Wrapfigure 为页面剩余部分保留空间

Wrapfigure 为页面剩余部分保留空间

有人能帮我解决这个问题吗?我查过有类似问题的问题,但似乎没有一个对我有用。我正在写一本书,我喜欢使用wrapfig站点注释来回忆或记笔记等。在整本书中,包裹图在其下方为页面的其余部分保留空间。\clearpage解决了这个问题,但我不想在每页之后开始新的一页wrapfigure。帮助 :(

以下是我正在处理的一个具体案例:在此处输入图片描述

我希望图表下方的段落能够扩展到整个页面。上面的 MWE 如下所示。

    \documentclass{article}
    \usepackage{tikz}
    \usepackage{amsmath}
    \usepackage{wrapfig}
    \usepackage{framed}
    \usepackage{geometry}
    \geometry{a4paper, portrait, margin=1in}
        \begin{document}
    \subsection*{What is Differentiation?}
    Differentiation is a mathematical tool used to find the \textbf{gradient of a tangent} to any general curve $y=f(x)$ at any desired point ($P$).
    \begin{center}
        \begin{tikzpicture}[domain=0:4]
        \draw (0,-0.3) node[left]{$O$};
        \draw[thick, color=gray,->] (-4,0) -- (5,0) node[right] {\textcolor{black}{$x$}};
        \draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$f(x)$}};
        \draw [color=red, semithick](-4,1).. controls(1,1.5).. (3.5,5);
        \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=below right:{$P(x,y)$}] (P) at (1.15,2.15) {};
        \draw (3,4) node[right]{$y=f(x)$};
        \draw (-1,3/5+0.05)--(3,34/10+0.05);
        \draw (-0.3,0.3) node[left]{tangent};
        \end{tikzpicture}
    \end{center}
    In general, the steepness (i.e. gradient) of a curve at any point $P$ is the same as the gradient of the tangent at that point; i.e.
    \[m_{\text{tangent at P}}=m_{f(x)\text{ at P}}\]
    In calculus, $m_{f(x)\text{ at P}}$ is denoted \[\displaystyle\frac{d}{dx}\left(f(x)\right)\text{~~or~~~~} \displaystyle\frac{dy}{dx}\] when the equation is defined in the form $y=f(x)$, and we call this general gradient the \textbf{derivative} of the curve. \paragraph{}
    \begin{wrapfigure}{r}{5.5cm}
        \vspace{-1cm}
        \begin{center}
            \begin{minipage}{5cm}
                \colorlet{shadecolor}{green!15}
                \begin{shaded}
                    \normalsize \textbf{Notation}
                    \Large $$\delta x$$
                    \normalsize The Greek letter $\delta$ (small-case delta) is a \textbf{prefix} to a variable and it represents an infinitesimally small increase in that variable. It is not a distinct value. 
                \end{shaded}
            \end{minipage}
        \end{center}
    \end{wrapfigure}
    Consider now another point on our general curve, the point Q. This point is $\delta x$ away from $P$ horizontally and $\delta y$ away from $P$ vertically:\\
        \begin{tikzpicture}[domain=0:4]
        \draw (0,-0.3) node[left]{$O$};
        \draw[thick, color=gray,->] (-4,0) -- (5,0) node[right] {\textcolor{black}{$x$}};
        \draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$f(x)$}};
        \draw[color=blue] (1.15,2.15)--(3.3,4.7);
        \draw [color=red, semithick](-4,1).. controls(1,1.5).. (3.5,5);
        \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=below right:{$P(x,y)$}] (P) at (1.15,2.15) {};
        \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=right:{$Q(x+\delta x,y+\delta y)$}] (Q) at (3.3,4.7) {};
        \draw (3,4) node[right]{$y=f(x)$};
        \draw (-1,3/5+0.05)--(3,34/10+0.05);
        \draw (-0.3,0.3) node[left]{tangent};
        \draw[dotted] (3.3,4.7)--(3.3,4.3);
        \draw[dotted] (3.3,3.7)--(3.3,0);
        \draw[dotted] (1.12,2.15)--(1.12,0);
        \draw[dotted] (3.3,4.7)--(0,4.7);
        \draw[dotted] (1.12,2.15)--(0,2.15);
        \draw[<->,dashed](-0.3,2.15)--(-0.3,4.7);
        \draw(-0.6, 3.4) node{$\delta y$};
        \draw[<->,dashed](1.15,-0.3)--(3.3,-0.3);
        \draw(2.3, -0.6) node{$\delta x$};
        \end{tikzpicture}\\
        The coordinates of $Q$ are $(x+\delta x,y+\delta y)$, shown above. We notice that if the values of $\delta x$ and $\delta y$ were to get smaller and smaller, the gradient of the chord $PQ$ (in blue) would approach that of the tangent at $P$, the gradient we wish to find ($\frac{dy}{dx}$). We also know that the $y$-values of this graph are dependent on their respective $x$-value, since $y$ is defined as a function of $x$ ($y=f(x)$). So as $\delta x$ decreases, $\delta y$ will consequentially decrease because $(y+\delta y)$ is dependent on $(x+\delta x)$. So we can say that as $\boldsymbol{\delta x\longrightarrow 0}$;  $\boldsymbol{m_{PQ}\longrightarrow\frac{dy}{dx}}$. 
    \end{document}

我很感谢您的反馈:)

答案1

您只需将要换行的行数作为环境的可选参数进行设置:

\begin{wrapfigure}[3]{r}{5.5cm}
\end{wrapfigure}

或者,您可以尝试InsertBoxR在环境中使用通用宏wrapfigure:使用

......
\input{insboxtex}
\begin{document}
......

\InsertBoxR{0}{%
 \begin{minipage}{5cm}
\colorlet{shadecolor}{green!15}
    \vskip\dimexpr-\FrameSep-0.6ex\relax
\begin{shaded}
\normalsize \textbf{Notation}
\Large $$\delta x$$
    \normalsize The Greek letter $\delta$ (small-case delta) is a \textbf{prefix} to a variable and it represents an infinitesimally small increase in that variable. It is not a distinct value.
\end{shaded}
\end{minipage}}[-2]

在此处输入图片描述

答案2

你不需要wrapfig这个。你也不需要并且framedamsbsy你滥用了\boldsymbol\boldmath如果你真的想让数学变得大胆)。

我还删除了不需要的\left\right和。\displaystyle

wrapfig不要使用非工作环境tabular,因为您想要放置一些不允许在插入周围流动的东西。

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usepackage{amsmath,bm,tabularx,framed}

\geometry{a4paper, portrait, margin=1in}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\newcommand{\normalindent}{\hspace*{\normalparindent}}

\begin{document}

\subsection*{What is Differentiation?}

Differentiation is a mathematical tool used to find the \textbf{gradient of a tangent} to 
any general curve $y=f(x)$ at any desired point ($P$).
\begin{center}
\begin{tikzpicture}[domain=0:4]
  \draw (0,-0.3) node[left]{$O$};
  \draw[thick, color=gray,->] (-4,0) -- (5,0) node[right] {\textcolor{black}{$x$}};
  \draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$f(x)$}};
  \draw [color=red, semithick](-4,1).. controls(1,1.5).. (3.5,5);
  \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=below right:{$P(x,y)$}] (P) at (1.15,2.15) {};
  \draw (3,4) node[right]{$y=f(x)$};
  \draw (-1,3/5+0.05)--(3,34/10+0.05);
  \draw (-0.3,0.3) node[left]{tangent};
\end{tikzpicture}
\end{center}
In general, the steepness (i.e. gradient) of a curve at any point $P$ is the same as the 
gradient of the tangent at that point; i.e.
\[
m_{\text{tangent at $P$}}=m_{f(x)\text{ at $P$}}
\]
In calculus, $m_{f(x)\text{ at $P$}}$ is denoted
\[
\frac{d}{dx}(f(x))\qquad\text{or}\qquad\frac{dy}{dx}
\]
when the equation is defined in the form $y=f(x)$, and we call this general gradient the 
\textbf{derivative} of the curve.\strut

