From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [RFC] [PATCH] ox-latex: support :float no with caption for minted listings Date: Thu, 28 Aug 2014 01:03:52 -0400 Message-ID: <87r401tdc7.fsf@gmail.com> References: <1408779394-11436-1-git-send-email-aaronecay@gmail.com> <87ha13dm3v.fsf@nicolasgoaziou.fr> <87oavbostg.fsf@gmail.com> <87a96uep52.fsf@nicolasgoaziou.fr> <87d2bqpvgr.fsf@gmail.com> <87tx514qaa.fsf@nicolasgoaziou.fr> 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]:53951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMrsS-0004di-UT for emacs-orgmode@gnu.org; Thu, 28 Aug 2014 01:04:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMrsJ-00061E-Sn for emacs-orgmode@gnu.org; Thu, 28 Aug 2014 01:04:04 -0400 Received: from mail-qc0-x22f.google.com ([2607:f8b0:400d:c01::22f]:53373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMrsJ-000618-NS for emacs-orgmode@gnu.org; Thu, 28 Aug 2014 01:03:55 -0400 Received: by mail-qc0-f175.google.com with SMTP id c9so274594qcz.34 for ; Wed, 27 Aug 2014 22:03:54 -0700 (PDT) In-Reply-To: <87tx514qaa.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou , emacs-orgmode@gnu.org Hi Nicolas, 2014ko abuztuak 24an, Nicolas Goaziou-ek idatzi zuen: >=20 > Hello, >=20 > Aaron Ecay writes: >=20 >> Why is the compatibility=3Dfalse option needed? I can=E2=80=99t figure = this >> out. >=20 > This is in my local copy of the minted manual, in "7 Known issues". It > may be outdated, though. Hmm. I had not seen that in the manual; good catch. There didn=E2=80=99t = seem to be any problems in the test documents I worked with, but they were very minimalistic so perhaps don=E2=80=99t exercise the problem areas. Anyway, the suggestion from Nicolas R. of using the capt-of package makes this moot. >=20 >> =E2=80=9CPretty=E2=80=9D source code export in all cases requires adding= certain packages >> to the default, as explained in the docstring of =E2=80=98org-latex-list= ings=E2=80=99. >> The patch adds discussion of the caption requirement there, so there is >> no =E2=80=9Cif=E2=80=9D about the documentation. >>=20 >> I don=E2=80=99t understand what you=E2=80=99re saying about introducing = =E2=80=9Csupport=E2=80=9D for >> the caption package. The patch uses one specific feature of the caption >> package in one specific place to accomplish one specific goal. There >> are no other changes needed anywhere else in the codebase than these >> couple of lines in one function (plus the documentation). >=20 > With your patch latex back-end can produce "\captionof" macros. This is > what I call (partial) "support" from Org: knowing the macro. >=20 > Again, using this macro is an error in the default configuration. > Besides not doing using it at all, there are usually two ways to solve > the problem: >=20 > 1. Add the package in the default package list, so the combination > still works out of the box for anyone. E.g., `rotating' package. > Use with care, more packages is a higher risk of incompatibilites > between them. The lighter counterpart of `caption' package may be > safe though. >=20 > OTOH, once the package is in the default package list, it can be > used everywhere in the back-end. This can be an advantage if there > are several places that could use \captionof. The other application I can think of is to allow captioned images and tables not to float. The LaTeX world is full of tutorials on how to un-float floating images and tables, but IME the org community doesn=E2=80= =99t ask for this. (perhaps they implement their own solutions in latex.) Given that the capt-of package is just two lines of code, defines just one new command, and doesn=E2=80=99t modify any existing code, I=E2=80=99m = inclined to the belief that adding it to the default packages list is tolerable. If capt-of is added to the default packages, then source blocks can also be handled. My original patch did not handle this case, on the theory that default option values should always generate output that complies, even if it=E2=80=99s not corre= ct in other ways. >=20 > 2. Suggest, through docstring or manual, to the user to require > a specific package if he wants to benefit from the feature. E.g., > `booktabs'. >=20 > Usually, the situation makes it obvious that such a package is > required (e.g. ":environment longtabu" or ":booktabs t"). > Unfortunately, this is not the case here. Under some > circumstances, :float nil needs `caption' (or its lighter > counterpart). I find it a bit too magical. I see your point. But, the \captionof command will only be emitted if the user has changed org-latex-listings to a non-default value (i.e. 'minted), necessitating the addition of the minted package to org-latex-packages-alist. The patch adds a note about the caption (-> capt-of) package to the same docstring, so hopefully it will be obvious enough. So this is hopefully a workable backup option to an addition to the default list. >=20 > Note there is also :caption attribute which is used in tables and > special blocks, but not in source blocks, which may come handy > here. I can=E2=80=99t tell what this is for. It looks like merely a backend-spec= ific alternative to specifying the caption using org syntax (#+caption:). Am I missing something? (Actually there seems to be subtle inconsistencies with respect to the handling of attr_latex :caption in the present code, which I will work on a patch to fix...) Thanks, --=20 Aaron Ecay