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{}\"."
|
Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
|
||||||
(let* ((type (org-element-type datum))
|
(let* ((type (org-element-type datum))
|
||||||
(user-label
|
(user-label
|
||||||
(org-element-property
|
(cl-case type
|
||||||
(cl-case type
|
((headline inlinetask) (org-element-property :CUSTOM_ID datum))
|
||||||
((headline inlinetask) :CUSTOM_ID)
|
(target (org-element-property :value datum))
|
||||||
(target :value)
|
(otherwise (or (org-element-property :name datum)
|
||||||
(otherwise :name))
|
(car (org-element-property :results datum))))))
|
||||||
datum))
|
|
||||||
(label
|
(label
|
||||||
(and (or user-label force)
|
(and (or user-label force)
|
||||||
(if (and user-label (plist-get info :latex-prefer-user-labels))
|
(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
|
INFO is the current export state, as a plist. This function
|
||||||
should not be used for floats. See
|
should not be used for floats. See
|
||||||
`org-latex--caption/label-string'."
|
`org-latex--caption/label-string'."
|
||||||
(if (not (and (org-string-nw-p output) (org-element-property :name element)))
|
(let ((label (org-latex--label element info)))
|
||||||
output
|
(if (not (and (org-string-nw-p output) label))
|
||||||
(concat (format "\\phantomsection\n\\label{%s}\n"
|
output
|
||||||
(org-latex--label element info))
|
(concat (format "\\phantomsection\n\\label{%s}\n" label)
|
||||||
output)))
|
output))))
|
||||||
|
|
||||||
(defun org-latex--protect-text (text)
|
(defun org-latex--protect-text (text)
|
||||||
"Protect special characters in string TEXT and return it."
|
"Protect special characters in string TEXT and return it."
|
||||||
|
|
Loading…
Reference in a new issue