Skip to content

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)

julia
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
julia
header!(
    tbl::StyledTable,
    title;
    subtitle,
    align
) -> 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).

  • align: horizontal alignment (:left, :center, :right), default :center.

Returns

tbl (modified in place).

See also: spanner!, sourcenote!, footnote!.

Examples

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

tbl = StyledTable(df)
header!(tbl, "Left-aligned Title"; align = :left)
render(tbl)
source

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:

julia
footnote!(tbl, col => text)
footnote!(tbl, [col1, col2] => text)
footnote!(tbl, col1 => text1, col2 => text2, ...)
footnote!(tbl, d::AbstractDict)
julia
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:

julia
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:

julia
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
julia
footnote!(tbl::StyledTable, args::Pair...) -> StyledTable

Add footnotes to the table.

Footnotes refer to specific columns. For notes not tied to any column, use sourcenote!.

Arguments

  • tbl: the StyledTable to modify.

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

Returns

tbl (modified in place).

To target a spanner label or an individual cell, use SpannerTarget and CellTarget.

See also: sourcenote!, header!.

Examples

julia
tbl = StyledTable(df)
footnote!(tbl, :gdp => "PPP adjusted")
render(tbl)
source

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)

julia
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
julia
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: footnote!, header!.

Examples

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