6

I load the following packages:

\documentclass[12pt]{amsart}

\usepackage{amsfonts, amssymb, amscd}
\usepackage[dvipdfm]{hyperref}
\usepackage{verbatim}
\usepackage{eucal}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage{cite}
\usepackage{upref}
\usepackage[all]{xy}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}

Could any one can tell me why when I run the latex, it always has error:

Package hyperref Error: Wrong DVI mode driver option `dvipdfm',
(hyperref) because pdfTeX or LuaTeX is running in PDF mode.

How should I fix this problem?

(Besides, I can see the PDF file of the paper, and it seems there is no error in the file.)

  • The dvipdfm suggests you are targeting latex + dvipdfmx, while the error says you are running pdflatex! – Joseph Wright Apr 3 '15 at 15:12
  • Note that hyperref should go last in your list of loaded packages. – egreg Apr 3 '15 at 15:37
10

You are running pdflatex or lualatex in PDF mode (second line of the error message), but you have specified a driver dvipdfm, which only works for DVI output (second line of the error message).

Since hyperref can detect the correct driver here (hpdftex.def), the error recovery works by ignoring the wrong driver specification.

If you want to compile the document both with pdflatex/lualatex and latex/dvipdfm, then option driverfallback can be used:

\usepackage[driverfallback=dvipdfm]{hyperref}

Then hyperref uses the driver for pdflatex/lualatex, if it detects them. Otherwise dvipdfm is chosen.

  • Wow! That works perfectly! Thank you for your wonderful answer!!!! – Li Yutong Apr 3 '15 at 15:16

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.