[OS X TeX] Using align with "or"

Josep Maria Font jmfont at ub.edu
Mon Apr 18 14:21:12 CEST 2011

El 18/04/2011, a las 04:04, Ross Moore escribió:

> \begin{align}
> u      &=0 & \quad\text{or}\quad  && u+4    &=0  & \quad\text{or}\quad  && u-4    &=0 \\
> u      &=0 &&&                       u      &=-4 &&&                       u      &=4 \\
> \log x &=0 &&&                       \log x &=-4 &&&                       \log x &=4
> \end{align}
> The {align} environment counts the number of alignments actually
> used. But their treatment is the same: alternating right/left.

Perhaps another way of explaining the philosophy behind "align" may help. At least it helps me :-)

It is to think of align as treating "blocks" of two columns, each block aligned centered around the symbol next to the main &, and putting additional & to separate these blocks. You can think each of the blocks as two columns, one left-aligned and one right-aligned, but it helps me to group the columns in pairs and think of each pair as a single column internally aligned around the points marked with the &. 

In the example above you are adding the text colums with the "or"s, which are only "half block" and hence aligned to their right edge (which doesn't actually matter, because they don't need to be aligned with any other row; but you have to put the relevant &s so that space between the blocks appears). So I would read the first row as:

u &=0 & \quad\text{or}\quad & & u+4 &=0 & \quad\text{or}\quad & & u-4 &=0 \\ 
----- | --------------------- | ------- | --------------------- | -------

The --- sections mark each "block", with its own "internal" alignment point &, while the | mark the separating &'s.

As a matter of fact, I would even dare to say this is the original reading and design of "align": It does not add intercolumn space around the aligning &'s (its main difference with standard LaTeX "array"!), while it adds some at the place of the "separating" &s. Repeat the above example after deleting the \quads and you will see what I mean. 

So, I would add to Ross explication and say, to summarize:

The {align} environment counts the number of alignments actually used. Their treatment is: alternating right / left and alternating no space / added space. The philosophy is not to align columns, but to align formulas, each correctly typeset without spurious spaces, at specified points (usually, relation symbols). This change in philosophy is, I think, what guided its design.

Hope this helps...


More information about the macostex-archives mailing list