From d51723102a3f0cfc05d60a338db81a42031862c9 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Tue, 16 Jan 2024 12:29:24 +0100 Subject: [PATCH] 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 Link: https://orgmode.org/list/m2zfx69uhb.fsf@pm.me --- lisp/ox-latex.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index b36c46f13..432f09f4e 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1361,7 +1361,8 @@ default values of which are given by `org-latex-engraved-preamble' and \\floatname{listing}{\\listingsname} \\newcommand{\\listoflistingsname}{List of Listings} \\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")) t t 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--caption/label-string latex-environment info))) (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) - (org-element-property :caption latex-environment))) + (org-element-property :caption latex-environment))) value ;; Environment is labeled: label must be within the environment ;; (otherwise, a reference pointing to that element will count