在下面的例子中\underbrace
,我想使用类似的来代替\text bar\leftarrow j+1\rightarrow\textbar
。
(p_{1},p_{2}\ldots,p_{m-j},\underbrace{m,m,\dots,m}_{j+1})
有没有类似的命令?
答案1
您可以\underset
使用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}
答案2
如果你想变得更时尚,还有总是方式tikz
。此\UnderArrow
宏将自动调整上方或下方文本的较长文本,还允许您将样式应用于线条和箭头:
代码:
\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}