情報アイコン
情報 / Info
当サイトは、Typst GmbHの許諾を得て、日本語コミュニティ「Typst Japan Community」がTypst v0.13.1の公式ドキュメントを翻訳したものです。誤訳や古い情報が含まれている可能性があるため、公式ドキュメントとの併用を推奨します。翻訳の改善やサイトの機能向上について、GitHubでのIssueやPull Requestを歓迎します。コミュニティにご興味のある方はDiscordサーバー「くみはんクラブ」にぜひご参加ください。
This site provides a Japanese translation of the Typst v0.13.1 documentation maintained by the "Typst Japan Community" with permission from Typst GmbH. We recommend using this alongside the official documentation. We welcome contributions through Issues and Pull Requests on our GitHub repository for both translation improvements and website enhancements. Feel free to join our Discord server "Kumihan Club".
言語アイコン
未翻訳

このページはまだ翻訳されていません。原文の内容が表示されています。

content

A piece of document content.

This type is at the heart of Typst. All markup you write and most functions you call produce content values. You can create a content value by enclosing markup in square brackets. This is also how you pass content to functions.

Example

Type of *Hello!* is
#type([*Hello!*])
Preview

Content can be added with the + operator, joined together and multiplied with integers. Wherever content is expected, you can also pass a string or none.

Representation

Content consists of elements with fields. When constructing an element with its element function, you provide these fields as arguments and when you have a content value, you can access its fields with field access syntax.

Some fields are required: These must be provided when constructing an element and as a consequence, they are always available through field access on content of that type. Required fields are marked as such in the documentation.

Most fields are optional: Like required fields, they can be passed to the element function to configure them for a single element. However, these can also be configured with set rules to apply them to all elements within a scope. Optional fields are only available with field access syntax when they were explicitly passed to the element function, not when they result from a set rule.

Each element has a default appearance. However, you can also completely customize its appearance with a show rule. The show rule is passed the element. It can access the element's field and produce arbitrary content from it.

In the web app, you can hover over a content variable to see exactly which elements the content is composed of and what fields they have. Alternatively, you can inspect the output of the repr function.

定義
ヘルプアイコン

func

The content's element function. This function can be used to create the element contained in this content. It can be used in set and show rules for the element. Can be compared with global functions to check whether you have a specific kind of element.

self.func(
)->

has

Whether the content has the specified field.

self.has()->

field
Required
ヘルプアイコン
Positional
ヘルプアイコン

The field to look for.

at

Access the specified field on the content. Returns the default value if the field does not exist or fails with an error if no default value was specified.

self.at()->
any

field
Required
ヘルプアイコン
Positional
ヘルプアイコン

The field to access.

default
any

A default value to return if the field does not exist.

fields

Returns the fields of this content.

self.fields(
)->
右矢印アイコン
例を表示
#rect(
  width: 10cm,
  height: 10cm,
).fields()
Preview

location

The location of the content. This is only available on content returned by query or provided by a show rule, for other content it will be none. The resulting location can be used with counters, state and queries.

self.location(
)->

検索