[Tex/LaTex] How to make running heads in book class show Part and Chapter, rather than Chapter and Section

header-footerpartssectioning

I am preparing a book, which is to be divided into Parts, Chapters, and Sections. At the moment, my running headers give the Chapter title (on recto pages), and Section title (on verso). I would like to switch from "Chapter/Section" to "Part/Chapter." I'd be grateful for any suggestions.

Best Answer

Here's one possibility using the standard book (or report) class and fancyhdr; the etoolbox package was used to patch \@part so as to grab the part title:

\documentclass{book}
\usepackage[a6paper]{geometry}%just for the example
\usepackage{fancyhdr}
\usepackage{etoolbox}
\usepackage{lipsum}%just for the example

\makeatletter
\patchcmd{\@part}
  {\markboth{}{}}
  {\gdef\parttitle{#1}}
  {}
  {}
\makeatother

\pagestyle{fancy}

\fancyhf{}
\fancyhead[EL]{\partname~\thepart.\ \parttitle}
\fancyhead[OR]{\nouppercase\leftmark}
\fancyhead[ER,OL]{\thepage}

\begin{document}

\part{Test part one}
\chapter{Test chapter one}
\section{Test section one one}
\lipsum[1-4]
\part{Test part two}
\chapter{Test chapter two}
\section{Test section two one}
\lipsum[1-4]

\end{document}

enter image description here

Related Question