-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample34e.tex
57 lines (42 loc) · 1.61 KB
/
example34e.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
\documentclass[oneside]{book}
\usepackage{kantlipsum}
\usepackage{boxedminipage}
\usepackage[twoside]{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{35pt}
\fancyhead[LE,RO]{\nouppercase{\rightmark}} % Section title
\fancyhead[LO,RE]{\nouppercase{\leftmark}} % Chapter title
\fancyfoot[LE,RO]{\thepage}
\fancyheadwidth*[L,R][tj]{0.48\headwidth}
\fancyfootwidth*[LE,RO][-c]{0.1\headwidth}
\begin{document}
\thispagestyle{plain}
\tableofcontents
\bigskip
\noindent
\begin{boxedminipage}{\textwidth}
This is example 34e in the \texttt{fancyhdr} documentation.
This document has some very long chapter and section titles. We use the \verb|\fancyheadwidth| command to fit the titles each in their own half of the header (actually slightly less than half). This command is available in \texttt{fancyhdr} version 5.0 and later. We use the second optional parameter to specify the alignment.
We also use \verb|\fancyfootwidth| to specify the width and alignment of the page number in the footer.
\begin{verbatim}
\setlength{\headheight}{35pt}
\fancyhead[LE,RO]{\nouppercase{\rightmark}} % Section title
\fancyhead[LO,RE]{\nouppercase{\leftmark}} % Chapter title
\fancyfoot[LE,RO]{\thepage}
\fancyheadwidth*[L,R][tj]{0.48\headwidth}
\fancyfootwidth*[LE,RO][-c]{0.1\headwidth}
\end{verbatim}
\end{boxedminipage}
\newpage
\pagestyle{fancy}
\chapter{This is a very long chapter title to see if we can
let fancyhdr fit it in the header}
\thispagestyle{fancy}
\kant[2-4]
\section{Normal section title}
\kant[5-6]
\section{This is a very long section title that will not fit
in the header}
\kant[7]
\end{document}