TeX - LaTeX Asked on August 29, 2020
I get confused with fancyhdr
. Let’s consider this minimal example:
documentclass{book}
usepackage{fancyhdr}
usepackage{lipsum}
pagestyle{fancy}
begin{document}
frontmatter
title{A dummy document}
author{John Doe}
maketitle
tableofcontents
section{Abstract}
lipsum{2}
mainmatter
chapter{Foo}
section{Neo}
lipsum{8-12}
section{Trinity}
lipsum{13-20}
chapter{Bar}
section{Morpheus}
lipsum{21-25}
backmatter
section{Appendix}
lipsum{26}
end{document}
I can note different header/footer styles:
I don’t really understand (2) and (3). How can I configure all these different configurations?
If I add the following it doesn’t affect the titlepage, the chapter pages and the numbering type:
fancyhead{}
fancyhead[CE]{Even}
fancyhead[CO]{Odd}
How can I configure fancyhdr to:
The first question is not about fancyhdr
is the behavior of cleardoblepage
. In order to remove headers and footers on empty pages I use the following code in the preamble:
makeatletter
defcleardoublepage{clearpageif@twoside ifoddc@pageelse
vspace*{fill}
thispagestyle{empty}
newpage
if@twocolumnhbox{}newpagefififi}
makeatother
chapter
resets the page style to plain by default. If you want to change the style of this page, try:
chapter{Foo}
thispagestyle{fancy}
An example on how to modify headers and footer on other pages:
pagestyle{fancy}
fancyhf{} %clear headers and footers
fancyhead[LE,RO]{thepage} %page number on the left on even pages and the right of odd pages
fancyhead[CO]{leftmark} %chapter name in the center of odd pages
fancyhead[CE]{rightmark} %section title in the center of even pages
renewcommand{headrulewidth}{0pt} %rule width
for this part you need to read a little more, because is difficult to make an example to illustrate every aspect of fancyhdr
. Try something basic or the manual.
Answered by Luis Turcio on August 29, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP