Sunday, 2 June 2013

Fancyhdr does not apply same header/footer on chapter and non-chapter pages

Fancyhdr does not apply same header/footer on chapter and non-chapter pages

I have a problem with the fancy package: I use the report documentclass and I have a chapter, a lot of text and then a new page starting with a section (or the next page has no chapter starting on that particular page).
The problem be, that what I defined for my header and footer is NOT on the chapter-page but only on the non-chapter page. How come? What did I miss?
Minimal example:
\documentclass[]{report}

\usepackage{lastpage}
\usepackage{fancyhdr} % for use of \pageref{LastPage}

\fancypagestyle{IHA-fancy-style}{%
\fancyhf{} %Clear header and footer
\fancyhead[LE,RO]{\slshape \rightmark}
\fancyhead[LO,RE]{\slshape \leftmark}
\fancyfoot[C]{\thepage of \pageref{LastPage}} %Custom footer
\renewcommand{\headrulewidth}{0.4pt} %Line at the header visible
\renewcommand{\footrulewidth}{0.4pt}} %Line at the footer visible

\title{A short example}

\begin{document}

\maketitle
\tableofcontents

\pagestyle{IHA-fancy-style}
\chapter{A chapter}
Look at the footer

\newpage
\section{A section}
Look at the footer

\end{document}
Take notice: No line on page 2 at the bottom - a line on page 3 at the bottom.
Any clues?

No comments:

Post a Comment