-
Notifications
You must be signed in to change notification settings - Fork 0
/
head.sty
109 lines (106 loc) · 4.02 KB
/
head.sty
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
% Latex2e version of the head.sty. It gives 3 position running headers
% and footers with optional horizontal lines below header and above
% the footer.
%
% User Commands are:
% \lhead{text} [default blank] Sets Left Header
% \chead{text} [default blank] Sets Central Header
% \rhead{text} [default blank] Sets Right Header
% \lfoot{text} [default blank] Sets Left footer
% \cfoot{text} [default pageno] Sets Central footer
% \rfoot{text} [default blank] Sets Right footer
% \headruleheight{length} [default 0] Sets header rule thickness
% \footruleheight{length} [default 0] Sets footer rule thickness
% \ruleseparation{length} [default 1ex] Distance to rule above/below
% header or footer.
%
% This version is compatible with the old 2.09 head.sty with the
% additions of the rules.
%
% Will Hossack, The University of Edinburgh
%
% Version 1.0 8/2/97
%
% Define the internal command buffers and lengths to hold the
% Header/Footer parameters
%
\typeout{Head style Version 1.0}
\newcommand{\@LeftHead}{}
\newcommand{\@CentreHead}{}
\newcommand{\@RightHead}{}
\newcommand{\@LeftFoot}{}
\newcommand{\@CentreFoot}{\rm\thepage}
\newcommand{\@RightFoot}{}
\newlength{\@HeadRuleHeight}
\newlength{\@FootRuleHeight}
\newlength{\@RuleSeparation}
\setlength{\@RuleSeparation}{1ex}
\newlength{\@HeadRuleSeparation}
\newlength{\@FootRuleSeparation}
%
% Define the user commands. They all just set command buffers
% or lengths.
%
\newcommand{\lhead}[1]{\renewcommand{\@LeftHead}{#1}}
\newcommand{\chead}[1]{\renewcommand{\@CentreHead}{#1}}
\newcommand{\rhead}[1]{\renewcommand{\@RightHead}{#1}}
\newcommand{\lfoot}[1]{\renewcommand{\@LeftFoot}{#1}}
\newcommand{\cfoot}[1]{\renewcommand{\@CentreFoot}{#1}}
\newcommand{\rfoot}[1]{\renewcommand{\@RightFoot}{#1}}
\newcommand{\headruleheight}[1]{\setlength{\@HeadRuleHeight}{#1}}
\newcommand{\footruleheight}[1]{\setlength{\@FootRuleHeight}{#1}}
\newcommand{\ruleseparation}[1]{\setlength{\@RuleSeparation}{#1}}
%
% Two intenal commands to build the actual headers and footers.
%
% There are FOUR parts to each header/footer, there being
% Left, Centre and Right text parts and the Rule. Each is set
% in a mbox of width zero to they their lengths will not effect
% their position on the page. The position of the rule is calculated
% as follows:
% Header: RuleSeparation+HeadRuleHeight BELOW the box containing header
% Footer: RuleSeparation ABOVE box containing footer.
%
\newcommand{\@ThreePartHead}[3]{%
\settodepth{\@HeadRuleSeparation}{#1 #2 #3}%
\addtolength{\@HeadRuleSeparation}{\@RuleSeparation}%
\addtolength{\@HeadRuleSeparation}{\@HeadRuleHeight}%
\makebox[0pt][l]{#1}\hfil%
\makebox[0pt]{\rule[-\@HeadRuleSeparation]{\textwidth}{\@HeadRuleHeight}}%
\makebox[0pt]{{#2}}\hfil%
\makebox[0pt][r]{#3}}
\newcommand{\@ThreePartFoot}[3]{%
\settoheight{\@FootRuleSeparation}{#1 #2 #3}%
\addtolength{\@FootRuleSeparation}{\@RuleSeparation}%
\makebox[0pt][l]{#1}\hfil%
\makebox[0pt]{\rule[\@FootRuleSeparation]{\textwidth}{\@FootRuleHeight}}%
\makebox[0pt]{{#2}}\hfil%
\makebox[0pt][r]{#3}}
%
% Use the ThreePartxxxx macros above to redefine the LaTeX
% internal commands of @odd/even/head/foot that are used to
% formatted the header and footer sections of the page.
% Remember if we are in twoside mode then reverse the
% Right/Left on the even pages.
%
\newcommand{\ps@threepartheading}{
\renewcommand{\@oddhead}{\@ThreePartHead{\@LeftHead}%
{\@CentreHead}{\@RightHead}}
\renewcommand{\@oddfoot}{\@ThreePartFoot{\@LeftFoot}%
{\@CentreFoot}{\@RightFoot}}
\if@twoside
\renewcommand{\@evenhead}{\@ThreePartHead{\@RightHead}
{\@CentreHead}{\@LeftHead}}
\renewcommand{\@evenfoot}{\@ThreePartFoot{\@RightFoot}
{\@CentreFoot}{\@LeftFoot}}
\else
\renewcommand{\@evenhead}{\@ThreePartHead{\@LeftHead}
{\@CentreHead}{\@RightHead}}
\renewcommand{\@evenfoot}{\@ThreePartFoot{\@LeftFoot}
{\@CentreFoot}{\@RightFoot}}
\fi
}
%
% Do the actual work .....
%
\ps@threepartheading