Typlet

Supported features

Typlet renders Typst 0.15.1's math, and the embedded code formulas use (docs/DESIGN.md ยง6). This list is generated from the library Typlet evaluates with.

Math

All of Typst's math syntax: attachments, fractions, roots, delimiters, alignment points and line breaks, shorthands such as -> and !=, primes, and calls with named arguments, spreads and rows. All 47 functions of the math module:

Function Example Parameters
abs |๐‘ฅ|abs(x)
abs(x)
abs(size: relative length, body: content)
accent ๐‘Žโƒ—accent(a, arrow)
accent(a, arrow)
accent(base: content, accent: string or content, size: relative length = 100% + 0pt, dotless: boolean = true)
attach ฮ 2๐›ผ1๐›ฝattach(Pi, t: alpha, b: beta, tl: 1, br: 2)
attach(Pi, t: alpha, b: beta, tl: 1, br: 2)
attach(base: content, t: content or none = none, b: content or none = none, tl: content or none = none, bl: content or none = none, tr: content or none = none, br: content or none = none)
bb โ„bb(R)
bb(R)
bb(body: content)
binom (๐‘›๐‘˜)binom(n, k)
binom(n, k)
binom(upper: content, ..lower: content)
bold ๐‘จ+๐ดbold(A) + A
bold(A) + A
bold(body: content)
cal ๐’œ๏ธ€cal(A)
cal(A)
cal(body: content)
cancel ๐‘ฅcancel(x)
cancel(x)
cancel(body: content, length: relative length = 100% + 0.3em, inverted: boolean = false, cross: boolean = false, angle: angle or function or auto = auto, stroke: length or color or gradient or tiling or dictionary or stroke = 0.05em)
cases {1if๐‘ฅ>00elsecases(1 "if" x > 0, 0 "else")
cases(1 "if" x > 0, 0 "else")
cases(delim: array or none or symbol or string = ("{", "}"), reverse: boolean = false, gap: relative length = 0% + 0.2em, ..children: content)
class ๐‘Žโˆ—๐‘a class("relation", ast) b
a class("relation", ast) b
class(class: "normal" or "punctuation" or "opening" or "closing" or "fence" or "large" or "relation" or "unary" or "binary" or "vary", body: content)
display โˆ‘๐‘–๐‘ฅ๐‘–display(sum_i x_i)
display(sum_i x_i)
display(body: content, cramped: boolean = false)
equation equation(block: boolean = false, numbering: string or function or none = none, number-align: alignment = end + horizon, supplement: content or function or none or auto = auto, alt: string or none = none, body: content)
frac ๐‘Ž๐‘frac(a, b)
frac(a, b)
frac(num: content, denom: content, style: "vertical" or "skewed" or "horizontal" = "vertical")
frak ๐”“frak(P)
frak(P)
frak(body: content)
inline โˆ‘๐‘–๐‘ฅ๐‘–inline(sum_i x_i)
inline(sum_i x_i)
inline(body: content, cramped: boolean = false)
italic ๐›คitalic(Gamma)
italic(Gamma)
italic(body: content)
limits ๐ด12limits(A)_1^2
limits(A)_1^2
limits(body: content, inline: boolean = true)
lr ]๐‘Ž๐‘]lr(]a/b])
lr(]a/b])
lr(size: relative length = 100% + 0pt, body: content)
mat (1234)mat(1, 2; 3, 4)
mat(1, 2; 3, 4)
mat(delim: array or none or symbol or string = ("(", ")"), align: alignment = center, augment: integer or dictionary or none = none, gap: relative length = 0% + 0pt, row-gap: relative length = 0% + 0.2em, column-gap: relative length = 0% + 0.5em, ..rows: array)
mid {๐‘ฅ|๐‘ฅ>0}lr({ x mid(bar.v) x > 0 })
lr({ x mid(bar.v) x > 0 })
mid(body: content)
mono ๐šก+๐Ÿทmono(x + 1)
mono(x + 1)
mono(body: content)
norm โ€–๐‘ฅโ€–norm(x)
norm(x)
norm(size: relative length, body: content)
op rank๐ดop("rank") A
op("rank") A
op(text: content, limits: boolean = false)
overbrace 1+2โž๐‘›overbrace(1 + 2, n)
overbrace(1 + 2, n)
overbrace(body: content, annotation: content or none)
overbracket 1+2โŽด๐‘›overbracket(1 + 2, n)
overbracket(1 + 2, n)
overbracket(body: content, annotation: content or none)
overline ๐‘งโ€พoverline(z)
overline(z)
overline(body: content)
overparen ๐‘Ž๐‘โœ๐‘›overparen(a b, n)
overparen(a b, n)
overparen(body: content, annotation: content or none)
overshell ๐‘Ž๐‘โ ๐‘›overshell(a b, n)
overshell(a b, n)
overshell(body: content, annotation: content or none)
primes ๐‘“โ€ณattach(f, tr: primes(#2))
attach(f, tr: primes(#2))
primes(count: integer)
root ๐‘ฅ3root(3, x)
root(3, x)
root(index: content or none, radicand: content)
round โŒŠ๐‘ฅโŒ‰round(x)
round(x)
round(size: relative length, body: content)
sans ๐˜ˆsans(A)
sans(A)
sans(body: content)
scr โ„’๏ธscr(L)
scr(L)
scr(body: content)
script ๐‘ฅ๐‘ฅx script(x)
x script(x)
script(body: content, cramped: boolean = true)
scripts โˆ‘12scripts(sum)_1^2
scripts(sum)_1^2
scripts(body: content)
serif ๐ด๐ต๐ถserif(A B C)
serif(A B C)
serif(body: content)
sqrt ๐‘ฅsqrt(x)
sqrt(x)
sqrt(radicand: content)
sscript ๐‘ฅ๐‘ฅx sscript(x)
x sscript(x)
sscript(body: content, cramped: boolean = true)
stretch =defstretch(=)^"def"
stretch(=)^"def"
stretch(body: content, size: relative length = 100% + 0pt)
text ๐‘ฅtext(fill: #red, x)
text(fill: #red, x)
text(font: string or dictionary or array = "libertinus serif", fallback: boolean = true, style: "normal" or "italic" or "oblique" = "normal", weight: integer or "thin" or "extralight" or "light" or "regular" or "medium" or "semibold" or "bold" or "extrabold" or "black" = "regular", stretch: ratio = 100%, size: length = 11pt, fill: color or gradient or tiling = luma(0%), stroke: length or color or gradient or tiling or dictionary or stroke or none = none, tracking: length = 0pt, spacing: relative length = 100% + 0pt, cjk-latin-spacing: none or auto = auto, baseline: length = 0pt, overhang: boolean = true, top-edge: "ascender" or "cap-height" or "x-height" or "baseline" or "bounds" or length = "cap-height", bottom-edge: "baseline" or "descender" or "bounds" or length = "baseline", lang: string = "en", region: string or none = none, script: string or auto = auto, dir: direction or auto = auto, hyphenate: boolean or auto = auto, costs: dictionary = (hyphenation: 100%, runt: 100%, widow: 100%, orphan: 100%), kerning: boolean = true, alternates: boolean or integer = 0, stylistic-set: none or integer or array = (), ligatures: boolean = true, discretionary-ligatures: boolean = false, historical-ligatures: boolean = false, number-type: "lining" or "old-style" or auto = auto, number-width: "proportional" or "tabular" or auto = auto, slashed-zero: boolean = false, fractions: boolean = false, features: array or dictionary = (:), variations: dictionary = (:), body: content = [], text: string)
underbrace 1+2โŸ๐‘›underbrace(1 + 2, n)
underbrace(1 + 2, n)
underbrace(body: content, annotation: content or none)
underbracket 1+2โŽต๐‘›underbracket(1 + 2, n)
underbracket(1 + 2, n)
underbracket(body: content, annotation: content or none)
underline ๐‘ฅ_underline(x)
underline(x)
underline(body: content)
underparen ๐‘Ž๐‘โ๐‘›underparen(a b, n)
underparen(a b, n)
underparen(body: content, annotation: content or none)
undershell ๐‘Ž๐‘โก๐‘›undershell(a b, n)
undershell(a b, n)
undershell(body: content, annotation: content or none)
upright xupright(x)
upright(x)
upright(body: content)
vec (123)vec(1, 2, 3)
vec(1, 2, 3)
vec(delim: array or none or symbol or string = ("(", ")"), align: alignment = center, gap: relative length = 0% + 0.2em, ..children: content)

Text operators, upright with spacing: Pr, arccos, arcsin, arctan, arg, cos, cosh, cot, coth, csc, csch, ctg, deg, det, dim, exp, gcd, hom, id, im, inf, ker, lcm, lg, lim, liminf, limsup, ln, log, max, min, mod, sec, sech, sin, sinc, sinh, sup, tan, tanh, tg, tr.

Spacings: med, quad, thick, thin, wide.

Symbols: all 334 symbols of the sym module, with 1206 variants by modifier, as in codex 0.3.0, including deprecated names with Typst's warnings.

Embedded code

Code after #, in the arguments of math calls, and in a preamble:

Functions in code:

Function Example Parameters
box ๐‘ฅ#box(stroke: 0.5pt, inset: 2pt, $x$)
#box(stroke: 0.5pt, inset: 2pt, $x$)
box(width: auto or relative length or fraction = auto, height: relative length or auto = auto, baseline: alignment or auto or relative length or dictionary = (at: auto, shift: 0% + 0pt), fill: color or gradient or tiling or none = none, stroke: length or color or gradient or tiling or dictionary or stroke or none = (:), radius: relative length or dictionary = (:), inset: relative length or dictionary = (:), outset: relative length or dictionary = (:), clip: boolean = false, body: content or none)
emph emphasis#emph[emphasis]
#emph[emphasis]
emph(body: content)
h ๐‘Ž๐‘a #h(1em) b
a #h(1em) b
h(amount: relative length or fraction, weak: boolean = false)
hide ๐‘Žb๐‘a #hide[b] c
a #hide[b] c
hide(body: content)
highlight ๐‘ฅ#highlight[$x$]
#highlight[$x$]
highlight(fill: color or gradient or tiling or none = rgb("#fffd11a1"), stroke: length or color or gradient or tiling or dictionary or stroke or none = (:), top-edge: "ascender" or "cap-height" or "x-height" or "baseline" or "bounds" or length = "ascender", bottom-edge: "baseline" or "descender" or "bounds" or length = "descender", extent: length = 0pt, radius: relative length or dictionary = (:), body: content)
link Typst#link("https://typst.app")[Typst]
#link("https://typst.app")[Typst]
link(dest: string or dictionary or location or label, body: content)
luma x#text(fill: luma(40%))[x]
#text(fill: luma(40%))[x]
luma(lightness: integer or ratio, alpha: ratio, color: color)
rgb x#text(fill: rgb("#2156b5"))[x]
#text(fill: rgb("#2156b5"))[x]
rgb(red: integer or ratio, green: integer or ratio, blue: integer or ratio, alpha: integer or ratio, hex: string, color: color)
strong strong#strong[strong]
#strong[strong]
strong(delta: integer = 300, body: content)
text blue#text(fill: blue)[blue]
#text(fill: blue)[blue]
text(font: string or dictionary or array = "libertinus serif", fallback: boolean = true, style: "normal" or "italic" or "oblique" = "normal", weight: integer or "thin" or "extralight" or "light" or "regular" or "medium" or "semibold" or "bold" or "extrabold" or "black" = "regular", stretch: ratio = 100%, size: length = 11pt, fill: color or gradient or tiling = luma(0%), stroke: length or color or gradient or tiling or dictionary or stroke or none = none, tracking: length = 0pt, spacing: relative length = 100% + 0pt, cjk-latin-spacing: none or auto = auto, baseline: length = 0pt, overhang: boolean = true, top-edge: "ascender" or "cap-height" or "x-height" or "baseline" or "bounds" or length = "cap-height", bottom-edge: "baseline" or "descender" or "bounds" or length = "baseline", lang: string = "en", region: string or none = none, script: string or auto = auto, dir: direction or auto = auto, hyphenate: boolean or auto = auto, costs: dictionary = (hyphenation: 100%, runt: 100%, widow: 100%, orphan: 100%), kerning: boolean = true, alternates: boolean or integer = 0, stylistic-set: none or integer or array = (), ligatures: boolean = true, discretionary-ligatures: boolean = false, historical-ligatures: boolean = false, number-type: "lining" or "old-style" or auto = auto, number-width: "proportional" or "tabular" or auto = auto, slashed-zero: boolean = false, fractions: boolean = false, features: array or dictionary = (:), variations: dictionary = (:), body: content = [], text: string)

Constants: the colors aqua, black, blue, eastern, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, yellow, and the alignments bottom, center, end, horizon, left, right, start, top. Modules: sym and math.

Not supported

Typlet refuses what it doesn't support with a TypletError of kind unsupported, which the fallback option can render another way. These names of Typst's global scope are not supported:

Nor are loops, methods of values, assignments, imports, show rules other than show math.equation: set โ€ฆ, with or without where(block: โ€ฆ), and the markup of documents: headings, lists, references and figures. Loops, range and methods are the planned Level 4 (docs/DESIGN.md ยง6.3); other show rules, introspection and file access are not planned.

The HTML output also refuses what it can't draw yet, and draws those formulas as MathML with a warning: characters New Computer Modern Math lacks, raw text, fonts other than New Computer Modern Math, the Regular weight, bold math letters, text strokes, OpenType features, right-to-left text with punctuation at its ends, text that wraps in a box, clipped boxes, and boxes with sizes relative to the page.