Child pages
  • Automatic pdf linked document structure
Skip to end of metadata
Go to start of metadata

The LaTeX package hyperref

Pdf documents often have a document outline attached which, with viewers such as Acrobat reader, allow you to jump to the sections of the document you are interested in without having to scroll through the whole document from the top.  This can be done automatically in LaTeX (pdflatex) with the package hyperref.

This package will also turn all of your figure, bibliographic and equation references into pdf links that will take you directly to the referenced item.  To use this package add the following line of code to your Latex preamble

and compile a few times ignoring the errors until it works.  The list of options given above prevents this package's default options from turning your document into an unpleasant multicolour mess (though this mess only appears on screen, not in print). It will also ask the PDF viewer to show a fully expanded set of PDF bookmarks.

Another trick you might want to try is this. Add some lines to your preamble, after loading hyperref and declaring the title and author, like so.

If you are using the memoir document class, things are even easier.

This will fill out the PDF metadata for you with the correct information. You can then feel smug any time you see a PDF come up on Google with the title 'Microsoft Word - template.doc'.

This package can also be used to add website links to your documents. The following command is useful in beamer slides and other contexts where you don't want to display the actual URL:

For more detail on the other features of this package (of which there are many) go to

  • No labels


  1. The code in the first example above is actually more complicated than you need.

    • The pdfTeX backend is automatically selected when running pdfLaTeX.
    • The colorlinks=true option automatically sets pdfborder={0 0 0}; it's this pdfborder option that removes the multicolour mess.
    • Using colorlinks=true and *color=black when your text is black anyway is the same as using the default colorlinks=false; the difference comes when you want to use coloured text (say, in a poster or presentation).

    So really all you need is this

  2. Unknown User (pab23)

    The \thetitle and \theauthor don't appear to be working for me. Are there any other packages that need to be loaded to get these to work??

    1. Sorry, I generally use the memoir class, and misremembered exactly how it differs from the standard classes with respect to \title, \author and \date. Text now amended above with the right advice. (smile)

  3. By the way, if you find yourself using the more advanced features of \author, the above technique for adding the information to the PDF metadata will sort-of-work but throw all kinds of warnings at you. To avoid these, the technique needs a little tweak.

    The \pdfstringdefDisableCommands command here will substitute ordinary punctuation for \and and double-backslash in places where they wouldn't work (like the PDF metadata fields, PDF bookmarks, etc.) but leave them untouched in the main body of the document.