wrapfigure 後のテキスト幅が間違っている

wrapfigure 後のテキスト幅が間違っている

写真も添付しましたがwrapfigure、すべて問題ありません。問題は、次の数式環境では、数式が完全に間違っていることです。環境で設定した幅も数式に影響しているように思われますwrapfigure。幅を標準に戻すにはどうすればよいですか?

これが私のコードです:

\documentclass{book}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{wrapfig}
\usepackage{mdframed}

\newtheoremstyle{mystyle}{}{}{}{}{}{}{0.5em}{}
\theoremstyle{mystyle}
\newmdtheoremenv{formel}{Formel}

\begin{document}
\begin{wrapfigure}{l}{8cm}
  \includegraphics[scale=0.48]{example-image-a}
\end{wrapfigure}
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
\begin{formel}[Formel]
$1+1=2$
\end{formel}
\end{document}

したがって、図の周りのテキストの折り返しは問題ありませんが、数式の幅が間違っています。がtextwidthに設定されているため、表示が間違ってしまうように思われます。wrapfiguretextwidth

答え1

マニュアルを引用するとラップフィグパッケージ、ページ 1:

いかなる種類のリスト環境でも、 または をその直前または直後に指定してはなりません。間にwrapfigure空白行 ( ) がある場合は、リストの後に続けても問題ありません。\par

[...]

\linewidth折り返されたテキスト内で調整されるようになりましたが、一度に設定できるのは段落全体に対してのみであるため、折り返し後、段落が終了するまで間違った値が保持されます。

そして2ページ目:

美観上の理由から、図の周囲にはプレーン テキストのみを配置してください。セクション タイトルや大きな数式は見栄えが悪く、図が左側にある場合はリストも見栄えが悪くなります (これらはすべて適切に機能しますが、見栄えがよくありません)。小さな数式は見栄えがよいです。

つまり、\parの前にa を置きます\begin{formel}

\documentclass{book}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{wrapfig}
\usepackage{mdframed}

\newtheoremstyle{mystyle}{}{}{}{}{}{}{0.5em}{}
\theoremstyle{mystyle}
\newmdtheoremenv{formel}{Formel}

%\usepackage{picins}

\begin{document}
\begin{wrapfigure}{l}{8cm}
  \includegraphics[scale=0.48]{example-image-a}
\end{wrapfigure}
text 
\par
\makeatletter
\loop
\ifnum\c@WF@wrappedlines>3
\hspace*{1sp}\newline
\advance\c@WF@wrappedlines by -1
\repeat
\makeatother
\par
\begin{formel}[Formel]
$1+1=2$
\end{formel}
\end{document}

折り返されるテキストが短すぎる場合、もちろん、幅が狭い折り返しテキスト内に数式が配置されます。(さらに、\usepackage{picins}数式が画像の上に印刷されないように、追加のテキストが必要です。) \c@WF@wrappedlineswrapfig パッケージを使用して、適切な数の空行を自動的に挿入すると、この問題は修正されます。

答え2

wrapfigを で囲みますminipage。通常は

\begin{minipage}
\begin{wrapfig}
...
\end{wrapfig}
...text... to be wrapped
\end{minipage}
..more text which should be normal

関連情報