[latex3-commits] [git/LaTeX3-latex3-latex2e] gh517: use implementation already in mathtools (753bb5e3)

Frank Mittelbach frank.mittelbach at latex-project.org
Sun Sep 4 11:25:17 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh517
Link       : https://github.com/latex3/latex2e/commit/753bb5e36a888642063325945ffe73601618fdf7

>---------------------------------------------------------------

commit 753bb5e36a888642063325945ffe73601618fdf7
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sun Sep 4 11:25:17 2022 +0200

    use implementation already in mathtools


>---------------------------------------------------------------

753bb5e36a888642063325945ffe73601618fdf7
 base/doc/ltnews36.tex                           | 35 +++++++++++++++++++++++++
 base/ltmath.dtx                                 | 12 ++++-----
 base/testfiles/github-0517.tlg                  |  4 +--
 base/testfiles/vlatex06-2015.luatex.tlg         |  8 +++---
 base/testfiles/vlatex06-2015.tlg                |  8 +++---
 base/testfiles/vtl2e06.luatex.tlg               |  8 +++---
 base/testfiles/vtl2e06.tlg                      |  8 +++---
 required/amsmath/testfiles/amsldoc-5.luatex.tlg | 10 +++----
 required/amsmath/testfiles/amsldoc-5.tlg        | 10 +++----
 required/amsmath/testfiles/amsldoc-5.xetex.tlg  | 10 +++----
 required/amsmath/testfiles/amsldoc-6.luatex.tlg |  4 +--
 required/amsmath/testfiles/amsldoc-6.tlg        |  4 +--
 12 files changed, 78 insertions(+), 43 deletions(-)

diff --git a/base/doc/ltnews36.tex b/base/doc/ltnews36.tex
index 20d10b47..19ca8e08 100644
--- a/base/doc/ltnews36.tex
+++ b/base/doc/ltnews36.tex
@@ -271,6 +271,41 @@ approach.
 \section{Bug fixes}
 
 
+
+\subsection{Prevent \TeX{} from loosing a \cs{smash}}
+
+When \TeX{} is typesetting a a fraction it will rebox the material in
+either numerator or the denumerator depending on which is wider. If
+the repackaged part consists of a single box that box gets new
+dimensions and if it was build using a \cs{smash} that effect vanishes
+(because a smash is nothing other than zeroing some box dimension,
+which not got undone). For example, in the line
+\begin{verbatim}
+\frac{1}{2} = \frac{1}{\smash{2^X}} 
+            \neq \frac{100}{\smash{2^X}} 
+\end{verbatim}
+the $2$ in the denominators was not always at the same vertical position, because
+the second \cs{smash} was ignored due to reboxing:
+\[
+\makeatletter
+\def\mathsm at sh#1#2{\setbox\z@\hbox{$\m at th#1{#2}$}\finsm at sh} % old definition
+\makeatother
+\newcommand*\drawbaseline{\rlap{\vrule width 60pt height 0.1pt depth 0pt }}
+\frac{1}{\drawbaseline2} = \frac{1}{\smash{2^X}}      \neq 
+\frac{100}{\smash{2^X}}
+\]
+The differences are subtle but noticeable. This is now corrected and the \cs{smash} is always
+honored, so you now get this output:
+\[
+\newcommand*\drawbaseline{\rlap{\vrule width 60pt height 0.1pt depth 0pt }}
+\frac{1}{\drawbaseline2} = \frac{1}{\smash{2^X}}      \neq 
+\frac{100}{\smash{2^X}}
+\]
+%
+\githubissue{517}
+
+
+
 \section{Changes to packages in the \pkg{amsmath} category}
 
 
