Skip to content

Annotations

These functions annotate the table: a title and subtitle appear at the top, footnotes and source notes at the bottom.

tab_header!

Add a title (and optional subtitle) above the column headers.

Signature: tab_header!(tbl, title; subtitle = nothing)

julia
using StyledTables, DataFrames

df = DataFrame(country = ["US", "DE", "JP"], gdp = [25.5, 4.1, 4.2])

tbl = StyledTable(df)
tab_header!(tbl, "GDP by Country"; subtitle = "Trillions USD, 2025")
cols_label!(tbl, :country => "Country", :gdp => "GDP")
fmt_number!(tbl, :gdp; digits = 1)
render(tbl)
GDP by Country
Trillions USD, 2025
Country GDP
US 25.5
DE 4.1
JP 4.2
StyledTables.tab_header! Function
julia
tab_header!(
    tbl::StyledTable,
    title;
    subtitle
) -> StyledTable

Add a title and optional subtitle above the column headers.

The title renders bold; the subtitle renders italic.

Arguments

  • tbl: the StyledTable to modify.

  • title: main heading text.

Keywords

  • subtitle: secondary heading text, or nothing (default).

Returns

tbl (modified in place).

See also: tab_spanner!, tab_sourcenote!, tab_footnote!.

Examples

julia
tbl = StyledTable(df)
tab_header!(tbl, "My Table"; subtitle = "Subtitle here")
render(tbl)
source

tab_footnote!

Add column-annotated footnotes. An auto-numbered superscript attaches to the specified column header(s); the footnote text appears in the footnote area below the table. For general notes not attached to any column, use tab_sourcenote!.

Signatures:

  • tab_footnote!(tbl, text => col)

  • tab_footnote!(tbl, text => [col1, col2])

  • tab_footnote!(tbl, text1 => col1, text2 => col2, ...)

  • tab_footnote!(tbl, d::AbstractDict)

julia
tbl = StyledTable(df)
tab_header!(tbl, "GDP by Country")
tab_footnote!(tbl, "Purchasing power parity adjusted" => :gdp)
render(tbl)
GDP by Country
country gdp1
US 25.5
DE 4.1
JP 4.2
1 Purchasing power parity adjusted

Annotate multiple columns with the same footnote:

julia
tbl = StyledTable(df)
tab_footnote!(tbl, "Source: World Bank (2025)" => [:country, :gdp])
render(tbl)
country1 gdp1
US 25.5
DE 4.1
JP 4.2
1 Source: World Bank (2025)

Multiple independent footnotes in one call:

julia
df2 = DataFrame(country = ["US", "DE"], gdp = [25.5, 4.1], pop = [331, 84])

tbl = StyledTable(df2)
tab_footnote!(tbl,
    "Purchasing power parity adjusted" => :gdp,
    "Population in millions" => :pop,
)
render(tbl)
country gdp1 pop2
US 25.5 331
DE 4.1 84
1 Purchasing power parity adjusted
2 Population in millions
StyledTables.tab_footnote! Function
julia
tab_footnote!(
    tbl::StyledTable,
    args::Pair...
) -> StyledTable

Add footnotes to the table.

Footnotes refer to specific columns. For placing general notes under the table, see tab_sourcenote!.

Arguments

  • tbl: the StyledTable to modify.

  • args: one or more text => column(s) pairs.

Returns

tbl (modified in place).

See also: tab_sourcenote!, tab_header!.

Examples

julia
tbl = StyledTable(df)
tab_footnote!(tbl, "PPP adjusted" => :gdp)
render(tbl)
source
julia
tab_footnote!(
    tbl::StyledTable,
    d::Union{AbstractDict{<:AbstractString, <:Union{Vector{Symbol}, Vector{<:AbstractString}}}, AbstractVector{<:Pair{<:AbstractString, <:Union{Vector{Symbol}, Vector{<:AbstractString}}}}}
) -> StyledTable

Add footnotes from a dict or vector of pairs.

Arguments

  • tbl: the StyledTable to modify.

  • d: an AbstractDict or AbstractVector of Pairs mapping text to column names.

Returns

tbl (modified in place).

See also: tab_spanner!, tab_header!, tab_stub!.

Examples

julia
tbl = StyledTable(df)
tab_footnote!(tbl, Dict(
    "measured each month" => [:efficacy, :safety],
    "in years" => [:age])
)
render(tbl)
source

tab_sourcenote!

Add a source-note line in the footer. Source notes span the full table width and are left-aligned. Each call appends another line.

Signature: tab_sourcenote!(tbl, text)

julia
using SummaryTables: Multiline
note = Multiline("Data: World Bank Open Data", "Values in trillions USD")

tbl = StyledTable(df)
tab_header!(tbl, "GDP by Country")
tab_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.tab_sourcenote! Function
julia
tab_sourcenote!(tbl::StyledTable, text) -> StyledTable

Add 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

Returns

tbl (modified in place).

See also: tab_footnote!, tab_header!.

Examples

julia
tbl = StyledTable(df)
tab_sourcenote!(tbl, "Data: World Bank Open Data")
render(tbl)
source