Up arrow under a sequence

A simple \uparrow can be placed using \underset{\uparrow}{<stuff>}. If you're adding wide content, you may want to consider stacking them (using \substack - a small array structure) and using \mathclap (from mathtools).

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\[
  x_1(n) = (1, 2, 3)
         = (\underset{\uparrow}{1}, 2, 3)
         = (1, \underset{\uparrow}{2}, 3)
         = (1, 2, \underset{\uparrow}{3})
         = (1, \underset{\mathclap{\substack{\uparrow \\ n = 2}}}{2}, 3)
\]

\end{document}

Basically the same as Werner's answer but with some wrapping around it:

\documentclass{article}

\usepackage{amsmath}

\makeatletter

\newcommand*{\underarrow}{\def\@underarrow{\relax}\@ifstar{\@@underarrow}{\def\@underarrow{\hidewidth}\@@underarrow}}
\newcommand*{\@@underarrow}[2][]{\underset{\@underarrow\substack{\uparrow\if\relax\detokenize{#1}\relax\else\\#1\fi}\@underarrow}{#2}}

\newcommand*{\overarrow}{\def\@overarrow{\relax}\@ifstar{\@@overarrow}{\def\@overarrow{\hidewidth}\@@overarrow}}
\newcommand*{\@@overarrow}[2][]{\overset{\@overarrow\substack{\if\relax\detokenize{#1}\relax\else#1\\\fi\downarrow}\@overarrow}{#2}}
\makeatother

\begin{document}

\[
(1, 2, 3)
= (\underarrow{1}, 2, \overarrow{3})
= (1, \underarrow{2}, 3)
= (\overarrow[n=1]{1}, 2, \underarrow{3})
= (1, \underarrow[n = 2]{2}, 3)
= (\underarrow*[n=1]{1}, \underarrow*[n = 2 \\ n=2]{2}, 3)
\]

\end{document}

enter image description here

The extra text can be given as optional parameter. The unstarred version ignores the width of the optional parameter, the starred doesn't.

Tags:

Equations