Re: [Rd] bounding box in PostScript

From: Ted Harding <>
Date: Mon 17 Apr 2006 - 22:05:31 GMT

On 17-Apr-06 Prof Brian Ripley wrote:
> On Mon, 17 Apr 2006, David Allen wrote:

>> When a graph is saved as PostScript, the bounding box is often too
>> big.
>> A consequence is that when the graph is included in a LaTeX document,
>> the spacing does not look good.
>> Is this a recognized problem? Is someone working on it? Could I help?

> It's not really true. The bounding box is of the figure region, and it
> is
> a design feature. If the figure `region' that is too big for your
> purposes you need to adjust the margins.
> Alternatively, there are lots of ways to set a tight bounding box: I
> tend to use the bbox device in gs. But that often ends up with
> figures which do not align, depending on whether text has descenders.

Ghostscript's BBox resources tend to suffer from this problem, since for some reason as Brian says it may not properly allow for the true sizes of characters. I once tweaked ps2eps to correct (more or less) for this.

But nowadays, to get it exactly right, I use gv (ghostview front end) to open the EPS file, and set "watch" mode:

  gv -watch filename.eps

If it doesn't automatically give the "BoundingBox" view, you can always select this from the top menu. This ensures that the frame of the gv window is the same as the BoundingBox.

Then open the EPS file for editing, and look for the

  %%BoundingBox llx lly urx ury

line (it may be near the beginning, or at the end -- which will be flagged by a line

  %%BoundingBox: atend

near the beinning).

Here, llx, lly, urx, ury are integers giving the coordinates (in points relative to the page origin) of the lower left, and upper right, corners of the bounding box.

Now you can change the values of these. Each time you change, save the edited file. Because gv is in "watch" mode, it will re-draw the page whenever the file changes. Thus you can adjust the bounding box until it is just as you want it.

Best wishes,

E-Mail: (Ted Harding) <> Fax-to-email: +44 (0)870 094 0861
Date: 17-Apr-06                                       Time: 23:05:29
------------------------------ XFMail ------------------------------

______________________________________________ mailing list Received on Tue Apr 18 08:07:19 2006

This archive was generated by hypermail 2.1.8 : Tue 18 Apr 2006 - 02:17:47 GMT