How can I ensure that the underbrace has no impact on the spacing of the elements above?

Hi,
Is there a way to ensure that the underbrace doesn’t impact the spacing of the formula above?
For instance, I would like to have no space after the 1 with :

$underbrace(0...0,k) 1 underbrace(0...0,n+m-k-1)$

Screenshot from 2025-03-06 14-24-25
Thanks.

You can use the function place() for the annotation. The underbrace (or rather the content below) will then no longer affect the spacing of the formula above. If you want the annotation to be formatted as math, you need to reduce the font size since the equation inside the place function would otherwise use the same font size as your regular formula. I am not sure if the scaling factor is exactly 0.7 but it looked right at the first glance.

#let annotation(body) = {
  show math.equation: set text(size: 0.7em)
  place(top + center, $body$)
}

$underbrace(0...0, k) 1 underbrace(0...0, annotation(n+m-k-1))$
1 Like