# How to ignore kerning of underbrace in math mode

Is there a way to instruct LaTeX to ignore the text in the \underbrace for purposes of kerning the equation in math mode?

\begin{align}
&x
\underbrace{(4-3y)}_
{\text{Positive $\forall y \in [0,1]$}}
+4y -1
\end{align}


.

I know that I can use \mkern-30:

\begin{align}
x
\mkern-30 % Adding this is a sub-par solution
\underbrace{(4-3y)}_
{\text{Positive $\forall y \in [0,1]$}}
\mkern-26 % Adding this is a sub-par solution
+4y -1
\end{align}


but finding the exact number to work out how to fix the kerning is obviously not fun.

Is there a better way?

• use mathtools and its \mathclap{...} macro: \underbrace{....}_{\mathclap{...}}, and next time please post a full minimal example, not just a sniplet, then it is a lot easier for others to test your code – daleif May 23 '19 at 11:25
• Noted, daleif. Thank's a ton! – Toldry May 23 '19 at 11:32

The subscript can be set in a zero-width box. The size of the subscript should be set explicitly. This results in the same output as \mathclap from mathtools.

MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}
\begin{align}
&x
\underbrace{(4-3y)}_
{\text{Positive $\forall y \in [0,1]$}}
+4y -1
\end{align}
\begin{align}
&x
\underbrace{(4-3y)}_
{\makebox[0pt]{\scriptsize\text{Positive $\forall y \in [0,1]$}}}
+4y -1
\end{align}
\begin{align}
&x
\underbrace{(4-3y)}_
{\mathclap{\text{Positive $\forall y \in [0,1]$}}}
+4y -1
\end{align}
\end{document}


Result:

In this particular case \mathclap is not necessary:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
x{\underbrace{(4-3y)}_{\substack{\text{positive}\\[1pt] \forall y \in [0,1]}}} + 4y - 1
\end{equation*}

\end{document}


Compare with

\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}

\begin{equation*}
x{\underbrace{(4-3y)}_{\mathclap{\text{positive $\forall y \in [0,1]$}}}} + 4y - 1
\end{equation*}

\end{document}


Note, anyway, the additional pair of braces around the whole

{\underbrace{...}_{...}}


construction: they're necessary in order to get the right spacing.

• +1 for the "extra set of braces" trick, which converts the \underbrace atom effectively into \mathord, I suppose. Or maybe it's deeper than that. – Steven B. Segletes May 23 '19 at 11:49
• @StevenB.Segletes Yes: you can see the wrong spacing in the other answer. – egreg May 23 '19 at 11:50
• What is the purpose of the [1pt] in the first solution? – Toldry May 23 '19 at 11:55
• @Toldry To separate a bit the two lines, they would be too crowded otherwise. – egreg May 23 '19 at 11:56