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

columns元素
Question mark
自始可用Go to source

Separates a region into multiple equally sized columns.

The column function lets you separate the contents of any container into multiple columns. By default, columns take up the height of their container or the remaining height on the page and are filled up one after another. Use colbreak to explicitly end a column and continue in the next one. Use the balanced parameter to automatically equalize the height of the columns.

Example

#columns(2, gutter: 8pt)[ This text is in the first column. #colbreak() This text is in the second column. ]

Page-level columns

If you need to insert columns across your whole document, use the page function’s columns parameter instead. This will create the columns directly at the page-level rather than wrapping all of your content in a layout container. As a result, things like pagebreaks, footnotes, and line numbers will continue to work as expected. For more information, also read the relevant part of the page setup guide.

Breaking out of columns

To temporarily break out of columns (e.g. for a paper’s title), use parent-scoped floating placement:

#set page(columns: 2, height: 150pt) #place( top + center, scope: "parent", float: true, text(1.4em, weight: "bold")[ My document ], ) #lorem(40)

参数
Question mark

count
int
位置参数
Question mark
可用set规则
Question mark
默认值:2

The number of columns.

gutter
relative
可用set规则
Question mark
默认值:4% + 0pt

The size of the gutter space between each column.

Expand展开示例
#set page(columns: 2, height: 5cm) #set par(justify: true) #set columns(gutter: 15mm) #lorem(30)

balanced
bool
可用set规则
Question mark
默认值:false

Whether to equalize the height of columns by breaking columns early.

Expand展开示例
#set page(columns: 2, height: 5cm) #set par(justify: true) #set columns(balanced: true) #lorem(30)

separator
none or content
可用set规则
Question mark
默认值:none

The separator to place between each pair of non-empty columns.

By default, the content is centered and lines use a length of 100% and an angle of 90deg unless specified otherwise.

Expand展开示例
#set page(columns: 2, height: 5cm) #set par(justify: true) #set columns( gutter: 2em, separator: line(), ) #lorem(35)
Expand展开示例:Separator with extended, dotted line
#set page(columns: 2, height: 5cm) #set par(justify: true) #set columns( gutter: 2em, separator: line( stroke: (dash: "dotted"), length: 100% + 2 * 4pt, ), ) #lorem(35)
Expand展开示例:Custom separator ornament
#set page(columns: 3, width: 15cm, height: 3cm) #set par(justify: true) #set columns( gutter: 30pt, separator: curve(curve.cubic((-8pt, 0%), (8pt, 50%), (0pt, 50%)) )) #lorem(36)

body
content
必需参数
Question mark
位置参数
Question mark

The content that should be layouted into the columns.