Next: Example blocks in LaTeX export, Previous: Plain lists in LaTeX export, Up: LaTeX Export [Contents][Index]
The LaTeX export back-end can make source code blocks into floating objects through the attributes ‘:float’ and ‘:options’. For ‘:float’:
Makes a source block float; by default floats any source block with a caption.
Spans the source block across multiple columns of a page.
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.