Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I looked at the documentation and examples on CTAN, but circuitikz is hard to get the hang of.

I am trying to create


Here is what I have so far:

\documentclass{convert = false]{standalone}
  \draw (-.5, 0) to[L, l = L] (1.4, 0)
           to[R, l = R] (5, 0);

but the spacing is weird, and I can't seem to figure out how to set it up.

share|improve this question
For some reason, your picture doesn't appear properly on the page. Am I the only one experiencing a problem? I uploaded a cropped version of it; now everything is fine. –  Jubobs Jan 18 '14 at 6:55

4 Answers 4

up vote 9 down vote accepted

I too find the circuitikz documentation a bit lacking, but you learn a lot from inspecting the examples. A quick [circuitikz] search on the site will lead you to more examples. Moreover, a few additional circuitikz examples are available at texample.net.

Regarding spacing, my main piece of advice (which applies to any vector-graphics package, really) is to parameterise everything at the beginnning; refrain from using "magic numbers". Your circuit will be far easier to adjust; moving things around will be a breeze. See below.

enter image description here

\documentclass[convert = false]{article}
    % left loop
    \draw                               (\xPortLeft,\yL)
            to[L=$L$, o-]               (\xL, \yL)
            to[R=$R$]                   (\xR, \yL)
            to[short]                   (\xC,\yL)
            to[C, l_=$C$,*-*]           (\xC,\yTerminalBottom)
            to[short,i=$i(t)$]          (\xPortLeft,\yTerminalBottom)
            to[open,v^>=$v_1(t)$,o-o]   (\xPortLeft,\yL);
    % right branch
    \draw                               (\xC,\yL)
            to[short]                   (\xPortRight,\yL)
            to[open,v^=$v_2(t)$,o-o]    (\xPortRight,\yTerminalBottom)
            to[short]                   (\xC,\yTerminalBottom);
share|improve this answer
Jubobs, I tried to use your commands in a \documentclass[paper=a4,fontsize=12pt,convert = false]{article}, but I have problems with this command to[open,v^>=$v_1(t)$,o-o], in specific with "^". Could you help me? If you need any information, you can ask me. –  xiuhays Aug 23 '14 at 0:50

This is how. Define (x,y) coordinate for each circuit node (2cm separation is fairly good in general), then use to[options] to connect all of the nodes, where options can be R, L, C, open (circuit), short (circuit), l(abel)=, v=, i=, for label/current/voltage name respectively. Variants such as v^, v_ and equivalents are designed to put labels on either side of circuit elements. As to the current loop for KVL, this solution uses amssymb package with node technique to achieve that. By default, currents are labeled on each branch as shown in the capacitor branch.

enter image description here


\documentclass[convert = false, border=10pt,]{standalone}
\draw (-.5, 2) to[L, l = $L$] (2, 2) to [R, l = $R$] (4, 2) to [short](6,2)
(4,2) to[C,l=$C$] (4,0)
(-0.5,2) to [open, v=$v_1(t)$,o-o](-0.5,0)
(6,2) to [open, v=$v_2(t)$,o-o] (6,0)   % use v^=$V_2$, if you want it on the right side.
(1.5,1) node[scale=3]{$\circlearrowright$}
(1.5,1) node{$i_1$};
share|improve this answer

If PSTricks is allowed, you can do the following:


% PSTricks.
\psset{unit = 0.8}

% Width and height of the diagram.
\def\width{12 }
\def\height{6 }

% Calculating width and height of picture.
  \cs_new_eq:NN \calc \fp_eval:n


% Drawing.
  % Coordinates for the ends of the wires.
    (0,0)(0,0)% Doubled to let the nodes start from P1 instead of P0.
    (!0.7 \width mul 0)%
    (!0.35 \width mul \height)%
    (!0.7  \width mul \height)
  % Wires and components.
  \wire[arrows = o-o](P1)(P3)
  \coil[arrows = o-](P4)(P5){$L$}
  \resistor[arrows = -o, dipolestyle = zigzag](P5)(P6){$R$}
  \wire[arrows = o-o](P6)(P7)
  \capacitor[arrows = *-*](P2)(P6){$C$}
  % Labels.
 {\psset{linestyle = none}
  % Direction of the current.
  \psBspline[arrows = ->]%
       (!0.7 \width mul 3   sub \height 1 sub)%
       (!0.7 \width mul 1.2 sub \height 1 sub)%
       (!0.7 \width mul 1.2 sub 1)%
       (!0.7 \width mul 3   sub 1)
  \rput(!0.7 \width mul 2.2 sub \height 2 div){$i(t)$}



Here, pst-circ is for drawing the electrical components, pst-bspline is for drawing the curved arrow, and pstricks-add is for setting the labels.

Width and height of the diagram can be chosen freely, and calculation of the corresponding width and height of the picture is automated.

Note: The advantage of using Herbert Voß' package pst-circ for a drawing like this is that all the macros are (more or less) self-explanatory, so the code is really easy to edit if needed. Also, the documentation has a lot of examples.

share|improve this answer
+1 for PSTricks. I believe that your code can still be simplified. I am doing it... –  stalking isn't tolerated Jan 18 '14 at 7:21
+1 Pretty nice. –  Jubobs Jan 18 '14 at 7:41

Just another solution with PSTricks.


enter image description here


    % \the following tensions don't work temporarily
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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