\noindent\begin{tabular}{
  @{}
  p{\dimexpr\textwidth-2\tabcolsep-5cm-12pt}
  c
  @{}
}
\normalindent Consider now another point on our general curve, the point Q. This point 
is $\delta x$ away from $P$ horizontally and $\delta y$ away from $P$ vertically:
\begin{center}
\begin{tikzpicture}[domain=0:4,scale=.95]
  \draw (0,-0.3) node[left]{$O$};
  \draw[thick, color=gray,->] (-4,0) -- (5,0) node[right] {\textcolor{black}{$x$}};
  \draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$f(x)$}};
  \draw[color=blue] (1.15,2.15)--(3.3,4.7);
  \draw [color=red, semithick](-4,1).. controls(1,1.5).. (3.5,5);
  \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=below right:{$P(x,y)$}] (P) at (1.15,2.15) {};
  \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=right:{$Q(x+\delta x,y+\delta y)$}] (Q) at (3.3,4.7) {};
  \draw (3,4) node[right]{$y=f(x)$};
  \draw (-1,3/5+0.05)--(3,34/10+0.05);
  \draw (-0.3,0.3) node[left]{tangent};
  \draw[dotted] (3.3,4.7)--(3.3,4.3);
  \draw[dotted] (3.3,3.7)--(3.3,0);
  \draw[dotted] (1.12,2.15)--(1.12,0);
  \draw[dotted] (3.3,4.7)--(0,4.7);
  \draw[dotted] (1.12,2.15)--(0,2.15);
  \draw[<->,dashed](-0.3,2.15)--(-0.3,4.7);
  \draw(-0.6, 3.4) node{$\delta y$};
  \draw[<->,dashed](1.15,-0.3)--(3.3,-0.3);
  \draw(2.3, -0.6) node{$\delta x$};
\end{tikzpicture}
\end{center} &
\setlength{\fboxsep}{6pt}%
\smash{\colorbox{green!15}{%
\begin{minipage}[t]{5cm}
\textbf{Notation}
\begin{center}
\Large $\delta x$
\end{center}
The Greek letter $\delta$ (small-case delta) is a \textbf{prefix} to a variable and it 
represents an infinitesimally small increase in that variable. It is not a distinct value.
\end{minipage}}}
\end{tabular}
The coordinates of $Q$ are $(x+\delta x,y+\delta y)$, shown above. We notice that if the 
values of $\delta x$ and $\delta y$ were to get smaller and smaller, the gradient of the 
chord $PQ$ (in blue) would approach that of the tangent at $P$, the gradient we wish to find 
($\frac{dy}{dx}$). We also know that the $y$-values of this graph are dependent on their 
respective $x$-value, since $y$ is defined as a function of $x$ ($y=f(x)$). So as $\delta x$ 
decreases, $\delta y$ will consequentially decrease because $(y+\delta y)$ is dependent on 
$(x+\delta x)$. So we can say that as {\boldmath$\delta x\longrightarrow 0$; 
$m_{PQ}\longrightarrow\frac{dy}{dx}$}.

\end{document}

需要一些技巧才能让 LaTeX 在表格中缩进段落,但当\normalindent您想在\parbox或中缩进段落minipage(其中正常缩进被抑制)的其他情况下也可以显着方便。

永远不要使用$$\Large$$\delta x$$您所拥有的只是通过center环境实现的。

我也对第二个进行了一点缩放tikzpicture,否则它就不适合分配的空间。

在此处输入图片描述

您也可以不使用tabular,而是使用一些低级技巧。插入内容被添加到开头,作为一个零宽度框,其中包含另一个与文本宽度一样宽的框,插入内容被放置在最右边距。

然后将运行的文本设置为负数,这会使缩进位于右侧。最后一行(包含图表)使用涉及和的\hangindent巧妙技巧居中。我们通过在图表之后的文本开头发出来掩盖我们的踪迹。\leftskip\rightskip\noindent

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usepackage{amsmath,bm,tabularx,framed}

\geometry{a4paper, portrait, margin=1in}

\begin{document}

\subsection*{What is Differentiation?}

Differentiation is a mathematical tool used to find the \textbf{gradient of a tangent} to 
any general curve $y=f(x)$ at any desired point ($P$).
\begin{center}
\begin{tikzpicture}[domain=0:4]
  \draw (0,-0.3) node[left]{$O$};
  \draw[thick, color=gray,->] (-4,0) -- (5,0) node[right] {\textcolor{black}{$x$}};
  \draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$f(x)$}};
  \draw [color=red, semithick](-4,1).. controls(1,1.5).. (3.5,5);
  \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=below right:{$P(x,y)$}] (P) at (1.15,2.15) {};
  \draw (3,4) node[right]{$y=f(x)$};
  \draw (-1,3/5+0.05)--(3,34/10+0.05);
  \draw (-0.3,0.3) node[left]{tangent};
