From 90d4aff5fa0db20c6a0491ed449d4f0718cbefd3 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 3 Sep 2025 09:41:03 -0400 Subject: [PATCH] Allow spaces after `@` in CD environment, as in real LaTeX. (mathjax/MathJax#3425) --- testsuite/tests/input/tex/Amscd.test.ts | 29 +++++++++++++++++++++++++ ts/input/tex/amscd/AmsCdMethods.ts | 4 +++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/input/tex/Amscd.test.ts b/testsuite/tests/input/tex/Amscd.test.ts index ff09abb12..bc856d815 100644 --- a/testsuite/tests/input/tex/Amscd.test.ts +++ b/testsuite/tests/input/tex/Amscd.test.ts @@ -752,6 +752,35 @@ describe('AmsCD', () => { /********************************************************************************/ + it('Spaces', () => { + toXmlMatch( + tex2mml('\\begin{CD}A @ > x > > B \\end{CD}'), + ` + + + + A + + + + + + + x + + + + + B + + + + ` + ); + }); + + /********************************************************************************/ + it('Suspicious Return', () => { toXmlMatch( tex2mml('\\begin{CD}A @Ra>> BaD\\end{CD}'), diff --git a/ts/input/tex/amscd/AmsCdMethods.ts b/ts/input/tex/amscd/AmsCdMethods.ts index 94660fc9e..85882ab5d 100644 --- a/ts/input/tex/amscd/AmsCdMethods.ts +++ b/ts/input/tex/amscd/AmsCdMethods.ts @@ -64,9 +64,11 @@ const AmsCdMethods: { [key: string]: ParseMethod } = { * @returns {void} No value. */ arrow(parser: TexParser, name: string): void { - const c = parser.string.charAt(parser.i); + const i = parser.i; + const c = parser.GetNext(); if (!c.match(/[>