## 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.

## Introduction

\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*}

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}

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)
gluon, curly
dbl_curly
dashes
scalar, dashes_arrow
dbl_dashes
dbl_dashes_arrow
dots
ghost, dots_arrow
dbl_dots
dbl_dots_arrow
phantom
phantom_arrow
vanilla, plain
fermion, electron, quark, plain_arrow
double, dbl_plain
double_arrow, heavy, dbl_plain_arrow
boson, photon, wiggly
dbl_wiggly
zigzag
dbl_zigzag