Commit f18840a

HPCesia <me@hpcesia.com>
2025-03-20 12:05:04
fix: 附录标题与图表编号
1 parent d1eec26
Changed files (1)
layouts
layouts/appendix.typ
@@ -3,7 +3,8 @@
 
 // 后记,重置 heading 计数器
 #let appendix(
-  numbering: numbly(none, "{1}.{2}"),
+  numbering: numbly(none, "{1:A}.{2}", "{1:A}.{2}.{3}", "{1:A}.{2}.{3}.{4}"),
+  figure-equation-numbering: auto,
   // figure 计数
   show-figure: i-figured.show-figure.with(numbering: "1.1"),
   // equation 计数
@@ -12,13 +13,18 @@
   reset-counter: false,
   it,
 ) = {
+  if figure-equation-numbering == auto {
+    figure-equation-numbering = numbering
+  }
+
+  counter(heading).update(0)
   set heading(numbering: numbering)
   if reset-counter {
     counter(heading).update(0)
   }
   // 设置 figure 的编号
-  show figure: show-figure
+  show figure: show-figure.with(numbering: figure-equation-numbering)
   // 设置 equation 的编号
-  show math.equation.where(block: true): show-equation
+  show math.equation.where(block: true): show-equation.with(numbering: (..args) => "(" + figure-equation-numbering(..args) + ")")
   it
 }
\ No newline at end of file