Debian Codegraph @

texmf-dist/source/latex/koma-script/scrkernel-pagestyles.dtx

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % scrkernel-pagestyles.dtx
4 % Copyright (c) Markus Kohm, 2002-2023
5 %
6 % This file is part of the LaTeX2e KOMA-Script bundle.
7 %
8 % This work may be distributed and/or modified under the conditions of
9 % the LaTeX Project Public License, version 1.3c of the license.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3c or later is part of all distributions of LaTeX
13 % version 2005/12/01 or later and of this work.
14 %
15 % This work has the LPPL maintenance status "author-maintained".
16 %
17 % The Current Maintainer and author of this work is Markus Kohm.
18 %
19 % This work consists of all files listed in MANIFEST.md.
20 % ======================================================================
21 %%% From File: $Id: scrkernel-pagestyles.dtx 4058 2023-06-16 08:32:27Z kohm $
22 %<option>%%% (run: option)
23 %<body>%%% (run: body)
24 %<*dtx>
25 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
26 \begingroup
27 \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
28 \filedate$Date: 2023-06-16 10:32:27 +0200 (Fr, 16. Jun 2023) $
29 \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
30 \filerevision$Revision: 4058 $
31 \edef\reserved@a{%
32 \noexpand\endgroup
33 \noexpand\ProvidesFile{scrkernel-pagestyles.dtx}%
34 [\filedate\space\filerevision\space
35 KOMA-Script source
36 (page styles)]
37 }%
38 \reserved@a
39 \documentclass[USenglish]{koma-script-source-doc}
40 \usepackage{babel}
41 \setcounter{StandardModuleDepth}{3}
42 \begin{document}
43 \DocInput{scrkernel-pagestyles.dtx}
44 \end{document}
45 %</dtx>
46 % \fi
47 %
48 % \changes{v2.95}{2002/06/25}{first version after splitting \file{scrclass.dtx}}
49 % \changes{v3.36}{2022/03/05}{switch over from \cls*{scrdoc} to
50 % \cls*{koma-script-source-doc}}
51 % \changes{v3.36}{2022/03/05}{whole implementation documentation in English}
52 % \changes{v3.40}{2023/04/17}{guide names changed}
53 %
54 % \GetFileInfo{scrkernel-pagestyles.dtx}
55 % \title{The Code of the Default Page Styles of the
56 % \href{https://komascript.de}{\KOMAScript} Classes}
57 % \author{\href{mailto:[email protected]}{Markus Kohm}}
58 % \date{Revision \fileversion{} of \filedate}
59 % \maketitle
60 % \begin{abstract}
61 % \file{scrkernel-pagestyles.dtx} provides the default page styles of the
62 % \KOMAScript{} classes. As already told decades ago, there are plans to
63 % remove this code and to require the \KOMAScript{} page style
64 % package---namely \pkg*{scrlayer-scrpage}---instead.
65 % \end{abstract}
66 % \tableofcontents
67 %
68 % \section{User Manual}
69 %
70 % You can find the user documentation the commands implemented here in the
71 % \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
72 % English \file{scrguide-en.pdf}.
73 %
74 % \MaybeStop{\PrintIndex}
75 %
76 % \section{Implementation of the Page Styles of the \KOMAScript{} Classes}
77 %
78 % \begin{macrocode}
79 %<*class>
80 % \end{macrocode}
81 %
82 % \subsection{Options for the separation lines in page head and footer}
83 %
84 % \begin{option}{headsepline}
85 % \changes{v2.95c}{2006/08/11}{arguments of \cs{PassOptonsToPackage} fixed}
86 % \changes{v2.97c}{2007/04/19}{don't pass \opt{headinclude} to \pkg*{typearea}}
87 % \changes{v2.98c}{2008/03/26}{set \opt{headinclude}}
88 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
89 % \changes{v3.12}{2013/03/05}{if \pkg*{typearea} has not been loaded, pass
90 % option to the package}
91 % \changes{v3.17}{2015/03/10}{using value storage}
92 % \changes{v3.18a}{2015/07/08}{arguments of \cs{PassOptionsToPackage} fixed
93 % again}
94 % \changes{v3.20}{2015/12/12}{don't pass option to \pkg*{typearea}}
95 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
96 % option storage commands}
97 % \begin{macro}{\@hslfalse,\@hsltrue,\if@hsl}
98 % Optional separation line between page head and text area---in other words:
99 % below the page head.
100 % \begin{macrocode}
101 %<*option>
102 \KOMA@ifkey{headsepline}{@hsl}%
103 \KOMA@kav@add{\KOMAClassFileName}{headsepline}{false}
104 % \end{macrocode}
105 % \begin{option}{headnosepline}
106 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
107 % \cs{PackageInfoNoLine}}
108 % \changes{v3.01a}{2008/11/20}{deprecated}
109 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
110 % \begin{macrocode}
111 %<!v4>\KOMA@DeclareDeprecatedOption{headnosepline}{headsepline=false}
112 % \end{macrocode}
113 % \end{option}^^A headnosepline
114 % \end{macro}^^A \if@hsl
115 % \end{option}^^A headsepline
116 %
117 %
118 % \begin{option}{footsepline}
119 % \changes{v2.0e}{1994/08/14}{missing package at \cs{PassOptionsToPackage}
120 % added}
121 % \changes{v2.95c}{2006/08/11}{arguments of \cs{PassOptionsToPackage} fixed}
122 % \changes{v2.97c}{2007/04/19}{don't pass \opt{footinclude} to
123 % \pkg*{typearea}}
124 % \changes{v2.98c}{2008/03/26}{set \opt{footinclude}}
125 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
126 % \changes{v3.12}{2013/03/05}{if \textsf{typearea} has not been loaded, pass
127 % option to package}
128 % \changes{v3.12}{2013/08/26}{\cs{KOMA@options} replaced by \cs{KOMAoptions}}
129 % \changes{v3.12}{2013/08/26}{recalculation of typing area}
130 % \changes{v3.13}{2014/07/07}{no recalculation of typing area}
131 % \changes{v3.13}{2014/07/07}{\opt{headinclude} mistake fixed}
132 % \changes{v3.17}{2015/03/10}{using value storage}
133 % \changes{v3.18a}{2015/07/08}{arguments of \cs{PassOptionsToPackage} fixed
134 % again}
135 % \changes{v3.20}{2015/12/12}{don't pass option to \pkg*{typearea}}
136 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
137 % option storage commands}
138 % \begin{macro}{\@fslfalse,\@fsltrue,\if@fsl}
139 % Optional separation line between text area and page footer---in other words:
140 % above the page footer.
141 % \begin{macrocode}
142 \KOMA@ifkey{footsepline}{@fsl}%
143 \KOMA@kav@add{\KOMAClassFileName}{footsepline}{false}
144 % \end{macrocode}
145 % \begin{option}{footnosepline}
146 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
147 % \cs{PackageInfoNoLine}}
148 % \changes{v3.01a}{2008/11/20}{deprecated}
149 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
150 % \begin{macrocode}
151 %<!v4>\KOMA@DeclareDeprecatedOption{footnosepline}{footsepline=false}
152 %</option>
153 % \end{macrocode}
154 % \end{option}^^A footnosepline
155 % \end{macro}^^A \if@fsl
156 % \end{option}^^A footsepline
157 %
158 % \begin{option}{mpinclude}
159 % \changes{v2.95}{2002/07/08}{moved to \pkg*{typearea}}
160 % \end{option}{mpinclude}
161 %
162 %
163 % \subsection{Definition of the standard page styles}
164 %
165 %
166 % \begin{pgstyle}{plain,myheadings,headings}
167 % \changes{v2.0e}{1994/08/10}{\cls*{scrbook} does not provide single-side page
168 % styles}
169 % \changes{v2.0e}{1994/08/17}{in single-side mode \cs{markboth} replaced by
170 % \cs{markright}}
171 % \changes{v2.1b}{1994/12/31}{in single-side mode \cs{markboth} replaced by
172 % \cs{markright}}
173 % \changes{v2.2a}{1995/02/07}{dot after section number in \cls*{scrbook} and
174 % \cls*{scrreprt} removed}
175 % \changes{v2.2a}{1995/02/07}{using \cs{subsectionmark} in single-side mode
176 % with \cls*{scrartcl}}
177 % \changes{v2.2a}{1995/02/07}{using \cs{sectionmark} in single-side mode with
178 % \cls*{scrreprt}}
179 % \changes{v2.2c}{1995/05/25}{dot after chapter number removed}
180 % \changes{v2.2c}{1995/05/25}{numbers in running heads support CJK format
181 % extension}
182 % \changes{v2.3a}{1995/07/08}{because \cls{book} from version 1.2v provides
183 % option \opt{oneside} single-side page styles added to \cls*{scrbook}}
184 % \changes{v2.4f}{1996/10/08}{\cs{strut} added to page head}
185 % \changes{v2.97c}{2007/07/18}{distinguish \opt{twoside} as late as possible}
186 % \changes{v3.08}{2010/10/28}{\cs{noindent} added before usage of variable
187 % \var{nexthead} or \var{nextfoot}}
188 % \changes{v3.10}{2011/08/31}{using \cs{MakeMarkcase}}
189 % \changes{v3.28}{2019/11/19}{\cs{ifnumbered} renamed to \cs{Ifnumbered}}
190 % In difference to the standard classes, the \KOMAScript{} classes use
191 % pagination in the page footer for all page styles. Also an optional
192 % separation line below the page head and above the page footer is
193 % supported. The ugly usage of pool man's upper case for the running head of
194 % the standard classes is also not used, but optional.
195 % \begin{macro}{\set@tempdima@hw}
196 % \changes{v2.8q}{2002/03/28}{added}
197 % Because with \pkg*{typearea} option \opt{mpinclude} the head should be
198 % extended to the margin note column, \cs{set@tempdima@hw} sets
199 % \len{@tempdima} to the corresponding head width.
200 % \begin{description}
201 % \item[Note:] Package \pkg*{scrlayer} does not use this code, but allows
202 % to configure the width of head and foot independent, which is much
203 % better.
204 % \end{description}
205 % \begin{macrocode}
206 %<*body>
207 \newcommand*{\set@tempdima@hw}{%
208 \setlength{\@tempdima}{\textwidth}%
209 \if@mincl
210 \addtolength{\@tempdima}{\marginparsep}%
211 \addtolength{\@tempdima}{\marginparwidth}%
212 \fi
213 }
214 % \end{macrocode}
215 % \end{macro}^^A \set@tempdima@hw
216 % \begin{fontelement}{pagenumber}
217 % \changes{v2.8o}{2001/09/14}{added}
218 % \begin{fontelement}{pagination}
219 % \changes{v2.8o}{2001/09/14}{alias added}
220 % \begin{fontelement}{pageheadfoot}
221 % \changes{v2.98c}{2008/02/14}{added}
222 % \begin{fontelement}{pagehead}
223 % \changes{v2.8o}{2001/09/14}{added with warning added}
224 % \changes{v2.98c}{2008/02/14}{changed to alias}
225 % \changes{v2.97c}{2007/09/25}{warning changed}
226 % \changes{v2.98c}{2008/02/14}{warning changed}
227 % \begin{fontelement}{pagefoot}
228 % \changes{v2.8o}{2001/09/14}{alias with warning added}
229 % \changes{v2.98c}{2008/02/14}{changed to element}
230 % \changes{v3.13}{2014/01/13}{warning changed}
231 % \begin{macro}{\pnumfont,\headfont}
232 % \changes{v2.8c}{2001/06/29}{\cs{normalcolor} added}
233 % \begin{macro}{\footfont}
234 % \changes{v2.98c}{2008/02/14}{added}
235 % All these font settings are deprecated as user commands, but still valid as
236 % internal macros, used to define font elements. Because of using the old
237 % macros, we have to define elements manually instead of using \cs{newkomafont}.
238 % \begin{macrocode}
239 \newcommand*{\pnumfont}{\normalfont\normalcolor}
240 \newcommand*{\headfont}{\normalfont\normalcolor\slshape}
241 \newcommand*{\footfont}{}
242 % \end{macrocode}
243 % \begin{macrocode}
244 \newcommand*{\scr@fnt@pagenumber}{\pnumfont}
245 \aliaskomafont{pagination}{pagenumber}
246 \newcommand*{\scr@fnt@pageheadfoot}{\headfont}
247 \aliaskomafont{pagehead}{pageheadfoot}
248 %<*letter>
249 \newcommand*{\scr@fnt@wrn@pagehead}[1]{%
250 `pagehead' is only an alias of `pageheadfoot'.\MessageBreak
251 Font of page foot will also be changed%
252 }
253 \newcommand*{\scr@fnt@pagefoot}{\footfont}
254 %</letter>
255 %<*!letter>
256 \newcommand*{\scr@fnt@pagefoot}{\footfont}
257 \newcommand*{\scr@fnt@wrn@pagefoot}[1]{%
258 This class does not use font element `pagefoot'!\MessageBreak
259 Maybe you should load package `scrlayer-scrpage',\MessageBreak
260 before using this element%
261 }
262 %</!letter>
263 % \end{macrocode}
264 % \end{macro}^^A \footfont
265 % \end{macro}^^A \pnumfont,\headfont
266 % \end{fontelement}^^A pagefoot
267 % \end{fontelement}^^A pagehead
268 % \end{fontelement}^^A pageheadfoot
269 % \end{fontelement}^^A pagination
270 % \end{fontelement}^^A pagenumber
271 %
272 % \begin{command}{\pagemark}
273 % \changes{v2.95}{2006/03/15}{available for all classes}
274 % \changes{v3.05}{2010/02/05}{group added}
275 % \begin{command}{\letterpagemark}
276 % \changes{v3.17}{2015/03/20}{added for \pkg*{scrletter}}
277 % The pagination used by all classes. Originally this has been defined to
278 % simplify usage of \pkg{fancyhdr} (instead of
279 % \pkg[https://www.ctan.org/pkg/koma-script-obsolete]{scrpage2}), because in
280 % this case you just have to use \cs{pagemark} instead of \cs{thepage} in the
281 % definitions of the fancy page style to support \KOMAScript. But neither the
282 % author nor the users of \pkg{fancyhdr} have used it. However, now it is
283 % useful for \pkg{scrlayer-scrpage} too. And because we use another pagination
284 % for letters, we define a second command for \pkg*{scrletter}.
285 % \begin{macrocode}
286 %</body>
287 %</class>
288 %<*(class|letter)&body>
289 \newcommand*{%
290 %<class> \pagemark
291 %<package> \letterpagemark
292 }{%
293 {\usekomafont{pagenumber}{%
294 %<letter> \pagename\nobreakspace
295 \thepage}}}
296 %</(class|letter)&body>
297 % \end{macrocode}
298 % \end{command}^^A \letterpagemark
299 % \end{command}^^A \pagemark
300 % First of all we have to define the page styles of all classes but the letter
301 % class.
302 % \begin{macrocode}
303 %<*class&!letter&body>
304 \renewcommand*{\ps@plain}{%
305 \renewcommand*{\@oddhead}{}%
306 \let\@evenhead\@oddhead
307 \renewcommand*{\@evenfoot}{%
308 \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
309 \if@fsl \hrule \vskip 3\p@ \fi
310 \hb@xt@ \@tempdima{{\pagemark\hfil}}}}}%
311 \renewcommand*{\@oddfoot}{%
312 \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
313 \if@fsl \hrule \vskip 3\p@ \fi
314 \hb@xt@ \@tempdima{{\hfil\pagemark
315 \if@twoside\else\hfil\fi}}}}\hss}%
316 }%
317 \newcommand*{\ps@headings}{\let\@mkboth\markboth
318 \renewcommand*{\@evenhead}{%
319 \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
320 \hb@xt@ \@tempdima{{\headfont\strut\leftmark\hfil}}%
321 \if@hsl \vskip 1.5\p@ \hrule \fi}}}%
322 \renewcommand*{\@oddhead}{%
323 \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
324 \hb@xt@ \@tempdima{{\headfont\hfil\strut\rightmark
325 \if@twoside\else\hfil\fi}}%
326 \if@hsl \vskip 1.5\p@ \hrule \fi}}\hss}%
327 \renewcommand*{\@evenfoot}{%
328 \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
329 \if@fsl \hrule \vskip 3\p@ \fi
330 \hb@xt@ \@tempdima{{\pagemark\hfil}}}}}%
331 \renewcommand*{\@oddfoot}{%
332 \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
333 \if@fsl \hrule \vskip 3\p@ \fi
334 \hb@xt@ \@tempdima{{\hfil\pagemark
335 \if@twoside\else\hfil\fi}}}}\hss}%
336 %<*article>
337 % \end{macrocode}
338 % \changes{v3.41}{2023/06/16}{split usage of \cs{MakeMarkcase}}
339 % From version 3.41 usage of \cs{MakeMarkcase} is split for number and text,
340 % to also support \cs{MakeTitlecase}.
341 % \begin{macrocode}
342 \renewcommand*{\sectionmark}[1]{%
343 \if@twoside\expandafter\markboth\else\expandafter\markright\fi
344 {%
345 \Ifnumbered{section}{\MakeMarkcase{\sectionmarkformat}}{}%
346 \MakeMarkcase{##1}%
347 }{}%
348 }%
349 \renewcommand*{\subsectionmark}[1]{%
350 \if@twoside
351 \markright{%
352 \Ifnumbered{subsection}{\MakeMarkcase{\subsectionmarkformat}}{}%
353 \MakeMarkcase{##1}%
354 }%
355 \fi
356 }%
357 %</article>
358 %<*report|book>
359 \renewcommand*{\chaptermark}[1]{%
360 \if@twoside\expandafter\markboth\else\expandafter\markright\fi
361 {%
362 \Ifnumbered{chapter}{%
363 %<book> \if@mainmatter
364 \MakeMarkcase{\chaptermarkformat}%
365 %<book> \fi
366 }{}\MakeMarkcase{##1}%
367 }{}%
368 }%
369 \renewcommand*{\sectionmark}[1]{%
370 \if@twoside
371 \markright{%
372 \Ifnumbered{section}{\MakeMarkcase{\sectionmarkformat}}{}%
373 \MakeMarkcase{##1}%
374 }%
375 \fi
376 }%
377 %</report|book>
378 }%
379 \newcommand*{\ps@myheadings}{\let\@mkboth\@gobbletwo
380 \renewcommand*{\@evenhead}{%
381 \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
382 \hb@xt@ \@tempdima{{\headfont\strut\leftmark\hfil}}%
383 \if@hsl \vskip 1.5\p@ \hrule \fi}}}%
384 \renewcommand*{\@oddhead}{%
385 \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
386 \hb@xt@ \@tempdima{{\headfont\hfil\strut\rightmark
387 \if@twoside\else\hfil\fi}}%
388 \if@hsl \vskip 1.5\p@ \hrule \fi}}\hss}%
389 \renewcommand*{\@evenfoot}{%
390 \set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{%
391 \if@fsl \hrule \vskip 3\p@ \fi
392 \hb@xt@ \@tempdima{{\pagemark\hfil}}}}}%
393 \renewcommand*{\@oddfoot}{%
394 \set@tempdima@hw\hb@xt@ \@tempdima{\vbox{%
395 \if@fsl \hrule \vskip 3\p@ \fi
396 \hb@xt@ \@tempdima{{\hfil\pagemark
397 \if@twoside\else\hfil\fi}}}}\hss}%
398 %<!article> \renewcommand*{\chaptermark}[1]{}%
399 %<article> \renewcommand*{\subsectionmark}[1]{}%
400 \renewcommand*{\sectionmark}[1]{}%
401 }
402 %</class&!letter&body>
403 % \end{macrocode}
404 % And now the page styles of the letter class.
405 % \begin{macrocode}
406 %<*class&letter&body>
407 \renewcommand*{\ps@plain}{%
408 \renewcommand*{\@oddhead}{%
409 \vbox{\vbox{\hsize=\textwidth\hbox to\textwidth{%
410 \parbox[b]{\textwidth}{\strut
411 \ifnum\@pageat>-1
412 \ifnum\@pageat<3
413 \ifcase\@pageat\raggedright\or\centering\or\raggedleft\fi
414 \pagemark
415 \else
416 \hfill
417 \fi
418 \else
419 \hfill
420 \fi
421 }%
422 }%
423 \if@hsl\kern1pt\rule{\textwidth}{.4pt}\fi
424 }%
425 }%
426 }%
427 \let\@evenhead\@oddhead%
428 \renewcommand*{\@oddfoot}{%
429 \parbox[t]{\textwidth}{%
430 \if@fsl
431 {%
432 \raggedright%
433 \vskip-\baselineskip\vskip.4pt
434 \hrulefill\\
435 }%
436 \fi
437 \ifnum\@pageat>2
438 \ifcase\@pageat\or\or\or\raggedright\or\centering\or\raggedleft\fi
439 \strut\pagemark
440 \else
441 \hfill
442 \fi
443 }%
444 }%
445 \let\@evenfoot\@oddfoot
446 }
447 \newcommand*{\ps@headings}{\let\@mkboth\markboth
448 \renewcommand*{\@oddhead}{%
449 \vbox{%
450 \vbox{\hsize=\textwidth\hbox to\textwidth{\headfont\noindent
451 \usekomavar{nexthead}}}%
452 \if@hsl\kern1pt\rule{\textwidth}{.4pt}\fi%
453 }%
454 }%
455 \let\@evenhead\@oddhead
456 \renewcommand*{\@oddfoot}{%
457 \parbox[t]{\textwidth}{%
458 \if@fsl
459 {%
460 \raggedright%
461 \vskip-\baselineskip\vskip.4pt
462 \hrulefill\\
463 }%
464 \fi
465 \vbox{\hsize=\textwidth\hbox to\textwidth{\headfont\footfont\noindent
466 \usekomavar{nextfoot}}}%
467 }%
468 }%
469 \let\@evenfoot\@oddfoot
470 }
471 \newcommand*{\ps@myheadings}{%
472 \ps@headings
473 \let\@mkboth\@gobbletwo
474 }
475 %</class&letter&body>
476 % \end{macrocode}
477 % The letter package already uses \pkg*{scrlayer-scrpage}:
478 % \begin{macrocode}
479 %<*package&letter&body>
480 \RequirePackage{scrlayer-scrpage}
481 \newpairofpagestyles{letter}{%
482 \clearpairofpagestyles
483 \lehead[\ifnum\@pageat=\z@\pagemark\fi]%
484 {\usekomavar{nexthead}}%
485 \lohead[\ifnum\@pageat=\z@\pagemark\fi]%
486 {\usekomavar{nexthead}}%
487 \chead[\ifnum\@pageat=\@ne\pagemark\fi]%
488 {}%
489 \rehead[\ifnum\@pageat=\tw@\pagemark\fi]%
490 {}%
491 \rohead[\ifnum\@pageat=\tw@\pagemark\fi]%
492 {}%
493 \lefoot[\ifnum\@pageat=\thr@@\pagemark\fi]%
494 {\usekomavar{nextfoot}}%
495 \lofoot[\ifnum\@pageat=\thr@@\pagemark\fi]%
496 {\usekomavar{nextfoot}}%
497 \cfoot[\ifnum\@pageat=4 \pagemark\fi]%
498 {}%
499 \refoot[\ifnum\@pageat=5 \pagemark\fi]%
500 {}%
501 \rofoot[\ifnum\@pageat=5 \pagemark\fi]%
502 {}%
503 }
504 %</package&letter&body>
505 % \end{macrocode}
506 % \end{pgstyle}^^A plain,myheadings,headings
507 %
508 % \begin{pgstyle}{notepaper}
509 % \changes{v3.27}{2019/03/22}{plan added}
510 % There are plans for \pkg*{scrletter} package to use a new layer
511 % \texttt{notepaper} to define the notepaper. With this layer it is possible
512 % to add several separated information blocks everywhere on the first
513 % page. A \texttt{picture} mode layer is used, because this makes the
514 % placement easier. It's a background layer, so the page contents are printed
515 % above. We could also use an odd-side layer, but who knows \dots
516 % \begin{macrocode}
517 %<*package&letter&body&willbe>
518 \DeclareNewLayer[%
519 background,
520 mode=picture,
521 page,
522 align=b,
523 contents=\scr@notepaper@printallelements
524 ]{notepaper}
525 % \end{macrocode}
526 % For \cs{scr@notepaper@elements} see \file{scrkernel-notepaper.dtx}.
527 %
528 % A second layer is used for the foldmarks. Again it is a picture layer. But
529 % this time it is an odd-sides-only layer.
530 % \begin{macrocode}
531 \DeclareNewLayer[%
532 background,
533 mode=picture,
534 page,
535 align=b,
536 contents=\scr@foldmarks@printallelements
537 ]{foldmarks}
538 % \end{macrocode}
539 % For \cs{@hfoldmark} and \cs{@vfoldmark} see \file{scrkernel-notepaper.dtx}.
540 %
541 % Last but not least the page style. The foldmarks are below the notepaper.
542 % \begin{macrocode}
543 \DeclareNewPageStyleByLayers{notepaper}{foldmarks,notepaper}
544 %</package&letter&body&willbe>
545 % \end{macrocode}
546 % \end{pgstyle}^^A notepaper
547 %
548 %
549 % \subsection{Selection of page styles for special pages}
550 %
551 %
552 % \begin{command}{\titlepagestyle,\indexpagestyle}
553 % \changes{v2.8d}{2001/07/05}{added}
554 % For pages with the in-page title and for the first page of the index,
555 % \KOMAScript{} provides configurable page styles. These are initially
556 % \pstyle{plain}.
557 % \begin{macrocode}
558 %<*class&!letter&body>
559 \newcommand*{\titlepagestyle}{plain}
560 \newcommand*{\indexpagestyle}{plain}
561 %</class&!letter&body>
562 % \end{macrocode}
563 % \end{command}
564 % \begin{command}{\partpagestyle}
565 % \changes{v2.8d}{2001/07/05}{added}
566 % \changes{v3.00}{2008/08/05}{not with \cls*{scrartcl}}
567 % \changes{v3.18}{2015/06/10}{indirect by \cs{DeclareSectionCommand}}
568 % \end{command}
569 % \begin{command}{\chapterpagestyle}
570 % \changes{v2.8d}{2001/07/05}{added}
571 % \changes{v3.18}{2015/05/20}{indirect by \cs{DeclareSectionCommand}}
572 % \end{command}
573 %
574 %
575 % \subsection{Selection of initial page style}
576 %
577 % The initial page style depends on the class:
578 % \begin{macrocode}
579 %<*class&body>
580 %<report|article|letter>\pagestyle{plain}
581 %<book>\pagestyle{headings}
582 % \end{macrocode}
583 % But the pagination is always done using Arabic numbers.
584 % \begin{macrocode}
585 \pagenumbering{arabic}
586 %</class&body>
587 % \end{macrocode}
588 %
589 % \section{Implementation of Interleaf Pages}
590 %
591 % \begin{description}
592 % \item[ToDo:] Move this code to a new file \file{scrkernel-interleaf.dtx}.
593 % \end{description}
594 %
595 % \begin{option}{cleardoublepage}
596 % \changes{v2.95}{2004/08/24}{added}
597 % \changes{v2.96a}{2007/01/03}{value \opt{\quotechar=current} fixed}
598 % \changes{v2.98c}{2008/03/06}{\cs{def} replaced by \cs{let}, because of
599 % option \opt{open}}
600 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
601 % \changes{v3.17}{2015/03/10}{using value storage}
602 % \changes{v3.37}{2022/05/10}{guard for \pkg*{scrextend} fixed}
603 % \changes{v3.39}{2022/10/25}{using \cs{scr@v@is@gt}}
604 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
605 % option storage commands}
606 % \begin{command}{\cleardoublestandardpage}
607 % \changes{v2.8a}{2001/06/18}{added}
608 % \changes{v2.96a}{2007/01/02}{default value added}
609 % \begin{command}{\cleardoubleusingstyle}
610 % \changes{v2.95}{2004/08/24}{added}
611 % \changes{v3.06a}{2010/09/17}{\cs{thispagestyle} replaced by
612 % \cs{pagestyle}}
613 % \begin{command}{\cleardoubleemptypage,\cleardoubleplainpage}
614 % \changes{v2.8a}{2001/06/18}{added}
615 % \begin{command}{\cleardoubleoddpage,\cleardoubleoddstandardpage}
616 % \changes{v2.98c}{2008/03/06}{added}
617 % \begin{command}{\cleardoubleoddusingstyle}
618 % \changes{v2.98c}{2008/03/06}{added}
619 % \changes{v3.06a}{2010/09/17}{\cs{thispagestyle} replaced by
620 % \cs{pagestyle}}
621 % \begin{command}{\cleardoubleoddemptypage,\cleardoubleoddplainpage}
622 % \changes{v2.98c}{2001/06/18}{added}
623 % \begin{command}{\cleardoubleevenpage,\cleardoubleevenstandardpage}
624 % \changes{v2.98c}{2008/03/06}{added}
625 % \begin{command}{\cleardoubleevenusingstyle}
626 % \changes{v2.98c}{2008/03/06}{added}
627 % \changes{v3.06a}{2010/09/17}{\cs{thispagestyle} replaced by
628 % \cs{pagestyle}}
629 % \begin{command}{\cleardoubleevenemptypage,\cleardoubleevenplainpage}
630 % \changes{v2.98c}{2001/06/18}{added}
631 % \begin{command}{\cleardoublepage}
632 % \changes{v2.98c}{2001/06/18}{always redefining it}
633 % \changes{v2.98c}{2008/04/11}{new default from version 2.98c}
634 % \changes{v3.13}{2014/03/01}{allow page style \pstyle{headings} as value for
635 % class option}
636 % \changes{v3.28}{2019/11/18}{\cs{ifnotundefined} replaced by
637 % \cs{Ifnotundefined}}
638 % \changes{v3.28}{2019/11/18}{\cs{ifstr} replaced by \cs{Ifstr}}
639 % With options \opt{twoside} and \opt{openright}, which are both default with
640 % \cls*{scrbook} and available with \cls*{scrreprt}, \cs{chapter} imply
641 % \cs{cleardoublepage}. Usually this results in a new odd page and can insert
642 % an interleaf page. With the standard classes this interleaf page has the
643 % current active page style and therefore can have a running head and
644 % pagination. Mainstream typography uses empty pages without running head or
645 % pagination for interleaf pages. Some users also want a pagination but no
646 % running head. Option \opt{cleardoublepage} can be used to select all the
647 % often wishes and also every other page style. The corresponding commands are
648 % also defined and the option re-defines \cs{cleardoublepage} to use one of
649 % these additional commands. Similar is for \cs{cleardoubleoddpage} and
650 % \cs{cleardoubleevenpage}.
651 % \begin{macrocode}
652 %<*(class|extend)&option>
653 \KOMA@key{cleardoublepage}{%
654 \begingroup
655 \def\@tempc{%
656 \endgroup
657 \KOMA@unknown@keyval{cleardoublepage}{#1}{%
658 'current' or any defined pagestyle e.g. 'empty','plain', 'headings'}%
659 }%
660 \Ifstr{#1}{current}{%
661 \def\@tempc{\endgroup
662 \def\cleardoublepage{\cleardoublestandardpage}%
663 \def\cleardoubleoddpage{\cleardoubleoddstandardpage}%
664 \def\cleardoubleevenpage{\cleardoubleevenstandardpage}%
665 \FamilyKeyStateProcessed
666 \KOMA@kav@replacevalue{%
667 %<package&extend> scrextend.\scr@pkgextension
668 %<class> \KOMAClassFileName
669 }{cleardoublepage}{current}%
670 }%
671 }{%
672 \Ifnotundefined{ps@#1}{%
673 \def\@tempc{\endgroup
674 \def\cleardoublepage{\cleardoublepageusingstyle{#1}}%
675 \def\cleardoubleoddpage{\cleardoubleoddpageusingstyle{#1}}%
676 \def\cleardoubleevenpage{\cleardoubleevenpageusingstyle{#1}}%
677 \FamilyKeyStateProcessed
678 \KOMA@kav@xreplacevalue{%
679 %<package&extend> scrextend.\scr@pkgextension
680 %<class> \KOMAClassFileName
681 }{cleardoublepage}{#1}%
682 }%
683 }{%
684 % \end{macrocode}
685 % At class loading time page style \pstyle{headings} is still undefined, but
686 % should be allowed as value for option \opt{cleardoublepage}.
687 % \begin{description}
688 % \item[Note:] Page style \pstyle{plain} is already defined in the \LaTeX{}
689 % kernel and therefore does not need special treatment.
690 % \end{description}
691 % \begin{macrocode}
692 %<*class>
693 \ifx\@currname\KOMAClassName
694 \ifx\@currext\@clsextension
695 \Ifstr{#1}{headings}{%
696 \def\@tempc{\endgroup
697 \def\cleardoublepage{\cleardoublepageusingstyle{#1}}%
698 \def\cleardoubleoddpage{\cleardoubleoddpageusingstyle{#1}}%
699 \def\cleardoubleevenpage{\cleardoubleevenpageusingstyle{#1}}%
700 \FamilyKeyStateProcessed
701 \KOMA@kav@xreplacevalue{\KOMAClassFileName}%
702 {cleardoublepage}{#1}%
703 }%
704 }{}%
705 \fi
706 \fi
707 %</class>
708 }%
709 }%
710 \@tempc
711 }
712 \newcommand*{\cleardoubleoddstandardpage}{}
713 \let\cleardoubleoddstandardpage=\cleardoublepage
714 \newcommand*{\cleardoubleoddpageusingstyle}[1]{\clearpage
715 {\pagestyle{#1}\cleardoubleoddstandardpage}}
716 \newcommand*{\cleardoubleoddemptypage}{\cleardoubleoddpageusingstyle{empty}}
717 \newcommand*{\cleardoubleoddplainpage}{\cleardoubleoddpageusingstyle{plain}}
718 \newcommand*{\cleardoubleevenstandardpage}{%
719 \clearpage
720 \if@twoside\ifodd\c@page
721 \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi
722 \fi\fi
723 }
724 \newcommand*{\cleardoubleevenpageusingstyle}[1]{\clearpage
725 {\pagestyle{#1}\cleardoubleevenstandardpage}}
726 \newcommand*{\cleardoubleevenemptypage}{\cleardoubleevenpageusingstyle{empty}}
727 \newcommand*{\cleardoubleevenplainpage}{\cleardoubleevenpageusingstyle{plain}}
728 \newcommand*{\cleardoublestandardpage}{\cleardoubleoddstandardpage}
729 \renewcommand*{\cleardoublepage}{%
730 %<!v4> \expandafter\ifnum \scr@v@is@gt{2.98c}%
731 \cleardoubleemptypage
732 %<!v4> \else
733 %<!v4> \cleardoublestandardpage
734 %<!v4> \fi
735 }
736 \KOMA@kav@add{%
737 %<package&extend> scrextend.\scr@pkgextension
738 %<class> \KOMAClassFileName
739 }{cleardoublepage}{%
740 %<!v4> \expandafter\ifnum \scr@v@is@gt{2.98c}
741 empty%
742 %<!v4> \else current\fi
743 }
744 % \end{macrocode}
745 % We expand the value at the end of the class or package.
746 % \begin{macrocode}
747 %<package&extend>\AtEndOfPackage{%
748 %<class>\AtEndOfClass{%
749 \KOMAoptionOf[\expandafter\edef\expandafter\@tempa\@firstofone]%
750 {%
751 %<package&extend> scrextend.\scr@pkgextension
752 %<class> \KOMAClassFileName
753 }{cleardoublepage}%
754 \KOMA@kav@removekey{%
755 %<package&extend> scrextend.\scr@pkgextension
756 %<class> \KOMAClassFileName
757 }{cleardoublepage}%
758 \KOMA@kav@xadd{%
759 %<package&extend> scrextend.\scr@pkgextension
760 %<class> \KOMAClassFileName
761 }{cleardoublepage}{\@tempa}%
762 }
763 \newcommand*{\cleardoubleoddpage}{\cleardoubleoddemptypage}
764 \newcommand*{\cleardoubleevenpage}{\cleardoubleevenemptypage}
765 \newcommand*{\cleardoublepageusingstyle}[1]{\clearpage
766 {\pagestyle{#1}\cleardoublestandardpage}}
767 \newcommand*{\cleardoubleemptypage}{\cleardoublepageusingstyle{empty}}
768 \newcommand*{\cleardoubleplainpage}{\cleardoublepageusingstyle{plain}}
769 % \end{macrocode}
770 % \end{command}^^A \cleardoublepage
771 % \end{command}^^A \cleardoubleevenplainpage,\cleardoubleevenemptypage
772 % \end{command}^^A \cleardoubleevenusingstyle
773 % \end{command}^^A \cleardoubleevenpage,\cleardoubleevenstandardpage
774 % \end{command}^^A \cleardoubleoddemptypage,\cleardoubleoddplainpage
775 % \end{command}^^A \cleardoubleoddusingstyle
776 % \end{command}^^A \cleardoubleoddpage,\cleardoubleoddstandardpage
777 % \end{command}^^A \cleardoubleemptypage,\cleardoubleplainpage
778 % \end{command}^^A \cleardoubleusingstyle
779 % \end{command}^^A \cleardoublestandardpage
780 % \begin{option}{cleardoubleempty,cleardoubleplain,cleardoublestandard}
781 % \changes{v2.8a}{2001/06/18}{added}
782 % \changes{v2.8q}{2001/11/06}{\cs{cleardoublestandardpage} replaced by
783 % \cs{cleardoublestandard}}
784 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
785 % \cs{PackageInfoNoLine}}
786 % \changes{v3.01a}{2008/11/20}{deprecated}
787 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
788 % \begin{macrocode}
789 %<*class&!v4>
790 \KOMA@DeclareDeprecatedOption{cleardoubleempty}{cleardoublepage=empty}
791 \KOMA@DeclareDeprecatedOption{cleardoubleplain}{cleardoublepage=plain}
792 \KOMA@DeclareDeprecatedOption{cleardoublestandard}{cleardoublepage=current}
793 %</class&!v4>
794 %</(class|extend)&option>
795 % \end{macrocode}
796 % \end{option}^^A cleardoublestandard,cleardoubleplain,cleardoubleempty
797 % \end{option}^^A cleardoublepage
798 %
799 %
800 % \Finale
801 % \PrintChanges
802 %
803 \endinput
804 % Local Variables:
805 % mode: doctex
806 % ispell-local-dictionary: "en_US"
807 % eval: (flyspell-mode 1)
808 % TeX-master: t
809 % TeX-engine: luatex-dev
810 % 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"))
811 % End: