[Tex/LaTex] I want a really small underbrace

math-modespacing

This question is related to, but distinct from Oversized \underbrace's label causes unwanted spacing.

My issue isn't with the spacing of the label, but with the size of the underbrace itself. Using the accepted answer at that page as a reference, I do not like the space around (?) caused by the brace underneath it. I would like the left and right vertical limits of the brace to lie under the parentheses, not around them.

That is, the brace in that answer could crudely be sketched as

 (?)
\---/

but I instead would like

(?)
\-/

(In the case I am actually frustrated with right now, the object is du rather than (?), but I think the same reasoning should apply.)

Thanks!

Best Answer

Even after smashing the label width (the usual culprit as addressed in the linked question), the brace cannot shrink any more because it is the smallest size provided in Computer Modern.

Some font/symbol packages define smaller curly braces. The only one I can think of off the top of my head is MnSymbol, which is unfortunate because it has several incompatibilities.

An alternative that should work with any font packages is to define a new \smallunderbrace command that uses the smallest font \tiny to create the brace:

\def\smallunderbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
   $\hfil\displaystyle{#1}\hfil$\crcr
   \noalign{\kern3\p@\nointerlineskip}%
   \tiny\upbracefill\crcr\noalign{\kern3\p@}}}}\limits}

This command is identical to \underbrace from base LaTeX with the exception of \tiny inserted in the last line. Here's the result:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\smallunderbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
   $\hfil\displaystyle{#1}\hfil$\crcr
   \noalign{\kern3\p@\nointerlineskip}%
   \tiny\upbracefill\crcr\noalign{\kern3\p@}}}}\limits}
\makeatother
\newcommand{\clap}[1]{\makebox[0pt]{#1}}

\begin{document}
\begin{gather}
  (du) \\
  (\smallunderbrace{du}_{\text{\clap{label}}}) \\
  (\smallunderbrace{\text{test}}_{\text{\clap{label}}})
\end{gather}
\end{document}

The last test line is just to show that this new command is still extensible, but the \smallunderbrace command should only be used when the standard \underbrace is too big.

Related Question