From acf47a1bb820ff2c328f32033c20453caf7aef42 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Mar 2006 14:34:17 +0000 Subject: [PATCH] * Prevent unnecessary LaTeX runs. svn path=/nixpkgs/trunk/; revision=5082 --- pkgs/misc/tex/nix/run-latex.sh | 38 +++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/pkgs/misc/tex/nix/run-latex.sh b/pkgs/misc/tex/nix/run-latex.sh index 31056094fc22..9e23aa21fa78 100644 --- a/pkgs/misc/tex/nix/run-latex.sh +++ b/pkgs/misc/tex/nix/run-latex.sh @@ -34,25 +34,36 @@ showError() { } 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 "PASS 1..." runLaTeX echo + if grep -q '\\citation' $rootNameBase.aux; then echo "RUNNING BIBTEX..." bibtex --terse $rootNameBase cp $rootNameBase.bbl $out + runNeeded=1 + echo +fi + + +if test "$runNeeded"; then + echo "PASS 2..." + runLaTeX echo fi -echo "PASS 2..." -runLaTeX -echo if test -f $rootNameBase.idx; then echo "MAKING INDEX..." @@ -60,18 +71,31 @@ if test -f $rootNameBase.idx; then makeindexFlags="$makeindexFlags -c" fi makeindex $makeindexFlags $rootNameBase.idx + runNeeded=1 echo fi -echo "PASS 3..." -runLaTeX -echo + +if test "$runNeeded"; then + echo "PASS 3..." + runLaTeX + echo +fi + + +if test "$runNeeded"; then + echo "Hm, still not done :-(" + echo +fi + + if test -n "$generatePDF"; then cp $rootNameBase.pdf $out else cp $rootNameBase.dvi $out fi + echo "OVERFULL/UNDERFULL:" cat $tmpFile | egrep "Overfull|Underfull" || true