Variable: org-latex-listings
org-latex-listings is an alias and customizable for
org-latex-src-block-backend, defined in org-compat.el.gz.
This variable is obsolete since 9.6; use org-latex-src-block-backend
instead.
Value
verbatim
Documentation
Backend used to generate source code listings.
This sets the behavior for fontifying source code, possibly even with
color. There are four implementations of this functionality you may
choose from (ordered from least to most capable):
1. Verbatim
2. Listings
3. Minted
4. Engraved
The first two options provide basic syntax highlighting (listings), or none at all (verbatim).
When using listings, you also need to make use of LaTeX package
"listings". The "color" LaTeX package is also needed if you
would like color too. These can simply be added to
org-latex-packages-alist, using customize or something like:
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "listings"))
(add-to-list 'org-latex-packages-alist '("" "color"))
There are two further options for more comprehensive fontification. The first can be set with,
(setq org-latex-src-block-backend 'minted)
which causes source code to be exported using the LaTeX package
minted as opposed to listings. If you want to use minted, you
need to add the minted package to org-latex-packages-alist, for
example using customize, or with
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("newfloat" "minted"))
In addition, it is necessary to install pygments
(URL https://pygments.org>), and to configure the variable
org-latex-pdf-process so that the -shell-escape option is
passed to pdflatex.
The minted choice has possible repercussions on the preview of
latex fragments (see org-preview-latex-fragment). If you run
into previewing problems, please consult
URL https://orgmode.org/worg/org-tutorials/org-latex-preview.html.
The most comprehensive option can be set with,
(setq org-latex-src-block-backend 'engraved)
which causes source code to be run through
engrave-faces-latex-buffer, which generates colorings using
Emacs's font-lock information. This requires the Emacs package
engrave-faces (available from GNU ELPA), and the LaTeX package
fvextra be installed.
The styling of the engraved result can be customized with
org-latex-engraved-preamble and org-latex-engraved-options.
The default preamble also uses the LaTeX package tcolorbox in
addition to fvextra.
Aliases
org-latex-listings (obsolete since 9.6)