Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
http://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------
Dear all,
I have a problem with org-babel and the export of C++11 code to LaTeX.
I report below a simple example of a problem file:
---------------------
#+TITLE: CPP example
#+LaTeX_HEADER: \usepackage{minted}
#+LaTeX_HEADER: \usemintedstyle{emacs}
* Example of c++11
An example of c++11
#+HEADERS: :results output :exports both
#+name: Example
#+BEGIN_SRC cpp
#include <vector>
#include <iostream>
using namespace std;
int main()
{
std::vector<int> v = {1, 2, 3};
for (auto x : v) cout << x << ", ";
cout << endl;
}
#+END_SRC
And these are the results:
#+RESULTS: Example
: 1, 2, 3,
------------------
If I export this file to LaTeX everything works fine, and I see the code
nicely formatter in the pdf file. Unfortunately, when I try to compile and execute the
code with C-c-C-c, I get an error: in facts, to compile the code above according to
the c++11 standard, I need to specify ":flags -std=c++11". Therefore, I
changed the header as follows:
------------------
#+BEGIN_SRC cpp :flags -std=c++11
...
#+END_SRC
---------------------
Now, when I press C-c-C-c, I the code is compiled and executed
correctly. However, I get another problem: when exporting to LaTeX,
the code disappears from the pdf file. By looking at the generated .tex
file, I see the following lines:
---------------------
\begin{minted}[]{cpp"-std=c++11"}
...
\end{minted}
---------------------
As you can see, the flags are wrongly copied after the language
specification. Therefore, minted does not work and does not output the
code.
I tried to put the :flags specification in the HEADERS, but it does not
work (fails for compile).
Also, the results do not appear in the pdf file, even by specifying
":exports both".
Any clue of what it is going on?
Best
Giuseppe Lipari
Emacs : GNU Emacs 23.4.1 (i686-pc-linux-gnu, GTK+ Version 2.24.18)
of 2013-06-17 on akateko, modified by Debian
Package: Org-mode version 7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)
current state:
==============
(setq
org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
org-export-latex-listings 'minted
org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
org-babel-load-languages '((dot) (emacs-lisp . t) (mscgen) (latex . t) (python . t) (sh) (C . t))
org-metaup-hook '(org-babel-load-in-session-maybe)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-babel-tangle-lang-exts '(("C++" . "cpp") ("python" . "py") ("latex" . "tex")
("emacs-lisp" . "el"))
org-export-latex-format-toc-function 'org-export-latex-format-toc-default
org-latex-to-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")
org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-confirm-shell-link-function 'yes-or-no-p
org-export-first-hook '(org-beamer-initialize-open-trackers)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-export-latex-packages-alist '(("" "minted"))
org-babel-pre-tangle-hook '(save-buffer)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
org-export-latex-classes '(("acm-proc" "\\documentclass{acm_proc_article-sp}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("article" "\\documentclass{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}"))
("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("beamer" "\\documentclass{beamer}" org-beamer-sectioning))
org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers)
org-export-latex-hyperref-format "\\ref{%s}"
org-mode-hook '(#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-export-interblocks '((src org-babel-exp-non-block-elements))
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-occur-hook '(org-first-headline-recenter)
org-from-is-user-regexp "\\<Giuseppe Lipari\\>"
org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code)
org-confirm-babel-evaluate nil
org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
org-beamer-auto-fragile-frames
org-beamer-place-default-actions-for-lists)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-export-blocks '((src org-babel-exp-src-block nil)
(export-comment org-export-blocks-format-comment t)
(ditaa org-export-blocks-format-ditaa nil)
(dot org-export-blocks-format-dot nil))
)
--
Giuseppe Lipari
RETIS Lab, CEIIC
Scuola Superiore Sant'Anna
via Moruzzi, 1
56127 Pisa
tel: 050 882030
fax: 050 882003
web: http://feanor.sssup.it/~lipari/
blogs: http://scacciamennule.blogspot.com