How do I get this strange alignment?
This might be the trick you need:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\makeatletter
\newcommand{\unalign}[1]{%
\ifmeasuring@ \else
\makebox[\ifcase 1\maxcolumn@widths \fi][l]{$\displaystyle#1$}
\fi
}
\makeatother
\begin{align}
\text{First left hand side} & = \text{First right hand side} \\
\text{Second left hand side} & = \text{Second right hand side} \\
\unalign{= \text{Long expanded right hand side}}
\end{align}
\end{document}
The argument of \unalign
is ignored for the measurements and then typeset in a box apparently as wide as the left hand sides of the other equations. Of course this is not completely safe, if the argument is very long, but for a one shot case it might be sufficient.
If you want the unaligned line to be flush with the widest right hand side, change the definition into
\documentclass{amsart}
\begin{document}
\makeatletter
\newcommand{\unalign}[1]{%
\ifmeasuring@ \else
&\makebox[\ifcase2\maxcolumn@widths \fi][r]{$\displaystyle#1$}
\fi
}
\makeatother
\begin{align}
\text{First left hand side} & = \text{First right hand side} \\
\text{Second left hand side} & = \text{Second right hand side} \\
\unalign{= \text{Long expanded right hand side}}
\end{align}
\end{document}
A bit of a low-level trick:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\text{First left hand side} & = \text{First right hand side} \\
\text{Second left hand side} & = \text{Second right hand side} \\
\omit \span = \text{Loooooooooooooooooooooooooooooooong expanded right hand side}
\end{align}
\end{document}
The above left aligns the last line. If you want the last line to be flush right, use (note order of the expression and \omit\span
has changed)
\begin{align}
\text{First left hand side} & = \text{First right hand side} \\
\text{Second left hand side} & = \text{Second right hand side} \\
= \text{ expanded right hand side} \span \omit
\end{align}
which gives
Probably not good style to answer my question after having accepted another answer, but I have two more solutions.
The first solution (from Ulrich Diez) makes the labels within align
within gather
work:
\makeatletter
\newcommand*\savedf{\@bsphack\global\let\sdf\df@label\@esphack}
\newcommand*\restoredf{\@bsphack\global\let\df@label\sdf\@esphack}
\newcommand*\mylabel{\restoredf\label}
\makeatother
...
\begin{gather}
\savedf
\begin{align}
\text{First left hand side} & = \text{First right hand side}
\mylabel{eq:e1} \\
\text{Second left hand side} & = \text{Second right hand side}
\mylabel{eq:e2}
\end{align} \restoredf \\
= \text{Loooooooooooooooooooooooooooooooong expanded right hand side}
\notag \\
= \text{Another line} \label{eq:e3}
\end{gather}
\eqref{eq:e1},\eqref{eq:e2},\eqref{eq:e3}
It is hackish, but it works, and it gives a different layout than the other solutions.
The second solution uses the mathtools
package, and its \MoveEqLeft
command:
\usepackage{mathtools}
...
\begin{align}
\text{First left hand side} & = \text{First right hand side} \\
\text{Second left hand side} & = \text{Second right hand side} \\
\MoveEqLeft[9] = \text{Loooooooooooooooooooooooooooooooong expanded right hand side}
\end{align}
This seems most elegant, but requires hand tuning the shift space, here 9em
. The \MoveEqLeft
command sets an alignment point, and then shifts the remaining material by the specified amount of em
's to the left. Works even with negative numbers, i.e., shifting to the right.