From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: src-blocks with captions do not respect attr_latex :placement options Date: Mon, 19 Feb 2018 11:20:05 +0100 Message-ID: <874lmdl1re.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eniYQ-0003Ru-W4 for emacs-orgmode@gnu.org; Mon, 19 Feb 2018 05:20:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eniYM-00089y-19 for emacs-orgmode@gnu.org; Mon, 19 Feb 2018 05:20:14 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:36670) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eniYL-00089B-QF for emacs-orgmode@gnu.org; Mon, 19 Feb 2018 05:20:09 -0500 In-Reply-To: (John Kitchin's message of "Wed, 14 Feb 2018 11:44:21 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: org-mode-email Hello, John Kitchin writes: > A block like this: > > #+attr_latex: :placement [H] > > #+caption: A test block > #+BEGIN_SRC ipython > > 'hello' > #+END_SRC > > exports to latex as: > > \begin{listing}[htbp] > \begin{minted}[frame=lines,fontsize=\scriptsize,linenos]{ipython} > 'hello' > \end{minted} > \caption{A test block} > \end{listing} > > The root of this is in org-latex-src-block where (plist-get info > :latex-default-figure-position) is being used to specify the > placement. True. LaTeX back-end doesn't handle :placement attribute in source blocks. > It seems like a sort of easy fix, but requires a couple of changes in the > function. > > I think we could replace all instances of > > (plist-get info :latex-default-figure-position) > > with > > (or (plist-get attributes :placement) > (format "[%s]" > (plist-get info :latex-default-figure-position))) Why (format "[%s]" ...)? > and also replace everything like: > > \\begin{figure*}[%s] > > with > > \\begin{figure*}%s > > I don't see a way around that unless :latex-default-figure-position is > changed from "htbp" to "[htbp]". I fail to see why this change is needed. > Thoughts? Do you want to propose a patch? The manual would need to be updated accordingly. Regards, -- Nicolas Goaziou