Possible Duplicate:
Index is incorrectly listed in the table of contents
I want to add a custom section to my table of contents.
I know I can use addcontentsline{toc}{section}{title}
. However, it doesn't use correct reference. When clicking on the item in the toc, it just jumps to the wrong section.
MWE:
\documentclass[a4paper]{scrartcl}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[pdftex,bookmarks=true,bookmarksnumbered,colorlinks=true]{hyperref} % http://ctan.org/pkg/hyperref
\usepackage{nameref}
\usepackage{makeidx}
\makeindex
\begin{document}
\tableofcontents
\section{Section 1}
\index{bla}. \index{blub}.
\section{Section 2}
\addcontentsline{toc}{section}{Index}
\printindex
\end{document}
To compile, run:
pdflatex file.tex
makeindex file
pdflatex file.tex
pdflatex file.tex
When clicking on Index
it jumps to "2 Section 2" instead of "Index".
\clearpage\phantomsection\addcontentsline{toc}{section}{Index}\printindex
.\usepackage[nottoc]{tocbibind}
takes care of the matter without any\addcontentsline
command.