# Redefining fancyhdr for "plain" changes non-chapter pages' header/footer

Relevant definition of fancy headers and footers for all pages, followed by redefinition of the footer for chapter pages:

\usepackage{fancyhdr}

\fancyhead[R]{\leftmark}
\fancyhead[C,L]{}
\fancyfoot[R]{\thepage}
\fancyfoot[C]{}
\fancyfoot[L]{\textit{\thesistitle}}
\renewcommand{\footrulewidth}{0.4pt}

\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[R]{\thepage}
\fancyfoot[L]{\textit{\thesistitle}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}}


If I use this without the second part (the redefinition of plain style), all non-chapter pages have the correct \leftmark (current chapter). However, if I add the bit concerning the fancyhdr for chapter pages, the command \leftmark gets ignored throughout the entire document.

Ideally, I want the \leftmark (current chapter) to show up in every non-chapter page, and have chapter page carry an empty header.

What am I doing wrong?

## 1 Answer

You have to add \pagestyle{fancy} before, say, \begin{document}

\documentclass{report}
\usepackage{blindtext}
\usepackage{fancyhdr}

\fancyhead[R]{\leftmark}
\fancyhead[C,L]{}
\fancyfoot[R]{\thepage}
\fancyfoot[C]{}
\fancyfoot[L]{\textit{thesistitle}}
\renewcommand{\footrulewidth}{0.4pt}

\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[R]{\thepage}
\fancyfoot[L]{\textit{thesistitle}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}}

\pagestyle{fancy}   %%<----------- this added
\begin{document}
\Blinddocument
\end{document}


• I have reduced \thesistitle to thesistitle for the MWE.
– user11232
Sep 16, 2015 at 9:35
• Thank you! In my case, I was using \pagestyle{fancy} inside of chapter pages instead of before the document.
– user50624
Sep 17, 2015 at 2:51