53

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

0

3 Answers 3

60

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.)

7
  • 11
    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. Commented Apr 26, 2016 at 0:23
  • 2
    @AndrewD.King \PassOptionsToPackage can be used to set additional options before the package is actually loaded. Commented Apr 26, 2016 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! Commented Jun 27, 2016 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
    Commented Sep 21, 2017 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 Commented Mar 29, 2019 at 7:54
22

BEAMER USERS:

Notice that hyperref is loaded by default. You do not need to add it. So remove the explicit \usepackage[...]{hyperref} line.

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}     
1
  • 1
    Ah, nice. I solved this by removing the \usepackage[options]{hypperref} call and moving the options to \hypersetup{}.
    – AstroFloyd
    Commented Mar 5, 2023 at 9:32
3

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

3
  • Still relevant 09/2020. Thanks!
    – Jens
    Commented Sep 22, 2020 at 23:17
  • While I believe the commentary above matches my case, see also overleaf.com/learn/how-to/LaTeX_checklist_for_arXiv_submissions which suggests setting hyperref options separately from package loading.
    – Sterling
    Commented May 10, 2022 at 4:22
  • In particular, you may find it useful to locate the line that says [verbose]: We failed utterly to process the TeX file 'main.tex' as opposed to simply [verbose]: tex 'main.tex' failed.
    – Sterling
    Commented May 10, 2022 at 4:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .