[Tex/LaTex] Adding numberless chapters to the table of contents

chaptersnumberingsectioningtable of contents

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.

Best Answer

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.