7

I am using the Memoir class to develop a thesis template and I have a problem that I am not able to solve. I want the chapter number to be displayed as text in the TOC. I already made the number to appear as text in the actual chapter but a haven't been able to do it in the TOC. Basically this is what I want to do:

Chapter One: Introduction

1.1 Why

1.2 XXXX

Chapter Two: Experiment

2.1 XXX

2.2 XXX

If you can help me with this problem I will really appreciate your help.

1 Answer 1

5

It turns out to be quite easy:

\renewcommand{\chapternumberline}[1]{\chaptername\ \numtoName{#1}: }

Easy, of course, after some experiments trying to figure out what the documentation says wrong about this topic.

When there are also appendices the code becomes slightly more complicated as we probably want "Appendix A: Title", so we must change the interpretation of \chapternumberline

\usepackage{etoolbox}
\renewcommand{\chapternumberline}[1]{\chaptername\ \numtoName{#1}: }
\appto\appendix{\addtocontents{toc}{\protect\reformchapapp}}
\newcommand{\reformchapapp}{%
  \renewcommand{\chapternumberline}[1]{\appendixname\ ##1: }%
}

At \appendix we register in the .toc file a command whose effect is to modify what \chapternumberline does.

7
  • ...because of all the hooks memoir provides. It's just a case of finding them! :)
    – Werner
    Nov 9, 2011 at 23:11
  • @Werner No: the typesetting of chapters in toc is completely different from that of lower levels and doesn't use \cftchapteraftersnumb which was the hook I thought to use at first.
    – egreg
    Nov 9, 2011 at 23:13
  • 1
    @Werner If you try and define \cftchapteraftesnumb to \ddt, you'll get no error, which means that it's never used. And so I discovered that the chapter number is not typeset in a box \cftchapternumwidth wide. Which indeed makes sense, but should be mentioned.
    – egreg
    Nov 9, 2011 at 23:28
  • 1
    egreg, thanks for all you help. I really solve my problem. But I actually created another problem. Now the problem is in the appedix. I need to appendix to appear as "Appendix A". However, what is happening is that it is trying to to convert the appendix into a letter. The problem is that it is not possible and I am getting an error. Is there a way to revert the instruction to the original state, just before I start the appendix.
    – Hector
    Nov 11, 2011 at 20:39
  • 1
    @Hector Yes, there is. :)
    – egreg
    Nov 11, 2011 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .