7

I have plotted the following with paint:

enter image description here

I need to replace it by LaTex. I searched through this website I found some information about drawing Feynman diagram with LateX, but none of them matches my graphs. Any help or link to other materials or websites is appreciated.

EDIT

My attempt for the left-hand side one:

\documentclass{standalone}
\usepackage{tikz-feynman,contour}
\begin{document}
\begin{tikzpicture}
\begin{feynman}

\vertex[blob] (m) at ( 0, 0) {};
\vertex (a) at (-1,-2) {};
\vertex (b) at ( 1,-2) {};
\vertex (c) at (-1, 2) {};
\vertex (d) at ( 1, 2) {};
\diagram* {
    (a) -- [photon,edge label=$q_2$] (m) -- [photon,edge   label=$q_1$] (c),
    (b) -- [plain,edge label'=$p_2$] (m) -- [plain, edge label'=$p_1$] (d),
  };
\end{feynman}

\end{tikzpicture}
\end{document}

which results in

enter image description here

Still, I cannot reproduce my graphs done with paint.

1
  • Welcome. // You can (re-)draw or extend it by tikz anyway.
    – MS-SPO
    Feb 5, 2023 at 11:38

2 Answers 2

8

I suggest to study package tikz on ctan.org , as it provides probably everything you need. Please find below some examples to augment or replace code when using package tikz-feynman .

  • contour is not needed
  • tikz isn't explicitely included: tikz-feynman does it ... so it's based on tikz
  • you may want to add tikzlibraries
  • (1) is your original code
  • (2) replaces the first \vertex simply by an empty \node: you can combine both packages
  • (3) puts a circle shape in blue, without any further adjustments
  • (4) does the same with a clumsy black rectangle
  • (5) connects two \nodes
  • changing the color of a path or photon etc. is easy, but not shown

You may want to start with the minimal introduction to tikz, and have closer looks into the big manual (or searching this site). The decoration-lib may be of interest for you in tikz. Putting text along a path, like in the last example, is easy to do, as well.

examples

\documentclass[border=3mm]{standalone}
\usepackage{tikz-feynman}% not needed: ,contour}
\usetikzlibrary{shapes.geometric}

\begin{document}
    % ~~~ (1) your code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \begin{tikzpicture}
        \begin{feynman}
            \vertex[blob] (m) at ( 0, 0) {};
            \vertex (a) at (-1,-2) {};
            \vertex (b) at ( 1,-2) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}   
    \end{tikzpicture}
    
    % ~~~ (2) just replacing a vertex by an empty node ~~~~~~~~~~~~~~~~~~~~~~
    \tikz{% equivalent
        \begin{feynman}
            \node (m) at ( 0, 0) {};
            \vertex (a) at (-1,-2) {};
            \vertex (b) at ( 1,-2) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}   
    }   
    
    % ~~~ (3) making said node a circle ~~~~~~~~~~~~~~~~~~~~~~
    \tikz{% equivalent
        \begin{feynman}
            \node[shape=circle,fill=blue] (m) at ( 0, 0) {};
            \vertex (a) at (-1,-2) {};
            \vertex (b) at ( 1,-2) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}   
    }   
    
    % ~~~ (4) making said node a rectangle ~~~~~~~~~~~~~~~~~~~~~~
    \tikz{% equivalent
        \begin{feynman}
            \node[shape=rectangle,fill=black] (m) at ( 0, 0) {Rectangle\vrule width 1pt height 2cm};
            \vertex (a) at (-1,-2) {};
            \vertex (b) at ( 1,-2) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}   
    }
    
    % ~~~ (5) connecting two nodes ~~~~~~~~~~~~~~~~
    \tikz{
        \node[shape=circle,fill=blue] (m) at ( 0, 0) {};
        \node[shape=circle,fill=red]  (q) at ( 2, 0) {};
        
        \draw  (m) to [bend left=45] (q);
        \draw  (m) to [bend right=85] (q);
    }
    
\end{document}

From comments: Sure, you can use tikz-commands with tikz-feynman. Here's a funny demonstration:

weired feynman

\documentclass[border=3mm]{standalone}
\usepackage{tikz-feynman}% not needed: ,contour}
\usetikzlibrary{shapes.geometric}

