Output a gt object as LaTeXSource:
Get the LaTeX content from a
gt_tbl object as a
knit_asis object. This
object contains the LaTeX code and attributes that serve as LaTeX
dependencies (i.e., the LaTeX packages required for the table). Using
as.character() on the created object will result in a single-element vector
containing the LaTeX code.
A table object that is created using the
gtcars to create a gt table. Add a header and then export as an
object with LaTeX code.
What's returned is a
knit_asis object, which makes it easy to include in R
Markdown documents that are knit to PDF. We can use
as.character() to get
just the LaTeX code as a single-element vector.