TypstDocumentation

pageShowable
Question mark

Layouts its child onto one or multiple pages.

Although this function is primarily used in set rules to affect page properties, it can also be used to explicitly render its argument onto a set of pages of its own.

Pages can be set to use auto as their width or height. In this case, the pages will grow to fit their content on the respective axis.

Example

#set page("us-letter")

There you go, US friends!
Preview

Parameters
Question mark

body
contentRequiredPositional
Question mark

The contents of the page(s).

Multiple pages will be created if the content does not fit on a single page. A new page with the page properties prior to the function invocation will be created after the body has been typeset.

paper
stringPositional
Question mark
Settable
Question mark

A standard paper size to set width and height. When this is not specified, Typst defaults to "a4" paper.

width
autolengthSettable
Question mark

The width of the page.

#set page(
  width: 3cm,
  margin: (x: 0cm),
)

#for i in range(3) {
  box(square(width: 1cm))
}
Preview

height
autolengthSettable
Question mark

The height of the page.

If this is set to auto, page breaks can only be triggered manually by inserting a page break. Most examples throughout this documentation use auto for the height of the page to dynamically grow and shrink to fit their content.

flipped
booleanSettable
Question mark

Whether the page is flipped into landscape orientation.

#set page(
  "us-business-card",
  flipped: true,
  fill: rgb("f2e5dd"),
)

#set align(bottom + end)
#text(14pt)[*Sam H. Richards*] \
_Procurement Manager_

#set text(10pt)
17 Main Street \
New York, NY 10001 \
+1 555 555 5555
Preview

margin
autorelative lengthdictionarySettable
Question mark

The page's margins.

#set page(
 width: 3cm,
 height: 4cm,
 margin: (x: 8pt, y: 4pt),
)

#rect(
  width: 100%,
  height: 100%,
  fill: aqua,
)
Preview

columns
integerSettable
Question mark

How many columns the page has.

#set page(columns: 2, height: 4.8cm)
Climate change is one of the most
pressing issues of our time, with
the potential to devastate
communities, ecosystems, and
economies around the world. It's
clear that we need to take urgent
action to reduce our carbon
emissions and mitigate the impacts
of a rapidly changing climate.
Preview

fill
nonecolorSettable
Question mark

The page's background color.

This instructs the printer to color the complete page with the given color. If you are considering larger production runs, it may be more environmentally friendly and cost-effective to source pre-dyed pages and not set this property.

#set page(fill: rgb("444352"))
#set text(fill: rgb("fdfdfd"))
*Dark mode enabled.*
Preview

header
nonecontentfunctionSettable
Question mark

The page's header.

The header is placed at in the top margin of each page.

#set par(justify: true)
#set page(
  margin: (x: 24pt, y: 32pt),
  header: align(horizon + right, text(8pt)[_Exercise Sheet 3_]),
)

#lorem(18)
Preview

The page's footer.

The footer is placed at in the bottom margin of each page.

#set par(justify: true)
#set page(
  margin: (x: 24pt, y: 32pt),
  footer: i => align(horizon + right,
    text(8pt, numbering("I", i))
  )
)

#lorem(18)
Preview

background
nonecontentfunctionSettable
Question mark

Content in the page's background.

This content will be placed behind the page's body. It can be used to place a background image or a watermark.

#set page(background: align(
  center + horizon,
  rotate(24deg,
    text(18pt, fill: rgb("FFCBC4"))[*CONFIDENTIAL*]
  ),
))

= Typst's secret plans

In the year 2023, we plan to take over the world
(of typesetting).
Preview

foreground
nonecontentfunctionSettable
Question mark

Content in the page's foreground.

This content will overlay the page's body.

#set page(foreground: align(
  center + horizon,
  text(24pt)[🥸],
))

Reviewer 2 has marked our paper
"Weak Reject" because they did
not understand our approach...
Preview