Create a standalone png snippet using latex and dvipng from an stable object; both functions are required to be installed for this to work. The resultant png file is saved on disk and the relative path to the file is returned. st2png() is an alias to st_as_png().

st_aspng(
  x,
  stem = "pmt-standalone-preview",
  dir = tempdir(),
  font = "helvetica",
  textwidth = getOption("pmtables.text.width", 6.5),
  border = getOption("pmtables.image.border", "0.2cm 0.7cm"),
  ntex = 1,
  dpi = 200
)

st2png(
  x,
  stem = "pmt-standalone-preview",
  dir = tempdir(),
  font = "helvetica",
  textwidth = getOption("pmtables.text.width", 6.5),
  border = getOption("pmtables.image.border", "0.2cm 0.7cm"),
  ntex = 1,
  dpi = 200
)

Arguments

x

an stable object; this can be the result of calling stable() or stable_long().

stem

used to build intermediate and output file names.

dir

directory for building the pdf file.

font

the font to use; alternative values include roboto and utopia; passed to st_to_standalone().

textwidth

the page width (in inches) when building with pdflatex; passed to st_to_standalone(); see details.

border

passed as an option to standalone latex output type; see details.

ntex

number of times to build the pdf file

dpi

dots per inch for the resulting png file; used by dvipng when converting dvi file to the final png result.

Value

A string containing the path to the rendered png file.

Examples

if (FALSE) { # \dontrun{
Sys.which("latex")
Sys.which("dvipng")

tab <- stable(stdata())
st_aspng(tab)
} # }