I saw in some articles, the links in the table of content appear in the pages. For example, suppose the first section, Introduction, is at page 11 as the following:

1 Introduction 11

Then the box showing the link is at around number 11 (page number).

In my machine, however, when I use \tableofcontents, the box is around the section title, i.e. "Introduction".

What is the setting I'm missing here? Thanks.

  • 3
    Try \usepackage[linktocpage=true]{hyperref} – Christian Hupfer Apr 13 '15 at 21:40
  • @ChristianHupfer Hi, can you change your comment to an answer so that I can accept it. Thank you very much. – qsp Apr 13 '15 at 21:41
up vote 19 down vote accepted

The standard setup of the package hyperref is to use the content titles (i.e. the section or chapter etc. names) in the ToC as link, however, the option linktocpage=true to hyperref or in \hypersetup will use the page number, saying linktocpage only will work as well (for the lazy ones ;-)

\documentclass{article}
\usepackage{blindtext} 
\usepackage[linktocpage]{hyperref}
\begin{document}
\tableofcontents
\section{First}
\blindtext[5]
\section{Second}
\blindtext[10]
\end{document}

enter image description here

It is even possible to link both: The section label and the page number. Just pass linktoc=all.

\usepackage[linktoc=all]{hyperref}

Full example:

\documentclass{article}
\usepackage{blindtext} 
\usepackage[linktoc=all]{hyperref}
\begin{document}
\tableofcontents
\section{First}
\blindtext[5]
\section{Second}
\blindtext[10]
\end{document}

MWE

MWE is based on the MWE by Christian Hupfer.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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