as.document: Coerce to LaTeX Document

Description Usage Arguments Value Methods (by class) See Also Examples

View source: R/document.R

Description

Coerces to LaTeX document. Generic, with methods for character and data.frame.

Coerces to LaTex document from character.

Coerces to LaTeX document from data.frame.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
as.document(x, ...)

## S3 method for class 'character'
as.document(
  x,
  preamble = makePreamble(...),
  thispagestyle = command("thispagestyle", args = "empty"),
  pagestyle = command("pagestyle", args = "empty"),
  prolog = NULL,
  epilog = NULL,
  ...
)

## S3 method for class 'data.frame'
as.document(
  x,
  rules = c(2, 1, 1),
  walls = 0,
  grid = FALSE,
  rowgroups = factor(rownames(x)),
  colgroups = factor(names(x)),
  rowbreaks = if (grid) breaks(rowgroups, ...) else 0,
  colbreaks = if (grid) breaks(colgroups, ...) else 0,
  rowcolors = NULL,
  charjust = "left",
  numjust = "right",
  justify = ifelse(sapply(x, is.numeric), numjust, charjust),
  colwidth = NA,
  paralign = "top",
  na = "",
  verbatim = ifelse(sapply(x, is.numeric), TRUE, FALSE),
  escape = "#",
  reserve = TRUE,
  trim = TRUE,
  wide = NULL,
  long = NULL,
  wider = 0,
  longer = 0,
  ...
)

Arguments

x

object to be converted, typically data.frame (paths of tex files for tex2pdf and viewtex)

...

passed to as.tabular.data.frame and as.document.character

preamble

latex markup to include before beginning the document

thispagestyle

thispagestyle command

pagestyle

pagestyle command

prolog

latex markup to include before x

epilog

latex markup to include after x

rules

numeric; will be recycled to length 3. indicates number of horizontal lines above and below the header, and below the last row.

walls

numeric, recycled to length 2. Number of vertical lines on left and right of table.

grid

logical, whether to have lines between rows and columns

rowgroups

a vector as long as nrow(x), non-repeats trigger horizontal lines

colgroups

a vector as long as names(x), non-repeats trigger vertical lines

rowbreaks

numeric: a manual way to specify numbers of lines between rows (ignores grid and rowgroups)

colbreaks

numeric: a manual way to specify numbers of lines between columns (ignores grid and colgroups)

rowcolors

character vector of color names, recycled as necessary to color all rows (NULL: no color)

charjust

default justification for character columns

numjust

default justification for numeric columns

justify

manual specification of column justifications: left, right, center, or decimal (vector as long as ncol(x))

colwidth

manual specification of column width. (vector of length ncol(x).) Overrides justify where not NA.

paralign

used with colwidth to align paragraphs: top, middle, or bottom.

na

string to replace NA elements

verbatim

whether to use verbatim environment for numeric fields. Makes sense for decimal justification; interacts with trim and justify.

escape

symbol used by ‘verb’ command as delimiter. A warning is issued if it is found in non-NA text.

reserve

substitute escape sequences for LaTeX reserved characters

trim

passed to the format command: true by default, so that alignment is the responsibility of just the tabular environment arguments

wide

nominal page width in mm

long

nominal page length in mm

wider

additional page width in mm

longer

additional page lenth in mm

Value

character

character

character

Methods (by class)

See Also

as.tabular.data.frame

as.document.character

as.pdf.data.frame

Examples

1

bergsmat/latexpdf documentation built on Jan. 16, 2022, 2:14 p.m.