# How to denote the labels in loop-diagram using package feynmp?

To draw a loop diagram, such as the self-energy of photon, like the below example:

I tried those codes

\begin{fmffile}{loop} % Loop correction
\begin{fmfgraph*}(80,65)
\fmfkeep{loop}
\fmfleft{ve1}
\fmfright{ve4}]
\fmflabel{$P \rightarrow$}{ve1}
\fmf{photon}{ve1,ve2}
\fmf{photon}{ve3,ve4}
\fmf{fermion,right,label=$K$,label.side=top,label=$K - P$,label.side=bottom,tension=.23}{ve2,ve3,ve2}
\end{fmfgraph*}
\end{fmffile}


but those codes was unsuccessful to make the both top and bottom labels, and the position for $P$ , on the left side:

How can I deal with the label problem?

Although you mention that you are using FeynMP, I offer an alternative here which uses TikZ-Feynman (CTAN) to draw Feynman diagrams.

\documentclass[tikz,convert]{standalone}

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

\begin{document}
\feynmandiagram [horizontal=a to b, layered layout] {
a -- [photon, momentum=$$p$$] b
-- [fermion, half left, momentum=$$k$$] c
-- [fermion, half left, momentum=$$p-k$$] b,
c -- [photon, momentum=$$p$$] d,
};
\end{document}


• To compile the above code, Lulatex is demanded , right ? I installed the package tikz-feynman, and the diagram is messy, the log reported Package tikz-feynman Warning: The key you tried to use '/tikz/graphs/spring layout' requires LuaTeX. It will be ignored. on input line 5. Package tikz-feynman Warning: The key you tried to use '/tikz/horizontal' requires LuaTeX. It will be ignored. on input line 5. – Zoe Rowa Mar 26 '16 at 16:01
• I run the above code using Luatex, and added the pic into the original article, because I am using the xelatex to produce PDF. I wonder if there is any way I can compile such codes in XeLatex, that would be more convenient. Thank you a lot. – Zoe Rowa Mar 26 '16 at 16:29
• @ZoeRowa Curiously, what is it that LuaTeX can't do that XeTeX does? Most packages which require XeTeX work also on LuaTeX. Anyway, you can externalize the generation of TikZ pictures so that it LuaTeX is used for them regardless of what the original compiler is. I have some instructions here detailing how that can be done. – JP-Ellis Mar 27 '16 at 0:02

If you specify a label in the fmf command it applies to all the segments of line it defines. It can't apply different arguments to different parts of the line. The simplest solution is to just use two fmf commands and specify each part separately as given below. The other option would be to draw the lines then add the labels in a second step but for this case at least thats too complex.

\begin{fmffile}{loop} % Loop correction
\begin{fmfgraph*}(80,65)
\fmfkeep{loop}
\fmfleft{ve1}
\fmfright{ve4}]
\fmflabel{$P \rightarrow$}{ve1}
\fmf{photon}{ve1,ve2}
\fmf{photon}{ve3,ve4}
\fmf{fermion,right,label=$K$,label.side=top,tension=.23}{ve2,ve3}
\fmf{fermion,right,label=$K - P$,label.side=bottom,tension=.23}{ve3,ve2}
\end{fmfgraph*}
\end{fmffile}