Debian Codegraph @

texmf-dist/source/latex/base/latexrelease.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 %
30 % \iffalse
31 %
32 %<*dtx>
33 \def\latexreleaseversion{<date only known in .sty file>}
34 \ProvidesFile{latexrelease.dtx}
35 %</dtx>
36 %<driver>\ProvidesFile{latexrelease.drv}
37 %<fixltx2e>\ProvidesPackage{fixltx2e}
38 %<fixltx2e> [2016/12/29 v2.1a fixes to LaTeX (obsolete)]
39 %<latexrelease>\ProvidesPackage{latexrelease}
40 %<*latexrelease>
41 % \fi
42 % \ProvidesFile{latexrelease.dtx}
43 [2025/01/31 v1.0q LaTeX release emulation and tests
44 (including releases up to \latexreleaseversion)]
45 % \iffalse
46 %</latexrelease>
47 %<*driver>
48 \documentclass{ltxdoc}
49 \newcommand\Lopt[1]{\textsf{#1}}
50 \let\Lpack\Lopt
51 \providecommand{\file}[1]{\texttt{#1}}
52 \providecommand{\MF}{\textsf{Metafont}}
53 \providecommand{\danger}{\marginpar[\hfill\protect\Huge!!]{\protect\Huge!!\hfill}}
54 \DeclareRobustCommand\cs[2][]{\texttt{\char`\\\detokenize{#2}}}
55 \DeclareRobustCommand\pkg[1]{\textsf{#1}}
56 \begin{document}
57 \DocInput{latexrelease.dtx}
58 \end{document}
59 %</driver>
60 % \fi
61 %
62 % \changes{v1.0i}{2017/12/17}{Add \cs{latexreleaseversion} info
63 % to \cs{ProvidesPackage} output}
64 %
65 %
66 % \let\package\textsf
67 %
68 %
69 % \GetFileInfo{latexrelease.dtx}
70 %
71 % \title{The \Lpack{latexrelease} package\thanks{This file
72 % has version number \fileversion, last
73 % revised \filedate.}}
74 % \author{The \LaTeX{} Project}
75 % \date{\filedate}
76 % \MaintainedByLaTeXTeam{latex}
77 % \maketitle
78 %
79 % \section{Introduction}
80 % Prior to the 2015 release of \LaTeX{}, essentially no changes had been
81 % made to the \LaTeX\ format code for some years, with all
82 % improvements being instead added to the package \Lpack{fixltx2e}.
83 %
84 % While this worked at a technical level it meant that you had to
85 % explicitly opt-in to bug fixes and improvements, and the vast
86 % majority of documents did not benefit.
87 %
88 % As described in \LaTeX\ News 22, a new policy is being implemented
89 % in which improvements will now be added to the format by default,
90 % and this \Lpack{latexrelease} package may be used to ensure
91 % stability where needed, either by making a new format use an older
92 % definition of some commands, or conversely may be used to supply the
93 % new definitions for use with an old format.
94 %
95 % The basic use is:
96 %\begin{verbatim}
97 % \RequirePackage[2015/01/01]{latexrelease}
98 % \documentclass{article}
99 % ....
100 %\end{verbatim}
101 %
102 % After such a declaration the document will use definitions current
103 % in the January 2015 \LaTeX{}, whether the actual format being used is
104 % older, or newer than that date. In the former case a copy of
105 % |latexrelease.sty| would need to be made available for use with the
106 % older format. This may be used, for example, to share a document
107 % between co-workers using different \LaTeX\ releases, or to protect a
108 % document from being affected by system updates. As well as the
109 % definitions within the format itself, individual packages may use
110 % the commands defined here to adjust their definitions to the
111 % specified date as described below.
112 %
113 % Note that the \Lpack{latexrelease} package is intended for use
114 % at the start of a \emph{document}. Package and class code should not
115 % include this package as loading a package should not normally globally
116 % reset the effective version of \LaTeX\ that is in force, so affecting all
117 % other packages used in the document.
118 %
119 %
120 % The bulk of this package, after some initial setup and option
121 % handling consists of a series of |\IncludeInRelease| commands
122 % which have been extracted from the main source files of the \LaTeX\
123 % format. These contain the old and new versions of any commands with
124 % modified definitions.
125 %
126 % \section{Package Options}
127 % \begin{itemize}
128 % \item \emph{yyyy/mm/dd} or \emph{yyyy-nn-dd}
129 % The package accepts any possible \LaTeX\ format date as argument,
130 % although dates in the future for which the current release of this
131 % package has no information will generate a warning. Dates
132 % earlier than 2015 will work but will roll back to some point in 2015
133 % when the method was introduced.
134 % The |\requestedLaTeXdate| is set to the normalized date argument
135 % so that package rollback defaults to the specified date.
136 %
137 % \item%
138 % |current| This is the default behaviour, it does not change the
139 % effective date of the format but does ensure that the
140 % |\IncludeInRelease| command is defined.
141 % The |\requestedLaTeXdate| macro is reset to 0 so that package rollback
142 % does not use the implicit date.
143 %
144 % \item
145 % |latest| sets the effective date of the format to the release date
146 % of this file, so in an older format applies all patches currently
147 % available.
148 % The |\requestedLaTeXdate| macro is reset to 0 so that package rollback
149 % does not use the implicit date.
150 % \end{itemize}
151 %
152 % In all cases, when the package is loaded, the |\sourceLaTeXdate| is
153 % defined to be the numerical representation of |\fmtversion| before the
154 % rollback/forward actually happens, so it is possible to test from which
155 % was the original \LaTeX{} version before \Lpack{latexrelease} was loaded.
156 % This is particularly useful when some code in a package has to be
157 % redefined differently if rolling backwards in time or forwards.
158 %
159 % \section{Release Specific Code}
160 %
161 % The |\IncludeInRelease| mechanism allows the kernel developer to
162 % associate code with a specific date to choose different versions of
163 % definitions depending on the date specified as an option to the
164 % \Lpack{latexrelease} package. Is also available for use by package
165 % authors (or even in a document if necessary).
166 %
167 % \medskip
168 %
169 % \noindent\DescribeMacro{\IncludeInRelease}
170 % \marg{code-date}^^A
171 % \oarg{format-date}%^^A
172 % \marg{label}^^A
173 % \marg{message}^^A
174 % \meta{code}^^A
175 % |\EndIncludeInRelease|
176 %
177 % \begin{description}
178 %
179 % \item[\marg{code-date}] This date is associated with the \marg{code}
180 % argument and will be compared to the requested date in the option to
181 % the \Lpack{latexrelease}.
182 %
183 % \item[\oarg{format-date}] This optional argument can be used to
184 % specify a format date with the code in addition to the mandatory
185 % \marg{code-date} argument. This can be useful for package developers
186 % as described below.
187 %
188 % \item[\marg{label}] The \marg{label} argument is an identifier
189 % (string) that within a given package must be a unique label for each
190 % related set of optional definitions. Per package at most one code
191 % block from all the |\IncludeInRelease| declarations with the same
192 % label will be executed.
193 %
194 % \item[\marg{message}]
195 % The \marg{message} is an informative string that is used in
196 % messages. It has no other function.
197 %
198 % \item[\meta{code}]
199 % Any \TeX\ code after the |\IncludeInRelease| arguments
200 % up until the and the following |\EndIncludeInRelease|
201 % is to be
202 % conditionally included depending on the date of the format as
203 % described below.
204 %
205 % \end{description}
206 %
207 % The |\IncludeInRelease| declarations with a given label should be in
208 % reverse chronological order in the file. The one chosen will depend
209 % on this order, the effective format version and the date options, as
210 % described below.
211 %
212 % If your package \Lpack{mypackage} defines a |\widget| command but
213 % has one definition using the features available in the 2015 \LaTeX\
214 % release, and a different definition is required for older formats
215 % then you can use:
216 %\begin{verbatim}
217 % \IncludeInRelease{2015/01/01}{\widget}{Widget Definition}
218 % \def\widget{new version}%
219 % \EndIncludeInRelease
220 %
221 % \IncludeInRelease{0000/00/00}{\widget}{Widget Definition}
222 % \def\widget{old version}%
223 % \EndIncludeInRelease
224 %\end{verbatim}
225 %
226 % If a document using this package is used with a format with
227 % effective release date of 2015/01/01 or later the new code will be
228 % used, otherwise the old code will be used. Note the \emph{effective
229 % release date} might be the original \LaTeX\ release date as shown at
230 % the start of every \LaTeX\ job, or it may be set by the
231 % \Lpack{latexrelease} package, so for example a document author who
232 % wants to ensure the new version is used could use
233 %\begin{verbatim}
234 % \RequirePackage[2015/01/01]{latexrelease}
235 % \documentclass{article}
236 % \usepackage{mypackage}
237 %\end{verbatim}
238 %
239 % If the document is used with a \LaTeX\ format from 2014 or before,
240 % then \Lpack{latexrelease} will not have been part of the original
241 % distribution, but it may be obtained from a later \LaTeX\ release or
242 % from CTAN and distributed with the document, it will make an older
243 % \LaTeX\ release act essentially like the 2015 release.
244 %
245 % \subsection{Intermediate Package Releases}
246 %
247 % The above example works well for testing against the latex format
248 % but is not always ideal for controlling code by the release date of
249 % the \emph{package}. Suppose \LaTeX\ is not updated but in March you
250 % update the \Lpack{mypackage} package and modify the definition of
251 % |\widget|. You could code the package as:
252 %\begin{verbatim}
253 % \IncludeInRelease{2015/03/01}{\widget}{Widget Definition}
254 % \def\widget{even newer improved March version}%
255 % \EndIncludeInRelease
256 %
257 % \IncludeInRelease{2015/01/01}{\widget}{Widget Definition}
258 % \def\widget{new version}%
259 % \EndIncludeInRelease
260 %
261 % \IncludeInRelease{0000/00/00}{\widget}{Widget Definition}
262 % \def\widget{old version}%
263 % \EndIncludeInRelease
264 %\end{verbatim}
265 %
266 % This would work and allow a document author to choose a date such as
267 %\begin{verbatim}
268 % \RequirePackage[2015/03/01]{latexrelease}
269 % \documentclass{article}
270 % \usepackage{mypackage}
271 %\end{verbatim}
272 %
273 % To use the latest version, however it would have disadvantage that
274 % until the next release of \LaTeX, by default, if the document does
275 % not use \Lpack{latexrelease} to specify a date, the new improved
276 % code will not be selected as the effective date will be 2015/01/01
277 % and so the first code block will be skipped.
278 %
279 % For this reason |\IncludeInRelease| has an optional argument that
280 % specifies an alternative date to use if a date option has not been
281 % specified to \Lpack{latexrelease}.
282 %\begin{verbatim}
283 % \IncludeInRelease{2015/03/01}[2015/01/01]{\widget}{Widget Definition}
284 % \def\widget{even newer improved March version}%
285 % \EndIncludeInRelease
286 %
287 % \IncludeInRelease{2015/01/01}{\widget}{Widget Definition}
288 % \def\widget{new version}%
289 % \EndIncludeInRelease
290 %
291 % \IncludeInRelease{0000/00/00}{\widget}{Widget Definition}
292 % \def\widget{old version}%
293 % \EndIncludeInRelease
294 %\end{verbatim}
295 %
296 % Now, by default on a 2015/01/01 \LaTeX\ format, the first code block
297 % will compare the format date to the optional argument 2015/01/01
298 % and so will execute the \emph{even newer improved} version. The
299 % remaining blocks using the |\widget| label argument will all then be
300 % skipped.
301 %
302 % If on the other hand the document requests an explicit release date
303 % using \Lpack{latexrelease} then this date will be used to decide what
304 % code block to include.
305 %
306 % \subsection{Using \cs{IncludeInRelease} in Packages}
307 %
308 % If |\IncludeInRelease| is used within a package then all such
309 % conditional code needs to be within such declarations, e.g., it is
310 % not possible in the above example to have the ``current'' definition
311 % of |\widget| somewhere in the main code and only the two older
312 % definitions inside |\IncludeInRelease| declarations. If you would do
313 % this then one of those |\IncludeInRelease| declarations would be
314 % included overwriting the even newer code in the main part of the
315 % package. As a result your package may get fragmented over time with
316 % various |\IncludeInRelease| declarations sprinkled throughout your
317 % code or you have to interrupt the reading flow by putting those
318 % declarations together but not necessarily in the place where they
319 % belong.
320 %
321 % To avoid this issue you can use the following coding
322 % strategy: place the current |\widget| definition in the main code
323 % where it correctly belongs.
324 % \begin{verbatim}
325 % ...
326 % \def\widget {even newer improved March version}
327 % \def\@widget{newly added helper command no defined in older releases}
328 % ...
329 %\end{verbatim}
330 % Then, near the end of your package place
331 % the following:
332 % \begin{verbatim}
333 % \IncludeInRelease{2015/03/01}[2015/01/01]{\widget}{Widget Definition}
334 % \EndIncludeInRelease
335 %
336 % \IncludeInRelease{2015/01/01}{\widget}{Widget Definition}
337 % \def\widget{new version}%
338 % \let\@widget\@undefined % this doesn't exist in earlier releases
339 % \EndIncludeInRelease
340 %
341 % \IncludeInRelease{0000/00/00}{\widget}{Widget Definition}
342 % \def\widget{old version}%
343 % \EndIncludeInRelease
344 %\end{verbatim}
345 % This way the empty code block hides the other |\IncludeInRelease|
346 % declarations unless there is an explicit request with a date
347 % 2015/01/01 or earlier.
348 %
349 % Now if you make a further change to |\widget| in the future you
350 % simply copy the current definition into the empty block and add a new
351 % empty declaration with today's date and the current format date. This
352 % way your main code stays readable and the old versions accumulate at
353 % the end of the package.\footnote{Of course there may be some cases
354 % in which the old code has to be in a specific place within the
355 % package as other code depends on it (e.g., if you
356 % \texttt{\string\let} something to it). In that case you have to
357 % place the code variations in the right place in your package rather
358 % than accumulating them at the very end.}
359 %
360 % The only other ``extra effort'' necessary when using this approach
361 % is that it may be advisable to undo new definitions in the code
362 % block for the previous release, e.g., in the above example we
363 % undefined |\@widget| as that isn't available in the 2015/01/01
364 % release but was defined in the main code. If all your conditional
365 % code is within |\IncludeInRelease| declarations that wouldn't been
366 % necessary as the new code only gets defined if that release is
367 % chosen.
368 %
369 % \section{Declaring entire modules}
370 %
371 % Sometimes a large chunk of code is added as a module to another larger
372 % code base. As example of that in the 2020-10-01 release \LaTeX{} got
373 % a new hook management system, \pkg{lthooks}, which was added in one go
374 % and, as with all changes to the kernel, it was added to
375 % \pkg{latexrelease}. However rolling back from a future date to the
376 % 2020-10-01 release didn't work because \pkg{latexrelease} would try to
377 % define again all those commands, which would result in many
378 % ``already defined'' errors and similar issues.
379 %
380 % To solve that problem, completely new modules can be defined in
381 % \pkg{latexrelease} using the commands:
382 % \begin{quote}
383 % \cs{NewModuleRelease}%^^A
384 % \verb|{|\meta{initial release date}%^^A
385 % \verb|}{|\meta{name}\verb|}{|\meta{message}\verb|}|\\
386 % \null\quad\meta{module code}\\
387 % \cs{IncludeInRelease}%^^A
388 % \verb|{0000/00/00}{|\meta{name}\verb|}{|\meta{message}\verb|}|\\
389 % \null\quad\meta{undefine module code}\\
390 % \cs{EndModuleRelease}
391 % \end{quote}
392 % With that setup, the module \meta{name} will be declared to exist only
393 % in releases equal or later \meta{initial release date}.
394 %
395 % If \pkg{latexrelease} is rolling backwards or forwards between dates
396 % after \meta{initial release date}, then all the \meta{module code} is
397 % skipped, except when inside \meta{IncludeInRelease} guards, in which
398 % case the code is applied or skipped as discussed above.
399 %
400 % If rolling forward from a date before the module's \meta{initial
401 % release date} to a date after that, then all the \meta{module code} is
402 % executed to define the module, and \cs{IncludeInRelease} guards are
403 % executed accordingly, depending on the date declared and the target
404 % date.
405 %
406 % If \pkg{latexrelease} is rolling back to a date before \meta{release
407 % date}, then the code in the \cs{IncludeInRelease} guard dated
408 % \verb|0000/00/00| is executed instead to undefine the module. This
409 % guard \emph{is not} ended by the usual \cs{EndIncludeInRelease}, but
410 % instead by \cs{EndModuleRelease}.
411 %
412 % Finally, if rolling backwards or forwards between dates both before
413 % \meta{initial release date}, the entire code between
414 % \meta{NewModuleRelease} and \meta{EndModuleRelease} is entirely
415 % skipped.
416 %
417 % \subsection{Example}
418 %
419 % Here is an example usage of the structure described above, as it would
420 % be used in the \LaTeX{} kernel, taking \pkg{lthooks} as example:
421 % \begin{verbatim}
422 % %<*2ekernel|latexrelease>
423 % \ExplSyntaxOn
424 % %<latexrelease>\NewModuleRelease{2020/10/01}{lthooks}%
425 % %<latexrelease> {The~hook~management~system}
426 % \NewDocumentCommand \NewHook { m }
427 % { \hook_new:n {#1} }
428 % %<latexrelease>\IncludeInRelease{2021/06/01}{\AddToHook}{Long~argument}
429 % \NewDocumentCommand \AddToHook { m o +m }
430 % { \hook_gput_code:nnn {#1} {#2} {#3} }
431 % %<latexrelease>\EndIncludeInRelease
432 % %<latexrelease>
433 % %<latexrelease>\IncludeInRelease{2020/10/01}{\AddToHook}{Long~argument}
434 % %<latexrelease>\NewDocumentCommand \AddToHook { m o m }
435 % %<latexrelease> { \hook_gput_code:nnn {#1} {#2} {#3} }
436 % %<latexrelease>\EndIncludeInRelease
437 % %<latexrelease>
438 % %<latexrelease>\IncludeInRelease{0000/00/00}{lthooks}{Undefine~lthooks}
439 % %<latexrelease>\cs_undefine:N \NewHook
440 % %<latexrelease>\cs_undefine:N \AddToHook
441 % %<latexrelease>\EndModuleRelease
442 % \ExplSyntaxOff
443 % %</2ekernel|latexrelease>
444 % \end{verbatim}
445 %
446 % In the example above, \cs{NewHook} is declared only once, and
447 % unchanged in the next release (2021/06/01 in the example), so it has
448 % no \cs{IncludeInRelease} guards, and will only be defined if needed.
449 % \cs{AddToHook}, on the other hand, changed between the two releases
450 % (made up for the example; it didn't really happen)
451 % and has an \cs{IncludeInRelease} block for the current release (off
452 % \pkg{docstrip} guards, so it goes into the kernel too), and another
453 % for the previous release (in \pkg{docstrip} guards so it goes only
454 % into \pkg{latexrelease}).
455 %
456 % Note that in the example above, \cs{ExplSyntaxOn} and
457 % \cs{ExplSyntaxOff} were added \emph{outside} the module code because,
458 % as discussed above, sometimes the code outside \cs{IncludeInRelease}
459 % guards may be skipped, but not the code inside them, and in that case
460 % the catcodes would be wrong when defining the code.
461 %
462 % \section{fixltx2e}
463 %
464 % As noted above, prior to the 2015 \LaTeX\ release updates to the
465 % \LaTeX\ kernel were not made in the format source files but were
466 % made available in the \Lpack{fixltx2e} package. That package is no
467 % longer needed but we generate a small package from this source
468 % that just makes a warning message but otherwise does nothing.
469 %
470 %
471 %
472 %
473 %
474 % \MaybeStop{}
475 %
476 % \section{Implementation}
477 %
478 % We require at least a somewhat sane version of \LaTeXe{}. Earlier
479 % ones where really quite different from one another.
480 % \begin{macrocode}
481 %<*latexrelease>
482 \NeedsTeXFormat{LaTeX2e}[1996/06/01]
483 % \end{macrocode}
484 %
485 % \subsection{Setup}
486 %
487 % \begin{macro}{\sourceLaTeXdate}
488 % \changes{v1.0l}{2021/01/23}{\cs{sourceLaTeXdate} added}
489 % \changes{v1.0m}{2021/03/18}{Define \cs{sourceLaTeXdate} conditionally}
490 % Store the original \LaTeX{} format version as a number in the format
491 % |YYYYMMDD |. This macro has to be defined conditionally, so that it
492 % isn't changed in case \file{latexrelease.sty} is reloaded, but it
493 % can't be defined in the kernel only, otherwise
494 % \file{latexrelease.sty} wouldn't work in older \LaTeX{} due
495 % to the missing macro.
496 % \begin{macrocode}
497 \@ifundefined{sourceLaTeXdate}{%
498 \edef\sourceLaTeXdate{%
499 \expandafter\@parse@version\fmtversion//00\@nil}}{}%
500 % \end{macrocode}
501 % \end{macro}
502 %
503 % \begin{macro}{\IncludeInRelease}
504 % \begin{macro}{\EndIncludeInRelease}
505 % These are defined in \file{ltvers.dtx}.
506 % \end{macro}
507 % \end{macro}
508 %
509 % \changes{v1.0c}{2015/02/19}{Swap argument order}
510 % \changes{v1.0k}{2018/05/08}{reset \cs{requestedLaTeXdate} for current
511 % and latest options, github issue 43}
512 % \begin{macrocode}
513 \DeclareOption*{%
514 \def\@IncludeInRelease#1[#2]{\@IncludeInRele@se{#1}}%
515 \let\requestedpatchdate\CurrentOption}
516 \DeclareOption{latest}{%
517 \let\requestedpatchdate\latexreleaseversion
518 \AtEndOfPackage{\def\requestedLaTeXdate{0}}}
519 \DeclareOption{current}{%
520 \let\requestedpatchdate\fmtversion
521 \AtEndOfPackage{\def\requestedLaTeXdate{0}}}
522 % \end{macrocode}
523 %
524 % \begin{macrocode}
525 \let\requestedpatchdate\fmtversion
526 \ProcessOptions\relax
527 % \end{macrocode}
528 %
529 % Sanity check options, it allows some non-legal dates but always
530 % ensures |requestedLaTeXdate| gets set to a number. Generate an
531 % error if there are any non digit tokens remaining after removing the
532 % |//|.
533 % \changes{v1.0j}{2018/01/30}{Explain both date formats in error message}
534 % \begin{macrocode}
535 \def\reserved@a{%
536 \edef\requestedLaTeXdate{\the\count@}%
537 \reserved@b}
538 \def\reserved@b#1\\{%
539 \def\reserved@b{#1}%
540 \ifx\reserved@b\@empty\else
541 \PackageError{latexrelease}%
542 {Unexpected option \requestedpatchdate}%
543 {The option must be of the form yyyy/mm/dd or yyyy-mm-dd}%
544 \fi}
545 \afterassignment\reserved@a
546 \count@\expandafter
547 \@parse@version\expandafter0\requestedpatchdate//00\@nil\\
548 % \end{macrocode}
549 %
550 % less precautions needed for |\fmtversion|
551 % \begin{macrocode}
552 \edef\currentLaTeXdate{%
553 \expandafter\@parse@version\fmtversion//00\@nil}
554 % \end{macrocode}
555 %
556 % \begin{macrocode}
557 \ifnum\requestedLaTeXdate=\currentLaTeXdate
558 \PackageWarningNoLine{latexrelease}{%
559 Current format date selected, no patches applied}
560 \expandafter\endinput
561 \fi
562 % \end{macrocode}
563 %
564 % A newer version of latexrelease should have been distributed with
565 % the later format.
566 % \begin{macrocode}
567 \ifnum\currentLaTeXdate
568 >\expandafter\@parse@version\latexreleaseversion//00\@nil
569 \PackageWarningNoLine{latexrelease}{%
570 The current package is for an older LaTeX format:\MessageBreak
571 LaTeX \latexreleaseversion\space\MessageBreak
572 Obtain a newer version of this package!}
573 \expandafter\endinput
574 \fi
575 % \end{macrocode}
576 % can't patch into the future, could make this an error
577 % but it has some uses to control package updates
578 % so allow for now.
579 % \begin{macrocode}
580 \ifnum\requestedLaTeXdate
581 >\expandafter\@parse@version\latexreleaseversion//00\@nil
582 \PackageWarningNoLine{latexrelease}{%
583 The current package is for LaTeX \latexreleaseversion:\MessageBreak
584 It has no patches beyond that date\MessageBreak
585 There may be an updated version\MessageBreak
586 of this package available from CTAN}
587 \expandafter\endinput
588 \fi
589 % \end{macrocode}
590 %
591 % Update the format version to the requested date.
592 % \begin{macrocode}
593 \let\fmtversion\requestedpatchdate
594 \let\currentLaTeXdate\requestedLaTeXdate
595 % \end{macrocode}
596 %
597 %
598 % \subsection{Ignoring \texttt{\string_new} errors when rolling back}
599 %
600 % Enforce \cs{ExplSyntaxOn} and \cs{ExplSyntaxOff} to be \cs{relax} in
601 % \pkg{latexrelease} if they are not yet defined. They are later
602 % restored to be undefined if needed.
603 % \begin{macrocode}
604 \csname ExplSyntaxOn\endcsname
605 \csname ExplSyntaxOff\endcsname
606 % \end{macrocode}
607 %
608 % \changes{v1.0m}{2021/03/18}
609 % {Make \texttt{\string_new} definitions harmless}
610 %
611 % Define a set of changes here, but we'll only use them later to make
612 % sure they are applied after \pkg{expl3} is loaded. If loading from a
613 % rather old format, we don't have \cs{ExplSyntaxOn} yet.
614 % \begin{macrocode}
615 \begingroup
616 \endlinechar=-1
617 \catcode95=11 % _
618 \catcode58=11 % :
619 \catcode126=10 % ~
620 \catcode32=09 % <space>
621 \xdef\latexrelease@postltexpl{\unexpanded{%
622 %<@@=latexrelease>
623 % \end{macrocode}
624 %
625 % First we'll define a \cs{declarecommand} that does \cs{renewcommand}
626 % if the command being defined already exists, and \cs{newcommand}
627 % otherwise.
628 % \begin{macrocode}
629 \cs_gset_protected:Npn \@@_declare_command:w
630 { \@star@or@long \@@_declare_command:Nw }
631 \cs_gset_protected:Npn \@@_declare_command:Nw #1
632 { \cs_if_exist:NTF #1 { \renew@command } { \new@command } #1 }
633 % \end{macrocode}
634 %
635 % Then define a version of \cs{e@alloc} that checks if the control
636 % sequence being defined already exists, and if so, checks if its
637 % meaning is the same as the one that would be defined with the call to
638 % \cs{e@alloc}. If both tests pass, nothing is defined to save a
639 % register. This version also takes care of setting
640 % \cs{allocationnumber} to the value it would have after the register is
641 % allocated.
642 % \begin{macrocode}
643 \cs_gset_protected:Npn \@@_e@alloc:NnnnnN #1 #2 #3 #4 #5 #6
644 {
645 \cs_if_free:NTF #6
646 { \use:n }
647 {
648 \exp_after:wN \@@_e@alloc:N
649 \token_to_meaning:N #6 \scan_stop: {#2} #6
650 }
651 { \@@_e@alloc #1 {#2} {#3} {#4} {#5} #6 }
652 }
653 % \end{macrocode}
654 % Walk through the meaning of the control sequence token by token,
655 % looking for the register allocation number.
656 % \begin{macrocode}
657 \cs_gset_protected:Npn \@@_e@alloc:N #1
658 {
659 \if_int_compare:w 0 < 0
660 \if_int_compare:w 10 < 9#1 ~ 1 \fi:
661 \if_charcode:w " #1 1 \fi: \exp_stop_f:
662 \tex_afterassignment:D \@@_e@alloc:w
663 \@tempcnta #1
664 \use_i:nnn
665 \fi:
666 \use:n
667 {
668 \if_meaning:w \scan_stop: #1
669 \exp_after:wN \use_iv:nnnn
670 \fi:
671 \@@_e@alloc:N
672 }
673 }
674 % \end{macrocode}
675 % When found, check if it is the exact same register as it would be
676 % allocated, and if it is, set \cs{allocationnumber} accordingly and
677 % exit, otherwise undefine the register and allocate from scratch.
678 % \begin{macrocode}
679 \cs_gset_protected:Npn \@@_e@alloc:w #1 \scan_stop: #2 #3
680 {
681 #2 \@@_tmp:w = \@tempcnta
682 \token_if_eq_meaning:NNTF #3 \@@_tmp:w
683 { \int_set_eq:NN \allocationnumber \@tempcnta \use_none:n }
684 { \cs_set_eq:NN #3 \tex_undefined:D \use:n }
685 }
686 % \end{macrocode}
687 %
688 % Now create a token list to hold the list of changed commands, and
689 % define a temporary macro that will loop through the command list,
690 % store each in \cs{l_@@_restores_tl}, save a copy, and redefine each.
691 % \begin{macrocode}
692 \tl_clear_new:N \l_@@_restores_tl
693 \cs_gset:Npn \@@_redefines:w #1 #2
694 {
695 \quark_if_recursion_tail_stop:N #1
696 \tl_put_right:Nn \l_@@_restores_tl {#1}
697 \cs_set_eq:cN { @@_ \cs_to_str:N #1 } #1
698 \cs_set_eq:NN #1 #2
699 \@@_redefines:w
700 }
701 % \end{macrocode}
702 %
703 % The redefinitions below are needed because:
704 % \begin{description}
705 % \def\makelabel#1{\cs{#1}}
706 % \item[__kernel_chk_if_free_cs:N] This function is used ubiquitously
707 % in the \pkg{l3kernel} to check if a control sequence is definable,
708 % and give an error otherwise (similar to \cs{@ifdefinable}).
709 % Making it a no-op is enough for most cases (except when defining
710 % new registers);
711 % \item[e@alloc] In the case of new registers, we waste an allocation
712 % number if we do \cs[no-index]{new\meta{thing}} in a register
713 % that's already allocated, so the redefinition of \cs{e@alloc}
714 % checks if the new register is really necessary. This code does
715 % not clear the register, which might cause problems in the future,
716 % if a register is allocated but not properly cleared before using;
717 % \item[__kernel_msg_error:nnx] This command is used to error on
718 % already defined scan marks. Just making the error do nothing is
719 % enough, as no action is taken in that case;
720 % \item[msg_new:nnnn] Used to define new messages. Making it
721 % \texttt{\string_gset} is enough. Other msg commands like
722 % \cs{msg_new:nnn} and \cs[no-index]{__kernel_msg_new:nnn(n)} are
723 % defined in terms of \cs{msg_new:nnnn}, so there is no need to
724 % change the other ones;
725 % \item[NewDocumentCommand] Used to define user-level commands in the
726 % kernel. Making it equal to \cs{DeclareDocumentCommand} solves the
727 % problem;
728 % \item[newcommand] Same as above.
729 % \end{description}
730 % And here we go:
731 % \begin{macrocode}
732 \@@_redefines:w
733 \__kernel_chk_if_free_cs:N \use_none:n
734 \e@alloc \@@_e@alloc:NnnnnN
735 \__kernel_msg_error:nnx \use_none:nnn
736 \msg_new:nnnn \msg_gset:nnnn
737 % \NewDocumentCommand \DeclareDocumentCommand % after ltcmd.dtx
738 \newcommand \@@_declare_command:w
739 % \end{macrocode}
740 % Temp addition \ldots
741 % \begin{macrocode}
742 \__kernel_msg_error:nnn \use_none:nnn % needed while redirect for kernel msgs doesn't work
743 \q_recursion_tail \q_recursion_tail
744 \q_recursion_stop
745 % \end{macrocode}
746 %
747 % Finally, redirect the error thrown by \cs{NewHook} to nowhere so it
748 % can be safely reused (the hook isn't redeclared if it already exists).
749 % The same happens for \cs{NewMarkClass}.
750 % \changes{v1.0p}{2022/11/14}
751 % {Silence \cs{NewMarkClass} in rollback (gh/955)}
752 % \begin{macrocode}
753 \msg_redirect_name:nnn { hooks } { exists } { none }
754 \msg_redirect_name:nnn { mark } { class-already-defined }{ none }
755 % \end{macrocode}
756 %
757 % The same is also needed for \cs{NewSocket} and \cs{NewSocketPlug}.
758 % \changes{v1.0q}{2025/01/31}
759 % {Silence \cs{NewSocket} and \cs{NewSocketPlug} in rollback}
760 % \begin{macrocode}
761 \msg_redirect_name:nnn { socket } { already-declared } { none }
762 \msg_redirect_name:nnn { socket } { plug-already-declared } { none }
763 % \end{macrocode}
764 %
765 % Now a one-off for |ltcmd.dtx|: we need to make \cs{NewDocumentCommand}
766 % not complain on an already existing command, but it has to be done
767 % after \cs{NewDocumentCommand} is defined, so this is separate from
768 % the \cs{latexrelease@postltexpl} actions above:
769 % \changes{v1.0o}{2022/02/28}
770 % {Move most redefinitions to right after ltexpl.dtx}
771 % \begin{macrocode}
772 \cs_gset_protected:Npn \latexrelease@postltcmd
773 {
774 \@@_redefines:w
775 \NewDocumentCommand \DeclareDocumentCommand
776 \q_recursion_tail \q_recursion_tail
777 \q_recursion_stop
778 }
779 % \end{macrocode}
780 %
781 % \begin{macrocode}
782 }}%
783 \endgroup
784 %</latexrelease>
785 % \end{macrocode}
786 %
787 % \subsection{Undoing the temp modifications}
788 %
789 % If \cs{ExplSyntaxOn} exists (defined and not equal \cs{relax}), then
790 % use the \pkg{expl3} restore code, otherwise restore \cs{ExplSyntaxOn}
791 % and \cs{ExplSyntaxOff} to be undefined.
792 % \begin{macrocode}
793 %<*latexrelease-finish>
794 \@ifundefined{ExplSyntaxOn}%
795 {\let\ExplSyntaxOn\@undefined
796 \let\ExplSyntaxOff\@undefined
797 \@gobble}%
798 {\ExplSyntaxOn
799 \@firstofone}%
800 {%
801 % \end{macrocode}
802 %
803 % Now just loop through the list of redefined commands and restore their
804 % previous meanings.
805 % \begin{macrocode}
806 \tl_map_inline:Nn \l_@@_restores_tl
807 {
808 \cs_set_eq:Nc #1 { @@_ \cs_to_str:N #1 }
809 \cs_undefine:c { @@_ \cs_to_str:N #1 }
810 }
811 \tl_clear:N \l_@@_restores_tl
812 % \end{macrocode}
813 %
814 % And restore the silenced error messages.
815 % \changes{v1.0p}{2022/11/14}
816 % {Unsilence \cs{NewMarkClass} error message after rollback (gh/955)}
817 % \changes{v1.0q}{2025/01/31}
818 % {Unsilence \cs{NewSocket} and \cs{NewSocketPlug} error message
819 % after rollback}
820 % \begin{macrocode}
821 \msg_redirect_name:nnn { hooks } { exists } { }
822 \msg_redirect_name:nnn { mark } { class-already-defined } { }
823 \msg_redirect_name:nnn { socket } { already-declared } { }
824 \msg_redirect_name:nnn { socket } { plug-already-declared } { }
825 % \end{macrocode}
826 %
827 % \begin{macrocode}
828 %<@@=>
829 \ExplSyntaxOff}%
830 %</latexrelease-finish>
831 % \end{macrocode}
832 %
833 % \subsection{Individual Changes}
834 %
835 % The code for each change will be inserted at this point, extracted
836 % from the kernel source files.
837 %
838 %
839 % \subsection{fixltx2e}
840 %
841 % Generate a stub \Lpack{fixltx2e} package:
842 % \begin{macrocode}
843 %<*fixltx2e>
844 \IncludeInRelease{2015/01/01}{\fixltxe}{Old fixltx2e package}
845 \NeedsTeXFormat{LaTeX2e}
846 \PackageWarningNoLine{fixltx2e}{%
847 fixltx2e is not required with releases after 2015\MessageBreak
848 All fixes are now in the LaTeX kernel.\MessageBreak
849 See the latexrelease package for details}
850 \EndIncludeInRelease
851 \IncludeInRelease{0000/00/00}{\fixltxe}{Old fixltx2e package}
852 \def\@outputdblcol{%
853 \if@firstcolumn
854 \global\@firstcolumnfalse
855 \global\setbox\@leftcolumn\copy\@outputbox
856 \splitmaxdepth\maxdimen
857 \vbadness\maxdimen
858 \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
859 \setbox\@outputbox\vsplit\@outputbox to\maxdimen
860 \toks@\expandafter{\topmark}%
861 \xdef\@firstcoltopmark{\the\toks@}%
862 \toks@\expandafter{\splitfirstmark}%
863 \xdef\@firstcolfirstmark{\the\toks@}%
864 \ifx\@firstcolfirstmark\@empty
865 \global\let\@setmarks\relax
866 \else
867 \gdef\@setmarks{%
868 \let\firstmark\@firstcolfirstmark
869 \let\topmark\@firstcoltopmark}%
870 \fi
871 \else
872 \global\@firstcolumntrue
873 \setbox\@outputbox\vbox{%
874 \hb@xt@\textwidth{%
875 \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
876 \hfil
877 {\normalcolor\vrule \@width\columnseprule}%
878 \hfil
879 \hb@xt@\columnwidth{\box\@outputbox \hss}}}%
880 \@combinedblfloats
881 \@setmarks
882 \@outputpage
883 \begingroup
884 \@dblfloatplacement
885 \@startdblcolumn
886 \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}%
887 \endgroup
888 \fi}
889 \def\end@dblfloat{%
890 \if@twocolumn
891 \@endfloatbox
892 \ifnum\@floatpenalty <\z@
893 \@largefloatcheck
894 \global\dp\@currbox1sp %
895 \@cons\@currlist\@currbox
896 \ifnum\@floatpenalty <-\@Mii
897 \penalty -\@Miv
898 \@tempdima\prevdepth
899 \vbox{}%
900 \prevdepth\@tempdima
901 \penalty\@floatpenalty
902 \else
903 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
904 \fi
905 \fi
906 \else
907 \end@float
908 \fi
909 }
910 \def\@testwrongwidth #1{%
911 \ifdim\dp#1=\f@depth
912 \else
913 \global\@testtrue
914 \fi}
915 \let\f@depth\z@
916 \def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber
917 \global\@dbltoproom \dbltopfraction\@colht
918 \@textmin \@colht
919 \advance \@textmin -\@dbltoproom
920 \@fpmin \dblfloatpagefraction\textheight
921 \@fptop \@dblfptop
922 \@fpsep \@dblfpsep
923 \@fpbot \@dblfpbot
924 \def\f@depth{1sp}}
925 \def \@doclearpage {%
926 \ifvoid\footins
927 \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
928 \setbox\@tempboxa\box\@cclv
929 \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
930 \global \let \@toplist \@empty
931 \global \let \@botlist \@empty
932 \global \@colroom \@colht
933 \ifx \@currlist\@empty
934 \else
935 \@latexerr{Float(s) lost}\@ehb
936 \global \let \@currlist \@empty
937 \fi
938 \@makefcolumn\@deferlist
939 \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
940 \if@twocolumn
941 \if@firstcolumn
942 \xdef\@deferlist{\@dbltoplist\@deferlist}%
943 \global \let \@dbltoplist \@empty
944 \global \@colht \textheight
945 \begingroup
946 \@dblfloatplacement
947 \@makefcolumn\@deferlist
948 \@whilesw\if@fcolmade \fi{\@outputpage
949 \@makefcolumn\@deferlist}%
950 \endgroup
951 \else
952 \vbox{}\clearpage
953 \fi
954 \fi
955 \ifx\@deferlist\@empty \else\clearpage \fi
956 \else
957 \setbox\@cclv\vbox{\box\@cclv\vfil}%
958 \@makecol\@opcol
959 \clearpage
960 \fi
961 }
962 \def \@startdblcolumn {%
963 \@tryfcolumn \@deferlist
964 \if@fcolmade
965 \else
966 \begingroup
967 \let \reserved@b \@deferlist
968 \global \let \@deferlist \@empty
969 \let \@elt \@sdblcolelt
970 \reserved@b
971 \endgroup
972 \fi
973 }
974 \def\@addtonextcol{%
975 \begingroup
976 \@insertfalse
977 \@setfloattypecounts
978 \ifnum \@fpstype=8
979 \else
980 \ifnum \@fpstype=24
981 \else
982 \@flsettextmin
983 \@reqcolroom \ht\@currbox
984 \advance \@reqcolroom \@textmin
985 \ifdim \@colroom>\@reqcolroom
986 \@flsetnum \@colnum
987 \ifnum\@colnum>\z@
988 \@bitor\@currtype\@deferlist
989 \@testwrongwidth\@currbox
990 \if@test
991 \else
992 \@addtotoporbot
993 \fi
994 \fi
995 \fi
996 \fi
997 \fi
998 \if@insert
999 \else
1000 \@cons\@deferlist\@currbox
1001 \fi
1002 \endgroup
1003 }
1004 \def\@addtodblcol{%
1005 \begingroup
1006 \@insertfalse
1007 \@setfloattypecounts
1008 \@getfpsbit \tw@
1009 \ifodd\@tempcnta
1010 \@flsetnum \@dbltopnum
1011 \ifnum \@dbltopnum>\z@
1012 \@tempswafalse
1013 \ifdim \@dbltoproom>\ht\@currbox
1014 \@tempswatrue
1015 \else
1016 \ifnum \@fpstype<\sixt@@n
1017 \advance \@dbltoproom \@textmin
1018 \ifdim \@dbltoproom>\ht\@currbox
1019 \@tempswatrue
1020 \fi
1021 \advance \@dbltoproom -\@textmin
1022 \fi
1023 \fi
1024 \if@tempswa
1025 \@bitor \@currtype \@deferlist
1026 \@testwrongwidth\@currbox
1027 \if@test
1028 \else
1029 \@tempdima -\ht\@currbox
1030 \advance\@tempdima
1031 -\ifx \@dbltoplist\@empty \dbltextfloatsep \else
1032 \dblfloatsep \fi
1033 \global \advance \@dbltoproom \@tempdima
1034 \global \advance \@colht \@tempdima
1035 \global \advance \@dbltopnum \m@ne
1036 \@cons \@dbltoplist \@currbox
1037 \@inserttrue
1038 \fi
1039 \fi
1040 \fi
1041 \fi
1042 \if@insert
1043 \else
1044 \@cons\@deferlist\@currbox
1045 \fi
1046 \endgroup
1047 }
1048 \def \@addtocurcol {%
1049 \@insertfalse
1050 \@setfloattypecounts
1051 \ifnum \@fpstype=8
1052 \else
1053 \ifnum \@fpstype=24
1054 \else
1055 \@flsettextmin
1056 \advance \@textmin \@textfloatsheight
1057 \@reqcolroom \@pageht
1058 \ifdim \@textmin>\@reqcolroom
1059 \@reqcolroom \@textmin
1060 \fi
1061 \advance \@reqcolroom \ht\@currbox
1062 \ifdim \@colroom>\@reqcolroom
1063 \@flsetnum \@colnum
1064 \ifnum \@colnum>\z@
1065 \@bitor\@currtype\@deferlist
1066 \@testwrongwidth\@currbox
1067 \if@test
1068 \else
1069 \@bitor\@currtype\@botlist
1070 \if@test
1071 \@addtobot
1072 \else
1073 \ifodd \count\@currbox
1074 \advance \@reqcolroom \intextsep
1075 \ifdim \@colroom>\@reqcolroom
1076 \global \advance \@colnum \m@ne
1077 \global \advance \@textfloatsheight \ht\@currbox
1078 \global \advance \@textfloatsheight 2\intextsep
1079 \@cons \@midlist \@currbox
1080 \if@nobreak
1081 \nobreak
1082 \@nobreakfalse
1083 \everypar{}%
1084 \else
1085 \addpenalty \interlinepenalty
1086 \fi
1087 \vskip \intextsep
1088 \box\@currbox
1089 \penalty\interlinepenalty
1090 \vskip\intextsep
1091 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
1092 \outputpenalty \z@
1093 \@inserttrue
1094 \fi
1095 \fi
1096 \if@insert
1097 \else
1098 \@addtotoporbot
1099 \fi
1100 \fi
1101 \fi
1102 \fi
1103 \fi
1104 \fi
1105 \fi
1106 \if@insert
1107 \else
1108 \@resethfps
1109 \@cons\@deferlist\@currbox
1110 \fi
1111 }
1112 \def\@xtryfc #1{%
1113 \@next\reserved@a\@trylist{}{}%
1114 \@currtype \count #1%
1115 \divide\@currtype\@xxxii
1116 \multiply\@currtype\@xxxii
1117 \@bitor \@currtype \@failedlist
1118 \@testfp #1%
1119 \@testwrongwidth #1%
1120 \ifdim \ht #1>\@colht
1121 \@testtrue
1122 \fi
1123 \if@test
1124 \@cons\@failedlist #1%
1125 \else
1126 \@ytryfc #1%
1127 \fi}
1128 \def\@ztryfc #1{%
1129 \@tempcnta\count #1%
1130 \divide\@tempcnta\@xxxii
1131 \multiply\@tempcnta\@xxxii
1132 \@bitor \@tempcnta {\@failedlist \@flfail}%
1133 \@testfp #1%
1134 \@testwrongwidth #1%
1135 \@tempdimb\@tempdima
1136 \advance\@tempdimb\ht #1%
1137 \advance\@tempdimb\@fpsep
1138 \ifdim \@tempdimb >\@colht
1139 \@testtrue
1140 \fi
1141 \if@test
1142 \@cons\@flfail #1%
1143 \else
1144 \@cons\@flsucceed #1%
1145 \@tempdima\@tempdimb
1146 \fi}
1147 \def\@{\spacefactor\@m{}}
1148 \def\@tempa#1#2{#1#2\relax}
1149 \ifx\setlength\@tempa
1150 \def\setlength#1#2{#1 #2\relax}
1151 \fi
1152 \def\addpenalty#1{%
1153 \ifvmode
1154 \if@minipage
1155 \else
1156 \if@nobreak
1157 \else
1158 \ifdim\lastskip=\z@
1159 \penalty#1\relax
1160 \else
1161 \@tempskipb\lastskip
1162 \begingroup
1163 \advance \@tempskipb
1164 \ifdim\prevdepth>\maxdepth\maxdepth\else
1165 \ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi
1166 \fi
1167 \vskip -\@tempskipb
1168 \penalty#1%
1169 \vskip\@tempskipb
1170 \endgroup
1171 \vskip -\@tempskipb
1172 \vskip \@tempskipb
1173 \fi
1174 \fi
1175 \fi
1176 \else
1177 \@noitemerr
1178 \fi}
1179 \def\@fnsymbol#1{%
1180 \ifcase#1\or \TextOrMath\textasteriskcentered *\or
1181 \TextOrMath \textdagger \dagger\or
1182 \TextOrMath \textdaggerdbl \ddagger \or
1183 \TextOrMath \textsection \mathsection\or
1184 \TextOrMath \textparagraph \mathparagraph\or
1185 \TextOrMath \textbardbl \|\or
1186 \TextOrMath {\textasteriskcentered\textasteriskcentered}{**}\or
1187 \TextOrMath {\textdagger\textdagger}{\dagger\dagger}\or
1188 \TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}\else
1189 \@ctrerr \fi
1190 }
1191 \begingroup\expandafter\expandafter\expandafter\endgroup
1192 \expandafter\ifx\csname eTeXversion\endcsname\relax
1193 \DeclareRobustCommand\TextOrMath{%
1194 \ifmmode \expandafter\@secondoftwo
1195 \else \expandafter\@firstoftwo \fi}
1196 \protected@edef\TextOrMath#1#2{\TextOrMath{#1}{#2}}
1197 \else
1198 \protected\expandafter\def\csname TextOrMath\space\endcsname{%
1199 \ifmmode \expandafter\@secondoftwo
1200 \else \expandafter\@firstoftwo \fi}
1201 \edef\TextOrMath#1#2{%
1202 \expandafter\noexpand\csname TextOrMath\space\endcsname
1203 {#1}{#2}}
1204 \fi
1205 \def\@esphack{%
1206 \relax
1207 \ifhmode
1208 \spacefactor\@savsf
1209 \ifdim\@savsk>\z@
1210 \nobreak \hskip\z@skip % <------
1211 \ignorespaces
1212 \fi
1213 \fi}
1214 \def\@Esphack{%
1215 \relax
1216 \ifhmode
1217 \spacefactor\@savsf
1218 \ifdim\@savsk>\z@
1219 \nobreak \hskip\z@skip % <------
1220 \@ignoretrue
1221 \ignorespaces
1222 \fi
1223 \fi}
1224 \DeclareRobustCommand\em
1225 {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
1226 \eminnershape \else \itshape \fi}
1227 \def\eminnershape{\upshape}
1228 \DeclareRobustCommand*\textsubscript[1]{%
1229 \@textsubscript{\selectfont#1}}
1230 \def\@textsubscript#1{%
1231 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
1232 \def\@DeclareMathSizes #1#2#3#4#5{%
1233 \@defaultunits\dimen@ #2pt\relax\@nnil
1234 \if $#3$%
1235 \expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse
1236 \else
1237 \@defaultunits\dimen@ii #3pt\relax\@nnil
1238 \@defaultunits\@tempdima #4pt\relax\@nnil
1239 \@defaultunits\@tempdimb #5pt\relax\@nnil
1240 \toks@{#1}%
1241 \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{%
1242 \gdef\noexpand\tf@size{\strip@pt\dimen@ii}%
1243 \gdef\noexpand\sf@size{\strip@pt\@tempdima}%
1244 \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}%
1245 \the\toks@
1246 }%
1247 \fi
1248 }
1249 \providecommand*\MakeRobust[1]{%
1250 \@ifundefined{\expandafter\@gobble\string#1}{%
1251 \@latex@error{The control sequence `\string#1' is undefined!%
1252 \MessageBreak There is nothing here to make robust}%
1253 \@eha
1254 }%
1255 {%
1256 \@ifundefined{\expandafter\@gobble\string#1\space}%
1257 {%
1258 \expandafter\let\csname
1259 \expandafter\@gobble\string#1\space\endcsname=#1%
1260 \edef\reserved@a{\string#1}%
1261 \def\reserved@b{#1}%
1262 \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
1263 \edef#1{%
1264 \ifx\reserved@a\reserved@b
1265 \noexpand\x@protect\noexpand#1%
1266 \fi
1267 \noexpand\protect\expandafter\noexpand
1268 \csname\expandafter\@gobble\string#1\space\endcsname}%
1269 }%
1270 {\@latex@info{The control sequence `\string#1' is already robust}}%
1271 }%
1272 }
1273 \MakeRobust\(
1274 \MakeRobust\)
1275 \MakeRobust\[
1276 \MakeRobust\]
1277 \MakeRobust\makebox
1278 \MakeRobust\savebox
1279 \MakeRobust\framebox
1280 \MakeRobust\parbox
1281 \MakeRobust\rule
1282 \MakeRobust\raisebox
1283 \def\@xfloat #1[#2]{%
1284 \@nodocument
1285 \def \@captype {#1}%
1286 \def \@fps {#2}%
1287 \@onelevel@sanitize \@fps
1288 \def \reserved@b {!}%
1289 \ifx \reserved@b \@fps
1290 \@fpsadddefault
1291 \else
1292 \ifx \@fps \@empty
1293 \@fpsadddefault
1294 \fi
1295 \fi
1296 \ifhmode
1297 \@bsphack
1298 \@floatpenalty -\@Mii
1299 \else
1300 \@floatpenalty-\@Miii
1301 \fi
1302 \ifinner
1303 \@parmoderr\@floatpenalty\z@
1304 \else
1305 \@next\@currbox\@freelist
1306 {%
1307 \@tempcnta \sixt@@n
1308 \expandafter \@tfor \expandafter \reserved@a
1309 \expandafter :\expandafter =\@fps
1310 \do
1311 {%
1312 \if \reserved@a h%
1313 \ifodd \@tempcnta
1314 \else
1315 \advance \@tempcnta \@ne
1316 \fi
1317 \else\if \reserved@a t%
1318 \@setfpsbit \tw@
1319 \else\if \reserved@a b%
1320 \@setfpsbit 4%
1321 \else\if \reserved@a p%
1322 \@setfpsbit 8%
1323 \else\if \reserved@a !%
1324 \ifnum \@tempcnta>15
1325 \advance\@tempcnta -\sixt@@n\relax
1326 \fi
1327 \else
1328 \@latex@error{Unknown float option `\reserved@a'}%
1329 {Option `\reserved@a' ignored and `p' used.}%
1330 \@setfpsbit 8%
1331 \fi\fi\fi\fi\fi
1332 }%
1333 \@tempcntb \csname ftype@\@captype \endcsname
1334 \multiply \@tempcntb \@xxxii
1335 \advance \@tempcnta \@tempcntb
1336 \global \count\@currbox \@tempcnta
1337 }%
1338 \@fltovf
1339 \fi
1340 \global \setbox\@currbox
1341 \color@vbox
1342 \normalcolor
1343 \vbox \bgroup
1344 \hsize\columnwidth
1345 \@parboxrestore
1346 \@floatboxreset
1347 }
1348 \def\@stpelt#1{\global\csname c@#1\endcsname \m@ne\stepcounter{#1}}
1349 \EndIncludeInRelease
1350 %</fixltx2e>
1351 % \end{macrocode}
1352 %
1353 % \Finale
1354 %
1355 \endinput