Next: C.2 Converting GMT PostScript Up: C. Including GMT graphics Previous: C. Including GMT graphics Contents Index

#
C.1 Making GMT Encapsulated PostScript Files

GMT can produce both freeform PostScript files and the more restricted Encapsulated PostScript files (EPS). The former is intended to be sent to a printer or PostScript previewer, while the latter is intended to be included in another document (but should also be able to print and preview). You control what kind of PostScript that GMT produces by manipulating the PAPER_MEDIA parameter (see the gmtdefaults man page for how this is accomplished). Note that a freeform PostScript file may contain special operators (such as `Setpagedevice`) that is specific to printers (e.g., selection of paper tray). Some previewers (among them, Sun's pageview) do not understand these valid instructions and may fail to image the file. Also, embedding freeform PostScript with such instructions in it into a larger document can create printing to fail. While you could choose another viewer (we recommend ghostview) to view single plots prepared by GMT, it is generally wiser anyhow to select EPS output when you are creating a plot intended for inclusion into a larger document. Some programs (and some publishers as well) do not allow the use of instructions like `Setpagedevice` as part of embedded graphics.

An EPS file that is to be placed into another document needs to have correct bounding box parameters. These are found in the PostScript Document Comment %%BoundingBox. Applications that generate EPS files should set these parameters correctly. Because GMT makes the PostScript files on the fly, often with several overlays, it is not possible to do so accurately. However, GMT does make an effort to ensure that the BoundingBox is large enough to contain the entire composite plotC.1. Therefore, if you need a ``tight'' BoundingBox you need to post-process your PostScript file. There are several ways in which this can be accomplished.

- Programs such as Adobe Illustrator, Aldus Freehand, and Corel Draw will allow you to edit the BoundingBox graphically.

- A command-line alternative is to use freely-available program epstool from the makers of Aladdin ghostscript. Running

      epstool -c -b myplot.ps

  should give a tight BoundingBox; epstool assumes the plot is page size and not a huge poster.

- Another option is to use ps2epsi which also comes with the ghostscript package. Running

      ps2epsi myplot.ps myplot.eps

  should also do the trick. The downside is that this program adds an ``image'' of the plot in the preamble of the EPS file, thus increasing the file size significantly. This image is a rough rendering of your PostScript graphics that some programs will show on screen while you are editing your document. This image is basically a placeholder for the PostScript graphics that will actually be printed.

- The preferred option is to use the GMT utility ps2raster. Its -A option will figure out the tightest BoundingBox, again using ghostscript in the background. For example, running

      ps2raster -A -Te myplot.ps

  will convert the PostScript file myplot.ps into an encapsulated PostScript file myplot.eps which is exactly cropped to the tightest possible BoundingBox.

If you do not want to modify your illustration but just include it in a text document: many word processors (such as Microsoft Word, Corel WordPerfect, and Apple Pages) will let you include a PostScript file that you may place but not edit. Newer versions of those programs also allow you to include PDF versions of your graphics. Except for Pages, you will not be able to view the figure on-screen, but it will print correctly.

Next: C.2 Converting GMT PostScript Up: C. Including GMT graphics Previous: C. Including GMT graphics Contents Index