这很完美,只是我希望当前符号和标签位于通用元素的顶部/底部或左侧/右侧,而不是之前或之后(我目前以此结束 p)。有没有简单的方法可以实现这一点?我的代码是:
\documentclass{article}
\usepackage[siunitx]{circuitikz}
\tikzset{
generic/.append style={color=cyan},
cute inductor/.append style={color=cyan},
I/.append style={color=red},
V/.append style={color=red},
}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}[american,scale=.8]
\ctikzset{resistors/scale=0.8, sources/scale=.8}
\draw (0,0)
to [V, l=9<\volt>,invert] ++(0,3)
to [generic, f<=$ i_1 $] ++(3,0)
to [short] ++(3,0)
to [I,l=0.5<\ampere>,invert] ++(3,0)
to [generic,f>=$ i_4 $] ++(0,-3)
to (0,0)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(3,3) to [generic,v<=$ v_2 $,*-*] ++(0,-3)
(6,3) to [generic,v>=$ v_3 $,*-*] ++(0,-3)
;
\end{circuitikz}
\caption{PSC 1}
\end{figure}
\end{document}
答案1
该解决方案不是尝试改变 circuitikz 定位当前箭头的方式(已经做过,不好玩),而是覆盖open
组件的当前箭头,并进行一些调整以纠正偏移量。
\documentclass{standalone}
\usepackage[siunitx]{circuitikz}
\tikzset{
generic/.append style={color=cyan},
cute inductor/.append style={color=cyan},
I/.append style={color=red},
V/.append style={color=red},
}
\begin{document}
\begin{circuitikz}[american,scale=.8]
\ctikzset{resistors/scale=0.8, sources/scale=.8}
\draw (0,0)
to [V, l=9<\volt>,invert] ++(0,3)
to [generic, name=A] ++(3,0)
to [short] ++(3,0)
to [I,l=0.5<\ampere>,invert] ++(3,0)
to [generic,name=B] ++(0,-3)
to (0,0)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(3,3) to [generic,v<=$ v_2 $,*-*] ++(0,-3)
(6,3) to [generic,v>=$ v_3 $,*-*] ++(0,-3)
;
\draw ($(A.west)+(-0.4cm,4pt)$) to[open, f=$ i_1 $] ($(A.east)+(-0.4cm,4pt)$)
($(B.west)+(4pt,0.4cm)$) to[open, f=$ i_4 $] ($(B.east)+(4pt,0.4cm)$);
\end{circuitikz}
\end{document}