情報アイコン
情報 / 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".
言語アイコン
未翻訳

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

arguments

Captured arguments to a function.

Argument Sinks

Like built-in functions, custom functions can also take a variable number of arguments. You can specify an argument sink which collects all excess arguments as ..sink. The resulting sink value is of the arguments type. It exposes methods to access the positional and named arguments.

#let format(title, ..authors) = {
  let by = authors
    .pos()
    .join(", ", last: " and ")

  [*#title* \ _Written by #by;_]
}

#format("ArtosFlow", "Jane", "Joe")
Preview

Spreading

Inversely to an argument sink, you can spread arguments, arrays and dictionaries into a function call with the ..spread operator:

#let array = (2, 3, 5)
#calc.min(..array)
#let dict = (fill: blue)
#text(..dict)[Hello]
Preview

コンストラクタ
ヘルプアイコン

Construct spreadable arguments in place.

This function behaves like let args(..sink) = sink.

arguments(
any
)->
#let args = arguments(stroke: red, inset: 1em, [Body])
#box(..args)
Preview

arguments
any
Required
ヘルプアイコン
Positional
ヘルプアイコン
Variadic
ヘルプアイコン

The arguments to construct.

定義
ヘルプアイコン

at

Returns the positional argument at the specified index, or the named argument with the specified name.

If the key is an integer, this is equivalent to first calling pos and then array.at. If it is a string, this is equivalent to first calling named and then dictionary.at.

self.at()->
any

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

The index or name of the argument to get.

default
any

A default value to return if the key is invalid.

pos

Returns the captured positional arguments as an array.

self.pos(
)->

named

Returns the captured named arguments as a dictionary.

self.named(
)->

検索