# How to simply center equations using eqnarray*?

So I have this code here:

\begin{eqnarray*}
x + (y - 2)^4 = w^2 \\
(x  - 9)^2 + y_2^2 = w^2 \\
x + (y - 2)^4 = w^2 = (x  - 9)^2 + y_2^2 \\
\end{eqnarray*}


As you can see, I get the following result: My problem is that I want to 'center' all those equations, so that they 'look nice'. What that means is that I dont necessarily want the equal signs to be alligned. I want the entire thing to be centered, evenly, so that it looks pleasing to the eye. Basically, if the top two equations were moved to the left somehow, then that would be 'centered'.

How can I go about doing this?

• @MatthewLeingang Thanks for the link, I do not have time to run through it right at this moment, but is there a main reason for it to be avoided though? – Spacey May 15 '13 at 16:42
• From the TOC: (1) Spacing inconsistency (2) Eqnarray might overwrite equation numbers (3) labels can get mixed up. – Matthew Leingang May 15 '13 at 16:43
• comment on tags: eqnarray has nothing to do with amsmath (or vice versa), so amsmath isn't a suitable tag for the question as asked. i'm leaving it, though, since the most logical answer -- gather -- does use an environment from amsmath. check the amsmath user's guide (texdoc amsldoc) for the environments that are supported. – barbara beeton May 15 '13 at 20:45

For any kind of display math you should load the amsmath package. \documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{gather*}
x + (y - 2)^4 = w^2 \\
(x  - 9)^2 + y_2^2 = w^2 \\
x + (y - 2)^4 = w^2 = (x  - 9)^2 + y_2^2
\end{gather*}

\end{document}

• For some reason gather* was not autocompleting and when I typed it out it didnt work, (before I asked the question on here), but it appears to work now... murphy's law I guess. – Spacey May 15 '13 at 16:40
• I take it from the number of upvotes that gather > eqnarray ?... (Noob here). – Spacey May 15 '13 at 16:48
• The standard eqnarray and eqnarray* really make rather poor spacing so in almost all cases you should use the AMS alignments. But especially here for a sequence of unaligned equations LaTeX has no direct support for that, but that is precisely what gather is designed to do. – David Carlisle May 15 '13 at 16:59
• Great. I was just warming up to eqnarray* too. >< Thanks though! I am learning. – Spacey May 15 '13 at 17:08
• So what to do when a journal requires you not to load extra packages? – naught101 Sep 11 '13 at 3:56

Try this:

\begin{eqnarray*}
&x + (y - 2)^4 = w^2 \\
&(x  - 9)^2 + y_2^2 = w^2 \\
&x + (y - 2)^4 = w^2 = (x  - 9)^2 + y_2^2 \\
\end{eqnarray*}

• Nice! Worked great. Is there a way to arbitrarily push one equation to be 'lower' than the one above him by any chance? – Spacey May 15 '13 at 16:38
• @Mohammad: The double-backslash  \\  takes an optional argument which is the amount of extra space to skip. – Matthew Leingang May 15 '13 at 16:40
• Ah right. >< I am still a noob. Thanks though! – Spacey May 15 '13 at 16:41
• @Mohammad This sort of looks OK but is abusing the eqnarray environment syntax which is designed to always have three columns with the centre column being the operator. – David Carlisle May 15 '13 at 16:43
• Sorry, but this is wrong. Try using a summation symbol and you'll see why. – egreg May 15 '13 at 16:46