Skip to content

Instantly share code, notes, and snippets.

@mguentner
Last active August 29, 2015 14:03
Show Gist options
  • Save mguentner/3d2575d68c89b68a00cc to your computer and use it in GitHub Desktop.
Save mguentner/3d2575d68c89b68a00cc to your computer and use it in GitHub Desktop.
Shadow build larger latex documents
#!/bin/bash
# Shadow $TMPDIR...
BASEDIR=$(pwd)
TMPDIR=$(mktemp -d /tmp/texbuild.XXXXXX)
FILES=("refdb.bib" "thesis.tex")
DIRECTORIES=("img" "code" "sections" "data" "data-xen")
if [ ! -d $TMPDIR ]
then
echo "Could not create tmp directory!"
exit 1
fi
for file in "${FILES[@]}"
do
cp $file $TMPDIR/
done
for dir in "${DIRECTORIES[@]}"
do
cp -a $dir $TMPDIR/
done
cd $TMPDIR
pdflatex thesis
bibtex thesis
pdflatex thesis
pdflatex thesis
cd $BASEDIR
cp $TMPDIR/thesis.pdf output/.
# Cleanup
rm -rf $TMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment