我想增加节点周围的空间以便能够显示文本内容。在下面的示例中,我希望文本“Channel 1”在节点上方可见oscopeshape
。我尝试使用 nodifiying 节点属性,但outer sep
没有成功。
在此先感谢您的帮助 !
\documentclass[border=2pt,convert={density=600,outext=.png}]{standalone}
\usepackage[siunitx,RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[american]
\draw(0,0) to[sV,l=$v(t)$] ++(0,3) to[R,l=$R$] ++(4,0) to[C,l=$C$] ++(0,-3) --(0,0);
\ctikzset{bipoles/oscope/width=1.4}
\ctikzset{bipoles/oscope/height=1.0}
\node[oscopeshape, fill=green!10, anchor=south, outer sep=20pt](O1) at (4,4) {$\text{Channel 1}$};
\node[bnc, xscale=-1, anchor=zero](bnc11) at (O1.in 1) {};
\node[bnc, anchor=zero, rotate=-90](bnc12) at (O1.in 2){};
\end{circuitikz}
\end{document}
答案1
使用border={2pt 2pt 2pt 12pt}
:
\documentclass[border={2pt 2pt 2pt 12pt},convert={density=600,outext=.png}]{standalone}
\usepackage[siunitx,RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[american]
\draw(0,0) to[sV,l=$v(t)$] ++(0,3) to[R,l=$R$] ++(4,0) to[C,l=$C$] ++(0,-3) --(0,0);
\ctikzset{bipoles/oscope/width=1.4}
\ctikzset{bipoles/oscope/height=1.0}
\node[oscopeshape, fill=green!10, anchor=south, outer sep=20pt](O1) at (4,4) {$\text{Channel 1}$};
\node[bnc, xscale=-1, anchor=zero](bnc11) at (O1.in 1) {};
\node[bnc, anchor=zero, rotate=-90](bnc12) at (O1.in 2){};
\end{circuitikz}
\end{document}
答案2
编辑:根据要求,我取消删除了我的解决方案,这有点像作弊,但有了它你就不必担心边距了。
那样的东西适合你吗?
\documentclass[border=2pt,convert={density=600,outext=.png}]{standalone}
\usepackage[siunitx,RPvoltages]{circuitikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{circuitikz}[american]
\draw(0,0) to[sV,l=$v(t)$] ++(0,3) to[R,l=$R$] ++(4,0) to[C,l=$C$] ++(0,-3) --(0,0);
\ctikzset{bipoles/oscope/width=1.4}
\ctikzset{bipoles/oscope/height=1.0}
\node[oscopeshape, fill=green!10](O1) at (4,4) {};
\node[above =2pt of O1] {Channel 1};
\node[bnc, xscale=-1, anchor=zero](bnc11) at (O1.in 1) {};
\node[bnc, anchor=zero, rotate=-90](bnc12) at (O1.in 2){};
\end{circuitikz}
\end{document}