[Tex/LaTex] feynmp – ! Missing $ inserted

feynmf

I'm trying to execute the code:

\documentclass{article}
\usepackage{feynmp}

\begin{document}
\unitlength = 1mm
% determine the unit for the size of diagram.

\begin{fmffile}{fmfile}{simple_tree}
\begin{fmfgraph}{50,35}
\fmfleft{i1,i2}
\fmfright{o1,o2,o3,o4,o5,o6,o7,o8,o9,o10,o11}
\fmf{fermion}{i1,v1,o1}
\fmf{gluon}{v1,v2}
\fmf{fermion}{o2,v2,v3}
\fmf{fermion}{v3,v4,v5,o3}
\fmf{fermion}{v5,v6}
\fmf{fermion}{o4,o5}
\end{fmffile} 
\end{document}

However, I get an error that begins with

! Missing $ inserted 

May I ask where I am going wrong here?

Edit: I've changed the code as follows, with the feynmp-auto and graph corrections:

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

\begin{document}
\unitlength = 40mm
% determine the unit for the size of diagram.

\begin{fmffile}{simple_tree}
\begin{fmfgraph}(50,35)
\fmfleft{i1,i2}
\fmfright{o1,o2,o3,o4,o5}
\fmf{fermion}{i1,v1,o1}
\fmf{gluon}{v1,v2}
\fmf{fermion}{o2,v2,v3}
\fmf{fermion}{v3,v4,v5,o3}
\fmf{gluon}{v5,v6}
\fmf{fermion}{o4,v6,o5}
\end{fmfgraph}
\end{fmffile}
\end{document}

Now however I get the error:

! LaTeX Error: File `feynmp-auto.sty' not found.

from Texmaker. I used command line and get the same thing.

Best Answer

The syntax of the fmffile environment is

\begin{fmffile}{<filename>}

so with your code the file name is fmfile and LaTeX doesn't know what to do with {simple_tree} and so tries to typeset it.

The file name is that of the output Metapost file; if you want to call it simple_tree, say

\begin{fmffile}{simple_tree}

There's an error also in the following line, which should be

\begin{fmfgraph}(50,35)

with parentheses rather than braces.

Finally, \end{fmfgraph} is missing. Correct code:

\documentclass{article}
\usepackage{feynmp}

\begin{document}
\setlength{\unitlength}{1mm}
% determine the unit for the size of diagram.

\begin{fmffile}{simple_tree}
\begin{fmfgraph}(50,35)
\fmfleft{i1,i2}
\fmfright{o1,o2,o3,o4,o5,o6,o7,o8,o9,o10,o11}
\fmf{fermion}{i1,v1,o1}
\fmf{gluon}{v1,v2}
\fmf{fermion}{o2,v2,v3}
\fmf{fermion}{v3,v4,v5,o3}
\fmf{fermion}{v5,v6}
\fmf{fermion}{o4,o5}
\end{fmfgraph}
\end{fmffile} 
\end{document}

Note

Compiling this with Metapost gives errors:

feynmf: warning: dangling vertex `v6' colliding with `v5'.
feynmf: Have you seen the warning messages above?
        They are usually caused by misspelling a vertex'
        name and can trigger errors further below!
        Fix the typos and run LaTeX and Metafont again.

Fix the code before trying.

Suggestion

If you have an up-to-date TeX distribution you can change

\usepackage{feynmp}

into

\usepackage{feynmp-auto}

that will take care of the Metapost run (two LaTeX runs are necessary anyway if the code in the fmffile environment is changed).