about summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-05-16 11:26:23 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-05-16 11:26:23 +0000
commit3042994875183f78ef229266c388075e14885ac3 (patch)
treec35c7bcbb4e5e8c800e074e611b75ebd9d73a646 /pkgs/misc
parent4bbd9bab29b1bdca4aa087bbd541d6629c1515a1 (diff)
downloadnixlib-3042994875183f78ef229266c388075e14885ac3.tar
nixlib-3042994875183f78ef229266c388075e14885ac3.tar.gz
nixlib-3042994875183f78ef229266c388075e14885ac3.tar.bz2
nixlib-3042994875183f78ef229266c388075e14885ac3.tar.lz
nixlib-3042994875183f78ef229266c388075e14885ac3.tar.xz
nixlib-3042994875183f78ef229266c388075e14885ac3.tar.zst
nixlib-3042994875183f78ef229266c388075e14885ac3.zip
* ImageMagick: don't need to keep old versions I guess.
* texFunctions.simpleTexToPNG: purity (use our own ImageMagick).

svn path=/nixpkgs/trunk/; revision=11836
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/tex/nix/default.nix58
1 files changed, 37 insertions, 21 deletions
diff --git a/pkgs/misc/tex/nix/default.nix b/pkgs/misc/tex/nix/default.nix
index 54fb512c8906..6b0ec0988374 100644
--- a/pkgs/misc/tex/nix/default.nix
+++ b/pkgs/misc/tex/nix/default.nix
@@ -95,15 +95,15 @@ rec {
 
     pkgs.stdenv.mkDerivation {
       inherit name preamble body;
-      buildCommand = "
+      buildCommand = ''
         touch $out
-        echo '\\documentclass{article}' >> $out
-        echo '\\pagestyle{empty}' >> $out
-        if test -n \"$preamble\"; then cat $preamble >> $out; fi
-        echo '\\begin{document}' >> $out
+        echo '\documentclass{article}' >> $out
+        echo '\pagestyle{empty}' >> $out
+        if test -n "$preamble"; then cat $preamble >> $out; fi
+        echo '\begin{document}' >> $out
         cat $body >> $out
-        echo '\\end{document}' >> $out
-      ";
+        echo '\end{document}' >> $out
+      '';
     };
 
 
@@ -116,8 +116,10 @@ rec {
     pkgs.stdenv.mkDerivation {
       name = "png";
       inherit postscript;
+
+      buildInputs = [pkgs.imagemagick pkgs.ghostscript];
       
-      buildCommand = "
+      buildCommand = ''
         if test -d $postscript; then
           input=$(ls $postscript/*.ps)
         else
@@ -125,19 +127,17 @@ rec {
           ln -s $postscript $input
         fi
 
-        # !!! Quick hack: no ImageMagick in Nixpkgs yet!
-        export PATH=/usr/bin:$PATH
         ensureDir $out
-        convert -units PixelsPerInch \\
-          -density 300 \\
-          -trim \\
-          -matte \\
-          -transparent '#ffffff' \\
-          -type PaletteMatte \\
-          +repage \\
-          $input \\
-          \"$out/$(basename $input .ps).png\"
-      ";
+        convert -units PixelsPerInch \
+          -density 300 \
+          -trim \
+          -matte \
+          -transparent '#ffffff' \
+          -type PaletteMatte \
+          +repage \
+          $input \
+          "$out/$(basename $input .ps).png"
+      ''; # */
     };
 
 
@@ -162,5 +162,21 @@ rec {
     };
 
 
-      
+  # Convert a piece of TeX code to a PDF.
+  simpleTeXToPDF =
+    { preamble ? null
+    , body
+    , name ? baseNameOf (toString body)
+    , packages ? []
+    }:
+
+    runLaTeX {
+      rootFile = wrapSimpleTeX {
+        inherit body preamble;
+      };
+      inherit packages;
+      searchRelativeTo = dirOf (toString body);
+    };
+
+
 }