#!/bin/sh
#
# Shell script to convert Chinese TeX files 
# (with .tex extension) to Postscript.
#
# This automates the procedure in the chtex man page.
#
NAME=`basename $1 .tex`
if [ $1 != $NAME.tex ]; then
  echo "usage: `basename $0` <name>.tex" >&2
  exit 1
fi
if [ ! -f $NAME.tex ]; then
  echo "$NAME.tex does not exist" >&2
  exit 1
fi
rm -f $NAME.hdr $NAME.chtex $NAME.log $NAME.dvi $NAME.lps $NAME.ps
chtex $NAME.tex
tex $NAME.chtex
dvi2ps $NAME.dvi > $NAME.lps
cat $NAME.hdr $NAME.lps > $NAME.ps
rm -f $NAME.hdr $NAME.chtex $NAME.log $NAME.dvi $NAME.lps



