Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Feynman diagram latex

  1. Aug 8, 2007 #1
    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:
    \end{fmfgraph*} \end{fmffile}
    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!
  2. jcsd
  3. Aug 8, 2007 #2
    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.
  4. Aug 8, 2007 #3
    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
  5. Aug 8, 2007 #4

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    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.
  6. Aug 10, 2007 #5
    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..
  7. Aug 10, 2007 #6
    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 (Text):

        \fmfstraight % same x-coordinate for all vertices on left/right
        \fmfleftn{i}{10}  % 3 incoming quarks
        \fmfrightn{o}{10} % 3 outgoing quarks
        \fmftopn{u}{7}  % leptons @ 5,7
        \fmflabel{$\bar \nu_e$}{u[5]}
        \fmffreeze    % freeze current position of vertices
        \fmf{boson, label=$W$}{v4,v3}
    % }
    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.

    Attached Files:

  8. Aug 11, 2007 #7
    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 wanna 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.
  9. Aug 11, 2007 #8
    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 [Broken] 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: May 3, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook