# Using feynmp in overleaf

I'm trying to create this diagram in overleaf:

I can create this on texstudio by using the package feynmp, the code is as follows:

\begin{fmffile}{diagram}
\begin{fmfgraph*}(100,50)
\fmfcmd{
path qc[],otimes;
qc[1] = (0,0) -- (.5,0) & quartercircle & (0,.5) -- (0,0);
qc[2] = qc[1] rotated 90;
qc[3] = qc[1] rotated 180;
qc[4] = qc[1] rotated 270;
otimes = (qc[1] & qc[2] & qc[3] & qc[4] -- cycle) rotated 45;
}
\fmfwizard
\fmfv{d.sh=otimes,d.f=empty}{l}
\fmfv{d.sh=otimes,d.f=empty}{r}
\fmfleft{l}
\fmfright{r}
\fmf{photon}{l,vl}
\fmf{fermion,right=1,label=$k$}{vl,vr}
\fmf{fermion,right=1,label=$k-q$}{vr,vl}
\fmf{photon}{vr,r}
\fmflabel{$j^\mu~$}{l}
\fmflabel{$~j^\nu$}{r}

\end{fmfgraph*}
\end{fmffile}


Unfortunately on overleaf, it appears to only allow me to use feynmf, an outdated version of the package. Does anyone know how to either get feynmp to work with overleaf, or how to create this diagram with feynmf? I tried compiling and running metapost on my laptop then uploading all the files to overleaf, but this didn't work.

• You should ask Overleaf support for help. Oct 10, 2021 at 19:41
• OT from your question, but (0,0) -- (.5,0) & quartercircle & (0,.5) -- (0,0); can be (much better) expressed as origin -- quartercircle -- cycle. Oct 11, 2021 at 20:35

Your code works fine for me on Overleaf with feynmp and pdflatex:

\documentclass{article}

\usepackage{feynmp}
\DeclareGraphicsRule{*}{mps}{*}{}

\begin{document}
\begin{fmffile}{diagram}
\begin{fmfgraph*}(100,50)
...
\end{fmfgraph*}
\end{fmffile}
\end{document}


• Ho. What Is please the rule of declaregraphicrule? Why do you have put this? Oct 11, 2021 at 11:06
• mps is the cut-down form of eps that MP will produce unless you put prologues := 3; at the top. And the line tells the graphics driver about it. Not necessary if you use xelatex or lualatex. Oct 11, 2021 at 19:11
• Amazing so if you just put the declargraphicsrule at the top it fixes everything! Thanks :) Oct 11, 2021 at 19:51