![hangindent + wrapfig = 间距不好?](https://linux22.com/image/256607/hangindent%20%2B%20wrapfig%20%3D%20%E9%97%B4%E8%B7%9D%E4%B8%8D%E5%A5%BD%EF%BC%9F.png)
我正在使用该wrapfig
包来在段落的右侧放置一些文本:
\documentclass{article}
\usepackage{wrapfig}
\begin{document}
\begin{wrapfigure}{r}{0pt}
\fbox{Test}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}
但是当我设置\hangindent
为某个正长度时,文本/图形会移动到段落末尾:
\documentclass{article}
\usepackage{wrapfig}
\begin{document}
\begin{wrapfigure}{r}{0pt}
\fbox{Test}
\end{wrapfigure}
\setlength{\hangindent}{1cm}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}
为什么会发生这种情况?我该如何解决?提前致谢。
答案1
wrapfig
用于\parshape
设置段落环绕图形。这与设置不兼容\hangindent
,实际上您会收到警告
Package wrapfig Warning: Stationary wrapfigure forced to float on input line 9
因为wrapfig
检查段落是否设置了非零值\hangindent
(或非零\parshape
)。有不wrapfig
用或用进行修复cutwin
,我相信,唯一的方法就是编写自己的\parshape
规范。