Skip to content

如何让引用的 label 缺失时仍然能编译?

如何让引用的 label 缺失时仍然能编译?

typst
#show ref: it => {
  if query(it.target).len() == 0 {
    return text(fill: red, "<未找到引用" + str(it.target) + ">")
  }
  it
}

#figure(rect(), caption: "A sample figure") <fig2>
@fig1 @fig2
Typst compiled image
What do you think?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v3.5.1

基于 MIT 许可发布