I have a similar problem as I did a while back. I configured ref to show me the caption of a figure that contains a counter. However, it doesn’t show the counter number of that caption, but the final result of the counter. What do I need to change?
#let count = counter("nfr")
#let nfr(name, reference: none) = {
count.step()
[
#figure(
table(
columns: (auto, 3fr),
[*ID*], context count.display(),
[*Name*], name
),
caption: [NFR #context count.display(): #name]
) #if (reference != none) { label(reference) }
]
}
#nfr("Hello", reference: "hello")
#nfr("World", reference: "world")
#let nfr-reference(label) = {
show ref: r => {
if r.element == none { panic("Label '" + str(label) + "' not found") }
let caption = r.element.caption.body
link(label, caption)
}
ref(label)
}
Caption: #nfr-reference(<hello>). This should show NFR 1.
