From 824df2c3789eb93234f983e7597d9a8e32c7c507 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Tue, 1 Jun 2010 10:14:56 +0200 Subject: [PATCH] ENH: add org-pdflatex to create pdf files --- bin/org-pdflatex | 1 + bin/tools/org-batch | 32 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 120000 bin/org-pdflatex diff --git a/bin/org-pdflatex b/bin/org-pdflatex new file mode 120000 index 00000000000..b7b47c1517b --- /dev/null +++ b/bin/org-pdflatex @@ -0,0 +1 @@ +tools/org-batch \ No newline at end of file diff --git a/bin/tools/org-batch b/bin/tools/org-batch index 90b60f0464b..ae97370dbd0 100755 --- a/bin/tools/org-batch +++ b/bin/tools/org-batch @@ -37,8 +37,9 @@ usage() { Usage: ${0##*/} [OPTIONS] file1 [.. fileN] options: - -html create html (default) - -latex create LaTeX + -html create html (default) + -latex create LaTeX + -pdflatex create pdf via pdflatex * Batch process emacs org-mode files to create html/LaTeX etc. @@ -49,8 +50,14 @@ USAGE # default is html export: mode=html +unset makePDF +echo "have $Script" case $Script in +*pdflatex) + mode=latex + makePDF=pdflatex + ;; *latex) mode=latex ;; @@ -59,7 +66,6 @@ case $Script in ;; esac - # parse options while [ "$#" -gt 0 ] do @@ -75,6 +81,11 @@ do mode=latex shift ;; + -pdflatex) + mode=latex + makePDF=pdflatex + shift + ;; -*) usage "unknown option: '$*'" ;; @@ -98,6 +109,21 @@ do then emacs --batch -l org --visit=$org \ --funcall org-export-as-$mode-batch + + # post-processing step to create pdf + case "$makePDF" in + pdflatex) + input="${org%.org}.tex" + + if [ -f "$input" ] + then + pdflatex "$input" + else + echo "No $input to convert to pdf" + fi + ;; + esac + else echo "File not found" fi -- GitLab