Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When using hyperref and compiling via pdflatex or dvips, I do not need to specify the driver with \usepackage{hyperref}. However when compiling via dvipdfm this fails and I have to specify the driver using \usepackage[dvipdfm]{hyperref}. A similar situation occurs with the use of graphicx.

Why is that so? Is there a way to fix the hyperref or graphicx packages so that dvipdfm need not be manually specified each time?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

A short answer is 'no, you always need to specify dvipdfm as a driver option'. To explain why, you need to remember that TeX does not handle things like colour, hyperlinks or including graphics directly. Instead, these are left to the driver to sort out. Each driver has its own way of doing things, and so the instructions needed for dvips are different from those for dvipdfm (or other drivers). These instructions are called 'specials' as they are included in a TeX file using the \special primitive. Things are a bit different when using pdfLaTeX as there are a whole family of PDF-specific primitives which do the same job. I'll just call all of these 'specials' in the following.

So why can hyperref and graphicx detect pdfLaTeX versus dvips but not dvips versus dvipdfm? At the (La)TeX level, it is possible to see that direct PDF output is being used, as the primitive \pdfoutput will be set to 1. So the code which determines which specials to use can check this value and make a simple decision: if it is 1, use the specials for direct PDF creation. On the other hand, if the value is 0 then there are more possibilities. The two major ones are, as you say, dvips and dvipdfm. There is no way to tell which of these will be used from within the LaTeX file, and they need different specials. So a decision was made that dvips would be assumed unless the user says otherwise. This is why you need to explicitly say dvipdfm as an option: once it is set then both graphicx and hyperref should pick up the setting.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.