Commit b06699e

HPCesia <me@hpcesia.com>
2025-03-20 10:53:53
feat: 附录环境
1 parent c19c721
Changed files (3)
layouts/appendix.typ
@@ -0,0 +1,24 @@
+#import "@preview/i-figured:0.2.4"
+#import "@preview/numbly:0.1.0": numbly
+
+// 后记,重置 heading 计数器
+#let appendix(
+  numbering: numbly(none, "{1}.{2}"),
+  // figure 计数
+  show-figure: i-figured.show-figure.with(numbering: "1.1"),
+  // equation 计数
+  show-equation: i-figured.show-equation.with(numbering: "(1.1)"),
+  // 重置计数
+  reset-counter: false,
+  it,
+) = {
+  set heading(numbering: numbering)
+  if reset-counter {
+    counter(heading).update(0)
+  }
+  // 设置 figure 的编号
+  show figure: show-figure
+  // 设置 equation 的编号
+  show math.equation.where(block: true): show-equation
+  it
+}
\ No newline at end of file
template/thesis.typ
@@ -7,6 +7,7 @@
   doc,
   preface,
   mainmatter,
+  appendix,
   // 页面函数
   cover,
   integrity,
@@ -305,3 +306,24 @@ $ F_n = floor(1 / sqrt(5) phi.alt^n) $
   },
   caption: [伪代码示例]
 )
+
+// ====== 附录 ======
+// 手动分页
+#if twoside {
+  set page(header: none, footer: none)
+  pagebreak() + " "
+}
+
+// 中英双语参考文献
+// 默认使用 gb-7714-2015-numeric 样式
+// #bilingual-bibliography(full: true)
+
+// 手动分页
+#if twoside {
+  set page(header: none, footer: none)
+  pagebreak() + " "
+}
+
+#show: appendix
+
+= 附录#metadata((en: "Appendix"))
\ No newline at end of file
lib.typ
@@ -2,6 +2,7 @@
 #import "layouts/doc.typ": doc
 #import "layouts/preface.typ": preface
 #import "layouts/mainmatter.typ": mainmatter
+#import "layouts/appendix.typ": appendix
 #import "pages/bachelor-cover.typ": bachelor-cover
 #import "pages/bachelor-integrity.typ": bachelor-integrity
 #import "pages/bachelor-abstract.typ": bachelor-abstract
@@ -64,6 +65,7 @@
         fonts: fonts + args.named().at("fonts", default: (:)),
       )
     },
+    appendix: (..args) => appendix(..args),
     // 封面页
     cover: (..args) => bachelor-cover(
       twoside: twoside,