如何增加合适盒子中节点周围的填充?

如何增加合适盒子中节点周围的填充?

我有代码:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{verbatim}
\usepackage{textcomp}
\usetikzlibrary{shapes,arrows,fit}
\begin{document}

\tikzset{
  sum/.style      = {draw, circle, node distance = 2cm, minimum size=.9cm}, % Adder
}

\newcommand{\suma}{\Large$+$}

\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
\draw
    node at (1,-3) [sum] (C) {\large$C$}
    node [sum, right of=C] (theta) {\large$\theta$}
    ;
    \draw[->](C) -- node {} (theta);

    \node[draw,fit=(C) (theta)] {$N_d$};

\end{tikzpicture}
\end{document}

我的主要问题是如何增加节点 C 和 theta 周围的框的填充。作为奖励,我想将标签 $N_d$ 移动到框的右下角。

答案1

周围节点的键inner sep可能就是您想要的。要移动标签,最简单的方法是创建一个新节点,并相对于周围节点放置。

在此处输入图片描述

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{shapes,arrows,fit}
\begin{document}

\tikzset{
  sum/.style      = {draw, circle, node distance = 2cm, minimum size=.9cm}, % Adder
}

\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
\node at (1,-3) [sum] (C) {\large$C$};
\node [sum, right of=C] (theta) {\large$\theta$};

\draw[->](C) -- node {} (theta);

\node[inner sep=10pt,draw,fit=(C) (theta)] (box) {};
\node[above left] at (box.south east) {$N_d$};

\end{tikzpicture}
\end{document}

相关内容