3

I have a LaTeX document (memoir class) broken into unnamed, numbered chapters, like so \chapter{}.

I'd like the table of contents to look roughly like this:

Contents

Chapter 1 ............... 1

Chapter 2 ............... 5

However, \tableofcontents generates the following:

Contents

1 ............... 1

2 ............... 5

Is there a way to insert the word 'Chapter' into each line of the table of contents, preferably without naming the chapters and re-configuring the chapter titles?

I've done a fair amount of searching and have looked into tocloft, titletoc and other such packages, however I haven't found a solution to this particular problem.

I'm hoping I've missed something simple here.

  • 2
    In memoir, something like \renewcommand{\cftchaptername}{Chapter\space} is the basic idea (change the \space bit as needed). – jon Dec 3 '14 at 6:09
  • @jon Can you please turn you comment into an answer? – Gonzalo Medina Dec 3 '14 at 12:46
  • If babel (or similar) is used, then @jons suggestion can be altered to \renewcommand\cftchaptername{\chaptername~} – daleif Dec 3 '14 at 14:23
1

The basic mechanics for this are pretty simple. If you're writing an English unilingual document with the memoir class, just add:

\renewcommand{\cftchaptername}{Chapter\space}

If you're not writing in English, as daleif says, you can use the \chaptername macro. Say something like:

\usepackage[ngerman]{babel}
\renewcommand\cftchaptername{\chaptername\space}

A complete example, which lets you try both:

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\newif\ifusebabel % <-- a conditional just for trying both
%\usebabeltrue    % <-- uncomment if you want to see the change (but compile twice 
                  %     to get the change reflected in the ToC!)

\ifusebabel
\usepackage[ngerman]{babel}
\renewcommand\cftchaptername{\chaptername\space}
\else
\renewcommand\cftchaptername{Chapter\space}
\fi

\begin{document}

\tableofcontents
\chapter{}
\chapter{}

\end{document}
|improve this answer|||||
  • Worked perfectly, thank you! I'd hoped that this would be simpler than I was making it. – palmee4 Dec 5 '14 at 2:46
  • @palmee4 -- I know the feeling! Glad it works for you. – jon Dec 5 '14 at 6:54

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.