6

I am having trouble writing this vector:

$\textbf{v}=(2n-1,n-1,n-1,\ldots,n-1,1,1,\ldots,1)$.

I want to indicate that $n-1$ appears $n-1$ times and $1$ appears $n$ times by writing arrow under $\ldots$.

But I can't do it.

CarLaTeX
  • 62,716
Charlotte
  • 963

3 Answers3

9

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.

enter image description here

\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}
Mico
  • 506,678
4

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}

enter image description here

Henri Menke
  • 109,596
2

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}

enter image description here

egreg
  • 1,121,712