From 3295a5cf0aa9e4cda794975ebc6c09f05569b337 Mon Sep 17 00:00:00 2001 From: Joshua Nathaniel Pritikin Date: Thu, 7 Nov 2013 12:09:24 -0500 Subject: [PATCH 1/2] Untangle main detection and file type detection --- git-latexdiff | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index ead600b..7a27de5 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -290,12 +290,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 @@ -308,6 +302,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 From cffda9dc25758c67eb857646f46f37d940229d4d Mon Sep 17 00:00:00 2001 From: Joshua Nathaniel Pritikin Date: Thu, 7 Nov 2013 14:35:46 -0500 Subject: [PATCH 2/2] Add option to pass extra options to latex --- git-latexdiff | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index 7a27de5..c0f863c 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" @@ -133,6 +134,7 @@ initial_dir=$PWD tmpdir_prefix="/tmp" prepare_cmd= uselatexmk= +latexopt= ln_untracked=0 quiet=0 @@ -200,6 +202,10 @@ while test $# -ne 0; do "--latexmk") uselatexmk=1 ;; + "--latexopt") + shift + latexopt=$1 + ;; "--ln-untracked") ln_untracked=1 ;; @@ -387,9 +393,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