Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456 Drawing Feynman diagrams with LaTeXiT and feynmp on Mac OS X
How to draw Feynman diagrams with LaTeXiT on Mac OS X
You can draw Feynman diagrams using LaTeXiT.
This is an easy way to put diagrams in Keynote slides, etc..
Launch LaTeXiT. In the LaTeXiT > Preferences... > Typesetting panel, press the pull-down menu next to "Configuration" and
select "Edit the configurations ...".
Press "+" button, rename "Copy of default" to "feynmp", and press "OK".
In the same Preferences > Typesetting > Behaviour panel,
choose "latex + dvipdf".
Press "Additional scripts" button, enable "Middle-processing", and
enter a 3-line scipt as shown below.
Close the Preferences panel.
3. How to draw Feynman diagrams
In the LaTeXiT panel to enter LaTeX source code, pull down a knob in the middle
to disclose preamble. Add
\usepackage{feynmp}
in the preamble. Write the feynmf/feynmp source code in the usual editing area underneath.
You can copy and paste from here, too.
because "feyngraph" is the file name you specified in the middle-processing script for "feynmp" configuration.
(You can use this same name for different diagrams, since it is just a
temporary file name.)
From the LaTeXiT pulldown menu at the top, select "Palettes > Composition configurations". Select "feynmp" configuration that we just
created.
Choose "Text" mode, and press "LaTeX it!" button.
You can drag the Feynman diagram to Keynote or other applications, or keep it in LaTeXiT Library
for future use.
If you have multiple \begin{fmffile}{...} in your source, use the
following middle-processing script, provided by Pierre Chatelier (father of LateXiT).
In this case, use different filename for each diagram.
#first, extract all fmffiles of the input text file
FMFFILES=`cat "${INPUTTEXFILE}" | grep "begin{fmffile}" | sed "s/.*\\begin{fmffile}{\([^}]*\)}/\1/g"`
#run mpost for each fmffile
for i in ${FMFFILES}; do
mpost $i
done
#re-run latex now that mpost has been run
latex ${INPUTTEXFILE}
dvipdf ${OUTPUTDVIFILE}
To go back to normal equations, just select "default" from the "Composition configuration" panel.