File: fig2ps2tex.sh.script

package info (click to toggle)
transfig 1%3A3.2.5.e-4%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 9,300 kB
  • sloc: ansic: 32,666; makefile: 3,255; sh: 549; csh: 25; perl: 13
file content (24 lines) | stat: -rwxr-xr-x 690 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh -f
#
# Fig2ps2tex.sh - generate a TeX file for including a PostScript file
#		 involves calculating the bounding box from fig2ps output
# version for systems without csh -- uses bc and awk
#
bbox=`grep "^%%BoundingBox:" $1`

bbox2=`echo $bbox | awk '{print $2}'`
bbox3=`echo $bbox | awk '{print $3}'`
bbox4=`echo $bbox | awk '{print $4}'`
bbox5=`echo $bbox | awk '{print $5}'`

xsp=`echo "scale=3; ( $bbox4 - $bbox2 ) / 72" | bc`
ysp=`echo "scale=3; ( $bbox5 - $bbox3 ) / 72" | bc`

printf "\makebox[${xsp}in][l]{\n"
printf "  \\\vbox to ${ysp}in{\n"
printf "    \\\vfill\n"
printf "    \special{psfile=$1}\n"
printf "  }\n"
printf "  \\\vspace{-\\\baselineskip}\n"
printf "}\n"