Re: Re> importing PS files
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Re> importing PS files
- From: ross at macadam.mpce.mq.edu.au
- Date: Wed, 6 May 1992 17:22:32 +1000
My earlier answer to the original question may have been mis-interpreted.
It was not clear whether the question referred to PostScript files created
by Mathematica or files generated elsewhere. My answer referred only to
Mma-generated files, but with a Notebook interface you can do a lot more
(at least on a Macintosh, and presumably also on a NeXT).
-----------
Some PostScript files created outside Mathematica can be imported into a
Mathematica Notebook Front-End and displayed there.
Indeed you can edit the text file to change the PostScript and have it
re-render the graphic with the changes.
This is all done in the Front-End --- there does not need to be a kernel
present for this.
With no kernel, use the editor, Copy, Paste method to get the (PostScript)
text file into a cell.
With a kernel, use the !! (read text file) command to import the file.
I said `some` PostScript files, because the Front-End is not a full
PostScript Interpreter.
If you stick to simple commands like:
moveto, lineto, stroke, fill, setgray, setlinewidth, setrgbcolour,
setdash, setlinecap
newpath, gsave, grestore, def, scale, translate
you'll be OK.
Control operators are a different matter: e.g. loop, repeat, for, if,
ifelse, stop, ...
I have not explored to find out which ones work and which do not.
Perhaps someone at WRI can clarify precisely which commands have been
implemented in the Front-Ends.
------------
For "PostScript" generated by Mathematica --- the " are intentional, due
to above comments :-)
there are more options...
Suppose you, or someone else, have created a Mathematica Graphics object
and saved it to a file using Display, e.g.
In[1] := Plot[.....]
Out[1] = -Graphics-
In[2]:= Display["mygraph", % ]
Out[2] = -Graphics-
There are several things you can do with this file "mygraph".
1. Attach the Mathematica PostScript header...
e.g. under Unix
psfix mygraph > mygraph.ps
The resulting file "mygraph.ps" can now be
a) sent to a PostScript laserprinter,
b) previewed with a PostScript viewer,
c) imported into a word-processing program that handles Encapsulated
PostScript (EPS or EPSF) files
d) included into a TeX document via a \special (depending on how your .dvi
files are handled).
e) any other use you may have for PostScript files.
All these are totally independent of the Mathematica origins of mygraph.ps