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.




  \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),
    \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),

Output: generated TikZ diagram from MWE

  • 1
    Try to set the color 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.
    – Daniel N
    Feb 6 at 2:44
  • @DanielN Adding blue to \diagram*'s argument sets the color of the edges correctly, but then the vertices do not have the correct color.
    – kc9jud
    Feb 6 at 6:06
  • I also tested: wrapping each feynman environment with a scope environment does correctly set all the colors -- somehow, the argument to feynman is not passed in "the same way" as an argument to scope would be.
    – kc9jud
    Feb 6 at 6:07
  • Hi again! You introduce the "vertices" with the option dot when you declare Av1 and Av2. It is there that you must provide the color. The philosophy is to introduce the desired color on each individual element.
    – Daniel N
    Feb 6 at 18:39
  • Did it work for you?
    – Daniel N
    Feb 7 at 8:26


You must log in to answer this question.

Browse other questions tagged .