emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Stanton <rhstanton@berkeley.edu>
To: orgmode <emacs-orgmode@gnu.org>
Subject: Exporting to LaTeX versus Beamer: how to take different actions depending on export format?
Date: Fri, 2 Jul 2021 12:56:52 -0700	[thread overview]
Message-ID: <16BF3CE5-AD4F-4BAB-9C18-D51DA66C36B6@berkeley.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

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/ <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_src

This 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=\tiny

immediately 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=\tiny

but 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












[-- Attachment #2: Type: text/html, Size: 3123 bytes --]

             reply	other threads:[~2021-07-02 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 19:56 Richard Stanton [this message]
2021-07-03 15:57 ` Richard Stanton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16BF3CE5-AD4F-4BAB-9C18-D51DA66C36B6@berkeley.edu \
    --to=rhstanton@berkeley.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).