Skip to content

Commit

Permalink
Fix problem where errors during mhchem argument collection are not pr…
Browse files Browse the repository at this point in the history
…operly handled. (mathjax/MathJax#2835)
  • Loading branch information
dpvc committed Feb 19, 2022
1 parent 611a48c commit e4528de
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ts/input/tex/mhchem/MhchemConfiguration.ts
Expand Up @@ -43,14 +43,15 @@ MhchemMethods.xArrow = AmsMethods.xArrow;
* @param{string} machine The name of the fininte-state machine to use
*/
MhchemMethods.Machine = function(parser: TexParser, name: string, machine: 'tex' | 'ce' | 'pu') {
let arg = parser.GetArgument(name);
let tex;
try {
let arg = parser.GetArgument(name);
let tex = mhchemParser.toTex(arg, machine);
parser.string = tex + parser.string.substr(parser.i);
parser.i = 0;
tex = mhchemParser.toTex(arg, machine);
} catch (err) {
throw new TexError(err[0], err[1], err.slice(2));
throw new TexError(err[0], err[1]);
}
parser.string = tex + parser.string.substr(parser.i);
parser.i = 0;
};

new CommandMap(
Expand Down

0 comments on commit e4528de

Please sign in to comment.