From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: interaction between org-latex-custom-lang-environments and name when exporting to latex Date: Tue, 24 Nov 2015 09:07:12 +0100 Message-ID: References: <877fld3qcr.fsf@gmx.us> <8737vw1u13.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a18dC-0003cI-TX for emacs-orgmode@gnu.org; Tue, 24 Nov 2015 03:07:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a18d7-0005Lj-Sn for emacs-orgmode@gnu.org; Tue, 24 Nov 2015 03:07:18 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:15038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a18d7-0005Le-M4 for emacs-orgmode@gnu.org; Tue, 24 Nov 2015 03:07:13 -0500 In-Reply-To: <8737vw1u13.fsf@gmx.us> (rasmus@gmx.us's message of "Mon, 23 Nov 2015 18:54:00 +0100") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Rasmus, On 2015-11-23 18:54, Rasmus writes: > Hi Alan, > > Alan Schmitt writes: > >> What I propose is to have either a string or a function in >> `org-latex-custom-lang-environments'. A string would be used as it is >> currently, whereas a function would be applied. Here is what it could >> look like: > > I think a format-string is fine, though I don=E2=80=99t oppose allowing a= function > as well. I don=E2=80=99t foresee a great necessity of the latter, though. > > I'd use format-spec. E.g. here=E2=80=99s how hyperref is filled > > (let ((template (plist-get info :latex-hyperref-template))) > (and (stringp template) > (format-spec template (org-latex--format-spec info)))) I did not know about `format-spec', it's really nice! > Then the cdr of an element in org-latex-custom-lang-environments can be > something like: > > \begin{%e}[label=3D%l, myfunkyoption=3Dval] > %c > \end{%e} What would "%e" be bound to? Since this is a customization for a given source block, it should be fixed, so I think we only need "%l" and "%c". > The only downside is that you=E2=80=99d have to somehow discriminate betw= een the > "old" case where the cdr is a single word denoting an environment. > Something like this might work: > > (string-match-p "\\`\\w+\\'" "hest1") This was the main reason why I did not want to go that route. This said, after understanding this regexp, I see how I can explain how the two cases are distinguished in the docstring. >> My main design question is what the arguments to the function should be. >> I thought the formatted source code and label would work, but I'm >> wondering if it may be better to simply give the `src-block' and `info' >> arguments directly. > > Well, functions would be user written. In general I=E2=80=99d favor info= and > src-block, but I don=E2=80=99t think it=E2=80=99s very user-friendly, as = it requires quite > some knowledge about how ox works. Also, when using such functions, the > user would have to write a lot of boilerplate to get e.g . the label. Yes. I'll give the template string a try and will report back. Thanks, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Athmospheric CO=E2=82=82 (Updated November 22, 2015, Mauna Loa Obs.): 400.3= 5 ppm --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJWVBqwAAoJEAQNCjtO0uXH6owH/iMwb3zLsQaF7qDYF+Svt51L N23ZqcOzVj2UuEmEgU8re4P32S2fv27BKllgQAy6s3BoU0LpyrRssPmTCQTQ0lLv LuAyDokxcBIZEOlY2339hnlKJeUIUrHZHrr+UuxMVrCxUMU+JPAyp/LwhM6oQjBF 76vo1YpAvy0lSqu+2uqAG2c4llbJxLnEInB3OXeUmHWswsMVRna66dV72FyBBR4d PS67FiSRn0pnV5yEGGJKLnps8M7VtI7HasmsD5TKWQO6C4PGAKNQ4xq/zQJz+UWM 15ivC455RsOAlHoG9O/djmmf8vWV7ihoIS1qQCBWyRPMg53QK/fz82qv9h3Ji5Q= =+Oqx -----END PGP SIGNATURE----- --=-=-=--