diff options
Diffstat (limited to 'Master/texmf-dist/fonts/source/public/feyn/feynmac.mf')
-rw-r--r-- | Master/texmf-dist/fonts/source/public/feyn/feynmac.mf | 218 |
1 files changed, 86 insertions, 132 deletions
diff --git a/Master/texmf-dist/fonts/source/public/feyn/feynmac.mf b/Master/texmf-dist/fonts/source/public/feyn/feynmac.mf index 568720d99be..e6df38b25d5 100644 --- a/Master/texmf-dist/fonts/source/public/feyn/feynmac.mf +++ b/Master/texmf-dist/fonts/source/public/feyn/feynmac.mf @@ -1,156 +1,108 @@ -% The following macros produce general gauge boson half-loops, and fermions -% bosons and ghosts at arbitrary angles. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% They are: -% def gbhalfloop (expr charno, wid, nopts, inv) = -% charno character number -% wid character width in double modules -% (= length of fermion) -% nopts number of intermediate points in the loop -% inv if <> 0, invert the loop -% -% def gfermion (expr code, ang) = -% def gboson (expr code, ang, stretch, taper) = -% def gghost (expr code, ang) = -% code character position -% ang angle anticlockwise from x-axis -% -90 <= ang <= +90, or all hell will break loose -% stretch Produces a character which is of length -% (2module*stretch). We need this so that we can -% construct a vertical propagator which will -% mesh smoothly with a photon half-loop. -% taper When a vertical photon has to join a loop which -% is raised at its central point, it has to taper -% to squeeze into the gap. +% Macros to support feyn.mf +% Release 0.3.1, 2008 February 29 def looselink = ..tension 0.75.. enddef; def pen = pickup diagram_pen enddef; - numeric nn; def dirlooselink(expr point,rtn) = looselink{(-point) rotated (90-rtn)}point enddef; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -def gbhalfloop (expr charno, wid, nopts, inv) = - % charno character number - % wid character width in double modules (= length of fermion) - % nopts number of intermediate points in the loop - % inv if <> 0, invert the loop - halfwidth# := wid*module# ; - define_pixels (halfwidth); - if odd (nopts): nn := nopts - else: nn := nopts+1 - fi; % nn is odd - if inv <> 0: % invert it - beginchar (charno, 0, a#, halfwidth# + phfudge# - a#); - else: - beginchar (charno, 0, halfwidth# + phfudge# + a#, 0); - fi - pen; "gauge boson (half) loop"; - z1 = (-halfwidth,0); - z[nn+1] = (halfwidth, 0); - for x = 2 upto nn: - z[x] = z1 rotated (- (x-1) * 180 / nn); - endfor - draw z1{dir (180-phangle)} - for x = 2 step 2 until nn: - dirlooselink(z[x], phangle) dirlooselink(z[x+1], -phangle) - endfor - looselink {dir (180+phangle)}z[nn+1]; - if inv <> 0: - currentpicture := currentpicture reflectedabout ((0,0),(1,0)); fi - currentpicture := currentpicture shifted (0,a); % shift up to axis -% labels (range 1 thru nn+1); +% Draw three related characters, one plain, one with an right-pointing +% arrow, and one with a left-pointing one, at basechar, basechar-0x20 and +% basechar-0x60. +def threechars(expr basechar, name, cp, apoint, wsharp, hsharp, dsharp, + anudge, apos) = + % basechar : the charcode of the character in the lowercase range + % name : the name of the character + % cp : the path to be drawn + % apoint : the point along the path where arrow and annotation are to go + % wsharp, hsharp, dsharp : the sharped dimensions of the character + % anudge : if a pair, the offset from (point apoint of cp) where + % the annotation is to go (usually numeric 0, indicating + % no offset) + % apos : one of the apos arguments to annotate_at + beginchar (basechar, wsharp, hsharp, dsharp); + name; + pen; + draw cp; + annotate_at(point apoint of cp if (pair anudge): shifted anudge fi, + apos); + endchar; + beginchar (byte basechar-hex"20", wsharp, hsharp, dsharp); + "r-arrowed " & name; + pen; + draw cp; + drawarrow (littlearrow, + point apoint of cp, + angle(direction apoint of cp)); + annotate_at(point apoint of cp if (pair anudge): shifted anudge fi, + apos); + endchar; + beginchar (byte basechar-hex"60", wsharp, hsharp, dsharp); + "l-arrowed " & name; + pen; + draw cp; + drawarrow (littlearrow, + point apoint of cp, + angle(direction apoint of cp) + 180); + annotate_at(point apoint of cp if (pair anudge): shifted anudge fi, + apos); endchar; enddef; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% The following characters are in boxes the same vertical size as the black -% bit of the character, but they project out of the top by an amount equal to -% the height of the math axis, and are that same height clear of the bottom -% of the box. -% -%%%% -90 <= ang <= +90, or all hell will break loose - - -def gfermion (expr code, ang) = - beginchar (code, 2module#*(cosd ang), 2module#*(abs sind ang), 0); - pen; - if ang > 0 : % slopes upward - draw (0,a) .. (w,h+a); - else : - draw (0,h+a) .. (w,a); - fi - endchar; +% Writes on the log file a string consisting of +% annotate charcode xofs yofs apos +% where charcode is the current character code, and xofs and yofs are the +% positions of the given point, relative to the reference point, in units +% of the font module. The string apos is one of top, bot, urt, ulft, lrt, +% llft, to indicate where the annotation is to sit, relative to the +% indicated position. +% +% Must be called within beginchar()...endchar; +def annotate_at (expr p, apos) = + message "annotate " & decimal charcode & " " & + decimal (xpart p/module) & " " & decimal (ypart p/module) & " " + & apos & " "; enddef; -def gboson (expr code, ang, stretch, taper) = - beginchar (code, - 2module#*(cosd ang)*stretch, 2module#*(abs sind ang)*stretch, 0); - pen; - if ang > 0 : % slopes upward - z1 = (0,a); z5 = (w,h+a); - else : - z1 = (0,h+a); z5 = (w,a); - fi - z2-z1 = z3-z2 = z4-z3 = z5-z4; - def ::(expr b) = {dir (ang+b)} looselink {dir (ang-b)} enddef; - draw z1 ::(phangle) z2 ::(-phangle) z3 ::(phangle) z4 - if taper <> 0 : {dir (ang-phangle)} .. tension 1 and 0.8 .. - {dir (ang+phangle/2)} - else : ::(-phangle) - fi - z5; - endchar; -enddef; +% Draw an arrow. +def drawarrow (expr size, pos, ang) = + % size : the scale of the arrow + % pos : the position of the arrow, relative to the reference point + % ang : the direction in which the arrow points + begingroup + pair t[]; + y0 = y1 = y4 = 0; + x1 = -4x4 = -2x2 = size; + + x2 = x3 = x0; + y2 - y0 = y0 - y3 = size/2; -def gghost (expr code, ang) = - beginchar (code, 2module#*(cosd ang), 2module#*(abs sind ang), 0); - pen; - if ang > 0 : % slopes upward - z1 = (0,a); z10 = (w,h+a); - else : - z1 = (0,h+a); z10 = (w,a); - fi - z4-z3 = 2(z2-z1); - z4-z3 = z6-z5 = z8-z7; - z2-z1 = z3-z2 = z5-z4 = z7-z6 = z9-z8 = z10-z9; - draw z1..z2; draw z3..z4; draw z5..z6; draw z7..z8; draw z9..z10; - endchar; + forsuffixes s = 1,2,3,4 : + t[s] := z[s] rotated ang shifted pos; + endfor; + fill t4--t2--t1--t3--cycle; + + endgroup enddef; def garrow (expr code, ang, onaxis) = -% If onaxis is 1, the arrow will be on the math axis, if 0, it'll be at the -% origin, and slightly smaller. -% We need the latter behaviour because \arrow places the arrow in a -% particular spot in the diagram. - numeric localarrowsize; - - if onaxis = 1 : - localarrowsize := bigarrow; - else : +% if onaxis = 1 : +% localarrowsize := bigarrow; +% else : localarrowsize := littlearrow; - fi +% fi - beginchar (code, 0, 0, 0); "garrow"; - pair t[]; - z1 = (localarrowsize, onaxis*a); - z4 = (-localarrowsize/4,onaxis*a); - z0 = (-localarrowsize/2,onaxis*a); - z2 = z0 + (0,localarrowsize/2); - z3 = z0 - (0,localarrowsize/2); - - forsuffixes s = 1,2,3,4 : - t[s] = z[s] rotated ang; - endfor - - fill t4--t2--t1--t3--cycle; + beginchar (code, 0, 0, 0); "garrow"; + drawarrow (localarrowsize, (0, onaxis*a), ang); endchar; enddef; @@ -181,8 +133,10 @@ def errorchar (expr ht) = if y[i] <= y[ilowest]: ilowest := i; fi endfor draw z[ilowest]{dir (ilowest*360/npetals)}..origin; - %draw z[npetals-2]{dir ((npetals-2)*360/npetals)}..origin; - draw origin{dir 0}..(rad,rad); - draw (rad,rad){dir 180}..origin; + pair leafend; + xpart(leafend) = 2rad; % want something like currentpicture.rt; + ypart(leafend) = 2y[ilowest]/3; + draw origin{dir 60} .. leafend; + draw leafend .. {dir 180}origin; endgroup enddef; |