-
Notifications
You must be signed in to change notification settings - Fork 96
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
how to fix “missing open brace on subscript”? #491
Comments
If you do npm list mathjax you should get the version of MathJax that you have installed. Because the npm install mathjax@2.7.9 should update the version that you have. If you want to force it to 2.7.5, then use npm install mathjax@2.7.5 MathJax does not have a message "missing open brace on subscript", but there are messages that say "Extra close brace or missing open brace", so perhaps that is what you are getting. That indicates a misbalanced brace, so there may be something wrong with the bracing in your expression. If that changes from one version to another, it may be because you haven't braced an argument to a macro properly. If you post the expression that is giving you trouble, we may be able to point out what is causing the issue. |
Yes,as you said,Mathjax-node parser worked well without error. It happened on rendering the svg labels to the web,even through postman. Let me show an example:
as shown, underline in the end is a blank position to fill by the answer student. and then I remove '\(':
it would occr "Missing open brace for subscript" which cased by the underline in the end. Thank you for your help. |
The mathjax-node mathjax.typeset({
math: "\\(∠AOB=50^{\circ}\\),\\(∠AOC=\\) ______ .",
... (other parameters) ...
}); MathJax is treating the math string as TeX code to be processed. Note that for javascript strings, the backslash, When you remove the delimiters and try to do mathjax.typeset({
math: "∠AOB=50^{\circ},∠AOC= ______ .",
... (other parameters) ...
}); The entire string is considered to be TeX code, including the underscores at the end. It is those underscores that are producing the error, as they are being interpreted to mean "produce a subscript", as that is the meaning of underscores in TeX's math mode. The first underscore starts a subscript, and then the second tries to make a second subscript, and that is not allowed (you need to use braces after the first underscore in order to have a second underscore with no preceding base character). So that is the source of the error you are getting, which is the correct result. Note also that the So there is no problem with the MathJax version or with mathjax-node, it is just that you are not providing the right input for MathJax to process. On a side note, most of your configuration is unnecessary for mathjax-node. The in-line and display delimiters are never used, since the string you pass |
/ As you said,the underscore is a special charactor to Mathjax. and I'v tried to remove or replace them to its html code _ to avoid such error. It does work. but underscores are missing. Could you tell me how to keep them in the result? |
It's easy to convert underline(_) to backslash and underline(\_) to avoid parsing error. |
Are the underscores really supposed to be part of the math expression? Or should that be part of the surrounding HTML? You need to process the math separately from plain text, in general. So I would expect you to process Alternatively, you could use
The main special characters are |
I use Mathjax-node release version to parse to svg, and when displaying svg on web, “missing open brace on subscript” error occurs.
But when I use Mathjax 2.7.5 to parse and display the same source senetences, there is no such error.
So,which version of Mathjax in Mathjax -node? How can I change version Mathjax in Mathjax-node to 2.7.5?
The text was updated successfully, but these errors were encountered: