Applies a compact table theme to gt tables that matches the 'jama' theme from gtsummary, so gtsummary and plain gt tables look the same in one document. Reduces padding, adjusts font sizes, and applies JAMA journal styling.
Arguments
- tbl
A gt table object created with
gt::gt()
Details
This function replicates the visual appearance
of gtsummary::theme_gtsummary_compact("jama") for
use with regular gt tables. Key styling includes:
Reduced font size (13px) for compact appearance
Minimal padding (1px) on all row types
Bold column headers and table titles
Hidden top and bottom table borders
Consistent spacing that matches JAMA journal standards
See also
sumExtras::use_jama_theme()for complimentary table stylinggt::tab_options()for additional gt table styling options
Examples
# Basic usage with a data frame
mtcars |>
head() |>
gt::gt() |>
theme_gt_compact()
# Combine with other gt functions
mtcars |>
head() |>
gt::gt() |>
gt::tab_header(title = "Vehicle Data") |>
theme_gt_compact()
# Use alongside gtsummary tables with sumExtras for consistency
# Set JAMA theme first
use_jama_theme()
# Then both tables will have matching appearance
summary_table <- gtsummary::trial |>
gtsummary::tbl_summary()
data_table <- gtsummary::trial |>
head() |>
gt::gt() |>
theme_gt_compact()
