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: Wed, 25 Nov 2015 08:59:59 +0100 Message-ID: References: <877fld3qcr.fsf@gmx.us> <8737vw1u13.fsf@gmx.us> <87vb8rbkum.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]:54208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VtF-0005fh-Fd for emacs-orgmode@gnu.org; Wed, 25 Nov 2015 03:57:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1VtA-0002ro-Fc for emacs-orgmode@gnu.org; Wed, 25 Nov 2015 03:57:25 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:36796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1VtA-0002ri-3w for emacs-orgmode@gnu.org; Wed, 25 Nov 2015 03:57:20 -0500 In-Reply-To: <87vb8rbkum.fsf@gmx.us> (rasmus@gmx.us's message of "Tue, 24 Nov 2015 14:14:25 +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: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hello, Here is a patch that allows the use of a format string in custom-lang-environments. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-latex-Extend-custom-lang-environments.patch Content-Transfer-Encoding: quoted-printable From=20e4731375eaf622df0187d47d949fb9f4e53330be Mon Sep 17 00:00:00 2001 From: Alan Schmitt Date: Wed, 25 Nov 2015 08:48:58 +0100 Subject: [PATCH] ox-latex: Extend custom-lang-environments * lisp/ox-latex.el (org-latex-custom-lang-environments): extend the documentation string. * lisp/ox-latex.el (org-latex-src-block): allow a custom language environment to be a format string to be directly inserted. =2D-- lisp/ox-latex.el | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index bbf7f41..1b0bff5 100644 =2D-- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1025,17 +1025,40 @@ block-specific options, you may use the following s= yntax: "Alist mapping languages to language-specific LaTeX environments. =20 It is used during export of src blocks by the listings and minted =2Dlatex packages. For example, +latex packages. The environment may either be a simple string, +composed of only letters and numbers. In this case, the string is +directly the name of the latex environment to use. The environment +may also be a format string. In this case the format string will be +directly exported. This format string may contain these elements: + + %c for the formatted source + %C for the caption + %f for the float attribute + %l for an appropriate label=20 + +For example, =20 (setq org-latex-custom-lang-environments =2D '((python \"pythoncode\"))) + '((python \"pythoncode\") + (ocaml \"\\\\begin{listing}\\n\\\\begin{minted}{ocaml}%c\\\\end{min= ted}\\n\\\\caption{%C}\\n\\\\label{%l}\"))) =20 would have the effect that if org encounters begin_src python during latex export it will output =20 \\begin{pythoncode} =2D \\end{pythoncode}") + \\end{pythoncode} + +and if org encounters begin_src ocaml during latex export it will +output + + \\begin{listing} + \\begin{minted}{ocaml} + + \\end{minted} + \\caption{} + \\label{