Feynman diagram with TikZ-Feynman

In summary, @Gaussian97' document is a great starting point for learning how to draw Feynman diagrams in LaTeX. However, you may not be able to get the desired results if you are using the PDFLaTeX compiler. You can fix the problem by using the LuaLaTeX compiler.
  • #1
Gaussian97
Homework Helper
683
412
TL;DR Summary
How can I write a loop in ##\phi^4## theory with TikZ-Feynman?
Hi, I'm learning how to draw Feynman diagrams in LaTeX using the TikZ-Feynman package, but in https://arxiv.org/ftp/arxiv/papers/1601/1601.05437.pdf I don't see if it's possible to draw loops in ##\lambda \phi^4## theory, how can I draw a loop that goes from one vertex to itself?

Thanks
 
  • Like
Likes JD_PM
Physics news on Phys.org
  • #3
Well, it's ok but it's not what I was looking.
By now I can create a loop, for example with the code

Code:
\begin{tikzpicture}
  \tikzfeynmanset{
  every vertex = {dot}
  }
  \begin{feynman}[small]
    \vertex (a1) {};
    \vertex[right=1.5cm of a1] (a2);
    \vertex[right=1.5cm of a2] (a3) {};
    \vertex[above=0.6cm of a2] (b);

    \diagram* {
      (a1) --[scalar] (a2) --[half left] (b) --[half left] (a2) --[scalar] (a3),
    };
    \path (b)--++(90:0.3) coordinate (A);
    \draw (A) circle(0.3);
  \end{feynman}
\end{tikzpicture}

I draw
1584268036622.png


But I wonder if there is a better way to do it.
 
  • #4
The node-to-node closed circuits don't have to be radially circular, but what's been presented here to you is not inconsistent with what apparently you asked for -- analogously, just as ##\TeX## requires you to be very specific in your commands, we need you to be very specific in saying what you're seeking, if we're to be optimally helpfully or assistively responsive.
 
  • #5
Yes, I know they don't have to be, it's not this what matters, I did it circular because I like it.
Sorry for the ambiguous question, my question is, can I do the same I did but without doing this \path and \draw, only with the TikZ-Feynman commands?
Something like adding (b) --[loop] (b)

Thanks for your time.
 
  • #6
Gaussian97 said:
Yes, I know they don't have to be, it's not this what matters, I did it circular because I like it.
Sorry for the ambiguous question, my question is, can I do the same I did but without doing this \path and \draw, only with the TikZ-Feynman commands?
Something like adding (b) --[loop] (b)

Thanks for your time.
I don't see why you're reluctant to use \path and \draw, and furthermore, if you're interested in more sophisticated than usual ##\LaTeX## graphics, I suggest that you might see how SVG can be brought in -- maybe have a look at https://wiki.inkscape.org/wiki/index.php/LaTeX
 
  • #8
Hi!

I am aimed to learn how to draw Feynman Diagrams using ##\TeX## from scratch and I am looking for some advice :smile:

The document shared by @Gaussian97 really helps. I am trying to reproduce the first of the diagrams (section 2.2, A First Diagram).

I naively followed the following steps:

1) Adding the package \usepackage{tikz-feynman} and \tikzfeynmanset{compat=1.0.0} as a warning.

2) Then I simply copy-pasted the code for the first of the diagrams

Code:
\feynmandiagram[horizontal=a to b] {
    i1 -- [fermion] a -- [fermion] i2,
    a -- [photon] b,
    f1 -- [fermion] b -- [fermion] f2,
};

But the output was

kqkqkqkq.png

Instead of the beautiful looking

lqaqsdjwx.png


What am I missing?

Any advice is very welcomed.

Thank you! :biggrin:
 
  • #9
Hello @JD_PM, I'm not an expert at all in this kind of things but I had the same problem the first time I tried to use tikz-feynman, I don't know if this will work for you but I'll tell you how I fix it (if it doesn't work then I have no idea).

In my case, the problem is that I was using the PDFLaTeX compiler (which was the default option), but to use some functionalities of tikz-feynman you must use the LuaLaTeX compiler.

Here's how I discovered the problem and how I fixed it (in case it helps you)

In my case, I use TexMaker as the editor to write LaTeX documents. In it, you can look at the log and usually it gives a message when something is wrong (In any case, look if you have some document named "Name_of_the_document.log" and open it with the notepad), I got the following message:
Package tikz-feynman Warning: LuaTeX is required if you wish to have vertices automatically placed. You can disable this warning by setting /tikzfeynman/warn luatex=false on input line 50.

Then I found that, in fact, the first line of the log was
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.7) (preloaded format=pdflatex 2020.8.21)

And found that, when I click the Run button (that for me was some kind of magic that make appear a pdf with the things I wrote) it was really doing two things: PdfLaTeX + View PDF (which I assume are some kind of commands)

After looking into the options of the editor I finally found that there was the option of compiling using LuaLaTeX, and after doing that (and the View PDF) i finally got the diagram correctly and my log file start with
This is LuaHBTeX, Version 1.12.0 (MiKTeX 20.7) (format=lualatex 2020.8.22)
and there was no Package tikz-feynman Warning

Hope it helps you
 
  • Informative
Likes JD_PM

1. What is a Feynman diagram and how is it used in physics?

A Feynman diagram is a visual representation of mathematical equations used in theoretical physics, specifically in the field of quantum field theory. It is used to depict the interactions between subatomic particles and the exchange of energy and momentum between them.

2. How is TikZ-Feynman different from other software or tools used to create Feynman diagrams?

TikZ-Feynman is a specific package for the typesetting system LaTeX, which allows for the creation of high-quality Feynman diagrams with precise control over the placement and style of each element. Other software or tools may have limited customization options or require more manual input.

3. Can I use TikZ-Feynman for diagrams outside of particle physics?

Yes, TikZ-Feynman can be used to create diagrams for any type of quantum field theory, not just particle physics. It can also be used for other mathematical illustrations, as long as they follow the Feynman diagram style.

4. Is TikZ-Feynman difficult to learn and use?

It may take some time to become familiar with the syntax and commands used in TikZ-Feynman, but there are many helpful resources and tutorials available online. Once you understand the basics, it is relatively easy to create and customize diagrams.

5. Can I export TikZ-Feynman diagrams to other formats or software?

Yes, TikZ-Feynman diagrams can be exported to various formats, including PDF, PNG, and SVG. They can also be included in documents created with other software, such as Microsoft Word or Adobe InDesign, as long as the appropriate packages and dependencies are installed.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • Advanced Physics Homework Help
Replies
6
Views
2K
Replies
14
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • High Energy, Nuclear, Particle Physics
Replies
2
Views
1K
  • Quantum Physics
Replies
5
Views
1K
  • Quantum Physics
Replies
6
Views
2K
  • High Energy, Nuclear, Particle Physics
Replies
1
Views
1K
Replies
33
Views
3K
Back
Top