]> git.saurik.com Git - wxWidgets.git/blame_incremental - utils/tex2rtf/docs/fancyhea.sty
minor clean up
[wxWidgets.git] / utils / tex2rtf / docs / fancyhea.sty
... / ...
CommitLineData
1% fancyheadings.sty version 1.92
2% Fancy headers and footers.
3% Piet van Oostrum, Dept of Computer Science, University of Utrecht
4% Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
5% Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!sun4nl!ruuinf!piet)
6% Sep 16, 1994
7% version 1.4: Correction for use with \reversemargin
8% Sep 29, 1994:
9% version 1.5: Added the \iftopfloat, \ifbotfloat and \iffloatpage commands
10% Oct 4, 1994:
11% version 1.6: Reset single spacing in headers/footers for use with
12% setspace.sty or doublespace.sty
13% Oct 4, 1994:
14% version 1.7: changed \let\@mkboth\markboth to
15% \def\@mkboth{\protect\markboth} to make it more robust
16% Dec 5, 1994:
17% version 1.8: corrections for amsbook/amsart: define \@chapapp and (more
18% importantly) use the \chapter/sectionmark definitions from ps@headings if
19% they exist (which should be true for all standard classes).
20% May 31, 1995:
21% version 1.9: The proposed \renewcommand{\headrulewidth}{\iffloatpage...
22% construction in the doc did not work properly with the fancyplain style.
23% June 1, 1995:
24% version 1.91: The definition of \@mkboth wasn't restored on subsequent
25% \pagestyle{fancy}'s.
26% June 1, 1995:
27% version 1.92: The sequence \pagestyle{fancyplain} \pagestyle{plain}
28% \pagestyle{fancy} would erroneously select the plain version.
29
30\def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}}
31\def\@xlhead[#1]#2{\gdef\@elhead{#1}\gdef\@olhead{#2}}
32\def\@ylhead#1{\gdef\@elhead{#1}\gdef\@olhead{#1}}
33
34\def\chead{\@ifnextchar[{\@xchead}{\@ychead}}
35\def\@xchead[#1]#2{\gdef\@echead{#1}\gdef\@ochead{#2}}
36\def\@ychead#1{\gdef\@echead{#1}\gdef\@ochead{#1}}
37
38\def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}}
39\def\@xrhead[#1]#2{\gdef\@erhead{#1}\gdef\@orhead{#2}}
40\def\@yrhead#1{\gdef\@erhead{#1}\gdef\@orhead{#1}}
41
42\def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
43\def\@xlfoot[#1]#2{\gdef\@elfoot{#1}\gdef\@olfoot{#2}}
44\def\@ylfoot#1{\gdef\@elfoot{#1}\gdef\@olfoot{#1}}
45
46\def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
47\def\@xcfoot[#1]#2{\gdef\@ecfoot{#1}\gdef\@ocfoot{#2}}
48\def\@ycfoot#1{\gdef\@ecfoot{#1}\gdef\@ocfoot{#1}}
49
50\def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
51\def\@xrfoot[#1]#2{\gdef\@erfoot{#1}\gdef\@orfoot{#2}}
52\def\@yrfoot#1{\gdef\@erfoot{#1}\gdef\@orfoot{#1}}
53
54\newdimen\headrulewidth
55\newdimen\footrulewidth
56\newdimen\plainheadrulewidth
57\newdimen\plainfootrulewidth
58\newdimen\headwidth
59\newif\if@fancyplain
60\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}
61
62% Command to reset various things in the headers:
63% a.o. single spacing (taken from setspace.sty)
64% and the catcode of ^^M (so that epsf files in the header work if a
65% verbatim crosses a page boundary)
66\def\fancy@reset{\restorecr
67 \def\baselinestretch{1}%
68 \ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
69 \ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
70 \else% NFSS (2.09) present
71 \@newbaseline%
72 \fi}
73
74% Initialization of the head and foot text.
75
76\headrulewidth 0.4pt
77\footrulewidth\z@
78\plainheadrulewidth\z@
79\plainfootrulewidth\z@
80
81\lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
82% i.e. empty on ``plain'' pages, \rightmark on even, \leftmark on odd pages
83\chead{}
84\rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
85% i.e. empty on ``plain'' pages, \leftmark on even, \rightmark on odd pages
86\lfoot{}
87\cfoot{\rm\thepage} % page number
88\rfoot{}
89
90% Put together a header or footer given the left, center and
91% right text, fillers at left and right and a rule.
92% The \lap commands put the text into an hbox of zero size,
93% so overlapping text does not generate an errormessage.
94
95\def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\hbox
96{\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill
97\parbox[b]{\headwidth}{\centering#3\strut}\hfill
98\llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5}
99
100
101\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\footrule
102\hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill
103\parbox[t]{\headwidth}{\centering#3\strut}\hfill
104\llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5}
105
106\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
107\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}
108
109\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
110\vskip-0.3\normalbaselineskip\vskip-\footrulewidth
111\hrule\@width\headwidth\@height\footrulewidth\vskip0.3\normalbaselineskip}}
112
113\def\ps@fancy{%
114\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%for amsbook
115\@ifundefined{chapter}{\def\sectionmark##1{\markboth
116{\uppercase{\ifnum \c@secnumdepth>\z@
117 \thesection\hskip 1em\relax \fi ##1}}{}}%
118\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
119 \thesubsection\hskip 1em\relax \fi ##1}}}%
120{\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth>\m@ne
121 \@chapapp\ \thechapter. \ \fi ##1}}{}}
122\def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@
123 \thesection. \ \fi ##1}}}}%
124\csname ps@headings\endcsname % use \ps@headings defaults if they exist
125\ps@@fancy
126\gdef\ps@fancy{\@fancyplainfalse\ps@@fancy}%
127\headwidth\textwidth}
128\def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
129\def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
130\def\ps@@fancy{%
131\def\@mkboth{\protect\markboth}%
132\def\@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd}%
133\def\@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd}%
134\def\@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd}%
135\def\@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd}%
136}
137\def\@lodd{\if@reversemargin\hss\else\relax\fi}
138\def\@rodd{\if@reversemargin\relax\else\hss\fi}
139
140\let\latex@makecol\@makecol
141\def\@makecol{\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
142\def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
143\def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
144\def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}
145