我想画一个费曼图,为此我编写了这个代码。
\documentclass[a4paper,12pt, border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations, decorations.markings, decorations.pathmorphing, arrows, graphs, graphdrawing, shapes.geometric, snakes}
\usegdlibrary{trees,force, layered}
\pgfdeclaredecoration{complete sines}{initial}
{
\state{initial}[
width=+0pt,
next state=sine,
persistent precomputation={\pgfmathsetmacro\matchinglength{
\pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}
\setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
}] {}
\state{sine}[width=\pgfdecorationsegmentlength]{
\pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
\pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
\pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
\pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
}
\state{final}{}
}
\tikzset{
photon/.style={
decoration={complete sines, amplitude=0.15cm, segment length=0.2cm},
decorate
},
fermion/.style={
decoration={
markings,
mark=at position 0.5 with {\node[transform shape, xshift=-0.5mm, fill=black, inner sep=1pt, draw, isosceles triangle]{};}
},
postaction=decorate
},
gluon/.style={
decoration={coil, aspect=0.75, mirror, segment length=1.5mm},
decorate
},
left/.style={
bend left=90,
looseness=1.75
}
}
\begin{document}%
\begin{tikzpicture}
\graph [spring layout, anchor at={(0,-4)}, nodes=coordinate, vertical= a to d, vertical= e to f]
{
a -- [fermion, edge label={\tiny{$\nu_{\mu/\tau}$}}] b,
c -- [fermion, edge label={{\tiny{$\nu_{\mu/\tau}$}}}] a,
a -- [photon, edge label={\tiny{$Z'$}}] d -- [left, fermion, edge label={\tiny{$\mu^-/\tau^-$}}] e -- [left, fermion, edge label={\tiny{$\mu^-/\tau^-$}}] d,
e -- [photon, edge label={\tiny{$\gamma$}}] f,
g-- [fermion, edge label={\tiny{$p$}}] f,
f -- [fermion, edge label={\tiny{$p$}}] h;
};
\end{tikzpicture}
\end{document}
输出为:
但是标签看起来不太好,尤其是(如果费米子线的标签看起来像线的标签$\nu_{\mu/\tau}$
就更好了)。而且标签的文字大小非常大。$\nu_{\mu/\tau}$
$p$
谁能帮我解决这些问题?
答案1
下面是散射事件的简化版本,它从简化的弹簧布局开始:
\feynmandiagram [vertical = c to f] {
{a,b} -- c -- d -- e -- f -- {g,h};
}
在左边的截图中,我标记了你画的点。右边的截图是由下面的代码生成的。
目前,它只是为了简单起见而删除了箭头。您可以通过拆分结构来处理它们,例如,就像我对缺失的半弧所做的那样。看起来不应该太字面地理解这些术语(费米子、玻色子等),而应该更多地使用它们来获得所需的绘图。这就是为什么我使用“费米子”来表示轻子圆。
\documentclass[10pt, border=10pt]{standalone}
\usepackage{tikz-feynman}
\begin{document}
\feynmandiagram [vertical = c to f] {
% {a,b} -- c -- d -- e -- f -- {g,h}; % basic structure
{ a [particle=\(\nu_\mu / \tau\)] ,% R
b [particle=\(\nu_\mu / \tau\)] % L
}
-- c
-- [boson, edge label=\(Z^{'}\)] d
-- [fermion, half left, edge label=\(\mu^{-}/\tau^{-}\)] e
-- [photon, edge label=\(\gamma\)] f
-- {g [particle=\(p\)],h [particle=\(p\)]};
% adding the missing half-loop
e -- [fermion, half left, edge label=\(\mu^{-}/\tau^{-}\)] d;
};
\end{document}