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'
This commit is contained in:
Alan Schmitt 2023-01-08 17:20:31 +01:00 committed by Ihor Radchenko
parent 739ccf6cbf
commit 666a61bcc8
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 12 additions and 4 deletions

View File

@ -24,6 +24,12 @@ consider [[https://gitlab.com/jackkamm/ob-python-mode-mode][ob-python-mode-mode]
has been ported to.
** New and changed options
*** 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~.
*** ~org-clock-x11idle-program-name~ now defaults to =xprintidle=, when available
When =xprintidle= executable is available at =org-clock= load time, it

View File

@ -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 "") ""