Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

specifying a file as EPS?

Status
Not open for further replies.

Wolfie7873

Technical User
Jan 15, 2004
94
US
tgreer, I hope your 'listening.'

So I've gotten ok at postscript coding, but I need to take it a step further - this time for a numerical analysis class.

I generated a 3D plot in Matlab for my project, exported it as an EPS file and successfully incorporated it into a LaTeX document and it displays great.

I'm trying to include an original drawing done strictly with PS and save it as EPS so I can put is as well into my LaTeX document.

I don't know if there's anything special in an EPS document that specifies it as such, but it doesn't quite load right in the LaTeX document. Any suggestions?

Eddie
 
Hi Eddie.

The official spec:


In short, an EPS has to be a single image. Don't think in terms of a "page", but rather of a picture on a page.

There are some required comments, so that programs that consume the EPS can know about it without having to interpret it.

Two are always requred:

Code:
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: llx lly urx ury

The first is the "version" comment that tells EPS consumers to which version of the EPS spec you conform. The second is the absolute smallest rectangle in which the EPS fits, in points.

There are other comments if you have other things, such as embedded fonts, images, forms, etc. Read the spec for these.

The second aspect of EPS files, besides the comment structure, is that certain operators are not allowed. Programs that emit EPS files break these rules all the time. It's irritating!

But here's a short list of commonly used operators that are a no-no:

Code:
clear 
quit
showpage
setpagedevice

There are more, but you rarely encounter them anyway. And technically, showpage may not be illegal, but it violates the principle.

You have to be real careful with your stack, always clean up after yourself. The calling program's stack, gstate, dictstack, etc should all be the same after your EPS as before. So use your own internal dictionary if you can, rather than userdict.

Other than that, it's just like a regular PostScript program.

Many programs will output "Private Dictionaries". These appear as comments in the file, but when the original program opens the file, it performs some operators based on the code hidden in the comment. I'm a purist and don't like that. Keep it simple.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top