summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/koma-script/scrpage.sty
blob: 396661cc31f18e4126e399f69b2889c771acdbc9 (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
%%
%% This is file `scrpage.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% scrpage.dtx  (with options: `scrpage,v1')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 1994-2010
%% Markus Kohm and any individual authors listed elsewhere in this file.
%% 
%% This file was generated from file(s) of the KOMA-Script bundle.
%% ---------------------------------------------------------------
%% 
%% It may be distributed under the conditions of the
%% LaTeX Project Public License in the version distributed together
%% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
%% 
%% This file may only be distributed together with a copy of the
%% KOMA-Script bundle.  You may however distribute the
%% KOMA-Script bundle without all such generated files.  See also
%% `lppl.txt' or `lppl-de.txt' for additional information.
%% 
%% The list of files belonging to KOMA-Script distribution is given in
%% the file `manifest.txt'.  See also `lppl.txt' or `lppl-de.txt' for
%% additional information.
%% 
%% If this file is a beta version, you may not be allowed to distribute
%% it.  Look at the comments below to see if this is the case.
%% 
%% English and German manuals are part of KOMA-Script bundle.
%% ----------------------------------------------------------
%% 
%% See `README'.
%% 
%% The KOMA-Script bundle (but maybe not this file) was based upon the
%% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
%% standard classes created by The LaTeX3 Project 1994-1996.  You may
%% find a complete unmodified copy of LaTeX2e at
%% <http://www.ctan.org/pub/tex-archive/macros/latex/base/>.
%% 
%%% From File: scrpage.dtx
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{scrpage}[2008/02/29 v1.3e KOMA-Script
                 package]
\DeclareOption{headinclude}{%
  \PassOptionsToPackage{headinclude}{typearea}%
}
\DeclareOption{headexclude}{%
  \PassOptionsToPackage{headexclude}{typearea}%
}
\DeclareOption{footinclude}{%
  \PassOptionsToPackage{footinclude}{typearea}%
}
\DeclareOption{footexclude}{%
  \PassOptionsToPackage{footexclude}{typearea}%
}
\ExecuteOptions{%
headinclude,footinclude%
}
\ProcessOptions\relax
\newif\if@chapter
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname chapter\endcsname\relax
  \@chapterfalse
\else
  \@chaptertrue
\fi
\def\@tempa{\newif\if@mainmatter\@mainmattertrue}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname mainmatter\endcsname\relax
\else
    \let\@tempa\relax
\fi
\@tempa
\let\headmark\relax
\DeclareRobustCommand\pagemark{{\pnumfont\thepage}}
\def\defpagestyle{%
  \@ifstar
  {\@defpagestyle[-]}%
  {\@defpagestyle[+]}}
\if@twoside
  \def\@defpagestyle[#1]#2#3#4{%
    \expandafter\def\csname ps@#2\endcsname{%
      \def\@tempa{+}%
      \def\@tempb{#1}%
      \ifx\@tempa\@tempb
        \let\@mkboth\markboth
        \if@chapter
          \def\chaptermark####1{%
            \markboth {\ifnum \c@secnumdepth >\m@ne%
              \if@mainmatter\chaptermarkformat\fi\fi ####1}{%
              \ifnum \c@secnumdepth >\m@ne%
              \if@mainmatter\chaptermarkformat\fi\fi ####1}}%
          \def\sectionmark####1{%
            \markright {\ifnum \c@secnumdepth >\z@%
              \sectionmarkformat\fi ####1}}%
        \else
          \def\sectionmark####1{%
            \markboth {\ifnum \c@secnumdepth >\z@%
              \if@mainmatter\sectionmarkformat\fi\fi ####1}{%
              \ifnum \c@secnumdepth >\z@%
              \if@mainmatter\sectionmarkformat\fi\fi ####1}}%
          \def\subsectionmark####1{%
            \markright {\ifnum \c@secnumdepth >\@ne%
              \subsectionmarkformat\fi ####1}}%
        \fi
      \else
        \let\@mkboth\@gobbletwo
        \if@chapter
          \def\chaptermark####1{}%
        \else
          \def\subsectionmark####1{}%
        \fi
        \def\sectionmark####1{}%
      \fi
      \def@twosidehead#3
      \def@twosidefoot#4
    }
  }
\else
  \def\@defpagestyle[#1]#2#3#4{%
    \expandafter\def\csname ps@#2\endcsname{%
      \def\@tempa{+}%
      \def\@tempb{#1}%
      \ifx\@tempa\@tempb
        \let\@mkboth\markboth
        \if@chapter
          \def\chaptermark####1{%
            \markright {\ifnum \c@secnumdepth >\m@ne%
              \if@mainmatter\chaptermarkformat\fi\fi ####1}}%
          \def\sectionmark####1{}%
        \else
          \def\sectionmark####1{%
            \markright{\ifnum \c@secnumdepth >\z@%
              \if@mainmatter\sectionmarkformat\fi\fi ####1}}%
          \def\subsectionmark####1{}%
        \fi
      \else
        \let\@mkboth\@gobbletwo
        \if@chapter
          \def\chaptermark####1{}%
        \else
          \def\subsectionmark####1{}%
        \fi
        \def\sectionmark####1{}%
      \fi
      \def@onesidehead#3
      \def@onesidefoot#4
    }
  }
\fi
\def\def@twosidehead(#1,#2)#3#4#5(#6,#7){%
  \def\@evenhead{\let\headmark\leftmark%
    \hss\hskip\@evenheadshift\vbox{\hsize=\@headwidth\relax%
      \hf@rule{#1}{#2}{\@headwidth}%
      \vskip#2
      \vskip\baselineskip
      \hb@xt@\@headwidth{{%
          \headfont\strut #3}}%
      \hf@rule{#6}{#7}{\@headwidth}%
  }\hskip\@oddheadshift\hss}%
  \def\@oddhead{\let\headmark\rightmark
    \hss\hskip\@oddheadshift\vbox{\hsize=\@headwidth\relax
      \hf@rule{#1}{#2}{\@headwidth}%
      \vskip#2%
      \vskip\baselineskip
      \hb@xt@\@headwidth{{%
          \headfont\strut #4}}%
      \hf@rule{#6}{#7}{\@headwidth}%
  }\hskip\@evenheadshift\hss}%
}
\def\def@onesidehead(#1,#2)#3#4#5(#6,#7){%
  \def\@evenhead{}%
  \def\@oddhead{\let\headmark\rightmark
    \hss\hskip\@oddheadshift\vbox{\hsize=\@headwidth\relax
      \hf@rule{#1}{#2}{\@headwidth}%
      \vskip#2%
      \vskip\baselineskip
      \hb@xt@\@headwidth{{%
          \headfont\strut #5}}%
      \hf@rule{#6}{#7}{\@headwidth}%
  }\hskip\@evenheadshift\hss}%
}
\def\def@twosidefoot(#1,#2)#3#4#5(#6,#7){%
  \def\@evenfoot{\let\headmark\leftmark
    \hss\hskip\@evenfootshift\vbox{\hsize=\@footwidth\relax
      \topfoot@rule{#1}{#2}\hb@xt@\@footwidth{{%
          \headfont\footfont\strut #3}}%
      \botfoot@rule{#6}{#7}}\hskip\@oddfootshift\hss}%
  \def\@oddfoot{\let\headmark\rightmark
    \hss\hskip\@oddfootshift\vbox{\hsize=\@footwidth\relax
      \topfoot@rule{#1}{#2}\hb@xt@\@footwidth{{%
          \headfont\footfont\strut #4}}%
      \botfoot@rule{#6}{#7}}\hskip\@evenfootshift\hss}%
}
\def\def@onesidefoot(#1,#2)#3#4#5(#6,#7){%
  \def\@evenfoot{}%
  \def\@oddfoot{\let\headmark\rightmark
    \hss\hskip\@oddfootshift\vbox{\hsize=\@footwidth\relax
      \topfoot@rule{#1}{#2}\hb@xt@\@footwidth{{%
          \headfont\footfont\strut #5}}
      \botfoot@rule{#6}{#7}}\hskip\@evenfootshift\hss}%
}

\newcommand\topfoot@rule[2]{%
  \@tempdima\baselineskip\advance\@tempdima by-.7\normalbaselineskip
  \advance\@tempdima by -#2
  \vskip\@tempdima\hf@rule{#1}{#2}{\@footwidth}%
  \vskip-\@tempdima}
\newcommand\botfoot@rule[2]{%
  \@tempdima-\baselineskip\advance\@tempdima by .3\normalbaselineskip
  \advance\@tempdima by #2
  \vskip\@tempdima\hf@rule{#1}{#2}{\@footwidth}%
}
\newcommand\hf@rule[3]{%
  \setlength{\@tempdimb}{#1}
      \setlength{\@tempdimb}{.5\@tempdimb}%
    \hb@xt@#3{%
        \hfill%
        \llap{\vrule\@depth#2\@height\z@\@width\@tempdimb}%
        \rlap{\vrule\@depth#2\@height\z@\@width\@tempdimb}%
        \hfill%
    }%
}
\def\newpagestyle{%
  \@ifstar
  {\@newpagestyle[-]}%
  {\@newpagestyle[+]}}
\def\@newpagestyle[#1]#2#3#4{%
  \expandafter\ifx\csname ps@#2\endcsname\relax
    \@defpagestyle[#1]{#2}{#3}{#4}%
  \else
    \PackageError
      {scrpage}%
      {Your command was ignored}%
      {There is already a pagestyle named ``#1''.\MessageBreak%
       Use \protect\defpagestyle\space, \protect\renewpagestyle or
       \protect\providepagestyle.}%
  \fi
}
\def\renewpagestyle{%
  \@ifstar
  {\@renewpagestyle[-]}%
  {\@renewpagestyle[+]}}
\def\@renewpagestyle[#1]#2#3#4{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname ps@#2\endcsname\relax
    \PackageError
      {scrpage}%
      {Your command was ignored}%
      {There is no pagestyle named ``#1''.\MessageBreak%
       Use \protect\defpagestyle, \protect\newpagestyle or
       \protect\providepagestyle.}%
  \else
    \@defpagestyle[#1]{#2}{#3}{#4}%
  \fi
}
\def\providepagestyle{%
  \@ifstar
  {\@providepagestyle[-]}%
  {\@providepagestyle[+]}}
\def\@providepagestyle[#1]#2#3#4{%
  \expandafter\ifx\csname ps@#2\endcsname\relax
    \@defpagestyle[#1]{#2}{#3}{#4}%
  \else
    \PackageInfo
      {scrpage}%
      {\protect\providepagestyle\protect{#1\protect} ignored.}%
  \fi
}
\def\deftripstyle{%
  \@ifstar
  {\@deftripstyle[-]}%
  {\@deftripstyle[+]}}
\def\@deftripstyle[#1]#2{%
  \@ifnextchar[%]
  {\@@deftripstyle[#1]{#2}}%
  {\@@deftripstyle[#1]{#2}[\z@]}}
\def\@@deftripstyle[#1]#2[#3]{%
  \def\@tempa{#1}%
  \@ifnextchar[%]
  {\@@@deftripstyle#2[#3]}%
  {\@@@deftripstyle#2[\z@][#3]}}
\def\@@@deftripstyle#1[#2][#3]#4#5#6#7#8#9{%
  \def\@tempb{+}%
  \ifx\@tempa\@tempb
    \defpagestyle{#1}%
      {(\@headwidth,#2)%
       {\rlap{#6}\hfill{#5}\hfill\llap{#4}}%
       {\rlap{#4}\hfill{#5}\hfill\llap{#6}}%
       {\rlap{#4}\hfill{#5}\hfill\llap{#6}}%
       (\@headwidth,#3)}%
      {(\@footwidth,#3)%
       {\rlap{#9}\hfill{#8}\hfill\llap{#7}}%
       {\rlap{#7}\hfill{#8}\hfill\llap{#9}}%
       {\rlap{#7}\hfill{#8}\hfill\llap{#9}}%
       (\@footwidth,#2)}%
  \else
    \defpagestyle*{#1}%
      {(\@headwidth,#2)%
       {\rlap{#6}\hfill{#5}\hfill\llap{#4}}%
       {\rlap{#4}\hfill{#5}\hfill\llap{#6}}%
       {\rlap{#4}\hfill{#5}\hfill\llap{#6}}%
       (\@headwidth,#3)}%
      {(\@footwidth,#3)%
       {\rlap{#9}\hfill{#8}\hfill\llap{#7}}%
       {\rlap{#7}\hfill{#8}\hfill\llap{#9}}%
       {\rlap{#7}\hfill{#8}\hfill\llap{#9}}%
       (\@footwidth,#2)}%
  \fi
}
\newcommand*{\settowidthof}[2]{%
  \edef\@tempa{#2}%
  \edef\@tempb{paper}\ifx\@tempa\@tempb
    \setlength{#1}{\paperwidth}%
  \else\edef\@tempb{text}\ifx\@tempa\@tempb
      \setlength{#1}{\textwidth}%
    \else\edef\@tempb{textwithmarginpar}\ifx\@tempa\@tempb
        \setlength{#1}{\textwidth}%
        \addtolength{#1}{\marginparwidth}%
        \addtolength{#1}{\marginparsep}%
      \else\edef\@tempb{head}\ifx\@tempa\@tempb
          \setlength{#1}{\@headwidth}%
        \else\edef\@tempb{foot}\ifx\@tempa\@tempb
            \setlength{#1}{\@footwidth}%
          \else\edef\@tempb{headtopline}\ifx\@tempa\@tempb
              \setlength{#1}{\scr@headabove@linelength}%
            \else\edef\@tempb{headsepline}\ifx\@tempa\@tempb
                \setlength{#1}{\scr@headbelow@linelength}%
              \else\edef\@tempb{footsepline}\ifx\@tempa\@tempb
                  \setlength{#1}{\scr@footabove@linelength}%
                \else\edef\@tempb{footbotline}\ifx\@tempa\@tempb
                    \setlength{#1}{\scr@footbelow@linelength}%
                  \else\edef\@tempb{page}\ifx\@tempa\@tempb
                      \setlength{#1}{\paperwidth}%
                      \begingroup\expandafter\expandafter\expandafter\endgroup
                      \expandafter\ifx\csname ta@bcor\endcsname\relax\else
                        \addtolength{#1}{-\ta@bcor}%
                      \fi
                    \else
                      \setlength{#1}{#2}%
                    \fi
                  \fi
                \fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
}
\newcommand*{\deftowidthof}[2]{%
  \edef\@tempa{#2}\edef\@tempb{autohead}\ifx\@tempa\@tempb
    \expandafter\def\csname #1\endcsname{\@headwidth}%
  \else\edef\@tempb{autofoot}\ifx\@tempa\@tempb
      \expandafter\def\csname #1\endcsname{\@footwidth}%
    \else
      \settowidthof{\@tempdima}{#2}%
      \expandafter\edef\csname #1\endcsname{\the\@tempdima}%
    \fi
  \fi
}
\newcommand*{\setheadwidth}[2][\@empty]{%
  \set@hf@width{head}{#1}{#2} %
}
\newcommand*{\setfootwidth}[2][\@empty]{%
  \set@hf@width{foot}{#1}{#2}%
}
\newcommand*{\set@hf@width}[3]{%
  \settowidthof{\@tempdima}{#3}%
  \ifdim\@tempdima>\paperwidth
    \PackageWarning
      {scrpage}%
      {You've set width of #1 to a value\MessageBreak
        greater than width of page!\MessageBreak%
        I`ll reduce width of #1 to width of page}%
    \setlength{\@tempdima}{\paperwidth}%
  \else
    \ifdim\@tempdima<\z@
       \PackageWarning
         {scrpage}%
         {You've set width of #1 to negative value!\MessageBreak%
           I'll set it to 0pt}%
       \setlength{\@tempdima}{\z@}%
     \fi
  \fi
  \expandafter\edef\csname @#1width\endcsname{\the\@tempdima}%
  \edef\@tempa{#2}%
  \setlength{\@tempdima}{\textwidth}%
  \addtolength{\@tempdima}{-\csname @#1width\endcsname}%
  \ifx\@tempa\@empty
    \if@twoside
      \setlength{\@tempdimb}{.3333333333\@tempdima}%
    \else
      \setlength{\@tempdimb}{.5\@tempdima}%
    \fi
  \else
    \setlength{\@tempdimb}{#2}%
  \fi
  \addtolength{\@tempdima}{-\@tempdimb}%
  \ifdim\@tempdimb<\z@
    \setlength{\@tempdimb}{-\@tempdimb}%
    \expandafter\edef\csname @odd#1shift\endcsname{-\the\@tempdimb}%
  \else
    \expandafter\edef\csname @odd#1shift\endcsname{\the\@tempdimb}%
  \fi
  \ifdim\@tempdima<\z@
    \setlength{\@tempdima}{-\@tempdima}%
    \expandafter\edef\csname @even#1shift\endcsname{-\the\@tempdima}%
  \else
    \expandafter\edef\csname @even#1shift\endcsname{\the\@tempdima}%
  \fi
}
\newcommand*{\@headwidth}{\textwidth}%
\newcommand*{\@oddheadshift}{\z@}%
\newcommand*{\@evenheadshift}{\z@}%
\newcommand*{\@footwidth}{\textwidth}%
\newcommand*{\@oddfootshift}{\z@}%
\newcommand*{\@evenfootshift}{\z@}%
\providecommand*{\pnumfont}{\normalfont}
\providecommand*{\headfont}{\normalfont%
}
\providecommand{\partmarkformat}         {\partname\ \thepart. \ }
\if@chapter
  \providecommand{\chaptermarkformat}    {\@chapapp\ \thechapter. \ }
  \providecommand{\sectionmarkformat}    {\thesection. \ }
\else
  \providecommand{\sectionmarkformat}    {\thesection\quad}
  \providecommand{\subsectionmarkformat} {\thesubsection\quad}
\fi
\InputIfFileExists{scrpage.cfg}
           {\typeout{*************************************^^J%
                     * Local config file scrpage.cfg used^^J%
                     *************************************}}
           {}
%%% From File: scrlogo.dtx
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `scrpage.sty'.