[Tex/LaTex] Appendix Chapter Title Editing

appendicesmemoir

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"

In the table of contents, it shows up as: "Appendix A 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

Best Answer

Add the following to your preamble:

\addtolength{\cftchapternumwidth}{.5em}
\makeatletter
\renewcommand*{\l@appendix}[2]{%
  \renewcommand{\chapternumberlinehook}[1]{\def\@cftbsnum{Appendix\ }}%
  \l@chapapp{#1}{#2}{}}
\g@addto@macro\appendix{\renewcommand{\printchaptername}{\normalfont\bfseries Appendix}}
\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:

enter image description here

\documentclass[final]{ukthesis}

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

\addtolength{\cftchapternumwidth}{.5em}
\makeatletter
\renewcommand*{\l@appendix}[2]{%
  \renewcommand{\chapternumberlinehook}[1]{\def\@cftbsnum{Appendix\ }}%
  \l@chapapp{#1}{#2}{}}
\g@addto@macro\appendix{\renewcommand{\printchaptername}{\normalfont\bfseries Appendix}}
\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}