-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample16.tex
58 lines (41 loc) · 1.48 KB
/
example16.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
\documentclass{article}
\usepackage{lipsum}
\usepackage{boxedminipage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength{\headheight}{32pt}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyhead[R]{\leftmark\\\rightmark}
\fancyhead[L]{\thepage}
\renewcommand{\headrule}{\vbox to 0pt
{\makebox[\headwidth]{\dotfill}\vss}}
\begin{document}
\tableofcontents
\section{Introduction}
\begin{boxedminipage}{\textwidth}
This is example 16 in the fancyhdr documentation.\\
We use a two-line header with section name on top of subsection name. Also the header rule is a dotted line. We must increase \verb|\headheight| to prevent Fancyhdr warnings.
\begin{verbatim}
\addtolength{\headheight}{\baselineskip}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyhead[R]{\leftmark\\\rightmark}
\fancyhead[L]{\thepage}
\renewcommand{\headrule}{\vbox to 0pt
{\makebox[\headwidth]{\dotfill}\vss}}
\end{verbatim}
\end{boxedminipage}
\subsection{The Problem}
\label{sec:problem}
\lipsum[1]
\subsection{Evaluation}
\lipsum
Some more text.
Some more text.
Some more text.
Some more text.
This example shows that putting the \verb+\markright+ before the \verb+\subsection+ may cause it to be effected too early when the \verb+\subsection+ falls at the page break. The mark is in the header on this page, while the subsection starts at the next page.
\subsection{Another subsection}
\lipsum[3]
\end{document}