-
Notifications
You must be signed in to change notification settings - Fork 0
/
feynmf.sty
423 lines (422 loc) · 14.8 KB
/
feynmf.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
%%
%% This is file `feynmf.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% feynmf.dtx (with options: `style')
%%
%% Copyright (C) 1989, 1990, 1992-1995 by [email protected]
%%
%% This file is NOT the source for feynmf, because almost all comments
%% have been stripped from it. It is NOT the preferred form of feynmf
%% for making modifications to it.
%%
%% Therefore you can NOT redistribute and/or modify THIS file. You can
%% however redistribute the complete source (feynmf.dtx and feynmf.ins)
%% and/or modify it under the terms of the GNU General Public License as
%% published by the Free Software Foundation; either version 2, or (at
%% your option) any later version.
%%
%% As a special exception, you can redistribute parts of this file for
%% the electronic distribution of scientific papers, provided that you
%% include a short note pointing to the complete source.
%%
%% Feynmf is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \CheckSum{924}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fileversion{v1.08}
\NeedsTeXFormat{LaTeX2e}
{\def\RCS#1#2\endRCS{%
\ifx$#1%
\@RCS $#2 \endRCS
\else
\@RCS $*: #1#2$ \endRCS
\fi}%
\def\@RCS $#1: #2,v #3 #4 #5 #6 #7$ \endRCS{%
\gdef\filename{#2}%
\gdef\filerevision{#3}%
\gdef\filedate{#4}%
\gdef\filemaintainer{#6}}%
\RCS $Id: feynmf.dtx,v 1.30 1996/12/02 09:20:36 ohl Exp $ \endRCS}%
\ProvidesPackage{feynmf}[\filedate\space\fileversion\space
LaTeX/Metafont Feynman Diagram Package (\filemaintainer)]
\let\fmf@noexpandoff\relax
\DeclareOption{pre-1.03}{%
\PackageWarning{feynmf}{%
Pre v1.03 compatibility can clash with font loading}
\def\fmf@noexpandoff{\let\noexpand\relax}}
\DeclareOption{errorstop}{\let\@interactionmode\errorstopmode}
\DeclareOption{scroll}{\let\@interactionmode\scrollmode}
\DeclareOption{nonstop}{\let\@interactionmode\nonstopmode}
\DeclareOption{batch}{\let\@interactionmode\batchmode}
\let\@interactionmode\errorstopmode
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphics}}
\ProcessOptions
\let\mdqrestore\relax
\@ifundefined{mdqoff}{}{%
\mdqoff
\let\mdqrestore\mdqon}
\def\fmfcmd#1{%
\if@fmfio
\immediate\write\@outfmf{#1}%
\fi
\ignorespaces}
\newif\if@fmfio
\@fmfiotrue
\newwrite\@outfmf
\newtoks\fmfbuf@
{\catcode`\%=11\gdef\p@rcent{%}}
\edef\fmf@revision{\filerevision}
\def\fmffile#1{%
\def\thefmffile{#1}%
\equaltojobname{\thefmffile}{%
\errhelp={The argument of \fmffile MUST NOT be identical to the^^J%
name of your main input file! I will use fmfdefault.mf^^J%
this time around, but you'd better fix your code now!}%
\errmessage{Invalid arument of \string\fmffile!}%
\def\thefmffile{fmfdefault}}{}%
\batchmode
\global\expandafter\font%
\csname f@ynmf:\thefmffile\endcsname=\thefmffile
\@interactionmode
\expandafter\let\expandafter\f@ynmf\csname f@ynmf:\thefmffile\endcsname
\ifx\f@ynmf\nullfont
\def\f@ynmf{Feynman graph:}%
\IfFileExists{\thefmffile.mf}%
{\typeout{%
feynmf: File \thefmffile.tfm not found:^^J%
feynmf: Process \thefmffile.mf with METAFONT and then %
reprocess this file.}}%
{\typeout{%
feynmf: Files \thefmffile.mf and \thefmffile.tfm not found:^^J%
feynmf: This job will create \thefmffile.mf, process it %
later with METAFONT^^J%
feynmf: and then reprocess this file. Don't worry about a %
harmless premature^^J%
feynmf: MakeTeXTFM that might have failed just a moment ago!}}%
\else
\typeout{%
feynmf: File \thefmffile.tfm found.^^J%
feynmf: Nevertheless, if the picture has changed, %
reprocess \thefmffile.mf.^^J%
feynmf: If dimension have changed, reprocess \thefmffile.mf %
and \jobname.tex.}%
\fi
\if@fmfio
\@ifundefined{ifmeasuring@}%
{}%
{\def\if@fmfio{\ifmeasuring@\else}}%
\immediate\openout\@outfmf=\thefmffile.mf\relax
\fmfcmd{\p@rcent\space \thefmffile.mf -- do not edit, %
generated automatically by \jobname.tex^^J%
input feynmf^^J%
require_RCS_revision "\fmf@revision";}%
\fi
\setcounter{fmfgraph}{0}}
\let\thefmffile\relax
\newcounter{fmfgraph}
\def\equaltojobname#1#2#3{%
\edef\@tempa{#1}%
\edef\@tempa{\meaning\@tempa}%
\edef\@tempb{\jobname}%
\edef\@tempb{\meaning\@tempb}%
\ifx\@tempa\@tempb
#2
\else
#3
\fi}
\def\endfmffile{%
\fmfcmd{\p@rcent\space the end.^^J%
end.^^J%
endinput;}%
\let\thefmffile\relax
\if@fmfio
\immediate\closeout\@outfmf
\fi}
{\catcode`\#=11\gdef\sh@rp{#}%
\catcode`\"=11\gdef\dqu@te{"}}
\def\fmf@graph#1#2{%
\ifx\thefmffile\relax
\errhelp={Outside a fmffile environment, I have no clue as to where^^J%
the METAFONT commands should go. I will use fmfdefault.mf^^J%
for this graph, but you'd better fix your code!}%
\errmessage{I detected a fmfgraph environment outside of fmffile}%
\fmffile{fmfdefault}
\fi
\global\expandafter\advance\csname c@fmfgraph\endcsname \@ne
\fmfcmd{beginchar(\thefmfgraph, #1*\the\unitlength\sh@rp, %
#2*\the\unitlength\sh@rp, 0);^^J%
\dqu@te feynmf: \thefmfgraph\dqu@te;}%
\fmfcmd{LaTeX_unitlength:=\the\unitlength;}%
\begin{fmfsubgraph}(0,0)(w,h)
\fmfinit
\fmfpen{thin}}
\def\fmfgraph(#1,#2){%
\fmf@graph{#1}{#2}%
\def\fmfkeep##1{\fmf@keep{#1}{#2}{##1}}%
{\f@ynmf \char\value{fmfgraph}}%
\ignorespaces}
\def\endfmfgraph{%
\fmffreeze
\fmfdraw
\end{fmfsubgraph}
\fmfcmd{endchar;}%
\def\fmfkeep##1{\fmf@nokeep}}
\def\fmfchar{\@nameuse{fmfgraph}}
\def\endfmfchar{\@nameuse{endfmfgraph}}
\@namedef{fmfgraph*}(#1,#2){%
\begin{picture}(#1,#2)
\fmf@graph{#1}{#2}%
\def\fmfkeep##1{\fmf@keepstar{#1}{#2}{##1}}%
\if@fmfio
\def\thefmfext{.log}%
\IfFileExists{\thefmffile.log}%
{}%
{\IfFileExists{\thefmffile.lis}%
{\def\thefmfext{.lis}}%
{}}%
{\catcode`\%=14\relax
\grepfile%
{\thefmfgraph}%
{\thefmffile\thefmfext}%
{\thefmffile.t\thefmfgraph}}%
\fi
\put(0,0){{\f@ynmf \char\value{fmfgraph}}}%
\ignorespaces}
\@namedef{endfmfgraph*}{%
\endfmfgraph
\if@fmfio
{\catcode`\%=14\relax
\fmf@noexpandoff
\InputIfFileExists{\thefmffile.t\thefmfgraph}{}{%
\typeout{%
feynmf: Label file \thefmffile.t\thefmfgraph\space not found:^^J%
feynmf: Process \thefmffile.mf with METAFONT and then %
reprocess this file.}}}%
\fi
\end{picture}}
\@namedef{fmfchar*}{\@nameuse{fmfgraph*}}
\@namedef{endfmfchar*}{\@nameuse{endfmfgraph*}}
\def\fmfkeep#1{\fmf@nokeep}
\def\fmf@nokeep{%
\errhelp={There's nothing to \string\fmfkeep!}%
\errmessage{feynmf: \string\fmfkeep\space outside of `fmfgraph'!}}
\def\fmf@keep#1#2#3{%
\global\@namedef{fmf@k:e:#3}{\begin{fmfgraph}(#1,#2)\end{fmfgraph}}%
\global\e@namedef{fmf@k:f:#3}{\thefmffile}%
\global\e@namedef{fmf@k:c:#3}{\thefmfgraph}}
\def\fmf@keepstar#1#2#3{%
\global\@namedef{fmf@k:e:#3}{\begin{fmfgraph*}(#1,#2)\end{fmfgraph*}}%
\global\e@namedef{fmf@k:f:#3}{\thefmffile}%
\global\e@namedef{fmf@k:c:#3}{\thefmfgraph}}
\def\e@namedef#1{\expandafter\edef\csname #1\endcsname}
\def\fmfreuse#1{%
\@ifundefined{fmf@k:e:#1}%
{\typeout{%
feynmf: \string\fmfreuse: %
missing \string\fmfkeep\space for `#1'!}}%
{\edef\thefmffile{\@nameuse{fmf@k:f:#1}}%
\expandafter\let\expandafter\f@ynmf%
\csname f@ynmf:\thefmffile\endcsname
\@nameuse{c@fmfgraph}\@nameuse{fmf@k:c:#1}%
\advance\@nameuse{c@fmfgraph}-1%
\def\fmfcmd##1{}%
\@nameuse{fmf@k:e:#1}}}
\def\fmfframe(#1,#2)(#3,#4)#5{%
\leavevmode
\hbox{\vbox{\vskip#2\unitlength\par
\hbox{\hskip#1\unitlength#5\hskip#3\unitlength}\par
\vskip#4\unitlength}}}
\def\fmfpen#1{\fmfcmd{pickup pencircle scaled #1;}}
\def\fmfsubgraph(#1,#2)(#3,#4){\fmfcmd{subgraph (#1, #2, #3, #4);}}
\def\endfmfsubgraph{\fmfcmd{endsubgraph;}}
\def\grepfile#1#2#3{%
\begingroup
\edef\pattern{\csname*grep*#1*\endcsname}%
\immediate\openin\grep@infile #2\relax
\ifeof\grep@infile
\else
\grep@outopenfalse
\endlinechar=-1
\@sanitize
\catcode`\{=1 \catcode`\}=2 \catcode`\%=14 \relax
\loop
\read\grep@infile to \grep@lbuf
\ifeof\grep@infile
\grep@contfalse
\else
\grep@conttrue
\ifx\grep@lbuf\empty
\else
\expandafter\grep@aline\grep@lbuf\sentinel
\ifx\pattern\grep@tag
\ifgrep@outopen
\else
\immediate\openout\grep@outfile #3\relax
\immediate\write\grep@outfile{\p@rcent\space #3 %
-- generated automatically from #2}%
\immediate\write\grep@outfile{\p@rcent\space
Think twice before editing THIS file!}%
\grep@outopentrue
\fi
\immediate\write\grep@outfile{\grep@val}%
\fi
\fi
\fi
\ifgrep@cont
\repeat
\ifgrep@outopen
\immediate\closeout\grep@outfile
\fi
\fi
\immediate\closein\grep@infile
\endgroup}
\newread\grep@infile
\newwrite\grep@outfile
\newif\ifgrep@cont
\newif\ifgrep@outopen
\def\grep@aline#1#2\sentinel{%
\ifx:#1%
\grep@splitlbuf#2\sentinel
\else
\edef\grep@tag{\csname*grep*\endcsname}%
\def\grep@val{}%
\fi}
\def\grep@splitlbuf#1:#2\sentinel{%
\edef\grep@tag{\csname*grep*#1*\endcsname}%
\def\grep@val{#2}}
\def\Compose#1#2#3{#1{#2{#3}}}
\def\gobblefalse\else\gobbletrue\fi#1#2{\fi#1}
\def\gobbletrue\fi#1#2{\fi#2}
\def\TeXif#1{#1\gobblefalse\else\gobbletrue\fi}
\def\Nil#1#2{#2}
\def\Cons#1#2#3#4{#3{#1}{#2}}
\def\Singleton#1{\Cons{#1}\Nil}
\def\Foldr#1#2#3{#3{\Foldr@{#1}{#2}}{#2}}
\def\Foldr@#1#2#3#4{#1{#3}{\Foldr{#1}{#2}{#4}}}
\def\Map#1{\Foldr{\Compose\Cons{#1}}\Nil}
\def\Unlistize#1{#1\Unlistize@{}}
\def\Unlistize@#1{#1\Foldr\Commaize{}}
\def\Commaize#1#2{, #1#2}
\def\Listize#1{\Listize@#1,\relax @@@}
\def\Listize@#1,#2@@@{%
\TeXif{\ifx\relax#2}%
{\Singleton{#1}}%
{\Cons{#1}{\Listize@#2@@@}}}
\def\fmfpfx@#1{__#1}
\def\fmfpfx#1{\Unlistize{\Map\fmfpfx@{\Listize{#1}}}}
\def\fmfwizard{\fmfcmd{feynmfwizard := true;}}
\def\fmfnowizard{\fmfcmd{feynmfwizard := false;}}
\def\fmfshrink#1{\fmfcmd{shrink (#1);}}
\def\endfmfshrink{\fmfcmd{endshrink;}}
\def\fmfinit{\fmfcmd{vinit;}}
\def\fmf#1#2{%
\fmfbuf@={#1}%
\fmfcmd{vconnect ("\the\fmfbuf@", \fmfpfx{#2});}}
\def\fmfn#1#2#3{
\fmfbuf@={#1}%
\fmfcmd{vconnectn ("\the\fmfbuf@", \fmfpfx{#2}, #3);}}
\def\fmfcyclen#1#2#3{%
\fmfbuf@={#1}%
\fmfcmd{vcyclen ("\the\fmfbuf@", \fmfpfx{#2}, #3);}}
\def\fmfrcyclen#1#2#3{%
\fmfbuf@={#1}%
\fmfcmd{vrcyclen ("\the\fmfbuf@", \fmfpfx{#2}, #3);}}
\def\fmfforce#1#2{\fmfcmd{vforce ((#1), \fmfpfx{#2});}}
\def\fmfshift#1#2{\fmfcmd{vshift ((#1), \fmfpfx{#2});}}
\def\fmffixed#1#2{\fmfcmd{vconstraint ((#1), \fmfpfx{#2});}}
\def\fmffixedx#1#2{\fmfcmd{vconstraint (((#1),whatever), \fmfpfx{#2});}}
\def\fmffixedy#1#2{\fmfcmd{vconstraint ((whatever,(#1)), \fmfpfx{#2});}}
\def\fmfpoly#1#2{%
\fmfbuf@={#1}%
\fmfcmd{vpolygon ("\the\fmfbuf@", \fmfpfx{#2});}}
\def\fmfpolyn#1#2#3{%
\fmfbuf@={#1}%
\fmfcmd{vpolygonn ("\the\fmfbuf@", \fmfpfx{#2}, #3);}}
\def\fmfrpolyn#1#2#3{%
\fmfbuf@={#1}%
\fmfcmd{vrpolygonn ("\the\fmfbuf@", \fmfpfx{#2}, #3);}}
\def\fmflabel#1#2{%
\fmfbuf@={#1}%
\fmfcmd{vlabel ("\the\fmfbuf@", \fmfpfx{#2});}}
\def\fmfv#1#2{%
\fmfbuf@={#1}%
\fmfcmd{vvertex ("\the\fmfbuf@", \fmfpfx{#2});}}
\def\fmfvn#1#2#3{%
\fmfbuf@={#1}%
\fmfcmd{vvertexn ("\the\fmfbuf@", \fmfpfx{#2}, #3);}}
\def\fmfblob#1#2{\fmfcmd{vblob ((#1), \fmfpfx{#2});}}
\def\fmfdot#1{\fmfcmd{vdot (\fmfpfx{#1});}}
\def\fmfblobn#1#2{\fmfcmd{vblobn (\fmfpfx{#1}, #2);}}
\def\fmfdotn#1#2{\fmfcmd{vdotn (\fmfpfx{#1}, #2);}}
\def\fmfleft#1{\fmfcmd{vleft (\fmfpfx{#1});}}
\def\fmfright#1{\fmfcmd{vright (\fmfpfx{#1});}}
\def\fmfbottom#1{\fmfcmd{vbottom (\fmfpfx{#1});}}
\def\fmftop#1{\fmfcmd{vtop (\fmfpfx{#1});}}
\let\fmfincoming\fmfleft
\let\fmfoutgoing\fmfright
\def\fmfsurround#1{\fmfcmd{vsurround (\fmfpfx{#1});}}
\def\fmfcurved{\fmfcmd{curved_galleries;}}
\def\fmfstraight{\fmfcmd{straight_galleries;}}
\let\fmfcurvedgalleries\fmfcurved
\let\fmfstraightgalleries\fmfstraight
\def\fmfleftn#1#2{\fmfcmd{vleftn (\fmfpfx{#1}, #2);}}
\def\fmfrightn#1#2{\fmfcmd{vrightn (\fmfpfx{#1}, #2);}}
\def\fmfbottomn#1#2{\fmfcmd{vbottomn (\fmfpfx{#1}, #2);}}
\def\fmftopn#1#2{\fmfcmd{vtopn (\fmfpfx{#1}, #2);}}
\let\fmfincomingn\fmfleftn
\let\fmfoutgoingn\fmfrightn
\def\fmfsurroundn#1#2{\fmfcmd{vsurroundn (\fmfpfx{#1}, #2);}}
\def\fmffor#1#2#3#4{\fmfcmd{for #1 = #2 step #3 until #4:}}
\def\endfmffor{\fmfcmd{endfor}}
\def\fmfgroup{\fmfcmd{begingroup}}
\def\endfmfgroup{\fmfcmd{endgroup;}}
\def\fmfset#1#2{\fmfcmd{save #1; #1:=#2;}}
\def\fmffreeze{\fmfcmd{vfreeze;}}
\let\fmfposition\fmffreeze
\def\fmfi#1#2{%
\fmfbuf@={#1}%
\fmfcmd{idraw ("\the\fmfbuf@", #2);}}
\def\fmfiv#1#2{%
\fmfbuf@={#1}%
\fmfcmd{ivertex ("\the\fmfbuf@", #2);}}
\def\fmfipath#1{\fmfcmd{path #1;}}
\def\fmfipair#1{\fmfcmd{pair #1;}}
\def\fmfiset#1#2{\fmfcmd{#1:=#2;}}
\def\fmfiequ#1#2{\fmfcmd{#1=#2;}}
\def\fmfdraw{\fmfcmd{vdraw;}}
\def\fmfL(#1,#2,#3)#4{\put(#1,#2){\makebox(0,0)[#3]{#4}}}
\def\fmfdisplay{\fmfcmd{show_all_diagrams (100,100);}}
\def\fmfstopdisplay{\fmfcmd{showstopping:=1;}\fmfdisplay}
\def\fmftrace{\fmfcmd{vtracing:=true;}}
\def\fmfnotrace{\fmfcmd{vtracing:=false;}}
\mdqrestore
\endinput
%%
%% End of file `feynmf.sty'.