# appendix package does not support the option “header” in the subappendices environment — workaround?

Basically what the title says. Is there a way to automatically have "Appendix A -- Title" in the page header instead of "A -- Title" when using the subappendices environment of the appendix package? I learned from the package documentation that this is not supported, but I need to use the subappendices environment, because I have appendices at the end of every chapter.

• We have a strange obsession on MWE -- please provide a compilable document – user31729 Jan 25 '16 at 18:56

Here's a possible way -- use \AtBeginEnvironment do add some code that redefines \sectionmark according to the needs.

\documentclass[oneside]{book}
\usepackage{appendix}
\usepackage{blindtext}
\usepackage{xpatch}

\begin{document}

\makeatletter
\AtBeginEnvironment{subappendices}{%
\renewcommand{\sectionmark}[1]{%
\if@twoside
\markboth{\appendixname\ \Alph{section}\ -- #1}{}
\else
\markright{\appendixname\ \Alph{section}\ --  #1}{}
\fi
}
}
\makeatother

\tableofcontents
\chapter{First}
\blindtext[5]

\begin{subappendices}
\section{Foo}
\blindtext[5]

\section{Another Foo}
\blindtext[5]
\end{subappendices}

\chapter{Another Chapter}

\blindtext[5]

\begin{subappendices}
\section{Yet another foo}
\blindtext[5]
\end{subappendices}

\end{document}