未翻訳
このページはまだ翻訳されていません。原文の内容が表示されています。
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")

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]

コンストラクタParameters are the inputs to a function. They are specified in parentheses after the function name.
Parameters are the inputs to a function. They are specified in parentheses after the function name.
Construct spreadable arguments in place.
This function behaves like let args(..sink) = sink
.
#let args = arguments(stroke: red, inset: 1em, [Body])
#box(..args)

arguments
anyRequiredRequired parameters must be specified when calling the function.PositionalPositional parameters are specified in order, without names.VariadicVariadic parameters can be specified multiple times.
any
Required
Required parameters must be specified when calling the function.
Positional
Positional parameters are specified in order, without names.
Variadic
Variadic parameters can be specified multiple times.
The arguments to construct.
定義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.
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.