Development build 9f2b6e87
Typst文档简体中文版v0.15.1 + dev 9f2b6e87

alignment自始可用Go to source

Where to align something along an axis.

Possible values are:

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]

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]

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)

常量
Question mark

start
alignment自始可用
Go to source

Horizontal alignment to the start of the text direction.

Expand展开示例
#set text(dir: ltr) #align(start, emoji.arrow.r) #set text(dir: rtl) #align(start, emoji.arrow.l)

end
alignment自始可用
Go to source

Horizontal alignment to the end of the text direction.

Expand展开示例
#set text(dir: ltr) #align(end, emoji.arrow.r) #set text(dir: rtl) #align(end, emoji.arrow.l)

left
alignment自始可用
Go to source

Left horizontal alignment.

Expand展开示例
#align(left)[Left]

center
alignment自始可用
Go to source

Center horizontal alignment.

Expand展开示例
#align(center)[Center]

right
alignment自始可用
Go to source

Right horizontal alignment.

Expand展开示例
#align(right)[Right]

top
alignment自始可用
Go to source

Top vertical alignment.

Expand展开示例
#set page(height: 3cm) #align(top)[Top]

horizon
alignment自始可用
Go to source

Middle vertical alignment.

Expand展开示例
#set page(height: 3cm) #align(horizon)[Horizon]

bottom
alignment自始可用
Go to source

Bottom vertical alignment.

Expand展开示例
#set page(height: 3cm) #align(bottom)[Bottom]

函数
Question mark

axis0.7.0起可用Go to source

The axis this alignment belongs to.

Expand展开示例
#left.axis() \ #bottom.axis()
self.axis() → nonestr

inv0.7.0起可用Go to source

The inverse alignment.

Expand展开示例
#top.inv() \ #left.inv() \ #center.inv() \ #(left + bottom).inv()
self.inv() → alignment