emacs-orgmode
[Top][All Lists]

Exporting to LaTeX versus Beamer: how to take different actions dependin

 From: Richard Stanton Subject: Exporting to LaTeX versus Beamer: how to take different actions depending on export format? Date: Fri, 2 Jul 2021 12:56:52 -0700

 I’ve been experimenting with using a single org file to generate an article when exported to LaTeX (or HTML) and a Beamer presentation when exported to Beamer, without requiring any edits to the org file itself. For this to be really useful, the exporter has to be able to do different things depending on which output format you’ve asked for. 1) At a minimum, you need to be able to have text included in the article that is not included in the Beamer presentation and vice versa, so that you can have, say, a paragraph in the article vs. an itemized list in the Beamer presentation. This can be taken care of relatively easily using one of several conditional-compilation packages available for LaTeX. If people are interested, I’ve uploaded a simple example to https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/2) However, some things are not so easy. For example, suppose I’m using the listings package to include some code in my document, e.g.,#+begin_src python  print(“Hello, world”)#+end_srcThis works fine as long as I’m OK with the default output format. But suppose this listing is too long for my slide so I want to make the text smaller than normal. I can do that quite easily for both article and presentation output by putting a line like#+attr_latex: :options basicstyle=\tinyimmediately before the source block. But suppose I only want to do this in the Beamer output and not in the LaTeX article output? I’ve tried #+attr_beamer: :options basicstyle=\tinybut this doesn’t seem to work. And even if it did, what if I wanted the change in font size to occur only when I’m exporting to LaTeX but not Beamer? How can I do conditional things like this at the org-file level based on whether I’m exporting to LaTeX or Beamer?Thanks for any suggestions.Richard Stanton