我正在使用 tikz 绘制费曼图,并且对调整以下代码的行为有一些疑问。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,arrows,decorations.pathmorphing,decorations.markings,trees}
\begin{document}
\tikzset{
photon/.style={decorate, decoration={snake}, draw=red},
particle/.style={draw=blue,solid, postaction={decorate},
decoration={markings,mark=at position .5 with {\arrow[draw=blue]{>}}}},
antiparticle/.style={draw=blue,solid, postaction={decorate},
decoration={markings,mark=at position .5 with {\arrow[draw=blue]{<}}}},
wboson/.style={draw=black,dashed}
}
\begin{tikzpicture}[
thick,
% Set the overall layout of the tree
level/.style={level distance=2.0cm},
level 2/.style={sibling distance=3.5cm},
]
\coordinate
child[grow=left]{
edge from parent [wboson]
child {
edge from parent [particle]
node [above] {$d^r_L$}
}
child {
edge from parent [antiparticle]
node [below] {$u^r_L$}
}
node [above=3pt] {$W^+$}
}
% I have to insert a dummy child to get the tree to grow
% correctly to the right.
child[grow=right, level distance=0pt] {
child { }
child {
edge from parent [particle]
node [above] {$\nu_L$}
}
}
child[grow=left, level distance=0pt]{
child {
edge from parent [particle]
node [above] {$\overline{e^-_L}$}
}
child { }
};
\end{tikzpicture}
\end{document}
1)如何从图片中去除黑色实线,以便只保留虚线和四条蓝线?
2)如何调整蓝线之间的角度,以便最右边的两条蓝线描述一个锐角,而完全不增加级别/兄弟距离?
谢谢你的时间
答案1
1)从手册 p222 中,child {edge from parent[draw=none] }
向虚拟节点添加选项以消除黑线。
2)level distance
和sibling distance
属性对每个子树都生效一次。就您的代码而言,您无法执行要执行的操作,因为您的树并不均匀。如果我没有看错的话,它从右顶点“开始”,然后向左移动到 wboson,然后分裂为反粒子/粒子对,向右回溯并产生最右边的蓝线,然后再次回溯并产生中间的蓝线。这不是很简单 :)
另一种方法是从标签处开始树W^+
,以零级别分离“向下”生长,以便树左右生长,并从那里散开:
\path
[grow=down, level distance=0pt,sibling distance=1cm]
coordinate [above, label={$W^+$}]
child [grow=left, level distance=1cm]{
edge from parent [wboson]
% Add [level distance=whatever, sibling distance=whatever] if you'd like
child {
node [above] {$d^r_L$}
edge from parent [particle]
}
child {
node [below] {$u^r_L$}
edge from parent [antiparticle]
}
}
child [grow=right, level distance=1cm, sibling distance=1cm] {
edge from parent [wboson]
[grow=up] % Add level distance=whatever, sibling distance=whatever here
child {
node [above] {$\nu_L$}
edge from parent [particle]
}
child {
node [above] {$\overline{e^-_L}$}
edge from parent [particle]
}
};
(您可以根据需要调整级别距离)这种方法的另一个优点是您不再有任何虚拟线。稍有缺点是您必须将路径W^+
“分成两半”,但您可以重新获得预期的不变量,即树的每个节点都沿一个统一的方向生长。