diff options
author | Lixin Chin <lixin.chin@research.uwa.edu.au> | 2017-01-31 14:15:40 +0800 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-01-31 09:01:42 +0100 |
commit | caa54d2e987eaca785df87ff51c11a04a38d4842 (patch) | |
tree | 9e1c8eecb1913118a0e8537990c322efaba67c1b | |
parent | 8194e7b09d592599985ea503dbda225463323c46 (diff) | |
download | org-mode-caa54d2e987eaca785df87ff51c11a04a38d4842.tar.gz |
ox-latex.el: Wrap 'minted' src blocks in a 'listing' environment
* lisp/ox-latex.el (org-latex-src-block): Make source highlighting
using the 'minted' syntax highlighting package behave the same as
using the 'listings' syntax highlighting package.
The source block should be floating if a caption is provided, or if
':float t' is provided in an '#+ATTR_LATEX:' block. Previously, the
source block would only be floating if ':float multicolumn' was
provided. This now matches the Org mode documentation for source
blocks.
TINYCHANGE
-rw-r--r-- | lisp/ox-latex.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 752583b..6e00f57 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1298,8 +1298,7 @@ For non-floats, see `org-latex--wrap-label'." main) (and (eq type 'src-block) (not (plist-get attr :float)) - (memq (plist-get info :latex-listings) - '(nil minted))))) + (null (plist-get info :latex-listings))))) (short (org-export-get-caption element t)) (caption-from-attr-latex (plist-get attr :caption))) (cond @@ -2875,13 +2874,19 @@ contextual information." (float-env (cond ((string= "multicolumn" float) - (format "\\begin{listing*}\n%s%%s\n%s\\end{listing*}" + (format "\\begin{listing*}[%s]\n%s%%s\n%s\\end{listing*}" + (plist-get info :latex-default-figure-position) (if caption-above-p caption-str "") (if caption-above-p "" caption-str))) (caption - (concat (if caption-above-p caption-str "") - "%s" - (if caption-above-p "" (concat "\n" caption-str)))) + (format "\\begin{listing}[%s]\n%s%%s\n%s\\end{listing}" + (plist-get info :latex-default-figure-position) + (if caption-above-p caption-str "") + (if caption-above-p "" caption-str))) + ((string= "t" float) + (concat (format "\\begin{listing}[%s]\n" + (plist-get info :latex-default-figure-position)) + "%s\n\\end{listing}")) (t "%s"))) (options (plist-get info :latex-minted-options)) (body |