TransWikia.com

How to increase the size of a boson in tikz-feynman package?

TeX - LaTeX Asked by Always Learning Forever on September 14, 2020

I am using the tikz-feynman package to make some Feynman diagrams like this:

documentclass{article}
% Beta decay
usepackage{tikz}

usepackage[compat=1.1.0]{tikz-feynman}
usepackage{feynmf}
begin{document}
begin{tikzpicture}
  begin{feynman}
    vertex (a);
    vertex [above right = 5 cm of a] (u11);
    vertex [above left = 5 cm of u11] (u12);
    vertex [right = 0.4 cm of a] (b);
    vertex [above right = 5 cm of b] (u21);
    vertex [above left = 5 cm of u21] (u22);
    vertex [right = 0.4 cm of b] (c);
    vertex [above right = 5 cm of c] (u31);
    vertex [above left = 5 cm of u31] (u32);
    vertex [above right = 2 cm of u31] (f1);
    vertex [above right = 3 cm of f1] (f2);
    vertex [below right = 3 cm of f1] (f3);
    
    diagram* {
      (a) -- [fermion] (u11) -- [fermion] (u12),
      (b) -- [fermion] (u21) -- [fermion] (u22),
      (c) -- [fermion] (u31) -- [fermion] (u32),
      (u31) -- [boson] (f1),
      (f1) -- [fermion] (f2);
      (f1) -- [fermion] (f3);
    };
  end{feynman}
end{tikzpicture}

end{document}

But I am having two issues:

  1. I cannot get the zigzag line for the boson, it looks identical to a photon. The zigzag line is supported in feynmf package but I am not sure if I can incorporate that in a diagram that uses TikZ.

  2. I want to be able to make the boson appear out more, so the amplitude of the wave should be larger, but I don’t see a way to do that either. I tried the options of changing size=# or using the key large, but neither of them work.

3 Answers

You can modify the style of a tikz-feynman element (such as boson) using the tikzfeynmanset command. However, normally this command appends to the predefining style instead of overwriting it, which in this case means you still get the sine wave for the boson mixed with some other pattern.

To actually redefine the element you can set the internal element boson@@ with tikzfeynmanset. Because this name contains an @ symbol you need to put makeatletter and makeatother around the code for the modification. Other than that you can just copy the relevant piece of the source code from tikz-feynman and modify any part of the style.

The zigzag pattern is predefined in the TikZ decorations.pathmorphing library, with the option amplitude to influence the size of the pattern. This library is already loaded by tikz-feynman (for other decorations such as the sine wave for photons), so you don't need to load the library separately.

MWE:

documentclass{article}
usepackage{tikz-feynman}
makeatletter
tikzfeynmanset{/tikzfeynman/every boson@@/.style={
    /tikz/draw=none,
    /tikz/decoration={name=none},
    /tikz/postaction={
      /tikz/draw,
      /tikz/decoration={
        zigzag,
        amplitude=2mm,
      },
      /tikz/decorate=true,
    }
}}
makeatother
begin{document}
begin{tikzpicture}
  begin{feynman}
    vertex (a);
    vertex [above right = 5 cm of a] (u11);
    vertex [above left = 5 cm of u11] (u12);
    vertex [right = 0.4 cm of a] (b);
    vertex [above right = 5 cm of b] (u21);
    vertex [above left = 5 cm of u21] (u22);
    vertex [right = 0.4 cm of b] (c);
    vertex [above right = 5 cm of c] (u31);
    vertex [above left = 5 cm of u31] (u32);
    vertex [above right = 2 cm of u31] (f1);
    vertex [above right = 3 cm of f1] (f2);
    vertex [below right = 3 cm of f1] (f3);
    
    diagram* {
      (a) -- [fermion] (u11) -- [fermion] (u12),
      (b) -- [fermion] (u21) -- [fermion] (u22),
      (c) -- [fermion] (u31) -- [fermion] (u32),
      (u31) -- [boson] (f1),
      (f1) -- [fermion] (f2);
      (f1) -- [fermion] (f3);
      (f2) -- [photon] (f3);
    };
  end{feynman}
end{tikzpicture}

end{document}

Result:

enter image description here

For comparison I also added a photon between two random nodes (that probably violates some laws of physics).

Note: to make your code more clear it would be a good idea not to mix tikz-feynman and feynmf, unless strictly necessary.

Correct answer by Marijn on September 14, 2020

It is possible, as described in the manual, to create your own style. Here I have created the yourboson style colored blue (but of course modifiable).

tikzfeynmanset{
yourboson/.style={
blue,
decoration={zigzag,amplitude=2mm,segment length=4mm,pre,pre length=2pt, post,post length=2pt},decorate}
}

The advantage is that it keeps the original style intact.

screenshot

documentclass[border=5mm]{standalone}
usepackage[compat=1.1.0]{tikz-feynman}

begin{document}
usetikzlibrary {decorations}

tikzfeynmanset{
yourboson/.style={
blue,
decoration={zigzag,amplitude=2mm,segment length=4mm,pre,pre length=2pt, post,post length=2pt},decorate}
}

begin{tikzpicture}
  begin{feynman}
    vertex (a);
    vertex [above right = 5 cm of a] (u11);
    vertex [above left = 5 cm of u11] (u12);
    vertex [right = 0.4 cm of a] (b);
    vertex [above right = 5 cm of b] (u21);
    vertex [above left = 5 cm of u21] (u22);
    vertex [right = 0.4 cm of b] (c);
    vertex [above right = 5 cm of c] (u31);
    vertex [above left = 5 cm of u31] (u32);
    vertex [above right = 2 cm of u31] (f1);
    vertex [above right = 3 cm of f1] (f2);
    vertex [below right = 3 cm of f1] (f3);
    
    diagram* {
      (a) -- [fermion] (u11) -- [fermion] (u12),
      (b) -- [fermion] (u21) -- [fermion] (u22),
      (c) -- [fermion] (u31) -- [fermion] (u32),
      (u31) -- [yourboson] (f1),
      (f1) -- [fermion] (f2);
      (f1) -- [fermion] (f3);
    };
  end{feynman}
  
