Hi List, I’m looking for a way to include Feynman diagrams in my ConTeXt documents. I’ve used feynMF/feynMP and TikZ-feynman with LaTeX in the past, but it doesn’t look like either works directly with ConTeXt. My diagrams are pretty basic (example below). Does anyone have a ConTeXt solution they like? If not, I’ll add it to my list of summer MetaPost projects. Thanks! Gavin
On 4/12/2023 5:45 AM, Gavin via ntg-context wrote:
Hi List,
I’m looking for a way to include Feynman diagrams in my ConTeXt documents. I’ve used feynMF/feynMP and TikZ-feynman with LaTeX in the past, but it doesn’t look like either works directly with ConTeXt. My diagrams are pretty basic (example below). Does anyone have a ConTeXt solution they like? If not, I’ll add it to my list of summer MetaPost projects. Maybe Alan's node module can do the work,
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hi,
On Wed, Apr 12, 2023 at 1:41 PM Hans Hagen via ntg-context
On 4/12/2023 5:45 AM, Gavin via ntg-context wrote:
Hi List,
I’m looking for a way to include Feynman diagrams in my ConTeXt documents. I’ve used feynMF/feynMP and TikZ-feynman with LaTeX in the past, but it doesn’t look like either works directly with ConTeXt. My diagrams are pretty basic (example below). Does anyone have a ConTeXt solution they like? If not, I’ll add it to my list of summer MetaPost projects. Maybe Alan's node module can do the work,
Hans
We were looking a bit at other feynman packages. It would be nice to have a not too complicated syntax, but maybe just have some of the "shapes" of paths available. So, which ones are actually needed? /Mikael (after discussing with Hans)
Hi Hans, Alan, Mikael, and other Feynman fans, I do think Alan's node module could do a good job with this.
It would be nice to have a not too complicated syntax, but maybe just have some of the "shapes" of paths available. So, which ones are actually needed?
I think the needed shapes are: - dashed or dotted paths already built into MetaPost - paths that are wiggly, zig-zag or coiled - optional arrows on the paths - optional dots or blobs at the connecting points This is plenty for someone doing Standard Model physics. Model builders doing supersymmetric, walking-technicolor, bla-bla need more, of course, but I’d let them program their own shapes. The package feynMP already has all of these paths, as well as double-line variants, coded in MetaPost. If I could use feynMP with ConTeXt, that’s what I’d do. It produces very nice diagrams. Gavin
On Wed, 12 Apr 2023, Gavin via ntg-context wrote:
Hi Hans, Alan, Mikael, and other Feynman fans,
I do think Alan's node module could do a good job with this.
It would be nice to have a not too complicated syntax, but maybe just have some of the "shapes" of paths available. So, which ones are actually needed?
I think the needed shapes are: - dashed or dotted paths already built into MetaPost - paths that are wiggly, zig-zag or coiled - optional arrows on the paths - optional dots or blobs at the connecting points
This is plenty for someone doing Standard Model physics. Model builders doing supersymmetric, walking-technicolor, bla-bla need more, of course, but I’d let them program their own shapes.
The package feynMP already has all of these paths, as well as double-line variants, coded in MetaPost. If I could use feynMP with ConTeXt, that’s what I’d do. It produces very nice diagrams.
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? Aditya
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? Gavin
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 >
Hi Aditya, Thanks for the suggestions. I hadn’t thought to dig into the MetaPost produced when typesetting a LaTeX document.
In principle, it should be easier to adapt the feynmp.mp (attached) code to make it work with LMTX.
This sounds like a good summer project for me. I’ll be doing a lot of MetaPost this summer. Gavin
On 4/13/2023 4:42 AM, Gavin via ntg-context wrote:
Hi Aditya,
Thanks for the suggestions. I hadn’t thought to dig into the MetaPost produced when typesetting a LaTeX document.
In principle, it should be easier to adapt the feynmp.mp (attached) code to make it work with LMTX.
This sounds like a good summer project for me. I’ll be doing a lot of MetaPost this summer. maybe alan can make you an examples in the node module, then we can see what 'lines' are needed. The ones in fyenmp are not that sophisticates (can be made nicer)
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Aditya Mahajan
-
Gavin
-
Hans Hagen
-
Mikael Sundqvist