[Tex/LaTex] Placing a PDF bookmark to the index page

bookmarkshyperrefindexingpdfpdftex

Using \usepackage{hyperref}and the \pdfbookmark[0]{...}{...} command you can place a PDF bookmark just before the index page generated with \printindex (Sometimes it will point to the empty page before the index.)
How can one place a bookmark exactly to the Index title?


After reading the answers so far, I have to refine the question a bit it seems.

I have now noticed two things that escaped me at first:

  • The index is always placed on an odd page. (May be common knowlegde but wasn't for me 🙂
  • If the even page before the index has text on it, then the bookmark placed before \printindex will point to the index page. If there is an empty (even) page inserted, then the bookmark will point to this empty page instead of the index page.

I also should have provided the construct that places the index in our custom document class:

 \AtEndDocument{
   \pdfbookmark[0]{\indexname}{bookmarkForTheIndex}
   \printindex
 }

Note that I found something talking about AtEndDocument and the index, but I fear I do not quite understand it … http://www.tug.org/TUGboat/Articles/tb19-1/tb58works.pdf

Best Answer

\printindex starts a theindex environment, which by default calls \twocolumn, which - and this causes your problem - starts a new page. The following should do the trick:

\cleardoublepage
\pdfbookmark[0]{\indexname}{idx}
\printindex

(You could also simply include the index in your table of contents.)