diff --git a/base/ltmath.dtx b/base/ltmath.dtx
index ee43b07b..80bee25d 100644
--- a/base/ltmath.dtx
+++ b/base/ltmath.dtx
@@ -380,17 +380,17 @@
 \def\mathsm at sh#1#2{%
   \setbox\z@\hbox{$\m at th#1{#2}$}%
 %    \end{macrocode}
-%    The zero-sized kern just in front of the smashed box (which is
+%    The empty brace groups in front of the smashed box (which is
 %    placed by \cs{finsm at sh}) ensures that a \cs{smash} in math is not
-%    just producing a single box with its dimensions altered, but a
-%    box plus this kern. The reason is that \TeX{} sometimes reboxes a
+%    just producing a single box  with its dimensions altered, but a
+%    box plus this second ord atom. The reason is that \TeX{} sometimes reboxes a
 %    box if its the only thing in a place like the denominator of a
 %    fraction. This would then undo the smashing and the addiitonal
-%    kern prevents that.
+%    kern prevents that. Two ord atoms in a row do not alter the
+%    horizontal spacing in a formula so this is otherwise transparent. 
 % \changes{v1.2m}{2022/09/03}{Guard against reboxing in fractions (gh/517)}
 %    \begin{macrocode}
-  \kern\z@
-  \finsm at sh}
+  {}\finsm at sh}
 %    \end{macrocode}
 %    \begin{macrocode}
 %</2ekernel|latexrelease>
diff --git a/base/testfiles/github-0517.tlg b/base/testfiles/github-0517.tlg
index ba452ea1..4efc981e 100644
--- a/base/testfiles/github-0517.tlg
+++ b/base/testfiles/github-0517.tlg
@@ -70,7 +70,7 @@ Completed box being shipped out [1]
 .......\rule(0.39998+0.0)x*
 .......\kern9.15952
 .......\hbox(0.0+0.0)x12.60213
-........\kern 0.0
+........\hbox(0.0+0.0)x0.0
 ........\hbox(0.0+0.0)x12.60213
 .........\mathon
 .........\hbox(8.41226+0.0)x12.60213
@@ -137,7 +137,7 @@ Completed box being shipped out [1]
 .......\kern9.15952
 .......\hbox(0.0+0.0)x15.00005, glue set 1.19896fil
 ........\glue 0.0 plus 1.0fil minus 1.0fil
-........\kern 0.0
+........\hbox(0.0+0.0)x0.0
 ........\hbox(0.0+0.0)x12.60213
 .........\mathon
 .........\hbox(8.41226+0.0)x12.60213
diff --git a/base/testfiles/vlatex06-2015.luatex.tlg b/base/testfiles/vlatex06-2015.luatex.tlg
index 014691f8..94c694f4 100644
--- a/base/testfiles/vlatex06-2015.luatex.tlg
+++ b/base/testfiles/vlatex06-2015.luatex.tlg
@@ -365,7 +365,7 @@ Completed box being shipped out [1]
 ....\glue(\spaceskip) 5.4 plus 2.7 minus 1.79999
 ....\mathon
 ....\hbox(0.0+0.0)x11.20003, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x11.20003, direction TLT
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003, direction TLT
@@ -385,7 +385,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x-2.39996, direction TLT
 .....\kern-2.39996 (italic)
 ....\hbox(0.0+0.0)x11.20003, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x11.20003, direction TLT
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003, direction TLT
@@ -4170,7 +4170,7 @@ Completed box being shipped out [7]
 ....\glue(\spaceskip) 3.33333 plus 1.66666 minus 1.11111
 ....\mathon
 ....\hbox(0.0+0.0)x7.7778, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x7.7778, direction TLT
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -4190,7 +4190,7 @@ Completed box being shipped out [7]
 ....\hbox(0.0+0.0)x-1.66663, direction TLT
 .....\kern-1.66663 (italic)
 ....\hbox(0.0+0.0)x7.7778, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x7.7778, direction TLT
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778, direction TLT
diff --git a/base/testfiles/vlatex06-2015.tlg b/base/testfiles/vlatex06-2015.tlg
index 00949e83..636e0d1e 100644
--- a/base/testfiles/vlatex06-2015.tlg
+++ b/base/testfiles/vlatex06-2015.tlg
@@ -304,7 +304,7 @@ Completed box being shipped out [1]
 ....\glue 5.4 plus 2.7 minus 1.79999
 ....\mathon
 ....\hbox(0.0+0.0)x11.20003
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x11.20003
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003
@@ -324,7 +324,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x-2.39996
 .....\kern -2.39996
 ....\hbox(0.0+0.0)x11.20003
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x11.20003
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003
@@ -3675,7 +3675,7 @@ Completed box being shipped out [7]
 ....\glue 3.33333 plus 1.66666 minus 1.11111
 ....\mathon
 ....\hbox(0.0+0.0)x7.7778
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x7.7778
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778
@@ -3695,7 +3695,7 @@ Completed box being shipped out [7]
 ....\hbox(0.0+0.0)x-1.66663
 .....\kern -1.66663
 ....\hbox(0.0+0.0)x7.7778
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x7.7778
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778
diff --git a/base/testfiles/vtl2e06.luatex.tlg b/base/testfiles/vtl2e06.luatex.tlg
index 4ea965b9..46827ff8 100644
--- a/base/testfiles/vtl2e06.luatex.tlg
+++ b/base/testfiles/vtl2e06.luatex.tlg
@@ -363,7 +363,7 @@ Completed box being shipped out [1]
 ....\glue(\spaceskip) 5.4 plus 2.7 minus 1.79999
 ....\mathon
 ....\hbox(0.0+0.0)x11.20003, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x11.20003, direction TLT
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003, direction TLT
@@ -383,7 +383,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x-2.39996, direction TLT
 .....\kern-2.39996 (italic)
 ....\hbox(0.0+0.0)x11.20003, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x11.20003, direction TLT
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003, direction TLT
@@ -4124,7 +4124,7 @@ Completed box being shipped out [7]
 ....\glue(\spaceskip) 3.33333 plus 1.66666 minus 1.11111
 ....\mathon
 ....\hbox(0.0+0.0)x7.7778, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x7.7778, direction TLT
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -4144,7 +4144,7 @@ Completed box being shipped out [7]
 ....\hbox(0.0+0.0)x-1.66663, direction TLT
 .....\kern-1.66663 (italic)
 ....\hbox(0.0+0.0)x7.7778, direction TLT
