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(size: relative length, body: content) |
accent |
accent(a, arrow) |
accent(base: content, accent: string or content, size: relative length = 100% + 0pt, dotless: boolean = true) |
attach |
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(body: content) |
binom |
binom(n, k) |
binom(upper: content, ..lower: content) |
bold |
bold(A) + A |
bold(body: content) |
cal |
cal(A) |
cal(body: content) |
cancel |
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 |
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 |
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(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(num: content, denom: content, style: "vertical" or "skewed" or "horizontal" = "vertical") |
frak |
frak(P) |
frak(body: content) |
inline |
inline(sum_i x_i) |
inline(body: content, cramped: boolean = false) |
italic |
italic(Gamma) |
italic(body: content) |
limits |
limits(A)_1^2 |
limits(body: content, inline: boolean = true) |
lr |
lr(]a/b]) |
lr(size: relative length = 100% + 0pt, body: content) |
mat |
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 |
lr({ x mid(bar.v) x > 0 }) |
mid(body: content) |
mono |
mono(x + 1) |
mono(body: content) |
norm |
norm(x) |
norm(size: relative length, body: content) |
op |
op("rank") A |
op(text: content, limits: boolean = false) |
overbrace |
overbrace(1 + 2, n) |
overbrace(body: content, annotation: content or none) |
overbracket |
overbracket(1 + 2, n) |
overbracket(body: content, annotation: content or none) |
overline |
overline(z) |
overline(body: content) |
overparen |
overparen(a b, n) |
overparen(body: content, annotation: content or none) |
overshell |
overshell(a b, n) |
overshell(body: content, annotation: content or none) |
primes |
attach(f, tr: primes(#2)) |
primes(count: integer) |
root |
root(3, x) |
root(index: content or none, radicand: content) |
round |
round(x) |
round(size: relative length, body: content) |
sans |
sans(A) |
sans(body: content) |
scr |
scr(L) |
scr(body: content) |
script |
x script(x) |
script(body: content, cramped: boolean = true) |
scripts |
scripts(sum)_1^2 |
scripts(body: content) |
serif |
serif(A B C) |
serif(body: content) |
sqrt |
sqrt(x) |
sqrt(radicand: content) |
sscript |
x sscript(x) |
sscript(body: content, cramped: boolean = true) |
stretch |
stretch(=)^"def" |
stretch(body: content, size: relative length = 100% + 0pt) |
text |
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 |
underbrace(1 + 2, n) |
underbrace(body: content, annotation: content or none) |
underbracket |
underbracket(1 + 2, n) |
underbracket(body: content, annotation: content or none) |
underline |
underline(x) |
underline(body: content) |
underparen |
underparen(a b, n) |
underparen(body: content, annotation: content or none) |
undershell |
undershell(a b, n) |
undershell(body: content, annotation: content or none) |
upright |
upright(x) |
upright(body: content) |
vec |
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:
- Values:
none,auto, booleans, integers, floats, lengths, angles, ratios, relative lengths, fractions, strings, arrays, dictionaries, colors, alignments, strokes, symbols, content, functions and modules, with Typst's operators and errors. - Definitions:
letbindings with destructuring, functions with positional and named parameters, defaults and argument sinks, closures with captures, and recursion within the budgets. - Control flow:
ifandelse, code blocks,return,breakandcontinue. - Markup in content blocks: text, strong and emphasis, escapes, shorthands, smart quotes, raw text, labels, line breaks and nested equations.
- Set rules for the functions below that have settable parameters, and for the math elements: in a content or code block, or in the preamble.
Functions in code:
| Function | Example | Parameters |
|---|---|---|
box |
#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 |
#emph[emphasis] |
emph(body: content) |
h |
a #h(1em) b |
h(amount: relative length or fraction, weak: boolean = false) |
hide |
a #hide[b] c |
hide(body: content) |
highlight |
#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 |
#link("https://typst.app")[Typst] |
link(dest: string or dictionary or location or label, body: content) |
luma |
#text(fill: luma(40%))[x] |
luma(lightness: integer or ratio, alpha: ratio, color: color) |
rgb |
#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(delta: integer = 300, body: content) |
text |
#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:
- Functions:
repr,panic,assert,eval,plugin,target,document,par,parbreak,list,enum,terms,title,heading,divider,figure,quote,footnote,outline,ref,cite,bibliography,table,numbering,linebreak,smartquote,sub,super,underline,overline,strike,smallcaps,raw,lower,upper,lorem,page,pagebreak,v,block,stack,grid,columns,colbreak,place,align,pad,repeat,move,scale,rotate,skew,measure,layout,image,line,rect,square,ellipse,circle,polygon,curve,metadata,here,query,locate,read,csv,json,toml,yaml,cbor,xml,oklab,oklch,cmyk,range. - Types:
bool,int,float,str,label,bytes,content,array,dictionary,function,arguments,type,module,regex,selector,datetime,decimal,symbol,duration,version,path,length,angle,ratio,relative,fraction,direction,alignment,color,gradient,tiling,stroke,location,counter,state. - Modules:
calc,sys,emoji,pdf. - Directions:
ltr,rtl,ttb,btt.
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.