Search code examples
bashlatexgnuploteps

Creating a one-pixel border of whitespace in EPS


I am trying to generate an eps for inclusion in a LaTeX document with a border of 1 pixel of whitespace around the contents of the figure. The figure is a plot I am producing with gnuplot using the postscript terminal:

set terminal postscript enhanced eps color colortext 14 size 19cm,15cm font 'Courier-Bold,30'

This figure has lots of whitespace, and I'd like to cut it down to 1 pixel. I can use the epstool utility to crop it down to a zero-whitespace border:

epstool --bbox --copy input.eps output.eps

I can't find a way to add 1 pixel of whitespace without editing the .eps file manually to change the boundingbox. What would be nice would be an option to a utility like -l (--loose) to ps2eps which does exactly what I want.


Solution

  • (Added at last minute: just saw your answer, so you probably don't need this)

    It's easy to do in awk:

    awk '/^%%(HiRes)?BoundingBox:/{print $1, $2-1, $3-1, $4+2, $5+2;next}{print}'