wrapfigure - 如果主文本以组开头则会出现问题

wrapfigure - 如果主文本以组开头则会出现问题

我正在该包的上下文中查找文档中的错误wrapfig。不管怎么说,只要主文本(即非换行文本)以非空组开头,它似乎就会失败:第一段运行超过该图,而全部后续段落展示了适合该图所需的间隙。

问:难道我做错了什么?

\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{wrapfig}
\newif\iffailmiserably

\failmiserablytrue % set this to false for comparison!

\begin{document}
\begin{wrapfigure}{r}{0.33\textwidth}
Just a little bit of text in the wrapfigure envoronment.
A full lipsum paragraph would be too much.
We don't want this to fill the page, after all.
\end{wrapfigure}  

\iffailmiserably{This} fails miserably. \else This {works fine.} \fi
\lipsum
\end{document}

在此处输入图片描述

答案1

只需添加一个\leavevmode,它就会按预期工作:

\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{wrapfig}
\newif\iffailmiserably

\failmiserablytrue % set this to false for comparison!

\begin{document}

\begin{wrapfigure}{r}{0.33\textwidth}
Just a little bit of text in the wrapfigure envoronment.
A full lipsum paragraph would be too much.
We don't want this to fill the page, after all.
\end{wrapfigure}

\leavevmode
\iffailmiserably{This} fails miserably. \else This {works fine.} \fi
\lipsum

\end{document} 

在此处输入图片描述

相关内容