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.

I have this problem all the time: I am trying to write a very large polynomial, but when I use eqnarray it does not look very nice. Is there a way to make it look nicer ? I am using a two column template so it I have limited space.

\begin{eqnarray}\label{rsmEqu}
&& B =-0.76562-2.38354S-0.17144R+0.81956\lambda      \nonumber \\
&&-0.18059SR+0.14635S\lambda+0.0253R\lambda+0.02885S^2 \nonumber \\

\end{eqnarray}
share|improve this question
    
Try using alingn instead eqnarray –  c.p. Sep 30 '12 at 1:04
1  
I fully agree with all exhortations that you should use an align environment instead of an eqnarray environment. The eqnarray environment suffers from several rather severe shortcomings. However, if you absolutely must use the latter environment anyway, at least start off the first line with B&=&-0.76562 instead of && B =-0.76562. –  Mico Sep 30 '12 at 2:47
add comment

2 Answers 2

Your interest in prettifying the expression is most likely around the alignment. Regardless, don't use eqnarray. Rather use the capabilities of amsmath's align environment(s):

enter image description here

\documentclass[twocolumn]{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\noeq}{\phantom{=}{}}
\begin{document}
\section{A section}
Here is some text. Your original \verb|eqnarray|:
\begin{eqnarray}
&& B =-0.76562-2.38354S-0.17144R+0.81956\lambda      \nonumber \\
&&-0.18059SR+0.14635S\lambda+0.0253R\lambda+0.02885S^2 \nonumber \\
&&+0.00815R^2+0.00332\lambda^2-0.00112SR\lambda+0.01041S^2R\nonumber \\
&&-0.00665S^2\lambda+0.000005SR^2+0.00016S\lambda^2 \nonumber \\
&&-0.000173R^2\lambda+0.00317S^3+0.000006R^3\nonumber \\
&&-0.00017\lambda^3
\end{eqnarray}
Here is an \verb|align| version:
\begin{align}
B &= -0.76562-2.38354S-0.17144R+0.81956\lambda \nonumber \\
  &\noeq -0.18059SR+0.14635S\lambda+0.0253R\lambda \nonumber \\
  &\noeq +0.02885S^2+0.00815R^2+0.00332\lambda^2 \nonumber \\
  &\noeq -0.00112SR\lambda+0.01041S^2R-0.00665S^2\lambda \nonumber \\
  &\noeq +0.000005SR^2+0.00016S\lambda^2-0.000173R^2\lambda \nonumber \\
  &\noeq +0.00317S^3+0.000006R^3-0.00017\lambda^3
\end{align}
\lipsum[1-3]
\end{document}

As a motivation, see \eqnarray vs \align, where you will find additional reference to not using eqnarray.

share|improve this answer
add comment

I would recommend using the alignat environment instead as the alignment of the binary operators makes the equation easier to read:

enter image description here

Here is the extended example from Werner's solution using alignat:

enter image description here

Notes:

  • Similar to the align environment, the alignat provides multiple rl alignments but without the spacing in between the pairs of rl equations. The && was necessary to make the following column left aligned (and skip past the right aligned column).
  • The {} before the plus and minus was to ensure that they were treated as binary operators.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\noindent
Example from MWE:
\begin{alignat*}{6}
B &= &&{}-0.76562   &&{}-2.38354S        &&{}-0.17144R       &&{}+ 0.81956\lambda \\
  &  &&{}-0.18059SR &&{}+0.14635S\lambda &&{}+0.0253R\lambda &&{}+ 0.02885S^2
\end{alignat*}
Extended example from Werner's solution:
\begin{alignat*}{6}
B &= &&{}-0.76562           &&{}-2.38354S         &&{}-0.17144R          &&{}+0.81956\lambda  \\
  &  &&{}-0.18059SR         &&{}+0.14635S\lambda  &&{}+0.0253R\lambda    &&{}+0.02885S^2 \\
  &  &&{}+0.00815R^2        &&{}+0.00332\lambda^2 &&{}-0.00112SR\lambda  &&{}+0.01041S^2R\\
  &  &&{}-0.00665S^2\lambda &&{}+0.000005SR^2     &&{}+0.00016S\lambda^2 &&{}-0.000173R^2\lambda  \\
  &  &&{}+0.00317S^3        &&{}+0.000006R^3      &&{}-0.00017\lambda^3
\end{alignat*}
\end{document}
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.