\end{tikzpicture}
\end{center}
In general, the steepness (i.e. gradient) of a curve at any point $P$ is the same as the 
gradient of the tangent at that point; i.e.
\[
m_{\text{tangent at $P$}}=m_{f(x)\text{ at $P$}}
\]
In calculus, $m_{f(x)\text{ at $P$}}$ is denoted
\[
\frac{d}{dx}(f(x))\qquad\text{or}\qquad\frac{dy}{dx}
\]
when the equation is defined in the form $y=f(x)$, and we call this general gradient the 
\textbf{derivative} of the curve.

\noindent
\makebox[0pt][l]{%
  \makebox[\textwidth][r]{%
    \setlength{\fboxsep}{6pt}%
    \smash{\colorbox{green!15}{%
    \begin{minipage}[t]{5cm}
    \textbf{Notation}
    \begin{center}
    \Large $\delta x$
    \end{center}
    The Greek letter $\delta$ (small-case delta) is a \textbf{prefix} to a variable and it 
    represents an infinitesimally small increase in that variable. It is not a distinct value.
    \end{minipage}}}%
  }%
}\indent
\hangindent=-\dimexpr5cm+12pt+6pt\relax\hangafter=0
\begingroup
\leftskip=0pt plus 0.5fil \rightskip=0pt plus -0.5fil
Consider now another point on our general curve, the point Q. This point 
is $\delta x$ away from $P$ horizontally and $\delta y$ away from $P$ vertically:\\
\begin{tikzpicture}[domain=0:4,scale=.95]
  \draw (0,-0.3) node[left]{$O$};
  \draw[thick, color=gray,->] (-4,0) -- (5,0) node[right] {\textcolor{black}{$x$}};
  \draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$f(x)$}};
  \draw[color=blue] (1.15,2.15)--(3.3,4.7);
  \draw [color=red, semithick](-4,1).. controls(1,1.5).. (3.5,5);
  \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=below right:{$P(x,y)$}] (P) at (1.15,2.15) {};
  \node[circle,fill=black,inner sep=0pt,minimum size=3pt,label=right:{$Q(x+\delta x,y+\delta y)$}] (Q) at (3.3,4.7) {};
  \draw (3,4) node[right]{$y=f(x)$};
  \draw (-1,3/5+0.05)--(3,34/10+0.05);
  \draw (-0.3,0.3) node[left]{tangent};
  \draw[dotted] (3.3,4.7)--(3.3,4.3);
  \draw[dotted] (3.3,3.7)--(3.3,0);
  \draw[dotted] (1.12,2.15)--(1.12,0);
  \draw[dotted] (3.3,4.7)--(0,4.7);
  \draw[dotted] (1.12,2.15)--(0,2.15);
  \draw[<->,dashed](-0.3,2.15)--(-0.3,4.7);
  \draw(-0.6, 3.4) node{$\delta y$};
  \draw[<->,dashed](1.15,-0.3)--(3.3,-0.3);
  \draw(2.3, -0.6) node{$\delta x$};
\end{tikzpicture}
\par\endgroup

\noindent
The coordinates of $Q$ are $(x+\delta x,y+\delta y)$, shown above. We notice that if the 
values of $\delta x$ and $\delta y$ were to get smaller and smaller, the gradient of the 
chord $PQ$ (in blue) would approach that of the tangent at $P$, the gradient we wish to find 
($\frac{dy}{dx}$). We also know that the $y$-values of this graph are dependent on their 
respective $x$-value, since $y$ is defined as a function of $x$ ($y=f(x)$). So as $\delta x$ 
decreases, $\delta y$ will consequentially decrease because $(y+\delta y)$ is dependent on 
$(x+\delta x)$. So we can say that as {\boldmath$\delta x\longrightarrow 0$; 
$m_{PQ}\longrightarrow\frac{dy}{dx}$}.

\end{document}

相关内容