setToBeDefinedPkgs: setToBeDefinedPkgs

Description Usage Arguments Details Value Author(s) Examples

View source: R/keywordsStyle.R

Description

sets up / updates a table of keywordstyles to different packages

Usage

1
setToBeDefinedPkgs(pkgs, keywordstyles)

Arguments

pkgs

character; the packages for which keywordstyle information is to be stored

keywordstyles

character or missing; the corresponding keywordstyle format strings; if missing the corresponding option Keywordstyle is read off by using
getSweaveListingOption("Keywordstyle").
Internally, it is being cast to the same length as pkgs by rep(keywordstyles, length.out = length(pkgs)).

Details

The corresponding table is stored globally in the (non-exported) object .tobeDefinedPkgs, which is hidden in the namespace of this package.

It is used afterwords by the masked versions of require and library of this package to allow for defining a set of keywordstyle formats for different packages right in the preamble of a ‘.Rnw’ file.

This transfer of information to require and library clearly is a deviation from the functional programming paradigm but is necessary at this place, as otherwise (although this is still allowed) require and library would have to be called with non-standard (i.e. package base-) arguments, which is not the goal of including R code sniplets by Sweave.

Value

invisible()

Author(s)

Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

Examples

1
2
3
4
5
setToBeDefinedPkgs(pkgs = c("distr","distrEx"),
                   keywordstyles = paste("\\bfseries\\color{",c("blue","red"),"}",
                         sep="", collapse=""))
### not to be used:
print(SweaveListingUtils:::.tobeDefinedPkgs)

SweaveListingUtils documentation built on May 30, 2017, 6:29 a.m.