我怎样才能使 tikzpicture 平滑地围绕文本流动?

我怎样才能使 tikzpicture 平滑地围绕文本流动?

tikzpicture我在使用和时遇到了问题wrapfigure。主要问题是,当使用第三个参数时,“距离”会变得任意。例如,我正在使用9cm但正确的方法是什么?因为目前,文本看起来不合适且不对齐。

\documentclass{article}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{wrapfig}

\begin{document}

Whenever we deal with integration, we come across the constant of integration $C$. Suppose we have the following graph of $ f(x) = \sin x$. 

\begin{wrapfigure}{l}{9cm}
\begin{tikzpicture}
\begin{axis}[
xlabel = $x$,
ylabel = $f(x)$
]
\addplot{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{wrapfigure}

The primary reason for doing integration is to be able to solve differential equations.

\begin{quote}
    some random text goes here and other cool stuff.
\end{quote}

\end{document}

答案1

不要使用9cm,而要使用0pt,那么将使用 的自然宽度wrapfigure来对齐周围的文本。在第一行缩进可能看起来很奇怪,所以添加\noindent The primary...会让它看起来不那么奇怪。

在此处输入图片描述

\documentclass{article}
\usepackage{pgfplots,wrapfig}

\begin{document}

Whenever we deal with integration, we come across the constant of integration $C$. Suppose we have the following graph of $ f(x) = \sin x$. 

\begin{wrapfigure}{l}{0pt}
\begin{tikzpicture}
\begin{axis}[
xlabel = $x$,
ylabel = $f(x)$
]
\addplot{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{wrapfigure}

\noindent The primary reason for doing integration is to be able to solve differential equations.

\begin{quote}
    some random text goes here and other cool stuff.
\end{quote}

\end{document}

相关内容