Skip to content

Commit

Permalink
Merge pull request #1145 from mathjax/fix/let-order
Browse files Browse the repository at this point in the history
Have \let look up macros first then delimiters, and removes \\ delimiter
  • Loading branch information
dpvc authored Nov 12, 2024
2 parents d765f3f + d0ccaef commit 5625751
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion ts/input/tex/base/BaseMappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ new sm.DelimiterMap('delimiter', ParseMethods.delimiter, {
'/': '/',
'|': ['|', { texClass: TEXCLASS.ORD }],
'.': '',
'\\\\': '\\',
'\\lmoustache': '\u23B0', // non-standard
'\\rmoustache': '\u23B1', // non-standard
'\\lgroup': '\u27EE', // non-standard
Expand Down
26 changes: 13 additions & 13 deletions ts/input/tex/newcommand/NewcommandMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,6 @@ const NewcommandMethods: { [key: string]: ParseMethod } = {
if (c === '\\') {
// @test Let Bar, Let Brace Equal Stretchy
name = NewcommandUtil.GetCSname(parser, name);
let macro = handlers
.get(HandlerType.DELIMITER)
.lookup('\\' + name) as Token;
if (macro) {
// @test Let Bar, Let Brace Equal Stretchy
NewcommandUtil.addDelimiter(
parser,
'\\' + cs,
macro.char,
macro.attributes
);
return;
}
const map = handlers.get(HandlerType.MACRO).applicable(name);
if (!map) {
// @test Let Undefined CS
Expand All @@ -161,6 +148,19 @@ const NewcommandMethods: { [key: string]: ParseMethod } = {
);
return;
}
let macro = handlers
.get(HandlerType.DELIMITER)
.lookup('\\' + name) as Token;
if (macro) {
// @test Let Bar, Let Brace Equal Stretchy
NewcommandUtil.addDelimiter(
parser,
'\\' + cs,
macro.char,
macro.attributes
);
return;
}
macro = (map as sm.CharacterMap).lookup(name) as Token;
// @test Let Relet, Let Let, Let Circular Macro
const method = (p: TexParser) => map.parser(p, macro);
Expand Down

0 comments on commit 5625751

Please sign in to comment.