使用 tikz 绘制双边电子线

使用 tikz 绘制双边电子线

我打算画一张手绘图形的图1使用tikz。到目前为止,我得到的不是圆形,更像是菱形,而且我还没有弄清楚如何在图中显示双面电子线。任何改进代码的建议都会有所帮助。

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}

\begin{document}

\tikzset{
  every node/.append style={font=\small},
  every edge/.append style={thick},
  electron/.style={postaction={decorate},
      decoration={markings,mark=at position .55 with {\arrow[]{>}}}},
}


\begin{tikzpicture}
    \node (center) at (0,0) {$ $};
      \foreach \phi in {1,...,4}{
      \node (c_\phi) at (-360/4 * \phi:1cm) {$ $} ;
      }
%       ==========================
    \draw[green] (c_1) edge[electron] node[above] {$\downarrow$}(c_2);
    \draw[green] (c_2) edge[electron] node[above] {$\downarrow \uparrow$} (c_3);
    \draw[green] (c_3) edge[electron] node[above] {$\uparrow$}(c_4);
    \draw[green] (c_4) edge[electron] node[above] {$ \uparrow \downarrow$}(c_1);
%       ==========================
      \foreach \phi in {1,...,4}{
      \node (v_\phi) at (360/4 * \phi:2.5cm) {$ $} ;
      }
%       ==========================
    \draw[blue] (v_1) edge[electron] node[above] {$ \downarrow \uparrow$}(v_2);
    \draw[blue] (v_2) edge[electron] node[above] {$ \uparrow $} (v_3);
    \draw[blue] (v_3) edge[electron] node[above] {$\uparrow \downarrow $}(v_4);
    \draw[blue] (v_4) edge[electron] node[above] {$\downarrow $}(v_1);
    \draw[dashed] (v_4) -- (center);
    \draw[dashed] (v_3) -- (center);
    \draw[dashed] (v_2) -- (center);
    \draw[dashed] (v_1) -- (center);
  \end{tikzpicture}

\end{document}

答案1

这看起来像费曼图,所以你可能想使用 tikz-feynman。别担心,下面的代码不需要 lualatex。不幸的是,这里的 s\uparrow\downarrows 的位置很大程度上是手工的。

enter image description here

\documentclass[tikz,border=3.14pt]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\usetikzlibrary{backgrounds,calc}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}

\begin{feynman}
\vertex (O);
\vertex[left=1.5cm of O] (a1);
\vertex[above=1.5cm of O] (a2);
\vertex[right=1.5cm of O] (a3);
\vertex[below=1.5cm of O] (a4);
\vertex[left=3cm of O] (b1);
\vertex[above=3cm of O] (b2);
\vertex[right=3cm of O] (b3);
\vertex[below=3cm of O] (b4);
\diagram* { (a1) -- [anti majorana,quarter left] (a2)
-- [fermion,quarter left] (a3) -- [anti majorana,quarter left] (a4)
-- [fermion,quarter left] (a1),
 (b1) -- [majorana,quarter left] (b2)
-- [anti fermion,quarter left] (b3) -- [majorana,quarter left] (b4)
-- [anti fermion,quarter left] (b1),
(a1) -- [scalar] (b1), (a2) -- [scalar] (b2), (a3) -- [scalar] (b3),
(a4) -- [scalar] (b4)
};
\end{feynman}
\node at (45:1) {$\uparrow$};
\node at (-30:1) {$\uparrow$};
\node at (-60:1) {$\downarrow$};
\node at (-135:1) {$\downarrow$};
\node at (150:1) {$\downarrow$};
\node at (120:1) {$\uparrow$};
\node at (45:3.5) {$\uparrow$};
\node at (-30:3.5) {$\uparrow$};
\node at (-60:3.5) {$\downarrow$};
\node at (-135:3.5) {$\downarrow$};
\node at (150:3.5) {$\downarrow$};
\node at (120:3.5) {$\uparrow$};
\end{tikzpicture}
\end{document}

答案2

\usepackage{tikz}
\usetikzlibrary{automata}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}

\begin{document}

\tikzset{  
  every node/.append style={font=\small, inner sep = 1pt},
  every edge/.append style={thick},
  electron/.style={postaction={decorate},
      decoration={markings,mark=at position .55 with {\arrow[]{>}}}},
  electron two in/.style={postaction={decorate},
      decoration={markings, mark=at position .55 with {\arrow[]{<}},
        mark=at position .45 with {\arrow[]{>}}}},
  electron two out/.style={postaction={decorate},
      decoration={markings, mark=at position .45 with {\arrow[]{<}},
        mark=at position .55 with {\arrow[]{>}}}},
  }


\begin{tikzpicture}
  \node (center) at (0,0) {$ $};
  \foreach \phi in {1,...,4}{
    \node (c_\phi) at (-360/4 * \phi:1cm) {$ $} ;
  }
  % ==========================
  \draw[green] (c_2) edge[out = -90, in = 180, electron] node[above right = 1pt] {$\downarrow$}(c_1);
  \draw[green] (c_2) edge[out = 90, in = 180, electron two out] node[below right = 1pt] {$\downarrow \uparrow$} (c_3);
  \draw[green] (c_3) edge[out = 0, in = 90, electron] node[below left = 1pt] {$\uparrow$}(c_4);
  \draw[green] (c_4) edge[out = -90, in = 0, electron two in] node[above left = 1pt] {$\downarrow \uparrow$}(c_1);
  % ==========================
  \foreach \phi in {1,...,4}{
    \node (v_\phi) at (360/4 * \phi:2.5cm) {$ $} ;
  }
  % ==========================
  \draw[blue] (v_1) edge[out = 180, in = 90, electron two in] node[above left = 1pt] {$ \downarrow \uparrow$}(v_2);
  \draw[blue] (v_3) edge[out = 180, in = -90, electron] node[below left = 1pt] {$ \downarrow $} (v_2);
  \draw[blue] (v_3) edge[out = 0, in = -90, electron two out] node[below right = 1pt] {$\downarrow \uparrow $}(v_4);
  \draw[blue] (v_4) edge[out = 90, in = 0, electron] node[above right = 1pt] {$\uparrow $}(v_1);

  \draw[dashed] (v_4) -- (c_4);
  \draw[dashed] (v_3) -- (c_1);
  \draw[dashed] (v_2) -- (c_2);
  \draw[dashed] (v_1) -- (c_3);
\end{tikzpicture}

\end{document}

enter image description here

相关内容