注意 当サイトは、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 ドキュメント日本語版

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

A closed polygon.

The polygon is defined by its corner points and is closed automatically.

Example

#polygon(
  fill: blue.lighten(80%),
  stroke: blue,
  (20%, 0pt),
  (60%, 0pt),
  (80%, 2cm),
  (0%,  2cm),
)
Preview

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

fill
none color gradient pattern
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

How to fill the polygon.

When setting a fill, the default stroke disappears. To create a rectangle with both fill and stroke, you have to configure both.

Currently all polygons are filled according to the non-zero winding rule.

Default:none

stroke
none auto length color gradient stroke pattern dictionary
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

How to stroke the polygon. This can be:

Can be set to none to disable the stroke or to auto for a stroke of 1pt black if and if only if no fill is given.

Default:auto

vertices
array
RequiredPositional
Positional parameters are specified in order, without names.
Variadic
Variadic parameters can be specified multiple times.

The vertices of the polygon. Each point is specified as an array of two relative lengths.

Definitions
Functions and types and can have associated definitions. These are accessed by specifying the function or type, followed by a period, and then the definition's name.

regular

A regular polygon, defined by its size and number of vertices.

View example
#polygon.regular(
  fill: blue.lighten(80%),
  stroke: blue,
  size: 30pt,
  vertices: 3,
)
Preview

fill

How to fill the polygon. See the general polygon's documentation for more details.

stroke

How to stroke the polygon. See the general polygon's documentation for more details.

size

The diameter of the circumcircle of the regular polygon.

Default:1em

vertices
int

The number of vertices in the polygon.

Default:3