* [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property
@ 2024-07-06 11:46 hugo
2024-07-06 15:39 ` Ihor Radchenko
0 siblings, 1 reply; 5+ messages in thread
From: hugo @ 2024-07-06 11:46 UTC (permalink / raw)
To: emacs-orgmode
[-- 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property
2024-07-06 11:46 [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property hugo
@ 2024-07-06 15:39 ` Ihor Radchenko
2024-07-08 12:57 ` hugo
0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-07-06 15:39 UTC (permalink / raw)
To: hugo; +Cc: emacs-orgmode
hugo@heagren.com writes:
> 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.
> ...
> + ;; Subtitle
> + (when-let ((subtitle
> + (org-element-property :BEAMER_SUBTITLE headline)))
> + (format "{%s}" subtitle))
I am neutral towards the idea of adding a way to set subtitle, but
concerned that the subtitle is added verbatim - no Org markup
processing.
I think that it will make more sense to recognize Org markup in the
BEAMER_SUBTITLE property value.
Also, please announce the new feature in the ORG-NEWS.
--
Ihor Radchenko // yantar92,
Org mode contributor,
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property
2024-07-06 15:39 ` Ihor Radchenko
@ 2024-07-08 12:57 ` hugo
2024-07-08 18:17 ` Ihor Radchenko
0 siblings, 1 reply; 5+ messages in thread
From: hugo @ 2024-07-08 12:57 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Hi Ihor,
> I think that it will make more sense to recognize Org markup in the >
> BEAMER_SUBTITLE property value.
I agree, that would be a good idea. I tried to implement this in the
same way as with the frametitle:
,----
| (let ((env (org-element-property :BEAMER_ENV headline)))
| (format "{%s}"
| (if (and env (equal (downcase env) "fullframe")) ""
| (org-export-data
| (org-element-property :title headline) info))))
`----
Like this:
,----
| (when-let ((subtitle
| (org-element-property :BEAMER_SUBTITLE headline)))
| (format "{%s}"
| (org-export-data subtitle info)))
`----
but it doesn't work---the subtitle is just rendered verbatim (even if it
has org markup---this is included in the .tex file). I've had a look
around the various data export functions and I can't work out why not.
Can you (or someone else) advise?
> Also, please announce the new feature in the ORG-NEWS.
Will do, when I've got the formatting working.
Very best,
Hugo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-10 14:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-06 11:46 [patch] ox-beamer: allow setting frame subtitle with BEAMER_SUBTITLE property hugo
2024-07-06 15:39 ` 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
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).