Quick Start Guide
This guide will get you started with tikz-feyn in minutes.
Basic Concepts
tikz-feyn diagrams are built from vertices and edges:
Vertices are points in space where particles meet
Edges are lines representing particle propagators
Diagrams are organized in columns for consistent layout
Your First Diagram
Let’s create a simple fermion propagator:
\documentclass{article}
\usepackage{tikz-feyn}
\begin{document}
\begin{tfeyn}
\tfcol{i} % Input vertex
\tfcol{o} % Output vertex
\tf[f]{i,o} % Fermion line from i to o
\end{tfeyn}
\end{document}
This creates two columns with one vertex each, connected by a fermion line.
Environments
tikz-feyn provides three environments for different contexts:
tfeyn (Display Mode)
For standalone diagrams:
\begin{tfeyn}
% diagram commands
\end{tfeyn}
tfeynin (Inline Mode)
For diagrams within text:
The process
\begin{tfeynin}
\tfcol{i}\tfcol{o}
\tf[f]{i,o}
\end{tfeynin}
is important.
tfeynma (Math Mode)
For diagrams in equations:
\begin{equation}
\mathcal{M} =
\begin{tfeynma}
\tfcol{i}\tfcol{o}
\tf[f]{i,o}
\end{tfeynma}
\end{equation}
Creating Columns
Use \tfcol to create columns of vertices:
\tfcol{vertex1, vertex2, vertex3}
Multiple vertices are separated by commas and arranged vertically.
Custom Spacing
Control the vertical spacing within a column:
\tfcol{i1, i2, i3}[1cm] % 1cm between vertices
Position Offsets
Shift an entire column vertically:
\tfcol(0, 0.5cm){m1, m2} % Shift column up by 0.5cm
Drawing Edges
Use \tf to connect vertices with particle propagators:
Basic Syntax
\tf[style]{vertex1, vertex2}
Examples:
\tf[f]{i,o} % Fermion
\tf[p]{a,b} % Photon
\tf[g]{v1,v2} % Gluon
Available Styles
forfermion- Fermion (line with arrow)porphoton- Photon (wavy line)worwboson- W boson (coiled double line, 1pt)zorzboson- Z boson (coiled double line, 2pt)horhiggs- Higgs boson (dotted line)gorgluon- Gluon (coiled line)Gorgraviton- Graviton (double coiled line)
Intermediate Vertices
Create vertices between existing ones:
\begin{tfeyn}
\tfcol{a1, a2}
\tfcol{b1, b2}
\tf[f]{a1, v1, a2}[r] % Creates v1 to the right
\tf[p]{v1, b1}
\end{tfeyn}
Direction Options
The third argument specifies where to create intermediate vertices:
r- Rightl- Leftu- Upd- Down
Complete Example
Electron-positron scattering:
\documentclass{article}
\usepackage{tikz-feyn}
\begin{document}
\begin{tfeyn}
% Create three columns
\tfcol{i1, i2} % Incoming particles
\tfcol{m1, m2} % Interaction vertices
\tfcol{o1, o2} % Outgoing particles
% Connect vertices
\tf[f]{i1, m1} % Incoming electron
\tf[f]{i2, m2} % Incoming positron
\tf[p]{m1, m2} % Photon exchange
\tf[f]{m1, o1} % Outgoing electron
\tf[f]{m2, o2} % Outgoing positron
\end{tfeyn}
\end{document}
Loops and Arcs
Create self-energy diagrams and loops:
\begin{tfeyn}
\tfcol{i}
\tfcol{o}
\tf[p]{i,o} % Main propagator
\tf[f, l]{i,o} % Fermion loop (l = loop style)
\end{tfeyn}
Adjust loop shape:
\tf[f, l, looseness=2]{i,o} % Larger loop
Customization
Combine with TikZ Styles
\tf[f, red]{i,o} % Red fermion
\tf[p, blue, thick]{a,b} % Thick blue photon
\tf[g, dashed]{v1,v2} % Dashed gluon
Environment Parameters
All environments accept spacing parameters:
\begin{tfeyn}[column sep][row sep][h-int][v-int]
% diagram
\end{tfeyn}
Example:
\begin{tfeyn}[3cm][1cm][0.8cm][0.4cm]
% Wider, taller diagram
\end{tfeyn}
Next Steps
See Command Reference for complete command documentation
Browse Examples for more complex diagrams
Learn about customization in the Command Reference section