#This command compiles the document and will stop at any point do to error.
#Put the document name here.
DOCUMENT_BASENAME="calculus_I"
#First remove any old tex-generated files as these can get messed up.
#See the clean.sh script for what all gets deleted.
./clean.sh
#Now run pdflatex (four times) and asymptote once.
if pdflatex $DOCUMENT_BASENAME.tex ; then
    if pdflatex $DOCUMENT_BASENAME.tex ; then
	# Note I modified the following because newer versions of
	# asymptote make separate asy files for each image, not just one.
	cd asymptote_files
	if asy $DOCUMENT_BASENAME*.asy ; then
	    cd ..
	    if pdflatex $DOCUMENT_BASENAME.tex ; then
		pdflatex $DOCUMENT_BASENAME.tex
	    fi
	fi
    fi
fi
