[latex3-commits] [git/LaTeX3-latex3-latex2e] gh716: make \shoveleft and \shoveright robust along the way (long term goal #123) (b9cdc824)

Frank Mittelbach frank.mittelbach at latex-project.org
Thu Feb 3 19:34:14 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh716
Link       : https://github.com/latex3/latex2e/commit/b9cdc824e4611108f16cd365a308169ff1b61911

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

commit b9cdc824e4611108f16cd365a308169ff1b61911
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Thu Feb 3 19:34:14 2022 +0100

    make \shoveleft and \shoveright robust along the way (long term goal #123)


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

b9cdc824e4611108f16cd365a308169ff1b61911
 required/amsmath/amsmath.dtx                                | 13 ++++++++-----
 required/amsmath/changes.txt                                |  1 +
 required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg |  4 ++--
 required/amsmath/testfiles/github-amsrobust-0123.tlg        |  4 ++--
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/required/amsmath/amsmath.dtx b/required/amsmath/amsmath.dtx
index 318fcdd9..52509f95 100644
--- a/required/amsmath/amsmath.dtx
+++ b/required/amsmath/amsmath.dtx
@@ -6130,15 +6130,16 @@ Cannot use `split' here;\MessageBreak trying to recover with `aligned'}%
 %    in his \fn{amstex.doc} Spivak indicates those commands should never
 %    be used on a first or last line. Perhaps better to leave the
 %    question open unless/until real-life examples turn up.
+% \changes{v2.17m}{2022/02/03}{Make \cs{shoveright} robust (if def is not trival)}
 %    \begin{macrocode}
 \iftagsleft@
-    \def\shoveright#1{%
+    \protected\def\shoveright#1{%
         #1%
         \hfilneg
         \hskip\multlinegap
     }
 \else
-    \def\shoveright#1{%
+    \protected\def\shoveright#1{%
         #1%
         \hfilneg
         \iftag@
@@ -6153,12 +6154,14 @@ Cannot use `split' here;\MessageBreak trying to recover with `aligned'}%
         \fi
     }
 \fi
-
+%    \end{macrocode}
+% \changes{v2.17m}{2022/02/03}{Make \cs{shoveleft} robust (if def is not trival)}
+%    \begin{macrocode}
 \if at fleqn
     \def\shoveleft#1{#1}%
 \else
     \iftagsleft@
-        \def\shoveleft#1{%
+        \protected\def\shoveleft#1{%
             \setboxz at h{$\m at th\displaystyle{}#1$}%
             \setbox\@ne\hbox{$\m at th\displaystyle#1$}%
             \hfilneg
@@ -6180,7 +6183,7 @@ Cannot use `split' here;\MessageBreak trying to recover with `aligned'}%
             #1%
         }
     \else
-        \def\shoveleft#1{%
+        \protected\def\shoveleft#1{%
             \setboxz at h{$\m at th\displaystyle{}#1$}%
             \setbox\@ne\hbox{$\m at th\displaystyle#1$}%
             \hfilneg
diff --git a/required/amsmath/changes.txt b/required/amsmath/changes.txt
index 0d3ed94a..95e291d7 100644
--- a/required/amsmath/changes.txt
+++ b/required/amsmath/changes.txt
@@ -2,6 +2,7 @@
 
 	* amsmath.dtx (subsection{The \env{multline} environment}):
 	Added missing \relax for (gh/716)
+	Also make \shoveleft and \shoveright robust (part of gh/123)
 
 2022-01-20  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
diff --git a/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg b/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg
index 4f382f60..5151cef5 100644
--- a/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg
+++ b/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg
@@ -680,9 +680,9 @@ Don't change this file in any respect.
 ---------------------------------------
 \setcounter -> \GenericError {               }{LaTeX Error: No counter 'foo' defined}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}{baz}
 ---------------------------------------
-\shoveleft -> \setbox \z@ \hbox {$\mathsurround \z@ \displaystyle {}foo$}\setbox \@ne \hbox {$\mathsurround \z@ \displaystyle foo$}\hfilneg \hskip \multlinegap \hskip .5\wd \@ne \hskip -.5\wd \z@ foo{bar}{baz}
+\shoveleft -> \shoveleft {foo}{bar}{baz}
 ---------------------------------------
-\shoveright -> foo\hfilneg \hskip \multlinegap {bar}{baz}
+\shoveright -> \shoveright {foo}{bar}{baz}
 ---------------------------------------
 \sideset -> \setbox \z@ \hbox {\mathsurround \z@ $\displaystyle baz$}\global \setbox \@ne \vbox to\ht \z@ {}\dp \@ne \dp \z@ \setbox \tw@ \box \@ne \setbox 4\hbox {\mathsurround \z@ $\displaystyle \copy \tw@ foo$}\setbox 6\hbox {\mathsurround \z@ $\displaystyle baz\nolimits bar$}\dimen@ -\wd 6 \advance \dimen@ \wd 4 \advance \dimen@ \wd \z@ \hbox to\dimen@ {}\mathop {\kern -\dimen@ \box 4\box 6}
 ---------------------------------------
diff --git a/required/amsmath/testfiles/github-amsrobust-0123.tlg b/required/amsmath/testfiles/github-amsrobust-0123.tlg
index 4f382f60..5151cef5 100644
--- a/required/amsmath/testfiles/github-amsrobust-0123.tlg
+++ b/required/amsmath/testfiles/github-amsrobust-0123.tlg
@@ -680,9 +680,9 @@ Don't change this file in any respect.
 ---------------------------------------
 \setcounter -> \GenericError {               }{LaTeX Error: No counter 'foo' defined}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}{baz}
 ---------------------------------------
-\shoveleft -> \setbox \z@ \hbox {$\mathsurround \z@ \displaystyle {}foo$}\setbox \@ne \hbox {$\mathsurround \z@ \displaystyle foo$}\hfilneg \hskip \multlinegap \hskip .5\wd \@ne \hskip -.5\wd \z@ foo{bar}{baz}
+\shoveleft -> \shoveleft {foo}{bar}{baz}
 ---------------------------------------
-\shoveright -> foo\hfilneg \hskip \multlinegap {bar}{baz}
+\shoveright -> \shoveright {foo}{bar}{baz}
 ---------------------------------------
 \sideset -> \setbox \z@ \hbox {\mathsurround \z@ $\displaystyle baz$}\global \setbox \@ne \vbox to\ht \z@ {}\dp \@ne \dp \z@ \setbox \tw@ \box \@ne \setbox 4\hbox {\mathsurround \z@ $\displaystyle \copy \tw@ foo$}\setbox 6\hbox {\mathsurround \z@ $\displaystyle baz\nolimits bar$}\dimen@ -\wd 6 \advance \dimen@ \wd 4 \advance \dimen@ \wd \z@ \hbox to\dimen@ {}\mathop {\kern -\dimen@ \box 4\box 6}
 ---------------------------------------





More information about the latex3-commits mailing list.