Why do references to subfigures (using subpar) not respect custom numbering?

When I customize the numbering with the following codes, although the caption is fine, the reference is not correct.

#import "@preview/subpar:0.1.1"

#show figure.caption: it => (
  context box(
    inset: (left: 1em, right: 1em),
    align(left)[
      *#it.supplement~#it.counter.display()#it.separator*#it.body
    ],
  )
)

#set figure(numbering: n => [R#n])

#subpar.grid(
  figure(
    box(stroke: 1pt, inset: 5pt)[This is a figure],
    caption: [This is a caption]
  ), <fig11>,
  figure(
    box(stroke: 1pt, inset: 5pt)[This is a figure],
    caption: [This is a caption]
  ),<fig12>,
  columns: (1fr, 1fr),
  caption: [These are two subfigures.],
  placement: auto,
  // label: <fig12>,
)

#figure(
  box(stroke: 1pt, inset: 5pt)[This is a figure],
  caption: [This is a caption],
) <fig2>

see @fig11, @fig12, @fig2

The “R” is missed when I use the references of subplots:
image

The reason why this happens is because you have changed figure(numbering) but have not set a specific show rule for ref. You can set it using subpar.grid(numbering-sub-ref: "R1.a")

1 Like

It worked! Thanks very much!

1 Like