writeTableToPDF: Create a pdf file from latex from a tabular object.

View source: R/writeTableToPDF.R

writeTableToPDFR Documentation

Create a pdf file from latex from a tabular object.

Description

Function to create a pdf file from latex from a tabular object.

Usage

writeTableToPDF(
  tbl_tex,
  template_tex = NULL,
  pdf_name = "table.pdf",
  insertion_point = "&&tex_str",
  pageheight = 8.5,
  pagewidth = 6.5,
  margin = 0.1,
  orientation = "portrait",
  units = "in",
  cleanup = TRUE
)

Arguments

tbl_tex
  • the tex string from tables::toLatex(tabular)

template_tex
  • character string of tex template

pdf_name
  • the desired name for the resulting pdf file

insertion_point
  • string identifying point at which to insert the tex string into the template

pageheight
  • page height (number, in units given by units)

pagewidth
  • page width (number, in units given by units)

margin
  • margin (number, in units given by units)

orientation
  • "portrait" or "landscape"

units
  • units for measurements (e.g., "in" or "cm")

cleanup
  • flag to clean up intermediate files

Details

This function inserts the latex string tbl_tex returned by tables::toLatex() called on a table tblinto a tex template (tex_template) for a document. It then converts the resulting tex to a pdf using writeTexToPDF().

The insertion point in the template is indicated by the value of insertion_point. A default template is provided in tex/templateForTable.tex.

The intermediate files are named "tex_DUMMY_TEX_FILE" with extensions .tex, .aux, .log, and .pdf. The pdf file is copied to the file given by pdf_name (which defaults to 'table.pdf').

Value

Invisibly, the tex string for the pdf document.

Note

The use of orientation="landscape" reverses the sense of pageheight and pagewidth in determining the page size, but does not rotate the table.


wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.