This code produces an image of a "quantum circuit" that produces a Greenberger-Horne-Zeilinger (GHZ) state, which is important for tests of nonlocality. This is an example of how simple it is to draw quantum circuits using TikZ.

Edit and compile if you like:
% Quantum circuit% Author:% This code produces an image of a `quantum circuit' that produces% a Greenberger-Horne-Zeilinger (GHZ) state, which is important% for tests of nonlocality. This is an example of how simple it is% to draw quantum circuits using TikZ.\documentclass[10pt]{article}\usepackage[hang,small,bf]{caption} % fancy captions\usepackage{tikz}\usetikzlibrary{backgrounds,fit,decorations.pathreplacing} % TikZ libraries\newcommand{\ket}[1]{\ensuremath{\left|#1\right\rangle}} % Dirac Kets\usepackage[active,tightpage]{preview}\PreviewEnvironment{tikzpicture}\setlength\PreviewBorder{5pt}%\begin{document}\begin{figure}\centerline{\begin{tikzpicture}[thick]%% `operator' will only be used by Hadamard (H) gates here.% `phase' is used for controlled phase gates (dots).% `surround' is used for the background box.\tikzstyle{operator} = [draw,fill=white,minimum size=1.5em]\tikzstyle{phase} = [fill,shape=circle,minimum size=5pt,inner sep=0pt]\tikzstyle{surround} = [fill=blue!10,thick,draw=black,rounded corners=2mm]%% Qubits\node at (0,0) (q1) {\ket{0}};\node at (0,-1) (q2) {\ket{0}};\node at (0,-2) (q3) {\ket{0}};%% Column 1\node[operator] (op11) at (1,0) {H} edge [-] (q1);\node[operator] (op21) at (1,-1) {H} edge [-] (q2);
Click to download: quantum-circuit.tex • quantum-circuit.pdf
Open in Overleaf: quantum-circuit.tex