Intermediate 30 min read

Circuit Diagrams in LaTeX with Circuitikz

Master the art of creating professional electrical circuits, electronic schematics, and logic diagrams directly in LaTeX using Circuitikz. This comprehensive guide covers resistors, capacitors, transistors, operational amplifiers, digital logic gates, and advanced circuit drawing techniques with 40+ practical examples.

Introduction to Circuitikz

Circuitikz is a powerful LaTeX package built on top of TikZ/PGF that provides an extensive library of electrical and electronic components for drawing professional circuit diagrams. It's the industry standard for creating publication-quality schematics in academic papers, technical documentation, and educational materials.

Why Use Circuitikz for Circuit Diagrams?

Circuitikz offers professional quality, extensive component libraries (200+ components), consistent styling, precise positioning, mathematical integration, and produces scalable vector graphics. It's used by IEEE publications, academic journals, and engineering textbooks worldwide.

What You Can Create with Circuitikz

Setup and Installation

Circuitikz requires the TikZ package and comes with most modern LaTeX distributions. To use it, add the package to your preamble:

Basic Circuitikz Setup
\documentclass{article}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz}
  % Your circuit diagram here
\end{circuitikz}

\end{document}

Package Options

Circuitikz supports various options for different drawing styles:

Circuitikz Options
% American style (default)
\usepackage[american]{circuitikz}

% European style
\usepackage[european]{circuitikz}

% Voltage labels
\usepackage[american voltages]{circuitikz}
\usepackage[european voltages]{circuitikz}

% Current arrows
\usepackage[american currents]{circuitikz}
\usepackage[european currents]{circuitikz}

% Resistor style
\usepackage[american resistors]{circuitikz}  % Zigzag
\usepackage[european resistors]{circuitikz}  % Rectangle
Style Option American European
Resistor Zigzag line Rectangle
Voltage Source + and - signs Arrow notation
Current Direction Arrow with label Arrow direction convention
Inductor Coiled line (American) Filled rectangles (European)

Basic Circuit Components

Circuitikz uses a simple syntax: \draw (start) to[component] (end). Components are placed between nodes using the to[component] syntax.

Resistors and Capacitors

Resistors and Capacitors
\begin{circuitikz}
  % Resistor (American zigzag style)
  \draw (0,4) to[R, l=$R_1$] (2,4);
  
  % European resistor (rectangle)
  \draw (3,4) to[european resistor, l=$R_2$] (5,4);
  
  % Variable resistor
  \draw (0,3) to[vR, l=$R_{var}$] (2,3);
  
  % Capacitor
  \draw (3,3) to[C, l=$C_1$] (5,3);
  
  % Polarized capacitor (electrolytic)
  \draw (0,2) to[pC, l=$C_2$] (2,2);
  
  % Variable capacitor
  \draw (3,2) to[vC, l=$C_{var}$] (5,2);
  
  % Potentiometer
  \draw (0,1) to[pR, l=POT] (2,1);
  
  % Resistor with specified value
  \draw (3,1) to[R, l=$100\,\Omega$] (5,1);
\end{circuitikz}

Voltage and Current Sources

Sources
\begin{circuitikz}
  % DC voltage source
  \draw (0,4) to[V, v=$V_s$] (0,2);
  
  % Battery
  \draw (2,4) to[battery, l=$9V$] (2,2);
  
  % AC voltage source
  \draw (4,4) to[sV, l=$V_{AC}$] (4,2);
  
  % Current source
  \draw (6,4) to[I, i=$I_s$] (6,2);
  
  % Controlled voltage source
  \draw (8,4) to[cV, l=$V_c$] (8,2);
  
  % Controlled current source
  \draw (10,4) to[cI, l=$I_c$] (10,2);
\end{circuitikz}

Inductors and Diodes

