Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I used a variation of the following code in order to create Feynman like diagram in latex using the answer in Drawing a scattering Feynman diagram with TikZ However, I want to wrap the diagram inside a circle or an ellipse? Does anybody can suggest how I can do this?

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}
\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=1cm and 1.5cm]
\coordinate[label=left:$e^{-}$] (e1);
\coordinate[below right=of e1] (aux1);
\coordinate[above right=of aux1,label=right:$e^{-}$] (e2);
\coordinate[below=1.25cm of aux1] (aux2);
\coordinate[below left=of aux2,label=left:$e^{-}$] (e3);
\coordinate[below right=of aux2,label=right:$e^{-}$] (e4);

\draw[particle] (e1) -- (aux1);
\draw[particle] (aux1) -- (e2);
\draw[particle] (e3) -- (aux2);
\draw[particle] (aux2) -- (e4);
\draw[gluon] (aux1) -- node[label=right:$\gamma$] {} (aux2);
\end{tikzpicture}
\end{document}
share|improve this question
    
Welcome to TeX.sx! –  Kurt Mar 30 '13 at 19:42
add comment

1 Answer

up vote 6 down vote accepted

One option would be to use the fit library; to use an ellipse you will also need the shapes library:

\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=1cm and 1.5cm]
\coordinate[label={[xshift=-3pt]left:$e^{-}$}] (e1);
\coordinate[below right=of e1] (aux1);
\coordinate[above right=of aux1,label={[xshift=6pt]right:$e^{-}$}] (e2);
\coordinate[below=1.25cm of aux1] (aux2);
\coordinate[below left=of aux2,label={[xshift=-6pt]left:$e^{-}$}] (e3);
\coordinate[below right=of aux2,label={[xshift=3pt]right:$e^{-}$}] (e4);

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

enter image description here

Instead of ultra thick, you could use thick, or line width=<length> for finer control:

\node[draw,line width=3pt,circle,fit=(e1) (e4),inner sep=0pt] {};

A new request has been made in a comment:

... to "factorize" the internal gluon. In other words, I want to split the gluon line inside into two straight lines both touching the circle at the same point (could be in either left or right but something that looks nice).

In this case, the intersections library can be used to locate the point of intersection between the circle and a horizontal diameter and then use this new point to draw the additional lines:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,arrows,fit,intersections,decorations.pathmorphing,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=1cm and 1.5cm]
\coordinate[label={[xshift=-3pt]left:$e^{-}$}] (e1);
\coordinate[below right=of e1] (aux1);
\coordinate[above right=of aux1,label={[xshift=6pt]right:$e^{-}$}] (e2);
\coordinate[below=1.25cm of aux1] (aux2);
\coordinate[below left=of aux2,label={[xshift=-6pt]left:$e^{-}$}] (e3);
\coordinate[below right=of aux2,label={[xshift=3pt]right:$e^{-}$}] (e4);

\draw[particle] (e1) -- (aux1);
\draw[particle] (aux1) -- (e2);
\draw[particle] (e3) -- (aux2);
\draw[particle] (aux2) -- (e4);
\draw[gluon] (aux1) -- node[label=right:$\gamma$] {} (aux2);
\node[draw,name path=circle,line width=3pt,circle,fit=(e1) (e4),inner sep=.5\pgflinewidth] {};
\path[name path=diameter] let \p1=(aux1), \p2=(aux2) 
  in (aux1|-0,0.5*\y2+0.5*\y1) -- ++(-3cm,0);% horizontal line from the center to the left
\path[name intersections={of=circle and diameter, by={aux3}}];% find the intersection
\draw[particle] (aux2) -- (aux3);
\draw[particle] (aux3) -- (aux1);
\node[label={[xshift=3pt]left:$m$}] at (aux3) {};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Thank you for your answer. I want to make the circle touch the external lines so i replaced, \node[draw,circle,fit=(e1) (e4),inner sep=0.5pt] {}. Is there a way to make the circle bold and whether there is an efficient way to do it than what I just did? –  Voltaire Mar 30 '13 at 20:11
    
@anvSnMusater You're welcome; please see my updated answer. For the inner sep value, it's better to use .5\pgflinewidth so you don't have to guess the right value. Also, please remember to up-vote good answers and to accept the ones you consider best solved your problem (two different actions); in case of doubt, please see How do you accept an answer?. –  Gonzalo Medina Mar 30 '13 at 20:36
    
One thing, that is perhaps trivial but I cant quite do is try to "factorize" the internal gluon. In other words, I want to split the gluon line inside into two straight lines both touching the circle at the same point (could be in either left or right but something that looks nice). I tried something like $\coordinate[above left=of aux2,label={[xshift=-6pt]left:$m$}] (e5);$ and drew \draw[particle] (e5) -- (aux2); \draw[particle] (e5) -- (aux1); Will you be able to offer any suggestion? –  Voltaire Mar 30 '13 at 22:06
    
@anvSnMusater please see my updated answer. Is something like that what you had in mind? –  Gonzalo Medina Mar 31 '13 at 0:01
    
this is exactly how i wanted it. thank you very much. –  Voltaire Mar 31 '13 at 21:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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