tikz 图片内部的 wrapfigure 与普通文本重叠

tikz 图片内部的 wrapfigure 与普通文本重叠

我的文档中有几个用 wrapfigure 包裹的 tikz 图片,其中只有一张与文本重叠, 以下是 pdf 输出的屏幕截图

如您所见,数学方程式居中,好像没有出现换行图,这是代码(请记住,我删除了大部分非问题代码)。但是,在 overleaf 上编译代码时(项目网址在底部),问题不存在,我在 Windows 10 机器上使用 MikTeX + PDFLaTeX。

\documentclass[12pt]{book}

\usepackage[top = 1in,
            bottom = 1in,
            left = 0.75in,
            right = 0.75in
            ]{geometry}
\usepackage{tikz}
\usetikzlibrary{3d}

\usepackage{graphicx}
\usepackage{amsmath, amsfonts}
\usepackage{wrapfig}
\usepackage{pgfplots}

\begin{document}
\begin{wrapfigure}{r}{0.35\textwidth}
\vspace{-60pt}
\begin{tikzpicture}[scale = 3]

\filldraw [very thick, draw = red, fill = red!10] (0, 0) -- (0.5, 0) arc[start angle = 0, end angle = 45, radius = 0.5] -- cycle;

\filldraw [very thick, draw = red, fill = red!10, rotate = 90] (0, 0) -- (0.5, 0) arc[start angle = 0, end angle = 45, radius = 0.5] -- cycle;

\node [anchor = south west] at (22.5: 0.5) {$\Psi$};
\node [anchor = south east] at (112.5: 0.5) {$\Psi$};

\node [anchor = west] at (1, 0) {$\vec{i}$};
\node [anchor = south] at (0, 1) {$\vec{j}$};
\node [anchor = south west] at (45:1) {$\vec{u}$};
\node [anchor = south east] at (135:1) {$\vec{v_1}$};
\node [anchor = north west] at (0.1, 0) {$O$};
\node [anchor = east] at (-0.1, 0) {$\vec{k}$};

\filldraw [fill = orange!50, draw = orange, very thick] (0, 0) circle (0.075);

\begin{scope}[red, ->, very thick]
\draw (0, 0) -- (0, 1);
\draw (0, 0) -- (1, 0);
\end{scope}

\begin{scope}[rotate = 45, green, ->, very thick]
\draw (0, 0) -- (0, 1);
\draw (0, 0) -- (1, 0);
\end{scope}
\draw (-1, -1) rectangle (1.2, 2);
\end{tikzpicture}
\end{wrapfigure}




\subsection{Mutation Rotation $\theta$}

It is the rotation around the $\vec{u}$ axis.

$$\vec{\Omega}(R_2/R_1) = \dot{\theta} \vec{u}$$

$$\left(\vec{u},\vec{v_1}, \vec{k_0}\right)\longrightarrow\left(\vec{u}, \vec{v},\vec{k_s}\right)$$

\end{document}

这是该程序的屏幕截图,您可以看到 x 轴上存在包裹问题。

微型代码执行截图

我已经将整个代码上传至overleaf.com,以防您需要全部内容。

答案1

在图形周围使用更紧密的矩形或者根本不使用矩形。

该图应位于之后\subsection以避免警告Stationary wrapfigure forced to float

运行 MikTeX 和 pdflatex。This is pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3)

A

% !TeX TS-program = pdflatex

\listfiles
\documentclass[12pt]{book}

\usepackage[top = 1in,
            bottom = 1in,
            left = 0.75in,
            right = 0.75in
            ]{geometry}
\usepackage{tikz}
\usetikzlibrary{3d}

\usepackage{graphicx}
\usepackage{amsmath, amsfonts}
\usepackage{wrapfig}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}

\subsection{Mutation Rotation $\theta$}

