Variable: org-latex-custom-lang-environments
org-latex-custom-lang-environments is a customizable variable defined
in ox-latex.el.gz.
Value
nil
Documentation
Alist mapping languages to language-specific LaTeX environments.
It is used during export of source blocks by the listings and minted LaTeX packages. The environment may 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
%o for the LaTeX attributes
For example,
(setq org-latex-custom-lang-environments
'((python "pythoncode")
(ocaml "\\\\begin{listing}
\\\\begin{minted}[%o]{ocaml}
%s\\\\end{minted}
\\\\caption{%c}
\\\\label{%l}")))
would have the effect that if Org encounters a Python source block during LaTeX export it will produce
\begin{pythoncode}
<source block body>
\end{pythoncode}
and if Org encounters an Ocaml source block during LaTeX export it will produce
\begin{listing}
\begin{minted}[<attr_latex options>]{ocaml}
<source block body>
\end{minted}
\caption{<caption>}
\label{<label>}
\end{listing}
This variable was added, or its default value changed, in Org version
9.0.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
(defcustom org-latex-custom-lang-environments nil
"Alist mapping languages to language-specific LaTeX environments.
It is used during export of source blocks by the listings and
minted LaTeX packages. The environment may 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
%o for the LaTeX attributes
For example,
(setq org-latex-custom-lang-environments
\\='((python \"pythoncode\")
(ocaml \"\\\\begin{listing}
\\\\begin{minted}[%o]{ocaml}
%s\\\\end{minted}
\\\\caption{%c}
\\\\label{%l}\")))
would have the effect that if Org encounters a Python source block
during LaTeX export it will produce
\\begin{pythoncode}
<source block body>
\\end{pythoncode}
and if Org encounters an Ocaml source block during LaTeX export it
will produce
\\begin{listing}
\\begin{minted}[<attr_latex options>]{ocaml}
<source block body>
\\end{minted}
\\caption{<caption>}
\\label{<label>}
\\end{listing}"
:group 'org-export-latex
:type '(repeat
(list
(symbol :tag "Language name ")
(string :tag "Environment name or format string")))
:version "26.1"
:package-version '(Org . "9.0"))