DynamicOptions: Compute the options for the target format

DynamicOptionsR Documentation

Compute the options for the target format

Description

This function computues the collection of options that govern the evaluation of the code in the dynamic document for the given target output format. This includes aspects such as the format of graphical output (e.g. PDF, SVG, JPEG or PNG), directory in which to place intermediate files (e.g. graphics output), number of characters for printing R output, number of digits to display, display for the prompt, background and foreground colors for graphics devices, font size and family, environment for evaluation, ... These are options controlling the R evaluator rather than the XSL parameters controlling the XSL engine. They provide the context for the evaluation of the code in the document.

Usage

DynamicOptions(target, ..., obj = new(.class), .class = "DynamicDocContext")

Arguments

target

the name of the target, e.g. "html", "fo", "latex"

...

user-specified options as name = value pairs that override the default options.

obj

the instance to populate and return

.class

the name of the class of which we return an instance.

Value

An object of class DynamicDocContext.

Note

This approach and function is quite extensible in that if you specify the name of a sub-class via the .class function the function returns an instance of that class. It also processesthe ... arguments relative to the slots of that new class and matches those rather than the "fixed" DynamicDocContext class.

Author(s)

Duncan Temple Lang

See Also

dynDoc

Examples

 DynamicOptions("HTML")
 DynamicOptions("HTML", deviceDims = c(10, 10))

 DynamicOptions("FO")
 DynamicOptions("FO", digits = 3, width = 72)


   # To illustrate extensibility using sub-classes
 setClass("MyDynamicDocContext", contains = "DynamicDocContext",
           representation(graphicsHook = "function"))
 x = DynamicOptions("HTML", graphicsHook = function(file) {
                               # annotate the SVG file to make it interactive
                              }, .class = "MyDynamicDocContext")

 x@graphicsHook
 x@width

duncantl/XDynDocs documentation built on Jan. 4, 2024, 5:20 p.m.