Next: , Previous: Plain lists in LaTeX export, Up: LaTeX export

12.10.8 Source blocks in LaTeX export

The LaTeX export back-end can make source code blocks into floating objects through the attributes :float and :options. For :float:

     #+ATTR_LATEX: :float nil
     #+BEGIN_SRC emacs-lisp
     Lisp code that may not fit in a single page.

The LaTeX export back-end passes string values in :options to LaTeX packages for customization of that specific source block. In the example below, the :options are set for Minted. Minted is a source code highlighting LaTeXpackage with many configurable options.

     #+ATTR_LATEX: :options commentstyle=\bfseries
     #+BEGIN_SRC emacs-lisp
       (defun Fib (n)
         (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))

To apply similar configuration options for all source blocks in a file, use the org-latex-listings-options and org-latex-minted-options variables.