3

How can I put the dots in the middle of the last line? The following doesn't work.

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath,mathtools}
\begin{document}
\begin{align*}
a&=a+a+a+a+a\\
a&=a+a+a+a+a+a+a+a+a+a\\
\vdotswithin{a=a+a+a+a+a+a+a+a+a+a}
\end{align*}
\end{document}

Thank you!

  • Perhaps \ldots should do the trick on its own line. – Sean Roberson Sep 14 '16 at 16:23
  • You should use in the last row &\vdotswithin{=}. \vdotswithin just aligns the dots in the middle of the witdth of the argument, that way, after the alignment point & you are aligning the dots to the middle of the equal sign width. – Manuel Sep 14 '16 at 16:24
  • @Manuel I want the dots in the middle –  Sep 14 '16 at 16:26
  • 1
    In the middle of what? Of the whole last line? You can do \sbox0{$a$} \kern-\wd0 before your \vdotshwithin{..}. – Manuel Sep 14 '16 at 16:26

3 Answers3

2

Don't tell anybody, it's a secret:

\documentclass{scrartcl}

\usepackage{amsmath}

\begin{document}

\begin{align*}
a&=a+a+a+a+a\\
a&=a+a+a+a+a+a+a+a+a+a\\
\multispan{2}\hfill\vdots\hfill
\end{align*}

\end{document}

(I removed whatever unnecessary for the example.)

enter image description here

egreg
  • 1,121,712
1

Maybe you want this, based on the eqparbox package:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{mathtools, eqparbox}

\newcommand\eqmathbox[2][1]{\eqmakebox[#1]{\ensuremath{\displaystyle#2}}}

\begin{document}

\begin{align*}
  a & =a+a+a+a+a \\
  a & =\eqmathbox[ls]{ a+a+a+a+a+a+a+a+a+a} \\[-1ex]
    & ⋮ within{=}\eqmathbox[ls]{ ⋮ } \\
\end{align*}

\end{document} 

enter image description here

Taking advantage of @egreg's secret, the following code produces the same result (note no space must be left in the 3rd row code):

\begin{align*}
a&=a+a+a+a+a\\
a&= a+a+a+a+a+a+a+a+a+a\\[-1ex]
 &\multispan{1}\ensuremath{\vdotswithin{=}}\hfill\vdots\hfill
\end{align*}
Bernard
  • 271,350
0

Taking for instance egreg's definition you can just do in the last line &\negphantom{a}\vdotswithin{a=a+a+a+a+a+a+a+a+a+a}

\makeatletter
\newlength\negph@wd
\DeclareRobustCommand*\negphantom[1]
  {\ifmmode\mathpalette\negph@math{#1}%
   \else\negph@do{#1}\fi}
\newcommand*\negph@math[2]{\negph@do{$#1#2\m@th$}}
\newcommand*\negph@do[1]
  {\settowidth{\negph@wd}{#1}\hspace*{-\negph@wd}}
\makeatother
Manuel
  • 27,118