This function creates a glossary with terms and definitions, rendering them as a formatted gt table with customizable styling, optimized for both HTML and PDF output, with text wrapping for definitions and visible borders between cells.

create_glossary_table(
  terms,
  table_title = "Glossary of Terms",
  term_color = "purple",
  term_decoration = "underline",
  def_bg = "gray",
  def_color = "white",
  font_size = "12pt",
  table_width = "100%",
  max_height = "400px",
  border_color = "black",
  border_style = "solid",
  border_weight = "2pt"
)

Arguments

terms

A named list where names are terms and values are definitions.

table_title

Title for the glossary table (default: "Glossary of Terms").

term_color

Color for glossary terms in the table (default: "purple").

term_decoration

Text decoration for terms (default: "underline"). Supports "underline", "overline", "line-through" (requires LaTeX package ulem for line-through).

def_bg

Background color for definitions (default: "gray").

def_color

Text color for definitions (default: "white").

font_size

Font size for the table (default: "12pt").

table_width

Width of the table (default: "100%").

max_height

Maximum height of the table (default: "400px").

border_color

Color of cell borders (default: "black").

border_style

Style of cell borders (default: "solid"). Supports "solid", "dashed", "dotted".

border_weight

Weight of cell borders (default: "2pt" for better visibility).

Value

A gt table object displaying the glossary.