×

ShareLaTeX guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

The feynmf package lets you easily draw Feynman diagrams in your LaTeX documents. All you need to do is specify the vertices, the particles and the labels, and it will automatically layout and draw your diagram for you.

Contents

Introduction

Let's start with a quick example:

\begin{fmffile*}{diagram}
\begin{fmfgraph}(40,25)
\fmfleft{i1,i2}
\fmfright{o1,o2}
\fmf{fermion}{i1,v1,o1}
\fmf{fermion}{i2,v2,o2}
\fmf{photon}{v1,v2}
\end{fmfgraph}
\end{fmffile*}

Open this example in ShareLaTeX

The fmffile* environment must be put around all of your Feynman diagrams. You can use fmffile environment for multiple diagrams, so you can put one around your whole document and forget about it. The second argument to the fmffile environment tells LaTeX where to write the files that it uses to store the diagram. You can name this whatever you want, but you need to run metafont on your diagram between LaTeX runs in order for your diagram to show up (ShareLaTeX does this automatically):

pdflatex feynmf.tex
mf '\mode:=laserjet; input diagram'
pdflatex feynmf.tex

The 'fmfgraph' environment starts a Feynman diagram, and the figures in brackets afterwards specify the width and height of the diagram.

Vertices

The first thing you need to do is specify your external vertices, and where they should be positioned. You can name your vertices anything you like, and say where they should be positioned with the commands \fmfleft , \fmfright , \fmftop , \fmfbottom . For example

% Creates two vertices on the left called i1 and i2
\fmfleft{i1,i2}
 
% Creates two vertices on the right called o1 and o2
\fmfright{o1,o2}

You can connect up vertices with the \fmf , which will create new vertices if you pass in names that haven't been created yet. For example

% Will create a fermion line between i1 and
% the newly created v1, and between v1 and o1.
\fmf{fermion}{i1,v1,o1}
 
% Will create a photon line between v1 and the newly created v2
\fmf{photon}{v2,v2}

Labels

A vertex can be labelled using the \fmflabel command, which takes two arguments: the label to apply to the vertex, and the name of the vertex to apply it to. For example, in the above diagram, if we add in the following labels, we get the updated diagram below:

\fmflabel{$v_1$}{v1}
\fmflabel{$v_2$}{v2}

Open this example in ShareLaTeX

Note that math mode can used inside the vertex labels, as we have done above.

Line styles

We've seen the 'photon' and 'fermion' line styles above, but the feynmf package support many more.

Appearance Name(s)
Feynmf-line-curly.png gluon, curly
Feynmf-line-dbl-curly.png dbl_curly
Feynmf-line-dashes.png dashes
Feynmf-line-dashed-arrow.png scalar, dashes_arrow
Feynmf-line-dbl-dashes.png dbl_dashes
Feynmf-line-dbl-dashes-arrow.png dbl_dashes_arrow
Feynmf-line-dots.png dots
Feynmf-line-dots-arrow.png ghost, dots_arrow
Feynmf-line-dbl-dots.png dbl_dots
Feynmf-line-dbl-dots-arrow.png dbl_dots_arrow
phantom
Feynmf-line-phantom-arrow.png phantom_arrow
Feynmf-line-plain.png vanilla, plain
Feynmf-line-plain-arrow.png fermion, electron, quark, plain_arrow
Feynmf-line-dbl-plain.png double, dbl_plain
Feynmf-line-dbl-plain-arrow.png double_arrow, heavy, dbl_plain_arrow
Feynmf-line-wiggly.png boson, photon, wiggly
Feynmf-line-dbl-wiggly.png dbl_wiggly
Feynmf-line-zigzag.png zigzag
Feynmf-line-dbl-zigzag.png dbl_zigzag

Further Reading

For more information see: