[latex3-commits] [git/LaTeX3-latex3-latex2e] robust-ams: more robustness (0786d5cf)
Frank Mittelbach
frank.mittelbach at latex-project.org
Thu Apr 7 23:52:35 CEST 2022
Repository : https://github.com/latex3/latex2e
On branch : robust-ams
Link : https://github.com/latex3/latex2e/commit/0786d5cf3ae83398fc86c6824ae619bf58f1043c
>---------------------------------------------------------------
commit 0786d5cf3ae83398fc86c6824ae619bf58f1043c
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Thu Apr 7 23:52:35 2022 +0200
more robustness
>---------------------------------------------------------------
0786d5cf3ae83398fc86c6824ae619bf58f1043c
required/amsmath/amsmath.dtx | 36 +++++++++++++++++++---
.../testfiles/github-amsrobust-0123.luatex.tlg | 6 ++--
.../amsmath/testfiles/github-amsrobust-0123.tlg | 6 ++--
required/amsmath/testfiles/tlb-amsmath-load.tlg | 1 +
required/amsmath/testfiles/tlb-utex-001.tlg | 1 +
5 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/required/amsmath/amsmath.dtx b/required/amsmath/amsmath.dtx
index 858c355c..35dbca7d 100644
--- a/required/amsmath/amsmath.dtx
+++ b/required/amsmath/amsmath.dtx
@@ -86,7 +86,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesPackage{amsmath}[2022/02/03 v2.17m AMS math features]
+\ProvidesPackage{amsmath}[2022/04/08 v2.17n AMS math features]
% \end{macrocode}
%
% \section{Catcode defenses}
@@ -615,7 +615,8 @@ Foreign command \@backslashchar#1;\MessageBreak
% abbreviations for some commonly needed mathstyle overrides. To
% conserve csnames we avoid making \cn{dfrac} and \cn{tfrac} robust
% (\cn{genfrac} is itself robust).
-% \changes{v2.17i}{2020/09/23}{added \cs{Ustack} for luatex (moved patch from lualatex-math)}
+% \changes{v2.17i}{2020/09/23}{added \cs{Ustack} for luatex (moved patch from lualatex-math)}
+% \changes{v2.17n}{2022/04/08}{Make fraction commands robust (gh/123)}
% \begin{macrocode}
%
\ifx\directlua\@undefined
@@ -632,6 +633,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% like \cn{binom}, and so the \cs{z@} with the potentially
% problematic \qc{\@} character would become visible when writing one
% of those commands to a \fn{.toc} file.
+% \changes{v2.17n}{2022/04/08}{Make binom commands robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\binom}{\genfrac()\z@{}}
\DeclareRobustCommand{\dbinom}{\genfrac(){0pt}0}
@@ -938,6 +940,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% an equation or piece of an equation. (Not including the equation
% number.) This isn't trivial for end-users to do it properly
% with \cs{fbox} so we provide a command for them.
+% \changes{v2.17n}{2022/04/08}{Make \cs{boxed} command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\boxed}[1]{\fbox{\m at th$\displaystyle#1$}}
% \end{macrocode}
@@ -980,6 +983,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% small space on the left, larger space on the right. The \qc{\:}
% character by itself is treated as a \cs{mathrel} i.e. large, equal
% spacing on both sides.
+% \changes{v2.17n}{2022/04/08}{Make \cs{colon} command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
\mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
@@ -1403,6 +1407,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% the left-hand space a bit to make the subscript visually centered.
%
% \verb'#1' is the multiplicity.
+% \changes{v2.17n}{2022/04/08}{Make \cs{MultiIntegral} command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\MultiIntegral}[1]{%
\edef\ints at c{\noexpand\intop
@@ -1582,6 +1587,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% the \latex/ kernel; the macro |\n at space| is then superfluous (since
% it is only used once) and should be removed to avoid wasting hash
% table space unnecessarily.
+% \changes{v2.17n}{2022/04/08}{Make biggg commands robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\big}{\bBigg@\@ne}
\DeclareRobustCommand{\Big}{\bBigg@{1.5}}
@@ -1667,6 +1673,10 @@ Foreign command \@backslashchar#1;\MessageBreak
\hbox{\,\normalfont....}\vss}}}}
% \end{macrocode}
%
+% We make the commands robust only at then end of the preamble as
+% \pkg{amsmath} interacts with \pkg{stix} (which should also move
+% to robust commands).
+% \changes{v2.17n}{2022/04/08}{Make dddot commands robust (gh/123)}
% \begin{macrocode}
\AtBeginDocument{%
\MakeRobust\dddot
@@ -2094,6 +2104,8 @@ Foreign command \@backslashchar#1;\MessageBreak
% \begin{macro}{\mod}
% The commands \cn{bmod}, \cn{pmod}, \cn{pod}, \cn{mod} aren't
% currently robust. [mjd, 1994/09/05]
+% Now they are
+% \changes{v2.17n}{2022/04/08}{Make mod commands robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
{\operator at font mod}\penalty900
@@ -2116,6 +2128,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% fraction rules to line up. The \cs{strut} keeps the numerator of
% a subsidiary cfrac from coming too close to the fraction rule above
% it.
+% \changes{v2.17n}{2022/04/08}{Make \cs{cfrac} command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\cfrac}[3][c]{{\displaystyle\frac{%
\strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}{#3}}%
@@ -2130,6 +2143,8 @@ Foreign command \@backslashchar#1;\MessageBreak
% naturally accept limits. \cs{binrel@@} uses information collected
% by \cs{binrel@} to make the resulting construction be of type
% mathrel or mathbin if the base symbol is either of those types.
+% \changes{v2.17n}{2022/04/08}{Make \cs{overset}, \cs{underset} and
+% \cs{overunderset} commands robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\overset}[2]{\binrel@{#2}%
\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
@@ -2164,6 +2179,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% have to read and measure the top and bottom limits and use
% mathchoice to always get the right mathstyle for each piece,
% etc., etc.
+% \changes{v2.17n}{2022/04/08}{Make \cs{sideset} command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\sideset}[3]{%
\@mathmeasure\z@\displaystyle{#3}%
@@ -2189,9 +2205,10 @@ Foreign command \@backslashchar#1;\MessageBreak
% denoting the part of the formula to be smashed.
% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{smash}
% if necessary (github/49)}
+% \changes{v2.17n}{2022/04/08}{Make \cs{smash} command robust (gh/123)}
% \begin{macrocode}
\ifx\leavevmode at ifvmode\@undefined
-\renewcommand{\smash}[1][tb]{%
+\DeclareRobustCommand{\smash}[1][tb]{%
\def\mb at t{\ht}\def\mb at b{\dp}\def\mb at tb{\ht\z@\z@\dp}%
\edef\finsm at sh{\csname mb@#1\endcsname\z@\z@\box\z@}%
\ifmmode \@xp\mathpalette\@xp\mathsm at sh
@@ -2199,7 +2216,7 @@ Foreign command \@backslashchar#1;\MessageBreak
\fi
}
\else
-\renewcommand{\smash}[1][tb]{%
+\DeclareRobustCommand{\smash}[1][tb]{%
\def\mb at t{\ht}\def\mb at b{\dp}\def\mb at tb{\ht\z@\z@\dp}%
\edef\finsm at sh{\csname mb@#1\endcsname\z@\z@ \leavevmode at ifvmode\box\z@}%
\ifmmode \@xp\mathpalette\@xp\mathsm at sh
@@ -2247,6 +2264,7 @@ Foreign command \@backslashchar#1;\MessageBreak
%
% \begin{macro}{\relbar}
% \begin{macro}{\Relbar}
+% \changes{v2.17n}{2022/04/08}{Make commands robust (gh/123)}
% \begin{macrocode}
\ams at DeclareRobustCommand\relbar{\mathrel{\mathpalette\mathsm at sh\std at minus}}
\ams at DeclareRobustCommand\Relbar{\mathrel\std at equal}
@@ -2279,7 +2297,8 @@ Foreign command \@backslashchar#1;\MessageBreak
\ams at newcommand{\overleftrightarrow}{%
\mathpalette{\overarrow@\leftrightarrowfill@}}
% \end{macrocode}
-%
+% Again we delay making commands robut for \pkg{stix}.
+% \changes{v2.17n}{2022/04/08}{Make commands robust (gh/123)}
% \begin{macrocode}
\AtBeginDocument{%
\expandafter\let\csname overleftarrow \endcsname\@undefined
@@ -2303,6 +2322,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% \end{macrocode}
%
%
+% \changes{v2.17n}{2022/04/08}{Make commands robust (gh/123)}
% \begin{macrocode}
\AtBeginDocument{%
\MakeRobust\underrightarrow
@@ -2311,6 +2331,7 @@ Foreign command \@backslashchar#1;\MessageBreak
}
% \end{macrocode}
%
+% \changes{v2.17n}{2022/04/08}{Make commands robust (gh/123)}
% \begin{macrocode}
%\DeclareRobustCommand{\xrightarrow}[2][]{\ext at arrow 0359\rightarrowfill@{#1}{#2}}
\def\ext at arrow#1#2#3#4#5#6#7{%
@@ -2432,6 +2453,7 @@ Foreign command \@backslashchar#1;\MessageBreak
% \begin{macro}{\substack}
% The \cn{substack} command is just an abbreviation for the
% most common use of \env{subarray}.
+% \changes{v2.17n}{2022/04/08}{Make command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\substack}[1]{\subarray{c}#1\endsubarray}
% \end{macrocode}
@@ -2656,6 +2678,7 @@ ill-advised in LaTeX.%
% numbered within sections. The \LaTeX{} kernel contains a similar command
% \cs{counterwithin} (with a slightly extended syntax) that can be used
% as a drop-in replacement for \cs{numberwithin}.
+% \changes{v2.17n}{2022/04/08}{Make command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\numberwithin}[3][\arabic]{%
\@ifundefined{c@#2}{\@nocounterr{#2}}{%
@@ -2671,6 +2694,7 @@ ill-advised in LaTeX.%
% To make references to equation numbers easier, we provide
% \cn{eqref}. We almost don't need \cn{textup}, except that
% \cs{tagform@} doesn't supply the italic correction.
+% \changes{v2.17n}{2022/04/08}{Make command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}}
% \end{macrocode}
@@ -2711,6 +2735,7 @@ ill-advised in LaTeX.%
% The \cn{allowdisplaybreaks} command. Since this is intended for use
% outside displayed formulas (typically in the preamble), it does not
% need to use \cs{new at ifnextchar}.
+% \changes{v2.17n}{2022/04/08}{Make command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\allowdisplaybreaks}[1][4]{%
\interdisplaylinepenalty\getdsp at pen{#1}\relax
@@ -2735,6 +2760,7 @@ ill-advised in LaTeX.%
% \begin{macro}{\dspbrk at context}
% \begin{macro}{\nogood at displaybreak}
% For breaks in a certain row of a alignment.
+% \changes{v2.17n}{2022/04/08}{Make command robust (gh/123)}
% \begin{macrocode}
\DeclareRobustCommand{\displaybreak}{\new at ifnextchar[\dspbrk@{\dspbrk@[4]}}
\chardef\dspbrk at context=\sixt@@n
diff --git a/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg b/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg
index 73395218..63474b1c 100644
--- a/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg
+++ b/required/amsmath/testfiles/github-amsrobust-0123.luatex.tlg
@@ -694,13 +694,13 @@ Don't change this file in any respect.
---------------------------------------
\skewchar -> \skewchar {foo}{bar}{baz}
---------------------------------------
-\smash -> \smash{foo}{bar}{baz}
+\smash -> \smash {foo}{bar}{baz}
---------------------------------------
\space -> {foo}{bar}{baz}
---------------------------------------
\span -> \span {foo}{bar}{baz}
---------------------------------------
-\spbreve -> ^{\!\smash[b]{\hbox {\lower 4\ex@ \hbox {\u {}}}}}{foo}{bar}{baz}
+\spbreve -> ^{\!\smash [b]{\hbox {\lower 4\ex@ \hbox {\u {}}}}}{foo}{bar}{baz}
---------------------------------------
\spcheck -> ^\vee {foo}{bar}{baz}
---------------------------------------
@@ -710,7 +710,7 @@ Don't change this file in any respect.
---------------------------------------
\spdot -> ^{\hbox {\raise \ex@ \hbox {\normalfont .}}}{foo}{bar}{baz}
---------------------------------------
-\sphat -> ^{\mathchoice {}{}{\,\,\smash[b]{\hbox {\lower 4\ex@ \hbox {$\mathsurround \z@ \widehat {\hbox {}}$}}}}{\,\smash[b]{\hbox {\lower 3\ex@ \hbox {$\mathsurround \z@ \hat {\hbox {}}$}}}}}{foo}{bar}{baz}
+\sphat -> ^{\mathchoice {}{}{\,\,\smash [b]{\hbox {\lower 4\ex@ \hbox {$\mathsurround \z@ \widehat {\hbox {}}$}}}}{\,\smash [b]{\hbox {\lower 3\ex@ \hbox {$\mathsurround \z@ \hat {\hbox {}}$}}}}}{foo}{bar}{baz}
---------------------------------------
\sptilde -> ^\sim {foo}{bar}{baz}
---------------------------------------
diff --git a/required/amsmath/testfiles/github-amsrobust-0123.tlg b/required/amsmath/testfiles/github-amsrobust-0123.tlg
index 73395218..63474b1c 100644
--- a/required/amsmath/testfiles/github-amsrobust-0123.tlg
+++ b/required/amsmath/testfiles/github-amsrobust-0123.tlg
@@ -694,13 +694,13 @@ Don't change this file in any respect.
---------------------------------------
\skewchar -> \skewchar {foo}{bar}{baz}
---------------------------------------
-\smash -> \smash{foo}{bar}{baz}
+\smash -> \smash {foo}{bar}{baz}
---------------------------------------
\space -> {foo}{bar}{baz}
---------------------------------------
\span -> \span {foo}{bar}{baz}
---------------------------------------
-\spbreve -> ^{\!\smash[b]{\hbox {\lower 4\ex@ \hbox {\u {}}}}}{foo}{bar}{baz}
+\spbreve -> ^{\!\smash [b]{\hbox {\lower 4\ex@ \hbox {\u {}}}}}{foo}{bar}{baz}
---------------------------------------
\spcheck -> ^\vee {foo}{bar}{baz}
---------------------------------------
@@ -710,7 +710,7 @@ Don't change this file in any respect.
---------------------------------------
\spdot -> ^{\hbox {\raise \ex@ \hbox {\normalfont .}}}{foo}{bar}{baz}
---------------------------------------
-\sphat -> ^{\mathchoice {}{}{\,\,\smash[b]{\hbox {\lower 4\ex@ \hbox {$\mathsurround \z@ \widehat {\hbox {}}$}}}}{\,\smash[b]{\hbox {\lower 3\ex@ \hbox {$\mathsurround \z@ \hat {\hbox {}}$}}}}}{foo}{bar}{baz}
+\sphat -> ^{\mathchoice {}{}{\,\,\smash [b]{\hbox {\lower 4\ex@ \hbox {$\mathsurround \z@ \widehat {\hbox {}}$}}}}{\,\smash [b]{\hbox {\lower 3\ex@ \hbox {$\mathsurround \z@ \hat {\hbox {}}$}}}}}{foo}{bar}{baz}
---------------------------------------
\sptilde -> ^\sim {foo}{bar}{baz}
---------------------------------------
diff --git a/required/amsmath/testfiles/tlb-amsmath-load.tlg b/required/amsmath/testfiles/tlb-amsmath-load.tlg
index 19f35e64..0e0cd61d 100644
--- a/required/amsmath/testfiles/tlb-amsmath-load.tlg
+++ b/required/amsmath/testfiles/tlb-amsmath-load.tlg
@@ -39,6 +39,7 @@ LaTeX Font Info: Redeclaring font encoding OMS on input line ....
\macc at depth=\count...
LaTeX Info: Redefining \bmod on input line ....
LaTeX Info: Redefining \pmod on input line ....
+LaTeX Info: Redefining \smash on input line ....
LaTeX Info: Redefining \relbar on input line ....
LaTeX Info: Redefining \Relbar on input line ....
\c at MaxMatrixCols=\count...
diff --git a/required/amsmath/testfiles/tlb-utex-001.tlg b/required/amsmath/testfiles/tlb-utex-001.tlg
index 075b2317..b8e994be 100644
--- a/required/amsmath/testfiles/tlb-utex-001.tlg
+++ b/required/amsmath/testfiles/tlb-utex-001.tlg
@@ -39,6 +39,7 @@ LaTeX Font Info: Redeclaring font encoding OMS on input line ....
\macc at depth=\count...
LaTeX Info: Redefining \bmod on input line ....
LaTeX Info: Redefining \pmod on input line ....
+LaTeX Info: Redefining \smash on input line ....
LaTeX Info: Redefining \relbar on input line ....
LaTeX Info: Redefining \Relbar on input line ....
\c at MaxMatrixCols=\count...
More information about the latex3-commits
mailing list.