文字环绕图形时防止换行

文字环绕图形时防止换行

floatingfigure我正在尝试使用包的环境将文本环绕在图像周围floatflt。结果相当不错,但我遇到了几个问题。请考虑以下示例:

\documentclass[11pt,a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[left=2.25cm,right=.75cm,top=1cm,bottom=1cm]{geometry} % Adjust page margins
\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}

输出如下:

在此处输入图片描述

图形与图形后段落的第一行对齐,并且即使代码中没有插入换行符。

有没有办法防止插入此换行符(以便以“Occasional emersions”开头的行紧接着“update their position”开始)?如果没有,是否可以删除上部间距并强制将图形与上一行对齐(以“update their position”结尾的行)?

我也尝试了wrapfigure包中的环境wrapfig和建议的解决方案这里,但没有取得好成绩。

编辑

我尝试使用以下解决方法手动调整图形位置(我仅报告感兴趣的行)

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.

这给了我想要的结果:

在此处输入图片描述

不过,我希望有一个更好的解决方案。

答案1

实际上,各种wrapfig类似的软件包都不允许在不添加段落分隔符的情况下放置图形。

因此,\cutwin您引用的路线似乎是唯一的解决方案。

这是一个可以满足您的要求的 MWE。我将整个内容封装\picwin在序言中定义的名为 的宏中。

\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}

当然,环境可以更加用户友好:

\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}} 

下面是两个具有不同宽度和不同可选参数值(保持不变的行数)的示例。 在此处输入图片描述

相关内容