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: Fri, 27 Nov 2015 22:05:33 +0100 Message-ID: <87h9k740gy.fsf@gmx.us> References: <877fld3qcr.fsf@gmx.us> <8737vw1u13.fsf@gmx.us> <87vb8rbkum.fsf@gmx.us> <87610qbdvx.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2QDK-0003r0-O8 for emacs-orgmode@gnu.org; Fri, 27 Nov 2015 16:05:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2QDF-0006Cb-GF for emacs-orgmode@gnu.org; Fri, 27 Nov 2015 16:05:54 -0500 Received: from plane.gmane.org ([80.91.229.3]:33345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2QDF-0006CH-6k for emacs-orgmode@gnu.org; Fri, 27 Nov 2015 16:05:49 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a2QD8-0001bZ-BO for emacs-orgmode@gnu.org; Fri, 27 Nov 2015 22:05:42 +0100 Received: from tsn109-201-154-210.dyn.nltelcom.net ([109.201.154.210]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Nov 2015 22:05:42 +0100 Received: from rasmus by tsn109-201-154-210.dyn.nltelcom.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Nov 2015 22:05:42 +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: emacs-orgmode@gnu.org Hi Alan, Alan Schmitt writes: >> Nitpick: label should be inside caption in the example to be consistent >> with how captions are normally formatted by ox-latex. Either way is fine >> though. > > I chose this example because it's the code in the minted manual. As you prefer. >> Also, you need to denote that the defcustom was changed. >> >> :version "25.1" >> :package-version '(Org . "9.0") >> >> When you are at it, please add the missing tags, :group and :type. > > It's not a defcustom but a defvar. (But maybe it should be a defcustom …) It should be a defcustom. Feel free to fix it, preferably in a separate patch. 11.5 Defining Global Variables A [defvar/defconst] definition is a construct that announces your intention to use a symbol as a global variable. ... To define a customizable variable, you should use defcustom (which calls defvar as a subroutine). See Variable Definitions. > From 527635c2e674fe1f3ab9d5d3de96e238d0debf7b 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 > > * ox-latex.el (org-latex-custom-lang-environments): Extend the > documentation string. > * ox-latex.el (org-latex-src-block): Allow a custom language environment > to be a format string to be directly inserted. > --- > lisp/ox-latex.el | 58 ++++++++++++++++++++++++++++++++++++++++++++------------ > 1 file changed, 46 insertions(+), 12 deletions(-) > > diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el > index bbf7f41..0a9f7d4 100644 > --- a/lisp/ox-latex.el > +++ b/lisp/ox-latex.el > @@ -1025,17 +1025,44 @@ block-specific options, you may use the following syntax: > "Alist mapping languages to language-specific LaTeX environments. > > It is used during export of src blocks by the listings and minted > -latex packages. For example, > +latex packages. The environment may either be a simple string, You don’t need the ’either’ IMO, but as you please. > +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: > + > + %s for the formatted source > + %c for the caption > + %f for the float attribute > + %l for an appropriate label > + > +For example, > > (setq org-latex-custom-lang-environments > - '((python \"pythoncode\"))) > + '((python \"pythoncode\") > + (ocaml \"\\\\begin{listing} > +\\\\begin{minted}{ocaml} > +%s\\\\end{minted} > +\\\\caption{%c} > +\\\\label{%l}\"))) > > -would have the effect that if org encounters begin_src python > -during latex export it will output > +would have the effect that if org encounters a Python source block > +during LaTeX export it will produce > > \\begin{pythoncode} > > - \\end{pythoncode}") > + \\end{pythoncode} > + > +and if org encounters an Ocaml source block during LaTeX export it Org. Perhaps the ’and’ should be capitalized. I don’t know. The rest looks good to me. Feel free to push (modulus someone else saying otherwise). Thanks, Rasmus -- m-mm-mmm-mmmm bacon!