Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You can use \underset from amsmath:

enter image description here

\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}
share|improve this answer
add comment

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:

enter image description here

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.