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
117
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: 166
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: 149
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!
 

FAQ: LaTeX formatting Feynman Diagrams incorrectly

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.

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.

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.

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.

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

Replies
4
Views
2K
Replies
1
Views
3K
Replies
7
Views
8K
Replies
3
Views
933
Replies
4
Views
4K
Replies
6
Views
31K
Back
Top