From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [patch, ox-latex] caption and :float nil Date: Thu, 02 Jul 2015 09:50:17 +0100 Message-ID: <87oajvj646.fsf@gmail.com> References: <87twtovkjh.fsf@gmx.us> <87wpykj6vg.fsf@gmail.com> <873817q5ow.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAaCZ-0002pi-IE for emacs-orgmode@gnu.org; Thu, 02 Jul 2015 04:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAaCV-00021u-92 for emacs-orgmode@gnu.org; Thu, 02 Jul 2015 04:50:35 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:36011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAaCV-00021V-0z for emacs-orgmode@gnu.org; Thu, 02 Jul 2015 04:50:31 -0400 Received: by widjy10 with SMTP id jy10so78538322wid.1 for ; Thu, 02 Jul 2015 01:50:30 -0700 (PDT) In-Reply-To: <873817q5ow.fsf@gmx.us> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus , emacs-orgmode@gnu.org Hi Rasmus, 2015ko uztailak 1an, Rasmus-ek idatzi zuen: >=20 > Hi, >=20 > Aaron Ecay writes: >=20 >> AFAICS you sent the original message only to me. I=E2=80=99m replying a= lso to >> the org mode list. You may want to resend the patch attachment though, >> since the quoting in this reply will probably mangle it. >=20 > http://permalink.gmane.org/gmane.emacs.orgmode/98791 >=20 > ?? 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=E2=80=99t notice it. Sorry. >> I think this should depend on the value of org-latex-listings: >> nil -> use \captionof{float} >=20 > You mean figure. But a source block in not a float. Yes. >=20 >> t -> use \captionof{listing} >> minted -> use \captionof{listing} (see below for why) >=20 >=20 >>> 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. >>>=20 >>> BTW: In the current code we uses \captionof{listing}{caption} with mint= ed. >>> This seems incompatible.=20=20 >>=20 >> Minted uses listing as itsf floating environment; see sec. 5 of the >> minted manual. So this seems correct in fact. >=20 > Consider this minimal example >=20 > \documentclass{article} > \usepackage{minted} > \usepackage{capt-of} > \begin{document} > \begin{minted}{lisp} > (+ 1 1 ) > \end{minted} > \captionof{listing}{test} > \end{document} >=20 > This is the error I get when compiling: >=20 > ERROR: Undefined control sequence. >=20 > --- TeX said --- > \@tempf ... \@parboxrestore \normalsize \@fs@capt=20 > {\@nameuse {fnum@#1}}{\= ign... > l.8 \captionof{listing}{test} >=20 > It works fine when I use another counter than listing. OK, I=E2=80=99ve 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=E2=80=99m not sure how that should be integrated in the picture =E2=80=93= perhaps org should recommend (require) this invocation of minted. >=20 >>> 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. >>=20 >> I=E2=80=99m not sure that minted provides this separately from the float >> package. So it=E2=80=99s probably better to use \captionof in the minte= d case >> as well. Certainly it will make things more consistent from org=E2=80= =99s POV. >>=20 >=20 > I guess it doesn't. In any, minted.sty has >=20 > \RequirePackage{float} >=20 > 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. --=20 Aaron Ecay