Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

While browsing some of the older questions I learned that I should not use $$. I also learned that I blamed LaTeX for obscure error messages that can be prevented by using \( and \). I started to further review my LaTeX files (old habits die hard) and now I have the following question:

Even if not using $$, there are many possible ways to get equations separated from the text. Which one should I use and why? \begin{equation}, \[, \begin{eqnarray} or some other?

I want to make the question more precise and ask for

  • a. a one line equation with no label/number,
  • b. a one line equation with a label/number,
  • c. a multi line equation with no label/number,
  • d. a multi line equation with one label/number and
  • e. a multi line equation with one number/label for each line.

Could you please point out if a package is needed as well, but I would prefer to learn the 'pure' LaTeX macros/ environments, first.

share|improve this question
4  
Avoid eqnarray! –  Thorsten Donig Oct 23 '11 at 9:16
7  
All your questions will be answered if you read the mathmode by Herbert Voß –  Marco Daniel Oct 23 '11 at 9:21

2 Answers 2

up vote 10 down vote accepted

The built-in environments are displaymath for a single unnumbered equation, equation for a single numbered equation, and eqnarray and eqnarray* for multiple aligned equations with and without numbering, respectively. \[ and \] are equivalent to \begin{displaymath} and end{displaymath}.

It is widely accepted that eqnarray and eqnarray* should not be used, because the spacing they create is inconsistent with all of the other environments (see Avoid eqnarray for details).

To generate aligned equations, one could use the array environment inside an equation or displaymath environment, but most people load the amsmath package, which provides many flexible environments for displayed equations. Note that amsmath creates an equation* environment for single unnumbered equations, which is syntactically more consistent than displaymath.

share|improve this answer
    
Let me see if I got everything: \usepackage{amsmath}. Then use (a) \begin{equation*}, (b) \begin{equation}, (c) \begin{align*}, (d) \begin{equation}\begin{split}, (e) \begin{align} –  Andy Oct 23 '11 at 15:25
    
(a), (b) yes. For (c), (d) & (e) it depends on exactly what you want. I use multline and multline* for single equations that are too long for one line, and align and align* for multiple equations with an aligned symbol on each line (e.g. =). Of course amsmath provides much more than this --- just choose the environment that is best suited to your needs. –  Ian Thompson Oct 24 '11 at 10:28

I'd also note that using \begin/end{equation*} instead of \[ ... \] makes the code a lot easier to edit, and the start and end part are much easier to spot.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.