I'm trying to align two equations using eqnarray.



\subsubsection*{\begin{center}Variance equations\end{center}}
\mu = \tfrac{1}{NM}\sum\limits_{x=1}^N\sum\limits_{y=1}^MA(y,x)\nonumber\\
varTot = \tfrac{1}{NM}\sum\limits_{x=1}^N\sum\limits_{y=1}^M(A(y,x)-\mu)^2

The task description specifically states that I should use eqnarray.

Image of what it should look like (I achieved this earlier by using two equation environments):

enter image description here

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Nov 17, 2014 at 0:58
  • 2
    If using eqnarray` you need &=& but really it is better not to use that and use align from amsmath. Also don't use math italic for multi-letter identifiers, use \mathit{varTot} so it looks like a word not a product of variables, and \begin{center in a section title is so wrong:-) just use plain text and specify section formatting elsewhere (apart from looking weird, it will mess up the table of contents) Commented Nov 17, 2014 at 1:08
  • 2
    you don't need \limits (limits layout is automatic in display math for \sum) Commented Nov 17, 2014 at 1:09
  • Thanks for the tips mate! Adding &=& got it working. I don't understand what you mean by 'use \mathit{varTot}' I see no difference.
    – Lightvvind
    Commented Nov 17, 2014 at 1:14
  • Make a zoom and you'll see differences: small spaces are added between letters if you don't use \mathit; they correspond to the side bearings, that are necessary e.g. in case of exponents or indices.
    – Bernard
    Commented Nov 17, 2014 at 1:19

1 Answer 1


Here are two solutions, first with eqnarray, then with align (an environment provided by the amsmath package). Note the absurdly large amount of space around the = symbols when using eqnarray -- it's one of the reasons why eqnarray is considered badly deprecated these days and really shouldn't be used anymore.

Incidentally, since both eqnarray and align set their material in \displaystyle math mode, \limits is on by default and needn't be specified.

enter image description here

\setlength\textwidth{3in} % just for this example

\subsubsection*{With \ttfamily eqnarray}
\mu &=& \tfrac{1}{NM}\sum_{x=1}^N\sum_{y=1}^MA(y,x)\nonumber\\
\mathrm{varTot} &=& \tfrac{1}{NM}\sum_{x=1}^N\sum_{y=1}^M(A(y,x)-\mu)^2

\subsubsection*{With \ttfamily align}
\mu &= \tfrac{1}{NM}\sum_{x=1}^N\sum_{y=1}^MA(y,x)\nonumber\\
\mathrm{varTot} &= \tfrac{1}{NM}\sum_{x=1}^N\sum_{y=1}^M(A(y,x)-\mu)^2


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .