Posted: Feb 16, 2012 3:28 am
by Pulsar
[math]

Equations

I've used the \begin{align} \end{align} environment several times already, without discussing its use: with align, you can type multiple, aligned equations. The ampersand & serves as a tab stop; usually, you want the lines to be aligned on the equation sign:

[math]

You can also align two sets of equation side by side, as follows:

[math]

If you want even more, use the alignat environment. It has a parameter denoting the amount of aligned columns. Here's an example with three:

[math]

Alternatively, you can centre equations rather than align them. To do this, use the gather environment.

[math]

Long equations can be split with the multline environment. In the example below, you see that the \left( bracket has to be followed by a \right. (an invisible right bracket) at the end of the first line, otherwise Latex will raise an error. Likewise, the second line starts with \left. (an invisible left bracket) and ends with \right).

However, to ensure that the closing \right) is as big as the opening \left( , we need another trick: the command \vphantom{} inserts an invisible vertical space, given by the text inside the brackets - analogous to the horizontal \phantom{}. On the first line, the summation \sum_{i<j} is the largest symbol, so \vphantom{\sum_{i<j}} inserts an equally large, but invisible symbol on the second line, which guarantees that \left( and \right) are of the same size.

[math]