From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Re: Color of exported R code results using LaTeX listings Date: Fri, 17 Sep 2010 15:20:59 +0200 Message-ID: <4C936B3B.7040301@gmail.com> References: <1284708719.2732.28.camel@sduofa-desktop> <4C932002.6070105@gmail.com> <1284712131.2732.35.camel@sduofa-desktop> <87r5gszr99.fsf@mundaneum.com> <4C93312E.8040706@gmail.com> <1284729261.2821.13.camel@sduofa-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=40605 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwasF-0004aj-Kl for emacs-orgmode@gnu.org; Fri, 17 Sep 2010 09:21:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwasC-0004a9-54 for emacs-orgmode@gnu.org; Fri, 17 Sep 2010 09:21:07 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:36735) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwasB-0004Zr-R8 for emacs-orgmode@gnu.org; Fri, 17 Sep 2010 09:21:04 -0400 Received: by wwb24 with SMTP id 24so2753240wwb.30 for ; Fri, 17 Sep 2010 06:21:03 -0700 (PDT) In-Reply-To: <1284729261.2821.13.camel@sduofa-desktop> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Steven Delean Cc: wxhgmqzgwmuf@spammotel.com, emacs-orgmode@gnu.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 17/09/10 15:14, Steven Delean wrote: > Thanks very much Rainer and Sébastien for your comments and information. > > However, I am still unable to get color output for the _result_ of > evaluating R code blocks. > > #+source: Rcode > #+begin_src R :results output :exports both > x <- 1:5 > square <- function(x) { > x^2 > } > square(x) > #+end_src > > > ## below is the .tex code generated which results in fontified and > colored source code (code within lstlisting), but non-colored results > (within verbatim). > > \lstset{language=R} > > Rcode() $\equiv$ > \begin{lstlisting} > x <- 1:5 > square <- function(x) { > x^2 > } > square(x) > \end{lstlisting} > > \begin{verbatim} > [1] 1 4 9 16 25 > \end{verbatim} > > So the question is how to color the output of text within > \begin{verbatim} ...\end{verbatim} in an exported pdf (just a single > color is fine)? You could redefine the verbatim environment with \renewenvironment{verbatim}[args]{begdef}{enddef} http://www.personal.ceu.hu/tex/defs.htm http://en.wikibooks.org/wiki/LaTeX/Customizing_LaTeX If verbatim is only used for the results, nothing should go wrong. Cheers, Rainer > Thanks for your time, > Steve > > > On Fri, 2010-09-17 at 11:13 +0200, Rainer M Krug wrote: > On 17/09/10 10:52, Sébastien Vauban wrote: >>>> Hi Steven and Rainer, >>>> >>>> Steven Delean wrote: >>>>>> This is not an answer to your question, but rather a question to you: >>>>>> I added your settings to my .emacs file, and I get fontification in the >>>>>> pdf output, but no color. Do I need any additional settings to get >>>>>> coloring of the source code? >>>>> >>>>> Yes, you will need to provide arguments to the \lstset listings variable >>>> >>>> See http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28251.html for >>>> examples of pretty-printed code. > > Thanks - that looks really nice. Nice example. > > As I said in the other email, that should go to worg. > > Instead of > #+begin_LaTeX > #+end_LaTeX > > I use > > #+LATEX_HEADER: \lstset{ > #+LATEX_HEADER: keywordstyle=\color{blue}, > #+LATEX_HEADER: commentstyle=\color{red}, > #+LATEX_HEADER: stringstyle=\color{green}, > #+LATEX_HEADER: basicstyle=\ttfamily\small, > #+LATEX_HEADER: columns=fullflexible, > #+LATEX_HEADER: basewidth={0.5em,0.4em} > #+LATEX_HEADER: } > > And it also works. > > Cheers, > > Rainer > > >>>> >>>> Best regards, >>>> Seb >>>> > > >> _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel: +33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: Rainer@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyTazsACgkQoYgNqgF2egoqcQCfb5h49qQjF1zYI6F48x8d+6NZ MMoAnA7VoeD5W9Q7CB2ElUgs4S8kjAVF =gBaP -----END PGP SIGNATURE-----