Site icon R-bloggers

highlight 0.2-5

[This article was first published on Romain Francois, Professional R Enthusiast, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I pushed highlight 0.2-5 on CRAN. This release improves the latex renderer and the sweave driver so that multiple lines character strings are properly rendered.

This example vignette shows it:

\documentclass[a4paper]{report}
\begin{document}

<<echo=FALSE,results=hide>>=
old.op <- options( prompt = " ", continue = " " )
@

<<>>=   
require( inline )
require( Rcpp )
convolve <- cxxfunction( 
    signature( a = "numeric", b = "numeric" ), '
    NumericVector xa(a); int n_xa = xa.size() ;
    NumericVector xb(b); int n_xb = xb.size() ;
    NumericVector xab(n_xa + n_xb - 1,0.0);
    
    Range r( 0, n_xb-1 );
    for(int i=0; i<n_xa; i++, r++){
        xab[ r ] += noNA(xa[i]) * noNA(xb) ;
    }
    return xab ;
', plugin = "Rcpp" )
convolve( 1:4, 1:5 )
@

<<echo=FALSE,results=hide>>=
options( old.op )
@

\end{document}

Once processed with Sweave, e.g. :

require( highlight )
driver <- HighlightWeaveLatex(boxes = TRUE)
Sweave( 'test.Rnw', driver = driver )
texi2dvi( 'test.tex', pdf = TRUE )

we get this result, embedded below with google viewer:

See this question on stack overflow for the tip of using google documents to display pdf files

To leave a comment for the author, please follow the link and comment on their blog: Romain Francois, Professional R Enthusiast.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.