Learn R Programming

highlight (version 0.3.2)

renderer_latex: LaTeX renderer

Description

renderer implementation targetting latex markup. The result markup uses the latex alltt package to achieve true type renderering and therefore does not depend on verbatim-like environments.

Usage

renderer_latex(document = TRUE, boxes = boxes_latex(), 
	translator = translator_latex, formatter = formatter_latex, 
	space = space_latex, newline = newline_latex, 
	stylesheet = "default", 
	styles = styler(stylesheet, "sty", styler_assistant_latex), 
	header = header_latex(document, styles = styles, boxes = boxes, minipage = minipage), 
	footer = footer_latex(document, minipage = minipage), 
	minipage = FALSE, ...)
newline_latex()
space_latex()

Arguments

document
logical. Should the renderer create the full document or only the code section, assuming the document is already created. Using FALSE is used by the sweave driver shipped with this package.
boxes
a function that returns definitions of latex boxes used for non standard characters. The reason for using boxes is that some character need to be escaped to be rendered, and unfortunately, escaping turns alltt off, which does not produce satisfying rende
translator
translation of characters into latex markup. See translator_latex for details
formatter
latex formatter. Tokens are wrapped into a latex command related to the style they should honor.
space
returns a space character that does not get reduced by latex
newline
returns a newline character
stylesheet
stylesheet to use.
styles
style definitions inferred from the parsing of the stylesheet. See styler and styler_assistant_latex.
header
returns the header. If the document argument is TRUE, the header contains the style definitions and the boxes definitions. If it is FALSE, a minimal header is produced to turn alltt on. In the latter case, boxes and style definitions are assumed to have
footer
returns the footer. Depending on the document argument, either a minimal footer is produced (turning off alltt) or the full latex document is closed.
minipage
if TRUE, the highlighted latex is included in a minipage environment
...
Additional arguments

Value

  • a renderer object, suitable for the renderer argument of highlight.

See Also

the sweave driver HighlightWeaveLatex makes extensive use if this renderer.

Examples

Run this code
r <- renderer_latex(document = T )
		r$space()
		r$newline()
		r$boxes()
		r$translator( "# the hash symbol gets a latex box" )

Run the code above in your browser using DataLab