[comp.text] postscript from mathematica and LaTeX

jzavgren@bbn.com (John Zavgren) (05/06/89)

Has anyone out there successfully included the postscript code from
Mathematica into LaTeX documents?  Psfig is probably the way to go. I
suspect the Mathematica program, psfix, will make it printable,
but one still has to compute a bounding box.

RSVP 
 John Zavgren

m1swd00@fed.frb.gov (Sean W. Doyle) (05/10/89)

Here's a simple (?) and crude way to print Mathematica graphics
in a LaTeX document. This works with the version of dvi2ps that
comes with the UniTeX distribution:

(1) Create a Mathematica plot and place it into the file 
    "plot.inc" with the following commands:

    In[1]:= Plot3D[Sin[x y],{x,0,Pi},{y,0,Pi}]

    Out[1]= -SurfaceGraphics-

    In[2]:= Display["!psfix>plot.inc ",%]

    Out[2]= -SurfaceGraphics-


(2) Edit the PostScript (I didn't say this was elegant, did I?)
	(a) change the dimensions of the plot:
		/Mwidth 8.5 => /Mwidth 4
		/Mheight 11 => /Mheight 4
	(b) delete:
		showpage

(3) Now include the LaTeX macros that Charlie Geyer posted to this
    group (I haven't asked his permission to re-post his macros... but
    it might be inconvenient for some people to get back postings...) They
    are short enough to re-post (I think...). 

    Thanks Charlie!
   
% ---------------------- cut here ----------------------------	
% Author: Charlie Geyer
% These macros were read off of the newsgroup comp.text on 
% March 18, 1989.
% macros for postscript files...
% 
% Includes postcript file
\def\psinc(#1,#2)#3{
\setlength{\unitlength}{1in}
\centering\begin{picture}(#1,#2)
\put(0,0){\special{#3}}
\end{picture}}
%
% Includes postcript file, places framebox around figure.
\def\framepsinc(#1,#2)#3{
\setlength{\unitlength}{1in}
\centering\begin{picture}(#1,#2)
\put(0,0){\framebox(#1,#2)[bl]{\special{#3}}}
\end{picture}}
%
\def\postscript{{\sc PostScript}}
% -------------------- end of macro file ---------------------

(4) You can then include this plot in your LaTeX document using the
    following commands:
	\begin{figure}[h]
	\psinc(4,4) {psfile=plot.inc}
	\caption{blah blah blah}
	\end{figure}
    Note that the dimesions reserved by \psinc (4,4) are the same
    size as the editing changes in step (2). 



If you have more questions about the LaTeX macros you might want to
go back to Charlie Geyer's orginal posting.

Hope this helps. If BoundingBox ever got included it would make things
easier....

Sean