Possible Duplicate:
How to use kile with feynmf or feynmp?

I would like to use feynmf, or better feynmp, with pdflatex. My first idea was to replace all the files file.[0-9]* which are produced after running mpost on file.mp corresponding to a \fmffile{file} environment by their PDF version obtained with epstopdf. But unfortunately pdflatex complains

! LaTeX Error: Unknown graphics extension: .1.

Obviously it does not know the filetype from this extension. How can I tell LaTeX that these are PDF files? The names of the files do of course not appear explicitly in my LaTeX source. Note that I looked at How to use kile with feynmf or feynmp? which does not seem to work for me. Also I would prefer a solution which allows me to be able to compile with both latex and pdflatex (of course after generating the corresponding feynmf graph files). I do not mind running feynmf and mpost by hand.


1 Answer 1


Metapost creates postscript files, so to include them in a pdflatex-processed document, you need to make an extra step. One of the ways of doing it is to use the package pst-pdf. Here is an example.

First, here is the document (tmp.tex):



\begin{fmfgraph*}(40,30) \fmfpen{thick}
\fmfleft{i1,i2} \fmfright{o1,o2}
\fmf{fermion}{i1,v1,o1} \fmf{fermion}{i2,v2,o2}
\fmf{photon,label=$q$}{v1,v2} \fmfdot{v1,v2}


As you see, the stuff in postscript is inside postscript environment.

Now the workflow

latex tmp                 # Produces the metapost input
mpost t.mp                # Produces t.1 and t.t1.  Can be repeated
                          # for several Feynman diagrams
latex tmp                 # Creates the dvi file with figures
dvips -o tmp-pics.ps tmp  # Creates the ps file with figures
ps2pdf tmp-pics.ps        # Creates the pdf file with figures
pdflatex tmp              # Compiles the result

And the result:

enter image description here ps2pdf tmp-pics.ps

  • 5
    There is no need to do all those steps: what's sufficient is adding \DeclareGraphicsRule{*}{mps}{*}{} to the document and running mpost t.
    – egreg
    Apr 13, 2012 at 22:01
  • hmmm... I agree.
    – Boris
    Apr 14, 2012 at 0:44
  • 1
    Or just do \usepackage{feynmp-auto} instead of \usepackage{feynmp}
    – Stan
    Jun 10, 2015 at 11:35

Not the answer you're looking for? Browse other questions tagged .