[Home] / Mac setup / LaTeX stuffs / Feynman Diagram

# feynMF/feynMP - Drawing Feynman Diagram

feynMFis a tool made by Thorsten Ohl to draw Feynman diagrams with LaTeX.

There are two ways to make Feynman diagrams; feynMF makes diagrams as special bitmap fonts, whereas feynMP makes diagrams as EPS files. Here, I will describe how to use feynMP, since it is simpler and the output is cleaner.

I also assume that you have MacTeX or platex for Japanese installed, and have TeXShop for Mac OS X, but even otherwise you should be able to use feynMP on your system.

## 1. How to install feynMF/feynMP

Otherwise:

2. Expand the zip file (by double clicking). (On Leopard, the folder shows up under "Downloads" in Dock.)
3. From Terminal, type
$cd ~/Downloads/feynmf$ latex (or platex) feynmf.ins

4. Next, copy 4 files into the following directories.
$mkdir -p ~/Library/texmf/tex/feynmf$ mkdir -p ~/Library/texmf/metafont/feynmf
$mkdir -p ~/Library/texmf/metapost/feynmf$ cp feynmf.sty ~/Library/texmf/tex/feynmf
$cp feynmp.sty ~/Library/texmf/tex/feynmf$ cp feynmf.mf ~/Library/texmf/metafont/feynmf
\$ cp feynmp.mp ~/Library/texmf/metapost/feynmf


## 2. A simple example

1. With TeXShop, let's make a simple diagram. Make simple latex source, my_gluon.tex, as follows.
	\documentclass{article}
\usepackage{feynmp}
\begin{document}
\unitlength = 1mm
\begin{fmffile}{gluon}
\begin{fmfgraph}(40,25)
\fmfleft{in}
\fmfright{out}
\fmf{curly}{in,out}
\end{fmfgraph}
\end{fmffile}
\end{document}

2. Typeset it by hitting "Typeset" button. This will create gluon.mp in the same directory as my_gluon.tex.
3. On Terminal, change directory to whre my_gluon.tex exists, and do
	% mpost gluon

This will read gluon.mp and create gluon.1 which is actually an EPS file.
4. Typeset the latex file again. Voilla! A curly gluon line

will show up.

## 3. How to draw something more useful

• Easiest way to learn is to follow some usual samples.
Everytime you change the diagram, make sure you run mpost for the mp file.
The latex source file of the above samples is also available.
• A complrehensive manual comes with the feynmf package. When you try examples in the manual, make sure you surrond the example by something like:
	\documentclass{article}
\usepackage{feynmp}
\begin{document}
\unitlength = 1mm
\begin{fmffile}{foo}
\begin{fmfgraph}(40,25)
..... example ...
\end{fmfgraph}
\end{fmffile}
\end{document}

The file name (shown as "foo" above) should be named properly.

## 4. Tips

• Do not put space characters between vertecies. You should write like
	\fmfleft{v1,v2,v3}     ,

and not like
	fmfleft{v1, v2, v3}   [WRONG].

Otherwise, you will get get a message like:
	feynmf: warning: dangling vertex v1' colliding with v2'.
feynmf: Have you seen the warning messages above?

when you run mp.
• The size of the diagram given in \begin{fmfgraph}(x,y) is in parenthesis, not curly brackets.
• Here is how to create Feynman diagrams using LaTeXiT. This is a great way to make diagrams for Keynote slides, etc..

2013-11-17: Taku Yamanaka