Illustrator, EPS and LaTeX

lokakuu 30, 2008

Ironically, Adobe Illustrator creates malformed files when you save your illustrations as EPS, and of course LaTeX, ghostscript and thus pdflatex choke on them. There’s however a simple remedy: the eps2eps “distiller” strips all non-essential parts away from EPS files thus fixing also malformed AI EPS files.

For reference, here’s the gist of my (unoptimized) eps2pdf script I use before I run pdflatex:

#!/bin/bash
mkdir temp-eps-eps
for file in *.eps; do
    echo -e "$file";
    eps2eps $file temp-eps-eps/$file;
    cd temp-eps-eps;
    epstopdf $file --outfile=`echo -e $file | sed -e "s/\.eps/\.pdf/g"`;
    mv `echo -e $file | sed -e "s/\.eps/\.pdf/g"` ..;
    rm $file;
    cd ..;
done
rmdir temp-eps-eps

This should be called in the directory whose EPS files you wish to convert to PDF.

And why do I use EPS? Pretty much any vector graphics application supports it. Pretty often, saving your illustrations directly as well-behaving PDFs can be much more difficult than using EPS.

Leave a Reply