LaTeX formatting Feynman Diagrams incorrectly

In summary, the conversation discusses the issue of a weird vertical Feynman Diagram appearing instead of a horizontally aligned one when using TikZ-Feynman in LaTeX code. Possible solutions mentioned include changing the compiler to LuaLaTex and using a different tool called jaxodraw. The problem is identified as a compiler bug, which can be resolved by commenting out a certain package.
  • #1
PhysicsRock
114
18
I've been trying to get Feynman Diagrams to work in my LaTeX code, however, the output is not what it is supposed to be. I'm using TeXMaker and TikZ-Feynman to draw the diagrams. My code looks like this:

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

which I have copied from the internet for testing purposes. However, instead of displaying a horizontally aligned Feynman Diagram, this gives me a weird vertical one, as seen in the attached picture.
Can anybody explain why this is happening? I am clueless and I haven't really found any solutions on the internet yet.

Thank you in advance and have a great day everybody.
 

Attachments

  • Screenshot (11).png
    Screenshot (11).png
    702 bytes · Views: 126
Physics news on Phys.org
  • #2
I've never used this tool. For my PhD thesis I used feynmf, but that's a bit tedious with "programming" the diagrams only. Now I use jaxodraw, which is WYSIWIG:

https://jaxodraw.sourceforge.io/
 
  • #3
It is a compiler bug. If you change the compiler to LuaLaTex (IDE options) then you might not be able to see the pdf previewer, but the pdf document results in (see attachment)The disadvantage is, that you have to comment out
%\usepackage[latin1]{inputenc}

Corr.: my previewer works meanwhile:

1665072342453.png
 

Attachments

  • testfile.pdf
    3.4 KB · Views: 119
Last edited:
  • Informative
  • Like
Likes topsquark, Wrichik Basu, PhysicsRock and 1 other person
  • #4
fresh_42 said:
It is a compiler bug. If you change the compiler to LuaLaTex (IDE options) then you might not be able to see the pdf previewer, but the pdf document results in (see attachment)The disadvantage is, that you have to comment out
%\usepackage[latin1]{inputenc}

Corr.: my previewer works meanwhile:

View attachment 315126
That helped. Thank you so much!
 

1. How can I fix incorrect formatting in my LaTeX Feynman diagrams?

There are a few common mistakes that can lead to incorrect formatting in LaTeX Feynman diagrams. The first thing to check is that you have included all necessary packages, such as the "feynmp" package. Additionally, make sure you have the correct syntax for drawing the diagram, including the use of commas and parentheses. If the issue persists, it may be helpful to consult online resources or ask for assistance from a more experienced LaTeX user.

2. Why are my Feynman diagrams not showing up in my LaTeX document?

If your Feynman diagrams are not appearing in your document, there could be a few potential reasons. First, make sure you have used the correct code for including the diagrams, such as \begin{fmffile} and \begin{fmfgraph}. Additionally, check that you have the necessary packages and that they are spelled correctly. If the diagrams still do not appear, there may be an issue with your LaTeX compiler or installation.

3. How can I resize my Feynman diagrams in LaTeX?

To resize a Feynman diagram in LaTeX, you can adjust the scale parameter within the \fmfframebox command. This will determine the size of the diagram as it appears in your document. Alternatively, you can also use the \fmffile and \fmfgraph commands within a \resizebox to adjust the overall size of the diagram.

4. What is the best way to add labels and annotations to my Feynman diagrams in LaTeX?

In order to add labels and annotations to your Feynman diagrams, you can use the \fmflabel and \fmfvlabel commands. These allow you to add text labels and arrows to specific points on your diagram. Additionally, you can use the \fmfblob command to add blob-style annotations. It may also be helpful to use the \fmfkeepexp and \fmffreeze commands to keep the labels in place and prevent them from being distorted during scaling.

5. Can I customize the appearance of my Feynman diagrams in LaTeX?

Yes, there are several ways to customize the appearance of Feynman diagrams in LaTeX. You can use the \fmfset command to adjust parameters such as the line style, arrow style, and label position. Additionally, you can use the \fmfforce command to manually adjust the position of vertices and lines. It may also be helpful to consult the documentation for the "feynmp" package for more advanced customization options.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
276
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
8K
  • Advanced Physics Homework Help
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Introductory Physics Homework Help
Replies
6
Views
29K
Replies
4
Views
3K
Back
Top