4

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

1 Answer 1

5

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}
3
  • Why don't you use \cftappendixname, should work if it is unmodified memoir underneath
    – daleif
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.