Function: org-latex--caption/label-string
org-latex--caption/label-string is a byte-compiled function defined in
ox-latex.el.gz.
Signature
(org-latex--caption/label-string ELEMENT INFO)
Documentation
Return caption and label LaTeX string for ELEMENT.
INFO is a plist holding contextual information. If there's no caption nor label, return the empty string.
For non-floats, see org-latex--wrap-label.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
(defun org-latex--caption/label-string (element info)
"Return caption and label LaTeX string for ELEMENT.
INFO is a plist holding contextual information. If there's no
caption nor label, return the empty string.
For non-floats, see `org-latex--wrap-label'."
(let* ((label (org-latex--label element info nil t))
(main (org-export-get-caption element))
(attr (org-export-read-attribute :attr_latex element))
(type (org-element-type element))
(nonfloat (or (and (plist-member attr :float)
(not (plist-get attr :float))
main)
(and (eq type 'src-block)
(not (plist-get attr :float))
(memq (plist-get info :latex-src-block-backend)
'(verbatim nil)))))
(short (org-export-get-caption element t))
(caption-from-attr-latex (plist-get attr :caption)))
(cond
((org-string-nw-p caption-from-attr-latex)
(concat caption-from-attr-latex "\n"))
((and (not main) (equal label "")) "")
((not main) label)
;; Option caption format with short name.
(t
(format (if nonfloat "\\captionof{%s}%s{%s%s}\n"
"\\caption%s%s{%s%s}\n")
(let ((type* (if (eq type 'latex-environment)
(org-latex--environment-type element)
type)))
(if nonfloat
(cl-case type*
(paragraph "figure")
(image "figure")
(special-block "figure")
(src-block (if (not (memq (plist-get info :latex-src-block-backend)
'(verbatim nil)))
"listing"
"figure"))
(t (symbol-name type*)))
""))
(if short (format "[%s]" (org-export-data short info)) "")
(org-trim label)
(org-export-data main info))))))