如何让引用的 label 缺失时仍然能编译?
typst
#show ref: it => {
if it.element == none {
return text(fill: red, "<未找到引用" + str(it.target) + ">")
}
it
}
#figure(rect(), caption: "A sample figure") <fig2>
@fig1 @fig2

WARNING
以上规则会把引用的文献误判为缺失标签。目前区分这两种情况比较困难,需要自行扫描*.bib
或 hack context
机制。
相关 issue:Downgrade missing references from errors to warning · Issue #4035 · typst/typst