# eqnarray vs align

I want to include a list of related equations, say, for a proof, in my LaTeX document. As far as I know, I have two good options, eqnarray and align. What is the difference between them, and how do I know which I should be using? Or does it not matter at all?

-

Although eqnarray may seem to work "well enough", Avoid eqnarray! Avoid eqnarray! Avoid eqnarray!

Use align and the rest of the ams environments. See texdoc amsldoc (PDF) or the short math guide for LaTeX for documentation on how to use them.

-
"avoid eqnarray" has been updated and published in tugboat 33:1. this will be accessible only to tug members until spring 2013, but after that it will be open to anyone. – barbara beeton Dec 15 '12 at 17:50

align is from amsmath, while eqnarray is from base LaTeX, so I would expect the former to be better. Some differences:

• eqnarray has two alignment points (it's basically just array with a default preamble); align has one. x + y &=& z versus x + y &= z
• eqnarray changes the spacing at the alignment points depending on different factors; align keeps it fixed (which is generally what you want)
• eqnarray allows page breaks between lines; align doesn't
• \\ * is treated the same as \\* in eqnarray, but won't work in align (since * shows up commonly in equations)

(largely from The LaTeX Companion §8.2.1)

-

The align environment only works if you use the AMS (American Mathematical Society) packages. If you need to use journal specific document classes or style files, the align environment may not be available. (For example, when I needed to use the iopart class for submission to an Institute of Physics journal, I had to change all my aligns to eqnarrays for the file to compile.

But unless you are forced to, I generally recommend the align environment. Here's a good write-up of what the differences are.

-

If you must use the eqnarray environment, there's a package called eqnarray (available here) that at least removes the excessive space around the middle column. Compare:

\documentclass{article}

\usepackage{eqnarray,amsmath}

\begin{document}

\begin{eqnarray*}
A&=&B,\\
C&=&D,\\
E&=&F
\end{eqnarray*}

\begin{align*}
A&=B,\\
C&=D,\\
E&=F
\end{align*}

\end{document}


The package is for LaTeX 2.09, but it might still work.

I notice that, in my example, the eqnarray* and align* are centered very slightly differently (the eqnarray* is less than 1 point to the left of the align*). I'm not sure why. If you use {B,} and {D,} instead of B, and D, in the eqnarray*, the two displays come out centered exactly the same, so I assume that the ending punctuation symbols are causing the problem. (The default eqnarray* appears to have the same issue.)

-

## protected by WernerJan 20 '12 at 7:42

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.