[Tex/LaTex] Label offsetting with multiple labels in Circuitikz

circuitikz

I have written the following code to draw the diagram of an RLC circuit:

\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}

I get the following result:

RLC Circuit with clashing labels - on the capacitor, and also G.

My settings are:

\usepackage[siunitx,americanvoltages,americancurrents,americanports,cuteinductors,fulldiodes,arrowmos,smartlabels]{circuitikz}

How do I fix it (offset the voltage label leftwards and center offset the G label)?

Best Answer

  1. For the "G" placement, you can use the label key.
  2. For the C component labels, mirror seems to mess label positioning, so you can use some xscale and manual shifting (first and two diagrams below), or to use yscale=-1 (third diagram below).

The code:

\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}

enter image description here