diff options
Diffstat (limited to '2005/flow-accounting-ols2005/OLS2005/Texmf/latex2dvi')
-rwxr-xr-x | 2005/flow-accounting-ols2005/OLS2005/Texmf/latex2dvi | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/2005/flow-accounting-ols2005/OLS2005/Texmf/latex2dvi b/2005/flow-accounting-ols2005/OLS2005/Texmf/latex2dvi new file mode 100755 index 0000000..8def593 --- /dev/null +++ b/2005/flow-accounting-ols2005/OLS2005/Texmf/latex2dvi @@ -0,0 +1,50 @@ +#! /bin/sh + +# This helper script runs pdflatex, LaTeX, and/or BibTeX in a loop until the output file +# (DVI/PDF) stabilizes. + +if [ $# -ne 1 ]; then + echo "usage: $0 TEX-FILE" >&2 + exit 2 +fi + + +input="${1%.tex}" +aux="$1".aux +oaux="$1".oaux + +# Go through the procedure twice; once for LaTeX to +# generate a stable DVI file, then once with pdflatex +# to generate a stable PDF file. We really do want both... + +for LATEX in latex pdflatex ; do + rm -f "$aux" "$oaux" + + # Run LATEX once. The output file we get from this is probably junk, but + # what we're interested in is the .aux file. If it fails, abort. + echo "+ $LATEX -interaction=nonstopmode \"$input\"" + $LATEX -interaction=nonstopmode "$input" || exit 1 + + # Determine whether we need to run BibTeX. This (should) only ever have + # to be done once. Again, if BibTeX fails, abort. + if grep -q bibdata "$aux"; then + echo "+ bibtex \"$input\"" + bibtex "$input" || exit 1 + fi + + # Save the old .aux file. + cp "$aux" "$oaux" + + # Now run LaTeX over and over again until the .aux file stops changing. + # We use \batchmode for these cycles - the user has already seen any + # diagnostics of interest. + while :; do + echo "+ $LATEX -interaction=batchmode \"$input\"" + $LATEX -interaction=batchmode "$input" || exit 1 + if cmp -s "$aux" "$oaux"; then + break + fi + cp "$aux" "$oaux" + done + +done |