From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id RvUCLWKJ4GByrQAAgWs5BA (envelope-from ) for ; Sat, 03 Jul 2021 17:59:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ELHzJ2KJ4GCiIwAA1q6Kng (envelope-from ) for ; Sat, 03 Jul 2021 15:59:30 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A05121D18C for ; Sat, 3 Jul 2021 17:59:29 +0200 (CEST) Received: from localhost ([::1]:41260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lzi3E-0001f3-7f for larch@yhetil.org; Sat, 03 Jul 2021 11:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzi1l-0001el-Hf for emacs-orgmode@gnu.org; Sat, 03 Jul 2021 11:57:57 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:53151) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lzi1h-0005eu-NO for emacs-orgmode@gnu.org; Sat, 03 Jul 2021 11:57:56 -0400 Received: by mail-pj1-x1033.google.com with SMTP id kt19so8440844pjb.2 for ; Sat, 03 Jul 2021 08:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=berkeley-edu.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=EseICOmM+JPhLLomMVhcsiaE70wY7kTFCirZLo7MvCw=; b=UlcGYGahEntZy7nHLZn1adN57IUnh4/IYINlCalcXV7aEDnycExBFrLhdCf+oQPteU m3LSGA6bAD9K+RN7X0VdMJdpFgufLGnJcSwv1fK3/C7wXyjnKl1owxfOzk58xHIvjPAB pCEFE/qTsF8sbac+qLkI9ToG7uObpth+C3ZbDLXrAzxCq7IgFDhKCwpMLzhixap9ARVi x7zCaHZMTWHITc8iW8e32+ZL9SXM55woJY4Eahv4l/xEUqfgEzTOCtez4GTAA+4QU7xL VG8BkF8kGz0c+xEu6QeTga9SnX1/uMUMj1BCcZbUor3C9R+gUsgYoMCHgj9mwQGvLEV7 /utA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=EseICOmM+JPhLLomMVhcsiaE70wY7kTFCirZLo7MvCw=; b=hH6Fq4bSG8pzr/8jzz0uB9GS9FATv3i3Q8Q98ZzqtZQun28jCdTDNBTeE6mH0mKLss haRJfsfY1t/uxgG9Sf8xi+K1kHs2tl3s+f0o+RLByCxY3J8j1r9rHuwCnHQr36B31hrn bbyDGj2OnEtVs2cSHL3SAnrx5nqxXzqNMc9M7EiB6yamPZz86ICzLJRiJQdU9BuhfIDW JI1yaIPxDICIhbjoTLfGbvhELHKtuk6pjFVnDkkoHLHfX/3LzQMdoiALn4cGY+OLWi3M M+aXpnXfzscSsJr3Hav//yZlCMopmbl8StM+cIdDHCKzNOsin2spoDc6oQ4IuB9Pl26s TuoA== X-Gm-Message-State: AOAM533ZhoXnxJnYoxCQEnJ5PLqhEqOBp5IxQoA6L/sP3CfthhKqyZ5L IdbMp+XiHjLT+TwSSRvThEXiN1uVSioaNA== X-Google-Smtp-Source: ABdhPJwUAI0saWKNim+5s9L1QEY6rovVVH8QisAu3mUIBos+pOqZDK+2wMWYoD7lnBh2s9unEvEs0A== X-Received: by 2002:a17:90b:380a:: with SMTP id mq10mr5169105pjb.79.1625327871134; Sat, 03 Jul 2021 08:57:51 -0700 (PDT) Received: from smtpclient.apple (198-27-189-67.fiber.dynamic.sonic.net. [198.27.189.67]) by smtp.gmail.com with ESMTPSA id y16sm7235265pfe.70.2021.07.03.08.57.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Jul 2021 08:57:50 -0700 (PDT) From: Richard Stanton Content-Type: multipart/alternative; boundary="Apple-Mail=_3E0898C1-8BD5-47B9-8F35-7A5C12C42589" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: Exporting to LaTeX versus Beamer: how to take different actions depending on export format? Date: Sat, 3 Jul 2021 08:57:49 -0700 References: <16BF3CE5-AD4F-4BAB-9C18-D51DA66C36B6@berkeley.edu> To: orgmode In-Reply-To: <16BF3CE5-AD4F-4BAB-9C18-D51DA66C36B6@berkeley.edu> Message-Id: <5405F77D-B247-46D5-B4A3-B995CC126E87@berkeley.edu> X-Mailer: Apple Mail (2.3654.100.0.2.22) Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=rhstanton@berkeley.edu; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625327969; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=EseICOmM+JPhLLomMVhcsiaE70wY7kTFCirZLo7MvCw=; b=e3GwBpfiBQMrNVlxIqG5/u/OSQVZgNBp/wJFADSqDcXb7ZyjVmG5DoXqmGw/KYMx3YZZ9k yfJVPCGayxwhQVVUrZCrdCffYGCTi9774XJRL20jwOl8p9z8ZziQO9t2+hofVgJ3d5rZx6 bmBcin9VXrgrCYOH6eyDzin8iy6HzXsTV2JkBBH4cOczSvjVj50qwZOrzYUGPvSGq0mGgq SeOPdHPTEDT8xw+nwxO4NlWbLZPwS8ynxMVSI8ik2Q2aroMDQmgyLsWIvpsiXwjy+3wZhg pnIxtdERrCCFoMkXF0qu9gR7B3OIOqxzSH9/FxBxaN2jgeV7UWvt+4z4l6YEjg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625327969; a=rsa-sha256; cv=none; b=Q8WVaWQ/WLWXObe2QXqOz7UYjJhtt+NxOfj8bQoLSZmQzd4YIOlFse2cCjJys8YdZnU1xi W1BqxmQ07y6jdHnVG38wPRZwxOJDzyHmKvzeEOAdQcfYONBtxvR1m4rwYmbQ6OjpojkuAz r2T61Z654PdsG/WsdyMlV2LBT24N/xTlYb5zBpIyT5jn5RMZONyOXyqvzHWGrJB6gb1GSm 37/nLptGsK9SIw63rD6YFtFoJk0cWFeTUiMAELTtTKuD72E2mMtmzQGYeCld6MU7NgRkKi j0oSUz9srR4Y1t3EavFWdrGCs4yxPHY9wCQkbga5DUkQkh49WVNFM+BpqRmD9w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=UlcGYGah; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=UlcGYGah; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: A05121D18C X-Spam-Score: -1.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: BZeYp7rFh/vJ --Apple-Mail=_3E0898C1-8BD5-47B9-8F35-7A5C12C42589 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I=E2=80=99ve found a few partial solutions: 1)=20 #+begin_src emacs-lisp :results raw :exports (if (eq = org-export-current-backend 'beamer) "results" "none") (eval (concat "#+begin_src python\n print('Hello, = world')\n#+end_src")) #+end_src This prints the python code if exporting to Beamer and not if exporting = to LaTeX, but the code is not now live, which rather undermines the best = feature of org-mode! 2) Include the code twice, with conditional statements around it each = time, so you can export one version to LaTeX and another version to = Beamer. OK, but inelegant 3) Instead of trying to modify the listing options, surround the code = block with some scaling statements that are called only in Beamer, e..g, #+beamer: \begin{adjustbox}{height=3D0.5\textheight} #+begin_src python print('Hello, world=E2=80=99) #+end_src #+beamer: \end{adjustbox} None of these is quite perfect, but they mostly do what I want, = especially #3. > On Jul 2, 2021, at 12:56 PM, Richard Stanton = wrote: >=20 > I=E2=80=99ve 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.=20 >=20 > For this to be really useful, the exporter has to be able to do = different things depending on which output format you=E2=80=99ve asked = for.=20 >=20 > 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=E2=80=99ve uploaded a simple = example to https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/ = >=20 > 2) However, some things are not so easy. For example, suppose I=E2=80=99= m using the listings package to include some code in my document, e.g., >=20 > #+begin_src python > print(=E2=80=9CHello, world=E2=80=9D) > #+end_src >=20 > This works fine as long as I=E2=80=99m 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 >=20 > #+attr_latex: :options basicstyle=3D\tiny >=20 > 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=E2=80=99v= e tried=20 >=20 > #+attr_beamer: :options basicstyle=3D\tiny >=20 > but this doesn=E2=80=99t seem to work. And even if it did, what if I = wanted the change in font size to occur only when I=E2=80=99m exporting = to LaTeX but not Beamer? How can I do conditional things like this at = the org-file level based on whether I=E2=80=99m exporting to LaTeX or = Beamer? >=20 > Thanks for any suggestions. >=20 > Richard Stanton >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 --Apple-Mail=_3E0898C1-8BD5-47B9-8F35-7A5C12C42589 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 I=E2=80=99ve found a few partial solutions:

