34

I'm trying to run the code below but I receive this error: "Option clash for hyperref" Please guide me what should I do. Any help appreciated. Here is the code:enter image description here

45

hyperref is loaded twice:

\usepackage{hyperref}
\usepackage[...]{hyperref}

Just remove the first loading without options.

A package can be given several times in LaTeX, however, the options of the calls after the first \usepackage must be a subset of the options present in the first \usepackage call, because LaTeX does not actually input the .sty file more than one. (Otherwise each \newcommand, ... would cause errors, if called more than once.)

  • 10
    As an aside to this, I had an issue submitting to arXiv and repaired it by moving my call to hyperref above all other package calls. – Andrew D. King Apr 26 '16 at 0:23
  • 2
    @AndrewD.King \PassOptionsToPackage can be used to set additional options before the package is actually loaded. – Heiko Oberdiek Apr 26 '16 at 5:01
  • Seconding @AndrewD.King's comment: I just had the same problem and was very confused about what to do. A quick Google search led me here and his comment proved to be the solution! – Brendan W. Sullivan Jun 27 '16 at 20:59
  • It worked for me. Just be sure to search for the package which gives you the Option Clash error all over your files and see that it is loaded only once. – desmond13 Sep 21 '17 at 17:21
  • I am currently having this issue, but I am using a template which contains hyperref twice, in the following format: \ifpdf \usepackage[ pdftex, other packages ]{hyperref} \DeclareGraphicsExtensions{.png, .jpg, .jpeg, .pdf, .gif} \usepackage[pdftex]{graphicx} \pdfcompresslevel=9 \graphicspath{{0_frontmatter/figures/PNG/}{0_frontmatter/figures/PDF/}{0_frontmatter/figures/}} \else \usepackage[ dvips, other packages ]{hyperref} \fi – supercoolphysicist Mar 29 '19 at 7:54
3

For Beamer users, notice that hyperref is loaded by default. You do not need to add it. In this sense, the problem is exactly the same as the one in the accepted answer (loading the package twice).

In case you want to pass arguments to hyperref, you can add them in the \documentclass command. For instance:

\documentclass[hyperref={colorlinks = true,linkcolor = blue}]{beamer}     
2

Please DO NOT believe this error message on arXiv. It appears even if the PDF is successfully built. Refer to the logs at the end of the post.

Instead, please check the rest parts of your TeX file.

You can follow the instructions below to locate your errors in TeX.

  • Create a minimal TeX file.
  • Add several lines to the TeX file.
  • Build a PDF after adding new lines.
  • Repeat the above two steps until arXiv gives an error message.
  • Try to locate the errors in the newly added lines.

Good luck.

arXiv Logs

  • Still relevant 09/2020. Thanks! – Jens Sep 22 '20 at 23:17

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.