Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to find some example code for some very simple Feynman diagrams. Something similar to any or all of the pictures below

Simple Feynman diagrams

I was able to find some example code on texample.net, but being new to TikZ I am not really able to tweak it to produce something simple like the examples above. I would appreciate any help :).

EDIT: I managed to get the code down to a smaller example that is close to what I want:

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,decorations.markings,trees}
\begin{document}

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

\begin{tikzpicture}[
        thick,
        % Set the overall layout of the tree
        level/.style={level distance=1.5cm},
        level 2/.style={sibling distance=3.5cm},
    ]
    \coordinate
        child[grow=left]{
            edge from parent [gluon]
            child {
                edge from parent [particle]
                node [above] {$g$}
            }
            child {
                edge from parent [antiparticle]
                node [below] {$g$}
            }
            node [above=3pt] {$g$}
         }
        % I have to insert a dummy child to get the tree to grow
        % correctly to the right.
        child[grow=right, level distance=0pt] {
            child {
                edge from parent [antiparticle]
                node [above] {$g$}
            }
            child {
                edge from parent [particle]
                node [below] {$g$}
            }
        };
\end{tikzpicture}
\end{document}

However, if instead of the coil decoration for the gluon, I want a straight dashed line, I change the line

gluon/.style={decorate, draw=black,
        decoration={snake,amplitude=4pt, segment length=5pt}}

for

gluon/.style={draw=black,dashed}

However, this makes the two particles to the left of the gluon become dashed as well. Can someone suggest a way to fix this?

share|improve this question
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Martin Scharrer Jul 8 '11 at 14:20
    
Thanks for the welcome :). So it does. I'll take a read through your link. –  KBriggs Jul 8 '11 at 14:28
    
Oh, no big issue. And again: welcome to TeX.sx! –  Martin Scharrer Jul 8 '11 at 14:31
    
@KyleB What in particular do you want to tweak on the texample? –  N.N. Jul 8 '11 at 14:32
    
I suppose mostly I was simply hoping for some hep understanding the code itself, and perhaps have someone use something similar to generate one of the pictures in my post so that I can see how it behaves. The syntax of tikz has a pretty steep learning curve, so seeing examples helps a lot. –  KBriggs Jul 8 '11 at 14:34
show 2 more comments

2 Answers 2

up vote 3 down vote accepted

As far as I understand it, the "dashed" style option is a shorthand that sets /tikz/dash pattern to a dashed style (PGF manual v2.1, p157). That then stays in effect for the rest of the path, until you change the dash pattern again. Because the other styles don't specify the dash pattern, they'll keep using whatever was in effect. Try adding "solid" to the definitions of (anti-)particle and gluon, and it should work.

share|improve this answer
    
Thanks for the suggestion! I will give it a shot then I get back to work Monday. –  KBriggs Jul 9 '11 at 12:49
add comment

I don't know if you are interested, but if you only need to draw "standard" diagrams you can take a look at the feynmf package which is designed just for that!

share|improve this answer
    
I have looked, but it seems that it needs quite a bit of extra work on top of just setting up the figure, so I was hoping for something easier with tikz. On the other hand, you may be right. I will look around for resources on the subject. –  KBriggs Jul 9 '11 at 12:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.