I work in a field of mathematics where long, multi-line computations are bread and butter, and I mostly use align* (and its siblings) from the amsmath package to display them. However, I have not found a simple, foolproof way of typesetting such expressions. What is the easiest way of correctly aligning lines horizontally in multi-line expressions?
Ideally, the solution should not be overly technical, lest my coauthors resort to easier, but incorrect, solutions.
Take the following caricature of a multi-line computation: x = -y [newline] -y. If I have understood Knuth and Swanson1 correctly, then the above should be typeset as
that is, something like
x [thickspace] = [thickspace] - [no space] y - [medium space] y (where the minuses are horizontally aligned). (There should be no space after the first minus, since it's a unary operator, and a medium space after the second, since it's a binary operator.)
I have searched StackExchange for solutions, but in vain. Below are the solutions I have found so far, with MWEs at the bottom.
The correct, but overly complicated way:
\documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} x &= -y \\ &\mathrel{\phantom{=}} -\:y \end{align*} \end{document}Do nothing. The minuses are incorrectly aligned.
x &= -y \\ &-y(I'm only changing the contents of
align*here.)Indent arbitrarily using e.g. \quad or \qquad. The minuses are incorrectly aligned.
x &= -y \\ &\quad -yUse \phantom. The minuses are incorrectly aligned.
x &= -y \\ &\phantom{=} -yUse \mathrel{\phantom}. The minuses are incorrectly aligned, and there is no medium space after the second minus.
x &= -y \\ &\mathrel{\phantom{=}} -yUse {}&. There seems to be a thin and a thick space after the equals sign, and a thin space after the first minus.
x ={}& -y \\ & -yUse aligned. Produces the same as in (6).
x &= \begin{aligned}[t] &-y \\ &-y \end{aligned}
1: Donald Knuth: The TeXbook, page 170 and Ellen Swanson: Mathematics into Type, Section 3.3.5.
Edit 29 January: I misread Knuth's table; there should be a medspace after the second minus. Also, turned the fragments into a full document.


