3

I'm writing my thesis. I would like to insert the acknowledgments after the frontispiece and before the table of contents.

I write

\chapter*{Acknowledgments}

....

\thispagestyle{empty}

But the problem is that it appear in the table of contents and I don't want it. How can I do to exclude this chapter from the table of contents?

egreg
  • 1,121,712
andreasvr
  • 155
  • Add \clear(double)page before \printindex? – Bernard Jul 14 '16 at 10:35
  • @Bernard I don't use the command \printindex but only \tableofcontents... – andreasvr Jul 14 '16 at 10:37
  • Do you mean the “table of contents”? In the standard classes, \chapter*{...} does not insert an entry in the table of contents, so an example is needed. What document class are you using? – egreg Jul 14 '16 at 10:48
  • @Bernard Yes I mean table of contents. I'm using "amsbook" and I would like to write the acknowledgments before it. My problem is that this appear in t.o.c. and i don't know how to hide it. I try to follow this post http://tex.stackexchange.com/questions/20543/excluding-chapters-from-toc-in-amsbook but it doesn't work.. – andreasvr Jul 14 '16 at 10:53
  • @andreassvr: Initially, I read ‘the index’, whence my suggestion. Seemed weird, though. I don't know the details of amsbook, but try, before the acknowledgments, \setcounter{tocnumdepth}{-1}, and put the whole in a group. – Bernard Jul 14 '16 at 11:00
  • @Bernard: Recall that the \setcounter command changes the value of a counter globally. – GuM Jul 14 '16 at 12:11
  • @andreasvr: Why didn’t the answers to Excluding chapters from ToC in amsbook work? – GuM Jul 14 '16 at 12:18
  • @Gustavo Mezzetti: Do you mean, the O.P. should restore the default value afterwards? I suggested to enclose the whole in a group mainly because I don't know the value for amsbook. – Bernard Jul 14 '16 at 12:21
  • @Bernard: That is precisely the problem with the tocnumdepth approach: you need to restore the value manually, and the only completely reliable means of doing this is to store the current value in another counter. – GuM Jul 14 '16 at 12:48

1 Answers1

3

Indeed, the amsbook class defines \chapter* in such a way that an entry is added to the ToC. You need to define a special command “by hand”:

\documentclass[a4paper]{amsbook}
\usepackage[T1]{fontenc}

\makeatletter

\newcommand*\notocchapter[1]{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \thispagestyle{empty}\global\@topnum\z@
  \@afterindenttrue
  \let\@secnumber\@empty
  \@makeschapterhead{#1}\@afterheading
}

\makeatother



\begin{document}

\tableofcontents

\notocchapter{Acknowledgments}
Thanks to everybody!

\chapter*{Introduction}
Introductory text.

\chapter{Genesis}
In the beginning God created the heavens and the earth.

\chapter{Exodus}
These are the names of the sons of Israel who went to Egypt with Jacob.

\end{document}

Edit: I’ve noticed that you want the empty page style on the acknowledgment page, so I’ve updated the above code accordingly.

GuM
  • 21,558