widetext equation in revtex4 messed up

I have stumbled upon a problem. I have a seminar I'm working on, and I'm writing it in revtex4 two column mode.

I already used one widetext environment and the equation came out nicely. So I repeated the process, and it overlaps other, non widetext equation :\

The code is:

Vidimo kako povećavamo p, odnosno kako prelazimo u limes beskonačne jame, varijaciona metoda nam daje lošije procjene za eneriju osnovnog stanja. Energetska stanja rastu, no drastičnije od numeričkih rezultata. To je vjerojatno posljedica postojanja gama funkcije u izrazu koja kako uzimamo veće vrijednosti drastično raste. Usporedbom slika dobivenih diskretizacijom vidimo da ovakva valna funkcija najbolje odgovara 'mekšim' potencijalima, dok za beskonačnu potencijalnu jamu imamo kosinusno rješenje koje najbolje opisuje osnovno stanje. Također moramo uzeti u obzir da kod beskonačne jame nema tuneliranja u klasično zabranjeno područje. Najbolje poklapanje imamo za potencijal harmoničkog oscilatora, no to nas ne bi trebalo iznenaditi jer je izraz za osnovno stanje harmoničkog oscilatora (uz $\hbar=\omega=m=1$): $\psi_0(x)=\pi^{-1/4}\exp[-x^2/2]$.\\

Druga probna valna funkcija je oblika:

$$\varphi_2(x)=b\sqrt{\frac{2b}{\pi}}\frac{1}{x^2+b^2}$$

\begin{figure}[htp]
\centering
\includegraphics[clip,scale=0.3]{valfun2.eps}
\caption{Probna valna funkcija $\varphi_2(x)$.}
\label{fig:probvalf2}
\end{figure}

Valna funkcija (slika \ref{fig:probvalf2}) je također normirana te ovisi o proizvoljnom, pozitivnom parametru b.

$$\begin{split} E(b)&=\int\limits_{-\infty}^{\infty}\varphi_2^*(x)\left(-\frac{1}{2}\frac{d^2}{dx^2}+x^{2p}\right)\varphi_2(x)\ dx=\\ &=\frac{2b^3}{\pi}\int\limits_{-\infty}^{\infty}\left\{\frac{1}{x^2+b^2}\left[-\frac{1}{2}\left(-\frac{2 \left(b^2-3x^2\right)}{\left(b^2+x^2\right)^3}\right)\right.\right.+\\ &+\left.\left.\frac{x^{2p}}{x^2+b^2}\right]\right\}=\\ &=\frac{1}{4b^2}+(-1)^p\frac{b^{2p}}{2}(1-2p) \end{split} \label{eq:Eb2}$$

Iz uvjeta minimuma \ref{eq:uvjmin} imamo:

$$b_0=2^{\frac{1}{-2-2p}}\left((-1)^p p(1-2p)\right)^{\frac{1}{-2-2p}}$$

Što, ako vratimo u izraz za očekivanu vrijednost energije \ref{eq:Eb2}, daje:

\begin{widetext}
$$\begin{split} E(b_0)=\frac{1}{4} \left(2 (-1)^p (1-2 p) \left(2^{\frac{1}{-2 p-2}} \left((-1)^p (1-2 p) p\right)^{\frac{1}{-2 p-2}}\right)^{2 p}+2^{\frac{1}{p+1}} \left((-1)^p (1-2 p) p\right)^{\frac{1}{p+1}}\right) \end{split}$$
\end{widetext}


And I get this:

I don't know why it leaves such big empty space between some equations :\

Oh the preambule is:

\documentclass[twocolumn,pre,floats,aps,amsmath,amssymb]{revtex4}

\usepackage{graphicx}
\usepackage{bm}
\usepackage[croatian]{babel}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{extarrows}
\usepackage{subfigure}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{bbm}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{float}
\usepackage{url}
\usepackage[all]{hypcap}
\usepackage{subfigure}
\usepackage{color}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{array}

\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\newcolumntype{y}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\renewcommand*{\arraystretch}{1.2}


The part that looks fine, looks like this:

Ignore the text, it's irrelevant... Why does this happen? :\

-
I can't reproduce this. Please reduce your document to a minimal working example (MWE) that illustrates your problem (you can edit your question). –  Lev Bishop Apr 26 '11 at 20:39
The problem is if I put it in a separate file, it will look good :\ –  dingo_d Apr 26 '11 at 20:56
Well, no one can help you if they can't reproduce the problem. The answers to the question that I linked to give a lot of help with how to shrink the file, remove unnecessary packages, provide fake versions of the figures if necessary, etc. –  Lev Bishop Apr 26 '11 at 21:02
The problem is, when I put even more text in a clean document, it comes out normal :\ So the example I give you will give no error... –  dingo_d Apr 27 '11 at 16:26
Ok I dk why, but I needed more text so that the widetext enviroment wouldn't be so close to the remaining text :roll: So I put a picture beneath the overlapping equation, and now it looks... decent :\ Still much white space between equations, but at least it's not overlapping anything... Sorry for not being able to provide the MWE, everything I tried it ended up normal (LaTeX is messing with my head xD)... –  dingo_d Apr 27 '11 at 17:22

I can't test this, since I can't reproduce your issue, but as a stab in the dark you could try \usepackage{revtex4-1} to use the more recent version of revtex. It is slightly incompatible with the earlier version so you may have to make a few minor changes elsewhere to get it to work, but overall it solves a bunch of problems with things like widetext.

-
This isn't helping :\ Any other advantages to revtex4-1? –  dingo_d Apr 27 '11 at 17:23

I had a similar spacing problem when there was a footnote reference before the \widetext command. When balancing the columns before the equation, LaTeX left enough space at the end of the second column for the footnote. (The footnote was correctly placed at the bottom of the page in the first column.) My workaround was to put something like \vskip-1.9in just before \begin{widetext}. I'd like to see this automated, though.

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code as I did in my edit. –  Torbjørn T. Jan 4 '12 at 19:53

I had a similar issue with a widetext environment overlapping an equation environment, I solve it using \begin{align}...\end{align} instead of $$...$$ for the overlapped equation, in your case try

\begin{align}
E(b)&=\int\limits_{-\infty}^{\infty}\varphi_2^*(x)\left(-\frac{1}{2}\frac{d^2}{dx^2}+x^{2p}\right)\varphi_2(x)\ dx=\\
&=\frac{2b^3}{\pi}\int\limits_{-\infty}^{\infty}\left\{\frac{1}{x^2+b^2}\left[-\frac{1}{2}\left(-\frac{2 \left(b^2-3x^2\right)}{\left(b^2+x^2\right)^3}\right)\right.\right.+\\
&+\left.\left.\frac{x^{2p}}{x^2+b^2}\right]\right\}=\\
&=\frac{1}{4b^2}+(-1)^p\frac{b^{2p}}{2}(1-2p)
\label{eq:Eb2}
\end{align}
`
-