emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* minted/lstlistings code block export when using :flags
@ 2013-04-11  8:16 Hannes Schulz
  0 siblings, 0 replies; only message in thread
From: Hannes Schulz @ 2013-04-11  8:16 UTC (permalink / raw)
  To: emacs-orgmode

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

Dear list,

I have some trouble with my C++ code blocks, and exporting them to LaTeX.
My version is current git HEAD.

There are two issues:

1) LaTeX Export: For some reason, the babel language name gets parts of the
compiler :flags mixed in, resulting in bad LaTeX code such as this:

\begin{minted}[]{cpp"-L/usr/local/cuda/lib"}   % <-- HERE
#include <iostream>
int main(int argc, char** argv){
     std::cout << "Hello World" << std::endl;
}
\end{minted}

This behavior is the same for lstlistings and minted type, but (obviously)
does not affect verbatim.

2) Not sure if anyone else has this issue, but for linking a c++ file with
g++, I need to specify the linker libraries AFTER the cpp file I'm trying
to compile. For me, this could be resolved by switching the order of the
arguments to (format...) in ob-C.el. Is there any reason why the order is
as it is?

A minimal example is included below.

yours,

  Hannes



==================== snip =======================
#+TITLE:     Test
#+LaTeX_HEADER: \usepackage{minted}
#+LaTeX_HEADER: \usemintedstyle{borland}
#+latex_header: \usepackage{color}
#+latex_header: \renewcommand{\maketitle}{}
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:
http://orgmode.org/org-info.js
#+LaTeX_CLASS: article
#+LaTeX_CLASS_OPTIONS: [english,final]
#+begin_src emacs-lisp :exports none :results silent
  ; work with minted
  (setq org-latex-listings 'minted)
#+end_src

* Test

#+begin_src cpp :exports code :flags "-L/usr/lib -lcblas"
  #include <iostream>

  int main(int argc, char** argv){
       std::cout << "Hello World" << std::endl;
  }
#+end_src

#+RESULTS:
: Hello World
==================== snap =======================

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-11  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11  8:16 minted/lstlistings code block export when using :flags Hannes Schulz

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).