How to put an arrow below a vector?
I actually would not use arrows for the job at hand. I suggest, instead, that you use \underbrace
directives (provided by the amsmath
package) to provide a platform for the two explanatory text snippets $n-1$ times
and $n$ times
. Indicating explicitly that \mathbf{v}
is a 2n\times1
vector might be helpful too.
\documentclass{article}
\usepackage{amsmath} % for \underbrace macro
\begin{document}
$\mathbf{v}^{}_{2n\times1}=(2n-1,\underbrace{n-1,\dots,n-1}_{\text{$n-1$ times}},\underbrace{1,\ldots,1}_{\text{$n$ times}}\,)'$
\end{document}
The amsmath
package provides \underrightarrow
and \underset
for this job.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\mathbf{v}=(2n-1,n-1,n-1,\underset{n-1}{\underrightarrow{\ldots}},n-1,1,1,\underset{n}{\underrightarrow{\ldots}},1)$.
\end{document}
I have two proposals. In the first one, the arrow reaches a bit beyond the commas, in the second one the arrow covers all objects to be replicated.
The top line is meant to show that the spacing is the same.
\documentclass{article}
\usepackage{amsmath,calc}
\makeatletter
\newcommand{\replA}[2]{% #1 = number of times, #2 = object
\vtop{\offinterlineskip\m@th
\sbox\z@{$,\dotsc,{}$}%
\ialign{&\hfil##\hfil\cr
$#2$&$,\dotsc,{}$&$#2$\cr
\noalign{\kern 1.5pt}
&\scriptsize\makebox[\wd\z@]{\hspace{-0.3em}\rightarrowfill\hspace{-0.3em}}\cr
\multispan{3}\hfil\scriptsize$\mathstrut#1$\hfil\cr
}%
}%
}
\newcommand{\replB}[2]{% #1 = number of times, #2 = object
\vtop{\offinterlineskip\m@th
\ialign{\hfil##\hfil\cr
$#2,\dots,#2$\cr
\noalign{\kern 1.5pt}
\scriptsize\,\rightarrowfill\,\cr
\scriptsize$\mathstrut#1$\cr
}%
}%
}
\makeatother
\begin{document}
$\mathbf{v}=(2n-1,n-1,\dots,n-1,1,\dots,1)$
$\mathbf{v}=(2n-1,\replA{n-1}{n-1},\replA{n}{1})$
$\mathbf{v}=(2n-1,\replB{n-1}{n-1},\replB{n}{1})$
\end{document}