0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 22:32:51 +00:00

lisp/ox-latex.el: put labels inside example blocks

* lisp/ox-latex.el (org-latex-example-block): Instead of
`org-latex--wrap-label', manually add label after
\begin{<environment>}.

This produces proper label resolution in LaTeX.  Labels before the
environment begins can be interpreted as referring to the surrounding
section.
This commit is contained in:
Hugo Heagren 2022-12-01 23:24:10 +00:00 committed by Ihor Radchenko
parent 97a780f0be
commit 304f18cb72
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -2131,13 +2131,13 @@ information."
(let ((environment (or (org-export-read-attribute
:attr_latex example-block :environment)
"verbatim")))
(org-latex--wrap-label
example-block
(format "\\begin{%s}\n%s\\end{%s}"
environment
(org-export-format-code-default example-block info)
environment)
info))))
(format "\\begin{%s}%s\n%s\\end{%s}"
environment
(if (org-element-property :name example-block)
(org-latex--label example-block info nil 'full)
"")
(org-export-format-code-default example-block info)
environment))))
;;;; Export Block