I have the following code:
\documentclass[border=3mm]{standalone}
\usepackage{tikz-feynman}
\usetikzlibrary{shapes.geometric}
\usepackage{amsmath}
\begin{tikzpicture}
\begin{feynman}
\node[shape=circle,draw=black, inner sep=0pt,minimum size=20pt] (m) at ( 0, 0) {};
\node[shape=rectangle,fill=black] (n) at (3, 0) {square };
\vertex (a) at ( 210:2cm) {};
\vertex (b) at ( -30:2cm) {};
\vertex (c) at (150:2cm) {};
\vertex (d) at (30:2cm) {};
\diagram* {
(a) -- [photon,edge label'=$q_2$] (m)
-- [photon,edge label'=$q_1$] (c),
(n) -- [bend left=45, edge label=$\pi^+(K^+)$] (m)
-- [bend left=45, edge label=$\pi^-(K^-)$] (n),
};
\end{feynman}
\end{tikzpicture}
\end{document}
which produces:
I have three questions:
-
How can we make the rectangle, a square?
-
How can we make the curves lines enter the square at the two vertices in the left?
-
How can we create two straight lines come out of the other two vertices of the square in right?
Thanks for your help!
Best Answer
(n)
contains the text "square", which is much wider than tall. You can make it square by adding a\rule
there instead.n
as the origin. I called them(e)
and(f)
.I also changed the angles of the lines to 45 degrees, instead of 30, otherwise the lines exiting the black square will not fall on the vertices (again, because geometry).
The result is shown below: