Skip to content

Commit 5625751

Browse files
authored
Merge pull request #1145 from mathjax/fix/let-order
Have \let look up macros first then delimiters, and removes \\ delimiter
2 parents d765f3f + d0ccaef commit 5625751

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

ts/input/tex/base/BaseMappings.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ new sm.DelimiterMap('delimiter', ParseMethods.delimiter, {
348348
'/': '/',
349349
'|': ['|', { texClass: TEXCLASS.ORD }],
350350
'.': '',
351-
'\\\\': '\\',
352351
'\\lmoustache': '\u23B0', // non-standard
353352
'\\rmoustache': '\u23B1', // non-standard
354353
'\\lgroup': '\u27EE', // non-standard

ts/input/tex/newcommand/NewcommandMethods.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,6 @@ const NewcommandMethods: { [key: string]: ParseMethod } = {
131131
if (c === '\\') {
132132
// @test Let Bar, Let Brace Equal Stretchy
133133
name = NewcommandUtil.GetCSname(parser, name);
134-
let macro = handlers
135-
.get(HandlerType.DELIMITER)
136-
.lookup('\\' + name) as Token;
137-
if (macro) {
138-
// @test Let Bar, Let Brace Equal Stretchy
139-
NewcommandUtil.addDelimiter(
140-
parser,
141-
'\\' + cs,
142-
macro.char,
143-
macro.attributes
144-
);
145-
return;
146-
}
147134
const map = handlers.get(HandlerType.MACRO).applicable(name);
148135
if (!map) {
149136
// @test Let Undefined CS
@@ -161,6 +148,19 @@ const NewcommandMethods: { [key: string]: ParseMethod } = {
161148
);
162149
return;
163150
}
151+
let macro = handlers
152+
.get(HandlerType.DELIMITER)
153+
.lookup('\\' + name) as Token;
154+
if (macro) {
155+
// @test Let Bar, Let Brace Equal Stretchy
156+
NewcommandUtil.addDelimiter(
157+
parser,
158+
'\\' + cs,
159+
macro.char,
160+
macro.attributes
161+
);
162+
return;
163+
}
164164
macro = (map as sm.CharacterMap).lookup(name) as Token;
165165
// @test Let Relet, Let Let, Let Circular Macro
166166
const method = (p: TexParser) => map.parser(p, macro);

0 commit comments

Comments
 (0)