Skip to content

Footnotes everywhere

StyledTables.jl supports three footnote targets. Each target places an auto-numbered superscript on a different element and appends the annotation text below the table.

TargetConstructorAttaches to
Column header"note" => :colA column label
Spanner label"note" => SpannerTarget(label)A spanner row cell
Body cell"note" => CellTarget(row, col)A single data cell

Setup

julia
using StyledTables, DataFrames

df = DataFrame(
    country  = ["United States", "Germany", "Japan"],
    gdp_usd  = [25.5, 4.1, 4.2],
    gdp_ppp  = [27.3, 5.2, 6.2],
    pop_m    = [331, 84, 125],
)
3×4 DataFrame
Rowcountrygdp_usdgdp_ppppop_m
StringFloat64Float64Int64
1United States25.527.3331
2Germany4.15.284
3Japan4.26.2125

Column footnotes

Annotate one or more column headers with a note.

julia
tbl = StyledTable(df)
tab_footnote!(tbl,
    "Trillions USD, 2025" => [:gdp_usd, :gdp_ppp],
    "Millions" => [:pop_m],
)
render(tbl)
country gdp_usd1 gdp_ppp1 pop_m2
United States 25.5 27.3 331
Germany 4.1 5.2 84
Japan 4.2 6.2 125
1 Trillions USD, 2025
2 Millions

Spanner footnotes

Use SpannerTarget to annotate a spanner label instead of a column header — useful when a note applies to the group as a whole rather than any single column.

julia
tbl = StyledTable(df)
tab_spanner!(tbl, "GDP (Trillions)" => [:gdp_usd, :gdp_ppp])
tab_footnote!(tbl, "Estimated values" => SpannerTarget("GDP (Trillions)"))
render(tbl)
GDP (Trillions)1
country gdp_usd gdp_ppp pop_m
United States 25.5 27.3 331
Germany 4.1 5.2 84
Japan 4.2 6.2 125
1 Estimated values

Cell footnotes

Use CellTarget to annotate a single body cell — useful for flagging a data point as preliminary, revised, or otherwise noteworthy.

By row index (1-based):

julia
tbl = StyledTable(df)
japan_gdp_ppp = CellTarget(3, :gdp_ppp)
tab_footnote!(tbl, "Preliminary estimate" => japan_gdp_ppp)
render(tbl)
country gdp_usd gdp_ppp pop_m
United States 25.5 27.3 331
Germany 4.1 5.2 84
Japan 4.2 6.21 125
1 Preliminary estimate

By stub value (requires tab_stub!):

With a stub column, target rows by stub value rather than numeric index — more robust when row order may change.

julia
tbl = StyledTable(df)
tab_stub!(tbl, :country)
japan_gdp_ppp = CellTarget(Stub("Japan"), :gdp_ppp)
tab_footnote!(tbl, "Preliminary estimate" => japan_gdp_ppp)
render(tbl)
gdp_usd gdp_ppp pop_m
United States 25.5 27.3 331
Germany 4.1 5.2 84
Japan 4.2 6.21 125
1 Preliminary estimate