Page Layout ⇒ Fancy Header: page numbering in footer and header
Fancy Header: page numbering in footer and header
I am creating a book using the following:
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CE,CO]{\bfseries\thepage}
\fancyhead[CO]{\bfseries\rightmark}
\fancyhead[CE]{\bfseries\leftmark}
\fancyhead[RE]{\thepage}
\fancyhead[LO]{\thepage}
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers
\renewcommand{\headrulewidth}{0pt} % and the line
}
At each chapter (separate files) I have something like the following:
\pagestyle{fancy}
\fancyhead[CE]{Chapter One} %chapter number
\fancyhead[CO]{Introduction} %chapter name
Page numbers appear in the header of all pages except the first page of each chapter (where they don't appear at all). I need to have page numbers at the bottom of the page on the first page of each new chapter (only here...the rest of the time the pages need to be in the header). Can anyone tell me how to do that with fancyhdr?
Thanks!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Fancy Header: page numbering in footer and header
welcome to the board!
The first page of a chapter has the plain style. That means no header, no head rule and the page number centered in the bottom. To achieve that, you just need to remove these lines:
Code: Select all
\fancypagestyle{plain}{%\fancyhead{} % get rid of headers\renewcommand{\headrulewidth}{0pt} % and the line}
Stefan
Re: Fancy Header: page numbering in footer and header
That worked!
Shannon
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Fancy Header: page numbering in footer and header
I'm glad to read that it works.
Just a general remark: it's good to mark a topic as "solved" when the question has been solved. This improves the readability of the forum and makes it easier to identify unsolved problems. It can be done by editing the first post of the topic and choosing the checkmark.
Best regards,
Stefan