emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Hannes Schulz <boiling.complex.9253826@gmail.com>
To: emacs-orgmode@gnu.org
Subject: minted/lstlistings code block export when using :flags
Date: Thu, 11 Apr 2013 10:16:46 +0200	[thread overview]
Message-ID: <CAJJwqQvC6Q4i5pATJdh7OoVwf+qGHNU2g+pxtxWS+YAjQ-Anbw@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2013-04-11  8:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAJJwqQvC6Q4i5pATJdh7OoVwf+qGHNU2g+pxtxWS+YAjQ-Anbw@mail.gmail.com \
    --to=boiling.complex.9253826@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).