		 Converting Mathematica PS to standard PS

							Shawn Sheridan
							shawn@dragonfly.wri.com
WRI Technical Support (c) Copyright 1989
Created: June 9, 1989

  The output from any of the Plot commands is one of
  Mathematica's graphics objects.  Although the Mathematica
  expression defining this object may be quite large, the
  output form is quite short.  For example
  
  In[1]:= Plot[ Sin[x], {x, 0, 2Pi}]
  
  Out[1]= -Graphics-
  
  Above, the word -Graphics- is a shortened notation for
  a potentially large collection of graphics primatives.
  In this case, a rather long Line primative as you can see
  below.
  
  In[2]:= InputForm[ % ]
  
  Out[2]//InputForm=
    Graphics[{{Line[{
         {0., 0.},
         {0.2617993877991494, 0.2588190451025207},
         {0.5235987755982988, 0.5},
         {0.7853981633974483, 0.7071067811865475},
         {0.916297857297023, 0.7933533402912352},
  
         ....( 70 lines were deleted here )....
  
         {5.497787143782137, -0.7071067811865484},
         {5.759586531581287, -0.5000000000000013},
         {6.021385919380436, -0.2588190451025224},
         {6.283185307179585, -(2.021278110164726*10^-15)}}]}},
     {PlotRange -> Automatic, AspectRatio -> GoldenRatio^(-1),
      DisplayFunction -> (Display[$Display, #1] & ), PlotColor -> Automatic,
      Axes -> Automatic, PlotLabel -> None, AxesLabel -> None,
      Ticks -> Automatic, Framed -> False, Prolog -> {}, Epilog -> {},
      AxesStyle -> {}, Background -> Automatic, DefaultColor -> Automatic}]
  
  
  Not only is this graphics object created by the Plot command,
  but Plot also assumes that you want to see a rendering of the
  graphic,  so it calls the Show command on the object that it
  just created.  The default behavior for the Show command is
  to create a PostScript (PS) description of the graphics object
  (i.e. "Display" it.) and to pass this PS over to a screen
  PostScript interpreter that renders the image on your screen.
  
  The PS that Display creates, however, is not real PS in the
  sense that the PS contains additional commands not in the
  definition of PS itself.  For example, you may see "Mdot"
  in the PS that Display creates but you will not find it
  in Adobe's PS reference manual.  This is fine as long as
  the PS interpreter that does the rendering understands these
  "extensions" to PS that Display creates.  As you would
  expect, all of the Mathematica PS interpreters understand
  these extensions.
  
  However, no other PS devices understand these extensions.
  In order to render the PS that Display creates on another
  PS device, one must include definitions for these extended PS
  commands in terms of standard PS.  This is standard practice
  in the world of PS and there is a recommended mechanism for
  doing this--the prolog.  The prolog is a collection of
  definitions of new PS commands in terms of standard PS.
  This prolog is simply added to the front of the PS that
  Display produces before it is shipped off to a foreign PS
  device.  I.e., the PS needs to be "fixed" to make it
  compatible with standard PS.
  
  The way you fix PS created by Display depends on the
  operating system you are using.  Below is a description
  of the technique for three operating systems:
  
  MS-DOS
  ------
  In MS-DOS Mathematica, Displayed PS is fixed by a utility
  program called PRINTPS.  PRINTPS creates print jobs using
  Mathematica generated PS as input.  The print job can be
  sent to a printer device attached to the machine or it
  can be sent to a file.  The example below creates a
  "fixed" PS file called REALPS from the Mathematica
  generated PS that was Displayed into the file MATHPS.
  
  
  In[1]:= Plot[ Sin[x], {x, 0, 2 Pi} ]
  
  Out[1]= -Graphics-
  
  In[2]:= Display[ "MATHPS", % ]
  
  Out[2]= -Graphics-
  
  In[3]:= Quit
  
  C:\MATH> PRINTPS -PRINTER PS MATHPS -FILE REALPS
  
  
  MacOS
  -----
  * Issue a Plot or Show command to create the PostScript image in a Notebook
  cell.
  
  * Select the cell by clicking the cell bracket or anywhere in the contents of
  the cell
  
  * Choose Copy from the Edit menu
  
  * Choose Convert Clipboard... from the Edit menu.
  
  * Select the Encapsulated PostScript radio button.
  
  * Click the Save in File... button to name and save the new file
  
  
  Unix
  ----
  
  For Unix versions of Mathematica, Displayed PostScript is fixed by
  a shell script utility called psfix.  psfix  reads standard input
  (presumably PostScript created by the Mathematica Display[]
  command)  and sends to standard output PostScript that can be
  directed to a PostScript device.
  
  The example below creates a "fixed" PS file called realps from
  the Mathematica generated PostScript that was Displayed into
  the file mathps.
  
  
  In[1]:= Plot[ Sin[x], {x, 0, 2 Pi} ]
  
  Out[1]= -Graphics-
  
  In[2]:= Display[ "mathps", % ]
  
  Out[2]= -Graphics-
  
  In[3]:= Quit
  
  % usr/local/math/Bin.sun3.68881/psfix < mathps >realps
  % lpr realps
  
  The example below pipes the output of Display[] through psfix to
  lpr.
  
  
  In[1]:= Plot[ Sin[x], {x, 0, 2 Pi} ]
  
  Out[1]= -Graphics-
  
  In[2]:= Display[ "!psfix | lpr", % ]
  
  Out[2]= -Graphics-
  
  In[3]:= Quit
  
  But the function PSPrint[] defined in the file init.m does
  exactly this:
  
  In[1]:= ??PSPrint
  
   PSPrint[-graphics-] sends graphics to a printer.
  
   Attributes[PSPrint] = {Protected}
   PSPrint/: PSPrint[System`Private`x_] :=
  
   >    (Display["!psfix | lpr", System`Private`x]; System`Private`x)
  
  In[2]:= Plot[ Sin[x], {x, 0, 2 Pi} ]
  
  Out[2]= -Graphics-
  
  In[3]:= PSPrint[ % ]
  
  Out[3]= -Graphics-
  
  In[4]:= Quit
