diff --git a/ts/input/tex/TexParser.ts b/ts/input/tex/TexParser.ts index f5d518ead..aff32b327 100644 --- a/ts/input/tex/TexParser.ts +++ b/ts/input/tex/TexParser.ts @@ -558,7 +558,8 @@ export default class TexParser { str = '\\' + str; } // These are the cases to handle sub and superscripts. - if (node.attributes.get(TexConstant.Attr.LATEX) === '^' && str !== '^') { + if (node.attributes.get(TexConstant.Attr.LATEX) === '^' && + str !== '^' && str !== '\\^') { if (str === '}') { this.composeBraces(node.childNodes[2]); } else { @@ -572,7 +573,8 @@ export default class TexParser { } return; } - if (node.attributes.get(TexConstant.Attr.LATEX) === '_' && str !== '_') { + if (node.attributes.get(TexConstant.Attr.LATEX) === '_' && + str !== '_' && str !== '\\_') { if (str === '}') { this.composeBraces(node.childNodes[1]); } else {