Annotations
These functions annotate the table: a title and subtitle at the top, footnotes and source notes at the bottom.
header!
Add a title (and optional subtitle) above the column headers.
Signature: header!(tbl, title; subtitle = nothing)
using StyledTables, DataFrames
df = DataFrame(country = ["US", "DE", "JP"], gdp = [25.5, 4.1, 4.2])
tbl = StyledTable(df)
header!(tbl, "GDP by Country"; subtitle = "Trillions USD, 2025")
relabel!(tbl, :country => "Country", :gdp => "GDP")
format!(NumberFormatter(digits = 1), tbl, :gdp)
render(tbl)| GDP by Country | |
| Trillions USD, 2025 | |
| Country | GDP |
| US | 25.5 |
| DE | 4.1 |
| JP | 4.2 |
StyledTables.header! Function
header!(
tbl::StyledTable,
title;
subtitle,
align
) -> StyledTableAdd a title and optional subtitle above the column headers.
The title renders bold; the subtitle renders italic.
Arguments
tbl: theStyledTableto modify.title: main heading text.
Keywords
subtitle: secondary heading text, ornothing(default).align: horizontal alignment (:left,:center,:right), default:center.
Returns
tbl (modified in place).
See also: spanner!, sourcenote!, footnote!.
Examples
tbl = StyledTable(df)
header!(tbl, "My Table"; subtitle = "Subtitle here")
render(tbl)
tbl = StyledTable(df)
header!(tbl, "Left-aligned Title"; align = :left)
render(tbl)footnote!
Attach footnotes to columns, spanners, or individual body cells. An superscript marks the target; the annotation text appears below the table. For general notes, use sourcenote!.
Signatures:
footnote!(tbl, col => text)
footnote!(tbl, [col1, col2] => text)
footnote!(tbl, col1 => text1, col2 => text2, ...)
footnote!(tbl, d::AbstractDict)tbl = StyledTable(df)
header!(tbl, "GDP by Country")
footnote!(tbl, :gdp => "Purchasing power parity adjusted")
render(tbl)| GDP by Country | |
| country | gdp1 |
| US | 25.5 |
| DE | 4.1 |
| JP | 4.2 |
| 1 Purchasing power parity adjusted | |
Multiple columns with the same footnote:
tbl = StyledTable(df)
footnote!(tbl, [:country, :gdp] => "Source: World Bank (2025)")
render(tbl)| country1 | gdp1 |
| US | 25.5 |
| DE | 4.1 |
| JP | 4.2 |
| 1 Source: World Bank (2025) | |
Footnotes for different columns:
df2 = DataFrame(country = ["US", "DE"], gdp = [25.5, 4.1], pop = [331, 84])
tbl = StyledTable(df2)
footnote!(tbl,
:gdp => "Purchasing power parity adjusted",
:pop => "Population in millions",
)
render(tbl)| country | gdp1 | pop2 |
| US | 25.5 | 331 |
| DE | 4.1 | 84 |
| 1 Purchasing power parity adjusted 2 Population in millions | ||
Footnotes for spanner labels and individual cells are explained here.
StyledTables.footnote! Method
footnote!(tbl::StyledTable, args::Pair...) -> StyledTableAdd footnotes to the table.
Footnotes refer to specific columns. For notes not tied to any column, use sourcenote!.
Arguments
tbl: theStyledTableto modify.args: one or morecolumn(s) => textpairs.
Returns
tbl (modified in place).
To target a spanner label or an individual cell, use SpannerTarget and CellTarget.
See also: sourcenote!, header!.
Examples
tbl = StyledTable(df)
footnote!(tbl, :gdp => "PPP adjusted")
render(tbl)sourcenote!
Add a source-note line in the footer. Source notes span the full table width and are left-aligned; each call appends one.
Signature: sourcenote!(tbl, text)
using SummaryTables: Multiline
note = Multiline("Data: World Bank Open Data", "Values in trillions USD")
tbl = StyledTable(df)
header!(tbl, "GDP by Country")
sourcenote!(tbl, note)
render(tbl)| GDP by Country | |
| country | gdp |
| US | 25.5 |
| DE | 4.1 |
| JP | 4.2 |
| Data: World Bank Open Data Values in trillions USD |
|
StyledTables.sourcenote! Function
sourcenote!(tbl::StyledTable, text) -> StyledTableAdd a source-note line in the table footer.
Source notes span the full table width and are left-aligned. Each call appends another line.
Arguments
tbl: theStyledTableto modify.text: source note text.
Returns
tbl (modified in place).
Examples
tbl = StyledTable(df)
sourcenote!(tbl, "Data: World Bank Open Data")
render(tbl)