5

I am trying to draw some Feynman diagrams using TikZ but seem to run into trouble where the arrow of a parent is also applied to the child, giving me two arrows on one line. (I have been using the example here as a base for creating my own)

Here's what my output look like (I am aware this diagram is incorrect):

enter image description here

As you can see the position line has two arrows overlapping, it seems it is only the arrows that are inherited.

Code:

\documentclass[10pt]{revtex4-1}

\usepackage{tikz}

\begin{document}

\usetikzlibrary{decorations.pathmorphing,decorations.markings,trees,positioning,arrows}   

 \tikzset{
    photon/.style={,decorate, decoration={snake}, draw=red},
    particle/.style={,draw=blue, postaction={decorate},
        decoration={markings,mark=at position 0.5 with {\arrow[draw=blue]{>}}}},
    antiparticle/.style={,draw=blue, postaction={decorate},
        decoration={markings,mark=at position 0.5 with {\arrow[draw=blue]{<}}}},
    gluon/.style={,decorate, draw=black,
        decoration={snake,amplitude=4pt, segment length=5pt}}
     }

\begin{tikzpicture}[
        thick,
        level/.style={level distance=2cm},
        level 2/.style={sibling distance=2cm},
    ]
\begin{scope}
\node{}
        child[grow=right]{
            edge from parent [particle]
            child []{
                edge from parent [photon]
                node [above=2pt, anchor=south,shift={(0.2,0)}] {$\gamma$};
            }
            child[] {
                edge from parent [antiparticle]
                node [above=2pt, anchor=south] {$e^+$};
            }
            node [above=3pt](gam) {$e^-$}
         };
  \end{scope}
\end{tikzpicture}

\end{document}

2 Answers 2

2

Include each decoration option inside the corresponding postaction for each style:

\documentclass[10pt]{revtex4-1}
\usepackage{tikz}

\begin{document}

\usetikzlibrary{decorations.pathmorphing,decorations.markings,trees,positioning,arrows}   

 \tikzset{
    photon/.style={decorate, decoration={snake}, draw=red},
    particle/.style={draw=blue,postaction={decorate,
        decoration={markings,mark=at position 0.5 with {\arrow[draw=blue]{>}}}}},
    antiparticle/.style={draw=blue,postaction={decorate,
        decoration={markings,mark=at position 0.5 with {\arrow[draw=blue]{<}}}}},
    gluon/.style={decorate, draw=black,
        decoration={snake,amplitude=4pt, segment length=5pt}}
     }

\begin{tikzpicture}[
        thick,
        level/.style={level distance=2cm},
        level 2/.style={sibling distance=2cm},
    ]
\begin{scope}
\node{}
        child[grow=right]{
            edge from parent [particle]
            child []{
                edge from parent [photon]
                node [above=2pt, anchor=south,shift={(0.2,0)}] {$\gamma$};
            }
            child[] {
                edge from parent [antiparticle]
                node [above=2pt, anchor=south] {$e^+$};
            }
            node [above=3pt](gam) {$e^-$}
         };
  \end{scope}
\end{tikzpicture}

\end{document}

enter image description here

2
  • Brilliant, works a treat.
    – JJPP
    Commented Sep 10, 2012 at 19:08
  • @JJPP While the drawing seems to be what you wanted, please note that physically this is incorrect - the graph suggests two electrons annihilating into a photon, eliminating a charge of 2e despite charge conservation. A positron is drawn the same way as an electron but with the arrow pointing in the opposite time direction, but the arrow direction along a path is continuous (so you can imagine a positron ~ as an electron travelling back in time). Have a look at this diagram's left half for a physically correct example. Commented May 2, 2013 at 6:45
1

just two additions/comments to solution given by Claudio Fiandrino:

  1. if the color of decoration arrow(s) is the same color as decorated line, it is not necessary to define color of arrow, i.e. instead \arrow[draw=blue] {>} it is enough to say \arrow{>}.

  2. for arrow in opposite direction of line (edge) you also can use \arrowreversed{>}. this is convenient, if you like to declare a tip of arrow (for example \arrowreversed{latex}, etc).

1
  • Thanks, though if you use the \arrow{latex} you need the option [blue] or the arrow will be black. Maybe that is what the original author was thinking of.
    – JJPP
    Commented Sep 10, 2012 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .