-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathfancyhdr.dtx
4713 lines (4703 loc) · 187 KB
/
fancyhdr.dtx
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
% \iffalse meta-comment
%
% Copyright (C) 1994-2021 by Pieter van Oostrum <pieter@vanoostrum.org>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{\jobname.dtx}
%</driver>
%
% \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
%<fancyhdr>\ProvidesPackage{fancyhdr}%
%<fancyheadings>\ProvidesPackage{fancyheadings}
%<extramarks>\ProvidesPackage{extramarks}
%<fancyhdr|fancyheadings|extramarks> [2021/01/28 v4.0.1
%<fancyhdr> Extensive control of page headers and footers]%
%<fancyheadings> Legacy package to call fancyhdr]
%<extramarks> Extra marks for LaTeX]
%<fancyhdr|extramarks>% Copyright (C) 1994-2021 by Pieter van Oostrum <pieter@vanoostrum.org>
%<fancyheadings>% Public domain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \end{macrocode}
%
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage{multicol}
\usepackage{float}
\usepackage{makeidx}
\usepackage{layout}
\usepackage{array}
\usepackage{booktabs}
\usepackage{boxedminipage}
\usepackage{fourier-orns}
\usepackage[T1]{fontenc}
\usepackage{url}
\usepackage[fit]{truncate}
\usepackage[colorlinks,linktocpage]{hyperref}
\usepackage{ifthen}
\usepackage{fancyhdr}
\GetFileInfo{fancyhdr.sty}
\def\latex/{\protect\LaTeX{}}
\def\tex/{\TeX}
\def\ams/{\protect\pAmS}
\def\pAmS{{\the\textfont2
A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
\def\amslatex/{\ams/-\latex/}
\newcommand{\PSNFSS}{{\sf
PSNFSS}}
\newcommand{\bs}{\symbol{'134}}
\newcommand{\env}[1]{\texttt{#1}}
\newcommand{\Package}[1]{\textsf{#1}}
\renewcommand{\partname}{Part}
\DisableCrossrefs
\CodelineIndex
\RecordChanges
\newcommand\bsbs{\cs{\char`\\}}
\newcommand{\Cmd}[1]{\texttt{\def\{{\char`\{}\def\}{\char`\}}\bs#1}}
\newcommand{\CmdIndex}[1]{\index{#1=\string\texttt{\bs#1}}}
\newcommand{\TTindex}[1]{\index{#1=\string\texttt{#1}}}
\newcommand{\PSindex}[1]{\index{page style>#1=\string\texttt{#1}}}
\newcommand{\OPTindex}[1]{\index{option>#1=\string\texttt{#1}}}
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.9}
\renewcommand{\textfraction}{0.05}
\setlength{\emergencystretch}{4em}
\addtolength{\textheight}{-0.5in} % make it print better on US letter paper
\makeatletter
\renewcommand\l@section {\@dottedtocline{1}{1.5em}{2.3em}}
\makeatother
\newenvironment{block}{\vspace{8pt}\noindent\begin{minipage}{\textwidth}}{\end{minipage}\vspace{8pt}}
\newenvironment{fblock}{\vspace{8pt}\noindent\begin{boxedminipage}{\textwidth}}{\end{boxedminipage}\vspace{8pt}}
\newcommand{\showrule}{\\[-1.5ex]\noindent\makebox[\textwidth]{\hrulefill}\\[\baselineskip]}
\newenvironment{xvspace}{\vspace{1ex}}{{\vspace{1ex}}}
\setcounter{tocdepth}{1}
% Compare section numbers in references
\usepackage{refcount}
\newcounter{secnum}
% #1=current section label #2=ref section label
\newcommand{\smartref}[2]{%
\setcounterref{secnum}{#1}%
\addtocounter{secnum}{-1}%
\ifnum\value{secnum}=\getrefnumber{#2}
the previous section%
\else
\addtocounter{secnum}{2}%
\ifnum\value{secnum}=\getrefnumber{#2}
the next section%
\else
section~\ref{#2}%
\fi
\fi
}
% Our own page style:
\pagestyle{fancy}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{0.5\marginparwidth}
\fancyhf{}
\fancyhead[L]{\rightmark}
\fancyhead[R]{\textbf{\thepage}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\quad#1}}
% Page style for demonstrating struts, \headruleskip and \footruleskip.
\newcommand{\strutheader}{%
\texttt{\textbackslash strut}:
\rule[-0.3\normalbaselineskip]{10pt}{0.3\normalbaselineskip}%
\rule{10pt}{0.7\normalbaselineskip}
\texttt{\textbackslash headruleskip}$\searrow$
\raisebox{-0.3\normalbaselineskip}[0pt][0pt]%
{\ifdim \headruleskip>0pt
\rule[-\headruleskip]{10pt}{\headruleskip}
\else
\rule{10pt}{-\headruleskip}
\fi}
}
\newcommand{\strutfooter}{%
\raisebox{0pt}[0pt][0pt]{%
\texttt{\textbackslash strut}:
\rule[-0.3\normalbaselineskip]{10pt}{0.3\normalbaselineskip}%
\rule{10pt}{0.7\normalbaselineskip}
\texttt{\textbackslash footruleskip} $\nearrow$
\rule[0.7\normalbaselineskip]{10pt}{\footruleskip}}%
}
\fancypagestyle{showstruts}{%
\fancyhead[L]{%
\ifthenelse{\value{page}=\pageref{showstruts}}%
{\strutheader}%
{\rightmark}%
}
\fancyfoot[L]{%
\ifthenelse{\value{page}=\pageref{showstruts}}%
{\strutfooter}%
{}%
}
\fancyheadinit{%
\ifthenelse{\value{page}=\pageref{showstruts}}%
{\renewcommand{\headruleskip}{4pt}}%
{\renewcommand{\headruleskip}{0pt}}%
}
\fancyfootinit{%
\ifthenelse{\value{page}=\pageref{showstruts}}%
{\renewcommand{\footrulewidth}{0.4pt}}%
{\renewcommand{\footrulewidth}{0pt}}%
}
}
% Change \MacroFont to have verbatim in normal size
\renewcommand{\MacroFont}%
{\fontencoding\encodingdefault
\fontfamily\ttdefault
\fontseries\mddefault
\fontshape\shapedefault
\normalsize}
\newcounter{example}
\newcommand{\Example}{%
\refstepcounter{example}%
\marginpar{\vspace{\baselineskip}\hfill Example \theexample\quad\quad}%
}
\newcommand{\FExample}{%
\refstepcounter{example}%
\makebox[0pt][r]{{Example \theexample}\quad\quad}%
}
\begin{document}
\DeleteShortVerb{\|}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
% \DoNotIndex{\@ne}
% \DoNotIndex{\advance,\begingroup,\catcode,\closein}
% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
%
% \title{The \Package{fancyhdr} and \Package{extramarks}
% packages\\{\normalsize version \fileversion.}}
% \author{Pieter van Oostrum\thanks{A considerable part of this documentation was
% written by George
% Gr\"atzer (University of Manitoba) in \emph{Notices Amer. Math. Soc.}
% Thanks, George!}\\
% Dept.\ of Computer Science\thanks{This was my employer at the time I developed this package.
% I am now retired.}\\
% Utrecht University}
%
% \maketitle
% \begin{abstract}
% This document describes how to customize the page layout of your LaTeX
% documents, i.e how to change page margings and sizes,
% headers and footers, and the
% proper placement of figures and tables (collectively called floats) on
% the page.
%
% This documentation describes version 4.0 or later of the
% \Package{fancyhdr} and \Package{extramarks} packages. The user
% documentation is valid for the versions 3.8 or later of the
% \Package{fancyhdr} package (except for the changes mentioned in
% section~\ref{sec:version-4}), and version 2.1 or later of the
% \Package{extramarks} package.
%
% \end{abstract}
%
% \tableofcontents
% \markright{Contents}
%
%\part{Introduction}
%
% This document contains four parts:
%
% Part I is a short documentation on
% the user commands of the \Package{fancyhdr} and \Package{extramarks} packages.
%
% Part II contains elaborate documentation on page layout in \latex/.
% This used to be the complete documentation of \Package{fancyhdr} and
% \Package{extramarks} for several years.
%
% Part III contains Questions and Answers.
%
% Part IV contains the annotated implementation.
%
% This document describes version 4 of \Package{fancyhdr}. This version
% is also described in the forthcoming edition 3 of \textit{The \latex/ Companion},
% whereas the previous editions describe version 3 of \Package{fancyhdr}.
% There are some significant differences between these versions. These
% are summarized in section~\ref{sec:version-4} on page~\pageref{sec:version-4}.
% Throughout this documentation it is mentioned when a specific feature
% is only available in version 4, or when there are differences between
% version 3 and 4.
%
% \section{Installation}
% \label{sec:installation}
%
% The preferred way to install this package is with a package installer.
% If you want to install it by hand, then first run the command
% \verb+tex fancyhdr.ins+ and then move the files \texttt{fancyhdr.sty},
% \texttt{extramarks.sty} and \texttt{fancyheadings.sty} to a place
% where \latex/ can find it, preferably in a directory similar to
% \texttt{.../texmf/tex/latex/fancyhdr/} in your \tex/ directory tree.
%
% \section{Using \Package{fancyhdr}}
%
% The package \Package{fancyhdr} gives you several commands to define
% headers and footers of the pages in a \latex/ document.
% You load the package with the following command in the preamble:
% \begin{quote}
% \verb|\usepackage|\oarg{options}\verb|{fancyhdr}|
% \end{quote}
% (Options are available since version~4.0)
% The following options are supported:
% \begin{center}
% \begin{tabular}{ l l }
% \toprule
% Option & Meaning \\
% \midrule
% \texttt{nocheck} & do not check the heights of the header and footer \\
% & (see section~\ref{sec:warning} on page~\pageref{page:warning})\\
% \texttt{compatV3} & keep some behaviour (now considered undesirable) as in version~3 \\
% & (see section~\ref{sec:options} and section~\ref{sec:warning} on
% page~\pageref{page:warning}) \\
% \texttt{headings} & redefine the \texttt{headings} page style to be fancy-based \\
% \texttt{myheadings} & redefine the \texttt{myheadings} page style to be fancy-based \\
% \bottomrule
% \end{tabular}
% \end{center}
% \OPTindex{nocheck}
% \OPTindex{compatV3}
% \OPTindex{headings}
% \OPTindex{myheadings}
% \DescribeMacro{\fancyhead}
% \DescribeMacro{\fancyfoot}
% \DescribeMacro{\fancyhf}
% \begin{verbatim}
% \fancyhead[places]{field}
% \fancyfoot[places]{field}
% \fancyhf[places]{field}
% \end{verbatim}
% Here \texttt{places} is a comma-separated list of places where
% \texttt{field} will be placed. There are 12 places defined: Left,
% Center and Right Headers and Footers, and both can be on Even or Odd
% pages. Each place therefore has 3 coordinates which are the inital
% letters of the above description: (1) \texttt{E} or \texttt{O}, (2) \texttt{L}, \texttt{C} or
% \texttt{R}, (3) \texttt{H} or \texttt{F}. So a place is given with 3
% letters, like \texttt{EOH}. A missing coordinate means: all
% possibilities, except for \cs{fancyhead} where \texttt{H} is implied
% and \cs{fancyfoot} where \texttt{F} is implied.
% \DescribeMacro{\fancyheadoffset}
% \DescribeMacro{\fancyfootoffset}
% \DescribeMacro{\fancyhfoffset}
% \begin{verbatim}
% \fancyheadoffset[places]{field}
% \fancyfootoffset[places]{field}
% \fancyhfoffset[places]{field}
% \end{verbatim}
% These define offsets to let the headers stick into the margin (or to
% the inside if negative). Places cannot contain the \texttt{C}
% specifier. See section~\ref{sec:book-examples} for more details.
%
% \DescribeMacro{\headrulewidth}
% \DescribeMacro{\footrulewidth}
% \DescribeMacro{\headruleskip}
% \DescribeMacro{\footruleskip}
% \DescribeMacro{\headrule}
% \DescribeMacro{\footrule}
% \DescribeMacro{\headwidth}
%
% \cs{headrulewidth} and \cs{footrulewidth} are macros to define the
% thickness of a line under the header and above the footer.
% \cs{headruleskip} and \cs{footruleskip} are macros that define the
% distance between the lines and the header and footer text,
% respectively. (But \cs{headruleskip} is only available since version~4.0.)
% \cs{headrule} and \cs{footrule} are macros to completely redefine
% these lines. And \cs{headwidth} is a length parameter that defines the
% total width of the headers and footers. See section~\ref{sec:book-examples} for more details.
%
% \DescribeMacro{\fancyheadinit}
% \DescribeMacro{\fancyfootinit}
% \DescribeMacro{\fancyhfinit}
%
% \cs{fancyheadinit} and \cs{fancyfootinit} can be used to define
% initialisation code for the header and footer, respectively, and
% \cs{fancyhfinit} defines both of these. These commands are only
% available in fancyhdr version~4.0 and later. See section~\ref{sec:change}.
%
% \DescribeMacro{\fancycenter}
% (Only in version~4.0 and later.) The command \cs{fancycenter} packs 3
% header fields into a full-width header. See section~\ref{sec:fancycenter}.
%
% \DescribeMacro{\iftopfloat}
% \DescribeMacro{\ifbotfloat}
% \DescribeMacro{\iffloatpage}
% \DescribeMacro{\iffootnote}
%
% The macros \cs{iftopfloat}, \cs{ifbotfloat}, \cs{iffloatpage} and
% \cs{iffootnote} are used to detect if there is a float on the top or
% the bottom of the page, or the page is a float page, or if there is
% a footnote at the bottom of the page. These can be used to choose
% different headers and/or footers if these conditions are met. See
% section~\ref{sec:float} for more details.
%
% \begin{quote}
% \DescribeMacro{\fancypagestyle}
% \verb|\fancypagestyle|\marg{style-name}\oarg{base-style}\marg{definitions}
% \end{quote}
% This command lets you (re)define page styles for use in special
% situations. See section~\ref{sec:fancypagestyle} for more details.
%
% \section{Using \Package{extramarks}}
% \label{sec:using-extramarks}
%
% The \Package{extramarks} gives you some extra marks in \latex/,
% besides the normal \cs{leftmark} and \cs{rightmark}, that are defined
% by the \cs{markboth} and \cs{markright} commands.
%
% \DescribeMacro{\firstleftmark}
% \DescribeMacro{\lastrightmark}
% \DescribeMacro{\firstrightmark}
% \DescribeMacro{\lastleftmark}
% \begin{verbatim}
% \firstleftmark
% \lastrightmark
% \firstrightmark
% \lastleftmark
% \end{verbatim}
%
% Standard \latex/ has two marks: a left and a right one. The standard
% command \cs{leftmark} gives you the last left mark on a page, and
% \cs{rightmark} gives you the first right one. These macros give you
% also the other combinations, where \cs{firstrightmark} =
% \cs{rightmark} and \cs{lastleftmark} = \cs{leftmark}. As with the
% standard marks, these are meant to be used in headers and footers. In
% other places they will not work properly.
% \begin{verbatim}
% \extramarks{aa}{bb}
% \firstleftxmark
% \firstrightxmark
% \topleftxmark
% \toprightxmark
% \lastleftxmark
% \lastrightxmark
% \firstxmark
% \lastxmark
% \topxmark
% \end{verbatim}
% The command \Cmd{extramarks\{aa\}\{bb\}} defines two extra marks,
% similar to the standard ones by \latex/, where \texttt{aa} is the left
% one and \texttt{bb} is the right one. The other commands are to
% extract these in the headers and footers, similar to the ones without
% the \texttt{x}. See sections~\ref{sec:scoop} and \ref{sec:xmarks} for more details.
%
% \newpage
% \part{Page Layout in \LaTeX}
%
% \section{Introduction}
% \label{sec:intro}
%
% A page in a \LaTeX{} document is built from various elements as shown in
% figure \ref{fig:layout}.
% \begin{figure}[htbp]
% \begin{center}
% \leavevmode
% \layout
% \vspace{1.5cm}
% \caption{Page elements. The values shown are those in effect in the current document, not the defaults.}
% \label{fig:layout}
% \end{center}
% \end{figure}
% \thispagestyle{plain}
% The body contains the main text of the document
% together with the so called floats (tables and figures).
%
% The pages are constructed by \LaTeX's output routine, which is quite
% complicated and should therefore not be modified. Some of the packages
% described in this paper contains small modifications to the output routine
% to accomplish things that cannot be done in another way. You should use
% these packages to get the desired result rather than fiddling with the
% output routine yourself.
%
% There are a number of things that you must be aware of:
% \begin{enumerate}
% \item The margins on the left are not called \cs{leftmargin}, but
% \cs{evensidemargin} (on even-numbered pages) and \cs{oddsidemargin}
% (on odd-numbered pages). In one-sided documents
% \cs{oddsidemargin} is used for either. \cs{leftmargin} is also a valid
% \latex/ parameter but it has a different use (namely the indentation of
% lists).
% \item Most of the parameters should not be changed in the middle of a
% document. Some changes might work at a pagebreak. If you want to change
% the height of a single page, you can use the \cs{enlargethispage}
% command.
% \end{enumerate}
%
% The margin notes
% area contains small pieces of information created by the \cs{marginpar}
% command. On twosided documents the margin notes appear on the left and right
% alternatively. The margin notes are not on fixed places with respect to the
% paper but at approximately the same height as the paragraph in which they
% appear. Due to the algorithm used to decide the placement of margin notes,
% in a twosided document unfortunately
% they may appear on the wrong side if they are close
% to a page break.
% If you want to put information on fixed places in the margins you may use
% the technique described in sections \ref{sec:movie} and \ref{sec:thumb}.
%
% The first part of this paper describes how to change the header and footer
% areas. The last part describes how to get your floats at the desired place.
%
% \section{Page headers and footers}
%
% The page headers and footers in \LaTeX{} are defined by the
% \cs{pagestyle} and \cs{pagenumbering} commands. \cs{pagestyle}
% defines the general contents of the headers and footers (e.g. where the
% page number will be printed), while
% \cs{pagenumbering} defines the format of the page number.
% \LaTeX{} has four standard page styles:
%
% \begin{center}
% \noindent
% \begin{tabular}{>{\tt}lp{9cm}}
% \toprule
% empty & no headers or footers \\
% plain & no header, footer contains page number centered \\
% headings & no footer, header contains name of chapter/section and/or
% subsection and page number \\
% myheadings & no footer, header contains page number and user
% supplied information \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% Although these are useful styles, they are quite limited. Additional page
% styles can be defined by defining commands of the form \cs{ps@xxx}. This
% command is executed when a \Cmd{pagestyle\{xxx\}} is given in the document.
% The \cs{ps@xxx} command should define the following
% commands for the contents of the headers and footers:
%
% \begin{center}
% \noindent
% \begin{tabular}{lp{9cm}}
% \toprule
% \cs{@oddhead} & header on odd numbered pages in two-sided documents
% (on all pages in one-sided) \\
% \cs{@evenhead} & header on even numbered pages in two-sided documents \\
% \cs{@oddfoot} & footer on odd numbered pages in two-sided documents
% (on all pages in one-sided) \\
% \cs{@evenfoot} & footer on even numbered pages in two-sided documents \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% These are not user commands, but rather ``variables'' that are used by
% \latex/'s output routine.
% As the command names contain the character '\texttt{@}', they should
% be defined in a package file, or otherwise be sandwiched between the commands
% \cs{makeatletter} and \cs{makeatother}.
%
% The \cs{pagenumbering} command defines the layout of the page number. It
% has a parameter from the following list:
%
% \begin{center}
% \begin{tabular}{>{\tt}ll}
% \toprule
% arabic & arabic numerals \\
% roman & lower case roman numerals \\
% Roman & upper case roman numerals \\
% alph & lower case letter \\
% Alph & upper case letter \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% The \Cmd{pagenumbering\{xxx\}} defines the command \cs{thepage} to be the
% expansion of the page number in the given notation \texttt{xxx}.
% The pagestyle command
% then would include \cs{thepage} in the appropriate place. Additionally
% the \cs{pagenumbering} command resets the page number to~1.
% The \cs{pagestyle} and \cs{pagenumbering} apply to the page that is
% being constructed, so they should be used at a location where it is clear
% to what page they apply (see section \ref{sec:change}).
%
%
% \section{What is \Package{fancyhdr}}
%
% The \Package{fancyhdr} macro package allows you to customize
% in \latex/ your page headers and footers in an easy way. You can
% define:
% \begin{itemize}
% \item three-part headers and footers
% \item decorative lines in headers and footers
% \item headers and footers wider than the width of the text
% \item multi-line headers and footers
% \item separate headers and footers for even and odd pages
% \item different headers and footers for chapter pages
% \item different headers and footer on pages with floats
% \end{itemize}
%
% Of course, you also have complete control over fonts, uppercase
% and lowercase displays, etc.
%
% \section{Simple use of \Package{fancyhdr}} To use this package
% install it is a place where \latex/ can find it (see
% section~\ref{sec:installation})\footnote{In most modern \tex/
% installation the package is already included.}, and include in the preamble of your document
% the commands:
%
% \PSindex{fancy}
% \begin{verbatim}
% \usepackage{fancyhdr}
% \pagestyle{fancy}
% \end{verbatim}
%
% We can visualize the page layout we can create with \Package{fancyhdr}
% as follows:
%
% \begin{fblock}
% \noindent\makebox[\textwidth]{LeftHeader\hfill
% CenteredHeader\hfill RightHeader}\showrule
% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
% \noindent\makebox[\textwidth]{\hrulefill}
% \noindent\makebox[\textwidth]{LeftFooter\hfill
% CenteredFooter\hfill RightFooter}
% \end{fblock}
%
% The LeftHeader and LeftFooter are left justified; the
% CenteredHeader and CenteredFooter are centered; the
% RightHeader and RightFooter are right justified.
%
% We define each of the six ``fields'' and the two decorative lines
% separately.
%
% \section{A simple example}
% \label{sec:simple}
%
% K. Grant is writing a report to Dean
% A. Smith, on ``The performance of new graduates'' with the
% following page layout:
%
% \begin{fblock}
% \noindent\makebox[\textwidth]{\hfill\textbf{The performance of new
% graduates}}\showrule
% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
% \noindent\makebox[\textwidth]{\rule{\textwidth}{2pt}}
% \noindent\makebox[\textwidth]{From: K. Grant\phantom{3}\hfill
% To: Dean A. Smith\hfill \phantom{From: K. Grant}3}
% \end{fblock}
%
% \noindent where ``3'' is the page number. The title: ``The
% performance of new graduates'' is bold. The rule above the footer is a
% bit thicker (2pt).
%
% This is accomplished by these commands following
% \Cmd{pagestyle\{fancy\}}\footnote{Note that version 1 of fancyheadings
% used the \cs{setlength} command to change the \texttt{\bs...rulewidth} parameters.}:
% \CmdIndex{fancyhead}
% \CmdIndex{fancyfoot}
% \CmdIndex{headrulewidth}
% \CmdIndex{footrulewidth}
% \begin{verbatim}
% \fancyhead[L,C]{}
% \fancyhead[R]{\textbf{The performance of new graduates}}
% \fancyfoot[L]{From: K. Grant}
% \fancyfoot[C]{To: Dean A. Smith}
% \fancyfoot[R]{\thepage}
% \renewcommand{\headrulewidth}{0.4pt}
% \renewcommand{\footrulewidth}{2pt}
% \end{verbatim}
% (The \cs{thepage} macro displays the current page number.
% \cs{textbf} puts it in bold face.)
%
% This is now fine, except that the first page does not need
% all these headers and footers. To eliminate all but the
% centered page number, issue the command
%
% \CmdIndex{thispagestyle}
% \begin{verbatim}
% \thispagestyle{plain}
% \end{verbatim}
% after the
% \Cmd{begin\{document\}}
% and the
% \CmdIndex{maketitle}
% \cs{maketitle}
% commands.
%
% Alternatively, issue
% \begin{verbatim}
% \thispagestyle{empty}
% \end{verbatim}
% if you do not want any headers or footers.
%
% In fact the standard \latex/ classes have the command \cs{maketitle}
% defined in such a way that a \Cmd{thispagestyle\{plain\}} is automatically
% issued. So if you \emph{do} want the fancy layout on a page containing
% \cs{maketitle} you must issue a \Cmd{thispagestyle\{fancy\}} after the
% \cs{maketitle}.
%
% \section{Fancy Centering}
% \label{sec:fancycenter}
%
% \textbf{Note:} This section only applies to \Package{fancyhdr} version~4.0
% and later\footnote{This comes from the \Package{nccfancyhdr}
% package by Alexander I. Rozhenko.}.
%
% The marks in a fancy header and footer are prepared using \cs{parbox}
% command. So, you can use multiline marks. In the header, they are
% aligned to the bottom line, but, in the footer, they are aligned to
% the top line. The maximum width of every mark is equal to the
% \cs{headwidth}. This can lead to overlapping of neighbouring marks.
%
% \DescribeMacro{\fancycenter}
% If you want to prepare marks in more traditional way in a line
% not exceeding the \cs{headwidth}, you can use
% the following command in any mark command:
% \begin{quote}
% \cs{fancycenter}\oarg{distance}\oarg{stretch}\\
% \verb| |\marg{left-mark}\marg{center-mark}\marg{right-mark}
% \end{quote}
% \CmdIndex{fancycenter}
% This command works like
% \begin{center}
% \verb|\hbox to\linewidth{|\marg{left-mark}\cs{hfil}\marg{center-mark}\cs{hfil}\marg{right-mark}\verb|}|
% \end{center}
% but does this more carefully trying to exactly center the central part of
% the text if possible. The solution for exact centering
% is applied if the width of \meta{center-mark} is less than
% \begin{quote}
% \verb|\linewidth - 2*(|\meta{stretch}\verb|*|\meta{distance}\verb| +|\\
% \verb| max(width(|\meta{left-mark}\verb|), width(|\meta{right-mark}\verb|)))|.
% \end{quote}
% Otherwise the \meta{center-mark} will slightly migrate to a shorter item
% (\meta{left-mark} or \meta{right-mark}), but at least \meta{distance}
% space between all parts of line is provided.
% The default values of \meta{distance} and \meta{stretch}
% are 1em and 3.
%
% If the \meta{center-mark} is empty, the \cs{fancycenter} is equivalent to
% the following command:
% \begin{center}
% \verb|\hbox to\linewidth {|\marg{left-mark}\verb|\hfil |\marg{right-mark}\verb|}|
% \end{center}
%
% You would use this in a header for example with
% \begin{quote}
% \verb|\fancyhead[C]{|\cs{fancycenter}\oarg{distance}\oarg{stretch}\\
% \verb| |\marg{left-mark}\marg{center-mark}\marg{right-mark}\verb|}|
% \end{quote}
% and leave the \texttt{[L,R]} parts empty.
%
% \textbf{Note 1}: If the whole of the \cs{fancycenter} is wider than
% \cs{headwidth} it will stick out on the right. See
% section~\ref{sec:longtitles} for possible solutions.
%
% \textbf{Note 2}: The usage of \cs{fancycenter} command is not limited to the
% argument of header/footer marks. You can use it anywhere in your document.
%
% \section{An example of two-sided printing}\label{two-sided}
%
% \TTindex{twoside}
% Some document classes, such as \verb|book.cls|, print two-sided by default: the even
% pages and the odd pages have different layouts; other document classes
% use the \verb|twoside| option to print two-sided.
%
% Now let us print the report two-sided. Let the above page
% layout be used for the odd (right-side) pages, and the
% following for the even (left-side) pages:
%
% \begin{fblock}
%
% \noindent\makebox[\textwidth]{\textbf{The performance of new
% graduates}\hfill}\showrule
% \noindent\makebox[\textwidth]{\hfill page body\hfill}\\[\baselineskip]
% \noindent\makebox[\textwidth]{\hrulefill}
% \noindent\makebox[\textwidth]{4\phantom{To: Dean A. Smith}\hfill
% From: K. Grant\hfill \phantom{4}To: Dean A. Smith}
%
% \end{fblock}
% \noindent where ``4'' is the page number.
%
% Here are the commands:
%
% \begin{verbatim}
% \fancyhead{} % clear all header fields
% \fancyhead[RO,LE]{\textbf{The performance of new graduates}}
% \fancyfoot{} % clear all footer fields
% \fancyfoot[LE,RO]{\thepage}
% \fancyfoot[LO,CE]{From: K. Grant}
% \fancyfoot[CO,RE]{To: Dean A. Smith}
% \renewcommand{\headrulewidth}{0.4pt}
% \renewcommand{\footrulewidth}{0.4pt}
% \end{verbatim}
%
% \CmdIndex{fancyhead}
% \CmdIndex{fancyfoot}
% The commands \cs{fancyhead} and \cs{fancyfoot}
% have an additional parameter between square brackets that specifies
% for which pages and/or parts of the header/footer they apply. The first
% \cs{fancyhead} command above omits this parameter, and thus applies to all
% header fields. In general this is only useful to get rid of the defaults or
% a previous definition, as is done here. Similar the \cs{fancyfoot} command
% without square brackets clears all footer fields. In this particular
% example it could be omitted as all footer fields have a value specified.
% The selectors that can be used
% between the square brackets are given in figure~\ref{fig:sel}. Selectors can be combined so
% \Cmd{fancyhead[LE,RO]\{text\}}
% will define the field for both the left header on even pages and the right
% header on odd pages. If you don't give an \texttt{E} or \texttt{O} the definition applies to
% both. Similar for \texttt{LRC}.
% The selectors may be given as uppercase or lowercase letters.
% \begin{figure}[htb]
% \begin{center}
% \leavevmode
% \begin{tabular}{|l|l|}
% \hline
% E & Even page \\
% O & Odd page \\
% \hline
% L & Left field \\
% C & Center field \\
% R & Right field \\
% \hline
% H & Header \\
% F & Footer \\
% \hline
% \end{tabular}
% \end{center}
% \caption{Selectors}
% \label{fig:sel}
% \end{figure}
%
% \CmdIndex{fancyhf}
% There is also a more general command \cs{fancyhf} that you can use to
% combine the specifications for headers and footers. This allows additional
% selectors \texttt{H} (header) and \texttt{F} (footer). In fact \cs{fancyhead} and
% \cs{fancyfoot} are just \cs{fancyhf} with \texttt{H} and \texttt{F} pre-specified, respectively.
%
% Again, you may
% use \Cmd{thispagestyle\{plain\}} for a simple page layout for
% page~1.
%
% \section{Redefining page style \texttt{plain}}
% \label{sec:pagestyle-plain}
%
% Some \latex/ commands, like \cs{chapter}, use the \cs{thispagestyle}
% command to automatically switch to the \texttt{plain} page style, thus
% ignoring the page style currently in effect.
%
% They do this by issuing a \verb+\thispagestyle{plain}+ command. The most
% well-known places where this could happen are:
% \begin{itemize}
% \item The first pages of chapters in the \texttt{book} and \texttt{report} class
% \item The first page of a document in the \texttt{article} class when \cs{maketitle} is used
% \item The first page of an index
% \end{itemize}
% but it could happen at other places depending on the class and the packages used.
%
% To customize even such pages you must redefine the \texttt{plain}
% page style. As we indicated before you could do this by defining the
% \cs{ps@plain} command, but \Package{fancyhdr} gives you an easier way
% with the \cs{fancypagestyle} command. This command can be used to
% redefine existing page styles (like \texttt{plain}) or to define new ones,
% e.g. if part of your document needs a different page style. This command
% has two mandatory parameters: the first one is the name of the page style to be defined, the
% second consists of commands that change the headers and/or footers, i.e.
% \verb|fancyhead| etc. Also allowed are changes to \cs{headrulewidth} and
% \cs{footrulewidth} or even \cs{headrule} and \cs{footrule}.
% The (re)defined page style uses the standard
% \texttt{fancy} definitions, amended by the definitions in the second
% parameter. In other words, those parts that are not redefined in the
% second parameter get their value from the \texttt{fancy} definition that
% is current. In particular, if the second parameter is empty, i.e. given
% as \verb+{}+, then the new page style is equal to page style
% \texttt{fancy}.
%
% As an example, let us redefine the \texttt{plain} style so that it will
% be the same as page style \texttt{fancy}:
% \begin{verbatim}
% \fancypagestyle{plain}{}
% \end{verbatim}
% Now when these special pages use the \texttt{plain} page style, they use your redefined version.
%
% As another example, let us
% redefine the \texttt{plain} style for the report in Section~\ref{two-sided} by
% making the page number bold and enclosing it in en-dashes without any rules.
% \PSindex{plain}
%
% \begin{verbatim}
% \fancypagestyle{plain}{%
% \fancyhf{}% clear all header and footer fields
% \fancyfoot[C]{\textbf{--~\thepage~--}} % except the center
% \renewcommand{\headrulewidth}{0pt}%
% \renewcommand{\footrulewidth}{0pt}%
% }
% \end{verbatim}
%
%
% \section{Defining other page styles}
% \label{sec:fancypagestyle}
%
% Just like redefining the \texttt{plain} page style in the previous
% section, you can define or redefine other page styles based on page
% style \texttt{fancy}. This is also done with the \cs{fancypagestyle}
% command. The general form of this command is:
% \begin{quote}
% \CmdIndex{fancypagestyle}
% \verb|\fancypagestyle|\marg{style-name}\oarg{base-style}\marg{definitions}
% \end{quote}
% As you see, there is an optional argument between the two mandatory arguments.
%
% For example:
% \begin{verbatim}
% \fancypagestyle{toc}{%
% \fancyhf{}%
% \fancyhead[RO]{\thepage}%
% \fancyhead[RO]{\textsl{TABLE OF CONTENTS}}%
% \fancyfoot[C]{\thepage}
% }
% \end{verbatim}
% This defines a special page style \texttt{toc} for use in the table
% of contents with \Cmd{pagestyle\{toc\}}.
% Inside the definition you can define the headers and/or footers,
% change the header and footer rules, and redefine commands like
% \cs{chaptermark} (see section~\ref{sec:options} for an example). The
% headers and footers and marks that are not redefined inside the
% \cs{fancypagestyle} definition, are taken from the global page style
% \texttt{fancy} values.
%
% You can also give an optional base page style to the
% \cs{fancypagestyle} command. Then the new page style will be based on
% the base style. This base style must be a \texttt{fancyhdr}-defined
% style. Also you should take care not to
% create circular dependencies. In this case the order of picking up the
% definitions (headers, footers, marks) is:
% \begin{enumerate}
% \item The definitions from the base style are taken.
% \item The definitions given in the \cs{fancypagestyle} command
% override and/or augment these.
% \item Any definitions that are not given by the two above, are taken
% from the environment at the time the new page style is used.
% \end{enumerate}
% Only the first two parts are embedded in the page style.
% When no base style is given, part 1 is null.
%
% The optional base style argument is only available since version~4.0. In
% this version it is also possible to redefine page style \texttt{fancy}
% in this way. In version~3.x and earlier this was not possible.
%
% If you want to restore the original default definitions
% from page style \texttt{fancy} as described in section~\ref{sec:default}, you can use
% \begin{verbatim}
% \fancypagestyle{myfancy}[fancydefault]{
% . . . override some here
% }
% \end{verbatim}
% \PSindex{fancydefault}
% Page style \texttt{fancydefault} is the version of page style
% \texttt{fancy} that has all the initialisation embedded. Contrary to
% this, page style \texttt{fancy} as defined in the package uses the
% same defaults, but doesn't have them embedded. It picks them up from
% the environment. So if the environment changes, because you redefine
% headers, footers, mark commands, etc, the functioning of page style
% \texttt{fancy} changes with it. The page style \texttt{fancydefault}
% does not change, however. However, \texttt{fancydefault} is only available
% since fancyhdr version~4.0.
%
% \section{Package options}
% \label{sec:options}
%
% \textbf{NOTE:} This section applies to fancyhdr version~4.0 and later.
%
% You can supply options to the \cs{usepackage} command:
% \begin{quote}
% \verb|\usepackage|\oarg{options}\verb|{fancyhdr}|
% \end{quote}
% % The following options are supported:
% \begin{center}
% \OPTindex{nocheck}\OPTindex{compatV3}\OPTindex{headings}\OPTindex{myheadings}
% \begin{tabular}{ l l }
% \toprule
% Option & Meaning \\
% \midrule
% \texttt{nocheck} & do not check the heights of the header and footer \\
% \texttt{compatV3} & keep some behaviour (now considered undesirable) as in version~3 \\
% \texttt{headings} & redefine the \texttt{headings} page style to be fancy-based \\
% \texttt{myheadings} & redefine the \texttt{myheadings} page style to be fancy-based \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% \begin{itemize}
% \item \OPTindex{nocheck}Option \texttt{nocheck} is described in section~\ref{sec:warning} on
% page~\pageref{page:warning}.
%
% \item \OPTindex{compatV3}Option \texttt{compatV3} keeps two fancyhdr
% version~3.x (or earlier) features that are now considered undesirable.
% \begin{enumerate}
% \item The automatic adjustment of \cs{headheight} or \cs{footskip}
% when these are too small. This causes the page layout to become
% inconsistent. See section~\ref{sec:warning} on
% page~\pageref{page:warning}.
% \item In these previous versions the changes to the
% \Package{fancyhdr} headers and footers (including those by
% \cs{fancyhead}, \cs{fancyheadoffset} and similar commands) are
% made globally, except within a page style defined by
% \cs{fancypagestyle}. That is, when these commands are given inside
% a \LaTeX{} group, they affect the whole document, not only the
% group. If your document depends on this behaviour, you can give
% the \texttt{compatV3} package option. However, this is only
% considered a short-time solution. You should change your document
% as soon as possible to work around this problem. In version~4.0 and
% later, without this option, the changes are always local.
% \end{enumerate}
% The option is scheduled to disappear in version~5 of
% \Package{fancyhdr}.
%
% \item \PSindex{headings}\PSindex{myheadings}\OPTindex{headings}\OPTindex{myheadings}
% The options \texttt{headings} and \texttt{myheadings} redefine the
% corresponding page style with fancyhdr commands (including a
% decorative line under the header), so that you can later select this
% page style as the page style for (part of) the
% document\footnote{These options were copied from the
% \texttt{nccfancyhdr} package, but contrary to that package, they are
% not automatically selected.}.
% \end{itemize}
%
% \PSindex{headings}
% The page style \texttt{headings} is in some aspects similar to the default page
% style \texttt{fancy} settings. In the \texttt{fancy} page style, the