Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write multipe math equations inline on a single line in Sphinx

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.

I have installed Furo as my default theme, try to write logic formula :

math formula
===================
p1:

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


p2:

.. raw:: html

   <!DOCTYPE html>
   <html>
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width">
     <title>MathJax example</title>
   <script type="text/javascript" async
     src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
   </script>
   <script type="text/x-mathjax-config">
   MathJax.Hub.Config({
     tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
   });
   </script>
   </head>
   <body>
   We know that `A \to B \vdash A \to \forall x B`, provided that `x` is not free in `A`.
   </body>
   </html>

The appearance:

enter image description here

If i delete the p2 part,all multipe math equations inline can't be on a single line shown in my browser:

enter image description here

How can fix it then?

like image 901
showkey Avatar asked Sep 01 '25 20:09

showkey


1 Answers

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.

like image 151
Lex Li Avatar answered Sep 03 '25 11:09

Lex Li