#!/bin/bash
# compilel
#
# This command compiles the document and will stop at any point do to error.
# This version just does a light compile, in the sense that figures
# are not compiled.  Otherwise all other auxilliary files are removed.
# Put the document name here. 'master' is useful for auctex and makes
# the script generic.
DOCUMENT_BASENAME="master"
#First remove any old tex-generated files as these can get messed up.  See
#the cleanl script for what gets deleted.
./cleanl
#Now run pdflatex (three times).
if pdflatex $DOCUMENT_BASENAME.tex ; then
    if pdflatex $DOCUMENT_BASENAME.tex ; then
	pdflatex $DOCUMENT_BASENAME.tex
    fi
fi
# Make a copy of the master document with new name based on the
# current directory.  This retains the last successfully compiled
# document and gives it a meaningful name for circulation.
cp $DOCUMENT_BASENAME.pdf $(basename $(pwd)).pdf
