A number of related questions have already been asked about this issue:
- align vs equation
- which is preferable to
- what to do with this hyperref note on amsmath
- and even eqnarray vs align
But I'm still confused by the conflicting suggestions that have been given so far. So I'm trying again.
Which should be the preferred command to produce a displayed equation in my LaTeX documents?
So far the suggestions indicate that one should use \[ ... \]
, maybe \begin{equation*} ... \end{equation*}
, or maybe even the gather*
or align*
environments from amsmath
.
And one should definitely avoid using either $$...$$
or the eqnarray
environment.
Now I have to say that, from a language perspective, I have a strong preference for the equation*
environment because it is less cryptic than the \[ ... \]
notation and it is semantically the most accurate.
So, is it fine to use equation*
? Maybe only after loading amsmath
? Or should the equation
/equation*
environment be redefined to something else so that spacing, package support, or whatever is improved?
Best Answer
You should use the environments from amsmath. In practice,
equation
andalign
are all you usually need.If you have a single equation, use
equation
. (Orequation*
if you don't want it numbered. Most of the other environments below also have similar * variants.)If you have a single equation spanning multiple lines, you can either use
multline
, or usesplit
(insideequation
) to have the parts aligned.If you have multiple equations and you want them to be aligned, use
align
(oralign*
).If you simply want to typeset multiple equations independently (with no alignment), use
gather
.There are also
flalign
andalignat
, for some special cases. See the Short Math Guide for LaTeX ortexdoc amsldoc
(PDF) for more documentation on these environments.\[
simply says "set the following in a math display", like plain TeX 's$$
(which you should not use), and is equivalent todisplaymath
. You can use it if you want an unnumbered equation and are too lazy to type (not good practice, semantically speaking), or, I guess, when you're simply "displaying" some long bit of mathematics that isn't an actual equation. And never use eqnarray.