| 1 |
% \iffalse^^A meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% scrlfile.dtx |
| 4 |
% Copyright (c) Markus Kohm, 2002-2023 |
| 5 |
% |
| 6 |
% This file is part of the work `scrlfile' which is part of the LaTeX2e |
| 7 |
% KOMA-Script bundle. |
| 8 |
% |
| 9 |
% This work may be distributed and/or modified under the conditions of |
| 10 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 11 |
% The latest version of this license is in |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 14 |
% version 2005/12/01 or later and of this work. |
| 15 |
% |
| 16 |
% This work has the LPPL maintenance status "author-maintained". |
| 17 |
% |
| 18 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 19 |
% |
| 20 |
% This work consists of all files listed in MANIFEST.md. |
| 21 |
% ====================================================================== |
| 22 |
%%% From File: $Id: scrlfile.dtx 4032 2023-04-17 09:45:11Z kohm $ |
| 23 |
%<*dtx> |
| 24 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 25 |
\begingroup |
| 26 |
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} |
| 27 |
\filedate$Date: 2023-04-17 11:45:11 +0200 (Mo, 17. Apr 2023) $ |
| 28 |
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} |
| 29 |
\filerevision$Revision: 4032 $ |
| 30 |
\edef\reserved@a{% |
| 31 |
\noexpand\endgroup |
| 32 |
\noexpand\ProvidesFile{scrlfile.dtx}% |
| 33 |
[\filedate\space\filerevision\space |
| 34 |
KOMA-Script package source |
| 35 |
}% |
| 36 |
\reserved@a |
| 37 |
%</dtx> |
| 38 |
%<package>\ProvidesPackage{scrlfile}[% |
| 39 |
%!KOMAScriptVersion |
| 40 |
%<package> package |
| 41 |
(file load hooks)] |
| 42 |
%<*dtx> |
| 43 |
\ifx\documentclass\undefined |
| 44 |
\input scrdocstrip.tex |
| 45 |
\@@input scrkernel-version.dtx |
| 46 |
\@@input scrstrip.inc |
| 47 |
\KOMAdefVariable{COPYRIGHTFROM}{2002} |
| 48 |
\generate{\usepreamble\defaultpreamble |
| 49 |
\file{scrlfile.sty}{% |
| 50 |
\from{scrlfile.dtx}{package}% |
| 51 |
\from{scrlogo.dtx}{logo}% |
| 52 |
}% |
| 53 |
} |
| 54 |
\batchinput{scrlfile-hook.dtx} |
| 55 |
\batchinput{scrlfile-patcholdlatex.dtx} |
| 56 |
\@@input scrstrop.inc |
| 57 |
\else |
| 58 |
\let\endbatchfile\relax |
| 59 |
\fi |
| 60 |
\endbatchfile |
| 61 |
\documentclass[USenglish]{koma-script-source-doc} |
| 62 |
\usepackage{babel} |
| 63 |
\setcounter{StandardModuleDepth}{1} |
| 64 |
\begin{document} |
| 65 |
\DocInput{scrlfile.dtx} |
| 66 |
\end{document} |
| 67 |
%</dtx> |
| 68 |
% \fi^^A meta-comment |
| 69 |
% |
| 70 |
% \changes{v2.95}{2002/06/11}{First version split from hugh scrclass.dtx} |
| 71 |
% \changes{v3.24}{2017/05/06}{standalone manual removed} |
| 72 |
% \changes{v3.32}{2020/09/11}{new implementation based on |
| 73 |
% \pkg*{scrlfile-hook} and \pkg*{scrlfile-patcholdlatex}} |
| 74 |
% \changes{v3.36}{2022/02/03}{switch over from \cls*{scrdoc} to |
| 75 |
% \cls*{koma-script-source-doc}} |
| 76 |
% \changes{v3.36}{2022/02/03}{using \file{scrlogo.dtx} to define the logo} |
| 77 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 78 |
% |
| 79 |
% \GetFileInfo{scrlfile.dtx} |
| 80 |
% \title{File Loading Hooks with \href{https://komascript.de}{\KOMAScript} |
| 81 |
% Package \pkg*{scrlfile}} |
| 82 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 83 |
% \date{Revision \fileversion{} of \filedate} |
| 84 |
% \maketitle |
| 85 |
% \begin{abstract} |
| 86 |
% This package is the compatibility layer over \texttt{scrlfile-hook} and |
| 87 |
% \texttt{scrlfile-patcholdlatex}. It provides package and class hook |
| 88 |
% handling independent from the used \LaTeX{} release. |
| 89 |
% \end{abstract} |
| 90 |
% \tableofcontents |
| 91 |
% |
| 92 |
% |
| 93 |
% \section{User Manual} |
| 94 |
% |
| 95 |
% You can find the user manual of \pkg*{scrlfile} in the \KOMAScript{} manual, |
| 96 |
% either the German \file{scrguide-de.pdf} or the English |
| 97 |
% \file{scrguide-en.pdf}. |
| 98 |
% |
| 99 |
% |
| 100 |
% \MaybeStop{\PrintIndex} |
| 101 |
% |
| 102 |
% \section{Implementation of \pkg*{scrlfile}} |
| 103 |
% |
| 104 |
% We need to load one of the packages \pkg*{scrlfile-hook}, |
| 105 |
% \pkg*{scrlfile-kook-3.34}, \pkg*{scrlfile-patcholdlatex}. |
| 106 |
% \changes{v3.33}{2021/02/09}{do not test for existence of \cs{AddToHook} any |
| 107 |
% longer, but \cs{IfFormatAtLeastTF} and the format version}% |
| 108 |
% We cannot do the decision by testing the existence of macro \cs{AddToHook}, |
| 109 |
% because package \pkg{latexrelease} does not rollback to prior format |
| 110 |
% versions good enough. Instead of undefining the macro and so really |
| 111 |
% reverting to the definition of \LaTeX{} kernels prior to 2020/10/01 it only |
| 112 |
% redefines it to a do-nothing macro. Because of this and similar issues with |
| 113 |
% \pkg{latexrelease} cannot (or only with provision) be used to simulate a |
| 114 |
% real old \LaTeX{} kernel, i.e. for testing. So the only valid test for the |
| 115 |
% existence of the wanted \cs{AddToHook} would be to test the definite |
| 116 |
% definition of \cs{AddToHook} and the existence of the hooks we are |
| 117 |
% using. But, because this is to much effort, we simply test the format |
| 118 |
% version. Nevertheless, we know, this may fail! |
| 119 |
% \begin{macrocode} |
| 120 |
\@ifundefined{IfFormatAtLeastTF}{% |
| 121 |
\RequirePackage{scrlfile-patcholdlatex}% |
| 122 |
\RequirePackage{xparse}% |
| 123 |
% \end{macrocode} |
| 124 |
% \changes{v3.33}{2021/02/16}{workaround for \pkg{latexrelease} bug} |
| 125 |
% Explicitly switch of \pkg{expl3} syntax because of a |
| 126 |
% \pkg{latexrelease} bug related to the usage of \pkg{xparse-2020-10-01} in |
| 127 |
% version 2020-02-02. |
| 128 |
% \changes{v3.35}{2021/10/31}{new variant because of \LaTeX{} kernel change} |
| 129 |
% \begin{macrocode} |
| 130 |
\ExplSyntaxOff |
| 131 |
}{% |
| 132 |
\IfFormatAtLeastTF{2020/10/01}{% |
| 133 |
\IfFormatAtLeastTF{2021/11/15}{% |
| 134 |
\RequirePackage{scrlfile-hook}% |
| 135 |
}{% |
| 136 |
\RequirePackage{scrlfile-hook-3.34}% |
| 137 |
}% |
| 138 |
}{% |
| 139 |
\RequirePackage{scrlfile-patcholdlatex}% |
| 140 |
\RequirePackage{xparse}% |
| 141 |
% \end{macrocode} |
| 142 |
% Explicitly switch of \pkg{expl3} syntax because of a |
| 143 |
% \pkg{latexrelease} bug in version 2020-02-02. |
| 144 |
% \begin{macrocode} |
| 145 |
\ExplSyntaxOff |
| 146 |
}% |
| 147 |
} |
| 148 |
% \end{macrocode} |
| 149 |
% |
| 150 |
% \begin{option}{withdeprecated} |
| 151 |
% \changes{v3.32}{2020/09/11}{added} |
| 152 |
% Depending on this option we implement addition deprecated commands. |
| 153 |
% \begin{macrocode} |
| 154 |
\DeclareOption{withdeprecated}{% |
| 155 |
% \end{macrocode} |
| 156 |
% |
| 157 |
% \begin{command}[noindex]{\AfterClass+,\AfterClass!} |
| 158 |
% \cs{scrlfile@AfterClass} is used in the sub-packages to store the original |
| 159 |
% \cs{AfterClass} and can be used to redefine \cs{AfterClass} to handle the |
| 160 |
% plus and the exclamation mark variant. |
| 161 |
% \begin{macrocode} |
| 162 |
\RenewDocumentCommand\AfterClass{}{% |
| 163 |
% \end{macrocode} |
| 164 |
%^^A Hack for correct line numbers in the index: |
| 165 |
%^^A - end environment, |
| 166 |
%^^A - do index entries |
| 167 |
%^^A - fix vertical spaces |
| 168 |
%^^A - restart environment without printing and indexing |
| 169 |
% \end{command} |
| 170 |
% \SpecialMainCommandIndex{\AfterClass+} |
| 171 |
% \SpecialMainCommandIndex{\AfterClass\quotechar!} |
| 172 |
% \vskip-\dimexpr 2.2\baselineskip+\parskip\relax |
| 173 |
% \begin{command}[noindex,noprint]{\AfterClass+,\AfterClass!} |
| 174 |
% \begin{macrocode} |
| 175 |
\kernel@ifnextchar +% |
| 176 |
{\scrlfile@emulatedeprecated{Class}}% |
| 177 |
{% |
| 178 |
\kernel@ifnextchar !% |
| 179 |
{\scrlfile@emulatedeprecated{Class}}% |
| 180 |
\scrlfile@AfterClass |
| 181 |
}% |
| 182 |
} |
| 183 |
% \end{macrocode} |
| 184 |
% \end{command} |
| 185 |
% |
| 186 |
% \begin{command}[noindex]{\AfterPackage+,\AfterPackage!} |
| 187 |
% \cs{scrlfile@AfterPackage} is used in the sub-packages to store the original |
| 188 |
% \cs{AfterPackage} and can be used to redefine \cs{AfterPackage} to handle |
| 189 |
% the plus and the exclamation mark variant. |
| 190 |
% \begin{macrocode} |
| 191 |
\RenewDocumentCommand\AfterPackage{}{% |
| 192 |
% \end{macrocode} |
| 193 |
%^^A Hack for correct line numbers in the index: |
| 194 |
%^^A - end environment, |
| 195 |
%^^A - do index entries |
| 196 |
%^^A - fix vertical spaces |
| 197 |
%^^A - restart environment without printing and indexing |
| 198 |
% \end{command} |
| 199 |
% \SpecialMainCommandIndex{\AfterPackage+} |
| 200 |
% \SpecialMainCommandIndex{\AfterPackage\quotechar!} |
| 201 |
% \vskip-\dimexpr 2.2\baselineskip+\parskip\relax |
| 202 |
% \begin{command}[noindex,noprint]{\AfterPackage+,\AfterPackage!} |
| 203 |
% \begin{macrocode} |
| 204 |
\kernel@ifnextchar +% |
| 205 |
{\scrlfile@emulatedeprecated{Package}}% |
| 206 |
{% |
| 207 |
\kernel@ifnextchar !% |
| 208 |
{\scrlfile@emulatedeprecated{Package}}% |
| 209 |
\scrlfile@AfterPackage |
| 210 |
}% |
| 211 |
} |
| 212 |
% \end{macrocode} |
| 213 |
% \end{command} |
| 214 |
% |
| 215 |
% \begin{macro}{\scrlfile@emulatedeprecated} |
| 216 |
% \changes{v3.32}{2020/09/11}{added} |
| 217 |
% This emulates \cs{AfterClass+}, \cs{AfterPackage+}, \cs{AfterClass!} and |
| 218 |
% \cs{AfterPackage!} using \cs{AfterAtEndOfClass} or |
| 219 |
% \cs{AfterAtEndOfPackage}. Note, that both, the plus and the exclamation mark |
| 220 |
% variants, are emulated by the star variant of \cs{AfterAtEndOfClass} |
| 221 |
% resp. \cs{AfterAtEndOfPackage}. So the emulation is not perfect. |
| 222 |
% \begin{macrocode} |
| 223 |
\newcommand*{\scrlfile@emulatedeprecated}[2]{% |
| 224 |
\PackageWarning{scrlfile}{% |
| 225 |
emulating deprecated \expandafter\string\csname After#1#2\endcsname |
| 226 |
\space by\MessageBreak |
| 227 |
\expandafter\string\csname AfterAtEndOf#1*\endcsname.\MessageBreak |
| 228 |
Note, this may fail, so you should not use\MessageBreak |
| 229 |
\expandafter\string\csname After#1#2\endcsname |
| 230 |
}% |
| 231 |
\csname AfterAtEndOf#1\endcsname*% |
| 232 |
} |
| 233 |
% \end{macrocode} |
| 234 |
% \end{macro} |
| 235 |
% |
| 236 |
% \begin{macrocode} |
| 237 |
} |
| 238 |
% \end{macrocode} |
| 239 |
% \end{option} |
| 240 |
% |
| 241 |
% Now, we just have to execute and process the options. |
| 242 |
% \begin{macrocode} |
| 243 |
\ExecuteOptions{} |
| 244 |
\ProcessOptions\relax |
| 245 |
% \end{macrocode} |
| 246 |
% |
| 247 |
% \Finale |
| 248 |
% \PrintChanges |
| 249 |
% |
| 250 |
% \endinput |
| 251 |
% Local Variables: |
| 252 |
% mode: doctex |
| 253 |
% ispell-local-dictionary: "en_US" |
| 254 |
% eval: (flyspell-mode 1) |
| 255 |
% TeX-master: t |
| 256 |
% TeX-engine: luatex-dev |
| 257 |
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx")) |
| 258 |
% End: |