[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Feature request: "Figure #:" in labels of listings
From: |
Clément Pit--Claudel |
Subject: |
Re: [O] Feature request: "Figure #:" in labels of listings |
Date: |
Wed, 24 Aug 2016 16:51:01 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 2016-08-24 15:51, Nicolas Goaziou wrote:
> Hello,
>
> Clément Pit--Claudel <address@hidden> writes:
>
>> One small difficulty is that html export uses two separate counters
>> for figures and listings, while LaTeX export calls both figures, and
>> uses a single counter.
>
> This is not necessarily true. For example, when "listings" package is
> used, listings and floats get a different counter.
Ah, I see; thanks for pointing this out!
>> This makes it tricky to reference figures in a way that works with
>> both HTML and LaTeX: for HTML one needs to write "Figure [[fig:a]]
>> shows x, Listing [[lst:b]] shows y" (which exports into "Figure
>> 1 shows x, Listing 1 shows y", while for LaTeX one needs to write
>> "Figure [[fig:a]] shows x, Figure [[lst:a]] shows y" (which exports
>> into "Figure 1 shows x, Figure 2 shows y"). I don't know of an easy
>> way to achieve this.
>
> You can use @@html:Listing@@@@latex:Figure@@ [[lst:a]], or with a macro
>
> #+macro: listing @@html:Listing@@@@latex:Figure@@
>
> and
>
> {{{listing}}} [[lst:a]]
Thanks! That's a convenient workaround. Macros names are not case-sensitive,
right? (so having to macros {{{listing}}} and {{{Listing}}} won't do)
>> Potential solutions:
>> * Using a single counter in HTML, and calling listings "Figure"s, as in LaTeX
>
> As stated above, this is not always correct.
Thanks; I missed that part.
>> * Using two counters in LaTeX as well, though this will require changes to
>> existing Org documents, which is not ideal.
>
> Counters in "latex" back-end are handled on the LaTeX side, unlike to
> "html".
Got it.
> In any case, I don't think there is a single satisfying solution. It
> really depends on one's needs. I guess we could introduce a variable to
> switch from one counting system to the other, if needed. Patches
> welcome.
Thanks for the clear and comprehensive answer!
Clément.
signature.asc
Description: OpenPGP digital signature