Is there a better way to do this than using tabular?
Use \substack
and \mathclap
to pretend the large subscript has no width.
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\underbrace{2\quad 9\quad 10\quad 12}_{\text{$4$ elements}}
\quad
\underbrace{19\quad 22}_{
\substack{
\big\uparrow\\[3pt]
\mathclap{\text{Median}=\frac{19+22}{2}=20.5}
}
}
\quad
\underbrace{37\quad 39\quad 46\quad 50}_{\text{$4$ elements}}
\]
\end{document}
Note that \operatorname
is no substitute for \mathrm
or \text
.
Maybe just placing an array
below the underbrace
.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Compute the median according to the above algorithm
\[
\underbrace{2\quad 9\quad 10\quad 12}_{4\text{ elements}}
\underbrace{19\quad 22}_{\begin{array}{c}
\Big\uparrow \\[6pt] \operatorname{Median} = \frac{19+22}{2} = 20.5
\end{array}}
\underbrace{37\quad 39\quad 46\quad 50}_{4\text{ elements}}
\]
\end{document}