Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having troubles making Index visible in the navigation that is shown with the pdf preview of the document. Namely, the following is the end of my main .tex file:

% Bibliography
% =================================================================
\bibliographystyle{plainnat}
\bibliography{refs}
\addcontentsline{toc}{chapter}{Bibliography}
% =================================================================

\printindex
\addcontentsline{toc}{chapter}{Index}

This indeed show Index in the navigation, but it actually points to bibliography. Exchanging places of \printindex and \addcontentsline removes Index from the navigation. How could I achieve precise navigation to Index?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

When LaTeX sees your \addcontentsline command, it has already finished typesetting the index. So if this is longer than one page, the reference to the page number will be wrong. Do

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}
\printindex

or try the package tocbibind which will add the entry automatically (also for the bibliography and, by default, the Table of Contents itself):

\usepackage[nottoc]{tocbibind} % nottoc will exclude the toc

Alternatively you can use

\usepackage{imakeidx}
\makeindex[intoc]

instead of \usepackage{makeidx}\makeindex. This will also balance the last page in the index. Remember to call hyperref after imakeidx.

share|improve this answer
    
Your first answer was good enough, thanks –  boy Jun 12 '12 at 20:38
4  
@boy If I weren't the author of imakeidx I'd use the second: simple and effective. –  egreg Jun 12 '12 at 20:40
    
\usepackage[nottoc]{tocbibind} produce right pagenumber, but the link is made to the last chapter... –  Anton Petrunin Feb 6 '13 at 21:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.