9

How do I include a chapter reference within the table of contents without giving it a chapter number? I am using the report document class.

Normally, I would create a chapter as follows:

\chapter{Some Chapter}

but this results in the chapter being given a number. Currently I am using

\chapter*{Some Chapter}

which gets rid of the number, but then it is absent from the table of contents.

3 Answers 3

9

You can use

\addcontentsline{toc}{chapter}{\protect\numberline{}Some chapter}

just after your \chapter*{Some chapter}. For an automated approach, define your own \chapter command (say) \mychapter:

enter image description here

\documentclass{book}
\usepackage{xparse}% http://ctan.org/pkg/xparse
\NewDocumentCommand{\mychapter}{s o m}{%
  \IfNoValueTF{#2}%
    {\global\edef\chapToCname{#3}}
    {\global\edef\chapToCname{#2}}%
  \IfBooleanTF{#1}
    {% \mychapter*
     \chapter*[\chapToCname]{#3}%
     \addcontentsline{toc}{chapter}{\protect\numberline{}\chapToCname}
    }{% \mychapter
     \chapter [\chapToCname]{#3}%
    }%
}
\begin{document}
\tableofcontents
\mychapter{A chapter}
\mychapter*{Some chapter}
\end{document}

The macro interface is provided by xparse.

11

You can insert it using \addcontentsline.

\documentclass{report}
\begin{document}
\tableofcontents
\chapter{A chapter}
\chapter*{Another chapter}
\addcontentsline{toc}{chapter}{Another chapter}
\end{document}
7

Just for the sake of completeness:

If you would use one of the KOMA-script classes scrbook or scrreprt, you could use the command \addchap, which provides exactly what you want.

You must log in to answer this question.

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