Skip to main content
Created by potrace 1.16, written by Peter Selinger 2001-2019 (then hand-edited)

Stay away from {eqnarray}

·352 words·2 mins
MSP Staff
math environments math displays TeX glue
Table of Contents
Typesetting TeXniques - This article is part of a series.
Part 1: This Article

In the series Typesetting TeXniques, we share our expertise as professional copyeditors and typesetters of mathematics. We frequently hear from authors that our work makes their papers better. This is how we do it.

Here are three examples of bad behavior of the {eqnarray} environment: overwritten equation numbers, incorrect equation references, and bad or inconsistent spacing. A preview of these issues is below, and a detailed analysis and better options for each are in the video.

Problem 1. Overwritten equation numbers
#

Overwritten equation number

The {eqnarray} environment allows the equation label to be overwritten by a too-wide display.

Problem 2. Incorrect equation references
#

A bad reference which corrupts the intended meaning

Here, an easy-to-make mistake in the code—combined with bad behavior of {eqnarray}—results in nonsense, and there are no compilation errors or warnings that something may have gone awry.

Problem 3. Bad horizontal and vertical spacing
#

Excessive horizontal and vertical spacing

The spacing around relational operators at alignment points (in this case, around the equals sign) is noticeably wider than necessary in the {eqnarray} environment, and the space above this display is excessive given the short line of text preceding it. While not as serious as our first two examples of bad behavior of {eqnarray}, unusual or unsightly horizontal or vertical spacing can distract readers.

Watch the video to see ways that we avoid each of these three issues.

Further reading
#

The TeXbook by D. E. Knuth: The concept of glue is introduced in the first few pages of Chapter 12. The spacing that TeX inserts into math formulas, using math glue, is introduced on pages 167–168 of Chapter 18. The table on page 170 gives TeX’s rules for inserting space into math formulas.

The LaTeX Companion, 2nd ed. by F. Mittelbach and M. Goossens with J. Braams, D. Carlisle, and C. Rowley: Environments for displayed math provided by the amsmath package are discussed in Section 8.2. The parameters controlling the vertical space above and below displays are given at the beginning of Section 8.2.10. Equation numbering is discussed in Section 8.2.11.

“Avoid eqnarray!” by Lars Madsen: This very nice short paper in The PracTeX Journal, No. 4 (published in 2006) presents similar examples.

Typesetting TeXniques - This article is part of a series.
Part 1: This Article