ENH: add org-pdflatex to create pdf files

This commit is contained in:
Mark Olesen
2010-06-01 10:14:56 +02:00
parent 7e9adc7b31
commit 824df2c378
2 changed files with 30 additions and 3 deletions

1
bin/org-pdflatex Symbolic link
View File

@ -0,0 +1 @@
tools/org-batch

View File

@ -37,8 +37,9 @@ usage() {
Usage: ${0##*/} [OPTIONS] file1 [.. fileN] Usage: ${0##*/} [OPTIONS] file1 [.. fileN]
options: options:
-html create html (default) -html create html (default)
-latex create LaTeX -latex create LaTeX
-pdflatex create pdf via pdflatex
* Batch process emacs org-mode files to create html/LaTeX etc. * Batch process emacs org-mode files to create html/LaTeX etc.
@ -49,8 +50,14 @@ USAGE
# default is html export: # default is html export:
mode=html mode=html
unset makePDF
echo "have $Script"
case $Script in case $Script in
*pdflatex)
mode=latex
makePDF=pdflatex
;;
*latex) *latex)
mode=latex mode=latex
;; ;;
@ -59,7 +66,6 @@ case $Script in
;; ;;
esac esac
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -75,6 +81,11 @@ do
mode=latex mode=latex
shift shift
;; ;;
-pdflatex)
mode=latex
makePDF=pdflatex
shift
;;
-*) -*)
usage "unknown option: '$*'" usage "unknown option: '$*'"
;; ;;
@ -98,6 +109,21 @@ do
then then
emacs --batch -l org --visit=$org \ emacs --batch -l org --visit=$org \
--funcall org-export-as-$mode-batch --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 else
echo "File not found" echo "File not found"
fi fi