renderer_latex: LaTeX renderer

View source: R/renderer.R

space_latexR Documentation

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

space_latex()

newline_latex()

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,
  ...
)

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 rendering. This argument is used by the header function when the document argument is TRUE. It is also used in the sweave driver at the very beginning of the document

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 been inserted already, latex will not compile the document otherwise.

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.

Examples

## Not run: 
	r <- renderer_latex(document = T )
	r$space()
	r$newline()
	r$boxes()
	r$translator( "# the hash symbol gets a latex box" )

## End(Not run)

highlight documentation built on Jan. 22, 2023, 1:38 a.m.