[texhax] Index in Table of Contents

Barbara Beeton bnb at ams.org
Sun May 30 20:19:26 CEST 2010

    I've been trying to generate a table of contents entry that includes the
    Index.  The standard \printindex produces a gorgeous Index of course.  But
    neither \*printindex* nor an* \addcontentsline{toc}{chapter}{\numberline
    ~Index}* produce an entry for Index in the Table of Contents.  All the
    other entries in the Table of Contents are at the Chapter Level only.
    Any suggestions, please?

try this.
determine the correct page number for the
first page of the index, and substitute it
for NN in this line:


insert this directly *before* \printindex .

the "standard" latex document classes don't
insert the titles of starred (unnumbered)
chapters in the t-of-c.  \printindex reads
in the .ind file with the assumption that
the index entries are wrapped in
and the generation of a contents line would
be triggered in the processing of the \begin
expansion.  if you add the line after
\printindex, it would still be okay as long
as you explicitly give the correct page
number, but if you use \addcontentsline and
expect an automatic page number, that will
be incorrect.  of course, you can fiddle with
the page counter and make it work automatically,
but it's really a pain.

the ams document class amsbook.cls *does*
include all unnumbered chapters and sections
in the t-of-c.  this is a design decision.
if you have the determination to look at the
code, you will find the difference in the
definitions of \@schapter in amsbook.cls
and book.cls; compare these with the defs
of \@chapter.

    I have a feeling this is a dumb question, but I can't find the source files
    for the Mittleback and Goosens Latex Companion which does have an entry for
    the Index in the Table of Contents!

you won't be able to find those source files.
the latex companion is copyright, and not
public.  the fact that the source file for
the texbook is public is owing to the
unusual generosity of don knuth; however,
please note that it should not be tex'ed
without explicit permission (which has been
granted only for purposes of timing tests
and validation of tex implementations on
various platforms, with the output not to
be distributed).
						-- bb

More information about the texhax mailing list