# Figure from Mathematica is printed on separate page

I am trying to include a Mathematica code in LaTeX. To do that, I just exported the code as PDF. The thing is that when I am trying to include the PDF figure in my TeX code, the figure is printed on the next page.

The code I am using is

\documentclass[a4paper,11pt]{article}
\usepackage{kerkis}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage[pdftex]{graphicx}

\begin{document}
\begin{align}
\nonumber W_{r\rightarrow\infty}=&-\int_{r}^{\infty}\!F\,\mathrm{d}y=-\int_r^\infty \!     \dfrac{1}{4\pi \epsilon_0} \dfrac{q^2}{\alpha^2} \dfrac{\alpha^3}{y^3}\left(1-    \dfrac{\alpha^2}{y^2}\right)^{-2}\,\mathrm{d}y\\
=&-\dfrac{1}{4\pi \epsilon_0} \dfrac{q^2}{\alpha^2}\alpha^3 \underbrace{\int_r^\infty     \! y^{-3} \left(1-\dfrac{\alpha^2}{y^2}\right)^{-2} \,\mathrm{d}y}_{I} \label{eq:WcondI}
\end{align}

\begin{figure}[H]%
\includegraphics[width=\columnwidth]{math}%
\end{figure}
\end{document}


Any ideas on that?

-
The H option is defined by the float package. If you want the image there with no caption, just use the center environment and not figure. –  egreg Nov 28 '12 at 16:12
@egreg:I didn't know...I should have, though...Thank you very much for the educative information! –  Thanos Nov 28 '12 at 16:17

The [H] option is only defined by the float package. In your case, the unknown option is changed into [p].

However you don't need at all a figure environment, since you don't have a caption. The \includegraphics command can go everywhere, even in math.

With the following code you will be sure that the Mathematica code will never be detached from the equation (unless you allow it with \displaybreak):

\documentclass[a4paper,11pt]{article}

\usepackage[tbtags]{amsmath}
\usepackage{graphicx}

\newcommand{\diff}{\mathop{}\!\mathrm{d}}

\begin{document}
\begin{gather}
\begin{split}
W_{r\rightarrow\infty}
&=
-\int_{r}^{\infty} F \diff y=
-\int_r^\infty \dfrac{1}{4\pi \epsilon_0} \dfrac{q^2}{\alpha^2} \dfrac{\alpha^3}{y^3}
\left(1-\dfrac{\alpha^2}{y^2}\right)^{-2}\diff y\\
&=
-\dfrac{1}{4\pi \epsilon_0} \dfrac{q^2}{\alpha^2}\alpha^3
\underbrace{\int_r^\infty y^{-3} \left(1-\dfrac{\alpha^2}{y^2}\right)^{-2} \diff y}_{I}
\end{split}
\label{eq:WcondI}
\\[2ex]
\includegraphics[width=\columnwidth]{math}\notag
\end{gather}
\end{document}


Notice how I corrected your input of the equation, that shows some flaws.

-

[H] is not defined by default. I'd simply recommend writing [htp] instead, works just as well, but the float will move if there is no room for it, and the rest of the page will be used for text.

-
Thank you very much for your answer! I replaced H with h! and it's working. What do you mean that "[H] is not defined by default"? I thought that H and h! are the same... Perhaps I am mistaken! –  Thanos Nov 28 '12 at 16:08
It's not the same. AFAIR the here package defines H –  Uwe Ziegenhagen Nov 28 '12 at 16:22
@UweZiegenhagen From texdoc here one learns that "The original here.sty by David Carlisle was withdrawn many years ago. The [H] modifier is now implemented in float.sty, which this here.sty simply reads." –  egreg Nov 28 '12 at 16:28
@egreg, I guess it should go into L2Tabu then. I'll check it. –  Uwe Ziegenhagen Nov 28 '12 at 17:17