ltx_doc: Prints latex code for a table, listing, plot, or text to a a...

View source: R/ltx_doc.r

ltx_docR Documentation

Prints latex code for a table, listing, plot, or text to a a file or console

Description

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.

Usage

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 (see whisker-package))

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

html_doc

Examples


## Not run: 
  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"))


## End(Not run)

RichardHooijmaijers/R3port documentation built on Sept. 30, 2023, 7:31 p.m.