Learn R Programming

flextable (version 0.10.0)

save_as_typst: Save flextable objects in a Typst file

Description

Writes one or more flextables to a standalone Typst (.typ) document. Images are embedded as base64 (decoded inline at compile time), so the file is self-contained and compiles offline with typst compile. Equations require the mitex Typst package, which is fetched from the Typst package registry on first compilation.

Usage

save_as_typst(
  ...,
  values = NULL,
  path,
  page = "#set page(width: auto, height: auto, margin: 12pt)"
)

Value

the path to the generated file, invisibly.

Arguments

...

flextable objects, possibly named.

values

a list of flextable objects. If provided, ... is ignored.

path

Typst file to be created.

page

a Typst #set page(...) rule used as document setup. The default produces a tightly cropped page fitting the table(s).

Examples

Run this code
ft <- flextable(head(iris))
tf <- tempfile(fileext = ".typ")
save_as_typst(ft, path = tf)

Run the code above in your browser using DataLab