-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample19.tex
94 lines (72 loc) · 2.88 KB
/
example19.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
\documentclass[openany]{book}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{boxedminipage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\textbf{\thepage}}
\fancyhead[LO]{\textbf{\rightmark}}
\fancyhead[RE]{\textbf{\leftmark}}
\fancyheadoffset[LE,RO]{\marginparsep+\marginparwidth}
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers
\renewcommand{\headrulewidth}{0pt} % and the line
}
\begin{document}
\tableofcontents
\bigskip
\begin{boxedminipage}{\textwidth}
This is example 19 in the fancyhdr documentation.\\
It is an approximation of the style used in Leslie Lamport's \LaTeX{} book.
The header has the width of the text plus the marginpar area. This time we do this by using \verb|\fancyheadoffset|.
The header on even pages has the page number on the left, and the chapter title on the right. On odd pages it has the section title preceded by the section number on the left and the page number on the right. All in boldface.
There is no footer. The \texttt{plain} style is redefined to have no header and no footer. (In the \LaTeX{} book this makes sense because each chapter begins with a page that contains only a drawing. In most other cases you probably would want a page number on the page.)
\begin{verbatim}
\usepackage{calc}
. . .
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\textbf{\thepage}}
\fancyhead[LO]{\textbf{\rightmark}}
\fancyhead[RE]{\textbf{\leftmark}}
\fancyheadoffset[LE,RO]{\marginparsep+\marginparwidth}
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers
\renewcommand{\headrulewidth}{0pt} % and the line
}
\end{verbatim}
\end{boxedminipage}
\chapter{Introduction}
\textbf{Here comes a marginpar.}
\marginpar{\textbf{Marginpar.} Donec bibendum quam in tellus. Nullam cur- sus pulvinar
lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum
pellentesque felis eu massa.}
\lipsum
\section{The Problem}
\label{sec:problem}
\textbf{Here comes a marginpar.}
\marginpar{\textbf{Marginpar.} Donec bibendum quam in tellus. Nullam cur- sus pulvinar
lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum
pellentesque felis eu massa.}
\lipsum[1]
\section{Evaluation}
\textbf{Here comes a marginpar.}
\marginpar{\textbf{Marginpar.} Donec bibendum quam in tellus. Nullam cur- sus pulvinar
lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum
pellentesque felis eu massa.}
\lipsum
Some more text.
Some more text.
Some more text.
Some more text.
\section{Another section}
\textbf{Here comes a marginpar.}
\marginpar{\textbf{Marginpar.} Donec bibendum quam in tellus. Nullam cur- sus pulvinar
lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum
pellentesque felis eu massa.}
\lipsum[3]
\end{document}