-.....\kern0.0
+.....\hbox(0.0+0.0)x0.0, direction TLT
 .....\hbox(0.0+0.0)x7.7778, direction TLT
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778, direction TLT
diff --git a/base/testfiles/vtl2e06.tlg b/base/testfiles/vtl2e06.tlg
index 875df87c..db290937 100644
--- a/base/testfiles/vtl2e06.tlg
+++ b/base/testfiles/vtl2e06.tlg
@@ -302,7 +302,7 @@ Completed box being shipped out [1]
 ....\glue 5.4 plus 2.7 minus 1.79999
 ....\mathon
 ....\hbox(0.0+0.0)x11.20003
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x11.20003
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003
@@ -322,7 +322,7 @@ Completed box being shipped out [1]
 ....\hbox(0.0+0.0)x-2.39996
 .....\kern -2.39996
 ....\hbox(0.0+0.0)x11.20003
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x11.20003
 ......\mathon
 ......\hbox(8.4+1.2)x11.20003
@@ -3639,7 +3639,7 @@ Completed box being shipped out [7]
 ....\glue 3.33333 plus 1.66666 minus 1.11111
 ....\mathon
 ....\hbox(0.0+0.0)x7.7778
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x7.7778
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778
@@ -3659,7 +3659,7 @@ Completed box being shipped out [7]
 ....\hbox(0.0+0.0)x-1.66663
 .....\kern -1.66663
 ....\hbox(0.0+0.0)x7.7778
-.....\kern 0.0
+.....\hbox(0.0+0.0)x0.0
 .....\hbox(0.0+0.0)x7.7778
 ......\mathon
 ......\hbox(5.83333+0.83333)x7.7778
diff --git a/required/amsmath/testfiles/amsldoc-5.luatex.tlg b/required/amsmath/testfiles/amsldoc-5.luatex.tlg
index c91dc358..d57294ef 100644
--- a/required/amsmath/testfiles/amsldoc-5.luatex.tlg
+++ b/required/amsmath/testfiles/amsldoc-5.luatex.tlg
@@ -228,7 +228,7 @@ Completed box being shipped out [1]
 ..........\mathon
 ..........\kern-1.11108 (italic)
 ..........\hbox(0.0+0.0)x7.7778, direction TLT
-...........\kern0.0
+...........\hbox(0.0+0.0)x0.0, direction TLT
 ...........\hbox(0.0+0.0)x7.7778, direction TLT
 ............\mathon
 ............\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -238,7 +238,7 @@ Completed box being shipped out [1]
 ..........\mathoff
 ........\kern-3.8888 (italic)
 ........\hbox(0.0+0.0)x7.7778, direction TLT
-.........\kern0.0
+.........\hbox(0.0+0.0)x0.0, direction TLT
 .........\hbox(0.0+0.0)x7.7778, direction TLT
 ..........\mathon
 ..........\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -265,7 +265,7 @@ Completed box being shipped out [1]
 .......\hbox(3.66875+0.0)x30.63222, glue set 20.63199fill, direction TLT
 ........\mathon
 ........\hbox(0.0+0.0)x7.7778, direction TLT
