I am trying to draw a set of Feynman diagrams which are color-coded. If I set the color on the entire tikzpicture
environment, all is well. However, if I pass the color to the feynman
environment, it seems to have no effect. I've also tried passing /tikz/<color>
, as well as using the /tikzfeynman/every vertex={<color>}
syntax, all to no avail.
According to the feynman-tikz
documentation, passing an option to \begin{feynman}
should be the same as passing the option to \begin{scope}
:
Options which are passed in
〈options〉
apply for the whole environment in the same way that the{scope}
environment work in TikZ.
MWE:
\documentclass[]{standalone}
\usepackage{tikz}
\usepackage{tikz-feynman}
\begin{document}
\begin{tikzpicture}[baseline=(Abase),scale=0.85,transform shape]
\useasboundingbox (-0.25,-0.25) rectangle (2.75,2.25);
\coordinate (base) at (-0.5,1);
\draw[help lines] (0,0) grid[step=0.25] (2.5,2);
\begin{feynman}[blue] %% <---- this diagram should be blue
\coordinate [right=1.5 of base] (Abase);
\vertex [on grid,below=1 of Abase] (Ai1);
\vertex [on grid,above=1 of Abase] (Ao1);
\vertex [on grid,below=1/3 of Abase, dot] (Av1) {};
\vertex [on grid,above=1/3 of Abase, dot] (Av2) {};
\vertex [on grid,left=1/3 of Abase] (Avp);
\vertex [on grid,left=1 of Abase] (Ap1);
\diagram*[small,horizontal=Ai1 to Ai2]{
(Ai1) -- (Av1) -- (Av2) -- (Ao1),
(Av1) -- [scalar, quarter left] (Avp) -- [scalar, quarter left] (Av2),
(Ap1) -- [photon] (Avp),
};
\end{feynman}
\begin{feynman}[red] %% <---- this diagram should be red
\coordinate [right=1.5 of Abase] (Dbase);
\vertex [on grid,below=1 of Dbase] (Di1);
\vertex [on grid,above=1 of Dbase] (Do1);
\vertex [on grid,below=1/3 of Dbase, dot] (Dv1) {};
\vertex [on grid,above=1/3 of Dbase, dot] (Dv2) {};
\vertex [on grid,left=1/3 of Dbase] (Dvp);
\vertex [on grid,left=1 of Dbase] (Dp1);
\diagram*[small,horizontal=Di1 to Di2]{
(Di1) -- (Dv1) -- (Dv2) -- (Do1),
(Dv1) -- [scalar, quarter left] (Dvp) -- [scalar, quarter left] (Dv2),
(Dp1) -- [photon] (Dvp),
};
\end{feynman}
\end{tikzpicture}
\end{document}
blue
as an argument of\diagram*
and you will get the desired color. For more information, look at arxiv.org/pdf/1601.05437.pdf, Adding styles.blue
to\diagram*
's argument sets the color of the edges correctly, but then the vertices do not have the correct color.feynman
environment with ascope
environment does correctly set all the colors -- somehow, the argument tofeynman
is not passed in "the same way" as an argument to scope would be.dot
when you declareAv1
andAv2
. It is there that you must provide the color. The philosophy is to introduce the desired color on each individual element.