#!/bin/csh -f

if ("$1" == "-x") then
set XDVI = 0
shift
else
set XDVI = 1
endif

set MAN = /KM/usr/naeher/LEDA/man

if (! -d $MAN) then
echo ""
echo Cannot find LEDA manual directory ($MAN)
exit
endif

if ($1 == "") then
echo ""
echo usage: tman \[-x\] \<LEDA data type\>
exit
endif

if (! -f $MAN/$1.tex) then
echo ""
echo "$1": no such entry. 
exit
endif

echo "\input $MAN/MANUAL.mac"  > $1_xx.tex
#echo "\hoffset=-0.5cm"     >> $1_xx.tex
#echo "\voffset=-1.5cm"     >> $1_xx.tex
echo "\nopagenumbers"         >> $1_xx.tex
echo "\input $MAN/$1.tex"     >> $1_xx.tex
echo "\bye"                   >> $1_xx.tex

echo ""
echo "wait"
tex $1_xx >& /dev/null

rm -f $1_xx.tex $1_xx.log

if ($XDVI) then
xdvi $1_xx
rm -f $1_xx.dvi
else
mv $1_xx.dvi $1.dvi
endif



