| 1 |
% \iffalse meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% scrkernel-tocstyle.dtx |
| 4 |
% Copyright (c) Markus Kohm, 2015-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-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $ |
| 22 |
% The runs of run-time file generation: |
| 23 |
%<preidentify>%%% (run: preidentify) |
| 24 |
% - everything that is needed before selfidentification of resulting files |
| 25 |
% (unused) |
| 26 |
%<identify>%%% (run: identify) |
| 27 |
% - everything that is needed for selfidentification of resulting files |
| 28 |
% (unused) |
| 29 |
%<prepare>%%% (run: prepare) |
| 30 |
% - everything that is needed to define options |
| 31 |
%<option>%%% (run: option) |
| 32 |
% - definition of options (unused) |
| 33 |
%<execoption>%%% (run: execoption) |
| 34 |
% - initial option executions up to \KOMAProcessOptions |
| 35 |
% (unused) |
| 36 |
%<body>%%% (run: body) |
| 37 |
% - everything, that should be done after \KOMAProcessOptions |
| 38 |
%<exit>%%% (run: exit) |
| 39 |
% - everything, that should be done immediately before leaving the file |
| 40 |
% (unused) |
| 41 |
%<*dtx> |
| 42 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 43 |
\begingroup |
| 44 |
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} |
| 45 |
\filedate$Date: 2025-10-08 16:10:51 +0200 (Mi, 08. Okt 2025) $ |
| 46 |
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} |
| 47 |
\filerevision$Revision: 4228 $ |
| 48 |
\edef\reserved@a{% |
| 49 |
\noexpand\endgroup |
| 50 |
\noexpand\ProvidesFile{scrkernel-tocstyle.dtx}% |
| 51 |
[\filedate\space\filerevision\space |
| 52 |
KOMA-Script source (TOC styles)] |
| 53 |
}% |
| 54 |
\reserved@a |
| 55 |
\documentclass[USenglish]{koma-script-source-doc} |
| 56 |
\usepackage{babel} |
| 57 |
\setcounter{StandardModuleDepth}{3} |
| 58 |
\begin{document} |
| 59 |
\DocInput{scrkernel-tocstyle.dtx} |
| 60 |
\end{document} |
| 61 |
%</dtx> |
| 62 |
% \fi |
| 63 |
% |
| 64 |
% \changes{v3.20}{2015/11/13}{added} |
| 65 |
% \changes{v3.36}{2022/02/14}{switch over from \cls*{scrdoc} to |
| 66 |
% \cls*{koma-script-source-doc}} |
| 67 |
% \changes{v3.36}{2022/02/14}{whole implementation documentation in English} |
| 68 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 69 |
% |
| 70 |
% \GetFileInfo{scrkernel-tocstyle.dtx} |
| 71 |
% \title{The Predifined Directory Styles of |
| 72 |
% \href{https://komascript.de}{\KOMAScript} Package \pkg*{tocbasic} and the |
| 73 |
% \href{https://komascript.de}{\KOMAScript} Classes} |
| 74 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 75 |
% \date{Revision \fileversion{} of \filedate} |
| 76 |
% \maketitle |
| 77 |
% \begin{abstract} |
| 78 |
% \file{scrkernel-tocstyle.dtx} provides the predefined directory (or ToC) |
| 79 |
% styles. The basic styles of \pkg*{tocbasic} are defined independent from |
| 80 |
% the \KOMAScript{} classes. However, the \KOMAScript{} classes define their |
| 81 |
% own styles depending on the styles of \pkg*{tocbasic}. |
| 82 |
% \end{abstract} |
| 83 |
% \tableofcontents |
| 84 |
% |
| 85 |
% \section{User Manual} |
| 86 |
% |
| 87 |
% You can find the user documentation the commands implemented here in the |
| 88 |
% \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the |
| 89 |
% English \file{scrguide-en.pdf}. |
| 90 |
% |
| 91 |
% \MaybeStop{\PrintIndex} |
| 92 |
% |
| 93 |
% \section{Implementation of the Basic ToC Styles of Package |
| 94 |
% \pkg*{tocbasic} and the Specific ToC Styles of the \KOMAScript{} classes} |
| 95 |
% |
| 96 |
% \subsection{Settings independent from directories but nevertheless basis for |
| 97 |
% them} |
| 98 |
% |
| 99 |
% Before \KOMAScript~3.20 the commands here were part of the \KOMAScript{} |
| 100 |
% classes. But now they are part of package \pkg*{tocbasic}, because they |
| 101 |
% are more basic than only to be used by the \KOMAScript{} classes. |
| 102 |
% |
| 103 |
% |
| 104 |
% \begin{command}{\numberline} |
| 105 |
% \changes{v3.20}{2016/03/10}{\cs{numberline} defined indirectly by |
| 106 |
% \cs{scr@numberline}} |
| 107 |
% \begin{macro}{\scr@numberline} |
| 108 |
% \changes{v2.3c}{1995/08/06}{\cs{numberline} redefined} |
| 109 |
% \changes{v3.06}{2010/05/18}{Usage of\cs{numberline@prefix} and |
| 110 |
% \cs{numberline@postfix}} |
| 111 |
% \changes{v3.12}{2013/11/22}{use \cs{numberline@numberformat} only, if the |
| 112 |
% argument expands to a non-empty string} |
| 113 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed into \cs{Ifstr}} |
| 114 |
% This macro is used indirectly in the ToC and has to be redefined to fulfil |
| 115 |
% rules~5 and 6 of DUDDEN, 20th edition. |
| 116 |
% \begin{macrocode} |
| 117 |
%<*package&body> |
| 118 |
\newcommand*{\scr@numberline}[1]{% |
| 119 |
\numberline@box{% |
| 120 |
\numberline@prefix |
| 121 |
\Ifstr{#1}{}{#1}{% |
| 122 |
\numberline@numberformat{#1}% |
| 123 |
}% |
| 124 |
\numberline@postfix |
| 125 |
}% |
| 126 |
} |
| 127 |
% \end{macrocode} |
| 128 |
% \begin{command}{\usetocbasicnumberline} |
| 129 |
% \changes{v3.20}{2016/03/15}{added} |
| 130 |
% The macro tests, whether \cs{numberline} used \cs{scr@numberline}. If not, |
| 131 |
% the optional argument is executed and a afterwards \cs{numberline} is |
| 132 |
% redefined. |
| 133 |
% \begin{macrocode} |
| 134 |
\newcommand*{\usetocbasicnumberline}[1][% |
| 135 |
\PackageInfo{tocbasic}{Using my definition of `\string\numberline'}% |
| 136 |
]{% |
| 137 |
\@tempswatrue |
| 138 |
\begingroup |
| 139 |
\def\scr@numberline##1{\global\@tempswafalse}% |
| 140 |
% \end{macrocode} |
| 141 |
% For \cs{numberline} \cs{@tempdima} usually is the width reserved for the |
| 142 |
% number. To avoid problems with to low values, we use the maximum value for |
| 143 |
% the test. |
| 144 |
% \begin{macrocode} |
| 145 |
\@tempdima\maxdimen |
| 146 |
\sbox\@tempboxa{\numberline{0}}% |
| 147 |
\endgroup |
| 148 |
\if@tempswa #1\renewcommand*{\numberline}[1]{\scr@numberline{##1}}\fi |
| 149 |
} |
| 150 |
% \end{macrocode} |
| 151 |
% \end{command}^^A \usetocbasicnumberline |
| 152 |
% \begin{macro}{\numberline@prefix} |
| 153 |
% \changes{v3.06}{2010/05/18}{added} |
| 154 |
% The default is just empty. It can be used, e.g., to print something before |
| 155 |
% the number or to make the number right aligned. |
| 156 |
% \begin{macrocode} |
| 157 |
\newcommand*{\numberline@prefix}{} |
| 158 |
% \end{macrocode} |
| 159 |
% \end{macro}^^A \numberline@prefix |
| 160 |
% \begin{macro}{\numberline@postfix} |
| 161 |
% \changes{v3.06}{2010/05/18}{added} |
| 162 |
% The default is \cs{hfil} to make the number left aligned. |
| 163 |
% \begin{macrocode} |
| 164 |
\newcommand*{\numberline@postfix}{\hfil} |
| 165 |
% \end{macrocode} |
| 166 |
% \end{macro}^^A \numberline@postfix |
| 167 |
% \begin{macro}{\numberline@numberformat} |
| 168 |
% \changes{v3.06}{2010/05/18}{added} |
| 169 |
% \changes{v3.12}{2013/11/22}{don't output anything, if argument expands to |
| 170 |
% an empty string} |
| 171 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed into \cs{Ifstr}} |
| 172 |
% Used to fulfil rules~5 and 6 of DUDEN, 20th edition. |
| 173 |
% \begin{macrocode} |
| 174 |
\newcommand*{\numberline@numberformat}[1]{% |
| 175 |
\Ifstr{#1}{}{}{\numberline@numberprefix#1\numberline@numberpostfix}% |
| 176 |
} |
| 177 |
% \end{macrocode} |
| 178 |
% \begin{macro}{\numberline@numberprefix} |
| 179 |
% \changes{v3.20}{2016/03/15}{added} |
| 180 |
% Used to prefix the number inside \cs{numberline@numberformat}. In opposite |
| 181 |
% to \cs{numberline@prefix} it is only used, if the argument of |
| 182 |
% \cs{numberline@numberformat} and therefore the argument of \cs{numberline} |
| 183 |
% is not empty. |
| 184 |
% \begin{macrocode} |
| 185 |
\newcommand*{\numberline@numberprefix}{} |
| 186 |
% \end{macrocode} |
| 187 |
% \end{macro}^^A \numberline@numberprefix |
| 188 |
% \begin{macro}{\numberline@numberpostfix} |
| 189 |
% \changes{v3.20}{2016/03/15}{added} |
| 190 |
% Used to postfix the number inside \cs{numberline@numberformat}. In opposite |
| 191 |
% to \cs{numberline@prefix} it is only used, if the argument of |
| 192 |
% \cs{numberline@numberformat} and therefore the argument of \cs{numberline} |
| 193 |
% is not empty. |
| 194 |
% \begin{macrocode} |
| 195 |
\newcommand*{\numberline@numberpostfix}{} |
| 196 |
% \end{macrocode} |
| 197 |
% \end{macro}^^A \numberline@numberpostfix |
| 198 |
% \end{macro}^^A \numberline@numberformat |
| 199 |
% \begin{macro}{\numberline@box} |
| 200 |
% \changes{v3.06}{2010/05/18}{added} |
| 201 |
% Is used to put the sectioning number into a box. |
| 202 |
% \begin{macrocode} |
| 203 |
\newcommand*{\numberline@box}[1]{\hb@xt@\@tempdima{#1}} |
| 204 |
%</package&body> |
| 205 |
% \end{macrocode} |
| 206 |
% \end{macro}^^A \numberline@box |
| 207 |
% \end{macro}^^A \scr@numberline |
| 208 |
% |
| 209 |
% \begin{macrocode} |
| 210 |
%<*class&body> |
| 211 |
\let\numberline\scr@numberline |
| 212 |
%</class&body> |
| 213 |
% \end{macrocode} |
| 214 |
% \end{command}^^A \numberline |
| 215 |
% |
| 216 |
% |
| 217 |
% \subsection{The basics of the styles} |
| 218 |
% |
| 219 |
% From \KOMAScript~3.20 styles are a new basic feature for the entries into |
| 220 |
% the table of contents and other directories. Each style consists of a |
| 221 |
% command that defines the entry command and the corresponding options. The |
| 222 |
% options are used to provide configuration features. |
| 223 |
% |
| 224 |
% \begin{macrocode} |
| 225 |
%<*package> |
| 226 |
% \end{macrocode} |
| 227 |
% |
| 228 |
% \changes{v3.20}{2015/11/17}{ToC styles have the \texttt{KOMAarg} member |
| 229 |
% \texttt{.dte}} |
| 230 |
% \begin{macrocode} |
| 231 |
%<*body> |
| 232 |
\DefineFamily{KOMAarg} |
| 233 |
\DefineFamilyMember[.dte]{KOMAarg} |
| 234 |
%</body> |
| 235 |
% \end{macrocode} |
| 236 |
% |
| 237 |
% \begin{macro}{\@DefineTOCEntryOptionWithoutDefault, |
| 238 |
% \@DefineTOCEntryOptionWithDefault} |
| 239 |
% \changes{v3.20}{2015/11/10}{added} |
| 240 |
% \changes{v3.49}{2025/10/08}{removed} |
| 241 |
% \end{macro} |
| 242 |
% \begin{macro}{\@DefineTOCEntryOption} |
| 243 |
% \changes{v3.20}{2015/04/10}{added} |
| 244 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 245 |
% The definition of the options is done by a general interface. Important |
| 246 |
% is, that the definition of the option is done indirectly, which means: |
| 247 |
% Here we define a command, that defines the options when needed. Note, not |
| 248 |
% only the entry command interface itself but also the sectioning command |
| 249 |
% interface may and should be able to setup options of the entry commands. |
| 250 |
% The parameters: |
| 251 |
% \begin{description} |
| 252 |
% \item[\marg{style}: \meta{string},] name of the entry style |
| 253 |
% \item[\marg{option}: \meta{string},] name of the option |
| 254 |
% \item[\oarg{value}:] default value of the option depending on the |
| 255 |
% \meta{definition} |
| 256 |
% \item[\marg{definition}: \meta{code},] definition of the option |
| 257 |
% \end{description} |
| 258 |
% \begin{macrocode} |
| 259 |
%<*body> |
| 260 |
\NewDocumentCommand{\@DefineTOCEntryOption}{mmom}{% |
| 261 |
\edef\scr@dte@doopts{% |
| 262 |
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2}% |
| 263 |
}% |
| 264 |
\IfValueTF{#3}{% |
| 265 |
\l@addto@macro\scr@dte@doopts{[#3]}% |
| 266 |
\DefineFamilyKey[.dte]{KOMAarg}{#2}[{#3}]{#4}% |
| 267 |
}{% |
| 268 |
\DefineFamilyKey[.dte]{KOMAarg}{#2}{#4}% |
| 269 |
}% |
| 270 |
} |
| 271 |
%</body> |
| 272 |
% \end{macrocode} |
| 273 |
% \end{macro}^^A \@DefineTOCEntryOption |
| 274 |
% |
| 275 |
% \begin{macro}{\@RelaxTOCEntryOptions} |
| 276 |
% \changes{v3.20}{2015/04/10}{added} |
| 277 |
% Reset all options of the current do-list back to \cs{relax}. |
| 278 |
% \begin{macrocode} |
| 279 |
%<*body> |
| 280 |
\newcommand*{\@RelaxTOCEntryOptions}{% |
| 281 |
\begingroup |
| 282 |
\def\do@endgroup{\endgroup}% |
| 283 |
\DeclareDocumentCommand\do{m+o}{% |
| 284 |
\l@addto@macro\do@endgroup{% |
| 285 |
\RelaxFamilyKey[.dte]{KOMAarg}{##1}% |
| 286 |
}% |
| 287 |
}% |
| 288 |
\scr@dte@doopts |
| 289 |
\do@endgroup |
| 290 |
} |
| 291 |
%</body> |
| 292 |
% \end{macrocode} |
| 293 |
% \end{macro}^^A \@RelaxTOCEntryOptions |
| 294 |
% \begin{macro}{\scr@dte@gobbleopt} |
| 295 |
% \changes{v3.20}{2015/04/10}{added} |
| 296 |
% \changes{v3.49}{2025/10/08}{removed} |
| 297 |
% \end{macro} |
| 298 |
% |
| 299 |
% \begin{macro}{\@DefineTOCEntryListOption} |
| 300 |
% \changes{v3.31}{2020/06/11}{added} |
| 301 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 302 |
% Use \cs{DefineTOCEntryOption} to define an option that represents a list. |
| 303 |
% It has following parameters: |
| 304 |
% \begin{description} |
| 305 |
% \item[\marg{style}: \meta{string},] name of the entry style |
| 306 |
% \item[\marg{option}: \meta{string},] name of the option |
| 307 |
% \item[\oarg{default}: \meta{string},] default value of the option |
| 308 |
% \item[\marg{prefix}: \meta{string},] prefix of the macro to be defined |
| 309 |
% \item[\marg{postfix}: \meta{string},] postfix of the macro to be defined |
| 310 |
% \item[\marg{description}: \meta{String},] short description of the option |
| 311 |
% \end{description} |
| 312 |
% Between the \meta{prefix} and \meta{postfix} automatically |
| 313 |
% \cs{scr@dte@current} will be added. A copy option using ``\opt{:=}'' |
| 314 |
% instead of ``\opt{=}'' and an add (append) option using ``\opt{+=}'' |
| 315 |
% instead of ``\opt{=}'' is also defined. |
| 316 |
% \begin{macrocode} |
| 317 |
%<*body> |
| 318 |
\NewDocumentCommand{\@DefineTOCEntryListOption}{mmommm}{% |
| 319 |
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}% |
| 320 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 321 |
\expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{##1}% |
| 322 |
\FamilyKeyStateProcessed |
| 323 |
}% |
| 324 |
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{% |
| 325 |
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{% |
| 326 |
\expandafter\let |
| 327 |
\csname #4\scr@dte@current#5\expandafter\endcsname |
| 328 |
\csname #4##1#5\endcsname |
| 329 |
\FamilyKeyStateProcessed |
| 330 |
}% |
| 331 |
}% |
| 332 |
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{% |
| 333 |
\expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{% |
| 334 |
\csname #4\scr@dte@current#5\endcsname,##1}% |
| 335 |
\FamilyKeyStateProcessed |
| 336 |
}% |
| 337 |
\edef\scr@dte@doopts{% |
| 338 |
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}\noexpand\do{#2+}% |
| 339 |
}% |
| 340 |
} |
| 341 |
%</body> |
| 342 |
% \end{macrocode} |
| 343 |
% \begin{macro}{\@DefineTOCEntryListOptionWithoutDefault, |
| 344 |
% \@DefineTOCEntryListOptionWithDefault} |
| 345 |
% \changes{v3.31}{2020/06/11}{added} |
| 346 |
% \changes{v3.49}{2025/10/08}{removed} |
| 347 |
% \end{macro} |
| 348 |
% \end{macro}^^A \@DefineTOCEntryListOption |
| 349 |
% |
| 350 |
% \begin{macro}{\@DefineTOCEntryLengthOptionWithoutDefault, |
| 351 |
% \@DefineTOCEntryLengthOptionWithDefault} |
| 352 |
% \changes{v3.20}{2015/11/10}{added} |
| 353 |
% \changes{v3.49}{2025/10/08}{removed} |
| 354 |
% \end{macro} |
| 355 |
% \begin{macro}{\@DefineTOCEntryLengthOption} |
| 356 |
% \changes{v3.20}{2015/12/04}{added} |
| 357 |
% \changes{v3.27}{2019/10/02}{automatic definition of copy option} |
| 358 |
% \changes{v3.27}{2019/10/03}{automatic definition of add option} |
| 359 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 360 |
% Use \cs{DefineTOCEntryOption} to define an option that represents a length |
| 361 |
% macro. The parameters are: |
| 362 |
% \begin{description} |
| 363 |
% \item[\marg{style}: \meta{string},] name of the entry style |
| 364 |
% \item[\marg{option}: \meta{string},] name of the option |
| 365 |
% \item[\oarg{value}: \meta{length},] default value of the option |
| 366 |
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro |
| 367 |
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro |
| 368 |
% \item[\marg{explanation}: \meta{string},] short description of the option |
| 369 |
% \end{description} |
| 370 |
% Later, when the option is defines, between \meta{prefix} and |
| 371 |
% \meta{postfix} will be added \cs{scr@dte@current} automatically. This is |
| 372 |
% the name of the entry level, e.g., |subsection| or |figure|. Additionally |
| 373 |
% to the option \marg{option} itself a copy option \marg{option}\opt{:} will |
| 374 |
% be defined. So it seems, that for the copy option a colon is before the |
| 375 |
% equal sign. The value of the copy option has to be the name of another |
| 376 |
% entry level and it copies the value of the same option of that entry |
| 377 |
% level. Additionally an additive option with appended plus sign is |
| 378 |
% defined. It adds the new value to the existing one. |
| 379 |
% \begin{macro}{\@DefineTOCEntryLengthOptionMacro,\@DefineTOCEntryAddLengthOptionMacro} |
| 380 |
% \changes{v3.27}{2019/10/03}{added} |
| 381 |
% \begin{macrocode} |
| 382 |
%<*body> |
| 383 |
\NewDocumentCommand{\@DefineTOCEntryLengthOption}{mmommm}{% |
| 384 |
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}% |
| 385 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 386 |
\@DefineTOCEntryLengthOptionMacro{#2}{#4}{#5}{##1}% |
| 387 |
}% |
| 388 |
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{% |
| 389 |
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{% |
| 390 |
\expandafter\let |
| 391 |
\csname #4\scr@dte@current#5\expandafter\endcsname |
| 392 |
\csname #4##1#5\endcsname |
| 393 |
\FamilyKeyStateProcessed |
| 394 |
}% |
| 395 |
}% |
| 396 |
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{% |
| 397 |
\@DefineTOCEntryAddLengthOptionMacro{#2+}{#4}{#5}{##1}% |
| 398 |
}% |
| 399 |
\edef\scr@dte@doopts{% |
| 400 |
\unexpanded\expandafter{\scr@dte@doopts}% |
| 401 |
\noexpand\do{#2:}\noexpand\do{#2+}% |
| 402 |
}% |
| 403 |
} |
| 404 |
\newcommand*{\@DefineTOCEntryLengthOptionMacro}[4]{% |
| 405 |
\protected@edef\reserved@a{% |
| 406 |
\noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}% |
| 407 |
}\reserved@a |
| 408 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 409 |
\ifscr@dte@expandtopt |
| 410 |
\expandafter\edef\csname #2\scr@dte@current#3\endcsname{% |
| 411 |
\the\@tempskipa}% |
| 412 |
\else |
| 413 |
\expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{#4}% |
| 414 |
\fi |
| 415 |
\fi |
| 416 |
} |
| 417 |
\newcommand*{\@DefineTOCEntryAddLengthOptionMacro}[4]{% |
| 418 |
\@ifundefined{#2\scr@dte@current#3}{% |
| 419 |
\FamilyKeyStateUnknownValue |
| 420 |
}{% |
| 421 |
\protected@edef\reserved@a{% |
| 422 |
\noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}% |
| 423 |
}\reserved@a |
| 424 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 425 |
\ifscr@dte@expandtopt |
| 426 |
\expandafter\edef\csname #2\scr@dte@current#3\endcsname{% |
| 427 |
\the\glueexpr\@tempskipa |
| 428 |
+\csname #2\scr@dte@current#3\endcsname\relax}% |
| 429 |
\else |
| 430 |
\expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{% |
| 431 |
\the\glueexpr #4% |
| 432 |
+\csname #2\scr@dte@current#3\endcsname\relax}% |
| 433 |
\fi |
| 434 |
\fi |
| 435 |
}% |
| 436 |
} |
| 437 |
%</body> |
| 438 |
% \end{macrocode} |
| 439 |
% \end{macro}^^A \@DefineTOCEntryAddLengthOptionMacro,\@DefineTOCEntryLengthOptionMacro |
| 440 |
% \end{macro}^^A \@DefineTOCEntryLengthOption |
| 441 |
% |
| 442 |
% \begin{macro}{\@DefineTOCEntryNumberOptionWithoutDefault, |
| 443 |
% \@DefineTOCEntryNumberOptionWithDefault} |
| 444 |
% \changes{v3.20}{2015/11/12}{added} |
| 445 |
% \changes{v3.49}{2025/10/08}{removed} |
| 446 |
% \end{macro} |
| 447 |
% \begin{macro}{\@DefineTOCEntryNumberOption} |
| 448 |
% \changes{v3.20}{2015/12/04}{added} |
| 449 |
% \changes{v3.27}{2019/10/02}{automatic definition of copy option} |
| 450 |
% \changes{v3.27}{2019/10/03}{automatic definition of add option} |
| 451 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 452 |
% Use \cs{DefineTOCEntryOption} to define an option that represents a number |
| 453 |
% macro. The parameters are: |
| 454 |
% \begin{description} |
| 455 |
% \item[\marg{style}: \meta{string},] name of the entry style |
| 456 |
% \item[\marg{option}: \meta{string},] name of the option |
| 457 |
% \item[\oarg{value}: \meta{length},] default value of the option |
| 458 |
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro |
| 459 |
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro |
| 460 |
% \item[\marg{explanation}: \meta{string},] short description of the option |
| 461 |
% \end{description} |
| 462 |
% Later, when the option is defines, between \meta{prefix} and |
| 463 |
% \meta{postfix} will be added \cs{scr@dte@current} automatically. This is |
| 464 |
% the name of the entry level, e.g., |subsection| or |figure|. Additionally |
| 465 |
% to the option \marg{option} itself a copy option \marg{option}\opt{:} will |
| 466 |
% be defined. So it seems, that for the copy option a colon is before the |
| 467 |
% equal sign. The value of the copy option has to be the name of another |
| 468 |
% entry level and it copies the value of the same option of that entry |
| 469 |
% level. Additionally an additive option with appended plus sign is |
| 470 |
% defined. It adds the new value to the existing one. |
| 471 |
% \begin{macro}{\@DefineTOCEntryNumberOptionMacro,\@DefineTOCEntryAddNumberOptionMacro} |
| 472 |
% \changes{v3.27}{2019/10/03}{added} |
| 473 |
% \begin{macrocode} |
| 474 |
%<*body> |
| 475 |
\NewDocumentCommand{\@DefineTOCEntryNumberOption}{mmommm}{% |
| 476 |
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}% |
| 477 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 478 |
\@DefineTOCEntryNumberOptionMacro{#2}{#4}{#5}{##1}% |
| 479 |
}% |
| 480 |
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{% |
| 481 |
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{% |
| 482 |
\expandafter\let |
| 483 |
\csname #4\scr@dte@current#5\expandafter\endcsname |
| 484 |
\csname #4##1#5\endcsname |
| 485 |
\FamilyKeyStateProcessed |
| 486 |
}% |
| 487 |
}% |
| 488 |
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{% |
| 489 |
\@DefineTOCEntryAddNumberOptionMacro{#2+}{#4}{#5}{##1}% |
| 490 |
}% |
| 491 |
\edef\scr@dte@doopts{% |
| 492 |
\unexpanded\expandafter{\scr@dte@doopts}% |
| 493 |
\noexpand\do{#2:}\noexpand\do{#2+}% |
| 494 |
}% |
| 495 |
} |
| 496 |
\newcommand*{\@DefineTOCEntryNumberOptionMacro}[4]{% |
| 497 |
\protected@edef\reserved@a{% |
| 498 |
\noexpand\FamilySetCounterMacro{KOMAarg}{#1}{% |
| 499 |
\expandafter\noexpand\csname #2\scr@dte@current#3\endcsname |
| 500 |
}{#4}% |
| 501 |
}\reserved@a |
| 502 |
} |
| 503 |
\newcommand*{\@DefineTOCEntryAddNumberOptionMacro}[4]{% |
| 504 |
\@ifundefined{#2\scr@dte@current#3}{% |
| 505 |
\FamilyKeyStateUnknownValue |
| 506 |
}{% |
| 507 |
\FamilySetCounterMacro{KOMAarg}{#1}{% |
| 508 |
\reserved@a |
| 509 |
}{#4}% |
| 510 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 511 |
\expandafter\edef\csname #2\scr@dte@current#3\endcsname{% |
| 512 |
\the\numexpr \reserved@a+\csname #2\scr@dte@current#3\endcsname\relax |
| 513 |
}% |
| 514 |
\fi |
| 515 |
}% |
| 516 |
} |
| 517 |
%</body> |
| 518 |
% \end{macrocode} |
| 519 |
% \end{macro}^^A \@DefineTOCEntryAddNumberOptionMacro,\@DefineTOCEntryNumberOptionMacro |
| 520 |
% \end{macro}^^A \@DefineTOCEntryNumberOption |
| 521 |
% |
| 522 |
% \begin{macro}{\@DefineTOCEntryBoolOptionWithoutDefault, |
| 523 |
% \@DefineTOCEntryBoolOptionWithDefault} |
| 524 |
% \changes{v3.20}{2015/11/12}{added} |
| 525 |
% \changes{v3.49}{2025/10/08}{removed} |
| 526 |
% \end{macro} |
| 527 |
% |
| 528 |
% \begin{macro}{\@DefineTOCEntryBooleanOption} |
| 529 |
% \changes{v3.20}{2015/12/04}{added} |
| 530 |
% \changes{v3.27}{2019/10/02}{automatic definition of copy option} |
| 531 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 532 |
% Use \cs{DefineTOCEntryOption} to define an option that represents a |
| 533 |
% boolean switch. The parameters are: |
| 534 |
% \begin{description} |
| 535 |
% \item[\marg{style}: \meta{string},] name of the entry style |
| 536 |
% \item[\marg{option}: \meta{string},] name of the option |
| 537 |
% \item[\oarg{value}: \meta{length},] default value of the option |
| 538 |
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro |
| 539 |
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro |
| 540 |
% \item[\marg{explanation}: \meta{string},] short description of the option |
| 541 |
% \end{description} |
| 542 |
% Later, when the option is defines, between \meta{prefix} and |
| 543 |
% \meta{postfix} will be added \cs{scr@dte@current} automatically. This is |
| 544 |
% the name of the entry level, e.g., |subsection| or |figure|. Additionally |
| 545 |
% to the option \marg{option} itself a copy option \marg{option}\opt{:} will |
| 546 |
% be defined. So it seems, that for the copy option a colon is before the |
| 547 |
% equal sign. The value of the copy option has to be the name of another |
| 548 |
% entry level and it copies the value of the same option of that entry |
| 549 |
% level. |
| 550 |
% \begin{macro}{\@DefineTOCEntryBoolOptionMacro} |
| 551 |
% \changes{v3.20}{2015/11/12}{added} |
| 552 |
% \begin{macrocode} |
| 553 |
%<*body> |
| 554 |
\NewDocumentCommand{\@DefineTOCEntryBooleanOption}{mmO{true}mmm}{% |
| 555 |
\@TOCEntryStyleNeedsCommandByOption{#1}{if#4}{#5}{#2}{#6}% |
| 556 |
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5true}{#2}{#6}% |
| 557 |
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5false}{#2}{#6}% |
| 558 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 559 |
\@DefineTOCEntryBoolOptionMacro{#2}{#4}{#5}{##1}% |
| 560 |
}% |
| 561 |
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{% |
| 562 |
\scr@ifundefinedorrelax{if#4##1#5}{\FamilyKeyStateUnknownValue}{% |
| 563 |
\expandafter\let |
| 564 |
\csname if#4\scr@dte@current#5\expandafter\endcsname |
| 565 |
\csname if#4##1#5\endcsname |
| 566 |
\FamilyKeyStateProcessed |
| 567 |
}% |
| 568 |
}% |
| 569 |
\edef\scr@dte@doopts{% |
| 570 |
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}% |
| 571 |
}% |
| 572 |
} |
| 573 |
\newcommand*{\@DefineTOCEntryBoolOptionMacro}[4]{% |
| 574 |
\@ifundefined{if#2\scr@dte@current#3}{% |
| 575 |
\expandafter\newif\csname if#2\scr@dte@current#3\endcsname |
| 576 |
}{}% |
| 577 |
\FamilySetBool{KOMAarg}{#1}{#2\scr@dte@current#3}{#4}% |
| 578 |
} |
| 579 |
%</body> |
| 580 |
% \end{macrocode} |
| 581 |
% \end{macro}^^A \@DefineTOCEntryBoolOptionMacro |
| 582 |
% \end{macro}^^A \@DefineTOCEntryBooleanOption |
| 583 |
% |
| 584 |
% \begin{macro}{\@DefineTOCEntryIfOptionWithoutDefault, |
| 585 |
% \@DefineTOCEntryIfOptionWithDefault} |
| 586 |
% \changes{v3.20}{2015/11/12}{added} |
| 587 |
% \changes{v3.49}{2025/10/08}{removed} |
| 588 |
% \end{macro} |
| 589 |
% |
| 590 |
% \begin{macro}{\@DefineTOCEntryIfOption} |
| 591 |
% \changes{v3.20}{2015/12/06}{added} |
| 592 |
% \changes{v3.27}{2019/10/02}{automatic definition of copy option} |
| 593 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 594 |
% Use \cs{DefineTOCEntryOption} to define an option that represents an if |
| 595 |
% command. The option itself is a boolean option. The parameters are: |
| 596 |
% \begin{description} |
| 597 |
% \item[\marg{style}: \meta{string},] name of the entry style |
| 598 |
% \item[\marg{option}: \meta{string},] name of the option |
| 599 |
% \item[\oarg{value}: \meta{length},] default value of the option |
| 600 |
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro |
| 601 |
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro |
| 602 |
% \item[\marg{explanation}: \meta{string},] short description of the option |
| 603 |
% \end{description} |
| 604 |
% Later, when the option is defines, between \meta{prefix} and |
| 605 |
% \meta{postfix} will be added \cs{scr@dte@current} automatically. This is |
| 606 |
% the name of the entry level, e.g., |subsection| or |figure|. Additionally |
| 607 |
% to the option \marg{option} itself a copy option \marg{option}\opt{:} will |
| 608 |
% be defined. So it seems, that for the copy option a colon is before the |
| 609 |
% equal sign. The value of the copy option has to be the name of another |
| 610 |
% entry level and it copies the value of the same option of that entry |
| 611 |
% level. |
| 612 |
% \begin{macro}{\@DefineTOCEntryIfOptionMacro} |
| 613 |
% \changes{v3.20}{2015/11/12}{added} |
| 614 |
% \begin{macrocode} |
| 615 |
%<*body> |
| 616 |
\NewDocumentCommand{\@DefineTOCEntryIfOption}{mmO{true}mmm}{% |
| 617 |
\@TOCEntryStyleNeedsCommandByOption{#1}{If#4}{#5}{#2}{#6}% |
| 618 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 619 |
\@DefineTOCEntryIfOptionMacro{#2}{#4}{#5}{##1}% |
| 620 |
}% |
| 621 |
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{% |
| 622 |
\scr@ifundefinedorrelax{If#4##1#5}{\FamilyKeyStateUnknownValue}{% |
| 623 |
\expandafter\let |
| 624 |
\csname If#4\scr@dte@current#5\expandafter\endcsname |
| 625 |
\csname If#4##1#5\endcsname |
| 626 |
\FamilyKeyStateProcessed |
| 627 |
}% |
| 628 |
}% |
| 629 |
\edef\scr@dte@doopts{% |
| 630 |
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}% |
| 631 |
}% |
| 632 |
} |
| 633 |
\newcommand*{\@DefineTOCEntryIfOptionMacro}[4]{% |
| 634 |
\FamilySetBool{KOMAarg}{#1}{@tempswa}{#4}% |
| 635 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 636 |
\if@tempswa |
| 637 |
\expandafter\let\csname If#2\scr@dte@current#3\endcsname\@firstoftwo |
| 638 |
\else |
| 639 |
\expandafter\let\csname If#2\scr@dte@current#3\endcsname\@secondoftwo |
| 640 |
\fi |
| 641 |
\fi |
| 642 |
} |
| 643 |
%</body> |
| 644 |
% \end{macrocode} |
| 645 |
% \end{macro}^^A \@DefineTOCEntryIfOptionMacro |
| 646 |
% \end{macro}^^A \@DefineTOCEntryIfOption |
| 647 |
% |
| 648 |
%<@@=> |
| 649 |
% \begin{macro}{\@DefineTOCEntryCommandOptionWithoutDefault, |
| 650 |
% \@@DefineTOCEntryCommandOptionWithoutDefault, |
| 651 |
% \@DefineTOCEntryCommandOptionWithDefault, |
| 652 |
% \@@DefineTOCEntryCommandOptionWithDefault} |
| 653 |
% \changes{v3.20}{2015/11/12}{added} |
| 654 |
% \changes{v3.49}{2025/10/08}{removed} |
| 655 |
% \end{macro} |
| 656 |
% |
| 657 |
% \begin{macro}{\@DefineTOCEntryCommandOption} |
| 658 |
% \changes{v3.20}{2015/11/17}{added} |
| 659 |
% \changes{v3.27}{2019/10/02}{automatic definition of copy option} |
| 660 |
% \changes{v3.27}{2019/10/03}{automatic definition of add option} |
| 661 |
% \changes{v3.49}{2025/10/08}{using \cs{NewDocumentCommand}} |
| 662 |
% \changes{v3.49}{2025/10/08}{extended to 9 possible arguments} |
| 663 |
% Use \cs{DefineTOCEntryOption} to define an option that represents a |
| 664 |
% macro. The parameters are: |
| 665 |
% \begin{description} |
| 666 |
% \item[\marg{style}: \meta{string},] name of the entry style, |
| 667 |
% \item[\marg{option}: \meta{string},] name of the option, |
| 668 |
% \item[\oarg{value}: \meta{length},] default value of the option, |
| 669 |
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro, |
| 670 |
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro, |
| 671 |
% \item[\oarg{arguments}: \meta{integer},] number of arguments for the |
| 672 |
% macro, |
| 673 |
% \item[\marg{explanation}: \meta{string},] short description of the option, |
| 674 |
% either 0, 1 or 2. |
| 675 |
% \end{description} |
| 676 |
% Later, when the option is defines, between \meta{prefix} and |
| 677 |
% \meta{postfix} will be added \cs{scr@dte@current} automatically. This is |
| 678 |
% the name of the entry level, e.g., |subsection| or |figure|. Additionally |
| 679 |
% to the option \marg{option} itself a copy option \marg{option}\opt{:} will |
| 680 |
% be defined. So it seems, that for the copy option a colon is before the |
| 681 |
% equal sign. The value of the copy option has to be the name of another |
| 682 |
% entry level and it copies the value of the same option of that entry |
| 683 |
% level. Additionally an appending option with appended plus sign is |
| 684 |
% defined. It appends the new code to the existing one. |
| 685 |
% \begin{macro}{\@DefineTOCEntryCommandOptionMacro,\@DefineTOCEntryCommandOptionMacro@} |
| 686 |
% \changes{v3.20}{2015/11/26}{added} |
| 687 |
% \changes{v3.49}{2025/10/08}{internal command renamed} |
| 688 |
% \begin{macrocode} |
| 689 |
%<*body> |
| 690 |
\NewDocumentCommand{\@DefineTOCEntryCommandOption}{mmommO{0}m}{% |
| 691 |
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#7}% |
| 692 |
\ifcase #6 |
| 693 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 694 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1}% |
| 695 |
}% |
| 696 |
\or |
| 697 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 698 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}}% |
| 699 |
}% |
| 700 |
\or |
| 701 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 702 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}}% |
| 703 |
}% |
| 704 |
\or |
| 705 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 706 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}}% |
| 707 |
}% |
| 708 |
\or |
| 709 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 710 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}}% |
| 711 |
}% |
| 712 |
\or |
| 713 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 714 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}}% |
| 715 |
}% |
| 716 |
\or |
| 717 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 718 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}}% |
| 719 |
}% |
| 720 |
\or |
| 721 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 722 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}}% |
| 723 |
}% |
| 724 |
\or |
| 725 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 726 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}}% |
| 727 |
}% |
| 728 |
\or |
| 729 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 730 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}{####8}}% |
| 731 |
}% |
| 732 |
\or |
| 733 |
\@DefineTOCEntryOption{#1}{#2}[{#3}]{% |
| 734 |
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}{####8}{####9}}% |
| 735 |
}% |
| 736 |
\else |
| 737 |
\PackageError{tocbasic}{maximum argument supported}{% |
| 738 |
\string\DefineTOCEntryCommandOption\space currently supports only |
| 739 |
commands with\MessageBreak |
| 740 |
at most one argument not #5}% |
| 741 |
\expandafter\@gobbletwo |
| 742 |
\fi |
| 743 |
\@firstofone{% |
| 744 |
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{% |
| 745 |
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{% |
| 746 |
\expandafter\let |
| 747 |
\csname #4\scr@dte@current#5\expandafter\endcsname |
| 748 |
\csname #4##1#5\endcsname |
| 749 |
\FamilyKeyStateProcessed |
| 750 |
}% |
| 751 |
}% |
| 752 |
\edef\scr@dte@doopts{% |
| 753 |
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}% |
| 754 |
}% |
| 755 |
}% |
| 756 |
} |
| 757 |
\newcommand*{\@DefineTOCEntryCommandOptionMacro}[3]{% |
| 758 |
\@testopt{\@DefineTOCEntryCommandOptionMacro@{#1}{#2}{#3}}0% |
| 759 |
} |
| 760 |
\newcommand*{\@DefineTOCEntryCommandOptionMacro@}{} |
| 761 |
\long\def\@DefineTOCEntryCommandOptionMacro@#1#2#3[#4]#5{% |
| 762 |
\let\l@ngrel@x\long |
| 763 |
\expandafter\@yargdef\csname #2\scr@dte@current#3\endcsname\@ne{#4}{#5}% |
| 764 |
\FamilyKeyStateProcessed |
| 765 |
} |
| 766 |
%</body> |
| 767 |
% \end{macrocode} |
| 768 |
% \end{macro}^^A \@DefineTOCEntryCommandOptionMacro@,\@DefineTOCEntryCommandOptionMacro |
| 769 |
% \end{macro}^^A \@DefineTOCEntryCommandOption |
| 770 |
% |
| 771 |
% \begin{macro}{\@AddToDeclareTOCStyleEntryPreCheckNeeds, |
| 772 |
% \@PreToDeclareTOCStyleEntryPreCheckNeeds} |
| 773 |
% \changes{v3.20}{2015/12/06}{added} |
| 774 |
% Before the existence of the mandatory commands can be tested in |
| 775 |
% \cs{DeclareTOCStyleEntry}, a hook will be executed. To add code to this hook |
| 776 |
% we have this command with the following parameter: |
| 777 |
% \begin{description} |
| 778 |
% \item[\marg{code}: \meta{code},] code to be executed. |
| 779 |
% \end{description} |
| 780 |
% Please note, this command is used inside the init code of styles, which |
| 781 |
% means inside \cs{DeclareTOCEntryStyle}, but the hook is inside |
| 782 |
% \cs{DeclareTOCStyleEntry}. The code of the hook has exactly one argument, |
| 783 |
% the name of the ToC entry level. |
| 784 |
% \begin{macrocode} |
| 785 |
%<*body> |
| 786 |
\newcommand{\@AddToDeclareTOCEntryStylePreCheckNeeds}[1]{% |
| 787 |
\expandafter\providecommand\csname scr@dte@precheck\endcsname[1]{}% |
| 788 |
\expandafter\l@addto@macro@a\csname scr@dte@precheck\endcsname |
| 789 |
} |
| 790 |
\newcommand{\@PreToDeclareTOCEntryStylePreCheckNeeds}[1]{% |
| 791 |
\expandafter\providecommand\csname scr@dte@precheck\endcsname[1]{}% |
| 792 |
\expandafter\l@preto@macro@a\csname scr@dte@precheck\endcsname |
| 793 |
} |
| 794 |
%</body> |
| 795 |
% \end{macrocode} |
| 796 |
% \end{macro}^^A \@AddToDeclareTOCStyleEntryPreCheckNeeds,\@PreToDeclareTOCStyleEntryPreCheckNeeds |
| 797 |
% |
| 798 |
% \begin{macro}{\@TOCEntryStyleNeedsCommandByOption} |
| 799 |
% \changes{v3.20}{2015/12/04}{added} |
| 800 |
% Adds one or more commands to the list of mandatory commands. The parameters |
| 801 |
% are: |
| 802 |
% \begin{description} |
| 803 |
% \item[\marg{style}:] The style \meta{string}, that needs the command(s). |
| 804 |
% \item[\marg{prefix}:] Prefix \meta{string} of the mandatory command(s). |
| 805 |
% \item[\marg{postfix}:] Postfix \meta{string} of the mandatory command(s). |
| 806 |
% \item[\marg{Option}:] Option \meta{string}, that defines the command(s). |
| 807 |
% \item[\marg{explanation}:] Short description. |
| 808 |
% \end{description} |
| 809 |
% Between \meta{prefix} and \meta{postfix} will be added the name of the entry |
| 810 |
% level automatically. |
| 811 |
% \begin{macrocode} |
| 812 |
%<*body> |
| 813 |
\newcommand*{\@TOCEntryStyleNeedsCommandByOption}[5]{% |
| 814 |
\expandafter\providecommand\expandafter*\csname scr@dte@#1@needs\endcsname{}% |
| 815 |
\expandafter\l@addto@macro\csname scr@dte@#1@needs\endcsname{% |
| 816 |
\do{#2}{#3}{#4}{#5}% |
| 817 |
}% |
| 818 |
} |
| 819 |
%</body> |
| 820 |
% \end{macrocode} |
| 821 |
% \end{macro}^^A \@TOCEntryStyleNeedsCommandByOption |
| 822 |
% |
| 823 |
% \begin{command}{\TOCEntryStyleInitCode,\TOCEntryStyleInitCode*, |
| 824 |
% \TOCEntryStyleStartInitCode} |
| 825 |
% \changes{v3.20}{2015/11/25}{added} |
| 826 |
% \changes{v3.41}{2023/06/20}{star variant \cs{TOCEntryStyleInitCode*} added} |
| 827 |
% Executes commands before a ToC entry level command of this style is defined |
| 828 |
% and before the \emph{needs} list will be executed. The parameters are: |
| 829 |
% \begin{description} |
| 830 |
% \item[\marg{style}:] The style \meta{string} that should be initialised. |
| 831 |
% \item[\marg{code}:] The code that should be executed to initialise the |
| 832 |
% style. The code has one argument \texttt{\#1} which is the name of the ToC |
| 833 |
% entry level. |
| 834 |
% \end{description} |
| 835 |
% \begin{macrocode} |
| 836 |
%<*body> |
| 837 |
\NewDocumentCommand\TOCEntryStyleInitCode{sm}{% |
| 838 |
\IfBooleanT{#1}{\expandafter\let\csname scr@dte@#2@init\endcsname\relax}% |
| 839 |
\scr@ifundefinedorrelax{scr@dte@#2@init}{% |
| 840 |
\expandafter\newcommand\expandafter*% |
| 841 |
\csname scr@dte@#2@init\endcsname[1]% |
| 842 |
}{% |
| 843 |
\expandafter\l@addto@macro@a\csname scr@dte@#2@init\endcsname |
| 844 |
}% |
| 845 |
} |
| 846 |
\newcommand{\TOCEntryStyleStartInitCode}[1]{% |
| 847 |
\scr@ifundefinedorrelax{scr@dte@#1@init}{% |
| 848 |
\expandafter\providecommand\expandafter*% |
| 849 |
\csname scr@dte@#1@init\endcsname[1]% |
| 850 |
}{% |
| 851 |
\expandafter\l@preto@macro@a\csname scr@dte@#1@init\endcsname |
| 852 |
}% |
| 853 |
} |
| 854 |
% \end{macrocode} |
| 855 |
% \end{command}^^A \TOCEntryStyleInitCode … \TOCEntryStyleStartInitCode |
| 856 |
% \begin{macro}{\@ExecuteTOCEntryStyleInitCode} |
| 857 |
% \changes{v3.20}{2015/12/04}{added} |
| 858 |
% Executes the init code of one style. The first argument is the name of the |
| 859 |
% style, the second the name of the ToC entry level, which will be used as |
| 860 |
% argument of the init code (see above). |
| 861 |
% \begin{macrocode} |
| 862 |
\newcommand*{\@ExecuteTOCEntryStyleInitCode}[2]{% |
| 863 |
\let\scr@dte@doopts\@empty |
| 864 |
% \end{macrocode} |
| 865 |
% \changes{v3.27}{2019/10/02}{init \cs{scr@dte@\meta{Stil}@init}} |
| 866 |
% Because the definition which options or which macros are needed for a style |
| 867 |
% takes place via the declaration of the options and this declaration does not |
| 868 |
% take place with the definition of the style but with the assignment of the |
| 869 |
% style to an entry, the do list of this information must also be deleted |
| 870 |
% here. Otherwise it would constantly grow over all entries of the same style |
| 871 |
% and thus contain various entries several times. Probably it would be better |
| 872 |
% to actually create a list per entry here instead of one per style, but |
| 873 |
% that's just not how it is. So the same list is always rebuilt here and must |
| 874 |
% therefore be reset at the beginning. |
| 875 |
% \begin{macrocode} |
| 876 |
\expandafter\let\csname scr@dte@#1@needs\endcsname\relax |
| 877 |
\scr@ifundefinedorrelax{scr@dte@#1@init}{}{% |
| 878 |
\def\DefineTOCEntryBooleanOption{\@DefineTOCEntryBooleanOption{#1}}% |
| 879 |
\def\DefineTOCEntryCommandOption{\@DefineTOCEntryCommandOption{#1}}% |
| 880 |
\def\DefineTOCEntryIfOption{\@DefineTOCEntryIfOption{#1}}% |
| 881 |
\def\DefineTOCEntryLengthOption{\@DefineTOCEntryLengthOption{#1}}% |
| 882 |
\def\DefineTOCEntryListOption{\@DefineTOCEntryListOption{#1}}% |
| 883 |
\def\DefineTOCEntryNumberOption{\@DefineTOCEntryNumberOption{#1}}% |
| 884 |
\def\DefineTOCEntryOption{\@DefineTOCEntryOption{#1}}% |
| 885 |
\def\AddToDeclareTOCEntryStylePreCheckNeeds{% |
| 886 |
\@AddToDeclareTOCEntryStylePreCheckNeeds{#1}}% |
| 887 |
\def\PreToDeclareTOCEntryStylePreCheckNeeds{% |
| 888 |
\@PreToDeclareTOCEntryStylePreCheckNeeds{#1}}% |
| 889 |
\def\TOCEntryStyleNeedsCommandByOption{% |
| 890 |
\@TOCEntryStyleNeedsCommandByOption{#1}}% |
| 891 |
\@nameuse{scr@dte@#1@init}{#2}% |
| 892 |
\let\TOCEntryStyleNeedsCommandByOption\relax |
| 893 |
\let\PreToDeclareTOCEntryStylePreCheckNeeds\relax |
| 894 |
\let\AddToDeclareTOCEntryStylePreCheckNeeds\relax |
| 895 |
\let\DefineTOCEntryOption\relax |
| 896 |
\let\DefineTOCEntryNumberOption\relax |
| 897 |
\let\DefineTOCEntryListOption\relax |
| 898 |
\let\DefineTOCEntryLengthOption\relax |
| 899 |
\let\DefineTOCEntryIfOption\relax |
| 900 |
\let\DefineTOCEntryCommandOption\relax |
| 901 |
\let\DefineTOCEntryBooleanOption\relax |
| 902 |
}% |
| 903 |
} |
| 904 |
%</body> |
| 905 |
% \end{macrocode} |
| 906 |
% \end{macro}^^A \@ExecuteTOCEntryStyleInitCode |
| 907 |
% |
| 908 |
% |
| 909 |
% \begin{command}{\DeclareTOCStyleEntry} |
| 910 |
% \changes{v3.20}{2015/11/13}{added} |
| 911 |
% \changes{v3.39}{2022/10/24}{error message about missing options improved} |
| 912 |
% \changes{v3.41}{2023/06/20}{usage of style definition files supported} |
| 913 |
% \changes{v3.46}{2025/07/17}{using \cs{NewDocumentCommand} for better |
| 914 |
% handling of optional argument} |
| 915 |
% This user command defines a new ToC entry command. It tests, if all needed |
| 916 |
% style macros are already defined. Otherwise an error will be shown and the |
| 917 |
% ToC entry command will not be defined. The arguments are: |
| 918 |
% \begin{description} |
| 919 |
% \item[\oarg{options}:] comma-separated list of options to specify the |
| 920 |
% entry; |
| 921 |
% \item[\marg{style}:] a string, that specifies the style of the ToC entry; |
| 922 |
% \item[\marg{level name}:] a string, that specifies the name of the |
| 923 |
% sectioning level (or float environment), related to the ToC entry; |
| 924 |
% \end{description} |
| 925 |
% The real macro to define a ToC entry command is |
| 926 |
% \cs{scr@dte@def@l@\meta{style}}. That needs exactly one argument, the |
| 927 |
% \meta{level name}. |
| 928 |
% \begin{macrocode} |
| 929 |
%<*body> |
| 930 |
\NewDocumentCommand{\DeclareTOCStyleEntry}{+omm}{% |
| 931 |
\scr@ifundefinedorrelax{scr@dte@def@l@#2}{% |
| 932 |
\IfFileExists{tocbasic-tocstyle-#2.def}{% |
| 933 |
\edef\reserved@a{% |
| 934 |
\unexpanded{% |
| 935 |
\makeatletter |
| 936 |
\input{tocbasic-tocstyle-#2.def}% |
| 937 |
\catcode`\@=}\the\catcode`\@\relax |
| 938 |
}\reserved@a |
| 939 |
}{}% |
| 940 |
}{}% |
| 941 |
\scr@ifundefinedorrelax{scr@dte@def@l@#2}{% |
| 942 |
\PackageError{tocbasic}{toc entry style `#2' undefined}{% |
| 943 |
Somebody told me to define toc entry `#3' with style `#2',\MessageBreak |
| 944 |
but I do not know style `#2'.\MessageBreak |
| 945 |
You should first define the style then define the entry.\MessageBreak |
| 946 |
If you'll continue, I'll ignore the command. This could result |
| 947 |
in\MessageBreak |
| 948 |
further error messages.% |
| 949 |
}% |
| 950 |
}{% |
| 951 |
\let\scr@dte@precheck\@gobble |
| 952 |
\def\scr@dte@current{#3}% |
| 953 |
\@ExecuteTOCEntryStyleInitCode{#2}{#3}% |
| 954 |
\IfValueT{#1}{% |
| 955 |
\FamilyBoolKey[.dte]{KOMAarg}{expandtopt}{scr@dte@expandtopt}% |
| 956 |
\scr@dte@expandtoptfalse |
| 957 |
\FamilyExecuteOptions[.dte]{KOMAarg}{#1}% |
| 958 |
\RelaxFamilyKey[.dte]{KOMAarg}{expandtopt}% |
| 959 |
}% |
| 960 |
\@RelaxTOCEntryOptions |
| 961 |
\let\scr@dte@doopts\relax |
| 962 |
\let\scr@dte@current\relax |
| 963 |
\scr@ifundefinedorrelax{#3tocdepth}{% |
| 964 |
\expandafter\let\csname #3tocdepth\expandafter\endcsname |
| 965 |
\csname #3numdepth\endcsname |
| 966 |
}{}% |
| 967 |
\scr@dte@precheck{#3}% |
| 968 |
\let\scr@dte@precheck\relax |
| 969 |
\begingroup |
| 970 |
\aftergroup\@tempswatrue |
| 971 |
\def\do##1##2##3##4{% |
| 972 |
\scr@ifundefinedorrelax{##1#3##2}{% |
| 973 |
\PackageError{tocbasic}{toc style `#2' needs ##4\MessageBreak |
| 974 |
of `#3'}{% |
| 975 |
Usually the ##4 is defined using option `##3'.\MessageBreak |
| 976 |
In some cases it may be set defining command |
| 977 |
`\expandafter\string\csname ##1#3##2\endcsname'.\MessageBreak |
| 978 |
If you'll continue, I'll ignore the command. This could result |
| 979 |
in\MessageBreak |
| 980 |
further error messages.% |
| 981 |
}% |
| 982 |
\aftergroup\@tempswafalse |
| 983 |
}{}% |
| 984 |
}% |
| 985 |
\do{}{tocdepth}{level}{toc style level}% |
| 986 |
\@nameuse{scr@dte@#2@needs}% |
| 987 |
\endgroup |
| 988 |
\if@tempswa |
| 989 |
\@nameuse{scr@dte@def@l@#2}{#3}% |
| 990 |
% \end{macrocode} |
| 991 |
% \changes{v3.27}{2019/10/02}{macro name prefix for style information changed} |
| 992 |
% Note: Before \KOMAScript~3.27 the style name of an entry was stored in |
| 993 |
% \cs{scr@dte@\meta{level name}@style}. But this war wrong, because the prefix |
| 994 |
% |scr@dte| is used for attributes of the style (while declaring an |
| 995 |
% entry), but the style is an attribute of the entry. So usage of the prefix |
| 996 |
% |scr@tso| would be much better. This means usage of |
| 997 |
% \cs{scr@dte@\meta{level name}@style} is deprecated and should be replaced by |
| 998 |
% \cs{scr@tso@\meta{level name}@style}. |
| 999 |
% \begin{macrocode} |
| 1000 |
\expandafter\edef\csname scr@dte@#3@style\endcsname{#2}% |
| 1001 |
\expandafter\edef\csname scr@tso@#3@style\endcsname{#2}% |
| 1002 |
% \end{macrocode} |
| 1003 |
% \changes{v3.21}{2016/06/09}{\cs{toclevel@\emph{level}} added for \pkg{hyperref}} |
| 1004 |
% At least \pkg{hyperref}, but several other packages too, depend on a |
| 1005 |
% \pkg{hyperref} compatible storage of the level number. So we define it here |
| 1006 |
% additionally. Unfortunately \pkg{hyperref} overwrites this definition, so we |
| 1007 |
% do so after loading the package and sometimes also at |\begin{document}|. |
| 1008 |
% \begin{macrocode} |
| 1009 |
\expandafter\let\csname toclevel@#3\expandafter\endcsname |
| 1010 |
\csname #3tocdepth\endcsname |
| 1011 |
\if@atdocument\else |
| 1012 |
\scr@ifundefinedorrelax{AfterPackage}{% |
| 1013 |
\AtBeginDocument |
| 1014 |
}{% |
| 1015 |
\AfterPackage*{hyperref}% |
| 1016 |
}% |
| 1017 |
{% |
| 1018 |
\expandafter\let\csname toclevel@#3\expandafter\endcsname |
| 1019 |
\csname #3tocdepth\endcsname |
| 1020 |
}% |
| 1021 |
\fi |
| 1022 |
\fi |
| 1023 |
}% |
| 1024 |
} |
| 1025 |
%</body> |
| 1026 |
% \end{macrocode} |
| 1027 |
% \end{command}^^A \DeclareTOCStyleEntry |
| 1028 |
% |
| 1029 |
% \begin{command}{\DeclareTOCStyleEntries} |
| 1030 |
% \changes{v3.26}{2018/08/27}{added} |
| 1031 |
% \changes{v3.46}{2025/07/17}{using \cs{NewDocumentCommand} for better |
| 1032 |
% handling of optional argument} |
| 1033 |
% Use \cs{DeclareTOCStyleEntry} to define a list of entries, all with the |
| 1034 |
% same options and style. |
| 1035 |
% \begin{macrocode} |
| 1036 |
%<*body> |
| 1037 |
\NewDocumentCommand{\DeclareTOCStyleEntries}{+omm}{% |
| 1038 |
\edef\reserved@a{#3}% |
| 1039 |
\@for \reserved@a:=\reserved@a \do {% |
| 1040 |
\scr@trim@spaces\reserved@a |
| 1041 |
\ifx\reserved@a\@empty\else |
| 1042 |
\IfValueTF{#1}{% |
| 1043 |
\edef\reserved@a{% |
| 1044 |
\unexpanded{\DeclareTOCStyleEntry[{#1}]{#2}}{\reserved@a}}% |
| 1045 |
}{% |
| 1046 |
\edef\reserved@a{% |
| 1047 |
\unexpanded{\DeclareTOCStyleEntry{#2}}{\reserved@a}}% |
| 1048 |
}% |
| 1049 |
\reserved@a |
| 1050 |
\fi |
| 1051 |
}% |
| 1052 |
} |
| 1053 |
%</body> |
| 1054 |
% \end{macrocode} |
| 1055 |
% \end{command}^^A \DeclareTOCStyleEntries |
| 1056 |
% |
| 1057 |
% \begin{command}{\DeclareTOCEntryStyle} |
| 1058 |
% \changes{v3.20}{2015/11/17}{added} |
| 1059 |
% \begin{macro}{\@DeclareTOCEntryStyle} |
| 1060 |
% \changes{v3.46}{2025/07/17}{removed} |
| 1061 |
% \end{macro} |
| 1062 |
% \changes{v3.20}{2015/11/17}{added} |
| 1063 |
% \changes{v3.41}{2023/06/20}{using \cs{TOCEntryStyleInitCode*} instead of |
| 1064 |
% \cs{TOCEntryStyleInitCode}} |
| 1065 |
% \changes{v3.46}{2025/07/17}{using \cs{NewDocumentCommand} to avoid |
| 1066 |
% auxiliary command} |
| 1067 |
% The user command is used to define a new style for ToC entries. The |
| 1068 |
% arguments are: |
| 1069 |
% \begin{description} |
| 1070 |
% \item[\marg{style}:] a string, that represents the name of the style; |
| 1071 |
% \item[\oarg{initialization code}:] code, e.g., to initialize the options, |
| 1072 |
% that will be used to define the ToC entry command (note: this code can be |
| 1073 |
% executed more than once); |
| 1074 |
% \item[\marg{code}:] code, that will be used to generate a ToC entry while |
| 1075 |
% loading the auxiliary file of the ToC; |
| 1076 |
% \end{description} |
| 1077 |
% Independent from the \meta{initialization code}, \opt{level} is always |
| 1078 |
% defined, because a numerical ToC level is always needed. |
| 1079 |
% \begin{macrocode} |
| 1080 |
%<*body> |
| 1081 |
\NewDocumentCommand{\DeclareTOCEntryStyle}{m+O{}+m}{% |
| 1082 |
\@namedef{scr@dte@def@l@#1}##1{% |
| 1083 |
\@namedef{l@##1}####1####2{% |
| 1084 |
\TOC@EntryStartHook{##1}% |
| 1085 |
#3% |
| 1086 |
\TOC@EntryEndHook{##1}% |
| 1087 |
}% |
| 1088 |
}% |
| 1089 |
\TOCEntryStyleInitCode*{#1}{% |
| 1090 |
\DefineTOCEntryNumberOption{level}{}{tocdepth}{toc entry level}% |
| 1091 |
#2% |
| 1092 |
}% |
| 1093 |
} |
| 1094 |
%</body> |
| 1095 |
% \end{macrocode} |
| 1096 |
% \end{command}^^A \DeclareTOCEntryStyle |
| 1097 |
% |
| 1098 |
% |
| 1099 |
% \begin{macro}{\TOC@EntryStartHook,\TOC@EntryEndHook} |
| 1100 |
% \changes{v3.20}{2016/01/12}{added} |
| 1101 |
% For every ToC entry, that has been defined by \KOMAScript{}, there is one |
| 1102 |
% \emph{hook}, that will be executed before the corresponding ToC entry, and |
| 1103 |
% another \emph{hook}, that will executed after the corresponding ToC entry. Inside |
| 1104 |
% the \emph{hook} commands \texttt{\#1} is the name of the ToC level. Generally |
| 1105 |
% the \emph{hook} commands should not do any output and should neither change |
| 1106 |
% \cs{lastpenalty} nor \len{lastskip}. The user is responsible for this! |
| 1107 |
% However, because this \emph{hook} is very dangerous, we only have two |
| 1108 |
% internal macros for it but no user command to add new commands to the |
| 1109 |
% hook. So it is a kind of last chance mechanism. |
| 1110 |
% \begin{macrocode} |
| 1111 |
%<*body> |
| 1112 |
\newcommand*{\TOC@EntryStartHook}[1]{} |
| 1113 |
\newcommand*{\TOC@EntryEndHook}[1]{} |
| 1114 |
%</body> |
| 1115 |
% \end{macrocode} |
| 1116 |
% \end{macro}^^A \TOC@EntryStartHook,\TOC@EntryEndHook |
| 1117 |
% |
| 1118 |
% |
| 1119 |
% \begin{command}{\CloneTOCEntryStyle} |
| 1120 |
% \changes{v3.20}{2015/11/25}{added} |
| 1121 |
% The user command clones the style from \texttt{\#1} to style |
| 1122 |
% \texttt{\#2}. After cloning you can change the new style. |
| 1123 |
% \begin{macrocode} |
| 1124 |
%<*body> |
| 1125 |
\newcommand*{\CloneTOCEntryStyle}[2]{% |
| 1126 |
% \end{macrocode} |
| 1127 |
% First of all copy the ToC entry command. |
| 1128 |
% \begin{macrocode} |
| 1129 |
\expandafter\let\csname scr@dte@def@l@#2\expandafter\endcsname |
| 1130 |
\csname scr@dte@def@l@#1\endcsname |
| 1131 |
% \end{macrocode} |
| 1132 |
% Then copy the \meta{initialization code}. |
| 1133 |
% \begin{macrocode} |
| 1134 |
\expandafter\let\csname scr@dte@#2@init\expandafter\endcsname |
| 1135 |
\csname scr@dte@#1@init\endcsname |
| 1136 |
} |
| 1137 |
%</body> |
| 1138 |
% \end{macrocode} |
| 1139 |
% \end{command} |
| 1140 |
% |
| 1141 |
% |
| 1142 |
% \begin{macro}{\@pnumwidth,\@tocrmarg,\@dotsep} |
| 1143 |
% \changes{v3.27}{2019/05/11}{moved from the classes to the package} |
| 1144 |
% \begin{description} |
| 1145 |
% \item[\cs{@pnumwidth}] is the space of the page number. |
| 1146 |
% \item[\cs{@tocrmarg}] is the right margin of entries with more than one |
| 1147 |
% line. Usually this should be larger than \cs{@pnumwidth}. |
| 1148 |
% \item[\cs{\@dotsep}] is the space between the dots of a dotted connecting line. |
| 1149 |
% \end{description} |
| 1150 |
% \begin{macrocode} |
| 1151 |
%<*body> |
| 1152 |
\providecommand*\@pnumwidth{1.55em} |
| 1153 |
\providecommand*\@tocrmarg {2.55em} |
| 1154 |
\providecommand*\@dotsep {4.5} |
| 1155 |
%</body> |
| 1156 |
% \end{macrocode} |
| 1157 |
% \end{macro} |
| 1158 |
% |
| 1159 |
% |
| 1160 |
% \subsection{Predefined ToC entry styles} |
| 1161 |
% |
| 1162 |
% You can read this code as examples for defining ToC entry styles using the |
| 1163 |
% commands from the previous sections. Some of them are very basic. Others are |
| 1164 |
% extensions of the basic styles. \file{scrdocstrip.tex} has to process this |
| 1165 |
% code several times to generate all the styles. |
| 1166 |
% |
| 1167 |
% \begin{macrocode} |
| 1168 |
%<*style> |
| 1169 |
% \end{macrocode} |
| 1170 |
% |
| 1171 |
% \begin{macro}{\scr@dte@def@l@gobble} |
| 1172 |
% \changes{v3.20}{2015/11/20}{ToC style \texttt{gobble} added} |
| 1173 |
% The simplest directory entry style is |gobble|. It takes the two arguments |
| 1174 |
% for the directory entry and the page number and simply ignores them, |
| 1175 |
% regardless of the entry level. Therefore, this style does not require any |
| 1176 |
% options or initialization. |
| 1177 |
% \begin{macrocode} |
| 1178 |
%<*gobble> |
| 1179 |
%%% (run: style,gobble) |
| 1180 |
\DeclareTOCEntryStyle{gobble}{}% |
| 1181 |
%</gobble> |
| 1182 |
% \end{macrocode} |
| 1183 |
% \end{macro}^^A \scr@dte@def@l@gobble |
| 1184 |
% |
| 1185 |
% \begin{macro}{\scr@dte@def@l@dottedtocline} |
| 1186 |
% \changes{v3.20}{2015/11/20}{ToC style \texttt{dottedtocline} added} |
| 1187 |
% The most simple real ToC entry style is |dottedtocline|. It used the |
| 1188 |
% \LaTeX{} kernel macro \cs{@dottedtocline}. You should not use this style for |
| 1189 |
% \KOMAScript. But it may be useful to be used with the standard |
| 1190 |
% classes. However, in my opinion style |tocline| would always be the better one. |
| 1191 |
% \begin{macro}{\scr@dte@def@l@undottedtocline} |
| 1192 |
% \changes{v3.20}{2015/11/20}{ToC style \texttt{undottedtocline} added} |
| 1193 |
% Style |undottedtocline| corresponds to the style, that is used for chapter |
| 1194 |
% entries of the standard class \cls*{book} or \cls*{report}. In opposite to |
| 1195 |
% that, it also supports an horizontal indent. So you can alternatively |
| 1196 |
% interpret it as a variant of |dottedtocline| without dots. |
| 1197 |
% \begin{macro}{\scr@dte@def@l@largetocline} |
| 1198 |
% \changes{v3.20}{2015/11/20}{ToC style \texttt{largetocline} added} |
| 1199 |
% Style |largetocline| corresponds to the style, that is used for part entries |
| 1200 |
% of the standard classes. Once again and in opposite to the original code of |
| 1201 |
% the standard classes, this style supports an entry indent. But an additional |
| 1202 |
% number width is not supported. Instead the entries will be printed hanging. |
| 1203 |
% \begin{macro}{\scr@dte@def@l@tocline} |
| 1204 |
% \changes{v3.20}{2015/11/22}{ToC style \texttt{tocline} added} |
| 1205 |
% |tocline| is a very flexible style. It is intended to be used for entries with |
| 1206 |
% one or more line. It is used for all the ToC entries of the \KOMAScript{} |
| 1207 |
% classes. The classes also clone this style several times. |
| 1208 |
% \begin{macro}{\scr@dte@def@l@toctext} |
| 1209 |
% \changes{3.27}{2019/07/08}{ToC style \texttt{toctext} added} |
| 1210 |
% So far all mentioned styles are intended to generate one paragraph per |
| 1211 |
% entry. Style |toctext| generated only one paragraph for all consecutive |
| 1212 |
% entries. So it prints \emph{text inside} a paragraph. |
| 1213 |
% \begin{macrocode} |
| 1214 |
%<*dottedtocline|undottedtocline|largetocline|tocline|toctext> |
| 1215 |
%<*dottedtocline> |
| 1216 |
%%% (run: style,dottedtocline) |
| 1217 |
\DeclareTOCEntryStyle{dottedtocline}[{% |
| 1218 |
%</dottedtocline> |
| 1219 |
%<*undottedtocline> |
| 1220 |
%%% (run: style,undottedtocline) |
| 1221 |
\DeclareTOCEntryStyle{undottedtocline}[{% |
| 1222 |
%</undottedtocline> |
| 1223 |
%<*largetocline> |
| 1224 |
%%% (run: style, largetocline) |
| 1225 |
\DeclareTOCEntryStyle{largetocline}[{% |
| 1226 |
%</largetocline> |
| 1227 |
%<*toctext> |
| 1228 |
%%% (run: style,toctext) |
| 1229 |
\DeclareTOCEntryStyle{toctext}[{% |
| 1230 |
%</toctext> |
| 1231 |
%<*tocline> |
| 1232 |
%%% (run: style,tocline) |
| 1233 |
\DeclareTOCEntryStyle{tocline}[{% |
| 1234 |
%</tocline> |
| 1235 |
% \end{macrocode} |
| 1236 |
% \changes{v3.46}{2025/08/13}{new option \opt{numberprefix}} |
| 1237 |
% \changes{v3.46}{2025/08/13}{new option \opt{numberpostfix}} |
| 1238 |
% \begin{macrocode} |
| 1239 |
%<*tocline> |
| 1240 |
\DefineTOCEntryCommandOption{numberprefix}% |
| 1241 |
{scr@tso@}{@numberprefix}{number prefix definition}% |
| 1242 |
\DefineTOCEntryCommandOption{numberpostfix}% |
| 1243 |
{scr@tso@}{@numberpostfix}{number postfix definition}% |
| 1244 |
%</tocline> |
| 1245 |
% \end{macrocode} |
| 1246 |
% \changes{v3.31}{2020/06/09}{style \texttt{toctext} also provides option |
| 1247 |
% \opt{beforeskip}} |
| 1248 |
% \begin{macrocode} |
| 1249 |
%<*tocline|toctext> |
| 1250 |
\DefineTOCEntryLengthOption{beforeskip}% |
| 1251 |
{scr@tso@}{@beforeskip}{vertical skip before the entry}% |
| 1252 |
%</tocline|toctext> |
| 1253 |
%<*tocline> |
| 1254 |
\DefineTOCEntryIfOption{breakafternumber}% |
| 1255 |
{scr@tso@}{@breakafternumber}{line break after number flag}% |
| 1256 |
\DefineTOCEntryIfOption{dynnumwidth}% |
| 1257 |
{scr@tso@}{@dynnumwidth}{dynamic number width flag}% |
| 1258 |
%</tocline> |
| 1259 |
% \end{macrocode} |
| 1260 |
% \changes{v3.31}{2020/06/08}{option for indent follows list} |
| 1261 |
% \changes{v3.49}{2025/10/07}{options \opt{indentfollows} and |
| 1262 |
% \opt{dynindent} also with style \texttt{toctext}} |
| 1263 |
% \begin{macrocode} |
| 1264 |
%<*tocline|toctext> |
| 1265 |
\DefineTOCEntryListOption{indentfollows}% |
| 1266 |
{scr@tso@}{@indentfollows}{list of levels that define the indent}% |
| 1267 |
\DefineTOCEntryIfOption{dynindent}% |
| 1268 |
{scr@tso@}{@dynindent}{dynamic indent width flag}% |
| 1269 |
\DefineTOCEntryCommandOption{entryformat}% |
| 1270 |
{scr@tso@}{@entryformat}[1]{entry format}% |
| 1271 |
\DefineTOCEntryCommandOption{entrynumberformat}% |
| 1272 |
{scr@tso@}{@numberformat}[1]{entry number format}% |
| 1273 |
%</tocline|toctext> |
| 1274 |
%<*tocline> |
| 1275 |
\DefineTOCEntryCommandOption{linefill}[\TOCLineLeaderFill]% |
| 1276 |
{scr@tso@}{@linefill}{filling between text and page number}% |
| 1277 |
%</tocline> |
| 1278 |
%<*toctext> |
| 1279 |
\DefineTOCEntryCommandOption{prepagenumber}% |
| 1280 |
{scr@tso@}{@prepagenumber}{separator between text and page number}% |
| 1281 |
%</toctext> |
| 1282 |
%<*tocline|toctext> |
| 1283 |
\DefineTOCEntryLengthOption{numsep}% |
| 1284 |
{scr@tso@}{@numsep}{entry number separation}% |
| 1285 |
%</tocline|toctext> |
| 1286 |
%<*tocline> |
| 1287 |
\DefineTOCEntryCommandOption{onstarthigherlevel}% |
| 1288 |
{scr@tso@}{@LastTOCLevelWasLower}{start higher level entry hook}% |
| 1289 |
\DefineTOCEntryCommandOption{onstartlowerlevel}% |
| 1290 |
{scr@tso@}{@LastTOCLevelWasHigher}{start lower level entry hook}% |
| 1291 |
\DefineTOCEntryCommandOption{onstartsamelevel}% |
| 1292 |
{scr@tso@}{@LastTOCLevelWasSame}{start same level entry hook}% |
| 1293 |
%</tocline> |
| 1294 |
%<*toctext> |
| 1295 |
\DefineTOCEntryCommandOption{onstartfirstentry}% |
| 1296 |
{scr@tso@}{@onstartfirstentry}{output at start of paragraph}% |
| 1297 |
\DefineTOCEntryCommandOption{onstartentry}% |
| 1298 |
{scr@tso@}{@onstartentry}{output at start of all entries but the first}% |
| 1299 |
\DefineTOCEntryCommandOption{onendlastentry}% |
| 1300 |
{scr@tso@}{@onendlastentry}{output at end of paragraph}% |
| 1301 |
\DefineTOCEntryCommandOption{afterpar}% |
| 1302 |
{scr@tso@}{@afterpar}{settings after end of paragraph}% |
| 1303 |
\DefineTOCEntryCommandOption{onendentry}% |
| 1304 |
{scr@tso@}{@onendentry}{output at end of all entries but the last}% |
| 1305 |
%</toctext> |
| 1306 |
%<*tocline> |
| 1307 |
\DefineTOCEntryCommandOption{pagenumberbox}% |
| 1308 |
{scr@tso@}{@pagenumberbox}[1]{page number box}% |
| 1309 |
%</tocline> |
| 1310 |
%<*tocline|toctext> |
| 1311 |
\DefineTOCEntryCommandOption{pagenumberformat}% |
| 1312 |
{scr@tso@}{@pagenumberformat}[1]{page number format}% |
| 1313 |
%</tocline|toctext> |
| 1314 |
% \end{macrocode} |
| 1315 |
% \changes{v3.27}{2019/05/24}{new option \opt{pagenumberwidth}} |
| 1316 |
% \changes{v3.27}{2019/05/24}{new option \opt{rightindent}} |
| 1317 |
% Die Optionen \opt{pagenumberwidth} und \opt{rightindent} ersetzen |
| 1318 |
% innerhalb des Stils |tocline| die Makros \cs{@pnumwidth} und |
| 1319 |
% \cs{@tocrmarg}. |
| 1320 |
% \begin{macrocode} |
| 1321 |
%<*tocline> |
| 1322 |
\DefineTOCEntryLengthOption{pagenumberwidth}% |
| 1323 |
{scr@tso@}{@pagenumberwidth}{width of page number box}% |
| 1324 |
%</tocline> |
| 1325 |
%<*tocline|toctext> |
| 1326 |
\DefineTOCEntryLengthOption{rightindent}% |
| 1327 |
{scr@tso@}{@rightindent}{entry's text right indent}% |
| 1328 |
%</tocline|toctext> |
| 1329 |
% \end{macrocode} |
| 1330 |
% \changes{v3.21}{2016/06/06}{new option \opt{raggedentrytext}} |
| 1331 |
% Unfortunately definition of option \opt{raggedentrytext} is somehow |
| 1332 |
% cumbersome, to be more or less compatible with former definition of |
| 1333 |
% \cs{raggedchapterentry}. |
| 1334 |
% \begin{macrocode} |
| 1335 |
%<*tocline> |
| 1336 |
\DefineTOCEntryOption{raggedentrytext}[true]{% |
| 1337 |
\FamilySetBool{KOMAarg}{raggedentrytext}{@tempswa}{##1}% |
| 1338 |
\ifx\FamilyKeyState\FamilyKeyStateProcessed |
| 1339 |
\if@tempswa |
| 1340 |
\expandafter\let\csname ragged\scr@dte@current entry\endcsname |
| 1341 |
\raggedright |
| 1342 |
\else |
| 1343 |
\expandafter\let\csname ragged\scr@dte@current entry\endcsname |
| 1344 |
\relax |
| 1345 |
\fi |
| 1346 |
\fi |
| 1347 |
}% |
| 1348 |
\DefineTOCEntryIfOption{raggedpagenumber}% |
| 1349 |
{scr@tso@}{@raggedpage}{page number ragged flag}% |
| 1350 |
%</tocline> |
| 1351 |
%<*toctext> |
| 1352 |
\DefineTOCEntryIfOption{raggedright}% |
| 1353 |
{scr@tso@}{@raggedright}{use raggedright for the whole paragraph}% |
| 1354 |
%</toctext> |
| 1355 |
\DefineTOCEntryLengthOption{indent}% |
| 1356 |
{scr@tso@}{@indent}{entry indent}% |
| 1357 |
%<*dottedtocline|undottedtocline|tocline> |
| 1358 |
\DefineTOCEntryLengthOption{numwidth}% |
| 1359 |
{scr@tso@}{@numwidth}{entry number width}% |
| 1360 |
%</dottedtocline|undottedtocline|tocline> |
| 1361 |
% \end{macrocode} |
| 1362 |
% \changes{v3.46}{2025/08/13}{new default for option \opt{numberprefix}} |
| 1363 |
% \changes{v3.46}{2025/08/13}{new default for option \opt{numberpostfix}} |
| 1364 |
% \begin{macrocode} |
| 1365 |
%<*tocline> |
| 1366 |
\ExpandArgs{c}\providecommand{scr@tso@#1@numberprefix}{}% |
| 1367 |
\ExpandArgs{c}\providecommand{scr@tso@#1@numberpostfix}{}% |
| 1368 |
%</tocline> |
| 1369 |
% \end{macrocode} |
| 1370 |
% Automatic setting of the numerical level of option \opt{level} resp. command |
| 1371 |
% \cs{\meta{entry name}tocdepth} can be done either by increasing the parent |
| 1372 |
% level number of a sub level, if the parent level has already be defined: |
| 1373 |
% \changes{v3.21}{2016/06/09}{\cs{the} inserted} |
| 1374 |
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}} |
| 1375 |
% \begin{macrocode} |
| 1376 |
%<*tocline|toctext> |
| 1377 |
\scr@ifundefinedorrelax{#1tocdepth}{% |
| 1378 |
\Ifstrstart{#1}{sub}{% |
| 1379 |
\scr@ifundefinedorrelax{\scr@dte@nosub{#1}tocdepth}{}{% |
| 1380 |
\expandafter\edef\csname #1tocdepth\endcsname{% |
| 1381 |
\the\numexpr \noexpand\@nameuse{\scr@dte@nosub{#1}tocdepth}+\@ne\relax |
| 1382 |
}% |
| 1383 |
}% |
| 1384 |
}{}% |
| 1385 |
}{}% |
| 1386 |
%</tocline|toctext> |
| 1387 |
% \end{macrocode} |
| 1388 |
% or, if this cannot be used, by using a standard value analogues to the |
| 1389 |
% values of the standard classes and the \KOMAScript{} classes. |
| 1390 |
% \changes{v3.39}{2022/10/24}{default level for \texttt{lstlisting} added} |
| 1391 |
% \begin{macrocode} |
| 1392 |
\@ifundefined{#1tocdepth}{% |
| 1393 |
\Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{% |
| 1394 |
\Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{% |
| 1395 |
\Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{% |
| 1396 |
\Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{% |
| 1397 |
\Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{% |
| 1398 |
\Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{% |
| 1399 |
\Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{% |
| 1400 |
\Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{% |
| 1401 |
\Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{% |
| 1402 |
\Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{% |
| 1403 |
% \end{macrocode} |
| 1404 |
% As last chance, we can use the same number already used for a headings level |
| 1405 |
% with the same name. |
| 1406 |
% \begin{macrocode} |
| 1407 |
\expandafter\let\csname #1tocdepth\expandafter\endcsname |
| 1408 |
\csname #1numdepth\endcsname |
| 1409 |
}% |
| 1410 |
}% |
| 1411 |
}% |
| 1412 |
}% |
| 1413 |
}% |
| 1414 |
}% |
| 1415 |
}% |
| 1416 |
}% |
| 1417 |
}% |
| 1418 |
}% |
| 1419 |
}{}% |
| 1420 |
% \end{macrocode} |
| 1421 |
% \changes{v3.39}{2022/10/24}{try also using \cs{toclevel@\meta{level name}} as |
| 1422 |
% default level} |
| 1423 |
% Last but not least, if \cs{tocdepth@\meta{level name}} has been defined, we |
| 1424 |
% can use this one. |
| 1425 |
% \begin{macrocode} |
| 1426 |
\@ifundefined{#1tocdepth}{% |
| 1427 |
\expandafter\let\csname #1tocdepth\expandafter\endcsname |
| 1428 |
\csname toclevel@#1\endcsname |
| 1429 |
}{}% |
| 1430 |
% \end{macrocode} |
| 1431 |
% The indent can also be defined automatically by a parent level. |
| 1432 |
% \begin{macrocode} |
| 1433 |
%<*tocline|toctext> |
| 1434 |
\scr@ifundefinedorrelax{scr@tso@#1@indent}{% |
| 1435 |
\@ifundefined{scr@#1@tocindent}{% |
| 1436 |
\Ifstrstart{#1}{sub}{% |
| 1437 |
\scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@indent}{% |
| 1438 |
\scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{% |
| 1439 |
\expandafter\edef\csname scr@tso@#1@indent\endcsname{% |
| 1440 |
\glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}% |
| 1441 |
\relax |
| 1442 |
}% |
| 1443 |
}% |
| 1444 |
}{% |
| 1445 |
\scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{% |
| 1446 |
\expandafter\edef\csname scr@tso@#1@indent\endcsname{% |
| 1447 |
\glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}% |
| 1448 |
\relax |
| 1449 |
}% |
| 1450 |
}{% |
| 1451 |
\expandafter\edef\csname scr@tso@#1@indent\endcsname{% |
| 1452 |
\glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}% |
| 1453 |
+\noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}% |
| 1454 |
\relax |
| 1455 |
}% |
| 1456 |
}% |
| 1457 |
}% |
| 1458 |
}{}% |
| 1459 |
}{% |
| 1460 |
% \end{macrocode} |
| 1461 |
% Former \KOMAScript{} versions use another macro name, that is also defined |
| 1462 |
% for compatibility. |
| 1463 |
% \begin{macrocode} |
| 1464 |
\@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}% |
| 1465 |
}% |
| 1466 |
}{}% |
| 1467 |
%</tocline|toctext> |
| 1468 |
% \end{macrocode} |
| 1469 |
% The width of the page number box and the right margin can simply be copied |
| 1470 |
% from a parent level. |
| 1471 |
% \begin{macrocode} |
| 1472 |
%<*tocline> |
| 1473 |
\scr@ifundefinedorrelax{scr@tso@#1@pagenumberwidth}{% |
| 1474 |
\Ifstrstart{#1}{sub}{% |
| 1475 |
\scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@pagenumberwidth}{% |
| 1476 |
\@namedef{scr@tso@#1@pagenumberwidth}{\@pnumwidth}% |
| 1477 |
}{% |
| 1478 |
\expandafter\let |
| 1479 |
\csname scr@tso@#1@pagenumberwidth\expandafter\endcsname |
| 1480 |
\csname scr@tso@\scr@dte@nosub{#1}@pagenumberwidth\endcsname |
| 1481 |
}% |
| 1482 |
}{% |
| 1483 |
\@namedef{scr@tso@#1@pagenumberwidth}{\@pnumwidth}% |
| 1484 |
}% |
| 1485 |
}{}% |
| 1486 |
%</tocline> |
| 1487 |
%<*tocline|toctext> |
| 1488 |
\scr@ifundefinedorrelax{scr@tso@#1@rightindent}{% |
| 1489 |
\Ifstrstart{#1}{sub}{% |
| 1490 |
\scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@rightindent}{% |
| 1491 |
\@namedef{scr@tso@#1@rightindent}{\@tocrmarg}% |
| 1492 |
}{% |
| 1493 |
\expandafter\let |
| 1494 |
\csname scr@tso@#1@rightindent\expandafter\endcsname |
| 1495 |
\csname scr@tso@\scr@dte@nosub{#1}@rightindent\endcsname |
| 1496 |
}% |
| 1497 |
}{% |
| 1498 |
\@namedef{scr@tso@#1@rightindent}{\@tocrmarg}% |
| 1499 |
}% |
| 1500 |
}{}% |
| 1501 |
%</tocline|toctext> |
| 1502 |
% \end{macrocode} |
| 1503 |
% If all the automatic setting methods were not successful, we try standard |
| 1504 |
% values used from the standard classes or older versions of the \KOMAScript{} |
| 1505 |
% classes. |
| 1506 |
% \changes{v3.39}{2022/10/24}{default indent for \texttt{lstlisting} added} |
| 1507 |
% \begin{macrocode} |
| 1508 |
\@ifundefined{scr@tso@#1@indent}{% |
| 1509 |
%<*dottedtocline|undottedtocline|largetocline> |
| 1510 |
\@ifundefined{scr@#1@tocindent}{% |
| 1511 |
%</dottedtocline|undottedtocline|largetocline> |
| 1512 |
\Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{% |
| 1513 |
\Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{% |
| 1514 |
\Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{% |
| 1515 |
\Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{% |
| 1516 |
\Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{% |
| 1517 |
% \end{macrocode} |
| 1518 |
% The follow code needs information about the existence of the chapter |
| 1519 |
% level. So the chapter level should already be defined, before the first |
| 1520 |
% usage! |
| 1521 |
% \begin{macrocode} |
| 1522 |
\scr@ifundefinedorrelax{l@chapter}{% |
| 1523 |
\Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{% |
| 1524 |
\Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{% |
| 1525 |
\Ifstr{#1}{subsubsection}{% |
| 1526 |
\@namedef{scr@tso@#1@indent}{3.8em}% |
| 1527 |
}{% |
| 1528 |
\Ifstr{#1}{paragraph}{% |
| 1529 |
\@namedef{scr@tso@#1@indent}{7em}% |
| 1530 |
}{% |
| 1531 |
\Ifstr{#1}{subparagraph}{% |
| 1532 |
\@namedef{scr@tso@#1@indent}{10em}% |
| 1533 |
}{% |
| 1534 |
% \end{macrocode} |
| 1535 |
% If nothing helps, the user has to define the values. |
| 1536 |
% \begin{macrocode} |
| 1537 |
}% |
| 1538 |
}% |
| 1539 |
}% |
| 1540 |
}% |
| 1541 |
}% |
| 1542 |
}{% |
| 1543 |
\Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{% |
| 1544 |
\Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{% |
| 1545 |
\Ifstr{#1}{subsubsection}{% |
| 1546 |
\@namedef{scr@tso@#1@indent}{7.0em}% |
| 1547 |
}{% |
| 1548 |
\Ifstr{#1}{paragraph}{% |
| 1549 |
\@namedef{scr@tso@#1@indent}{10em}% |
| 1550 |
}{% |
| 1551 |
\Ifstr{#1}{subparagraph}{% |
| 1552 |
\@namedef{scr@tso@#1@indent}{12em}% |
| 1553 |
}{% |
| 1554 |
% \end{macrocode} |
| 1555 |
% Once more: if nothing helps, the user has to define the values. |
| 1556 |
% \begin{macrocode} |
| 1557 |
}% |
| 1558 |
}% |
| 1559 |
}% |
| 1560 |
}% |
| 1561 |
}% |
| 1562 |
}% |
| 1563 |
}% |
| 1564 |
}% |
| 1565 |
}% |
| 1566 |
}% |
| 1567 |
}% |
| 1568 |
%<*dottedtocline|undottedtocline|largetocline> |
| 1569 |
}{% |
| 1570 |
% \end{macrocode} |
| 1571 |
% Once again, for compatibility with former versions of \KOMAScript: |
| 1572 |
% \begin{macrocode} |
| 1573 |
\@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}% |
| 1574 |
}% |
| 1575 |
%</dottedtocline|undottedtocline|largetocline> |
| 1576 |
}{}% |
| 1577 |
% \end{macrocode} |
| 1578 |
% Almost the same for the number width: |
| 1579 |
% \changes{v3.39}{2022/10/24}{default number width for \texttt{lstlisting} added} |
| 1580 |
% \begin{macrocode} |
| 1581 |
%<*dottedtocline|undottedtocline|tocline> |
| 1582 |
%<*tocline> |
| 1583 |
\scr@ifundefinedorrelax{scr@tso@#1@numwidth}{% |
| 1584 |
\scr@ifundefinedorrelax{scr@#1@tocnumwidth}{% |
| 1585 |
\Ifstrstart{#1}{sub}{% |
| 1586 |
\scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{% |
| 1587 |
\expandafter\edef\csname scr@tso@#1@numwidth\endcsname{% |
| 1588 |
\glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}% |
| 1589 |
+.9em% |
| 1590 |
\relax |
| 1591 |
}% |
| 1592 |
}% |
| 1593 |
}{}% |
| 1594 |
}{% |
| 1595 |
\@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}% |
| 1596 |
}% |
| 1597 |
}{}% |
| 1598 |
%</tocline> |
| 1599 |
\@ifundefined{scr@tso@#1@numwidth}{% |
| 1600 |
%<*dottedtocline|undottedtocline> |
| 1601 |
\@ifundefined{scr@#1@tocnumwidth}{% |
| 1602 |
%</dottedtocline|undottedtocline> |
| 1603 |
\Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{% |
| 1604 |
\Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{% |
| 1605 |
\Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{% |
| 1606 |
\Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{% |
| 1607 |
% \end{macrocode} |
| 1608 |
% Depending on existence of the chapter level: |
| 1609 |
% \begin{macrocode} |
| 1610 |
\scr@ifundefinedorrelax{chapter}{% |
| 1611 |
\Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{% |
| 1612 |
\Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{% |
| 1613 |
\Ifstr{#1}{subsubsection}{% |
| 1614 |
\@namedef{scr@tso@#1@numwidth}{3.2em}% |
| 1615 |
}{% |
| 1616 |
\Ifstr{#1}{paragraph}{% |
| 1617 |
\@namedef{scr@tso@#1@numwidth}{4.1em}% |
| 1618 |
}{% |
| 1619 |
\Ifstr{#1}{subparagraph}{% |
| 1620 |
\@namedef{scr@tso@#1@numwidth}{5m}% |
| 1621 |
}{% |
| 1622 |
% \end{macrocode} |
| 1623 |
% Need option to be set. |
| 1624 |
% \begin{macrocode} |
| 1625 |
}% |
| 1626 |
}% |
| 1627 |
}% |
| 1628 |
}% |
| 1629 |
}% |
| 1630 |
}{% |
| 1631 |
\Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{% |
| 1632 |
\Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{% |
| 1633 |
\Ifstr{#1}{subsubsection}{% |
| 1634 |
\@namedef{scr@tso@#1@numwidth}{3.1em}% |
| 1635 |
}{% |
| 1636 |
\Ifstr{#1}{paragraph}{% |
| 1637 |
\@namedef{scr@tso@#1@numwidth}{5em}% |
| 1638 |
}{% |
| 1639 |
\Ifstr{#1}{subparagraph}{% |
| 1640 |
\@namedef{scr@tso@#1@numwidth}{6em}% |
| 1641 |
}{% |
| 1642 |
% \end{macrocode} |
| 1643 |
% Need option to be set. |
| 1644 |
% \begin{macrocode} |
| 1645 |
}% |
| 1646 |
}% |
| 1647 |
}% |
| 1648 |
}% |
| 1649 |
}% |
| 1650 |
}% |
| 1651 |
}% |
| 1652 |
}% |
| 1653 |
}% |
| 1654 |
}% |
| 1655 |
%<*dottedtocline|undottedtocline> |
| 1656 |
}{% |
| 1657 |
% \end{macrocode} |
| 1658 |
% Compatibility with old \KOMAScript{} versions. |
| 1659 |
% \begin{macrocode} |
| 1660 |
\@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}% |
| 1661 |
}% |
| 1662 |
%</dottedtocline|undottedtocline> |
| 1663 |
}{}% |
| 1664 |
%</dottedtocline|undottedtocline|tocline> |
| 1665 |
%<*tocline> |
| 1666 |
% \end{macrocode} |
| 1667 |
% The three penalty hooks. Here simply the default commands are used by |
| 1668 |
% default. |
| 1669 |
% \begin{macrocode} |
| 1670 |
\expandafter\providecommand% |
| 1671 |
\csname scr@tso@#1@LastTOCLevelWasLower\endcsname{\LastTOCLevelWasLower}% |
| 1672 |
\expandafter\providecommand% |
| 1673 |
\csname scr@tso@#1@LastTOCLevelWasSame\endcsname{\LastTOCLevelWasSame}% |
| 1674 |
\expandafter\providecommand% |
| 1675 |
\csname scr@tso@#1@LastTOCLevelWasHigher\endcsname{\LastTOCLevelWasHigher}% |
| 1676 |
% \end{macrocode} |
| 1677 |
% The default of the vertical distance of entries is 0 plus some glue. But |
| 1678 |
% this is enough only for at least one line, if needed for vertical |
| 1679 |
% justification. For the higher levels (part and chapter resp. section) the |
| 1680 |
% defaults of the standard classes are used. These have some more glue. |
| 1681 |
% \begin{macrocode} |
| 1682 |
\@ifundefined{scr@tso@#1@beforeskip}{% |
| 1683 |
\Ifstr{#1}{part}{% |
| 1684 |
\@namedef{scr@tso@#1@beforeskip}{\glueexpr 2.25em \@plus\p@\relax}% |
| 1685 |
}{% |
| 1686 |
\Ifstr{#1}{chapter}{% |
| 1687 |
\@namedef{scr@tso@#1@beforeskip}{\glueexpr 1.0em \@plus\p@\relax}% |
| 1688 |
}{% |
| 1689 |
\Ifstr{#1}{section}{% |
| 1690 |
\scr@ifundefinedorrelax{l@chapter}{% |
| 1691 |
\@namedef{scr@tso@#1@beforeskip}{\glueexpr 1.0em \@plus\p@\relax}% |
| 1692 |
}{}% |
| 1693 |
}{}% |
| 1694 |
}% |
| 1695 |
}% |
| 1696 |
\expandafter\providecommand\expandafter*% |
| 1697 |
\csname scr@tso@#1@beforeskip\endcsname{\glueexpr \z@ plus .2\p@\relax}% |
| 1698 |
}{}% |
| 1699 |
%</tocline> |
| 1700 |
% \end{macrocode} |
| 1701 |
% \changes{v3.31}{2020/06/09}{\opt{beforeskip} default also for style \texttt{toctext}} |
| 1702 |
% For style |toctext| a default without glue is used to stay compatible. |
| 1703 |
% \begin{macrocode} |
| 1704 |
%<*toctext> |
| 1705 |
\expandafter\providecommand\expandafter*% |
| 1706 |
\csname scr@tso@#1@beforeskip\endcsname{\z@}% |
| 1707 |
%</toctext> |
| 1708 |
%<*tocline> |
| 1709 |
% \end{macrocode} |
| 1710 |
% It would be good to know the width of the widest number. We will use this to |
| 1711 |
% test several conditions. |
| 1712 |
% \begin{macrocode} |
| 1713 |
\@ifundefined{scr@dte@#1@maxnumwidth}{% |
| 1714 |
\expandafter\newlength\csname scr@dte@#1@maxnumwidth\endcsname |
| 1715 |
\setlength{\@nameuse{scr@dte@#1@maxnumwidth}}{\z@}% |
| 1716 |
}{}% |
| 1717 |
\providecommand*{\scr@dte@donumwidth}{}% |
| 1718 |
\g@addto@macro{\scr@dte@donumwidth}{\do{#1}}% |
| 1719 |
%</tocline> |
| 1720 |
% \end{macrocode} |
| 1721 |
% One condition is a minimum distance between number and text. |
| 1722 |
% \begin{macrocode} |
| 1723 |
%<*tocline|toctext> |
| 1724 |
\expandafter\providecommand\expandafter*% |
| 1725 |
\csname scr@tso@#1@numsep\endcsname{.4em}% |
| 1726 |
%</tocline|toctext> |
| 1727 |
% \end{macrocode} |
| 1728 |
% The |toctext| style support the output of some text before the first entry |
| 1729 |
% of a paragraph, between the entries and after the last entry of a paragraph. |
| 1730 |
% \begin{macrocode} |
| 1731 |
%<*toctext> |
| 1732 |
\expandafter\providecommand% |
| 1733 |
\csname scr@tso@#1@onstartfirstentry\endcsname{}% |
| 1734 |
\expandafter\providecommand% |
| 1735 |
\csname scr@tso@#1@onstartentry\endcsname{}% |
| 1736 |
\expandafter\providecommand% |
| 1737 |
\csname scr@tso@#1@onendlastentry\endcsname{}% |
| 1738 |
\expandafter\providecommand% |
| 1739 |
\csname scr@tso@#1@onendentry\endcsname{\quad}% |
| 1740 |
\expandafter\providecommand% |
| 1741 |
\csname scr@tso@#1@afterpar\endcsname{}% |
| 1742 |
%</toctext> |
| 1743 |
% \end{macrocode} |
| 1744 |
% Formatting for only the number and formatting for number and text are |
| 1745 |
% provided. For part we use the formatting of the standard classes as default. |
| 1746 |
% \begin{macrocode} |
| 1747 |
%<*tocline|toctext> |
| 1748 |
\expandafter\providecommand% |
| 1749 |
\csname scr@tso@#1@numberformat\endcsname[1]{##1}% |
| 1750 |
%<*tocline> |
| 1751 |
\Ifstr{#1}{part}{% |
| 1752 |
\expandafter\providecommand% |
| 1753 |
\csname scr@tso@#1@entryformat\endcsname[1]{\large\bfseries ##1}% |
| 1754 |
}{% |
| 1755 |
\Ifstr{#1}{chapter}{% |
| 1756 |
\expandafter\providecommand% |
| 1757 |
\csname scr@tso@#1@entryformat\endcsname[1]{\bfseries ##1}% |
| 1758 |
}{% |
| 1759 |
\scr@ifundefinedorrelax{l@chapter}{% |
| 1760 |
\Ifstr{#1}{section}{% |
| 1761 |
\expandafter\providecommand% |
| 1762 |
\csname scr@tso@#1@entryformat\endcsname[1]{\bfseries ##1}% |
| 1763 |
}{}% |
| 1764 |
}{}% |
| 1765 |
%</tocline> |
| 1766 |
\expandafter\providecommand% |
| 1767 |
\csname scr@tso@#1@entryformat\endcsname[1]{##1}% |
| 1768 |
%<*tocline> |
| 1769 |
}% |
| 1770 |
}% |
| 1771 |
%</tocline> |
| 1772 |
%</tocline|toctext> |
| 1773 |
% \end{macrocode} |
| 1774 |
% After the number a line break is optional. In this case the text starts |
| 1775 |
% again at the horizontal position of the number and not behind it. The |
| 1776 |
% default is, not to break after the number. |
| 1777 |
% \begin{macrocode} |
| 1778 |
%<*tocline> |
| 1779 |
\expandafter\providecommand |
| 1780 |
\csname Ifscr@tso@#1@breakafternumber\endcsname[2]{##2}% |
| 1781 |
% \end{macrocode} |
| 1782 |
% The default of the connection between the end of the text and the page |
| 1783 |
% number column is a simple \cs{hfill}. Here you can optionally use dots as usual. |
| 1784 |
% \begin{macrocode} |
| 1785 |
\@ifundefined{scr@tso@#1@linefill}{% |
| 1786 |
\Ifstr{#1}{part}{% |
| 1787 |
\@namedef{scr@tso@#1@linefill}{\hfill}% |
| 1788 |
}{% |
| 1789 |
\Ifstr{#1}{chapter}{% |
| 1790 |
\@namedef{scr@tso@#1@linefill}{\hfill}% |
| 1791 |
}{% |
| 1792 |
\scr@ifundefinedorrelax{l@chapter}{% |
| 1793 |
\Ifstr{#1}{section}{% |
| 1794 |
\@namedef{scr@tso@#1@linefill}{\hfill}% |
| 1795 |
}{}% |
| 1796 |
}{}% |
| 1797 |
\expandafter\providecommand% |
| 1798 |
\csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}% |
| 1799 |
}% |
| 1800 |
}% |
| 1801 |
}{}% |
| 1802 |
% \end{macrocode} |
| 1803 |
% If you don't want a connection, this does not automatically mean, that the |
| 1804 |
% page number moves forwards to the end of the text. This only happens, if the |
| 1805 |
% entry is set ragged. |
| 1806 |
% \begin{macrocode} |
| 1807 |
\expandafter\providecommand\csname Ifscr@tso@#1@raggedpage\endcsname[2]{##2}% |
| 1808 |
% \end{macrocode} |
| 1809 |
% Optionally you can use a formatting for the page number. |
| 1810 |
% \begin{macrocode} |
| 1811 |
\Ifstr{#1}{part}{% |
| 1812 |
% \end{macrocode} |
| 1813 |
% With parts this is usually large and bold. |
| 1814 |
% \begin{macrocode} |
| 1815 |
\expandafter\providecommand% |
| 1816 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{\large\bfseries ##1}% |
| 1817 |
}{% |
| 1818 |
% \end{macrocode} |
| 1819 |
% \changes{v3.25}{2017/11/23}{default of page numbers of chapter entries is bold} |
| 1820 |
% With chapters it is bold. |
| 1821 |
% \begin{macrocode} |
| 1822 |
\Ifstr{#1}{chapter}{% |
| 1823 |
\expandafter\providecommand% |
| 1824 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{\bfseries ##1}% |
| 1825 |
}{% |
| 1826 |
\scr@ifundefinedorrelax{l@chapter}{% |
| 1827 |
\Ifstr{#1}{section}{% |
| 1828 |
% \end{macrocode} |
| 1829 |
% \changes{v3.25}{2017/11/23}{default of page numbers of section entries maybe |
| 1830 |
% bold} |
| 1831 |
% With sections sometimes bold. |
| 1832 |
% \begin{macrocode} |
| 1833 |
\expandafter\providecommand% |
| 1834 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{\bfseries ##1}% |
| 1835 |
}{}% |
| 1836 |
}{}% |
| 1837 |
% \end{macrocode} |
| 1838 |
% All others in normal font and normal color. |
| 1839 |
% \begin{macrocode} |
| 1840 |
\expandafter\providecommand% |
| 1841 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{% |
| 1842 |
\normalfont\normalcolor ##1}% |
| 1843 |
}% |
| 1844 |
}% |
| 1845 |
% \end{macrocode} |
| 1846 |
% Sometimes the page number has a box with defined width. |
| 1847 |
% \changes{v3.27}{2019/10/02}{consequent use of width of page number box} |
| 1848 |
% \begin{macrocode} |
| 1849 |
\expandafter\providecommand% |
| 1850 |
\csname scr@tso@#1@pagenumberbox\endcsname[1]{% |
| 1851 |
\hb@xt@\@nameuse{scr@dte@pagenumberwidth}{\hfil ##1}}% |
| 1852 |
\expandafter\providecommand\csname |
| 1853 |
Ifscr@tso@#1@dynnumwidth\endcsname[2]{##2}% |
| 1854 |
%</tocline> |
| 1855 |
% \end{macrocode} |
| 1856 |
% \changes{v3.31}{2020/06/08}{init indent follows list} |
| 1857 |
% \changes{v3.49}{2025/10/07}{init \opt{dynindent} and \opt{indentfollows} |
| 1858 |
% also with style \texttt{toctext}} |
| 1859 |
% This command defines a list of levels that specify the indent (if not |
| 1860 |
% empty). |
| 1861 |
% \begin{macrocode} |
| 1862 |
%<*tocline|toctext> |
| 1863 |
\expandafter\providecommand\csname Ifscr@tso@#1@dynindent\endcsname[2]{##2}% |
| 1864 |
\scr@ifundefinedorrelax{scr@tso@#1@indentfollows}{% |
| 1865 |
\Ifstrstart{#1}{sub}{% |
| 1866 |
\expandafter\edef\csname scr@tso@#1@indentfollows\endcsname{% |
| 1867 |
\scr@dte@nosub{#1}% |
| 1868 |
}% |
| 1869 |
}{% |
| 1870 |
\expandafter\let\csname scr@tso@#1@indentfollows\endcsname\@empty |
| 1871 |
}% |
| 1872 |
}{}% |
| 1873 |
%</tocline|toctext> |
| 1874 |
% \end{macrocode} |
| 1875 |
% \changes{v3.27}{2019/07/08}{initialization of \opt{raggedentry}} |
| 1876 |
% \changes{v3.27}{2019/07/08}{initialization of \opt{prepagenumber}} |
| 1877 |
% \changes{v3.46}{2025/06/26}{initialization of \opt{pagenumberformat}} |
| 1878 |
% With style |toctext| we have to initialize ragged or justified text and what |
| 1879 |
% to print immediately before the page number (\opt{linefill} wouldn't have |
| 1880 |
% been a suitable term). |
| 1881 |
% \begin{macrocode} |
| 1882 |
%<*toctext> |
| 1883 |
\expandafter\providecommand% |
| 1884 |
\csname Ifscr@tso@#1@raggedright\endcsname[2]{##2}% |
| 1885 |
\expandafter\providecommand% |
| 1886 |
\csname scr@tso@#1@prepagenumber\endcsname{\nobreakspace}% |
| 1887 |
\expandafter\providecommand% |
| 1888 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{##1}% |
| 1889 |
%</toctext> |
| 1890 |
}]{% |
| 1891 |
% \end{macrocode} |
| 1892 |
% \changes{v3.27}{2019/05/12}{support for \opt{noindent}} |
| 1893 |
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by |
| 1894 |
% \cs{Iftocfeature}} |
| 1895 |
% Initialization complete. Next we have the output code or macro. |
| 1896 |
% \begin{macrocode} |
| 1897 |
%<*dottedtocline> |
| 1898 |
\Iftocfeature{\@currext}{noindent}{% |
| 1899 |
\@dottedtocline{\@nameuse{#1tocdepth}}{\z@}% |
| 1900 |
{\@nameuse{scr@tso@#1@numwidth}}{##1}{##2}% |
| 1901 |
}{% |
| 1902 |
\@dottedtocline{\@nameuse{#1tocdepth}}{\@nameuse{scr@tso@#1@indent}}% |
| 1903 |
{\@nameuse{scr@tso@#1@numwidth}}{##1}{##2}% |
| 1904 |
}% |
| 1905 |
%</dottedtocline> |
| 1906 |
%<*undottedtocline|largetocline> |
| 1907 |
\ifnum \c@tocdepth >\numexpr \@nameuse{#1tocdepth}-\@ne\relax |
| 1908 |
% \end{macrocode} |
| 1909 |
% Here we have a little difference between chapters and the sections of |
| 1910 |
% \cls*{article}. We do this by the level. So if you change the levels, the |
| 1911 |
% result would change too. |
| 1912 |
% \begin{macrocode} |
| 1913 |
\ifnum \@nameuse{#1tocdepth}<\@ne |
| 1914 |
\scr@ifundefinedorrelax{chapter}{% |
| 1915 |
\addpenalty\@secpenalty |
| 1916 |
%<undottedtocline> \addvspace{1.0em \@plus\p@}% |
| 1917 |
%<largetocline> \addvspace{2.25em \@plus\p@}% |
| 1918 |
}{% |
| 1919 |
\addpenalty{-\@highpenalty}% |
| 1920 |
%<undottedtocline> \vskip 1.0em \@plus\p@ |
| 1921 |
%<largetocline> \addvspace{2.25em \@plus\p@}% |
| 1922 |
}% |
| 1923 |
\else |
| 1924 |
\addpenalty\@secpenalty |
| 1925 |
%<undottedtocline> \addvspace{1.0em \@plus\p@}% |
| 1926 |
%<largetocline> \addvspace{2.25em \@plus\p@}% |
| 1927 |
\fi |
| 1928 |
%<undottedtocline> \setlength\@tempdima{\@nameuse{scr@tso@#1@numwidth}}% |
| 1929 |
%<largetocline> \setlength\@tempdima{3em}% |
| 1930 |
\begingroup |
| 1931 |
% \end{macrocode} |
| 1932 |
% Note: Here we should use two \cs{@tocrmarg} correctly. I've reported this |
| 1933 |
% bug in the standard classes years ago without any change. So for |
| 1934 |
% compatibility I've decided to accept it as feature and two times |
| 1935 |
% \cs{@pnumwith} like the standard classes. |
| 1936 |
% \begin{macrocode} |
| 1937 |
\parindent \z@ \rightskip \@pnumwidth |
| 1938 |
\parfillskip -\@pnumwidth |
| 1939 |
% \end{macrocode} |
| 1940 |
% The standard classes use a group at this point. This group ends before the |
| 1941 |
% final \cs{par}. This can result in wrong baseline skip for multi line |
| 1942 |
% entries. It was a hard decision, but I've decided to avoid this bug, because |
| 1943 |
% it was much too strange. Moreover, with the bug, the setting of |
| 1944 |
% \len{leftskip} would have to be changed, because here also the value at the |
| 1945 |
% end of the paragraph is used. |
| 1946 |
% \begin{macrocode} |
| 1947 |
\leavevmode |
| 1948 |
%<largetocline> \large |
| 1949 |
\bfseries |
| 1950 |
% \end{macrocode} |
| 1951 |
% Note, here we also should use \cs{@tempdima} with style |largetocline|. But |
| 1952 |
% we cannot do so, only because the standard classes do not use |
| 1953 |
% \cs{numberline} for parts. Because of this, multi line entries are not |
| 1954 |
% correctly indented. To do this same is also because of compatibility. |
| 1955 |
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by \cs{Iftocfeature}} |
| 1956 |
% \begin{macrocode} |
| 1957 |
%<undottedtocline> \advance\leftskip\@tempdima |
| 1958 |
\Iftocfeature{\@currext}{noindent}{% |
| 1959 |
%<undottedtocline> \hskip -\leftskip |
| 1960 |
}{% |
| 1961 |
\advance\leftskip\@nameuse{scr@tso@#1@indent}% |
| 1962 |
%<*undottedtocline> |
| 1963 |
\hskip -\dimexpr \leftskip-\@nameuse{scr@tso@#1@indent}\relax |
| 1964 |
%</undottedtocline> |
| 1965 |
}% |
| 1966 |
##1% |
| 1967 |
%<undottedtocline> \nobreak |
| 1968 |
% \end{macrocode} |
| 1969 |
% Here \cs{@pnumwidth} is not the same absolute value for entries with |
| 1970 |
% \cs{large} as for entries without \cs{large}. So correctly, e.g., the value |
| 1971 |
% should be transferred via \len{@temdimb}. But because of compatibility this |
| 1972 |
% bug hat also been interpreted as feature. |
| 1973 |
% \begin{macrocode} |
| 1974 |
\hfil \nobreak\hb@xt@\@pnumwidth{\hss ##2}% |
| 1975 |
\par |
| 1976 |
%<undottedtocline> \penalty\@highpenalty |
| 1977 |
%<*largetocline> |
| 1978 |
\nobreak |
| 1979 |
\ifnum 0= |
| 1980 |
\scr@ifundefinedorrelax{chapter}{\if@compatibility 1\else 0\fi}{1}\relax |
| 1981 |
\global\@nobreaktrue |
| 1982 |
\everypar{\global\@nobreakfalse\everypar{}}% |
| 1983 |
\fi |
| 1984 |
%</largetocline> |
| 1985 |
\endgroup |
| 1986 |
\fi |
| 1987 |
%</undottedtocline|largetocline> |
| 1988 |
%<*tocline> |
| 1989 |
\scr@dte@tocline{#1}{##1}{##2}% |
| 1990 |
%</tocline> |
| 1991 |
%<*toctext> |
| 1992 |
\scr@dte@toctext{#1}{##1}{##2}% |
| 1993 |
%</toctext> |
| 1994 |
} |
| 1995 |
%</dottedtocline|undottedtocline|largetocline|tocline|toctext> |
| 1996 |
% \end{macrocode} |
| 1997 |
% \end{macro}^^A \scr@dte@def@l@toctext |
| 1998 |
% \end{macro}^^A \scr@dte@def@l@tocline |
| 1999 |
% \end{macro}^^A \scr@dte@def@l@largetocline |
| 2000 |
% \end{macro}^^A \scr@dte@def@l@undottedtocline |
| 2001 |
% \end{macro}^^A \scr@dte@def@l@dottedtocline |
| 2002 |
% |
| 2003 |
% Style |tocline| needs several additional settings and macros: |
| 2004 |
% \begin{macrocode} |
| 2005 |
%<*tocline> |
| 2006 |
\AtBeginDocument{% |
| 2007 |
\BeforeClosingMainAux{% |
| 2008 |
\begingroup |
| 2009 |
\def\do#1{% |
| 2010 |
\relax |
| 2011 |
\scr@ifundefinedorrelax{scr@dte@#1@maxnumwidth}{}{% |
| 2012 |
\ifdim \@nameuse{scr@dte@#1@maxnumwidth}>\z@ |
| 2013 |
\if@filesw |
| 2014 |
\protected@write\@mainaux{}{% |
| 2015 |
\string\global\string\@namedef{scr@dte@#1@lastmaxnumwidth}% |
| 2016 |
{\the\@nameuse{scr@dte@#1@maxnumwidth}}% |
| 2017 |
}% |
| 2018 |
\fi |
| 2019 |
\@nameuse{scr@dte@#1@maxnumwidth}\z@ |
| 2020 |
\fi |
| 2021 |
}% |
| 2022 |
}% |
| 2023 |
\@nameuse{scr@dte@donumwidth}% |
| 2024 |
\endgroup |
| 2025 |
}% |
| 2026 |
} |
| 2027 |
% \end{macrocode} |
| 2028 |
% \begin{macro}{\scr@dte@nosub,\@scr@dte@nosub} |
| 2029 |
% \changes{v3.20}{2015/11/23}{added} |
| 2030 |
% These helper macros are used to recognize the |sub| prefix at the start of |
| 2031 |
% an argument and remove it. If there isn't a |sub| at the very beginning, we |
| 2032 |
% report an error, because of wrong usage of \cs{@scr@de@nusub}. |
| 2033 |
% \begin{macrocode} |
| 2034 |
\newcommand*{\scr@dte@nosub}[1]{\@scr@dte@nosub #1\relax} |
| 2035 |
\newcommand*{\@scr@dte@nosub}{} |
| 2036 |
\def\@scr@dte@nosub sub#1\relax{#1} |
| 2037 |
% \end{macrocode} |
| 2038 |
% \end{macro}^^A \scr@dte@nosub,\@scr@dte@nosub |
| 2039 |
% \begin{macro}{\scr@dte@tocline} |
| 2040 |
% \changes{v3.20}{2015/11/22}{added} |
| 2041 |
% \changes{v3.27}{2019/05/12}{support for \opt{noindent}} |
| 2042 |
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by \cs{Iftocfeature}} |
| 2043 |
% This is somehow like the \LaTeX{} kernel macro \cs{@dottedtocline}. But it |
| 2044 |
% supports a lot of more attributes, not only the level, the numberwidth, the |
| 2045 |
% indent and the text. The attributes are handled by options. So we need only |
| 2046 |
% three arguments: |
| 2047 |
% \begin{description} |
| 2048 |
% \item[\marg{level name}:] the name of the ToC entry level; |
| 2049 |
% \item[\marg{entry}:] the ToC entry; |
| 2050 |
% \item[\marg{page number}:] the page number of the ToC entry. |
| 2051 |
% \end{description} |
| 2052 |
% \begin{length}{\scr@dte@tocline@numberwidth} |
| 2053 |
% \changes{v3.20}{2016/01/15}{added} |
| 2054 |
% Sometimes the real width of a formatted number is of interest. So we store |
| 2055 |
% it in \len{scr@dte@tocline@numberwidth}. |
| 2056 |
% \begin{macrocode} |
| 2057 |
\newlength\scr@dte@tocline@numberwidth |
| 2058 |
\newcommand*{\scr@dte@tocline}[3]{% |
| 2059 |
\ifnum \@nameuse{#1tocdepth}>\c@tocdepth |
| 2060 |
\else |
| 2061 |
\tocbasic@DependOnPenaltyAndTOCLevel{#1}% |
| 2062 |
\addvspace{\@nameuse{scr@tso@#1@beforeskip}}\relax |
| 2063 |
% \end{macrocode} |
| 2064 |
% \changes{v3.31}{2020/06/08}{code for indent following list processing} |
| 2065 |
% If a indent following list exists and the depth of an entry is lower than |
| 2066 |
% the depth of the current entry, use the maximum of the ident + number width |
| 2067 |
% for the indent of this entry. |
| 2068 |
% \begin{macrocode} |
| 2069 |
\@nameuse{Ifscr@tso@#1@dynindent}{% |
| 2070 |
\expandafter\ifx\csname scr@tso@#1@indentfollows\endcsname\@empty |
| 2071 |
\PackageWarning{tocbasic}{`dynindent' for `#1' not available}% |
| 2072 |
\else |
| 2073 |
\edef\reserved@a{\@nameuse{scr@tso@#1@indentfollows}}% |
| 2074 |
\@for \reserved@a:=\reserved@a\do {% |
| 2075 |
\scr@trim@spaces\reserved@a |
| 2076 |
\ifx\reserved@a\@empty\else |
| 2077 |
\scr@ifundefinedorrelax{\reserved@a tocdepth}{% |
| 2078 |
}{% |
| 2079 |
\ifnum \@nameuse{\reserved@a tocdepth}<\@nameuse{#1tocdepth}% |
| 2080 |
\@tempdima\@nameuse{scr@tso@\reserved@a @indent}\relax |
| 2081 |
\@nameuse{Ifscr@tso@\reserved@a @dynnumwidth}{% |
| 2082 |
\scr@ifundefinedorrelax |
| 2083 |
{scr@dte@\reserved@a @lastmaxnumwidth}{% |
| 2084 |
\advance\@tempdima |
| 2085 |
\@nameuse{scr@tso@\reserved@a @numwidth}\relax |
| 2086 |
}{% |
| 2087 |
\advance\@tempdima |
| 2088 |
\@nameuse{scr@dte@\reserved@a @lastmaxnumwidth}\relax |
| 2089 |
}% |
| 2090 |
}{% |
| 2091 |
\advance\@tempdima |
| 2092 |
\@nameuse{scr@tso@\reserved@a @numwidth}\relax |
| 2093 |
}% |
| 2094 |
\ifdim \@tempdima>\@nameuse{scr@tso@#1@indent}\relax |
| 2095 |
\expandafter\edef\csname scr@tso@#1@indent\endcsname |
| 2096 |
{\the\@tempdima}% |
| 2097 |
\fi |
| 2098 |
\fi |
| 2099 |
}% |
| 2100 |
\fi |
| 2101 |
}% |
| 2102 |
\fi |
| 2103 |
}{}% |
| 2104 |
{% |
| 2105 |
\Iftocfeature{\@currext}{noindent}{% |
| 2106 |
\leftskip \z@ |
| 2107 |
}{% |
| 2108 |
\leftskip \@nameuse{scr@tso@#1@indent}\relax |
| 2109 |
}% |
| 2110 |
\rightskip \@nameuse{scr@tso@#1@rightindent}\relax |
| 2111 |
\parfillskip -\rightskip |
| 2112 |
\@nameuse{Ifscr@tso@#1@raggedpage}{% |
| 2113 |
\addtolength{\parfillskip}{\z@ \@plus 1fil}% |
| 2114 |
}{}% |
| 2115 |
\Iftocfeature{\@currext}{noindent}{% |
| 2116 |
\parindent \z@ |
| 2117 |
}{% |
| 2118 |
\parindent \@nameuse{scr@tso@#1@indent}\relax |
| 2119 |
}% |
| 2120 |
\@afterindenttrue |
| 2121 |
\interlinepenalty\@M |
| 2122 |
% \end{macrocode} |
| 2123 |
% \changes{v3.21}{2016/06/06}{\cs{ragged\dots entry} is supported (again)} |
| 2124 |
% \begin{macrocode} |
| 2125 |
\expandafter\ifx\csname ragged#1entry\endcsname\raggedright |
| 2126 |
\addtolength\rightskip\@flushglue |
| 2127 |
\else |
| 2128 |
\def\reserved@a{\raggedright}% |
| 2129 |
\expandafter\ifx\csname ragged#1entry\endcsname\reserved@a |
| 2130 |
\addtolength\rightskip\@flushglue |
| 2131 |
\else |
| 2132 |
\renewcommand\reserved@a{\raggedright}% |
| 2133 |
\expandafter\ifx\csname ragged#1entry\endcsname\reserved@a |
| 2134 |
\addtolength\rightskip\@flushglue |
| 2135 |
\fi |
| 2136 |
\fi |
| 2137 |
\fi |
| 2138 |
\leavevmode |
| 2139 |
\@tempdima \@nameuse{scr@tso@#1@numwidth}\relax |
| 2140 |
\@nameuse{Ifscr@tso@#1@dynnumwidth}{% |
| 2141 |
\scr@ifundefinedorrelax{scr@dte@#1@lastmaxnumwidth}{}{% |
| 2142 |
\ifdim \@nameuse{scr@dte@#1@lastmaxnumwidth}>\@tempdima |
| 2143 |
\@tempdima\@nameuse{scr@dte@#1@lastmaxnumwidth}\relax |
| 2144 |
\fi |
| 2145 |
}% |
| 2146 |
}{}% |
| 2147 |
\advance\leftskip \@tempdima |
| 2148 |
\null\nobreak\hskip -\leftskip |
| 2149 |
{% |
| 2150 |
% \end{macrocode} |
| 2151 |
% \changes{v3.46}{2025/08/13}{extending \cs{numberline@numberprefix}} |
| 2152 |
% \changes{v3.46}{2025/08/13}{extending \cs{numberline@numberpostfix}} |
| 2153 |
% Here we extend \cs{numberline@numberprefix} and |
| 2154 |
% \cs{numberline@numberpostfix} to handle options \opt{numberprefix} and |
| 2155 |
% \opt{numberpostfix}. |
| 2156 |
% \begin{macrocode} |
| 2157 |
\l@preto@macro\numberline@numberprefix |
| 2158 |
{\@nameuse{scr@tso@#1@numberprefix}}% |
| 2159 |
\l@addto@macro\numberline@numberpostfix |
| 2160 |
{\@nameuse{scr@tso@#1@numberpostfix}}% |
| 2161 |
% \end{macrocode} |
| 2162 |
% Here we use a trick to detect the width of an eventually existing number |
| 2163 |
% while printing it. For this it is a must to use the internal definition of |
| 2164 |
% \cs{numberline}. |
| 2165 |
% \begin{macrocode} |
| 2166 |
\usetocbasicnumberline |
| 2167 |
\let\scr@dte@numberline@box\numberline@box |
| 2168 |
\def\numberline@box##1{% |
| 2169 |
\sbox\scr@dte@tocline@numbox{\@nameuse{scr@tso@#1@numberformat}{##1}}% |
| 2170 |
% \end{macrocode} |
| 2171 |
% We are inside a group, so we have to set the length globally. |
| 2172 |
% \begin{macrocode} |
| 2173 |
\global\scr@dte@tocline@numberwidth |
| 2174 |
\dimexpr\wd\scr@dte@tocline@numbox+\@nameuse{scr@tso@#1@numsep}\relax |
| 2175 |
% \end{macrocode} |
| 2176 |
% \changes{v3.22}{2016/12/02}{missing second \cs{relax} added} |
| 2177 |
% Attention: We need two \cs{relax}, because the first one is eaten by |
| 2178 |
% \cs{dimexpr}. |
| 2179 |
% \begin{macrocode} |
| 2180 |
\relax |
| 2181 |
\ifdim \scr@dte@tocline@numberwidth |
| 2182 |
>\@nameuse{scr@dte@#1@maxnumwidth}\relax |
| 2183 |
\global\@nameuse{scr@dte@#1@maxnumwidth}\scr@dte@tocline@numberwidth |
| 2184 |
\fi |
| 2185 |
\@nameuse{Ifscr@tso@#1@dynnumwidth}{}{% |
| 2186 |
\ifdim \scr@dte@tocline@numberwidth |
| 2187 |
>\dimexpr \@nameuse{scr@tso@#1@numwidth}% |
| 2188 |
+\@nameuse{scr@tso@#1@numsep}\relax\relax |
| 2189 |
\PackageWarning{tocbasic}{% |
| 2190 |
number width of #1 toc entries should be |
| 2191 |
increased!\MessageBreak |
| 2192 |
Currently used number width = |
| 2193 |
\the\wd\scr@dte@tocline@numbox,\MessageBreak |
| 2194 |
Wanted number separation |
| 2195 |
\space\space\space = |
| 2196 |
\the\dimexpr\@nameuse{scr@tso@#1@numsep}\relax,\MessageBreak |
| 2197 |
Reserved number width \space\space\space\space\space\space = |
| 2198 |
\the\dimexpr\@nameuse{scr@tso@#1@numwidth}\relax% |
| 2199 |
}% |
| 2200 |
\fi |
| 2201 |
}% |
| 2202 |
\scr@dte@numberline@box{\@nameuse{scr@tso@#1@numberformat}{##1}}% |
| 2203 |
\@nameuse{Ifscr@tso@#1@breakafternumber}{% |
| 2204 |
{\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip |
| 2205 |
}{}% |
| 2206 |
}% |
| 2207 |
\@nameuse{scr@tso@#1@entryformat}{% |
| 2208 |
#2% |
| 2209 |
\nobreak |
| 2210 |
{% |
| 2211 |
\normalfont\normalsize\@nameuse{scr@tso@#1@linefill}% |
| 2212 |
\nobreak |
| 2213 |
% \end{macrocode} |
| 2214 |
% \changes{v3.27}{2019/10/02}{\cs{scr@dte@pagenumberwidth} is defined} |
| 2215 |
% We don't want a dependency of entry variable from entry variables. So |
| 2216 |
% locally \cs{scr@dte@pagenumberwidth} will become |
| 2217 |
% \cs{scr@tso@\meta{Eintragsname}@pagenumberwidth} and in the definition of |
| 2218 |
% \cs{scr@tso@\meta{Eintragsname}@pagenumberbox} we use this local macro. |
| 2219 |
% \begin{macrocode} |
| 2220 |
\expandafter\let\expandafter\scr@dte@pagenumberwidth |
| 2221 |
\csname scr@tso@#1@pagenumberwidth\endcsname |
| 2222 |
\@nameuse{scr@tso@#1@pagenumberbox}{% |
| 2223 |
\@nameuse{scr@tso@#1@pagenumberformat}{#3}% |
| 2224 |
}% |
| 2225 |
}% |
| 2226 |
\@par |
| 2227 |
}% |
| 2228 |
}% |
| 2229 |
}% |
| 2230 |
\tocbasic@SetPenaltyByTOCLevel{#1}% |
| 2231 |
\fi |
| 2232 |
} |
| 2233 |
% \end{macrocode} |
| 2234 |
% \end{length}^^A \scr@dte@tocline@numberwidth |
| 2235 |
% \begin{macro}{\scr@dte@tocline@numbox} |
| 2236 |
% \changes{v3.20}{2015/11/25}{new (\emph{box})} |
| 2237 |
% Needed to measure the width of the number and use the number later. |
| 2238 |
% \begin{macrocode} |
| 2239 |
\newsavebox\scr@dte@tocline@numbox |
| 2240 |
% \end{macrocode} |
| 2241 |
% \end{macro}^^A \scr@dte@tocline@numbox |
| 2242 |
% \begin{macro}{\tocbasic@DependOnPenaltyAndTOCLevel, |
| 2243 |
% \tocbasic@SetPenaltyByTOCLevel} |
| 2244 |
% \changes{v3.20}{2015/11/23}{added} |
| 2245 |
% \changes{v3.20}{2016/03/12}{changed for \pkg*{tocbasic} syntax of package |
| 2246 |
% author macros} |
| 2247 |
% \cs{tocbasic@DepenedOnPenaltyAndTOCLevel} executes a saved action depending |
| 2248 |
% on whether the current penalty value stands for an entry with higher, same, |
| 2249 |
% or lower entry level. |
| 2250 |
% \cs{tocbasic@SetPenaltyByTOCLevel} sets the penalty for the page break |
| 2251 |
% depending on the current entry level. |
| 2252 |
% \begin{command}{\LastTOCLevelWasHigher,\LastTOCLevelWasSame, |
| 2253 |
% \LastTOCLevelWasLower} |
| 2254 |
% \changes{v3.20}{2015/11/23}{added} |
| 2255 |
% Standard action, if the previous entry level was higher (allow page break), |
| 2256 |
% same (allow page break), or lower (keep penalty and therefore prevent page |
| 2257 |
% break). |
| 2258 |
% \begin{macrocode} |
| 2259 |
\newcommand*{\tocbasic@DependOnPenaltyAndTOCLevel}[1]{% |
| 2260 |
\ifnum \lastpenalty<\numexpr 20009-\@nameuse{#1tocdepth}\relax |
| 2261 |
\@nameuse{scr@tso@#1@LastTOCLevelWasHigher}% |
| 2262 |
\else\ifnum \lastpenalty=\numexpr 20009-\@nameuse{#1tocdepth}\relax |
| 2263 |
\@nameuse{scr@tso@#1@LastTOCLevelWasSame}% |
| 2264 |
\else |
| 2265 |
\@nameuse{scr@tso@#1@LastTOCLevelWasLower}% |
| 2266 |
\fi |
| 2267 |
\fi |
| 2268 |
} |
| 2269 |
\newcommand*{\tocbasic@SetPenaltyByTOCLevel}[1]{% |
| 2270 |
\penalty \numexpr 20009-\@nameuse{#1tocdepth}\relax |
| 2271 |
} |
| 2272 |
\newcommand*{\LastTOCLevelWasHigher}{\ifvmode\addpenalty{\@lowpenalty}\fi} |
| 2273 |
\newcommand*{\LastTOCLevelWasSame}{\ifvmode\addpenalty{\@lowpenalty}\fi} |
| 2274 |
\newcommand*{\LastTOCLevelWasLower}{} |
| 2275 |
% \end{macrocode} |
| 2276 |
% \end{command}^^A \LastTOCLevelWasHigher … \LastTOCLevelWasLower |
| 2277 |
% \end{macro}^^A \tocbasic@SetPenaltyByTOCLevel,\tocbasic@DependOnPenaltyAndTOCLevel |
| 2278 |
% \begin{command}{\TOCLineLeaderFill} |
| 2279 |
% \changes{v3.20}{2015/11/14}{added} |
| 2280 |
% Filler between the last text line and the page number. The optional argument |
| 2281 |
% \texttt{\#1} is the character used for filling. |
| 2282 |
% \begin{macrocode} |
| 2283 |
\newcommand*{\TOCLineLeaderFill}[1][.]{% |
| 2284 |
\leaders\hbox{$\m@th |
| 2285 |
\mkern \@dotsep mu\hbox{#1}\mkern \@dotsep |
| 2286 |
mu$}\hfill |
| 2287 |
} |
| 2288 |
%</tocline> |
| 2289 |
% \end{macrocode} |
| 2290 |
% \end{command}^^A \TOCLineLeaderFill |
| 2291 |
% \end{macro}^^A \scr@dte@tocline |
| 2292 |
% |
| 2293 |
% \begin{macro}{\scr@dte@toctext} |
| 2294 |
% \changes{v3.27}{2019/07/08}{added} |
| 2295 |
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by |
| 2296 |
% \cs{Iftocfeature}} |
| 2297 |
% This is the command to format entries that will be accumalted into a single |
| 2298 |
% paragraph. This is somehow special, because the settings of one entrie can |
| 2299 |
% influence another one. The three arguments are: |
| 2300 |
% \begin{description} |
| 2301 |
% \item[\marg{level}:] The name \meta{string} of the entry level. |
| 2302 |
% \item[\marg{entry}:] The ToC entry \meta{string}. |
| 2303 |
% \item[\marg{pagenumber}:] The page number \meta{string} of the ToC entry. |
| 2304 |
% \end{description} |
| 2305 |
% \begin{macrocode} |
| 2306 |
%<*toctext> |
| 2307 |
\newcommand*{\scr@dte@toctext}[3]{% |
| 2308 |
\ifnum \@nameuse{#1tocdepth}>\c@tocdepth |
| 2309 |
\else |
| 2310 |
\ifhmode |
| 2311 |
% \end{macrocode} |
| 2312 |
% In h-mode their is already output of a previous text entry. So the end code |
| 2313 |
% of that previous text entry has to be output before the initial output of |
| 2314 |
% the new text entry has to be done. |
| 2315 |
% \begin{macrocode} |
| 2316 |
\scr@dte@toctext@lastend |
| 2317 |
\@nameuse{scr@tso@#1@onstartentry}% |
| 2318 |
\else |
| 2319 |
% \end{macrocode} |
| 2320 |
% \changes{v3.31}{2020/06/09}{use of option \opt{beforeskip}} |
| 2321 |
% In v-mode it is a new text entry. Before leaving v-mode the vertical space |
| 2322 |
% is added. |
| 2323 |
% \begin{macrocode} |
| 2324 |
\addvspace{\@nameuse{scr@tso@#1@beforeskip}}% |
| 2325 |
\leavevmode |
| 2326 |
% \end{macrocode} |
| 2327 |
% The paragraph end has to be prepared to eventually change the right |
| 2328 |
% skip, to do the final output, and after all destroy these commands. |
| 2329 |
% \begin{macrocode} |
| 2330 |
\def\par{% |
| 2331 |
\scr@dte@toctext@raggedright |
| 2332 |
\scr@dte@toctext@parend |
| 2333 |
\@par |
| 2334 |
\scr@dte@toctext@afterpar |
| 2335 |
\global\let\scr@dte@toctext@afterpar\relax |
| 2336 |
\global\let\scr@dte@toctext@parend\relax |
| 2337 |
\global\let\scr@dte@toctext@raggedright\relax |
| 2338 |
}% |
| 2339 |
\global\let\scr@dte@toctext@afterpar\@empty |
| 2340 |
% \end{macrocode} |
| 2341 |
% Also the left skip and the right skip has to be setup (these are the |
| 2342 |
% margins) and if any of the text entries has to be printed ragged right, all |
| 2343 |
% of them should be ragged right. |
| 2344 |
% \begin{macrocode} |
| 2345 |
\Iftocfeature{\@currext}{noindent}{% |
| 2346 |
\leftskip \z@ |
| 2347 |
}{% |
| 2348 |
% \end{macrocode} |
| 2349 |
% \changes{v3.49}{2025/10/07}{\opt{dynindent} code added} |
| 2350 |
% From version 3.49 we also need to calculate the dynamic indent, if it is |
| 2351 |
% activated. |
| 2352 |
% \begin{description} |
| 2353 |
% \item[Todo:] This code should be moved to local macro, because it is used |
| 2354 |
% in style \texttt{tocline} and in \texttt{toctext}. |
| 2355 |
% \end{description} |
| 2356 |
% \begin{macrocode} |
| 2357 |
\@nameuse{Ifscr@tso@#1@dynindent}{% |
| 2358 |
\expandafter\ifx\csname scr@tso@#1@indentfollows\endcsname\@empty |
| 2359 |
\PackageWarning{tocbasic}{`dynindent' for `#1' not available}% |
| 2360 |
\else |
| 2361 |
\edef\reserved@a{\@nameuse{scr@tso@#1@indentfollows}}% |
| 2362 |
\@for \reserved@a:=\reserved@a\do {% |
| 2363 |
\scr@trim@spaces\reserved@a |
| 2364 |
\ifx\reserved@a\@empty\else |
| 2365 |
\scr@ifundefinedorrelax{\reserved@a tocdepth}{% |
| 2366 |
}{% |
| 2367 |
\ifnum \@nameuse{\reserved@a tocdepth}<\@nameuse{#1tocdepth}% |
| 2368 |
\@tempdima\@nameuse{scr@tso@\reserved@a @indent}\relax |
| 2369 |
\@nameuse{Ifscr@tso@\reserved@a @dynnumwidth}{% |
| 2370 |
\scr@ifundefinedorrelax |
| 2371 |
{scr@dte@\reserved@a @lastmaxnumwidth}{% |
| 2372 |
\advance\@tempdima |
| 2373 |
\@nameuse{scr@tso@\reserved@a @numwidth}\relax |
| 2374 |
}{% |
| 2375 |
\advance\@tempdima |
| 2376 |
\@nameuse{scr@dte@\reserved@a @lastmaxnumwidth}\relax |
| 2377 |
}% |
| 2378 |
}{% |
| 2379 |
\advance\@tempdima |
| 2380 |
\@nameuse{scr@tso@\reserved@a @numwidth}\relax |
| 2381 |
}% |
| 2382 |
\ifdim \@tempdima>\@nameuse{scr@tso@#1@indent}\relax |
| 2383 |
\expandafter\edef\csname scr@tso@#1@indent\endcsname |
| 2384 |
{\the\@tempdima}% |
| 2385 |
\fi |
| 2386 |
\fi |
| 2387 |
}% |
| 2388 |
\fi |
| 2389 |
}% |
| 2390 |
\fi |
| 2391 |
}{}% |
| 2392 |
\leftskip \@nameuse{scr@tso@#1@indent}\relax |
| 2393 |
}% |
| 2394 |
\rightskip \@nameuse{scr@tso@#1@rightindent}\relax |
| 2395 |
\parfillskip \z@ \@plus 1fill\relax |
| 2396 |
% \end{macrocode} |
| 2397 |
% \changes{v3.31}{2020/06/09}{redefinition of \cs{addvspace}} |
| 2398 |
% \changes{v3.31}{2020/06/09}{redefinition of \cs{addpenalty}} |
| 2399 |
% Now, make sure, that the first non-|toctext| entry does do a \cs{par} |
| 2400 |
% before it uses \cs{addpenalty} or \cs{addvspace}. Before version~3.31 this |
| 2401 |
% has been done by redefining \cs{@noitemerr} but this does not work, because |
| 2402 |
% it ignores the argument of \cs{addpenalty} or \cs{addvspace}. So, this more |
| 2403 |
% dangerous solution has been made, that redefines \cs{addvspace} and |
| 2404 |
% \cs{addpenalty} locally. |
| 2405 |
% \begin{macrocode} |
| 2406 |
\ifx\addvspace\scr@dte@xaddvspace\else |
| 2407 |
\let\scr@dte@saddvspace\addvspace |
| 2408 |
\def\scr@dte@xaddvspace{% |
| 2409 |
\let\addvspace\scr@dte@saddvspace\par\addvspace}% |
| 2410 |
\let\addvspace\scr@dte@xaddvspace |
| 2411 |
\fi |
| 2412 |
\ifx\addpenalty\scr@dte@xaddpenalty\else |
| 2413 |
\let\scr@dte@saddpenalty\addpenalty |
| 2414 |
\def\scr@dte@xaddpenalty{% |
| 2415 |
\let\addpenalty\scr@dte@saddpenalty\par\addpenalty}% |
| 2416 |
\fi |
| 2417 |
% \end{macrocode} |
| 2418 |
% Finally the init code of the first entry has to be used. |
| 2419 |
% \begin{macrocode} |
| 2420 |
\@nameuse{scr@tso@#1@onstartfirstentry}% |
| 2421 |
\fi |
| 2422 |
% \end{macrocode} |
| 2423 |
% Also some settings are independend from beeing the first entry in the |
| 2424 |
% paragraph or not. |
| 2425 |
% \begin{macrocode} |
| 2426 |
\@nameuse{Ifscr@tso@#1@raggedright}{% |
| 2427 |
\let\\\@centercr |
| 2428 |
\gdef\scr@dte@toctext@raggedright{% |
| 2429 |
\@rightskip\@flushglue |
| 2430 |
\addtolength\rightskip\@rightskip |
| 2431 |
}% |
| 2432 |
}{}% |
| 2433 |
\l@addto@macro\scr@dte@toctext@afterpar{\@nameuse{scr@tso@#1@afterpar}}% |
| 2434 |
% \end{macrocode} |
| 2435 |
% The end codes have to be changed. These are used either at the start of the |
| 2436 |
% next entry with this style or at the end of the paragraph. |
| 2437 |
% \begin{macrocode} |
| 2438 |
\expandafter\global\expandafter\let\expandafter\scr@dte@toctext@lastend |
| 2439 |
\csname scr@tso@#1@onendentry\endcsname |
| 2440 |
\expandafter\global\expandafter\let\expandafter\scr@dte@toctext@parend |
| 2441 |
\csname scr@tso@#1@onendlastentry\endcsname |
| 2442 |
% \end{macrocode} |
| 2443 |
% Last but not least, the output has to be done. |
| 2444 |
% \begin{macrocode} |
| 2445 |
{% |
| 2446 |
\usetocbasicnumberline |
| 2447 |
\def\numberline@box##1{% |
| 2448 |
\mbox{% |
| 2449 |
\@nameuse{scr@tso@#1@numberformat}{\ignorespaces ##1\unskip}% |
| 2450 |
\hskip\@nameuse{scr@tso@#1@numsep}\relax |
| 2451 |
}% |
| 2452 |
}% |
| 2453 |
\@nameuse{scr@tso@#1@entryformat}{% |
| 2454 |
\ignorespaces#2\unskip |
| 2455 |
\@nameuse{scr@tso@#1@prepagenumber}% |
| 2456 |
\@nameuse{scr@tso@#1@pagenumberformat}{\ignorespaces #3\unskip}% |
| 2457 |
}% |
| 2458 |
}% |
| 2459 |
\fi |
| 2460 |
} |
| 2461 |
% \end{macrocode} |
| 2462 |
% \begin{macro}{\scr@dte@toctext@raggedright,\scr@dte@toctext@parend, |
| 2463 |
% \scr@dte@toctext@lastend} |
| 2464 |
% Helper macros to store some information for later usage. |
| 2465 |
% \begin{macrocode} |
| 2466 |
\newcommand*{\scr@dte@toctext@raggedright}{} |
| 2467 |
\newcommand*{\scr@dte@toctext@parend}{} |
| 2468 |
\newcommand*{\scr@dte@toctext@lastend}{} |
| 2469 |
%</toctext> |
| 2470 |
% \end{macrocode} |
| 2471 |
% \end{macro}^^A \scr@dte@toctext@raggedright … \scr@dte@toctext@lastend |
| 2472 |
% \end{macro}^^A \scr@dte@toctext |
| 2473 |
% |
| 2474 |
% |
| 2475 |
% \begin{macro}{\scr@dte@def@l@default} |
| 2476 |
% \changes{v3.20}{2015/12/16}{new for the package} |
| 2477 |
% The package \pkg*{tocbasic} already has a standard style. Other packages |
| 2478 |
% should not change the standard style. But classes are allowed to clone (or |
| 2479 |
% define) another standard style for documents made with that class. |
| 2480 |
% \begin{macrocode} |
| 2481 |
%<*default> |
| 2482 |
%%% (run: style,dottedtocline) |
| 2483 |
\CloneTOCEntryStyle{dottedtocline}{default} |
| 2484 |
%</default> |
| 2485 |
% \end{macrocode} |
| 2486 |
% \end{macro} |
| 2487 |
% |
| 2488 |
% \begin{macrocode} |
| 2489 |
%</style> |
| 2490 |
%</package> |
| 2491 |
% \end{macrocode} |
| 2492 |
% |
| 2493 |
% |
| 2494 |
% \subsubsection{The styles used by the \KOMAScript{} classes} |
| 2495 |
% |
| 2496 |
% \begin{macrocode} |
| 2497 |
%<*class> |
| 2498 |
%<*style> |
| 2499 |
% \end{macrocode} |
| 2500 |
% |
| 2501 |
% Some styles are defined by the classes only. They are only defined for the |
| 2502 |
% classes, that use them. So not all styles are available by all classes and |
| 2503 |
% even not all styles are the same with every class. |
| 2504 |
% |
| 2505 |
% \begin{macro}{\scr@dte@def@l@part} |
| 2506 |
% \changes{v3.20}{2015/12/07}{ToC entry style \texttt{part} added} |
| 2507 |
% This style exists with \cls*{scrbook}, \cls*{scrreprt} and |
| 2508 |
% \cls*{scrartcl}. The formatting of the entry and the page number is defined |
| 2509 |
% by the font elements \fnt{partentry} and \fnt{partentrypagenumber}. |
| 2510 |
% \begin{macrocode} |
| 2511 |
%<*part> |
| 2512 |
%%% (run: class,style,part) |
| 2513 |
\CloneTOCEntryStyle{tocline}{part} |
| 2514 |
\TOCEntryStyleStartInitCode{part}{% |
| 2515 |
\expandafter\providecommand% |
| 2516 |
\csname scr@tso@#1@linefill\endcsname{\hfill}% |
| 2517 |
\expandafter\providecommand% |
| 2518 |
\csname scr@tso@#1@entryformat\endcsname[1]{\usekomafont{partentry}{##1}}% |
| 2519 |
\expandafter\providecommand% |
| 2520 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{% |
| 2521 |
\usekomafont{partentry}{\usekomafont{partentrypagenumber}{##1}}}% |
| 2522 |
\expandafter\providecommand\expandafter*% |
| 2523 |
\csname scr@tso@#1@beforeskip\endcsname{2.25em \@plus\p@}% |
| 2524 |
} |
| 2525 |
%</part> |
| 2526 |
% \end{macrocode} |
| 2527 |
% \end{macro}^^A \scr@dte@def@l@part |
| 2528 |
% |
| 2529 |
% \begin{macro}{\scr@dte@def@l@chapter} |
| 2530 |
% \changes{v3.20}{2015/12/07}{ToC entry style \texttt{chapter} added} |
| 2531 |
% \changes{v3.27}{2019/10/28}{using font element \fnt{chapterentrydots}} |
| 2532 |
% This style exists with \cls*{scrbook} and \cls*{scrreprt} only. |
| 2533 |
% \begin{macrocode} |
| 2534 |
%<*chapter> |
| 2535 |
%%% (run: class,style,chapter) |
| 2536 |
\CloneTOCEntryStyle{tocline}{chapter} |
| 2537 |
\TOCEntryStyleStartInitCode{chapter}{% |
| 2538 |
\expandafter\providecommand% |
| 2539 |
\csname scr@tso@#1@linefill\endcsname{% |
| 2540 |
\if@chapterentrywithdots |
| 2541 |
{\usekomafont{chapterentrydots}{\TOCLineLeaderFill}}\relax |
| 2542 |
\else |
| 2543 |
\hfill |
| 2544 |
\fi |
| 2545 |
}% |
| 2546 |
\expandafter\providecommand% |
| 2547 |
\csname scr@tso@#1@entryformat\endcsname{\usekomafont{chapterentry}}% |
| 2548 |
\expandafter\providecommand% |
| 2549 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{% |
| 2550 |
\usekomafont{chapterentry}{\usekomafont{chapterentrypagenumber}{##1}}}% |
| 2551 |
\expandafter\providecommand\expandafter*% |
| 2552 |
\csname scr@tso@#1@beforeskip\endcsname{1.0em \@plus\p@}% |
| 2553 |
} |
| 2554 |
%</chapter> |
| 2555 |
% \end{macrocode} |
| 2556 |
% \end{macro}^^A \scr@dte@def@l@chapter |
| 2557 |
% |
| 2558 |
% \begin{macro}{\scr@dte@def@l@section} |
| 2559 |
% \changes{v3.20}{2015/12/07}{ToC entry style \texttt{section} added} |
| 2560 |
% \changes{v3.27}{2019/10/28}{using font element \fnt{sectionentrydots}} |
| 2561 |
% With classes \cls*{scrbook} and \cls*{scrreprt} this is the style of the |
| 2562 |
% \emph{minor} entry level. With \cls*{scrartcl} this is the style of the top |
| 2563 |
% entry level (below the part level). So with \cls*{scrartcl} it is similar |
| 2564 |
% to the chapter style of \cls*{scrbook} or \cls*{scrreprt}. |
| 2565 |
% \begin{macrocode} |
| 2566 |
%<*section> |
| 2567 |
%%% (run: class,style,section) |
| 2568 |
\CloneTOCEntryStyle{tocline}{section} |
| 2569 |
%<*book|report> |
| 2570 |
\TOCEntryStyleStartInitCode{section}{% |
| 2571 |
\expandafter\providecommand% |
| 2572 |
\csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}% |
| 2573 |
} |
| 2574 |
%</book|report> |
| 2575 |
%<*article> |
| 2576 |
\TOCEntryStyleStartInitCode{section}{% |
| 2577 |
\expandafter\providecommand% |
| 2578 |
\csname scr@tso@#1@linefill\endcsname{% |
| 2579 |
\if@sectionentrywithdots |
| 2580 |
{\usekomafont{sectionentrydots}{\TOCLineLeaderFill}}\relax |
| 2581 |
\else |
| 2582 |
\hfill |
| 2583 |
\fi |
| 2584 |
}% |
| 2585 |
% \end{macrocode} |
| 2586 |
% Für die Einträge die Schrift von Element sectionentry verwenden. |
| 2587 |
% \begin{macrocode} |
| 2588 |
\expandafter\providecommand% |
| 2589 |
\csname scr@tso@#1@entryformat\endcsname{\usekomafont{sectionentry}}% |
| 2590 |
\expandafter\providecommand% |
| 2591 |
\csname scr@tso@#1@pagenumberformat\endcsname[1]{\usekomafont{sectionentry}{\usekomafont{sectionentrypagenumber}{##1}}}% |
| 2592 |
\expandafter\providecommand\expandafter*% |
| 2593 |
\csname scr@tso@#1@beforeskip\endcsname{1.0em \@plus\p@}% |
| 2594 |
} |
| 2595 |
%</article> |
| 2596 |
%</section> |
| 2597 |
% \end{macrocode} |
| 2598 |
% \end{macro}^^A \scr@dte@def@l@section |
| 2599 |
% |
| 2600 |
% \begin{macro}{\scr@dte@def@l@subsection} |
| 2601 |
% \changes{v3.20}{2015/12/07}{ToC entry style \texttt{subsection} added} |
| 2602 |
% This style exists with \cls*{scrartcl} only. It is the minor level style |
| 2603 |
% similar to the section style with \cls*{scrbook} and \cls*{scrreprt}. |
| 2604 |
% \begin{macrocode} |
| 2605 |
%<*subsection&article> |
| 2606 |
%%% (run: class,style,subsection) |
| 2607 |
\CloneTOCEntryStyle{tocline}{subsection} |
| 2608 |
\TOCEntryStyleStartInitCode{subsection}{% |
| 2609 |
\expandafter\providecommand% |
| 2610 |
\csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}% |
| 2611 |
} |
| 2612 |
%</subsection&article> |
| 2613 |
% \end{macrocode} |
| 2614 |
% \end{macro}^^A \scr@dte@def@l@subsection |
| 2615 |
% |
| 2616 |
% \begin{macro}{\scr@dte@def@l@default} |
| 2617 |
% \changes{v3.20}{2015/12/07}{ToC entry style \texttt{default} added} |
| 2618 |
% With classes \cls*{scrbook} and \cls*{scrreprt} this is a clone of the |
| 2619 |
% section style. With \cls*{scrartcl} this is a clone of the subsection style. |
| 2620 |
% \begin{macrocode} |
| 2621 |
%<*default> |
| 2622 |
%%% (run: class,style,default) |
| 2623 |
%<book|report>\CloneTOCEntryStyle{section}{default} |
| 2624 |
%<article>\CloneTOCEntryStyle{subsection}{default} |
| 2625 |
%</default> |
| 2626 |
% \end{macrocode} |
| 2627 |
% \end{macro} |
| 2628 |
% |
| 2629 |
% \begin{macrocode} |
| 2630 |
%</style> |
| 2631 |
%</class> |
| 2632 |
% \end{macrocode} |
| 2633 |
% |
| 2634 |
% \Finale |
| 2635 |
% \PrintChanges |
| 2636 |
% |
| 2637 |
\endinput |
| 2638 |
% Local Variables: |
| 2639 |
% mode: doctex |
| 2640 |
% ispell-local-dictionary: "en_US" |
| 2641 |
% eval: (flyspell-mode 1) |
| 2642 |
% TeX-master: t |
| 2643 |
% TeX-engine: luatex-dev |
| 2644 |
% 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")) |
| 2645 |
% End: |
| 2646 |
|