# Prevent line break when wrapping text around a figure

I'm trying to wrap text around an image using the floatingfigure environment of the floatflt package. The result is quite nice, but I have a couple of issues. Consider the following example:

\documentclass[11pt,a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{floatflt}

\begin{document}
CNAs are fitted with accurate navigation systems and they are used as moving reference transponders to which the SCM/RI vehicles, equipped with less capable navigation systems, can acoustically range to update their position.
\begin{floatingfigure}[r]{0.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth]{DummyImage}
\caption{The MLBL conceptual scheme.}
\label{fig:mlbl}
\end{floatingfigure}
Occasional emersions are used by the CNAs to periodically reset the positioning error accumulated underwater.
In the MLBL configuration (\figurename~\ref{fig:mlbl}) the CNAs navigate on the sides of the team of vehicles, forming the two-beacon moving long baseline array that is used by the SCM/RI vehicles.
CNAs broadcast their estimated position and the corresponding estimation error following a Time Division Multiple Access (TDMA) scheme.
All the clocks are synchronised, so that any vehicle in the CNAs' communication range can determine its distance from the sender from the One-Way Travel Time (OWTT).
The SCM/RI vehicles can hence update their position integrating these information into their navigation algorithm.
\end{document}


which has this output:

The figure is aligned with the first line of the paragraph after the figure and a line break is inserted even if in the code is not present.

Is there a way to prevent this line break to be inserted (so that the line beginning with "Occasional emersions" starts right after "update their position")? If not, is it possible to remove the upper spacing and force the alignment of the figure to the previous line (the one ending with "update their position")?

I tried also the wrapfigure environment from the package wrapfig and the solution with suggested here, but I didn't obtain nice results.

EDIT

I tried to adjust manually the figure position with the following workaround (I report the interested lines only)

CNAs are fitted with accurate navigation systems and they are used as moving reference transponders to which the SCM/RI vehicles, equipped with less capable navigation systems, can acoustically range to update
\vspace{-\baselineskip}
\begin{floatingfigure}[r]{0.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth]{DummyImage}
\caption{The MLBL conceptual scheme.}
\label{fig:mlbl}
\end{floatingfigure}
\noindent their position.


which gives me the result I want:

However, I would like to have a nicer solution.

Actually, none of the various wrapfig-like packages accept to put the figure without adding a paragraph break.

Hence the \cutwin route you quoted seems to be the only solution.

Here is a MWE which does what you want. I have encapsulated the whole thing in a macro named \picwin, defined in the preamble.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{calc}
\usepackage{cutwin}

\newcommand\picwin[4][0]{ % #1=nblinesstart #2=width #3=content #4=text
\newsavebox\wpstuff \savebox{\wpstuff}{\parbox{#2}{\centering #3}}
\opencutright
\def\windowpagestuff{\flushright\usebox{\wpstuff}}
\newlength\hhh \settototalheight{\hhh}{\usebox{\wpstuff}}
\newlength\www \setlength{\www}{\dimexpr\textwidth-#2-1em\relax}
\begin{cutout}{#1}{\www}{0pt}{\the\numexpr\hhh/\baselineskip+1\relax}
#4
\end{cutout}
}

\begin{document}

\picwin[3]{0.65\textwidth}{
\includegraphics[width=\linewidth,height=21mm]{img}
\captionof{figure}{The MLBL conceptual scheme}
\label{fig:mlbl}
}{
Occasional emersions are used by the CNAs to periodically
reset the positioning error accumulated underwater.
In the MLBL configuration (\figurename~\ref{fig:mlbl}) the CNAs
navigate on the sides of the team of vehicles, forming the two-beacon
moving long baseline array that is used by the SCM/RI vehicles. CNAs
broadcast their estimated position and the corresponding estimation
error following a Time Division Multiple Access (TDMA) scheme.
All the clocks are synchronised, so that any vehicle in the CNAs'
communication range can determine its distance from the sender
from the One-Way Travel Time (OWTT).
The SCM/RI vehicles can hence update their position integrating
these information into their navigation algorithm.
}

\end{document}


of course, an environement could be more user friendly :

\newenvironment{picwin}[3][0]{
\newsavebox\wpstuff \savebox{\wpstuff}{\parbox{#2}{\centering #3}}
\opencutright
\def\windowpagestuff{\flushright\usebox{\wpstuff}}
\newlength\hhh \settototalheight{\hhh}{\usebox{\wpstuff}}
\newlength\www \setlength{\www}{\dimexpr\textwidth-#2-1em\relax}
\begin{cutout}{#1}{\www}{0pt}{\the\numexpr\hhh/\baselineskip+1\relax}}
{\end{cutout}}


and bellow are two examples with different widths and different values of the optional parameter (which the number of lines to left unchanged.)