martes, 10 de mayo de 2011

latex code listings in org-mode

I already talked about inserting code listings in latex some time ago. At @work
(in a ruby meaning, not a perl one), I try to write as much as I can
in org, and then export it to html, or pdf.

org-mode is fully capable of assisting you when writing code listings,
and it will export them with fancy syntax highlighting. When exporting
to html, it uses htmlize (emacs-goodies if you're in ubuntu). But when
exporting to LaTeX, things are not so straightforward. Of course,
there's extensive documentation, but sometimes, you just don't want to
read through hundreds of details. You just want something that
'WorksForMe (c)'.

(setq org-export-latex-listings t)
(add-to-list 'org-export-latex-packages-alist '("" "listings"))
(add-to-list 'org-export-latex-packages-alist '("" "color"))


I don't know if it's enough or there's another configuration related
to this sunken in my .emacs (now 609 lines long), but you know... It
WorksForMe.