mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-26 08:32:51 +00:00
lisp/ox-latex.el: Don't emit empty label=, caption=
* lisp/ox-latex.el (org-latex-src-block--listings): Don't emit label= when label is empty. Don't emit caption= and captionpos= when caption is empty. This is safe to do as long as we do not set "lstlisting" parameters globally. See the discussion in https://orgmode.org/list/87h6xyqqod.fsf@localhost.
This commit is contained in:
parent
dd4e06ddc3
commit
0c467b6b89
|
@ -3594,11 +3594,14 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
|
|||
((and float (not (assoc "float" lst-opt)))
|
||||
`(("float" ,(plist-get info :latex-default-figure-position)))))
|
||||
`(("language" ,lst-lang))
|
||||
(if label
|
||||
`(("label" ,(org-latex--label src-block info)))
|
||||
'(("label" " ")))
|
||||
(if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
|
||||
`(("captionpos" ,(if caption-above-p "t" "b")))
|
||||
(when label
|
||||
`(("label" ,(org-latex--label src-block info))))
|
||||
(when caption-str
|
||||
`(("caption" ,caption-str)))
|
||||
(when caption-str
|
||||
;; caption-above-p means captionpos is t(op)
|
||||
;; else b(ottom)
|
||||
`(("captionpos" ,(if caption-above-p "t" "b"))))
|
||||
(cond ((assoc "numbers" lst-opt) nil)
|
||||
((not num-start) '(("numbers" "none")))
|
||||
(t `(("firstnumber" ,(number-to-string (1+ num-start)))
|
||||
|
|
Loading…
Reference in a new issue