Search code examples
htmlcsspython-sphinxrestructuredtext

How can write the line in Sphinx reST?


I want to write a simple line as below in my Sphinx reST document:
enter image description here

To write the line using :math: flag:

We know that :math:`A \to B \vdash A \to \forall x B`, provided that :math:`x` is not free in :math:`A`.

The appearance shown in browser after make html:

enter image description here

How can make it a one line without line break?
I want to tune the line with restructuredtext grammar to get the desired appearnce ,instead of tune the html or css code.


Solution

  • Whether you like it or not, the result of make html is HTML and CSS so the rendering will be fully controlled by the rules.

    Your snippet in reStructuredText is compiled to the following HTML elements,

    <p>We know that <span class="math notranslate nohighlight">\(A \to B \vdash A \to \forall x B\)</span>, provided that <span class="math notranslate nohighlight">\(x\)</span> is not free in <span class="math notranslate nohighlight">\(A\)</span>.</p>
    

    So, when I use the Furo theme to test, the preview looks like this,

    enter image description here

    You see something differently, probably because the theme you chose aligns elements another way.