How To Fix Adobe Illustrator 9.0's EPS Output For Use in LaTeX

When writing talks, publications, etc., I typically work in Linux, using LaTeX, ghostscript, and some programs we've written in the lab. However, I often use Adobe Illustrator to make figures, because frankly it's the best vector graphic drawing program I've found out there. In addition, Illustrator supports reading and writing of EPS files, which makes it convenient to read existing PostScript files into Illustrator, to save Illustrator files in EPS format and include them in documents, etc.

Up through version 8.0, I had no problem moving EPS files back and forth between Illustrator and other applications (particularly ghostscript and LaTeX), even when I made changes to the PostScript code by hand. With version 9.0, though, suddenly including Illustrator EPS files in LaTeX stopped working. To figure out why, I started poking around in the EPS output of Illustrator. In this new version, Adobe's added a new section after the showpage command. This section consists of a few commands followed by a PrivateData region. To get the EPS file to display properly in LaTeX or gs, I had to delete everything after the showpage command (note: if you do this yourself, be sure to add a carriage return after the showpage line). After doing that, the EPS file behaved just as in the old versions.

Unfortunately, cutting out this section also prevents Illustrator from being able to open the file again: when you try, the program just hangs with an hourglass pointer until you kill it. To fix this problem, you need to "comment out" two lines from the top of the file (note: the lines are already "comments" in PostScript, since they start with a % sign. However, comment lines of the form "%%Keyword: Value" are called DSC lines, which are treated specially in PostScript. Adding "% " to the beginning of each line prevents the PostScript interpreter from treating these as DSC lines. Thanks to Jont Allen for the tip.). The lines that look like this:

%%Creator: Adobe Illustrator(R) 9.0
%%AI8_CreatorVersion: 9.0
should be changed to look like this:
% %%Creator: Adobe Illustrator(R) 9.0
% %%AI8_CreatorVersion: 9.0

Apparently when Illustrator sees these two lines, it assumes it's dealing with an Illustrator file, so it looks for the PrivateData section to get its information. To test this idea, I cut this section out of one file (let's call it file A) and pasted it into another file (file B). When I opened the resulting file in Illustrator, I saw the contents of file A, even though the actual PostScript code described file B. So if the PrivateData section is present, and the two lines above are at the top of the file, Illustrator completely ignores the PostScript code.

Summary:

  1. Delete everything after showpage
  2. Comment out the %%Creator: and %%AI8_CreatorVersion: lines.