summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/doc/english/scrpage2.tex
blob: 2fc696e23e91cc00668507ceb75caa47c0e17d90 (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
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
% ======================================================================
% scrpage2.tex
% Copyright (c) Markus Kohm, 2001-2007
%
% 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.3b of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3b 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.
% ----------------------------------------------------------------------
% scrpage2.tex
% Copyright (c) Markus Kohm, 2001-2007
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3b, verteilt und/oder veraendert werden.
% Die neuste Version dieser Lizenz ist
%   http://www.latex-project.org/lppl.txt
% und Version 1.3b 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.
% ======================================================================
%
% Chapter about scrpage2 of the KOMA-Script guide
% Maintained by Jens-Uwe Morawski (and sometimes Markus Kohm)
%
% ----------------------------------------------------------------------
%
% Kapitel über scrpage2 in der KOMA-Script-Anleitung
% Verwaltet von Jens-Uwe Morawski (unterstützt von Markus Kohm)
%
% ============================================================================

\ProvidesFile{scrpage2.tex}[2007/12/07 KOMA-Script guide (chapter:scrpage2)]
\translator{Jens-Uwe Morawski\and Karl-Heinz Zimmer\and Christoph Bier\and
  Gernot Hassenpflug\and Markus Kohm}

% date of translated german file: 2007/12/07

\chapter{Adapting Page Headers and Footers with \Package{scrpage2}}
\labelbase{scrpage}

%
\BeginIndex{Package}{scrpage2}%
As already mentioned in the two previous chapters, {\KOMAScript}
includes a package to customise the document page header and footer.
As of 2001, this package is no longer \Package{scrpage} but the much
improved and enhanced successor \Package{scrpage2}.  Therefore, this
documentation describes only \Package{scrpage2}.  The package
\Package{scrpage} is obsolete.

\begin{Explain}
  In place of \Package{scrpage2} you can of course make use of
  \Package{fancyhdr} (see \cite{package:fancyhdr}). However,
  \Package{scrpage2} integrated markedly better with the {\KOMAScript}
  bundle. For this reason, and because at the time the forerunner to
  \Package{fancyhdr} was missing many features, \Package{scrpage2} was
  developed. Naturally, \Package{scrpage2} is not limited to use only
  with the {\KOMAScript} classes, but can just as easily be used with
  other document classes.
\end{Explain}

Included as part of the basic functionality of \Package{scrpage2} are
various predefined and configurable page styles.

\section{Basic Functionality}\label{sec:scrpage.basics}

\begin{Explain}% Introduction to headings
  To understand the following description, an overview of {\LaTeX}'s
  fairly involved header and footer mechanism is needed.  The {\LaTeX}
  kernel defines the page styles \PValue{empty}, which produces a
  completely empty header and footer, and \PValue{plain}, which
  produces usually only a page number in the footer and an empty
  header.  Apart from these, many document classes provide the style
  \PValue{headings}, which allows more complex style settings and
  running headings.  The \PValue{headings} style often has a related
  variant, \PValue{myheadings}, which is similar except for switching
  off the running headings and reverting them to manual control by the
  user.  A more detailed description is given in
  \autoref{sec:maincls.pageStyle} where it is also noted that some
  {\LaTeX} commands automatically switch to the page style
  \PValue{plain} for the current page, independent of what page style
  was chosen by the author, and consequently a document needs an
  appropriate \PValue{plain} page style.
  
  Therefore \Package{scrpage2} defines its own \PValue{plain} and
  \PValue{headings} page styles, named \PValue{scrplain} and
  \PValue{scrheadings}.  The manual activation of \PValue{scrplain} is
  not necessary, since the activation of \PValue{scrheadings} takes
  care of it automatically.  Only if one wants to use one's own page
  style in combination with \PValue{scrplain} must the page style
  \PValue{scrplain} be activated first, i.\,e., with
  \Macro{pagestyle}\Parameter{scrplain}%
  \Macro{pagestyle}\Parameter{personalPagestyle}.
\end{Explain}
  
The original \PValue{headings} page style of the document class is
available as \PValue{useheadings}. This re-definition is required
since \Package{scrpage2} uses a different way to deal with automatic
and manual headings. This way is more flexible and allows
configurations which would usually prove difficult to implement for
inexperienced users. The required commands to work with the
\Package{scrpage2} implementation are introduced at the end of
\autoref{sec:scrpage.basics.buildIn} and the beginning of
\autoref{sec:scrpage.basics.mark}.

\subsection{Predefined Page Styles}\label{sec:scrpage.basics.buildIn}
% \lehead ...
% scrheadings
% \headmark \pagemark 

\begin{Declaration}
  \PValue{scrheadings}\\
  \PValue{scrplain}
\end{Declaration}%
\BeginIndex{Pagestyle}{scrheadings}\BeginIndex{Pagestyle}{scrplain}%
\Index{page>style}%
%
Package \Package{scrpage2} delivers its own page style, named
\PValue{scrheadings}, which can be activated with the
\Macro{pagestyle}\PParameter{scrheadings}. When this page style is in
use, an appropriate \PValue{scrplain} page style is used for the
\PValue{plain} page style.  In this case \emph{appropriate} means that
this new \PValue{plain} page style is also configureable by the
commands introduced in \autoref{sec:scrpage.basics.format}, which, for
example, configure the header and footer width.  Neither the
activation of \PValue{scrheadings} nor the attendant change to the
\PValue{plain} page style influences the mode of manual or automatic
headings (see \autoref{sec:scrpage.basics.mark}). The
\PValue{scrplain} page style can also be activated directly with
\Macro{pagestyle}.

\begin{Declaration}
  \Macro{lehead}%
    \OParameter{scrplain-left-even}\Parameter{scrheadings-left-even}\\
  \Macro{cehead}%
    \OParameter{scrplain-center-even}\Parameter{scrheadings-center-even}\\
  \Macro{rehead}%
    \OParameter{scrplain-right-even}\Parameter{scrheadings-right-even}\\
  \Macro{lefoot}%
    \OParameter{scrplain-left-even}\Parameter{scrheadings-left-even}\\
  \Macro{cefoot}%
    \OParameter{scrplain-center-even}\Parameter{scrheadings-center-even}\\
  \Macro{refoot}%
    \OParameter{scrplain-right-even}\Parameter{scrheadings-right-even}\\
  \Macro{lohead}%
    \OParameter{scrplain-left-odd}\Parameter{scrheadings-left-odd}\\
  \Macro{cohead}%
    \OParameter{scrplain-center-odd}\Parameter{scrheadings-center-odd}\\
  \Macro{rohead}%
    \OParameter{scrplain-right-odd}\Parameter{scrheadings-right-odd}\\
  \Macro{lofoot}%
    \OParameter{scrplain-left-odd}\Parameter{scrheadings-left-odd}\\
  \Macro{cofoot}%
    \OParameter{scrplain-center-odd}\Parameter{scrheadings-center-odd}\\
  \Macro{rofoot}%
    \OParameter{scrplain-right-odd}\Parameter{scrheadings-right-odd}\\
  \Macro{ihead}%
    \OParameter{scrplain-inside}\Parameter{scrheadings-inside}\\
  \Macro{chead}%
    \OParameter{scrplain-centered}\Parameter{scrheadings-centered}\\
  \Macro{ohead}%
    \OParameter{scrplain-outside}\Parameter{scrheadings-outside}\\
  \Macro{ifoot}%
    \OParameter{scrplain-inside}\Parameter{scrheadings-inside}\\
  \Macro{cfoot}%
    \OParameter{scrplain-centered}\Parameter{scrheadings-centered}\\
  \Macro{ofoot}%
    \OParameter{scrplain-outside}\Parameter{scrheadings-outside}
\end{Declaration}%
\BeginIndex{Cmd}{lehead}\BeginIndex{Cmd}{cehead}\BeginIndex{Cmd}{rehead}%
\BeginIndex{Cmd}{ihead}\BeginIndex{Cmd}{chead}\BeginIndex{Cmd}{ohead}%
\BeginIndex{Cmd}{lohead}\BeginIndex{Cmd}{cohead}\BeginIndex{Cmd}{rohead}%
\BeginIndex{Cmd}{lefoot}\BeginIndex{Cmd}{cefoot}\BeginIndex{Cmd}{refoot}%
\BeginIndex{Cmd}{ifoot}\BeginIndex{Cmd}{cfoot}\BeginIndex{Cmd}{rfoot}%
\BeginIndex{Cmd}{lofoot}\BeginIndex{Cmd}{cofoot}\BeginIndex{Cmd}{rofoot}%
%
The page styles include three boxes in both the header and the footer.
The commands modifying the content of these boxes can be seen in
\autoref{fig:scrpage.leheadetall}.  Commands in the middle column
modify the box contents on both odd and even pages.

\begin{figure}
  \centering
  \setlength{\unitlength}{1mm}\begin{picture}(100,65)(0,10)\small
    \put(0,12){\dashbox{2}(40,56){even page}}
    \put(60,12){\dashbox{2}(40,56){odd page}}
                                % items top left
    \put(1,63){\framebox(8,4){~}}
    \put(16,63){\framebox(8,4){~}}
    \put(31,63){\framebox(8,4){~}}
                                % items top right
    \put(61,63){\framebox(8,4){~}}
    \put(76,63){\framebox(8,4){~}}
    \put(91,63){\framebox(8,4){~}}
                                % items bottom left
    \put(1,13){\framebox(8,4){~}}
    \put(16,13){\framebox(8,4){~}}
    \put(31,13){\framebox(8,4){~}}
                                % items bottom right
    \put(61,13){\framebox(8,4){~}}
    \put(76,13){\framebox(8,4){~}}
    \put(91,13){\framebox(8,4){~}}
                                % commands and arrow
                                % for twoside
                                % 
    \put(50,65){\makebox(0,0){\Macro{ihead}}}
    \put(44,65){\vector(-1,0){4}}\put(56,65){\vector(1,0){4}}
    \put(50,58){\makebox(0,0){\Macro{chead}}}
    \put(44,58){\line(-1,0){24}}\put(56,58){\line(1,0){24}}
    \put(20,58){\vector(0,1){4}}\put(80,58){\vector(0,1){4}}
    \put(50,51){\makebox(0,0){\Macro{ohead}}}
    \put(44,51){\line(-1,0){40}}\put(56,51){\line(1,0){40}}
    \put(4,51){\vector(0,1){11}}\put(96,51){\vector(0,1){11}}
                                %
    \put(50,15){\makebox(0,0){\Macro{ifoot}}}
    \put(56,15){\vector(1,0){4}}\put(44,15){\vector(-1,0){4}}
    \put(50,22){\makebox(0,0){\Macro{cfoot}}}
    \put(44,22){\line(-1,0){24}}\put(56,22){\line(1,0){24}}
    \put(20,22){\vector(0,-1){4}}\put(80,22){\vector(0,-1){4}}
    \put(50,29){\makebox(0,0){\Macro{ofoot}}}
    \put(44,29){\line(-1,0){40}}\put(56,29){\line(1,0){40}}
    \put(4,29){\vector(0,-1){11}}\put(96,29){\vector(0,-1){11}}
                                % commands for oneside
    \put(5,69){\makebox(0,0)[b]{\Macro{lehead}}}
    \put(20,69){\makebox(0,0)[b]{\Macro{cehead}}}
    \put(35,69){\makebox(0,0)[b]{\Macro{rehead}}}
                                %
    \put(65,69){\makebox(0,0)[b]{\Macro{lohead}}}
    \put(80,69){\makebox(0,0)[b]{\Macro{cohead}}}
    \put(95,69){\makebox(0,0)[b]{\Macro{rohead}}}
                                %
    \put(5,11){\makebox(0,0)[t]{\Macro{lefoot}}}
    \put(20,11){\makebox(0,0)[t]{\Macro{cefoot}}}
    \put(35,11){\makebox(0,0)[t]{\Macro{refoot}}}
                                %
    \put(65,11){\makebox(0,0)[t]{\Macro{lofoot}}}
    \put(80,11){\makebox(0,0)[t]{\Macro{cofoot}}}
    \put(95,11){\makebox(0,0)[t]{\Macro{rofoot}}}
  \end{picture}
  \caption[Commands for modification of \Package{scrpage2} page styles
  elements]%
  {Commands for modification of page styles \PValue{scrheadings} and
    \PValue{scrplain} and their relationship to header and footer
    elements}
  \label{fig:scrpage.leheadetall}
\end{figure}

\begin{Example}
If one wants the page number be placed in the middle of the
footer, then following can be used:
\begin{lstlisting}
  \cfoot{\pagemark}
\end{lstlisting}
The next example shows how to place both running heading and page
number in the header; the running heading inside and the page number
outside:
\begin{lstlisting}
  \ohead{\pagemark}
  \ihead{\headmark}
  \cfoot{}
\end{lstlisting}
The command \Macro{cfoot}\PParameter{} is only required in order to
empty the item in the middle of the footer, which normally contains
the page number.
\end{Example}

The commands which are associated with only one item can be used for
more advanced settings.

\begin{Example}
Assuming one has the order to write an annual report for one's
company, one could use commands like this:
\begin{lstlisting}
  \ohead{\pagemark}
  \rehead{Annual Report 2001}
  \lohead{\headmark}
  \cefoot{TheCompanyName Inc.}
  \cofoot{Department: Development}
\end{lstlisting}
In order to keep the data in the footer synchronized with the content
of the document, the footer has to be updated using \Macro{cofoot}
when a new department is discussed in the report.
\end{Example}

As mentioned above, there is a new \PValue{plain} page style which
corresponds to \PValue{scrheadings}. Since it should also be possible
to customize this style, the commands support an optional argument
with which the contents of the appropriate fields of this
\PValue{plain} page style can be modified.

\begin{Example}
The position of the page number for the page style \PValue{scrheadings}
can be declared as follows:
\begin{lstlisting}
  \cfoot[\pagemark]{}
  \ohead[]{\pagemark}
\end{lstlisting}
When the command \Macro{chapter}, after it has started a new page, now
switches to the \PValue{plain} page style, then the page number is
centered in the footer.
\end{Example}
%
\EndIndex{Pagestyle}{scrheadings}\EndIndex{Pagestyle}{scrplain}%

\begin{Declaration}
  \Macro{clearscrheadings}\\
  \Macro{clearscrplain}\\
  \Macro{clearscrheadfoot}
\end{Declaration}%
\BeginIndex{Cmd}{clearscrheadings}%
\BeginIndex{Cmd}{clearscrplain}%
\BeginIndex{Cmd}{clearscrheadfoot}%
If one wants to redefine both the page style \PValue{scrheadings} and
the corresponding \PValue{plain} page style, frequently one must empty
some already occupied page elements. Since one rarely fills all items
with new content, in most cases several instructions with empty
parameters are necessary.  With the help of these three instructions
the quick and thorough deletion is possible.  While
\Macro{clearscrheadings} only deletes all fields of the page style
\PValue{scrheadings}, and \Macro{clearscrplain} deletes all fields of
the corresponding \PValue{plain} page style, \Macro{clearscrheadfoot}
sets all fields of both page styles to empty.

\begin{Example}
  If one wants to reset the page style to the default {\KOMAScript}
  settings, independent of the actual configuration, only these three
  commands are sufficient:
\begin{lstlisting}
  \clearscrheadfoot
  \ohead{\headmark}
  \ofoot[\pagemark]{\pagemark}
\end{lstlisting}
Without the commands \Macro{clearscrheadfoot},
\Macro{clearscrheadings} and \Macro{clearscrplain}, 6 commands with 9
empty arguments would be required:
\begin{lstlisting}
  \ihead[]{}
  \chead[]{}
  \ohead[]{\headmark}
  \ifoot[]{}
  \cfoot[]{}
  \ofoot[\pagemark]{\pagemark}
\end{lstlisting}
Of course, for a specific configuration, some of them could be
dropped.%
\end{Example}%
%
\EndIndex{Cmd}{clearscrheadings}%
\EndIndex{Cmd}{clearscrplain}%
\EndIndex{Cmd}{clearscrheadfoot}%
%
\EndIndex{Cmd}{lehead}\EndIndex{Cmd}{cehead}\EndIndex{Cmd}{rehead}%
\EndIndex{Cmd}{ihead}\EndIndex{Cmd}{chead}\EndIndex{Cmd}{ohead}%
\EndIndex{Cmd}{lohead}\EndIndex{Cmd}{cohead}\EndIndex{Cmd}{rohead}%
\EndIndex{Cmd}{lefoot}\EndIndex{Cmd}{cefoot}\EndIndex{Cmd}{refoot}%
\EndIndex{Cmd}{ifoot}\EndIndex{Cmd}{cfoot}\EndIndex{Cmd}{rfoot}%
\EndIndex{Cmd}{lofoot}\EndIndex{Cmd}{cofoot}\EndIndex{Cmd}{rofoot}%

In the previous examples two commands were used which have not been
introduced yet. The description of these commands follows.

\begin{Declaration}
  \Macro{leftmark}\\
  \Macro{rightmark}
\end{Declaration}%
\BeginIndex{Cmd}{leftmark}\BeginIndex{Cmd}{rightmark}%
These two instructions make it possible to access the running
headings, which are normally meant for the left or for the right
page. These two instruction are not made available by
\Package{scrpage2}, but directly by the {\LaTeX} kernel. When in this
section running headings of the left page or the right page are
mentioned, this refers to the contents of \Macro{leftmark} or
\Macro{rightmark}, respectively.
%
\EndIndex{Cmd}{leftmark}\EndIndex{Cmd}{rightmark}%

\BeginIndex{Cmd}{headmark}
\begin{Declaration}
\Macro{headmark}
\end{Declaration}%
This command gives access to the content of running headings.  In
contrast to \Macro{leftmark} and \Macro{rightmark}, one need not
regard the proper assignment to left or right page.
\EndIndex{Cmd}{headmark}

\BeginIndex{Cmd}{pagemark}
\begin{Declaration}
\Macro{pagemark}
\end{Declaration}%
This command returns the formatted page number. The formatting can be
controlled by \Macro{pnumfont}, introduced in
\autoref{sec:scrpage.basics.format},
\autopageref{desc:scrpage.macro.pnumfont}, which \Macro{pagemark}
heeds automatically. Alternatively, \Macro{setkomafont} can be used if
a {\KOMAScript} class is used (see \autoref{sec:maincls.font}).
% the last describtion \setkomafont ... is only fill-text
\EndIndex{Cmd}{pagemark}

\BeginIndex{Cmd}{pagestyle}\BeginIndex{Pagestyle}{useheadings}
\begin{Declaration}
\Option{useheadings}
\end{Declaration}%
\phantomsection\label{desc:scrpage.pagestyle.useheadings}%
The package \Package{scrpage2} is meant primarily for use of the
supplied styles or for defining one's own styles. However, it may be
necessary to shift back also to a style provided by the document
class.  It might appear that this should be done with \Macro{page
  style}\PParameter{headings}, but this has the disadvantage that
commands \Macro{automark} and \Macro{manualmark}, to be discussed
shortly, do not function as expected.  For this reason one should
shift back to the original styles using \Macro{page
  style}\PParameter{useheadings}, which chooses the correct page
styles automatically for both manual and automatic running headings.
%
\EndIndex{Cmd}{pagestyle}\EndIndex{Pagestyle}{useheadings}

\subsection{Manual and Running Headings}
\label{sec:scrpage.basics.mark}
% \automark \manualmark
%
Usually there is a \emph{my}-version of the \PValue{headings}
page style.  If such a page style is active, then the running headings
are no longer updated no longer automatically and become manual
headings.  With \Package{scrpage2} a different path is taken. Whether
the headings are running or manual is determined by the instructions
\Macro{automark} and \Macro{manualmark}, respectively.  The default
can be set already while loading of the package, with the options
\Option{automark} and \Option{manualmark} (see
\autoref{sec:scrpage.basics.options},
\autopageref{desc:scrpage.option.automark}).

\BeginIndex{Cmd}{manualmark}
\begin{Declaration}
\Macro{manualmark}
\end{Declaration}%
As the name suggests, \Macro{manualmark} switches off the updating of
the running headings and makes them manual. It is left to the user to
update and provide contents for the headings.  For that purpose the
instructions \Macro{markboth}\IndexCmd{markboth} and
\Macro{markright}\IndexCmd{markright} are available.
\EndIndex{Cmd}{manualmark}

\BeginIndex{Cmd}{automark}
\begin{Declaration}
  \Macro{automark}\OParameter{right page}\Parameter{left page}
\end{Declaration}%
The macro \Macro{automark} activates the automatic updating, that is,
running headings.  For the two parameters the designations of the
document sectioning level whose title is to appear in appropriate
place are to be used.  Valid values for the parameters are:
\PValue{part}\ChangedAt{v2.2}{\Package{scrpage2}}, \PValue{chapter},
\PValue{section}, \PValue{subsection}, \PValue{subsubsection},
\PValue{paragraph}, and \PValue{subparagraph}.  For most of the
classes use of \PValue{part} will not produce the expected result. So
far only {\KOMAScript} classes from version~2.9s up are known to
support this value.

The optional argument \PName{right page} is understandably meant only
for two-sided documents. In the one-sided case one should normally not
use it.  With the help of the option \Option{autooneside} one can also
set that the optional argument in one-sided mode is ignored
automatically (see \autoref{sec:scrpage.basics.options},
\autopageref{desc:scrpage.option.autooneside}).
%
\begin{Example}
  Assuming that the document uses a \emph{book} class, whose topmost
  section level is \emph{chapter}, then after a preceding
  \Macro{manualmark}
\begin{lstlisting}
  \automark[section]{chapter}
\end{lstlisting}
restores the original behaviour.  If one prefers lower section levels
in running headings, the following can be used:
\begin{lstlisting}
  \automark[subsection]{section}
\end{lstlisting}
How useful the last declaration is, everybody has to decide
for themselves.
\end{Example}

\begin{Explain}
  For the upper section level, the data of the headings is set by the
  command \Macro{markboth}\IndexCmd{markboth}, while that for the
  lower section level by \Macro{markright}\IndexCmd{markright} or
  \Macro{markleft}\IndexCmd{markleft}.  These commands are called
  indirectly by the sectioning commands.  The macro \Macro{markleft}
  is provided by the package \Package{scrpage2} and is defined
  similarly to \Macro{markright} in the {\LaTeX} kernel.  Although
  \Macro{markleft} is not defined as an internal command, the direct
  use is not recommended.
\end{Explain}
\EndIndex{Cmd}{automark}


\subsection{Formatting of Header and Footer}
\label{sec:scrpage.basics.format}
% \headfont \pnumfont
% \setheadwidth \setfootwidth
% \set(head|foot)(top|sep|bot)line
The previous section concerned itself mainly with the contents of the
header and footer. This is of course not sufficient to satisfy
formative ambitions. Therefore we devote this section exclusively to
this topic.
%
\BeginIndex{Cmd}{headfont}\BeginIndex{Cmd}{pnumfont}
\begin{Declaration}
\Macro{headfont}\\
\Macro{pnumfont}
\end{Declaration}%
The command \Macro{headfont} contains the commands which determine the
font of header and footer lines.  The style of the page number is
defined by the command \Macro{pnumfont}.
\begin{Example}
  If, for example, one wants the header and footer to be typeset in
  bold sans serif, and the page number in a slanted serif style, then
  one can use the following definitions:
\begin{lstlisting}
  \renewcommand{\headfont}{\normalfont\sffamily\bfseries}
  \renewcommand{\pnumfont}{\normalfont\rmfamily\slshape}
\end{lstlisting}
\end{Example}
\EndIndex{Cmd}{headfont}\EndIndex{Cmd}{pnumfont}
%
From version 2.8p of the {\KOMAScript} classes a new unified user
interface scheme is implemented for font attributes. If
\Package{scrpage2} is used together with one of these classes, then it
is recommended to set up font attributes in the manner described in
\autoref{sec:maincls.font}.
\begin{Example}
  Instead of \Macro{renewcommand} the command \Macro{setkomafont}
  should be used to configure the font attributes. The previous
  definitions can then be written as:
\begin{lstlisting}
  \setkomafont{pagehead}\normalfont\sffamily\bfseries}
  \setkomafont{pagenumber}{\normalfont\rmfamily\slshape}
\end{lstlisting}
\end{Example}

\BeginIndex{Cmd}{setheadwidth}\BeginIndex{Cmd}{setfootwidth}
\begin{Declaration}
\Macro{setheadwidth}\OParameter{shift}\Parameter{width}\\
\Macro{setfootwidth}\OParameter{shift}\Parameter{width}
\end{Declaration}%
Normally the widths of header and footer lines correspond to the width
of the text body.  The commands \Macro{setheadwidth} and
\Macro{setfootwidth} enable the user to adapt in a simple manner the
widths to his needs.  The mandatory argument \PName{width} takes the
value of the desired width of the page header or footer, while
\PName{shift} is a length parameter by which amount the appropriate
item is shifted toward the outside page edge.

For the most common situations the mandatory argument \PName{width}
accepts the following symbolic values:
\begin{labeling}[\,--]{\PValue{textwithmarginpar}}
\item[\PValue{paper}] the width of the paper
\item[\PValue{page}] the width of the page
\item[\PValue{text}] the width of the text body
\item[\PValue{textwithmarginpar}] the width of the text body including margin
\item[\PValue{head}] the current header width
\item[\PValue{foot}] the current footer width
\end{labeling}
The difference between \PValue{paper} and \PValue{page} is that
\PValue{page} means the width of the paper less the binding correction
if the package \Package{typearea}\IndexPackage{typearea} is used (see
\autoref{cha:typearea}). Without \Package{typearea} both values are
identical.

\begin{Example}
  Assume that one wants a layout like that of \emph{The
    {\LaTeX}\,Companion}, where the header projects into the
  margin. This can be obtained with:
\begin{lstlisting}
  \setheadwidth[0pt]{textwithmarginpar}
\end{lstlisting}
%
which appears like this on an odd page:
%
\begin{XmpTopPage}
        \XmpHeading{10,25}{85}
        \thinlines\XmpRule{10,23}{85}
        \XmpSetText[\XmpTopText]{10,21}
        \XmpMarginNote{83,11.8}
\end{XmpTopPage}
%
If the footer line should have the same width and alignment, then two
ways to set this up are possible. The first way simply repeats the
settings for the case of the footer line:
\begin{lstlisting}
  \setfootwidth[0pt]{textwithmarginpar}
\end{lstlisting}
%
In the second way the symbolic value \PValue{head} is used, since the
header already has the desired settings.
\begin{lstlisting}
  \setfootwidth[0pt]{head}
\end{lstlisting}
\end{Example}

If no \PName{shift} is indicated, i.\,e., without the optional argument,
then the header or footer appears arranged symmetrically on the page.
In other words, a value for the \PName{shift} is determined
automatically to correspond to the current page shape.
%
\begin{Example}
  Continuing with the previous example, we remove the optional
  argument:
\begin{lstlisting}
  \setheadwidth{textwithmarginpar}
\end{lstlisting}
%
which appears like this on an odd page:
%
\begin{XmpTopPage}
        \XmpHeading{5,25}{85}
        \thinlines\XmpRule{5,23}{85}
        \XmpSetText[\XmpTopText]{10,21}
        \XmpMarginNote{83,11.8}
\end{XmpTopPage}
\end{Example}

As can be seen, the header is now shifted inward, while the header
width has not changed. The shift is calculated in a way that the
configuration of the typearea become visible also here.
%
\EndIndex{Cmd}{setheadwidth}\EndIndex{Cmd}{setfootwidth}

\BeginIndex{Cmd}{setheadtopline}\BeginIndex{Cmd}{setheadsepline}
\BeginIndex{Cmd}{setfootseptline}\BeginIndex{Cmd}{setfootbotline}
\begin{Declaration}
\Macro{setheadtopline}\OParameter{length}\Parameter{thickness}\OParameter{commands}\\
\Macro{setheadsepline}\OParameter{length}\Parameter{thickness}\OParameter{commands}\\
\Macro{setfootsepline}\OParameter{length}\Parameter{thickness}\OParameter{commands}\\
\Macro{setfootbotline}\OParameter{length}\Parameter{thickness}\OParameter{commands}
\end{Declaration}%
Corresponding to the size configuration parameters of header and
footer there are commands to modify the lines above and below the
header and footer.

\begin{labeling}[\,--]{\Macro{setfootsepline}}
\item[\Macro{setheadtopline}] configures the line above the header
\item[\Macro{setheadsepline}] configures the line below the header
\item[\Macro{setfootsepline}] configures the line above the footer
\item[\Macro{setfootbotline}] configures the line below the footer
\end{labeling}

The mandatory argument \PName{thickness} determines how strongly the
line is drawn. The optional argument \PName{length} accepts the same
symbolic values as \PName{width} for \Macro{setheadwidth}, as well as
also a normal length expression.  As long as the optional argument
\PName{length} is not assigned a value, the appropriate line length
adapts automatically the width of the header or the footer.

Use \PValue{auto} in the length argument to restore this automation
for the length of a line.

The\ChangedAt{v2.2}{\Package{scrpage2}} optional argument
\PName{commands} may be used to specify additional commands to be
executed before the respective line is drawn.  For example, such
commands could be used for changing the
color\Index{header>color}\Index{footer>color}\Index{color>in
  header}\Index{color>in footer} of the line.  When using a
{\KOMAScript} class you could also use
\Macro{setkomafont}\IndexCmd{setkomafont} to specify commands for one
of the elements
\FontElement{headtopline}\IndexFontElement{headtopline},
\FontElement{headsepline}\IndexFontElement{headsepline},
\FontElement{footsepline}\IndexFontElement{footsepline},
\FontElement{footbottomline}\IndexFontElement{footbottomline}, or
\FontElement{footbotline}\IndexFontElement{footbotline}.  These can
then be extended via \Macro{addtokomafont}\IndexCmd{addtokomafont}.
See \autoref{sec:maincls.font} for details on the \Macro{setkomafont}
and \Macro{addkomafont} commands.

\begin{Declaration}
\XMacro{setheadtopline}\OParameter{\upshape\PValue{auto}}\Parameter{\upshape\PValue{current}}\\
\XMacro{setheadtopline}\OParameter{\upshape\PValue{auto}}\Parameter{}\\
\XMacro{setheadtopline}\OParameter{\upshape\PValue{auto}}\Parameter{}\OParameter{}
\end{Declaration}%
The arguments shown here for the command \Macro{setheadtopline} are of
course valid for the other three configuration commands too.

If the mandatory parameter has the value \PValue{current} or has been
left empty, then the line thickness is not changed.  This may be used
to modify the length of the line without changing its thickness.

If the optional argument \PName{commands} is omitted, then all command
settings that might have been specified before will remain active,
while an empty \PName{commands} argument will revoke any previously
valid commands.

\begin{Example}
  If the header, for example, is to be contrasted by a strong line of
  2\,pt above and a normal line of 0.4\,pt between header and body,
  one can achieve this with:
\begin{lstlisting}
  \setheadtopline{2pt}
  \setheadsepline{.4pt}
\end{lstlisting}
%
\begin{XmpTopPage}
        \XmpHeading{10,25}{70}
        \thinlines\XmpRule{10,23}{70}
        \thicklines\XmpRule{10,28}{70}
        \XmpSetText[\XmpTopText]{10,21}
        \XmpMarginNote{83,11.8}
\end{XmpTopPage}

To specify that this line is to be drawn also, e.\,g., in red color, you
would change the commands like this:
\begin{lstlisting}
  \setheadtopline{2pt}[\color{red}]
  \setheadsepline{.4pt}[\color{red}]
\end{lstlisting}
In this example, as well as in the following one, line color is
activated by applying the syntax of the
\Package{color}\IndexPackage{color} package, so this package must of
course be loaded. Since \Package{scrpage2} comes without built-in
color handling, any package providing color support may be used.

{\KOMAScript} classes also support the following way of color specification:
\begin{lstlisting}
  \setheadtopline{2pt}
  \setheadsepline{.4pt}
  \setkomafont{headtopline}[\color{red}]
  \setkomafont{headsepline}[\color{red}]
\end{lstlisting}

The automatic adjustment to the header and footer width is illustrated
in the following example:
\begin{lstlisting}
  \setfootbotline{2pt}
  \setfootsepline[text]{.4pt}
  \setfootwidth[0pt]{textwithmarginpar}
\end{lstlisting}

% \phantomsection for hyperref-\pageref-links jum-2001/11/24
\phantomsection\label{page:scrpage.autoLineLength}
\begin{XmpBotPage}
        \XmpHeading{10,18}{85}
        \thinlines\XmpRule{17,21}{70}
        \thicklines\XmpRule{10,16}{85}
        \XmpSetText[\XmpBotText]{10,33}
        \XmpMarginNote{83,24}
\end{XmpBotPage}
\end{Example}

Now not everyone will like the alignment of the line above the footer;
instead, one would expect the line to be left-aligned. This can only
be achieved with a global package option, which will be described
together with other package options in the next
\autoref{sec:scrpage.basics.options}.
\EndIndex{Cmd}{setheadtopline}\EndIndex{Cmd}{setheadsepline}
\EndIndex{Cmd}{setfootseptline}\EndIndex{Cmd}{setfootbotline}

\subsection{Package Options}\label{sec:scrpage.basics.options}
% head(in|ex)clude foot(in|ex)clude --> typearea
% headtopline headsepline footbotline footsepline (plain...)
% komastyle standardstyle
% markuppercase markusecase
% automark manualmark

\BeginIndex{Option}{headinclude}\BeginIndex{Option}{footinclude}
\BeginIndex{Option}{headexclude}\BeginIndex{Option}{footexclude}
\begin{Declaration}
\Option{headinclude}\\
\Option{headexclude}\\
\Option{footinclude}\\
\Option{footexclude}
\end{Declaration}%
These options determine whether the page header or the page footer are
considered as part of the page body for the calculation of the type
area.  The adjustments necessary by the use of these parameters are
made by the package \Package{typearea} (see
\autoref{sec:typearea.options}), if this package is loaded after
\Package{scrpage2}.  Important here is that when using a {\KOMAScript}
class, these options must be given for the document class and not for
the package \Package{scrpage2}, in order to be effective.
%
\EndIndex{Option}{headinclude}\EndIndex{Option}{footinclude}
\EndIndex{Option}{headexclude}\EndIndex{Option}{footexclude}

\BeginIndex{Option}{headtopline}\BeginIndex{Option}{plainheadtopline}
\BeginIndex{Option}{headsepline}\BeginIndex{Option}{plainheadsepline}
\BeginIndex{Option}{footsepline}\BeginIndex{Option}{plainfootsepline}
\BeginIndex{Option}{footbotline}\BeginIndex{Option}{plainfootbotline}
\begin{Declaration}
\Option{headtopline} and \Option{plainheadtopline}\\
\Option{headsepline} and \Option{plainheadsepline}\\
\Option{footsepline} and \Option{plainfootsepline}\\
\Option{footbotline} and \Option{plainfootbotline}
\end{Declaration}%
Basic adjustment of the lines under and over header and footer can be
made with these options.  These adjustments are then considered the
default for all page styles defined with \Package{scrpage2}.  If one
of these options is used, then a line thickness 0.4\,pt is set.

Since there is a corresponding \PValue{plain} page style to the
page style \PValue{scrheadings}, the corresponding line in the plain
style can also be configured with the \Option{plain\dots} options.
These \Option{plain} options do however work only if the corresponding
options without \Option{plain} are activated.  Thus,
\Option{plainheadtopline} shows no effect without the
\Option{headtopline} option set.

With these options, it is to be noted that the appropriate page part,
header or footer, is considered as a part of the text area for the
calculation of the type area in case a line has been activated.  This
means that, if the separation line between header and text is
activated with \Option{headsepline}, then the package
\Package{typearea} calculates the type area in such a way that the
page header is part of the text block automatically.

The conditions for the options of the preceding paragraph apply also
to this automation. That means that the package \Package{typearea}
must be loaded after \Package{scrpage2}, or that on use of a
{\KOMAScript} class, the options \Option{headinclude} and
\Option{footinclude} must be set explicitly with \Macro{documentclass}
in order to transfer header or footer line in the text area.
%
\EndIndex{Option}{headtopline}\EndIndex{Option}{plainheadtopline}
\EndIndex{Option}{headsepline}\EndIndex{Option}{plainheadsepline}
\EndIndex{Option}{footsepline}\EndIndex{Option}{plainfootsepline}
\EndIndex{Option}{footbotline}\EndIndex{Option}{plainfootbotline}

\BeginIndex{Option}{ilines}%
\BeginIndex{Option}{clines}%
\BeginIndex{Option}{olines}%
\Index{rule}\Index{line}%
\begin{Declaration}
\Option{ilines}\\
\Option{clines}\\
\Option{olines}
\end{Declaration}%
%
With the definition of the line lengths the case can arise where the
lengths are set correctly, but the justification is not as desired
because the line will be centered in the header or footer area.  With
the package options presented here, this specification can be modified
for all page styles defined with \Package{scrpage2}.  The option
\Option{ilines} sets the justification in such a way that the lines
align to the inside edge.  The option \Option{clines} behaves like the
default justification, and \Option{olines} aligns at the outside edge.

\begin{Example}
  The next example illustrates the influence of the
  option \Option{ilines}. Please compare to the example for
  \Macro{setfootsepline} on \autopageref{page:scrpage.autoLineLength}.
\begin{lstlisting}
  \usepackage[ilines]{scrpage2}
  \setfootbotline{2pt}  
  \setfootsepline[text]{.4pt}
  \setfootwidth[0pt]{textwithmarginpar}
\end{lstlisting}

The mere use of the option \Option{ilines} leads to the different
result shown below:
\begin{XmpBotPage}
        \XmpHeading{10,18}{85}
        \thinlines\XmpRule{10,21}{70}
        \thicklines\XmpRule{10,16}{85}
        \XmpSetText[\XmpBotText]{10,33}
        \XmpMarginNote{83,24}
\end{XmpBotPage}
In contrast to the default configuration, the separation line between
text and footer is now left-aligned, not centered.%
\end{Example}%
\EndIndex{Option}{ilines}\EndIndex{Option}{clines}\EndIndex{Option}{olines}%

% \phantomsection for hyperref-\pageref-links jum-2001/11/24
\phantomsection\label{page:scrpage.automark}%
\BeginIndex{Option}{automark}\BeginIndex{Option}{manualmark}
\begin{Declaration}
\Option{automark}\\
\Option{manualmark}
\end{Declaration}%
These options set at the beginning of the document whether to use
running headings or manual ones.  The option \Option{automark}
switches the automatic updating on, \Option{manualmark} deactivates
it.  Without the use of one of the two options, the setting which was
valid when the package was loaded is preserved, .
%
\begin{Example}
  You load the package \Package{scrpage2} directly after the document class
  \Class{scrreprt} without any package options:
\begin{lstlisting}
  \documentclass{scrreprt}
  \usepackage{scrpage2}
\end{lstlisting}
Since the default page style of \Class{scrreprt} is \PValue{plain},
this page style is also now still active.  Futhermore, \PValue{plain}
means manual headings.  If one now activates the page style
\PValue{scrheadings} with
\begin{lstlisting}
  \pagestyle{scrheadings}
\end{lstlisting}
then the manual headings are nevertheless still active.

If you instead use the document class \Class{scrbook}, then after
\begin{lstlisting}
  \documentclass{scrbook}
  \usepackage{scrpage2}
\end{lstlisting}
the page style \PValue{headings} is active and the running headings are
updated automatically.  Switching to the page style
\PValue{scrheadings} keeps this setting active.  The marking commands
of \Class{scrbook} continue to be used.

However, the use of
\begin{lstlisting}
  \usepackage[automark]{scrpage2}
\end{lstlisting}
activates running headings independently of the used document class.
The option does not of course affect the used page style \PValue{plain}
of the class \Class{scrreprt}. The headings are not visible until the
page style is changed to
\PValue{scrheadings}\IndexPagestyle{scrheadings}, \PValue{useheadings}
or another user-defined page style with headings.%
\end{Example}%
\EndIndex{Option}{automark}\EndIndex{Option}{manualmark}%

\BeginIndex{Option}{autooneside}
\begin{Declaration}
  \Option{autooneside}
\end{Declaration}%
This option ensures that the optional parameter of
\Macro{automark}\IndexCmd{automark} will be ignored automatically in
one-sided mode. See also the explanation of the command
\Macro{automark} in \autoref{sec:scrpage.basics.mark},
\autopageref{desc:scrpage.macro.automark}.
\EndIndex{Option}{autooneside}

\BeginIndex{Option}{komastyle}\BeginIndex{Option}{standardstyle}
\begin{Declaration}
\Option{komastyle}\\
\Option{standardstyle}
\end{Declaration}%
These options determine the look of the predefined page style
\PValue{scrheadings}. The option \Option{komastyle} configures a look
like that of the {\KOMAScript} classes.  This is the default for
{\KOMAScript} classes and can in this way also be set for other
classes.

The option \Option{standardstyle} configures a page style as it is
expected by the standard classes. Furthermore, the option
\Option{markuppercase} will be activated automatically, but only if
option \Option{markusedcase} is not given.
\EndIndex{Option}{komastyle}\EndIndex{Option}{standardstyle}

\BeginIndex{Option}{markuppercase}\BeginIndex{Option}{markusedcase}
\begin{Declaration}
\Option{markuppercase}\\
\Option{markusedcase}
\end{Declaration}%
In order to achieve the functionality of \Macro{automark}, the package
\Package{scrpage2} modifies internal commands which are used by the
document structuring commands to set the running headings.  Since some
classes, in contrast to the {\KOMAScript} classes, write the headings
in uppercase letters, \Package{scrpage2} has to know how the used
document class sets the headings.

Option \Option{markuppercase} shows \Package{scrpage2} that the
document class uses uppercase letters.  If the document class does not
set the headings in uppercase letters, then the option
\Option{markusedcase} should be given.  These options are not suitable
to force a representation; thus, unexpected effects may occur if the
given option does not match the actual behaviour of the document
class.
\EndIndex{Option}{markuppercase}\EndIndex{Option}{markusedcase}

\begin{Declaration}
  \Option{nouppercase}
\end{Declaration}%
\BeginIndex{Option}{nouppercase}%
In the previous paragraph dealing with \Option{markuppercase} and
\Option{markusedcase}, it has been already stated that some document
classes set the running headings\Index{heading} in uppercase letters
using the commands \Macro{MakeUppercase} or \Macro{uppercase}.
Setting the option \Option{nouppercase} allows disabling both these
commands in the headers and footers.  However, this is valid only for
page styles defined by \Package{scrpage2}, including
\PValue{scrheadings} and its corresponding \PValue{plain} page style.

The applied method is very brutal and can cause that desired changes
of normal letters to uppercase letters \Index{uppercase letters} do
not occur.  Since these cases do not occur frequently, the option
\Option{nouppercase} usually affords a useful solution.

\begin{Example}
  Your document uses the standard class \Class{book}\IndexClass{book},
  but you do not want the uppercase headings but mixed case
  headings. Then the preamble of your document could start with:
\begin{lstlisting}
  \documentclass{book}
  \usepackage[nouppercase]{scrpage2}
  \pagestyle{scrheadings}
\end{lstlisting}
  The selection of the page style \PValue{scrheadings} is necessary,
  since otherwise the page style \PValue{headings} is active, which
  does not respect the settings made by option \Option{nouppercase}.
\end{Example}

In some cases not only classes but also packages set the running
headings in uppercase letters.
Also in these cases the option \Option{nouppercase} should be able
to switch back to the normal mixed case headings.
\EndIndex{Option}{nouppercase}

\section{Defining Own Page Styles}\label{sec:scrpage.UI}
%
% 
\subsection{The Interface for Beginners}\label{sec:scrpage.UI.user}
% \deftripstyle
\BeginIndex{Cmd}{deftripstyle}\Index{page>style}

Now one would not like to remain bound to only the provided page
styles, but may wish to define one's own page styles.  Sometimes there
will be a special need, since a specific \emph{Corporate Identity} may
require the declaration of its own page styles.  The easiest way to
deal with this is:
\begin{Declaration}
\Macro{deftripstyle}\Parameter{name}%
\OParameter{LO}\OParameter{LI}%
\Parameter{HI}\Parameter{HC}\Parameter{HO}%
\Parameter{FI}\Parameter{FC}\Parameter{FO}
\end{Declaration}%
The individual parameters have the following meanings:
\begin{labeling}[\,--]{\PName{Name}}
\item[\PName{name}] the name of the page style, in order to activate it
        using the command \Macro{pagestyle}\Parameter{name}
\item[\PName{LO}] the thickness of the outside lines,
        i.\,e., the line above the header
        and the line below the footer (optional)
\item[\PName{LI}] the thickness of the separation lines,
        i.\,e., the line below the header
        and the line above the foot (optional)
\item[\PName{HI}] contents of the inside box in the page header for two-sided
        layout or left for one-sided layout
\item[\PName{HC}] contents of the centered box in the page header
\item[\PName{HO}] contents of the outside box in the page header for two-sided
        layout or right for one-sided layout
\item[\PName{FI}] contents of the inside box in the page footer for two-sided
        layout or left for one-sided layout
\item[\PName{FC}] contents of the centered box in the page footer
\item[\PName{FO}] contents of the outside box in the page footer for two-sided
        layout or right for one-sided layout
\end{labeling}

The command \Macro{deftripstyle} definitely represents the simplest
possibility of defining page styles.  Unfortunately, there are also
restrictions connected with this, since in a page range using a page
style defined via deftripstyle, no modification of the lines above and
below header and footer can take place.

\begin{Example}
  Assume a two-sided layout, where the running headings are placed on
  the inside.  Furthermore, the document title, here ``Report'', shall
  be placed outside in the header, the page number shall be centered
  in the footer.
\begin{lstlisting}
  \deftripstyle{TheReport}%
                {\headmark}{}{Report}%
                {}{\pagemark}{}
\end{lstlisting}

If moreover the lines above the header and below the footer shall be
drawn with a thickness of 2\,pt, and the text body be separated from
header and footer with 0.4\,pt lines, then the definition has to be
extended:
\begin{lstlisting}
  \deftripstyle{TheReport}[2pt][.4pt]%
                {\headmark}{}{Report}%
                {}{\pagemark}{}
\end{lstlisting}
%
\typeout{^^J--- Ignore underfull and overfull \string\hbox:}
\begin{center}\setlength{\unitlength}{1mm}\begin{picture}(100,50)\scriptsize
\thinlines
\put(5,0){\line(0,1){50}}
\put(55,0){\line(0,1){50}}
\put(5,50){\line(1,0){40}}
\put(55,50){\line(1,0){40}}
%
\thicklines
\put(45,0){\line(0,1){50}}
\put(95,0){\line(0,1){50}}
\put(5,0,){\line(1,0){40}}
\put(55,0){\line(1,0){40}}
%
\XmpHeading[Report\hfill 2. The Eye]{11,46}{30}
\XmpHeading[2.1 Retina\hfill Report]{59,46}{30}
\XmpHeading[\hfill 14\hfill]{11,6.5}{30}
\XmpHeading[\hfill 15\hfill]{59,6.5}{30}
\put(11,43){\makebox(0,0)[tl]{\parbox{30mm}{\tiny%
        \textbf{2.1 Retina}\\
        \XmpText[49]}}}
\put(59,43){\makebox(0,0)[tl]{\parbox{30mm}{\tiny%
        \XmpText[51]}}}
%
\thinlines
\XmpRule{11,44.5}{30}\XmpRule{59,44.5}{30}
\XmpRule{11,8}{30}\XmpRule{59,8}{30}
\linethickness{1pt}
\XmpRule{11,48}{30}\XmpRule{59,48}{30}
\XmpRule{11,5}{30}\XmpRule{59,5}{30}
\end{picture}\end{center}
\typeout{^^J--- Don't ignore underfull and overfull \string\hbox:^^J}
\end{Example}
\EndIndex{Cmd}{deftripstyle}

\subsection{The Interface for Experts}\label{sec:scrpage.UI.expert}
% \defpagestyle \newpagestyle \providepagestyle \renewpagestyle
\BeginIndex{Cmd}{defpagestyle}\BeginIndex{Cmd}{newpagestyle}
\BeginIndex{Cmd}{renewpagestyle}\BeginIndex{Cmd}{providepagestyle}
\Index{page>style}
Simple page styles, as they can be defined with \Macro{deftripstyle},
are fairly rare according to experience.  Either a professor requires
that the thesis looks like his or her own\,---\,and who seriously wants
to argue against such a wish?\,---\,or a company would like that half the
financial accounting emerges in the page footer.  No problem, the
solution is:
%
\begin{Declaration}
\Macro{defpagestyle}\Parameter{name}\Parameter{header definition}\Parameter{footer definition}\\
\Macro{newpagestyle}\Parameter{name}\Parameter{header definition}\Parameter{footer definition}\\
\Macro{renewpagestyle}\Parameter{name}\Parameter{header definition}\Parameter{footer definition}\\
\Macro{providepagestyle}\Parameter{name}\Parameter{header definition}\Parameter{footer definition}
\end{Declaration}%
These four commands give full access to the capabilities of
\Package{scrpage2} to define page styles.  Their structure is
indentical, they differ only in the manner of working.

\begin{labeling}[\,--]{\Macro{providepagestyle}}
\item[\Macro{defpagestyle}] defines a new page style.
If a page style with this name already exists it will be overwritten.
\item[\Macro{newpagestyle}] defines a new page style.
If a page style with this name already exists a error message will be given.
\item[\Macro{renewpagestyle}] redefines a page style.
If a page style with this name does not exist a error message will be given.
\item[\Macro{providepagestyle}] defines a new page style only if there is no page style with that name already present.
\end{labeling}

Using \Macro{defpagestyle} as an example, the syntax of the four
commands is explained below.
\begin{labeling}[\,--]{\PName{head definition}}
\item[\PName{name}] the name of the page style for
        \Macro{pagestyle}\Parameter{name}
\item[\PName{header definition}]  the declaration of the header, consisting
        of five element; elements in round parenthesis are optional:\\
\AParameter{ALL,ALT}\Parameter{EP}\Parameter{OP}\Parameter{OS}\AParameter{BLL,BLT}
\item[\PName{footer definition}]  the declaration of the footer, consisting
        of five element; elements in round parenthesis are optional:\\  
\AParameter{ALL,ALT}\Parameter{EP}\Parameter{OP}\Parameter{OS}\AParameter{BLL,BLT}
\end{labeling}

As can be seen, header and footer declaration have identical
structure.  The individual parameters have the following meanings:
\begin{labeling}[\,--]{\PName{OLD}}
\item[\PName{ALL}] above line length: (header = outside, footer = separation line)
\item[\PName{ALT}] above line thickness
\item[\PName{EP}]  definition for \emph{even} pages
\item[\PName{OP}]  definition for \emph{odd} pages
\item[\PName{OS}]  definition for \emph{one-sided} layout
\item[\PName{BLL}] below line length: (header = separation line, footer = outside)
\item[\PName{BLT}] below line thickness
\end{labeling}
If the optional line-parameters are omitted, then the line behaviour
remains configurable by the commands introduced in
\autoref{sec:scrpage.basics.format},
\autopageref{desc:scrpage.macro.setheadtopline}.

The three elements \PName{EP}, \PName{OP} and \PName{OS} are boxes
with the width of page header or footer, as appropriate.  The
corresponding definitions are set left-justified in the boxes. To set
something left- and right-justified into the boxes, the space between
two text elements can be stretched using \Macro{hfill}, in order to
write the first text element on the left edge \emph{and}:
%
\begin{lstlisting}
  {\headmark\hfill\pagemark}
\end{lstlisting}

If one would like a third text-element centered in the box, then an
extended definition must be used. The commands \Macro{rlap} and
\Macro{llap} simply write the given arguments, but for {\LaTeX} they
take up no horizontal space. Only in this way is the middle text
really centered.
%
\begin{lstlisting}
  {\rlap{\headmark}\hfill centered text\hfill\llap{\pagemark}}
\end{lstlisting}

This and the use of the expert interface in connection with other
commands provided by \Package{scpage2} follows now in the final
example.

\begin{Example}
  This examples uses the document class \Class{scrbook}, which means
  that the default page layout is two-sided.  The package
  \Package{scrpage2} is loaded with options \Option{automark} and
  \Option{headsepline}.  The first switches on the automatic update of
  running headings, the second determines that a separation line
  between header and text body is drawn in the \PValue{scrheadings}
  page style.

\begin{lstlisting}
  \documentclass{scrbook}
  \usepackage[automark,headsepline]{scrpage2}
\end{lstlisting}

The expert interface is used to define two page styles.  The page
style \PValue{withoutLines} does not define any line parameters.  The
second page style \PValue{withLines} defines a line thicknes of 1\,pt
for the line above the header and 0\,pt for the separation line
between header and text.

\begin{lstlisting}
  \defpagestyle{withoutLines}{%
    {Example\hfill\headmark}{\headmark\hfill without lines}
    {\rlap{Example}\hfill\headmark\hfill%
     \llap{without lines}}
  }{%
    {\pagemark\hfill}{\hfill\pagemark}
    {\hfill\pagemark\hfill}
  }
\end{lstlisting}

\begin{lstlisting}
  \defpagestyle{withLines}{%
    (\textwidth,1pt)
    {with lines\hfill\headmark}{\headmark\hfill with lines}
    {\rlap{\KOMAScript}\hfill \headmark\hfill%
     \llap{with lines}}
    (0pt,0pt)
  }{%
    (\textwidth,.4pt)
    {\pagemark\hfill}{\hfill\pagemark}
    {\hfill\pagemark\hfill}
    (\textwidth,1pt)
  }
\end{lstlisting}

Right at the beginning of the document the page style
\PValue{scrheadings} is activated.  The command \Macro{chapter} starts
a new chapter and automatically sets the page rstyle for this page to
\PValue{plain}. Even though not a prime example, the command
\Macro{chead} shows how running headings can be created even on a
\PValue{plain} page.  However, in principle running headings on
chapter start-pages are to be avoided, since otherwise the special
character of the \PValue{plain} page style is lost. It is more
important to indicate that a new chapter starts here than that a
section of this page has a special title.

\begin{Explain}% not important, only to enhance the paragraph breaking
Instead of \Macro{leftmark} one would expect
the use of \Macro{rightmark} in the parameter
of \Macro{chead}, since the chapter starts on an even
page. But, because of internal {\LaTeX} definitions,
this does not work. It only returns an empty string.
\end{Explain}
\begin{lstlisting}
  \begin{document}
  \pagestyle{scrheadings}
  \chapter{Thermodynamics}
  
  \chead[\leftmark]{}
  
  \section{Main Laws}
  Every system has an extensive state quantity called
  Energy. In a closed system the energy is constant.
\end{lstlisting}

\begin{XmpTopPage}
        \XmpHeading[\hfill\textsl{1. Thermodynamics}\hfill]{10,27}{70}
        \put(10,17){\normalsize\textbf{\sffamily 1.Thermodynamics}}
        \put(10,12){\textbf{\sffamily 1.1 Main Laws}}
        \XmpSetText[%
        Every System has an extensive state quantity]{10,9}
\end{XmpTopPage}

After starting a new page the page style \PValue{scrheadings} is
active and thus the separation line below the header is visible.
\begin{lstlisting}
  There is a state quatity of a system, called entropy, whose temporal
  change consists of entropy flow and entropy generation.
\end{lstlisting}
\begin{XmpTopPage}
        \XmpHeading[\textsl{1. Thermodynamics}\hfill]{20,27}{70}
        \thinlines\XmpRule{20,25}{70}
        \XmpSetText[%
          There is a condition unit of a system, called entropy,
          whose temporal change consists of entropy flow
          and entropy generation.]{20,20}
\end{XmpTopPage}

After switching to the next page, the automatic update of the running
headings is disabled using \Macro{manualmark}, and the page style
\PValue{withoutLines} becomes active.  Since no line parameters are
given in the definition of this page style, the default configuration
is used, which draws a separation line between header and text body
because \Package{scrpage2} was called with \Option{headsepline}.
\begin{XmpTopPage}
        \XmpHeading[\slshape Energy Conversion\hfill without lines]{10,27}{70}
        \thinlines\XmpRule{10,25}{70}
        \XmpSetText[%
        \textbf{\sffamily 1.2 Exergy and Anergy}\\
        During the transition of a system to an equilibrium state
  with its environment, the maximum work gainable is called
  exergy.]{10,21}
\end{XmpTopPage}

\begin{lstlisting}
  \manualmark
  \pagestyle{withoutLines}
  \section{Exergy and Anergy}\markright{Energy Conversion}
  During the transition of a system to an equilibrium state
  with its environment, the maximum work gainable is called
  exergy.
\end{lstlisting}

At the next page of the document, the page style \PValue{withLines} is
activated.  The line settings of its definition are taken in account
and the lines are drawn accordingly.
\begin{lstlisting}
  \pagestyle{mitLinien}
  \renewcommand{\headfont}{\itshape\bfseries}
  The portion of an energy not convertible in exergy
  is named anergy \Var{B}.
  \[ B = U + T (S_1 - S_u) - p (V_1 - V_u)\] 
  \end{document}
\end{lstlisting}
\begin{XmpTopPage}
        \XmpHeading[\itshape\bfseries with lines\hfill 1. Thermodynamics]{20,27}{70}
        \thicklines\XmpRule{20,29}{70}
        \XmpSetText[%
        The portion of an energy not convertible in exergy
        is named anergy $B$. 
  \[ B = U + T (S_1 - S_u) - p (V_1 - V_u)\] ]{20,20}
\end{XmpTopPage}
\end{Example}
\EndIndex{Cmd}{defpagestyle}\EndIndex{Cmd}{newpagestyle}
\EndIndex{Cmd}{renewpagestyle}\EndIndex{Cmd}{providepagestyle}

\subsection{Managing Page Styles}\label{sec:scrpage.UI.cfgFile}
% scrpage.cfg
\BeginIndex{File}{scrpage.cfg}
Before long the work with different page styles will establish a
common set of employed page styles, depending on taste and tasks.  In
order to make the management of page styles easier and avoid
time-consuming copy operations each time a new project is started,
\Package{scrpage2} reads the file \File{scrpage.cfg} after
initialisation.  This file can contain a set of user-defined page
styles which many projects can share.
\EndIndex{File}{scrpage.cfg}
\EndIndex{Package}{scrpage2}

%%% Local Variables:
%%% mode: latex
%%% coding: iso-latin-1
%%% TeX-master: "../guide"
%%% End: