Sunday, September 2, 2012

How to make pdflatex accept .eps images

Unfortunately, pdflatex does not support .eps images, for example the following code fails:
The fix is to put the following lines at the top of the document:
\DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf #1}
and compile with the -shell-escape flag:
pdflatex -shell-escape my_file.tex
Then the above code works. You need the epstopdf program that is run behind the scene.

Update: Apparently, it's enough to just include the following line at the top of the document:
One still has to compile with the -shell-escape flag. This works for me in Ubuntu 12.04.

Thanks to:

1 comment:

Unknown said...

Some additional mucking about is necessary to get the epstopdf package to accept images from TEXINPUTS:

epstopdf --outfile=\OutputFile \space `kpsewhich \space "\SourceFile"`

It turns out the \space is crucial otherwise the filenames get concatenated together.

Thank you for the tip.

-- Rhys