1) 

#+begin_src emacs-lisp :results raw = :exports (if (eq org-export-current-backend 'beamer) "results" = "none")
  (eval (concat "#+begin_src python\n =  print('Hello, world')\n#+end_src"))
#+end_src

This prints the python code if exporting to Beamer and not if = exporting to LaTeX, but the code is not now live, which rather = undermines the best feature of org-mode!

2) Include the code = twice, with conditional statements around it each time, so you can = export one version to LaTeX and another version to Beamer. OK, but = inelegant

3) = Instead of trying to modify the listing options, surround the code block = with some scaling statements that are called only in Beamer, = e..g,

#+beamer: \begin{adjustbox}{height=3D0.5\textheight}
#+begin_src python
  print('Hello, = world=E2=80=99)
#+end_src
#+beamer: \end{adjustbox}

None of these is quite perfect, but = they mostly do what I want, especially #3.



On Jul = 2, 2021, at 12:56 PM, Richard Stanton <rhstanton@berkeley.edu> wrote:

I=E2=80=99ve 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=E2=80=99ve 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=E2=80=99ve uploaded a simple example to https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/

2) However, = some things are not so easy. For example, suppose I=E2=80=99m using the = listings package to include some code in my document, e.g.,

#+begin_src = python
  print(=E2=80=9CHello, = world=E2=80=9D)
#+end_src

This works fine as long as I=E2=80=99m = 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=3D\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=E2=80=99ve tried 

#+attr_beamer: :options = basicstyle=3D\tiny

but this doesn=E2=80=99t seem to work. And even if it did, = what if I wanted the change in font size to occur only when I=E2=80=99m = exporting to LaTeX but not Beamer? How can I do conditional things like = this at the org-file level based on whether I=E2=80=99m exporting to = LaTeX or Beamer?

Thanks for any suggestions.

Richard Stanton












= --Apple-Mail=_3E0898C1-8BD5-47B9-8F35-7A5C12C42589--