![如何用 tikz-feynman 绘制彩色费曼图?](https://linux22.com/image/474109/%E5%A6%82%E4%BD%95%E7%94%A8%20tikz-feynman%20%E7%BB%98%E5%88%B6%E5%BD%A9%E8%89%B2%E8%B4%B9%E6%9B%BC%E5%9B%BE%EF%BC%9F.png)
我正在尝试在 Latex 上绘制下图。我不知道从哪里开始。我搜索了很多,但找不到任何解决方案。以下是我遇到的情况:
从左到右画线很容易。但其余的没有解决方案。首先我尝试:
\begin{figure}[h]
\centering
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{feynman}
\vertex (x);
\vertex[right=5cm of x] (y);
\vertex[right=2.5cm of x] (a);
\diagram*{
(x) --[fermion] (a),
(a) --[fermion] (y),
a --[fermion, out=135, in=45, loop, min distance=5 cm] a,
};
\end{feynman}
\end{tikzpicture}
\caption{Feynman diagrams for two vertex $\phi^4$ interaction in real scalar field theory.} \label{fig:FD1}
\end{figure}
但结果不一样。环不是如图所示的椭圆形。它看起来像有问题的那个这里。
下一个问题是将颜色放入循环内。我找到了一些绘制选项。但是着色区域有圆形/方形/椭圆形,与循环不一致。我完全不知所措。对此有什么可能的解决办法吗?
答案1
您所链接问题的答案实际上是一个很好的起点,可以让你了解如何绘制所需的椭圆。我根据该答案修改了我的答案,但我将其更改circle
为椭圆并添加了填充颜色,并根据您的屏幕截图ellipseFillColor
将文本颜色设置为。此外, at 节点被椭圆的填充覆盖,因此我添加了一些 TibackgroundTextColor
tikzfeynman/dot
b
钾最后加上我自己的 Z 代码,以确保它在填充的椭圆上方可见。这是我的最终结果:
\documentclass{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\definecolor{backgroundTextColor}{HTML}{8C6D0B}
\definecolor{ellipseFillColor}{HTML}{ADDCF0}
\begin{tikzpicture}
\color{backgroundTextColor}
\makeatletter
\begin{feynman}
\diagram [horizontal=a to b, layered layout] {
a [particle={$(p_n,\mathbf p)$}]
-- [fermion]
b
-- [fermion]
c [particle={$(p_n,\mathbf p)$}]
};
% Define a path to the center of the ellipse at point A1, and another point
% to the top of the ellipse at point A2
\path (b) --++ (90:0.6) coordinate (A1) --++ (0,0.65) coordinate (A2);
% Next, draw the ellipse at point A, and color the inside
\draw[
fill = ellipseFillColor,
decoration={
markings,
% This following part is borrowed from the tikzfeynman.keys.code.tex “with
% reversed arrow” style, but I changed the fill of the arrow to match the
% fill color of the line. Otherwise, the arrow would have been blue like
% the fill of the ellipse.
mark=at position 0.25 with {\node[
transform shape,
xshift=0.5mm,
rotate=180,
fill=backgroundTextColor,
inner sep=\tikzfeynman@arrow@size,
draw=none,
isosceles triangle
] {}; }
},
postaction=decorate
] (A1) ellipse (0.4 and 0.6);
% Draw dot at node b
\draw[fill = backgroundTextColor](b) circle (0.05) node[anchor=north] {$\lambda_1$};
% Place text above ellipse
\draw(A2) node[anchor=south] {$(r_n, \mathbf r)$};
\end{feynman}
\end{tikzpicture}
\end{document}