Emacs is exporting listings blocks (i.e. #+BEGIN_SRC <lang>) in a strange, incorrect way. Here's an example of what I mean with a simple org file:

var dog = "dog!"

dog <- "dog!"

Here is the output LaTeX:

% Created 2014-12-15
  pdfcreator={Emacs 24.3.1 (Org mode 8.2.7c)}}


var,label= ,caption= ,numbers=none}
var dog = "dog!"

dog,label= ,caption= ,numbers=none}
dog <- "dog!"
% Emacs 24.3.1 (Org mode 8.2.7c)

The \lstset lines are messed up: they have an extra new line, and they repeat the first word given after language.

Here are the relevant lines from the (custom-set-variables section of my dotfile:

 '(org-latex-listings t)
 '(org-latex-listings-langs (quote ((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp") (c "C") (cc "C++") (fortran "fortran") (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby") (html "HTML") (xml "XML") (tex "TeX") (latex "[LaTeX]TeX") (shell-script "bash") (gnuplot "Gnuplot") (ocaml "Caml") (caml "Caml") (sql "SQL") (sqlite "sql") (R-mode "R"))))

 '(org-export-latex-listings t)
 '(org-export-latex-listings-langs (quote ((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp") (c "C") (cc "C++") (fortran "fortran") (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby") (html "HTML") (xml "XML") (tex "TeX") (latex "TeX") (shell-script "bash") (gnuplot "Gnuplot") (ocaml "Caml") (caml "Caml") (sql "SQL") (sqlite "sql") (R-mode "R"))))

This also seems to occur if the above listings options are removed and org-export-latex-listings is set to minted:

pdfcreator={Emacs 24.3.1 (Org mode 8.2.10)}}


var dog = "dog!"

dog <- "dog!"
% Emacs 24.3.1 (Org mode 8.2.10)
  • 1
    I cannot reproduce this, so most likely your Emacs configuration is to blame. Try exporting the same document to LaTeX in emacs -Q (after setting org-latex-listings to t) and see if the result is different. (It works for me with Org 8.2.10 and Emacs 24.4.1.) If it does work, try bisecting your init file as described elsewhere on this site. Dec 16, 2014 at 2:15
  • Bisecting my init file! That'll at least cut it to O(log(n))! Dec 16, 2014 at 10:31

1 Answer 1


I solved by upgrading to 24.4 and building from source. Upgrading Org alone was not enough.

I also noted that the problem went away when downgrading to the built-in Org for 24, which was 7.9.3, but that version is too low to work with now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.