# latex placing image - how can I put image wherever I want [duplicate]

I am trying to insert an image in the middle of the page, but it is going to the top of the page. why the hell is it happening?

I tried this:

\begin{figure}
\begin{minipage}{\textwidth}
\includegraphics[width=75.5mm]{myimage}
\end{minipage}
\end{figure}


I am looking for solution for 2 hours, not a single sign of success!

-

## migrated from stackoverflow.comApr 7 '14 at 16:26

This question came from our site for professional and enthusiast programmers.

## marked as duplicate by Adam Liter, Heiko Oberdiek, Svend Tveskæg, Ludovic C., dustinApr 7 '14 at 17:42

The only purpose of the figure environment is to allow LaTeX to move the figure, and a minipage inside figure has no purpose at all unless you have footnotes, so you just need

%\begin{figure}
% \begin{minipage}{\textwidth}
\includegraphics[width=75.5mm]{myimage}
%  \end{minipage}
%\end{figure}


and the image will appear wherever you have \includegraphics in the source.

Note the rules for placing images are the same as the rules for placing X Normally if you enter X it comes where you put it, either part of the current line, or perhaps indented at start of a paragraph. If you do

\begin{figure}
X
\end{figure}


Then the X will float and be positioned by the page breaking routines. \includegraphics works in exactly the same way, or said more correctly, the float placement routines have no information about the content of the figure environment.

-

Figure is an floating object and minipage is not, so by encapsulating a minipage in a figure object you make the minipage floating.

Another option is using the "H" position specifier; http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions

That being said, I prefer to let LaTeX control the position of the image and use a reference to that figure in your text. Letting LaTeX control the position of all elements of your page is in my option a more robust and neat solution.

-
thanks man, helped a lot – doniyor Apr 7 '14 at 16:24
If you put a figure inside a minipage you will get a syntax error and the float will be discarded. – David Carlisle Apr 7 '14 at 16:29
you are absolutely right, I updated my answer – Robert Apr 7 '14 at 20:28