-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample34d.tex
53 lines (39 loc) · 1.35 KB
/
example34d.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
\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]{0.48\headwidth}
\begin{document}
\thispagestyle{plain}
\tableofcontents
\bigskip
\noindent
\begin{boxedminipage}{\textwidth}
This is example 34d 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.
\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]{0.48\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}