
Hi, 

highlight is pretty good, http://www.andre-simon.de/
this is what I have used to build this website: http://addictedtor.free.fr/graphiques/.

It generates latex code too. See this page as well to get it to work with R. http://www.yihui.name/en/read.php/6.htm

With a bit a processing, it is fairly easy to embed within a vignette. I am actually working (on the side) on a Sweave driver that would handle highlighting using highlight for which I would like to actually embed the C++ code of highlight within an R package (not been able yet to do it). If I fail, I might consider cook one from scratch by parse'ing R code and manipulate the results.
 
Cheers, 

Romain

--
Mango Solutions
data analysis that delivers
Tel: +44(0) 1249 767 700
Fax: +44(0) 1249 767 707
Mob: +44(0) 7813 526 123



-----Original Message-----
From: r-help-bounces@r-project.org on behalf of Duncan Murdoch
Sent: Sun 06/04/2008 18:50
To: Dirk Eddelbuettel
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] [OT] Typesetting / highlighting R code in Latex
 
On 06/04/2008 11:40 AM, Dirk Eddelbuettel wrote:
> Using Latex and the beamer class, I would like to highlight code snippets.
> Does anybody know a suitable 'preprocessor' or 'filter' for R (and/or C/C++)
> code ?
> 
> I have been including it in simple \begin{verbatim} ... \end{verbatim} and I
> know there is a better way -- in fact I saw it used a while back in some
> package I looked at.  And I didn't write that down...
> 
> What I am looking for is the basic equivalent of 'everything in verbatim'
> plus the ability to hightlight certain parts to stress the points I'd like to
> make.  
> 
> There must be something.  Pointers would be greatly appreciated!

Sweave uses the fancyvrb package, which allows quite a lot of 
customization.  I don't think it would be easy to use Sweave to apply 
different highlighting to different parts of R code, but you could use 
fancyvrb directly.

When combining Sweave and beamer, you need to remember the opening

\begin{frame}[containsverbatim]

but that's probably true for \begin{verbatim} too.

I've also used the listings package (not with beamer), but didn't stick 
with it, I think because I didn't like the default style and was too 
lazy to customize it.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


	[[alternative HTML version deleted]]

