% \iffalse^^A meta-comment
% ======================================================================
% scrlayer-scrpage.dtx
% Copyright (c) Markus Kohm, 2012-2023
%
% 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.md.
% ======================================================================
%%% From File: $Id: scrlayer-scrpage.dtx 4032 2023-04-17 09:45:11Z kohm $
%%%% (run: identify)
%%%% (run: init)
%%%% (run: options)
%%%% (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: 2023-04-17 11:45:11 +0200 (Mo, 17. Apr 2023) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 4032 $
\edef\reserved@a{%
\noexpand\endgroup
\noexpand\ProvidesFile{scrlayer-scrpage.dtx}%
[\filedate\space\filerevision\space
KOMA-Script package source
}%
\reserved@a
%
%<*identify>
%\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%\ProvidesPackage{scrlayer-scrpage}[%
%!KOMAScriptVersion
% package
%
%<*dtx|identify>
(end user interface for scrlayer)]
%
%<*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,scrpage,identify}%
\from{scrlayer.dtx}{interface,scrpage,init}%
\from{scrlayer-scrpage.dtx}{interface,scrpage,init}%
\from{scrlayer.dtx}{interface,scrpage,options}%
\from{scrlayer-scrpage.dtx}{interface,scrpage,options}%
\from{scrlayer.dtx}{interface,scrpage,body}%
\from{scrlayer-scrpage.dtx}{interface,scrpage,body}%
\from{scrlogo.dtx}{logo}%
}%
}
\@@input scrstrop.inc
\else
\let\endbatchfile\relax
\fi
\endbatchfile
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\setcounter{StandardModuleDepth}{2}
% We need (foo,bar)
\DeclareRobustCommand*{\pparg}[2]{\texttt(\meta{#1}\texttt,\meta{#2}\texttt)}
% and {foo:bar}
\DeclareRobustCommand*{\mmarg}[2]{%
\texttt{\char`\{}\meta{#1}\texttt:\meta{#2}\texttt{\char`\}}}
\begin{document}
\DocInput{scrlayer-scrpage.dtx}
\end{document}
%
% \fi^^A meta-comment
%
% \changes{v0.0}{2012/01/01}{start of interface}
% \changes{v3.32}{2020/09/11}{do not use deprecated interface commands}
% \changes{v3.36}{2022/02/09}{switch over from \cls*{scrdoc} to
% \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/02/09}{require package \pkg*{scrlogo} instead of
% defining \cs{KOMAScript}}
% \changes{v3.36}{2022/02/09}{whole implementation documentation in English}
% \changes{v3.40}{2023/04/17}{guide names changed}
%
% \GetFileInfo{scrlayer-scrpage.dtx}
% \title{The \texttt{scrlayer} Interface of
% \href{https://komascript.de}{\KOMAScript} Package \pkg*{scrlayer-scrpage}}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
% This package defines several extensions above \pkg*{scrlayer} for easy
% handling of pairs of \emph{headings} and \emph{plain} page styles. So this
% widely is a replacement of the not any longer supported, former
% \KOMAScript{} package \pkg{scrpage2}.
% \end{abstract}
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user manuals of \pkg*{scrlayer-scrpage} in the
% \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
% English \file{scrguide-en.pdf}.
%
% \MaybeStop{\PrintIndex}
%
%
% \section{Implementation of \pkg*{scrlayer-scrpage}}
% \label{sec:scrlayer-scrpage}
%
% This section if for developers only.
%
% \begin{macrocode}
%<*interface>
% \end{macrocode}
%
%
% \subsection{Initialising some values before the options}
%
% \begin{macrocode}
%<*init>
% \end{macrocode}
%
% Initialisation before all options (even the options from
% \file{scrlayer.dtx}).
%
% Currently nothing to do.
%
% \begin{macrocode}
%
% \end{macrocode}
%
%
% \subsection{Options}
%
% \begin{macrocode}
%<*options>
% \end{macrocode}
%
% Package \pkg{scrpage2} didn't support \KOMAScript{} options but only
% regular \LaTeX{} package options. This 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 \opt{headinclude}, \opt{headexclude}, \opt{footinclude} and
% \opt{footexclude} of package \pkg{scrpage2} are deprecated since
% package version 2.3, 2008-12-08. They won't be supported by the
% \pkg*{scrlayer-scrpage} interface.
%
% Additional initialisation may be done here, but currently this isn't
% needed.
%
% \begin{macrocode}
%
% \end{macrocode}
%
%
% \subsection{Width of header and footer}
%
% \pkg{scrpage2} provided commands \cs{setheadwidth} and \cs{setfootwidth} to
% set the width of the page head or footer different from the width of the
% text area of the page. Optionally those commands allow to setup an
% horizontal offset for the head or footer. This interface provides the same
% feature but prefers 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}
% \changes{v3.17}{2015/02/25}{new: store the values}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage
% commands removed}
% \begin{option}{footwidth}
% \changes{v0.9.1757}{2014/04/09}{new: two offsets available}
% \changes{v3.15}{2014/12/28}{fix: missing colon in call of
% \cs{sls@split@at@iicolons}}
% \changes{v3.17}{2015/02/25}{new: store the values}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage
% commands removed}
% \begin{description}
% \item[\texttt{=\meta{special dimensional expression}:\meta{special
% dimensional expression}}:] see \cs{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
}
\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
}
% \end{macrocode}
% \begin{macro}{\sls@split@at@iicolons}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \begin{description}
% \item[\texttt{\meta{balanced}:\meta{balanced}:\meta{balanced}\cs{@nil}}:]
% first \meta{balanced} will be stored into \cs{reserved@a}, second into
% \cs{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 \opt{headwidth} and
% \opt{footwidth}.
% \begin{macrocode}
\newcommand\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}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \begin{description}
% \item[\marg{head or foot}:] to complete the macro names for page head or
% footer, either \texttt{head} or \texttt{foot}.
% \item[\marg{special dimensional expression}:] the offset odd page
% \item[\marg{special dimensional expression}:] the offset even page
% \item[\marg{special dimensional expression}:] the width
% \end{description}
% This helper will generally set up width an offset of either head or footer.
% \begin{macrocode}
\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
% \end{macrocode}
% \changes{3.39}{2023/02/02}{offset depends on \cs{reversemarginpar}}
% \begin{macrocode}
\if@reversemargin
\setlength{\@tempdimb}{-\dimexpr \marginparwidth+\marginparsep\relax}%
\else
\setlength{\@tempdimb}{\z@}%
\fi
\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,\sls@oddheadshift,\sls@evenheadshift,
% \sls@footwidth,\sls@oddfootshift,\sls@evenfootshift}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage
% commands removed}
% 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}
\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}%
}%
\newcommand*{\sls@oddheadshift}{0pt}
\newcommand*{\sls@evenheadshift}{0pt}
\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}
}%
\newcommand*{\sls@oddfootshift}{0pt}
\newcommand*{\sls@evenfootshift}{0pt}
% \end{macrocode}
% \end{macro}^^A \sls@headwidth … \sls@evenfootshift
%
% \begin{macro}{\sls@settowidthof,\sls@deftowidthof}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% 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}
\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}%
}%
}%
}%
}%
}%
}%
}%
}%
}%
}%
}%
}%
\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}%
}%
}%
}%
%
% \end{macrocode}
% \end{macro}^^A \sls@deftowidthof,\sls@settowidthof
% \end{option}^^A footwidth
% \end{option}^^A footheight
%
% \begin{command}{\setheadwidth,\setfootwidth}
% \changes{v3.36}{2022/02/09}{warning about deprecated command}
% For compatibility with \pkg{scrpage2}, map the commands to the options:
% \begin{macrocode}
%<*body>
\newcommand*{\setheadwidth}[2][]{%
\PackageWarning{scrlayer-scrpage}{%
Command `\string\setheadwidth' is deprecated.\MessageBreak
I'm using \detokenize{\KOMAoptions{headwidth=#2:#1}} instead,\MessageBreak
and so should you do}%
\KOMAoptions{headwidth=#2:#1}%
}%
\newcommand*{\setfootwidth}[2][]{%
\PackageWarning{scrlayer-scrpage}{%
Command `\string\setfootwidth' is deprecated.\MessageBreak
I'm using \detokenize{\KOMAoptions{footwidth=#2:#1}} instead,\MessageBreak
and so should you do}%
\KOMAoptions{footwidth=#2:#1}%
}%
%
% \end{macrocode}
% \end{command}^^A \setheadwidth,\setfootwidth
%
%
% \subsection{Lines in page head and footer}
%
% The interface implements the options \opt{headtopline}, \opt{headsepline},
% \opt{footsepline}, \opt{footbotline}, \opt{plainheadtopline},
% \opt{plainheadsepline}, \opt{plainfootsepline}, \opt{plainfootbotline},
% \opt{ilines}, \opt{clines}, and \opt{olines}, the commands
% \cs{setheadtopline}, \cs{setheadsepline}, \cs{setfootsepline}, and
% \cs{setfootbotline}, and the corresponding \KOMAScript{} font elements of
% package \pkg{scrpage2}. Some of the options are extended to understand
% values.
%
% \begin{option}{headtopline,headsepline,footsepline,footbotline}
% \changes{v3.17}{2015/02/25}{new: store the values}
% \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[\opt{headtopline}:] the top margin of the page and the page head.
% \item[\opt{headsepline}:] the page head and the text area.
% \item[\opt{footsepline}:] the text area and the page footer.
% \item[\opt{footbotline}:] the page footer and the bottom margin.
% \end{description}
% Both \meta{dimensional expression} 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}%
}
\KOMA@key{headsepline}[:]{%
\sls@set@values[headsepline]{head}{below}{#1}%
}
\KOMA@key{footsepline}[:]{%
\sls@set@values[footsepline]{foot}{above}{#1}%
}
\KOMA@key{footbotline}[:]{%
\sls@set@values[footbotline]{foot}{below}{#1}%
}
% \end{macrocode}
% \begin{macro}{\sls@set@values}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage
% commands removed}
% \begin{description}
% \item[\oarg{option name}:] either empty or the name of the option that sets
% the line,
% \item[\marg{head or foot}:] either \texttt{head} or \texttt{foot},
% \item[\marg{above or below}:] either \texttt{above} or \texttt{below},
% \item[\mmarg{dimension expression}{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}
\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}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \begin{description}
% \item[\texttt{\meta{balanced}:\meta{balanced}:\meta{balanced}\cs{@nil}}:]
% first \meta{balanced} will be stored into \cs{reserved@a}, second into
% \cs{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 \opt{headwidth} and
% \opt{footwidth}.
% \begin{macrocode}
\newcommand*{\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,\sls@headabove@linethickness,
% \sls@headbelow@linelength,\sls@headbelow@linethickness,
% \sls@footabove@linelength,\sls@footabove@linethickness,
% \sls@footbelow@linelength,\sls@footbelow@linethickness}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage
% commands removed}
% 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}
\newcommand*{\sls@headabove@linelength}{\sls@headwidth}%
\newcommand*{\sls@headabove@linethickness}{0pt}%
\KOMA@kav@xadd{scrlayer-scrpage.sty}{headtopline}{%
\expandafter\noexpand\sls@headabove@linethickness:%
\expandafter\noexpand\sls@headabove@linelength
}
\newcommand*{\sls@headbelow@linelength}{\sls@headwidth}%
\newcommand*{\sls@headbelow@linethickness}{0pt}%
\KOMA@kav@xadd{scrlayer-scrpage.sty}{headsepline}{%
\expandafter\noexpand\sls@headbelow@linethickness:%
\expandafter\noexpand\sls@headbelow@linelength
}
\newcommand*{\sls@footabove@linelength}{\sls@footwidth}%
\newcommand*{\sls@footabove@linethickness}{0pt}%
\KOMA@kav@xadd{scrlayer-scrpage.sty}{footsepline}{%
\expandafter\noexpand\sls@footabove@linethickness:%
\expandafter\noexpand\sls@footabove@linelength
}
\newcommand*{\sls@footbelow@linelength}{\sls@footwidth}%
\newcommand*{\sls@footbelow@linethickness}{0pt}%
\KOMA@kav@xadd{scrlayer-scrpage.sty}{footbotline}{%
\expandafter\noexpand\sls@footbelow@linethickness:%
\expandafter\noexpand\sls@footbelow@linelength
}
%
% \end{macrocode}
% \end{macro}^^A \sls@headabove@linelength … \sls@footbelow@linethickness
% \end{option}^^A headtopline … footbotline
%
% \begin{option}{plainheadtopline,plainheadsepline,
% plainfootsepline,plainfootbotline}
% \begin{macro}{\ifsls@plain@head@above@line,\sls@plain@head@above@linetrue,
% \sls@plain@head@above@linefalse,
% \ifsls@plain@head@below@line,\sls@plain@head@below@linetrue,
% \sls@plain@head@below@linefalse,
% \ifsls@plain@foot@above@line,\sls@plain@foot@above@linetrue,
% \sls@plain@foot@above@linefalse,
% \ifsls@plain@foot@below@line,\sls@plain@foot@below@linetrue,
% \sls@plain@foot@below@linefalse}
% \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>
\KOMA@ifkey{plainheadtopline}{sls@plain@head@above@line}%
\KOMA@ifkey{plainheadsepline}{sls@plain@head@below@line}%
\KOMA@ifkey{plainfootsepline}{sls@plain@foot@above@line}%
\KOMA@ifkey{plainfootbotline}{sls@plain@foot@below@line}%
%
% \end{macrocode}
% \end{macro}^^A \ifsls@plain@foot@below@line … \sls@plain@foot@below@linefalse
% \end{option}^^A plainheadtopline … plainfootbotline
%
% \begin{option}{ilines,clines,olines}
% \changes{v3.17}{2015/02/25}{storing values}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage
% commands removed}
% \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 \pkg{scrpage2} supports only these
% options. At least we can set the options inside a layer or page style. This
% may help.
% \begin{macrocode}
%<*options>
\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
}
\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
}
\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
}
\KOMA@kav@add{scrlayer-scrpage.sty}{ilines}{}
%
% \end{macrocode}
% \end{macro}^^A \sls@hfline@adjust
% \end{option}^^A ilines … olines
%
% \begin{command}{\setheadtopline,\setheadsepline,
% \setfootsepline,\setfootbotline}
% \begin{description}
% \item[\oarg{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[\marg{dimensional expression}:] the thickness of the line.
% \item[\oarg{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>
\newcommand*{\setheadtopline}{\sls@setline{head}{above}}%
\newcommand*{\setheadsepline}{\sls@setline{head}{below}}%
\newcommand*{\setfootsepline}{\sls@setline{foot}{above}}%
\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}}
% \begin{macro}{\sls@@setline}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \begin{macro}{\sls@@@setline}
% \changes{v3.17}[2015/02/27]{internal use of the corresponding options}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
% \cs{kernel@ifnextchar}}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \changes{v3.39}{2022/11/11}{initial dot in member argument of
% \cs{KOMAExecuteOptions} removed}
% \begin{macro}{\sls@@@@setline}
% \changes{v3.18}{2015/06/17}{explicit reuse of the current length}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Helper to set up the line attributes processing the parameters of the
% commands above.
% \begin{macrocode}
\newcommand*\sls@setline[2]{%
\kernel@ifnextchar[%]
{\sls@@setline{#1}{#2}}{\sls@@@setline{#1#2}}%
}%
\newcommand*{\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}%
}%
\newcommand*{\sls@@@setline}[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
`:' 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}%
}{%
}%
}%
\newcommand*{\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{fontelement}{headtopline,headsepline,footsepline,footbotline}
% These are the font elements used in \cs{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}{%
\newkomafont{headtopline}{}%
}{}
\@ifundefined{scr@fnt@headsepline}{%
\newkomafont{headsepline}{}%
}{}
\@ifundefined{scr@fnt@footsepline}{%
\newkomafont{footsepline}{}%
}{}
\@ifundefined{scr@fnt@footbotline}{%
\newkomafont{footbotline}{}%
}{}
%