From: Colin Patrick Mccabe Date: Thu, 23 Aug 2012 17:53:12 +0000 (-0700) Subject: pdflatex.sh, a script for creating pdfs from tex X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40f22e9f4b3b07ceb573fb5d27ca69534ef1cca8;p=cmccabe-bin pdflatex.sh, a script for creating pdfs from tex Signed-off-by: Colin McCabe --- diff --git a/pdflatex.sh b/pdflatex.sh new file mode 100755 index 0000000..6c8b769 --- /dev/null +++ b/pdflatex.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +die() { + echo $@ + exit 1 +} + +which pdflatex &> /dev/null || die "you must have pdflatex installed" + +[ $# -eq 1 ] || die "you must give exactly one argument: the \ +name of the tex file to use as input." + +TMPDIR=`mktemp -d -t pdfgrep.XXXXXXXXXX` || exit 1 +trap "rm -rf ${TMPDIR}; exit" INT TERM EXIT + +INPUT_FNAME=$1 +shift +pdflatex -output-directory "${TMPDIR}" < "${INPUT_FNAME}" || die "ERROR: pdflatex failed!" +mv -f ${TMPDIR}/*.pdf "${INPUT_FNAME}.pdf" || die "ERROR: couldn't find pdf output file"