Record Chinese names with a rhythm of three characters. 按占三格的节奏记录中文人名。
#import "@preview/tricorder:0.1.0": tricorder
#tricorder(
.."丁声树、黎锦熙、李荣、陆志韦、陆宗达、吕叔湘、石明远、王力、魏建功、叶籁士、叶圣陶、周定一、周浩然、周祖谟、朱文叔".split("、"),
"成吉思汗(蒙古族,古人)", "张大三", "李小四",
)

用法 Usage
如何控制布局 How to control the layout
-
columns:列数 Number of columns默认:
auto,会填充所有可用空间。若从头设计版面,无需更改。Default:
auto, which will use all available space. This is suitable if you design the whole layout from the beginning.可用正的
int直接规定列数。Use a positive
intto specify the number of columns explicitly.#tricorder(columns: auto, ..names) #align( center, tricorder(columns: 3, ..names), )
-
row-gutter/column-gutter:行/列间隙 Gaps between rows/columns默认:
1em,这会在行/列间空一个字。Default:
1em, which will leave a space of one Han character between rows/columns. This is suitable if you have如果两个字的名字较多,默认
1em易引发歧义,可适当增加。If there are too many two-character names, the default
1emmay cause ambiguity. A larger value would be better.这两个选项类似
grid,但只有1em、1.5em、2em认真测试过。请谨慎使用其它值。These two arguments are similar to
grid, but only1em,1.5em, and2emare properly tested. Use other values at your own risk.
如何记录名字 How to record names
有两种方法。There are two ways.
-
str:按标准方法处理 Process in the standard way例 Example:
"张飞" -
((span, overflow), …):不再自动处理名字或计算列数 Do not touch the name or calculate the span automatically例 Example:
((span: 1, overflow: false), "张 飞")-
span:这个名字占据的列数 The amount of columns spanned by this name默认:
1Default:
1 -
overflow:是否允许溢出到列间 Whether to allow overflowing into the column gutter默认:
falseDefault:
false
此外,
((span: 1, overflow: false), […])可被省略成[…]。Besides,
((span: 1, overflow: false), […])can be shortened into[…]. -

实现细节 Implementation detail
#tricorder(…)始终生成块级容器,但固定列数和自动列数的实现不同。
#tricorder(…) always gives a block-level container, but the implementation of fixed columns and auto columns are different.
-
#tricorder(columns: 2, …)≈#grid( columns: (3em,) * 2, column-gutter: column-gutter, row-gutter: row-gutter, [孔乙己], [孔乙己], ) -
#tricorder(columns: auto, …)≈#set par(leading: row-gutter) #block( box(width: 3em, "孔乙己"), h(column-gutter, weak: true), box(width: 3em, "孔乙己"), )
固定列数会略快一点。
Fixed columns would be slightly faster.