5

I have drawn a Feynman diagram by tikz using this script

\documentclass[tikz,border=3.14pt]{standalone}
\usepackage[compat=1.1.0]{tikz-feynman}
\usetikzlibrary{backgrounds,calc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{automata}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}

\begin{document}
 \tikzset{>=triangle 45}
\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[]{>}}}},
  }


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

  \draw[dashed] (v_2) -- (c_1);
  \draw[dashed] (v_1) -- (c_2);
  \draw[dashed] (v_3) -- (c_3);


\end{tikzpicture}

\end{document}

I would like to have a more rounded electron line such that the whole diagram looks like two circles instead of the drawn rounded triangles. I am very much looking for a solution which does not use circle. Any suggestions on improving the script is very appreciated.

.

6

If you don't want to use circle, you may use arc.

\documentclass[tikz]{standalone}

\usetikzlibrary{positioning,arrows}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[
    myedge/.style={thick,draw=black, postaction={decorate},
      decoration={markings,mark=at position .6 with {\arrow[black]{triangle 45}}}},
    myshorten/.style={shorten <= 2pt, shorten >= 2pt}]

  \foreach \phi in {1,2,3}{
    \coordinate (A\phi) at (360/3*\phi:1cm);
    \coordinate (B\phi) at (360/3*\phi:2.5cm);
    \draw[myshorten,myedge] (A\phi) arc ( 360/3*\phi: 360/3*(\phi+1): 1cm);
    \draw[myshorten,myedge] (B\phi) arc ( 360/3*\phi: 360/3*(\phi+1): 2.5cm);
  }

  \draw[dashed] (A1) -- (B1);
  \draw[dashed] (A2) -- (B2);
  \draw[dashed] (A3) -- (B3);

\end{tikzpicture}

\end{document}

gives

enter image description here

The shorten messes a little bit with the arc, but it should be ok.

  • 1
    Very nice! +1. BTW, if you want to avoid the shift of the arrow due to shorten, please have a look here. – user121799 May 21 '18 at 13:39
5
\documentclass[tikz, border=3.14pt]{standalone}
\usetikzlibrary{calc}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                backgrounds,
                calc,
                decorations.markings}

\begin{document}
    \begin{tikzpicture}[
electron/.style = {decoration={markings,
                               mark=at position 0.166 with {\arrow{Triangle}},
                               mark=at position 0.499 with {\arrow{Triangle}},
                               mark=at position 0.834 with {\arrow{Triangle}}},
                  postaction={decorate},
                  blue, thick},
                        ]
\draw[electron] (0,0) circle[radius=12mm];
\draw[electron] (0,0) circle[radius=24mm];
%
\foreach \phi in {1,2,3}
{
    \node [circle, fill=white, inner sep=1pt] (v1\phi) at (360/3 * \phi:12mm) {};
    \node [circle, fill=white, inner sep=1pt] (v2\phi) at (360/3 * \phi:24mm) {};
}
%
\draw[dashed]   (v11) -- (v21)
                (v12) -- (v22)
                (v13) -- (v23);
    \end{tikzpicture}
\end{document}

gives

enter image description here

as you can see, for electron are used two circles with three equal spaced arrow heads. dashed lines are between nodes whit white color, which are placed on circles.

  • Thank you. This looks exactly like what I am seeking. Isn't any other alternative to obtaining this diagram without using circle? This is because I need to handle each of these electron lines separately~(adding different color, arrow type, ...). – Shasa May 21 '18 at 9:32
2

Code golfing : two loops, single \draw.

\documentclass[tikz,border=7pt]{standalone}
\usetikzlibrary{bending}
\begin{document}
  \tikz\foreach\a in {0,1,2}\foreach\r in {1,2}
    \draw[blue,thick,latex-,rotate=\a*120]
      (0:\r) edge[dashed,thin,black,.-] (0:2)
      (59:\r) arc (59:-70:\r) node[pos=.457,fill=white,circle,inner sep=1pt]{};
\end{document}

enter image description here

2

I personally would bend the arrows and also indicate the vertices by dots.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta,bending,decorations.markings} 
\tikzset{% inspired by https://tex.stackexchange.com/a/316050/121799
    arc arrow/.style args={%
    to pos #1 with length #2}{
    decoration={
        markings,
         mark=at position 0 with {\pgfextra{%
         \pgfmathsetmacro{\tmpArrowTime}{#2/(\pgfdecoratedpathlength)}
         \xdef\tmpArrowTime{\tmpArrowTime}}},
        mark=at position {#1-\tmpArrowTime} with {\coordinate(@1);},
        mark=at position {#1-2*\tmpArrowTime/3} with {\coordinate(@2);},
        mark=at position {#1-\tmpArrowTime/3} with {\coordinate(@3);},
        mark=at position {#1} with {\coordinate(@4);
        \draw[-{Triangle[length=#2,bend]}]       
        (@1) .. controls (@2) and (@3) .. (@4);},
        },
     postaction=decorate,
     },
    my electron/.style={arc arrow={to pos 0.5 with length 3mm}},
    vertex dot/.style={draw,circle,fill,scale=0.4}
}


\begin{document}
\begin{tikzpicture}
  \foreach \angle in {120,240,360}{
    \node[vertex dot,blue] (c_\angle) at (\angle:1cm) {} ;
    \node[vertex dot,blue] (v_\angle) at (\angle:2.5cm) {} ;
    \draw[my electron,blue] (\angle:1cm) arc(\angle:{\angle-120}:1cm);
    \draw[my electron,blue] (\angle:2.5cm) arc(\angle:{\angle+120}:2.5cm);
    \draw[dashed] (c_\angle) -- (v_\angle);
  }
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.