LC circuit with circuitikz

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

• Can you demonstrate what you want to draw visually? There might be others like me that are familiar with latex but not LC circuit concepts. Jun 5, 2020 at 20:07
• I've added a picture, hope it is clearer now :) Jun 5, 2020 at 20:36
• Jun 6, 2020 at 2:08
• @LorenzoBenedetti did the answer below meet your requirement Jun 13, 2020 at 15:57
• @jsbibra yep, it did Jun 14, 2020 at 16:08

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}


• I stil need the electrical current, how to add it? thank you Jun 5, 2020 at 22:26
– user31034
Jun 5, 2020 at 23:08

@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

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


\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)$)
;


\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)$)
;