# Does there exist a math version of multido command?

I need a command as \hdotsfor and use it in align environment.

\begin{align*}
X&=a_{11} + a_{12} + \cdots + a_{1n}\\
&\qquad{}+ a_{21} + a_{22} + \cdots + a_{2n}\\
&\text{\multido{}{33}{$\cdot$}}\\
&\qquad{}+ a_{m1} + a_{m2} + \cdots + a_{mn}
\end{align*}


The spacing between dot is not correct. While

\begin{align*}
X&=a_{11} + a_{12} + \cdots + a_{1n}\\
&\qquad{}+ a_{21} + a_{22} + \cdots + a_{2n}\\
&\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\cdot\\
&\qquad{}+ a_{m1} + a_{m2} + \cdots + a_{mn}
\end{align*}


is correct. So I think may be the math environment take a bad effect.

• Welcome to tex.sx! It's not necessary to begin your questions with a greeting. – lockstep Apr 12 '11 at 5:34

Well, \multido works in math mode, so removing \text and the dollars from your example gives the correct spacing, except for the last dot. This is fixed by adding an empty math atom at the end (with {}). Complete example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{multido}
\begin{document}

\begin{align*}
X&=a_{11} + a_{12} + \cdots + a_{1n}\\
&\qquad{}+ a_{21} + a_{22} + \cdots + a_{2n}\\
&\multido{}{33}{\cdot} {}\\
&\qquad{}+ a_{m1} + a_{m2} + \cdots + a_{mn}
\end{align*}

\end{document}


I would say, though that using \vdots in this case is probably a better idea.

\begin{align*}
X &= a_{11} + a_{12} + \cdots + a_{1n}\\
& \qquad{}+ a_{21} + a_{22} + \cdots + a_{2n}\\
& \makebox[5cm]{\dotfill}\\
& \qquad{}+ a_{m1} + a_{m2} + \cdots + a_{mn}
\end{align*}


Try this:

\begin{align*}
\MoveEqLeft
X=a_{11} + a_{12} + \cdots + a_{1n}\\
&+ a_{21} + a_{22} + \cdots + a_{2n}\\
&\text{\multido{}{23}{$\cdot\,$}}\\
&+ a_{m1} + a_{m2} + \cdots + a_{mn}
\end{align*}