注意 当サイトは、Typst v0.11.1 公式ドキュメントを、日本語コミュニティが非公式に翻訳したものです。誤訳・未訳・古い情報が含まれている可能性があるため、公式ドキュメント との併用を推奨します。このサイトの内容に誤りを発見された方は、GitHubリポジトリまでご報告を頂けましたら幸いです。我々のコミュニティにご興味のある方は、ぜひ非公式Discordサーバー「くみはんクラブ」にご参加ください。
Warning: This site provides an unofficial translation of the Typst v0.11.1 documentation by the Japanese Community. Please note that there may be some inaccuracies, untranslated sections or outdated information. We highly recommend referring to the latest official documentation as well. If you find any errors in the content, please let us know through our GitHub repository. If you are interested in our community, feel free to join our unofficial Discord server, “Kumihan Club.”
Typst ドキュメント日本語版

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

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.

The Guide for Page Setup explains how to use this and related functions to set up a document with many examples.

Example

#set page("us-letter")

There you go, US friends!
Preview

Parameters
Parameters are the inputs to a function. They are specified in parentheses after the function name.

paper
str
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

A standard paper size to set width and height.

Default:"a4"

width
auto length
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The width of the page.

Default:595.28pt

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

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

height
auto length
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

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.

Default:841.89pt

flipped
bool
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

Whether the page is flipped into landscape orientation.

Default:false

View example
#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
auto relative dictionary
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The page's margins.

The values for left and right are mutually exclusive with the values for inside and outside.

Default:auto

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

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

binding
auto alignment
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

On which side the pages will be bound.

This affects the meaning of the inside and outside options for margins.

Default:auto

columns
int
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

How many columns the page has.

If you need to insert columns into a page or other container, you can also use the columns function.

Default:1

View example
#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
none color gradient pattern
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

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.

Default:none

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

numbering
none str function
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

How to number the pages.

If an explicit footer (or header for top-aligned numbering) is given, the numbering is ignored.

Default:none

View example
#set page(
  height: 100pt,
  margin: (top: 16pt, bottom: 24pt),
  numbering: "1 / 1",
)

#lorem(48)
Preview

number-align
alignment
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The alignment of the page numbering.

If the vertical component is top, the numbering is placed into the header and if it is bottom, it is placed in the footer. Horizon alignment is forbidden. If an explicit matching header or footer is given, the numbering is ignored.

Default:center + bottom

View example
#set page(
  margin: (top: 16pt, bottom: 24pt),
  numbering: "1",
  number-align: right,
)

#lorem(30)
Preview

header
none content
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The page's header. Fills the top margin of each page.

Default:none

View example
#set par(justify: true)
#set page(
  margin: (top: 32pt, bottom: 20pt),
  header: [
    #set text(8pt)
    #smallcaps[Typst Academcy]
    #h(1fr) _Exercise Sheet 3_
  ],
)

#lorem(19)
Preview

header-ascent
relative
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The amount the header is raised into the top margin.

Default:30%

The page's footer. Fills the bottom margin of each page.

For just a page number, the numbering property, typically suffices. If you want to create a custom footer, but still display the page number, you can directly access the page counter.

Default:none

View example
#set par(justify: true)
#set page(
  height: 100pt,
  margin: 20pt,
  footer: context [
    #set align(right)
    #set text(8pt)
    #counter(page).display(
      "1 of I",
      both: true,
    )
  ]
)

#lorem(48)
Preview

The amount the footer is lowered into the bottom margin.

Default:30%

background
none content
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

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.

Default:none

View example
#set page(background: 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
none content
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

Content in the page's foreground.

This content will overlay the page's body.

Default:none

View example
#set page(foreground: text(24pt)[🥸])

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

body
content
RequiredPositional
Positional parameters are specified in order, without names.

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.