我编写了以下代码来绘制 RLC 电路图:
\begin{tikzpicture}\draw
(0,2) node[anchor=east] {1} to [short,*-] (0,2)
to[R,R=$R$] (4,2) node[anchor=west] {2} to [short,*-] (4,2)
to[L,L=$L$,i>=$i_{L}$] (4,0)
to[short,-*] (2,0) node[rground] {G} to [short] (0,0)
(0,0) to[C,C=$C$,mirror,v=$v_{C}$] (0,2)
;\end{tikzpicture}
我得到以下结果:
我的设置是:
\usepackage[siunitx,americanvoltages,americancurrents,americanports,cuteinductors,fulldiodes,arrowmos,smartlabels]{circuitikz}
我该如何修复它(将电压标签向左偏移并将 G 标签居中偏移)?
答案1
- 对于“G”位置,您可以使用键
label
。 - 对于 C 组件标签,
mirror
似乎标签定位混乱,因此您可以使用一些xscale
手动移位(下面的第一张和第二张图),或者使用yscale=-1
(下面的第三张图)。
代码:
\documentclass{article}
\usepackage[siunitx,americanvoltages,americancurrents,americanports,cuteinductors,fulldiodes,arrowmos,smartlabels]{circuitikz}
\begin{document}
\begin{tikzpicture}
\draw
(0,2) node[anchor=east] {1} to [short,*-] (0,2)
to[R,R=$R$] (4,2) node[anchor=west] {2} to [short,*-] (4,2)
to[L,L=$L$,i>=$i_{L}$] (4,0)
to[short,-*] (2,0) node[rground,label=$G$] {} to [short] (0,0)
(0,0) to[C,C=$C$,xscale=3,mirror,v={$\hspace*{-12pt}v_{C}$}] (0,2)
;\end{tikzpicture}
\begin{tikzpicture}
\draw
(0,2) node[anchor=east] {1} to [short,*-] (0,2)
to[R,R=$R$] (4,2) node[anchor=west] {2} to [short,*-] (4,2)
to[L,L=$L$,i>=$i_{L}$] (4,0)
to[short,-*] (2,0) node[rground,label={120:$G$}] {} to [short] (0,0)
(0,0) to[C,C=$C$,xscale=3,mirror,v={$\hspace*{-12pt}v_{C}$}] (0,2)
;\end{tikzpicture}
\begin{tikzpicture}
\draw
(0,2) node[anchor=east] {1} to [short,*-] (0,2)
to[R,R=$R$] (4,2) node[anchor=west] {2} to [short,*-] (4,2)
to[L,L=$L$,i>=$i_{L}$] (4,0)
to[short,-*] (2,0) node[rground,label={120:$G$}] {} to [short] (0,0)
(0,0) to[C,C=$C$,v={$v_{C}$},yscale=-1] (0,-2);
\end{tikzpicture}
\end{document}