| 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 |
%%% From File: ltclass.dtx |
| 32 |
% |
| 33 |
%<*driver> |
| 34 |
% \fi |
| 35 |
\ProvidesFile{ltclass.dtx} |
| 36 |
[2025/07/07 v1.5n LaTeX Kernel (Class & Package Interface)] |
| 37 |
% \iffalse |
| 38 |
\documentclass{ltxdoc} |
| 39 |
\GetFileInfo{ltclass.dtx} |
| 40 |
\begin{document} |
| 41 |
\title{The main structure of documents} |
| 42 |
\author{Frank Mittelbach\and Chris Rowley\and Alan Jeffrey\and |
| 43 |
David Carlisle} |
| 44 |
\date{\filedate} |
| 45 |
\MaintainedByLaTeXTeam{latex} |
| 46 |
\maketitle |
| 47 |
|
| 48 |
\providecommand\pkg[1]{\texttt{#1}} |
| 49 |
|
| 50 |
\DocInput{\filename} |
| 51 |
\end{document} |
| 52 |
%</driver> |
| 53 |
% \fi |
| 54 |
% |
| 55 |
% \iffalse |
| 56 |
% (C) Copyright Frank Mittelbach, Chris Rowley, |
| 57 |
% Alan Jeffrey and David Carlisle 1993-1998. |
| 58 |
% All rights reserved. |
| 59 |
% \fi |
| 60 |
% |
| 61 |
% |
| 62 |
% \changes{v0.2f}{1993/11/22} |
| 63 |
% {\cs{@unknownversion} removed} |
| 64 |
% \changes{v1.0j}{1994/10/18} |
| 65 |
% {Move \cs{listfiles} to ltfiles.dtx} |
| 66 |
% \changes{v1.0f}{1994/05/22}{Use new warning and error commands} |
| 67 |
% \changes{v1.0l}{1994/11/17}{\cs{@tempa} to \cs{reserved@a}} |
| 68 |
% \changes{v1.0z}{1998/03/21}{Added to documentation of filecontents} |
| 69 |
% \changes{v1.1c}{1998/08/17}{(RmS) Minor documentation fixes.} |
| 70 |
% \changes{v1.3o}{2020/08/21}{Integration of new hook management interface} |
| 71 |
% \changes{v1.4f}{2021/08/25}{Standardise generic hook names (gh/648)} |
| 72 |
% |
| 73 |
% |
| 74 |
% \section{Introduction} |
| 75 |
% |
| 76 |
% This file implements the following declarations, which replace |
| 77 |
% |\documentstyle| in \LaTeXe\ documents. |
| 78 |
% |
| 79 |
% Note that old documents containing |\documentstyle| will be run using |
| 80 |
% a compatibility option---thus keeping everyone happy, we hope! |
| 81 |
% |
| 82 |
% The overall idea is that there are two types of `style files': |
| 83 |
% `class files' which define elements and provide a default formatting |
| 84 |
% for them; and `packages' which provide extra functionality. One |
| 85 |
% difference between \LaTeXe\ and \LaTeX2.09 is that \LaTeXe\ packages |
| 86 |
% may have options. Note that options to classes packages may be |
| 87 |
% implemented such that they input files, but these file names are not |
| 88 |
% necessarily directly related to the option name. |
| 89 |
% |
| 90 |
% \section{User interface} |
| 91 |
% |
| 92 |
% |\documentclass[|\meta{main-option-list}|]{|^^A |
| 93 |
% \meta{class}|}[|\meta{version}|]| |
| 94 |
% |
| 95 |
% There must be exactly one such declaration, and it must come first. |
| 96 |
% The \meta{main-option-list} is a list of options which can modify the |
| 97 |
% formatting of elements which are defined in the \meta{class} file |
| 98 |
% as well as in all following |\usepackage| declarations (see below). |
| 99 |
% The \meta{version} is a version number, beginning with a date in the |
| 100 |
% format |YYYY/MM/DD|. If an older version of the class is found, a |
| 101 |
% warning is issued. |
| 102 |
% |
| 103 |
% \bigskip |
| 104 |
% |
| 105 |
% |\documentstyle[|\meta{main-option-list}|]{|^^A |
| 106 |
% \meta{class}|}[|\meta{version}|]| |
| 107 |
% |
| 108 |
% The |\documentstyle| declaration is kept in order to maintain upward |
| 109 |
% compatibility with \LaTeX2.09 documents. It is similar to |
| 110 |
% |\documentclass|, but it causes all options in |
| 111 |
% \meta{main-option-list} that the \meta{class} does not use to be |
| 112 |
% passed to |\RequirePackage| after the options have been processed. |
| 113 |
% This maintains compatibility with the 2.09 behaviour. Also a flag is |
| 114 |
% set to indicate that the document is to be processed in \LaTeX2.09 |
| 115 |
% compatibility mode. As far as most packages are concerned, this |
| 116 |
% only affects the warnings and errors \LaTeX\ generates. This flag |
| 117 |
% does affect the definition of font commands, and |\sloppy|. |
| 118 |
% |
| 119 |
% \bigskip |
| 120 |
% |
| 121 |
% |\usepackage[|\meta{package-option-list}|]{|^^A |
| 122 |
% \meta{package-list}|}[|\meta{version}|]| |
| 123 |
% |
| 124 |
% There can be any number of these declarations. All packages in |
| 125 |
% \meta{package-list} are called with the same options. |
| 126 |
% |
| 127 |
% Each \meta{package} file defines new elements (or modifies those |
| 128 |
% defined in the \meta{class}), and thus extends the range of documents |
| 129 |
% which can be processed. |
| 130 |
% The \meta{package-option-list} is a list of options which can modify |
| 131 |
% the formatting of elements defined in the \meta{package} file. |
| 132 |
% The \meta{version} is a version number, beginning with a date in the |
| 133 |
% format |YYYY/MM/DD|. If an older version of the package is found, a |
| 134 |
% warning is issued. |
| 135 |
% |
| 136 |
% Each package is loaded only once. If the same package is requested |
| 137 |
% more than once, nothing happens, unless the package has been requested |
| 138 |
% with options that were not given the first time it was loaded, in |
| 139 |
% which case an error is produced. |
| 140 |
% |
| 141 |
% As well as processing the options given in the |
| 142 |
% \meta{package-option-list}, each package processes the |
| 143 |
% \meta{main-option-list}. This means that options that affect all |
| 144 |
% of the packages can be given globally, rather than repeated for every |
| 145 |
% package. |
| 146 |
% |
| 147 |
% Note that class files have the extension |.cls|, packages have the |
| 148 |
% extension |.sty|. |
| 149 |
% |
| 150 |
% \DescribeEnv{filecontents} |
| 151 |
% The environment |filecontents| is intended for passing the contents |
| 152 |
% of packages, options, or other files along with a document in a |
| 153 |
% single file. |
| 154 |
% It has one argument, which is the name of the file to create. If that |
| 155 |
% file already exists (maybe only in the current directory if the OS |
| 156 |
% supports a notion of a `current directory' or `default directory') |
| 157 |
% then nothing happens |
| 158 |
% (except for an information message) and the body of the environment |
| 159 |
% is bypassed. Otherwise, the body of the environment is written |
| 160 |
% verbatim to the file name given as the first argument, together with |
| 161 |
% some comments about how it was produced. |
| 162 |
% |
| 163 |
% The environment can also be called with an optional argument which is |
| 164 |
% used to alter some of its behavior: option \texttt{force} or |
| 165 |
% \texttt{overwrite} will allow for overwriting existing files, |
| 166 |
% option \texttt{nosearch} will only check the current directory |
| 167 |
% when looking if the file exists. This can be useful if you want to |
| 168 |
% generate a local (modified) copy of some file that is already in the |
| 169 |
% search tree of \TeX{}. Finally, you can use \texttt{noheader} to |
| 170 |
% prevent it from writing the standard blurb at the top of the file |
| 171 |
% (this is actually the same as using the star form of the environment). |
| 172 |
% |
| 173 |
% As the environment is intended to be used on document level to |
| 174 |
% bundle different files together, by default it refuses to overwrite files. |
| 175 |
% If the option \texttt{force} is used then it always writes the |
| 176 |
% file, but it generates a |
| 177 |
% warning if it overwrites (or might overwrite) an existing |
| 178 |
% file.\footnote{\TeX{} might see a file in the \texttt{texmf/} tree |
| 179 |
% that is not in current directory, in which case no overwrite happens; |
| 180 |
% but it can't distinguish that case from the one in which an |
| 181 |
% overwrite takes place.} If necessary, this warning can be suppressed |
| 182 |
% by also using the option \texttt{nowarn} but for most use cases we |
| 183 |
% recommend informing the user when an overwrite happens and |
| 184 |
% therefore to not add this option. |
| 185 |
% |
| 186 |
% The environment is now allowed anywhere in the document, but to ensure |
| 187 |
% that all the necessary packages and options are available when the |
| 188 |
% document is run, it is normally best to place it at the top of your |
| 189 |
% file (before \cs{documentclass}). |
| 190 |
% A possible use case for using it inside the document body is if you |
| 191 |
% want to reuse some text several times in the document you could then |
| 192 |
% write it and later use \cs{input} to retrieve it where needed. |
| 193 |
% |
| 194 |
% |
| 195 |
% The begin and end tags should each be on a |
| 196 |
% line by itself. |
| 197 |
% |
| 198 |
% \subsection{Option processing} |
| 199 |
% |
| 200 |
% When the options are processed, they are divided into two types: {\em |
| 201 |
% local\/} and {\em global}: |
| 202 |
% \begin{itemize} |
| 203 |
% |
| 204 |
% \item For a class, the options in the |\documentclass| command are |
| 205 |
% local. |
| 206 |
% |
| 207 |
% \item For a package, the options in the |\usepackage| command are |
| 208 |
% local, and the options in the |\documentclass| command are global. |
| 209 |
% |
| 210 |
% \end{itemize} |
| 211 |
% The options for |\documentclass| and |\usepackage| |
| 212 |
% are processed in the following way: |
| 213 |
% \begin{enumerate} |
| 214 |
% |
| 215 |
% \item The local and global options that have been declared |
| 216 |
% (using |\DeclareOption| as described below) are processed |
| 217 |
% first. |
| 218 |
% |
| 219 |
% In the case of |\ProcessOptions|, they are processed in the order |
| 220 |
% that they were declared in the class or package. |
| 221 |
% |
| 222 |
% In the case of |\ProcessOptions*|, they are processed in the order |
| 223 |
% that they appear in the option-lists. First the global options, and |
| 224 |
% then the local ones. |
| 225 |
% |
| 226 |
% \item Any remaining local options are dealt with using the default |
| 227 |
% option (declared using the |\DeclareOption*| declaration described |
| 228 |
% below). For document classes, this usually does nothing, but |
| 229 |
% records the option on a list of unused options. |
| 230 |
% For packages, this usually produces an error. |
| 231 |
% |
| 232 |
% \end{enumerate} |
| 233 |
% Finally, when |\begin{document}| is reached, if there are any global |
| 234 |
% options which have not been used by either the class or any package, |
| 235 |
% the system will produce a warning. |
| 236 |
% |
| 237 |
% |
| 238 |
% \section{Class and Package interface} |
| 239 |
% |
| 240 |
% \subsection{Class name and version} |
| 241 |
% |
| 242 |
% \DescribeMacro\ProvidesClass |
| 243 |
% A class can identify itself with the |
| 244 |
% |\ProvidesClass{|\meta{name}|}[|\meta{version}|]| command. The |
| 245 |
% \meta{version} should begin with a date in the format |YYYY/MM/DD|. |
| 246 |
% |
| 247 |
% \subsection{Package name and version} |
| 248 |
% |
| 249 |
% \DescribeMacro\ProvidesPackage |
| 250 |
% A package can identify itself with the |
| 251 |
% |\ProvidesPackage|\marg{name}\oarg{version} command. The |
| 252 |
% \meta{version} should begin with a date in the format |YYYY/MM/DD|. |
| 253 |
% |
| 254 |
% \subsection{Requiring other packages} |
| 255 |
% |
| 256 |
% \DescribeMacro\RequirePackage |
| 257 |
% Packages or classes can load other packages using\\ |
| 258 |
% |\RequirePackage|\oarg{options}\marg{name}\oarg{version}.\\ |
| 259 |
% If the package has already been loaded, then nothing happens unless |
| 260 |
% the requested options are not a subset of the options with which it |
| 261 |
% was loaded, in which case an error is called. |
| 262 |
% |
| 263 |
% \DescribeMacro\LoadClass |
| 264 |
% Similar to |\RequirePackage|, but for classes, may not be used in |
| 265 |
% package files. |
| 266 |
% |
| 267 |
% \DescribeMacro\PassOptionsToPackage |
| 268 |
% Packages can pass options to other packages using:\\ |
| 269 |
% |\PassOptionsToPackage{|\meta{options}|}{|\meta{package}|}|.\\ |
| 270 |
% \DescribeMacro\PassOptionsToClass |
| 271 |
% This adds the \meta{options} to the options list of any future |
| 272 |
% |\RequirePackage| or |\usepackage| command. For example: |
| 273 |
% \begin{verbatim} |
| 274 |
% \PassOptionsToPackage{foo,bar}{fred} |
| 275 |
% \RequirePackage[baz]{fred}\end{verbatim} |
| 276 |
% is the same as: |
| 277 |
%\begin{verbatim} |
| 278 |
% \RequirePackage[foo,bar,baz]{fred} |
| 279 |
%\end{verbatim} |
| 280 |
% |
| 281 |
% \DescribeMacro\LoadClassWithOptions |
| 282 |
% |\LoadClassWithOptions|\marg{name}\oarg{version}:\\ |
| 283 |
% This is similar to |
| 284 |
% |\LoadClass|, but it always calls class \meta{name} with |
| 285 |
% exactly the same option list that is being used by the current class, |
| 286 |
% rather than an option explicitly supplied or passed on by |
| 287 |
% |\PassOptionsToClass|. |
| 288 |
% \DescribeMacro\RequirePackageWithOptions |
| 289 |
% |\RequirePackageWithOptions| is the analogous command for packages. |
| 290 |
% |
| 291 |
% This is mainly intended to allow one class to simply build on another, |
| 292 |
% for example: |
| 293 |
%\begin{verbatim} |
| 294 |
% \LoadClassWithOptions{article} |
| 295 |
%\end{verbatim} |
| 296 |
% |
| 297 |
% This should be contrasted with the slightly different construction |
| 298 |
%\begin{verbatim} |
| 299 |
% \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} |
| 300 |
% \ProcessOptions |
| 301 |
% \LoadClass{article} |
| 302 |
%\end{verbatim} |
| 303 |
% |
| 304 |
% As used here, the effects are more or less the same, but the |
| 305 |
% version using |\LoadClassWithOptions| is slightly quicker |
| 306 |
% (and less to type). |
| 307 |
% If, however, the class declares options of its own then |
| 308 |
% the two constructions are different; compare, for example: |
| 309 |
%\begin{verbatim} |
| 310 |
% \DeclareOption{landscape}{...} |
| 311 |
% \ProcessOptions |
| 312 |
% \LoadClassWithOptions{article} |
| 313 |
%\end{verbatim} |
| 314 |
% with: |
| 315 |
%\begin{verbatim} |
| 316 |
% \DeclareOption{landscape}{...} |
| 317 |
% \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} |
| 318 |
% \ProcessOptions |
| 319 |
% \LoadClass{article} |
| 320 |
%\end{verbatim} |
| 321 |
% In the first case, the \textsf{article} class will be called with |
| 322 |
% option |landscape| precisely when the current class is called with |
| 323 |
% this option; but in the second example it will |
| 324 |
% not as in that case \textsf{article} is only passed options by the |
| 325 |
% default option handler, which is not used for |landscape| as that |
| 326 |
% option is explicitly declared. |
| 327 |
% |
| 328 |
% \DescribeMacro\IfPackageLoadedTF |
| 329 |
% \DescribeMacro\IfClassLoadedTF |
| 330 |
% \DescribeMacro\@ifpackageloaded |
| 331 |
% \DescribeMacro\@ifclassloaded |
| 332 |
% To find out if a package has already been loaded, use |
| 333 |
% \begin{quote} |
| 334 |
% |\IfPackageLoadedTF{|\meta{package}|}{|\meta{true}|}{|\meta{false}|}|\\ |
| 335 |
% \end{quote} |
| 336 |
% or the old name \cs{@ifpackageloaded}. |
| 337 |
% |
| 338 |
% \DescribeMacro\IfPackageAtLeastTF |
| 339 |
% \DescribeMacro\IfClassAtLeastTF |
| 340 |
% \DescribeMacro\IfFileAtLeastTF |
| 341 |
% \DescribeMacro\@ifpackagelater |
| 342 |
% \DescribeMacro\@ifclasslater |
| 343 |
% \changes{v1.1i}{2013/07/07}{Correctly describe how the date in |
| 344 |
% \cs{@ifpackagelater} is used} |
| 345 |
% To find out if a package has already been loaded with a version |
| 346 |
% equal to or more |
| 347 |
% recent than \meta{date}, use |
| 348 |
% \begin{quote} |
| 349 |
% |\IfPackageAtLeastTF{|\meta{package}|}{|\meta{date}|}{|^^A |
| 350 |
% \meta{true}|}{|\meta{false}|}| |
| 351 |
% \end{quote} |
| 352 |
% or the old name \cs{@ifpackagelater}. |
| 353 |
|
| 354 |
% \DescribeMacro\IfFormatAtLeastTF |
| 355 |
% To test the format date use |
| 356 |
% \begin{quote} |
| 357 |
% |\IfFormatAtLeastTF{|\meta{date}|}{|^^A |
| 358 |
% \meta{true}|}{|\meta{false}|}| |
| 359 |
% \end{quote} |
| 360 |
% |
| 361 |
% \DescribeMacro\IfPackageLoadedWithOptionsTF |
| 362 |
% \DescribeMacro\IfClassLoadedWithOptionsTF |
| 363 |
% \DescribeMacro\@ifpackagewith |
| 364 |
% \DescribeMacro\@ifclasswith |
| 365 |
% To find out if a package has already been loaded with at least the |
| 366 |
% options \meta{options}, use |
| 367 |
% \begin{quote} |
| 368 |
% |\IfPackageLoadedWithOptionsTF{|\meta{package}|}{|\meta{options}|}{|^^A |
| 369 |
% \meta{true}|}{|\meta{false}|}| |
| 370 |
% \end{quote} |
| 371 |
% or the old name \cs{@ifpackagewith}. |
| 372 |
% |
| 373 |
% There exists one package that can't be tested with the above |
| 374 |
% commands: the \texttt{fontenc} package pretends that it was never |
| 375 |
% loaded to allow for repeated reloading with different options (see |
| 376 |
% \texttt{ltoutenc.dtx} for details). |
| 377 |
% |
| 378 |
% \DescribeMacro\NeedsDocumentMetadata |
| 379 |
% To require that a document starts with |\DocumentMetadata| use |
| 380 |
% \begin{quote} |
| 381 |
% |\NeedsDocumentMetadata| |
| 382 |
% \end{quote} |
| 383 |
% |
| 384 |
% |
| 385 |
% \subsection{Declaring new options} |
| 386 |
% |
| 387 |
% Options for classes and packages are built using the same macros. |
| 388 |
% |
| 389 |
% \DescribeMacro\DeclareOption To define a builtin option, use |
| 390 |
% |\DeclareOption{|\meta{name}|}{|\meta{code}|}|. |
| 391 |
% |
| 392 |
% \DescribeMacro{\DeclareOption*} To define the default action to |
| 393 |
% perform for local options which have not been declared, use |
| 394 |
% |\DeclareOption*{|\meta{code}|}|. |
| 395 |
% |
| 396 |
% {\em Note\/}: there should be no use of\\ |
| 397 |
% |\RequirePackage|, |\DeclareOption|, |\DeclareOption*| or |
| 398 |
% |\ProcessOptions|\\ |
| 399 |
% inside |\DeclareOption| or |\DeclareOption*|. |
| 400 |
% |
| 401 |
% Possible uses for |\DeclareOption*| include: |
| 402 |
% |
| 403 |
% |\DeclareOption*{}|\\ |
| 404 |
% Do nothing. Silently accept unknown options. (This suppresses the |
| 405 |
% usual warnings.) |
| 406 |
% |
| 407 |
% |\DeclareOption*{\@unkownoptionerror}|\\ |
| 408 |
% Complain about unknown local options. (The initial setting for |
| 409 |
% package files.) |
| 410 |
% |
| 411 |
% |\DeclareOption*{\PassOptionsToPackage{\CurrentOption}|^^A |
| 412 |
% |{|\meta{pkg-name}|}}|\\ |
| 413 |
% Handle the current option by passing it on to the package |
| 414 |
% \meta{pkg-name}, which will presumably be loaded via |
| 415 |
% |\RequirePackage| later in the file. This is useful for building |
| 416 |
% `extension' packages, that perhaps handle a couple of new options, |
| 417 |
% but then pass everything else on to an existing package. |
| 418 |
% |
| 419 |
% |\DeclareOption*{\InputIfFileExists{xx-\CurrentOption.yyy}%|\\ |
| 420 |
% | {}%|\\ |
| 421 |
% | {\OptionNotUsed}}|\\ |
| 422 |
% Handle the option foo by loading the file |xx-foo.yyy| if it |
| 423 |
% exists, otherwise do nothing, but declare that the option was not |
| 424 |
% used. |
| 425 |
% Actually the |\OptionNotUsed| declaration is only needed if this is |
| 426 |
% being used in class files, but does no harm in package files. |
| 427 |
% |
| 428 |
% |
| 429 |
% \subsection{Safe Input Macros} |
| 430 |
% \DescribeMacro{\InputIfFileExists} |
| 431 |
% |\InputIfFileExists{|\meta{file}|}{|\meta{then}|}{|\meta{else}|}|\\ |
| 432 |
% Inputs \meta{file} if it exists. Immediately before the input, |
| 433 |
% \meta{then} is executed. Otherwise \meta{else} is executed. |
| 434 |
% |
| 435 |
% \DescribeMacro{\IfFileExists} |
| 436 |
% As above, but does not input the file. |
| 437 |
% |
| 438 |
% One thing you might like to put in the \meta{else} clause is |
| 439 |
% |
| 440 |
% \DescribeMacro{\@missingfileerror} |
| 441 |
% This starts an interactive request for a filename, supplying default |
| 442 |
% extensions. Just hitting return causes the whole input to be skipped |
| 443 |
% and entering |x| quits the current run, |
| 444 |
% |
| 445 |
% \DescribeMacro{\input} |
| 446 |
% This has been redefined from the \LaTeX2.09 definition, in terms of |
| 447 |
% the new commands |\InputIfFileExists| and |\@missingfileerror|. |
| 448 |
% |
| 449 |
% |
| 450 |
% \DescribeMacro{\listfiles} Giving this declaration in the preamble |
| 451 |
% causes a list of all files input via the `safe input' commands to be |
| 452 |
% listed at the end. Any strings specified in the optional argument to |
| 453 |
% |\ProvidesPackage| are listed alongside the file name. So files in |
| 454 |
% standard (and other non-standard) distributions can put informative |
| 455 |
% strings in this argument. |
| 456 |
% |
| 457 |
% \MaybeStop{} |
| 458 |
% |
| 459 |
% \section{Implementation} |
| 460 |
% |
| 461 |
% \begin{macrocode} |
| 462 |
%<*2ekernel> |
| 463 |
% \end{macrocode} |
| 464 |
% |
| 465 |
% |
| 466 |
% \changes{v0.2g}{1993/11/23} |
| 467 |
% {Various macros now moved to latex.tex.} |
| 468 |
% \changes{v0.2g}{1993/11/23} |
| 469 |
% {Warnings and errors now directly coded.} |
| 470 |
% \changes{v0.2h}{1993/11/28} |
| 471 |
% {Primitive filenames now terminated by space not \cs{relax}.} |
| 472 |
% \changes{v0.2h}{1993/11/28} |
| 473 |
% {Directory syntax checking moved to dircheck.dtx} |
| 474 |
% \changes{v0.2h}{1993/11/28} |
| 475 |
% {Assorted commands now in the kernel removed.} |
| 476 |
% \changes{v0.2i}{1993/12/03} |
| 477 |
% {\cs{@onlypreamble}: Many commands declared.} |
| 478 |
% \changes{v0.2i}{1993/12/03} |
| 479 |
% {Removed obsolete \cs{@documentclass}} |
| 480 |
% \changes{v0.2o}{1993/12/13} |
| 481 |
% {Removed setting \cs{errorcontextlines}\ (now in latex.tex)} |
| 482 |
% \changes{v0.2p}{1993/12/15} |
| 483 |
% {Removed extra `.'s from \cs{@@warning}s} |
| 484 |
% \changes{v0.2s}{1994/01/17} |
| 485 |
% {Added many more \cs{@onlypreamble} commands} |
| 486 |
% \changes{v0.2s}{1994/01/17} |
| 487 |
% {Wrapped long lines to column 72} |
| 488 |
% \changes{v0.3a}{1994/03/02} |
| 489 |
% {Remove need for driver file} |
| 490 |
% \changes{v0.3b}{1994/03/08} |
| 491 |
% {Modify driver code into `new style'} |
| 492 |
% \changes{v0.3c}{1994/03/12} |
| 493 |
% {Change name from docclass to ltclass} |
| 494 |
% \changes{v0.3h}{1994/04/25} |
| 495 |
% {Removed spurious extra `.'s at the end of error messages} |
| 496 |
% \changes{v1.0a}{1994/04/29} |
| 497 |
% {Change version number to 1 (no other change)} |
| 498 |
% \changes{v1.0k}{1994/11/03} |
| 499 |
% {Move \cs{@missingfileerror} to ltfiles} |
| 500 |
% |
| 501 |
% \begin{macro}{\if@compatibility} |
| 502 |
% The flag for compatibility mode. |
| 503 |
% \begin{macrocode} |
| 504 |
\newif\if@compatibility |
| 505 |
% \end{macrocode} |
| 506 |
% \end{macro} |
| 507 |
% |
| 508 |
% \begin{macro}{\@documentclasshook} |
| 509 |
% This legacy hook is called after the first |\documentclass| command. |
| 510 |
% It is \emph{not} integrated with the new 2020 hook management system! |
| 511 |
% By |
| 512 |
% default this checks to see if |\@normalsize| is undefined, and if |
| 513 |
% so, sets it to |\normalsize|. |
| 514 |
% \changes{v0.2q}{1993/12/17} |
| 515 |
% {Macro added} |
| 516 |
% \changes{v0.2z}{1994/02/10} |
| 517 |
% {Changed the name from \cs{@compatibility} to |
| 518 |
% \cs{@documentclasshook}, and added the check for whether |
| 519 |
% \cs{@normalsize} has been defined. ASAJ.} |
| 520 |
% \begin{macrocode} |
| 521 |
\def\@documentclasshook{% |
| 522 |
\ifx\@normalsize\@undefined |
| 523 |
\let\@normalsize\normalsize |
| 524 |
\fi |
| 525 |
} |
| 526 |
% \end{macrocode} |
| 527 |
% \end{macro} |
| 528 |
% |
| 529 |
% \begin{macro}{\@declaredoptions} |
| 530 |
% This list is automatically built by |\DeclareOption|. |
| 531 |
% It is the list of options (separated by commas) declared in |
| 532 |
% the class or package file and it defines the order in which |
| 533 |
% the corresponding |\ds@|\meta{option} commands are executed. |
| 534 |
% All local \meta{option}s which are not declared will be processed |
| 535 |
% in the order defined by the optional argument of |\documentclass| |
| 536 |
% or |\usepackage|. |
| 537 |
% \begin{macrocode} |
| 538 |
\let\@declaredoptions\@empty |
| 539 |
% \end{macrocode} |
| 540 |
% \end{macro} |
| 541 |
% |
| 542 |
% \begin{macro}{\@classoptionslist} |
| 543 |
% List of options of the main class. |
| 544 |
% \changes{v1.0u}{1996/07/26}{made only preamble} |
| 545 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 546 |
% \begin{macrocode} |
| 547 |
\let\@classoptionslist\relax |
| 548 |
%\@onlypreamble\@classoptionslist |
| 549 |
% \end{macrocode} |
| 550 |
% \end{macro} |
| 551 |
% |
| 552 |
% \begin{macro}{\@raw@classoptionslist} |
| 553 |
% List of options of the main class (unprocessed). |
| 554 |
% \changes{v1.4b}{2021/05/18}{Initialise to \cs{relax} to match \cs{@classoptionslist}} |
| 555 |
% \begin{macrocode} |
| 556 |
\let\@raw@classoptionslist\relax |
| 557 |
% \end{macrocode} |
| 558 |
% \end{macro} |
| 559 |
% |
| 560 |
% \begin{macro}{\@unusedoptionlist} |
| 561 |
% \changes{v1.0u}{1996/07/26}{made only preamble} |
| 562 |
% List of options of the main class that haven't been declared or |
| 563 |
% loaded as class option files. |
| 564 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 565 |
% \begin{macrocode} |
| 566 |
\let\@unusedoptionlist\@empty |
| 567 |
%\@onlypreamble\@unusedoptionlist |
| 568 |
% \end{macrocode} |
| 569 |
% \end{macro} |
| 570 |
% |
| 571 |
% \begin{macro}{\CurrentOption} |
| 572 |
% Name of current package or option. |
| 573 |
% \changes{v0.2c}{1993/11/17} |
| 574 |
% {Name changed from \cs{@curroption}} |
| 575 |
% \begin{macrocode} |
| 576 |
\let\CurrentOption\@empty |
| 577 |
% \end{macrocode} |
| 578 |
% \end{macro} |
| 579 |
% |
| 580 |
% \begin{macro}{\@currpath} |
| 581 |
% Path to the current file if explicitly given. |
| 582 |
% \changes{v1.3u}{2020/11/20}{Macro added} |
| 583 |
% \begin{macrocode} |
| 584 |
%</2ekernel> |
| 585 |
%<*2ekernel|latexrelease> |
| 586 |
%<latexrelease> |
| 587 |
%<latexrelease>\IncludeInRelease{2020/10/01}{\@currpath}% |
| 588 |
%<latexrelease> {Add \@currpath}% |
| 589 |
\let\@currpath\@empty |
| 590 |
%<latexrelease>\EndIncludeInRelease |
| 591 |
% |
| 592 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@currpath}% |
| 593 |
%<latexrelease> {Add \@currpath}% |
| 594 |
%<latexrelease>\let\@currpath\@undefined |
| 595 |
%<latexrelease>\EndIncludeInRelease |
| 596 |
%</2ekernel|latexrelease> |
| 597 |
%<*2ekernel> |
| 598 |
% \end{macrocode} |
| 599 |
% \end{macro} |
| 600 |
% |
| 601 |
% \begin{macro}{\@currname} |
| 602 |
% Name of current package or option. |
| 603 |
% \begin{macrocode} |
| 604 |
\let\@currname\@empty |
| 605 |
% \end{macrocode} |
| 606 |
% \end{macro} |
| 607 |
% |
| 608 |
% \begin{macro}{\@currext} |
| 609 |
% The current file extension. |
| 610 |
% \changes{v0.2a}{1993/11/14}{Name changed from \cs{@currextension}} |
| 611 |
% \begin{macrocode} |
| 612 |
\global\let\@currext=\@empty |
| 613 |
% \end{macrocode} |
| 614 |
% \end{macro} |
| 615 |
% |
| 616 |
% \begin{macro}{\@clsextension} |
| 617 |
% \begin{macro}{\@pkgextension} |
| 618 |
% The two possible values of |\@currext|. |
| 619 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 620 |
% \begin{macrocode} |
| 621 |
\def\@clsextension{cls} |
| 622 |
\def\@pkgextension{sty} |
| 623 |
% \end{macrocode} |
| 624 |
% \end{macro} |
| 625 |
% \end{macro} |
| 626 |
% |
| 627 |
% \begin{macro}{\@pushfilename} |
| 628 |
% \begin{macro}{\@popfilename} |
| 629 |
% \begin{macro}{\@currnamestack} |
| 630 |
% Commands to push and pop the file name and extension. \\ |
| 631 |
% |#1| current name. \\ |
| 632 |
% |#2| current extension. \\ |
| 633 |
% |#3| current catcode of |@|. \\ |
| 634 |
% |#4| Rest of the stack. |
| 635 |
% \changes{v1.3l}{2020/06/05}{Added \cs{@expl@push@filename@@} |
| 636 |
% and \cs{@expl@push@filename@aux@@}} |
| 637 |
% \changes{v1.3s}{2020/10/08}{Added missing 2020/02/02 \cs{IncludeInRelease}} |
| 638 |
% \changes{v1.3v}{2020/12/14}{Removed \cs{@expl@@@hook@curr@name@push@@n}} |
| 639 |
% \begin{macrocode} |
| 640 |
%</2ekernel> |
| 641 |
%<*2ekernel|latexrelease> |
| 642 |
%<latexrelease> |
| 643 |
%<latexrelease>\IncludeInRelease{2020/10/01}{\@pushfilename}% |
| 644 |
%<latexrelease> {Add \@expl@push@filename@@ and \@expl@push@filename@aux@@}% |
| 645 |
\def\@pushfilename{% |
| 646 |
% \end{macrocode} |
| 647 |
% The push and pop macros are injected in \cs{@pushfilename} and |
| 648 |
% \cs{@popfilename} so that they correctly keep track of the hook |
| 649 |
% labels. |
| 650 |
% |
| 651 |
% This needs cleanup with the \pkg{expl3} interfaces also playing |
| 652 |
% here, e.g., \cs{@expl@push@filename@@} needs cleanup and (and |
| 653 |
% should probably not have this name either). |
| 654 |
% \begin{macrocode} |
| 655 |
\@expl@push@filename@@ |
| 656 |
\xdef\@currnamestack{% |
| 657 |
{\@currname}% |
| 658 |
{\@currext}% |
| 659 |
{\the\catcode`\@}% |
| 660 |
\@currnamestack}% |
| 661 |
% \end{macrocode} |
| 662 |
% Temporarily add a stack for \cs{@currpath} here. This should be |
| 663 |
% integrated in the main file stack eventually, but other packages |
| 664 |
% rely on \cs{@currnamestack} having three elements per file, so that |
| 665 |
% isn't a trivial change. The prefix \cs{@kernel@...} hopefully |
| 666 |
% discourages people from using it. |
| 667 |
% \begin{macrocode} |
| 668 |
\xdef\@kernel@currpathstack{% |
| 669 |
{\@currpath}% |
| 670 |
\@kernel@currpathstack}% |
| 671 |
\@expl@push@filename@aux@@} |
| 672 |
%<latexrelease>\EndIncludeInRelease |
| 673 |
% \end{macrocode} |
| 674 |
% |
| 675 |
% The following version of \cs{@pushfilename} didn't formally exist in |
| 676 |
% this file, but in the 2020/02/02 release, \pkg{expl3} was preloaded |
| 677 |
% and it patched \cs{@pushfilename} (and \cs{@popfilename}) by adding |
| 678 |
% some hooks in there. But rolling back to 2020/02/02, \pkg{expl3} |
| 679 |
% doesn't patch these macros again, so rolling back has to take those |
| 680 |
% hooks into account. Same goes for \cs{@popfilename}. |
| 681 |
% \begin{macrocode} |
| 682 |
%<latexrelease> |
| 683 |
%<latexrelease>\IncludeInRelease{2020/02/02}{\@pushfilename}% |
| 684 |
%<latexrelease> {Add \@expl@push@filename@@}% |
| 685 |
%<latexrelease>\def\@pushfilename{% |
| 686 |
%<latexrelease> \@expl@push@filename@@ |
| 687 |
%<latexrelease> \xdef\@currnamestack{% |
| 688 |
%<latexrelease> {\@currname}% |
| 689 |
%<latexrelease> {\@currext}% |
| 690 |
%<latexrelease> {\the\catcode`\@}% |
| 691 |
%<latexrelease> \@currnamestack}% |
| 692 |
%<latexrelease> \@expl@push@filename@aux@@} |
| 693 |
%<latexrelease>\EndIncludeInRelease |
| 694 |
%<latexrelease> |
| 695 |
% \end{macrocode} |
| 696 |
% |
| 697 |
% When we roll back from a release that has \pkg{expl3} preloaded, the |
| 698 |
% definitions of \cs{@pushfilename} and \cs{@popfilename} can't be |
| 699 |
% completely rolled back otherwise \pkg{expl3}-based packages won't |
| 700 |
% have the automatic \cs{ExplSyntaxOff} at the end. Here and below for |
| 701 |
% \cs{@popfilename}, we don't roll back all the way through if coming |
| 702 |
% from \LaTeX${}>2020-02-02$. |
| 703 |
% \changes{v1.4a}{2021/03/27} |
| 704 |
% {Do not completely roll back if \pkg{expl3} is loaded.} |
| 705 |
% \begin{macrocode} |
| 706 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@pushfilename}% |
| 707 |
%<latexrelease> {Add \@expl@push@filename@@ and \@expl@push@filename@aux@@}% |
| 708 |
%<latexrelease>\ifnum\sourceLaTeXdate<20200202\relax |
| 709 |
%<latexrelease> \GenericInfo{}{Defining 00-00-00\string\@pushfilename.} |
| 710 |
%<latexrelease>\def\@pushfilename{% |
| 711 |
%<latexrelease> \xdef\@currnamestack{% |
| 712 |
%<latexrelease> {\@currname}% |
| 713 |
%<latexrelease> {\@currext}% |
| 714 |
%<latexrelease> {\the\catcode`\@}% |
| 715 |
%<latexrelease> \@currnamestack}} |
| 716 |
%<latexrelease>\else |
| 717 |
%<latexrelease> \GenericInfo{}{Defining 2020-02-02\string\@pushfilename.} |
| 718 |
%<latexrelease>\def\@pushfilename{% |
| 719 |
%<latexrelease> \@expl@push@filename@@ |
| 720 |
%<latexrelease> \xdef\@currnamestack{% |
| 721 |
%<latexrelease> {\@currname}% |
| 722 |
%<latexrelease> {\@currext}% |
| 723 |
%<latexrelease> {\the\catcode`\@}% |
| 724 |
%<latexrelease> \@currnamestack}% |
| 725 |
%<latexrelease> \@expl@push@filename@aux@@} |
| 726 |
%<latexrelease>\fi |
| 727 |
%<latexrelease>\EndIncludeInRelease |
| 728 |
\@onlypreamble\@pushfilename |
| 729 |
% \end{macrocode} |
| 730 |
% |
| 731 |
% |
| 732 |
% |
| 733 |
% |
| 734 |
% |
| 735 |
% \changes{v1.3l}{2020/06/05}{Added \cs{@expl@pop@filename@@}} |
| 736 |
% \begin{macrocode} |
| 737 |
%<latexrelease> |
| 738 |
%<latexrelease>\IncludeInRelease{2020/10/01}{\@popfilename}% |
| 739 |
%<latexrelease> {Add \@expl@pop@filename@@}% |
| 740 |
\def\@popfilename{\@expl@@@hook@curr@name@pop@@ |
| 741 |
\expandafter\@p@pfilename\@currnamestack\@nil |
| 742 |
% \end{macrocode} |
| 743 |
% Same for popping: |
| 744 |
% \begin{macrocode} |
| 745 |
\expandafter\@p@pfilepath\@kernel@currpathstack\@nil |
| 746 |
\@expl@pop@filename@@} |
| 747 |
%<latexrelease>\EndIncludeInRelease |
| 748 |
%<latexrelease> |
| 749 |
%<latexrelease>\IncludeInRelease{2020/02/02}{\@popfilename}% |
| 750 |
%<latexrelease> {Add \@expl@push@filename@@}% |
| 751 |
%<latexrelease>\def\@popfilename{\expandafter\@p@pfilename\@currnamestack\@nil |
| 752 |
%<latexrelease> \@expl@pop@filename@@} |
| 753 |
%<latexrelease>\EndIncludeInRelease |
| 754 |
%<latexrelease> |
| 755 |
% \end{macrocode} |
| 756 |
% |
| 757 |
% \changes{v1.4a}{2021/03/27} |
| 758 |
% {Do not completely roll back if \pkg{expl3} is loaded.} |
| 759 |
% \begin{macrocode} |
| 760 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@popfilename}% |
| 761 |
%<latexrelease> {Add \@expl@push@filename@@ and \@expl@push@filename@aux@@}% |
| 762 |
%<latexrelease>\ifnum\sourceLaTeXdate<20200202\relax |
| 763 |
%<latexrelease> \GenericInfo{}{Defining 00-00-00\string\@popfilename.} |
| 764 |
%<latexrelease>\def\@popfilename{\expandafter\@p@pfilename\@currnamestack\@nil} |
| 765 |
%<latexrelease>\else |
| 766 |
%<latexrelease> \GenericInfo{}{Defining 2020-02-02\string\@popfilename.} |
| 767 |
%<latexrelease>\def\@popfilename{\expandafter\@p@pfilename\@currnamestack\@nil |
| 768 |
%<latexrelease> \@expl@pop@filename@@} |
| 769 |
%<latexrelease>\fi |
| 770 |
%<latexrelease>\EndIncludeInRelease |
| 771 |
\@onlypreamble\@popfilename |
| 772 |
% \end{macrocode} |
| 773 |
% |
| 774 |
% \begin{macrocode} |
| 775 |
%</2ekernel|latexrelease> |
| 776 |
%<*2ekernel> |
| 777 |
% \end{macrocode} |
| 778 |
% |
| 779 |
% |
| 780 |
% |
| 781 |
% \begin{macrocode} |
| 782 |
\def\@p@pfilename#1#2#3#4\@nil{% |
| 783 |
\gdef\@currname{#1}% |
| 784 |
\gdef\@currext{#2}% |
| 785 |
\catcode`\@#3\relax |
| 786 |
\gdef\@currnamestack{#4}} |
| 787 |
\@onlypreamble\@p@pfilename |
| 788 |
% \end{macrocode} |
| 789 |
% |
| 790 |
% \begin{macrocode} |
| 791 |
\gdef\@currnamestack{} |
| 792 |
\@onlypreamble\@currnamestack |
| 793 |
% \end{macrocode} |
| 794 |
% \end{macro} |
| 795 |
% \end{macro} |
| 796 |
% \end{macro} |
| 797 |
% |
| 798 |
% |
| 799 |
% \begin{macro}{\@kernel@currpathstack} |
| 800 |
% Path to the current file if explicitly given. The auxiliary is |
| 801 |
% needed here to insert a \cs{@empty} to prevent the loss of braces. |
| 802 |
% \changes{v1.3u}{2020/11/20}{Macro added} |
| 803 |
% \changes{v1.3w}{2021/01/21}{Add empty entry for latexrelease} |
| 804 |
% \changes{v1.4c}{2021/06/03}% |
| 805 |
% {Take care of \cs{@kernel@currpathstack} when rolling |
| 806 |
% back/forward.} |
| 807 |
% \begin{macrocode} |
| 808 |
%</2ekernel> |
| 809 |
%<*2ekernel|latexrelease> |
| 810 |
%<latexrelease> |
| 811 |
%<latexrelease>\IncludeInRelease{2020/10/01}{\@kernel@currpathstack}% |
| 812 |
%<latexrelease> {Add \@kernel@currpathstack}% |
| 813 |
% \end{macrocode} |
| 814 |
% If rolling backwards to this release, \cs{@kernel@currpathstack} |
| 815 |
% will be defined, so the \cs{gdef} line should not be executed, thus |
| 816 |
% the \cs{@gobblethree} will take it out, so the satck isn't touched. |
| 817 |
% \begin{macrocode} |
| 818 |
%<latexrelease>\@ifundefined{@kernel@currpathstack}{}{\@gobblethree} |
| 819 |
\gdef\@kernel@currpathstack{}% |
| 820 |
% \end{macrocode} |
| 821 |
% If rolling forward to this release, then the \cs{gdef} line above |
| 822 |
% will define the path stack to be empty (which it can't be, inside a |
| 823 |
% file), so the code below will traverse the \cs{@currnamestack}, and |
| 824 |
% add as many empty items to \cs{@kernel@currpathstack} as there are |
| 825 |
% items in \cs{@currnamestack}, so both are back in sync. Most of the |
| 826 |
% time \pkg{latexrelease} is loaded on top-level, so only one item is |
| 827 |
% needed, but \pkg{platexrelease} loads it internally, so the more |
| 828 |
% complicated loop is needed. |
| 829 |
% \begin{macrocode} |
| 830 |
%<latexrelease>\ifx\@kernel@currpathstack\@empty |
| 831 |
%<latexrelease> \def\reserved@a#1#2#3{% |
| 832 |
%<latexrelease> \ifx\relax#3\else |
| 833 |
%<latexrelease> \g@addto@macro\@kernel@currpathstack{{}}% |
| 834 |
%<latexrelease> \expandafter\reserved@a |
| 835 |
%<latexrelease> \fi}% |
| 836 |
%<latexrelease> \expandafter\reserved@a\@currnamestack{}{}{\relax}% |
| 837 |
%<latexrelease>\fi |
| 838 |
\def\@p@pfilepath#1{% |
| 839 |
\gdef\@currpath{#1}\@p@pfilepath@aux\@empty} |
| 840 |
\def\@p@pfilepath@aux#1\@nil{% |
| 841 |
\xdef\@kernel@currpathstack{#1}} |
| 842 |
%<latexrelease>\EndIncludeInRelease |
| 843 |
% |
| 844 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@kernel@currpathstack}% |
| 845 |
%<latexrelease> {Add \@kernel@currpathstack}% |
| 846 |
%<latexrelease>\let\@kernel@currpathstack\@undefined |
| 847 |
%<latexrelease>\let\@p@pfilepath\@undefined |
| 848 |
%<latexrelease>\let\@p@pfilepath@aux\@undefined |
| 849 |
%<latexrelease>\EndIncludeInRelease |
| 850 |
%</2ekernel|latexrelease> |
| 851 |
%<*2ekernel> |
| 852 |
% \end{macrocode} |
| 853 |
% \end{macro} |
| 854 |
% |
| 855 |
% |
| 856 |
% \begin{macro}{\@ptionlist} |
| 857 |
% Returns the option list of the file. |
| 858 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 859 |
% \begin{macrocode} |
| 860 |
\def\@ptionlist#1{% |
| 861 |
\@ifundefined{opt@#1}\@empty{\csname opt@#1\endcsname}} |
| 862 |
%\@onlypreamble\@ptionlist |
| 863 |
% \end{macrocode} |
| 864 |
% \end{macro} |
| 865 |
% |
| 866 |
% \begin{macro}{\@ifpackageloaded} |
| 867 |
% \begin{macro}{\@ifclassloaded} |
| 868 |
% |\@ifpackageloaded{|\meta{name}|}| |
| 869 |
% Checks to see whether a file has been loaded. |
| 870 |
% \changes{v0.2t}{1994/01/18} |
| 871 |
% {Fix typo \cs{@pkgetension}} |
| 872 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 873 |
% \begin{macrocode} |
| 874 |
\def\@ifpackageloaded{\@ifl@aded\@pkgextension} |
| 875 |
\def\@ifclassloaded{\@ifl@aded\@clsextension} |
| 876 |
% \end{macrocode} |
| 877 |
% |
| 878 |
% \begin{macrocode} |
| 879 |
\def\@ifl@aded#1#2{% |
| 880 |
\expandafter\ifx\csname ver@#2.#1\endcsname\relax |
| 881 |
\expandafter\@secondoftwo |
| 882 |
\else |
| 883 |
\expandafter\@firstoftwo |
| 884 |
\fi} |
| 885 |
% \end{macrocode} |
| 886 |
% \end{macro} |
| 887 |
% \end{macro} |
| 888 |
% |
| 889 |
% |
| 890 |
% |
| 891 |
% \begin{macro}{\@ifpackagelater} |
| 892 |
% \begin{macro}{\@ifclasslater} |
| 893 |
% |\@ifpackagelater{|\meta{name}|}{YYYY/MM/DD}{|\meta{true |
| 894 |
% code}|}{|\meta{false code}|}| |
| 895 |
% Checks that the package loaded is more recent or equal to the |
| 896 |
% given date. |
| 897 |
% A better name for it would therefore been |
| 898 |
% |\@ifpackagelaterorequal| but it is in use for more than 30 |
| 899 |
% years, so \ldots |
| 900 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 901 |
% \begin{macrocode} |
| 902 |
\def\@ifpackagelater{\@ifl@ter\@pkgextension} |
| 903 |
\def\@ifclasslater{\@ifl@ter\@clsextension} |
| 904 |
% \end{macrocode} |
| 905 |
% \end{macro} |
| 906 |
% \end{macro} |
| 907 |
% |
| 908 |
% |
| 909 |
% |
| 910 |
% |
| 911 |
% \begin{macro}{\IfPackageAtLeastTF} |
| 912 |
% \begin{macro}{\IfClassAtLeastTF} |
| 913 |
% \begin{macro}{\IfFileAtLeastTF} |
| 914 |
% \begin{macro}{\IfFormatAtLeastTF} |
| 915 |
% |\IfFormatAtLeastTF{YYYY/MM/DD}{|\meta{true |
| 916 |
% code}|}{|\meta{false code}|}| |
| 917 |
% Test if the format is later or equal to the given date. |
| 918 |
% \changes{v1.3k}{2020/04/07}{Macro added; also in rollback (gh/168)} |
| 919 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 920 |
% \changes{v1.5g}{2023/03/28}{Added \cs{IfFileAtLeastTF} (gh/1015)} |
| 921 |
% \begin{macrocode} |
| 922 |
%</2ekernel> |
| 923 |
%<*2ekernel|latexrelease> |
| 924 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 925 |
%<latexrelease> {\IfFormatAtLeastTF}{Test format date}% |
| 926 |
\def\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} |
| 927 |
\let\IfPackageAtLeastTF\@ifpackagelater |
| 928 |
\let\IfClassAtLeastTF\@ifclasslater |
| 929 |
\def\IfFileAtLeastTF#1{\expandafter\@ifl@t@r\csname ver@#1\endcsname} |
| 930 |
% \end{macrocode} |
| 931 |
% For rollback pretend it was available since the beginning of dawn. |
| 932 |
% \begin{macrocode} |
| 933 |
%</2ekernel|latexrelease> |
| 934 |
%<latexrelease>\EndIncludeInRelease |
| 935 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 936 |
%<latexrelease> {\IfFormatAtLeastTF}{Test format date}% |
| 937 |
%<latexrelease>\def\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} |
| 938 |
%<latexrelease>\let\IfPackageAtLeastTF\@ifpackagelater |
| 939 |
%<latexrelease>\let\IfClassAtLeastTF\@ifclasslater |
| 940 |
%<latexrelease>\def\IfFileAtLeastTF#1{\expandafter\@ifl@t@r\csname ver@#1\endcsname} |
| 941 |
%<latexrelease>\EndIncludeInRelease |
| 942 |
%<*2ekernel> |
| 943 |
% \end{macrocode} |
| 944 |
% \end{macro} |
| 945 |
% \end{macro} |
| 946 |
% \end{macro} |
| 947 |
% \end{macro} |
| 948 |
% |
| 949 |
% \begin{macro}{\@ifl@ter} |
| 950 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 951 |
% \begin{macrocode} |
| 952 |
\def\@ifl@ter#1#2{% |
| 953 |
\expandafter\@ifl@t@r |
| 954 |
\csname ver@#2.#1\endcsname} |
| 955 |
%</2ekernel> |
| 956 |
% \end{macrocode} |
| 957 |
% |
| 958 |
% This internal macro is also used in |\NeedsTeXFormat|. |
| 959 |
% \changes{v0.2f}{1993/11/22} |
| 960 |
% {Added //00 so parsing never produces a runaway argument.} |
| 961 |
% \changes{v1.2d}{2018/02/18} |
| 962 |
% {Added 0 up front to make bad data come out as 0.} |
| 963 |
% \changes{v1.2g}{2018/04/08} |
| 964 |
% {Strip leading spaces from dates.} |
| 965 |
% \begin{macrocode} |
| 966 |
%<latexrelease>\IncludeInRelease{2018/04/01}% |
| 967 |
%<latexrelease> {\@ifl@t@r}{Guard against bad input}% |
| 968 |
%<*2ekernel|latexrelease> |
| 969 |
\def\@ifl@t@r#1#2{% |
| 970 |
\ifnum\expandafter\@parse@version@#1//00\@nil<% |
| 971 |
\expandafter\@parse@version@#2//00\@nil |
| 972 |
\expandafter\@secondoftwo |
| 973 |
\else |
| 974 |
\expandafter\@firstoftwo |
| 975 |
\fi} |
| 976 |
\def\@parse@version@#1{\@parse@version0#1} |
| 977 |
%</2ekernel|latexrelease> |
| 978 |
%<latexrelease>\EndIncludeInRelease |
| 979 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 980 |
%<latexrelease> {\@ifl@t@r}{Guard against bad input}% |
| 981 |
%<latexrelease>\def\@ifl@t@r#1#2{% |
| 982 |
%<latexrelease> \ifnum\expandafter\@parse@version#1//00\@nil<% |
| 983 |
%<latexrelease> \expandafter\@parse@version#2//00\@nil |
| 984 |
%<latexrelease> \expandafter\@secondoftwo |
| 985 |
%<latexrelease> \else |
| 986 |
%<latexrelease> \expandafter\@firstoftwo |
| 987 |
%<latexrelease> \fi} |
| 988 |
%<latexrelease>\let\@parse@version@\@undefined |
| 989 |
%<latexrelease>\EndIncludeInRelease |
| 990 |
%<*2ekernel> |
| 991 |
% \end{macrocode} |
| 992 |
% |
| 993 |
% \end{macro} |
| 994 |
% |
| 995 |
% \changes{v1.1j}{2016/06/20} |
| 996 |
% {don't declare as \cs{@onlypreamble}} |
| 997 |
% \changes{v1.2c}{2017/03/08} |
| 998 |
% {add \cs{@parse@version@dash} to support yyyy-mm-dd as well as yyyy/mm/dd } |
| 999 |
% \begin{macrocode} |
| 1000 |
%</2ekernel> |
| 1001 |
%<*2ekernel|latexreleasefirst> |
| 1002 |
\def\@parse@version#1/#2/#3#4#5\@nil{% |
| 1003 |
\@parse@version@dash#1-#2-#3#4\@nil |
| 1004 |
} |
| 1005 |
% \end{macrocode} |
| 1006 |
% |
| 1007 |
% The |\if| test here ensures that an argument with no |/| or |-| produces 0 (actually 00). |
| 1008 |
% \begin{macrocode} |
| 1009 |
\def\@parse@version@dash#1-#2-#3#4#5\@nil{% |
| 1010 |
\if\relax#2\relax\else#1\fi#2#3#4 } |
| 1011 |
%</2ekernel|latexreleasefirst> |
| 1012 |
%<*2ekernel> |
| 1013 |
% \end{macrocode} |
| 1014 |
% |
| 1015 |
% |
| 1016 |
% |
| 1017 |
% \begin{macro}{\@ifpackagewith} |
| 1018 |
% \begin{macro}{\@ifclasswith} |
| 1019 |
% |\@ifpackagewith{|\meta{name}|}{|\meta{option-list}|}| |
| 1020 |
% Checks that \meta{option-list} is a subset of the options |
| 1021 |
% \textbf{with} which \meta{name} was loaded. |
| 1022 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 1023 |
% \begin{macrocode} |
| 1024 |
\def\@ifpackagewith{\@if@ptions\@pkgextension} |
| 1025 |
\def\@ifclasswith{\@if@ptions\@clsextension} |
| 1026 |
% \end{macrocode} |
| 1027 |
% |
| 1028 |
% \begin{macrocode} |
| 1029 |
\def\@if@ptions#1#2{% |
| 1030 |
\@expandtwoargs\@if@pti@ns{\@ptionlist{#2.#1}}} |
| 1031 |
% \end{macrocode} |
| 1032 |
% |
| 1033 |
% Probably shouldn't use |\CurrentOption| here\ldots (changed to |
| 1034 |
% |\reserved@b|.) |
| 1035 |
% \changes{v0.2y}{1994/02/07} |
| 1036 |
% {Add extra ,s so `two' is not matched with `twocolumn'} |
| 1037 |
% \changes{v1.1i}{2011/08/19} |
| 1038 |
% {Re-jig definition after more stringent \cs{in@} test.} |
| 1039 |
% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} |
| 1040 |
% \begin{macrocode} |
| 1041 |
%</2ekernel> |
| 1042 |
%<latexrelease>\IncludeInRelease{2017/01/01}% |
| 1043 |
%<latexrelease> {\@if@pti@ns}{Spaces in option clash check}% |
| 1044 |
%<*2ekernel|latexrelease> |
| 1045 |
\def\@if@pti@ns#1#2{% |
| 1046 |
\let\reserved@a\@firstoftwo |
| 1047 |
% \end{macrocode} |
| 1048 |
% \changes{v1.2a}{2016/10/02} |
| 1049 |
% {Ignore spaces while checking for option clash} |
| 1050 |
% \begin{macrocode} |
| 1051 |
\edef\reserved@b{\zap@space#2 \@empty}% |
| 1052 |
\@for\reserved@b:=\reserved@b\do{% |
| 1053 |
\ifx\reserved@b\@empty |
| 1054 |
\else |
| 1055 |
\expandafter\in@\expandafter{\expandafter,\reserved@b,}{,#1,}% |
| 1056 |
\ifin@ |
| 1057 |
\else |
| 1058 |
\let\reserved@a\@secondoftwo |
| 1059 |
\fi |
| 1060 |
\fi |
| 1061 |
}% |
| 1062 |
\reserved@a} |
| 1063 |
%</2ekernel|latexrelease> |
| 1064 |
%<latexrelease>\EndIncludeInRelease |
| 1065 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1066 |
%<latexrelease> {\@if@pti@ns}{Spaces in option clash check}% |
| 1067 |
%<latexrelease>\def\@if@pti@ns#1#2{% |
| 1068 |
%<latexrelease> \let\reserved@a\@firstoftwo |
| 1069 |
%<latexrelease> \@for\reserved@b:=#2\do{% |
| 1070 |
%<latexrelease> \ifx\reserved@b\@empty |
| 1071 |
%<latexrelease> \else |
| 1072 |
%<latexrelease> \expandafter\in@\expandafter |
| 1073 |
%<latexrelease> {\expandafter,\reserved@b,}{,#1,}% |
| 1074 |
%<latexrelease> \ifin@ |
| 1075 |
%<latexrelease> \else |
| 1076 |
%<latexrelease> \let\reserved@a\@secondoftwo |
| 1077 |
%<latexrelease> \fi |
| 1078 |
%<latexrelease> \fi |
| 1079 |
%<latexrelease> }% |
| 1080 |
%<latexrelease> \reserved@a} |
| 1081 |
%<latexrelease>\EndIncludeInRelease |
| 1082 |
%<*2ekernel> |
| 1083 |
% \end{macrocode} |
| 1084 |
% |
| 1085 |
% \end{macro} |
| 1086 |
% \end{macro} |
| 1087 |
% |
| 1088 |
% |
| 1089 |
% |
| 1090 |
% |
| 1091 |
% \begin{macro}{\IfPackageLoadedTF,\IfPackageLoadedWithOptionsTF, |
| 1092 |
% \IfClassLoadedTF,\IfClassLoadedWithOptionsTF} |
| 1093 |
% More public names for the commands already available for a long time. |
| 1094 |
% \begin{macrocode} |
| 1095 |
%</2ekernel> |
| 1096 |
%<*2ekernel|latexrelease> |
| 1097 |
%<latexrelease>\IncludeInRelease{2024/06/01}% |
| 1098 |
%<latexrelease> {\IfPackageLoadedTF}{Test package loading}% |
| 1099 |
\let \IfPackageLoadedTF \@ifpackageloaded |
| 1100 |
\let \IfClassLoadedTF \@ifclassloaded |
| 1101 |
\let \IfPackageLoadedWithOptionsTF \@ifpackagewith |
| 1102 |
\let \IfClassLoadedWithOptionsTF \@ifclasswith |
| 1103 |
% \end{macrocode} |
| 1104 |
% For rollback/rollforward pretend everything was available since |
| 1105 |
% the beginning of dawn. |
| 1106 |
% \begin{macrocode} |
| 1107 |
%</2ekernel|latexrelease> |
| 1108 |
%<latexrelease>\EndIncludeInRelease |
| 1109 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1110 |
%<latexrelease> {\IfPackageLoadedTF}{Test package loading}% |
| 1111 |
%<latexrelease> |
| 1112 |
%<latexrelease>\let \IfPackageLoadedTF \@ifpackageloaded |
| 1113 |
%<latexrelease>\let \IfClassLoadedTF \@ifclassloaded |
| 1114 |
%<latexrelease>\let \IfPackageLoadedWithOptionsTF \@ifpackagewith |
| 1115 |
%<latexrelease>\let \IfClassLoadedWithOptionsTF \@ifclasswith |
| 1116 |
%<latexrelease> |
| 1117 |
%<latexrelease>\EndIncludeInRelease |
| 1118 |
%<*2ekernel> |
| 1119 |
% \end{macrocode} |
| 1120 |
% \end{macro} |
| 1121 |
% |
| 1122 |
% |
| 1123 |
% |
| 1124 |
% |
| 1125 |
% \begin{macro}{ |
| 1126 |
% \IfPackageLoadedT,\IfPackageLoadedF, |
| 1127 |
% \IfPackageAtLeastT,\IfPackageAtLeastF, |
| 1128 |
% \IfClassAtLeastT,\IfClassAtLeastF, |
| 1129 |
% \IfFileAtLeastT,\IfFileAtLeastF, |
| 1130 |
% \IfFormatAtLeastT,\IfFormatAtLeastF, |
| 1131 |
% \IfPackageLoadedWithOptionsT,\IfPackageLoadedWithOptionsF, |
| 1132 |
% \IfClassLoadedT,\IfClassLoadedF, |
| 1133 |
% \IfClassLoadedWithOptionsF,\IfClassLoadedWithOptionsTF |
| 1134 |
% } |
| 1135 |
% A few more conditionals for convenience |
| 1136 |
% \changes{v1.5k}{2024/04/10}{Provide T and F conditionals not just TF |
| 1137 |
% (gh/1262)} |
| 1138 |
% \changes{v1.5m}{2025/05/10}{avoid errors for par in code argument of T versions (gh/1733)} |
| 1139 |
% \begin{macrocode} |
| 1140 |
%</2ekernel> |
| 1141 |
%<*2ekernel|latexrelease> |
| 1142 |
%<latexrelease>\IncludeInRelease{2024/06/01}% |
| 1143 |
%<latexrelease> {\IfPackageLoadedT}{More conditionals}% |
| 1144 |
\def\IfPackageLoadedT #1{\IfPackageLoadedTF{#1}\@firstofone\@gobble} |
| 1145 |
\def\IfPackageLoadedF #1{\IfPackageLoadedTF{#1}{}} |
| 1146 |
\def\IfClassLoadedT #1{\IfClassLoadedTF{#1}\@firstofone\@gobble} |
| 1147 |
\def\IfClassLoadedF #1{\IfClassLoadedTF{#1}{}} |
| 1148 |
\def\IfPackageAtLeastT#1#2{\IfPackageAtLeastTF{#1}{#2}\@firstofone\@gobble} |
| 1149 |
\def\IfPackageAtLeastF#1#2{\IfPackageAtLeastTF{#1}{#2}{}} |
| 1150 |
\def\IfClassAtLeastT #1#2{\IfClassAtLeastTF{#1}{#2}\@firstofone\@gobble} |
| 1151 |
\def\IfClassAtLeastF #1#2{\IfClassAtLeastTF{#1}{#2}{}} |
| 1152 |
\def\IfFileAtLeastT #1#2{\IfFileAtLeastTF{#1}{#2}\@firstofone\@gobble} |
| 1153 |
\def\IfFileAtLeastF #1#2{\IfFileAtLeastTF{#1}{#2}{}} |
| 1154 |
\def\IfFormatAtLeastT #1{\IfFormatAtLeastTF{#1}\@firstofone\@gobble} |
| 1155 |
\def\IfFormatAtLeastF #1{\IfFormatAtLeastTF{#1}{}} |
| 1156 |
\def\IfPackageLoadedWithOptionsT #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}\@firstofone\@gobble} |
| 1157 |
\def\IfPackageLoadedWithOptionsF #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}{}} |
| 1158 |
\def\IfClassLoadedWithOptionsT #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}\@firstofone\@gobble} |
| 1159 |
\def\IfClassLoadedWithOptionsF #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}{}} |
| 1160 |
% \end{macrocode} |
| 1161 |
% |
| 1162 |
% \begin{macro}{\IfFileLoadedTF,\IfFileLoadedT,\IfFileLoadedF} |
| 1163 |
% These three commands haven't been there at all in the past. |
| 1164 |
% \changes{v1.5k}{2024/04/10}{Provide \cs{IfFileLoadedTF} and variants |
| 1165 |
% (gh/1222)} |
| 1166 |
% \begin{macrocode} |
| 1167 |
\def\IfFileLoadedTF#1{% |
| 1168 |
\expandafter\ifx\csname ver@#1\endcsname\relax |
| 1169 |
\expandafter\@secondoftwo |
| 1170 |
\else |
| 1171 |
\expandafter\@firstoftwo |
| 1172 |
\fi} |
| 1173 |
\def\IfFileLoadedT #1{\IfFileLoadedTF{#1}\@firstofone\@gobble} |
| 1174 |
\def\IfFileLoadedF #1{\IfFileLoadedTF{#1}{}} |
| 1175 |
% \end{macrocode} |
| 1176 |
% For rollback/rollforward pretend everything was available since |
| 1177 |
% the beginning of dawn. |
| 1178 |
% \begin{macrocode} |
| 1179 |
%</2ekernel|latexrelease> |
| 1180 |
%<latexrelease>\EndIncludeInRelease |
| 1181 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1182 |
%<latexrelease> {\IfPackageLoadedT}{More conditionals}% |
| 1183 |
%<latexrelease> |
| 1184 |
%<latexrelease>\def\IfPackageLoadedT #1#2{\IfPackageLoadedTF{#1}{#2}{}} |
| 1185 |
%<latexrelease>\def\IfPackageLoadedF #1{\IfPackageLoadedTF{#1}{}} |
| 1186 |
%<latexrelease>\def\IfClassLoadedT #1#2{\IfClassLoadedTF{#1}{#2}{}} |
| 1187 |
%<latexrelease>\def\IfClassLoadedF #1{\IfClassLoadedTF{#1}{}} |
| 1188 |
%<latexrelease>\def\IfPackageAtLeastT#1#2#3{\IfPackageAtLeastTF{#1}{#2}{#3}{}} |
| 1189 |
%<latexrelease>\def\IfPackageAtLeastF #1#2{\IfPackageAtLeastTF{#1}{#2}{}} |
| 1190 |
%<latexrelease>\def\IfClassAtLeastT #1#2#3{\IfClassAtLeastTF{#1}{#2}{#3}{}} |
| 1191 |
%<latexrelease>\def\IfClassAtLeastF #1#2{\IfClassAtLeastTF{#1}{#2}{}} |
| 1192 |
%<latexrelease>\def\IfFileAtLeastT #1#2#3{\IfFileAtLeastTF{#1}{#2}{#3}{}} |
| 1193 |
%<latexrelease>\def\IfFileAtLeastF #1#2{\IfFileAtLeastTF{#1}{#2}{}} |
| 1194 |
%<latexrelease>\def\IfFormatAtLeastT #1#2{\IfFormatAtLeastTF{#1}{#2}{}} |
| 1195 |
%<latexrelease>\def\IfFormatAtLeastF #1{\IfFormatAtLeastTF{#1}{}} |
| 1196 |
%<latexrelease>\def\IfPackageLoadedWithOptionsT #1#2#3{\IfPackageLoadedWithOptionsTF{#1}{#2}{#3}{}} |
| 1197 |
%<latexrelease>\def\IfPackageLoadedWithOptionsF #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}{}} |
| 1198 |
%<latexrelease>\def\IfClassLoadedWithOptionsT #1#2#3{\IfClassLoadedWithOptionsTF{#1}{#2}{#3}{}} |
| 1199 |
%<latexrelease>\def\IfClassLoadedWithOptionsF #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}{}} |
| 1200 |
%<latexrelease> |
| 1201 |
%<latexrelease>\def\IfFileLoadedTF#1{% |
| 1202 |
%<latexrelease> \expandafter\ifx\csname ver@#1\endcsname\relax |
| 1203 |
%<latexrelease> \expandafter\@secondoftwo |
| 1204 |
%<latexrelease> \else |
| 1205 |
%<latexrelease> \expandafter\@firstoftwo |
| 1206 |
%<latexrelease> \fi} |
| 1207 |
%<latexrelease>\def\IfFileLoadedT#1#2{\IfFileLoadedTF{#1}{#2}{}} |
| 1208 |
%<latexrelease>\def\IfFileLoadedF #1{\IfFileLoadedTF{#1}{}} |
| 1209 |
%<latexrelease> |
| 1210 |
%<latexrelease>\EndIncludeInRelease |
| 1211 |
%<*2ekernel> |
| 1212 |
% \end{macrocode} |
| 1213 |
% \end{macro} |
| 1214 |
% \end{macro} |
| 1215 |
% |
| 1216 |
% |
| 1217 |
% |
| 1218 |
% |
| 1219 |
% \begin{macro}{\ProvidesPackage} |
| 1220 |
% Checks that the current filename is correct, and defines |
| 1221 |
% |\ver@filename|. |
| 1222 |
% \changes{v0.3c}{1994/03/12} |
| 1223 |
% {Add \cs{wlog}} |
| 1224 |
% \changes{v0.3c}{1994/03/12} |
| 1225 |
% {use \cs{@gtempa}} |
| 1226 |
% \begin{macrocode} |
| 1227 |
%</2ekernel> |
| 1228 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 1229 |
%<latexrelease> {\ProvidesPackage}{Check name with \strcmp}% |
| 1230 |
%<*2ekernel|latexrelease> |
| 1231 |
\def\ProvidesPackage#1{% |
| 1232 |
\xdef\@gtempa{#1}% |
| 1233 |
% \end{macrocode} |
| 1234 |
% \changes{v1.3u}{2020/11/20} |
| 1235 |
% {Use string comparison instead of \cs{ifx}} |
| 1236 |
% Here \cs{@currpath} is explicitly added to the file name to report |
| 1237 |
% when a package or class is loaded using an explicit path. Loading |
| 1238 |
% using a path in the argument is supported but not encouraged. |
| 1239 |
% \begin{macrocode} |
| 1240 |
\@expandtwoargs\@expl@str@if@eq@@nnTF |
| 1241 |
{\@gtempa}{\@currpath\@currname}{}{% |
| 1242 |
\@latex@warning@no@line{You have requested |
| 1243 |
\@cls@pkg\space`\@currpath\@currname',\MessageBreak |
| 1244 |
but the \@cls@pkg\space provides `#1'}% |
| 1245 |
}% |
| 1246 |
\@ifnextchar[\@pr@videpackage{\@pr@videpackage[]}}%] |
| 1247 |
\@onlypreamble\ProvidesPackage |
| 1248 |
%</2ekernel|latexrelease> |
| 1249 |
%<latexrelease>\EndIncludeInRelease |
| 1250 |
% |
| 1251 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1252 |
%<latexrelease> {\ProvidesPackage}{Undo: check name with \strcmp}% |
| 1253 |
%<latexrelease>\def\ProvidesPackage#1{% |
| 1254 |
%<latexrelease> \xdef\@gtempa{#1}% |
| 1255 |
%<latexrelease> \ifx\@gtempa\@currname\else |
| 1256 |
%<latexrelease> \@latex@warning@no@line{You have requested |
| 1257 |
%<latexrelease> \@cls@pkg\space`\@currname',\MessageBreak |
| 1258 |
%<latexrelease> but the \@cls@pkg\space provides `#1'}% |
| 1259 |
%<latexrelease> \fi |
| 1260 |
%<latexrelease> \@ifnextchar[\@pr@videpackage{\@pr@videpackage[]}}%] |
| 1261 |
%<latexrelease>\EndIncludeInRelease |
| 1262 |
%<*2ekernel> |
| 1263 |
% \end{macrocode} |
| 1264 |
% \end{macro} |
| 1265 |
% |
| 1266 |
% |
| 1267 |
% |
| 1268 |
% \begin{macro}{\@pr@videpackage} |
| 1269 |
% This is the helper command for \cs{ProvidesPackage}. It tries to |
| 1270 |
% be cautious when handling the identification string in case it |
| 1271 |
% contains UTF-8 characters. |
| 1272 |
% \changes{v1.3e}{2019/11/29}{Protect package info text (gh/52)} |
| 1273 |
% \changes{v1.3r}{2020/10/01}{Allow for package substitution} |
| 1274 |
% \begin{macrocode} |
| 1275 |
%</2ekernel> |
| 1276 |
%<*2ekernel|latexrelease> |
| 1277 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 1278 |
%<latexrelease> {\@pr@videpackage}{Allow for package substitution}% |
| 1279 |
\def\@pr@videpackage[#1]{% |
| 1280 |
\expandafter\protected@xdef % <-- protected... |
| 1281 |
\csname ver@\@currname.\@currext\endcsname{#1}% Loaded package |
| 1282 |
\expandafter\let |
| 1283 |
\csname ver@\@currpkg@reqd\expandafter\endcsname % Requested package |
| 1284 |
\csname ver@\@currname.\@currext\endcsname |
| 1285 |
\ifx\@currext\@clsextension |
| 1286 |
\typeout{Document Class: \@gtempa\space#1}% |
| 1287 |
\else |
| 1288 |
\protected@wlog{Package: \@gtempa\space#1}% <--- protected |
| 1289 |
\fi} |
| 1290 |
% \end{macrocode} |
| 1291 |
% \end{macro} |
| 1292 |
% |
| 1293 |
% |
| 1294 |
% |
| 1295 |
% \begin{macro}{\protected@wlog} |
| 1296 |
% This is like plain \TeX's \cs{wlog} but gracefully handles |
| 1297 |
% protected commands. |
| 1298 |
% \begin{macrocode} |
| 1299 |
\long\def\protected@wlog#1{\begingroup |
| 1300 |
\set@display@protect |
| 1301 |
\immediate \write \m@ne {#1}\endgroup } |
| 1302 |
% \end{macrocode} |
| 1303 |
% \end{macro} |
| 1304 |
% |
| 1305 |
% |
| 1306 |
% \begin{macrocode} |
| 1307 |
%</2ekernel|latexrelease> |
| 1308 |
%<latexrelease>\EndIncludeInRelease |
| 1309 |
%<latexrelease>\IncludeInRelease{2020/02/02}% |
| 1310 |
%<latexrelease> {\@pr@videpackage}{Protection for package info}% |
| 1311 |
%<latexrelease> |
| 1312 |
%<latexrelease>\def\@pr@videpackage[#1]{% |
| 1313 |
%<latexrelease> \expandafter\protected@xdef % <-- protected... |
| 1314 |
%<latexrelease> \csname ver@\@currname.\@currext\endcsname{#1}% |
| 1315 |
%<latexrelease>\ifx\@currext\@clsextension |
| 1316 |
%<latexrelease> \typeout{Document Class: \@gtempa\space#1}% |
| 1317 |
%<latexrelease> \else |
| 1318 |
%<latexrelease> \protected@wlog{Package: \@gtempa\space#1}% <--- protected |
| 1319 |
%<latexrelease> \fi} |
| 1320 |
%<latexrelease> |
| 1321 |
%<latexrelease>\EndIncludeInRelease |
| 1322 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1323 |
%<latexrelease> {\@pr@videpackage}{Protection for package info}% |
| 1324 |
%<latexrelease> |
| 1325 |
%<latexrelease>\def\@pr@videpackage[#1]{% |
| 1326 |
%<latexrelease> \expandafter\xdef\csname ver@\@currname.\@currext\endcsname{#1}% |
| 1327 |
%<latexrelease> \ifx\@currext\@clsextension |
| 1328 |
%<latexrelease> \typeout{Document Class: \@gtempa\space#1}% |
| 1329 |
%<latexrelease> \else |
| 1330 |
%<latexrelease> \wlog{Package: \@gtempa\space#1}% |
| 1331 |
%<latexrelease> \fi} |
| 1332 |
%<latexrelease>\let\protected@wlog\@undefined |
| 1333 |
%<latexrelease> |
| 1334 |
%<latexrelease>\EndIncludeInRelease |
| 1335 |
%<*2ekernel> |
| 1336 |
% \end{macrocode} |
| 1337 |
% |
| 1338 |
% \begin{macrocode} |
| 1339 |
\@onlypreamble\@pr@videpackage |
| 1340 |
% \end{macrocode} |
| 1341 |
% |
| 1342 |
% |
| 1343 |
% |
| 1344 |
% \begin{macro}{\ProvidesClass} |
| 1345 |
% Like |\ProvidesPackage|, but for classes. |
| 1346 |
% This needs a dummy \pkg{latexrelease} block to copy the definition |
| 1347 |
% of \cs{ProvidesPackage} as it changes across releases. |
| 1348 |
% \begin{macrocode} |
| 1349 |
%</2ekernel> |
| 1350 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1351 |
%<latexrelease> {\ProvidesClass}{Track \ProvidesPackage}% |
| 1352 |
%<*2ekernel|latexrelease> |
| 1353 |
\let\ProvidesClass\ProvidesPackage |
| 1354 |
\@onlypreamble\ProvidesClass |
| 1355 |
%</2ekernel|latexrelease> |
| 1356 |
%<latexrelease>\EndIncludeInRelease |
| 1357 |
%<*2ekernel> |
| 1358 |
% \end{macrocode} |
| 1359 |
% \end{macro} |
| 1360 |
% |
| 1361 |
% \begin{macro}{\ProvidesFile} |
| 1362 |
% Like |\ProvidesPackage|, but for arbitrary files. Do not apply |
| 1363 |
% |\@onlypreamble| to these, as we may want to label files input |
| 1364 |
% during the document. |
| 1365 |
% \changes{v0.2l}{1993/12/07} |
| 1366 |
% {Macro added} |
| 1367 |
% \changes{v0.3c}{1994/03/12} |
| 1368 |
% {Add \cs{wlog}} |
| 1369 |
% \changes{v0.3g}{1994/04/11} |
| 1370 |
% {Protect against weird catcodes.} |
| 1371 |
% \begin{macro}{\@providesfile} |
| 1372 |
% \changes{v1.0r}{1995/10/17} |
| 1373 |
% {Delay definition of \cs{ProvidesFile} till ltfinal} |
| 1374 |
% \changes{v1.1a}{1998/03/21} |
| 1375 |
% {Allow \&. Internal/2702} |
| 1376 |
% \changes{v1.1d}{2001/05/25}{Explicitly set catcode of |
| 1377 |
% \cs{endlinechar} to 10 (pr/3334)} |
| 1378 |
% \changes{v1.1e}{2001/06/04}{But only if it is a char (pr/3334)} |
| 1379 |
% \changes{v1.1f}{2001/08/26}{Readded setting of space char (pr/3353)} |
| 1380 |
% \begin{macrocode} |
| 1381 |
\def\ProvidesFile#1{% |
| 1382 |
\begingroup |
| 1383 |
\catcode`\ 10 % |
| 1384 |
\ifnum \endlinechar<256 % |
| 1385 |
\ifnum \endlinechar>\m@ne |
| 1386 |
\catcode\endlinechar 10 % |
| 1387 |
\fi |
| 1388 |
\fi |
| 1389 |
\@makeother\/% |
| 1390 |
\@makeother\&% |
| 1391 |
% \end{macrocode} |
| 1392 |
% \changes{v1.1g}{2004/01/28}{Use kernel version of |
| 1393 |
% \cs{@ifnextchar} (pr/3501)} |
| 1394 |
% \begin{macrocode} |
| 1395 |
\kernel@ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}} |
| 1396 |
% \end{macrocode} |
| 1397 |
% |
| 1398 |
% During initex a special version of |\@providesfile| is used. |
| 1399 |
% The real definition is installed right at the end, in |ltfinal.dtx|. |
| 1400 |
%\begin{verbatim} |
| 1401 |
%\def\@providesfile#1[#2]{% |
| 1402 |
% \wlog{File: #1 #2}% |
| 1403 |
% \expandafter\xdef\csname ver@#1\endcsname{#2}% |
| 1404 |
% \endgroup} |
| 1405 |
%\end{verbatim} |
| 1406 |
% \end{macro} |
| 1407 |
% \end{macro} |
| 1408 |
% |
| 1409 |
% \begin{macro}{\PassOptionsToPackage} |
| 1410 |
% \begin{macro}{\PassOptionsToClass} |
| 1411 |
% If the package has been loaded, we check that it was first loaded with |
| 1412 |
% the options. Otherwise we add the option list to that of the package. |
| 1413 |
% \changes{v1.3t}{2020/10/18}{Drop path from \cs{input@path} (gh/414).} |
| 1414 |
% \changes{v1.3x}{2021/02/18}{save raw option lists (gh/85)} |
| 1415 |
% \begin{macrocode} |
| 1416 |
%</2ekernel> |
| 1417 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 1418 |
%<latexrelease> {\@pass@ptions}{Raw option lists}% |
| 1419 |
%<*2ekernel|latexrelease> |
| 1420 |
\def\@pass@ptions#1#2#3{% |
| 1421 |
\@expl@@@filehook@set@curr@file@@nNN |
| 1422 |
{\@expl@@@filehook@resolve@file@subst@@w #3.#1\@nil}% |
| 1423 |
\reserved@a\reserved@b |
| 1424 |
\@expl@@@filehook@clear@replacement@flag@@ |
| 1425 |
% \end{macrocode} |
| 1426 |
% \changes{v1.5d}{2022/10/10}{Use \cs{protected@xdef}.} |
| 1427 |
% \begin{macrocode} |
| 1428 |
\expandafter\protected@xdef\csname opt@\reserved@a\endcsname{% |
| 1429 |
\@ifundefined{opt@\reserved@a}\@empty |
| 1430 |
{\csname opt@\reserved@a\endcsname,}% |
| 1431 |
\zap@space#2 \@empty}% |
| 1432 |
% \end{macrocode} |
| 1433 |
% \changes{v1.3u}{2020/11/20} |
| 1434 |
% {Copy option list to the requested package.} |
| 1435 |
% \begin{macrocode} |
| 1436 |
\expandafter\let |
| 1437 |
\csname opt@#3.#1\expandafter\endcsname |
| 1438 |
\csname opt@\reserved@a\endcsname |
| 1439 |
% \end{macrocode} |
| 1440 |
% Extend raw option list |
| 1441 |
% \changes{v1.4c}{2021/06/06} |
| 1442 |
% {apply \cs{expandafter} to raw options for gh/580} |
| 1443 |
% \begin{macrocode} |
| 1444 |
\@ifundefined{@raw@opt@#3.#1}% |
| 1445 |
{\expandafter\gdef\csname @raw@opt@#3.#1\expandafter\endcsname |
| 1446 |
\expandafter{#2}}% |
| 1447 |
{\expandafter\g@addto@macro\csname @raw@opt@#3.#1\expandafter\endcsname |
| 1448 |
\expandafter{\expandafter,#2}}% |
| 1449 |
} |
| 1450 |
%</2ekernel|latexrelease> |
| 1451 |
%<latexrelease>\EndIncludeInRelease |
| 1452 |
% \end{macrocode} |
| 1453 |
% |
| 1454 |
% \begin{macrocode} |
| 1455 |
%<latexrelease>\IncludeInRelease{2020/10/01}{\@pass@ptions} |
| 1456 |
%<latexrelease> {Add file replacement in \@pass@ptions}% |
| 1457 |
%<latexrelease> |
| 1458 |
%<latexrelease>\def\@pass@ptions#1#2#3{% |
| 1459 |
%<latexrelease> \@expl@@@filehook@set@curr@file@@nNN |
| 1460 |
%<latexrelease> {\@expl@@@filehook@resolve@file@subst@@w #3.#1\@nil}% |
| 1461 |
%<latexrelease> \reserved@a\reserved@b |
| 1462 |
%<latexrelease> \@expl@@@filehook@clear@replacement@flag@@ |
| 1463 |
%<latexrelease> \expandafter\xdef\csname opt@\reserved@a\endcsname{% |
| 1464 |
%<latexrelease> \@ifundefined{opt@\reserved@a}\@empty |
| 1465 |
%<latexrelease> {\csname opt@\reserved@a\endcsname,}% |
| 1466 |
%<latexrelease> \zap@space#2 \@empty}% |
| 1467 |
%<latexrelease> \expandafter\let |
| 1468 |
%<latexrelease> \csname opt@#3.#1\expandafter\endcsname |
| 1469 |
%<latexrelease> \csname opt@\reserved@a\endcsname} |
| 1470 |
%<latexrelease>\EndIncludeInRelease |
| 1471 |
% \end{macrocode} |
| 1472 |
% |
| 1473 |
% \begin{macrocode} |
| 1474 |
%<latexrelease>\IncludeInRelease{0000/00/00}{\@pass@ptions} |
| 1475 |
%<latexrelease> {\@pass@ptions}% |
| 1476 |
%<latexrelease> |
| 1477 |
%<latexrelease>\def\@pass@ptions#1#2#3{% |
| 1478 |
%<latexrelease> \expandafter\xdef\csname opt@#3.#1\endcsname{% |
| 1479 |
%<latexrelease> \@ifundefined{opt@#3.#1}\@empty |
| 1480 |
%<latexrelease> {\csname opt@#3.#1\endcsname,}% |
| 1481 |
%<latexrelease> \zap@space#2 \@empty}} |
| 1482 |
%<latexrelease>\EndIncludeInRelease |
| 1483 |
%<*2ekernel> |
| 1484 |
% \end{macrocode} |
| 1485 |
% |
| 1486 |
% \begin{macrocode} |
| 1487 |
\@onlypreamble\@pass@ptions |
| 1488 |
% \end{macrocode} |
| 1489 |
% |
| 1490 |
% \begin{macrocode} |
| 1491 |
\def\PassOptionsToPackage{\@pass@ptions\@pkgextension} |
| 1492 |
\def\PassOptionsToClass{\@pass@ptions\@clsextension} |
| 1493 |
\@onlypreamble\PassOptionsToPackage |
| 1494 |
\@onlypreamble\PassOptionsToClass |
| 1495 |
% \end{macrocode} |
| 1496 |
% \end{macro} |
| 1497 |
% \end{macro} |
| 1498 |
% |
| 1499 |
% \begin{macro}{\DeclareOption} |
| 1500 |
% \begin{macro}{\DeclareOption*} |
| 1501 |
% Adds an option as a |\ds@| command, or the default |\default@ds| |
| 1502 |
% command. |
| 1503 |
% \changes{v0.2c}{1993/11/17} |
| 1504 |
% {Error checking added} |
| 1505 |
% \changes{v1.0m}{1995/04/21} |
| 1506 |
% {Made long /1498} |
| 1507 |
% \changes{v1.0n}{1995/05/12} |
| 1508 |
% {Use \cs{toks@} to remove need to double hash /1557} |
| 1509 |
% \begin{macrocode} |
| 1510 |
\def\DeclareOption{% |
| 1511 |
\let\@fileswith@pti@ns\@badrequireerror |
| 1512 |
\@ifstar\@defdefault@ds\@declareoption} |
| 1513 |
\long\def\@declareoption#1#2{% |
| 1514 |
\xdef\@declaredoptions{\@declaredoptions,#1}% |
| 1515 |
\toks@{#2}% |
| 1516 |
\expandafter\edef\csname ds@#1\endcsname{\the\toks@}} |
| 1517 |
\long\def\@defdefault@ds#1{% |
| 1518 |
\toks@{#1}% |
| 1519 |
\edef\default@ds{\the\toks@}} |
| 1520 |
\@onlypreamble\DeclareOption |
| 1521 |
\@onlypreamble\@declareoption |
| 1522 |
\@onlypreamble\@defdefault@ds |
| 1523 |
% \end{macrocode} |
| 1524 |
% \end{macro} |
| 1525 |
% \end{macro} |
| 1526 |
% |
| 1527 |
% \begin{macro}{\OptionNotUsed} |
| 1528 |
% \changes{v1.3x}{2021/02/18}{filter out =value from unused option list (gh/85)} |
| 1529 |
% \begin{macro}{\@remove@eq@value} |
| 1530 |
% \changes{v1.3x}{2021/02/18}{macro added (gh/85)} |
| 1531 |
% If we are in a class file, add |\CurrentOption| to the list of |
| 1532 |
% unused options. Otherwise, in a package file do nothing. |
| 1533 |
% \begin{macrocode} |
| 1534 |
%</2ekernel> |
| 1535 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 1536 |
%<latexrelease> {\OptionNotUsed}{filter unused option list}% |
| 1537 |
%<*2ekernel|latexrelease> |
| 1538 |
\ExplSyntaxOn |
| 1539 |
\def\@remove@eq@value#1=#2\@nil{\tl_trim_spaces:n{#1}} |
| 1540 |
\ExplSyntaxOff |
| 1541 |
% \end{macrocode} |
| 1542 |
% |
| 1543 |
% \begin{macrocode} |
| 1544 |
\def\OptionNotUsed{% |
| 1545 |
\ifx\@currext\@clsextension |
| 1546 |
\xdef\@unusedoptionlist{% |
| 1547 |
\ifx\@unusedoptionlist\@empty\else\@unusedoptionlist,\fi |
| 1548 |
\expandafter\@remove@eq@value\CurrentOption=\@nil}% |
| 1549 |
\fi} |
| 1550 |
%</2ekernel|latexrelease> |
| 1551 |
%<latexrelease>\EndIncludeInRelease |
| 1552 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1553 |
%<latexrelease> {\OptionNotUsed}{filter unused option list}% |
| 1554 |
%<latexrelease>\let\@remove@eq@value\@undefined |
| 1555 |
% \end{macrocode} |
| 1556 |
% |
| 1557 |
% \begin{macrocode} |
| 1558 |
%<latexrelease>\def\OptionNotUsed{% |
| 1559 |
%<latexrelease> \ifx\@currext\@clsextension |
| 1560 |
%<latexrelease> \xdef\@unusedoptionlist{% |
| 1561 |
%<latexrelease> \ifx\@unusedoptionlist\@empty\else\@unusedoptionlist,\fi |
| 1562 |
%<latexrelease> \CurrentOption}% |
| 1563 |
%<latexrelease> \fi} |
| 1564 |
%<latexrelease>\EndIncludeInRelease |
| 1565 |
%<*2ekernel> |
| 1566 |
% \end{macrocode} |
| 1567 |
% |
| 1568 |
% \begin{macrocode} |
| 1569 |
\@onlypreamble\OptionNotUsed |
| 1570 |
% \end{macrocode} |
| 1571 |
% \end{macro} |
| 1572 |
% \end{macro} |
| 1573 |
% |
| 1574 |
% \begin{macro}{\default@ds} |
| 1575 |
% The default option code. |
| 1576 |
% Set by |\@onefilewithoptions| to either |\OptionNotUsed| for |
| 1577 |
% classes, or |\@unknownoptionerror| for packages. This may be reset |
| 1578 |
% in either case with |\DeclareOption*|. |
| 1579 |
% \begin{macrocode} |
| 1580 |
% \let\default@ds\OptionNotUsed |
| 1581 |
% \end{macrocode} |
| 1582 |
% \end{macro} |
| 1583 |
% |
| 1584 |
% \begin{macro}{\ProcessOptions} |
| 1585 |
% \begin{macro}{\ProcessOptions*} |
| 1586 |
% |\ProcessOptions| calls |\ds@option| for each known package option, |
| 1587 |
% then calls |\default@ds| for each option on the local options list. |
| 1588 |
% Finally resets all the declared options to |\relax|. The empty option |
| 1589 |
% does nothing, this has to be reset on the off chance it's set to |
| 1590 |
% |\relax| if an empty element gets into the |\@declaredoptions| list. |
| 1591 |
% |
| 1592 |
% The star form is similar but executes options given in the order |
| 1593 |
% specified in the document, not the order they are declared in the |
| 1594 |
% file. In the case of packages, global options are executed before |
| 1595 |
% local ones. |
| 1596 |
% \changes{v0.2a}{1993/11/14} |
| 1597 |
% {Stop adding the global option list inside class files.} |
| 1598 |
% \changes{v0.2a}{1993/11/14} |
| 1599 |
% {Optimize `empty option' code.} |
| 1600 |
% \changes{v0.2b}{1993/11/15} |
| 1601 |
% {Star form added.} |
| 1602 |
% \changes{v0.2c}{1993/11/17} |
| 1603 |
% {restoring \cs{@fileswith@pti@ns} added.} |
| 1604 |
% \changes{v1.5d}{2022/10/10} |
| 1605 |
% {Use \cs{protected@edef}.} |
| 1606 |
% \begin{macrocode} |
| 1607 |
\def\ProcessOptions{% |
| 1608 |
\let\ds@\@empty |
| 1609 |
\protected@edef\@curroptions{\@ptionlist{\@currname.\@currext}}% |
| 1610 |
\@ifstar\@xprocess@ptions\@process@ptions} |
| 1611 |
\@onlypreamble\ProcessOptions |
| 1612 |
% \end{macrocode} |
| 1613 |
% |
| 1614 |
% \changes{v0.2y}{1994/02/07} |
| 1615 |
% {Add extra ,s so `two' is not matched with `twocolumn'} |
| 1616 |
% \begin{macrocode} |
| 1617 |
\def\@process@ptions{% |
| 1618 |
\@for\CurrentOption:=\@declaredoptions\do{% |
| 1619 |
\ifx\CurrentOption\@empty\else |
| 1620 |
\@expandtwoargs\in@{,\CurrentOption,}{% |
| 1621 |
,\ifx\@currext\@clsextension\else\@classoptionslist,\fi |
| 1622 |
\@curroptions,}% |
| 1623 |
\ifin@ |
| 1624 |
\@use@ption |
| 1625 |
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty |
| 1626 |
\fi |
| 1627 |
\fi}% |
| 1628 |
\@process@pti@ns} |
| 1629 |
\@onlypreamble\@process@ptions |
| 1630 |
% \end{macrocode} |
| 1631 |
% |
| 1632 |
% \changes{v0.2y}{1994/02/07} |
| 1633 |
% {Add extra ,s so `two' is not matched with `twocolumn'} |
| 1634 |
% \changes{v1.3z}{2021/03/05}{modify so braces to not give errors (gh/513)} |
| 1635 |
% \changes{v1.5e}{2022/10/22}{Use \cs{detokenize}} |
| 1636 |
% \begin{macrocode} |
| 1637 |
%</2ekernel> |
| 1638 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 1639 |
%<latexrelease> {\@xprocess@ptions}{safer @xprocess@ptions}% |
| 1640 |
%<*2ekernel|latexrelease> |
| 1641 |
\def\@xprocess@ptions{% |
| 1642 |
\ifx\@currext\@clsextension\else |
| 1643 |
\ifx\@classoptionslist\relax\else |
| 1644 |
\@for\CurrentOption:=\@classoptionslist\do{% |
| 1645 |
\ifx\CurrentOption\@empty\else |
| 1646 |
\@ifundefined{ds@\detokenize\expandafter{\CurrentOption}}{}{% |
| 1647 |
\@use@ption |
| 1648 |
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty |
| 1649 |
}% |
| 1650 |
\fi}% |
| 1651 |
\fi |
| 1652 |
\fi |
| 1653 |
\@process@pti@ns} |
| 1654 |
%</2ekernel|latexrelease> |
| 1655 |
%<latexrelease>\EndIncludeInRelease |
| 1656 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1657 |
%<latexrelease> {\@xprocess@ptions}{safer @xprocess@ptions}% |
| 1658 |
%<latexrelease>\let\@remove@eq@value\@undefined |
| 1659 |
% \end{macrocode} |
| 1660 |
% |
| 1661 |
% \begin{macrocode} |
| 1662 |
%<latexrelease>\def\@xprocess@ptions{% |
| 1663 |
%<latexrelease> \ifx\@currext\@clsextension\else |
| 1664 |
%<latexrelease> \@for\CurrentOption:=\@classoptionslist\do{% |
| 1665 |
%<latexrelease> \ifx\CurrentOption\@empty\else |
| 1666 |
%<latexrelease> \@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}% |
| 1667 |
%<latexrelease> \ifin@ |
| 1668 |
%<latexrelease> \@use@ption |
| 1669 |
%<latexrelease> \expandafter\let\csname ds@\CurrentOption\endcsname\@empty |
| 1670 |
%<latexrelease> \fi |
| 1671 |
%<latexrelease> \fi}% |
| 1672 |
%<latexrelease> \fi |
| 1673 |
%<latexrelease> \@process@pti@ns} |
| 1674 |
%<latexrelease>\EndIncludeInRelease |
| 1675 |
%<*2ekernel> |
| 1676 |
% \end{macrocode} |
| 1677 |
% |
| 1678 |
% \begin{macrocode} |
| 1679 |
\@onlypreamble\@xprocess@ptions |
| 1680 |
% \end{macrocode} |
| 1681 |
% |
| 1682 |
% The common part of |\ProcessOptions| and |\ProcessOptions*|. |
| 1683 |
% \changes{v1.5e}{2022/10/22}{Use \cs{detokenize}} |
| 1684 |
% \begin{macrocode} |
| 1685 |
%</2ekernel> |
| 1686 |
%<*2ekernel|latexrelease> |
| 1687 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 1688 |
%<latexrelease> {\@process@pti@ns}{Unused options issue}% |
| 1689 |
\def\@process@pti@ns{% |
| 1690 |
\@for\CurrentOption:=\@curroptions\do{% |
| 1691 |
\@ifundefined{ds@\detokenize\expandafter{\CurrentOption}}% |
| 1692 |
{\@use@ption |
| 1693 |
\default@ds}% |
| 1694 |
% \end{macrocode} |
| 1695 |
% There should not be any non-empty definition of |\CurrentOption| at |
| 1696 |
% this point, as all the declared options were executed earlier. This is |
| 1697 |
% for compatibility with 2.09 styles which use |\def\ds@|\ldots\ |
| 1698 |
% directly, and so have options which do not appear in |
| 1699 |
% |\@declaredoptions|. |
| 1700 |
% \begin{macrocode} |
| 1701 |
\@use@ption}% |
| 1702 |
% \end{macrocode} |
| 1703 |
% Clear all the definitions for option code. First set all the declared |
| 1704 |
% options to |\relax|, then reset the `default' and `empty' options. and |
| 1705 |
% the lst of declared options. |
| 1706 |
% \begin{macrocode} |
| 1707 |
\@for\CurrentOption:=\@declaredoptions\do{% |
| 1708 |
\expandafter\let\csname ds@\CurrentOption\endcsname\relax}% |
| 1709 |
% \end{macrocode} |
| 1710 |
% \changes{v1.0r}{1995/10/17} |
| 1711 |
% {Reset \cs{CurrentOption} for graphics/1873} |
| 1712 |
% \changes{v1.3k}{2020/04/07}{Use different method to ignore |
| 1713 |
% unprocessed options (gh/22)} |
| 1714 |
% \begin{macrocode} |
| 1715 |
\let\CurrentOption\@empty |
| 1716 |
\let\@fileswith@pti@ns\@@fileswith@pti@ns |
| 1717 |
\AtEndOfPackage{\expandafter\let |
| 1718 |
\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 1719 |
\relax}} |
| 1720 |
\@onlypreamble\@process@pti@ns |
| 1721 |
%</2ekernel|latexrelease> |
| 1722 |
%<latexrelease>\EndIncludeInRelease |
| 1723 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1724 |
%<latexrelease> {\@process@pti@ns}{Unused options issue}% |
| 1725 |
%<latexrelease> |
| 1726 |
%<latexrelease>\def\@process@pti@ns{% |
| 1727 |
%<latexrelease> \@for\CurrentOption:=\@curroptions\do{% |
| 1728 |
%<latexrelease> \@ifundefined{ds@\CurrentOption}% |
| 1729 |
%<latexrelease> {\@use@ption |
| 1730 |
%<latexrelease> \default@ds}% |
| 1731 |
%<latexrelease> \@use@ption}% |
| 1732 |
%<latexrelease> \@for\CurrentOption:=\@declaredoptions\do{% |
| 1733 |
%<latexrelease> \expandafter\let\csname ds@\CurrentOption\endcsname\relax}% |
| 1734 |
%<latexrelease> \let\CurrentOption\@empty |
| 1735 |
%<latexrelease> \let\@fileswith@pti@ns\@@fileswith@pti@ns |
| 1736 |
%<latexrelease> \AtEndOfPackage{\let\@unprocessedoptions\relax}} |
| 1737 |
%<latexrelease>\EndIncludeInRelease |
| 1738 |
%<*2ekernel> |
| 1739 |
% \end{macrocode} |
| 1740 |
% \end{macro} |
| 1741 |
% \end{macro} |
| 1742 |
% |
| 1743 |
% \begin{macro}{\@options} |
| 1744 |
% |\@options| is a synonym for |\ProcessOptions*| for upward |
| 1745 |
% compatibility with \LaTeX2.09 style files. |
| 1746 |
% \begin{macrocode} |
| 1747 |
\def\@options{\ProcessOptions*} |
| 1748 |
\@onlypreamble\@options |
| 1749 |
% \end{macrocode} |
| 1750 |
% \end{macro} |
| 1751 |
% |
| 1752 |
% \begin{macro}{\@use@ption} |
| 1753 |
% Execute the code for the current option. |
| 1754 |
% \changes{v0.2g}{1993/11/23} |
| 1755 |
% {Name changed from \cs{@executeoption}} |
| 1756 |
% \changes{v1.0e}{1994/05/17} |
| 1757 |
% {Execute option after removing from list, not before} |
| 1758 |
% \changes{v1.3x}{2021/02/18}{filter out =value from unused option list (gh/85)} |
| 1759 |
% \changes{v1.5e}{2022/10/22}{Use \cs{detokenize}} |
| 1760 |
% \begin{macrocode} |
| 1761 |
%</2ekernel> |
| 1762 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 1763 |
%<latexrelease> {\@use@ption}{filter unused option list}% |
| 1764 |
%<*2ekernel|latexrelease> |
| 1765 |
\def\@use@ption{% |
| 1766 |
\@expandtwoargs\@removeelement |
| 1767 |
{\expandafter\@remove@eq@value\CurrentOption=\@nil}% |
| 1768 |
\@unusedoptionlist\@unusedoptionlist |
| 1769 |
\csname ds@\detokenize\expandafter{\CurrentOption}\endcsname} |
| 1770 |
%</2ekernel|latexrelease> |
| 1771 |
%<latexrelease>\EndIncludeInRelease |
| 1772 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1773 |
%<latexrelease> {\@use@ption}{filter unused option list}% |
| 1774 |
%<latexrelease>\def\@use@ption{% |
| 1775 |
%<latexrelease> \@expandtwoargs\@removeelement\CurrentOption |
| 1776 |
%<latexrelease> \@unusedoptionlist\@unusedoptionlist |
| 1777 |
%<latexrelease> \csname ds@\CurrentOption\endcsname} |
| 1778 |
%<latexrelease>\EndIncludeInRelease |
| 1779 |
%<*2ekernel> |
| 1780 |
% \end{macrocode} |
| 1781 |
% |
| 1782 |
% \begin{macrocode} |
| 1783 |
\@onlypreamble\@use@ption |
| 1784 |
% \end{macrocode} |
| 1785 |
% \end{macro} |
| 1786 |
% |
| 1787 |
% \begin{macro}{\ExecuteOptions} |
| 1788 |
% |\ExecuteOptions{|\meta{option-list}|}| executes the code declared |
| 1789 |
% for each option. |
| 1790 |
% \changes{v0.2d}{1993/11/18} |
| 1791 |
% {Use \cs{CurrentOption} not \cs{reserved@a}} |
| 1792 |
% \changes{v0.2k}{1993/12/06} |
| 1793 |
% {Preserve \cs{CurrentOption}.} |
| 1794 |
% \begin{macrocode} |
| 1795 |
%</2ekernel> |
| 1796 |
%<latexrelease>\IncludeInRelease{2017/01/01}% |
| 1797 |
%<latexrelease> {\ExecuteOptions}{Spaces in \ExecuteOptions}% |
| 1798 |
%<*2ekernel|latexrelease> |
| 1799 |
\def\ExecuteOptions#1{% |
| 1800 |
% \end{macrocode} |
| 1801 |
% \changes{v1.2a}{2016/10/02} |
| 1802 |
% {Ignore spaces in argument} |
| 1803 |
% Use |\@fortmp| here as it is anyway cleared during |\@for| loop |
| 1804 |
% so does not change any existing names. |
| 1805 |
% \begin{macrocode} |
| 1806 |
\edef\@fortmp{\zap@space#1 \@empty}% |
| 1807 |
\def\reserved@a##1\@nil{% |
| 1808 |
\@for\CurrentOption:=\@fortmp\do |
| 1809 |
{\csname ds@\CurrentOption\endcsname}% |
| 1810 |
\edef\CurrentOption{##1}}% |
| 1811 |
\expandafter\reserved@a\CurrentOption\@nil} |
| 1812 |
%</2ekernel|latexrelease> |
| 1813 |
%<latexrelease>\EndIncludeInRelease |
| 1814 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1815 |
%<latexrelease> {\ExecuteOptions}{Spaces in \ExecuteOptions}% |
| 1816 |
%<latexrelease>\def\ExecuteOptions#1{% |
| 1817 |
%<latexrelease> \def\reserved@a##1\@nil{% |
| 1818 |
%<latexrelease> \@for\CurrentOption:=#1\do |
| 1819 |
%<latexrelease> {\csname ds@\CurrentOption\endcsname}% |
| 1820 |
%<latexrelease> \edef\CurrentOption{##1}}% |
| 1821 |
%<latexrelease> \expandafter\reserved@a\CurrentOption\@nil} |
| 1822 |
%<latexrelease>\EndIncludeInRelease |
| 1823 |
%<*2ekernel> |
| 1824 |
% \end{macrocode} |
| 1825 |
% |
| 1826 |
% \begin{macrocode} |
| 1827 |
\@onlypreamble\ExecuteOptions |
| 1828 |
% \end{macrocode} |
| 1829 |
% \end{macro} |
| 1830 |
% |
| 1831 |
% The top-level commands, which just set some parameters then call |
| 1832 |
% the internal command, |\@fileswithoptions|. |
| 1833 |
% \begin{macro}{\documentclass} |
| 1834 |
% \changes{v1.0q}{1995/06/19} |
| 1835 |
% {Don't redefine \cs{usepackage} in compat mode for /1634} |
| 1836 |
% The main new-style class declaration. |
| 1837 |
% \begin{macrocode} |
| 1838 |
\def\documentclass{% |
| 1839 |
\let\documentclass\@twoclasseserror |
| 1840 |
\if@compatibility\else\let\usepackage\RequirePackage\fi |
| 1841 |
\@fileswithoptions\@clsextension} |
| 1842 |
\@onlypreamble\documentclass |
| 1843 |
% \end{macrocode} |
| 1844 |
% \end{macro} |
| 1845 |
% |
| 1846 |
% \begin{macro}{\documentstyle} |
| 1847 |
% 2.09 style class `style' declaration. |
| 1848 |
% \changes{v0.2a}{1993/11/14} |
| 1849 |
% {Added \cs{RequirePackage} \cs{@unusedoptionlist} stuff.} |
| 1850 |
% \changes{v0.2b}{1993/11/15} |
| 1851 |
% {Modified to match \cs{ProcessOption*}} |
| 1852 |
% \changes{v0.2d}{1993/11/18} |
| 1853 |
% {Modified \cs{RequirePackage} stuff.} |
| 1854 |
% \changes{v0.2n}{1993/12/09} |
| 1855 |
% {input 209 compatibility file.} |
| 1856 |
% \changes{v0.2o}{1993/12/13} |
| 1857 |
% {compatibility file now latex209.sty.} |
| 1858 |
% \changes{v0.2q}{1993/12/17} |
| 1859 |
% {Match Alan's new code.} |
| 1860 |
% \changes{v0.2u}{1994/01/21} |
| 1861 |
% {compatibility file now latex209.def.} |
| 1862 |
% \begin{macrocode} |
| 1863 |
\def\documentstyle{% |
| 1864 |
\makeatletter\input{latex209.def}\makeatother |
| 1865 |
\documentclass} |
| 1866 |
\@onlypreamble\documentstyle |
| 1867 |
% \end{macrocode} |
| 1868 |
% \end{macro} |
| 1869 |
% |
| 1870 |
% \begin{macro}{\RequirePackage} |
| 1871 |
% Load package if not already loaded. |
| 1872 |
% \begin{macrocode} |
| 1873 |
\def\RequirePackage{% |
| 1874 |
\@fileswithoptions\@pkgextension} |
| 1875 |
\@onlypreamble\RequirePackage |
| 1876 |
% \end{macrocode} |
| 1877 |
% \end{macro} |
| 1878 |
% |
| 1879 |
% \begin{macro}{\LoadClass} |
| 1880 |
% Load class. |
| 1881 |
% \begin{macrocode} |
| 1882 |
\def\LoadClass{% |
| 1883 |
\ifx\@currext\@pkgextension |
| 1884 |
\@latex@error |
| 1885 |
{\noexpand\LoadClass in package file}% |
| 1886 |
{You may only use \noexpand\LoadClass in a class file.}% |
| 1887 |
\fi |
| 1888 |
\@fileswithoptions\@clsextension} |
| 1889 |
\@onlypreamble\LoadClass |
| 1890 |
% \end{macrocode} |
| 1891 |
% \end{macro} |
| 1892 |
% |
| 1893 |
% \begin{macro}{\@loadwithoptions} |
| 1894 |
% \changes{v1.0t}{1995/11/14}{macro added} |
| 1895 |
% \changes{v1.4c}{2021/06/06} |
| 1896 |
% {handle raw options for gh/580} |
| 1897 |
% Pass the current option list on to a class or package. |
| 1898 |
% |#1| is |\@|\emph{cls-or-pkg}|extension|, |
| 1899 |
% |#2| is |\RequirePackage| or |\LoadClass|, |
| 1900 |
% |#3| is the class or package to be loaded. |
| 1901 |
% \begin{macrocode} |
| 1902 |
%</2ekernel> |
| 1903 |
%<latexrelease>\IncludeInRelease{2021/06/01}% |
| 1904 |
%<latexrelease> {\@loadwithoptions}{Raw option lists load with options}% |
| 1905 |
%<*2ekernel|latexrelease> |
| 1906 |
\def\@loadwithoptions#1#2#3{% |
| 1907 |
\expandafter\let\csname opt@#3.#1\expandafter\endcsname |
| 1908 |
\csname opt@\@currname.\@currext\endcsname |
| 1909 |
\expandafter\let\csname @raw@opt@#3.#1\expandafter\endcsname |
| 1910 |
\csname @raw@opt@\@currname.\@currext\endcsname |
| 1911 |
#2{#3}} |
| 1912 |
%</2ekernel|latexrelease> |
| 1913 |
%<latexrelease>\EndIncludeInRelease |
| 1914 |
% \end{macrocode} |
| 1915 |
% |
| 1916 |
% \begin{macrocode} |
| 1917 |
%<latexrelease>\IncludeInRelease{0000/00/00} |
| 1918 |
%<latexrelease> {\@loadwithoptions}{Raw option lists load with options}% |
| 1919 |
%<latexrelease>\def\@loadwithoptions#1#2#3{% |
| 1920 |
%<latexrelease> \expandafter\let\csname opt@#3.#1\expandafter\endcsname |
| 1921 |
%<latexrelease> \csname opt@\@currname.\@currext\endcsname |
| 1922 |
%<latexrelease> #2{#3}} |
| 1923 |
%<latexrelease>\EndIncludeInRelease |
| 1924 |
%<*2ekernel> |
| 1925 |
% \end{macrocode} |
| 1926 |
% |
| 1927 |
% \begin{macrocode} |
| 1928 |
\@onlypreamble\@loadwithoptions |
| 1929 |
% \end{macrocode} |
| 1930 |
% \end{macro} |
| 1931 |
% |
| 1932 |
% |
| 1933 |
% \begin{macro}{\LoadClassWithOptions} |
| 1934 |
% \changes{v1.0t}{1995/11/14}{macro added} |
| 1935 |
% Load class `|#1|' with the current option list. |
| 1936 |
% \begin{macrocode} |
| 1937 |
\def\LoadClassWithOptions{% |
| 1938 |
\@loadwithoptions\@clsextension\LoadClass} |
| 1939 |
\@onlypreamble\LoadClassWithOptions |
| 1940 |
% \end{macrocode} |
| 1941 |
% \end{macro} |
| 1942 |
% |
| 1943 |
% \begin{macro}{\RequirePackageWithOptions} |
| 1944 |
% \changes{v1.0t}{1995/11/14}{macro added} |
| 1945 |
% \changes{v1.0v}{1996/10/04}{Reset \cs{@unprocessedoptions} for /2269} |
| 1946 |
% Load package `|#1|' with the current option list. |
| 1947 |
% \begin{macrocode} |
| 1948 |
%</2ekernel> |
| 1949 |
%<*2ekernel|latexrelease> |
| 1950 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 1951 |
%<latexrelease> {\RequirePackageWithOptions}{Unused options issue}% |
| 1952 |
\def\RequirePackageWithOptions{% |
| 1953 |
% \end{macrocode} |
| 1954 |
% The resetting of the unprocessed options is now done on a par package basis. |
| 1955 |
% \changes{v1.3k}{2020/04/07}{Use different method to ignore |
| 1956 |
% unprocessed options (gh/22)} |
| 1957 |
% \begin{macrocode} |
| 1958 |
\AtEndOfPackage{\expandafter\let |
| 1959 |
\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 1960 |
\relax}% |
| 1961 |
\@loadwithoptions\@pkgextension\RequirePackage} |
| 1962 |
\@onlypreamble\RequirePackageWithOptions |
| 1963 |
%</2ekernel|latexrelease> |
| 1964 |
%<latexrelease>\EndIncludeInRelease |
| 1965 |
% \end{macrocode} |
| 1966 |
% |
| 1967 |
% \begin{macrocode} |
| 1968 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1969 |
%<latexrelease> {\RequirePackageWithOptions}{Unused options issue}% |
| 1970 |
%<latexrelease> |
| 1971 |
%<latexrelease>\def\RequirePackageWithOptions{% |
| 1972 |
%<latexrelease> \AtEndOfPackage{\let\@unprocessedoptions\relax}% |
| 1973 |
%<latexrelease> \@loadwithoptions\@pkgextension\RequirePackage} |
| 1974 |
%<latexrelease>\EndIncludeInRelease |
| 1975 |
%<*2ekernel> |
| 1976 |
% \end{macrocode} |
| 1977 |
% \end{macro} |
| 1978 |
% |
| 1979 |
% |
| 1980 |
|
| 1981 |
|
| 1982 |
|
| 1983 |
|
| 1984 |
|
| 1985 |
|
| 1986 |
% |
| 1987 |
% \begin{macro}{\usepackage} |
| 1988 |
% To begin with, |\usepackage| produces an error. This is reset by |
| 1989 |
% |\documentclass|. |
| 1990 |
% \changes{v0.2o}{1993/12/13} |
| 1991 |
% {Fixed error handling} |
| 1992 |
% \changes{v1.0h}{1994/05/23}{Remove argument if possible} |
| 1993 |
% \begin{macrocode} |
| 1994 |
\def\usepackage#1#{% |
| 1995 |
\@latex@error |
| 1996 |
{\noexpand \usepackage before \string\documentclass}% |
| 1997 |
{\noexpand \usepackage may only appear in the document |
| 1998 |
preamble, i.e.,\MessageBreak |
| 1999 |
between \noexpand\documentclass and |
| 2000 |
\string\begin{document}.}% |
| 2001 |
\@gobble} |
| 2002 |
\@onlypreamble\usepackage |
| 2003 |
% \end{macrocode} |
| 2004 |
% \end{macro} |
| 2005 |
% |
| 2006 |
% \begin{macro}{\NeedsTeXFormat} |
| 2007 |
% Check that the document is running on the correct system. |
| 2008 |
% \changes{v0.2a}{1993/11/14} |
| 2009 |
% {made more robust for alternative syntax for other formats.} |
| 2010 |
% \changes{v0.2c}{1993/11/17} |
| 2011 |
% {Name changed from \cs{NeedsFormat}} |
| 2012 |
% \changes{v0.2d}{1993/11/18} |
| 2013 |
% {\cs{fmtname} \cs{fmtversion} not \cs{@}\ldots} |
| 2014 |
% \begin{macrocode} |
| 2015 |
\def\NeedsTeXFormat#1{% |
| 2016 |
\def\reserved@a{#1}% |
| 2017 |
\ifx\reserved@a\fmtname |
| 2018 |
\expandafter\@needsformat |
| 2019 |
\else |
| 2020 |
\@latex@error{This file needs format `\reserved@a'% |
| 2021 |
\MessageBreak but this is `\fmtname'}{% |
| 2022 |
The current input file will not be processed |
| 2023 |
further,\MessageBreak |
| 2024 |
because it was written for some other flavor of |
| 2025 |
TeX.\MessageBreak\@ehd}% |
| 2026 |
% \end{macrocode} |
| 2027 |
% If the file is not meant to be processed by \LaTeXe{} we stop |
| 2028 |
% inputting it, but we do not end the run. We just end inputting |
| 2029 |
% the current file. |
| 2030 |
% \changes{v1.0h}{1994/05/23} |
| 2031 |
% {Don't stop completely when format is wrong} |
| 2032 |
% \begin{macrocode} |
| 2033 |
\endinput \fi} |
| 2034 |
\@onlypreamble\NeedsTeXFormat |
| 2035 |
% \end{macrocode} |
| 2036 |
% |
| 2037 |
% \begin{macrocode} |
| 2038 |
\def\@needsformat{% |
| 2039 |
\@ifnextchar[%] |
| 2040 |
\@needsf@rmat |
| 2041 |
{}} |
| 2042 |
\@onlypreamble\@needsformat |
| 2043 |
% \end{macrocode} |
| 2044 |
% |
| 2045 |
% \changes{v1.0b}{1994/05/04} |
| 2046 |
% {Changed wording of the warning} |
| 2047 |
% \begin{macrocode} |
| 2048 |
\def\@needsf@rmat[#1]{% |
| 2049 |
\@ifl@t@r\fmtversion{#1}{}% |
| 2050 |
{\@latex@warning@no@line |
| 2051 |
{You have requested release `#1' of LaTeX,\MessageBreak |
| 2052 |
but only release `\fmtversion' is available}}} |
| 2053 |
\@onlypreamble\@needsf@rmat |
| 2054 |
% \end{macrocode} |
| 2055 |
% \end{macro} |
| 2056 |
% |
| 2057 |
% \begin{macro}{\NeedsDocumentMetadata} |
| 2058 |
% Check that |\DocumentMetadata| has been used. |
| 2059 |
% \begin{macrocode} |
| 2060 |
\protected\def\NeedsDocumentMetadata{% |
| 2061 |
\IfDocumentMetadataF{% |
| 2062 |
\@latex@error{This file needs \string\DocumentMetadata}% |
| 2063 |
{The current input file will not be processed |
| 2064 |
further,\MessageBreak |
| 2065 |
because the document didn't start with \string\DocumentMetadata.% |
| 2066 |
\MessageBreak\@ehd}} |
| 2067 |
\IfDocumentMetadataF{\endinput}}% |
| 2068 |
% \end{macrocode} |
| 2069 |
% \end{macro} |
| 2070 |
% |
| 2071 |
% \begin{macro}{\zap@space} |
| 2072 |
% |\zap@space foo|\meta{space}|\@empty| removes all spaces from |foo| |
| 2073 |
% that are not protected by |{ }| groups. |
| 2074 |
% \begin{macrocode} |
| 2075 |
\def\zap@space#1 #2{% |
| 2076 |
#1% |
| 2077 |
\ifx#2\@empty\else\expandafter\zap@space\fi |
| 2078 |
#2} |
| 2079 |
% \end{macrocode} |
| 2080 |
% \end{macro} |
| 2081 |
% |
| 2082 |
% \begin{macro}{\@fileswithoptions} |
| 2083 |
% \changes{v1.5i}{2024/01/30}{Test group level} |
| 2084 |
% The common part of |\documentclass| and |\usepackage|. |
| 2085 |
% \begin{macrocode} |
| 2086 |
%</2ekernel> |
| 2087 |
%<latexrelease>\IncludeInRelease{2024/06/01}% |
| 2088 |
%<latexrelease> {\@fileswithoptions}{Check Group}% |
| 2089 |
%<*2ekernel|latexrelease> |
| 2090 |
\def\@fileswithoptions#1{% |
| 2091 |
\ifnum\currentgrouplevel>\z@ |
| 2092 |
\@latex@error |
| 2093 |
{Loading a class or package in a group}% |
| 2094 |
{Classes and packages should only be loaded at the top level}% |
| 2095 |
\fi |
| 2096 |
\@ifnextchar[%] |
| 2097 |
{\@fileswith@ptions#1}% |
| 2098 |
{\@fileswith@ptions#1[]}} |
| 2099 |
%</2ekernel|latexrelease> |
| 2100 |
%<latexrelease>\EndIncludeInRelease |
| 2101 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 2102 |
%<latexrelease> {\@fileswithoptions}{Check Group}% |
| 2103 |
%<latexrelease>\def\@fileswithoptions#1{% |
| 2104 |
%<latexrelease> \@ifnextchar[%] |
| 2105 |
%<latexrelease> {\@fileswith@ptions#1}% |
| 2106 |
%<latexrelease> {\@fileswith@ptions#1[]}} |
| 2107 |
%<latexrelease>\EndIncludeInRelease |
| 2108 |
%<*2ekernel> |
| 2109 |
% \end{macrocode} |
| 2110 |
% \begin{macrocode} |
| 2111 |
\@onlypreamble\@fileswithoptions |
| 2112 |
% \end{macrocode} |
| 2113 |
% |
| 2114 |
% \changes{v0.2f}{1993/11/22} |
| 2115 |
% {Made the default [] not [\cs{@unknownversion}]} |
| 2116 |
% \changes{v1.1h}{2007/08/05} |
| 2117 |
% {Prevent loss of brackets PR/3965} |
| 2118 |
% \begin{macrocode} |
| 2119 |
\def\@fileswith@ptions#1[#2]#3{% |
| 2120 |
\@ifnextchar[%] |
| 2121 |
{\@fileswith@pti@ns#1[{#2}]#3}% |
| 2122 |
{\@fileswith@pti@ns#1[{#2}]#3[]}} |
| 2123 |
\@onlypreamble\@fileswith@ptions |
| 2124 |
% \end{macrocode} |
| 2125 |
% Then we do some work. |
| 2126 |
% |
| 2127 |
% First of all, we define the global variables. |
| 2128 |
% Then we look to see if the file has already been loaded. |
| 2129 |
% If it has, we check that it was first loaded with at least the current |
| 2130 |
% options. |
| 2131 |
% If it has not, we add the current options to the package options, |
| 2132 |
% set the default version to be |0000/00/00|, and load the file if we |
| 2133 |
% can find it. |
| 2134 |
% Then we check the version number. |
| 2135 |
% |
| 2136 |
% Finally, we restore the old file name, reset the default option, |
| 2137 |
% and we set the catcode of |@|. |
| 2138 |
% |
| 2139 |
% For classes, we can immediately process the file. For other types, |
| 2140 |
% |#2| could be a comma separated list, so loop through, processing |
| 2141 |
% each one separately. |
| 2142 |
% \changes{v0.2q}{1993/12/17} |
| 2143 |
% {Add \cs{@compatibility} hook} |
| 2144 |
% \changes{v0.2s}{1994/01/17} |
| 2145 |
% {Modify to reduce parameter stack usage} |
| 2146 |
% \changes{v0.2y}{1994/02/07} |
| 2147 |
% {Run \cs{@compatibility} on the first class to start |
| 2148 |
% (not the first to finish) } |
| 2149 |
% \changes{v0.2z}{1994/02/10} |
| 2150 |
% {Renamed \cs{@compatibility} to \cs{@documentclasshook}. |
| 2151 |
% ASAJ.} |
| 2152 |
% \changes{v1.1h}{2007/08/05} |
| 2153 |
% {Prevent loss of brackets PR/3965} |
| 2154 |
% \changes{v2.1b}{2016/11/09} |
| 2155 |
% {Improve \cs{ifx} tests PR/4497} |
| 2156 |
% \changes{v1.3x}{2021/02/18}{save raw class option list (gh/85)} |
| 2157 |
% \changes{v1.5e}{2022/10/22}{Use \cs{protected@xdef}.} |
| 2158 |
% \begin{macrocode} |
| 2159 |
%</2ekernel> |
| 2160 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 2161 |
%<latexrelease> {\@fileswith@pti@ns}{ifx tests in \@fileswith@pti@ns}% |
| 2162 |
%<*2ekernel|latexrelease> |
| 2163 |
\def\@fileswith@pti@ns#1[#2]#3[#4]{% |
| 2164 |
\ifx#1\@clsextension |
| 2165 |
\ifx\@classoptionslist\relax |
| 2166 |
\protected@xdef\@classoptionslist{\zap@space#2 \@empty}% |
| 2167 |
% \end{macrocode} |
| 2168 |
% Save raw class list. |
| 2169 |
% \begin{macrocode} |
| 2170 |
\gdef\@raw@classoptionslist{#2}% |
| 2171 |
% \end{macrocode} |
| 2172 |
% |
| 2173 |
% \begin{macrocode} |
| 2174 |
\def\reserved@a{% |
| 2175 |
\@onefilewithoptions#3[{#2}][{#4}]#1% |
| 2176 |
\@documentclasshook}% |
| 2177 |
\else |
| 2178 |
\def\reserved@a{% |
| 2179 |
\@onefilewithoptions#3[{#2}][{#4}]#1}% |
| 2180 |
\fi |
| 2181 |
\else |
| 2182 |
% \end{macrocode} |
| 2183 |
% build up a list of calls to |\@onefilewithoptions| |
| 2184 |
% (one for each package) without thrashing the parameter stack. |
| 2185 |
% \begin{macrocode} |
| 2186 |
\def\reserved@b##1,{% |
| 2187 |
% \end{macrocode} |
| 2188 |
% If |#1| is |\@nnil| we have reached the end of the list |
| 2189 |
% (older version used |\@nil| here but |\@nil| is undefined so |\ifx| |
| 2190 |
% equal to all undefined commands) |
| 2191 |
% \begin{macrocode} |
| 2192 |
\ifx\@nnil##1\relax\else |
| 2193 |
% \end{macrocode} |
| 2194 |
% If |\ifx\@nnil##1\@nnil| is true then |#1| is (presumably) empty |
| 2195 |
% (Older code used |\relax| which is slightly easier to get into |#1| |
| 2196 |
% by mistake, which would spoil this test.) |
| 2197 |
% \begin{macrocode} |
| 2198 |
\ifx\@nnil##1\@nnil\else |
| 2199 |
% \end{macrocode} |
| 2200 |
% |
| 2201 |
% \changes{v1.4d}{2021/07/12}{add \cs{unexpanded}} |
| 2202 |
% \begin{macrocode} |
| 2203 |
\noexpand\@onefilewithoptions##1[{\unexpanded{#2}}][{#4}]% |
| 2204 |
\noexpand\@pkgextension |
| 2205 |
\fi |
| 2206 |
\expandafter\reserved@b |
| 2207 |
\fi}% |
| 2208 |
\edef\reserved@a{\zap@space#3 \@empty}% |
| 2209 |
\edef\reserved@a{\expandafter\reserved@b\reserved@a,\@nnil,}% |
| 2210 |
\fi |
| 2211 |
\reserved@a} |
| 2212 |
%</2ekernel|latexrelease> |
| 2213 |
%<latexrelease>\EndIncludeInRelease |
| 2214 |
%<latexrelease>\IncludeInRelease{2017/01/01}% |
| 2215 |
%<latexrelease> {\@fileswith@pti@ns}{ifx tests in \@fileswith@pti@ns}% |
| 2216 |
%<latexrelease>\def\@fileswith@pti@ns#1[#2]#3[#4]{% |
| 2217 |
%<latexrelease> \ifx#1\@clsextension |
| 2218 |
%<latexrelease> \ifx\@classoptionslist\relax |
| 2219 |
%<latexrelease> \xdef\@classoptionslist{\zap@space#2 \@empty}% |
| 2220 |
%<latexrelease> \def\reserved@a{% |
| 2221 |
%<latexrelease> \@onefilewithoptions#3[{#2}][{#4}]#1% |
| 2222 |
%<latexrelease> \@documentclasshook}% |
| 2223 |
%<latexrelease> \else |
| 2224 |
%<latexrelease> \def\reserved@a{% |
| 2225 |
%<latexrelease> \@onefilewithoptions#3[{#2}][{#4}]#1}% |
| 2226 |
%<latexrelease> \fi |
| 2227 |
%<latexrelease> \else |
| 2228 |
%<latexrelease> \def\reserved@b##1,{% |
| 2229 |
%<latexrelease> \ifx\@nnil##1\relax\else |
| 2230 |
%<latexrelease> \ifx\@nnil##1\@nnil\else |
| 2231 |
%<latexrelease> \noexpand\@onefilewithoptions##1[{#2}][{#4}]% |
| 2232 |
%<latexrelease> \noexpand\@pkgextension |
| 2233 |
%<latexrelease> \fi |
| 2234 |
%<latexrelease> \expandafter\reserved@b |
| 2235 |
%<latexrelease> \fi}% |
| 2236 |
%<latexrelease> \edef\reserved@a{\zap@space#3 \@empty}% |
| 2237 |
%<latexrelease> \edef\reserved@a{\expandafter\reserved@b\reserved@a,\@nnil,}% |
| 2238 |
%<latexrelease> \fi |
| 2239 |
%<latexrelease> \reserved@a} |
| 2240 |
% \end{macrocode} |
| 2241 |
% |
| 2242 |
% \begin{macrocode} |
| 2243 |
%<latexrelease>\EndIncludeInRelease |
| 2244 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 2245 |
%<latexrelease> {\@fileswith@pti@ns}{ifx tests in \@fileswith@pti@ns}% |
| 2246 |
%<latexrelease>\def\@fileswith@pti@ns#1[#2]#3[#4]{% |
| 2247 |
%<latexrelease> \ifx#1\@clsextension |
| 2248 |
%<latexrelease> \ifx\@classoptionslist\relax |
| 2249 |
%<latexrelease> \xdef\@classoptionslist{\zap@space#2 \@empty}% |
| 2250 |
%<latexrelease> \def\reserved@a{% |
| 2251 |
%<latexrelease> \@onefilewithoptions#3[{#2}][{#4}]#1% |
| 2252 |
%<latexrelease> \@documentclasshook}% |
| 2253 |
%<latexrelease> \else |
| 2254 |
%<latexrelease> \def\reserved@a{% |
| 2255 |
%<latexrelease> \@onefilewithoptions#3[{#2}][{#4}]#1}% |
| 2256 |
%<latexrelease> \fi |
| 2257 |
%<latexrelease> \else |
| 2258 |
%<latexrelease> \def\reserved@b##1,{% |
| 2259 |
%<latexrelease> \ifx\@nil##1\relax\else |
| 2260 |
%<latexrelease> \ifx\relax##1\relax\else |
| 2261 |
%<latexrelease> \noexpand\@onefilewithoptions##1[{#2}][{#4}]% |
| 2262 |
%<latexrelease> \noexpand\@pkgextension |
| 2263 |
%<latexrelease> \fi |
| 2264 |
%<latexrelease> \expandafter\reserved@b |
| 2265 |
%<latexrelease> \fi}% |
| 2266 |
%<latexrelease> \edef\reserved@a{\zap@space#3 \@empty}% |
| 2267 |
%<latexrelease> \edef\reserved@a{% |
| 2268 |
%<latexrelease> \expandafter\reserved@b\reserved@a,\@nil,}% |
| 2269 |
%<latexrelease> \fi |
| 2270 |
%<latexrelease> \reserved@a} |
| 2271 |
%<latexrelease>\EndIncludeInRelease |
| 2272 |
%<*2ekernel> |
| 2273 |
% \end{macrocode} |
| 2274 |
% |
| 2275 |
% \begin{macrocode} |
| 2276 |
\@onlypreamble\@fileswith@pti@ns |
| 2277 |
% \end{macrocode} |
| 2278 |
% |
| 2279 |
% \begin{macro}{\load@onefilewithoptions} |
| 2280 |
% This macro is used when loading packages or classes. |
| 2281 |
% |
| 2282 |
% Have the main argument as |#1|, so we only need one |\expandafter| |
| 2283 |
% above. |
| 2284 |
% \changes{v0.2a}{1993/11/14} |
| 2285 |
% {Moved resetting of \cs{default@ds}, \cs{ds@} and |
| 2286 |
% \cs{@declaredoptions} here, from the end of |
| 2287 |
% \cs{ProcessOptions}.} |
| 2288 |
% \changes{v0.2f}{1993/11/22} |
| 2289 |
% {Made the initial version [] not [\cs{@unknownversion}]} |
| 2290 |
% \changes{v0.2m}{1993/12/07} |
| 2291 |
% {Reset \cs{CurrentOption}} |
| 2292 |
% \changes{v1.3d}{2019/10/18}{Initialize \cs{...-h@@k} only when loading |
| 2293 |
% the package or class (gh/198)} |
| 2294 |
% \changes{v1.5h}{2023/04/14}{Define \cs{load@onefilewithoptions} when |
| 2295 |
% in \pkg{latexrelease} (gh/992)} |
| 2296 |
% \begin{macrocode} |
| 2297 |
%</2ekernel> |
| 2298 |
%<*2ekernel|latexrelease> |
| 2299 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 2300 |
%<latexrelease> {\@onefilewithoptions}{Hooks and unused options issue}% |
| 2301 |
% \end{macrocode} |
| 2302 |
% |
| 2303 |
% Here this macro is called \cs{@onefilewithoptions}, but further |
| 2304 |
% ahead in this file it is renamed to \cs{load@onefilewithoptions}, |
| 2305 |
% and \cs{@onefilewithoptions} becomes a wrapper around this, used for |
| 2306 |
% bookkeeping when rolling back. Therefore, when in |
| 2307 |
% \pkg{latexrelease}, we need to define \cs{load@onefilewithoptions} |
| 2308 |
% instead, thus the extra guarded \cs{def} line below: |
| 2309 |
% \begin{macrocode} |
| 2310 |
%<*2ekernel> |
| 2311 |
\def\@onefilewithoptions#1[#2][#3]#4{% |
| 2312 |
%</2ekernel> |
| 2313 |
%<latexrelease>\def\load@onefilewithoptions#1[#2][#3]#4{% |
| 2314 |
% \end{macrocode} |
| 2315 |
% |
| 2316 |
% We have to sanitise file names, so that something like |
| 2317 |
% \begin{verbatim} |
| 2318 |
% \usepackage{some/local/path/array} |
| 2319 |
% \usepackage{array} |
| 2320 |
% \end{verbatim} |
| 2321 |
% won't load |array.sty| twice. It is remotely possible that |
| 2322 |
% those are two different files, but as a matter of principles, we |
| 2323 |
% will consider that the base file name uniquely identifies a |
| 2324 |
% package, regardless of where it lives. This assumption already |
| 2325 |
% holds for file hooks, for example, which address the hook to a file |
| 2326 |
% by its base name only. |
| 2327 |
% |
| 2328 |
% We'll use \cs{@expl@@@filehook@set@curr@file@@nNN} to parse the |
| 2329 |
% file name and return the \meta{path} and \meta{base+ext} in |
| 2330 |
% separate token lists. Further ahead, most operations use |
| 2331 |
% \cs{@currname} which doesn't have a path attached to it; only few |
| 2332 |
% actions prepend \cs{@currpath} to \cs{@currname} (namely loading, |
| 2333 |
% as we have to respect the given path). |
| 2334 |
% |
| 2335 |
% A file substitution isn't followed just yet because at this point |
| 2336 |
% we are parsing user input, so the file is still what the user |
| 2337 |
% asked for, and not the file actually loaded. |
| 2338 |
% \begin{macrocode} |
| 2339 |
\@expl@@@filehook@set@curr@file@@nNN{#1.#4}\reserved@a\reserved@b |
| 2340 |
\edef\reserved@c{\def\noexpand\reserved@c####1% |
| 2341 |
\detokenize\expandafter{\expanded{.#4}}% |
| 2342 |
\noexpand\@nil{\def\noexpand\reserved@a{####1}}}\reserved@c |
| 2343 |
\expandafter\reserved@c\reserved@a\@nil |
| 2344 |
\@pushfilename |
| 2345 |
\xdef\@currname{\string@makeletter\reserved@a}% |
| 2346 |
\xdef\@currpath{\ifx\reserved@b\@empty\else\reserved@b/\fi}% |
| 2347 |
\global\let\@currext#4% |
| 2348 |
% \end{macrocode} |
| 2349 |
% The command \cs{ver@\meta{file}.\meta{ext}} is used to signal that |
| 2350 |
% a package is already loaded, either because it is in fact loaded, or |
| 2351 |
% because it's loading was suppressed. In minimal installations, said |
| 2352 |
% package may not exist but still have its loading suppressed with |
| 2353 |
% \cs{ver@\meta{file}.\meta{ext}}, so before checking if the file |
| 2354 |
% exists we have to check that we do need to load it with |
| 2355 |
% \cs{@ifl@aded}. If we don't, then there's no point in checking for |
| 2356 |
% a typo or load-disabling. |
| 2357 |
% \begin{macrocode} |
| 2358 |
\@ifl@aded\@currext\@currname |
| 2359 |
% \end{macrocode} |
| 2360 |
% \changes{v1.5b}{2022/03/18}{Switch to \cs{ProcessKeyOptions}} |
| 2361 |
% \changes{v1.5c}{2022/06/20}{Pass raw options to \cs{ProcessKeyOptions}} |
| 2362 |
% \changes{v1.5e}{2022/10/20} |
| 2363 |
% {Define key option handler in \pkg{ltkeys}} |
| 2364 |
% In the current preferred approach, a key family name will exist for |
| 2365 |
% processing using \pkg{ltkeys}. In that case, we replace the previous |
| 2366 |
% package options with the new ones, then call the key handler. |
| 2367 |
% Otherwise, we use the more classical clash handler. |
| 2368 |
% \begin{macrocode} |
| 2369 |
{% |
| 2370 |
\@ifundefined{opt@handler@\@currname.\@currext} |
| 2371 |
{\@onefilewithoptions@clashchk{#2}} |
| 2372 |
{% |
| 2373 |
% \end{macrocode} |
| 2374 |
% \changes{v1.5d}{2022/10/10}{Use \cs{protected@edef}.} |
| 2375 |
% \begin{macrocode} |
| 2376 |
\expandafter\protected@edef |
| 2377 |
\csname opt@\@currname.\@currext\endcsname |
| 2378 |
{\zap@space#2 \@empty}% |
| 2379 |
% \end{macrocode} |
| 2380 |
% \changes{v1.5j}{2024/03/22} |
| 2381 |
% {Apply one-step expansion to raw option list, |
| 2382 |
% to be consistent with change for gh/580 (gh/1298).} |
| 2383 |
% \begin{macrocode} |
| 2384 |
\expandafter\def |
| 2385 |
\csname @raw@opt@\@currname.\@currext\expandafter\endcsname |
| 2386 |
\expandafter{#2}% |
| 2387 |
\@nameuse{opt@handler@\@currname.\@currext}% |
| 2388 |
}% |
| 2389 |
}% |
| 2390 |
{\makeatletter |
| 2391 |
% \end{macrocode} |
| 2392 |
% The next line seems to be necessary for 2.09 compatibility (the |
| 2393 |
% way the code is written there) This seems questionable and should be |
| 2394 |
% look at as in 2e it is definitely unnecessary at this point! |
| 2395 |
% \begin{macrocode} |
| 2396 |
\@reset@ptions |
| 2397 |
% \end{macrocode} |
| 2398 |
% First we take the \meta{name} and \meta{ext} given in the argument |
| 2399 |
% and check if the file exists, and issue an error otherwise asking |
| 2400 |
% for a correction with \cs{@missingfileerror}. For checking if the |
| 2401 |
% file exists we use \cs{@currpath} (usually empty) before |
| 2402 |
% \cs{@currname}. |
| 2403 |
% \begin{macrocode} |
| 2404 |
\IfFileExists{\@currpath\@currname.\@currext}{}% |
| 2405 |
{\@missing@onefilewithoptions{#2}}% |
| 2406 |
% \end{macrocode} |
| 2407 |
% If \cs{@currname} is empty (the user replied to the ``Enter file |
| 2408 |
% name'' prompt with \meta{RETURN}), so stop here |
| 2409 |
% (do \cs{@popfilename} to pop the item just added above). |
| 2410 |
% |
| 2411 |
% This \cs{@gobble} omits the date check at the end. |
| 2412 |
% \begin{macrocode} |
| 2413 |
\ifx\@currname\@empty |
| 2414 |
\expandafter\@gobble |
| 2415 |
\else |
| 2416 |
% \end{macrocode} |
| 2417 |
% If the file exists, check if it was load-prevented, and otherwise |
| 2418 |
% do the bookkeeping with \cs{@filehook@file@push} |
| 2419 |
% then call \cs{set@curr@file} to set \cs{@curr@file} (and do any |
| 2420 |
% required substitution), then actually load the class/package with |
| 2421 |
% \cs{load@onefile@withoptions}. \cs{set@curr@file} also needs the |
| 2422 |
% file path. |
| 2423 |
% \begin{macrocode} |
| 2424 |
\@disable@packageload@do{\@currname.\@currext}% |
| 2425 |
{\@expl@@@filehook@file@push@@ |
| 2426 |
\set@curr@file{\@currpath\@currname.\@currext}% |
| 2427 |
\@filehook@set@CurrentFile |
| 2428 |
% \end{macrocode} |
| 2429 |
% \changes{v1.3q}{2020/09/06} |
| 2430 |
% {Save \cs{@currpkg@reqd} so that we don't lose track of |
| 2431 |
% package substitutions.} |
| 2432 |
% The \cs{set@curr@file} line above might have replaced the file, so |
| 2433 |
% \cs{@currname} and \cs{@currext} may no longer hold the actual |
| 2434 |
% package being loaded, so in that case we need to update these two |
| 2435 |
% token lists (\cs{@curr@file} holds the file name after replacement, |
| 2436 |
% so we parse that). |
| 2437 |
% |
| 2438 |
% The requested file is saved in \cs{@currpkg@reqd} to be used in |
| 2439 |
% \cs{InputIfFileExists} later: if the updated \cs{@currname} and |
| 2440 |
% \cs{@currext} are used we lose track of the substitution, so |
| 2441 |
% \cs{CurrentFile} and \cs{CurrentFileUsed} will be (incorrectly) |
| 2442 |
% the same. |
| 2443 |
% |
| 2444 |
% \changes{v1.3t}{2020-10-11}{Restore \cs{@currpkg@reqd} after |
| 2445 |
% finished loading a package file (gh/408).} |
| 2446 |
% \begin{macrocode} |
| 2447 |
\expandafter\@swaptwoargs\expandafter |
| 2448 |
{\expandafter{\@currpkg@reqd}}% |
| 2449 |
{% < |
| 2450 |
% \end{macrocode} |
| 2451 |
% \cs{@currpkg@reqd} doesn't take a path because it is used later to |
| 2452 |
% assign \cs[no-index]{opt@...} and \cs[no-index]{ver@...}. |
| 2453 |
% \begin{macrocode} |
| 2454 |
\edef\@currpkg@reqd{\@currname.\@currext}% |
| 2455 |
\ifx\CurrentFile\CurrentFileUsed |
| 2456 |
\else |
| 2457 |
\filename@parse\@curr@file |
| 2458 |
\edef\@currpath{\string@makeletter\filename@area}% |
| 2459 |
\edef\@currname{\string@makeletter\filename@base}% |
| 2460 |
\edef\@currext{\string@makeletter\filename@ext}% |
| 2461 |
\fi |
| 2462 |
\load@onefile@withoptions{#2}% |
| 2463 |
\def\@currpkg@reqd%{\@currpkg@reqd} |
| 2464 |
}% > |
| 2465 |
% \end{macrocode} |
| 2466 |
% Now just clean up and exit. |
| 2467 |
% \begin{macrocode} |
| 2468 |
\@expl@@@filehook@file@pop@@}% |
| 2469 |
\expandafter\@firstofone |
| 2470 |
\fi}% |
| 2471 |
% \end{macrocode} |
| 2472 |
% Except in the case where \cs{@currname} is empty, the date is |
| 2473 |
% checked against the date marked in the package file: |
| 2474 |
% \begin{macrocode} |
| 2475 |
{\@ifl@ter\@currext{\@currname}{#3}{}% |
| 2476 |
{\@latex@warning@no@line |
| 2477 |
{You have requested,\on@line, |
| 2478 |
version\MessageBreak |
| 2479 |
`#3' of \@cls@pkg\space \@currname,\MessageBreak |
| 2480 |
but only version\MessageBreak |
| 2481 |
`\csname ver@\@currname.\@currext\endcsname'\MessageBreak |
| 2482 |
is available}}% |
| 2483 |
% \end{macrocode} |
| 2484 |
% \changes{v0.2c}{1993/11/17} |
| 2485 |
% {Added trap for two \cs{LoadClass} commands.} |
| 2486 |
% \begin{macrocode} |
| 2487 |
\ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi}% |
| 2488 |
\@popfilename |
| 2489 |
\@reset@ptions} |
| 2490 |
% \end{macrocode} |
| 2491 |
% |
| 2492 |
% \begin{macro}{\@onefilewithoptions@clashchk} |
| 2493 |
% If the package is already loaded, check that there were no option |
| 2494 |
% clashes. |
| 2495 |
% \changes{v1.1b}{1998/05/07} |
| 2496 |
% {Modify help message for latex/2805} |
| 2497 |
% \changes{v1.5a}{2021/11/30} |
| 2498 |
% {Separated out from \cs{@onefilewithoptions}} |
| 2499 |
% \begin{macrocode} |
| 2500 |
\def\@onefilewithoptions@clashchk#1{% |
| 2501 |
\@if@ptions\@currext{\@currname}{#1}{}% |
| 2502 |
{\@latex@error |
| 2503 |
{Option clash for \@cls@pkg\space \@currname}% |
| 2504 |
{The package \@currname\space has already been loaded |
| 2505 |
with options:\MessageBreak |
| 2506 |
\space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak |
| 2507 |
There has now been an attempt to load it |
| 2508 |
with options\MessageBreak |
| 2509 |
\space\space[#1]\MessageBreak |
| 2510 |
Adding the global options:\MessageBreak |
| 2511 |
\space\space |
| 2512 |
\@ptionlist{\@currname.\@currext},#1\MessageBreak |
| 2513 |
to your \noexpand\documentclass declaration may fix this.% |
| 2514 |
\MessageBreak |
| 2515 |
Try typing \space <return> \space to proceed.}}% |
| 2516 |
\@firstofone} |
| 2517 |
% \end{macrocode} |
| 2518 |
% \end{macro} |
| 2519 |
% |
| 2520 |
% \begin{macrocode} |
| 2521 |
\let\@currpkg@reqd\@empty |
| 2522 |
% \end{macrocode} |
| 2523 |
% |
| 2524 |
% \begin{macrocode} |
| 2525 |
\@onlypreamble\@onefilewithoptions |
| 2526 |
% \end{macrocode} |
| 2527 |
% |
| 2528 |
% The kernel no longer uses \cs{@unprocessedoptions} |
| 2529 |
% \begin{macrocode} |
| 2530 |
\let\@unprocessedoptions\@undefined |
| 2531 |
% \end{macrocode} |
| 2532 |
% \end{macro} |
| 2533 |
% |
| 2534 |
% \begin{macro}{\@missing@onefilewithoptions} |
| 2535 |
% Now the action taken when a file is not found. Path must be |
| 2536 |
% included here as it eventually leads to a file lookup. |
| 2537 |
% \begin{macrocode} |
| 2538 |
\def\@missing@onefilewithoptions#1{% |
| 2539 |
\@missingfileerror{\@currpath\@currname}\@currext |
| 2540 |
\global\let\@currpath\@missingfile@area |
| 2541 |
\global\let\@currname\@missingfile@base |
| 2542 |
\global\let\@currext\@missingfile@ext} |
| 2543 |
% \end{macrocode} |
| 2544 |
% \end{macro} |
| 2545 |
% |
| 2546 |
% \begin{macro}{\load@onefile@withoptions} |
| 2547 |
% Now the code that actually does the file loading: |
| 2548 |
% \begin{macrocode} |
| 2549 |
\def\load@onefile@withoptions#1{% |
| 2550 |
\let\CurrentOption\@empty |
| 2551 |
\@reset@ptions |
| 2552 |
% \end{macrocode} |
| 2553 |
% Grab everything in a macro, so the parameter stack is popped before |
| 2554 |
% any processing begins. |
| 2555 |
% \changes{v0.2s}{1994/01/17} |
| 2556 |
% {Modify to reduce parameter stack usage} |
| 2557 |
% \begin{macrocode} |
| 2558 |
\def\reserved@a{% |
| 2559 |
\@pass@ptions\@currext{#1}{\@currname}% |
| 2560 |
% \end{macrocode} |
| 2561 |
% \changes{v1.3u}{2020/11/20} |
| 2562 |
% {Copy option list to the requested package.} |
| 2563 |
% \changes{v1.4c}{2021/06/06} |
| 2564 |
% {Copy raw options for gh/580} |
| 2565 |
% \begin{macrocode} |
| 2566 |
\expandafter\let |
| 2567 |
\csname opt@\@currpkg@reqd\expandafter\endcsname |
| 2568 |
\csname opt@\@currname.\@currext\endcsname |
| 2569 |
\expandafter\let |
| 2570 |
\csname @raw@opt@\@currpkg@reqd\expandafter\endcsname |
| 2571 |
\csname @raw@opt@\@currname.\@currext\endcsname |
| 2572 |
\global\expandafter |
| 2573 |
\let\csname ver@\@currname.\@currext\endcsname\@empty |
| 2574 |
% \end{macrocode} |
| 2575 |
% We initialize \cs{...-h@@k} here and only if we load the file so that it |
| 2576 |
% remains undefined otherwise. |
| 2577 |
% \begin{macrocode} |
| 2578 |
\expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty |
| 2579 |
% \end{macrocode} |
| 2580 |
% When the current extension is \cs{@pkgextension} we are loading a |
| 2581 |
% package otherwise, if it is \cs{@clsextension}, a class, so |
| 2582 |
% depending on that we execute different hooks. If the extension is |
| 2583 |
% neither, then it is another type of file without special hooks. |
| 2584 |
% \changes{v1.4e}{2021/07/23}{Make class/name/before a one-time hook} |
| 2585 |
% \changes{v1.4e}{2021/07/23}{Make package/name/before a one-time hook} |
| 2586 |
% \begin{macrocode} |
| 2587 |
%----------------------------------------- |
| 2588 |
\ifx\@currext\@pkgextension |
| 2589 |
\UseHook{package/before}% |
| 2590 |
\UseOneTimeHook{package/\@currname/before}% |
| 2591 |
\else |
| 2592 |
\ifx\@currext\@clsextension |
| 2593 |
\UseHook{class/before}% |
| 2594 |
\UseOneTimeHook{class/\@currname/before}% |
| 2595 |
\fi |
| 2596 |
\fi |
| 2597 |
% \end{macrocode} |
| 2598 |
% Now actually load the file (at this point we are certain it exists, |
| 2599 |
% but use \cs{InputIfFileExists} so that file hooks are executed). |
| 2600 |
% \cs{@currpath} is needed here too. |
| 2601 |
% \begin{macrocode} |
| 2602 |
\InputIfFileExists{\@currpath\@currpkg@reqd}{}% |
| 2603 |
{\@latex@error |
| 2604 |
{The \@cls@pkg\space\@currpkg@reqd\space failed to load}\@ehd}% |
| 2605 |
%----------------------------------------- |
| 2606 |
% \end{macrocode} |
| 2607 |
% In older versions of the code |\@unprocessedoptions| would |
| 2608 |
% generate an error for each specified |
| 2609 |
% option in a package unless a |\ProcessOptions| has appeared in the |
| 2610 |
% package file. |
| 2611 |
% \changes{v0.2v}{1994/01/29} |
| 2612 |
% {All options raise error if no \cs{ProcessOptions} appears} |
| 2613 |
% \changes{v0.2x}{1994/02/02} |
| 2614 |
% {Only run the hook and options check if the file was |
| 2615 |
% loaded.} |
| 2616 |
% |
| 2617 |
% This has changed in 2020. We now use a separate macro per package |
| 2618 |
% to avoid interference in case of nested packages. The whole |
| 2619 |
% code for handling this issue (GitHub 22) was provided by Hironobu |
| 2620 |
% Yamashita, thanks for that. |
| 2621 |
% \changes{v1.3k}{2020/04/07}{Use different method to ignore |
| 2622 |
% unprocessed options (gh/22)} |
| 2623 |
% \begin{macrocode} |
| 2624 |
\expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 2625 |
\@@unprocessedoptions |
| 2626 |
\csname\@currname.\@currext-h@@k\endcsname |
| 2627 |
\expandafter\let\csname\@currname.\@currext-h@@k\endcsname |
| 2628 |
\@undefined |
| 2629 |
% \end{macrocode} |
| 2630 |
% Catch the case where the packages has handled the options and |
| 2631 |
% redefined \cs{@unprocessedoptions} to \cs{relax} (old interface). |
| 2632 |
% In that case no error should be produced. |
| 2633 |
% \changes{v1.3k}{2020/04/07}{Use different method to ignore |
| 2634 |
% unprocessed options (gh/22)} |
| 2635 |
% \begin{macrocode} |
| 2636 |
\ifx\@unprocessedoptions\relax |
| 2637 |
\let\@unprocessedoptions\@undefined |
| 2638 |
% \end{macrocode} |
| 2639 |
% Otherwise run the per package set of unused options. |
| 2640 |
% \begin{macrocode} |
| 2641 |
\else |
| 2642 |
\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 2643 |
\fi |
| 2644 |
% \end{macrocode} |
| 2645 |
% In either case we drop the macro afterwards as it is no longer needed. |
| 2646 |
% \begin{macrocode} |
| 2647 |
\expandafter\let |
| 2648 |
\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 2649 |
\@undefined |
| 2650 |
% \end{macrocode} |
| 2651 |
% And same procedure, James, when we are finished loading, except |
| 2652 |
% that the hook order is now reversed. |
| 2653 |
% \changes{v1.4e}{2021/07/23}{Make class/name/after a one-time hook} |
| 2654 |
% \changes{v1.4e}{2021/07/23}{Make package/name/after a one-time hook} |
| 2655 |
% \begin{macrocode} |
| 2656 |
%----------------------------------------- |
| 2657 |
\ifx\@currext\@pkgextension |
| 2658 |
\UseOneTimeHook{package/\@currname/after}% |
| 2659 |
\UseHook{package/after}% |
| 2660 |
\else |
| 2661 |
\ifx\@currext\@clsextension |
| 2662 |
\UseOneTimeHook{class/\@currname/after}% |
| 2663 |
\UseHook{class/after}% |
| 2664 |
\fi |
| 2665 |
\fi}% |
| 2666 |
%----------------------------------------- |
| 2667 |
\@ifl@aded\@currext\@currname{}{\reserved@a}} |
| 2668 |
% \end{macrocode} |
| 2669 |
% |
| 2670 |
% \changes{v1.4f}{2021/08/25}{Declare non-generic package and class hooks} |
| 2671 |
% Now declare the non-generic package and class hooks used above: |
| 2672 |
% \begin{macrocode} |
| 2673 |
\NewHook{package/before} |
| 2674 |
\NewHook{class/before} |
| 2675 |
\NewReversedHook{package/after} |
| 2676 |
\NewReversedHook{class/after} |
| 2677 |
% \end{macrocode} |
| 2678 |
% \end{macro} |
| 2679 |
% |
| 2680 |
% \begin{macrocode} |
| 2681 |
%</2ekernel|latexrelease> |
| 2682 |
%<latexrelease>\EndIncludeInRelease |
| 2683 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 2684 |
%<latexrelease> {\@onefilewithoptions}{Hooks and unused options issue}% |
| 2685 |
%<latexrelease> |
| 2686 |
% \end{macrocode} |
| 2687 |
% Because of the way \cs{@onfilewithoptions} is changed for |
| 2688 |
% rollback handling below we have to define |
| 2689 |
% \cs{load@onefilewithoptions} when rolling back! |
| 2690 |
% \begin{macrocode} |
| 2691 |
%<latexrelease>\def\load@onefilewithoptions#1[#2][#3]#4{% |
| 2692 |
%<latexrelease> \@pushfilename |
| 2693 |
%<latexrelease> \xdef\@currname{#1}% |
| 2694 |
%<latexrelease> \global\let\@currext#4% |
| 2695 |
%<latexrelease> \let\CurrentOption\@empty |
| 2696 |
%<latexrelease> \@reset@ptions |
| 2697 |
%<latexrelease> \makeatletter |
| 2698 |
%<latexrelease> \def\reserved@a{% |
| 2699 |
%<latexrelease> \@ifl@aded\@currext{#1}% |
| 2700 |
%<latexrelease> {\@if@ptions\@currext{#1}{#2}{}% |
| 2701 |
%<latexrelease> {\@latex@error |
| 2702 |
%<latexrelease> {Option clash for \@cls@pkg\space #1}% |
| 2703 |
%<latexrelease> {The package #1 has already been loaded |
| 2704 |
%<latexrelease> with options:\MessageBreak |
| 2705 |
%<latexrelease> \space\space[\@ptionlist{#1.\@currext}]\MessageBreak |
| 2706 |
%<latexrelease> There has now been an attempt to load it |
| 2707 |
%<latexrelease> with options\MessageBreak |
| 2708 |
%<latexrelease> \space\space[#2]\MessageBreak |
| 2709 |
%<latexrelease> Adding the global options:\MessageBreak |
| 2710 |
%<latexrelease> \space\space |
| 2711 |
%<latexrelease> \@ptionlist{#1.\@currext},#2\MessageBreak |
| 2712 |
%<latexrelease> to your \noexpand\documentclass declaration may fix this.% |
| 2713 |
%<latexrelease> \MessageBreak |
| 2714 |
%<latexrelease> Try typing \space <return> \space to proceed.}}}% |
| 2715 |
%<latexrelease> {\@pass@ptions\@currext{#2}{#1}% |
| 2716 |
%<latexrelease> \global\expandafter |
| 2717 |
%<latexrelease> \let\csname ver@\@currname.\@currext\endcsname\@empty |
| 2718 |
%<latexrelease> \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty |
| 2719 |
%<latexrelease> \InputIfFileExists |
| 2720 |
%<latexrelease> {\@currname.\@currext}% |
| 2721 |
%<latexrelease> {}% |
| 2722 |
%<latexrelease> {\@missingfileerror\@currname\@currext}% |
| 2723 |
%<latexrelease> \let\@unprocessedoptions\@@unprocessedoptions |
| 2724 |
%<latexrelease> \csname\@currname.\@currext-h@@k\endcsname |
| 2725 |
%<latexrelease> \expandafter\let\csname\@currname.\@currext-h@@k\endcsname |
| 2726 |
%<latexrelease> \@undefined |
| 2727 |
%<latexrelease> \@unprocessedoptions}% |
| 2728 |
%<latexrelease> \@ifl@ter\@currext{#1}{#3}{}% |
| 2729 |
%<latexrelease> {\@latex@warning@no@line |
| 2730 |
%<latexrelease> {You have requested,\on@line, |
| 2731 |
%<latexrelease> version\MessageBreak |
| 2732 |
%<latexrelease> `#3' of \@cls@pkg\space #1,\MessageBreak |
| 2733 |
%<latexrelease> but only version\MessageBreak |
| 2734 |
%<latexrelease> `\csname ver@#1.\@currext\endcsname'\MessageBreak |
| 2735 |
%<latexrelease> is available}}% |
| 2736 |
%<latexrelease> \ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi |
| 2737 |
%<latexrelease> \@popfilename |
| 2738 |
%<latexrelease> \@reset@ptions}% |
| 2739 |
%<latexrelease> \reserved@a} |
| 2740 |
%<latexrelease> |
| 2741 |
%<latexrelease>\let \load@onefile@withoptions \@undefined |
| 2742 |
%<latexrelease>\let \@missing@onefilewithoptions \@undefined |
| 2743 |
%<latexrelease> |
| 2744 |
%<latexrelease>\EndIncludeInRelease |
| 2745 |
%<*2ekernel> |
| 2746 |
% \end{macrocode} |
| 2747 |
% \end{macro} |
| 2748 |
% |
| 2749 |
% |
| 2750 |
% |
| 2751 |
% |
| 2752 |
% |
| 2753 |
% |
| 2754 |
% \begin{macro}{\@@fileswith@pti@ns} |
| 2755 |
% Save the definition (for error checking). |
| 2756 |
% \changes{v0.2c}{1993/11/17} |
| 2757 |
% {Macro added} |
| 2758 |
% \begin{macrocode} |
| 2759 |
\let\@@fileswith@pti@ns\@fileswith@pti@ns |
| 2760 |
\@onlypreamble\@@fileswith@pti@ns |
| 2761 |
% \end{macrocode} |
| 2762 |
% \end{macro} |
| 2763 |
% |
| 2764 |
% \begin{macro}{\@reset@ptions} |
| 2765 |
% Reset the default option, and clear lists of declared options. |
| 2766 |
% \changes{v0.2a}{1993/11/14}{macro added} |
| 2767 |
% \begin{macrocode} |
| 2768 |
\def\@reset@ptions{% |
| 2769 |
\global\ifx\@currext\@clsextension |
| 2770 |
\let\default@ds\OptionNotUsed |
| 2771 |
\else |
| 2772 |
\let\default@ds\@unknownoptionerror |
| 2773 |
\fi |
| 2774 |
\global\let\ds@\@empty |
| 2775 |
\global\let\@declaredoptions\@empty} |
| 2776 |
\@onlypreamble\@reset@ptions |
| 2777 |
% \end{macrocode} |
| 2778 |
% \end{macro} |
| 2779 |
% |
| 2780 |
% |
| 2781 |
% |
| 2782 |
% |
| 2783 |
% \subsection{Hooks} |
| 2784 |
% |
| 2785 |
% Allow code to be saved to be executed at specific later times. |
| 2786 |
% |
| 2787 |
% Here we save things in macros. I considered using toks registers (and |
| 2788 |
% |\addto@hook| from the NFSS code), but that would require stacking the |
| 2789 |
% contents in the case of required packages, so just generate a new |
| 2790 |
% macro for each package. |
| 2791 |
% \begin{macro}{\@begindocumenthook} |
| 2792 |
% \changes{v1.0s}{1995/10/20} |
| 2793 |
% {Make setting conditional, for autoload version} |
| 2794 |
% \begin{macro}{\@enddocumenthook} |
| 2795 |
% Stuff to appear at the beginning or end of the document. |
| 2796 |
% \begin{macrocode} |
| 2797 |
\ifx\@begindocumenthook\@undefined |
| 2798 |
\let\@begindocumenthook\@empty |
| 2799 |
\fi |
| 2800 |
\let\@enddocumenthook\@empty |
| 2801 |
% \end{macrocode} |
| 2802 |
% \end{macro} |
| 2803 |
% \end{macro} |
| 2804 |
% |
| 2805 |
% |
| 2806 |
% \begin{macro}{\AtEndOfPackage} |
| 2807 |
% \begin{macro}{\AtEndOfClass} |
| 2808 |
% \begin{macro}{\AtBeginDocument} |
| 2809 |
% \begin{macro}{\AtEndDocument} |
| 2810 |
% The access functions. |
| 2811 |
% \changes{v0.2a}{1993/11/14} |
| 2812 |
% {Included extension in the generated macro name for package |
| 2813 |
% and class hooks.} |
| 2814 |
% \begin{macrocode} |
| 2815 |
\def\AtEndOfPackage{% |
| 2816 |
\expandafter\g@addto@macro\csname\@currname.\@currext-h@@k\endcsname} |
| 2817 |
\let\AtEndOfClass\AtEndOfPackage |
| 2818 |
\@onlypreamble\AtEndOfPackage |
| 2819 |
\@onlypreamble\AtEndOfClass |
| 2820 |
% \end{macrocode} |
| 2821 |
% |
| 2822 |
% \begin{macrocode} |
| 2823 |
%</2ekernel> |
| 2824 |
%<*2ekernel|latexrelease> |
| 2825 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 2826 |
%<latexrelease> {\AtBeginDocument}{Use hook system}% |
| 2827 |
\DeclareRobustCommand\AtBeginDocument{\AddToHook{begindocument}} |
| 2828 |
\DeclareRobustCommand\AtEndDocument {\AddToHook{enddocument}} |
| 2829 |
%\DeclareRobustCommand\AtEndDocument {\AddToHook{env/document/end}} % alternative impl |
| 2830 |
% \end{macrocode} |
| 2831 |
% |
| 2832 |
% \begin{macrocode} |
| 2833 |
%</2ekernel|latexrelease> |
| 2834 |
%<latexrelease>\EndIncludeInRelease |
| 2835 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 2836 |
%<latexrelease> {\AtBeginDocument}{Use hook system}% |
| 2837 |
%<latexrelease> |
| 2838 |
%<latexrelease>\DeclareRobustCommand\AtBeginDocument{\g@addto@macro\@begindocumenthook} |
| 2839 |
%<latexrelease>\DeclareRobustCommand\AtEndDocument{\g@addto@macro\@enddocumenthook} |
| 2840 |
%<latexrelease> |
| 2841 |
%<latexrelease>\EndIncludeInRelease |
| 2842 |
%<*2ekernel> |
| 2843 |
% \end{macrocode} |
| 2844 |
% |
| 2845 |
% In its initial implementation (not using the hook system) |
| 2846 |
% \cs{AtBeginDocument} was made \cs{@onlypreamble} because using it |
| 2847 |
% later had no effect whatsoever, thus was most certainly an |
| 2848 |
% unintended programming error. With the reimplementation, using |
| 2849 |
% the \texttt{begindocument} hook internally, this has changed |
| 2850 |
% because adding to a onetime hook after it has already been used |
| 2851 |
% simply executes the additional code immediately. We therefore no |
| 2852 |
% longer generate an error if it is used inside the document so |
| 2853 |
% that \verb=\AddToHook{begindocument}= and \cs{AtBeginDocument} |
| 2854 |
% are truly equivalent (as claimed in the hook documentation). |
| 2855 |
% \changes{v1.5n}{2025/01/02}{Do not make \cs{AtBeginDocument} |
| 2856 |
% preamble only (gh/1604)} |
| 2857 |
% \begin{macrocode} |
| 2858 |
%\@onlypreamble\AtBeginDocument |
| 2859 |
% \end{macrocode} |
| 2860 |
% \end{macro} |
| 2861 |
% \end{macro} |
| 2862 |
% \end{macro} |
| 2863 |
% \end{macro} |
| 2864 |
% |
| 2865 |
% |
| 2866 |
% \begin{macro}{\@cls@pkg} |
| 2867 |
% The current file type. |
| 2868 |
% \changes{v0.2i}{1993/12/03} |
| 2869 |
% {Name changed to avoid clash with output routine.} |
| 2870 |
% \changes{v1.5l}{2024/06/04} |
| 2871 |
% {Allow for extensions other than "cls" and "pkg"} |
| 2872 |
% \begin{macrocode} |
| 2873 |
%</2ekernel> |
| 2874 |
%<*2ekernel|latexrelease> |
| 2875 |
%<latexrelease>\IncludeInRelease{2024/11/01}% |
| 2876 |
%<latexrelease> {\@cls@pkg}{Allow for more extensions}% |
| 2877 |
\def\@cls@pkg{% |
| 2878 |
\ifx\@currext\@clsextension |
| 2879 |
document class% |
| 2880 |
\else |
| 2881 |
\ifx\@currext\@pkgextension |
| 2882 |
package% |
| 2883 |
\else |
| 2884 |
file% |
| 2885 |
\fi |
| 2886 |
\fi} |
| 2887 |
%</2ekernel|latexrelease> |
| 2888 |
%<latexrelease>\EndIncludeInRelease |
| 2889 |
% \end{macrocode} |
| 2890 |
% |
| 2891 |
% \begin{macrocode} |
| 2892 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 2893 |
%<latexrelease> {\@cls@pkg}{Allow for more extensions}% |
| 2894 |
%<latexrelease> |
| 2895 |
%<latexrelease>\def\@cls@pkg{% |
| 2896 |
%<latexrelease> \ifx\@currext\@clsextension |
| 2897 |
%<latexrelease> document class% |
| 2898 |
%<latexrelease> \else |
| 2899 |
%<latexrelease> package% |
| 2900 |
%<latexrelease> \fi} |
| 2901 |
%<latexrelease>\EndIncludeInRelease |
| 2902 |
%<*2ekernel> |
| 2903 |
% \end{macrocode} |
| 2904 |
% |
| 2905 |
% \begin{macrocode} |
| 2906 |
\@onlypreamble\@cls@pkg |
| 2907 |
% \end{macrocode} |
| 2908 |
% \end{macro} |
| 2909 |
% |
| 2910 |
% \begin{macro}{\@unknownoptionerror} |
| 2911 |
% Bad option. |
| 2912 |
% \begin{macrocode} |
| 2913 |
\def\@unknownoptionerror{% |
| 2914 |
\@latex@error |
| 2915 |
{Unknown option `\CurrentOption' for \@cls@pkg\space`\@currname'}% |
| 2916 |
{The option `\CurrentOption' was not declared in |
| 2917 |
\@cls@pkg\space`\@currname', perhaps you\MessageBreak |
| 2918 |
misspelled its name. |
| 2919 |
Try typing \space <return> |
| 2920 |
\space to proceed.}} |
| 2921 |
\@onlypreamble\@unknownoptionerror |
| 2922 |
% \end{macrocode} |
| 2923 |
% \end{macro} |
| 2924 |
% |
| 2925 |
% \begin{macro}{\@@unprocessedoptions} |
| 2926 |
% Declare an error for each option, unless a |\ProcessOptions| occurred. |
| 2927 |
% \changes{v0.2v}{1994/01/29} |
| 2928 |
% {Macro added.} |
| 2929 |
% \changes{v1.0t}{1995/11/14}{Allow empty option} |
| 2930 |
% \changes{v1.5d}{2022/10/10}{Use \cs{protected@edef}.} |
| 2931 |
% \begin{macrocode} |
| 2932 |
\def\@@unprocessedoptions{% |
| 2933 |
\ifx\@currext\@pkgextension |
| 2934 |
\protected@edef\@curroptions{\@ptionlist{\@currname.\@currext}}% |
| 2935 |
\@for\CurrentOption:=\@curroptions\do{% |
| 2936 |
\ifx\CurrentOption\@empty\else\@unknownoptionerror\fi}% |
| 2937 |
\fi} |
| 2938 |
\@onlypreamble\@unprocessedoptions |
| 2939 |
\@onlypreamble\@@unprocessedoptions |
| 2940 |
% \end{macrocode} |
| 2941 |
% \end{macro} |
| 2942 |
% |
| 2943 |
% \begin{macro}{\@badrequireerror} |
| 2944 |
% |\RequirePackage| or |\LoadClass| occurs in the options section. |
| 2945 |
% \changes{v0.2c}{1993/11/17} |
| 2946 |
% {Macro added} |
| 2947 |
% \begin{macrocode} |
| 2948 |
\def\@badrequireerror#1[#2]#3[#4]{% |
| 2949 |
\@latex@error |
| 2950 |
{\noexpand\RequirePackage or \noexpand\LoadClass |
| 2951 |
in Options Section}% |
| 2952 |
{The \@cls@pkg\space `\@currname' is defective.\MessageBreak |
| 2953 |
It attempts to load `#3' in the options section, i.e.,\MessageBreak |
| 2954 |
between \noexpand\DeclareOption and \string\ProcessOptions.}} |
| 2955 |
\@onlypreamble\@badrequireerror |
| 2956 |
% \end{macrocode} |
| 2957 |
% \end{macro} |
| 2958 |
% |
| 2959 |
% \begin{macro}{\@twoloadclasserror} |
| 2960 |
% Two |\LoadClass| in a class. |
| 2961 |
% \changes{v0.2c}{1993/11/17} |
| 2962 |
% {Macro added} |
| 2963 |
% \begin{macrocode} |
| 2964 |
\def\@twoloadclasserror{% |
| 2965 |
\@latex@error |
| 2966 |
{Two \noexpand\LoadClass commands}% |
| 2967 |
{You may only use one \noexpand\LoadClass in a class file}} |
| 2968 |
\@onlypreamble\@twoloadclasserror |
| 2969 |
% \end{macrocode} |
| 2970 |
% \end{macro} |
| 2971 |
% |
| 2972 |
% \begin{macro}{\@twoclasseserror} |
| 2973 |
% Two |\documentclass| or |\documentstyle|. |
| 2974 |
% \changes{v0.2h}{1993/11/28} |
| 2975 |
% {Macro added} |
| 2976 |
% \begin{macrocode} |
| 2977 |
\def\@twoclasseserror#1#{% |
| 2978 |
\@latex@error |
| 2979 |
{Two \noexpand\documentclass or \noexpand\documentstyle commands}% |
| 2980 |
{The document may only declare one class.}\@gobble} |
| 2981 |
\@onlypreamble\@twoclasseserror |
| 2982 |
% \end{macrocode} |
| 2983 |
% \end{macro} |
| 2984 |
% |
| 2985 |
% \subsection{Providing shipment} |
| 2986 |
% |
| 2987 |
% \begin{macro}{\two@digits} |
| 2988 |
% Prefix a number less than 10 with `0'. |
| 2989 |
% \begin{macrocode} |
| 2990 |
\def\two@digits#1{\ifnum#1<10 0\fi\number#1} |
| 2991 |
% \end{macrocode} |
| 2992 |
% \end{macro} |
| 2993 |
% |
| 2994 |
% \begin{environment}{filecontents} |
| 2995 |
% \begin{macro}{\filecontents} |
| 2996 |
% \begin{macro}{\endfilecontents} |
| 2997 |
% This environment implements inline files. |
| 2998 |
% The star-form does not write extra comments into the file. |
| 2999 |
% |
| 3000 |
% \changes{v0.2h}{1993/11/28} |
| 3001 |
% {Don't globally allocate a write stream (always use 15)} |
| 3002 |
% \changes{v0.2r}{1993/12/19}{Different message when ignoring a file} |
| 3003 |
% \changes{v0.3g}{1994/04/11} |
| 3004 |
% {Add star form, |
| 3005 |
% don't write \cs{endinput} at the end of the file.} |
| 3006 |
% \changes{v1.0c}{1994/05/11} |
| 3007 |
% {Add checks for form feed and tab} |
| 3008 |
% \changes{v1.0m}{1995/04/21} |
| 3009 |
% {Close input check stream: latex/1487} |
| 3010 |
% \changes{v1.0p}{1995/05/25}{Delete \cs{filec@ntents} after preamble} |
| 3011 |
% \changes{v1.3a}{2019/07/01}{Support UTF8 and spaces in |
| 3012 |
% filecontents environment file name} |
| 3013 |
% \changes{v1.3b}{2019/08/27}{Make various commands robust} |
| 3014 |
% \changes{v1.3c}{2019/09/11}{Support optional argument for filecontents} |
| 3015 |
% \changes{v1.3f}{2020/01/05}{Support more write streams in LuaTeX gh/238} |
| 3016 |
% \begin{macrocode} |
| 3017 |
%</2ekernel> |
| 3018 |
%<*2ekernel|latexrelease> |
| 3019 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 3020 |
%<latexrelease> {\filec@ntents}{Define \q@curr@file directly (gh/220)}% |
| 3021 |
% |
| 3022 |
% \end{macrocode} |
| 3023 |
% We use |@tempswa| to mean no preamble writing and reuse |@filesw| |
| 3024 |
% to indicate no overwriting: |
| 3025 |
% \begin{macrocode} |
| 3026 |
\def\filecontents{\@tempswatrue\@fileswtrue |
| 3027 |
\@ifnextchar[\filec@ntents@opt\filec@ntents |
| 3028 |
} |
| 3029 |
\@namedef{filecontents*}{\@tempswafalse\@fileswtrue |
| 3030 |
\@ifnextchar[\filec@ntents@opt\filec@ntents |
| 3031 |
} |
| 3032 |
% \end{macrocode} |
| 3033 |
% To handle the optional argument we execute for each option the |
| 3034 |
% command \cs{filec@ntents@OPTION} if it exist or complain about |
| 3035 |
% unknown option. |
| 3036 |
% \changes{v1.3h}{2020/01/28}{Allow spaces in option string and display |
| 3037 |
% only unknown options not the whole option list (gh/256)} |
| 3038 |
% \changes{v1.5f}{2022/11/16}{Introduce key 'nowarn' on filecontents (gh/958)} |
| 3039 |
% \begin{macrocode} |
| 3040 |
\def\filec@ntents@opt[#1]{% |
| 3041 |
\edef\@fortmp{\zap@space#1 \@empty}% |
| 3042 |
\@for\reserved@a:=\@fortmp\do{% |
| 3043 |
\ifcsname filec@ntents@\reserved@a\endcsname |
| 3044 |
\csname filec@ntents@\reserved@a\endcsname |
| 3045 |
\else |
| 3046 |
\@latex@error{Unknown filecontents option \reserved@a}% |
| 3047 |
{Valid options are force (or overwrite), nosearch, noheader, nowarn}% |
| 3048 |
\fi}% |
| 3049 |
\filec@ntents |
| 3050 |
} |
| 3051 |
% \end{macrocode} |
| 3052 |
% Option \texttt{force} (or \texttt{overwrite}) changes the |
| 3053 |
% overwriting switch |
| 3054 |
% \begin{macrocode} |
| 3055 |
\let\filec@ntents@force\@fileswfalse |
| 3056 |
\let\filec@ntents@overwrite\@fileswfalse % alternative name |
| 3057 |
% \end{macrocode} |
| 3058 |
% and option \texttt{noheader} the preamble switch (which is |
| 3059 |
% equivalent to using the star form of the environment). |
| 3060 |
% \begin{macrocode} |
| 3061 |
\let\filec@ntents@noheader\@tempswafalse |
| 3062 |
% \end{macrocode} |
| 3063 |
% Option \texttt{nosearch} only checks the current directory not |
| 3064 |
% the whole \TeX{} tree for the existence of the file to write. |
| 3065 |
% \begin{macrocode} |
| 3066 |
\def\filec@ntents@nosearch{% |
| 3067 |
\let\filec@ntents@checkdir\@currdir |
| 3068 |
\def\filec@ntents@where{in current directory}} |
| 3069 |
% \end{macrocode} |
| 3070 |
% By default we search the whole tree: |
| 3071 |
% \begin{macrocode} |
| 3072 |
\let\filec@ntents@checkdir\@empty |
| 3073 |
\def\filec@ntents@where{exists on the system} |
| 3074 |
% \end{macrocode} |
| 3075 |
% Option \texttt{nowarn} does not show any warning on the terminal |
| 3076 |
% but still writes it to the \texttt{.log}. |
| 3077 |
% \changes{v1.5f}{2022/11/16}{Introduce key 'nowarn' on filecontents (gh/958)} |
| 3078 |
% \begin{macrocode} |
| 3079 |
\def\filec@ntents@nowarn{% |
| 3080 |
\let\filec@ntents@warning\@latex@note@no@line |
| 3081 |
} |
| 3082 |
% \end{macrocode} |
| 3083 |
% By default we show terminal warnings. |
| 3084 |
% \begin{macrocode} |
| 3085 |
\let\filec@ntents@warning\@latex@warning@no@line |
| 3086 |
% \end{macrocode} |
| 3087 |
% |
| 3088 |
% \begin{macrocode} |
| 3089 |
\begingroup% |
| 3090 |
\@tempcnta=1 |
| 3091 |
\loop |
| 3092 |
\catcode\@tempcnta=12 % |
| 3093 |
\advance\@tempcnta\@ne % |
| 3094 |
\ifnum\@tempcnta<32 % |
| 3095 |
\repeat % |
| 3096 |
\catcode`\*=11 % |
| 3097 |
\catcode`\^^M\active% |
| 3098 |
\catcode`\^^L\active\let^^L\relax% |
| 3099 |
\catcode`\^^I\active% |
| 3100 |
% \end{macrocode} |
| 3101 |
% |
| 3102 |
% \changes{v1.3m}{2020-08-08}{define \cs{q@curr@file} directly as the |
| 3103 |
% quotes have already been removed (gh/220)} |
| 3104 |
% \begin{macrocode} |
| 3105 |
\gdef\filec@ntents#1{% |
| 3106 |
\set@curr@file{\filec@ntents@checkdir#1}% |
| 3107 |
\edef\q@curr@file{"\@curr@file"}% |
| 3108 |
% \end{macrocode} |
| 3109 |
% |
| 3110 |
% Lua\TeX\ has more writes (and 18 is safe here). |
| 3111 |
% \changes{v1.4b}{2021/06/09}{Use \cs{@latex@note@no@line} to display the information} |
| 3112 |
% \begin{macrocode} |
| 3113 |
\chardef\reserved@c\ifx\directlua\@undefined 15 \else 127 \fi% |
| 3114 |
\openin\@inputcheck\q@curr@file \space % |
| 3115 |
\ifeof\@inputcheck% |
| 3116 |
\@latex@note@no@line% |
| 3117 |
{Writing file `\@currdir\@curr@file'}% |
| 3118 |
% \end{macrocode} |
| 3119 |
% |
| 3120 |
% \changes{v1.0y}{1997/10/10} |
| 3121 |
% {\cs{reserved@c} not \cs{verbatim@out} to save a csname} |
| 3122 |
% \begin{macrocode} |
| 3123 |
\ch@ck7\reserved@c\write\relax% |
| 3124 |
\immediate\openout\reserved@c\q@curr@file\relax% |
| 3125 |
\else% |
| 3126 |
% \end{macrocode} |
| 3127 |
% |
| 3128 |
% \changes{v1.0y}{1997/10/10} |
| 3129 |
% {Use \cs{@gobbletwo}} |
| 3130 |
% \changes{v1.4b}{2021/06/09}{Use \cs{@latex@note@no@line} to display the information} |
| 3131 |
% \begin{macrocode} |
| 3132 |
\if@filesw% |
| 3133 |
\@latex@note@no@line% |
| 3134 |
{File `\@curr@file' already \filec@ntents@where.\MessageBreak% |
| 3135 |
Not generating it from this source}% |
| 3136 |
\let\write\@gobbletwo% |
| 3137 |
\let\closeout\@gobble% |
| 3138 |
\else% |
| 3139 |
% \end{macrocode} |
| 3140 |
% If we are overwriting, we try to make sure that the user is not |
| 3141 |
% by mistake overwriting the input file (\cs{jobname}). Of course, |
| 3142 |
% this only works for input files ending in \texttt{.tex}. If a |
| 3143 |
% different extension is used there is no way to see that we are |
| 3144 |
% overwriting ourselves! |
| 3145 |
% \changes{v1.3y}{2021/03/03} |
| 3146 |
% {Fix overwrite check for files with UTF-8 (gh/415)} |
| 3147 |
% \begin{macrocode} |
| 3148 |
\edef\reserved@b{\detokenize\expandafter{\jobname}}% |
| 3149 |
\ifx\@curr@file\reserved@b% |
| 3150 |
\@fileswtrue% |
| 3151 |
\else% |
| 3152 |
\edef\reserved@b{\reserved@b\detokenize{.tex}}% |
| 3153 |
\ifx\@curr@file\reserved@b |
| 3154 |
\@fileswtrue% |
| 3155 |
\fi% |
| 3156 |
\fi% |
| 3157 |
% \end{macrocode} |
| 3158 |
% We allocate a write channel but we open it only if it is |
| 3159 |
% (hopefully) safe. If not opened that means we are going to write |
| 3160 |
% on the terminal. |
| 3161 |
% \changes{v1.3g}{2020/01/27}{Fix typo in error message} |
| 3162 |
% \changes{v1.3j}{2020/02/20}{Fix missing quotes around file name (gh/284)} |
| 3163 |
% \changes{v1.5f}{2022/11/16}{Introduce key 'nowarn' on filecontents (gh/958)} |
| 3164 |
% \changes{v1.5f}{2022/11/16}{Do not show "current dir" in message (gh/917)} |
| 3165 |
% \begin{macrocode} |
| 3166 |
\ch@ck7\reserved@c\write\relax% |
| 3167 |
\if@filesw% % Foul ... trying to overwrite \jobname! |
| 3168 |
\@latex@error{Trying to overwrite `\jobname.tex'}{You can't % |
| 3169 |
write to the file you are reading from!\MessageBreak% |
| 3170 |
Data is written to screen instead.}% |
| 3171 |
\else% |
| 3172 |
\filec@ntents@warning% |
| 3173 |
{Writing or overwriting file `\@curr@file'}% |
| 3174 |
\immediate\openout\reserved@c\q@curr@file\relax% |
| 3175 |
\fi% |
| 3176 |
\fi% |
| 3177 |
\fi% |
| 3178 |
% \end{macrocode} |
| 3179 |
% Closing the \cs{@inputcheck} is done here to avoid having to do |
| 3180 |
% this in each branch. |
| 3181 |
% \begin{macrocode} |
| 3182 |
\closein\@inputcheck% |
| 3183 |
\if@tempswa% |
| 3184 |
% \end{macrocode} |
| 3185 |
% |
| 3186 |
% \changes{v1.0y}{1997/10/10} |
| 3187 |
% {\cs{@currenvir} in banner} |
| 3188 |
% \begin{macrocode} |
| 3189 |
\immediate\write\reserved@c{% |
| 3190 |
\@percentchar\@percentchar\space% |
| 3191 |
\expandafter\@gobble\string\LaTeX2e file `\@curr@file'^^J% |
| 3192 |
\@percentchar\@percentchar\space generated by the % |
| 3193 |
`\@currenvir' \expandafter\@gobblefour\string\newenvironment^^J% |
| 3194 |
\@percentchar\@percentchar\space from source `\jobname' on % |
| 3195 |
\number\year/\two@digits\month/\two@digits\day.^^J% |
| 3196 |
\@percentchar\@percentchar}% |
| 3197 |
\fi% |
| 3198 |
\let\do\@makeother\dospecials% |
| 3199 |
% \end{macrocode} |
| 3200 |
% If there are active characters in the upper half (e.g., from |
| 3201 |
% \texttt{inputenc}) there would be confusion so we render everything |
| 3202 |
% harmless. |
| 3203 |
% \changes{v1.2f}{2018/03/27} |
| 3204 |
% {Use full file name for old release} |
| 3205 |
% \begin{macrocode} |
| 3206 |
\count@ 128\relax% |
| 3207 |
\loop% |
| 3208 |
\catcode\count@ 11\relax% |
| 3209 |
\advance\count@ \@ne% |
| 3210 |
\ifnum\count@<\@cclvi% |
| 3211 |
\repeat% |
| 3212 |
% \end{macrocode} |
| 3213 |
% |
| 3214 |
% \changes{v1.0y}{1997/10/10} |
| 3215 |
% {Check for text before or after \cs{end} environment. latex/2636} |
| 3216 |
% \begin{macrocode} |
| 3217 |
\edef\E{\@backslashchar end\string{\@currenvir\string}}% |
| 3218 |
\edef\reserved@b{% |
| 3219 |
\def\noexpand\reserved@b% |
| 3220 |
####1\E####2\E####3\relax}% |
| 3221 |
\reserved@b{% |
| 3222 |
\ifx\relax##3\relax% |
| 3223 |
% \end{macrocode} |
| 3224 |
% There was no |\end{filecontents}| |
| 3225 |
% \begin{macrocode} |
| 3226 |
\immediate\write\reserved@c{##1}% |
| 3227 |
\else% |
| 3228 |
% \end{macrocode} |
| 3229 |
% There was a |\end{filecontents}|, so stop this time. |
| 3230 |
% \begin{macrocode} |
| 3231 |
\edef^^M{\noexpand\end{\@currenvir}}% |
| 3232 |
\ifx\relax##1\relax% |
| 3233 |
\else% |
| 3234 |
% \end{macrocode} |
| 3235 |
% Text before the |\end|, write it with a warning. |
| 3236 |
% \begin{macrocode} |
| 3237 |
\@latex@warning{Writing text `##1' before % |
| 3238 |
\string\end{\@currenvir}\MessageBreak |
| 3239 |
as last line of \@curr@file}% |
| 3240 |
\immediate\write\reserved@c{##1}% |
| 3241 |
\fi% |
| 3242 |
\ifx\relax##2\relax% |
| 3243 |
\else% |
| 3244 |
% \end{macrocode} |
| 3245 |
% Text after the |\end|, ignore it with a warning. |
| 3246 |
% \begin{macrocode} |
| 3247 |
\@latex@warning{% |
| 3248 |
Ignoring text `##2' after \string\end{\@currenvir}}% |
| 3249 |
\fi% |
| 3250 |
\fi% |
| 3251 |
^^M}% |
| 3252 |
% \end{macrocode} |
| 3253 |
% |
| 3254 |
% |
| 3255 |
% \changes{v1.2j}{2018/05/29}{use \cs{csname} not \cs{@undefined}} |
| 3256 |
% \begin{macrocode} |
| 3257 |
\catcode`\^^L\active% |
| 3258 |
\let\L\@undefined% |
| 3259 |
\def^^L{\expandafter\ifx\csname L\endcsname\relax\fi ^^J^^J}% |
| 3260 |
\catcode`\^^I\active% |
| 3261 |
\let\I\@undefined% |
| 3262 |
\def^^I{\expandafter\ifx\csname I\endcsname\relax\fi\space}% |
| 3263 |
\catcode`\^^M\active% |
| 3264 |
\edef^^M##1^^M{% |
| 3265 |
\noexpand\reserved@b##1\E\E\relax}}% |
| 3266 |
\endgroup% |
| 3267 |
% \end{macrocode} |
| 3268 |
% |
| 3269 |
% |
| 3270 |
% \begin{macrocode} |
| 3271 |
%</2ekernel|latexrelease> |
| 3272 |
%<latexrelease>\EndIncludeInRelease |
| 3273 |
%<latexrelease>\IncludeInRelease{2019/10/01}% |
| 3274 |
%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% |
| 3275 |
%<latexrelease> |
| 3276 |
%<latexrelease>\def\filecontents{\@tempswatrue\@fileswtrue |
| 3277 |
%<latexrelease> \@ifnextchar[\filec@ntents@opt\filec@ntents |
| 3278 |
%<latexrelease>} |
| 3279 |
%<latexrelease>\@namedef{filecontents*}{\@tempswafalse\@fileswtrue |
| 3280 |
%<latexrelease> \@ifnextchar[\filec@ntents@opt\filec@ntents |
| 3281 |
%<latexrelease>} |
| 3282 |
%<latexrelease>\def\filec@ntents@opt[#1]{% |
| 3283 |
%<latexrelease> \edef\@fortmp{\zap@space#1 \@empty}% |
| 3284 |
%<latexrelease> \@for\reserved@a:=\@fortmp\do{% |
| 3285 |
%<latexrelease> \ifcsname filec@ntents@\reserved@a\endcsname |
| 3286 |
%<latexrelease> \csname filec@ntents@\reserved@a\endcsname |
| 3287 |
%<latexrelease> \else |
| 3288 |
%<latexrelease> \@latex@error{Unknown filecontents option \reserved@a}% |
| 3289 |
%<latexrelease> {Valid options are force (or overwrite), nosearch, noheader}% |
| 3290 |
%<latexrelease> \fi}% |
| 3291 |
%<latexrelease> \filec@ntents |
| 3292 |
%<latexrelease>} |
| 3293 |
%<latexrelease>\let\filec@ntents@force\@fileswfalse |
| 3294 |
%<latexrelease>\let\filec@ntents@overwrite\@fileswfalse % alternative name |
| 3295 |
%<latexrelease>\let\filec@ntents@noheader\@tempswafalse |
| 3296 |
%<latexrelease>\def\filec@ntents@nosearch{% |
| 3297 |
%<latexrelease> \let\filec@ntents@checkdir\@currdir |
| 3298 |
%<latexrelease> \def\filec@ntents@where{in current directory}} |
| 3299 |
%<latexrelease>\let\filec@ntents@checkdir\@empty |
| 3300 |
%<latexrelease>\def\filec@ntents@where{exists on the system} |
| 3301 |
%<latexrelease>\begingroup% |
| 3302 |
%<latexrelease>\@tempcnta=1 |
| 3303 |
%<latexrelease>\loop |
| 3304 |
%<latexrelease> \catcode\@tempcnta=12 % |
| 3305 |
%<latexrelease> \advance\@tempcnta\@ne % |
| 3306 |
%<latexrelease>\ifnum\@tempcnta<32 % |
| 3307 |
%<latexrelease>\repeat % |
| 3308 |
%<latexrelease>\catcode`\*=11 % |
| 3309 |
%<latexrelease>\catcode`\^^M\active% |
| 3310 |
%<latexrelease>\catcode`\^^L\active\let^^L\relax% |
| 3311 |
%<latexrelease>\catcode`\^^I\active% |
| 3312 |
%<latexrelease>\gdef\filec@ntents#1{% |
| 3313 |
%<latexrelease> \set@curr@file{\filec@ntents@checkdir#1}% |
| 3314 |
%<latexrelease> \edef\q@curr@file{\expandafter\quote@name\expandafter{\@curr@file}}% |
| 3315 |
%<latexrelease> \chardef\reserved@c\ifx\directlua\@undefined 15 \else 127 \fi% |
| 3316 |
%<latexrelease> \openin\@inputcheck\q@curr@file \space % |
| 3317 |
%<latexrelease> \ifeof\@inputcheck% |
| 3318 |
%<latexrelease> \@latex@warning@no@line% |
| 3319 |
%<latexrelease> {Writing file `\@currdir\@curr@file'}% |
| 3320 |
%<latexrelease> \ch@ck7\reserved@c\write\relax% |
| 3321 |
%<latexrelease> \immediate\openout\reserved@c\q@curr@file\relax% |
| 3322 |
%<latexrelease> \else% |
| 3323 |
%<latexrelease> \if@filesw% |
| 3324 |
%<latexrelease> \@latex@warning@no@line% |
| 3325 |
%<latexrelease> {File `\@curr@file' already \filec@ntents@where.\MessageBreak% |
| 3326 |
%<latexrelease> Not generating it from this source}% |
| 3327 |
%<latexrelease> \let\write\@gobbletwo% |
| 3328 |
%<latexrelease> \let\closeout\@gobble% |
| 3329 |
%<latexrelease> \else% |
| 3330 |
%<latexrelease> \edef\reserved@a{#1}% |
| 3331 |
%<latexrelease> \edef\reserved@a{\detokenize\expandafter{\reserved@a}}% |
| 3332 |
%<latexrelease> \edef\reserved@b{\detokenize\expandafter{\jobname}}% |
| 3333 |
%<latexrelease> \ifx\reserved@a\reserved@b% |
| 3334 |
%<latexrelease> \@fileswtrue% |
| 3335 |
%<latexrelease> \else% |
| 3336 |
%<latexrelease> \edef\reserved@b{\reserved@b\detokenize{.tex}}% |
| 3337 |
%<latexrelease> \ifx\reserved@a\reserved@b |
| 3338 |
%<latexrelease> \@fileswtrue% |
| 3339 |
%<latexrelease> \fi% |
| 3340 |
%<latexrelease> \fi% |
| 3341 |
%<latexrelease> \ch@ck7\reserved@c\write\relax% |
| 3342 |
%<latexrelease> \if@filesw% % Foul ... trying to overwrite \jobname! |
| 3343 |
%<latexrelease> \@latex@error{Trying to overwrite `\jobname.tex'}{You can't % |
| 3344 |
%<latexrelease> write to the file you are reading from!\MessageBreak% |
| 3345 |
%<latexrelease> Data is written to screen instead.}% |
| 3346 |
%<latexrelease> \else% |
| 3347 |
%<latexrelease> \@latex@warning@no@line% |
| 3348 |
%<latexrelease> {Writing or overwriting file `\@currdir\@curr@file'}% |
| 3349 |
%<latexrelease> \immediate\openout\reserved@c\q@curr@file\relax% |
| 3350 |
%<latexrelease> \fi% |
| 3351 |
%<latexrelease> \fi% |
| 3352 |
%<latexrelease> \fi% |
| 3353 |
%<latexrelease> \closein\@inputcheck% |
| 3354 |
%<latexrelease> \if@tempswa% |
| 3355 |
%<latexrelease> \immediate\write\reserved@c{% |
| 3356 |
%<latexrelease> \@percentchar\@percentchar\space% |
| 3357 |
%<latexrelease> \expandafter\@gobble\string\LaTeX2e file `\@curr@file'^^J% |
| 3358 |
%<latexrelease> \@percentchar\@percentchar\space generated by the % |
| 3359 |
%<latexrelease> `\@currenvir' \expandafter\@gobblefour\string\newenvironment^^J% |
| 3360 |
%<latexrelease> \@percentchar\@percentchar\space from source `\jobname' on % |
| 3361 |
%<latexrelease> \number\year/\two@digits\month/\two@digits\day.^^J% |
| 3362 |
%<latexrelease> \@percentchar\@percentchar}% |
| 3363 |
%<latexrelease> \fi% |
| 3364 |
%<latexrelease> \let\do\@makeother\dospecials% |
| 3365 |
%<latexrelease> \count@ 128\relax% |
| 3366 |
%<latexrelease> \loop% |
| 3367 |
%<latexrelease> \catcode\count@ 11\relax% |
| 3368 |
%<latexrelease> \advance\count@ \@ne% |
| 3369 |
%<latexrelease> \ifnum\count@<\@cclvi% |
| 3370 |
%<latexrelease> \repeat% |
| 3371 |
%<latexrelease> \edef\E{\@backslashchar end\string{\@currenvir\string}}% |
| 3372 |
%<latexrelease> \edef\reserved@b{% |
| 3373 |
%<latexrelease> \def\noexpand\reserved@b% |
| 3374 |
%<latexrelease> ####1\E####2\E####3\relax}% |
| 3375 |
%<latexrelease> \reserved@b{% |
| 3376 |
%<latexrelease> \ifx\relax##3\relax% |
| 3377 |
%<latexrelease> \immediate\write\reserved@c{##1}% |
| 3378 |
%<latexrelease> \else% |
| 3379 |
%<latexrelease> \edef^^M{\noexpand\end{\@currenvir}}% |
| 3380 |
%<latexrelease> \ifx\relax##1\relax% |
| 3381 |
%<latexrelease> \else% |
| 3382 |
%<latexrelease> \@latex@warning{Writing text `##1' before % |
| 3383 |
%<latexrelease> \string\end{\@currenvir}\MessageBreak as last line of \@curr@file}% |
| 3384 |
%<latexrelease> \immediate\write\reserved@c{##1}% |
| 3385 |
%<latexrelease> \fi% |
| 3386 |
%<latexrelease> \ifx\relax##2\relax% |
| 3387 |
%<latexrelease> \else% |
| 3388 |
%<latexrelease> \@latex@warning{% |
| 3389 |
%<latexrelease> Ignoring text `##2' after \string\end{\@currenvir}}% |
| 3390 |
%<latexrelease> \fi% |
| 3391 |
%<latexrelease> \fi% |
| 3392 |
%<latexrelease> ^^M}% |
| 3393 |
%<latexrelease> \catcode`\^^L\active% |
| 3394 |
%<latexrelease> \let\L\@undefined% |
| 3395 |
%<latexrelease> \def^^L{\expandafter\ifx\csname L\endcsname\relax\fi ^^J^^J}% |
| 3396 |
%<latexrelease> \catcode`\^^I\active% |
| 3397 |
%<latexrelease> \let\I\@undefined% |
| 3398 |
%<latexrelease> \def^^I{\expandafter\ifx\csname I\endcsname\relax\fi\space}% |
| 3399 |
%<latexrelease> \catcode`\^^M\active% |
| 3400 |
%<latexrelease> \edef^^M##1^^M{% |
| 3401 |
%<latexrelease> \noexpand\reserved@b##1\E\E\relax}}% |
| 3402 |
%<latexrelease>\endgroup% |
| 3403 |
%<latexrelease>\EndIncludeInRelease |
| 3404 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 3405 |
%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% |
| 3406 |
%<latexrelease> |
| 3407 |
%<latexrelease>\let\filec@ntents@opt \@undefined |
| 3408 |
%<latexrelease>\let\filec@ntents@force \@undefined |
| 3409 |
%<latexrelease>\let\filec@ntents@overwrite \@undefined |
| 3410 |
%<latexrelease>\let\filec@ntents@noheader \@undefined |
| 3411 |
%<latexrelease>\let\filec@ntents@nosearch \@undefined |
| 3412 |
%<latexrelease>\let\filec@ntents@checkdir \@undefined |
| 3413 |
%<latexrelease>\let\filec@ntents@where \@undefined |
| 3414 |
%<latexrelease> |
| 3415 |
%<latexrelease>\begingroup% |
| 3416 |
%<latexrelease>\@tempcnta=1 |
| 3417 |
%<latexrelease>\loop |
| 3418 |
%<latexrelease> \catcode\@tempcnta=12 % |
| 3419 |
%<latexrelease> \advance\@tempcnta\@ne % |
| 3420 |
%<latexrelease>\ifnum\@tempcnta<32 % |
| 3421 |
%<latexrelease>\repeat % |
| 3422 |
%<latexrelease>\catcode`\*=11 % |
| 3423 |
%<latexrelease>\catcode`\^^M\active% |
| 3424 |
%<latexrelease>\catcode`\^^L\active\let^^L\relax% |
| 3425 |
%<latexrelease>\catcode`\^^I\active% |
| 3426 |
%<latexrelease> |
| 3427 |
%<latexrelease>\gdef\filec@ntents#1{% |
| 3428 |
%<latexrelease> \openin\@inputcheck#1 % |
| 3429 |
%<latexrelease> \ifeof\@inputcheck% |
| 3430 |
%<latexrelease> \@latex@warning@no@line% |
| 3431 |
%<latexrelease> {Writing file `\@currdir#1'}% |
| 3432 |
%<latexrelease> \chardef\reserved@c15 % |
| 3433 |
%<latexrelease> \ch@ck7\reserved@c\write% |
| 3434 |
%<latexrelease> \immediate\openout\reserved@c#1\relax% |
| 3435 |
%<latexrelease> \else% |
| 3436 |
%<latexrelease> \closein\@inputcheck% |
| 3437 |
%<latexrelease> \@latex@warning@no@line% |
| 3438 |
%<latexrelease> {File `#1' already exists on the system.\MessageBreak% |
| 3439 |
%<latexrelease> Not generating it from this source}% |
| 3440 |
%<latexrelease> \let\write\@gobbletwo% |
| 3441 |
%<latexrelease> \let\closeout\@gobble% |
| 3442 |
%<latexrelease> \fi% |
| 3443 |
%<latexrelease> \if@tempswa% |
| 3444 |
%<latexrelease> \immediate\write\reserved@c{% |
| 3445 |
%<latexrelease> \@percentchar\@percentchar\space% |
| 3446 |
%<latexrelease> \expandafter\@gobble\string\LaTeX2e file `#1'^^J% |
| 3447 |
%<latexrelease> \@percentchar\@percentchar\space generated by the % |
| 3448 |
%<latexrelease> `\@currenvir' \expandafter\@gobblefour\string\newenvironment^^J% |
| 3449 |
%<latexrelease> \@percentchar\@percentchar\space from source `\jobname' on % |
| 3450 |
%<latexrelease> \number\year/\two@digits\month/\two@digits\day.^^J% |
| 3451 |
%<latexrelease> \@percentchar\@percentchar}% |
| 3452 |
%<latexrelease> \fi% |
| 3453 |
%<latexrelease> \let\do\@makeother\dospecials% |
| 3454 |
%<latexrelease> \count@ 128\relax% |
| 3455 |
%<latexrelease> \loop% |
| 3456 |
%<latexrelease> \catcode\count@ 11\relax% |
| 3457 |
%<latexrelease> \advance\count@ \@ne% |
| 3458 |
%<latexrelease> \ifnum\count@<\@cclvi% |
| 3459 |
%<latexrelease> \repeat% |
| 3460 |
%<latexrelease> \edef\E{\@backslashchar end\string{\@currenvir\string}}% |
| 3461 |
%<latexrelease> \edef\reserved@b{% |
| 3462 |
%<latexrelease> \def\noexpand\reserved@b% |
| 3463 |
%<latexrelease> ####1\E####2\E####3\relax}% |
| 3464 |
%<latexrelease> \reserved@b{% |
| 3465 |
%<latexrelease> \ifx\relax##3\relax% |
| 3466 |
%<latexrelease> \immediate\write\reserved@c{##1}% |
| 3467 |
%<latexrelease> \else% |
| 3468 |
%<latexrelease> \edef^^M{\noexpand\end{\@currenvir}}% |
| 3469 |
%<latexrelease> \ifx\relax##1\relax% |
| 3470 |
%<latexrelease> \else% |
| 3471 |
%<latexrelease> \@latex@warning{Writing text `##1' before % |
| 3472 |
%<latexrelease> \string\end{\@currenvir}\MessageBreak as last line of #1}% |
| 3473 |
%<latexrelease> \immediate\write\reserved@c{##1}% |
| 3474 |
%<latexrelease> \fi% |
| 3475 |
%<latexrelease> \ifx\relax##2\relax% |
| 3476 |
%<latexrelease> \else% |
| 3477 |
%<latexrelease> \@latex@warning{% |
| 3478 |
%<latexrelease> Ignoring text `##2' after \string\end{\@currenvir}}% |
| 3479 |
%<latexrelease> \fi% |
| 3480 |
%<latexrelease> \fi% |
| 3481 |
%<latexrelease> ^^M}% |
| 3482 |
%<latexrelease> |
| 3483 |
%<latexrelease> \catcode`\^^L\active% |
| 3484 |
%<latexrelease> \let\L\@undefined% |
| 3485 |
%<latexrelease> \def^^L{\expandafter\ifx\csname L\endcsname\relax\fi ^^J^^J}% |
| 3486 |
%<latexrelease> \catcode`\^^I\active% |
| 3487 |
%<latexrelease> \let\I\@undefined% |
| 3488 |
%<latexrelease> \def^^I{\expandafter\ifx\csname I\endcsname\relax\fi\space}% |
| 3489 |
%<latexrelease> \catcode`\^^M\active% |
| 3490 |
%<latexrelease> \edef^^M##1^^M{% |
| 3491 |
%<latexrelease> \noexpand\reserved@b##1\E\E\relax}}% |
| 3492 |
%<latexrelease>\endgroup% |
| 3493 |
%<latexrelease>\EndIncludeInRelease |
| 3494 |
%<*2ekernel> |
| 3495 |
% \end{macrocode} |
| 3496 |
% |
| 3497 |
% |
| 3498 |
% \begin{macrocode} |
| 3499 |
\begingroup |
| 3500 |
\catcode`|=\catcode`\% |
| 3501 |
\catcode`\%=12 |
| 3502 |
\catcode`\*=11 |
| 3503 |
\gdef\@percentchar{%} |
| 3504 |
\gdef\endfilecontents{| |
| 3505 |
\immediate\closeout\reserved@c |
| 3506 |
\def\T##1##2##3{| |
| 3507 |
\ifx##1\@undefined\else |
| 3508 |
\@latex@warning@no@line{##2 has been converted to Blank ##3e}| |
| 3509 |
\fi}| |
| 3510 |
\T\L{Form Feed}{Lin}| |
| 3511 |
\T\I{Tab}{Spac}| |
| 3512 |
\immediate\write\@unused{}} |
| 3513 |
\global\let\endfilecontents*\endfilecontents |
| 3514 |
% \end{macrocode} |
| 3515 |
% We no longer prevent the code to be used after begin document (no |
| 3516 |
% rollback needed for this change). |
| 3517 |
% \begin{macrocode} |
| 3518 |
%\@onlypreamble\filecontents |
| 3519 |
%\@onlypreamble\endfilecontents |
| 3520 |
%\@onlypreamble\filecontents* |
| 3521 |
%\@onlypreamble\endfilecontents* |
| 3522 |
\endgroup |
| 3523 |
%\@onlypreamble\filec@ntents |
| 3524 |
% \end{macrocode} |
| 3525 |
% \end{macro} |
| 3526 |
% \end{macro} |
| 3527 |
% \end{environment} |
| 3528 |
% |
| 3529 |
% |
| 3530 |
% |
| 3531 |
% |
| 3532 |
% |
| 3533 |
% \section{Package/class rollback mechanism} |
| 3534 |
% |
| 3535 |
% |
| 3536 |
% |
| 3537 |
% \begin{macrocode} |
| 3538 |
%</2ekernel> |
| 3539 |
%<*2ekernel|latexreleasefirst> |
| 3540 |
% \end{macrocode} |
| 3541 |
% |
| 3542 |
% \changes{v1.2d}{2018/02/18}{Introduce rollback concept} |
| 3543 |
% |
| 3544 |
% \begin{macro}{\pkgcls@debug} |
| 3545 |
% For testing we have a few extra lines of code that by default do |
| 3546 |
% nothing but one can set |\pkgcls@debug| to |\typeout| to get |
| 3547 |
% extra info. Sometime in the future this will be dropped. |
| 3548 |
% \begin{macrocode} |
| 3549 |
%<*tracerollback> |
| 3550 |
%\let\pkgcls@debug\typeout |
| 3551 |
\let\pkgcls@debug\@gobble |
| 3552 |
%</tracerollback> |
| 3553 |
% \end{macrocode} |
| 3554 |
% \end{macro} |
| 3555 |
% |
| 3556 |
% |
| 3557 |
% \begin{macro}{\requestedLaTeXdate} |
| 3558 |
% The macro (!) |\requestedLaTeXdate| holds the globally requested |
| 3559 |
% rollback date (via \texttt{latexrelease}) or zero if no such |
| 3560 |
% request was made. |
| 3561 |
% \begin{macrocode} |
| 3562 |
\def\requestedLaTeXdate{0} |
| 3563 |
% \end{macrocode} |
| 3564 |
% \end{macro} |
| 3565 |
% |
| 3566 |
% |
| 3567 |
% \begin{macro}{\pkgcls@targetdate} |
| 3568 |
% \begin{macro}{\pkgcls@targetlabel} |
| 3569 |
% \begin{macro}{\pkgcls@innerdate} |
| 3570 |
% |
| 3571 |
% If a rollback for a package or class is requested then |
| 3572 |
% |\pkgcls@targetdate| holds the requested date as a number |
| 3573 |
% YYYYMMDD (if there was one, otherwise the value of |
| 3574 |
% |\requestedLaTeXdate|) and |\pkgcls@targetlabel| will be |
| 3575 |
% empty. If there was a request for a named version then |
| 3576 |
% |\pkgcls@targetlabel| holds the version name and |
| 3577 |
% |\pkgcls@targetdate| is set to \texttt{1}. |
| 3578 |
% |
| 3579 |
% |\pkgcls@targetdate=0| is used to indicate that there was no |
| 3580 |
% rollback request. |
| 3581 |
% While loading an old release |\pkgcls@targetdate| is also reset to |
| 3582 |
% zero so that |\DeclareRelease| declarations are bypassed. |
| 3583 |
% |
| 3584 |
% In contrast |\pkgcls@innerdate| will always hold the requested |
| 3585 |
% date (in a macro not a counter) if there was one, otherwise, |
| 3586 |
% e.g., if there was no request or a request to a version name it |
| 3587 |
% will contain \TeX{} largest legal number. While loading a file |
| 3588 |
% this can be used to provide conditionals that select code based |
| 3589 |
% on the request. |
| 3590 |
% |
| 3591 |
% |
| 3592 |
% \begin{macrocode} |
| 3593 |
\ifx\pkgcls@targetdate\@undefined |
| 3594 |
\newcount\pkgcls@targetdate |
| 3595 |
\fi |
| 3596 |
\let\pkgcls@targetlabel\@empty |
| 3597 |
\def\pkgcls@innerdate{\maxdimen} |
| 3598 |
% \end{macrocode} |
| 3599 |
% \end{macro} |
| 3600 |
% \end{macro} |
| 3601 |
% \end{macro} |
| 3602 |
% |
| 3603 |
% \begin{macro}{\pkgcls@candidate} |
| 3604 |
% \begin{macro}{\pkgcls@releasedate} |
| 3605 |
% When looping through the |\DeclareRelease| declarations we |
| 3606 |
% record if the release is the best candidate we have seen so far. |
| 3607 |
% This is recorded in |\pkgcls@candidate| and we update it whenever |
| 3608 |
% we see a better one. |
| 3609 |
% |
| 3610 |
% In |\pkgcls@releasedate| we keep track of the release date of |
| 3611 |
% that candidate. |
| 3612 |
% \begin{macrocode} |
| 3613 |
\let\pkgcls@candidate\@empty |
| 3614 |
\let\pkgcls@releasedate\@empty |
| 3615 |
% \end{macrocode} |
| 3616 |
% \end{macro} |
| 3617 |
% \end{macro} |
| 3618 |
% |
| 3619 |
% \begin{macro}{\load@onefilewithoptions} |
| 3620 |
% \begin{macro}{\@onefilewithoptions} |
| 3621 |
% the best place to add the rollback code is at the point where |
| 3622 |
% |\@onefilewithoptions| is called to load a single class or |
| 3623 |
% package. |
| 3624 |
% |
| 3625 |
% To make things easy we save the old definition as |
| 3626 |
% |\load@onefilewithoptions| and then provide a new interface. |
| 3627 |
% |
| 3628 |
% Important: as this code is also unconditionally placed into |
| 3629 |
% latexrelease we can only do this name change once otherwise both |
| 3630 |
% macros will contain the same code. |
| 3631 |
% \begin{macrocode} |
| 3632 |
\ifx\load@onefilewithoptions\@undefined |
| 3633 |
\let\load@onefilewithoptions\@onefilewithoptions |
| 3634 |
% \end{macrocode} |
| 3635 |
% |
| 3636 |
% \begin{macrocode} |
| 3637 |
\def\@onefilewithoptions#1[#2][#3]#4{% |
| 3638 |
% \end{macrocode} |
| 3639 |
% First a bit of tracing normally disabled. |
| 3640 |
% \begin{macrocode} |
| 3641 |
%<*tracerollback> |
| 3642 |
\pkgcls@debug{--- File loaded request (\noexpand\usepackage or ...)}% |
| 3643 |
\pkgcls@debug{\@spaces 1: #1}% |
| 3644 |
\pkgcls@debug{\@spaces 2: #2}% |
| 3645 |
\pkgcls@debug{\@spaces 3: #3}% |
| 3646 |
\pkgcls@debug{\@spaces 4: #4}% |
| 3647 |
%</tracerollback> |
| 3648 |
% \end{macrocode} |
| 3649 |
% Three of the arguments are needed later on in error/warning |
| 3650 |
% messages so we save them. |
| 3651 |
% \changes{v1.5l}{2024/06/04} |
| 3652 |
% {New argument \cs{pkgcls@ext} (gh/870)} |
| 3653 |
% \begin{macrocode} |
| 3654 |
\def\pkgcls@name{#1}% % for info message |
| 3655 |
\def\pkgcls@arg {#3}% % for info message |
| 3656 |
\edef\pkgcls@ext{% |
| 3657 |
\ifx#4\@clsextension document class\else |
| 3658 |
\ifx#4\@pkgextension package\else |
| 3659 |
file |
| 3660 |
\fi |
| 3661 |
\fi |
| 3662 |
}% % for info message |
| 3663 |
% \end{macrocode} |
| 3664 |
% then we parse the final optional argument to determine if there |
| 3665 |
% is a specific rollback request for the current file. This will |
| 3666 |
% set |\pkgcls@targetdate|, |\pkgcls@targetlabel| and |
| 3667 |
% |\pkgcls@mindate|. |
| 3668 |
% \begin{macrocode} |
| 3669 |
\pkgcls@parse@date@arg{#3}% |
| 3670 |
% \end{macrocode} |
| 3671 |
% When determining the correct release to load we keep track of |
| 3672 |
% candidates in |\pkgcls@candidate| and initially we don't have any: |
| 3673 |
% \begin{macrocode} |
| 3674 |
\let\pkgcls@candidate\@empty |
| 3675 |
% \end{macrocode} |
| 3676 |
% If we had a rollback request then |#3| may contain data but not |
| 3677 |
% necessarily a ``minimal date'' so instead of passing it on we |
| 3678 |
% pass on the content of |\pkgcls@mindate|. We need to pass the |
| 3679 |
% value not the command, otherwise nested packages may pick up the |
| 3680 |
% wrong information. |
| 3681 |
% \changes{v1.2h}{2018-04-08}{Pass expanded date} |
| 3682 |
% \begin{macrocode} |
| 3683 |
\begingroup |
| 3684 |
\edef\reserved@a{% |
| 3685 |
\endgroup |
| 3686 |
\unexpanded{\load@onefilewithoptions#1[#2]}% |
| 3687 |
[\pkgcls@mindate]% |
| 3688 |
\unexpanded{#4}}% |
| 3689 |
\reserved@a |
| 3690 |
} |
| 3691 |
\fi |
| 3692 |
% \end{macrocode} |
| 3693 |
% \end{macro} |
| 3694 |
% \end{macro} |
| 3695 |
% |
| 3696 |
% |
| 3697 |
% \begin{macro}{\pkgcls@parse@date@arg} |
| 3698 |
% The |\pkgcls@parse@date@arg| command parses the second optional |
| 3699 |
% argument of |\usepackage|, |\RequirePackage| or |\documentclass| |
| 3700 |
% for a rollback request setting the values of |\pkgcls@targetdate| |
| 3701 |
% and |\pkgcls@targetlabel|. |
| 3702 |
% |
| 3703 |
% This optional argument has a dual purpose: If it just contains a |
| 3704 |
% date string then this means that the package should have at least |
| 3705 |
% that date (to ensure that a certain feature is actually available, |
| 3706 |
% or a certain bug has been fixed). When the package gets loaded the |
| 3707 |
% information in |\Provides...| will then be checked against this |
| 3708 |
% request. |
| 3709 |
% |
| 3710 |
% But if it starts with an equal sign followed by a date string or |
| 3711 |
% followed by a version name then this means that we should roll |
| 3712 |
% back to the state of the package at that date or to the version |
| 3713 |
% with the requested name. |
| 3714 |
% |
| 3715 |
% If there was no optional argument or the optional argument |
| 3716 |
% does not start with ``\texttt{=}'' then the |\pkgcls@targetdate| |
| 3717 |
% is set to the date of the overall rollback request (via |
| 3718 |
% \texttt{latexrelease}) or if that was not given it is set to |
| 3719 |
% \texttt{0}. |
| 3720 |
% In either case |\pkgcls@targetlabel| will be made empty. |
| 3721 |
% |
| 3722 |
% If the argument doesn't start with ``\texttt{=}'' then it is |
| 3723 |
% supposed to be a ``minimal date'' and we therefore save the value |
| 3724 |
% in |\pkgcls@mindate|, otherwise this macro is made empty. |
| 3725 |
% |
| 3726 |
% So in summary we have: |
| 3727 |
% \begin{flushleft} |
| 3728 |
% \hspace*{-1in}\begin{tabular}{ccccc@{}} |
| 3729 |
% Input & & \cs{pkgcls@targetdate} |
| 3730 |
% & \cs{pkgcls@targetlabel} |
| 3731 |
% & \cs{pkgcls@mindate}\\[3pt] |
| 3732 |
% \meta{empty} & $\to$ & \meta{global-rollbackdate-as-number} |
| 3733 |
% & \meta{empty} & \meta{empty} |
| 3734 |
% \\ |
| 3735 |
% \meta{date} & $\to$ & \meta{global-rollbackdate-as-number} |
| 3736 |
% & \meta{empty} & \meta{date} |
| 3737 |
% \\ |
| 3738 |
% \texttt{=}\meta{date} & $\to$ & \meta{date-as-number} |
| 3739 |
% & \meta{empty} & \meta{empty} |
| 3740 |
% \\ |
| 3741 |
% \texttt{=}\meta{version}& $\to$ & \texttt{1} |
| 3742 |
% & \meta{version} & \meta{empty} |
| 3743 |
% \\ |
| 3744 |
% \meta{other} & $\to$ & \meta{global-rollbackdate-as-number} |
| 3745 |
% & \meta{empty} & \meta{other} |
| 3746 |
% \\ |
| 3747 |
% \end{tabular} |
| 3748 |
% \end{flushleft} |
| 3749 |
% where \meta{global-rollbackdate-as-number} is a date request given |
| 3750 |
% via \texttt{latexrelease} or if there wasn't one \texttt{0}. |
| 3751 |
% |
| 3752 |
% \begin{macrocode} |
| 3753 |
\def\pkgcls@parse@date@arg #1{% |
| 3754 |
% \end{macrocode} |
| 3755 |
% If the argument is empty we use the rollback date from |
| 3756 |
% \texttt{latexrelease} which has the value of zero if there was no |
| 3757 |
% rollback request. The label and the minimal date is made empty in that case. |
| 3758 |
% \begin{macrocode} |
| 3759 |
\ifx\@nil#1\@nil |
| 3760 |
\pkgcls@targetdate\requestedLaTeXdate\relax |
| 3761 |
\let\pkgcls@targetlabel\@empty |
| 3762 |
\let\pkgcls@mindate\@empty |
| 3763 |
% \end{macrocode} |
| 3764 |
% Otherwise we parse the argument further, checking for a \texttt{=} |
| 3765 |
% as the first character. We append a \texttt{=} at the end so that |
| 3766 |
% there is at least one such character in the argument. |
| 3767 |
% \begin{macrocode} |
| 3768 |
\else |
| 3769 |
\pkgcls@parse@date@arg@#1=\@nil\relax |
| 3770 |
\fi |
| 3771 |
} |
| 3772 |
% \end{macrocode} |
| 3773 |
% The actual parsing work then happens in |\pkgcls@parse@date@arg@|: |
| 3774 |
% \begin{macrocode} |
| 3775 |
\def\pkgcls@parse@date@arg@#1=#2\@nil{% |
| 3776 |
% \end{macrocode} |
| 3777 |
% We set |\pkgcls@targetdate| depending on the parsing result; the |
| 3778 |
% code is expandable so we can do the parsing as part of the assignment. |
| 3779 |
% \begin{macrocode} |
| 3780 |
\pkgcls@targetdate |
| 3781 |
% \end{macrocode} |
| 3782 |
% If a \texttt{=} was in first position then |#1| will be empty. In |
| 3783 |
% that case |#2| will be the original argument with a \texttt{=} |
| 3784 |
% appended. |
| 3785 |
% |
| 3786 |
% This can be parsed with |\@parse@version|, the trailing character |
| 3787 |
% is simply ignored. This macro returns the parsed date as a number |
| 3788 |
% (or zero if it wasn't a date) and accepts both YYYY/MM/DD and YYYY-MM-DD |
| 3789 |
% formats. |
| 3790 |
% \begin{macrocode} |
| 3791 |
\ifx\@nil#1\@nil |
| 3792 |
\@parse@version0#2//00\@nil\relax |
| 3793 |
% \end{macrocode} |
| 3794 |
% Whatever is returned is thus assigned to |\pkgcls@targetdate| |
| 3795 |
% and therefore we can now test its value. If the value is zero we |
| 3796 |
% assume that the remaining argument string represents a version |
| 3797 |
% and change |\pkgcls@targetdate| and set |\pkgcls@targetlabel| to |
| 3798 |
% the version name (after stripping off the trailing \texttt{=}). |
| 3799 |
% \begin{macrocode} |
| 3800 |
\ifnum \pkgcls@targetdate=\z@ |
| 3801 |
\pkgcls@targetdate\@ne |
| 3802 |
\def\pkgcls@innerdate{\maxdimen}% |
| 3803 |
\pkgcls@parse@date@arg@version#2% |
| 3804 |
\else |
| 3805 |
\edef\pkgcls@innerdate{\the\pkgcls@targetdate}% |
| 3806 |
\fi |
| 3807 |
\let\pkgcls@mindate\@empty |
| 3808 |
\else |
| 3809 |
% \end{macrocode} |
| 3810 |
% If |#1| was not empty then there wasn't a \texttt{=} character in |
| 3811 |
% first position so we are dealing either with a ``minimum |
| 3812 |
% date'' or with some incorrect data. We assume the former and make |
| 3813 |
% the following assignments (the first one finishing the assignment |
| 3814 |
% of |\pkgcls@targetdate|): |
| 3815 |
% \begin{macrocode} |
| 3816 |
\requestedLaTeXdate\relax |
| 3817 |
\let\pkgcls@targetlabel\@empty |
| 3818 |
\def\pkgcls@innerdate{\maxdimen}% |
| 3819 |
\def\pkgcls@mindate{#1}% |
| 3820 |
% \end{macrocode} |
| 3821 |
% If the min-date is after the requested rollback date (if there is |
| 3822 |
% any, i.e., if it is not zero) then we have a conflict and |
| 3823 |
% therefore issue a warning. |
| 3824 |
% \changes{v1.2i}{2018/05/08} |
| 3825 |
% {Make suspicious rollback a warning not error: github issue 43} |
| 3826 |
% \changes{v1.5l}{2024/06/04} |
| 3827 |
% {New argument \cs{pkgcls@ext} (gh/870)} |
| 3828 |
% \begin{macrocode} |
| 3829 |
\ifnum \pkgcls@targetdate > \z@ |
| 3830 |
\ifnum \@parse@version0#1//00\@nil > \pkgcls@targetdate |
| 3831 |
\@latex@warning@no@line{Suspicious rollback/min-date date given\MessageBreak |
| 3832 |
A minimal date of #1 has been specified for |
| 3833 |
\pkgcls@ext\MessageBreak '\pkgcls@name'.\MessageBreak |
| 3834 |
But this is in conflict |
| 3835 |
with a rollback request to \requestedpatchdate} |
| 3836 |
\fi |
| 3837 |
\fi |
| 3838 |
\fi |
| 3839 |
} |
| 3840 |
% \end{macrocode} |
| 3841 |
% Strip off the trailing \texttt{=} and assign the version name to |
| 3842 |
% |\pkgcls@targetlabel|. |
| 3843 |
% \begin{macrocode} |
| 3844 |
\def\pkgcls@parse@date@arg@version#1={% |
| 3845 |
\def\pkgcls@targetlabel{#1}} |
| 3846 |
% \end{macrocode} |
| 3847 |
% \end{macro} |
| 3848 |
% |
| 3849 |
% \begin{macro}{\DeclareRelease} |
| 3850 |
% First argument is the ``name'' of the release and it can be left empty |
| 3851 |
% if one doesn't like to give a name to the release. |
| 3852 |
% The second argument is that from which on this release was |
| 3853 |
% available (or should be used in case of minor updates). |
| 3854 |
% The final argument is the external file name of this release, by |
| 3855 |
% convention this should be |
| 3856 |
% \meta{pkg/cls-name}\texttt{-}\meta{date}\texttt{.}\meta{extension} |
| 3857 |
% but this is not enforced and through this argument one can |
| 3858 |
% overwrite it. |
| 3859 |
% \begin{macrocode} |
| 3860 |
\def\DeclareRelease#1#2#3{% |
| 3861 |
\ifnum\pkgcls@targetdate>\z@ % some sort of rollback request |
| 3862 |
%<*tracerollback> |
| 3863 |
\pkgcls@debug{---\string\DeclareRelease:}% |
| 3864 |
\pkgcls@debug{\@spaces 1: #1}% |
| 3865 |
\pkgcls@debug{\@spaces 2: #2}% |
| 3866 |
\pkgcls@debug{\@spaces 3: #3}% |
| 3867 |
%</tracerollback> |
| 3868 |
% \end{macrocode} |
| 3869 |
% If the date argument |#2| is empty we are dealing with a special |
| 3870 |
% release that should be only accessible via its name; a typical |
| 3871 |
% use case would be a ``beta'' release. So if we are |
| 3872 |
% currently processing a date request we ignore it and otherwise we |
| 3873 |
% check if we can match the name and if so load the corresponding |
| 3874 |
% release file. |
| 3875 |
% \begin{macrocode} |
| 3876 |
\ifx\@nil#2\@nil |
| 3877 |
\ifnum\pkgcls@targetdate=\@ne % named request |
| 3878 |
\def\reserved@a{#1}% |
| 3879 |
\ifx\pkgcls@targetlabel\reserved@a |
| 3880 |
\pkgcls@use@this@release{#3}{}% |
| 3881 |
%<*tracerollback> |
| 3882 |
\else |
| 3883 |
\pkgcls@debug{Label doesn't match}% |
| 3884 |
%</tracerollback> |
| 3885 |
\fi |
| 3886 |
%<*tracerollback> |
| 3887 |
\else |
| 3888 |
\pkgcls@debug{Date request: ignored}% |
| 3889 |
%</tracerollback> |
| 3890 |
\fi |
| 3891 |
\else |
| 3892 |
% \end{macrocode} |
| 3893 |
% If the value of |\pkgcls@targetdate| is greater than 1 (or in |
| 3894 |
% reality greater than something like 19930101) we are dealing with a |
| 3895 |
% rollback request to a specific date. |
| 3896 |
% \begin{macrocode} |
| 3897 |
\ifnum\pkgcls@targetdate>\@ne % a real request |
| 3898 |
% \end{macrocode} |
| 3899 |
% So we parse the date of this release to check if it is before or |
| 3900 |
% after the request date. |
| 3901 |
% \begin{macrocode} |
| 3902 |
\ifnum\@parse@version#2//00\@nil |
| 3903 |
>\pkgcls@targetdate |
| 3904 |
% \end{macrocode} |
| 3905 |
% If it is after we have to distinguish between two cases: If there |
| 3906 |
% was an earlier candidate we use that one because the other is too |
| 3907 |
% late, but if there wasn't one (i.e., if current release is the |
| 3908 |
% oldest that exists) we use it as the best choice. However in |
| 3909 |
% that case something is wrong (as there shouldn't be a rollback to |
| 3910 |
% a date when a package used didn't yet exists). So we make a |
| 3911 |
% complained to the user. |
| 3912 |
% \begin{macrocode} |
| 3913 |
\ifx\pkgcls@candidate\@empty |
| 3914 |
\pkgcls@rollbackdate@error{#2}% |
| 3915 |
\pkgcls@use@this@release{#3}{#2}% |
| 3916 |
\else |
| 3917 |
\pkgcls@use@this@release\pkgcls@candidate |
| 3918 |
\pkgcls@releasedate |
| 3919 |
\fi |
| 3920 |
\else |
| 3921 |
% \end{macrocode} |
| 3922 |
% Otherwise, if the release date of this version is before the |
| 3923 |
% target rollback and we record it as a candidate. But we don't use |
| 3924 |
% it yet as there may be another release which is still before the |
| 3925 |
% target rollback. |
| 3926 |
% \begin{macrocode} |
| 3927 |
\def\pkgcls@candidate{#3}% |
| 3928 |
\def\pkgcls@releasedate{#2}% |
| 3929 |
%<*tracerollback> |
| 3930 |
\pkgcls@debug{New candidate: #3}% |
| 3931 |
%</tracerollback> |
| 3932 |
\fi |
| 3933 |
\else |
| 3934 |
% \end{macrocode} |
| 3935 |
% If we end up in this branch we have a named version request. So |
| 3936 |
% we check if |\pkgcls@targetlabel| matches the current name and if |
| 3937 |
% yes we use this release immediately, otherwise we do nothing as a |
| 3938 |
% later declaration may match it. |
| 3939 |
% \begin{macrocode} |
| 3940 |
\def\reserved@a{#1}% |
| 3941 |
\ifx\pkgcls@targetlabel\reserved@a |
| 3942 |
\pkgcls@use@this@release{#3}{#2}% |
| 3943 |
%<*tracerollback> |
| 3944 |
\else |
| 3945 |
\pkgcls@debug{Label doesn't match}% |
| 3946 |
%</tracerollback> |
| 3947 |
\fi |
| 3948 |
\fi |
| 3949 |
\fi |
| 3950 |
\fi |
| 3951 |
} |
| 3952 |
% \end{macrocode} |
| 3953 |
% \end{macro} |
| 3954 |
% |
| 3955 |
% \begin{macro}{\pkgcls@use@this@release} |
| 3956 |
% If a certain release has been selected (stored in the external |
| 3957 |
% file given in \verb=#1=) we need to input it and afterwards stop |
| 3958 |
% reading the current file. |
| 3959 |
% \begin{macrocode} |
| 3960 |
\def\pkgcls@use@this@release#1#2{% |
| 3961 |
% \end{macrocode} |
| 3962 |
% Before that we record the selection made inside the transcript. |
| 3963 |
% \begin{macrocode} |
| 3964 |
\pkgcls@show@selection{#1}{#2}% |
| 3965 |
% \end{macrocode} |
| 3966 |
% We then set the |\pkgcls@targetdate| to zero so that any |
| 3967 |
% |\DeclareRelease| or |\DeclareCurrentRelease| in the file we |
| 3968 |
% now load are bypassed\footnote{The older release may also have |
| 3969 |
% such declarations inside if it was a simply copy of the |
| 3970 |
% \texttt{.sty} or \texttt{.cls} file current at that |
| 3971 |
% date. Removing these declarations would make the file load a tiny |
| 3972 |
% bit faster, but this way it works in any case.} and then we |
| 3973 |
% finally load the correct release. |
| 3974 |
% |
| 3975 |
% After loading that file we need to stop reading the current file |
| 3976 |
% so we issue |\endinput|. Note that the |\relax| before that is |
| 3977 |
% essential to ensure that the |\endinput| is only happening after |
| 3978 |
% the file has been fully processed, otherwise it would act after the |
| 3979 |
% first line of the |\@@input|! |
| 3980 |
% \changes{v1.2e}{2018/03/24} |
| 3981 |
% {Use full file name for old release} |
| 3982 |
% \changes{v1.5m}{2024/08/03} |
| 3983 |
% {Add selected release to the file list (gh/1413)} |
| 3984 |
% \begin{macrocode} |
| 3985 |
\pkgcls@targetdate\z@ |
| 3986 |
\@addtofilelist{#1}% |
| 3987 |
\@@input #1\relax |
| 3988 |
\endinput |
| 3989 |
} |
| 3990 |
% \end{macrocode} |
| 3991 |
% \end{macro} |
| 3992 |
% |
| 3993 |
% \begin{macro}{\pkgcls@show@selection} |
| 3994 |
% This command records what selection was made. As that is needed |
| 3995 |
% in two places (and it is rather lengthy) it was placed in a |
| 3996 |
% separate command. The first argument is the name of the external |
| 3997 |
% file that is being loaded and is only needed for debugging. The |
| 3998 |
% second argument is the date that corresponds to this file and it |
| 3999 |
% is used as part of the message. |
| 4000 |
% \begin{macrocode} |
| 4001 |
\def\pkgcls@show@selection#1#2{% |
| 4002 |
%<*tracerollback> |
| 4003 |
\pkgcls@debug{Result: use #1}% |
| 4004 |
%</tracerollback> |
| 4005 |
\GenericInfo |
| 4006 |
{\@spaces\@spaces\space}{Rollback for |
| 4007 |
\@cls@pkg\space'\@currname' requested -> |
| 4008 |
\ifnum\pkgcls@targetdate>\@ne |
| 4009 |
date |
| 4010 |
\ifnum\requestedLaTeXdate=\pkgcls@targetdate |
| 4011 |
\requestedpatchdate |
| 4012 |
\else |
| 4013 |
\expandafter\@gobble\pkgcls@arg |
| 4014 |
\fi.\MessageBreak |
| 4015 |
% \end{macrocode} |
| 4016 |
% Instead of ``best approximation'' we could say that we have been |
| 4017 |
% able to exactly match the date (if it is exact), but that would |
| 4018 |
% mean extra tests without much gain, so not done. |
| 4019 |
% \begin{macrocode} |
| 4020 |
Best approximation is |
| 4021 |
\else |
| 4022 |
version '\pkgcls@targetlabel'.\MessageBreak |
| 4023 |
This corresponds to |
| 4024 |
\fi |
| 4025 |
\ifx\@nil#2\@nil |
| 4026 |
a special release% |
| 4027 |
\else |
| 4028 |
the release introduced on #2% |
| 4029 |
\fi |
| 4030 |
\@gobble}% |
| 4031 |
} |
| 4032 |
% \end{macrocode} |
| 4033 |
% \end{macro} |
| 4034 |
% |
| 4035 |
% \begin{macro}{\pkgcls@rollbackdate@error} |
| 4036 |
% This is called if the requested rollback date is earlier than the |
| 4037 |
% earliest known release of a package or class. |
| 4038 |
% |
| 4039 |
% A similar error is given if global rollback date and min-date on |
| 4040 |
% a specific package conflict with each other, but that case is |
| 4041 |
% happens only once so it is inlined. |
| 4042 |
% \changes{v1.3u}{2020/11/09}{Change help text because the package may have |
| 4043 |
% existed then --- there is just no rollback data (gh/423).} |
| 4044 |
% \begin{macrocode} |
| 4045 |
\def\pkgcls@rollbackdate@error#1{% |
| 4046 |
\@latex@error{Suspicious rollback date given}% |
| 4047 |
{The \@cls@pkg\space'\@currname' has no rollback data |
| 4048 |
before #1 which\MessageBreak |
| 4049 |
is after your requested rollback date --- so |
| 4050 |
something may be wrong here.\MessageBreak |
| 4051 |
Continue and we use the earliest known release.}} |
| 4052 |
% \end{macrocode} |
| 4053 |
% \end{macro} |
| 4054 |
% |
| 4055 |
% |
| 4056 |
% \begin{macro}{\DeclareCurrentRelease} |
| 4057 |
% This declares the date (and possible name) of the current version |
| 4058 |
% of a package or class. |
| 4059 |
% \begin{macrocode} |
| 4060 |
\def\DeclareCurrentRelease#1#2{% |
| 4061 |
% \end{macrocode} |
| 4062 |
% First we test if |\pkgcls@targetdate| is greater than zero, |
| 4063 |
% otherwise this code is bypassed (as there is no rollback |
| 4064 |
% request). |
| 4065 |
% \begin{macrocode} |
| 4066 |
\ifnum\pkgcls@targetdate>\z@ % some sort of rollback request |
| 4067 |
%<*tracerollback> |
| 4068 |
\pkgcls@debug{---DeclareCurrentRelease}% |
| 4069 |
\pkgcls@debug{ 1: #1}% |
| 4070 |
\pkgcls@debug{ 2: #2}% |
| 4071 |
%</tracerollback> |
| 4072 |
% \end{macrocode} |
| 4073 |
% If the value is greater than 1 we have to deal with a date |
| 4074 |
% request, so we parse |#2| as a date and compare it with |
| 4075 |
% |\pkgcls@targetdate|. |
| 4076 |
% \begin{macrocode} |
| 4077 |
\ifnum\pkgcls@targetdate>\@ne % a date request |
| 4078 |
\ifnum\@parse@version#2//00\@nil |
| 4079 |
>\pkgcls@targetdate |
| 4080 |
% \end{macrocode} |
| 4081 |
% If it is greater that means the release date if this file is |
| 4082 |
% later than the requested rollback date. Again we have two cases: |
| 4083 |
% If there was a previous candidate release we use that one as the |
| 4084 |
% current release is too young, but if there wasn't we have to use |
| 4085 |
% this release nevertheless as there isn't any alternative. |
| 4086 |
% |
| 4087 |
% However this case can only happen if there is a |
| 4088 |
% |\DeclareCurrentRelease| but no declared older releases (so |
| 4089 |
% basically the use of the declaration is a bit dubious). |
| 4090 |
% \begin{macrocode} |
| 4091 |
\ifx\pkgcls@candidate\@empty |
| 4092 |
\pkgcls@rollbackdate@error{#2}% |
| 4093 |
\else |
| 4094 |
\pkgcls@use@this@release\pkgcls@candidate |
| 4095 |
\pkgcls@releasedate |
| 4096 |
\fi |
| 4097 |
% \end{macrocode} |
| 4098 |
% Otherwise the current file is the right release, so we record that |
| 4099 |
% in the transcript and then carry on. |
| 4100 |
% \begin{macrocode} |
| 4101 |
\else |
| 4102 |
\pkgcls@show@selection{current version}{#2}% |
| 4103 |
\fi |
| 4104 |
\else % a label request |
| 4105 |
% \end{macrocode} |
| 4106 |
% Otherwise we have a rollback request to a named version so we |
| 4107 |
% check if that fits the current name and if not give an error as |
| 4108 |
% this was the last possible opportunity. |
| 4109 |
% \begin{macrocode} |
| 4110 |
\def\reserved@a{#1}% |
| 4111 |
\ifx\pkgcls@targetlabel\reserved@a |
| 4112 |
\pkgcls@show@selection{current version}{#2}% |
| 4113 |
\else |
| 4114 |
\@latex@error{Requested version '\pkgcls@targetlabel' for |
| 4115 |
\@cls@pkg\space'\@currname' is unknown}\@ehc |
| 4116 |
\fi |
| 4117 |
\fi |
| 4118 |
\fi |
| 4119 |
} |
| 4120 |
% \end{macrocode} |
| 4121 |
% \end{macro} |
| 4122 |
% |
| 4123 |
% |
| 4124 |
% \begin{macro}{\IfTargetDateBefore} |
| 4125 |
% This enables a simple form of conditional code inside a class or |
| 4126 |
% package file. If there is a date request and the request date is |
| 4127 |
% earlier than the first argument the code in the second argument |
| 4128 |
% is processed otherwise the code in the third argument is |
| 4129 |
% processed. If there was no date request then we also execute the |
| 4130 |
% third argument, i.e., we will get the ``latest'' version of the |
| 4131 |
% file. |
| 4132 |
% |
| 4133 |
% Most often the second argument (before-date-code) will be empty. |
| 4134 |
% \begin{macrocode} |
| 4135 |
\DeclareRobustCommand\IfTargetDateBefore[1]{% |
| 4136 |
\ifnum\pkgcls@innerdate <% |
| 4137 |
\expandafter\@parse@version\expandafter0#1//00\@nil |
| 4138 |
\typeout{Exclude code introduced on #1}% |
| 4139 |
\expandafter\@firstoftwo |
| 4140 |
\else |
| 4141 |
\typeout{Include code introduced on #1}% |
| 4142 |
\expandafter\@secondoftwo |
| 4143 |
\fi |
| 4144 |
} |
| 4145 |
% \end{macrocode} |
| 4146 |
% \end{macro} |
| 4147 |
% |
| 4148 |
% \begin{macrocode} |
| 4149 |
%</2ekernel|latexreleasefirst> |
| 4150 |
% \end{macrocode} |
| 4151 |
% |
| 4152 |
% |
| 4153 |
% \section{After Preamble} |
| 4154 |
% Finally we declare a package that allows all the commands declared |
| 4155 |
% above to be |\@onlypreamble| to be used after |\begin{document}|. |
| 4156 |
% \changes{v0.3f}{1994/03/16} |
| 4157 |
% {Add pkgindoc package} |
| 4158 |
% \changes{v1.1a}{1998/03/21} |
| 4159 |
% {Correct to new onlypreamble command list} |
| 4160 |
% \begin{macrocode} |
| 4161 |
%<*afterpreamble> |
| 4162 |
\NeedsTeXFormat{LaTeX2e} |
| 4163 |
\ProvidesPackage{pkgindoc} |
| 4164 |
[2020-08-08 v1.3m Package Interface in Document (DPC)] |
| 4165 |
\def\reserved@a#1\do\@classoptionslist#2\do\filec@ntents#3\relax{% |
| 4166 |
\gdef\@preamblecmds{#1#3}} |
| 4167 |
\expandafter\reserved@a\@preamblecmds\relax |
| 4168 |
%</afterpreamble> |
| 4169 |
% \end{macrocode} |
| 4170 |
% |
| 4171 |
% \Finale |