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

location

Identifies an element in the document.

A location uniquely identifies an element in the document and lets you access its absolute position on the pages. You can retrieve the current location with the here function and the location of a queried or shown element with the location() method on content.

Locatable elements

Currently, only a subset of element functions is locatable. Aside from headings and figures, this includes equations, references and all elements with an explicit label. As a result, you can query for e.g. strong elements, but you will find only those that have an explicit label attached to them. This limitation will be resolved in the future.

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.

page

Returns the page number for this location.

Note that this does not return the value of the page counter at this location, but the true page number (starting from one).

If you want to know the value of the page counter, use counter(page).at(loc) instead.

Can be used with here to retrieve the physical page position of the current context:

self.page(
) -> int
View example
#context [
  I am located on
  page #here().page()
]
Preview

position

Returns a dictionary with the page number and the x, y position for this location. The page number starts at one and the coordinates are measured from the top-left of the page.

If you only need the page number, use page() instead as it allows Typst to skip unnecessary work.

self.position(
) -> dictionary

page-numbering

Returns the page numbering pattern of the page at this location. This can be used when displaying the page counter in order to obtain the local numbering. This is useful if you are building custom indices or outlines.

If the page numbering is set to none at that location, this function returns none.

self.page-numbering(
) -> nonestrfunction