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: