diff --git a/testsuite/tests/input/tex/Ams.test.ts b/testsuite/tests/input/tex/Ams.test.ts
index 02d0a6184..e1d13aaa7 100644
--- a/testsuite/tests/input/tex/Ams.test.ts
+++ b/testsuite/tests/input/tex/Ams.test.ts
@@ -441,16 +441,19 @@ describe('Ams', () => {
toXmlMatch(
tex2mml('\\xleftarrow{abcd}'),
``
);
});
@@ -461,22 +464,25 @@ describe('Ams', () => {
toXmlMatch(
tex2mml('\\xleftarrow[xyz]{abcd}'),
``
);
});
@@ -488,16 +494,19 @@ describe('Ams', () => {
tex2mml('A\\xleftarrow{abcd}B'),
``
);
@@ -509,16 +518,19 @@ describe('Ams', () => {
toXmlMatch(
tex2mml('\\xrightarrow{abcd}'),
``
);
});
@@ -529,22 +541,25 @@ describe('Ams', () => {
toXmlMatch(
tex2mml('\\xrightarrow[xyz]{abcd}'),
``
);
});
@@ -556,16 +571,19 @@ describe('Ams', () => {
tex2mml('A\\xrightarrow{abcd}B'),
``
);
diff --git a/testsuite/tests/input/tex/Extpfeil.test.ts b/testsuite/tests/input/tex/Extpfeil.test.ts
index a9f0181f0..c44882b5c 100644
--- a/testsuite/tests/input/tex/Extpfeil.test.ts
+++ b/testsuite/tests/input/tex/Extpfeil.test.ts
@@ -15,18 +15,21 @@ describe('Extpfeil', () => {
toXmlMatch(
tex2mml('\\xtwoheadrightarrow{abcxyz}'),
``
);
});
@@ -37,18 +40,21 @@ describe('Extpfeil', () => {
toXmlMatch(
tex2mml('\\xtwoheadleftarrow{abcxyz}'),
``
);
});
@@ -59,18 +65,21 @@ describe('Extpfeil', () => {
toXmlMatch(
tex2mml('\\xmapsto{abcxyz}'),
``
);
});
@@ -81,18 +90,21 @@ describe('Extpfeil', () => {
toXmlMatch(
tex2mml('\\xlongequal{abcxyz}'),
``
);
});
@@ -103,18 +115,21 @@ describe('Extpfeil', () => {
toXmlMatch(
tex2mml('\\xtofrom{abcxyz}'),
``
);
});
@@ -125,15 +140,18 @@ describe('Extpfeil', () => {
toXmlMatch(
tex2mml('\\Newextarrow{\\ab}{10,20}{8672}\\ab{xyz}'),
``
);
});
diff --git a/testsuite/tests/input/tex/Mathtools.test.ts b/testsuite/tests/input/tex/Mathtools.test.ts
index abdad3a17..e27c549bf 100644
--- a/testsuite/tests/input/tex/Mathtools.test.ts
+++ b/testsuite/tests/input/tex/Mathtools.test.ts
@@ -743,15 +743,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xleftrightarrow{x+y}'),
``
);
});
@@ -762,15 +765,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xLeftarrow{x+y}'),
``
);
});
@@ -781,15 +787,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xRightarrow{x+y}'),
``
);
});
@@ -800,15 +809,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xLeftrightarrow{x+y}'),
``
);
});
@@ -819,15 +831,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xhookleftarrow{x+y}'),
``
);
});
@@ -838,15 +853,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xhookrightarrow{x+y}'),
``
);
});
@@ -857,15 +875,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xmapsto{x+y}'),
``
);
});
@@ -876,15 +897,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xrightharpoondown{x+y}'),
``
);
});
@@ -895,15 +919,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xleftharpoondown{x+y}'),
``
);
});
@@ -914,15 +941,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xrightleftharpoons{x+y}'),
``
);
});
@@ -933,15 +963,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xleftrightharpoons{x+y}'),
``
);
});
@@ -952,15 +985,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xrightharpoonup{x+y}'),
``
);
});
@@ -971,15 +1007,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xleftharpoonup{x+y}'),
``
);
});
@@ -990,15 +1029,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xlongleftarrow{x+y}'),
``
);
});
@@ -1009,15 +1051,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xLongleftarrow{x+y}'),
``
);
});
@@ -1028,15 +1073,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xlongrightarrow{x+y}'),
``
);
});
@@ -1047,15 +1095,18 @@ describe('Mathtools stretchy', () => {
toXmlMatch(
tex2mml('\\xLongrightarrow{x+y}'),
``
);
});
diff --git a/testsuite/tests/input/tex/Mhchem.test.ts b/testsuite/tests/input/tex/Mhchem.test.ts
index 118dc6637..36ee99b75 100644
--- a/testsuite/tests/input/tex/Mhchem.test.ts
+++ b/testsuite/tests/input/tex/Mhchem.test.ts
@@ -4027,36 +4027,39 @@ describe('Mhchem8', () => {
-
-
-
-
- +
-
- 2
-
-
-
-
- OH
-
-
-
-
-
-
- A
-
-
-
-
-
- −
+
+
+
+
+
+
+ +
+
+ 2
+
+
+
+
+ OH
-
-
-
-
+
+
+
+
+
+ A
+
+
+
+
+
+ −
+
+
+
+
+
+
@@ -4124,36 +4127,39 @@ describe('Mhchem8', () => {
-
-
-
-
- +
-
- 2
-
-
-
-
- OH
-
-
-
-
-
-
- A
-
-
-
-
-
- −
+
+
+
+
+
+
+ +
+
+ 2
+
+
+
+
+ OH
-
-
-
-
+
+
+
+
+
+ A
+
+
+
+
+
+ −
+
+
+
+
+
+
@@ -4748,29 +4754,32 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- I
-
-
-
-
-
-
- A
-
-
-
-
-
- −
+
+
+
+
+
+
+ I
-
-
-
-
+
+
+
+
+
+ A
+
+
+
+
+
+ −
+
+
+
+
+
+
@@ -4796,29 +4805,32 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- I
-
-
-
-
-
-
- A
-
-
-
-
-
- −
+
+
+
+
+
+
+ I
-
-
-
-
+
+
+
+
+
+ A
+
+
+
+
+
+ −
+
+
+
+
+
+
[
@@ -4895,36 +4907,39 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- H
-
-
-
-
-
-
- A
-
-
-
+
+
+
+
+
+
+ H
-
-
-
- 2
-
+
+
+
+
+
+ A
+
+
+
+
+
+
+
+ 2
+
+
+
+
+ O
-
-
- O
-
-
-
-
+
+
+
+
@@ -4947,23 +4962,26 @@ describe('Mhchem-Ams', () => {
-
-
-
-
-
- text below
+
+
+
+
+
+
+
+ text below
+
-
-
-
-
-
- text above
-
-
-
-
+
+
+
+
+ text above
+
+
+
+
+
@@ -4986,22 +5004,25 @@ describe('Mhchem-Ams', () => {
-
-
-
-
-
- x
- i
-
-
-
-
-
- x
-
-
-
+
+
+
+
+
+
+
+ x
+ i
+
+
+
+
+
+ x
+
+
+
+
@@ -5070,15 +5091,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- Δ
-
-
-
-
+
+
+
+
+
+
+ Δ
+
+
+
+
+
(
@@ -5213,29 +5237,32 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- I
-
-
-
-
-
-
- A
-
-
-
-
-
- −
+
+
+
+
+
+
+ I
-
-
-
-
+
+
+
+
+
+ A
+
+
+
+
+
+ −
+
+
+
+
+
+
@@ -5268,29 +5295,32 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- I
-
-
-
-
-
-
- A
-
-
-
-
-
- −
+
+
+
+
+
+
+ I
-
-
-
-
+
+
+
+
+
+ A
+
+
+
+
+
+ −
+
+
+
+
+
+
@@ -5381,15 +5411,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
@@ -5412,15 +5445,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
@@ -5443,15 +5479,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
@@ -5474,15 +5513,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
@@ -5505,15 +5547,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
@@ -5536,15 +5581,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
@@ -5567,15 +5615,18 @@ describe('Mhchem-Ams', () => {
-
-
-
-
- text
-
-
-
-
+
+
+
+
+
+
+ text
+
+
+
+
+
diff --git a/testsuite/tests/input/tex/Tex.test.ts b/testsuite/tests/input/tex/Tex.test.ts
index 29f76e373..a77f12244 100644
--- a/testsuite/tests/input/tex/Tex.test.ts
+++ b/testsuite/tests/input/tex/Tex.test.ts
@@ -436,21 +436,24 @@ describe('TexParser', () => {
toXmlMatch(
tex2mml('\\xrightarrow[{[x]}]{a}'),
``
);
});
diff --git a/ts/input/tex/ams/AmsMethods.ts b/ts/input/tex/ams/AmsMethods.ts
index 63545da71..d1ea310da 100644
--- a/ts/input/tex/ams/AmsMethods.ts
+++ b/ts/input/tex/ams/AmsMethods.ts
@@ -560,7 +560,7 @@ export const AmsMethods: { [key: string]: ParseMethod } = {
let arrow = parser.create(
'token',
'mo',
- { stretchy: true, texClass: TEXCLASS.REL },
+ { stretchy: true, texClass: TEXCLASS.ORD }, // REL is applied in a TeXAtom below
String.fromCodePoint(chr)
);
if (m) {
@@ -588,7 +588,23 @@ export const AmsMethods: { [key: string]: ParseMethod } = {
// @test Above Left Arrow, Above Right Arrow, Above Left Arrow in Context,
// Above Right Arrow in Context
NodeUtil.setProperty(mml, 'subsupOK', true);
- parser.Push(mml);
+ //
+ // Use an empty item to prevent the xarrow from further stretching (see #3457)
+ // and enclose both in a TeXAtom to make the combination a REL.
+ //
+ parser.Push(
+ parser.create(
+ 'node',
+ 'TeXAtom',
+ [
+ parser.create('node', 'TeXAtom', [], {
+ texClass: TEXCLASS.NONE,
+ }),
+ mml,
+ ],
+ { texClass: TEXCLASS.REL }
+ )
+ );
},
/**