Variants
Alternate typefaces within formulas.
These functions are distinct from the text function because math fonts contain multiple variants of each letter.
函数
serif自始可用
Serif (roman) font style in math.
This is already the default.
body
The content to style.
sans自始可用
Sans-serif font style in math.
展开示例
$ sans(A B C) $

body
The content to style.
frak自始可用
Fraktur font style in math.
展开示例
$ frak(P) $

body
The content to style.
mono自始可用
Monospace font style in math.
展开示例
$ mono(x + y = z) $

body
The content to style.
bb自始可用
Blackboard bold (double-struck) font style in math.
For uppercase latin letters, blackboard bold is additionally available through symbols of the form NN and RR.
展开示例
$ bb(b) $
$ bb(N) = NN $
$ f: NN -> RR $

body
The content to style.
cal自始可用
Calligraphic (chancery) font style in math.
展开示例
Let $cal(P)$ be the set of ...

This is the default calligraphic/script style for most math fonts. See scr for more on how to get the other style (roundhand).
body
The content to style.
scr0.14.0起可用
Script (roundhand) font style in math.
展开示例
$scr(L)$ is not the set of linear
maps $cal(L)$.

There are two ways that fonts can support differentiating cal and scr. The first is using Unicode variation sequences. This works out of the box in Typst, however only a few math fonts currently support this.
The other way is using font features. For example, the roundhand style might be available in a font through the stylistic set 1 (ss01) feature. To use it in Typst, you could then define your own version of scr like in the example below.
展开示例:Recreation using stylistic set 1
#let scr(it) = text(
stylistic-set: 1,
$cal(it)$,
)
We establish $cal(P) != scr(P)$.

body
The content to style.