From 40f22e9f4b3b07ceb573fb5d27ca69534ef1cca8 Mon Sep 17 00:00:00 2001 From: Colin Patrick Mccabe Date: Thu, 23 Aug 2012 10:53:12 -0700 Subject: [PATCH] pdflatex.sh, a script for creating pdfs from tex Signed-off-by: Colin McCabe --- pdflatex.sh | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) create mode 100755 pdflatex.sh 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" -- 1.6.6.rc1.39.g9a42