HighlightWeaveLatex {highlight}R Documentation

Sweave driver performing syntax highlighting

Description

Sweave driver using the highlight latex renderer to perform syntax highlighting of input R code in sweave chunks.

Usage

HighlightWeaveLatex(
  boxes = FALSE,
  bg = rgb(0.95, 0.95, 0.95, maxColorValue = 1),
  border = "black",
  highlight.options = list(boxes = boxes, bg = bg, border = border)
)

Arguments

boxes

if TRUE, code blocks are wrapped in boxes.

bg

background color for code boxes.

border

color to use for the border of code boxes.

highlight.options

Can be used instead of the other arguments to set the boxes, bg and border settings.

Details

This sweave driver is very similar to standard driver that is included in ‘⁠utils⁠’. The difference is that input R code and verbatim output is rendered using highlight enabling syntax highlighting of R code.

Instead of using ‘⁠Sinput⁠’ and ‘⁠Soutput⁠’ commands, this driver uses ‘⁠Hinput⁠’ and ‘⁠Houtput⁠’ and defines these commands at the very beginning of the document, letting the user the option to overwrite them as necessary.

Latex boxes defined by the latex renderer (renderer_latex) and style definitions needed are also written at the beginning of the document.

Because highlight does not use verbatim environments, the user of this driver can freely redefine the ‘⁠Hinput⁠’, ‘⁠Houtput⁠’ and ‘⁠Hchunk⁠’ environments to achieve greater control of the output latex document than with the standard driver.

Value

A sweave driver, suitable for the ‘⁠driver⁠’ argument of Sweave

Examples

## Not run: 
# using the driver on the grid vignette
require( grid )
v <- vignette( "grid", package = "grid" )$file
file.copy( v, "grid.Snw" )
Sweave( "grid.Snw", driver= HighlightWeaveLatex() )

## End(Not run)

[Package highlight version 0.5.1 Index]