3

I would like to insert an image into a two-column document, but have the text flow around the image, avoiding to perturb the text flow, like shown here:

enter image description here

I tried to do it with the option "strip" from the package "cuted", but it is not working so far.

Here is a demo code to play with:

\documentclass[10pt, a4paper, twocolumn]{article}

\usepackage{caption} %to insert a caption
\usepackage{lipsum}  %for dummy text
\usepackage{todonotes} %for dummy figure

\usepackage{cuted} %main package: to insert the image 

\begin{document}
\twocolumn

\section{Introduction}
%some text
\lipsum[2-4]
%place the figure
\begin{strip}
    \begin{figure}[h]
    \centering
    \includegraphics[width=10cm]{example-image-golden}
    \captionof{figure}{label}
    \label{fig:python_convergence_reflection}
    \end{figure}
\end{strip}
%some more text
\lipsum[2-4]

\end{document}

However, I get the error:

Float(s) lost

Any help would be very appreciated.

3
  • Why do you put a float environment (\begin{figure} ... \end{figure}) inside the strip?
    – DG'
    Commented Jan 17, 2019 at 8:45
  • @DG' I just tried that. Is this wrong ? How would you do it ? Thanks.
    – james
    Commented Jan 17, 2019 at 8:48
  • 1
    Remove the figure environment. strip is not a floating environment, and that's why \captionof{figure} is used, instead of \caption.
    – Bernard
    Commented Jan 17, 2019 at 8:48

1 Answer 1

3

The floats are lost, because they are nested inside the strip, the strip environment is a replacement of figure, not an addition to it. And since you don't want them to float you just have to remove the lines containing \begin{figure} and \end{figure}:

\documentclass[10pt, a4paper, twocolumn]{article}

\usepackage{caption} %to insert a caption
\usepackage{lipsum}  %for dummy text
\usepackage{todonotes} %for dummy figure

\usepackage{cuted} %main package: to insert the image

\begin{document}
\twocolumn

\section{Introduction}
%some text
\lipsum[2-4]
%place the figure
\begin{strip}
    \centering
    \includegraphics[width=10cm]{example-image-golden}
    \captionof{figure}{label}
    \label{fig:python_convergence_reflection}
\end{strip}
%some more text
\lipsum[2-4]

\end{document}

enter image description here

For the desired text flow use midfloat instead of cuted:

\documentclass[10pt, a4paper, twocolumn]{article}

\usepackage{caption} %to insert a caption
\usepackage{lipsum}  %for dummy text
\usepackage{todonotes} %for dummy figure

\usepackage{midfloat} %main package: to insert the image

\begin{document}
\twocolumn

\section{Introduction}
%some text
\lipsum[1]
%place the figure
\begin{strip}
    \centering
    \includegraphics[width=10cm]{example-image-golden}
    \captionof{figure}{label}
    \label{fig:python_convergence_reflection}
\end{strip}
%some more text
\lipsum[2-4]

\end{document}

enter image description here

3
  • Thanks a lot for this answer. Would you also know how to have the text continue, as if the image was not there (see Image in Question)?... i.e the text above the image should not continue in the second column but in the first column.
    – james
    Commented Jan 17, 2019 at 8:54
  • Use midfloat instead of cuted
    – DG'
    Commented Jan 17, 2019 at 8:59
  • Yes !! This works. Thank you so much for your great help! :))
    – james
    Commented Jan 17, 2019 at 9:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .