|
89 | 89 | pagebreak()
|
90 | 90 |
|
91 | 91 | // 目录
|
92 |
| - set page(numbering: "I") |
93 |
| - counter(page).update(1) |
94 |
| - align(center)[ |
95 |
| - #outline( |
96 |
| - title: text(font: FONTSET.at("Hei"), weight: "bold", tracking: 2em, size: 16pt, [目录\ \ ]), |
97 |
| - depth: 3, |
98 |
| - ) |
99 |
| - ] |
100 |
| - |
101 |
| - // 章节标题配置 |
102 | 92 | let chineseNumMap(num) = {
|
103 | 93 | let chineseNum = (
|
104 | 94 | "一", "二", "三", "四", "五", "六", "七", "八", "九", "十",
|
105 | 95 | "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十")
|
106 | 96 | chineseNum.at(num - 1)
|
107 | 97 | }
|
108 |
| - |
| 98 | + |
| 99 | + set page(numbering: "I") |
| 100 | + counter(page).update(1) |
| 101 | + |
| 102 | + show outline: it => locate(loc => { |
| 103 | + set par(first-line-indent: 0em) |
| 104 | + |
| 105 | + align(center)[ |
| 106 | + #text(font: FONTSET.at("Hei"), weight: "bold", tracking: 2em, size: 16pt, [目录\ \ ]) |
| 107 | + ] |
| 108 | + |
| 109 | + let chapterCounter = 1 |
| 110 | + let sectionCounter = 1 |
| 111 | + let subsectionCounter = 1 |
| 112 | + |
| 113 | + let headingList = query(heading, after: loc) |
| 114 | + for i in headingList { |
| 115 | + if i.outlined == false { |
| 116 | + break |
| 117 | + } |
| 118 | + |
| 119 | + if i.level == 1 { |
| 120 | + set text(font: (FONTSET.at("English"), FONTSET.at("Hei")), size: 12pt, weight: "bold") |
| 121 | + |
| 122 | + if i.body != [参考文献] and i.body != [致#h(2em)谢] and i.body != [附#h(2em)录] { |
| 123 | + [第#chineseNumMap(chapterCounter)章#h(1em)] |
| 124 | + } |
| 125 | + [#i.body#box(width: 1fr, repeat[.])#calc.abs(i.location().page() - loc.page())\ ] |
| 126 | + |
| 127 | + chapterCounter = chapterCounter + 1 |
| 128 | + sectionCounter = 1 |
| 129 | + } else if i.level == 2 { |
| 130 | + [#h(1em)#calc.abs(chapterCounter - 1)\.#sectionCounter#h(1em)#i.body#box(width: 1fr, repeat[.])#calc.abs(i.location().page() - loc.page())\ ] |
| 131 | + |
| 132 | + sectionCounter += 1 |
| 133 | + subsectionCounter = 1 |
| 134 | + } else if i.level == 3 { |
| 135 | + [#h(2em)#calc.abs(chapterCounter - 1)\.#calc.abs(sectionCounter - 1)\.#subsectionCounter#h(1em)#i.body#box(width: 1fr, repeat[.])#calc.abs(i.location().page() - loc.page())\ ] |
| 136 | + |
| 137 | + subsectionCounter += 1 |
| 138 | + } |
| 139 | + } |
| 140 | + }) |
| 141 | + |
| 142 | + outline(title: none, depth: 3, indent: true) |
| 143 | + |
| 144 | + // 章节标题配置 |
109 | 145 | set heading(numbering: "1.1")
|
110 | 146 | show heading: it => locate(loc => {
|
111 | 147 | let levels = counter(heading).at(loc)
|
112 | 148 |
|
113 | 149 | // 重置段首空格
|
114 | 150 | set par(first-line-indent: 0em)
|
115 | 151 | set text(font: FONTSET.at("Hei"), weight: "bold")
|
116 |
| - |
| 152 | + |
117 | 153 | if it.level == 1 {
|
118 | 154 | // 重置计数器
|
119 | 155 | tableCounter.update(1)
|
|
180 | 216 | [图 #chapterLevel\-#figureCounter.display() #caption]
|
181 | 217 | )
|
182 | 218 | ]
|
183 |
| - |
| 219 | + |
184 | 220 | figureCounter.step()
|
185 | 221 | })
|
186 |
| - |
| 222 | + |
187 | 223 | figure(
|
188 | 224 | image(file, width: width)
|
189 | 225 | )
|
|
192 | 228 | #let Table(caption, columnsSet, alignSet, body) = {
|
193 | 229 | show table: it => locate(loc => {
|
194 | 230 | let chapterLevel = counter(heading).at(loc).at(0)
|
195 |
| - |
| 231 | + |
196 | 232 | align(center)[
|
197 | 233 | #text(
|
198 | 234 | font: (FONTSET.at("English"), FONTSET.at("Kai")),
|
|
0 commit comments