LaTeX-Specific Theme for tinytable

Description

This function provides comprehensive LaTeX-specific theming and configuration options for tinytable objects. It allows customization of LaTeX environments, table layout, multipage behavior, resizing, and placement within LaTeX documents.

Usage

theme_latex(
  x,
  inner = NULL,
  outer = NULL,
  environment = get_option("tinytable_latex_environment", default = NULL),
  environment_table = get_option("tinytable_latex_environment_table", default = TRUE),
  multipage = get_option("tinytable_latex_multipage", default = FALSE),
  rowhead = get_option("tinytable_latex_rowhead", 0L),
  rowfoot = get_option("tinytable_latex_rowfoot", 0L),
  resize_width = get_option("tinytable_latex_resize_width", 1),
  resize_direction = get_option("tinytable_latex_resize_direction", default = NULL),
  placement = get_option("tinytable_latex_placement", NULL),
  ...
)

Arguments

x A tinytable object to apply LaTeX theming to.
inner Character string specifying inner tabularray options. These options control the internal formatting of the table (e.g., column alignment, spacing). Will be added to any existing inner options. Default is NULL.
outer Character string specifying outer tabularray options. These options control the external formatting around the table. Will be added to any existing outer options. Default is NULL.
environment

Character string specifying the LaTeX table environment to use. Options are:

  • “tblr” - Standard tabularray table (default)

  • “talltblr” - Tall tabularray table for tables that may break across pages

  • “longtblr” - Long tabularray table for multi-page tables

  • “tabular” - Basic LaTeX tabular environment without tabularray features

Default is controlled by tinytable_latex_environment option.
environment_table Logical indicating whether to wrap the table in a table environment. When FALSE, only the core table structure is output without the surrounding table wrapper. Automatically set to FALSE when environment = “longtblr”. Default is controlled by tinytable_latex_environment_table option.
multipage Logical indicating whether to enable multipage table functionality. When TRUE, automatically switches to longtblr environment and sets appropriate options for tables that span multiple pages. Default is controlled by tinytable_latex_multipage option.
rowhead Integer specifying the number of header rows to repeat on each page in multipage tables. Only valid with longtblr environment. Default is controlled by tinytable_latex_rowhead option.
rowfoot Integer specifying the number of footer rows to repeat on each page in multipage tables. Only valid with longtblr environment. Default is controlled by tinytable_latex_rowfoot option.
resize_width Numeric value between 0.01 and 1.0 specifying the target width as a fraction of \linewidth when resizing tables. Only used when resize_direction is specified. Default is controlled by tinytable_latex_resize_width option.
resize_direction

Character string specifying how to resize tables that are too wide or too narrow. Options are:

  • “down” - Only shrink tables wider than \linewidth

  • “up” - Only expand tables narrower than \linewidth

  • “both” - Resize all tables to exactly resize_width * \linewidth

Default is controlled by tinytable_latex_resize_direction option.
placement Character string specifying LaTeX float placement options for the table environment (e.g., "h", "t", "b", "p", "H"). Only used when environment_table = TRUE. Default is controlled by tinytable_latex_placement option.
Additional arguments (currently unused).

Details

The function provides fine-grained control over LaTeX table output through several mechanisms:

Environment Selection: Different LaTeX environments offer different capabilities:

  • tblr: Modern tabularray syntax with full styling support

  • talltblr: Like tblr but optimized for tall tables

  • longtblr: Supports page breaks and repeated headers/footers

  • tabular: Basic LaTeX syntax, limited styling but maximum compatibility

Multipage Tables: When multipage = TRUE or when rowhead/rowfoot are specified, the function automatically switches to longtblr environment and disables the table wrapper. This allows tables to break across pages while maintaining headers and footers.

Resizing: The resize functionality uses LaTeX’s \resizebox command to automatically adjust table width based on content and page constraints. This is particularly useful for tables with many columns.

Tabularray Options: Inner and outer options directly control tabularray formatting. Inner options affect cell content and spacing, while outer options control the table’s relationship with surrounding text.

Value

A modified tinytable object with LaTeX-specific theming applied.

See Also

tt(), style_tt(), save_tt()