Skip to content

Commit 68386bf

Browse files
add extra meaning test for #1448 (#1520)
* add extra meaning test for #1448 * forgot to add test file to git * chmod * luatex (l3build could perhaps have normalised this) * eol eof * document use of special uccodes for catcode 12 tokens * Correct a missing "%" --------- Co-authored-by: Joseph Wright <[email protected]>
1 parent 40c1b17 commit 68386bf

File tree

5 files changed

+389
-7
lines changed

5 files changed

+389
-7
lines changed

required/amsmath/amsmath.dtx

+24-7
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ Bug reports can be opened (category \texttt{#1}) at\\%
8181
% \begin{macrocode}
8282
\DeclareRelease{}{1994-06-01}{amsmath-2018-12-01.sty}
8383
\DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty}
84-
\DeclareCurrentRelease{}{2019-04-01}
84+
\DeclareCurrentRelease{}{2024-10-30}
8585
% \end{macrocode}
8686
%
8787
% \begin{macrocode}
88-
\ProvidesPackage{amsmath}[2024/08/11 v2.17r AMS math features]
88+
\ProvidesPackage{amsmath}[2024/10/30 v2.17s AMS math features]
8989
% \end{macrocode}
9090
%
9191
% \section{Catcode defenses}
@@ -1002,6 +1002,10 @@ Foreign command \@backslashchar#1;\MessageBreak
10021002
\let\DOTSI\relax
10031003
\let\DOTSB\relax
10041004
\let\DOTSX\relax
1005+
% \end{macrocode}
1006+
% In the definitions below, special \cs{uccode}s are used to generate macros
1007+
% with arguments delimited by catcode 12 letters as returned by \cs{meaning}.
1008+
% \begin{macrocode}
10051009
{\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h
10061010
\uppercase{%
10071011
\gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2%
@@ -1039,6 +1043,13 @@ Foreign command \@backslashchar#1;\MessageBreak
10391043
}
10401044
\fi
10411045
% \end{macrocode}
1046+
% \changes{v2.17s}{2024/10/30}{guard against primitive if (gh/1448)}
1047+
% \begin{macrocode}
1048+
{\uccode`7=`\\ \uccode`(=`i \uccode`)=`f
1049+
\uppercase{\gdef\testif@#1#2#3#4\testif@{%
1050+
\ifx7#1\ifx(#2\ifx)#3\@tempswafalse\fi\fi\fi}
1051+
}}
1052+
% \end{macrocode}
10421053
% \begin{macrocode}
10431054
\newcount\classnum@
10441055
\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096
@@ -1159,11 +1170,17 @@ Foreign command \@backslashchar#1;\MessageBreak
11591170
% \changes{v2.15d}{2016/06/28}{Add space token to prevent runaway
11601171
% argument error}
11611172
% \changes{v2.17r}{2024/06/29}{Drop \cs{protect} if present (gh/1265)}
1162-
% \begin{macrocode}
1163-
\begingroup
1164-
\def\protect{\protect}% % make it a quark
1165-
\xdef\meaning@{\@xp\stripprotect@\@let@token.........\stripprotect@. .........}%
1166-
\endgroup
1173+
% \changes{v2.17s}{2024/10/30}{skip protect testif detect primitive if (gh/1448)}
1174+
% \begin{macrocode}
1175+
\xdef\meaning@{\meaning\@let@token. .........}%
1176+
\@tempswatrue
1177+
\@xp\testif@\meaning@....\testif@
1178+
\if@tempswa
1179+
\begingroup
1180+
\def\protect{\protect}% % make it a quark
1181+
\xdef\meaning@{\@xp\stripprotect@\@let@token.........\stripprotect@. .........}%
1182+
\endgroup
1183+
\fi
11671184
% \end{macrocode}
11681185
% In previous versions \verb|\long| macros were not seen by the lookahead.
11691186
% That was bad as this file uses \verb|\(re)newcommand| for \verb|\implies| etc.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
This is a generated file for the LaTeX2e validation system.
2+
Don't change this file in any respect.
3+
Completed box being shipped out [1]
4+
\vbox(633.0+0.0)x407.0, direction TLT
5+
.\glue 16.0
6+
.\vbox(617.0+0.0)x345.0, shifted 62.0, direction TLT
7+
..\vbox(12.0+0.0)x345.0, glue set 12.0fil, direction TLT
8+
...\glue 0.0 plus 1.0fil
9+
...\hbox(0.0+0.0)x345.0, direction TLT
10+
....\hbox(0.0+0.0)x345.0, direction TLT
11+
..\glue 25.0
12+
..\glue(\lineskip) 0.0
13+
..\vbox(550.0+0.0)x345.0, glue set 479.94873fil, direction TLT
14+
...\write-{}
15+
...\glue(\topskip) 4.16667
16+
...\hbox(5.83333+0.83333)x345.0, glue set 301.50708fil, direction TLT
17+
....\localpar
18+
.....\localinterlinepenalty=0
19+
.....\localbrokenpenalty=0
20+
.....\localleftbox=null
21+
.....\localrightbox=null
22+
....\hbox(0.0+0.0)x15.0, direction TLT
23+
....\mathon
24+
....\OML/cmm/m/it/10 x
25+
....\glue(\thinmuskip) 1.66663
26+
....\hbox(4.44444+0.0)x11.66661, direction TLT
27+
.....\OMS/cmsy/m/n/10 ^^A
28+
.....\glue(\thinmuskip) 1.66663
29+
.....\OMS/cmsy/m/n/10 ^^A
30+
.....\glue(\thinmuskip) 1.66663
31+
.....\OMS/cmsy/m/n/10 ^^A
32+
....\glue(\thinmuskip) 1.66663
33+
....\OT1/cmr/m/n/10 +
34+
....\mathoff
35+
....\penalty 10000
36+
....\glue(\parfillskip) 0.0 plus 1.0fil
37+
....\glue(\rightskip) 0.0
38+
...\glue(\parskip) 0.0 plus 1.0
39+
...\glue(\parskip) 0.0
40+
...\glue(\baselineskip) 5.33334
41+
...\hbox(5.83333+0.83333)x345.0, glue set 301.50708fil, direction TLT
42+
....\localpar
43+
.....\localinterlinepenalty=0
44+
.....\localbrokenpenalty=0
45+
.....\localleftbox=null
46+
.....\localrightbox=null
47+
....\hbox(0.0+0.0)x15.0, direction TLT
48+
....\mathon
49+
....\OML/cmm/m/it/10 x
50+
....\glue(\thinmuskip) 1.66663
51+
....\hbox(4.44444+0.0)x11.66661, direction TLT
52+
.....\OMS/cmsy/m/n/10 ^^A
53+
.....\glue(\thinmuskip) 1.66663
54+
.....\OMS/cmsy/m/n/10 ^^A
55+
.....\glue(\thinmuskip) 1.66663
56+
.....\OMS/cmsy/m/n/10 ^^A
57+
....\glue(\thinmuskip) 1.66663
58+
....\OMS/cmsy/m/n/10 ^^@
59+
....\mathoff
60+
....\penalty 10000
61+
....\glue(\parfillskip) 0.0 plus 1.0fil
62+
....\glue(\rightskip) 0.0
63+
...\glue(\parskip) 0.0 plus 1.0
64+
...\glue(\parskip) 0.0
65+
...\glue(\baselineskip) 6.51389
66+
...\hbox(4.65279+0.0)x345.0, glue set 304.28485fil, direction TLT
67+
....\localpar
68+
.....\localinterlinepenalty=0
69+
.....\localbrokenpenalty=0
70+
.....\localleftbox=null
71+
.....\localrightbox=null
72+
....\hbox(0.0+0.0)x15.0, direction TLT
73+
....\mathon
74+
....\OML/cmm/m/it/10 x
75+
....\glue(\thinmuskip) 1.66663
76+
....\hbox(4.44444+0.0)x11.66661, direction TLT
77+
.....\OMS/cmsy/m/n/10 ^^A
78+
.....\glue(\thinmuskip) 1.66663
79+
.....\OMS/cmsy/m/n/10 ^^A
80+
.....\glue(\thinmuskip) 1.66663
81+
.....\OMS/cmsy/m/n/10 ^^A
82+
....\glue(\thinmuskip) 1.66663
83+
....\OMS/cmsy/m/n/10 ^^C
84+
....\mathoff
85+
....\penalty 10000
86+
....\glue(\parfillskip) 0.0 plus 1.0fil
87+
....\glue(\rightskip) 0.0
88+
...\glue(\parskip) 0.0 plus 1.0
89+
...\glue(\parskip) 0.0
90+
...\glue(\baselineskip) 5.05556
91+
...\hbox(6.94444+0.0)x345.0, glue set 304.99323fil, direction TLT
92+
....\localpar
93+
.....\localinterlinepenalty=0
94+
.....\localbrokenpenalty=0
95+
.....\localleftbox=null
96+
.....\localrightbox=null
97+
....\hbox(0.0+0.0)x15.0, direction TLT
98+
....\mathon
99+
....\OML/cmm/m/it/10 x
100+
....\glue(\thinmuskip) 1.66663
101+
....\hbox(1.05554+0.0)x11.66661, direction TLT
102+
.....\OML/cmm/m/it/10 :
103+
.....\glue(\thinmuskip) 1.66663
104+
.....\OML/cmm/m/it/10 :
105+
.....\glue(\thinmuskip) 1.66663
106+
.....\OML/cmm/m/it/10 :
107+
....\glue(\thinmuskip) 1.66663
108+
....\OML/cmm/m/it/10 b
109+
....\mathoff
110+
....\penalty 10000
111+
....\glue(\parfillskip) 0.0 plus 1.0fil
112+
....\glue(\rightskip) 0.0
113+
...\glue(\parskip) 0.0 plus 1.0
114+
...\glue(\parskip) 0.0
115+
...\glue(\baselineskip) 7.69446
116+
...\hbox(4.30554+0.0)x345.0, glue set 303.56958fil, direction TLT
117+
....\localpar
118+
.....\localinterlinepenalty=0
119+
.....\localbrokenpenalty=0
120+
.....\localleftbox=null
121+
.....\localrightbox=null
122+
....\hbox(0.0+0.0)x15.0, direction TLT
123+
....\mathon
124+
....\OML/cmm/m/it/10 x
125+
....\glue(\thinmuskip) 1.66663
126+
....\hbox(1.05554+0.0)x11.66661, direction TLT
127+
.....\OML/cmm/m/it/10 :
128+
.....\glue(\thinmuskip) 1.66663
129+
.....\OML/cmm/m/it/10 :
130+
.....\glue(\thinmuskip) 1.66663
131+
.....\OML/cmm/m/it/10 :
132+
....\glue(\thinmuskip) 1.66663
133+
....\OML/cmm/m/it/10 x
134+
....\mathoff
135+
....\penalty 10000
136+
....\glue(\parfillskip) 0.0 plus 1.0fil
137+
....\glue(\rightskip) 0.0
138+
...\glue(\parskip) 0.0 plus 1.0
139+
...\glue(\parskip) 0.0
140+
...\glue(\baselineskip) 7.55556
141+
...\hbox(4.44444+1.94444)x345.0, glue set 303.01172fil, direction TLT
142+
....\localpar
143+
.....\localinterlinepenalty=0
144+
.....\localbrokenpenalty=0
145+
.....\localleftbox=null
146+
.....\localrightbox=null
147+
....\hbox(0.0+0.0)x15.0, direction TLT
148+
....\mathon
149+
....\OML/cmm/m/it/10 x
150+
....\glue(\thinmuskip) 1.66663
151+
....\hbox(1.05554+0.0)x11.66661, direction TLT
152+
.....\OML/cmm/m/it/10 :
153+
.....\glue(\thinmuskip) 1.66663
154+
.....\OML/cmm/m/it/10 :
155+
.....\glue(\thinmuskip) 1.66663
156+
.....\OML/cmm/m/it/10 :
157+
....\glue(\thinmuskip) 1.66663
158+
....\hbox(4.44444+1.94444)x6.27313, direction TLT
159+
.....\hbox(4.44444+1.94444)x6.27313, direction TLT
160+
......\mathon
161+
......\OML/cmm/b/it/10 y
162+
......\kern0.37038 (italic)
163+
......\mathoff
164+
....\mathoff
165+
....\penalty 10000
166+
....\glue(\parfillskip) 0.0 plus 1.0fil
167+
....\glue(\rightskip) 0.0
168+
...\glue -1.94444
169+
...\glue 0.0 plus 1.0fil
170+
...\glue 0.0
171+
...\glue 0.0 plus 0.0001fil
172+
..\glue(\baselineskip) 23.55556
173+
..\hbox(6.44444+0.0)x345.0, direction TLT
174+
...\hbox(6.44444+0.0)x345.0, glue set 170.0fil, direction TLT
175+
....\glue 0.0 plus 1.0fil
176+
....\OT1/cmr/m/n/10 1
177+
....\glue 0.0 plus 1.0fil
178+
(github-1448.aux)
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
\documentclass{article}
2+
3+
\input{test2e}
4+
5+
% 2.17r gave low level argument errors as teh \if nesting
6+
% was wrong if the \futurelet found a primitive \if... token
7+
8+
\usepackage{amsmath}
9+
10+
11+
\newcommand\test{\iftrue x\fi}
12+
13+
\DeclareRobustCommand\testr{\DOTSB+}
14+
\protected\def\testp{\DOTSB-}
15+
\def\testd{\DOTSB*}
16+
17+
\begin{document}
18+
19+
\START
20+
\showoutput
21+
$ x \dots \testr$
22+
23+
$ x \dots \testp$
24+
25+
$ x \dots \testd$
26+
27+
$x \dots \iffalse a\else b\fi $
28+
29+
$x \dots \test$
30+
31+
$x \dots \boldsymbol{y} $
32+
33+
34+
\end{document}

0 commit comments

Comments
 (0)