Positioning of math in Tikz-Feynman

I'm trying to write an equation with a Feynman diagrams inside. My code is:

\begin{equation*}
i\mathcal M_t= \feynmandiagram[inline=(d),vertical= b to d]{
a[particle={$p_1$}] -- [fermion] b -- [fermion] c[particle={$p_3$}],
b -- [photon] d,
e[particle={$p_2$}]-- [fermion] d -- [fermion] g[particle={$p_4$}]
};=\cdots
\end{equation*}


This positions the equation at the vertex d. However, I would like to write the equation between the vertices b and d (in the middle of the photon line). By removing the option inline=(d), the equation becomes positioned below the graph (not what I want).

One way I managed to position the diagram correctly was by creating a new vertex between b and d and set the inline option to that vertex. (by doing b -- [photon] k, k -- [photon] d, This is not a desirable solution however, because the diagram becomes too big.

1 Answer

I made an invisible vertex k and invisible lines to this vertex. Here is the result:

Here is the code:

\documentclass{article}

\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{mathtools,amssymb}

\begin{document}

\begin{align*}
i\mathcal M_t= \feynmandiagram[inline=(k),vertical= b to d]{
a[particle={$p_1$}] -- [fermion] b -- [fermion] c[particle={$p_3$}],
b -- [photon] d,
b -- [opacity=0] k, k -- [opacity=0] d,
e[particle={$p_2$}]-- [fermion] d -- [fermion] g[particle={$p_4$}];
};=\cdots
\end{align*}

\end{document}


If you wonder how these invisible lines look, you can change opacity=0 to, say, opacity=0.2. This is how it looks: