4

I am trying to draw a feynman diagram using feynmf in TXC. I use the following code

    \documentclass{article}
    \usepackage{feynmf}
    \begin{document}
    \unitlength = 1mm
    % determine the unit for the size of diagram.
    ... here comes an example with feynmf
     \begin{fmffile}{one}   %one.mf will be created for this feynman diagram  
       \fmfframe(1,7)(1,7){     %Sets dimension of Diagram
       \begin{fmfgraph*}(110,62) %Sets size of Diagram
        \fmfleft{i1,i2} %Sets there to be 2 sources 
        \fmfright{o1,o2}    %Sets there to be 2  outputs
        \fmflabel{$e^-$}{i1} %Labels one of the left sources
        \fmflabel{$e^+$}{i2} %Labels one of the left sources
        \fmflabel{${\ensuremath{\erlpm}}$}{o1} %Labels one of the right outputs
        \fmflabel{${\ensuremath{\erlpm}}$}{o2} %Labels one of the right outputs
        \fmf{fermion}{i1,v1,i2} %Connects the sources with a vertex.
        \fmf{fermion}{o1,v2,o2} %Connects the outputs with a vertex.
        \fmf{photon,label=$\gamma/Z^0$}{v1,v2} %Labels the conneting line.
       \end{fmfgraph*}
      }
    \end{fmffile}

The thing is, that no error occurs, however no diagram is printed. Searching the web I found that I have to run LaTeX, then run metafont and run LaTeX again. Somehow I have to pre-produce the file "ome.mf" and run, I don't know how to do it, though. Any ideas?

Thanos
  • 12,446

1 Answers1

4

Running (pdf)latex on the file should produce a file called one.mf in the same directory as your main .tex file.

You need to open a command window (or DOS shell, or whatever it's called) cd to the directory and issue

mf one.mf

However, you can say

\usepackage{feynmp}

which will create one.mp. You'd run

mpost one.mp

This is vastly more efficient than the Metafont method.

For even more convenience, use the feynmp-auto package, which will automatically run mpost (for this to work with MikTex you have to add the -enable-write18 switch to the argument list of (pdf)latex)

egreg
  • 1,121,712
  • In TXC, you can add pre- and post-processor instructions to an output profile, including a "File path without extension" parameter, so adding the post-processor mpost "%bm.mp", probably followed by another (pdf)latex run, should do the trick. If you add this to your default output profile make sure you add some error catching, since a non-existent .mp file will otherwise cause TXC to believe compilation failed and refuse to "compile & show" (it will compile, but due to the error won't show the result) – Tobias Kienzler May 02 '13 at 06:23