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

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

Adds spacing around content.

The spacing can be specified for each side individually, or for all sides at once by specifying a positional argument.

Example

#set align(center)

#pad(x: 16pt, image("typing.jpg"))
_Typing speeds can be
 measured in words per minute._
Preview

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

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

The padding at the left side.

Default value:

0% + 0pt

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

The padding at the top side.

Default value:

0% + 0pt

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

The padding at the right side.

Default value:

0% + 0pt

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

The padding at the bottom side.

Default value:

0% + 0pt

x

A shorthand to set left and right to the same value.

Default value:

0% + 0pt

y

A shorthand to set top and bottom to the same value.

Default value:

0% + 0pt

rest

A shorthand to set all four sides to the same value.

Default value:

0% + 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 content to pad at the sides.

Open official docs

Search