| 1 |
% ====================================================================== |
| 2 |
% scrbookreportarticle-experts-en.tex |
| 3 |
% Copyright (c) Markus Kohm, 2001-2022 |
| 4 |
% |
| 5 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the conditions of |
| 8 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 9 |
% The latest version of this license is in |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 12 |
% version 2005/12/01 or later and of this work. |
| 13 |
% |
| 14 |
% This work has the LPPL maintenance status "author-maintained". |
| 15 |
% |
| 16 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 17 |
% |
| 18 |
% This work consists of all files listed in MANIFEST.md. |
| 19 |
% ====================================================================== |
| 20 |
% |
| 21 |
% Chapter about scrbook, scrreprt, and scrartcl of the KOMA-Script guide |
| 22 |
% expert part |
| 23 |
% Maintained by Markus Kohm |
| 24 |
% |
| 25 |
% ============================================================================ |
| 26 |
|
| 27 |
\KOMAProvidesFile{scrbookreportarticle-experts-en.tex} |
| 28 |
[$Date: 2023-09-06 10:22:04 +0200 (Mi, 06. Sep 2023) $ |
| 29 |
KOMA-Script guide (chapter: scrbook, scrreprt, scrartcl for |
| 30 |
experts)] |
| 31 |
|
| 32 |
\translator{Gernot Hassenpflug\and Markus Kohm\and Karl Hagen} |
| 33 |
|
| 34 |
\chapter[{Additional Information about the Main Classes and |
| 35 |
\Package{scrextend}}]{Additional Information about the Main Classes |
| 36 |
\Class{scrbook}, |
| 37 |
\Class{scrreprt}, and \Class{scrartcl} as well as the Package |
| 38 |
\Package{scrextend}} |
| 39 |
\labelbase{maincls-experts} |
| 40 |
|
| 41 |
\BeginIndexGroup% |
| 42 |
\BeginIndex{Class}{scrartcl}% |
| 43 |
\BeginIndex{Class}{scrbook}% |
| 44 |
\BeginIndex{Class}{scrreprt}% |
| 45 |
\BeginIndex{Package}{scrextend}% |
| 46 |
This chapter provides additional information about the \KOMAScript{} classes |
| 47 |
\Class{scrbook}, \Class{scrreprt}, and \Class{scrartcl} and some commands that |
| 48 |
are also available in \Package{scrextend}. \iffree{Some parts of the chapter |
| 49 |
are found only in the German \KOMAScript{} book \cite{book:komascript}. This |
| 50 |
should not be a problem because the}{The} average user, who only wants to |
| 51 |
use the classes, will seldom need this information. Some of this information |
| 52 |
is addressed to users with non-standard requirements or who want to write |
| 53 |
their own classes based on a \KOMAScript{} class. Because such descriptions |
| 54 |
are not addressed to beginners, they are condensed and require deeper |
| 55 |
knowledge of \LaTeX. Other parts describe features that exist only for the |
| 56 |
sake of compatibility with the standard classes or earlier versions of |
| 57 |
\KOMAScript{}.\iffree{}{ |
| 58 |
Portions that describe features that exist only for reasons of compatibility |
| 59 |
with earlier versions of \KOMAScript{} are printed in sans serif font. You |
| 60 |
should not use them any longer.} |
| 61 |
|
| 62 |
\LoadNonFree{scrbookreportarticle-experts}{0} |
| 63 |
|
| 64 |
\section{Extensions to User Commands} |
| 65 |
\seclabel{addInfos} |
| 66 |
|
| 67 |
\LoadNonFree{scrbookreportarticle-experts}{1} |
| 68 |
|
| 69 |
\iffree{\LoadCommonFile{footnotes-experts}}{} |
| 70 |
|
| 71 |
\section{\KOMAScript's Interaction with Other Packages} |
| 72 |
\seclabel{coexistence} |
| 73 |
|
| 74 |
\LoadNonFree{scrbookreportarticle-experts}{2} |
| 75 |
|
| 76 |
|
| 77 |
\section{Detection of \KOMAScript{} Classes} |
| 78 |
\seclabel{identify} |
| 79 |
|
| 80 |
Package authors sometimes need to detect a \KOMAScript{} class. Mostly this is |
| 81 |
of little or no interest to the average user. To identify the version of |
| 82 |
\KOMAScript{} that is being used, refer to |
| 83 |
\DescRef{scrbase.cmd.KOMAScriptVersion} in \autoref{sec:scrbase.identify}, |
| 84 |
\DescPageRef{scrbase.cmd.KOMAScriptVersion}. |
| 85 |
|
| 86 |
\begin{Declaration} |
| 87 |
\Macro{KOMAClassName}% |
| 88 |
\Macro{ClassName} |
| 89 |
\end{Declaration} |
| 90 |
\Macro{KOMAClassName} stores the name of the \KOMAScript{} class currently in |
| 91 |
use. So if you want to know if a \KOMAScript{} class is used, you can easily |
| 92 |
test for this command. In contrast, \Macro{ClassName} indicates which standard |
| 93 |
class has been replaced by this \KOMAScript{} class. |
| 94 |
|
| 95 |
Note\textnote{Attention!} in this context, however, that the existence of |
| 96 |
\DescRef{scrlogo.cmd.KOMAScript}\IndexCmd{KOMAScript} cannot guarantee that a |
| 97 |
\KOMAScript{} class is in use. For one thing, all \KOMAScript{} packages |
| 98 |
define this command. For another, other packages may find it useful to define |
| 99 |
the \KOMAScript{} label using this name.% |
| 100 |
% |
| 101 |
\EndIndexGroup |
| 102 |
|
| 103 |
\section{Entries to the Table of Contents} |
| 104 |
\seclabel{toc} |
| 105 |
|
| 106 |
\KOMAScript{} classes provide advanced methods for generating and |
| 107 |
manipulating entries in the table of contents. Some of these are based on |
| 108 |
the \Package{tocbasic} package (see \autoref{sec:tocbasic.tocstyle} starting |
| 109 |
on \autopageref{sec:tocbasic.tocstyle}). Other are implemented directly in the |
| 110 |
classes. |
| 111 |
|
| 112 |
\begin{Declaration} |
| 113 |
\Macro{raggedchapterentry} |
| 114 |
\end{Declaration} |
| 115 |
In\ChangedAt{v3.21}{\Class{scrbook}\and \Class{scrreprt}} earlier versions of |
| 116 |
\KOMAScript{}, it was possible to define the \Macro{raggedchapterentry} macro |
| 117 |
as \Macro{raggedright} to print chapter entries in the table of contents |
| 118 |
left-aligned instead of fully justified. Officially, this feature has not |
| 119 |
existed in \KOMAScript{} since version~3.21. |
| 120 |
|
| 121 |
In fact, the \PValue{raggedentrytext} attribute for the \PValue{tocline} |
| 122 |
TOC-entry style of the \Package{tocbasic}\IndexPackage{tocbasic} package is |
| 123 |
implemented by setting the \Macro{ragged\PName{entry level}entry} macro to |
| 124 |
either \Macro{relax} or \Macro{raggedright}. This attribute is evaluated by |
| 125 |
checking whether the corresponding macro is defined as \Macro{raggedright}. If |
| 126 |
so, the text is printed left-aligned. With any other definition, no ragged |
| 127 |
margins are used. |
| 128 |
|
| 129 |
Since it was previously documented that \Macro{raggedchapterentry} should not |
| 130 |
be defined as anything other than \Macro{raggedright}, this behaviour is |
| 131 |
compatible with the documented behaviour of earlier versions. As noted in |
| 132 |
earlier releases, other definitions of \Macro{raggedchapterentry}\,---\,and |
| 133 |
now also of \Macro{raggedsectionentry} and similar macros for other entry |
| 134 |
levels\,---\,may lead to unexpected results. |
| 135 |
|
| 136 |
You should select the desired justification for the all table-of-contents |
| 137 |
entries using the \PValue{raggedentrytext} attribute of \PValue{tocline} |
| 138 |
rather than attempting to set the attribute for specific entry levels.% |
| 139 |
\EndIndexGroup |
| 140 |
|
| 141 |
|
| 142 |
\begin{Declaration} |
| 143 |
\Macro{addtocentrydefault}\Parameter{level}\Parameter{number}% |
| 144 |
\Parameter{heading} |
| 145 |
\end{Declaration} |
| 146 |
The\ChangedAt{v3.08}{\Class{scrbook}\and \Class{scrreprt}\and |
| 147 |
\Class{scrartcl}} \KOMAScript{} classes do not use |
| 148 |
\Macro{addcontentsline}\IndexCmd{addcontentsline}% |
| 149 |
\important{\Macro{addcontentsline}} directly to make entries in the table of |
| 150 |
contents. Instead, they call \Macro{addtocentrydefault} with similar |
| 151 |
arguments. The command can be used for both numbered and unnumbered entries. |
| 152 |
The \PName{level} is the sectioning level, that is \PValue{part}, |
| 153 |
\PValue{chapter}, \PValue{section}, \PValue{subsection}, |
| 154 |
\PValue{subsubsection}, \PValue{paragraph}, or \PValue{subparagraph}. The |
| 155 |
formatted sectioning number is given the second argument, \PName{number}. This |
| 156 |
argument can be empty. The text of the entry is given by the \PName{heading} |
| 157 |
argument. You should protect fragile commands inside this argument with |
| 158 |
\Macro{protect}\IndexCmd{protect}\important{\Macro{protect}}. |
| 159 |
|
| 160 |
One notable feature of the \PName{number} argument is that an empty argument |
| 161 |
indicates that an unnumbered entry should be generated. By default, |
| 162 |
\KOMAScript{} uses |
| 163 |
\begin{quote} |
| 164 |
\Macro{addcontentsline}\PParameter{toc}\Parameter{level}% |
| 165 |
\Parameter{heading} |
| 166 |
\end{quote} |
| 167 |
for this. If the argument is not empty, however, an entry with number |
| 168 |
will be created and \PName{number} is the formatted heading |
| 169 |
number. \KOMAScript{} uses |
| 170 |
\begin{quote}\raggedright |
| 171 |
\Macro{addcontentsline}\PParameter{toc}\Parameter{level}% |
| 172 |
\PParameter{\%\\ |
| 173 |
\quad\Macro{protect}\DescRef{tocbasic.cmd.numberline}\Parameter{number}% |
| 174 |
\PName{heading}\%\\ |
| 175 |
} |
| 176 |
\end{quote} |
| 177 |
to create this entry. |
| 178 |
|
| 179 |
Package authors and authors of wrapper classes can redefine this command to |
| 180 |
alter the entries. For example\textnote{Example}, you could use |
| 181 |
\begin{lstcode} |
| 182 |
\renewcommand{\addtocentrydefault}[3]{% |
| 183 |
\IfArgIsEmpty{#3}{% |
| 184 |
\IfArgIsEmpty{#2}{% |
| 185 |
\addcontentsline{toc}{#1}{#3}% |
| 186 |
}{% |
| 187 |
\addcontentsline{toc}{#1}{\protect\numberline{#2}#3}% |
| 188 |
}% |
| 189 |
}% |
| 190 |
}% |
| 191 |
\end{lstcode} |
| 192 |
to\IndexCmd{IfArgIsEmpty} omit entries with an empty \PName{heading}. In |
| 193 |
practice, such a change is not necessary because the \KOMAScript{} classes |
| 194 |
already use another method to suppress empty entries. See the description of |
| 195 |
the sectioning commands in \autoref{sec:maincls.structure}, starting on |
| 196 |
\DescPageRef{maincls.cmd.part} for this.% |
| 197 |
% |
| 198 |
\EndIndexGroup |
| 199 |
|
| 200 |
|
| 201 |
\begin{Declaration} |
| 202 |
\Macro{addparttocentry}\Parameter{number}\Parameter{heading} |
| 203 |
\Macro{addchaptertocentry}\Parameter{number}\Parameter{heading} |
| 204 |
\Macro{addsectiontocentry}\Parameter{number}\Parameter{heading} |
| 205 |
\Macro{addsubsectiontocentry}\Parameter{number}\Parameter{heading} |
| 206 |
\Macro{addsubsubsectiontocentry}\Parameter{number}\Parameter{heading} |
| 207 |
\Macro{addparagraphtocentry}\Parameter{number}\Parameter{heading} |
| 208 |
\Macro{addsubparagraphtocentry}\Parameter{number}\Parameter{heading} |
| 209 |
\end{Declaration}% |
| 210 |
The\ChangedAt{v3.08}{\Class{scrbook}\and \Class{scrreprt}\and |
| 211 |
\Class{scrartcl}} \KOMAScript{} classes call the previously described |
| 212 |
command |
| 213 |
\DescRef{\LabelBase.cmd.addtocentrydefault}\IndexCmd{addtocentrydefault}% |
| 214 |
\important{\DescRef{\LabelBase.cmd.addtocentrydefault}} directly only if no |
| 215 |
individual command for the \PName{level} has been defined or if that command |
| 216 |
is \Macro{relax}\IndexCmd{relax}\important{\Macro{relax}}. By default, all |
| 217 |
these commands simply pass their own \PName{level} and arguments directly to |
| 218 |
\DescRef{\LabelBase.cmd.addtocentrydefault}.% |
| 219 |
% |
| 220 |
\EndIndexGroup |
| 221 |
|
| 222 |
|
| 223 |
\section{Font Settings} |
| 224 |
\seclabel{fonts} |
| 225 |
|
| 226 |
\KOMAScript{} classes not only provide an extended selection of basic font |
| 227 |
sizes, but they also let you define, manipulate, and apply elements with |
| 228 |
their own font settings. |
| 229 |
|
| 230 |
% Note: Instead of |
| 231 |
% \LoadNonFree{scrbookreportarticle-experts}{5} |
| 232 |
% here is the content of that file: |
| 233 |
\begin{Declaration} |
| 234 |
\Macro{@fontsizefilebase}% |
| 235 |
\Macro{changefontsizes}\Parameter{font size} |
| 236 |
\end{Declaration} |
| 237 |
The \File{scrsize} prefix for file names of font-size files described |
| 238 |
in \autoref{sec:maincls-experts.addInfos}\iffree{}{ on |
| 239 |
\DescPageRef{maincls-experts.option.fontsize}} is just the default for the |
| 240 |
internal \Macro{@fontsizefilebase}\IndexCmd{@fontsizefilebase} macro. This |
| 241 |
default is used only when the macro is not yet defined when loading a |
| 242 |
\KOMAScript{} class or the \Package{scrextend} package. Authors of wrapper |
| 243 |
classes can redefine this macro to use completely different font-size files. |
| 244 |
Similarly\textnote{Hint!} authors of wrapper classes can change or deactivate |
| 245 |
the fallback solution for unknown font sizes by redefining the |
| 246 |
\Macro{changefontsizes}\important{\Macro{changefontsizes}} macro. This macro |
| 247 |
has exactly one argument: the desired \PName{font size}. |
| 248 |
However\textnote{Attention!}, the \Macro{changefontsizes} macro is not |
| 249 |
designed as an end-user instruction.% |
| 250 |
\EndIndexGroup |
| 251 |
|
| 252 |
|
| 253 |
\begin{Declaration} |
| 254 |
\Macro{newkomafont}\OParameter{warning}\Parameter{element}% |
| 255 |
\Parameter{default}% |
| 256 |
\Macro{aliaskomafont}\Parameter{alias}\Parameter{element} |
| 257 |
\end{Declaration} |
| 258 |
Experts can use \Macro{newkomafont} to define a \PName{default} for the font |
| 259 |
style of an \PName{element}. Subsequently, that default can be changed with |
| 260 |
the \DescRef{maincls.cmd.setkomafont} and \DescRef{maincls.cmd.addtokomafont} |
| 261 |
commands (see \autoref{sec:maincls.textmarkup}, |
| 262 |
\DescPageRef{maincls.cmd.setkomafont}). Of course, merely defining the font |
| 263 |
style does not actually put it to use. You must make sure you include the |
| 264 |
\DescRef{maincls.cmd.usekomafont}% |
| 265 |
\important{\DescRef{maincls.cmd.usekomafont}}\IndexCmd{usekomafont} command |
| 266 |
(see \DescPageRef{maincls.cmd.usekomafont}) for this \PName{element} in your |
| 267 |
code at the appropriate places. Calling \Macro{newkomafont} for an existing |
| 268 |
element will result in error messages. |
| 269 |
|
| 270 |
The optional \PName{warning} argument defines a warning message. The |
| 271 |
\KOMAScript{} classes output it with \Macro{ClassWarning}, and the |
| 272 |
\Package{scrextend} package with \Macro{PackageWarning}, whenever the default |
| 273 |
font style of that \PName{element} is changed. The package \Package{scrkbase} |
| 274 |
is listed as the generator of the warning. |
| 275 |
|
| 276 |
The \Macro{aliaskomafont} command defines an \PName{alias} for a previously |
| 277 |
defined \PName{element}. \KOMAScript{} informs the user in the \File{log} file |
| 278 |
about the actual name of the element if it uses an \PName{alias}. |
| 279 |
You\textnote{Hint!} can use an \PName{alias}, for example, if you think of a |
| 280 |
better name for an element and the old name should remain usable for the sake |
| 281 |
of compatibility. It can also increase user-friendliness by creating aliases |
| 282 |
for all the terms that different users may intuitively choose. \KOMAScript{} |
| 283 |
itself makes use of this possibility.% |
| 284 |
\EndIndexGroup |
| 285 |
|
| 286 |
|
| 287 |
\begin{Declaration} |
| 288 |
\Macro{addtokomafontrelaxlist}\Parameter{macro} |
| 289 |
\Macro{addtokomafontonearglist}\Parameter{macro} |
| 290 |
\Macro{addtokomafontgobblelist}\Parameter{macro} |
| 291 |
\end{Declaration} |
| 292 |
As already mentioned in \autoref{part:forAuthors} of this manual, font |
| 293 |
settings of elements should consist only of commands to select the size, |
| 294 |
family, encoding, series, shape, or colour. Colour changes are not |
| 295 |
always transparent in \LaTeX{} and therefore can cause in unwanted side-effects |
| 296 |
if you use \DescRef{maincls.cmd.usekomafont} at an inappropriate place. |
| 297 |
|
| 298 |
Users tend to put very different, sometimes critical, things into the font |
| 299 |
setting of an element, such as \Macro{MakeUppercase} at the very end of the |
| 300 |
setting. As much as possible, the internal use of the font settings has been |
| 301 |
implemented so that many of these prohibited elements still do no harm, and it |
| 302 |
usually works even if the last command in a font setting expects an argument, |
| 303 |
for example using \Macro{textbf} instead of \Macro{bfseries}. But there is no |
| 304 |
guarantee for that. |
| 305 |
|
| 306 |
Internally, \KOMAScript{} must sometimes limit font changes to real font |
| 307 |
settings. This is accomplished, for example, by using |
| 308 |
\DescRef{maincls.cmd.usefontofkomafont}% |
| 309 |
\IndexCmd{usefontofkomafont}% |
| 310 |
\IndexCmd{usesizeofkomafont}\IndexCmd{useencodingofkomafont}% |
| 311 |
\IndexCmd{usefamilyofkomafont}\IndexCmd{useseriesofkomafont}% |
| 312 |
\IndexCmd{useshapeofkomafont} instead of \DescRef{maincls.cmd.usekomafont} |
| 313 |
(see \autoref{sec:maincls.textmarkup}, |
| 314 |
\DescPageRef{maincls.cmd.usefontofkomafont}). |
| 315 |
|
| 316 |
Nevertheless, the \DescRef{maincls.cmd.usefontofkomafont} command and its |
| 317 |
siblings have their limitations. Therefore you must not use a command that |
| 318 |
always needs a fully expandable argument inside the font setting of an |
| 319 |
element. But this is exactly what \Macro{MakeUppercase} needs. |
| 320 |
Therefore\ChangedAt{v3.17}{\Class{scrbook}\and \Class{scrreprt}\and |
| 321 |
\Class{scrartcl}} \KOMAScript{} maintains an internal list of macros that |
| 322 |
should become \Macro{relax} inside \DescRef{maincls.cmd.usefontofkomafont} and |
| 323 |
its siblings. Since \KOMAScript~3.24\ChangedAt{v3.24}{\Class{scrbook}\and |
| 324 |
\Class{scrreprt}\and \Class{scrartcl}} only \Macro{normalcolor} is added to |
| 325 |
this list by default. |
| 326 |
|
| 327 |
Note that the given \PName{macro} is actually just set to \Macro{relax}. So |
| 328 |
any arguments within the font setting will be executed locally, if applicable. |
| 329 |
Therefore you should never add commands like \Macro{setlength} to the list. |
| 330 |
You are responsible for all errors resulting caused by using |
| 331 |
\Macro{addtokomafontrelaxlist}. Also, do not take this command as license to |
| 332 |
add all sorts of commands to the font settings! |
| 333 |
|
| 334 |
For\ChangedAt{v3.24}{\Class{scrbook}\and \Class{scrreprt}\and |
| 335 |
\Class{scrartcl}} commands whose first argument should be executed without an |
| 336 |
additional group, there is \Macro{addtokomatfontonearglist}. The specified |
| 337 |
macro is set to \Macro{@firstofone}. By default \Macro{MakeUppercase} and |
| 338 |
\Macro{MakeLowercase} are added to this list. |
| 339 |
|
| 340 |
If\ChangedAt{v3.19}{\Class{scrbook}\and \Class{scrreprt}\and |
| 341 |
\Class{scrartcl}}, on the other hand, a \PName{macro} and its first argument |
| 342 |
should be ignored locally inside \DescRef{maincls.cmd.usefontofkomafont} and |
| 343 |
its siblings, you can use \Macro{addtokomafontgobblelist} instead of |
| 344 |
\Macro{addtokomafontrelaxlist}. An example of this is the command |
| 345 |
\Macro{color}, which must be ignored along with the colour name and therefore |
| 346 |
is a member of this list by default. |
| 347 |
|
| 348 |
Note the defaults of these three lists may change in future version. If you |
| 349 |
need a certain commands in one of the lists, you should should explicitly add |
| 350 |
them yourself.% |
| 351 |
\EndIndexGroup |
| 352 |
|
| 353 |
|
| 354 |
\begin{Declaration} |
| 355 |
\Macro{IfExistskomafont}\Parameter{element}\Parameter{then code}% |
| 356 |
\Parameter{else code} |
| 357 |
\Macro{IfIsAliaskomafont}\Parameter{element}\Parameter{then code}% |
| 358 |
\Parameter{else code} |
| 359 |
\end{Declaration} |
| 360 |
Which\ChangedAt{v3.15}{\Class{scrbook}\and \Class{scrreprt}\and |
| 361 |
\Class{scrartcl}\and \Class{scrlttr2}} elements are defined depends on the |
| 362 |
version of \KOMAScript. So it sometimes makes sense to test in advance whether |
| 363 |
a specific \PName{element} even exists. The \Macro{IfExistskomafont} command |
| 364 |
executes the \PName{then code} if and only if an \PName{element} has been |
| 365 |
defined using \DescRef{\LabelBase.cmd.newkomafont} or |
| 366 |
\DescRef{\LabelBase.cmd.aliaskomafont} and therefore can also be changed using |
| 367 |
\DescRef{maincls.cmd.setkomafont} or \DescRef{maincls.cmd.addtokomafont} and |
| 368 |
can be used by one of the \Macro{use\dots komafont} commands. Otherwise it |
| 369 |
executes the \PName{else code}.% |
| 370 |
|
| 371 |
In contrast, \Macro{IfIsAliaskomafont}\ChangedAt{v3.25}{\Class{scrbook}\and |
| 372 |
\Class{scrreprt}\and \Class{scrartcl}\and \Class{scrlttr2}} executes |
| 373 |
\PName{then code} only if \PName{element} has been defined with |
| 374 |
\DescRef{\LabelBase.cmd.aliaskomafont} as an alias of another element. For |
| 375 |
undefined elements as well as for elements defined with |
| 376 |
\DescRef{\LabelBase.cmd.newkomafont}, however, it executes the |
| 377 |
\PName{else code}.% |
| 378 |
\EndIndexGroup |
| 379 |
|
| 380 |
\section{Paragraph Indention or Gap} |
| 381 |
\seclabel{parskip} |
| 382 |
|
| 383 |
Because the \KOMAScript{} classes offer extended features for setting the |
| 384 |
paragraph indention or gap, direct changes of the standard lengths |
| 385 |
\Length{parskip}\IndexLength{parskip}, \Length{parindent}\IndexLength{parskip} |
| 386 |
and \Length{parfillskip}\IndexLength{parskip} are not only unnecessary but |
| 387 |
mostly inadvisable. |
| 388 |
|
| 389 |
\begin{Declaration} |
| 390 |
\Macro{setparsizes}\Parameter{indent}\Parameter{distance} |
| 391 |
\Parameter{last-line end space} |
| 392 |
\end{Declaration} |
| 393 |
\KOMAScript{} provides the option to set the indent of the first line of a new |
| 394 |
paragraph, the distance between paragraphs, and the white space required at the |
| 395 |
end of the last line of each paragraph. You should use this command whenever |
| 396 |
the \OptionValueRef{maincls}{parskip}{relative} option should recognize these |
| 397 |
changes. \KOMAScript{}\textnote{example} itself uses this command, for |
| 398 |
example, in the form |
| 399 |
\begin{lstcode} |
| 400 |
\setparsizes{0pt}{0pt}{0pt plus 1fil} |
| 401 |
\end{lstcode} |
| 402 |
to eliminate both the paragraph indentation and inter-paragraph spacing, as |
| 403 |
well as to allow any amount of white space at the end of the last line of the |
| 404 |
paragraph. Such values are useful if a paragraph consists of only a box that |
| 405 |
should be printed without vertical spacing and filling the whole column |
| 406 |
width. If, on the other hand, the box should only span the whole width but use |
| 407 |
the current settings for indentation and distance between paragraphs, then |
| 408 |
\begin{lstcode} |
| 409 |
\setlength{\parfillskip}{0pt plus 1fil} |
| 410 |
\end{lstcode} |
| 411 |
is preferable. |
| 412 |
|
| 413 |
Starting with \KOMAScript~3.17\ChangedAt{v3.17}{\Class{scrbook}\and |
| 414 |
\Class{scrreprt}\and \Class{scrartcl}}, recalculating or |
| 415 |
reactivating\IndexCmd{activateareas} the type area or the margins (see |
| 416 |
\autoref{cha:typearea}) also readjusts the values of \Macro{setparsizes} if |
| 417 |
they have not been changed in the meantime. This is one more reason not to |
| 418 |
change these values without using \KOMAScript. Setting compatibility to a |
| 419 |
\KOMAScript{} version prior to 3.17 (see |
| 420 |
\autoref{sec:maincls.compatibilityOptions}, |
| 421 |
\DescPageRef{maincls.option.version}, option \DescRef{maincls.option.version}% |
| 422 |
\IndexOption{version}\important{\OptionValueRef{maincls}{version}{3.17}}) |
| 423 |
disables this recalculation.% |
| 424 |
% |
| 425 |
\EndIndexGroup |
| 426 |
|
| 427 |
\section{Counters} |
| 428 |
\seclabel{counter} |
| 429 |
|
| 430 |
\LoadNonFree{scrbookreportarticle-experts}{3} |
| 431 |
|
| 432 |
\section{Sections} |
| 433 |
\seclabel{sections} |
| 434 |
|
| 435 |
The \KOMAScript{} classes provide a wide range of options for modifying |
| 436 |
sectioning levels and their corresponding headings. You can even define new |
| 437 |
levels. |
| 438 |
|
| 439 |
\begin{Declaration} |
| 440 |
\Macro{DeclareSectionCommand}\OParameter{attributes}\Parameter{name}% |
| 441 |
\Macro{DeclareNewSectionCommand}\OParameter{attributes}\Parameter{name}% |
| 442 |
\Macro{RedeclareSectionCommand}\OParameter{attributes}\Parameter{name}% |
| 443 |
\Macro{ProvideSectionCommand}\OParameter{attributes}\Parameter{name} |
| 444 |
\end{Declaration} |
| 445 |
With\ChangedAt{v3.15}{\Class{scrbook}\and \Class{scrreprt}\and |
| 446 |
\Class{scrartcl}} these commands you can either define a new sectioning |
| 447 |
command, \Macro{\PName{name}}, or modify an existing sectioning command, |
| 448 |
\Macro{\PName{name}}. To do so, you use the optional argument to set several |
| 449 |
\PName{attributes}. The \PName{attributes} are a comma-separated list of |
| 450 |
\PName{key}=\PName{value} assignments. In addition to the style-independent |
| 451 |
attributes shown in \autoref{tab:maincls-experts.declaresection.keys}, |
| 452 |
\autopageref{tab:maincls-experts.declaresection.keys}, there are also |
| 453 |
attributes that depend on the style. Currently the following styles are |
| 454 |
available: |
| 455 |
\begin{description}\setkomafont{descriptionlabel}{} |
| 456 |
\item[\PValue{chapter}:] \ChangedAt{v3.18}{\Class{scrbook}\and |
| 457 |
\Class{scrreprt}}The style for chapter headings. This style is used by |
| 458 |
default for \DescRef{maincls.cmd.chapter}\IndexCmd{chapter} and indirectly |
| 459 |
for \DescRef{maincls.cmd.addchap}\IndexCmd{addchap}. You can define new |
| 460 |
sectioning commands using this style, but then they do not automatically |
| 461 |
have an \Macro{add\dots} variant. To configure existing or new sectioning |
| 462 |
commands, you can also use the attributes of |
| 463 |
\autoref{tab:maincls-experts.declarechapterstyle.keys}, |
| 464 |
\autopageref{tab:maincls-experts.declarechapterstyle.keys}. |
| 465 |
The\textnote{Attention!} \DescRef{maincls.cmd.addchap} command, |
| 466 |
like the starred variants, is configured automatically with |
| 467 |
\DescRef{maincls.cmd.chapter} and cannot be modified independently. Note |
| 468 |
that \Class{scrartcl}\OnlyAt{\Class{scrbook}\and \Class{scrreprt}} does not |
| 469 |
provide this style. |
| 470 |
\item[\PValue{part}:] \ChangedAt{v3.18}{\Class{scrbook}\and |
| 471 |
\Class{scrreprt}\and \Class{scrartcl}}The style for part headings. This |
| 472 |
style is used by default for \DescRef{maincls.cmd.part}\IndexCmd{part} and |
| 473 |
indirectly for \DescRef{maincls.cmd.addpart}\IndexCmd{addpart}. You can |
| 474 |
define new sectioning commands using this style, but then they do not |
| 475 |
automatically have an \Macro{add\dots} variant. To configure existing or new |
| 476 |
sectioning commands, you can also use the attributes of |
| 477 |
\autoref{tab:maincls-experts.declarepartstyle.keys}, |
| 478 |
\autopageref{tab:maincls-experts.declarepartstyle.keys}. |
| 479 |
Note\textnote{Attention!} that the \DescRef{maincls.cmd.addpart} command, |
| 480 |
like the starred variants, is configured automatically with |
| 481 |
\DescRef{maincls.cmd.part} and cannot be modified independently. |
| 482 |
\item[\PValue{section}:] The style for section headings. This style is currently |
| 483 |
used for \DescRef{maincls.cmd.section}\IndexCmd{section}, |
| 484 |
\DescRef{maincls.cmd.subsection}\IndexCmd{subsection}, |
| 485 |
\DescRef{maincls.cmd.subsubsection}\IndexCmd{subsubsection}, |
| 486 |
\DescRef{maincls.cmd.paragraph}\IndexCmd{paragraph}, and |
| 487 |
\DescRef{maincls.cmd.subparagraph}\IndexCmd{subparagraph}. You can define |
| 488 |
new sectioning commands using this style. To configure existing or new |
| 489 |
sectioning commands, you can also use the attributes of |
| 490 |
\autoref{tab:maincls-experts.declaresectionstyle.keys}, |
| 491 |
\autopageref{tab:maincls-experts.declaresectionstyle.keys}. When redefining |
| 492 |
a command, the \ChangedAt{v3.24}{\Class{scrbook}\and |
| 493 |
\Class{scrreprt}\and \Class{scrartcl}} \PName{key}s |
| 494 |
\PValue{style}, \PValue{afterskip}, \PValue{beforeskip}, and \PValue{level} |
| 495 |
are mandatory. The keys |
| 496 |
\PValue{afterindent}\ChangedAt{v3.26}{\Class{scrbook}\and |
| 497 |
\Class{scrreprt}\and \Class{scrartcl}},\PValue{font} and \PValue{indent} |
| 498 |
are recommended. \PValue{tocindent} and |
| 499 |
\PValue{tocnumwidth} may also be required depending on the command's |
| 500 |
\PName{name}. This also applies if a command that was not previously a |
| 501 |
sectioning command is redefined as a sectioning command using |
| 502 |
\Macro{RedeclareSectionCommand}. Note\textnote{Attention!} that the |
| 503 |
\Macro{addsec} command and its starred variants are configured automatically |
| 504 |
with \DescRef{maincls.cmd.section} and cannot be changed independently. |
| 505 |
\end{description} |
| 506 |
Defining a sectioning command also creates an element with the same |
| 507 |
\PName{name}, if it does not already exist. For \PValue{chapter} and |
| 508 |
\PValue{part}, elements are also created for the prefix line. You can change |
| 509 |
its font settings using \DescRef{maincls.cmd.setkomafont} or |
| 510 |
\DescRef{maincls.cmd.addtokomafont} (see \autoref{sec:maincls.textmarkup}, |
| 511 |
\DescPageRef{maincls.cmd.setkomafont}). |
| 512 |
|
| 513 |
\begin{table} |
| 514 |
\caption[{Style-independent attributes for declaring sectioning |
| 515 |
commands}]{Available \PName{key}s and \PName{value}s for |
| 516 |
style-independent \PName{attributes} when declaring sectioning command}% |
| 517 |
\label{tab:maincls-experts.declaresection.keys}% |
| 518 |
\begin{tabularx}{\linewidth}{llX} |
| 519 |
\toprule |
| 520 |
\PName{key} & \PName{value} & Description \\ |
| 521 |
\midrule% |
| 522 |
\PValue{counterwithin} |
| 523 |
& \PName{counter name} |
| 524 |
& The value of the counter of the heading should depend on \PName{counter |
| 525 |
name}. Whenever \Macro{stepcounter} or \Macro{refstepcounter} increases |
| 526 |
the value of \PName{counter name}, the value of the counter of this |
| 527 |
heading is reset to 0. In addition, \Macro{the\PName{counter name}} is |
| 528 |
prefixed with a dot when this counter is output.\\ |
| 529 |
\PValue{counterwithout}% |
| 530 |
\ChangedAt{v3.19}{\Class{scrbook}\and \Class{scrreprt}\and |
| 531 |
\Class{scrartcl}}% |
| 532 |
& \PName{counter name} |
| 533 |
& Cancels a prior \PValue{counterwithin} setting. Therefore it makes sense |
| 534 |
only if you redefine an existing sectioning command.\\ |
| 535 |
\PValue{expandtopt} |
| 536 |
& \PName{switch} |
| 537 |
& If the switch is on, all subsequent values for lengths will be |
| 538 |
completely expanded, evaluated, and stored as \texttt{pt} values when |
| 539 |
they are defined. This means lengths no longer depend on the current |
| 540 |
font size. If the switch is off, all subsequent values for lengths will |
| 541 |
be tentatively expanded and evaluated but stored for full evaluation at |
| 542 |
application time. You can use any values from |
| 543 |
\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch}. |
| 544 |
The default is \PValue{false}.\\ |
| 545 |
\PValue{level} |
| 546 |
& \PName{integer} |
| 547 |
& The numerical value of the sectioning level (see the |
| 548 |
\DescRef{maincls.counter.secnumdepth} counter, |
| 549 |
\autoref{sec:maincls.structure}, |
| 550 |
\DescPageRef{maincls.counter.secnumdepth}); the value should be unique |
| 551 |
and is mandatory for new levels.\\ |
| 552 |
\PValue{style} |
| 553 |
& \PName{name} |
| 554 |
& Defines the style of the heading.\\ |
| 555 |
\ChangedAt{v3.20}{\Class{scrbook}\and \Class{scrreprt}\and |
| 556 |
\Class{scrartcl}}% |
| 557 |
\PValue{tocstyle} |
| 558 |
& \PName{name} |
| 559 |
& Defines the style of the entries in the table of contents. You can use |
| 560 |
every previously defined TOC-entry style (see |
| 561 |
\autoref{sec:tocbasic.tocstyle}). An empty \PName{name} prevents a new |
| 562 |
definition of the TOC-entry command \Macro{l@\dots}.\\ |
| 563 |
\ChangedAt{v3.20}{\Class{scrbook}\and \Class{scrreprt}\and |
| 564 |
\Class{scrartcl}}% |
| 565 |
\PValue{toc\PName{option}} |
| 566 |
& \PName{value} |
| 567 |
& Additional options depending on the TOC-entry style selected with |
| 568 |
\Option{tocstyle}. See \autoref{sec:tocbasic.tocstyle}, |
| 569 |
\autopageref{sec:tocbasic.tocstyle} for additional information about |
| 570 |
TOC-entry styles. You can find the attributes that can be used as |
| 571 |
\PName{option}s for the predefined TOC-entry styles of the |
| 572 |
\Package{tocbasic} package in |
| 573 |
\autoref{tab:tocbasic.tocstyle.attributes}, |
| 574 |
\autopageref{tab:tocbasic.tocstyle.attributes}.\\ |
| 575 |
% \PValue{tocindent} |
| 576 |
% & \PName{length} |
| 577 |
% & Total indentation from the left margin of the entry in the table of |
| 578 |
% contents corresponding to this heading, if and only if such an |
| 579 |
% entry will be made (see \DescRef{maincls.counter.tocdepth}, |
| 580 |
% \autoref{sec:maincls.toc}, \DescPageRef{maincls.counter.tocdepth}).\\ |
| 581 |
% \PValue{toclevel} |
| 582 |
% & \PName{integer} |
| 583 |
% & A number denoting the depth of the entry in the table of contents |
| 584 |
% corresponding to this heading, if this should differ from |
| 585 |
% \PValue{level} (see \DescRef{maincls.counter.tocdepth}, |
| 586 |
% \autoref{sec:maincls.toc}, \DescPageRef{maincls.counter.tocdepth}). \\ |
| 587 |
% \PValue{tocnumwidth} |
| 588 |
% & \PName{length} |
| 589 |
% & Width of the box for the number of the entry in the table of |
| 590 |
% contents.\\ |
| 591 |
\bottomrule |
| 592 |
\end{tabularx} |
| 593 |
\end{table} |
| 594 |
|
| 595 |
\begin{table} |
| 596 |
\caption[{Attributes of the \PValue{section} style when declaring a |
| 597 |
sectioning command}]{Additional \PName{key}s and \PName{value}s for |
| 598 |
attributes when declaring a sectioning command with the \PValue{section} |
| 599 |
style}% |
| 600 |
\label{tab:maincls-experts.declaresectionstyle.keys}% |
| 601 |
\begin{tabularx}{\linewidth}{llX} |
| 602 |
\toprule |
| 603 |
\PName{key} & \PName{value} & Description \\ |
| 604 |
\midrule |
| 605 |
\PValue{afterindent}% |
| 606 |
\ChangedAt{v3.26}{\Class{scrbook}\and \Class{scrreprt}\and |
| 607 |
\Class{scrartcl}}% |
| 608 |
& \PName{switch} |
| 609 |
& The \PName{switch} determines whether the current paragraph indent is |
| 610 |
applied to the first line following a freestanding heading (see |
| 611 |
\PValue{runin}). With the default, \PValue{bysign}, the sign of |
| 612 |
\PValue{beforeskip} determines the behaviour. If the value of |
| 613 |
\PValue{beforeskip} is negative, the indentation of the first paragraph |
| 614 |
following the heading is suppressed. You can use any value from |
| 615 |
\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch} to |
| 616 |
explicitly enable or disable this indentation.\\ |
| 617 |
\PValue{afterskip} |
| 618 |
& \PName{length} |
| 619 |
& In the case of a run-in heading (see \PValue{runin}), the absolute value |
| 620 |
of the \PName{length} is the horizontal space after the heading. That is, |
| 621 |
a positive distance is always inserted. In the case of a freestanding |
| 622 |
heading, the \PName{length} is the vertical skip below the heading. With |
| 623 |
\OptionValue{runin}{bysign}, a positive value results in a freestanding |
| 624 |
heading, while a negative value or zero results in a run-in heading.\\ |
| 625 |
\PValue{beforeskip} |
| 626 |
& \PName{length} |
| 627 |
& Specifies the vertical space before the heading. With |
| 628 |
\OptionValue{afterindent}{bysign}, if the value is negative, a positive |
| 629 |
distance\,---\,the amount of \PName{length}\,---\,is still inserted, but |
| 630 |
in this case the indentation of the paragraph following the heading is |
| 631 |
suppressed.\\ |
| 632 |
\PValue{font} |
| 633 |
& \PName{font commands} |
| 634 |
& The font settings that should be used for the heading in addition to |
| 635 |
\DescRef{maincls.fontelement.disposition}. You can use all settings that |
| 636 |
are allowed for \DescRef{maincls.cmd.setkomafont} and |
| 637 |
\DescRef{maincls.cmd.addtokomafont} for the element of the heading.\\ |
| 638 |
\PValue{indent} |
| 639 |
& \PName{length} |
| 640 |
& The indentation of heading from the left margin.\\ |
| 641 |
\PValue{runin} |
| 642 |
\ChangedAt{v3.26}{\Class{scrbook}\and \Class{scrreprt}\and |
| 643 |
\Class{scrartcl}}% |
| 644 |
& \PName{switch} |
| 645 |
& Defines whether to use a run-in or a freestanding heading. With |
| 646 |
the default, \PValue{bysign}, the sign of \PValue{afterskip} determines |
| 647 |
the behaviour. In this case, a positive value of \PValue{afterskip} |
| 648 |
results in a freestanding heading. You can use any values from |
| 649 |
\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch} to |
| 650 |
explicitly enable or disable a run-in heading.\\ |
| 651 |
\bottomrule |
| 652 |
\end{tabularx} |
| 653 |
\end{table} |
| 654 |
|
| 655 |
\begin{table} |
| 656 |
\caption[{Attributes of the \PValue{chapter} style when declaring a |
| 657 |
sectioning command}]{Additional \PName{keys} and \PName{value}s for |
| 658 |
attributes when declaring a sectioning command with the \PValue{chapter} |
| 659 |
style}% |
| 660 |
\label{tab:maincls-experts.declarechapterstyle.keys}% |
| 661 |
\begin{tabularx}{\linewidth}{llX} |
| 662 |
\toprule |
| 663 |
\PName{key} & \PName{value} & Description \\ |
| 664 |
\midrule |
| 665 |
\PValue{afterindent}% |
| 666 |
\ChangedAt{v3.26}{\Class{scrbook}\and \Class{scrreprt}\and |
| 667 |
\Class{scrartcl}}% |
| 668 |
& \PName{switch} |
| 669 |
& The \PName{switch} determines whether to apply the indentation of the |
| 670 |
first paragraph following a heading. With the default, \PValue{bysign}, |
| 671 |
the sign of \PValue{beforeskip} defines the behaviour. If the value of |
| 672 |
\PValue{beforeskip} is negative, the indentation of the paragraph |
| 673 |
following the heading is suppressed. You can use any value from |
| 674 |
\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch} to |
| 675 |
explicitly enable or disable this indentation.\\ |
| 676 |
\PValue{afterskip}% |
| 677 |
\ChangedAt{v3.26}{\Class{scrbook}\and \Class{scrreprt}\and |
| 678 |
\Class{scrartcl}}% |
| 679 |
& \PName{length} |
| 680 |
& The vertical skip below the heading.\\ |
| 681 |
\PValue{beforeskip} |
| 682 |
& \PName{length} |
| 683 |
& The vertical skip before the heading. With |
| 684 |
\OptionValue{afterindent}{bysign}, if the value is negative, a positive |
| 685 |
distance\,---\,the amount of \PName{length}\,---\,is still inserted, but |
| 686 |
in this case the indentation of the first paragraph following the heading |
| 687 |
is suppressed.\\ |
| 688 |
\PValue{font} & \PName{font commands} & The font setting to use for the |
| 689 |
heading in addition to \DescRef{maincls.fontelement.disposition}. You |
| 690 |
can use all settings, that are allowed for |
| 691 |
\DescRef{maincls.cmd.setkomafont} and |
| 692 |
\DescRef{maincls.cmd.addtokomafont} for this element.\\ |
| 693 |
\PValue{innerskip} & \PName{length} & The vertical skip between the prefix |
| 694 |
line and the heading's text, if a prefix line is used.\\ |
| 695 |
\PValue{pagestyle} & \PName{page style name} & The name of the page style |
| 696 |
to use automatically for pages with the heading. There is no check to |
| 697 |
see if the \PName{page style name} is valid. Therefore, incorrect names |
| 698 |
will result in error messages when the sectioning command is used.\\ |
| 699 |
\PValue{prefixfont} & \PName{font commands} & The font setting to use |
| 700 |
for the prefix line of the heading, in addition to the |
| 701 |
\DescRef{maincls.fontelement.disposition} and sectioning command |
| 702 |
elements. You can use all settings that are allowed for |
| 703 |
\DescRef{maincls.cmd.setkomafont} and |
| 704 |
\DescRef{maincls.cmd.addtokomafont} for the element of the prefix |
| 705 |
line.\\ |
| 706 |
\bottomrule |
| 707 |
\end{tabularx} |
| 708 |
\end{table} |
| 709 |
|
| 710 |
\begin{table} |
| 711 |
\caption[{Attributes of the \PValue{part} style when declaring a sectioning |
| 712 |
command}]{Additional \PName{keys} and \PName{value}s for attributes |
| 713 |
when declaring a sectioning command with the \PValue{part} style}% |
| 714 |
\label{tab:maincls-experts.declarepartstyle.keys}% |
| 715 |
\begin{tabularx}{\linewidth}{llX} |
| 716 |
\toprule |
| 717 |
\PName{key} & \PName{value} & Description \\ |
| 718 |
\midrule |
| 719 |
\PValue{afterindent}% |
| 720 |
\ChangedAt{v3.26}{\Class{scrbook}\and \Class{scrreprt}\and |
| 721 |
\Class{scrartcl}}% |
| 722 |
& \PName{switch} |
| 723 |
& The \PName{switch} determines whether to apply the indentation of the |
| 724 |
first paragraph following a heading. With the value \PValue{bysign}, |
| 725 |
the sign of \PValue{beforeskip} determines the behaviour. If the value |
| 726 |
of \PValue{beforeskip} is negative, the indentation of the first |
| 727 |
paragraph following the heading is suppressed. You can use any value |
| 728 |
from \autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch} to |
| 729 |
explicitly enable or disable this indentation. For compatibility, |
| 730 |
the default is \PValue{false} for \Class{scrartcl} and \PValue{true} for |
| 731 |
\Class{scrbook} and \Class{scrreprt}.\\ |
| 732 |
\PValue{afterskip} & \PName{length} & The value is the vertical skip below |
| 733 |
the heading.\\ |
| 734 |
\PValue{beforeskip} |
| 735 |
& \PName{length} |
| 736 |
& The vertical skip before the heading. With |
| 737 |
\OptionValue{afterindent}{bysign}, if the value is negative, a positive |
| 738 |
distance\,---\,the amount of \PName{length}\,---\,is still inserted, but |
| 739 |
in this case the indentation of the first paragraph following the heading |
| 740 |
is suppressed.\\ |
| 741 |
\PValue{font} & \PName{font commands} & The font setting to use for the |
| 742 |
heading in addition to \DescRef{maincls.fontelement.disposition}. You |
| 743 |
can use all settings that are allowed for |
| 744 |
\DescRef{maincls.cmd.setkomafont} and |
| 745 |
\DescRef{maincls.cmd.addtokomafont} for the element of the heading.\\ |
| 746 |
\PValue{innerskip} & \PName{length} & % \OnlyAt{\Class{scrbook}\and |
| 747 |
% \Class{scrreprt}}% |
| 748 |
The vertical skip between the prefix line and the heading text in |
| 749 |
\Class{scrbook} and \Class{scrreprt}.\\ |
| 750 |
\PValue{pagestyle} & \PName{page style name} & |
| 751 |
% \OnlyAt{\Class{scrbook}\and |
| 752 |
% \Class{scrreprt}}% |
| 753 |
The name of the page style to use automatically on pages with the |
| 754 |
heading. There is no check to see if \PName{page style name} is valid. |
| 755 |
Therefore, incorrect names will result in error messages when the |
| 756 |
sectioning command is used. This feature only exists in \Class{scrbook} |
| 757 |
and\Class{scrreprt}.\\ |
| 758 |
\PValue{prefixfont} & \PName{font commands} & The font setting to use for |
| 759 |
the prefix line of the heading, in addition to the |
| 760 |
\DescRef{maincls.fontelement.disposition} and sectioning command |
| 761 |
elements. You can use all settings that are allowed for |
| 762 |
\DescRef{maincls.cmd.setkomafont} and |
| 763 |
\DescRef{maincls.cmd.addtokomafont} for the element of the prefix |
| 764 |
line.\\ |
| 765 |
\bottomrule |
| 766 |
\end{tabularx} |
| 767 |
\end{table} |
| 768 |
|
| 769 |
\Macro{DeclareNewSectionCommand} defines a new sectioning command. If the |
| 770 |
same \PName{name} is already used by \TeX{} for something else, the command |
| 771 |
will result in an error message and will not define anything. |
| 772 |
|
| 773 |
\Macro{ProvideSectionSommand} behaves similarly but does not issue an error |
| 774 |
message. |
| 775 |
|
| 776 |
\Macro{RedeclareSectionCommand}, on the other hand, can only change an |
| 777 |
existing command to a sectioning command with the specified |
| 778 |
\PName{attributes}. It does not check whether \Macro{\PName{name}} is already |
| 779 |
a sectioning command. It only needs to be a \PName{name} already a \TeX |
| 780 |
command. |
| 781 |
|
| 782 |
\Macro{DeclareSectionCommand} does not check whether or not \PName{name} is |
| 783 |
an existing \TeX{} command name. It just defines a sectioning |
| 784 |
command \Macro{\PName{name}} with the specified \PName{attributes}. |
| 785 |
|
| 786 |
Each sectioning command also has a corresponding counter with the same |
| 787 |
\PName{name} that is allocated with \Macro{newcounter} if necessary. The same |
| 788 |
naming rule applies to the corresponding output of the counter |
| 789 |
(\Macro{the\PName{name}}), the counter's format (\Macro{\PName{name}format}), |
| 790 |
the command to generate a running head (\Macro{\PName{name}mark}), the format |
| 791 |
of the counter in the running head (\Macro{\PName{name}markformat}), the font |
| 792 |
element (\FontElement{\PName{name}}), and the section-depth number |
| 793 |
(\Macro{\PName{name}numdepth}). The command for the running head, |
| 794 |
\Macro{\PName{name}mark}, is defined by default not to generate a running |
| 795 |
head. The default output of the counter \Macro{the\PName{name}} is an Arabic |
| 796 |
number. If the counter is defined as depending on another counter with the |
| 797 |
\PValue{counterwithin} \PName{key}, the output of this counter will be |
| 798 |
prefixed by a dot. |
| 799 |
|
| 800 |
In\ChangedAt[2016/03]{v3.20}{\Class{scrbook}\and \Class{scrreprt}\and |
| 801 |
\Class{scrartcl}} addition to the sectioning command itself, a command for |
| 802 |
corresponding entries to the table of contents is also defined. This is done |
| 803 |
using the \hyperref[cha:tocbasic]{\Package{tocbasic}}% |
| 804 |
\important{\hyperref[cha:tocbasic]{\Package{tocbasic}}}\IndexPackage{tocbasic} |
| 805 |
package. The \PName{tocstyle} attribute defines the style of those entries. If |
| 806 |
you set an empty \PName{name}, e.\,g. using \OptionValue{tocstyle}{} or |
| 807 |
\OptionValue{tocstyle}{\{\}}, the command for the TOC entry will not be |
| 808 |
changed. This is important, for example, if you use another package to modify |
| 809 |
the table of contents. If you do not set the \PValue{tocstyle} attribute, the |
| 810 |
previous style will be used again during the redefinition. |
| 811 |
|
| 812 |
The\ChangedAt[2016/03]{v3.20}{\Class{scrbook}\and \Class{scrreprt}\and |
| 813 |
\Class{scrartcl}} different TOC-entry styles also have different additional |
| 814 |
attributes. You can set them directly if you prefix them with \PValue{toc}. |
| 815 |
For example, you can set the level of the TOC entries, \PValue{level}, using |
| 816 |
\PValue{toclevel}, the indention, \PValue{indent}, using \PValue{tocindent}, |
| 817 |
or the number width, \PValue{numwidth}, using \PValue{tocnumwidth}. For more |
| 818 |
TOC-entry style attributes see \autoref{sec:tocbasic.tocstyle}, |
| 819 |
\autopageref{sec:tocbasic.tocstyle}. |
| 820 |
|
| 821 |
\begin{Example} |
| 822 |
For some unknown reason, you want to redefine the |
| 823 |
\DescRef{maincls.cmd.paragraph} headings so that they are no longer run-in |
| 824 |
headings but are similar to \DescRef{maincls.cmd.subsubsection}. The |
| 825 |
vertical skip above the heading should be 10\Unit{pt} and no additional |
| 826 |
vertical skip below the heading. To do so, you can use: |
| 827 |
\begin{lstcode} |
| 828 |
\RedeclareSectionCommand[% |
| 829 |
beforeskip=-10pt,% |
| 830 |
afterskip=1sp% |
| 831 |
]{paragraph} |
| 832 |
\end{lstcode} |
| 833 |
The negative value of \PValue{beforeskip} creates a positive vertical skip |
| 834 |
before the heading and simultaneously disables the paragraph indentation of |
| 835 |
the following text. Even though the specification did not want any vertical |
| 836 |
skip after the heading, a value of 1\Unit{sp} has been given here. This is |
| 837 |
because \LaTeX{} doesn't recognize 0\Unit{pt} as positive value. So |
| 838 |
1\Unit{sp} is the smallest possible positive value. |
| 839 |
|
| 840 |
Generally, it is better to have some tolerance for adjusting the vertical |
| 841 |
spacing, the so-called \emph{glue}: |
| 842 |
\begin{lstcode} |
| 843 |
\RedeclareSectionCommand[% |
| 844 |
beforeskip=-10pt plus -2pt minus -1pt,% |
| 845 |
afterskip=1sp plus -1sp minus 1sp% |
| 846 |
]{paragraph} |
| 847 |
\end{lstcode} |
| 848 |
Note that the glue also switches the algebraic sign before becoming a skip, |
| 849 |
if the value is negative. That is the reason for the negative glue values in |
| 850 |
the example. Additionally we used the occasion to minimize the vertical skip |
| 851 |
after the heading using glue too. |
| 852 |
\end{Example} |
| 853 |
|
| 854 |
In the example above, we only needed to define the keys \PValue{beforeskip} |
| 855 |
and \PValue{afterskip} because since v3.15 \KOMAScript{} has defined |
| 856 |
\DescRef{maincls.cmd.paragraph} internally using |
| 857 |
\Macro{DeclareSectionCommand}, and therefore the other settings can be adopted |
| 858 |
unchanged. The original definition of \DescRef{maincls.cmd.paragraph} in |
| 859 |
\Class{scrartcl} reads: |
| 860 |
\begin{lstcode} |
| 861 |
\DeclareSectionCommand[% |
| 862 |
level=4, |
| 863 |
indent=0pt, |
| 864 |
beforeskip=3.25ex plus 1ex minus .2ex, |
| 865 |
afterskip=-1em, |
| 866 |
font={}, |
| 867 |
tocindent=7em, |
| 868 |
tocnumwidth=4.1em, |
| 869 |
counterwithin=subsubsection |
| 870 |
]{paragraph} |
| 871 |
\end{lstcode} |
| 872 |
\Class{scrreprt} and \Class{scrbook} use slightly different values. |
| 873 |
|
| 874 |
Some settings of \DescRef{maincls.cmd.chapter} depend on the |
| 875 |
\DescRef{maincls.option.headings} option (see \autoref{sec:maincls.structure}, |
| 876 |
\DescPageRef{maincls.option.headings}). |
| 877 |
\hyperref[tab:maincls.chapter.skips]{Table~\ref*{tab:maincls.chapter.skips}} |
| 878 |
shows the default values of these settings. An overview of all settings is |
| 879 |
shown in \autoref{tab:maincls.section.defaults}. For more |
| 880 |
information\ChangedAt[2016/03]{v3.20}{\Class{scrbook}\and \Class{scrreprt}\and |
| 881 |
\Class{scrartcl}} about the default of the TOC-entry styles see |
| 882 |
\autoref{sec:tocbasic.tocstyle}\important{\Package{tocbasic}}, |
| 883 |
\autopageref{sec:tocbasic.tocstyle}. Note that \PValue{1ex} and |
| 884 |
\Length{baselineskip} depend on the default font size of the heading or the |
| 885 |
table of contents entry.% |
| 886 |
|
| 887 |
\begin{table} |
| 888 |
\centering |
| 889 |
\caption{Defaults for the chapter headings of \Class{scrbook} |
| 890 |
and \Class{scrreprt} depending on the \DescRef{maincls.option.headings} |
| 891 |
option} |
| 892 |
\label{tab:maincls.chapter.skips} |
| 893 |
\begin{tabular}{ll} |
| 894 |
\multicolumn{2}{@{}l}{\bfseries |
| 895 |
With \OptionValueRef{maincls}{headings}{big}:}\\ |
| 896 |
\toprule |
| 897 |
Attribute & Default Value \\ |
| 898 |
\midrule |
| 899 |
\PValue{afterskip} |
| 900 |
& \PValue{1.725\Length{baselineskip} plus .115\Length{baselineskip} |
| 901 |
minus .192\Length{baselineskip}} \\ |
| 902 |
\PValue{beforeskip} |
| 903 |
& \PValue{-3.3\Length{baselineskip}-\Length{parskip}} \\ |
| 904 |
\PValue{font} & \Macro{huge} \\ |
| 905 |
\bottomrule\\ |
| 906 |
\multicolumn{2}{@{}l}{\bfseries |
| 907 |
With \OptionValueRef{maincls}{headings}{normal}:}\\ |
| 908 |
\toprule |
| 909 |
Attribute & Default Value \\ |
| 910 |
\midrule |
| 911 |
\PValue{afterskip} |
| 912 |
& \PValue{1.5\Length{baselineskip} plus .1\Length{baselineskip} |
| 913 |
minus .167\Length{baselineskip}} \\ |
| 914 |
\PValue{beforeskip} |
| 915 |
& \PValue{-3\Length{baselineskip}-\Length{parskip}} \\ |
| 916 |
\PValue{font} & \Macro{LARGE} \\ |
| 917 |
\bottomrule\\ |
| 918 |
\multicolumn{2}{@{}l}{\bfseries |
| 919 |
With \OptionValueRef{maincls}{headings}{small}:}\\ |
| 920 |
\toprule |
| 921 |
Attribute & Default Value \\ |
| 922 |
\midrule |
| 923 |
\PValue{afterskip} |
| 924 |
& \PValue{1.35\Length{baselineskip} plus .09\Length{baselineskip} |
| 925 |
minus .15\Length{baselineskip}} \\ |
| 926 |
\PValue{beforeskip} |
| 927 |
& \PValue{-2.8\Length{baselineskip}-\Length{parskip}} \\ |
| 928 |
\PValue{font} & \Macro{Large} \\ |
| 929 |
\bottomrule |
| 930 |
\end{tabular} |
| 931 |
\end{table} |
| 932 |
|
| 933 |
%begin{table} |
| 934 |
% \centering |
| 935 |
\begin{longtable}{@{}p{\columnwidth}@{}} |
| 936 |
\caption{Defaults for the headings of \Class{scrbook} and |
| 937 |
\Class{scrreprt}}% |
| 938 |
\label{tab:maincls.section.defaults}\\ |
| 939 |
\endfirsthead |
| 940 |
\caption[]{Default for the headings of \Class{scrbook} and |
| 941 |
\Class{scrreprt} \emph{(continued)}}\\ |
| 942 |
\addlinespace[-\normalbaselineskip] |
| 943 |
\endhead |
| 944 |
\raggedleft\dots\\ |
| 945 |
\endfoot |
| 946 |
\endlastfoot |
| 947 |
\DescRef{maincls.cmd.part}: \\* |
| 948 |
\begin{tabularx}{\linewidth}{ll} |
| 949 |
\toprule |
| 950 |
Attribute & Default Value \\ |
| 951 |
\midrule |
| 952 |
\PValue{afterskip} & \PValue{0pt plus 1fil} \\ |
| 953 |
\PValue{beforeskip} & \PValue{0pt plus 1fil + \Length{baselineskip}} \\ |
| 954 |
\PValue{font} & see element \DescRef{maincls.fontelement.part}, |
| 955 |
\autoref{tab:maincls.structureElementsFont}, |
| 956 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 957 |
\PValue{innerskip} & \PValue{20pt} \\ |
| 958 |
\PValue{level} & -1 \\ |
| 959 |
\PValue{prefixfont} & see element |
| 960 |
\DescRef{maincls.fontelement.partnumber}, |
| 961 |
\autoref{tab:maincls.structureElementsFont}, |
| 962 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 963 |
\PValue{tocindent} & \PValue{0pt} \\ |
| 964 |
\PValue{toclevel} & -1 \\ |
| 965 |
\PValue{tocnumwidth} & \PValue{2em} \\ |
| 966 |
\PValue{tocstyle} & \PValue{part} \\ |
| 967 |
\bottomrule |
| 968 |
\end{tabularx} \\ |
| 969 |
\addlinespace[\normalbaselineskip] |
| 970 |
\DescRef{maincls.cmd.chapter}: \\* |
| 971 |
\begin{tabularx}{\linewidth}{ll} |
| 972 |
\toprule |
| 973 |
Attribute & Default Value \\ |
| 974 |
\midrule |
| 975 |
\PValue{afterskip} & see \autoref{tab:maincls.chapter.skips} \\ |
| 976 |
\PValue{beforeskip} & see \autoref{tab:maincls.chapter.skips} \\ |
| 977 |
\PValue{font} & see element \DescRef{maincls.fontelement.chapter}, |
| 978 |
\autoref{tab:maincls.structureElementsFont}, |
| 979 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 980 |
\PValue{innerskip} & \PValue{0.5\Length{baselineskip}} \\ |
| 981 |
\PValue{level} & 0 \\ |
| 982 |
\PValue{prefixfont} & see element |
| 983 |
\DescRef{maincls.fontelement.chapterprefix}, |
| 984 |
\autoref{tab:maincls.structureElementsFont}, |
| 985 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 986 |
\PValue{tocindent} & \PValue{0pt} \\ |
| 987 |
\PValue{toclevel} & 0 \\ |
| 988 |
\PValue{tocnumwidth} & \PValue{1.5em} \\ |
| 989 |
\PValue{tocstyle} & \PValue{chapter} \\ |
| 990 |
\bottomrule |
| 991 |
\end{tabularx} \\ |
| 992 |
\addlinespace[\normalbaselineskip] |
| 993 |
\DescRef{maincls.cmd.section}: \\* |
| 994 |
\begin{tabularx}{\linewidth}{ll} |
| 995 |
\toprule |
| 996 |
Attribute & Default Value \\ |
| 997 |
\midrule |
| 998 |
\PValue{afterskip} & \PValue{2.3ex plus .2ex} \\ |
| 999 |
\PValue{beforeskip} & \PValue{-3.5ex plus -1ex minus -.2ex} \\ |
| 1000 |
\PValue{font} & see element \DescRef{maincls.fontelement.section}, |
| 1001 |
\autoref{tab:maincls.structureElementsFont}, |
| 1002 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 1003 |
\PValue{indent} & \PValue{0pt} \\ |
| 1004 |
\PValue{level} & 1 \\ |
| 1005 |
\PValue{tocindent} & \PValue{1.5em}\\ |
| 1006 |
\PValue{toclevel} & 1 \\ |
| 1007 |
\PValue{tocnumwidth} & \PValue{2.3em}\\ |
| 1008 |
\PValue{tocstyle} & \PValue{section} \\ |
| 1009 |
\bottomrule |
| 1010 |
\end{tabularx} \\ |
| 1011 |
\addlinespace[\normalbaselineskip] |
| 1012 |
\DescRef{maincls.cmd.subsection}: \\* |
| 1013 |
\begin{tabularx}{\linewidth}{ll} |
| 1014 |
\toprule |
| 1015 |
Attribute & Default Value \\ |
| 1016 |
\midrule\nopagebreak |
| 1017 |
\PValue{afterskip} & \PValue{1.5ex plus .2ex} \\ |
| 1018 |
\PValue{beforeskip} & \PValue{-3.25ex plus -1ex minus -.2ex} \\ |
| 1019 |
\PValue{font} & see element |
| 1020 |
\DescRef{maincls.fontelement.subsection}, |
| 1021 |
\autoref{tab:maincls.structureElementsFont}, |
| 1022 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 1023 |
\PValue{indent} & \PValue{0pt} \\ |
| 1024 |
\PValue{level} & 2 \\ |
| 1025 |
\PValue{tocindent} & \PValue{3.8em}\\ |
| 1026 |
\PValue{toclevel} & 2 \\ |
| 1027 |
\PValue{tocnumwidth} & \PValue{3.2em}\\ |
| 1028 |
\PValue{tocstyle} & \PValue{section} \\ |
| 1029 |
\bottomrule |
| 1030 |
\end{tabularx} \\ |
| 1031 |
\addlinespace[\normalbaselineskip] |
| 1032 |
\DescRef{maincls.cmd.subsubsection}: \\* |
| 1033 |
\begin{tabularx}{\linewidth}{ll} |
| 1034 |
\toprule |
| 1035 |
Attribute & Default Value \\ |
| 1036 |
\midrule\nopagebreak |
| 1037 |
\PValue{afterskip} & \PValue{1.5ex plus .2ex} \\ |
| 1038 |
\PValue{beforeskip} & \PValue{-3.25ex plus -1ex minus -.2ex} \\ |
| 1039 |
\PValue{font} & see element |
| 1040 |
\DescRef{maincls.fontelement.subsubsection}, |
| 1041 |
\autoref{tab:maincls.structureElementsFont}, |
| 1042 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 1043 |
\PValue{indent} & \PValue{0pt} \\ |
| 1044 |
\PValue{level} & 3 \\ |
| 1045 |
\PValue{tocindent} & \PValue{7.0em}\\ |
| 1046 |
\PValue{tocnumwidth} & \PValue{4.1em}\\ |
| 1047 |
\PValue{toclevel} & 3 \\ |
| 1048 |
\PValue{tocstyle} & \PValue{section} \\ |
| 1049 |
\bottomrule |
| 1050 |
\end{tabularx} \\ |
| 1051 |
\addlinespace[\normalbaselineskip] |
| 1052 |
\DescRef{maincls.cmd.paragraph}: \\* |
| 1053 |
\begin{tabularx}{\linewidth}{ll} |
| 1054 |
\toprule |
| 1055 |
Attribute & Default Value \\ |
| 1056 |
\midrule\nopagebreak |
| 1057 |
\PValue{afterskip} & \PValue{-1em} \\ |
| 1058 |
\PValue{beforeskip} & \PValue{3.25ex plus 1ex minus .2ex} \\ |
| 1059 |
\PValue{font} & see element \DescRef{maincls.fontelement.paragraph}, |
| 1060 |
\autoref{tab:maincls.structureElementsFont}, |
| 1061 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 1062 |
\PValue{indent} & \PValue{0pt} \\ |
| 1063 |
\PValue{level} & 4 \\ |
| 1064 |
\PValue{tocindent} & \PValue{10em}\\ |
| 1065 |
\PValue{toclevel} & 4 \\ |
| 1066 |
\PValue{tocnumwidth} & \PValue{5em}\\ |
| 1067 |
\PValue{tocstyle} & \PValue{section} \\ |
| 1068 |
\bottomrule |
| 1069 |
\end{tabularx} \\ |
| 1070 |
\addlinespace[\normalbaselineskip] |
| 1071 |
\DescRef{maincls.cmd.subparagraph}: \\* |
| 1072 |
\begin{tabularx}{\linewidth}{ll} |
| 1073 |
\toprule |
| 1074 |
Attribute & Default Value \\ |
| 1075 |
\midrule\nopagebreak |
| 1076 |
\PValue{afterskip} & \PValue{-1em} \\ |
| 1077 |
\PValue{beforeskip} & \PValue{3.25ex plus 1ex minus .2ex} \\ |
| 1078 |
\PValue{font} & see element |
| 1079 |
\DescRef{maincls.fontelement.subparagraph}, |
| 1080 |
\autoref{tab:maincls.structureElementsFont}, |
| 1081 |
\autopageref{tab:maincls.structureElementsFont} \\ |
| 1082 |
\PValue{indent} & \Macro{scr@parindent} \\ |
| 1083 |
\PValue{level} & 5 \\ |
| 1084 |
\PValue{tocindent} & \PValue{12em}\\ |
| 1085 |
\PValue{toclevel} & 5 \\ |
| 1086 |
\PValue{tocnumwidth} & \PValue{6em}\\ |
| 1087 |
\PValue{tocstyle} & \PValue{section} \\ |
| 1088 |
\bottomrule |
| 1089 |
\end{tabularx} |
| 1090 |
\end{longtable} |
| 1091 |
%end{table} |
| 1092 |
Incidentally, the internal macro \Macro{scr@parindent} used in the settings |
| 1093 |
for \DescRef{maincls.cmd.subparagraph} is the paragraph indent set by the |
| 1094 |
\DescRef{maincls.option.parskip} option or the |
| 1095 |
\DescRef{maincls-experts.cmd.setparsizes} command. |
| 1096 |
\EndIndexGroup |
| 1097 |
|
| 1098 |
|
| 1099 |
\begin{Declaration} |
| 1100 |
\Macro{DeclareSectionCommands}\OParameter{attributes} |
| 1101 |
\Parameter{list of names}% |
| 1102 |
\Macro{DeclareNewSectionCommands}\OParameter{attributes} |
| 1103 |
\Parameter{list of names}% |
| 1104 |
\Macro{RedeclareSectionCommands}\OParameter{attributes} |
| 1105 |
\Parameter{list of names}% |
| 1106 |
\Macro{ProvideSectionCommands}\OParameter{attributes} |
| 1107 |
\Parameter{list of names} |
| 1108 |
\end{Declaration} |
| 1109 |
These\ChangedAt{v3.15}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1110 |
\Class{scrartcl}} commands can define or change a whole series of |
| 1111 |
sectioning commands at once. The names of the sectioning commands are given by |
| 1112 |
the comma-separated \PName{list of names}. |
| 1113 |
|
| 1114 |
These commands differ in two other ways from the previously described commands |
| 1115 |
that only define or change a single sectioning command. First, in case of |
| 1116 |
error\,---\,that is if a command already exists with |
| 1117 |
\Macro{DeclareNewSectionCommands} or is undefined with |
| 1118 |
\Macro{RedeclareSectionCommands}\,---\,the definition will be performed |
| 1119 |
regardless. An appropriate an error message will, of course, be reported |
| 1120 |
anyway. |
| 1121 |
|
| 1122 |
Second, there is another attribute, |
| 1123 |
\important{\PValue{increaselevel}}\OptionVName{increaselevel}{integer}. This |
| 1124 |
attribute changes the meaning of the attributes \PValue{level} and |
| 1125 |
\PValue{toclevel} (see \autoref{tab:maincls-experts.declaresection.keys}) so |
| 1126 |
that their values become starting values for the first sectioning command of |
| 1127 |
the \PName{list of names}. For all other sectioning command in the \PName{list |
| 1128 |
of names}, the values of \PValue{level} and \PValue{toclevel} are successively |
| 1129 |
increased by the value of \PValue{increaselevel}. If the |
| 1130 |
\PValue{increaselevel} attribute is used without assigning a value, 1 is |
| 1131 |
assumed.% |
| 1132 |
\EndIndexGroup |
| 1133 |
|
| 1134 |
|
| 1135 |
\begin{Declaration} |
| 1136 |
\Macro{IfSectionCommandStyleIs}\Parameter{name}\Parameter{style} |
| 1137 |
\Parameter{then code}\Parameter{else code} |
| 1138 |
\end{Declaration} |
| 1139 |
In\ChangedAt{v3.27}{\Class{scrbook}\and \Class{scrreprt}\and \Class{scrartcl}} |
| 1140 |
rare cases, it is useful to be able to test whether a sectioning command |
| 1141 |
belongs to a specific \PName{style}. If \KOMAScript{} has defined the |
| 1142 |
sectioning command \Macro{\PName{name}} using the given \PName{style}, the |
| 1143 |
\PName{then code} will be used. Otherwise the \PName{else code} will be |
| 1144 |
executed. An error is reported if \Macro{\PName{name}} is undefined or if it |
| 1145 |
is not a \KOMAScript{} sectioning command.% |
| 1146 |
\EndIndexGroup |
| 1147 |
|
| 1148 |
|
| 1149 |
\begin{Declaration} |
| 1150 |
\Macro{chapterheadstartvskip} |
| 1151 |
\Macro{chapterheadmidvskip} |
| 1152 |
\Macro{chapterheadendvskip} |
| 1153 |
\Macro{partheadstartvskip} |
| 1154 |
\Macro{partheadmidvskip} |
| 1155 |
\Macro{partheadendvskip} |
| 1156 |
\Macro{partheademptypage} |
| 1157 |
\end{Declaration} |
| 1158 |
These\important[i]{\DescRef{maincls.cmd.chapter}\\ |
| 1159 |
\DescRef{maincls.cmd.part}\\ |
| 1160 |
\DescRef{maincls.cmd.addchap}\\ |
| 1161 |
\DescRef{maincls.cmd.addpart}\\ |
| 1162 |
\DescRef{maincls.cmd.chapter*}\\ |
| 1163 |
\DescRef{maincls.cmd.part*}\\ |
| 1164 |
\DescRef{maincls.cmd.addchap*}\\ |
| 1165 |
\DescRef{maincls.cmd.addpart*}} commands are used inside the headings of the |
| 1166 |
previously described \PValue{chapter} and \PValue{part} styles and thus for |
| 1167 |
the definitions of \DescRef{maincls.cmd.chapter}\IndexCmd{chapter}, |
| 1168 |
\DescRef{maincls.cmd.part}\IndexCmd{part}, |
| 1169 |
\DescRef{maincls.cmd.addchap}\IndexCmd{addchap}, and |
| 1170 |
\DescRef{maincls.cmd.addpart}\IndexCmd{addpart}, as well as their starred |
| 1171 |
variants \DescRef{maincls.cmd.chapter*}\IndexCmd{chapter*}, |
| 1172 |
\DescRef{maincls.cmd.part*}\IndexCmd{part*}, |
| 1173 |
\DescRef{maincls.cmd.addchap*}\IndexCmd{addchap*}, and |
| 1174 |
\DescRef{maincls.cmd.addpart*}\IndexCmd{addpart*}. |
| 1175 |
The \Macro{chapterheadstartvskip} command is intended to insert a |
| 1176 |
vertical skip before the chapter heading. Similarly, |
| 1177 |
\Macro{chapterheadendvskip} is a command intended to insert a vertical |
| 1178 |
skip after the chapter heading. If\ChangedAt{v3.15}{\Class{scrbook}\and |
| 1179 |
\Class{scrreprt}} the chapter heading has a prefix number line (see option |
| 1180 |
\DescRef{maincls.option.chapterprefix} in \autoref{sec:maincls.structure}, |
| 1181 |
\DescPageRef{maincls.option.chapterprefix}), \Macro{chapterheadmidvskip} |
| 1182 |
is also used between the number line and the heading text. |
| 1183 |
|
| 1184 |
The \Macro{partheadstartvskip} and \Macro{partheadendvskip} commands insert |
| 1185 |
vertical skips above and below part headings. A page break is interpreted as |
| 1186 |
part of the vertical distance. Such a page break is part of the default |
| 1187 |
definitions of \Macro{partheadendvskip} in |
| 1188 |
\Class{scrbook}\OnlyAt{\Class{scrbook}\and \Class{scrreprt}} and |
| 1189 |
\Class{scrreprt}. The |
| 1190 |
\Macro{partheademptypage}\ChangedAt{v3.02}{\Class{scrbook}\and |
| 1191 |
\Class{scrreprt}} command produces an empty page after the part heading page |
| 1192 |
of \Class{scrbook} and \Class{scrreprt}. |
| 1193 |
|
| 1194 |
Starting with \KOMAScript~3.15\ChangedAt{v3.15}{\Class{scrbook}\and |
| 1195 |
\Class{scrreprt}\and \Class{scrartcl}}, the defaults of these seven commands |
| 1196 |
are independent from the \DescRef{maincls.option.headings} option (see |
| 1197 |
\autoref{sec:maincls.structure}, |
| 1198 |
\DescPageRef{maincls.option.headings}). The default definitions for the |
| 1199 |
chapter headings starting with |
| 1200 |
\KOMAScript~3.17\ChangedAt{v3.17}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1201 |
\Class{scrartcl}} correspond to:\IndexLength{@tempskipa} |
| 1202 |
\begin{lstcode} |
| 1203 |
\newcommand*{\chapterheadstartvskip}{\vspace{\@tempskipa}} |
| 1204 |
\newcommand*{\chapterheadmidvskip}{\par\nobreak\vskip\@tempskipa} |
| 1205 |
\newcommand*{\chapterheadendvskip}{\vskip\@tempskipa} |
| 1206 |
\end{lstcode} |
| 1207 |
These defaults are reactivated every time you use |
| 1208 |
\OptionValueRef{maincls}{headings}{big}\IndexOption{headings}, |
| 1209 |
\OptionValueRef{maincls}{headings}{normal}, or |
| 1210 |
\OptionValueRef{maincls}{headings}{small}. As a side effect, these options may |
| 1211 |
affect not only chapter titles but all headings in the \PValue{chapter} style |
| 1212 |
|
| 1213 |
The \PValue{chapter} style automatically sets the internal length |
| 1214 |
\Length{@tempskipa} to the value that results from the |
| 1215 |
\DescRef{\LabelBase.cmd.DeclareSectionCommand}\IndexCmd{DeclareSectionCommand} |
| 1216 |
attribute \PValue{beforeskip} before calling \Macro{chapterheadstartvskip}. |
| 1217 |
Similarly, it sets this length to the value of the \PValue{afterskip} |
| 1218 |
attribute before calling \Macro{chapterheadendvskip}, and to |
| 1219 |
\PValue{innerskip} before calling \Macro{chapterheadmidvskip}. |
| 1220 |
|
| 1221 |
The default values of the distances of \DescRef{maincls.cmd.part} do not |
| 1222 |
depend on the \DescRef{maincls.option.headings} option. So the corresponding |
| 1223 |
commands will not be redefined by this option. |
| 1224 |
Their\ChangedAt{v3.17}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1225 |
\Class{scrartcl}} default definitions in \Class{scrbook} and \Class{scrreprt} |
| 1226 |
correspond to: |
| 1227 |
\begin{lstcode} |
| 1228 |
\newcommand*{\partheadstartvskip}{% |
| 1229 |
\null\vskip-\baselineskip\vskip\@tempskipa |
| 1230 |
} |
| 1231 |
\newcommand*{\partheadmidvskip}{% |
| 1232 |
\par\nobreak |
| 1233 |
\vskip\@tempskipa |
| 1234 |
} |
| 1235 |
\newcommand*{\partheadendvskip}{% |
| 1236 |
\vskip\@tempskipa\newpage |
| 1237 |
} |
| 1238 |
\end{lstcode} |
| 1239 |
and of \Class{scrartcl}: |
| 1240 |
\begin{lstcode} |
| 1241 |
\newcommand*{\partheadstartvskip}{% |
| 1242 |
\addvspace{\@tempskipa}% |
| 1243 |
} |
| 1244 |
\newcommand*{\partheadmidvskip}{% |
| 1245 |
\par\nobreak |
| 1246 |
} |
| 1247 |
\newcommand*{\partheadendvskip}{% |
| 1248 |
\vskip\@tempskipa |
| 1249 |
} |
| 1250 |
\end{lstcode} |
| 1251 |
The \PValue{part} style once again sets the internal length |
| 1252 |
\Length{@tempskipa}\IndexLength{@tempskipa} according to the settings of |
| 1253 |
\DescRef{\LabelBase.cmd.DeclareSectionCommand}\IndexCmd{DeclareSectionCommand} |
| 1254 |
before using the commands. |
| 1255 |
|
| 1256 |
If you redefine one of the commands used for the vertical skip in the original |
| 1257 |
\Length{@tempskipa} but still want to be able to configure the lengths, for |
| 1258 |
example with \DescRef{\LabelBase.cmd.RedeclareSectionCommand}, you should also |
| 1259 |
use \Length{@tempskipa} in the new definition. |
| 1260 |
Since\ChangedAt{v3.17}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1261 |
\Class{scrartcl}} you can more easily configure the distances above, within, |
| 1262 |
and below the headings using \DescRef{\LabelBase.cmd.RedeclareSectionCommand}, |
| 1263 |
you generally should not redefine the commands described here. Changing them |
| 1264 |
should be reserved for more complex changes that cannot be accomplished with |
| 1265 |
\DescRef{\LabelBase.cmd.RedeclareSectionCommand}. An\textnote{Example!} |
| 1266 |
example that redefines \Macro{chapterheadstartvskip} and |
| 1267 |
\Macro{chapterheadendvskip} to print extra rules above and below the chapter |
| 1268 |
heading can be found at \cite{homepage} (in German).% |
| 1269 |
% |
| 1270 |
\EndIndexGroup |
| 1271 |
|
| 1272 |
|
| 1273 |
\begin{Declaration} |
| 1274 |
\Macro{partlineswithprefixformat}% |
| 1275 |
\Parameter{level}\Parameter{number}\Parameter{text}% |
| 1276 |
\end{Declaration} |
| 1277 |
This\ChangedAt{v3.25}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1278 |
\Class{scrartcl}} command is used by headings with the \PValue{part} style to |
| 1279 |
output the heading number and heading text. The \PName{number} and |
| 1280 |
\PName{text} arguments are already formatted, including the font |
| 1281 |
selections. Ultimately, this command controls the arrangement of the two parts |
| 1282 |
of the heading. For unnumbered headings, \PName{number} is a completely empty |
| 1283 |
argument, so it does not contain any formatting commands. |
| 1284 |
|
| 1285 |
The default definition is rather Spartan: |
| 1286 |
\begin{lstcode} |
| 1287 |
\newcommand{\partlineswithprefixformat}[3]{% |
| 1288 |
#2#3% |
| 1289 |
} |
| 1290 |
\end{lstcode} |
| 1291 |
|
| 1292 |
\begin{Example} |
| 1293 |
You want to have part headings in a light blue box with blue frame. The |
| 1294 |
box should occupy only about three quarters of full width of the text |
| 1295 |
area. So you try: |
| 1296 |
\begin{lstcode} |
| 1297 |
\documentclass{scrbook} |
| 1298 |
\usepackage{xcolor} |
| 1299 |
\renewcommand*{\partlineswithprefixformat}[3]{% |
| 1300 |
\fcolorbox{blue}{blue!25}{% |
| 1301 |
\parbox{.75\linewidth}{#2#3}% |
| 1302 |
}% |
| 1303 |
} |
| 1304 |
\begin{document} |
| 1305 |
\part{Framed Part} |
| 1306 |
\end{document} |
| 1307 |
\end{lstcode} |
| 1308 |
But surprisingly the heading is not longer centred\,---\,neither the box |
| 1309 |
itself nor the text inside the box. |
| 1310 |
|
| 1311 |
The reason for the missing centring of the box is that the end of the |
| 1312 |
paragraph is hidden in the third argument of the command. So it still |
| 1313 |
finishes the paragraph of the text inside the box but not the paragraph of |
| 1314 |
the \Macro{parbox} itself. To solve this you add a \Macro{par} at the end of |
| 1315 |
the definition. |
| 1316 |
|
| 1317 |
The reason for the missing centring inside the box is that the alignment of |
| 1318 |
\DescRef{maincls.cmd.raggedpart} is valid outside the box but not |
| 1319 |
automatically inside a \Macro{parbox}. To solve this you add |
| 1320 |
\Macro{raggedpart} inside the box. |
| 1321 |
|
| 1322 |
With |
| 1323 |
\begin{lstcode} |
| 1324 |
\documentclass{scrbook} |
| 1325 |
\usepackage{xcolor} |
| 1326 |
\renewcommand*{\partlineswithprefixformat}[3]{% |
| 1327 |
\fcolorbox{blue}{blue!25}{% |
| 1328 |
\parbox{.75\linewidth}{\raggedpart #2#3}% |
| 1329 |
}% |
| 1330 |
} |
| 1331 |
\par |
| 1332 |
\begin{document} |
| 1333 |
\part{Framed Part} |
| 1334 |
\end{document} |
| 1335 |
\end{lstcode} |
| 1336 |
you get the expected result. |
| 1337 |
\end{Example} |
| 1338 |
|
| 1339 |
As the example shows, users who redefine this command must watch out for |
| 1340 |
several side effects. In addition to preserving the text alignment, they also |
| 1341 |
must prevent page breaks within the headings, for example if they insert extra |
| 1342 |
paragraphs or space. The example above does not have this problem. Not only |
| 1343 |
does the box prevent a page breaks anyway, but \KOMAScript{} itself also |
| 1344 |
changes \Macro{interlinepenalty} as part of \PName{text} so to prevent page |
| 1345 |
breaks there. It also finishes \PName{text} with an internal paragraph break |
| 1346 |
using \Macro{@@par}. |
| 1347 |
|
| 1348 |
The default definition of \Macro{partlineswithprefixformat} does not use the |
| 1349 |
first argument, \PName{level}, nor is it needed in the example above. It is of |
| 1350 |
interest only if you want to define several commands with the \PValue{part} |
| 1351 |
style and need to distinguish the different levels. The predefined commands |
| 1352 |
\DescRef{maincls.cmd.part}, \DescRef{maincls.cmd.part*}, |
| 1353 |
\DescRef{maincls.cmd.addpart}, and \DescRef{maincls.cmd.addpart*} all share |
| 1354 |
the same \PName{level} \PName{part}.% |
| 1355 |
\EndIndexGroup |
| 1356 |
|
| 1357 |
|
| 1358 |
\begin{Declaration} |
| 1359 |
\Macro{chapterlineswithprefixformat}% |
| 1360 |
\Parameter{level}\Parameter{number}\Parameter{text}% |
| 1361 |
\Macro{chapterlinesformat}% |
| 1362 |
\Parameter{level}\Parameter{number}\Parameter{text} |
| 1363 |
\end{Declaration} |
| 1364 |
These\ChangedAt{v3.19}{\Class{scrbook}\and \Class{scrreprt}} commands are used |
| 1365 |
by headings with the \PValue{chapter} style to output the heading number and |
| 1366 |
heading text, depending on the |
| 1367 |
\DescRef{maincls.option.chapterprefix}\IndexOption{chapterprefix}% |
| 1368 |
\textnote{\DescRef{maincls.option.chapterprefix}} option (see |
| 1369 |
\autoref{sec:maincls.structure}, |
| 1370 |
\DescPageRef{maincls.option.chapterprefix}). If the option is \PValue{true}, |
| 1371 |
\Macro{chapterlineswithprefixformat} is used. Otherwise |
| 1372 |
\Macro{chapterlinesformat} determines the ouput. |
| 1373 |
|
| 1374 |
The \PName{number} and \PName{text} arguments are already formatted, including |
| 1375 |
the font selections. Ultimately, these commands thus control the arrangement |
| 1376 |
of the two parts of the heading. For unnumbered headings, the \PName{number} |
| 1377 |
argument is completely empty, so it does not contain any formatting commands. |
| 1378 |
|
| 1379 |
The\textnote{default} defaults for these commands are: |
| 1380 |
\begin{lstcode} |
| 1381 |
\newcommand{\chapterlinesformat}[3]{% |
| 1382 |
\@hangfrom{#2}{#3}% |
| 1383 |
} |
| 1384 |
\newcommand{\chapterlineswithprefixformat}[3]{% |
| 1385 |
#2#3% |
| 1386 |
} |
| 1387 |
\end{lstcode} |
| 1388 |
|
| 1389 |
\begin{Example} |
| 1390 |
You want to have chapter headings with yellow background. For the headings |
| 1391 |
without a prefix line, you use the following definition in the document |
| 1392 |
preamble: |
| 1393 |
\begin{lstcode} |
| 1394 |
\makeatletter |
| 1395 |
\renewcommand{\chapterlinesformat}[3]{% |
| 1396 |
\colorbox{yellow}{% |
| 1397 |
\parbox{\dimexpr\linewidth-2\fboxrule-2\fboxsep}{% |
| 1398 |
\@hangfrom{#2}#3% |
| 1399 |
}% |
| 1400 |
}% |
| 1401 |
} |
| 1402 |
\makeatother |
| 1403 |
\end{lstcode} |
| 1404 |
For chapter headings with prefix line, you use: |
| 1405 |
\begin{lstcode} |
| 1406 |
\renewcommand{\chapterlineswithprefixformat}[3]{% |
| 1407 |
\colorbox{yellow}{% |
| 1408 |
\parbox{\dimexpr\linewidth-2\fboxrule-2\fboxsep}{% |
| 1409 |
#2#3% |
| 1410 |
}% |
| 1411 |
}% |
| 1412 |
} |
| 1413 |
\end{lstcode} |
| 1414 |
Unfortunately, you discover that these redefinitions result in justified |
| 1415 |
text for the headings. The reason is the \Macro{parbox} command. To change |
| 1416 |
this, you can use the \DescRef{maincls.cmd.raggedchapter} command (see |
| 1417 |
\autoref{sec:maincls.structure}, \DescPageRef{maincls.cmd.raggedchapter}) |
| 1418 |
inside the argument of \Macro{parbox}. Otherwise \Macro{raggedchapter} would |
| 1419 |
be used only before \Macro{chapterlineswithprefixformat} and |
| 1420 |
\Macro{chapterlinesformat}: |
| 1421 |
\begin{lstcode} |
| 1422 |
\makeatletter |
| 1423 |
\renewcommand{\chapterlinesformat}[3]{% |
| 1424 |
\colorbox{yellow}{% |
| 1425 |
\parbox{\dimexpr\linewidth-2\fboxrule-2\fboxsep}{% |
| 1426 |
\raggedchapter |
| 1427 |
\@hangfrom{#2}#3% |
| 1428 |
}% |
| 1429 |
}% |
| 1430 |
} |
| 1431 |
\makeatother |
| 1432 |
\renewcommand{\chapterlineswithprefixformat}[3]{% |
| 1433 |
\colorbox{yellow}{% |
| 1434 |
\parbox{\dimexpr\linewidth-2\fboxrule-2\fboxsep}{% |
| 1435 |
\raggedchapter |
| 1436 |
#2#3% |
| 1437 |
}% |
| 1438 |
}% |
| 1439 |
} |
| 1440 |
\end{lstcode} |
| 1441 |
Remember to use \Macro{makeatletter} and \Macro{makeatother} only in the |
| 1442 |
document preamble. Do not use it inside your own wrapper class or package. |
| 1443 |
They are only needed here because of \Macro{@hangfrom} in the definition of |
| 1444 |
\Macro{chapterlinesformat}. |
| 1445 |
\end{Example} |
| 1446 |
|
| 1447 |
As the example shows, users who redefine this command must watch out for |
| 1448 |
several side effects. In addition to preserving the text alignment, they also |
| 1449 |
must prevent page breaks within the headings, for example if they insert extra |
| 1450 |
paragraphs or space. The example above does not have this problem. Not only |
| 1451 |
does the box prevent a page breaks anyway, but \KOMAScript{} itself also |
| 1452 |
changes \Macro{interlinepenalty} as part of \PName{text} so to prevent page |
| 1453 |
breaks there. It also finishes \PName{text} with an internal paragraph break |
| 1454 |
using \Macro{@@par}. |
| 1455 |
|
| 1456 |
Incidentally, the \DescRef{maincls.cmd.raggedchapter} command is not part of |
| 1457 |
\PName{text}, as otherwise using \Macro{MakeUppercase} inside redefined |
| 1458 |
versions of these two commands would be much more difficult. Note, however, |
| 1459 |
that typographic rules require individual adjustments of letter spacing in |
| 1460 |
capitalised text. However the \LaTeX{} \Macro{MakeUppercase} command does not |
| 1461 |
do this. |
| 1462 |
|
| 1463 |
The default definitions do not use the first argument, \PName{level}, nor is |
| 1464 |
it needed in the example above. It is of interest only if you want to define |
| 1465 |
several commands with the \PValue{chapter} style and need to distinguish the |
| 1466 |
different levels. The predefined commands \DescRef{maincls.cmd.chapter}, |
| 1467 |
\DescRef{maincls.cmd.chapter*}, \DescRef{maincls.cmd.addchap}, and |
| 1468 |
\DescRef{maincls.cmd.addchap*} all share the same \PName{level} |
| 1469 |
\PName{chapter}.% |
| 1470 |
\EndIndexGroup |
| 1471 |
|
| 1472 |
|
| 1473 |
\begin{Declaration} |
| 1474 |
\Macro{sectionlinesformat}% |
| 1475 |
\Parameter{level}\Parameter{indent}\Parameter{number}\Parameter{text}% |
| 1476 |
\Macro{sectioncatchphraseformat}% |
| 1477 |
\Parameter{level}\Parameter{indent}\Parameter{number}\Parameter{text}% |
| 1478 |
\end{Declaration} |
| 1479 |
These\ChangedAt{v3.19}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1480 |
\Class{scrartcl}} commands are used by headings with the \PValue{section} |
| 1481 |
style depending on whether the heading is run-in or on its own line. |
| 1482 |
Free-standing headings use \Macro{sectionlinesformat} for their output, while |
| 1483 |
run-in headings use \Macro{sectioncatchphraseformat}. |
| 1484 |
|
| 1485 |
In both cases \PName{indent} is the value of the horizontal indention of the |
| 1486 |
heading relative to the text area. If the value is negative, the heading can |
| 1487 |
protrude into the left margin. |
| 1488 |
|
| 1489 |
The arguments \PName{number} and \PName{text} are already formatted, including |
| 1490 |
the font settings. Ultimately, these commands thus control the arrangement of |
| 1491 |
the two parts of the heading. For unnumbered headings, the \PName{number} |
| 1492 |
argument is completely empty, so it does not contain any formatting commands. |
| 1493 |
|
| 1494 |
The default definitions are: |
| 1495 |
\begin{lstcode} |
| 1496 |
\newcommand{\sectionlinesformat}[4]{% |
| 1497 |
\@hangfrom{\hskip #2#3}{#4}% |
| 1498 |
} |
| 1499 |
\newcommand{\sectioncatchphraseformat}[4]{% |
| 1500 |
\hskip #2#3#4% |
| 1501 |
} |
| 1502 |
\end{lstcode} |
| 1503 |
|
| 1504 |
If you redefine one of these commands, you are responsible for preventing page |
| 1505 |
breaks inside heading. \KOMAScript{} itself only changes |
| 1506 |
\Macro{interlinepenalty} to impede page breaks. |
| 1507 |
|
| 1508 |
\begin{Example} |
| 1509 |
As in the previous example with chapter headings, the free-standing headings |
| 1510 |
of the \PValue{section} \PName{level} should now be printed with a |
| 1511 |
background colour. Headings of lower levels should not be changed: |
| 1512 |
\begin{lstcode} |
| 1513 |
\makeatletter |
| 1514 |
\renewcommand{\sectionlinesformat}[4]{% |
| 1515 |
\@tempswafalse |
| 1516 |
\Ifstr{#1}{section}{% |
| 1517 |
\hspace*{#2}% |
| 1518 |
\colorbox{yellow}{% |
| 1519 |
\parbox{\dimexpr\linewidth-2\fboxrule-2\fboxsep-#2}{% |
| 1520 |
\raggedsection |
| 1521 |
\@hangfrom{#3}{#4}% |
| 1522 |
}% |
| 1523 |
}% |
| 1524 |
}{% |
| 1525 |
\@hangfrom{\hskip #2#3}{#4}% |
| 1526 |
}% |
| 1527 |
} |
| 1528 |
\makeatother |
| 1529 |
\end{lstcode} |
| 1530 |
With this code, area of the indention is not coloured if the heading is |
| 1531 |
indented. If, however, the heading is placed in the left margin with |
| 1532 |
negative indention, this area of the margin is also highlighted. You can |
| 1533 |
move the \Macro{hspace*} command into the \Macro{colorbox} to change this |
| 1534 |
behaviour. |
| 1535 |
|
| 1536 |
Again, remember to use \Macro{makeatletter} and \Macro{makeatother} only in |
| 1537 |
the document preamble. You should omit them inside your own wrapper class or |
| 1538 |
package. They are only needed because of \Macro{@hangfrom} in the definition |
| 1539 |
of \Macro{sectionlinesformat}. |
| 1540 |
\end{Example} |
| 1541 |
|
| 1542 |
The first argument, \PName{level}, is not used by the default definition. The |
| 1543 |
example shows how to use it to distinguish different heading levels of the |
| 1544 |
same style \PValue{section}.% |
| 1545 |
\EndIndexGroup |
| 1546 |
|
| 1547 |
|
| 1548 |
\begin{Declaration} |
| 1549 |
\DoHook{heading/preinit/\PName{name}}% |
| 1550 |
\DoHook{heading/postinit/\PName{name}}% |
| 1551 |
\DoHook{heading/branch/star/\PName{name}}% |
| 1552 |
\DoHook{heading/branch/nostar/\PName{name}}% |
| 1553 |
\DoHook{heading/begingroup/\PName{name}}% |
| 1554 |
\DoHook{heading/endgroup/\PName{name}}% |
| 1555 |
\end{Declaration} |
| 1556 |
\BeginIndex{}{hooks}% |
| 1557 |
In\ChangedAt[2019/01]{v3.27}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1558 |
\Class{scrartcl}} addition to all their attributes, |
| 1559 |
\DescRef{\LabelBase.cmd.DeclareSectionCommand}, |
| 1560 |
\DescRef{\LabelBase.cmd.DeclareNewSectionCommand}, |
| 1561 |
\DescRef{\LabelBase.cmd.ProvideSectionCommand} and |
| 1562 |
\DescRef{\LabelBase.cmd.RedeclareSectionCommand} provide several hooks in |
| 1563 |
sectioning commands that can be manipulated using |
| 1564 |
\DescRef{scrbase.cmd.AddtoDoHook}. For information about the functionality of |
| 1565 |
these \emph{do-hooks} see \autoref{sec:scrbase.hooks}, |
| 1566 |
\autopageref{sec:scrbase.hooks}. The last element of the specifier is the |
| 1567 |
\PName{name} of the sectioning command, as it is for the declaration commands |
| 1568 |
mentioned above. |
| 1569 |
|
| 1570 |
It is important\important{Attention!} to avoid adding code to these hooks that |
| 1571 |
would affect the page breaking or the position of the heading. Therefore only |
| 1572 |
advanced users should use these hooks. In case of doubt, refer to the class's |
| 1573 |
source code for information about exactly when a hook is executed. These hooks |
| 1574 |
serve as a fallback before you indeed would need to resort to redefining |
| 1575 |
a section command without using \KOMAScript{} features. |
| 1576 |
|
| 1577 |
The\textnote{\DoHHook{\dits/preinit/\dots}} hook |
| 1578 |
\DoHook{heading/preinit/\PName{name}} is executed immediately before the |
| 1579 |
sectioning command is initialised. At this point, no settings have been |
| 1580 |
initialised. Even the paragraph that precedes the heading is not |
| 1581 |
necessarily finished yet. |
| 1582 |
|
| 1583 |
The\textnote{\DoHook{\dots/postinit/\dots}} hook |
| 1584 |
\DoHook{heading/postinit/\PName{name}} is executed somewhat later. At this |
| 1585 |
point, some settings have been initialised and the previous paragraph has |
| 1586 |
already ended. |
| 1587 |
|
| 1588 |
Only\textnote{\DoHook{\dots/branch/\dots}} one of the hooks |
| 1589 |
\DoHook{heading/branch/nostar/\PName{name}} or |
| 1590 |
\DoHook{heading/branch/star/\PName{name}} is executed, after determining |
| 1591 |
whether the starred or normal variant of the section command is used. At this |
| 1592 |
point, the vertical gap above the heading has already been inserted. |
| 1593 |
|
| 1594 |
The\textnote{\DoHook{\dots/begingroup/\dots}} hook |
| 1595 |
\DoHook{heading/begingroup/\PName{name}} is executed at the beginning of |
| 1596 |
the group used to process the heading. This is also the last opportunity to |
| 1597 |
intervene before the heading is printed. |
| 1598 |
|
| 1599 |
Similarly\textnote{\DoHook{\dots/begingroup/\dots}}, the hook |
| 1600 |
\DoHook{heading/endgroup/\PName{name}} will be executed at the end of the |
| 1601 |
group used to process the heading. Currently this is the last hook inside |
| 1602 |
a section command. |
| 1603 |
|
| 1604 |
Note\textnote{\DescRef{maincls.cmd.minisec}} that |
| 1605 |
\DescRef{maincls.cmd.minisec} is not a real sectioning command and therefore |
| 1606 |
these hooks are not available for it.% |
| 1607 |
\EndIndexGroup |
| 1608 |
|
| 1609 |
\begin{Declaration} |
| 1610 |
\Macro{IfUseNumber}\Parameter{then code}\Parameter{else code} |
| 1611 |
\end{Declaration} |
| 1612 |
Strictly\ChangedAt{v3.27}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1613 |
\Class{scrartcl}} speaking, this is an internal command. It is defined |
| 1614 |
inside sectioning commands only between the \DoHook{\dots/begingroup/\dots} |
| 1615 |
and \DoHook{\dots/endgroup/\dots} hooks. In this case, the |
| 1616 |
\Parameter{then code} is executed if the sectioning heading uses the non-star |
| 1617 |
variant and should be numbered according to the value of |
| 1618 |
\DescRef{maincls.counter.secnumdepth}. If the heading should not be numbered |
| 1619 |
because the sectioning command uses the star variant or because of the value |
| 1620 |
of \DescRef{maincls.counter.secnumdepth}, the \PName{else code} is executed. |
| 1621 |
Headings in the \PValue{chapter} style also take into account whether |
| 1622 |
the headings appears in the main matter. |
| 1623 |
|
| 1624 |
If you use the command outside a sectioning command, the result is |
| 1625 |
unspecified. In this case, it will usually result in an error message and |
| 1626 |
execute neither the \PName{then code} nor the \PName{else code}.% |
| 1627 |
\EndIndexGroup |
| 1628 |
|
| 1629 |
\begin{Declaration} |
| 1630 |
\Macro{SecDef}\Parameter{star command}\Parameter{command}% |
| 1631 |
\Macro{scr@startsection}\Parameter{name}\Parameter{level}\Parameter{indent}% |
| 1632 |
\Parameter{beforeskip}\Parameter{afterskip}% |
| 1633 |
\Parameter{style commands}% |
| 1634 |
\OParameter{short version}\Parameter{heading}% |
| 1635 |
\labelsuffix[*]% |
| 1636 |
\Macro{scr@startsection}\Parameter{name}\Parameter{level}\Parameter{indent}% |
| 1637 |
\Parameter{beforeskip}\Parameter{afterskip}% |
| 1638 |
\Parameter{style commands}% |
| 1639 |
\PValue{*}\Parameter{heading}% |
| 1640 |
\labelsuffix% |
| 1641 |
\end{Declaration} |
| 1642 |
As\ChangedAt[2014/09]{v3.15}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1643 |
\Class{scrartcl}} already explained in \autoref{sec:maincls.structure} in the |
| 1644 |
description of the sectioning commands beginning with |
| 1645 |
\DescPageRef{maincls.cmd.chapter}, \KOMAScript{} provides additional features |
| 1646 |
for the optional argument of those commands. To achieve this, it was necessary |
| 1647 |
to replace some \LaTeX{} kernel commands: |
| 1648 |
\begin{itemize} |
| 1649 |
\item Instead of |
| 1650 |
\Macro{@startsection}\IndexCmd{@startsection}\important{\Macro{@startsection}} |
| 1651 |
\KOMAScript{} uses \Macro{scr@startsection}. However, the definition of |
| 1652 |
\Macro{@startsection} is checked. If the implementation differs from the |
| 1653 |
expected one, a warning is issued, several features of \KOMAScript{} |
| 1654 |
are deactivated, and \Macro{scr@startsection} uses a copy of |
| 1655 |
\Macro{@startsection} while \Macro{@startsection} is redefined to use |
| 1656 |
\Macro{scr@startsection}. |
| 1657 |
\item Instead of \Macro{@dblarg}\IndexCmd{@dblarg}\important{\Macro{@dblarg}} |
| 1658 |
\KOMAScript{} uses an internal command to define sectioning commands. |
| 1659 |
\item Instead of \Macro{secdef}\IndexCmd{secdef}\important{\Macro{secdef}}, |
| 1660 |
\KOMAScript{} uses \Macro{SecDef} to change \Macro{@dblarg} as |
| 1661 |
mentioned above. If the implementation of \Macro{secdef} differs from the |
| 1662 |
expected one, a warning is issued. |
| 1663 |
\item \Macro{@sect}\IndexCmd{@sect}\important{\Macro{@sect}} is redefined to |
| 1664 |
implement various extensions of \KOMAScript. |
| 1665 |
\item \Macro{@ssect}\IndexCmd{@ssect}\important{\Macro{@ssect}} is redefined |
| 1666 |
to implement various extensions of \KOMAScript. |
| 1667 |
\item \Macro{@xsect}\IndexCmd{@xsect}\important{\Macro{@xsect}} is redefined |
| 1668 |
to implement various extensions of \KOMAScript. |
| 1669 |
\end{itemize} |
| 1670 |
In future versions of \KOMAScript{}, consideration is being given to avoid |
| 1671 |
changing the \LaTeX{} kernel commands mentioned above and to replace them |
| 1672 |
completely with custom, internal commands. Loading truly incompatible |
| 1673 |
sectioning packages would automatically disable \KOMAScript{} extensions |
| 1674 |
and transfer the responsibility for the sectioning commands entirely |
| 1675 |
to these packages. On the other hand, extra effort would be required |
| 1676 |
to maintain compatibility with other packages. |
| 1677 |
|
| 1678 |
Package authors can use these commands as they would use the corresponding |
| 1679 |
\LaTeX{} kernel commands and therefore gain access to the additional features |
| 1680 |
of \KOMAScript. However, these commands should not be redefined, as they may |
| 1681 |
changed at any time, and then this redefinition could compromise |
| 1682 |
\KOMAScript{}'s functionality. The meaning of the parameters for these |
| 1683 |
commands can be found in the \LaTeX{} kernel manual \cite{latex:source2e}. |
| 1684 |
As\ChangedAt[2019/01]{v3.27}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1685 |
\Class{scrartcl}} an alternative to redefining such commands, \KOMAScript{} |
| 1686 |
offers the hooks described previously.% |
| 1687 |
\EndIndexGroup |
| 1688 |
|
| 1689 |
\begin{Explain} |
| 1690 |
\begin{Declaration} |
| 1691 |
\Macro{At@startsection}\Parameter{code} |
| 1692 |
\Macro{Before@ssect}\Parameter{code} |
| 1693 |
\Macro{Before@sect}\Parameter{code} |
| 1694 |
\end{Declaration} |
| 1695 |
Until\ChangedAt[2019/01]{v3.27}{\Class{scrbook}\and \Class{scrreprt}\and |
| 1696 |
\Class{scrartcl}} \KOMAScript~v3.26b, these commands were available as an |
| 1697 |
alternative to redefine \DescRef{\LabelBase.cmd.scr@startsection} or |
| 1698 |
\DescRef{\LabelBase.cmd.SecDef}. Since\textnote{outdated \KOMAScript{} |
| 1699 |
command} \KOMAScript~v3.27, these commands are deprecated. |
| 1700 |
|
| 1701 |
Internally \Macro{At@startsection} is now implemented with the |
| 1702 |
\DescRef{\LabelBase.dohook.heading/postinit} hook. \Macro{Before@ssect} is |
| 1703 |
implemented with \DescRef{\LabelBase.dohook.heading/branch/star}, and |
| 1704 |
\Macro{Before@sect} uses |
| 1705 |
\DescRef{\LabelBase.dohook.heading/branch/nostar}. The \PName{code} is added |
| 1706 |
using \DescRef{scrbase.cmd.AddtoDoHook}. There are no provisions to remove |
| 1707 |
this code once it has been added.% |
| 1708 |
\EndIndexGroup |
| 1709 |
\end{Explain} |
| 1710 |
|
| 1711 |
% \section{Appendix} |
| 1712 |
% \seclabel{appendix} |
| 1713 |
|
| 1714 |
|
| 1715 |
\begin{Declaration} |
| 1716 |
\Macro{appendixmore} |
| 1717 |
\end{Declaration}% |
| 1718 |
The \KOMAScript{} classes have an unusual feature within the |
| 1719 |
\DescRef{maincls.cmd.appendix} command. If the \Macro{appendixmore} command |
| 1720 |
is defined, \DescRef{maincls.cmd.appendix} will also execute it. Internally, |
| 1721 |
the \KOMAScript{} classes \Class{scrbook}\OnlyAt{\Class{scrbook}\and |
| 1722 |
\Class{scrreprt}} and \Class{scrreprt} take advantage of this behaviour to |
| 1723 |
implement the \DescRef{maincls.option.appendixprefix} layout option (see |
| 1724 |
\autoref{sec:maincls.structure}, |
| 1725 |
\DescPageRef{maincls.option.appendixprefix}). You\textnote{Attention!} should |
| 1726 |
take note of this in case you decide to define or redefine the |
| 1727 |
\Macro{appendixmore} macro. If this option has been used, you will receive an |
| 1728 |
error message when using \verb|\newcommand{\appendixmore}{|\dots\verb|}|. This |
| 1729 |
behaviour is intended to prevent you from overriding the options without |
| 1730 |
realising it. |
| 1731 |
|
| 1732 |
\begin{Example} |
| 1733 |
You do not want the chapters in the main part of the classes \Class{scrbook} |
| 1734 |
or \Class{scrreprt} to be introduced by a prefix line (see the |
| 1735 |
\DescRef{maincls.option.chapterprefix} layout option in |
| 1736 |
\autoref{sec:maincls.structure}, |
| 1737 |
\DescPageRef{maincls.option.chapterprefix}). For consistency, you also do |
| 1738 |
not want such a line in the appendix either. Instead, you would like to see |
| 1739 |
the word ``Appendix'' in the language of your choice written in front of the |
| 1740 |
chapter letter and, simultaneously, in the page headings. Instead of using |
| 1741 |
the \DescRef{maincls.option.appendixprefix} layout option, you define the |
| 1742 |
following in the document preamble: |
| 1743 |
% |
| 1744 |
\begin{lstcode} |
| 1745 |
\newcommand*{\appendixmore}{% |
| 1746 |
\renewcommand*{\chapterformat}{% |
| 1747 |
\appendixname~\thechapter\autodot\enskip} |
| 1748 |
\renewcommand*{\chaptermarkformat}{% |
| 1749 |
\appendixname~\thechapter\autodot\enskip} |
| 1750 |
} |
| 1751 |
\end{lstcode} |
| 1752 |
% |
| 1753 |
In case you subsequently change your mind and decide to use the option |
| 1754 |
\DescRef{maincls.option.appendixprefix} at a later stage, you will get an |
| 1755 |
error message because of the already defined \Macro{appendixmore} command. |
| 1756 |
This behaviour prevents the definition made above from invisibly changing |
| 1757 |
the settings intended with the option. |
| 1758 |
|
| 1759 |
It is also possible to get a similar behaviour for the appendix of the class |
| 1760 |
\Class{scrartcl}. For example, you can write in the preamble of your |
| 1761 |
document: |
| 1762 |
\begin{lstcode}[moretexcs={ifthenelse,equal}] |
| 1763 |
\newcommand*{\appendixmore}{% |
| 1764 |
\renewcommand*{\sectionformat}{% |
| 1765 |
\appendixname~\thesection\autodot\enskip}% |
| 1766 |
\renewcommand*{\sectionmarkformat}{% |
| 1767 |
\appendixname~\thesection\autodot\enskip}} |
| 1768 |
\end{lstcode} |
| 1769 |
|
| 1770 |
The redefined commands are explained in more detail in |
| 1771 |
\autoref{sec:maincls.structure}, |
| 1772 |
\DescPageRef{maincls.cmd.chapterformat} and |
| 1773 |
\DescPageRef{maincls.cmd.chaptermarkformat}. |
| 1774 |
\end{Example} |
| 1775 |
% |
| 1776 |
\EndIndexGroup |
| 1777 |
|
| 1778 |
|
| 1779 |
\section{Bibliography} |
| 1780 |
\seclabel{bibliography} |
| 1781 |
|
| 1782 |
The information in this section is less important if you use packages like |
| 1783 |
\Package{biblatex}. In that case, the extensive features of such packages |
| 1784 |
will supersede the extensions of the \KOMAScript{} classes described here. |
| 1785 |
|
| 1786 |
\begin{Declaration} |
| 1787 |
\Macro{newbibstyle}\OParameter{parent style}\Parameter{name}%^^A |
| 1788 |
\Parameter{commands}% |
| 1789 |
\Macro{newblock}% |
| 1790 |
\Macro{@openbib@code}% |
| 1791 |
\Macro{bib@beginhook}% |
| 1792 |
\Macro{bib@endhook} |
| 1793 |
\end{Declaration} |
| 1794 |
The standard classes\textnote{standard classes} already provide the |
| 1795 |
\Macro{newblock} command to structure bibliography entries. The exact purpose |
| 1796 |
of this command depends on the class options. Using option |
| 1797 |
\Option{openbib}\important{\Option{openbib}} redefines the commands |
| 1798 |
\Macro{@openbib@code} and \Macro{newblock} itself at the end of the standard |
| 1799 |
class. The standard classes execute the \Macro{@openbib@code} command when |
| 1800 |
starting the bibliography list, or more precisely, when defining the |
| 1801 |
parameters for the list. You can assume that many packages which redefine the |
| 1802 |
bibliography will execute this command. |
| 1803 |
|
| 1804 |
The \KOMAScript{} classes\textnote{\KOMAScript} do something similar. However, |
| 1805 |
they do not redefine \Macro{@openbib@code} at the end of the class. Instead, |
| 1806 |
\Macro{newbibstyle} defines the \PValue{openstyle} bibliography style. The |
| 1807 |
\PName{commands} given in the implementation contain the appropriate |
| 1808 |
redefinition of \Macro{@openbib@code} and \Macro{newblock}. If you select this |
| 1809 |
bibliography style using the |
| 1810 |
\OptionValueRef{maincls}{bibliography}{openstyle}% |
| 1811 |
\IndexOption{bibliography~=\PValue{openstyle}}% |
| 1812 |
\important{\OptionValueRef{maincls}{bibliography}{openstyle}} option, the |
| 1813 |
\PName{commands} will be executed immediately. This will redefine |
| 1814 |
\Macro{@openbib@code} and \Macro{newblock}. |
| 1815 |
|
| 1816 |
In addition to \Macro{@openbib@code} and \Macro{newblock}, |
| 1817 |
\Macro{bib@beginhook} and \Macro{bib@endhook} can also be redefined by the |
| 1818 |
\PName{commands} of the style. The \Macro{bib@beginhook} command is executed |
| 1819 |
immediately after the heading and preamble of the bibliography but before the |
| 1820 |
beginning of the list of bibliographic entries. The \Macro{bib@endhook} |
| 1821 |
command will be executed immediately after this list, at the end of the |
| 1822 |
bibliography. If \DescRef{maincls.cmd.BreakBibliography} (see |
| 1823 |
\autoref{sec:maincls.bibliography}, |
| 1824 |
\DescPageRef{maincls.cmd.BreakBibliography}) is used to interrupt the |
| 1825 |
bibliography, these commands will also executed at the beginning and end of |
| 1826 |
each part of the bibliography, immediately before and after |
| 1827 |
\DescRef{maincls.cmd.BreakBibliography}. |
| 1828 |
|
| 1829 |
The \Macro{newblock}, \Macro{@openbib@code}, \Macro{bib@beginhook}, and |
| 1830 |
\Macro{bib@endhook} commands are initially defined to be empty when using a |
| 1831 |
new bibliography style. After this, the \PName{commands} of the \PName{parent |
| 1832 |
style} that was optionally specified when defining the style will be executed, |
| 1833 |
followed by the \PName{commands} for the bibliography style itself. As a |
| 1834 |
result, these commands must be defined, if necessary, with |
| 1835 |
\Macro{renewcommand}\IndexCmd{renewcommand}\important{\Macro{renewcommand}}, |
| 1836 |
not \Macro{newcommand}, inside the \PName{instructions} argument. |
| 1837 |
|
| 1838 |
If you use the |
| 1839 |
\DescRef{maincls.cmd.AtEndBibliography}\IndexCmd{AtEndBibliography} and |
| 1840 |
\DescRef{maincls.cmd.AfterBibliographyPreamble}% |
| 1841 |
\IndexCmd{AfterBibliographyPreamble} commands to declare additional |
| 1842 |
\PName{commands} to be executed after the preamble or at the end of the |
| 1843 |
bibliography, the \PName{commands} specified with |
| 1844 |
\DescRef{maincls.cmd.AfterBibliographyPreamble} will only be executed once, at |
| 1845 |
the beginning of the bibliography after the \Macro{bib@beginhook} |
| 1846 |
\PName{commands}, and the \PName{commands} of |
| 1847 |
\DescRef{maincls.cmd.AtEndBibliography} will be executed only once at the end |
| 1848 |
of the bibliography, before \Macro{bib@endhook}. |
| 1849 |
|
| 1850 |
For\textnote{Example!} example, the |
| 1851 |
\Package{multicol}\IndexPackage{multicol}\important{\Package{multicol}} |
| 1852 |
package (see \cite{package:multicol}) could be used to define a bibliography |
| 1853 |
style for printing the bibliography with two columns: |
| 1854 |
% Umbruchkorrektur: listings korrigiert |
| 1855 |
\begin{lstcode} |
| 1856 |
\newbibstyle{twocolumstyle}{% |
| 1857 |
\renewcommand*{\bib@beginhook}{\begin{multicols}{2}}% |
| 1858 |
\renewcommand*{\bib@endhook}{\end{multicols}}}% |
| 1859 |
\end{lstcode} |
| 1860 |
If you also want to define an open variation of this style, you can use |
| 1861 |
the possibilities of inheritance here and specify a \PName{parent style}: |
| 1862 |
% Umbruchkorrektur: listings korrigiert |
| 1863 |
\begin{lstcode} |
| 1864 |
\newbibstyle{twocolumopenstyle}[openstyle]{% |
| 1865 |
\renewcommand*{\bib@beginhook}{\begin{multicols}{2}}% |
| 1866 |
\renewcommand*{\bib@endhook}{\end{multicols}}}% |
| 1867 |
\end{lstcode} |
| 1868 |
You can then select these newly defined styles with the |
| 1869 |
\DescRef{maincls.option.bibliography} option as usual. |
| 1870 |
|
| 1871 |
Like\textnote{Achtung!} \DescRef{maincls.cmd.BreakBibliography}, these |
| 1872 |
commands lose all or part of their effect when \Environment{thebibliography} |
| 1873 |
is redefined, for example by using |
| 1874 |
\Package{biblatex}\IndexPackage{biblatex}\important{\Package{biblatex}}.% |
| 1875 |
\EndIndexGroup |
| 1876 |
|
| 1877 |
|
| 1878 |
\section{More or Less Obsolete Options and Commands} |
| 1879 |
\seclabel{obsolete} |
| 1880 |
|
| 1881 |
\LoadNonFree{scrbookreportarticle-experts}{4} |
| 1882 |
% |
| 1883 |
\EndIndexGroup |
| 1884 |
|
| 1885 |
\endinput |
| 1886 |
|
| 1887 |
%%% Local Variables: |
| 1888 |
%%% mode: latex |
| 1889 |
%%% TeX-master: "scrguide-en.tex" |
| 1890 |
%%% coding: utf-8 |
| 1891 |
%%% ispell-local-dictionary: "en_GB" |
| 1892 |
%%% eval: (flyspell-mode 1) |
| 1893 |
%%% End: |