-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample34c.tex
62 lines (47 loc) · 1.66 KB
/
example34c.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
\documentclass[oneside]{book}
\usepackage{kantlipsum}
\usepackage{boxedminipage}
\usepackage[twoside]{fancyhdr}
\pagestyle{fancy}
\usepackage[fit]{truncate}
\fancyhf{}
\fancyhead[LE,RO]{\nouppercase{%
\truncate{0.5\headwidth}{\rightmark}}} % Section title
\fancyhead[LO,RE]{\nouppercase{%
\truncate{0.5\headwidth}{\leftmark}}} % Chapter title
\fancyfoot[LE,RO]{\thepage}
\begin{document}
\thispagestyle{plain}
\tableofcontents
\bigskip
\noindent
\begin{boxedminipage}{\textwidth}
This is example 34c in the \texttt{fancyhdr} documentation.
This document has some very long chapter and section titles. We use the package \texttt{trunc} so that these titles are automatically truncated in the header.
Check that the table of contents contains the long titles and the header contains the truncated titles where necessary.
\begin{verbatim}
\usepackage[fit]{truncate}
\fancyhead[LE,RO]{\nouppercase{%
\truncate{0.5\headwidth}{\rightmark}}} % Section title
\fancyhead[LO,RE]{\nouppercase{%
\truncate{0.5\headwidth}{\leftmark}}} % Chapter title
\fancyfoot[C]{\thepage}
\chapter{This is a very long chapter title to see if we can
give fancyhdr a shorter one that fits in the header}
. . .
\section{This is a very long section title that will not fit
in the header}
\end{verbatim}
\end{boxedminipage}
\newpage
\pagestyle{fancy}
\chapter{This is a very long chapter title to see if we can
give fancyhdr a shorter one that fits 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}