emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Rasmus <rasmus@gmx.us>, emacs-orgmode@gnu.org
Subject: Re: [patch, ox-latex] caption and :float nil
Date: Thu, 02 Jul 2015 09:50:17 +0100	[thread overview]
Message-ID: <87oajvj646.fsf@gmail.com> (raw)
In-Reply-To: <873817q5ow.fsf@gmx.us>

Hi Rasmus,

2015ko uztailak 1an, Rasmus-ek idatzi zuen:
> 
> Hi,
> 
> Aaron Ecay <aaronecay@gmail.com> 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 ---
> \@tempf ... \@parboxrestore \normalsize \@fs@capt 
>                                                   {\@nameuse {fnum@#1}}{\ign...
> 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	other threads:[~2015-07-02  8:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 23:33 [patch, ox-latex] caption and :float nil Rasmus
2015-07-01 14:21 ` Aaron Ecay
2015-07-01 15:05   ` Rasmus
2015-07-02  8:50     ` Aaron Ecay [this message]
2015-07-02 12:17       ` Rasmus
2015-07-03 12:43         ` Rasmus
2015-07-03 12:57           ` Nicolas Goaziou
2015-07-01 20:16 ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oajvj646.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).