| 1 |
% ====================================================================== |
| 2 |
% common-pagestylemanipulation-en.tex |
| 3 |
% Copyright (c) Markus Kohm, 2013-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 |
% Text that is common for several chapters of the KOMA-Script guide |
| 22 |
% Maintained by Markus Kohm |
| 23 |
% |
| 24 |
% ============================================================================ |
| 25 |
|
| 26 |
\KOMAProvidesFile{common-pagestylemanipulation-en.tex} |
| 27 |
[$Date: 2023-09-18 09:02:03 +0200 (Mo, 18. Sep 2023) $ |
| 28 |
KOMA-Script guide (common paragraph: |
| 29 |
Setting up defined page styles)] |
| 30 |
\translator{Markus Kohm\and Jana Schubert\and Karl Hagen} |
| 31 |
|
| 32 |
\section{Manipulating Page Styles} |
| 33 |
\seclabel{pagestyle.content} |
| 34 |
\BeginIndexGroup |
| 35 |
\BeginIndex{}{page>style} |
| 36 |
|
| 37 |
\IfThisCommonLabelBase{scrlayer}{% |
| 38 |
Although \Package{scrlayer} itself does not define concrete page styles with |
| 39 |
content\,---\,the previously mentioned page styles |
| 40 |
\DescRef{\LabelBase.pagestyle.@everystyle@} and \PageStyle{empty} are |
| 41 |
initially defined without any layers, i.\,e., without content\,---\,, the |
| 42 |
package provides some options and commands to manipulate their contents.% |
| 43 |
}{% |
| 44 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 45 |
\autoref{sec:scrlayer-scrpage.predefined.pagestyles} explains how the page |
| 46 |
styles \DescRef{\LabelBase.pagestyle.scrheadings} and |
| 47 |
\DescRef{\LabelBase.pagestyle.plain.scrheadings} are defined and how these |
| 48 |
defaults can be changed. But topics such as creating running headers, |
| 49 |
changing the widths of the header and footer, and putting horizontal lines |
| 50 |
above or below the header or footer have yet to be described. Although |
| 51 |
these capabilities are actually part of the |
| 52 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 53 |
\important{\hyperref[cha:scrlayer]{\Package{scrlayer}}} package, they will |
| 54 |
be explained below because these basic features of |
| 55 |
\hyperref[cha:scrlayer]{\Package{scrlayer}} make up an important part of |
| 56 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\Package{scrlayer-scrpage}% |
| 57 |
}{% |
| 58 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 59 |
}.% |
| 60 |
}{% |
| 61 |
\IfThisCommonLabelBase{scrlayer-scrpage-experts}{% |
| 62 |
This section is a supplement to |
| 63 |
\autoref{sec:scrlayer.pagestyle.content}. It describes features that may |
| 64 |
be too complicated for beginners.% |
| 65 |
}{\InternalCommonFileUsageError}% |
| 66 |
}% |
| 67 |
} |
| 68 |
|
| 69 |
\IfThisCommonLabelBase{scrlayer-scrpage-experts}{\iffalse}{% |
| 70 |
\csname iftrue\endcsname}% |
| 71 |
\begin{Declaration} |
| 72 |
\IfThisCommonLabelBase{scrlayer}{% |
| 73 |
\Option{automark} |
| 74 |
\OptionVName{autooneside}{simple switch} |
| 75 |
\Option{manualmark} |
| 76 |
}{}% |
| 77 |
\Macro{automark}\OParameter{section level of the right mark} |
| 78 |
\Parameter{section level of the left mark} |
| 79 |
\Macro{automark*}\OParameter{section level of the right mark} |
| 80 |
\Parameter{section level of the left mark} |
| 81 |
\Macro{manualmark} |
| 82 |
\end{Declaration} |
| 83 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 84 |
\begin{Explain} |
| 85 |
In both the standard \LaTeX{} classes and the \KOMAScript{} classes, the |
| 86 |
decision of whether to use automatic or static running |
| 87 |
heads\Index{running heads>automatic}\Index{running heads>static} is made |
| 88 |
by using the appropriate page style. Running heads repeat some |
| 89 |
descriptive text, such as a title, that is appropriate to the page or |
| 90 |
column, usually in the header, more rarely in the footer. As already |
| 91 |
explained in |
| 92 |
\autoref{sec:maincls.pagestyle}, you get automatic running heads with |
| 93 |
\DescRef{maincls.pagestyle.headings}\IndexPagestyle{headings}% |
| 94 |
\important{\DescRef{maincls.pagestyle.headings}} |
| 95 |
|
| 96 |
In the article classes\OnlyAt{\Class{article}\and \Class{scrartcl}} |
| 97 |
\Class{article} or \hyperref[cha:maincls]{\Class{scrartcl}}, the |
| 98 |
\PageStyle{headings}\IndexPagestyle{headings} page style uses the |
| 99 |
section heading, which is either the mandatory or the optional argument |
| 100 |
of \DescRef{maincls.cmd.section}, for the running head% |
| 101 |
\textnote{automatic running head} of one-sided documents. Two-sided |
| 102 |
documents use this section heading as the \emph{left mark} and the |
| 103 |
subsection heading as the \emph{right mark}. The left mark is printed, |
| 104 |
as the name indicates, on left-hand (verso) pages. The right mark is |
| 105 |
printed on right-hand (recto)\,---\,in one-sided printing this means on |
| 106 |
all\,---\,pages. The classes by default also delete the right mark |
| 107 |
whenever they put the section heading into the left mark. |
| 108 |
|
| 109 |
The report and book classes \OnlyAt{\Class{report}\and |
| 110 |
\Class{scrreprt}\and \Class{book}\and \Class{scrbook}} start one level |
| 111 |
higher. Thus they use the chapter heading as the right mark in one-sided |
| 112 |
printing. In two-sided printing, the chapter heading is the left mark |
| 113 |
and the section heading is the right mark. |
| 114 |
|
| 115 |
If you use \DescRef{maincls.pagestyle.myheadings}% |
| 116 |
\IndexPagestyle{myheadings}% |
| 117 |
\important{\DescRef{maincls.pagestyle.myheadings}}\textnote{manual |
| 118 |
running head}, the marks in the page header still exist, and the page |
| 119 |
numbers are placed in the same way, but section commands no longer set |
| 120 |
the marks automatically. You can set them manually\important{% |
| 121 |
\DescRef{\ThisCommonLabelBase.cmd.markright}\\ |
| 122 |
\DescRef{\ThisCommonLabelBase.cmd.markboth}} using the commands |
| 123 |
\DescRef{\ThisCommonLabelBase.cmd.markright} and |
| 124 |
\DescRef{\ThisCommonLabelBase.cmd.markboth}, which are described later |
| 125 |
in this section. |
| 126 |
\end{Explain}\par% |
| 127 |
This distinction has been eliminated by % |
| 128 |
\iffalse \Package{scrpage2} and now also by \fi% |
| 129 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}\IndexPackage{scrlayer}. Instead |
| 130 |
of distinguishing between automatic\textnote{automatic and manual running |
| 131 |
heads} and manual running heads by which page style is selected, there |
| 132 |
are two new commands: \Macro{automark} and \Macro{manualmark}.% |
| 133 |
}{% |
| 134 |
\IfThisCommonLabelBase{scrlayer}{% |
| 135 |
For most classes, the choice of a page style\,---\,generally |
| 136 |
\PageStyle{headings} or \PageStyle{myheading}\,---\,determines whether |
| 137 |
the running heads are created automatically or manually. |
| 138 |
% TODO: Fix new translation |
| 139 |
With \Package{scrlayer} the distinction is done with the two commands |
| 140 |
\Macro{automark} and \Macro{manualmark}.% |
| 141 |
% :ODOT |
| 142 |
}{\InternalCommonFileUsageError}% |
| 143 |
}% |
| 144 |
|
| 145 |
The \Macro{manualmark}\important{\Macro{manualmark}} command switches to |
| 146 |
manual marks and deactivates the automatic filling of the marks. In contrast, |
| 147 |
\Macro{automark}\important{\Macro{automark}} and \Macro{automark*} define |
| 148 |
which section levels should be used to set the mark automatically. The |
| 149 |
optional argument is the \PName{section level of the right mark}, the |
| 150 |
mandatory argument the \PName{section level of the left mark}. The |
| 151 |
arguments should always be the name of a section level like |
| 152 |
\PValue{part}, \PValue{chapter}, \PValue{section}, \PValue{subsection}, |
| 153 |
\PValue{subsubsection}, \PValue{paragraph}, or \PValue{subparagraph}. |
| 154 |
|
| 155 |
Normally, the higher level should be used for the left mark and the lower |
| 156 |
level for the right mark. This is only a convention and not a requirement, |
| 157 |
but it makes sense. |
| 158 |
|
| 159 |
Please note\textnote{Attention!} that not every class provides running heads |
| 160 |
for every section level. For example, the standard classes\textnote{% |
| 161 |
\KOMAScript{} vs. standard classes} never use \DescRef{maincls.cmd.part} |
| 162 |
in the heading. The \KOMAScript{} classes, on the other hand, support all |
| 163 |
levels. |
| 164 |
|
| 165 |
The difference between \Macro{automark} and \Macro{automark*}% |
| 166 |
\important{\Macro{automark*}} is that \Macro{automark} overrides all |
| 167 |
previous commands to automatically set the mark, while \Macro{automark*} |
| 168 |
changes only the behaviour of the section levels specified in its |
| 169 |
arguments.% |
| 170 |
\IfThisCommonLabelBase{scrlayer-scrpage}{}{ % |
| 171 |
With this feature you can handle |
| 172 |
relatively complex cases.% |
| 173 |
}% Umbruchoptimierung |
| 174 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iftrue}{\csname |
| 175 |
iffalse\endcsname}% |
| 176 |
\iffalse% Umbruchkorrekturtext |
| 177 |
\iffree{}{\par |
| 178 |
The obsolete package |
| 179 |
\Package{scrpage2}\IndexPackage{scrpage2}\important{\Package{scrpage2}} |
| 180 |
understands both \Macro{manualmark} and \Macro{automark}, but not |
| 181 |
\Macro{automark*}. Therefore the following examples are not completely |
| 182 |
transferable when using \Package{scrpage2}.% |
| 183 |
}% |
| 184 |
\fi |
| 185 |
% |
| 186 |
\begin{Example} |
| 187 |
\phantomsection\xmpllabel{mark}% |
| 188 |
Suppose you want chapter headings to be used as the running head of even |
| 189 |
pages and the section heading to be the running head of odd pages, as |
| 190 |
usual. But on odd pages you also want the chapter headings to be used as |
| 191 |
the running head until the first section appears. To do so, you first |
| 192 |
have to load \IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 193 |
\Package{scrlayer-scrpage}% |
| 194 |
}{% |
| 195 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 196 |
} |
| 197 |
and select the \DescRef{\LabelBase.pagestyle.scrheadings} page style, |
| 198 |
so the document starts with: |
| 199 |
\begin{lstcode} |
| 200 |
\documentclass{scrbook} |
| 201 |
\usepackage{scrlayer-scrpage} |
| 202 |
\pagestyle{scrheadings} |
| 203 |
\end{lstcode} |
| 204 |
Next, ensure that the chapter headings set both the left and the right |
| 205 |
marks: |
| 206 |
\begin{lstcode} |
| 207 |
\automark[chapter]{chapter} |
| 208 |
\end{lstcode} |
| 209 |
Then the section heading should also set right marks: |
| 210 |
\begin{lstcode} |
| 211 |
\automark*[section]{} |
| 212 |
\end{lstcode} |
| 213 |
Here the starred version is used, since the previous \Macro{automark} |
| 214 |
command should remain in effect. Additionally, the mandatory argument |
| 215 |
for the \PName{section level of the left mark} is empty because this |
| 216 |
mark should remain unchanged. |
| 217 |
|
| 218 |
All that's missing now is a bit of document content to show the result: |
| 219 |
\begin{lstcode} |
| 220 |
\usepackage{lipsum} |
| 221 |
\begin{document} |
| 222 |
\chapter{Chapter Heading} |
| 223 |
\lipsum[1-20] |
| 224 |
\section{Section Heading} |
| 225 |
\lipsum[21-40] |
| 226 |
\end{document} |
| 227 |
\end{lstcode} |
| 228 |
We use the extremely useful \Package{lipsum}\IndexPackage{lipsum} |
| 229 |
package to generate some dummy text with command |
| 230 |
\Macro{lipsum}\IndexCmd{lipsum}. |
| 231 |
|
| 232 |
If you test the example, you will see that the first page of the chapter |
| 233 |
appears, as usual, without a running head, since this page automatically |
| 234 |
uses the \PageStyle{plain} page style |
| 235 |
\DescRef{\LabelBase.pagestyle.plain.scrheadings} (see the |
| 236 |
\DescRef{maincls.cmd.chapterpagestyle} on |
| 237 |
\DescPageRef{maincls.cmd.chapterpagestyle}). Pages~2--4 have the |
| 238 |
chapter headings in the running head. After the section heading on |
| 239 |
page~4, the running head of page~5 changes to this section heading. From |
| 240 |
this page to the end, the running head alternates from page to page |
| 241 |
between the chapter and section headings.% |
| 242 |
\end{Example} |
| 243 |
\fi |
| 244 |
|
| 245 |
\IfThisCommonLabelBase{scrlayer}{}{% |
| 246 |
\begin{Declaration} |
| 247 |
\Option{automark} |
| 248 |
\OptionVName{autooneside}{simple switch} |
| 249 |
\Option{manualmark} |
| 250 |
\end{Declaration}} |
| 251 |
Instead of the commands described previously, you can also use the |
| 252 |
\Option{manualmark}\important{\Option{manualmark}\\\Option{automark}} and |
| 253 |
\Option{automark} options to switch between automatic and manual running |
| 254 |
heads. \Option{automark} always uses the default\textnote{default} |
| 255 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iftrue}{\csname |
| 256 |
iffalse\endcsname}% |
| 257 |
\lstinline|\automark[section]{chapter}| for classes with |
| 258 |
\DescRef{maincls.cmd.chapter} and |
| 259 |
\lstinline|\automark[subsection]{section}| for other classes. |
| 260 |
\else |
| 261 |
\begin{lstcode} |
| 262 |
\automark[section]{chapter} |
| 263 |
\end{lstcode} |
| 264 |
for classes with \DescRef{maincls.cmd.chapter} and |
| 265 |
\begin{lstcode} |
| 266 |
\automark[subsection]{section} |
| 267 |
\end{lstcode} |
| 268 |
for other classes. |
| 269 |
\fi |
| 270 |
|
| 271 |
\IfThisCommonLabelBaseOneOf{scrlayer,scrlayer-scrpage}{% |
| 272 |
In one-sided printing, you normally want only the higher section levels |
| 273 |
to provide the running title.% |
| 274 |
}{% |
| 275 |
In one-sided printing, you normally do not want the lower section level |
| 276 |
to influence the right mark. Instead, you want the higher section |
| 277 |
level, which would appear in only the left mark in two-sided printing, to |
| 278 |
be the running head of all pages.% |
| 279 |
} The default option \Option{autooneside}\important{\Option{autooneside}} |
| 280 |
corresponds to this behaviour. The option accepts the values for |
| 281 |
simple switches listed in \autoref{tab:truefalseswitch}, |
| 282 |
\autopageref{tab:truefalseswitch}. If you deactivate this option, the |
| 283 |
optional and mandatory arguments of \Macro{automark} and \Macro{automark*} |
| 284 |
will again control the running head in one-sided printing.% |
| 285 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iftrue}{\csname |
| 286 |
iffalse\endcsname}% |
| 287 |
\begin{Example} |
| 288 |
\phantomsection\xmpllabel{mark.oneside}% |
| 289 |
Suppose you have a one-sided report but want running heads similar to |
| 290 |
those in the previous book example. Specifically, the chapter headings |
| 291 |
should be used as the running head until the first section appears. |
| 292 |
From the then on, the section heading should be used. So we modify the |
| 293 |
previous example a little bit: |
| 294 |
\begin{lstcode} |
| 295 |
\documentclass{scrreprt} |
| 296 |
\usepackage[autooneside=false]{scrlayer-scrpage} |
| 297 |
\pagestyle{scrheadings} |
| 298 |
\automark[section]{chapter} |
| 299 |
\usepackage{lipsum} |
| 300 |
\begin{document} |
| 301 |
\chapter{Chapter Heading} |
| 302 |
\lipsum[1-20] |
| 303 |
\section{Section Heading} |
| 304 |
\lipsum[21-40] |
| 305 |
\end{document} |
| 306 |
\end{lstcode} |
| 307 |
As you can see an \DescRef{\LabelBase.cmd.automark*} command is not |
| 308 |
required in this case. You should try the example with |
| 309 |
\Option{autooneside} set to \PValue{true}, or remove the option, for |
| 310 |
comparison. You will notice a difference in the running head from |
| 311 |
page~4 on. |
| 312 |
\end{Example} |
| 313 |
\fi |
| 314 |
|
| 315 |
Note\textnote{Attention!} that merely loading the package does not have any |
| 316 |
effect on whether automatic or manual running heads are used, or what kind |
| 317 |
of sectioning headings fill the marks. Only by explicitly using the option |
| 318 |
\Option{automark} or \Option{manualmark}, or the command |
| 319 |
\DescRef{\LabelBase.cmd.automark} or \DescRef{\LabelBase.cmd.manualmark}, |
| 320 |
will the conditions here be initialized.% |
| 321 |
\IfThisCommonLabelBase{scrlayer}{\par% |
| 322 |
You can find additional background information and examples of how to use |
| 323 |
these commands in the documentation for the \Package{scrlayer} package |
| 324 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 325 |
in \autoref{sec:scrlayer-scrpage.pagestyle.content}, starting on |
| 326 |
\DescPageRef{scrlayer-scrpage.cmd.manualmark}.% |
| 327 |
}{% |
| 328 |
\EndIndexGroup% |
| 329 |
}% |
| 330 |
\EndIndexGroup |
| 331 |
|
| 332 |
|
| 333 |
\IfThisCommonLabelBase{scrlayer}{% already described at \layercontentsmeasure |
| 334 |
}{% |
| 335 |
\begin{Declaration} |
| 336 |
\OptionVName{draft}{simple switch} |
| 337 |
\end{Declaration} |
| 338 |
This \KOMAScript{} option accepts the values for simple switches |
| 339 |
listed in \autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch}. |
| 340 |
If this option is active, all elements of the page styles will also show |
| 341 |
rulers\index{ruler}% |
| 342 |
\IfThisCommonLabelBase{scrlayer}{ for}{% |
| 343 |
. This can sometimes be useful during} |
| 344 |
the drafting process.% |
| 345 |
\IfThisCommonLabelBase{scrlayer-scrpage}{ % |
| 346 |
If this option has been set globally (see the optional argument |
| 347 |
of \DescRef{\LabelBase.cmd.documentclass}) but you do not want the |
| 348 |
rulers, you can deactivate them for this package alone by using |
| 349 |
\OptionValue{draft}{false} as an optional argument of |
| 350 |
\DescRef{\LabelBase.cmd.usepackage} while loading the package.% |
| 351 |
}{}% |
| 352 |
\EndIndexGroup% |
| 353 |
}% |
| 354 |
|
| 355 |
\begin{Declaration} |
| 356 |
\Macro{MakeMarkcase}\Parameter{text} |
| 357 |
\OptionVName{markcase}{value} |
| 358 |
\end{Declaration} |
| 359 |
Automatic running heads, but not manual ones, use \Macro{MakeMarkcase} for |
| 360 |
their output. If the command has not been defined, e.\,g., by the class |
| 361 |
while loading \IfThisCommonLabelBase{scrlayer}{% |
| 362 |
\Package{scrlayer}% |
| 363 |
}{% |
| 364 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 365 |
}, it is defined by default to output the argument \PName{text} without |
| 366 |
changes. But the default can be changed either by redefining |
| 367 |
\Macro{MakeMarkcase}. Using the \DescRef{\LabelBase.option.markcase}% |
| 368 |
\IndexOption{markcase}\important{\DescRef{\LabelBase.option.markcase}} |
| 369 |
option with one of the values of \autoref{tab:scrlayer-scrpage.markcase} |
| 370 |
also redefines \Macro{MakeMarkcase}. |
| 371 |
|
| 372 |
\IfThisCommonLabelBase{scrlayer}{% |
| 373 |
Because of the poor typographical quality of the primitive capitalisation |
| 374 |
routine (see the explanation of \DescRef{scrlayer-scrpage.option.markcase} |
| 375 |
in \autoref{sec:scrlayer-scrpage.pagestyle.content}, |
| 376 |
\autopageref{expl:scrlayer-scrpage.MakeUppercase}) the author of |
| 377 |
\KOMAScript{} recommends that you avoid upper-case typesetting for running |
| 378 |
heads.% |
| 379 |
}{% |
| 380 |
Unfortunately,\phantomsection\label{expl:\ThisCommonLabelBase.MakeUppercase} |
| 381 |
the \LaTeX{} command for converting text to upper case\Index{upper case}, |
| 382 |
\Macro{MakeUppercase}\IndexCmd{MakeUppercase}, does not produce good |
| 383 |
results because it neither spaces characters nor balances lines |
| 384 |
appropriately. This is certainly in part due to the fact that a |
| 385 |
typographically correct upper-case conversion requires analysing the |
| 386 |
glyphs to account for the different letter shapes \iffree{and their |
| 387 |
combinations}{} while balancing the block. I therefore recommend that |
| 388 |
you avoid upper-case typesetting for running heads.% |
| 389 |
} This is usually possible with \OptionValue{markcase}{used}\important{% |
| 390 |
\OptionValue{markcase}{used}}\IndexOption[indexmain]{markcase~=used}. |
| 391 |
However, some classes insert \Macro{MarkUppercase}, or even the \TeX{} |
| 392 |
command \Macro{uppercase}, into the running heads. For such cases, you can |
| 393 |
use the option \OptionValue{markcase}{noupper}% |
| 394 |
\important{\OptionValue{markcase}{noupper}}% |
| 395 |
\IndexOption[indexmain]{markcase~=noupper}. This will also deactivate |
| 396 |
\Macro{MakeUppercase} and \Macro{uppercase} inside the running heads. |
| 397 |
|
| 398 |
You can find all valid values for \Option{markcase} in |
| 399 |
\autoref{tab:scrlayer-scrpage.markcase}% |
| 400 |
\IfThisCommonLabelBase{scrlayer-scrpage}{}{, |
| 401 |
\autopageref{tab:scrlayer-scrpage.markcase}}.% |
| 402 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 403 |
\begin{table} |
| 404 |
\centering |
| 405 |
\caption[Available values for the \Option{markcase} option]{Available |
| 406 |
values for the \Option{markcase} option to select upper/lower case |
| 407 |
typesetting in automatic running heads}% |
| 408 |
\label{tab:\ThisCommonLabelBase.markcase}% |
| 409 |
\begin{desctabular} |
| 410 |
\pventry{lower}{\IndexOption[indexmain]{markcase~=lower}% |
| 411 |
redefines \DescRef{\LabelBase.cmd.MakeMarkcase} to convert the |
| 412 |
automatic running heads into lower-case letters using |
| 413 |
\Macro{MakeLowercase}.% |
| 414 |
}\\[-1.7ex] |
| 415 |
\pventry{upper}{\IndexOption[indexmain]{markcase~=upper}% |
| 416 |
redefines \DescRef{\LabelBase.cmd.MakeMarkcase} to convert the |
| 417 |
automatic running heads into upper-case letters using |
| 418 |
\Macro{MakeUppercase}.% |
| 419 |
}\\[-1.7ex] |
| 420 |
\pventry{title}{\IndexOption[indexmain]{markcase~=title}% |
| 421 |
\IfThisCommonLabelBase{scrlayer}{% |
| 422 |
\ChangedAt{v3.41}{\Package{scrlayer}}}{% |
| 423 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 424 |
\ChangedAt{v3.41}{\Package{scrlayer-scrpage}}}}{}% |
| 425 |
redefines \DescRef{\LabelBase.cmd.MakeMarkcase} to convert the |
| 426 |
automatic running heads into title-case using |
| 427 |
\Macro{MakeTitlecase}. This is done separately for the number |
| 428 |
and the text. If \Macro{MakeTitlecase} is not defined, i.\,e., |
| 429 |
because you are using an old \LaTeX{} kernel, you will get a warning |
| 430 |
message and the option will be ignored.% |
| 431 |
}\\[-1.7ex] |
| 432 |
\pventry{used}{\IndexOption[indexmain]{markcase~=used}% |
| 433 |
redefines \DescRef{\LabelBase.cmd.MakeMarkcase} to use automatic |
| 434 |
running heads without any case changes.% |
| 435 |
}\\[-1.7ex] |
| 436 |
\entry{\PValue{ignoreuppercase}, \PValue{nouppercase}, |
| 437 |
\PValue{ignoreupper}, |
| 438 |
\PValue{noupper}}{\IndexOption[indexmain]{markcase~=noupper}% |
| 439 |
redefines not only \DescRef{\LabelBase.cmd.MakeMarkcase} but also |
| 440 |
\Macro{MakeUppercase} and \Macro{uppercase} locally to the running |
| 441 |
heads to leave the automatic running heads unchanged.% |
| 442 |
}% |
| 443 |
\end{desctabular} |
| 444 |
\end{table} |
| 445 |
}{}% |
| 446 |
\EndIndexGroup |
| 447 |
\fi |
| 448 |
|
| 449 |
|
| 450 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iffalse}{\csname iftrue\endcsname} |
| 451 |
\begin{Declaration} |
| 452 |
\Macro{righttopmark} |
| 453 |
\Macro{rightbotmark} |
| 454 |
\Macro{rightfirstmark} |
| 455 |
\Macro{rightmark} |
| 456 |
\Macro{lefttopmark} |
| 457 |
\Macro{leftbotmark} |
| 458 |
\Macro{leftfirstmark} |
| 459 |
\Macro{leftmark} |
| 460 |
\end{Declaration} |
| 461 |
\LaTeX\ChangedAt{v3.16}{\Package{scrlayer}} typically uses a two-part |
| 462 |
\TeX{} mark for page styles. Running heads can access the left part of that |
| 463 |
mark with \DescRef{scrlayer.cmd.leftmark}% |
| 464 |
\important{\DescRef{scrlayer.cmd.leftmark}}\IndexCmd{leftmark} and the right |
| 465 |
part with \DescRef{scrlayer.cmd.rightmark}% |
| 466 |
\important{\DescRef{scrlayer.cmd.rightmark}}\IndexCmd{rightmark}. In fact, |
| 467 |
it was probably intended to use \DescRef{scrlayer.cmd.leftmark} for the |
| 468 |
running head of left (even) pages and \DescRef{scrlayer.cmd.rightmark} for |
| 469 |
the running head of right (odd) pages of two-sided documents. In |
| 470 |
one-sided printing, however, the standard classes do not even set the left |
| 471 |
part of the mark. |
| 472 |
|
| 473 |
\TeX{} itself knows three ways to access a mark. The \Macro{botmark}% |
| 474 |
\IndexCmd{botmark}\important{\Macro{botmark}} is the last valid mark of the |
| 475 |
most recent page that has been built. If no mark has been set on the page, |
| 476 |
it corresponds to the last mark set on the pages that have already been |
| 477 |
shipped out. The \LaTeX{} command \DescRef{scrlayer.cmd.leftmark} uses |
| 478 |
precisely this mark, so it returns the left part of the last mark of the |
| 479 |
page. This corresponds exactly to \Macro{leftbotmark}% |
| 480 |
\important{\Macro{leftbotmark}}. By comparison, \Macro{rightbotmark}% |
| 481 |
\important{\Macro{rightbotmark}} prints the right part of this mark. |
| 482 |
|
| 483 |
\Macro{firstmark}\IndexCmd{firstmark}\important{\Macro{firstmark}} is the |
| 484 |
first mark of the last page that has been built. This is the first mark that |
| 485 |
has been set on the page. If no mark has been set on the page, it |
| 486 |
corresponds to the last mark of the pages that have already been shipped |
| 487 |
out. The \LaTeX{} command \DescRef{scrlayer.cmd.rightmark} uses precisely |
| 488 |
this mark, so it returns the right part of the first mark of the page. This |
| 489 |
corresponds exactly to \Macro{rightfirstmark}% |
| 490 |
\important{\Macro{rightfirstmark}}. By comparison, \Macro{leftfirstmark}% |
| 491 |
\important{\Macro{leftfirstmark}} prints the left part of this mark. |
| 492 |
|
| 493 |
\Macro{topmark}\IndexCmd{topmark}\important{\Macro{topmark}} is the content |
| 494 |
that \Macro{botmark} had before building the current page. \LaTeX{} itself |
| 495 |
does not use it. Nevertheless, \IfThisCommonLabelBase{scrlayer}{% |
| 496 |
\Package{scrlayer}% |
| 497 |
}{% |
| 498 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 499 |
} provides \Macro{lefttopmark}\important{\Macro{lefttopmark}} to access the |
| 500 |
left part of this mark and \Macro{righttopmark}% |
| 501 |
\important{\Macro{righttopmark}} to access the right part. |
| 502 |
|
| 503 |
Note\textnote{Attention!} that the left and right portions of the mark |
| 504 |
can only be set together. Even if you use |
| 505 |
\DescRef{scrlayer.cmd.markright}\IndexCmd{markright} to change only the |
| 506 |
right part, the left part will set again (unchanged). Accordingly, in |
| 507 |
two-sided printing, using the \PageStyle{headings}% |
| 508 |
\important{\PageStyle{headings}}\IndexPagestyle{headings} page style, |
| 509 |
the higher section levels always make both parts. For example, |
| 510 |
\DescRef{scrlayer.cmd.chaptermark} uses \DescRef{scrlayer.cmd.markboth} with |
| 511 |
an empty right argument in this case. This is the reason |
| 512 |
\DescRef{scrlayer.cmd.rightmark} or \Macro{rightfirstmark} always shows an |
| 513 |
empty value on pages which start a chapter, even if there was a |
| 514 |
\DescRef{scrlayer.cmd.sectionmark} or \DescRef{maincls.cmd.section} on the |
| 515 |
same page to make the right part of the mark. |
| 516 |
Please note\textnote{Attention!} that using any of these commands to show |
| 517 |
the left or right part of the mark as part of the page content may lead to |
| 518 |
unexpected results. They are really meant for use in the header or footer |
| 519 |
of a page style only. Therefore, they should always be part of the contents |
| 520 |
of a layer when using \IfThisCommonLabelBase{scrlayer}{% |
| 521 |
\Package{scrlayer}% |
| 522 |
}{% |
| 523 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 524 |
}. But it does not matter whether the layer is restricted to the background |
| 525 |
or the foreground, since all layers are shipped out after building the |
| 526 |
current page. |
| 527 |
|
| 528 |
If you need more information about the mark mechanism |
| 529 |
\iffree{of \TeX{}}{\unskip}, please have a look at |
| 530 |
\cite[chapter~23]{knuth:texbook}. The topic is flagged there as an issue for |
| 531 |
real experts. \IfThisCommonLabelBase{scrlayer}{% Umbruchkorrektur |
| 532 |
So if the explanation above confused you, please don't worry about it.}{}% |
| 533 |
\EndIndexGroup |
| 534 |
\fi |
| 535 |
|
| 536 |
|
| 537 |
\IfThisCommonLabelBase{scrlayer-scrpage-experts}{\iffalse}{% |
| 538 |
\csname iftrue\endcsname}% |
| 539 |
\begin{Declaration} |
| 540 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 541 |
\Macro{leftmark} |
| 542 |
\Macro{rightmark} |
| 543 |
}{}% |
| 544 |
\Macro{headmark} |
| 545 |
\Macro{pagemark} |
| 546 |
\end{Declaration} |
| 547 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 548 |
If you want to depart from the predefined page styles, you typically need |
| 549 |
to decide where to place the marks' contents. With |
| 550 |
\Macro{leftmark}\important{\Macro{leftmark}} you can define what will |
| 551 |
appear in the left mark when the page is output. |
| 552 |
|
| 553 |
Similarly, you can use \Macro{rightmark}\important{\Macro{rightmark}} to |
| 554 |
define the contents of the right mark.\iffree{}{ For information about |
| 555 |
some subtleties when using these commands, see further |
| 556 |
\DescRef{maincls-experts.cmd.rightmark} in |
| 557 |
\autoref{sec:maincls-experts.addInfos}, |
| 558 |
\DescPageRef{maincls-experts.cmd.rightmark}.} |
| 559 |
|
| 560 |
}{}% |
| 561 |
|
| 562 |
You can make life easier with \Macro{headmark}\important{\Macro{headmark}}. |
| 563 |
This extension of \IfThisCommonLabelBase{scrlayer}{% |
| 564 |
\Package{scrlayer}% |
| 565 |
}{% |
| 566 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 567 |
} is a shorthand that resolves to either \Macro{leftmark} or |
| 568 |
\Macro{rightmark} depending on whether the current page is even or odd. |
| 569 |
|
| 570 |
The \Macro{pagemark}\important{\Macro{pagemark}} command has nothing to do |
| 571 |
with \TeX's mark mechanism. It is used to output a formatted page number. |
| 572 |
\BeginIndex{FontElement}{pagenumber}\LabelFontElement{pagenumber}% |
| 573 |
The font of element |
| 574 |
\FontElement{pagenumber}\important{\FontElement{pagenumber}} will be used |
| 575 |
for the output. This can be changed using the \Macro{setkomafont} or |
| 576 |
\DescRef{maincls.cmd.addtokomafont} commands (see also |
| 577 |
\autoref{sec:maincls.textmarkup}, \DescPageRef{maincls.cmd.setkomafont}).% |
| 578 |
\EndIndex{FontElement}{pagenumber}% |
| 579 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iftrue}{% |
| 580 |
\par % |
| 581 |
If you are interested in an example showing the usage of the |
| 582 |
\Macro{headmark} and \Macro{pagemark} commands, see |
| 583 |
\autoref{sec:scrlayer-scrpage.pagestyle.content}, |
| 584 |
\PageRefxmpl{scrlayer-scrpage.cmd.headmark}. Internally, the |
| 585 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 586 |
\Package{scrlayer-scrpage}% |
| 587 |
}{% |
| 588 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 589 |
} package uses many such features of |
| 590 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 591 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 592 |
}{% |
| 593 |
\Package{scrlayer}% |
| 594 |
}.% |
| 595 |
\csname iffalse\endcsname}% |
| 596 |
\begin{Example} |
| 597 |
\phantomsection\xmpllabel{cmd.headmark}% |
| 598 |
Suppose you want the running head to be aligned to the left margin and |
| 599 |
the page number to the right margin in one-sided printing. The following |
| 600 |
minimal working example does just this: |
| 601 |
\begin{lstcode} |
| 602 |
\documentclass{scrreprt} |
| 603 |
\usepackage{blindtext} |
| 604 |
\usepackage[automark]{scrlayer-scrpage} |
| 605 |
\pagestyle{scrheadings} |
| 606 |
\ihead{\headmark} |
| 607 |
\ohead*{\pagemark} |
| 608 |
\chead{} |
| 609 |
\cfoot[]{} |
| 610 |
\begin{document} |
| 611 |
\blinddocument |
| 612 |
\end{document} |
| 613 |
\end{lstcode} |
| 614 |
The \Package{blindtext}\IndexPackage{blindtext} package and its |
| 615 |
\Macro{blinddocument}\IndexCmd{blinddocument} command have been used |
| 616 |
here to quickly generate sample document content for the example. |
| 617 |
|
| 618 |
The \DescRef{scrlayer-scrpage.cmd.ihead}\IndexCmd{ihead} and |
| 619 |
\DescRef{scrlayer-scrpage.cmd.ohead*}\IndexCmd{ohead*} commands |
| 620 |
configure the desired marks. The starred variant |
| 621 |
\DescRef{scrlayer-scrpage.cmd.ohead*} % |
| 622 |
\iffalse% Umbruchvarianten |
| 623 |
configures the page number mark not only on the pages set with the |
| 624 |
\DescRef{\LabelBase.pagestyle.scrheadings}% |
| 625 |
\IndexPagestyle{scrheadings} page style but also those set |
| 626 |
with the \PageStyle{plain} % |
| 627 |
\else% |
| 628 |
also configures the page number with the % |
| 629 |
\fi% |
| 630 |
\DescRef{\LabelBase.pagestyle.plain.scrheadings}% |
| 631 |
\IndexPagestyle{plain.scrheadings} page style used on the first page of |
| 632 |
a chapter.% |
| 633 |
|
| 634 |
Because these page styles have predefined marks in the centre of the |
| 635 |
header and footer, those elements are cleared by using |
| 636 |
\DescRef{scrlayer-scrpage.cmd.chead} and |
| 637 |
\DescRef{scrlayer-scrpage.cmd.cfoot} with empty arguments. Alternatively |
| 638 |
you could use |
| 639 |
\DescRef{scrlayer-scrpage-experts.cmd.clearpairofpagestyles} |
| 640 |
\IndexCmd{clearpairofpagestyles} \emph{before} |
| 641 |
\DescRef{scrlayer-scrpage.cmd.ihead}. You will find this command |
| 642 |
described in \autoref{sec:scrlayer-scrpage-experts.pagestyle.pairs}. |
| 643 |
\end{Example} |
| 644 |
|
| 645 |
Please note\textnote{Attention!} that the empty optional argument of |
| 646 |
\DescRef{scrlayer-scrpage.cmd.cfoot} in the example above is not the same |
| 647 |
as omitting the optional argument. You should try it yourself and have a |
| 648 |
look at the difference in the footer of the first page.% |
| 649 |
\fi |
| 650 |
|
| 651 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% Umbruchvarianten |
| 652 |
Advanced users can find more mark-setting commands% |
| 653 |
}{% |
| 654 |
If the options for the marks described above are not sufficient, |
| 655 |
additional commands for advanced users are documented% |
| 656 |
} % |
| 657 |
starting on \IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 658 |
\DescPageRef{scrlayer-scrpage-experts.cmd.righttopmark}}{% |
| 659 |
\DescPageRef{\ThisCommonLabelBase.cmd.righttopmark}}.% |
| 660 |
\iffalse% Umbruchkorrektur |
| 661 |
\ For example, there you can find |
| 662 |
\DescRef{scrlayer-scrpage-experts.cmd.leftfirstmark} and |
| 663 |
\DescRef{scrlayer-scrpage-experts.cmd.rightbotmark}, which are quite useful |
| 664 |
for documents like lexicons.% |
| 665 |
\fi% |
| 666 |
\EndIndexGroup |
| 667 |
|
| 668 |
|
| 669 |
\begin{Declaration} |
| 670 |
\Macro{partmarkformat}% |
| 671 |
\Macro{chaptermarkformat}% |
| 672 |
\Macro{sectionmarkformat}% |
| 673 |
\Macro{subsectionmarkformat}% |
| 674 |
\Macro{subsubsectionmarkformat}% |
| 675 |
\Macro{paragraphmarkformat}% |
| 676 |
\Macro{subparagraphmarkformat} |
| 677 |
\end{Declaration} |
| 678 |
\KOMAScript{} classes and the \IfThisCommonLabelBase{scrlayer}{% |
| 679 |
\Package{scrlayer}% |
| 680 |
}{% |
| 681 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 682 |
} package typically use these commands internally to format the section |
| 683 |
numbers. They also support the \DescRef{maincls.cmd.autodot} mechanism of |
| 684 |
the \KOMAScript{} classes. If desired, these commands can be redefined to |
| 685 |
achieve a different formatting of section numbers.% |
| 686 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iftrue}{% |
| 687 |
\ See the example in \autoref{sec:scrlayer-scrpage.pagestyle.content}, |
| 688 |
\PageRefxmpl{scrlayer-scrpage.cmd.sectionmarkformat} for more |
| 689 |
information.% |
| 690 |
\csname iffalse\endcsname% |
| 691 |
}% |
| 692 |
\begin{Example} |
| 693 |
\phantomsection\xmpllabel{cmd.sectionmarkformat}% |
| 694 |
\iftrue |
| 695 |
For example, if you want to have running heads without a section |
| 696 |
number, this is how you do it: |
| 697 |
\else |
| 698 |
Suppose you want section headings without the section number to appear |
| 699 |
in the running head. This can be accomplished easily with the |
| 700 |
following: |
| 701 |
\fi |
| 702 |
\begin{lstcode} |
| 703 |
\renewcommand*{\sectionmarkformat}{} |
| 704 |
\end{lstcode} |
| 705 |
\end{Example} |
| 706 |
\ExampleEndFix |
| 707 |
\fi% |
| 708 |
\EndIndexGroup |
| 709 |
|
| 710 |
|
| 711 |
\begin{Declaration} |
| 712 |
\Macro{partmark}\Parameter{Text}% |
| 713 |
\Macro{chaptermark}\Parameter{Text}% |
| 714 |
\Macro{sectionmark}\Parameter{Text}% |
| 715 |
\Macro{subsectionmark}\Parameter{Text}% |
| 716 |
\Macro{subsubsectionmark}\Parameter{Text}% |
| 717 |
\Macro{paragraphmark}\Parameter{Text}% |
| 718 |
\Macro{subparagraphmark}\Parameter{Text} |
| 719 |
\end{Declaration} |
| 720 |
Most classes use these commands internally to set the marks according to the |
| 721 |
sectioning commands. The argument should contain the text without the number |
| 722 |
of the sectioning unit. The number is automatically determined using the |
| 723 |
current section level if you use numbered headings. |
| 724 |
|
| 725 |
However\textnote{Attention!}, not all classes use such a command for |
| 726 |
every section level. The standard classes\textnote{\KOMAScript{} vs. |
| 727 |
standard classes}, for example, do not call \Macro{partmark} |
| 728 |
\IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 729 |
upon a \Macro{part} command}{% |
| 730 |
, whereas the \KOMAScript{} classes naturally support \Macro{partmark} as |
| 731 |
well}. |
| 732 |
|
| 733 |
If you redefine these commands, be sure\textnote{Attention!} to check |
| 734 |
whether the numbers will be output via the |
| 735 |
\DescRef{maincls.counter.secnumdepth} before setting the number even if you |
| 736 |
do not change the \DescRef{maincls.counter.secnumdepth} counter yourself, |
| 737 |
because packages and classes may do so locally and rely on correct handling |
| 738 |
of \DescRef{maincls.counter.secnumdepth}. |
| 739 |
|
| 740 |
The \IfThisCommonLabelBase{scrlayer}{% |
| 741 |
\Package{scrlayer}% |
| 742 |
}{% |
| 743 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 744 |
} package also redefines these commands whenever you use |
| 745 |
\DescRef{scrlayer.cmd.automark} or \DescRef{scrlayer.cmd.manualmark} or the |
| 746 |
corresponding options, to activate or deactivate the desired running heads.% |
| 747 |
\EndIndexGroup |
| 748 |
|
| 749 |
|
| 750 |
\begin{Declaration} |
| 751 |
\Macro{markleft}\Parameter{left mark} |
| 752 |
\Macro{markright}\Parameter{right mark} |
| 753 |
\Macro{markboth}\Parameter{left mark}\Parameter{right mark} |
| 754 |
\Macro{markdouble}\Parameter{mark} |
| 755 |
\end{Declaration} |
| 756 |
Regardless of whether you are working with manual or automatic running |
| 757 |
heads, you can always change the contents of the \PName{left mark} or the |
| 758 |
\PName{right mark} using these commands. Note that the left-hand mark |
| 759 |
resulting from \Macro{leftmark}\IndexCmd{leftmark}% |
| 760 |
\important{\Macro{leftmark}} will be the last mark placed on the |
| 761 |
corresponding page, while the right-hand mark resulting from |
| 762 |
\Macro{rightmark}\IndexCmd{rightmark}\important{\Macro{rightmark}} is the |
| 763 |
first mark placed on the corresponding page. For more details, see |
| 764 |
\iffree{}{the additional explanation of |
| 765 |
\DescRef{maincls-experts.cmd.rightmark} in |
| 766 |
\autoref{sec:maincls-experts.addInfos}, |
| 767 |
\DescPageRef{maincls-experts.cmd.rightmark} or} to |
| 768 |
\DescRef{scrlayer.cmd.rightfirstmark}\IfThisCommonLabelBase{scrlayer}{}{ in |
| 769 |
\autoref{sec:scrlayer.pagestyle.content}}, |
| 770 |
\DescPageRef{scrlayer.cmd.rightfirstmark}. |
| 771 |
|
| 772 |
If you are using manual running heads\Index{running head>manual}, the marks |
| 773 |
remain valid until they are explicitly replaced by reusing the corresponding |
| 774 |
commands. However, if you are using automatic running heads, the marks can |
| 775 |
become invalid with the next section heading, depending on the automatic |
| 776 |
configuration. |
| 777 |
|
| 778 |
You can also use these commands in conjunction with the starred versions of |
| 779 |
the sectioning commands.% |
| 780 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iftrue}{% |
| 781 |
\ You can find detailed examples illustrating usage of \Macro{markboth} |
| 782 |
with the \IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 783 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 784 |
}{% |
| 785 |
\Package{scrlayer}% |
| 786 |
}-derived package \IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 787 |
\Package{scrlayer-scrpage}% |
| 788 |
}{% |
| 789 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 790 |
} in |
| 791 |
\autoref{sec:scrlayer-scrpage.pagestyle.content}, |
| 792 |
\PageRefxmpl{scrlayer-scrpage.cmd.markboth}.% |
| 793 |
\csname iffalse\endcsname% |
| 794 |
}% |
| 795 |
\begin{Example} |
| 796 |
\phantomsection\xmpllabel{cmd.markboth}% |
| 797 |
Suppose you write a preface of several pages placed just before the |
| 798 |
table of contents but not appearing in it. However, since you use |
| 799 |
dividing lines in your header, you want a running head for this preface: |
| 800 |
\begin{lstcode} |
| 801 |
\documentclass[headsepline]{book} |
| 802 |
\usepackage{scrlayer-scrpage} |
| 803 |
\pagestyle{scrheadings} |
| 804 |
\usepackage{blindtext} |
| 805 |
\begin{document} |
| 806 |
\chapter*{Preface} |
| 807 |
\markboth{Preface}{Preface} |
| 808 |
\blindtext[20] |
| 809 |
\tableofcontents |
| 810 |
\blinddocument |
| 811 |
\end{document} |
| 812 |
\end{lstcode} |
| 813 |
At first glance, this seems to produce the desired result. Taking a |
| 814 |
second look, however, you can see that the running title |
| 815 |
``\texttt{Preface}'' does not appear in upper-case letters, unlike the |
| 816 |
other running heads. But that's easy to change: |
| 817 |
\begin{lstcode} |
| 818 |
\documentclass[headsepline]{book} |
| 819 |
\usepackage{scrlayer-scrpage} |
| 820 |
\pagestyle{scrheadings} |
| 821 |
\usepackage{blindtext} |
| 822 |
\begin{document} |
| 823 |
\chapter*{Preface} |
| 824 |
\markboth{\MakeMarkcase{Preface}}{\MakeMarkcase{Preface}} |
| 825 |
\blindtext[20] |
| 826 |
\tableofcontents |
| 827 |
\blinddocument |
| 828 |
\end{document} |
| 829 |
\end{lstcode} |
| 830 |
Using command \DescRef{\LabelBase.cmd.MakeMarkcase} results in getting |
| 831 |
the same letter case as for automatic running heads. |
| 832 |
|
| 833 |
Now, let's move the \DescRef{maincls.cmd.tableofcontents} in front |
| 834 |
of the preface and remove the \Macro{markboth} command. You'll |
| 835 |
discover that the preface now has the running head |
| 836 |
``\texttt{CONTENTS}''. This is due to a quirk of |
| 837 |
\DescRef{maincls.cmd.chapter*} (see also \autoref{sec:maincls.structure} |
| 838 |
on \DescPageRef{maincls.cmd.chapter*}). If you do not want a running |
| 839 |
head here, you can easily accomplish this by passing two empty arguments |
| 840 |
to \Macro{markboth}: |
| 841 |
\begin{lstcode} |
| 842 |
\documentclass[headsepline]{book} |
| 843 |
\usepackage{scrlayer-scrpage} |
| 844 |
\pagestyle{scrheadings} |
| 845 |
\usepackage{blindtext} |
| 846 |
\begin{document} |
| 847 |
\tableofcontents |
| 848 |
\chapter*{Preface} |
| 849 |
\markboth{}{} |
| 850 |
\blindtext[20] |
| 851 |
\blinddocument |
| 852 |
\end{document} |
| 853 |
\end{lstcode} |
| 854 |
\end{Example} |
| 855 |
\fi% |
| 856 |
% TODO: Fix new translation |
| 857 |
The\ChangedAt{v3.28}{\Package{scrlayer}} command |
| 858 |
\Macro{markdouble}\important{\Macro{markdouble}} does change the left mark |
| 859 |
and the right mark to the same contents. So |
| 860 |
\Macro{markdouble}\Parameter{mark} is a shorter form of |
| 861 |
\Macro{markboth}\Parameter{mark}\Parameter{mark} with two identical |
| 862 |
arguments.% |
| 863 |
% :ODOT |
| 864 |
\EndIndexGroup |
| 865 |
\fi |
| 866 |
|
| 867 |
|
| 868 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iffalse}{\csname iftrue\endcsname} |
| 869 |
\begin{Declaration} |
| 870 |
\Macro{GenericMarkFormat}\Parameter{name of the section level} |
| 871 |
\end{Declaration} |
| 872 |
By default, this command is used to format all section numbers in running |
| 873 |
heads below the subsection level, and for classes without |
| 874 |
\DescRef{maincls.cmd.chapter}, also for the section and subsection levels, |
| 875 |
unless the respective mark commands for those levels are defined before |
| 876 |
loading \Package{scrlayer}. The command causes the package to use |
| 877 |
\Macro{@seccntmarkformat}\IndexCmd{@seccntmarkformat}% |
| 878 |
\important{\Macro{@seccntmarkformat}} if this internal command is defined, |
| 879 |
as it is in the \KOMAScript{} classes. Otherwise \Macro{@seccntformat}% |
| 880 |
\IndexCmd{@seccntformat}\important{\Macro{@seccntformat}} will be used, |
| 881 |
which is provided by the \LaTeX{} kernel. The mandatory argument of the |
| 882 |
command contains the name of a sectioning command, such as \PValue{chapter} |
| 883 |
or \PValue{section} \emph{without} the backslash prefix. |
| 884 |
|
| 885 |
By redefining this command, you can change the default number format for all |
| 886 |
sectioning commands that use it. Classes can also change the default |
| 887 |
formatting also by defining this command.% |
| 888 |
\IfThisCommonLabelBase{scrlayer-scrpage-experts}{\iftrue}{% |
| 889 |
\par % |
| 890 |
A detailed example illustrating the interplay of the |
| 891 |
\Macro{GenericMarkFormat} command with the |
| 892 |
\DescPageRef{\ThisCommonLabelBase.cmd.chaptermark} command and |
| 893 |
\DescRef{\ThisCommonLabelBase.cmd.sectionmarkformat} or |
| 894 |
\DescRef{\ThisCommonLabelBase.cmd.subsectionmarkformat} when using |
| 895 |
the \IfThisCommonLabelBase{scrlayer}{% |
| 896 |
\Package{scrlayer}% |
| 897 |
}{% |
| 898 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 899 |
}-derived package \IfThisCommonLabelBase{scrlayer-scrpage}{% |
| 900 |
\Package{scrlayer-scrpage}% |
| 901 |
}{% |
| 902 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 903 |
} is shown in \autoref{sec:scrlayer-scrpage-experts.pagestyle.content}, |
| 904 |
\PageRefxmpl{scrlayer-scrpage-experts.cmd.GenericMarkFormat}.% |
| 905 |
\csname iffalse\endcsname}% |
| 906 |
\begin{Example} |
| 907 |
\phantomsection |
| 908 |
\xmpllabel{cmd.GenericMarkFormat}% |
| 909 |
Suppose you want the section numbers of all levels in the running head |
| 910 |
of an article to be printed in white within a black box. Since the |
| 911 |
commands \Macro{sectionmarkformat} and \Macro{subsectionmarkformat} of |
| 912 |
the \Package{scrlayer} package are defined with |
| 913 |
\Macro{GenericMarkFormat} for articles using the standard \LaTeX{} |
| 914 |
\Class{article} class, you need to redefine only this one command: |
| 915 |
\begin{lstcode} |
| 916 |
\documentclass{article} |
| 917 |
\usepackage{blindtext} |
| 918 |
\usepackage[automark]{scrlayer-scrpage} |
| 919 |
\pagestyle{scrheadings} |
| 920 |
\usepackage{xcolor} |
| 921 |
\newcommand*{\numberbox}[1]{% |
| 922 |
\colorbox{black}{\strut~\textcolor{white}{#1}~}} |
| 923 |
\renewcommand*{\GenericMarkFormat}[1]{% |
| 924 |
\protect\numberbox{\csname the#1\endcsname}\enskip} |
| 925 |
\begin{document} |
| 926 |
\blinddocument |
| 927 |
\end{document} |
| 928 |
\end{lstcode} |
| 929 |
The colour has been changed using the |
| 930 |
\Package{xcolor}\IndexPackage{xcolor} package. More details can be found |
| 931 |
in that package's manual (see \cite{package:xcolor}). |
| 932 |
|
| 933 |
This example also uses an invisible strut. Any detailed \LaTeX{} |
| 934 |
introduction should explain the related command \Macro{strut}. |
| 935 |
|
| 936 |
A helper macro, \Macro{numberbox}, has been defined to format the number |
| 937 |
within a box. This command is prefixed in the redefinition of |
| 938 |
\Macro{GenericMarkFormat} by \Macro{protect} in order to protect it from |
| 939 |
expansion. This is necessary because otherwise the upper-case letter |
| 940 |
conversion of \Macro{MakeUppercase} for the running head, would result |
| 941 |
in using the colours ``\texttt{BLACK}'' and ``\texttt{WHITE}'' instead |
| 942 |
of ``\texttt{black}'' and ``\texttt{white}'', and those colours are |
| 943 |
undefined. Alternatively, you could define \Macro{numberbox} using |
| 944 |
\Macro{DeclareRobustCommand*} instead of \Macro{newcommand*} and omit |
| 945 |
\Macro{protect} (see \cite{latex:clsguide}). |
| 946 |
|
| 947 |
If you wanted to achieve the same effect with a \KOMAScript{} class or |
| 948 |
with the standard \LaTeX{} classes \Class{book} or \Class{report}, you |
| 949 |
would also have to redefine, respectively, |
| 950 |
\DescRef{scrlayer.cmd.sectionmarkformat}\IndexCmd{sectionmarkformat}% |
| 951 |
\important{\DescRef{scrlayer.cmd.sectionmarkformat}} and |
| 952 |
\DescRef{scrlayer.cmd.subsectionmarkformat}% |
| 953 |
\IndexCmd{subsectionmarkformat}% |
| 954 |
\important{\DescRef{scrlayer.cmd.subsectionmarkformat}}, or |
| 955 |
\DescRef{scrlayer.cmd.chaptermarkformat}% |
| 956 |
\IndexCmd{chaptermarkformat}% |
| 957 |
\important{\DescRef{scrlayer.cmd.chaptermarkformat}} and |
| 958 |
\DescRef{scrlayer.cmd.sectionmarkformat}% |
| 959 |
\IndexCmd{sectionmarkformat}% |
| 960 |
\important{\DescRef{scrlayer.cmd.sectionmarkformat}}, because |
| 961 |
these are not by default defined using \Macro{GenericMarkFormat}: |
| 962 |
\begin{lstcode} |
| 963 |
\documentclass[headheight=19.6pt]{scrbook} |
| 964 |
\usepackage{blindtext} |
| 965 |
\usepackage[automark]{scrlayer-scrpage} |
| 966 |
\pagestyle{scrheadings} |
| 967 |
\usepackage{xcolor} |
| 968 |
\newcommand*{\numberbox}[1]{% |
| 969 |
\colorbox{black}{\strut~\textcolor{white}{#1}~}} |
| 970 |
\renewcommand*{\GenericMarkFormat}[1]{% |
| 971 |
\protect\numberbox{\csname the#1\endcsname}\enskip} |
| 972 |
\renewcommand*{\chaptermarkformat}{\GenericMarkFormat{chapter}} |
| 973 |
\renewcommand*{\sectionmarkformat}{\GenericMarkFormat{section}} |
| 974 |
\begin{document} |
| 975 |
\blinddocument |
| 976 |
\end{document} |
| 977 |
\end{lstcode} |
| 978 |
% TODO: New translation |
| 979 |
Here, option \DescRef{typearea.option.headheight} is used to eliminate |
| 980 |
the warning, that also has been reported in the previous example.% |
| 981 |
% :ODOT |
| 982 |
\end{Example} |
| 983 |
\fi% |
| 984 |
\EndIndexGroup |
| 985 |
\fi |
| 986 |
|
| 987 |
|
| 988 |
\IfThisCommonLabelBase{scrlayer-scrpage}{\iffalse}{\csname iftrue\endcsname} |
| 989 |
\begin{Declaration} |
| 990 |
\Macro{@mkleft}\Parameter{left mark}% |
| 991 |
\Macro{@mkright}\Parameter{right mark}% |
| 992 |
\Macro{@mkdouble}\Parameter{mark}% |
| 993 |
\Macro{@mkboth}\Parameter{left mark}\Parameter{right mark} |
| 994 |
\end{Declaration} |
| 995 |
Within classes and packages, you may only want to use running heads if |
| 996 |
automatic running heads are active (see the |
| 997 |
\DescRef{scrlayer.option.automark} option and the |
| 998 |
\DescRef{scrlayer.cmd.automark} command on |
| 999 |
\DescPageRef{scrlayer-scrpage.cmd.automark}). In the standard \LaTeX{} |
| 1000 |
classes, this only works with \Macro{@mkboth}. This command corresponds to |
| 1001 |
either \Macro{@gobbletwo}, which simply consumes both mandatory arguments, |
| 1002 |
or \DescRef{scrlayer.cmd.markboth}, which sets both the \PValue{left mark} |
| 1003 |
and the \PValue{right mark}. Packages like \Package{babel} also change |
| 1004 |
\Macro{\@mkboth}, e.\,g., to enable language switching in the running head. |
| 1005 |
|
| 1006 |
However, if you want to change only the \PName{left mark} or the |
| 1007 |
\PName{right mark} without changing the other one, there is no corresponding |
| 1008 |
command. The \IfThisCommonLabelBase{scrlayer}{% |
| 1009 |
\Package{scrlayer}% |
| 1010 |
}{% |
| 1011 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 1012 |
} package itself needs such commands to implement automatic running heads. |
| 1013 |
So if \Macro{@mkleft}, for setting the left mark only, or \Macro{@mkright}, |
| 1014 |
for setting the right mark only, or \Macro{@mkdouble}, for setting both |
| 1015 |
marks with the same content, is undefined when loading |
| 1016 |
\IfThisCommonLabelBase{scrlayer}{% |
| 1017 |
\Package{scrlayer}% |
| 1018 |
}{% |
| 1019 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 1020 |
}, this package will define them. This definition uses the state of |
| 1021 |
\Macro{@mkboth} as an indication of whether to use automatic running heads. |
| 1022 |
The commands will set the marks only in the case of automatic running heads. |
| 1023 |
|
| 1024 |
Class and package authors can also fall back on these commands as appropriate |
| 1025 |
if they want to set the left or right the marks only if automatic running |
| 1026 |
heads are activated.% |
| 1027 |
\EndIndexGroup% |
| 1028 |
\fi% |
| 1029 |
|
| 1030 |
\IfThisCommonLabelBase{scrlayer}{% |
| 1031 |
\par |
| 1032 |
For more information about manipulating the contents of page styles, see |
| 1033 |
also \autoref{sec:scrlayer-scrpage.pagestyle.content} starting at |
| 1034 |
\autopageref{sec:scrlayer-scrpage.pagestyle.content}.% |
| 1035 |
}{}% |
| 1036 |
\EndIndexGroup |
| 1037 |
|
| 1038 |
%%% Local Variables: |
| 1039 |
%%% mode: latex |
| 1040 |
%%% TeX-master: "scrguide-en.tex" |
| 1041 |
%%% coding: utf-8 |
| 1042 |
%%% ispell-local-dictionary: "en_GB" |
| 1043 |
%%% eval: (flyspell-mode 1) |
| 1044 |
%%% End: |
| 1045 |
|
| 1046 |
% LocalWords: scrlayer |