Development build 586e1bd4
Typst文档简体中文版v0.15.1 + dev 586e1bd4

参考手册

本参考索引是一个综合指南文档,包括Typst的语法,概念,类型和函数。如果你初识Typst,建议从学习指南开始,然后再按需回来学习更多的Typst特性。 [⚠️💀]

语言

本参考索引第一部分粗略介绍Typst语法,包括文档样式概念,以及Typst脚本功能详细文档。 [⚠️]

Library

第二部分引入所有能用到的函数,有插入文档内容的,有设置文档内容样式的,有文档内容变换的,有布局文档内容的。每一个函数均已同样的形式表述,有些是表述函数基本功能,有些列举函数参数,有些举例如何使用函数。

参考索引最后一部分描述的Typst代码模式内的函数,用来操作及转换数据的。和第二部分一样,每一个函数均已同样的形式表述,有些是表述函数基本功能,有些列举函数参数,有些举例如何使用函数。

进阶

译者注:这部分官方文档没有,是译者自主添加的。

除了参考,还可以考虑阅读typst-examples-book,里面包含了一些Typst的高级知识、简单示例,以及一些最佳实践。

例如简单地实现类似Markdown中的引用文本样式:

+ #lorem(10) \ #rect(fill: luma(240), stroke: (left: 0.25em))[ *Solution:* #lorem(10) $ a_(n+1)x^n = 2... $ ]

[⚠️💀]

Reading the reference

This reference uses a few graphical conventions and labels to let you quickly scan its sections.

str

These pills indicate that a value is of a particular type. Each type’s chapter uses the respective pill as its title. Similar types share a color. For example, all numeric types have the same color.

元素

Some functions are labelled as elements. This means that they can be used with set and show rules. Some elements can be located and used with the query function. Elements generally produce visible output in the document. You may be using elements even if you are not calling functions, as there is dedicated markup for some elements.

上下文相关函数

These functions can reason about the contents of your document. They can only be used when context is available, for example through a context block. Refer to the 上下文 section for more information.

必需参数

Appears on a function parameter if calling the function without that parameter would result in an error.

位置参数

Appears on a function parameter that is specified without a parameter name and colon. Instead, Typst will use the parameter order to determine which argument is which. Parameters not marked as positional are named parameters.

变长参数

Appears on function parameters that can be specified multiple times.

可用set规则

Appears on function parameters of element functions that can be customized with a set rule.