From 710955d247f780fe19892c3f47c7411c11ba2ecb Mon Sep 17 00:00:00 2001 From: Taha Ahmed Date: Sun, 17 Apr 2011 15:02:26 +0200 Subject: [PATCH] Added support for latexmk shell escape in chertex.sh. Added clean-up option. --- chertex.sh | 41 ++++++++++++++++++++++++++++++++--------- ltxmkshellescape.rc | 2 ++ 2 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 ltxmkshellescape.rc diff --git a/chertex.sh b/chertex.sh index 5ea9b77..34955ab 100755 --- a/chertex.sh +++ b/chertex.sh @@ -16,10 +16,23 @@ echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" echo "MMX -- taha.ahmed@mkem.uu.se -- CHEPEC doctoral degree project" echo "---------------------------------------------------------------" +## If the file ltxmkshellescape.rc exists in the current directory, +## set the flag useshellescape=TRUE +useshellescape=false +echo "--- Looking for ltxmkshellescape.rc" +if [ -e ltxmkshellescape.rc ]; then + useshellescape=true + echo "+++ Shell escape activated" +else + echo "--- This job does not require shell escape" +fi + + Rfiletype="R" TeXfiletype="tex" tikzfiles="*.tikz" Rnwfiles="*.Rnw" +auxfiles="*.aux *.bbl *.bcf *.blg *.fdb* *.figlist *.log *.lox *.makefile *.map *.out *.run* *.toc *.dep *.dpth" if [ $# -eq 1 ]; then # Check if the argument contains a filetype @@ -58,7 +71,7 @@ if [ $# -eq 1 ]; then echo " -------------------------" echo " R CMD pgfsweave completed" echo " -------------------------" - simpledelay.sh 5 + simpledelay.sh 4 # Run vc script if vc exists in working directory echo " Running vc script" @@ -67,8 +80,15 @@ if [ $# -eq 1 ]; then fi # Run pdflatex, bibtex, and company - echo " Calling LaTeXMK" - latexmk $jobname -pdf -bibtex + if $useshellescape; then + echo " Calling LaTeXMK with shell escape" + simpledelay.sh 2 + latexmk -r ltxmkshellescape.rc -pdf -bibtex $jobname + else + echo " Calling LaTeXMK" + simpledelay.sh 2 + latexmk -pdf -bibtex $jobname + fi #echo " Calling texi2dvi()" #R CMD texi2dvi --pdf --verbose $jobname.tex ### Perhaps the choice should be dictated from a command-line argument? @@ -86,7 +106,8 @@ else if [ $# -eq 0 ]; then # Zero arguments. Present a menu of choices echo "This is cheRTeX POST-PROCESSING" # only one choice for now - echo "<1> 'pdf-all' -- Process all .tikz files to pdf graphics" + echo "<1> 'pdf-all' -- Process all .tikz files to pdf graphics" + echo "<2> 'clean-up' -- Remove all auxiliary files" echo "Any other input exits the program" read usrchoice @@ -132,13 +153,15 @@ else done echo "Completed TikZ file processing" fi + + if [[ $usrchoice == "clean-up" || $usrchoice == "2" ]]; then + echo "<2> 'clean-up' chosen" + rm $auxfiles + # Still a rather crude way of cleaning up... + fi + echo "Terminating..." - #mv $jobname-*.pdf tikz-pdfs - #mv *.aux logs - #mv *.log logs - #mv *.out logs - exit 1 fi diff --git a/ltxmkshellescape.rc b/ltxmkshellescape.rc new file mode 100644 index 0000000..42007d4 --- /dev/null +++ b/ltxmkshellescape.rc @@ -0,0 +1,2 @@ +$latex = "latex --shell-escape"; +$pdflatex = "pdflatex --shell-escape";