How to use subpar to put subplots into one figure and avoid skipping numbers?

Hello, I am trying to use subpar to put subplots into one figure. In general, I have the result I was looking for. However, there seems to be an issue where the figure counter double counts the subplot. For instance, if the subplot figure is “Fig. 4,” then the next figure counts itself as “Fig. 6,” despite “Fig. 5” not appearing. Adding figures updates the numbering below, but for some reason the figure number after the subplot index gets skipped. Has anyone run into this issue before?

#import "@preview/subpar:0.2.2"
#figure(
subpar.grid(
  
  figure(image("Images/Velocity D1.png"), caption: [
    Velocity Contour at Layer D1
  ]), <D1>,
  figure(image("Images/Velocity D2.png"), caption: [
    Velocity Contour at Layer D2
  ]), <D2>,
  figure(image("Images/Velocity D3.png"), caption: [
   Velocity Contour at Layer D3
  ]), <D3>,
  figure(image("Images/Velocity D4.png"), caption: [
    Velocity Contour at Layer D4
  ]), <D4>,
  figure(image("Images/Velocity D5.png"), caption: [
   Velocity Contour at Layer D5
  ]), <D5>,
  figure(image("Images/Velocity D6.png"), caption: [
    Velocity Contour at Layer D6
  ]), <D6>,
  
  columns: (1fr, 1fr),
), caption: [Velocity contour plots]
)<velocitycontour> ````

hello,

subpar.grid is already a figure (see the manual), if you wrap it with an extra figure you get a hidden figure which causes the wrong counter value.

#import "@preview/subpar:0.2.2"
#subpar.grid(
  
  figure(image("Images/Velocity D1.png"), caption: [
    Velocity Contour at Layer D1
  ]), <D1>,
  figure(image("Images/Velocity D2.png"), caption: [
    Velocity Contour at Layer D2
  ]), <D2>,
  figure(image("Images/Velocity D3.png"), caption: [
   Velocity Contour at Layer D3
  ]), <D3>,
  figure(image("Images/Velocity D4.png"), caption: [
    Velocity Contour at Layer D4
  ]), <D4>,
  figure(image("Images/Velocity D5.png"), caption: [
   Velocity Contour at Layer D5
  ]), <D5>,
  figure(image("Images/Velocity D6.png"), caption: [
    Velocity Contour at Layer D6
  ]), <D6>,
  
  columns: (1fr, 1fr),
  caption: [Velocity contour plots],
  label: <velocitycontour>
)
1 Like

Thanks so much, totally it!