From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Feature request: "Figure #:" in labels of listings Date: Wed, 24 Aug 2016 21:51:16 +0200 Message-ID: <87vayq0wuj.fsf@saiph.selenimh> References: <092e6a31-51b1-8bb8-d8bc-3e1da66764da@gmail.com> <87bn0uujfg.fsf@saiph.selenimh> <8737lwwnup.fsf@saiph.selenimh> <2824f983-5494-371f-a969-bd1ea40b6810@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bceCq-0004zD-G2 for emacs-orgmode@gnu.org; Wed, 24 Aug 2016 15:51:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bceCm-0007cr-Bm for emacs-orgmode@gnu.org; Wed, 24 Aug 2016 15:51:23 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:57104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bceCm-0007cm-50 for emacs-orgmode@gnu.org; Wed, 24 Aug 2016 15:51:20 -0400 In-Reply-To: <2824f983-5494-371f-a969-bd1ea40b6810@gmail.com> (=?utf-8?Q?=22Cl=C3=A9ment?= Pit--Claudel"'s message of "Mon, 22 Aug 2016 16:48:52 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel Cc: emacs-orgmode@gnu.org Hello, Cl=C3=A9ment Pit--Claudel 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 L= aTeX As stated above, this is not always correct. > * Using two counters in LaTeX as well, though this will require changes t= o 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", =E2= =80=A6 > 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, --=20 Nicolas Goaziou