Browse Source

Add --latex option

master
Luca Venturini 9 years ago
parent
commit
705c93e61f
  1. 25
      git-latexdiff

25
git-latexdiff

@ -73,6 +73,7 @@ Options:
--help this help message --help this help message
--main <file.tex> name of the main LaTeX file --main <file.tex> name of the main LaTeX file
--no-view don't display the resulting PDF file --no-view don't display the resulting PDF file
--latex run latex instead of pdflatex
--bibtex, -b run bibtex as well as latex --bibtex, -b run bibtex as well as latex
(pdflatex,bibtex,pdflatex,pdflatex) (pdflatex,bibtex,pdflatex,pdflatex)
--biber run BibLaTex-Biber as well as latex --biber run BibLaTex-Biber as well as latex
@ -175,6 +176,8 @@ latexpand=()
workingdir=() workingdir=()
bbl=0 bbl=0
latexdiff_flatten=0 latexdiff_flatten=0
latex=0
while test $# -ne 0; do while test $# -ne 0; do
case "$1" in case "$1" in
@ -229,6 +232,9 @@ while test $# -ne 0; do
"-b"|"--bibtex") "-b"|"--bibtex")
bibtex=1 bibtex=1
;; ;;
"--latex")
latex=1
;;
"--biber") "--biber")
biber=1 biber=1
;; ;;
@ -361,6 +367,12 @@ if test $flatten = 1 &&
flatten=0 flatten=0
fi fi
if test $latex = 1; then
LATEX_EXEC=latex
else
LATEX_EXEC=pdflatex
fi
## end option parsing ## ## end option parsing ##
check_knitr () { check_knitr () {
@ -506,7 +518,7 @@ if test "$flatten" = 1; then
verbose "Attempting to regenerate missing new/$maindir$mainbase.bbl" verbose "Attempting to regenerate missing new/$maindir$mainbase.bbl"
( (
cd new/"$maindir" cd new/"$maindir"
log_cmd pdflatex0.log pdflatex $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex0.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd bibtex0.log bibtex "$mainbase" || compile_error=1 log_cmd bibtex0.log bibtex "$mainbase" || compile_error=1
) )
if [ "$compile_error" = 1 ]; then if [ "$compile_error" = 1 ]; then
@ -564,15 +576,15 @@ else
else else
latexopt="$latexopt -interaction=errorstopmode" latexopt="$latexopt -interaction=errorstopmode"
fi fi
log_cmd pdflatex1.log pdflatex $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex1.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
if test "$bibtex" = 1 ; then if test "$bibtex" = 1 ; then
log_cmd bibtex.log bibtex "$mainbase" || compile_error=1 log_cmd bibtex.log bibtex "$mainbase" || compile_error=1
fi fi
if test "$biber" = 1 ; then if test "$biber" = 1 ; then
log_cmd biber.log biber "$mainbase" || compile_error=1 log_cmd biber.log biber "$mainbase" || compile_error=1
fi fi
log_cmd pdflatex2.log pdflatex $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex3.log pdflatex $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex2.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex3.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
fi fi
verbose_done verbose_done
@ -582,6 +594,11 @@ if [ "$compile_error" = 1 ] && [ "$ignorelatexerrors" = 1 ]; then
compile_error=0 compile_error=0
fi fi
if test $latex = 1; then
dvips "$mainbase".dvi
ps2pdf "$mainbase".ps
fi
pdffile="$mainbase".pdf pdffile="$mainbase".pdf
if test ! -r "$pdffile" ; then if test ! -r "$pdffile" ; then
echo "No PDF file generated." echo "No PDF file generated."

Loading…
Cancel
Save