You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1184 lines
52 KiB
1184 lines
52 KiB
% ======================================================================
|
|
% scrlayer-scrpage.tex
|
|
% Copyright (c) Markus Kohm, 2013-2019
|
|
%
|
|
% This file is part of the LaTeX2e KOMA-Script bundle.
|
|
%
|
|
% This work may be distributed and/or modified under the conditions of
|
|
% the LaTeX Project Public License, version 1.3c of the license.
|
|
% The latest version of this license is in
|
|
% http://www.latex-project.org/lppl.txt
|
|
% and version 1.3c or later is part of all distributions of LaTeX
|
|
% version 2005/12/01 or later and of this work.
|
|
%
|
|
% This work has the LPPL maintenance status "author-maintained".
|
|
%
|
|
% The Current Maintainer and author of this work is Markus Kohm.
|
|
%
|
|
% This work consists of all files listed in manifest.txt.
|
|
% ----------------------------------------------------------------------
|
|
% scrlayer-scrpage.tex
|
|
% Copyright (c) Markus Kohm, 2013-2019
|
|
%
|
|
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
|
|
% Version 1.3c, verteilt und/oder veraendert werden.
|
|
% Die neuste Version dieser Lizenz ist
|
|
% http://www.latex-project.org/lppl.txt
|
|
% und Version 1.3c ist Teil aller Verteilungen von LaTeX
|
|
% Version 2005/12/01 oder spaeter und dieses Werks.
|
|
%
|
|
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
|
|
% (allein durch den Autor verwaltet).
|
|
%
|
|
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
|
|
%
|
|
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
|
|
% ======================================================================
|
|
%
|
|
% Chapter about scrlayer-scrpage of the KOMA-Script guide
|
|
%
|
|
% ----------------------------------------------------------------------
|
|
%
|
|
% Kapitel ueber scrlayer-scrpage in der KOMA-Script-Anleitung
|
|
%
|
|
% ============================================================================
|
|
|
|
\KOMAProvidesFile{scrlayer-scrpage.tex}%
|
|
[$Date: 2019-12-06 11:44:37 +0100 (Fri, 06 Dec 2019) $
|
|
KOMA-Script guide (chapter: scrlayer-scrpage)]
|
|
\translator{Markus Kohm\and Jana Schubert\and Jens H\"uhne\and Karl Hagen}
|
|
|
|
% Date version of the translated file: 2019-11-29
|
|
|
|
\chapter[{Headers and Footers with \Package{scrlayer-scrpage}}]
|
|
{Headers\ChangedAt{v3.12}{\Package{scrlayer-scrpage}} and
|
|
Footers with \Package{scrlayer-scrpage}}
|
|
\labelbase{scrlayer-scrpage}
|
|
%
|
|
\BeginIndexGroup
|
|
\BeginIndex{Package}{scrlayer-scrpage}%
|
|
\begin{Explain}
|
|
Until version 3.11b of \KOMAScript, the \Package{scrpage2}%
|
|
\IndexPackage[indexmain]{scrpage2}\important{\Package{scrpage2}} package was
|
|
the recommended way to customise headers and footers beyond the options
|
|
provided by the \PageStyle{headings}, \PageStyle{myheadings},
|
|
\PageStyle{plain}, and \PageStyle{empty} page styles of the \KOMAScript{}
|
|
classes.
|
|
\iffalse%
|
|
The still older \Package{scrpage}\IndexPackage{scrpage} package was marked
|
|
obsolete in 2001 and removed from the regular \KOMAScript{} distribution in
|
|
2013.\par
|
|
\fi%
|
|
Since 2013, the \hyperref[cha:scrlayer]{\Package{scrlayer}}%
|
|
\important{\hyperref[cha:scrlayer]{\Package{scrlayer}}}%
|
|
\IndexPackage{scrlayer} package has been included as a basic module of
|
|
\KOMAScript. This package provides a layer model and a new page-style model
|
|
based upon it. However, the package's interface is almost too flexible and
|
|
consequently not easy for the average user to comprehend. For more
|
|
information about this interface, see \autoref{cha:scrlayer} in
|
|
\autoref{part:forExperts}. However, a few of the options that are actually
|
|
part of \Package{scrlayer}, and which are therefore taken up again in that
|
|
chapter, are also documented here because they are required to use
|
|
\Package{scrlayer-scrpage}.
|
|
|
|
Many users are already familiar with the commands from \Package{scrpage2}.
|
|
For this reason, \Package{scrlayer-scrpage} provides a method for
|
|
manipulating headers and footers which is based on \Package{scrlayer}, is
|
|
largely compatible with \Package{scrpage2}, and at the same time greatly
|
|
expands the user interface. If you are already familiar with
|
|
\Package{scrpage2} and refrain from direct calls to its internal commands,
|
|
you can usually use \Package{scrlayer-scrpage} as a drop-in replacement.
|
|
This also applies to most examples using \Package{scrpage2} found in
|
|
\LaTeX{} books or on the Internet.%
|
|
\iffalse%
|
|
\iffree{}{\par With the release of this book, \Package{scrlayer-scrpage}
|
|
for \KOMAScript{} is recommended as the tool of choice when it comes to
|
|
changing the predefined page styles. Using the obsolete package
|
|
\Package{scrpage2}\IndexPackage[indexmain]{scrpage2}%
|
|
\important{\Package{scrpage2}} is now deprecated. Therefore, the
|
|
commands for this outdated package are no longer part of this book. If
|
|
you encounter older documents that still use \Package{scrpage2},
|
|
consider switching to \Package{scrlayer-scrpage}. Notwithstanding, this
|
|
chapter does contain some hints for using \Package{scrpage2}.}%
|
|
\fi
|
|
\end{Explain}
|
|
|
|
In addition to \Package{scrlayer-scrpage}\iffree{ or \Package{scrpage2}}{},
|
|
you could also use \Package{fancyhdr}\IndexPackage{fancyhdr} (see
|
|
\cite{package:fancyhdr}) to configure the headers and footers of pages.
|
|
However, this package has no support for several \KOMAScript{} features,
|
|
for example the element scheme (see \DescRef{\LabelBase.cmd.setkomafont},
|
|
\DescRef{\LabelBase.cmd.addtokomafont}, and
|
|
\DescRef{\LabelBase.cmd.usekomafont} in \autoref{sec:maincls.textmarkup},
|
|
\DescPageRef{maincls.cmd.setkomafont}) or the configurable numbering format
|
|
for dynamic headers (see the \DescRef{maincls.option.numbers} option and,
|
|
for example, \DescRef{\LabelBase.cmd.chaptermarkformat} in
|
|
\autoref{sec:maincls.structure}, \DescPageRef{maincls.option.numbers} and
|
|
\DescPageRef{maincls.cmd.chaptermarkformat}). Hence, if you are using a
|
|
\KOMAScript{} class, you should use the new \Package{scrlayer-scrpage}
|
|
package. \iffree{If you have problems, you can still use
|
|
\Package{scrpage2}.}{\ignorespaces} Of course, you can also use
|
|
\Package{scrlayer-scrpage} with other classes, such as the standard \LaTeX{}
|
|
ones.
|
|
|
|
Apart from the features described in this chapter, \Package{scrlayer-scrpage}
|
|
provides several more functions that are likely only of interest to a very
|
|
small number of users and therefore are described in
|
|
\autoref{cha:scrlayer-scrpage-experts} of \autoref{part:forExperts}, starting
|
|
at \autopageref{cha:scrlayer-scrpage-experts}. Nevertheless, if the options
|
|
described in \autoref{part:forAuthors} are insufficient for your purposes, you
|
|
should examine \autoref{cha:scrlayer-scrpage-experts}.
|
|
|
|
\LoadCommonFile{options} % \section{Early or late Selection of Options}
|
|
|
|
\LoadCommonFile{headfootheight} % \section{Header and Footer Height}
|
|
|
|
\LoadCommonFile{textmarkup} % \section{Text Markup}
|
|
|
|
\section{Using Predefined Page Styles}
|
|
\seclabel{predefined.pagestyles}
|
|
|
|
The easiest way to create custom headers and footers with
|
|
\Package{scrlayer-scrpage} is to use one of the predefined page styles.
|
|
%
|
|
\iffalse % Umbruchoptimierung
|
|
This section introduces the page styles defined by the
|
|
\Package{scrlayer-scrpage} package as it loads. It also explains the
|
|
commands that you can use to create basic settings for these page
|
|
styles. You can find further options, commands, and background information
|
|
in the following sections and in
|
|
\autoref{sec:scrlayer-scrpage-experts.pagestyle.pairs} in
|
|
\autoref{part:forExperts}.%
|
|
\fi
|
|
|
|
\begin{Declaration}
|
|
\PageStyle{scrheadings}%
|
|
\PageStyle{plain.scrheadings}
|
|
\end{Declaration}
|
|
The \Package{scrlayer-scrpage} package provides two page styles that you can
|
|
reconfigure to your liking. The first page style is
|
|
\PageStyle{scrheadings}\important{\PageStyle{scrheadings}}, which is intended
|
|
as a page style with running heads. Its defaults are similar to the page style
|
|
\PageStyle{headings}\IndexPagestyle{headings} of the standard \LaTeX{} or
|
|
\KOMAScript{} classes. You can configure exactly what appears in the header or
|
|
footer with the commands and options described below.
|
|
|
|
The second page style is \PageStyle{plain.scrheadings}%
|
|
\important{\PageStyle{plain.scrheadings}}, which is intended to be a style
|
|
with no running head. Its defaults resemble those of the
|
|
\PageStyle{plain}\IndexPagestyle{plain} page style of the standard or
|
|
\KOMAScript{} classes. You can configure exactly what appears in the header or
|
|
footer with the commands and options described below.
|
|
|
|
You could, of course, configure \PageStyle{scrheadings} to be a page style
|
|
without a running head and \PageStyle{plain.scrheadings} to be a page style
|
|
with a running head. It is, however, advisable to adhere to the conventions
|
|
mentioned above. The two page styles mutually influence one another. Once you
|
|
apply one of these page styles, \PageStyle{scrheadings} will become accessible
|
|
as \PageStyle{headings}\important{\PageStyle{headings}}%
|
|
\IndexPagestyle{headings} and the page style \PageStyle{plain.scrheadings}
|
|
will become accessible as \PageStyle{plain}\important{\PageStyle{plain}}%
|
|
\IndexPagestyle{plain}. Thus, if you use a class or package that automatically
|
|
switches between \PageStyle{headings} and \PageStyle{plain}, you only need to
|
|
select \PageStyle{scrheadings} or \PageStyle{plain.scrheadings} once. Direct
|
|
patches to the corresponding classes or packages are not necessary. This pair
|
|
of page styles can thus serve as a drop-in replacement for
|
|
\PageStyle{headings} and \PageStyle{plain}. If you need more such pairs,
|
|
please refer to \autoref{sec:scrlayer-scrpage-experts.pagestyle.pairs} in
|
|
\autoref{part:forExperts}.%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\Macro{lehead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cehead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{rehead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{lohead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cohead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{rohead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}
|
|
\end{Declaration}
|
|
You can set the contents of the header for the
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} and
|
|
\DescRef{\LabelBase.pagestyle.scrheadings} page styles with these commands.
|
|
The optional argument sets the content of an element of the
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} page style, while the
|
|
mandatory argument sets the content of the corresponding element of the
|
|
\DescRef{\LabelBase.pagestyle.scrheadings} page style.
|
|
|
|
The contents of even\,---\,or left-hand\,---\,pages\textnote{left-hand pages}
|
|
can be set with \Macro{lehead}, \Macro{cehead}, and \Macro{rehead}. The
|
|
``\texttt{e}'' appearing as the second letter of the commands' names stands
|
|
for ``\emph{even}''.
|
|
|
|
The contents of odd\,---\,or right-hand\,---\,pages\textnote{right-hand pages}
|
|
can be set with \Macro{lohead}, \Macro{cohead}, and \Macro{rohead}. The
|
|
``\texttt{o}'' appearing as the second letter of the commands' names stands
|
|
for ``\emph{odd}''.
|
|
|
|
Note\textnote{Attention!} that in one-sided printing, only right-hand pages
|
|
exist, and \LaTeX{} designates these as odd pages regardless of their page
|
|
number.
|
|
|
|
Each header consists of a left-aligned\textnote{left aligned} element that can
|
|
be set with \Macro{lehead} or \Macro{lohead}. The ``\texttt{l}'' appearing as
|
|
the first letter of the commands' names stands for ``\emph{left aligned}''.
|
|
|
|
Similarly, each header has a centred\textnote{centred} element that can be set
|
|
with \Macro{cehead} or \Macro{cohead}. The ``\texttt{c}'' appearing as the
|
|
first letter of the command' names stands for ``\emph{centred}''.
|
|
|
|
Likewise, each header has a right-aligned\textnote{right aligned} element that
|
|
can be set with \Macro{rehead} or \Macro{rohead}. The ``\texttt{r}'' appearing
|
|
as the first letter of the commands' names stands for ``\emph{right
|
|
aligned}''.
|
|
|
|
\BeginIndexGroup
|
|
\BeginIndex{FontElement}{pagehead}\LabelFontElement{pagehead}%
|
|
\BeginIndex{FontElement}{pageheadfoot}\LabelFontElement{pageheadfoot}%
|
|
These elements do not have individual font attributes that you can
|
|
change using the commands \DescRef{\LabelBase.cmd.setkomafont} and
|
|
\DescRef{\LabelBase.cmd.addtokomafont} (see \autoref{sec:maincls.textmarkup},
|
|
\DescPageRef{maincls.cmd.setkomafont}). Instead, they use an element named
|
|
\FontElement{pagehead}. Before this element is applied, the
|
|
\FontElement{pageheadfoot} element will also be applied. See
|
|
\autoref{tab:scrlayer-scrpage.fontelements} for the defaults of these
|
|
elements.%
|
|
\EndIndexGroup
|
|
|
|
The meaning of each command for headers in two-sided printing is illustrated
|
|
in \autoref{fig:scrlayer-scrpage.head}.%
|
|
%
|
|
\begin{figure}[tp]
|
|
\centering
|
|
\begin{picture}(\textwidth,30mm)(0,-10mm)
|
|
\thinlines
|
|
\small\ttfamily
|
|
% left/even page
|
|
\put(0,20mm){\line(1,0){.49\textwidth}}%
|
|
\put(0,0){\line(0,1){20mm}}%
|
|
\multiput(0,0)(0,-1mm){10}{\line(0,-1){.5mm}}%
|
|
\put(.49\textwidth,5mm){\line(0,1){15mm}}%
|
|
\put(.05\textwidth,10mm){%
|
|
\color{ImageRed}%
|
|
\put(-.5em,0){\line(1,0){4em}}%
|
|
\multiput(3.5em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-.5em,0){\line(0,1){\baselineskip}}%
|
|
\put(-.5em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(3.5em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\makebox(4em,5mm)[l]{\Macro{lehead}}%
|
|
}%
|
|
\put(.465\textwidth,10mm){%
|
|
\color{ImageBlue}%
|
|
\put(-4em,0){\line(1,0){4em}}%
|
|
\multiput(-4em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(0,0){\line(0,1){\baselineskip}}%
|
|
\put(-4em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(-4em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-4.5em,0){\makebox(4em,5mm)[r]{\Macro{rehead}}}%
|
|
}%
|
|
\put(.2525\textwidth,10mm){%
|
|
\color{ImageGreen}%
|
|
\put(-2em,0){\line(1,0){4em}}%
|
|
\multiput(2em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(2em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,0){\makebox(4em,5mm)[c]{\Macro{cehead}}}%
|
|
}%
|
|
% right/odd page
|
|
\put(.51\textwidth,20mm){\line(1,0){.49\textwidth}}%
|
|
\put(.51\textwidth,5mm){\line(0,1){15mm}}%
|
|
\put(\textwidth,0){\line(0,1){20mm}}%
|
|
\multiput(\textwidth,0)(0,-1mm){10}{\line(0,-1){.5mm}}%
|
|
\put(.5325\textwidth,10mm){%
|
|
\color{ImageBlue}%
|
|
\put(0,0){\line(1,0){4em}}%
|
|
\multiput(4em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(0,0){\line(0,1){\baselineskip}}%
|
|
\put(0em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(4em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(.5em,0){\makebox(4em,5mm)[l]{\Macro{lohead}}}%
|
|
}%
|
|
\put(.965\textwidth,10mm){%
|
|
\color{ImageRed}%
|
|
\put(-4em,0){\line(1,0){4em}}%
|
|
\multiput(-4em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(0,0){\line(0,1){\baselineskip}}%
|
|
\put(-4em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(-4em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-4.5em,0){\makebox(4em,5mm)[r]{\Macro{rohead}}}%
|
|
}%
|
|
\put(.75\textwidth,10mm){%
|
|
\color{ImageGreen}%
|
|
\put(-2em,0){\line(1,0){4em}}%
|
|
\multiput(2em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(2em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,0){\makebox(4em,5mm)[c]{\Macro{cohead}}}%
|
|
}%
|
|
% commands for both pages
|
|
\color{ImageBlue}%
|
|
\put(.5\textwidth,0){\makebox(0,\baselineskip)[c]{\Macro{ihead}}}%
|
|
\color{ImageGreen}%
|
|
\put(.5\textwidth,-5mm){\makebox(0,\baselineskip)[c]{\Macro{chead}}}
|
|
\color{ImageRed}%
|
|
\put(.5\textwidth,-10mm){\makebox(0,\baselineskip)[c]{\Macro{ohead}}}
|
|
\put(\dimexpr.5\textwidth-2em,.5\baselineskip){%
|
|
\color{ImageBlue}%
|
|
\put(0,0){\line(-1,0){1.5em}}%
|
|
\put(-1.5em,0){\vector(0,1){5mm}}%
|
|
\color{ImageGreen}%
|
|
\put(0,-1.25\baselineskip){\line(-1,0){\dimexpr .25\textwidth-2em\relax}}%
|
|
\put(-\dimexpr
|
|
.25\textwidth-2em\relax,-1.25\baselineskip){\vector(0,1){\dimexpr
|
|
5mm+1.25\baselineskip\relax}}
|
|
\color{ImageRed}%
|
|
\put(0,-2.5\baselineskip){\line(-1,0){\dimexpr .45\textwidth-4em\relax}}%
|
|
\put(-\dimexpr
|
|
.45\textwidth-4em\relax,-2.5\baselineskip){\vector(0,1){\dimexpr
|
|
5mm+2.5\baselineskip\relax}}
|
|
}%
|
|
\put(\dimexpr.5\textwidth+2em,.5\baselineskip){%
|
|
\color{ImageBlue}%
|
|
\put(0,0){\line(1,0){1.5em}}%
|
|
\put(1.5em,0){\vector(0,1){5mm}}%
|
|
\color{ImageGreen}%
|
|
\put(0,-1.25\baselineskip){\line(1,0){\dimexpr .25\textwidth-2em\relax}}
|
|
\put(\dimexpr
|
|
.25\textwidth-2em\relax,-1.25\baselineskip){\vector(0,1){\dimexpr
|
|
5mm+1.25\baselineskip\relax}}
|
|
\color{ImageRed}%
|
|
\put(0,-2.5\baselineskip){\line(1,0){\dimexpr .45\textwidth-4em\relax}}
|
|
\put(\dimexpr
|
|
.45\textwidth-4em\relax,-2.5\baselineskip){\vector(0,1){\dimexpr
|
|
5mm+2.5\baselineskip\relax}}
|
|
}%
|
|
\end{picture}
|
|
\caption[Commands for setting the page header]%
|
|
{The meaning of the commands for setting the contents of page headers
|
|
shown on a two-page schematic}
|
|
\label{fig:scrlayer-scrpage.head}
|
|
\end{figure}
|
|
%
|
|
\begin{Example}
|
|
Suppose you're writing a short article and you want the author's name to
|
|
appear on the left side of the page and the article's title to appear
|
|
right. You can write, for example:
|
|
\begin{lstcode}
|
|
\documentclass{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\lohead{John Doe}
|
|
\rohead{Page style with \KOMAScript}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\end{document}
|
|
\end{lstcode}
|
|
But what happens? On the first page there's only a page number in the
|
|
footer, while the header remains empty!
|
|
|
|
The explanation is simple: The \Class{scrartcl} class, like the default
|
|
\Class{article} class, switches to the \PageStyle{plain} page style for the
|
|
page which contains the title. After the command
|
|
\DescRef{maincls.cmd.pagestyle}\PParameter{scrheadings} in the preamble of
|
|
our example, this actually refers to the
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} page style. The default for
|
|
this page style when using a \KOMAScript{} class is an empty page header and
|
|
a page number in the footer. In the example, the optional arguments of
|
|
\Macro{lohead} and \Macro{rohead} are omitted, so the
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} page style remains
|
|
unchanged and the result for the first page is actually correct.
|
|
|
|
Now add enough text to the example after \DescRef{maincls.cmd.maketitle}
|
|
so that a second page is printed. You can simply add
|
|
\Macro{usepackage}\PParameter{lipsum}\IndexPackage{lipsum} to the document
|
|
preamble and \Macro{lipsum}\IndexCmd{lipsum} below
|
|
\DescRef{maincls.cmd.maketitle}. You will see that the header of the second
|
|
page now contains the author and the document title as we wanted.
|
|
|
|
For comparison, you should also add the optional argument to
|
|
\Macro{lohead} and \Macro{rohead}. Change the example as follows:
|
|
\begin{lstcode}
|
|
\documentclass{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\lohead[John Doe]
|
|
{John Doe}
|
|
\rohead[Page style with \KOMAScript]
|
|
{Page style with \KOMAScript}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\end{document}
|
|
\end{lstcode}
|
|
Now you have a header on the first page just above the title itself.
|
|
That is because you have reconfigured page style
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} with the two optional
|
|
arguments. As you probably appreciate, it would be better to leave this page
|
|
style unchanged, as a running head above the document title is rather
|
|
annoying.
|
|
|
|
By the way, as an alternative to configuring
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} you could, if you were
|
|
using a \KOMAScript{} class, have changed the page style for pages that
|
|
contain title headers. See \DescRef{maincls.cmd.titlepagestyle}%
|
|
\important{\DescRef{maincls.cmd.titlepagestyle}}%
|
|
\IndexCmd{titlepagestyle} in \autoref{sec:maincls.pagestyle},
|
|
\DescPageRef{maincls.cmd.titlepagestyle}.
|
|
\end{Example}
|
|
|
|
Note\textnote{Attention!} that you should never put a section
|
|
heading or section number directly into the header using one of these
|
|
commands. Because of the asynchronous way that \TeX{} lays out and outputs
|
|
pages, doing so can easily result in the wrong number or heading text in the
|
|
running head. Instead you should use the mark mechanism, ideally in
|
|
conjunction with the procedures explained in the next section.%
|
|
\EndIndexGroup
|
|
|
|
\begin{Declaration}
|
|
\Macro{lehead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cehead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{rehead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{lohead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cohead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{rohead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}
|
|
\end{Declaration}
|
|
The starred versions\ChangedAt{v3.14}{\Package{scrlayer-scrpage}} of the
|
|
previously described commands differ from the ordinary versions only if you
|
|
omit the optional argument \PName{plain.scrheadings content}. In this case,
|
|
the version without the star does not change the contents of
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings}. The starred version, on the
|
|
other hand, uses the mandatory argument \PName{scrheading content}
|
|
for \DescRef{\LabelBase.pagestyle.plain.scrheadings} as well. So if both
|
|
arguments should be the same, you can simply use the starred version with only
|
|
the mandatory argument.%
|
|
|
|
\begin{Example}
|
|
You can shorten the previous example using the starred versions of
|
|
\DescRef{\LabelBase.cmd.lohead} and \DescRef{\LabelBase.cmd.rohead}:
|
|
\begin{lstcode}
|
|
\documentclass{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\lohead*{John Doe}
|
|
\rohead*{Page style with \KOMAScript}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\end{document}
|
|
\end{lstcode}%
|
|
\end{Example}%
|
|
\EndIndexGroup
|
|
\ExampleEndFix
|
|
|
|
|
|
\begin{Declaration}
|
|
\Macro{lefoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cefoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{refoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{lofoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cofoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{rofoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}
|
|
\end{Declaration}
|
|
You can define the contents of the footer for
|
|
\DescRef{\LabelBase.pagestyle.scrheadings} and
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} with these commands. The
|
|
optional argument defines the content of an element of
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings}, while the mandatory argument
|
|
sets the content of the corresponding element of
|
|
\DescRef{\LabelBase.pagestyle.scrheadings}.
|
|
|
|
The contents of even\,---\,or left-hand\,---\,pages\textnote{left-hand page}
|
|
are set with \Macro{lefoot}, \Macro{cefoot}, and \Macro{refoot}. The
|
|
``\texttt{e}'' appearing as the second letter of the commands' names stands
|
|
for ``\emph{even}''.
|
|
|
|
The contents of odd\,---\,or right-hand\,---\,pages\textnote{right-hand page}
|
|
are set with \Macro{lofoot}, \Macro{cofoot}, and \Macro{rofoot}. The
|
|
``\texttt{o}'' appearing as the second letter of the commands' names stands
|
|
for ``\emph{odd}''.
|
|
|
|
Note\textnote{Attention!} that in one-sided printing, only right-hand pages
|
|
exist, and \LaTeX{} designates these as odd pages regardless of their page
|
|
number.
|
|
|
|
Each footer consists of a left-aligned\textnote{left aligned} element that can
|
|
be set with \Macro{lefoot} or \Macro{lofoot}. The ``\texttt{l}'' appearing as
|
|
the first letter of the commands' names stands for ``\emph{left aligned}''.
|
|
|
|
Similarly, each footer has a centred\textnote{centred} element that can be set
|
|
with \Macro{cefoot} or \Macro{cofoot}. The ``\texttt{c}'' in the first letter
|
|
of the command' names stands for ``\emph{centred}''.
|
|
|
|
Likewise, each footer has a right-aligned\textnote{right aligned} element that
|
|
can be set with \Macro{refoot} or \Macro{rofoot}. The ``\texttt{r}'' in the
|
|
first letter of the commands' names stands for ``\emph{right aligned}''.
|
|
|
|
\BeginIndexGroup
|
|
\BeginIndex{FontElement}{pagefoot}\LabelFontElement{pagefoot}%
|
|
\BeginIndex{FontElement}{pageheadfoot}\LabelFontElement[foot]{pageheadfoot}%
|
|
However, these elements do not have individual font attributes that can be
|
|
changed with the \DescRef{\LabelBase.cmd.setkomafont} and
|
|
\DescRef{\LabelBase.cmd.addtokomafont} commands (see
|
|
\autoref{sec:maincls.textmarkup}, \DescPageRef{maincls.cmd.setkomafont}).
|
|
Instead, they use an element named
|
|
\FontElement{pagefoot}\important{\FontElement{pagefoot}}. Before this element
|
|
is applied, the font element
|
|
\FontElement{pageheadfoot}\important{\FontElement{pageheadfoot}} is also
|
|
applied. See \autoref{tab:scrlayer-scrpage.fontelements} for the defaults of
|
|
the fonts of these elements.%
|
|
\EndIndexGroup
|
|
|
|
The meaning of each command for footers in two-sided printing is illustrated
|
|
in \autoref{fig:scrlayer-scrpage.foot}.%
|
|
%
|
|
\begin{figure}[bp]
|
|
\centering
|
|
\begin{picture}(\textwidth,30mm)
|
|
\thinlines
|
|
\small\ttfamily
|
|
% left page
|
|
\put(0,0){\line(1,0){.49\textwidth}}%
|
|
\put(0,0){\line(0,1){20mm}}%
|
|
\multiput(0,20mm)(0,1mm){10}{\line(0,1){.5mm}}%
|
|
\put(.49\textwidth,0){\line(0,1){15mm}}%
|
|
\put(.05\textwidth,5mm){%
|
|
\color{ImageRed}%
|
|
\put(-.5em,0){\line(1,0){4em}}%
|
|
\multiput(3.5em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-.5em,0){\line(0,1){\baselineskip}}%
|
|
\put(-.5em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(3.5em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\makebox(4em,5mm)[l]{\Macro{lefoot}}%
|
|
}%
|
|
\put(.465\textwidth,5mm){%
|
|
\color{ImageBlue}%
|
|
\put(-4em,0){\line(1,0){4em}}%
|
|
\multiput(-4em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(0,0){\line(0,1){\baselineskip}}%
|
|
\put(-4em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(-4em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-4.5em,0){\makebox(4em,5mm)[r]{\Macro{refoot}}}%
|
|
}%
|
|
\put(.2525\textwidth,5mm){%
|
|
\color{ImageGreen}%
|
|
\put(-2em,0){\line(1,0){4em}}%
|
|
\multiput(2em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(2em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,0){\makebox(4em,5mm)[c]{\Macro{cefoot}}}%
|
|
}%
|
|
% right page
|
|
\put(.51\textwidth,0){\line(1,0){.49\textwidth}}%
|
|
\put(.51\textwidth,0){\line(0,1){15mm}}%
|
|
\put(\textwidth,0){\line(0,1){20mm}}%
|
|
\multiput(\textwidth,20mm)(0,1mm){10}{\line(0,1){.5mm}}%
|
|
\put(.5325\textwidth,5mm){%
|
|
\color{ImageBlue}%
|
|
\put(0,0){\line(1,0){4em}}%
|
|
\multiput(4em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(0,0){\line(0,1){\baselineskip}}%
|
|
\put(0em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(4em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(.5em,0){\makebox(4em,5mm)[l]{\Macro{lofoot}}}%
|
|
}%
|
|
\put(.965\textwidth,5mm){%
|
|
\color{ImageRed}%
|
|
\put(-4em,0){\line(1,0){4em}}%
|
|
\multiput(-4em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(0,0){\line(0,1){\baselineskip}}%
|
|
\put(-4em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(-4em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-4.5em,0){\makebox(4em,5mm)[r]{\Macro{rofoot}}}%
|
|
}%
|
|
\put(.75\textwidth,5mm){%
|
|
\color{ImageGreen}%
|
|
\put(-2em,0){\line(1,0){4em}}%
|
|
\multiput(2em,0)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,0)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,\baselineskip){\line(1,0){4em}}%
|
|
\multiput(2em,\baselineskip)(.25em,0){5}{\line(1,0){.125em}}%
|
|
\multiput(-2em,\baselineskip)(-.25em,0){5}{\line(1,0){.125em}}%
|
|
\put(-2em,0){\makebox(4em,5mm)[c]{\Macro{cofoot}}}%
|
|
}%
|
|
% both pages
|
|
\color{ImageBlue}%
|
|
\put(.5\textwidth,15mm){\makebox(0,\baselineskip)[c]{\Macro{ifoot}}}%
|
|
\color{ImageGreen}%
|
|
\put(.5\textwidth,20mm){\makebox(0,\baselineskip)[c]{\Macro{cfoot}}}
|
|
\color{ImageRed}%
|
|
\put(.5\textwidth,25mm){\makebox(0,\baselineskip)[c]{\Macro{ofoot}}}
|
|
\put(\dimexpr.5\textwidth-2em,.5\baselineskip){%
|
|
\color{ImageBlue}%
|
|
\put(0,15mm){\line(-1,0){1.5em}}%
|
|
\put(-1.5em,15mm){\vector(0,-1){5mm}}%
|
|
\color{ImageGreen}%
|
|
\put(0,20mm){\line(-1,0){\dimexpr .25\textwidth-2em\relax}}%
|
|
\put(-\dimexpr .25\textwidth-2em\relax,20mm){\vector(0,-1){10mm}}%
|
|
\color{ImageRed}%
|
|
\put(0,25mm){\line(-1,0){\dimexpr .45\textwidth-4em\relax}}%
|
|
\put(-\dimexpr .45\textwidth-4em\relax,25mm){\vector(0,-1){15mm}}%
|
|
}%
|
|
\put(\dimexpr.5\textwidth+2em,.5\baselineskip){%
|
|
\color{ImageBlue}%
|
|
\put(0,15mm){\line(1,0){1.5em}}%
|
|
\put(1.5em,15mm){\vector(0,-1){5mm}}%
|
|
\color{ImageGreen}%
|
|
\put(0,20mm){\line(1,0){\dimexpr .25\textwidth-2em\relax}}%
|
|
\put(\dimexpr .25\textwidth-2em\relax,20mm){\vector(0,-1){10mm}}%
|
|
\color{ImageRed}%
|
|
\put(0,25mm){\line(1,0){\dimexpr .45\textwidth-4em\relax}}%
|
|
\put(\dimexpr .45\textwidth-4em\relax,25mm){\vector(0,-1){15mm}}%
|
|
}%
|
|
\end{picture}
|
|
\caption[Commands for setting the page footer]%
|
|
{The meaning of the commands for setting the contents of page
|
|
footers shown on a two-page schematic}%
|
|
\label{fig:scrlayer-scrpage.foot}
|
|
\end{figure}
|
|
%
|
|
\begin{Example}
|
|
Let's return to the example of the short article. Let's say you want to
|
|
specify the publisher in the left side of the footer. You would change the
|
|
example above to:
|
|
\begin{lstcode}
|
|
\documentclass{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\lohead{John Doe}
|
|
\rohead{Page style with \KOMAScript}
|
|
\lofoot{Smart Alec Publishing}
|
|
\usepackage{lipsum}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\lipsum
|
|
\end{document}
|
|
\end{lstcode}
|
|
Once again the publisher is not printed on the first page with the title.
|
|
The reason is the same as in the example with
|
|
\DescRef{\LabelBase.cmd.lohead} above. And the solution for getting the
|
|
publisher on the first page is similar:
|
|
\begin{lstcode}
|
|
\lofoot[Smart Alec Publishing]
|
|
{Smart Alec Publishing}
|
|
\end{lstcode}
|
|
Now you decide\textnote{font change}\important{\FontElement{pageheadfoot}}%
|
|
\IndexFontElement{pageheadfoot} that the header and footer should use an
|
|
upright but smaller font in place of the default slanted font:
|
|
\begin{lstcode}
|
|
\setkomafont{pageheadfoot}{\small}
|
|
\end{lstcode}
|
|
In addition, the header, but not the footer, should be bold:
|
|
\begin{lstcode}
|
|
\setkomafont{pagehead}{\bfseries}
|
|
\end{lstcode}
|
|
It is important\textnote{Attention!} that this command does not occur until
|
|
after \Package{scrpage-scrlayer} has been loaded because the \KOMAScript{}
|
|
class defines \DescRef{\LabelBase.fontelement.pagehead} as an alias for
|
|
\DescRef{\LabelBase.fontelement.pageheadfoot}. Only by loading
|
|
\Package{scrpage-scrlayer} will \DescRef{\LabelBase.fontelement.pagehead}
|
|
become an element independent of
|
|
\DescRef{\LabelBase.fontelement.pageheadfoot}.
|
|
|
|
Now add one more \Macro{lipsum} and the
|
|
\Option{twoside}\IndexOption{twoside}\important{\Option{twoside}} option
|
|
when loading \Class{scrartcl}. First of all, you will see the page number
|
|
moves from the centre to the outer margin of the page footer, due to the
|
|
changed defaults of \DescRef{\LabelBase.pagestyle.scrheadings} and
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} for two-sided printing with
|
|
a \KOMAScript{} class.
|
|
|
|
Simultaneously, the author, document title, and publisher will vanish from
|
|
page~2. They only appear on page~3. That's because we've only used
|
|
commands for odd pages. You can recognise this by the ``\texttt{o}'' in the
|
|
second position of the command names.
|
|
|
|
Now, we could simply copy those commands and replace the ``\texttt{o}'' with
|
|
an ``\texttt{e}'' to define the contents of \emph{even} pages. But with
|
|
two-sided printing, it makes more sense to use mirror-inverted elements,
|
|
i.\,e. the left element of an even page should become the right element of
|
|
the odd page and visa versa. To achieve this, we also replace the first
|
|
letter ``\texttt{l}'' with ``\texttt{r}'':
|
|
\begin{lstcode}
|
|
\documentclass[twoside]{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\lohead{John Doe}
|
|
\rohead{Page style with \KOMAScript}
|
|
\lofoot[Smart Alec Publishing]
|
|
{Smart Alec Publishing}
|
|
\rehead{John Doe}
|
|
\lohead{Page style with \KOMAScript}
|
|
\refoot[Smart Alec Publishing]
|
|
{Smart Alec Publishing}
|
|
\usepackage{lipsum}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\lipsum\lipsum
|
|
\end{document}
|
|
\end{lstcode}
|
|
\end{Example}
|
|
%
|
|
Since it is a bit cumbersome to define left and right pages separately in
|
|
cases such as the previous example, a simpler solution for this common case is
|
|
introduced below.
|
|
|
|
Allow me once again an important note:\textnote{Attention!} you should
|
|
never put a section heading or section number directly into the footer using
|
|
one of these commands. Because of the asynchronous way that \TeX{} lays out and
|
|
outputs pages, doing so can easily result in the wrong number or heading text
|
|
in the running head. Instead you should use the mark mechanism, ideally in
|
|
conjunction with the procedures explained in the next section.%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\Macro{lefoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cefoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{refoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{lofoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cofoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{rofoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}
|
|
\end{Declaration}
|
|
The starred versions\ChangedAt{v3.14}{\Package{scrlayer-scrpage}} of the
|
|
previously described commands differ only if you omit the optional argument
|
|
\OParameter{plain.scrheadings content}. In this case, the version without the
|
|
star does not change the contents of
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings}. The starred version, on the
|
|
other hand, uses the mandatory argument \PName{scrheading content} for
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} as well. So if both arguments
|
|
should be the same, you can simply use the starred version with just the
|
|
mandatory argument.%
|
|
|
|
\begin{Example}
|
|
You can shorten the previous example using the star versions of
|
|
\DescRef{\LabelBase.cmd.lofoot} and \DescRef{\LabelBase.cmd.refoot}:
|
|
\begin{lstcode}
|
|
\documentclass[twoside]{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\lohead{John Doe}
|
|
\rohead{Page style with \KOMAScript}
|
|
\lofoot*{Smart Alec Publishing}
|
|
\rehead{John Doe}
|
|
\lohead{Page style with \KOMAScript}
|
|
\refoot*{Smart Alec Publishing}
|
|
\usepackage{lipsum}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\lipsum\lipsum
|
|
\end{document}
|
|
\end{lstcode}
|
|
\end{Example}
|
|
%
|
|
\EndIndexGroup
|
|
\ExampleEndFix
|
|
|
|
|
|
\begin{Declaration}
|
|
\Macro{ohead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{chead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{ihead}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{ofoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cfoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{ifoot}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}
|
|
\end{Declaration}
|
|
To configure the headers and footers for two-sided printing with the
|
|
previously described commands, you would have to configure the left and right
|
|
sides separately from one another. In most cases, however, the left and right
|
|
sides are more or less symmetrical. An item that appears on the left of an
|
|
even page should appear on the right of an odd page and vice versa. Centred
|
|
elements are usually centred on both sides.
|
|
|
|
To simplify the definition of such symmetric page styles,
|
|
\Package{scrlayer-scrpage} has shortcuts. The \Macro{ohead} command
|
|
corresponds to a call to both \DescRef{\LabelBase.cmd.lehead} and
|
|
\DescRef{\LabelBase.cmd.rohead}. The \Macro{chead} command corresponds to a
|
|
call to both \DescRef{\LabelBase.cmd.cehead} and
|
|
\DescRef{\LabelBase.cmd.cohead}. And the \Macro{ihead} command corresponds to
|
|
a call to both \DescRef{\LabelBase.cmd.rehead} and
|
|
\DescRef{\LabelBase.cmd.lohead}. The same applies to the equivalent commands
|
|
for the page footer. An outline of these relationships can also be found in
|
|
\autoref{fig:scrlayer-scrpage.head} on \autopageref{fig:scrlayer-scrpage.head}
|
|
and \autoref{fig:scrlayer-scrpage.foot} on
|
|
\autopageref{fig:scrlayer-scrpage.foot}.
|
|
%
|
|
\begin{Example}
|
|
You can simplify the previous example using the new commands:
|
|
\begin{lstcode}
|
|
\documentclass[twoside]{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\ihead{John Doe}
|
|
\ohead{Page style with \KOMAScript}
|
|
\ifoot[Smart Alec Publishing]
|
|
{Smart Alec Publishing}
|
|
\usepackage{lipsum}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\lipsum\lipsum
|
|
\end{document}
|
|
\end{lstcode}
|
|
\iffalse%
|
|
As you can see, you can use half the number of commands but get the same
|
|
result. %
|
|
\fi%
|
|
\end{Example}%
|
|
Because one-sided printing treats all pages as odd pages, these commands are
|
|
synonymous with the corresponding right-side commands when in one-sided mode.
|
|
Therefore in most cases you will only need these six commands instead of the
|
|
twelve described before.
|
|
|
|
Allow me once again an important note:\textnote{Attention!} you should never
|
|
put a section heading or section number directly into the footer using one of
|
|
these commands. Because of the asynchronous way that \TeX{} lays out and
|
|
outputs pages, doing so can easily result in the wrong number or heading text
|
|
in the running head. Instead you should use the mark mechanism, ideally in
|
|
conjunction with the procedures explained in the next section.%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\Macro{ohead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{chead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{ihead*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{ofoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{cfoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}%
|
|
\Macro{ifoot*}\OParameter{plain.scrheadings content}%
|
|
\Parameter{scrheadings content}
|
|
\end{Declaration}
|
|
The previously described commands also have starred
|
|
versions\ChangedAt{v3.14}{\Package{scrlayer-scrpage}} that differ only if you
|
|
omit the optional argument \OParameter{plain.scrheadings content}. In this
|
|
case, the version without a star does not change the content of
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings}. The version with the star,
|
|
on the other hand, also uses the mandatory argument \PName{scrheadings
|
|
content} for \DescRef{\LabelBase.pagestyle.plain.scrheadings}. So if both
|
|
arguments should be the same, you can simply use the starred version with only
|
|
the mandatory argument.%
|
|
|
|
\begin{Example}
|
|
You can shorten the previous example using the star version of
|
|
\DescRef{\LabelBase.cmd.ifoot}:
|
|
\begin{lstcode}
|
|
\documentclass[twoside]{scrartcl}
|
|
\usepackage{scrlayer-scrpage}
|
|
\ihead{John Doe}
|
|
\ohead{Page style with \KOMAScript}
|
|
\ifoot*{Smart Alec Publishing}
|
|
\usepackage{lipsum}
|
|
\begin{document}
|
|
\title{Page styles with \KOMAScript}
|
|
\author{John Doe}
|
|
\maketitle
|
|
\lipsum\lipsum
|
|
\end{document}
|
|
\end{lstcode}%
|
|
\end{Example}%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\OptionVName{pagestyleset}{setting}
|
|
\end{Declaration}
|
|
\BeginIndex{Option}{pagestyleset~=KOMA-Script}%
|
|
\BeginIndex{Option}{pagestyleset~=standard}%
|
|
The examples above refer several times to the default settings of the page
|
|
styles \DescRef{\LabelBase.pagestyle.scrheadings}\IndexPagestyle{scrheadings}
|
|
and \DescRef{\LabelBase.pagestyle.plain.scrheadings}%
|
|
\IndexPagestyle{plain.scrheadings}. In fact, \Package{scrlayer-scrpage}
|
|
currently provides two different defaults for these page styles. You can
|
|
select them manually with the \Option{pagestyleset} option.
|
|
|
|
The
|
|
\PValue{KOMA-Script}\important{\OptionValue{pagestyleset}{KOMA-Script}}
|
|
\PName{setting} selects the defaults, which are also set automatically if the
|
|
option is not specified and a \KOMAScript{} class is detected. In two-sided
|
|
printing, \DescRef{\LabelBase.pagestyle.scrheadings} uses outer-aligned
|
|
running heads in the header and outer-aligned page numbers in the footer.
|
|
In one-sided printing, the running head will be printed in the
|
|
middle of the header and the page number in the middle of the footer. Upper-
|
|
and lower-case letters are used in the automatic running heads as they
|
|
actually appear in the sectioning headings. This corresponds to the
|
|
\OptionValueRef{\LabelBase}{markcase}{used}\IndexOption{markcase~=used}%
|
|
\important{\OptionValueRef{\LabelBase}{markcase}{used}} option. The
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} page style has no running
|
|
heads, but the page numbers are printed in the same manner.
|
|
|
|
However, if the \hyperref[cha:scrlttr2]{\Class{scrlttr2}}%
|
|
\important{\hyperref[cha:scrlttr2]{\Class{scrlttr2}}}%
|
|
\IndexClass{scrlttr2} class is detected, the default settings are based on the
|
|
page styles of that class. See \autoref{sec:scrlttr2.pagestyle},
|
|
\autopageref{sec:scrlttr2.pagestyle}.
|
|
|
|
The
|
|
\PValue{standard}\important{\OptionValue{pagestyleset}{standard}}
|
|
\PName{setting} selects defaults that match the page styles of the standard
|
|
classes. This is also activated automatically if the option has not been
|
|
specified and no \KOMAScript{} class is detected. In this case, for two-sided
|
|
printing \DescRef{\LabelBase.pagestyle.scrheadings} uses running heads
|
|
inner-aligned in the header, and the page numbers will be printed\,---\,also
|
|
in the header\,---\,outer-aligned. One-sided printing uses the same settings,
|
|
but since only right-hand pages exist in this mode, the running head will
|
|
always be left-aligned and the page number right-aligned. The automatic
|
|
running heads\,---\,despite considerable typographic objections\,---\,are
|
|
converted to capital letters, as they would be with
|
|
\OptionValueRef{\LabelBase}{markcase}{upper}\IndexOption{markcase~=upper}%
|
|
\important{\OptionValueRef{\LabelBase}{markcase}{upper}}. In one-sided
|
|
printing, the \DescRef{\LabelBase.pagestyle.plain.scrheadings} page style
|
|
differs considerably from \DescRef{\LabelBase.pagestyle.scrheadings} because
|
|
the page number is printed in the middle of the footer.
|
|
Unlike\textnote{\KOMAScript{} vs. standard classes} the \PageStyle{plain} page
|
|
style in the standard classes,
|
|
\DescRef{\LabelBase.pagestyle.plain.scrheadings} omits the page number in
|
|
two-sided printing. The standard classes print the page number in the middle
|
|
of the footer, which does not match the rest of the page styles in two-sided
|
|
printing.
|
|
\iffalse % Umbruchkorrekturtext
|
|
If you want the page number back
|
|
\begin{lstcode}
|
|
\cfoot[\pagemark]{}
|
|
\end{lstcode}
|
|
will restore it. %
|
|
\fi%
|
|
The running head is omitted in \DescRef{\LabelBase.pagestyle.plain.scrheadings}.
|
|
|
|
Note\textnote{Attention!} that using this option activates the
|
|
\DescRef{\LabelBase.pagestyle.scrheadings}\IndexPagestyle{scrheadings}%
|
|
\important{\DescRef{\LabelBase.pagestyle.scrheadings}} page style.
|
|
\iffalse% Umbruchkorrektur
|
|
This also applies if you use the option within the document.%
|
|
\fi
|
|
%
|
|
\EndIndexGroup
|
|
|
|
|
|
\LoadCommonFile{pagestylemanipulation} % \section{Manipulating Defined Page Styles}
|
|
|
|
\begin{Declaration}
|
|
\OptionVName{headwidth}{width\textup{:}offset\textup{:}offset}%
|
|
\OptionVName{footwidth}{width\textup{:}offset\textup{:}offset}
|
|
\end{Declaration}
|
|
By default the header\Index{header>width} and footer\Index{footer>width} are
|
|
as wide as the type area. However, you can change this using these
|
|
\KOMAScript{} options. The value \PName{width} is the desired width of the
|
|
header or footer. The \PName{offset} defines how far the header or footer
|
|
should be moved towards the outer\,---\,in one-sided printing to the
|
|
right\,---\,margin. All three\ChangedAt{v3.14}{\Package{scrlayer-scrpage}}
|
|
values are optional and can be omitted. If you omit a value, you can also omit
|
|
the associated colon to the left of it. If only one \PName{offset} is
|
|
specified, it is used for both odd and even pages. Otherwise, the first
|
|
\PName{offset} is used for odd and the second \PName{offset} for even pages in
|
|
two-sided mode. If you only use one value without a colon, this will be the
|
|
\PName{width}.
|
|
|
|
For both the \PName{width} and the \PName{offset} you can use any valid length
|
|
value, \LaTeX{} length, \TeX{} dimension, or \TeX{} skip. In addition, you can
|
|
use an \eTeX{} dimension expression with the basic arithmetic operations
|
|
\texttt{+}, \texttt{-}, \texttt{*}, \texttt{/}, and parentheses. See
|
|
\cite[section~3.5]{manual:eTeX} for more information on such expressions. See
|
|
\autoref{sec:scrlayer-scrpage.options} for more information on using a
|
|
\LaTeX{} length as an option value. The \PName{width} can also be one of the
|
|
symbolic values shown in \autoref{tab:scrlayer-scrpage.symbolic.values}.
|
|
|
|
By default the header and the footer are the width of the text area. The
|
|
default \PName{offset} depends on the selected \PName{width}. One-sided
|
|
printing typically uses half the difference between \PName{width} and the
|
|
width of the text area. This centres the header horizontally above the text
|
|
area. Two-sided printing, on the other hand, uses only a third of the
|
|
difference between \PName{width} and the width of the text area. However, if
|
|
\PName{width} is the width of the whole text area and the marginal note
|
|
column, the default \PName{offset} will be zero. If this is too complicated
|
|
for you, you should simply specify the desired \PName{offset} yourself.
|
|
%
|
|
\begin{table}
|
|
\centering
|
|
\caption[Symbolic values for the \Option{headwidth} and \Option{footwidth}
|
|
options]{Available symbolic values for the \PName{width} value of options
|
|
\Option{headwidth} and \Option{footwidth}}
|
|
\label{tab:scrlayer-scrpage.symbolic.values}
|
|
\begin{desctabular}
|
|
\entry{\PValue{foot}}{%
|
|
the current width of the footer%
|
|
}%
|
|
\entry{\PValue{footbotline}}{%
|
|
the current length of the horizontal line below the footer%
|
|
}%
|
|
\entry{\PValue{footsepline}}{%
|
|
the current length of the horizontal line above the footer%
|
|
} \entry{\PValue{head}}{%
|
|
the current width of the header%
|
|
}%
|
|
\entry{\PValue{headsepline}}{%
|
|
the current length of the horizontal line below the header%
|
|
}%
|
|
\entry{\PValue{headtopline}}{%
|
|
the current length of the horizontal line above the header%
|
|
}%
|
|
\entry{\PValue{marginpar}}{%
|
|
the width of the marginal note column including the distance
|
|
between the text area and the marginal note column%
|
|
}%
|
|
\entry{\PValue{page}}{%
|
|
the width of the page taking into account any binding correction defined
|
|
with the help of the \Package{typearea} package (see the
|
|
\DescRef{typearea.option.BCOR} option in
|
|
\autoref{sec:typearea.typearea}, \DescPageRef{typearea.option.BCOR})%
|
|
}%
|
|
\entry{\PValue{paper}}{%
|
|
the width of the paper without considering any binding correction%
|
|
}%
|
|
\entry{\PValue{text}}{%
|
|
the width of the text area%
|
|
}%
|
|
\entry{\PValue{textwithmarginpar}}{%
|
|
the width of the text area including the marginal note column and
|
|
the distance between the two (Note: only in this case is
|
|
the default for \PName{offset} zero)%
|
|
}%
|
|
\end{desctabular}
|
|
\end{table}
|
|
%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\OptionVName{headtopline}{thickness\textup{:}length}%
|
|
\OptionVName{headsepline}{thickness\textup{:}length}%
|
|
\OptionVName{footsepline}{thickness\textup{:}length}%
|
|
\OptionVName{footbotline}{thickness\textup{:}length}
|
|
\end{Declaration}
|
|
\BeginIndex{Option}{headtopline~=\PName{thickness\textup{:}length}}%
|
|
\BeginIndex{Option}{headsepline~=\PName{thickness\textup{:}length}}%
|
|
\BeginIndex{Option}{footsepline~=\PName{thickness\textup{:}length}}%
|
|
\BeginIndex{Option}{footbotline~=\PName{thickness\textup{:}length}}%
|
|
The \KOMAScript{} classes provide only one separation line below the header
|
|
and another above the footer, and you can only switch these lines on or off.
|
|
But the \Package{scrlayer-scrpage} package also lets you place lines above the
|
|
header and below the footer. And for all four lines, you can not only switch
|
|
them on an off but also configure their \PName{length} and \PName{thickness}.
|
|
|
|
Both values are optional. If you omit the \PName{thickness}, a default value
|
|
of 0.4\Unit{pt} is used, producing a so-called \emph{hairline}. If you omit
|
|
the \PName{length}, the width of the header or footer will be used. If you
|
|
omit both, you can also omit the colon. If you use only one value without
|
|
colon, this is the \PName{thickness}.
|
|
|
|
Of course, the \PName{length} can be not just shorter than the current width
|
|
of the header or footer but also longer. See also the options
|
|
\DescRef{\LabelBase.option.ilines}\IndexOption{ilines}%
|
|
\important{\DescRef{\LabelBase.option.ilines},
|
|
\DescRef{\LabelBase.option.clines}, \DescRef{\LabelBase.option.olines}},
|
|
\DescRef{\LabelBase.option.clines}\IndexOption{clines} and
|
|
\DescRef{\LabelBase.option.olines}\IndexOption{olines} later in this section.
|
|
|
|
\BeginIndexGroup
|
|
\BeginIndex{FontElement}{headtopline}\LabelFontElement{headtopline}%
|
|
\BeginIndex{FontElement}{headsepline}\LabelFontElement{headsepline}%
|
|
\BeginIndex{FontElement}{footsepline}\LabelFontElement{footsepline}%
|
|
\BeginIndex{FontElement}{footbotline}\LabelFontElement{footbotline}%
|
|
In addition to the length and thickness, you can also change the colour of the
|
|
lines. Initially the colour depends on the colour of the header or footer. In
|
|
addition to this, however, the settings of the corresponding elements
|
|
\important[i]{\FontElement{headtopline}\\
|
|
\FontElement{headsepline}\\
|
|
\FontElement{footsepline}\\
|
|
\FontElement{footbotline}} \FontElement{headtopline},
|
|
\FontElement{headsepline}, \FontElement{footsepline} and
|
|
\FontElement{footbotline} are applied. You can
|
|
change these using the \DescRef{\LabelBase.cmd.setkomafont} or
|
|
\DescRef{\LabelBase.cmd.addtokomafont} commands (see
|
|
\autoref{sec:maincls.textmarkup}, \DescPageRef{maincls.cmd.setkomafont}).
|
|
By default these elements are empty, so they do not change the current font or
|
|
colour. Font changes at this point, unlike colour changes, make little sense
|
|
anyway and are therefore not recommended for these elements.%
|
|
\EndIndexGroup
|
|
%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\OptionVName{plainheadtopline}{simple switch}%
|
|
\OptionVName{plainheadsepline}{simple switch}%
|
|
\OptionVName{plainfootsepline}{simple switch}%
|
|
\OptionVName{plainfootbotline}{simple switch}
|
|
\end{Declaration}
|
|
You can use these options to apply the settings for the lines to the
|
|
\PageStyle{plain} page style. You can find the available values for
|
|
\PName{simple switch} in \autoref{tab:truefalseswitch} on
|
|
\autopageref{tab:truefalseswitch}. If one of these options is activated, the
|
|
\PageStyle{plain} page style will use the line settings given by the options
|
|
and commands described above. If the option is deactivated, the
|
|
\PageStyle{plain} will not show the corresponding line.%
|
|
\EndIndexGroup
|
|
|
|
|
|
\begin{Declaration}
|
|
\Option{ilines}%
|
|
\Option{clines}%
|
|
\Option{olines}
|
|
\end{Declaration}
|
|
As previously explained, dividing lines for the header or footer can be longer
|
|
or shorter than the width of the header or footer respectively. But the
|
|
question remains how these lines are aligned. By default, all lines are
|
|
aligned to the left margin in one-sided printing and to the inner margin in
|
|
two-sided printing. This corresponds to using the \Option{ilines} option.
|
|
Alternatively, you can use the \Option{clines} option to centre the lines with
|
|
respect to the width of the header or footer, or the \Option{olines} option to
|
|
align them to the outer (or right) margin.%
|
|
\EndIndexGroup
|
|
%
|
|
\EndIndexGroup
|
|
|
|
%%% Local Variables:
|
|
%%% mode: latex
|
|
%%% mode: flyspell
|
|
%%% coding: us-ascii
|
|
%%% ispell-local-dictionary: "en_GB"
|
|
%%% TeX-master: "../guide"
|
|
%%% End:
|
|
|