Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # A script for automatically creating PDf files from a latex document
- # You can set the number of builds
- # Usage: ./buildpdf.sh filename [build amount] PDFLATEX_ARGS
- # Marcel Michael Kapfer, Elias Toivanen
- # 6th January 2015
- # GNU GPL v3.0 -> Feel free to re-distribute it or fork it
- if [[ -z "$1" ]]; then
- echo "Usage: $(basename $0) filename [-n build amount (Default: 1)] [PDFLATEX_ARGS]"
- exit 1
- fi
- if ! which inotifywait > /dev/null; then
- echo "ERROR: inotifywait not found in path. Is inotify-tools installed?" >&2
- exit 1
- fi
- filename=$1
- if [[ ! -r "$filename" ]]; then
- echo "ERROR: The input file \`$filename' name is not readable.">&2
- exit 1
- fi
- shift
- builds=1
- if [[ "$1" == "-n" ]]; then
- shift
- builds=$1
- shift
- fi
- args=""
- if (( $# )); then
- args="$@"
- fi
- while inotifywait --event modify $filename; do
- for ((i=1 ; i<=$builds ; ++i)); do
- pdflatex "$args" "$filename"
- echo "Build $i ready"
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement