![`tikz` `spy` 库不渲染背景层](https://linux22.com/image/407042/%60tikz%60%20%60spy%60%20%E5%BA%93%E4%B8%8D%E6%B8%B2%E6%9F%93%E8%83%8C%E6%99%AF%E5%B1%82.png)
这是相同 MWE 的变体另一个问题:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{spy}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{tikzpicture}
[spy using outlines={circle, magnification=7, size=3cm, connect spies}]
\draw[->, very thick] (0,0) -- (5,0);
\path (2,2) node[fill, rectangle, inner sep=2pt, minimum height=1cm] (n) {};
\begin{scope}[on background layer]
\draw[dotted] (n.south west) -- (n.south west |- 0,0);
\draw[dotted] (n.south east) -- (n.south east |- 0,0);
\end{scope}
\spy on ($(n.south east |- 0,0)!0.5!(n.south west |- 0,0)$)
in node at (3,-2);
\end{tikzpicture}
\end{document}
这是输出:
如您所见,node 中的 spy 中缺少虚线。似乎spy
库忽略了背景层。
有没有办法让背景层的内容出现在节点中的间谍中?