0

In the MWE below, I wanted to be able to show the name of the chapter on pages in the \frontmatter that spans more than one page. In the example, the "Dedication", "List of Abbreviations" and the "Nomenclature" pages. Instead of showing "Contents" on the \frontmatter pages, show "Dedication", then "List of Abbreviations" and then "Nomenclature" on the respective pages. The first page after the chapter start page should have the name of the chapter, then the second page following the chapter start page should have the name of the book.

Here is the code that I have so far:

\documentclass{book}
\usepackage{lipsum}
\usepackage{etoolbox,fancyhdr}

\newcommand{\mymark}{}

\makeatletter
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries \ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}}
\fancyhf{} \fancyhead[LE,RO]{\textbf{\sffamily\normalsize\thepage}}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\textbf{\sffamily\scshape \leftmark}}%
\renewcommand{\headrulewidth}{.5pt}
\addtolength{\headheight}{2.5pt}
\newcommand{\headrulecolor}[1]{\patchcmd{\headrule}{\hrule}{\color{#1}\hrule}{}{}}
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\renewcommand{\cleardoublepage}{
\clearpage\ifodd\c@page\else
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi}

\renewcommand{\mymark}{\leftmark}


\begin{document}

\frontmatter
\tableofcontents 

\chapter*{Dedication}
\lipsum[1-6]

\chapter*{List of Abbreviations}
\lipsum[1-6]

\chapter*{Nomenclature}
\lipsum[1-6]

\part{Part One}
\mainmatter
\fancyhead[RE]{\textbf{\sffamily\scshape\chaptername~\thechapter. \leftmark}}%
\chapter{This is Start of Main Text}
\section{Section One}
\lipsum[1-11]

\end{document}
1

May be I do not completely understand what the desired result is. But if you use starred chapters like \chapter*{Dedication} you have to manually set the marks.

\documentclass{book}
\usepackage{emptypage}
\usepackage{lipsum}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\renewcommand{\chaptermark}[1]{\markboth{\chaptername~\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

\fancyhead[LE,RO]{\bfseries\sffamily\normalsize\thepage}
\fancyhead[LO]{\bfseries\sffamily\normalsize\rightmark}
\fancyhead[RE]{\bfseries\sffamily\normalsize\leftmark}

\renewcommand{\headrulewidth}{.5pt}
\addtolength{\headheight}{2.5pt}

\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\begin{document}
\frontmatter
\tableofcontents 

\chapter*{Dedication}\markboth{Dedication}{}
\lipsum[1-6]
\chapter*{List of Abbreviations}\markboth{List of Abbreviations}{}
\lipsum[1-6]
\chapter*{Nomenclature}\markboth{Nomenclature}{}
\lipsum[1-6]

\mainmatter
\part{Part One}
\chapter{This is Start of Main Text}
\section{Section One}
\lipsum[1-11]
\end{document}

enter image description here

If there can be a TOC entry for chapters in frontmatter you could use \chapter instead \chapter*.

\documentclass{book}
\usepackage{emptypage}
\usepackage{lipsum}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\makeatletter
\renewcommand{\chaptermark}[1]
  {\markboth{\if@mainmatter\chaptername~\thechapter.\ \fi#1}{}}
\makeatother
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

\fancyhead[LE,RO]{\bfseries\sffamily\normalsize\thepage}
\fancyhead[LO]{\bfseries\sffamily\normalsize\rightmark}
\fancyhead[RE]{\bfseries\sffamily\normalsize\leftmark}

\renewcommand{\headrulewidth}{.5pt}
\addtolength{\headheight}{2.5pt}

\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\begin{document}
\frontmatter
\tableofcontents 

\chapter{Dedication}
\lipsum[1-6]
\chapter{List of Abbreviations}
\lipsum[1-6]
\chapter{Nomenclature}
\lipsum[1-6]

\mainmatter
\part{Part One}
\chapter{This is Start of Main Text}
\section{Section One}
\lipsum[1-11]
\end{document}
  • I tested your code above, adding \newpage \lipsum[1-6] above the List of Abbreviations to extend "Dedication" to a third page. I found (as in my thesis) that this extra page does not get a "Dedication" header, only a page number. I've tried various means of fixing this, but clearly there's something I'm missing. Any suggestions on how to generalise your answer? – Jason Whyte Nov 27 '17 at 11:28
  • 1
    @Jason Whyte Use the second argument of \markboth: \markboth{Dedication}{Dedication}. The first argument sets a left mark which is used by \leftmark (on even pages in the example), the second sets a right mark which is used by \rightmark (on odd pages in the example). – esdd Nov 27 '17 at 11:35
  • Brilliant! Thanks so much, works like a charm, now that you've pointed it out, the empty {} on the end was staring right at me. – Jason Whyte Nov 27 '17 at 11:43

Your Answer

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

Not the answer you're looking for?Browse other questions tagged or ask your own question.