werifu / HUST-typst-template

华科毕业论文(本科)的 typst 模板
MIT License
176 stars 17 forks source link

Ref has a wrong numbering #4

Closed werifu closed 1 year ago

werifu commented 1 year ago

复现

引用出现在本体后,会导致引用的编号不对(比原来的大)

image
#equation(
  $ A = pi r^2 $,
) <eq1>

根据@eq1 ,推断出@eq2

#equation(
  $ x < y => x gt.eq.not y $,
) <eq2>

原因是自己实现的章节编号(typst并不提供按章节编号功能),在排版执行到图片时自动+1,而引用会用引用时的location去得到计数器。

解决方案是学 word 用 图 1- 作为 supplement 而不是 ,这样可以每一章重新编号,但是 typst 现在还没支持自定义ref的文案,会自动给 supplement 和 numbering 加空格,导致得到 图 1- 1而不是 图 1-1,其他的实现方案感觉成本比较高,先等typst 更新

相关pr:https://github.com/typst/typst/pull/646

werifu commented 1 year ago

相关pr:typst/typst#646

合进去了,等下个release版本更新后修复

werifu commented 1 year ago

fixed. 在 ref 里手动找 element 的各个计数器,而不是靠 numbering 函数来求值 41eba4f