werifu / HUST-typst-template

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

图片序号排版问题 #15

Closed hakureiR-eimu closed 8 months ago

hakureiR-eimu commented 8 months ago

image 更新以后图片排版序号出现出现两次的bug,估计是原来的功能内置了然后又写了一遍导致的,我回去试着改一下

hakureiR-eimu commented 8 months ago

另外所有类似排版的都已经出问题了,例如表格。删掉以后字体又不对。悲

werifu commented 8 months ago

最黑暗的一集,这周可能需要重构下,跟上typst的版本

z1youRA commented 8 months ago

template.typ 315行开始 删掉/注释图片和表格中it.body和it.caption以外的内容可以解决,暂时用着没有其他问题,怀疑可能是typst自己在caption中添加了supplement和编号导致的

  show figure: it => {
    set align(center)
    if it.kind == "image" {
      set text(font: heiti, size: 12pt)
      it.body
      // it.supplement
      // " " + it.counter.display(it.numbering)
      // " " + 
      it.caption
      locate(loc => {
        let chapt = counter(heading).at(loc).at(0)
        let c = counter("image-chapter" + str(chapt))
        c.step()
      })
    } else if it.kind == "table" {
      set text(font: heiti, size: 12pt)
      // it.supplement
      // " " + it.counter.display(it.numbering)
      // " " + 
      it.caption
      set text(font: songti, size: 10.5pt)
      it.body
      locate(loc => {
        let chapt = counter(heading).at(loc).at(0)
        let c = counter("table-chapter" + str(chapt))
        c.step()
      })
    }
werifu commented 8 months ago

已解决,figure.caption.body 相当于0.9.0以前的figure.caption 3036a0dd382b5aab4ec160483a8c7620db0ac598