1

I took the example code from the following question and edited it.

I'm writing a long book, and I intend to have more appendices than there are letters in the alphabet, so I took the following code from another question:

\usepackage{alphalph,etoolbox}
\appto\appendix{% patch \appendix so \AlphAlph is used
    \renewcommand\thechapter{\AlphAlph{\value{chapter}}}%
}

I also added the following code into the main matter:

\appendix

\chapter{Causality}

\lipsum[1-15]

\setcounter{chapter}{24} % just to see the effect

\chapter{Twenty five}

\chapter{Twenty six}

\chapter{Twenty seven}

\chapter{Twenty eight}

The solution works perfectly, where when I exceed the last letter of the Alphabet (Z), the next appendix is called AA, but now I have a problem with the table of contents, as shown below:

enter image description here

The table of contents isn't configured to take into account appendices that take up multiple characters, so the spacing is causing the words to stick to the appendix letters, and I already don't like the spacing between appendix A and the word "Causality," because it appears as if it's simply a chapter called "A Causality."

I'd like to add a ":" or a "-" to the text, or perhaps a better solution. How do I achieve this within the template that I've taken from the other question.

I also looked at the following question, but it's not quite what I want.

  • 1
    Welcome to TeX SX! The answer depends very much on your document class and on the packages you load. Could you post a minimal compilable code reproducing the problem? – Bernard Jul 7 '17 at 19:06
  • Unfortunately I don't yet have the knowledge to tone down my code. If you follow the link I provided to the template I'm using, then I'm using the template provided by a user named Jesper Ipsen. All the changes I made was to add the first section of code to the packages section, and to add the second section of code to the \mainmatter, after \appendix. That's all that's needed to reproduce the code I have. – user3776022 Jul 7 '17 at 19:33
  • @user3776022: What \documentclass are you using? – Werner Jul 7 '17 at 21:25
  • I'm using memoir. – user3776022 Jul 7 '17 at 21:29
2

You can add this code to your preamble:

\setlength{\cftchapternumwidth}{2.2em}

enter image description here

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.