# What is the advantage of using the equation environment in latex?

My flatmate uses \flalign for all of his equations in LaTeX and after thinking about it, it makes sense. Is the \equation environment not just more restrictive? Is there ever an advantage to using the \equation environment?

Is it simply that \flalign requires the amsmath package?

-

## migrated from stackoverflow.comApr 9 '13 at 15:41

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your post was migrated here from another Stack Exchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – egreg Apr 9 '13 at 15:45
Compare the outputs of Equation$$a=b$$ and of Equation\begin{flalign}a=b\end{flalign}. You'll see bigger vertical space in the latter case. – egreg Apr 9 '13 at 15:46

As egreg mentioned in his comment, when using equation and flalign there's a difference in the vertical spacing around the formula if the line of text immediately before it stops before the math expression. In the following example this can be seen using some visual guidelines drawn with the help of TikZ:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}

\newcommand\myline[2][red]{%
\draw[#1] ([yshift=#2]current page.west) -- ([yshift=#2]current page.east);
}
\begin{document}

Short line
$$a=b$$
Short line
\begin{flalign}$$a=b$$\end{flalign}
Short line

A not so short line of text for the example
$$a=b$$
A not so short line of text for the example
\begin{flalign}$$a=b$$\end{flalign}
A not so short line of text for the example

\begin{tikzpicture}[remember picture,overlay]
\myline{262}
\myline{250}
\myline[blue]{232}
\myline[blue]{210}
\myline{177}
\myline{154}
\myline[blue]{132}
\myline[blue]{111}
\end{tikzpicture}

\end{document}


The red rules correspond to equation and the blue ones, to flalign.

The difference in spacing is explained because, for the equation environment, different lengths controlling the vertical spacing surrounding a formula are applied, depending on whether the line before the formula stops before the formula or not.

There are four lengths regulating the vertical spacing around displayed equations: \abovedisplayskip, \belowdisplayskip, \abovedisplayshortskip, \belowdisplayshortskip. Their default values for the article class at 10pt are:

\abovedisplayskip=10pt plus 2pt minus 5pt
\belowdisplayskip=10pt plus 2pt minus 5pt
\abovedisplayshortskip=0pt plus 3pt
\belowdisplayshortskip=6pt plus 3pt minus 3pt


The short variants will be applied for equation, but not for flalign, if the text line immediately before the formula ends before it.

So, what's the advantage of using equation? Well, when the line ends before the formula, equation will introduce less vertical space around the formula, so the expression (remember that, in this case we're considering a one line expression) won't appear too detached from the surrounding text.

-
Thank you so much! I hadn't noticed the vertical spacing difference and I also didn't know that there was a variation due to the preceding text length. It definitely looks better with \equation. May I ask a brief follow up question, would you recommend using a \split environment wrapped in an \equation rather than using \flalign for the purpose of a simple multiline equation? – oLas Apr 10 '13 at 12:24
@oLas You're welcome. Regarding your question, that would depend on the kind of alignment you want; for example, flalign can handle more than one split but equation can handle just one (this can be useful depending on how you want things numbered). On the other side, split can handle just one alignment column, but flalign can handle many more. If you don't want any special alignment, amsmath offers you some other possibilities such as multline. The mathmode document can give you some more information. – Gonzalo Medina Apr 10 '13 at 13:31