From c169f741c0473d63ac83d5ff94f5932af91abe82 Mon Sep 17 00:00:00 2001 From: zorkow Date: Sun, 12 Jul 2026 09:46:03 +0200 Subject: [PATCH 01/11] fix latex attributes for rows in array-like expressions --- ts/input/tex/base/BaseItems.ts | 48 +++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index a2eb4d66b..f3f99016d 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -965,6 +965,14 @@ export class ArrayItem extends BaseItem { */ public row: MmlNode[] = []; + /** + * The LaTeX source for the content cells of the current row, used to + * reconstruct the `data-latex` attribute of the row (mtr/mlabeledtr) node. + * + * @type {string[]} + */ + public rowLatex: string[] = []; + /** * Frame specification as a list of pairs of strings [side, style]. * @@ -1346,6 +1354,7 @@ export class ArrayItem extends BaseItem { this.breakAlign.cell = ''; // this.row.push(mtd); + this.rowLatex.push(this.cellLatex(mtd)); this.Clear(); this.hfill = []; } @@ -1370,12 +1379,49 @@ export class ArrayItem extends BaseItem { NodeUtil.setAttribute(node, 'data-break-align', this.breakAlign.row); this.breakAlign.row = ''; } - this.addLatexItem(node); + this.setRowLatex(node); this.table.push(node); this.row = []; + this.rowLatex = []; this.atEnd = false; } + /** + * Reconstructs the LaTeX source of a single table cell from the `data-latex` + * attributes of its content nodes. + * + * @param {MmlNode} mtd The mtd node whose content is reconstructed. + * @returns {string} The LaTeX source of the cell content. + */ + public cellLatex(mtd: MmlNode): string { + const children = mtd.childNodes[0]?.childNodes || []; + let expr = ''; + for (const child of children) { + const att = (child?.attributes?.get(TexConstant.Attr.LATEX) || + '') as string; + if (!att) continue; + expr += + expr && expr.match(/[a-zA-Z]$/) && att.match(/^[a-zA-Z]/) + ? ' ' + att + : att; + } + return expr; + } + + /** + * Sets the `data-latex` attribute of a row node by joining the LaTeX source + * of its content cells with `&`. + * + * @param {MmlNode} node The mtr/mlabeledtr node. + */ + public setRowLatex(node: MmlNode) { + const tex = this.rowLatex.join('&'); + if (tex) { + node.attributes.set(TexConstant.Attr.LATEXITEM, tex); + node.attributes.set(TexConstant.Attr.LATEX, tex); + } + } + /** * Finishes the table layout. */ From 1d90849e453251a5040e1624a8cbe1a945369567 Mon Sep 17 00:00:00 2001 From: zorkow Date: Sun, 12 Jul 2026 09:47:11 +0200 Subject: [PATCH 02/11] update tests to for new LaTeX output in rows --- .../input/tex/__snapshots__/Ams.test.ts.snap | 230 +++--- .../tex/__snapshots__/Amscd.test.ts.snap | 66 +- .../tex/__snapshots__/Autoload.test.ts.snap | 2 +- .../input/tex/__snapshots__/Base.test.ts.snap | 369 +++++----- .../tex/__snapshots__/Cases.test.ts.snap | 34 +- .../tex/__snapshots__/Colortbl.test.ts.snap | 50 +- .../tex/__snapshots__/Empheq.test.ts.snap | 38 +- .../tex/__snapshots__/Mathtools.test.ts.snap | 330 ++++----- .../tex/__snapshots__/Newcommand.test.ts.snap | 10 +- .../tex/__snapshots__/Physics.test.ts.snap | 684 +++++++++--------- .../input/tex/__snapshots__/Tag.test.ts.snap | 168 ++--- .../tex/__snapshots__/TagFormat.test.ts.snap | 12 +- .../input/tex/__snapshots__/Tex.test.ts.snap | 2 +- 13 files changed, 997 insertions(+), 998 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap index f76f8eee6..15f1f6d89 100644 --- a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap @@ -185,7 +185,7 @@ exports[`Ams Complex A Cross Product Formula 1`] = ` | - + i @@ -202,7 +202,7 @@ exports[`Ams Complex A Cross Product Formula 1`] = ` - + @@ -231,7 +231,7 @@ exports[`Ams Complex A Cross Product Formula 1`] = ` 0 - + @@ -269,7 +269,7 @@ exports[`Ams Complex A Cross Product Formula 1`] = ` exports[`Ams Complex Cubic Binomial 1`] = ` " - + ( x @@ -307,7 +307,7 @@ exports[`Ams Complex Cubic Binomial 1`] = ` - + @@ -370,7 +370,7 @@ exports[`Ams Complex Cubic Binomial 1`] = ` - + @@ -427,7 +427,7 @@ exports[`Ams Complex Cubic Binomial 1`] = ` exports[`Ams Complex Maxwell's Equations 1`] = ` " - + × @@ -486,7 +486,7 @@ exports[`Ams Complex Maxwell's Equations 1`] = ` - + @@ -509,7 +509,7 @@ exports[`Ams Complex Maxwell's Equations 1`] = ` - + × @@ -562,7 +562,7 @@ exports[`Ams Complex Maxwell's Equations 1`] = ` - + @@ -590,7 +590,7 @@ exports[`Ams Complex Maxwell's Equations 1`] = ` exports[`Ams Complex The Lorenz Equations 1`] = ` " - + @@ -612,7 +612,7 @@ exports[`Ams Complex The Lorenz Equations 1`] = ` - + @@ -635,7 +635,7 @@ exports[`Ams Complex The Lorenz Equations 1`] = ` - + @@ -760,7 +760,7 @@ exports[`Ams Display Sub Fraction 1`] = ` exports[`Ams Environments Align 1`] = ` " - + a @@ -772,7 +772,7 @@ exports[`Ams Environments Align 1`] = ` - + c @@ -791,7 +791,7 @@ exports[`Ams Environments Align 1`] = ` exports[`Ams Environments Align Star 1`] = ` " - + a @@ -803,7 +803,7 @@ exports[`Ams Environments Align Star 1`] = ` - + c @@ -822,7 +822,7 @@ exports[`Ams Environments Align Star 1`] = ` exports[`Ams Environments Alignat 1`] = ` " - + a @@ -834,7 +834,7 @@ exports[`Ams Environments Alignat 1`] = ` - + c @@ -853,7 +853,7 @@ exports[`Ams Environments Alignat 1`] = ` exports[`Ams Environments Alignat Star 1`] = ` " - + a @@ -865,7 +865,7 @@ exports[`Ams Environments Alignat Star 1`] = ` - + c @@ -884,7 +884,7 @@ exports[`Ams Environments Alignat Star 1`] = ` exports[`Ams Environments Aligned 1`] = ` " - + a @@ -894,7 +894,7 @@ exports[`Ams Environments Aligned 1`] = ` = b - + r @@ -906,7 +906,7 @@ exports[`Ams Environments Aligned 1`] = ` - + @@ -920,7 +920,7 @@ exports[`Ams Environments Aligned 1`] = ` - + c @@ -939,7 +939,7 @@ exports[`Ams Environments Aligned 1`] = ` exports[`Ams Environments Alignedat 1`] = ` " - + a @@ -949,7 +949,7 @@ exports[`Ams Environments Alignedat 1`] = ` = b - + r @@ -961,7 +961,7 @@ exports[`Ams Environments Alignedat 1`] = ` - + @@ -975,7 +975,7 @@ exports[`Ams Environments Alignedat 1`] = ` - + c @@ -996,7 +996,7 @@ exports[`Ams Environments Bmatrix 1`] = ` { - + a @@ -1004,7 +1004,7 @@ exports[`Ams Environments Bmatrix 1`] = ` b - + c @@ -1021,7 +1021,7 @@ exports[`Ams Environments Bmatrix 1`] = ` exports[`Ams Environments Eqnarray 1`] = ` " - + a @@ -1035,7 +1035,7 @@ exports[`Ams Environments Eqnarray 1`] = ` - + c @@ -1056,7 +1056,7 @@ exports[`Ams Environments Eqnarray 1`] = ` exports[`Ams Environments Eqnarray Star 1`] = ` " - + a @@ -1070,7 +1070,7 @@ exports[`Ams Environments Eqnarray Star 1`] = ` - + c @@ -1103,14 +1103,14 @@ exports[`Ams Environments Equation Star 1`] = ` exports[`Ams Environments Gather 1`] = ` " - + a = b - + c = @@ -1124,14 +1124,14 @@ exports[`Ams Environments Gather 1`] = ` exports[`Ams Environments Gather Star 1`] = ` " - + a = b - + c = @@ -1145,7 +1145,7 @@ exports[`Ams Environments Gather Star 1`] = ` exports[`Ams Environments Gathered 1`] = ` " - + a @@ -1155,14 +1155,14 @@ exports[`Ams Environments Gathered 1`] = ` = b - + r = s - + = t @@ -1172,7 +1172,7 @@ exports[`Ams Environments Gathered 1`] = ` - + c @@ -1236,7 +1236,7 @@ exports[`Ams Environments Small Matrix 1`] = ` " - + a @@ -1249,7 +1249,7 @@ exports[`Ams Environments Small Matrix 1`] = ` exports[`Ams Environments Split 1`] = ` " - + a @@ -1259,7 +1259,7 @@ exports[`Ams Environments Split 1`] = ` = b - + r @@ -1271,7 +1271,7 @@ exports[`Ams Environments Split 1`] = ` - + @@ -1285,7 +1285,7 @@ exports[`Ams Environments Split 1`] = ` - + c @@ -1305,7 +1305,7 @@ exports[`Ams Environments Subarray 1`] = ` " - + a @@ -1320,7 +1320,7 @@ exports[`Ams Environments Vmatrix 1`] = ` - + a @@ -1328,7 +1328,7 @@ exports[`Ams Environments Vmatrix 1`] = ` b - + c @@ -1347,7 +1347,7 @@ exports[`Ams Environments bmatrix 1`] = ` [ - + a @@ -1355,7 +1355,7 @@ exports[`Ams Environments bmatrix 1`] = ` b - + c @@ -1379,7 +1379,7 @@ exports[`Ams Environments cases 1`] = ` { - + 1 @@ -1394,7 +1394,7 @@ exports[`Ams Environments cases 1`] = ` - + 0 @@ -1411,7 +1411,7 @@ exports[`Ams Environments cases 1`] = ` exports[`Ams Environments flalign 1`] = ` " - + a @@ -1426,7 +1426,7 @@ exports[`Ams Environments flalign 1`] = ` b - + c @@ -1448,7 +1448,7 @@ exports[`Ams Environments flalign 1`] = ` exports[`Ams Environments flalign small 1`] = ` " - + a @@ -1465,7 +1465,7 @@ exports[`Ams Environments flalign small 1`] = ` exports[`Ams Environments matrix 1`] = ` " - + a @@ -1473,7 +1473,7 @@ exports[`Ams Environments matrix 1`] = ` b - + c @@ -1490,7 +1490,7 @@ exports[`Ams Environments pmatrix 1`] = ` ( - + a @@ -1498,7 +1498,7 @@ exports[`Ams Environments pmatrix 1`] = ` b - + c @@ -1515,7 +1515,7 @@ exports[`Ams Environments pmatrix 1`] = ` exports[`Ams Environments xalign tagged 1`] = ` " - + ( @@ -1546,7 +1546,7 @@ exports[`Ams Environments xalign tagged 1`] = ` exports[`Ams Environments xalignat 1`] = ` " - + a @@ -1574,7 +1574,7 @@ exports[`Ams Environments xalignat 1`] = ` exports[`Ams Environments xalignat padding 1`] = ` " - + a @@ -1598,7 +1598,7 @@ exports[`Ams Environments xalignat padding 1`] = ` exports[`Ams Environments xxalignat 1`] = ` " - + a @@ -2006,7 +2006,7 @@ exports[`Ams Symbol 1`] = ` exports[`Ams Tagged Environments Align 1`] = ` " - + ( 1 @@ -2023,7 +2023,7 @@ exports[`Ams Tagged Environments Align 1`] = ` - + ( 2 @@ -2047,7 +2047,7 @@ exports[`Ams Tagged Environments Align 1`] = ` exports[`Ams Tagged Environments Align Notag 1`] = ` " - + ( 1 @@ -2064,7 +2064,7 @@ exports[`Ams Tagged Environments Align Notag 1`] = ` - + @@ -2081,7 +2081,7 @@ exports[`Ams Tagged Environments Align Notag 1`] = ` exports[`Ams Tagged Environments Align Star 1`] = ` " - + a @@ -2093,7 +2093,7 @@ exports[`Ams Tagged Environments Align Star 1`] = ` - + c @@ -2112,7 +2112,7 @@ exports[`Ams Tagged Environments Align Star 1`] = ` exports[`Ams Tagged Environments Alignat 1`] = ` " - + ( 1 @@ -2129,7 +2129,7 @@ exports[`Ams Tagged Environments Alignat 1`] = ` - + ( 2 @@ -2153,7 +2153,7 @@ exports[`Ams Tagged Environments Alignat 1`] = ` exports[`Ams Tagged Environments Alignat Star 1`] = ` " - + a @@ -2165,7 +2165,7 @@ exports[`Ams Tagged Environments Alignat Star 1`] = ` - + c @@ -2184,7 +2184,7 @@ exports[`Ams Tagged Environments Alignat Star 1`] = ` exports[`Ams Tagged Environments Aligned 1`] = ` " - + a @@ -2194,7 +2194,7 @@ exports[`Ams Tagged Environments Aligned 1`] = ` = b - + r @@ -2206,7 +2206,7 @@ exports[`Ams Tagged Environments Aligned 1`] = ` - + @@ -2220,7 +2220,7 @@ exports[`Ams Tagged Environments Aligned 1`] = ` - + c @@ -2239,7 +2239,7 @@ exports[`Ams Tagged Environments Aligned 1`] = ` exports[`Ams Tagged Environments Alignedat 1`] = ` " - + a @@ -2249,7 +2249,7 @@ exports[`Ams Tagged Environments Alignedat 1`] = ` = b - + r @@ -2261,7 +2261,7 @@ exports[`Ams Tagged Environments Alignedat 1`] = ` - + @@ -2275,7 +2275,7 @@ exports[`Ams Tagged Environments Alignedat 1`] = ` - + c @@ -2294,7 +2294,7 @@ exports[`Ams Tagged Environments Alignedat 1`] = ` exports[`Ams Tagged Environments Eqnarray 1`] = ` " - + ( 1 @@ -2313,7 +2313,7 @@ exports[`Ams Tagged Environments Eqnarray 1`] = ` - + ( 2 @@ -2339,7 +2339,7 @@ exports[`Ams Tagged Environments Eqnarray 1`] = ` exports[`Ams Tagged Environments Eqnarray Star 1`] = ` " - + a @@ -2353,7 +2353,7 @@ exports[`Ams Tagged Environments Eqnarray Star 1`] = ` - + c @@ -2397,7 +2397,7 @@ exports[`Ams Tagged Environments Equation Star 1`] = ` exports[`Ams Tagged Environments Gather 1`] = ` " - + ( 1 @@ -2409,7 +2409,7 @@ exports[`Ams Tagged Environments Gather 1`] = ` b - + ( 2 @@ -2428,14 +2428,14 @@ exports[`Ams Tagged Environments Gather 1`] = ` exports[`Ams Tagged Environments Gather Star 1`] = ` " - + a = b - + c = @@ -2449,7 +2449,7 @@ exports[`Ams Tagged Environments Gather Star 1`] = ` exports[`Ams Tagged Environments Gathered 1`] = ` " - + a @@ -2459,14 +2459,14 @@ exports[`Ams Tagged Environments Gathered 1`] = ` = b - + r = s - + = t @@ -2476,7 +2476,7 @@ exports[`Ams Tagged Environments Gathered 1`] = ` - + c @@ -2495,7 +2495,7 @@ exports[`Ams Tagged Environments Gathered 1`] = ` exports[`Ams Tagged Environments Left Gather Align 1`] = ` " - + ( 2 @@ -2503,7 +2503,7 @@ exports[`Ams Tagged Environments Left Gather Align 1`] = ` - + ( 1 @@ -2547,7 +2547,7 @@ exports[`Ams Tagged Environments Left multline tagged left 1`] = ` exports[`Ams Tagged Environments Left xalign tagged left 1`] = ` " - + ( @@ -2628,7 +2628,7 @@ exports[`Ams Tagged Environments Small Matrix 1`] = ` " - + a @@ -2641,7 +2641,7 @@ exports[`Ams Tagged Environments Small Matrix 1`] = ` exports[`Ams Tagged Environments Split 1`] = ` " - + a @@ -2651,7 +2651,7 @@ exports[`Ams Tagged Environments Split 1`] = ` = b - + r @@ -2663,7 +2663,7 @@ exports[`Ams Tagged Environments Split 1`] = ` - + @@ -2677,7 +2677,7 @@ exports[`Ams Tagged Environments Split 1`] = ` - + c @@ -2697,7 +2697,7 @@ exports[`Ams Tagged Environments Subarray 1`] = ` " - + a @@ -2710,12 +2710,12 @@ exports[`Ams Tagged Environments Subarray 1`] = ` exports[`Ams Tagged Environments aligned [b] 1`] = ` " - + a - + b @@ -2727,7 +2727,7 @@ exports[`Ams Tagged Environments aligned [b] 1`] = ` exports[`Ams Tagged Environments aligned [x] 1`] = ` " - + [ x @@ -2735,7 +2735,7 @@ exports[`Ams Tagged Environments aligned [x] 1`] = ` a - + b @@ -2747,7 +2747,7 @@ exports[`Ams Tagged Environments aligned [x] 1`] = ` exports[`Ams Tagged Environments flalign 1`] = ` " - + ( 1 @@ -2771,7 +2771,7 @@ exports[`Ams Tagged Environments flalign 1`] = ` exports[`Ams Tagged Environments xalignet 1`] = ` " - + ( @@ -2797,7 +2797,7 @@ exports[`Ams Tagged Environments xalignet 1`] = ` exports[`Ams Tagged Environments xalignet star 1`] = ` " - + a @@ -2816,7 +2816,7 @@ exports[`Ams Tagged Environments xalignet star 1`] = ` exports[`Ams Tagged Environments xalignet star 2`] = ` " - + a @@ -3231,12 +3231,12 @@ exports[`Ams symbols substack 1`] = ` " - + a - + b diff --git a/testsuite/tests/input/tex/__snapshots__/Amscd.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Amscd.test.ts.snap index 47dc8e819..3594791d1 100644 --- a/testsuite/tests/input/tex/__snapshots__/Amscd.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Amscd.test.ts.snap @@ -3,7 +3,7 @@ exports[`AmsCD AmsCD-1 1`] = ` " - + A @@ -20,7 +20,7 @@ exports[`AmsCD AmsCD-1 1`] = ` B - + @@ -60,7 +60,7 @@ exports[`AmsCD AmsCD-1 1`] = ` - + C @@ -84,7 +84,7 @@ exports[`AmsCD AmsCD-1 1`] = ` exports[`AmsCD AmsCD-2 1`] = ` " - + A @@ -112,7 +112,7 @@ exports[`AmsCD AmsCD-2 1`] = ` C - + @@ -124,7 +124,7 @@ exports[`AmsCD AmsCD-2 1`] = ` - + @@ -146,7 +146,7 @@ exports[`AmsCD AmsCD-2 1`] = ` exports[`AmsCD AmsCD-3 1`] = ` " - + A @@ -166,7 +166,7 @@ exports[`AmsCD AmsCD-3 1`] = ` B - + @@ -232,7 +232,7 @@ exports[`AmsCD AmsCD-3 1`] = ` - + C @@ -259,7 +259,7 @@ exports[`AmsCD AmsCD-3 1`] = ` exports[`AmsCD AmsCD-4 1`] = ` " - + A @@ -287,7 +287,7 @@ exports[`AmsCD AmsCD-4 1`] = ` C - + @@ -301,7 +301,7 @@ exports[`AmsCD AmsCD-4 1`] = ` - + D @@ -336,7 +336,7 @@ exports[`AmsCD AmsCD-4 1`] = ` exports[`AmsCD AmsCD-5 1`] = ` " - + A @@ -366,7 +366,7 @@ exports[`AmsCD AmsCD-5 1`] = ` C - + @@ -380,7 +380,7 @@ exports[`AmsCD AmsCD-5 1`] = ` - + D @@ -421,7 +421,7 @@ exports[`AmsCD AmsCD-5 1`] = ` exports[`AmsCD AmsCD-6 1`] = ` " - + A @@ -451,7 +451,7 @@ exports[`AmsCD AmsCD-6 1`] = ` C - + @@ -465,7 +465,7 @@ exports[`AmsCD AmsCD-6 1`] = ` - + D @@ -516,7 +516,7 @@ exports[`AmsCD AmsCD-6 1`] = ` exports[`AmsCD AmsCD-both 1`] = ` " - + A @@ -533,7 +533,7 @@ exports[`AmsCD AmsCD-both 1`] = ` B - + @@ -573,7 +573,7 @@ exports[`AmsCD AmsCD-both 1`] = ` - + C @@ -597,7 +597,7 @@ exports[`AmsCD AmsCD-both 1`] = ` exports[`AmsCD AmsCD-height 1`] = ` " - + A @@ -614,7 +614,7 @@ exports[`AmsCD AmsCD-height 1`] = ` B - + @@ -654,7 +654,7 @@ exports[`AmsCD AmsCD-height 1`] = ` - + C @@ -678,7 +678,7 @@ exports[`AmsCD AmsCD-height 1`] = ` exports[`AmsCD AmsCD-width 1`] = ` " - + A @@ -695,7 +695,7 @@ exports[`AmsCD AmsCD-width 1`] = ` B - + @@ -735,7 +735,7 @@ exports[`AmsCD AmsCD-width 1`] = ` - + C @@ -759,7 +759,7 @@ exports[`AmsCD AmsCD-width 1`] = ` exports[`AmsCD Entry with prime (#3373) 1`] = ` " - + A @@ -786,7 +786,7 @@ exports[`AmsCD Entry with prime (#3373) 1`] = ` exports[`AmsCD Options Hide Horizontal Labels 1`] = ` " - + A @@ -805,7 +805,7 @@ exports[`AmsCD Options Hide Horizontal Labels 1`] = ` B - + @@ -845,7 +845,7 @@ exports[`AmsCD Options Hide Horizontal Labels 1`] = ` - + C @@ -871,7 +871,7 @@ exports[`AmsCD Options Hide Horizontal Labels 1`] = ` exports[`AmsCD Spaces 1`] = ` " - + A @@ -895,7 +895,7 @@ exports[`AmsCD Spaces 1`] = ` exports[`AmsCD Suspicious Return 1`] = ` " - + A @ diff --git a/testsuite/tests/input/tex/__snapshots__/Autoload.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Autoload.test.ts.snap index d0a71584f..fd4799027 100644 --- a/testsuite/tests/input/tex/__snapshots__/Autoload.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Autoload.test.ts.snap @@ -3,7 +3,7 @@ exports[`Autoload Autoload environment 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index 23cf581c2..4d91b7da5 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -194,7 +194,7 @@ exports[`Accents widetilde 1`] = ` exports[`Array Array Single 1`] = ` " - + a @@ -206,7 +206,7 @@ exports[`Array Array Single 1`] = ` exports[`Array Array aligned 1`] = ` " - + a @@ -218,7 +218,7 @@ exports[`Array Array aligned 1`] = ` exports[`Array Array aligned invalid 1`] = ` " - + a @@ -230,7 +230,7 @@ exports[`Array Array aligned invalid 1`] = ` exports[`Array Array dashed column 1`] = ` " - + a @@ -238,7 +238,7 @@ exports[`Array Array dashed column 1`] = ` c - + b @@ -253,12 +253,12 @@ exports[`Array Array dashed column 1`] = ` exports[`Array Array dashed row 1`] = ` " - + a - + b @@ -270,7 +270,7 @@ exports[`Array Array dashed row 1`] = ` exports[`Array Array solid column 1`] = ` " - + a @@ -278,7 +278,7 @@ exports[`Array Array solid column 1`] = ` c - + b @@ -293,12 +293,12 @@ exports[`Array Array solid column 1`] = ` exports[`Array Array solid row 1`] = ` " - + a - + b @@ -310,7 +310,7 @@ exports[`Array Array solid row 1`] = ` exports[`Array Column+Rowlines Solid Dashed None 1`] = ` " - + 0 @@ -324,7 +324,7 @@ exports[`Array Column+Rowlines Solid Dashed None 1`] = ` c - + 1 @@ -338,7 +338,7 @@ exports[`Array Column+Rowlines Solid Dashed None 1`] = ` f - + 2 @@ -352,7 +352,7 @@ exports[`Array Column+Rowlines Solid Dashed None 1`] = ` i - + 3 @@ -373,7 +373,7 @@ exports[`Array Column+Rowlines Solid Dashed None 1`] = ` exports[`Array Column+Rowlines Solid None 1`] = ` " - + a @@ -384,7 +384,7 @@ exports[`Array Column+Rowlines Solid None 1`] = ` c - + d @@ -395,7 +395,7 @@ exports[`Array Column+Rowlines Solid None 1`] = ` f - + g @@ -413,7 +413,7 @@ exports[`Array Column+Rowlines Solid None 1`] = ` exports[`Array Columnlines Solid None 1`] = ` " - + a @@ -424,7 +424,7 @@ exports[`Array Columnlines Solid None 1`] = ` c - + d @@ -449,7 +449,7 @@ exports[`Array Enclosed bottom 1`] = ` " - + a @@ -463,7 +463,7 @@ exports[`Array Enclosed dashed column 1`] = ` " - + a @@ -471,7 +471,7 @@ exports[`Array Enclosed dashed column 1`] = ` c - + b @@ -488,12 +488,12 @@ exports[`Array Enclosed dashed row 1`] = ` " - + a - + b @@ -506,7 +506,7 @@ exports[`Array Enclosed dashed row 1`] = ` exports[`Array Enclosed frame dashed 1`] = ` " - + a @@ -518,7 +518,7 @@ exports[`Array Enclosed frame dashed 1`] = ` exports[`Array Enclosed frame solid 1`] = ` " - + a @@ -531,7 +531,7 @@ exports[`Array Enclosed left 1`] = ` " - + a @@ -545,7 +545,7 @@ exports[`Array Enclosed left right 1`] = ` " - + a @@ -559,7 +559,7 @@ exports[`Array Enclosed right 1`] = ` " - + a @@ -573,7 +573,7 @@ exports[`Array Enclosed solid column 1`] = ` " - + a @@ -581,7 +581,7 @@ exports[`Array Enclosed solid column 1`] = ` c - + b @@ -597,7 +597,7 @@ exports[`Array Enclosed solid column 1`] = ` exports[`Array Enclosed solid dashed 1`] = ` " - + a @@ -610,12 +610,12 @@ exports[`Array Enclosed solid row 1`] = ` " - + a - + b @@ -629,7 +629,7 @@ exports[`Array Enclosed top 1`] = ` " - + a @@ -643,7 +643,7 @@ exports[`Array Enclosed top bottom 1`] = ` " - + a @@ -656,7 +656,7 @@ exports[`Array Enclosed top bottom 1`] = ` exports[`Array Label 1`] = ` " - + @@ -678,7 +678,7 @@ exports[`Array Matrix Test 1`] = ` ( - + a @@ -689,7 +689,7 @@ exports[`Array Matrix Test 1`] = ` c - + d @@ -700,7 +700,7 @@ exports[`Array Matrix Test 1`] = ` f - + g @@ -720,7 +720,7 @@ exports[`Array Matrix Test 1`] = ` exports[`Array Newcolumntype 1`] = ` " - + a @@ -728,7 +728,7 @@ exports[`Array Newcolumntype 1`] = ` b - + c @@ -743,7 +743,7 @@ exports[`Array Newcolumntype 1`] = ` exports[`Array Newcolumntype Option 1`] = ` " - + a @@ -755,7 +755,7 @@ exports[`Array Newcolumntype Option 1`] = ` - + c @@ -774,7 +774,7 @@ exports[`Array Newcolumntype Option 1`] = ` exports[`Array Rowlines Solid None 1`] = ` " - + a @@ -785,7 +785,7 @@ exports[`Array Rowlines Solid None 1`] = ` c - + d @@ -796,7 +796,7 @@ exports[`Array Rowlines Solid None 1`] = ` f - + g @@ -1525,7 +1525,7 @@ exports[`Boxes Vtop Hsize 1`] = ` exports[`BreakAlign BreakAlign Case c 1`] = ` " - + a @@ -1546,7 +1546,7 @@ exports[`BreakAlign BreakAlign Case c 1`] = ` exports[`BreakAlign BreakAlign Case c second cell 1`] = ` " - + a @@ -1567,7 +1567,7 @@ exports[`BreakAlign BreakAlign Case c second cell 1`] = ` exports[`BreakAlign BreakAlign Case r 1`] = ` " - + a @@ -1588,7 +1588,7 @@ exports[`BreakAlign BreakAlign Case r 1`] = ` exports[`BreakAlign BreakAlign Case r multi split 1`] = ` " - + a @@ -1609,7 +1609,7 @@ exports[`BreakAlign BreakAlign Case r multi split 1`] = ` exports[`BreakAlign BreakAlign Case r second row 1`] = ` " - + a @@ -1623,7 +1623,7 @@ exports[`BreakAlign BreakAlign Case r second row 1`] = ` - + c @@ -1644,7 +1644,7 @@ exports[`BreakAlign BreakAlign Case r second row 1`] = ` exports[`BreakAlign BreakAlign Case t 1`] = ` " - + a @@ -1804,7 +1804,7 @@ exports[`Character Class Changes mathpunct 1`] = ` exports[`Complete Array column ! | @ 1`] = ` " - + a @@ -1823,7 +1823,7 @@ exports[`Complete Array column ! | @ 1`] = ` exports[`Complete Array column > > c < < 1`] = ` " - + b a @@ -1839,7 +1839,7 @@ exports[`Complete Array column > > c < < 1`] = ` exports[`Complete Array column > space 1`] = ` " - + x X @@ -1852,7 +1852,7 @@ exports[`Complete Array column > space 1`] = ` exports[`Complete Array column @ | ! c 1`] = ` " - + @@ -1869,7 +1869,7 @@ exports[`Complete Array column @ | ! c 1`] = ` exports[`Complete Array column @ p m 1`] = ` " - + x @@ -1891,7 +1891,7 @@ exports[`Complete Array column @ p m 1`] = ` exports[`Complete Array column {{c}} 1`] = ` " - + X @@ -1903,7 +1903,7 @@ exports[`Complete Array column {{c}} 1`] = ` exports[`Complete Array column {c} 1`] = ` " - + X Y @@ -1916,7 +1916,7 @@ exports[`Complete Array column {c} 1`] = ` exports[`Complete Array column {cc} 1`] = ` " - + X Y @@ -1929,7 +1929,7 @@ exports[`Complete Array column {cc} 1`] = ` exports[`Complete Array column {r}c{l} 1`] = ` " - + X @@ -1947,7 +1947,7 @@ exports[`Complete Array column {r}c{l} 1`] = ` exports[`Complete Array column b 1`] = ` " - + a @@ -1964,7 +1964,7 @@ exports[`Complete Array column b 1`] = ` - + d @@ -1988,13 +1988,13 @@ exports[`Complete Array column b 1`] = ` exports[`Complete Array column c < 1`] = ` " - + a A - + d A @@ -2007,13 +2007,13 @@ exports[`Complete Array column c < 1`] = ` exports[`Complete Array column c > 1`] = ` " - + A a - + A d @@ -2026,7 +2026,7 @@ exports[`Complete Array column c > 1`] = ` exports[`Complete Array column c @ end 1`] = ` " - + a @@ -2034,7 +2034,7 @@ exports[`Complete Array column c @ end 1`] = ` h - + d @@ -2049,7 +2049,7 @@ exports[`Complete Array column c @ end 1`] = ` exports[`Complete Array column c @& 1`] = ` " - + a @@ -2061,7 +2061,7 @@ exports[`Complete Array column c @& 1`] = ` b - + d @@ -2080,7 +2080,7 @@ exports[`Complete Array column c @& 1`] = ` exports[`Complete Array column c @& hfil 1`] = ` " - + a @@ -2092,7 +2092,7 @@ exports[`Complete Array column c @& hfil 1`] = ` b - + d @@ -2111,7 +2111,7 @@ exports[`Complete Array column c @& hfil 1`] = ` exports[`Complete Array column c W 1`] = ` " - + a @@ -2124,7 +2124,7 @@ exports[`Complete Array column c W 1`] = ` c - + d @@ -2144,7 +2144,7 @@ exports[`Complete Array column c W 1`] = ` exports[`Complete Array column c c @ 1`] = ` " - + X @@ -2162,7 +2162,7 @@ exports[`Complete Array column c c @ 1`] = ` exports[`Complete Array column c c | c 1`] = ` " - + X @@ -2180,7 +2180,7 @@ exports[`Complete Array column c c | c 1`] = ` exports[`Complete Array column c w 1`] = ` " - + a @@ -2193,7 +2193,7 @@ exports[`Complete Array column c w 1`] = ` c - + d @@ -2213,7 +2213,7 @@ exports[`Complete Array column c w 1`] = ` exports[`Complete Array column m 1`] = ` " - + a @@ -2230,7 +2230,7 @@ exports[`Complete Array column m 1`] = ` - + d @@ -2256,8 +2256,7 @@ exports[`Complete Array column newline 1`] = ` c} X & Y\\end{array}" display="block"> - + X @@ -2272,7 +2271,7 @@ c}"> exports[`Complete Array column p 1`] = ` " - + a @@ -2289,7 +2288,7 @@ exports[`Complete Array column p 1`] = ` - + d @@ -2313,7 +2312,7 @@ exports[`Complete Array column p 1`] = ` exports[`Complete Array column r c l ! 1`] = ` " - + a @@ -2330,7 +2329,7 @@ exports[`Complete Array column r c l ! 1`] = ` c - + d @@ -2354,7 +2353,7 @@ exports[`Complete Array column r c l ! 1`] = ` exports[`Complete Array column r c l : 1`] = ` " - + a @@ -2365,7 +2364,7 @@ exports[`Complete Array column r c l : 1`] = ` c - + d @@ -2383,7 +2382,7 @@ exports[`Complete Array column r c l : 1`] = ` exports[`Complete Array column r c l < 1`] = ` " - + a A @@ -2395,7 +2394,7 @@ exports[`Complete Array column r c l < 1`] = ` c - + d A @@ -2414,7 +2413,7 @@ exports[`Complete Array column r c l < 1`] = ` exports[`Complete Array column r c l > 1`] = ` " - + A a @@ -2426,7 +2425,7 @@ exports[`Complete Array column r c l > 1`] = ` c - + A d @@ -2445,7 +2444,7 @@ exports[`Complete Array column r c l > 1`] = ` exports[`Complete Array column r c l @ 1`] = ` " - + a @@ -2462,7 +2461,7 @@ exports[`Complete Array column r c l @ 1`] = ` c - + d @@ -2486,7 +2485,7 @@ exports[`Complete Array column r c l @ 1`] = ` exports[`Complete Array column r c l | 1`] = ` " - + a @@ -2497,7 +2496,7 @@ exports[`Complete Array column r c l | 1`] = ` c - + d @@ -2515,7 +2514,7 @@ exports[`Complete Array column r c l | 1`] = ` exports[`Complete Array column r c l 1`] = ` " - + a @@ -2526,7 +2525,7 @@ exports[`Complete Array column r c l 1`] = ` c - + d @@ -2544,7 +2543,7 @@ exports[`Complete Array column r c l 1`] = ` exports[`Complete Array column r c repeat | 1`] = ` " - + a @@ -2560,7 +2559,7 @@ exports[`Complete Array column r c repeat | 1`] = ` c - + d @@ -2583,7 +2582,7 @@ exports[`Complete Array column r c repeat | 1`] = ` exports[`Complete Array column r c repeat | {} 1`] = ` " - + a @@ -2602,7 +2601,7 @@ exports[`Complete Array column r c repeat | {} 1`] = ` c - + d @@ -2625,12 +2624,12 @@ exports[`Complete Array column r c repeat | {} 1`] = ` exports[`Complete Array column r c repeat | {} 2`] = ` " - + a - + Q @@ -2650,7 +2649,7 @@ exports[`Complete Array column r c repeat | {} 2`] = ` c - + d @@ -2673,11 +2672,11 @@ exports[`Complete Array column r c repeat | {} 2`] = ` exports[`Complete Array column r c repeat | {} 3`] = ` " - + a - + Q @@ -2696,7 +2695,7 @@ exports[`Complete Array column r c repeat | {} 3`] = ` c - + d @@ -2719,7 +2718,7 @@ exports[`Complete Array column r c repeat | {} 3`] = ` exports[`Complete Array column r repeat c 1`] = ` " - + a @@ -2730,7 +2729,7 @@ exports[`Complete Array column r repeat c 1`] = ` c - + d @@ -2748,7 +2747,7 @@ exports[`Complete Array column r repeat c 1`] = ` exports[`Complete Array column repeat r c 1`] = ` " - + a @@ -2759,7 +2758,7 @@ exports[`Complete Array column repeat r c 1`] = ` c - + d @@ -2777,12 +2776,12 @@ exports[`Complete Array column repeat r c 1`] = ` exports[`Complete Array end row hline c 1`] = ` " - + a - + b @@ -2794,7 +2793,7 @@ exports[`Complete Array end row hline c 1`] = ` exports[`Complete Array end row spacing r c l 1`] = ` " - + a @@ -2805,7 +2804,7 @@ exports[`Complete Array end row spacing r c l 1`] = ` c - + d @@ -2823,7 +2822,7 @@ exports[`Complete Array end row spacing r c l 1`] = ` exports[`Complete Array eqnarray extend last row 1`] = ` " - + r @@ -2836,7 +2835,7 @@ exports[`Complete Array eqnarray extend last row 1`] = ` b - + d @@ -3333,7 +3332,7 @@ exports[`Dots vdots 1`] = ` exports[`Environments Array Center 1`] = ` " - + a @@ -3345,12 +3344,12 @@ exports[`Environments Array Center 1`] = ` exports[`Environments Array Center Lines 1`] = ` " - + a - + b @@ -3362,7 +3361,7 @@ exports[`Environments Array Center Lines 1`] = ` exports[`Environments Array RCL 1`] = ` " - + a @@ -3380,7 +3379,7 @@ exports[`Environments Array RCL 1`] = ` exports[`Environments Array RCL Lines 1`] = ` " - + a @@ -3391,7 +3390,7 @@ exports[`Environments Array RCL Lines 1`] = ` b - + c @@ -3409,7 +3408,7 @@ exports[`Environments Array RCL Lines 1`] = ` exports[`Environments Display Array Center 1`] = ` " - + a @@ -3421,12 +3420,12 @@ exports[`Environments Display Array Center 1`] = ` exports[`Environments Display Array Center Lines 1`] = ` " - + a - + b @@ -3438,7 +3437,7 @@ exports[`Environments Display Array Center Lines 1`] = ` exports[`Environments Display Array RCL 1`] = ` " - + a @@ -3456,7 +3455,7 @@ exports[`Environments Display Array RCL 1`] = ` exports[`Environments Display Array RCL Lines 1`] = ` " - + a @@ -3467,7 +3466,7 @@ exports[`Environments Display Array RCL Lines 1`] = ` b - + c @@ -3491,7 +3490,7 @@ exports[`Environments Displaymath 1`] = ` exports[`Environments Eqnarray 1`] = ` " - + a @@ -3544,7 +3543,7 @@ exports[`Environments IndentAlign Single 1`] = ` exports[`Environments Nested array 1`] = ` " - + a @@ -3557,7 +3556,7 @@ exports[`Environments Nested array 1`] = ` c - + f @@ -3565,7 +3564,7 @@ exports[`Environments Nested array 1`] = ` h - + g @@ -4498,12 +4497,12 @@ exports[`InternalMath Unicode text 1`] = ` exports[`Linebreaks Array Custom Linebreak 1`] = ` " - + a - + b @@ -4515,12 +4514,12 @@ exports[`Linebreaks Array Custom Linebreak 1`] = ` exports[`Linebreaks Cr Linebreak 1`] = ` " - + a - + b @@ -5823,12 +5822,12 @@ exports[`Mathchoice Pmod 1`] = ` exports[`Matrix Displaylines 1`] = ` " - + a - + b @@ -5840,7 +5839,7 @@ exports[`Matrix Displaylines 1`] = ` exports[`Matrix Matrix Arg 1`] = ` " - + a @@ -5852,7 +5851,7 @@ exports[`Matrix Matrix Arg 1`] = ` exports[`Matrix Matrix Braces 1`] = ` " - + a @@ -5866,7 +5865,7 @@ exports[`Matrix Matrix Cases 1`] = ` { - + a @@ -5882,7 +5881,7 @@ exports[`Matrix Matrix Cases 2`] = ` { - + a @@ -5898,7 +5897,7 @@ exports[`Matrix Matrix Cases text 1`] = ` { - + a @@ -5917,7 +5916,7 @@ exports[`Matrix Matrix Cases two columns 1`] = ` { - + a @@ -5936,7 +5935,7 @@ exports[`Matrix Matrix Cases two columns braces 1`] = ` { - + a @@ -5955,7 +5954,7 @@ exports[`Matrix Matrix Cases two rows 1`] = ` { - + a @@ -5963,7 +5962,7 @@ exports[`Matrix Matrix Cases two rows 1`] = ` b - + c @@ -5980,7 +5979,7 @@ exports[`Matrix Matrix Cases two rows 1`] = ` exports[`Matrix Matrix Columns 1`] = ` " - + a @@ -5997,7 +5996,7 @@ exports[`Matrix Matrix Font Entry 1`] = ` ( - + a @@ -6014,7 +6013,7 @@ exports[`Matrix Matrix Font Entry 1`] = ` exports[`Matrix Matrix Not Numbered 1`] = ` " - + a @@ -6032,7 +6031,7 @@ exports[`Matrix Matrix Not Numbered 1`] = ` exports[`Matrix Matrix Numbered 1`] = ` " - + c @@ -6050,7 +6049,7 @@ exports[`Matrix Matrix Numbered 1`] = ` exports[`Matrix Matrix Numbered Left 1`] = ` " - + c @@ -6070,7 +6069,7 @@ exports[`Matrix Matrix Parens 1`] = ` ( - + a @@ -6092,7 +6091,7 @@ exports[`Matrix Matrix Parens Subscript 1`] = ` ( - + a @@ -6111,7 +6110,7 @@ exports[`Matrix Matrix Parens Subscript 1`] = ` exports[`Matrix Matrix Rows 1`] = ` " - + a @@ -6119,7 +6118,7 @@ exports[`Matrix Matrix Rows 1`] = ` b - + c @@ -6137,7 +6136,7 @@ exports[`Matrix Matrix Subscript 1`] = ` X - + a @@ -7608,7 +7607,7 @@ exports[`Referencing Label Empty 1`] = ` exports[`Referencing Label Multiple 1`] = ` " - + ( 1 @@ -7618,7 +7617,7 @@ exports[`Referencing Label Multiple 1`] = ` a - + ( 2 @@ -7635,7 +7634,7 @@ exports[`Referencing Label Multiple 1`] = ` exports[`Referencing Nonumber 1`] = ` " - + ( 1 @@ -7645,7 +7644,7 @@ exports[`Referencing Nonumber 1`] = ` a - + c @@ -7831,7 +7830,7 @@ exports[`Setting sizes tiny 1`] = ` exports[`Spaces Hfil 1`] = ` " - + a @@ -7839,7 +7838,7 @@ exports[`Spaces Hfil 1`] = ` b - + d @@ -7856,7 +7855,7 @@ exports[`Spaces Hfil 1`] = ` exports[`Spaces Hfil Centering 1`] = ` " - + x @@ -7868,7 +7867,7 @@ exports[`Spaces Hfil Centering 1`] = ` exports[`Spaces Hfill 1`] = ` " - + a @@ -7876,7 +7875,7 @@ exports[`Spaces Hfill 1`] = ` b - + d @@ -7893,7 +7892,7 @@ exports[`Spaces Hfill 1`] = ` exports[`Spaces Hfilll 1`] = ` " - + a @@ -7901,7 +7900,7 @@ exports[`Spaces Hfilll 1`] = ` b - + d @@ -9027,7 +9026,7 @@ exports[`Sub and Superscripts SubSup 1`] = ` exports[`Tagged Environments EqnTest 1`] = ` " - + ( 1 @@ -9068,7 +9067,7 @@ exports[`User Defined Environments Cases star 1`] = ` { - + a @@ -9076,7 +9075,7 @@ exports[`User Defined Environments Cases star 1`] = ` test a - + b @@ -9094,7 +9093,7 @@ exports[`User Defined Environments Crampedsubarray 1`] = ` " - + a @@ -9102,7 +9101,7 @@ exports[`User Defined Environments Crampedsubarray 1`] = ` b - + c @@ -9118,7 +9117,7 @@ exports[`User Defined Environments Crampedsubarray 1`] = ` exports[`User Defined Environments EqnTest 1`] = ` " - + a @@ -9135,7 +9134,7 @@ exports[`User Defined Environments EqnTest 1`] = ` exports[`User Defined Environments Gather 1`] = ` " - + a @@ -9157,7 +9156,7 @@ exports[`User Defined Environments pmatrix 1`] = ` ( - + a @@ -9165,7 +9164,7 @@ exports[`User Defined Environments pmatrix 1`] = ` b - + c @@ -9183,7 +9182,7 @@ exports[`User Defined Environments smallmatrix 1`] = ` " - + a @@ -9191,7 +9190,7 @@ exports[`User Defined Environments smallmatrix 1`] = ` b - + c diff --git a/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap index f62320187..f6514ec86 100644 --- a/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap @@ -3,7 +3,7 @@ exports[`Cases Numcases 1`] = ` " - + ( 1 @@ -22,7 +22,7 @@ exports[`Cases Numcases 1`] = ` - + ( 1 @@ -48,7 +48,7 @@ exports[`Cases Numcases 1`] = ` - + ( 2 @@ -73,7 +73,7 @@ exports[`Cases Numcases 1`] = ` - + ( 1 @@ -124,7 +124,7 @@ exports[`Cases Numcases 1`] = ` - + ( 2 @@ -150,7 +150,7 @@ exports[`Cases Numcases 1`] = ` exports[`Cases Numcases with macro 1`] = ` " - + ( 1 @@ -166,7 +166,7 @@ exports[`Cases Numcases with macro 1`] = ` - + ( 1 @@ -191,7 +191,7 @@ exports[`Cases Numcases with macro 1`] = ` - + ( 1 @@ -233,7 +233,7 @@ exports[`Cases Numcases with macro 1`] = ` exports[`Cases entry not in numcases 1`] = ` " - + x @@ -248,7 +248,7 @@ exports[`Cases entry not in numcases 1`] = ` exports[`Cases numcases with explicit tag 1`] = ` " - + ( A @@ -264,7 +264,7 @@ exports[`Cases numcases with explicit tag 1`] = ` - + ( A @@ -289,7 +289,7 @@ exports[`Cases numcases with explicit tag 1`] = ` - + ( A @@ -331,7 +331,7 @@ exports[`Cases numcases with explicit tag 1`] = ` exports[`Cases subnumcases 1`] = ` " - + ( 1a @@ -350,7 +350,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1a @@ -376,7 +376,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1b @@ -401,7 +401,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1a @@ -452,7 +452,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1b diff --git a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap index ea5e43856..e006254e7 100644 --- a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap @@ -3,7 +3,7 @@ exports[`Colortbl cellcolor 1`] = ` " - + a @@ -11,7 +11,7 @@ exports[`Colortbl cellcolor 1`] = ` b - + c @@ -28,7 +28,7 @@ exports[`Colortbl cellcolor in pmatrix 1`] = ` ( - + a @@ -42,7 +42,7 @@ exports[`Colortbl cellcolor in pmatrix 1`] = ` exports[`Colortbl cellcolor in preamble 1`] = ` " - + a @@ -50,7 +50,7 @@ exports[`Colortbl cellcolor in preamble 1`] = ` b - + c @@ -65,7 +65,7 @@ exports[`Colortbl cellcolor in preamble 1`] = ` exports[`Colortbl cellcolor late 1`] = ` " - + a @@ -80,7 +80,7 @@ exports[`Colortbl cellcolor late 1`] = ` exports[`Colortbl cellcolor with color model 1`] = ` " - + a @@ -92,7 +92,7 @@ exports[`Colortbl cellcolor with color model 1`] = ` exports[`Colortbl cellcolor with columncolor 1`] = ` " - + a @@ -100,7 +100,7 @@ exports[`Colortbl cellcolor with columncolor 1`] = ` b - + c @@ -115,7 +115,7 @@ exports[`Colortbl cellcolor with columncolor 1`] = ` exports[`Colortbl cellcolor with columncolor and rowcolor 1`] = ` " - + a @@ -123,7 +123,7 @@ exports[`Colortbl cellcolor with columncolor and rowcolor 1`] = ` b - + c @@ -139,7 +139,7 @@ exports[`Colortbl cellcolor with frame 1`] = ` " - + a @@ -152,7 +152,7 @@ exports[`Colortbl cellcolor with frame 1`] = ` exports[`Colortbl cellcolor with rowcolor 1`] = ` " - + a @@ -160,7 +160,7 @@ exports[`Colortbl cellcolor with rowcolor 1`] = ` b - + c @@ -175,7 +175,7 @@ exports[`Colortbl cellcolor with rowcolor 1`] = ` exports[`Colortbl color with no frame 1`] = ` " - + a @@ -187,7 +187,7 @@ exports[`Colortbl color with no frame 1`] = ` exports[`Colortbl columncolor 1`] = ` " - + a @@ -195,7 +195,7 @@ exports[`Colortbl columncolor 1`] = ` b - + c @@ -210,7 +210,7 @@ exports[`Colortbl columncolor 1`] = ` exports[`Colortbl columncolor and rowcolor 1`] = ` " - + a @@ -218,7 +218,7 @@ exports[`Colortbl columncolor and rowcolor 1`] = ` b - + c @@ -233,7 +233,7 @@ exports[`Colortbl columncolor and rowcolor 1`] = ` exports[`Colortbl columncolor ignore overlap 1`] = ` " - + a @@ -241,7 +241,7 @@ exports[`Colortbl columncolor ignore overlap 1`] = ` b - + c @@ -256,7 +256,7 @@ exports[`Colortbl columncolor ignore overlap 1`] = ` exports[`Colortbl columncolor in preamble 1`] = ` " - + a @@ -264,7 +264,7 @@ exports[`Colortbl columncolor in preamble 1`] = ` b - + c @@ -279,7 +279,7 @@ exports[`Colortbl columncolor in preamble 1`] = ` exports[`Colortbl rowcolor 1`] = ` " - + a @@ -287,7 +287,7 @@ exports[`Colortbl rowcolor 1`] = ` b - + c diff --git a/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap index d3a200fc1..dd632401a 100644 --- a/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap @@ -225,7 +225,7 @@ exports[`Empheq Characters empheqrvert 1`] = ` exports[`Empheq Empheq Left 1`] = ` " - + ( 1 @@ -239,7 +239,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 1 @@ -256,7 +256,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 2 @@ -280,7 +280,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 1 @@ -313,7 +313,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 2 @@ -338,7 +338,7 @@ exports[`Empheq Empheq Left 1`] = ` exports[`Empheq Empheq Right 1`] = ` " - + ( 1 @@ -362,7 +362,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 1 @@ -379,7 +379,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 2 @@ -403,7 +403,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 1 @@ -426,7 +426,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 2 @@ -450,7 +450,7 @@ exports[`Empheq Empheq Right 1`] = ` exports[`Empheq Numcases 1`] = ` " - + ( 1 @@ -467,7 +467,7 @@ exports[`Empheq Numcases 1`] = ` - + ( 1 @@ -477,7 +477,7 @@ exports[`Empheq Numcases 1`] = ` a - + ( 2 @@ -501,7 +501,7 @@ exports[`Empheq Numcases 1`] = ` - + ( 1 @@ -517,7 +517,7 @@ exports[`Empheq Numcases 1`] = ` - + ( 2 @@ -541,7 +541,7 @@ exports[`Empheq Numcases 1`] = ` exports[`Empheq Numcases alignedat 1`] = ` " - + ( 1 @@ -623,7 +623,7 @@ exports[`Empheq Numcases empty right 1`] = ` exports[`Empheq Numcases with label 1`] = ` " - + ( 1 @@ -639,7 +639,7 @@ exports[`Empheq Numcases with label 1`] = ` - + ( 1 @@ -664,7 +664,7 @@ exports[`Empheq Numcases with label 1`] = ` - + ( 1 diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index a2d6de709..a844809e3 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -3,7 +3,7 @@ exports[`Mathtools Boxed Equations Aboxed 1`] = ` " - + @@ -39,7 +39,7 @@ exports[`Mathtools Boxed Equations Aboxed 1`] = ` - + @@ -56,7 +56,7 @@ exports[`Mathtools Boxed Equations Aboxed 1`] = ` exports[`Mathtools Boxed Equations Aboxed odd column 1`] = ` " - + @@ -103,7 +103,7 @@ exports[`Mathtools Boxed Equations Aboxed odd column 1`] = ` exports[`Mathtools Boxed Equations MakeAboxedCommand 1`] = ` " - + @@ -146,7 +146,7 @@ exports[`Mathtools Boxed Equations MakeAboxedCommand 1`] = ` exports[`Mathtools Boxed Equations MakeAboxedCommand star 1`] = ` " - + @@ -529,7 +529,7 @@ exports[`Mathtools Matrix Environments Bmatrix* 1`] = ` { - + 1 @@ -538,7 +538,7 @@ exports[`Mathtools Matrix Environments Bmatrix* 1`] = ` 3 - + 2 @@ -558,7 +558,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[c] 1`] = ` { - + 1 @@ -567,7 +567,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[c] 1`] = ` 3 - + 2 @@ -587,7 +587,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[l] 1`] = ` { - + 1 @@ -596,7 +596,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[l] 1`] = ` 3 - + 2 @@ -616,7 +616,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[r] 1`] = ` { - + 1 @@ -625,7 +625,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[r] 1`] = ` 3 - + 2 @@ -645,7 +645,7 @@ exports[`Mathtools Matrix Environments Vmatrix* 1`] = ` - + 1 @@ -654,7 +654,7 @@ exports[`Mathtools Matrix Environments Vmatrix* 1`] = ` 3 - + 2 @@ -674,7 +674,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[c] 1`] = ` - + 1 @@ -683,7 +683,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[c] 1`] = ` 3 - + 2 @@ -703,7 +703,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[l] 1`] = ` - + 1 @@ -712,7 +712,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[l] 1`] = ` 3 - + 2 @@ -732,7 +732,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[r] 1`] = ` - + 1 @@ -741,7 +741,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[r] 1`] = ` 3 - + 2 @@ -761,7 +761,7 @@ exports[`Mathtools Matrix Environments bmatrix* 1`] = ` [ - + 1 @@ -770,7 +770,7 @@ exports[`Mathtools Matrix Environments bmatrix* 1`] = ` 3 - + 2 @@ -790,7 +790,7 @@ exports[`Mathtools Matrix Environments bmatrix*[c] 1`] = ` [ - + 1 @@ -799,7 +799,7 @@ exports[`Mathtools Matrix Environments bmatrix*[c] 1`] = ` 3 - + 2 @@ -819,7 +819,7 @@ exports[`Mathtools Matrix Environments bmatrix*[l] 1`] = ` [ - + 1 @@ -828,7 +828,7 @@ exports[`Mathtools Matrix Environments bmatrix*[l] 1`] = ` 3 - + 2 @@ -848,7 +848,7 @@ exports[`Mathtools Matrix Environments bmatrix*[r] 1`] = ` [ - + 1 @@ -857,7 +857,7 @@ exports[`Mathtools Matrix Environments bmatrix*[r] 1`] = ` 3 - + 2 @@ -875,7 +875,7 @@ exports[`Mathtools Matrix Environments bmatrix*[r] 1`] = ` exports[`Mathtools Matrix Environments matrix* 1`] = ` " - + 1 @@ -884,7 +884,7 @@ exports[`Mathtools Matrix Environments matrix* 1`] = ` 3 - + 2 @@ -900,7 +900,7 @@ exports[`Mathtools Matrix Environments matrix* 1`] = ` exports[`Mathtools Matrix Environments matrix*[c] 1`] = ` " - + 1 @@ -909,7 +909,7 @@ exports[`Mathtools Matrix Environments matrix*[c] 1`] = ` 3 - + 2 @@ -925,7 +925,7 @@ exports[`Mathtools Matrix Environments matrix*[c] 1`] = ` exports[`Mathtools Matrix Environments matrix*[l] 1`] = ` " - + 1 @@ -934,7 +934,7 @@ exports[`Mathtools Matrix Environments matrix*[l] 1`] = ` 3 - + 2 @@ -950,7 +950,7 @@ exports[`Mathtools Matrix Environments matrix*[l] 1`] = ` exports[`Mathtools Matrix Environments matrix*[r] 1`] = ` " - + 1 @@ -959,7 +959,7 @@ exports[`Mathtools Matrix Environments matrix*[r] 1`] = ` 3 - + 2 @@ -977,7 +977,7 @@ exports[`Mathtools Matrix Environments pmatrix* 1`] = ` ( - + 1 @@ -986,7 +986,7 @@ exports[`Mathtools Matrix Environments pmatrix* 1`] = ` 3 - + 2 @@ -1006,7 +1006,7 @@ exports[`Mathtools Matrix Environments pmatrix*[c] 1`] = ` ( - + 1 @@ -1015,7 +1015,7 @@ exports[`Mathtools Matrix Environments pmatrix*[c] 1`] = ` 3 - + 2 @@ -1035,7 +1035,7 @@ exports[`Mathtools Matrix Environments pmatrix*[l] 1`] = ` ( - + 1 @@ -1044,7 +1044,7 @@ exports[`Mathtools Matrix Environments pmatrix*[l] 1`] = ` 3 - + 2 @@ -1064,7 +1064,7 @@ exports[`Mathtools Matrix Environments pmatrix*[r] 1`] = ` ( - + 1 @@ -1073,7 +1073,7 @@ exports[`Mathtools Matrix Environments pmatrix*[r] 1`] = ` 3 - + 2 @@ -1093,7 +1093,7 @@ exports[`Mathtools Matrix Environments vmatrix* 1`] = ` | - + 1 @@ -1102,7 +1102,7 @@ exports[`Mathtools Matrix Environments vmatrix* 1`] = ` 3 - + 2 @@ -1122,7 +1122,7 @@ exports[`Mathtools Matrix Environments vmatrix*[c] 1`] = ` | - + 1 @@ -1131,7 +1131,7 @@ exports[`Mathtools Matrix Environments vmatrix*[c] 1`] = ` 3 - + 2 @@ -1151,7 +1151,7 @@ exports[`Mathtools Matrix Environments vmatrix*[l] 1`] = ` | - + 1 @@ -1160,7 +1160,7 @@ exports[`Mathtools Matrix Environments vmatrix*[l] 1`] = ` 3 - + 2 @@ -1180,7 +1180,7 @@ exports[`Mathtools Matrix Environments vmatrix*[r] 1`] = ` | - + 1 @@ -1189,7 +1189,7 @@ exports[`Mathtools Matrix Environments vmatrix*[r] 1`] = ` 3 - + 2 @@ -1207,7 +1207,7 @@ exports[`Mathtools Matrix Environments vmatrix*[r] 1`] = ` exports[`Mathtools More Environments ArrowBetweenLines 1`] = ` " - + @@ -1231,13 +1231,13 @@ exports[`Mathtools More Environments ArrowBetweenLines 1`] = ` - + - + @@ -1268,7 +1268,7 @@ exports[`Mathtools More Environments ArrowBetweenLines 1`] = ` exports[`Mathtools More Environments ArrowBetweenLines* 1`] = ` " - + @@ -1296,7 +1296,7 @@ exports[`Mathtools More Environments ArrowBetweenLines* 1`] = ` - + @@ -1306,7 +1306,7 @@ exports[`Mathtools More Environments ArrowBetweenLines* 1`] = ` - + @@ -1341,7 +1341,7 @@ exports[`Mathtools More Environments ArrowBetweenLines* 1`] = ` exports[`Mathtools More Environments MoveEqLeft 1`] = ` " - + @@ -1358,7 +1358,7 @@ exports[`Mathtools More Environments MoveEqLeft 1`] = ` - + @@ -1374,7 +1374,7 @@ exports[`Mathtools More Environments MoveEqLeft 1`] = ` - + @@ -1391,14 +1391,14 @@ exports[`Mathtools More Environments MoveEqLeft 1`] = ` exports[`Mathtools More Environments Spreadlines 1`] = ` " - + a = b - + c = @@ -1412,14 +1412,14 @@ exports[`Mathtools More Environments Spreadlines 1`] = ` exports[`Mathtools More Environments Spreadlines multiple environments 1`] = ` " - + a = b - + c = @@ -1429,14 +1429,14 @@ exports[`Mathtools More Environments Spreadlines multiple environments 1`] = ` - + x = y - + z @@ -1458,7 +1458,7 @@ exports[`Mathtools More Environments cases* 1`] = ` { - + 1 @@ -1473,7 +1473,7 @@ exports[`Mathtools More Environments cases* 1`] = ` - + 1 @@ -1493,7 +1493,7 @@ exports[`Mathtools More Environments dcases 1`] = ` { - + 1 @@ -1503,7 +1503,7 @@ exports[`Mathtools More Environments dcases 1`] = ` 0 - + 1 @@ -1525,7 +1525,7 @@ exports[`Mathtools More Environments dcases* 1`] = ` { - + 1 @@ -1540,7 +1540,7 @@ exports[`Mathtools More Environments dcases* 1`] = ` - + 1 @@ -1562,7 +1562,7 @@ exports[`Mathtools More Environments drcases 1`] = ` - + 1 @@ -1572,7 +1572,7 @@ exports[`Mathtools More Environments drcases 1`] = ` 0 - + 1 @@ -1594,7 +1594,7 @@ exports[`Mathtools More Environments drcases* 1`] = ` - + 1 @@ -1609,7 +1609,7 @@ exports[`Mathtools More Environments drcases* 1`] = ` - + 1 @@ -1629,7 +1629,7 @@ exports[`Mathtools More Environments drcases* 1`] = ` exports[`Mathtools More Environments lgathered 1`] = ` " - + a + @@ -1638,7 +1638,7 @@ exports[`Mathtools More Environments lgathered 1`] = ` c - + d @@ -1940,7 +1940,7 @@ exports[`Mathtools More Environments rcases 1`] = ` - + 1 @@ -1950,7 +1950,7 @@ exports[`Mathtools More Environments rcases 1`] = ` 0 - + 1 @@ -1972,7 +1972,7 @@ exports[`Mathtools More Environments rcases* 1`] = ` - + 1 @@ -1987,7 +1987,7 @@ exports[`Mathtools More Environments rcases* 1`] = ` - + 1 @@ -2005,7 +2005,7 @@ exports[`Mathtools More Environments rcases* 1`] = ` exports[`Mathtools More Environments rgathered 1`] = ` " - + a + @@ -2014,7 +2014,7 @@ exports[`Mathtools More Environments rgathered 1`] = ` c - + d @@ -2026,7 +2026,7 @@ exports[`Mathtools More Environments rgathered 1`] = ` exports[`Mathtools More Environments smallvdotswithin star 1`] = ` " - + A @@ -2038,7 +2038,7 @@ exports[`Mathtools More Environments smallvdotswithin star 1`] = ` - + @@ -2055,7 +2055,7 @@ exports[`Mathtools More Environments smallvdotswithin star 1`] = ` - + C @@ -2074,7 +2074,7 @@ exports[`Mathtools More Environments smallvdotswithin star 1`] = ` exports[`Mathtools More Environments vdotswithin smallvdotswithin 1`] = ` " - + a @@ -2086,7 +2086,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 1`] = ` - + @@ -2103,7 +2103,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 1`] = ` - + @@ -2113,7 +2113,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 1`] = ` - + @@ -2130,7 +2130,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 1`] = ` - + @@ -2147,7 +2147,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 1`] = ` exports[`Mathtools More Environments vdotswithin smallvdotswithin 2`] = ` " - + A @@ -2175,7 +2175,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 2`] = ` - + @@ -2211,7 +2211,7 @@ exports[`Mathtools More Environments vdotswithin smallvdotswithin 2`] = ` - + C @@ -2444,7 +2444,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix 1`] = ` { - + a @@ -2453,7 +2453,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix 1`] = ` b - + c @@ -2475,7 +2475,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix* 1`] = ` { - + a @@ -2484,7 +2484,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix* 1`] = ` b - + c @@ -2506,7 +2506,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[c] 1`] = ` { - + a @@ -2515,7 +2515,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[c] 1`] = ` b - + c @@ -2537,7 +2537,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[l] 1`] = ` { - + a @@ -2546,7 +2546,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[l] 1`] = ` b - + c @@ -2568,7 +2568,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[r] 1`] = ` { - + a @@ -2577,7 +2577,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[r] 1`] = ` b - + c @@ -2599,7 +2599,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix 1`] = ` - + a @@ -2608,7 +2608,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix 1`] = ` b - + c @@ -2630,7 +2630,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix* 1`] = ` - + a @@ -2639,7 +2639,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix* 1`] = ` b - + c @@ -2661,7 +2661,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[c] 1`] = ` - + a @@ -2670,7 +2670,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[c] 1`] = ` b - + c @@ -2692,7 +2692,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[l] 1`] = ` - + a @@ -2701,7 +2701,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[l] 1`] = ` b - + c @@ -2723,7 +2723,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[r] 1`] = ` - + a @@ -2732,7 +2732,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[r] 1`] = ` b - + c @@ -2754,7 +2754,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix 1`] = ` [ - + a @@ -2763,7 +2763,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix 1`] = ` b - + c @@ -2785,7 +2785,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix* 1`] = ` [ - + a @@ -2794,7 +2794,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix* 1`] = ` b - + c @@ -2816,7 +2816,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[c] 1`] = ` [ - + a @@ -2825,7 +2825,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[c] 1`] = ` b - + c @@ -2847,7 +2847,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[l] 1`] = ` [ - + a @@ -2856,7 +2856,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[l] 1`] = ` b - + c @@ -2878,7 +2878,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[r] 1`] = ` [ - + a @@ -2887,7 +2887,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[r] 1`] = ` b - + c @@ -2909,7 +2909,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix 1`] = ` ( - + a @@ -2918,7 +2918,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix 1`] = ` b - + c @@ -2940,7 +2940,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix* 1`] = ` ( - + a @@ -2949,7 +2949,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix* 1`] = ` b - + c @@ -2971,7 +2971,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[c] 1`] = ` ( - + a @@ -2980,7 +2980,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[c] 1`] = ` b - + c @@ -3002,7 +3002,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[l] 1`] = ` ( - + a @@ -3011,7 +3011,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[l] 1`] = ` b - + c @@ -3033,7 +3033,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[r] 1`] = ` ( - + a @@ -3042,7 +3042,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[r] 1`] = ` b - + c @@ -3062,7 +3062,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix 1`] = ` " - + a @@ -3071,7 +3071,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix 1`] = ` b - + c @@ -3089,7 +3089,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix 2`] = ` " - + a @@ -3098,7 +3098,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix 2`] = ` b - + c @@ -3116,7 +3116,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix* 1`] = ` " - + a @@ -3125,7 +3125,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix* 1`] = ` b - + c @@ -3143,7 +3143,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[c] 1`] = ` " - + a @@ -3152,7 +3152,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[c] 1`] = ` b - + c @@ -3170,7 +3170,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[l] 1`] = ` " - + a @@ -3179,7 +3179,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[l] 1`] = ` b - + c @@ -3197,7 +3197,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[r] 1`] = ` " - + a @@ -3206,7 +3206,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[r] 1`] = ` b - + c @@ -3226,7 +3226,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix 1`] = ` | - + a @@ -3235,7 +3235,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix 1`] = ` b - + c @@ -3257,7 +3257,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix* 1`] = ` | - + a @@ -3266,7 +3266,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix* 1`] = ` b - + c @@ -3288,7 +3288,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[c] 1`] = ` | - + a @@ -3297,7 +3297,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[c] 1`] = ` b - + c @@ -3319,7 +3319,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[l] 1`] = ` | - + a @@ -3328,7 +3328,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[l] 1`] = ` b - + c @@ -3350,7 +3350,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[r] 1`] = ` | - + a @@ -3359,7 +3359,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[r] 1`] = ` b - + c @@ -3571,7 +3571,7 @@ exports[`Mathtools Spacing Control crampedsubstack 1`] = ` - + x @@ -3579,7 +3579,7 @@ exports[`Mathtools Spacing Control crampedsubstack 1`] = ` - + y @@ -3978,7 +3978,7 @@ exports[`Mathtools Tagging newtagform styled 1`] = ` exports[`Mathtools Tagging refeq 1`] = ` " - + \\textsf{A} @@ -3992,7 +3992,7 @@ exports[`Mathtools Tagging refeq 1`] = ` - + \\textsf{A} @@ -4415,12 +4415,12 @@ exports[`Mathtools setoptions smallmatrix-align 1`] = ` ( - + a - + b diff --git a/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap index a0b254542..7b6d7af71 100644 --- a/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap @@ -15,10 +15,10 @@ exports[`Nested Environments Environments Intermixed 1`] = ` exports[`Nested Environments Environments Nested 1`] = ` " - + - + a @@ -26,7 +26,7 @@ exports[`Nested Environments Environments Nested 1`] = ` b - + c @@ -57,7 +57,7 @@ exports[`Nested Environments Nested Begins 1`] = ` exports[`Nested Environments Newenvironment with Begin 1`] = ` " - + a @@ -65,7 +65,7 @@ exports[`Nested Environments Newenvironment with Begin 1`] = ` b - + c diff --git a/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap index fb892c287..9c643e5bf 100644 --- a/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap @@ -902,11 +902,11 @@ exports[`Matrix Macros Rest antidiagonalmatrix 1`] = ` ( - + - + 0 @@ -914,15 +914,15 @@ exports[`Matrix Macros Rest antidiagonalmatrix 1`] = ` - + - + 1 - + 2 @@ -944,10 +944,10 @@ exports[`Matrix Macros Rest diagonalmatrix 1`] = ` ( - + - + 0 @@ -955,16 +955,16 @@ exports[`Matrix Macros Rest diagonalmatrix 1`] = ` - + - + 1 - + 2 @@ -986,7 +986,7 @@ exports[`Matrix Macros Rest paulimatrix 0 1`] = ` ( - + 1 @@ -994,7 +994,7 @@ exports[`Matrix Macros Rest paulimatrix 0 1`] = ` 0 - + 0 @@ -1013,7 +1013,7 @@ exports[`Matrix Macros Rest paulimatrix 1 1`] = ` ( - + 0 @@ -1021,7 +1021,7 @@ exports[`Matrix Macros Rest paulimatrix 1 1`] = ` 1 - + 1 @@ -1040,7 +1040,7 @@ exports[`Matrix Macros Rest paulimatrix 2 1`] = ` ( - + 0 @@ -1049,7 +1049,7 @@ exports[`Matrix Macros Rest paulimatrix 2 1`] = ` i - + i @@ -1068,7 +1068,7 @@ exports[`Matrix Macros Rest paulimatrix 3 1`] = ` ( - + 1 @@ -1076,7 +1076,7 @@ exports[`Matrix Macros Rest paulimatrix 3 1`] = ` 0 - + 0 @@ -1106,7 +1106,7 @@ exports[`Matrix Macros Rest zeromatrix 1`] = ` ( - + 0 @@ -1117,7 +1117,7 @@ exports[`Matrix Macros Rest zeromatrix 1`] = ` 0 - + 0 @@ -7979,7 +7979,7 @@ exports[`Physics6_4 BraKet_MatrixEl_7 1`] = ` exports[`Physics7_0 Matrices_Quantity_0 1`] = ` " - + Q @@ -7991,7 +7991,7 @@ exports[`Physics7_0 Matrices_Quantity_0 1`] = ` exports[`Physics7_0 Matrices_Quantity_1 1`] = ` " - + a @@ -7999,7 +7999,7 @@ exports[`Physics7_0 Matrices_Quantity_1 1`] = ` b - + c @@ -8016,7 +8016,7 @@ exports[`Physics7_0 Matrices_Quantity_2 1`] = ` - + a @@ -8024,7 +8024,7 @@ exports[`Physics7_0 Matrices_Quantity_2 1`] = ` b - + c @@ -8043,7 +8043,7 @@ exports[`Physics7_0 Matrices_Quantity_3 1`] = ` ( - + a @@ -8051,7 +8051,7 @@ exports[`Physics7_0 Matrices_Quantity_3 1`] = ` b - + c @@ -8070,7 +8070,7 @@ exports[`Physics7_0 Matrices_Quantity_4 1`] = ` [ - + a @@ -8078,7 +8078,7 @@ exports[`Physics7_0 Matrices_Quantity_4 1`] = ` b - + c @@ -8097,7 +8097,7 @@ exports[`Physics7_0 Matrices_Quantity_5 1`] = ` | - + a @@ -8105,7 +8105,7 @@ exports[`Physics7_0 Matrices_Quantity_5 1`] = ` b - + c @@ -8122,7 +8122,7 @@ exports[`Physics7_0 Matrices_Quantity_5 1`] = ` exports[`Physics7_0 Matrices_Quantity_6 1`] = ` " - + a @@ -8130,7 +8130,7 @@ exports[`Physics7_0 Matrices_Quantity_6 1`] = ` b - + c @@ -8147,7 +8147,7 @@ exports[`Physics7_0 Matrices_Quantity_7 1`] = ` ( - + a @@ -8155,7 +8155,7 @@ exports[`Physics7_0 Matrices_Quantity_7 1`] = ` b - + c @@ -8174,7 +8174,7 @@ exports[`Physics7_0 Matrices_Quantity_8 1`] = ` - + a @@ -8182,7 +8182,7 @@ exports[`Physics7_0 Matrices_Quantity_8 1`] = ` b - + c @@ -8201,7 +8201,7 @@ exports[`Physics7_0 Matrices_Quantity_9 1`] = ` [ - + a @@ -8209,7 +8209,7 @@ exports[`Physics7_0 Matrices_Quantity_9 1`] = ` b - + c @@ -8228,7 +8228,7 @@ exports[`Physics7_0 Matrices_Quantity_10 1`] = ` | - + a @@ -8236,7 +8236,7 @@ exports[`Physics7_0 Matrices_Quantity_10 1`] = ` b - + c @@ -8255,7 +8255,7 @@ exports[`Physics7_0 Matrices_Quantity_11 1`] = ` | - + a @@ -8263,7 +8263,7 @@ exports[`Physics7_0 Matrices_Quantity_11 1`] = ` b - + c @@ -8282,7 +8282,7 @@ exports[`Physics7_1 Matrices_Fenced_0 1`] = ` ( - + Q @@ -8293,7 +8293,7 @@ exports[`Physics7_1 Matrices_Fenced_0 1`] = ` ( - + R @@ -8309,7 +8309,7 @@ exports[`Physics7_1 Matrices_Fenced_1 1`] = ` - + Q @@ -8320,7 +8320,7 @@ exports[`Physics7_1 Matrices_Fenced_1 1`] = ` - + R @@ -8336,7 +8336,7 @@ exports[`Physics7_1 Matrices_Fenced_2 1`] = ` [ - + Q @@ -8347,7 +8347,7 @@ exports[`Physics7_1 Matrices_Fenced_2 1`] = ` [ - + R @@ -8363,7 +8363,7 @@ exports[`Physics7_1 Matrices_Fenced_3 1`] = ` | - + Q @@ -8374,7 +8374,7 @@ exports[`Physics7_1 Matrices_Fenced_3 1`] = ` | - + R @@ -8390,7 +8390,7 @@ exports[`Physics7_1 Matrices_Fenced_4 1`] = ` ( - + a @@ -8398,7 +8398,7 @@ exports[`Physics7_1 Matrices_Fenced_4 1`] = ` b - + c @@ -8417,7 +8417,7 @@ exports[`Physics7_1 Matrices_Fenced_5 1`] = ` - + a @@ -8425,7 +8425,7 @@ exports[`Physics7_1 Matrices_Fenced_5 1`] = ` b - + c @@ -8444,7 +8444,7 @@ exports[`Physics7_1 Matrices_Fenced_6 1`] = ` [ - + a @@ -8452,7 +8452,7 @@ exports[`Physics7_1 Matrices_Fenced_6 1`] = ` b - + c @@ -8471,7 +8471,7 @@ exports[`Physics7_1 Matrices_Fenced_7 1`] = ` | - + a @@ -8479,7 +8479,7 @@ exports[`Physics7_1 Matrices_Fenced_7 1`] = ` b - + c @@ -8497,7 +8497,7 @@ exports[`Physics7_2 Matrices_Small_0 1`] = ` " - + Q @@ -8512,7 +8512,7 @@ exports[`Physics7_2 Matrices_Small_1 1`] = ` " - + a @@ -8521,7 +8521,7 @@ exports[`Physics7_2 Matrices_Small_1 1`] = ` b - + c @@ -8540,7 +8540,7 @@ exports[`Physics7_2 Matrices_Small_2 1`] = ` - + a @@ -8549,7 +8549,7 @@ exports[`Physics7_2 Matrices_Small_2 1`] = ` b - + c @@ -8570,7 +8570,7 @@ exports[`Physics7_2 Matrices_Small_3 1`] = ` ( - + a @@ -8579,7 +8579,7 @@ exports[`Physics7_2 Matrices_Small_3 1`] = ` b - + c @@ -8600,7 +8600,7 @@ exports[`Physics7_2 Matrices_Small_5 1`] = ` | - + a @@ -8609,7 +8609,7 @@ exports[`Physics7_2 Matrices_Small_5 1`] = ` b - + c @@ -8628,7 +8628,7 @@ exports[`Physics7_2 Matrices_Small_6 1`] = ` " - + a @@ -8637,7 +8637,7 @@ exports[`Physics7_2 Matrices_Small_6 1`] = ` b - + c @@ -8656,7 +8656,7 @@ exports[`Physics7_2 Matrices_Small_7 1`] = ` ( - + a @@ -8665,7 +8665,7 @@ exports[`Physics7_2 Matrices_Small_7 1`] = ` b - + c @@ -8686,7 +8686,7 @@ exports[`Physics7_2 Matrices_Small_8 1`] = ` - + a @@ -8695,7 +8695,7 @@ exports[`Physics7_2 Matrices_Small_8 1`] = ` b - + c @@ -8716,7 +8716,7 @@ exports[`Physics7_2 Matrices_Small_9 1`] = ` [ - + a @@ -8725,7 +8725,7 @@ exports[`Physics7_2 Matrices_Small_9 1`] = ` b - + c @@ -8746,7 +8746,7 @@ exports[`Physics7_2 Matrices_Small_10 1`] = ` | - + a @@ -8755,7 +8755,7 @@ exports[`Physics7_2 Matrices_Small_10 1`] = ` b - + c @@ -8776,7 +8776,7 @@ exports[`Physics7_3 Matrices_SmallFenced_0 1`] = ` ( - + Q @@ -8790,7 +8790,7 @@ exports[`Physics7_3 Matrices_SmallFenced_0 1`] = ` ( - + R @@ -8809,7 +8809,7 @@ exports[`Physics7_3 Matrices_SmallFenced_1 1`] = ` - + Q @@ -8823,7 +8823,7 @@ exports[`Physics7_3 Matrices_SmallFenced_1 1`] = ` - + R @@ -8842,7 +8842,7 @@ exports[`Physics7_3 Matrices_SmallFenced_2 1`] = ` [ - + Q @@ -8856,7 +8856,7 @@ exports[`Physics7_3 Matrices_SmallFenced_2 1`] = ` [ - + R @@ -8875,7 +8875,7 @@ exports[`Physics7_3 Matrices_SmallFenced_3 1`] = ` | - + Q @@ -8889,7 +8889,7 @@ exports[`Physics7_3 Matrices_SmallFenced_3 1`] = ` | - + R @@ -8908,7 +8908,7 @@ exports[`Physics7_3 Matrices_SmallFenced_4 1`] = ` ( - + a @@ -8917,7 +8917,7 @@ exports[`Physics7_3 Matrices_SmallFenced_4 1`] = ` b - + c @@ -8938,7 +8938,7 @@ exports[`Physics7_3 Matrices_SmallFenced_5 1`] = ` - + a @@ -8947,7 +8947,7 @@ exports[`Physics7_3 Matrices_SmallFenced_5 1`] = ` b - + c @@ -8968,7 +8968,7 @@ exports[`Physics7_3 Matrices_SmallFenced_6 1`] = ` [ - + a @@ -8977,7 +8977,7 @@ exports[`Physics7_3 Matrices_SmallFenced_6 1`] = ` b - + c @@ -8998,7 +8998,7 @@ exports[`Physics7_3 Matrices_SmallFenced_7 1`] = ` | - + a @@ -9007,7 +9007,7 @@ exports[`Physics7_3 Matrices_SmallFenced_7 1`] = ` b - + c @@ -9027,7 +9027,7 @@ exports[`Physics7_4 Matrices_Det_0 1`] = ` | - + a @@ -9035,7 +9035,7 @@ exports[`Physics7_4 Matrices_Det_0 1`] = ` b - + c @@ -9054,7 +9054,7 @@ exports[`Physics7_4 Matrices_Det_1 1`] = ` | - + a @@ -9062,7 +9062,7 @@ exports[`Physics7_4 Matrices_Det_1 1`] = ` b - + c @@ -9082,7 +9082,7 @@ exports[`Physics7_4 Matrices_Det_2 1`] = ` | - + a @@ -9091,7 +9091,7 @@ exports[`Physics7_4 Matrices_Det_2 1`] = ` b - + c @@ -9111,7 +9111,7 @@ exports[`Physics7_4 Matrices_Det_3 1`] = ` | - + a @@ -9128,7 +9128,7 @@ exports[`Physics7_4 Matrices_Det_4 1`] = ` | - + a @@ -9146,7 +9146,7 @@ exports[`Physics7_4 Matrices_Det_5 1`] = ` | - + a @@ -9163,7 +9163,7 @@ exports[`Physics7_4 Matrices_Det_5 1`] = ` exports[`Physics7_5 Matrices_Identity_0 1`] = ` " - + 1 @@ -9174,7 +9174,7 @@ exports[`Physics7_5 Matrices_Identity_0 1`] = ` 0 - + 0 @@ -9185,7 +9185,7 @@ exports[`Physics7_5 Matrices_Identity_0 1`] = ` 0 - + 0 @@ -9205,7 +9205,7 @@ exports[`Physics7_5 Matrices_Identity_1 1`] = ` | - + 1 @@ -9222,7 +9222,7 @@ exports[`Physics7_5 Matrices_Identity_1 1`] = ` 0 - + 0 @@ -9239,7 +9239,7 @@ exports[`Physics7_5 Matrices_Identity_1 1`] = ` 0 - + 0 @@ -9256,7 +9256,7 @@ exports[`Physics7_5 Matrices_Identity_1 1`] = ` 0 - + 0 @@ -9273,7 +9273,7 @@ exports[`Physics7_5 Matrices_Identity_1 1`] = ` 0 - + 0 @@ -9301,7 +9301,7 @@ exports[`Physics7_5 Matrices_Identity_2 1`] = ` | - + 1 @@ -9317,7 +9317,7 @@ exports[`Physics7_5 Matrices_Identity_3 1`] = ` | - + 1 @@ -9333,7 +9333,7 @@ exports[`Physics7_5 Matrices_Identity_4 1`] = ` | - + 1 @@ -9349,7 +9349,7 @@ exports[`Physics7_5 Matrices_Identity_5 1`] = ` ( - + 1 @@ -9360,7 +9360,7 @@ exports[`Physics7_5 Matrices_Identity_5 1`] = ` 0 - + 0 @@ -9371,7 +9371,7 @@ exports[`Physics7_5 Matrices_Identity_5 1`] = ` 0 - + 0 @@ -9386,7 +9386,7 @@ exports[`Physics7_5 Matrices_Identity_5 1`] = ` 0 - + 0 @@ -9406,7 +9406,7 @@ exports[`Physics7_6 Matrices_XMatrix_0 1`] = ` ( - + 1 @@ -9418,7 +9418,7 @@ exports[`Physics7_6 Matrices_XMatrix_0 1`] = ` 1 - + 1 @@ -9442,7 +9442,7 @@ exports[`Physics7_6 Matrices_XMatrix_1 1`] = ` ( - + a @@ -9454,7 +9454,7 @@ exports[`Physics7_6 Matrices_XMatrix_1 1`] = ` a - + a @@ -9465,7 +9465,7 @@ exports[`Physics7_6 Matrices_XMatrix_1 1`] = ` a - + a @@ -9489,18 +9489,18 @@ exports[`Physics7_6 Matrices_XMatrix_2 1`] = ` ( - + a - + a - + a @@ -9518,7 +9518,7 @@ exports[`Physics7_6 Matrices_XMatrix_3 1`] = ` ( - + a @@ -9543,7 +9543,7 @@ exports[`Physics7_6 Matrices_XMatrix_4 1`] = ` ( - + @@ -9585,7 +9585,7 @@ exports[`Physics7_6 Matrices_XMatrix_4 1`] = ` - + 1 @@ -9639,7 +9639,7 @@ exports[`Physics7_6 Matrices_XMatrix_5 1`] = ` ( - + @@ -9681,7 +9681,7 @@ exports[`Physics7_6 Matrices_XMatrix_5 1`] = ` - + a @@ -9722,7 +9722,7 @@ exports[`Physics7_6 Matrices_XMatrix_5 1`] = ` - + a @@ -9776,7 +9776,7 @@ exports[`Physics7_6 Matrices_XMatrix_6 1`] = ` ( - + @@ -9787,7 +9787,7 @@ exports[`Physics7_6 Matrices_XMatrix_6 1`] = ` - + a @@ -9797,7 +9797,7 @@ exports[`Physics7_6 Matrices_XMatrix_6 1`] = ` - + a @@ -9820,7 +9820,7 @@ exports[`Physics7_6 Matrices_XMatrix_7 1`] = ` ( - + @@ -9860,7 +9860,7 @@ exports[`Physics7_6 Matrices_XMatrix_8 1`] = ` ( - + a @@ -9879,7 +9879,7 @@ exports[`Physics7_6 Matrices_XMatrix_9 1`] = ` ( - + a @@ -9898,7 +9898,7 @@ exports[`Physics7_6 Matrices_XMatrix_10 1`] = ` ( - + 0 @@ -9923,7 +9923,7 @@ exports[`Physics7_6 Matrices_XMatrix_11 1`] = ` ( - + 0 @@ -9935,7 +9935,7 @@ exports[`Physics7_6 Matrices_XMatrix_11 1`] = ` 0 - + 0 @@ -9959,18 +9959,18 @@ exports[`Physics7_6 Matrices_XMatrix_12 1`] = ` ( - + 0 - + 0 - + 0 @@ -9985,7 +9985,7 @@ exports[`Physics7_6 Matrices_XMatrix_12 1`] = ` exports[`Physics7_7 Matrices_Pauli_0 1`] = ` " - + 1 @@ -9993,7 +9993,7 @@ exports[`Physics7_7 Matrices_Pauli_0 1`] = ` 0 - + 0 @@ -10010,7 +10010,7 @@ exports[`Physics7_7 Matrices_Pauli_1 1`] = ` ( - + 1 @@ -10018,7 +10018,7 @@ exports[`Physics7_7 Matrices_Pauli_1 1`] = ` 0 - + 0 @@ -10035,7 +10035,7 @@ exports[`Physics7_7 Matrices_Pauli_1 1`] = ` exports[`Physics7_7 Matrices_Pauli_2 1`] = ` " - + 0 @@ -10043,7 +10043,7 @@ exports[`Physics7_7 Matrices_Pauli_2 1`] = ` 1 - + 1 @@ -10058,7 +10058,7 @@ exports[`Physics7_7 Matrices_Pauli_2 1`] = ` exports[`Physics7_7 Matrices_Pauli_3 1`] = ` " - + 0 @@ -10067,7 +10067,7 @@ exports[`Physics7_7 Matrices_Pauli_3 1`] = ` i - + i @@ -10082,7 +10082,7 @@ exports[`Physics7_7 Matrices_Pauli_3 1`] = ` exports[`Physics7_7 Matrices_Pauli_4 1`] = ` " - + 1 @@ -10090,7 +10090,7 @@ exports[`Physics7_7 Matrices_Pauli_4 1`] = ` 0 - + 0 @@ -10112,7 +10112,7 @@ exports[`Physics7_7 Matrices_Pauli_5 1`] = ` exports[`Physics7_7 Matrices_Pauli_6 1`] = ` " - + 0 @@ -10120,7 +10120,7 @@ exports[`Physics7_7 Matrices_Pauli_6 1`] = ` 1 - + 1 @@ -10135,7 +10135,7 @@ exports[`Physics7_7 Matrices_Pauli_6 1`] = ` exports[`Physics7_7 Matrices_Pauli_7 1`] = ` " - + 0 @@ -10144,7 +10144,7 @@ exports[`Physics7_7 Matrices_Pauli_7 1`] = ` i - + i @@ -10159,7 +10159,7 @@ exports[`Physics7_7 Matrices_Pauli_7 1`] = ` exports[`Physics7_7 Matrices_Pauli_8 1`] = ` " - + 1 @@ -10167,7 +10167,7 @@ exports[`Physics7_7 Matrices_Pauli_8 1`] = ` 0 - + 0 @@ -10199,7 +10199,7 @@ exports[`Physics7_7 Matrices_Pauli_10 1`] = ` exports[`Physics7_7 Matrices_Pauli_11 1`] = ` " - + a @@ -10213,7 +10213,7 @@ exports[`Physics7_7 Matrices_Pauli_12 1`] = ` ( - + . a @@ -10223,7 +10223,7 @@ exports[`Physics7_7 Matrices_Pauli_12 1`] = ` 0 - + 0 @@ -10242,7 +10242,7 @@ exports[`Physics7_8 Matrices_PauliFenced_0 1`] = ` ( - + 0 @@ -10250,7 +10250,7 @@ exports[`Physics7_8 Matrices_PauliFenced_0 1`] = ` 1 - + 1 @@ -10269,7 +10269,7 @@ exports[`Physics7_8 Matrices_PauliFenced_1 1`] = ` ( - + 0 @@ -10278,7 +10278,7 @@ exports[`Physics7_8 Matrices_PauliFenced_1 1`] = ` i - + i @@ -10297,7 +10297,7 @@ exports[`Physics7_8 Matrices_PauliFenced_2 1`] = ` ( - + 1 @@ -10305,7 +10305,7 @@ exports[`Physics7_8 Matrices_PauliFenced_2 1`] = ` 0 - + 0 @@ -10335,7 +10335,7 @@ exports[`Physics7_8 Matrices_PauliFenced_4 1`] = ` ( - + 0 @@ -10343,7 +10343,7 @@ exports[`Physics7_8 Matrices_PauliFenced_4 1`] = ` 1 - + 1 @@ -10362,7 +10362,7 @@ exports[`Physics7_8 Matrices_PauliFenced_5 1`] = ` ( - + 0 @@ -10371,7 +10371,7 @@ exports[`Physics7_8 Matrices_PauliFenced_5 1`] = ` i - + i @@ -10390,7 +10390,7 @@ exports[`Physics7_8 Matrices_PauliFenced_6 1`] = ` ( - + 1 @@ -10398,7 +10398,7 @@ exports[`Physics7_8 Matrices_PauliFenced_6 1`] = ` 0 - + 0 @@ -10418,7 +10418,7 @@ exports[`Physics7_8 Matrices_PauliFenced_7 1`] = ` ( - + a @@ -10434,10 +10434,10 @@ exports[`Physics7_9 Matrices_Diag_0 1`] = ` ( - + - + 1 @@ -10445,11 +10445,11 @@ exports[`Physics7_9 Matrices_Diag_0 1`] = ` - + - + 2 @@ -10457,7 +10457,7 @@ exports[`Physics7_9 Matrices_Diag_0 1`] = ` 3 - + 4 @@ -10479,7 +10479,7 @@ exports[`Physics7_9 Matrices_Diag_1 1`] = ` ( - + 1 @@ -10495,7 +10495,7 @@ exports[`Physics7_9 Matrices_Diag_2 1`] = ` ( - + 1 , @@ -10513,10 +10513,10 @@ exports[`Physics7_9 Matrices_Diag_3 1`] = ` ( - + - + 1 @@ -10524,11 +10524,11 @@ exports[`Physics7_9 Matrices_Diag_3 1`] = ` - + - + 2 @@ -10536,7 +10536,7 @@ exports[`Physics7_9 Matrices_Diag_3 1`] = ` 3 - + 4 @@ -10550,12 +10550,12 @@ exports[`Physics7_9 Matrices_Diag_3 1`] = ` - + - + 7 @@ -10563,13 +10563,13 @@ exports[`Physics7_9 Matrices_Diag_3 1`] = ` - + - + 8 @@ -10588,10 +10588,10 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` ( - + - + 1 @@ -10599,11 +10599,11 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` - + - + 2 @@ -10611,7 +10611,7 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` 3 - + 4 @@ -10622,12 +10622,12 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` - + - + 6 @@ -10635,13 +10635,13 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` - + - + 7 @@ -10649,14 +10649,14 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` - + - + 8 @@ -10675,10 +10675,10 @@ exports[`Physics7_9 Matrices_Diag_5 1`] = ` ( - + - + 1 @@ -10686,31 +10686,31 @@ exports[`Physics7_9 Matrices_Diag_5 1`] = ` - + - + 2 - + 3 - + 4 - + 5 - + 6 @@ -10718,12 +10718,12 @@ exports[`Physics7_9 Matrices_Diag_5 1`] = ` - + - + 7 @@ -10731,13 +10731,13 @@ exports[`Physics7_9 Matrices_Diag_5 1`] = ` - + - + 8 @@ -10756,10 +10756,10 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` ( - + - + 1 @@ -10767,11 +10767,11 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + - + 2 @@ -10779,7 +10779,7 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` 3 - + 4 @@ -10793,12 +10793,12 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + - + 7 @@ -10806,13 +10806,13 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + - + 8 @@ -10820,17 +10820,17 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + - + - + 9 @@ -10838,11 +10838,11 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + - + 10 @@ -10864,11 +10864,11 @@ exports[`Physics7_10 Matrices_Adiag_0 1`] = ` ( - + - + 1 @@ -10876,10 +10876,10 @@ exports[`Physics7_10 Matrices_Adiag_0 1`] = ` - + - + 2 @@ -10887,7 +10887,7 @@ exports[`Physics7_10 Matrices_Adiag_0 1`] = ` 3 - + 4 @@ -10909,7 +10909,7 @@ exports[`Physics7_10 Matrices_Adiag_1 1`] = ` ( - + 1 @@ -10925,7 +10925,7 @@ exports[`Physics7_10 Matrices_Adiag_2 1`] = ` ( - + 1 , @@ -10943,13 +10943,13 @@ exports[`Physics7_10 Matrices_Adiag_3 1`] = ` ( - + - + 1 @@ -10957,12 +10957,12 @@ exports[`Physics7_10 Matrices_Adiag_3 1`] = ` - + - + 2 @@ -10970,7 +10970,7 @@ exports[`Physics7_10 Matrices_Adiag_3 1`] = ` 3 - + 4 @@ -10984,11 +10984,11 @@ exports[`Physics7_10 Matrices_Adiag_3 1`] = ` - + - + 7 @@ -10996,10 +10996,10 @@ exports[`Physics7_10 Matrices_Adiag_3 1`] = ` - + - + 8 @@ -11018,14 +11018,14 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` ( - + - + 1 @@ -11033,13 +11033,13 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` - + - + 2 @@ -11047,7 +11047,7 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` 3 - + 4 @@ -11058,12 +11058,12 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` - + - + 6 @@ -11071,11 +11071,11 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` - + - + 7 @@ -11083,10 +11083,10 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` - + - + 8 @@ -11105,14 +11105,14 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` ( - + - + 1 @@ -11120,13 +11120,13 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + - + 2 @@ -11134,7 +11134,7 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` 3 - + 4 @@ -11148,12 +11148,12 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + - + 7 @@ -11161,11 +11161,11 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + - + 8 @@ -11173,13 +11173,13 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + - + - + 9 @@ -11187,11 +11187,11 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + - + 10 @@ -11235,7 +11235,7 @@ exports[`Physics7_11 Matrices_Other_2 1`] = ` ( - + @@ -11252,10 +11252,10 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` ( - + - + 1 @@ -11263,11 +11263,11 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + - + 2 @@ -11278,12 +11278,12 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + - + 4 @@ -11294,7 +11294,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` 5 - + 4 @@ -11305,13 +11305,13 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + - + 33 @@ -11319,14 +11319,14 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + - + 4 @@ -11334,7 +11334,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + @@ -11342,7 +11342,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + 5 @@ -11350,7 +11350,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + @@ -11359,7 +11359,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + 7 @@ -11367,7 +11367,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + @@ -11377,17 +11377,17 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + 8 - + 0 - + 10 @@ -11395,7 +11395,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` 20 - + 3 @@ -11403,7 +11403,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + @@ -11414,7 +11414,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` - + 200 @@ -11433,10 +11433,10 @@ exports[`Physics7_11 Matrices_Other_4 1`] = ` ( - + - + 1 @@ -11444,11 +11444,11 @@ exports[`Physics7_11 Matrices_Other_4 1`] = ` - + - + 2 @@ -11456,7 +11456,7 @@ exports[`Physics7_11 Matrices_Other_4 1`] = ` 3 - + 4 @@ -11478,10 +11478,10 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` ( - + - + 1 @@ -11489,11 +11489,11 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + - + 2 @@ -11501,7 +11501,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` 3 - + 4 @@ -11515,12 +11515,12 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + - + 1 @@ -11531,7 +11531,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` 0 - + 0 @@ -11542,7 +11542,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` 0 - + 0 @@ -11556,13 +11556,13 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + - + 7 @@ -11570,14 +11570,14 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + - + 8 @@ -11585,7 +11585,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + @@ -11593,10 +11593,10 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + - + 9 @@ -11604,11 +11604,11 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + - + 10 @@ -11630,10 +11630,10 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` ( - + - + 1 @@ -11641,11 +11641,11 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` - + - + 2 @@ -11653,7 +11653,7 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` 3 - + 4 @@ -11667,12 +11667,12 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` - + - + 1 @@ -11683,7 +11683,7 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` 0 - + 0 @@ -11694,7 +11694,7 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` 0 - + 0 @@ -11708,13 +11708,13 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` - + - + 7 @@ -11745,7 +11745,7 @@ exports[`Physics7_11 Matrices_Other_8 1`] = ` " - + a @@ -11753,7 +11753,7 @@ exports[`Physics7_11 Matrices_Other_8 1`] = ` b - + c @@ -11770,7 +11770,7 @@ exports[`Physics7_11 Matrices_Other_9 1`] = ` " - + 1 @@ -11782,7 +11782,7 @@ exports[`Physics7_11 Matrices_Other_9 1`] = ` 0 - + 0 @@ -11793,7 +11793,7 @@ exports[`Physics7_11 Matrices_Other_9 1`] = ` 0 - + 0 @@ -11812,7 +11812,7 @@ exports[`Physics7_11 Matrices_Other_9 1`] = ` exports[`Physics7_11 Matrices_Other_10 1`] = ` " - + 1 @@ -11844,7 +11844,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -11876,7 +11876,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -11908,7 +11908,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -11940,7 +11940,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -11972,7 +11972,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -12004,7 +12004,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -12036,7 +12036,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -12068,7 +12068,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 @@ -12100,7 +12100,7 @@ exports[`Physics7_11 Matrices_Other_10 1`] = ` 0 - + 0 diff --git a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap index 79660e10a..832cdf8f9 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap @@ -72,7 +72,7 @@ exports[`Page References LabelIds 1`] = ` exports[`TagAll Align 1`] = ` " - + ( 1 @@ -89,7 +89,7 @@ exports[`TagAll Align 1`] = ` exports[`TagAll Align Two labels 1`] = ` " - + ( 1 @@ -101,7 +101,7 @@ exports[`TagAll Align Two labels 1`] = ` b - + ( 2 @@ -125,7 +125,7 @@ exports[`TagAll Align Two labels 1`] = ` exports[`TagAll Eqref 1`] = ` " - + ( 1 @@ -145,7 +145,7 @@ exports[`TagAll Eqref 1`] = ` exports[`TagAll Label 1`] = ` " - + ( 1 @@ -162,7 +162,7 @@ exports[`TagAll Label 1`] = ` exports[`TagAll Label Default 1`] = ` " - + ( 1 @@ -179,7 +179,7 @@ exports[`TagAll Label Default 1`] = ` exports[`TagAll Label Empty 1`] = ` " - + ( 1 @@ -196,7 +196,7 @@ exports[`TagAll Label Empty 1`] = ` exports[`TagAll Label Named 1`] = ` " - + ( A @@ -213,7 +213,7 @@ exports[`TagAll Label Named 1`] = ` exports[`TagAll Label Named Default 1`] = ` " - + ( A @@ -223,7 +223,7 @@ exports[`TagAll Label Named Default 1`] = ` a - + ( 1 @@ -240,7 +240,7 @@ exports[`TagAll Label Named Default 1`] = ` exports[`TagAll Label Named Named 1`] = ` " - + ( A @@ -250,7 +250,7 @@ exports[`TagAll Label Named Named 1`] = ` a - + ( B @@ -294,7 +294,7 @@ exports[`TagAll MultLine 1`] = ` exports[`TagAll Notag Align 1`] = ` " - + a @@ -328,7 +328,7 @@ exports[`TagAll Notag Multline 1`] = ` exports[`TagAll Notag Tag 1`] = ` " - + a @@ -340,7 +340,7 @@ exports[`TagAll Notag Tag 1`] = ` exports[`TagAll Ref 1`] = ` " - + ( 1 @@ -360,7 +360,7 @@ exports[`TagAll Ref 1`] = ` exports[`TagAll Ref Default 1`] = ` " - + ( 1 @@ -380,7 +380,7 @@ exports[`TagAll Ref Default 1`] = ` exports[`TagAll Ref Named 1`] = ` " - + ( A @@ -400,7 +400,7 @@ exports[`TagAll Ref Named 1`] = ` exports[`TagAll Ref Named Default 1`] = ` " - + ( A @@ -410,7 +410,7 @@ exports[`TagAll Ref Named Default 1`] = ` a - + ( 1 @@ -433,7 +433,7 @@ exports[`TagAll Ref Named Default 1`] = ` exports[`TagAll Ref Named Named 1`] = ` " - + ( A @@ -443,7 +443,7 @@ exports[`TagAll Ref Named Named 1`] = ` a - + ( B @@ -466,7 +466,7 @@ exports[`TagAll Ref Named Named 1`] = ` exports[`TagAll Ref Unknown 1`] = ` " - + ( 1 @@ -503,7 +503,7 @@ exports[`TagAll Single Expression 1`] = ` exports[`TagAll Tag Default 1`] = ` " - + ( 1 @@ -520,7 +520,7 @@ exports[`TagAll Tag Default 1`] = ` exports[`TagAll Tag Named 1`] = ` " - + ( A @@ -537,7 +537,7 @@ exports[`TagAll Tag Named 1`] = ` exports[`TagAll Tag Named Default 1`] = ` " - + ( A @@ -547,7 +547,7 @@ exports[`TagAll Tag Named Default 1`] = ` a - + ( 1 @@ -564,7 +564,7 @@ exports[`TagAll Tag Named Default 1`] = ` exports[`TagAll Tag Named Named 1`] = ` " - + ( A @@ -574,7 +574,7 @@ exports[`TagAll Tag Named Named 1`] = ` a - + ( B @@ -591,7 +591,7 @@ exports[`TagAll Tag Named Named 1`] = ` exports[`TagAms Align 1`] = ` " - + ( 1 @@ -608,7 +608,7 @@ exports[`TagAms Align 1`] = ` exports[`TagAms Align Two labels 1`] = ` " - + ( 1 @@ -620,7 +620,7 @@ exports[`TagAms Align Two labels 1`] = ` b - + ( 2 @@ -644,7 +644,7 @@ exports[`TagAms Align Two labels 1`] = ` exports[`TagAms Eqref 1`] = ` " - + ( 1 @@ -664,7 +664,7 @@ exports[`TagAms Eqref 1`] = ` exports[`TagAms Label 1`] = ` " - + ( 1 @@ -681,7 +681,7 @@ exports[`TagAms Label 1`] = ` exports[`TagAms Label Default 1`] = ` " - + ( 1 @@ -698,7 +698,7 @@ exports[`TagAms Label Default 1`] = ` exports[`TagAms Label Empty 1`] = ` " - + ( 1 @@ -715,7 +715,7 @@ exports[`TagAms Label Empty 1`] = ` exports[`TagAms Label Named 1`] = ` " - + ( A @@ -732,7 +732,7 @@ exports[`TagAms Label Named 1`] = ` exports[`TagAms Label Named Default 1`] = ` " - + ( A @@ -742,7 +742,7 @@ exports[`TagAms Label Named Default 1`] = ` a - + ( 1 @@ -759,7 +759,7 @@ exports[`TagAms Label Named Default 1`] = ` exports[`TagAms Label Named Named 1`] = ` " - + ( A @@ -769,7 +769,7 @@ exports[`TagAms Label Named Named 1`] = ` a - + ( B @@ -813,7 +813,7 @@ exports[`TagAms MultLine 1`] = ` exports[`TagAms Notag Align 1`] = ` " - + a @@ -847,7 +847,7 @@ exports[`TagAms Notag Multline 1`] = ` exports[`TagAms Notag Tag 1`] = ` " - + a @@ -859,7 +859,7 @@ exports[`TagAms Notag Tag 1`] = ` exports[`TagAms Ref 1`] = ` " - + ( 1 @@ -879,7 +879,7 @@ exports[`TagAms Ref 1`] = ` exports[`TagAms Ref Default 1`] = ` " - + ( 1 @@ -899,7 +899,7 @@ exports[`TagAms Ref Default 1`] = ` exports[`TagAms Ref Named 1`] = ` " - + ( A @@ -919,7 +919,7 @@ exports[`TagAms Ref Named 1`] = ` exports[`TagAms Ref Named Default 1`] = ` " - + ( A @@ -929,7 +929,7 @@ exports[`TagAms Ref Named Default 1`] = ` a - + ( 1 @@ -952,7 +952,7 @@ exports[`TagAms Ref Named Default 1`] = ` exports[`TagAms Ref Named Named 1`] = ` " - + ( A @@ -962,7 +962,7 @@ exports[`TagAms Ref Named Named 1`] = ` a - + ( B @@ -985,7 +985,7 @@ exports[`TagAms Ref Named Named 1`] = ` exports[`TagAms Ref Unknown 1`] = ` " - + ( 1 @@ -1011,7 +1011,7 @@ exports[`TagAms Single Expression 1`] = ` exports[`TagAms Split 1`] = ` " - + a @@ -1023,7 +1023,7 @@ exports[`TagAms Split 1`] = ` exports[`TagAms Tag Default 1`] = ` " - + ( 1 @@ -1040,7 +1040,7 @@ exports[`TagAms Tag Default 1`] = ` exports[`TagAms Tag Named 1`] = ` " - + ( A @@ -1057,7 +1057,7 @@ exports[`TagAms Tag Named 1`] = ` exports[`TagAms Tag Named Default 1`] = ` " - + ( A @@ -1067,7 +1067,7 @@ exports[`TagAms Tag Named Default 1`] = ` a - + ( 1 @@ -1084,7 +1084,7 @@ exports[`TagAms Tag Named Default 1`] = ` exports[`TagAms Tag Named Named 1`] = ` " - + ( A @@ -1094,7 +1094,7 @@ exports[`TagAms Tag Named Named 1`] = ` a - + ( B @@ -1111,7 +1111,7 @@ exports[`TagAms Tag Named Named 1`] = ` exports[`TagNone Align 1`] = ` " - + a @@ -1123,7 +1123,7 @@ exports[`TagNone Align 1`] = ` exports[`TagNone Eqref 1`] = ` " - + a @@ -1138,7 +1138,7 @@ exports[`TagNone Eqref 1`] = ` exports[`TagNone Label 1`] = ` " - + a @@ -1150,7 +1150,7 @@ exports[`TagNone Label 1`] = ` exports[`TagNone Label Default 1`] = ` " - + a @@ -1162,7 +1162,7 @@ exports[`TagNone Label Default 1`] = ` exports[`TagNone Label Empty 1`] = ` " - + a @@ -1174,7 +1174,7 @@ exports[`TagNone Label Empty 1`] = ` exports[`TagNone Label Named 1`] = ` " - + ( A @@ -1191,7 +1191,7 @@ exports[`TagNone Label Named 1`] = ` exports[`TagNone Label Named Default 1`] = ` " - + ( A @@ -1201,7 +1201,7 @@ exports[`TagNone Label Named Default 1`] = ` a - + b @@ -1213,7 +1213,7 @@ exports[`TagNone Label Named Default 1`] = ` exports[`TagNone Label Named Named 1`] = ` " - + ( A @@ -1223,7 +1223,7 @@ exports[`TagNone Label Named Named 1`] = ` a - + ( B @@ -1262,7 +1262,7 @@ exports[`TagNone MultLine 1`] = ` exports[`TagNone Notag Align 1`] = ` " - + a @@ -1296,7 +1296,7 @@ exports[`TagNone Notag Multline 1`] = ` exports[`TagNone Notag Tag 1`] = ` " - + a @@ -1308,7 +1308,7 @@ exports[`TagNone Notag Tag 1`] = ` exports[`TagNone Ref 1`] = ` " - + a @@ -1323,7 +1323,7 @@ exports[`TagNone Ref 1`] = ` exports[`TagNone Ref Default 1`] = ` " - + a @@ -1338,7 +1338,7 @@ exports[`TagNone Ref Default 1`] = ` exports[`TagNone Ref Named 1`] = ` " - + ( A @@ -1358,7 +1358,7 @@ exports[`TagNone Ref Named 1`] = ` exports[`TagNone Ref Named Default 1`] = ` " - + ( A @@ -1368,7 +1368,7 @@ exports[`TagNone Ref Named Default 1`] = ` a - + b @@ -1386,7 +1386,7 @@ exports[`TagNone Ref Named Default 1`] = ` exports[`TagNone Ref Named Named 1`] = ` " - + ( A @@ -1396,7 +1396,7 @@ exports[`TagNone Ref Named Named 1`] = ` a - + ( B @@ -1419,7 +1419,7 @@ exports[`TagNone Ref Named Named 1`] = ` exports[`TagNone Ref Unknown 1`] = ` " - + a @@ -1457,7 +1457,7 @@ exports[`TagNone Single Expression 1`] = ` exports[`TagNone Split 1`] = ` " - + a @@ -1469,7 +1469,7 @@ exports[`TagNone Split 1`] = ` exports[`TagNone Tag Default 1`] = ` " - + a @@ -1481,7 +1481,7 @@ exports[`TagNone Tag Default 1`] = ` exports[`TagNone Tag Named 1`] = ` " - + ( A @@ -1498,7 +1498,7 @@ exports[`TagNone Tag Named 1`] = ` exports[`TagNone Tag Named Default 1`] = ` " - + ( A @@ -1508,7 +1508,7 @@ exports[`TagNone Tag Named Default 1`] = ` a - + b @@ -1520,7 +1520,7 @@ exports[`TagNone Tag Named Default 1`] = ` exports[`TagNone Tag Named Named 1`] = ` " - + ( A @@ -1530,7 +1530,7 @@ exports[`TagNone Tag Named Named 1`] = ` a - + ( B diff --git a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap index d32e09fc4..4d61726e7 100644 --- a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap @@ -69,7 +69,7 @@ exports[`Tagformat Basic tag 1`] = ` exports[`Tagformat Custom ref 1`] = ` " - + ( x @@ -79,7 +79,7 @@ exports[`Tagformat Custom ref 1`] = ` x - + ( 1 @@ -98,7 +98,7 @@ exports[`Tagformat Custom ref 1`] = ` exports[`Tagformat Eqref 1`] = ` " - + [ x @@ -108,7 +108,7 @@ exports[`Tagformat Eqref 1`] = ` x - + [ A1 @@ -127,7 +127,7 @@ exports[`Tagformat Eqref 1`] = ` exports[`Tagformat Ref 1`] = ` " - + [ x @@ -137,7 +137,7 @@ exports[`Tagformat Ref 1`] = ` x - + [ A1 diff --git a/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap index 3c6ca50f5..ea428f42a 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap @@ -94,7 +94,7 @@ exports[`TexParser GetBrackets nested [ 1`] = ` exports[`TexParser Removed delimiter 1`] = ` " - + a From fd5569dc32a9159ee856ab4fc9f57a67ed99e33c Mon Sep 17 00:00:00 2001 From: zorkow Date: Tue, 14 Jul 2026 16:59:36 +0200 Subject: [PATCH 03/11] ensure labels will get the right latex attribute --- .../input/tex/__snapshots__/Ams.test.ts.snap | 42 +-- .../input/tex/__snapshots__/Base.test.ts.snap | 36 +- .../tex/__snapshots__/Cases.test.ts.snap | 38 +- .../tex/__snapshots__/Empheq.test.ts.snap | 40 +-- .../tex/__snapshots__/Mathtools.test.ts.snap | 20 +- .../tex/__snapshots__/SetOptions.test.ts.snap | 4 +- .../input/tex/__snapshots__/Tag.test.ts.snap | 328 +++++++++--------- .../tex/__snapshots__/TagFormat.test.ts.snap | 38 +- ts/input/tex/NodeUtil.ts | 26 ++ ts/input/tex/Tags.ts | 10 + ts/input/tex/TexParser.ts | 19 + ts/input/tex/ams/AmsMethods.ts | 1 + ts/input/tex/base/BaseItems.ts | 14 +- ts/input/tex/base/BaseMethods.ts | 3 + 14 files changed, 334 insertions(+), 285 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap index 15f1f6d89..1259e3178 100644 --- a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap @@ -1515,7 +1515,7 @@ exports[`Ams Environments pmatrix 1`] = ` exports[`Ams Environments xalign tagged 1`] = ` " - + ( @@ -1529,7 +1529,7 @@ exports[`Ams Environments xalign tagged 1`] = ` - b + b @@ -2006,7 +2006,7 @@ exports[`Ams Symbol 1`] = ` exports[`Ams Tagged Environments Align 1`] = ` " - + ( 1 @@ -2023,7 +2023,7 @@ exports[`Ams Tagged Environments Align 1`] = ` - + ( 2 @@ -2047,7 +2047,7 @@ exports[`Ams Tagged Environments Align 1`] = ` exports[`Ams Tagged Environments Align Notag 1`] = ` " - + ( 1 @@ -2064,13 +2064,13 @@ exports[`Ams Tagged Environments Align Notag 1`] = ` - + = - c + c @@ -2112,7 +2112,7 @@ exports[`Ams Tagged Environments Align Star 1`] = ` exports[`Ams Tagged Environments Alignat 1`] = ` " - + ( 1 @@ -2129,7 +2129,7 @@ exports[`Ams Tagged Environments Alignat 1`] = ` - + ( 2 @@ -2294,7 +2294,7 @@ exports[`Ams Tagged Environments Alignedat 1`] = ` exports[`Ams Tagged Environments Eqnarray 1`] = ` " - + ( 1 @@ -2313,7 +2313,7 @@ exports[`Ams Tagged Environments Eqnarray 1`] = ` - + ( 2 @@ -2374,7 +2374,7 @@ exports[`Ams Tagged Environments Eqnarray Star 1`] = ` exports[`Ams Tagged Environments Equation 1`] = ` " - + ( 1 @@ -2397,7 +2397,7 @@ exports[`Ams Tagged Environments Equation Star 1`] = ` exports[`Ams Tagged Environments Gather 1`] = ` " - + ( 1 @@ -2409,7 +2409,7 @@ exports[`Ams Tagged Environments Gather 1`] = ` b - + ( 2 @@ -2495,7 +2495,7 @@ exports[`Ams Tagged Environments Gathered 1`] = ` exports[`Ams Tagged Environments Left Gather Align 1`] = ` " - + ( 2 @@ -2503,7 +2503,7 @@ exports[`Ams Tagged Environments Left Gather Align 1`] = ` - + ( 1 @@ -2537,7 +2537,7 @@ exports[`Ams Tagged Environments Left multline tagged left 1`] = ` ) - a + a @@ -2547,7 +2547,7 @@ exports[`Ams Tagged Environments Left multline tagged left 1`] = ` exports[`Ams Tagged Environments Left xalign tagged left 1`] = ` " - + ( @@ -2561,7 +2561,7 @@ exports[`Ams Tagged Environments Left xalign tagged left 1`] = ` - b + b @@ -2747,7 +2747,7 @@ exports[`Ams Tagged Environments aligned [x] 1`] = ` exports[`Ams Tagged Environments flalign 1`] = ` " - + ( 1 @@ -2771,7 +2771,7 @@ exports[`Ams Tagged Environments flalign 1`] = ` exports[`Ams Tagged Environments xalignet 1`] = ` " - + ( diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index 4d91b7da5..021808512 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -7573,14 +7573,14 @@ exports[`Primes Triple Prime 1`] = ` exports[`Referencing Label 1`] = ` " - + ( 1 ) - a + a @@ -7590,14 +7590,14 @@ exports[`Referencing Label 1`] = ` exports[`Referencing Label Empty 1`] = ` " - + ( 1 ) - a + a @@ -7607,24 +7607,24 @@ exports[`Referencing Label Empty 1`] = ` exports[`Referencing Label Multiple 1`] = ` " - + ( 1 ) - a + a - + ( 2 ) - c + c @@ -7634,7 +7634,7 @@ exports[`Referencing Label Multiple 1`] = ` exports[`Referencing Nonumber 1`] = ` " - + ( 1 @@ -7644,9 +7644,9 @@ exports[`Referencing Nonumber 1`] = ` a - + - c + c @@ -7656,14 +7656,14 @@ exports[`Referencing Nonumber 1`] = ` exports[`Referencing Ref 1`] = ` " - + ( 1 ) - a + a ??? @@ -7676,14 +7676,14 @@ exports[`Referencing Ref 1`] = ` exports[`Referencing Ref Unknown 1`] = ` " - + ( 1 ) - a + a ??? @@ -9026,7 +9026,7 @@ exports[`Sub and Superscripts SubSup 1`] = ` exports[`Tagged Environments EqnTest 1`] = ` " - + ( 1 @@ -9048,7 +9048,7 @@ exports[`Tagged Environments EqnTest 1`] = ` exports[`Tagged Environments Equation 1`] = ` " - + ( 1 @@ -9205,7 +9205,7 @@ exports[`User Defined Environments smallmatrix 1`] = ` exports[`User Defined Macros EqRef 1`] = ` " - a + a (???) diff --git a/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap index f6514ec86..3b66bcd75 100644 --- a/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Cases.test.ts.snap @@ -3,7 +3,7 @@ exports[`Cases Numcases 1`] = ` " - + ( 1 @@ -22,7 +22,7 @@ exports[`Cases Numcases 1`] = ` - + ( 1 @@ -48,7 +48,7 @@ exports[`Cases Numcases 1`] = ` - + ( 2 @@ -73,7 +73,7 @@ exports[`Cases Numcases 1`] = ` - + ( 1 @@ -124,7 +124,7 @@ exports[`Cases Numcases 1`] = ` - + ( 2 @@ -150,7 +150,7 @@ exports[`Cases Numcases 1`] = ` exports[`Cases Numcases with macro 1`] = ` " - + ( 1 @@ -166,7 +166,7 @@ exports[`Cases Numcases with macro 1`] = ` - + ( 1 @@ -191,7 +191,7 @@ exports[`Cases Numcases with macro 1`] = ` - + ( 1 @@ -248,7 +248,7 @@ exports[`Cases entry not in numcases 1`] = ` exports[`Cases numcases with explicit tag 1`] = ` " - + ( A @@ -264,14 +264,14 @@ exports[`Cases numcases with explicit tag 1`] = ` - + ( A ) - x + x @@ -289,14 +289,14 @@ exports[`Cases numcases with explicit tag 1`] = ` - + ( A ) - x + x @@ -313,7 +313,7 @@ exports[`Cases numcases with explicit tag 1`] = ` - x + x @@ -331,7 +331,7 @@ exports[`Cases numcases with explicit tag 1`] = ` exports[`Cases subnumcases 1`] = ` " - + ( 1a @@ -350,7 +350,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1a @@ -376,7 +376,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1b @@ -401,7 +401,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1a @@ -452,7 +452,7 @@ exports[`Cases subnumcases 1`] = ` - + ( 1b diff --git a/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap index dd632401a..326041006 100644 --- a/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Empheq.test.ts.snap @@ -225,7 +225,7 @@ exports[`Empheq Characters empheqrvert 1`] = ` exports[`Empheq Empheq Left 1`] = ` " - + ( 1 @@ -239,7 +239,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 1 @@ -256,7 +256,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 2 @@ -280,7 +280,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 1 @@ -313,7 +313,7 @@ exports[`Empheq Empheq Left 1`] = ` - + ( 2 @@ -338,7 +338,7 @@ exports[`Empheq Empheq Left 1`] = ` exports[`Empheq Empheq Right 1`] = ` " - + ( 1 @@ -362,7 +362,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 1 @@ -379,7 +379,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 2 @@ -403,7 +403,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 1 @@ -426,7 +426,7 @@ exports[`Empheq Empheq Right 1`] = ` - + ( 2 @@ -450,7 +450,7 @@ exports[`Empheq Empheq Right 1`] = ` exports[`Empheq Numcases 1`] = ` " - + ( 1 @@ -467,7 +467,7 @@ exports[`Empheq Numcases 1`] = ` - + ( 1 @@ -477,7 +477,7 @@ exports[`Empheq Numcases 1`] = ` a - + ( 2 @@ -501,7 +501,7 @@ exports[`Empheq Numcases 1`] = ` - + ( 1 @@ -517,7 +517,7 @@ exports[`Empheq Numcases 1`] = ` - + ( 2 @@ -541,7 +541,7 @@ exports[`Empheq Numcases 1`] = ` exports[`Empheq Numcases alignedat 1`] = ` " - + ( 1 @@ -623,7 +623,7 @@ exports[`Empheq Numcases empty right 1`] = ` exports[`Empheq Numcases with label 1`] = ` " - + ( 1 @@ -633,13 +633,13 @@ exports[`Empheq Numcases with label 1`] = ` A - = + = { - + ( 1 @@ -664,7 +664,7 @@ exports[`Empheq Numcases with label 1`] = ` - + ( 1 diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index a844809e3..949b5ba8c 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -3915,14 +3915,14 @@ exports[`Mathtools Symbols Other 1`] = ` exports[`Mathtools Tagging Tags add 1`] = ` " - + | 1 | - x + x @@ -3932,7 +3932,7 @@ exports[`Mathtools Tagging Tags add 1`] = ` exports[`Mathtools Tagging newtagform 1`] = ` " - + [ 1 @@ -3955,7 +3955,7 @@ exports[`Mathtools Tagging newtagform 1`] = ` exports[`Mathtools Tagging newtagform styled 1`] = ` " - + [ \\textbf{1} @@ -3978,7 +3978,7 @@ exports[`Mathtools Tagging newtagform styled 1`] = ` exports[`Mathtools Tagging refeq 1`] = ` " - + \\textsf{A} @@ -4006,7 +4006,7 @@ exports[`Mathtools Tagging refeq 1`] = ` exports[`Mathtools Tagging renewtagform 1`] = ` " - + (( 1 @@ -4247,7 +4247,7 @@ exports[`Mathtools options pairedDelimiters 3`] = ` exports[`Mathtools options tagforms 1`] = ` " - + [[ \\mathbf{x} @@ -4256,7 +4256,7 @@ exports[`Mathtools options tagforms 1`] = ` a = - b + b @@ -4266,14 +4266,14 @@ exports[`Mathtools options tagforms 1`] = ` exports[`Mathtools options tagforms reset 1`] = ` " - + ( 1 ) - a + a diff --git a/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap index c73a13af8..cf9c3ea9a 100644 --- a/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap @@ -24,7 +24,7 @@ exports[`Setoptions Require Require with option 1`] = ` exports[`Setoptions Set TeX option 1`] = ` " - + ( 1 @@ -33,7 +33,7 @@ exports[`Setoptions Set TeX option 1`] = ` a = - b + b diff --git a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap index 832cdf8f9..3f2274324 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap @@ -4,7 +4,7 @@ exports[`Page References Forward Reference 1`] = ` [ " - + ( 1 @@ -13,7 +13,7 @@ exports[`Page References Forward Reference 1`] = ` a = - b + b @@ -35,7 +35,7 @@ exports[`Page References Forward Reference 2`] = ` ", " - + ( 1 @@ -44,7 +44,7 @@ exports[`Page References Forward Reference 2`] = ` a = - b + b @@ -55,14 +55,14 @@ exports[`Page References Forward Reference 2`] = ` exports[`Page References LabelIds 1`] = ` " - + ( 1 ) - a + a @@ -72,7 +72,7 @@ exports[`Page References LabelIds 1`] = ` exports[`TagAll Align 1`] = ` " - + ( 1 @@ -89,7 +89,7 @@ exports[`TagAll Align 1`] = ` exports[`TagAll Align Two labels 1`] = ` " - + ( 1 @@ -98,10 +98,10 @@ exports[`TagAll Align Two labels 1`] = ` a = - b + b - + ( 2 @@ -114,7 +114,7 @@ exports[`TagAll Align Two labels 1`] = ` = - d + d @@ -125,14 +125,14 @@ exports[`TagAll Align Two labels 1`] = ` exports[`TagAll Eqref 1`] = ` " - + ( 1 ) - a + a @@ -145,14 +145,14 @@ exports[`TagAll Eqref 1`] = ` exports[`TagAll Label 1`] = ` " - + ( 1 ) - a + a @@ -162,14 +162,14 @@ exports[`TagAll Label 1`] = ` exports[`TagAll Label Default 1`] = ` " - + ( 1 ) - a + a @@ -179,14 +179,14 @@ exports[`TagAll Label Default 1`] = ` exports[`TagAll Label Empty 1`] = ` " - + ( 1 ) - a + a @@ -196,14 +196,14 @@ exports[`TagAll Label Empty 1`] = ` exports[`TagAll Label Named 1`] = ` " - + ( A ) - a + a @@ -213,24 +213,24 @@ exports[`TagAll Label Named 1`] = ` exports[`TagAll Label Named Default 1`] = ` " - + ( A ) - a + a - + ( 1 ) - b + b @@ -240,24 +240,24 @@ exports[`TagAll Label Named Default 1`] = ` exports[`TagAll Label Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -294,9 +294,9 @@ exports[`TagAll MultLine 1`] = ` exports[`TagAll Notag Align 1`] = ` " - + - a + a @@ -318,7 +318,7 @@ exports[`TagAll Notag Multline 1`] = ` - c + c @@ -328,9 +328,9 @@ exports[`TagAll Notag Multline 1`] = ` exports[`TagAll Notag Tag 1`] = ` " - + - a + a @@ -340,14 +340,14 @@ exports[`TagAll Notag Tag 1`] = ` exports[`TagAll Ref 1`] = ` " - + ( 1 ) - a + a @@ -360,14 +360,14 @@ exports[`TagAll Ref 1`] = ` exports[`TagAll Ref Default 1`] = ` " - + ( 1 ) - a + a @@ -380,14 +380,14 @@ exports[`TagAll Ref Default 1`] = ` exports[`TagAll Ref Named 1`] = ` " - + ( A ) - a + a @@ -400,24 +400,24 @@ exports[`TagAll Ref Named 1`] = ` exports[`TagAll Ref Named Default 1`] = ` " - + ( A ) - a + a - + ( 1 ) - b + b @@ -433,24 +433,24 @@ exports[`TagAll Ref Named Default 1`] = ` exports[`TagAll Ref Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -466,14 +466,14 @@ exports[`TagAll Ref Named Named 1`] = ` exports[`TagAll Ref Unknown 1`] = ` " - + ( 1 ) - a + a @@ -486,7 +486,7 @@ exports[`TagAll Ref Unknown 1`] = ` exports[`TagAll Single Expression 1`] = ` " - + ( 1 @@ -503,7 +503,7 @@ exports[`TagAll Single Expression 1`] = ` exports[`TagAll Tag Default 1`] = ` " - + ( 1 @@ -520,14 +520,14 @@ exports[`TagAll Tag Default 1`] = ` exports[`TagAll Tag Named 1`] = ` " - + ( A ) - a + a @@ -537,17 +537,17 @@ exports[`TagAll Tag Named 1`] = ` exports[`TagAll Tag Named Default 1`] = ` " - + ( A ) - a + a - + ( 1 @@ -564,24 +564,24 @@ exports[`TagAll Tag Named Default 1`] = ` exports[`TagAll Tag Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -591,7 +591,7 @@ exports[`TagAll Tag Named Named 1`] = ` exports[`TagAms Align 1`] = ` " - + ( 1 @@ -608,7 +608,7 @@ exports[`TagAms Align 1`] = ` exports[`TagAms Align Two labels 1`] = ` " - + ( 1 @@ -617,10 +617,10 @@ exports[`TagAms Align Two labels 1`] = ` a = - b + b - + ( 2 @@ -633,7 +633,7 @@ exports[`TagAms Align Two labels 1`] = ` = - d + d @@ -644,14 +644,14 @@ exports[`TagAms Align Two labels 1`] = ` exports[`TagAms Eqref 1`] = ` " - + ( 1 ) - a + a @@ -664,14 +664,14 @@ exports[`TagAms Eqref 1`] = ` exports[`TagAms Label 1`] = ` " - + ( 1 ) - a + a @@ -681,14 +681,14 @@ exports[`TagAms Label 1`] = ` exports[`TagAms Label Default 1`] = ` " - + ( 1 ) - a + a @@ -698,14 +698,14 @@ exports[`TagAms Label Default 1`] = ` exports[`TagAms Label Empty 1`] = ` " - + ( 1 ) - a + a @@ -715,14 +715,14 @@ exports[`TagAms Label Empty 1`] = ` exports[`TagAms Label Named 1`] = ` " - + ( A ) - a + a @@ -732,24 +732,24 @@ exports[`TagAms Label Named 1`] = ` exports[`TagAms Label Named Default 1`] = ` " - + ( A ) - a + a - + ( 1 ) - b + b @@ -759,24 +759,24 @@ exports[`TagAms Label Named Default 1`] = ` exports[`TagAms Label Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -813,9 +813,9 @@ exports[`TagAms MultLine 1`] = ` exports[`TagAms Notag Align 1`] = ` " - + - a + a @@ -837,7 +837,7 @@ exports[`TagAms Notag Multline 1`] = ` - c + c @@ -847,9 +847,9 @@ exports[`TagAms Notag Multline 1`] = ` exports[`TagAms Notag Tag 1`] = ` " - + - a + a @@ -859,14 +859,14 @@ exports[`TagAms Notag Tag 1`] = ` exports[`TagAms Ref 1`] = ` " - + ( 1 ) - a + a @@ -879,14 +879,14 @@ exports[`TagAms Ref 1`] = ` exports[`TagAms Ref Default 1`] = ` " - + ( 1 ) - a + a @@ -899,14 +899,14 @@ exports[`TagAms Ref Default 1`] = ` exports[`TagAms Ref Named 1`] = ` " - + ( A ) - a + a @@ -919,24 +919,24 @@ exports[`TagAms Ref Named 1`] = ` exports[`TagAms Ref Named Default 1`] = ` " - + ( A ) - a + a - + ( 1 ) - b + b @@ -952,24 +952,24 @@ exports[`TagAms Ref Named Default 1`] = ` exports[`TagAms Ref Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -985,14 +985,14 @@ exports[`TagAms Ref Named Named 1`] = ` exports[`TagAms Ref Unknown 1`] = ` " - + ( 1 ) - a + a @@ -1023,7 +1023,7 @@ exports[`TagAms Split 1`] = ` exports[`TagAms Tag Default 1`] = ` " - + ( 1 @@ -1040,14 +1040,14 @@ exports[`TagAms Tag Default 1`] = ` exports[`TagAms Tag Named 1`] = ` " - + ( A ) - a + a @@ -1057,17 +1057,17 @@ exports[`TagAms Tag Named 1`] = ` exports[`TagAms Tag Named Default 1`] = ` " - + ( A ) - a + a - + ( 1 @@ -1084,24 +1084,24 @@ exports[`TagAms Tag Named Default 1`] = ` exports[`TagAms Tag Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -1123,9 +1123,9 @@ exports[`TagNone Align 1`] = ` exports[`TagNone Eqref 1`] = ` " - + - a + a @@ -1138,9 +1138,9 @@ exports[`TagNone Eqref 1`] = ` exports[`TagNone Label 1`] = ` " - + - a + a @@ -1150,9 +1150,9 @@ exports[`TagNone Label 1`] = ` exports[`TagNone Label Default 1`] = ` " - + - a + a @@ -1162,9 +1162,9 @@ exports[`TagNone Label Default 1`] = ` exports[`TagNone Label Empty 1`] = ` " - + - a + a @@ -1174,14 +1174,14 @@ exports[`TagNone Label Empty 1`] = ` exports[`TagNone Label Named 1`] = ` " - + ( A ) - a + a @@ -1191,19 +1191,19 @@ exports[`TagNone Label Named 1`] = ` exports[`TagNone Label Named Default 1`] = ` " - + ( A ) - a + a - + - b + b @@ -1213,24 +1213,24 @@ exports[`TagNone Label Named Default 1`] = ` exports[`TagNone Label Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -1262,9 +1262,9 @@ exports[`TagNone MultLine 1`] = ` exports[`TagNone Notag Align 1`] = ` " - + - a + a @@ -1286,7 +1286,7 @@ exports[`TagNone Notag Multline 1`] = ` - c + c @@ -1296,9 +1296,9 @@ exports[`TagNone Notag Multline 1`] = ` exports[`TagNone Notag Tag 1`] = ` " - + - a + a @@ -1308,9 +1308,9 @@ exports[`TagNone Notag Tag 1`] = ` exports[`TagNone Ref 1`] = ` " - + - a + a @@ -1323,9 +1323,9 @@ exports[`TagNone Ref 1`] = ` exports[`TagNone Ref Default 1`] = ` " - + - a + a @@ -1338,14 +1338,14 @@ exports[`TagNone Ref Default 1`] = ` exports[`TagNone Ref Named 1`] = ` " - + ( A ) - a + a @@ -1358,19 +1358,19 @@ exports[`TagNone Ref Named 1`] = ` exports[`TagNone Ref Named Default 1`] = ` " - + ( A ) - a + a - + - b + b @@ -1386,24 +1386,24 @@ exports[`TagNone Ref Named Default 1`] = ` exports[`TagNone Ref Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b @@ -1419,9 +1419,9 @@ exports[`TagNone Ref Named Named 1`] = ` exports[`TagNone Ref Unknown 1`] = ` " - + - a + a @@ -1434,14 +1434,14 @@ exports[`TagNone Ref Unknown 1`] = ` exports[`TagNone Simple Tag 1`] = ` " - + ( 0 ) - a + a @@ -1481,14 +1481,14 @@ exports[`TagNone Tag Default 1`] = ` exports[`TagNone Tag Named 1`] = ` " - + ( A ) - a + a @@ -1498,14 +1498,14 @@ exports[`TagNone Tag Named 1`] = ` exports[`TagNone Tag Named Default 1`] = ` " - + ( A ) - a + a @@ -1520,24 +1520,24 @@ exports[`TagNone Tag Named Default 1`] = ` exports[`TagNone Tag Named Named 1`] = ` " - + ( A ) - a + a - + ( B ) - b + b diff --git a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap index 4d61726e7..ef45268a7 100644 --- a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap @@ -3,14 +3,14 @@ exports[`Tagformat Array tag 1`] = ` " - + | 1 | - x + x @@ -20,13 +20,13 @@ exports[`Tagformat Array tag 1`] = ` exports[`Tagformat Array tag with empty entry 1`] = ` " - + 1 . - x + x @@ -36,13 +36,13 @@ exports[`Tagformat Array tag with empty entry 1`] = ` exports[`Tagformat Array tag with null entry 1`] = ` " - + 1 . - x + x @@ -52,14 +52,14 @@ exports[`Tagformat Array tag with null entry 1`] = ` exports[`Tagformat Basic tag 1`] = ` " - + [ 1 ] - x + x @@ -69,17 +69,17 @@ exports[`Tagformat Basic tag 1`] = ` exports[`Tagformat Custom ref 1`] = ` " - + ( x ) - x + x - + ( 1 @@ -98,17 +98,17 @@ exports[`Tagformat Custom ref 1`] = ` exports[`Tagformat Eqref 1`] = ` " - + [ x ] - x + x - + [ A1 @@ -127,17 +127,17 @@ exports[`Tagformat Eqref 1`] = ` exports[`Tagformat Ref 1`] = ` " - + [ x ] - x + x - + [ A1 @@ -156,14 +156,14 @@ exports[`Tagformat Ref 1`] = ` exports[`Tagformat Text tag 1`] = ` " - + [ x ] - x + x diff --git a/ts/input/tex/NodeUtil.ts b/ts/input/tex/NodeUtil.ts index d04028da2..b4e458ad4 100644 --- a/ts/input/tex/NodeUtil.ts +++ b/ts/input/tex/NodeUtil.ts @@ -32,6 +32,7 @@ import { MmlMo } from '../../core/MmlTree/MmlNodes/mo.js'; import { Property, PropertyList } from '../../core/Tree/Node.js'; import { Args } from './Types.js'; import { OperatorDef } from '../../core/MmlTree/OperatorDictionary.js'; +import { TexConstant } from './TexConstants.js'; const NodeUtil = { attrs: new Set([ @@ -78,6 +79,31 @@ const NodeUtil = { return node.getText(); }, + /** + * Reconstructs the LaTeX source of a node (e.g., an mtd) from the + * `data-latex` attributes of the children of its first child (e.g., to + * rebuild the source of a table cell from its content nodes). + * + * @param {MmlNode} node The node whose content's LaTeX source should be + * reconstructed. + * @returns {string} The reconstructed LaTeX source. + */ + getChildrenLatex(node: MmlNode): string { + const children = node.childNodes[0]?.childNodes || []; + let expr = ''; + for (const child of children) { + const att = ((child as MmlNode)?.attributes?.get( + TexConstant.Attr.LATEX + ) || '') as string; + if (!att) continue; + expr += + expr && expr.match(/[a-zA-Z]$/) && att.match(/^[a-zA-Z]/) + ? ' ' + att + : att; + } + return expr; + }, + /** * Append children to a node. * diff --git a/ts/input/tex/Tags.ts b/ts/input/tex/Tags.ts index 0f62b716a..08a7c68bc 100644 --- a/ts/input/tex/Tags.ts +++ b/ts/input/tex/Tags.ts @@ -26,6 +26,8 @@ import { MmlNode } from '../../core/MmlTree/MmlNode.js'; import { MathItem } from '../../core/MathItem.js'; import { EnvList } from './StackItem.js'; import ParseOptions from './ParseOptions.js'; +import NodeUtil from './NodeUtil.js'; +import { TexConstant } from './TexConstants.js'; /** * Simple class for label objects. @@ -535,6 +537,14 @@ export class AbstractTags implements Tags { const nf = this.configuration.nodeFactory; const cell = nf.create('node', 'mtd', [node]); const row = nf.create('node', 'mlabeledtr', [tag, cell]); + const latex = [ + NodeUtil.getChildrenLatex(tag), + NodeUtil.getChildrenLatex(cell), + ].join('&'); + if (latex) { + row.attributes.set(TexConstant.Attr.LATEXITEM, latex); + row.attributes.set(TexConstant.Attr.LATEX, latex); + } const table = nf.create('node', 'mtable', [row], { side: this.configuration.options['tagSide'], minlabelspacing: this.configuration.options['tagIndent'], diff --git a/ts/input/tex/TexParser.ts b/ts/input/tex/TexParser.ts index 48f27addc..f996115b6 100644 --- a/ts/input/tex/TexParser.ts +++ b/ts/input/tex/TexParser.ts @@ -73,6 +73,12 @@ export default class TexParser { */ private saveI: number = 0; + /** + * Set by skipLatex() to tell the next call to updateResult() that LaTeX + * sources of the current macro does not produce an Mml node. + */ + private _skipLatex: boolean = false; + /** * @class * @param {string} _string The string to parse. @@ -245,6 +251,15 @@ export default class TexParser { } } + /** + * Marks the LaTeX source as skippable, so macros producing no Mml node (e.g., + * \label, \tag, \notag) do not have their source code attached to the + * `data-latex` attribute of the most recently created node. + */ + public skipLatex() { + this._skipLatex = true; + } + /** * @returns {MmlNode} The internal Mathml structure. */ @@ -643,6 +658,10 @@ export default class TexParser { */ // Currently works without translating environments that generate typesetting. private updateResult(input: string, old: number) { + if (this._skipLatex) { + this._skipLatex = false; + return; + } const node = this.stack.Prev(true) as MmlNode; if (!node) { return; diff --git a/ts/input/tex/ams/AmsMethods.ts b/ts/input/tex/ams/AmsMethods.ts index 976a0ed45..f55e9737e 100644 --- a/ts/input/tex/ams/AmsMethods.ts +++ b/ts/input/tex/ams/AmsMethods.ts @@ -779,6 +779,7 @@ export const AmsMethods: { [key: string]: ParseMethod } = { const tagId = UnitUtil.trimSpaces(parser.GetArgument(name)); parser.tags.tag(tagId, star); parser.Push(parser.itemFactory.create('null')); + parser.skipLatex(); }, HandleNoTag: BaseMethods.HandleNoTag, diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index f3f99016d..309bbe8ca 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -1394,18 +1394,7 @@ export class ArrayItem extends BaseItem { * @returns {string} The LaTeX source of the cell content. */ public cellLatex(mtd: MmlNode): string { - const children = mtd.childNodes[0]?.childNodes || []; - let expr = ''; - for (const child of children) { - const att = (child?.attributes?.get(TexConstant.Attr.LATEX) || - '') as string; - if (!att) continue; - expr += - expr && expr.match(/[a-zA-Z]$/) && att.match(/^[a-zA-Z]/) - ? ' ' + att - : att; - } - return expr; + return NodeUtil.getChildrenLatex(mtd); } /** @@ -1536,6 +1525,7 @@ export class EqnArrayItem extends ArrayItem { const tag = this.factory.configuration.tags.getTag(); if (tag) { this.row = [tag].concat(this.row); + this.rowLatex = [this.cellLatex(tag)].concat(this.rowLatex); this.setProperty('isLabeled', true); } this.factory.configuration.tags.clearTag(); diff --git a/ts/input/tex/base/BaseMethods.ts b/ts/input/tex/base/BaseMethods.ts index 4fcf2badb..4ea0b9f16 100644 --- a/ts/input/tex/base/BaseMethods.ts +++ b/ts/input/tex/base/BaseMethods.ts @@ -2162,6 +2162,7 @@ const BaseMethods: { [key: string]: ParseMethod } = { */ HandleNoTag(parser: TexParser, _name: string) { parser.tags.notag(); + parser.skipLatex(); }, /** @@ -2175,6 +2176,7 @@ const BaseMethods: { [key: string]: ParseMethod } = { const label = parser.GetArgument(name); if (label === '') { // @test Label Empty + parser.skipLatex(); return; } // @test Label, Ref, Ref Unknown @@ -2198,6 +2200,7 @@ const BaseMethods: { [key: string]: ParseMethod } = { // TODO: This should be set in the tags structure! parser.tags.labels[label] = new Label(); // will be replaced by tag value later } + parser.skipLatex(); }, /** From 388383620d375922d07f3aa88a13ec3c3deb7975 Mon Sep 17 00:00:00 2001 From: zorkow Date: Tue, 14 Jul 2026 19:15:04 +0200 Subject: [PATCH 04/11] extend correct row handling to multline environments --- .../input/tex/__snapshots__/Ams.test.ts.snap | 80 +++++++++---------- .../tex/__snapshots__/Mathtools.test.ts.snap | 56 ++++++------- .../tex/__snapshots__/SetOptions.test.ts.snap | 12 +-- .../input/tex/__snapshots__/Tag.test.ts.snap | 36 ++++----- ts/input/tex/ams/AmsItems.ts | 13 +++ 5 files changed, 105 insertions(+), 92 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap index 1259e3178..2d3785a41 100644 --- a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap @@ -1191,17 +1191,17 @@ exports[`Ams Environments Gathered 1`] = ` exports[`Ams Environments Multline 1`] = ` " - + a - + b - + c @@ -1213,17 +1213,17 @@ exports[`Ams Environments Multline 1`] = ` exports[`Ams Environments Multline Star 1`] = ` " - + a - + b - + c @@ -2530,7 +2530,7 @@ exports[`Ams Tagged Environments Left Gather Align 1`] = ` exports[`Ams Tagged Environments Left multline tagged left 1`] = ` " - + ( 1 @@ -2578,17 +2578,17 @@ exports[`Ams Tagged Environments Left xalign tagged left 1`] = ` exports[`Ams Tagged Environments Multline 1`] = ` " - + a - + b - + ( 1 @@ -2605,17 +2605,17 @@ exports[`Ams Tagged Environments Multline 1`] = ` exports[`Ams Tagged Environments Multline Star 1`] = ` " - + a - + b - + c @@ -3330,17 +3330,17 @@ exports[`Multirel Preset Rspace Lspace 1`] = ` exports[`MultlineShove Shove Left Bottom 1`] = ` " - + a - + b - + c @@ -3352,17 +3352,17 @@ exports[`MultlineShove Shove Left Bottom 1`] = ` exports[`MultlineShove Shove Left Middle 1`] = ` " - + a - + b - + c @@ -3374,17 +3374,17 @@ exports[`MultlineShove Shove Left Middle 1`] = ` exports[`MultlineShove Shove Left Right 1`] = ` " - + a - + b - + c @@ -3396,17 +3396,17 @@ exports[`MultlineShove Shove Left Right 1`] = ` exports[`MultlineShove Shove Left Top 1`] = ` " - + a - + b - + c @@ -3418,17 +3418,17 @@ exports[`MultlineShove Shove Left Top 1`] = ` exports[`MultlineShove Shove None 1`] = ` " - + a - + b - + c @@ -3440,17 +3440,17 @@ exports[`MultlineShove Shove None 1`] = ` exports[`MultlineShove Shove Right Bottom 1`] = ` " - + a - + b - + c @@ -3462,17 +3462,17 @@ exports[`MultlineShove Shove Right Bottom 1`] = ` exports[`MultlineShove Shove Right Left 1`] = ` " - + a - + b - + c @@ -3484,17 +3484,17 @@ exports[`MultlineShove Shove Right Left 1`] = ` exports[`MultlineShove Shove Right Middle 1`] = ` " - + a - + b - + c @@ -3506,17 +3506,17 @@ exports[`MultlineShove Shove Right Middle 1`] = ` exports[`MultlineShove Shove Right Top 1`] = ` " - + a - + b - + c diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index 949b5ba8c..b76a42e37 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -1650,7 +1650,7 @@ exports[`Mathtools More Environments lgathered 1`] = ` exports[`Mathtools More Environments multlined [b] width 1`] = ` " - + @@ -1662,7 +1662,7 @@ exports[`Mathtools More Environments multlined [b] width 1`] = ` - + @@ -1683,7 +1683,7 @@ exports[`Mathtools More Environments multlined [b] width 1`] = ` exports[`Mathtools More Environments multlined [c] width 1`] = ` " - + @@ -1695,7 +1695,7 @@ exports[`Mathtools More Environments multlined [c] width 1`] = ` - + @@ -1716,7 +1716,7 @@ exports[`Mathtools More Environments multlined [c] width 1`] = ` exports[`Mathtools More Environments multlined [t] width 1`] = ` " - + @@ -1728,7 +1728,7 @@ exports[`Mathtools More Environments multlined [t] width 1`] = ` - + @@ -1751,7 +1751,7 @@ exports[`Mathtools More Environments multlined 1`] = ` A = - + @@ -1763,7 +1763,7 @@ exports[`Mathtools More Environments multlined 1`] = ` - + @@ -1783,7 +1783,7 @@ exports[`Mathtools More Environments multlined 1`] = ` exports[`Mathtools More Environments multlined empty row 1`] = ` " - + a @@ -1795,7 +1795,7 @@ exports[`Mathtools More Environments multlined empty row 1`] = ` exports[`Mathtools More Environments multlined shoved 1`] = ` " - + @@ -1807,7 +1807,7 @@ exports[`Mathtools More Environments multlined shoved 1`] = ` - + @@ -1818,7 +1818,7 @@ exports[`Mathtools More Environments multlined shoved 1`] = ` - + @@ -1829,7 +1829,7 @@ exports[`Mathtools More Environments multlined shoved 1`] = ` - + @@ -1848,7 +1848,7 @@ exports[`Mathtools More Environments multlined shoved 1`] = ` exports[`Mathtools More Environments multlined shoved distance 1`] = ` " - + @@ -1860,7 +1860,7 @@ exports[`Mathtools More Environments multlined shoved distance 1`] = ` - + @@ -1874,7 +1874,7 @@ exports[`Mathtools More Environments multlined shoved distance 1`] = ` - + @@ -1888,7 +1888,7 @@ exports[`Mathtools More Environments multlined shoved distance 1`] = ` - + @@ -1907,7 +1907,7 @@ exports[`Mathtools More Environments multlined shoved distance 1`] = ` exports[`Mathtools More Environments multlined width 1`] = ` " - + @@ -1919,7 +1919,7 @@ exports[`Mathtools More Environments multlined width 1`] = ` - + @@ -4107,7 +4107,7 @@ exports[`Mathtools options legacycolonsymbols option 2`] = ` exports[`Mathtools options mathtoolsset 1`] = ` " - + a @@ -4307,13 +4307,13 @@ exports[`Mathtools setoptions multlined gap and pos 1`] = ` a + - + a - + b @@ -4328,13 +4328,13 @@ exports[`Mathtools setoptions multlined gap and pos 1`] = ` exports[`Mathtools setoptions multlined skips 1`] = ` " - + a - + b @@ -4347,13 +4347,13 @@ exports[`Mathtools setoptions multlined skips 1`] = ` exports[`Mathtools setoptions multlined width 1`] = ` " - + a - + b @@ -4368,13 +4368,13 @@ exports[`Mathtools setoptions multlined-pos override 1`] = ` a + - + a - + b diff --git a/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap index cf9c3ea9a..bb3c9a361 100644 --- a/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap @@ -59,7 +59,7 @@ exports[`Setoptions Set package boolean option 1`] = ` exports[`Setoptions Set package string option 1`] = ` " - + a @@ -77,7 +77,7 @@ exports[`Setoptions Set regexp option with flags 1`] = ` exports[`Setoptions options allowOptionsDefault false ams multlineWidth true 1`] = ` " - + a @@ -89,7 +89,7 @@ exports[`Setoptions options allowOptionsDefault false ams multlineWidth true 1`] exports[`Setoptions options allowPackageDefault false ams true 1`] = ` " - + a @@ -101,7 +101,7 @@ exports[`Setoptions options allowPackageDefault false ams true 1`] = ` exports[`Setoptions options filterOption 1`] = ` " - + a @@ -113,7 +113,7 @@ exports[`Setoptions options filterOption 1`] = ` exports[`Setoptions options filterPackage 1`] = ` " - + a @@ -125,7 +125,7 @@ exports[`Setoptions options filterPackage 1`] = ` exports[`Setoptions options filterValue 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap index 3f2274324..75e1a507c 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap @@ -267,17 +267,17 @@ exports[`TagAll Label Named Named 1`] = ` exports[`TagAll MultLine 1`] = ` " - + a - + b - + ( 1 @@ -306,17 +306,17 @@ exports[`TagAll Notag Align 1`] = ` exports[`TagAll Notag Multline 1`] = ` " - + a - + b - + c @@ -786,17 +786,17 @@ exports[`TagAms Label Named Named 1`] = ` exports[`TagAms MultLine 1`] = ` " - + a - + b - + ( 1 @@ -825,17 +825,17 @@ exports[`TagAms Notag Align 1`] = ` exports[`TagAms Notag Multline 1`] = ` " - + a - + b - + c @@ -1240,17 +1240,17 @@ exports[`TagNone Label Named Named 1`] = ` exports[`TagNone MultLine 1`] = ` " - + a - + b - + c @@ -1274,17 +1274,17 @@ exports[`TagNone Notag Align 1`] = ` exports[`TagNone Notag Multline 1`] = ` " - + a - + b - + c diff --git a/ts/input/tex/ams/AmsItems.ts b/ts/input/tex/ams/AmsItems.ts index 6368b47d2..6db8a6585 100644 --- a/ts/input/tex/ams/AmsItems.ts +++ b/ts/input/tex/ams/AmsItems.ts @@ -68,6 +68,7 @@ export class MultlineItem extends ArrayItem { ); this.setProperty('shove', null); this.row.push(mtd); + this.rowLatex.push(this.cellLatex(mtd)); this.Clear(); } @@ -84,8 +85,10 @@ export class MultlineItem extends ArrayItem { ); } const row = this.create('node', 'mtr', this.row); + this.setRowLatex(row); this.table.push(row); this.row = []; + this.rowLatex = []; } /** @@ -133,6 +136,16 @@ export class MultlineItem extends ArrayItem { [tag].concat(NodeUtil.getChildren(mtr)) ); NodeUtil.copyAttributes(mtr, mlabel); + const latex = [ + this.cellLatex(tag), + mtr.attributes.get(TexConstant.Attr.LATEX), + ] + .filter((x) => x) + .join('&'); + if (latex) { + mlabel.attributes.set(TexConstant.Attr.LATEXITEM, latex); + mlabel.attributes.set(TexConstant.Attr.LATEX, latex); + } this.table[label] = mlabel; } } From cb86ab3ff0fed33e194621b397549c0f3f32492c Mon Sep 17 00:00:00 2001 From: zorkow Date: Tue, 21 Jul 2026 10:40:39 +0200 Subject: [PATCH 05/11] fixes missing color elements in rows --- .../tex/__snapshots__/Colortbl.test.ts.snap | 44 +++++++++---------- .../tex/colortbl/ColortblConfiguration.ts | 41 +++++++++++++++-- 2 files changed, 59 insertions(+), 26 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap index e006254e7..b100c0509 100644 --- a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap @@ -3,7 +3,7 @@ exports[`Colortbl cellcolor 1`] = ` " - + a @@ -11,7 +11,7 @@ exports[`Colortbl cellcolor 1`] = ` b - + c @@ -28,7 +28,7 @@ exports[`Colortbl cellcolor in pmatrix 1`] = ` ( - + a @@ -42,7 +42,7 @@ exports[`Colortbl cellcolor in pmatrix 1`] = ` exports[`Colortbl cellcolor in preamble 1`] = ` " - + a @@ -50,7 +50,7 @@ exports[`Colortbl cellcolor in preamble 1`] = ` b - + c @@ -65,12 +65,12 @@ exports[`Colortbl cellcolor in preamble 1`] = ` exports[`Colortbl cellcolor late 1`] = ` " - + a - b + b @@ -80,7 +80,7 @@ exports[`Colortbl cellcolor late 1`] = ` exports[`Colortbl cellcolor with color model 1`] = ` " - + a @@ -92,7 +92,7 @@ exports[`Colortbl cellcolor with color model 1`] = ` exports[`Colortbl cellcolor with columncolor 1`] = ` " - + a @@ -100,7 +100,7 @@ exports[`Colortbl cellcolor with columncolor 1`] = ` b - + c @@ -115,7 +115,7 @@ exports[`Colortbl cellcolor with columncolor 1`] = ` exports[`Colortbl cellcolor with columncolor and rowcolor 1`] = ` " - + a @@ -123,7 +123,7 @@ exports[`Colortbl cellcolor with columncolor and rowcolor 1`] = ` b - + c @@ -139,7 +139,7 @@ exports[`Colortbl cellcolor with frame 1`] = ` " - + a @@ -160,7 +160,7 @@ exports[`Colortbl cellcolor with rowcolor 1`] = ` b - + c @@ -175,7 +175,7 @@ exports[`Colortbl cellcolor with rowcolor 1`] = ` exports[`Colortbl color with no frame 1`] = ` " - + a @@ -187,7 +187,7 @@ exports[`Colortbl color with no frame 1`] = ` exports[`Colortbl columncolor 1`] = ` " - + a @@ -210,7 +210,7 @@ exports[`Colortbl columncolor 1`] = ` exports[`Colortbl columncolor and rowcolor 1`] = ` " - + a @@ -218,7 +218,7 @@ exports[`Colortbl columncolor and rowcolor 1`] = ` b - + c @@ -233,7 +233,7 @@ exports[`Colortbl columncolor and rowcolor 1`] = ` exports[`Colortbl columncolor ignore overlap 1`] = ` " - + a @@ -256,7 +256,7 @@ exports[`Colortbl columncolor ignore overlap 1`] = ` exports[`Colortbl columncolor in preamble 1`] = ` " - + a @@ -264,7 +264,7 @@ exports[`Colortbl columncolor in preamble 1`] = ` b - + c @@ -287,7 +287,7 @@ exports[`Colortbl rowcolor 1`] = ` b - + c diff --git a/ts/input/tex/colortbl/ColortblConfiguration.ts b/ts/input/tex/colortbl/ColortblConfiguration.ts index 67496ffcf..fdfac34f3 100644 --- a/ts/input/tex/colortbl/ColortblConfiguration.ts +++ b/ts/input/tex/colortbl/ColortblConfiguration.ts @@ -56,6 +56,18 @@ export class ColorArrayItem extends ArrayItem { col: [], }; + /** + * The LaTeX source of a pending \cellcolor, \rowcolor, or \columncolor + * macro, used to include the macro itself in the `data-latex` attribute + * of the mtr/mlabeledtr row it belongs to (it produces no Mml node of its + * own, so it does not appear in the data-latex of any content node). + */ + public colorLatex: ColorData = { + cell: '', + row: '', + col: [], + }; + /** * True if any cell is colored (we will make sure the edge cells are full sized). */ @@ -66,14 +78,23 @@ export class ColorArrayItem extends ArrayItem { */ public EndEntry() { super.EndEntry(); - const cell = this.row[this.row.length - 1]; - const color = - this.color.cell || this.color.row || this.color.col[this.row.length - 1]; + const n = this.row.length - 1; + const cell = this.row[n]; + const color = this.color.cell || this.color.row || this.color.col[n]; if (color) { cell.attributes.set('mathbackground', color); this.color.cell = ''; this.hasColor = true; } + const colorLatex = + this.colorLatex.cell || this.colorLatex.row || this.colorLatex.col[n]; + if (colorLatex) { + const i = this.rowLatex.length - 1; + this.rowLatex[i] = colorLatex + this.rowLatex[i]; + this.colorLatex.cell = ''; + this.colorLatex.row = ''; + delete this.colorLatex.col[n]; + } } /** @@ -82,6 +103,7 @@ export class ColorArrayItem extends ArrayItem { public EndRow() { super.EndRow(); this.color.row = ''; + this.colorLatex.row = ''; } /** @@ -124,7 +146,9 @@ export class ColorArrayItem extends ArrayItem { function TableColor(parser: TexParser, name: string, type: keyof ColorData) { const lookup = parser.configuration.packageData.get('color').model; // use the color extension's color model const model = parser.GetBrackets(name, ''); - const color = lookup.getColor(model, parser.GetArgument(name)); + const arg = parser.GetArgument(name); + const color = lookup.getColor(model, arg); + const latex = `${name}${model ? `[${model}]` : ''}{${arg}}`; // // Check that we are in a colorable array. // @@ -148,6 +172,7 @@ function TableColor(parser: TexParser, name: string, type: keyof ColorData) { ); } top.color.col[top.row.length] = color; + top.colorLatex.col[top.row.length] = latex; // // Ignore the left and right overlap options. // @@ -156,6 +181,7 @@ function TableColor(parser: TexParser, name: string, type: keyof ColorData) { } } else { top.color[type] = color; + top.colorLatex[type] = latex; if (type === 'row' && (top.Size() || top.row.length)) { throw new TexError( 'RowColorNotFirst', @@ -164,6 +190,13 @@ function TableColor(parser: TexParser, name: string, type: keyof ColorData) { ); } } + // + // This macro produces no Mml node of its own, so don't let its source + // text be attached as the data-latex of whatever node precedes it. Its + // own source is instead folded into the data-latex of the mtr/mlabeledtr + // row it belongs to (see ColorArrayItem.EndEntry). + // + parser.skipLatex(); } // From 85591c79f8cd884be0ec21c540cc6f6048f1924e Mon Sep 17 00:00:00 2001 From: zorkow Date: Tue, 21 Jul 2026 13:20:40 +0200 Subject: [PATCH 06/11] fixes issue with column template that garbles data-latex attribute --- .../input/tex/__snapshots__/Base.test.ts.snap | 40 ++++---- .../tex/__snapshots__/Colortbl.test.ts.snap | 4 +- ts/input/tex/StackItem.ts | 5 + ts/input/tex/TexParser.ts | 10 +- ts/input/tex/base/BaseItems.ts | 94 +++++++++++++++++++ ts/input/tex/base/BaseMethods.ts | 3 +- 6 files changed, 130 insertions(+), 26 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index 021808512..5ab212e76 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -441,7 +441,7 @@ exports[`Array Columnlines Solid None 1`] = ` exports[`Array Empty Array with Template 1`] = ` " - + " `; @@ -1803,7 +1803,7 @@ exports[`Character Class Changes mathpunct 1`] = ` exports[`Complete Array column ! | @ 1`] = ` " - + a @@ -1822,7 +1822,7 @@ exports[`Complete Array column ! | @ 1`] = ` exports[`Complete Array column > > c < < 1`] = ` " - + b @@ -1838,7 +1838,7 @@ exports[`Complete Array column > > c < < 1`] = ` exports[`Complete Array column > space 1`] = ` " - + x @@ -1851,7 +1851,7 @@ exports[`Complete Array column > space 1`] = ` exports[`Complete Array column @ | ! c 1`] = ` " - + @@ -1868,7 +1868,7 @@ exports[`Complete Array column @ | ! c 1`] = ` exports[`Complete Array column @ p m 1`] = ` " - + x @@ -1987,7 +1987,7 @@ exports[`Complete Array column b 1`] = ` exports[`Complete Array column c < 1`] = ` " - + a @@ -2006,7 +2006,7 @@ exports[`Complete Array column c < 1`] = ` exports[`Complete Array column c > 1`] = ` " - + A @@ -2025,7 +2025,7 @@ exports[`Complete Array column c > 1`] = ` exports[`Complete Array column c @ end 1`] = ` " - + a @@ -2048,7 +2048,7 @@ exports[`Complete Array column c @ end 1`] = ` exports[`Complete Array column c @& 1`] = ` " - + a @@ -2079,7 +2079,7 @@ exports[`Complete Array column c @& 1`] = ` exports[`Complete Array column c @& hfil 1`] = ` " - + a @@ -2143,7 +2143,7 @@ exports[`Complete Array column c W 1`] = ` exports[`Complete Array column c c @ 1`] = ` " - + X @@ -2311,7 +2311,7 @@ exports[`Complete Array column p 1`] = ` exports[`Complete Array column r c l ! 1`] = ` " - + a @@ -2381,7 +2381,7 @@ exports[`Complete Array column r c l : 1`] = ` exports[`Complete Array column r c l < 1`] = ` " - + a @@ -2412,7 +2412,7 @@ exports[`Complete Array column r c l < 1`] = ` exports[`Complete Array column r c l > 1`] = ` " - + A @@ -2443,7 +2443,7 @@ exports[`Complete Array column r c l > 1`] = ` exports[`Complete Array column r c l @ 1`] = ` " - + a @@ -2542,7 +2542,7 @@ exports[`Complete Array column r c l 1`] = ` exports[`Complete Array column r c repeat | 1`] = ` " - + a @@ -2581,7 +2581,7 @@ exports[`Complete Array column r c repeat | 1`] = ` exports[`Complete Array column r c repeat | {} 1`] = ` " - + a @@ -2623,7 +2623,7 @@ exports[`Complete Array column r c repeat | {} 1`] = ` exports[`Complete Array column r c repeat | {} 2`] = ` " - + a @@ -2671,7 +2671,7 @@ exports[`Complete Array column r c repeat | {} 2`] = ` exports[`Complete Array column r c repeat | {} 3`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap index b100c0509..958267778 100644 --- a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap @@ -41,7 +41,7 @@ exports[`Colortbl cellcolor in pmatrix 1`] = ` exports[`Colortbl cellcolor in preamble 1`] = ` " - + a @@ -255,7 +255,7 @@ exports[`Colortbl columncolor ignore overlap 1`] = ` exports[`Colortbl columncolor in preamble 1`] = ` " - + a diff --git a/ts/input/tex/StackItem.ts b/ts/input/tex/StackItem.ts index 95b84ccba..57a7938f2 100644 --- a/ts/input/tex/StackItem.ts +++ b/ts/input/tex/StackItem.ts @@ -580,6 +580,11 @@ export abstract class BaseItem extends MmlStack implements StackItem { * @param {string=} prefix A prefix for the LaTeX command. */ public addLatexItem(node: MmlNode, prefix: string = '') { + // If the node already has a LaTeX source (e.g., an mtable reconstructed + // data-latex ), don't overwrite it with a new one. + if (node.getProperty('fixedLatex') !== undefined) { + return; + } const str = this.startStr.slice(this.startI, this.stopI); if (str) { const tex = prefix ? prefix + str : str; diff --git a/ts/input/tex/TexParser.ts b/ts/input/tex/TexParser.ts index f996115b6..6a2cabe7d 100644 --- a/ts/input/tex/TexParser.ts +++ b/ts/input/tex/TexParser.ts @@ -269,9 +269,13 @@ export default class TexParser { return null; } const node = this.stack.Top().First; - const latex = this.trimTex(this.string); - if (latex) { - node.attributes.set(TexConstant.Attr.LATEX, latex); + // Only overwrite the LaTeX source if it hasn't been set already (e.g., an + // mtable produced by an array-like environment) + if (node.getProperty('fixedLatex') === undefined) { + const latex = this.trimTex(this.string); + if (latex) { + node.attributes.set(TexConstant.Attr.LATEX, latex); + } } return node; } diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index 309bbe8ca..16ea15cb2 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -1134,6 +1134,7 @@ export class ArrayItem extends BaseItem { this.getProperty('close') as string ); } + this.setTableLatex(mml); return mml; } @@ -1397,6 +1398,99 @@ export class ArrayItem extends BaseItem { return NodeUtil.getChildrenLatex(mtd); } + /** + * Captures the LaTeX source of this array/table environment (e.g., `>{...}`, + * `<{...}`, `@{...}`, or `!{...}`) before any entry-template substitutions + * are made. + * + * @param {TexParser} parser The current parser, positioned right after + * `\begin{name}`, before the column-alignment argument (if any) has + * been read. + * @param {string} name The environment name (e.g., `array`, `matrix`). + */ + public captureLatex(parser: TexParser, name: string) { + const source = parser.string.slice(parser.i); + const end = ArrayItem.findEnvEnd(source, name); + // If no matching \end{name} could be found (e.g., an environment produced + // by macro expansion \newenvironment. + if (end < 0) return; + this.setProperty('rawLatex', `\\begin{${name}}${source.slice(0, end)}`); + } + + /** + * Sets `data-latex` attribute of the mtable node from captured source. This + * is only needed when column templates are in play. + * + * @param {MmlNode} mml The mtable node. + */ + public setTableLatex(mml: MmlNode) { + const hasTemplate = (list: (string | boolean)[]) => + list && list.some((x) => x); + if ( + !hasTemplate(this.cstart) && + !hasTemplate(this.cend) && + !hasTemplate(this.cextra) + ) { + return; + } + const tex = this.getProperty('rawLatex') as string; + if (!tex) return; + mml.attributes.set(TexConstant.Attr.LATEXITEM, tex); + mml.attributes.set(TexConstant.Attr.LATEX, tex); + mml.setProperty('fixedLatex', true); + } + + /** + * Find the position of the corresponding `\end{name}` in the string starting + * right after the corresponding `\begin{name}` (skipping nested environments + * of that name). + * + * @param {string} str The string to search. + * @param {string} name The environment name to look for. + * @returns {number} The index right after the matching `\end{name}`, or + * -1 if no matching end was found. + */ + private static findEnvEnd(str: string, name: string): number { + const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const begin = new RegExp(`^\\\\begin\\s*\\{${escaped}\\}`); + const end = new RegExp(`^\\\\end\\s*\\{${escaped}\\}`); + let depth = 0; + let nested = 0; + let i = 0; + while (i < str.length) { + const c = str.charAt(i); + if (c === '\\') { + const rest = str.slice(i); + const mBegin = rest.match(begin); + if (mBegin) { + if (depth === 0) nested++; + i += mBegin[0].length; + continue; + } + const mEnd = rest.match(end); + if (mEnd) { + if (depth === 0) { + if (!nested) { + return i + mEnd[0].length; + } + nested--; + } + i += mEnd[0].length; + continue; + } + i += 2; + continue; + } + if (c === '{') { + depth++; + } else if (c === '}' && depth > 0) { + depth--; + } + i++; + } + return -1; + } + /** * Sets the `data-latex` attribute of a row node by joining the LaTeX source * of its content cells with `&`. diff --git a/ts/input/tex/base/BaseMethods.ts b/ts/input/tex/base/BaseMethods.ts index 4ea0b9f16..467b5bc06 100644 --- a/ts/input/tex/base/BaseMethods.ts +++ b/ts/input/tex/base/BaseMethods.ts @@ -1934,11 +1934,12 @@ const BaseMethods: { [key: string]: ParseMethod } = { style: string, raggedHeight: boolean ): ParseResult { + const array = parser.itemFactory.create('array') as sitem.ArrayItem; + array.captureLatex(parser, begin.getName()); if (!align) { // @test Array Single align = parser.GetArgument('\\begin{' + begin.getName() + '}'); } - const array = parser.itemFactory.create('array') as sitem.ArrayItem; if (begin.getName() === 'array') { array.setProperty('arrayPadding', '.5em .125em'); } From ee4d3609f17c9195f95619390f7e187b75c3143e Mon Sep 17 00:00:00 2001 From: zorkow Date: Tue, 21 Jul 2026 20:26:09 +0200 Subject: [PATCH 07/11] fixes also the nested array issue --- testsuite/tests/input/tex/Ams.test.ts | 8 + .../input/tex/__snapshots__/Ams.test.ts.snap | 45 +++- .../input/tex/__snapshots__/Base.test.ts.snap | 46 ++-- .../tex/__snapshots__/Colortbl.test.ts.snap | 2 +- .../tex/__snapshots__/Mathtools.test.ts.snap | 112 ++++----- .../tex/__snapshots__/Physics.test.ts.snap | 226 +++++++++--------- ts/input/tex.ts | 1 + ts/input/tex/FilterUtil.ts | 56 +++++ ts/input/tex/StackItem.ts | 5 - ts/input/tex/TexParser.ts | 10 +- ts/input/tex/base/BaseItems.ts | 22 +- 11 files changed, 302 insertions(+), 231 deletions(-) diff --git a/testsuite/tests/input/tex/Ams.test.ts b/testsuite/tests/input/tex/Ams.test.ts index dce2117cb..66c089ce9 100644 --- a/testsuite/tests/input/tex/Ams.test.ts +++ b/testsuite/tests/input/tex/Ams.test.ts @@ -1038,4 +1038,12 @@ describe('Ams symbols', () => { /**********************************************************************************/ +describe('Ams Issues', () => { + it('Array with Tag', () => { + expect(tex2mml('\\begin{array}{c}a \\end{array}\\tag{1}')).toMatchSnapshot(); + }); +}); + +/**********************************************************************************/ + afterAll(() => getTokens('ams')); diff --git a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap index 2d3785a41..bee5dcb82 100644 --- a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap @@ -184,7 +184,7 @@ exports[`Ams Complex A Cross Product Formula 1`] = ` = | - + @@ -995,7 +995,7 @@ exports[`Ams Environments Bmatrix 1`] = ` " { - + a @@ -1235,7 +1235,7 @@ exports[`Ams Environments Multline Star 1`] = ` exports[`Ams Environments Small Matrix 1`] = ` " - + a @@ -1304,7 +1304,7 @@ exports[`Ams Environments Split 1`] = ` exports[`Ams Environments Subarray 1`] = ` " - + a @@ -1319,7 +1319,7 @@ exports[`Ams Environments Vmatrix 1`] = ` " - + a @@ -1346,7 +1346,7 @@ exports[`Ams Environments bmatrix 1`] = ` " [ - + a @@ -1378,7 +1378,7 @@ exports[`Ams Environments cases 1`] = ` = { - + 1 @@ -1489,7 +1489,7 @@ exports[`Ams Environments pmatrix 1`] = ` " ( - + a @@ -1651,6 +1651,29 @@ exports[`Ams Genfrac no delimiters 1`] = ` " `; +exports[`Ams Issues Array with Tag 1`] = ` +" + + + + ( + 1 + ) + + + + + + a + + + + + + +" +`; + exports[`Ams Left Fraction 1`] = ` " @@ -2627,7 +2650,7 @@ exports[`Ams Tagged Environments Multline Star 1`] = ` exports[`Ams Tagged Environments Small Matrix 1`] = ` " - + a @@ -2696,7 +2719,7 @@ exports[`Ams Tagged Environments Split 1`] = ` exports[`Ams Tagged Environments Subarray 1`] = ` " - + a @@ -3230,7 +3253,7 @@ exports[`Ams symbols math0mo 19 1`] = ` exports[`Ams symbols substack 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index 5ab212e76..ac2c37d4a 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -448,7 +448,7 @@ exports[`Array Empty Array with Template 1`] = ` exports[`Array Enclosed bottom 1`] = ` " - + a @@ -462,7 +462,7 @@ exports[`Array Enclosed bottom 1`] = ` exports[`Array Enclosed dashed column 1`] = ` " - + a @@ -487,7 +487,7 @@ exports[`Array Enclosed dashed column 1`] = ` exports[`Array Enclosed dashed row 1`] = ` " - + a @@ -530,7 +530,7 @@ exports[`Array Enclosed frame solid 1`] = ` exports[`Array Enclosed left 1`] = ` " - + a @@ -544,7 +544,7 @@ exports[`Array Enclosed left 1`] = ` exports[`Array Enclosed left right 1`] = ` " - + a @@ -558,7 +558,7 @@ exports[`Array Enclosed left right 1`] = ` exports[`Array Enclosed right 1`] = ` " - + a @@ -572,7 +572,7 @@ exports[`Array Enclosed right 1`] = ` exports[`Array Enclosed solid column 1`] = ` " - + a @@ -609,7 +609,7 @@ exports[`Array Enclosed solid dashed 1`] = ` exports[`Array Enclosed solid row 1`] = ` " - + a @@ -628,7 +628,7 @@ exports[`Array Enclosed solid row 1`] = ` exports[`Array Enclosed top 1`] = ` " - + a @@ -642,7 +642,7 @@ exports[`Array Enclosed top 1`] = ` exports[`Array Enclosed top bottom 1`] = ` " - + a @@ -677,7 +677,7 @@ exports[`Array Matrix Test 1`] = ` " ( - + a @@ -742,7 +742,7 @@ exports[`Array Newcolumntype 1`] = ` exports[`Array Newcolumntype Option 1`] = ` " - + @@ -1946,7 +1946,7 @@ exports[`Complete Array column {r}c{l} 1`] = ` exports[`Complete Array column b 1`] = ` " - + @@ -2110,7 +2110,7 @@ exports[`Complete Array column c @& hfil 1`] = ` exports[`Complete Array column c W 1`] = ` " - + a @@ -2179,7 +2179,7 @@ exports[`Complete Array column c c | c 1`] = ` exports[`Complete Array column c w 1`] = ` " - + a @@ -2212,7 +2212,7 @@ exports[`Complete Array column c w 1`] = ` exports[`Complete Array column m 1`] = ` " - + @@ -2270,7 +2270,7 @@ c} X & Y\\end{array}"> exports[`Complete Array column p 1`] = ` " - + @@ -2628,7 +2628,7 @@ exports[`Complete Array column r c repeat | {} 2`] = ` a - + Q @@ -2675,7 +2675,7 @@ exports[`Complete Array column r c repeat | {} 3`] = ` a - + Q @@ -3555,7 +3555,7 @@ exports[`Environments Nested array 1`] = ` c - + f @@ -9092,7 +9092,7 @@ exports[`User Defined Environments Cases star 1`] = ` exports[`User Defined Environments Crampedsubarray 1`] = ` " - + a @@ -9155,7 +9155,7 @@ exports[`User Defined Environments pmatrix 1`] = ` " ( - + a @@ -9181,7 +9181,7 @@ exports[`User Defined Environments pmatrix 1`] = ` exports[`User Defined Environments smallmatrix 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap index 958267778..e00f9bbb4 100644 --- a/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Colortbl.test.ts.snap @@ -138,7 +138,7 @@ exports[`Colortbl cellcolor with columncolor and rowcolor 1`] = ` exports[`Colortbl cellcolor with frame 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index b76a42e37..374db4e51 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -528,7 +528,7 @@ exports[`Mathtools Matrix Environments Bmatrix* 1`] = ` " { - + @@ -557,7 +557,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[c] 1`] = ` " { - + @@ -586,7 +586,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[l] 1`] = ` " { - + @@ -615,7 +615,7 @@ exports[`Mathtools Matrix Environments Bmatrix*[r] 1`] = ` " { - + @@ -644,7 +644,7 @@ exports[`Mathtools Matrix Environments Vmatrix* 1`] = ` " - + @@ -673,7 +673,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[c] 1`] = ` " - + @@ -702,7 +702,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[l] 1`] = ` " - + @@ -731,7 +731,7 @@ exports[`Mathtools Matrix Environments Vmatrix*[r] 1`] = ` " - + @@ -760,7 +760,7 @@ exports[`Mathtools Matrix Environments bmatrix* 1`] = ` " [ - + @@ -789,7 +789,7 @@ exports[`Mathtools Matrix Environments bmatrix*[c] 1`] = ` " [ - + @@ -818,7 +818,7 @@ exports[`Mathtools Matrix Environments bmatrix*[l] 1`] = ` " [ - + @@ -847,7 +847,7 @@ exports[`Mathtools Matrix Environments bmatrix*[r] 1`] = ` " [ - + @@ -976,7 +976,7 @@ exports[`Mathtools Matrix Environments pmatrix* 1`] = ` " ( - + @@ -1005,7 +1005,7 @@ exports[`Mathtools Matrix Environments pmatrix*[c] 1`] = ` " ( - + @@ -1034,7 +1034,7 @@ exports[`Mathtools Matrix Environments pmatrix*[l] 1`] = ` " ( - + @@ -1063,7 +1063,7 @@ exports[`Mathtools Matrix Environments pmatrix*[r] 1`] = ` " ( - + @@ -1092,7 +1092,7 @@ exports[`Mathtools Matrix Environments vmatrix* 1`] = ` " | - + @@ -1121,7 +1121,7 @@ exports[`Mathtools Matrix Environments vmatrix*[c] 1`] = ` " | - + @@ -1150,7 +1150,7 @@ exports[`Mathtools Matrix Environments vmatrix*[l] 1`] = ` " | - + @@ -1179,7 +1179,7 @@ exports[`Mathtools Matrix Environments vmatrix*[r] 1`] = ` " | - + @@ -1492,7 +1492,7 @@ exports[`Mathtools More Environments dcases 1`] = ` " { - + 1 @@ -1561,7 +1561,7 @@ exports[`Mathtools More Environments drcases 1`] = ` " - + 1 @@ -1939,7 +1939,7 @@ exports[`Mathtools More Environments rcases 1`] = ` " - + 1 @@ -2443,7 +2443,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix 1`] = ` { - + @@ -2474,7 +2474,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix* 1`] = ` { - + @@ -2505,7 +2505,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[c] 1`] = ` { - + @@ -2536,7 +2536,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[l] 1`] = ` { - + @@ -2567,7 +2567,7 @@ exports[`Mathtools Small Matrix Environments Bsmallmatrix*[r] 1`] = ` { - + @@ -2598,7 +2598,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix 1`] = ` - + @@ -2629,7 +2629,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix* 1`] = ` - + @@ -2660,7 +2660,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[c] 1`] = ` - + @@ -2691,7 +2691,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[l] 1`] = ` - + @@ -2722,7 +2722,7 @@ exports[`Mathtools Small Matrix Environments Vsmallmatrix*[r] 1`] = ` - + @@ -2753,7 +2753,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix 1`] = ` [ - + @@ -2784,7 +2784,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix* 1`] = ` [ - + @@ -2815,7 +2815,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[c] 1`] = ` [ - + @@ -2846,7 +2846,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[l] 1`] = ` [ - + @@ -2877,7 +2877,7 @@ exports[`Mathtools Small Matrix Environments bsmallmatrix*[r] 1`] = ` [ - + @@ -2908,7 +2908,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix 1`] = ` ( - + @@ -2939,7 +2939,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix* 1`] = ` ( - + @@ -2970,7 +2970,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[c] 1`] = ` ( - + @@ -3001,7 +3001,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[l] 1`] = ` ( - + @@ -3032,7 +3032,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[r] 1`] = ` ( - + @@ -3061,7 +3061,7 @@ exports[`Mathtools Small Matrix Environments psmallmatrix*[r] 1`] = ` exports[`Mathtools Small Matrix Environments smallmatrix 1`] = ` " - + @@ -3088,7 +3088,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix 1`] = ` exports[`Mathtools Small Matrix Environments smallmatrix 2`] = ` " - + @@ -3115,7 +3115,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix 2`] = ` exports[`Mathtools Small Matrix Environments smallmatrix* 1`] = ` " - + @@ -3142,7 +3142,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix* 1`] = ` exports[`Mathtools Small Matrix Environments smallmatrix*[c] 1`] = ` " - + @@ -3169,7 +3169,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[c] 1`] = ` exports[`Mathtools Small Matrix Environments smallmatrix*[l] 1`] = ` " - + @@ -3196,7 +3196,7 @@ exports[`Mathtools Small Matrix Environments smallmatrix*[l] 1`] = ` exports[`Mathtools Small Matrix Environments smallmatrix*[r] 1`] = ` " - + @@ -3225,7 +3225,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix 1`] = ` | - + @@ -3256,7 +3256,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix* 1`] = ` | - + @@ -3287,7 +3287,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[c] 1`] = ` | - + @@ -3318,7 +3318,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[l] 1`] = ` | - + @@ -3349,7 +3349,7 @@ exports[`Mathtools Small Matrix Environments vsmallmatrix*[r] 1`] = ` | - + @@ -3570,7 +3570,7 @@ exports[`Mathtools Spacing Control crampedsubstack 1`] = ` - + @@ -4414,7 +4414,7 @@ exports[`Mathtools setoptions smallmatrix-align 1`] = ` ( - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap index 9c643e5bf..c15069e31 100644 --- a/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap @@ -901,7 +901,7 @@ exports[`Matrix Macros Rest antidiagonalmatrix 1`] = ` " ( - + @@ -943,7 +943,7 @@ exports[`Matrix Macros Rest diagonalmatrix 1`] = ` " ( - + @@ -985,7 +985,7 @@ exports[`Matrix Macros Rest paulimatrix 0 1`] = ` " ( - + 1 @@ -1012,7 +1012,7 @@ exports[`Matrix Macros Rest paulimatrix 1 1`] = ` " ( - + 0 @@ -1039,7 +1039,7 @@ exports[`Matrix Macros Rest paulimatrix 2 1`] = ` " ( - + 0 @@ -1067,7 +1067,7 @@ exports[`Matrix Macros Rest paulimatrix 3 1`] = ` " ( - + 1 @@ -1095,7 +1095,7 @@ exports[`Matrix Macros Rest paulimatrix 4 1`] = ` " ( - + ) " @@ -1105,7 +1105,7 @@ exports[`Matrix Macros Rest zeromatrix 1`] = ` " ( - + 0 @@ -8015,7 +8015,7 @@ exports[`Physics7_0 Matrices_Quantity_2 1`] = ` " - + a @@ -8042,7 +8042,7 @@ exports[`Physics7_0 Matrices_Quantity_3 1`] = ` " ( - + a @@ -8069,7 +8069,7 @@ exports[`Physics7_0 Matrices_Quantity_4 1`] = ` " [ - + a @@ -8096,7 +8096,7 @@ exports[`Physics7_0 Matrices_Quantity_5 1`] = ` " | - + a @@ -8146,7 +8146,7 @@ exports[`Physics7_0 Matrices_Quantity_7 1`] = ` " ( - + a @@ -8173,7 +8173,7 @@ exports[`Physics7_0 Matrices_Quantity_8 1`] = ` " - + a @@ -8200,7 +8200,7 @@ exports[`Physics7_0 Matrices_Quantity_9 1`] = ` " [ - + a @@ -8227,7 +8227,7 @@ exports[`Physics7_0 Matrices_Quantity_10 1`] = ` " | - + a @@ -8254,7 +8254,7 @@ exports[`Physics7_0 Matrices_Quantity_11 1`] = ` " | - + a @@ -8281,7 +8281,7 @@ exports[`Physics7_1 Matrices_Fenced_0 1`] = ` " ( - + Q @@ -8292,7 +8292,7 @@ exports[`Physics7_1 Matrices_Fenced_0 1`] = ` ( - + R @@ -8308,7 +8308,7 @@ exports[`Physics7_1 Matrices_Fenced_1 1`] = ` " - + Q @@ -8319,7 +8319,7 @@ exports[`Physics7_1 Matrices_Fenced_1 1`] = ` - + R @@ -8335,7 +8335,7 @@ exports[`Physics7_1 Matrices_Fenced_2 1`] = ` " [ - + Q @@ -8346,7 +8346,7 @@ exports[`Physics7_1 Matrices_Fenced_2 1`] = ` [ - + R @@ -8362,7 +8362,7 @@ exports[`Physics7_1 Matrices_Fenced_3 1`] = ` " | - + Q @@ -8373,7 +8373,7 @@ exports[`Physics7_1 Matrices_Fenced_3 1`] = ` | - + R @@ -8389,7 +8389,7 @@ exports[`Physics7_1 Matrices_Fenced_4 1`] = ` " ( - + a @@ -8416,7 +8416,7 @@ exports[`Physics7_1 Matrices_Fenced_5 1`] = ` " - + a @@ -8443,7 +8443,7 @@ exports[`Physics7_1 Matrices_Fenced_6 1`] = ` " [ - + a @@ -8470,7 +8470,7 @@ exports[`Physics7_1 Matrices_Fenced_7 1`] = ` " | - + a @@ -8496,7 +8496,7 @@ exports[`Physics7_1 Matrices_Fenced_7 1`] = ` exports[`Physics7_2 Matrices_Small_0 1`] = ` " - + @@ -8511,7 +8511,7 @@ exports[`Physics7_2 Matrices_Small_0 1`] = ` exports[`Physics7_2 Matrices_Small_1 1`] = ` " - + @@ -8539,7 +8539,7 @@ exports[`Physics7_2 Matrices_Small_2 1`] = ` - + @@ -8569,7 +8569,7 @@ exports[`Physics7_2 Matrices_Small_3 1`] = ` ( - + @@ -8599,7 +8599,7 @@ exports[`Physics7_2 Matrices_Small_5 1`] = ` | - + @@ -8627,7 +8627,7 @@ exports[`Physics7_2 Matrices_Small_5 1`] = ` exports[`Physics7_2 Matrices_Small_6 1`] = ` " - + @@ -8655,7 +8655,7 @@ exports[`Physics7_2 Matrices_Small_7 1`] = ` ( - + @@ -8685,7 +8685,7 @@ exports[`Physics7_2 Matrices_Small_8 1`] = ` - + @@ -8715,7 +8715,7 @@ exports[`Physics7_2 Matrices_Small_9 1`] = ` [ - + @@ -8745,7 +8745,7 @@ exports[`Physics7_2 Matrices_Small_10 1`] = ` | - + @@ -8775,7 +8775,7 @@ exports[`Physics7_3 Matrices_SmallFenced_0 1`] = ` ( - + @@ -8789,7 +8789,7 @@ exports[`Physics7_3 Matrices_SmallFenced_0 1`] = ` ( - + @@ -8808,7 +8808,7 @@ exports[`Physics7_3 Matrices_SmallFenced_1 1`] = ` - + @@ -8822,7 +8822,7 @@ exports[`Physics7_3 Matrices_SmallFenced_1 1`] = ` - + @@ -8841,7 +8841,7 @@ exports[`Physics7_3 Matrices_SmallFenced_2 1`] = ` [ - + @@ -8855,7 +8855,7 @@ exports[`Physics7_3 Matrices_SmallFenced_2 1`] = ` [ - + @@ -8874,7 +8874,7 @@ exports[`Physics7_3 Matrices_SmallFenced_3 1`] = ` | - + @@ -8888,7 +8888,7 @@ exports[`Physics7_3 Matrices_SmallFenced_3 1`] = ` | - + @@ -8907,7 +8907,7 @@ exports[`Physics7_3 Matrices_SmallFenced_4 1`] = ` ( - + @@ -8937,7 +8937,7 @@ exports[`Physics7_3 Matrices_SmallFenced_5 1`] = ` - + @@ -8967,7 +8967,7 @@ exports[`Physics7_3 Matrices_SmallFenced_6 1`] = ` [ - + @@ -8997,7 +8997,7 @@ exports[`Physics7_3 Matrices_SmallFenced_7 1`] = ` | - + @@ -9026,7 +9026,7 @@ exports[`Physics7_4 Matrices_Det_0 1`] = ` " | - + a @@ -9053,7 +9053,7 @@ exports[`Physics7_4 Matrices_Det_1 1`] = ` " | - + a @@ -9081,7 +9081,7 @@ exports[`Physics7_4 Matrices_Det_2 1`] = ` | - + @@ -9110,7 +9110,7 @@ exports[`Physics7_4 Matrices_Det_3 1`] = ` " | - + a @@ -9127,7 +9127,7 @@ exports[`Physics7_4 Matrices_Det_4 1`] = ` " | - + a @@ -9145,7 +9145,7 @@ exports[`Physics7_4 Matrices_Det_5 1`] = ` | - + @@ -9204,7 +9204,7 @@ exports[`Physics7_5 Matrices_Identity_1 1`] = ` " | - + 1 @@ -9300,7 +9300,7 @@ exports[`Physics7_5 Matrices_Identity_2 1`] = ` " | - + 1 @@ -9316,7 +9316,7 @@ exports[`Physics7_5 Matrices_Identity_3 1`] = ` " | - + 1 @@ -9332,7 +9332,7 @@ exports[`Physics7_5 Matrices_Identity_4 1`] = ` " | - + 1 @@ -9348,7 +9348,7 @@ exports[`Physics7_5 Matrices_Identity_5 1`] = ` " ( - + 1 @@ -9405,7 +9405,7 @@ exports[`Physics7_6 Matrices_XMatrix_0 1`] = ` ( - + @@ -9441,7 +9441,7 @@ exports[`Physics7_6 Matrices_XMatrix_1 1`] = ` ( - + @@ -9488,7 +9488,7 @@ exports[`Physics7_6 Matrices_XMatrix_2 1`] = ` ( - + @@ -9517,7 +9517,7 @@ exports[`Physics7_6 Matrices_XMatrix_3 1`] = ` ( - + @@ -9542,7 +9542,7 @@ exports[`Physics7_6 Matrices_XMatrix_4 1`] = ` ( - + @@ -9638,7 +9638,7 @@ exports[`Physics7_6 Matrices_XMatrix_5 1`] = ` ( - + @@ -9775,7 +9775,7 @@ exports[`Physics7_6 Matrices_XMatrix_6 1`] = ` ( - + @@ -9819,7 +9819,7 @@ exports[`Physics7_6 Matrices_XMatrix_7 1`] = ` ( - + @@ -9859,7 +9859,7 @@ exports[`Physics7_6 Matrices_XMatrix_8 1`] = ` ( - + @@ -9878,7 +9878,7 @@ exports[`Physics7_6 Matrices_XMatrix_9 1`] = ` ( - + @@ -9897,7 +9897,7 @@ exports[`Physics7_6 Matrices_XMatrix_10 1`] = ` ( - + @@ -9922,7 +9922,7 @@ exports[`Physics7_6 Matrices_XMatrix_11 1`] = ` ( - + @@ -9958,7 +9958,7 @@ exports[`Physics7_6 Matrices_XMatrix_12 1`] = ` ( - + @@ -10009,7 +10009,7 @@ exports[`Physics7_7 Matrices_Pauli_1 1`] = ` " ( - + 1 @@ -10190,7 +10190,7 @@ exports[`Physics7_7 Matrices_Pauli_10 1`] = ` " ( - + ) " @@ -10212,7 +10212,7 @@ exports[`Physics7_7 Matrices_Pauli_12 1`] = ` " ( - + . @@ -10241,7 +10241,7 @@ exports[`Physics7_8 Matrices_PauliFenced_0 1`] = ` " ( - + 0 @@ -10268,7 +10268,7 @@ exports[`Physics7_8 Matrices_PauliFenced_1 1`] = ` " ( - + 0 @@ -10296,7 +10296,7 @@ exports[`Physics7_8 Matrices_PauliFenced_2 1`] = ` " ( - + 1 @@ -10324,7 +10324,7 @@ exports[`Physics7_8 Matrices_PauliFenced_3 1`] = ` " ( - + ) " @@ -10334,7 +10334,7 @@ exports[`Physics7_8 Matrices_PauliFenced_4 1`] = ` " ( - + 0 @@ -10361,7 +10361,7 @@ exports[`Physics7_8 Matrices_PauliFenced_5 1`] = ` " ( - + 0 @@ -10389,7 +10389,7 @@ exports[`Physics7_8 Matrices_PauliFenced_6 1`] = ` " ( - + 1 @@ -10417,7 +10417,7 @@ exports[`Physics7_8 Matrices_PauliFenced_7 1`] = ` " ( - + a @@ -10433,7 +10433,7 @@ exports[`Physics7_9 Matrices_Diag_0 1`] = ` " ( - + @@ -10478,7 +10478,7 @@ exports[`Physics7_9 Matrices_Diag_1 1`] = ` " ( - + 1 @@ -10494,7 +10494,7 @@ exports[`Physics7_9 Matrices_Diag_2 1`] = ` " ( - + 1 @@ -10512,7 +10512,7 @@ exports[`Physics7_9 Matrices_Diag_3 1`] = ` " ( - + @@ -10587,7 +10587,7 @@ exports[`Physics7_9 Matrices_Diag_4 1`] = ` " ( - + @@ -10674,7 +10674,7 @@ exports[`Physics7_9 Matrices_Diag_5 1`] = ` " ( - + @@ -10755,7 +10755,7 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` " ( - + @@ -10826,7 +10826,7 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + @@ -10863,7 +10863,7 @@ exports[`Physics7_10 Matrices_Adiag_0 1`] = ` " ( - + @@ -10908,7 +10908,7 @@ exports[`Physics7_10 Matrices_Adiag_1 1`] = ` " ( - + 1 @@ -10924,7 +10924,7 @@ exports[`Physics7_10 Matrices_Adiag_2 1`] = ` " ( - + 1 @@ -10942,7 +10942,7 @@ exports[`Physics7_10 Matrices_Adiag_3 1`] = ` " ( - + @@ -11017,7 +11017,7 @@ exports[`Physics7_10 Matrices_Adiag_4 1`] = ` " ( - + @@ -11104,7 +11104,7 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` " ( - + @@ -11175,7 +11175,7 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + @@ -11212,7 +11212,7 @@ exports[`Physics7_11 Matrices_Other_0 1`] = ` " ( - + ) a @@ -11223,7 +11223,7 @@ exports[`Physics7_11 Matrices_Other_1 1`] = ` " ( - + ) 1 @@ -11234,7 +11234,7 @@ exports[`Physics7_11 Matrices_Other_2 1`] = ` " ( - + @@ -11251,7 +11251,7 @@ exports[`Physics7_11 Matrices_Other_3 1`] = ` " ( - + @@ -11432,7 +11432,7 @@ exports[`Physics7_11 Matrices_Other_4 1`] = ` " ( - + @@ -11477,7 +11477,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` " ( - + @@ -11519,7 +11519,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + 1 @@ -11592,7 +11592,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + @@ -11629,7 +11629,7 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` " ( - + @@ -11671,7 +11671,7 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` - + 1 @@ -11744,7 +11744,7 @@ exports[`Physics7_11 Matrices_Other_7 1`] = ` exports[`Physics7_11 Matrices_Other_8 1`] = ` " - + a @@ -11769,7 +11769,7 @@ exports[`Physics7_11 Matrices_Other_8 1`] = ` exports[`Physics7_11 Matrices_Other_9 1`] = ` " - + diff --git a/ts/input/tex.ts b/ts/input/tex.ts index 205ecd4ff..5b27367a2 100644 --- a/ts/input/tex.ts +++ b/ts/input/tex.ts @@ -161,6 +161,7 @@ export class TeX extends AbstractInputJax { [FilterUtil.cleanSubSup, -7], [FilterUtil.setInherited, -6], [FilterUtil.checkScriptlevel, -5], + [FilterUtil.fixArrayLatex, -4.5], [FilterUtil.moveLimits, -4], [FilterUtil.cleanStretchy, -3], [FilterUtil.cleanAttributes, -2], diff --git a/ts/input/tex/FilterUtil.ts b/ts/input/tex/FilterUtil.ts index 0252d8b0f..51826dd91 100644 --- a/ts/input/tex/FilterUtil.ts +++ b/ts/input/tex/FilterUtil.ts @@ -341,6 +341,62 @@ const FilterUtil = { } options.removeFromList('mstyle', remove); }, + + /** + * Fixes the `data-latex` attribute of mtable nodes produced by array-like + * environments, in the cases where the parser's string was rewritten during + * parsing: + * + * - Column templates rewrite the parser's string entry by entry, so we end up + * using a leftover fragment instead of the actual source. + * + * - When the table is nested inside another environment (e.g., inside a + * tagged equation, or another array), `addLatexItem` sets `data-latex` from + * the `\end{name}` argument alone (e.g., `{array}`), which is wrong. + * + * This filter only replace a `data-latex` value that looks missing or + * broken, so that already-correct values (e.g., the literal source of a bare + * top-level array, or the macro call for macros that build their own + * array-like content) are left alone. + * + * @param {object} arg The argument object. + * @param {ParseOptions} arg.data The parse options. + */ + fixArrayLatex(arg: { data: ParseOptions }) { + const LATEX = TexConstant.Attr.LATEX; + for (const mml of arg.data.getList('mtable')) { + const tex = mml.getProperty('rawLatex') as string; + if (!tex) continue; + const name = mml.getProperty('rawLatexName') as string; + const current = mml.attributes.getExplicit(LATEX) as string; + if (!current || FilterUtil.isBrokenArrayLatex(current, name)) { + mml.attributes.set(TexConstant.Attr.LATEXITEM, tex); + mml.attributes.set(LATEX, tex); + } + } + }, + + /** + * Checks whether a `data-latex` value looks like one of the broken fragments, + * rather than a genuine, complete piece of LaTeX source. + * + * This could be fragile or incomplete! + * + * @param {string} current The current `data-latex` value. + * @param {string} name The environment name (e.g., `array`, `matrix`). + * @returns {boolean} True if the value looks broken. + */ + isBrokenArrayLatex(current: string, name: string): boolean { + if (current === `{${name}}`) { + // @test Ams Issues Array with Tag + return true; + } + // @test Complete Array column r c l > + return ( + current.includes(`\\end{${name}}`) && + !current.includes(`\\begin{${name}}`) + ); + }, }; export default FilterUtil; diff --git a/ts/input/tex/StackItem.ts b/ts/input/tex/StackItem.ts index 57a7938f2..95b84ccba 100644 --- a/ts/input/tex/StackItem.ts +++ b/ts/input/tex/StackItem.ts @@ -580,11 +580,6 @@ export abstract class BaseItem extends MmlStack implements StackItem { * @param {string=} prefix A prefix for the LaTeX command. */ public addLatexItem(node: MmlNode, prefix: string = '') { - // If the node already has a LaTeX source (e.g., an mtable reconstructed - // data-latex ), don't overwrite it with a new one. - if (node.getProperty('fixedLatex') !== undefined) { - return; - } const str = this.startStr.slice(this.startI, this.stopI); if (str) { const tex = prefix ? prefix + str : str; diff --git a/ts/input/tex/TexParser.ts b/ts/input/tex/TexParser.ts index 6a2cabe7d..f996115b6 100644 --- a/ts/input/tex/TexParser.ts +++ b/ts/input/tex/TexParser.ts @@ -269,13 +269,9 @@ export default class TexParser { return null; } const node = this.stack.Top().First; - // Only overwrite the LaTeX source if it hasn't been set already (e.g., an - // mtable produced by an array-like environment) - if (node.getProperty('fixedLatex') === undefined) { - const latex = this.trimTex(this.string); - if (latex) { - node.attributes.set(TexConstant.Attr.LATEX, latex); - } + const latex = this.trimTex(this.string); + if (latex) { + node.attributes.set(TexConstant.Attr.LATEX, latex); } return node; } diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index 16ea15cb2..a7457af5f 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -1107,6 +1107,7 @@ export class ArrayItem extends BaseItem { const scriptlevel = this.arraydef['scriptlevel']; delete this.arraydef['scriptlevel']; let mml = this.create('node', 'mtable', this.table, this.arraydef); + this.setTableLatex(mml); if (scriptlevel) { mml.setProperty('smallmatrix', true); } @@ -1134,7 +1135,6 @@ export class ArrayItem extends BaseItem { this.getProperty('close') as string ); } - this.setTableLatex(mml); return mml; } @@ -1415,29 +1415,21 @@ export class ArrayItem extends BaseItem { // by macro expansion \newenvironment. if (end < 0) return; this.setProperty('rawLatex', `\\begin{${name}}${source.slice(0, end)}`); + this.setProperty('rawLatexName', name); } /** - * Sets `data-latex` attribute of the mtable node from captured source. This - * is only needed when column templates are in play. + * Stashes the original source when a table is opened as a fall-back value for + * `data-latex` if the the postprocessing filter decides the attribute is + * incorrect. * * @param {MmlNode} mml The mtable node. */ public setTableLatex(mml: MmlNode) { - const hasTemplate = (list: (string | boolean)[]) => - list && list.some((x) => x); - if ( - !hasTemplate(this.cstart) && - !hasTemplate(this.cend) && - !hasTemplate(this.cextra) - ) { - return; - } const tex = this.getProperty('rawLatex') as string; if (!tex) return; - mml.attributes.set(TexConstant.Attr.LATEXITEM, tex); - mml.attributes.set(TexConstant.Attr.LATEX, tex); - mml.setProperty('fixedLatex', true); + mml.setProperty('rawLatex', tex); + mml.setProperty('rawLatexName', this.getProperty('rawLatexName') as string); } /** From a304ee35a3c3417bba65bcddc96868e171ad42a2 Mon Sep 17 00:00:00 2001 From: zorkow Date: Mon, 27 Jul 2026 20:09:15 +0200 Subject: [PATCH 08/11] ensure that ref elements actually get a data-latex attribute --- .../input/tex/__snapshots__/Ams.test.ts.snap | 2 +- .../input/tex/__snapshots__/Base.test.ts.snap | 6 +- .../tex/__snapshots__/Mathtools.test.ts.snap | 2 +- .../input/tex/__snapshots__/Tag.test.ts.snap | 58 +++++++++---------- .../tex/__snapshots__/TagFormat.test.ts.snap | 6 +- .../input/tex/__snapshots__/Tex.test.ts.snap | 2 +- .../tex/__snapshots__/Textmacros.test.ts.snap | 6 +- ts/input/tex/base/BaseMethods.ts | 19 +++--- 8 files changed, 51 insertions(+), 50 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap index bee5dcb82..c208fae9e 100644 --- a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap @@ -3276,7 +3276,7 @@ exports[`InternalMath Mbox Eqref 1`] = `   - (???) + (???)   diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index ac2c37d4a..52ea4bd67 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -7665,7 +7665,7 @@ exports[`Referencing Ref 1`] = ` a - ??? + ??? @@ -7685,7 +7685,7 @@ exports[`Referencing Ref Unknown 1`] = ` a - ??? + ??? @@ -9207,7 +9207,7 @@ exports[`User Defined Macros EqRef 1`] = ` " a - (???) + (???) " `; diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index 374db4e51..f0c2b3240 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -3995,7 +3995,7 @@ exports[`Mathtools Tagging refeq 1`] = ` - \\textsf{A} + \\textsf{A} diff --git a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap index 75e1a507c..de738fff0 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap @@ -20,7 +20,7 @@ exports[`Page References Forward Reference 1`] = ` ", " - (1) + (1) ", ] @@ -30,7 +30,7 @@ exports[`Page References Forward Reference 2`] = ` [ " - (1) + (1) ", " @@ -137,7 +137,7 @@ exports[`TagAll Eqref 1`] = ` - (1) + (1) " `; @@ -352,7 +352,7 @@ exports[`TagAll Ref 1`] = ` - 1 + 1 " `; @@ -372,7 +372,7 @@ exports[`TagAll Ref Default 1`] = ` - 1 + 1 " `; @@ -392,7 +392,7 @@ exports[`TagAll Ref Named 1`] = ` - A + A " `; @@ -422,10 +422,10 @@ exports[`TagAll Ref Named Default 1`] = ` - A + A - 1 + 1 " `; @@ -455,10 +455,10 @@ exports[`TagAll Ref Named Named 1`] = ` - A + A - B + B " `; @@ -478,7 +478,7 @@ exports[`TagAll Ref Unknown 1`] = ` - ??? + ??? " `; @@ -656,7 +656,7 @@ exports[`TagAms Eqref 1`] = ` - (1) + (1) " `; @@ -871,7 +871,7 @@ exports[`TagAms Ref 1`] = ` - 1 + 1 " `; @@ -891,7 +891,7 @@ exports[`TagAms Ref Default 1`] = ` - 1 + 1 " `; @@ -911,7 +911,7 @@ exports[`TagAms Ref Named 1`] = ` - A + A " `; @@ -941,10 +941,10 @@ exports[`TagAms Ref Named Default 1`] = ` - A + A - 1 + 1 " `; @@ -974,10 +974,10 @@ exports[`TagAms Ref Named Named 1`] = ` - A + A - B + B " `; @@ -997,7 +997,7 @@ exports[`TagAms Ref Unknown 1`] = ` - ??? + ??? " `; @@ -1130,7 +1130,7 @@ exports[`TagNone Eqref 1`] = ` - (???) + (???) " `; @@ -1315,7 +1315,7 @@ exports[`TagNone Ref 1`] = ` - ??? + ??? " `; @@ -1330,7 +1330,7 @@ exports[`TagNone Ref Default 1`] = ` - ??? + ??? " `; @@ -1350,7 +1350,7 @@ exports[`TagNone Ref Named 1`] = ` - A + A " `; @@ -1375,10 +1375,10 @@ exports[`TagNone Ref Named Default 1`] = ` - A + A - ??? + ??? " `; @@ -1408,10 +1408,10 @@ exports[`TagNone Ref Named Named 1`] = ` - A + A - B + B " `; @@ -1426,7 +1426,7 @@ exports[`TagNone Ref Unknown 1`] = ` - ??? + ??? " `; diff --git a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap index ef45268a7..a37860a18 100644 --- a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap @@ -87,7 +87,7 @@ exports[`Tagformat Custom ref 1`] = ` - **x** + **x** @@ -116,7 +116,7 @@ exports[`Tagformat Eqref 1`] = ` - [x] + [x] @@ -145,7 +145,7 @@ exports[`Tagformat Ref 1`] = ` - x + x diff --git a/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap index ea428f42a..01b104ff7 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap @@ -46,7 +46,7 @@ exports[`FindTeX ref undefined 1`] = ` [ " - ??? + ??? ", ] diff --git a/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap index c876abb13..1d223fae8 100644 --- a/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap @@ -182,10 +182,10 @@ exports[`Textmacros Macros Ref and Eqref 1`] = ` " - ??? + ??? - (???) + (???) " @@ -594,7 +594,7 @@ exports[`Textmacros Text ref 1`] = ` - ??? + ??? " diff --git a/ts/input/tex/base/BaseMethods.ts b/ts/input/tex/base/BaseMethods.ts index 467b5bc06..8ba1f15ed 100644 --- a/ts/input/tex/base/BaseMethods.ts +++ b/ts/input/tex/base/BaseMethods.ts @@ -2227,15 +2227,16 @@ const BaseMethods: { [key: string]: ParseMethod } = { // @test Eqref tag = parser.tags.formatRef(tag); } - const node = parser.create( - 'node', - 'mrow', - ParseUtil.internalMath(parser, Array.isArray(tag) ? tag.join('') : tag), - { - href: parser.tags.formatUrl(ref.id, parser.options.baseURL), - class: 'MathJax_ref', - } - ); + const tagStr = Array.isArray(tag) ? tag.join('') : tag; + const mml = new TexParser( + `\\text{${tagStr}}`, + {}, + parser.tags.configuration + ).mml(); + const node = parser.create('node', 'mrow', [mml], { + href: parser.tags.formatUrl(ref.id, parser.options.baseURL), + class: 'MathJax_ref', + }); parser.Push(node); }, From 43ad772e0e73c75586495a2de6643dcae2895631 Mon Sep 17 00:00:00 2001 From: zorkow Date: Mon, 27 Jul 2026 20:57:10 +0200 Subject: [PATCH 09/11] mrows with ref commands get the correct data-latex --- .../input/tex/__snapshots__/Base.test.ts.snap | 10 ++-- .../tex/__snapshots__/Mathtools.test.ts.snap | 4 +- .../input/tex/__snapshots__/Tag.test.ts.snap | 54 +++++++++---------- .../tex/__snapshots__/TagFormat.test.ts.snap | 12 ++--- .../tex/__snapshots__/Textmacros.test.ts.snap | 6 +-- ts/input/tex/base/BaseMethods.ts | 9 ++++ 6 files changed, 52 insertions(+), 43 deletions(-) diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index 52ea4bd67..bfe84ecbd 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -7656,7 +7656,7 @@ exports[`Referencing Nonumber 1`] = ` exports[`Referencing Ref 1`] = ` " - + ( 1 @@ -7664,7 +7664,7 @@ exports[`Referencing Ref 1`] = ` a - + ??? @@ -7676,7 +7676,7 @@ exports[`Referencing Ref 1`] = ` exports[`Referencing Ref Unknown 1`] = ` " - + ( 1 @@ -7684,7 +7684,7 @@ exports[`Referencing Ref Unknown 1`] = ` a - + ??? @@ -9206,7 +9206,7 @@ exports[`User Defined Environments smallmatrix 1`] = ` exports[`User Defined Macros EqRef 1`] = ` " a - + (???) " diff --git a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap index f0c2b3240..7af85c919 100644 --- a/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Mathtools.test.ts.snap @@ -3992,9 +3992,9 @@ exports[`Mathtools Tagging refeq 1`] = ` - + - + \\textsf{A} diff --git a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap index de738fff0..7a5d585bb 100644 --- a/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Tag.test.ts.snap @@ -136,7 +136,7 @@ exports[`TagAll Eqref 1`] = ` - + (1) " @@ -351,7 +351,7 @@ exports[`TagAll Ref 1`] = ` - + 1 " @@ -371,7 +371,7 @@ exports[`TagAll Ref Default 1`] = ` - + 1 " @@ -391,7 +391,7 @@ exports[`TagAll Ref Named 1`] = ` - + A " @@ -421,10 +421,10 @@ exports[`TagAll Ref Named Default 1`] = ` - + A - + 1 " @@ -454,10 +454,10 @@ exports[`TagAll Ref Named Named 1`] = ` - + A - + B " @@ -477,7 +477,7 @@ exports[`TagAll Ref Unknown 1`] = ` - + ??? " @@ -655,7 +655,7 @@ exports[`TagAms Eqref 1`] = ` - + (1) " @@ -870,7 +870,7 @@ exports[`TagAms Ref 1`] = ` - + 1 " @@ -890,7 +890,7 @@ exports[`TagAms Ref Default 1`] = ` - + 1 " @@ -910,7 +910,7 @@ exports[`TagAms Ref Named 1`] = ` - + A " @@ -940,10 +940,10 @@ exports[`TagAms Ref Named Default 1`] = ` - + A - + 1 " @@ -973,10 +973,10 @@ exports[`TagAms Ref Named Named 1`] = ` - + A - + B " @@ -996,7 +996,7 @@ exports[`TagAms Ref Unknown 1`] = ` - + ??? " @@ -1129,7 +1129,7 @@ exports[`TagNone Eqref 1`] = ` - + (???) " @@ -1314,7 +1314,7 @@ exports[`TagNone Ref 1`] = ` - + ??? " @@ -1329,7 +1329,7 @@ exports[`TagNone Ref Default 1`] = ` - + ??? " @@ -1349,7 +1349,7 @@ exports[`TagNone Ref Named 1`] = ` - + A " @@ -1374,10 +1374,10 @@ exports[`TagNone Ref Named Default 1`] = ` - + A - + ??? " @@ -1407,10 +1407,10 @@ exports[`TagNone Ref Named Named 1`] = ` - + A - + B " @@ -1425,7 +1425,7 @@ exports[`TagNone Ref Unknown 1`] = ` - + ??? " diff --git a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap index a37860a18..2714b6037 100644 --- a/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/TagFormat.test.ts.snap @@ -79,14 +79,14 @@ exports[`Tagformat Custom ref 1`] = ` x - + ( 1 ) - + **x** @@ -108,14 +108,14 @@ exports[`Tagformat Eqref 1`] = ` x - + [ A1 ] - + [x] @@ -137,14 +137,14 @@ exports[`Tagformat Ref 1`] = ` x - + [ A1 ] - + x diff --git a/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap index 1d223fae8..ab7400a49 100644 --- a/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Textmacros.test.ts.snap @@ -181,10 +181,10 @@ exports[`Textmacros Macros Quoted Specials 1`] = ` exports[`Textmacros Macros Ref and Eqref 1`] = ` " - + ??? - + (???) @@ -593,7 +593,7 @@ exports[`Textmacros Text ref 1`] = ` " - + ??? diff --git a/ts/input/tex/base/BaseMethods.ts b/ts/input/tex/base/BaseMethods.ts index 8ba1f15ed..b301bfb96 100644 --- a/ts/input/tex/base/BaseMethods.ts +++ b/ts/input/tex/base/BaseMethods.ts @@ -2237,6 +2237,15 @@ const BaseMethods: { [key: string]: ParseMethod } = { href: parser.tags.formatUrl(ref.id, parser.options.baseURL), class: 'MathJax_ref', }); + const latex = (mml.attributes.get(TexConstant.Attr.LATEX) || '') as string; + if (latex) { + // Protects the latex from being overwritten by the generic + // source-tracking in TexParser.updateResult, which would otherwise + // record the raw `\ref{...}`/`\eqref{...}` call instead of the + // latex that was actually used to build the reference's content. + node.attributes.set(TexConstant.Attr.LATEXITEM, latex); + node.attributes.set(TexConstant.Attr.LATEX, latex); + } parser.Push(node); }, From 546c77fc1ccd3389601a6bddc061386d0eba5ad4 Mon Sep 17 00:00:00 2001 From: zorkow Date: Thu, 30 Jul 2026 14:46:21 +0200 Subject: [PATCH 10/11] fixes nested table problem --- testsuite/tests/input/tex/SetOptions.test.ts | 2 +- .../input/tex/__snapshots__/Ams.test.ts.snap | 2 +- .../input/tex/__snapshots__/Base.test.ts.snap | 4 +- .../tex/__snapshots__/Newcommand.test.ts.snap | 8 +- .../tex/__snapshots__/Physics.test.ts.snap | 10 +-- .../tex/__snapshots__/SetOptions.test.ts.snap | 12 +-- ts/input/tex/NodeUtil.ts | 7 +- ts/input/tex/base/BaseItems.ts | 77 +++++++++++++++---- ts/input/tex/newcommand/NewcommandMethods.ts | 41 ++++++---- 9 files changed, 110 insertions(+), 53 deletions(-) diff --git a/testsuite/tests/input/tex/SetOptions.test.ts b/testsuite/tests/input/tex/SetOptions.test.ts index a292a8495..d5ec59894 100644 --- a/testsuite/tests/input/tex/SetOptions.test.ts +++ b/testsuite/tests/input/tex/SetOptions.test.ts @@ -54,7 +54,7 @@ describe('Setoptions', () => { ).toMatchSnapshot(); }); - test('Set pacjage regexp option', () => { + test('Set package regexp option', () => { expect( tex2mml( '\\setOptions[ams]{operatornamePattern=/^[a-z0-9]+/} \\operatorname{ab1}' diff --git a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap index c208fae9e..dfd63ceba 100644 --- a/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Ams.test.ts.snap @@ -1654,7 +1654,7 @@ exports[`Ams Genfrac no delimiters 1`] = ` exports[`Ams Issues Array with Tag 1`] = ` " - + ( 1 diff --git a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap index bfe84ecbd..dd4850496 100644 --- a/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Base.test.ts.snap @@ -2672,7 +2672,7 @@ exports[`Complete Array column r c repeat | {} 2`] = ` exports[`Complete Array column r c repeat | {} 3`] = ` " - + a @@ -3543,7 +3543,7 @@ exports[`Environments IndentAlign Single 1`] = ` exports[`Environments Nested array 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap index 7b6d7af71..3e5af71fa 100644 --- a/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Newcommand.test.ts.snap @@ -14,10 +14,10 @@ exports[`Nested Environments Environments Intermixed 1`] = ` exports[`Nested Environments Environments Nested 1`] = ` " - - + + - + a @@ -56,7 +56,7 @@ exports[`Nested Environments Nested Begins 1`] = ` exports[`Nested Environments Newenvironment with Begin 1`] = ` " - + a diff --git a/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap index c15069e31..21b22bc45 100644 --- a/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/Physics.test.ts.snap @@ -10820,7 +10820,7 @@ exports[`Physics7_9 Matrices_Diag_6 1`] = ` - + @@ -11173,7 +11173,7 @@ exports[`Physics7_10 Matrices_Adiag_5 1`] = ` - + @@ -11515,7 +11515,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + @@ -11585,7 +11585,7 @@ exports[`Physics7_11 Matrices_Other_5 1`] = ` - + @@ -11667,7 +11667,7 @@ exports[`Physics7_11 Matrices_Other_6 1`] = ` - + diff --git a/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap b/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap index bb3c9a361..3db061637 100644 --- a/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap +++ b/testsuite/tests/input/tex/__snapshots__/SetOptions.test.ts.snap @@ -40,12 +40,6 @@ exports[`Setoptions Set TeX option 1`] = ` " `; -exports[`Setoptions Set pacjage regexp option 1`] = ` -" - ab1 -" -`; - exports[`Setoptions Set package boolean option 1`] = ` " 1 @@ -56,6 +50,12 @@ exports[`Setoptions Set package boolean option 1`] = ` " `; +exports[`Setoptions Set package regexp option 1`] = ` +" + ab1 +" +`; + exports[`Setoptions Set package string option 1`] = ` " diff --git a/ts/input/tex/NodeUtil.ts b/ts/input/tex/NodeUtil.ts index b4e458ad4..fb678c393 100644 --- a/ts/input/tex/NodeUtil.ts +++ b/ts/input/tex/NodeUtil.ts @@ -92,9 +92,10 @@ const NodeUtil = { const children = node.childNodes[0]?.childNodes || []; let expr = ''; for (const child of children) { - const att = ((child as MmlNode)?.attributes?.get( - TexConstant.Attr.LATEX - ) || '') as string; + // For table child we prefer the `rawLatex` property. + const att = ((child as MmlNode)?.getProperty?.('rawLatex') || + (child as MmlNode)?.attributes?.get(TexConstant.Attr.LATEX) || + '') as string; if (!att) continue; expr += expr && expr.match(/[a-zA-Z]$/) && att.match(/^[a-zA-Z]/) diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index a7457af5f..463e6a0c3 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -772,7 +772,7 @@ export class FnItem extends BaseItem { (NodeUtil.isType(mml, 'mstyle') && mml.childNodes.length && NodeUtil.isType(mml.childNodes[0].childNodes[0], 'mspace')) || - NodeUtil.isType(mml, 'mspace') + NodeUtil.isType(mml, 'mspace') ) { // @test Fn Pos Space, Fn Neg Space return [[top, item], true]; @@ -832,16 +832,16 @@ export class NotItem extends BaseItem { } if ( item.isKind('mml') && - (NodeUtil.isType(item.First, 'mo') || - NodeUtil.isType(item.First, 'mi') || - NodeUtil.isType(item.First, 'mtext')) + (NodeUtil.isType(item.First, 'mo') || + NodeUtil.isType(item.First, 'mi') || + NodeUtil.isType(item.First, 'mtext')) ) { mml = item.First; c = NodeUtil.getText(mml as TextNode); if ( c.length === 1 && - !NodeUtil.getProperty(mml, 'movesupsub') && - NodeUtil.getChildren(mml).length === 1 + !NodeUtil.getProperty(mml, 'movesupsub') && + NodeUtil.getChildren(mml).length === 1 ) { if (this.remap.contains(c)) { // @test Negation Simple, Negation Complex @@ -1124,7 +1124,13 @@ export class ArrayItem extends BaseItem { } mml = this.handleFrame(mml); if (scriptlevel !== undefined) { + const table = mml; mml = this.create('node', 'mstyle', [mml], { scriptlevel }); + const rawLatex = table.getProperty('rawLatex'); + if (rawLatex) { + mml.setProperty('rawLatex', rawLatex); + mml.setProperty('rawLatexName', table.getProperty('rawLatexName')); + } } if (this.getProperty('open') || this.getProperty('close')) { // @test Cross Product Formula @@ -1232,7 +1238,7 @@ export class ArrayItem extends BaseItem { if (start || end || ralign) { if ( ++this.templateSubs > - parser.configuration.options.maxTemplateSubtitutions + parser.configuration.options.maxTemplateSubtitutions ) { throw new TexError( 'MaxTemplateSubs', @@ -1292,7 +1298,7 @@ export class ArrayItem extends BaseItem { envs--; break; } - // fall through if not closing a nested array environment + // fall through if not closing a nested array environment default: { if (braces || envs) continue; i -= match[2].length; @@ -1409,13 +1415,21 @@ export class ArrayItem extends BaseItem { * @param {string} name The environment name (e.g., `array`, `matrix`). */ public captureLatex(parser: TexParser, name: string) { + this.setProperty('rawLatexName', name); const source = parser.string.slice(parser.i); const end = ArrayItem.findEnvEnd(source, name); - // If no matching \end{name} could be found (e.g., an environment produced - // by macro expansion \newenvironment. - if (end < 0) return; - this.setProperty('rawLatex', `\\begin{${name}}${source.slice(0, end)}`); - this.setProperty('rawLatexName', name); + if (end >= 0) { + this.setProperty('rawLatex', `\\begin{${name}}${source.slice(0, end)}`); + return; + } + // No matching \end{name} could be found (e.g., produced by + // \newenvironment), save the start position instead, so the raw source can + // be taken from the parser's string once the table actually closes. + this.setProperty('rawLatexStart', parser.i); + this.setProperty( + 'rawLatexGen', + (parser.stack.global['envSplice'] as number) || 0 + ); } /** @@ -1426,10 +1440,39 @@ export class ArrayItem extends BaseItem { * @param {MmlNode} mml The mtable node. */ public setTableLatex(mml: MmlNode) { - const tex = this.getProperty('rawLatex') as string; + const name = this.getProperty('rawLatexName') as string; + let tex = this.getProperty('rawLatex') as string; + if (!tex && name) { + const start = this.getProperty('rawLatexStart') as number; + const gen = this.getProperty('rawLatexGen') as number; + const currentGen = this.parser + ? (this.parser.stack.global['envSplice'] as number) || 0 + : -1; + if (start != null && this.parser && gen === currentGen) { + // The environment's closing text is now in the parser's string, so the + // full source can finally be recovered. Expanded environment's + // can leave extra whitespace, so collapse. + // @test Environments Nested + const body = this.parser.string + .slice(start, this.parser.i) + .replace(/ {2,}/g, ' '); + tex = `\\begin{${name}}${body}`; + } + } + if (!tex && name) { + // Last resort: reconstruct the source from the table's own rows, + // whose `data-latex` is always tracked correctly. + const LATEX = TexConstant.Attr.LATEX; + const rows = this.table + .map((row) => (row.attributes.get(LATEX) as string) || '') + .filter((row) => row); + if (rows.length) { + tex = `\\begin{${name}}${rows.join('\\\\')}\\end{${name}}`; + } + } if (!tex) return; mml.setProperty('rawLatex', tex); - mml.setProperty('rawLatexName', this.getProperty('rawLatexName') as string); + mml.setProperty('rawLatexName', name); } /** @@ -1592,8 +1635,8 @@ export class EqnArrayItem extends ArrayItem { const calign = (this.arraydef.columnalign as string).split(/ /); const align = this.row.length && calign.length - ? calign[this.row.length % calign.length] - : 'right'; + ? calign[this.row.length % calign.length] + : 'right'; if (align !== 'right') { ParseUtil.fixInitialMO(this.factory.configuration, this.nodes); } diff --git a/ts/input/tex/newcommand/NewcommandMethods.ts b/ts/input/tex/newcommand/NewcommandMethods.ts index 545c0f6d9..b18c8b80f 100644 --- a/ts/input/tex/newcommand/NewcommandMethods.ts +++ b/ts/input/tex/newcommand/NewcommandMethods.ts @@ -87,17 +87,17 @@ const NewcommandMethods: { [key: string]: ParseMethod } = { const def = parser.GetArgument(name); !(params instanceof Array) ? // @test Def DoubleLet, DefReDef - NewcommandUtil.addMacro(parser, cs, NewcommandMethods.Macro, [ - def, - params, - ]) + NewcommandUtil.addMacro(parser, cs, NewcommandMethods.Macro, [ + def, + params, + ]) : // @test Def Let - NewcommandUtil.addMacro( - parser, - cs, - NewcommandMethods.MacroWithTemplate, - [def].concat(params) - ); + NewcommandUtil.addMacro( + parser, + cs, + NewcommandMethods.MacroWithTemplate, + [def].concat(params) + ); parser.Push(parser.itemFactory.create('null')); }, @@ -269,11 +269,20 @@ const NewcommandMethods: { [key: string]: ParseMethod } = { if (edef) { // Parse the commands in the end environment definition. const rest = parser.string.slice(parser.i); - parser.string = ParseUtil.addArgs( - parser, - parser.string.substring(0, parser.i), - edef + let prefix = parser.string.substring(0, parser.i); + // Here `\end{name}` has already been parsed, but left in place it + // ends up in the LaTeX source. Remove it using whitespace to keep the + // counter correct. + const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const endTag = prefix.match( + new RegExp(`\\\\end\\s*\\{\\s*${escaped}\\s*\\}$`) ); + if (endTag) { + prefix = + prefix.slice(0, prefix.length - endTag[0].length) + + ' '.repeat(endTag[0].length); + } + parser.string = ParseUtil.addArgs(parser, prefix, edef); parser.Parse(); // Reset to parsing the remainder of the expression. parser.string = rest; @@ -306,6 +315,10 @@ const NewcommandMethods: { [key: string]: ParseMethod } = { parser.string.slice(parser.i) ); parser.i = 0; + // This destroys any absolute positions recorded by an enclosing environment + // This counter allows to detect that. + parser.stack.global['envSplice'] = + ((parser.stack.global['envSplice'] as number) || 0) + 1; parser.stack.global['beginEnv'] = ((parser.stack.global['beginEnv'] as number) || 0) + 1; return parser.itemFactory.create('beginEnv').setProperty('name', name); From 4a091656e0e2dd68c47818d30a104f3f8946305c Mon Sep 17 00:00:00 2001 From: zorkow Date: Wed, 12 Aug 2026 12:44:36 +0200 Subject: [PATCH 11/11] incorporate review suggestions except for parsing loop --- ts/input/tex/FilterUtil.ts | 4 ++-- ts/input/tex/base/BaseItems.ts | 23 ++++++++++---------- ts/input/tex/newcommand/NewcommandMethods.ts | 23 ++++++++++---------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/ts/input/tex/FilterUtil.ts b/ts/input/tex/FilterUtil.ts index 51826dd91..bc21e0828 100644 --- a/ts/input/tex/FilterUtil.ts +++ b/ts/input/tex/FilterUtil.ts @@ -354,8 +354,8 @@ const FilterUtil = { * tagged equation, or another array), `addLatexItem` sets `data-latex` from * the `\end{name}` argument alone (e.g., `{array}`), which is wrong. * - * This filter only replace a `data-latex` value that looks missing or - * broken, so that already-correct values (e.g., the literal source of a bare + * This filter only replaces a `data-latex` value that looks missing or + * broken, so that already correct values (e.g., the literal source of a bare * top-level array, or the macro call for macros that build their own * array-like content) are left alone. * diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index e37609c57..4f4ee73a7 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -38,6 +38,7 @@ import StackItemFactory from '../StackItemFactory.js'; import { CheckType, BaseItem, StackItem, EnvList } from '../StackItem.js'; import { TRBL } from '../../../util/Styles.js'; import { TexConstant } from '../TexConstants.js'; +import { quotePattern } from '../../../util/string.js'; import { COMPONENT as TEX_COMPONENT } from '../__locales__/Component.js'; import { COMPONENT } from './__locales__/Component.js'; @@ -768,7 +769,7 @@ export class FnItem extends BaseItem { (NodeUtil.isType(mml, 'mstyle') && mml.childNodes.length && NodeUtil.isType(mml.childNodes[0].childNodes[0], 'mspace')) || - NodeUtil.isType(mml, 'mspace') + NodeUtil.isType(mml, 'mspace') ) { // @test Fn Pos Space, Fn Neg Space return [[top, item], true]; @@ -828,16 +829,16 @@ export class NotItem extends BaseItem { } if ( item.isKind('mml') && - (NodeUtil.isType(item.First, 'mo') || - NodeUtil.isType(item.First, 'mi') || - NodeUtil.isType(item.First, 'mtext')) + (NodeUtil.isType(item.First, 'mo') || + NodeUtil.isType(item.First, 'mi') || + NodeUtil.isType(item.First, 'mtext')) ) { mml = item.First; c = NodeUtil.getText(mml as TextNode); if ( c.length === 1 && - !NodeUtil.getProperty(mml, 'movesupsub') && - NodeUtil.getChildren(mml).length === 1 + !NodeUtil.getProperty(mml, 'movesupsub') && + NodeUtil.getChildren(mml).length === 1 ) { if (this.remap.contains(c)) { // @test Negation Simple, Negation Complex @@ -1234,7 +1235,7 @@ export class ArrayItem extends BaseItem { if (start || end || ralign) { if ( ++this.templateSubs > - parser.configuration.options.maxTemplateSubtitutions + parser.configuration.options.maxTemplateSubtitutions ) { texError(COMPONENT, 'MaxTemplateSubs'); } @@ -1290,7 +1291,7 @@ export class ArrayItem extends BaseItem { envs--; break; } - // fall through if not closing a nested array environment + // fall through if not closing a nested array environment default: { if (braces || envs) continue; i -= match[2].length; @@ -1478,7 +1479,7 @@ export class ArrayItem extends BaseItem { * -1 if no matching end was found. */ private static findEnvEnd(str: string, name: string): number { - const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const escaped = quotePattern(name); const begin = new RegExp(`^\\\\begin\\s*\\{${escaped}\\}`); const end = new RegExp(`^\\\\end\\s*\\{${escaped}\\}`); let depth = 0; @@ -1627,8 +1628,8 @@ export class EqnArrayItem extends ArrayItem { const calign = (this.arraydef.columnalign as string).split(/ /); const align = this.row.length && calign.length - ? calign[this.row.length % calign.length] - : 'right'; + ? calign[this.row.length % calign.length] + : 'right'; if (align !== 'right') { ParseUtil.fixInitialMO(this.factory.configuration, this.nodes); } diff --git a/ts/input/tex/newcommand/NewcommandMethods.ts b/ts/input/tex/newcommand/NewcommandMethods.ts index 62d67f545..305f92cc6 100644 --- a/ts/input/tex/newcommand/NewcommandMethods.ts +++ b/ts/input/tex/newcommand/NewcommandMethods.ts @@ -32,6 +32,7 @@ import { ParseUtil } from '../ParseUtil.js'; import { UnitUtil } from '../UnitUtil.js'; import { StackItem } from '../StackItem.js'; import { NewcommandUtil } from './NewcommandUtil.js'; +import { quotePattern } from '../../../util/string.js'; import { COMPONENT } from './__locales__/Component.js'; @@ -89,17 +90,17 @@ const NewcommandMethods: { [key: string]: ParseMethod } = { const def = parser.GetArgument(name); !(params instanceof Array) ? // @test Def DoubleLet, DefReDef - NewcommandUtil.addMacro(parser, cs, NewcommandMethods.Macro, [ - def, - params, - ]) + NewcommandUtil.addMacro(parser, cs, NewcommandMethods.Macro, [ + def, + params, + ]) : // @test Def Let - NewcommandUtil.addMacro( - parser, - cs, - NewcommandMethods.MacroWithTemplate, - [def].concat(params) - ); + NewcommandUtil.addMacro( + parser, + cs, + NewcommandMethods.MacroWithTemplate, + [def].concat(params) + ); parser.Push(parser.itemFactory.create('null')); }, @@ -271,7 +272,7 @@ const NewcommandMethods: { [key: string]: ParseMethod } = { // Here `\end{name}` has already been parsed, but left in place it // ends up in the LaTeX source. Remove it using whitespace to keep the // counter correct. - const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const escaped = quotePattern(name); const endTag = prefix.match( new RegExp(`\\\\end\\s*\\{\\s*${escaped}\\s*\\}$`) );