Generalfeynmp | Integration into TeXnicCenter

General information and discussion about TeXnicCenter
Post Reply
dandus
Posts: 10
Joined: Thu Mar 31, 2011 12:41 pm

feynmp | Integration into TeXnicCenter

Post by dandus »

I'm trying to make some Feynman diagrams with the feynmp package, but I can't manage to get it to work properly with TeXnicCenter. I can produce them, but they don't get automatically included in the PDF. What I do now is:
  1. Produce the Metapost file using the appropriate latex code.
  2. Manually give it to Metapost (I tried to put it in the preprocessor directive of PDFLaTeX output profile, but to no avail)
  3. Separately print on a PDF file the diagrams I need
  4. Insert them in the document via \includegraphics.
I would like to make every Feynman diagram go at its place only building the source via TeXnicCenter. Any clues on how to do it?
Last edited by dandus on Mon Nov 21, 2011 7:58 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

dandus
Posts: 10
Joined: Thu Mar 31, 2011 12:41 pm

feynmp | Integration into TeXnicCenter

Post by dandus »

Done!

Since I couldn't find any answer on how to make texnic center interact with feynmp, I thought about asking how to make kile work with it instead. Turns out the solution is surprisingly fast, and works just fine with texnic center too.

As you can see here
http://tex.stackexchange.com/questions/ ... -or-feynmp, by using the code

Code: Select all

\usepackage{feynmp}
\DeclareGraphicsRule{*}{mps}{*}{}

\makeatletter
\def\endfmffile{%
  \fmfcmd{\p@rcent\space the end.^^J%
          end.^^J%
          endinput;}%
  \if@fmfio
    \immediate\closeout\@outfmf
  \fi
  \ifnum\pdfshellescape=\@ne
    \immediate\write18{mpost \thefmffile}%
  \fi}
\makeatother
and twice launching pdftex with the -enable-write18 option, everyithing worked. I post it in case it can be of any help to someone, which i think it will since I had a very hard time googling it.
dandus
Posts: 10
Joined: Thu Mar 31, 2011 12:41 pm

feynmp | Integration into TeXnicCenter

Post by dandus »

By the way, it appears that the feynman diagrams appear in the wrong order using these method. You can avoid this using one metapost file per diagram. I automated the process by defining a new environment

Code: Select all

\newenvironment{feynman}[1][1]{
\begin{fmffile}{fey_#1}
\begin{fmfgraph}(40,25)\fmfkeep{#1}
\fmfpen{thin}
}{
\end{fmfgraph}
\end{fmffile}
}
which accepts as an argument the name of the diagram, used both for the filenamea and for the sake of the \fmfkeep command.
Post Reply