# How to add arrow in circuit and change the direction of voltage source

Here is the code.

\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}

\usepackage[siunitx]{circuitikz} % circuit package and  include electrical units in our labels

\begin{document}

\begin{center}
\tikzstyle{arrow}=[draw, -latex]
\begin{circuitikz} [american voltages, american currents] \draw
(5,0) to [capacitor, a = $C_1$] (5,3) --
(2,3) to [inductor, a^ = L, mirror]  (-1,3) to [capacitor, a^ = $C_2$, name=C2] (-1, 1.8)
to [V, l = $\frac{V_{\pi}} {s}$]
(-1,0) -- (1,0) -- (3,0) -- (5,0)

(3.5,3) to  [R,  l = R] (3.5,0)

;

\end{circuitikz}
\end{center}

\end{document}


This is what I got from this code.

However, I want something like this below. I want add arrow in the circuit and change the direction of the voltage.

• Try [V, invert, l= $\frac{V_{\pi}} {s}$, i_>=$i$] Commented Dec 8, 2022 at 21:16
• @HasanBasriÇetin Is there a way to change the direction of curent.
– kile
Commented Dec 9, 2022 at 8:37

For the generator, just add invert to its options.

For the current, instead of a plain line (-1,0) -- (1,0) in the bottom wire, you can use (-1,0) to[short, i=$I(s)$] (1,0) to add a current arrow and its label...

\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}
\usepackage[siunitx]{circuitikz}

\begin{document}

\begin{center}
% notice that this style (which is in the old, deprecated format)
% will NOT affect circuitikz, where arrows are shapes (mostly)
% \tikzstyle{arrow}=[draw, -latex]
% the correct (modern) way is
\tikzset{arrow/.style={draw, -latex}}
%
\begin{circuitikz} [american voltages, american currents] \draw
(5,0) to [capacitor, a = $C_1$] (5,3) --
(2,3) to [inductor, a^ = L, mirror]  (-1,3) to [capacitor, a^ = $C_2$, name=C2] (-1, 1.8)
to [V, l = $\frac{V_{\pi}} {s}$, invert] % CHANGED: use "invert"
% CHANGED: use to[short...] to add currents (and flows, poles, etc.)
(-1,0) to[short, i=$I(s)$] (3,0) -- (5,0)
(3.5,3) to  [R,  l = R] (3.5,0)
;
\end{circuitikz}
\end{center}

\end{document}


If you want to change the current direction, you can use

to[short, i<=$I(s)$]


or the four combination of >, <, _, ^ to choose direction and label position, as explained in the manual under the section "Currents:"

In the case at hand, where the component is a short, the arrow is at the center of the path, so the first four and the last four options are basically equivalent.

• How can I change the direction of current? I think invert is not working.
– kile
Commented Dec 9, 2022 at 8:35
• @kile, edited (with a reference to the manual too, in the case you find it useful) Commented Dec 9, 2022 at 9:35

Try this code.

\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}

\usepackage[siunitx]{circuitikz} % circuit package and  include electrical units in our labels

\begin{document}

\begin{center}
\tikzstyle{arrow}=[draw, -latex]
\begin{circuitikz} [american voltages, american currents]
\draw(5,0) to [capacitor, a = $C_1$] (5,3) -- (2,3) to [inductor, a^ = L, mirror]  (-1,3) to [capacitor, a^ = $C_2$, name=C2] (-1, 1.8)
to [V, invert, l = $\frac{V_{\pi}} {s}$]
(-1,0) -- (1,0)  -- (3,0) -- (5,0)
(3.5,3) to  [R,  l = R] (3.5,0) ;
\draw[->] (-1,0)--(0.5,0);  % add an arrow inline
\end{circuitikz}
\end{center}
\end{document}