emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-latex.el: Extend :placement attribute to source blocks
@ 2019-09-12 12:50 Mario Schlegel
  2019-09-16 17:00 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Schlegel @ 2019-09-12 12:50 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Mario Schlegel

* lisp/ox-latex.el (org-latex-src-block): Extend :placement attribute
to source blocks when the minted package is used.

TINYCHANGE
---
 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 1f1be240a..77aac78f4 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2957,21 +2957,23 @@ contextual information."
        ;; Case 3.  Use minted package.
        ((eq listings 'minted)
 	(let* ((caption-str (org-latex--caption/label-string src-block info))
+	       (placement (or (org-unbracket-string "[" "]" (plist-get attributes :placement))
+			      (plist-get info :latex-default-figure-position)))
 	       (float-env
 		(cond
 		 ((string= "multicolumn" float)
 		  (format "\\begin{listing*}[%s]\n%s%%s\n%s\\end{listing*}"
-			  (plist-get info :latex-default-figure-position)
+			  placement
 			  (if caption-above-p caption-str "")
 			  (if caption-above-p "" caption-str)))
 		 (caption
 		  (format "\\begin{listing}[%s]\n%s%%s\n%s\\end{listing}"
-			  (plist-get info :latex-default-figure-position)
+			  placement
 			  (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))
+				  placement)
 			  "%s\n\\end{listing}"))
 		 (t "%s")))
 	       (options (plist-get info :latex-minted-options))
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ox-latex.el: Extend :placement attribute to source blocks
  2019-09-12 12:50 [PATCH] ox-latex.el: Extend :placement attribute to source blocks Mario Schlegel
@ 2019-09-16 17:00 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2019-09-16 17:00 UTC (permalink / raw)
  To: Mario Schlegel; +Cc: emacs-orgmode

Hello,

Mario Schlegel <m.schlegel@posteo.de> writes:

> * lisp/ox-latex.el (org-latex-src-block): Extend :placement attribute
> to source blocks when the minted package is used.

Applied. Thank you!

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-16 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 12:50 [PATCH] ox-latex.el: Extend :placement attribute to source blocks Mario Schlegel
2019-09-16 17:00 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).