The style keys small
and large
only change the default separation between vertices, but they do not rescale the overall diagram, and this should work in all compilers. (Note: At the moment it does not, it only works with lualatex
, see https://github.com/JP-Ellis/tikz-feynman/issues/35#issuecomment-258429193. So either use lualatex
, or the suggestion at the bottom of this post.)
As a result, if the position of vertices is specified explicitly,
\vertex (a) at (0, 1);
or if you specify the separation explicitly,
\vertex [right=1cm of b] (a);
then the small
and large
keys will have no effect on the placement of these. Since you haven't provided the actual diagram you are drawing, then I'm only speculating that this is the reason.
If an overall scaling is really desired, it is possible to do so with the appropriate TikZ key, which can be passed to \feynmandiagram
. In particular, use:
\feynmandiagram[scale=2,transform shape][horizontal=a to b]
where the first set of brackets are the TikZ specific options, and the second set are the TikZ-Feynman options. you can change the 2
to an appropriate value.
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ββ)
Best Answer
To address each of these points:
For the vertical alignment, use the
baseline
key, as in the example below.For shortening the photons I can't give you an automatic solution that doesn't involve shrinking the middle part as well, but you can move the end points of those lines by using
nudge
(see the manual for TikZ). I see that the amount of nudging could be fine tuned.Instead of
particle=\(nu\)
, uselabel=\(\nu\)
which places the\nu
beside the vertex instead of replacing the vertex with the litter. You can further adjust the positioning of the label withlabel=<angle>:\(nu\)
.