Inductors and Diodes
\begin{circuitikz}
  % Inductor
  \draw (0,4) to[L, l=$L_1$] (2,4);
  
  % Variable inductor
  \draw (3,4) to[vL, l=$L_{var}$] (5,4);
  
  % Diode
  \draw (0,3) to[D, l=$D_1$] (2,3);
  
  % LED
  \draw (3,3) to[leDo, l=LED] (5,3);
  
  % Zener diode
  \draw (0,2) to[zD, l=$D_Z$] (2,2);
  
  % Schottky diode
  \draw (3,2) to[sD, l=$D_S$] (5,2);
  
  % Photodiode
  \draw (0,1) to[pD, l=PD] (2,1);
  
  % Tunnel diode
  \draw (3,1) to[tD, l=$D_T$] (5,1);
\end{circuitikz}

Connecting Components

Creating complete circuits requires understanding how to connect components and create nodes.

Simple Series Circuit

Series RC Circuit
\begin{circuitikz}
  \draw (0,0) 
    to[V, v=$V_s$] (0,3)
    to[R, l=$R$] (3,3)
    to[C, l=$C$] (3,0)
    -- (0,0);
\end{circuitikz}

Parallel Circuit

Parallel Resistors
\begin{circuitikz}
  % Draw the voltage source and main path
  \draw (0,0) to[V, v=$12V$] (0,4) -- (2,4);
  
  % First resistor branch
  \draw (2,4) to[R, l=$R_1$] (2,2) to[R, l=$R_2$] (2,0);
  
  % Second resistor branch
  \draw (2,4) -- (4,4) to[R, l=$R_3$] (4,0) -- (2,0);
  
  % Complete the circuit
  \draw (2,0) -- (0,0);
\end{circuitikz}

Using Nodes for Complex Circuits

Node-Based Circuit
\begin{circuitikz}
  % Define nodes
  \node[label=left:A] (A) at (0,0) {};
  \node[label=right:B] (B) at (4,0) {};
  \node[label=above:C] (C) at (2,2) {};
  
  % Connect components between nodes
  \draw (A) to[R, l=$R_1$] (C);
  \draw (C) to[R, l=$R_2$] (B);
  \draw (A) to[R, l=$R_3$] (B);
  
  % Add voltage source
  \draw (A) to[V, v=$V_s$] ++(0,-2) -| (B);
\end{circuitikz}

Junction Dots

Circuit Junctions
\begin{circuitikz}
  \draw (0,0) to[V] (0,2) -- (2,2);
  \draw (2,2) to[R] (4,2);
  
  % Add junction dot
  \draw (2,2) node[circ]{} to[C] (2,0) -- (0,0);
  
  % Multiple junctions
  \draw (4,2) node[circ]{} -- (4,0) -- (0,0);
  \draw (4,2) to[R] (6,2);
\end{circuitikz}

Labels and Component Values

Proper labeling is essential for readable circuit diagrams. Circuitikz provides flexible labeling options.

Component Labels

Labeling Options
\begin{circuitikz}
  % Label above component
  \draw (0,3) to[R, l=$R_1$] (2,3);
  
  % Label below component
  \draw (0,2) to[R, l_=$R_2$] (2,2);
  
  % Label with value
  \draw (0,1) to[R, l=$100\,k\Omega$] (2,1);
  
  % Multiple labels (name and value)
  \draw (0,0) to[R, l=$R_3$, l_=$47\,\Omega$] (2,0);
\end{circuitikz}

Voltage and Current Annotations

Voltage and Current Labels
\begin{circuitikz}
  % Voltage annotation
  \draw (0,3) to[R, v=$V_R$] (3,3);
  
  % Voltage below
  \draw (0,2) to[R, v_=$V_R$] (3,2);
  
  % Current annotation
  \draw (0,1) to[R, i=$I_R$] (3,1);
  
  % Both voltage and current
  \draw (0,0) to[R, v=$V_R$, i=$I_R$] (3,0);
  
  % Reversed voltage polarity
  \draw (4,3) to[R, v^=$V_R$] (7,3);
  
  % Complex annotation
  \draw (4,0) to[R, l=$R_1$, v=$V_1$, i>^=$I_1$] (7,0);
