Skip to content

Commit b66969a

Browse files
committed
Fix xarrows so that they won't stretch after initial layout. (mathjax/MathJax#3457)
1 parent 27c47f3 commit b66969a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

ts/input/tex/ams/AmsMethods.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ export const AmsMethods: { [key: string]: ParseMethod } = {
560560
let arrow = parser.create(
561561
'token',
562562
'mo',
563-
{ stretchy: true, texClass: TEXCLASS.REL },
563+
{ stretchy: true, texClass: TEXCLASS.ORD }, // REL is applied in a TeXAtom below
564564
String.fromCodePoint(chr)
565565
);
566566
if (m) {
@@ -588,7 +588,23 @@ export const AmsMethods: { [key: string]: ParseMethod } = {
588588
// @test Above Left Arrow, Above Right Arrow, Above Left Arrow in Context,
589589
// Above Right Arrow in Context
590590
NodeUtil.setProperty(mml, 'subsupOK', true);
591-
parser.Push(mml);
591+
//
592+
// Use an empty item to prevent the xarrow from further stretching (see #3457)
593+
// and enclose both in a TeXAtom to make the combination a REL.
594+
//
595+
parser.Push(
596+
parser.create(
597+
'node',
598+
'TeXAtom',
599+
[
600+
parser.create('node', 'TeXAtom', [], {
601+
texClass: TEXCLASS.NONE,
602+
}),
603+
mml,
604+
],
605+
{ texClass: TEXCLASS.REL }
606+
)
607+
);
592608
},
593609

594610
/**

0 commit comments

Comments
 (0)