typst
Mark a value for Typst-markup evaluation.
Inside aes(), typst("col") names the column to use for the aesthetic mapping; the scale uses raw values for its mapping logic and evaluates each value as Typst markup wherever the scale renders text (legend swatches, axis ticks, geom labels).
In static-prose surfaces (titles, captions, axis titles, legend titles), typst("...") evaluates the wrapped string as markup.
source may be another tagged value (such as as-factor("col")) so the helper composes with other aes coercions; the resolver unwraps innermost-first.
Usage
typst(
source,
)Parameters
| Parameter | Default | Description |
|---|---|---|
source |
A markup string, a column name, or another tagged aesthetic value. |
Returns
A tagged dictionary the renderer recognises as markup-bearing.
Examples
Wrap a static title so math renders.
#plot(
data: (
(x: 1, y: 1),
(x: 2, y: 4),
(x: 3, y: 9),
),
mapping: aes(x: "x", y: "y"),
layers: (geom-point(),),
labs: labs(title: typst("Mean $bar(x)$ over time")),
width: 10cm,
height: 6cm,
)Mark a label aesthetic so values render as markup.
#plot(
data: (
(x: 1, y: 1, lab: "$alpha$"),
(x: 2, y: 2, lab: "$beta$"),
(x: 3, y: 3, lab: "$gamma$"),
),
mapping: aes(x: "x", y: "y"),
layers: (geom-text(mapping: aes(label: typst("lab"))),),
width: 10cm,
height: 6cm,
)