从圆圈画图

从圆圈画图

我正在尝试将下图包裹成一个圆圈,但遇到了一些问题。我使用了一些代码,将费曼图包裹成椭圆形还是圆形?,但我无法使下线接触周长。我怎样才能使它看起来美观且对称?

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows,fit}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}

\begin{document}

\tikzset{
particle/.style={thick,draw=blue, postaction={decorate},
    decoration={markings,mark=at position .5 with {\arrow[blue]{triangle 45}}}},
gluon/.style={decorate, draw=black,
    decoration={coil,aspect=0}}
 }

\begin{tikzpicture}[node distance=1.5cm and 1.5cm]
\coordinate[label={[xshift=-2pt]left:$e^{-}$}] (e1);
\coordinate[below right=of e1] (aux1);
\coordinate[above right=of aux1,label={[xshift=6pt]right:$e^{-}$}] (e2);
\coordinate[below=2cm of aux1] (aux2);


\draw[particle] (e1) -- (aux1);
\draw[particle] (aux1) -- (e2);

\draw[gluon] (aux1) -- node[label=right:$\gamma$] {} (aux2);
\node[draw,line width=2pt,circle,fit=(e1)(e2) (aux2),inner sep=.5\pgflinewidth] {};
\end{tikzpicture}
\end{document}

任何帮助都会有用。

答案1

fit命令将文本框放入circle节点内,节点呈矩形,且仅与其角落的圆形轮廓重合(尝试在代码中替换circlerectangle查看文本区域的形状)。

您可以使用一些三角函数手动绘制圆圈来解决此问题:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows,fit}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}

\begin{document}

\tikzset{
particle/.style={thick,draw=blue, postaction={decorate},
    decoration={markings,mark=at position .5 with {\arrow[blue]{triangle 45}}}},
gluon/.style={decorate, draw=black,
    decoration={coil,aspect=0}}
 }

\begin{tikzpicture}[node distance=1.5cm and 1.5cm]
\coordinate[label={[xshift=-2pt]left:$e^{-}$}] (e1);
\coordinate[below right=of e1] (aux1);
\coordinate[above right=of aux1,label={[xshift=6pt]right:$e^{-}$}] (e2);
\coordinate[below=1/cos(45)*1.5cm of aux1] (aux2);


\draw[particle] (e1) -- (aux1);
\draw[particle] (aux1) -- (e2);

\draw[gluon] (aux1) -- node[label=right:$\gamma$] {} (aux2);
\draw  [ultra thick] (aux1) circle [radius=sqrt(1.5cm^2+1.5cm^2)];
\end{tikzpicture}
\end{document}

答案2

这可以通过新的tikz-feynman包(另请参阅项目页面), 基于这个答案。使用自动定位顶点的唯一要求是使用以下内容编译文档lualatex

\documentclass[tikz]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\begin{document}
\tikzfeynmanset{
  every fermion={blue},
  every anti fermion={blue},
}

\begin{tikzpicture}
  \begin{feynman}
    \vertex (a);
    \vertex [above left=of a] (b) {\(\textup{e}^{-}\)};
    \vertex [above right=of a] (c) {\(\textup{e}^{-}\)};
    \vertex [below=of a] (d);
    \diagram*{
      (b) -- [fermion] (a),
      (c) -- [anti fermion] (a),
      (a)  -- [photon,edge label=\(\gamma\)] (d),
    };
    \draw[red,thick] (a) circle (1.518);
  \end{feynman}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容