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.

enter image description here

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

1 Answer

up vote 4 down vote accepted

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:

enter image description here

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.