# Tweaking behaviour of tikz trees for Feynman diagrams

I am working with tikz to draw Feynman diagrams, and I have a few questions about tweaking the behavior of the following code.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,arrows,decorations.pathmorphing,decorations.markings,trees}
\begin{document}
\tikzset{
photon/.style={decorate, decoration={snake}, draw=red},
particle/.style={draw=blue,solid, postaction={decorate},
decoration={markings,mark=at position .5 with {\arrow[draw=blue]{>}}}},
antiparticle/.style={draw=blue,solid, postaction={decorate},
decoration={markings,mark=at position .5 with {\arrow[draw=blue]{<}}}},
wboson/.style={draw=black,dashed}
}
\begin{tikzpicture}[
thick,
% Set the overall layout of the tree
level/.style={level distance=2.0cm},
level 2/.style={sibling distance=3.5cm},
]
\coordinate
child[grow=left]{
edge from parent [wboson]
child {
edge from parent [particle]
node [above] {$d^r_L$}
}
child {
edge from parent [antiparticle]
node [below] {$u^r_L$}
}
node [above=3pt] {$W^+$}
}
% I have to insert a dummy child to get the tree to grow
% correctly to the right.
child[grow=right, level distance=0pt] {
child { }
child {
edge from parent [particle]
node [above] {$\nu_L$}
}
}
child[grow=left, level distance=0pt]{
child {
edge from parent [particle]
node [above] {$\overline{e^-_L}$}
}
child { }
};
\end{tikzpicture}
\end{document}


1) How can I remove the black solid lines from the picture so that only the dashed line and four blue lines remain?

2) How can I tweak the angle between the blue lines, so that the two right-most blue lines describe an acute angle, without increasing the level/sibling distances at all?

-

1) From the manual, p222, add the option child {edge from parent[draw=none] } to the dummy nodes to get rid of the black lines.

2) The level distance and sibling distance properties take effect once, for each subtree. As your code stands, you can't do what you're trying to do, because your tree is not uniform. If I'm reading it right, it "starts" at the right vertex, then goes left for the wboson and splits for the anti/particle pair, backtracks to the right and produces the rightmost blue line, then backtracks again and produces the middle one. That's not very straightforward :)

An alternative would be to start the tree at the W^+ label, grow "down" with zero level separation, so that the tree grows left and right, and spread out from there:

 \path
[grow=down, level distance=0pt,sibling distance=1cm]
coordinate [above, label={$W^+$}]
child [grow=left, level distance=1cm]{
edge from parent [wboson]
% Add [level distance=whatever, sibling distance=whatever] if you'd like
child {
node [above] {$d^r_L$}
edge from parent [particle]
}
child {
node [below] {$u^r_L$}
edge from parent [antiparticle]
}
}
child [grow=right, level distance=1cm, sibling distance=1cm] {
edge from parent [wboson]
[grow=up] % Add level distance=whatever, sibling distance=whatever here
child {
node [above] {$\nu_L$}
edge from parent [particle]
}
child {
node [above] {$\overline{e^-_L}$}
edge from parent [particle]
}
};


(You can tweak the level distances as you want) The added advantage of this approach is you don't have any dummy lines anymore. The slight disadvantage is you have to split the W^+ path "in half", but you regain the expected invariant that each node of a tree grows in one uniform direction.

-
I very much like your idea, since it is indeed much more straightforward then what I was doing. Unfortunately, there seems to be a syntax error in the code somewhere. Either that, or I am dropping it into the wrong place. Am I correct in taking the \path as a replacement for \coordinate, after which the rest of the code follows? – KBriggs Jul 11 '11 at 17:59
I was able to tweak it to compile - there was just a line out of place. Once I got that working everything went smoothly. Thanks for your help :) – KBriggs Jul 11 '11 at 18:28
Yes. From the manual, p175, "\coordinate is shorthand for \path coordinate", and what you really care about here is the path. (BTW, you can use backticks in comments too, to highlight some text as code) – Ben Lerner Jul 11 '11 at 18:33