summary refs log tree commit diff
path: root/pkgs/misc/tex/nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-11-22 07:06:10 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-11-22 07:06:10 +0000
commit9485d4a3203d8bf125e71663a9bdbb304b8eb8b2 (patch)
tree763f3127f9d155756a45a30ea070fb9414ddf207 /pkgs/misc/tex/nix
parent244a91a090e2abb6dcbaa83f1d69f5c3107e969d (diff)
downloadnixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.tar
nixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.tar.gz
nixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.tar.bz2
nixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.tar.lz
nixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.tar.xz
nixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.tar.zst
nixpkgs-9485d4a3203d8bf125e71663a9bdbb304b8eb8b2.zip
* Support \pgfimage.
svn path=/nixpkgs/trunk/; revision=7087
Diffstat (limited to 'pkgs/misc/tex/nix')
-rw-r--r--pkgs/misc/tex/nix/find-includes.pl29
1 files changed, 18 insertions, 11 deletions
diff --git a/pkgs/misc/tex/nix/find-includes.pl b/pkgs/misc/tex/nix/find-includes.pl
index c85b6901924..7750f63af19 100644
--- a/pkgs/misc/tex/nix/find-includes.pl
+++ b/pkgs/misc/tex/nix/find-includes.pl
@@ -17,6 +17,13 @@ $path =~ s/\/$//;
 my @workset = ();
 my %doneset = ();
 
+sub addToWorkSetExts {
+    my $base = shift;
+    foreach my $ext (@_) {
+        push @workset, "$base$ext";
+    }
+}
+
 push @workset, $root;
 
 while (scalar @workset > 0) {
@@ -45,37 +52,37 @@ while (scalar @workset > 0) {
 	if (/\\input\{(.*)\}/) {
 	    my $fn2 = $1;
             die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
-	    push @workset, $path . "/" . $fn2;
+	    push @workset, "$path/$fn2";
 	} elsif (/\\usepackage(\[.*\])?\{(.*)\}/) {
 	    my $fn2 = $2;
             die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
-	    push @workset, $path . "/" . $fn2 . ".sty";
+	    push @workset, "$path/$fn2.sty";
 	} elsif (/\\documentclass(\[.*\])?\{(.*)\}/) {
 	    my $fn2 = $2;
             die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
-	    push @workset, $path . "/" . $fn2 . ".cls";
+	    push @workset, "$path/$fn2.cls";
 	} elsif (/\\bibliographystyle\{(.*)\}/) {
 	    my $fn2 = $1;
             die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
-	    push @workset, $path . "/" . $fn2 . ".bst";
+	    push @workset, "$path/$fn2.bst";
 	} elsif (/\\bibliography\{(.*)\}/) {
             foreach my $bib (split /,/, $1) {
                 $bib =~ s/^\s+//; # remove leading / trailing whitespace
                 $bib =~ s/\s+$//;
-                push @workset, $path . "/" . $bib . ".bib";
+                push @workset, "$path/$bib.bib";
             }
 	} elsif (/\\includegraphics(\[.*\])?\{(.*)\}/) {
 	    my $fn2 = $2;
             die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
-	    push @workset, $path . "/" . $fn2 . ".pdf";
-	    push @workset, $path . "/" . $fn2 . ".png";
-	    push @workset, $path . "/" . $fn2 . ".ps";
+            addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".ps");
 	} elsif (/\\pgfdeclareimage(\[.*\])?\{.*\}\{(.*)\}/) {
 	    my $fn2 = $2;
             die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
-	    push @workset, $path . "/" . $fn2 . ".pdf";
-	    push @workset, $path . "/" . $fn2 . ".png";
-	    push @workset, $path . "/" . $fn2 . ".jpg";
+            addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".jpg");
+	} elsif (/\\pgfimage(\[.*\])?\{(.*)\}/) {
+	    my $fn2 = $2;
+            die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
+            addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".jpg");
         }
         # !!! also support \usepackage
     }