Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: [mg4172] Mathematica graphics into TeX
Posted:
Jun 16, 1996 2:08 AM


In article <4p8gfp$7d@dragonfly.wolfram.com>, Alan Schwartz <schwartz@arch.umsl.edu> wrote:
> Is there a simple way to incorporate graphics generated by > Mathematica into a TeX document (specifically AmsLatex 2e). > > I suspect that this involves somehow generating an appropriate > Postscript file, but I cannot find out from the Mathematica > book how to do this. >
I assume that you already know how to include PS or EPSfiles into TeXdocuments.
Depending on the system you are working on, you could of course go through the print menu and print to a PSfile, or use the clipboard in some way, but I would not recommend this: It's painful, because it requires lots of mouseclicks every time you change the graphics, and the quality of the PSfile created this way is variable at best, depending on your printer driver (under windows, you typically end up with about a megabyte of garbage).
A much more clever solution is to use the DISPLAYfunction (this function and the very useful job it performs is well hidden in Wolfram's book). DISPLAY produces a file which is not yet a correct PSfile; it has to be fixed by a program called 'psfix'. All this can be done from within mathematica; I am running mma under Linux and use the following function, which produces a goodquality EPSfile from any graphics object:
CreateEPS[ filename_, graphics_ ] := ( Display[ StringJoin[ filename, ".mps"], graphics ]; Run[ "psfix epsf ", StringJoin[ filename, ".mps" ], StringJoin[ ">", filename, ".eps" ] ] )
Unfortunately, psfix does not seem to be included in all distributions of mma. It comes with the Linux version; there, it is a plain shell script which will run on any unix system.
I do not know of any equivalent to psfix on other platforms than unix; does anyone know of a similar program which can be run under windows?
Timo Felbinger (timo.felbinger@unikonstanz.de)



