# Appendix Chapter Title Editing

I'm using a variation of the memoir class that is specialized for my school's dissertation requirements. The cls file is here: https://math.as.uky.edu/sites/default/files/ukthesis.cls_.txt

Here is a MWE (Explanation of problem to follow):

\documentclass[final]{ukthesis}
%you must include these 2 packages.
\usepackage{hyperref}
\usepackage{memhfixc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{Introduction}
\section{General Introduction}

In \textbf{Appendix \ref{app:A}}, alongside CAD diagrams.

\appendix
\makeatletter
\renewcommand{\@chapapp}{Appendix}
\makeatother
\chapter{Detector Frame Drawings}\label{app:A}
The following pages show drawings

%-----------------------------------------------

\newpage

\end{document}


What I want is for the appendix chapter title to say: "Appendix A: Detector Frame Drawings"

What actually comes out is: "Chapter A Detector Frame Drawings"

I've searched around this Stack Exchange and tried a number of methods for changing chapter titling and the like, and have made no progress. So I'd like help with two things: 1) How do I add a colon after the appendix numbering (lettering) and 2) How to I get this to change the word "chapter" to "appendix" when using \chapter{}.

Thanks, Zach

\addtolength{\cftchapternumwidth}{.5em}
\makeatletter
\renewcommand*{\l@appendix}[2]{%
\renewcommand{\chapternumberlinehook}[1]{\def\@cftbsnum{Appendix\ }}%
\l@chapapp{#1}{#2}{}}
\makeatother


The first length adjustment pushes the ToC titles over by another .5em. This is because the class hard-codes the width of the "chapter number", which actually consists of Chapter<space><num>. And, since Chapter<space><num> is typically longer than Appendix<space><letter>, we need a little more space.

The second adjustment is made to the way the appendix entries are handled in the ToC. In a rather crude way (similar to the way the class has been written), we adjust the content before the sectional number to be Appendix .

Finally, we append a new chapter name printing mechanism to the \appendix macro.

Here is a complete minimal example:

\documentclass[final]{ukthesis}

%you must include these 2 packages.
\usepackage{hyperref}
\usepackage{memhfixc}

\makeatletter
\renewcommand*{\l@appendix}[2]{%
\renewcommand{\chapternumberlinehook}[1]{\def\@cftbsnum{Appendix\ }}%
\l@chapapp{#1}{#2}{}}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\tableofcontents

\chapter{Introduction}
\section{General Introduction}

In \textbf{Appendix \ref{app:A}}, alongside CAD diagrams.

\appendix
\chapter{Detector Frame Drawings}\label{app:A}
The following pages show drawings

\end{document}

• Why don't you use \cftappendixname, should work if it is unmodified memoir underneath Mar 12, 2015 at 8:17
• Excellent! Thank you. That works beautifully. My only other question is, how do I get a colon after the chapter or appendix name (I'd actually like both), such that it reads: "Chapter #: Title" or "Appendix A: Title?" Thanks again, Werner.
– Zach
Mar 12, 2015 at 11:11
• @Zach: If you wish to the : after the number in the ToC, then add \renewcommand{\cftchapteraftersnum}{:} to the preamble. If you want to add : after the number in the chapter title/header, then add \g@addto@macro\printchapternum{\unskip:\space} somewhere between \makeatletter...\makeatother.
– Werner
Mar 12, 2015 at 19:38