This is my first ever using LaTeX, I received a template header from my university to use. Still had done no changes to it whatsoever and I get this error:

! Package hyperref Error: Wrong DVI mode driver option `pdfmark',

The part of the code that is failing is the following:

\ifpdf %pdflatex
    \usepackage[hyperindex,pdfmark,pdftex,colorlinks=true,linkcolor=tumblue,citecolor=citegreen,urlcolor=mailviolet,filecolor=linkred]  {hyperref}
\else %latex && dvips
  • I've already seen some of the other questions about this and tried 2 fixes suggested both did not work as it resulted in a clash of some sort. – Hadi Farah Jun 20 '19 at 22:50
  • 1
    you should remove the pdfmark option from hyperref (you should also remove dvips and pdftex option from hyperref and graphicx – David Carlisle Jun 20 '19 at 22:56
  • you can replace all of the code shown by \usepackage{graphicx}\usepackage[hyperindex,colorlinks=true,linkcolor=tumblue,citecolor=citegreen,urlcolor=mailviolet,filecolor=linkred]{hyperref} – David Carlisle Jun 20 '19 at 22:58
  • @DavidCarlisle thank you for the tip, I did something else though no idea if what I did was right or wrong but it fixed it? At least it's running. if the (if pdf) I replaced pdfmark with driverfallback=pdfmark and in the (else) replaced pdfmark with driverfallback=dvipdfm but kept dvips . Is what I did wrong, should I implement your version ? – Hadi Farah Jun 20 '19 at 23:56

The code shown is trying to specify different driver options for graphicx and hyperref and passing the incorrect options in some cases. However the tests are unnecessary as both packages will automatically detect whether they are being used with pdflatex or latex and choose the correct driver.

So the code can be simplified to


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.