Skip to content

Instantly share code, notes, and snippets.

@RGreinacher
Created February 7, 2016 13:09
Show Gist options
  • Save RGreinacher/ec4dd13f18124d37fc89 to your computer and use it in GitHub Desktop.
Save RGreinacher/ec4dd13f18124d37fc89 to your computer and use it in GitHub Desktop.
Create PDF from a .tex file
#!/bin/bash
#title :makepdf.sh
#description :This script (double) compiles a tex file into a pdf and cleans up everything afterwards.
#author :Arik Grahl, Robert Greinacher
#date :2014-07-18
#version :0.1
#usage :bash makepdf.sh FILENAME.TEX
#notes :Install latex, pdflatex to use this script. The one liner ca be used in e.g. your .vimrc to automatically compile a tex file right out of vim
#bash_version :any
#====================================================================
# check for given arguments
if [ "$1" != "" ]; then
# check if the biber citation management tool is used
if file *.bib; then
pdflatex -shell-escape -halt-on-error -file-line-error $1
biber `basename $1 .tex`
pdflatex -shell-escape -halt-on-error -file-line-error $1
fi;
#compile and clean up
pdflatex -shell-escape -halt-on-error -file-line-error $1
rm -f *.aux *.log *gnuplot* *.bbl *.bcf *.blg *.fdb *.fdb_latexmk *.fls *.lof *.out *.xml *.toc
else
echo "usage: $0 TEXFILE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment