3

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?

3

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}

enter image description here

| improve this answer | |
  • I have reduced \thesistitle to thesistitle for the MWE. – user11232 Sep 16 '15 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 '15 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy