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.

I am currently hunting for errors in my template and these two I cannot solve after reading the log and researching:

! LaTeX Error: Option clash for package hyperref.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.7 

The package hyperref has already been loaded with options:
  []

I already ruled out

  • Bibliography-styles requiring it
  • Package not loaded last
  • Putting global hyperref options in Documentclass options (even more errors)

My current knowledge is that some package/configuration file loads/requires hyperref. Therefore I looked at the log-file. But as a beginner I cannot decipher (a) which package causes the problem and (b) how I can solve/bypass it.

Minimal example:

\documentclass[a4paper, 12pt, oneside]{book}

\usepackage{bookmark}
\usepackage[
    ocgcolorlinks=false, %sample
]{hyperref}

\hypersetup{   
    urlcolor=red, %sample
}

\makeatletter
    \if@twoside
        \hypersetup{pdfpagelayout=TwoPageLeft, linkcolor=red}
        \fi
\makeatother

\begin{document}

This is a test.

\end{document}
share|improve this question
4  
Using your code, I don't get any error if I load bookmark AFTER hyperref. Try it. –  Jubobs Mar 7 '13 at 14:27
5  
You need to load bookmark after hyperref: 1. The clash doesn’t exist anymore. 2. bookmark re-defines some hyperref’s macros. –  Qrrbrbirlbel Mar 7 '13 at 14:27
2  
I can imagine that this would be hard to debug given the number of places where I've read that hyperref should be the last package you load. –  Ethan Bolker Mar 7 '13 at 14:41
1  
@EthanBolker Yes, but see also Which packages should be loaded after hyperref instead of before? And packages, which should be loaded after hyperref, often state this in their documentation. I know “often” is not “all”, though … –  Speravir Mar 7 '13 at 21:14

1 Answer 1

Loading bookmark after hyperref solves the error.

See Bookmark-Documentation on page 7.

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.