#Number my figures for each first level heading
3 messages · Page 1 of 1 (latest)
You would have to use a custom counter that resets after each heading, and a numbering function that includes the section number and that custom counter. However, the numbering will not differentiate between figures, tables and other kinds, as long as you only use one custom counter:
?render ```
#set heading(numbering: "1.1")
// Reset 'section-figure' counter at each first-level heading
#show heading.where(level: 1): it => {
counter("section-figure").update(0)
it
}
#set figure(numbering: (..nums) => locate(loc => {
counter("section-figure").step()
let section-number = counter(heading).at(loc).at(0)
let figure-number = counter("section-figure").display("1.1")
[#section-number] + [.] + [#figure-number]
}))
= First Chapter
#figure(caption: [First figure], rect(width: 1cm, height: 0.6cm))
#figure(caption: [Second figure], rect(width: 1cm, height: 0.6cm))
= Second Chapter
#figure(caption: [Third figure], rect(width: 1cm, height: 0.6cm))
#figure(caption: [Fourth figure], kind: table, rect(width: 1cm, height: 0.6cm))