#+Title: Conditional export * Conditional Export Test Here's a tree, exported to both html and pdf. #+name: rnorm #+headers: :exports results #+headers: :results graphics #+begin_src R :file (by-backend (latex "rnorm.pdf") (t "rnorm.png")) plot(rnorm(100), rnorm(100)) #+end_src #+Caption: Normal random data. #+RESULTS: rnorm [[file:rnorm.png]] * COMMENT setup This function could be added to the user's =.emacs= init file. #+begin_src emacs-lisp :results silent (setq org-babel-latex-htlatex "htlatex") (defmacro by-backend (&rest body) `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body)) #+end_src