Examples
This section provides a collection of example Feynman diagrams demonstrating various features of tikz-feyn.
Basic Processes
Simple Fermion Propagator
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[f]{i,o}
\end{tfeyn}
Photon Propagator
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[p]{i,o}
\end{tfeyn}
Gluon Exchange
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[g]{i,o}
\end{tfeyn}
Scattering Processes
Electron-Positron Scattering (QED)
Basic s-channel process:
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{m1, m2}
\tfcol{o1, o2}
\tf[f]{i1, m1} % e- incoming
\tf[f]{i2, m2} % e+ incoming
\tf[p]{m1, m2} % photon exchange
\tf[f]{m1, o1} % e- outgoing
\tf[f]{m2, o2} % e+ outgoing
\end{tfeyn}
With intermediate vertex:
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{o1, o2}
\tf[f]{i1, v1, i2}[r]
\tf[f]{o1, v2, o2}[l]
\tf[p]{v1, v2}
\end{tfeyn}
Quark-Antiquark Annihilation
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{o1, o2}
\tf[f]{i1, v, i2}[r] % quark-antiquark annihilation
\tf[g]{v, m} % gluon
\tf[f]{o1, m, o2}[l] % quark pair creation
\end{tfeyn}
Compton Scattering
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{v1, v2}
\tfcol{o1, o2}
\tf[p]{i1, v1} % incoming photon
\tf[f]{i2, v1} % incoming electron
\tf[f]{v1, v2} % electron propagator
\tf[p]{v2, o1} % outgoing photon
\tf[f]{v2, o2} % outgoing electron
\end{tfeyn}
Loop Diagrams
Fermion Self-Energy
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[f]{i, o} % main propagator
\tf[f, l]{i, o} % fermion loop
\tf[p, l]{i, o} % photon connecting loop
\end{tfeyn}
Vertex Correction
One-loop vertex correction:
\begin{tfeyn}
\tfcol{i1, i2}[1cm]
\tfcol(0, 0.3cm){v1, v2}[0.3cm]
\tfcol(0, -0.3cm){o1, o2}[1cm]
\tf[f]{i2, v4, v2}
\tf[f]{v2, v6, o2}
\tf[p, l]{v4, v6} % photon loop
\tf[p]{v2, v1}
\tf[f]{i1, v1, o1}
\end{tfeyn}
Vacuum Polarization
Photon with fermion loop:
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[p]{i, o} % photon propagator
\tf[f, l]{i, o} % fermion loop
\tf[f, l]{o, i} % anti-fermion (opposite direction)
\end{tfeyn}
Higgs and Electroweak Processes
Higgs Production (Gluon Fusion)
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{o}
\tf[g]{i1, v1, i2}[r] % gluon fusion
\tf[f, l]{v1, v2} % top quark loop
\tf[f, l]{v2, v3}
\tf[f, l]{v3, v1}
\tf[h]{v2, o} % Higgs production
\end{tfeyn}
W Boson Exchange
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{m1, m2}
\tfcol{o1, o2}
\tf[f]{i1, m1} % fermion
\tf[f]{i2, m2} % fermion
\tf[w]{m1, m2} % W boson exchange
\tf[f]{m1, o1} % fermion
\tf[f]{m2, o2} % fermion
\end{tfeyn}
Z Boson Production
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{o}
\tf[f]{i1, v, i2}[r] % fermion-antifermion annihilation
\tf[z]{v, o} % Z boson production
\end{tfeyn}
Box Diagrams
Four-Point Function
\begin{tfeyn}[2cm][1cm]
\tfcol{i1, i2}
\tfcol{m1, m2}
\tfcol{m3, m4}
\tfcol{o1, o2}
\tf[f]{i1, m1}
\tf[f]{i2, m2}
\tf[f]{m1, m3}
\tf[f]{m2, m4}
\tf[p]{m1, m2}
\tf[p]{m3, m4}
\tf[f]{m3, o1}
\tf[f]{m4, o2}
\end{tfeyn}
QCD Processes
Gluon Self-Energy
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[g]{i, o}
\tf[g, l]{i, o}
\tf[g, l]{o, i}
\end{tfeyn}
Three-Gluon Vertex
\begin{tfeyn}
\tfcol{i1}
\tfcol{i2}
\tfcol{o}
\tf[g]{i1, v}
\tf[g]{i2, v}
\tf[g]{v, o}
\node[vertex] at (v) {};
\end{tfeyn}
Quark-Gluon Scattering
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{m1, m2}
\tfcol{o1, o2}
\tf[f]{i1, m1} % quark
\tf[g]{i2, m2} % gluon
\tf[g]{m1, m2} % gluon exchange
\tf[f]{m1, o1} % quark
\tf[g]{m2, o2} % gluon
\end{tfeyn}
Advanced Techniques
Multiple Loops with Custom Looseness
\begin{tfeyn}
\tfcol{i}[1cm]
\tfcol{o}
\tf[p, l, looseness=1]{i, o}
\tf[p, l, looseness=1]{o, i}
\tf[f, l]{i, o}
\tf[f, l]{o, i}
\end{tfeyn}
Colored Diagrams for Presentations
\begin{tfeyn}
\tfcol{i1, i2, i3}
\tfcol{o1, o2, o3}
\tf[f, red, thick]{i1, o1}
\tf[p, blue, thick]{i2, o2}
\tf[g, green!70!black, thick]{i3, o3}
\end{tfeyn}
Asymmetric Diagrams
Using position offsets for asymmetric layouts:
\begin{tfeyn}[1.5cm][0.8cm]
\tfcol{i1, i2}[1cm]
\tfcol(0, 0.5cm){m1}
\tfcol(0, -0.5cm){o1, o2, o3}[0.5cm]
\tf[f]{i1, m1}
\tf[f]{i2, m1}
\tf[f]{m1, o1}
\tf[f]{m1, o2}
\tf[f]{m1, o3}
\end{tfeyn}
Visible Interaction Vertices
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{m1, m2}
\tfcol{o1, o2}
\tf[f]{i1, m1}
\tf[f]{i2, m2}
\tf[p]{m1, m2}
\tf[f]{m1, o1}
\tf[f]{m2, o2}
% Draw vertices
\node[vertex] at (m1) {};
\node[vertex] at (m2) {};
\end{tfeyn}
Inline Diagrams in Text
Simple Inline
The vertex
\begin{tfeynin}
\tfcol{a, b}
\tfcol{c}
\tf[f]{a, c}
\tf[f]{b, c}
\tf[p]{c, d}
\end{tfeynin}
contributes to the amplitude.
In Equations
\begin{equation}
\mathcal{M} =
\begin{tfeynma}
\tfcol{i1, i2}
\tfcol{o1, o2}
\tf[f]{i1, v1, i2}[r]
\tf[f]{o1, v2, o2}[l]
\tf[p]{v1, v2}
\end{tfeynma}
+ \text{crossed terms}
\end{equation}
Custom Particle Types
Defining New Styles
\tikzset{
scalar/.style={
dashed,
thick
},
s/.style={scalar},
meson/.style={
dash pattern=on 2pt off 2pt,
line width=1pt
},
m/.style={meson}
}
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[s]{i, o} % scalar particle
\end{tfeyn}
Tips and Tricks
Consistent Spacing
For diagrams in the same document, define consistent spacing:
\newcommand{\mydiagram}[1]{%
\begin{tfeyn}[2cm][0.8cm][0.7cm][0.3cm]
#1
\end{tfeyn}%
}
\mydiagram{
\tfcol{i}\tfcol{o}
\tf[f]{i,o}
}
Reusable Components
Define common sub-diagrams:
\newcommand{\photonexchange}{%
\tf[p]{m1, m2}
}
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{m1, m2}
\tfcol{o1, o2}
\tf[f]{i1, m1}
\tf[f]{i2, m2}
\photonexchange % reusable component
\tf[f]{m1, o1}
\tf[f]{m2, o2}
\end{tfeyn}
Labels and Annotations
Add labels using TikZ nodes:
\begin{tfeyn}
\tfcol{i1, i2}
\tfcol{o1, o2}
\tf[f]{i1, v1, i2}[r]
\tf[f]{o1, v2, o2}[l]
\tf[p]{v1, v2}
\node[above] at (i1) {$e^-$};
\node[below] at (i2) {$e^+$};
\node[above] at (o1) {$e^-$};
\node[below] at (o2) {$e^+$};
\end{tfeyn}