| 1 |
% \iffalse meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% scrkernel-basics.dtx |
| 4 |
% Copyright (c) Markus Kohm, 2002-2025 |
| 5 |
% |
| 6 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the conditions of |
| 9 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 10 |
% The latest version of this license is in |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 13 |
% version 2005/12/01 or later and of this work. |
| 14 |
% |
| 15 |
% This work has the LPPL maintenance status "author-maintained". |
| 16 |
% |
| 17 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 18 |
% |
| 19 |
% This work consists of all files listed in MANIFEST.md. |
| 20 |
% ====================================================================== |
| 21 |
%%% From File: $Id: scrkernel-basics.dtx 4198 2025-08-15 09:19:27Z kohm $ |
| 22 |
%<prepare>%%% (run: prepare) |
| 23 |
%<option>%%% (run: option) |
| 24 |
%<body>%%% (run: body) |
| 25 |
%<load>%%% (run: load) |
| 26 |
%<package&prepare>\NeedsTeXFormat{LaTeX2e}[2022/06/01] |
| 27 |
%<*dtx> |
| 28 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 29 |
\begingroup |
| 30 |
\def\filedate$#1: #2-#3-#4 #5${\def\filedate{#2/#3/#4}} |
| 31 |
\filedate$Date: 2025-08-15 11:19:27 +0200 (Fr, 15. Aug 2025) $ |
| 32 |
\def\filerevision$#1: #2 ${\def\filerevision{r#2}} |
| 33 |
\filerevision$Revision: 4198 $ |
| 34 |
\edef\reserved@a{% |
| 35 |
\noexpand\endgroup |
| 36 |
\noexpand\ProvidesFile{scrkernel-basics.dtx}% |
| 37 |
[\filedate\space\filerevision\space |
| 38 |
KOMA-Script |
| 39 |
} |
| 40 |
\reserved@a |
| 41 |
%</dtx> |
| 42 |
%<*dtx|(package&prepare)> |
| 43 |
%<package>\ProvidesPackage{% |
| 44 |
%<package&base> scrbase% |
| 45 |
%<package&koma> scrkbase% |
| 46 |
%<package>}[% |
| 47 |
%!KOMAScriptVersion |
| 48 |
package |
| 49 |
%<*dtx> |
| 50 |
source |
| 51 |
%</dtx> |
| 52 |
(% |
| 53 |
%<base> KOMA-Script-independent |
| 54 |
%<koma> KOMA-Script-dependent |
| 55 |
basics and keyval usage)] |
| 56 |
%</dtx|(package&prepare)> |
| 57 |
%<*dtx> |
| 58 |
\ifx\documentclass\undefined |
| 59 |
\input scrdocstrip.tex |
| 60 |
\@@input scrkernel-version.dtx |
| 61 |
\@@input scrstrip.inc |
| 62 |
\KOMAdefVariable{COPYRIGHTFROM}{2002} |
| 63 |
\generate{\usepreamble\defaultpreamble |
| 64 |
\file{scrbase.sty}{% |
| 65 |
\from{scrkernel-version.dtx}{package,scrbase}% |
| 66 |
\from{scrkernel-basics.dtx}{package,prepare,base}% |
| 67 |
\from{scrkernel-basics.dtx}{package,option,base}% |
| 68 |
\from{scrkernel-language.dtx}{package,option,base}% |
| 69 |
\from{scrkernel-basics.dtx}{package,body,base}% |
| 70 |
\from{scrkernel-language.dtx}{package,body,base}% |
| 71 |
\from{scrlogo.dtx}{logo}% |
| 72 |
}% |
| 73 |
} |
| 74 |
\@@input scrstrop.inc |
| 75 |
\else |
| 76 |
\let\endbatchfile\relax |
| 77 |
\fi |
| 78 |
\endbatchfile |
| 79 |
\documentclass[USenglish]{koma-script-source-doc} |
| 80 |
\usepackage{babel} |
| 81 |
\usepackage{hvlogos} |
| 82 |
\setcounter{StandardModuleDepth}{2} |
| 83 |
\begin{document} |
| 84 |
\DocInput{scrkernel-basics.dtx} |
| 85 |
\end{document} |
| 86 |
%</dtx> |
| 87 |
% \fi^^A meta-comment |
| 88 |
% |
| 89 |
% \changes{v1.0}{2002/07/06}{starting implementation} |
| 90 |
% \changes{v3.12}{203/03/05}{usage of \cs{@tempa}, \cs{@tempb}, \cs{@tempc} |
| 91 |
% eliminated} |
| 92 |
% \changes{v3.36}{2022/02/16}{switch over from \cls*{scrdoc} to |
| 93 |
% \cls*{koma-script-source-doc}} |
| 94 |
% \changes{v3.36}{2022/02/21}{whole implementation documentation in English} |
| 95 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 96 |
% |
| 97 |
% \GetFileInfo{scrkernel-basics.dtx} |
| 98 |
% \title{Basic Funktionality Used by Almost all |
| 99 |
% \href{https://komascript.de}{\KOMAScript} Classes and Packages} |
| 100 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 101 |
% \date{Revision \fileversion{} of \filedate} |
| 102 |
% \maketitle |
| 103 |
% \begin{abstract} |
| 104 |
% New versions of \KOMAScript{} make increasing use of the \pkg{keyval} |
| 105 |
% package. The \pkg{keyval} package is part of the \pkg{graphics} package |
| 106 |
% and as such must be included on all \TeX{} systems with \LaTeX{}. However, |
| 107 |
% it does not meet the requirements of \KOMAScript{} in some |
| 108 |
% respects. Therefore, extensions are made here which can be used by |
| 109 |
% \KOMAScript classes and \KOMAScript packages. |
| 110 |
% |
| 111 |
% In addition, more and more parts of \KOMAScript{} are used by more than |
| 112 |
% one package or by packages and classes. These basic things have therefore |
| 113 |
% been split into two packages, \pkg*{scrbase} (for things that can also be |
| 114 |
% used by other classes and packages) and \pkg*{scrkbase} (for things that |
| 115 |
% are reserved for \pkg*{scrkbase}). This makes the packages and classes |
| 116 |
% themselves smaller and they can still be used independently. Of course you |
| 117 |
% can also use this package without the rest of \KOMAScript{}. |
| 118 |
% \end{abstract} |
| 119 |
% \tableofcontents |
| 120 |
% |
| 121 |
% \section{User Manual} |
| 122 |
% |
| 123 |
% You can find the user documentation of package \pkg*{scrbase} and the |
| 124 |
% commands implemented in \file{scrkernel-basics.dtx} in the \KOMAScript{} |
| 125 |
% manual, either the German \file{scrguide-de.pdf} or the English |
| 126 |
% \file{scrguide-en.pdf}. |
| 127 |
% |
| 128 |
% |
| 129 |
% \subsection{Features not yet in the user manuals} |
| 130 |
% |
| 131 |
% Some user commands are not documented in the \KOMAScript{} manuals, e.g., |
| 132 |
% because they are not stable enough to be used by average users or more or |
| 133 |
% less for internal usage only. Some are only not documented in the |
| 134 |
% \KOMAScript{} manual, because nobody has done it yet. |
| 135 |
% |
| 136 |
% \DescribeCommand\IfLTXAtLeastTF |
| 137 |
% \marginpar{\raggedleft\tiny Added: 2021-01-31}% |
| 138 |
% This is the same like \cs{IfFormatAtLeast} of \LaTeX{} from 2020/10/01, but |
| 139 |
% works also with older \LaTeX{} kernels. |
| 140 |
% |
| 141 |
% \DescribeCommand\Ifislengthprimitive |
| 142 |
% \marginpar{\raggedleft\tiny Added: 2015/10/19\\Renamed: 2022/02/17}% |
| 143 |
% \cs{Ifislengthprimitive}\marg{macro}\marg{then code}\marg{else code} |
| 144 |
% expands the \meta{macro} and tests if the result can be used as a length |
| 145 |
% primitive. If this is the case the \meta{then code} is executed, otherwise |
| 146 |
% the \meta{else code}. Note, that this command can be false negative, |
| 147 |
% because, i.e., with \LuaLaTeX{} there can be primitives, that are like length, |
| 148 |
% but that are not known by \cs{Ifislengthprimitive}. |
| 149 |
% |
| 150 |
% \DescribeCommand\Ifisdefchar |
| 151 |
% \marginpar{\raggedleft\tiny Added: 2015/10/19\\Renamed: 2022/02/17}% |
| 152 |
% \cs{Ifislengthprimitive}\marg{macro}\marg{then code}\marg{else code} |
| 153 |
% expands the \meta{macro} and tests if the result is a \cs{char}. If this is |
| 154 |
% the case the \meta{then code} is executed, otherwise the \meta{else code}. |
| 155 |
% Note, that this command can be false positive, if the \cs{char} value is |
| 156 |
% incorrect. |
| 157 |
% |
| 158 |
% |
| 159 |
% \MaybeStop{\PrintIndex} |
| 160 |
% |
| 161 |
% \section{Implementation of \pkg*{scrbase} and \pkg*{scrkbase}} |
| 162 |
% |
| 163 |
% \subsection{Loading \pkg*{scrkbase}} |
| 164 |
% Who ever loads ths package, always wants the same version of the already |
| 165 |
% used \KOMAScript version. |
| 166 |
% \begin{macrocode} |
| 167 |
%<*load> |
| 168 |
\RequirePackage{scrkbase}[\KOMAScriptVersion] |
| 169 |
%</load> |
| 170 |
% \end{macrocode} |
| 171 |
% |
| 172 |
% |
| 173 |
% \subsection{\eTeX{} test} |
| 174 |
% \changes{v3.02c}{2009/02/19}{error message without \eTeX} |
| 175 |
% |
| 176 |
% \begin{macrocode} |
| 177 |
%<*prepare> |
| 178 |
%<*base> |
| 179 |
\begingroup |
| 180 |
\def\reserved@b{}% |
| 181 |
\def\reserved@a#1{% |
| 182 |
\PackageError{scrbase}{seems you are not running e-TeX#1}{% |
| 183 |
Since 2004 the LaTeX team recommends to use e-TeX.\MessageBreak |
| 184 |
KOMA-Script since version 2.95 uses several e-TeX features.\MessageBreak |
| 185 |
At actual systems `latex' should already use e-TeX.\MessageBreak |
| 186 |
At deprecated systems it may be called `elatex'.\MessageBreak |
| 187 |
Use either unsupported KOMA-Script up to version 2.9u or\MessageBreak |
| 188 |
ask you administrator for LaTeX using e-TeX#1.\MessageBreak |
| 189 |
Not using e-TeX#1 is a fatal error!\MessageBreak |
| 190 |
Processing cannot be continued!}% |
| 191 |
\endgroup |
| 192 |
\batchmode \errmessage{}\csname @@end\endcsname\end\relax |
| 193 |
\csname endinput\endcsname |
| 194 |
}% |
| 195 |
\expandafter\ifx\csname eTeXversion\endcsname\relax\else |
| 196 |
\ifnum\eTeXversion <2 |
| 197 |
\def\reserved@b{ V 2}% |
| 198 |
\else |
| 199 |
\let\reserved@a\endgroup |
| 200 |
\fi |
| 201 |
\fi |
| 202 |
\expandafter\reserved@a\expandafter{\reserved@b} |
| 203 |
%</base> |
| 204 |
% \end{macrocode} |
| 205 |
% |
| 206 |
% |
| 207 |
% \subsection{The \KOMAScript-only package loads the universal package} |
| 208 |
% |
| 209 |
% Once again the same version is wanted. |
| 210 |
% \begin{macrocode} |
| 211 |
%<koma>\RequirePackage{scrbase}[\KOMAScriptVersion] |
| 212 |
% \end{macrocode} |
| 213 |
% |
| 214 |
% \changes{v3.44}{2025/05/13}{at least \LaTeX{} 2022-06-01 required} |
| 215 |
% \begin{macrocode} |
| 216 |
%<*koma> |
| 217 |
\IfLTXAtLeastTF{2022/06/01}{}{% |
| 218 |
\@ifundefined{KOMAClassName} |
| 219 |
{\PackageError{scrkbase}} |
| 220 |
{\ClassError{\KOMAClassName}} |
| 221 |
{% |
| 222 |
LaTeX kernel too old!\MessageBreak |
| 223 |
This version of KOMA-Script requires at least\MessageBreak |
| 224 |
LaTeX 2022-06-01.\MessageBreak |
| 225 |
You need to either use an older version of\MessageBreak |
| 226 |
KOMA-Script or update your LaTeX kernel.\MessageBreak |
| 227 |
Sorry, but this error is fatal.\MessageBreak |
| 228 |
You cannot continue. Aborting LaTeX run% |
| 229 |
} |
| 230 |
{No further help available!}% |
| 231 |
\batchmode \immediate\read -1 to \@tempa |
| 232 |
} |
| 233 |
%</koma> |
| 234 |
% \end{macrocode} |
| 235 |
% |
| 236 |
% |
| 237 |
% \subsection{Define used commands missing with old \LaTeX{} kernel} |
| 238 |
% |
| 239 |
% There are some easy commands, we want to use, but don't want to need a very |
| 240 |
% new \LaTeX{} kernel. So we define them here. |
| 241 |
% |
| 242 |
% \begin{command}{\IfPackageLoadedT,\IfPackageLoadedF} |
| 243 |
% \changes{v3.46}{2025/06/16}{added} |
| 244 |
% These are only variants of \cs{IfPackageLoadedTF}, which is already |
| 245 |
% available since \LaTeX{} 2021-11-15. |
| 246 |
% \begin{macrocode} |
| 247 |
%<*koma> |
| 248 |
\providecommand*\IfPackageLoadedT[1]{\IfPackageLoadedTF{#1}\@firstofone\@gobble} |
| 249 |
\providecommand*\IfPackageLoadedF[1]{\IfPackageLoadedTF{#1}{}} |
| 250 |
%</koma> |
| 251 |
% \end{macrocode} |
| 252 |
% \end{command} |
| 253 |
% |
| 254 |
% \begin{macro}{\@gobble@o,\@gobble@om,\@gobble@som} |
| 255 |
% \changes{v3.46}{2025/08/15}{added} |
| 256 |
% \begin{macrocode} |
| 257 |
%<*koma> |
| 258 |
\ProvideDocumentCommand\@gobble@o{+o}{} |
| 259 |
\ProvideExpandableDocumentCommand\@gobble@om{+o+m}{} |
| 260 |
\ProvideExpandableDocumentCommand\@gobble@som{s+o+m}{} |
| 261 |
%</koma> |
| 262 |
% \end{macrocode} |
| 263 |
% \end{macro} |
| 264 |
% |
| 265 |
% \subsection{Package \pkg*{scrlfile}} |
| 266 |
% |
| 267 |
% We need to react on the loading other packages like \pkg{polyglossia}. For |
| 268 |
% this we use \pkg*{scrlfile}. But we can use any version. |
| 269 |
% |
| 270 |
% \begin{macrocode} |
| 271 |
%<base>\RequirePackage{scrlfile} |
| 272 |
% \end{macrocode} |
| 273 |
% |
| 274 |
% \subsection{Package \pkg*{keyval}} |
| 275 |
% |
| 276 |
% The \KOMAScript{} key handling bases on package \pkg{keyval}. |
| 277 |
% \begin{macrocode} |
| 278 |
%<base>\RequirePackage{keyval} |
| 279 |
% \end{macrocode} |
| 280 |
% |
| 281 |
% |
| 282 |
% \subsection{Using protected kernel macros} |
| 283 |
% Some package like \pkg{amsgen} redefine internal \LaTeX{} kernel macros, but |
| 284 |
% break them for other purposes than the own. So I have to make them work |
| 285 |
% again. The \KOMAScript{} classes have less problems with this, because most |
| 286 |
% of these packages cannot be loaded before a class. So the classes can simply |
| 287 |
% copy the original macro, before it is redefined. But I do not know, when a |
| 288 |
% package is loaded. So I have to implement the whole macro again with another |
| 289 |
% name (and can only hope, that such packages do not damage them also). |
| 290 |
% |
| 291 |
% \begin{macro}{\kernel@ifstar} |
| 292 |
% \changes{v3.20}{2016/04/12}{added} |
| 293 |
% I hope, the \LaTeX{} kernel will define this in future and other packages do |
| 294 |
% not redefine like they do with \cs{@ifstar}. So I use \cs{providecommand} to |
| 295 |
% not redefine the kernel macro, if it does exist. |
| 296 |
% \begin{macrocode} |
| 297 |
%<base>\providecommand*\kernel@ifstar[1]{\kernel@ifnextchar*{\@firstoftwo{#1}}} |
| 298 |
% \end{macrocode} |
| 299 |
% \end{macro}^^A \kernel@ifstar |
| 300 |
% |
| 301 |
% |
| 302 |
% \subsection{Improved \LaTeX{} kernel commands} |
| 303 |
% The \LaTeX{} kernel already provides some useful commands, but some can be |
| 304 |
% improved. |
| 305 |
% |
| 306 |
% \begin{command}{\rloop} |
| 307 |
% \changes{v3.30}{2020/03/07}{added} |
| 308 |
% The \cs{loop} \dots \cs{repeat} of the \LaTeX{} kernel cannot be used inside |
| 309 |
% a \cs{loop} \dots \cs{repeat} without extra code for preserving |
| 310 |
% \cs{iterate}. So here is a re-entrant version that is also long. This |
| 311 |
% version can be used even inside a \cs{loop} \dots \cs{repeat}. However you |
| 312 |
% should not use \cs{loop} \dots \cs{repeat} inside \cs{rloop} \dots |
| 313 |
% \cs{repeat}. |
| 314 |
% \begin{macrocode} |
| 315 |
%<*base> |
| 316 |
\newcommand{\rloop}[1]{} |
| 317 |
\long\def\rloop#1\repeat{% |
| 318 |
\ifdefined\iterate |
| 319 |
\edef\iterate{\unexpanded{#1\relax\expandafter\iterate\fi\def\iterate}% |
| 320 |
{\unexpanded\expandafter{\iterate}}}% |
| 321 |
\else |
| 322 |
\def\iterate{#1\relax\expandafter\iterate\fi\let\iterate\relax}% |
| 323 |
\fi |
| 324 |
\iterate |
| 325 |
} |
| 326 |
%</base> |
| 327 |
% \end{macrocode} |
| 328 |
% \end{command} |
| 329 |
% |
| 330 |
% \begin{command}{\IfLTXAtLeastTF} |
| 331 |
% \changes{v3.33}{2021/01/21}{added} |
| 332 |
% This is the same like \cs{IfFormatAtLeastTF} of the current \LaTeX{} kernel, |
| 333 |
% but does also work, if \cs{IfFormatAtLeastTF} is not defined because of |
| 334 |
% very old \LaTeX{} kernel. |
| 335 |
% \begin{macrocode} |
| 336 |
%<*base> |
| 337 |
\newcommand*{\IfLTXAtLeastTF}{\@ifl@t@r\fmtversion} |
| 338 |
\ifcsname IfFormatAtLeastTF\endcsname |
| 339 |
\let\IfLTXAtLeastTF\IfFormatAtLeastTF |
| 340 |
\fi |
| 341 |
\@onlypreamble\IfLTXAtLeastTF |
| 342 |
%</base> |
| 343 |
% \end{macrocode} |
| 344 |
% \end{command} |
| 345 |
% |
| 346 |
% |
| 347 |
% \subsection{Testing macros} |
| 348 |
% |
| 349 |
% \begin{macro}{\scr@ifundefinedorrelax} |
| 350 |
% \changes{v2.95c}{2006/08/12}{added} |
| 351 |
% \changes{v2.97b}{2007/03/08}{broken logic fixed} |
| 352 |
% \changes{v2.97c}{2007/04/18}{broken functionality fixed} |
| 353 |
% \changes{v2.97c}{2007/04/18}{\cs{scr@ifundefined} renamed} |
| 354 |
% \changes{v3.02c}{2009/02/19}{special treatment of \eTeX{} removed} |
| 355 |
% This macro is like \cs{@ifundefined}, but does not define the test macro |
| 356 |
% \cs{relax} if it was undefined before. Note: With up-to-date \LaTeX{} this |
| 357 |
% is the same with the original \cs{@ifundefined}. |
| 358 |
% \begin{macrocode} |
| 359 |
%<*base> |
| 360 |
\newcommand{\scr@ifundefinedorrelax}[1]{% |
| 361 |
\ifcsname #1\endcsname |
| 362 |
\expandafter\ifx\csname #1\endcsname\relax |
| 363 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 364 |
\else |
| 365 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 366 |
\fi |
| 367 |
\else |
| 368 |
\expandafter\@firstoftwo |
| 369 |
\fi |
| 370 |
} |
| 371 |
%</base> |
| 372 |
% \end{macrocode} |
| 373 |
% \end{macro}^^A \scr@ifundefinedorrelax |
| 374 |
% |
| 375 |
% |
| 376 |
% \subsection{Extending messages} |
| 377 |
% |
| 378 |
% \begin{command}{\PackageErrorNoLine} |
| 379 |
% \changes{v3.12}{2013/09/19}{added} |
| 380 |
% \changes{v3.28}{2019/11/23}{nonsense command removed} |
| 381 |
% Falk correctly stated, that \cs{PackageError} already does not show a line |
| 382 |
% number. So we do not need this command. |
| 383 |
% \end{command} |
| 384 |
% |
| 385 |
% |
| 386 |
% \subsection{Definition of the \KOMAScript{} \pkg*{keyval} basis} |
| 387 |
% |
| 388 |
% \KOMAScript{} could use \pkg{keyval} keys with the same set of keywords |
| 389 |
% ``\texttt{KOMA}'' to make it possible, that packages can redefine keys of |
| 390 |
% classes and other packages. However this would be dangerous and can easily |
| 391 |
% break. So we split the set of keywords in an family of keywords and family |
| 392 |
% member of keywords and define commands to process the keywords either of a |
| 393 |
% member or a whole family. |
| 394 |
% |
| 395 |
% \begin{command}{\DefineFamily,\DefineFamilyMember,\DefineFamilyKey} |
| 396 |
% \changes{v3.00}{2008/04/30}{added} |
| 397 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by \cs{kernel@ifnextchar}} |
| 398 |
% \begin{macro}{\scr@if@family} |
| 399 |
% \changes{v3.00}{2008/04/30}{added} |
| 400 |
% \begin{macro}{\scr@if@familymember} |
| 401 |
% \changes{v3.00}{2008/04/30}{added} |
| 402 |
% \changes{v3.27}{2019/07/19}{the empty member exists by default} |
| 403 |
% \begin{macro}{\scr@define@family@key} |
| 404 |
% \changes{v3.00}{2008/04/30}{added} |
| 405 |
% \begin{macro}{\scr@define@family@key@nodefault} |
| 406 |
% \changes{v3.00}{2008/04/30}{added} |
| 407 |
% \changes{v3.18a}{2015/07/03}{missing \% added} |
| 408 |
% Family, member of a family and \pkg{keyval} key for a member of a |
| 409 |
% family. The default of the member of a family is always the file name of a |
| 410 |
% class or package (while reading the file). |
| 411 |
% \begin{macrocode} |
| 412 |
%<*base> |
| 413 |
\newcommand*{\DefineFamily}[1]{% |
| 414 |
\scr@ifundefinedorrelax{#1@key@familylist}{% |
| 415 |
\@namedef{#1@key@familylist}{}% |
| 416 |
}{}% |
| 417 |
} |
| 418 |
\newcommand*{\scr@if@family}[2]{% |
| 419 |
\scr@ifundefinedorrelax{#1@key@familylist}{% |
| 420 |
\PackageError{scrbase}{% |
| 421 |
unknown family `#1'% |
| 422 |
}{% |
| 423 |
You've tried to #2 for family `#1'.\MessageBreak |
| 424 |
This my be done only for previous defined families.\MessageBreak |
| 425 |
You should call `\string\DefineFamily{#1}' first.% |
| 426 |
}% |
| 427 |
}% |
| 428 |
} |
| 429 |
\newcommand*{\DefineFamilyMember}[2][.\@currname.\@currext]{% |
| 430 |
\scr@if@family{#2}{define a family member}{% |
| 431 |
\edef\reserved@a{% |
| 432 |
\noexpand\in@{#2#1,}{\csname #2@key@familylist\endcsname}}% |
| 433 |
\reserved@a |
| 434 |
\ifin@\else |
| 435 |
\expandafter\edef\csname #2@key@familylist\endcsname{% |
| 436 |
\@nameuse{#2@key@familylist}#2#1,}% |
| 437 |
\fi |
| 438 |
}% |
| 439 |
} |
| 440 |
\newcommand*{\scr@if@familymember}[3]{% |
| 441 |
\scr@if@family{#2}{#3}{% |
| 442 |
\IfArgIsEmpty{#1}{% |
| 443 |
\@firstofone |
| 444 |
}{% |
| 445 |
\edef\reserved@a{% |
| 446 |
\noexpand\in@{#2#1,}{\csname #2@key@familylist\endcsname}}% |
| 447 |
\reserved@a |
| 448 |
\ifin@ |
| 449 |
\expandafter\@firstofone |
| 450 |
\else |
| 451 |
\PackageError{scrbase}{% |
| 452 |
unknown member `#1' at family `#2'% |
| 453 |
}{% |
| 454 |
You've tried to #3 for member `#1' of family `#2'.\MessageBreak |
| 455 |
This my be done only for previous defined family members.\MessageBreak |
| 456 |
You should call `\string\DefineFamilyMember[{#1}]{#2}' first.% |
| 457 |
}% |
| 458 |
\expandafter\@gobble |
| 459 |
\fi |
| 460 |
}% |
| 461 |
}% |
| 462 |
} |
| 463 |
\newcommand*{\DefineFamilyKey}[3][.\@currname.\@currext]{% |
| 464 |
\kernel@ifnextchar[%] |
| 465 |
{% |
| 466 |
\edef\reserved@a{#1}% |
| 467 |
\expandafter\scr@define@family@key |
| 468 |
\expandafter{\reserved@a}{#2}{#3}% |
| 469 |
}{% |
| 470 |
\edef\reserved@a{#1}% |
| 471 |
\expandafter\scr@define@family@key@nodefault |
| 472 |
\expandafter{\reserved@a}{#2}{#3}% |
| 473 |
}% |
| 474 |
} |
| 475 |
\newcommand{\scr@define@family@key}{} |
| 476 |
\long\def\scr@define@family@key#1#2#3[#4]#5{% |
| 477 |
\scr@if@familymember{#1}{#2}{define a key}{% |
| 478 |
\define@key{#2#1}{#3}[{#4}]{% |
| 479 |
\def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}% |
| 480 |
\FamilyKeyStateUnknown |
| 481 |
#5% |
| 482 |
\def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}% |
| 483 |
}% |
| 484 |
}% |
| 485 |
} |
| 486 |
\newcommand{\scr@define@family@key@nodefault}[4]{% |
| 487 |
\scr@if@familymember{#1}{#2}{define a key}{% |
| 488 |
\define@key{#2#1}{#3}{% |
| 489 |
\def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}% |
| 490 |
\FamilyKeyStateUnknown |
| 491 |
#4% |
| 492 |
\def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}% |
| 493 |
}% |
| 494 |
\@namedef{KV@#2#1@#3@default}{% |
| 495 |
\def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}% |
| 496 |
\FamilyKeyStateNeedValue |
| 497 |
}% |
| 498 |
}% |
| 499 |
} |
| 500 |
%</base> |
| 501 |
% \end{macrocode} |
| 502 |
% \end{macro}^^A \scr@define@family@key@nodefault |
| 503 |
% \end{macro}^^A \scr@define@family@key |
| 504 |
% \end{macro}^^A \scr@if@familymember |
| 505 |
% \end{macro}^^A \scr@if@family |
| 506 |
% \end{command}^^A \DefineFamily,\DefineFamilyMember,\DefineFamilyKey |
| 507 |
% |
| 508 |
% |
| 509 |
% \begin{command}{\RelaxFamilyKey} |
| 510 |
% \changes{v3.15}{2014/12/03}{added} |
| 511 |
% Sometimes it is useful to be able to \emph{un-define} a key. This will not |
| 512 |
% un-define all helper macros but only the key and a default value will become |
| 513 |
% \cs{relax}. |
| 514 |
% \begin{macrocode} |
| 515 |
%<*base> |
| 516 |
\newcommand*{\RelaxFamilyKey}[3][.\@currname.\@currext]{% |
| 517 |
\scr@ifundefinedorrelax{KV@#2#1@#3}{}{% |
| 518 |
\expandafter\let\csname KV@#2#1@#3\endcsname\relax |
| 519 |
}% |
| 520 |
\scr@ifundefinedorrelax{KV@#2#1@#3@default}{}{% |
| 521 |
\expandafter\let\csname KV@#2#1@#3@default\endcsname\relax |
| 522 |
}% |
| 523 |
} |
| 524 |
%</base> |
| 525 |
% \end{macrocode} |
| 526 |
% \end{command}^^A \RelaxFamilyKey |
| 527 |
% |
| 528 |
% \begin{command}{\FamilyKeyState,\FamilyKeyStateProcessed,\FamilyKeyStateUnknown, |
| 529 |
% \FamilyKeyStateUnknownValue,\FamilyKeyStateNeedValue} |
| 530 |
% \changes{v3.12}{2013/03/04}{added} |
| 531 |
% \cs{FamilyKeyState} is the state of processing a key. The initial state is |
| 532 |
% \cs{FamilyKeyStateUnknown}, so the state is indeed unknown. If a key has |
| 533 |
% been processed by the definition code and everything is OK, you should run |
| 534 |
% \cs{FamilyKeyStateProcessed}. This will set \cs{FamilyKeyState} also to |
| 535 |
% \cs{FamilyKeyStateProcessed} to indicate, the key has been processed |
| 536 |
% successfully. If the value assigned to the key is unknown, you should run |
| 537 |
% \cs{FamilyKeyStateUnknownValue}. And if the value is needed but no value has |
| 538 |
% been assigned, \cs{FamilyKeyStateNeedValue} is the correct choice. Note: |
| 539 |
% \cs{FamilyKeyState} is valid only immediately after processing a key. |
| 540 |
% \begin{macrocode} |
| 541 |
%<*base> |
| 542 |
\newcommand*{\FamilyKeyState}{} |
| 543 |
\newcommand*{\FamilyKeyStateUnknown}{% |
| 544 |
\let\FamilyKeyState\FamilyKeyStateUnknown |
| 545 |
} |
| 546 |
\newcommand*{\FamilyKeyStateUnknownValue}{% |
| 547 |
\let\FamilyKeyState\FamilyKeyStateUnknownValue |
| 548 |
} |
| 549 |
\newcommand*{\FamilyKeyStateNeedValue}{% |
| 550 |
\let\FamilyKeyState\FamilyKeyStateNeedValue |
| 551 |
} |
| 552 |
\newcommand*{\FamilyKeyStateProcessed}{% |
| 553 |
\let\FamilyKeyState\FamilyKeyStateProcessed |
| 554 |
} |
| 555 |
\let\FamilyKeyState\FamilyKeyStateUnknown |
| 556 |
%</base> |
| 557 |
% \end{macrocode} |
| 558 |
% \end{command}^^A \FamilyKeyState … \FamilyKeyStateNeedValue |
| 559 |
% |
| 560 |
% \begin{command}{\FamilyOfKey,\FamilyMemberOfKey} |
| 561 |
% \changes{v3.12}{2013/03/04}{added} |
| 562 |
% While processing a key, this is the family and the member of family. |
| 563 |
% \begin{macrocode} |
| 564 |
%<*base> |
| 565 |
\newcommand*{\FamilyOfKey}{} |
| 566 |
\newcommand*{\FamilyMemberOfKey}{} |
| 567 |
%</base> |
| 568 |
% \end{macrocode} |
| 569 |
% \end{command}^^A \FamilyOfKey,\FamilyMemberOfKey |
| 570 |
% |
| 571 |
% \begin{macro}{\KOMA@key} |
| 572 |
% \changes{v2.97c}{2007/04/19}{optional argument added} |
| 573 |
% \changes{v3.17}{2015/02/24}{rudimentary value storage} |
| 574 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 575 |
% \pkg{keyval} keys of \KOMAScript{} are defined with \cs{KOMAkey} to setup |
| 576 |
% the family to ``\texttt{KOMA}'' automatically. Additionally the value |
| 577 |
% storage is initialized. |
| 578 |
% \begin{macrocode} |
| 579 |
%<*koma> |
| 580 |
\newcommand*{\KOMA@key}[1][\@currname.\@currext]{% |
| 581 |
\DefineFamilyMember[{.#1}]{KOMA}% |
| 582 |
\@ifundefined{scr@kav@KOMA.#1}{\@namedef{scr@kav@KOMA.#1}{}}{}% |
| 583 |
\DefineFamilyKey[{.#1}]{KOMA}% |
| 584 |
} |
| 585 |
%</koma> |
| 586 |
% \end{macrocode} |
| 587 |
% \end{macro} |
| 588 |
% |
| 589 |
% \begin{macro}{\KOMA@kav@add} |
| 590 |
% \changes{v3.17}{2015/02/24}{added} |
| 591 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 592 |
% This macro stores a \texttt{\meta{key}=\meta{value}} pair in a internal |
| 593 |
% list. The first argument is the family member, the second the \meta{key} and |
| 594 |
% the third the \meta{value}. |
| 595 |
% \begin{macrocode} |
| 596 |
%<*koma> |
| 597 |
\newcommand*{\KOMA@kav@add}[3]{% |
| 598 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 599 |
\KOMA@internal@error\KOMA@kav@add{#1}% |
| 600 |
}{% |
| 601 |
\expandafter\l@addto@macro\csname scr@kav@KOMA.#1\endcsname{\do{{#2}{#3}}}% |
| 602 |
}% |
| 603 |
} |
| 604 |
%</koma> |
| 605 |
% \end{macrocode} |
| 606 |
% \end{macro} |
| 607 |
% |
| 608 |
% \begin{macro}{\KOMA@kav@xadd} |
| 609 |
% \changes{v3.17}{2015/02/24}{added} |
| 610 |
% This macro stores a \texttt{\meta{key}=\meta{value}} pair in a internal |
| 611 |
% list after expanding both, the \meta{key} and the \meta{value}. The first |
| 612 |
% argument is the family member, the second the \meta{key} and the third the |
| 613 |
% \meta{value}. |
| 614 |
% \begin{macrocode} |
| 615 |
%<*koma> |
| 616 |
\newcommand*{\KOMA@kav@xadd}[3]{% |
| 617 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 618 |
\KOMA@internal@error\KOMA@kav@xadd{#1}% |
| 619 |
}{% |
| 620 |
\protected@edef\reserved@a{{#2}{#3}}% |
| 621 |
\expandafter\l@addto@macro\csname scr@kav@KOMA.#1\expandafter\endcsname |
| 622 |
\expandafter{\expandafter\do\expandafter{\reserved@a}}% |
| 623 |
}% |
| 624 |
} |
| 625 |
%</koma> |
| 626 |
% \end{macrocode} |
| 627 |
% \end{macro} |
| 628 |
% |
| 629 |
% \begin{macro}{\KOMA@kav@remove} |
| 630 |
% \changes{v3.17}{2015/02/24}{added} |
| 631 |
% This macro removes a \texttt{\meta{key}=\meta{value}} pair from the internal |
| 632 |
% list. The first argument is the family member, the second the \meta{key} and |
| 633 |
% the third the \meta{value}. |
| 634 |
% \begin{macrocode} |
| 635 |
%<*koma> |
| 636 |
\newcommand*{\KOMA@kav@remove}[3]{% |
| 637 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 638 |
\KOMA@internal@error\KOMA@kav@remove{#1}% |
| 639 |
}{% |
| 640 |
\begingroup |
| 641 |
\def\reserved@a{\endgroup\@namedef{scr@kav@KOMA.#1}{}}% |
| 642 |
\edef\reserved@b{\detokenize{{#2}{#3}}}% |
| 643 |
\def\do##1{% |
| 644 |
\edef\reserved@c{\detokenize{##1}}% |
| 645 |
\ifx\reserved@b\reserved@c\else |
| 646 |
\l@addto@macro\reserved@a{% |
| 647 |
\expandafter\l@addto@macro\csname scr@kav@KOMA.#1\endcsname{% |
| 648 |
\do{##1}% |
| 649 |
}% |
| 650 |
}% |
| 651 |
\fi |
| 652 |
}% |
| 653 |
\@nameuse{scr@kav@KOMA.#1}% |
| 654 |
\reserved@a |
| 655 |
}% |
| 656 |
} |
| 657 |
%</koma> |
| 658 |
% \end{macrocode} |
| 659 |
% \end{macro} |
| 660 |
% |
| 661 |
% \begin{macro}{\KOMA@kav@removekey} |
| 662 |
% \changes{v3.17}{2015/02/24}{added} |
| 663 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 664 |
% This macro removes all \texttt{\meta{key}=\meta{value}} pairs of a given |
| 665 |
% \meta{key} from the internal list. The first argument is the family member, |
| 666 |
% the second the \meta{key}. |
| 667 |
% \begin{macrocode} |
| 668 |
%<*koma> |
| 669 |
\newcommand*{\KOMA@kav@removekey}[2]{% |
| 670 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 671 |
\KOMA@internal@error\KOMA@kav@removekey{#1}% |
| 672 |
}{% |
| 673 |
\begingroup |
| 674 |
\def\reserved@a{\endgroup\@namedef{scr@kav@KOMA.#1}{}}% |
| 675 |
\edef\reserved@b{\detokenize{#2}}% |
| 676 |
\def\reserved@d##1##2{\edef\reserved@c{\detokenize{##1}}}% |
| 677 |
\def\do##1{% |
| 678 |
\reserved@d##1\relax |
| 679 |
\ifx\reserved@b\reserved@c\else |
| 680 |
\l@addto@macro\reserved@a{% |
| 681 |
\expandafter\l@addto@macro\csname scr@kav@KOMA.#1\endcsname{% |
| 682 |
\do{##1}% |
| 683 |
}% |
| 684 |
}% |
| 685 |
\fi |
| 686 |
}% |
| 687 |
\@nameuse{scr@kav@KOMA.#1}% |
| 688 |
\reserved@a |
| 689 |
}% |
| 690 |
} |
| 691 |
%</koma> |
| 692 |
% \end{macrocode} |
| 693 |
% \end{macro} |
| 694 |
% |
| 695 |
% \begin{macro}{\KOMA@kav@replacevalue,\KOMA@kav@xreplacevalue} |
| 696 |
% \changes{v3.17}{2015/02/25}{added} |
| 697 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 698 |
% If \cs{FamilyKeyState} is \cs{FamilyKeyStateProcessed}, |
| 699 |
% these macros replace a \texttt{\meta{key}=\meta{value}} pair in the internal list. |
| 700 |
% The first argument is the family member, the second the \meta{key} and the |
| 701 |
% third is the new \meta{value}. \cs{KOMA@kav@xreplacevalue} expands both, the |
| 702 |
% \meta{key} and the \meta{value}. |
| 703 |
% \begin{macrocode} |
| 704 |
%<*koma> |
| 705 |
\newcommand*{\KOMA@kav@replacevalue}[3]{% |
| 706 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 707 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 708 |
\KOMA@internal@error\KOMA@kav@replacevalue{#1}% |
| 709 |
}{% |
| 710 |
\KOMA@kav@removekey{#1}{#2}% |
| 711 |
\KOMA@kav@add{#1}{#2}{#3}% |
| 712 |
}% |
| 713 |
\fi |
| 714 |
} |
| 715 |
\newcommand*{\KOMA@kav@xreplacevalue}[3]{% |
| 716 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 717 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 718 |
\KOMA@internal@error\KOMA@kav@replacevalue{#1}% |
| 719 |
}{% |
| 720 |
\KOMA@kav@removekey{#1}{#2}% |
| 721 |
\KOMA@kav@xadd{#1}{#2}{#3}% |
| 722 |
}% |
| 723 |
\fi |
| 724 |
} |
| 725 |
%</koma> |
| 726 |
% \end{macrocode} |
| 727 |
% \end{macro} |
| 728 |
% |
| 729 |
% \begin{macro}{\KOMA@kav@replacebool} |
| 730 |
% \changes{v3.17}{2015/02/24}{added} |
| 731 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 732 |
% If \cs{FamilyKeyState} is \cs{FamilyKeyStateProcessed}, |
| 733 |
% this macro replaces the value of a if key in the internal list. |
| 734 |
% The first argument is the family member, the second the \meta{key} and the |
| 735 |
% third is the boolean switch (\cs{if\dots} statement) representing the new value. |
| 736 |
% \begin{macrocode} |
| 737 |
%<*koma> |
| 738 |
\newcommand*{\KOMA@kav@replacebool}[3]{% |
| 739 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 740 |
\@ifundefined{scr@kav@KOMA.#1}{% |
| 741 |
\KOMA@internal@error\KOMA@kav@replacebool{#1}% |
| 742 |
}{% |
| 743 |
\KOMA@kav@remove{#1}{#2}{false}% |
| 744 |
\KOMA@kav@remove{#1}{#2}{true}% |
| 745 |
\expandafter\ifx\csname if#3\expandafter\endcsname |
| 746 |
\csname iftrue\endcsname |
| 747 |
\KOMA@kav@xadd{#1}{#2}{true}% |
| 748 |
\else |
| 749 |
\KOMA@kav@xadd{#1}{#2}{false}% |
| 750 |
\fi |
| 751 |
}% |
| 752 |
\fi |
| 753 |
} |
| 754 |
%</koma> |
| 755 |
% \end{macrocode} |
| 756 |
% \end{macro} |
| 757 |
% |
| 758 |
% \begin{macro}{\KOMA@kav@defall} |
| 759 |
% \changes{v3.17}{2015/02/24}{added} |
| 760 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 761 |
% This macro defines a macro/command with the \texttt{\meta{key}=\meta{value}} |
| 762 |
% list of all stored pairs. The first argument is the macro/command to be |
| 763 |
% defined with the list. The second is the family member. |
| 764 |
% \begin{macrocode} |
| 765 |
%<*koma> |
| 766 |
\newcommand*{\KOMA@kav@defall}[2]{% |
| 767 |
\@ifundefined{scr@kav@KOMA.#2}{% |
| 768 |
\KOMA@internal@error\KOMA@kav@defall{#1}% |
| 769 |
}{% |
| 770 |
\begingroup |
| 771 |
\let\reserved@a\@empty |
| 772 |
\def\reserved@b##1##2{\l@addto@macro\reserved@a{,{##1=##2}}}% |
| 773 |
\def\do##1{\reserved@b##1}% |
| 774 |
\@nameuse{scr@kav@KOMA.#2}% |
| 775 |
\ifx\reserved@a\@empty |
| 776 |
\def\reserved@b{\endgroup\let#1\@empty}% |
| 777 |
\else |
| 778 |
\edef\reserved@b{% |
| 779 |
\unexpanded{\endgroup\def#1}{% |
| 780 |
\unexpanded |
| 781 |
\expandafter\expandafter\expandafter{% |
| 782 |
\expandafter\@gobble\reserved@a}}}% |
| 783 |
\fi |
| 784 |
\reserved@b |
| 785 |
}% |
| 786 |
} |
| 787 |
%</koma> |
| 788 |
% \end{macrocode} |
| 789 |
% \end{macro} |
| 790 |
% |
| 791 |
% \begin{macro}{\KOMA@kav@defone} |
| 792 |
% \changes{v3.17}{2015/02/25}{added} |
| 793 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 794 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 795 |
% This macro defines a macro/command with all stored values of a \meta{key} |
| 796 |
% from the internal list of \texttt{\meta{key}=\meta{value}} pairs. |
| 797 |
% The first argument is the macro/command to be defined. The second is the |
| 798 |
% family member and the third is the \meta{key}. |
| 799 |
% \begin{macrocode} |
| 800 |
%<*koma> |
| 801 |
\newcommand*{\KOMA@kav@defone}[3]{% |
| 802 |
\@ifundefined{scr@kav@KOMA.#2}{% |
| 803 |
\KOMA@internal@error\KOMA@kav@defall{#1}% |
| 804 |
}{% |
| 805 |
\begingroup |
| 806 |
\let\reserved@a\@empty |
| 807 |
\def\reserved@b##1##2{% |
| 808 |
\Ifstr{##1}{#3}{\l@addto@macro\reserved@a{,{##2}}}{}% |
| 809 |
}% |
| 810 |
\def\do##1{\reserved@b##1}% |
| 811 |
\@nameuse{scr@kav@KOMA.#2}% |
| 812 |
\ifx\reserved@a\@empty |
| 813 |
\def\reserved@b{\endgroup\let#1\@empty}% |
| 814 |
\else |
| 815 |
\edef\reserved@b{% |
| 816 |
\unexpanded{\endgroup\def#1}{% |
| 817 |
\unexpanded |
| 818 |
\expandafter\expandafter\expandafter{% |
| 819 |
\expandafter\@gobble\reserved@a}}}% |
| 820 |
\fi |
| 821 |
\reserved@b |
| 822 |
}% |
| 823 |
} |
| 824 |
%</koma> |
| 825 |
% \end{macrocode} |
| 826 |
% \end{macro} |
| 827 |
% |
| 828 |
% \begin{macro}{\KOMA@internal@error} |
| 829 |
% \changes{v3.17}{2015/02/24}{added} |
| 830 |
% \changes{v3.39}{2022/11/11}{bug report address changed} |
| 831 |
% General internal error message with the recommendation to report a bug. |
| 832 |
% \begin{macrocode} |
| 833 |
%<*koma> |
| 834 |
\newcommand*{\KOMA@internal@error}[2]{% |
| 835 |
\PackageError{scrkbase}{internal error using \string#1{#2}}{% |
| 836 |
You've found an internal error either in KOMA-Script or a third |
| 837 |
party\MessageBreak |
| 838 |
definition, that uses KOMA-Script internal macros.\MessageBreak |
| 839 |
Please send a bug report with a minimal but complete example, |
| 840 |
that\MessageBreak |
| 841 |
shows this error, to komascript at gmx dot info or report it |
| 842 |
at\MessageBreak |
| 843 |
<https://sf.net/p/koma-script/tickets/> (you need an account to do so).% |
| 844 |
}% |
| 845 |
} |
| 846 |
%</koma> |
| 847 |
% \end{macrocode} |
| 848 |
% \end{macro} |
| 849 |
% |
| 850 |
% \subsection{Options} |
| 851 |
% |
| 852 |
% From version 2.97c \KOMAScript{} processes all options in the order they |
| 853 |
% have been set and no longer in the order they have been defined. This is |
| 854 |
% much more intuitive for users. Packages first process the global options |
| 855 |
% then the local options. |
| 856 |
% |
| 857 |
% \begin{macro}{\@globaloptionslist} |
| 858 |
% \changes{v2.96}{2006/11/26}{added} |
| 859 |
% \changes{v2.96}{2006/11/26}{process class options} |
| 860 |
% \changes{v3.20}{2016/02/06}{delay decisions} |
| 861 |
% The lost of global options is sometimes needed. But because \pkg{xkeyval} |
| 862 |
% has the opinion it should remove all options with equal char from the list |
| 863 |
% of class options, we define out own macro with a copy of the class |
| 864 |
% options. Until \KOMAScript{} 3.19a the copy has been done here. But if |
| 865 |
% \pkg*{scrbase} is loaded before \cs{documentclass} this is too early. From |
| 866 |
% \KOMAScript{} 3.20 the assignment has been moved to |
| 867 |
% \cs{FamilyProcessOptions}. And from \KOMAScript{} 3.33 the normal class |
| 868 |
% option list is only used if the raw option list is not available. |
| 869 |
% \begin{macrocode} |
| 870 |
%<*base> |
| 871 |
\newcommand*{\@globaloptionslist}{} |
| 872 |
%</base> |
| 873 |
% \end{macrocode} |
| 874 |
% \end{macro} |
| 875 |
% |
| 876 |
% \begin{macro}{\scr@removeunused,\scr@optiontest,\scr@pti@ntest} |
| 877 |
% \changes{v2.97c}{2007/04/18}{added} |
| 878 |
% \changes{v3.12}{2013/03/04}{removed} |
| 879 |
% \end{macro}^^A \scr@removeunused,\scr@optiontest,\scr@pti@ntest |
| 880 |
% |
| 881 |
% \begin{command}{\FamilyProcessOptions} |
| 882 |
% \changes{v3.00}{2008/04/30}{added} |
| 883 |
% \changes{v3.11a}{2012/06/11}{classes do not report errors for unknown values} |
| 884 |
% \changes{v3.12}{2013/03/04}{error handling} |
| 885 |
% \changes{v3.33}{2021/03/02}{new version using raw options lists of \LaTeX{} |
| 886 |
% 2021/05/01} |
| 887 |
% Note: Wrong values should not result in errors or warnings and only seldom |
| 888 |
% in information. The best is to signal all kind of errors via |
| 889 |
% \cs{FamilyKeyState}. Only values, that cannot be handled by any family |
| 890 |
% member have to be reported. This is done inside \cs{FamilyProcessOptions} |
| 891 |
% depending on \cs{FamilyKeyState} of each member. |
| 892 |
% Note also: This command is not re-entrant. So it cannot be used while |
| 893 |
% processing another option. |
| 894 |
% Note also: We use 2021/05/01 instead of the official \LaTeX{} release date, |
| 895 |
% to detect a \LaTeX{} kernel version with raw option lists, because there |
| 896 |
% were relevant earlier \LaTeX{} developer releases with that date. |
| 897 |
% \begin{macrocode} |
| 898 |
%<*base> |
| 899 |
\IncludeInRelease{2021/05/01}{\FamilyProcessOptions}% |
| 900 |
{Usage of raw or classic option list} |
| 901 |
\newcommand*{\FamilyProcessOptions}[2][.\@currname.\@currext]{% |
| 902 |
% \end{macrocode} |
| 903 |
% Before processing of the options we have to execute an initialise several |
| 904 |
% hooks: |
| 905 |
% \begin{macrocode} |
| 906 |
\ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions |
| 907 |
\PackageError{scrbase}{nested \string\FamilyProcessOptions\space |
| 908 |
detected\MessageBreak}{% |
| 909 |
\string\FamilyProcessOptions\space has been used while processing or |
| 910 |
setting options.\MessageBreak |
| 911 |
This is currently not allowed. You should contact the author of the |
| 912 |
causing\MessageBreak |
| 913 |
code.\MessageBreak |
| 914 |
This error is fatal. You should not continue.% |
| 915 |
}% |
| 916 |
\fi |
| 917 |
\scr@ifundefinedorrelax{scr@before@process@options@#2@hook}{}{% |
| 918 |
\@nameuse{scr@before@process@options@#2@hook}% |
| 919 |
}% |
| 920 |
\scr@ifundefinedorrelax{scr@before@process@options@#2#1@hook}{}{% |
| 921 |
\@nameuse{scr@before@process@options@#2#1@hook}% |
| 922 |
\expandafter\let\csname scr@before@process@options@#2#1@hook\endcsname |
| 923 |
\relax |
| 924 |
}% |
| 925 |
\scr@ifundefinedorrelax{scr@after@options@#2@hook}{% |
| 926 |
\@namedef{scr@after@options@#2@hook}{% |
| 927 |
\@namedef{scr@after@options@#2@hook}{}% |
| 928 |
}% |
| 929 |
}{% |
| 930 |
\expandafter\edef\csname scr@after@options@#2@hook\endcsname{% |
| 931 |
\noexpand\@namedef{scr@after@options@#2@hook}{% |
| 932 |
\unexpanded\expandafter\expandafter\expandafter |
| 933 |
{\csname scr@after@options@#2@hook\endcsname}% |
| 934 |
}% |
| 935 |
}% |
| 936 |
}% |
| 937 |
\ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate |
| 938 |
\@namedef{scr@after@options@#2@hook@topmost}{% |
| 939 |
\@namedef{scr@after@options@#2@hook@topmost}{}% |
| 940 |
}% |
| 941 |
\expandafter\l@addto@macro\csname scr@after@options@#2@hook\endcsname{% |
| 942 |
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate |
| 943 |
\@nameuse{scr@after@options@#2@hook@topmost}% |
| 944 |
}% |
| 945 |
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions |
| 946 |
\fi |
| 947 |
\let\ds@\@empty |
| 948 |
% \end{macrocode} |
| 949 |
% Here we set up \cs{@curroptions} to the raw options of the current class or |
| 950 |
% package or empty if the options are not defined. |
| 951 |
% \begin{macrocode} |
| 952 |
\@ifundefined{@raw@opt@\@currname.\@currext}{% |
| 953 |
\let\@curroptions\@empty |
| 954 |
}{% |
| 955 |
\expandafter\let\expandafter\@curroptions |
| 956 |
\csname @raw@opt@\@currname.\@currext\endcsname |
| 957 |
}% |
| 958 |
% \end{macrocode} |
| 959 |
% If this is not a class, we first have to process all raw class options. |
| 960 |
% \changes{v3.33}{2021/03/12}{switched to fast test like \LaTeX{} 2021/06/01} |
| 961 |
% \changes{v3.34}{2021/05/30}{use \cs{@raw@classoptionslist} only, if defined} |
| 962 |
% Note, if \pkg*{scrbase} or a depending package is loaded before the class, |
| 963 |
% \cs{@raw@classoptionslist} should not be processed. |
| 964 |
% \begin{macrocode} |
| 965 |
\ifx\@currext\@clsextension\else |
| 966 |
\@ifundefined{@raw@classoptionslist}{}{% |
| 967 |
\@for\CurrentOption:=\@raw@classoptionslist\do{% |
| 968 |
\scr@trim@spaces\CurrentOption |
| 969 |
\ifx\CurrentOption\@empty\else |
| 970 |
% \end{macrocode} |
| 971 |
% \changes{v3.41}{2023/04/26}{only one step expansion while classic option |
| 972 |
% test} |
| 973 |
% Because we are using the raw option list, we do only a one step expansion of |
| 974 |
% \cs{CurrentOption} here, because a full expansion could break. |
| 975 |
% \begin{macrocode} |
| 976 |
\@ifundefined{ds@\expandafter\detokenize\expandafter{\CurrentOption}}{% |
| 977 |
\scr@ifprocess@curroption{#1}{#2}{% |
| 978 |
\@expandtwoargs\@removeelement{% |
| 979 |
\expandafter\@remove@eq@value\CurrentOption=\@nil}% |
| 980 |
\@unusedoptionlist\@unusedoptionlist |
| 981 |
}{}% |
| 982 |
}{% |
| 983 |
\@use@ption |
| 984 |
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty |
| 985 |
}% |
| 986 |
\fi |
| 987 |
}% |
| 988 |
}% |
| 989 |
\fi |
| 990 |
% \end{macrocode} |
| 991 |
% \changes{v3.34}{2021/06/05}{extra test because of \LaTeX{} raw option issue} |
| 992 |
% Afterwards we have to process the current options. Unfortunately there is an |
| 993 |
% issue with the raw option list of the \LaTeX{} kernel, that could result in |
| 994 |
% \cs{CurrentOption} in the option list instead of the one step expansion of |
| 995 |
% \cs{CurrentOption} (see |
| 996 |
% \url{https://sourceforge.net/p/koma-script/tickets/10/}). This would result |
| 997 |
% in an infinite loop using the usual loop: |
| 998 |
% \begin{macrocode} |
| 999 |
%<*dontusethis> |
| 1000 |
\@for\CurrentOption:=\@curroptions\do{% |
| 1001 |
\scr@trim@spaces\CurrentOption |
| 1002 |
% \end{macrocode} |
| 1003 |
% \changes{v3.41}{2023/04/26}{only one step expansion while classic option |
| 1004 |
% test} |
| 1005 |
% Because we are using the raw option list, we do only a one step expansion of |
| 1006 |
% \cs{CurrentOption} here, because a full expansion could break. |
| 1007 |
% \begin{macrocode} |
| 1008 |
\@ifundefined{ds@\expandafter\detokenize\expandafter{\CurrentOption}}{% |
| 1009 |
\@use@ption |
| 1010 |
\scr@ifprocess@curroption{#1}{#2}{}\default@ds |
| 1011 |
}\@use@ption |
| 1012 |
}% |
| 1013 |
%</dontusethis> |
| 1014 |
% \end{macrocode} |
| 1015 |
% So for a little more rosbustnes we do an extra test. |
| 1016 |
% \begin{macrocode} |
| 1017 |
\@for\reserved@a:=\@curroptions\do{% |
| 1018 |
\scr@trim@spaces\reserved@a |
| 1019 |
\def\reserved@b{\CurrentOption}% |
| 1020 |
\ifx\reserved@a\reserved@b |
| 1021 |
\PackageError{scrbase}{% |
| 1022 |
\string\CurrentOption\space loop detected\MessageBreak |
| 1023 |
Perhaps someone uses:\MessageBreak\space\space |
| 1024 |
\ifx\@currext\@clsextension |
| 1025 |
\string\PassOptionsToClass |
| 1026 |
\else |
| 1027 |
\string\PassOptionsToPackage |
| 1028 |
\fi |
| 1029 |
{\string\CurrentOption}{…}.\MessageBreak |
| 1030 |
With LaTeX 2020/10/01 or 2021/06/01 this results in |
| 1031 |
\string\CurrentOption\MessageBreak |
| 1032 |
in the raw option list and therefore is not allowed.\MessageBreak |
| 1033 |
Please ask the class or package author to use:\MessageBreak\space\space |
| 1034 |
\string\expandafter |
| 1035 |
\ifx\@currext\@clsextension |
| 1036 |
\string\PassOptionsToClass |
| 1037 |
\else |
| 1038 |
\string\PassOptionsToPackage |
| 1039 |
\fi |
| 1040 |
\MessageBreak\space\space\space |
| 1041 |
\string\expandafter{\string\CurrentOption}{…}\MessageBreak |
| 1042 |
instead or update LaTeX (if possible)% |
| 1043 |
}% |
| 1044 |
\let\CurrentOption\@empty |
| 1045 |
\else |
| 1046 |
\let\CurrentOption\reserved@a |
| 1047 |
\fi |
| 1048 |
% \end{macrocode} |
| 1049 |
% \changes{v3.41}{2023/04/26}{only one step expansion while classic option |
| 1050 |
% test} |
| 1051 |
% Because we are using the raw option list, we do only a one step expansion of |
| 1052 |
% \cs{CurrentOption} here, because a full expansion could break. |
| 1053 |
% \begin{macrocode} |
| 1054 |
\@ifundefined{ds@\expandafter\detokenize\expandafter{\CurrentOption}}{% |
| 1055 |
\@use@ption |
| 1056 |
\scr@ifprocess@curroption{#1}{#2}{}\default@ds |
| 1057 |
}\@use@ption |
| 1058 |
}% |
| 1059 |
% \end{macrocode} |
| 1060 |
% Clear all the definitions for declared options and the current option. Then |
| 1061 |
% reset the marker macro, initiate emptying the unprocessed options list of |
| 1062 |
% the current file and execute the exit hook. |
| 1063 |
% \begin{macrocode} |
| 1064 |
\@for\CurrentOption:=\@declaredoptions\do{% |
| 1065 |
\expandafter\let\csname ds@\CurrentOption\endcsname\relax}% |
| 1066 |
\let\CurrentOption\@empty |
| 1067 |
\let\@fileswith@pti@ns\@@fileswith@pti@ns |
| 1068 |
\AtEndOfPackage{\expandafter\let |
| 1069 |
\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 1070 |
\relax}% |
| 1071 |
\@nameuse{scr@after@options@#2@hook}% |
| 1072 |
} |
| 1073 |
\EndIncludeInRelease |
| 1074 |
% \end{macrocode} |
| 1075 |
% And here the old version for old \LaTeX{} kernel version: |
| 1076 |
% \begin{macrocode} |
| 1077 |
\IncludeInRelease{0000/00/00}{\FamilyProcessOptions}% |
| 1078 |
{Usage of raw or classic option list} |
| 1079 |
\newcommand*{\FamilyProcessOptions}[2][.\@currname.\@currext]{% |
| 1080 |
\ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions |
| 1081 |
\PackageError{scrbase}{nested \string\FamilyProcessOptions\space |
| 1082 |
detected\MessageBreak}{% |
| 1083 |
\string\FamilyProcessOptions\space has been used while processing or |
| 1084 |
setting options.\MessageBreak |
| 1085 |
This is currently not allowed. You should contact the author of the |
| 1086 |
causing\MessageBreak |
| 1087 |
code.\MessageBreak |
| 1088 |
This error is fatal. You should not continue.% |
| 1089 |
}% |
| 1090 |
\fi |
| 1091 |
% \end{macrocode} |
| 1092 |
% \changes{v3.18}{2015/06/17}{new hooks before processing the options} |
| 1093 |
% From version 3.18 we execute two hooks. The first one is valid for all |
| 1094 |
% classes and packages of a family. This is multi-time hook, not deleting |
| 1095 |
% itself. The second one is valid only one time for one member. |
| 1096 |
% \begin{macrocode} |
| 1097 |
\scr@ifundefinedorrelax{scr@before@process@options@#2@hook}{}{% |
| 1098 |
\@nameuse{scr@before@process@options@#2@hook}% |
| 1099 |
}% |
| 1100 |
\scr@ifundefinedorrelax{scr@before@process@options@#2#1@hook}{}{% |
| 1101 |
\@nameuse{scr@before@process@options@#2#1@hook}% |
| 1102 |
\expandafter\let\csname scr@before@process@options@#2#1@hook\endcsname |
| 1103 |
\relax |
| 1104 |
}% |
| 1105 |
% \end{macrocode} |
| 1106 |
% \changes{v3.23}{2017/02/16}{fix: the after hook uses the family instead of |
| 1107 |
% the member} |
| 1108 |
% Initialization of \cs{AtEndOfFamilyOptions} inclusive hook. |
| 1109 |
% \begin{macrocode} |
| 1110 |
\scr@ifundefinedorrelax{scr@after@options@#2@hook}{% |
| 1111 |
\@namedef{scr@after@options@#2@hook}{% |
| 1112 |
% \end{macrocode} |
| 1113 |
% The first hook action is to delete the hook. |
| 1114 |
% \begin{macrocode} |
| 1115 |
\@namedef{scr@after@options@#2@hook}{}% |
| 1116 |
}% |
| 1117 |
}{% |
| 1118 |
\expandafter\edef\csname scr@after@options@#2@hook\endcsname{% |
| 1119 |
% \end{macrocode} |
| 1120 |
% The first action in the hook is to reactivate the current hook. |
| 1121 |
% \begin{macrocode} |
| 1122 |
\noexpand\@namedef{scr@after@options@#2@hook}{% |
| 1123 |
\unexpanded\expandafter\expandafter\expandafter |
| 1124 |
{\csname scr@after@options@#2@hook\endcsname}% |
| 1125 |
}% |
| 1126 |
}% |
| 1127 |
}% |
| 1128 |
% \end{macrocode} |
| 1129 |
% \changes{v3.23}{2017/02/16}{new hook added for \cs{AtEndOfFamilyOptions*}} |
| 1130 |
% From version 3.23 there is one more hook before \cs{AtEndOfFamilyOptions*} |
| 1131 |
% to be initialized and executed. We can detect the topmost level comparing |
| 1132 |
% the definition of \cs{AtEndOfFamilyOptions}. This is faster than by the |
| 1133 |
% definition of the hook itself (we have to do so in \cs{FamilyOptions}). |
| 1134 |
% \begin{macrocode} |
| 1135 |
\ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate |
| 1136 |
\@namedef{scr@after@options@#2@hook@topmost}{% |
| 1137 |
% \end{macrocode} |
| 1138 |
% The hook definitions also contains the hook deletion. This is important for |
| 1139 |
% recursive calls, to distinguish lower levels from the topmost level. |
| 1140 |
% \begin{macrocode} |
| 1141 |
\@namedef{scr@after@options@#2@hook@topmost}{}% |
| 1142 |
}% |
| 1143 |
% \end{macrocode} |
| 1144 |
% The top hook is added to the hook of the (topmost) level, while resetting |
| 1145 |
% the definition of \cs{AtEndOfFamilyOptions}. |
| 1146 |
% \begin{macrocode} |
| 1147 |
\expandafter\l@addto@macro\csname scr@after@options@#2@hook\endcsname{% |
| 1148 |
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate |
| 1149 |
\@nameuse{scr@after@options@#2@hook@topmost}% |
| 1150 |
}% |
| 1151 |
% \end{macrocode} |
| 1152 |
% Don't forget to change the command to fill one of the hooks from immediate |
| 1153 |
% execution to adding code to the corresponding hook. |
| 1154 |
% \begin{macrocode} |
| 1155 |
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions |
| 1156 |
\fi |
| 1157 |
% \end{macrocode} |
| 1158 |
% Continue the adaption of code from \cs{ProcessOptions}. |
| 1159 |
% \changes{v3.42}{2023/07/14}{\cs{edef} replaced by \cs{protected@edef}} |
| 1160 |
% \begin{macrocode} |
| 1161 |
\let\ds@\@empty |
| 1162 |
\protected@edef\@curroptions{\@ptionlist{\@currname.\@currext}}% |
| 1163 |
\ifx\@currext\@clsextension\else |
| 1164 |
% \end{macrocode} |
| 1165 |
% Within classes the current option list is same like the global option |
| 1166 |
% list. So classes are not allowed to process the global option list |
| 1167 |
% additionally to the local one. But packages do process the global option |
| 1168 |
% list, but do not report errors or warnings about these options. |
| 1169 |
% \changes{v3.18}{2015/06/17}{handling of not defined \cs{@globaloptionslist}} |
| 1170 |
% \changes{v3.20}{2016/02/06}{\cs{@globaloptionslist} assignment always} |
| 1171 |
% \begin{macrocode} |
| 1172 |
\let\@globaloptionslist\@classoptionslist |
| 1173 |
\scr@ifundefinedorrelax{XKV@classoptionslist}{% |
| 1174 |
%<trace> \PackageInfo{scrbase}{Using \string\@classoptionslist}% |
| 1175 |
}{% |
| 1176 |
\ifx\XKV@classoptionslist\@empty |
| 1177 |
%<trace> \PackageInfo{scrbase}{Using \string\@classoptionslist}% |
| 1178 |
\else |
| 1179 |
%<trace> \PackageInfo{scrbase}{Using \string\XKV@classoptionslist}% |
| 1180 |
\let\@globaloptionslist\XKV@classoptionslist |
| 1181 |
\fi |
| 1182 |
}% |
| 1183 |
\scr@ifundefinedorrelax{@globaloptionslist}{}{% |
| 1184 |
\@for\CurrentOption:=\@globaloptionslist\do{% |
| 1185 |
% \end{macrocode} |
| 1186 |
% The options are processed in the order they have been set into the global |
| 1187 |
% option list. But only these options are processed, that are not empty and |
| 1188 |
% that are known by the current package. So these are only classic options not |
| 1189 |
% \pkg{keyval} options. |
| 1190 |
% \begin{macrocode} |
| 1191 |
\ifx\CurrentOption\@empty\else |
| 1192 |
\@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}% |
| 1193 |
\ifin@ |
| 1194 |
\@use@ption |
| 1195 |
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty |
| 1196 |
\else |
| 1197 |
% \end{macrocode} |
| 1198 |
% But if they are not classic options, they could be \pkg{keyval} options. In |
| 1199 |
% this case we test, if member (\texttt{\#1}) of family (\texttt{\#2}) has |
| 1200 |
% such an option. If this is the case, the options is executed once with |
| 1201 |
% member and once again with member. In case of an unknown key or value |
| 1202 |
% nothing else happens. |
| 1203 |
% \begin{macrocode} |
| 1204 |
\scr@ifprocess@curroption{#1}{#2}{% |
| 1205 |
\@expandtwoargs\@removeelement\CurrentOption |
| 1206 |
\@unusedoptionlist\@unusedoptionlist |
| 1207 |
}{}% |
| 1208 |
\fi |
| 1209 |
\fi |
| 1210 |
}% |
| 1211 |
}% |
| 1212 |
\fi |
| 1213 |
% \end{macrocode} |
| 1214 |
% Now, processing local options of classes and packages follows. In this case |
| 1215 |
% unknown options (keys) or values of packages immediately can result in error |
| 1216 |
% messages. But in classes they are only added to the list of unused global |
| 1217 |
% options. |
| 1218 |
% \begin{macrocode} |
| 1219 |
\@for\CurrentOption:=\@curroptions\do{% |
| 1220 |
% \end{macrocode} |
| 1221 |
% \changes{v3.26}{2018/10/22}{options are not fully expanded for the tests} |
| 1222 |
% \changes{v3.26}{2018/10/22}{\cs{@use@ption} is not used for |
| 1223 |
% \texttt{\meta{key}\quotechar=\meta{value}} options} |
| 1224 |
% From \KOMAScript~3.26 the options are not fully expanded to test, if it is a |
| 1225 |
% classic option. The essential expansion already has been done. So removing |
| 1226 |
% the full expansion avoids errors because of missing |
| 1227 |
% \cs{endcsname}. Additionally using \cs{@use@option} hat been removed for all |
| 1228 |
% \texttt{\meta{key}=\meta{value}} options, because this would result in the |
| 1229 |
% same error because of the |\csname ds@\CurrentOption\endcsname|, that is |
| 1230 |
% used inside \cs{@use@option}. Instead of \cs{@use@option} we just remove the |
| 1231 |
% option from the list of unused options. |
| 1232 |
% \begin{macrocode} |
| 1233 |
\edef\reserved@a{\expandafter\detokenize\expandafter{\CurrentOption}}% |
| 1234 |
\scr@ifundefinedorrelax{ds@\reserved@a}{% |
| 1235 |
\@expandtwoargs\@removeelement\CurrentOption |
| 1236 |
\@unusedoptionlist\@unusedoptionlist |
| 1237 |
\scr@ifprocess@curroption{#1}{#2}{}\default@ds |
| 1238 |
}\@use@ption |
| 1239 |
}% |
| 1240 |
% \end{macrocode} |
| 1241 |
% Almost at the end we delete the options code of all declared options. This |
| 1242 |
% is the same as with the \LaTeX{} kernel command |
| 1243 |
% \cs{ProcessOptions*}. Additionally at the end of the package (not |
| 1244 |
% \pkg*{tocbasic} but the package, that is using the command) all unprocessed |
| 1245 |
% options are processed. |
| 1246 |
% \changes{v3.33}{2021/02/15}{prepared for \LaTeX{} 2020/10/01} |
| 1247 |
% \begin{macrocode} |
| 1248 |
\@for\CurrentOption:=\@declaredoptions\do{% |
| 1249 |
\expandafter\let\csname ds@\CurrentOption\endcsname\relax}% |
| 1250 |
\let\CurrentOption\@empty |
| 1251 |
\let\@fileswith@pti@ns\@@fileswith@pti@ns |
| 1252 |
\IfLTXAtLeastTF{2020/10/01}{% |
| 1253 |
\AtEndOfPackage{\expandafter\let |
| 1254 |
\csname unprocessedoptions-\@currname.\@currext\endcsname |
| 1255 |
\relax}% |
| 1256 |
}{% |
| 1257 |
\AtEndOfPackage{\let\@unprocessedoptions\relax}% |
| 1258 |
}% |
| 1259 |
% \end{macrocode} |
| 1260 |
% Last but not least the hook has to be executed and (self-)deleted. |
| 1261 |
% \changes{v3.23}{2017/02/16}{fix using family instead of member} |
| 1262 |
% \begin{macrocode} |
| 1263 |
\@nameuse{scr@after@options@#2@hook}% |
| 1264 |
} |
| 1265 |
\EndIncludeInRelease |
| 1266 |
\@onlypreamble\FamilyProcessOptions |
| 1267 |
% \end{macrocode} |
| 1268 |
% \begin{command}{\BeforeFamilyProcessOptions} |
| 1269 |
% \changes{v3.18}{2015/06/17}{added} |
| 1270 |
% Add code to the hook used immediately before executing the options via |
| 1271 |
% \cs{FamilyProcessOptions}. Neither the family nor the member need to |
| 1272 |
% exist. So you are able to already add code to the hook before the class or |
| 1273 |
% package has been loaded. |
| 1274 |
% \begin{macrocode} |
| 1275 |
\newcommand*{\BeforeFamilyProcessOptions}[3][.\@currname.\@currext]{% |
| 1276 |
\scr@ifundefinedorrelax{scr@before@process@options@#2#1@hook}{% |
| 1277 |
\@namedef{scr@before@process@options@#2#1@hook}{#3}% |
| 1278 |
}{% |
| 1279 |
\expandafter\g@addto@macro |
| 1280 |
\csname scr@before@process@options@#2#1@hook\endcsname{#3}% |
| 1281 |
}% |
| 1282 |
} |
| 1283 |
% \end{macrocode} |
| 1284 |
% \end{command}^^A \BeforeFamilyProcessOptions |
| 1285 |
% \begin{command}{\AtEndOfFamilyOptions} |
| 1286 |
% \changes{v3.12}{2013/03/04}{added} |
| 1287 |
% \changes{v3.23}{2017/02/16}{star variant added} |
| 1288 |
% Inside the code of an option you can delay execution of code till the end of |
| 1289 |
% the current \cs{FamilyProcessOptions}, \cs{FamilyExecuteOptions}, |
| 1290 |
% \cs{FamilyOptions} or \cs{FamilyOption}. The only argument is the code. The |
| 1291 |
% argument is delegated to \cs{l@addto@macro} (instead of reading it |
| 1292 |
% directly). The non-star variant delays only till the end of the current |
| 1293 |
% level. The star-variant delays till the end of all levels. |
| 1294 |
% \begin{macro}{\scr@AtEndOfFamilyOptions} |
| 1295 |
% \changes{v3.12}{2013/05/29}{added} |
| 1296 |
% \begin{macro}{\scr@@AtEndOfFamilyOptions,\scr@AtEndOfFamilyOptions@immediate} |
| 1297 |
% \changes{v3.23}{2017/02/16}{added} |
| 1298 |
% \begin{macrocode} |
| 1299 |
\newcommand*{\scr@AtEndOfFamilyOptions}{% |
| 1300 |
\kernel@ifstar {\scr@@AtEndOfFamilyOptions{@topmost}}% |
| 1301 |
{\scr@@AtEndOfFamilyOptions\@empty}% |
| 1302 |
} |
| 1303 |
\newcommand*{\scr@@AtEndOfFamilyOptions}[1]{% |
| 1304 |
\expandafter |
| 1305 |
\l@addto@macro\csname scr@after@options@\FamilyOfKey @hook#1\endcsname |
| 1306 |
} |
| 1307 |
\newcommand*{\scr@AtEndOfFamilyOptions@immediate}{% |
| 1308 |
\kernel@ifstar {\@firstofone}{\@firstofone}% |
| 1309 |
} |
| 1310 |
\newcommand*{\AtEndOfFamilyOptions}{} |
| 1311 |
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate |
| 1312 |
% \end{macrocode} |
| 1313 |
% \end{macro}^^A \scr@@AtEndOfFamilyOptions,\scr@AtEndOfFamilyOptions@immediate |
| 1314 |
% \end{macro}^^A \scr@AtEndOfFamilyOptions |
| 1315 |
% \end{command}^^A \AtEndOfFamilyOptions |
| 1316 |
% \begin{macro}{\scr@ifprocess@curroption} |
| 1317 |
% \changes{v3.13}{2014/01/04}{brackets around \cs{CurrentOption} inside \cs{setkeys}} |
| 1318 |
% This macro executes the current \pkg{keyval} option for member |
| 1319 |
% \texttt{\#1} of family \texttt{\#2}. If the option does not know the value, |
| 1320 |
% the forth argument is used. Otherwise it is ignored. Note, before the member |
| 1321 |
% option the family option is executed. If this is successful the member does |
| 1322 |
% not need to know the option. |
| 1323 |
% \begin{macrocode} |
| 1324 |
\newcommand*\scr@ifprocess@curroption[2]{% |
| 1325 |
% \end{macrocode} |
| 1326 |
% \changes{v3.26}{2018/10/22}{using \cs{scr@sp@def} instead of \cs{def} for |
| 1327 |
% splitting the key} |
| 1328 |
% Because white spaces are not always and forever removed from the option |
| 1329 |
% list, here \cs{scr@sp@def} is used to eliminate unwanted white spaces before |
| 1330 |
% the key, before and after the equal sign and at the end of the value. |
| 1331 |
% \begin{macrocode} |
| 1332 |
\def\reserved@a##1=##2\@nil{\scr@sp@def\reserved@a{##1}}% |
| 1333 |
\expandafter\reserved@a\CurrentOption=\@nil |
| 1334 |
\scr@ifundefinedorrelax{KV@#2@\reserved@a}{% |
| 1335 |
\scr@ifundefinedorrelax{KV@#2#1@\reserved@a}{% |
| 1336 |
\let\FamilyKeyState\OptionNotUsed |
| 1337 |
}{% |
| 1338 |
\protected@edef\reserved@b{\noexpand\setkeys{#2#1}{{\CurrentOption}}% |
| 1339 |
\noexpand\def\noexpand\CurrentOption{\CurrentOption}}% |
| 1340 |
\reserved@b |
| 1341 |
\ifx\FamilyKeyState\FamilyKeyStateUnknown |
| 1342 |
\PackageInfo{scrbase}{Unknown processing state.\MessageBreak |
| 1343 |
Processing option `\CurrentOption'\MessageBreak |
| 1344 |
of member `#1' of family\MessageBreak |
| 1345 |
`#2' doesn't set\MessageBreak |
| 1346 |
a valid state. This will be interpreted\MessageBreak |
| 1347 |
as \string\FamilyKeyStateProcessed |
| 1348 |
}% |
| 1349 |
\FamilyKeyStateProcessed |
| 1350 |
\fi |
| 1351 |
}{% |
| 1352 |
\let\FamilyKeyState\OptionNotUsed |
| 1353 |
}% |
| 1354 |
}{% |
| 1355 |
\protected@edef\reserved@b{\noexpand\setkeys{#2}{{\CurrentOption}}% |
| 1356 |
\noexpand\def\noexpand\CurrentOption{\CurrentOption}}% |
| 1357 |
\reserved@b |
| 1358 |
\ifx\FamilyKeyState\FamilyKeyStateUnknown |
| 1359 |
\PackageInfo{scrbase}{Unknown processing state.\MessageBreak |
| 1360 |
Processing option `\CurrentOption'\MessageBreak |
| 1361 |
of family `#2'\MessageBreak |
| 1362 |
doesn't set a valid state.\MessageBreak |
| 1363 |
This will be interpreted\MessageBreak |
| 1364 |
as \string\FamilyKeyStateProcessed |
| 1365 |
}% |
| 1366 |
\FamilyKeyStateProcessed |
| 1367 |
\fi |
| 1368 |
\def\reserved@a##1=##2\@nil{\scr@sp@def\reserved@a{##1}}% |
| 1369 |
\expandafter\reserved@a\CurrentOption=\@nil |
| 1370 |
\scr@ifundefinedorrelax{KV@#2#1@\reserved@a}{}{% |
| 1371 |
\protected@edef\reserved@b{\noexpand\setkeys{#2#1}{{\CurrentOption}}% |
| 1372 |
\noexpand\def\noexpand\CurrentOption{\CurrentOption}}% |
| 1373 |
\ifx\FamilyKeyState\FamiliyKeyStateProcessed |
| 1374 |
\reserved@b |
| 1375 |
\FamilyKeyStateProcessed |
| 1376 |
\else |
| 1377 |
\reserved@b |
| 1378 |
\ifx\FamilyKeyState\FamilyKeyStateUnknown |
| 1379 |
\PackageInfo{scrbase}{Unknown processing state.\MessageBreak |
| 1380 |
Processing option `\CurrentOption'\MessageBreak |
| 1381 |
of member `#1' of family\MessageBreak |
| 1382 |
`#2' doesn't set\MessageBreak |
| 1383 |
a valid state. This will be interpreted\MessageBreak |
| 1384 |
as \string\FamilyKeyStateProcessed |
| 1385 |
}% |
| 1386 |
\FamilyKeyStateProcessed |
| 1387 |
\fi |
| 1388 |
\fi |
| 1389 |
}% |
| 1390 |
}% |
| 1391 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 1392 |
\expandafter\@firstoftwo |
| 1393 |
\else |
| 1394 |
\expandafter\@secondoftwo |
| 1395 |
\fi |
| 1396 |
} |
| 1397 |
% \end{macrocode} |
| 1398 |
% \begin{macro}{\scr@sp@d,\scr@sp@b,\scr@sp@c,\scr@sp@def} |
| 1399 |
% \changes{v3.26}{2018/08/29}{moved from \file{tocbasic.dtx} to |
| 1400 |
% \file{scrkernel-basics.dtx} and renamed} |
| 1401 |
% \changes{v3.26b}{2019/01/17}{\cs{long}} |
| 1402 |
% The helper macro \cs{scr@sp@def} defines a macro (\texttt{\#1}) to contain a |
| 1403 |
% token list (\texttt{\#2}) and removes tailing spaces at the beginning an the |
| 1404 |
% end. The original definition was from \pkg{keyval}. The other macros are |
| 1405 |
% helpers to realize \cs{scr@sp@def}. |
| 1406 |
% \begin{macrocode} |
| 1407 |
\def\@tempa#1{% |
| 1408 |
\long\def\scr@sp@def##1##2{% |
| 1409 |
\futurelet\scr@sp@tempa\scr@sp@d##2\@nil\@nil#1\@nil\relax##1}% |
| 1410 |
\def\scr@sp@d{% |
| 1411 |
\ifx\scr@sp@tempa\@sptoken |
| 1412 |
\expandafter\scr@sp@b |
| 1413 |
\else |
| 1414 |
\expandafter\scr@sp@b\expandafter#1% |
| 1415 |
\fi}% |
| 1416 |
\long\def\scr@sp@b#1##1 \@nil{\scr@sp@c##1}% |
| 1417 |
} |
| 1418 |
\@tempa{ } |
| 1419 |
\long\def\scr@sp@c#1\@nil#2\relax#3{\@temptokena{#1}\edef#3{\the\@temptokena}} |
| 1420 |
%</base> |
| 1421 |
% \end{macrocode} |
| 1422 |
% \end{macro}^^A \scr@sp@d,\scr@sp@b,\scr@sp@c,\scr@sp@def |
| 1423 |
% \end{macro}^^A \scr@process@curroption |
| 1424 |
% \end{command}^^A \FamilyProcessOptions |
| 1425 |
% |
| 1426 |
% \begin{command}{\KOMAProcessOptions} |
| 1427 |
% \changes{v2.97c}{2007/04/18}{added} |
| 1428 |
% \changes{v3.00}{2008/04/30}{no optional argument} |
| 1429 |
% This command executes all options, not only classic declared by |
| 1430 |
% \cs{DeclareOption} or \cs{DeclareOption*}, but also \pkg{keyval} options in |
| 1431 |
% the order these options have been used (not declared). For packages first |
| 1432 |
% the global options, than the local options. For classes global and local |
| 1433 |
% options are the same and only local options are processed. This is similar |
| 1434 |
% to the \LaTeX{} kernel command \cs{ProcessOptions*} (with the difference of |
| 1435 |
% processing \pkg{keyval} options too). Family options are always executed |
| 1436 |
% before member options. |
| 1437 |
% \begin{macrocode} |
| 1438 |
%<*koma> |
| 1439 |
\newcommand*{\KOMAProcessOptions}{\FamilyProcessOptions{KOMA}} |
| 1440 |
\@onlypreamble\KOMAProcessOptions |
| 1441 |
%</koma> |
| 1442 |
% \end{macrocode} |
| 1443 |
% \end{command} |
| 1444 |
% |
| 1445 |
% \begin{macro}{\scr@trim@spaces} |
| 1446 |
% \changes{v3.12}{2013/11/06}{added} |
| 1447 |
% \changes{v3.26}{2018/08/29}{moved from \file{scrkernel-language.dtx} to |
| 1448 |
% \file{scrkernel-basics.dtx}} |
| 1449 |
% \changes{v3.33}{2021/03/02}{moved to preparation section} |
| 1450 |
% Helper macro to remove white spaces from the beginning or the end. This is |
| 1451 |
% useful for list processing with \cs{@for} to remove spaces before or after |
| 1452 |
% commas. The argument is a macro with the string to be trimmed and the result |
| 1453 |
% is stored again in this macro. |
| 1454 |
% \begin{macrocode} |
| 1455 |
%<*base> |
| 1456 |
\newcommand\scr@trim@spaces[1]{% |
| 1457 |
\expandafter\scr@sp@def\expandafter#1\expandafter{#1}% |
| 1458 |
} |
| 1459 |
%</base> |
| 1460 |
%</prepare> |
| 1461 |
% \end{macrocode} |
| 1462 |
% \end{macro}^^A \scr@trim@space |
| 1463 |
% |
| 1464 |
% |
| 1465 |
% \begin{option}{internalonly} |
| 1466 |
% \changes{v2.96}{2006/11/26}{added} |
| 1467 |
% \changes{v2.97c}{2007/06/20}{no argument needed} |
| 1468 |
% \changes{v3.27a}{2019/11/04}{\cs{FamilyKeyStateProcessed} added} |
| 1469 |
% \changes{v3.27a}{2019/11/04}{defined only inside the package} |
| 1470 |
% \changes{v3.27a}{2019/11/04}{defined temporary inside the classes} |
| 1471 |
% \changes{v3.28}{2019/11/18}{deprecated} |
| 1472 |
% \begin{macro}{\dont@let@as@internal@defined} |
| 1473 |
% \changes{v2.96}{2006/11/26}{added} |
| 1474 |
% \changes{v3.28}{2019/11/18}{removed} |
| 1475 |
% \end{macro} |
| 1476 |
% \begin{macrocode} |
| 1477 |
%<*option> |
| 1478 |
%<*base> |
| 1479 |
\DefineFamily{KOMA} |
| 1480 |
\DefineFamilyMember{KOMA} |
| 1481 |
\DefineFamilyKey{KOMA}{internalonly}[\relax]{% |
| 1482 |
\PackageInfo{scrbase}{Ignoring deprecated option `internalonly'}% |
| 1483 |
\FamilyKeyStateProcessed |
| 1484 |
} |
| 1485 |
\AtEndOfPackage{% |
| 1486 |
\RelaxFamilyKey[.scrbase.sty]{KOMA}{internalonly}% |
| 1487 |
} |
| 1488 |
%</base> |
| 1489 |
% \end{macrocode} |
| 1490 |
% If \pkg*{scrbase} has been loaded before the class, the option will be |
| 1491 |
% reported as unused, despite it already has been processed. We could solve |
| 1492 |
% this using a dummy option inside the classes. However, because the option is |
| 1493 |
% deprecated the following code should never been used. |
| 1494 |
% \begin{macrocode} |
| 1495 |
%</option> |
| 1496 |
%<*load&class&neveruse> |
| 1497 |
\KOMA@key{internalonly}[\relax]{% |
| 1498 |
\FamilyKeyStateProcessed |
| 1499 |
} |
| 1500 |
\AtEndOfClass{\RelaxFamilyKey[.\KOMAClassFileName]{KOMA}{internalonly}}% |
| 1501 |
%</load&class&neveruse> |
| 1502 |
%<*option> |
| 1503 |
% \end{macrocode} |
| 1504 |
% \end{option} |
| 1505 |
% |
| 1506 |
% |
| 1507 |
% \changes{v2.96}{2006/08/20}{processing options} |
| 1508 |
% \changes{v2.97c}{2007/04/18}{using \cs{KOMAProcessOptions} for processing options} |
| 1509 |
% \begin{macrocode} |
| 1510 |
%<koma>\KOMAProcessOptions\relax |
| 1511 |
%<base>\FamilyProcessOptions{KOMA}\relax |
| 1512 |
%</option> |
| 1513 |
%<*body> |
| 1514 |
% \end{macrocode} |
| 1515 |
% |
| 1516 |
% |
| 1517 |
% \subsection{Some additional math missing from \eTeX} |
| 1518 |
% |
| 1519 |
% \begin{command}{\XdivY} |
| 1520 |
% \changes{v3.05a}{2010/03/10}{added} |
| 1521 |
% \meta{X} divided by \meta{Y} and rounded to the lower integer. |
| 1522 |
% \begin{macrocode} |
| 1523 |
%<*base> |
| 1524 |
\newcommand*{\XdivY}[2]{% |
| 1525 |
\numexpr ( #1 + #2 / 2 ) / #2 - 1\relax |
| 1526 |
} |
| 1527 |
%</base> |
| 1528 |
% \end{macrocode} |
| 1529 |
% \end{command} |
| 1530 |
% |
| 1531 |
% \begin{command}{\XmodY} |
| 1532 |
% \changes{v3.05a}{2010/03/10}{added} |
| 1533 |
% \meta{X} modulo \meta{Y} (rest of integer division \meta{X} divided by \meta{Y}). |
| 1534 |
% \begin{macrocode} |
| 1535 |
%<*base> |
| 1536 |
\newcommand*{\XmodY}[2]{% |
| 1537 |
\numexpr #1 - #2 * \XdivY{#1}{#2}\relax |
| 1538 |
} |
| 1539 |
%</base> |
| 1540 |
% \end{macrocode} |
| 1541 |
% \end{command} |
| 1542 |
% |
| 1543 |
% \subsection{Often needed commands and macros} |
| 1544 |
% |
| 1545 |
% \begin{macro}{\scr@ForEachTrimmedListElement} |
| 1546 |
% \changes{v3.27}{2019/04/16}{new (internal)} |
| 1547 |
% Executes \cs{\#2\{\meta{element}\}} for each \meta{element} of the comma |
| 1548 |
% separated list \#1. Spaces before for after \meta{element} are eliminated |
| 1549 |
% and empty elements are ignored. |
| 1550 |
% \begin{macrocode} |
| 1551 |
%<*base> |
| 1552 |
\newcommand{\scr@ForEachTrimmedListElement}[2]{% |
| 1553 |
\begingroup |
| 1554 |
\def\reserved@a{\endgroup}% |
| 1555 |
\@for \reserved@b:=#1 \do {% |
| 1556 |
\scr@trim@spaces\reserved@b |
| 1557 |
\ifx\reserved@b\@empty\else |
| 1558 |
\edef\reserved@a{% |
| 1559 |
\unexpanded\expandafter{\reserved@a#2}% |
| 1560 |
{\unexpanded\expandafter{\reserved@b}}% |
| 1561 |
}% |
| 1562 |
\fi |
| 1563 |
}% |
| 1564 |
\reserved@a |
| 1565 |
} |
| 1566 |
%</base> |
| 1567 |
% \end{macrocode} |
| 1568 |
% \end{macro}^^A \scr@ForEachTrimmedListElement |
| 1569 |
% |
| 1570 |
% \begin{macro}{\@atdocumenttrue,\@atdocumentfalse,\if@atdocument} |
| 1571 |
% \changes{v2.95}{2002/12/05}{added} |
| 1572 |
% \changes{v3.37}{2022/05/06}{\cs{atdocumenttrue} moved with \LaTeX{} |
| 1573 |
% 2020/10/01 or newer} |
| 1574 |
% The boolean switch becomes true while |\begin{document}|. \KOMAScript{} uses |
| 1575 |
% it for commands and macros, which are different in the document preamble and |
| 1576 |
% the document body. |
| 1577 |
% \begin{macrocode} |
| 1578 |
%<*base> |
| 1579 |
\newif\if@atdocument |
| 1580 |
\IfLTXAtLeastTF{2020/10/01}{% |
| 1581 |
\AddToHook{begindocument/before}{\@atdocumenttrue}% |
| 1582 |
}{% |
| 1583 |
\AtBeginDocument{\@atdocumenttrue}% |
| 1584 |
} |
| 1585 |
\@onlypreamble\@atdocumentrue |
| 1586 |
\@onlypreamble\@atdocumentfalse |
| 1587 |
%</base> |
| 1588 |
% \end{macrocode} |
| 1589 |
% \end{macro} |
| 1590 |
% |
| 1591 |
% \begin{macro}{\let@as@internal@defined} |
| 1592 |
% \changes{v2.95}{2002/08/19}{added} |
| 1593 |
% \changes{v2.95c}{2006/08/12}{warning while redefining} |
| 1594 |
% \changes{v2.96}{2006/11/26}{making user commands from internal macros can |
| 1595 |
% be banned for single macros} |
| 1596 |
% \changes{v2.97c}{2007/06/20}{making user commands from internal macros can |
| 1597 |
% generally banned} |
| 1598 |
% \changes{v3.10}{2010/10/26}{\cs{ignorespaces} at \cs{document} patch added} |
| 1599 |
% \changes{v3.13a}{2014/08/13}{unwanted white spaces removed} |
| 1600 |
% \changes{v3.28}{2019/11/18}{removed} |
| 1601 |
% \end{macro} |
| 1602 |
% |
| 1603 |
% \begin{command}{\ifundefined,\ifundefinedorrelax,\Ifundefinedorrelax} |
| 1604 |
% \changes{v2.95}{2002/08/21}{added} |
| 1605 |
% \changes{v2.95c}{2006/08/12}{using an internal macro to define it} |
| 1606 |
% \changes{v2.97c}{2007/06/20}{\cs{ifundefinedorrelax} replaces \cs{ifundefined}} |
| 1607 |
% \changes{v3.28}{2019/11/18}{\cs{ifundefinedorrelax} renamed to |
| 1608 |
% \cs{Ifundefinedorrelax}} |
| 1609 |
% \changes{v3.29}{2020/01/17}{fix of missing backslash} |
| 1610 |
% Same as \cs{scr@ifundefinedorrelax} but at user level. |
| 1611 |
% \begin{macrocode} |
| 1612 |
%<*base> |
| 1613 |
\newcommand*{\Ifundefinedorrelax}{\scr@ifundefinedorrelax}% |
| 1614 |
%</base> |
| 1615 |
% \end{macrocode} |
| 1616 |
% \end{command} |
| 1617 |
% |
| 1618 |
% \begin{command}{\ifnotundefined,\Ifnotundefined} |
| 1619 |
% \changes{v2.95}{2002/08/21}{added} |
| 1620 |
% \changes{v2.95c}{2006/08/12}{using \eTeX{} if possible} |
| 1621 |
% \changes{v3.02c}{2009/02/19}{\eTeX{} is mandatory} |
| 1622 |
% \changes{v3.28}{2019/11/18}{\cs{ifnotundefined} renamed to \cs{Ifnotundefined}} |
| 1623 |
% This is the opposite to \cs{Ifundefinedorrelax}. Sometimes it is useful. |
| 1624 |
% \begin{macrocode} |
| 1625 |
%<*base> |
| 1626 |
\providecommand*{\ifnotundefined}{% |
| 1627 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1628 |
`\string\ifnotundefined'.\MessageBreak |
| 1629 |
The command has been renamed because of a\MessageBreak |
| 1630 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1631 |
Please replace `\string\ifnotundefined' by `\string\Ifnotundefined'% |
| 1632 |
}% |
| 1633 |
\Ifnotundefined |
| 1634 |
} |
| 1635 |
\newcommand{\Ifnotundefined}[1]{% |
| 1636 |
\ifcsname #1\endcsname |
| 1637 |
\expandafter\@firstoftwo |
| 1638 |
\else |
| 1639 |
\expandafter\@secondoftwo |
| 1640 |
\fi |
| 1641 |
} |
| 1642 |
%</base> |
| 1643 |
% \end{macrocode} |
| 1644 |
% \end{command} |
| 1645 |
% |
| 1646 |
% \begin{command}{\ifstr,\Ifstr} |
| 1647 |
% \changes{v2.95}{2004/07/20}{\meta{if code} and \meta{then code} delegated |
| 1648 |
% after the command execution} |
| 1649 |
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}} |
| 1650 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr} (but still |
| 1651 |
% available as deprecated command)} |
| 1652 |
% This command compares two fully expanded token lists. So an alternative name |
| 1653 |
% would be \cs{Ifxequal}. |
| 1654 |
% \begin{macrocode} |
| 1655 |
%<*base> |
| 1656 |
\providecommand*{\ifstr}{% |
| 1657 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1658 |
`\string\ifstr'.\MessageBreak |
| 1659 |
The command has been renamed because of a\MessageBreak |
| 1660 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1661 |
Please replace `\string\ifstr' by `\string\Ifstr'% |
| 1662 |
}% |
| 1663 |
\Ifstr |
| 1664 |
} |
| 1665 |
\newcommand\Ifstr[2]{% |
| 1666 |
\begingroup\protected@edef\reserved@a{#1}\protected@edef\reserved@b{#2}% |
| 1667 |
\ifx\reserved@a\reserved@b |
| 1668 |
\endgroup\expandafter\@firstoftwo |
| 1669 |
\else |
| 1670 |
\endgroup\expandafter\@secondoftwo |
| 1671 |
\fi |
| 1672 |
} |
| 1673 |
%</base> |
| 1674 |
% \end{macrocode} |
| 1675 |
% \end{command} |
| 1676 |
% |
| 1677 |
% \begin{command}{\ifstrstart,\Ifstrstart} |
| 1678 |
% \changes{v3.12}{2013/11/05}{added} |
| 1679 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart} (but |
| 1680 |
% still available as deprecated command)} |
| 1681 |
% If the expansion of the first argument starts with expansion of the second |
| 1682 |
% one use the third argument, otherwise the fourth. |
| 1683 |
% \begin{macrocode} |
| 1684 |
%<*base> |
| 1685 |
\providecommand*{\ifstrstart}{% |
| 1686 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1687 |
`\string\ifstrstart'.\MessageBreak |
| 1688 |
The command has been renamed because of a\MessageBreak |
| 1689 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1690 |
Please replace `\string\ifstrstart' by `\string\Ifstrstart'% |
| 1691 |
}% |
| 1692 |
\Ifstrstart |
| 1693 |
} |
| 1694 |
\newcommand*{\Ifstrstart}[2]{% |
| 1695 |
\begingroup |
| 1696 |
\edef\reserved@a{\noexpand\@ifstrstart{#1}{#2}}% |
| 1697 |
\reserved@a{\aftergroup\@firstoftwo}{\aftergroup\@secondoftwo}% |
| 1698 |
\endgroup |
| 1699 |
} |
| 1700 |
% \end{macrocode} |
| 1701 |
% \begin{macro}{\@ifstrstart} |
| 1702 |
% \changes{v3.12}{2013/11/05}{added} |
| 1703 |
% Helper. |
| 1704 |
% \begin{macrocode} |
| 1705 |
\newcommand*{\@ifstrstart}[2]{% |
| 1706 |
\def\reserved@a ##1#2##2\@nil{% |
| 1707 |
\if\relax\detokenize{##1}\relax |
| 1708 |
\expandafter\@firstoftwo |
| 1709 |
\else |
| 1710 |
\expandafter\@secondoftwo |
| 1711 |
\fi |
| 1712 |
}% |
| 1713 |
\reserved@a#1#2\@nil |
| 1714 |
} |
| 1715 |
%</base> |
| 1716 |
% \end{macrocode} |
| 1717 |
% \end{macro}^^A \@ifstrstart |
| 1718 |
% \end{command}^^A \ifstrstart,\Ifstrstart |
| 1719 |
% |
| 1720 |
% \begin{command}{\IfArgIsEmpty} |
| 1721 |
% \changes{v3.19}{2015/08/29}{added} |
| 1722 |
% \changes{v3.27}{2019/03/11}{\cs{long}} |
| 1723 |
% \changes{v3.27}{2019/07/19}{needed already to process options} |
| 1724 |
% If the first argument is absolutely empty execute the second one, otherwise |
| 1725 |
% the third one. |
| 1726 |
%</body> |
| 1727 |
%<*prepare> |
| 1728 |
%<*base> |
| 1729 |
% \begin{macrocode} |
| 1730 |
\newcommand{\IfArgIsEmpty}[1]{% |
| 1731 |
\if\relax\detokenize{#1}\relax |
| 1732 |
\expandafter\@firstoftwo |
| 1733 |
\else |
| 1734 |
\expandafter\@secondoftwo |
| 1735 |
\fi |
| 1736 |
} |
| 1737 |
% \end{macrocode} |
| 1738 |
%</base> |
| 1739 |
%</prepare> |
| 1740 |
%<*body> |
| 1741 |
% \end{command}^^A \IfArgIsEmpty |
| 1742 |
% |
| 1743 |
% |
| 1744 |
% \begin{command}{\ifislengthprimitive,\Ifislengthprimitive} |
| 1745 |
% \changes{v3.20}{2015/10/19}{added} |
| 1746 |
% \changes{v3.36}{2022/02/17}{\cs{ifislengthprimitive} renamed to |
| 1747 |
% \cs{Ifislengthprimitive} (but still defined as deprecated)} |
| 1748 |
% If the first argument expands to a primitive, that can be used as a length, |
| 1749 |
% execute the second argument, otherwise the third one. |
| 1750 |
% \begin{macrocode} |
| 1751 |
%<*base> |
| 1752 |
\providecommand*{\ifislengthprimitive}{% |
| 1753 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1754 |
`\string\ifislengthprimitive'.\MessageBreak |
| 1755 |
The command has been renamed because of a\MessageBreak |
| 1756 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1757 |
Please replace `\string\ifislengthprimitive' by `\string\Ifislengthprimitive'% |
| 1758 |
}% |
| 1759 |
\Ifislengthprimitive |
| 1760 |
} |
| 1761 |
\newcommand*{\Ifislengthprimitive}[1]{% |
| 1762 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifislengthprimitive#1\@nil}% |
| 1763 |
} |
| 1764 |
% \end{macrocode} |
| 1765 |
% \begin{macro}{\scr@ifislengthprimitive} |
| 1766 |
% \changes{v3.20}{2015/10/19}{added} |
| 1767 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 1768 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 1769 |
% Helper macro to test against several length like \TeX{} primitives. |
| 1770 |
% \begin{macrocode} |
| 1771 |
\newcommand*{\scr@ifislengthprimitive}[1]{% |
| 1772 |
\begingroup |
| 1773 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 1774 |
\aftergroup\expandafter\aftergroup\scr@ifislengthprimitive |
| 1775 |
}{% |
| 1776 |
\def\reserved@c{\aftergroup\scr@secondoftwoAfterNil}% |
| 1777 |
\@for\reserved@a:=\baselineskip,\dp,\hsize,\ht,\lineskip,% |
| 1778 |
\parindent,\parskip,\pdfpageheight,\pdfpagewidth,% |
| 1779 |
\wd,\vsize \do {% |
| 1780 |
\expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{% |
| 1781 |
\meaning #1% |
| 1782 |
}{% |
| 1783 |
\def\reserved@c{\aftergroup\scr@TestDimenAssignTillNil}% |
| 1784 |
}% |
| 1785 |
}% |
| 1786 |
\reserved@c |
| 1787 |
}% |
| 1788 |
\endgroup |
| 1789 |
#1% |
| 1790 |
} |
| 1791 |
%</base> |
| 1792 |
% \end{macrocode} |
| 1793 |
% \end{macro}^^A \scr@ifislengthprimitive |
| 1794 |
% \end{command}^^A \ifislengthprimitive,\Ifislengthprimitive |
| 1795 |
% |
| 1796 |
% |
| 1797 |
% \begin{command}{\ifisdimen,\Ifisdimen} |
| 1798 |
% \changes{v3.12}{2013/11/05}{added} |
| 1799 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 1800 |
% \changes{v3.28}{2019/11/19}{\cs{ifisdimen} renamed to \cs{Ifisdimen} (but |
| 1801 |
% still defined as deprecated command)} |
| 1802 |
% If the first argument expands to a \cs{dimen} register (and nothing else), |
| 1803 |
% execute the second argument, otherwise the third one. |
| 1804 |
% \begin{macrocode} |
| 1805 |
%<*base> |
| 1806 |
\providecommand*{\ifisdimen}{% |
| 1807 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1808 |
`\string\ifisdimen'.\MessageBreak |
| 1809 |
The command has been renamed because of a\MessageBreak |
| 1810 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1811 |
Please replace `\string\ifisdimen' by `\string\Ifisdimen'% |
| 1812 |
}% |
| 1813 |
\Ifisdimen |
| 1814 |
} |
| 1815 |
\newcommand*{\Ifisdimen}[1]{% |
| 1816 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdimen#1\@nil}% |
| 1817 |
} |
| 1818 |
% \end{macrocode} |
| 1819 |
% \begin{macro}{\scr@ifisdimen} |
| 1820 |
% \changes{v3.20}{2015/10/19}{added} |
| 1821 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 1822 |
% Helper macro, that tests a macro recursive to expand to a \cs{dimen} register. |
| 1823 |
% \begin{macrocode} |
| 1824 |
\newcommand*{\scr@ifisdimen}[1]{% |
| 1825 |
\begingroup |
| 1826 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 1827 |
\aftergroup\expandafter\aftergroup\scr@ifisdimen |
| 1828 |
}{% |
| 1829 |
\Ifstrstart{\meaning #1}{\string\dimen}{% |
| 1830 |
\aftergroup\scr@TestDimenAssignTillNil |
| 1831 |
}{% |
| 1832 |
\aftergroup\scr@secondoftwoAfterNil |
| 1833 |
}% |
| 1834 |
}% |
| 1835 |
\endgroup |
| 1836 |
#1% |
| 1837 |
} |
| 1838 |
% \end{macrocode} |
| 1839 |
% \end{macro}^^A \scr@ifisdimen |
| 1840 |
% \begin{macro}{\scr@TestDimenAssignTillNil} |
| 1841 |
% \changes{v3.20}{2015/10/19}{added} |
| 1842 |
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary |
| 1843 |
% length. If this uses the argument completely, the argument \texttt{\#2} behind |
| 1844 |
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case |
| 1845 |
% \texttt{\#1} will removed from the input totally. |
| 1846 |
% \begin{macrocode} |
| 1847 |
\newcommand*\scr@TestDimenAssignTillNil{} |
| 1848 |
\def\scr@TestDimenAssignTillNil#1\@nil{% |
| 1849 |
\begingroup |
| 1850 |
\afterassignment\scr@AfterEndGroupIfArgIsRelaxTillNnil |
| 1851 |
\@tempdima=#1\relax\@nnil |
| 1852 |
} |
| 1853 |
% \end{macrocode} |
| 1854 |
% \begin{macro}{\scr@IfAfterEndgroupArgIsRelaxTillNnil,\scr@IfArgIsRelaxAfterRelaxTillNnil} |
| 1855 |
% \changes{v3.20}{2015/10/19}{added} |
| 1856 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 1857 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 1858 |
% The helper macros read an argument delimited by \cs{@nnil}. If this |
| 1859 |
% arguments consists of a number of \cs{relax} only, the second argument (first |
| 1860 |
% behind \cs{@nnil}) will be execute, otherwise the third (second behind \cs{@nnil}). |
| 1861 |
% \begin{macrocode} |
| 1862 |
\newcommand*\scr@AfterEndGroupIfArgIsRelaxTillNnil{} |
| 1863 |
\def\scr@AfterEndGroupIfArgIsRelaxTillNnil#1\@nnil{% |
| 1864 |
\endgroup |
| 1865 |
\Ifstr{\detokenize{#1}}{\detokenize{\relax}}{\@firstoftwo}{% |
| 1866 |
\Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{% |
| 1867 |
\scr@IfArgIsRelaxAfterRelaxTillNnil #1\@nnil |
| 1868 |
}{\@secondoftwo}% |
| 1869 |
}% |
| 1870 |
} |
| 1871 |
\newcommand*\scr@IfArgIsRelaxAfterRelaxTillNnil{} |
| 1872 |
\def\scr@IfArgIsRelaxAfterRelaxTillNnil \relax#1\@nnil{% |
| 1873 |
\Ifstr{\detokenize{#1}}{\detokenize{\relax}}{\@firstoftwo}{% |
| 1874 |
\Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{% |
| 1875 |
\scr@IfArgIsRelaxAfterRelaxTillNnil #1\@nnil |
| 1876 |
}{\@secondoftwo}% |
| 1877 |
}% |
| 1878 |
} |
| 1879 |
% \end{macrocode} |
| 1880 |
% \end{macro}^^A \scr@IfArgIsRelaxTillNnil,\scr@IfArgIsRelaxAfterRelaxTillNnil |
| 1881 |
% \end{macro}^^A \scr@TestSkipAssignTillNil |
| 1882 |
% \begin{macro}{\scr@@secondoftwoAfterNil,\scr@secondoftwoAfterNil} |
| 1883 |
% \changes{v3.20}{2015/10/19}{added} |
| 1884 |
% The helper macros reads arguments \texttt{\#1} delimited by \cs{@nil} and |
| 1885 |
% executes \texttt{\#3}. We have to take care for the case of an empty first |
| 1886 |
% argument, which would make \cs{@nil} to be the argument. Because of this we |
| 1887 |
% need two helpers. |
| 1888 |
% \begin{macrocode} |
| 1889 |
\newcommand*{\scr@secondoftwoAfterNil}{\scr@@secondoftwoAfterNil\@empty} |
| 1890 |
\newcommand*{\scr@@secondoftwoAfterNil}{} |
| 1891 |
\def\scr@@secondoftwoAfterNil#1\@nil{\@secondoftwo} |
| 1892 |
%</base> |
| 1893 |
% \end{macrocode} |
| 1894 |
% \end{macro}^^A \scr@@secondoftwoAfterNil,\scr@secondoftwoAfterNil |
| 1895 |
% \end{command}^^A \ifisdimen,\Ifisdimen |
| 1896 |
% |
| 1897 |
% \begin{command}{\ifisskip,\Ifisskip} |
| 1898 |
% \changes{v3.12}{2013/11/05}{added} |
| 1899 |
% \changes{v3.18a}{2015/07/07}{\cs{baselineskip} and \cs{parskip} are skips} |
| 1900 |
% \changes{v3.20}{2015/10/19}{\cs{baselineskip} and \cs{parskip} are not skips} |
| 1901 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 1902 |
% \changes{v3.28}{2019/11/19}{\cs{ifisskip} renamed to \cs{Ifisskip}} |
| 1903 |
% If the first argument expands to a \cs{skip} register (and nothing else), |
| 1904 |
% execute the second argument, otherwise the third one. |
| 1905 |
% \begin{macrocode} |
| 1906 |
%<*base> |
| 1907 |
\providecommand*{\ifisskip}{% |
| 1908 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1909 |
`\string\ifisskip'.\MessageBreak |
| 1910 |
The command has been renamed because of a\MessageBreak |
| 1911 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1912 |
Please replace `\string\ifisskip' by `\string\Ifisskip'% |
| 1913 |
}% |
| 1914 |
\Ifisskip |
| 1915 |
} |
| 1916 |
\newcommand*{\Ifisskip}[1]{% |
| 1917 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisskip#1\@nil}% |
| 1918 |
} |
| 1919 |
% \end{macrocode} |
| 1920 |
% \begin{macro}{\scr@ifisskip} |
| 1921 |
% \changes{v3.20}{2015/10/19}{added} |
| 1922 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 1923 |
% Helper macro, that tests a macro recursive to expand to a \cs{skip} register. |
| 1924 |
% \begin{macrocode} |
| 1925 |
\newcommand*{\scr@ifisskip}[1]{% |
| 1926 |
\begingroup |
| 1927 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 1928 |
\aftergroup\expandafter\aftergroup\scr@ifisskip |
| 1929 |
}{% |
| 1930 |
\Ifstrstart{\meaning #1}{\string\skip}{% |
| 1931 |
\aftergroup\scr@TestSkipAssignTillNil |
| 1932 |
}{% |
| 1933 |
\aftergroup\scr@secondoftwoAfterNil |
| 1934 |
}% |
| 1935 |
}% |
| 1936 |
\endgroup |
| 1937 |
#1% |
| 1938 |
} |
| 1939 |
% \end{macrocode} |
| 1940 |
% \end{macro}^^A \scr@ifisskip |
| 1941 |
% \begin{macro}{\scr@TestSkipAssignTillNil} |
| 1942 |
% \changes{v3.20}{2015/10/19}{added} |
| 1943 |
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary |
| 1944 |
% \cs{skip}. If this uses the argument completely, the argument \texttt{\#2} behind |
| 1945 |
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case |
| 1946 |
% \texttt{\#1} will removed from the input totally. |
| 1947 |
% \begin{macrocode} |
| 1948 |
\newcommand*\scr@TestSkipAssignTillNil{} |
| 1949 |
\def\scr@TestSkipAssignTillNil#1\@nil{% |
| 1950 |
\begingroup |
| 1951 |
\afterassignment\scr@AfterEndGroupIfArgIsRelaxTillNnil |
| 1952 |
\@tempskipa=#1\relax\@nnil |
| 1953 |
} |
| 1954 |
%</base> |
| 1955 |
% \end{macrocode} |
| 1956 |
% \end{macro}^^A \scr@TestSkipAssignTillNil |
| 1957 |
% \end{command}^^A \ifiskip,\Ifisskip |
| 1958 |
% |
| 1959 |
% \begin{command}{\ifiscount,\Ifiscount} |
| 1960 |
% \changes{v3.12}{2013/11/05}{added} |
| 1961 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 1962 |
% \changes{v3.28}{2019/11/19}{\cs{ifiscount} renamed to \cs{Ifiscount}} |
| 1963 |
% If the first argument expands to a \cs{count} register (and nothing else), |
| 1964 |
% execute the second argument, otherwise the third one. |
| 1965 |
% \begin{macrocode} |
| 1966 |
%<*base> |
| 1967 |
\providecommand*{\ifiscount}{% |
| 1968 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 1969 |
`\string\ifiscount'.\MessageBreak |
| 1970 |
The command has been renamed because of a\MessageBreak |
| 1971 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 1972 |
Please replace `\string\ifiscount' by `\string\Ifiscount'% |
| 1973 |
}% |
| 1974 |
\Ifiscount |
| 1975 |
} |
| 1976 |
\newcommand*{\Ifiscount}[1]{% |
| 1977 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifiscount#1\@nil}% |
| 1978 |
} |
| 1979 |
% \end{macrocode} |
| 1980 |
% \begin{macro}{\scr@ifiscount} |
| 1981 |
% \changes{v3.20}{2015/10/19}{added} |
| 1982 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 1983 |
% Helper macro, that tests a macro recursive to expand to a \cs{count} register. |
| 1984 |
% \begin{macrocode} |
| 1985 |
\newcommand*{\scr@ifiscount}[1]{% |
| 1986 |
\begingroup |
| 1987 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 1988 |
\aftergroup\expandafter\aftergroup\scr@ifiscount |
| 1989 |
}{% |
| 1990 |
\Ifstrstart{\meaning #1}{\string\count}{% |
| 1991 |
\aftergroup\scr@TestCountAssignTillNil |
| 1992 |
}{% |
| 1993 |
\aftergroup\scr@secondoftwoAfterNil |
| 1994 |
}% |
| 1995 |
}% |
| 1996 |
\endgroup |
| 1997 |
#1% |
| 1998 |
} |
| 1999 |
% \end{macrocode} |
| 2000 |
% \end{macro}^^A \scr@ifiscount |
| 2001 |
% \begin{macro}{\scr@TestSkipCountTillNil} |
| 2002 |
% \changes{v3.20}{2015/10/19}{added} |
| 2003 |
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary |
| 2004 |
% counter. If this uses the argument completely, the argument \texttt{\#2} behind |
| 2005 |
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case |
| 2006 |
% \texttt{\#1} will removed from the input totally. |
| 2007 |
% \begin{macrocode} |
| 2008 |
\newcommand*\scr@TestCountAssignTillNil{} |
| 2009 |
\def\scr@TestCountAssignTillNil#1\@nil{% |
| 2010 |
\begingroup |
| 2011 |
\afterassignment\scr@AfterEndGroupIfArgIsRelaxTillNnil |
| 2012 |
\@tempcnta=#1\relax\@nnil |
| 2013 |
} |
| 2014 |
%</base> |
| 2015 |
% \end{macrocode} |
| 2016 |
% \end{macro}^^A \scr@TestCountAssignTillNil |
| 2017 |
% \end{command}^^A \ifiscount,\Ifiscount |
| 2018 |
% |
| 2019 |
% |
| 2020 |
% \begin{command}{\ifisdimexpr,\Ifisdimexpr} |
| 2021 |
% \changes{v3.12}{2013/11/05}{added} |
| 2022 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 2023 |
% \changes{v3.28}{2019/11/19}{\cs{ifisdimexpr} renamed to \cs{Ifisdimexpr}} |
| 2024 |
% If the first argument expands to a \cs{dimexpr}, |
| 2025 |
% execute the second argument, otherwise the third one. There is an important |
| 2026 |
% difference to \cs{Ifisdimen}: If the argument begins with \cs{dimexpr} but |
| 2027 |
% is not a valid \emph{dimension expression} \cs{Ifisdimexpr} detects a |
| 2028 |
% \cs{dimexpr}, but using this expression later will result in an error. |
| 2029 |
% \begin{macrocode} |
| 2030 |
%<*base> |
| 2031 |
\providecommand*{\ifisdimexpr}{% |
| 2032 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2033 |
`\string\ifisdimexpr'.\MessageBreak |
| 2034 |
The command has been renamed because of a\MessageBreak |
| 2035 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2036 |
Please replace `\string\ifisdimexpr' by `\string\Ifisdimexpr'% |
| 2037 |
}% |
| 2038 |
\Ifisdimexpr |
| 2039 |
} |
| 2040 |
\newcommand*{\Ifisdimexpr}[1]{% |
| 2041 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdimexpr#1\relax\@nil}% |
| 2042 |
} |
| 2043 |
% \end{macrocode} |
| 2044 |
% \begin{macro}{\scr@ifisdimexpr} |
| 2045 |
% \changes{v3.20}{2015/10/19}{added} |
| 2046 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2047 |
% Helper macro, that tests a macro recursive to expand to a \cs{dimexpr}. |
| 2048 |
% \begin{macrocode} |
| 2049 |
\newcommand*{\scr@ifisdimexpr}[1]{% |
| 2050 |
\begingroup |
| 2051 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2052 |
\aftergroup\expandafter\aftergroup\scr@ifisdimexpr |
| 2053 |
}{% |
| 2054 |
\Ifstrstart{\meaning #1}{\string\dimexpr}{% |
| 2055 |
\aftergroup\scr@TestDimenAssignTillNil |
| 2056 |
}{% |
| 2057 |
\aftergroup\scr@secondoftwoAfterNil |
| 2058 |
}% |
| 2059 |
}% |
| 2060 |
\endgroup |
| 2061 |
#1% |
| 2062 |
} |
| 2063 |
%</base> |
| 2064 |
% \end{macrocode} |
| 2065 |
% \end{macro}^^A \scr@ifisdimexpr |
| 2066 |
% \end{command}^^A \ifisdimexpr,\Ifisdimexpr |
| 2067 |
% |
| 2068 |
% |
| 2069 |
% \begin{command}{\ifisglueexpr,\Ifisglueexpr} |
| 2070 |
% \changes{v3.12}{2013/11/05}{added} |
| 2071 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 2072 |
% \changes{v3.28}{2019/11/19}{\cs{ifisglueexpr} renamed to \cs{Ifisglueexpr}} |
| 2073 |
% If the first argument expands to a \cs{glueexpr}, |
| 2074 |
% execute the second argument, otherwise the third one. There is an important |
| 2075 |
% difference to \cs{Ifisskip}: If the argument begins with \cs{glueexpr} but |
| 2076 |
% is not a valid \emph{glue expression} \cs{Ifisglueexpr} detects a |
| 2077 |
% \cs{göueexpr}, but using this expression later will result in an error. |
| 2078 |
% \begin{macrocode} |
| 2079 |
%<*base> |
| 2080 |
\providecommand*{\ifisglueexpr}{% |
| 2081 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2082 |
`\string\ifisglueexpr'.\MessageBreak |
| 2083 |
The command has been renamed because of a\MessageBreak |
| 2084 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2085 |
Please replace `\string\ifisglueexpr' by `\string\Ifisglueexpr'% |
| 2086 |
}% |
| 2087 |
\Ifisglueexpr |
| 2088 |
} |
| 2089 |
\newcommand*{\Ifisglueexpr}[1]{% |
| 2090 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisglueexpr#1\relax\@nil}% |
| 2091 |
} |
| 2092 |
% \end{macrocode} |
| 2093 |
% \begin{macro}{\scr@ifisglueexpr} |
| 2094 |
% \changes{v3.20}{2015/10/19}{added} |
| 2095 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2096 |
% Helper macro, that tests a macro recursive to expand to a \cs{glueexpr}. |
| 2097 |
% \begin{macrocode} |
| 2098 |
\newcommand*{\scr@ifisglueexpr}[1]{% |
| 2099 |
\begingroup |
| 2100 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2101 |
\aftergroup\expandafter\aftergroup\scr@ifisglueexpr |
| 2102 |
}{% |
| 2103 |
\Ifstrstart{\meaning #1}{\string\glueexpr}{% |
| 2104 |
\aftergroup\scr@TestSkipAssignTillNil |
| 2105 |
}{% |
| 2106 |
\aftergroup\scr@secondoftwoAfterNil |
| 2107 |
}% |
| 2108 |
}% |
| 2109 |
\endgroup |
| 2110 |
#1% |
| 2111 |
} |
| 2112 |
%</base> |
| 2113 |
% \end{macrocode} |
| 2114 |
% \end{macro}^^A \scr@ifisglueexpr |
| 2115 |
% \end{command}^^A \ifisglueexpr,\Ifisglueexpr |
| 2116 |
% |
| 2117 |
% |
| 2118 |
% \begin{command}{\ifisnumexpr,\Ifisnumexpr} |
| 2119 |
% \changes{v3.12}{2013/11/05}{added} |
| 2120 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 2121 |
% \changes{v3.28}{2019/11/19}{\cs{ifisnumexpr} renamed to \cs{Ifisnumexpr}} |
| 2122 |
% If the first argument expands to a \cs{numexpr}, |
| 2123 |
% execute the second argument, otherwise the third one. There is an important |
| 2124 |
% difference to \cs{Ifiscount}: If the argument begins with \cs{numexpr} but |
| 2125 |
% is not a valid \emph{numerical expression} \cs{Ifisnumexpr} detects a |
| 2126 |
% \cs{numexpr}, but using this expression later will result in an error. |
| 2127 |
% \begin{macrocode} |
| 2128 |
%<*base> |
| 2129 |
\providecommand*{\ifisnumexpr}{% |
| 2130 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2131 |
`\string\ifisnumexpr'.\MessageBreak |
| 2132 |
The command has been renamed because of a\MessageBreak |
| 2133 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2134 |
Please replace `\string\ifisnumexpr' by `\string\Ifisnumexpr'% |
| 2135 |
}% |
| 2136 |
\Ifisnumexpr |
| 2137 |
} |
| 2138 |
\newcommand*{\Ifisnumexpr}[1]{% |
| 2139 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisnumexpr#1\relax\@nil}% |
| 2140 |
} |
| 2141 |
% \end{macrocode} |
| 2142 |
% \begin{macro}{\scr@ifisnumexpr} |
| 2143 |
% \changes{v3.20}{2015/10/19}{added} |
| 2144 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2145 |
% Helper macro, that tests a macro recursive to expand to a \cs{numexpr}. |
| 2146 |
% \begin{macrocode} |
| 2147 |
\newcommand*{\scr@ifisnumexpr}[1]{% |
| 2148 |
\begingroup |
| 2149 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2150 |
\aftergroup\expandafter\aftergroup\scr@ifisnumexpr |
| 2151 |
}{% |
| 2152 |
\Ifstrstart{\meaning #1}{\string\numexpr}{% |
| 2153 |
\aftergroup\scr@TestCountAssignTillNil |
| 2154 |
}{% |
| 2155 |
\aftergroup\scr@secondoftwoAfterNil |
| 2156 |
}% |
| 2157 |
}% |
| 2158 |
\endgroup |
| 2159 |
#1% |
| 2160 |
} |
| 2161 |
%</base> |
| 2162 |
% \end{macrocode} |
| 2163 |
% \end{macro}^^A \scr@ifisnumexpr |
| 2164 |
% \end{command}^^A \ifisnumexpr,\Ifisnumexpr |
| 2165 |
% |
| 2166 |
% |
| 2167 |
% \begin{command}{\ifisdefchar,\Ifisdefchar} |
| 2168 |
% \changes{v3.20}{2015/10/19}{added} |
| 2169 |
% \changes{v3.36}{2022/02/17}{\cs{ifisdefchar} renamed to \cs{Ifisdefchar}} |
| 2170 |
% If the first argument expands to a value defined using \cs{chardef}, |
| 2171 |
% execute the second argument, otherwise the third one. Note: If the expanded |
| 2172 |
% argument begins with \verb|\char"| but is not a valid \emph{character value} |
| 2173 |
% \cs{Ifisdefchar} detects a valid value, but using this value later will |
| 2174 |
% result in an error. |
| 2175 |
% \begin{macrocode} |
| 2176 |
%<*base> |
| 2177 |
\providecommand*{\ifisdefchar}{% |
| 2178 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2179 |
`\string\ifisdefchar'.\MessageBreak |
| 2180 |
The command has been renamed because of a\MessageBreak |
| 2181 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2182 |
Please replace `\string\ifisdefchar' by `\string\Ifisdefchar'% |
| 2183 |
}% |
| 2184 |
\Ifisdefchar |
| 2185 |
} |
| 2186 |
\newcommand*{\Ifisdefchar}[1]{% |
| 2187 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdefchar#1\@nil}% |
| 2188 |
} |
| 2189 |
% \end{macrocode} |
| 2190 |
% \begin{macro}{\scr@ifisdefchar} |
| 2191 |
% \changes{v3.20}{2015/10/19}{added} |
| 2192 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2193 |
% Helper macro, that tests a macro recursive to expand to a \cs{char}. |
| 2194 |
% \begin{macrocode} |
| 2195 |
\newcommand*{\scr@ifisdefchar}[1]{% |
| 2196 |
\begingroup |
| 2197 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2198 |
\aftergroup\expandafter\aftergroup\scr@ifisdefchar |
| 2199 |
}{% |
| 2200 |
\Ifstrstart{\meaning #1}{\string\char\string"}{% |
| 2201 |
\aftergroup\scr@TestCountAssignTillNil |
| 2202 |
}{% |
| 2203 |
\aftergroup\scr@secondoftwoAfterNil |
| 2204 |
}% |
| 2205 |
}% |
| 2206 |
\endgroup |
| 2207 |
#1% |
| 2208 |
} |
| 2209 |
%</base> |
| 2210 |
% \end{macrocode} |
| 2211 |
% \end{macro}^^A \scr@ifisdefchar |
| 2212 |
% \end{command}^^A \ifisdefchar,\Ifisdefchar |
| 2213 |
% |
| 2214 |
% |
| 2215 |
% \begin{command}{\ifiscounter,\Ifiscounter} |
| 2216 |
% \changes{v3.12}{2013/11/05}{added} |
| 2217 |
% \changes{v3.28}{2019/11/19}{\cs{ifiscounter} renamed to \cs{Ifiscounter}} |
| 2218 |
% If the first argument expands to a \LaTeX{} counter, execute the second |
| 2219 |
% argument, otherwise the third one. |
| 2220 |
% \begin{macrocode} |
| 2221 |
%<*base> |
| 2222 |
\providecommand*{\ifiscounter}{% |
| 2223 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2224 |
`\string\ifiscounter'.\MessageBreak |
| 2225 |
The command has been renamed because of a\MessageBreak |
| 2226 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2227 |
Please replace `\string\ifiscounter' by `\string\Ifiscounter'% |
| 2228 |
}% |
| 2229 |
\Ifiscounter |
| 2230 |
} |
| 2231 |
\newcommand*{\Ifiscounter}[1]{% |
| 2232 |
\begingroup |
| 2233 |
\scr@ifundefinedorrelax{c@#1}{% |
| 2234 |
\aftergroup\@secondoftwo |
| 2235 |
}{% |
| 2236 |
\aftergroup\@firstoftwo |
| 2237 |
}% |
| 2238 |
\endgroup |
| 2239 |
} |
| 2240 |
%</base> |
| 2241 |
% \end{macrocode} |
| 2242 |
% \end{command}^^A \ifiscounter,\Ifiscounter |
| 2243 |
% |
| 2244 |
% |
| 2245 |
% \begin{command}{\ifisinteger,\Ifisinteger} |
| 2246 |
% \changes{v3.12}{2013/11/05}{added} |
| 2247 |
% \changes{v3.12a}{2014/01/24}{white space removed} |
| 2248 |
% \changes{v3.20}{2015/10/19}{re-implemented} |
| 2249 |
% \changes{v3.28}{2019/11/19}{\cs{ifisinteger} renamed to \cs{Ifisinteger}} |
| 2250 |
% If the first argument expands to a (positive or negative) integer, execute |
| 2251 |
% the second argument, otherwise the third one. |
| 2252 |
% \begin{macrocode} |
| 2253 |
%<*base> |
| 2254 |
\providecommand*{\ifisinteger}{% |
| 2255 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2256 |
`\string\ifisinteger'.\MessageBreak |
| 2257 |
The command has been renamed because of a\MessageBreak |
| 2258 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2259 |
Please replace `\string\ifisinteger' by `\string\Ifisinteger'% |
| 2260 |
}% |
| 2261 |
\Ifisinteger |
| 2262 |
} |
| 2263 |
\newcommand*{\Ifisinteger}[1]{% |
| 2264 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisinteger#1\@nil}% |
| 2265 |
} |
| 2266 |
% \end{macrocode} |
| 2267 |
% \begin{macro}{\scr@ifisinteger} |
| 2268 |
% \changes{v3.20}{2015/10/19}{added} |
| 2269 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2270 |
% Helper macro to test recursive to a algebraic sign or a number without sign. |
| 2271 |
% \begin{macrocode} |
| 2272 |
\def\scr@ifisinteger#1{% |
| 2273 |
\begingroup |
| 2274 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2275 |
\aftergroup\expandafter\aftergroup\scr@ifisinteger\aftergroup#1% |
| 2276 |
}{% |
| 2277 |
\Ifstrstart{\meaning #1}{\detokenize{the character}}{% |
| 2278 |
\if #1-\aftergroup\scr@ifisinteger |
| 2279 |
\else |
| 2280 |
\if #1+\aftergroup\scr@ifisinteger |
| 2281 |
\else |
| 2282 |
\ifnum 0=0\if #10\else\if #11\else\if #12\else\if #13\else |
| 2283 |
\if #14\else\if #15\else\if #16\else\if #17\else |
| 2284 |
\if #18\else\if #19\else 1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi |
| 2285 |
\relax |
| 2286 |
\aftergroup\scr@TestCountAssignTillNil |
| 2287 |
\aftergroup#1% |
| 2288 |
\else |
| 2289 |
\aftergroup\scr@secondoftwoAfterNil |
| 2290 |
\aftergroup#1% |
| 2291 |
\fi |
| 2292 |
\fi |
| 2293 |
\fi |
| 2294 |
}{% |
| 2295 |
\Ifstrstart{\meaning #1}{\string\char\string"}{% |
| 2296 |
\aftergroup\scr@TestCountAssignTillNil |
| 2297 |
}{% |
| 2298 |
\def\reserved@c{% |
| 2299 |
\aftergroup\scr@secondoftwoAfterNil |
| 2300 |
}% |
| 2301 |
\@for\reserved@a:=\abovedisplayskip,\abovedisplayshortskip,% |
| 2302 |
\adjdemerits,% |
| 2303 |
\baselineskip,\belowdisplayskip,% |
| 2304 |
\belowdisplayshortskip,\binoppenalty,\boxmaxdepth,% |
| 2305 |
\brokenpenalty,% |
| 2306 |
\clubpenalty,\count,% |
| 2307 |
\dimen,\dimexpr,\doublehyphendemerits,\dp,% |
| 2308 |
\emergenystretch,\exhyphenpenalty,% |
| 2309 |
\finalhyphendemerits,% |
| 2310 |
\glueexpr,% |
| 2311 |
\hbadness,\hfuzz,\hsize,\ht,\hyphenpenalty,% |
| 2312 |
\lastskip,\lastpenalty,\linepenalty,% |
| 2313 |
\lineskip,\lineskiplimit,% |
| 2314 |
\maxdepth,\numexpr,% |
| 2315 |
\overfullrule,% |
| 2316 |
\parfillskip,\parindent,\parskip,% |
| 2317 |
\pdfpageheight,\pdfpagewidth,% |
| 2318 |
\predisplaypenalty,\pretolerance,% |
| 2319 |
\relpenalty,\widowpenalty,% |
| 2320 |
\skip,\splitmaxdepth,\splittopskip,% |
| 2321 |
\tolerance,\topskip,% |
| 2322 |
\wd,\vbadness,\vfuzz,\vsize |
| 2323 |
\do {% |
| 2324 |
\expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{% |
| 2325 |
\meaning #1% |
| 2326 |
}{% |
| 2327 |
\def\reserved@c{\aftergroup\scr@TestCountAssignTillNil}% |
| 2328 |
}% |
| 2329 |
}% |
| 2330 |
\reserved@c |
| 2331 |
}% |
| 2332 |
\aftergroup#1% |
| 2333 |
}% |
| 2334 |
}% |
| 2335 |
\endgroup |
| 2336 |
} |
| 2337 |
%</base> |
| 2338 |
% \end{macrocode} |
| 2339 |
% \end{macro}^^A \scr@ifisinteger |
| 2340 |
% \end{command}^^A \ifisinteger,\Ifisinteger |
| 2341 |
% |
| 2342 |
% |
| 2343 |
% \begin{macro}{\scr@ifrelax@to@nnil} |
| 2344 |
% \changes{v3.12}{2013/11/05}{added} |
| 2345 |
% Helper macro to be used after an assignment. If everything until the first |
| 2346 |
% \cs{@nnil} is exactly one \cs{relax}, the second argument (first after the |
| 2347 |
% \cs{@nnil}) will be executed, otherwise the third argument (second after the |
| 2348 |
% \cs{@nnil}). |
| 2349 |
% \begin{macrocode} |
| 2350 |
%<*base> |
| 2351 |
\newcommand*{\scr@ifrelax@to@nnil}{} |
| 2352 |
\def\scr@ifrelax@to@nnil#1\@nnil{% |
| 2353 |
\begingroup |
| 2354 |
\def\reserved@a{#1}\def\reserved@b{\relax}% |
| 2355 |
\ifx\reserved@a\reserved@b |
| 2356 |
\aftergroup\@firstoftwo |
| 2357 |
\else |
| 2358 |
\aftergroup\@secondoftwo |
| 2359 |
\fi |
| 2360 |
\endgroup |
| 2361 |
} |
| 2362 |
%</base> |
| 2363 |
% \end{macrocode} |
| 2364 |
% \end{macro} |
| 2365 |
% |
| 2366 |
% \begin{command}{\ifisdimension,\Ifisdimension} |
| 2367 |
% \changes{v3.12}{2013/11/05}{added} |
| 2368 |
% \changes{v3.12a}{2014/01/24}{white space removed} |
| 2369 |
% \changes{v3.20}{2015/10/20}{re-implemented} |
| 2370 |
% \changes{v3.28}{2019/11/19}{\cs{ifisdimension} renamed to \cs{Ifisdimension}} |
| 2371 |
% If the step by step expansion of the first argument results in a (positive |
| 2372 |
% or negative) length, the second argument will be executed, otherwise the |
| 2373 |
% third one. |
| 2374 |
% \begin{macrocode} |
| 2375 |
%<*base> |
| 2376 |
\providecommand*{\ifisdimension}{% |
| 2377 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2378 |
`\string\ifisdimension'.\MessageBreak |
| 2379 |
The command has been renamed because of a\MessageBreak |
| 2380 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2381 |
Please replace `\string\ifisdimension' by `\string\Ifisdimension'% |
| 2382 |
}% |
| 2383 |
\Ifisdimension |
| 2384 |
} |
| 2385 |
\newcommand*{\Ifisdimension}[1]{% |
| 2386 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdimension#1\@nil}% |
| 2387 |
} |
| 2388 |
% \end{macrocode} |
| 2389 |
% \begin{macro}{\scr@ifisdimension} |
| 2390 |
% \changes{v3.20}{2015/10/20}{added} |
| 2391 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2392 |
% \changes{v3.28}{2019/11/23}{arithmetic plus sign fixed} |
| 2393 |
% To make this command absolutely correct without false positive and false |
| 2394 |
% negative results, it would be very complicated. Instead we use a heuristic: |
| 2395 |
% If the argument consists of a arbitrary number of arithmetic signs followed |
| 2396 |
% by at most one dot, comma or digit or followed by something, that is a valid |
| 2397 |
% lengths primitive, we try an assignment. Invalid assignments can result in |
| 2398 |
% errors. This is not the best solution but makes things a lot easier. |
| 2399 |
% \begin{macrocode} |
| 2400 |
\newcommand*{\scr@ifisdimension}[1]{% |
| 2401 |
\begingroup |
| 2402 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2403 |
\aftergroup\expandafter\aftergroup\scr@ifisdimension\aftergroup#1% |
| 2404 |
}{% |
| 2405 |
\Ifstrstart{\meaning #1}{\detokenize{the character}}{% |
| 2406 |
\if #1-\aftergroup\scr@ifisdimension |
| 2407 |
\else |
| 2408 |
\if #1+\aftergroup\scr@ifisdimension |
| 2409 |
\else |
| 2410 |
\if #1.% |
| 2411 |
\aftergroup\scr@TestDimensionAssignTillNil |
| 2412 |
\aftergroup#1% |
| 2413 |
\else |
| 2414 |
\if #1,% |
| 2415 |
\aftergroup\scr@TestDimensionAssignTillNil |
| 2416 |
\aftergroup#1% |
| 2417 |
\else |
| 2418 |
\ifnum 0=0\if #10\else\if #11\else\if #12\else\if #13\else |
| 2419 |
\if #14\else\if #15\else\if #16\else\if #17\else |
| 2420 |
\if #18\else\if #19\else 1\fi\fi |
| 2421 |
\fi\fi\fi\fi |
| 2422 |
\fi\fi\fi\fi |
| 2423 |
\relax |
| 2424 |
\aftergroup\scr@TestDimensionAssignTillNil |
| 2425 |
\aftergroup#1% |
| 2426 |
\else |
| 2427 |
\aftergroup\scr@secondoftwoAfterNil |
| 2428 |
\aftergroup#1% |
| 2429 |
\fi |
| 2430 |
\fi |
| 2431 |
\fi |
| 2432 |
\fi |
| 2433 |
\fi |
| 2434 |
}{% |
| 2435 |
\Ifstrstart{\meaning #1}{\string\char\string"}{% |
| 2436 |
\aftergroup\scr@TestDimensionAssignTillNil |
| 2437 |
}{% |
| 2438 |
\def\reserved@c{% |
| 2439 |
\aftergroup\scr@secondoftwoAfterNil |
| 2440 |
\aftergroup\@empty |
| 2441 |
}% |
| 2442 |
\@for\reserved@a:=\abovedisplayskip,\abovedisplayshortskip,% |
| 2443 |
\adjdemerits,% |
| 2444 |
\baselineskip,\belowdisplayskip,% |
| 2445 |
\belowdisplayshortskip,\binoppenalty,\boxmaxdepth,% |
| 2446 |
\brokenpenalty,% |
| 2447 |
\clubpenalty,\count,% |
| 2448 |
\dimen,\dimexpr,\doublehyphendemerits,\dp,% |
| 2449 |
\emergenystretch,\exhyphenpenalty,% |
| 2450 |
\finalhyphendemerits,% |
| 2451 |
\glueexpr,% |
| 2452 |
\hbadness,\hfuzz,\hsize,\ht,\hyphenpenalty,% |
| 2453 |
\lastskip,\lastpenalty,\linepenalty,% |
| 2454 |
\lineskip,\lineskiplimit,% |
| 2455 |
\maxdepth,\numexpr,% |
| 2456 |
\overfullrule,% |
| 2457 |
\parfillskip,\parindent,\parskip,% |
| 2458 |
\pdfpageheight,\pdfpagewidth,% |
| 2459 |
\predisplaypenalty,\pretolerance,% |
| 2460 |
\relpenalty,\widowpenalty,% |
| 2461 |
\skip,\splitmaxdepth,\splittopskip,% |
| 2462 |
\tolerance,\topskip,% |
| 2463 |
\wd,\vbadness,\vfuzz,\vsize |
| 2464 |
\do {% |
| 2465 |
\expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{% |
| 2466 |
\meaning #1% |
| 2467 |
}{% |
| 2468 |
\def\reserved@c{\aftergroup\scr@TestDimensionAssignTillNil}% |
| 2469 |
}% |
| 2470 |
}% |
| 2471 |
\reserved@c |
| 2472 |
}% |
| 2473 |
\aftergroup#1% |
| 2474 |
}% |
| 2475 |
}% |
| 2476 |
\endgroup |
| 2477 |
} |
| 2478 |
% \end{macrocode} |
| 2479 |
% \begin{macro}{\scr@TestDimenionAssignTillNil} |
| 2480 |
% \changes{v3.20}{2015/10/19}{added} |
| 2481 |
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary |
| 2482 |
% length. If this uses the argument completely, the argument \texttt{\#2} behind |
| 2483 |
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case |
| 2484 |
% \texttt{\#1} will removed from the input totally. The difference to |
| 2485 |
% \cs{scr@TestDimenAssignTillNil} is the \texttt{pt} test. |
| 2486 |
% \begin{macrocode} |
| 2487 |
\newcommand*\scr@TestDimensionAssignTillNil{} |
| 2488 |
\def\scr@TestDimensionAssignTillNil#1\@nil{% |
| 2489 |
\begingroup |
| 2490 |
\afterassignment\scr@AfterEndGroupIfArgIsRelaxTillptNnil |
| 2491 |
\@tempdima=#1pt\@nnil |
| 2492 |
} |
| 2493 |
% \end{macrocode} |
| 2494 |
% \begin{macro}{\scr@IfArgIsRelaxAfterRelaxTillptNnil,\scr@IfAfterEndgroupArgIsRelaxTillptNnil} |
| 2495 |
% \changes{v3.20}{2015/10/19}{added} |
| 2496 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 2497 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2498 |
% Die Hilfsmakros lesen ein durch \cs{@nnil} begrenztes Argument. Falls dieses |
| 2499 |
% Argument nur aus einer Folge von \cs{relax} besteht, wird das erste Argument |
| 2500 |
% nach \cs{@nnil} ausgeführt, sonst das zweite. |
| 2501 |
% \begin{macrocode} |
| 2502 |
\newcommand*\scr@AfterEndGroupIfArgIsRelaxTillptNnil{} |
| 2503 |
\def\scr@AfterEndGroupIfArgIsRelaxTillptNnil#1\@nnil{% |
| 2504 |
\endgroup |
| 2505 |
\Ifstr{\detokenize{#1}}{\detokenize{pt}}{\@firstoftwo}{% |
| 2506 |
\Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{% |
| 2507 |
\scr@IfArgIsRelaxAfterRelaxTillptNnil #1\@nnil |
| 2508 |
}{\@secondoftwo}% |
| 2509 |
}% |
| 2510 |
} |
| 2511 |
\newcommand*\scr@IfArgIsRelaxAfterRelaxTillptNnil{} |
| 2512 |
\def\scr@IfArgIsRelaxAfterRelaxTillptNnil \relax#1pt\@nnil{% |
| 2513 |
\Ifstr{\detokenize{#1}}{\detokenize{pt}}{\@firstoftwo}{% |
| 2514 |
\Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{% |
| 2515 |
\scr@IfArgIsRelaxAfterRelaxTillptNnil #1\@nnil |
| 2516 |
}{\@secondoftwo}% |
| 2517 |
}% |
| 2518 |
} |
| 2519 |
%</base> |
| 2520 |
% \end{macrocode} |
| 2521 |
% \end{macro}^^A \scr@IfArgIsRelaxAfterRelaxTillptNnil,\scr@IfAfterEndgroupArgIsRelaxTillptNnil |
| 2522 |
% \end{macro}^^A \scr@DimensionSkipAssignTillNil |
| 2523 |
% \end{macro}^^A \scr@ifisdimension |
| 2524 |
% \end{command}^^A \ifisdimension,\Ifisdimension |
| 2525 |
% |
| 2526 |
% |
| 2527 |
% \begin{command}{\ifisglue} |
| 2528 |
% \changes{v3.12}{2013/11/05}{added} |
| 2529 |
% \changes{v3.12a}{2014/01/24}{white space removed} |
| 2530 |
% \changes{v3.20}{2015/10/21}{re-implemented} |
| 2531 |
% \changes{v3.28}{2019/11/19}{\cs{ifisglue} renamed to \cs{Ifisglue}} |
| 2532 |
% If the step-by-step expansion of the first argument results in a (positive |
| 2533 |
% or negativ) length with glue, the second argument is executed, otherwise the |
| 2534 |
% third one. |
| 2535 |
% \begin{macrocode} |
| 2536 |
%<*base> |
| 2537 |
\providecommand*{\ifisglue}{% |
| 2538 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2539 |
`\string\ifisglue'.\MessageBreak |
| 2540 |
The command has been renamed because of a\MessageBreak |
| 2541 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2542 |
Please replace `\string\ifisglue' by `\string\Ifisglue'% |
| 2543 |
}% |
| 2544 |
\Ifisglue |
| 2545 |
} |
| 2546 |
\newcommand*{\Ifisglue}[1]{% |
| 2547 |
\IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisglue#1\@nil}% |
| 2548 |
} |
| 2549 |
% \end{macrocode} |
| 2550 |
% \begin{macro}{\scr@ifisglue} |
| 2551 |
% \changes{v3.20}{2015/10/21}{added} |
| 2552 |
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}} |
| 2553 |
% \changes{v3.28}{2019/11/23}{arithmetic plus sign fixed} |
| 2554 |
% \changes{v3.28}{2019/11/23}{in plus case \cs{ifisdimension} replaced by |
| 2555 |
% \cs{ifisglue}} |
| 2556 |
% To make this command absolutely correct without false positive and false |
| 2557 |
% negative results, it would be very complicated. Instead we use a heuristic: |
| 2558 |
% If the argument consists of a arbitrary number of arithmetic signs followed |
| 2559 |
% by at most one dot, comma or digit or followed by something, that is a valid |
| 2560 |
% primitive for skips, we try an assignment. Invalid assignments can result in |
| 2561 |
% errors. This is not the best solution but makes things a lot easier. |
| 2562 |
% \begin{macrocode} |
| 2563 |
\newcommand*{\scr@ifisglue}[1]{% |
| 2564 |
\begingroup |
| 2565 |
\Ifstrstart{\meaning #1}{\detokenize{macro:}}{% |
| 2566 |
\aftergroup\expandafter\aftergroup\scr@ifisglue\aftergroup#1% |
| 2567 |
}{% |
| 2568 |
\Ifstrstart{\meaning #1}{\detokenize{the character}}{% |
| 2569 |
\if #1-\aftergroup\scr@ifisglue |
| 2570 |
\else |
| 2571 |
\if #1+\aftergroup\scr@ifisglue |
| 2572 |
\else |
| 2573 |
\if #1.% |
| 2574 |
\aftergroup\scr@TestGlueAssignTillNil |
| 2575 |
\aftergroup#1% |
| 2576 |
\else |
| 2577 |
\if #1,% |
| 2578 |
\aftergroup\scr@TestGlueAssignTillNil |
| 2579 |
\aftergroup#1% |
| 2580 |
\else |
| 2581 |
\ifnum 0=0\if #10\else\if #11\else\if #12\else\if #13\else |
| 2582 |
\if #14\else\if #15\else\if #16\else\if #17\else |
| 2583 |
\if #18\else\if #19\else 1\fi\fi |
| 2584 |
\fi\fi\fi\fi |
| 2585 |
\fi\fi\fi\fi |
| 2586 |
\relax |
| 2587 |
\aftergroup\scr@TestGlueAssignTillNil |
| 2588 |
\aftergroup#1% |
| 2589 |
\else |
| 2590 |
\aftergroup\scr@secondoftwoAfterNil |
| 2591 |
\aftergroup#1% |
| 2592 |
\fi |
| 2593 |
\fi |
| 2594 |
\fi |
| 2595 |
\fi |
| 2596 |
\fi |
| 2597 |
}{% |
| 2598 |
\Ifstrstart{\meaning #1}{\string\char\string"}{% |
| 2599 |
\aftergroup\scr@TestGlueAssignTillNil |
| 2600 |
}{% |
| 2601 |
\def\reserved@c{% |
| 2602 |
\aftergroup\scr@secondoftwoAfterNil |
| 2603 |
\aftergroup\@empty |
| 2604 |
}% |
| 2605 |
\@for\reserved@a:=\abovedisplayskip,\abovedisplayshortskip,% |
| 2606 |
\adjdemerits,% |
| 2607 |
\baselineskip,\belowdisplayskip,% |
| 2608 |
\belowdisplayshortskip,\binoppenalty,\boxmaxdepth,% |
| 2609 |
\brokenpenalty,% |
| 2610 |
\clubpenalty,\count,% |
| 2611 |
\dimen,\dimexpr,\doublehyphendemerits,\dp,% |
| 2612 |
\emergenystretch,\exhyphenpenalty,% |
| 2613 |
\finalhyphendemerits,% |
| 2614 |
\glueexpr,% |
| 2615 |
\hbadness,\hfuzz,\hsize,\ht,\hyphenpenalty,% |
| 2616 |
\lastskip,\lastpenalty,\linepenalty,% |
| 2617 |
\lineskip,\lineskiplimit,% |
| 2618 |
\maxdepth,\numexpr,% |
| 2619 |
\overfullrule,% |
| 2620 |
\parfillskip,\parindent,\parskip,% |
| 2621 |
\pdfpageheight,\pdfpagewidth,% |
| 2622 |
\predisplaypenalty,\pretolerance,% |
| 2623 |
\relpenalty,\widowpenalty,% |
| 2624 |
\skip,\splitmaxdepth,\splittopskip,% |
| 2625 |
\tolerance,\topskip,% |
| 2626 |
\wd,\vbadness,\vfuzz,\vsize |
| 2627 |
\do {% |
| 2628 |
\expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{% |
| 2629 |
\meaning #1% |
| 2630 |
}{% |
| 2631 |
\def\reserved@c{\aftergroup\scr@TestGlueAssignTillNil}% |
| 2632 |
}% |
| 2633 |
}% |
| 2634 |
\reserved@c |
| 2635 |
}% |
| 2636 |
\aftergroup#1% |
| 2637 |
}% |
| 2638 |
}% |
| 2639 |
\endgroup |
| 2640 |
} |
| 2641 |
% \end{macrocode} |
| 2642 |
% \begin{macro}{\scr@TestGlueAssignTillNil} |
| 2643 |
% \changes{v3.20}{2015/10/21}{added} |
| 2644 |
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary |
| 2645 |
% \cs{skip}. If this uses the argument completely, the argument \texttt{\#2} behind |
| 2646 |
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case |
| 2647 |
% \texttt{\#1} will removed from the input totally. The difference to |
| 2648 |
% \cs{scr@TestSkipAssignTillNil} is the \texttt{pt} test. |
| 2649 |
% \begin{macrocode} |
| 2650 |
\newcommand*\scr@TestGlueAssignTillNil{} |
| 2651 |
\def\scr@TestGlueAssignTillNil#1\@nil{% |
| 2652 |
\begingroup |
| 2653 |
\afterassignment\scr@AfterEndGroupIfArgIsRelaxTillptNnil |
| 2654 |
\@tempskipa=#1pt\@nnil |
| 2655 |
} |
| 2656 |
%</base> |
| 2657 |
% \end{macrocode} |
| 2658 |
% \end{macro}^^A \scr@TestGlueAssignTillNil |
| 2659 |
% \end{macro}^^A \scr@ifisglue |
| 2660 |
% \end{command}^^A \ifisglue,\Ifisglue |
| 2661 |
% |
| 2662 |
% |
| 2663 |
% \begin{command}{\ifnumber,\Ifnumber} |
| 2664 |
% \changes{v3.12}{2013/10/30}{using \cs{aftergroup} instead of |
| 2665 |
% \cs{endgroup}\cs{expandafter}} |
| 2666 |
% \changes{v3.12a}{2014/01/24}{white space removed} |
| 2667 |
% \changes{v3.27}{2019/08/26}{empty arguments fixed} |
| 2668 |
% \changes{v3.28}{2019/11/18}{\cs{ifnumber} renamed to \cs{Ifnumber}} |
| 2669 |
% If the first argument is a positive integer, the second argument is |
| 2670 |
% executed, otherwise the third. |
| 2671 |
% \begin{macrocode} |
| 2672 |
%<*base> |
| 2673 |
\providecommand*{\ifnumber}{% |
| 2674 |
% \end{macrocode} |
| 2675 |
% Note: We must not output the warning if package \pkg{babelbib} has been |
| 2676 |
% loaded, because the package defines the same command but only, if it has not |
| 2677 |
% been defined already. Unfortunately and against all conventions, it even |
| 2678 |
% defines internal macros of \pkg*{scrbase} with prefix \cs{scr@}. This is |
| 2679 |
% very dangerous and would result in errors, if \pkg{babelbib} is loaded |
| 2680 |
% before \pkg*{scrbase}. Maybe I will remove this special treatment of |
| 2681 |
% \pkg{babelbib} after switching over to \pkg{biblatex} for the \KOMAScript{} |
| 2682 |
% manuals. |
| 2683 |
% \begin{macrocode} |
| 2684 |
\scr@ifundefinedorrelax{[email protected]}{% |
| 2685 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2686 |
`\string\ifnumber'.\MessageBreak |
| 2687 |
The command has been renamed because of a\MessageBreak |
| 2688 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2689 |
Please replace `\string\ifnumber' by `\string\Ifnumber'% |
| 2690 |
}% |
| 2691 |
}{}% |
| 2692 |
\Ifnumber |
| 2693 |
} |
| 2694 |
\newcommand\Ifnumber[1]{% |
| 2695 |
\begingroup\@tempswafalse\let\scr@next\scr@test@number |
| 2696 |
\IfArgIsEmpty{#1}{}{\expandafter\scr@next#1\scr@next}% |
| 2697 |
\if@tempswa |
| 2698 |
\aftergroup\@firstoftwo |
| 2699 |
\else |
| 2700 |
\aftergroup\@secondoftwo |
| 2701 |
\fi |
| 2702 |
\endgroup |
| 2703 |
} |
| 2704 |
% \end{macrocode} |
| 2705 |
% \begin{macro}{\test@number,\scr@test@number} |
| 2706 |
% \changes{v3.36}{2022/02/17}{\cs{test@number} renamed to \cs{scr@test@number}} |
| 2707 |
% For the real test scan the first argument token by token. |
| 2708 |
% \begin{macrocode} |
| 2709 |
\newcommand*{\scr@test@number}[1]{% |
| 2710 |
\ifx \scr@next#1% |
| 2711 |
\let\scr@next\relax |
| 2712 |
\else |
| 2713 |
\@tempcnta=\expandafter\expandafter\expandafter\number |
| 2714 |
\expandafter`#1\relax |
| 2715 |
\ifnum \@tempcnta>47 |
| 2716 |
\ifnum \@tempcnta<58 |
| 2717 |
\@tempswatrue |
| 2718 |
\else\@tempswafalse\fi |
| 2719 |
\else\@tempswafalse\fi |
| 2720 |
% \end{macrocode} |
| 2721 |
% Remove the rest, if a non-digit has been found. |
| 2722 |
% \begin{macrocode} |
| 2723 |
\if@tempswa\else\let\scr@next\gobble@till@scr@next\fi |
| 2724 |
\fi |
| 2725 |
\scr@next |
| 2726 |
} |
| 2727 |
% \end{macrocode} |
| 2728 |
% \begin{macro}{\gobble@tillscr@@next} |
| 2729 |
% Use a delimited \emph{empty} macro. |
| 2730 |
% \begin{macrocode} |
| 2731 |
\newcommand*{\gobble@till@scr@next}{} |
| 2732 |
\def\gobble@till@scr@next#1\scr@next{} |
| 2733 |
%</base> |
| 2734 |
% \end{macrocode} |
| 2735 |
% \end{macro}^^A \gobble@tillscr@next |
| 2736 |
% \end{macro}^^A \test@number, \scr@test@number |
| 2737 |
% \end{command}^^A \ifnumber,\Ifnumber |
| 2738 |
% |
| 2739 |
% \begin{command}{\ifintnumber,\Ifintnumber} |
| 2740 |
% \changes{v3.12}{2013/10/30}{added} |
| 2741 |
% \changes{v3.28}{2019/11/18}{\cs{ifintnumber} renamed to |
| 2742 |
% \cs{Ifintnumber}} |
| 2743 |
% If the first argument is a positive or negative integer, execute the second |
| 2744 |
% argument, otherwise the third one. There are multiple arithmetic signs allowed. |
| 2745 |
% \begin{macrocode} |
| 2746 |
%<*base> |
| 2747 |
\providecommand*{\ifintnumber}{% |
| 2748 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2749 |
`\string\ifintnumber'.\MessageBreak |
| 2750 |
The command has been renamed because of a\MessageBreak |
| 2751 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2752 |
Please replace `\string\ifintnumber' by `\string\Ifintnumber'% |
| 2753 |
}% |
| 2754 |
\Ifintnumber |
| 2755 |
} |
| 2756 |
\newcommand\Ifintnumber[1]{% |
| 2757 |
\begingroup\@tempswafalse\let\scr@next\scr@test@sign |
| 2758 |
\expandafter\scr@next#1\scr@next |
| 2759 |
\if@tempswa |
| 2760 |
\aftergroup\@firstoftwo |
| 2761 |
\else |
| 2762 |
\aftergroup\@secondoftwo |
| 2763 |
\fi |
| 2764 |
\endgroup |
| 2765 |
} |
| 2766 |
% \end{macrocode} |
| 2767 |
% \begin{macro}{\scr@test@sign} |
| 2768 |
% \changes{v3.12}{2013/10/30}{added} |
| 2769 |
% \begin{macrocode} |
| 2770 |
\newcommand*{\scr@test@sign}[1]{% |
| 2771 |
\ifx \scr@next#1 |
| 2772 |
\let\scr@next\relax |
| 2773 |
\else |
| 2774 |
\if #1-% |
| 2775 |
\else |
| 2776 |
\ifx #1+% |
| 2777 |
\else |
| 2778 |
\def\scr@next{\let\scr@next\scr@test@number\scr@next #1}% |
| 2779 |
\fi |
| 2780 |
\fi |
| 2781 |
\fi |
| 2782 |
\scr@next |
| 2783 |
} |
| 2784 |
%</base> |
| 2785 |
% \end{macrocode} |
| 2786 |
% \end{macro}^^A \scr@test@sign |
| 2787 |
% \end{command}^^A \ifintnumber,\Ifintnumber |
| 2788 |
% |
| 2789 |
% \begin{command}{\ifdimen,\Ifdimen} |
| 2790 |
% \changes{v3.28}{2019/11/18}{renamed to \cs{Ifdimen}} |
| 2791 |
% If the first argument is a dimension number, the second argument will be |
| 2792 |
% executed, otherwise the third. |
| 2793 |
% \begin{macrocode} |
| 2794 |
%<*base> |
| 2795 |
\providecommand*{\ifdimen}{% |
| 2796 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 2797 |
`\string\ifdimen'.\MessageBreak |
| 2798 |
The command has been renamed because of a\MessageBreak |
| 2799 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 2800 |
Please replace `\string\ifdimen' by `\string\Ifdimen'% |
| 2801 |
}% |
| 2802 |
\Ifdimen |
| 2803 |
} |
| 2804 |
\newcommand{\Ifdimen}[1]{% |
| 2805 |
\begingroup\@tempswatrue\let\scr@next\scr@test@posdimen |
| 2806 |
\expandafter\scr@test@dimen#1\scr@next |
| 2807 |
\if@tempswa |
| 2808 |
\endgroup\expandafter\@firstoftwo |
| 2809 |
\else |
| 2810 |
\endgroup\expandafter\@secondoftwo |
| 2811 |
\fi |
| 2812 |
} |
| 2813 |
% \end{macrocode} |
| 2814 |
% \begin{macro}{\test@dimen,\scr@test@dimen} |
| 2815 |
% \changes{v3.36}{2022/02/17}{\cs{test@dimen} renamed to \cs{scr@test@dimen}} |
| 2816 |
% We have to remove the arithmetic signs. |
| 2817 |
% \begin{macrocode} |
| 2818 |
\newcommand*{\scr@test@dimen}[1]{% |
| 2819 |
\ifx -#1\else\ifx +#1\else |
| 2820 |
\def\scr@next{\let\scr@next\scr@test@posdimen\scr@next#1}\fi\fi |
| 2821 |
\scr@next |
| 2822 |
} |
| 2823 |
% \end{macrocode} |
| 2824 |
% \begin{macro}{\test@posdimen,\scr@test@posdimen} |
| 2825 |
% \changes{v3.36}{2022/02/17}{\cs{test@posdimen} renamed to \cs{scr@test@posdimen}} |
| 2826 |
% Is the rest a dimension. Despite this is not correct, we allow more than one |
| 2827 |
% decimal point or decimal comma. Should this be changed? |
| 2828 |
% \begin{macrocode} |
| 2829 |
\newcommand*{\scr@test@posdimen}[1]{% |
| 2830 |
\ifx \scr@next#1% |
| 2831 |
\@tempswafalse\let\scr@next\relax |
| 2832 |
\else |
| 2833 |
\if .#1\else\if ,#1\else |
| 2834 |
\@tempcnta=% |
| 2835 |
\expandafter\expandafter\expandafter\number\expandafter`#1\relax |
| 2836 |
\ifnum \@tempcnta>47 |
| 2837 |
\ifnum \@tempcnta<58 |
| 2838 |
\else\def\scr@next{\scr@test@dimunt#1}\fi |
| 2839 |
\else\def\scr@next{\scr@test@dimunt#1}\fi |
| 2840 |
\fi\fi |
| 2841 |
\fi |
| 2842 |
\scr@next |
| 2843 |
} |
| 2844 |
% \end{macrocode} |
| 2845 |
% \begin{macro}{\test@dimunt,\test@trueunt,\scr@test@dimunt,\scr@test@trueunt} |
| 2846 |
% Last but not least the unit has to be tested. We have standard units and |
| 2847 |
% true units. So we first cut of a ``\texttt{true}''. |
| 2848 |
% \begin{macrocode} |
| 2849 |
\newcommand*{\scr@test@dimunt}{} |
| 2850 |
\def\scr@test@dimunt#1\scr@next{% |
| 2851 |
\expandafter\scr@test@trueunt#1truetrue\scr@test@trueunt |
| 2852 |
} |
| 2853 |
\newcommand*{\scr@test@trueunt}{} |
| 2854 |
\def\scr@test@trueunt#1true#2true#3\scr@test@trueunt{% |
| 2855 |
\edef\reserved@a{#1}% |
| 2856 |
\ifx\reserved@a\@empty\scr@test@@dimunt{#2}\else\scr@test@@dimunt{#1}\fi |
| 2857 |
} |
| 2858 |
% \end{macrocode} |
| 2859 |
% \begin{macro}{\test@@ifdimunt,\scr@test@@dimunt} |
| 2860 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 2861 |
% Currently we know eleven or twelve units. Unit \texttt{px} is only valid |
| 2862 |
% with PDF output. |
| 2863 |
% \begin{macrocode} |
| 2864 |
\newcommand*\scr@test@@dimunt[1]{% |
| 2865 |
\@tempswafalse |
| 2866 |
\Ifstr{#1}{pt}{\@tempswatrue}{% |
| 2867 |
\Ifstr{#1}{pc}{\@tempswatrue}{% |
| 2868 |
\Ifstr{#1}{in}{\@tempswatrue}{% |
| 2869 |
\Ifstr{#1}{bp}{\@tempswatrue}{% |
| 2870 |
\Ifstr{#1}{cm}{\@tempswatrue}{% |
| 2871 |
\Ifstr{#1}{mm}{\@tempswatrue}{% |
| 2872 |
\Ifstr{#1}{dd}{\@tempswatrue}{% |
| 2873 |
\Ifstr{#1}{cc}{\@tempswatrue}{% |
| 2874 |
\Ifstr{#1}{sp}{\@tempswatrue}{% |
| 2875 |
\Ifstr{#1}{ex}{\@tempswatrue}{% |
| 2876 |
\Ifstr{#1}{em}{\@tempswatrue}{% |
| 2877 |
\scr@ifpdfoutput{% |
| 2878 |
\Ifstr{#1}{px}{\@tempswatrue}{}% |
| 2879 |
}{}% |
| 2880 |
}% |
| 2881 |
}% |
| 2882 |
}% |
| 2883 |
}% |
| 2884 |
}% |
| 2885 |
}% |
| 2886 |
}% |
| 2887 |
}% |
| 2888 |
}% |
| 2889 |
}% |
| 2890 |
}% |
| 2891 |
} |
| 2892 |
%</base> |
| 2893 |
% \end{macrocode} |
| 2894 |
% \end{macro}^^A \test@@ifdimunt,\scr@test@@dimunt |
| 2895 |
% \end{macro}^^A \test@dimunt,\test@trueunt,\scr@test@dimunt,\scr@test@trueunt |
| 2896 |
% \end{macro}^^A \scr@test@posdimen |
| 2897 |
% \end{macro}^^A \scr@test@dimen |
| 2898 |
% \end{command}^^A \ifdimen,\Ifdimen |
| 2899 |
% |
| 2900 |
% |
| 2901 |
% \begin{command}{\ifpdftex} |
| 2902 |
% \changes{v2.95}{2002/08/19}{added} |
| 2903 |
% \changes{v3.28}{2019/11/18}{removed} |
| 2904 |
% \end{command} |
| 2905 |
% \begin{macro}{\scr@ifpdftex} |
| 2906 |
% \changes{v2.95}{2002/08/19}{added} |
| 2907 |
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}} |
| 2908 |
% If \pdfTeX{} is used, execute the first argument, otherwise the |
| 2909 |
% second. Note, we do not read the arguments but delegate them to |
| 2910 |
% \cs{Ifnotundefined}. |
| 2911 |
% \begin{macrocode} |
| 2912 |
%<*base> |
| 2913 |
\newcommand{\scr@ifpdftex}{\Ifnotundefined{pdftexversion}} |
| 2914 |
%</base> |
| 2915 |
% \end{macrocode} |
| 2916 |
% \end{macro} |
| 2917 |
% |
| 2918 |
% \begin{macro}{\scr@ifluatex} |
| 2919 |
% \changes{v3.21}{2016/05/27}{added} |
| 2920 |
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}} |
| 2921 |
% If \LuaTeX{} is used, execute the first argument, otherwise the |
| 2922 |
% second. Note, we do not read the arguments but delegate them to |
| 2923 |
% \cs{Ifnotundefined}. |
| 2924 |
% \begin{macrocode} |
| 2925 |
%<*base> |
| 2926 |
\newcommand{\scr@ifluatex}{\Ifnotundefined{luatexversion}} |
| 2927 |
%</base> |
| 2928 |
% \end{macrocode} |
| 2929 |
% \end{macro} |
| 2930 |
% |
| 2931 |
% \begin{macro}{\scr@ifpdforluatex} |
| 2932 |
% \changes{v3.21}{2016/05/27}{added} |
| 2933 |
% If either \LuaTeX{} or \pdfTeX{} is used, execute the first argument, |
| 2934 |
% otherwise the second. Note, we do not read the arguments but delegate them |
| 2935 |
% to \cs{@firstoftwo} and \cs{@secondoftwo}. |
| 2936 |
% \begin{macrocode} |
| 2937 |
%<*base> |
| 2938 |
\newcommand*{\scr@ifpdforluatex}{% |
| 2939 |
\scr@ifpdftex{\@firstoftwo}{\scr@ifluatex{\@firstoftwo}{\@secondoftwo}}% |
| 2940 |
} |
| 2941 |
%</base> |
| 2942 |
% \end{macrocode} |
| 2943 |
% \end{macro} |
| 2944 |
% |
| 2945 |
% \begin{command}{\ifvtex,\ifVTeX} |
| 2946 |
% \changes{v2.95}{2002/08/19}{added} |
| 2947 |
% \changes{v2.97c}{2007/06/20}{\cs{ifvtex} renamed to \cs{ifVTeX}} |
| 2948 |
% \changes{v3.28}{2019/11/18}{removed} |
| 2949 |
% \end{command} |
| 2950 |
% \begin{macro}{\scr@ifvtex,\scr@ifVTeX} |
| 2951 |
% \changes{v2.95}{2002/08/19}{added} |
| 2952 |
% \changes{v2.97c}{2007/06/20}{\cs{scr@ifvtex} renamed to \cs{scr@ifVTeX}} |
| 2953 |
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}} |
| 2954 |
% If \VTeX{} is used, execute the first argument, otherwise the |
| 2955 |
% second. Note, we do not read the arguments but delegate them to |
| 2956 |
% \cs{Ifnotundefined}. |
| 2957 |
% \begin{macrocode} |
| 2958 |
%<*base> |
| 2959 |
\newcommand{\scr@ifVTeX}{\Ifnotundefined{VTeXversion}} |
| 2960 |
%</base> |
| 2961 |
% \end{macrocode} |
| 2962 |
% \end{macro} |
| 2963 |
% |
| 2964 |
% \begin{command}{\ifpdfoutput,\Ifpdfoutput} |
| 2965 |
% \changes{v2.7g}{2001/04/17}{added} |
| 2966 |
% \changes{v2.8q}{2001/10/19}{\cs{pdfoutput} does not become \cs{relax} if it |
| 2967 |
% was undefined before} |
| 2968 |
% \changes{v2.8q}{2001/10/19}{\cs{ifpdfoutput} is only defined if new} |
| 2969 |
% \changes{v2.8q}{2001/10/19}{usage of \cs{scr@ifpdfoutput}} |
| 2970 |
% \changes{v3.28}{2019/11/18}{\cs{ifpdfoutput} renamed to \cs{Ifpdfoutput}} |
| 2971 |
% \begin{macro}{\scr@ifpdfoutput} |
| 2972 |
% \changes{v2.8q}{2001/10/19}{added} |
| 2973 |
% \changes{v2.8q}{2001/11/13}{full functional} |
| 2974 |
% \changes{v2.95}{2002/08/21}{knowing \VTeX} |
| 2975 |
% \changes{v2.95}{2004/07/20}{expandable} |
| 2976 |
% \changes{v3.21}{2016/05/27}{works for \LuaTeX{} after version 0.85} |
| 2977 |
% If the output (currently) produces a PDF, the first argument is executed, |
| 2978 |
% otherwise the second one. This macro is used inside the implementation of |
| 2979 |
% option \opt{pagesize}, so we cannot remove it or declare it as deprecated. |
| 2980 |
% \begin{macrocode} |
| 2981 |
%<*base> |
| 2982 |
\newcommand{\scr@ifpdfoutput}{% |
| 2983 |
\scr@ifundefinedorrelax{pdfoutput}{% |
| 2984 |
\scr@ifundefinedorrelax{outputmode}{% |
| 2985 |
\scr@ifundefinedorrelax{OpMode}{% |
| 2986 |
\expandafter\@secondoftwo% |
| 2987 |
}{% |
| 2988 |
\ifnum\OpMode=1 |
| 2989 |
\expandafter\@firstoftwo |
| 2990 |
\else |
| 2991 |
\expandafter\@secondoftwo |
| 2992 |
\fi |
| 2993 |
}% |
| 2994 |
}{% |
| 2995 |
\ifnum\outputmode>0 |
| 2996 |
\expandafter\@firstoftwo |
| 2997 |
\else |
| 2998 |
\expandafter\@secondoftwo |
| 2999 |
\fi |
| 3000 |
}% |
| 3001 |
}{% |
| 3002 |
\ifnum\pdfoutput>0 |
| 3003 |
\expandafter\@firstoftwo |
| 3004 |
\else |
| 3005 |
\expandafter\@secondoftwo |
| 3006 |
\fi |
| 3007 |
}% |
| 3008 |
}% |
| 3009 |
\providecommand*{\ifpdfoutput}{% |
| 3010 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 3011 |
`\string\ifpdfoutput'.\MessageBreak |
| 3012 |
The command has been renamed because of a\MessageBreak |
| 3013 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 3014 |
Please replace `\string\ifpdfoutput' by `\string\Ifpdfoutput'% |
| 3015 |
}% |
| 3016 |
\Ifpdfoutput |
| 3017 |
} |
| 3018 |
\newcommand*{\Ifpdfoutput}{\scr@ifpdfoutput} |
| 3019 |
%</base> |
| 3020 |
% \end{macrocode} |
| 3021 |
% \end{macro} |
| 3022 |
% \end{command} |
| 3023 |
% |
| 3024 |
% \begin{command}{\ifpsoutput,\Ifpsoutput} |
| 3025 |
% \changes{v2.95}{2002/08/21}{added} |
| 3026 |
% \changes{v3.28}{2019/11/18}{renamed to \cs{Ifpsoutput}} |
| 3027 |
% \begin{macro}{\scr@ifpsoutput} |
| 3028 |
% \changes{v2.95}{2002/08/21}{added} |
| 3029 |
% \changes{v2.95}{2004/07/20}{expandable} |
| 3030 |
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}} |
| 3031 |
% If the output is (currently) expected to be PS some time, the first argument |
| 3032 |
% is executed, otherwise the second one. This macro is used inside the |
| 3033 |
% implementation of option \opt{pagesize}, so we cannot remove it or declare |
| 3034 |
% it as deprecated. |
| 3035 |
% \begin{macrocode} |
| 3036 |
%<*base> |
| 3037 |
\newcommand*{\scr@ifpsoutput}{% |
| 3038 |
\Ifnotundefined{if@dvips}{% |
| 3039 |
\if@dvips |
| 3040 |
\expandafter\@firstoftwo |
| 3041 |
\else |
| 3042 |
\expandafter\@secondoftwo |
| 3043 |
\fi |
| 3044 |
}{% |
| 3045 |
\Ifnotundefined{OpMode}{% |
| 3046 |
\ifnum\OpMode=2 |
| 3047 |
\expandafter\@firstoftwo |
| 3048 |
\else |
| 3049 |
\expandafter\@secondoftwo |
| 3050 |
\fi |
| 3051 |
}{% |
| 3052 |
\expandafter\@secondoftwo |
| 3053 |
}% |
| 3054 |
}% |
| 3055 |
} |
| 3056 |
\providecommand*{\ifpsoutput}{% |
| 3057 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 3058 |
`\string\ifpsoutput'.\MessageBreak |
| 3059 |
The command has been renamed because of a\MessageBreak |
| 3060 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 3061 |
Please replace `\string\ifpsoutput' by `\string\Ifpsoutput'% |
| 3062 |
}% |
| 3063 |
\Ifpsoutput |
| 3064 |
} |
| 3065 |
\newcommand*{\Ifpsoutput}{\scr@ifpsoutput} |
| 3066 |
%</base> |
| 3067 |
% \end{macrocode} |
| 3068 |
% \end{macro} |
| 3069 |
% \end{command} |
| 3070 |
% |
| 3071 |
% \begin{command}{\ifdvioutput,\Ifdvioutput} |
| 3072 |
% \changes{v2.95}{2002/08/21}{added} |
| 3073 |
% \changes{v3.28}{2019/11/18}{\cs{ifdvioutput} renamed to \cs{Ifdvioutput}} |
| 3074 |
% \begin{macro}{\scr@ifdvioutput} |
| 3075 |
% \changes{v2.95}{2002/08/21}{added} |
| 3076 |
% \changes{v2.95}{2004/07/20}{expandable} |
| 3077 |
% \changes{v3.23}{2017/02/14}{works for \LuaTeX{} after version 0.85} |
| 3078 |
% If the output (currently) produces a DVI, the first argument is executed, |
| 3079 |
% otherwise the second one. This macro is used inside the implementation of |
| 3080 |
% option \opt{pagesize}, so we cannot remove it or declare it as deprecated. |
| 3081 |
% \begin{macrocode} |
| 3082 |
%<*base> |
| 3083 |
\newcommand*{\scr@ifdvioutput}{% |
| 3084 |
\scr@ifundefinedorrelax{pdfoutput}{% |
| 3085 |
\scr@ifundefinedorrelax{outputmode}{% |
| 3086 |
\scr@ifundefinedorrelax{OpMode}{% |
| 3087 |
\expandafter\@firstoftwo |
| 3088 |
}{% |
| 3089 |
\ifnum\OpMode=0 |
| 3090 |
\expandafter\@firstoftwo |
| 3091 |
\else |
| 3092 |
\expandafter\@secondoftwo |
| 3093 |
\fi |
| 3094 |
}% |
| 3095 |
}{% |
| 3096 |
\ifnum\outputmode>0 |
| 3097 |
\expandafter\@secondoftwo |
| 3098 |
\else |
| 3099 |
\expandafter\@firstoftwo |
| 3100 |
\fi |
| 3101 |
}% |
| 3102 |
}{% |
| 3103 |
\ifnum\pdfoutput=0 |
| 3104 |
\expandafter\@firstoftwo |
| 3105 |
\else |
| 3106 |
\expandafter\@secondoftwo |
| 3107 |
\fi |
| 3108 |
}% |
| 3109 |
} |
| 3110 |
\providecommand*{\ifdvioutput}{% |
| 3111 |
\PackageWarning{scrbase}{Usage of deprecated command |
| 3112 |
`\string\ifdvioutput'.\MessageBreak |
| 3113 |
The command has been renamed because of a\MessageBreak |
| 3114 |
recommendation of The LaTeX Project Team.\MessageBreak |
| 3115 |
Please replace `\string\ifdvioutput' by `\string\Ifdvioutput'% |
| 3116 |
}% |
| 3117 |
\Ifdvioutput |
| 3118 |
} |
| 3119 |
\newcommand*{\Ifdvioutput}{\scr@ifdvioutput} |
| 3120 |
%</base> |
| 3121 |
% \end{macrocode} |
| 3122 |
% \end{macro} |
| 3123 |
% \end{command} |
| 3124 |
% |
| 3125 |
% \begin{macro}{\scr@smashdp} |
| 3126 |
% \changes{v2.97c}{2007/09/17}{added} |
| 3127 |
% \changes{v3.02a}{2009/01/23}{using own definition instead of \cs{smash}} |
| 3128 |
% \changes{v3.36}{2022/02/18}{as robust as \cs{smash}} |
| 3129 |
% Generate a box and output it with height and width but no depth. Note: Using |
| 3130 |
% internal macros \cs{finsm@sh}, \cs{mathsm@sh} and \cs{makesm@ash} from the |
| 3131 |
% \LaTeX{} kernel is a very ugly hack and dangerous. Using \cs{smash} itself |
| 3132 |
% would be problematic, because \pkg{amsmath} redefines it and the new |
| 3133 |
% definition is not fully compatible. But maybe a better definition could be |
| 3134 |
% found depending on, whether \pkg{amsmath} has been loaded or not. |
| 3135 |
% \begin{macrocode} |
| 3136 |
%<*base> |
| 3137 |
\DeclareRobustCommand{\scr@smashdp}[1]{% |
| 3138 |
\relax |
| 3139 |
\begingroup |
| 3140 |
\def\finsm@sh{\dp\z@\z@ \leavevmode\box\z@}% |
| 3141 |
\ifmmode |
| 3142 |
\expandafter\mathpalette\expandafter\mathsm@sh |
| 3143 |
\else |
| 3144 |
\expandafter\makesm@sh |
| 3145 |
\fi |
| 3146 |
{#1}% |
| 3147 |
\endgroup |
| 3148 |
} |
| 3149 |
%</base> |
| 3150 |
% \end{macrocode} |
| 3151 |
% \end{macro} |
| 3152 |
% |
| 3153 |
% \begin{command}{\IfRTL} |
| 3154 |
% \changes{v3.24}{2017/05/04}{added} |
| 3155 |
% \changes{v3.36}{2022/02/18}{white space removed} |
| 3156 |
% If we are in the right-to-left mode of a package like \pkg{bidi} the first |
| 3157 |
% argument will be used otherwise the second one. |
| 3158 |
% \begin{macrocode} |
| 3159 |
%<*base> |
| 3160 |
\newcommand*{\IfRTL}{% |
| 3161 |
\scr@ifundefinedorrelax{if@RTL}{\@secondoftwo}{% |
| 3162 |
\expandafter\ifx\csname if@RTL\expandafter\endcsname |
| 3163 |
\csname iftrue\endcsname |
| 3164 |
\expandafter\@firstoftwo |
| 3165 |
\else |
| 3166 |
\expandafter\@secondoftwo |
| 3167 |
\fi |
| 3168 |
}% |
| 3169 |
} |
| 3170 |
%</base> |
| 3171 |
% \end{macrocode} |
| 3172 |
% \end{command}^^A \IfRTL |
| 3173 |
% \begin{command}{\IfLTR} |
| 3174 |
% \changes{v3.24}{2017/05/04}{added} |
| 3175 |
% \changes{v3.36}{2022/02/18}{white space removed} |
| 3176 |
% If we are not in the right-to-left mode of a package like \pkg{bidi} any |
| 3177 |
% kind of left-to-right mode is assumed and the first argument is used, |
| 3178 |
% otherwise the second one. |
| 3179 |
% \begin{macrocode} |
| 3180 |
%<*base> |
| 3181 |
\newcommand*{\IfLTR}{% |
| 3182 |
\scr@ifundefinedorrelax{if@RTL}{\@firstoftwo}{% |
| 3183 |
\expandafter\ifx\csname if@RTL\expandafter\endcsname |
| 3184 |
\csname iftrue\endcsname |
| 3185 |
\expandafter\@secondoftwo |
| 3186 |
\else |
| 3187 |
\expandafter\@firstoftwo |
| 3188 |
\fi |
| 3189 |
}% |
| 3190 |
} |
| 3191 |
%</base> |
| 3192 |
% \end{macrocode} |
| 3193 |
% \end{command}^^A \IfLTR |
| 3194 |
% |
| 3195 |
% \begin{command}{\PackageInfoNoLine} |
| 3196 |
% \changes{v2.97d}{2007/10/03}{added} |
| 3197 |
% Like \cs{PackageInfo} but without output of line number at the end. |
| 3198 |
% \begin{macrocode} |
| 3199 |
%<*base> |
| 3200 |
\providecommand*{\PackageInfoNoLine}[2]{% |
| 3201 |
\PackageInfo{#1}{#2\@gobble}% |
| 3202 |
} |
| 3203 |
%</base> |
| 3204 |
% \end{macrocode} |
| 3205 |
% \end{command} |
| 3206 |
% |
| 3207 |
% \begin{command}{\ClassInfoNoLine} |
| 3208 |
% \changes{v2.98c}{2008/02/15}{added} |
| 3209 |
% Like \cs{ClassInfo} but without output of line number at the end. |
| 3210 |
% \begin{macrocode} |
| 3211 |
%<*base> |
| 3212 |
\providecommand*{\ClassInfoNoLine}[2]{% |
| 3213 |
\ClassInfo{#1}{#2\@gobble}% |
| 3214 |
} |
| 3215 |
%</base> |
| 3216 |
% \end{macrocode} |
| 3217 |
% \end{command} |
| 3218 |
% |
| 3219 |
% \begin{macro}{\@removefromreset} |
| 3220 |
% \changes{v3.15}{2014/11/21}{added}% |
| 3221 |
% For \LaTeX{} releases before 2018/04/01 and without using a package like |
| 3222 |
% \pkg{remreset} or \pkg{chngcntr} we still need \cs{@removefromreset}. |
| 3223 |
% \begin{macrocode} |
| 3224 |
%<*base> |
| 3225 |
\providecommand*\@removefromreset[2]{% |
| 3226 |
{% |
| 3227 |
\expandafter\let\csname c@#1\endcsname\@removefromreset |
| 3228 |
\def\@elt##1{% |
| 3229 |
\expandafter\ifx\csname c@##1\endcsname\@removefromreset |
| 3230 |
\else\noexpand\@elt{##1}\fi |
| 3231 |
}% |
| 3232 |
\expandafter\xdef\csname cl@#2\endcsname{\csname cl@#2\endcsname}% |
| 3233 |
}% |
| 3234 |
} |
| 3235 |
%</base> |
| 3236 |
% \end{macrocode} |
| 3237 |
% \end{macro} |
| 3238 |
% |
| 3239 |
% \begin{command}{\IfActiveMkBoth} |
| 3240 |
% \changes{v3.26}{2018/09/03}{added} |
| 3241 |
% \begin{macro}{\if@scrActiveMkBoth} |
| 3242 |
% \changes{v3.26}{2018/09/03}{added} |
| 3243 |
% \changes{v3.27}{2019/07/26}{handling for \cs{marks}} |
| 3244 |
% This command test, whether or not \cs{@mkboth} does change a mark or not. |
| 3245 |
% \begin{macrocode} |
| 3246 |
%<*base> |
| 3247 |
\newif\ifscr@ActiveMkBoth |
| 3248 |
\def\scr@ActiveMkBothfalse{\global\let\ifscr@ActiveMkBoth\iffalse} |
| 3249 |
\def\scr@ActiveMkBothtrue {\global\let\ifscr@ActiveMkBoth\iftrue} |
| 3250 |
\newcommand*{\IfActiveMkBoth}{% |
| 3251 |
\begingroup |
| 3252 |
\def\markboth##1##2{\scr@ActiveMkBothtrue}% |
| 3253 |
\def\markright##1{\scr@ActiveMkBothtrue}% |
| 3254 |
\def\markleft##1{\scr@ActiveMkBothtrue}% |
| 3255 |
\def\markboth##1{\scr@ActiveMkBothtrue}% |
| 3256 |
\def\markdouble##1{\scr@ActiveMkBothtrue}% |
| 3257 |
\def\mark##1{\scr@ActiveMkBothtrue}% |
| 3258 |
\def\marks##1##2{\scr@ActiveMkBothtrue}% |
| 3259 |
\scr@ActiveMkBothfalse |
| 3260 |
\setbox\@tempboxa\vbox{\@mkboth{}{}}% |
| 3261 |
\endgroup |
| 3262 |
\ifscr@ActiveMkBoth |
| 3263 |
\expandafter\@firstoftwo |
| 3264 |
\else |
| 3265 |
\expandafter\@secondoftwo |
| 3266 |
\fi |
| 3267 |
} |
| 3268 |
%</base> |
| 3269 |
% \end{macrocode} |
| 3270 |
% \end{macro}^^A \if@scrActiveMkBoth |
| 3271 |
% \end{command}^^A \IfActiveMkBoth |
| 3272 |
% |
| 3273 |
% |
| 3274 |
% \subsection{Definition of the \KOMAScript{} \pkg*{keyval} main handling} |
| 3275 |
% |
| 3276 |
% \begin{command}{\FamilyExecuteOptions} |
| 3277 |
% \changes{v3.00}{2008/04/30}{added} |
| 3278 |
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}} |
| 3279 |
% \changes{v3.04b}{2010/02/02}{prevent overwriting of \cs{scr@key@atlist} and |
| 3280 |
% \cs{scr@key@name} in \cs{setkeys}} |
| 3281 |
% \changes{v3.12}{2013/03/04}{re-implemented} |
| 3282 |
% \changes{v3.12}{2013/03/04}{can be used after document preamble} |
| 3283 |
% \changes{v3.14}{2014/10/17}{third argument is \cs{long}} |
| 3284 |
% \begin{macro}{\@FamilyExecuteOptions} |
| 3285 |
% \changes{v3.14}{2014/10/17}{added} |
| 3286 |
% \changes{v3.23}{2017/02/16}{fix: hook after uses family instead of member} |
| 3287 |
% \changes{v3.27}{2019/10/02}{improved error message} |
| 3288 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 3289 |
% Similar to \cs{ExecuteOptions} but with \pkg{keyval} options. The command |
| 3290 |
% also is re-entrant. Note: The hooks are local to every usage. |
| 3291 |
% \begin{macrocode} |
| 3292 |
%<*base> |
| 3293 |
\newcommand*{\FamilyExecuteOptions}[2][.\@currname.\@currext]{% |
| 3294 |
\@FamilyExecuteOptions[{#1}]{#2}% |
| 3295 |
} |
| 3296 |
\newcommand{\@FamilyExecuteOptions}[3][.\@currname.\@currext]{% |
| 3297 |
\scr@ifundefinedorrelax{scr@after@options@#2@hook}{% |
| 3298 |
\@namedef{scr@after@options@#2@hook}{% |
| 3299 |
\@namedef{scr@after@options@#2@hook}{}% |
| 3300 |
}% |
| 3301 |
}{% |
| 3302 |
\expandafter\edef\csname scr@after@options@#2@hook\endcsname{% |
| 3303 |
\noexpand\@namedef{scr@after@options@#2@hook}{% |
| 3304 |
\unexpanded\expandafter\expandafter\expandafter |
| 3305 |
{\csname scr@after@options@#2@hook\endcsname}% |
| 3306 |
}% |
| 3307 |
}% |
| 3308 |
}% |
| 3309 |
\@for\scr@key@atlist:=#3\do{% |
| 3310 |
\expandafter\scr@key@split@name@value\scr@key@atlist==\@nil |
| 3311 |
\ifx\scr@key@name\@empty\else |
| 3312 |
\ifx\scr@key@name\space\else |
| 3313 |
\scr@ifundefinedorrelax{KV@#2@\scr@key@name}{% |
| 3314 |
\scr@ifundefinedorrelax{KV@#2#1@\scr@key@name}{% |
| 3315 |
% \end{macrocode} |
| 3316 |
% \changes{v3.20}{2015/11/18}{special treatment of \opt{@else@} option} |
| 3317 |
% Neither family nor member option found. But maybe special option |
| 3318 |
% \opt{@else@} exists. In this case the current option is set as value of |
| 3319 |
% \opt{@else@}. |
| 3320 |
% \begin{macrocode} |
| 3321 |
\scr@ifundefinedorrelax{KV@#2#1@@else@}{% |
| 3322 |
\PackageError{scrbase}{% |
| 3323 |
unknown option |
| 3324 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3325 |
}{% |
| 3326 |
Member `#1' of family `#2'\MessageBreak |
| 3327 |
cannot handle option `\scr@key@name'.\MessageBreak |
| 3328 |
So it cannot be set% |
| 3329 |
\ifx\scr@key@value\@empty\else |
| 3330 |
\space to value |
| 3331 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3332 |
\fi.% |
| 3333 |
}% |
| 3334 |
}{% |
| 3335 |
\scr@execute@elseoption{#2#1}% |
| 3336 |
% \end{macrocode} |
| 3337 |
% In difference to other options, for \opt{@else@} all states different from |
| 3338 |
% \cs{FamilyKeyStateProcessed} have to be reported as error of the |
| 3339 |
% current/original option. |
| 3340 |
% \begin{macrocode} |
| 3341 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed\else |
| 3342 |
\PackageError{scrbase}{% |
| 3343 |
unknown option |
| 3344 |
\ifx\FamilyKeyState\FamilyKeyStateUnknownValue |
| 3345 |
value at |
| 3346 |
\fi |
| 3347 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3348 |
}{% |
| 3349 |
Member `#1' of family `#2'\MessageBreak |
| 3350 |
cannot handle option `\scr@key@name'.\MessageBreak |
| 3351 |
So it cannot be set% |
| 3352 |
\ifx\scr@key@value\@empty\else |
| 3353 |
\space to value |
| 3354 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3355 |
\fi.% |
| 3356 |
}% |
| 3357 |
\fi |
| 3358 |
}% |
| 3359 |
}{% |
| 3360 |
\scr@execute@option{#2#1}% |
| 3361 |
}% |
| 3362 |
}{% |
| 3363 |
\scr@execute@option{#2}% |
| 3364 |
\Ifstr{#1}{}{}{% |
| 3365 |
% \end{macrocode} |
| 3366 |
% \changes{v3.20}{2015/11/18}{member option test after execution of family |
| 3367 |
% option fixed} |
| 3368 |
% If a family option has been found and executed an existing member option |
| 3369 |
% still has to be executed. If no member option exists, also an existing |
| 3370 |
% \opt{@else@} option of the member has to been used. But in this case, the |
| 3371 |
% states different from \cs{FamilyKeyStateProcessed} are not errors. |
| 3372 |
% \begin{macrocode} |
| 3373 |
\scr@ifundefinedorrelax{KV@#2#1@\scr@key@name}{% |
| 3374 |
\scr@ifundefinedorrelax{KV@#2#1@@else@}{}{% |
| 3375 |
\scr@execute@elseoption{#2#1}% |
| 3376 |
}% |
| 3377 |
}{% |
| 3378 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 3379 |
\scr@execute@option{#2#1}% |
| 3380 |
\FamilyKeyStateProcessed |
| 3381 |
\else |
| 3382 |
\scr@execute@option{#2#1}% |
| 3383 |
\fi |
| 3384 |
}% |
| 3385 |
}% |
| 3386 |
}% |
| 3387 |
\scr@show@key@state@error |
| 3388 |
\fi |
| 3389 |
\fi |
| 3390 |
}% |
| 3391 |
\@nameuse{scr@after@options@#2@hook}% |
| 3392 |
} |
| 3393 |
%</base> |
| 3394 |
% \end{macrocode} |
| 3395 |
% \begin{macro}{\scr@show@key@state@error} |
| 3396 |
% \changes{v3.12}{2013/03/04}{added} |
| 3397 |
% \changes{v3.27}{2019/10/02}{improved error message} |
| 3398 |
% Show depending on \cs{FamilyKeyState} a error message. All information to |
| 3399 |
% the error has to be set to \cs{FamilyMemberOfKey} (member or \cs{@empty}), |
| 3400 |
% \cs{FamilyOfKey} (family or \cs{@empty}), \cs{scr@key@atlest} (option as it |
| 3401 |
% was in the option list), \cs{scr@key@name} (\meta{key} of the option), and |
| 3402 |
% \cs{scr@key@value} (\meta{value} of the option). Note: \cs{scr@key@atlist} |
| 3403 |
% and \cs{scr@key@value} can contain macros and will be output using |
| 3404 |
% \cs{detokenize}. |
| 3405 |
% \begin{macrocode} |
| 3406 |
%<*base> |
| 3407 |
\newcommand*{\scr@show@key@state@error}{% |
| 3408 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed\else |
| 3409 |
\PackageError{scrbase}{% |
| 3410 |
\ifx\FamilyKeyState\FamilyKeyStateNeedValue |
| 3411 |
missing option value at |
| 3412 |
\else |
| 3413 |
unknown option |
| 3414 |
\ifx\FamilyKeyState\FamilyKeyStateUnknownValue |
| 3415 |
value at |
| 3416 |
\fi |
| 3417 |
\fi |
| 3418 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3419 |
}{% |
| 3420 |
Option |
| 3421 |
`\expandafter\detokenize\expandafter{\scr@key@name}'\MessageBreak |
| 3422 |
\ifx\FamilyMemberOfKey\@empty\else |
| 3423 |
of member `\FamilyMemberOfKey'\MessageBreak |
| 3424 |
\fi |
| 3425 |
\ifx\FamilyOfKey\@empty\else |
| 3426 |
of family `\FamilyOfKey'\MessageBreak |
| 3427 |
\fi |
| 3428 |
\ifx\FamilyKeyState\FamilyKeyStateNeedValue |
| 3429 |
expects a value, but has been used without any value.% |
| 3430 |
\else |
| 3431 |
cannot handle value\MessageBreak |
| 3432 |
`\expandafter\detokenize\expandafter{\scr@key@value}',% |
| 3433 |
\MessageBreak |
| 3434 |
\ifx\FamilyKeyState\FamilyKeyStateUnknownValue |
| 3435 |
because this is an unsupported value.% |
| 3436 |
\else |
| 3437 |
because \FamilyKeyState. |
| 3438 |
\fi |
| 3439 |
\fi |
| 3440 |
}% |
| 3441 |
\fi |
| 3442 |
} |
| 3443 |
%</base> |
| 3444 |
% \end{macrocode} |
| 3445 |
% \end{macro}^^A \scr@show@key@state@error |
| 3446 |
% \end{macro}^^A \@FamilyExecuteOptions |
| 3447 |
% \end{command}^^A \FamilyExecuteOptions |
| 3448 |
% |
| 3449 |
% \begin{command}{\KOMAExecuteOptions} |
| 3450 |
% \changes{v2.97c}{2007/04/19}{added} |
| 3451 |
% \changes{v3.00}{2008/04/30}{no optional argument} |
| 3452 |
% \changes{v3.12}{2013/03/04}{can be used after the document preamble} |
| 3453 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 3454 |
% \changes{v3.99}{2022/11/16}{do not handle deprecated initial dot} |
| 3455 |
% Executes a \meta{list of options} (\texttt{\#3}) of a \meta{member} (optional |
| 3456 |
% \texttt{\#1}) of a \meta{family} (\texttt{\#2}). The default for the |
| 3457 |
% \meta{member} is \file{.\cs{@currname}.\cs{@currext}}. Note: If |
| 3458 |
% \cs{KOMAExcuteOptions} is not used while loading a class or package, the |
| 3459 |
% optional first argument is not optional, but has to be set correctly! And |
| 3460 |
% because filenames can be changed, it is recommended to \emph{always} use the |
| 3461 |
% optional argument to set a definite \meta{member}. |
| 3462 |
% \begin{macrocode} |
| 3463 |
%<*koma> |
| 3464 |
\newcommand*{\KOMAExecuteOptions}[1][\@currname.\@currext]{% |
| 3465 |
%<*!v4> |
| 3466 |
\Ifstrstart{#1}{.}{% |
| 3467 |
\PackageWarning{scrkbase}{Deprecated initial dot of member |
| 3468 |
argument\MessageBreak |
| 3469 |
of \string\KOMAExecuteOptions\space detected% |
| 3470 |
}% |
| 3471 |
\expandafter\FamilyExecuteOptions[#1]% |
| 3472 |
}{% |
| 3473 |
%</!v4> |
| 3474 |
\FamilyExecuteOptions[.#1]% |
| 3475 |
%<!v4> }% |
| 3476 |
{KOMA}% |
| 3477 |
} |
| 3478 |
%</koma> |
| 3479 |
% \end{macrocode} |
| 3480 |
% \end{command} |
| 3481 |
% |
| 3482 |
% \begin{command}{\FamilyOptions} |
| 3483 |
% \changes{v3.00}{2008/04/30}{added} |
| 3484 |
% \changes{v3.12}{2013/03/02}{re-implemented} |
| 3485 |
% \changes{v3.12}{2013/03/02}{\cs{scr@after@options@\#1@hook}} |
| 3486 |
% \changes{v3.14}{2014/10/17}{second argument is \cs{long}} |
| 3487 |
% \begin{macro}{\@FamilyOptions} |
| 3488 |
% \changes{v3.14}[2014/10/17]{added} |
| 3489 |
% \changes{v3.27}{2019/10/02}{improved error message} |
| 3490 |
% \begin{macro}{\Family@Options} |
| 3491 |
% \changes{v3.00}{2008/04/30}{added} |
| 3492 |
% \changes{v3.12}{2013/03/04}{removed} |
| 3493 |
% \end{macro}^^A \Family@Options |
| 3494 |
% Used to set the options of a family. The first argument (\texttt{\#1}) is |
| 3495 |
% the \meta{family} and the second (\texttt{\#2}) a \meta{list of options}. If |
| 3496 |
% a \meta{key} or a \meta{value} to a \meta{key} in the \meta{list of options} |
| 3497 |
% does not exist, an error is reported. The command itself is re-entrant, so |
| 3498 |
% it can be used inside the definition of an option. But in this case the hook |
| 3499 |
% is local to the local usage of the command. |
| 3500 |
% \begin{macrocode} |
| 3501 |
%<*base> |
| 3502 |
\newcommand{\FamilyOptions}[1]{\@FamilyOptions{#1}} |
| 3503 |
\newcommand{\@FamilyOptions}[2]{% |
| 3504 |
\scr@ifundefinedorrelax{scr@after@options@#1@hook}{% |
| 3505 |
\@namedef{scr@after@options@#1@hook}{% |
| 3506 |
\@namedef{scr@after@options@#1@hook}{}% |
| 3507 |
}% |
| 3508 |
}{% |
| 3509 |
\expandafter\edef\csname scr@after@options@#1@hook\endcsname{% |
| 3510 |
\noexpand\@namedef{scr@after@options@#1@hook}{% |
| 3511 |
\unexpanded\expandafter\expandafter\expandafter |
| 3512 |
{\csname scr@after@options@#1@hook\endcsname}% |
| 3513 |
}% |
| 3514 |
}% |
| 3515 |
}% |
| 3516 |
% \end{macrocode} |
| 3517 |
% \changes{v3.23}{2017/02/16}{\cs{AtEndOfFamilyOptions*} hook added} |
| 3518 |
% From version 3.23 the new hook before \cs{AtEndOfFamilyOptions*} has to be |
| 3519 |
% initialized. First step is a kind of pre-initialization: The hook is |
| 3520 |
% defined empty, if it does not already exist. So if the hook exists empty we |
| 3521 |
% can now recognize the top level of using \cs{FamilyOptions}. |
| 3522 |
% \begin{macrocode} |
| 3523 |
\scr@ifundefinedorrelax{scr@after@options@#1@hook@topmost}{% |
| 3524 |
\@namedef{scr@after@options@#1@hook@topmost}{}% |
| 3525 |
}{}% |
| 3526 |
% \end{macrocode} |
| 3527 |
% Now, if we recognize the top level, because of an empty hook, the execution |
| 3528 |
% of the hook to the normal level hook (which is the top level hook in this |
| 3529 |
% case) is added. Additionally the self destruction code is added to the very |
| 3530 |
% beginning of the hook. Because of the self destruction hook the hook itself |
| 3531 |
% it no longer empty. So deeper levels distinguish from the top level. Because |
| 3532 |
% the hook is not empty any longer. |
| 3533 |
% \begin{macrocode} |
| 3534 |
\expandafter\ifx\csname scr@after@options@#1@hook@topmost\endcsname\@empty |
| 3535 |
\expandafter\l@addto@macro\csname scr@after@options@#1@hook\endcsname{% |
| 3536 |
\@nameuse{scr@after@options@#1@hook@topmost}% |
| 3537 |
}% |
| 3538 |
\@namedef{scr@after@options@#1@hook@topmost}{% |
| 3539 |
\@namedef{scr@after@options@#1@hook@topmost}{}% |
| 3540 |
}% |
| 3541 |
\fi |
| 3542 |
% \end{macrocode} |
| 3543 |
% \begin{description} |
| 3544 |
% \item[Note:] We do not use \pkg{xkeyval} and its \cs{setkeys+}, because this |
| 3545 |
% would not execute the options in the order of the options but in the order |
| 3546 |
% of the families, which is not intuitive and therefore not what we want. |
| 3547 |
% \end{description} |
| 3548 |
% We use a loop over all \meta{option}s in the \meta{list of options} to |
| 3549 |
% split each \meta{option} into \meta{key} and \meta{value}. |
| 3550 |
% \begin{macrocode} |
| 3551 |
\@for\scr@key@atlist:=#2\do{% |
| 3552 |
% \end{macrocode} |
| 3553 |
% \changes{v3.08}{2010/11/05}{empty options in the list are ignored} |
| 3554 |
% Despite they do not make any sense empty \emph{options} are allowed and |
| 3555 |
% ignored. This would at first mean two consecutive commas. |
| 3556 |
% \begin{macrocode} |
| 3557 |
\ifx\scr@key@atlist\@empty\else |
| 3558 |
% \end{macrocode} |
| 3559 |
% But there also can be white spaces between the commas. |
| 3560 |
% \begin{macrocode} |
| 3561 |
\ifx\scr@key@atlist\space\else |
| 3562 |
\expandafter\scr@key@split@name@value\scr@key@atlist==\@nil |
| 3563 |
% \end{macrocode} |
| 3564 |
% The third possibility would be a single equal sign. But in my opinion this |
| 3565 |
% would be a mistake and therefore an error. So now, we have an \opt{option} |
| 3566 |
% splitted into a \meta{key} and a \meta{value} (which can be empty). |
| 3567 |
% \changes{v3.12}{2013/03/04}{storing the overall state} |
| 3568 |
% Now, we are storing the overall state by emptying the error storage. If the |
| 3569 |
% error storage is \cs{relax} it is not needed any longer. Both, \cs{relax} |
| 3570 |
% and \cs{@empty} means no error. All other cases the error storage contains |
| 3571 |
% all the errors to be reported. |
| 3572 |
% \begin{macrocode} |
| 3573 |
\let\scr@key@run@errors\@empty |
| 3574 |
% \end{macrocode} |
| 3575 |
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}} |
| 3576 |
% \changes{v3.09a}{2011/06/07}{less number of expansions by improved usage of |
| 3577 |
% \cs{unexpanded}} |
| 3578 |
% Next a loop over the members is used, to detect members, that have the |
| 3579 |
% \meta{key}. In this case the member option is executed. Note: The execution |
| 3580 |
% of an option must not change any of the internal macros with the \meta{key}, |
| 3581 |
% \meta{value}, \meta{option} or \meta{list of options} |
| 3582 |
% information. Additionally the states and the resulting messages have to been |
| 3583 |
% collected. Here it is useful to have \cs{\meta{family}@key@familylist}, a |
| 3584 |
% list of family + member and not only of members. |
| 3585 |
% \changes{v3.27}{2019/07/19}{family options are executed first} |
| 3586 |
% \begin{macrocode} |
| 3587 |
\scr@key@found@false |
| 3588 |
\edef\reserved@a{#1,\csname #1@key@familylist\endcsname}% |
| 3589 |
\@for\reserved@a:=\reserved@a\do{% |
| 3590 |
\scr@ifundefinedorrelax{KV@\reserved@a @\scr@key@name}{% |
| 3591 |
% \end{macrocode} |
| 3592 |
% \changes{v3.27}{2019/07/19}{treatment of \opt{@else@} options} |
| 3593 |
% If a family member does not have the current option, there still may be a |
| 3594 |
% \opt{@else@} option. In this case the \opt{@else@} option gets the current |
| 3595 |
% \meta{option} as value and is executed. But this changes the error storage |
| 3596 |
% only, if it was successful. In this case, the error storage has to become |
| 3597 |
% empty. But the \opt{@else@} must not be executed here, if the current member |
| 3598 |
% is the empty one, which represents the family itself. This will be done |
| 3599 |
% later and only, if no one of the members have had the option itself or a |
| 3600 |
% \opt{@else@} option. So the family \opt{@else@} option is only used, if the |
| 3601 |
% option has not been successfully processed by any member in any kind. |
| 3602 |
% \begin{macrocode} |
| 3603 |
\Ifstr{\reserved@a}{#1}{}{% |
| 3604 |
\scr@ifundefinedorrelax{KV@\reserved@a @@else@}{}{% |
| 3605 |
\expandafter\scr@execute@elseoption\expandafter{\reserved@a}% |
| 3606 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 3607 |
\scr@key@found@true |
| 3608 |
\let\scr@key@run@errors\relax |
| 3609 |
\fi |
| 3610 |
}% |
| 3611 |
}% |
| 3612 |
}{% |
| 3613 |
% \end{macrocode} |
| 3614 |
% If the option has been found for a member, it is executed and the error |
| 3615 |
% storage is updated. |
| 3616 |
% \begin{macrocode} |
| 3617 |
\expandafter\scr@execute@option\expandafter{\reserved@a}% |
| 3618 |
\scr@key@found@true |
| 3619 |
\ifx\scr@key@run@errors\relax\else |
| 3620 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 3621 |
\let\scr@key@run@errors\relax |
| 3622 |
\else |
| 3623 |
\ifx\FamilyKeyState\FamilyKeyStateUnknownValue |
| 3624 |
\edef\scr@key@run@errors{% |
| 3625 |
\unexpanded\expandafter{\scr@key@run@errors}% |
| 3626 |
\noexpand\MessageBreak |
| 3627 |
\space\space- `\FamilyMemberOfKey': unkown value |
| 3628 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3629 |
}% |
| 3630 |
\else |
| 3631 |
\ifx\FamilyKeyState\FamilyKeyStateNeedValue |
| 3632 |
\edef\scr@key@run@errors{% |
| 3633 |
\unexpanded\expandafter{\scr@key@run@errors}% |
| 3634 |
\noexpand\MessageBreak |
| 3635 |
\space\space- `\FamilyMemberOfKey': value expected |
| 3636 |
}% |
| 3637 |
\else |
| 3638 |
\edef\scr@key@run@errors{% |
| 3639 |
\unexpanded\expandafter{\scr@key@run@errors}% |
| 3640 |
\noexpand\MessageBreak |
| 3641 |
\space\space- `\FamilyMemberOfKey': \FamilyKeyState |
| 3642 |
}% |
| 3643 |
\fi |
| 3644 |
\fi |
| 3645 |
\fi |
| 3646 |
\fi |
| 3647 |
}% |
| 3648 |
}% |
| 3649 |
\ifscr@key@found@ |
| 3650 |
\ifx\scr@key@run@errors\relax\else |
| 3651 |
\ifx\scr@key@run@errors\@empty\else |
| 3652 |
% \end{macrocode} |
| 3653 |
% \changes{v3.28}{2019/11/23}{error messages and info fixed} |
| 3654 |
% Now, an existing \opt{@else@} option has to be used and either an error or |
| 3655 |
% info has to be shown. |
| 3656 |
% \begin{macrocode} |
| 3657 |
\scr@ifundefinedorrelax{KV@#1@@else@}{% |
| 3658 |
\PackageError{scrbase}{% |
| 3659 |
unknown option |
| 3660 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3661 |
}{% |
| 3662 |
The members of family `#1' cannot set option |
| 3663 |
`\scr@key@name' |
| 3664 |
\ifx\scr@key@value\@empty\else |
| 3665 |
\MessageBreak |
| 3666 |
to value |
| 3667 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3668 |
\fi.\MessageBreak |
| 3669 |
Here's what each member says: |
| 3670 |
\scr@key@run@errors |
| 3671 |
}% |
| 3672 |
}{% |
| 3673 |
\scr@execute@elseoption{#1}% |
| 3674 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 3675 |
\PackageInfo{scrbase}{% |
| 3676 |
option |
| 3677 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3678 |
\MessageBreak |
| 3679 |
processed by `@else@' option of family\MessageBreak |
| 3680 |
`#1', after the members said: |
| 3681 |
\scr@key@run@errors\MessageBreak |
| 3682 |
o\expandafter\@gobble |
| 3683 |
}% |
| 3684 |
\let\scr@key@run@errors\relax |
| 3685 |
\else |
| 3686 |
\PackageError{scrbase}{% |
| 3687 |
unknown option |
| 3688 |
\ifx\FamilyKeyState\FamilyKeyStateUnknownValue |
| 3689 |
value at |
| 3690 |
\fi |
| 3691 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3692 |
}{% |
| 3693 |
The members of family `#1' cannot set option |
| 3694 |
`\scr@key@name' |
| 3695 |
\ifx\scr@key@value\@empty\else |
| 3696 |
\MessageBreak |
| 3697 |
to value |
| 3698 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3699 |
\fi.\MessageBreak |
| 3700 |
Here's what each member says: |
| 3701 |
\scr@key@run@errors |
| 3702 |
}% |
| 3703 |
\fi |
| 3704 |
}% |
| 3705 |
\fi |
| 3706 |
\fi |
| 3707 |
\else |
| 3708 |
\scr@ifundefinedorrelax{KV@#1@@else@}{% |
| 3709 |
\PackageError{scrbase}{% |
| 3710 |
unknown option |
| 3711 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3712 |
}{% |
| 3713 |
No one of the members of family `#1'\MessageBreak |
| 3714 |
can handle option `\scr@key@name'.\MessageBreak |
| 3715 |
So it cannot be set% |
| 3716 |
\ifx\scr@key@value\@empty\else |
| 3717 |
\space to value |
| 3718 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3719 |
\fi.% |
| 3720 |
}% |
| 3721 |
}{% |
| 3722 |
\scr@execute@elseoption{#1}% |
| 3723 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 3724 |
\else |
| 3725 |
\PackageError{scrbase}{% |
| 3726 |
unknown option |
| 3727 |
\ifx\FamilyKeyState\FamilyKeyStateUnknownValue |
| 3728 |
value at |
| 3729 |
\fi |
| 3730 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'% |
| 3731 |
}{% |
| 3732 |
No one of the members of family `#1'\MessageBreak |
| 3733 |
can handle option `\scr@key@name'.\MessageBreak |
| 3734 |
So it cannot be set% |
| 3735 |
\ifx\scr@key@value\@empty\else |
| 3736 |
\space to value |
| 3737 |
`\expandafter\detokenize\expandafter{\scr@key@value}'% |
| 3738 |
\fi.% |
| 3739 |
}% |
| 3740 |
\fi |
| 3741 |
}% |
| 3742 |
\fi |
| 3743 |
\fi |
| 3744 |
\fi |
| 3745 |
}% |
| 3746 |
\@nameuse{scr@after@options@#1@hook}% |
| 3747 |
} |
| 3748 |
% \end{macrocode} |
| 3749 |
% \begin{macro}{\scr@execute@option} |
| 3750 |
% \changes{v3.12}{2013/03/04}{added} |
| 3751 |
% \changes{v3.13}{2014/06/30}{missing \cs{expandafter} in \cs{PackageInfo} added} |
| 3752 |
% \changes{v3.13a}{2014/08/13}{white spaces removed} |
| 3753 |
% \changes{v3.23}{2017/02/16}{it does not help to save the |
| 3754 |
% \cs{AtEndOfFamilyOptions} hook} |
| 3755 |
% A split \opt{option} is executed, without changing any relevant macros (but |
| 3756 |
% \cs{reserved@a}). The first argument is the complete set in \pkg{keyval} syntax. |
| 3757 |
% \begin{macrocode} |
| 3758 |
\newcommand*{\scr@execute@option}[1]{% |
| 3759 |
\protected@edef\reserved@a{% |
| 3760 |
\noexpand\let\noexpand\KV@err\noexpand\scr@KV@err |
| 3761 |
\noexpand\setkeys{#1}{% |
| 3762 |
\unexpanded\expandafter{\scr@key@atlist}}% |
| 3763 |
\noexpand\def\noexpand\scr@key@atlist{% |
| 3764 |
\unexpanded\expandafter{\scr@key@atlist}}% |
| 3765 |
\noexpand\def\noexpand\scr@key@name{% |
| 3766 |
\unexpanded\expandafter{\scr@key@name}}% |
| 3767 |
\noexpand\def\noexpand\scr@key@value{% |
| 3768 |
\unexpanded\expandafter{\scr@key@value}}% |
| 3769 |
\ifx\scr@key@run@errors\relax |
| 3770 |
\noexpand\let\noexpand\scr@key@run@errors\relax |
| 3771 |
\else |
| 3772 |
\noexpand\def\noexpand\scr@key@run@errors{% |
| 3773 |
\unexpanded\expandafter{\scr@key@run@errors}}% |
| 3774 |
\fi |
| 3775 |
\ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate |
| 3776 |
\noexpand\let\noexpand\AtEndOfFamilyOptions |
| 3777 |
\noexpand\scr@AtEndOfFamilyOptions@immediate |
| 3778 |
\fi |
| 3779 |
}% |
| 3780 |
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions |
| 3781 |
\reserved@a |
| 3782 |
\ifx\FamilyKeyState\FamilyKeyStateUnknown |
| 3783 |
\PackageInfo{scrbase}{Unknown processing state.\MessageBreak |
| 3784 |
Processing option |
| 3785 |
`\expandafter\detokenize\expandafter{\scr@key@atlist}'\MessageBreak |
| 3786 |
\ifx\FamilyMemberOfKey\@empty\else |
| 3787 |
of member `\FamilyMemberOfKey'\MessageBreak |
| 3788 |
\fi |
| 3789 |
of family `\FamilyOfKey'\MessageBreak |
| 3790 |
doesn't set a valid state.\MessageBreak |
| 3791 |
This will be interpreted\MessageBreak |
| 3792 |
as \string\FamilyKeyStateProcessed |
| 3793 |
}% |
| 3794 |
\FamilyKeyStateProcessed |
| 3795 |
\fi |
| 3796 |
} |
| 3797 |
% \end{macrocode} |
| 3798 |
% \begin{macro}{\scr@KV@err} |
| 3799 |
% \changes{v3.12a}{2013/03/04}{missing internal command added} |
| 3800 |
% We just have to signal, that the option needs a value, that is missing. |
| 3801 |
% \begin{macrocode} |
| 3802 |
\newcommand*{\scr@KV@err}[1]{% |
| 3803 |
\FamilyKeyStateNeedValue |
| 3804 |
} |
| 3805 |
% \end{macrocode} |
| 3806 |
% \end{macro}^^A \scr@KV@err |
| 3807 |
% \begin{macro}{\scr@key@run@errors} |
| 3808 |
% \changes{v3.12}{2013/03/04}{added} |
| 3809 |
% Needed by \cs{FamilyOptions} to collect the error messages, but report the |
| 3810 |
% error only, if no member has successfully processed the option. We define it |
| 3811 |
% here to make the re-definition in the previous code does work without error. |
| 3812 |
% \begin{macrocode} |
| 3813 |
\newcommand*{\scr@key@run@errors}{} |
| 3814 |
% \end{macrocode} |
| 3815 |
% \end{macro}^^A \scr@key@run@errors} |
| 3816 |
% \end{macro}^^A \scr@execute@option |
| 3817 |
% \begin{macro}{\scr@execute@elseoption} |
| 3818 |
% \changes{v3.20}{2015/11/18}{added} |
| 3819 |
% \changes{v3.25}{2017/11/16}{group added} |
| 3820 |
% \changes{v3.25}{2017/11/16}{\cs{scr@key@name@else} and |
| 3821 |
% \cs{scr@key@value@else} added} |
| 3822 |
% \changes{v3.27}{2019/03/10}{missing percent added to avoid spaces} |
| 3823 |
% If a special option \opt{@else@} has been defined, it is executed by |
| 3824 |
% \cs{FamilyExecuteOptions} if and only if no other suitable option has been |
| 3825 |
% found. This is done by \cs{scr@execute@elseoption}. The argument and |
| 3826 |
% resulting state are exactly the same as with \cs{scr@execute@option}. It |
| 3827 |
% also have to do the same, but it does not call the option, but the |
| 3828 |
% \opt{@else@} option. The option itself is used as \meta{value} of the |
| 3829 |
% \opt{@else@} option. So temporary \cs{scr@key@atlist}, \cs{scr@key@name} and |
| 3830 |
% \cs{scr@key@value} have to be changed, before calling |
| 3831 |
% \cs{scr@execute@option}. To avoid once again splitting the \meta{value} into |
| 3832 |
% an internal \meta{key} and \meta{value} the original \cs{scr@key@name} and |
| 3833 |
% \cs{scr@key@value} are copied to \cs{scr@key@name@else} and |
| 3834 |
% \cs{scr@key@value@else}. These can be used inside the code of the |
| 3835 |
% \opt{@else@} option. |
| 3836 |
% \begin{macrocode} |
| 3837 |
\newcommand*{\scr@execute@elseoption}[1]{% |
| 3838 |
\begingroup |
| 3839 |
\protected@edef\reserved@a{% |
| 3840 |
\unexpanded{% |
| 3841 |
\endgroup |
| 3842 |
\let\scr@key@name@else\scr@key@name |
| 3843 |
\let\scr@key@value@else\scr@key@value |
| 3844 |
\def\scr@key@name{@else@}% |
| 3845 |
}% |
| 3846 |
\noexpand\def\noexpand\scr@key@value{% |
| 3847 |
\unexpanded\expandafter{\scr@key@atlist}}% |
| 3848 |
\noexpand\def\noexpand\scr@key@atlist{% |
| 3849 |
@else@={\unexpanded\expandafter{\scr@key@atlist}}}% |
| 3850 |
\noexpand\scr@execute@option{#1}% |
| 3851 |
\noexpand\def\noexpand\scr@key@atlist{% |
| 3852 |
\unexpanded\expandafter{\scr@key@atlist}}% |
| 3853 |
\noexpand\def\noexpand\scr@key@name{% |
| 3854 |
\unexpanded\expandafter{\scr@key@name}}% |
| 3855 |
\noexpand\def\noexpand\scr@key@value{% |
| 3856 |
\unexpanded\expandafter{\scr@key@value}}% |
| 3857 |
\scr@ifundefinedorrelax{scr@key@name@else}{% |
| 3858 |
\unexpanded{\let\scr@key@name@else\relax}% |
| 3859 |
}{% |
| 3860 |
\noexpand\def\noexpand\scr@key@name@else{% |
| 3861 |
\unexpanded\expandafter{\scr@key@name@else}% |
| 3862 |
}% |
| 3863 |
}% |
| 3864 |
\scr@ifundefinedorrelax{scr@key@value@else}{% |
| 3865 |
\unexpanded{\let\scr@key@value@else\relax}% |
| 3866 |
}{% |
| 3867 |
\noexpand\def\noexpand\scr@key@value@else{% |
| 3868 |
\unexpanded\expandafter{\scr@key@value@else}% |
| 3869 |
}% |
| 3870 |
}% |
| 3871 |
}\reserved@a |
| 3872 |
} |
| 3873 |
% \end{macrocode} |
| 3874 |
% \end{macro}^^A \scr@execute@elseoption |
| 3875 |
% \begin{macro}{\KOMA@key@foundtrue,\KOMA@key@foundfalse,\ifKOMA@key@found, |
| 3876 |
% \scr@key@found@true,\scr@key@found@false,\ifscr@key@found@} |
| 3877 |
% \changes{v2.97c}{2007/04/19}{added} |
| 3878 |
% \changes{v3.00}{2008/04/30}{\cs{ifKOMA@key@found} renamed to \cs{ifscr@key@found}} |
| 3879 |
% \begin{macro}{\KOMA@key@at@list,\scr@key@atlist} |
| 3880 |
% \changes{v2.97c}{2007/04/19}{added} |
| 3881 |
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@atlist} renamed to \cs{scr@key@atlist}} |
| 3882 |
% \begin{macro}{\KOMA@key@name,\scr@key@name} |
| 3883 |
% \changes{v2.97c}{2007/04/19}{added} |
| 3884 |
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@name} renamed to \cs{scr@key@name}} |
| 3885 |
% \begin{macro}{\KOMA@key@value,\scr@key@value} |
| 3886 |
% \changes{v2.97c}{2007/04/19}{added} |
| 3887 |
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@value} renamed to \cs{scr@key@value}} |
| 3888 |
% \begin{macro}{\KOMA@key@split@name@value,\scr@key@split@name@value} |
| 3889 |
% \changes{v2.97c}{2007/04/19}{added} |
| 3890 |
% \changes{v2.97e}{2007/11/10}{using \cs{KV@@sp@def} to remove white spaces} |
| 3891 |
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@split@name@value} renamed to |
| 3892 |
% \cs{scr@key@split@name@value}} |
| 3893 |
% \changes{v3.13}{2014/10/17}{\cs{long}} |
| 3894 |
% \changes{v3.26}{2018/08/29}{using \cs{scr@sp@def} instead of \cs{KV@@sp@def}} |
| 3895 |
% \begin{macrocode} |
| 3896 |
\newif\ifscr@key@found@ |
| 3897 |
\newcommand*{\scr@key@atlist}{} |
| 3898 |
\newcommand*{\scr@key@name}{} |
| 3899 |
\newcommand*{\scr@key@value}{} |
| 3900 |
\newcommand*{\scr@key@split@name@value}{} |
| 3901 |
\long\def\scr@key@split@name@value#1=#2=#3\@nil{% |
| 3902 |
\scr@sp@def\scr@key@name{#1}% |
| 3903 |
\scr@sp@def\scr@key@value{#2}% |
| 3904 |
} |
| 3905 |
%</base> |
| 3906 |
% \end{macrocode} |
| 3907 |
% \end{macro}^^A \scr@key@split@name@value |
| 3908 |
% \end{macro}^^A \scr@key@value |
| 3909 |
% \end{macro}^^A \scr@key@name |
| 3910 |
% \end{macro}^^A \scr@key@atlist |
| 3911 |
% \end{macro}^^A \@FamilyOptions |
| 3912 |
% \end{macro}^^A \ifscr@key@found@ |
| 3913 |
% \end{command}^^A \FamilyOptions |
| 3914 |
% |
| 3915 |
% \begin{command}{\FamilyOption} |
| 3916 |
% \changes{v3.00}{2008/04/30}{added} |
| 3917 |
% \changes{v3.26b}{2019/01/09}{handling of typical user mistakes} |
| 3918 |
% \begin{macro}{\@FamilyOptions} |
| 3919 |
% \changes{v3.14}[2014/10/17]{added} |
| 3920 |
% \changes{v3.26}{2018/08/29}{using \cs{scr@sp@def} instead of \cs{KV@@sp@def}} |
| 3921 |
% \begin{macro}{\Family@Option} |
| 3922 |
% \changes{v3.00}{2008/04/30}{added} |
| 3923 |
% \changes{v3.12}{2013/03/04}{removed} |
| 3924 |
% \end{macro}^^A \Family@Option |
| 3925 |
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}} |
| 3926 |
% In opposite to \cs{FamilyOptions} this command sets only one \meta{option} |
| 3927 |
% (\texttt{\#2}) of a \meta{family} (\texttt{\#1}). But you can set it to a |
| 3928 |
% \meta{list of values} (\texttt{\#3}). The values are set in the order of the |
| 3929 |
% \meta{list of values}. |
| 3930 |
% \begin{macrocode} |
| 3931 |
%<*base> |
| 3932 |
\newcommand*{\FamilyOption}[2]{% |
| 3933 |
\begingroup |
| 3934 |
\def\reserved@a##1,##2\@nil{\IfArgIsEmpty{##2}{}{\@tempswatrue}}% |
| 3935 |
\@tempswafalse\expandafter\reserved@a#2,\@nil |
| 3936 |
\if@tempswa |
| 3937 |
\PackageError{scrbase}{% |
| 3938 |
syntax error in key `\detokenize{#2}'% |
| 3939 |
}{% |
| 3940 |
You've used `\string\...Option' to set the key |
| 3941 |
`\detokenize{#2}'\MessageBreak |
| 3942 |
to new value(s), but `,' is not allowed in the key of |
| 3943 |
an option\MessageBreak |
| 3944 |
(and `\string\...Option' does not use `,' to separate several |
| 3945 |
keys).\MessageBreak |
| 3946 |
Maybe you've meant \string\...Options\space instead of |
| 3947 |
\string\...Option.\MessageBreak |
| 3948 |
If you'll continue, I'll give it a try, but you should expect |
| 3949 |
further\MessageBreak |
| 3950 |
and even strange error messages.% |
| 3951 |
}% |
| 3952 |
\else |
| 3953 |
\def\reserved@a##1=##2\@nil{% |
| 3954 |
\IfArgIsEmpty{##2}{}{\@tempswatrue\def\reserved@a{=}}}% |
| 3955 |
\expandafter\reserved@a#2=\@nil |
| 3956 |
\if@tempswa |
| 3957 |
\PackageError{scrbase}{% |
| 3958 |
syntax error in key `\detokenize{#2}'% |
| 3959 |
}{% |
| 3960 |
You've used `\string\...Option' to set the key |
| 3961 |
`\detokenize{#2}'\MessageBreak |
| 3962 |
to new value(s), but `=' is not allowed in the key of |
| 3963 |
an option\MessageBreak |
| 3964 |
(and `\string\...Option' does not use `=' to separate key and |
| 3965 |
value).\MessageBreak |
| 3966 |
Maybe you've meant \string\...Options\space instead of |
| 3967 |
\string\...Option.\MessageBreak |
| 3968 |
If you'll continue, I'll give it a try, but you should expect |
| 3969 |
further\MessageBreak |
| 3970 |
and even strange error messages.% |
| 3971 |
}% |
| 3972 |
\fi |
| 3973 |
\fi |
| 3974 |
\endgroup |
| 3975 |
\@FamilyOption{#1}{#2}% |
| 3976 |
} |
| 3977 |
\newcommand{\@FamilyOption}[3]{% |
| 3978 |
\expandafter\scr@sp@def\expandafter\scr@key@name\expandafter{#2}% |
| 3979 |
% \end{macrocode} |
| 3980 |
% The most simply solution is to walk through the \meta{list of values} and |
| 3981 |
% generate a \meta{list of options} for \cs{FamilyOptions}. |
| 3982 |
% \begin{macrocode} |
| 3983 |
\let\reserved@a\@empty |
| 3984 |
\@for\reserved@b:=#3\do{% |
| 3985 |
% \end{macrocode} |
| 3986 |
% \changes{v3.08}{2010/11/05}{allow empty values} |
| 3987 |
% Empty elements in the \meta{list of values} are ignored. Note: This is not |
| 3988 |
% really the correct solution but several users expect it. So for a real empty |
| 3989 |
% value you need to use |{}|. |
| 3990 |
% \begin{macrocode} |
| 3991 |
\ifx\reserved@b\@empty\else |
| 3992 |
% \end{macrocode} |
| 3993 |
% \changes{v3.12}{2012/03/04}{ignore white space values} |
| 3994 |
% The same for white space values. |
| 3995 |
% \begin{macrocode} |
| 3996 |
\ifx\reserved@b\space\else |
| 3997 |
\edef\reserved@a{\unexpanded\expandafter{\reserved@a},% |
| 3998 |
\scr@key@name=\unexpanded\expandafter{\reserved@b}}% |
| 3999 |
\fi |
| 4000 |
\fi |
| 4001 |
}% |
| 4002 |
\def\reserved@b{\FamilyOptions{#1}}% |
| 4003 |
\expandafter\reserved@b\expandafter{\reserved@a}% |
| 4004 |
} |
| 4005 |
%</base> |
| 4006 |
% \end{macrocode} |
| 4007 |
% \end{macro} |
| 4008 |
% \end{command} |
| 4009 |
% |
| 4010 |
% \begin{command}{\KOMAoptions} |
| 4011 |
% \changes{v2.96}{2006/08/20}{hook after options added} |
| 4012 |
% \changes{v2.97c}{2007/04/19}{process options of all members} |
| 4013 |
% \changes{v3.12}{2013/03/04}{using hooks of \cs{FamilyOptions}} |
| 4014 |
% Nice little shortcut. |
| 4015 |
% \begin{macrocode} |
| 4016 |
%<*koma> |
| 4017 |
\newcommand*{\KOMAoptions}{\FamilyOptions{KOMA}} |
| 4018 |
%</koma> |
| 4019 |
% \end{macrocode} |
| 4020 |
% \begin{macro}{\KOMA@options} |
| 4021 |
% \changes{v2.97c}{2007/04/19}{added} |
| 4022 |
% \changes{v3.12}{2013/03/04}{removed} |
| 4023 |
% \end{macro}^^A \KOMA@options |
| 4024 |
% \end{command}^^A \KOMAoptions |
| 4025 |
% |
| 4026 |
% \begin{command}{\KOMAoptionsOf} |
| 4027 |
% \changes{v3.17}{2015/02/25}{added} |
| 4028 |
% \changes{v3.39}{2022/11/11}{initial dot removed from member argument of |
| 4029 |
% \cs{KOMA@kac@defall}} |
| 4030 |
% Ask for the currently set options of a supporting \KOMAScript{} class or |
| 4031 |
% package. The optional first argument (\texttt{\#1}) is a command or macro, |
| 4032 |
% that will be execute with the list of options as an argument. The second |
| 4033 |
% argument (\texttt{\#2}) is the filename of a \KOMAScript{} class or package |
| 4034 |
% (with extension). Without optional argument, the \meta{list of options} are |
| 4035 |
% be printed. |
| 4036 |
% \begin{macrocode} |
| 4037 |
%<*koma> |
| 4038 |
\newcommand*{\KOMAoptionsOf}[2][\@firstofone]{% |
| 4039 |
\scr@ifundefinedorrelax{scr@kav@KOMA.#2}{% |
| 4040 |
\PackageError{scrkbase}{\string\KOMAoptionsOf\space not supported}{% |
| 4041 |
#2 is not the name of a KOMA-Script package or\MessageBreak |
| 4042 |
KOMA-Script class, that supports \string\KOMAoptionsOf.}% |
| 4043 |
}{% |
| 4044 |
\begingroup |
| 4045 |
\def\reserved@a{#1}% |
| 4046 |
\KOMA@kav@defall\reserved@b{#2}% |
| 4047 |
\expandafter\expandafter\expandafter\endgroup |
| 4048 |
\expandafter\reserved@a\expandafter{\reserved@b}% |
| 4049 |
}% |
| 4050 |
} |
| 4051 |
%</koma> |
| 4052 |
% \end{macrocode} |
| 4053 |
% \end{command}^^A \KOMAoptionsOf |
| 4054 |
% |
| 4055 |
% \begin{command}{\KOMAoptionOf} |
| 4056 |
% \changes{v3.17}{2015/02/26}{added} |
| 4057 |
% Ask for the current values of one option of a supporting \KOMAScript{} class |
| 4058 |
% or package. Again the optional first argument (\texttt{\#1}) is a command or |
| 4059 |
% macro, that will be execute with the list of values as an argument. The second |
| 4060 |
% argument (\texttt{\#2}) is the filename of a \KOMAScript{} class or package |
| 4061 |
% (with extension). The third argument (\texttt{\#3}) is the name of an |
| 4062 |
% option of the class resp. package. Without optional argument, the \meta{list of |
| 4063 |
% values} are be printed. |
| 4064 |
% \begin{macrocode} |
| 4065 |
%<*koma> |
| 4066 |
\newcommand*{\KOMAoptionOf}[3][\@firstofone]{% |
| 4067 |
\scr@ifundefinedorrelax{scr@kav@KOMA.#2}{% |
| 4068 |
\PackageError{scrkbase}{\string\KOMAoptionOf\space not supported}{% |
| 4069 |
#2 is not the name of a KOMA-Script package or\MessageBreak |
| 4070 |
KOMA-Script class, that supports \string\KOMAoptionOf.}% |
| 4071 |
}{% |
| 4072 |
\begingroup |
| 4073 |
\def\reserved@a{#1}% |
| 4074 |
\KOMA@kav@defone\reserved@b{#2}{#3}% |
| 4075 |
\ifx\reserved@b\@empty |
| 4076 |
\PackageWarning{scrkbase}{option `#3' for `#2' unset}% |
| 4077 |
\endgroup |
| 4078 |
\else |
| 4079 |
\expandafter\expandafter\expandafter\endgroup |
| 4080 |
\expandafter\reserved@a\expandafter{\reserved@b}% |
| 4081 |
\fi |
| 4082 |
}% |
| 4083 |
} |
| 4084 |
%</koma> |
| 4085 |
% \end{macrocode} |
| 4086 |
% \end{command} |
| 4087 |
% |
| 4088 |
% \begin{macro}{\post@kopt@hook} |
| 4089 |
% \changes{v3.12}{2013/03/04}{removed} |
| 4090 |
% \end{macro}^^A \post@kopt@hook |
| 4091 |
% \begin{command}{\AfterKOMAoptions} |
| 4092 |
% \changes{v3.12}{2013/03/04}{using \cs{AtEndOfFamilyOptions}} |
| 4093 |
% \changes{v3.23}{2017/02/16}{\cs{newcommand} instead of \cs{let}} |
| 4094 |
% An option can process code after executing all options of the current |
| 4095 |
% \cs{KOMAoptions}. |
| 4096 |
% \begin{macrocode} |
| 4097 |
%<*koma> |
| 4098 |
\newcommand*{\AfterKOMAoptions}{\AtEndOfFamilyOptions} |
| 4099 |
%</koma> |
| 4100 |
% \end{macrocode} |
| 4101 |
% \end{command}^^A \AfterKOMAoptions |
| 4102 |
% |
| 4103 |
% \begin{macro}{\l@addto@macro} |
| 4104 |
% \changes{v2.8p}{2001/09/22}{added} |
| 4105 |
% \changes{v2.95}{2006/06/02}{changed to handle macros with arguments same |
| 4106 |
% like \cs{g@addto@macro}} |
| 4107 |
% \changes{v3.12}{2013/04/20}{removed non-\eTeX{} implementation} |
| 4108 |
% \changes{v3.12}{2013/04/20}{warn, if \cs{l@addto@macro} is already defined |
| 4109 |
% different from our definition} |
| 4110 |
% \changes{v3.23}{2017/02/16}{moved to \texttt{prepare}} |
| 4111 |
% We need a local variant of \cs{g@addto@macro}. |
| 4112 |
% \begin{macrocode} |
| 4113 |
%</body> |
| 4114 |
%<*base&prepare> |
| 4115 |
\@ifundefined{l@addto@macro}{}{% |
| 4116 |
\begingroup |
| 4117 |
\long\def\reserved@a#1#2{% |
| 4118 |
\edef#1{\unexpanded\expandafter{#1#2}}% |
| 4119 |
}% |
| 4120 |
\ifx\reserved@a\l@addto@macro\else |
| 4121 |
\PackageWarning{scrbase}{% |
| 4122 |
Someone also uses macro name \string\l@addto@macro.\MessageBreak |
| 4123 |
When KOMA-Script author decided to use macro name\MessageBreak |
| 4124 |
\string\l@addto@macro\space first, there was no other |
| 4125 |
free\MessageBreak |
| 4126 |
LaTeX package using this macro name.\MessageBreak |
| 4127 |
In the meantime other package authers decided to use\MessageBreak |
| 4128 |
same macro name, but unfortunatly not all of those\MessageBreak |
| 4129 |
are compatible with KOMA-Script's definition, e.g.,\MessageBreak |
| 4130 |
while adding definitions with arguments to macros.\MessageBreak |
| 4131 |
Because of such potentially incompatible definitions,\MessageBreak |
| 4132 |
KOMA-Script will redefine the command now.\MessageBreak |
| 4133 |
Please ask the author of the other package to\MessageBreak |
| 4134 |
rename his macro, if a problem results in the\MessageBreak |
| 4135 |
redefinition% |
| 4136 |
}% |
| 4137 |
\fi |
| 4138 |
\endgroup |
| 4139 |
} |
| 4140 |
\long\def\l@addto@macro#1#2{% |
| 4141 |
\edef#1{\unexpanded\expandafter{#1#2}}% |
| 4142 |
}% |
| 4143 |
%</base&prepare> |
| 4144 |
%<*body> |
| 4145 |
% \end{macrocode} |
| 4146 |
% \end{macro}^^A \l@addto@macro |
| 4147 |
% |
| 4148 |
% \begin{macro}{\l@addto@macro@a} |
| 4149 |
% \changes{v3.20}{2015/11/20}{added} |
| 4150 |
% I also need a version for macros with exactly one argument. Note: This macro |
| 4151 |
% is dangerous. Sometimes it does not work correctly, so there is not an will |
| 4152 |
% not be an official documentation. |
| 4153 |
% \begin{macrocode} |
| 4154 |
%<*base> |
| 4155 |
\begingroup |
| 4156 |
\catcode`\^^A=\catcode`\# |
| 4157 |
\@makeother\# |
| 4158 |
\gdef\l@addto@macro@a^^A1{% |
| 4159 |
\begingroup |
| 4160 |
\@makeother\# |
| 4161 |
\def\l@addto@macro@a@cmd{^^A1}% |
| 4162 |
\l@addto@macro@a@ |
| 4163 |
} |
| 4164 |
\gdef\l@addto@macro@a@^^A1{% |
| 4165 |
\def\l@addto@macro@a@add{^^A1}% |
| 4166 |
\l@addto@macro@a@@ |
| 4167 |
} |
| 4168 |
\endgroup |
| 4169 |
\begingroup |
| 4170 |
\@makeother\# |
| 4171 |
\gdef\l@addto@macro@a@@{% |
| 4172 |
\@makeother\# |
| 4173 |
\edef\reserved@a{% |
| 4174 |
\detokenize{\endgroup\def}% |
| 4175 |
\detokenize\expandafter{\l@addto@macro@a@cmd#1}% |
| 4176 |
{% |
| 4177 |
\expandafter\detokenize% |
| 4178 |
\expandafter\expandafter\expandafter{\l@addto@macro@a@cmd{#1}}% |
| 4179 |
\expandafter\detokenize\expandafter{\l@addto@macro@a@add}% |
| 4180 |
}% |
| 4181 |
}% |
| 4182 |
\expandafter\scantokens\expandafter{\reserved@a}% |
| 4183 |
}% |
| 4184 |
\endgroup |
| 4185 |
%</base> |
| 4186 |
% \end{macrocode} |
| 4187 |
% \end{macro}^^A \l@addto@macro@a |
| 4188 |
% |
| 4189 |
% \begin{macro}{\l@preto@macro} |
| 4190 |
% \changes{v3.20}{2015/11/25}{added} |
| 4191 |
% Similar to \cs{l@addto@macro} but adds code at the very beginning instead of |
| 4192 |
% appending it a the end. |
| 4193 |
% \begin{macrocode} |
| 4194 |
%<*base> |
| 4195 |
\newcommand\l@preto@macro[2]{% |
| 4196 |
\edef#1{\unexpanded{#2}\unexpanded\expandafter{#1}}% |
| 4197 |
}% |
| 4198 |
%</base> |
| 4199 |
% \end{macrocode} |
| 4200 |
% \end{macro}^^A \l@preto@macro |
| 4201 |
% |
| 4202 |
% \begin{macro}{\l@preto@macro@a} |
| 4203 |
% \changes{v3.20}{2015/11/25}{added} |
| 4204 |
% I also need a version for macros with exactly one argument. Note: This macro |
| 4205 |
% is dangerous. Sometimes it does not work correctly, so there is not an will |
| 4206 |
% not be an official documentation. |
| 4207 |
% \begin{macrocode} |
| 4208 |
%<*base> |
| 4209 |
\begingroup |
| 4210 |
\catcode`\^^A=\catcode`\# |
| 4211 |
\@makeother\# |
| 4212 |
\gdef\l@preto@macro@a^^A1{% |
| 4213 |
\begingroup |
| 4214 |
\@makeother\# |
| 4215 |
\def\l@preto@macro@a@cmd{^^A1}% |
| 4216 |
\l@preto@macro@a@ |
| 4217 |
} |
| 4218 |
\gdef\l@preto@macro@a@^^A1{% |
| 4219 |
\def\l@preto@macro@a@add{^^A1}% |
| 4220 |
\l@preto@macro@a@@ |
| 4221 |
} |
| 4222 |
\endgroup |
| 4223 |
\begingroup |
| 4224 |
\@makeother\# |
| 4225 |
\gdef\l@preto@macro@a@@{% |
| 4226 |
\@makeother\# |
| 4227 |
\edef\reserved@a{% |
| 4228 |
\detokenize{\endgroup\def}% |
| 4229 |
\detokenize\expandafter{\l@preto@macro@a@cmd#1}% |
| 4230 |
{% |
| 4231 |
\expandafter\detokenize\expandafter{\l@preto@macro@a@add}% |
| 4232 |
\expandafter\detokenize% |
| 4233 |
\expandafter\expandafter\expandafter{\l@preto@macro@a@cmd{#1}}% |
| 4234 |
}% |
| 4235 |
}% |
| 4236 |
\expandafter\scantokens\expandafter{\reserved@a}% |
| 4237 |
}% |
| 4238 |
\endgroup |
| 4239 |
%</base> |
| 4240 |
% \end{macrocode} |
| 4241 |
% \end{macro}^^A \l@preto@macro@a |
| 4242 |
% |
| 4243 |
% \begin{command}{\KOMAoption} |
| 4244 |
% \changes{v2.98c}{2008/03/12}{added} |
| 4245 |
% \changes{v3.12}{2013/03/04}{using \cs{FamilyOption}} |
| 4246 |
% Simple little shortcut. |
| 4247 |
% \begin{macrocode} |
| 4248 |
%<*koma> |
| 4249 |
\newcommand*{\KOMAoption}{\FamilyOption{KOMA}} |
| 4250 |
%</koma> |
| 4251 |
% \end{macrocode} |
| 4252 |
% \end{command} |
| 4253 |
% |
| 4254 |
% \begin{command}{\FamilyUnknownKeyValue} |
| 4255 |
% \changes{v3.10}{2011/09/12}{no error while processing global options} |
| 4256 |
% \changes{v3.11a}{2012/05/28}{prevent remove from list of unused global |
| 4257 |
% options globally} |
| 4258 |
% \changes{v3.14}{2014/10/17}{\cs{long}} |
| 4259 |
% \changes{v3.30}{2020/02/25}{spurious space in warning message removed} |
| 4260 |
% Used to report an error because of unknown values. Arguments are |
| 4261 |
% \marg{family}\marg{key}\marg{valid values}. |
| 4262 |
% \begin{macrocode} |
| 4263 |
%<*base> |
| 4264 |
\newcommand{\FamilyUnknownKeyValue}[4]{% |
| 4265 |
\FamilyKeyStateUnknownValue |
| 4266 |
\ifx\FamilyElseValues\@empty\else |
| 4267 |
\PackageWarning{scrbase}{non empty \string\FamilyElseValue |
| 4268 |
ignored.\MessageBreak |
| 4269 |
Setting this command to a non empty\MessageBreak |
| 4270 |
value for option `#2' of\MessageBreak |
| 4271 |
family `#1' is deprecated,\MessageBreak |
| 4272 |
but has been found% |
| 4273 |
}% |
| 4274 |
\fi |
| 4275 |
} |
| 4276 |
%</base> |
| 4277 |
% \end{macrocode} |
| 4278 |
% \begin{command}{\FamilyElseValues} |
| 4279 |
% \changes{v3.00}{2008/05/02}{added} |
| 4280 |
% \changes{v3.12}{2013/03/04}{deprecated and not used internally} |
| 4281 |
% \begin{macrocode} |
| 4282 |
%<*base> |
| 4283 |
\newcommand*{\FamilyElseValues}{} |
| 4284 |
%</base> |
| 4285 |
% \end{macrocode} |
| 4286 |
% \end{command}^^A \FamilyUnknownKeyValue |
| 4287 |
% \end{command}^^A \FamilyElseValue |
| 4288 |
% |
| 4289 |
% \begin{command}{\FamilyBoolKey} |
| 4290 |
% \changes{v3.00}{2008/04/30}{added} |
| 4291 |
% Defining a new boolean key: |
| 4292 |
% \begin{quote} |
| 4293 |
% \cs{FamilyBoolKey}\oarg{member}\marg{family}\marg{key}\marg{switch} |
| 4294 |
% \end{quote} |
| 4295 |
% The default \meta{member} is (once again) |
| 4296 |
% \file{.\cs{@currname}.\cs{@currext}} and it is recommended to always use it! |
| 4297 |
% \cs{if\meta{switch}} is automatically defined, if it was undefined. In this |
| 4298 |
% case the initial value is \opt{false}. The default for using the \meta{key} |
| 4299 |
% without argument would be \opt{true}. For other allowed values see |
| 4300 |
% \cs{FamilySetBool}. |
| 4301 |
% \begin{macrocode} |
| 4302 |
%<*base> |
| 4303 |
\newcommand*{\FamilyBoolKey}[4][.\@currname.\@currext]{% |
| 4304 |
\@ifundefined{if#4}{% |
| 4305 |
\expandafter\newif\csname if#4\endcsname |
| 4306 |
}{}% |
| 4307 |
\DefineFamilyKey[{#1}]{#2}{#3}[true]{\FamilySetBool{#2}{#3}{#4}{##1}}% |
| 4308 |
} |
| 4309 |
% \end{macrocode} |
| 4310 |
% \begin{command}{\FamilySetBool} |
| 4311 |
% \changes{v3.00}{2008/04/30}{added} |
| 4312 |
% \changes{v3.11a}{2012/05/25}{error message fixed} |
| 4313 |
% \changes{v3.27}{2019/07/08}{empty argument is \texttt{true}} |
| 4314 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 4315 |
% Setting a boolean key: |
| 4316 |
% \begin{quote} |
| 4317 |
% \cs{FamilySetBool}\marg{family}\marg{key}\marg{switch}\marg{value} |
| 4318 |
% \end{quote} |
| 4319 |
% The \meta{family} and the \meta{key} are used for reporting unknown values using |
| 4320 |
% \cs{FamilyUnknownKeyValue}. The \meta{switch} is used to use either |
| 4321 |
% \cs{\meta{switch}true} or \cs{\meta{switch}false}. It is ignored, if these |
| 4322 |
% are not defined, so have to take care, that \cs{if\meta{switch}} already has |
| 4323 |
% been defined, e.g., using \cs{FamilyBoolKey}. The \meta{value} can either be |
| 4324 |
% \opt{true}, \opt{on} or \opt{yes} for \cs{\meta{switch}true} or |
| 4325 |
% \opt{false}, \opt{off} or \opt{no} for \cs{\meta{switch}false}. |
| 4326 |
% \begin{macrocode} |
| 4327 |
\newcommand*{\FamilySetBool}[4]{% |
| 4328 |
\Ifstr{#4}{}{\@nameuse{#3true}\FamilyKeyStateProcessed}{% |
| 4329 |
\Ifstr{#4}{true}{\@nameuse{#3true}\FamilyKeyStateProcessed}{% |
| 4330 |
\Ifstr{#4}{on}{\@nameuse{#3true}\FamilyKeyStateProcessed}{% |
| 4331 |
\Ifstr{#4}{yes}{\@nameuse{#3true}\FamilyKeyStateProcessed}{% |
| 4332 |
\Ifstr{#4}{false}{\@nameuse{#3false}\FamilyKeyStateProcessed}{% |
| 4333 |
\Ifstr{#4}{off}{\@nameuse{#3false}\FamilyKeyStateProcessed}{% |
| 4334 |
\Ifstr{#4}{no}{\@nameuse{#3false}\FamilyKeyStateProcessed}{% |
| 4335 |
\FamilyUnknownKeyValue{#1}{#2}{#4}{% |
| 4336 |
`true', `on', `yes', `false', `off', `no'% |
| 4337 |
}% |
| 4338 |
}% |
| 4339 |
}% |
| 4340 |
}% |
| 4341 |
}% |
| 4342 |
}% |
| 4343 |
}% |
| 4344 |
}% |
| 4345 |
\let\FamilyElseValues\@empty |
| 4346 |
} |
| 4347 |
%</base> |
| 4348 |
% \end{macrocode} |
| 4349 |
% \end{command} |
| 4350 |
% \end{command} |
| 4351 |
% \begin{command}{\FamilyInverseBoolKey,\FamilySetInverseBool} |
| 4352 |
% \changes{3.27}{2019/07/08}{added} |
| 4353 |
% These are similar to \cs{FamilyBoolKey} and \cs{FamilySetBoolKey} but use |
| 4354 |
% inverse logic (true sets false and false sets true). |
| 4355 |
% \begin{macrocode} |
| 4356 |
%<*base> |
| 4357 |
\newcommand*{\FamilyInverseBoolKey}[4][.\@currname.\@currext]{% |
| 4358 |
\@ifundefined{if#4}{% |
| 4359 |
\expandafter\newif\csname if#4\endcsname |
| 4360 |
\@nameuse{#4true}% |
| 4361 |
}{}% |
| 4362 |
\DefineFamilyKey[{#1}]{#2}{#3}[true]{\FamilySetInverseBool{#2}{#3}{#4}{##1}}% |
| 4363 |
} |
| 4364 |
\newcommand*{\FamilySetInverseBool}[4]{% |
| 4365 |
\FamilySetBool{#1}{#2}{#3}{#4}% |
| 4366 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 4367 |
\expandafter\ifx\csname if#3\expandafter\endcsname\csname iftrue\endcsname |
| 4368 |
\@nameuse{#3false}% |
| 4369 |
\else |
| 4370 |
\@nameuse{#3true}% |
| 4371 |
\fi |
| 4372 |
\fi |
| 4373 |
} |
| 4374 |
%</base> |
| 4375 |
% \end{macrocode} |
| 4376 |
% \end{command}^^A \FamilyInverseBoolKey,\FamilySetInverseBool |
| 4377 |
% |
| 4378 |
% \begin{macro}{\KOMA@unknown@keyval} |
| 4379 |
% Version of \cs{FamilyUnknownKeyValue} with static family |KOMA|. |
| 4380 |
% \begin{macrocode} |
| 4381 |
%<*koma> |
| 4382 |
\newcommand*{\KOMA@unknown@keyval}{\FamilyUnknownKeyValue{KOMA}} |
| 4383 |
%</koma> |
| 4384 |
% \end{macrocode} |
| 4385 |
% \end{macro} |
| 4386 |
% |
| 4387 |
% \begin{macro}{\KOMA@ifkey} |
| 4388 |
% \changes{v3.02c}{2009/02/04}{defines the member if needed} |
| 4389 |
% \changes{v3.17}{2015/03/02}{replaces the value in the storage} |
| 4390 |
% \changes{v3.39}{2022/11/11}{initial dot added automatically} |
| 4391 |
% This is an extended version of \cs{FamilyBoolKey} with static family |
| 4392 |
% |KOMA|. So the syntax is: |
| 4393 |
% \begin{quote} |
| 4394 |
% \cs{KOMA@ifkey}\oarg{member}\marg{key}\marg{switch} |
| 4395 |
% \end{quote} |
| 4396 |
% The default \meta{member} is (once again) |
| 4397 |
% \file{.\cs{@currname}.\cs{@currext}} and it is recommended to always use it! |
| 4398 |
% \cs{if\meta{switch}} is automatically defined, if it was undefined. The |
| 4399 |
% default for using the \meta{key} without argument would be \opt{true}. Note: |
| 4400 |
% \meta{member} and \meta{key} are always fully expanded. Depending on a |
| 4401 |
% already existing \cs{if\meta{key}} either \opt{\meta{key}=true} or |
| 4402 |
% \opt{\meta{key}=false} is added to the value storage. If \cs{if\meta{key}} |
| 4403 |
% was not defined, the initialized value is \opt{false}. |
| 4404 |
% \begin{macrocode} |
| 4405 |
%<*koma> |
| 4406 |
\newcommand*{\KOMA@ifkey}[2][\@currname.\@currext]{% |
| 4407 |
\begingroup\edef\reserved@a{\noexpand\KOMA@@ifkey{#1}{#2}}% |
| 4408 |
\expandafter\endgroup\reserved@a |
| 4409 |
} |
| 4410 |
\newcommand*{\KOMA@@ifkey}[3]{% |
| 4411 |
\@ifundefined{if#3}{% |
| 4412 |
\expandafter\newif\csname if#3\endcsname |
| 4413 |
}{}% |
| 4414 |
\KOMA@key[{#1}]{#2}[true]{% |
| 4415 |
\KOMA@set@ifkey{#2}{#3}{##1}% |
| 4416 |
\KOMA@kav@replacebool{#1}{#2}{#3}% |
| 4417 |
}% |
| 4418 |
\csname if#3\endcsname |
| 4419 |
\KOMA@kav@xadd{#1}{#2}{true}% |
| 4420 |
\else |
| 4421 |
\KOMA@kav@xadd{#1}{#2}{false}% |
| 4422 |
\fi |
| 4423 |
} |
| 4424 |
%</koma> |
| 4425 |
% \end{macrocode} |
| 4426 |
% \begin{macro}{\KOMA@set@ifkey} |
| 4427 |
% Simple a shortcut for |\FamilySetBool{KOMA}|. So the syntax is: |
| 4428 |
% \begin{quote} |
| 4429 |
% \cs{KOMA@set@ifkey}\marg{key}\marg{switch}\marg{value} |
| 4430 |
% \end{quote} |
| 4431 |
% But all arguments are delegated. |
| 4432 |
% \begin{macrocode} |
| 4433 |
%<*koma> |
| 4434 |
\newcommand*{\KOMA@set@ifkey}{\FamilySetBool{KOMA}} |
| 4435 |
%</koma> |
| 4436 |
% \end{macrocode} |
| 4437 |
% \end{macro} |
| 4438 |
% \end{macro} |
| 4439 |
% |
| 4440 |
% \begin{command}{\FamilyCounterKey} |
| 4441 |
% \changes{v3.12}{2013/11/05}{added} |
| 4442 |
% \changes{v3.15}{2014/12/03}{optional default value} |
| 4443 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 4444 |
% \cs{kernel@ifnextchar}} |
| 4445 |
% Defining a \meta{key} that sets a \LaTeX{} counter to a \meta{value}. |
| 4446 |
% \begin{quote} |
| 4447 |
% \cs{FamilyCounterKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{\LaTeX{} counter} |
| 4448 |
% \end{quote} |
| 4449 |
% \meta{default} and the \meta{value} of the option has to be (almost) any |
| 4450 |
% kind of value, that can be assigned to a \LaTeX{} counter. The |
| 4451 |
% \meta{counter} is automatically defined, if it was undefined. In this case |
| 4452 |
% the initial value is 0. |
| 4453 |
% \begin{macro}{\Family@@Counter@@Key,\Family@Counter@Key} |
| 4454 |
% \changes{v3.15}{2014/12/03}{added} |
| 4455 |
% \begin{macrocode} |
| 4456 |
%<*base> |
| 4457 |
\newcommand*{\FamilyCounterKey}[3][.\@currname.\@currext]{% |
| 4458 |
\kernel@ifnextchar [%] |
| 4459 |
{\Family@@Counter@@Key{#1}{#2}{#3}}% |
| 4460 |
{\Family@Counter@Key{#1}{#2}{#3}}% |
| 4461 |
} |
| 4462 |
\newcommand*{\Family@@Counter@@Key}{} |
| 4463 |
\def\Family@@Counter@@Key#1#2#3[#4]#5{% |
| 4464 |
\@ifundefined{c@#5}{\newcounter{#5}}{}% |
| 4465 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetCounter{#2}{#3}{#5}{##1}}% |
| 4466 |
} |
| 4467 |
\newcommand*{\Family@Counter@Key}[4]{% |
| 4468 |
\@ifundefined{c@#4}{\newcounter{#4}}{}% |
| 4469 |
\DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetCounter{#2}{#3}{#4}{##1}}% |
| 4470 |
} |
| 4471 |
% \end{macrocode} |
| 4472 |
% \end{macro} |
| 4473 |
% \begin{command}{\FamilySetCounter} |
| 4474 |
% \changes{v3.12}{2013/11/05}{added} |
| 4475 |
% \changes{v3.18a}{2015/07/06}{using \cs{FamilyKeyStateProcessed}} |
| 4476 |
% \changes{v3.23}{2017/02/23}{white space replaced by \cs{relax}} |
| 4477 |
% Set the value of a \meta{key} defined by \cs{FamilyCounterKey}: |
| 4478 |
% \begin{quote} |
| 4479 |
% \cs{FamilySetCounter}\marg{family}\marg{key}\marg{counter}\marg{value} |
| 4480 |
% \end{quote} |
| 4481 |
% Note: Before assigning the \meta{value} to the \meta{counter} tests are |
| 4482 |
% done, if the \meta{value} can be used to be assigned to a \LaTeX{} |
| 4483 |
% counter. If this fails a unknown value is reported. |
| 4484 |
% \begin{macrocode} |
| 4485 |
\newcommand*{\FamilySetCounter}[4]{% |
| 4486 |
\begingroup |
| 4487 |
\protected@edef\reserved@a{#4}% |
| 4488 |
\def\reserved@b{\endgroup\value{#3}=#4\relax\FamilyKeyStateProcessed}% |
| 4489 |
\expandafter\Ifiscount\expandafter{\reserved@a}{}{% |
| 4490 |
\expandafter\Ifisdimen\expandafter{\reserved@a}{}{% |
| 4491 |
\expandafter\Ifisskip\expandafter{\reserved@a}{}{% |
| 4492 |
\expandafter\Ifisnumexpr\expandafter{\reserved@a}{}{% |
| 4493 |
\expandafter\Ifisdimexpr\expandafter{\reserved@a}{}{% |
| 4494 |
\expandafter\Ifisinteger\expandafter{\reserved@a}{}{% |
| 4495 |
\expandafter\Ifiscounter\expandafter{\reserved@a}{% |
| 4496 |
\def\reserved@b{% |
| 4497 |
\endgroup\value{#3}=\value{#4}\FamilyKeyStateProcessed |
| 4498 |
}% |
| 4499 |
}{% |
| 4500 |
\def\reserved@b{% |
| 4501 |
\endgroup |
| 4502 |
\FamilyUnknownKeyValue{#1}{#2}{#4}{% |
| 4503 |
integer numbers, counters, lengths, skips, dimens |
| 4504 |
}% |
| 4505 |
}% |
| 4506 |
}% |
| 4507 |
}% |
| 4508 |
}% |
| 4509 |
}% |
| 4510 |
}% |
| 4511 |
}% |
| 4512 |
}% |
| 4513 |
\reserved@b |
| 4514 |
} |
| 4515 |
%</base> |
| 4516 |
% \end{macrocode} |
| 4517 |
% \end{command} |
| 4518 |
% \end{command} |
| 4519 |
% |
| 4520 |
% \begin{command}{\FamilyCounterMacroKey} |
| 4521 |
% \changes{v3.12}{2013/11/05}{added} |
| 4522 |
% \changes{v3.15}{2014/12/03}{support for optional default} |
| 4523 |
% Similar to \cs{FamilyCounterKey}, but it does not use a \LaTeX{} counter to |
| 4524 |
% store the value but a macro (or command): |
| 4525 |
% \begin{quote} |
| 4526 |
% \cs{FamilyCounterMacroKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro} |
| 4527 |
% \end{quote} |
| 4528 |
% The \meta{value} will be assigned to a counter (\cnt{page}) locally and the |
| 4529 |
% \meta{macro} is defined using the value of the counter. The \meta{macro} |
| 4530 |
% is automatically set to \cs{z@} if it was not already defined. If it was |
| 4531 |
% defined, the user is responsible for that it has to be a number. |
| 4532 |
% \begin{macro}{\Family@@Counter@@Macro@@Key,\Family@Counter@Macro@Key} |
| 4533 |
% \changes{v3.15}{2014/12/03}{added} |
| 4534 |
% \changes{v3.37}{2022/06/28}{existence test fixed} |
| 4535 |
% \begin{macrocode} |
| 4536 |
%<*base> |
| 4537 |
\newcommand*{\FamilyCounterMacroKey}[3][.\@currname.\@currext]{% |
| 4538 |
\kernel@ifnextchar [%] |
| 4539 |
{\Family@@Counter@@Macro@@Key{#1}{#2}{#3}}% |
| 4540 |
{\Family@Counter@Macro@Key{#1}{#2}{#3}}% |
| 4541 |
} |
| 4542 |
\newcommand*{\Family@@Counter@@Macro@@Key}{} |
| 4543 |
\def\Family@@Counter@@Macro@@Key#1#2#3[#4]#5{% |
| 4544 |
\ifdefined#5\else\let#5\z@\fi |
| 4545 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetCounterMacro{#2}{#3}{#5}{##1}}% |
| 4546 |
} |
| 4547 |
\newcommand*{\Family@Counter@Macro@Key}[4]{% |
| 4548 |
\ifdefined#4\else\let#4\z@\fi |
| 4549 |
\DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetCounterMacro{#2}{#3}{#4}{##1}}% |
| 4550 |
} |
| 4551 |
% \end{macrocode} |
| 4552 |
% \end{macro}^^A \Family@@Counter@@Macro@@Key,\Family@Counter@Macro@Key |
| 4553 |
% \begin{command}{\FamilySetCounterMacro} |
| 4554 |
% \changes{v3.12}{2013/11/05}{added} |
| 4555 |
% \changes{v3.15}{2014/12/17}{\cs{aftergroup} before \cs{FamilyKeyStateProcessed}} |
| 4556 |
% \changes{v3.18a}{2015/07/06}{fixed usage of \cs{FamilyKeyStateProcessed}} |
| 4557 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 4558 |
% \cs{kernel@ifnextchar}} |
| 4559 |
% Similar to \cs{FamilySetCounter} but using a macro (or command) instead of a |
| 4560 |
% \LaTeX{} counter: |
| 4561 |
% \begin{quote} |
| 4562 |
% \cs{FamilySetCounterMacro}\marg{family}\marg{key}\marg{macro}\marg{value} |
| 4563 |
% \end{quote} |
| 4564 |
% Note, that the \meta{value} is locally assigned to a counter (\cnt{page}) |
| 4565 |
% before defining the \meta{macro} using the value of the counter. |
| 4566 |
% \begin{macrocode} |
| 4567 |
\newcommand*{\FamilySetCounterMacro}[4]{% |
| 4568 |
\begingroup |
| 4569 |
\FamilySetCounter{#1}{#2}{page}{#4}% |
| 4570 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 4571 |
\edef\reserved@a{% |
| 4572 |
\unexpanded{\endgroup\def#3}% |
| 4573 |
{\the\value{page}}% |
| 4574 |
\noexpand\FamilyKeyStateProcessed |
| 4575 |
}% |
| 4576 |
\else |
| 4577 |
\def\reserved@a{% |
| 4578 |
\endgroup |
| 4579 |
\FamilyUnknownKeyValue{#1}{#2}{#4}{% |
| 4580 |
integer numbers, counters, lengths, skips, dimens |
| 4581 |
}% |
| 4582 |
}% |
| 4583 |
\fi |
| 4584 |
\reserved@a |
| 4585 |
} |
| 4586 |
%</base> |
| 4587 |
% \end{macrocode} |
| 4588 |
% \end{command}^^A \FamilySetCounterMacro |
| 4589 |
% \end{command}^^A \FamilyCounterMacroKey |
| 4590 |
% |
| 4591 |
% \begin{command}{\FamilyLengthKey} |
| 4592 |
% \changes{v3.12}{2013/11/05}{added} |
| 4593 |
% \changes{v3.15}{2014/12/03}{optional default value} |
| 4594 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 4595 |
% \cs{kernel@ifnextchar}} |
| 4596 |
% Defining a \meta{key} that sets a \LaTeX{} length to a \meta{value}. |
| 4597 |
% \begin{quote} |
| 4598 |
% \cs{FamilyLengthKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{\LaTeX{} length} |
| 4599 |
% \end{quote} |
| 4600 |
% \meta{default} and the \meta{value} of the option has to be (almost) any |
| 4601 |
% kind of value, that can be assigned to a \LaTeX{} length, a \TeX{} dimension |
| 4602 |
% or a \TeX{} skip. The \meta{\LaTeX{} length} is automatically defined, if it |
| 4603 |
% was undefined. In this case the initial value is 0. |
| 4604 |
% \begin{macro}{\Family@@Length@@Key,\Family@Length@Key} |
| 4605 |
% \changes{v3.15}{2014/12/03}{added} |
| 4606 |
% \begin{macrocode} |
| 4607 |
%<*base> |
| 4608 |
\newcommand*{\FamilyLengthKey}[3][.\@currname.\@currext]{% |
| 4609 |
\kernel@ifnextchar [%] |
| 4610 |
{\Family@@Length@@Key{#1}{#2}{#3}}% |
| 4611 |
{\Family@Length@Key{#1}{#2}{#3}}% |
| 4612 |
} |
| 4613 |
\newcommand*{\Family@@Length@@Key}{} |
| 4614 |
\def\Family@@Length@@Key#1#2#3[#4]#5{% |
| 4615 |
\ifdefined#5\else\newlength{#5}\fi |
| 4616 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetLength{#2}{#3}{#5}{##1}}% |
| 4617 |
} |
| 4618 |
\newcommand*{\Family@Length@Key}[4]{% |
| 4619 |
\ifdefined#4\else\newlength{#4}\fi |
| 4620 |
\DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetLength{#2}{#3}{#4}{##1}}% |
| 4621 |
} |
| 4622 |
% \end{macrocode} |
| 4623 |
% \begin{command}{\FamilySetLength} |
| 4624 |
% \changes{v3.12}{2013/11/05}{added} |
| 4625 |
% \changes{v3.15}{2015/01/02}{\cs{ifglueexpr} added} |
| 4626 |
% \changes{v3.18a}{2015/07/06}{usage of \cs{FamilyKeyStateProcessed} fixed} |
| 4627 |
% \changes{v3.20}{2016/04/27}{expansion before testing} |
| 4628 |
% Set the value of a \meta{key} defined by \cs{FamilyLengthKey}: |
| 4629 |
% \begin{quote} |
| 4630 |
% \cs{FamilySetLength}\marg{family}\marg{key}\marg{\LaTeX{} length}\marg{value} |
| 4631 |
% \end{quote} |
| 4632 |
% Note: Before assigning the \meta{value} to the \meta{\LaTeX{} length} it is |
| 4633 |
% fully expanded and tests are done, if the \meta{value} can be used to be |
| 4634 |
% assigned to a \LaTeX{} length. If this fails a unknown value is reported. If |
| 4635 |
% the expansion or the assignment fails a \TeX{} error happens. |
| 4636 |
% \begin{macrocode} |
| 4637 |
\newcommand*{\FamilySetLength}[4]{% |
| 4638 |
\begingroup |
| 4639 |
\protected@edef\reserved@a{#4}% |
| 4640 |
% \end{macrocode} |
| 4641 |
% Together with \cs{@defaultsunits} (see below) following code, could be used: |
| 4642 |
% \begin{macrocode} |
| 4643 |
%<*neveruse> |
| 4644 |
\expandafter\Ifiscount\expandafter{\reserved@a}{% |
| 4645 |
\aftergroup\@firstoftwo |
| 4646 |
}{% |
| 4647 |
%</neveruse> |
| 4648 |
% \end{macrocode} |
| 4649 |
% But currently we don't use it! |
| 4650 |
% \begin{macrocode} |
| 4651 |
\expandafter\Ifisdimen\expandafter{\reserved@a}{% |
| 4652 |
\aftergroup\@firstoftwo |
| 4653 |
}{% |
| 4654 |
\expandafter\Ifisskip\expandafter{\reserved@a}{% |
| 4655 |
\aftergroup\@firstoftwo |
| 4656 |
}{% |
| 4657 |
% \end{macrocode} |
| 4658 |
% Together with \cs{@defaultsunits} (see below) following code, could be used: |
| 4659 |
% \begin{macrocode} |
| 4660 |
%<*neveruse> |
| 4661 |
\expandafter\Ifisnumexpr\expandafter{\reserved@a}{% |
| 4662 |
\aftergroup\@firstoftwo |
| 4663 |
}{% |
| 4664 |
%</neveruse> |
| 4665 |
% \end{macrocode} |
| 4666 |
% But currently we don't use it! |
| 4667 |
% \begin{macrocode} |
| 4668 |
\expandafter\Ifisdimexpr\expandafter{\reserved@a}{% |
| 4669 |
\aftergroup\@firstoftwo |
| 4670 |
}{% |
| 4671 |
\expandafter\Ifisglueexpr\expandafter{\reserved@a}{% |
| 4672 |
\aftergroup\@firstoftwo |
| 4673 |
}{% |
| 4674 |
\expandafter\Ifisglue\expandafter{\reserved@a}{% |
| 4675 |
\aftergroup\@firstoftwo |
| 4676 |
}{% |
| 4677 |
\aftergroup\@secondoftwo |
| 4678 |
}% |
| 4679 |
}% |
| 4680 |
}% |
| 4681 |
%<*neveruse> |
| 4682 |
}% |
| 4683 |
%</neveruse> |
| 4684 |
}% |
| 4685 |
}% |
| 4686 |
%<*neveruse> |
| 4687 |
}% |
| 4688 |
%</neveruse> |
| 4689 |
\endgroup |
| 4690 |
% \end{macrocode} |
| 4691 |
% \begin{description} |
| 4692 |
% \item[ToDo:] Maybe something like: |
| 4693 |
% \begin{macrocode} |
| 4694 |
%<*neveruse> |
| 4695 |
{\@defaultunits#3=#4pt\relax\@nnil\FamilyKeyStateProcessed} |
| 4696 |
%</neveruse> |
| 4697 |
% \end{macrocode} |
| 4698 |
% would be nice. But there are reasons I've decided not to use |
| 4699 |
% this. Unfortunately I cannot remember the reason (and because of this I've |
| 4700 |
% added the code as \texttt{neveruse}). So the simple assignment is used |
| 4701 |
% instead: |
| 4702 |
% \end{description} |
| 4703 |
% \begin{macrocode} |
| 4704 |
{#3=#4\FamilyKeyStateProcessed}% |
| 4705 |
{% |
| 4706 |
\FamilyUnknownKeyValue{#1}{#2}{#4}{% |
| 4707 |
length values, |
| 4708 |
%<*neveruse> |
| 4709 |
counters, |
| 4710 |
%</neveruse> |
| 4711 |
lengths, skips, dimens |
| 4712 |
}% |
| 4713 |
}% |
| 4714 |
} |
| 4715 |
%</base> |
| 4716 |
% \end{macrocode} |
| 4717 |
% \end{command}^^A \FamilySetLength |
| 4718 |
% \end{macro}^^A \Family@@Leng{\FamilyLengthKey}th@@Key,\Family@Length@Key |
| 4719 |
% \end{command}^^A FamilyLengthKey |
| 4720 |
% |
| 4721 |
% \begin{command}{\FamilyLengthMacroKey} |
| 4722 |
% \changes{v3.12}{2013/11/05}{added} |
| 4723 |
% \changes{v3.15}{2014/12/03}{support for optional default} |
| 4724 |
% \begin{command}{\FamilySetLengthMacro} |
| 4725 |
% \changes{v3.12}{2013/11/05}{added} |
| 4726 |
% \changes{v3.14a}{2014/11/24}{fix: \cs{@tempskipa} instead of \cs{@temskipa}} |
| 4727 |
% \changes{v3.15}{2014/12/17}{\cs{aftergroup} before |
| 4728 |
% \cs{FamilyKeyStateProcessed}} |
| 4729 |
% \changes{v3.15}{2015/01/02}{\cs{ifglueexpr} added} |
| 4730 |
% \changes{v3.18a}{2015/07/06}{usage of \cs{FamilyKeyStateProcessed} fixed} |
| 4731 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 4732 |
% \cs{kernel@ifnextchar}} |
| 4733 |
% \changes{v3.20}{2016/04/27}{using \cs{FamilySetLength}} |
| 4734 |
% Similar to \cs{FamilyLengthKey}, but it does not use a \LaTeX{} counter to |
| 4735 |
% store the value but a macro (or command): |
| 4736 |
% \begin{quote} |
| 4737 |
% \cs{FamilyLength MacroKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro} |
| 4738 |
% \end{quote} |
| 4739 |
% The \meta{value} will be assigned to a length (\len{@tempskipa}) locally and |
| 4740 |
% the \meta{macro} is defined using the value of the length. The \meta{macro} |
| 4741 |
% is automatically set to \cs{z@} if it was not already defined. If it was |
| 4742 |
% defined, the user is responsible for that it has to be a valid length. Usage |
| 4743 |
% of \cs{dimexpr} is recommended for such a definition. |
| 4744 |
% \begin{macro}{\Family@@Length@@Macro@@Key,\Family@Length@Macro@Key} |
| 4745 |
% \changes{v3.15}{2014/12/03}{added} |
| 4746 |
% \begin{macrocode} |
| 4747 |
%<*base> |
| 4748 |
\newcommand*{\FamilyLengthMacroKey}[3][.\@currname.\@currext]{% |
| 4749 |
\kernel@ifnextchar [%] |
| 4750 |
{\Family@@Length@@Macro@@Key{#1}{#2}{#3}}% |
| 4751 |
{\Family@Length@Macro@Key{#1}{#2}{#3}}% |
| 4752 |
} |
| 4753 |
\newcommand*{\Family@@Length@@Macro@@Key}{} |
| 4754 |
\def\Family@@Length@@Macro@@Key#1#2#3[#4]#5{% |
| 4755 |
\ifdefined#5\else\let#5\z@\fi |
| 4756 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetLengthMacro{#2}{#3}{#5}{##1}}% |
| 4757 |
} |
| 4758 |
\newcommand*{\Family@Length@Macro@Key}[4]{% |
| 4759 |
\ifdefined#4\else\let#4\z@\fi |
| 4760 |
\DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetLengthMacro{#2}{#3}{#4}{##1}}% |
| 4761 |
} |
| 4762 |
\newcommand*{\FamilySetLengthMacro}[4]{% |
| 4763 |
\begingroup |
| 4764 |
\FamilySetLength{#1}{#2}{\@tempskipa}{#4}% |
| 4765 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 4766 |
\edef\reserved@a{% |
| 4767 |
\unexpanded{\endgroup\def#3}% |
| 4768 |
{\the\@tempskipa}% |
| 4769 |
\noexpand\FamilyKeyStateProcessed |
| 4770 |
}% |
| 4771 |
\else |
| 4772 |
\def\reserved@a{% |
| 4773 |
\endgroup |
| 4774 |
\FamilyUnknownKeyValue{#1}{#2}{#4}{% |
| 4775 |
length values, counters, lengths, skips, dimens |
| 4776 |
}% |
| 4777 |
}% |
| 4778 |
\fi |
| 4779 |
\reserved@a |
| 4780 |
} |
| 4781 |
%</base> |
| 4782 |
% \end{macrocode} |
| 4783 |
% \end{macro}^^A \Family@@Length@@Macro@@Key,\Family@Length@Macro@Key |
| 4784 |
% \end{command}^^A \FamilySetLengthMacro |
| 4785 |
% \end{command}^^A \FamilyLengthMacroKey |
| 4786 |
% |
| 4787 |
% |
| 4788 |
% \begin{command}{\FamilyUseLengthMacroKey,\FamilySetUseLengthMacro} |
| 4789 |
% \changes{v3.20}{2016/04/27}{added} |
| 4790 |
% These are almost the same like \cs{FamilyLengthMacroKey} and |
| 4791 |
% \cs{FamilySetLengthMacro}. But there is one important difference: Instead of |
| 4792 |
% setting the \meta{macro} to the value of the temporary length, that has been |
| 4793 |
% used for a test assignment, the \meta{macro} is defined as \meta{value}. So |
| 4794 |
% later changes valid for the expansion and value of \meta{value} will indeed |
| 4795 |
% change the value of \meta{macro}, when it is used. |
| 4796 |
% \begin{macro}{\Family@@UseLength@@Macro@@Key,\Family@USeLength@Macro@Key} |
| 4797 |
% \changes{v3.20}{2016/04/27}{added} |
| 4798 |
% \begin{macrocode} |
| 4799 |
%<*base> |
| 4800 |
\newcommand*{\FamilyUseLengthMacroKey}[3][.\@currname.\@currext]{% |
| 4801 |
\kernel@ifnextchar [%] |
| 4802 |
{\Family@@UseLength@@Macro@@Key{#1}{#2}{#3}}% |
| 4803 |
{\Family@UseLength@Macro@Key{#1}{#2}{#3}}% |
| 4804 |
} |
| 4805 |
\newcommand*{\Family@@UseLength@@Macro@@Key}{} |
| 4806 |
\def\Family@@UseLength@@Macro@@Key#1#2#3[#4]#5{% |
| 4807 |
\ifdefined#5\else\let#5\z@\fi |
| 4808 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{% |
| 4809 |
\FamilySetUseLengthMacro{#2}{#3}{#5}{##1}% |
| 4810 |
}% |
| 4811 |
} |
| 4812 |
\newcommand*{\Family@UseLength@Macro@Key}[4]{% |
| 4813 |
\ifdefined#4\else\let#4\z@\fi |
| 4814 |
\DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetUseLengthMacro{#2}{#3}{#4}{##1}}% |
| 4815 |
} |
| 4816 |
\newcommand*{\FamilySetUseLengthMacro}[4]{% |
| 4817 |
\begingroup |
| 4818 |
\FamilySetLength{#1}{#2}{\@tempskipa}{#4}% |
| 4819 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 4820 |
\def\reserved@a{% |
| 4821 |
\endgroup\def#3{#4}% |
| 4822 |
\FamilyKeyStateProcessed |
| 4823 |
}% |
| 4824 |
\else |
| 4825 |
\def\reserved@a{% |
| 4826 |
\endgroup |
| 4827 |
\FamilyUnknownKeyValue{#1}{#2}{#4}{% |
| 4828 |
length values, counters, lengths, skips, dimens |
| 4829 |
}% |
| 4830 |
}% |
| 4831 |
\fi |
| 4832 |
\reserved@a |
| 4833 |
} |
| 4834 |
%</base> |
| 4835 |
% \end{macrocode} |
| 4836 |
% \end{macro}^^A \Family@@UseLength@@Macro@@Key,\Family@USeLength@Macro@Key |
| 4837 |
% \end{command}^^A \FamilyUseLengthMacroKey,\FamilySetUseLengthMacro |
| 4838 |
% |
| 4839 |
% |
| 4840 |
% \begin{command}{\FamilyNumericalKey} |
| 4841 |
% \changes{v3.00}{2008/04/30}{added} |
| 4842 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 4843 |
% \cs{kernel@ifnextchar}} |
| 4844 |
% This is a mapping of symbolic values to numerical values: |
| 4845 |
% \begin{quote} |
| 4846 |
% \cs{FamilyNumericalKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro}\marg{mapping list} |
| 4847 |
% \end{quote} |
| 4848 |
% The \meta{mapping list} is: |
| 4849 |
% \begin{quote} |
| 4850 |
% \texttt{\marg{symbol$_1$}\marg{value$_1$},\marg{symbol$_2$}\marg{value$_2$}\dots} |
| 4851 |
% \end{quote} |
| 4852 |
% There is no need for \meta{value$_n$} and \meta{value$_m$} to be mutual |
| 4853 |
% exclusive. So several symbols can be mapped to the same value. |
| 4854 |
% \begin{macro}{\Family@Numerical@Key} |
| 4855 |
% \changes{v3.00}{2008/05/28}{added} |
| 4856 |
% \changes{v3.08b}{2011/03/31}{fixed: missing argument to \cs{ifundefined}} |
| 4857 |
% The internal macro is used to handle the optional \meta{default} (because |
| 4858 |
% currently we are not using \pkg{xparse}). |
| 4859 |
% \begin{macrocode} |
| 4860 |
%<*base> |
| 4861 |
\newcommand*{\FamilyNumericalKey}[3][.\@currname.\@currext]{% |
| 4862 |
\kernel@ifnextchar [%] |
| 4863 |
{\Family@Numerical@Key{#1}{#2}{#3}}{\Family@Numerical@Key{#1}{#2}{#3}[]}% |
| 4864 |
} |
| 4865 |
\newcommand*{\Family@Numerical@Key}{} |
| 4866 |
\def\Family@Numerical@Key#1#2#3[#4]#5#6{% |
| 4867 |
\@ifundefined{#5}{\@namedef{#5}{0}}{}% |
| 4868 |
\ifx\relax#4\relax |
| 4869 |
\DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetNumerical{#2}{#3}{#5}{#6}{##1}}% |
| 4870 |
\else |
| 4871 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{% |
| 4872 |
\FamilySetNumerical{#2}{#3}{#5}{#6}{##1}}% |
| 4873 |
\fi |
| 4874 |
} |
| 4875 |
% \end{macrocode} |
| 4876 |
% \end{macro} |
| 4877 |
% \begin{command}{\FamilySetNumerical} |
| 4878 |
% \changes{v3.11a}{2012/05/28}{call of \cs{FamilyUnknownKeyValue} outside of |
| 4879 |
% local group} |
| 4880 |
% \changes{v3.25}{2017/12/04}{handling of completely empty list elements} |
| 4881 |
% Set the value of \meta{key} defined by \cs{FamilyNumericalKey}: |
| 4882 |
% \begin{quote} |
| 4883 |
% \cs{FamilySetNumerical}\marg{family}\marg{key}\marg{macro}\marg{mapping list}\marg{value} |
| 4884 |
% \end{quote} |
| 4885 |
% \begin{macrocode} |
| 4886 |
\newcommand*{\FamilySetNumerical}[5]{% |
| 4887 |
\begingroup |
| 4888 |
\edef\@searched{#5}% |
| 4889 |
\let\reserved@a=\@empty |
| 4890 |
\let\reserved@b=\@empty |
| 4891 |
\@tempswafalse |
| 4892 |
\@for\@valuelist:=#4\do{% |
| 4893 |
\ifx\@valuelist\@empty\else |
| 4894 |
\if@tempswa\else |
| 4895 |
\edef\reserved@c{\expandafter\@firstoftwo\@valuelist}% |
| 4896 |
\edef\reserved@a{\reserved@a\reserved@b`\reserved@c'}% |
| 4897 |
\edef\reserved@b{, }% |
| 4898 |
\ifx\reserved@c\@searched |
| 4899 |
\@tempswatrue |
| 4900 |
\edef\reserved@a{\expandafter\@secondoftwo\@valuelist}% |
| 4901 |
\fi |
| 4902 |
\fi |
| 4903 |
\fi |
| 4904 |
}% |
| 4905 |
\if@tempswa |
| 4906 |
\edef\reserved@a{\endgroup |
| 4907 |
\noexpand\@namedef{#3}{\reserved@a}% |
| 4908 |
\noexpand\FamilyKeyStateProcessed |
| 4909 |
}% |
| 4910 |
\else |
| 4911 |
\edef\reserved@a{\endgroup |
| 4912 |
\noexpand\FamilyUnknownKeyValue{#1}{#2}{#5}{\reserved@a}% |
| 4913 |
}% |
| 4914 |
\fi |
| 4915 |
\reserved@a |
| 4916 |
\let\FamilyElseValues\@empty |
| 4917 |
} |
| 4918 |
%</base> |
| 4919 |
% \end{macrocode} |
| 4920 |
% \end{command}^^A \FamilySetNumerical |
| 4921 |
% \end{command}^^A \FamilyNumericalKey |
| 4922 |
% |
| 4923 |
% \begin{macro}{\KOMA@ncmdkey} |
| 4924 |
% \changes{v3.02c}{2009/02/04}{defining the member (if needed)} |
| 4925 |
% \changes{v3.17}{2015/03/16}{re-implemented with value storage and optional default} |
| 4926 |
% \begin{macro}{\KOMA@@@ncmdkey,\KOMA@@ncmdkey} |
| 4927 |
% \changes{v3.17}{2015/03/16}{added} |
| 4928 |
% Like \cs{FamilyNumericalKey} with two important differences: |
| 4929 |
% \begin{itemize} |
| 4930 |
% \item The family is not an argument but always |KOMA|. |
| 4931 |
% \item The values will in the internal value storage is replaced (on success). |
| 4932 |
% \end{itemize} |
| 4933 |
% Important: Don't forget to add the default to the internal value storage, |
| 4934 |
% e.g., using \cs{KOMA@kav@add}. |
| 4935 |
% \begin{macrocode} |
| 4936 |
%<*koma> |
| 4937 |
\newcommand*{\KOMA@ncmdkey}[2][\@currname.\@currext]{% |
| 4938 |
\begingroup\edef\reserved@a{\noexpand\KOMA@@ncmdkey{#1}{#2}}% |
| 4939 |
\expandafter\endgroup\reserved@a |
| 4940 |
} |
| 4941 |
\newcommand*{\KOMA@@ncmdkey}[2]{% |
| 4942 |
\kernel@ifnextchar [%] |
| 4943 |
{\KOMA@@@ncmdkey{#1}{#2}}{\KOMA@@@ncmdkey{#1}{#2}[]} |
| 4944 |
} |
| 4945 |
\newcommand*{\KOMA@@@ncmdkey}{} |
| 4946 |
\def\KOMA@@@ncmdkey#1#2[#3]#4#5{% |
| 4947 |
\@ifundefined{#4}{\@namedef{#4}{0}}{}% |
| 4948 |
\ifx\relax#3\relax |
| 4949 |
\KOMA@key[{#1}]{#2}{% |
| 4950 |
\KOMA@set@ncmdkey{#2}{#4}{#5}{##1}% |
| 4951 |
\KOMA@kav@replacevalue{#1}{#2}{##1}% |
| 4952 |
}% |
| 4953 |
\else |
| 4954 |
\KOMA@key[{#1}]{#2}[{#3}]{% |
| 4955 |
\KOMA@set@ncmdkey{#2}{#4}{#5}{##1}% |
| 4956 |
\KOMA@kav@replacevalue{#1}{#2}{##1}% |
| 4957 |
}% |
| 4958 |
\fi |
| 4959 |
} |
| 4960 |
%</koma> |
| 4961 |
% \end{macrocode} |
| 4962 |
% \begin{macro}{\KOMA@set@ncmdkey} |
| 4963 |
% The corresponding set command similar to \cs{FamilySetNumerical} but again |
| 4964 |
% the family is not an argument but always |KOMA|. |
| 4965 |
% \begin{macrocode} |
| 4966 |
%<*koma> |
| 4967 |
\newcommand*{\KOMA@set@ncmdkey}{\FamilySetNumerical{KOMA}} |
| 4968 |
%</koma> |
| 4969 |
% \end{macrocode} |
| 4970 |
% \end{macro}^^A \KOMA@set@ncmdkey |
| 4971 |
% \end{macro}^^A \KOMA@@@ncmdkey,\KOMA@@ncmdkey |
| 4972 |
% \end{macro}^^A \KOMA@ncmdkey |
| 4973 |
% |
| 4974 |
% |
| 4975 |
% \begin{command}{\FamilyStringKey} |
| 4976 |
% \changes{v3.08}{2010/11/05}{added} |
| 4977 |
% \changes{v3.08b}{2011/03/31}{\cs{Family@String@Key} and |
| 4978 |
% \cs{Family@@String@@Key} switched} |
| 4979 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 4980 |
% \cs{kernel@ifnextchar}} |
| 4981 |
% Defining a \meta{key} that defines a \meta{macro} to be a \meta{value}. |
| 4982 |
% \begin{quote} |
| 4983 |
% \cs{FamilyStringKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro} |
| 4984 |
% \end{quote} |
| 4985 |
% \meta{default} and the \meta{value} of the option should be a string (but |
| 4986 |
% currently every value is accepted). The definition is done using |
| 4987 |
% \cs{def}. So it doesn't matter whether the \meta{macro} is already defined. |
| 4988 |
% \begin{macro}{\Family@String@Key,\Family@@String@@Key} |
| 4989 |
% \changes{v3.08}{2010/11/05}{added} |
| 4990 |
% \changes{v3.37}{2022/06/28}{state signaling fixed} |
| 4991 |
% \begin{macrocode} |
| 4992 |
%<*base> |
| 4993 |
\newcommand*{\FamilyStringKey}[3][.\@currname.\@currext]{% |
| 4994 |
\kernel@ifnextchar [%] |
| 4995 |
{\Family@@String@@Key{#1}{#2}{#3}}{\Family@String@Key{#1}{#2}{#3}}% |
| 4996 |
} |
| 4997 |
\newcommand*{\Family@@String@@Key}{} |
| 4998 |
\long\def\Family@@String@@Key#1#2#3[#4]#5{% |
| 4999 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\def#5{##1}\FamilyKeyStateProcessed}% |
| 5000 |
} |
| 5001 |
\newcommand{\Family@String@Key}[4]{% |
| 5002 |
\DefineFamilyKey[{#1}]{#2}{#3}{\def#4{##1}\FamilyKeyStateProcessed}% |
| 5003 |
} |
| 5004 |
%</base> |
| 5005 |
% \end{macrocode} |
| 5006 |
% \end{macro}^^A \Family@String@Key,\Family@@String@@Key |
| 5007 |
% \end{command}^^A \FamilyStringKey |
| 5008 |
% |
| 5009 |
% |
| 5010 |
% \begin{command}{\FamilyCSKey} |
| 5011 |
% \changes{v3.25}{2017/12/08}{added} |
| 5012 |
% This is similar to \cs{FamilyStringKey} but instead of a \meta{macro} a |
| 5013 |
% \meta{command sequence} is used: |
| 5014 |
% \begin{quote} |
| 5015 |
% \cs{FamilyCSKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{command sequence} |
| 5016 |
% \end{quote} |
| 5017 |
% Because of this, \cs{@namedef} instead of \cs{def} is used to define the |
| 5018 |
% corresponding \cs{\meta{command sequence}}. |
| 5019 |
% \begin{macro}{\Family@CS@Key} |
| 5020 |
% \changes{v3.25}{2017/12/08}{added} |
| 5021 |
% \begin{macro}{\Family@@CS@@Key} |
| 5022 |
% \changes{v3.25}{2017/12/08}{added} |
| 5023 |
% \changes{v3.26}{2018/11/06}{fix: don't overwrite \cs{Family@@String@@Key}} |
| 5024 |
% \changes{v3.37}{2022/06/28}{state signaling fixed} |
| 5025 |
% \begin{macrocode} |
| 5026 |
%<*base> |
| 5027 |
\newcommand*{\FamilyCSKey}[3][.\@currname.\@currext]{% |
| 5028 |
\kernel@ifnextchar [%] |
| 5029 |
{\Family@@CS@@Key{#1}{#2}{#3}}{\Family@CS@Key{#1}{#2}{#3}}% |
| 5030 |
} |
| 5031 |
\newcommand*{\Family@@CS@@Key}{} |
| 5032 |
\long\def\Family@@CS@@Key#1#2#3[#4]#5{% |
| 5033 |
\DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\@namedef{#5}{##1}\FamilyKeyStateProcessed}% |
| 5034 |
} |
| 5035 |
\newcommand{\Family@CS@Key}[4]{% |
| 5036 |
\DefineFamilyKey[{#1}]{#2}{#3}{\@namedef{#4}{##1}\FamilyKeyStateProcessed}% |
| 5037 |
} |
| 5038 |
%</base> |
| 5039 |
% \end{macrocode} |
| 5040 |
% \end{macro}^^A \Family@@CS@@Key |
| 5041 |
% \end{macro}^^A \Family@CS@Key |
| 5042 |
% \end{command}^^A \FamilyCSKey |
| 5043 |
% |
| 5044 |
% |
| 5045 |
% \begin{macro}{\KOMA@DeclareDeprecatedOption} |
| 5046 |
% \changes{v3.01a}{2008/11/20}{added} |
| 5047 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 5048 |
% \cs{kernel@ifnextchar}} |
| 5049 |
% \changes{v3.99}{2022/11/16}{not with \KOMAScript~4} |
| 5050 |
% Used to define a deprecated \meta{classic option} by an up-to-date |
| 5051 |
% \meta{\pkg*{keyval} option}. |
| 5052 |
% \begin{quote} |
| 5053 |
% \cs{KOMA@DeclareDeprecatedOption}\oarg{package name}\marg{classic |
| 5054 |
% option}\marg{\pkg*{keyval} option} |
| 5055 |
% \end{quote} |
| 5056 |
% If the \meta{package name} is omitted, \cs{KOMAClassName} is used to report |
| 5057 |
% a class warning instead of a package warning. |
| 5058 |
% \begin{macro}{\KOMA@@DeclareDeprecatedOption,\KOMA@@@DeclareDeprecatedOption} |
| 5059 |
% \changes{v3.01a}{2008/11/20}{added} |
| 5060 |
% \begin{macrocode} |
| 5061 |
%<*koma&!v4> |
| 5062 |
\newcommand*{\KOMA@DeclareDeprecatedOption}{% |
| 5063 |
\kernel@ifnextchar [%] |
| 5064 |
{\KOMA@@DeclareDeprecatedOption}% |
| 5065 |
{\KOMA@@@DeclareDeprecatedOption{\ClassWarningNoLine{\KOMAClassName}}}% |
| 5066 |
} |
| 5067 |
\newcommand*{\KOMA@@DeclareDeprecatedOption}[1][]{% |
| 5068 |
\KOMA@@@DeclareDeprecatedOption{\PackageWarningNoLine{#1}}% |
| 5069 |
} |
| 5070 |
\newcommand*{\KOMA@@@DeclareDeprecatedOption}[3]{% |
| 5071 |
\DeclareOption{#2}{\KOMA@UseDeprecatedOption{#1}{#2}{#3}}% |
| 5072 |
} |
| 5073 |
% \end{macrocode} |
| 5074 |
% \begin{macro}{\KOMA@UseDeprecatedOption} |
| 5075 |
% \changes{v3.01a}{2008/11/20}{added} |
| 5076 |
% \changes{v3.12}{2013/03/04}{test to use \opt{version\quotechar=first}} |
| 5077 |
% \changes{v3.12a}{2014/01/22}{test fixed} |
| 5078 |
% \changes{v3.22}{2016/07/29}{added several \cs{detokenize}} |
| 5079 |
% \changes{v3.37}{2022/06/21}{message text ``obsolete'' replaced by |
| 5080 |
% ``deprecated''} |
| 5081 |
% One more helper: |
| 5082 |
% \begin{quote} |
| 5083 |
% \cs{KOMA@UseDeprecatedOption}\marg{warning command}\marg{classic |
| 5084 |
% option}\marg{\pkg*{keyval} option} |
| 5085 |
% \end{quote} |
| 5086 |
% Note: \meta{warning command} should either be |
| 5087 |
% |\ClassWarningNoLine{\KOMAClassName}| or |
| 5088 |
% \cs{PackageWarningNoLine}\marg{package name}. But you could also use |
| 5089 |
% \cs{ClassInfoNoLine} or \cs{PackageInfoNoLine}. |
| 5090 |
% \begin{macrocode} |
| 5091 |
\newcommand*{\KOMA@UseDeprecatedOption}[3]{% |
| 5092 |
\begingroup |
| 5093 |
\scr@ifundefinedorrelax{KV@KOMA.\@currname.\@currext @version}{% |
| 5094 |
\edef\reserved@a{\noexpand\endgroup |
| 5095 |
\noexpand#1{% |
| 5096 |
You've used deprecated option `\detokenize{#2}'.\noexpand\MessageBreak |
| 5097 |
Usage of this option is deprecated.\noexpand\MessageBreak |
| 5098 |
You should simply replace `\detokenize{#2}'\noexpand\MessageBreak |
| 5099 |
by `\detokenize{#3}'% |
| 5100 |
}% |
| 5101 |
\noexpand\KOMAExecuteOptions{#3}% |
| 5102 |
\noexpand\def\noexpand\CurrentOption{\CurrentOption}% |
| 5103 |
}% |
| 5104 |
}{% |
| 5105 |
\edef\reserved@a{\noexpand\endgroup |
| 5106 |
\noexpand#1{% |
| 5107 |
You've used deprecated option `\detokenize{#2}'.\noexpand\MessageBreak |
| 5108 |
Usage of this option indicates an old document\noexpand\MessageBreak |
| 5109 |
and changes compatibility level using\noexpand\MessageBreak |
| 5110 |
`\detokenize{#3},version=first,\noexpand\MessageBreak |
| 5111 |
enabledeprecatedfontcommands' that may result\noexpand\MessageBreak |
| 5112 |
in further warnings.\noexpand\MessageBreak |
| 5113 |
If you don't want this, you should simply\noexpand\MessageBreak |
| 5114 |
replace option `\detokenize{#2}' by `\detokenize{#3}'% |
| 5115 |
}% |
| 5116 |
\noexpand\KOMAExecuteOptions{% |
| 5117 |
#3,version=first}% |
| 5118 |
\noexpand\ExecuteOptions{enabledeprecatedfontcommands}% |
| 5119 |
\noexpand\def\noexpand\CurrentOption{\CurrentOption}% |
| 5120 |
}% |
| 5121 |
}% |
| 5122 |
\reserved@a |
| 5123 |
} |
| 5124 |
%</koma&!v4> |
| 5125 |
% \end{macrocode} |
| 5126 |
% \end{macro}^^A \KOMA@UseDeprecatedOption |
| 5127 |
% \end{macro}^^A \KOMA@@DeclareDeprecatedOption,\KOMA@@@DeclareDeprecatedOption |
| 5128 |
% \end{macro}^^A \KOMA@DeclareDeprecatedOption |
| 5129 |
% |
| 5130 |
% |
| 5131 |
% \begin{macro}{\KOMA@DeclareStandardOption} |
| 5132 |
% \changes{v3.01a}{2008/11/21}{added} |
| 5133 |
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by |
| 5134 |
% \cs{kernel@ifnextchar}} |
| 5135 |
% This is similar to \cs{KOMA@DeclareDeprecatedOption} but is used for |
| 5136 |
% standard options, which means options known by the standard classes. |
| 5137 |
% \begin{quote} |
| 5138 |
% \cs{KOMA@DeclareStandardOption}\oarg{package name}\marg{classic |
| 5139 |
% option}\marg{\pkg*{keyval} option} |
| 5140 |
% \end{quote} |
| 5141 |
% For compatibility these options are not reported as deprecated, but an info |
| 5142 |
% is added to the \file{log} file about the usage and how it could be replaced |
| 5143 |
% by a \pkg*{keyval} option. |
| 5144 |
% \begin{macro}{\KOMA@@DeclareStandardOption,\KOMA@@@DeclareStandardOption, |
| 5145 |
% \KOMA@UseStandardOption} |
| 5146 |
% \changes{v3.01a}{2008/11/21}{added} |
| 5147 |
% \begin{macrocode} |
| 5148 |
%<*koma> |
| 5149 |
\newcommand*{\KOMA@DeclareStandardOption}{% |
| 5150 |
\kernel@ifnextchar [%] |
| 5151 |
{\KOMA@@DeclareStandardOption}% |
| 5152 |
{\KOMA@@@DeclareStandardOption{\ClassInfoNoLine{\KOMAClassName}}}% |
| 5153 |
} |
| 5154 |
\newcommand*{\KOMA@@DeclareStandardOption}[1][]{% |
| 5155 |
\KOMA@@@DeclareStandardOption{\PackageInfoNoLine{#1}}% |
| 5156 |
} |
| 5157 |
\newcommand*{\KOMA@@@DeclareStandardOption}[3]{% |
| 5158 |
\DeclareOption{#2}{\KOMA@UseStandardOption{#1}{#2}{#3}}% |
| 5159 |
} |
| 5160 |
\newcommand*{\KOMA@UseStandardOption}[3]{% |
| 5161 |
\begingroup |
| 5162 |
\edef\reserved@a{\noexpand\endgroup |
| 5163 |
\noexpand#1{% |
| 5164 |
You've used standard option `#2'.\noexpand\MessageBreak |
| 5165 |
This is correct!\noexpand\MessageBreak |
| 5166 |
Internally I'm using `#3'.\noexpand\MessageBreak |
| 5167 |
If you'd like to set the option with \string\KOMAoptions,% |
| 5168 |
\noexpand\MessageBreak |
| 5169 |
you'd have to use `#3' there\noexpand\MessageBreak |
| 5170 |
instead of `#2', too% |
| 5171 |
}% |
| 5172 |
\noexpand\KOMAExecuteOptions{#3}% |
| 5173 |
\noexpand\def\noexpand\CurrentOption{\CurrentOption}% |
| 5174 |
}% |
| 5175 |
\reserved@a |
| 5176 |
} |
| 5177 |
%</koma> |
| 5178 |
% \end{macrocode} |
| 5179 |
% \begin{macro}{\scr@sr@co} |
| 5180 |
% \changes{v2.96}{2006/08/20}{added} |
| 5181 |
% \changes{v3.12a}{2014/01/22}{removed} |
| 5182 |
% \end{macro}^^A \scr@sr@co |
| 5183 |
% \end{macro}^^A \KOMA@@@DeclareStandardOption … \KOMA@UseStandardOption |
| 5184 |
% \end{macro}^^A \KOMA@DeclareStandardOption |
| 5185 |
% |
| 5186 |
% |
| 5187 |
% \begin{macro}{\KOMA@DeclareObsoleteOption} |
| 5188 |
% \changes{v2.96}{2006/08/20}{\cs{CurrentOption} protected} |
| 5189 |
% \changes{v3.12}{2013/03/04}{removed} |
| 5190 |
% \begin{macro}{\KOMA@@DeclareObsoleteOption,\KOMA@@@DeclareObsoleteOption, |
| 5191 |
% \KOMA@iv@DeclareObsoleteOption,\KOMA@UseObsoleteOption} |
| 5192 |
% \changes{v2.98c}{2008/02/18}{added} |
| 5193 |
% \changes{v3.12}{2013/03/04}{removed} |
| 5194 |
% \end{macro}^^A \KOMA@@DeclareObsoleteOption … \KOMA@UseObsoleteOption |
| 5195 |
% \end{macro}^^A \KOMA@DeclareObsoleteOption |
| 5196 |
% |
| 5197 |
% |
| 5198 |
% \begin{macro}{\KOMA@newobsoletecommand,\KOMA@newdeprecatedcommand} |
| 5199 |
% \changes{v3.12}{2013/03/04}{\cs{KOMA@newobsoletecommand} renamed to |
| 5200 |
% \cs{KOMA@newdeprecatedcommand}} |
| 5201 |
% \changes{v3.99}{2022/11/16}{not with \KOMAScript~4} |
| 5202 |
% Defines a deprecated command or \meta{macro}, represented by a |
| 5203 |
% \meta{\pkg*{keyval} option}: |
| 5204 |
% \begin{quote} |
| 5205 |
% \cs{KOMA@newdeprecatedcommand}\oarg{warning |
| 5206 |
% command}\marg{macro}\marg{\pkg*{keyval} option} |
| 5207 |
% \end{quote} |
| 5208 |
% Note: This can be used only for macros and commands, that behave as a |
| 5209 |
% selector. Macros or commands with arguments are not supported. |
| 5210 |
% \begin{macro}{\KOMA@UseDeprecatedCommand,\KOMA@UseDeprecatedCommand} |
| 5211 |
% \changes{v2.97c}{2007/04/19}{added} |
| 5212 |
% \changes{v3.12}{2013/03/04}{\cs{KOMA@UseObsoleteCommand} renamed to |
| 5213 |
% \cs{KOMA@UseDeprecatedCommand}} |
| 5214 |
% \begin{macrocode} |
| 5215 |
%<*koma&!v4> |
| 5216 |
\newcommand*{\KOMA@newdeprecatedcommand}[3][\@gobbletwo]{% |
| 5217 |
\newcommand*{#2}{\KOMA@UseDeprecatedCommand{#1}{\string#2}{#3}}% |
| 5218 |
} |
| 5219 |
\newcommand*{\KOMA@UseDeprecatedCommand}[3]{% |
| 5220 |
#1{% |
| 5221 |
scrkbase% |
| 5222 |
}{% |
| 5223 |
You've used deprecated command `#2'.\MessageBreak |
| 5224 |
\protect\KOMAoptions{#3} will be used instead.\MessageBreak |
| 5225 |
You should also replace `#2' by `\protect\KOMAoptions{#3}'% |
| 5226 |
}% |
| 5227 |
\KOMAoptions{#3}% |
| 5228 |
} |
| 5229 |
%</koma&!v4> |
| 5230 |
% \end{macrocode} |
| 5231 |
% \end{macro}^^A \KOMA@UseDeprecatedCommand |
| 5232 |
% \end{macro}^^A \KOMA@newdeprecatedcommand |
| 5233 |
% |
| 5234 |
% |
| 5235 |
% \subsection{Do hook mechanism} |
| 5236 |
% \label{sec:dohook} |
| 5237 |
% |
| 5238 |
% \changes{v3.27}{2019/02/02}{Do hook mechanism added} |
| 5239 |
% From \KOMAScript~v3.27 there is a new general hook mechanism called ``do |
| 5240 |
% hook mechanism''. This mechanism is mentioned to provide extended hooks for |
| 5241 |
% package authors. All hooks newly implemented in \KOMAScript{} \emph{should} |
| 5242 |
% use this new mechanism. |
| 5243 |
% |
| 5244 |
% |
| 5245 |
% \begin{command}{\ForDoHook} |
| 5246 |
% \changes{v3.27}{2019/02/05}{added} |
| 5247 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 5248 |
% \changes{v3.30}{2020/03/07}{\cs{loop}\dots\cs{repeat} inside group} |
| 5249 |
% \changes{v3.30}{2020/03/07}{using \cs{rloop} instead of \cs{loop}} |
| 5250 |
% Arguments: |
| 5251 |
% \begin{description} |
| 5252 |
% \item[\meta{specificator}:] |
| 5253 |
% \meta{string} or \meta{string}\texttt{/}\meta{specificator} |
| 5254 |
% \item[\meta{code}:] \LaTeX{} code |
| 5255 |
% \end{description} |
| 5256 |
% Executes \meta{code} for earch level of a do-hook. This is a helper command |
| 5257 |
% normally not interesting for users or package authors. However, I define it |
| 5258 |
% in the user context to be consistent with the other do-hook commands. Note, |
| 5259 |
% there will be two arguments appended to the \meta{code}. The first one is |
| 5260 |
% the name of the hook, the second one the hook argument. |
| 5261 |
% See \cs{ExecuteDoHook} as an example. |
| 5262 |
% \begin{macrocode} |
| 5263 |
%<*base> |
| 5264 |
\newcommand*{\ForDoHook}[2]{% |
| 5265 |
\Ifstr{#1}{}{% |
| 5266 |
\PackageError{scrbase}{empty do-hook specificator}{% |
| 5267 |
You've tried to use an empty do-hook specificator,\MessageBreak |
| 5268 |
but do-hook specificators must not be empty.% |
| 5269 |
}% |
| 5270 |
}{% |
| 5271 |
\begingroup |
| 5272 |
\def\scr@hookrun{\endgroup}% |
| 5273 |
\let\scr@hookname\relax |
| 5274 |
\edef\scr@hookargument{#1}% |
| 5275 |
\rloop |
| 5276 |
\scr@hooksplit@specificator\scr@hookname\scr@hookargument |
| 5277 |
\scr@hookargument |
| 5278 |
\edef\scr@hookrun{% |
| 5279 |
\unexpanded\expandafter{\scr@hookrun}% |
| 5280 |
\unexpanded{#2}{\scr@hookname}{\scr@hookargument}% |
| 5281 |
}% |
| 5282 |
\ifx\scr@hookargument\@empty\else |
| 5283 |
\repeat |
| 5284 |
\scr@hookrun |
| 5285 |
}% |
| 5286 |
} |
| 5287 |
% \end{macrocode} |
| 5288 |
% \begin{command}{\SplitDoHook} |
| 5289 |
% \changes{v3.27}{2019/02/04}{added} |
| 5290 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 5291 |
% Arguments: |
| 5292 |
% \begin{description} |
| 5293 |
% \item[\meta{specificator}:] |
| 5294 |
% \meta{string} or \meta{string}\texttt{/}\meta{specificator} |
| 5295 |
% \item[\meta{prefix command}:] \LaTeX{} macro |
| 5296 |
% \item[\meta{postfix command}:] \LaTeX{} macro |
| 5297 |
% \end{description} |
| 5298 |
% Splits of the \emph{last} element of the \meta{specificator}. The |
| 5299 |
% \meta{postfix command} is defined to be that last element, the \meta{prefix |
| 5300 |
% command} is defined to be the rest. |
| 5301 |
% \begin{macrocode} |
| 5302 |
\newcommand*{\SplitDoHook}[3]{% |
| 5303 |
\Ifstr{#1}{}{% |
| 5304 |
\PackageWarning{scrbase}{empty do-hook specificator}% |
| 5305 |
\let#2\@empty\let#3\@empty |
| 5306 |
}{% |
| 5307 |
\let#2\relax |
| 5308 |
\edef\reserved@a{% |
| 5309 |
\unexpanded{\scr@hooksplit@specificator{#2}{#3}}{#1}% |
| 5310 |
}\reserved@a |
| 5311 |
}% |
| 5312 |
} |
| 5313 |
% \end{macrocode} |
| 5314 |
% \begin{macro}{\scr@hooksplit@specificator} |
| 5315 |
% \changes{v3.27}{2019/02/02}{added} |
| 5316 |
% Split of the first string of the specificator argument, append it to |
| 5317 |
% \cs{scr@hookname} and store the rest in \cs{scr@hookargument}. The argument |
| 5318 |
% must not be empty! |
| 5319 |
% \begin{macro}{\scr@@hooksplit@specificator} |
| 5320 |
% \changes{v3.27}{2019/02/02}{added} |
| 5321 |
% \begin{macrocode} |
| 5322 |
\newcommand*{\scr@hooksplit@specificator}[3]{% |
| 5323 |
\expandafter\scr@@hooksplit@specificator\expandafter#1\expandafter#2#3/\@nil |
| 5324 |
} |
| 5325 |
\newcommand*{\scr@@hooksplit@specificator}{} |
| 5326 |
\def\scr@@hooksplit@specificator#1#2#3/#4\@nil{% |
| 5327 |
\scr@ifundefinedorrelax{scr@hookname}{\def#1{#3}}{% |
| 5328 |
\edef#1{#1/#3}% |
| 5329 |
}% |
| 5330 |
\def#2{#4}% |
| 5331 |
\ifx#2\@empty\else \scr@@hookargument#2#4\@nil\fi |
| 5332 |
} |
| 5333 |
\newcommand*{\scr@@hookargument}{} |
| 5334 |
\def\scr@@hookargument#1#2/\@nil{\def#1{#2}}% |
| 5335 |
% \end{macrocode} |
| 5336 |
% \end{macro} |
| 5337 |
% \end{macro} |
| 5338 |
% \end{command} |
| 5339 |
% \end{command} |
| 5340 |
% |
| 5341 |
% \begin{command}{\ExecuteDoHook} |
| 5342 |
% \changes{v3.27}{2019/02/02}{added} |
| 5343 |
% Arguments: |
| 5344 |
% \begin{description} |
| 5345 |
% \item[\meta{specificator}:] |
| 5346 |
% \meta{string} or \meta{string}\texttt{/}\meta{specificator} |
| 5347 |
% \end{description} |
| 5348 |
% Each string of the \meta{specificator} defines a hook subgroup. The |
| 5349 |
% execution is done in a loop, first all hook elements of the first |
| 5350 |
% \meta{string} of the \meta{specificator} are executed with the rest of the |
| 5351 |
% \meta{specificator} as an argument. Then the hook elements of the |
| 5352 |
% composition of the first and the second \meta{string} are executed again |
| 5353 |
% with the rest of the \meta{specificator} as an agument and so on until the |
| 5354 |
% hook elements of the whole \meta{specificator} has been executed with an |
| 5355 |
% empty argument. So every hook element has to expect an argument that is |
| 5356 |
% itself a \meta{specificator}. At each loop level the one-time hooks |
| 5357 |
% are executed after the permanent hooks. |
| 5358 |
% \begin{macrocode} |
| 5359 |
\newcommand*{\ExecuteDoHook}[1]{% |
| 5360 |
\@ifundefined{scr@execute@dohook}{% |
| 5361 |
\def\scr@execute@dohook##1##2{% |
| 5362 |
\def\scr@hook@do####1{####1{##2}}% |
| 5363 |
\@nameuse{scr@dohook@##1}% |
| 5364 |
\@nameuse{scr@otdohook@##1}% |
| 5365 |
\expandafter\global\expandafter\let |
| 5366 |
\csname scr@otdohook@##1\endcsname\@empty |
| 5367 |
\let\scr@hook@do\relax |
| 5368 |
}% |
| 5369 |
\ForDoHook{#1}{\scr@execute@dohook}% |
| 5370 |
\let\scr@execute@dohook\relax |
| 5371 |
}{% |
| 5372 |
\PackageWarning{scrbase}{cascaded do-hook detected.\MessageBreak |
| 5373 |
It seems, that the do-hook `\detokenize{#1}'\MessageBreak |
| 5374 |
is be executed, while another do-hook is active.\MessageBreak |
| 5375 |
This is not allowed and therefore ignored% |
| 5376 |
}% |
| 5377 |
}% |
| 5378 |
} |
| 5379 |
% \end{macrocode} |
| 5380 |
% \end{command} |
| 5381 |
% |
| 5382 |
% \begin{command}{\AddtoDoHook} |
| 5383 |
% \changes{v3.27}{2019/02/02}{added} |
| 5384 |
% Arguments: |
| 5385 |
% \begin{description} |
| 5386 |
% \item[\meta{specificator}:] |
| 5387 |
% \meta{string} or \meta{string}\texttt{/}\meta{specificator} |
| 5388 |
% \item[\meta{element}:] |
| 5389 |
% a \LaTeX command, that expects exactly one argument. |
| 5390 |
% \end{description} |
| 5391 |
% For the \meta{specificator} see \cs{ExecuteDoHook}. Here you can add an |
| 5392 |
% \meta{element} to a hook defined by the \meta{specificator}. Adding a hook |
| 5393 |
% is local to the current group. |
| 5394 |
% \begin{macrocode} |
| 5395 |
\newcommand*{\AddtoDoHook}[2]{% |
| 5396 |
\Ifstr{#1}{}{% |
| 5397 |
\PackageError{scrbase}{empty hook specificator}{% |
| 5398 |
As hook specificators can never be empty, the first argument\MessageBreak |
| 5399 |
of \string\AddtoDoHook\space must expand to an not empty string.% |
| 5400 |
}% |
| 5401 |
}{% |
| 5402 |
\scr@ifundefinedorrelax{scr@dohook@#1}{\@namedef{scr@dohook@#1}{}}{}% |
| 5403 |
\expandafter\l@addto@macro\csname scr@dohook@#1\endcsname{% |
| 5404 |
\scr@hook@do{#2}% |
| 5405 |
}% |
| 5406 |
}% |
| 5407 |
} |
| 5408 |
% \end{macrocode} |
| 5409 |
% \end{command} |
| 5410 |
% |
| 5411 |
% \begin{command}{\AddtoOneTimeDoHook} |
| 5412 |
% \changes{v3.27}{2019/02/02}{added} |
| 5413 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 5414 |
% Arguments: |
| 5415 |
% \begin{description} |
| 5416 |
% \item[\meta{specificator}:] |
| 5417 |
% \meta{string} or \meta{string}\texttt{/}\meta{specificator} |
| 5418 |
% \item[\meta{element}:] |
| 5419 |
% a \LaTeX command, that expects exactly one argument. |
| 5420 |
% \end{description} |
| 5421 |
% This is almost the same as \cs{AddtoDoHook} but a hook added by this command |
| 5422 |
% is executed only once. |
| 5423 |
% \begin{macrocode} |
| 5424 |
\newcommand*{\AddtoOneTimeDoHook}[2]{% |
| 5425 |
\Ifstr{#1}{}{% |
| 5426 |
\PackageError{scrbase}{empty hook specificator}{% |
| 5427 |
As hook specificators can never be empty, the first argument\MessageBreak |
| 5428 |
of \string\AddtoDoHook\space must expand to an not empty string.% |
| 5429 |
}% |
| 5430 |
}{% |
| 5431 |
\scr@ifundefinedorrelax{scr@otdohook@#1}{\@namedef{scr@otdohook@#1}{}}{}% |
| 5432 |
\expandafter\l@addto@macro\csname scr@otdohook@#1\endcsname{% |
| 5433 |
\scr@hook@do{#2}% |
| 5434 |
}% |
| 5435 |
}% |
| 5436 |
} |
| 5437 |
%</base> |
| 5438 |
%</body> |
| 5439 |
% \end{macrocode} |
| 5440 |
% \end{command} |
| 5441 |
% |
| 5442 |
% |
| 5443 |
% \Finale |
| 5444 |
% \PrintChanges |
| 5445 |
% |
| 5446 |
\endinput |
| 5447 |
% Local Variables: |
| 5448 |
% mode: doctex |
| 5449 |
% ispell-local-dictionary: "en_US" |
| 5450 |
% eval: (flyspell-mode 1) |
| 5451 |
% TeX-master: t |
| 5452 |
% TeX-engine: luatex-dev |
| 5453 |
% 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")) |
| 5454 |
% End: |