我刚刚在使用以下代码时遇到了wrapfigure的一些问题:
\documentclass[a4paper, 12pt]{article}
\usepackage{wrapfig} % to have text around figures
\usepackage{graphicx}
\usepackage{amsmath}
\begin{document}
\subsubsection*{Sample Subsection}
\begin{wrapfigure}{r}{0.25\textwidth}
\includegraphics[width=0.23\textwidth]{sampleFigure}
\caption{Heat Balance for the ceiling node}
\end{wrapfigure}
\begin{equation*}
a^2+b^2=c^2
\end{equation*}
with
\begin{align*}
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2
\end{align*}
can be solved to
\begin{equation}
a^2+b^2=c^2
\end{equation}
\subsubsection*{Sample Subsection}
\begin{wrapfigure}{r}{0.25\textwidth}
\includegraphics[width=0.23\textwidth]{sampleFigure}
\caption{Heat Balance for the ceiling node}
\end{wrapfigure}
-> With some text it is working!
\begin{equation*}
a^2+b^2=c^2
\end{equation*}
with
\begin{align*}
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2
\end{align*}
can be solved to
\begin{equation}
a^2+b^2=c^2
\end{equation}
\end{document}
第一小节有问题,而第二小节看起来符合我的预期。两节之间的唯一区别是以“->”开头的行。
有人可以解释这种行为吗?
答案1
我不能声称了解最初导致问题的内部原因;但是,在\leavevmode
后面放置\end{wrapfigure}
可以解决问题。
我从观察到的行为推断出答案,在 后添加一些文本也wrapfigure
可以解决问题。添加文本会让您退出垂直模式,因此我尝试保留垂直模式作为解决方案,并且成功了。这是 的一个错误吗wrapfig
?我说不出来。
(对于其余的读者来说,评论一行将会重新引发问题。)
\documentclass[a4paper, 12pt]{article}
\usepackage{wrapfig} % to have text around figures
\usepackage[demo]{graphicx}
\usepackage{amsmath}
\begin{document}
\subsubsection*{Sample Subsection}
\begin{wrapfigure}{r}{0.25\textwidth}
\includegraphics[width=0.23\textwidth]{sampleFigure}
\caption{Heat Balance for the ceiling node}
\end{wrapfigure}
\leavevmode% THIS RESOLVED IT
\begin{equation*}
a^2+b^2=c^2
\end{equation*}
with
\begin{align*}
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2
\end{align*}
can be solved to
\begin{equation}
a^2+b^2=c^2
\end{equation}
\subsubsection*{Sample Subsection}
\begin{wrapfigure}{r}{0.25\textwidth}
\includegraphics[width=0.23\textwidth]{sampleFigure}
\caption{Heat Balance for the ceiling node}
\end{wrapfigure}
-> With some text it is working!
\begin{equation*}
a^2+b^2=c^2
\end{equation*}
with
\begin{align*}
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2 \\
a^2+b^2&=c^2 & a^2+b^2&=c^2
\end{align*}
can be solved to
\begin{equation}
a^2+b^2=c^2
\end{equation}
\end{document}