* Macros for building LaTeX documents using Nix.

svn path=/nixpkgs/trunk/; revision=3216
This commit is contained in:
Eelco Dolstra 2005-06-20 13:51:48 +00:00
parent f029091023
commit 6fcee91442
2 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,20 @@
pkgs:
rec {
runLaTeX =
{ rootFile
, generatePDF ? true
}:
pkgs.stdenv.mkDerivation {
name = "doc";
builder = ./run-latex.sh;
inherit rootFile generatePDF;
buildInputs = [ pkgs.tetex ];
};
}

View file

@ -0,0 +1,40 @@
. $stdenv/setup
ensureDir $out
for i in $rootFile $sources; do
if test -d $i; then
cp $i/* .
else
cp $i $(stripHash $i; echo $strippedName)
fi
done
rootName=$(basename $(stripHash "$rootFile"; echo $strippedName))
echo "root name is $rootName"
rootNameBase=$(echo "$rootName" | sed 's/\..*//')
if test -n "$generatePDF"; then
latex=pdflatex
else
latex=latex
fi
$latex $rootName
if grep -q '\\bibitem' $rootNameBase.bbl; then
bibtex $rootNameBase
fi
$latex $rootName
makeindex $rootNameBase.idx
$latex $rootName
if test -n "$generatePDF"; then
cp $rootNameBase.pdf $out
else
cp $rootNameBase.dvi $out
fi