axodraw4j.sty 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541
  1. \ProvidesPackage{axodraw4j}[2011/03/22]
  2. \typeout{Document option: axodraw4j. 22 Mar 2011}
  3. \typeout{***************************************************************************}
  4. \typeout{WARNING: use of axodraw4j is recommended only in conjunction with JaxoDraw!}
  5. \typeout{.....See http://jaxodraw.sourceforge.net/ for information on JaxoDraw......}
  6. \typeout{***************************************************************************}
  7. % Style file for the drawing of Feynman diagrams with LaTeX.
  8. % It assumes that the dvips that is used is by Radical Eye Software
  9. % (by Rokicki), because the graphics primitives are given in
  10. % postscript. If you do not work with a dvi to postscript converter
  11. % you are out of luck.
  12. %
  13. % Original version made by J.A.M. Vermaseren 14-feb-1994
  14. % Current version maintained by John Collins
  15. % collins at phys dot psu dot edu
  16. % with code by Daniele Binosi and Lukas Theussl.
  17. %% axodraw4j.sty
  18. %% Copyright J.A.M. Vermaseren, John Collins, Daniele Binosi and Lukas Theussl (1994-2011).
  19. %% This package may be distributed under the terms of the LaTeX Project Public
  20. %% License, as described in lppl.txt in the base LaTeX distribution.
  21. %% Either version 1.0 or, at your option, any later version.
  22. % Use:
  23. % Enter the picture environment with for instance
  24. % \begin{picture}(width,height)(0,0)
  25. % statements
  26. % \end{picture}
  27. % All statements should be entered inside the picture environment.
  28. % All coordinates should be in terms of pt (but the pt must be omitted).
  29. % One may also use the figure environment.
  30. % Issues:
  31. % 1. a. Global scaling: axoscale applies to graphics, but not to
  32. % text
  33. % b. Text uses \unitlength, but graphics does not
  34. % c. Drawing of postscript works in (postscript) points,
  35. % but picture works in terms of \unitlength, which by
  36. % default coincide.
  37. % d. Note that \SetScale{4}\setlength{\unitlength}{4pt}
  38. % appears to work appropriately: graphics and positions
  39. % are scaled, but text size is unscaled.
  40. % e. User could legitimately set \unitlength, since that
  41. % is documented for the picture environment. But AXO
  42. % drawings should be insulated from that, or they
  43. % should consistently use \unitlength
  44. % f. Perhaps there should be an axopicture environment,
  45. % which is picture environment which sets \unitlength
  46. % to 1pt? Done
  47. % 2. Need \GluonBezier and \PhotonBezier. Could use code in
  48. % JD for the drawing routines. See JaxoGlBezier.java,
  49. % and JaxoPBezier.java. Not urgent, since JD does
  50. % implement them in some way.
  51. \RequirePackage{keyval}
  52. % Ideas from usenet message on comp.text.tex, Alberto L 29 Oct 2004.
  53. \IfFileExists{colordvi.sty}{
  54. \RequirePackage{colordvi} % For colorname macros like \Black
  55. % This is used by jaxodraw when it invokes
  56. % axodraw
  57. \background{White}
  58. \textBlack
  59. \def\axocolor{Black }
  60. \def\SetColor##1{\def\axocolor{##1 }}
  61. \def\IfColor##1##2{##1}
  62. }{
  63. % Fixups in case of absence of colordvi.sty
  64. \def\axocolor{ }
  65. \def\SetColor##1{\def\axocolor{ }}
  66. \def\Color##1##2{##2}
  67. \def\IfColor##1##2{##2}
  68. }
  69. \input{rotate}
  70. %=========================================================
  71. % Commands to set parameters
  72. %
  73. % Arrow scale:
  74. \newcommand{\AXO@DefaultArrowScale}{1}
  75. \newcommand\SetArrowScale[1]{%
  76. \renewcommand\AXO@DefaultArrowScale{#1}%
  77. }
  78. % Alternative name
  79. \newcommand\DefaultArrowScale[1]{\SetArrowScale{#1}}
  80. \SetArrowScale{1}
  81. % Arrow inset:
  82. \newcommand\AXO@ArrowInset{0.2}
  83. %\renewcommand\AXO@ArrowInset{-1 }
  84. \newcommand\SetArrowInset[1]{%
  85. \renewcommand\AXO@ArrowInset{#1}%
  86. }
  87. % Arrow aspect:
  88. \newcommand\AXO@DefaultArrowAspect{1.25}
  89. \newcommand\SetArrowAspect[1]{%
  90. \renewcommand\AXO@DefaultArrowAspect{#1}%
  91. }
  92. % Arrow position (fractional position along line):
  93. \newcommand\AXO@ArrowPos{0.5}
  94. \newcommand\SetArrowPosition[1]{%
  95. \renewcommand\AXO@ArrowPos{#1}%
  96. }
  97. % Arrow stroke width
  98. \newcommand{\AXO@DefaultArrowStroke}{1}
  99. \newcommand\SetArrowStroke[1]{%
  100. \renewcommand\AXO@DefaultArrowStroke{#1}%
  101. }
  102. %=========================================================
  103. %=========================================================
  104. %=========================================================
  105. %================= PostScript preamble
  106. \AtBeginDvi{
  107. % This forces the PostScript preamble commands to be put into the
  108. % dvi file. Without this, revtex4 can remove them by funny
  109. % stuff with manipulating the first page.
  110. %
  111. % #[ inventory :
  112. %
  113. % The variables in here are:
  114. % num,num1,ampi,ampi1,x1,y1,x2,y2,x3,y3,x4,y4,dx,dy,dr
  115. % width, arrowpos, arrowspec, arrowwidth, arrowlength, arrowinset
  116. % arcend, arcmid, arcstart, radius, linesep, angdsize, dsize,
  117. % clockwise, dotsize, inc, pi, sign
  118. % darc,const,amp1, amp2, amp3, amp4, amp5, amp6, amp7, amp8, amp1i
  119. % gcolor,xx2
  120. %
  121. % NOTE: blank lines are not allowed inside the postscript code!!!!!
  122. % (LaTeX sneaks \par commands in and the postscript goes boink)
  123. %
  124. \special{color} % Provoke dvips into including color.pro
  125. % Revtex4 in 2-column mode fails to force that
  126. \special{!
  127. /pi 3.141592 def
  128. /ed{exch def}def
  129. /gs{gsave dup scale}def
  130. /gsw{ gs
  131. /width ed
  132. width setlinewidth
  133. }def
  134. /p1{/y1 ed /x1 ed}def
  135. /p2{/y2 ed /x2 ed}def
  136. /p3{/y3 ed /x3 ed}def
  137. /p4{/y4 ed /x4 ed}def
  138. /garrow{/arrowpos ed /arrowspec ed}def
  139. /setabs{
  140. % Usage /var setabs
  141. % Sets variable to its absolute value
  142. dup load abs def
  143. }def
  144. %
  145. /normalizearc {
  146. % Usage: clockwise r angle1 angle2 x y normalizearc
  147. % Adjusts coordinate system for anticlockwize arc from angle
  148. % zero, centered at origin.
  149. % Left on stack: r d_angle, with 0<d_angle <=360.
  150. % Zero angle arc converted to loop
  151. translate
  152. exch dup rotate % Origin of arc now at angle 0
  153. sub % Change angle2 to dangle
  154. 3 2 roll
  155. { % Clockwise arc: obtain from anticlockwise arc
  156. neg
  157. 1 -1 scale
  158. } if
  159. dup abs 360 ge
  160. { %Outside 360 degrees, make exactly a loop
  161. pop 360
  162. }
  163. { % Convert to positive angle mod 360.
  164. dup
  165. dup 0 lt { 360 sub } if
  166. 360 div truncate 360 mul sub
  167. dup 0.1 lt { pop 360 } if
  168. }ifelse
  169. } def
  170. %
  171. /normalizeline {
  172. % Usage: x1 y1 x2 y2 normalizeline
  173. % Adjusts coordinate system for line from origin in x direction
  174. % Left on stack: dr = length of line
  175. 3 index 3 index translate
  176. 2 index sub exch 3 index sub
  177. 2 copy atan rotate
  178. dup mul exch dup mul add sqrt
  179. 3 1 roll pop pop
  180. } def
  181. %
  182. /abox{
  183. newpath
  184. x1 y1 moveto
  185. x1 y2 lineto
  186. x2 y2 lineto
  187. x2 y1 lineto
  188. closepath
  189. }def
  190. /atriangle{
  191. newpath
  192. x1 y1 moveto
  193. x2 y2 lineto
  194. x3 y3 lineto
  195. closepath
  196. }def
  197. /abezier{
  198. newpath
  199. x1 y1 moveto
  200. x2 y2 x3 y3 x4 y4 curveto
  201. }def
  202. /distance{
  203. % Usage: x1 y1 x2 y2 distance -> x1 y1 x2 y2 r
  204. % Pure stack based: computes distance between points. Keeps points
  205. dup
  206. 3 index sub dup mul
  207. 2 index 5 index sub dup mul add sqrt
  208. } def
  209. }
  210. %
  211. % #] inventory :
  212. %
  213. %============================================================
  214. %============================================================
  215. %
  216. % Define better arrows
  217. %
  218. \special{!
  219. % Arrow making routines
  220. %
  221. % Arrow drawing:
  222. %
  223. /arrowVTriangle {
  224. % Down-pointing arrow: arrowstroke width length inset arrowVTriangle
  225. /arrowinset ed
  226. /arrowlength ed
  227. /arrowwidth ed
  228. /arrowstroke ed
  229. newpath
  230. 0 arrowlength -0.5 mul moveto
  231. arrowwidth arrowlength rlineto
  232. arrowwidth -1 mul arrowlength arrowinset mul -1 mul rlineto
  233. arrowwidth -1 mul arrowlength arrowinset mul rlineto
  234. closepath
  235. arrowstroke 0 ne {
  236. gsave
  237. arrowstroke setlinewidth stroke
  238. grestore
  239. } if
  240. fill
  241. } def
  242. %
  243. % General arrow. Call as { arrowspec } angle arrow
  244. % arrow is drawn at angle degrees clockwise of down
  245. % arrowspec is code for drawing a downward pointing arrow
  246. /arrow1 {
  247. gsave
  248. rotate
  249. exec
  250. grestore
  251. } def
  252. %
  253. }
  254. %
  255. %============================================================
  256. %============================================================
  257. % Basic line drawing
  258. % #[ fixdash :
  259. %
  260. \special{! /fixdash{
  261. % Usage: r dashsize fixdash
  262. % Sets renormalized dashsize, doing
  263. % [rdsize rdsize] 0 setdash
  264. % so that n+1/2 patterns fit in length r
  265. % If dsize is too big or if dsize is zero, use continuous line
  266. % Uses stack, no named variables.
  267. 2 copy gt
  268. 1 index 0 ne
  269. and
  270. {
  271. 2 copy
  272. 2 mul div 0.5 sub round
  273. dup 0 le { pop 0 } if
  274. 2 mul 1 add exch pop div
  275. dup 2 array astore 0 setdash
  276. }
  277. { pop pop [] 0 setdash }
  278. ifelse
  279. } def }
  280. %
  281. % #] fixdash :
  282. % #[ dashline :
  283. %
  284. \special{! /dashline{
  285. % Draws a straight dashed line: x1,y1,x2,y2
  286. % Assumes dsize already set
  287. % The pattern is ideally [dsize dsize] 0 setdash
  288. % but we want to have (2*n+1)/2 patterns, so dsize must be rounded
  289. % If dsize is too large or zero, use a continuous line
  290. % Pure stack operation.
  291. gsave
  292. distance dsize fixdash % Function distance leaves points on stack
  293. newpath
  294. moveto
  295. lineto
  296. stroke
  297. grestore
  298. } def }
  299. % #] dashline :
  300. % #[ dasharc :
  301. %
  302. \special{! /dasharc{
  303. % Draws an arc segment anticlockwise:
  304. % x_center, y_center, radius, start_angle, end_angle
  305. % Assumes angdsize (radians) set elsewhere
  306. gsave
  307. 3 copy sub abs
  308. % Top of stack is copy of radius, start_angle, end_angle
  309. pi mul 180 div mul
  310. % Top of stack is arc length
  311. 3 index angdsize mul fixdash
  312. newpath arc stroke
  313. grestore
  314. } def }
  315. %
  316. % #] dasharc :
  317. %============================================================
  318. %============================================================
  319. %
  320. % #[ doublegluon :
  321. %
  322. \special{! /doublegluon{
  323. %
  324. % Draw gluon, possibly double
  325. % We have a 'head' and a 'tail' and inbetween the 'body'
  326. % The head + tail is 2 windings. The body is num-1 windings.
  327. %
  328. gsw
  329. /linesep ed
  330. /num ed /ampi ed
  331. normalizeline /dr ed
  332. %
  333. linesep 0 eq
  334. { 0 0 dr 0 ampi num gluon1 }
  335. {
  336. 0 linesep 2 div dup dr exch ampi num gluon1
  337. 0 linesep -2 div dup dr exch ampi num gluon1
  338. }
  339. ifelse
  340. grestore
  341. } def }
  342. %
  343. % #] doublegluon :
  344. % #[ gluon1 :
  345. %
  346. \special{! /gluon1{
  347. % Draw a single gluon
  348. % We have a 'head' and a 'tail' and inbetween the 'body'
  349. % The head + tail is 2 windings. The body is num-1 windings.
  350. %
  351. gsave
  352. /num ed /ampi ed
  353. normalizeline /dr ed
  354. %
  355. /num num 0.5 sub round def
  356. /inc dr num 2 mul 2 add div def % increment per half winding
  357. /amp8 ampi 0.9 mul def
  358. amp8 0 lt {/amp8 amp8 neg def} if
  359. %
  360. /x1 inc 2 mul def
  361. %
  362. newpath
  363. 0 0 moveto
  364. inc 0.1 mul ampi 0.5 mul inc 0.5 mul ampi inc 1.4 mul ampi curveto
  365. x1 amp8 add dup ampi exch ampi neg dup x1 exch curveto
  366. %
  367. 2 1 num {
  368. pop
  369. x1 amp8 sub dup ampi neg exch ampi dup x1 inc add exch curveto
  370. /x1 x1 inc dup add add def
  371. x1 amp8 add dup ampi exch ampi neg dup x1 exch curveto
  372. } for
  373. %
  374. x1 amp8 sub dup ampi neg exch ampi dup x1 inc 0.6 mul add exch curveto
  375. x1 inc 1.5 mul add ampi dr inc 0.1 mul sub ampi 0.5 mul dr 0 curveto
  376. stroke
  377. %
  378. grestore
  379. } def }
  380. %
  381. % #] gluon1 :
  382. % #[ doublephoton :
  383. %
  384. \special{! /doublephoton{
  385. %
  386. % Draws a photon from x1,y1 to x2,y2 with amplitude A and n wiggles
  387. % Possibly double
  388. %
  389. gsw
  390. /linesep ed
  391. /num ed /ampi ed
  392. normalizeline /dr ed
  393. %
  394. linesep 0 eq
  395. { 0 0 dr 0 ampi num photon1 }
  396. {
  397. 0 linesep 2 div dup dr exch ampi num photon1
  398. 0 linesep -2 div dup dr exch ampi num photon1
  399. }
  400. ifelse
  401. grestore
  402. } def }
  403. %
  404. % #] doublephoton :
  405. % #[ photon1 :
  406. %
  407. \special{! /photon1{
  408. %
  409. % Draws a single photon from x1,y1 to x2,y2 with amplitude A and n wiggles
  410. %
  411. gsave
  412. /num1 ed /ampi1 ed
  413. normalizeline /dr ed
  414. %
  415. /num1 num1 2 mul 0.5 sub round def
  416. /x2 dr num1 div def
  417. /sign 1 def
  418. 1 1 num1 {
  419. pop
  420. newpath
  421. 0 0 moveto
  422. 4 3 div x2 mul pi div dup neg x2 add
  423. 4 3 div ampi1 sign mul mul dup 3 1 roll
  424. x2 0 curveto
  425. stroke
  426. /sign sign neg def
  427. x2 0 translate
  428. } for
  429. %
  430. grestore
  431. } def }
  432. %
  433. % #] photon1 :
  434. % #[ zigzag :
  435. %
  436. \special{! /zigzag{
  437. %
  438. % Draws a zigzag line from x1,y1 to x2,y2 with amplitude A and n zigzags
  439. %
  440. gsw /num ed /ampi ed
  441. normalizeline /dr ed
  442. %
  443. /num num 2 mul 0.5 sub round def
  444. /x2 dr num div def
  445. /sign 1 def
  446. 1 1 num {
  447. pop
  448. newpath
  449. 0 0 moveto
  450. x2 2 div ampi sign mul lineto
  451. x2 0 lineto
  452. stroke
  453. /sign sign neg def
  454. x2 0 translate
  455. } for
  456. %
  457. grestore
  458. } def }
  459. %
  460. % #] zigzag :
  461. % #[ doublephotonarc :
  462. %
  463. \special{! /doublephotonarc{
  464. %
  465. % Draws a gluon on an arcsegment
  466. % gluon_radius, num, linesep (0 for no-double),
  467. % clock, radius, start_angle, end_angle, x_center, y_center
  468. % in which num is the number of wiggles of the photon.
  469. %
  470. gsw
  471. normalizearc
  472. /darc ed /radius ed /linesep ed /num ed /ampli ed
  473. %
  474. /num num 2 mul round def % number of half wiggles
  475. /darc1 darc num div def
  476. /cp darc1 cos def
  477. /sp darc1 sin def
  478. darc1 2 div dup
  479. /cp2 exch cos def
  480. /sp2 exch sin def
  481. %
  482. linesep 0 eq
  483. {
  484. radius photonarc1
  485. }
  486. {
  487. linesep 2 div radius add photonarc1
  488. linesep -2 div radius add photonarc1
  489. }
  490. ifelse
  491. %
  492. grestore
  493. } def }
  494. %
  495. % #] doublephotonarc :
  496. % #[ photonarc1 :
  497. %
  498. \special{! /photonarc1{
  499. % Usage: radius photonarc1
  500. % Draws a single photon on an arcsegment.
  501. % Called from doublephotonarc with coordinates centered on center,
  502. % start on x-axis.
  503. % Assume the following are set: num, ampli, arcend phi, arcstart phi/2, cp,
  504. % cp2, sp, sp2.
  505. % Draws a photonarc center at x1,y1, radius arcstart,arcend, amplitude
  506. % number of wiggles, width, scale
  507. %
  508. gsave
  509. /radius1 ed
  510. % Local copy of amplitude, since I change it
  511. /ampli1 ampli def
  512. %
  513. newpath
  514. 1 1 num {
  515. pop
  516. radius1 0 moveto
  517. /beta radius1 darc1 mul 180 ampli1 mul div def
  518. /tt sp cp beta mul sub cp sp beta mul add div def
  519. /amp1 radius1 ampli1 add 8 mul beta cp2 mul sp2 sub mul beta 4 cp add mul
  520. tt cp mul 3 mul sp 4 mul sub add radius1 mul sub
  521. beta tt sub 3 mul div def % this is x2
  522. radius1 ampli1 add 8 mul cp2 mul 1 cp add radius1 mul sub 3 div amp1 sub
  523. dup radius1 sub beta mul % x1,y1
  524. amp1 dup radius1 cp mul sub tt mul radius1 sp mul add % x2,y2
  525. radius1 cp mul radius1 sp mul % x3 y3
  526. curveto
  527. /ampli1 ampli1 neg def
  528. darc1 rotate
  529. } for
  530. stroke
  531. %
  532. grestore
  533. } def }
  534. %
  535. % #] photonarc :
  536. % #[ doublegluearc :
  537. %
  538. \special{! /doublegluearc{
  539. %
  540. % Draws a gluon on an arcsegment
  541. % gluon_radius, num, linesep (0 for no-double),
  542. % clock, radius, start_angle, end_angle, x_center, y_center
  543. % in which num is the number of windings of the gluon.
  544. %
  545. gsw
  546. normalizearc
  547. /darc ed /radius ed /linesep ed /num ed /ampi ed
  548. /num num 0.5 sub round def
  549. %
  550. linesep 0 eq
  551. { radius gluearc1 }
  552. {
  553. linesep 2 div radius add gluearc1
  554. linesep -2 div radius add gluearc1
  555. }
  556. ifelse
  557. %
  558. grestore
  559. } def }
  560. %
  561. % #] doublegluearc :
  562. % #[ gluearc1 :
  563. \special{! /gluearc1{
  564. % Usage: radius gluearc1
  565. % Draws a single gluon on an arcsegment.
  566. % Called from doublegluearc with coordinates centered on center,
  567. % start on x-axis.
  568. % Assume: num, ampi and darc set.
  569. % Method:
  570. % 1: compute length of arc.
  571. % 2: generate gluon in x and y as if the arc is a straight line
  572. % 3: x' = (radius+y)*cos(x*const)
  573. % y' = (radius+y)*sin(x*const)
  574. %
  575. gsave
  576. /radius1 ed
  577. /dr radius1 darc mul pi mul 180 div def % length of segment.
  578. /const darc dr div def % conversion constant
  579. darc 360 lt
  580. {
  581. /inc dr num 2 mul 2 add div def % increment per half winding
  582. }
  583. { % Full loop, so don't have extra bits on end
  584. /inc dr num 2 mul div def % increment per half winding
  585. }
  586. ifelse
  587. %
  588. /amp8 ampi 0.9 mul def
  589. /amp1 radius1 ampi add def
  590. /amp2 radius1 ampi sub def
  591. /amp3 radius1 ampi 2 div add def
  592. /amp4 amp1 inc amp8 add const mul cos div def
  593. /amp5 amp2 amp8 const mul cos div def
  594. /amp6 amp1 inc 0.6 mul amp8 add const mul cos div def
  595. /amp7 amp1 inc 0.9 mul const mul cos div def
  596. amp8 0 lt {/amp8 amp8 neg def} if
  597. %
  598. %
  599. newpath
  600. darc 360 lt
  601. {
  602. /x1 inc 2 mul def
  603. radius1 0 moveto
  604. % Normal arc has special head segment
  605. inc 0.1 mul const mul dup cos amp3 mul exch sin amp3 mul
  606. inc 0.5 mul const mul dup cos amp7 mul exch sin amp7 mul
  607. inc 1.4 mul const mul dup cos amp1 mul exch sin amp1 mul
  608. curveto
  609. x1 amp8 add const mul dup cos amp6 mul exch sin amp6 mul
  610. x1 amp8 add const mul dup cos amp5 mul exch sin amp5 mul
  611. x1 const mul dup cos amp2 mul exch sin amp2 mul
  612. curveto
  613. % Range of main segments
  614. 2 1 num
  615. }
  616. {
  617. /x1 0 def
  618. amp2 0 moveto
  619. 1 1 num
  620. }
  621. ifelse
  622. {
  623. pop
  624. x1 amp8 sub const mul dup cos amp5 mul exch sin amp5 mul
  625. x1 amp8 sub const mul dup cos amp4 mul exch sin amp4 mul
  626. x1 inc add const mul dup cos amp1 mul exch sin amp1 mul
  627. curveto
  628. /x1 x1 inc dup add add def
  629. x1 amp8 add const mul dup cos amp4 mul exch sin amp4 mul
  630. x1 amp8 add const mul dup cos amp5 mul exch sin amp5 mul
  631. x1 const mul dup cos amp2 mul exch sin amp2 mul
  632. curveto
  633. } for
  634. %
  635. darc 360 lt
  636. {
  637. x1 amp8 sub const mul dup cos amp5 mul exch sin amp5 mul
  638. x1 amp8 sub const mul dup cos amp6 mul exch sin amp6 mul
  639. x1 inc 0.6 mul add const mul dup cos amp1 mul exch sin amp1 mul
  640. curveto
  641. x1 inc 1.5 mul add const mul dup cos amp7 mul exch sin amp7 mul
  642. dr inc 0.1 mul sub const mul dup cos amp3 mul exch sin amp3 mul
  643. dr const mul dup cos radius1 mul exch sin radius1 mul
  644. curveto
  645. }
  646. if
  647. stroke
  648. %
  649. grestore
  650. } def }
  651. %
  652. % #] gluearc1 :
  653. % #[ dasharrowdoubleline :
  654. %
  655. \special{! /dasharrowdoubleline{
  656. %
  657. % arrowspec, arrowpos, flip, linesep, dsize,
  658. % x1, y1, x2, y2, width, scale
  659. % If linesep == 0, then single line, else double with separation linesep.
  660. % Draws a dashed double straight line with arrow.
  661. % If dsize==0, then continuous line.
  662. % If linesep==0, then single line.
  663. gsw
  664. normalizeline
  665. /dr ed
  666. /dsize ed
  667. /linesep ed
  668. /flip ed
  669. garrow
  670. %
  671. % If linesep is negative, that means the arrow is flipped.
  672. % But the lineend coordinates are already flipped, so there is
  673. % no need to make any adjustment; i.e., replace linesep by
  674. % absolute value.
  675. /linesep setabs
  676. /linewidth width def
  677. %
  678. /y11 linesep 0.5 mul def
  679. /y22 linesep -0.5 mul def
  680. 0 y11 dr arrowpos mul y11 dashline
  681. linesep 0 ne
  682. { 0 y22 dr arrowpos mul y22 dashline }
  683. if
  684. dr arrowpos mul 0 translate
  685. /arrowspec load
  686. flip { -90 }{ 90 } ifelse
  687. arrow1
  688. 0 y11 dr 1 arrowpos sub mul y11 dashline
  689. linesep 0 ne
  690. { 0 y22 dr 1 arrowpos sub mul y22 dashline }
  691. if
  692. grestore
  693. } def }
  694. %
  695. % #] dasharrowdoubleline :
  696. % #[ arc2 :
  697. %
  698. \special{! /arc2{
  699. % Draws an arc segment:
  700. % arrowspec, arrowpos, flip, linesep, dsize,
  701. % clock, radius, start_angle, end_angle, x_center, y_center, width, scale
  702. % If linesep == 0, then single line, else double with separation linesep.
  703. %
  704. gsw
  705. normalizearc
  706. /darc ed /radius ed
  707. /dsize ed /linesep ed
  708. /angdsize dsize radius div def
  709. /flip ed
  710. garrow
  711. /arcmid
  712. darc arrowpos mul
  713. def
  714. dsize 0 eq
  715. { linesep 0 eq
  716. { 0 0 radius 0 darc dasharc }
  717. { 0 0 radius linesep 2 div add 0 darc dasharc
  718. 0 0 radius linesep -2 div add 0 darc dasharc
  719. }
  720. ifelse
  721. }
  722. { linesep 0 eq
  723. { 0 0 radius 0 arcmid dasharc
  724. 0 0 radius arcmid darc dasharc
  725. }
  726. {
  727. 0 0 radius linesep 2 div add 0 arcmid dasharc
  728. 0 0 radius linesep -2 div add 0 arcmid dasharc
  729. 0 0 radius linesep 2 div add arcmid darc dasharc
  730. 0 0 radius linesep -2 div add arcmid darc dasharc
  731. }
  732. ifelse
  733. }
  734. ifelse
  735. arcmid rotate
  736. radius 0 translate
  737. /arrowspec load flip { 0 } { 180 } ifelse arrow1
  738. grestore
  739. } def }
  740. %
  741. % #] arc2 :
  742. % #[ vertex :
  743. %
  744. \special{! /vertex{
  745. %
  746. % Puts a fat dot at x,y size is the radius of the dot
  747. %
  748. gs
  749. /dotsize ed
  750. translate
  751. newpath
  752. 0 0 dotsize 0 360 arc
  753. fill stroke
  754. grestore
  755. } def }
  756. %
  757. % #] vertex :
  758. % #[ bcirc :
  759. %
  760. \special{! /bcirc{
  761. %
  762. % Draws an anti-clockwise blanked circle:
  763. % x_center, y_center, radius
  764. %
  765. gsw /radius ed
  766. %
  767. translate % x and y are still on stack
  768. %
  769. gsave
  770. 1 setgray
  771. newpath 0 0 radius 0 360 arc fill
  772. grestore
  773. newpath 0 0 radius 0 360 arc stroke
  774. grestore
  775. } def }
  776. %
  777. % #] bcirc :
  778. % #[ gcirc :
  779. %
  780. \special{! /gcirc{
  781. %
  782. % Draws an anti-clockwise blanked gray circle:
  783. % x_center, y_center, radius, grayscale
  784. %
  785. gsw /gcolor ed /radius ed
  786. %
  787. translate % x and y are still on stack
  788. %
  789. 1 setgray
  790. newpath 0 0 radius 0 360 arc fill
  791. gcolor setgray
  792. newpath 0 0 radius 0 360 arc fill
  793. 0 setgray
  794. newpath 0 0 radius 0 360 arc stroke
  795. grestore
  796. } def }
  797. %
  798. % #] gcirc :
  799. % #[ ccirc1 :
  800. %
  801. \special{! /ccirc1{
  802. %
  803. % Draws an anti-clockwise circle :
  804. % x_center, y_center, radius
  805. % Part 1: the contents in background color
  806. %
  807. gsw /radius ed
  808. %
  809. translate % x and y are still on stack
  810. %
  811. newpath 0 0 radius 0 360 arc fill
  812. grestore
  813. } def }
  814. %
  815. % #] ccirc1 :
  816. % #[ ccirc2 :
  817. %
  818. \special{! /ccirc2{
  819. %
  820. % Draws an anti-clockwise circle :
  821. % x_center, y_center, radius
  822. % Part 1: the contents in background color
  823. %
  824. gsw /radius ed
  825. %
  826. translate % x and y are still on stack
  827. %
  828. newpath 0 0 radius 0 360 arc stroke
  829. grestore
  830. } def }
  831. %
  832. % #] ccirc2 :
  833. % #[ box :
  834. %
  835. \special{! /box{
  836. %
  837. % Draws a box x1,y1,x2,y2
  838. %
  839. gsw p2 p1
  840. abox stroke
  841. grestore
  842. } def }
  843. %
  844. % #] box :
  845. % #[ bbox :
  846. %
  847. \special{! /bbox{
  848. %
  849. % Draws a blanked out box x1,y1,x2,y2
  850. %
  851. gsw p2 p1
  852. gsave
  853. 1 setgray abox fill
  854. grestore
  855. abox stroke
  856. grestore
  857. } def }
  858. %
  859. % #] bbox :
  860. % #[ gbox :
  861. %
  862. \special{! /gbox{
  863. %
  864. % Draws a blanked out gray box x1,y1,x2,y2,color
  865. %
  866. gsw /gcolor ed p2 p1
  867. 1 setgray abox fill
  868. gcolor setgray abox fill
  869. 0 setgray abox stroke
  870. grestore
  871. } def }
  872. %
  873. % #] gbox :
  874. % #[ cbox1 :
  875. %
  876. \special{! /cbox1{
  877. %
  878. % Draws a blanked out colored box x1,y1,x2,y2
  879. % Part 1: the background
  880. %
  881. gsw p2 p1
  882. abox fill
  883. grestore
  884. } def }
  885. %
  886. % #] cbox1 :
  887. % #[ cbox2 :
  888. %
  889. \special{! /cbox2{
  890. %
  891. % Draws a blanked out colored box x1,y1,x2,y2
  892. % Part 1: the box
  893. %
  894. gsw p2 p1
  895. abox stroke
  896. grestore
  897. } def }
  898. %
  899. % #] cbox2 :
  900. % #[ triangle :
  901. %
  902. \special{! /triangle{
  903. %
  904. % Draws a triangle x1,y1,x2,y2,x3,y3
  905. %
  906. gsw p3 p2 p1
  907. atriangle stroke
  908. grestore
  909. } def }
  910. %
  911. % #] triangle :
  912. % #[ btriangle :
  913. %
  914. \special{! /btriangle{
  915. %
  916. % Draws a blanked out triangle x1,y1,x2,y2,x3,y3
  917. %
  918. gsw p3 p2 p1
  919. gsave
  920. 1 setgray atriangle fill
  921. grestore
  922. atriangle stroke
  923. grestore
  924. } def }
  925. %
  926. % #] btriangle :
  927. % #[ gtriangle :
  928. %
  929. \special{! /gtriangle{
  930. %
  931. % Draws a blanked out gray triangle x1,y1,x2,y2,x3,y3,color
  932. %
  933. gsw /gcolor ed p3 p2 p1
  934. 1 setgray atriangle fill
  935. gcolor setgray atriangle fill
  936. 0 setgray atriangle stroke
  937. grestore
  938. } def }
  939. %
  940. % #] gtriangle :
  941. % #[ ctriangle1 :
  942. %
  943. \special{! /ctriangle1{
  944. %
  945. % Draws a blanked out colored triangle x1,y1,x2,y2,x3,y3
  946. % Part 1: the background
  947. %
  948. gsw p3 p2 p1
  949. atriangle fill
  950. grestore
  951. } def }
  952. %
  953. % #] ctriangle1 :
  954. % #[ ctriangle2 :
  955. %
  956. \special{! /ctriangle2{
  957. %
  958. % Draws a blanked out colored triangle x1,y1,x2,y2,x3,y3
  959. % Part 1: the triangle
  960. %
  961. gsw p3 p2 p1
  962. atriangle stroke
  963. grestore
  964. } def }
  965. %
  966. % #] ctriangle2 :
  967. % #[ btext :
  968. %
  969. \special{! /btext{
  970. %
  971. % Makes a box that has the text centered in it
  972. % The center of the box is at x,y and the box is just large enough
  973. % for the text.
  974. % x,y,text,fontsize,linewidth,scale
  975. %
  976. gsw /fsize ed /thetext ed translate
  977. /hsize thetext stringwidth pop def
  978. /x1 hsize fsize add 2 div neg def
  979. /y1 fsize 2 mul 3 div neg def
  980. /x2 x1 neg def /y2 y1 neg def
  981. gsave 1 setgray abox fill grestore
  982. abox stroke
  983. hsize 2 div neg fsize 3 div neg moveto thetext show
  984. grestore
  985. } def }
  986. %
  987. % #] btext :
  988. % #[ b2text :
  989. %
  990. \special{! /b2text{
  991. %
  992. % Makes a box that has two lines of text centered in it
  993. % The center of the box is at x,y and the box is just large enough
  994. % for the text.
  995. % x,y,text1,text2,fontsize,linewidth,scale
  996. %
  997. gsw /fsize ed /text2 ed /text1 ed translate
  998. /hsize1 text1 stringwidth pop def
  999. /hsize2 text2 stringwidth pop def
  1000. hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
  1001. /x1 hsize fsize add 2 div neg def
  1002. /y1 fsize neg 7 mul 6 div def
  1003. /x2 x1 neg def /y2 y1 neg def
  1004. gsave 1 setgray abox fill grestore
  1005. abox stroke
  1006. hsize1 2 div neg fsize 6 div moveto text1 show
  1007. hsize2 2 div neg fsize 5 mul 6 div neg moveto text2 show
  1008. grestore
  1009. } def }
  1010. %
  1011. % #] b2text :
  1012. % #[ gtext :
  1013. %
  1014. \special{! /gtext{
  1015. %
  1016. % Makes a gray box that has the text centered in it
  1017. % The center of the box is at x,y and the box is just large enough
  1018. % for the text.
  1019. % x,y,gray,text,fontsize,linewidth,scale
  1020. %
  1021. gsw /fsize ed /thetext ed /graysc ed translate
  1022. /hsize thetext stringwidth pop def
  1023. /x1 hsize fsize add 2 div neg def
  1024. /y1 fsize 2 mul 3 div neg def
  1025. /x2 x1 neg def /y2 y1 neg def
  1026. graysc setgray abox fill 0 setgray abox stroke
  1027. hsize 2 div neg fsize 3 div neg moveto thetext show
  1028. grestore
  1029. } def }
  1030. %
  1031. % #] gtext :
  1032. % #[ ctext1 :
  1033. %
  1034. \special{! /ctext1{
  1035. %
  1036. % Makes a colored box that has the text centered in it
  1037. % The center of the box is at x,y and the box is just large enough
  1038. % for the text.
  1039. % x,y,text,fontsize,linewidth,scale
  1040. % Part 1: the background
  1041. %
  1042. gsw /fsize ed /thetext ed translate
  1043. /hsize thetext stringwidth pop def
  1044. /x1 hsize fsize add 2 div neg def
  1045. /y1 fsize 2 mul 3 div neg def
  1046. /x2 x1 neg def /y2 y1 neg def
  1047. abox fill
  1048. grestore
  1049. } def }
  1050. %
  1051. % #] ctext1 :
  1052. % #[ ctext2 :
  1053. %
  1054. \special{! /ctext2{
  1055. %
  1056. % Makes a colored box that has the text centered in it
  1057. % The center of the box is at x,y and the box is just large enough
  1058. % for the text.
  1059. % x,y,text,fontsize,linewidth,scale
  1060. % Part 2: the box and the text
  1061. %
  1062. gsw /fsize ed /thetext ed translate
  1063. /hsize thetext stringwidth pop def
  1064. /x1 hsize fsize add 2 div neg def
  1065. /y1 fsize 2 mul 3 div neg def
  1066. /x2 x1 neg def /y2 y1 neg def
  1067. abox stroke
  1068. hsize 2 div neg fsize 3 div neg moveto thetext show
  1069. grestore
  1070. } def }
  1071. %
  1072. % #] ctext2 :
  1073. % #[ g2text :
  1074. %
  1075. \special{! /g2text{
  1076. %
  1077. % Makes a gray box that has two lines of text centered in it
  1078. % The center of the box is at x,y and the box is just large enough
  1079. % for the text.
  1080. % x,y,gray,text1,text2,fontsize,linewidth,scale
  1081. %
  1082. gsw /fsize ed /text2 ed /text1 ed /graysc ed translate
  1083. /hsize1 text1 stringwidth pop def
  1084. /hsize2 text2 stringwidth pop def
  1085. hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
  1086. /x1 hsize fsize add 2 div neg def
  1087. /y1 fsize neg 7 mul 6 div def
  1088. /x2 x1 neg def /y2 y1 neg def
  1089. graysc setgray abox fill 0 setgray abox stroke
  1090. hsize1 2 div neg fsize 6 div moveto text1 show
  1091. hsize2 2 div neg fsize 5 mul 6 div neg moveto text2 show
  1092. grestore
  1093. } def }
  1094. %
  1095. % #] g2text :
  1096. % #[ c2text1 :
  1097. %
  1098. \special{! /c2text1{
  1099. %
  1100. % Makes a colored box that has two lines of text centered in it
  1101. % The center of the box is at x,y and the box is just large enough
  1102. % for the text.
  1103. % x,y,text1,text2,fontsize,linewidth,scale
  1104. % Part 1: the background
  1105. %
  1106. gsw /fsize ed /text2 ed /text1 ed translate
  1107. /hsize1 text1 stringwidth pop def
  1108. /hsize2 text2 stringwidth pop def
  1109. hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
  1110. /x1 hsize fsize add 2 div neg def
  1111. /y1 fsize neg 7 mul 6 div def
  1112. /x2 x1 neg def /y2 y1 neg def
  1113. abox fill
  1114. grestore
  1115. } def }
  1116. %
  1117. % #] c2text1 :
  1118. % #[ c2text2 :
  1119. %
  1120. \special{! /c2text2{
  1121. %
  1122. % Makes a colored box that has two lines of text centered in it
  1123. % The center of the box is at x,y and the box is just large enough
  1124. % for the text.
  1125. % x,y,text1,text2,fontsize,linewidth,scale
  1126. % Part 2, box and text
  1127. %
  1128. gsw /fsize ed /text2 ed /text1 ed translate
  1129. /hsize1 text1 stringwidth pop def
  1130. /hsize2 text2 stringwidth pop def
  1131. hsize1 hsize2 lt { /hsize hsize2 def } { /hsize hsize1 def } ifelse
  1132. /x1 hsize fsize add 2 div neg def
  1133. /y1 fsize neg 7 mul 6 div def
  1134. /x2 x1 neg def /y2 y1 neg def
  1135. abox stroke
  1136. hsize1 2 div neg fsize 6 div moveto text1 show
  1137. hsize2 2 div neg fsize 5 mul 6 div neg moveto text2 show
  1138. grestore
  1139. } def }
  1140. %
  1141. % #] c2text2 :
  1142. % #[ ptext :
  1143. %
  1144. \special{! /ptext{
  1145. %
  1146. % Puts a text at x,y (focal point)
  1147. % phi is a rotation angle
  1148. % Mode tells how the text should be w.r.t. the focal point.
  1149. % fsize is the fontsize
  1150. % Then the text is given.
  1151. % Finally the scale factor should be there
  1152. %
  1153. gs
  1154. /text ed
  1155. /fsize ed
  1156. /mode ed
  1157. 3 1 roll
  1158. translate rotate % We are at the focus and have the proper orientation
  1159. mode 3 lt { 0 fsize neg translate } {
  1160. mode 6 lt { /mode mode 3 sub def 0 fsize 2 div neg translate }
  1161. { /mode mode 6 sub def } ifelse } ifelse
  1162. /fsize text stringwidth pop def
  1163. mode 1 eq { fsize 2 div neg 0 translate } {
  1164. mode 2 eq { fsize neg 0 translate } if } ifelse
  1165. 0 0 moveto
  1166. text show
  1167. grestore
  1168. } def }
  1169. %
  1170. % #] ptext :
  1171. % #[ ellipse:
  1172. %
  1173. \special{! /ellipse {
  1174. % Draw an ellipse
  1175. % RedGrittyBrick 20/10/2003
  1176. % From http://www.redgrittybrick.org/postscript/ellipse.html. 2011/03/22
  1177. % draw an ellipse using four bezier curves
  1178. %
  1179. /r2 exch def % 2nd parameter
  1180. /r1 exch def % 1st parameter
  1181. /kappa 0.5522847498 def
  1182. %
  1183. newpath
  1184. 0 r2 moveto % start point of curve
  1185. %
  1186. % top clockwise
  1187. kappa r1 mul r2 % 1st Bezier control point
  1188. r1 kappa r2 mul % 2nd Bezier control point
  1189. r1 0 curveto % end point of curve
  1190. %
  1191. % right clockwise
  1192. r1 kappa r2 mul neg
  1193. kappa r1 mul r2 neg
  1194. 0 r2 neg curveto
  1195. %
  1196. % bottom clockwise
  1197. kappa r1 mul neg r2 neg
  1198. r1 neg kappa r2 mul neg
  1199. r1 neg 0 curveto
  1200. %
  1201. % left clockwise
  1202. r1 neg kappa r2 mul
  1203. kappa r1 mul neg r2
  1204. 0 r2 curveto
  1205. %
  1206. } def % ellipse
  1207. }
  1208. %
  1209. % #] ellipse:
  1210. % #[ goval :
  1211. %
  1212. \special{! /goval{
  1213. %
  1214. % Draws a gray oval that overwrites whatever was there.
  1215. % x_center y_center height width rotation color linewidth scale
  1216. %
  1217. gsw /gcolor ed /angle ed /width ed /height ed
  1218. %
  1219. translate % x and y are still on stack
  1220. angle rotate
  1221. 1 setgray width height ellipse fill
  1222. gcolor setgray width height ellipse fill
  1223. 0 setgray width height ellipse stroke
  1224. grestore
  1225. } def }
  1226. %
  1227. % #] goval :
  1228. % #[ coval1 :
  1229. %
  1230. \special{! /coval1{
  1231. %
  1232. % Draws an oval that overwrites whatever was there.
  1233. % x_center y_center height width rotation linewidth scale
  1234. %
  1235. gsw /angle ed /width ed /height ed
  1236. %
  1237. translate % x and y are still on stack
  1238. angle rotate
  1239. width height ellipse fill
  1240. grestore
  1241. } def }
  1242. %
  1243. % #] coval1 :
  1244. % #[ coval2 :
  1245. %
  1246. \special{! /coval2{
  1247. %
  1248. % Draws a oval that overwrites whatever was there.
  1249. % x_center y_center height width rotation linewidth scale
  1250. %
  1251. gsw /angle ed /width ed /height ed
  1252. %
  1253. translate % x and y are still on stack
  1254. angle rotate
  1255. width height ellipse stroke
  1256. grestore
  1257. } def }
  1258. %
  1259. % #] coval2 :
  1260. % #[ oval :
  1261. %
  1262. \special{! /oval{
  1263. %
  1264. % Draws an oval that does not overwrite whatever was there.
  1265. % x_center y_center height width rotation linewidth scale
  1266. %
  1267. gsw /angle ed /width ed /height ed
  1268. %
  1269. translate % x and y are still on stack
  1270. angle rotate
  1271. width height ellipse stroke
  1272. } def }
  1273. %
  1274. % #] oval :
  1275. % #[ makecurve :
  1276. %
  1277. \special{! /docurve{
  1278. x1 2 mul x2 add 3 div
  1279. y1 y0 sub x1 x0 sub div x2 x0 sub mul
  1280. y2 y0 sub x2 x0 sub div x1 x0 sub mul add
  1281. y1 add y0 2 mul add 3 div
  1282. x1 x2 2 mul add 3 div
  1283. y2 y3 sub x2 x3 sub div x1 x3 sub mul
  1284. y1 y3 sub x1 x3 sub div x2 x3 sub mul add
  1285. y2 add y3 2 mul add 3 div
  1286. x2 y2 curveto
  1287. } def }
  1288. %
  1289. \special{! /makecurve{
  1290. %
  1291. % Incoming stack:
  1292. % [array of x,y pairs] width scale
  1293. %
  1294. gsw /points ed
  1295. /ss points length 2 idiv 2 mul def
  1296. newpath
  1297. ss 4 gt {
  1298. /x1 points 0 get def
  1299. /y1 points 1 get def
  1300. /x2 points 2 get def
  1301. /y2 points 3 get def
  1302. /x3 points 4 get def
  1303. /y3 points 5 get def
  1304. /x0 x1 2 mul x2 sub def
  1305. /y0 y3 y2 sub x3 x2 sub div y2 y1 sub x2 x1 sub div sub 2 mul
  1306. x2 x1 sub dup mul x3 x1 sub div mul
  1307. y1 2 mul add y2 sub def
  1308. x1 y1 moveto
  1309. docurve
  1310. 0 2 ss 8 sub { /ii ed
  1311. /x0 points ii get def
  1312. /y0 points ii 1 add get def
  1313. /x1 points ii 2 add get def
  1314. /y1 points ii 3 add get def
  1315. /x2 points ii 4 add get def
  1316. /y2 points ii 5 add get def
  1317. /x3 points ii 6 add get def
  1318. /y3 points ii 7 add get def
  1319. docurve
  1320. } for
  1321. /x0 points ss 6 sub get def
  1322. /y0 points ss 5 sub get def
  1323. /x1 points ss 4 sub get def
  1324. /y1 points ss 3 sub get def
  1325. /x2 points ss 2 sub get def
  1326. /y2 points ss 1 sub get def
  1327. /x3 x2 2 mul x1 sub def
  1328. /y3 y2 y1 sub x2 x1 sub div y1 y0 sub x1 x0 sub div sub 2 mul
  1329. x2 x1 sub dup mul x2 x0 sub div mul
  1330. y2 2 mul add y1 sub def
  1331. docurve
  1332. } {
  1333. ss 4 eq {
  1334. points 0 get points 1 get moveto
  1335. points 2 get points 3 get lineto
  1336. } if
  1337. } ifelse
  1338. stroke
  1339. grestore
  1340. } def }
  1341. %
  1342. % #] makecurve :
  1343. % #[ makedashcurve :
  1344. %
  1345. \special{! /makedashcurve{
  1346. %
  1347. % Incoming stack:
  1348. % [array of x,y pairs] dashsize width scale
  1349. %
  1350. gsw /dsize ed /points ed
  1351. /ss points length 2 idiv 2 mul def
  1352. newpath
  1353. ss 4 gt {
  1354. /x1 points 0 get def
  1355. /y1 points 1 get def
  1356. /x2 points 2 get def
  1357. /y2 points 3 get def
  1358. /x3 points 4 get def
  1359. /y3 points 5 get def
  1360. /x0 x1 2 mul x2 sub def
  1361. /y0 y3 y2 sub x3 x2 sub div y2 y1 sub x2 x1 sub div sub 2 mul
  1362. x2 x1 sub dup mul x3 x1 sub div mul
  1363. y1 2 mul add y2 sub def
  1364. x1 y1 moveto
  1365. docurve
  1366. 0 2 ss 8 sub { /ii ed
  1367. /x0 points ii get def
  1368. /y0 points ii 1 add get def
  1369. /x1 points ii 2 add get def
  1370. /y1 points ii 3 add get def
  1371. /x2 points ii 4 add get def
  1372. /y2 points ii 5 add get def
  1373. /x3 points ii 6 add get def
  1374. /y3 points ii 7 add get def
  1375. docurve
  1376. } for
  1377. /x0 points ss 6 sub get def
  1378. /y0 points ss 5 sub get def
  1379. /x1 points ss 4 sub get def
  1380. /y1 points ss 3 sub get def
  1381. /x2 points ss 2 sub get def
  1382. /y2 points ss 1 sub get def
  1383. /x3 x2 2 mul x1 sub def
  1384. /y3 y2 y1 sub x2 x1 sub div y1 y0 sub x1 x0 sub div sub 2 mul
  1385. x2 x1 sub dup mul x2 x0 sub div mul
  1386. y2 2 mul add y1 sub def
  1387. docurve
  1388. } {
  1389. ss 4 eq {
  1390. points 0 get points 1 get moveto
  1391. points 2 get points 3 get lineto
  1392. } if
  1393. } ifelse
  1394. centerdash
  1395. stroke
  1396. grestore
  1397. } def }
  1398. %
  1399. \special{! /pathlength{
  1400. flattenpath
  1401. /dist 0 def
  1402. { /yfirst ed /xfirst ed /ymoveto yfirst def /xmoveto xfirst def }
  1403. { /ynext ed /xnext ed /dist dist ynext yfirst sub dup mul
  1404. xnext xfirst sub dup mul add sqrt add def
  1405. /yfirst ynext def /xfirst xnext def }
  1406. {}
  1407. {/ynext ymoveto def /xnext xmoveto def
  1408. /dist ynext yfirst sub dup mul
  1409. xnext xfirst sub dup mul add sqrt add def
  1410. /yfirst ynext def /xfirst xnext def }
  1411. pathforall
  1412. dist
  1413. } def }
  1414. %
  1415. \special{! /centerdash{
  1416. /pathlen pathlength def
  1417. /jj pathlen dsize div 2.0 div cvi def
  1418. /ddsize pathlen jj 2.0 mul div def
  1419. [ddsize] ddsize 2 div setdash
  1420. } def }
  1421. %
  1422. % #] makedashcurve :
  1423. % #[ logaxis :
  1424. %
  1425. \special{! /logaxis{
  1426. %
  1427. % Draws an axis from x1,y1 to x2,y2 with nl log divisions
  1428. % size of the hashes hs, offset F
  1429. % and width W. The stack looks like
  1430. % x1,y1,x2,y2,nl,hs,F,W,scale
  1431. % After the rotation the hash marks are on top if nl is positive and
  1432. % on the bottom if nl is negative
  1433. %
  1434. gsw /offset ed /hashsize ed /nlogs ed
  1435. normalizeline /rr ed
  1436. offset 0 ne { /offset offset ln 10 ln div def } if
  1437. /offset offset dup cvi sub def
  1438. newpath
  1439. 0 0 moveto
  1440. rr 0 lineto
  1441. /lsize rr nlogs div def
  1442. 0 1 nlogs { /x2 ed
  1443. x2 offset ge {
  1444. /y2 x2 offset sub lsize mul def
  1445. y2 rr le {
  1446. y2 0 moveto
  1447. y2 hashsize 1.2 mul lineto
  1448. } if
  1449. } if
  1450. } for
  1451. stroke
  1452. width 0.6 mul setlinewidth
  1453. newpath
  1454. 0 1 nlogs { /x2 ed
  1455. 2 1 9 {
  1456. ln 10 ln div x2 add
  1457. /xx2 ed
  1458. xx2 offset ge {
  1459. /y2 xx2 offset sub lsize mul def
  1460. y2 rr le {
  1461. y2 0 moveto
  1462. y2 hashsize 0.8 mul lineto
  1463. } if
  1464. } if
  1465. } for
  1466. } for
  1467. stroke
  1468. grestore
  1469. } def }
  1470. %
  1471. % #] logaxis :
  1472. % #[ linaxis :
  1473. %
  1474. \special{! /linaxis{
  1475. %
  1476. % x1,y1,x2,y2,num_decs,per_dec,hashsize,offset,width,scale
  1477. %
  1478. gsw /offset ed /hashsize ed /perdec ed /numdec ed
  1479. normalizeline
  1480. /rr ed
  1481. newpath
  1482. 0 0 moveto
  1483. rr 0 lineto
  1484. /x1 rr numdec perdec mul div def
  1485. /y1 rr numdec div def
  1486. /offset offset x1 mul def
  1487. 0 1 numdec { y1 mul offset sub
  1488. dup 0 ge {
  1489. dup rr le {
  1490. dup 0 moveto
  1491. hashsize 1.2 mul lineto
  1492. } if
  1493. } if
  1494. } for
  1495. stroke
  1496. width 0.6 mul setlinewidth
  1497. newpath
  1498. offset cvi 1 numdec perdec mul offset add {
  1499. x1 mul offset sub
  1500. dup 0 ge {
  1501. dup rr le {
  1502. dup 0 moveto
  1503. hashsize 0.8 mul lineto
  1504. } if
  1505. } if
  1506. } for
  1507. stroke
  1508. grestore
  1509. } def }
  1510. %
  1511. % #] linaxis :
  1512. % #[ dashbezier:
  1513. %
  1514. \special{! /dashbezier{
  1515. %
  1516. % Draws a dashed Bezier with control points x1,y1,x2,y2,x3,y3,x4,y4
  1517. %
  1518. gsw /dsize ed p4 p3 p2 p1
  1519. % The following is a failed attempt (copied from dashline) to make
  1520. % sure there is an integer number of dashes. It fails because it
  1521. % assumes the length of the line is the distance between the two end points.
  1522. % /r y4 y1 sub dup mul x4 x1 sub dup mul add sqrt def
  1523. % /dsize r dsize 2 mul div 0.5 sub round dup 0 le { pop 0 } if 2 mul 1 add
  1524. % r exch div def
  1525. dsize 0 ne
  1526. { [dsize dsize] 0 setdash }
  1527. if
  1528. abezier stroke
  1529. grestore
  1530. } def }
  1531. %
  1532. % #] dashbezier :
  1533. }
  1534. % ========== End of AtBeginDvi
  1535. %=========================================================
  1536. %=========================================================
  1537. \def\axowidth{0.5 }
  1538. \def\axoscale{1.0 }
  1539. \def\axoxoff{0 }
  1540. \def\axoyoff{0 }
  1541. \def\axoxo{0 }
  1542. \def\axoyo{0 }
  1543. \def\firstcall{1}
  1544. \def\AXO@NOTIMPLEMENTED#1{\PackageWarning{axodraw4j}{#1}}
  1545. % Postscript code for setting default arrow
  1546. \def\AXO@DefaultArrow{%
  1547. 1
  1548. \axowidth \space
  1549. \ifAXO@double
  1550. \AXO@CurrentSep \space 0.7 mul add
  1551. \fi
  1552. 1 add 1.2 mul % Width. 1.2 factor is from axodraw
  1553. % Additive term was 1 in axodraw
  1554. % Now put in an extra overall scaling
  1555. \AXO@CurrentArrowScale \space mul
  1556. dup 2 mul \AXO@DefaultArrowAspect \space mul % Length
  1557. \AXO@CurrentArrowInset \space
  1558. arrowVTriangle
  1559. }
  1560. % Version of picture environment with unitlength set to 1pt
  1561. % as assumed by axodraw
  1562. \newenvironment{axopicture}
  1563. { \begingroup
  1564. \setlength{\unitlength}{1pt}%
  1565. \picture
  1566. }
  1567. {\endpicture\endgroup}
  1568. % The next is used temporarily, it gives the result of parsing an
  1569. % arrow-using command to give the Postscript code for setting the
  1570. % arrow.
  1571. %
  1572. % Keys for optional arguments:
  1573. % First the variables used, with some defaults.
  1574. \newif\ifAXO@arrow
  1575. \AXO@arrowfalse
  1576. \newif\ifAXO@clock
  1577. \AXO@clockfalse
  1578. \newif\ifAXO@dash
  1579. \AXO@dashfalse
  1580. \newif\ifAXO@double
  1581. \AXO@doublefalse
  1582. \newif\ifAXO@flip % Flip arrow orientation, as in JaxoDraw
  1583. \AXO@flipfalse
  1584. \def\AXO@Sep{2 } % Double line separation
  1585. \def\AXO@DashSize{3 }
  1586. % Then the definitions of the keys
  1587. \define@key{axo}{arrowscale}{%
  1588. \def\AXO@CurrentArrowScale{#1}%
  1589. }
  1590. \define@key{axo}{arrowwidth}{%
  1591. \def\AXO@CurrentArrowWidth{#1}%
  1592. }
  1593. \define@key{axo}{arrowlength}{%
  1594. \def\AXO@CurrentArrowLength{#1}%
  1595. }
  1596. % Make arrowheight a synonym for arrowlength
  1597. \let\KV@axo@arrowheight=\KV@axo@arrowlength
  1598. %
  1599. \define@key{axo}{arrowpos}{%
  1600. \def\AXO@CurrentArrowPos{#1 }
  1601. }
  1602. %
  1603. \define@key{axo}{arrowinset}{%
  1604. \def\AXO@CurrentArrowInset{#1 }
  1605. }
  1606. % Make inset a synonym for arrowinset
  1607. \let\KV@axo@inset=\KV@axo@arrowinset
  1608. %
  1609. \define@key{axo}{arrow}[true]{%
  1610. \AXO@boolkey{#1}{arrow}%
  1611. }
  1612. \define@key{axo}{clock}[true]{%
  1613. \AXO@boolkey{#1}{clock}%
  1614. }
  1615. \define@key{axo}{clockwise}[true]{%
  1616. \AXO@boolkey{#1}{clock}%
  1617. }
  1618. \define@key{axo}{double}[true]{%
  1619. \AXO@boolkey{#1}{double}%
  1620. }
  1621. \define@key{axo}{dash}[true]{%
  1622. \AXO@boolkey{#1}{dash}%
  1623. }
  1624. \define@key{axo}{flip}[true]{%
  1625. \AXO@boolkey{#1}{flip}%
  1626. }
  1627. \define@key{axo}{linesep}{%
  1628. \def\AXO@CurrentSep{#1 }
  1629. }
  1630. \define@key{axo}{sep}{%
  1631. \def\AXO@CurrentSep{#1 }
  1632. }
  1633. \define@key{axo}{dashsize}{%
  1634. \def\AXO@CurrentDashSize{#1 }
  1635. }
  1636. \define@key{axo}{dsize}{%
  1637. \def\AXO@CurrentDashSize{#1 }
  1638. }
  1639. %
  1640. % Parsing of optional arguments, etc
  1641. %
  1642. \def\AXO@Parse#1#2{%
  1643. % Usage: \AXO@Parse#1#2 or \AXO@Parse#1#2[#3]
  1644. % #1 is a command for setting an object, that takes no optional argument
  1645. % #2 and the optional #3 are keyword settings.
  1646. % There then follow the compulsory arguments for the command in #1.
  1647. %
  1648. % E.g., \AXO@Parse{\AXO@Line}{double}(x1,y1)(x2,y2)
  1649. % \AXO@Parse{\AXO@Line}{double}[arrow](x1,y1)(x2,y2)
  1650. %
  1651. % I will
  1652. % (a) Set standard initial settings (arrows, etc)
  1653. % (b) Parse the keyword settings in #2 and #3, e.g., scale = 3,
  1654. % (c) Call #1 to make the object
  1655. \AXO@arrowfalse
  1656. \AXO@clockfalse
  1657. \AXO@dashfalse
  1658. \AXO@doublefalse
  1659. \AXO@flipfalse
  1660. \def\AXO@CurrentArrow{
  1661. \AXO@CurrentArrowStroke \space
  1662. \AXO@CurrentArrowWidth \space
  1663. \AXO@CurrentArrowLength \space
  1664. \AXO@CurrentArrowInset \space
  1665. arrowVTriangle
  1666. }%
  1667. \let\AXO@CurrentArrowPos\AXO@ArrowPos
  1668. \let\AXO@CurrentArrowWidth\relax
  1669. \let\AXO@CurrentArrowLength\relax
  1670. \let\AXO@CurrentArrowInset\AXO@ArrowInset
  1671. \let\AXO@CurrentArrowScale\AXO@DefaultArrowScale
  1672. \let\AXO@CurrentArrowStroke\AXO@DefaultArrowStroke
  1673. \let\AXO@CurrentDashSize\AXO@DashSize
  1674. \let\AXO@CurrentSep=\AXO@Sep
  1675. \@ifnextchar[{\AXO@Options{#1}{#2}}%
  1676. {\AXO@Options{#1}{#2}[]}%
  1677. }
  1678. %
  1679. \def\AXO@Options#1#2[#3]{%
  1680. % #1 is command to execute, #2 and #3 are options.
  1681. \setkeys{axo}{#2}%
  1682. \setkeys{axo}{#3}%
  1683. \ifx\AXO@CurrentArrowLength\relax
  1684. \ifx\AXO@CurrentArrowWidth\relax
  1685. % AL AW to default
  1686. \let\AXO@CurrentArrow=\AXO@DefaultArrow
  1687. \else
  1688. % AL by default aspect ratio
  1689. \def\AXO@CurrentArrowLength{
  1690. \AXO@CurrentArrowWidth \space 2 mul
  1691. \AXO@DefaultArrowAspect\space mul
  1692. }%
  1693. \fi
  1694. \else
  1695. \ifx\AXO@CurrentArrowWidth\relax
  1696. % AW by default aspect ratio
  1697. \def\AXO@CurrentArrowWidth{
  1698. \AXO@CurrentArrowLength \space 2 div
  1699. \AXO@DefaultArrowAspect\space div
  1700. }%
  1701. \fi
  1702. \fi
  1703. \ifAXO@arrow
  1704. \def\AXO@ArrowArg{
  1705. { \AXO@CurrentArrow \space } \AXO@CurrentArrowPos \space
  1706. }%
  1707. \else
  1708. \def\AXO@ArrowArg{ { } 0 }%
  1709. \fi
  1710. #1%
  1711. }
  1712. %
  1713. % Now ensure there is a setting for the current arrow
  1714. \AXO@Parse{}{}
  1715. \def\AXO@PrependOption#1#2{%
  1716. % Run command #1, which has an optional argument, with #2 prepended
  1717. % to the command's optional arguments. If there are no optional
  1718. % arguments, just run the command with #2 as the optional arguments
  1719. \@ifnextchar[{\AXO@TwoOption{#1}{#2}}%
  1720. {#1[#2]}%
  1721. }
  1722. \def\AXO@TwoOption#1#2[#3]{%
  1723. #1[#2,#3]%
  1724. }
  1725. % Copied from graphicx.sty, for use with boolean keys
  1726. % Modified to do lower casing here
  1727. \def\AXO@boolkey#1#2{%
  1728. % Wanted to do
  1729. % \csname AXO@#2\ifx\relax#1\relax true\else\lowercase{#1}\fi\endcsname
  1730. % but there was an error message about a missing \endcsname
  1731. \lowercase{\AXO@boolkeyA{#1}}{#2}%
  1732. }
  1733. \def\AXO@boolkeyA#1#2{%
  1734. \csname AXO@#2\ifx\relax#1\relax true\else#1\fi\endcsname
  1735. }
  1736. %=========================================================
  1737. %=========================================================
  1738. %
  1739. % Now the user callable routines, and their immediate helpers
  1740. %
  1741. % Commands for setting parameters applicable to subsequent graphical objects:
  1742. %
  1743. \def\SetLineSep#1{\def\AXO@Sep{#1 }}
  1744. \let\SetSep=\SetLineSep
  1745. \def\SetWidth#1{\def\axowidth{#1 }}
  1746. \def\SetScale#1{\def\axoscale{#1 }}
  1747. \def\SetOffset(#1,#2){\def\axoxoff{#1 } \def\axoyoff{#2 }}
  1748. \def\SetScaledOffset(#1,#2){\def\axoxo{#1 } \def\axoyo{#2 }}
  1749. %
  1750. % Commands for making graphical objects:
  1751. \def\Arc{%
  1752. % \Arc[opt](x,y)(r,theta1,theta2)
  1753. % draws an arc centered at (x,y) of radius r, starting at theta1,
  1754. % and ending at theta2. By default: no arrow, undashed, single,
  1755. % anticlockwise.
  1756. % Supported options: all arrow settings, all double line settings,
  1757. % all dash line settings, clock
  1758. %
  1759. \AXO@Parse{\AXO@Arc}{}%
  1760. }
  1761. %
  1762. \def\AXO@Arc(#1,#2)(#3,#4,#5){%
  1763. %
  1764. % Draws arc centered at (#1,#2), radius #3, starting and ending
  1765. % angles #4, #5.
  1766. % Double, dashing, arrow, clockwise according to current settings
  1767. %
  1768. \put(\axoxoff,\axoyoff){%
  1769. \special{"\axocolor
  1770. \AXO@ArrowArg \space
  1771. \ifAXO@flip true \else false \fi
  1772. \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
  1773. \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
  1774. \ifAXO@clock true \else false \fi
  1775. #3 #4 #5
  1776. #1 \axoxo add #2 \axoyo add
  1777. \axowidth \axoscale
  1778. arc2
  1779. }}%
  1780. }
  1781. %
  1782. %
  1783. \def\Gluon{%
  1784. %
  1785. % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
  1786. %
  1787. \AXO@Parse{\AXO@Gluon}{}%
  1788. }
  1789. %
  1790. \def\AXO@Gluon(#1,#2)(#3,#4)#5#6{%
  1791. %
  1792. % Draws a gluon from (x1,y1) to (x2,y2) with amplitude #5 and number
  1793. % of windings #6.
  1794. % Assumes options have been set
  1795. %
  1796. \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon}\fi
  1797. \ifAXO@dash\AXO@NOTIMPLEMENTED{dashing not implemented for gluon}\fi
  1798. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  1799. \axoxo add #4 \axoyo add #5 #6
  1800. \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
  1801. \axowidth \axoscale doublegluon
  1802. }}%
  1803. }
  1804. %
  1805. \def\Photon{%
  1806. % \Photon[opt](x1,y1)(x2,y2){amplitude}{numwind}
  1807. % Draws a photon from (x1,y1) to (x2,y2) with given amplitude and
  1808. % number of windings
  1809. % Supported options: double, sep, linesep
  1810. %
  1811. \AXO@Parse{\AXO@Photon}{}%
  1812. }
  1813. %
  1814. \def\AXO@Photon(#1,#2)(#3,#4)#5#6{%
  1815. %
  1816. % Draws a photon from (x1,y1) to (x2,y2) with amplitude #5 and number
  1817. % of windings #6.
  1818. % Assumes options have been set
  1819. %
  1820. \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for photon}\fi
  1821. \ifAXO@dash\AXO@NOTIMPLEMENTED{dashing not implemented for photon}\fi
  1822. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  1823. \axoxo add #4 \axoyo add #5 #6
  1824. \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
  1825. \axowidth \axoscale doublephoton
  1826. }}%
  1827. }
  1828. %
  1829. \def\ZigZag(#1,#2)(#3,#4)#5#6{
  1830. %
  1831. % Draws a zigzag from (x1,y1) to (x2,y2) with amplitude and number of zigzags
  1832. %
  1833. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  1834. \axoxo add #4 \axoyo add #5 #6 \axowidth \axoscale zigzag
  1835. }}
  1836. }
  1837. %
  1838. \def\PhotonArc{%
  1839. % \PhotonArc(x,y)(r,theta1,theta2){amplitude}{numwind}
  1840. % draws a photon on an arc centered at (x,y) of radius r, starting
  1841. % at theta1, and ending at theta2, with given amplitude and
  1842. % number of windings
  1843. %
  1844. \AXO@Parse{\AXO@PhotonArc}{}%
  1845. }
  1846. %
  1847. \def\AXO@PhotonArc(#1,#2)(#3,#4,#5)#6#7{%
  1848. %
  1849. % Draws a photon on an arc segment. The center of the curve is at (1,2)
  1850. % The radius, start angle and target angle are (#3,#4,#5), #6 is the
  1851. % amplitude of the gluon, and #7 is the number of wiggles.
  1852. % Assumes options have been set
  1853. %
  1854. \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for photon arc}\fi
  1855. \ifAXO@dash\AXO@NOTIMPLEMENTED{dashing not implemented for photon arc}\fi
  1856. \put(\axoxoff,\axoyoff){\special{"\axocolor
  1857. #6 #7
  1858. \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
  1859. \ifAXO@clock true \else false \fi
  1860. #3 #4 #5
  1861. #1 \axoxo add #2 \axoyo add
  1862. \axowidth \axoscale
  1863. doublephotonarc
  1864. }}%
  1865. }
  1866. %
  1867. \def\GluonArc{%
  1868. % \GluonArc(x,y)(r,theta1,theta2){amplitude}{numwind}
  1869. % draws a gluon on an arc centered at (x,y) of radius r, starting
  1870. % at theta1, and ending at theta2, with given amplitude and
  1871. % number of windings
  1872. %
  1873. \AXO@Parse{\AXO@GluonArc}{}%
  1874. }
  1875. %
  1876. \let\GlueArc=\GluonArc % For backward compatibility
  1877. %
  1878. \def\AXO@GluonArc(#1,#2)(#3,#4,#5)#6#7{%
  1879. %
  1880. % Draws a gluon on an arc segment. The center of the curve is at (1,2)
  1881. % The radius, start angle and target angle are (#3,#4,#5), #6 is the
  1882. % amplitude of the gluon, and #7 is the number of windings.
  1883. % Assumes options have been set
  1884. %
  1885. \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon arc}\fi
  1886. \ifAXO@dash\AXO@NOTIMPLEMENTED{dashing not implemented for gluon arc}\fi
  1887. \put(\axoxoff,\axoyoff){\special{"\axocolor
  1888. #6 #7
  1889. \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
  1890. \ifAXO@clock true \else false \fi
  1891. #3 #4 #5
  1892. #1 \axoxo add #2 \axoyo add
  1893. \axowidth \axoscale
  1894. doublegluearc
  1895. }}%
  1896. }
  1897. %
  1898. \def\ArrowArc{%
  1899. \AXO@PrependOption{\Arc}{arrow}%
  1900. }
  1901. %
  1902. \def\LongArrowArc{%
  1903. \AXO@PrependOption{\Arc}{arrow,arrowpos=1}%
  1904. }
  1905. %
  1906. \def\DashArrowArc{%
  1907. % (x,y)(radius,start,end){dashsize}
  1908. % Draws a dashed arc segment with an arrow in it. The center of the curve
  1909. % is at (x,y), with given radius, start angle, and end angle
  1910. % The arc segment runs anticlockwise
  1911. \@ifnextchar[{\AXO@DashArrowArc}{\AXO@DashArrowArc[]}%
  1912. }
  1913. \def\AXO@DashArrowArc[#1](#2,#3)(#4,#5,#6)#7{
  1914. \Arc[arrow,dash,dashsize=#7,#1](#2,#3)(#4,#5,#6)%
  1915. }
  1916. %
  1917. \def\ArrowArcn{%
  1918. \AXO@PrependOption{\Arc}{arrow,clock}%
  1919. }
  1920. %
  1921. \def\LongArrowArcn{%
  1922. % \ArrowArcn, but with arrow at end by default
  1923. \AXO@PrependOption{\Arc}{arrow, clock, arrowpos=1}%
  1924. }
  1925. %
  1926. \def\DashArrowArcn{%
  1927. % (x,y)(radius,start,end){dashsize}
  1928. % Draws a dashed arc segment with an arrow in it. The center of the curve
  1929. % is at (x,y), with given radius, start angle, and end angle
  1930. % The arc segment runs anticlockwise
  1931. \@ifnextchar[{\AXO@DashArrowArcn}{\AXO@DashArrowArcn[]}%
  1932. }
  1933. \def\AXO@DashArrowArcn[#1](#2,#3)(#4,#5,#6)#7{
  1934. \Arc[clock,arrow,dash,dashsize=#7,#1](#2,#3)(#4,#5,#6)%
  1935. }
  1936. %
  1937. \def\ArrowDoubleLine{%
  1938. %
  1939. % \ArrowDoubleLine[opt](x1,y1)(x2,y2){sep}
  1940. % Draws a double line, with arrow by default, from (x1,y1) to (x2,y2),
  1941. % with separation sep
  1942. %
  1943. \@ifnextchar[{\AXO@ADoL}{\AXO@ADoL[]}%
  1944. }
  1945. \def\AXO@ADoL[#1](#2,#3)(#4,#5)#6{%
  1946. \Line[arrow,double,sep=#6,#1](#2,#3)(#4,#5)%
  1947. }
  1948. %
  1949. \def\DashArrowDoubleLine{%
  1950. % \DashArrowDoubleLine[opt](x1,y1)(x2,y2){sep}{dashsize}
  1951. % Draws a double line from (x1,y1) to (x2,y2) with separation sep,
  1952. % and with a dash pattern of which the
  1953. % alternating black and white pieces are approximately sep points long
  1954. % Arrow on.
  1955. \@ifnextchar[{\AXO@ADaDoL}{\AXO@ADaDoL[]}%
  1956. }
  1957. \def\AXO@ADaDoL[#1](#2,#3)(#4,#5)#6#7{%
  1958. \Line[arrow,dash,dashsize=#7,double,sep=#6,#1](#2,#3)(#4,#5)%
  1959. }
  1960. %
  1961. \def\ArrowLine{%
  1962. % \ArrowLine[opt](x1,y1)(x2,y2)
  1963. % draws a line from (x1,y1) to (x2,y2). Arrow by default.
  1964. %
  1965. \AXO@PrependOption{\Line}{arrow}%
  1966. }
  1967. %
  1968. \def\LongArrow{%
  1969. \AXO@PrependOption{\Line}{arrow, arrowpos=1}%
  1970. }
  1971. %
  1972. \def\DashArrowLine{
  1973. % \DashArrowLine[opt](x1,y1)(x2,y2){sep}
  1974. % Draws a line from (x1,y1) to (x2,y2) with a dash pattern of which the
  1975. % alternating black and white pieces are approximately sep points
  1976. % long. Arrow by default.
  1977. %
  1978. \@ifnextchar[{\AXO@ADaL}{\AXO@ADaL[]}%
  1979. }
  1980. \def\AXO@ADaL[#1](#2,#3)(#4,#5)#6{%
  1981. \Line[arrow,dash,dashsize=#6,#1](#2,#3)(#4,#5)%
  1982. }
  1983. %
  1984. \def\Line{
  1985. % \Line[opt](x1,y1)(x2,y2)
  1986. % draws a line from (x1,y1) to (x2,y2). NO arrow by default.
  1987. % Supported options: all arrow settings, all double line settings,
  1988. % all dash line settings.
  1989. %
  1990. \AXO@Parse{\AXO@Line}{}%
  1991. }
  1992. %
  1993. \def\AXO@Line(#1,#2)(#3,#4){
  1994. %
  1995. % Draws a line from (x1,y1) to (x2,y2)
  1996. % Double, dashing, arrow according to current settings
  1997. %
  1998. \put(\axoxoff,\axoyoff){%
  1999. \special{"\axocolor \space
  2000. \AXO@ArrowArg \space
  2001. \ifAXO@flip true \else false \fi
  2002. \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
  2003. \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
  2004. #1 \axoxo add #2 \axoyo add
  2005. #3 \axoxo add #4 \axoyo add
  2006. \axowidth \space \axoscale \space
  2007. dasharrowdoubleline
  2008. }}%
  2009. }
  2010. %
  2011. %
  2012. \def\DashLine{
  2013. % \DashLine[opt](x1,y1)(x2,y2){sep}
  2014. % Draws a line from (x1,y1) to (x2,y2) with a dash pattern of which the
  2015. % alternating black and white pieces are approximately sep points long
  2016. %
  2017. \@ifnextchar[{\AXO@DaL}{\AXO@DaL[]}%
  2018. }
  2019. \def\AXO@DaL[#1](#2,#3)(#4,#5)#6{%
  2020. \Line[dash,dashsize=#6,#1](#2,#3)(#4,#5)%
  2021. }
  2022. %
  2023. \def\DoubleLine{
  2024. %
  2025. % \DoubleLine[opt](x1,y1)(x2,y2){sep}
  2026. % Draws a double line, with NO arrow by default, from (x1,y1) to (x2,y2),
  2027. % with separation sep
  2028. %
  2029. \@ifnextchar[{\AXO@DoL}{\AXO@DoL[]}%
  2030. }
  2031. \def\AXO@DoL[#1](#2,#3)(#4,#5)#6{%
  2032. \Line[arrow=false,double,sep=#6,#1](#2,#3)(#4,#5)%
  2033. }
  2034. %
  2035. \def\DashDoubleLine{
  2036. % \DashDoubleLine[opt](x1,y1)(x2,y2){sep}{dashsize}
  2037. % Draws a double line from (x1,y1) to (x2,y2) with separation sep,
  2038. % and with a dash pattern of which the
  2039. % alternating black and white pieces are approximately sep points long
  2040. % Arrow on.
  2041. \@ifnextchar[{\AXO@DaDoL}{\AXO@DaDoL[]}%
  2042. }
  2043. \def\AXO@DaDoL[#1](#2,#3)(#4,#5)#6#7{%
  2044. \Line[arrow=off,dash,dashsize=#7,double,sep=#6,#1](#2,#3)(#4,#5)%
  2045. }
  2046. %
  2047. \def\CArc(#1,#2)(#3,#4,#5){%
  2048. %
  2049. % Draws an arc segment. The center of the curve
  2050. % is at (#1,#2).
  2051. % The radius, start angle and target angle are (#3,#4,#5).
  2052. % The arc segment runs anticlockwise
  2053. %
  2054. \Arc(#1,#2)(#3,#4,#5)%
  2055. }
  2056. %
  2057. \def\DashCArc(#1,#2)(#3,#4,#5)#6{
  2058. %
  2059. % Draws a dashed arc segment. The center of the curve
  2060. % is at (1,2).
  2061. % The radius, start angle and target angle are (#3,#4,#5).
  2062. % The arc segment runs anticlockwise
  2063. % #6 is the dashsize. this is rounded to make things come
  2064. % out right.
  2065. %
  2066. \Arc[dash,dsize=#6](#1,#2)(#3,#4,#5)%
  2067. }
  2068. %
  2069. \def\Vertex(#1,#2)#3{
  2070. %
  2071. % Draws a fat dot at (1,2). The radius of the dot is given by 3.
  2072. %
  2073. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2074. \axoscale vertex
  2075. }}
  2076. }
  2077. %
  2078. \def\Text(#1,#2)[#3]#4{
  2079. %
  2080. % Draws text at (1,2). Argument 3 is l,r or c indicating whether
  2081. % the text is left adjusted, right adjusted or centered.
  2082. % 4 is of course the text.
  2083. %
  2084. \dimen0=\axoxoff \unitlength
  2085. \dimen1=\axoyoff \unitlength
  2086. \advance\dimen0 by #1 \unitlength
  2087. \advance\dimen1 by #2 \unitlength
  2088. \@killglue\raise\dimen1\hbox to\z@{\kern\dimen0 \makebox(0,0)[#3]{#4}\hss}
  2089. \ignorespaces
  2090. }
  2091. %
  2092. \def\BCirc(#1,#2)#3{
  2093. %
  2094. % Draws a circle at (1,2) and radius 3 that is blanked out.
  2095. %
  2096. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2097. \axowidth \axoscale bcirc
  2098. }}
  2099. }
  2100. %
  2101. \def\GCirc(#1,#2)#3#4{
  2102. %
  2103. % Draws a circle at (1,2) and radius 3 that is blanked out.
  2104. % Then it fills the circle with a gray scale 4 (0 = black, 1 is white)
  2105. %
  2106. \put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3
  2107. #4 \axowidth \axoscale gcirc
  2108. }}
  2109. }
  2110. %
  2111. \def\CCirc(#1,#2)#3#4#5{
  2112. %
  2113. % Draws a circle at (1,2) and radius 3 that is blanked out.
  2114. % #4 is the color of the circle, #5 the color of the contents
  2115. %
  2116. \put(\axoxoff,\axoyoff){\special{"#5 #1 \axoxo add #2 \axoyo add #3
  2117. \axowidth \axoscale ccirc1
  2118. }}
  2119. \put(\axoxoff,\axoyoff){\special{"#4 #1 \axoxo add #2 \axoyo add #3
  2120. \axowidth \axoscale ccirc2
  2121. }}
  2122. }
  2123. %
  2124. \def\EBox(#1,#2)(#3,#4){
  2125. %
  2126. % Draws a box with the left bottom at (x1,y1) and the right top
  2127. % at (x2,y2).
  2128. %
  2129. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2130. \axoxo add #4 \axoyo add \axowidth \axoscale box
  2131. }}
  2132. }
  2133. %
  2134. \def\BBox(#1,#2)(#3,#4){
  2135. %
  2136. % Draws a box with the left bottom at (x1,y1) and the right top
  2137. % at (x2,y2). The box is blanked out.
  2138. %
  2139. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2140. \axoxo add #4 \axoyo add \axowidth \axoscale bbox
  2141. }}
  2142. }
  2143. %
  2144. \def\GBox(#1,#2)(#3,#4)#5{
  2145. %
  2146. % Draws a box with the left bottom at (x1,y1) and the right top
  2147. % at (x2,y2). The box is blanked out and then filled with gray 5
  2148. % (0 is black, 1 is white)
  2149. %
  2150. \put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3
  2151. \axoxo add #4 \axoyo add #5 \axowidth \axoscale gbox
  2152. }}
  2153. }
  2154. %
  2155. \def\CBox(#1,#2)(#3,#4)#5#6{
  2156. %
  2157. % Draws a box with the left bottom at (x1,y1) and the right top
  2158. % at (x2,y2). The color of the box is #5, the background is #6
  2159. %
  2160. \put(\axoxoff,\axoyoff){\special{"#6 #1 \axoxo add #2 \axoyo add #3
  2161. \axoxo add #4 \axoyo add \axowidth \axoscale cbox1
  2162. }}
  2163. \put(\axoxoff,\axoyoff){\special{"#5 #1 \axoxo add #2 \axoyo add #3
  2164. \axoxo add #4 \axoyo add \axowidth \axoscale cbox2
  2165. }}
  2166. }
  2167. %
  2168. \def\Boxc(#1,#2)(#3,#4){
  2169. %
  2170. % Draws a box with the center at (x1,y1).
  2171. % The width and height are (3,4).
  2172. %
  2173. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #3 2 div sub #2 \axoyo add
  2174. #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
  2175. \axowidth \axoscale box
  2176. }}
  2177. }
  2178. %
  2179. \def\BBoxc(#1,#2)(#3,#4){
  2180. %
  2181. % Draws a box with the center at (x1,y1).
  2182. % The width and height are (3,4). The contents are blanked out
  2183. %
  2184. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #3 2 div sub #2 \axoyo add
  2185. #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
  2186. \axowidth \axoscale bbox
  2187. }}
  2188. }
  2189. %
  2190. \def\GBoxc(#1,#2)(#3,#4)#5{
  2191. %
  2192. % Draws a box with the center at (x1,y1).
  2193. % The width and height are (3,4). The contents are blanked out
  2194. % Then the contents are filled with gray 5 (0 is black, 1 is white)
  2195. %
  2196. \put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #3 2 div sub #2 \axoyo add
  2197. #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
  2198. #5 \axowidth \axoscale gbox
  2199. }}
  2200. }
  2201. %
  2202. \def\CBoxc(#1,#2)(#3,#4)#5#6{
  2203. %
  2204. % Draws a box with the center at (x1,y1).
  2205. % The width and height are (3,4). The contents are blanked out
  2206. % The color of the box is #5, the background is #6
  2207. %
  2208. \put(\axoxoff,\axoyoff){\special{"#6 #1 \axoxo add #3 2 div sub #2 \axoyo add
  2209. #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
  2210. \axowidth \axoscale cbox1
  2211. }}
  2212. \put(\axoxoff,\axoyoff){\special{"#5 #1 \axoxo add #3 2 div sub #2 \axoyo add
  2213. #4 2 div sub #1 \axoxo add #3 2 div add #2 \axoyo add #4 2 div add
  2214. \axowidth \axoscale cbox2
  2215. }}
  2216. }
  2217. %
  2218. \def\ETri(#1,#2)(#3,#4)(#5,#6){
  2219. %
  2220. % Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
  2221. %
  2222. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2223. \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
  2224. \axowidth \axoscale triangle
  2225. }}
  2226. }
  2227. %
  2228. \def\BTri(#1,#2)(#3,#4)(#5,#6){
  2229. %
  2230. % Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
  2231. % The triangle is blanked out.
  2232. %
  2233. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2234. \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
  2235. \axowidth \axoscale btriangle
  2236. }}
  2237. }
  2238. %
  2239. \def\GTri(#1,#2)(#3,#4)(#5,#6)#7{
  2240. %
  2241. % Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
  2242. % The triangle is blanked out and then filled with gray 7
  2243. % (0 is black, 1 is white)
  2244. %
  2245. \put(\axoxoff,\axoyoff){\special{"#1 \axoxo add #2 \axoyo add #3
  2246. \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add #7
  2247. \axowidth \axoscale gtriangle
  2248. }}
  2249. }
  2250. %
  2251. \def\CTri(#1,#2)(#3,#4)(#5,#6)#7#8{
  2252. %
  2253. % Draws a triangle with the corners (x1,y1), (x2,y2), (x3,y3)
  2254. % The color of the box is #7, the background is #8
  2255. %
  2256. \put(\axoxoff,\axoyoff){\special{"#8 #1 \axoxo add #2 \axoyo add #3
  2257. \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
  2258. \axowidth \axoscale ctriangle1
  2259. }}
  2260. \put(\axoxoff,\axoyoff){\special{"#7 #1 \axoxo add #2 \axoyo add #3
  2261. \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add
  2262. \axowidth \axoscale ctriangle2
  2263. }}
  2264. }
  2265. %
  2266. \def\pfont{Times-Roman }
  2267. \def\fsize{10 }
  2268. %
  2269. \def\SetPFont#1#2{\def\pfont{#1 } \def\fsize{#2 }}
  2270. %
  2271. % Now some definitions to sort out the lt etc type of options in PText
  2272. %
  2273. \def\fmode{4 }
  2274. \def\@l@{l} \def\@r@{r} \def\@t@{t} \def\@b@{b}
  2275. \def\mymodetest#1{\ifx#1\end \let\next=\relax \else {
  2276. \if#1\@r@\global\def\fmodeh{1 }\fi
  2277. \if#1\@l@\global\def\fmodeh{-1 }\fi
  2278. \if#1\@b@\global\def\fmodev{3 }\fi
  2279. \if#1\@t@\global\def\fmodev{-3 }\fi
  2280. } \let\next=\mymodetest\fi \next}
  2281. %
  2282. \def\PText(#1,#2)(#3)[#4]#5{
  2283. %
  2284. % Draws a postscript text in a postscript font.
  2285. % Focal point is (1,2), rotation angle is 3, 4 is the mode (as in text)
  2286. % and 5 is the text.
  2287. %
  2288. \def\fmodev{0 }
  2289. \def\fmodeh{0 }
  2290. \mymodetest#4\end
  2291. \put(\axoxoff,\axoyoff){\makebox(0,0)[]{\special{"/\pfont findfont \fsize
  2292. scalefont setfont \axocolor #1 \axoxo add #2 \axoyo add #3
  2293. \fmode \fmodev add \fmodeh add \fsize (#5) \axoscale ptext }}}
  2294. }
  2295. %
  2296. \def\GOval(#1,#2)(#3,#4)(#5)#6{%
  2297. %
  2298. % Draws a gray oval that overwrites whatever was there.
  2299. % Oval(x_center,y_center)(height,width)(rotation)(color)
  2300. %
  2301. \put(\axoxoff,\axoyoff)%
  2302. {\special{"#1 \axoxo add #2 \axoyo add #3 #4 #5 #6
  2303. \axowidth \axoscale goval
  2304. }}%
  2305. }
  2306. %
  2307. \def\COval(#1,#2)(#3,#4)(#5)#6#7{%
  2308. %
  2309. % Draws a colored oval that overwrites whatever was there.
  2310. % Oval(x_center,y_center)(height,width)(rotation){color1}{color2}
  2311. %
  2312. \put(\axoxoff,\axoyoff)%
  2313. {\special{"#7 #1 \axoxo add #2 \axoyo add #3 #4 #5
  2314. \axowidth \axoscale coval1
  2315. }}%
  2316. \put(\axoxoff,\axoyoff)%
  2317. {\special{"#6 #1 \axoxo add #2 \axoyo add #3 #4 #5
  2318. \axowidth \axoscale coval2
  2319. }}%
  2320. }
  2321. %
  2322. \def\Oval(#1,#2)(#3,#4)(#5){%
  2323. %
  2324. % Draws an oval that does not overwrite whatever was there.
  2325. % Oval(x_center,y_center)(height,width)(rotation)
  2326. %
  2327. \put(\axoxoff,\axoyoff)%
  2328. {\special{"\axocolor #1 \axoxo add #2 \axoyo add #3 #4 #5
  2329. \axowidth \axoscale oval
  2330. }}%
  2331. }
  2332. %
  2333. \let\eind=]
  2334. \def\DashCurve#1#2{\put(\axoxoff,\axoyoff){\special{"\axocolor [ \kromme#1] #2
  2335. \axowidth \axoscale makedashcurve
  2336. }}}
  2337. \def\Curve#1{\put(\axoxoff,\axoyoff){\special{"\axocolor [ \kromme#1] \axowidth
  2338. \axoscale makecurve
  2339. }}}
  2340. \def\kromme(#1,#2)#3{#1 \axoxo add #2 \axoyo add \ifx #3\eind\else
  2341. \expandafter\kromme\fi#3}
  2342. %
  2343. \def\LogAxis(#1,#2)(#3,#4)(#5,#6,#7,#8){
  2344. %
  2345. % Draws a line with logarithmic hash marks along it.
  2346. % LogAxis(x1,y1)(x2,y2)(num_logs,hashsize,offset,width)
  2347. % The line is from (x1,y1) to (x2,y2) and the marks are on the left side
  2348. % when hashsize is positive, and right when it is negative.
  2349. % num_logs is the number of orders of magnitude and offset is the number
  2350. % at which one starts at (x1,y1) (like if offset=2 we start at 2)
  2351. % When offset is 0 we start at 1. Width is the linewidth.
  2352. %
  2353. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2354. \axoxo add #4 \axoyo add #5 #6 #7 #8 \axoscale logaxis
  2355. }}
  2356. }
  2357. %
  2358. \def\LinAxis(#1,#2)(#3,#4)(#5,#6,#7,#8,#9){
  2359. %
  2360. % Draws a line with linear hash marks along it.
  2361. % LinAxis(x1,y1)(x2,y2)(num_decs,per_dec,hashsize,offset,width)
  2362. % The line is from (x1,y1) to (x2,y2) and the marks are on the left side
  2363. % when hashsize is positive, and right when it is negative.
  2364. % num_decs is the number of accented marks, per_dec the number of
  2365. % divisions between them and offset is the number
  2366. % at which one starts at (x1,y1) (like if offset=2 we start at the second
  2367. % small mark) Width is the linewidth.
  2368. %
  2369. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2370. \axoxo add #4 \axoyo add #5 #6 #7 #8 #9 \axoscale linaxis
  2371. }}
  2372. }
  2373. %
  2374. %
  2375. \def\rText(#1,#2)[#3][#4]#5{
  2376. %
  2377. % Draws rotated text at (1,2). Argument 3 is l,r or c indicating whether
  2378. % the text is left adjusted, right adjusted or centered.
  2379. % 4 is the rotation angle and 5 is of course the text.
  2380. %
  2381. \ifnum\firstcall=1\global\def\firstcall{0}\rText(-10000,#2)[#3][]{#5}\fi
  2382. \dimen2=\axoxoff \unitlength
  2383. \dimen3=\axoyoff \unitlength
  2384. \advance\dimen2 by #1 \unitlength
  2385. \advance\dimen3 by #2 \unitlength
  2386. \@killglue\raise\dimen3\hbox to \z@{\kern\dimen2
  2387. \makebox(0,0)[#3]{
  2388. \ifx#4l{\setbox3=\hbox{#5}\rotl{3}}\else{
  2389. \ifx#4r{\setbox3=\hbox{#5}\rotr{3}}\else{
  2390. \ifx#4u{\setbox3=\hbox{#5}\rotu{3}}\else{#5}\fi}\fi}\fi}\hss}
  2391. \ignorespaces
  2392. }
  2393. %
  2394. \def\BText(#1,#2)#3{
  2395. %
  2396. % Draws a box with the center at (x1,y1) and postscript text in it.
  2397. %
  2398. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2399. scalefont setfont \axocolor #1 \axoxo add #2 \axoyo add (#3)
  2400. \fsize \axowidth \axoscale btext
  2401. }}
  2402. }
  2403. %
  2404. \def\GText(#1,#2)#3#4{
  2405. %
  2406. % Draws a box with the center at (x1,y1) and postscript(#4) text in it.
  2407. % The grayness of the box is given by #3
  2408. %
  2409. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2410. scalefont setfont #1 \axoxo add #2 \axoyo add #3 (#4)
  2411. \fsize \axowidth \axoscale gtext
  2412. }}
  2413. }
  2414. %
  2415. \def\CText(#1,#2)#3#4#5{
  2416. %
  2417. % Draws a box with the center at (x1,y1) and postscript(#5) text in it.
  2418. % The color of box and text is in #3
  2419. % The color of the background is in #4
  2420. %
  2421. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2422. scalefont setfont #4 #1 \axoxo add #2 \axoyo add (#5)
  2423. \fsize \axowidth \axoscale ctext1
  2424. }}
  2425. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2426. scalefont setfont #3 #1 \axoxo add #2 \axoyo add (#5)
  2427. \fsize \axowidth \axoscale ctext2
  2428. }}
  2429. }
  2430. %
  2431. \def\BTwoText(#1,#2)#3#4{
  2432. %
  2433. % Draws a box with the center at (x1,y1) and two lines of postscript
  2434. % text in it.
  2435. %
  2436. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2437. scalefont setfont \axocolor #1 \axoxo add #2 \axoyo add (#3) (#4)
  2438. \fsize \axowidth \axoscale b2text
  2439. }}
  2440. }
  2441. %
  2442. \def\GTwoText(#1,#2)#3#4#5{
  2443. %
  2444. % Draws a box with the center at (x1,y1) and two lines of postscript
  2445. % text (#4 and #5) in it.
  2446. % The grayness of the box is given by #3
  2447. %
  2448. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2449. scalefont setfont #1 \axoxo add #2 \axoyo add #3 (#4) (#5)
  2450. \fsize \axowidth \axoscale g2text
  2451. }}
  2452. }
  2453. %
  2454. \def\CTwoText(#1,#2)#3#4#5#6{
  2455. %
  2456. % Draws a box with the center at (x1,y1) and two lines of postscript
  2457. % text (#5 and #6) in it.
  2458. % The color of the box and the text is given by #3
  2459. % The background color is given by #4
  2460. %
  2461. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2462. scalefont setfont #4 #1 \axoxo add #2 \axoyo add (#5) (#6)
  2463. \fsize \axowidth \axoscale c2text1
  2464. }}
  2465. \put(\axoxoff,\axoyoff){\special{"/\pfont findfont \fsize
  2466. scalefont setfont #3 #1 \axoxo add #2 \axoyo add (#5) (#6)
  2467. \fsize \axowidth \axoscale c2text2
  2468. }}
  2469. }
  2470. \def\Bezier{
  2471. % \Bezier[opt](x1,y1)(x2,y2)(x3,y3)(x4,y4)
  2472. % Draws a Bezier cubic with the control points (x1,y1), (x2,y2), (x3,y3), (x4,y4)
  2473. % Supported options: dash, dashsize and dashsize
  2474. \AXO@Parse{\AXO@Bezier}{}%
  2475. }
  2476. \def\AXO@Bezier(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
  2477. % Draws a Bezier cubic with the control points (x1,y1), (x2,y2),
  2478. % (x3,y3), (x4,y4)
  2479. % Assumes options have been set
  2480. %
  2481. \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for Bezier curve}\fi
  2482. \ifAXO@double\AXO@NOTIMPLEMENTED{double line not implemented for Bezier curve}\fi
  2483. \put(\axoxoff,\axoyoff){\special{"\axocolor #1 \axoxo add #2 \axoyo add #3
  2484. \axoxo add #4 \axoyo add #5 \axoxo add #6 \axoyo add #7 \axoxo add #8
  2485. \axoyo add
  2486. \ifAXO@dash
  2487. \AXO@CurrentDashSize \space
  2488. \else
  2489. 0
  2490. \fi
  2491. \axowidth \axoscale
  2492. dashbezier
  2493. }}%
  2494. }
  2495. \def\DashBezier(#1,#2)(#3,#4)(#5,#6)(#7,#8)#9{%
  2496. %
  2497. % Draws a Bezier cubic with control points (x1,y1), (x2,y2),
  2498. % (x3,y3), (x4,y4) with a dash pattern of which the
  2499. % alternating black and white pieces are approximately #9 points long
  2500. %
  2501. \Bezier[dash,dashsize=#9](#1,#2)(#3,#4)(#5,#6)(#7,#8)%
  2502. }
  2503. %