mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 23:02:53 +00:00
ox-latex: Fix references to src block results without #+name
* lisp/ox-latex.el (org-latex--label): Consider :results property in addition to :name property of the datum. For datums that are results of evaluation, the label may not only come from #+name keyword, but can also be duplicated from the generating src block. (org-latex--wrap-label): Do not limit label to elements with #+name. Rely on `org-latex--label' to return appropriate label (or nil). Reported-by: gerard.vermeulen@posteo.net Link: https://orgmode.org/list/6d9db4be5d42236391d5c4e530250ee1@posteo.net
This commit is contained in:
parent
0938795fd7
commit
f4414f5dbb
|
@ -1552,12 +1552,11 @@ this case always return a unique label.
|
|||
Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
|
||||
(let* ((type (org-element-type datum))
|
||||
(user-label
|
||||
(org-element-property
|
||||
(cl-case type
|
||||
((headline inlinetask) :CUSTOM_ID)
|
||||
(target :value)
|
||||
(otherwise :name))
|
||||
datum))
|
||||
(cl-case type
|
||||
((headline inlinetask) (org-element-property :CUSTOM_ID datum))
|
||||
(target (org-element-property :value datum))
|
||||
(otherwise (or (org-element-property :name datum)
|
||||
(car (org-element-property :results datum))))))
|
||||
(label
|
||||
(and (or user-label force)
|
||||
(if (and user-label (plist-get info :latex-prefer-user-labels))
|
||||
|
@ -1818,11 +1817,11 @@ nil."
|
|||
INFO is the current export state, as a plist. This function
|
||||
should not be used for floats. See
|
||||
`org-latex--caption/label-string'."
|
||||
(if (not (and (org-string-nw-p output) (org-element-property :name element)))
|
||||
output
|
||||
(concat (format "\\phantomsection\n\\label{%s}\n"
|
||||
(org-latex--label element info))
|
||||
output)))
|
||||
(let ((label (org-latex--label element info)))
|
||||
(if (not (and (org-string-nw-p output) label))
|
||||
output
|
||||
(concat (format "\\phantomsection\n\\label{%s}\n" label)
|
||||
output))))
|
||||
|
||||
(defun org-latex--protect-text (text)
|
||||
"Protect special characters in string TEXT and return it."
|
||||
|
|
Loading…
Reference in a new issue