Next: , Previous: , Up: LaTeX Export   [Contents][Index]


13.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’:

t

Makes a source block float; by default floats any source block with a caption.

multicolumn

Spans the source block across multiple columns of a page.

nil

Avoids a ‘:float’ even if using a caption; useful for source code blocks that may not fit on a page.

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

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 LaTeX package 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)))))
#+END_SRC

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