![为什么我的 tikz 文本出现在图像后面?](https://linux22.com/image/427004/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E7%9A%84%20tikz%20%E6%96%87%E6%9C%AC%E5%87%BA%E7%8E%B0%E5%9C%A8%E5%9B%BE%E5%83%8F%E5%90%8E%E9%9D%A2%EF%BC%9F.png)
如何将文本置于图像的前面?下面的代码将其置于图像后面。我告诉 tikz 节点在前面,但它仍然在后面?
\begin{figure}
\centering
\begin{tikzpicture}
\node[draw,front] at (0,0) {some text};
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.8\columnwidth,trim={0 3cm 0 0},clip]{figures/intro/intro1.png}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw[fill=white, ultra thick, rounded corners] (0.5,0.2) rectangle (0.9,0.05);
\end{scope}
\end{tikzpicture}
\end{figure}
答案1
切换语句的顺序,以便最后设置文本;项目在代码中按顺序绘制:
\documentclass{article}
\usepackage{graphicx,tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.8\columnwidth,trim={0 3cm 0 0},clip]{example-image}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw[fill=white, ultra thick, rounded corners] (0.5,0.2) rectangle (0.9,0.05);
\end{scope}
\node[draw] at (0,0) {some text};
\end{tikzpicture}
\end{figure}
\end{document}