I want to create latex like subequations. Using the following code
#let subequation(..it) = (
figure(
{
context {
let n = counter(math.equation).at(here()).first()
let c = counter("subequation")
c.update((
counter(heading).get().first(),
n + 1,
0,
))
set math.equation(numbering: n => {
numbering("(1.1a)", ..c.get())
})
for i in it.pos() {
c.step(level: 3)
block[ #i ]
}
counter(math.equation).update(n + 1)
}
},
supplement: "Equation",
kind: "subequation",
)
)
#show figure.where(kind: "subequation"): set figure(numbering: n => numbering(
"(1.1)",
..(counter(heading).get().first(), counter(math.equation).get().first() + 1),
))
#subequation([$ a $ <a>], [ $ b $ <b>]) <both>
@label3 consists of @label and @label2
I’m getting quite close. The label works properly, i.e. @a
references equation (1.23a). I can’t, however, reference both equations at once using the @both
label. I understand why, but like to find a workaround anyways.
Any ideas?
EDIT: I updated my code. Now both correctly references (1.23). Maybe somebody has us for the example.
What does not work, however, is alignment using &
…