knit_print.StyledTable: Knit-Print StyledTable

View source: R/knit_print.R

knit_print.StyledTableR Documentation

Knit-Print StyledTable

Description

Add a knit_print method to the styledTable class. In case the knitting destination is latex, then a LaTeX text block is printed, which holds the LaTeX code of the table. In case the knitting destination is html, then an HTML text block is printed, holding the HTML code of the table. In both cases the dependencies (LaTex and HTML dependencies) will be automatically added to the knitr metadata. In the html case, the the following chunk options are used for printing:

  • tab.cap: An optional string holding the table caption. If no tab.cap is set, then no table caption is created and the table is not listed in the list of tables.

  • label: If tab.cap is set, then the chunk label is used as table id in order to reference to it (using ⁠\@ref(tab:LABEL)⁠). If no chunk label is defined, then the table will not be listed in the list of tables.

  • tab.footer: A character vector holding the strings for the table footer entries. Each string is placed inside of a ⁠<td>⁠ table element in a separate table row in the ⁠<tfoot>⁠ part of the table.

  • tab.print: An optional logical value. If set to FALSE, then the table is not printed.

  • tab.add_dummy_table: An optional logical value. If set to TRUE, then an empty kable table is printed before the given table. This dummy table is contained inside of a ⁠<div class="lua-remove">⁠ html-element. This is a quick fix for the open feature request in https://github.com/rstudio/pagedown/issues/191, since only markdown tables are currently supported by the loft.lua filter of pagedown. As a workaround for this missing feature, we add an empty dummy table before the desired table and remove it with the lua-filter system.file("lua-filters", "lua_remove.lua", package = "styledTables").

Usage

## S3 method for class 'StyledTable'
knit_print(x, ...)

Arguments

x

A StyledTable class object to be printed

...

Additional arguments (ignored)


R-package/styledTables documentation built on Feb. 6, 2024, 2:21 a.m.