This function makes a latex document using output generated with functions in the R3port package or any other latex code available as vector. Basically it adds a preamble to a tex file and let's the user select various options to customize the output.

ltx_doc(
  text,
  out = NULL,
  template = paste0(system.file(package = "R3port"), "/simple.tex"),
  rendlist,
  orientation = "landscape",
  rtitle = "report",
  compile = TRUE,
  show = TRUE
)

Arguments

text

character vector to be placed within latex document

out

filename for the output latex file (if NULL it will print to console)

template

file name of the template file to use (see examples how templates can be used/adapted)

rendlist

a render list to be used for the template file (see whisker::whisker.render)

orientation

string indicating the page orientation (can be either "landscape" or "portrait")

rtitle

string indicating the title of the output document

compile

logical indicating if the tex file should be compiled (using tools::texi2dvi)

show

logical indicating if the resulting pdf file from the compiled tex file should be opened when created

Value

The function returns a latex file (or writes output to console)

See also

Examples


if (FALSE) { # \dontrun{
  txt <- "\\section{example}"
  tbl <- "\\begin{tabular}{|l|c|r|} 1 & 2 & 3 \\\\ 4 & 5 & 6 \\\\ \\end{tabular}"
  add <- "\\\\ Including some additional text"
  ltx_doc(c(txt,tbl,add),out=paste0(tempfile(),".tex"),show=FALSE)

  # You can use xtable (and any other packages that output tex)
  library(xtable)
  data(Theoph)
  xtbl <- print(xtable(Theoph),tabular.environment="longtable",floating=FALSE,print.results=FALSE)
  ltx_doc(xtbl,out=tempfile(fileext = ".tex"))

} # }