# Spacing of Formula Gets Weird with an Underbrace on One of the Terms

So, I just needed an underbrace in a formula in a Beamer presentation and ended up with some weird spacing between the two plus signs. Any clues how to fix? I looked online already for solutions but haven't found one.

Here's the code:

\begin{block}{Second stage:}
\centering $Y_i = \beta_0 + \beta_1 \widehat{D_i}+ \underbrace{\delta(score_i)}_\text{\parbox{4cm}{\centering Continuous\\[-4pt] function}}+\epsilon_i$
\end{block}


And here's how it looks.

• With \parbox{4cm} you are requesting 4cm of horizontal space and that is what you get. – Henri Menke Feb 25 at 23:00

You could use \substack.

\documentclass{beamer}
\usepackage{amsmath}
\begin{document}

\begin{frame}
\begin{block}{Second stage:}
\begin{equation*}
Y_i = \beta_0 + \beta_1 \hat{D}_i + \underbrace{\delta(\text{score}_i)}_{\substack{\text{Continuous} \\ \text{function}}} + \epsilon_i
\end{equation*}
\end{block}
\end{frame}

\end{document}