Joshua Ellisi · vi · mmxxvi

Projects

TikZ-Feynman

Feynman diagrams with human-readable code

View on GitHub ↗
stars
forks
watchers
open issues
latest release
pull requests

TikZ-Feynman is a LaTeX package for typesetting Feynman diagrams directly in LaTeX, without external tools. It leverages TikZ’s graph placement algorithms to automate vertex layout, while still allowing fine-grained manual control for complex diagrams.

The package is available through CTAN and ships with thorough documentation including a tutorial and an extensive example gallery.

If you use TikZ-Feynman in academic work, please cite:

Ellis, Joshua P. “TikZ-Feynman: Feynman diagrams with TikZ.” Computer Physics Communications 210 (2017): 103–123. doi:10.1016/j.cpc.2016.08.019 · arXiv:1601.05437

Examples

A simple QED scattering diagram of two electrons exchanging a photon:

Two electrons scattering via photon exchange

\feynmandiagram [horizontal=a to b] {
  i1 -- [fermion] a -- [fermion] i2,
  a -- [photon] b,
  f1 -- [fermion] b -- [fermion] f2,
};

A “penguin” diagram with explicit momentum arrows:

Penguin diagram with momentum arrows

\feynmandiagram [large, vertical=e to f] {
  a -- [fermion] b -- [photon, momentum=\(k\)] c -- [fermion] d,
  b -- [fermion, momentum'=\(p_1\)] e -- [fermion, momentum'=\(p_2\)] c,
  e -- [gluon] f,
  h -- [fermion] f -- [fermion] i;
};

A B-meson decay to π⁺π⁻ using the manual diagram* environment for full positional control:

B meson decaying to π⁺π⁻

\begin{tikzpicture}
  \begin{feynman}
    \vertex (a1) {\(\overline b\)};
    \vertex[right=1cm of a1] (a2);
    \vertex[right=1cm of a2] (a3);
    \vertex[right=1cm of a3] (a4) {\(b\)};
    % ... (see documentation for full example)
    \diagram* {
      {[edges=fermion] (a1) -- (a2) -- (a3) -- (a4)},
      (a2) -- [boson, edge label=\(W\)] (a3),
    };
  \end{feynman}
\end{tikzpicture}