Variable: org-latex-src-block-backend
org-latex-src-block-backend is a customizable variable defined in
ox-latex.el.gz.
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' 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.
This variable was added, or its default value changed, in Org version
9.6.
Aliases
org-latex-listings (obsolete since 9.6)
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
;; Src blocks
(defcustom org-latex-src-block-backend 'verbatim
"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' 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."
:group 'org-export-latex
:package-version '(Org . "9.6")
:type '(choice
(const :tag "Use listings" listings)
(const :tag "Use minted" minted)
(const :tag "Use engrave-faces-latex" engraved)
(const :tag "Export verbatim" verbatim))
:safe (lambda (s) (memq s '(listings minted engraved verbatim))))