|
18 | 18 | justify: true,
|
19 | 19 | first-line-indent: 2em,
|
20 | 20 | // 浮动于页顶或页底的上下间距
|
21 |
| - figure-clearance: 32pt, |
| 21 | + figure-clearance: 24pt, |
22 | 22 | figure-caption-spacing: 0.4em,
|
23 | 23 | numbering: custom-numbering.with(first-level: "第一章 ", depth: 4, "1.1 "),
|
24 | 24 | // 正文字体与字号参数
|
|
27 | 27 | heading-font: auto,
|
28 | 28 | heading-size: (字号.三号, 字号.四号,),
|
29 | 29 | heading-weight: ("regular",),
|
30 |
| - heading-above: (2 * 15.6pt - 0.7em, 2 * 15.6pt - 0.7em), |
31 |
| - heading-below: (2 * 15.6pt, 2 * 15.6pt - 0.7em), |
| 30 | + heading-above: (1.0em, 2.0em, 1.5em), |
| 31 | + heading-below: (1.5em, 1.5em, 1.25em), |
32 | 32 | heading-pagebreak: (true, false),
|
33 | 33 | heading-align: (center, auto),
|
34 | 34 | // 页眉
|
|
110 | 110 | show figure: show-figure
|
111 | 111 | // 3.4 设置 equation 的编号和假段落首行缩进
|
112 | 112 | show math.equation.where(block: true): show-equation
|
113 |
| - show math.equation.where(block: true): it => { |
114 |
| - it |
115 |
| - fake-par |
116 |
| - } |
117 | 113 | // 3.5 表格表头置顶 + 不用冒号用空格分割 + 样式
|
118 | 114 | show figure.where(
|
119 | 115 | kind: table
|
120 | 116 | ): set figure.caption(position: top)
|
121 | 117 | set figure.caption(separator: separator)
|
122 | 118 | show figure.caption: caption-style
|
123 | 119 | show figure.caption: set text(size: caption-size, font: fonts.楷体)
|
124 |
| - show figure.caption: set par(leading: 1.25em) |
| 120 | + show figure.caption: set par(leading: 1em) |
125 | 121 |
|
126 | 122 | show figure.caption: c => block(inset: (top: figure-caption-spacing, bottom: figure-caption-spacing))[
|
127 |
| - #text(font: fonts.黑体, weight: "bold", style: "normal")[ |
| 123 | + #set align(left) |
| 124 | + #text(font: fonts.黑体, weight: "regular", style: "normal")[ |
128 | 125 | #c.supplement #context c.counter.display(c.numbering)
|
129 | 126 | ]
|
130 | 127 | #h(0.3em)#c.body
|
131 | 128 | ]
|
132 | 129 | show figure.where(placement: none): it => {
|
133 | 130 | v(figure-clearance / 6)
|
134 | 131 | it
|
135 |
| - fake-par |
| 132 | + v(figure-clearance / 6) |
136 | 133 | }
|
137 | 134 | set place(clearance: figure-clearance)
|
138 | 135 | // 3.6 优化列表显示
|
|
170 | 167 | below: array-at(heading-below, it.level),
|
171 | 168 | )
|
172 | 169 | it
|
173 |
| - fake-par |
174 | 170 | }
|
175 | 171 | // 4.3 标题居中与自动换页
|
176 | 172 | show heading: it => context {
|
|
231 | 227 |
|
232 | 228 | set underline(stroke: 0.5pt + black, offset: 0.35em)
|
233 | 229 |
|
| 230 | + // 处理一些元素后第一段文本的首行缩进 |
| 231 | + show selector.or(heading, figure, list, enum, quote, terms): it => { |
| 232 | + it |
| 233 | + fake-par |
| 234 | + } |
| 235 | + |
| 236 | + // 处理一级标题的引用格式 |
| 237 | + show ref: it => { |
| 238 | + let el = it.element |
| 239 | + if (el != none and el.func() == heading and el.level == 1) { |
| 240 | + link(el.location(), text(fill: color.black, |
| 241 | + numbering(..counter(heading).at(el.location())).trim() |
| 242 | + )) |
| 243 | + } else { |
| 244 | + it |
| 245 | + } |
| 246 | + } |
| 247 | + |
234 | 248 | // 字数统计(正文 + 附录)
|
235 | 249 | // typst query main.typ '<total-words>' 2>/dev/null --field value --one
|
236 | 250 | context [
|
|
0 commit comments