13

I came to this question after looking for a way to explicitly end a \part (as described in this question: https://stackoverflow.com/questions/1483396/how-to-explicitly-end-a-part-in-latex-with-hyperref)

Using \bookmarksetup{startatroot} worked perfectly, but now I'm not sure if there is a reason for loading hyperref or bookmark first.

According to this post: Which packages should be loaded after hyperref instead of before? bookmark should be loaded after hyperref. However, is this always the case?

Any ideas how it should really be?

13

bookmark loads hyperref since it uses some of the code contained within it. As such, it is sufficient to only load bookmark. Since loading of hyperref is included in bookmark, load order doesn't matter.

  • At least in some cases, this breaks down if you want to pass extra options to the "base" package (here, hyperref). Is this an exception? – Blaisorblade Oct 8 '13 at 21:58
  • @Blaisorblade: Then one should use \PassOptionsToPackage{<options>}{hyperref}. See Option clash for package. – Werner Oct 8 '13 at 22:10
  • Isn't reordering packages often (though not always) an easier solution? – Blaisorblade Oct 8 '13 at 22:31
  • @Blaisorblade: Sometimes, but the same things holds in that instance. As an example, what happens when bookmark loads hyperref with some options/ – Werner Oct 8 '13 at 22:35
13

Next to the answer of Werner I want to point to the example of the documentation. There the package bookmark is loaded after hyperref. So you can setup options for hyperref separat. However related to the documentation it's important to load hyperref without disabling the bookmarks.

Although bookmarks loads hyperref I prefer the loading of hyperref separat. The preamble is much clearer and you know what is loaded and why.

5

from the documentation:

2\documentclass{article}
3 \usepackage{xcolor}[2007/01/21]
4 \usepackage{hyperref}
5 \usepackage[
6   open,
7   openlevel=2,
8   atend
9 ]{bookmark}[2011/12/02]
10
11 \bookmarksetup{color=blue}
   ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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