1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 22:50:49 +00:00

* Prevent unnecessary LaTeX runs.

svn path=/nixpkgs/trunk/; revision=5082
This commit is contained in:
Eelco Dolstra 2006-03-23 14:34:17 +00:00
parent 77d7e2ea95
commit acf47a1bb8

View file

@ -34,25 +34,36 @@ showError() {
} }
runLaTeX() { runLaTeX() {
if ! $latex $latexFlags $rootName >$tmpFile 2>&1; then showError; fi if ! $latex $latexFlags $rootName >$tmpFile 2>&1; then showError; fi
runNeeded=
if grep -q "LaTeX Warning: Label(s) may have changed." "$tmpFile"; then
runNeeded=1
fi
} }
echo echo
echo "PASS 1..." echo "PASS 1..."
runLaTeX runLaTeX
echo echo
if grep -q '\\citation' $rootNameBase.aux; then if grep -q '\\citation' $rootNameBase.aux; then
echo "RUNNING BIBTEX..." echo "RUNNING BIBTEX..."
bibtex --terse $rootNameBase bibtex --terse $rootNameBase
cp $rootNameBase.bbl $out cp $rootNameBase.bbl $out
runNeeded=1
echo
fi
if test "$runNeeded"; then
echo "PASS 2..."
runLaTeX
echo echo
fi fi
echo "PASS 2..."
runLaTeX
echo
if test -f $rootNameBase.idx; then if test -f $rootNameBase.idx; then
echo "MAKING INDEX..." echo "MAKING INDEX..."
@ -60,18 +71,31 @@ if test -f $rootNameBase.idx; then
makeindexFlags="$makeindexFlags -c" makeindexFlags="$makeindexFlags -c"
fi fi
makeindex $makeindexFlags $rootNameBase.idx makeindex $makeindexFlags $rootNameBase.idx
runNeeded=1
echo echo
fi fi
echo "PASS 3..."
runLaTeX if test "$runNeeded"; then
echo echo "PASS 3..."
runLaTeX
echo
fi
if test "$runNeeded"; then
echo "Hm, still not done :-("
echo
fi
if test -n "$generatePDF"; then if test -n "$generatePDF"; then
cp $rootNameBase.pdf $out cp $rootNameBase.pdf $out
else else
cp $rootNameBase.dvi $out cp $rootNameBase.dvi $out
fi fi
echo "OVERFULL/UNDERFULL:" echo "OVERFULL/UNDERFULL:"
cat $tmpFile | egrep "Overfull|Underfull" || true cat $tmpFile | egrep "Overfull|Underfull" || true