# In Appendix Fancyhdr header suddenly disappears

I use the fancyhdr package. It works fine for the whole document, however, in the Appendix, the last two pages are without header. I haven't found a solution online and I am grateful for any help!

Also, I would like to have only "Part I" on the right header, without the "A" Prefix. However, \renewcommand{\sectionmark}[1]{\markright{#1}} only results in nothing on the right side.

Here is my code:

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[titletoc]{appendix}
\usepackage{graphicx}
\usepackage[left= 2.7cm,right = 2cm, bottom = 4 cm]{geometry}
\author{I}
\usepackage{fancyhdr}

\begin{document}
\begin{appendices}
\pagestyle{fancy}
%\renewcommand{\sectionmark}[1]{\markright{#1}}
\lhead{\textit{APPENDIX}}
\rhead{\textit{\leftmark}}
\appendixpage
\thispagestyle{empty}
\newpage
\pagenumbering{Roman}

\section{Part I}
\subsection{Image I}
\includegraphics[width=\linewidth]{example-image-a}
\subsection{Image II}
\includegraphics[width=\linewidth]{example-image-a}
\subsection{Image III}
\includegraphics[width=\linewidth]{example-image-a}

\section{Part II}
\includegraphics[width=0.95\linewidth]{example-image-a}
\end{appendices}

\end{document}

Thank you!



## 1 Answer

Ok I found part of the answer - the command \pagestyle{fancy} needs to be set before \begin{appendices} and it works fine!