\begin{wrapfigure}{r}{0.4\textwidth}
\vspace{-40pt} % changed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\begin{tikzpicture}[scale = 3]

    \filldraw [very thick, draw = magenta, fill = red!10] (0, 0) -- (0.5, 0) arc[start angle = 0, end angle = 45, radius = 0.5] -- cycle;
    
    \filldraw [very thick, draw = magenta, fill = red!10, rotate = 90] (0, 0) -- (0.5, 0) arc[start angle = 0, end angle = 45, radius = 0.5] -- cycle;
    
    \node [anchor = south west] at (22.5: 0.5) {$\Psi$};
    \node [anchor = south east] at (112.5: 0.5) {$\Psi$};
    
    \node [anchor = west] at (1, 0) {$\vec{i}$};
    \node [anchor = south] at (0, 1) {$\vec{j}$};
    \node [anchor = south west] at (45:1) {$\vec{u}$};
    \node [anchor = south east] at (135:1) {$\vec{v_1}$};
    \node [anchor = north west] at (0.1, 0) {$O$};
    \node [anchor = east] at (-0.1, 0) {$\vec{k}$};
    
    \filldraw [fill = orange!50, draw = orange, very thick] (0, 0) circle (0.075);
    
    \begin{scope}[red, ->, very thick]
    \draw (0, 0) -- (0, 1);
    \draw (0, 0) -- (1, 0);
    \end{scope}
    
    \begin{scope}[rotate = 45, green, ->, very thick]
    \draw (0, 0) -- (0, 1);
    \draw (0, 0) -- (1, 0);
    \end{scope}
    \draw[xshift =-10mm,yshift = -2mm] (0, 0) rectangle (2.3, 1.5); % changed <<<<<<<<<<<<<<
\end{tikzpicture}
\end{wrapfigure}
It is the rotation around the $\vec{u}$ axis.

\[\vec{\Omega}(R_2/R_1) = \dot{\theta} \vec{u}\]

\[\left(\vec{u},\vec{v_1}, \vec{k_0}\right)\longrightarrow\left(\vec{u}, \vec{v},\vec{k_s}\right)\]

\end{document}

\listfiles开头的命令会将所有已加载的文件及其版本的列表放入.log文件中。

与我的进行比较,看看是否有任何包需要更新。

*File List*
book.cls    2020/04/10 v1.4m Standard LaTeX document class
bk12.clo    2020/04/10 v1.4m Standard LaTeX file (size option)
geometry.sty    2020/01/02 v5.9 Page Geometry
keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
ifvtex.sty    2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
iftex.sty    2020/03/06 v1.0d TeX engine tests
geometry.cfg
tikz.sty    2020/12/27 v3.1.8b (3.1.8b)
pgf.sty    2020/12/27 v3.1.8b (3.1.8b)
pgfrcs.sty    2020/12/27 v3.1.8b (3.1.8b)
pgfrcs.code.tex
pgfcore.sty    2020/12/27 v3.1.8b (3.1.8b)
graphicx.sty    2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR)
trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
pdftex.def    2020/10/05 v1.2a Graphics/color driver for pdftex
pgfsys.sty    2020/12/27 v3.1.8b (3.1.8b)
pgfsys.code.tex
pgfsyssoftpath.code.tex    2020/12/27 v3.1.8b (3.1.8b)
pgfsysprotocol.code.tex    2020/12/27 v3.1.8b (3.1.8b)
xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg    2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty    2020/12/27 v3.1.8b (3.1.8b)
pgfcomp-version-1-18.sty    2020/12/27 v3.1.8b (3.1.8b)
pgffor.sty    2020/12/27 v3.1.8b (3.1.8b)
pgfkeys.sty    
pgfkeys.code.tex
pgfmath.sty    
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
amsmath.sty    2020/09/23 v2.17i AMS math features
amstext.sty    2000/06/29 v2.01 AMS text
amsgen.sty    1999/11/30 v2.0 generic functions
amsbsy.sty    1999/11/29 v1.2d Bold Symbols
amsopn.sty    2016/03/08 v2.02 operator names
amsfonts.sty    2013/01/14 v3.01 Basic AMSFonts support
wrapfig.sty    2003/01/31  v 3.6
pgfplots.sty    2020/02/29 v1.17 Data Visualization (1.17)
l3backend-pdftex.def    2021-03-18 L3 backend support: PDF output (pdfTeX)
supp-pdf.mkii
epstopdf-base.sty    2020-01-24 v2.11 Base part for package epstopdf
epstopdf-sys.cfg    2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
umsa.fd    2013/01/14 v3.01 AMS symbols A
umsb.fd    2013/01/14 v3.01 AMS symbols B
***********

相关内容