Function: org-latex-src-block

org-latex-src-block is a byte-compiled function defined in ox-latex.el.gz.

Signature

(org-latex-src-block SRC-BLOCK CONTENTS INFO)

Documentation

Transcode a SRC-BLOCK element from Org to LaTeX.

CONTENTS holds the contents of the item. INFO is a plist holding contextual information.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
;;;; Src Block

(defun org-latex-src-block (src-block _contents info)
  "Transcode a SRC-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the item.  INFO is a plist holding
contextual information."
  (when (org-string-nw-p (org-element-property :value src-block))
    (let* ((lang (org-element-property :language src-block))
           (caption (org-element-property :caption src-block))
           (caption-above-p (org-latex--caption-above-p src-block info))
           (label (org-element-property :name src-block))
           (custom-env (and lang
                            (cadr (assq (intern lang)
                                        org-latex-custom-lang-environments))))
           (num-start (org-export-get-loc src-block info))
           (retain-labels (org-element-property :retain-labels src-block))
           (attributes (org-export-read-attribute :attr_latex src-block))
           (float (plist-get attributes :float)))
      (funcall
       (pcase (plist-get info :latex-src-block-backend)
         ((or `verbatim (guard (not lang))) #'org-latex-src-block--verbatim)
         (`minted #'org-latex-src-block--minted)
         (`engraved #'org-latex-src-block--engraved)
         (`listings #'org-latex-src-block--listings)
         ((guard custom-env) #'org-latex-src-block--custom)
         (oldval
          (message "Please update the LaTeX src-block-backend to %s"
                   (if oldval "listings" "verbatim"))
          (if oldval
              #'org-latex-src-block--listings
            #'org-latex-src-block--verbatim)))
       :src-block src-block
       :info info
       :lang lang
       :caption caption
       :caption-above-p caption-above-p
       :label label
       :num-start num-start
       :retain-labels retain-labels
       :attributes attributes
       :float float
       :custom-env custom-env))))