-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestheadwidth.tex
149 lines (115 loc) · 4.16 KB
/
testheadwidth.tex
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
\documentclass[oneside]{report}
\usepackage{xcolor}
\usepackage{boxedminipage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyleassign{plain}{fancy}
\setlength{\headheight}{40pt}
\fancyhead[L]{llllll llllll llllll llllll llllll llllll llllll\\
\color{red}\rule {\linewidth}{5mm}}
\fancyhead[C]{cccc cccc cc cc cccc cccc\\
\color{green}\rule{\linewidth}{3mm}}
\fancyhead[R]{rrrrrr rrrrrr rrrrrr rrrrrr rrrrrr rrrrrr rrrrrr\\
\color{blue}\rule {\linewidth}{2mm}}
\begin{document}
\chapter{Intro}
\noindent\begin{boxedminipage}{\textwidth}
Here the default widths are used. There is overlap.
\medskip
The header definitions:
\begin{verbatim}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyleassign{plain}{fancy}
\setlength{\headheight}{40pt}
\fancyhead[L]{llllll llllll llllll llllll llllll llllll llllll\\
\color{red}\rule {\linewidth}{5mm}}
\fancyhead[C]{cccc cccc cc cc cccc cccc\\
\color{green}\rule{\linewidth}{3mm}}
\fancyhead[R]{rrrrrr rrrrrr rrrrrr rrrrrr rrrrrr rrrrrr rrrrrr\\
\color{blue}\rule {\linewidth}{2mm}}
\end{verbatim}
\end{boxedminipage}
\bigskip
\newpage
\section{First section}
\noindent\begin{boxedminipage}{\textwidth}
Here we define the width of the left and right header fields. The
center field width isn't specified, so it remains the default
\verb|\headwidth|. And there is overlap between the center field and
the other ones, but it is still centered in the header, because the
total of all widths $>$ \verb|\headwidth|.
\begin{verbatim}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\end{verbatim}
\end{boxedminipage}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\newpage
\section{Second section}
\noindent\begin{boxedminipage}{\textwidth}
Here we define the widths of all three header fields. The total width
is $>$ \verb|\headwidth|. So there is overlap between the center field
and the other ones, but it is still centered in the header.
\begin{verbatim}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.5\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\end{verbatim}
\end{boxedminipage}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.5\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\newpage
\section{Third section}
\noindent\begin{boxedminipage}{\textwidth}
Here we define the widths of all three header fields. The total width
is $<$ \verb|\headwidth|. And there is no overlap between the center
field and the other ones (the center and right fields just touch each other),
so the center field is still centered in the header.
\begin{verbatim}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.2\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\end{verbatim}
\end{boxedminipage}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.2\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\newpage
\section{Fourth section}
\noindent\begin{boxedminipage}{\textwidth}
Here we define the widths of all three header fields. The total width
is $<$ \verb|\headwidth|. But there would be overlap between the center
field and the right field if the center field would be centered horizontally in the header.
So now it is centered between the left and right fields.
\begin{verbatim}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.25\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\end{verbatim}
\end{boxedminipage}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.25\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\newpage
\section{Fifth section}
\noindent\begin{boxedminipage}{\textwidth}
Now we add a header offset to the left.
\begin{verbatim}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.25\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\fancyhfoffset[L]{2cm}
\end{verbatim}
We change the offset after defining the field widths. The offset
changes \verb|\headwidth|, but we see that the changed
\verb|\headwidth| is pickup up by the header construction, because the
field widths are calculated at header construction time.
\end{boxedminipage}
\fancyheadwidth[L]{0.3\headwidth}
\fancyheadwidth[C]{0.25\headwidth}
\fancyheadwidth[R]{0.4\headwidth}
\fancyhfoffset[L]{2cm}
\end{document}