From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giuseppe Lipari Subject: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)] Date: Sat, 11 Jan 2014 14:55:07 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013c71e4b9fba904efb230cc Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1z1w-00057b-UT for emacs-orgmode@gnu.org; Sat, 11 Jan 2014 08:55:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1z1o-0008Fp-W8 for emacs-orgmode@gnu.org; Sat, 11 Jan 2014 08:55:16 -0500 Received: from mail-oa0-x232.google.com ([2607:f8b0:4003:c02::232]:37571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1z1o-0008FN-NK for emacs-orgmode@gnu.org; Sat, 11 Jan 2014 08:55:08 -0500 Received: by mail-oa0-f50.google.com with SMTP id l6so6237192oag.37 for ; Sat, 11 Jan 2014 05:55:07 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --089e013c71e4b9fba904efb230cc Content-Type: text/plain; charset=ISO-8859-1 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 #include using namespace std; int main() { std::vector 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 "\\" 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 http://okpanico,wordpress.com http://algoland.wordpress.com --089e013c71e4b9fba904efb230cc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Remember to cover the basics, that is, what you expected t= o happen and
what in fact did happen.=A0 You don't know how to make = a good report?=A0 See

=A0=A0=A0=A0 http://orgmode.org/manual/Feedback.html#Feedbac= k

Your bug report will be posted to the Org-mode mailing list.
-------= -----------------------------------------------------------------

De= ar 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()
{
=A0=A0= =A0 std::vector<int> v =3D {1, 2, 3};

=A0=A0=A0 for (auto x : v) cout << x << ", ";
= =A0=A0=A0 cout << endl;
}
#+END_SRC

And these are the re= sults:

#+RESULTS: Example
: 1, 2, 3,

------------------
If I export this file to LaTeX everything works fine, and I see the c= ode
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 ":fla= gs -std=3Dc++11". Therefore, I
changed the header as follows:

------------------

#+BEGIN_SRC= cpp :flags -std=3Dc++11
...
#+END_SRC

---------------------
Now, when I press C-c-C-c, I the code is compiled and executed
cor= rectly. 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{mi= nted}[]{cpp"-std=3Dc++11"}
...
\end{minted}
------------= ---------

As you can see, the flags are wrongly copied after the language
spec= ification. Therefore, minted does not work and does not output the
code.=

I tried to put the :flags specification in the HEADERS, but it doe= s 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= =A0 : GNU Emacs 23.4.1 (i686-pc-linux-gnu, GTK+ Version 2.24.18)
=A0of 2013-06-17 on akateko, modified by Debian
Package: Org-mode versio= n 7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)

