-
-
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
mhchem TeX extension breaks internally when leaving out closing bracket #2835
Comments
https://github.com/mhchem/MathJax-mhchem/ is a better place for mhchem issues. mhchem/MathJax-mhchem#20 looks potentially similar. |
Thanks! Looks like a match indeed. |
On another thought, I'm not sure if the issue is with |
@wb-joona, thanks a lot for this bugreport, in particular your live minimal reproducible example. That was very helpful. The issue is in MhchemConfiguration.ts try {
let arg = parser.GetArgument(name);
let tex = mhchemParser.toTex(arg, machine);
parser.string = tex + parser.string.substr(parser.i);
parser.i = 0;
} catch (err) {
throw new TexError(err[0], err[1], err.slice(2));
} The issue is that the first line ( As the TeXErrors are catched further above, anyway, it should be enough to "try" mhchemParser, shouldn't it? @pkra, @zorkow let arg = parser.GetArgument(name);
try {
let tex = mhchemParser.toTex(arg, machine);
} catch (err) {
throw new TexError(err[0], err[1]);
}
parser.string = tex + parser.string.substr(parser.i);
parser.i = 0; |
I have made a PR to address the issue based on @mhchem 's suggestion, which was right on target. |
Fix problem where errors during mhchem argument collection are not properly handled. (mathjax/MathJax#2835)
Issue Summary
TeX
mhchem
input extension produces an error from the internals when not closing the\ce
command.Steps to Reproduce:
Live minimal reproducible example here: https://codesandbox.io/s/nice-dhawan-yu49p?file=/index.html
tex-chtml.js
\ce{H2O
I would expect that with
noerrors
loaded, I would see some output at least. This error appears to break the rendering though.The error appears to be originating here:
https://github.com/mathjax/MathJax-src/blob/2dd53ce6c8af3c9cceba0baf014ea9b065130774/ts/input/tex/mhchem/MhchemConfiguration.ts#L51-L53
The
catch
appears to assume that the error is an array, but the actual error emitted here is the following object:and thus there is no
.slice()
.Technical details:
Supporting information:
The text was updated successfully, but these errors were encountered: