I'm running Orgmode 8.2.10 with emacs 24.4 on a Win 7 machine.
I've installed python, pygment and minted and added the following code to my .emacs
file:
(setq org-export-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
For some unknown reason, when exporting to latex (and consequently to pdf), the minted pkg is loaded in the preamble of the tex file but in the body of that same tex file pkg listings
and its corresponding cmds are used. As a result the final pdf shows no formatting of, say, a short python code-block enclosed in #+BEGIN_SRC
and #+END_SRC
in the org file.
I know minted
works because if I manually correct the tex file and recompile it with pdflatex it yields the code block correctly.
Why isn't the latex export of the org-file using the minted
command/environment in the body of the document?
EDIT 1
I managed somehow to set minted
not listings
as the go-to package that handles code blocks enclosed within #+BEGIN_SRC
and #+END_SRC
in an *.org file. I did that by using the GUI of emacs not the .emacs
conf file (will study that file at a later moment). Menu Org > Customize > Browse Org Group then patiently finding the Group Org Export
> LaTeX
> LaTeX Listings
and setting this variable to minted
instead of leaving it as listings
. Saved for future sessions, and clicked Apply and Save. I see I can set Options (such as background color of code) under Org Latex Minted Options
. Here's a screenshot:
org-latex-listings
- maybe it changed names as far back as 8.2.10, so try that.\lstset{language=Python,label= ,caption= ,numbers=none} \begin{lstlisting} print "Jack and Jill went up a hill" \end{lstlisting} % Emacs 24.4.1 (Org mode 8.2.10)
(setq org-latex-listings 'minted)
.emacs
file the following:(setq org-latex-listings 'minted org-latex-packages-alist '(("" "minted")) org-latex-pdf-process '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
. Noticeexport
is no more, double parentheses wrap up everything.C-h v org-latex-listings RET
and see what the value is. In any case, with a minimal .emacs (with the org-latex-listings version of the setq form above) on my Fedora 24 system and doingemacs -q -l /path/to/minimal.emacs
I get minted all the way through.