emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo Butler <Leo.Butler@umanitoba.ca>
To: David Masterson <dsmasterson92630@outlook.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Orgmode and Beamer
Date: Tue, 29 Oct 2024 02:05:46 +0000	[thread overview]
Message-ID: <87v7xbacjr.fsf@t14.reltub.ca> (raw)
In-Reply-To: <SA1P223MB09241E0CE3EEE281CA3705D49B4A2@SA1P223MB0924.NAMP223.PROD.OUTLOOK.COM> (David Masterson's message of "Mon, 28 Oct 2024 15:27:09 -0700")

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

On Mon, Oct 28 2024, David Masterson <dsmasterson92630@outlook.com> wrote:

> Does anyone have a recommendation on how to structure an Org document
> such that it can be exported to either Latex or Beamer? Suppose you
> have a (small) thesis that you are writing and you want to generate
> Beamer slides of a high-level view of the document, but also generate
> a PDF for the whole document.   I suppose you could break it into two
> files, but then you'd have to copy (certain) changes from file to
> file.  I was wondering if it could be done with one file such that
> updates to the master document are simultaneously reflected in the
> Beamer slides.  Is this going to involve liberal use of
> #+BEGIN...#+END blocks?
>
> David Masterson
>
>

I think I would add the tags

#+TAGS: beameronly latexonly noexport

and then define an elisp function that changes beameronly tags to
noexport when the export backend is latex and similar for latexonly.
Add that function to the `org-export-before-processing-functions' so it
gets executed before export begins.

Attached is an example.

Note that you likely would need to fiddle with conditionally loading
packages, depending on the export backend.

Best regards,
Leo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: beamer-latex.org --]
[-- Type: text/x-org; name="beamer-latex.org", Size: 938 bytes --]

#+TITLE: LaTeX and Beamer
#+TAGS: beameronly(b) latexonly(l) noexport(n)
#+OPTIONS: tags:nil

* Code                                                             :noexport:
#+begin_src elisp
  (defun ltb-org-export-filter (backend)
    (let ((regex (cl-case backend
  		 (latex ":beameronly:")
  		 (beamer ":latexonly:")
  		 (t nil))))
      (when regex
        (save-excursion
  	(goto-char (point-min))
  	(while (search-forward-regexp regex nil t)
  	  (replace-match ":noexport:"))))))
  (add-hook 'org-export-before-processing-functions 'ltb-org-export-filter)
#+end_src

* Some Beamer stuff                                              :beameronly:
** Frame 1                                                          :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
* Some LaTeX stuff                                                :latexonly:
In the beginning, there was \TeX{}.
* Other stuff
The end


  parent reply	other threads:[~2024-10-29  2:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28 22:27 Orgmode and Beamer David Masterson
2024-10-28 23:57 ` Naresh Gurbuxani
2024-10-29  0:47   ` David Masterson
2024-10-29  2:05 ` Leo Butler [this message]
2024-10-29  3:38   ` David Masterson

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=87v7xbacjr.fsf@t14.reltub.ca \
    --to=leo.butler@umanitoba.ca \
    --cc=dsmasterson92630@outlook.com \
    --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).