# Meaningful error messages when using LaTeX instead of PDFLaTeX

When I have TikZ images or I include .png graphics, I need to use PDFLaTeX instead of plain vanilla LaTeX. (That is, I need to use PDFLaTeX all the time, rather than just when I want to produce the final PDF).

Sometimes I forget that my current document (or one \included in it) contains one of these things. The compilation using latex doesn't work. The errors I get out when this happens don't seem to be meaningful: they don't just say

No such file image.eps

or

LaTeX can't work TikZ

or the like. Is there anyway I can make these kinds of errors more transparent?

I've often spent ages fiddling with insignificant other bits of code, because I haven't realised it's the image that is messing up the compilation. beamer also sometimes messes up in LaTeX, but I normally spot that one.

-
Is there a reason why you don't just always use pdflatex? – Caramdir Aug 1 '10 at 10:44
I was led to believe that latex compiles quicker, and it's the default for AucTeX in emacs (I know I could change that, but I'm lazy) – Seamus Aug 1 '10 at 13:10
To put that statement to test, I compiled the paper from complang.tuwien.ac.at/anton/latex-bench with latex and pdflatex. latex takes around 0.64s, while pdflatex takes around 0.75s. So you are correct, but I do not think the difference really matters. Also the historic comparison is quite interesting: ftp.complang.tuwien.ac.at/franz/latex-bench – Caramdir Aug 1 '10 at 16:32
For the whole LaTeX source (latex source2e.tex) it's 2.8s vs 3.1s. – Caramdir Aug 1 '10 at 16:39
Typically latex + dvips + ps2pdf is much slower than simply using pdflatex. – Jukka Suomela Aug 1 '10 at 21:47

You can use the ifpdf package to test at the beginning of your document whether you're running with pdflatex and, if not, make latex crash with a more meaningful error message.
Ideally, redefine the appropriate macros to insert blanks (similar to the draft option …). – Konrad Rudolph Aug 1 '10 at 19:13
If you have both includedimage.png and includedimage.eps in the same directory and your LaTeX code doesn't specify the extension, i.e. it says \includegraphics{includedimage}, then latex will pick up the .eps file and pdflatex will use the .png. Even if you don't feel like converting your .png, you could just use a blank placeholder image in .eps format so that latex will also compile correctly. (If you do feel like converting them but don't currently have an easy way to do it, I recommend ImageMagick convert as an excellent free utility.)