[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] src-blocks with captions do not respect attr_latex :placement op
From: |
Nicolas Goaziou |
Subject: |
Re: [O] src-blocks with captions do not respect attr_latex :placement options |
Date: |
Mon, 19 Feb 2018 11:20:05 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Hello,
John Kitchin <address@hidden> 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