[Tex/LaTex] Wrapfigure doesn’t show the image and add blank column

wrapfigure

Writing my PhD I come across an unusual issue. I just want to add another wrapfigure (no issue before) but this one shows me only a blank space where the figure should be placed and on the next page – until a new section – it's like I have a two column article with only blank on the second column.

A MWE to reproduce the problem:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage{geometry}
\geometry{hmargin=2cm}

\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{wrapfig}
\usepackage{titlesec}
\usepackage{lipsum}

\title{\parbox{\textwidth}
{\begin{center}
{\huge MyTitle}\medskip\\
{\Large Second title}
\end{center}
}}
\author{Name\\
   function}
\date{\today}

\pagestyle{fancy}
\cfoot{-\thepage -}

\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}

\fancyhead[RO,LE]{Name}
\fancyhead[LO,RE]{}
\fancyfoot[RO,LE]{function 1}
\fancyfoot[LO,RE]{function 2}


\begin{document}
\maketitle
\tableofcontents
\thispagestyle{empty}
\newpage

\section{Section 1}
\subsection{SubSection 1.1}
\subsubsection{SubSubSection 1.1.1}


\begin{wrapfigure}{R}{6cm}
\centering
\includegraphics[width=6cm]{example-image}
\caption{My caption.}\label{MyLabel}
\end{wrapfigure}

\lipsum[1-4]


\begin{wrapfigure}{R}{6cm}
\centering
\includegraphics[width=6cm]{example-image}
\caption{My caption.}\label{MyLabel}
\end{wrapfigure}

\lipsum[1]


\begin{table}
\begin{tabular}{ll}
\hline 
header 1 & header 2 \\ 
\hline 
0 & random text random text random text random text random text random text \\ 
1 & random text random text random text random text random text \\ 
2 & random text random text random text random text random text \\ 
3 & random text random text random text random text random text \\ 
\hline 
\end{tabular}
%\caption{Caption_Table}\label{tb:1}
\end{table}


\subsubsection{SubSubSection 1.1.2}
\lipsum[1]

\paragraph{my paragraph}
\begin{itemize}
\item random text random text random text random text random text random text
\item random text random text random text random text 
\item random text random text random text random text random text random text
\item random text random text random text random text random text random text
\item random text random text random text random text 
\item random text random text random text random text random text random text
\item random text random text random text 
\end{itemize}
\end{document}

The image illustrate what I have:

enter image description here

Best Answer

The problem is that there is not enough "normal" text between the wrapfigure and the itemize environment which can be put besides the image. List of all kinds are known to be incompatible with wrapfigures, see e.g. Wrapfigure in an enumerate environment. and links therein.

To work around this problem, you could either move the wrapfigure further up in the text or add more text between it and the list, see for example the code below:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage{geometry}
\geometry{hmargin=2cm}

\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{wrapfig}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{xcolor}

\title{\parbox{\textwidth}
{\begin{center}
{\huge MyTitle}\medskip\\
{\Large Second title}
\end{center}
}}
\author{Name\\
   function}
\date{\today}

\pagestyle{fancy}
\cfoot{-\thepage -}

\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}

\fancyhead[RO,LE]{Name}
\fancyhead[LO,RE]{}
\fancyfoot[RO,LE]{function 1}
\fancyfoot[LO,RE]{function 2}


\begin{document}
\maketitle
\tableofcontents
\thispagestyle{empty}
\newpage

\section{Section 1}
\subsection{SubSection 1.1}
\subsubsection{SubSubSection 1.1.1}


\begin{wrapfigure}{R}{6cm}
\centering
\includegraphics[width=6cm]{example-image}
\caption{My caption.}\label{MyLabel}
\end{wrapfigure}
\lipsum[1-2]
\begin{wrapfigure}{R}{6cm}
\centering
\includegraphics[width=6cm]{example-image}
\caption{My caption.}\label{MyLabela}
\end{wrapfigure}
\lipsum[1-4]

\begin{table}
\begin{tabular}{ll}
\hline 
header 1 & header 2 \\ 
\hline 
0 & random text random text random text random text random text random text \\ 
1 & random text random text random text random text random text \\ 
2 & random text random text random text random text random text \\ 
3 & random text random text random text random text random text \\ 
\hline 
\end{tabular}
%\caption{Caption_Table}\label{tb:1}
\end{table}
%
%
\subsubsection{SubSubSection 1.1.2}
\lipsum[1]

\paragraph{my paragraph}
\begin{itemize}
\item random text random text random text random text random text random text
\item random text random text random text random text 
\item random text random text random text random text random text random text
\item random text random text random text random text random text random text
\item random text random text random text random text 
\item random text random text random text random text random text random text
\item random text random text random text 
\end{itemize}
\end{document}

enter image description here

Related Question