How can I modify the header of a source block dynamically, based on the backend used to export my org-mode document? Specifically, I want the header to include :results output html
when the file is exported to HTML, and :results output latex
when the file is exported to LaTeX.
I believe that I should use the org-export-current-backend
variable to achieve this, but I have been unable to write a header that does what I need.
For example, I think I could include an if
call in the header. Unfortunately, this example triggers the HTML build correctly but not the LaTeX one (I can successfully export to LaTeX by inverting the if
conditional):
#+begin_src emacs-lisp :exports both :results output (if (eq org-export-current-backend 'html) html latex)
(if (eq org-export-current-backend 'html)
(princ "<ul><li>Green tea</li><li>Black tea</li></ul>")
(princ "\\begin{itemize}\n\\item Green tea\n\\item Black tea\n\\end{itemize}"))
#+end_src