# Vertical alignment of feynmp-graphs in equations

I find myself often in the situation where I have to arrange graphs generated with feynmp in equations. This works usually fine, but I have to play around with the space, i.e. I need to add some at the bottom for the text and the graph not to overlap. Consider the following code

\documentclass{article}
\usepackage{lipsum}
\usepackage{mathtools}
\usepackage{feynman-auto}

\setlength{\unitlength}{.09cm}

\begin{document}

\lipsum[10]

\begin{fmffile}{operator_2}
\begin{align*}
(a)-(b):=
\fmfframe(2,12.5)(2,-12.5){%
\begin{fmfgraph*}(40,25)
\fmfleftn{i}{2}
\fmfrightn{o}{2}
\fmf{dashes}{i1,v,o1}
\fmf{fermion}{i2,v,o2}
\fmfblob{0.15w}{v}
\fmflabel{$p_2$}{i2}
\fmflabel{$p_4$}{i1}
\fmflabel{$p_3$}{o1}
\fmflabel{$p_1$}{o2}
\end{fmfgraph*}%
}
-
\fmfframe(2,12.5)(2,-12.5){%
\begin{fmfgraph*}(40,25)
\fmfleftn{i}{2}
\fmfrightn{o}{2}
\fmflabel{$p_2$}{i2}
\fmflabel{$p_4$}{i1}
\fmflabel{$p_3$}{o1}
\fmflabel{$p_1$}{o2}
\fmf{photon,tension=2,fore=red}{i1,v4}
\fmf{photon,tension=2,fore=red}{o1,v1}
\fmf{dashes,tension=2}{o2,v2}
\fmf{dashes,tension=2}{i2,v3}
\fmfdotn{v}{4}
\end{fmfgraph*}%
}
\end{align*}
\end{fmffile}

\lipsum[10]

\end{document}


which should result in the following output:

The math and the graph are nicely aligned, but I would need to add something like \\\\\\ after the last \fmfframe{} command to make enough space for the text to fit... Also, it seems that there is unnecessary space between the upper text and the graph. Can this be reduced?

If possible I would like to apply these changes to all environments of the form

\begin{fmffile}{name}
\begin{align*}
\fmfframe()(){}
.
.
.
\end{align*}
\end{fmffile}


I'm not sure if it would be smart to create a new environment for this (and I lack the skill to do it anyways...). Also, I am not interested in solutions that are based on tikz-feynman.

I'd use gathered, but with a twist, because labels in Feynman diagrams are often outside the bounding box.

\documentclass{article}
\usepackage{lipsum}
\usepackage{mathtools}
\usepackage{feynmp-auto}

\newcommand{\eqgraph}[3]{%
% #1 = adjustment above, #2 = adjustment below, #3 = graph
\begin{gathered}
\raisebox{0pt}[\dimexpr\height+#1][\dimexpr\depth+#2]{\ignorespaces#3\unskip}%
\end{gathered}
}

\setlength{\unitlength}{.09cm}

\begin{document}

\lipsum[10]

\begin{fmffile}{operator_2}
$(a)-(b):= \mspace{30mu} \eqgraph{0ex}{2ex}{ \begin{fmfgraph*}(40,25) \fmfleftn{i}{2} \fmfrightn{o}{2} \fmf{dashes}{i1,v,o1} \fmf{fermion}{i2,v,o2} \fmfblob{0.15w}{v} \fmflabel{p_2}{i2} \fmflabel{p_4}{i1} \fmflabel{p_3}{o1} \fmflabel{p_1}{o2} \end{fmfgraph*} } \mspace{30mu} - \mspace{30mu} \eqgraph{0ex}{1.8ex}{ \begin{fmfgraph*}(40,25) \fmfleftn{i}{2} \fmfrightn{o}{2} \fmflabel{p_2}{i2} \fmflabel{p_4}{i1} \fmflabel{p_3}{o1} \fmflabel{p_1}{o2} \fmf{photon,tension=2,fore=red}{i1,v4} \fmf{photon,tension=2,fore=red}{o1,v1} \fmf{dashes,tension=2}{o2,v2} \fmf{dashes,tension=2}{i2,v3} \fmfdotn{v}{4} \end{fmfgraph*} }$
\end{fmffile}
\lipsum[10]

\end{document}


I'm afraid you need to do the adjustment by eye.