The problem
I have a document where I need (1) legal numbering and (2) a figure with subfigures. Legal numbering in this context means that paragraph in the main text are numbered, but not other paragraph-like entities, such as footnotes or captions.
I’ve set up the paragraph numbering using this show rule for pars. It works quite and well and the document still compiles quickly, which is great.
The one issue I’m running into is that subpar figures add paragraph numbering to the subfigure captions (though not the normal superfigure caption). Standard figures #figure(...) do not have paragraph numbering.
Is there something obvious I’m missing?
Some things I’ve considered
- Writing a new show rule on par within the subfigures, but this seems to not converge
show par: it => it.body - Using a state within a show rule for subfigures and checking that state, but this gives
only element functions can be used as selectors
These were variants of setting a state saydo_countand adding to the show par:
context {
if do_count.get() == 0 {
return it
}
}
and to the super:
#show subpar.super: it => {
do_count.update(0)
it
do_count.update(1)
}
reprex
#import "@preview/subpar:0.2.2"
#set page(height: auto)
#set par(justify: true)
#let cnt_para = counter("para")
#let step = cnt_para.step()
#let n_para = context cnt_para.display()
#show par: it => {
if it.body.at("children", default: ()).at(0, default: none) == step {
return it
}
par(step + [#n_para. ] + it.body)
}
= Some header
And then there's text, followed by our test figure.
#subpar.super(
grid(
[#figure(rect(fill:red), caption: [An image]) <fig1a>],
[#figure(rect(fill:blue), caption: [Another image]) <fig1b>],
figure(rect(fill:yellow), caption: [A third unlabeled image]),
columns: (1fr,) * 3,
),
caption: [A figure composed of three sub figures.],
label: <fig1>,
)
But note that a regular figure does not have this issue:
#figure(rect(fill:red), caption: [An image]) <fig2>
The doc ends with a little more text.
