0

I'm trying to compile a document with multiple chapters and an appendix but run into problems with the fancyhdr package. After compilation, I do not get the desired effect of \chaptername appearing at the right place.

enter image description here enter image description here

Page 5 marks the actual start of the \chapter{Dummy test}

enter image description here


A minimum working example that reproduces my issue is below [compiled with xelatex]:

\documentclass[11pt,twoside,openright]{report}

\usepackage{appendix}
\usepackage{fancyhdr}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhead{}
\fancyhead[LO,RE]{\chaptername\ \thechapter}
\fancyhead[RO,LE]{\thepage}
\fancyfoot{}

\begin{document}

\chapter{Sample}
\section{Introduction}
\lipsum[1-10]
\clearpage

\begin{appendices}
    \renewcommand\chaptername{Appendix}
    \chapter{Dummy test}
    \section{Introduction}
    \lipsum[1-3]
\end{appendices}

\end{document}

I am aware of similar questions, such as chapter-heading-appearing-in-appendix and fancyheader-and-appendix, but neither solves my issue.

1 Answer 1

0

Here is my solution:

\documentclass[11pt,twoside,openright]{report}

\usepackage{fancyhdr}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhead{}
\fancyhead[LO,RE]{\chaptername\ \thechapter}
\fancyhead[RO,LE]{\thepage}
\fancyfoot{}

\begin{document}

\chapter{Sample}
\section{Introduction}
\lipsum[1-10]
\clearpage
\thispagestyle{empty}

\appendix

\renewcommand\chaptername{Appendix}
\chapter{Dummy test}
\section{Introduction}
\lipsum[1-3]


\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .