next up previous
Next: Editing existing EPS files Up: Graphics Previous: Tips on using Inkscape

Creating EPS/PDF/SVG files from Mathematica code

Tomorrow you will work more extensively with Mathematica ; those already familiar with Mathematica might wonder how to get those plots or other graphics out of Mathematica into a LATEXdocument. This is quite easy:
  1. Using the mouse, you can simply select a graphic and

    Save Selection as EPS (or, possibly under Mathematica 6.0, as PDF).

  2. Using the Export command from within the notebook. The command, to be place right after you've generated the graphic, will look something like this:

    Export[``graphicfile.eps'',%]

    This will create a file named graphicfile.eps. Mathematica determines what kind of file to create based on the file extension, in this case eps. What goes into the file is determined by the second argument to the Export command. In Mathematica -speak, % means ``The output of the immediately preceeding equation.'' So, you would want to do something like this with your Mathematica code:

    Plot[Sin[x],{x,0,Pi}]
    Export[``Graphic.eps'',%]
    
The same process works for SVG files. In DMW's experience, above a critical size (such as might be encountered with a large `3D' surface plot) Mathematica will crash and NOT produce the SVG file. You can try exporting to an XFig-format FIG file, but XFig mangles some graphics with dense information.


next up previous
Next: Editing existing EPS files Up: Graphics Previous: Tips on using Inkscape
David Wood 2007-06-25