Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

6 Answers

To avoid guessing about the space, you can use

\begin{align*}
  &\mathrel{\phantom{=}} abcd \\
  &= defg\\
  &= hijk
\end{align*}
share|improve this answer
    
That is the cleanest version. –  Lagerbaer May 7 '11 at 0:58
    
It can get much cleaner if you define \newcommand*{\pheq}{\hphantom{{}={}}} (or with \mathrel but with h). –  Qrrbrbirlbel Jul 20 '13 at 18:27
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment
\begin{align*}
  &\quad\, abcd \\
  &=       defg \\
  &=       hijk
\end{align*}
share|improve this answer
    
I find that \quad\ abcd\\ is better than \quad\,abcd\\ –  TCL Feb 7 '11 at 4:22
add comment

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}
share|improve this answer
add comment

A quick and dirty solution would be

\begin{align*}&abcd \\
=\ &defg\\
=\ &hijk
\end{align*}

Obviously, you can increase the whitespace as you might wish.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.