[R] inserting R code in a latex document

Thibaut Jombart jombart at biomserv.univ-lyon1.fr
Wed May 11 01:27:11 CEST 2005


I'm trying to insert R source code (functions) in an appendix of a latex 
document. I guess the easiest way to do so is to use the package Sweaved 
(file : Sweaved.sty) provided with the latest R version. Latex succeeds 
in loading the package, but my problem comes from the use of this very 
package. I tried to use the 'Schunk' environment, but '#' characters 
generate error (my R functions are annotated, and I want to keep those 
annotations). Under the 'Sinput' environment, no error is generated but 
the result is simply not different from what would be obtained under 
'verbatim' environment : R code lines are cut as they don't fit in the 
page width.

I tried to find answers in the latest Sweaved User Manual, 
unsuccessfully. I'm a recent latex user and I doubt I can quickly find a 
solution by myself.

Thibaut Jombart

More information about the R-help mailing list