我已经像这样连接了矩形:
\usetikzlibrary{fit, positioning}
\begin{tikzpicture}[]
\node [rectangle, draw, text width=4em, fill=white] (b) {B};
\node [rectangle, draw, text width=4em, right=of b, fill=white] (a) {A};
\node [rectangle, draw, fit=(b) (a), fill=orange, fill opacity=0.1] (local) {};
\end{tikzpicture}
上述操作的结果是这样的:
我的问题是我不想让内框 A 和 B 具有橙色背景(即它们不应该有颜色...)。请问我该如何解决这个问题?(对 Tikz 还是新手!)
答案1
评论太长了。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\usetikzlibrary{fit, positioning,backgrounds}
\begin{tikzpicture}[]
\node [rectangle, draw,text width=4em,fill=white] (b) {B};
\node [rectangle, draw,text width=4em, right=of b,fill=white] (a) {A};
\begin{scope}[on background layer]
\node [rectangle, draw, fit=(b) (a),fill=orange,fill opacity=0.1] (local) {};
\end{scope}
\end{tikzpicture}
\end{document}