假设我想将某些节点聚集在一个框中,不过我也想让节点文本被装箱。
以下 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}