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.

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

1 Answer 1

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}
2
  • Worked perfectly, thank you! I'd hoped that this would be simpler than I was making it.
    – palmee4
    Dec 5, 2014 at 2:46
  • @palmee4 -- I know the feeling! Glad it works for you.
    – jon
    Dec 5, 2014 at 6:54

You must log in to answer this question.

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