From a4ccc84b5ea15905a51f24c56989a29267cfd949 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 13 Nov 2021 03:01:22 +0000 Subject: CTAN sync 202111130301 --- macros/latex/base/ltclass.dtx | 159 +++++++++++++++++++++++++++++------------- 1 file changed, 112 insertions(+), 47 deletions(-) (limited to 'macros/latex/base/ltclass.dtx') diff --git a/macros/latex/base/ltclass.dtx b/macros/latex/base/ltclass.dtx index 2ab3081bf7..06e0f437af 100644 --- a/macros/latex/base/ltclass.dtx +++ b/macros/latex/base/ltclass.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltclass.dtx} - [2021/06/06 v1.4c LaTeX Kernel (Class & Package Interface)] + [2021/08/25 v1.4f LaTeX Kernel (Class & Package Interface)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltclass.dtx} @@ -68,6 +68,7 @@ % \changes{v1.0z}{1998/03/21}{Added to documentation of filecontents} % \changes{v1.1c}{1998/08/17}{(RmS) Minor documentation fixes.} % \changes{v1.3o}{2020/08/21}{Integration of new hook management interface} +% \changes{v1.4f}{2021/08/25}{Standardise generic hook names (gh/648)} % % % \section{Introduction} @@ -311,27 +312,49 @@ % default option handler, which is not used for |landscape| as that % option is explicitly declared. % +% \DescribeMacro\IfPackageLoadedTF +% \DescribeMacro\IfClassLoadedTF % \DescribeMacro\@ifpackageloaded -% To find out if a package has already been loaded, use\\ % \DescribeMacro\@ifclassloaded -% |\@ifpackageloaded{|\meta{package}|}{|\meta{true}|}{|\meta{false}|}|. -% +% To find out if a package has already been loaded, use +% \begin{quote} +% |\IfPackageLoadedTF{|\meta{package}|}{|\meta{true}|}{|\meta{false}|}|\\ +% \end{quote} +% or the old name \cs{@ifpackageloaded}. +% +% \DescribeMacro\IfPackageAtLeastTF +% \DescribeMacro\IfClassAtLeastTF % \DescribeMacro\@ifpackagelater +% \DescribeMacro\@ifclasslater % \changes{v1.1i}{2013/07/07}{Correctly describe how the date in % \cs{@ifpackagelater} is used} % To find out if a package has already been loaded with a version % equal to or more -% recent than \meta{version}, use\\ -% \DescribeMacro\@ifclasslater -% |\@ifpackagelater{|\meta{package}|}{|\meta{version}|}{|^^A -% \meta{true}|}{|\meta{false}|}|. -% +% recent than \meta{date}, use +% \begin{quote} +% |\IfPackageAtLeastTF{|\meta{package}|}{|\meta{date}|}{|^^A +% \meta{true}|}{|\meta{false}|}| +% \end{quote} +% or the old name \cs{@ifpackagelater}. + +% \DescribeMacro\IfFormatAtLeastTF +% To test the format date use +% \begin{quote} +% |\IfFormatAtLeastTF{|\meta{date}|}{|^^A +% \meta{true}|}{|\meta{false}|}| +% \end{quote} +% +% \DescribeMacro\IfPackageLoadedWithOptionsTF +% \DescribeMacro\IfClassLoadedWithOptionsTF % \DescribeMacro\@ifpackagewith +% \DescribeMacro\@ifclasswith % To find out if a package has already been loaded with at least the % options \meta{options}, use -% \DescribeMacro\@ifclasswith -% |\@ifpackagewith{|\meta{package}|}{|\meta{options}|}{|^^A -% \meta{true}|}{|\meta{false}|}|. +% \begin{quote} +% |\IfPackageLoadedWithOptionsTF{|\meta{package}|}{|\meta{options}|}{|^^A +% \meta{true}|}{|\meta{false}|}| +% \end{quote} +% or the old name \cs{@ifpackagewith}. % % There exists one package that can't be tested with the above % commands: the \texttt{fontenc} package pretends that it was never @@ -499,9 +522,10 @@ % \begin{macro}{\@classoptionslist} % List of options of the main class. % \changes{v1.0u}{1996/07/26}{made only preamble} +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \let\@classoptionslist\relax -\@onlypreamble\@classoptionslist +%\@onlypreamble\@classoptionslist % \end{macrocode} % \end{macro} % @@ -517,9 +541,10 @@ % \changes{v1.0u}{1996/07/26}{made only preamble} % List of options of the main class that haven't been declared or % loaded as class option files. +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \let\@unusedoptionlist\@empty -\@onlypreamble\@unusedoptionlist +%\@onlypreamble\@unusedoptionlist % \end{macrocode} % \end{macro} % @@ -571,11 +596,10 @@ % \begin{macro}{\@clsextension} % \begin{macro}{\@pkgextension} % The two possible values of |\@currext|. +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \def\@clsextension{cls} \def\@pkgextension{sty} -\@onlypreamble\@clsextension -\@onlypreamble\@pkgextension % \end{macrocode} % \end{macro} % \end{macro} @@ -811,10 +835,11 @@ % % \begin{macro}{\@ptionlist} % Returns the option list of the file. +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \def\@ptionlist#1{% \@ifundefined{opt@#1}\@empty{\csname opt@#1\endcsname}} -\@onlypreamble\@ptionlist +%\@onlypreamble\@ptionlist % \end{macrocode} % \end{macro} % @@ -824,11 +849,10 @@ % Checks to see whether a file has been loaded. % \changes{v0.2t}{1994/01/18} % {Fix typo \cs{@pkgetension}} +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \def\@ifpackageloaded{\@ifl@aded\@pkgextension} \def\@ifclassloaded{\@ifl@aded\@clsextension} -\@onlypreamble\@ifpackageloaded -\@onlypreamble\@ifclassloaded % \end{macrocode} % % \begin{macrocode} @@ -838,11 +862,12 @@ \else \expandafter\@firstoftwo \fi} -\@onlypreamble\@ifl@aded % \end{macrocode} % \end{macro} % \end{macro} % +% +% % \begin{macro}{\@ifpackagelater} % \begin{macro}{\@ifclasslater} % |\@ifpackagelater{|\meta{name}|}{YYYY/MM/DD}{|\meta{true @@ -852,17 +877,17 @@ % A better name for it would therefore been % |\@ifpackagelaterorequal| but it is in use for more than 30 % years, so \ldots +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \def\@ifpackagelater{\@ifl@ter\@pkgextension} \def\@ifclasslater{\@ifl@ter\@clsextension} -\@onlypreamble\@ifpackagelater -\@onlypreamble\@ifclasslater % \end{macrocode} % \end{macro} % \end{macro} % % % +% % \begin{macro}{\IfPackageAtLeastTF} % \begin{macro}{\IfClassAtLeastTF} % \begin{macro}{\IfFormatAtLeastTF} @@ -870,6 +895,7 @@ % code}|}{|\meta{false code}|}| % Test if the format is later or equal to the given date. % \changes{v1.3k}{2020/04/07}{Macro added; also in rollback (gh/168)} +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} % %<*2ekernel|latexrelease> @@ -878,9 +904,6 @@ \def\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} \let\IfPackageAtLeastTF\@ifpackagelater \let\IfClassAtLeastTF\@ifclasslater -\@onlypreamble\IfFormatAtLeastTF -\@onlypreamble\IfPackageAtLeastTF -\@onlypreamble\IfClassAtLeastTF % \end{macrocode} % For rollback pretend it was available since the beginning of dawn. % \begin{macrocode} @@ -899,11 +922,11 @@ % \end{macro} % % \begin{macro}{\@ifl@ter} +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \def\@ifl@ter#1#2{% \expandafter\@ifl@t@r \csname ver@#2.#1\endcsname} -\@onlypreamble\@ifl@ter % % \end{macrocode} % @@ -942,9 +965,6 @@ %<*2ekernel> % \end{macrocode} % -% \begin{macrocode} -\@onlypreamble\@ifl@t@r -% \end{macrocode} % \end{macro} % % \changes{v1.1j}{2016/06/20} @@ -974,17 +994,15 @@ % |\@ifpackagewith{|\meta{name}|}{|\meta{option-list}|}| % Checks that \meta{option-list} is a subset of the options % \textbf{with} which \meta{name} was loaded. +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} \def\@ifpackagewith{\@if@ptions\@pkgextension} \def\@ifclasswith{\@if@ptions\@clsextension} -\@onlypreamble\@ifpackagewith -\@onlypreamble\@ifclasswith % \end{macrocode} % % \begin{macrocode} \def\@if@ptions#1#2{% \@expandtwoargs\@if@pti@ns{\@ptionlist{#2.#1}}} -\@onlypreamble\@if@ptions % \end{macrocode} % % Probably shouldn't use |\CurrentOption| here\ldots (changed to @@ -993,6 +1011,7 @@ % {Add extra ,s so `two' is not matched with `twocolumn'} % \changes{v1.1i}{2011/08/19} % {Re-jig definition after more stringent \cs{in@} test.} +% \changes{v1.4e}{2021/07/19}{Drop \cs{@onlypreamble}} % \begin{macrocode} % %\IncludeInRelease{2017/01/01}% @@ -1038,12 +1057,45 @@ %<*2ekernel> % \end{macrocode} % -% \begin{macrocode} -\@onlypreamble\@if@pti@ns -% \end{macrocode} % \end{macro} % \end{macro} % +% +% +% +% \begin{macro}{\IfPackageLoadedTF,\IfPackageLoadedWithOptionsTF, +% \IfClassLoadedTF,\IfClassLoadedWithOptionsTF} +% More public names for the commands already available for a long time. +% \begin{macrocode} +% +%<*2ekernel|latexrelease> +%\IncludeInRelease{2021/11/15}% +% {\IfPackageLoadedtTF}{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. +% \begin{macrocode} +% +%\EndIncludeInRelease +%\IncludeInRelease{0000/00/00}% +% {\IfPackageLoadedtTF}{Test package loading}% +% +%\let \IfPackageLoadedTF \@ifpackageloaded +%\let \IfClassLoadedTF \@ifclassloaded +%\let \IfPackageLoadedWithOptionsTF \@ifpackagewith +%\let \IfClassLoadedWithOptionsTF \@ifclasswith +% +%\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \end{macro} +% +% +% +% % \begin{macro}{\ProvidesPackage} % Checks that the current filename is correct, and defines % |\ver@filename|. @@ -1979,8 +2031,9 @@ \ifx\@nnil##1\@nnil\else % \end{macrocode} % +% \changes{v1.4d}{2021/07/12}{add \cs{unexpanded}} % \begin{macrocode} - \noexpand\@onefilewithoptions##1[{#2}][{#4}]% + \noexpand\@onefilewithoptions##1[{\unexpanded{#2}}][{#4}]% \noexpand\@pkgextension \fi \expandafter\reserved@b @@ -2289,7 +2342,7 @@ % \changes{v1.3u}{2020/11/20} % {Copy option list to the requested package.} % \changes{v1.4c}{2021/06/06} -% {Copy raw raw options for gh/580} +% {Copy raw options for gh/580} % \begin{macrocode} \expandafter\let \csname opt@\@currpkg@reqd\expandafter\endcsname @@ -2309,15 +2362,17 @@ % package otherwise, if it is \cs{@clsextension}, a class, so % depending on that we execute different hooks. If the extension is % neither, then it is another type of file without special hooks. +% \changes{v1.4e}{2021/07/23}{Make class/name/before a one-time hook} +% \changes{v1.4e}{2021/07/23}{Make package/name/before a one-time hook} % \begin{macrocode} %----------------------------------------- \ifx\@currext\@pkgextension \UseHook{package/before}% - \UseHook{package/before/\@currname}% + \UseOneTimeHook{package/\@currname/before}% \else \ifx\@currext\@clsextension \UseHook{class/before}% - \UseHook{class/before/\@currname}% + \UseOneTimeHook{class/\@currname/before}% \fi \fi % \end{macrocode} @@ -2376,27 +2431,35 @@ % \end{macrocode} % And same procedure, James, when we are finished loading, except % that the hook order is now reversed. +% \changes{v1.4e}{2021/07/23}{Make class/name/after a one-time hook} +% \changes{v1.4e}{2021/07/23}{Make package/name/after a one-time hook} % \begin{macrocode} %----------------------------------------- \ifx\@currext\@pkgextension - \UseHook{package/after/\@currname}% + \UseOneTimeHook{package/\@currname/after}% \UseHook{package/after}% \else \ifx\@currext\@clsextension - \UseHook{class/after/\@currname}% + \UseOneTimeHook{class/\@currname/after}% \UseHook{class/after}% \fi \fi}% %----------------------------------------- \@ifl@aded\@currext\@currname{}{\reserved@a}} % \end{macrocode} -% \end{macro} -% +% +% \changes{v1.4f}{2021/08/25}{Declare non-generic package and class hooks} +% Now declare the non-generic package and class hooks used above: % \begin{macrocode} -% +\NewHook{package/before} +\NewHook{class/before} +\NewReversedHook{package/after} +\NewReversedHook{class/after} % \end{macrocode} -% +% \end{macro} +% % \begin{macrocode} +% %\EndIncludeInRelease %\IncludeInRelease{0000/00/00}% % {\@onefilewithoptions}{Hooks and unused options issue}% @@ -2771,11 +2834,12 @@ % \end{macrocode} % % Lua\TeX\ has more writes (and 18 is safe here). +% \changes{v1.4b}{2021/06/09}{Use \cs{@latex@note@no@line} to display the information} % \begin{macrocode} \chardef\reserved@c\ifx\directlua\@undefined 15 \else 127 \fi% \openin\@inputcheck\q@curr@file \space % \ifeof\@inputcheck% - \@latex@warning@no@line% + \@latex@note@no@line% {Writing file `\@currdir\@curr@file'}% % \end{macrocode} % @@ -2789,9 +2853,10 @@ % % \changes{v1.0y}{1997/10/10} % {Use \cs{@gobbletwo}} +% \changes{v1.4b}{2021/06/09}{Use \cs{@latex@note@no@line} to display the information} % \begin{macrocode} \if@filesw% - \@latex@warning@no@line% + \@latex@note@no@line% {File `\@curr@file' already \filec@ntents@where.\MessageBreak% Not generating it from this source}% \let\write\@gobbletwo% -- cgit v1.2.3