Skip to content

Commit 451bd4e

Browse files
authored
Merge pull request #1343 from mathjax/issue3425
Allow spaces after `@` in CD environment, as in real LaTeX. (mathjax/MathJax#3425)
2 parents 4318ee0 + 90d4aff commit 451bd4e

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

testsuite/tests/input/tex/Amscd.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,35 @@ describe('AmsCD', () => {
752752

753753
/********************************************************************************/
754754

755+
it('Spaces', () => {
756+
toXmlMatch(
757+
tex2mml('\\begin{CD}A @ > x > > B \\end{CD}'),
758+
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{CD}A @ &gt; x &gt; &gt; B \\end{CD}" display="block">
759+
<mtable columnspacing="5pt" rowspacing="5pt" displaystyle="true" data-latex-item="{CD}" data-latex="\\begin{CD}A @ &gt; x &gt; &gt; B \\end{CD}">
760+
<mtr>
761+
<mtd>
762+
<mi data-latex="A">A</mi>
763+
<mpadded height="8.5pt" depth="2pt"></mpadded>
764+
</mtd>
765+
<mtd>
766+
<mover>
767+
<mo minsize="2.75em">&#x2192;</mo>
768+
<mpadded width="+.67em" lspace=".33em" voffset=".1em">
769+
<mi data-latex="x">x</mi>
770+
</mpadded>
771+
</mover>
772+
</mtd>
773+
<mtd>
774+
<mi data-latex="B">B</mi>
775+
</mtd>
776+
</mtr>
777+
</mtable>
778+
</math>`
779+
);
780+
});
781+
782+
/********************************************************************************/
783+
755784
it('Suspicious Return', () => {
756785
toXmlMatch(
757786
tex2mml('\\begin{CD}A @Ra>> BaD\\end{CD}'),

ts/input/tex/amscd/AmsCdMethods.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ const AmsCdMethods: { [key: string]: ParseMethod } = {
6464
* @returns {void} No value.
6565
*/
6666
arrow(parser: TexParser, name: string): void {
67-
const c = parser.string.charAt(parser.i);
67+
const i = parser.i;
68+
const c = parser.GetNext();
6869
if (!c.match(/[><VA.|=]/)) {
6970
// TODO: This return is suspicious.
71+
parser.i = i;
7072
return Other(parser, name);
7173
} else {
7274
parser.i++;

0 commit comments

Comments
 (0)