I’m trying to refer to my figure, but the figure label name is stored in a variable.
If I did not have a mix of tables and figures in my document counter(figure).at(label("sample_c"))
would work. However as I have a table first this is included in the counter.
Here is my attempts:
#figure(
table(columns:2,[test],[test]),
caption: [A table],
kind: table
) <table_1>
#let samples = ((tag:"a"),(tag:"b"),(tag:"c"),)
#for s in samples {
block([
#figure(
[Some figure],
caption: [Statistics for measurement #s.tag.],
) #label("sample_" + s.tag)
])
}
// The below of cause works as expected
@sample_c \
@table_1
// But if I have the lable name in a variable I struggle to get the correct figure number
// The counter does not differentiate between tables and figures.
#context locate(label("sample_c")).position()
#context counter(figure).at(label("sample_c")) // The figure number is 3 - Returns 4 as the table is counted as well