Why align and equation environment do not tolerate empty lines?

The error message tells exactly why it is problematic:

Paragraph ended before \align was complete.

In standard (La)TeX, an empty line signifies a paragraph break.

Since it does not make sense to start a new paragraph inside a single math display, the display math environments were not implemented with paragraph breaks in mind (a simplification, but we might think of this in this way: they are not "long" environments).

Because these environments were not created allowing paragraph breaks, when TeX encounters an empty line (a paragraph break with a "standard" catcode setup), it assumes that the user forgot to close the environment, closes it (thereby leaving display math), starts a new paragraph, and moves happily along.

Then it finds all these other math-mode tokens, but we are no longer in math mode because of the above paragraph. So that is the cause of all the errors following the first one.


As requested, elaborating a bit on the following statement:

[I]t does not make sense to start a new paragraph inside a single math display[.]

Depending on one's chosen/preferred style, a displayed equation or group of equations is either

  • part of a single sentence unit, or
  • a standalone unit roughly equivalent to a sentence.

The former case is most common in mathematical and technical writing. Here, the equation(s) fit in with the surrounding wording and include punctuation so they can be read continuously with the surrounding text. In this case, we would not start a new paragraph within an equation any more than we would start a new paragraph within a single sentence.

In the latter case, which is less common, a single equation could be its own paragraph, but it is more likely to have some text sentences around it introducing it or explaining it, so the displayed equation is usually "attached" to some body copy, so it belongs to the paragraph of that body copy. (Just as a single sentence could be its own paragraph, but it is more common for multiple sentences to make up a paragraph.) Either way, again, we would not start a new paragraph within an equation any more than we would start a new paragraph within a single sentence.

For groups of equations in a single display environment, the very fact that they are logically grouped means they are related and part of the same "idea" in some way. Just as we group sentences together to form paragraphs, equations grouped in this way should belong to the same "idea" or paragraph. If you really intend to start a new "idea" or paragraph within a group of equations, I would argue that the group of equations should be split at this point rather than trying to introduce a paragraph break inside the group of equations.

Hopefully this helps to explain why I said that it doesn't make sense to start a new paragraph inside a math display environment.


By design latex tries to give commands a consistent syntax, the environment syntax in particular here makes it clear what is intended to be in math, and what is not.

However the error message comes from the tex engine itself if \par is seen in math mode. To prevent this latex would have to prevent blank lines generating a \par token (which is tricky to do in all contexts) or locally redefine \par to do nothing (which is what it does to ignore blank lines between table rows) However it doesn't.

The reason for the error is related to the primitive syntax for math $ and $$ which doesn't have a clear begin/end distinction, and to the error recovery of adding $ when a math construct is used in text.

If (as posted here every other day) you go

blah blah foo_bar  blah ...

then on seeing the _ Tex inserts a $ to get into math mode. After that it would be quite likely the entire document was gobbled up in one line, with no spaces. The error trap on end of paragraph "limits the damage" allowing TeX to force an end to math mode at the end of the paragraph and re-start the next paragraph in text mode and so reduce the number of spurious errors reported.

Whether or not this is still useful with modern editor workflows is open to debate but it is certainly an intentional design feature.