end{tikzpicture}

end{document}

Answered by AndréC on September 14, 2020

Asymptote can do it.

Compile here http://asymptote.ualberta.ca/

The Feynman diagram for β− decay.

usepackage("amssymb");

path zigzag(path g, int n=5, real amplitude=1 , real tension1=100, real tension2=tension1){

// n : the number of segments of path g (the default value is 5)
// amplitude : the amplitude of zigzag (the default value is 1)
// To understand tension, see https://asymptote.sourceforge.io/doc/Bezier-curves.html#Bezier-curves

pair[] A;
for (int k=0; k <= n; ++k){ A.push(point(g,k/n)); }
pair[] midofA;
pair[] vertexofcurve;
for (int i=0; i < A.length-1; ++i){ 
  midofA.push(0.5*(A[i]+A[i+1]));
  vertexofcurve.push(midofA[i]+amplitude*unit(rotate((i%2==0) ? 90 : -90)*(A[i+1]-midofA[i])));  
}
guide zz=A[0];
for (int i=0; i < vertexofcurve.length; ++i){
zz=zz.. tension tension1 and tension2 ..vertexofcurve[i]
     .. tension tension2 and tension1 ..A[i+1];
}
return zz;
}
// An example :
/*
unitsize(1cm);
path g=(0,0)--(5,2);
draw(g);
draw(zigzag(g,amplitude=1.5,tension1=10,tension2=4),red);
draw(zigzag(g,amplitude=0.8,tension1=10,tension2=1),green);
draw(zigzag(g,n=18,amplitude=0.2),blue);
*/
// we will get the zigzag if tension1 is big.

unitsize(1cm);
path q1=(0,0)--(2,3),q2=(2,3)--(0.1,6);
transform t=shift(0.3,0);

draw(shift(0,-3)*Label("u",BeginPoint+(0,-0.2)),q1,MidArrow(size=5));
draw(Label("u",EndPoint),q2,MidArrow(size=5));
draw(Label("d",BeginPoint+(0,-0.2)),t*q1,MidArrow(size=5));
draw(Label("d",EndPoint),t*q2,MidArrow(size=5));
draw(Label("d",BeginPoint+(0,-0.2)),t^2*q1,linewidth(1bp),MidArrow(size=8));
draw(Label("u",EndPoint),t^2*q2,linewidth(1bp),MidArrow(size=8));
path ZigZag=zigzag(t^2*(2,3)--t^2*(2,3)+dir(20),
                   n=4,
                   amplitude=0.28,
                   tension1=5,tension2=2.2);

draw(Label("$W^{-}$",Relative(.9),2*S),ZigZag,linewidth(1bp));
draw(Label("$e^{-}$",EndPoint),
     relpoint(ZigZag,1)--relpoint(ZigZag,1)+1.2*dir(45),
     linewidth(1bp),MidArrow(size=8)); 
draw(Label("$overline{mathcal{V}}_{e}$",BeginPoint),
     reverse(relpoint(ZigZag,1)--relpoint(ZigZag,1)+1.4*dir(80)),
     linewidth(1bp),MidArrow(size=8)); 

draw(scale(1.5)*Label("$t$",EndPoint),(-.5,-.5)--(-.5,6.5),Arrow);
label(scale(1.5)*"$n$",(0.2,-.7));
label(scale(1.5)*"$p$",(0.3,6.7));

enter image description here

The picture of example:

enter image description here

And here is diagram (a) (your link)

path zigzag(path g, int n=5, real amplitude=1 , real tension1=100, real tension2=tension1){

// n : the number of segments of path g (the default value is 5)
// amplitude : the amplitude of zigzag (the default value is 1)
// To understand tension, see https://asymptote.sourceforge.io/doc/Bezier-curves.html#Bezier-curves

pair[] A;
for (int k=0; k <= n; ++k){ A.push(point(g,k/n)); }
pair[] midofA;
pair[] vertexofcurve;
for (int i=0; i < A.length-1; ++i){ 
  midofA.push(0.5*(A[i]+A[i+1]));
  vertexofcurve.push(midofA[i]+amplitude*unit(rotate((i%2==0) ? 90 : -90)*(A[i+1]-midofA[i])));  
}
guide zz=A[0];
for (int i=0; i < vertexofcurve.length; ++i){
zz=zz.. tension tension1 and tension2 ..vertexofcurve[i]
     .. tension tension2 and tension1 ..A[i+1];
}
return zz;
}

unitsize(1cm);
transform t=shift(0,-4);
draw(Label("$pi$",BeginPoint),(0,0)--(2,0),MidArrow);
draw(Label("$pi$",EndPoint),(2,0)--(4,0),MidArrow);
draw(zigzag((2,0)--t*(2,0),n=10,amplitude=0.5,tension1=100));
draw(Label("$N$",BeginPoint),t*((0,0)--(2,0)),MidArrow);
draw(Label("$N$",EndPoint),t*((2,0)--(4,0)),MidArrow);
dot((2,0)^^t*(2,0));

enter image description here

And you can draw your Feynman diagrams.

Answered by TrongVuong1998 on September 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP