source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/doc/fancyheadings.sty @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 4 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 9.1 KB
Line 
1% fancyheadings.sty version 1.98
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 2531806. Email: piet@cs.ruu.nl
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% June 1, 1995:
30% version 1.93: \fancypagestyle command added.
31% Dec 11, 1995:
32% version 1.94: suggested by Conrad Hughes <chughes@maths.tcd.ie>
33% CJCH, Dec 11, 1995: added \footruleskip to allow control over footrule
34% position (old hardcoded value of .3\normalbaselineskip is far too high
35% when used with very small footer fonts).
36% Jan 31, 1996:
37% version 1.95: call \@normalsize in the reset code if that is defined,
38% otherwise \normalsize.
39% this is to solve a problem with ucthesis.cls, as this doesn't
40% define \@currsize. Unfortunately for latex209 calling \normalsize doesn't
41% work as this is optimized to do very little, so there \@normalsize should
42% be called. Hopefully this code works for all versions of LaTeX known to
43% mankind. 
44% April 25, 1996:
45% version 1.96: initialize \headwidth to a magic (negative) value to catch
46% most common cases that people change it before calling \pagestyle{fancy}.
47% Note it can't be initialized when reading in this file, because
48% \textwidth could be changed afterwards. This is quite probable.
49% We also switch to \MakeUppercase rather than \uppercase and introduce a
50% \nouppercase command for use in headers. and footers.
51% May 3, 1996:
52% version 1.97: Two changes:
53% 1. Undo the change in version 1.8 (using the pagestyle{headings} defaults
54% for the chapter and section marks. The current version of amsbook and
55% amsart classes don't seem to need them anymore. Moreover the standard
56% latex classes don't use \markboth if twoside isn't selected, and this is
57% confusing as \leftmark doesn't work as expected.
58% 2. include a call to \ps@empty in ps@@fancy. This is to solve a problem
59% in the amsbook and amsart classes, that make global changes to \topskip,
60% which are reset in \ps@empty. Hopefully this doesn't break other things.
61% May 7, 1996:
62% version 1.98:
63% Added % after the line  \def\nouppercase
64% BY THE WAY, THIS IS THE LAST RELEASE OF VERSION 1.
65
66\let\fancy@def\gdef
67\def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}}
68\def\@xlhead[#1]#2{\fancy@def\@elhead{#1}\fancy@def\@olhead{#2}}
69\def\@ylhead#1{\fancy@def\@elhead{#1}\fancy@def\@olhead{#1}}
70
71\def\chead{\@ifnextchar[{\@xchead}{\@ychead}}
72\def\@xchead[#1]#2{\fancy@def\@echead{#1}\fancy@def\@ochead{#2}}
73\def\@ychead#1{\fancy@def\@echead{#1}\fancy@def\@ochead{#1}}
74
75\def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}}
76\def\@xrhead[#1]#2{\fancy@def\@erhead{#1}\fancy@def\@orhead{#2}}
77\def\@yrhead#1{\fancy@def\@erhead{#1}\fancy@def\@orhead{#1}}
78
79\def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
80\def\@xlfoot[#1]#2{\fancy@def\@elfoot{#1}\fancy@def\@olfoot{#2}}
81\def\@ylfoot#1{\fancy@def\@elfoot{#1}\fancy@def\@olfoot{#1}}
82
83\def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
84\def\@xcfoot[#1]#2{\fancy@def\@ecfoot{#1}\fancy@def\@ocfoot{#2}}
85\def\@ycfoot#1{\fancy@def\@ecfoot{#1}\fancy@def\@ocfoot{#1}}
86
87\def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
88\def\@xrfoot[#1]#2{\fancy@def\@erfoot{#1}\fancy@def\@orfoot{#2}}
89\def\@yrfoot#1{\fancy@def\@erfoot{#1}\fancy@def\@orfoot{#1}}
90
91\newdimen\headrulewidth
92\newdimen\footrulewidth
93\newdimen\plainheadrulewidth
94\newdimen\plainfootrulewidth
95\newdimen\headwidth
96\newdimen\footruleskip
97\newif\if@fancyplain \@fancyplainfalse
98\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}
99\headwidth=-123456789sp %magic constant
100
101% Command to reset various things in the headers:
102% a.o.  single spacing (taken from setspace.sty)
103% and the catcode of ^^M (so that epsf files in the header work if a
104% verbatim crosses a page boundary)
105% It also defines a \nouppercase command that disables \uppercase and
106% \Makeuppercase. It can only be used in the headers and footers.
107\def\fancy@reset{\restorecr
108 \def\baselinestretch{1}%
109 \def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax##1}}%
110 \ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
111   \ifx\@normalsize\undefined \normalsize % for ucthesis.cls
112   \else \@normalsize \fi
113 \else% NFSS (2.09) present
114  \@newbaseline%
115 \fi}
116
117% Initialization of the head and foot text.
118
119\headrulewidth 0.4pt
120\footrulewidth\z@
121\plainheadrulewidth\z@
122\plainfootrulewidth\z@
123\footruleskip .3\normalbaselineskip
124
125\lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
126%  i.e. empty on ``plain'' pages, \rightmark on even, \leftmark on odd pages
127\chead{}
128\rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
129%  i.e. empty on ``plain'' pages, \leftmark on even, \rightmark on odd pages
130\lfoot{}
131\cfoot{\rm\thepage} % page number
132\rfoot{}
133
134% Put together a header or footer given the left, center and
135% right text, fillers at left and right and a rule.
136% The \lap commands put the text into an hbox of zero size,
137% so overlapping text does not generate an errormessage.
138
139\def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\hbox
140{\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill
141\parbox[b]{\headwidth}{\centering#3\strut}\hfill
142\llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5}
143
144\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\footrule
145\hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill
146\parbox[t]{\headwidth}{\centering#3\strut}\hfill
147\llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5}
148
149\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
150\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}
151
152\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
153\vskip-\footruleskip\vskip-\footrulewidth
154\hrule\@width\headwidth\@height\footrulewidth\vskip\footruleskip}}
155
156\def\ps@fancy{%
157\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%for amsbook
158% Define \MakeUppercase for old LaTeXen.
159% Note: we used \def rather than \let, so that \let\uppercase\relax (from
160% the original documentation) will still work.
161\@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}
162\@ifundefined{chapter}{\def\sectionmark##1{\markboth
163{\MakeUppercase{\ifnum \c@secnumdepth>\z@
164 \thesection\hskip 1em\relax \fi ##1}}{}}%
165\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
166 \thesubsection\hskip 1em\relax \fi ##1}}}%
167{\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum \c@secnumdepth>\m@ne
168 \@chapapp\ \thechapter. \ \fi ##1}}{}}
169\def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c@secnumdepth >\z@
170 \thesection. \ \fi ##1}}}}%
171%\csname ps@headings\endcsname % use \ps@headings defaults if they exist
172\ps@@fancy
173\gdef\ps@fancy{\@fancyplainfalse\ps@@fancy}%
174% Initialize \headwidth if the user didn't
175\ifdim\headwidth<0sp
176% This catches the case that \headwidth hasn't been initialized and the
177% case that the user added something to \headwidth in the expectation that
178% it was initialized to \textwidth. We compensate this now. This loses if
179% the user intended to multiply it by a factor. But that case is more
180% likely done by saying something like \headwidth=1.2\textwidth The doc
181% says you have to change \headwidth after the first call to,
182% \pagestyle{fancy}. This code is just to catch the most common cases were
183% that requirement is violated.
184    \advance\headwidth123456789sp\advance\headwidth\textwidth\fi}
185\def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
186\def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
187\def\ps@@fancy{%
188\ps@empty % This is for amsbook/amsart, which do strange things with \topskip
189\def\@mkboth{\protect\markboth}%
190\def\@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd}%
191\def\@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd}%
192\def\@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd}%
193\def\@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd}%
194}
195\def\@lodd{\if@reversemargin\hss\else\relax\fi}
196\def\@rodd{\if@reversemargin\relax\else\hss\fi}
197
198\let\latex@makecol\@makecol
199\def\@makecol{\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
200\def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
201\def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
202\def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}
203
204\newcommand{\fancypagestyle}[2]{%
205  \@namedef{ps@#1}{\let\fancy@def\def#2\relax\ps@fancy}}
Note: See TracBrowser for help on using the repository browser.