How do I produce the following in align environment?
\begin{eqnarray*}& & abcd \\
&=& defg\\
&=& hijk
\end{eqnarray*}
I try
\begin{align*}& abcd \\
&= defg\\
&= hijk
\end{align*}
But the result is not what I wanted.
How do I produce the following in align environment?
\begin{eqnarray*}& & abcd \\
&=& defg\\
&=& hijk
\end{eqnarray*}
I try
\begin{align*}& abcd \\
&= defg\\
&= hijk
\end{align*}
But the result is not what I wanted.
To avoid guessing about the space, you can use
\begin{align*}
&\mathrel{\phantom{=}} abcd \\
&= defg\\
&= hijk
\end{align*}
\newcommand*{\pheq}{\hphantom{{}={}}} (or with \mathrel but with h).
– Qrrbrbirlbel
Jul 20 '13 at 18:27
Here you've got the fifth solution, which shows you that what you want to do is indeed slightly tricky in align.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
& abcd \\
={} & defg \\
={} & hijk
\end{align*}
\end{document}
The trick: If you have the = in the left column, then you need to put something after it to get correct spacing.
This is sort of cheating, but in your example document, the following also works:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
a&bcd \\
= d&efg \\
= h&ijk
\end{align*}
\end{document}
Why? Because I know that a, d, and h all have the same width. This trick is surprisingly generalizable.
Another solution gives virtually identical results as eqnarray:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{aligned}
& & abcd \\
&=& defg \\
&=& hijk
\end{aligned}
\end{equation*}
\end{document}
This works because the aligned subenvironment (which must be enclosed in a larger equation or the like) shrinks to fit its contents exactly, and separates columns by a minimal amount. You can tweak this amount by redefining \minalignsep:
\renewcommand*{\minalignsep}{2em} % 10pt by default
as in this answer: Could I change the default column sep of `aligned` from \quad to \qquad globally?.
Personally, I would go with Hendrik Vogt's method, though.
\begin{align*}
&\quad\, abcd \\
&= defg \\
&= hijk
\end{align*}
in this special case you can use the order =&, which should be by default the other way round:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&\; abcd \\
=&\; defg\\
=&\; hijk
\end{align*}
\end{document}
A quick and dirty solution would be
\begin{align*}&abcd \\
=\ &defg\\
=\ &hijk
\end{align*}
Obviously, you can increase the whitespace as you might wish.