Re: [NTG-context] Feynman Diagrams

2023-04-13 Thread Hans Hagen via ntg-context

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
-

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Gavin via ntg-context
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
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Aditya Mahajan via ntg-context
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 >  1
metapost> trace >  #
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 >  bp# := bp;
metapost> trace >

My guess is that it could be something to do with bp# being used as a variable, 
but I am not 100% sure on that. 

In principle, it should be easier to adapt the feynmp.mp (attached) code to 
make it work with LMTX. The feynmp.sty package, simply provide a high level 
macro wrapper around this mp code, and it is relatively simply to do something 
similar in context; but the MP file isn't that different from the latex code 
anyways.

Aditya%%
%% This is file `feynmp.mp',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% feynmf.dtx  (with options: `base,mp')
%% 
%% Copyright (C) 1989, 1990, 1992-1995 by thorsten@physik.th-darmstadt.de
%% 
%% This file is NOT the source for feynmf, because almost all comments
%% have been stripped from it.  It is NOT the preferred form of feynmf
%% for making modifications to it.
%% 
%% Therefore you can NOT redistribute and/or modify THIS file.  You can
%% however redistribute the complete source (feynmf.dtx and feynmf.ins)
%% 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.
%% 
%% As a special exception, you can redistribute parts of this file for
%% the electronic distribution of scientific papers, provided that you
%% include a short note pointing to the complete source.
%% 
%% Feynmf is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; 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.
%% 

%% \CheckSum{924}
%% \CharacterTable
%%  {Upper-case  

Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Gavin via ntg-context
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

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Aditya Mahajan via ntg-context
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


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Gavin via ntg-context
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
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread Mikael Sundqvist via ntg-context
Hi,

On Wed, Apr 12, 2023 at 1:41 PM Hans Hagen via ntg-context
 wrote:
>
> 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)
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Feynman Diagrams

2023-04-12 Thread 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

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___