* runLaTeX: detect the existence of a pre-generated .bbl file and use

it.  Useful if you're supposed to stick a \balancecolumns in the
  middle of the file.

svn path=/nixpkgs/trunk/; revision=26522
This commit is contained in:
Eelco Dolstra 2011-03-26 00:14:28 +00:00
parent af5952eb0b
commit 20912b654b
3 changed files with 10 additions and 5 deletions

View file

@ -53,7 +53,7 @@ rec {
# The type denotes the kind of dependency, which determines
# what extensions we use to look for it.
deps = import (pkgs.runCommand "latex-includes"
{ src = key; }
{ rootFile = baseNameOf (toString rootFile); src = key; }
"${pkgs.perl}/bin/perl ${./find-includes.pl}");
# Look for the dependencies of `key', trying various

View file

@ -45,6 +45,7 @@ while (<FILE>) {
$bib =~ s/^\s+//; # remove leading / trailing whitespace
$bib =~ s/\s+$//;
addName "misc", "$bib.bib";
addName "misc", (basename($ENV{"rootFile"}, ".tex", ".ltx") . ".bbl");
}
} elsif (/\\includegraphics(\[.*\])?\{(.*)\}/) {
my $fn2 = $2;

View file

@ -68,11 +68,15 @@ for auxFile in $(find . -name "*.aux"); do
# Run bibtex to process all bibliographies. There may be several
# when we're using the multibib package.
if grep -q '\\citation' $auxFile; then
echo "RUNNING BIBTEX ON $auxFile..."
auxBase=$(basename $auxFile .aux)
bibtex --terse $auxBase
cp $auxBase.bbl $out
runNeeded=1
if [ -e $auxBase.bbl ]; then
echo "SKIPPING BIBTEX ON $auxFile!"
else
echo "RUNNING BIBTEX ON $auxFile..."
bibtex --terse $auxBase
cp $auxBase.bbl $out
runNeeded=1
fi
echo
fi