format-scientific
Format a numeric break in scientific notation as Typst math.
Returns a typst()-tagged string so the render path evaluates the result as Typst math markup. Values within [10^(-3), 10^3) are formatted as plain numbers via format-number.
Usage
format-scientific(
digits: 2,
)Parameters
| Parameter | Default | Description |
|---|---|---|
digits |
2 |
Significant decimal digits in the mantissa. |
Returns
A closure value => content.
Examples
Spread y across decades so the labels switch into Typst-math scientific notation.
#plot(
data: ((x: 1, y: 1e-4), (x: 2, y: 1e-2), (x: 3, y: 1), (x: 4, y: 1e4)),
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 3pt),),
scales: (scale-y-continuous(labels: format-scientific(digits: 2)),),
width: 10cm,
height: 6cm,
)