emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [patch, ox-latex] caption and :float nil


From: Aaron Ecay
Subject: Re: [O] [patch, ox-latex] caption and :float nil
Date: Thu, 02 Jul 2015 09:50:17 +0100
User-agent: Notmuch/0.19+52~g1722ea2 (http://notmuchmail.org) Emacs/25.0.50.2 (x86_64-unknown-linux-gnu)

Hi Rasmus,

2015ko uztailak 1an, Rasmus-ek idatzi zuen:
> 
> 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
> 
> ??

Both Gmail and my MUA (notmuch) showed the message as addressed only to
me, but now that I examine the raw headers I see a Newsgroups: line.  I
guess you sent the list copy via NNTP instead of email?  In any case, I
didn’t notice it.  Sorry.

>> 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.

Yes.

> 
>> 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.

OK, I’ve done some more investigation.  By default, minted uses
\newfloat from the float package to create the listing float class.
This does not set up the caption integration.  OTOH, adding the newfloat
option to minted uses \DeclareFloatingEnvironment from the newfloat
package, which works.  IOW, replacing the relevant line in your MWE with
the following makes it work:

\usepackage[newfloat]{minted}

I’m not sure how that should be integrated in the picture – perhaps org
should recommend (require) this invocation of minted.

> 
>>> 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.

But this is an implementation detail of minted, and could change in a
future release.

-- 
Aaron Ecay



reply via email to

[Prev in Thread] Current Thread [Next in Thread]