2

This is the circuit. Sorry for the low quality, but that's my mobileI have to draw a LC circuit, with inductor of inductance L and capacitor of capacitance C. I'de like to add the current flow (say clockwise) and a + near one of the surfaces and a - near the other one.

This is what I've come up with, but it lacks of some details I'd like to have instead.

\begin{circuitikz} \draw
(0,0) -- (3,0)
(0,3) -- (3,3)
(0,0) to[L] (0,3)
(3,0) to[C] (3,3)
;
\end{circuitikz}

Can you draw it for me using circuitikz, please?

5

2 Answers 2

4

Like this?

\documentclass[margin=3mm]{standalone}
\usepackage[oldvoltagedirection]{circuitikz}

\begin{document}
\begin{circuitikz}
\draw
(0,0) -- (3,0)
(0,3) -- (3,3)
(0,0) to[L, l^=$L$] (0,3)
(3,0) to[C, l^=$C$,name=c] (3,3)
;
\node at (c.300)[above]{$+$};
\node at (c.60)[above]{$+$};
\node at (c.120)[below]{$-$};
\node at (c.240)[below]{$-$};
\draw [-latex](1,-0.25)--(2,-0.25)node[midway,below]{$i$};
\draw [latex-](1,3.25)--(2,3.25)node[midway,above]{$i$};
\end{circuitikz}
\end{document}

enter image description here

2
  • I stil need the electrical current, how to add it? thank you
    – Benny
    Jun 5, 2020 at 22:26
  • Your welcome. I have edited my answer.
    – user31034
    Jun 5, 2020 at 23:08
1

@Lorenzo wanted a clockwise current so-- three options -- --with an arrow on the circuit -- with dashed arrow loop inside the circuit --with continuous arrow loop inside the circuit

enter image description here

enter image description here

enter image description here

Fill up the basic package

\documentclass[margin=2mm,tikz]{standalone}
\usepackage[american]{circuitikz}
\usetikzlibrary{backgrounds,calc,positioning}
\begin{document}

    \begin{tikzpicture}[x=3cm,y=3cm]

    \end{tikzpicture}
\end{document}
% I use a tikzpicture instead of a circuitikz here because
% the standalone package does weird things with the paper
% size when using a circuitikz environment. Feel free to
% change this in your document.
% We choose a base length of 3cm to simplify our coordinate
% calculations. Adjust as needed. Default is 1cm by the way.

Next step --
Define all coordinates. Not strictly necessary, but it makes for cleaner code, in my humble opinion.

\coordinate[label=A1]       (A1)  at (1,0);
\coordinate[label=B1]       (B1)  at (2,0);
\coordinate[label=C1]       (D1)  at (1,-1);
\coordinate[label=D1]       (C1) at (2,-1);

Next -- Draw part of the circuit. You might need more than one draw command, depending on how you do things.

\draw   (A1) 
to      (B1)
to [C, name=c, l_=$C_{1}$]        (C1)
to      (D1)
to [L,l_=$L_1$,color=magenta]     (A1);

Next -- Some additional labelling...

\node at (c.north west)[yshift=4pt,  xshift=-6pt] {$+$};
\node at (c.north east)[yshift=-4pt, xshift=-6pt] {$-$};

Next -- Helper lines-- Remove the 'dashed' parameter for a normal line. This part uses the 'calc' library from TikZ for coordinate calculations.

NOTE: The corner radius has to be adjusted manually if you adjust the base x and y lengths in the optional argument for the tikzpicture/circuitikz environment.

\draw[red,rounded corners=0.2cm,-latex]
   ($(A1) + (0.175,-0.5)$) 
-- ($(A1) + (0.175,-0.1)$) 
-- ($(B1) - (0.175, 0.1)$)
-- ($(C1) + (-0.175, 0.1)$)
-- ($(D1) + (0.175, 0.1)$)
;

Some additional labeling--

\node at ($(D1) + (0.4, 0.15)$) {$i$};

Complete--

\documentclass[margin=2mm,tikz]{standalone}
\usepackage[american]{circuitikz}
\usetikzlibrary{backgrounds,calc,positioning}
\begin{document}

    \begin{tikzpicture}[x=3cm,y=3cm]
    \coordinate[label=A1]       (A1)  at (1,0);
    \coordinate[label=B1]       (B1)  at (2,0);
    \coordinate[label=C1]       (D1)  at (1,-1);
    \coordinate[label=D1]       (C1) at (2,-1);

    \draw 
    (A1) 
    to (B1)
    to [C, name=c, l_=$C_{1}$]        (C1)
    to (D1)
    to [L,l_=$L_1$,color=magenta]     (A1);


    \node at (c.north west)[yshift=4pt, xshift=-6pt] {$+$};
    \node at (c.north east)[yshift=-4pt, xshift=-6pt] {$-$};

    \draw[red,rounded corners=0.2cm,-latex]
       ($(A1) + ( 0.175,-0.5  )$) 
    -- ($(A1) + ( 0.175,-0.1)$) 
    -- ($(B1) - ( 0.175, 0.1)$)
    -- ($(C1) + (-0.175, 0.1)$)
    -- ($(D1) + (0.175, 0.1)$)
    ;
    \node at ($(D1) + (0.4, 0.15)$) {$i$};
    \end{tikzpicture}
\end{document}

For dashed lines -- replace with

\draw[red,dashed, thick,rounded corners=0.2cm,-latex]
    ($(A1) + ( 0.175,-0.5  )$) 
-- ($(A1) + ( 0.175,-0.1)$) 
-- ($(B1) - ( 0.175, 0.1)$)
-- ($(C1) + (-0.175, 0.1)$)
-- ($(D1) + (0.175, 0.1)$)
;

For continuous lines instead of dashed lines replace with --

\draw[red,rounded corners=0.2cm,-latex]
    ($(A1) + ( 0.175,-0.5  )$) 
-- ($(A1) + ( 0.175,-0.1)$) 
-- ($(B1) - ( 0.175, 0.1)$)
-- ($(C1) + (-0.175, 0.1)$)
-- ($(D1) + (0.175, 0.1)$)
;

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.