[Tex/LaTex] Why the figure shows up behind the text

floatstext;

I'm trying to fit one image to the page width while using a 2-column framework:

\begin{figure}[ht]
\centering
    \includegraphics[width=\textwidth]{mp-f-k}
    \caption{Happy Smiley}
\end{figure}

However, it shows up behind the text. How can I fix that? Thanks.
enter image description here

Best Answer

Your picture is too wide. See difference below:

enter image description here

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}
\lipsum[2]
\begin{figure}[htb]
    \includegraphics[height=30mm,width=\textwidth]{example-image-a}
\caption{This figure is to wide}
\end{figure}
\lipsum[1]    
\begin{figure}[htb]
    \includegraphics[height=30mm,width=\columnwidth]{example-image-b}
\caption{This figure has correct width}
\end{figure}
\lipsum[3-4]
\end{document}

If you need picture with width of two column, than you need to use \begin{figure*} ... \end{figure*}.

Edit: In use of

\begin{figure*}[htb]
    \includegraphics[height=30mm,width=\textwidth]{example-image-a}
\caption{This figure is to wide}
\end{figure*}

you had to be aware, that those image can appear only on top or bottom of the next page. Consequently as position options have sense only t and b or if the image take whole page, option p.

Related Question