Hi,
I managed to create a demo on using counters to display figure and table captions with numbering. Here is the link:
https://typst.app/project/rHVlsLUqcZ5zRT26hUfZFB
I paste the code here too
#set heading(numbering: "1.")
#let fig = counter("figure")
#let tab = counter("table")
#let fig_numbering(.., desc) = {
fig.step()
context str(counter(heading).get().at(0)) + "-" + context fig.display()
}
#let tab_numbering(.., desc) = {
tab.step()
context str(counter(heading).get().at(0)) + "-" + context tab.display()
}
#show figure.where(
kind: table
): set figure.caption(position: top)
= Introduction
== Background
The current value is: #context counter(heading).display() \
Heading 1 value = #context counter(heading).get().at(0) \
Heading 1 in roman numerals: #context counter(heading).display("I")
#figure(
image("circles.png"),
caption: "Drawing circles in AutoCAD",
numbering: fig_numbering
)
#figure(
table(
columns: 4,
[t], [1], [2], [3],
[y], [0.3s], [0.4s], [0.8s],
),
caption: [Timing results],
numbering: tab_numbering
)
== More Background
#figure(
image("circles.png"),
caption: "Drawing circles in AutoCAD",
numbering: fig_numbering
)
= Theory
#counter("figure").update(0)
#counter("table").update(0)
== More Theory
#figure(
image("circles.png"),
caption: "Drawing circles in AutoCAD",
numbering: fig_numbering
)
#figure(
table(
columns: 4,
[t], [1], [2], [3],
[y], [0.3s], [0.4s], [0.8s],
),
caption: [Timing results],
numbering: tab_numbering
)