答案1
以后请不要再发图片询问“如何绘制这个?”。请提供一些你尝试编写的代码,向此网站的人们展示你正在努力解决的特定技术问题。
我不知道如何使用这些feynman
包,所以这里有一个使用 TikZ 的解决方案pics
。它有点冗长,可能会优化,但我不知道如何优化。事实上,网格是硬编码的,因为库提供的模式pattern
在形状内的位置不正确。无论如何,这里是代码:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\tikzset{%
Feynman vertical/.style args = {#1}{%
path picture = {
\draw
let
\p1 = ($(path picture bounding box.north east) - (path picture bounding box.south west)$),
\n1 = {veclen(\x1, 0)},
in
\foreach \x in {0,...,#1} {
($(path picture bounding box.south west) + ({\x*\n1/#1}, 0)$)
-- ($(path picture bounding box.north west) + ({\x*\n1/#1}, 0)$)
};
}
},
Feynman hatch/.style 2 args = {%
path picture = {
\draw
let
\p1 = ($(path picture bounding box.north east) - (path picture bounding box.south west)$),
\n1 = {veclen(\x1, 0)},
\n2 = {veclen(0, \y1)},
in
\foreach \x in {0,...,#1} {
($(path picture bounding box.south west) + ({\x*\n1/#1}, 0)$)
-- ($(path picture bounding box.north west) + ({\x*\n1/#1}, 0)$)
}
\foreach \x in {0,...,#2} {
($(path picture bounding box.south west) + (0, {\x*\n2/#2})$)
-- ($(path picture bounding box.south east) + (0, {\x*\n2/#2})$)
};
}
},
pics/my Feynman diagram/.style n args = {4}{%
code = {%
\node[
label = above:{#1},
] (1) at (0, 0) {};
\node[
label = above:{#2},
on grid,
right = 4cm of 1
] (2) {};
\node[
label = above:{#3},
on grid,
below = 2cm of 1
] (3) {};
\node[
label = above:{#4},
on grid,
below = 2cm of 2
] (4) {};
\node[
rectangle,
draw,
pic actions,
minimum width = 2cm,
minimum height = 2cm,
] (square) at ($(1.center)!0.5!(4.center)$) {};
\draw[%
Circle-Circle,
decoration = {%
markings,
mark = at position 0.09 with{%
\arrowreversed[scale = 1.5]{latex}
},
mark = at position 0.839 with{%
\arrowreversed[scale = 1.5]{latex}
}
},
postaction = {decorate}
] (1.center) -- (2.center);
\draw[%
Circle-Circle,
decoration = {%
markings,
mark = at position 0.161 with{%
\arrow[scale = 1.5]{latex}
},
mark = at position .91 with{%
\arrow[scale = 1.5]{latex}
}
},
postaction = {decorate}
] (3.center) -- (4.center);
}
}
}
\begin{document}
\begin{tikzpicture}
\draw[
double,
decoration = {%
markings,
mark = at position 0.425 with{%
\arrowreversed[scale = 1]{latex}
},
},
postaction = {decorate}
] (15.9, 0) -- (18.1, 0);
\draw[
double,
decoration = {%
markings,
mark = at position 0.575 with{%
\arrow[scale = 1]{latex}
},
},
postaction = {decorate}
] (15.9, -2) -- (18.1, -2);
\draw (0, 0) pic[Feynman hatch = {20}{20}] {my Feynman diagram = {$1$}{$4$}{$3$}{$2$}};
\draw (6, 0) pic[Feynman vertical = {20}] {my Feynman diagram = {$1$}{$4$}{$3$}{$2$}};
\node at (5, -1) {$=$};
\node at (11, -1) {$+$};
\draw (12, 0) pic[Feynman vertical = {20}] {my Feynman diagram = {$1$}{$4'$}{$3$}{$2'$}};
\draw (18, 0) pic[Feynman hatch = {20}{20}] {my Feynman diagram = {$1'$}{$4$}{$3'$}{$2$}};
\end{tikzpicture}
\end{document}
得出的结果是:
答案2
只是我的建议,不是真正的答案。我见过tikz-feynmann
、feynman
等包,你的图片很难画,需要花很多时间。我谦虚地建议使用 Mathcha (https://www.mathcha.io/editor) 考虑到没有任何 MWE。这只是一个起点,因为我认为您的绘图不是用LaTeX
外部程序完成的,而是用外部程序完成的。经过一个谦虚的建议。您可以选择垂直线并创建垂直网格。我已经将一些垂直线放入矩形中。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Grid [id:dp050710141198379466]
\draw [draw opacity=0] (157.75,146) -- (81.75,146) -- (81.75,90.91) -- (157.75,90.91) -- cycle ; \draw (157.75,146) -- (157.75,90.91)(152.75,146) -- (152.75,90.91)(147.75,146) -- (147.75,90.91)(142.75,146) -- (142.75,90.91)(137.75,146) -- (137.75,90.91)(132.75,146) -- (132.75,90.91)(127.75,146) -- (127.75,90.91)(122.75,146) -- (122.75,90.91)(117.75,146) -- (117.75,90.91)(112.75,146) -- (112.75,90.91)(107.75,146) -- (107.75,90.91)(102.75,146) -- (102.75,90.91)(97.75,146) -- (97.75,90.91)(92.75,146) -- (92.75,90.91)(87.75,146) -- (87.75,90.91)(82.75,146) -- (82.75,90.91) ; \draw (157.75,146) -- (81.75,146)(157.75,141) -- (81.75,141)(157.75,136) -- (81.75,136)(157.75,131) -- (81.75,131)(157.75,126) -- (81.75,126)(157.75,121) -- (81.75,121)(157.75,116) -- (81.75,116)(157.75,111) -- (81.75,111)(157.75,106) -- (81.75,106)(157.75,101) -- (81.75,101)(157.75,96) -- (81.75,96)(157.75,91) -- (81.75,91) ; \draw ;
%Straight Lines [id:da8796742553374359]
\draw (38.5,146) -- (197,146) ;
%Straight Lines [id:da7418470204062146]
\draw (40,91) -- (203,91) ;
%Shape: Triangle [id:dp5355715554922158]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (182.5,145.83) -- (166.75,149.12) -- (166.75,141.25) -- cycle ;
%Shape: Triangle [id:dp4419608441364373]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (163.75,90.54) -- (179.5,87.25) -- (179.5,95.13) -- cycle ;
%Shape: Circle [id:dp6683259397550181]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (194.5,146) .. controls (194.5,143.51) and (196.51,141.5) .. (199,141.5) .. controls (201.49,141.5) and (203.5,143.51) .. (203.5,146) .. controls (203.5,148.49) and (201.49,150.5) .. (199,150.5) .. controls (196.51,150.5) and (194.5,148.49) .. (194.5,146) -- cycle ;
%Shape: Circle [id:dp6688169767236045]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (194,91) .. controls (194,88.51) and (196.01,86.5) .. (198.5,86.5) .. controls (200.99,86.5) and (203,88.51) .. (203,91) .. controls (203,93.49) and (200.99,95.5) .. (198.5,95.5) .. controls (196.01,95.5) and (194,93.49) .. (194,91) -- cycle ;
%Shape: Triangle [id:dp13879421950135273]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (57.75,90.54) -- (73.5,87.25) -- (73.5,95.13) -- cycle ;
%Shape: Triangle [id:dp5597483621320856]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (74.5,145.83) -- (58.75,149.12) -- (58.75,141.25) -- cycle ;
%Shape: Circle [id:dp1895078155864982]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (31,91) .. controls (31,88.51) and (33.01,86.5) .. (35.5,86.5) .. controls (37.99,86.5) and (40,88.51) .. (40,91) .. controls (40,93.49) and (37.99,95.5) .. (35.5,95.5) .. controls (33.01,95.5) and (31,93.49) .. (31,91) -- cycle ;
%Shape: Circle [id:dp3554568913446312]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (29.5,146) .. controls (29.5,143.51) and (31.51,141.5) .. (34,141.5) .. controls (36.49,141.5) and (38.5,143.51) .. (38.5,146) .. controls (38.5,148.49) and (36.49,150.5) .. (34,150.5) .. controls (31.51,150.5) and (29.5,148.49) .. (29.5,146) -- cycle ;
%Shape: Rectangle [id:dp7959619866531342]
\draw (316,91) -- (391,91) -- (391,146) -- (316,146) -- cycle ;
%Straight Lines [id:da7024988435600825]
\draw (316,90) -- (316.5,147) ;
%Straight Lines [id:da45533264265815454]
\draw (383,91) -- (383,146) ;
%Straight Lines [id:da5454213977328088]
\draw (387,91) -- (387,146) ;
%Straight Lines [id:da4951170094128672]
\draw (320,91) -- (320,146) ;
%Straight Lines [id:da08155165705769307]
\draw (379,90) -- (379,145) ;
%Straight Lines [id:da7100493757071882]
\draw (324,91) -- (324,146) ;
%Straight Lines [id:da695751770201078]
\draw (268.5,146) -- (427,146) ;
%Straight Lines [id:da7988836981009606]
\draw (270,91) -- (433,91) ;
%Shape: Triangle [id:dp20499709756019535]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (412.5,145.83) -- (396.75,149.12) -- (396.75,141.25) -- cycle ;
%Shape: Triangle [id:dp10671876541257652]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (393.75,90.54) -- (409.5,87.25) -- (409.5,95.13) -- cycle ;
%Shape: Circle [id:dp461347621490265]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (424.5,146) .. controls (424.5,143.51) and (426.51,141.5) .. (429,141.5) .. controls (431.49,141.5) and (433.5,143.51) .. (433.5,146) .. controls (433.5,148.49) and (431.49,150.5) .. (429,150.5) .. controls (426.51,150.5) and (424.5,148.49) .. (424.5,146) -- cycle ;
%Shape: Circle [id:dp639507151669934]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (424,91) .. controls (424,88.51) and (426.01,86.5) .. (428.5,86.5) .. controls (430.99,86.5) and (433,88.51) .. (433,91) .. controls (433,93.49) and (430.99,95.5) .. (428.5,95.5) .. controls (426.01,95.5) and (424,93.49) .. (424,91) -- cycle ;
% Text Node
\draw (29,67.4) node [anchor=north west][inner sep=0.75pt] {$1$};
% Text Node
\draw (30,153.9) node [anchor=north west][inner sep=0.75pt] {$3$};
% Text Node
\draw (239,107.4) node [anchor=north west][inner sep=0.75pt] {$=$};
% Text Node
\draw (203.5,153.9) node [anchor=north west][inner sep=0.75pt] {$4$};
% Text Node
\draw (204,71.9) node [anchor=north west][inner sep=0.75pt] {$2$};
% Text Node
\draw (434,71.9) node [anchor=north west][inner sep=0.75pt] {$2$};
% Text Node
\draw (433.5,153.9) node [anchor=north west][inner sep=0.75pt] {$4$};
\end{tikzpicture}
\end{document}