I load the following packages:


\usepackage{amsfonts, amssymb, amscd}

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, 2015 at 15:12
  • Note that hyperref should go last in your list of loaded packages.
    – egreg
    Apr 3, 2015 at 15:37

1 Answer 1


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:


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, 2015 at 15:16

You must log in to answer this question.

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