From Ted.Harding at nessie.mcc.ac.uk  Tue Apr 18 00:05:31 2006
From: Ted.Harding at nessie.mcc.ac.uk ( (Ted Harding))
Date: Mon, 17 Apr 2006 23:05:31 +0100 (BST)
Subject: [Rd] bounding box in PostScript
In-Reply-To: <Pine.LNX.4.64.0604172157540.29810@gannet.stats.ox.ac.uk>
Message-ID: <XFMail.060417230531.Ted.Harding@nessie.mcc.ac.uk>

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,
Ted.

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



[Rd] bounding box in PostScript
 (Ted Harding