Skip to content

Instantly share code, notes, and snippets.

@tynn
Created May 7, 2014 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tynn/d8cdef9985bc08e3d64b to your computer and use it in GitHub Desktop.
Save tynn/d8cdef9985bc08e3d64b to your computer and use it in GitHub Desktop.
Create pdf from tex files with the table of contents and other lists included, since pdflatex will be invoked twice. You'll only get the pdf, not any other output file.
#!/bin/sh
# 2014 CC0 http://creativecommons.org/publicdomain/zero/1.0/
# Create pdf from tex files.
[ $# -lt 1 ] && echo Usage: $0 tex-file && exit 1
OUT=/tmp/pdflatex+out
[ -d $OUT ] || mkdir $OUT
PL="pdflatex -file-line-error -halt-on-error -output-directory $OUT"
for file in "$@"
do [ -f "$file" ] && $PL -draftmode "$file" && $PL "$file"
done
mv $OUT/*.pdf . 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment