summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/doc/english/scrlayer-scrpage-experts.tex
blob: fb3282f1d709cd926b58c59bc409a371c793c080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
% ======================================================================
% scrlayer-scrpage-experts.tex
% Copyright (c) Markus Kohm, 2013-2017
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in manifest.txt.
% ----------------------------------------------------------------------
% scrlayer-scrpage-experts.tex
% Copyright (c) Markus Kohm, 2013-2017
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3c, verteilt und/oder veraendert werden.
% Die neuste Version dieser Lizenz ist
%   http://www.latex-project.org/lppl.txt
% und Version 1.3c ist Teil aller Verteilungen von LaTeX
% Version 2005/12/01 oder spaeter und dieses Werks.
%
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
% (allein durch den Autor verwaltet).
%
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
% 
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
% ======================================================================
%
% Expert chapter about scrlayer-scrpage of the KOMA-Script guide
%
% ----------------------------------------------------------------------
%
% Expertenkapitel ueber scrlayer-scrpage in der KOMA-Script-Anleitung
%
% ============================================================================

\KOMAProvidesFile{scrlayer-scrpage-experts.tex}%
                 [$Date: 2017-01-02 13:30:07 +0100 (Mon, 02 Jan 2017) $
                  KOMA-Script guide (chapter: scrlayer-scrpage-experts)]
\translator{Markus Kohm}

% Date version of the translated file: 2015-03-31

\chapter[{Additional Features of \Package{scrlayer-scrpage}}]
  {Additional Features\ChangedAt{v3.12}{\Package{scrlayer-scrpage}} with
    package \Package{scrlayer-scrpage}}
\labelbase{scrlayer-scrpage-experts}
%
\BeginIndexGroup
\BeginIndex{Package}{scrlayer-scrpage}%
Package \Package{scrlayer-scrpage} provides features that have not been
described in \autoref{cha:scrlayer-scrpage} of this \iffree{user
  guide}{book}'s \autoref{part:forAuthors}. In general, the average user will
not need those extensions and some of them are only provided for
compatibility with \Package{scrpage2}.

\LoadCommonFile{pagestylemanipulation}% \section{Manipulation of Defined Page Styles}

\section{Definition of new Pairs of Page Styles}
\seclabel{pagestyle.pairs}

In \autoref{sec:scrlayer-scrpage.predefined.pagestyles} the page styles
\PageStyle{scrheadings} and \PageStyle{plain.scrheadings} have been
described. These can be seen as a pair of page styles, with
\PageStyle{scrheadings} being the main page style with a running head and
\PageStyle{plain.scrheadings} being the corresponding \PageStyle{plain} page
style without running head but generally with pagination. Additionally to the
configuration of these page styles, \Package{scrlayer-scrpage} provides also
the feature of defining new such pairs of page styles. Thereby the name of the
main page style, e.\,g., \PageStyle{scrheadings}, can be seen as the name of the
pair of page styles.

Most users will not need more than the predefined pair
\PageStyle{scrheadings}. So the commands of this section may be understood as
an addition for special cases. And as each such case is very special,
this section also lacks of handsome examples. Nevertheless, if the support
will show me a real nice example in the future, I perhaps could use it in
the future. However, I'm almost sure that all such cases could also be
solved using the predefined pair only.

\begin{Declaration}
  \Macro{defpairofpagestyles}%
  \OParameter{parent pair}\Parameter{name}\Parameter{definition}%
  \Macro{newpairofpagestyles}%
  \OParameter{parent pair}\Parameter{name}\Parameter{definition}%
  \Macro{renewpairofpagestyles}%
  \OParameter{parent pair}\Parameter{name}\Parameter{definition}%
  \Macro{providepairofpagestyles}%
  \OParameter{parent pair}\Parameter{name}\Parameter{definition}
\end{Declaration}
With these commands you may define pairs of page styles similar to
\PageStyle{scrheadings} and \PageStyle{plain.scrheadings}. Thereby
\PName{name} is the name of the main page style that is similar to
\PageStyle{scrheadings}. The name of the corresponding \PageStyle{plain} page
style will be prefixed by \PValue{plain.} automatically. So \PName{name} is
not only the name of the pair of page styles, but also the name of the main
page style of that pair, while \PValue{plain.}\PName{name} is the name of the
\PageStyle{plain} page style of this pair.

If the optional argument \PName{parent pair} is given, the settings of the
pair of page styles with that name are the initial settings of the new pair of
page styles. So the new pair inherits the configuration of the \PName{parent
  pair}.

Reading \autoref{sec:scrlayer-scrpage.predefined.pagestyles} might have
created the impression that the described commands are related to
\PageStyle{scrheadings} and \PageStyle{plain.scrheadings} only. However, if
there exist more pairs of page styles, these commands are related to the pair
that has been activated last. In fact, this is the case for \DescRef{scrlayer-scrpage.cmd.lehead},
\DescRef{scrlayer-scrpage.cmd.cehead}, \DescRef{scrlayer-scrpage.cmd.rehead}, \DescRef{scrlayer-scrpage.cmd.lohead}, \DescRef{scrlayer-scrpage.cmd.cohead},
\DescRef{scrlayer-scrpage.cmd.rohead}, \DescRef{scrlayer-scrpage.cmd.lefoot}, \DescRef{scrlayer-scrpage.cmd.cefoot}, \DescRef{scrlayer-scrpage.cmd.refoot},
\DescRef{scrlayer-scrpage.cmd.lofoot}, \DescRef{scrlayer-scrpage.cmd.cofoot}, \DescRef{scrlayer-scrpage.cmd.rofoot}, \DescRef{scrlayer-scrpage.cmd.ihead}, \DescRef{scrlayer-scrpage.cmd.chead},
\DescRef{scrlayer-scrpage.cmd.ohead}, \DescRef{scrlayer-scrpage.cmd.ifoot}, \DescRef{scrlayer-scrpage.cmd.cfoot}, and \DescRef{scrlayer-scrpage.cmd.ofoot} of
\autoref{sec:scrlayer-scrpage.predefined.pagestyles}.

All those commands and the below described commands
\DescRef{\LabelBase.cmd.clearmainofpairofpagestyles}, \DescRef{\LabelBase.cmd.clearplainofpairofpagestyles}, and
\DescRef{\LabelBase.cmd.clearpairofpagestyles} are also designed to be used inside the argument
\PName{definition}. In that case, they are a kind of default configuration of
the pair of page styles that is executed each time the pair will be
activated. A pair of page styles is activated, if one of the page styles of
the pair will be activated, which is mostly done by using
\DescRef{maincls.cmd.pagestyle}\IndexCmd{pagestyle}.

Please note that the commands of
\autoref{sec:scrlayer-scrpage.pagestyle.content} are for general
purpose. Therefore, they are related to every page style that has been defined
using \Package{scrlayer-scrpage}.

Whereas \Macro{defpairofpagestyles} will define a pair no matter if the
corresponding page styles are already defined, \Macro{newpairofpagestyles} and
\Macro{providepairofpagestyles} will define the pair only, if the page styles
are currently undefined. If at least one of the page styles is already
defined, the new definition of \Macro{providepairofpagestyles} will be
ignored, but usage of \Macro{newpairofpagestyles} would result in an error
message. To redefine already existing pairs of page styles you may use
\Macro{renewpairofpagestyles}. With this an error would be thrown, if at least
one of the page styles of the pair does not already exist.%
\EndIndexGroup


\begin{Declaration}
  \Macro{clearmainofpairofpagestyles}%
  \Macro{clearplainofpairofpagestyles}%
  \Macro{clearpairofpagestyles}
\end{Declaration}
Command \Macro{clearmainofpairofpagestyles} will configure the main page style
of the lastly activated pair of page styles to be empty. In contrast to this
\Macro{clearplainofpairofpagestyles} will configure the \PageStyle{plain} page
style of the lastly activated pair of page styles to be empty. Last but not
least \Macro{clearpairofpagestyle} will configure both page styles of the
lastly activated pair of page styles to be empty.

But please note\textnote{Attention!} that none of these commands will remove
the definitions of argument \PName{definition} that has been used when
defining the pair of page styles (see above). So if you activate the pair of
page styles again, those definitions will be used again!

These commands may be used inside of \PName{definition} themselves. But you
may use them outside the definition of a pair of page styles too. In this case
they are related to the lastly activated pair of page styles.

\BeginIndex{Cmd}{clearscrheadings}%
\BeginIndex{Cmd}{clearscrplain}%
\BeginIndex{Cmd}{clearscrheadfoot}%
The commands \Macro{clearscrheadings}, \Macro{clearscrplain}, and
\Macro{clearscrheadfoot} are aliases for these commands provided only for
compatibility with \Package{scrpage2}. Nevertheless, they are deprecated and
should not be used.%
%
\EndIndexGroup


\section{Definition of Simple Page Styles with Three Parts in Head and Foot }
\seclabel{pagestyle.triple}

Beside predefined page styles and the definition of new pairs of page styles,
package \Package{scrlayer-scrpage} also provides the definition of page styles
with three parts in head and foot. But this user interface exists for
compatibility with \Package{scrpage2} only. However, it has been extended
beyond the functionality of \Package{scrpage2} to provide a more consistent
set of commands. Nevertheless, for new documents it is recommended to instead
use the advanced features described in the previous section.

\begin{Declaration}
  \Macro{deftriplepagestyle}\Parameter{name of the page style}%
                            \OParameter{thickness of the outer line}%
                            \OParameter{thickness of the inner line}%
                            \Parameter{inner head element}%
                            \Parameter{centre head element}%
                            \Parameter{outer head element}%
                            \Parameter{inner foot element}%
                            \Parameter{centre foot element}%
                            \Parameter{outer foot element}%
  \Macro{newtriplepagestyle}\Parameter{name of the page style}%
                            \OParameter{thickness of the outer linen}%
                            \OParameter{thickness of the inner linen}%
                            \Parameter{inner head element}%
                            \Parameter{centre head element}%
                            \Parameter{outer head element}%
                            \Parameter{inner foot element}%
                            \Parameter{centre foot element}%
                            \Parameter{outer foot element}%
  \Macro{renewtriplepagestyle}\Parameter{name of the page style}%
                              \OParameter{thickness of the outer line}%
                              \OParameter{thickness of the inner line}%
                              \Parameter{inner head element}%
                              \Parameter{centre head element}%
                              \Parameter{outer head element}%
                              \Parameter{inner foot element}%
                              \Parameter{centre foot element}%
                              \Parameter{outer foot element}%
  \Macro{providetriplepagestyle}\Parameter{name of the page style}%
                                \OParameter{thickness of the outer line}%
                                \OParameter{thickness of the inner line}%
                                \Parameter{inner head element}%
                                \Parameter{centre head element}%
                                \Parameter{outer head element}%
                                \Parameter{inner foot element}%
                                \Parameter{centre foot element}%
                                \Parameter{outer foot element}
\end{Declaration}
With these commands you can define a single page style, whose head and foot
are parted into three elements: an inner element, a centre element, and an
outer element. The contents of the elements are stated via three mandatory
arguments for the head and three mandatory arguments for the foot.

Each of the two inner elements will be printed right aligned on left pages and
left aligned on right pages. The centre elements will be printed centred in
the head respectively foot of left and right pages. Each of the two outer
elements will be printed left aligned on left pages and right aligned on right
pages.

Please note once again:\textnote{Attention!} There are only right pages in
single side layout!

The two optional arguments can be used to activate horizontal lines in the
head and foot of the page style. To do so, you put the wanted thickness of the
line as an optional argument. The first optional argument is the
\PName{thickness of the outer line} in both, the page head and footer. In the
page head it will be printed above the head contents. In the page footer it
will be printed below the foot contents. The second optional argument is the
\PName{thickness of the inner line}. This will be printed below the page head
and additionally above the page footer. If you have only one optional
argument, this is the \PName{thickness of the inner line}. In this case no
outer line will be printed. And if you omit both optional arguments, both
lines will be omitted.

Please note\textnote{Attention!}, an empty optional argument is not the same
like omitting the optional argument! Empty optional arguments are not allowed
in this case. But you may use simple dimension expressions as explained for
\KOMAScript{} option \DescRef{scrlayer-scrpage.option.headwidth} (see
\autoref{sec:scrlayer-scrpage.pagestyle.content},
\DescPageRef{scrlayer-scrpage.option.headwidth}) for the optional
arguments.

\hyperref[fig:scrlayer-scrpage.triplepagestyle]%
{Figure~\ref*{fig:scrlayer-scrpage.triplepagestyle}} shows a sketch for the
interpretation of the arguments on a schematic double page. Thereby
``\texttt{outer}'', ``\texttt{inner}'', and ``\texttt{centre}'' are example
contents. The corresponding arrows illustrate the expansion of those
contents. The \iffree{coloured }{}texts inside the pages are only the names of
the arguments of these commands. The related arrows \iffree{in the same colour
}{} point to the corresponding elements of the page.

\begin{figure}
  \centering
  \begin{picture}(\textwidth,80mm)
    \put(0,50mm){%
      %\
      \begin{picture}(\textwidth,30mm)(0,-10mm)
        \thinlines
        \small
        % linke Seite
        \put(0,20mm){\line(1,0){.49\textwidth}}%
        \put(0,0){\line(0,1){20mm}}%
        \multiput(0,0)(0,-1mm){10}{\line(0,-1){.5mm}}%
        \put(.49\textwidth,5mm){\line(0,1){15mm}}%
        \put(.05\textwidth,15mm){\thicklines\line(1,0){.415\textwidth}}%
        \put(.05\textwidth,10mm){\makebox(0em,5mm)[l]{\slshape outer\strut$\longrightarrow$}}%
        \put(.465\textwidth,10mm){\makebox(0em,5mm)[r]{\slshape $\longleftarrow$inner\strut}}%
        \put(.2575\textwidth,10mm){\makebox(0em,5mm)[c]{\slshape $\longleftarrow$centre\strut$\longrightarrow$}}%
        \put(.05\textwidth,10mm){\thicklines\line(1,0){.415\textwidth}}%
        % rechte Seite
        \put(0.51\textwidth,20mm){\line(1,0){.49\textwidth}}%
        \put(0.51\textwidth,5mm){\line(0,1){15mm}}%
        \multiput(\textwidth,0)(0,-1mm){10}{\line(0,-1){.5mm}}%
        \put(\textwidth,0mm){\line(0,1){20mm}}%
        \put(.535\textwidth,15mm){\thicklines\line(1,0){.415\textwidth}}%
        \put(.535\textwidth,10mm){\makebox(0em,5mm)[l]{\slshape inner\strut$\longrightarrow$}}%
        \put(.95\textwidth,10mm){\makebox(0em,5mm)[r]{\slshape $\longleftarrow$outer\strut}}%
        \put(.7425\textwidth,10mm){\makebox(0em,5mm)[c]{\slshape $\longleftarrow$centre\strut$\longrightarrow$}}%
        \put(.535\textwidth,10mm){\thicklines\line(1,0){.415\textwidth}}%
        % commands for both pages
        \iffree{\color{red}}{}%
        \put(.5\textwidth,0){\makebox(0,\baselineskip)[c]{\PName{inner head element}}}%
        \put(.5\textwidth,-5mm){\makebox(0,\baselineskip)[c]{\PName{centre
              head element}}}%
        \put(.5\textwidth,-10mm){\makebox(0,\baselineskip)[c]{\PName{outer
              head element}}}%
        \put(\dimexpr.5\textwidth-2em,.5\baselineskip){%
          \put(-1.5em,.5\baselineskip){\vector(0,1){7mm}}%
          \put(-3.5em,-1\baselineskip){\line(-1,0){\dimexpr .25\textwidth-6.5em\relax}}%
          \put(-\dimexpr
          .25\textwidth-3em\relax,-1\baselineskip){\vector(0,1){\dimexpr
              7mm+1.5\baselineskip\relax}}
          \put(-3.25em,-2.25\baselineskip){\line(-1,0){\dimexpr .45\textwidth-8em\relax}}%
          \put(-\dimexpr
          .45\textwidth-4.75em\relax,-2.25\baselineskip){\vector(0,1){\dimexpr
              7mm+2.75\baselineskip\relax}}
        }%
        \put(\dimexpr.5\textwidth+2em,.5\baselineskip){%
          \put(1.5em,.5\baselineskip){\vector(0,1){7mm}}%
          \put(3.5em,-1\baselineskip){\line(1,0){\dimexpr .25\textwidth-6.5em\relax}}
          \put(\dimexpr
          .25\textwidth-3em\relax,-1\baselineskip){\vector(0,1){\dimexpr
              7mm+1.5\baselineskip\relax}}
          \put(3.25em,-2.25\baselineskip){\line(1,0){\dimexpr .45\textwidth-8em\relax}}
          \put(\dimexpr
          .45\textwidth-4.75em\relax,-2.25\baselineskip){\vector(0,1){\dimexpr
              7mm+2.75\baselineskip\relax}}
        }%
      \end{picture}
      %
    }%
    \put(0,0){%
      \begin{picture}(\textwidth,30mm)
        \thinlines
        \small
        % linke Seite
        \put(0,0){\line(1,0){.49\textwidth}}%
        \put(0,0){\line(0,1){20mm}}%
        \multiput(0,20mm)(0,1mm){10}{\line(0,1){.5mm}}%
        \put(.49\textwidth,0){\line(0,1){15mm}}%
        \put(.05\textwidth,15mm){\thicklines\line(1,0){.415\textwidth}}%
        \put(.05\textwidth,10mm){\makebox(0em,5mm)[l]{\slshape outer\strut$\longrightarrow$}}%
        \put(.465\textwidth,10mm){\makebox(0em,5mm)[r]{\slshape $\longleftarrow$inner\strut}}%
        \put(.2575\textwidth,10mm){\makebox(0em,5mm)[c]{\slshape $\longleftarrow$centre\strut$\longrightarrow$}}%
        \put(.05\textwidth,10mm){\thicklines\line(1,0){.415\textwidth}}%
        % rechte Seite
        \put(.51\textwidth,0){\line(1,0){.49\textwidth}}%
        \put(.51\textwidth,0){\line(0,1){15mm}}%
        \put(\textwidth,0){\line(0,1){20mm}}%
        \multiput(\textwidth,20mm)(0,1mm){10}{\line(0,1){.5mm}}%
        \put(.535\textwidth,15mm){\thicklines\line(1,0){.415\textwidth}}%
        \put(.535\textwidth,10mm){\makebox(0em,5mm)[l]{\slshape inner\strut$\longrightarrow$}}%
        \put(.95\textwidth,10mm){\makebox(0em,5mm)[r]{\slshape $\longleftarrow$outer\strut}}%
        \put(.7425\textwidth,10mm){\makebox(0em,5mm)[c]{\slshape $\longleftarrow$centre\strut$\longrightarrow$}}%
        \put(.535\textwidth,10mm){\thicklines\line(1,0){.415\textwidth}}%
        % commands for both pages
        \iffree{\color{red}}{}%
        \put(.5\textwidth,20mm){\makebox(0,\baselineskip)[c]{\PName{inner foot
              element}}}%
        \put(.5\textwidth,25mm){\makebox(0,\baselineskip)[c]{\PName{centre
              foot element}}}%
        \put(.5\textwidth,30mm){\makebox(0,\baselineskip)[c]{\PName{outer foot
              element}}}%
        \put(\dimexpr.5\textwidth-2em,.5\baselineskip){%
          \put(-1.5em,\dimexpr 20mm-.5\baselineskip\relax){\vector(0,-1){6mm}}%
          \put(-3.5em,25mm){\line(-1,0){\dimexpr .25\textwidth-6.5em\relax}}%
          \put(-\dimexpr .25\textwidth-3em\relax,25mm){\vector(0,-1){\dimexpr
              .5\baselineskip + 11mm\relax}}%
          \put(-3em,30mm){\line(-1,0){\dimexpr .45\textwidth-7.5em\relax}}%
          \put(-\dimexpr .45\textwidth-4.5em\relax,30mm){\vector(0,-1){\dimexpr
              .5\baselineskip + 16mm\relax}}%
        }%
        \put(\dimexpr.5\textwidth+2em,.5\baselineskip){%
          \put(1.5em,\dimexpr 20mm-.5\baselineskip\relax){\vector(0,-1){6mm}}%
          \put(3.5em,25mm){\line(1,0){\dimexpr .25\textwidth-6.5em\relax}}%
          \put(\dimexpr .25\textwidth-3em\relax,25mm){\vector(0,-1){\dimexpr
              .5\baselineskip + 11mm\relax}}%
          \put(3em,30mm){\line(1,0){\dimexpr .45\textwidth-7.5em\relax}}%
          \put(\dimexpr .45\textwidth-4.5em\relax,30mm){\vector(0,-1){\dimexpr
              .5\baselineskip + 16mm\relax}}%
        }%
      \end{picture}
    }%
    \thinlines\small\iffree{\color{blue}}{}%
    \put(0.055\textwidth,45mm){\vector(0,1){25mm}}%
    \put(0.945\textwidth,45mm){\vector(0,1){25mm}}%
    \put(0.055\textwidth,45mm){\vector(0,-1){30mm}}%
    \put(0.945\textwidth,45mm){\vector(0,-1){30mm}}%
    \put(0.055\textwidth,45mm){\line(1,0){\dimexpr
        .445\textwidth-7.5em\relax}}%
    \put(0.945\textwidth,45mm){\line(-1,0){\dimexpr
        .445\textwidth-7.5em\relax}}%
    \put(0.5\textwidth,45mm){\makebox(0,0)[c]{\PName{thickness of the inner lines}}}%
    \iffree{\color{green}}{}%
    \put(0.025\textwidth,40mm){\line(0,1){35mm}}%
    \put(0.025\textwidth,75mm){\vector(1,0){3.75mm}}%
    \put(0.975\textwidth,40mm){\line(0,1){35mm}}%
    \put(0.975\textwidth,40mm){\line(0,1){35mm}}%
    \put(0.975\textwidth,75mm){\vector(-1,0){3.75mm}}%
    \put(0.025\textwidth,40mm){\line(0,-1){30mm}}%
    \put(0.025\textwidth,10mm){\vector(1,0){3.75mm}}%
    \put(0.975\textwidth,40mm){\line(0,-1){30mm}}%
    \put(0.975\textwidth,40mm){\line(0,-1){30mm}}%
    \put(0.975\textwidth,10mm){\vector(-1,0){3.75mm}}%
    \put(0.025\textwidth,40mm){\line(1,0){\dimexpr
        .475\textwidth-7.5em\relax}}%
    \put(0.975\textwidth,40mm){\line(-1,0){\dimexpr
        .475\textwidth-7.5em\relax}}%
    \put(0.5\textwidth,40mm){\makebox(0,0)[c]{\PName{thickness of the outer lines}}}%
  \end{picture}
  \caption[{Elements of a three parts page style}]{Schematic double page with
    the elements of a tripartite page style of commands
    \Macro{deftriplepagestyle}, \Macro{newtriplepagestyle},
    \Macro{providetriplepagestyle}, and \Macro{renewtriplepagestyle}}
  \label{fig:scrlayer-scrpage.triplepagestyle}