curr= ent state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(setq
=A0org= -export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)<= br> =A0org-export-latex-listings 'minted
=A0org-speed-command-hook '= (org-speed-command-default-hook org-babel-speed-command-hook)
=A0org-bab= el-load-languages '((dot) (emacs-lisp . t) (mscgen) (latex . t) (python= . t) (sh) (C . t))
=A0org-metaup-hook '(org-babel-load-in-session-maybe)
=A0org-after-t= odo-state-change-hook '(org-clock-out-if-current)
=A0org-babel-tangl= e-lang-exts '(("C++" . "cpp") ("python" .= "py") ("latex" . "tex")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 ("emacs-lisp" . &qu= ot;el"))
=A0org-export-latex-format-toc-function 'org-export-la= tex-format-toc-default
=A0org-latex-to-pdf-process '("pdflatex = -shell-escape -interaction nonstopmode -output-directory %o %f" "= pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f&quo= t; "pdflatex -shell-escape -interaction nonstopmode -output-directory = %o %f")
=A0org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-= command-maybe
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 org-babel-hide-result-= toggle-maybe org-babel-header-arg-expand)
=A0org-src-mode-hook '(org= -src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
=A0org-confirm-shell-link-function 'yes-or-no-p
=A0org-export-first-= hook '(org-beamer-initialize-open-trackers)
=A0org-agenda-before-wri= te-hook '(org-agenda-add-entry-text)
=A0org-export-latex-packages-al= ist '(("" "minted"))
=A0org-babel-pre-tangle-hook '(save-buffer)
=A0org-cycle-hook '(= org-cycle-hide-archived-subtrees org-cycle-hide-drawers
=A0=A0=A0 =A0=A0= =A0 =A0 org-cycle-show-empty-lines org-optimize-window-after-visibility-cha= nge)
=A0org-export-latex-classes '(("acm-proc" "\\doc= umentclass{acm_proc_article-sp}"
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\section{%s}" . &qu= ot;\\section*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 (&qu= ot;\\subsection{%s}" . "\\subsection*{%s}")
=A0=A0=A0 =A0= =A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\paragraph{%s}" . "\\paragr= aph*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subsubsection{%s}"= . "\\subsubsection*{%s}"))
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0= =A0=A0 ("article" "\\documentclass{article}"
=A0=A0= =A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\section{%s}" . "\\s= ection*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subsection{%s}" . = "\\subsection*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0= =A0 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\paragraph{%s}" . = "\\paragraph*{%s}"))
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 ("article" "\\docume= ntclass[11pt]{article}"
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 = ("\\section{%s}" . "\\section*{%s}")
=A0=A0=A0 =A0= =A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subsection{%s}" . "\\subse= ction*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subsubsection{%s}"= . "\\subsubsection*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0= =A0=A0=A0 ("\\paragraph{%s}" . "\\paragraph*{%s}")
= =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subparagraph{%s}" = . "\\subparagraph*{%s}"))
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 ("report" "\\documen= tclass[11pt]{report}"
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 (&= quot;\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}"= . "\\chapter*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0= =A0 ("\\section{%s}" . "\\section*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subsection{%s}" . = "\\subsection*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0= =A0 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 ("book" "\\documen= tclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}")=
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\chapter{%s}" . &qu= ot;\\chapter*{%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 (&qu= ot;\\section{%s}" . "\\section*{%s}")
=A0=A0=A0 =A0=A0=A0= =A0=A0=A0 =A0=A0=A0=A0 ("\\subsection{%s}" . "\\subsection*= {%s}")
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 ("\\subsubsection{%s}"= . "\\subsubsection*{%s}"))
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0= =A0=A0 ("beamer" "\\documentclass{beamer}" org-beamer-s= ectioning))
=A0org-export-preprocess-before-normalizing-links-hook '= (org-remove-file-link-modifiers)
=A0org-export-latex-hyperref-format "\\ref{%s}"
=A0org-mode-ho= ok '(#[nil "\300\301\302\303\304$\207"
=A0=A0=A0 =A0=A0=A0= =A0=A0 [org-add-hook change-major-mode-hook org-show-block-all append loca= l] 5]
=A0=A0=A0 =A0=A0=A0 =A0#[nil "\300\301\302\303\304$\207"=
=A0=A0=A0 =A0=A0=A0 =A0=A0 [org-add-hook change-major-mode-hook org-babel-s= how-result-all append local] 5]
=A0=A0=A0 =A0=A0=A0 =A0org-babel-result-= hide-spec org-babel-hide-all-hashes)
=A0org-ctrl-c-ctrl-c-hook '(org= -babel-hash-at-point org-babel-execute-safely-maybe)
=A0org-confirm-elisp-link-function 'yes-or-no-p
=A0org-export-interb= locks '((src org-babel-exp-non-block-elements))
=A0org-clock-out-hoo= k '(org-clock-remove-empty-clock-drawer)
=A0org-occur-hook '(org= -first-headline-recenter)
=A0org-from-is-user-regexp "\\<Giuseppe Lipari\\>"
=A0or= g-export-preprocess-before-selecting-backend-code-hook '(org-beamer-sel= ect-beamer-code)
=A0org-confirm-babel-evaluate nil
=A0org-export-late= x-final-hook '(org-beamer-amend-header org-beamer-fix-toc
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0=A0 org-beamer-auto-fragile-fr= ames
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0=A0 org-beamer-place-d= efault-actions-for-lists)
=A0org-metadown-hook '(org-babel-pop-to-se= ssion-maybe)
=A0org-export-blocks '((src org-babel-exp-src-block nil= )
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 (export-comment org-export-blocks-format-c= omment t)
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 (ditaa org-export-blocks-form= at-ditaa nil)
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 (dot org-export-blocks-fo= rmat-dot nil))
=A0)


--
Giuseppe Lipari
RETIS Lab, CEIIC
Scuola Superiore Sant'Anna
via Moruzzi, 1
561= 27 Pisa
tel:=A0=A0 050 882030
fax:=A0 050 882003
web: http://feanor.sssup.it/~l= ipari/
blogs: htt= p://scacciamennule.blogspot.com
=A0=A0 =A0 =A0 =A0 =A0http://okpanico,wordpress.com=A0
=A0=A0 =A0 =A0 =A0 =A0http://algoland.wordpress.com
--089e013c71e4b9fba904efb230cc--