\begin{document}
    % ~~~ some variations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \begin{tikzpicture}
        \begin{feynman}
            \vertex[blob] (m) at ( 0, 0) {};
            \vertex (a) at (-1,-1) {};% <<< changed y-coordinate
            \vertex (b) at ( -60:1cm) {};%<<< switched to polar: -60 deg, 1 cm radius
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,bend left=72,edge label=$q_2$] (m) % <<< funny bend
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,color=red,edge label'=$p_2$] (m) %<<< some color
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}   
    \end{tikzpicture}

\end{document}
2
  • 1
    Fine. If I understand your comment correctly that's a consequence of using absolut coordinates for the \vertex statements. You can check by changing any of them. Try e.g. "\vertex (a) at (-1,-1) {};\vertex (b) at ( 300:1cm) {};" where the second one uses polar coordinates (same result via (-60:1cm), mathematical orientation of rotation). // For relative positioning see Ch. 2.4.3 in the tikz-feynman manual, and Ch. 5.2 in the huge tikz manual, using tikzlibrary positioning.
    – MS-SPO
    Feb 5, 2023 at 16:16
  • 1
    Kindly review my answer, which shows some more things you can do.
    – MS-SPO
    Feb 5, 2023 at 16:28
3

The comment about inserting (a), = and + together qualifes for a new answer.

One thing you could do is to perceive any \tikz{} statement as a complicated letter. So you could well write something like this inside your document-environment:

(a) \tikz{} = \tikz{} + \tikz{}

However, all these "characters" will align to the bottom, just like charaters do in typesetting. To overcome this there are several choices, like:

  • raising (a), = and + by some amount
  • using tables with vertical alignment (1st col (a), 2nd col \tikz{} etc.)

Within tikz one way is:

  • defining a couple of pictures
  • drawing them on a (horizontal) path

The example demonstrates both this approach and problems you might encounter using pics. So the code:

  • starts with defining 3 feynman diagrams
  • defines the 3 text elements (a), = and +
  • draws them on one path at absolute postions

There may be more elegant ways to do this, though.

demo

\documentclass[border=3mm]{standalone}
\usepackage{tikz-feynman}% not needed: ,contour}
\usetikzlibrary{shapes.geometric}

\begin{document}
% defining some pictures
% diagrams
    % ~~~ (1) your code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \tikzset{
        A/.pic={
        \begin{feynman}
            \vertex[blob] (m) at ( 0, 0) {};
            \vertex (a) at (-1,-1) {};\vertex (b) at ( -60:1cm) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}
        }
    }
        
    % ~~~ (3) making said node a circle ~~~~~~~~~~~~~~~~~~~~~~
    \tikzset{
        B/.pic={
        \begin{feynman}
            \node[shape=circle,fill=blue] (m) at ( 0, 0) {};
            \vertex (a) at (-1,-2) {};
            \vertex (b) at ( 1,-2) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}
        }
    }   
    
    % ~~~ (4) making said node a rectangle ~~~~~~~~~~~~~~~~~~~~~~
    \tikzset{
        C/.pic={
        \begin{feynman}
            \node[shape=rectangle,fill=black] (m) at ( 0, 0) {Rectangle\vrule width 1pt height 2cm};
            \vertex (a) at (-1,-2) {};
            \vertex (b) at ( 1,-2) {};
            \vertex (c) at (-1, 2) {};
            \vertex (d) at ( 1, 2) {};
            \diagram* {
                (a) -- [photon,edge label=$q_2$] (m) 
                    -- [photon,edge   label=$q_1$] (c),
                (b) -- [plain,edge label'=$p_2$] (m) 
                    -- [plain, edge label'=$p_1$] (d),
              };
        \end{feynman}
        }
    }

% texts 
    \tikzset{t1/.pic={\node {(a)};}}
    \tikzset{t2/.pic={\node {=};}}
    \tikzset{t3/.pic={\node {+};}}


\tikz{
% drawing them all together
    \draw        pic{t1} -- (2,0) pic{A} -- 
         (3.5,0) pic{t2} -- (5,0) pic{B} -- 
         (6.5,0) pic{t3} -- (8,0) pic{C}
    ;
}   
    
\end{document}
1
  • 1
    Have a look at \raisebox: en.wikibooks.org/wiki/LaTeX/Boxes#raisebox , which is "good old LaTeX". If you want to use it, it may be better to create clean code by putting those \tikz{} statements inside \newcommands. See said book for \newcommand.
    – MS-SPO
    Feb 5, 2023 at 17:40

You must log in to answer this question.