Spacing in `alignat' and `alignedat'

The code {}+{} works because it adds empty atoms at either side of the operation, ensuring correct spacing.

However, you can input more easily this formula with array:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{equation*}
\left\{
\setlength{\arraycolsep}{0pt}% no padding
\newcolumntype{B}{>{{}}c<{{}}}
\begin{array}{ l B l B l B l B l }
b_{1,1} x_2 & + & b_{1,2} x_2 & + & \cdots & + & b_{1,9} x_9 & = & c_1 \\
b_{2,1} x_2 & + & b_{2,2} x_2 & + & \cdots & + & b_{2,9} x_9 & = & c_2 \\
  & \vdots && \vdots && \vdots &&  \vdots \\
b_{9,1} x_2 & + & b_{9,2} x_2 & + & \cdots & + & b_{9,9} x_9 & = & c_9
\end{array}
\right.
\end{equation*}

\end{document}

Here the {}+{} trick is used as well, but hidden in the temporary column type B (for Binary).

enter image description here


You don't need so many alignment points. Actually, the number of alignment points essentially depends on the number of vertical dots you want to align. I give two possibilities, with 4 or 2 alignment points (7 or 3 ampersands). The alignment itself uses the \vdotswithin command, from mathtools, and the braces come from the empheq package (which loads mathtools). You don't need an alignedat environment nested in an equation*, alignat* will do the job.

    \documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[overload]{empheq}

\begin{document}

\begin{alignat*}{4}[left =\empheqlbrace]
     b_{1,1} x_2 &{}+ {}& b_{1,2} x_2 &{} + ⋯ +{} & b_{1,9} x_9 & ={} & c_1 \\
 b_{2,1} x_2 &{}+{} & b_{2,2} x_2 &{} + ⋯ + {}& b_{2,9} x_9 & = & c_2 \\[-1.5ex]
  \vdotswithin{b_{2,1} x_2}&& \vdotswithin{b_{2,2} x_2} && \vdotswithin{b_{2,9} x_9 } &&\vdotswithin{c_2} \\[-1ex]
     b_{9,1} x_2 &{}+ {}& b_{9,2} x_2 &{} + ⋯ + {}& b_{9,9} x_9 & = & c_9
\end{alignat*}

\begin{alignat*}{2}[left =\empheqlbrace]
     b_{1,1} x_2 &{}+ b_{1,2} x_2 + ⋯ + b_{1,9} x_9 & ={} & c_1 \\
 b_{2,1} x_2 &{}+ b_{2,2} x_2 + ⋯ + b_{2,9} x_9 & = {}& c_2 \\[-1.5ex]
  \vdotswithin{b_{2,1} x_2} && \vdotswithin{ = {}} \\[-1ex]
     b_{9,1} x_2 &{}+ b_{9,2} x_2 + ⋯ + b_{9,9} x_9 & = {}& c_9
\end{alignat*}

\end{document} 

enter image description here

Tags:

Alignat