WoodcoreMake the numbers vibe

Commands › Writing templates

#fmt-number Writing templates

Formats a number and its unit as the report prints them: «1.902 kN/m²».

#fmt-number(, )

Hover an argument: what it does. Hover its value: every possible value. A click keeps the bubble open.

The essentials

A template's building blockWhat Woodcore's own commands use; a report seldom needs it.
The document's decimalsThe number of decimals follows number-digits, as everywhere in the report.
Without a var objectFor a value computed in Typst; fmt-value reads a var object.

Arguments

ArgumentStatusWhat it does, and examples
The line's arguments
required
The number to print.
#fmt-number(1.7291232, "kN/m²")1.729 kN/m²
#fmt-number(12, "kN")an integer, no decimals
required
Its unit, "" if dimensionless.
#fmt-number(0.9, "")the number alone
"kNm"a unit of the report

Lines to copy

Minimal call

#fmt-number(1.729, "kN/m²")

Examples

Example 1
#fmt-number(1.7291232, "kN/m²")
The page fmt-number produces, level 2
Example 2
#fmt-number(0.9, "")
The page fmt-number produces, level 2

Defined in lib/calc-engine-core.typ:634