emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: hugo@heagren.com
To: emacs-orgmode@gnu.org
Subject: [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property
Date: Sat, 06 Jul 2024 12:46:01 +0100	[thread overview]
Message-ID: <d5369f5f0e9fa02e5953fc19f993ad0e@heagren.com> (raw)

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

Hi all,

I found recently I wanted to add subtitles to some slides in beamer in
an export from org-mode. In the end I had to write an
explicit #+beamer: declaration with latex code in it for each
headline. The attached patch implements an easier (I think) way of
setting subtitles, with properties on org headings which are exported
as frames. I hope this is helpful.

Best,

Hugo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-beamer-allow-setting-frame-subtitle-with-headline.patch --]
[-- Type: text/x-diff; name=0001-ox-beamer-allow-setting-frame-subtitle-with-headline.patch, Size: 1922 bytes --]

From 88b04892fd270989980c5d34595213e67d8c8f3a Mon Sep 17 00:00:00 2001
From: Hugo Heagren <hugo@heagren.com>
Date: Fri, 5 Jul 2024 22:13:19 +0100
Subject: [PATCH] ox-beamer: allow setting frame subtitle with headline
 property

* lisp/ox-beamer.el (org-beamer--format-frame): allow a frame subtitle
to be specified in the BEAMER_SUBTITLE property. If specified, put it
in the second non-optional argument to \begin{frame}.
* doc/org-manual.org (Frames and Blocks in Beamer): document above behaviour.
---
 doc/org-manual.org | 5 +++++
 lisp/ox-beamer.el  | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index ad584d7a5..cfa1e4b85 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -12653,6 +12653,11 @@ *** Frames and Blocks in Beamer
   frames.  It is also useful for properly closing a =column=
   environment.
 
+  #+cindex: @samp{BEAMER_SUBTITLE}, property
+  If =BEAMER_SUBTITLE= is set, org exports its value as the subtitle
+  for the headline's frame. This property has no effect on headlines
+  which are not exported as frames.
+
   #+cindex: @samp{BEAMER_ACT}, property
   #+cindex: @samp{BEAMER_OPT}, property
   When =BEAMER_ACT= is set for a headline, Org export translates that
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 51684448d..6925c8092 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -470,6 +470,10 @@ (defun org-beamer--format-frame (headline contents info)
 		      (if (and env (equal (downcase env) "fullframe")) ""
 			(org-export-data
 			 (org-element-property :title headline) info))))
+            ;; Subtitle
+            (when-let ((subtitle
+                        (org-element-property :BEAMER_SUBTITLE headline)))
+              (format "{%s}" subtitle))
 	    "\n"
 	    ;; The following workaround is required in fragile frames
 	    ;; as Beamer will append "\par" to the beginning of the
-- 
2.20.1


             reply	other threads:[~2024-07-06 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-06 11:46 hugo [this message]
2024-07-06 15:39 ` [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property Ihor Radchenko
2024-07-08 12:57   ` hugo
2024-07-08 18:17     ` Ihor Radchenko
     [not found]       ` <4af34ba26f42fd8ef329e8690393ec9d@heagren.com>
2024-07-10 14:03         ` Ihor Radchenko

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=d5369f5f0e9fa02e5953fc19f993ad0e@heagren.com \
    --to=hugo@heagren.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).