\end{figure}

Using the described commands it is not possible to draw only a single line,
e.\,g., only below the page head but not above the page footer.  If you need
to do so, please consult the previous or following section.

The length of a single element\textnote{Attention!} is not limited by the
existence of a neighbour element. So in unfortunate circumstances it can
happen that one elements overwrites a neighbour element or even both of
them. The user himself is responsible to avoid such inappropriate usage. With
automatic running heads this could, e.\,g., be done using the optional
argument of the section commands. See the manual of the document class for
more information about those commands.

Command \Macro{deftriplepagestyle} defines a page style independent from
whether or not a page style with the same \PName{name of the page style}
already exists. In difference to this \Macro{newtriplepagestyle} and
\Macro{providetriplepagestyle} define the page style only, if the \PName{name
  of the page style} is not the name of an already defined page
style. Otherwise \Macro{providepagestyle} simply does nothing, but
\Macro{newtriplepagestyle} throws an error. Command
\Macro{renewtriplepagestyle} is something like the opposite of
\Macro{newtriplepagestyle}. It throws an error, if there has not been
a page style with the \PName{name of the page style} before, and defines the
page style only, if there has been already a page style with the given name.

\BeginIndex{Cmd}{deftripstyle}%
The command \Macro{deftriplestyle} of \Package{scrpage2} corresponds to
\Macro{deftriplepagestyle}. Because of unification reasons it has been renamed
and should not be used with it's old name any longer. Using the old name would
result in a warning message. Nevertheless, the result would be the expected
one.%
\EndIndexGroup


