Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to draw oval shape with FeynMP? Here is a mwe for a blob [which is a a circle]:

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{feynmp}
\usepackage{rotating}
\setlength{\unitlength}{1mm}
\pagestyle{empty}

\usepackage{ifpdf}
\ifpdf
  \DeclareGraphicsRule{*}{mps}{*}{}
\fi

\makeatletter
\def\endfmffile{%
  \fmfcmd{\p@rcent\space the end.^^J%
          end.^^J%
          endinput;}%
  \if@fmfio
    \immediate\closeout\@outfmf
  \fi
  \IfFileExists{\thefmffile.mp}{\immediate\write18{mpost \thefmffile}}{}
  \let\thefmffile\relax
}
\makeatother

\begin{document}
\begin{center}
\begin{fmffile}{lower_bloba}
    \begin{fmfgraph*}(50,70)
    \fmfrightn{r}{1}
    \fmfleftn{l}{1}
    \fmftopn{t}{1}
        \fmfblob{.5w}{v1}
        \fmf{fermion}{l1,v1}
        \fmf{fermion}{v1,r1}
        \fmf{photon}{t1,v1}
\end{fmfgraph*}
\end{fmffile}
\end{center} 
\end{document}
share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

I don't think it's possible without modifying the FeynMP sources, or at least I don't know how.

But you can modify the sources of feynmp.sty and feynmp.mp to do what you want. Make sure you put feynmp.sty and feynmp.mp in the same directory where you compile your latex file and do the following. (Edit: see below for an even simpler patch to feynmp.mp)

On the file feynmp.mp:1325 (line 1325) there is the definition of vblob(). Based on it I created another procedure called vblobOval() right below it:

vardef vblobOval (expr bd) (text vl)=
  forsuffixes $=vl:
    if not vexists $: venter $; fi
    vlist[vlookup $]decor.shape := fullcircle xscaled 1.4;
    vlist[vlookup $]decor.size := bd;
    vlist[vlookup $]decor.sty := "shaded";
 endfor
enddef;

where the only difference is the xscaled 1.4 part, which makes the circle oval (you can play with the number; 1.4 seemed nice to me).

On the file feynmp.sty:289 there is the definition of \fmfblob. Based on it I wrote \fmfblobOval

\def\fmfblobOval#1#2{\fmfcmd{vblobOval ((#1), \fmfpfx{#2});}}

below the original \fmfblob, so you still have both.

And now on your latex file instead of using \fmfblob you can use \fmfblobOval,

\fmfblobOval{.5w}{v1}

and you'll have an oval-shaped vertex:

oval-shaped vertex with xscale 1.4

Edit: One can write a one-line patch to feynmp.mp to include an oval style for blobs. If you write

elseif match_prefix (n, "oval"): p := fullcircle xscaled 1.4;

below line 1282 in feynmp.mp you can use the following line to draw an oval-shaped blob in your latex file:

\fmfv{decor.shape=oval, decor.filled=shaded, decor.size=(.5w)}{v1}

The command \fmfv is an equivalent way of drawing a blob (see pag. 17 of the FeynMF manual) which allows one to specify the options explicitly. So you can use the new "oval" shape from the one-line patch above.

share|improve this answer
2  
+1. You may be able to avoid editing the source with the \fmfcmd command (section 2.8 of the manual). –  egreg Dec 1 '12 at 10:56
    
@egreg: Thanks a lot for pointing that out. It looks like it's indeed possible from a first look. –  Mafra Dec 1 '12 at 11:49
    
@egreg: On a second look, it doesn't look possible to extend the drawing of blobs using \fmfcmd. From my understanding of section 2.8 you can only add more styles for arcs. –  Mafra Dec 1 '12 at 13:03
2  
You can use \fmfcmd. Just create a vbloboval.mp file containing the vardef text; then add the definition of \fmfblobOval in the document preamble and in the code for the picture just add \fmfcmd{input vbloboval;} and use \fmfblobOval instead of \fmfblob –  egreg Dec 1 '12 at 14:30
    
Instead of xscale 1.4 I used yscale 0.5 which vertically squeezed the circle instead of horizontal stretch. Thank you very much Mafra for your beautiful answer and egreg for your helpful comment! –  Laura Dec 2 '12 at 7:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.