From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [patch, ox-latex] caption and :float nil Date: Wed, 01 Jul 2015 17:05:19 +0200 Message-ID: <873817q5ow.fsf@gmx.us> References: <87twtovkjh.fsf@gmx.us> <87wpykj6vg.fsf@gmail.com> 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]:56656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAJZt-0006B8-DD for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 11:05:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAJZk-0002HH-Sm for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 11:05:33 -0400 Received: from mout.gmx.net ([212.227.15.19]:64679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAJZk-0002Gp-Iq for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 11:05:24 -0400 Received: from x200s ([90.163.164.75]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MMk99-1Z7s462bN9-008d0L for ; Wed, 01 Jul 2015 17:05:21 +0200 In-Reply-To: <87wpykj6vg.fsf@gmail.com> (Aaron Ecay's message of "Wed, 01 Jul 2015 15:21:39 +0100") 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: emacs-orgmode@gnu.org Hi, Aaron Ecay writes: > AFAICS you sent the original message only to me. I=E2=80=99m replying al= so 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: >>=20 >> Hi, >>=20 >> Attached is a patch that works reasonably well to allow :float nil >> "floats" to have captions in ox-latex. >>=20 >> The hard part is src-blocks. >>=20 >> At the moment we sometimes allow captions to register as figures (at lea= st >> when when using verbatim). Instead we could go with "listing". Of cour= se >> 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: >>=20 >> \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 f= or >> 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 minte= d. >> This seems incompatible.=20=20 > > 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 --- \@tempf ... \@parboxrestore \normalsize \@fs@capt=20 {\@nameuse {fnum@#1}}{\ig= n... 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=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 minted= case > as well. Certainly it will make things more consistent from org=E2=80=99= 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 --=20 Lasciate ogni speranza, voi che leggete questo.