\section{Definition of Complex Page Styles}
\seclabel{pagestyle.experts}

Beside predefined page styles, the definition of new pairs of page styles and
the deprecated definition of page styles with tripartite head and foot, the
package \Package{scrlayer-scrpage} additionally provides basic features to
define new page styles. All already described page style definitions of
\Package{scrlayer-scrpage} use internally these basic features. Because of the
complexity of this user interface it is recommended for advanced users only.
As all most all imaginable use cases of page styles can handled using the
features described previous section, less advanced users may skip this
section.

\begin{Declaration}
  \Macro{defpagestyle}%
  \Parameter{name}\Parameter{head specification}\Parameter{foot specification}%
  \Macro{newpagestyle}%
  \Parameter{name}\Parameter{head specification}\Parameter{foot specification}%
  \Macro{providepagestyle}%
  \Parameter{name}\Parameter{head specification}\Parameter{foot specification}%
  \Macro{renewpagestyle}%
  \Parameter{name}\Parameter{head specification}\Parameter{foot specification}%
\end{Declaration}
These commands can be used to define a single page style with maximum
flexibility. Thereby \PName{name} is the name of the page style that should
be defined.

The arguments \PName{head specification} and \PName{foot specification} have
identical structure:
\begin{quote}\raggedright
  \texttt{%
    (\PName{length of the line above},\PName{thickness of the line above})\%\\
    \Parameter{specification for the left page in two-side layout}\%\\
    \Parameter{specification for the right page in two-side layout}\%\\
    \Parameter{specification for all pages in one-side laypout}\%\\
    (\PName{length of the line below},\PName{thickness of the line below})%
  }
