emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Feature request: "Figure #:" in labels of listings
Date: Wed, 24 Aug 2016 16:51:01 -0400	[thread overview]
Message-ID: <3fce785b-e85a-992d-95a6-b5ad3b560e90@gmail.com> (raw)
In-Reply-To: <87vayq0wuj.fsf@saiph.selenimh>


[-- Attachment #1.1: Type: text/plain, Size: 1964 bytes --]



On 2016-08-24 15:51, Nicolas Goaziou wrote:
> Hello,
> 
> Clément Pit--Claudel <clement.pit@gmail.com> 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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2016-08-24 20:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-13  3:23 Feature request: "Figure #:" in labels of listings Clément Pit--Claudel
2016-08-15 15:43 ` Nicolas Goaziou
2016-08-22 13:33   ` Clément Pit--Claudel
2016-08-22 20:27     ` Nicolas Goaziou
2016-08-22 20:48       ` Clément Pit--Claudel
2016-08-24 19:51         ` Nicolas Goaziou
2016-08-24 20:51           ` Clément Pit--Claudel [this message]

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=3fce785b-e85a-992d-95a6-b5ad3b560e90@gmail.com \
    --to=clement.pit@gmail.com \
    --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).