Learn R Programming

odfWeave (version 0.4.9)

setStyles: Style Definitions and Assignments

Description

Utility functions for declaring and setting styles

Usage

getStyles()
setStyles(style)

getStyleDefs() setStyleDefs(def)

getImageDefs() setImageDefs(def, verbose = TRUE)

Arguments

style
a list of style assignments
def
a list of style definitions
verbose
a logical: should warnings be printed?

Value

  • The get functions return named lists.

Details

There are two main components to specifying output formats: style definitions and style assignments. The definition has the specific components (such as a table cell) and their format values (e.g. boxed with solid black lines). The function getStyleDefs can fetch the pre-existing styles in the package. These can be modified and new definitions can be added. The function setStyledefs ``registers'' the style changes with the package. When odfWeave is called, these definitions are written to the style sections of the XML files. See the example below.

There is a second mechanism to assign styles to specific output elements. The functions getStyles and setStyles can be used to tell odfWeave which style definition to use for a particular output.

For example, the input and output elements control how R code and command--line output look. To change either of these, an existing definition can be assigned to these entries and reset using setStyles(currentStyles). Unlike the style definitions, the style assignments can be modified throughout the R code.

For graphics, getImageDefs and setImageDefs can be used to specifiy the type of plot device and it's arguments. getImageDefs will return a list with elements [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Since these functions can be called from within code chunks, graphical parameters can be changes during the Sweave process.

Examples

Run this code
currentStyleDefs <- getStyleDefs()
currentStyleDefs$ArialNormal$fontSize <- "10pt"
setStyleDefs(currentStyleDefs)

Run the code above in your browser using DataLab