# IEEEqnarray specific aligning

Is it possible to align the second row as to where it is, and align the third row with = sign? I'm new to LaTeX, so I only know basic stuff. This is my code:

\begin{IEEEeqnarray}{rCl}
P^2=\frac{1}{16}\cdot&\bigg(&-a^4-b^4-c^4-d^4\nonumber
\\&&+\:2a^2b^2+2a^2c^2+2a^2d^2+2b^2c^2+2b^2d^2+2c^2d^2\bigg)\nonumber
\\&&-\frac 12 abcd\cos(\alpha+\gamma)
\end{IEEEeqnarray}

-
Welcome to TeX.sx! Please provide your problem as a complete Minimal Working Example (MWE instead of just a code snippet. – Peter Jansson Jan 31 '13 at 14:31

Here are two ways to accomplish the task:

\documentclass{article}
\usepackage{IEEEtrantools}
\begin{document}

First way, automatic'':
\begin{IEEEeqnarray}{rCll}
P^2 &=& \frac{1}{16}\cdot\biggl(&-a^4-b^4-c^4-d^4\nonumber\\
&&& {}+2a^2b^2+2a^2c^2+2a^2d^2+2b^2c^2+2b^2d^2+2c^2d^2\biggr)\nonumber\\
&&  \rlap{$\displaystyle-\frac 12 abcd\cos(\alpha+\gamma)$}
\end{IEEEeqnarray}

Second way, with hints'':
\begin{IEEEeqnarray}{rCl}
P^2 &=& \frac{1}{16}\cdot\biggl(-a^4-b^4-c^4-d^4\nonumber\\
&&\hphantom{\frac{1}{16}\cdot\biggl(}
+2a^2b^2+2a^2c^2+2a^2d^2+2b^2c^2+2b^2d^2+2c^2d^2\biggr)\nonumber\\
&& -\frac 12 abcd\cos(\alpha+\gamma)
\end{IEEEeqnarray}

\end{document}


With \rlap in the first way, the entry doesn't take any space. In the second way, we use a phantom to push the second line to the right.

The result is the same in both cases:

-