Skip to content

Commit 066962a

Browse files
committed
Takes care of the final case for let mapping non-command delimiters.
1 parent 8b5fedb commit 066962a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mathjax3-ts/input/tex/newcommand/NewcommandMethods.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ NewcommandMethods.Let = function(parser: TexParser, name: string) {
131131
// to \def\cs{char}, which is as close as MathJax can get for this.
132132
// So \let\bgroup={ is possible, but doesn't work as it does in TeX.
133133
//
134+
const handlers = parser.configuration.handlers;
134135
if (c === '\\') {
135136
name = GetCSname(parser, name);
136-
const handlers = parser.configuration.handlers;
137137
macro = handlers.get('delimiter').lookup('\\' + name) as Symbol;
138138
if (macro) {
139139
(MapHandler.getInstance().getMap('new-Delimiter') as sm.DelimiterMap).
@@ -162,10 +162,16 @@ NewcommandMethods.Let = function(parser: TexParser, name: string) {
162162
}
163163
} else {
164164
// TODO: Add the delimiter case for elements like [],()
165+
parser.i++;
166+
macro = handlers.get('delimiter').lookup(c) as Symbol;
167+
if (macro) {
168+
(MapHandler.getInstance().getMap('new-Delimiter') as sm.DelimiterMap).
169+
add('\\' + cs, new Symbol('\\' + cs, macro.char, macro.attributes));
170+
return;
171+
}
165172
let newMacros = MapHandler.getInstance().getMap('new-Command') as sm.CommandMap;
166173
newMacros.add(cs,
167174
new Macro('Macro', NewcommandMethods.Macro, [c]));
168-
parser.i++;
169175
}
170176
};
171177

0 commit comments

Comments
 (0)