Info
This site is generated using the static site generator developed by the Typst Community. Please adjust the text content of this banner according to your usage requirements. At Typst GmbH's request, when publishing documentation, you must clearly indicate that it is non-official and display the version of Typst being documented. For details, refer to Issue #874 on typst/typst.
TypstDocumentEnglish
v0.dev.2025-09-12

Left/Right

Delimiter matching.

The lr function allows you to match two delimiters and scale them with the content they contain. While this also happens automatically for delimiters that match syntactically, lr allows you to match two arbitrary delimiters and control their size exactly. Apart from the lr function, Typst provides a few more functions that create delimiter pairings for absolute, ceiled, and floored values as well as norms.

To prevent a delimiter from being matched by Typst, and thus auto-scaled, escape it with a backslash. To instead disable auto-scaling completely, use set math.lr(size: 1em).

Example

$ [a, b/2] $
$ lr(]sum_(x=1)^n], size: #50%) x $
$ abs((x + y) / 2) $
$ \{ (x / y) \} $
#set math.lr(size: 1em)
$ { (a / b), a, b in (0; 1/2] } $
Preview

Function

lr
Element
Element
Element functions can be customized with set and show rules.

Scales delimiters.

While matched delimiters scale by default, this can be used to scale unmatched delimiters and to control the delimiter scaling more precisely.

size
Settable
Settable
Settable parameters can be set using the set rule, changing the default value used thereafter.

The size of the brackets, relative to the height of the wrapped content.

Default value:

100% + 0pt

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The delimited content, including the delimiters.

mid
Element
Element
Element functions can be customized with set and show rules.

Scales delimiters vertically to the nearest surrounding lr() group.

math.mid()->
$ { x mid(|) sum_(i=1)^n w_i|f_i (x)| < 1 } $
Preview

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The content to be scaled.

abs

Takes the absolute value of an expression.

$ abs(x/2) $
Preview

size

The size of the brackets, relative to the height of the wrapped content.

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The expression to take the absolute value of.

norm

Takes the norm of an expression.

$ norm(x/2) $
Preview

size

The size of the brackets, relative to the height of the wrapped content.

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The expression to take the norm of.

floor

Floors an expression.

$ floor(x/2) $
Preview

size

The size of the brackets, relative to the height of the wrapped content.

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The expression to floor.

ceil

Ceils an expression.

$ ceil(x/2) $
Preview

size

The size of the brackets, relative to the height of the wrapped content.

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The expression to ceil.

round

Rounds an expression.

$ round(x/2) $
Preview

size

The size of the brackets, relative to the height of the wrapped content.

body
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The expression to round.

Open official docs

Search