[Mac OS X Softwares], [Setting up Mac]

feynMF/feynMP - Drawing Feynman Diagram

tree diagram

feynMFis a tool made by Thorsten Ohl to draw Feynman diagrams in 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 (as I learned at pTeX forum).

I also assume that you have latex or platex installed, and have TeXShop for Mac OS X, but even otherwise you should be able to follow.

How to install feynMF/feynMP

  1. Download feynmf.zip from CTAN site.
  2. Expand the zip file (by double clicking). (On Leopard, the folder shows up under "Downloads" in Dock.)
  3. From Terminal, go into the feynmf directory ( on Leopard, ~/Downloads/feynmf), and type
    % latex (or platex) feynmf.ins
  4. Next, copy 4 files into specific directories. If you are the only person who uses feynmf, you can copy them under your home directory.
    If you are using platex (to also handle Japanese) (with or without Mac OS X TeXShop), the directory is "~/texmf/" as shown below. If you are using teTeX + TeXShop, the directory is "~/Library/TeXShop/", instead.
    	% mkdir -p ~/texmf/tex/feynmf
    	% mkdir -p ~/texmf/metafont/feynmf
    	% mkdir -p ~/texmf/metapost/feynmf
    	% cp feynmf.sty ~/texmf/tex/feynmf
    	% cp feynmp.sty ~/texmf/tex/feynmf
    	% cp feynmf.mf ~/texmf/metafont/feynmf
    	% cp feynmp.mp ~/texmf/metapost/feynmf
    					

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
    gluon
    will show up.

How to draw something more useful

Tips


March 4, 2010, Taku Yamanaka