# How to put the dots in the centre?

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
A+B
\\
C+D
\\
D+E
\\
\vdots
\\Y+Z
\end{document}


I want the output like the dots should be placed below the plus sign. But i am getting the dots aligned to the left, how can I fix it.

Sample Output:

One way is use matrix as defined in amsmath package:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\begin{matrix} A + B \\ B + C \\ \vdots \\[3pt] Y + Z \end{matrix}$
\end{document}


or with array (based on the last solution stolen from deleted @campa answer):

\documentclass{article}

\begin{document}
$\begin{array}[t]{r@{\:}c@{\:}l} A & + & B \\ B & + & C \\ & \vdots & \\[3pt] Y & + & Z \\ \end{array}$
\end{document}


Result is in this particular case similar as before, however, now terms on left and right from + can have different lengths but math expressions are still centered at + sign.

• To be fussy \; inserts \thickmuskip while around a mathbin we have \medmuskip, so \: should be more appropriate. But +1 anyway :-) – campa yesterday
• @campa, you are right. Thank you for pointing this. Implemented in answer! BTW, why you delete your answer. It is very good one! – Zarko yesterday
• I was puzzled by something related to the two mathtools-based solutions and I was afraid of having misinterpreted the macros. I didn't like the idea of a possibly wrong answer so I deleted it in order to think about it later. Then time passed and I completely forgot about it... – campa 21 hours ago

Here's a way to this :

\begin{document}
$\begin{array}{l@{~}c@{~}l} A &+ &B\\ C &+ &D\\ &\vdots&\\ E &+ &F \end{array}$
\end{document}


New contributor
mxnc baud is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.