Hi

When you want to change the beamer class options, you needed to add
#+LATEX_CLASS: beamer
#+LATEX_CLASS_OPTIONS: ...

With this simple patch, you can declare them directly as
#+BEAMER_CLASS_OPTIONS:...

which is more consistent with using
#+STARTUP: beamer

and the LaTeX settings.

Best, /PA


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Sagen's Paradeiser, write BE!
Year 1 of the New Koprocracy
From b66dff2aaf36b35424f2c499ff7240bdb86e41d6 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paag...@gmail.com>
Date: Mon, 7 Apr 2025 12:45:44 +0200
Subject: [PATCH] New BEAMER_CLASS_OPTIONS

* lisp/ox-beamer.el: Create :beamer-class-options. This avoids having
to declare the LATEX_CLASS explicitly as beamer.
(org-beamer-template): replace the default `[presentation]' option to
the new options if :beamer-class-options have been defined.

* doc/org-manual.org: add ~#+BEAMER_CLASS_OPTIONS:~ to the beamer
class documentation

* etc/ORG_NEWS: Announce new ~#+BEAMER_CLASS_OPTIONS:~

---
 doc/org-manual.org | 12 ++++++++++++
 etc/ORG-NEWS       | 11 +++++++++++
 lisp/ox-beamer.el  |  7 ++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 7561c0d62..5a6039ba1 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13064,6 +13064,18 @@ Beamer export backend has several additional keywords for customizing
 Beamer output.  These keywords work similar to the general options
 settings (see [[*Export Settings]]).

+- =BEAMER_CLASS_OPTIONS= ::
+
+  #+cindex: @samp{BEAMER_CLASS_OPTIONS}, keyword
+
+  The options to pass to the beamer class. It is the equivalent
+  to ~LATEX_CLASS_OPTIONS~ in the LaTeX exporter.  For example:
+
+  : #+BEAMER_CLASS_OPTIONS: [handout,12pt,t]
+
+  would produce a handout (as opposed to the slides) with 12pt fonts
+  and align the slide contents to the top of the contents space.
+
 - =BEAMER_THEME= ::

   #+cindex: @samp{BEAMER_THEME}, keyword
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 982bac4e9..8f6911a50 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -215,6 +215,17 @@ take the date as an argument, and generate a list of pairs for
 types of datetrees (e.g. for lunar calendars, academic calendars,
 retail 4-4-5 calendars, etc).

+*** New keyword ~#+BEAMER_CLASS_OPTIONS:~
+
+~#+BEAMER_CLASS_OPTIONS~ is a equivalent to ~#+LATEX_CLASS_OPTIONS~ for
+documents that are meant to be exported to LaTeX/beamer presentations.
+An example: add
+#+BEGIN_EXAMPLE
+#+BEAMER_CLASS_OPTIONS: [handout,t]
+#+END_EXAMPLE
+to produce a handout of the presentation with the items aligned at the
+top of the slide contents space.
+
 ** New and changed options

 # Changes dealing with changing default values of customizations,
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index e862da99d..220d1d695 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -259,6 +259,7 @@ Return overlay specification, as a string, or nil."
   :options-alist
   '((:headline-levels nil "H" org-beamer-frame-level)
     (:latex-class "LATEX_CLASS" nil "beamer" t)
+    (:beamer-class-options "BEAMER_CLASS_OPTIONS" nil "[presentation]" t)
     (:beamer-subtitle-format nil nil org-beamer-subtitle-format)
     (:beamer-column-view-format "COLUMNS" nil org-beamer-column-view-format)
     (:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
@@ -872,7 +873,11 @@ holding export options."
      ;; LaTeX compiler
      (org-latex--insert-compiler info)
      ;; Document class and packages.
-     (org-latex-make-preamble info)
+     (let* ((preamble  (org-latex-make-preamble info))
+            (beamer-class-options (plist-get info :beamer-class-options)))
+       (if beamer-class-options
+           (replace-regexp-in-string "\\[[^]]+\\]" beamer-class-options preamble)
+       preamble))
      ;; Define the alternative frame environment, if needed.
      (when (plist-get info :beamer-define-frame)
        (format "\\newenvironment<>{%s}[1][]{\\begin{frame}#2[environment=%1$s,#1]}{\\end{frame}}\n"
--
2.34.1

Reply via email to