Converting Adobe Illustrator files to EPS for inclusion in LaTeX

A better way...just use pdfLaTeX

The best way to work with Illustrator and LaTeX is simply to use pdfLaTeX: then we avoid all of the problems I discuss below. As a minor detail, when working with pdf files created in Illustrator, you should add the following command to your LaTeX file to tell it to use the "Artwork Box" as the bounding box:


This "Artwork Box" is automatically saved in the Illustrator ".ai" file, and is calculated as the size of your artwork when Illustrator saves the file.

Note, however, that Illustrator does not actually use "PDF" as it's native format: instead, it embeds the real "native format" information at the end of the PDF file as data that is not displayed. This means that your PDFs are always bigger than they need to be. To reduce the size of the PDFs (for example, to post them to the cond-mat archive), you should use "Save As" to save the file as a PDF, and disable "Preserver Illustrator Compatibility". This will shrink your PDF considerably.

As another minor annoyance, if you do this, Illustrator no longer saves the "Artwork Box" in the file. You can get around this by manually specifiying the clipping box using the clipping box tool. You can then remove the above LaTeX command.

As a further note about Illustrator and cond-mat, you can also very easily in Illustrator optimize your PDF file size while carefully controlling the PDF compression by using the "Compression" settings in the "Save As" PDF options. (Make sure not to overwrite your original ".ai" file...).

(The nice thing about this is that if you use pdfLaTeX for your cond-mat submission, you don't need to fuss with configuring the PStoPDF compression options by embedding special PS commands in your postcript...


Another method for converting adobe illustrator files into latex compatible EPS is using the adobe postscript printer driver, and then using GSView (or the bounding box part of the script below) to convert the file into an eps file.

You will need to download the to download the Adobe Postscript driver from here.

One advantage of this is that it correctly handles transparency!

While I am generally quite a linux enthusiast, I recently became addicted to Adobe Illustrator CS for making high quality scientific figures. It's really pretty good, and now I can't really live without it. There are some very promising linux alternatives now avialable (in particular, Inkscape is probably just as good or even better. Someday I may make the switch.)

At any rate, when I was writing my thesis, inkscape still didn't have all the stuff I wanted, so I was using Illustrator quite heavily. The only problem that I encountered was that the "Export as EPS" option in the newer Illustrator versions produced EPS files that were causing Ghostscript (version 8.50) to give a segmentation fault. (Adobe dumps a load of binary stuff at the end of the EPS file that was causing problems...) This caused particular problems when dvipdfm was using ghostscript to convert the eps into pdf.

My solution was to instead convert the .ai files themselves (which are now pdf compatible in newer Illustrator versions) into an EPS file myself. This required some tricks to get the fonts right (in particular, I had to use pdftops from the xpdf distribution, then use ghostscript to manually add a bounding box). I have posted the script here:

base=`basename $1 .ai`
pdftops -level2 -eps $ $base.eps
gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox $base.eps >& $base.bbox
newbox=`grep -v HiRes $base.bbox`
echo -$newbox-
sed 's/%%BoundingBox.*/'"$newbox"'/' < $base.eps > $base.fixed.eps
mv $base.fixed.eps $base.eps
rm $base.bbox

Just give it a .ai file and it will output a nice EPS figure that will be happy in your latex file.


One problem I ran into is that pstopdf from the xpdf distribution does not support transparent objects (no alpha channel support yet...). I have not found a particularly good way around this yet...If you have an alternative, please let me know.