# repair bad vertical spacing of underbrace label when using newtxtext, newtxmath, and mathtools

Feeding

\documentclass{article}
\pagestyle{empty}
\usepackage{newtxtext,newtxmath}
\usepackage{mathtools}
\begin{document}
For an arbitrary $n\in M^B$ we have $\varphi_M(\underbrace{\langle 0\rangle {}^{\circ}\dotsb{}^{\circ}\langle 0\rangle }_{n\ \text{times}}) = n$; hence, $\varphi_M$ is onto.
Since $\varphi_{\mathrm{Bool}}$ is also onto as an indentity, $\varphi$ is even an epimorphism (see reference so-and-so).
\end{document}


to pdflatex results in

As you see, the vertical gap between the brace ⏟ and the brace label "𝑛 times" is (at least optically) larger that between the brace label and "an epimorphism" in the following line. This is illogical, as the brace label semantically belongs to the brace and not to the next line. How to switch the gap sizes? The gap between the brace and the brace label should be decreased, and the vertical gap below the label should be increased. (Yes, I tried out \raisebox, but the result was counterintuitive; the upper gap did not go away.)

Here, I redefine \underbrace, though I would instead recommend giving it its own name like \altunderbrace (as it stands, the original definition is saved in \svunderbrace). I shift the brace itself up 2pt and the brace label up an additional 3pt. Not sure if I break anything else in doing it this way.

\documentclass{article}
\pagestyle{empty}
\usepackage{newtxtext,newtxmath}
\usepackage{mathtools}
\let\svunderbrace\underbrace
\renewcommand\underbrace[1]{\setbox0=\hbox{$#1$}\dp0=\dimexpr\dp0-2pt\relax
\setbox2=\hbox{$\svunderbrace{\copy0}$}\dp2=\dimexpr\dp2-3pt\relax
\mathop{\copy2}\limits}
\begin{document}
For an arbitrary $n\in M^B$ we have $\varphi_M(\underbrace{\langle 0\rangle {}^{\circ}\dotsb{}^{\circ}\langle 0\rangle }_{n\ \text{times}}) = n$;
hence, $\varphi_M$ is onto.
Since $\varphi_{\mathrm{Bool}}$ is also onto as an indentity, $\varphi$ is even an epimorphism (see reference so-and-so).
\end{document}


• @Just_A_Man look in the redefinition where I specify -2pt and -3pt. Those are the shifts. – Steven B. Segletes Apr 28 '20 at 12:48
• @Just_A_Man Sorry for the misunderstanding. That gap is nothing I control. There is normal interline spacing observed, but when a line's depth exceeds the allotted space (as here), it literally wedges the next line downward to accommodate. However, it only wedges downward by that amount necessary to squeeze in the extra content, and no more. That is why that gap is narrow. You can manually fudge it by adding a \mathstrut to your subscripted content. – Steven B. Segletes Apr 28 '20 at 16:57