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

direction自始可用Go to source

The four directions into which content can be laid out.

Possible values are: ltr, rtl, ttb, and btt.

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

#stack(dir: rtl)[A][B][C] #stack(dir: direction.rtl)[A][B][C]

常量
Question mark

ltr
direction自始可用
Go to source

Left to right.

Expand展开示例
#stack( dir: ltr, spacing: 0.2cm, circle(), line(), square(), )

rtl
direction自始可用
Go to source

Right to left.

Expand展开示例
#stack( dir: rtl, spacing: 0.2cm, circle(), line(), square(), )

ttb
direction自始可用
Go to source

Top to bottom.

Expand展开示例
#stack( dir: ttb, spacing: 0.2cm, circle(), line(), square(), )

btt
direction自始可用
Go to source

Bottom to top.

Expand展开示例
#stack( dir: btt, spacing: 0.2cm, circle(), line(), square(), )

函数
Question mark

from0.14.0起可用Go to source

Returns a direction from a starting point.

This function does the opposite of direction.start.

Expand展开示例
#direction.from(left) \ #direction.from(right) \ #direction.from(top) \ #direction.from(bottom)
direction.from(alignment) → direction

side
alignment
必需参数
Question mark
位置参数
Question mark

The starting point for the direction.

This cannot be start or end.

to0.14.0起可用Go to source

Returns a direction from an end point.

This function does the opposite of direction.end.

Expand展开示例
#direction.to(left) \ #direction.to(right) \ #direction.to(top) \ #direction.to(bottom)
direction.to(alignment) → direction

side
alignment
必需参数
Question mark
位置参数
Question mark

The end point for the direction.

This cannot be start or end.

axis0.7.0起可用Go to source

The axis this direction belongs to, either "horizontal" or "vertical".

Expand展开示例
#ltr.axis() \ #ttb.axis()
self.axis() → str

sign0.14.0起可用Go to source

The corresponding sign, for use in calculations.

This is the sign of the vector going this direction along the corresponding axis.

Expand展开示例
#ltr.sign() \ #rtl.sign() \ #ttb.sign() \ #btt.sign()
self.sign() → int

start0.7.0起可用Go to source

The starting point of this direction.

This function does the opposite of direction.from.

Expand展开示例
#ltr.start() \ #rtl.start() \ #ttb.start() \ #btt.start()
self.start() → alignment

end0.7.0起可用Go to source

The end point of this direction.

This function does the opposite of direction.to.

Expand展开示例
#ltr.end() \ #rtl.end() \ #ttb.end() \ #btt.end()
self.end() → alignment

inv自始可用Go to source

The inverse (opposite) direction.

Expand展开示例
#ltr.inv() \ #rtl.inv() \ #ttb.inv() \ #btt.inv()
self.inv() → direction