Page LayoutFancy Header: page numbering in footer and header

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
shannon
Posts: 9
Joined: Fri Jun 25, 2010 2:47 pm

Fancy Header: page numbering in footer and header

Post by shannon »

Hi,

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!
Last edited by shannon on Fri Jul 23, 2010 10:49 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Fancy Header: page numbering in footer and header

Post by Stefan Kottwitz »

Hi Shannon,

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
}
Otherwise modify these lines.

Stefan
LaTeX.org admin
shannon
Posts: 9
Joined: Fri Jun 25, 2010 2:47 pm

Re: Fancy Header: page numbering in footer and header

Post by shannon »

Thanks Stefan,

That worked!

Shannon
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Re: Fancy Header: page numbering in footer and header

Post by Stefan Kottwitz »

Hi Shannon,

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
LaTeX.org admin
Post Reply