emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Feature request: "Figure #:" in labels of listings


From: Nicolas Goaziou
Subject: Re: [O] Feature request: "Figure #:" in labels of listings
Date: Wed, 24 Aug 2016 21:51:16 +0200

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.

> 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]]

> Potential solutions:
> * Using a single counter in HTML, and calling listings "Figure"s, as in LaTeX

As stated above, this is not always correct.

> * 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".

> * Introducing an org-mode equivalent of \autoref that would insert
> (and hyperlink, which would be nice) "Figure", "Listing", "Section", …
> as appropriate based on the link's target.

I'm not sure about what you mean here, and to what export back-end it
applies.

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.


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]