Documentation

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] } $

Functions

lrElement
Question mark
Go to source

Scales delimiters.

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

math.lr() → content

size
relative
Settable
Question mark
Default: 100% + 0pt

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

body
content
RequiredPositional
Question mark

The delimited content, including the delimiters.

midElement
Question mark
Go to source

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

ExpandView example
$ { x mid(|) sum_(i=1)^n w_i|f_i (x)| < 1 } $
math.mid(content) → content

body
content
RequiredPositional
Question mark

The content to be scaled.

absGo to source

Takes the absolute value of an expression.

ExpandView example
$ abs(x/2) $
math.abs() → content

size

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

Default: The current value of lr.size.

body
content
RequiredPositional
Question mark

The expression to take the absolute value of.

normGo to source

Takes the norm of an expression.

ExpandView example
$ norm(x/2) $
math.norm() → content

size

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

Default: The current value of lr.size.

body
content
RequiredPositional
Question mark

The expression to take the norm of.

floorGo to source

Floors an expression.

ExpandView example
$ floor(x/2) $
math.floor() → content

size

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

Default: The current value of lr.size.

body
content
RequiredPositional
Question mark

The expression to floor.

ceilGo to source

Ceils an expression.

ExpandView example
$ ceil(x/2) $
math.ceil() → content

size

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

Default: The current value of lr.size.

body
content
RequiredPositional
Question mark

The expression to ceil.

roundGo to source

Rounds an expression.

ExpandView example
$ round(x/2) $
math.round() → content

size

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

Default: The current value of lr.size.

body
content
RequiredPositional
Question mark

The expression to round.