-.........\kern0.0
+.........\hbox(0.0+0.0)x0.0, direction TLT
 .........\hbox(0.0+0.0)x7.7778, direction TLT
 ..........\mathon
 ..........\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -277,7 +277,7 @@ Completed box being shipped out [1]
 ..........\mathon
 ..........\kern-1.11108 (italic)
 ..........\hbox(0.0+0.0)x7.7778, direction TLT
-...........\kern0.0
+...........\hbox(0.0+0.0)x0.0, direction TLT
 ...........\hbox(0.0+0.0)x7.7778, direction TLT
 ............\mathon
 ............\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -858,7 +858,7 @@ Completed box being shipped out [1]
 ......\rule(0.39998+0.0)x*
 ......\kern2.89722 (font)
 ......\hbox(4.30554+0.0)x5.2616, direction TLT
-.......\kern0.0
+.......\hbox(0.0+0.0)x0.0, direction TLT
 .......\hbox(4.30554+0.0)x5.2616, direction TLT
 ........\mathon
 ........\OML/cmm/m/it/10 y
diff --git a/required/amsmath/testfiles/amsldoc-5.tlg b/required/amsmath/testfiles/amsldoc-5.tlg
index df02045a..458c25af 100644
--- a/required/amsmath/testfiles/amsldoc-5.tlg
+++ b/required/amsmath/testfiles/amsldoc-5.tlg
@@ -200,7 +200,7 @@ Completed box being shipped out [1]
 ..........\mathon
 ..........\kern -1.11108
 ..........\hbox(0.0+0.0)x7.7778
-...........\kern 0.0
+...........\hbox(0.0+0.0)x0.0
 ...........\hbox(0.0+0.0)x7.7778
 ............\mathon
 ............\hbox(5.83333+0.83333)x7.7778
@@ -210,7 +210,7 @@ Completed box being shipped out [1]
 ..........\mathoff
 ........\kern -3.8888
 ........\hbox(0.0+0.0)x7.7778
-.........\kern 0.0
+.........\hbox(0.0+0.0)x0.0
 .........\hbox(0.0+0.0)x7.7778
 ..........\mathon
 ..........\hbox(5.83333+0.83333)x7.7778
@@ -237,7 +237,7 @@ Completed box being shipped out [1]
 .......\hbox(3.66875+0.0)x30.63222, glue set 20.63199fill
 ........\mathon
 ........\hbox(0.0+0.0)x7.7778
-.........\kern 0.0
+.........\hbox(0.0+0.0)x0.0
 .........\hbox(0.0+0.0)x7.7778
 ..........\mathon
 ..........\hbox(5.83333+0.83333)x7.7778
@@ -249,7 +249,7 @@ Completed box being shipped out [1]
 ..........\mathon
 ..........\kern -1.11108
 ..........\hbox(0.0+0.0)x7.7778
-...........\kern 0.0
+...........\hbox(0.0+0.0)x0.0
 ...........\hbox(0.0+0.0)x7.7778
 ............\mathon
 ............\hbox(5.83333+0.83333)x7.7778
@@ -754,7 +754,7 @@ Completed box being shipped out [1]
 ......\rule(0.39998+0.0)x*
 ......\kern2.89722
 ......\hbox(4.30554+0.0)x5.2616
-.......\kern 0.0
+.......\hbox(0.0+0.0)x0.0
 .......\hbox(4.30554+0.0)x5.2616
 ........\mathon
 ........\OML/cmm/m/it/10 y
diff --git a/required/amsmath/testfiles/amsldoc-5.xetex.tlg b/required/amsmath/testfiles/amsldoc-5.xetex.tlg
index 9be3b498..225924b6 100644
--- a/required/amsmath/testfiles/amsldoc-5.xetex.tlg
+++ b/required/amsmath/testfiles/amsldoc-5.xetex.tlg
@@ -200,7 +200,7 @@ Completed box being shipped out [1]
 ..........\mathon
 ..........\kern -1.11108
 ..........\hbox(0.0+0.0)x7.7778
-...........\kern 0.0
+...........\hbox(0.0+0.0)x0.0
 ...........\hbox(0.0+0.0)x7.7778
 ............\mathon
 ............\hbox(5.83333+0.83333)x7.7778
