I have a large document with an index compiled through makeindex
, and is included in my source .tex
as follows:
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex
However, the \addcontentsline
does not correctly add the Index to either the Table of Contents, or the list of bookmarks in the resulting PDF.
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . 330
One solution is to write a new command, \immediateaddcontentsline
, and this adds the Index to both the TOC and the list of Bookmarks. The Bookmark link works correctly. But in the TOC, the page number is now listed with roman numerals as "xvi" rather than "349".
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . 330
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
"xvi" is the current page, so it looks like something is mighty confused. It is probably related to the immediate-ness of the new TOC command.
Is it even possible to have an Index listed the Table of Contents? Or must I use a different index maker?
\immediateaddcontentsline
command, please add a minimal working example (MWE) that illustrates your problem.tocbibind
package be of help? Edit: If you're using KOMA rather use domwass' suggestion,tocbibind
is made to work with the standard classes.