emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Giuseppe Lipari <giulipari@gmail.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <CABHo5SAxQ2YnRtqZ37td_DgLXiLKT_2P=YtiMzvyv3+hvqxLPA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7279 bytes --]

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


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
#include <vector>
#include <iostream>

using namespace std;
int main()
    std::vector<int> v = {1, 2, 3};

    for (auto x : v) cout << x << ", ";
    cout << endl;

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


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:


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

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?


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 @

current state:
 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-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" .
                  ("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-mode-hook '(org-src-babel-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-export-latex-classes '(("acm-proc"
                 ("\\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}" .
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
                ("book" "\\documentclass[11pt]{book}" ("\\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-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-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-confirm-babel-evaluate nil
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
 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
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

[-- Attachment #2: Type: text/html, Size: 9253 bytes --]

             reply	other threads:[~2014-01-11 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-11 13:55 Giuseppe Lipari [this message]
2014-01-19 16:02 ` 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/)] Bastien
2014-01-20  9:35   ` Giuseppe Lipari
2014-01-20 13:13     ` Nicolas Goaziou
2014-01-20 13:17       ` Nicolas Goaziou
2014-01-20 13:22         ` Nicolas Goaziou
2014-01-20 13:41           ` Giuseppe Lipari
2014-01-20 15:26           ` Eric Schulte
2014-01-20 16:18             ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABHo5SAxQ2YnRtqZ37td_DgLXiLKT_2P=YtiMzvyv3+hvqxLPA@mail.gmail.com' \
    --to=giulipari@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).