diff --git a/pkgs/misc/tex/nix/copy-includes.pl b/pkgs/misc/tex/nix/copy-includes.pl index 57ae2d4a33d..26a9ab91602 100644 --- a/pkgs/misc/tex/nix/copy-includes.pl +++ b/pkgs/misc/tex/nix/copy-includes.pl @@ -15,8 +15,6 @@ for (my $n = 0; $n < @ARGV; $n += 2) { my $fullPath = $ARGV[$n]; my $relPath = $ARGV[$n + 1]; - print "$fullPath <- $relPath\n"; - createDirs $relPath; symlink $fullPath, $relPath or die "cannot create symlink `$relPath'"; diff --git a/pkgs/misc/tex/nix/default.nix b/pkgs/misc/tex/nix/default.nix index 73ef5e523eb..d371014e1ff 100644 --- a/pkgs/misc/tex/nix/default.nix +++ b/pkgs/misc/tex/nix/default.nix @@ -33,6 +33,9 @@ rec { args = [ ./find-includes.pl ]; rootFile = toString rootFile; # !!! hacky + + # Forces rebuilds. + hack = __currentTime; }; } \ No newline at end of file diff --git a/pkgs/misc/tex/nix/find-includes.pl b/pkgs/misc/tex/nix/find-includes.pl index 5be9259507d..633f9084370 100644 --- a/pkgs/misc/tex/nix/find-includes.pl +++ b/pkgs/misc/tex/nix/find-includes.pl @@ -50,7 +50,13 @@ while (scalar @workset > 0) { my $fn2 = $2; die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/"; push @workset, $path . "/" . $fn2 . ".cls"; - } + } elsif (/\\bibliography\{(.*)\}/) { + foreach my $bib (split /,/, $1) { + $bib =~ s/^\s+//; # remove leading / trailing whitespace + $bib =~ s/\s+$//; + push @workset, $path . "/" . $bib . ".bib"; + } + } # !!! also support \usepackage } diff --git a/pkgs/misc/tex/nix/run-latex.sh b/pkgs/misc/tex/nix/run-latex.sh index 72fc8234bd0..07db6e9c42a 100644 --- a/pkgs/misc/tex/nix/run-latex.sh +++ b/pkgs/misc/tex/nix/run-latex.sh @@ -25,9 +25,9 @@ fi $latex $rootName -if grep -q '\\bibitem' $rootNameBase.bbl; then +if grep -q '\\citation' $rootNameBase.aux; then bibtex $rootNameBase -fi +fi $latex $rootName