emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Color of exported R code results using LaTeX listings


From: Sébastien Vauban
Subject: [Orgmode] Re: Color of exported R code results using LaTeX listings
Date: Sat, 18 Sep 2010 09:10:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi Steven,

Steven Delean wrote:
> Thanks again for all your assistance. I was not able to achieve the results
> I was after exactly using any proposed solutions, but have found a way
> forward and outline my solution below in case it benefits others.
>
> The following allows fontification and syntax highlighting for source code
> and a single color for exported output, and works both for latex documents
> and beamer slides.
> NB: A single color for source code in exported documents can be acheived by
> adding e.g. \color{blue} to basicstyle.
>
> 1. The following must appear in your .emacs
> (require 'org-latex)
> (setq org-export-latex-listings t)
> (add-to-list 'org-export-latex-packages-alist '("" "listings"))
> (add-to-list 'org-export-latex-packages-alist '("" "color"))
>
> 2. Add the following to your .org document header to allow colors and
> 'nice' font
> #+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:         }
>
> 3. Also add the following to your .org document header to allow the
> output results of evaluating R (or other language) code to be in color
> #+LATEX_HEADER: \RequirePackage{fancyvrb}
> #+LATEX_HEADER: \DefineVerbatimEnvironment{verbatim}{Verbatim}{fontsize=
> \small,formatcom = {\color[rgb]{0.5,0,0}}}

What about if your results block is an Org table, instead of verbatim?

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

[Prev in Thread] Current Thread [Next in Thread]