[Tex/LaTex] Image not showing up when using figure environment

floatsgraphics

I want to add an image to my paper but I have a problem.

When I add the image with just \includegraphics[]{} tag, everything works fine, and the picture shows up when I compile my document.

When I use \begin{figure} \includegraphics[]{} \end{figure} – syntax the image does not appear in the compiled document.

The relevant part of my header include is :

 \usepackage{graphicx}
 \graphicspath{ {pics/} }

And later on I add the image with this block:

%This does not work

\begin{figure}
  \centering
    \includegraphics[width=.4\textwidth]{generalPolya}
  \label{generalPolya}
\end{figure}



%This works

\includegraphics[width=.4\textwidth]{generalPolya}

I guess it's some sort of issue in the graphics package, but I've copied the setup from a previous paper I had, so it should work.
Any ideas on what's wrong? Thanks in advance.

Edit:

Thanks for all the responses. I created a minimal working example. Apparently multicols messes with the figure tag:

\documentclass[]{article}
\usepackage{multicol} % Used for the two-column layout of the document
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {pics/} }
\title{\vspace{-15mm}\fontsize{24pt}{10pt}\selectfont\textbf{Lorem ipsum}} % Article title
\begin{document}
\maketitle % Insert title
\begin{multicols}{2} %
%This does not show up
\begin{figure}[h]
    \includegraphics[width=.4\textwidth]{generalPolya}
\end{figure}
%This shows up.
\begin{center}
        \includegraphics[width=.5\textwidth]{chair}
\end{center}
\end{multicols}
\end{document}

What shows up after compiling the document is this

enter image description here

What is wrong with this syntax?

Best Answer

Try using a minipage as this:

\documentclass[12pt,a4paper]{article}
\usepackage{caption}
\usepackage{graphicx}
\begin{document}

\makebox[0pt][l]{%
\begin{minipage}{\textwidth}
\centering
    \includegraphics[width=.4\textwidth]{example-image.pdf}
 \captionof{figure}{figure caption}
 \label{fig:fig1}
\end{minipage}
}

\medskip

I used Figure \ref{fig:fig1} above and referred to it.

\end{document}

enter image description here