不

我正在学习 wrapfig 包。我注意到,当我包含具有通用定义的通用 latex 文件时,文本不再环绕图形,而是图形仅被推到右侧(因为我设置wrapfig这样做)。

结果是,由于我geometry在通用乳胶文件中使用了包,其中我为所有文档设置了边距2.2cm,这是我很久以前设置的。

如果我不使用该geometry包,那么文本将按预期换行。

我不明白为什么这种边距设置会导致 wrapfig 出现如此大的错误。我想保留使用边距的geometry2.2cm,并继续使用 wrapfigure。这可能吗?有没有更好的方法可以做到这一点?

下面将通过一个 MWE 示例进行说明。首先将展示使用\usepackage[margin={2.2cm}]{geometry}

Mathematica 图形

现在将显示相同的页面,但根本不使用几何包。

Mathematica 图形

geometry所以现在文本确实可以换行了。但是页面的边距太大,这就是我想使用几何的原因。我在之前或之后加载包都没关系wrapfig。同样的问题。

这是 MWE

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[margin={2.2cm}]{geometry}%
\usepackage{wrapfig, blindtext}

\begin{document}
\section{The problem}
\begin{wrapfigure}{R}{0.3\textwidth}
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{\label{fig:d1}Integrating a function}
\end{wrapfigure}
%
To find a numerical value for the integral of a real valued function of a real
variable over a specific range over the real line. This means to
evaluate
\[
I={\displaystyle\int\limits_{a}^{b}}f\left(  x\right)  \ dx
\]
Geometrically, this integral represents the area under $f(x)$
from $a$ to $b$%

\section{Solution}
\begingroup
\begin{wrapfigure}{R}{0.3\textwidth}
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{\label{fig:d2}Numerical integration}
\end{wrapfigure}
\endgroup

We can always approximate the area by dividing it in equal width strips and
then sum the areas of all the strips.

In general, there will always be an error in the estimate of the area using
this method. The error will become smaller the more strips
we use (which implies a smaller strip width). Hence we can write%

\[
{\displaystyle\int\limits_{a}^{b}}
f\left(  x\right)  \ dx=\left(
{\displaystyle\sum\limits_{i=1}^{N}}
\Delta x\ f\left(  x_{i}\right)  \right)  +E
\]

Where $E$ is the error between the actual area and the approximated area using the
above method of numerical integration. $N$ above is the number of strips or
can also be refereed to as the number of integration points.

Instead of keep referring to the 'width of the strip' all the time, we will
call this quantity the weight $w_{i}$ that we will multiply the value of the
function with to obtain the area. Hence the above becomes

\[%
{\displaystyle\int\limits_{a}^{b}}
f\left(  x\right)  \ dx=\left(
{\displaystyle\sum\limits_{i=1}^{N}}
w_{i}\ f\left(  x_{i}\right)  \right)  +E
\]

Using implied summation on indices the above becomes

\[%
{\displaystyle\int\limits_{a}^{b}}
f\left(  x\right)  \ dx=w_{i}\ f\left(  x_{i}\right)  +E
\]

In the above we divided the range of the integration (the distance between the
upper and lower limits of integration) into equal intervals. We can decide to
evaluate $f(x_{i})$ at the middle of the strip or at the start
of the strip or at the end of the strip. In the diagram above we evaluated the
$f(x)$ at the left end of the strip.

Our goal is to evaluate this integral such as the error $E$ is minimum and using
the smallest number of integration points. In a sense this can be considered
an optimization problem with constraints: minimize the error of integration
using the smallest possible number of points.

\end{document}

答案1

  1. 使用大写字母(如R)作为浮点说明符。大写字母表示图形可以浮动。
  2. 不要使用组来包装wrapfigure环境。

  1. 在下面的段落中放入足够的文字wrapfigure
  2. wrapfigure通过 olga.saucedo指定要剪切的行数(以便容纳)作为 tols。

这是注释的代码。

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[margin={2.2cm}]{geometry}%
\usepackage{wrapfig, blindtext}

\begin{document}
\section{The problem}
\begin{wrapfigure}[12]{r}{0.3\textwidth}
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{\label{fig:d1}Integrating a function}
\end{wrapfigure}
%
To find a numerical value for the integral of a real valued function of a real
variable over a specific range over the real line. This means to
evaluate
\[
I={\displaystyle\int\limits_{a}^{b}}f\left(  x\right)  \ dx
\]
Geometrically, this integral represents the area under $f(x)$
from $a$ to $b$.%

%% uncomment following dummy text to see the undesired effect
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.
This is some dummy text. This is some dummy text. This is some dummy text. This is some dummy text.

\section{Solution}
%\begingroup   %% why group?
\begin{wrapfigure}[12]{r}{0.3\textwidth}
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{\label{fig:d2}Numerical integration}
\end{wrapfigure}
%\endgroup

We can always approximate the area by dividing it in equal width strips and
then sum the areas of all the strips.

在此处输入图片描述

In general, there will always be an error in the estimate of the area using
this method. The error will become smaller the more strips
we use (which implies a smaller strip width). Hence we can write%

\[
{\displaystyle\int\limits_{a}^{b}}
f\left(  x\right)  \ dx=\left(
{\displaystyle\sum\limits_{i=1}^{N}}
\Delta x\ f\left(  x_{i}\right)  \right)  +E
\]

Where $E$ is the error between the actual area and the approximated area using the
above method of numerical integration. $N$ above is the number of strips or
can also be refereed to as the number of integration points.

Instead of keep referring to the 'width of the strip' all the time, we will
call this quantity the weight $w_{i}$ that we will multiply the value of the
function with to obtain the area. Hence the above becomes

\[%
{\displaystyle\int\limits_{a}^{b}}
f\left(  x\right)  \ dx=\left(
{\displaystyle\sum\limits_{i=1}^{N}}
w_{i}\ f\left(  x_{i}\right)  \right)  +E
\]

Using implied summation on indices the above becomes

\[%
{\displaystyle\int\limits_{a}^{b}}
f\left(  x\right)  \ dx=w_{i}\ f\left(  x_{i}\right)  +E
\]

In the above we divided the range of the integration (the distance between the
upper and lower limits of integration) into equal intervals. We can decide to
evaluate $f(x_{i})$ at the middle of the strip or at the start
of the strip or at the end of the strip. In the diagram above we evaluated the
$f(x)$ at the left end of the strip.

Our goal is to evaluate this integral such as the error $E$ is minimum and using
the smallest number of integration points. In a sense this can be considered
an optimization problem with constraints: minimize the error of integration
using the smallest possible number of points.

\end{document}

答案2

Wrapfig计算整个段落的短线宽度。您的文本有很多短段落,所以我认为它“迷失了方向”,无法确定换行应该走多远。但Wrapfig也提供了一个可选参数来修复应该短的行数。如果您写:

\begin{wrapfigure}[10]{R}{0.3\textwidth}

在相关位置,然后您可以手动调整每个图的方括号中的数字,以获得所需的布局。请注意,仅限制第二个图的行数是行不通的,您必须对它们两个都这样做。

相关内容