#!/bin/bash # The trailing colon indicates the standard search path should be # appended to the user specified TEXINPUT variable. export TEXINPUTS=".:~/papers:" main () { DIR=`dirname $1` ROOT=`basename $1 .tex` pushd $DIR DIR=`pwd` cd $TMPDIR # add some environment to the .tex file and compile it to .dvi cat $TEX2WWW_HEADER "$DIR/$ROOT.tex" $TEX2WWW_FOOTER >"$ROOT.tex" latex "$ROOT.tex" # convert the .dvi to a collection of .png indexed by a .html dvipng "$ROOT.dvi" -o "$ROOT-%04d.png" -T tight echo '
' >>"$ROOT.html" for i in *.png; do echo "" >>"$ROOT.html" done echo '
' >>"$ROOT.html" popd mv $TMPDIR/*.png . mv $TMPDIR/*.html . } source ~/bin/fw