[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] latex export subtree: org-latex-export-process
From: |
Michael Bach |
Subject: |
[O] latex export subtree: org-latex-export-process |
Date: |
Wed, 25 Sep 2013 18:35:21 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
Dear org-mode Users and Developers,
(org-mode v8.1) I use the following function for customizable latex
export processes
#+begin_src emacs-lisp
(defun my-auto-tex-cmd (backend)
"When exporting from .org with latex,
automatically run latex, pdflatex, or xelatex as appropriate,
using latexmk."
(let ((texcmd))
(cond ((string-match "LATEX_CMD: pdflatex" (buffer-string))
(setq texcmd "latexmk -pdflatex=pdflatex -pdf %f"))
((string-match "LATEX_CMD: pdflatex-shell-escape" (buffer-string))
(setq texcmd "latexmk -pdflatex=pdflatex --shell-escape -pdf
%f"))
((string-match "LATEX_CMD: xelatex" (buffer-string))
(setq texcmd "latexmk -pdflatex=xelatex -pdf %f"))
(t (setq texcmd "latexmk -pdf %f"))
)
(setq org-latex-pdf-process (list texcmd))))
(add-hook 'org-export-before-processing-hook 'my-auto-tex-cmd)
#+end_src
which essentially uses an earlier idea[1]. Now this works well if I
export an .org buffer as a whole. If I export a subtree, the
`buffer-string` only contains the subtree without the .org buffer
header, so the `string-match` always fails.
Any ideas on how to best integrate this function during a subtree
export? Maybe inside a hook that is run before the subtree is narrowed
down?
Best Regards,
Michael
[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] latex export subtree: org-latex-export-process,
Michael Bach <=