#! /bin/csh -f
#
# The script is contributed by Sylvain Pion <Sylvain.Pion@sophia.inria.fr>.
#  Subject: (mgp-users 00071) Re: remarks against 1.04a
#
# Expected usage:
#	%filter "tex2eps.sh b"
#	My \TeX\ is nicer with $Magic$ Point
#	%endfilter
#	%image "b.eps" 250x200
#

# temporary filename (without .eps suffix)
set tmp=$1
# directory where the *.tex *.eps file will be located
set fdir="generated_eps"

# echo '\documentstyle[psfrag,graphicx,color,defvar2,eclepsf,othermac]{jarticle}' >  $fdir/$tmp.tex
echo '\documentclass[]{jsbook}' >  $fdir/$tmp.tex
echo '\usepackage{psfrag,graphicx,color,defvar2,eclepsf,othermac}' >>  $fdir/$tmp.tex
echo '\pagestyle{empty}' >>  $fdir/$tmp.tex
echo '\begin{document}' >> $fdir/$tmp.tex
cat >> $fdir/$tmp.tex
echo '\end{document}' >> $fdir/$tmp.tex
platex $fdir/$tmp.tex >& /dev/null
dvips -q -E $tmp.dvi -o $tmp.ps >& /dev/null
ps2epsi $tmp.ps >& /dev/null
mv  $tmp.epsi  $fdir/$tmp.eps
# /bin/rm -f  $fdir/$tmp.tex
/bin/rm -f  $tmp.log $tmp.dvi $tmp.aux $tmp.pfg $tmp.ps
