emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] CUSTOM_id ignored on blocks by ox-beamer
Date: Thu, 09 Feb 2023 10:14:26 +0100	[thread overview]
Message-ID: <m2mt5nw68d.fsf@eduroam-82-218.eduroam.wifi.biologie.ens.fr> (raw)
In-Reply-To: <8735866czo.fsf@localhost>


[-- Attachment #1.1: Type: text/plain, Size: 395 bytes --]

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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-beamer.el-add-labels-to-latex-export.patch --]
[-- Type: text/x-patch, Size: 3560 bytes --]

>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


[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


Best,

Alan

  reply	other threads:[~2023-02-09  9:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 11:52 CUSTOM_id ignored on blocks by ox-beamer alan.schmitt
2023-01-05  9:26 ` [BUG] " Ihor Radchenko
2023-01-08 16:25   ` Alan Schmitt
2023-01-15 13:57     ` Alan Schmitt
2023-01-19 10:21     ` Ihor Radchenko
2023-02-09  9:14       ` Alan Schmitt [this message]
2023-02-10 10:57         ` 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=m2mt5nw68d.fsf@eduroam-82-218.eduroam.wifi.biologie.ens.fr \
    --to=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).