-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bug: underscore not handled correctly in \text{} macro #1770
Comments
That is expected behavior, cf. http://docs.mathjax.org/en/latest/tex.html#mathjax-tex-and-latex-support. |
See also this forum post for a possible work-around. |
Seems awkward. In practice, I should be using \mathrm or \operatorname instead so that the fonts are correct, and these can be done with the same syntax in latex (both with the backslash before the underscore). On further investigation of font issues, the following renders using the same font in latex, but on the mathjax demo page (OS/X firefox) the first character is serif and the second is sans serif:
The first character renders with style="font-family: STIXGeneral;" in the text span, and style="... font-size: 120%;" in the $$ span. The second character inherits font-family and font-size directly from body. Latex renders these both with \familydefault. |
Yes, As I pointed out, you can override the As for your example of MathJax is not LaTeX, and it only handles math content. The rest of the page is marked up using HTML, and MathJax lives within that large ecosystem. The fact that the math font and the surrounding text font are different is not a bug, it is the expected behavior. |
The other option is to support underscore in latex text mode without the leading backslash. This can be done by adding a latex preamble to support underscores without backslashes:
I'm including it for those who have the same problem in future and stumble across this discussion. |
Issue Summary
With the amsmath package, LaTeX raises an error on
\text{underscore_separated}
unless there is a leading backslash before the underscore. Mathjax renders with and without the backslash, but shows the backslash if it is included. This means that you cannot use the same input for both html and latex markup.Steps to Reproduce
paste the following into the mathjax live demo page
erfc is the complementary error function$1 - \text{error_function}(x)$ .
Compare this to the same markup in LaTeX (via overleaf shared latex editor):
https://www.overleaf.com/read/xdcwcrkkwkns
Technical details
The text was updated successfully, but these errors were encountered: