-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitchstyle2.tex
60 lines (47 loc) · 1.39 KB
/
switchstyle2.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
\documentclass[oneside]{report}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{blindtext}
\fancypagestyle{fancy}{%
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{}
\fancyhead[L]{\leftmark}
\fancyhead[R]{\rightmark}
\fancyfoot[C]{\thepage}
}
\fancypagestyle{special}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[L]{Special Page Style \nouppercase\leftmark}
\fancyfoot[R]{\thepage}
}
\pagestyle{fancy}
\begin{document}
\chapter{Introduction}
This example shows the effects of having the header and footer definitions embedded in the page style. The page style \texttt{special} does have some relevant definitions inside it, and the page style \texttt{fancy} too. However, as the \texttt{special} page style changes the \verb|\headrulewidth|, page style \texttt{fancy} must also embed the default definition of this, which isn't logical.
\begin{verbatim}
\fancypagestyle{fancy}{%
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{}
\fancyhead[L]{\leftmark}
\fancyhead[R]{\rightmark}
\fancyfoot[C]{\thepage}
}
\fancypagestyle{special}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[L]{Special Page Style \nouppercase\leftmark}
\fancyfoot[R]{\thepage}
}
\pagestyle{fancy}
\end{verbatim}
\bigskip
\lipsum[1-5]
\chapter{Special Chapter}
\pagestyle{special}
\lipsum
\chapter{Another Chapter}
\pagestyle{fancy}
\lipsum
\end{document}