# Formatting Math Equations With Modern Tools: Moving Beyond Eqnarray In Latex

## Replacing eqnarray with More Modern Tools

The eqnarray environment has been used extensively in LaTeX documents for formatting multiline equations. However, it comes with several drawbacks that have led to newer, more robust tools being introduced to replace it.

### Issues with the eqnarray Environment

There are three main problems with using the eqnarray environment:

- Poor spacing around relation symbols like =, <, and > leading to suboptimal appearance
- Difficulty aligning equations at the relation symbols instead of at left or right
- Centering line-by-line making asymmetric equations look slightly off

These spacing and alignment issues can make eqnarray environments visually unappealing and harder to read. The individual centering of lines also does not allow spreading equations over multiple lines easily while maintaining alignment.

### The align Environment for Aligning Equations

The align environment is designed specifically for aligning multiline equations horizontally at a specified point like a relation symbol. This allows avoiding poor spacing and alignment issues with eqnarray.

Basic usage is to specify alignment points using ampersands (&) and separate lines using double backslashes (\\\\):

```
\begin{align}
a &= b + c \\\\
d + e &= f
\end{align}
```

Which would display properly spaced and aligned equations as:

The key advantages of align over eqnarray are:

- Correct spacing around relation symbols
- Proper horizontal alignment at any designated point
- No individual centering per line
- Easier multi-line equations

### The gather Environment for Gathering Equations

While align requires aligning each line at a specified marker, the gather environment simply gathers multiline equations vertically. This vertical alignment can be useful for systems of equations and inequalities.

Usage is similar to align except without any ampersands for alignment points:

```
\begin{gather}
a = b + c \\\\
d + e = f
\end{gather}
```

And outputs gathered equations:

Benefits of gather over eqnarray include:

- Better spacing around relation symbols
- Easily write systems of equations or inequalities
- No concerns over improper single line alignments

### Splitting Equations Across Multiple Lines

eqnarray also provides little support for breaking long equations across multiline displays. However, the align environment handles line splitting well through strategic placement of start (&) and end (\\\\) markers.

A long equation can be broken across two lines as:

```
\begin{align*}
a + b + c + {} & d + e + f + g \\\\
& + h + i + j
\end{align*}
```

Notice how the {} marker on the first line allows you to manually specify where line breaks should occur through the order of terms:

This allows splitting equations neatly across any number of lines while preserving alignment at relation symbols.

### Numbering Only One Line in Multi-Line Equations

Another key difference between eqnarray and align is default equation numbering behavior. eqnarray numbers each line independently while align numbers the whole multiline equation.

Numbering can be manually specified in align using \nonumber before the end specifier (\\\\) on lines that should not be numbered:

```
\begin{align}
a + b + c + d + e &\nonumber\\\\
&= f
\end{align}
```

Resulting in a multi-line equation with only one number:

This provides clarity that the split equation is one logical statement.

### Inserting Text Between Aligned Equations

Align also allows inserting text or multiline comments between equation lines which is not possible in eqnarray:

```
\begin{align}
a &= b + c \\\\
\text{because:} \\\\
d + e &= f
\end{align}
```

Enabling annotations for aligned equations:

This is useful for explaining steps between lines.

## Summary of Recommendations Beyond eqnarray

In summary, it is recommended adopting the following practices and LaTeX environments when typesetting multiline equations instead of using eqnarray:

- Use align for horizontally aligning equations especially at relation symbols
- Use gather for vertically gathering systems of equations/inequalities
- Split long equations across properly aligned lines with align
- Number entire multiline equations instead of each line
- Insert textual annotations between aligned lines

Additional modern math environments like IEEEeqnarray, alignat, flalign, and multiline also exist for more specialized use cases. But align and gather can cover most general math typesetting needs while avoiding inherent issues with eqnarray. Consistently replacing eqnarray usage with these newer tools leads to better spacing, alignment, and readability in multiline display equations.