# Is there a better way to do this than using tabular?

I am wondering if there is a better way to point to the median using an \uparrow (or maybe another arrow/method) with text underneath/accompanying it. I had to put this construct in a table to get things to lineup.

\begin{tabular}{c c c}
$\underbrace{2\quad 9\quad 10\quad 12}_\text{4 elements}$& $\underbrace{19\quad 22}$&$\underbrace{37\quad 39\quad 46\quad 50}_\text{4 elements}$\\
&   $\Big\uparrow$ &\\
&&\\
&$\text{Median}=\frac{19+22}{2}=20.5$&\\
\end{tabular}


Here is the output of the above code snippet:

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.

• Thank you very much! – Jimmy Touma May 27 '20 at 0:36

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}


• Thank you Vincent. You're solution is also neat and I'll use it as well. – Jimmy Touma May 27 '20 at 0:38