@@ -210,7 +210,7 @@ Completed box being shipped out [1]
 ..........\mathoff
 ........\kern -3.8888
 ........\hbox(0.0+0.0)x7.7778
-.........\kern 0.0
+.........\hbox(0.0+0.0)x0.0
 .........\hbox(0.0+0.0)x7.7778
 ..........\mathon
 ..........\hbox(5.83333+0.83333)x7.7778
@@ -237,7 +237,7 @@ Completed box being shipped out [1]
 .......\hbox(3.66875+0.0)x30.63222, glue set 20.63199fill
 ........\mathon
 ........\hbox(0.0+0.0)x7.7778
-.........\kern 0.0
+.........\hbox(0.0+0.0)x0.0
 .........\hbox(0.0+0.0)x7.7778
 ..........\mathon
 ..........\hbox(5.83333+0.83333)x7.7778
@@ -249,7 +249,7 @@ Completed box being shipped out [1]
 ..........\mathon
 ..........\kern -1.11108
 ..........\hbox(0.0+0.0)x7.7778
-...........\kern 0.0
+...........\hbox(0.0+0.0)x0.0
 ...........\hbox(0.0+0.0)x7.7778
 ............\mathon
 ............\hbox(5.83333+0.83333)x7.7778
@@ -796,7 +796,7 @@ Completed box being shipped out [1]
 ......\rule(0.39998+0.0)x*
 ......\kern2.89722
 ......\hbox(4.30554+0.0)x5.2616
-.......\kern 0.0
+.......\hbox(0.0+0.0)x0.0
 .......\hbox(4.30554+0.0)x5.2616
 ........\mathon
 ........\OML/cmm/m/it/10 y
diff --git a/required/amsmath/testfiles/amsldoc-6.luatex.tlg b/required/amsmath/testfiles/amsldoc-6.luatex.tlg
index 7bda7dea..85c5dbdf 100644
--- a/required/amsmath/testfiles/amsldoc-6.luatex.tlg
+++ b/required/amsmath/testfiles/amsldoc-6.luatex.tlg
@@ -66,7 +66,7 @@ Completed box being shipped out [1]
 ..........\hbox(3.66875+0.0)x30.0, glue set 19.99977fill, direction TLT
 ...........\mathon
 ...........\hbox(0.0+0.0)x7.7778, direction TLT
-............\kern0.0
+............\hbox(0.0+0.0)x0.0, direction TLT
 ............\hbox(0.0+0.0)x7.7778, direction TLT
 .............\mathon
 .............\hbox(5.83333+0.83333)x7.7778, direction TLT
@@ -78,7 +78,7 @@ Completed box being shipped out [1]
 .............\mathon
 .............\kern-1.11108 (italic)
 .............\hbox(0.0+0.0)x7.7778, direction TLT
-..............\kern0.0
+..............\hbox(0.0+0.0)x0.0, direction TLT
 ..............\hbox(0.0+0.0)x7.7778, direction TLT
 ...............\mathon
 ...............\hbox(5.83333+0.83333)x7.7778, direction TLT
diff --git a/required/amsmath/testfiles/amsldoc-6.tlg b/required/amsmath/testfiles/amsldoc-6.tlg
index b899f683..560a71d4 100644
--- a/required/amsmath/testfiles/amsldoc-6.tlg
+++ b/required/amsmath/testfiles/amsldoc-6.tlg
@@ -61,7 +61,7 @@ Completed box being shipped out [1]
 ..........\hbox(3.66875+0.0)x30.0, glue set 19.99977fill
 ...........\mathon
 ...........\hbox(0.0+0.0)x7.7778
-............\kern 0.0
+............\hbox(0.0+0.0)x0.0
 ............\hbox(0.0+0.0)x7.7778
 .............\mathon
 .............\hbox(5.83333+0.83333)x7.7778
@@ -73,7 +73,7 @@ Completed box being shipped out [1]
 .............\mathon
 .............\kern -1.11108
 .............\hbox(0.0+0.0)x7.7778
-..............\kern 0.0
+..............\hbox(0.0+0.0)x0.0
 ..............\hbox(0.0+0.0)x7.7778
 ...............\mathon
 ...............\hbox(5.83333+0.83333)x7.7778





More information about the latex3-commits mailing list.