The equations do not align with respect to +
You need one more &
to have stuff left-aligned after it (if you want to work with aligned
here).
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[\begin{aligned}
p &= q r &&+ r_0 \\
r &= q_0 r_0 &&+ r_1 \\
r_0 &= q_1 r_1 &&+ r_2 \\
r_k &= q_{k+1} r_{k+1} &&+ r_{k+2} \\
&\mathrel{\vdots} \\
r_{k+1} &= q_{k+2} r_{k+2} \\
\end{aligned}\]
\end{document}
If you want to center the \vdots
, you can use the mathtools
package.
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[\begin{aligned}
p &= q r &&+ r_0 \\
r &= q_0 r_0 &&+ r_1 \\
r_0 &= q_1 r_1 &&+ r_2 \\
r_k &= q_{k+1} r_{k+1} &&+ r_{k+2} \\
&\vdotswithin{=} \\
r_{k+1} &= q_{k+2} r_{k+2} \\
\end{aligned}\]
\end{document}
You need alignedat
, that doesn't add horizontal spacing, but with one &
more.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{alignedat}{2}
p &= q r &&+ r_0 \\
r &= q_0 r_0 &&+ r_1 \\
r_0 &= q_1 r_1 &&+ r_2 \\
&\mathrel{\;\vdots} \\
r_k &= q_{k+1} r_{k+1} &&+ r_{k+2} \\
r_{k+1} &= q_{k+2} r_{k+2}
\end{alignedat}
\]
\end{document}