4 replaced http://stackoverflow.com/ with https://stackoverflow.com/
source | link

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

Addition: For minted, I get a satisfying result when using the following .emacs (using information from http://stackoverflow.com/a/21007117/6024971https://stackoverflow.com/a/21007117/6024971):

(require 'org)
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted) 

(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

(setq org-src-fontify-natively t)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (latex . t)))

Note, the triple call to pdflatex is to get all the references (including TOC) in the document right.

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

Addition: For minted, I get a satisfying result when using the following .emacs (using information from http://stackoverflow.com/a/21007117/6024971):

(require 'org)
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted) 

(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

(setq org-src-fontify-natively t)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (latex . t)))

Note, the triple call to pdflatex is to get all the references (including TOC) in the document right.

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

Addition: For minted, I get a satisfying result when using the following .emacs (using information from https://stackoverflow.com/a/21007117/6024971):

(require 'org)
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted) 

(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

(setq org-src-fontify-natively t)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (latex . t)))

Note, the triple call to pdflatex is to get all the references (including TOC) in the document right.

3 Added working setup for minted.
source | link

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

Addition: For minted, I get a satisfying result when using the following .emacs (using information from http://stackoverflow.com/a/21007117/6024971):

(require 'org)
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted) 

(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

(setq org-src-fontify-natively t)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (latex . t)))

Note, the triple call to pdflatex is to get all the references (including TOC) in the document right.

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

Addition: For minted, I get a satisfying result when using the following .emacs (using information from http://stackoverflow.com/a/21007117/6024971):

(require 'org)
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted) 

(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

(setq org-src-fontify-natively t)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (latex . t)))

Note, the triple call to pdflatex is to get all the references (including TOC) in the document right.

2 updated way to add listings package. This probably changed for Org 8.0.
source | link

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(setqadd-to-list org'org-latex-listingspackages-alist t'("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

You have to tell org-mode to actually use the listings package in your .emacs:

(setq org-latex-listings t)

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

You have to tell org-mode to actually use the listings or listingsutf8 package in your .emacs:

(add-to-list 'org-latex-packages-alist '("" "listingsutf8"))

Then you'll have a line

\usepackage{listings}

in the exported TeX file and the pdfLaTeX run will give you the result you want to have.

1
source | link