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, +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 +will produce + + \\begin{listing} + \\begin{minted}{ocaml} + + \\end{minted} + \\caption{} + \\label{