Created
December 19, 2015 07:10
-
-
Save rldotai/572acbc6be1327a0370c to your computer and use it in GitHub Desktop.
A quick way to build LaTeX files while purging the auxiliary files pdflatex generates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Generate a PDF from a `.tex` file, then remove the auxiliary files with the same base name. | |
| # | |
| # Usage: | |
| # ./quicktex.sh myfile.tex | |
| # the first argument should be the tex file, either with or without extension | |
| file="$1" | |
| # remove the suffix (if it's .tex) | |
| file="${file%.tex}" | |
| [ "${file:0:1}" == "/" ] || file="${PWD}/${file}" | |
| pdffile="${file%.tex}.pdf" | |
| # run pdflatex and bibtex, then pdflatex again to get references right | |
| pdflatex "${file}" && bibtex "${file}" && pdflatex "${file}" && pdflatex "${file}" | |
| # clean the files | |
| rm -f "$file""."{aux,bak,bbl,blg,log,out,toc,tdo} #brace expansion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment