2

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)?

3
  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

  • Thanks. How do I retain the +/- signs on $v_{C}$ and offset this label leftwards, so that it does not run into the circuit as it is in my original question? – user2751530 Sep 2 '15 at 18:44
  • @user2751530 Which + - signs? I don't see them. – Gonzalo Medina Sep 2 '15 at 18:51
  • In my posted image. They are smashed into the wire (the -'s). – user2751530 Sep 2 '15 at 18:52
  • @user2751530 Please see my updated answer. I'm still confused about the + and - signs. – Gonzalo Medina Sep 2 '15 at 18:52
  • @user2751530 How come they appear in your image but not in mine? Do you have any special setting for the components? – Gonzalo Medina Sep 2 '15 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.