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.

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:

enter image description here

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?

share|improve this question
5  
Avoid eqnarray! –  Matthew Leingang May 15 '13 at 16:41
    
@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? –  TyranaSaur 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

2 Answers 2

For any kind of display math you should load the amsmath package.

enter image description here

\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}
share|improve this answer
    
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. –  TyranaSaur May 15 '13 at 16:40
    
I take it from the number of upvotes that gather > eqnarray ?... (Noob here). –  TyranaSaur May 15 '13 at 16:48
1  
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. –  TyranaSaur 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*}
share|improve this answer
    
Nice! Worked great. Is there a way to arbitrarily push one equation to be 'lower' than the one above him by any chance? –  TyranaSaur 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! –  TyranaSaur 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
3  
Sorry, but this is wrong. Try using a summation symbol and you'll see why. –  egreg May 15 '13 at 16:46

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.