注意 / Info
本站经 Typst GmbH 许可,提供 Typst v0.10.0+后期随缘更新 官方文档的翻译,由中文社区维护。建议与官方文档一同阅读,因为可能存在错译、漏译或过时信息。如有意改进翻译内容或网站本身,可在GitHub上提出 Issue、发起 Pull Requests。此外,也欢迎加入「Typst 非官方中文交流群」(QQ 793548390)
This site provides a Chinese translation of the Typst v0.10.0+后期随缘更新 documentation maintained by the “Typst Chinese 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 QQ chat group “Typst 非官方中文交流群” (793548390).
Typst文档简体中文版
v0.10.0+后期随缘更新

par
元素
元素
元素函数可用setshow规则自定义样式。

Arranges text, spacing and inline-level elements into a paragraph.

Although this function is primarily used in set rules to affect paragraph properties, it can also be used to explicitly render its argument onto a paragraph of its own.

Example

#show par: set block(spacing: 0.65em)
#set par(
  first-line-indent: 1em,
  justify: true,
)

We proceed by contradiction.
Suppose that there exists a set
of positive integers $a$, $b$, and
$c$ that satisfies the equation
$a^n + b^n = c^n$ for some
integer value of $n > 2$.

Without loss of generality,
let $a$ be the smallest of the
three integers. Then, we ...
Preview

参数
参数
参数是传给函数的输入,写在函数名后的括号中。

leading
可用set规则
可用set规则
可用set规则设置参数,更改后续调用时的默认值。

The spacing between lines.

默认值:

0.65em

justify
可用set规则
可用set规则
可用set规则设置参数,更改后续调用时的默认值。

Whether to justify text in its line.

Hyphenation will be enabled for justified paragraphs if the text function's hyphenate property is set to auto and the current language is known.

Note that the current alignment still has an effect on the placement of the last line except if it ends with a justified line break.

默认值:

false

linebreaks
可用set规则
可用set规则
可用set规则设置参数,更改后续调用时的默认值。

How to determine line breaks.

When this property is set to auto, its default value, optimized line breaks will be used for justified paragraphs. Enabling optimized line breaks for ragged paragraphs may also be worthwhile to improve the appearance of the text.

默认值:

auto

可填写的值
  • simple

    Determine the line breaks in a simple first-fit style.

  • optimized

    Optimize the line breaks for the whole paragraph.

    Typst will try to produce more evenly filled lines of text by considering the whole paragraph when calculating line breaks.

展开例子
#set page(width: 207pt)
#set par(linebreaks: "simple")
Some texts feature many longer
words. Those are often exceedingly
challenging to break in a visually
pleasing way.

#set par(linebreaks: "optimized")
Some texts feature many longer
words. Those are often exceedingly
challenging to break in a visually
pleasing way.
Preview

first-line-indent
可用set规则
可用set规则
可用set规则设置参数,更改后续调用时的默认值。

The indent the first line of a paragraph should have.

Only the first line of a consecutive paragraph will be indented (not the first one in a block or on the page).

By typographic convention, paragraph breaks are indicated either by some space between paragraphs or by indented first lines. Consider reducing the paragraph spacing to the [leading] when using this property (e.g. using #show par: set block(spacing: 0.65em)).

默认值:

0pt

hanging-indent
可用set规则
可用set规则
可用set规则设置参数,更改后续调用时的默认值。

The indent all but the first line of a paragraph should have.

默认值:

0pt

body
必需参数
必需参数
必需参数在调用函数时必须传入。
位置参数
位置参数
位置参数按顺序传入,不带参数名。

The contents of the paragraph.

转到官方文档(英文)

搜索