[Tex/LaTex] Removing “Chapter 0” before TOC and Appendix issue

fancyhdrheader-footermemoir

I am using the memoir class with the fancyhdr package for headings. I wanted to lower the size of my headings because of overlapping issues. Here is my tex code

\documentclass[oneside]{memoir}

\setlength\midchapskip{10pt}
\makechapterstyle{VZ23}{
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\chapnumfont{\Huge\bfseries\centering}
\renewcommand\chaptitlefont{\Huge\scshape\centering}
\renewcommand\afterchapternum{%
\par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip}
\renewcommand\printchapternonum{%
\vphantom{\chapnumfont \thechapter}
\par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip}
}\chapterstyle{VZ23}

\usepackage{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE,LO]{\itshape \nouppercase \rightmark}
\fancyhead[RO,RE]{\itshape \nouppercase Chapter \arabic{chapter}}

\usepackage{lipsum}

\begin{document}

\begin{abstract}
\lipsum[1-3]
\end{abstract}

\newpage

\tableofcontents

\chapter{First Chapter}
\section{Extremely long first section that overlaps}
\newpage
\section{Extremely long second section that overlaps}

\appendix
\chapter{First Appendix}
\section{Lipsum}
\newpage
\section{Lipsum}

\end{document}

This works well but I got two remaining issues :

  • At the beginning of my document (before first chapter and toc) I got a annoying "Chapter 0" heading
  • I would like to write "Appendix" instead of "Chapter" when hitting chapters after \appendix

Best Answer

When you run your code you get the following error message;

! LaTeX Error: Command \footruleskip already defined.
               Or name \end... illegal, see p.192 of the manual.

and this is because you are using the fancyhdr package to produce your headings instead of using the built-in commands offered by the class. To remove the error and to get rid of the problem mentioned in the question, use the mechanism provided by memoir and described in the Section 7.3 MAKING HEADERS AND FOOTERS of the memoir manual.

You declared the oneside class option, but this option is not compatible with the way you were defining your headers; here's a modification of the original code that you can adapt according to your needs:

\documentclass[twoside]{memoir}

\setlength\midchapskip{10pt}
\makechapterstyle{VZ23}{
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\chapnumfont{\Huge\bfseries\centering}
\renewcommand\chaptitlefont{\Huge\scshape\centering}
\renewcommand\afterchapternum{%
\par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip}
\renewcommand\printchapternonum{%
\vphantom{\chapnumfont \thechapter}
\par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip}
}
\chapterstyle{VZ23}

\usepackage{geometry}

\nouppercaseheads
\makepagestyle{mystyle}
\makeevenhead{mystyle}{\itshape\rightmark}{}{}
\makeoddhead{mystyle}{}{}{\itshape\leftmark}
\pagestyle{mystyle}

\usepackage{lipsum}

\begin{document}


\chapter{First Chapter}
\section{Extremely long first section that overlaps}
\lipsum[1-20]

\end{document}
Related Question