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.

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}
share|improve this question
2  
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 1

up vote 1 down vote accepted

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

share|improve this answer

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.