12

I'm writing a book using the amsbook class, and I've included a page for acknowledgements using \chapter*{}, thinking it wouldn't show up in the ToC.

However, it does (and for some reason it's supposed to do so, according to the amsbook manual); so the question is, how do I get rid of it from the ToC?

1
  • As for the reason amsbook (and other ams classes) do this: The intended use of this class is a technical volume. The prototypical use of a starred chapter in a technical volume is an executive summary. The executive summary goes in the table of contents. Commented Jun 12, 2011 at 16:51

3 Answers 3

14

The amsmath FAQ has a solution. Here's a modification of it, in a complete example:

\documentclass{amsbook}
\DeclareRobustCommand{\gobblefour}[4]{}
\newcommand*{\SkipTocEntry}{\addtocontents{toc}{\gobblefour}}
\begin{document}
\tableofcontents
\SkipTocEntry\chapter*{Hidden chapter}
\chapter{Shown chapter}
\end{document}

Just place \SkipTocEntry before a TOC entry you would like to hide.

If you use hyperref, take one argument more:

\DeclareRobustCommand{\gobblefive}[5]{}
\newcommand*{\SkipTocEntry}{\addtocontents{toc}{\gobblefive}}
2
  • @Stefan Kottwitz: Also works for chapters without *, this is great!
    – bkarpuz
    Commented Mar 25, 2013 at 8:27
  • The FAQ link is broken, but the example code still works! Commented Mar 26, 2019 at 12:40
5

You can change the value of the tocdepth counter just before the particular sectional unit which must not show in the ToC and then restore the original value:

\documentclass{amsbook}

\begin{document}
\tableofcontents
\addtocontents{toc}{\setcounter{tocdepth}{-1}}
\chapter*{Preface}
\addtocontents{toc}{\setcounter{tocdepth}{2}}

\end{document}
5

Renewal of \addtocontents to gobble it's arguments can also be used to remove its entry into the ToC:

\documentclass{amsbook}
\begin{document}
\tableofcontents
{\renewcommand{\addtocontents}[2]{}
\chapter*{Preface}}% Not included in ToC
\chapter*{Acknowledgements}% Included in ToC
\end{document}

Localization of the \renewcommand allows for it to work only within the group.

1
  • I like this solution, but unfortunately, it doesn't seem to work correctly for subsections (using amsart): it prevents the subsection name from printing at all, not just in ToC. For sections it works fine. I'm using hyperref if it at all matters.
    – tomasz
    Commented Jun 3, 2014 at 18:53

You must log in to answer this question.

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