[latex3-commits] [git/LaTeX3-latex3-latex2e] robustness: some more commands made robust (3e189163)
Frank Mittelbach
frank.mittelbach at latex-project.org
Thu Aug 29 19:24:58 CEST 2019
Repository : https://github.com/latex3/latex2e
On branch : robustness
Link : https://github.com/latex3/latex2e/commit/3e1891637c25316a21c6e7cbe7006a2e5fff8288
>---------------------------------------------------------------
commit 3e1891637c25316a21c6e7cbe7006a2e5fff8288
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Thu Aug 29 19:24:58 2019 +0200
some more commands made robust
>---------------------------------------------------------------
3e1891637c25316a21c6e7cbe7006a2e5fff8288
base/ltmath.dtx | 8 +++---
base/ltoutenc.dtx | 4 +--
base/ltsect.dtx | 4 +--
base/testfiles/github-robust-0123.luatex.tlg | 28 ++++++++++++++++---
base/testfiles/github-robust-0123.lvt | 40 +++++++++++++---------------
base/testfiles/github-robust-0123.tlg | 28 ++++++++++++++++---
base/testfiles/github-robust-0123.xetex.tlg | 28 ++++++++++++++++---
7 files changed, 99 insertions(+), 41 deletions(-)
diff --git a/base/ltmath.dtx b/base/ltmath.dtx
index 4fa016c9..836b1572 100644
--- a/base/ltmath.dtx
+++ b/base/ltmath.dtx
@@ -261,15 +261,15 @@
% \end{macrocode}
%
% \begin{macrocode}
-\def\vphantom{\v at true\h at false\ph at nt}
+\DeclareRobustCommand\vphantom{\v at true\h at false\ph at nt}
% \end{macrocode}
%
% \begin{macrocode}
-\def\hphantom{\v at false\h at true\ph at nt}
+\DeclareRobustCommand\hphantom{\v at false\h at true\ph at nt}
% \end{macrocode}
%
% \begin{macrocode}
-\def\phantom{\v at true\h at true\ph at nt}
+\DeclareRobustCommand\phantom{\v at true\h at true\ph at nt}
% \end{macrocode}
%
% \begin{macrocode}
@@ -476,7 +476,7 @@
%
% \begin{macro}{\*}
% \begin{macrocode}
-\def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
+\DeclareRobustCommand\*{\discretionary{\thinspace\the\textfont2\char2}{}{}}
% \end{macrocode}
% \end{macro}
%
diff --git a/base/ltoutenc.dtx b/base/ltoutenc.dtx
index a6b19900..796c8e3b 100644
--- a/base/ltoutenc.dtx
+++ b/base/ltoutenc.dtx
@@ -1054,7 +1054,7 @@
% \task{?}{Improve this and document its problems, see pr/3160}
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \begin{macrocode}
-\def\UseTextAccent#1#2#3{%
+\DeclareRobustCommand\UseTextAccent[3]{%
\hmode at start@before at group
{%
% \end{macrocode}
@@ -1070,7 +1070,7 @@
%
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \begin{macrocode}
-\def\UseTextSymbol#1#2{%
+\DeclareRobustCommand\UseTextSymbol[2]{%
\hmode at start@before at group
{%
\def\@wrong at font@char{\MessageBreak
diff --git a/base/ltsect.dtx b/base/ltsect.dtx
index 42357900..40c143ec 100644
--- a/base/ltsect.dtx
+++ b/base/ltsect.dtx
@@ -170,10 +170,10 @@
% \end{macro}
% \begin{macro}{\and}
% \begin{macrocode}
-\def\and{% % \begin{tabular}
+\DeclareRobustCommand\and{% % \begin{tabular}
\end{tabular}%
\hskip 1em \@plus.17fil%
- \begin{tabular}[t]{c}}% % \end{tabular}
+ \begin{tabular}[t]{c}}% % \end{tabular}
% \end{macrocode}
% \end{macro}
%
diff --git a/base/testfiles/github-robust-0123.luatex.tlg b/base/testfiles/github-robust-0123.luatex.tlg
index 064c78bf..cde04c9e 100644
--- a/base/testfiles/github-robust-0123.luatex.tlg
+++ b/base/testfiles/github-robust-0123.luatex.tlg
@@ -6,10 +6,6 @@ LaTeX Font Info: Redeclaring math delimiter \Downarrow on input line ....
<recently read> \Downarrow
l. ......dafter\show\csname Downarrow\space\endcsname
---------------------------------------
-\begin{foo} -> \begin {foo}
----------------------------------------
-\end{foo} -> \end {foo}
----------------------------------------
====================================
Not worth making robust ...
====================================
@@ -359,6 +355,10 @@ and I'll forget about whatever was undefined.
---------------------------------------
\Upsilon -> \Upsilon
---------------------------------------
+\UseTextAccent{foo} -> \UseTextAccent {foo}
+---------------------------------------
+\UseTextSymbol{foo} -> \UseTextSymbol {foo}
+---------------------------------------
\Vert -> \Vert
---------------------------------------
\Xi -> \Xi
@@ -391,6 +391,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\amalg -> \amalg
---------------------------------------
+\and -> \and
+---------------------------------------
\angle -> \angle
---------------------------------------
\approx -> \approx
@@ -433,6 +435,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\begingroup -> \begingroup
---------------------------------------
+\begin{foo} -> \begin {foo}
+---------------------------------------
\belowdisplayshortskip -> \belowdisplayshortskip
---------------------------------------
\belowdisplayskip -> \belowdisplayskip
@@ -761,6 +765,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\endline -> \endline
---------------------------------------
+\end{foo} -> \end {foo}
+---------------------------------------
\enskip -> \hskip .5em\relax
---------------------------------------
\enspace -> \enspace
@@ -939,6 +945,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\hookrightarrow -> \hookrightarrow
---------------------------------------
+\hphantom -> \hphantom
+---------------------------------------
\hrulefill -> \hrulefill
---------------------------------------
\hrule -> \hrule
@@ -1257,6 +1265,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\mathsterling -> \mathsterling
---------------------------------------
+\mathstrut -> \mathstrut
+---------------------------------------
\mathsurround -> \mathsurround
---------------------------------------
\mathtt -> \mathtt
@@ -1267,6 +1277,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\math -> \(
---------------------------------------
+\matrix{foo} -> \matrix {foo}
+---------------------------------------
\maxdeadcycles -> \maxdeadcycles
---------------------------------------
\maxdepth -> \maxdepth
@@ -1483,6 +1495,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\perp -> \perp
---------------------------------------
+\phantom -> \phantom
+---------------------------------------
\phi -> \phi
---------------------------------------
\pi -> \pi
@@ -1661,6 +1675,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\shipout -> \shipout
---------------------------------------
+\shortstack -> \shortstack
+---------------------------------------
\showboxbreadth -> \showboxbreadth
---------------------------------------
\showboxdepth -> \showboxdepth
@@ -1915,6 +1931,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\textwidth -> \textwidth
---------------------------------------
+\thanks{foo} -> \thanks {foo}
+---------------------------------------
\theta -> \theta
---------------------------------------
\thicklines -> \thicklines
@@ -2093,6 +2111,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\vfuzz -> \vfuzz
---------------------------------------
+\vphantom{foo} -> \vphantom {foo}
+---------------------------------------
\vrule -> \vrule
---------------------------------------
\vsize -> \vsize
diff --git a/base/testfiles/github-robust-0123.lvt b/base/testfiles/github-robust-0123.lvt
index b533e4dd..f0421f65 100644
--- a/base/testfiles/github-robust-0123.lvt
+++ b/base/testfiles/github-robust-0123.lvt
@@ -31,16 +31,13 @@
%%\test{\ProvideTextCommand{foo}{bar}{baz}} -- breaks badly
%%\test{\ProvidesFile{foo}{bar}{baz}} -- breaks badly
%%\test{\UseRawInputEncoding} -- breaks badly
-%%\test{\UseTextAccent{foo}} -- breaks badly
-%%\test{\UseTextSymbol{foo}} -- breaks badly
%%\test{\addcontentsline{foo}{bar}{baz}} -- breaks badly
%%\test{\addtocontents{foo}{bar}{baz}} -- breaks badly
-%%\test{\and} -- breaks badly
%%\test{\array} -- breaks badly
%%\test{\bibitem{foo}} -- breaks badly
%%\test{\bibliography} -- breaks badly
-%%\test{\bordermatrix} -- breaks badly
-%%\test{\buildrel{foo}{bar}} -- breaks badly
+%%\test{\bordermatrix} -- breaks badly -- plain TeX
+%%\test{\buildrel{foo}{bar}} -- breaks badly -- plain TeX
%%\test{\center} -- breaks badly
%%\test{\cleardoublepage} -- breaks badly
%%\test{\clearpage} -- breaks badly
@@ -48,17 +45,15 @@
%%\test{\counterwithin{section}{footnote}} -- breaks badly
%%\test{\counterwithout{section}{footnote}} -- breaks badly
%%\test{\displaylines{foo}} -- breaks badly
-%%\test{\else} -- breaks badly
%%\test{\enlargethispage{5pt}} -- breaks badly
%%\test{\enumerate} -- breaks badly
%%\test{\eqnarray} -- breaks badly
%%\test{\equation} -- breaks badly
-%%\test{\flushleft} -- breaks badly
-%%\test{\flushright} -- breaks badly
+%%\test{\flushleft} -- breaks badly --probably ok
+%%\test{\flushright} -- breaks badly --probably ok
%%\test{\footnotemark} -- breaks badly
%%\test{\footnotetext{foo}} -- breaks badly
%%\test{\footnote{foo}} -- breaks badly
-%%\test{\hphantom} -- breaks badly
%%\test{\ignorespacesafterend} -- breaks badly
%%\test{\include{foo}} -- breaks badly
%%\test{\input{foo}} -- breaks badly
@@ -69,10 +64,7 @@
%%\test{\marginpar{foo}} -- breaks badly
%%\test{\mathhexbox} -- breaks badly
%%\test{\mathpalette} -- breaks badly
-%%\test{\mathstrut} -- breaks badly
-%%\test{\matrix{foo}} -- breaks badly
%%\test{\minipage{3cm}} -- breaks badly
-%%\test{\multicolumn{1}{c}{foo}} -- breaks badly
%%\test{\multiput} -- breaks badly
%%\test{\multispan} -- breaks badly
%%\test{\newcommand\foo{}} -- breaks badly
@@ -83,37 +75,29 @@
%%\test{\normalmarginpar} -- breaks badly
%%\test{\normalsfcodes} -- breaks badly
%%\test{\onecolumn} -- breaks badly
-%%\test{\phantom} -- breaks badly
%%\test{\picture(0,0)} -- breaks badly
%%\test{\providecommand} -- breaks badly
%%\test{\refstepcounter{page}} -- breaks badly
%%\test{\renewcommand} -- breaks badly
%%\test{\renewenvironment} -- breaks badly
%%\test{\reversemarginpar} -- breaks badly
-%%\test{\root} -- breaks badly
+%%\test{\root} -- breaks badly -- plain TeX syntax
%%\test{\setcounter{page}} -- breaks badly
-%%\test{\shortstack} -- breaks badly
%%\test{\stepcounter} -- breaks badly
%%\test{\stop} -- breaks badly
%%\test{\suppressfloats} -- breaks badly
%%\test{\tabbing} -- breaks badly
%%\test{\tabular} -- breaks badly
-%%\test{\thanks{foo}} -- breaks badly
%%\test{\thispagestyle{plain}} -- breaks badly
%%\test{\trivlist} -- breaks badly
%%\test{\twocolumn} -- breaks badly
%%\test{\typein} -- breaks badly
%%\test{\typeout} -- breaks badly
%%\test{\usecounter{page}} -- breaks badly
-%%\test{\vphantom{foo}} -- breaks badly
% now ok ...
-\test{\begin{foo}} % breaks really really badly
-\test{\end{foo}} -- breaks badly
-
-
% also break but most likely ok ....
@@ -318,6 +302,8 @@
\test{\vglue}
\test{\wlog}
+%%\test{\multicolumn{1}{c}{foo}} -- breaks badly
+
\typeout{====================================}
\typeout{ Robust ...}
@@ -388,6 +374,8 @@
\test{\Uparrow}
\test{\Updownarrow}
\test{\Upsilon}
+\test{\UseTextAccent{foo}} % -- breaks badly
+\test{\UseTextSymbol{foo}} % -- breaks badly
\test{\Vert}
\test{\Xi}
\test{\_}
@@ -404,6 +392,7 @@
\test{\allowbreak}
\test{\alpha}
\test{\amalg}
+\test{\and} % -- breaks badly
\test{\angle}
\test{\approx}
\test{\arccos}
@@ -425,6 +414,7 @@
\test{\baselinestretch}
\test{\batchmode}
\test{\begingroup}
+\test{\begin{foo}}
\test{\belowdisplayshortskip}
\test{\belowdisplayskip}
\test{\beta}
@@ -589,6 +579,7 @@
\test{\endgroup}
\test{\endlinechar}
\test{\endline}
+\test{\end{foo}}
\test{\enskip}
\test{\enspace}
\test{\ensuremath}
@@ -678,6 +669,7 @@
\test{\hom}
\test{\hookleftarrow}
\test{\hookrightarrow}
+\test{\hphantom} % -- breaks badly
\test{\hrulefill}
\test{\hrule}
\test{\hsize}
@@ -833,11 +825,13 @@
\test{\mathsection}
\test{\mathsf}
\test{\mathsterling}
+\test{\mathstrut} % -- breaks badly
\test{\mathsurround}
\test{\mathtt}
\test{\mathunderscore}
\test{\mathversion}
\test{\math}
+\test{\matrix{foo}} % -- breaks badly
\test{\maxdeadcycles}
\test{\maxdepth}
\test{\maxdimen}
@@ -946,6 +940,7 @@
\test{\partopsep}
\test{\penalty}
\test{\perp}
+\test{\phantom} % -- breaks badly
\test{\phi}
\test{\pi}
\test{\pmatrix}
@@ -1035,6 +1030,7 @@
\test{\shapedefault}
\test{\sharp}
\test{\shipout}
+\test{\shortstack} % -- breaks badly
\test{\showboxbreadth}
\test{\showboxdepth}
\test{\showhyphens{foo}}
@@ -1162,6 +1158,7 @@
\test{\textup}
\test{\textvisiblespace}
\test{\textwidth}
+\test{\thanks{foo}} % -- breaks badly
\test{\theta}
\test{\thicklines}
\test{\thickmuskip}
@@ -1251,6 +1248,7 @@
\test{\vfilneg}
\test{\vfil}
\test{\vfuzz}
+\test{\vphantom{foo}} % -- breaks badly
\test{\vrule}
\test{\vsize}
\test{\vskip}
diff --git a/base/testfiles/github-robust-0123.tlg b/base/testfiles/github-robust-0123.tlg
index fe521782..2fa37389 100644
--- a/base/testfiles/github-robust-0123.tlg
+++ b/base/testfiles/github-robust-0123.tlg
@@ -6,10 +6,6 @@ LaTeX Font Info: Redeclaring math delimiter \Downarrow on input line ....
<recently read> \Downarrow
l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
-\begin{foo} -> \begin {foo}
----------------------------------------
-\end{foo} -> \end {foo}
----------------------------------------
====================================
Not worth making robust ...
====================================
@@ -351,6 +347,10 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\Upsilon -> \Upsilon
---------------------------------------
+\UseTextAccent{foo} -> \UseTextAccent {foo}
+---------------------------------------
+\UseTextSymbol{foo} -> \UseTextSymbol {foo}
+---------------------------------------
\Vert -> \Vert
---------------------------------------
\Xi -> \Xi
@@ -383,6 +383,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\amalg -> \amalg
---------------------------------------
+\and -> \and
+---------------------------------------
\angle -> \angle
---------------------------------------
\approx -> \approx
@@ -425,6 +427,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\begingroup -> \begingroup
---------------------------------------
+\begin{foo} -> \begin {foo}
+---------------------------------------
\belowdisplayshortskip -> \belowdisplayshortskip
---------------------------------------
\belowdisplayskip -> \belowdisplayskip
@@ -753,6 +757,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\endline -> \endline
---------------------------------------
+\end{foo} -> \end {foo}
+---------------------------------------
\enskip -> \hskip .5em\relax
---------------------------------------
\enspace -> \enspace
@@ -931,6 +937,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\hookrightarrow -> \hookrightarrow
---------------------------------------
+\hphantom -> \hphantom
+---------------------------------------
\hrulefill -> \hrulefill
---------------------------------------
\hrule -> \hrule
@@ -1241,6 +1249,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\mathsterling -> \mathsterling
---------------------------------------
+\mathstrut -> \mathstrut
+---------------------------------------
\mathsurround -> \mathsurround
---------------------------------------
\mathtt -> \mathtt
@@ -1251,6 +1261,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\math -> \(
---------------------------------------
+\matrix{foo} -> \matrix {foo}
+---------------------------------------
\maxdeadcycles -> \maxdeadcycles
---------------------------------------
\maxdepth -> \maxdepth
@@ -1467,6 +1479,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\perp -> \perp
---------------------------------------
+\phantom -> \phantom
+---------------------------------------
\phi -> \phi
---------------------------------------
\pi -> \pi
@@ -1645,6 +1659,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\shipout -> \shipout
---------------------------------------
+\shortstack -> \shortstack
+---------------------------------------
\showboxbreadth -> \showboxbreadth
---------------------------------------
\showboxdepth -> \showboxdepth
@@ -1899,6 +1915,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\textwidth -> \textwidth
---------------------------------------
+\thanks{foo} -> \thanks {foo}
+---------------------------------------
\theta -> \theta
---------------------------------------
\thicklines -> \thicklines
@@ -2077,6 +2095,8 @@ l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
\vfuzz -> \vfuzz
---------------------------------------
+\vphantom{foo} -> \vphantom {foo}
+---------------------------------------
\vrule -> \vrule
---------------------------------------
\vsize -> \vsize
diff --git a/base/testfiles/github-robust-0123.xetex.tlg b/base/testfiles/github-robust-0123.xetex.tlg
index de1c3b3c..407965db 100644
--- a/base/testfiles/github-robust-0123.xetex.tlg
+++ b/base/testfiles/github-robust-0123.xetex.tlg
@@ -6,10 +6,6 @@ LaTeX Font Info: Redeclaring math delimiter \Downarrow on input line ....
<recently read> \Downarrow
l. ......fter\show\csname Downarrow\space\endcsname
---------------------------------------
-\begin{foo} -> \begin {foo}
----------------------------------------
-\end{foo} -> \end {foo}
----------------------------------------
====================================
Not worth making robust ...
====================================
@@ -359,6 +355,10 @@ and I'll forget about whatever was undefined.
---------------------------------------
\Upsilon -> \Upsilon
---------------------------------------
+\UseTextAccent{foo} -> \UseTextAccent {foo}
+---------------------------------------
+\UseTextSymbol{foo} -> \UseTextSymbol {foo}
+---------------------------------------
\Vert -> \Vert
---------------------------------------
\Xi -> \Xi
@@ -391,6 +391,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\amalg -> \amalg
---------------------------------------
+\and -> \and
+---------------------------------------
\angle -> \angle
---------------------------------------
\approx -> \approx
@@ -433,6 +435,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\begingroup -> \begingroup
---------------------------------------
+\begin{foo} -> \begin {foo}
+---------------------------------------
\belowdisplayshortskip -> \belowdisplayshortskip
---------------------------------------
\belowdisplayskip -> \belowdisplayskip
@@ -761,6 +765,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\endline -> \endline
---------------------------------------
+\end{foo} -> \end {foo}
+---------------------------------------
\enskip -> \hskip .5em\relax
---------------------------------------
\enspace -> \enspace
@@ -939,6 +945,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\hookrightarrow -> \hookrightarrow
---------------------------------------
+\hphantom -> \hphantom
+---------------------------------------
\hrulefill -> \hrulefill
---------------------------------------
\hrule -> \hrule
@@ -1257,6 +1265,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\mathsterling -> \mathsterling
---------------------------------------
+\mathstrut -> \mathstrut
+---------------------------------------
\mathsurround -> \mathsurround
---------------------------------------
\mathtt -> \mathtt
@@ -1267,6 +1277,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\math -> \(
---------------------------------------
+\matrix{foo} -> \matrix {foo}
+---------------------------------------
\maxdeadcycles -> \maxdeadcycles
---------------------------------------
\maxdepth -> \maxdepth
@@ -1483,6 +1495,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\perp -> \perp
---------------------------------------
+\phantom -> \phantom
+---------------------------------------
\phi -> \phi
---------------------------------------
\pi -> \pi
@@ -1661,6 +1675,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\shipout -> \shipout
---------------------------------------
+\shortstack -> \shortstack
+---------------------------------------
\showboxbreadth -> \showboxbreadth
---------------------------------------
\showboxdepth -> \showboxdepth
@@ -1915,6 +1931,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\textwidth -> \textwidth
---------------------------------------
+\thanks{foo} -> \thanks {foo}
+---------------------------------------
\theta -> \theta
---------------------------------------
\thicklines -> \thicklines
@@ -2093,6 +2111,8 @@ and I'll forget about whatever was undefined.
---------------------------------------
\vfuzz -> \vfuzz
---------------------------------------
+\vphantom{foo} -> \vphantom {foo}
+---------------------------------------
\vrule -> \vrule
---------------------------------------
\vsize -> \vsize
More information about the latex3-commits
mailing list