注意 / 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+后期随缘更新

alignment

Where to align something along an axis.

Possible values are:

  • start: Aligns at the start of the text direction.
  • end: Aligns at the end of the text direction.
  • left: Align at the left.
  • center: Aligns in the middle, horizontally.
  • right: Aligns at the right.
  • top: Aligns at the top.
  • horizon: Aligns in the middle, vertically.
  • bottom: Align at the bottom.

These values are available globally and also in the alignment type's scope, so you can write either of the following two:

#align(center)[Hi]
#align(alignment.center)[Hi]
Preview

2D alignments

To align along both axes at the same time, add the two alignments using the + operator. For example, top + right aligns the content to the top right corner.

#set page(height: 3cm)
#align(center + bottom)[Hi]
Preview

Fields

The x and y fields hold the alignment's horizontal and vertical components, respectively (as yet another alignment). They may be none.

#(top + right).x \
#left.x \
#left.y (none)
Preview

定义
定义
这些函数和类型带有附属定义。要访问这种定义,请先写上函数或类型的名称,再加上定义的名称,并用句点在中间分隔。

axis

The axis this alignment belongs to.

  • "horizontal" for start, left, center, right, and end
  • "vertical" for top, horizon, and bottom
  • none for 2-dimensional alignments
self.axis(
)
展开例子
#left.axis() \
#bottom.axis()
Preview

inv

The inverse alignment.

self.inv(
)->
展开例子
#top.inv() \
#left.inv() \
#center.inv() \
#(left + bottom).inv()
Preview
转到官方文档(英文)

搜索