\end{quote}
The arguments in the round brackets are options. This means, you may omit them
together with the brackets. In that case, the length and thickness of the
corresponding horizontal line would be given by the \KOMAScript{} options
\DescRef{scrlayer-scrpage.option.headtopline},
\DescRef{scrlayer-scrpage.option.headsepline},
\DescRef{scrlayer-scrpage.option.footsepline} or
\DescRef{scrlayer-scrpage.option.footbotline} (see
\autoref{sec:scrlayer-scrpage.pagestyle.content},
\DescPageRef{scrlayer-scrpage.option.headtopline}).

All three arguments in the curly brackets are mandatory. They hold arbitrary
content specifications depending on the page and the layout settings. But for
page styles with running heads usage of
\DescRef{scrlayer-scrpage.cmd.headmark},
\DescRef{scrlayer-scrpage.cmd.leftmark}, or
\DescRef{scrlayer-scrpage.cmd.rightmark} is recommended inside the
specification. Section numbers or section headings must not be used in the
specifications. Due to the asynchronous page building of \LaTeX, using them
could result in wrong numbers or texts in the page header or footer.

Command \Macro{defpagestyle} defines the page style no matter if a page style
with the same \PName{name} already exists. Command \Macro{newpagestyle} would
throw an error, if such a page style already exists. In contrast to this,
\Macro{providepagestyle} simple does nothing in such a case. In contrast to
\Macro{newpagestyle} command \Macro{renewpagestyle} throws an error, if a page
style with the \PName{name} does not already exist, and therefore may be used
to redefine an existing page style.

All these commands are based on the command
\DescRef{scrlayer.cmd.DeclarePageStyleByLayers}\IndexCmd{DeclarePageStyleByLayers} of package
\Package{scrlayer}. \hyperref[tab:scrlayer-scrpage-experts.layersperstyle]{Table~\ref*{tab:scrlayer-scrpage-experts.layersperstyle}}
shows the layers that are defined for a page style \PName{name}. More
information about layers and layer page styles can be found starting on
\autopageref{cha:scrlayer} in \autoref{cha:scrlayer} of
\autoref{part:forExperts}.%

\begin{table}
%  \KOMAoptions{captions=topbeside}
%  \setcapindent{0pt}
%  \begin{captionbeside}
  \caption
    [{The layers \Package{scrlayer-scrpage} defines to a page style}]
    {The layers \Package{scrlayer-scrpage} defines to a page style
      \PName{name}%
      \label{tab:scrlayer-scrpage-experts.layersperstyle}}
