[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [patch, ox-latex] caption and :float nil
From: |
Rasmus |
Subject: |
Re: [O] [patch, ox-latex] caption and :float nil |
Date: |
Wed, 01 Jul 2015 17:05:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hi,
Aaron Ecay <address@hidden> writes:
> AFAICS you sent the original message only to me. I’m replying also to
> the org mode list. You may want to resend the patch attachment though,
> since the quoting in this reply will probably mangle it.
http://permalink.gmane.org/gmane.emacs.orgmode/98791
??
> 2015ko uztailak 1an, Rasmus-ek idatzi zuen:
>>
>> Hi,
>>
>> Attached is a patch that works reasonably well to allow :float nil
>> "floats" to have captions in ox-latex.
>>
>> The hard part is src-blocks.
>>
>> At the moment we sometimes allow captions to register as figures (at least
>> when when using verbatim). Instead we could go with "listing". Of course
>> listing is not a known environment to LaTeX. We can add register it with
>> newfloat in default-packages, or we can mention in the manual the lines
>> that needs to be added to org-latex-packages if desired:
>>
>> \usepackage{newfloat}
>> \DeclareFloatingEnvironment{listing}
>>
>
> I think this should depend on the value of org-latex-listings:
> nil -> use \captionof{float}
You mean figure. But a source block in not a float.
> t -> use \captionof{listing}
> minted -> use \captionof{listing} (see below for why)
>> We could also unconditionally use captionof in case of verbatim output for
>> src blocks, even if float is required, which would allow us to kill
>> float.sty from default package alist.
>>
>> BTW: In the current code we uses \captionof{listing}{caption} with minted.
>> This seems incompatible.
>
> Minted uses listing as itsf floating environment; see sec. 5 of the
> minted manual. So this seems correct in fact.
Consider this minimal example
\documentclass{article}
\usepackage{minted}
\usepackage{capt-of}
\begin{document}
\begin{minted}{lisp}
(+ 1 1 )
\end{minted}
\captionof{listing}{test}
\end{document}
This is the error I get when compiling:
ERROR: Undefined control sequence.
--- TeX said ---
address@hidden ... address@hidden \normalsize address@hidden@capt
address@hidden address@hidden
l.8 \captionof{listing}{test}
It works fine when I use another counter than listing.
>> But I have not really used minted so I don't know if I did the
>> test correctly. minted has a [H] placement through it's listings
>> environment, it seems, so I don't think we need captionof there.
>
> I’m not sure that minted provides this separately from the float
> package. So it’s probably better to use \captionof in the minted case
> as well. Certainly it will make things more consistent from org’s POV.
>
I guess it doesn't. In any, minted.sty has
\RequirePackage{float}
So we can be sure [H] is available. Thus, we should just rely on float.
Rasmus
--
Lasciate ogni speranza, voi che leggete questo.