\end{circuitikz}

Node Labels

Node Voltage Labels
\begin{circuitikz}
  \draw (0,0) to[V, v=$V_s$] (0,3) 
    to[R] (3,3) node[label={[font=\footnotesize]above:$V_{out}$}] {}
    to[C] (3,0) -- (0,0);
  
  % Ground symbol
  \draw (3,0) node[ground]{};
  
  % Reference ground
  \draw (1.5,0) node[rground]{};
\end{circuitikz}

Transistors and Semiconductors

Circuitikz includes comprehensive support for bipolar and field-effect transistors.

Bipolar Junction Transistors (BJT)

BJT Transistors
\begin{circuitikz}
  % NPN transistor
  \draw (0,0) node[npn](Q1){$Q_1$};
  \draw (Q1.base) -- ++(-1,0) to[R, l=$R_B$] ++(-1,0);
  \draw (Q1.collector) -- ++(0,1) to[R, l=$R_C$] ++(0,1) 
    node[vcc]{$V_{CC}$};
  \draw (Q1.emitter) -- ++(0,-1) node[ground]{};
  
  % PNP transistor
  \draw (4,0) node[pnp](Q2){$Q_2$};
  \draw (Q2.base) -- ++(-1,0);
  \draw (Q2.collector) -- ++(0,-1) node[ground]{};
  \draw (Q2.emitter) -- ++(0,1) node[vcc]{$V_{CC}$};
\end{circuitikz}

Field-Effect Transistors (FET)

MOSFET Transistors
\begin{circuitikz}
  % N-channel MOSFET
  \draw (0,0) node[nmos](M1){$M_1$};
  \draw (M1.gate) -- ++(-1,0) node[left]{Gate};
  \draw (M1.drain) -- ++(0,1) node[above]{Drain};
  \draw (M1.source) -- ++(0,-1) node[below]{Source};
  
  % P-channel MOSFET
  \draw (4,0) node[pmos](M2){$M_2$};
  \draw (M2.gate) -- ++(-1,0);
  \draw (M2.drain) -- ++(0,-1);
  \draw (M2.source) -- ++(0,1);
  
  % JFET
  \draw (8,0) node[njfet](J1){$J_1$};
  \draw (J1.gate) -- ++(-1,0);
  \draw (J1.drain) -- ++(0,1);
  \draw (J1.source) -- ++(0,-1);
\end{circuitikz}

Common Emitter Amplifier

Complete Amplifier Circuit
\begin{circuitikz}[scale=1.2]
  % Draw transistor
  \draw (3,2) node[npn](Q){$Q_1$};
  
  % Base bias network
  \draw (0,4) node[vcc]{$V_{CC}$} 
    to[R, l=$R_1$] (0,2) 
    to[R, l=$R_2$] (0,0) node[ground]{};
  \draw (0,2) -- (Q.base);
  
  % Input coupling
  \draw (-2,2) node[left]{$V_{in}$} 
    to[C, l=$C_1$] (Q.base);
  
  % Collector resistor
  \draw (Q.collector) to[R, l=$R_C$] (3,4) 
    node[vcc]{$V_{CC}$};
  
  % Output coupling
  \draw (Q.collector) to[C, l=$C_2$] (5,3.5) 
    node[right]{$V_{out}$};
  
  % Emitter resistor and bypass
  \draw (Q.emitter) to[R, l=$R_E$] (3,0) node[ground]{};
  \draw (3,0.5) to[C, l_=$C_E$] (4.5,0.5) |- (3,0);
\end{circuitikz}

Operational Amplifiers

Op-amps are fundamental building blocks in analog circuit design. Circuitikz makes drawing op-amp circuits straightforward.

Basic Op-Amp Symbol

