FeynMF: Drawing Feynman Diagrams in LaTeX
FeynMF: Drawing Feynman Diagrams in LaTeX
Abstract
feynMF is a LAT
EX package for easy drawing of professional quality
Feynman diagrams with METAFONT (or METAPOST). feynMF lays out
most diagrams satisfactorily from the structure of the graph without any
need for manual intervention. Nevertheless all the power of METAFONT
(or METAPOST) is available for obscure cases.
Copying
feynMF is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version.
feynMF is distributed in the hope that it will be useful, but without any war-
ranty; without even the implied warranty of merchantability or fitness for a
particular purpose. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.
1
Contents
1 Introduction 4
1.1 Purpose and scope . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Relation to similar packages . . . . . . . . . . . . . . . . . . . . . 5
1.3 Historical note . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Usage 8
2.1 LATEX package and environments . . . . . . . . . . . . . . . . . . 8
2.2 Auxiliary files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Running METAFONT . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 The feynmf perl script . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Vertex mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5.1 External vertices . . . . . . . . . . . . . . . . . . . . . . . 14
2.5.2 Arcs and internal vertices . . . . . . . . . . . . . . . . . . 14
2.5.3 Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.5.4 Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.5.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.5.6 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.5.7 Manipulating the layout . . . . . . . . . . . . . . . . . . . 24
2.5.8 Skeletons . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.5.9 Pulling strings . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6 Miscellaneous commands . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.1 Graphs in graphs . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.2 Reusing diagrams . . . . . . . . . . . . . . . . . . . . . . . 30
2.6.3 Grouping . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.6.4 Changing parameters . . . . . . . . . . . . . . . . . . . . 31
2.6.5 Shrinking . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.6.6 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.6.7 Multiple vertices and arcs . . . . . . . . . . . . . . . . . . 31
2.7 Immediate mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.7.1 Arcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.7.2 Vertices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.7.3 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.7.4 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.7.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.8 Raw METAFONT . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.8.1 Extending feynMF . . . . . . . . . . . . . . . . . . . . . . 36
2.9 Common traps, trouble shooting and frequently asked questions
(FAQs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.9.1 ! Value is too large . . . . . . . . . . . . . . . . . . 39
2.9.2 Diagrams in the document are never updated . . . . . . . 40
2.9.3 Disgrams show up in the wrong spot . . . . . . . . . . . . 40
2.9.4 Spurious labels show up . . . . . . . . . . . . . . . . . . . 40
2.10 Known bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.10.1 Chaotic manual . . . . . . . . . . . . . . . . . . . . . . . . 41
2.10.2 Delayed error messages . . . . . . . . . . . . . . . . . . . 41
2.10.3 Multiple tadpoles . . . . . . . . . . . . . . . . . . . . . . . 41
2
2.10.4 Hard limits . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3
1 Introduction
1.1 Purpose and scope
In recent years, TEX1 [1] and LATEX2 [2] have revolutionized the way we share
information in theoretical physics (and other areas). Not only does TEX provide
typographical capabilities, which transcend those of commercial “wordproces-
sors” substantially, TEX documents are also completely portable. Since imple-
mentations are available on essentially all computers in use in the community,
documents can be shared without the usual restrictions of proprietary data for-
mats. This has enabled us to collaborate on papers with colleagues on the other
side of the globe, to replace the mailing of hard copy preprints by electronic
transmission and to submit these papers electronically to the publisher.
This portability comes with a price, though. TEX (and LATEX) do not address
the issue of graphical information, apart from the rudimentary (but very useful)
capabilities of the LATEX picture environment and similar packages [3]. As an
de facto standard for the inclusion of more complex graphics has emerged the
inclusion of PostScript3 files. The complete document can then be printed on
any PostScript device.
Still there are areas, where complementary approaches seem worth pursuing.
In particular this is the case, if the graphical information is highly formalized,
like the case at hand. Feynman diagrams are specified by their topology and
the type of particles connecting the vertices. Thus a given diagram can be
reproduced from a very concise specification, if the software is able to choose a
reasonable layout (semi-)automatically.
METAFONT4 [4] and METAPOST5 [5] appear to be the perfect tool for such a
purpose, since
1. METAFONT is part of any (reasonable) TEX installation, thus available to
all potential users,
2. both have very powerful graphics primitivs, which allow high quality out-
put, and
3. both have builtin linear algebra, which allows us to choose a layout auto-
matically.
Still, providing at least the basic interface in LATEX macros seems appropriate
for boosting the acceptance among the less technically oriented parts of the
audience. Thus feynMF6 [6, 7] was conceived.
feynMF is unique among packages for drawing Feynman diagrams in combining
the following features:
• Simplicity and conciseness for common diagrams. E.g. the scattering dia-
gram in figure 1 can be specified completely in five lines of LATEX:
1T
EX is a trademark of the American Mathematical Society.
2LAT X might be a trademark of Addison Wesley Publishing Company.
E
3 PostScript is
a trademark of Adobe Systems Inc.
4 METAFONT is a trademark of Addison Wesley Publishing Company.
5 John Hobby’s METAPOST is a modified version of METAFONT which generates (encap-
sulated) PostScript output. METAPOST can be build trivially on top of the web2c version of
TEX and METAFONT for UNIX. Ports to other systems should be simple.
6 feynMF is not anybody’s trademark.
4
q
\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}
\end{fmfgraph*}
5
1.3 Historical note
Parts of this code have a rather long history7 . Some of the drawing primitives
started in 1989 as [Link], a library of METAFONT macros for drawing
Feynman diagrams in my thesis. The layout had to be specified completely by
hand, which required a long edit-process-preview cycle and made [Link]
awkward to use. Nevertheless, it suited my and other’s neeeds and survived
for five years without major modifications. Early in 1994, I became aware of
Thomas Leathrum’s mfpic [10]. This inspired me to shift the user interface
from METAFONT to LATEX, because this allows a smoother blending of the
LATEX picture environment with feynMF for the purpose of labeling the graphs.
While doing this and after having been taught by Tim Stelzer’s and Bill Long’s
MADGRAPH [11] that simply minimizing the length of the graph gives much better
results than I had anticipated, I added the graph manipulation and layout code.
1.4 Architecture
Even though there has never been a proper design phase in the development of
feynMF, a certain structure has emerged, which is depicted in figure 2. A user
who is aware of this architecture should be able to use feynMF more effectively.
The most crucial aspect of the architecture is the existence of two distinct modes
with different fundamental datatypes:
• vertex mode, which deals with graphs as structures consisting of vertices
and arcs and (almost) never deals with their physical locations.
• immediate mode, which deals with METAFONT paths and pairs (i.e. co-
ordinates) and allows complete control over the physical locations.
It is of course possible to mix these modes in advanced applications. Commands
are provided to translate vertices and arcs to pairs and paths and vice versa.
Novice users with little experience in METAFONT programming should start
with vertex mode to get their job done. Later, immediate mode can be used to
create more and more complex diagrams. It is possible to create most diagrams
that can actually be calculated in vertex mode. Immediate mode is most useful
for extending line feynMF and for drawing diagrams with fancy decorations.
A word on portability: feynMF is implemented as a LATEX package. But it
should be straightforward to adapt it to other TEX macro packages because
LATEX macros have been used for convenience only and can easily be replaced or
provided in a compatibility package. The LATEX specific environment construct
can also easily be replaced by the equivalent construct in another macro package.
1.5 Conclusion
It goes without saying that feynMF is not perfect. There might be cases where
using a graphical drawing tool with a mouse can give more pleasing results in
less time. But in most cases, feynMF will give satisfactory results without any
fine tuning. These will be reproducible and independent from the computer it
is running on.
7 Which is a partial explanation, if not excuse, for its slightly incoherent structure.
6
LaTEX
Vertex Mode
Immediate Mode
Objects: \fmfforce
Objects:
vertices
pairs
arcs
paths \fmfcmd
polygons
Commands:
Commands:
\fmfi{}{}
\fmf{}{}
\fmfiv{}
\fmfv{}{}
\fmfiequ{}
\fmfleft{} vloc ...
... vpath
METAFONT
Early user reponses have been very encouraging. There seems to be a rela-
tively steep learning curve for those LATEX users that have to find out how to
run METAFONT on their systems. But once this purely technical obstacle has
been surmounted, users have been enthusiatic as well about the quality of the
generated graphs as about the ease of use of feynMF.
7
2 Usage
In addition to this manual, there exists also a concise description of feynMF in
a journal article [6], as well as a three part tutorial [7].
\usepackage{feynmf}
\begin{fmffile}{⟨METAFONT-file⟩}
...
\end{fmffile}
8 As given, this applies to L
AT X. But the installation file [Link] allows to generate
E
special versions [Link] and [Link] which are compatible with the obsolete
LATEX version 2.09. These files are to be used as documentstyle options
\documentstyle[...,feynmf209,...]{...}
or
\documentstyle[...,feynmp209,...]{...}
If you cannot use [Link] for including PostScript files, you can either hack [Link]
or upgrade to LATEX2e. Please keep in mind that feynMF has been developed for LATEX 2ε
and the LATEX 2.09 compatibility version will always be a retrofitted hack. I will accept bug
reports for the 2.09 version, but I urge everybody to move to LATEX2e, which is the one and
only supported LATEX right now.
9 feynMF understands an option pre-1.03, that is of interest for veteran users:
\usepackage[pre-1.03]{feynmf}
or
\usepackage[pre-1.03]{feynmp}
The purpose of this option is to enable processing of old input files (pre v1.02) that use
\noexpand in labels. Since the method for processing these files can clash (in rare cases) with
LATEX 2ε ’s font loading procedure, it has been disabled by default.
8
Upto 255 graphs can be placed into one METAFONT file. Currently feynMF
does not check that the 255 graph limit per file is not overrun.10 Note that
the filename for the METAFONT file given in the argument of the fmffile
environment must not be identical to the LATEX source file name, because the
METAFONT .log would be overwritten and LATEX can no longer access the
information in this .log file. It should be obvious that any umber of diagrams
can be generated by using more than one fmffile environment with different
filenames.
fmfgraph The fmfgraph environment contains the description of a single Feynman dia-
gram which will be placed a the location of the environment. Arguments are
the width and the height of the diagram, in units of \unitlength:
\begin{fmfgraph}(⟨width⟩,⟨height⟩)
...
\end{fmfgraph}
This environment does not support labels, use fmfgraph* if your diagrams
contains labels.
fmfgraph* Same as fmfgraph, but enclosed in a picture environment of the same size and
supporting LATEX labels.
\begin{fmfgraph*}(⟨width⟩,⟨height⟩)
...
\end{fmfgraph*}
\fmfframe Allows to allocate additional space around a fmfgraph*, since the labels (or the
diagram itself) might overshoot:
\fmfframe(⟨left⟩,⟨top⟩)(⟨right⟩,⟨bottom⟩){⟨box ⟩}
puts an invisible frame of the given dimensions (measured in \unitlength)
around ⟨box ⟩.
stricts filenames to eight characters with a three character extension. On this system, only 99
graphs can be placed into one METAFONT file because auxiliary files will not be unambiguous,
if more than two digits are used.
9
% [Link] % [Link] -- do not edit
... input feynmf
\usepackage{feynmf} beginchar(1,100*1pt#,50*1pt#,0);
... vinit;
latex foo
\begin{fmffile}{fd} ...
\begin{fmfchar*}(100,50) vfreeze;
... vdraw;
\end{fmfchar*} endchar;
... ...
\end{fmffile}
...
latex foo
LaTEX labels LaTEX labels font metric
fd.t1 fd.t2 information
[Link]
device independent
output file printer
[Link] dvixx foo lpr
to X/Open.
10
% [Link] % [Link] -- do not edit
... input feynmp
\usepackage{feynmp} beginchar(1,100*1pt#,50*1pt#,0);
... vinit;
latex foo
\begin{fmffile}{fd} ...
\begin{fmfchar*}(100,50) vfreeze;
... vdraw;
\end{fmfchar*} endchar;
... ...
\end{fmffile}
... mp fd encapsulated
PostScript
LaTEX labels LaTEX labels file
fd.t1 fd.t2 fd.2
latex foo
encapsulated
PostScript
file
fd.1
device independent
output file printer
[Link] dvixx foo lpr
modes.
11
install the “fonts” corresponding to the Feynman diagrams in a system direc-
tory, where they don’t belong. Adding the following lines to the [Link]
script will prevent this mishap in the teTEX distribution for UNIX (which is
derived from web2c):
if [ -r $KPSE_DOT/$[Link] ]; then
MT_PKDESTDIR=$KPSE_DOT
MT_TFMDESTDIR=$KPSE_DOT
MT_NAMEPART=
fi
The automagic tools will also not notice when a diagram has changed. These
problems suggest that it is a generally a good idea to invoke METAFONT ex-
plicitely, instead of relying on the automagic tools.
Running METAPOST is usually trivial, because not printer specific mode is
needed:
mp ⟨METAPOST-file⟩
NAME
feynmf — Process LaTeX files using FeynMF
SYNOPSIS
feynmf [-hvqncfT] [-t tfm [-t tfm ...]] [-m mode] file [file ...]
feynmf [--help] [--version] [--quiet] [--noexec] [--clean] [--force]
[--notfm] [--tfm tfm [--tfm tfm ...]] [--mode mode] file [file ...]
DESCRIPTION
The most complicated part of using the FeynMF style appears to be the proper
invocation of Metafont. The feynmf script provides a convenient front end and
will automagically invoke Metafont with the proper mode and magnifincation.
It will also avoid cluttering system font directories and offers an option to clean
them.
OPTIONS
-h, --help
Print a short help text.
-v, --version
Print the version of feynmf.
12
-q, --quiet
Don’t echo the commands being executed.
-n, --noexec
Don’t execute LaTeX or Metafont.
-c, --clean
Offer to delete font files that have accidentally been placed in a system di-
rectory by the MakeTeXTFM and MakeTeXPK scripts (these scripts
are run by tex (and latex) in the background). This option has only been
tested with recent versions of UNIX TeX.
-f, --force
Don’t ask any questions.
-T, --notfm
Don’t try to prepare fake .tfm files for the first run.
file
Main LaTeX input files.
file ...
Other LaTeX input files that are included by the main file.
AUTHOR
Thorsten Ohl <[Link]@[Link]>
BUGS
The preparation of .tfm files is not foolproof yet, because we can parse TeX
files only superficially.
This script has only been tested for recent teTeX distributions of UNIX TeX,
though it will probably work with other versions of UNIX TeX. The author will
be grateful for portability suggestions, even concerning Borg operating systems,
for the benefit of those users that are forced to live with DOS or Windows.
13
v1
v1 v2
v2 v3
v3 v4v1
v4
v3
v2
v4 v
v4
v3
v2
1
v4
v4
v5
v5
v3
v6
v2 v1 v2
v7
v1
v6
v2 v1 v2
v7
v1
v3
v3 v4
v4 v4
v1
v3
v2
v4
v3
v2
v1
connects the vertices v1,v2,. . . with a line of style ⟨style⟩, using a set of options
⟨opt⟩ with (optional) value ⟨val ⟩. If a vertex is not known yet, it is added to
the diagram. Note that the actual drawing is not done immediately, because
the positions can only be calculated when all vertices are known. The currently
available styles are collected in table 1. Most names should be self explanatory
and are not discussed further. The dashes, dots, phantom and plain styles
can optionally be decorated with an arrow as shown above. All styles, including
curly, wiggly and zigzag, can be doubled. But arrows are not available for
the latter three, because esthetically pleasing results can not be expected. The
phantom style is special, because it only enters the vertices and does not cause
a line to be drawn. This is extremely useful for advanced layout features, as
explained below. If you need a line styles that is not listed in table 1, see
section 2.8.1 for how to define your own line styles.
14
Name Example Parameters Aliases
dbl_curly curly_len
dashes dash_len
dbl_dashes dash_len
dbl_dashes_arrow dash_len
dots dot_len
dbl_dots dot_len
dbl_dots_arrow dot_len
phantom
phantom_arrow
plain vanilla
dbl_plain double
dbl_wiggly wiggly_len
zigzag zigzag_width
dbl_zigzag zigzag_len
The supported options are collected in table 213 Note that each of the dot
separated components of the options can be abbreviated. For example, l.d is
equivalent to [Link]. The result of ambiguous matches is however unde-
fined.
Note that because the options are separated by single commata, commata inside
arguments to options (label comes to mind) have to be doubled (similar to
13 One particulary useful further option would be smooth, allowing for several lines joined
smoothly. Early experimentation has shown however, that the results are not always what
one expects and that there is a lot of room for abuse.
15
Name Explanation
tension draw a tighter (> 1) or more loose (< 1)
arc
left draw on a halfcircle on the left
right draw on a halfcircle on the right
straight draw on a straight line (default)
label TEX text for labeling the arc
[Link] force placement of the label on the left
or right
[Link] place label at a distance dist
[Link] relative position of the label (not imple-
mented yet!)
tag optional tag for disambiguating arcs
width width of the line
rubout scale factor for crossing out lines
(doesn’t work properly for doubled lines
yet)
foreground foreground color (METAPOST only!)
background background color for doubled lines
(METAPOST only!)
quotes in Fortran).14
Arcs that return to their origin are allowed (I will refer to them as tadpoles),
but some options have slightly different semantics. tension is here a inverse
scale factor for the tadpole, whose default size is 2/3 of the average distance
the neighboring vertices. If left or right are specified, they give the direction
(in degrees) of the preferred gap into which the tadpole is placed. By default,
the largest gap is chosen for all tapoles at a given vertex, which will therefore
overlap. This is neither a bug nor a feature, but a limitation.
\fmfn The macro \fmfn is similar to \fmf, but
\fmfn{⟨style⟩[,⟨opt⟩[=⟨val ⟩],. . . ]}{⟨v ⟩}{⟨n⟩}
This is used for adding labels to a vertex and for specifying other decoration.
Supported options are collected in table 3. Here the same abbreviation mecha-
nism as above is in effect. The available shapes are listed in various filling styles
14 Note that, as of version 1.03, it is no longer necessary to escape T X control sequences in
E
arguments. Old files will continue to work, because noexpand is temporarily disabled.
16
Name Explanation
label TEX text for labeling the vertex
[Link] force placement of the label at the given
angle from the vertex
[Link] place label at a distance dist
[Link] shape of decoration
[Link] size of decoration
[Link] fill, shade or hatch decoration
[Link] rotate decoration
foreground foreground color (METAPOST only!)
background background color (METAPOST only!)
in table 415 . The tilings gray10, gray25, gray75 and gray90 are available in ad-
dition to gray50. Customized tilings can be created with the METAFONT func-
tion tile_from_string. It should be noted however, that tilings are gobbling
up memory at high speed and should be used with discretion. The halftones16
can be accessed by giving any number from 2 to 99, which will denote the per-
centage of saturation (30% and 70% here)17 . Again, commata inside arguments
to options have to be doubled.
\fmfblob Draw a blob of the specified diameter at the vertices. Incidentally,
\fmfblob{⟨diameter ⟩}{⟨v1 ⟩[,. . . ]}
is equivalent to
\fmfv{[Link]=circle,[Link]=shaded,
[Link]=⟨diameter ⟩}{⟨v1 ⟩[,. . . ]}
\fmfdot Draw a dot at the vertices given as arguments.
\fmfdot{⟨v1 ⟩[,. . . ]}
is equivalent to
\fmfv{[Link]=circle,[Link]=full,
[Link]=2thick}{⟨v1 ⟩[,. . . ]}
\fmfvn The macro \fmfvn is similar to \fmfv, but
\fmfvn{⟨opt⟩[=⟨val ⟩][,⟨opt⟩[=⟨val ⟩],. . . ]}{⟨v ⟩}{⟨n⟩}
places the vertices ⟨v[1]⟩. . . ⟨v[n]⟩.
\fmfdotn The macros \fmfdotn and \fmfblobn are similar to the \fmfdot and \fmfblob,
\fmfblobn but \fmfdotn{⟨v ⟩}{⟨n⟩} places the vertices ⟨v[1]⟩. . . ⟨v[n]⟩. Analogously for
\fmfblobn.
15 If the variable feymfwizard is true (e.g. after calling the \fmfwizard macro), it is also
possible to specify any METAFONT expression that evaluates to a path. Naturally, this has
to used with great care, because strange errors can be triggered by typos!
16 METAPOST will give true halftones (if your printer supports them), while METAFONT
tries to mimic them. The dithering algorithm of the latter will be improved in the future.
17 The old numeric arguments in the range −1 . . . 1 continue to work, but are considered
obsolete.
17
filled= full empty shaded hatched gray50 30 70
circle
square
triangle
! " #
diamond
$% & ' ( ) *
pentagon
+, - . / 0 1
hexagon
23 4 5 6 7 8
triagram
9: ; < = > ?
tetragram
@A B C D E F
pentagram
hexagram
G H I J
triacross cross pentacross hexacross
2.5.3 Polygons
Complex vertices with arcs attached at the corners can be contructed with
polygons, which share some characteristics with arcs and vertices.
\fmfpoly The macro
\fmfpoly{⟨style⟩[,⟨opt⟩[=⟨val ⟩],. . . ]}{⟨v1 ⟩,⟨v2 ⟩[,. . . ]}
places the vertices ⟨v1 ⟩, ⟨v2 ⟩, . . . on the corners of a regular polygon. The
orientation of the polygon is fixed to be mathematically positive (i.e. counter
clockwise). Note that this can have strange results if the orientation is opposite
to the orientation of the vertices the corners are connected to. The available
options are collected in table 5. The effects of some options are depicted in
table 6.
Note that is is technically impossible to fix the size of a polygon. The size can
be controlled by specifying a tension for the edges, which acts like the tension
of normal arcs.
\fmfpolyn The macro \fmfpolyn{⟨style⟩}{⟨v ⟩}{⟨n⟩} is similar to \fmfpoly but connects
\fmfrpolyn the vertices ⟨v[1]⟩. . . ⟨v[n]⟩. \fmfrpolyn operates in reverse order.
18
Name Explanation
filled fill, shade or hatch interior
phantom don’t draw anything
empty draw outline
shade shade interior
hatched hatch interior
full fill interior
pull pull edges in (< 0) or out (> 0)
tension tension of the edges
smooth draw smoth corners
label TEX text for labeling the polygon
[Link] force placement of the label at the given
angle from the vertex
[Link] place label at a distance dist
foreground foreground color (METAPOST only!)
background background color (METAPOST only!)
2.5.4 Color
If METAPOST is used for rendering the diagrams, vertices and arcs can be
colored. The corresponding options give a warning message under METAFONT
and are otherwise ignored.
Two colors are available for vertices and arcs: foreground and background.
Both can either be specified as a linear combination of the predefined colors
white, black, red, green and blue or as RBG triples (⟨red ⟩,⟨green⟩,⟨blue⟩).
Note that as always commata have to be doubled in option arguments. There-
fore both foreground=(1,,0,,1) and foreground=red+blue are valid options
setting the foreground color to magenta. For arcs, the background color is used
only for the interior of doubled lines.
While the color feature is rarely used in papers or books, it can be very useful
for jazzing up your transparencies. See page 27 for a not very serious example.
2.5.5 Examples
After the main features of the vertex mode have been introduced, it is time for
a couple of illustrative examples that are taken from The Real World.
\begin{fmfgraph}(40,25)
\fmfpen{thick}
19
pull= 0.75 1.0 ? 1.5
default K L M N
smooth O P Q R
default S T U V
smooth W X Y Z
default [ \ ] ^
smooth _ ` a b
Table 6: Some of the available polygon shapes. Note that pull=1.0 is identical
to pull=? for straight lines, but very different for smooth lines.
The incoming and outcoming vertices are placed on the left and right
hand side, respectively:
\fmfleft{i1,i2}
\fmfright{o1,o2}
b̄ d¯ Finally we tell feynMF to draw dots at the vertices and we’re done.
\fmfdotn{v}{4}
\end{fmfgraph}
20
With a little effort the layout of this diagram can actually be improved
by enlarging the inner box, see page 29 below.
Here is the resonant s-channel contribution to e+ e− → 4f . (From now
on, we do no longer display the
\begin{fmfgraph}(40,25)
\fmfpen{thick}
...
\end{fmfgraph}
\fmfleftn{i}{2}
\fmfrightn{o}{4}
\fmf{fermion}{i1,v1,i2}
e+ c̄ \fmf{photon}{v1,v2}
\fmfblob{.15w}{v2}
\fmf{photon}{v2,v3}
s
\fmf{fermion}{o1,v3,o2}
\fmf{photon}{v2,v4}
νµ \fmf{fermion}{o4,v4,o3}
e− µ+
And the resonant t-channel contribution:
\fmfleftn{i}{2}
e+ c̄ \fmfrightn{o}{4}
\fmf{fermion}{i1,v1,v2,i2}
\fmf{photon}{v1,v3}
s
\fmf{fermion}{o1,v3,o2}
\fmf{photon}{v2,v4}
νµ \fmf{fermion}{o4,v4,o3}
e− µ+
Two point loop diagrams pose another set of problems. We must have
a way of specifying that one or more of the lines connecting the two
vertices are not connected by a straight line. The options left, right
and straight offer the possibility to connect two vertices by a semicircle
detour, either on the left or on the right. Since by default all lines con-
tribute to the tension between two vertices, the tension option allows us
to reduce this tension. The next examples shows both options in action.
The lower fermion line is given an tension of 1/3 to make is symmetrical
with the upper line with consists of three parts. The loop photon is using
a detour on the right and does not contribute any tension.
\fmfleft{i1,i2}
\fmfright{o1}
\fmf{fermion,tension=1/3}{i1,v1}
\fmf{plain}{v1,v2}
\fmf{fermion}{v2,v3}
\fmf{photon,right,tension=0}{v2,v3}
21
p
k
p−k
\fmf{plain}{v3,i2}
\fmf{photon}{v1,o1}
p′ The optional argument to left and right can be used to deform the
corresponding contour as in the following example. The default value of
left and right is 1.
\fmfleft{i} \fmfright{o}
\fmf{plain}{i,v1} \fmf{plain}{v2,o}
\fmf{dots,left=.5,tension=0.3}{v1,v2,v1}\fmffreeze
\fmf{plain,left}{v1,v2,v1}
\fmf{dashes,left=1.5}{v1,v2,v1}
\fmfpen{thick}
\fmfleftn{l}{2}\fmfrightn{r}{2}
\fmfrpolyn{shaded,label=$\Gamma$}{G}{4}
\fmfpolyn{empty,label=$K$}{K}{4}
\fmf{fermion}{l1,G1}\fmf{fermion}{l2,G2}
\fmf{fermion}{K1,r1}\fmf{fermion}{K2,r2}
Γ K \fmf{fermion,left=.5,tension=.5}{G3,K3}
\fmf{fermion,right=.5,tension=.5}{G4,K4}
To conclude this first picture show, here’s a self energy in scalar ϕ4 -theory
showing the simplicity of the tadpole feature:
\fmfpen{thick}
\fmfleft{i}
\fmfright{o}
\fmf{plain}{i,v,v,o}
\fmfdot{v}
\fmfpen{thick}
\fmfleft{i}
\fmfright{o}
\fmf{plain}{i,v,v,o}
\fmf{plain,left=90}{v,v}
\fmfdot{v}
22
2.5.6 Labels
Let us now come back to the examples on page 21 and discuss how to add the
labels.
\fmflabel The macro
\fmflabel{⟨label ⟩}{⟨v ⟩}
is equivalent to
\fmfv{label=⟨label ⟩}{⟨v ⟩}
and adds the label ⟨label ⟩ to the vertex ⟨v ⟩. In the current implementation, there
can be only a single label for each vertex. Thus earlier calls to \fmflabel for the
same vertex will be overwritten. ⟨label ⟩ will be placed with the \put command
of the LATEX picture environment.18 Note that the fmfgraph* environment
must be used to use labels, they will silently disappear in fmfgraph.
\fmflabel gives the user no control on the placement of the the label (use the
\fmfv macro for a more fine-grained control). The label is placed using the
following algorithm:
1. The reference point of the box containing ⟨label ⟩ is placed at the distance
3thick on the continuation of the straight line connecting the center of
the picture with the vertex ⟨v ⟩.
2. The reference point of the box is chosen such that the contents of the box
is on the outside of the vertex (with respect to the center of the diagram).
It is chosen from the four corners and the four midpoints of the sides.
Therefore the four external particles in the B-B̄ mixing diagram on page 21 are
labelled simply by:
\fmflabel{$\bar{b}$}{i1}
\fmflabel{$d$}{i2}
\fmflabel{$\bar{d}$}{o1}
\fmflabel{$b$}{o2}
\fmfsurroundn{v}{8}\fmfdotn{v}{8}
v3 \fmflabel{$v_1$}{v1}
\fmflabel{$v_2$}{v2}
v4 v2
\fmflabel{$v_3$}{v3}
\fmflabel{$v_4$}{v4}
\fmflabel{$v_5$}{v5}
v5 v1 \fmflabel{$v_6$}{v6}
\fmflabel{$v_7$}{v7}
\fmflabel{$v_8$}{v8}
v6 v8
v7 18 Note again that, as of version 1.03, it is no longer necessary to escape TEX control se-
quences in arguments. Old files will continue to work, because noexpand is temporarily dis-
abled.
23
And here is a demonstration of the explicit placement of labels19 :
\fmfiv{[Link]=circle,d.f=1,[Link]=2thin}{c}
\fmfiv{l=-120,l.a=-120,l.d=.2w}{c}
120 60 \fmfiv{l=-60,l.a=-60,l.d=.2w}{c}
\fmfiv{l=0,l.a=0,l.d=.2w}{c}
180 0 \fmfiv{l=60,l.a=60,l.d=.2w}{c}
\fmfiv{l=120,l.a=120,l.d=.2w}{c}
-120 -60 \fmfiv{l=180,l.a=180,l.d=.2w}{c}
There is no equivalent to \fmflabel for arcs. Here options to the \fmf command
have to be used. The default placement rules put the label on the outside at the
midpoint of a curved arc. If the arc is straight, one should use the [Link]
option to push the label either to the left or to the right. This [Link]
option is treated analogously to same option for vertices.
Therefore the four internal particles in the B-B̄ mixing diagram on page 21 are
labelled simply by adding options to the \fmf commands:
\fmf{fermion,label=$\bar{t},,\bar{c},,\bar{u}$,
[Link]=right}{v1,v3}
\fmf{fermion,label=$t,,c,,u$,[Link]=right}{v4,v2}
\fmf{photon,label=$W^+$,[Link]=left}{v1,v2}
\fmf{photon,label=$W^-$,[Link]=right}{v3,v4}
takes the same arguments as the \fmfv command. We use it here for convenience to place
multiple vertices at the same point, i.e. the center.
24
it is possible to overconstrain the layout of the graph and the error messages
will be obscure for a novice user.
\fmffixedx \fmffixedx{⟨dx ⟩}{⟨v1 ⟩[,. . . ]} is identical to \fmffixed{(⟨dx ⟩,whatever)}{⟨v1 ⟩
\fmffixedy [,. . . ]} and \fmffixedy{⟨dy⟩}{⟨v1 ⟩[,. . . ]} is identical to \fmffixed{(whatever,⟨dy⟩)}{⟨v1 ⟩
[,. . . ]}. These commands can be used to fix relative positions in one coordinate,
while allowing movement in the other coordinate.
2.5.8 Skeletons
The single most powerful concept for adjusting feynMF’s layout decisions is the
use of skeletons. By issuing a \fmffreeze after specifying a subgraph (skeleton),
we can fix the location of the skeleton as if the other arcs were not there. We
can then successively add more subgraphs whose layout will be chosen with the
skeleton remaining fixed. Similar effects can be achieved by giving some arcs a
vanishing tension.
\fmfleft{i1} \fmfright{o1,o2}
\fmf{photon}{i1,v4}
\fmf{quark}{o1,v1,v2,v3,v4,v5,v6,v7,o2}
\fmf{gluon}{v1,v7}
\fmf{gluon}{v2,v6}
\fmf{gluon}{v3,v5}
What went wrong? Obviously the gluons are bonding the quark lines too
strongly. The fix is simple: just create a skeleton excluding the gluons
\fmfleft{i1} \fmfright{o1,o2}
\fmf{photon}{i1,v4}
\fmf{quark}{o1,v1,v2,v3,v4,v5,v6,v7,o2}
\fmfleft{i1} \fmfright{o1,o2}
\fmf{photon}{i1,v4}
\fmf{quark}{o1,v1,v2,v3,v4,v5,v6,v7,o2}
\fmffreeze
\fmf{gluon}{v1,v7}
\fmf{gluon}{v2,v6}
\fmf{gluon}{v3,v5}
\fmfleft{i1} \fmfright{o1,o2}
\fmf{photon}{i1,v4}
25
\fmf{quark}{o1,v1,v2,v3,v4,v5,v6,v7,o2}
\fmf{gluon,tension=0}{v1,v7}
\fmf{gluon,tension=0}{v2,v6}
\fmf{gluon,tension=0}{v3,v5}
\fmfleft{i1} \fmfright{o1,o2}
\fmf{photon}{i1,v3}
\fmf{quark}{o1,v1,v2,v3,v4,v5,o2}
\fmffreeze
\fmf{gluon}{v1,v4}
\fmf{gluon,rubout}{v2,v5}
If rubout is selected, it defaults to 2, but it can be changed to any
(reasonable) value > 1. The current implementation should work for
almost all user-defined line styles. However, it does not work correctly
for the predefined double line styles yet.
Another instructive example is the following: imagine you want to draw
a typical non-resonant contribution to e+ e− → 4f . The obvious solution
doesn’t look right:
\fmfleft{i1,i2}
\fmfright{o1,o2,o3,o4}
\fmf{fermion}{i1,v1,i2}
\fmf{boson}{v1,v2}
\fmf{fermion}{o1,v2,v3,o4}
\fmf{boson}{v3,v4}
\fmf{fermion}{o3,v4,o2}
\fmfleft{i1,i2}
\fmfright{o1,o2,o3,o4}
\fmf{fermion}{i1,v1,i2}
\fmf{boson}{v1,v2}
\fmf{fermion}{o1,v2,v3,o4}
\fmfleft{i1,i2}
\fmfright{o1,o2,o3,o4}
\fmf{fermion}{i1,v1,i2}
\fmf{boson}{v1,v2}
\fmf{fermion}{o1,v2,v3,o4}
26
\fmffreeze
\fmf{boson}{v3,v4}
\fmf{fermion}{o3,v4,o2}
Here’s another example that uses stretchable arcs. Diagrams of this kind
are known as rainbow diagrams. If you’re using METAPOST and are
watching this on a color device, you’ll see why.
\fmfpen{thick}
\fmfleft{i1,d1}
\fmfright{o1,d2}
\fmfn{plain}{i}{4}
\fmf{plain}{i4,v,o4}
\fmfn{plain}{o}{4}
\fmffreeze
\fmf{gluon,left,fore=red}{i1,o1}
\fmf{gluon,left,fore=green}{i2,o2}
\fmf{gluon,left,fore=blue}{i3,o3}
\fmfdotn{i}{3}
\fmfdotn{o}{3}
\fmfv{[Link]=circle,d.f=empty,[Link]=.2w,b=(1,,0,,1),
l=$\Sigma$}{v}
Σ
Experience has shown that the method advocated in this section is more effective
than fuzzing around with fractional tension parameters. Using \fmfshift or
\fmfforce should be a last resort only.
which is equivalent to
\fmf{fermion,tension=2}{v1,v2}
The phantom arc has to be added before any \fmffreeze involving these ver-
tices, of course.
\fmfleft{ip,il}
\fmfright{oq1,oq2,d1,oq3,d2,d3,ol}
\fmf{fermion}{ip,vp,vq,oq3}
20 Don’t be confused by the \fmfi command. It is described below (see section 2.7.1) and
takes the same arguments as the \fmfv command. We use it here for adding to more lines
parallel to the incoming proton line. They do not enter the layout decisions.
27
\fmf{fermion}{vp,oq1}
\fmf{fermion}{vp,oq2}
\fmf{photon}{vl,vq}
\fmf{fermion}{il,vl,ol}
\fmfblob{.15w}{vp}
\fmfdot{vq,vl}
\fmffreeze
\fmfi{plain}{vpath (__ip,__vp) shifted (thick*(0,2))}
\fmfi{plain}{vpath (__ip,__vp) shifted (thick*(1,-2))}
As it stands, all vertices come out too far to the right, because the greater
number of outgoing lines pulls them over. Adding \fmf{phantom} makes
the bond between the incoming vertices and the interactions tighter and
produces a better balanced picture:
\fmfleft{ip,il}
\fmfright{oq1,oq2,d1,oq3,d2,d3,ol}
\fmf{fermion}{ip,vp,vq,oq3}
\fmf{phantom}{ip,vp}
\fmf{fermion}{vp,oq1}
\fmf{fermion}{vp,oq2}
\fmf{photon}{vl,vq}
\fmf{fermion}{il,vl,ol}
\fmf{phantom}{il,vl}
\fmfblob{.15w}{vp}
\fmfdot{vq,vl}
\fmffreeze
\fmfi{plain}{vpath (__ip,__vp) shifted (thick*(0,2))}
\fmfi{plain}{vpath (__ip,__vp) shifted (thick*(1,-2))}
Equivalently, we could add tension to the lines in question and we will
get the same result:
\fmfleft{ip,il}
\fmfright{oq1,oq2,d1,oq3,d2,d3,ol}
\fmf{fermion,tension=2}{ip,vp}
\fmf{fermion}{vp,vq,oq3}
\fmf{fermion}{vp,oq1}
\fmf{fermion}{vp,oq2}
\fmf{photon}{vl,vq}
\fmf{fermion,tension=2}{il,vl}
\fmf{fermion}{vl,ol}
\fmfblob{.15w}{vp}
\fmfdot{vq,vl}
\fmffreeze
\fmfi{plain}{vpath (__ip,__vp) shifted (thick*(0,2))}
\fmfi{plain}{vpath (__ip,__vp) shifted (thick*(1,-2))}
Conversely, specifing a tension < 1 will make the corresponding arcs more
loose.
28
Reconsider the box graph on page 20 and reduce the tension on the inner
lines21
\fmfleft{i1,i2}
\fmflabel{$\bar{b}$}{i1}
\fmflabel{$d$}{i2}
\fmfright{o1,o2}
\fmflabel{$\bar{d}$}{o1}
\fmflabel{$b$}{o2}
\fmf{fermion}{i1,v1}
\fmf{fermion,tension=.5,label=$\bar{t},,\bar{c},,\bar{u}$,
[Link]=right}{v1,v3}
\fmf{fermion}{v3,o1}
d b \fmf{fermion}{o2,v4}
t, c, u
\fmf{fermion,tension=.5,label=$t,,c,,u$,[Link]=right}{v4,v2}
\fmf{fermion}{v2,i2}
\fmf{photon,tension=.2,label=$W^+$,[Link]=left}{v1,v2}
W+ W− \fmf{photon,tension=.2,label=$W^-$,[Link]=right}{v3,v4}
\fmfdotn{v}{4}
t̄, c̄, ū
b̄ d¯ This result is much nicer than the original.
\begin{fmfsubgraph}(⟨x ⟩,⟨y⟩)(⟨width⟩,⟨height⟩)
⟨body⟩
\end{fmfsubgraph}
The center and four corners are available as c, nw, ne, sw and se (for north-west
etc). Because of the restrictions on the overall size of the diagram in META-
FONT, this environment will, mainly be useful for preparing transparencies with
METAPOST.
\def\subgraphsample#1{%
\fmfleftn{#1i}{2}%
\fmfrightn{#1o}{2}%
\fmf{plain}{#1i1,#1v1}%
\fmf{plain}{#1o1,#1v2}%
\fmf{plain}{#1o2,#1v3}%
\fmf{plain}{#1i2,#1v4}%
\fmfcyclen{plain,tension=0.3}{#1v}{4}}
\begin{fmfgraph}(40,30)
\subgraphsample{a}
21 Now that you know, I have also displayed the label options used.
29
\fmfkeep
\fmfreuse
2.6.2
\begin{fmfsubgraph}(.3w,.3h)(.4w,.4h)
\subgraphsample{b}
\end{fmfsubgraph}
\begin{fmfsubgraph}(.45w,.45h)(.1w,.1h)
\subgraphsample{c}
\end{fmfsubgraph}
\end{fmfgraph}
More serious applications will use this feature to group together related
diagrams and use other METAFONT drawing commands for graphical
elements that are not available in the LATEX picture environment.
Reusing diagrams
After saving a pointer with \fmfkeep{⟨name⟩} inside a fmfgraph or fmfgraph*
environment, the diagram can be reused later by \fmfreuse{⟨name⟩}. This
works across fmffile environments.
Here’s an example that uses centered \parboxes to place diagrams into equa-
tions. The celebrated cancelation of quadratic divergencies in scalar selfenergies
in supersymmetric field theories can be written as:
\begin{eqnarray}
\parbox{20mm}{\begin{fmfgraph}(20,15)\fmfkeep{boson}
\fmfleft{i} \fmfright{o} \fmf{dashes}{i,v,v,o}
\end{fmfgraph}} & \propto & \Lambda^2 \\
\parbox{20mm}{\begin{fmfgraph}(20,15)\fmfkeep{fermion}
\fmfleft{i} \fmfright{o} \fmf{dashes}{i,v1} \fmf{dashes}{v2,o}
\fmf{fermion,left,tension=.3}{v1,v2,v1}
\end{fmfgraph}} & \propto & \Lambda^2 \\
\parbox{20mm}{\fmfreuse{boson}} \quad + \quad
\parbox{20mm}{\fmfreuse{fermion}} & \propto & \ln\Lambda^2
\end{eqnarray}
∝ Λ2 (1)
∝ Λ2 (2)
+ ∝ ln Λ2 (3)
2.6.3 Grouping
fmfgroup Make the enclosed \fmfset assignments local to this environment.
30
Parameter Default Semantics
thin 1pt thin arcs
thick 1.5thin thicker arcs
arrow_len 4mm length of arrow head
arrow_ang 15 opening angle of arrow head
curly_len 3mm length of one curl
dash_len 3mm length of one dash
dot_len 2mm distance of two dots
wiggly_len 4mm length of one wiggle
wiggly_slope 60 inclination of wiggles
zigzag_len 2mm length of a zig-zag period
zigzag_width 2thick width of zig-zag lines
decor_size 5mm default size of vertex decors
dot_size 4thick diameter of dots
Note that these parameters are not stored in the graph data structure for the
individual vertices and arcs. Instead the current values at the time of \fmfdraw
are used.
2.6.5 Shrinking
fmfshrink Shrink the linewidths and similar parameters in the enclosed section.
2.6.6 Debugging
\fmftrace Enable and disable tracing of the layout decisions. This is not necessarily
\fmfnotrace printed in an intuitive format, but can be helpful for debugging.
\fmfdisplay Enable online displays. \fmfstopdisplay will halt METAFONT everytime a
\fmfstopdisplay graph is complete.
executes ⟨body⟩ multiple times, setting ⟨var ⟩ to ⟨from⟩, ⟨from⟩ + ⟨step⟩, . . . , ⟨to⟩.
An application of this above feynMF feature is shown in figure 7, which is
generated by calling the TEX macro
\def\EulerHeisenberg#1{%
31
Figure 7: Higher order terms in the Euler-Heisenberg lagrangian.
\begin{fmfgraph}(40,25)
\fmfpen{thick}
\fmfsurroundn{e}{#1}
\begin{fmffor}{n}{1}{1}{#1}
\fmf{photon}{e[n],i[n]}
\end{fmffor}
\fmfcyclen{fermion,tension=#1/8}{i}{#1}
\end{fmfgraph}}
32
Figure 8: Particle-particle ring diagrams
pairs and paths. You might want to consult The METAFONT Book [4] or the
METAPOST manual [5] for further information on the available path expressions.
2.7.1 Arcs
\fmfi Immediate mode’s brother of \fmf.
2.7.2 Vertices
\fmfiv Immediate mode’s brother of \fmfv.
\fmfiv{⟨shape⟩[=⟨val ⟩][,⟨opt⟩[=⟨val ⟩],. . . ]}{⟨v ⟩}
draws a vertex at position ⟨v ⟩. Note that here ⟨v ⟩ is a METAFONT pair and not
a feynMF vertex name. The former’s equivalent of the latter can be accessed
(after \fmffreeze!) with the vloc function: vloc(⟨vertex ⟩). Again, you have
to prepend the name of the vertex in vloc’s argument with two underscores
(e.g. v1 becomes __v1).
2.7.3 Declarations
\fmfipath The argument(s) are declared METAFONT paths.
\fmfipair The argument(s) are declared METAFONT pairs (coordinates).
33
2.7.4 Assignments
\fmfiequ Establish equality for the two arguments, i.e. \fmfiequ{lval}{rval} translates
to lval=rval.
\fmfiset Assign the second argument to the first, i.e. \fmfiset{lval}{rval} translates
to lval:=rval.
Specifying equality of two variables is a very different operation from assignment
in METAFONT. See The METAFONT Book [4] for details on METAFONT’s builtin
equation solver.
2.7.5 Examples
Here is a non-trivial example of immediate mode, which shows some useful
tricks. The non-trivial aspect of the diagram in question is that it has lines
broken in two, denoting particles coupling to a condensate.
We start the diagram with a skeleton (the phantom lines are shown as
thin lines for clarity):
\fmfleft{i}
\fmfright{o}
\fmf{dots}{i,v1}
\fmf{dots}{v2,o}
\fmf{phantom,left,tension=0.2,tag=1}{v1,v2}
\fmf{phantom,left,tension=0.2,tag=2}{v2,v1}
\fmfdot{v1,v2}
\fmfposition
34
Figure 10: Circular gluons.
Here’s an interesting abuse of feynMF (see the next section for \fmfcmd):
\begin{fmfgraph*}(40,40)
\fmfipair{o,xm,xp,ym,yp}
\fmfiequ{o}{(.5w,.1h)}
\fmfiequ{xm}{(0,.1h)}
\fmfiequ{xp}{(w,.1h)}
\fmfiequ{ym}{(.5w,0)}
\fmfiequ{yp}{(.5w,h)}
\fmfiv{l=$x$,l.a=-135,l.d=2mm}{xp}
\fmfiv{l=$y=x^2$,l.a=-135,l.d=2mm}{yp}
\fmfpen{thin}
y = x2
\fmfcmd{draw xm--xp; draw ym--yp;}
\fmfpen{thick}
\fmfiequ{xs}{xpart(xp-o)}
\fmfiequ{ys}{ypart(yp-o)}
\fmfcmd{draw (o + (-xs,ys)) for n = -9 upto 10:
--(o + (xs*(n/10),ys*((n/10)**2)))
endfor;}
\end{fmfgraph*}
x
Finally, for the curious, here is how to draw the circular gluons in figure 10:
\fmfi{gluon}{fullcircle scaled .5w shifted (.5w,.5h)}
\fmfi{gluon}{reverse fullcircle scaled .5w shifted (.5w,.5h)}
35
approach can simplify the production of complex diagrams considerably. Note
that no semicolon is appended, the user has to provide it explicitely.
\fmfcmd{%
vardef cross_bar (expr p, len, ang) =
((-len/2,0)--(len/2,0))
rotated (ang + angle direction length(p)/2 of p)
shifted point length(p)/2 of p
enddef;
style_def crossed expr p =
cdraw p;
ccutdraw cross_bar (p, 5mm, 45);
ccutdraw cross_bar (p, 5mm, -45)
enddef;}
\fmfleft{i}
\fmfright{o}
\fmf{plain}{i,v,o}
\fmf{crossed}{v,v}
\fmfdot{v}
\fmfcmd{%
style_def wiggly_arrow expr p =
cdraw (wiggly p);
shrink (2);
cfill (arrow p);
endshrink;
enddef;}
36
Note how the shrink macro (which is the METAFONT equivalent of the
fmfshrink environment) is used to temporarily double the dimensions of
the arrowhead which is constructed by the arrow macro.
In particular theorists beyond the standard model are likely to need a lot
of different line styles. The aficionados of majorana neutrinos might find
the following two useful:
\fmfcmd{%
style_def majorana expr p =
cdraw p;
cfill (harrow (reverse p, .5));
cfill (harrow (p, .5))
enddef;
style_def alt_majorana expr p =
cdraw p;
cfill (tarrow (reverse p, .55));
cfill (tarrow (p, .55))
enddef;}
Note the use of the harrow and tarrow functions which return an arrow-
head on the given fraction of the path, with reference points at the head
(harrow) or tail (tarrow). The arrow function used above is equivalent
to marrow(p,.5), which has the reference point at the center of the ar-
rowhead. Having the three different reference point available is important
for supporting arcs of substantially differing lengths.
A problem of the current implementation is that the endpoints of double
lines don’t match smoothly at vertices:
\fmfpen{thick}\fmfleftn{l}{2}\fmfrightn{r}{2}
\fmfpolyn{shaded}{z}{4}
\fmf{dbl_plain_arrow}{l2,z3}
\fmf{dbl_plain_arrow}{l1,z4}
\fmf{dbl_plain_arrow}{z1,r1}
\fmf{dbl_plain_arrow}{z2,r2}
One way around is to add dots of the right size at the vertices after the
arcs have been drawn.
\fmfpen{thick}\fmfleftn{l}{2}\fmfrightn{r}{2}
\fmfpolyn{shaded}{z}{4}
\fmf{dbl_plain_arrow}{l2,z3}
\fmf{dbl_plain_arrow}{l1,z4}
\fmf{dbl_plain_arrow}{z1,r1}
\fmf{dbl_plain_arrow}{z2,r2}
\fmffreeze\fmfdraw
\fmfvn{[Link]=2thick,[Link]=circle}{z}{4}
37
Without the \fmffreeze\fmfdraw, the arcs would “know” about the
dots and would be shortened.
A more elegant solution is to define line styles with dots at the head,
tail
or both
38
2.9
2.9.1
which can be used as follows to give an equivalent result:
\fmfpen{thick}\fmfleftn{l}{2}\fmfrightn{r}{2}
\fmfpolyn{shaded}{z}{4}
\fmf{hd_dbl_plain_arrow}{l2,z3}
\fmf{hd_dbl_plain_arrow}{l1,z4}
\fmf{td_dbl_plain_arrow}{z1,r1}
\fmf{td_dbl_plain_arrow}{z2,r2}
beginchar->...rdp:=(EXPR3);w:=hround(charwd*hppp);
h:=...
l.685 ...char(64, 40*2.84526pt#, 25*2.84526pt#, 0)
;
?
dentally, the largest diagram is 40mm wide, while 4096/2601.72dpi corresponds to 39.99mm).
However, I prefer METAFONT to give an error message if the user forgot to specify the mode.
It is much more obscure when METAFONT works without errors but the dvi driver fails to
find the generated bitmap file.
23 If someone wants to use feynMF with one of these high end typesetters, I would be glad
39
2.9.2 Diagrams in the document are never updated
There are two known reasons why diagrams may not be updated the document
after the source file has been changed:
• Some dvi file previewers (e.g. xdvi(1) under UNIX) do not reread font
information if the tfm or pk files have changed, even though they reread
the dvi file if it has changed. Therefore you have to restart such previewers
if you have made changes in diagrams to see these changes on the screen.
• Some dvi drivers (e.g. dvips(1) under UNIX) do not work with the gf
files directly, but convert them with an external program to pk format
first. On later occasions, the dvi driver will then use the pk file which is
out of date with respect to the sources and the gf file. The only known
fix is to delete the pk fils before running the dvi driver.
where [Link] defines graph #1, [Link] graph #2 and [Link] defines
graph #3. If you now proceeded to add graphs to [Link], you will notice
that a second graph is accepted, but instead of the new third graph, the old
graph #3 appears. What happens is that LATEX stores the value of the counter
for fmfgraphs in each .aux file so that because [Link] is not processed, this
counter is always reset to 3 at the beginning of [Link].
Even though this situation appears to be contrived, it actually occured in real
life applications and the resulting error is very confusing.
The only “fix” for this problem would be to use a private counter behind LATEX’s
back. Unfortunately, it appears that this will violate the principle of minimal
surprise even more. It is therefore usually a good idea to reprocess the complete
document when the number of graphs has changed in an \included file. The
other solution is to have a separate fmfgraph environment for each \included
file.
40
2.10 Known bugs
2.10.1 Chaotic manual
This is being worked on. It should probably be rewritten from scratch, but I
don’t have enough time at the moment (this is a spare time activity).
Acknowledgements
I am most grateful to Wolfgang Kilian, who pushed feynMF’s predecessor
[Link] to its limits [12]. Discussions with him triggered a lot of good
41
ideas. Thanks also to my students and the people on The Net for suggestions,
portability fixes and for volunteering as guinea pigs.
References
[1] Donald E. Knuth, The TEXbook, Addison-Wesley, Reading MA, 1986.
[3] Michel Goosens, Frank Mittelbach, and Alexander Samarin, The LATEX
Companion, Addison-Wesley, Reading MA, 1994.
[5] John D. Hobby, A User’s Manual for METAPOST, Computer Science Re-
port #162, AT&T Bell Laboratories, April 1992.
[7] Thorsten Ohl, CERN Computer Newsletter 220 (1995) 22; 221 (1995) 46;
222 (1996) 24.
Distribution
feynMF is available by anonymous internet ftp from any of the Comprehensive
TEX Archive Network (CTAN) hosts
macros/latex/contrib/supported/feynmf
in the directory
42
pub/ohl/feynmf
majordomo@[Link]
and not to the lists itself. The following commands (on a line in the body of
the mail, not in the subject) are useful:
subscribe feynmf-announce
unsubscribe feynmf-announce
help
Index
Numbers written in italic refer to the page where the corresponding entry is
described; numbers underlined refer to the code line of the definition; numbers
in roman refer to the code lines where the entry is used.
Symbols C \fmf . . . . . . . . . . . . . 14
-T, –notfm@-T, color . . . . . . . . . . . . 19 \fmfblob . . . . . . . . . 17
--notfm . . . 13 crossed arcs . . . . . . . 36 \fmfblobn . . . . . . . . 17
-c, –clean@-c, --clean 13 \fmfbottom . . . . . . . 14
-f, –force@-f, --force 13 D \fmfbottomn . . . . . . . 14
-h, –help@-h, --help 12 defining new styles . . 36 \fmfcmd . . . . . . . . . . 35
-m mode, –mode displays, online . . . . . 31 \fmfcurved . . . . . . . 14
mode@-m dots . . . . . . . . . . . . . 17 \fmfcyclen . . . . . . . 16
mode, --mode \fmfdisplay . . . . . . . 31
mode . . . . . . 13 E \fmfdot . . . . . . . . . . 17
-n, –noexec@-n, environments: \fmfdotn . . . . . . . . . 17
--noexec . . . 13 fmffile . . . . . . . 8 fmffile (environ-
-q, –quiet@-q, fmffor . . . . . . . . 31 ment) . . . . . . . 8
--quiet . . . . 13 fmfgraph . . . . . . 9 \fmffixed . . . . . . . . 24
-t, –tfm tfm@-t, --tfm fmfgraph* . . . . . . 9 \fmffixedx . . . . . . . 25
tfm . . . . . . . 13 fmfgroup . . . . . . 30 \fmffixedy . . . . . . . 25
-v, –version@-v, fmfshrink . . . . . . 31 fmffor (environment) 31
--version . . 12 fmfsubgraph . . . . 29 \fmfforce . . . . . . . . 24
extensions . . . . . . . . 36 \fmfframe . . . . . . . . 9
A external vertices . . . . 14 \fmffreeze . . . . . . . 24
arcs . . . . . . . 14, 16, 33 fmfgraph (environ-
F ment) . . . . . . . 9
B file ...@file ... . . . . . . 13 fmfgraph* (environ-
blobs . . . . . . . . . . . . 17 file@file . . . . . . . . . . 13 ment) . . . . . . . 9
43
fmfgroup (environ- \fmfshift . . . . . . . . 24 O
ment) ...... 30 fmfshrink (environ- online displays . . . . . 31
\fmfi . . . . . ....... 33 ment) . . . . . . 31 OPTIONS . . . . . . . . 12
\fmfiequ . . ....... 34 \fmfstopdisplay . . . 31
\fmfipair . ....... 33 \fmfstraight . . . . . . 14 P
\fmfipath . ....... 33 fmfsubgraph (environ- parameters . . . . . . . . 31
\fmfiset . . ....... 34 ment) . . . . . . 29 polygons . . . . . . . . . . 18
\fmfiv . . . . ....... 33 \fmfsurround . . . . . . 14
\fmfkeep . . ....... 30 \fmfsurroundn . . . . . 14 R
\fmflabel . ....... 23 \fmftop . . . . . . . . . . 14 running METAFONT . 10
\fmftopn . . . . . . . . . 14 running METAPOST . 12
\fmfleft . . ....... 14
\fmfleftn . ....... 14 \fmftrace . . . . . . . . 31
\fmfv . . . . . . . . . . . . 16 S
\fmfn . . . . . ....... 16
\fmfvn . . . . . . . . . . . 17 styles, defining new . . 36
\fmfnotrace ....... 31
subgraphs . . . . . . . . . 29
\fmfpen . . . ....... 16
G
\fmfpoly . . ....... 18 T
galleries . . . . . . . . . . 14
\fmfpolyn . ....... 18 tadpoles . . . . . . . . . . 22
\fmfrcyclen ....... 16 I tracing . . . . . . . . . . . 31
\fmfreuse . ....... 30 internal vertices . 16, 17
\fmfright . ....... 14 V
\fmfrightn ....... 14 L vertices . . . . . . . . . . 33
\fmfrpolyn ....... 18 labels . . . . 14, 16, 23, 24 vertices, external . . . . 14
\fmfset . . . ....... 31 looping . . . . . . . . . . . 31 vertices, internal . 16, 17
44