SweaveListingPreparations {SweaveListingUtils} | R Documentation |
helping tool for writing the corresponding TeX preamble commands to integrate Sweave and package listings
SweaveListingPreparations(LineLength = 80, Rset = getSweaveListingOption("Rset"), Rdset = getSweaveListingOption("Rdset"), Rcolor = getSweaveListingOption("Rcolor"), Rbcolor = getSweaveListingOption("Rbcolor"), Rout = getSweaveListingOption("Rout"), Rcomment = getSweaveListingOption("Rcomment"), pkg = getSweaveListingOption("pkg"), pkv = getSweaveListingOption("pkv"), lib.loc = NULL)
LineLength |
numeric; defaults to 80 |
Rset |
list or taglist; defaults to global option "Rset" |
Rdset |
list or taglist; defaults to global option "Rdset" |
Rcolor |
numeric of length 3; defaults to global option "Rcolor" ;
rgb coordinates of the color in which to print R-code |
Rbcolor |
numeric of length 3; defaults to global option "Rbcolor" ;
rgb coordinates of the color in which to print R keywords
induced by intermediate packages. |
Rout |
numeric of length 3; defaults to global option "Rout" ;
rgb coordinates of the color in which to print R output |
Rcomment |
numeric of length 3; defaults to global option "Rcomment" ;
rgb coordinates of the color in which to print comments
in R-code |
pkg |
character; name of the packageto be described (e.g. in a vignette);
defaults to global option "pkg" |
pkv |
character; package version to be described (e.g. in a vignette);
defaults to global option "pkv" |
lib.loc |
location of a local library in which the described package resides |
SweaveListingPreparations
writes a corresponding preamble to the ‘.Rnw’-file for the simultaneous use
of Sweave and package listings; note that the lines
\usepackage{Sweave} \SweaveOpts{keep.source=TRUE}still have to appear in the ‘.Rnw’ file — before the corresponding
SweaveListingPreparations
-chunk.SweaveListingPreparations
sets colors,
requires TeX-package ‘listings’,
defines listings-settings for ‘.R’- and ‘.Rd’-code.
For ‘.Rd’ files it uses a new 'listings'-language definition file,
‘Rdlisting.sty’ to be found in subfolder ‘TeX’ in the
SweaveListingUtils package folder.
SweaveListingPreparations
is to be called in an ‘.Rnw’ file and
[re-]defines Sinput
,
Soutput
, Scode
environments for use with TeX-package ‘listings’,
defines commands \code
, \file
, \pkg
and sets
the corresponding package version.<< lstPreamble, results=tex, echo=FALSE>>= require(SweaveListingUtils) SweaveListingPreparations() @to insert the corresponding preamble parts to the produced TeX file.
require
or library
without adding extra arguments
to these commands (and hence displaying the actual R code),
you have to set up a global formatting matrix
.tobeDefinedPkgs
by setToBeDefinedPkgs
.
invisible()
Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de
SweaveListingPreparations() SweaveListingPreparations(pkv="2.1")