Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am attempting to write a system of linear equations that looks like this:

A_{11}x_1 + A_{12}x_2 + \cdots + A_{1n}x_n = y_1
A_{21}x_1 + A_{22}x_2 + \cdots + A_{2n}x_n = y_2
\vdots      \vdots               \vdots      \vdots
A_{m1}x_1 + A_{m2}x_2 + \cdots + A_{mn}x_n = y_m

where the vdots are centered on the terms rather than the equal sign. Here is my attempt:

\documentclass{report}
\usepackage{amsmath}
\begin{document}

\begin{align*}
&A_{11}x_1& + &A_{12}x_2& + \cdots + &A_{1n}x_n& = &y_1& \\
&A_{21}x_1& + &A_{22}x_2& + \cdots + &A_{2n}x_n& = &y_2& \\
&\vdots&  &\vdots& &\vdots& &\vdots& \\
&A_{m1}x_1& + &A_{m2}x_2& + \cdots + &A_{mn}x_n& = &y_m& \\
\end{align*}

\end{document}

Anyone have an elegant solution?

EDIT. Here is a second attempt, using the better-suited array environment. It looks better, but still unnatural.

\documentclass{report}
\begin{document}

\[\begin{array}{ccccccccc}
A_{11}x_1 & + & A_{12}x_1 & + & \cdots & + & A_{1n}x_n & = & y_1 \\
A_{21}x_1 & + & A_{22}x_2 & + & \cdots & + & A_{2n}x_n & = & y_2 \\
\vdots    &   & \vdots    &   &        &   & \vdots    &   & \vdots \\
A_{m1}x_1 & + & A_{m2}x_2 & + & \cdots & + & A_{mn}x_n & = & y_m \\
\end{array}\]

\end{document}

Is there any way to have the vdots aligned like this but make the equations look normal?

share|improve this question
3  
An array environment? –  Abhimanyu Arora Jun 12 at 15:47
    
@AbhimanyuArora That works better, but it still doesn't look right. See edit. –  fctaylor25 Jun 12 at 15:53

3 Answers 3

up vote 6 down vote accepted

I suggest the following modification:

\documentclass{report}
\usepackage{array}
\begin{document}

\[\begin{array}{*{9}{@{}c@{}}}
A_{11}x_1 & {}+{} & A_{12}x_1 &{}+{} & \cdots & {}+{} & A_{1n}x_n & {}\mathrel{=}{} & y_1 \\
A_{21}x_1 & + & A_{22}x_2 & + & \cdots & + & A_{2n}x_n & = & y_2 \\
\vdots    &   & \vdots    &   &        &   & \vdots    &   & \vdots \\
A_{m1}x_1 & + & A_{m2}x_2 & + & \cdots & + & A_{mn}x_n & = & y_m \\
\end{array}\]

\end{document}

enter image description here

share|improve this answer
    
Looks great, thanks! –  fctaylor25 Jun 12 at 16:11

I'd recommend you use the a \makebox to get the \vdots centered and use the alignat environment to do multiple alignment points:

enter image description here

Code:

\documentclass{report}
\usepackage{amsmath}
\usepackage{calc}

\newcommand*{\MyVdots}[1][$A_{22}x_n$]{\makebox[\widthof{#1}]{$\vdots$}}%
\newcommand*{\Ph}{\hphantom{{}+{}}}%
\begin{document}

\begin{alignat*}{5}
    &A_{11}x_1 &&{}+ A_{12}x_2  &&{}+ \cdots &&{}+ A_{1n}x_n && = y_1 \\
    &A_{21}x_1 &&{}+ A_{22}x_2  &&{}+ \cdots &&{}+ A_{2n}x_n && = y_2 \\
    &\MyVdots  &&\Ph \MyVdots   &&           &&\Ph  \MyVdots &&\Ph \MyVdots[$y_1$] \\
    &A_{m1}x_1 &&{}+ A_{m2}x_2  &&{}+ \cdots &&{}+ A_{mn}x_n && = y_m \\
\end{alignat*}

\end{document}
share|improve this answer

Here are two TABstacks, one with a lesser space around the \vdots, the other with a greater space.

\documentclass{report}
\usepackage{tabstackengine}
\stackMath
\begin{document}
\[\TABbinary
\let\svvdots\vdots\def\vdots{\protect\raisebox{-3pt}{$\svvdots$}}
\tabbedCenterstack{
A_{11}x_1 & + & A_{12}x_1 & + & \cdots & + & A_{1n}x_n & = & y_1 \\
A_{21}x_1 & + & A_{22}x_2 & + & \cdots & + & A_{2n}x_n & = & y_2 \\
\vdots    &   & \vdots    &   &        &   & \vdots    &   & \vdots \\
A_{m1}x_1 & + & A_{m2}x_2 & + & \cdots & + & A_{mn}x_n & = & y_m \\
}\]
\[\TABbinary
\let\svvdots\vdots\def\vdots{\protect\raisebox{3pt}{$\svvdots$}}
\tabbedShortstack{
A_{11}x_1 & + & A_{12}x_1 & + & \cdots & + & A_{1n}x_n & = & y_1 \\
A_{21}x_1 & + & A_{22}x_2 & + & \cdots & + & A_{2n}x_n & = & y_2 \\
\vdots    &   & \vdots    &   &        &   & \vdots    &   & \vdots \\
A_{m1}x_1 & + & A_{m2}x_2 & + & \cdots & + & A_{mn}x_n & = & y_m \\
}\]
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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