Overleaf

Reimplementation of diagrams from https://www.overleaf.com/learn/latex/Feynman_diagrams

[1]:
from feynml import FeynmanDiagram, Leg, Propagator, Vertex
from pyfeyn2.render.all import AllRender
from pyfeyn2.render.latex.tikzfeynman import TikzFeynmanRender
from pyfeyn2.auto.position import feynman_adjust_points
[2]:
v1 = Vertex().with_xy(-1, 0)
v2 = Vertex().with_xy(1, 0)

fd = FeynmanDiagram().add(
    v1,
    v2,
    Propagator().connect(v1, v2).with_type("photon").put_style('opacity',0.2).with_style_property('color','red').with_momentum("$k$"),
    Leg().with_target(v1).with_xy(-2, 1).with_type("fermion").with_incoming().with_label("$e^{+}$").with_style_property('opacity',0.2),
    Leg().with_target(v1).with_xy(-2, -1).with_type("fermion").with_incoming().with_label("$e^{-}$").with_style_property('opacity',0.2),
    Leg().with_target(v2).with_xy(2, 1).with_type("fermion").with_outgoing().with_label("$\\mu^+$").with_style_property('opacity',0.2),
    Leg().with_target(v2).with_xy(2, -1).with_type("fermion").with_outgoing().with_label("$\\mu^-$").with_style_property('opacity',0.9),
)
ar = AllRender(fd)
ar.render()
/tmp/ipykernel_484/3445839438.py:7: DeprecatedWarning: put_style is deprecated as of 0.0.0.
  Propagator().connect(v1, v2).with_type("photon").put_style('opacity',0.2).with_style_property('color','red').with_momentum("$k$"),
tikz:
../../_images/gallery_overleaf_overleaf_2_2.png
pyx:
../../_images/gallery_overleaf_overleaf_2_4.png
feynmp:
../../_images/gallery_overleaf_overleaf_2_6.png
feynman:
../../_images/gallery_overleaf_overleaf_2_8.png
dot:
../../_images/gallery_overleaf_overleaf_2_10.png
mermaid:
../../_images/gallery_overleaf_overleaf_2_12.svg
asciipdf:
../../_images/gallery_overleaf_overleaf_2_14.png
unicodepdf:
../../_images/gallery_overleaf_overleaf_2_16.png
madgraph:
../../_images/gallery_overleaf_overleaf_2_18.png
root:
../../_images/gallery_overleaf_overleaf_2_20.png
Info in <TCanvas::SaveSource>: C++ Macro file: /tmp/tmpnaab_9_v.tex has been generated
Info in <TCanvas::Print>: TeX file /tmp/tmp96oc6ou1.tex has been created
[3]:
v1 = Vertex().with_xy(-1, 0)
v2 = Vertex().with_xy(1, 0)

fd = FeynmanDiagram().add(
    v1,
    v2,
    Propagator().connect(v1, v2).with_type("fermion"),
    Leg().with_target(v1).with_xy(-2, 1).with_type("fermion").with_incoming(),
    Leg().with_target(v1).with_xy(-2, -1).with_type("photon").with_incoming(),
    Leg().with_target(v2).with_xy(2, 1).with_type("fermion").with_outgoing(),
    Leg().with_target(v2).with_xy(2, -1).with_type("photon").with_outgoing(),
)
ar = AllRender(fd)
ar.render()
tikz:
../../_images/gallery_overleaf_overleaf_3_1.png
pyx:
../../_images/gallery_overleaf_overleaf_3_3.png
feynmp:
../../_images/gallery_overleaf_overleaf_3_5.png
feynman:
../../_images/gallery_overleaf_overleaf_3_7.png
dot:
../../_images/gallery_overleaf_overleaf_3_9.png
mermaid:
../../_images/gallery_overleaf_overleaf_3_11.svg
asciipdf:
../../_images/gallery_overleaf_overleaf_3_13.png
unicodepdf:
../../_images/gallery_overleaf_overleaf_3_15.png
madgraph:
../../_images/gallery_overleaf_overleaf_3_17.png
root:
../../_images/gallery_overleaf_overleaf_3_19.png
Info in <TCanvas::SaveSource>: C++ Macro file: /tmp/tmpqgl5e966.tex has been generated
Info in <TCanvas::Print>: TeX file /tmp/tmpy2n93fur.tex has been created
[4]:
v1 = Vertex().with_xy(-2, -2)
v2 = Vertex().with_xy(2, -2)

i1 = Vertex().with_xy(-2, 2)
o1 = Vertex().with_xy(2,  2)
o2 = Vertex().with_xy(2,  1)
o3 = Vertex().with_xy(2,  0)

p1 = Vertex().with_xy(0,  2)
p2 = Vertex().with_xy(1,  1)


fd = FeynmanDiagram().add(
    v1,
    v2,
    Propagator().connect(v1,v2).with_type("fermion").with_label("$d$").with_tension(0),
    Leg().with_target(v1).with_point(v1).with_type("phantom").with_incoming(),
    Leg().with_target(v2).with_point(v2).with_type("phantom").with_outgoing(),

    i1,p1,p2,o1,o2,o3,
    Propagator().connect(p2,p1).with_type("boson").with_label(r"$W^{+}$"),
    Leg(label=r"$\bar{b}$").with_target(p1).with_point(i1).with_type("fermion").with_incoming(),
    Leg(label=r"$\bar{c}$").with_target(p1).with_point(o1).with_type("fermion").with_outgoing(),
    Leg(label=r"$c$").with_target(p2).with_point(o2).with_type("fermion").with_outgoing(),
    Leg(label=r"$\bar{s}$").with_target(p2).with_point(o3).with_type("fermion").with_outgoing()
)
ar = AllRender(fd)
ar.render()
tikz:
../../_images/gallery_overleaf_overleaf_4_1.png
pyx:
../../_images/gallery_overleaf_overleaf_4_3.png
feynmp:
../../_images/gallery_overleaf_overleaf_4_5.png
feynman:
../../_images/gallery_overleaf_overleaf_4_7.png
dot:
../../_images/gallery_overleaf_overleaf_4_9.png
mermaid:
../../_images/gallery_overleaf_overleaf_4_11.svg
asciipdf:
../../_images/gallery_overleaf_overleaf_4_13.png
unicodepdf:
../../_images/gallery_overleaf_overleaf_4_15.png
madgraph:
../../_images/gallery_overleaf_overleaf_4_17.png
root:
../../_images/gallery_overleaf_overleaf_4_19.png
Info in <TCanvas::SaveSource>: C++ Macro file: /tmp/tmpsaj8ngxb.tex has been generated
Info in <TCanvas::Print>: TeX file /tmp/tmp6_je8lvq.tex has been created
[ ]:

[ ]:

[ ]: