multicol and figures

\documentclass[a5paper]{article}
\usepackage{multicol,caption}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\newenvironment{Figure}
  {\par\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}
\begin{document}

\begin{multicols}{2}
\lipsum[1]
\begin{Figure}
 \centering
 \includegraphics[width=\linewidth]{foo}
 \captionof{figure}{my caption of the figure}
\end{Figure}

\lipsum[1]
\end{multicols}

\end{document}

enter image description here

Defining a placement option is not possible inside the multicols environment.


One solution is to use the nonfloat package.

\documentclass[]{article}

\usepackage{nonfloat}
\usepackage{multicol}

\usepackage[demo]{graphicx}
\usepackage{lipsum}

\newcommand\myfigure[1]{%
\medskip\noindent\begin{minipage}{\columnwidth}
\centering%
#1%
%figure,caption, and label go here
\end{minipage}\medskip}

\begin{document}
\begin{multicols}{3}
\lipsum[1]
%
\myfigure{\includegraphics[width=.9\columnwidth]{test}%
\figcaption{\emph{I am a figure caption!}}}
%
\lipsum[1]
\end{multicols}
\end{document}

example output


"One way around this is to not make your floats float. The float package provides the [H] float specifier which avoids this" (Taken form Werner's answer here: https://tex.stackexchange.com/a/75939/182467)

\usepackage{float}
[...]
\begin{figure}[H]
    [...]
\end{figure}