Use baseline while no proper node at hand
Turgon-Aran-Gondolin opened this issue · 1 comments
Turgon-Aran-Gondolin commented
In some diagrams such as a box diagram, we have
\feynmandiagram[horizontal=i1 to f1,layered layout,inline=(d.base)]{
i1 -- [fermion] a -- [fermion] b -- [fermion] f1,
i2 -- [fermion] c -- [fermion] d -- [fermion] f2,
{ [same layer] a -- [photon] c},
{ [same layer] b-- [photon] d},
};
but as you can see, there's no node in the center (i.e. in the middle of a and c), so how can I set the baseline in there? Do you have any idea?
Thanks a lot.
JP-Ellis commented
The easiest is to automatically calculate the centre. As you said, you want the middle of a
and c
which can be computed by TikZ. The format for that is ($(a)!0.5!(c)$)
. The dollar signs here indicate that this is a computer node that is half-way (0.5) between a
and c
.
\RequirePackage{luatex85}
\documentclass[border=10pt]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
ABC \feynmandiagram[horizontal=i1 to f1,layered layout,inline=($(a)!0.5!(c)$)]{
i1 -- [fermion] a -- [fermion] b -- [fermion] f1,
i2 -- [fermion] c -- [fermion] d -- [fermion] f2,
{ [same layer] a -- [photon] c},
{ [same layer] b-- [photon] d},
}; XYZ
\end{document}