假設我想將某些節點聚集在一個盒子中,但是我也希望節點文字被裝箱。
以下 MWE 將節點放置在方塊中,但下方(或左/上/右)放置的文字則不然。
如何封裝與節點相關的所有內容?
微量元素:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes}
\usetikzlibrary{arrows}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}[>=stealth',semithick,auto]
\tikzstyle{surround} = [fill=blue!10,thick,draw=black,rounded corners=2mm]
\tikzstyle{obj} = [circle, minimum width=10pt, draw, inner sep=0pt]
\node[obj,label=below:Outside] (id1) at (2,2) {};
\begin{pgfonlayer}{background}
\node[surround] (background) [fit = (id1)] {};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}