From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [patch, ox-latex] caption and :float nil
Date: Wed, 01 Jul 2015 17:05:19 +0200 [thread overview]
Message-ID: <873817q5ow.fsf@gmx.us> (raw)
In-Reply-To: <87wpykj6vg.fsf@gmail.com> (Aaron Ecay's message of "Wed, 01 Jul 2015 15:21:39 +0100")
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
??
> 2015ko uztailak 1an, Rasmus-ek idatzi zuen:
>>
>> Hi,
>>
>> Attached is a patch that works reasonably well to allow :float nil
>> "floats" to have captions in ox-latex.
>>
>> The hard part is src-blocks.
>>
>> At the moment we sometimes allow captions to register as figures (at least
>> when when using verbatim). Instead we could go with "listing". Of course
>> 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:
>>
>> \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 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.
>> 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.
Rasmus
--
Lasciate ogni speranza, voi che leggete questo.
next prev parent reply other threads:[~2015-07-01 15:05 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 [this message]
2015-07-02 8:50 ` Aaron Ecay
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=873817q5ow.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/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).