summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
Initial commit
Diffstat (limited to 'macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx')
-rw-r--r--macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx2968
1 files changed, 2968 insertions, 0 deletions
diff --git a/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx b/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
new file mode 100644
index 0000000000..3868af7741
--- /dev/null
+++ b/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
@@ -0,0 +1,2968 @@
+% \CheckSum{2591}
+% \iffalse^^A meta-comment
+% ======================================================================
+% scrlayer-scrpage.dtx
+% Copyright (c) Markus Kohm, 2012-2018
+%
+% 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 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.dtx
+% Copyright (c) Markus Kohm, 2012-2018
+%
+% Diese Datei ist Teil der LaTeX2e KOMA-Script-Sammlung.
+%
+% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
+% Version 1.3c.
+% 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 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.
+% ======================================================================
+% \fi^^A meta-comment
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \iffalse^^A meta-comment
+%%% From File: $Id: scrlayer-scrpage.dtx 3017 2018-09-05 06:27:27Z kohm $
+%<identify>%%% (run: identify)
+%<init>%%% (run: init)
+%<options>%%% (run: options)
+%<body>%%% (run: body)
+%<*dtx>
+\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
+\begingroup
+ \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
+ \filedate$Date: 2018-09-05 08:27:27 +0200 (Wed, 05 Sep 2018) $
+ \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
+ \filerevision$Revision: 3017 $
+ \edef\reserved@a{%
+ \noexpand\endgroup
+ \noexpand\ProvidesFile{scrlayer-scrpage.dtx}%
+ [\filedate\space\filerevision\space
+ KOMA-Script package source
+ }%
+\reserved@a
+%</dtx>
+%<*identify>
+%<interface>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+%<interface>\ProvidesPackage{scrlayer-scrpage}[%
+%!KOMAScriptVersion
+%<interface> package
+%</identify>
+%<*dtx|identify>
+ (end user interface for scrlayer)]
+%</dtx|identify>
+%<*dtx>
+\ifx\documentclass\undefined
+ \input scrdocstrip.tex
+ \@@input scrkernel-version.dtx
+ \@@input scrstrip.inc
+ \KOMAdefVariable{COPYRIGHTFROM}{2012}
+ \generate{\usepreamble\defaultpreamble
+ \file{scrlayer-scrpage.sty}{%
+ \from{scrlayer-scrpage.dtx}{interface,trace,scrpage,identify}%
+ \from{scrlayer.dtx}{interface,trace,scrpage,init}%
+ \from{scrlayer-scrpage.dtx}{interface,trace,scrpage,init}%
+ \from{scrlayer.dtx}{interface,trace,scrpage,options}%
+ \from{scrlayer-scrpage.dtx}{interface,trace,scrpage,options}%
+ \from{scrlayer.dtx}{interface,trace,scrpage,body}%
+ \from{scrlayer-scrpage.dtx}{interface,trace,scrpage,body}%
+ \from{scrlogo.dtx}{logo}%
+ }%
+ }
+ \@@input scrstrop.inc
+\else
+ \let\endbatchfile\relax
+\fi
+\endbatchfile
+ \documentclass{scrdoc}
+ \addtolength{\textwidth}{-1em}
+ \addtolength{\marginparwidth}{2em}
+ \addtolength{\oddsidemargin}{2em}
+ \usepackage[ngerman,english]{babel}
+ \usepackage{url,babelbib}\bibliographystyle{babalpha-fl}
+ \usepackage{listings}
+ \usepackage{scrhack}
+ \usepackage{etoolbox}
+ \pretocmd\DescribeMacro{\ifhmode\else\bigskip\noindent\fi}{}{}
+ \pretocmd\DescribeEnv{\ifhmode\else\bigskip\noindent\fi}{}{}
+ \pretocmd\DescribeOption{\ifhmode\else\bigskip\noindent\fi}{}{}
+
+ \CodelineIndex
+ \RecordChanges
+ \GetFileInfo{scrlayer-scrpage.dtx}
+ \title{The \texttt{scrlayer} interface \texttt{scrlayer-scrpage}%
+ \footnote{This is version \fileversion\ of file \texttt{\filename}.}}
+ \date{\filedate}
+ \author{Markus Kohm}
+
+ \newenvironment{Explain}{\par}{\par}
+ \newcommand*{\length}{}
+ \let\length\Length
+ \let\endlength\endLength
+ \let\Macro\cs
+ \let\Length\Macro
+ \let\Package\textsf
+ \let\Class\Package
+ \let\File\texttt
+ \let\Option\texttt
+ \newcommand*{\KOption}[1]{\Option{#1}\texttt{=}}
+ \newcommand*{\OptionValue}[2]{\Option{#1}\texttt{=}\PValue{#2}}
+ \let\Counter\texttt
+ \let\Environment\texttt
+ \let\ShowOutput\quote
+ \let\endShowOutput\endquote
+ \let\Pagestyle\texttt
+ \newcommand*{\Parameter}[1]{\texttt{\marg{#1}}\linebreak[1]}
+ \newcommand*{\OParameter}[1]{\texttt{\oarg{#1}}\linebreak[1]}
+ \newcommand*{\MParameter}[2]{\texttt{(\meta{#1},\meta{#2})}\linebreak[1]}
+ \providecommand\PParameter[1]{\mbox{\texttt{\{#1\}}}\linebreak[1]}
+ \let\PName\meta
+ \let\PValue\texttt
+ \providecommand*{\autoref}[1]{\expandafter\AUTOREF#1:}
+ \providecommand*{\AUTOREF}{}
+ \makeatletter
+ \def\AUTOREF#1:#2:{%
+ \edef\@tempa{#1}%
+ \edef\@tempb{tab}\ifx\@tempa\@tempb table~\fi
+ \edef\@tempb{sec}\ifx\@tempa\@tempb section~\fi
+ \ref{#1:#2}%
+ }
+ \providecommand*{\IndexCmd}[2][]{}
+ \providecommand*{\textnote}[2][]{}
+ \providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX}
+ \providecommand*\NTS{%
+ \leavevmode\hbox{$\cal N\kern-0.35em\lower0.5ex\hbox{$\cal T$}%
+ \kern-0.2emS$}}
+
+ \lstnewenvironment{lstcode}{\lstset{language=[LaTeX]TeX}}{}
+ \makeatother
+ \sloppy% YOU SHOULD NOT DO THIS!!!
+
+ \begin{document}
+ \maketitle
+ \tableofcontents
+ \DocInput{\filename}
+ \PrintChanges
+ \PrintIndex
+ \end{document}
+% \fi^^A meta-comment
+%
+% \selectlanguage{english}
+%
+% \changes{v0.0}{2012/01/01}{start of interface}
+% \let\restorechapter\chapter
+% \let\chapter\section
+% \let\section\subsection
+% \let\subsection\subsubsection
+%
+%\iffalse
+%</dtx>
+%\fi
+%
+% \StopEventually{}
+%
+% \chapter{Implementation of \Package{scrlayer-scrpage}}
+% \label{sec:scrlayer-scrpage}
+%
+% This section if for developers only.
+%
+% \iffalse
+%<*interface>
+%<*identify>
+% \fi
+%
+%\iffalse
+%</identify>
+%\fi
+%
+%
+% \section{Initialising some Values before the Options}
+%
+% \iffalse^^A meta-comment
+%<*init>
+% \fi^^A meta-comment
+%
+% Initialisation before all options (even the options from
+% \File{scrlayer.dtx}).
+%
+% Currently nothing.
+%
+% \iffalse^^A meta-comment
+%</init>
+% \fi^^A meta-comment
+%
+% \section{Options}
+%
+% \iffalse^^A meta-comment
+%<*options>
+% \fi
+%
+% Package \Package{scrpage2} doesn't support \KOMAScript{} options but only
+% regular \LaTeX{} package options. The interface will also support those
+% options, but uses \KOMAScript{} options for the implementation. This
+% results in additional features of the interface.
+%
+% Note, that some options are already defined before this by the common option
+% parts of \File{scrlayer.dtx}. All others will follow step by step in the
+% main part.
+%
+% Options \Option{headinclude}, \Option{headexclude}, \Option{footinclude} and
+% \Option{footexclude} of package \Package{scrpage2} are deprecated since
+% package version 2.3, 2008-12-08. They won't be supported by the
+% \Package{scrlayer-scrpage} interface.
+%
+% Additional initialisation may be done here, but currently this isn't
+% needed.
+%
+% \iffalse^^A meta-comment
+%</options>
+% \fi^^A meta-comment
+%
+%
+% \section{Width of Header and Footer}
+%
+% \Package{scrpage2} provides to set the width of the page head or footer
+% different from the width of the text area of the page using
+% \Macro{setheadwidth} and \Macro{setfootwidth}. Optionally those commands
+% allow to setup an horizontal offset for the head or footer. This interface
+% provides the same feature but also allows to set up the widths and offsets
+% with \KOMAScript{} options. Those options will become the primary interface.
+%
+% \begin{option}{headwidth}
+% \changes{v0.9.1757}{2014/04/09}{new: two offsets available}^^A
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{option}{footwidth}
+% \changes{v0.9.1757}{2014/04/09}{new: two offsets available}^^A
+% \changes{v3.15}{2014/12/28}{fix: missing colon in call of
+% \cs{sls@split@at@iicolons}}^^A
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{description}
+% \item[\texttt{=\meta{special dimensional expression}:\meta{special
+% dimensional expression}}:] see \Macro{sls@settowidthof} for information
+% about the syntax of \meta{special dimensional expression}. The width of
+% the page head or footer will be set to the result of the first on, the
+% offset to the result of the second one. If the first one\,---\,the
+% width\,---\,is omitted, the current width will be used. If the second
+% one\,---\,the offset\,---\,is omitted and the width is the width of the
+% text area plus the margin note column, the offset will be set to
+% zero. If the second one is omitted and the width is not the width of the
+% text area plus the margin note column, a special kind of centering will
+% be used.
+% \end{description}
+% These options may be used to set up the widths of head and foot.
+% \begin{macrocode}
+%<*options>
+\KOMA@key{headwidth}{%
+ \begingroup
+ \sls@split@at@iicolons#1:::\@nil
+ \ifx\reserved@a\@empty \let\reserved@a\sls@headwidth\fi
+ \edef\reserved@a{%
+ \noexpand\endgroup
+ \noexpand\sls@set@hf@width{head}{\reserved@b}{\reserved@c}{\reserved@a}%
+ \noexpand\FamilyKeyStateProcessed
+ \noexpand\KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{headwidth}{%
+ \reserved@a:\reserved@b:\reserved@c
+ }%
+ }%
+ \reserved@a
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headwidth}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headwidth@default}
+\KOMA@key{footwidth}{%
+ \begingroup
+ \sls@split@at@iicolons#1:::\@nil
+ \ifx\reserved@a\@empty \let\reserved@a\sls@footwidth\fi
+ \edef\reserved@a{%
+ \noexpand\endgroup
+ \noexpand\sls@set@hf@width{foot}{\reserved@b}{\reserved@c}{\reserved@a}%
+ \noexpand\FamilyKeyStateProcessed
+ \noexpand\KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{footwidth}{%
+ \reserved@a:\reserved@b:\reserved@c
+ }%
+ }%
+ \reserved@a
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footwidth}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footwidth@default}
+% \end{macrocode}
+% \begin{macro}{\sls@split@at@iicolons}
+% \begin{description}
+% \item[\texttt{\meta{balanced}:^^A
+% \meta{balanced}:^^A
+% \meta{balanced}\Macro{@nil}}:] first \meta{balanced} will be stored into
+% \Macro{reserved@a}, second into \Macro{reserved@b}, third will be eaten
+% and warn about if it is neither empty and nor a colon.
+% \end{description}
+% This little helper is used, e.g., by options \Option{headwidth} and
+% \Option{footwidth}.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@split@at@iicolons{%
+ \def\sls@split@at@iicolons#1:#2:#3:#4\@nil{%
+ \ifstr{#4}{}{}{%
+ \ifstr{#4}{:}{}{%
+ \ifstr{#4}{::}{}{%
+ \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
+ You've used more than two colons at the argument\MessageBreak
+ of a two value option.\MessageBreak
+ The extra value(s) will be ignored%
+ }%
+ }%
+ }%
+ }%
+ \def\reserved@a{#1}%
+ \def\reserved@b{#2}%
+ \def\reserved@c{#3}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@split@at@iicolons
+% \begin{macro}{\sls@set@hf@width}
+% \changes{v0.9.1757}{2014/04/09}{new: two offsets available}
+% \begin{description}
+% \item[\Parameter{head} or \Parameter{foot}:] to complete the macro names
+% for page head or footer.
+% \item[\Parameter{special dimensional expression}:] the offset odd page
+% \item[\Parameter{special dimensional expression}:] the offset even page
+% \item[\Parameter{special dimensional expression}:] the width
+% \end{description}
+% This helper will generally set up width an offset of either head or footer.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@set@hf@width{%
+ \newcommand*{\sls@set@hf@width}[4]{%
+ \sls@settowidthof{\@tempdima}{#4}%
+ \ifdim\@tempdima>\paperwidth
+ \PackageWarning
+ {scrlayer-scrpage}%
+ {You've set width of #1 to a value\MessageBreak
+ greater than width of page!\MessageBreak%
+ I'll reduce width of #1 to width of page}%
+ \setlength{\@tempdima}{\paperwidth}%
+ \else
+ \ifdim\@tempdima<\z@
+ \PackageWarning
+ {scrlayer-scrpage}%
+ {You've set width of #1 to negative value!\MessageBreak%
+ I'll set it to 0pt}%
+ \setlength{\@tempdima}{\z@}%
+ \fi
+ \fi
+ \expandafter\edef\csname sls@#1width\endcsname{\the\@tempdima}%
+ \setlength{\@tempdima}{\textwidth}%
+ \addtolength{\@tempdima}{-\csname sls@#1width\endcsname}%
+ \ifstr{#2}{}{%
+ \ifdim \csname sls@#1width\endcsname
+ = \dimexpr \textwidth+\marginparwidth+\marginparsep\relax
+ \setlength{\@tempdimb}{\z@}
+ \else
+ \if@twoside
+ \setlength{\@tempdimb}{.3333333333\@tempdima}%
+ \else
+ \setlength{\@tempdimb}{.5\@tempdima}%
+ \fi
+ \fi
+ }{%
+ \sls@settowidthof{\@tempdimb}{#2}%
+ }%
+ \ifstr{#3}{}{%
+ \addtolength{\@tempdima}{-\@tempdimb}%
+ }{%
+ \sls@settowidthof{\@tempdima}{#3}%
+ \setlength{\@tempdima}{-\@tempdima}%
+ }%
+ \ifdim\@tempdimb<\z@
+ \setlength{\@tempdimb}{-\@tempdimb}%
+ \expandafter\edef\csname sls@odd#1shift\endcsname{-\the\@tempdimb}%
+ \else
+ \expandafter\edef\csname sls@odd#1shift\endcsname{\the\@tempdimb}%
+ \fi
+ \ifdim\@tempdima<\z@
+ \setlength{\@tempdima}{-\@tempdima}%
+ \expandafter\edef\csname sls@even#1shift\endcsname{-\the\@tempdima}%
+ \else
+ \expandafter\edef\csname sls@even#1shift\endcsname{\the\@tempdima}%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@set@hf@width
+% \begin{macro}{\sls@headwidth}
+% \begin{macro}{\sls@oddheadshift}
+% \begin{macro}{\sls@evenheadshift}
+% \begin{macro}{\sls@footwidth}
+% \begin{macro}{\sls@oddfootshift}
+% \begin{macro}{\sls@evenfootshift}
+% To store width and offset of page head an footer, we use macros. Those are
+% also used by the options and therefore need to be initialised before option
+% usage.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@headwidth{%
+ \scr@ifundefinedorrelax{@headwidth}{%
+ \newcommand*{\sls@headwidth}{\textwidth}%
+ \KOMA@kav@add{.scrlayer-scrpage.sty}{headwidth}{\textwidth:0pt:0pt}%
+ }{%
+ \newcommand*{\sls@headwidth}{\@headwidth}%
+ \KOMA@kav@xadd{.scrlayer-scrpage.sty}{headwidth}{\@headwidth:0pt:0pt}%
+ }%
+}
+\scrlayerAddToInterface\sls@oddheadshift{\newcommand*{\sls@oddheadshift}{0pt}}
+\scrlayerAddToInterface\sls@evenheadshift{\newcommand*{\sls@evenheadshift}{0pt}}
+\scrlayerAddToInterface\sls@footwidth{%
+ \scr@ifundefinedorrelax{@footwidth}{%
+ \newcommand*{\sls@footwidth}{\textwidth}%
+ \KOMA@kav@add{.scrlayer-scrpage.sty}{footwidth}{\textwidth:0pt:0pt}
+ }{%
+ \newcommand*{\sls@footwidth}{\@footwidth}%
+ \KOMA@kav@xadd{.scrlayer-scrpage.sty}{footwidth}{\@footwidth:0pt:0pt}
+ }%
+}
+\scrlayerAddToInterface\sls@oddfootshift{\newcommand*{\sls@oddfootshift}{0pt}}
+\scrlayerAddToInterface\sls@evenfootshift{\newcommand*{\sls@evenfootshift}{0pt}}
+% \end{macrocode}
+% \end{macro}^^A \sls@headwidth
+% \end{macro}^^A \sls@oddheadshift
+% \end{macro}^^A \sls@evenheadshift
+% \end{macro}^^A \sls@footwidth
+% \end{macro}^^A \sls@oddfootshift
+% \end{macro}^^A \sls@evenfootshift
+%
+% \begin{macro}{\sls@settowidthof}
+% \begin{macro}{\sls@deftowidthof}
+% the special dimensional expressions may be either one of the strings
+% \texttt{paper}, \texttt{text}, \texttt{marginpar},
+% \texttt{textwithmarginpar}, \texttt{head}, \texttt{foot},
+% \texttt{headtopline}, \texttt{headsepline}, \texttt{footsepline},
+% \texttt{footbotline}, or \texttt{page} or a valid dimensional
+% expression. But it cannot be both a dimensional expression using symbolic
+% values!
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@settotwidthof{%
+ \newcommand*{\sls@settowidthof}[2]{%
+ \ifstr{#2}{paper}{%
+ \setlength{#1}{\paperwidth}%
+ }{%
+ \ifstr{#2}{text}{%
+ \setlength{#1}{\textwidth}%
+ }{%
+ \ifstr{#2}{marginpar}{%
+ \setlength{#1}{\dimexpr \marginparwidth+\marginparsep\relax}%
+ }{%
+ \ifstr{#2}{textwithmarginpar}{%
+ \setlength{#1}{\dimexpr\textwidth
+ +\marginparwidth
+ +\marginparsep\relax}%
+ }{%
+ \ifstr{#2}{head}{%
+ \setlength{#1}{\sls@headwidth}%
+ }{%
+ \ifstr{#2}{foot}{%
+ \setlength{#1}{\sls@footwidth}%
+ }{%
+ \ifstr{#2}{headtopline}{%
+ \setlength{#1}{\sls@headabove@linelength}%
+ }{%
+ \ifstr{#2}{headsepline}{%
+ \setlength{#1}{\sls@headbelow@linelength}%
+ }{%
+ \ifstr{#2}{footsepline}{%
+ \setlength{#1}{\sls@footabove@linelength}%
+ }{%
+ \ifstr{#2}{footbotline}{%
+ \setlength{#1}{\sls@footbelow@linelength}%
+ }{%
+ \ifstr{#2}{page}{%
+ \setlength{#1}{\paperwidth}%
+ \begingroup
+ \expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname ta@bcor\endcsname\relax\else
+ \addtolength{#1}{-\ta@bcor}%
+ \fi
+ }{%
+ \setlength{#1}{\dimexpr #2\relax}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}
+\scrlayerAddToInterface\sls@deftowidthof{%
+ \newcommand*{\sls@deftowidthof}[2]{%
+ \ifstr{#2}{autohead}{%
+ \expandafter\def\csname #1\endcsname{\sls@headwidth}%
+ }{%
+ \ifstr{#2}{autofoot}{%
+ \expandafter\def\csname #1\endcsname{\sls@footwidth}%
+ }{%
+ \sls@settowidthof{\@tempdima}{#2}%
+ \expandafter\edef\csname #1\endcsname{\the\@tempdima}%
+ }%
+ }%
+ }%
+}
+%</options>
+% \end{macrocode}
+% \end{macro}^^A \sls@deftowidthof
+% \end{macro}^^A \sls@settowidthof
+% \end{option}^^A footwidth
+% \end{option}^^A footheight
+%
+% \begin{macro}{\setheadwidth}
+% \begin{macro}{\setfootwidth}
+% For compatibility with \Package{scrpage2}, map the commands to the options:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\setheadwidth{%
+ \newcommand*{\setheadwidth}[2][]{%
+ \KOMAoptions{headwidth=#2:#1}%
+ }%
+}
+\scrlayerAddToInterface\setfootwidth{%
+ \newcommand*{\setfootwidth}[2][]{%
+ \KOMAoptions{footwidth=#2:#1}%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \setheadwidth
+% \end{macro}^^A \setfootwidth
+%
+%
+% \section{Lines in Page Head and Footer}
+%
+% The interface implements the options \Option{headtopline},
+% \Option{headsepline}, \Option{footsepline}, \Option{footbotline},
+% \Option{plainheadtopline}, \Option{plainheadsepline},
+% \Option{plainfootsepline}, \Option{plainfootbotline}, \Option{ilines},
+% \Option{clines}, and \Option{olines}, the commands \Macro{setheadtopline},
+% \Macro{setheadsepline}, \Macro{setfootsepline}, and \Macro{setfootbotline},
+% and the corresponding \KOMAScript{} font elements of package
+% \Package{scrpage2}. Some of the options are extended to understand
+% values.
+%
+% \begin{option}{headtopline}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{option}{headsepline}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{option}{footsepline}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{option}{footbotline}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{description}
+% \item[{\texttt{=\meta{dimensional expression}:\meta{dimensional
+% expression}}:}]
+% \end{description}\noindent
+% Define thickness and length of the a default separation line between:
+% \begin{description}
+% \item[\Option{headtopline}:] the top margin of the page and the page head.
+% \item[\Option{headsepline}:] the page head and the text area.
+% \item[\Option{footsepline}:] the text area and the page footer.
+% \item[\Option{footbotline}:] the page footer and the bottom margin.
+% \end{description}
+% Both values may be omitted. In that case thickness would be 0.4\,pt, and
+% length would be the width of the page head or footer. If the second
+% argument, the length, has been omitted the \texttt{:} may also be omitted.
+% \begin{macrocode}
+%<*options>
+\KOMA@key{headtopline}[:]{%
+ \sls@set@values[headtopline]{head}{above}{#1}%
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headtopline}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headtopline@default}
+\KOMA@key{headsepline}[:]{%
+ \sls@set@values[headsepline]{head}{below}{#1}%
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headsepline}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headsepline@default}
+\KOMA@key{footsepline}[:]{%
+ \sls@set@values[footsepline]{foot}{above}{#1}%
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footsepline}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footsepline@default}
+\KOMA@key{footbotline}[:]{%
+ \sls@set@values[footbotline]{foot}{below}{#1}%
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footbotline}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footbotline@default}
+% \end{macrocode}
+% \begin{macro}{\sls@set@values}
+% \begin{description}
+% \item[\OParameter{option name}:] either empty or the name of the option
+% that sets the line,
+% \item[\Parameter{head or foot}:] either \texttt{head} or \texttt{foot},
+% \item[\Parameter{above or below}:] either \texttt{above} or
+% \texttt{below},
+% \item[\Parameter{dimension expression}\texttt{:}\Parameter{dimension
+% expression}] length an thickness of a line (both are optional).
+% \end{description}
+% Helper macros for the options to set two macros by two values of one
+% option. The two values are separated by a colon.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@set@values{%
+ \newcommand*{\sls@set@values}[4][]{%
+ \begingroup
+ \ifstr{#1}{}{%
+ \FamilyKeyStateUnknown
+ }{%
+ \KOMA@set@ifkey{#1}{@tempswa}{#4}%
+ }%
+ \ifx\FamilyKeyState\FamilyKeyStateProcessed
+ \if@tempswa
+ \edef\reserved@b{%
+ \noexpand\endgroup
+ \noexpand\@namedef{sls@#2#3@linethickness}{.4pt}%
+ \noexpand\@namedef{sls@#2#3@linelength}{%
+ \expandafter\noexpand\csname sls@#2width\endcsname
+ }%
+ }%
+ \else
+ \def\reserved@b{%
+ \endgroup
+ \@namedef{sls@#2#3@linethickness}{0pt}%
+ \@namedef{sls@#2#3@linelength}{0pt}%
+ }%
+ \fi
+ \else
+ \let\reserved@a\@empty
+ \let\reserved@b\@empty
+ \sls@split@at@colon#4::\@nil
+ \ifx\reserved@a\@empty
+ \def\reserved@a{\endgroup\@namedef{sls@#2#3@linethickness}{.4pt}}%
+ \else
+ \setlength{\@tempdima}{\dimexpr\reserved@a\relax}%
+ \edef\reserved@a{%
+ \noexpand\endgroup
+ \noexpand\@namedef{sls@#2#3@linethickness}{\the\@tempdima}%
+ }%
+ \fi
+ \ifx\reserved@b\@empty
+ \def\reserved@b{%
+ \reserved@a
+ \@namedef{sls@#2#3@linelength}{\@nameuse{sls@#2width}}%
+ }%
+ \else
+ \edef\reserved@b{%
+ \noexpand\reserved@a
+ \noexpand\sls@deftowidthof{sls@#2#3@linelength}{\reserved@b}%
+ }%
+ \fi
+ \fi
+ \reserved@b
+ \FamilyKeyStateProcessed
+ \ifstr{#1}{}{}{%
+ \KOMA@kav@xreplacevalue{.scrlayer-scrpage.sty}{#1}{%
+ \csname sls@#2#3@linethickness\endcsname
+ :\csname sls@#2#3@linelength\endcsname
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@set@values
+% \begin{macro}{\sls@split@at@colon}
+% \begin{description}
+% \item[\texttt{\meta{balanced}:^^A
+% \meta{balanced}:^^A
+% \meta{balanced}\Macro{@nil}}:] first \meta{balanced} will be stored into
+% \Macro{reserved@a}, second into \Macro{reserved@b}, third will be eaten
+% and warn about if it is neither empty and nor a colon.
+% \end{description}
+% This little helper is used, e.g., by options \Option{headwidth} and
+% \Option{footwidth}.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@split@at@colon{%
+ \def\sls@split@at@colon#1:#2:#3\@nil{%
+ \ifstr{#3}{}{}{%
+ \ifstr{#3}{:}{}{%
+ \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
+ You've used more than one colon at the argument\MessageBreak
+ of a two value option.\MessageBreak
+ The extra value(s) will be ignored%
+ }%
+ }%
+ }%
+ \def\reserved@a{#1}%
+ \def\reserved@b{#2}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@split@at@colon
+% \begin{macro}{\sls@headabove@linelength}
+% \begin{macro}{\sls@headabove@linethickness}
+% \begin{macro}{\sls@headbelow@linelength}
+% \begin{macro}{\sls@headbelow@linethickness}
+% \begin{macro}{\sls@footabove@linelength}
+% \begin{macro}{\sls@footabove@linethickness}
+% \begin{macro}{\sls@footbelow@linelength}
+% \begin{macro}{\sls@footbelow@linethickness}
+% To store length and thickness of the lines at the page head an footer, we
+% use macros. Those are also used by the options and therefore need to be
+% initialised before option usage.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@headabove@linelength{%
+ \newcommand*{\sls@headabove@linelength}{\sls@headwidth}%
+}
+\scrlayerAddToInterface\sls@headabove{%
+ \newcommand*{\sls@headabove@linethickness}{0pt}%
+}
+\KOMA@kav@xadd{.scrlayer-scrpage.sty}{headtopline}{%
+ \expandafter\noexpand\sls@headabove@linethickness:%
+ \expandafter\noexpand\sls@headabove@linelength}
+\scrlayerAddToInterface\sls@headbelow@linelength{%
+ \newcommand*{\sls@headbelow@linelength}{\sls@headwidth}%
+}
+\scrlayerAddToInterface\sls@headbelow@linethickness{%
+ \newcommand*{\sls@headbelow@linethickness}{0pt}%
+}
+\KOMA@kav@xadd{.scrlayer-scrpage.sty}{headsepline}{%
+ \expandafter\noexpand\sls@headbelow@linethickness:%
+ \expandafter\noexpand\sls@headbelow@linelength}
+\scrlayerAddToInterface\sls@footabove@linelength{%
+ \newcommand*{\sls@footabove@linelength}{\sls@footwidth}%
+}
+\scrlayerAddToInterface\sls@footabove@linethickness{%
+ \newcommand*{\sls@footabove@linethickness}{0pt}%
+}
+\KOMA@kav@xadd{.scrlayer-scrpage.sty}{footsepline}{%
+ \expandafter\noexpand\sls@footabove@linethickness:%
+ \expandafter\noexpand\sls@footabove@linelength}
+\scrlayerAddToInterface\sls@footbelow@linelength{%
+ \newcommand*{\sls@footbelow@linelength}{\sls@footwidth}%
+}
+\scrlayerAddToInterface\sls@footbelow@linethickness{%
+ \newcommand*{\sls@footbelow@linethickness}{0pt}%
+}
+\KOMA@kav@xadd{.scrlayer-scrpage.sty}{footbotline}{%
+ \expandafter\noexpand\sls@footbelow@linethickness:%
+ \expandafter\noexpand\sls@footbelow@linelength}
+%</options>
+% \end{macrocode}
+% \end{macro}^^A \sls@footbelow@linethickness
+% \end{macro}^^A \sls@footbelow@linelength
+% \end{macro}^^A \sls@footabove@linethickness
+% \end{macro}^^A \sls@footabove@linelength
+% \end{macro}^^A \sls@headbelow@linethickness
+% \end{macro}^^A \sls@headbelow@linelength
+% \end{macro}^^A \sls@headabove@linethickness
+% \end{macro}^^A \sls@headabove@linelength
+% \end{option}^^A footbotline
+% \end{option}^^A footsepline
+% \end{option}^^A headsepline
+% \end{option}^^A headtopline
+%
+% \begin{option}{plainheadtopline}
+% \begin{macro}{\ifsls@plain@head@above@line}
+% \begin{option}{plainheadsepline}
+% \begin{macro}{\ifsls@plain@head@below@line}
+% \begin{option}{plainfootsepline}
+% \begin{macro}{\ifsls@plain@foot@above@line}
+% \begin{option}{plainfootbotline}
+% \begin{macro}{\ifsls@plain@foot@below@line}
+% \begin{description}
+% \item[\texttt{=\meta{switch value}}:]
+% \end{description}\noindent
+% While these only switches the rule on or off, we need only some switches.
+% \begin{macrocode}
+%<*options>
+\scrlayerAddCsToInterface{ifsls@plain@head@above@line}{%
+ \KOMA@ifkey{plainheadtopline}{sls@plain@head@above@line}%
+ \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainheadtopline}%
+ \scrlayer@AddCsToInterface{%
+ KV@KOMA.scrlayer-scrpage.sty@plainheadtopline@default}%
+ \scrlayer@AddCsToInterface{sls@plain@head@above@linetrue}
+ \scrlayer@AddCsToInterface{sls@plain@head@above@linefalse}
+}
+\scrlayerAddCsToInterface{ifsls@plain@head@sbelow@line}{%
+ \KOMA@ifkey{plainheadsepline}{sls@plain@head@below@line}%
+ \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainheadsepline}%
+ \scrlayer@AddCsToInterface{%
+ KV@KOMA.scrlayer-scrpage.sty@plainheadsepline@default}%
+ \scrlayer@AddCsToInterface{sls@plain@head@below@linetrue}%
+ \scrlayer@AddCsToInterface{sls@plain@head@below@linefalse}%
+}
+\scrlayerAddCsToInterface{ifsls@plain@foot@above@line}{%
+ \KOMA@ifkey{plainfootsepline}{sls@plain@foot@above@line}%
+ \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainfootsepline}%
+ \scrlayer@AddCsToInterface{%
+ KV@KOMA.scrlayer-scrpage.sty@plainfootsepline@default}%
+ \scrlayer@AddCsToInterface{sls@plain@foot@above@linetrue}%
+ \scrlayer@AddCsToInterface{sls@plain@foot@above@linefalse}%
+}
+\scrlayerAddCsToInterface{ifsls@plain@foot@below@line}{%
+ \KOMA@ifkey{plainfootbotline}{sls@plain@foot@below@line}%
+ \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainfootbotline}%
+ \scrlayer@AddCsToInterface{%
+ KV@KOMA.scrlayer-scrpage.sty@plainfootbotline@default}%
+ \scrlayer@AddCsToInterface{sls@plain@foot@below@linetrue}%
+ \scrlayer@AddCsToInterface{sls@plain@foot@below@linefalse}%
+}
+%</options>
+% \end{macrocode}
+% \end{macro}^^A \ifsls@plain@foot@below@line
+% \end{option}^^A plainfootbotline
+% \end{macro}^^A \ifsls@plain@foot@above@line
+% \end{option}^^A plainfootsepline
+% \end{macro}^^A \ifsls@plain@head@below@line
+% \end{option}^^A plainheadsepline
+% \end{macro}^^A \ifsls@plain@head@above@line
+% \end{option}^^A plainheadtopline
+%
+% \begin{option}{ilines}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{option}{clines}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{option}{olines}
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{macro}{\sls@hfline@adjust}
+% Maybe it would be more useful to be able to adjust each line on its own or
+% at most to define an offset. But \Package{scrpage2} supports only these
+% options. At least we can set the options inside a layer or page style. This
+% may help.
+% \begin{macrocode}
+%<*options>
+\scrlayerAddToInterface\sls@hfline@adjust{%
+ \newcommand*{\sls@hfline@adjust}{0}%
+}
+\KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}
+\KOMA@key{ilines}[]{%
+ \ifx\relax#1\relax
+ \renewcommand*{\sls@hfline@adjust}{0}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{ilines}%
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{clines}%
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{olines}%
+ \KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}%
+ \else
+ \def\FamilyKeyStateProcessed{unexpected value}%
+ \fi
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@ilines}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@ilines@default}
+\KOMA@key{clines}[]{%
+ \ifx\relax#1\relax
+ \renewcommand*{\sls@hfline@adjust}{1}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{ilines}%
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{clines}%
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{olines}%
+ \KOMA@kav@add{.scrlayer-scrpage.sty}{clines}{}%
+ \else
+ \def\FamilyKeyStateProcessed{unexpected value}%
+ \fi
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@clines}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@clines@default}
+\KOMA@key{olines}[]{%
+ \ifx\relax#1\relax
+ \renewcommand*{\sls@hfline@adjust}{2}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{ilines}%
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{clines}%
+ \KOMA@kav@removekey{.scrlayer-scrpage.sty}{olines}%
+ \KOMA@kav@add{.scrlayer-scrpage.sty}{olines}{}%
+ \else
+ \def\FamilyKeyStateProcessed{unexpected value}%
+ \fi
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@olines}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@olines@default}
+\KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}
+%</options>
+% \end{macrocode}
+% \end{macro}^^A \sls@hfline@adjust
+% \end{option}^^A olines
+% \end{option}^^A clines
+% \end{option}^^A ilines
+%
+% \begin{macro}{\setheadtopline}
+% \begin{macro}{\setheadsepline}
+% \begin{macro}{\setfootsepline}
+% \begin{macro}{\setfootbotline}
+% \begin{description}
+% \item[\OParameter{extended dimensional expression}:] the length of the
+% line; if omitted the length will use the width of the page head or
+% footer while printing the line.
+% \item[\Parameter{dimensional expression}:] the thickness of the line.
+% \item[\OParameter{code}:] the font selection code for the line. You may
+% use it for any kind of operation, that doesn't change the position,
+% width, height, or depth, e.g., to change the colour of the line.
+% \end{description}
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\setheadtopline{%
+ \newcommand*{\setheadtopline}{\sls@setline{head}{above}}%
+}
+\scrlayerAddToInterface\setheadsepline{%
+ \newcommand*{\setheadsepline}{\sls@setline{head}{below}}%
+}
+\scrlayerAddToInterface\setfootsepline{%
+ \newcommand*{\setfootsepline}{\sls@setline{foot}{above}}%
+}
+\scrlayerAddToInterface\setfootbotline{%
+ \newcommand*{\setfootbotline}{\sls@setline{foot}{below}}%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@setline}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\sls@@setline}
+% \begin{macro}{\sls@@@setline}
+% \changes{v3.17}[2015/02/27]{internal use of the corresponding options}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\sls@@@@setline}
+% \changes{v3.18}{2015/06/17}{explicit reuse of the current length}^^A
+% Helper to set up the line attributes processing the parameters of the
+% commands above.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@setline{%
+ \newcommand*\sls@setline[2]{%
+ \kernel@ifnextchar[%]
+ {\sls@@setline{#1}{#2}}{\sls@@@setline{#1#2}}%
+ }%
+}
+\scrlayerAddToInterface\sls@@setline{%
+ \def\sls@@setline#1#2[#3]{%
+ \ifstr{#3}{auto}{%
+ \sls@deftowidthof{sls@#1#2@linelength}{#3#1}%
+ }{%
+ \sls@deftowidthof{sls@#1#2@linelength}{#3}%
+ }%
+ \sls@@@setline{#1#2}%
+ }%
+}
+\scrlayerAddToInterface\sls@@@setline{%
+ \def\sls@@@setline#1#2{%
+ \edef\@tempa{#2}\edef\@tempb{current}%
+ \ifstr{#2}{}{}{%
+ \ifstr{#2}{current}{}{%
+ \setlength{\@tempdima}{#2}%
+ \ifstr{#1}{headabove}{%
+ \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
+ {headtopline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+ }{\ifstr{#1}{headbelow}{%
+ \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
+ {headsepline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+ }{%
+ \ifstr{#1}{footabove}{%
+ \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
+ {footsepline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+ }{%
+ \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
+ {footbotline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ \PackageWarning{scrlayer-scrpage}{%
+ Command deprecated!\MessageBreak
+ Usage of `\string\setheadtopline',
+ `\string\setheadsepline',\MessageBreak
+ `\string\setfootsepline', and `\string\setfootbotline'\MessageBreak
+ became deprecated with scrlayer-scrpage.\MessageBreak
+ You should use KOMA-Script options\MessageBreak
+ `headsepline', `headtopline', `footsepline',\MessageBreak
+ or `footbotline' with values\MessageBreak
+ `<line thickness>:<line length>' to setup\MessageBreak
+ the line length and thickness, and\MessageBreak
+ `\string\setkomafont' or `\string\addtokomafont' to\MessageBreak
+ setup the colour%
+ }%
+ \kernel@ifnextchar[%]
+ {%
+ \sls@@@@setline{#1}%
+ }{%
+ }%
+ }%
+}
+\scrlayerAddToInterface\sls@@@@setline{%
+ \def\sls@@@@setline#1[#2]{%
+ \ifstr{#1}{headabove}{\setkomafont{headtopline}{#2}}{%
+ \ifstr{#1}{headbelow}{\setkomafont{headsepline}{#2}}{%
+ \ifstr{#1}{footabove}{\setkomafont{footsepline}{#2}}{%
+ \setkomafont{footbotline}{#2}%
+ }%
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@setline
+% \end{macro}^^A \sls@@setline
+% \end{macro}^^A \sls@@@setline
+% \end{macro}^^A \sls@@@@setline
+% \begin{KOMAfont}{headtopline}
+% \begin{KOMAfont}{headsepline}
+% \begin{KOMAfont}{footsepline}
+% \begin{KOMAfont}{footbotline}
+% These are the font elements used in \Macro{sls@hf@rule} to set the rules
+% with, i.e., another colour. Note, that those may already be defined and
+% become only part of the interface if they are not.
+% \begin{macrocode}
+\@ifundefined{scr@fnt@headtopline}{%
+ \@ifundefined{@headtoplinefont}{%
+ \scrlayer@AddCsToInterface{@headtoplinefont}%
+ }{}%
+ \newkomafont{headtopline}{}%
+ \scrlayer@AddCsToInterface{scr@fnt@headtopline}%
+}{}
+\@ifundefined{scr@fnt@headsepline}{%
+ \@ifundefined{@headseplinefont}{%
+ \scrlayer@AddCsToInterface{@headseplinefont}%
+ }{}%
+ \newkomafont{headsepline}{}%
+ \scrlayer@AddCsToInterface{scr@fnt@headsepline}%
+}{}
+\@ifundefined{scr@fnt@footsepline}{%
+ \@ifundefined{@footseplinefont}{%
+ \scrlayer@AddCsToInterface{@footseplinefont}%
+ }{}%
+ \newkomafont{footsepline}{}%
+ \scrlayer@AddCsToInterface{scr@fnt@footsepline}%
+}{}
+\@ifundefined{scr@fnt@footbotline}{%
+ \@ifundefined{@footbotlinefont}{%
+ \scrlayer@AddCsToInterface{@footbotlinefont}%
+ }{}%
+ \newkomafont{footbotline}{}%
+ \scrlayer@AddCsToInterface{scr@fnt@footbotline}%
+}{}
+%</body>
+% \end{macrocode}
+% \end{KOMAfont}^^A footbotline
+% \end{KOMAfont}^^A footsepline
+% \end{KOMAfont}^^A headsepline
+% \end{KOMAfont}^^A headtopline
+% \end{macro}^^A \setfootbotline
+% \end{macro}^^A \setfootsepline
+% \end{macro}^^A \setheadsepline
+% \end{macro}^^A \setheadtopline
+%
+% \begin{length}{\headheight}
+% \changes{v3.24}{2017/05/22}{warning depends on option
+% \texttt{singlespacing}}^^A
+% Some classes set \Length{headheight} to a very, very small value. We'll
+% warn about that.
+% \begin{length}{\footheight}
+% \changes{v3.24}{2017/05/23}{also warn for low \cs{footheight}}^^A
+% If the \Length{headheight} is OK, we also test for \Length{footheight}.
+% \begin{macrocode}
+%<*body>
+\AtBeginDocument{%
+ \ifdim \headheight
+ <\if@ps@singlespacing\f@baselineskip\else\baselineskip\fi\relax
+ \PackageWarningNoLine{scrlayer-scrpage}{Very small head height
+ detected!\MessageBreak
+ Using scrlayer-scrpage the head height\MessageBreak
+ should be at least \string\baselineskip, which is\MessageBreak
+ \if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi\space
+ currently.\MessageBreak
+ But head height is currently
+ \the\headheight\space only.\MessageBreak
+ You may use\MessageBreak
+ \@ifpackageloaded{geometry}{%
+ geometry option
+ `head=\if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi'%
+ }{%
+ \@ifpackageloaded{typearea}{%
+ typearea option `headheight=%
+ \if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi'%
+ }{%
+ \string\setlength{\string\headheight}%
+ {\if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi}%
+ }%
+ }\MessageBreak
+ \if@ps@singlespacing\else\ifdim \headheight<\f@baselineskip\else
+ or load package `scrlayer-scrpage' with\MessageBreak
+ option `singlespacing=true'\MessageBreak
+ \fi\fi
+ to avoid this warning%
+ }%
+ \else
+ \ifdim \footheight
+ <\if@ps@singlespacing\f@baselineskip\else\baselineskip\fi\relax
+ \PackageWarningNoLine{scrlayer-scrpage}{Very small foot height
+ detected!\MessageBreak
+ Using scrlayer-scrpage the foot height\MessageBreak
+ should be at least \string\baselineskip, which is\MessageBreak
+ \if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi\space
+ currently.\MessageBreak
+ But foot height is currently
+ \the\footheight\space only.\MessageBreak
+ You may use\MessageBreak
+ \@ifpackageloaded{typearea}{%
+ typearea option `footheight=%
+ \if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi'%
+ }{%
+ \string\setlength{\string\footheight}%
+ {\if@ps@singlespacing\f@baselineskip\else\the\baselineskip\fi}%
+ }%
+ \MessageBreak
+ \if@ps@singlespacing\else\ifdim \footheight<\f@baselineskip\else
+ or load package `scrlayer-scrpage' with\MessageBreak
+ option `singlespacing=true'\MessageBreak
+ \fi\fi
+ to avoid this warning%
+ }%
+ \fi
+ \fi
+}
+%</body>
+% \end{macrocode}
+% \end{length}^^A \footheight
+% \end{length}^^A \headheight
+%
+%
+% \section{Style of Running Heads}
+%
+% This implements not only options \Option{komastyle} and
+% \Option{standardstyle} of \Package{scrpage2}, but also activates the default
+% style at the end of the package and takes care for the correct overwrite
+% behaviour of option \Option{markcase}.
+%
+% \begin{option}{pagestyleset}
+% \begin{description}
+% \item[\texttt{=\meta{string}}:] a valid name of a predefined
+% style-set. Currently only \texttt{KOMA-Script} and \texttt{standard} are
+% supported. Maybe more will follow.
+% \end{description}
+% Note, that the following automatic style activation must be before the
+% first option usage:
+% \begin{macrocode}
+%<*init>
+\AtEndOfPackage{%
+ \sls@auto@pagestyleset%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@auto@pagestyleset}
+% \changes{v0.9}{2014/01/22}{new (internal) macro}%^^A
+% \begin{macrocode}
+\newcommand*{\sls@auto@pagestyleset}{%
+ \scr@ifundefinedorrelax{KOMAClassName}{%
+%<trace> \PackageInfoNoLine{scrlayer-scrpage}{%
+%<trace> auto-selection of `pagestyleset=standard'}%
+ \FamilyExecuteOptions[.scrlayer-scrpage.sty]{KOMA}{pagestyleset=standard}%
+ }{%
+%<trace> \PackageInfoNoLine{scrlayer-scrpage}{%
+%<trace> auto-selection of `pagestyleset=KOMA-Script'}%
+ \FamilyExecuteOptions[.scrlayer-scrpage.sty]{KOMA}%
+ {pagestyleset=KOMA-Script}%
+ }%
+}
+%</init>
+% \end{macrocode}
+% \end{macro}%^^A \sls@auto@pagestyleset
+% \changes{v3.17}{2015/02/25}{new: store the values}^^A
+% \begin{macrocode}
+%<*options>
+\KOMA@key{pagestyleset}{%
+ \scr@ifundefinedorrelax{sls@ps@style@#1}{%
+ \FamilyKeyStateUnknownValue
+ }{%
+ \let\sls@auto@pagestyleset\relax
+ \@nameuse{sls@ps@style@#1}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{pagestyleset}{#1}%
+ }%
+}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@pagestyleset}
+% \end{macrocode}
+% \begin{macro}{\sls@ps@style@standard}
+% \begin{macro}{\sls@ps@style@KOMA-Script}
+% These are the predefined page style sets.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@ps@style@standard{%
+ \newcommand*{\sls@ps@style@standard}{%
+ \let\MakeMarkcase\MakeUppercase
+ \scrlayer@AtEndOfPackage{%
+ \pagestyle{scrheadings}%
+ \clearpairofpagestyles
+ \ihead{\headmark}%
+ \ohead{\pagemark}%
+ \cfoot[\if@twoside\else\pagemark\fi]{}%
+ }%
+ }%
+}
+\scrlayerAddCsToInterface{sls@ps@style@KOMA-Script}{%
+ \@namedef{sls@ps@style@KOMA-Script}{%
+ \let\MakeMarkcase\@firstofone
+ \scrlayer@AtEndOfPackage{%
+ \pagestyle{scrheadings}%
+ \clearpairofpagestyles
+ \ohead{\if@twoside\headmark\fi}%
+ \chead{\if@twoside\else\headmark\fi}%
+ \ofoot[\if@twoside\pagemark\fi]{\if@twoside\pagemark\fi}%
+ \cfoot[\if@twoside\else\pagemark\fi]{\if@twoside\else\pagemark\fi}%
+ \scr@ifundefinedorrelax{KOMAClassName}{}{%
+ \ifstr{\KOMAClassName}{scrlttr2}{%
+% \end{macrocode}
+% We are using \Class{scrlttr2}, so we have to initialise the page style
+% different:
+% \changes{v3.18}{2015/06/24}{missing \cs{lofoot} and \cs{rofoot} added}^^A
+% \begin{macrocode}
+ \clearpairofpagestyles
+ \lehead[\ifnum\@pageat=\z@\pagemark\fi]
+ {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
+ \lohead[\ifnum\@pageat=\z@\pagemark\fi]
+ {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
+ \chead[\ifnum\@pageat=\@ne\pagemark\fi]
+ {\ifcase\@pageat \rightmark\or \pagemark\or \rightmark\fi}%
+ \rehead[\ifnum\@pageat=\tw@\pagemark\fi]
+ {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
+ \else \rightmark\fi}%
+ \rohead[\ifnum\@pageat=\tw@\pagemark\fi]
+ {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
+ \else \rightmark\fi}%
+ \lefoot[\ifnum\@pageat=\thr@@\pagemark\fi]
+ {\ifnum\@pageat=\thr@@\pagemark\fi}%
+ \lofoot[\ifnum\@pageat=\thr@@\pagemark\fi]
+ {\ifnum\@pageat=\thr@@\pagemark\fi}%
+ \cfoot[\ifnum\@pageat=4 \pagemark\fi]
+ {\ifnum\@pageat=4 \pagemark\fi}%
+ \refoot[\ifnum\@pageat=5 \pagemark\fi]
+ {\ifnum\@pageat=5 \pagemark\fi}%
+ \rofoot[\ifnum\@pageat=5 \pagemark\fi]
+ {\ifnum\@pageat=5 \pagemark\fi}%
+ }{}%
+ }%
+ }%
+ }%
+}
+%</options>
+% \end{macrocode}
+% \end{macro}^^A \sls@ps@style@KOMA-Script
+% \end{macro}^^A \sls@ps@style@standard
+% \end{option}^^A pagestyleset
+%
+% \begin{option}{komastyle}
+% \begin{option}{standardstyle}
+% These options are deprecated, but defined for compatibility with
+% \Package{scrpage2}:
+% \begin{macrocode}
+%<*options>
+\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{komastyle}{%
+ pagestyleset=KOMA-Script}
+\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{standardstyle}{%
+ pagestyleset=standard}
+%</options>
+% \end{macrocode}
+% \end{option}^^A standardstyle
+% \end{option}^^A komastyle
+%
+%
+% \section{Extended Mark Mechanisms}
+%
+% Package options \Option{markuppercase}, \Option{markusedcase}, and
+% \Option{nouppercase} of package \Package{scrpage2} will be mapped to
+% \KOMAScript{} option \Option{markcase}.
+%
+% \begin{option}{markuppercase}
+% \begin{option}{markusedcase}
+% \begin{option}{nouppercase}
+% For compatibility with \Package{scrpage2}.
+% \begin{macrocode}
+%<*options>
+\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{markuppercase}{markcase=upper}
+\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{markusedcase}{markcase=used}
+\KOMA@DeclareDeprecatedOption[scrlayer-scrpage]{nouppercase}{%
+ markcase=ignoreuppercase%
+}
+%</options>
+% \end{macrocode}
+% \end{option}^^A nouppercase
+% \end{option}^^A markusedcase
+% \end{option}^^A markuppercase
+%
+%
+% \section{Expert Page Style Definition Interface}
+%
+% This is the low level interface of \Package{scrpage2} with
+% \Macro{defpagestyle}, \Macro{newpagestyle}, \Macro{renewpagestyle}, and
+% \Macro{providepagestyle}. We will also define is. In difference to
+% \Package{scrpage2} layers are used. Following layers will be defined for
+% each page style:
+% \begin{description}
+% \item[\texttt{\meta{page style name}.head.above.line}] line above the head
+% \item[\texttt{\meta{page style name}.head.odd}] odd page head (only twoside)
+% \item[\texttt{\meta{page style name}.head.even}] even page head (only
+% twoside)
+% \item[\texttt{\meta{page style name}.head.oneside}] single-side head (only
+% oneside)
+% \item[\texttt{\meta{page style name}.head.below}] line below the head
+% \item[\texttt{\meta{page style name}.foot.above.line}] line above the footer
+% \item[\texttt{\meta{page style name}.foot.odd}] odd page footer (only
+% twoside)
+% \item[\texttt{\meta{page style name}.foot.even}] even side footer (only
+% twoside)
+% \item[\texttt{\meta{page style name}.foot.oneside}] single-side footer (only
+% oneside)
+% \item[\texttt{\meta{page style name}.foot.below.line}] line below the footer
+% (only oneside)
+% \end{description}
+% Note: \Package{scrpage2} also provides starred versions of the page style
+% definition commands, doing the same like the starless versions. This has
+% been done for compatibility reasons with deprecated \Package{scrpage2} and
+% may be removed some times. The layer interface doesn't support this.
+%
+% \begin{macro}{\defpagestyle}
+% \begin{description}
+% \item[\Parameter{string}:] the name of the page style to be defined (must
+% be fully expandable and expand to a string only).
+% \item[\Parameter{head/foot definition}:] will be used to define the
+% head (see \Macro{sls@defhead}).
+% \item[\Parameter{head/foot definition}:] will be used to define the
+% foot (see \Macro{sls@deffoot}).
+% \end{description}
+% See \Package{scrpage2} implementation.
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\defpagestyle{%
+ \newcommand*{\defpagestyle}[3]{%
+ \sls@defhead{#1}#2\@empty\@empty\@empty
+ \sls@deffoot{#1}#3\@empty\@empty\@empty
+ \DeclarePageStyleByLayers{#1}{%
+ #1.head.odd,#1.head.even,#1.head.oneside,%
+ #1.head.above.line,#1.head.below.line,%
+ #1.foot.odd,#1.foot.even,#1.foot.oneside,%
+ #1.foot.above.line,#1.foot.below.line%
+ }%
+ \edef\reserved@a{%
+ \noexpand\scrlayerOnAutoRemoveInterface[scrlayer-scrpage.sty]{%
+ \noexpand\DestroyLayer{#1.head.odd}%
+ \noexpand\DestroyLayer{#1.head.even}%
+ \noexpand\DestroyLayer{#1.head.oneside}%
+ \noexpand\DestroyLayer{#1.head.above.line}%
+ \noexpand\DestroyLayer{#1.head.below.line}%
+ \noexpand\DestroyLayer{#1.foot.odd}%
+ \noexpand\DestroyLayer{#1.foot.even}%
+ \noexpand\DestroyLayer{#1.foot.oneside}%
+ \noexpand\DestroyLayer{#1.foot.above.line}%
+ \noexpand\DestroyLayer{#1.foot.below.line}%
+ \noexpand\ifstr{\noexpand\currentpagestyle}{#1}{%
+ \noexpand\PackageWarning{scrlayer-scrpage}{%
+ page style `#1' not longer valid.\noexpand\MessageBreak
+ The page style has been defined using\noexpand\MessageBreak
+ interface `scrlayer-scrpage.sty', that\noexpand\MessageBreak
+ has been removed%
+ }%
+ }{}%
+ \noexpand\DestroyRealLayerPageStyle{#1}%
+ }%
+ }\reserved@a
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@defhead}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\sls@@defhead}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\sls@@@defhead}
+% \changes{v0.9}{2014/08/18}{fix names of layers \texttt{\dots head.odd} and
+% \texttt{\dots head.even}}%^^A
+% \begin{description}
+% \item[\MParameter{dimensional expression}{dimensional expression}:] length
+% and thickness of a line (ruler) above the page head. May be omitted and
+% if so the values from option \Option{headtopline} will be used.
+% \item[\Parameter{code}:] will be executed on even pages; used to define
+% the contents of layer \texttt{\meta{page style name}.head.even}.
+% \item[\Parameter{code}:] will be executed on odd pages within two-side
+% layout; used to define the contents of layer \texttt{\meta{page style
+% name}.head.odd}.
+% \item[\Parameter{code}:] will be executed on single-side pages; used to
+% define the contents of layer \texttt{\meta{page style
+% name}.head.oneside}.
+% \item[\MParameter{dimensional expression}{dimensional expression}:] length
+% and thickness of a line (ruler) below the page head. May be omitted and
+% if so the values from option \Option{headsepline} will be used.
+% \end{description}
+% Helper to define the head layers.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@defhead{%
+ \newcommand*\sls@defhead[1]{%
+ \kernel@ifnextchar(%)
+ {\sls@@defhead{#1}}%
+ {\sls@@defhead{#1}(\sls@headabove@linelength,\sls@headabove@linethickness)}%
+ }%
+}
+\scrlayerAddToInterface\sls@@defhead{%
+ \def\sls@@defhead#1(#2,#3)#4#5#6{%
+ \kernel@ifnextchar(%)
+ {\sls@@@defhead{#1}({#2},{#3}){#4}{#5}{#6}}%
+ {\sls@@@defhead{#1}%
+ ({#2},{#3})%
+ {#4}{#5}{#6}%
+ (\sls@headbelow@linelength,\sls@headbelow@linethickness)}%
+ }%
+}
+\scrlayerAddToInterface\sls@@@defhead{%
+ \def\sls@@@defhead#1(#2,#3)#4#5#6(#7,#8){%
+% \end{macrocode}
+% The lines:
+% \begin{macrocode}
+ \DeclareLayer[%
+ background,%
+ hoffset=\sls@leftmargin{head},%
+ voffset=\sls@topmargin+\dp\strutbox,%
+ width=\sls@headwidth,%
+ height=0pt,%
+ align=bl,%
+ contents={%
+ {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
+ \sls@hf@rule{headtop}{#2}{#3}}}}%
+ }%
+ ]{#1.head.above.line}%
+ \DeclareLayer[%
+ background,%
+ hoffset=\sls@leftmargin{head},%
+ voffset=\sls@topmargin+\headheight-\ht\strutbox+#8,%
+ width=\sls@headwidth,%
+ height=0pt,%
+ align=tl,%
+ contents={%
+ {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
+ \sls@hf@rule{headsep}{#7}{#8}}}}%
+ }%
+ ]{#1.head.below.line}%
+% \end{macrocode}
+% The odd side, even side and one side:
+% \changes{v3.13b}{2014/10/16}{workaround: additional group added to avoid
+% pdf\TeX{} color stack warnings}%^^A
+% \begin{macrocode}
+ \DeclareLayer[%
+ background,evenpage,twoside,%
+ head,%
+ hoffset=\sls@leftmargin{head},%
+ width=\sls@headwidth,%
+ contents={%
+ \sls@secure@box\headheight{%
+ \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#4}}}}}%
+ ]{#1.head.even}%
+ \DeclareLayer[%
+ background,oddpage,twoside,%
+ head,%
+ hoffset=\sls@leftmargin{head},%
+ width=\sls@headwidth,%
+ contents={%
+ \sls@secure@box\headheight{%
+ \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#5}}}}}%
+ ]{#1.head.odd}%
+ \DeclareLayer[%
+ background,oddpage,oneside,%
+ head,%
+ hoffset=\sls@leftmargin{head},%
+ width=\sls@headwidth,%
+ contents={%
+ \sls@secure@box\headheight{%
+ \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#6}}}}}%
+ ]{#1.head.oneside}%
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@deffoot}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\sls@@deffoot}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\sls@@@deffoot}
+% \changes{v0.9}{2014/08/18}{fix names of layers \texttt{\dots foot.odd} and
+% \texttt{\dots foot.even}}%^^A
+% \begin{description}
+% \item[\MParameter{dimensional expression}{dimensional expression}:] length
+% and thickness of a line (ruler) above the page footer. May be omitted
+% and if so the values from option \Option{footsepline} will be used.
+% \item[\Parameter{code}:] will be executed on even pages; used to define
+% the contents of layer \texttt{\meta{page style name}.foot.even}.
+% \item[\Parameter{code}:] will be executed on odd pages within two-side
+% layout; used to define the contents of layer \texttt{\meta{page style
+% name}.foot.odd}.
+% \item[\Parameter{code}:] will be executed on single-side pages; used to
+% define the contents of layer \texttt{\meta{page style
+% name}.foot.oneside}.
+% \item[\MParameter{dimensional expression}{dimensional expression}:] length
+% and thickness of a line (ruler) below the page footer. May be omitted
+% and if so the values from option \Option{footbotline} will be used.
+% \end{description}
+% Helper to define the foot layers.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@deffoot{%
+ \newcommand*\sls@deffoot[1]{%
+ \kernel@ifnextchar(%)
+ {\sls@@deffoot{#1}}%
+ {\sls@@deffoot{#1}(\sls@footabove@linelength,\sls@footabove@linethickness)}%
+ }%
+}
+\scrlayerAddToInterface\sls@@deffoot{%
+ \def\sls@@deffoot#1(#2,#3)#4#5#6{%
+ \kernel@ifnextchar(%)
+ {\sls@@@deffoot{#1}({#2},{#3}){#4}{#5}{#6}}%
+ {\sls@@@deffoot{#1}%
+ ({#2},{#3})%
+ {#4}{#5}{#6}%
+ (\sls@footbelow@linelength,\sls@footbelow@linethickness)}%
+ }%
+}
+\scrlayerAddToInterface\sls@@@deffoot{%
+ \def\sls@@@deffoot#1(#2,#3)#4#5#6(#7,#8){%
+% \end{macrocode}
+% The lines:
+% \begin{macrocode}
+ \DeclareLayer[%
+ foreground,%
+ hoffset=\sls@leftmargin{foot},%
+ voffset=\sls@topmargin
+ +\headheight+\headsep
+ +\textheight
+ +\footskip-\footheight
+ +2\dp\strutbox,%
+ width=\sls@footwidth,%
+ height=0pt,%
+ align=bl,%
+ contents={%
+ {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
+ \sls@hf@rule{footsep}{#2}{#3}}}}%
+ }%
+ ]{#1.foot.above.line}%
+ \DeclareLayer[%
+ foreground,%
+ hoffset=\sls@leftmargin{foot},%
+ voffset=\sls@topmargin
+ +\headheight+\headsep
+ +\textheight
+ +\footskip
+ +2\dp\strutbox
+ +#8,%
+ width=\sls@footwidth,%
+ height=0pt,%
+ align=bl,%
+ contents={%
+ {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
+ \sls@hf@rule{footbot}{#7}{#8}}}}%
+ }%
+ ]{#1.foot.below.line}%
+% \end{macrocode}
+% The odd side, even side and one side:
+% \begin{macrocode}
+ \DeclareLayer[%
+ foreground,evenpage,twoside,%
+ foot,%
+ hoffset=\sls@leftmargin{foot},%
+ width=\sls@footwidth,%
+ contents={%
+ \sls@secure@box\footheight{%
+ \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#4}}}}%
+ ]{#1.foot.even}%
+ \DeclareLayer[%
+ foreground,oddpage,twoside,%
+ foot,%
+ hoffset=\sls@leftmargin{foot},%
+ width=\sls@footwidth,%
+ contents={%
+ \sls@secure@box\footheight{%
+ \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#5}}}}%
+ ]{#1.foot.odd}%
+ \DeclareLayer[%
+ foreground,oddpage,oneside,%
+ foot,%
+ hoffset=\sls@leftmargin{foot},%
+ width=\sls@footwidth,%
+ contents={%
+ \sls@secure@box\footheight{%
+ \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#6}}}}%
+ ]{#1.foot.oneside}%
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@secure@box}
+% \begin{description}
+% \item[\Parameter{length}:] a \LaTeX{} length, that gives the maximum
+% height + depth of the \meta{content}. It has to be either
+% \cs{headheight} or \cs{footheight}.
+% \item[\Parameter{content}:] what should be output (inside the box).
+% \end{description}
+% Note, that several length may be changed, to fit.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@secure@box{%
+ \newcommand*{\sls@secure@box}[2]{%
+ \begingroup
+ \setbox\z@\vbox{%
+ \ifsls@leavevmode\leavevmode\expandafter\ignorespaces\fi
+ #2%
+ }%
+ \ifdim #1<\dimexpr \ht\z@+\dp\z@\relax
+ \PackageWarning{scrlayer-scrpage}{%
+ \string#1 to low.\MessageBreak
+ At least \the\dimexpr \ht\z@+\dp\z@\relax\space needed,\MessageBreak
+ but only \the#1 found.\MessageBreak
+ \ifsls@autoenlarge
+ I'll enlarge \string#1, for further\MessageBreak
+ processing, but you should do this yourself,\MessageBreak
+ \else
+ You should enlarge \string#1,\MessageBreak
+ \fi
+ e.g.,
+ \scr@ifundefinedorrelax{geometry}{%
+ \scr@ifundefinedorrelax{typearea}{%
+ using\MessageBreak
+ \space\space\string\setlength{\string#1}{%
+ \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
+ in your preamble%
+ }{%
+ setting typearea's option\MessageBreak
+ `\expandafter\@gobble\string#1=\the\dimexpr \ht\z@+\dp\z@\relax'%
+ }%
+ }{%
+ \ifx #1\headheight
+ setting geometry's option\MessageBreak
+ `head=\the\dimexpr \ht\z@+\dp\z@\relax'%
+ \else
+ using\MessageBreak
+ \space\space\string\setlength{\string#1}{%
+ \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
+ in your preamble%
+ \fi
+ }%
+ \ifsls@autoenlarge
+ .\MessageBreak
+ I'll also
+ \ifx #1\headheight decrease \string\topmargin
+ \else increase \string\footskip\fi
+ \fi
+ }%
+ \ifsls@autoenlarge
+ \@tempdima\dimexpr \ht\z@+\dp\z@\relax
+ \ifx #1\headheight
+ \global\advance\topmargin by \dimexpr #1-(\ht\z@+\dp\z@)\relax
+ \dp\z@\dimexpr \dp\z@+\ht\z@+\dp\z@-\headheight\relax
+ \else
+ \global\advance\footskip by \dimexpr \ht\z@+\dp\z@-#1\relax
+ \fi
+ \global#1\@tempdima
+ \fi
+ \fi
+ \usebox\z@
+ \endgroup
+ }%
+}
+%</body>
+% \end{macrocode}
+% \begin{option}{hmode}
+% Switch automatically to the horizontal mode before setting a page head or
+% page footer element.
+% \begin{macrocode}
+%<*options>
+\KOMA@ifkey{hmode}{sls@leavevmode}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@hmode}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@hmode@default}
+\scrlayer@AddCsToInterface{sls@leavevmode@linetrue}
+\scrlayer@AddCsToInterface{sls@leavevmode@linefalse}
+%</options>
+% \end{macrocode}
+% \end{option}^^A hmode
+% \begin{option}{autoenlargeheadfoot}
+% \changes{v3.25}{2018/01/14}{new option}^^A
+% Automaticly enlarge vertical size of head or foot if the contents is to
+% large. This is the default.
+% \begin{macrocode}
+%<*options>
+\KOMA@ifkey{autoenlargeheadfoot}{sls@autoenlarge}
+\KOMAExecuteOptions{autoenlargeheadfoot=true}
+\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@autoenlargeheadfoot}
+\scrlayer@AddCsToInterface{%
+ KV@KOMA.scrlayer-scrpage.sty@autoenlargeheadfoot@default}
+\scrlayer@AddCsToInterface{sls@autoenlargetrue}
+\scrlayer@AddCsToInterface{sls@autoenlargefalse}
+%</options>
+% \end{macrocode}
+% \end{option}^^A autoenlargeheadfoot
+% \end{macro}^^A \sls@secure@box
+% \end{macro}^^A \sls@@@deffoot
+% \end{macro}^^A \sls@@deffoot
+% \end{macro}^^A \sls@deffoot
+% \end{macro}^^A \sls@@@defhead
+% \end{macro}^^A \sls@@defhead
+% \end{macro}^^A \sls@defhead
+% \begin{macro}{\headfont}
+% The low level page head font command. It is deprecated to redefine or use
+% this and it may already be defined.
+% \begin{macro}{\scr@fnt@pagehead}
+% \changes{v3.25}{2018/02/05}{don't use \cs{newkomafont} to avoid
+% warning}^^A
+% \begin{macro}{\scr@fnt@wrn@pagehead}
+% \changes{v0.9}{2014/01/13}{warning always deactivated}^^A
+% \begin{macro}{\scr@fnt@pageheadfoot}
+% \begin{macrocode}
+%<*body>
+\@ifundefined{scr@fnt@pagehead}{%
+ \scr@ifundefinedorrelax{scr@fnt@instead@pagehead}{}{%
+ \PackageInfo{scrlayer-scrpage}{%
+ Makeing stand-alone element `pagehead' from\MessageBreak
+ alias to `pageheadfoot'%
+ }%
+ \let\scr@fnt@instead@pagehead\relax
+ }%
+ \scrlayer@AddCsToInterface{scr@fnt@pagehead}%
+ \@ifundefined{@pageheadfont}{%
+ \newcommand*{\@pageheadfont}{}%
+ \scrlayer@AddCsToInterface{@pageheadfont}%
+ }{}%
+ \newcommand*{\scr@fnt@pagehead}{\@pageheadfont}%
+}{}
+\@ifundefined{scr@fnt@pageheadfoot}{%
+ \newcommand*{\scr@fnt@pageheadfoot}{\headfont}%
+ \scrlayer@AddCsToInterface{scr@fnt@pageheadfoot}%
+ \@ifundefined{headfont}{%
+ \newcommand*{\headfont}{\normalcolor\slshape}%
+ }{}
+}{}
+\scr@ifundefinedorrelax{scr@fnt@wrn@pagehead}{}{%
+%<trace> \PackageInfo{scrlayer-scrpage}{%
+%<trace> deactivating warning for font element\MessageBreak
+%<trace> `pagehead'}%
+ \let\scr@fnt@wrn@pagehead\relax
+}
+% \end{macrocode}
+% \end{macro}^^A \scr@fnt@pageheadfoot
+% \end{macro}^^A \scr@fnt@wrn@pagehead
+% \end{macro}^^A \scr@fnt@pagehead
+% \end{macro}^^A \headfont
+%
+% \begin{macro}{\footfont}
+% The low level page footer font command. It is deprecated to redefine or use
+% this and it may already be defined.
+% \begin{macro}{\scr@fnt@pagefoot}
+% \begin{macro}{\scr@fnt@wrn@pagefoot}
+% \changes{v0.9}{2014/01/13}{warning always deactivated}
+% \begin{macrocode}
+\@ifundefined{scr@fnt@pagefoot}{%
+ \scrlayer@AddCsToInterface{scr@fnt@pagefoot}%
+ \def\scr@fnt@pagefoot{\footfont}%
+ \@ifundefined{footfont}{%
+ \newcommand*{\footfont}{}%
+ \scrlayer@AddCsToInterface{footfont}%
+ }{}%
+}{}
+\scr@ifundefinedorrelax{scr@fnt@wrn@pagefoot}{}{%
+%<trace> \PackageInfo{scrlayer-scrpage}{%
+%<trace> deactivating warning for font element\MessageBreak
+%<trace> `pagefoot'}%
+ \let\scr@fnt@wrn@pagefoot\relax
+}
+% \end{macrocode}
+% \end{macro}^^A \scr@fnt@wrn@pagefoot
+% \end{macro}^^A \scr@fnt@pagefoot
+% \end{macro}^^A \footfont
+%
+% \begin{macro}{\sls@hf@rule}
+% \begin{description}
+% \item[\Parameter{rule name}:] one of \texttt{headtop}, \texttt{headsep},
+% \texttt{footsep}, or \texttt{footbot}
+% \item[\Parameter{dimensional expression}:] the line length (width)
+% \item[\Parameter{dimensional expression}:] the line thickness (height)
+% \end{description}
+% Helper to draw the line.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@hf@rule{%
+ \newcommand*\sls@hf@rule[3]{%
+ \begingroup
+ \normalfont\usekomafont{#1line}{%
+ \vbox to \z@{%
+ \kern -\dimexpr #3\relax
+ \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
+ \if@twoside\ifodd\value{page}\else
+ \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
+ \fi\fi
+ \if@tempswa
+ \hskip \z@\@plus 1fill\@minus \paperwidth
+ \fi
+ \vrule \@width\dimexpr #2\relax \@height\dimexpr #3\relax \@depth\z@
+ \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
+ \if@twoside\ifodd\value{page}\else
+ \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
+ \fi\fi
+ \if@tempswa
+ \hskip \z@\@plus 1fill\@minus \paperwidth\null
+ \fi
+ }%
+ }%
+ \endgroup
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@hf@rule
+% \begin{macro}{\sls@topmargin}
+% \begin{macro}{\sls@leftmargin}
+% Two simple helper macros:
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@topmargin{%
+ \newcommand*{\sls@topmargin}{\dimexpr\topmargin+1in\relax}%
+}
+\scrlayerAddToInterface\sls@leftmargin{%
+ \newcommand*{\sls@leftmargin}[1]{%
+ \dimexpr
+ \if@twoside
+ \ifodd\value{page}
+ \oddsidemargin+\csname sls@odd#1shift\endcsname
+ \else
+ \evensidemargin+\csname sls@even#1shift\endcsname
+ \fi
+ \else
+ \oddsidemargin+\csname sls@odd#1shift\endcsname
+ \fi
+ +1in\relax
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \sls@leftmargin
+% \end{macro}^^A \sls@topmargin
+% \end{macro}^^A \defpagestyle
+%
+% \begin{macro}{\newpagestyle}
+% For the parameters see \Macro{defpagestyle}.
+% Define only, if not already defined:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\newpagestyle{%
+ \newcommand*\newpagestyle[3]{%
+ \@ifundefined{ps@#1}{\defpagestyle{#1}{#2}{#3}}{%
+ \PackageError{scrlayer-scrpage}{Page style `#1' already defined}{%
+ Only not yet defined page style may be defined using
+ \string\newpagestyle.\MessageBreak
+ You may use either \string\renewpagestyle, \string\providepagestyle,
+ or \string\defpagestyle\MessageBreak
+ with already defined page styles.\MessageBreak
+ If you'll continue, your command will be ignored.%
+ }%
+ }%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \newpagestyle
+%
+% \begin{macro}{\renewpagestyle}
+% For the parameters see \Macro{defpagestyle}.
+% Define only, if not already defined:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\renewpagestyle{%
+ \newcommand*\renewpagestyle[3]{%
+ \@ifundefined{ps@#1}{%
+ \PackageError{scrlayer-scrpage}{Undefined page style `#1'}{%
+ Only already defined page style may be re-defined using
+ \string\renewpagestyle.\MessageBreak
+ You may use either \string\newpagestyle, \string\providepagestyle,
+ or \string\defpagestyle\MessageBreak
+ with not yet defined page styles.\MessageBreak
+ If you'll continue, your command will be ignored.%
+ }%
+ }{%
+ \defpagestyle{#1}{#2}{#3}%
+ }%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \renewpagestyle
+%
+% \begin{macro}{\providepagestyle}
+% For the parameters see \Macro{defpagestyle}.
+% Define only, if not already defined:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\providepagestyle{%
+ \newcommand*\providepagestyle[3]{%
+ \@ifundefined{ps@#1}{%
+ \defpagestyle{#1}{#2}{#3}%
+ }{%
+%<*trace>
+ \PackageInfo{scrlayer-scrpage}{%
+ page style `#1' already defined.\MessageBreak
+ New definition ignored%
+ }%
+%</trace>
+ }%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \providepagestyle
+%
+%
+% \section{User Page Style Definition Interface}
+%
+% This is the mid-level interface of \Package{scrpage2} with
+% \Macro{deftripstyle}. As in \Package{scrpage2} we simply use the expert page
+% style definition interface to define the new user interface commands. But
+% here the useless starred versions will not longer be supported. So users of
+% them have to remove the star (nothing else).
+%
+% \begin{macro}{\deftriplepagestyle}
+% \begin{macro}{\newtriplepagestyle}
+% \begin{macro}{\renewtriplepagestyle}
+% \begin{macro}{\providetriplepagestyle}
+% \begin{macro}{\deftripstyle}
+% \begin{description}
+% \item[\Parameter{string}:] the name of the page style to be defined (must
+% be fully expandable and expand to a string only).
+% \item[\OParameter{dimensional expression}:] thickness of a horizontal line
+% above the page head and below the page foot (default: 0\,pt).
+% \item[\OParameter{dimensional expression}:] thickness of a horizontal line
+% below the page head and above the page foot (default: 0\,pt).
+% \item[\Parameter{code}:] will be expanded left aligned at head of odd
+% pages (with one-side layout all pages are odd) and right aligned at head
+% of even pages.
+% \item[\Parameter{code}:] will be expanded centered at head of odd
+% and even pages.
+% \item[\Parameter{code}:] will be expanded right aligned at head of odd
+% pages (with one-side layout all pages are odd) and left aligned at head
+% of even pages.
+% \item[\Parameter{code}:] will be expanded left aligned at footer of odd
+% pages (with one-side layout all pages are odd) and right aligned at
+% footer of even pages.
+% \item[\Parameter{code}:] will be expanded centered at footer of odd
+% and even pages.
+% \item[\Parameter{code}:] will be expanded right aligned at footer of odd
+% pages (with one-side layout all pages are odd) and left aligned at
+% footer of even pages.
+% \end{description}
+% See \Package{scrpage2}, but:
+% While the starred version of \Macro{deftripstyle} is deprecated for several
+% years and hasn't been described at the manual, it will not longer be
+% defined. Additional commands have been added.
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface{\deftriplepagestyle}{%
+ \newcommand*{\deftriplepagestyle}[1]{%
+ \let\@tempa\defpagestyle
+ \scrlayer@triplestyle{#1}%
+ }%
+}
+\scrlayerAddToInterface{\newtriplepagestyle}{%
+ \newcommand*{\newtriplepagestyle}[1]{%
+ \let\@tempa\newpagestyle
+ \scrlayer@triplestyle{#1}%
+ }%
+}
+\scrlayerAddToInterface{\renewtriplepagestyle}{%
+ \newcommand*{\renewtriplepagestyle}[1]{%
+ \let\@tempa\renewpagestyle
+ \scrlayer@triplestyle{#1}%
+ }%
+}
+\scrlayerAddToInterface{\providetriplepagestyle}{%
+ \newcommand*{\providetriplepagestyle}[1]{%
+ \let\@tempa\providepagestyle
+ \scrlayer@triplestyle{#1}%
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\scrlayer@triplestyle}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\scrlayer@@triplestyle}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\scrlayer@@@triplestyle}
+% Helpers, that do the real work. Parameters are same, but \cs{reserved@a} has
+% to be one of \Macro{defpagestyle}, \Macro{newpagestyle},
+% \Macro{renewpagestyle}, or \Macro{providepagestyle}.
+% \begin{macrocode}
+\scrlayerAddToInterface\scrlayer@triplestyle{%
+ \def\scrlayer@triplestyle#1{%
+ \kernel@ifnextchar[%]
+ {\scrlayer@@triplestyle{#1}}%
+ {\scrlayer@@triplestyle{#1}[\z@]}%
+ }
+}
+\scrlayerAddToInterface\scrlayer@@triplestyle{%
+ \def\scrlayer@@triplestyle#1[#2]{%
+ \kernel@ifnextchar[%]
+ {\scrlayer@@@triplestyle{#1}[#2]}%
+ {\scrlayer@@@triplestyle{#1}[\z@][#2]}%
+ }%
+}
+\scrlayerAddToInterface\scrlayer@@@triplestyle{%
+ \def\scrlayer@@@triplestyle#1[#2][#3]#4#5#6#7#8#9{%
+ \@tempa{#1}{%
+ (\sls@headwidth,#2)%
+ {%
+ \makebox[\z@][l]{#6}\hfill
+ \makebox[\z@][c]{#5}\hfill
+ \makebox[\z@][r]{#4}%
+ }{%
+ \makebox[\z@][l]{#4}\hfill
+ \makebox[\z@][c]{#5}\hfill
+ \makebox[\z@][r]{#6}%
+ }{%
+ \makebox[\z@][l]{#4}\hfill
+ \makebox[\z@][c]{#5}\hfill
+ \makebox[\z@][r]{#6}%
+ }%
+ (\sls@headwidth,#3)%
+ }{%
+ (\sls@footwidth,#3)%
+ {%
+ \makebox[\z@][l]{#9}\hfill
+ \makebox[\z@][c]{#8}\hfill
+ \makebox[\z@][r]{#7}%
+ }{%
+ \makebox[\z@][l]{#7}\hfill
+ \makebox[\z@][c]{#8}\hfill
+ \makebox[\z@][r]{#9}%
+ }{%
+ \makebox[\z@][l]{#7}\hfill
+ \makebox[\z@][c]{#8}\hfill
+ \makebox[\z@][r]{#9}%
+ }%
+ (\sls@footwidth,#2)%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \scrlayer@@@triplestyle
+% \end{macro}^^A \scrlayer@@triplestyle
+% \end{macro}^^A \scrlayer@triplestyle
+% \begin{macrocode}
+\scrlayerAddToInterface{\deftripstyle}{%
+ \newcommand*{\deftripstyle}{%
+ \PackageWarning{scrlayer-scrpage}{%
+ Command \string\deftripstyle\space is deprecate.\MessageBreak
+ You should replace it by \string\deftriplepagestyle,\MessageBreak
+ e.g.,%
+ }%
+ \let\deftripstyle\deftriplepagestyle
+ \deftripstyle
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \deftripstyle
+% \end{macro}^^A \providetriplepagestyle
+% \end{macro}^^A \renewtriplepagestyle
+% \end{macro}^^A \newtriplepagestyle
+% \end{macro}^^A \deftriplepagestyle
+%
+%
+% \section{Pre-defined Page Styles Interface}
+%
+% This is the high-level interface of \Package{scrpage2} with the page style
+% \Pagestyle{scrheadings}, \Pagestyle{scrplain}, and
+% \Pagestyle{useheadings}. Those will work as expected but will also be
+% extended to support definition of additional styles using the same
+% interface.
+%
+% \begin{macro}{\defpairofpagestyles}
+% \begin{description}
+% \item[\OParameter{string}:] name of a parent page style, that will be used
+% to initialise the new page style (must be fully expandable and expand to
+% the name of a page style).
+% \item[\Parameter{string}:] name the page style to be defined (must be
+% fully expandable and expand to the name of a page style).
+% \item[\Parameter{code}:] several commands of \Macro{ihead}, \Macro{chead},
+% \Macro{ohead}, \Macro{lehead}, \Macro{lohead}, \Macro{cohead},
+% \Macro{rehead}, \Macro{cehead}, \Macro{rohead}, \Macro{ifoot},
+% \Macro{cfoot}, \Macro{ofoot}, \Macro{lefoot}, \Macro{cefoot},
+% \Macro{lofoot}, \Macro{refoot}, \Macro{cofoot}, \Macro{rofoot},
+% \Macro{clearscrheadfoot}, \Macro{clearscrheadings},
+% \Macro{clearscrplain}.
+% \end{description}
+% Two page styles will be defined using \Macro{defpagestyle}, page style named
+% with the second argument and page style with the same name but an additional
+% prefix ``\texttt{plain.}''. This will be activated automatically to be the
+% plain page style when the first page style will be used. If first argument
+% is used this pair of page styles will be used to initialise the head and
+% footer of the new. All the other commands are used to define the initial
+% fields. Note, if one of those page styles is active, all further commands
+% (see 3rd argument) depend on the active page style. If no one is active,
+% they depend on page style \texttt{scrheadings}.
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\defpairofpagestyles{%
+ \newcommand*{\defpairofpagestyles}[3][]{%
+ \def\reserved@a##1##2##3##4##5##6##7\@nil{##1##2##3##4##5##6}%
+ \edef\reserved@a{\expandafter\reserved@a #2xxxxxx\@nil}%
+ \ifstr\reserved@a{plain.}{%
+ \PackageError{scrlayer-scrpage}{plain page style `#2' not allowed}{%
+ You may not define a plain page style using
+ \string\defpairofpagestyles, \string\newpairofpagestyles,
+ \string\renewpairofpagestyles, or\MessageBreak
+ \string\providepairofpagestyles. I'd suggest to simply define the
+ corresponding\MessageBreak
+ non-plain page style to also define the plain one.\MessageBreak
+ If you'll continue, your command will be ignored.}%
+ }{%
+ \sls@init@pair@page@style*{#2}%
+ \sls@init@pair@page@style*{plain.#2}%
+ \ifx\relax #1\relax\else
+ \scr@ifundefinedorrelax{sls@ps@#1@even@left@head}{%
+ \PackageError{scrlayer-scrpage}{`#1' not a pair page style}{%
+ Only pair page styles may be used to initialise new pairs of page
+ styles. So\MessageBreak
+ optional argument of \string\defpairofpagestyles,
+ \string\newpairofpagestyles,\MessageBreak
+ \string\renewpairofpagestyles, or \string\providepairofpagestyle has
+ to be a pair\MessageBreak
+ page style or should be unused.\MessageBreak
+ If you'll continue, the initialisation will be ignored.}%
+ }{%
+ \sls@init@pair@page@style{#2}{#1}%
+ \scr@ifundefinedorrelax{sls@ps@plain.#1@even@left@head}{%
+ \sls@init@pair@page@style{plain.#2}{#1}%
+ }{%
+ \sls@init@pair@page@style{plain.#2}{plain.#1}%
+ }%
+ }%
+ \fi
+ \edef\reserved@a{%
+ \noexpand\scrlayerOnAutoRemoveInterface[scrlayer-scrpage.sty]{%
+ \noexpand\sls@init@pair@page@style**{#2}%
+ \noexpand\sls@init@pair@page@style**{plain.#2}%
+ \noexpand\expandafter\noexpand\ifx\noexpand
+ \csname ps@plain.#2\noexpand\endcsname\noexpand\ps@plain
+ \noexpand\PackageWarning{scrlayer-scrpage}{%
+ page style `#2' not longer valid.\noexpand\MessageBreak
+ This was the current plain page style.\noexpand\MessageBreak
+ Making current plain page style empty.\noexpand\MessageBreak
+ The page style has been defined using\noexpand\MessageBreak
+ interface `scrlayer-scrpage.sty', that\noexpand\MessageBreak
+ has been removed%
+ }%
+ \noexpand\def\noexpand\ps@plain{%
+ \noexpand\def\noexpand\@oddhead{}\noexpand\def\noexpand\@evenhead{}%
+ \noexpand\def\noexpand\@oddhead{}\noexpand\def\noexpand\@evenhead{}%
+ }%
+ \noexpand\fi
+ }%
+ }\reserved@a
+ \sls@def@pair@page@style@member{#2}%
+ \AddToLayerPageStyleOptions{#2}{%
+ onselect={%
+% \end{macrocode}
+% \changes{v3.15}{2015/01/08}{usage of \cs{DeclarePageStyleAlias} instead of
+% \cs{let}}^^A fixme: Is this correct?
+% \begin{macrocode}
+ \DeclarePageStyleAlias{plain}{plain.#2}%
+ \DeclarePageStyleAlias{headings}{#2}%
+ \def\sls@currentheadings{#2}%
+ \def\sls@currentplain{plain.#2}%
+ #3%
+ }%
+ }%
+ \sls@def@pair@page@style@member{plain.#2}%
+ \AddToLayerPageStyleOptions{plain.#2}{%
+ onselect={%
+% \end{macrocode}
+% \changes{v3.15}{2015/01/08}{usage of \cs{DeclarePageStyleAlias} instead of
+% \cs{let}}^^A fixme: Is this correct?
+% \begin{macrocode}
+ \DeclarePageStyleAlias{plain}{plain.#2}%
+ \DeclarePageStyleAlias{headings}{#2}%
+ \def\sls@currentheadings{#2}%
+ \def\sls@currentplain{plain.#2}%
+ #3%
+ },%
+ oninit={%
+ \expandafter
+ \ifx\csname ifsls@plain@head@above@line\expandafter\endcsname
+ \csname iftrue\endcsname\else
+ \let\sls@headabove@linelength\z@
+ \let\sls@headabove@linethickness\z@
+ \fi
+ \expandafter
+ \ifx\csname ifsls@plain@head@below@line\expandafter\endcsname
+ \csname iftrue\endcsname\else
+ \let\sls@headbelow@linelength\z@
+ \let\sls@headbelow@linethickness\z@
+ \fi
+ \expandafter
+ \ifx\csname ifsls@plain@foot@above@line\expandafter\endcsname
+ \csname iftrue\endcsname\else
+ \let\sls@footabove@linelength\z@
+ \let\sls@footabove@linethickness\z@
+ \fi
+ \expandafter
+ \ifx\csname ifsls@plain@foot@below@line\expandafter\endcsname
+ \csname iftrue\endcsname\else
+ \let\sls@footbelow@linelength\z@
+ \let\sls@footbelow@linethickness\z@
+ \fi
+ }%
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@currentheadings}
+% \begin{macro}{\sls@currentplain}
+% These little helpers will be set up at selection of each pair page style and
+% stores the last activated page style pair of the scope.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@currentheadings{%
+ \newcommand*\sls@currentheadings{scrheadings}%
+}
+\scrlayerAddToInterface\sls@currentplain{%
+ \newcommand*\sls@currentplain{plain.scrheadings}%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@currentplain
+% \end{macro}^^A \sls@currentheadings
+% \begin{macro}{\sls@init@pair@page@style}
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\sls@init@@pair@page@style}
+% \begin{description}
+% \item[\Parameter{string}:] the name of the page style, that should be
+% initialised to be one member of a page style pair.
+% \item[\Parameter{string}:] the name of a member of a page style pair, that
+% should be used to initialise one the member of a page style pair from
+% first argument.
+% \end{description}
+% These are two little helpers for \Macro{defpairofpagestyles}.
+% The first command has two starred versions. With one star the commands for
+% the page style will be initialised to \Macro{@empty}, with two stars they
+% will become \LaTeX-undefined (\Macro{relax}).
+%
+% Note also, that the second argument may either be the plain or the non-plain
+% member of the page style pair.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@init@pair@page@style{%
+ \newcommand*{\sls@init@pair@page@style}{%
+ \kernel@ifstar {%
+ \kernel@ifstar {%
+ \sls@let@pair@page@style\relax
+ }{%
+ \sls@let@pair@page@style\@empty
+ }
+ }{%
+ \sls@init@@pair@page@style
+ }%
+ }%
+}
+\scrlayerAddToInterface\sls@init@@pair@page@style{%
+ \newcommand*{\sls@init@@pair@page@style}[2]{%
+ \expandafter\let\csname sls@ps@#1@even@left@head\expandafter\endcsname
+ \csname sls@ps@#2@even@left@head\endcsname
+ \expandafter\let\csname sls@ps@#1@even@middle@head\expandafter\endcsname
+ \csname sls@ps@#2@even@middle@head\endcsname
+ \expandafter\let\csname sls@ps@#1@even@right@head\expandafter\endcsname
+ \csname sls@ps@#2@even@right@head\endcsname
+ \expandafter\let\csname sls@ps@#1@odd@left@head\expandafter\endcsname
+ \csname sls@ps@#2@odd@left@head\endcsname
+ \expandafter\let\csname sls@ps@#1@odd@middle@head\expandafter\endcsname
+ \csname sls@ps@#2@odd@middle@head\endcsname
+ \expandafter\let\csname sls@ps@#1@odd@right@head\expandafter\endcsname
+ \csname sls@ps@#2@odd@right@head\endcsname
+ \expandafter\let\csname sls@ps@#1@even@left@foot\expandafter\endcsname
+ \csname sls@ps@#2@even@left@foot\endcsname
+ \expandafter\let\csname sls@ps@#1@even@middle@foot\expandafter\endcsname
+ \csname sls@ps@#2@even@middle@foot\endcsname
+ \expandafter\let\csname sls@ps@#1@even@right@foot\expandafter\endcsname
+ \csname sls@ps@#2@even@right@foot\endcsname
+ \expandafter\let\csname sls@ps@#1@odd@left@foot\expandafter\endcsname
+ \csname sls@ps@#2@odd@left@foot\endcsname
+ \expandafter\let\csname sls@ps@#1@odd@middle@foot\expandafter\endcsname
+ \csname sls@ps@#2@odd@middle@foot\endcsname
+ \expandafter\let\csname sls@ps@#1@odd@right@foot\expandafter\endcsname
+ \csname sls@ps@#2@odd@right@foot\endcsname
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@init@@pair@page@style
+% \begin{macro}{\sls@let@pair@page@style}
+% \begin{description}
+% \item[\Parameter{command}:] a single command used to initialise the
+% commands of the page style commands.
+% \item[\Parameter{string}:] the name of a member of a page style pair, that
+% should be used to initialise one the member of a page style pair from
+% first argument.
+% \end{description}
+% A little helper for \Macro{sls@init@pair@page@style}.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@let@pair@page@style{%
+ \newcommand*{\sls@let@pair@page@style}[2]{%
+ \expandafter\let\csname sls@ps@#2@even@left@head\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@even@middle@head\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@even@right@head\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@odd@left@head\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@odd@middle@head\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@odd@right@head\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@even@left@foot\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@even@middle@foot\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@even@right@foot\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@odd@left@foot\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@odd@middle@foot\endcsname #1%
+ \expandafter\let\csname sls@ps@#2@odd@right@foot\endcsname #1%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \sls@let@pair@page@style
+% \end{macro}^^A \sls@init@pair@page@style
+% \begin{macro}{\sls@def@pair@page@style@member}
+% \changes{v3.24}{2017/05/04}{improved \textsf{bidi} compatibility}^^A
+% \begin{description}
+% \item[\Parameter{string}:] name of the page style to be defined.
+% \end{description}
+% A little helper for \Macro{defpairofpagestyles}.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@def@pair@page@style@member{%
+ \newcommand*{\sls@def@pair@page@style@member}[1]{%
+ \defpagestyle{#1}{%
+ {%
+ \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\raggedright
+ \strut\@nameuse{sls@ps@#1@even@left@head}\strut}}%
+ \parbox{\sls@headwidth}{\centering
+ \strut\@nameuse{sls@ps@#1@even@middle@head}\strut}%
+ \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\raggedleft
+ \strut\@nameuse{sls@ps@#1@even@right@head}\strut}}%
+ }{%
+ \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\raggedright
+ \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
+ \parbox{\sls@headwidth}{\centering
+ \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
+ \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\raggedleft
+ \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
+ }{%
+ \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\raggedright
+ \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
+ \parbox{\sls@headwidth}{\centering
+ \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
+ \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\raggedleft
+ \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
+ }%
+ }{%
+ {%
+ \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\raggedright
+ \strut\@nameuse{sls@ps@#1@even@left@foot}\strut}}%
+ \parbox{\sls@footwidth}{\centering
+ \strut\@nameuse{sls@ps@#1@even@middle@foot}\strut}%
+ \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\raggedleft
+ \strut\@nameuse{sls@ps@#1@even@right@foot}\strut}}%
+ }{%
+ \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\raggedright
+ \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
+ \parbox{\sls@footwidth}{\centering
+ \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
+ \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\raggedleft
+ \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
+ }{%
+ \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\raggedright
+ \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
+ \parbox{\sls@footwidth}{\centering
+ \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
+ \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\raggedleft
+ \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
+ }%
+ }%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \sls@def@pair@page@style@member
+% \end{macro}^^A \defpairofpagestyles
+%
+% \begin{macro}{\newpairofpagestyles}
+% \begin{macro}{\renewpairofpagestyles}
+% \begin{macro}{\providepairofpagestyles}
+% See \Macro{defpairofpagestyles} for the arguments.
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\newpairofpagestyles{%
+ \newcommand*{\newpairofpagestyles}[3][]{%
+ \scr@ifundefinedorrelax{ps@#2}{%
+ \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
+ \PackageError{scrlayer-scrpage}{%
+ Plain page style of `#2' already defined}{%
+ You may only define a new pair of page styles, if neither the style
+ itself\MessageBreak
+ nor it's plain page style has already been defined.\MessageBreak
+ You may use only \string\defpairofpagestyles\space or
+ \string\providepairofpagestyles\space with partly\MessageBreak
+ already defined page styles.\MessageBreak
+ If you'll continue, your command will be ignored.%
+ }%
+ }%
+ }{%
+ \PackageError{scrlayer-scrpage}{%
+ Page style `#2' already defined}{%
+ You may only define a new pair of page styles, if neither the style
+ itself\MessageBreak
+ nor it's plain page style has already been defined.\MessageBreak
+ You may use either \string\renewpairsofpagestyles,
+ \string\defpairofpagestyles, or\MessageBreak
+ \string\providepairofpagestyles\space with already defined page
+ styles.\MessageBreak
+ If you'll continue, your command will be ignored.%
+ }%
+ }%
+ }%
+}
+\scrlayerAddToInterface\renewpairofpagestyles{%
+ \newcommand*{\renewpairofpagestyles}[3][]{%
+ \scr@ifundefinedorrelax{ps@#2}{%
+ \PackageError{scrlayer-scrpage}{%
+ Undefined page style `#2'}{%
+ You may only redefine existing pairs of page styles. You may use
+ either\MessageBreak
+ \string\newpairsofpagestyles, \string\defpairofpagestyles, or
+ \string\providepairofpagestyles\MessageBreak
+ with not yet defined page styles.\MessageBreak
+ If you'll continue, your command will be ignored.%
+ }%
+ }{%
+ \@ifundefined{ps@plain.#2}{%
+ \PackageError{scrlayer-scrpage}{%
+ Undefined plain page style of `#2'}{%
+ You may only redefine existing pairs of page styles. You may use
+ either\MessageBreak
+ \string\defpairofpagestyles\space or
+ \string\providepairofpagestyles\space with partly already
+ defined\MessageBreak
+ page styles.\MessageBreak
+ If you'll continue, your command will be ignored.%
+ }%
+ }{\defpairofpagestyles[#1]{#2}{#3}}%
+ }%
+ }%
+}
+\scrlayerAddToInterface\providepairofpagestyles{%
+ \newcommand*{\providepairofpagestyles}[3][]{%
+ \scr@ifundefinedorrelax{ps@#2}{%
+ \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
+%<*trace>
+ \PackageInfo{scrlayer-scrpage}{%
+ Plain page style of `#2' already\MessageBreak
+ defined. Definition ignored}%
+%</trace>
+ }%
+ }{%
+%<*trace>
+ \PackageInfo{scrlayer-scrpage}{%
+ Page style of `#2' already defined.\MessageBreak
+ Definition ignored}%
+%</trace>
+ }%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \providepairofpagestyles
+% \end{macro}^^A \renewpairofpagestyles
+% \end{macro}^^A \newpairofpagestyles
+%
+% \begin{macro}{\ps@scrheadings}
+% \begin{macro}{\ps@plain.scrheadings}
+% We have one predefined pair: \texttt{scrheadings} with plain page style
+% \texttt{plain.scrheadings}.
+% \begin{macrocode}
+%<*body>
+\newpairofpagestyles{scrheadings}{}%
+% \end{macrocode}
+% \begin{macro}{\ps@scrplain}
+% But with package \Package{scrpage2} the plain page style was
+% \texttt{scrplain}. So we make a kind of alias:
+% \begin{macrocode}
+\DeclarePageStyleAlias{scrplain}{plain.scrheadings}
+\scrlayerOnAutoRemoveInterface{\DestroyPageStyleAlias{scrplain}}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \ps@scrplain
+% \end{macro}^^A \ps@plain.scrheadings
+% \end{macro}^^A \ps@scrheadings
+%
+%
+% \begin{macro}{\ihead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\ohead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\chead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\lehead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\lohead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\rehead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\rohead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\cehead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\cohead}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\ifoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\ofoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\cfoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\lefoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\lofoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\refoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\rofoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\cefoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\cofoot}
+% \changes{v3.14}{2014/09/19}{new star version double the argument}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% We also need macros to define the contents of the three part head
+% and foot. Each macro defines one of the part of head or foot of the
+% headings page style member and optional of the plain page style
+% member.
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\ihead{%
+ \newcommand*{\ihead}{\kernel@ifstar {\@dblarg\@@@ihead}{\@ihead}}%
+}
+% \end{macrocode}
+% \begin{macro}{\@ihead}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\@@ihead}
+% \begin{macro}{\@@@ihead}
+% Two helpers for the previous one to double the command and it's arguments.
+% \begin{macrocode}
+\scrlayerAddToInterface\@ihead{%
+ \newcommand*{\@ihead}{\kernel@ifnextchar[{\@@@ihead}{\@@ihead}}%
+}
+\scrlayerAddToInterface\@@ihead{%
+ \newcommand*{\@@ihead}[1]{\rehead{#1}\lohead{#1}}%
+}
+\scrlayerAddToInterface\@@@ihead{%
+ \newcommand*{\@@@ihead}[2][]{\rehead[{#1}]{#2}\lohead[{#1}]{#2}}%
+}
+% \end{macrocode}
+% \end{macro}^^A \@@@ihead
+% \end{macro}^^A \@@ihead
+% \end{macro}^^A \@ihead
+% \begin{macrocode}
+\scrlayerAddToInterface\ohead{%
+ \newcommand*{\ohead}{\kernel@ifstar {\@dblarg\@@@ohead}{\@ohead}}%
+}
+% \end{macrocode}
+% \begin{macro}{\@ohead}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\@@ohead}
+% \begin{macro}{\@@@ohead}
+% Two helpers for the previous one to double the command and it's arguments.
+% \begin{macrocode}
+\scrlayerAddToInterface\@ohead{%
+ \newcommand*{\@ohead}{\kernel@ifnextchar[{\@@@ohead}{\@@ohead}}%
+}
+\scrlayerAddToInterface\@@ohead{%
+ \newcommand*{\@@ohead}[1]{\lehead{#1}\rohead{#1}}%
+}
+\scrlayerAddToInterface\@@@ohead{%
+ \newcommand*{\@@@ohead}[2][]{\lehead[{#1}]{#2}\rohead[{#1}]{#2}}%
+}
+% \end{macrocode}
+% \end{macro}^^A \@@@ohead
+% \end{macro}^^A \@@ohead
+% \end{macro}^^A \@ohead
+% \begin{macrocode}
+\scrlayerAddToInterface\chead{%
+ \newcommand*{\chead}{\kernel@ifstar {\@dblarg\@@@chead}{\@chead}}%
+}
+% \end{macrocode}
+% \begin{macro}{\@chead}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\@@chead}
+% \begin{macro}{\@@@chead}
+% Two helpers for the previous one to double the command and it's arguments.
+% \begin{macrocode}
+\scrlayerAddToInterface\@chead{%
+ \newcommand*{\@chead}{\kernel@ifnextchar[{\@@@chead}{\@@chead}}%
+}
+\scrlayerAddToInterface\@@chead{%
+ \newcommand*{\@@chead}[1]{\cehead{#1}\cohead{#1}}%
+}
+\scrlayerAddToInterface\@@@chead{%
+ \newcommand*{\@@@chead}[2][]{\cehead[{#1}]{#2}\cohead[{#1}]{#2}}%
+}
+% \end{macrocode}
+% \end{macro}^^A \@@@chead
+% \end{macro}^^A \@@chead
+% \end{macro}^^A \@chead
+% \begin{macrocode}
+\scrlayerAddToInterface\lehead{%
+ \newcommand*{\lehead}{\sls@renewelement{even}{left}{head}}%
+}
+\scrlayerAddToInterface\lohead{%
+ \newcommand*{\lohead}{\sls@renewelement{odd}{left}{head}}%
+}
+\scrlayerAddToInterface\rehead{%
+ \newcommand*{\rehead}{\sls@renewelement{even}{right}{head}}%
+}
+\scrlayerAddToInterface\rohead{%
+ \newcommand*{\rohead}{\sls@renewelement{odd}{right}{head}}%
+}
+\scrlayerAddToInterface\cehead{%
+ \newcommand*{\cehead}{\sls@renewelement{even}{middle}{head}}%
+}
+\scrlayerAddToInterface\cohead{%
+ \newcommand*{\cohead}{\sls@renewelement{odd}{middle}{head}}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\scrlayerAddToInterface\ifoot{%
+ \newcommand*{\ifoot}{\kernel@ifstar {\@dblarg\@@@ifoot}{\@ifoot}}%
+}
+% \end{macrocode}
+% \begin{macro}{\@ifoot}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\@@ifoot}
+% \begin{macro}{\@@@ifoot}
+% Two helpers for the previous one to double the command and it's arguments.
+% \begin{macrocode}
+\scrlayerAddToInterface\@ifoot{%
+ \newcommand*{\@ifoot}{\kernel@ifnextchar[{\@@@ifoot}{\@@ifoot}}%
+}
+\scrlayerAddToInterface\@@ifoot{%
+ \newcommand*{\@@ifoot}[1]{\refoot{#1}\lofoot{#1}}%
+}
+\scrlayerAddToInterface\@@@ifoot{%
+ \newcommand*{\@@@ifoot}[2][]{\refoot[{#1}]{#2}\lofoot[{#1}]{#2}}%
+}
+% \end{macrocode}
+% \end{macro}^^A \@@@ifoot
+% \end{macro}^^A \@@ifoot
+% \end{macro}^^A \@ifoot
+% \begin{macrocode}
+\scrlayerAddToInterface\ofoot{%
+ \newcommand*{\ofoot}{\kernel@ifstar {\@dblarg\@@@ofoot}{\@ofoot}}%
+}
+% \end{macrocode}
+% \begin{macro}{\@ofoot}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\@@ofoot}
+% \begin{macro}{\@@@ofoot}
+% Two helpers for the previous one to double the command and it's arguments.
+% \begin{macrocode}
+\scrlayerAddToInterface\@ofoot{%
+ \newcommand*{\@ofoot}{\kernel@ifnextchar[{\@@@ofoot}{\@@ofoot}}%
+}
+\scrlayerAddToInterface\@@ofoot{%
+ \newcommand*{\@@ofoot}[1]{\lefoot{#1}\rofoot{#1}}%
+}
+\scrlayerAddToInterface\@@@ofoot{%
+ \newcommand*{\@@@ofoot}[2][]{\lefoot[{#1}]{#2}\rofoot[{#1}]{#2}}%
+}
+% \end{macrocode}
+% \end{macro}^^A \@@@ofoot
+% \end{macro}^^A \@@ofoot
+% \end{macro}^^A \@ofoot
+% \begin{macrocode}
+\scrlayerAddToInterface\cfoot{%
+ \newcommand*{\cfoot}{\kernel@ifstar {\@dblarg\@@@cfoot}{\@cfoot}}%
+}
+% \end{macrocode}
+% \begin{macro}{\@cfoot}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \begin{macro}{\@@cfoot}
+% \begin{macro}{\@@@cfoot}
+% Two helpers for the previous one to double the command and it's arguments.
+% \begin{macrocode}
+\scrlayerAddToInterface\@cfoot{%
+ \newcommand*{\@cfoot}{\kernel@ifnextchar[{\@@@cfoot}{\@@cfoot}}%
+}
+\scrlayerAddToInterface\@@cfoot{%
+ \newcommand*{\@@cfoot}[1]{\cefoot{#1}\cofoot{#1}}%
+}
+\scrlayerAddToInterface\@@@cfoot{%
+ \newcommand*{\@@@cfoot}[2][]{\cefoot[{#1}]{#2}\cofoot[{#1}]{#2}}%
+}
+% \end{macrocode}
+% \end{macro}^^A \@@@cfoot
+% \end{macro}^^A \@@cfoot
+% \end{macro}^^A \@cfoot
+% \begin{macrocode}
+\scrlayerAddToInterface\lefoot{%
+ \newcommand*{\lefoot}{\sls@renewelement{even}{left}{foot}}%
+}
+\scrlayerAddToInterface\lofoot{%
+ \newcommand*{\lofoot}{\sls@renewelement{odd}{left}{foot}}%
+}
+\scrlayerAddToInterface\refoot{%
+ \newcommand*{\refoot}{\sls@renewelement{even}{right}{foot}}%
+}
+\scrlayerAddToInterface\rofoot{%
+ \newcommand*{\rofoot}{\sls@renewelement{odd}{right}{foot}}%
+}
+\scrlayerAddToInterface\cefoot{%
+ \newcommand*{\cefoot}{\sls@renewelement{even}{middle}{foot}}%
+}
+\scrlayerAddToInterface\cofoot{%
+ \newcommand*{\cofoot}{\sls@renewelement{odd}{middle}{foot}}%
+}
+% \end{macrocode}
+% \begin{macro}{\sls@renewelement}
+% \begin{macro}{\sls@@renewelement}
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}^^A
+% \begin{macro}{\sls@@@renewelement}
+% \begin{macro}{\sls@@@@renewelement}
+% \begin{macro}{\sls@@renewplainelement}
+% Little helper for several of the above commands.
+% \begin{macrocode}
+\scrlayerAddToInterface\sls@renewelement{%
+ \newcommand*{\sls@renewelement}[3]{%
+ \kernel@ifstar{\@dblarg{\sls@@@@renewelement{#1}{#2}{#3}}}%
+ {\sls@@renewelement{#1}{#2}{#3}}%
+ }%
+}
+\scrlayerAddToInterface\sls@@renewelement{%
+ \newcommand*{\sls@@renewelement}[3]{%
+ \kernel@ifnextchar[%]
+ {\sls@@@@renewelement{#1}{#2}{#3}}%
+ {\sls@@@renewelement{#1}{#2}{#3}}%
+ }%
+}
+\scrlayerAddToInterface\sls@@@renewelement{%
+ \newcommand*{\sls@@@renewelement}[4]{%
+ \scr@ifundefinedorrelax{sls@ps@\sls@currentheadings @#1@#2@#3}{%
+ \@namedef{sls@ps@scrheadings@#1@#2@#3}{#4}%
+ }{%
+ \@namedef{sls@ps@\sls@currentheadings @#1@#2@#3}{#4}%
+ }%
+ }%
+}
+\scrlayerAddToInterface\sls@@@@renewelement{%
+ \def\sls@@@@renewelement#1#2#3[#4]#5{%
+ \sls@@renewplainelement{#1}{#2}{#3}{#4}%
+ \sls@@@renewelement{#1}{#2}{#3}{#5}%
+ }%
+}
+\scrlayerAddToInterface\sls@@renewplainelement{%
+ \newcommand*{\sls@@renewplainelement}[4]{%
+ \scr@ifundefinedorrelax{sls@ps@\sls@currentplain @#1@#2@#3}{%
+ \@namedef{sls@ps@plain.scrheadings@#1@#2@#3}{#4}%
+ }{%
+ \@namedef{sls@ps@\sls@currentplain @#1@#2@#3}{#4}%
+ }%
+ }%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \sls@@renewplainelement
+% \end{macro}^^A \sls@@@@renewelement
+% \end{macro}^^A \sls@@@renewelement
+% \end{macro}^^A \sls@@renewelement
+% \end{macro}^^A \sls@renewelement
+% \end{macro}^^A \cofoot
+% \end{macro}^^A \cefoot
+% \end{macro}^^A \rofoot
+% \end{macro}^^A \refoot
+% \end{macro}^^A \lofoot
+% \end{macro}^^A \lefoot
+% \end{macro}^^A \cfoot
+% \end{macro}^^A \ofoot
+% \end{macro}^^A \ifoot
+% \end{macro}^^A \cohead
+% \end{macro}^^A \cehead
+% \end{macro}^^A \rohead
+% \end{macro}^^A \rehead
+% \end{macro}^^A \lohead
+% \end{macro}^^A \lehead
+% \end{macro}^^A \chead
+% \end{macro}^^A \ohead
+% \end{macro}^^A \ihead
+%
+% \begin{macro}{\clearmainofpairofpagestyles}
+% \begin{macro}{\clearscrheadings}
+% Maybe you want to clear the currently defined head and foot. First
+% let's clear only scrheadings pagestyle but not scrplain pagestyle.
+% We do this simply using the already known command:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\clearmainofpairofpagestyles{%
+ \newcommand*{\clearmainofpairofpagestyles}{%
+ \ihead{}\chead{}\ohead{}\ifoot{}\cfoot{}\ofoot{}%
+ }%
+}
+\scrlayerAddToInterface\clearscrheadings{%
+ \let\clearscrheadings\clearmainofpairofpagestyles
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \clearscrheadings
+% \end{macro}^^A \clearmainofpairofpagestyles
+% \begin{macro}{\clearplainofpairofpagestyles}
+% \begin{macro}{\clearscrplain}
+% Now, we use the not recommended feature to set up a plain style:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\clearplainofpairofpagestyles{%
+ \newcommand*{\clearplainofpairofpagestyles}{%
+ \sls@@renewplainelement{odd}{left}{head}{}%
+ \sls@@renewplainelement{odd}{right}{head}{}%
+ \sls@@renewplainelement{odd}{middle}{head}{}%
+ \sls@@renewplainelement{even}{left}{head}{}%
+ \sls@@renewplainelement{even}{right}{head}{}%
+ \sls@@renewplainelement{even}{middle}{head}{}%
+ \sls@@renewplainelement{odd}{left}{foot}{}%
+ \sls@@renewplainelement{odd}{right}{foot}{}%
+ \sls@@renewplainelement{odd}{middle}{foot}{}%
+ \sls@@renewplainelement{even}{left}{foot}{}%
+ \sls@@renewplainelement{even}{right}{foot}{}%
+ \sls@@renewplainelement{even}{middle}{foot}{}%
+ }%
+}
+\scrlayerAddToInterface\clearscrplain{%
+ \let\clearscrplain\clearplainofpairofpagestyles
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \clearscrplain
+% \end{macro}^^A \clearplainofpairofpagestyles
+% \begin{macro}{\clearpairofpagestyles}
+% \begin{macro}{\clearscrheadfoot}
+% Last but not least we clean up both, the main and the plain:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\clearpairofpagestyles{%
+ \newcommand*{\clearpairofpagestyles}{%
+ \ihead[]{}\chead[]{}\ohead[]{}\ifoot[]{}\cfoot[]{}\ofoot[]{}%
+ }%
+}
+\scrlayerAddToInterface\clearscrheadfoot{%
+ \let\clearscrheadfoot\clearpairofpagestyles
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \clearscrheadfoot
+% \end{macro}^^A \clearpairofpagestyles
+%
+% \begin{macro}{\ps@useheadings}
+% Not longer supported:
+% \begin{macrocode}
+%<*body>
+\scrlayerAddToInterface\ps@useheadings{%
+ \newcommand*\ps@useheadings{%
+ \PackageWarning{scrlayer-scrpage}{incompatible page style!\MessageBreak
+ Page styles like `headings' and `plain'\MessageBreak
+ are incompatible with the page styles\MessageBreak
+ of scrlayer-scrpage. You shouldn't mix\MessageBreak
+ them up. Therefore page style\MessageBreak
+ `useheadings' is not longer provided.\MessageBreak
+ Usage is deprecated and will be replaced\MessageBreak
+ by `scrheadings'%
+ }%
+ \let\ps@useheadings\ps@scrheadings
+ \ps@useheadings
+ }%
+}
+\scrlayerAddCsToInterface{ps@plain.useheadings}{%
+ \@namedef{ps@plain.useheadings}{\@nameuse{ps@plain.scrheadings}}%
+}
+%</body>
+% \end{macrocode}
+% \end{macro}^^A \ps@useheadings
+%
+% \iffalse^^A meta-comment
+%</interface>
+% \fi^^A meta-comment
+%
+% \Finale
+% \let\subsection\section
+% \let\section\chapter
+% \let\chapter\restorechapter
+%
+\endinput
+%
+% end of file `scrlayer.dtx'
+
+%%% Local Variables:
+%%% mode: doctex
+%%% mode: flyspell
+%%% ispell-local-dictionary: "en_GB"
+%%% TeX-master: t
+%%% End: