Oh, I see. That does look nice, but… Do you know if there might be a way to get a general solution? I imagine that if I were to have a matrix with many elements that this could quickly get onerous.
You are adding a non-matrix part inside the matrix layout, which is already a “non-general” matrix form (how am I supposed to know at which positions and how often will you use underbrace so that it can be automatically handled by the general solution?), so you can’t expect to have a general solution for a niche use case. If it was just a matrix, then you can align stuff in some ways:
$
mat(
align: #left,
upright(bold(I))_M;
// underbrace(bold(0), (N - M) times M)
bold(0)
)
$
I can’t come up with a general solution without knowing the constraints, possible values, and other stuff that you want to do with a matrix.
I agree that underbrace is supposed to use rarely anyways, but let’s say that we just have I_M and 0. Do you think there’s a general solution, then? Because I think it would fairly standard to have a matrix with subscripts and for those subscripts to be differently sized…
One thing about left align is that the 0 has unequal amounts of whitespace from the brackets which feels awkward to me…