0

I am completing the template for my PhD thesis. Everything works as expected, except the appendix header.

So far, it only displays the title: "A Journal articles". What I want instead is: "Appendix A Journal articles".

The document class is memoir and here is an MWE showing the problem:

\documentclass[b5paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{blindtext} 

%%%%%%%%% HEADER AND FOOTER FORMAT  %%%%%%%%%

\def\hffont{\sffamily\small}
\makepagestyle{myruled}
\makeheadrule{myruled}{\textwidth}{\normalrulethickness}
\makeevenhead{myruled}{\hffont\thepage}{}{\hffont\leftmark}
\makeoddhead{myruled}{\hffont\rightmark}{}{\hffont\thepage}
\makeevenfoot{myruled}{}{}{}
\makeoddfoot{myruled}{}{}{}
\makepsmarks{myruled}{
    \nouppercaseheads
    \createmark{chapter}{both}{shownumber}{}{\space}
    \createmark{section}{right}{shownumber}{}{\space}
    \createplainmark{toc}{both}{\contentsname}
    \createplainmark{lof}{both}{\listfigurename}
    \createplainmark{lot}{both}{\listtablename}
    \createplainmark{bib}{both}{\bibname}
    \createplainmark{index}{both}{\indexname}
    \createplainmark{glossary}{both}{\glossaryname}
}
\pagestyle{myruled}
\copypagestyle{cleared}{myruled}      % When \cleardoublepage, use myruled instead of empty
\makeevenhead{cleared}{\hffont\thepage}{}{} % Remove leftmark on cleared pages
\makeevenfoot{plain}{}{}{}            % No page number on plain even pages (chapter begin)
\makeoddfoot{plain}{}{}{}  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\appendix
\chapter{Test on header}
\blindtext[10]

\end{document}

I hope you can help me to fix this. Thanks in advance!

  • Welcome to TeX.SE! Please remember to give us a minimal working example, which most importantly doesn't involve inputting any files that we don't have access to. It'll make it much easier to help you. – dgoodmaniii Nov 27 '19 at 15:52
  • You are right, but the files to input are not necessary. I showed the code to make clear how I call the appendix. – daniele cozzolino Nov 27 '19 at 16:23
  • I tried to run your MWE but there were so many errors. Please provide code, in one file, from \documentclass to \end{document} that shows your problem and that we can run. – Peter Wilson Nov 27 '19 at 18:37
  • Hi! I will try to upload an easier MWE because I cannot put the entire code, it will be enormous. I didn't put it in a first instance because I thought the problem was rather general. – daniele cozzolino Nov 27 '19 at 18:43
  • Done, I added an MWE that shows the problem and can be run. I hope you can help me guys. – daniele cozzolino Nov 27 '19 at 19:13

1 Answers1

0

Thank you for the new MWE --- most helpful.

Maybe the following edited version of your MWE will do what you want.

% appendixheaderprob.tex SE 518282 add Appendix to header

\documentclass[b5paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{blindtext} 

%%%%%%%%% HEADER AND FOOTER FORMAT  %%%%%%%%%

\def\hffont{\sffamily\small}
\makepagestyle{myruled}
\makeheadrule{myruled}{\textwidth}{\normalrulethickness}
\makeevenhead{myruled}{\hffont\thepage}{}{\hffont\leftmark}
\makeoddhead{myruled}{\hffont\rightmark}{}{\hffont\thepage}
\makeevenfoot{myruled}{}{}{}
\makeoddfoot{myruled}{}{}{}
%%%%%% new code
\makepagestyle{appruled}
\makeheadrule{appruled}{\textwidth}{\normalrulethickness}
\makeevenhead{appruled}{\hffont\thepage}{}{\hffont\appendixname~\leftmark}
\makeoddhead{appruled}{\hffont\appendixname~\rightmark}{}{\hffont\thepage}
\makeevenfoot{appruled}{}{}{}
\makeoddfoot{appruled}{}{}{}
%%%% end new code
\makepsmarks{myruled}{
    \nouppercaseheads
    \createmark{chapter}{both}{shownumber}{}{\space}
    \createmark{section}{right}{shownumber}{}{\space}
    \createplainmark{toc}{both}{\contentsname}
    \createplainmark{lof}{both}{\listfigurename}
    \createplainmark{lot}{both}{\listtablename}
    \createplainmark{bib}{both}{\bibname}
    \createplainmark{index}{both}{\indexname}
    \createplainmark{glossary}{both}{\glossaryname}
\createplainmark{appendix}{both}{\appendixname}
}
\pagestyle{myruled}
\copypagestyle{cleared}{myruled}      % When \cleardoublepage, use myruled instead of empty
\makeevenhead{cleared}{\hffont\thepage}{}{} % Remove leftmark on cleared pages
\makeevenfoot{plain}{}{}{}            % No page number on plain even pages (chapter begin)
\makeoddfoot{plain}{}{}{}  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\chapter{A chapter}
\blindtext[10]

\appendix
\pagestyle{appruled}  %%%% new code
\chapter{Test on appendix header}
\blindtext[10]

\end{document}
Peter Wilson
  • 28,066