-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample26.tex
99 lines (71 loc) · 2.43 KB
/
example26.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
95
96
97
98
99
\documentclass[openany]{book}
\usepackage{lipsum}
\usepackage{boxedminipage}
\usepackage{afterpage}
\usepackage{ifthen}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE,RO]{\textsl{\rightmark}}
\fancyhead[LO,RE]{\textsl{\leftmark}}
\fancyfoot[C]{\thepage}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancypagestyle{myfancy}{
\fancyhead[LE,RO]{\textbf{MYFANCY SECTION}}
\fancyhead[LO,RE]{\textbf{MYFANCY CHAPTER}}
\fancyfoot[C]{\textbf{--~\thepage~--}}
}
\begin{document}
\tableofcontents
\bigskip
\thispagestyle{plain}
\noindent
\begin{boxedminipage}{\textwidth}
This is example 26 in the fancyhdr documentation.
It demonstrates \verb|\thispagestyle| in \verb|\afterpage|.
On page~\pageref{setafterpage} we call \verb|\afterpage|:
\begin{verbatim}
\afterpage{%
This page will have page style \textbf{myfancy} inserted by
\afterpage.
\\[2ex]
\thispagestyle{myfancy}
}
\end{verbatim}
and then on the next page (page~\pageref{afterpage})
the page style will be \texttt{myfancy} as defined by:
\begin{verbatim}
\fancypagestyle{myfancy}{
\fancyhead[LE,RO]{\textbf{MYFANCY SECTION}}
\fancyhead[LO,RE]{\textbf{MYFANCY CHAPTER}}
\fancyfoot[C]{\textbf{--~\thepage~--}}
}
\end{verbatim}
\end{boxedminipage}
\pagestyle{headings}
\chapter{Introduction}
\bigskip
\lipsum[1]
\section{The Problem}
\label{sec:problem}
\lipsum[2-3]
\section{Evaluation}
%% Here we use \afterpage to set the page style for the next page (only)
\label{setafterpage}\textbf{NEXT PAGE SHOULD HAVE PAGE STYLE MYFANCY}
\afterpage{%
This page will have page style \textbf{myfancy} inserted by
\texttt{\textbackslash afterpage}.
\\[2ex]\label{afterpage}
\thispagestyle{myfancy}
}
\lipsum[3-5]
\section{Another section}
\bigskip
\lipsum[6-8]
\bigskip
Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit amet, laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus eros, malesuada sit amet, fer- mentum eu, sodales cursus, magna. Donec eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem egestas dui, et convallis elit erat sed nulla. Donec luctus. Curabitur et nunc. Aliquam dolor odio, commodo pretium, ultricies non, pharetra in, velit. Integer arcu est, nonummy in, fermentum faucibus, egestas vel, odio.
\bigskip
Donec odio elit, dictum in, hendrerit sit amet, egestas sed, leo.
\bigskip
\lipsum[8-9]
\end{document}