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
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
http://okpanico,wordpress.com
http://algoland.wordpress.com
[-- Attachment #2: Type: text/html, Size: 9253 bytes --]
next 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
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 \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).