summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/scrkernel-pagestyles.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/koma-script/scrkernel-pagestyles.dtx')
-rw-r--r--macros/latex/contrib/koma-script/scrkernel-pagestyles.dtx785
1 files changed, 785 insertions, 0 deletions
diff --git a/macros/latex/contrib/koma-script/scrkernel-pagestyles.dtx b/macros/latex/contrib/koma-script/scrkernel-pagestyles.dtx
new file mode 100644
index 0000000000..33a5f6a6cf
--- /dev/null
+++ b/macros/latex/contrib/koma-script/scrkernel-pagestyles.dtx
@@ -0,0 +1,785 @@
+% \iffalse meta-comment
+% ======================================================================
+% scrkernel-pagestyles.dtx
+% Copyright (c) Markus Kohm, 2002-2022
+%
+% This file is part of the LaTeX2e KOMA-Script bundle.
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, version 1.3c of the license.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later and of this work.
+%
+% This work has the LPPL maintenance status "author-maintained".
+%
+% The Current Maintainer and author of this work is Markus Kohm.
+%
+% This work consists of all files listed in MANIFEST.md.
+% ======================================================================
+%%% From File: $Id: scrkernel-pagestyles.dtx 3874 2022-06-05 10:38:02Z kohm $
+%<option>%%% (run: option)
+%<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: 2022-06-05 12:38:02 +0200 (So, 05. Jun 2022) $
+ \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
+ \filerevision$Revision: 3874 $
+ \edef\reserved@a{%
+ \noexpand\endgroup
+ \noexpand\ProvidesFile{scrkernel-pagestyles.dtx}%
+ [\filedate\space\filerevision\space
+ KOMA-Script source
+ (page styles)]
+ }%
+\reserved@a
+\documentclass[USenglish]{koma-script-source-doc}
+\usepackage{babel}
+\setcounter{StandardModuleDepth}{3}
+\begin{document}
+\DocInput{scrkernel-pagestyles.dtx}
+\end{document}
+%</dtx>
+% \fi
+%
+% \changes{v2.95}{2002/06/25}{first version after splitting \file{scrclass.dtx}}
+% \changes{v3.36}{2022/03/05}{switch over from \cls*{scrdoc} to
+% \cls*{koma-script-source-doc}}
+% \changes{v3.36}{2022/03/05}{whole implementation documentation in English}
+%
+% \GetFileInfo{scrkernel-pagestyles.dtx}
+% \title{The Code of the Default Page Styles of the
+% \href{https://komascript.de}{\KOMAScript} Classes}
+% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
+% \date{Revision \fileversion{} of \filedate}
+% \maketitle
+% \begin{abstract}
+% \file{scrkernel-pagestyles.dtx} provides the default page styles of the
+% \KOMAScript{} classes. As already told decades ago, there are plans to
+% remove this code and to require the \KOMAScript{} page style
+% package---namely \pkg*{scrlayer-scrpage}---instead.
+% \end{abstract}
+% \tableofcontents
+%
+% \section{User Manual}
+%
+% You can find the user documentation the commands implemented here in the
+% \KOMAScript{} manual, either the German \file{scrguide} or the English
+% \file{scrguien}.
+%
+% \MaybeStop{\PrintIndex}
+%
+% \section{Implementation of the Page Styles of the \KOMAScript{} Classes}
+%
+% \begin{macrocode}
+%<*class>
+% \end{macrocode}
+%
+% \subsection{Options for the separation lines in page head and footer}
+%
+% \begin{option}{headsepline}
+% \changes{v2.95c}{2006/08/11}{arguments of \cs{PassOptonsToPackage} fixed}
+% \changes{v2.97c}{2007/04/19}{don't pass \opt{headinclude} to \pkg*{typearea}}
+% \changes{v2.98c}{2008/03/26}{set \opt{headinclude}}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
+% \changes{v3.12}{2013/03/05}{if \pkg*{typearea} has not been loaded, pass
+% option to the package}
+% \changes{v3.17}{2015/03/10}{using value storage}
+% \changes{v3.18a}{2015/07/08}{arguments of \cs{PassOptionsToPackage} fixed
+% again}
+% \changes{v3.20}{2015/12/12}{don't pass option to \pkg*{typearea}}
+% \begin{macro}{\@hslfalse,\@hsltrue,\if@hsl}
+% Optional separation line between page head and text area---in other words:
+% below the page head.
+% \begin{macrocode}
+%<*option>
+\KOMA@ifkey{headsepline}{@hsl}%
+\KOMA@kav@add{.\KOMAClassFileName}{headsepline}{false}
+% \end{macrocode}
+% \begin{option}{headnosepline}
+% \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
+% \cs{PackageInfoNoLine}}
+% \changes{v3.01a}{2008/11/20}{deprecated}
+% \begin{macrocode}
+\KOMA@DeclareDeprecatedOption{headnosepline}{headsepline=false}
+% \end{macrocode}
+% \end{option}^^A headnosepline
+% \end{macro}^^A \if@hsl
+% \end{option}^^A headsepline
+%
+%
+% \begin{option}{footsepline}
+% \changes{v2.0e}{1994/08/14}{missing package at \cs{PassOptionsToPackage}
+% added}
+% \changes{v2.95c}{2006/08/11}{arguments of \cs{PassOptionsToPackage} fixed}
+% \changes{v2.97c}{2007/04/19}{don't pass \opt{footinclude} to
+% \pkg*{typearea}}
+% \changes{v2.98c}{2008/03/26}{set \opt{footinclude}}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
+% \changes{v3.12}{2013/03/05}{if \textsf{typearea} has not been loaded, pass
+% option to package}
+% \changes{v3.12}{2013/08/26}{\cs{KOMA@options} replaced by \cs{KOMAoptions}}
+% \changes{v3.12}{2013/08/26}{recalculation of typing area}
+% \changes{v3.13}{2014/07/07}{no recalculation of typing area}
+% \changes{v3.13}{2014/07/07}{\opt{headinclude} mistake fixed}
+% \changes{v3.17}{2015/03/10}{using value storage}
+% \changes{v3.18a}{2015/07/08}{arguments of \cs{PassOptionsToPackage} fixed
+% again}
+% \changes{v3.20}{2015/12/12}{don't pass option to \pkg*{typearea}}
+% \begin{macro}{\@fslfalse,\@fsltrue,\if@fsl}
+% Optional separation line between text area and page footer---in other words:
+% above the page footer.
+% \begin{macrocode}
+\KOMA@ifkey{footsepline}{@fsl}%
+\KOMA@kav@add{.\KOMAClassFileName}{footsepline}{false}
+% \end{macrocode}
+% \begin{option}{footnosepline}
+% \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
+% \cs{PackageInfoNoLine}}
+% \changes{v3.01a}{2008/11/20}{deprecated}
+% \begin{macrocode}
+\KOMA@DeclareDeprecatedOption{footnosepline}{footsepline=false}
+%</option>
+% \end{macrocode}
+% \end{option}^^A footnosepline
+% \end{macro}^^A \if@fsl
+% \end{option}^^A footsepline
+%
+% \begin{option}{mpinclude}
+% \changes{v2.95}{2002/07/08}{moved to \pkg*{typearea}}
+% \end{option}{mpinclude}
+%
+%
+% \subsection{Definition of the standard page styles}
+%
+%
+% \begin{pgstyle}{plain,myheadings,headings}
+% \changes{v2.0e}{1994/08/10}{\cls*{scrbook} does not provide single-side page
+% styles}
+% \changes{v2.0e}{1994/08/17}{in single-side mode \cs{markboth} replaced by
+% \cs{markright}}
+% \changes{v2.1b}{1994/12/31}{in single-side mode \cs{markboth} replaced by
+% \cs{markright}}
+% \changes{v2.2a}{1995/02/07}{dot after section number in \cls*{scrbook} and
+% \cls*{scrreprt} removed}
+% \changes{v2.2a}{1995/02/07}{using \cs{subsectionmark} in single-side mode
+% with \cls*{scrartcl}}
+% \changes{v2.2a}{1995/02/07}{using \cs{sectionmark} in single-side mode with
+% \cls*{scrreprt}}
+% \changes{v2.2c}{1995/05/25}{dot after chapter number removed}
+% \changes{v2.2c}{1995/05/25}{numbers in running heads support CJK format
+% extension}
+% \changes{v2.3a}{1995/07/08}{because \cls{book} from version 1.2v provides
+% option \opt{oneside} single-side page styles added to \cls*{scrbook}}
+% \changes{v2.4f}{1996/10/08}{\cs{strut} added to page head}
+% \changes{v2.97c}{2007/07/18}{distinguish \opt{twoside} as late as possible}
+% \changes{v3.08}{2010/10/28}{\cs{noindent} added before usage of variable
+% \var{nexthead} or \var{nextfoot}}
+% \changes{v3.10}{2011/08/31}{using \cs{MakeMarkcase}}
+% \changes{v3.28}{2019/11/19}{\cs{ifnumbered} renamed to \cs{Ifnumbered}}
+% In difference to the standard classes, the \KOMAScript{} classes use
+% pagination in the page footer for all page styles. Also an optional
+% separation line below the page head and above the page footer is
+% supported. The ugly usage of pool man's upper case for the running head of
+% the standard classes is also not used, but optional.
+% \begin{macro}{\set@tempdima@hw}
+% \changes{v2.8q}{2002/03/28}{added}
+% Because with \pkg*{typearea} option \opt{mpinclude} the head should be
+% extended to the margin note column, \cs{set@tempdima@hw} sets
+% \len{@tempdima} to the corresponding head width.
+% \begin{description}
+% \item[Note:] Package \pkg*{scrlayer} does not use this code, but allows
+% to configure the width of head and foot independent, which is much
+% better.
+% \end{description}
+% \begin{macrocode}
+%<*body>
+\newcommand*{\set@tempdima@hw}{%
+ \setlength{\@tempdima}{\textwidth}%
+ \if@mincl
+ \addtolength{\@tempdima}{\marginparsep}%
+ \addtolength{\@tempdima}{\marginparwidth}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}^^A \set@tempdima@hw
+% \begin{fontelement}{pagenumber}
+% \changes{v2.8o}{2001/09/14}{added}
+% \begin{fontelement}{pagination}
+% \changes{v2.8o}{2001/09/14}{alias added}
+% \begin{fontelement}{pageheadfoot}
+% \changes{v2.98c}{2008/02/14}{added}
+% \begin{fontelement}{pagehead}
+% \changes{v2.8o}{2001/09/14}{added with warning added}
+% \changes{v2.98c}{2008/02/14}{changed to alias}
+% \changes{v2.97c}{2007/09/25}{warning changed}
+% \changes{v2.98c}{2008/02/14}{warning changed}
+% \begin{fontelement}{pagefoot}
+% \changes{v2.8o}{2001/09/14}{alias with warning added}
+% \changes{v2.98c}{2008/02/14}{changed to element}
+% \changes{v3.13}{2014/01/13}{warning changed}
+% \begin{macro}{\pnumfont,\headfont}
+% \changes{v2.8c}{2001/06/29}{\cs{normalcolor} added}
+% \begin{macro}{\footfont}
+% \changes{v2.98c}{2008/02/14}{added}
+% All these font settings are deprecated as user commands, but still valid as
+% internal macros, used to define font elements. Because of using the old
+% macros, we have to define elements manually instead of using \cs{newkomafont}.
+% \begin{macrocode}
+\newcommand*{\pnumfont}{\normalfont\normalcolor}
+\newcommand*{\headfont}{\normalfont\normalcolor\slshape}
+\newcommand*{\footfont}{}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\scr@fnt@pagenumber}{\pnumfont}
+\aliaskomafont{pagination}{pagenumber}
+\newcommand*{\scr@fnt@pageheadfoot}{\headfont}
+\aliaskomafont{pagehead}{pageheadfoot}
+%<*letter>
+\newcommand*{\scr@fnt@wrn@pagehead}[1]{%
+ `pagehead' is only an alias of `pageheadfoot'.\MessageBreak
+ Font of page foot will also be changed%
+}
+\newcommand*{\scr@fnt@pagefoot}{\footfont}
+%</letter>
+%<*!letter>
+\newcommand*{\scr@fnt@pagefoot}{\footfont}
+\newcommand*{\scr@fnt@wrn@pagefoot}[1]{%
+ This class does not use font element `pagefoot'!\MessageBreak
+ Maybe you should load package `scrlayer-scrpage',\MessageBreak
+ before using this element%
+}
+%</!letter>
+% \end{macrocode}
+% \end{macro}^^A \footfont
+% \end{macro}^^A \pnumfont,\headfont
+% \end{fontelement}^^A pagefoot
+% \end{fontelement}^^A pagehead
+% \end{fontelement}^^A pageheadfoot
+% \end{fontelement}^^A pagination
+% \end{fontelement}^^A pagenumber
+%
+% \begin{command}{\pagemark}
+% \changes{v2.95}{2006/03/15}{available for all classes}
+% \changes{v3.05}{2010/02/05}{group added}
+% \begin{command}{\letterpagemark}
+% \changes{v3.17}{2015/03/20}{added for \pkg*{scrletter}}
+% The pagination used by all classes. Originally this has been defined to
+% simplify usage of \pkg{fancyhdr} (instead of
+% \pkg[https://www.ctan.org/pkg/koma-script-obsolete]{scrpage2}), because in
+% this case you just have to use \cs{pagemark} instead of \cs{thepage} in the
+% definitions of the fancy page style to support \KOMAScript. But neither the
+% author nor the users of \pkg{fancyhdr} have used it. However, now it is
+% useful for \pkg{scrlayer-scrpage} too. And because we use another pagination
+% for letters, we define a second command for \pkg*{scrletter}.
+% \begin{macrocode}
+%</body>
+%</class>
+%<*(class|letter)&body>
+\newcommand*{%
+%<class> \pagemark
+%<package> \letterpagemark
+}{%
+ {\usekomafont{pagenumber}{%
+%<letter> \pagename\nobreakspace
+ \thepage}}}
+%</(class|letter)&body>
+% \end{macrocode}
+% \end{command}^^A \letterpagemark
+% \end{command}^^A \pagemark
+% First of all we have to define the page styles of all classes but the letter
+% class.
+% \begin{macrocode}
+%<*class&!letter&body>
+\renewcommand*{\ps@plain}{%
+ \renewcommand*{\@oddhead}{}%
+ \let\@evenhead\@oddhead
+ \renewcommand*{\@evenfoot}{%
+ \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
+ \if@fsl \hrule \vskip 3\p@ \fi
+ \hb@xt@ \@tempdima{{\pagemark\hfil}}}}}%
+ \renewcommand*{\@oddfoot}{%
+ \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
+ \if@fsl \hrule \vskip 3\p@ \fi
+ \hb@xt@ \@tempdima{{\hfil\pagemark
+ \if@twoside\else\hfil\fi}}}}\hss}%
+}%
+\newcommand*{\ps@headings}{\let\@mkboth\markboth
+ \renewcommand*{\@evenhead}{%
+ \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
+ \hb@xt@ \@tempdima{{\headfont\strut\leftmark\hfil}}%
+ \if@hsl \vskip 1.5\p@ \hrule \fi}}}%
+ \renewcommand*{\@oddhead}{%
+ \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
+ \hb@xt@ \@tempdima{{\headfont\hfil\strut\rightmark
+ \if@twoside\else\hfil\fi}}%
+ \if@hsl \vskip 1.5\p@ \hrule \fi}}\hss}%
+ \renewcommand*{\@evenfoot}{%
+ \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
+ \if@fsl \hrule \vskip 3\p@ \fi
+ \hb@xt@ \@tempdima{{\pagemark\hfil}}}}}%
+ \renewcommand*{\@oddfoot}{%
+ \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
+ \if@fsl \hrule \vskip 3\p@ \fi
+ \hb@xt@ \@tempdima{{\hfil\pagemark
+ \if@twoside\else\hfil\fi}}}}\hss}%
+%<*article>
+ \renewcommand*{\sectionmark}[1]{%
+ \if@twoside\expandafter\markboth\else\expandafter\markright\fi
+ {\MakeMarkcase{\Ifnumbered{section}{\sectionmarkformat}{}##1}}{}}%
+ \renewcommand*{\subsectionmark}[1]{%
+ \if@twoside
+ \markright{%
+ \MakeMarkcase{\Ifnumbered{subsection}{\subsectionmarkformat}{}##1}%
+ }%
+ \fi
+ }%
+%</article>
+%<*report|book>
+ \renewcommand*{\chaptermark}[1]{%
+ \if@twoside\expandafter\markboth\else\expandafter\markright\fi
+ {\MakeMarkcase{\Ifnumbered{chapter}{%
+%<book> \if@mainmatter
+ \chaptermarkformat
+%<book> \fi
+ }{}##1}%
+ }{}%
+ }%
+ \renewcommand*{\sectionmark}[1]{%
+ \if@twoside
+ \markright{\MakeMarkcase{\Ifnumbered{section}{\sectionmarkformat}{}%
+ ##1}}%
+ \fi
+ }%
+%</report|book>
+}%
+\newcommand*{\ps@myheadings}{\let\@mkboth\@gobbletwo
+ \renewcommand*{\@evenhead}{%
+ \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
+ \hb@xt@ \@tempdima{{\headfont\strut\leftmark\hfil}}%
+ \if@hsl \vskip 1.5\p@ \hrule \fi}}}%
+ \renewcommand*{\@oddhead}{%
+ \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
+ \hb@xt@ \@tempdima{{\headfont\hfil\strut\rightmark
+ \if@twoside\else\hfil\fi}}%
+ \if@hsl \vskip 1.5\p@ \hrule \fi}}\hss}%
+ \renewcommand*{\@evenfoot}{%
+ \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
+ \if@fsl \hrule \vskip 3\p@ \fi
+ \hb@xt@ \@tempdima{{\pagemark\hfil}}}}}%
+ \renewcommand*{\@oddfoot}{%
+ \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
+ \if@fsl \hrule \vskip 3\p@ \fi
+ \hb@xt@ \@tempdima{{\hfil\pagemark
+ \if@twoside\else\hfil\fi}}}}\hss}%
+%<!article> \renewcommand*{\chaptermark}[1]{}%
+%<article> \renewcommand*{\subsectionmark}[1]{}%
+ \renewcommand*{\sectionmark}[1]{}%
+}
+%</class&!letter&body>
+% \end{macrocode}
+% And now the page styles of the letter class.
+% \begin{macrocode}
+%<*class&letter&body>
+\renewcommand*{\ps@plain}{%
+ \renewcommand*{\@oddhead}{%
+ \vbox{\vbox{\hsize=\textwidth\hbox to\textwidth{%
+ \parbox[b]{\textwidth}{\strut
+ \ifnum\@pageat>-1
+ \ifnum\@pageat<3
+ \ifcase\@pageat\raggedright\or\centering\or\raggedleft\fi
+ \pagemark
+ \else
+ \hfill
+ \fi
+ \else
+ \hfill
+ \fi
+ }%
+ }%
+ \if@hsl\kern1pt\rule{\textwidth}{.4pt}\fi
+ }%
+ }%
+ }%
+ \let\@evenhead\@oddhead%
+ \renewcommand*{\@oddfoot}{%
+ \parbox[t]{\textwidth}{%
+ \if@fsl
+ {%
+ \raggedright%
+ \vskip-\baselineskip\vskip.4pt
+ \hrulefill\\
+ }%
+ \fi
+ \ifnum\@pageat>2
+ \ifcase\@pageat\or\or\or\raggedright\or\centering\or\raggedleft\fi
+ \strut\pagemark
+ \else
+ \hfill
+ \fi
+ }%
+ }%
+ \let\@evenfoot\@oddfoot
+}
+\newcommand*{\ps@headings}{\let\@mkboth\markboth
+ \renewcommand*{\@oddhead}{%
+ \vbox{%
+ \vbox{\hsize=\textwidth\hbox to\textwidth{\headfont\noindent
+ \usekomavar{nexthead}}}%
+ \if@hsl\kern1pt\rule{\textwidth}{.4pt}\fi%
+ }%
+ }%
+ \let\@evenhead\@oddhead
+ \renewcommand*{\@oddfoot}{%
+ \parbox[t]{\textwidth}{%
+ \if@fsl
+ {%
+ \raggedright%
+ \vskip-\baselineskip\vskip.4pt
+ \hrulefill\\
+ }%
+ \fi
+ \vbox{\hsize=\textwidth\hbox to\textwidth{\headfont\footfont\noindent
+ \usekomavar{nextfoot}}}%
+ }%
+ }%
+ \let\@evenfoot\@oddfoot
+}
+\newcommand*{\ps@myheadings}{%
+ \ps@headings
+ \let\@mkboth\@gobbletwo
+}
+%</class&letter&body>
+% \end{macrocode}
+% The letter package already uses \pkg*{scrlayer-scrpage}:
+% \begin{macrocode}
+%<*package&letter&body>
+\RequirePackage{scrlayer-scrpage}
+\newpairofpagestyles{letter}{%
+ \clearpairofpagestyles
+ \lehead[\ifnum\@pageat=\z@\pagemark\fi]%
+ {\usekomavar{nexthead}}%
+ \lohead[\ifnum\@pageat=\z@\pagemark\fi]%
+ {\usekomavar{nexthead}}%
+ \chead[\ifnum\@pageat=\@ne\pagemark\fi]%
+ {}%
+ \rehead[\ifnum\@pageat=\tw@\pagemark\fi]%
+ {}%
+ \rohead[\ifnum\@pageat=\tw@\pagemark\fi]%
+ {}%
+ \lefoot[\ifnum\@pageat=\thr@@\pagemark\fi]%
+ {\usekomavar{nextfoot}}%
+ \lofoot[\ifnum\@pageat=\thr@@\pagemark\fi]%
+ {\usekomavar{nextfoot}}%
+ \cfoot[\ifnum\@pageat=4 \pagemark\fi]%
+ {}%
+ \refoot[\ifnum\@pageat=5 \pagemark\fi]%
+ {}%
+ \rofoot[\ifnum\@pageat=5 \pagemark\fi]%
+ {}%
+}
+%</package&letter&body>
+% \end{macrocode}
+% \end{pgstyle}^^A plain,myheadings,headings
+%
+% \begin{pgstyle}{notepaper}
+% \changes{v3.27}{2019/03/22}{plan added}
+% There are plans for \pkg*{scrletter} package to use a new layer
+% \texttt{notepaper} to define the notepaper. With this layer it is possible
+% to add several separated information blocks everywhere on the first
+% page. A \texttt{picture} mode layer is used, because this makes the
+% placement easier. It's a background layer, so the page contents are printed
+% above. We could also use an odd-side layer, but who knows \dots
+% \begin{macrocode}
+%<*package&letter&body&willbe>
+\DeclareNewLayer[%
+ background,
+ mode=picture,
+ page,
+ align=b,
+ contents=\scr@notepaper@printallelements
+]{notepaper}
+% \end{macrocode}
+% For \cs{scr@notepaper@elements} see \file{scrkernel-notepaper.dtx}.
+%
+% A second layer is used for the foldmarks. Again it is a picture layer. But
+% this time it is an odd-sides-only layer.
+% \begin{macrocode}
+\DeclareNewLayer[%
+ background,
+ mode=picture,
+ page,
+ align=b,
+ contents=\scr@foldmarks@printallelements
+]{foldmarks}
+% \end{macrocode}
+% For \cs{@hfoldmark} and \cs{@vfoldmark} see \file{scrkernel-notepaper.dtx}.
+%
+% Last but not least the page style. The foldmarks are below the notepaper.
+% \begin{macrocode}
+\DeclareNewPageStyleByLayers{notepaper}{foldmarks,notepaper}
+%</package&letter&body&willbe>
+% \end{macrocode}
+% \end{pgstyle}^^A notepaper
+%
+%
+% \subsection{Selection of page styles for special pages}
+%
+%
+% \begin{command}{\titlepagestyle,\indexpagestyle}
+% \changes{v2.8d}{2001/07/05}{added}
+% For pages with the in-page title and for the first page of the index,
+% \KOMAScript{} provides configurable page styles. These are initially
+% \pstyle{plain}.
+% \begin{macrocode}
+%<*class&!letter&body>
+\newcommand*{\titlepagestyle}{plain}
+\newcommand*{\indexpagestyle}{plain}
+%</class&!letter&body>
+% \end{macrocode}
+% \end{command}
+% \begin{command}{\partpagestyle}
+% \changes{v2.8d}{2001/07/05}{added}
+% \changes{v3.00}{2008/08/05}{not with \cls*{scrartcl}}
+% \changes{v3.18}{2015/06/10}{indirect by \cs{DeclareSectionCommand}}
+% \end{command}
+% \begin{command}{\chapterpagestyle}
+% \changes{v2.8d}{2001/07/05}{added}
+% \changes{v3.18}{2015/05/20}{indirect by \cs{DeclareSectionCommand}}
+% \end{command}
+%
+%
+% \subsection{Selection of initial page style}
+%
+% The initial page style depends on the class:
+% \begin{macrocode}
+%<*class&body>
+%<report|article|letter>\pagestyle{plain}
+%<book>\pagestyle{headings}
+% \end{macrocode}
+% But the pagination is always done using Arabic numbers.
+% \begin{macrocode}
+\pagenumbering{arabic}
+%</class&body>
+% \end{macrocode}
+%
+% \section{Implementation of Interleaf Pages}
+%
+% \begin{description}
+% \item[ToDo:] Move this code to a new file \file{scrkernel-interleaf.dtx}.
+% \end{description}
+%
+% \begin{option}{cleardoublepage}
+% \changes{v2.95}{2004/08/24}{added}
+% \changes{v2.96a}{2007/01/03}{value \opt{\quotechar=current} fixed}
+% \changes{v2.98c}{2008/03/06}{\cs{def} replaced by \cs{let}, because of
+% option \opt{open}}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
+% \changes{v3.17}{2015/03/10}{using value storage}
+% \changes{v3.37}{2022/05/10}{guard for \pkg*{scrextend} fixed}
+% \begin{command}{\cleardoublestandardpage}
+% \changes{v2.8a}{2001/06/18}{added}
+% \changes{v2.96a}{2007/01/02}{default value added}
+% \begin{command}{\cleardoubleusingstyle}
+% \changes{v2.95}{2004/08/24}{added}
+% \changes{v3.06a}{2010/09/17}{\cs{thispagestyle} replaced by
+% \cs{pagestyle}}
+% \begin{command}{\cleardoubleemptypage,\cleardoubleplainpage}
+% \changes{v2.8a}{2001/06/18}{added}
+% \begin{command}{\cleardoubleoddpage,\cleardoubleoddstandardpage}
+% \changes{v2.98c}{2008/03/06}{added}
+% \begin{command}{\cleardoubleoddusingstyle}
+% \changes{v2.98c}{2008/03/06}{added}
+% \changes{v3.06a}{2010/09/17}{\cs{thispagestyle} replaced by
+% \cs{pagestyle}}
+% \begin{command}{\cleardoubleoddemptypage,\cleardoubleoddplainpage}
+% \changes{v2.98c}{2001/06/18}{added}
+% \begin{command}{\cleardoubleevenpage,\cleardoubleevenstandardpage}
+% \changes{v2.98c}{2008/03/06}{added}
+% \begin{command}{\cleardoubleevenusingstyle}
+% \changes{v2.98c}{2008/03/06}{added}
+% \changes{v3.06a}{2010/09/17}{\cs{thispagestyle} replaced by
+% \cs{pagestyle}}
+% \begin{command}{\cleardoubleevenemptypage,\cleardoubleevenplainpage}
+% \changes{v2.98c}{2001/06/18}{added}
+% \begin{command}{\cleardoublepage}
+% \changes{v2.98c}{2001/06/18}{always redefining it}
+% \changes{v2.98c}{2008/04/11}{new default from version 2.98c}
+% \changes{v3.13}{2014/03/01}{allow page style \pstyle{headings} as value for
+% class option}
+% \changes{v3.28}{2019/11/18}{\cs{ifnotundefined} replaced by
+% \cs{Ifnotundefined}}
+% \changes{v3.28}{2019/11/18}{\cs{ifstr} replaced by \cs{Ifstr}}
+% With options \opt{twoside} and \opt{openright}, which are both default with
+% \cls*{scrbook} and available with \cls*{scrreprt}, \cs{chapter} imply
+% \cs{cleardoublepage}. Usually this results in a new odd page and can insert
+% an interleaf page. With the standard classes this interleaf page has the
+% current active page style and therefore can have a running head and
+% pagination. Mainstream typography uses empty pages without running head or
+% pagination for interleaf pages. Some users also want a pagination but no
+% running head. Option \opt{cleardoublepage} can be used to select all the
+% often wishes and also every other page style. The corresponding commands are
+% also defined and the option re-defines \cs{cleardoublepage} to use one of
+% these additional commands. Similar is for \cs{cleardoubleoddpage} and
+% \cs{cleardoubleevenpage}.
+% \begin{macrocode}
+%<*(class|extend)&option>
+\KOMA@key{cleardoublepage}{%
+ \begingroup
+ \def\@tempc{%
+ \endgroup
+ \KOMA@unknown@keyval{cleardoublepage}{#1}{%
+ 'current' or any defined pagestyle e.g. 'empty','plain', 'headings'}%
+ }%
+ \Ifstr{#1}{current}{%
+ \def\@tempc{\endgroup
+ \def\cleardoublepage{\cleardoublestandardpage}%
+ \def\cleardoubleoddpage{\cleardoubleoddstandardpage}%
+ \def\cleardoubleevenpage{\cleardoubleevenstandardpage}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@replacevalue{.%
+%<package&extend> scrextend.\scr@pkgextension
+%<class> \KOMAClassFileName
+ }{cleardoublepage}{current}%
+ }%
+ }{%
+ \Ifnotundefined{ps@#1}{%
+ \def\@tempc{\endgroup
+ \def\cleardoublepage{\cleardoublepageusingstyle{#1}}%
+ \def\cleardoubleoddpage{\cleardoubleoddpageusingstyle{#1}}%
+ \def\cleardoubleevenpage{\cleardoubleevenpageusingstyle{#1}}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@xreplacevalue{.%
+%<package&extend> scrextend.\scr@pkgextension
+%<class> \KOMAClassFileName
+ }{cleardoublepage}{#1}%
+ }%
+ }{%
+% \end{macrocode}
+% At class loading time page style \pstyle{headings} is still undefined, but
+% should be allowed as value for option \opt{cleardoublepage}.
+% \begin{description}
+% \item[Note:] Page style \pstyle{plain} is already defined in the \LaTeX{}
+% kernel and therefore does not need special treatment.
+% \end{description}
+% \begin{macrocode}
+%<*class>
+ \ifx\@currname\KOMAClassName
+ \ifx\@currext\@clsextension
+ \Ifstr{#1}{headings}{%
+ \def\@tempc{\endgroup
+ \def\cleardoublepage{\cleardoublepageusingstyle{#1}}%
+ \def\cleardoubleoddpage{\cleardoubleoddpageusingstyle{#1}}%
+ \def\cleardoubleevenpage{\cleardoubleevenpageusingstyle{#1}}%
+ \FamilyKeyStateProcessed
+ \KOMA@kav@xreplacevalue{.\KOMAClassFileName}%
+ {cleardoublepage}{#1}%
+ }%
+ }{}%
+ \fi
+ \fi
+%</class>
+ }%
+ }%
+ \@tempc
+}
+\newcommand*{\cleardoubleoddstandardpage}{}
+\let\cleardoubleoddstandardpage=\cleardoublepage
+\newcommand*{\cleardoubleoddpageusingstyle}[1]{\clearpage
+ {\pagestyle{#1}\cleardoubleoddstandardpage}}
+\newcommand*{\cleardoubleoddemptypage}{\cleardoubleoddpageusingstyle{empty}}
+\newcommand*{\cleardoubleoddplainpage}{\cleardoubleoddpageusingstyle{plain}}
+\newcommand*{\cleardoubleevenstandardpage}{%
+ \clearpage
+ \if@twoside\ifodd\c@page
+ \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi
+ \fi\fi
+}
+\newcommand*{\cleardoubleevenpageusingstyle}[1]{\clearpage
+ {\pagestyle{#1}\cleardoubleevenstandardpage}}
+\newcommand*{\cleardoubleevenemptypage}{\cleardoubleevenpageusingstyle{empty}}
+\newcommand*{\cleardoubleevenplainpage}{\cleardoubleevenpageusingstyle{plain}}
+\newcommand*{\cleardoublestandardpage}{\cleardoubleoddstandardpage}
+\renewcommand*{\cleardoublepage}{%
+ \expandafter\ifnum \@nameuse{scr@v@2.98c}<\scr@compatibility\relax
+ \cleardoubleemptypage
+ \else
+ \cleardoublestandardpage
+ \fi
+}
+\KOMA@kav@add{.%
+%<package&extend> scrextend.\scr@pkgextension
+%<class> \KOMAClassFileName
+}{cleardoublepage}{%
+ \expandafter\ifnum \scr@v@is@gt{2.98c}empty\else current\fi
+}
+% \end{macrocode}
+% We expand the value at the end of the class or package.
+% \begin{macrocode}
+%<package&extend>\AtEndOfPackage{%
+%<class>\AtEndOfClass{%
+ \KOMAoptionOf[\expandafter\edef\expandafter\@tempa\@firstofone]%
+ {%
+%<package&extend> scrextend.\scr@pkgextension
+%<class> \KOMAClassFileName
+ }{cleardoublepage}%
+ \KOMA@kav@removekey{.%
+%<package&extend> scrextend.\scr@pkgextension
+%<class> \KOMAClassFileName
+ }{cleardoublepage}%
+ \KOMA@kav@xadd{.%
+%<package&extend> scrextend.\scr@pkgextension
+%<class> \KOMAClassFileName
+ }{cleardoublepage}{\@tempa}%
+}
+\newcommand*{\cleardoubleoddpage}{\cleardoubleoddemptypage}
+\newcommand*{\cleardoubleevenpage}{\cleardoubleevenemptypage}
+\newcommand*{\cleardoublepageusingstyle}[1]{\clearpage
+ {\pagestyle{#1}\cleardoublestandardpage}}
+\newcommand*{\cleardoubleemptypage}{\cleardoublepageusingstyle{empty}}
+\newcommand*{\cleardoubleplainpage}{\cleardoublepageusingstyle{plain}}
+% \end{macrocode}
+% \end{command}^^A \cleardoublepage
+% \end{command}^^A \cleardoubleevenplainpage,\cleardoubleevenemptypage
+% \end{command}^^A \cleardoubleevenusingstyle
+% \end{command}^^A \cleardoubleevenpage,\cleardoubleevenstandardpage
+% \end{command}^^A \cleardoubleoddemptypage,\cleardoubleoddplainpage
+% \end{command}^^A \cleardoubleoddusingstyle
+% \end{command}^^A \cleardoubleoddpage,\cleardoubleoddstandardpage
+% \end{command}^^A \cleardoubleemptypage,\cleardoubleplainpage
+% \end{command}^^A \cleardoubleusingstyle
+% \end{command}^^A \cleardoublestandardpage
+% \begin{option}{cleardoubleempty,cleardoubleplain,cleardoublestandard}
+% \changes{v2.8a}{2001/06/18}{added}
+% \changes{v2.8q}{2001/11/06}{\cs{cleardoublestandardpage} replaced by
+% \cs{cleardoublestandard}}
+% \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
+% \cs{PackageInfoNoLine}}
+% \changes{v3.01a}{2008/11/20}{deprecated}
+% \begin{macrocode}
+%<*class>
+\KOMA@DeclareDeprecatedOption{cleardoubleempty}{cleardoublepage=empty}
+\KOMA@DeclareDeprecatedOption{cleardoubleplain}{cleardoublepage=plain}
+\KOMA@DeclareDeprecatedOption{cleardoublestandard}{cleardoublepage=current}
+%</class>
+%</(class|extend)&option>
+% \end{macrocode}
+% \end{option}^^A cleardoublestandard,cleardoubleplain,cleardoubleempty
+% \end{option}^^A cleardoublepage
+%
+%
+% \Finale
+% \PrintChanges
+%
+\endinput
+% Local Variables:
+% mode: doctex
+% ispell-local-dictionary: "en_US"
+% eval: (flyspell-mode 1)
+% TeX-master: t
+% TeX-engine: luatex-dev
+% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
+% End: