TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The LaTeX General Guidelines show a conditional invocation of the graphicx package. I wanted to test this out. I did the following:

  1. Created a main.tex in which I LEFT OUT the big, complicated, conditional header linked above
  2. Included a myplot.pdf and myplot.eps in my working directory.
  3. Included a call to \includegraphics{myplot} in my main.tex.
  4. Ran TeXify. myplot.eps was plotted as desired.
  5. Ran PdfTeXify. myplot.pdf was plotted as desired.

Q: Considering that my steps above worked perfectly fine, what's the point of the big, complicated, conditional header?

Q: Do pdftex and dvips really need to be passed as options to \documentclass and \usepackage{graphicx}?

share|improve this question
Your method is the approach recommended in the FAQ, see this answer. – Lev Bishop Feb 27 '11 at 22:46
up vote 6 down vote accepted

This kind of conditional header is outdated (IMHO). I learned it as beginner as well and stopped using it with the same results as you. The graphicx package is normally very well capable to detect the output driver by itself. This is in most cases even better than hard coding it.

Because pdflatex is nowadays also used for DVI output simply checking for the existence of \pdfoutput is not enough anymore. If you need this use the ifpdf package which provides the \ifpdf switch. One reason to use it might be to define a different extension list with \DeclareGraphicsExtensions for DVI/PS or PDF output. I stopped supporting both formats with my documents years ago. Normally you chose your format in advance and stick with it. IMHO due to the modern eps-to-pdf packages there is not much reason to use DVI output nowadays.

Also: The linked document is a wikibook, i.e. everyone can edit it and therefore the quality can vary. Don't pay to much attention to such websites. There is a lot of outdated material on LaTeX in the WWW.

share|improve this answer
@Martin: thanks as always for the help. Yes, I suspected this was the case. No complicated headers for me then. – lowndrul Feb 27 '11 at 22:44
@brianjd: As always you are very welcome. Please wait before accepting any answers to see what others have to say about this topic. – Martin Scharrer Feb 27 '11 at 22:46
What is the best way to rewrite that example on Wikibooks? That is clearly outdated information. – Caramdir Feb 27 '11 at 23:56
@Caramdir: Do you mean the way to change it or what content should be on its place? Normally simply creating a Wikibook account should be enough to change it. We could discuss some alternative content on Meta. – Martin Scharrer Feb 28 '11 at 0:08
@Martin, one reason to maintain a 'bilingual' workflow would be if you're writing an article and want to send a preprint to something like arXiv (which has a very tight size limit, so the better compression of PDF figures is a real help) and also submit to a journal (which often have PS-based workflows). – Lev Bishop Feb 28 '11 at 1:11

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.