New version of the patch (will test your suggestions right after this)

Best, /PA

On Sat, 12 Apr 2025 at 19:50, Ihor Radchenko <yanta...@posteo.net> wrote:

> Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes:
>
> > A new version of the patch, including a test for the new
> > #+BEAMER_CLASS_OPTIONS
>
> Thanks!
> I have no objections to adding a new keyword.
> See my comments inline on the patch itself.
>
> > Subject: [PATCH] New BEAMER_CLASS_OPTIONS
> >
> > * lisp/ox-beamer.el: Add #+BEAMER_CLASS_OPTIONS
> > (org-beamer-template) replace the class options with the
> > #+BEAMER_CLASS_OPTIONS, if defined.
> > * testing/lisp/test-ox-beamer.el: Add test for new
> > #+BEAMER_CLASS_OPTIONS
> > * doc/org-manual.org: Add entry explaining new
> > #+BEAMER_CLASS_OPTIONS
>
> May you please follow the commit message conventions as described in
> https://orgmode.org/worg/org-contribute.html#commit-messages ?
>
> > +- =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:
>
> We generally use =...= markup when referring to Org markup verbatim.
> Please check doc/Documentation_Standards.org file.
>
> > +*** New keyword ~#+BEAMER_CLASS_OPTIONS:~
> > +
> > +~#+BEAMER_CLASS_OPTIONS~ is a equivalent to ~#+LATEX_CLASS_OPTIONS~ for
>
> Same here =...=.
>
> >    '((:headline-levels nil "H" org-beamer-frame-level)
> >      (:latex-class "LATEX_CLASS" nil "beamer" t)
> > +    (:beamer-class-options "BEAMER_CLASS_OPTIONS" nil "[presentation]"
> t)
>
> I think that it will be much simpler to override :latex-class-options
> as we do for :latex-class
>    (:latex-class-options "BEAMER_CLASS_OPTIONS" nil "[presentation]" t)
>
> >       ;; 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
> > +           ;; modify the documentclass only
> > +           (replace-regexp-in-string "class\\[[^]]+\\]"
> > +                                     (concat "class "
> beamer-class-options)
> > +                                     preamble)
> > +       preamble))
>
> If we override :latex-class-options, there will be no need to change
> anything here.
>
> > +(ert-deftest ox-beamer/beamer-class-options ()
> > +  "Test that #+BEAMER_CLASS_OPTIONS is used."
> > +  (org-test-with-exported-text
> > +   'beamer
> > +   "#+OPTIONS: toc:nil
> > +#+BEAMER_CLASS_OPTIONS: [12pt,t]
> > +
> > +* A frame
> > +- Hola
> > +"
> > +   (goto-char (point-min))
> > +   (should (search-forward "\\documentclass [12pt,t]{beamer}"))))
>
> I am wondering why you added space after documentclass.
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


-- 
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 ee2ed173f189cdea2d33c7e28354fb5c3761c218 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paag...@gmail.com>
Date: Sun, 13 Apr 2025 11:22:15 +0200
Subject: [PATCH] Introduce BEAMER_CLASS_OPTIONS
lisp/ox-beamer.el: Add BEAMER_CLASS_OPTIONS keyword to beamer export backend

* doc/org-manual.org: Document BEAMER_CLASS_OPTIONS.
* lisp/ox-beamer.el: overwrite :latex-class-options in derived backend with
 contents of #+BEAMER_CLASS_OPTIONS keyword.

---
 doc/org-manual.org | 28 ++++++++++++++++++++--------
 etc/ORG-NEWS       |  6 ++++++
 lisp/ox-beamer.el  |  1 +
 3 files changed, 27 insertions(+), 8 deletions(-)

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

-- =BEAMER_THEME= ::
++ =BEAMER_CLASS_OPTIONS= ::
+
+  #+cindex: @samp{BEAMER_CLASS_OPTIONS}, keyword
+
+  The options passed to the LaTeX beamer class. Use square brackets
+  for options.  For example:
+
+  : #+BEAMER_CLASS_OPTIONS: [aspectratio=169,t,12pt]
+
+  Using =BEAMER_CLASS_OPTIONS= exclusively should be preferred over
+  using =LATEX_CLASS= and =LATEX_CLASS_OPTIONS=.
+
++ =BEAMER_THEME= ::

   #+cindex: @samp{BEAMER_THEME}, keyword
   #+vindex: org-beamer-theme
@@ -13073,28 +13085,28 @@ settings (see [[*Export Settings]]).

   : #+BEAMER_THEME: Rochester [height=20pt]

-- =BEAMER_FONT_THEME= ::
++ =BEAMER_FONT_THEME= ::

   #+cindex: @samp{BEAMER_FONT_THEME}, keyword
   The Beamer font theme.

-- =BEAMER_INNER_THEME= ::
++ =BEAMER_INNER_THEME= ::

   #+cindex: @samp{BEAMER_INNER_THEME}, keyword
   The Beamer inner theme.

-- =BEAMER_OUTER_THEME= ::
++ =BEAMER_OUTER_THEME= ::

   #+cindex: @samp{BEAMER_OUTER_THEME}, keyword
   The Beamer outer theme.

-- =BEAMER_HEADER= ::
++ =BEAMER_HEADER= ::

   #+cindex: @samp{BEAMER_HEADER}, keyword
   Arbitrary lines inserted in the preamble, just before the =hyperref=
   settings.

-- =DESCRIPTION= ::
++ =DESCRIPTION= ::

   #+cindex: @samp{DESCRIPTION}, keyword
   The document description.  For long descriptions, use multiple
@@ -13103,7 +13115,7 @@ settings (see [[*Export Settings]]).
   configure document metadata.  Use ~org-latex-title-command~ to
   configure typesetting of description as part of front matter.

-- =KEYWORDS= ::
++ =KEYWORDS= ::

   #+cindex: @samp{KEYWORDS}, keyword
   The keywords for defining the contents of the document.  Use
@@ -13112,7 +13124,7 @@ settings (see [[*Export Settings]]).
   to configure document metadata.  Use ~org-latex-title-command~ to
   configure typesetting of keywords as part of front matter.

-- =SUBTITLE= ::
++ =SUBTITLE= ::

   #+cindex: @samp{SUBTITLE}, keyword
   Document's subtitle.  For typesetting, use
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 982bac4e9..2f777598a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -215,6 +215,12 @@ 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 class options keyword for exporting to Beamer
+
+When exporting to beamer, =#+BEAMER_CLASS_OPTIONS:= should be used
+instead of =#+LATEX_CLASS_OPTIONS:=. If you use
+=#+LATEX_CLASS_OPTIONS=, remember to set =#+LATEX_CLASS:= to ~beamer~.
+
 ** 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..a684ecf77 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)
+    (:latex-class-options "BEAMER_CLASS_OPTIONS" nil "[presentation,t]" 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)
--
2.34.1

Reply via email to