![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Wed, 12 Apr 2023, Gavin via ntg-context wrote:
Hi Aditya,
Have you tried using feynmp (the metapost macros) directly instead of the LaTeX wrapper? Can you create an example that works with metapost but fails in ConTeXt?
No, I’m not sure how to do that. I looked at the manual, and it has some examples where new styles are written in MetaPost, but every diagram is drawn with the LaTeX wrapper. I looked in the source files, and maybe feynmf.dtx has everything to produce documentation for the MetaPost macros, but if so, I’m not sure how to generate that documentation.
Can you point me to an example that works with metapost macros directly?
I have never used feynMP, so I am just copy-pasting an example from
https://osksn2.hep.sci.osaka-u.ac.jp/~taku/osx/feynmp/fmfsamples.pdf
\documentclass{article}
\usepackage{feynmp}
\begin{document}
\unitlength = 1mm
\begin{fmffile}{simple}
\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}
\end{document}
This creates a file simple.mp in the same directory (kind of like the old mkii way of including MP in context):
% simple.mp -- do not edit, generated automatically by test1.tex
input feynmp
require_RCS_revision "1.30";
beginchar(1, 40*2.84526pt#, 25*2.84526pt#, 0);
"feynmf: 1";
LaTeX_unitlength:=2.84526pt;
subgraph (0, 0, w, h);
vinit;
pickup pencircle scaled thin;
vleft (__i1, __i2);
vright (__o1, __o2);
vconnect ("fermion", __i1, __v1, __o1);
vconnect ("fermion", __i2, __v2, __o2);
vconnect ("photon", __v1, __v2);
vfreeze;
vdraw;
endsubgraph;
endchar;
% the end.
end.
endinput;
So, I created a context file:
\startMPinclusions
input feynmp;
require_RCS_revision "1.30";
\stopMPinclusions
\starttext
\startMPpage
beginchar(1, 40*2.84526pt#, 25*2.84526pt#, 0);
"feynmf: 1";
LaTeX_unitlength:=2.84526pt;
subgraph (0, 0, w, h);
vinit;
pickup pencircle scaled thin;
vleft (__i1, __i2);
vright (__o1, __o2);
vconnect ("fermion", __i1, __v1, __o1);
vconnect ("fermion", __i2, __v2, __o2);
vconnect ("photon", __v1, __v2);
vfreeze;
vdraw;
endsubgraph;
endchar;
\stopMPpage
\stoptext
but compiling that fails with
metapost > trace >
metapost > trace > loading metafun for lmtx, including the plain 1.004 base definitions
metapost > trace >
metafun > log >
metafun > log > error: Isolated expression
metafun > log >
metapost > trace > <error> 1
metapost > trace > <to be read again> #
metafun > log >
metafun > log > I couldn't find an '=' or ':=' after the expression that is shown above this
error message, so I guess I'll just ignore it and carry on.
metafun > log >
metapost > trace >