[Tex/LaTex] How to fix “Package hyperref Error: Wrong DVI mode driver option `dvips'”

dvipserrorshyperrefxetex

I'm having this Error when I try to compile my .tex file with xelatex:

! Package hyperref Error: Wrong DVI mode driver option `dvips',
(hyperref)                because XeTeX is running.

See the hyperref package documentation for explanation.

This is my LaTeX header

\documentclass[10pt, a4paper, dvips,]{moderncv}

\moderncvtheme[grey, roman]{classic}

\usepackage{ifxetex}
\ifxetex % only for xelatex
\usepackage{xltxtra} % this should load both fontspec & xunicode
\usepackage{fontspec}
\setromanfont{Helvetica Neue}
\else %
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\fi % \ifxetex

Any ideas?

EDIT:

I removed the 'dvips', now I get:

! Package hyperref Error: Wrong driver option `pdftex',
(hyperref)                because pdfTeX in PDF mode is not detected.

See the hyperref package documentation for explanation.

Now my first latex line

\documentclass[10pt, a4paper]{moderncv}

Any clues ?

Best Answer

Don't use the dvips option for the class (and any package). It will be passed to every package, like all class options, and tell these that they should use the DVIPS mode or driver. You however use apparently XeLaTeX which uses a different driver.

You should not explicitly state the driver in any case. The packages should nowadays be able to determine the correct driver themselves and stating a wrong one manually leads to exactly this kind of errors.

Related Question