LaTeX Draw Feynman Diagrams w/ Latex for Beginners

AI Thread Summary
The discussion focuses on challenges faced by a beginner in using LaTeX to draw Feynman diagrams, specifically with the feynmf package that requires Metafont. The user struggles with syntax errors and the need to reprocess files, expressing a desire for simpler alternatives. Suggestions include using JaxoDraw, which can export to LaTeX code, as a more user-friendly option. Participants emphasize the importance of understanding Metafont for proper label display and recommend consulting the FeynMF manual for command references. Overall, the conversation highlights the complexities of using feynmf while exploring more accessible tools for diagram creation.
Super_Leunam
Messages
14
Reaction score
0
Hi! I need some help with latex. I need to draw Feynman diagrams and it seems that the package feynmfm relies on Metafont, which I really don't even have the slightest idea as how to use it.

Anyway, I tried to find a good tutorial on the subject (metafont) but it looks like i will need some help since i still consider myself a newbie in latex.

I'm using the full installation of Miktex 2.6 on Texnicenter which I know has the packages already. Whenever I try to follow the commands for drawing a diagram like this:
\begin{verbatim}
\begin{fmffile}{decan}
\begin{fmfgraph*}(40,25)
\fmfleft{o3}
\fmfright{i1,o1,o2}
\fmf{fermion}{i1,v1}
\fmf{fermion}{o1,o2,o3}
\end{fmfgraph*} \end{fmffile}
\end{verbatim}
for the feynman graph of the neutron decay( Maybe I'm not doing the sintax right?) I get a single arrow all over my writing in the last paragraph and not even an error message.
It says that i have to somehow reprocess the file "decan.mf" and try again but that's my problem . i have no experience with metafont or something like that..like i said I'm almost illiterate in Tex/LAtex. I've used latex for my reports but until now, I only needed to type math formulas.

If there's another way to draw Feynman Diagrams, other than drawing it with some graphics application and pasting it, please let me know. All I need is to learn how to draw Feynman diagrams using some package since I don't want to overload my pdf with inserted graphics. Thanks in advance!
 
Physics news on Phys.org
For relatively simple diagrams you could try using JaxoDraw which can export to LaTex code. Never used that method myself (I only use it to quickly create pngs) but it seems easier given that the FeynMF stuff can be a real pain in the lowerback, especially on windows.
 
Thanks, I'm trying to install the application... I'll be happy if i can get a decent diagram complied with texnicenter but still I would like to learn the feynMF package.. so if theree's someone who can explain me all the details I would really appreciate it.
Thanks for your help
 
Did you include the package in the beginning of the file. If not you have too. Now I don't have any experience with your particular file that you are working with so I'd have to investigate it more fully.
 
yes, i did include it. I'm using jaxodraw now... i think I'll stick to it..but if you can enlighten me with this feynmf package that would be awesome maybe other people are still struggling to get it work...
thanks anyway..
 
Out of curiosity: Did the TeX output of jaxodraw and the inclusion in your file work without any bigger complications (like I said, I only created picture files, yet)?

For your Feynmf issue:
- You do have the Feynmf manual at hand, do you?
- I'm not really experienced with Feynmf, but from the code you posted I'd assume a resulting picture similar to the one attached with v1 floating around somewhere (not sure if feynmf has a rule for placing freely-floating vertices or if it possibly ignores them totally).
- Trying to compile your code-snipped, I actually do get a warning and an error message, stemming from the floating vertex v1.
- From my experience, you can learn FeynMF by starting from working graphs and improving/altering them as needed. You can look up command in the manual and try them out, then. For a start, here's a possible diagram for your neutron decay:
Code:
\begin{fmffile}{neutron}
%\fmfframe(1,7)(1,7){
	\begin{fmfgraph*}(100,100)
	\fmfstraight % same x-coordinate for all vertices on left/right
	\fmfleftn{i}{10}  % 3 incoming quarks
	\fmflabel{$u$}{i[1]}
	\fmflabel{$d$}{i[2]}
	\fmflabel{$d$}{i[3]}
	\fmfrightn{o}{10} % 3 outgoing quarks
	\fmflabel{$u$}{o[1]}
	\fmflabel{$d$}{o[2]}
	\fmflabel{$u$}{o[3]}
	\fmftopn{u}{7}  % leptons @ 5,7
	\fmflabel{$\bar \nu_e$}{u[5]}
	\fmflabel{$e^-$}{u[7]}
	\fmf{fermion}{i[1],o[1]}
	\fmf{fermion}{i[2],o[2]}
	\fmf{fermion}{i[3],v3,o[3]}
	\fmffreeze    % freeze current position of vertices
	\fmf{boson, label=$W$}{v4,v3}
	\fmf{fermion}{u[5],v4,u[7]}
  \end{fmfgraph*}
% }
\end{fmffile}
Compile the file twice, then process the .mf file with metafont. Then compile again. Warning: On Windows, I had to delete a lot of relatively hidden (somewhere in the jungle of paths) files when doing changes to the diagram - otherwise the changes will not show and the diagram will remain the old one. Like I said, FeynMF can be a real pain (if you find a way around that, pls tell me). I usually circumvent the problem by giving the files names like "neutron1" and increasing the counter for every change (creating a new file). That works but fills your disk with crap files in the long run, so it's a good idea to have a big cleanup once the diagram is finished and looks like it should.
 

Attachments

  • feynmf.png
    feynmf.png
    551 bytes · Views: 860
Yeah jaxodraw's code gave me no problem, just needs to be adjusted manually because when you draw it by hand sometimes the arrows are not in the exact place you want them. I guess this wouldn't be a problem if i were using FeynMF.
Well I knew my code for feynmf wasn't right :S but my problem is another: I don't know how to use metafont... I downloaded a metafont tutorial but it seems lengthy and I don't think it has what i need.

I don't want to sound lazy but would please explain to me how to use it?
Thanks for your help wiht jaxodraw btw :D

Oh, about that code you gave me, it works! i don't know how it worked but i Just compiled it! I just pasted it and compiled it without doing anything about metafont but ...there are no labels! I compiled it thre times and still no labels :S I'm confused now.
 
You have to process the file with metafont for the labels to show up. On Windows, right-click the ".mf" file and select "open with...", then browse to and select "mf.exe" (the metafont executable). On a console (linux et.al) you'd probably just type "mf filename.mf" (or whatever the executable is called there plus possibly a path). With manual, I meant the FeynMF manual by Thorsten Ohl: http://materiales.fis.puc.cl/cgi-bin/dwww/usr/share/doc/feynmf/manual.ps.gz or http://www.pd.infn.it/TeX/doc/latex/feynmf/manual.pdf . Don't bother actually working through it, just look up the commands you need.
 
Last edited by a moderator:

Similar threads

Replies
3
Views
4K
Replies
3
Views
2K
Replies
1
Views
3K
Replies
8
Views
6K
Replies
2
Views
3K
Replies
2
Views
5K
Replies
5
Views
9K
Replies
2
Views
1K
Replies
2
Views
2K
Back
Top