lisp/ox-latex.el: Honor non-list value of `org-latex-caption-above'

* lisp/ox-latex.el (org-latex-generate-engraved-preamble):
(org-latex-latex-environment):  Use
`org-latex--caption-above-p' to query whether an element should have
its caption above.

Reported-by: Mads Bach Villadsen <mbvilladsen@pm.me>
Link: https://orgmode.org/list/m2zfx69uhb.fsf@pm.me
This commit is contained in:
Ihor Radchenko 2024-01-16 12:29:24 +01:00
parent b79d9dd604
commit d51723102a
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 3 deletions

View File

@ -1361,7 +1361,8 @@ default values of which are given by `org-latex-engraved-preamble' and
\\floatname{listing}{\\listingsname} \\floatname{listing}{\\listingsname}
\\newcommand{\\listoflistingsname}{List of Listings} \\newcommand{\\listoflistingsname}{List of Listings}
\\providecommand{\\listoflistings}{\\listof{listing}{\\listoflistingsname}}\n" \\providecommand{\\listoflistings}{\\listof{listing}{\\listoflistingsname}}\n"
(if (memq 'src-block org-latex-caption-above) (if (org-latex--caption-above-p
(org-element-create 'src-block) info)
"plaintop" "plain")) "plaintop" "plain"))
t t t t
engraved-preamble))) engraved-preamble)))
@ -2682,9 +2683,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-latex--label latex-environment info nil t) (org-latex--label latex-environment info nil t)
(org-latex--caption/label-string latex-environment info))) (org-latex--caption/label-string latex-environment info)))
(caption-above-p (caption-above-p
(memq type (append (plist-get info :latex-caption-above) '(math))))) (or (eq type 'math)
(org-latex--caption-above-p latex-environment info))))
(if (not (or (org-element-property :name latex-environment) (if (not (or (org-element-property :name latex-environment)
(org-element-property :caption latex-environment))) (org-element-property :caption latex-environment)))
value value
;; Environment is labeled: label must be within the environment ;; Environment is labeled: label must be within the environment
;; (otherwise, a reference pointing to that element will count ;; (otherwise, a reference pointing to that element will count