From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Subject: Re: Feature request: "Figure #:" in labels of listings Date: Wed, 24 Aug 2016 16:51:01 -0400 Message-ID: <3fce785b-e85a-992d-95a6-b5ad3b560e90@gmail.com> References: <092e6a31-51b1-8bb8-d8bc-3e1da66764da@gmail.com> <87bn0uujfg.fsf@saiph.selenimh> <8737lwwnup.fsf@saiph.selenimh> <2824f983-5494-371f-a969-bd1ea40b6810@gmail.com> <87vayq0wuj.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iu6NDqf1buB0UXm4Kpd4fiPiHQmUwqedQ" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcf8r-00070m-On for emacs-orgmode@gnu.org; Wed, 24 Aug 2016 16:51:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcf8m-0006Jh-PO for emacs-orgmode@gnu.org; Wed, 24 Aug 2016 16:51:20 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:61032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcf8m-0006Jb-Ej for emacs-orgmode@gnu.org; Wed, 24 Aug 2016 16:51:16 -0400 Received: from [18.26.2.123] ([18.26.2.123]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0MJnBU-1bbZDC2noq-0016Cq for ; Wed, 24 Aug 2016 22:51:14 +0200 In-Reply-To: <87vayq0wuj.fsf@saiph.selenimh> 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: emacs-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iu6NDqf1buB0UXm4Kpd4fiPiHQmUwqedQ Content-Type: multipart/mixed; boundary="bbjBMEft55Jav0xXj9cqdMVC2RPgGC4uD" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-orgmode@gnu.org Message-ID: <3fce785b-e85a-992d-95a6-b5ad3b560e90@gmail.com> Subject: Re: Feature request: "Figure #:" in labels of listings References: <092e6a31-51b1-8bb8-d8bc-3e1da66764da@gmail.com> <87bn0uujfg.fsf@saiph.selenimh> <8737lwwnup.fsf@saiph.selenimh> <2824f983-5494-371f-a969-bd1ea40b6810@gmail.com> <87vayq0wuj.fsf@saiph.selenimh> In-Reply-To: <87vayq0wuj.fsf@saiph.selenimh> --bbjBMEft55Jav0xXj9cqdMVC2RPgGC4uD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-08-24 15:51, Nicolas Goaziou wrote: > Hello, >=20 > Cl=C3=A9ment Pit--Claudel writes: >=20 >> 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. >=20 > 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. >=20 > You can use @@html:Listing@@@@latex:Figure@@ [[lst:a]], or with a macro= >=20 > #+macro: listing @@html:Listing@@@@latex:Figure@@ >=20 > and >=20 > {{{listing}}} [[lst:a]] Thanks! That's a convenient workaround. Macros names are not case-sensiti= ve, 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 i= n LaTeX >=20 > As stated above, this is not always correct. Thanks; I missed that part. >> * Using two counters in LaTeX as well, though this will require change= s to existing Org documents, which is not ideal. >=20 > 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=C3=A9ment. --bbjBMEft55Jav0xXj9cqdMVC2RPgGC4uD-- --iu6NDqf1buB0UXm4Kpd4fiPiHQmUwqedQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXvgi1AAoJEPqg+cTm90wjTKEP/Rl+HAXLc+gSZk18O2fce3AT DGH7E4qtgqvHojPrzxC3IKd7YZlZbTPso34rQHgpOkZsYmrLRtJ+rxuA5tlWyRvL iALhlJyv6tFzzDntM61LG4aPjg3TIG0f2iIrXQf2PjI7KusnGim6VpfYCseyT7xd f9rc4of32rNXenBJXkyfnwykPqjfyONJ8l8pwPpPV3xisowrgIUByYLJZO5KY12r jBW4b+AcuuWJ1/yyd3kudp79nguQnGC0zeZA6VyM/bSUv8qEjq3blBK5GRLthjl6 jB3coS2BVrNxPwF7AT2y1BrQztGsl7mtpDVXT1SnZSzikOHofgXFyzJNOKuqj3xL /TdmeNyz8mxwLH29StkQUFT18j3YQntz/sPZi7Aksi9huuvvThRorFO0kgRlsxyz cxaqJOAeDBUG5PjyBy0fejtCanHO5hX9xXwE3vK+G3eQbLmzWI2t20nL65+a2lGY 45GzC5e249eGYWVG29SDNXf5zCD0CV9KeSp+6vQHxaOp8bhDU4e9gLE6NEvGvEPE MTgaMyHTvQwSCUYnDT+XO08snADEFGsvTPDG6YpX4qI8NRB7RwFLTg42HY3X4Sid sl2XTpe96J4j2jbgjnPsbaFBdLMebn643XN5xYfslNaieBtH7Bm8/t6zj5nZaAbc RMuCnMZRcLGvI8EikfOL =AxLC -----END PGP SIGNATURE----- --iu6NDqf1buB0UXm4Kpd4fiPiHQmUwqedQ--