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

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

Forced use of a certain math class.

This is useful to treat certain symbols as if they were of a different class, e.g. to make a symbol behave like a relation. The class of a symbol defines the way it is laid out, including spacing around it, and how its scripts are attached by default. Note that the latter can always be overridden using limits and scripts.

Example

#let loves = math.class(
  "relation",
  sym.suit.heart,
)

$x loves y and y loves 5$
Preview

Parameter
Parameter
Parameters are input values for functions. Specify them in parentheses after the function name.

math.class()->

class
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 class to apply to the content.

Available string values:
  • normal

    The default class for non-special things.

  • punctuation

    Punctuation, e.g. a comma.

  • opening

    An opening delimiter, e.g. (.

  • closing

    A closing delimiter, e.g. ).

  • fence

    A delimiter that is the same on both sides, e.g. |.

  • large

    A large operator like sum.

  • relation

    A relation like = or prec.

  • unary

    A unary operator like not.

  • binary

    A binary operator like times.

  • vary

    An operator that can be both unary or binary like +.

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 which the class is applied.

Open official docs

Search