# Hyperref links to correct page, but too low (headings not visible)

To add your nomenclature, bibliography and index to the table of contents you have the choice between

1. using built-in options of the corresponding packages, i.e., using \usepackage[intoc]{nomencl}, \printbibliography[heading=bibintoc] and \usepackage[totoc]{idxlayout}, or

2. doing this manually by adding

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{xxx}


before \printnomenclature, \printbibliography and \printindex.

Both methods give the same visual output.

Method 1 seems to be preferable because it is much cleaner code, you don't have to use the same three lines of method 2 several times and you don't have to manually type the heading name in the addcontentsline.

However, if you're using hyperref, the links in the toc point to the first line after the corresponding heading (i.e., the heading itself is not visible). Compare it to the link to a standard chapter which points to a position quite a bit above the heading. The same is true for method 2.

Is this behavior intentional? If so, why? Can i somehow use method 1 and still get links as in method 2?

Method 1 (only for nomenclature, the same holds for bibliography and index):

\documentclass{scrreprt}

\usepackage[intoc]{nomencl}
\usepackage{hyperref}

\makenomenclature

\begin{document}
\tableofcontents
\nomenclature{$T$}{test}

\chapter{Test}
\printnomenclature
\end{document}


Method 2 (only for nomenclature, the same holds for bibliography and index):

\documentclass{scrreprt}

\usepackage{nomencl}
\usepackage{hyperref}

\makenomenclature

\begin{document}
\tableofcontents
\nomenclature{$T$}{test}

\chapter{Test}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Nomenclature}
\printnomenclature
\end{document}

-
I can't notice any differences. Which version of hyperref do you use? – Marco Daniel Apr 9 '12 at 9:13
@MarcoDaniel: Thanks for this reminder! Sometimes I forget that the TeX-installation here in our office is quite old. After updating from the ancient v6.79a to v6.82o, the problem disappeared. Do you want to turn your comment into an answer? – boothby81 Apr 10 '12 at 13:58

## 1 Answer

Both of your examples work well with the current version of hyperref. So I recommend to use the newest version of hyperref.

-