9
\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: enter image description here

Can someone please help me out?

3

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}

enter image description here

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.

enter image description here

| improve this answer | |
  • To be fussy \; inserts \thickmuskip while around a mathbin we have \medmuskip, so \: should be more appropriate. But +1 anyway :-) – campa yesterday
  • 2
    @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
1

Here's a way to this :

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

enter image description here

| improve this answer | |
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.