I am using a Typst template in Quarto for a report and I want to number my images and tables. I want them to be numbered as Figure 1.1, Figure 1.2 in chapter 1 and as Figure 2.1, Figure 2.2 in chapter 2. Currently, the figures in chapter 2 are numbered as Figure 2.3, Figure 2.4. The first number is correct, but I want the second number to be resetted at the start of each chapter.
I import my typst template in the yaml. In the typst template I use the following pieces of code:
show heading.where(level: 1): hdr => {
counter(figure.where(kind:image)).update(0)
counter(figure.where(kind:table)).update(0)
hdr
}
set figure(numbering: n => {
let hdr = counter(heading).get().first()
let num = query(selector(heading).before(here())).last().numbering
numbering(num, hdr, n)
})
To my understanding, the first piece of code should reset the second number in the figure and table numbering when a new chapter is made by placing a new header.
Other people using typst directly (so no Quarto) do use the same code, and for them the counter resets correctly (see for example: Do I need different code for numbering equations and figures? - #2 by Eric or How to change numbering in Appendix? - #6 by slowjo). If this a bug between Quarto and typst?