Op-Amp Component
\begin{circuitikz}
  % Basic op-amp
  \draw (0,0) node[op amp](opamp){};
  \draw (opamp.+) -- ++(-1,0) node[left]{$V_+$};
  \draw (opamp.-) -- ++(-1,0) node[left]{$V_-$};
  \draw (opamp.out) -- ++(1,0) node[right]{$V_{out}$};
  
  % Op-amp with power supply
  \draw (5,0) node[op amp, noinv input up](opamp2){};
  \draw (opamp2.up) -- ++(0,0.5) node[vcc]{$V_{CC}$};
  \draw (opamp2.down) -- ++(0,-0.5) node[ground]{};
\end{circuitikz}

Inverting Amplifier

Inverting Configuration
\begin{circuitikz}
  % Op-amp
  \draw (3,0) node[op amp](opamp){};
  
  % Input resistor
  \draw (0,0.5) node[left]{$V_{in}$} 
    to[R, l=$R_1$] (opamp.-);
  
  % Feedback resistor
  \draw (opamp.-) -- ++(0,1.5) coordinate(fbstart)
    to[R, l=$R_f$] (fbstart -| opamp.out) 
    -- (opamp.out);
  
  % Ground non-inverting input
  \draw (opamp.+) -- ++(0,-0.5) node[ground]{};
  
  % Output
  \draw (opamp.out) -- ++(1,0) node[right]{$V_{out}$};
  
  % Gain equation
  \node[below] at (3,-2) 
    {$A_v = -\frac{R_f}{R_1}$};
\end{circuitikz}

Non-Inverting Amplifier

Non-Inverting Configuration
\begin{circuitikz}
  % Op-amp
  \draw (3,0) node[op amp](opamp){};
  
  % Input to non-inverting terminal
  \draw (0,-0.5) node[left]{$V_{in}$} 
    -- (opamp.+);
  
  % Feedback network
  \draw (opamp.-) -- ++(0,1.5) coordinate(fbstart)
    to[R, l=$R_2$] (fbstart -| opamp.out) 
    -- (opamp.out);
  
  % Ground resistor
  \draw (opamp.-) to[R, l_=$R_1$] ++(0,-1.5) 
    node[ground]{};
  
  % Output
  \draw (opamp.out) -- ++(1,0) node[right]{$V_{out}$};
  
  % Gain equation
  \node[below] at (3,-2.5) 
    {$A_v = 1 + \frac{R_2}{R_1}$};
\end{circuitikz}

Summing Amplifier

Multi-Input Summing Circuit
\begin{circuitikz}
  % Op-amp
  \draw (4,0) node[op amp](opamp){};
  
  % Input resistors
  \draw (0,1) node[left]{$V_1$} 
    to[R, l=$R_1$] ++(2,0) -- (opamp.-);
  \draw (0,0.5) node[left]{$V_2$} 
    to[R, l=$R_2$] ++(2,0) -- (opamp.-);
  \draw (0,0) node[left]{$V_3$} 
    to[R, l=$R_3$] ++(2,0) -- (opamp.-);
  
  % Feedback resistor
  \draw (opamp.-) to[R, l=$R_f$, *-] ++(0,2) 
    -| (opamp.out);
  
  % Ground positive input
  \draw (opamp.+) |- ++(0,-0.5) node[ground]{};
  
  % Output
  \draw (opamp.out) -- ++(1,0) node[right]{$V_{out}$};
\end{circuitikz}

Digital Logic Gates

Circuitikz supports all standard logic gates for digital circuit diagrams.

Basic Logic Gates

