#! /bin/csh
#
# Fig2ps2tex - generate a TeX file for including a PostScript file
#		 involves calculating the bounding box from fig2ps output
#
set bbox = `cat $1 | head -2 | tail -1`

set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
set ysp = `echo "3k $bbox[5] $bbox[3] - 72 / p" | dc`

echo "\vbox to ${ysp}in{"
echo "  \vfill"
echo "  \hbox to ${xsp}in{"
echo "    \hfill"
echo "    \special{psfile=$1}"
echo "    \hfill}"
echo "  }~"
echo "\vspace{-\baselineskip}"
