未翻訳
このページはまだ翻訳されていません。原文の内容が表示されています。
eval
Evaluates a string as Typst code.
This function should only be used as a last resort.
Example
#eval("1 + 1") \
#eval("(1, 2, 3, 4)").len() \
#eval("*Markup!*", mode: "markup") \

引数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.
source
RequiredRequired parameters must be specified when calling the function.PositionalPositional parameters are specified in order, without names.
Required
Required parameters must be specified when calling the function.
Positional
Positional parameters are specified in order, without names.
A string of Typst code to evaluate.
mode
The syntactical mode in which the string is parsed.
使用可能な文字列値:
code
Evaluate as code, as after a hash.
markup
Evaluate as markup, like in a Typst file.
math
Evaluate as math, as in an equation.
デフォルト値: "code"
例を表示
#eval("= Heading", mode: "markup")
#eval("1_2^3", mode: "math")

scope
A scope of definitions that are made available.
デフォルト値: (:)
例を表示
#eval("x + 1", scope: (x: 2)) \
#eval(
"abc/xyz",
mode: "math",
scope: (
abc: $a + b + c$,
xyz: $x + y + z$,
),
)
