# eqnarray

Legacy multi-line displayed equations with column alignment via & and row breaks via \\, typically with equation numbering on rows.

https://texform.dev/latex/environments/eqnarray

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Alignment](https://texform.dev/latex/topics/alignment) |
| Packages | base |
| Allowed mode | math |
| Tags | math-alignment, discouraged |
| Commonality | medium |
| Body mode | math |

## Syntax

### base

Argument specification: ``

Legacy multi-line displayed equations with column alignment via & and row breaks via \\, typically with equation numbering on rows.

## Common tasks

### How to write a three-column equation array

eqnarray uses &rel&; prefer align, which has better spacing.

```latex
\begin{eqnarray} a &=& b+c \\ &=& d \end{eqnarray}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Beqnarray%7D+a+%26%3D%26+b%2Bc+%5C%5C+%26%3D%26+d+%5Cend%7Beqnarray%7D)

### How to write two numbered lines in eqnarray

```latex
\begin{eqnarray} x+y &=& 1 \\ x-y &=& 0 \end{eqnarray}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Beqnarray%7D+x%2By+%26%3D%26+1+%5C%5C+x-y+%26%3D%26+0+%5Cend%7Beqnarray%7D)

## Examples

```latex
\begin{eqnarray} a = b \end{eqnarray}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Beqnarray%7D+a+%3D+b+%5Cend%7Beqnarray%7D)

```latex
\begin{eqnarray} x & = & y \end{eqnarray}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Beqnarray%7D+x+%26+%3D+%26+y+%5Cend%7Beqnarray%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| base | full | none | full |

## Usage frequency

7.31% of formulas in the measured corpus contain this entry, rank 3 of 31 entries with frequency data.

## In TeXForm

TeXForm reads the environment body in math mode.

### Discouraged in base

eqnarray is widely discouraged in LaTeX practice because it produces poor spacing around relation symbols and has inferior alignment/tagging behavior compared with amsmath alignment environments.

```latex
\begin{eqnarray} a&=&b \\ c&=&d \end{eqnarray} -> \begin{align} a&=b \\ c&=d \end{align}
```

The amsmath align environment is the standard recommended replacement; it provides correct spacing around relation symbols and better equation-numbering/alignment behavior.

```latex
\begin{eqnarray} a&=&b \\ c&=&d \end{eqnarray} -> \begin{equation}\begin{aligned} a&=b \\ c&=d \end{aligned}\end{equation}
```

aligned is preferred when the alignment should be nested inside a surrounding equation-like display, following amsmath conventions and avoiding eqnarray's spacing issues.

## See also

- [align](https://texform.dev/latex/environments/align)
- [align*](https://texform.dev/latex/environments/align-star)
- [eqnarray*](https://texform.dev/latex/environments/eqnarray-star)
- [gather](https://texform.dev/latex/environments/gather)
- [gather*](https://texform.dev/latex/environments/gather-star)
- [split](https://texform.dev/latex/environments/split)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \begin{eqnarray} a & b \end{eqnarray} | Positive: baseline | Pass | Fail | Pass |
