Package loading order with hyperref

The hyperref package documentation says: “Make sure it comes last of your loaded packages”. The reason is that it redefines many LaTeX commands. It’s a rule of thumb that helps to avoid errors.

However, there are exceptions, for instance the amsrefs user’s guide notes that amsrefs has to be loaded after hyperref. Many others are documented in section 6 of the hyperref README.

To avoid problems when adding hypertext functionality, here is a list of exceptions, that is, a list of packages which have to be loaded after hyperref, instead of before hyperref:

  • cleveref
  • amsrefs
  • float before hyperref before algorithm
  • chappg
  • sidecap
  • linguex
  • minitoc
  • geometry: From the User manual: With mag <> 1000, no truedimen and hyperrefhyperref should be loaded before geometry. Otherwise the resulted PDF size will become wrong.
  • robustindex
  • hypdestopthypcaphypbmsec
  • hypernat
  • attachfile
  • showframeshowidx (which disables the \hrefs in the index but in this loading order at least documents compile at all)
  • uripagesltsregstats
  • refcheck
  • bookmark
  • glossaries
  • apacite

Probably also further packages with \RequirePackage{hyperref}. A quick search in TeX Live 2011 resulted in this list:

  • amsrefs
  • attachfile2
  • bugtracker (part of pgfplots)
  • classicthesis
  • doi
  • dtx-style (part of thuthesis)
  • eforms
  • exerquiz
  • hypgotoe
  • insdljs
  • ltxdockit
  • opcit
  • prerex
  • rec-thy
  • tdclock
  • toptesi
  • ydoc-code and ydoc-desc (both part of ydoc; note, that ydoc-doc contains \hypersetup without loading hyperref) )

Packages with \RequirePackage[<some option(s)>]{hyperref}:

  • beamerbasearticle
  • bidituftehyperref
  • chextras
  • cmpj
  • dtk-pdf
  • easy-todo
  • hep
  • hrefhide
  • ifmslide
  • lstdoc
  • ocgtools
  • pdfcomment
  • pdfscreen
  • pdfx
  • rvdtx
  • strukdoc
  • ucshyper

This list was created on TeX.SE with the help of Lev Bishop, Stephen, Geoffrey Jones, Simon, Werner, and Stijn Hoop.

Leave a Reply