You need to compile with lualatex
!
If compiled width pdflatex
, there's a warning message
Package tikz-feynman Warning: LuaTeX is required if you wish to have vertices a
utomatically placed. You can disable this warning by setting /tikzfeynman/warn
luatex=false on input line 8.
However, disabling the warning does not cure the problem.
Unfortunately the tikz-feynman
manual does not reveal anything about the usage of lualatex
. It seems to be a hidden feature or the package author relied that this is known.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,automata,backgrounds,calc,er,patterns}
\usepackage{tikz-feynman}
\tikzfeynmanset{compat=1.0.0}
\begin{document}
\begin{tikzpicture}
\begin{feynman}
\vertex (a) {\(\mu^{-}\)};
\vertex [right=of a] (b);
\vertex [above right=of b] (f1) {\(\nu_{\mu}\)};
\vertex [below right=of b] (c);
\vertex [above right=of c] (f2) {\(\overline \nu_{e}\)};
\vertex [below right=of c] (f3) {\(e^{-}\)};
\diagram* {
(a) -- [fermion] (b) -- [fermion] (f1),
(b) -- [boson, edge label'=\(W^{-}\)] (c),
(c) -- [anti fermion] (f2),
(c) -- [fermion] (f3),
};
\end{feynman}
\end{tikzpicture}
\end{document}
Here's the image produced for that apparent muon-decay
EDIT
As mentioned in the comment below, this was a bug in TikZ-Feynman in v1.0.0. As of v1.1.0, TikZ-Feynman issues warnings whenever a feature requiring LuaLaTeX is used.
If you still try using the automatic graph placement algorithms and don't use LuaLaTeX, a very simple algorithm is used which generates something like:
If you see this output, you'll either need to change compiler to LuaLaTeX, or manually position the location of the vertices.
The algorithms that TikZ-Feynman (CTAN) uses only figure out how to place the vertices relative to other vertices. Unfortunately, the algorithms have no notion of the overall orientation.
Fortunately, you can easily adjust the orientation with either
vertical=<vertex> to <vertex>
or
horizontal=<vertex> to <vertex>
In addition to these two keys, there are corresponding primed options (vertical'
and horizontal'
) which adjust the overall orientation and then perform an additional flip.
Here's an example of a 4-point interaction in a λφ⁴ theory:
\documentclass[tikz,border=10pt]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\feynmandiagram [horizontal=i1 to f2, edges={scalar}] {
{i1, i2} -- c [dot] -- {f1, f2},
};
\end{document}
One thing you'll notice is that vertical
and horizontal
can take any (distinct) nodes; the nodes need not be connected.
Best Answer
Something like this?