# How to align an expression in an amsmath environment

If I write

\begin{align}
A = <long string of variables> \\
=& <another long string of variables>
\end{align}


This works and aligns the equal signs and makes the total block of two-lines centered.

Now I want to remove the "A =" part, and simply assert that <long string of variables> is equal to <another long string of variables>. However, every version of this I write makes the left alignment of the second line to the left of the first, since <another long string of variables> is even longer.

How can I force the second line to shift over to the right so that the equal sign lies underneath the first line, somewhat? I've tried \hspace and a million alignment tricks but none of them have worked. I'd also be fine if I could just left-align the first line and right-align the second line!

• Your code doesn't align the = sign on whatever. – Bernard May 11 '16 at 17:07

Write this:

 \begin{align*}
& \phantom{{}={}}\text{long string of variables}\\
& = \text{another long string of variables}
\end{align*}


or this (as suggested by @daleif):

\begin{align*}
&\text{long string of variables}\\
={} & \text{another long string of variables}
\end{align*}


• Less to write if you use & in the first row and ={} &  on the second. – daleif May 11 '16 at 17:55
• @daleif: You're right, if there are no other lines with alignment. I've updated my answer. Thanks! – Bernard May 11 '16 at 18:03