Standard Logic Gates
\begin{circuitikz}
  % AND gate
  \draw (0,0) node[and port](and){};
  \node[above] at (and.north) {AND};
  
  % OR gate
  \draw (3,0) node[or port](or){};
  \node[above] at (or.north) {OR};
  
  % NOT gate
  \draw (6,0) node[not port](not){};
  \node[above] at (not.north) {NOT};
  
  % NAND gate
  \draw (0,-2) node[nand port](nand){};
  \node[above] at (nand.north) {NAND};
  
  % NOR gate
  \draw (3,-2) node[nor port](nor){};
  \node[above] at (nor.north) {NOR};
  
  % XOR gate
  \draw (6,-2) node[xor port](xor){};
  \node[above] at (xor.north) {XOR};
  
  % XNOR gate
  \draw (0,-4) node[xnor port](xnor){};
  \node[above] at (xnor.north) {XNOR};
  
  % Buffer
  \draw (3,-4) node[buffer port](buf){};
  \node[above] at (buf.north) {BUFFER};
\end{circuitikz}

Logic Circuit Example

Combinational Logic
\begin{circuitikz}
  % Input labels
  \node at (-1,2) {A};
  \node at (-1,1) {B};
  \node at (-1,0) {C};
  
  % First level gates
  \draw (0,1.5) node[and port](and1){};
  \draw (-0.5,2) -- (and1.in 1);
  \draw (-0.5,1) -- (and1.in 2);
  
  \draw (0,0.5) node[or port](or1){};
  \draw (-0.5,1) -- (or1.in 1);
  \draw (-0.5,0) -- (or1.in 2);
  
  % Second level gate
  \draw (3,1) node[xor port](xor1){};
  \draw (and1.out) -| (xor1.in 1);
  \draw (or1.out) -| (xor1.in 2);
  
  % Output
  \draw (xor1.out) -- ++(1,0) node[right]{Output};
\end{circuitikz}

Flip-Flop Circuits

D Flip-Flop
\begin{circuitikz}
  % Draw flip-flop box
  \draw (0,0) rectangle (3,3);
  \node at (1.5,3.3) {D Flip-Flop};
  
  % Inputs
  \draw (-1,2.5) node[left]{D} -- (0,2.5);
  \draw (-1,1.5) node[left]{CLK} -- (0,1.5);
  \draw (-1,0.5) node[left]{RST} -- (0,0.5);
  
  % Clock triangle
  \draw (0,1.5) -- ++(0.3,0.2) -- ++(0,-0.4) -- cycle;
  
  % Outputs
  \draw (3,2.5) -- ++(1,0) node[right]{Q};
  \draw (3,0.5) -- ++(1,0) node[right]{$\overline{Q}$};
  
  % Internal labels
  \node at (0.5,2.5) [right]{D};
  \node at (2.5,2.5) [left]{Q};
  \node at (2.5,0.5) [left]{$\overline{Q}$};
\end{circuitikz}

Advanced Circuit Techniques

Full Bridge Rectifier

Bridge Rectifier Circuit
\begin{circuitikz}[scale=1.2]
  % AC source
  \draw (0,0) to[sV, l=$V_{AC}$] (0,3) -- (1,3);
  
  % Bridge diodes
  \draw (1,3) to[D, l=$D_1$] (3,4.5);
  \draw (1,0) to[D, l=$D_2$] (3,1.5);
  \draw (3,4.5) to[D, l=$D_3$, *-*] (5,3);
  \draw (3,1.5) to[D, l=$D_4$, *-*] (5,0);
  \draw (1,3) -- (1,0) -- (0,0);
  
  % Load resistor and capacitor
  \draw (3,4.5) -- (6,4.5) to[C, l=$C$] (6,1.5);
  \draw (6,4.5) to[R, l=$R_L$] (6,1.5) -- (3,1.5);
  
  % Output terminals
  \draw (6,4.5) -- (7,4.5) node[right]{$V_{DC}^+$};
  \draw (6,1.5) -- (7,1.5) node[right]{$V_{DC}^-$};
\end{circuitikz}

555 Timer Circuit

