mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-03 11:33:46 +00:00
org-e-latex: Fix label position in LaTeX environments
* EXPERIMENTAL/org-e-latex.el (org-e-latex-latex-environment): label should be within the environment.
This commit is contained in:
parent
af2a46a76f
commit
61f831b923
@ -1295,9 +1295,19 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-latex-latex-environment (latex-environment contents info)
|
||||
"Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-e-latex--wrap-label
|
||||
latex-environment
|
||||
(org-remove-indentation (org-element-get-property :value latex-environment))))
|
||||
(let ((label (org-element-get-property :name latex-environment))
|
||||
(value (org-remove-indentation
|
||||
(org-element-get-property :value latex-environment))))
|
||||
(if (not (org-string-nw-p label)) value
|
||||
;; Environment is labelled: label must be within the environment
|
||||
;; (otherwise, a reference pointing to that element will count
|
||||
;; the section instead).
|
||||
(with-temp-buffer
|
||||
(insert value)
|
||||
(goto-char (point-min))
|
||||
(forward-line)
|
||||
(insert (format "\\label{%s}\n" label))
|
||||
(buffer-string)))))
|
||||
|
||||
|
||||
;;;; Latex Fragment
|
||||
|
Loading…
Reference in New Issue
Block a user