From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: src-blocks with captions do not respect attr_latex :placement options Date: Wed, 14 Feb 2018 11:44:21 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1147c88c859d3a0565315662" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em2yf-0006ZW-SD for emacs-orgmode@gnu.org; Wed, 14 Feb 2018 14:44:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1em2ye-0004Uy-MJ for emacs-orgmode@gnu.org; Wed, 14 Feb 2018 14:44:25 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:37514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1em2ye-0004UJ-EI for emacs-orgmode@gnu.org; Wed, 14 Feb 2018 14:44:24 -0500 Received: by mail-wm0-x233.google.com with SMTP id v71so24019782wmv.2 for ; Wed, 14 Feb 2018 11:44:24 -0800 (PST) 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: org-mode-email --001a1147c88c859d3a0565315662 Content-Type: text/plain; charset="UTF-8" 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. 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))) 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]". Thoughts? John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu --001a1147c88c859d3a0565315662 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
A block like this:

#+attr_latex: := placement [H]
#+caption: A test block
#+BEGIN_SRC ipyth= on
'hello'
#+END_SRC

e= xports to latex as:

\begin{listing}[htbp]
\begin{minted}[frame=3Dlines,fontsize=3D\scriptsize,linenos]{ipython= }
'hello'
\end{minted}
\caption{A tes= t block}
\end{listing}

The root of= this is in=C2=A0=C2=A0org-latex-src-block where=C2=A0(plist-get info :late= x-default-figure-position) is being used to specify the placement.

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=C2=A0

(plist-get info :latex-def= ault-figure-position)

with=C2=A0
(or (plist-get attributes :placement)
=C2=A0 =C2=A0(format "[%s]"
=C2=A0 =C2=A0(plist-get info := latex-default-figure-position)))

and also replace = everything like:

\\begin{figure*}[%s]

with=C2=A0

\\begin{figure*}%s
=

I don't see a way around that unless=C2=A0:la= tex-default-figure-position is changed from "htbp" to "[htbp= ]".

Thoughts?

John
-----------------------------------
Professor John Kitchin=C2=A0
Doh= erty Hall A207F
Department of Chemical Engineering
Carnegie Mellon Un= iversity
Pittsburgh, PA 15213
412-268-7803
--001a1147c88c859d3a0565315662--