jupyter-book / mystmd

Command line tools for working with MyST Markdown.
https://mystmd.org/guide
MIT License
192 stars 60 forks source link

Differences between KaTeX and MathJax (underscore in text math) #1267

Open rowanc1 opened 3 months ago

rowanc1 commented 3 months ago

It looks like if you have \text{something_with_underscores} in a math block, this works in MathJax and Jupyter, but with fail in MyST. This is due to the differences between LaTeX/KaTeX/MathJax:

Apparently this is actually incorrect LaTeX, but has been introduced as acceptable by MathJax. I think that MyST should parse this (via regexp) and patch it (and or react to the error, and fix it at that stage). This would support, for example, numpy-tutorials to have a smoother onboarding experience.

cc @melissawm @fperez (Note also that the numpy-tutorials content currently doesn't render in VSCode becase of this!)

melissawm commented 3 months ago

Thanks, @rowanc1 ! We got around it by escaping the underscore, but would definitely be great to see a fix.