After reading some related question on how to insert an image into a TeX file I tried to do the following:
\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\begin{document}
\section*{a section}
\subsection*{a subsection}
some text\
\begin{figure}
\centering
\includegraphics[width=0.7\linewidth]{vagabon}
\caption[]{an image}
\label{fig:vagabon}
\end{figure}\
some other text
\end{document}
but the output was:

with the image before the sections, and not in between the 2 lines of text. why is that? and what's the proper way to insert an image in the middle of a paragraph?
\begin{figure}[!h]– azetina Jun 10 '14 at 16:35\caption? – Torbjørn T. Jun 10 '14 at 17:04\usepackage{capt-of}and then use\noindent\begin{minipage}{\linewidth}\includegraphics{..}\captionof{figure}{Some fig.\label{stuff}}\end{minipage}. Another option is to add\usepackage{float}and use theHfloat specifier, i.e.\begin{figure}[H], which disables floating. See also http://tex.stackexchange.com/questions/2275/keeping-tables-figures-close-to-where-they-are-mentioned – Torbjørn T. Jun 10 '14 at 17:13\includegraphics[...]{...}and LaTeX will put the graphic wherever you've said to put it. (This does mean it matters where you say to put it, of course!) – cfr Jun 10 '14 at 23:59[H]is an undefined option so just prevents the figure being placed anywhere so it goes to the end of the document. If you have a 2014 release and use packagefixltx2ethen you get an error message for undefined options. To define[H]meaning "here: do not float" you need the float package. – David Carlisle Aug 20 '14 at 10:29