diff --git a/git-latexdiff b/git-latexdiff index 4df062b..69422d4 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -78,6 +78,7 @@ Options: deleted. --latexmk use latexmk + --latexopt pass additional options to latex (e.g. -shell-escape) -o , --output copy resulting PDF into (usually ending with .pdf) Implies "--cleanup all" @@ -136,6 +137,7 @@ tmpdir_prefix="/tmp" prepare_cmd= subtree=0 uselatexmk= +latexopt= ln_untracked=0 quiet=0 @@ -209,6 +211,10 @@ while test $# -ne 0; do "--latexmk") uselatexmk=1 ;; + "--latexopt") + shift + latexopt=$1 + ;; "--ln-untracked") ln_untracked=1 ;; @@ -299,12 +305,6 @@ if test -z "$main" ; then main=$(git grep -l '^[ \t]*\\documentclass') # May return multiple results, but if so the result won't be a file. if test -r "$main" ; then - ext=${main##*\.} - case "$ext" in - Rnw) check_knitr ;; - Rtex) check_knitr ;; - *) ;; - esac echo "Using $main as the main file." else if test -z "$main" ; then @@ -317,6 +317,13 @@ if test -z "$main" ; then fi fi +ext=${main##*\.} +case "$ext" in + Rnw) check_knitr ;; + Rtex) check_knitr ;; + *) ;; +esac + if test ! -r "$main" ; then die "Cannot read $main." fi @@ -401,9 +408,9 @@ elif test "$uselatexmk" = 1; then log_cmd latexmk.log latexmk -f -pdf -silent "$mainbase" || compile_error=1 else if [ "$quiet" = 1 ]; then - latexopt="-interaction=nonstopmode" + latexopt="$latexopt -interaction=nonstopmode" else - latexopt="-interaction=errorstopmode" + latexopt="$latexopt -interaction=errorstopmode" fi log_cmd pdflatex1.log pdflatex $latexopt "$mainbase" || compile_error=1 if test "$bibtex" = 1 ; then