diff options
author | Karl Berry <karl@freefriends.org> | 2024-06-02 20:26:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-06-02 20:26:39 +0000 |
commit | b0c666dbd315af330424f5d34739d7d4134d0c17 (patch) | |
tree | 0b0a60149691348e9cea719bb797b2c1587adfc6 /Master/texmf-dist/source/latex/base/ltclass.dtx | |
parent | 5634f0473d32ab71b4fbaaf0a6870737c2cc6dcb (diff) |
latex2e (2jun24)
git-svn-id: svn://tug.org/texlive/trunk@71408 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltclass.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltclass.dtx | 160 |
1 files changed, 142 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltclass.dtx b/Master/texmf-dist/source/latex/base/ltclass.dtx index 139eb7a1a72..35bbb8a55a4 100644 --- a/Master/texmf-dist/source/latex/base/ltclass.dtx +++ b/Master/texmf-dist/source/latex/base/ltclass.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltclass.dtx} - [2023/04/14 v1.5h LaTeX Kernel (Class & Package Interface)] + [2024/04/10 v1.5k LaTeX Kernel (Class & Package Interface)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltclass.dtx} @@ -390,7 +390,7 @@ % package files.) % % |\DeclareOption*{\PassOptionsToPackage{\CurrentOption}|^^A -% |{|\meta{pkg-name}|}|\\ +% |{|\meta{pkg-name}|}}|\\ % Handle the current option by passing it on to the package % \meta{pkg-name}, which will presumably be loaded via % |\RequirePackage| later in the file. This is useful for building @@ -1075,19 +1075,20 @@ % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{2021/11/15}% -%<latexrelease> {\IfPackageLoadedtTF}{Test package loading}% +%<latexrelease>\IncludeInRelease{2024/06/01}% +%<latexrelease> {\IfPackageLoadedTF}{Test package loading}% \let \IfPackageLoadedTF \@ifpackageloaded \let \IfClassLoadedTF \@ifclassloaded \let \IfPackageLoadedWithOptionsTF \@ifpackagewith \let \IfClassLoadedWithOptionsTF \@ifclasswith % \end{macrocode} -% For rollback pretend it was available since the beginning of dawn. +% For rollback/rollforward pretend everything was available since +% the beginning of dawn. % \begin{macrocode} %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}% -%<latexrelease> {\IfPackageLoadedtTF}{Test package loading}% +%<latexrelease> {\IfPackageLoadedTF}{Test package loading}% %<latexrelease> %<latexrelease>\let \IfPackageLoadedTF \@ifpackageloaded %<latexrelease>\let \IfClassLoadedTF \@ifclassloaded @@ -1102,6 +1103,99 @@ % % % +% \begin{macro}{ +% \IfPackageLoadedT,\IfPackageLoadedF, +% \IfPackageAtLeastT,\IfPackageAtLeastF, +% \IfClassAtLeastT,\IfClassAtLeastF, +% \IfFileAtLeastT,\IfFileAtLeastF, +% \IfFormatAtLeastT,\IfFormatAtLeastF, +% \IfPackageLoadedWithOptionsT,\IfPackageLoadedWithOptionsF, +% \IfClassLoadedT,\IfClassLoadedF, +% \IfClassLoadedWithOptionsF,\IfClassLoadedWithOptionTF +% } +% A few more conditionals for convenience +% \changes{v1.5k}{2024/04/10}{Provide T and F conditionals not just TF +% (gh/1262)} +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2024/06/01}% +%<latexrelease> {\IfPackageLoadedT}{More conditionals}% +\def\IfPackageLoadedT #1#2{\IfPackageLoadedTF{#1}{#2}{}} +\def\IfPackageLoadedF #1{\IfPackageLoadedTF{#1}{}} +\def\IfClassLoadedT #1#2{\IfClassLoadedTF{#1}{#2}{}} +\def\IfClassLoadedF #1{\IfClassLoadedTF{#1}{}} +\def\IfPackageAtLeastT#1#2#3{\IfPackageAtLeastTF{#1}{#2}{#3}{}} +\def\IfPackageAtLeastF #1#2{\IfPackageAtLeastTF{#1}{#2}{}} +\def\IfClassAtLeastT #1#2#3{\IfClassAtLeastTF{#1}{#2}{#3}{}} +\def\IfClassAtLeastF #1#2{\IfClassAtLeastTF{#1}{#2}{}} +\def\IfFileAtLeastT #1#2#3{\IfFileAtLeastTF{#1}{#2}{#3}{}} +\def\IfFileAtLeastF #1#2{\IfFileAtLeastTF{#1}{#2}{}} +\def\IfFormatAtLeastT #1#2{\IfFormatAtLeastTF{#1}{#2}{}} +\def\IfFormatAtLeastF #1{\IfFormatAtLeastTF{#1}{}} +\def\IfPackageLoadedWithOptionsT #1#2#3{\IfPackageLoadedWithOptionsTF{#1}{#2}{#3}{}} +\def\IfPackageLoadedWithOptionsF #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}{}} +\def\IfClassLoadedWithOptionsT #1#2#3{\IfClassLoadedWithOptionsTF{#1}{#2}{#3}{}} +\def\IfClassLoadedWithOptionsF #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}{}} +% \end{macrocode} +% +% \begin{macro}{\IfFileLoadedTF,\IfFileLoadedT,\IfFileLoadedF} +% These three commands haven't been there at all in the past. +% \changes{v1.5k}{2024/04/10}{Provide \cs{IfFileLoadedTF} and variants +% (gh/1222)} +% \begin{macrocode} +\def\IfFileLoadedTF#1{% + \expandafter\ifx\csname ver@#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} +\def\IfFileLoadedT#1#2{\IfFileLoadedTF{#1}{#2}{}} +\def\IfFileLoadedF #1{\IfFileLoadedTF{#1}{}} +% \end{macrocode} +% For rollback/rollforward pretend everything was available since +% the beginning of dawn. +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\IfPackageLoadedT}{More conditionals}% +%<latexrelease> +%<latexrelease>\def\IfPackageLoadedT #1#2{\IfPackageLoadedTF{#1}{#2}{}} +%<latexrelease>\def\IfPackageLoadedF #1{\IfPackageLoadedTF{#1}{}} +%<latexrelease>\def\IfClassLoadedT #1#2{\IfClassLoadedTF{#1}{#2}{}} +%<latexrelease>\def\IfClassLoadedF #1{\IfClassLoadedTF{#1}{}} +%<latexrelease>\def\IfPackageAtLeastT#1#2#3{\IfPackageAtLeastTF{#1}{#2}{#3}{}} +%<latexrelease>\def\IfPackageAtLeastF #1#2{\IfPackageAtLeastTF{#1}{#2}{}} +%<latexrelease>\def\IfClassAtLeastT #1#2#3{\IfClassAtLeastTF{#1}{#2}{#3}{}} +%<latexrelease>\def\IfClassAtLeastF #1#2{\IfClassAtLeastTF{#1}{#2}{}} +%<latexrelease>\def\IfFileAtLeastT #1#2#3{\IfFileAtLeastTF{#1}{#2}{#3}{}} +%<latexrelease>\def\IfFileAtLeastF #1#2{\IfFileAtLeastTF{#1}{#2}{}} +%<latexrelease>\def\IfFormatAtLeastT #1#2{\IfFormatAtLeastTF{#1}{#2}{}} +%<latexrelease>\def\IfFormatAtLeastF #1{\IfFormatAtLeastTF{#1}{}} +%<latexrelease>\def\IfPackageLoadedWithOptionsT #1#2#3{\IfPackageLoadedWithOptionsTF{#1}{#2}{#3}{}} +%<latexrelease>\def\IfPackageLoadedWithOptionsF #1#2{\IfPackageLoadedWithOptionsTF{#1}{#2}{}} +%<latexrelease>\def\IfClassLoadedWithOptionsT #1#2#3{\IfClassLoadedWithOptionsTF{#1}{#2}{#3}{}} +%<latexrelease>\def\IfClassLoadedWithOptionsF #1#2{\IfClassLoadedWithOptionsTF{#1}{#2}{}} +%<latexrelease> +%<latexrelease>\def\IfFileLoadedTF#1{% +%<latexrelease> \expandafter\ifx\csname ver@#1\endcsname\relax +%<latexrelease> \expandafter\@secondoftwo +%<latexrelease> \else +%<latexrelease> \expandafter\@firstoftwo +%<latexrelease> \fi} +%<latexrelease>\def\IfFileLoadedT#1#2{\IfFileLoadedTF{#1}{#2}{}} +%<latexrelease>\def\IfFileLoadedF #1{\IfFileLoadedTF{#1}{}} +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% % \begin{macro}{\ProvidesPackage} % Checks that the current filename is correct, and defines % |\ver@filename|. @@ -1327,11 +1421,11 @@ % \changes{v1.4c}{2021/06/06} % {apply \cs{expandafter} to raw options for gh/580} % \begin{macrocode} - \@ifundefined{@raw@opt@#3.#1}% - {\expandafter\gdef\csname @raw@opt@#3.#1\expandafter\endcsname - \expandafter{#2}}% - {\expandafter\g@addto@macro\csname @raw@opt@#3.#1\expandafter\endcsname - \expandafter{\expandafter,#2}}% + \@ifundefined{@raw@opt@#3.#1}% + {\expandafter\gdef\csname @raw@opt@#3.#1\expandafter\endcsname + \expandafter{#2}}% + {\expandafter\g@addto@macro\csname @raw@opt@#3.#1\expandafter\endcsname + \expandafter{\expandafter,#2}}% } %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease @@ -1950,12 +2044,34 @@ % \end{macro} % % \begin{macro}{\@fileswithoptions} +% \changes{v1.5i}{2024/01/30}{Test group level} % The common part of |\documentclass| and |\usepackage|. % \begin{macrocode} +%</2ekernel> +%<latexrelease>\IncludeInRelease{2024/06/01}% +%<latexrelease> {\@fileswithoptions}{Check Group}% +%<*2ekernel|latexrelease> \def\@fileswithoptions#1{% + \ifnum\currentgrouplevel>\z@ + \@latex@error + {Loading a class or package in a group}% + {Classes and packages should only be loaded at the top level}% + \fi \@ifnextchar[%] {\@fileswith@ptions#1}% {\@fileswith@ptions#1[]}} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@fileswithoptions}{Check Group}% +%<latexrelease>\def\@fileswithoptions#1{% +%<latexrelease> \@ifnextchar[%] +%<latexrelease> {\@fileswith@ptions#1}% +%<latexrelease> {\@fileswith@ptions#1[]}} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \begin{macrocode} \@onlypreamble\@fileswithoptions % \end{macrocode} % @@ -2221,9 +2337,17 @@ % \end{macrocode} % \changes{v1.5d}{2022/10/10}{Use \cs{protected@edef}.} % \begin{macrocode} - \expandafter\protected@edef\csname opt@\@currname.\@currext\endcsname + \expandafter\protected@edef + \csname opt@\@currname.\@currext\endcsname {\zap@space#2 \@empty}% - \@namedef{@raw@opt@\@currname.\@currext}{#2}% +% \end{macrocode} +% \changes{v1.5j}{2024/03/22} +% {Apply one-step expansion to raw option list, +% to be consistent with change for gh/580 (gh/1298).} +% \begin{macrocode} + \expandafter\def + \csname @raw@opt@\@currname.\@currext\expandafter\endcsname + \expandafter{#2}% \@nameuse{opt@handler@\@currname.\@currext}% }% }% @@ -2624,8 +2748,8 @@ % % Allow code to be saved to be executed at specific later times. % -% Save things in macros, I considered using toks registers, (and -% |\addto@hook| from the NFSS code, that would require stacking the +% Here we save things in macros. I considered using toks registers (and +% |\addto@hook| from the NFSS code), but that would require stacking the % contents in the case of required packages, so just generate a new % macro for each package. % \begin{macro}{\@begindocumenthook} @@ -2997,7 +3121,7 @@ \let\do\@makeother\dospecials% % \end{macrocode} % If there are active characters in the upper half (e.g., from -% \texttt{inputenc} there would be confusion so we render everything +% \texttt{inputenc}) there would be confusion so we render everything % harmless. % \changes{v1.2f}{2018/03/27} % {Use full file name for old release} @@ -3585,7 +3709,7 @@ % and therefore we can now test its value. If the value is zero we % assume that the remaining argument string represents a version % and change |\pkgcls@targetdate| and set |\pkgcls@targetlabel| to -% the version name (after stripping off the trailing \texttt{=}. +% the version name (after stripping off the trailing \texttt{=}). % \begin{macrocode} \ifnum \pkgcls@targetdate=\z@ \pkgcls@targetdate\@ne @@ -3695,7 +3819,7 @@ % late, but if there wasn't one (i.e., if current release is the % oldest that exists) we use it as the best choice. However in % that case something is wrong (as there shouldn't be a rollback to -% a date where a package used doesn't yet exists. So we make a +% a date when a package used didn't yet exists). So we make a % complained to the user. % \begin{macrocode} \ifx\pkgcls@candidate\@empty |