The circuitikz package
Draws electrical circuits: components such as R, C, L and V are placed on a path with to[...] inside a circuitikz environment.
Loading the package
\usepackage{circuitikz}The package adds circuit symbols to tikz and loads it. A circuit is a \draw path through coordinates. Between two coordinates, to[R] puts a resistor in the middle of the connection and draws the wire on both sides; -- is a plain wire.
The keys l=, v= and i= add a label, a voltage and a current to a component. Components with more than two terminals, such as an operational amplifier or the ground symbol, are nodes: node[op amp] {}.
Main commands
\begin{circuitikz} ... \end{circuitikz} | The drawing; accepts the same options as tikzpicture. |
to[R, l=$R_1$] | Resistor with a label. C is a capacitor, L an inductor, D a diode. |
to[V, v=$U_0$] | Voltage source with its voltage; battery1 draws a battery cell. |
to[short, i=$I$] | Wire with a current arrow. |
to[C, *-*] | Component with a connection dot at both ends. |
node[ground] {} | Ground symbol at the current position. |
\usepackage[european]{circuitikz} | Draws resistors as rectangles; american draws them as zigzag lines and marks voltages with + and −. |
Complete example
\documentclass{article}
\usepackage[european]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to[V, v=$U_0$] (0,3)
to[R, l=$R_1$, i=$I$] (4,3)
to[C, l=$C$, *-*] (4,0)
-- (0,0);
\draw (4,3) -- (6,3)
to[L, l=$L$] (6,0)
-- (4,0);
\draw (0,0) node[ground] {};
\end{circuitikz}
\end{document}Compiled with pdfLaTeX from TeX Live 2023.
Pitfalls
- Without a style option, resistors are zigzag lines and voltages are drawn as arrows. Choose
europeanoramericanin\usepackageto get one consistent set of symbols. - With the option
siunitx, a value with a unit can be written in angle brackets:to[R, l=1<\kilo\ohm>].
Related pages
- Package
tikz - Package
siunitx - How-to Draw with TikZ in LaTeX
- How-to Draw a graph with nodes and edges in LaTeX