diff --git a/lib/LaTeXML/Package/amsmath.sty.ltxml b/lib/LaTeXML/Package/amsmath.sty.ltxml
index f2962d642b..e1af026561 100644
--- a/lib/LaTeXML/Package/amsmath.sty.ltxml
+++ b/lib/LaTeXML/Package/amsmath.sty.ltxml
@@ -672,7 +672,7 @@ sub rearrangeLoneAMSAligned {
# and synthesize a box from the lhs & rhs.
$document->setNodeBox($main, MathWhatsit(map { $document->getNodeBox($_) } @cells));
closeMathFork($document, $eqn, $main, $branch);
- } } } }
+ } } } }
return; }
#======================================================================
@@ -749,7 +749,7 @@ DefPrimitive('\numberwithin[]{}{}', sub {
# Section 3.11.2 Cross references to equation numbers
DefConstructor('\eqref Semiverbatim', "()",
- mode => 'restricted_horizontal', enterHorizontal => 1,
+ mode => 'restricted_horizontal', enterHorizontal => 1,
properties => sub { (label => CleanLabel($_[1])); });
DefMacro('\thetag{}', '{\rm #1}');
@@ -905,10 +905,14 @@ DefMath('\And', '&', role => 'ADDOP', meaning => 'and');
# Should be in LaTeX (& TeX): \overrightarrow, \overleftarrow
# Note that the arrow is treated as an accent over/under the argument!
-DefMath('\underrightarrow{}', "\x{2192}", operator_role => 'UNDERACCENT');
-DefMath('\underleftarrow{}', "\x{2190}", operator_role => 'UNDERACCENT');
-DefMath('\overleftrightarrow{}', "\x{2194}", operator_role => 'OVERACCENT');
-DefMath('\underleftrightarrow{}', "\x{2194}", operator_role => 'UNDERACCENT');
+DefMath('\underrightarrow{}', "\x{2192}",
+ operator_role => 'UNDERACCENT', operator_stretchy => 'true');
+DefMath('\underleftarrow{}', "\x{2190}",
+ operator_role => 'UNDERACCENT', operator_stretchy => 'true');
+DefMath('\overleftrightarrow{}', "\x{2194}",
+ operator_role => 'OVERACCENT', operator_stretchy => 'true');
+DefMath('\underleftrightarrow{}', "\x{2194}",
+ operator_role => 'UNDERACCENT', operator_stretchy => 'true');
#======================================================================
# Section 4.9 Extensible arrows
@@ -916,7 +920,7 @@ DefMath('\underleftrightarrow{}', "\x{2194}", operator_role => 'UNDERACCENT');
# set up a general macro to support variations on xarrows macros (see mathtools)
# \lx@long@arrow{token}{arrow}[under]{over}
-DefConstructor('\lx@long@arrow DefToken {}[]{}',
+DefConstructor('\lx@long@arrow DefToken {} OptionalInScriptStyle InScriptStyle',
"?#3("
. ""
. "#3"
@@ -937,24 +941,36 @@ DefConstructor('\lx@long@arrow DefToken {}[]{}',
# specialize to ldots ???
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefMacro('\xrightarrow', '\lx@long@arrow{\xrightarrow}{\rightarrow}');
-DefMacro('\xleftarrow', '\lx@long@arrow{\xleftarrow}{\leftarrow}');
+DefMacro('\xrightarrow', '\lx@long@arrow{\xrightarrow}{\lx@stretchy@rightarrow}');
+DefMacro('\xleftarrow', '\lx@long@arrow{\xleftarrow}{\lx@stretchy@leftarrow}');
+
+DefMathI('\lx@stretchy@leftarrow', undef, "\x{2190}",
+ role => 'ARROW', stretchy => 'true', alias => '\leftarrow');
+DefMathI('\lx@stretchy@rightarrow', undef, "\x{2192}",
+ role => 'ARROW', stretchy => 'true', alias => '\rightarrow');
#======================================================================
# Section 4.10 Affixing symbols to other symbols
# Note that the 1st argument is treated set as an accent over (or under) the 2nd argument.
-DefConstructor('\overset{}{}',
+DefConstructor('\overset InScriptStyle {}',
""
. "#1"
. "#2"
. "");
-DefConstructor('\underset{}{}',
+DefConstructor('\underset InScriptStyle {}',
""
. "#1"
. "#2"
. "");
-
+DefConstructor('\overunderset InScriptStyle InScriptStyle {}',
+ ""
+ . "#1"
+ . ""
+ . "#2"
+ . "#3"
+ . ""
+ . "");
#======================================================================
# Section 4.11 Fractions and related commands
@@ -1189,7 +1205,7 @@ DefConstructor('\sideset{}{}{}', sub {
if (my $scriptop = IsScript($script)) {
$node = sidesetWrap($document, $node, 'pre', $$scriptop[1], $level, $script);
$level++ if $$scriptop[0] eq 'FLOATING'; # After node is seen!
- } }
+ } }
my @after = ();
foreach my $script ($post->unlist) {
# If it's a script, handle it (non-scripts dealt with above & below)
diff --git a/lib/LaTeXML/Package/mathtools.sty.ltxml b/lib/LaTeXML/Package/mathtools.sty.ltxml
index f13aba7e17..21186d8a1c 100644
--- a/lib/LaTeXML/Package/mathtools.sty.ltxml
+++ b/lib/LaTeXML/Package/mathtools.sty.ltxml
@@ -247,7 +247,7 @@ DefMacro('\noeqref{}', '');
## 3.3
-DefConstructor('\xleftrightarrow[]{}', # not centered anymore
+DefConstructor('\xleftrightarrow OptionalInScriptStyle InScriptStyle', # not centered anymore
"?#1("
. ""
. "#1"
@@ -259,12 +259,12 @@ DefConstructor('\xleftrightarrow[]{}', # not centered anymore
. ")("
. ""
. "#2"
- . "\x{2194}"
+ . "\x{2194}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xLeftarrow[]{}',
+DefConstructor('\xLeftarrow OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -276,12 +276,12 @@ DefConstructor('\xLeftarrow[]{}',
. ")("
. ""
. "#2"
- . "\x{21D0}"
+ . "\x{21D0}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xRightarrow[]{}',
+DefConstructor('\xRightarrow OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -293,12 +293,12 @@ DefConstructor('\xRightarrow[]{}',
. ")("
. ""
. "#2"
- . "\x{21D2}"
+ . "\x{21D2}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xLeftrightarrow[]{}', # looks stretched
+DefConstructor('\xLeftrightarrow OptionalInScriptStyle InScriptStyle', # looks stretched
"?#1("
. ""
. "#1"
@@ -310,12 +310,12 @@ DefConstructor('\xLeftrightarrow[]{}', # looks stretched
. ")("
. ""
. "#2"
- . "\x{21D4}"
+ . "\x{21D4}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xhookleftarrow[]{}',
+DefConstructor('\xhookleftarrow OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -327,12 +327,12 @@ DefConstructor('\xhookleftarrow[]{}',
. ")("
. ""
. "#2"
- . "\x{21A9}"
+ . "\x{21A9}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xhookrightarrow[]{}',
+DefConstructor('\xhookrightarrow OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -344,12 +344,12 @@ DefConstructor('\xhookrightarrow[]{}',
. ")("
. ""
. "#2"
- . "\x{21AA}"
+ . "\x{21AA}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xmapsto[]{}',
+DefConstructor('\xmapsto OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -361,12 +361,12 @@ DefConstructor('\xmapsto[]{}',
. ")("
. ""
. "#2"
- . "\x{21A6}"
+ . "\x{21A6}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xrightharpoondown[]{}',
+DefConstructor('\xrightharpoondown OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -383,7 +383,7 @@ DefConstructor('\xrightharpoondown[]{}',
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xrightharpoonup[]{}',
+DefConstructor('\xrightharpoonup OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -395,12 +395,12 @@ DefConstructor('\xrightharpoonup[]{}',
. ")("
. ""
. "#2"
- . "\x{21C0}"
+ . "\x{21C0}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xleftharpoondown[]{}',
+DefConstructor('\xleftharpoondown OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -412,12 +412,12 @@ DefConstructor('\xleftharpoondown[]{}',
. ")("
. ""
. "#2"
- . "\x{21BD}"
+ . "\x{21BD}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xleftharpoonup[]{}',
+DefConstructor('\xleftharpoonup OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -429,12 +429,12 @@ DefConstructor('\xleftharpoonup[]{}',
. ")("
. ""
. "#2"
- . "\x{21BC}"
+ . "\x{21BC}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xrightleftharpoons[]{}',
+DefConstructor('\xrightleftharpoons OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -446,12 +446,12 @@ DefConstructor('\xrightleftharpoons[]{}',
. ")("
. ""
. "#2"
- . "\x{21CC}"
+ . "\x{21CC}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
-DefConstructor('\xleftrightharpoons[]{}',
+DefConstructor('\xleftrightharpoons OptionalInScriptStyle InScriptStyle',
"?#1("
. ""
. "#1"
@@ -463,7 +463,7 @@ DefConstructor('\xleftrightharpoons[]{}',
. ")("
. ""
. "#2"
- . "\x{21CB}"
+ . "\x{21CB}"
. ""
. ")",
properties => { font => sub { LookupValue('font')->specialize("\x{2026}"); } });
diff --git a/lib/LaTeXML/Post/MathML.pm b/lib/LaTeXML/Post/MathML.pm
index ab37dedde9..67b71a3236 100644
--- a/lib/LaTeXML/Post/MathML.pm
+++ b/lib/LaTeXML/Post/MathML.pm
@@ -1492,7 +1492,7 @@ DefMathML('Apply:OVERACCENT:?', sub {
my ($xaccent, $xbase) = element_nodes($base);
if (($xaccent->getAttribute('role') || '') eq 'UNDERACCENT') {
return ['m:munderover', { accent => 'true', accentunder => 'true' },
- pmml($xbase), pmml_scriptsize($xaccent), pmml($accent)]; } }
+ pmml($xbase), pmml($xaccent), pmml($accent)]; } }
return ['m:mover', { accent => 'true' }, pmml($base), pmml($accent)]; });
DefMathML('Apply:UNDERACCENT:?', sub {
@@ -1501,7 +1501,7 @@ DefMathML('Apply:UNDERACCENT:?', sub {
my ($xaccent, $xbase) = element_nodes($base);
if (($xaccent->getAttribute('role') || '') eq 'OVERACCENT') {
return ['m:munderover', { accent => 'true', accentunder => 'true' },
- pmml($xbase), pmml_scriptsize($accent), pmml($xaccent)]; } }
+ pmml($xbase), pmml($accent), pmml($xaccent)]; } }
return ['m:munder', { accentunder => 'true' }, pmml($base), pmml($accent)]; });
DefMathML('Apply:ENCLOSE:?', sub {
diff --git a/t/ams/mathtools.xml b/t/ams/mathtools.xml
index aeb6d580f2..932421a9f4 100644
--- a/t/ams/mathtools.xml
+++ b/t/ams/mathtools.xml
@@ -1170,19 +1170,19 @@ Then a switch of tag forms.
- u
- n
- d
- e
- r
+ u
+ n
+ d
+ e
+ r
- o
- v
- e
- r
+ o
+ v
+ e
+ r
⇐
@@ -1191,19 +1191,19 @@ Then a switch of tag forms.
- u
- n
- d
- e
- r
+ u
+ n
+ d
+ e
+ r
- o
- v
- e
- r
+ o
+ v
+ e
+ r
⇒
@@ -1220,29 +1220,29 @@ Then a switch of tag forms.
- u
- n
- d
- e
- r
+ u
+ n
+ d
+ e
+ r
- o
- v
- e
- r
- l
- o
- o
- o
- o
- o
- o
- o
- n
- g
+ o
+ v
+ e
+ r
+ l
+ o
+ o
+ o
+ o
+ o
+ o
+ o
+ n
+ g
↔
@@ -1252,30 +1252,30 @@ Then a switch of tag forms.
- u
- n
- d
- e
- r
- l
- o
- o
- o
- o
- o
- o
- o
- o
- n
- g
+ u
+ n
+ d
+ e
+ r
+ l
+ o
+ o
+ o
+ o
+ o
+ o
+ o
+ o
+ n
+ g
- o
- v
- e
- r
+ o
+ v
+ e
+ r
⇔
@@ -1296,16 +1296,16 @@ Then a switch of tag forms.
- b
- a
- r
+ b
+ a
+ r
- f
- o
- o
+ f
+ o
+ o
↩
@@ -1314,25 +1314,25 @@ Then a switch of tag forms.
- b
- l
- u
- u
- u
- u
- u
- u
- u
- u
- u
- b
+ b
+ l
+ u
+ u
+ u
+ u
+ u
+ u
+ u
+ u
+ u
+ b
- b
- a
- z
+ b
+ a
+ z
↪
@@ -1341,16 +1341,16 @@ Then a switch of tag forms.
- h
- e
- e
- e
- r
- e
- e
- e
+ h
+ e
+ e
+ e
+ r
+ e
+ e
+ e
- ↦
+ ↦
k
@@ -1364,7 +1364,7 @@ Then a switch of tag forms.
k
- .
+ .
↼
@@ -1373,14 +1373,14 @@ Then a switch of tag forms.
l
- .
- .
+ .
+ .
- ↽
+ ↽
m
- …
+ …
⇁
@@ -1389,10 +1389,10 @@ Then a switch of tag forms.
n
- …
- .
+ …
+ .
- ⇀
+ ⇀
o
@@ -1408,30 +1408,30 @@ Then a switch of tag forms.
- b
- l
- u
- u
- u
- u
- u
- b
+ b
+ l
+ u
+ u
+ u
+ u
+ u
+ b
- ⇌
+ ⇌
y
- b
- l
- a
- a
- a
- a
- a
- a
- b
+ b
+ l
+ a
+ a
+ a
+ a
+ a
+ a
+ b
diff --git a/t/math/arrows.xml b/t/math/arrows.xml
index b7776bb55c..a4003ce1ef 100644
--- a/t/math/arrows.xml
+++ b/t/math/arrows.xml
@@ -12,11 +12,11 @@
→
- →
+ →
word
- ←
+ ←
word
@@ -31,11 +31,11 @@
←
- ↔
+ ↔
word
- ↔
+ ↔
word
@@ -55,13 +55,13 @@
2
- over
- →
+ over
+ →
b
- over
- ←
+ over
+ ←
c
@@ -77,18 +77,18 @@
a
- under
+ under
- over
- →
+ over
+ →
b
- under
+ under
- over
- ←
+ over
+ ←
c
@@ -105,12 +105,12 @@
a
- over
+ over
→
b
- under
+ under
←
c
diff --git a/t/math/sampler.xml b/t/math/sampler.xml
index 14672e81bc..8811c9d566 100644
--- a/t/math/sampler.xml
+++ b/t/math/sampler.xml
@@ -1317,7 +1317,7 @@ some as accents, and pre-scripts (m:multiscripts,
a
- def
+ def
→
b
@@ -1327,7 +1327,7 @@ some as accents, and pre-scripts (m:multiscripts,
a
- def
+ def
→
b
@@ -1347,7 +1347,7 @@ some as accents, and pre-scripts (m:multiscripts,
a
- →
+ →
def
b