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