3

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}?

Martin Scharrer
  • 262,582
lowndrul
  • 5,323

1 Answers1

6

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.

Martin Scharrer
  • 262,582
  • @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 00:08
  • @Martin: What exactly to put in its place. – Caramdir Feb 28 '11 at 00:09
  • Material can be outdated even easier if noone can change it :-) – Paŭlo Ebermann Feb 28 '11 at 00:20
  • 1
    @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 01:11
  • @Hendrik: thanks for pointing that out. I was confused as to what that was (thought it meant less than 20% of my posts were accepted without having to be edited :>). Went back and chose accepted answers for almost all my questions. – lowndrul Mar 02 '11 at 15:32
  • @brianjd: Great! (And keep in mind, it's usually good to wait a bit before accepting; other people might come up with better answers.) – Hendrik Vogt Mar 02 '11 at 15:35