# Array padding not right [duplicate]

I have the following array environment:

\begin{array}{ccc}
0 & = & \text{some equation} \\
0 & = & \text{some other equation} \\
& \vdots \\
0 & = & \text{last equation}
\end{array}


However, I get lots of spacing around the equal signs here, not unlike when using the eqnarray environment.

I want to use the array environment because \vdots is of smaller width than =, and gets centered under it.

Any help on conforming the padding/spacing to other equations would be greatly appreciated.

## marked as duplicate by Werner spacing StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 7 '16 at 3:01

The mathtools provides a \vdotswithin command exactly for this situation:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{align}
0 &=  \text{some equation} \\
0 &=  \text{some other equation} \\
&\vdotswithin{=} \notag \\
0 &=  \text{last equation}
\end{align}

\end{document}


The appropriate spacing in an array environment requires you to remove the default array column separation (\arraycolsep) and insert empty groups where needed so the binary relations/operators can space themselves. This is easily achieved via array's \newcolumntype.

Below the new column type C inserts {} to the left (using >) and right (using <) of its contents:

\documentclass{article}
\usepackage{amsmath,array}% http://ctan.org/pkg/{amsmath,array}
\newcolumntype{C}{>{{}}c<{{}}}
\begin{document}
$\begin{array}{c@{}C@{}c} a & = & \text{some equation} \\ b & = & \text{some other equation} \\ & \vdots \\ c & = & \text{last equation} \end{array}$

\begin{align*}
a &= \text{some equation} \\
b &= \text{some other equation} \\
& \vdots \\
c &= \text{last equation}
\end{align*}
\end{document}


While you're still left with padding on the array ends, it doesn't make a difference in terms of the alignment, as you can see in comparison to using align.

There are advantages to using array above align, but there are also drawbacks. One advantage is an easy alignment change to suit your needs compared to the fixed right-left alignment of align. However, align provides flexibility when you have multiple alignment points, together with interspersed text-capability, page-breakability, vertical spread-out-i-ness (somewhat achievable via \renewcommand{\arraystretch}{1.2} when using array), ... So, all-in-all, align works better.

In this solution, I use the features of the stackengine package to create vertical stacks. A "Long stack" as defined by the package, creates stacks whose inter-item baseline is constant and settable (default \baselineskip). It can be told to stack its arguments in text mode (default) or math mode.

So this solution is composed of three stacks: a stack of right-aligned zeros (with a blank line where the vdots are; a stack of center-aligned equal signs with slightly-shifted \vdots, enclosed in a \mathrel for proper horizontal spacing; and a stack of left-aligned text sentences.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}[2013-10-15]
\begin{document}
$\stackMath \Longstack[r]{0\\0\\ \\0} \mathrel{\Longstack{=\\=\\ \raisebox{-1.5pt}{\vdots}\\=}} \stackText \Longstack[l]{some equation\\some other equation\\ \\last equation}$
\end{document}


• People who aren't already familiar with the stackengine package and its many capabilities would probably appreciate getting a couple of sentences that explain what your setup is all about. – Mico Oct 20 '13 at 6:07
• @mico Good point, Mico. Done. – Steven B. Segletes Oct 20 '13 at 11:08
• this looks great, but ... consider the plight of a visually impaired reader, who must rely on an audio rendering. unfortunately the important flow of the message is lost. a way to keep the meaning more scrutable would be welcome. – barbara beeton Oct 20 '13 at 12:00
• @barbarabeeton Thank you for that comment. It is the first time that issue has been brought to my attention, and I must admit I hadn't thought of it before. Sad to say, I'm not sure that issue can be resolved with stacking as the methodology. – Steven B. Segletes Oct 20 '13 at 22:34