555 Astable Multivibrator
\begin{circuitikz}
  % 555 IC box
  \draw (2,0) rectangle (5,4);
  \node at (3.5,4.3) {555};
  
  % Pin labels
  \node at (2.3,3.5) [right]{\small 1-GND};
  \node at (2.3,3) [right]{\small 2-TRIG};
  \node at (2.3,2.5) [right]{\small 3-OUT};
  \node at (2.3,2) [right]{\small 4-RST};
  \node at (4.7,3.5) [left]{\small 8-VCC};
  \node at (4.7,3) [left]{\small 7-DIS};
  \node at (4.7,2.5) [left]{\small 6-THR};
  \node at (4.7,2) [left]{\small 5-CV};
  
  % Power connections
  \draw (5,3.5) -- (6,3.5) node[vcc]{$V_{CC}$};
  \draw (2,3.5) -- (1,3.5) node[ground]{};
  
  % Timing resistors
  \draw (5,3) -- (6.5,3) to[R, l=$R_1$] (6.5,4.5) 
    -| (6,3.5);
  \draw (5,2.5) -- (7,2.5) to[R, l=$R_2$] (7,3) 
    -- (6.5,3);
  
  % Timing capacitor
  \draw (5,2.5) to[C, l=$C$, *-] (7.5,2.5) |- (1,3.5);
  
  % Bypass capacitor
  \draw (5,2) to[C, l_=$0.01\mu F$] (6.5,2) 
    |- (1,3.5);
  
  % Output
  \draw (2,2.5) -- (0,2.5) node[left]{OUT};
  
  % Reset to VCC
  \draw (2,2) |- (6,3.5);
\end{circuitikz}

Styling and Customization

Custom Component Styles

Style Options
\begin{circuitikz}[
  % Set global styles
  american voltages,
  american currents,
  voltage/distance from node=0.3,
  ]
  
  % Thick lines
  \draw[thick] (0,2) to[R] (2,2);
  
  % Colored components
  \draw[red] (0,1) to[R] (2,1);
  
  % Dashed lines
  \draw[dashed] (0,0) to[R] (2,0);
  
  % Component size
  \ctikzset{resistors/scale=0.8}
  \draw (4,2) to[R] (6,2);
\end{circuitikz}

Scaling Circuits

Circuit Scaling
% Scale entire circuit
\begin{circuitikz}[scale=1.5]
  \draw (0,0) to[V] (0,2) to[R] (2,2) 
    to[C] (2,0) -- (0,0);
\end{circuitikz}

% Transform scaling (affects coordinates only)
\begin{circuitikz}[transform shape, scale=0.8]
  \draw (0,0) to[R] (2,0);
\end{circuitikz}

Frequently Asked Questions

How do I install Circuitikz?

Circuitikz comes with most modern LaTeX distributions (TeX Live, MiKTeX). Simply add \usepackage{circuitikz} to your preamble. If needed, install manually with tlmgr install circuitikz (TeX Live) or through the MiKTeX Package Manager.

Can I mix American and European component styles?

Yes! You can specify styles per component: \draw (0,0) to[american resistor] (2,0) to[european inductor] (4,0); or use \ctikzset{} to change styles mid-document.

How do I find the complete list of components?

Run texdoc circuitikz in your terminal to open the comprehensive manual with all 200+ components, or visit the Circuitikz documentation online. The manual includes visual examples of every component.

Can I create custom components?

Yes! Circuitikz allows custom component definitions using TikZ paths. You can define reusable components with \newcommand or create component libraries for specific applications.

How do I align components precisely?

Use coordinate notation with explicit values: (x,y), or relative positioning: ++(dx,dy). For complex circuits, define nodes first with \coordinate (name) at (x,y); then connect them.

Why are my circuit labels overlapping?

Adjust label positions using l^ (above), l_ (below), or l= (custom position). Increase spacing with \ctikzset{label/distance=0.5} or use anchor options for precise control.

Can I export circuits as standalone images?

Yes! Use the standalone document class:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
  % Your circuit here
\end{circuitikz}
\end{document}

Compile to PDF, then convert to PNG/SVG as needed.