[R-pkgs] SweaveListingUtils --- a package for joining markup provided by TeX package 'listings' with Sweave

Peter Ruckdeschel peter.ruckdeschel at web.de
Thu Jul 2 11:17:47 CEST 2009


As indicated in some off-list mail by Frank E. Harrell Jr.,
the announcement of the availability of package

%---------------------------------------------
SweaveListingUtils
%---------------------------------------------

on CRAN, mingled into mail "New versions for the distr-family of
packages" to R-pkgs from 21 Apr 2009, will probably have gone
unnoticed by some people who might be interested in this package.

Briefly, SweaveListingUtils provides utilities to make accessible
the markup commands provided by TeX package 'listings' (Heinz and Moses
(2007)) for use with Sweave (confer Leisch(2002a,b,2003).

R-functions for setting R-markup in Sweave by means of 'listings'
command \lstset are defined. (lstsetR, lstsetRd)

R-Comments will automatically be set in a different style using
\lstset- resp. lstsetR()- argument 'commentstyle'.

Different coloring for input, output and comments is set by default.

.Rd markup is defined as a new "sublanguage" of TeX for listings package.

Perhaps most useful is a feature for automatic keyword registration
to listings for markup: We dynamically create a list of such keywords
by masking/extending commands require(), library() such that, in
addition to the usual behavior, these commands after attaching package
SweaveListingUtils issue TeX (or more specifically listings) code
registering for markup all keywords found by ls() in the search() list;
besides this side effect require(), library() should behave as usual.
This way, each package can have its own markup style which can be useful
to highlight ones own new functions in a different way.

Finally, SweaveListingUtils also covers inclusion of code
sniplets from a repository / an url (notably/by default from r-forge).
This can help to include R code from source files in some package
R folder to be consistently documented in some vignette.

For details you may wish to consider  ?lstinputSourceFromRForge
and vignette "ExampleSweaveListingUtils".

I'd look forward to receiving questions, comments and
suggestions

Best,
Peter Ruckdeschel



More information about the R-packages mailing list