Often the equation peeks into the label, even though on the left side is still place, because the center-alignment does not take the label into consideration, see e.g.
It looks like this is done intentionally? The code does calculate the full_number_width and will translate the the equation under certain conditions, but does not translate with the default setup.
I think the algorithm you proposed is also problematic, because the widths of numbers are not fixed.
In the following example, the current algorithm put the two equations aligned, but your algorithm would shift the second equation to the left.
x = a (9)
x = b (10)
As for your original example, I suggest you split the equation into multiple lines with \ (and &).
Interesting. Hm, I guess then I’ll probably stay with my imperfect manual way of doing it. Maybe it would be best to let math.equation have the option “alignment correction” that is on default 0em and has the options auto or something of type length and makes the center alignment as if the line begins left of the length that is provided while auto gives the length with the actual label, but if I want to circumvent the problem you describe, but also not have it 0.
I haven’t formed a clear opinion yet… Maybe shifting a center-aligned equation only when it would collide with the number if not shifted? Or adding math.equation.{body,number} sub-elements?
If you want to discuss it seriously, you could create an issue or forward the problem to Discord | #Math | Typst.