The code samples here are taken from the tikz-feynman
and feynmf
package documentations.
Compile with LuaLaTeX to get the most out of tikz-feynman
.
\documentclass[12pt,a4paper]{article}
\usepackage{feynmp}
\DeclareGraphicsRule{*}{mps}{*}{}
\usepackage{tikz-feynman}
\tikzfeynmanset{compat=1.1.0}
\title{Drawing Feynman Diagrams in \LaTeX}
\begin{document}
\begin{figure}
\centering
\feynmandiagram [horizontal=a to b] {
i1 -- [fermion] a -- [fermion] i2,
a -- [photon] b,
f1 -- [fermion] b -- [fermion] f2,
};
%
\hspace*{1em}
%
\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;
};
\bigskip
\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\)};
\vertex[right=1cm of a4] (a5);
\vertex[right=2cm of a5] (a6) {\(u\)};
\vertex[below=2em of a1] (b1) {\(d\)};
\vertex[right=1cm of b1] (b2);
\vertex[right=1cm of b2] (b3);
\vertex[right=1cm of b3] (b4) {\(\overline d\)};
\vertex[below=2em of a6] (b5) {\(\overline d\)};
\vertex[above=of a6] (c1) {\(\overline u\)};
\vertex[above=2em of c1] (c3) {\(d\)};
\vertex at ($(c1)!0.5!(c3) - (1cm, 0)$) (c2);
\diagram* {
{[edges=fermion]
(b1) -- (b2) -- (a2) -- (a1),
(b5) -- (b4) -- (b3) -- (a3) -- (a4) -- (a5) -- (a6),
},
(a2) -- [boson, edge label=\(W\)] (a3),
(b2) -- [boson, edge label'=\(W\)] (b3),
(c1) -- [fermion, out=180, in=-45] (c2) -- [fermion, out=45, in=180] (c3),
(a5) -- [boson, bend left, edge label=\(W^{-}\)] (c2),
};
\draw [decoration={brace}, decorate] (b1.south west) -- (a1.north west)
node [pos=0.5, left] {\(B^{0}\)};
\draw [decoration={brace}, decorate] (c3.north east) -- (c1.south east)
node [pos=0.5, right] {\(\pi^{-}\)};
\draw [decoration={brace}, decorate] (a6.north east) -- (b5.south east)
node [pos=0.5, right] {\(\pi^{+}\)};
\end{feynman}
\end{tikzpicture}
\caption{Using \texttt{tikz-feynmann}}
\end{figure}
\bigskip
\begin{figure}
\unitlength = 1mm
\begin{fmffile}{simple_labels}
\begin{fmfgraph*}(40,25)
\fmfleft{i1,i2}
\fmfright{o1,o2}
\fmflabel{$e^-$}{i1}
\fmflabel{$e^+$}{i2}
\fmflabel{$e^+,\mu^+$}{o1}
\fmflabel{$e^-,\mu^-$}{o2}
\fmflabel{$i\sqrt{\alpha}$}{v1}
\fmflabel{$i\sqrt{\alpha}$}{v2}
\fmf{fermion}{i1,v1,i2}
\fmf{fermion}{o1,v2,o2}
\fmf{photon,label=$\gamma,,Z^0$}{v1,v2}
\end{fmfgraph*}
\end{fmffile}
%
\hspace{1em}
%
\begin{fmffile}{box}
\begin{fmfgraph}(40,15)
\fmfleft{i1,i2}
\fmfright{o1,o2}
\fmf{fermion}{i1,v1,v2,o1}
\fmf{fermion}{o2,v4,v3,i2}
\fmf{photon,tension=0}{v1,v3}
\fmf{photon,tension=0}{v2,v4}
\end{fmfgraph}
\end{fmffile}
\medskip
\caption{Using \texttt{feynmp}}
\end{figure}
\end{document}