TikZ-Feynman: layers and alignment

I'm trying to draw a gg->ttZ Feynman diagram using the TikZ-Fenyman package, and so far here's what I have:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\feynmandiagram[medium, layered layout, vertical=a to c] {
g1 [particle=$$g$$] -- [gluon] a -- [fermion] b [particle=$$t$$],
{ [same layer] c -- [fermion, edge label=$$t$$] e -- [fermion, edge label=$$t$$] a},
e -- [photon, edge label=$$Z$$] f,
g [particle=$$\nu$$] -- [anti fermion] f -- [anti fermion] h [particle=$$\bar{\nu}$$],
g2 [particle=$$g$$] -- [gluon] c -- [anti fermion] d [particle=$$\bar{t}$$],
};
\end{document}


giving me this diagram:

How can I do the following:

• have the external neutrinos and tops lined up?
• have the Z correctly splitting in a pair of neutrinos?
• (extra) make the diagram a bit more compact by reducing the length of the internal top propagators?
• I compiled your code in LaTeX and got quite a different outcome (along with some warnings about LuaTeX). Does your first bullet point mean you want the baseline of the g and t to be lined up? You can try doing this with \phantom{g} or \vphantom{g} around the t node to raise the baseline. Does your second bullet point mean you want them coming out at the same angles? – Jānis Lazovskis Dec 12 '16 at 17:25
• Hi @JānisLazovskis :) I'd like to have nodes b,d,g,h aligned vertically, and yes, the neutrinos coming out at the same angles from the Z. – Demosthene Dec 12 '16 at 17:33
• @Jānis you have to compile with lualatex, as also suggested to you by your compiler. – giordano Dec 12 '16 at 23:44

Good to see TikZ-Feynman being put to good use!

So, the main issue here is that the layered layout (unlike most other algorithms) takes into account the order in which vertices are specified. In particular, it has a notion of layers and with:

a -- b


This tells it that a is on the layer above b and is distinct from b -- a. So in your example, you have

g [particle=$$\nu$$]
-- f
-- h [particle=$$\bar{\nu}$$]


and as a result, the neutrino at g is on the layer above f which itself is a layer above the antineutrino at h, hence why the neutrino is awkwardly sitting at the bottom of the central fermion line.

Now as to make it more compact, you can use sibling distance and layer distance to adjust the separation between vertices on the same layer or across layers respectively.

With all this, two of the three dot-points above are addressed:

\documentclass{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}

\begin{document}

\feynmandiagram[layered layout, vertical=a to c, sibling distance=1cm] {
g1 [particle=$$g$$]
-- [gluon] a
-- [fermion] t1 [particle=$$t$$],
{ [same layer]
c -- [fermion, edge label=$$t$$] b
-- [fermion, edge label=$$t$$] a},
b  -- [boson, edge label=$$Z$$] n2,
n2 -- [anti fermion] n1 [particle=$$\overline \nu$$],
n2 -- [fermion] n3 [particle=$$\nu$$],
g2 [particle=$$g$$]
-- [gluon] c
-- [anti fermion] t2 [particle=$$\overline t$$],
};
\end{document}


Finally, if you want even finer control on everything, then the algorithm won't be able to meet all your needs and you'll have to adjust things manually. You can see some example of this being done at:

How to draw Feynman diagram for Majorana particles?

Tikz-Feynman: Multiple arrows on one fermion line and alignment (0vββ)