I'd like to be able to call a function to export to pdf (via latex beamer) from an org subtree. Right now I have properties set up like so:
:PROPERTIES:
:EXPORT_LATEX_COMPILER: xelatex
:EXPORT_LATEX_HEADER: \input{beamer-preamble.tex}
:EXPORT_OPTIONS: H:2
:EXPORT_FILE_NAME: path/to/pdf
:EXPORT_LATEX_CLASS: beamer-presentation
:END:
I have two latex classes I've added to org-latex-classes
-- "beamer-presentation", which allows notes and incremental lists, and "beamer-handout", which has no notes and collapses all incremental slides to single slides. Right now if I want to change to presentation or handout I change the :EXPORT_LATEX_CLASS:
property to the relevant class. Everything works fine. However, I'd like to be able to do this from an elisp function I could just call to export the subtree, and without having the :EXPORT_LATEX_CLASS:
property set manually. But I can't seem to find any way to do this. I would have thought the following would work:
(defun cpm/org-export-beamer-presentation ()
(interactive)
(progn
(setq org-latex-default-class "beamer-presentation")
(org-open-file (org-beamer-export-to-pdf nil t))))
(defun cpm/org-export-beamer-handout ()
(interactive)
(progn
(setq org-latex-default-class "beamer-handout")
(org-open-file (org-beamer-export-to-pdf nil t))))
However, in both cases the function simply export the subtree with the default (i.e. not either of my custom classes) beamer presentation class. Any tips on what to do here are appreciated (and I know that there is at least one other way to deal with this issue. But I'm curious why my approach fails. I am not adept with elisp, so that may be the explanation. Advice appreciated.