Troels Kofoed Jacobsen’s blog


Execute scripts with LaTeX
April 27, 2008, 11:53 am
Filed under: latex | Tags: ,

Have you ever made a script generating content for your LaTeX tables?

And are you tired of running them every time you have new data?

Then make LaTeX run them when comipling. Just use the command
\write18{COMMAND}
and compile your document with
latex -shell-escape
NOTE: Do never run latex with -shell-escape if you did not make the document yourself, it might just eat your children.



Print pdf files from bash
April 25, 2008, 12:14 pm
Filed under: bash | Tags: , ,

Tired of manually doing pdf2ps and then lpr so you can print from the commandline. This bash function is the solution.


function printpdf ()
{
for i in $@; do
if [ "$1" != "$i" ]; then
dt=`date +%y%m%d%H%M%S`
pdftops $i temp-print${dt}.ps
lpr -P $1 temp-print${dt}.ps
rm temp-print${dt}.ps
fi
done
}

Usage:
printpdf printername file1.pdf file2.pdf file3.pdf ….