emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] CUSTOM_id ignored on blocks by ox-beamer


From: Alan Schmitt
Subject: Re: [BUG] CUSTOM_id ignored on blocks by ox-beamer
Date: Thu, 09 Feb 2023 10:14:26 +0100

Hello Ihor,

On 2023-01-19 10:21, Ihor Radchenko <yantar92@posteo.net> writes:

> Please add a changelog entry detailing the definitions where the changes
> happened. See https://orgmode.org/worg/org-contribute.html#commit-messages
>
...
> Please document the new %l option in the docstring of
> `org-beamer-environments-extra' and add a notice to etc/ORG-NEWS file.

Here is an updated patch.

Attachment: signature.asc
Description: PGP signature

>From c480b26f9cb536b68b00930a19d59485f9221ef7 Mon Sep 17 00:00:00 2001
From: Alan Schmitt <alan.schmitt@polytechnique.org>
Date: Sun, 8 Jan 2023 17:20:31 +0100
Subject: [PATCH] lisp/ox-beamer.el: add labels to latex export

* ox-beamer.el (org-beamer-environments-default): add label escape to
some environments
(org-beamer--format-block): generate label string for label escape
(org-beamer-environments-extra): document label escape

A new escape %l is available to be used in `org-beamer-environments-*'
to insert the label of the current block, obtained using
`org-babel--get-label'
---
 etc/ORG-NEWS      |  5 +++++
 lisp/ox-beamer.el | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c5e9cd568..47806484e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -79,6 +79,11 @@ document header:
 The face ~org-agenda-calendar-daterange~ is used to show entries with
 a date range in the agenda.  It inherits from the default face in
 order to remain backward-compatible.
+*** New escape in ~org-beamer-environments-extra~ for labels in Beamer export
+The escape ~%l~ in ~org-beamer-environments-extra~ inserts the label
+obtained from ~org-beamer--get-label~.  This is added to the default
+environments "theorem", "definition", "example", and "exampleblock" in
+~org-beamer-environments-default~.
 
 ** New features
 *** ~org-metaup~ and ~org-metadown~ now act on headings in region
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 689bf1559..5df78d5a4 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -116,6 +116,7 @@ open    The opening template for the environment, with the 
following escapes
         %r   the raw headline text (i.e. without any processing)
         %H   if there is headline text, that raw text in {} braces
         %U   if there is headline text, that raw text in [] brackets
+        %l   the label, obtained from `org-beamer--get-label'
 close   The closing string of the environment."
   :group 'org-export-beamer
   :version "24.4"
@@ -178,10 +179,10 @@ through `org-beamer-environments-extra' variable.")
     ("quotation"      "q" "\\begin{quotation}%a %% %h"    "\\end{quotation}")
     ("quote"          "Q" "\\begin{quote}%a %% %h"        "\\end{quote}")
     ("structureenv"   "s" "\\begin{structureenv}%a %% %h" 
"\\end{structureenv}")
-    ("theorem"        "t" "\\begin{theorem}%a[%h]"        "\\end{theorem}")
-    ("definition"     "d" "\\begin{definition}%a[%h]"     "\\end{definition}")
-    ("example"        "e" "\\begin{example}%a[%h]"        "\\end{example}")
-    ("exampleblock"   "E" "\\begin{exampleblock}%a{%h}"   
"\\end{exampleblock}")
+    ("theorem"        "t" "\\begin{theorem}%a[%h]%l"        "\\end{theorem}")
+    ("definition"     "d" "\\begin{definition}%a[%h]%l"     
"\\end{definition}")
+    ("example"        "e" "\\begin{example}%a[%h]%l"        "\\end{example}")
+    ("exampleblock"   "E" "\\begin{exampleblock}%a{%h}%l"   
"\\end{exampleblock}")
     ("proof"          "p" "\\begin{proof}%a[%h]"          "\\end{proof}")
     ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}" 
"\\end{beamercolorbox}"))
   "Environments triggered by properties in Beamer export.
@@ -578,6 +579,7 @@ used as a communication channel."
                (cons "O" (or raw-options ""))
                (cons "h" title)
                (cons "r" raw-title)
+                (cons "l" (format "\\label{%s}" (org-beamer--get-label 
headline info)))
                (cons "H" (if (equal raw-title "") ""
                            (format "{%s}" raw-title)))
                (cons "U" (if (equal raw-title "") ""
-- 
2.39.1

Best,

Alan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]