% feynarts.sty
% LaTeX style file used with the "TeX" output format of FeynArts
% works "as is" probably only with dvips
% this file is part of FeynArts
% last modified 1 May 01 th

\special{!% FeynArts.texpro
/FeynArtsDict 100 dict def FeynArtsDict begin /DiagramBorder 1 def
/DiagramCanvas 20 def /DiagramSize DiagramBorder dup add DiagramCanvas
add def /LabelFont /Palatino-Italic def /LabelFontSize 2 def
/PropagatorThickness .11 def /VertexThickness PropagatorThickness 8 mul
def /CounterThickness PropagatorThickness 3 mul def /CrossWidth 1 def
/ArrowLength 1.2 def /ArrowHeight .4 def /DampingConst ArrowLength .65
mul dup mul dup mul def /ScalarDashing [ .66 .66 ] def /GhostDashing [
.11 .66 ] def /NPoints 10 def /NCrestsSine .5 def /NCrestsCycles .65 def
/SineAmp .25 def /CyclesAmp .6 def /CyclesBreadth .16 def /Degree
3.141592653589793 180 div def /acos { dup dup mul 1 exch sub sqrt exch
atan } bind def /asin { dup dup mul 1 exch sub sqrt atan } bind def
/polar { 3 -1 roll sub /y exch def exch sub /x exch def x dup mul y dup
mul add sqrt y x atan } bind def /stm matrix def /yoff -1 def /Layout {
dup floor //DiagramSize mul /yoff exch def //DiagramSize mul /ymax exch
def //DiagramSize mul /xmax exch def /height exch 3 index sub def /width
exch 3 index sub def translate ymax width mul xmax height mul div abs dup
1 gt { width exch div width /width 2 index def sub -.5 mul 0 } { height
mul height /height 2 index def sub -.5 mul 0 exch } ifelse translate
width xmax div height ymax div scale //stm currentmatrix pop /xoff
//DiagramBorder def /yoff yoff //DiagramSize sub //DiagramBorder add def
} bind def /Advance { yoff 0 lt {
(Too many diagrams for the chosen sheet layout.) error } if //stm
setmatrix xoff yoff translate /xoff xoff //DiagramSize add dup xmax ge {
pop /yoff yoff //DiagramSize sub def //DiagramBorder } if def } bind def
/Vert { /cto exch def /y exch def /x exch def 1 setlinecap cto 0 eq { x y
moveto 0 0 rlineto //VertexThickness setlinewidth stroke } { cto 0 gt { x
y moveto //CrossWidth .5 mul dup rmoveto //CrossWidth dup neg dup dup
rlineto exch dup 0 rmoveto rlineto //CounterThickness setlinewidth stroke
//PropagatorThickness setlinewidth 2 1 cto { .25 mul .55 add //CrossWidth
mul x y 3 -1 roll 0 360 arc stroke } for } { newpath x y //CrossWidth 0
360 arc gsave cto .3 mul 1.1 add dup 0 lt { pop 0 } if setgray fill
grestore //PropagatorThickness setlinewidth stroke } ifelse } ifelse }
bind def /Prop { /toy exch def /tox exch def /fromy exch def /fromx exch
def fromx tox eq fromy toy eq and { /midy exch def /midx exch def /ctrx
fromx midx add .5 mul def /ctry fromy midy add .5 mul def fromx fromy
ctrx ctry polar /ommc exch def /rad exch def /dir ommc 90 add def /dphi
180 def } { /height exch def fromx fromy tox toy polar /dir exch def .5
mul /lab exch def /ommc dir 90 height 0 ge { sub } { add } ifelse def
/cosommc ommc cos def /sinommc ommc sin def /midx fromx tox add .5 mul
def /midy fromy toy add .5 mul def /ctrx midx def /ctry midy def height 0
eq { /rad 20000 def /dphi lab rad div asin def -1 } { /h height abs def
/dphi h 1 atan dup add def /rad lab dphi sin div def height 0 lt { /dphi
dphi neg def } if h lab mul dup cosommc mul midx add /midx exch def
sinommc mul midy add /midy exch def h 1 gt { 1 } { -1 } ifelse } ifelse
rad dup mul lab dup mul sub sqrt mul dup cosommc mul ctrx add /ctrx exch
def sinommc mul ctry add /ctry exch def } ifelse /arrow exch def arrow 0
eq { /damping { pop 1 } def } { /damping { ommc sub abs //Degree mul rad
mul dup mul dup mul dup //DampingConst add div } bind def } ifelse /phi
ommc dphi sub def /dphi dphi dup add 2 index length div def
//PropagatorThickness setlinewidth 1 setlinecap fromx fromy moveto { cvx
exec /phi phi dphi add def } forall stroke arrow 0 ne { newpath rad 20000
ge { //ArrowLength arrow mul dup dir cos mul /x exch def dir sin mul /y
exch def x .5 mul midx add y .5 mul midy add moveto x /x cosommc
//ArrowHeight mul def x add neg y /y sinommc //ArrowHeight mul def y add
neg rlineto x dup add y dup add rlineto } { ommc dir sub sin 0 le {
/arrow arrow neg def } if /rad rad dup add def /ctrx ctrx dup add midx
sub def /ctry ctry dup add midy sub def /dphi //ArrowLength .5 mul rad
atan arrow mul def ommc dphi sub dup cos rad mul ctrx add /tipx exch def
sin rad mul ctry add /tipy exch def ommc dphi add dup /sinommc exch sin
def /cosommc exch cos def rad //ArrowHeight sub arrowarc arrow 1 eq { arc
} { arcn } ifelse rad //ArrowHeight add arrowarc exch arrow 1 eq { arcn }
{ arc } ifelse } ifelse closepath fill } if } bind def /arrowarc { dup
cosommc mul ctrx add /tailx exch def sinommc mul ctry add /taily exch def
tailx tipx sub tipy taily sub dup dup mul 2 index dup mul add dup .25 mul
rad dup mul exch sub exch div sqrt arrow mul dup 3 -1 roll mul tailx tipx
add .5 mul add /midx exch def mul taily tipy add .5 mul add /midy exch
def midx midy rad tipy midy sub tipx midx sub atan taily midy sub tailx
midx sub atan } bind def /Straight { rad 20000 lt { ctrx ctry rad phi phi
dphi add dphi 0 ge { arc } { arcn } ifelse } { phi dphi add dup cos rad
mul ctrx add exch sin rad mul ctry add lineto } ifelse } bind def
/ScalarDash { currentpoint stroke moveto //ScalarDashing 0 setdash
Straight currentpoint stroke moveto [ ] 0 setdash } bind def /GhostDash {
currentpoint stroke moveto //GhostDashing 0 setdash Straight currentpoint
stroke moveto [ ] 0 setdash } bind def /Sine { /a dphi abs //Degree mul
rad mul def /omega //NCrestsSine a mul round dup 1 lt { pop 1 } if .5 add
dup add 180 mul def 0 1 //NPoints a mul floor div 1 { /n exch def /a phi
n dphi mul add def rad a damping //SineAmp mul n omega mul sin mul sub
dup a cos mul ctrx add exch a sin mul ctry add lineto } for } bind def
/rshift CyclesAmp SineAmp sub def /phadj rshift CyclesAmp div acos def
/sinphadj phadj sin def /Cycles { /a dphi abs //Degree mul rad mul def
/omega //NCrestsCycles a mul round dup 1 lt { pop 1 } if 180 mul //phadj
add dup add def /phamp //CyclesBreadth 180 mul rad div dphi 0 lt { neg }
if def 0 1 //NPoints a mul dup add floor div 1 { /n exch def n omega mul
//phadj sub dup cos //CyclesAmp mul //rshift sub rad add /a exch def sin
n dup add 1 sub //sinphadj mul sub phamp mul phi add n dphi mul add dup
cos a mul ctrx add exch sin a mul ctry add lineto } for } bind def /ctm
matrix def TeXDict begin /texLayout { gsave //FeynArtsDict begin Layout
end grestore } bind def /texAdvance { gsave //FeynArtsDict begin Advance
end //ctm currentmatrix pop grestore } bind def /texVert { gsave //ctm
setmatrix //FeynArtsDict begin Vert end grestore } bind def /texProp {
gsave //ctm setmatrix //FeynArtsDict begin Prop end grestore } bind def
end end}

\makeatletter

\newdimen\v@w
\newdimen\v@h
\newdimen\v@r
\newdimen\v@c
\newdimen\v@x
\newdimen\v@y
\newdimen\v@xb
\newdimen\v@diag
\newdimen\v@unit
\newdimen\v@float
\v@float=10sp

\def\beginfap(#1,#2)(#3,#4){%
  \v@w=#1\unitlength\v@h=#2\unitlength%
  \v@c=#3\v@float\v@r=#4\v@float%
  \v@x=\v@w\divide\v@x\v@c%
  \v@y=\v@h\divide\v@y\v@r%
  \ifnum\v@x<\v@y%
    \v@diag=\v@x%
    \multiply\v@x\v@r%
    \v@y=\v@h\advance\v@y -\v@x%
    \v@y=.5\v@y%
    \v@x=\z@%
  \else%
    \v@diag=\v@y%
    \multiply\v@y\v@c%
    \v@x=\v@w\advance\v@x -\v@y%
    \v@x=.5\v@x%
    \advance\v@w -\v@x%
    \v@y=\z@%
  \fi%
  \multiply\v@diag\v@float%
  \v@unit=\v@diag\divide\v@unit 22% DiagramSize
  \v@c=\v@w%
  \v@r=#4sp%
  \multiply\v@r\v@diag%
  \advance\v@r\v@y%
  \advance\v@r\v@unit% DiagramBorder
  \v@xb=\v@x\advance\v@xb\v@unit% DiagramBorder
  \begin{picture}(#1,#2)%
  \put(0,0){\special{ps:currentpoint}}%
  \put(#1,#2){\special{ps:currentpoint #3 #4 texLayout}}%
  \ignorespaces}

\newenvironment{feynartspicture}{\beginfap}{\end{picture}}

\def\FADiagramLabelSize{\small}

\def\FADiagram#1{%
  \special{ps::texAdvance}%
  \advance\v@c\v@diag%
  \ifnum\v@c>\v@w%
    \advance\v@r -\v@diag%
    \v@c=\v@xb%
  \fi%
  \v@x=\v@c\v@y=\v@r%
  \FALabel(10,-.5)[b]{\FADiagramLabelSize #1}%
  \ignorespaces}

\def\FAVert(#1,#2)#3{\special{ps::#1 #2 #3 texVert}%
  \ignorespaces}

\def\FAProp(#1,#2)(#3,#4)(#5,#6)#7#8{%
  \special{ps::[ #7 ] #8 #5 #6 #1 #2 #3 #4 texProp}%
  \ignorespaces}

\newdimen\v@lx
\newdimen\v@ly

\def\FALabel(#1,#2)[#3]#4{%
  \v@lx=#1\v@unit\advance\v@lx\v@x%
  \v@ly=#2\v@unit\advance\v@ly\v@y%
  \put(0,0){\raise\v@ly\hbox to\z@{%
    \kern\v@lx\makebox(0,0)[#3]{#4}\hss}}%
  \ignorespaces}

\makeatother

