Debian Codegraph @

texmf-dist/tex/latex/firstaid/latex2e-first-aid-for-external-files.ltx

raw
1 %%
2 %% This is file `latex2e-first-aid-for-external-files.ltx',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% latex2e-first-aid-for-external-files.dtx (with options: `kernel')
8 %%
9 %% The source is maintained by the LaTeX Project team and bug
10 %% reports for it can be opened at https://latex-project.org/bugs/
11 %% (but please observe conditions on bug reports sent to that address!)
12 %%
13 %%
14 %% Copyright (C) 2020-2025
15 %% The LaTeX Project and any individual authors listed elsewhere
16 %% in this file.
17 %%
18 %% This file was generated from file(s) of the Standard LaTeX `First Aid Bundle'.
19 %% ------------------------------------------------------------------------------
20 %%
21 %% It may be distributed and/or modified under the
22 %% conditions of the LaTeX Project Public License, either version 1.3c
23 %% of this license or (at your option) any later version.
24 %% The latest version of this license is in
25 %% https://www.latex-project.org/lppl.txt
26 %% and version 1.3c or later is part of all distributions of LaTeX
27 %% version 2005/12/01 or later.
28 %%
29 %% This file may only be distributed together with a copy of the LaTeX
30 %% `First Aid Bundle'. You may however distribute the LaTeX `First Aid Bundle'
31 %% without such generated files.
32 %%
33 %% File: latex2e-first-aid-for-external-files.dtx (C) Copyright 2020-2025
34 %%
35 %% The LaTeX Project and any individual authors listed elsewhere
36 %% in this file.
37 \def\LaTeXFirstAidDate{2025/11/03}
38 \def\LaTeXFirstAidVersion{v1.1r}
39 \ProvidesFile{latex2e-first-aid-for-external-files.ltx}
40 [\LaTeXFirstAidDate\space \LaTeXFirstAidVersion\space
41 LaTeX kernel fixes to external files and packages]
42 \ExplSyntaxOn
43 \cs_new:Npn\FirstAidNeededT#1#2#3{
44 \exp_args:Ncx\str_if_eq:onTF{ver@#1.#2}{#3}
45 { \typeout{==>~ First~ Aid~ for~ #1.#2~ applied! } }
46 { \typeout{==>~ First~ Aid~ for~ #1.#2~ no~ longer~ applied!^^J
47 \@spaces Expected:^^J
48 \@spaces\@spaces #3^^J
49 \@spaces but~ found:^^J
50 \@spaces\@spaces \use:c{ver@#1.#2}^^J
51 \@spaces so~ I'm~ assuming~ it~ got~ fixed.
52 } }
53 \exp_args:Ncx\str_if_eq:onT{ver@#1.#2}{#3}
54 }
55 \ExplSyntaxOff
56 \AddToHook{file/dinbrief.cls/after}[firstaid]{%
57 \FirstAidNeededT{dinbrief}{cls}{2000/03/02 LaTeX2e class}%
58 {\AddToHook{env/document/begin}{\begingroup}}%
59 }
60 \AddToHook{package/unicode-math/after}{%
61 \AddToHook{cmd/mod@math@codes/after}{\mathcode`\|=28796 }}
62 \ExplSyntaxOn
63 \AddToHook{file/pgfpages.sty/after}[firstaid]{
64 \cs_gset_eq:NN \shipout \pgfpages@originalshipout
65 \cs_set_eq:NN \pgfpages@originalshipout \tex_shipout:D
66 \cs_set_eq:NN \tex_shipout:D \pgfpages@interceptshipout
67 }
68 \ExplSyntaxOff
69 \ExplSyntaxOn
70 \AddToHook{file/pgfmorepages.sty/after}[firstaid]{
71 \cs_set_nopar:Npn \pgfhookintoshipout {
72 \cs_set_eq:NN \pgfpages@originalshipout \tex_shipout:D
73 \cs_set_eq:NN \tex_shipout:D \pgfpages@interceptshipout
74 }
75 }
76 \ExplSyntaxOff
77 \AddToHook{file/babel.sty/before}[firstaid]{\def\BabelCaseHack{}}
78 \AddToHook{file/songs.sty/after}[firstaid]{%
79 \FirstAidNeededT{songs}{sty}{2018/09/12 v3.1 Songs package}%
80 {%
81 \renewcommand\SB@obeylines{%
82 \let\obeyedline\SB@par%
83 \obeylines%
84 \let\@par\SB@@par%
85 }}%
86 }
87 \AddToHook{file/crop.sty/after}[firstaid]{%
88 \FirstAidNeededT{crop}{sty}{2017/11/19 1.10 crop marks (mf)}%
89 {%
90 \ifdim\stockwidth > 0pt \else \stockwidth\paperwidth \fi
91 \ifdim\stockheight > 0pt \else \stockheight\paperheight \fi
92 \renewcommand*\CROP@genreflect[1]{%
93 \leavevmode
94 \dimen0\CROP@horigin
95 \kern2\dimen0
96 \begingroup
97 \set@typeset@protect %change protect
98 \reflectbox{%
99 \hb@xt@\paperwidth{%
100 \vbox to\paperheight{%
101 #1%
102 \vss
103 }%
104 \hss
105 }%
106 }%
107 \endgroup
108 }
109 }%
110 }
111 \AddToHook{file/bigfoot.sty/after}{%
112 \ifnum\count10<\insc@unt
113 \global\count10=\insc@unt
114 \fi
115 \def\FN@allmarks#1{\@elt{#1}%
116 \ifnum#1<\count256 %<--- problem: 266 isn't the counter for marks
117 \expandafter\FN@allmarks\expandafter{\number\numexpr#1+\@ne}%
118 \fi}%
119 }
120 \AddToHook{file/marginfix.sty/after}[firstaid]{%
121 \FirstAidNeededT{marginfix}{sty}%
122 {2020/05/06 v1.2 Fix Margin Paragraphs}%
123 {\let \@outputbox@attachfloats \@combinefloats}%
124 }
125 \AddToHook{file/ulem.sty/after}[firstaid]{%
126 \def\@hspace#1{\begingroup\setlength\skip@{#1}%
127 \edef\x{\endgroup\hskip\the\skip@\relax}\x}%
128 }
129 \AddToHook{file/varwidth.sty/after}[firstaid]{%
130 \FirstAidNeededT{varwidth}{sty}%
131 {2009/03/30 ver 0.92; \space Variable-width minipages}%
132 {%
133 \def\@vwid@sift{%
134 \skip@\lastskip\unskip
135 \ifdim\lastskip=\z@\unskip\fi % <---- the first aid here (not just unskip)
136 \dimen@\lastkern\unkern
137 \count@\lastpenalty\unpenalty
138 \setbox\z@\lastbox
139 \ifvoid\z@ \advance\sift@deathcycles\@ne \else \sift@deathcycles\z@ \fi
140 \ifnum\sift@deathcycles>33
141 \let\@vwid@sift\relax
142 \PackageWarning{varwidth}{Failed to reprocess entire contents}%
143 \fi
144 \ifnum\count@=\@vwid@preeqp \@vwid@eqmodefalse\fi
145 \ifnum\count@=\@vwid@posteqp \@vwid@eqmodetrue\fi
146 \ifnum\count@=\@vwid@toppen % finished
147 \let\@vwid@sift\relax
148 \else\ifnum\count@=\@vwid@offsets
149 \@vwid@setoffsets
150 \else
151 \ifnum\count@=\@vwid@postw
152 \else
153 \@vwid@resetb % reset box \z@ or measure it
154 \fi
155 \@vwid@append
156 \fi\fi
157 \@vwid@sift}%
158 }%
159 }
160 \AddToHook{file/german.sty/after}[firstaid]{%
161 \FirstAidNeededT{german}{sty}{1998/07/08 v2.5e Support for writing german texts (br)}
162 {%
163 \let\grmn@active@dq@\@active@dq
164 \def\@active@dq{\protect\grmn@active@dq@}%
165 \germanTeX
166 }%
167 }
168 \AddToHook{file/ngerman.sty/after}[firstaid]{%
169 \FirstAidNeededT{ngerman}{sty}{1998/07/08 v2.5e Support for writing german texts (br)}
170 {%
171 \let\grmn@active@dq@\@active@dq
172 \def\@active@dq{\protect\grmn@active@dq@}%
173 \ngermanTeX
174 }%
175 }
176 \AddToHook{file/underscore.sty/after}[firstaid]{%
177 \FirstAidNeededT{underscore}{sty}{2006/09/13}{\RequirePackage{underscore-ltx}}}
178 \AddToHook{package/acro/after}[firstaid]{%
179 \FirstAidNeededT{acro}{sty}{2022/04/01 v3.8 typeset acronyms
180 and other abbreviations (CN)}
181 {\UseName{prop_new:c}{l__acro_tmpa_prop}%
182 \acsetup{patch/longtable=false}%
183 }%
184 }
185 \AddToHook{package/chemformula/before}[firstaid]{%
186 \RequirePackage{l3keys2e}%
187 }
188 \AddToHook{package/chemnum/after}[firstaid]{%
189 \FirstAidNeededT{chemnum}{sty}{2021/01/21 v1.3a a comprehensive
190 approach for the numbering of chemical compounds (CN)}
191 {\UseName{prop_new:c}{l__chemnum_tmpa_prop}}%
192 }
193 \AddToHook{package/cleveref/after}[firstaid]{%
194 \FirstAidNeededT{cleveref}{sty}{2018/03/27 v0.21.4 Intelligent cross-referencing}
195 {%
196 \def\cref@getref#1#2{%
197 \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
198 \expandafter\expandafter\expandafter\def%
199 \expandafter\expandafter\expandafter#2%
200 \expandafter\expandafter\expandafter{%
201 \expandafter\@firstoffive#2}}% <-------- five
202 \def\cpageref@getref#1#2{%
203 \expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
204 \expandafter\expandafter\expandafter\def%
205 \expandafter\expandafter\expandafter#2%
206 \expandafter\expandafter\expandafter{%
207 \expandafter\@secondoffive#2}}% <----------- five
208 \AddToHook{begindocument}[cleveref]{%
209 \def\label@noarg#1{%
210 \cref@old@label{#1}%
211 \@bsphack%
212 \protected@edef\@tempa{{page}{\the\c@page}}% <--- should be protected
213 \setcounter{page}{1}%
214 \protected@edef\@tempb{\thepage}% <--- should be protected
215 \expandafter\setcounter\@tempa%
216 \cref@constructprefix{page}{\cref@result}%
217 \protected@write\@auxout{}%
218 {\string\newlabel{#1@cref}{{\cref@currentlabel}%
219 {[\@tempb][\arabic{page}][\cref@result]\thepage}{}{}{}}}% <----- five
220 \@esphack}%
221 \def\label@optarg[#1]#2{%
222 \cref@old@label{#2}%
223 \@bsphack%
224 \protected@edef\@tempa{{page}{\the\c@page}}% <--- should be protected
225 \setcounter{page}{1}%
226 \protected@edef\@tempb{\thepage}% <--- should be protected
227 \expandafter\setcounter\@tempa%
228 \cref@constructprefix{page}{\cref@result}%
229 \protected@edef\cref@currentlabel{%
230 \expandafter\cref@override@label@type%
231 \cref@currentlabel\@nil{#1}}%
232 \protected@write\@auxout{}%
233 {\string\newlabel{#2@cref}{{\cref@currentlabel}%
234 {[\@tempb][\arabic{page}][\cref@result]\thepage}{}{}{}}}% <------- five
235 \@esphack}%
236 }
237 \newcommand\firstaid@cref@smugglelabel{\let\cref@currentlabel\cref@gcurrentlabel@temp}
238 \newcommand\firstaid@cref@updatelabeldata[1]{%
239 \cref@constructprefix{#1}{\cref@result}%
240 \@ifundefined{cref@#1@alias}%
241 {\def\@tempa{#1}}%
242 {\def\@tempa{\csname cref@#1@alias\endcsname}}%
243 \protected@xdef\cref@gcurrentlabel@temp{%
244 [\@tempa][\arabic{#1}][\cref@result]%
245 \csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
246 \aftergroup\firstaid@cref@smugglelabel
247 }
248 \newif\iftag@
249 \AddToHook{label}[firstaid/cleveref]
250 {\ifx
251 \@currentcounter\@empty
252 \else
253 \iftag@\else
254 \firstaid@cref@updatelabeldata{\@currentcounter}%
255 \fi
256 \fi}
257 \AddToHook{begindocument}[cleveref]
258 {
259 \IfPackageAtLeastT{amsmath}{2025-05-18}
260 {
261 \def\ltx@label#1{\cref@label{#1}}
262 \def\label@in@display@noarg#1{\cref@old@label@in@display{#1}}
263 \def\label@in@mmeasure@noarg#1{%
264 \begingroup
265 \measuring@false%
266 \cref@old@label@in@display{#1}%
267 \endgroup}%
268 }
269 }
270 }%
271 }
272 \AddToHook{package/arydshln/after}[firstaid]{%
273 \FirstAidNeededT{arydshln}{sty}{2019/02/21 v1.76 }
274 {%
275 \protected\def\adl@@vlineL#1#2#3#4{\adl@ivline#4\@nil{#1}{#2}%
276 \xdef\adl@colsL{\adl@colsL
277 \@elt{#3}{\number\@tempcnta}{\number\@tempcntb}%
278 {\adl@dashcolor}{\adl@gapcolor}}}%
279 \protected\def\adl@@vlineR#1#2#3#4{\adl@ivline#4\@nil{#1}{#2}%
280 \xdef\adl@colsR{%
281 \@elt{#3}{\number\@tempcnta}{\number\@tempcntb}%
282 {\adl@dashcolor}{\adl@gapcolor}%
283 \adl@colsR}}%
284 \let\adl@act@@vlineL\adl@@vlineL
285 \let\adl@act@@vlineR\adl@@vlineR
286 }%
287 }
288 \AddToHook{begindocument}[calc-noop]{}
289 \DeclareHookRule{begindocument}{calc-noop}{voids}{calc}
290 \def\@themark{{}{}}
291 \AddToHook{class/smfart/after}[firstaid]{%
292 \FirstAidNeededT{smfart}{cls}{2021/03/28 v1.6
293 Classe LaTeX pour les articles publies par la SMF}
294 {%
295 \def\leftmark{\expandafter\@leftmark\botmark\@empty\@empty}%
296 \def\rightmark{\expandafter\@rightmark\firstmark\@empty\@empty}%
297 }}
298 \AddToHook{class/smfbook/after}[firstaid]{%
299 \FirstAidNeededT{smfbook}{cls}{2021/03/28 v1.6
300 Classe LaTeX pour les monographies editees par la SMF}
301 {%
302 \def\leftmark{\expandafter\@leftmark\botmark\@empty\@empty}%
303 \def\rightmark{\expandafter\@rightmark\firstmark\@empty\@empty}%
304 }}
305 \ExplSyntaxOn
306 \cs_set:Npn \__shipout_force_immediate_writes: {
307 \cs_gset_eq:NN \iow_shipout:Nn \iow_now:Nn
308 \cs_gset_eq:NN \lua_shipout:n \lua_now:n
309 \cs_gset_eq:NN \__kernel_write_saved: \write
310 \cs_gset:Npn \write {\immediate \__kernel_write_saved:}
311 \global\advance\c@page\m@ne
312 }
313 \ExplSyntaxOff
314 \ExplSyntaxOn
315 \AddToHook{class/amsart/after}{
316 \DeclareRobustCommand*\markboth[2]{%
317 \mark_insert:nn{2e-left}{#1}
318 \mark_insert:nn{2e-right}{#2}
319 \tl_if_empty:nF{#2}{ \mark_insert:nn{2e-right-nonempty}{#2} }
320 }
321 \cs_set:Npn \leftmark {\mark_use_last:nn{page}{2e-left}}
322 \cs_set:Npn \rightmark {\mark_use_first:nn{page}{2e-right}}
323 }
324 \AddToHook{class/amsproc/after}{
325 \DeclareRobustCommand*\markboth[2]{%
326 \mark_insert:nn{2e-left}{#1}
327 \mark_insert:nn{2e-right}{#2}
328 \tl_if_empty:nF{#2}{ \mark_insert:nn{2e-right-nonempty}{#2} }
329 }
330 \cs_set:Npn \leftmark {\mark_use_last:nn{page}{2e-left}}
331 \cs_set:Npn \rightmark {\mark_use_first:nn{page}{2e-right}}
332 }
333 \ExplSyntaxOff
334 \AddToHook{package/listings/after}[firstaid]{%
335 \FirstAidNeededT{listings}{sty}{2024/09/23 1.10c (Carsten Heinz)}
336 {%
337 \def\@tempa#1#2#3{%
338 \gdef\lstnewenvironment@##1##2##3##4##5{%
339 \begingroup
340 \global\@namedef{end##2}{\lstenv@Error{##2}}%
341 \global\@namedef{##2}{\def\lstenv@name{##2}%
342 \begingroup \lst@setcatcodes \catcode\active=\active
343 \csname##2@\endcsname}%
344 \let\l@ngrel@x\global %<----
345 % The above was a bit of a hack in listings, making a command that
346 % was supposed to be either \long or \relax suddenly applying \global
347 %
348 % Since this doesn't any longer work with 2025/11
349 % let's replace it by an equally dubious hack :-() in this situation
350 \let\pr@tectedrel@x\global
351 % In order to work with both 2025/11 and earlier we keep both settings!
352 %
353 \let\@xargdef\lstenv@xargdef
354 \expandafter\new@command\csname##2@\endcsname##3%
355 {\lsthk@PreSet ##4%
356 \ifx\@currenvir\lstenv@name
357 \def\lstenv@endstring{#1#2##1#3}%
358 \else
359 \def\lstenv@endstring{#1##1}%
360 \fi
361 \@namedef{end##2}{\lst@DeInit ##5\endgroup
362 \lst@doendpe \@ignoretrue}%
363 \lsthk@DisplayStyle
364 \let\lst@EndProcessListing\lstenv@SkipToEnd
365 \lst@Init\lstenv@backslash
366 \lst@ifprint
367 \expandafter\expandafter\expandafter\lstenv@Process
368 \else
369 \expandafter\lstenv@SkipToEnd
370 \fi
371 \lst@insertargs}%
372 \endgroup}%
373 }
374 \let\lst@arg\@empty \lst@XConvert{end}\{\}\@nil
375 \expandafter\@tempa\lst@arg
376 }%
377 }
378 \endinput
379 %%
380 %% End of file `latex2e-first-aid-for-external-files.ltx'.