From 489e0abf8c00d556b32c792893d748d1f9b48b46 Mon Sep 17 00:00:00 2001
From: Bruce Miller
Date: Wed, 11 Dec 2024 23:34:44 -0500
Subject: [PATCH] Update various wide math accents to get stretchy=yes;
slightly more plausible definitions of \hrulefill, etc; update affected tests
---
lib/LaTeXML/Engine/TeX_Math.pool.ltxml | 32 +++++++++++++++++++-------
lib/LaTeXML/Engine/plain.pool.ltxml | 17 +++++++-------
t/ams/mathtools.xml | 4 ++--
t/complex/physics.xml | 8 +++----
t/fonts/abxtest.xml | 12 +++++-----
t/fonts/mathaccents.xml | 22 +++++++++---------
t/math/sampler.xml | 4 ++--
7 files changed, 58 insertions(+), 41 deletions(-)
diff --git a/lib/LaTeXML/Engine/TeX_Math.pool.ltxml b/lib/LaTeXML/Engine/TeX_Math.pool.ltxml
index d850d9d16..21d814086 100644
--- a/lib/LaTeXML/Engine/TeX_Math.pool.ltxml
+++ b/lib/LaTeXML/Engine/TeX_Math.pool.ltxml
@@ -908,18 +908,34 @@ Let('\vcenter', '\vbox');
# \overline c puts a line over the following character or subformula.
# \underline c puts a line under the following character or subformula.
-DefMath('\lx@math@overline{}', UTF(0xAF), operator_role => 'OVERACCENT',
- name => 'overline', alias => '\overline');
+DefMath('\lx@math@overline{}', UTF(0xAF),
+ operator_role => 'OVERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'overline', alias => '\overline');
DefConstructor('\lx@text@overline{}',
"#1");
-DefMath('\lx@math@underline{}', UTF(0xAF), operator_role => 'UNDERACCENT',
- name => 'underline', alias => '\underline');
+DefMath('\lx@math@underline{}', UTF(0xAF),
+ operator_role => 'UNDERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'underline', alias => '\underline');
DefConstructor('\lx@text@underline{}',
"#1");
-DefMath('\lx@math@overrightarrow{}', "\x{2192}", operator_role => 'OVERACCENT',
- name => 'overrightarrow', alias => '\overrightarrow');
-DefMath('\lx@math@overleftarrow{}', "\x{2190}", operator_role => 'OVERACCENT',
- name => 'overleftarrow', alias => '\overleftarrow');
+DefMath('\lx@math@overrightarrow{}', "\x{2192}",
+ operator_role => 'OVERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'overrightarrow', alias => '\overrightarrow');
+DefMath('\lx@math@overleftarrow{}', "\x{2190}",
+ operator_role => 'OVERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'overleftarrow', alias => '\overleftarrow');
+DefMath('\lx@math@underrightarrow{}', "\x{2192}",
+ operator_role => 'UNDERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'underrightarrow', alias => '\underrightarrow');
+DefMath('\lx@math@underleftarrow{}', "\x{2190}",
+ operator_role => 'UNDERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'underleftarrow', alias => '\underleftarrow');
+DefMath('\lx@math@overbrace{}', "\x{23DE}",
+ operator_role => 'OVERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'overbrace', alias => '\overbrace', robust => 1);
+DefMath('\lx@math@underbrace{}', "\x{23DF}",
+ operator_role => 'UNDERACCENT', scriptpos => 'mid', operator_stretchy => 'true',
+ name => 'underbrace', alias => '\underbrace', robust => 1);
# Careful: Use \protect so that it doesn't expand too early in alignments, etc.
# [Really shouldn't use \protect, since this is a TeX primitive and \protect is LaTeX]
diff --git a/lib/LaTeXML/Engine/plain.pool.ltxml b/lib/LaTeXML/Engine/plain.pool.ltxml
index 2473d9aef..45b52279a 100644
--- a/lib/LaTeXML/Engine/plain.pool.ltxml
+++ b/lib/LaTeXML/Engine/plain.pool.ltxml
@@ -736,9 +736,12 @@ DefConstructor('\@math@baccent {}',
DefMathI('\to', undef, "\x{2192}", role => 'ARROW'); # RIGHTWARDS ARROW??? a bit more explicitly relation-like?
-foreach my $op ('\hrulefill', '\dotfill', '\rightarrowfill', '\leftarrowfill',
- '\upbracefill', '\downbracefill') {
- DefPrimitiveI($op, undef, undef); }
+DefMacro('\hrulefill', '\leaders\hrule\hfill');
+DefMacro('\dotfill', '\leaders\hbox{.}\hfill'); # Not exactly, but...
+DefMath('\leftarrowfill', "\x{2190}", role => 'ARROW', stretchy => 'true');
+DefMath('\rightarrowfill', "\x{2192}", role => 'ARROW', stretchy => 'true');
+DefMath('\upbracefill', "\x{23DF}", role => 'ARROW', stretchy => 'true'); # for \underbrace
+DefMath('\downbracefill', "\x{23DE}", role => 'ARROW', stretchy => 'true'); # for \overbrace
Let('\sp', T_SUPER);
Let('\sb', T_SUB);
@@ -1218,11 +1221,9 @@ DefMath('\dot Digested', "\x{02D9}", operator_role => 'OVERACCENT'); # DOT
DefMath('\ddot Digested', UTF(0xA8), operator_role => 'OVERACCENT'); # DIAERESIS
DefMath('\widehat Digested', UTF(0x5E), operator_role => 'OVERACCENT'); # CIRCUMFLEX ACCENT [plain? also amsfonts]
DefMath('\widetilde Digested', UTF(0x7E), operator_role => 'OVERACCENT'); # TILDE [plain? also amsfonts]
-# These aren't handled as simple accents by TeX, so no Digested
-DefMath('\overbrace {}', "\x{23DE}", operator_role => 'OVERACCENT', # TOP CURLY BRACKET
- scriptpos => 'mid', robust => 1);
-DefMath('\underbrace {}', "\x{23DF}", operator_role => 'UNDERACCENT', # BOTTOM CURLY BRACKET
- scriptpos => 'mid', robust => 1);
+
+Let('\overbrace', '\lx@math@overbrace');
+Let('\underbrace', '\lx@math@underbrace');
# NOTE that all the above accents REQUIRE math mode
# EXCEPT underline, overrightarrow and overleftarrow!
diff --git a/t/ams/mathtools.xml b/t/ams/mathtools.xml
index 7173f2336..0d49e03bf 100644
--- a/t/ams/mathtools.xml
+++ b/t/ams/mathtools.xml
@@ -1461,7 +1461,7 @@ Then a switch of tag forms.
- ⏞
+ ⏞
+
@@ -1492,7 +1492,7 @@ Then a switch of tag forms.
- ⏟
+ ⏟
+
1
diff --git a/t/complex/physics.xml b/t/complex/physics.xml
index d9b74f3d7..34a9174e0 100644
--- a/t/complex/physics.xml
+++ b/t/complex/physics.xml
@@ -661,13 +661,13 @@
a
-
- →
+
+ →
a
-
- →
+
+ →
a
diff --git a/t/fonts/abxtest.xml b/t/fonts/abxtest.xml
index f91b019a5..3046acd62 100644
--- a/t/fonts/abxtest.xml
+++ b/t/fonts/abxtest.xml
@@ -4696,7 +4696,7 @@
|