From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Schulz Subject: minted/lstlistings code block export when using :flags Date: Thu, 11 Apr 2013 10:16:46 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c22fa286c4bf04da116907 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQCh1-0000F3-3r for emacs-orgmode@gnu.org; Thu, 11 Apr 2013 04:17:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQCgu-0000qd-LG for emacs-orgmode@gnu.org; Thu, 11 Apr 2013 04:17:15 -0400 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]:48380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQCgu-0000qD-9j for emacs-orgmode@gnu.org; Thu, 11 Apr 2013 04:17:08 -0400 Received: by mail-la0-f41.google.com with SMTP id er20so1227692lab.14 for ; Thu, 11 Apr 2013 01:17:06 -0700 (PDT) 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 --001a11c22fa286c4bf04da116907 Content-Type: text/plain; charset=UTF-8 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 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 int main(int argc, char** argv){ std::cout << "Hello World" << std::endl; } #+end_src #+RESULTS: : Hello World ==================== snap ======================= --001a11c22fa286c4bf04da116907 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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:
<= div style>
\begin{minted}[]{cpp"-L/usr/local/= cuda/lib"} =C2=A0 % <-- HERE
#include <iostream>
int main(int argc, char** argv){
=C2=A0 =C2=A0 =C2=A0std::cout << "Hello World" <= ;< std::endl;
}
\end{minted}

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

2) Not sure if anyone else has this i= ssue, but for linking a c++ file with g++, I need to specify the linker lib= raries 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.
<= div style>
yours,

= =C2=A0 Hannes


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

* Test
#+begin_src cpp :exports code :flags "-L/usr/lib -lcblas"
=C2=A0 #include <iostream>
=C2=A0=C2=A0
= =C2=A0 int main(int argc, char** argv){
=C2=A0 =C2=A0 =C2=A0 =C2= =A0std::cout << "Hello World" << std::endl;
=C2=A0 }
#+end_src

#+RESULTS:
=
: Hello World
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D snap =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D
--001a11c22fa286c4bf04da116907--