Circuitikz is a powerful LaTeX package used by Electrical Engineers to create professional, publication-quality circuit diagrams. Unlike drag-and-drop tools, Circuitikz uses code to define components, ensuring perfect alignment and standard symbols.
Every circuit drawing requires a specific setup in the LaTeX preamble.
\documentclass{article}
\usepackage{circuitikz} % Essential package for circuits
\begin{document}
\begin{circuitikz}
% Drawing commands go here
\end{circuitikz}
\end{document}
\draw CommandThe fundamental command to place components is \draw. It works on a Cartesian coordinate system (x, y).
Syntax:
\draw (starting_point) to[component_type, label] (ending_point);
Example:
\draw (0,0) to[R, l=$R_1$] (3,0);
Key Rules:
(x,y). E.g., (0,0).[...]. E.g., [R] for Resistor.;.Horizontal Label (Above the Component):
\draw (0,0) to[R, l=$R_1$] (3,0);
$R_1$ → LaTeX math notation for subscriptHorizontal Label (Below the Component):
\draw (0,0) to[R, l_=$R_1$] (3,0);
l_ → Below the Component| Component | Syntax |
|---|---|
| Resistor | to[R] |
| Capacitor | to[C] |
| Inductor | to[L] |
| Voltage source | to[V] |
| Current source | to[I] |
| Wire | to[short] |
When drawing components in series, there are two valid approaches in circuitikz.
Both work, but one is recommended.
🔹 Method 1:
\begin{circuitikz}
\draw (0,0) to[R, l=$R_1$] (3,0);
\draw (3,0) to[R, l=$R_2$] (6,0);
\end{circuitikz}
🔹 Method 2- Chaining: (Recommended)
\begin{circuitikz}
\draw (0,0) to[R, l=$R_1$] (3,0)
to[R, l=$R_2$] (6,0);
\end{circuitikz}
Example:
Three Resistors in Series (Chaining Method)
\begin{circuitikz}
\draw (0,0) to[R, l=$R_1$] (3,0)
to[R, l=$R_2$] (6,0)
to[R, l=$R_3$] (9,0);
\end{circuitikz}
; appears only once, at the end