%    [l]
    \begin{tabular}{ll}
      \toprule
      Name of the layer & Meaning of the layer \\
      \midrule
      \PName{Name}\PValue{.head.above.line} 
        & horizontal line above the page head\\
      \PName{Name}\PValue{.head.odd} 
        & page head of odd pages in two-side layout\\
      \PName{Name}\PValue{.head.even}
        & page head of even pages in two-side layout\\
      \PName{Name}\PValue{.head.oneside} 
        & page head in single-side layout\\
      \PName{Name}\PValue{.head.below.line} 
        & horizontal line below the page head\\
      \PName{Name}\PValue{.foot.above.line} 
        & horizontal line above the page foot\\
      \PName{Name}\PValue{.foot.odd} 
        & page foot of odd pages in two-side layout\\
      \PName{Name}\PValue{.foot.even} 
         & page foot of even pages in two-side layout\\
     \PName{Name}\PValue{.foot.oneside} 
        & page foot in single-side layout\\
      \PName{Name}\PValue{.foot.below.line}
        & horizontal line below the page foot\\
      \bottomrule
    \end{tabular}
%  \end{captionbeside}
\end{table}

\begin{Example}
  Assume you want to colour the whole background of page style
  \PageStyle{scrheadings}' head. Because you read the introduction to
  this chapter, you know, that \PageStyle{scrheadings} last but not least is a
  layer page style with, e.\,g., layers \PValue{scrheadings.head.even},
  \PValue{scrheadings.head.odd}, and \PValue{scrheadings.head.oneside}. So you
  define three more layers for the backgrounds and add them at the very
  beginning of the page style:
\begin{lstcode}
 \documentclass{scrartcl}
  \usepackage[automark]{scrlayer-scrpage}
  \usepackage{xcolor}
  \usepackage{blindtext}
  \DeclareLayer[clone=scrheadings.head.oneside,
    contents={%
      \color{yellow}\rule[-\dp\strutbox]{\layerwidth}{\layerheight}%
    }%
  ]{scrheadings.head.oneside.background}
  \DeclareLayer[clone=scrheadings.head.odd,
    contents={%
      \color{yellow}\rule[-\dp\strutbox]{\layerwidth}{\layerheight}%
    }%
  ]{scrheadings.head.odd.background}
  \DeclareLayer[clone=scrheadings.head.even,
    contents={%
      \color{yellow}\rule[-\dp\strutbox]{\layerwidth}{\layerheight}%
    }%
  ]{scrheadings.head.even.background}
  \AddLayersAtBeginOfPageStyle{scrheadings}{%
    scrheadings.head.oneside.background,%
    scrheadings.head.odd.background,%
    scrheadings.head.even.background%
  }
  \pagestyle{scrheadings}
  \begin{document}
  \blinddocument
  \end{document}
\end{lstcode}
  As you can see, the example uses three layers, so the position and size of
  that background layers may simply be copied from the corresponding head
  layer using option \Option{clone}. This is much easier than using only one
  background layer and dynamically calculate the position time by time.

  In this example the coloured background is printed using a \Macro{rule}
  command. The size arguments of this \Macro{rule} are given by
  \DescRef{scrlayer.cmd.layerwidth} and \DescRef{scrlayer.cmd.layerheight}
  which contain the current width and height of the layer itself. The optional
  argument of \Macro{rule} is used to move the rule down by the height of a
  descender.
\end{Example}
%
Instead of using new layers to colour the background in the example above,
\Macro{colorbox} and \DescRef{scrlayer-scrpage.cmd.chead} could have been
used. It is recommended to build such a solution as an exercise. Another
approach could be to add the background layers one by one and just before the
contents layers. You may do this as an exercise too.%
\EndIndexGroup


\begin{Declaration}
  \KOption{hmode}\PValue{simple switch}
\end{Declaration}
Package \Package{scrpage2} outputs page heads and page foots in horizontal
mode always. In opposite to this \Package{scrlayer-scrpage} does not switch
into horizontal mode itself, but the output of horizontal material will do
so. Nevertheless, you can activate option \Option{hmode} gain compatibility to
\Package{scrpage2} in this
aspect. But this would have side effects, i.\,e., white
spaces at the start of the output or the vertical alignment of the output.

The options allows for the standard values for simple switches that are given
at \autoref{tab:truefalseswitch} on \autopageref{tab:truefalseswitch}. The
option is deactivated by default.%
\EndIndexGroup
%
\EndIndexGroup

%%% Local Variables:
%%% mode: latex
%%% mode: flyspell
%%% coding: us-ascii
%%% ispell-local-dictionary: "en_GB"
%%% TeX-master: "../guide"
%%% End: