[Tex/LaTex] Missing labels on Feynman Graph using feynmf

feynmfmetafont

I'm trying to create a Feynman graph using the feynmf package. My minimal example is

\documentclass{article}

\usepackage{feynmf}

\begin{document}

\begin{fmffile}{diagram}

  \begin{fmfgraph*}(40,25)
    \fmfleft{i1,i2}
    \fmfright{o1,o2}
    \fmfbottom{b}
    \fmf{fermion}{i2,v1,o2}
    \fmf{photon}{v1,b}
    \fmflabel{i1}{i1}
    \fmflabel{i2}{i2}
    \fmflabel{o1}{o1}
    \fmflabel{o2}{o2}
    \fmflabel{b}{b}
  \end{fmfgraph*}

\end{fmffile}

\end{document}

After compiling once, I have the graph but not the labels (as expected, I guess…). I get the error

pdflatex> feynmf: Label file diagram.t1 not found:

pdflatex> feynmf: Process diagram.mf with METAFONT and then reprocess this file.

OK, so I do as told and try to process the .mf file with Metafont in my terminal (using Xubuntu) with

mpost diagram.mf

And then I get stuck. It starts then stops with a question mark, and I don't know how to proceed or what Metapost is trying to tell me:

This is MetaPost, version 1.803 (kpathsea version 6.1.1)
(mpost.mp (/usr/share/texlive/texmf-dist/metapost/base/plain.mp
Preloading the plain mem file, version 1.004) ) (./diagram.mf
(/usr/share/texmf/metafont/feynmf/feynmf.mf
>> mode_setup
! Isolated expression.
<to be read again> 
                   ;
l.117 mode_setup;

? 

Can anyone help? How can I get my labels?
Thanks a lot!

Best Answer

The program to call is not Metapost, but Metafont:

mf diagram.mf

However, it's better to use feynmp that has the same syntax and produces Metapost files: you'll get diagram.mp and running mpost diagram.mp will do.

There's another possibility:

\documentclass{article}

\usepackage{feynmp-auto} % or \usepackage{feynmp}

\begin{document}

\begin{fmffile}{diagram}

  \begin{fmfgraph*}(40,25)
    \fmfleft{i1,i2}
    \fmfright{o1,o2}
    \fmfbottom{b}
    \fmf{fermion}{i2,v1,o2}
    \fmf{photon}{v1,b}
    \fmflabel{i1}{i1}
    \fmflabel{i2}{i2}
    \fmflabel{o1}{o1}
    \fmflabel{o2}{o2}
    \fmflabel{b}{b}
  \end{fmfgraph*}

\end{fmffile}

\end{document}

The package feynmp-auto (which I'm the author of) even avoids the need of running manually mpost: the diagram is compiled at the end of a run (with pdflatex only if the source has been modified in the current LaTeX run) and will correctly place it at the next LaTeX run.

enter image description here