TransWikia.com

How to put the dots in the centre?

TeX - LaTeX Asked on April 22, 2021

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?

2 Answers

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

Correct answer by mxnc baud on April 22, 2021

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

Answered by Zarko on April 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP