emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>, emacs-orgmode@gnu.org
Subject: Re: [RFC] [PATCH] ox-latex: support :float no with caption	for minted listings
Date: Thu, 28 Aug 2014 01:03:52 -0400	[thread overview]
Message-ID: <87r401tdc7.fsf@gmail.com> (raw)
In-Reply-To: <87tx514qaa.fsf@nicolasgoaziou.fr>

Hi Nicolas,

2014ko abuztuak 24an, Nicolas Goaziou-ek idatzi zuen:
> 
> Hello,
> 
> Aaron Ecay <aaronecay@gmail.com> writes:
> 
>> Why is the compatibility=false option needed?  I can’t figure this
>> out.
> 
> 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’t seem
to be any problems in the test documents I worked with, but they were
very minimalistic so perhaps don’t exercise the problem areas.

Anyway, the suggestion from Nicolas R. of using the capt-of package
makes this moot.

> 
>> “Pretty” source code export in all cases requires adding certain packages
>> to the default, as explained in the docstring of ‘org-latex-listings’.
>> The patch adds discussion of the caption requirement there, so there is
>> no “if” about the documentation.
>> 
>> I don’t understand what you’re saying about introducing “support” 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).
> 
> With your patch latex back-end can produce "\captionof" macros. This is
> what I call (partial) "support" from Org: knowing the macro.
> 
> 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:
> 
>   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.
> 
>      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’t
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’t modify any existing code, I’m inclined to
the belief that adding it to the default packages list is tolerable.

If capt-of is added to the default packages, then <caption, non-float,
org-latex-listing = nil> 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’s not correct in
other ways.

> 
>   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'.
> 
>      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.

> 
>      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’t tell what this is for.  It looks like merely a backend-specific
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,

-- 
Aaron Ecay

  reply	other threads:[~2014-08-28  5:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-23  7:36 [RFC] [PATCH] ox-latex: support :float no with caption for minted listings Aaron Ecay
2014-08-23 19:47 ` Nicolas Goaziou
2014-08-23 20:27   ` Aaron Ecay
2014-08-23 23:56     ` Nicolas Goaziou
2014-08-24  0:44       ` Aaron Ecay
2014-08-24  6:51         ` Nicolas Richard
2014-08-24 19:54         ` Nicolas Goaziou
2014-08-28  5:03           ` Aaron Ecay [this message]
2014-08-28  9:19             ` Nicolas Goaziou
2014-09-19 19:04               ` Aaron Ecay
2014-09-19 20:13                 ` Nicolas Goaziou
2014-09-23  3:09                   ` Aaron Ecay
2014-09-23 19:48                     ` Nicolas Goaziou
2014-09-28  4:07                       ` Aaron Ecay
2014-09-28  7:09                         ` Nicolas Goaziou
2014-09-28 12:00                         ` Rasmus

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=87r401tdc7.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).