From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: interaction between org-latex-custom-lang-environments and name when exporting to latex Date: Wed, 25 Nov 2015 10:57:06 +0100 Message-ID: <87610qbdvx.fsf@gmx.us> References: <877fld3qcr.fsf@gmx.us> <8737vw1u13.fsf@gmx.us> <87vb8rbkum.fsf@gmx.us> 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]:40360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1Wp8-0004Kc-3D for emacs-orgmode@gnu.org; Wed, 25 Nov 2015 04:57:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1Wp3-0002ws-VN for emacs-orgmode@gnu.org; Wed, 25 Nov 2015 04:57:14 -0500 Received: from mout.gmx.net ([212.227.15.19]:60320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1Wp3-0002wf-LY for emacs-orgmode@gnu.org; Wed, 25 Nov 2015 04:57:09 -0500 In-Reply-To: (Alan Schmitt's message of "Wed, 25 Nov 2015 08:59:59 +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: alan.schmitt@polytechnique.org Cc: emacs-orgmode@gnu.org Hi Alan, Alan Schmitt writes: > Here is a patch that allows the use of a format string in > custom-lang-environments. Thanks. > * lisp/ox-latex.el (org-latex-custom-lang-environments): extend the > documentation string. Extend. You don=E2=80=99t need the lisp prefix. > * lisp/ox-latex.el (org-latex-src-block): allow a custom language > environment to be a format string to be directly inserted. Allow. > + %c for the formatted source > + %C for the caption > + %f for the float attribute > + %l for an appropriate label=20 it=E2=80=99s a bit sadistic to use %c and %C. Can=E2=80=99t the first be (= %s)ource-code? > +For example, >=20=20 > (setq org-latex-custom-lang-environments > - '((python \"pythoncode\"))) > + '((python \"pythoncode\") > + (ocaml \"\\\\begin{listing}\\n\\\\begin{minted}{ocaml}%c\\\\end{m= inted}\\n\\\\caption{%C}\\n\\\\label{%l}\"))) Minor: For the sake of making the ocaml block readable you could add the actual newlines instead of "\n". > would have the effect that if org encounters begin_src python A Python source block. > during latex export it will output LaTeX export it will produce, > \\begin{pythoncode} > > - \\end{pythoncode}") > + \\end{pythoncode} > + > +and if org encounters begin_src ocaml during latex export it will Likewise, if Org ... a Ocaml source block ... LaTeX=20 > +output , > + \\begin{listing} > + \\begin{minted}{ocaml} > + > + \\end{minted} > + \\caption{} > + \\label{