# How to use arrow instead of underbrace?

In the following example instead of \underbrace, I want to use something like \text bar\leftarrow j+1\rightarrow\textbar.

(p_{1},p_{2}\ldots,p_{m-j},\underbrace{m,m,\dots,m}_{j+1})

Is there any similar command?

-

You can use \underset from amsmath:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
$(p_{1},p_{2}\ldots,p_{m-j},\underbrace{m,m,\dots,m}_{j+1})$ \par
$(p_{1},p_{2}\ldots,p_{m-j},\underset{\leftarrow\hfill j+1\hfill\rightarrow}{m,m,\dots,m})$ \par
$(p_{1},p_{2}\ldots,p_{m-j},\underset{\text{\textbar}\leftarrow\hfill j+1\hfill\rightarrow\text{\textbar}}{m,m,\dots,m})$
\end{document}

-

If you want to be able to get a bit fancier, there is always the tikz way. This \UnderArrow macro will auto adjust for the longer texts either above or as part of the text below, and also allows you to apply styling to the lines and arrows:

## Code:

\documentclass{article}
\usepackage{tikz}

\newcommand*{\UnderArrow}[3][]{%
\begin{tikzpicture}[baseline, inner sep=0pt]
\node [anchor=base]  (A) {$#2$};
\node [below] (B) at (A.south) {$#3$};
\begin{scope}[overlay]
\draw [thick, #1, -] ([xshift=-0.07em]A.south east) -- ++ (0,-2.0ex);
\draw [thick, #1, -] ([xshift=+0.07em]A.south west) -- ++ (0,-2.0ex);
\draw [-stealth, #1] (B.west) -- ([xshift=+0.07em]B.west -| A.south west);
\draw [-stealth, #1] (B.east) -- ([xshift=-0.07em]B.east -| A.south east);
\end{scope}
\end{tikzpicture}%
}%

\begin{document}
$(p_{1},p_{2}\ldots,p_{m-j},\UnderArrow{m,m,\dots,m}{j+1})$

\medskip
$(p_{1},p_{2}\ldots,p_{m-j},\UnderArrow[blue]{m,m,\dots,m}{j+k+1})$

\medskip
$(p_{1},p_{2}\ldots,p_{m-j},\UnderArrow[red, -latex]{m,n,o,p,\dots,q,r,s}{j+k+1})$
\end{document}

-