注意:该中文文档为社区驱动的非官网文档,可能存在错译、漏译或过时等问题,请以官网文档 Documentation 为准,如发现错漏,也欢迎 您的贡献镜像)。Typst 非官方中文交流 QQ 群:793548390
Warning: the Chinese document is a community-driven non-official document, there may be mistranslation, omission or outdated problems, please refer to the official website documentation.
Typst 中文文档

equation 元素
元素函数可以通过 set 和 show 规则进行样式自定义。

数学表达式。

可以为内联显示或作为单独的文本块显示。

Example

#set text(font: "New Computer Modern")

Let $a$, $b$, and $c$ be the side
lengths of right-angled triangle.
Then, we know that:
$ a^2 + b^2 = c^2 $

Prove by induction:
$ sum_(k=1)^n k = (n(n+1)) / 2 $
Preview

语法

该函数也有一个专用语法: 在美元符号内编写数学标记以创建表达式。 在表达式开头和结尾添加至少一个空格,可以将其提升至水平居中的单独的文本块中显示中。详情请参考: math 页面.

参数
参数是函数的输入,它们在函数名称后面的括号中传入。

block
bool
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

Whether the equation is displayed as a separate block.

默认:false

numbering
none str function
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

如何对表达式进行 编号

默认:none

查看示例
#set math.equation(numbering: "(1)")

We define:
$ phi.alt := (1 + sqrt(5)) / 2 $ <ratio>

With @ratio, we get:
$ F_n = floor(1 / sqrt(5) phi.alt^n) $
Preview

supplement
none auto content function
可用 Set 规则
可以使用 Set 规则,为函数后续所有的使用设置默认参数。

数学表达式的补充内容。

添加在被引用的公式编号的前面。

如果指定了一个函数,将会传入引用的表达式,并返回其内容。

默认:auto

查看示例
#set math.equation(numbering: "(1)", supplement: [Eq.])

We define:
$ phi.alt := (1 + sqrt(5)) / 2 $ <ratio>

With @ratio, we get:
$ F_n = floor(1 / sqrt(5) phi.alt^n) $
Preview

body
content
必需参数位置参数
位置参数按顺序传入,不带名称。

The contents of the equation.