-
Notifications
You must be signed in to change notification settings - Fork 346
In-line math alignment #2255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
In-line math alignment #2255
Conversation
Inline math alignment
I think we need more information than the 2 small screenshots you've provided. Here's an example with in-line math on a sphinx-gallery-generated page that doesn't have that problem: The first paragraph of that section has several inline In the "notes" section of that docstring there are several, most notably in item 5 of the numbered list. Again they all look fine (and not noticeably different from on the sphinx-gallery-generated page). So, can you say more about exactly what conditions cause the error? Simply using sphinx-gallery doesn't seem to be enough to trigger the problem. Links to the docs / pages in question would help. Even better would be a minimal example site (e.g., starting from |
Thanks for the reply, the examples from your links look normal for me as well. The bug happens on this web-site: https://docs.wulfric.org/en/latest/ when option
in docs/source/_static/wulfric.css Note, that by default this option is turned on, thus no bug is visible. Bug occurs on the page https://docs.wulfric.org/en/latest/user-guide/conventions/bravais-lattices/2_sc/plot_01_CUB.html just on top of it: symbol No bug occurs on another one, that is not produced by sphinx-gallery https://docs.wulfric.org/en/latest/user-guide/conventions/basic-notation.html I will try to prepare minimal project that reproduces this bug in the following days. |
OK so at a glance: Your sphinx-gallery-generated page has a different internal structure for the mathjax elements. SG-pages have (simplified): <span class="math notranslate nohighlight">
<span class="MathJax_Preview" ...></span>
<span class="MathJax_SVG" ...>
<svg>...</svg>
<span class="MJX_Assistive_MathML" ...>
<math ...>...</math>
</span>
</span>
<script ...>...</script>
</span> whereas the non-SG pages have: <span class="math notranslate nohighlight">
<mjx-container class="MathJax CtxtMenu_Attached_0" ...>
<mjx-math class="MJX-TEX" ...>
<mjx-mi class="mjx-b mjx-i">
<mjx-c class="mjx-c1D493 TEX-BI"></mjx-c>
</mjx-mi>
</mjx-math>
<mjx-assistive-mml ...>
<math ...>
<mi ...>...</mi>
</math>
</mjx-assistive-mml>
</mjx-container>
</span> So the nodes are different (e.g. span vs mjx-container at the top level) and the classes are different. I don't know why (different versions of MathJax used during SG build vs the rest of the site? seems weird but probably possible). If I look at the page source for the two links I provided from MNE-Python docs, both have |
So I prepared the small demo: pst-2255.tar.gz My local environmentMacOS 13.7.7 Steps to build:
How the bug looks like![]() What I found out
SummaryThe bug needs at least three components to appear pydata theme + sphinx gallery. + plotly figure (with those lines in conf.py). It might not be the bug specifically of the pydata theme. However, as at least three other themes handle the same demo gallery without any problems, the fix on the side of pydata theme seems to be appropriate. |
Hello,
I encountered a problem with math's rendering on pages produced by sphinx-gallery. It does not occur on their documentation web-page, but does occur when I build documentation of my project.
Here is misaligned version:
Here is version that is build with proposed change:
I do not have experience with css styling, perhaps proposed solution is not an adequate one.
I would be grateful if someone with more experience can comment on this topic.
Best,
Andrey