typst-hs
typst-hs copied to clipboard
counter isn't resetting properly for figures
The kind counter isn't resetting properly (issue visible in pdf, in docx number isn't shown at all).
This is a pretty big problem for me because the project I'm working on is a collection of essays and each has their own counters for figures and tables. So ideally I'd be able to reset it and have the numbers still match in the version generated with pandoc. That being said, I could manually fix it but hopefully it can be fixed here for everyone!
PS: Below is the minimum example but tables, images, and each "kind" have a separate counter so that should be considered.
Sample typst file figure.typ:
#figure(
table(
columns: (1fr, 1fr),
table.header([A], [B]),
table.hline(),
[Content],
[Content],
),
caption: [A nice caption for my figure],
)
#counter(figure.where(kind: table)).update(0)
#figure(
table(
columns: (1fr, 1fr),
table.header([C], [D]),
table.hline(),
[Content],
[Content],
),
caption: [A second caption],
)
Expected output (when compiled with typst):
Actual output (using pandoc from typst to pdf):
Actual output (using pandoc from typst to docx):
Related typst documentation: https://typst.app/docs/reference/model/figure/
Mostly copied from: https://github.com/jgm/pandoc/issues/11102
Thanks again for maintaining this 👍