summaryrefslogtreecommitdiff
path: root/macros/generic/diagrams/xypic/texinputs/xyknot.tex
blob: 4c5d7108edd4ff7f4ba3bb7ba240ad67b3e5ecc6 (plain)
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
%% xyknot.tex from $Id: xyknot.doc,v 3.9 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``Knots and Links'' feature.
%% Copyright (c) 1994-1996 Ross Moore <ross.moore@mq.edu.au>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-2011 Kristoffer H. Rose <krisrose@tug.org>
%%
%% The Xy-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The Xy-pic package 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 macro package; if not, see http://www.gnu.org/licenses/.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{knot}{Knots and Links feature}{\stripRCS$Revision: 3.9 $}%
 {Ross Moore}{ross.moore@mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\message{knots and links,}
\xyrequire{arrow}\xycatcodes 
\xydef@\xykparsecross@{%
 \def\xykSCALE@@{}\edef\xyknotPLACE{\xykmidPLACE@}%
 \let\xykparser@=\xykparsecross@@
 \def\xykdefaultbreak@{\let\xykbreak@=\xykforetemp@
 \def\xyknotPLACE{(.5)}\appendtoholder@}%
 \xyFN@\xykparsescale@ }
{\xyuncatcodes \catcode`@=11
\gdef\next{%
 \ifx\space@\next \expandafter\DN@\space{\xyFN@\xykparsecross@@}%
 \else\addLT@\ifx\next \addLT@\DN@{\xyprecross@}%
 \else\addGT@\ifx\next \addGT@\DN@{\xypostcross@}%
 \else\addEQ@\ifx\next \addEQ@\DN@{\xyFN@\xykparsetips@@}%
 \else\ifx|\next\DN@|{\xymidcross@}%
 \else\addAT@\ifx\next \addAT@\DN@(##1){%
 \xyadjustBREAK@i##1@@\xyFN@\xykparsecross@@}%
 \else\DN@{\afterknot@}%
 \fi\fi\fi\fi\fi\fi \next@ }}
\xylet@\xykparsecross@@=\next
\xydef@\xyprecross@{%
 \def\xykholder@{\xykprebreak@@}%
 \edef\xyknotPLACE{\xykprePLACE@}%
 \xyFN@\xykparsebreak@}
\xydef@\xypostcross@{%
 \def\xykholder@{\xykpostbreak@@}%
 \edef\xyknotPLACE{\xykpostPLACE@}%
 \xyFN@\xykparsebreak@}
\xydef@\xymidcross@{%
 \def\xykholder@{\xykmidbreak@@}%
 \edef\xyknotPLACE{\xykmidPLACE@}%
 \xyFN@\xykparsebreak@}
\xydef@\xykcross@#1{\xykcheckTIPS@
 \expandafter\toks@\expandafter{\expandafter#1\knotSTYLE}}
\xydef@\xykoverstring@{\addtotoks@{{}}\xykmidbreak@ \xyknottips@}
\xydef@\xykunderstring@{\xykprebreak@ \xykpostbreak@ \xyknottips@}
\xydef@\vcross{\begingroup\def\afterknot@{\xyvcross}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\hcross{\begingroup\def\afterknot@{\xyhcross}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\vcrossneg{\begingroup\def\afterknot@{\xyvcrossneg}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\hcrossneg{\begingroup\def\afterknot@{\xyhcrossneg}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\vuncross{\begingroup\def\afterknot@{\xyvuncross}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\huncross{\begingroup\def\afterknot@{\xyhuncross}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\xyvcross{\xykcross@\xykcrossv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhcross{\xykcross@\xykcrossh
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyvcrossneg{\xykcross@\xykcrossv
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhcrossneg{\xykcross@\xykcrossh
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyvuncross{\xykcross@\xykuncrossv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhuncross{\xykcross@\xykuncrossh
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<",{\xykz_\ar #1@'{"_<"**{}?(.25)@+,?+(.375,0)@+,
 "_>";"^>"**{}?-(.375,0)@+,?(.25)@+}"_>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"^<"**{}?(.25)@+,?+(.375,0)@+,
 "^>";"_>"**{}?-(.375,0)@+,?(.25)@+}"^>"#6#7#8}
 \restore\POS #9}}
\xylet@\xykcrossv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "_<",{\xykz_\ar #1@'{"_>"**{}?(.25)@+,?+(0,.375)@+,
 "^>";"^<"**{}?-(0,.375)@+,?(.25)@+}"^>"#3#4#5},
 "_>",{\xykz^\ar #2@'{"_<"**{}?(.25)@+,?+(0,.375)@+,
 "^<";"^>"**{}?-(0,.375)@+,?(.25)@+}"^<"#6#7#8}
 \restore\POS #9}}
\xylet@\xykcrossh=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<",{\xykz^\ar #1@'{"_<"**{}?(.25)@+,?(.375)+(.375,0)@+,
 "^>";"_>"**{}?(.375)-(.375,0)@+,?(.25)@+}"^>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"^<"**{}?(.25)@+,?(.375)+(.375,0)@+,
 "_>";"^>"**{}?(.375)-(.375,0)@+,?(.25)@+}"_>"#6#7#8}
 \restore\POS #9}}
\xylet@\xykuncrossv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "_<",{\xykz^\ar #1@'{"_>"**{}?(.25)@+,?(.375)+(0,.375)@+,
 "^<";"^>"**{}?(.375)-(0,.375)@+,?(.25)@+}"^<"#3#4#5},
 "_>",{\xykz^\ar #2@'{"_<"**{}?(.25)@+,?(.375)+(0,.375)@+,
 "^>";"^<"**{}?(.375)-(0,.375)@+,?(.25)@+}"^>"#6#7#8}
 \restore\POS #9}}
\xylet@\xykuncrossh=\next
\xydef@\vover{\begingroup\def\afterknot@{\xyvover}%
 \def\xykprePLACE@{(.2)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.8)}\def\xykpostbreak@@{|(.725)\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\hover{\begingroup\def\afterknot@{\xyhover}%
 \def\xykprePLACE@{(.2)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.8)}\def\xykpostbreak@@{|(.725)\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\vunder{\begingroup\def\afterknot@{\xyvunder}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.8)}%
 \def\xykmidPLACE@{(.2)}\def\xykpostbreak@@{|(.275)\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\hunder{\begingroup\def\afterknot@{\xyhunder}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.8)}%
 \def\xykmidPLACE@{(.2)}\def\xykpostbreak@@{|(.275)\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\vunover{\begingroup\def\afterknot@{\xyvunover}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.8)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\hunover{\begingroup\def\afterknot@{\xyhunover}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.8)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\xoverv{\begingroup\def\afterknot@{\xyxoverv}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.15)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\xunderv{\begingroup\def\afterknot@{\xyxunderv}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.15)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\xoverh{\begingroup\def\afterknot@{\xyxoverh}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.15)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\xunderh{\begingroup\def\afterknot@{\xyxunderh}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.85)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\xunover{\begingroup\def\afterknot@{\xyxunover}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.15)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\xunoverv{\begingroup\def\afterknot@{\xyxunoverv}%
 \def\xykprePLACE@{(.2)}\def\xykpostPLACE@{(.8)}%
 \def\xykmidPLACE@{(.2)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\xunoverh{\begingroup\def\afterknot@{\xyxunoverh}%
 \def\xykprePLACE@{(.2)}\def\xykpostPLACE@{(.8)}%
 \def\xykmidPLACE@{(.8)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\xyvover{\xykcross@\xykoverv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhover{\xykcross@\xykoverh
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyvunder{\xykcross@\xykoverv
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhunder{\xykcross@\xykoverh
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyvunover{\xykcross@\xykunoverv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhunover{\xykcross@\xykunoverh
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyxoverv{\xykcross@\xykxoverv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyxunderv{\xykcross@\xykxoverv
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyxoverh{\xykcross@\xykxoverh
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyxunderh{\xykcross@\xykxoverh
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyxunover{\xykcross@\xykxoverv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyxunoverv{\xykcross@\xykxunoverv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyxunoverh{\xykcross@\xykxunoverh
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<",{\xykz^\ar #1@'{"^>"**{}?(.25)@+,?(.625)+(0,-.125)@+,
 "_>";"^>"**{}?(.625)-(.125,0)@+,?(.25)@+}"_>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"^<"**{}?(.25)@+,?(.625)+(.125,0)@+,
 "^>";"^<"**{}?(.625)-(0,.125)@+,?(.25)@+}"^>"#6#7#8},\restore\POS#9}}
\xylet@\xykoverv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "_<",{\xykz^\ar #1@'{"^<"**{}?(.25)@+,?(.625)+(.125,0)@+,
 "^>";"^<"**{}?(.625)-(0,.125)@+,?(.25)@+}"^>"#3#4#5},
 "_>",{\xykz^\ar #2@'{"_<"**{}?(.25)@+,?(.625)+(0,.125)@+,
 "^<";"_<"**{}?(.625)+(.125,0)@+,?(.25)@+}"^<"#6#7#8},\restore\POS#9}}
\xylet@\xykoverh=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<",{\xykz^\ar #1@'{"^>"**{}?(.25)@+,?-(0,.175)@+,?(.75)@+}
 "^>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"^<"**{}?(.25)@+,?+(.125,0)@+,
 "_>"**{}?+(0,.7)@+,"_>";"^>"**{}?-(.125,0)@+,?(.25)@+}
 "_>"#6#7#8},\restore\POS#9}}
\xylet@\xykunoverv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "_<",{\xykz^\ar #1@'{"^<"**{}?(.25)@+,?+(.175,0)@+,?(.75)@+}
 "^<"#3#4#5},
 "_>",{\xykz^\ar #2@'{"_<"**{}?(.25)@+,?+(0,.125)@+,
 "^>"**{}?-(.7,0)@+,"^>";"^<"**{}?-(0,.125)@+,?(.25)@+}
 "^>"#6#7#8},\restore\POS#9}}
\xylet@\xykunoverh=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<";"^>"**{}?="^_","_<";"_>"**{}?;"^_",**{}?="^_",
 "^>",{\xykz^\ar #1@'{"^_"@+}"_<"#3#4#5},
 "^<",{\xykz_\ar #2@'{"^_"@+}"_>"#6#7#8},\restore\POS#9}}
\xylet@\xykxoverv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<";"_<"**{}?="^_","^>";"_>"**{}?;"^_",**{}?="^_",
 "^<",{\xykz_\ar #1@'{"^_"@+}"_>"#3#4#5},
 "_<",{\xykz_\ar #2@'{"^_"@+}"^>"#6#7#8},\restore\POS#9}}
\xylet@\xykxoverh=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<";"^>"**{}?="^_","_<";"_>"**{}?;"^_",**{}?="^_",
 "^>",{\xykz^\ar #1@'{"^_"@+}"_>"#3#4#5},
 "^<",{\xykz^\ar #2@'{"^_"@+}"_<"#6#7#8},\restore\POS#9}}
\xylet@\xykxunoverv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<";"_<"**{}?="^_","^>";"_>"**{}?;"^_",**{}?="^_",
 "^<",{\xykz^\ar #1@'{"^_"@+}"^>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"^_"@+}"_>"#6#7#8},
 \restore\POS#9}}
\xylet@\xykxunoverh=\next
\xydef@\vtwist{\begingroup\def\afterknot@{\xyvtwist}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\htwist{\begingroup\def\afterknot@{\xyhtwist}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\vtwistneg{\begingroup\def\afterknot@{\xyvtwistneg}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\htwistneg{\begingroup\def\afterknot@{\xyhtwistneg}%
 \def\xykprePLACE@{(.1)}\def\xykpostPLACE@{(.9)}%
 \def\xykmidPLACE@{(.9)}\def\xykpostbreak@@{|\knothole}%
 \xyFN@\xykparsecross@ }%
\xydef@\vuntwist{\begingroup\def\afterknot@{\xyvuntwist}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.85)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\huntwist{\begingroup\def\afterknot@{\xyhuntwist}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.85)}%
 \def\xykmidPLACE@{(.85)}\def\xykpostbreak@@{}%
 \xyFN@\xykparsecross@ }%
\xydef@\xyvtwist{\xykcross@\xyktwistv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyvtwistneg{\xykcross@\xyktwistv
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyvuntwist{\xykcross@\xykuntwistv
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(0,-1)}}
\xydef@\xyhtwist{\xykcross@\xyktwisth
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyhuntwist{\xykcross@\xykuntwisth
 \xykoverstring@ \xykunderstring@ \xykhvobject@{+(1,0)}}
\xydef@\xyhtwistneg{\xykcross@\xyktwisth
 \xykunderstring@ \xykoverstring@ \xykhvobject@{+(1,0)}}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^>",{\xykz_\ar #1@'{"_>"**{}?(.25)@+,?-(.375,0)@+,
 "_<";"^<"**{}?+(.375,0)@+,?(.25)@+}"_<"#3#4#5},
 "^<",{\xykz^\ar #2@'{"_<"**{}?(.25)@+,?+(.375,0)@+,
 "_>";"^>"**{}?+(-.375,0)@+,?(.25)@+}"_>"#6#7#8}
 \restore\POS #9}}
\xylet@\xyktwistv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^>",{\xykz^\ar #1@'{"_>"**{}?(.125)@+,?(.375)-(.25,0)@+,
 ?(.625)-(.25,0)@+,?(.875)@+}"_>"#3#4#5},
 "^<",{\xykz^\ar #2@'{"_<"**{}?(.125)@+,?(.375)+(.25,0)@+,
 ?(.625)+(.25,0)@+,?(.875)@+}"_<"#6#7#8}
 \restore\POS #9}}
\xylet@\xykuntwistv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<",{\xykz_\ar #1@'{"^>"**{}?(.25)@+,?+(0,-.375)@+,
 "_>";"_<"**{}?+(0,.375)@+,?(.25)@+}"_>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"_>"**{}?(.25)@+,?+(0,.375)@+,
 "^>";"^<"**{}?-(0,.375)@+,?(.25)@+}"^>"#6#7#8}
 \restore\POS #9}}
\xylet@\xyktwisth=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\save,
 "^<",{\xykz^\ar #1@'{"^>",**{}?(.125)@+,?(.375)+(0,-.25)@+,
 ?(.625)+(0,-.25)@+,?(.875)@+}"^>"#3#4#5},
 "_<",{\xykz^\ar #2@'{"_>",**{}?(.125)@+,?(.375)+(0,.25)@+,
 ?(.625)+(0,.25)@+,?(.875)@+}"_>"#6#7#8},\restore\POS #9}}
\xylet@\xykuntwisth=\next
\xydef@\xykparsescale@{%
 \ifx\space@\next \expandafter\DN@\space{\xyFN@\xykparsescale@}%
 \else\addDASH@\ifx\next \addDASH@\DN@{\def\xykSCALE@@{-1}%
 \xyFN@\xykparser@}%
 \else\ifx[\next \DN@[##1]{\dimen@=##1\p@
 \ifdim\dimen@=\z@\xywarning@{\xykscaleerror@}%
 \else\edef\xykSCALE@@{\expandafter\removePT@\the\dimen@}\fi
 \xyFN@\xykparser@}%
 \else\ifx~\next \DN@~##1##2##3##4{%
 \def\xykSCALE@@{@{##1}{##2}{##3}{##4}}\xyFN@\xykparser@}%
 \else\DN@{\xyFN@\xykparser@}%
 \fi\fi\fi\fi \next@}
\xydef@\xykscaleerror@{Ignoring zero scale factor}
\xydef@\xykhobject@{\aftergroup\xykhadjust@
 \ifx\xykSCALE@@\empty\DN@{\xykkeepscale@}%
 \else \DN@{\xyksavescale@{}}%
 \fi \next@ }
\xydef@\xykvobject@{\aftergroup\xykvadjust@
 \ifx\xykSCALE@@\empty\DN@{\xykkeepscale@}%
 \else \DN@{\xyksavescale@{}}%
 \fi \next@ }
\xydef@\xykhvobject@{\aftergroup\xykhvadjust@
 \ifx\xykSCALE@@\empty\DN@{\xykkeepscale@}%
 \else \DN@{\xyksavescale@{}}%
 \fi \next@ }
\xydef@\xykhuobject@{\aftergroup\xykhuadjust@
 \ifx\xykSCALE@@\empty\DN@{\xykkeepscale@}%
 \else \DN@{\xyksavescale@{}}%
 \fi \next@ }
\xydef@\xyksavescale@#1#2{%
 \expandafter\ifx\the\Edge@c\zeroEdge\relax \def\xyksaveEdgec{}%
 \else
 \edef\xyksaveEdgec{\noexpand\Edge@c={\expandafter\noexpand\the\Edge@c}%
 \L@c=\the\L@c \R@c=\the\R@c \D@c=\the\D@c \U@c=\the\U@c}%
 \fi
 \edef\next@##1##2{\endgroup
 \def\noexpand\xyksaveEdgec{}%
 \def\noexpand\xykSCALE@@\noexpand{##1}%
 \def\noexpand\xykjoincontrol\noexpand{\xykjoincontrol}%
 \noexpand\toks@\noexpand{##2}%
 \noexpand\xy@@{\def\noexpand\xyksaveEdgec{}%
 \def\noexpand\xykSCALE@@{##1}%
 \def\noexpand\xykjoincontrol{\xykjoincontrol}}}%
 \expandafter\expandafter\expandafter\next@
 \expandafter\expandafter\expandafter{\expandafter\xykSCALE@@\expandafter}%
 \expandafter{\the\toks@}%
 \xykrescale@ #1\the\toks@\restore\POS#2}
\xydef@\xykkeepscale@{%
 \edef\next@##1{\endgroup \noexpand\toks@={##1}%
 \def\noexpand\xykjoincontrol{\xykjoincontrol}}%
 \expandafter\next@\expandafter{\the\toks@}%
 \def\xykSCALE@@{}\def\xyksaveEdgec{}%
 \xy@@{\def\xykSCALE@@{}\def\xyksaveEdgec{}}%
 \edef\next@{\def\noexpand\xykjoincontrol{\xykjoincontrol}}%
 \expandafter\xy@@\expandafter{\next@}%
 \xyknoflexscale@ \the\toks@}
\xydef@\xykrescale@{\expandafter\xykcheckscale@\xykSCALE@@ !}%
\xydef@\xykcheckscale@#1#2!{%
 \expandafter\DN@\expandafter{\codeof{#1}}%
 \expandafter\DNii@\expandafter{\codeof{@}}%
 \ifx\next@\nextii@\relax\DN@{\xykflexiscale@#2%
 \xy@@{\divide\X@xbase2\divide\X@ybase2\divide\Y@xbase2\divide\Y@ybase2%
 \def\xykSCALE@@{}}\def\xykSCALE@@{}%
 \expandafter\toks@\expandafter{\afterFLEX@}}%
 \else\DN@{\save \xykrescale@@}\fi \next@ }
\xydef@\xykflexiscale@{%
 \expandafter\def\expandafter\afterFLEX@\expandafter{\the\toks@}%
 \xykflexiscale@@ }
\xydef@\xykrescale@@{%
 \edef\next@{\X@xbase=\xykSCALE@@\X@xbase \X@ybase=\xykSCALE@@\X@ybase
 \Y@xbase=\xykSCALE@@\Y@xbase \Y@ybase=\xykSCALE@@\Y@ybase}%
 \expandafter\xy@@\expandafter{\next@}%
 \ifdim\xykSCALE@@\p@<\z@\relax \DN@{\xyknegflexscale@}%
 \else\DN@{\xyknoflexscale@}\fi \next@ }
{\xyuncatcodes \gdef\next#1#2#3#4{\save="@",
 #1,="^<",\POS"@",#2,="^>",\POS"@",#3,="_<",\POS"@",#4,="_>",
 (0,0);"^>"-"^<"+"_>"-"_<":"^<"-"_<"+"^>"-"_>"::}}
\xylet@\xykflexiscale@@=\next
{\xyuncatcodes \gdef\next{\save ="^<",
 +(1,0)="^>",-(1,1)="_<",+(1,0)="_>"\restore }}
\xylet@\xyknoflexscale@@=\next
\xylet@\xyknoflexscale@=\next
{\xyuncatcodes \gdef\next{\save ="_>",
 +(-1,1)="^<",+(1,0)="^>",-(1,1)="_<"\restore }}
\xylet@\xyknegflexscale@@=\next
\xylet@\xyknegflexscale@=\next
{\xyuncatcodes \gdef\next{\save ="_<",
 +(1,0)="_>",+(-1,1)="^<",+(1,0)="^>"\restore }}
\xylet@\xykhscale@@=\next
{\xyuncatcodes \gdef\next{\save ="^>",
 -(1,0)="^<",+(1,-1)="_>",-(1,0)="_<"\restore }}
\xylet@\xykvscale@@=\next
\xydef@\xykhadjust@{%
 \let\xyknoflexscale@=\xykhscale@@
 \let\xyknegflexscale@=\xyknegflexscale@@ }
\xydef@\xykvadjust@{%
 \let\xyknoflexscale@=\xyknoflexscale@@
 \let\xyknegflexscale@=\xykhscale@@ }
\xydef@\xykhvadjust@{%
 \let\xyknoflexscale@=\xyknoflexscale@@
 \let\xyknegflexscale@=\xyknegflexscale@@ }
\xydef@\xykhuadjust@{%
 \let\xyknoflexscale@=\xykhscale@@
 \let\xyknegflexscale@=\xykvscale@@ }
\xydef@\xykprebreak@{%
 \ifx\xykprebreak@@\empty\addtotoks@{{}}\else
 \expandafter\addtotoks@\expandafter{\expandafter{\xykprebreak@@}}\fi}
\xydef@\xykpostbreak@{%
 \ifx\xykpostbreak@@\empty\addtotoks@{{}}\else
 \expandafter\addtotoks@\expandafter{\expandafter{\xykpostbreak@@}}\fi}
\xydef@\xykmidbreak@{%
 \ifx\xykmidbreak@@\empty\addtotoks@{{}}\else
 \expandafter\addtotoks@\expandafter{\expandafter{\xykmidbreak@@}}\fi}
\xydef@\xykparsebreak@{%
 \ifx\space@\next \expandafter\DN@\space{\xyFN@\xykparsebreak@}%
 \else \addLT@\ifx\next 
 \expandafter\appendtoholder@\xykbacktemp@\next@
 \addLT@\DN@{\xyFN@\xykparser@}%
 \else \addGT@\ifx\next 
 \expandafter\appendtoholder@\xykforetemp@\next@
 \addGT@\DN@{\xyFN@\xykparser@}%
 \else \ifx|\next
 \expandafter\appendtoholer@\xyknulltemp@\next@
 \DN@|{\xyFN@\xykparser@}%
 \else \ifx\next \bgroup\DN@##1{\checkgroupbreak@##1@}%
 \else \ifx (\next\DN@(##1){\xyadjustknotPLACE@i##1@@%
 \xyFN@\xykparsebreak@}%
 \else \ifx\next \knothole@\DN@##1{\expandafter\appendtoholder@@
 \expandafter{\expandafter|\xyknotPLACE\knothole}\next@
 \xyFN@\xykparser@}%
 \else 
 \expandafter\xykdefaultbreak@\xykbreak@\next@
 \DN@{\xyFN@\xykparser@}%
 \fi\fi\fi\fi\fi\fi\fi \next@ }
{\xyuncatcodes \gdef\next{^>*\dir{>}}}
\xylet@\xykforetips@=\next
{\xyuncatcodes \gdef\next{^<*\dir{<}}}
\xylet@\xykbacktips@=\next
{\xyuncatcodes \gdef\next{*!/-1pt/=0\dir{>}}}
\xylet@\xykforetemp@=\next
{\xyuncatcodes \gdef\next{*!/1pt/=0\dir{<}}}
\xylet@\xykbacktemp@=\next
{\xyuncatcodes \gdef\next{*=<\xykholesize>[o]{}}}
\xylet@\xykholetemp@=\next
\xydef@\knothole@{\hbox to\xykholesize{%
 \dimen@=\xykholesize \divide\dimen@\tw@
 \hfill \vrule height\dimen@ depth\dimen@ width\z@ }}
\xylet@\knothole=\knothole@
\xylet@\khole=\knothole@
{\xyuncatcodes \gdef\next{*=<0pt>{}}}
\xylet@\xyknulltemp@=\next
\xylet@\xykbreak@=\xyknulltemp@
\xydef@\checkgroupbreak@#1#2@{%
 \ifx|#1\DN@{\appendtoholder@@#1#2\next@ \xyFN@\xykparser@}%
 \else \ifx_#1\DN@{\appendtoholder@@_#2\next@ \xyFN@\xykparser@}%
 \else \ifx^#1\DN@{\appendtoholder@@^#2\next@ \xyFN@\xykparser@}%
 \else 
 \def\next##1\next{\expandafter\DNii@\expandafter{\xyk@@##1}}%
 \expandafter\next\xyknotPLACE\next
 \ifx*#1%
 \expandafter\DN@\expandafter{%
 \expandafter\appendtoholder@@\nextii@#1#2\next@ \xyFN@\xykparser@}%
 \else
 \expandafter\DN@\expandafter{%
 \expandafter\appendtoholder@@\nextii@{#1#2}\next@ \xyFN@\xykparser@}%
 \fi\fi\fi\fi \next@ }
{\xyuncatcodes \gdef\next{%
 \expandafter{\expandafter^\xyknotPLACE##1}}}%
 \DN@{\xydef@\xykholder@@##1}\DNii@{\expandafter\toks@}%
 \expandafter\expandafter\expandafter\next@
 \expandafter\expandafter\expandafter{\expandafter\nextii@\next}
\xydef@\appendtoholder@#1\next@{\xykholder@@{#1}%
 \DN@##1{\expandafter\DN@\expandafter{\xykholder@##1}}%
 \expandafter\next@\expandafter{\the\toks@}\appendtoholder@@@ }
\xydef@\appendtoholder@@#1\next@{%
 \DN@##1\next@{\expandafter\DN@\expandafter{\xykholder@##1}}%
 \next@#1\next@ \appendtoholder@@@}%
\xydef@\appendtoholder@@@{%
 \expandafter\expandafter\expandafter\DN@
 \expandafter\expandafter\expandafter{\next@}%
 \DNii@{\expandafter\def\xykholder@}%
 \expandafter\nextii@\expandafter{\next@}}
{\xyuncatcodes \gdef\next{%
 \expandafter{\expandafter|\xyknotPLACE##1}}}%
\DN@{\xydef@\xykholer@@##1}\DNii@{\expandafter\toks@}%
 \expandafter\expandafter\expandafter\next@
 \expandafter\expandafter\expandafter{\expandafter\nextii@\next}
\xydef@\appendtoholer@#1\next@{\xykholer@@{#1}%
 \DN@##1{\expandafter\DN@\expandafter{\xykholder@##1}}%
 \expandafter\next@\expandafter{\the\toks@}\appendtoholder@@@ }
\xydef@\xykz#1{\let\xyk@@=#1\xy@@{\let\xyk@@=#1}}
{\xyuncatcodes \global\let\next=_}
\xylet@\xyk@@=\next
\xydef@\xyadjustknotPLACE@i{%
 \ifx\xyknotPLACE\empty\DN@{\dimen@=.5\p@}%
 \else\DN@{\expandafter\xygetknotPLACE@@\xyknotPLACE}%
 \fi \next@ \relax \let\xywhichknotPLACE@@=\xysetknotPLACE@@
 \xyFN@\xyadjustknotPLACE@}
\xydef@\xyadjustknotPLACE@{\expandafter\ifx\space@\next
 \expandafter\DN@\space{\xyFN@\xyadjustknotPLACE@}%
 \else\addDASH@\ifx\next\DN@{\xyadjustknotPLACE@@}%
 \else\addPLUS@\ifx\next\DN@{\xyadjustknotPLACE@@}%
 \else\addEQ@\ifx\next\addEQ@\DN@{\dimen@=\z@ \xyadjustknotPLACE@@}%
 \else \DN@{\dimen@=\z@ \xyadjustknotPLACE@@}%
 \fi\fi\fi\fi \next@}
\xydef@\xyadjustknotPLACE@@#1@@{\advance\dimen@#1\p@
 \expandafter\xysetknotPLACE@\expandafter{\the\dimen@}}
\xydef@\xysetknotPLACE@#1{%
 \expandafter\xywhichknotPLACE@@\expandafter{\removePT@#1}}
{\xyuncatcodes\gdef\next#1{\def\xyknotPLACE{(#1)}}}%
\xylet@\xysetknotPLACE@@=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next(#1){\DN@\next@{#1}\ifx\next@\empty
 \dimen@=\z@\else\dimen@=#1\p@ \fi}}%
\xylet@\xygetknotPLACE@@=\next 
\xydef@\xyadjustJOIN@i{%
 \ifx\xykjoincontrol\empty\DN@{\dimen@=.75\p@}%
 \else\DN@{\expandafter\xygetknotPLACE@@\expandafter(\xykjoincontrol)}%
 \fi \next@ \relax \let\xywhichknotPLACE@@=\xysetjoincontrol@
 \xyFN@\xyadjustknotPLACE@}
\xydef@\xyadjustBREAK@i{%
 \ifx\xykpostbreak@@\empty\DN@{\dimen@=.5\p@}%
 \else\DN@{\expandafter\xygetpostBREAK@\xykpostbreak@@}%
 \fi \next@ \relax \let\xywhichknotPLACE@@=\xysetpostbreak@
 \xyFN@\xyadjustknotPLACE@}
\xydef@\xygetpostBREAK@|#1\knothole{\DN@{#1}%
 \ifx\next@\empty\dimen@=.5\p@\else \xygetknotPLACE@@#1\fi}
\xydef@\xysetpostbreak@#1{\def\xykpostbreak@@{|(#1)\knothole}}
\xydef@\xysetjoincontrol@#1{\edef\xykjoincontrol{#1}}
\xydef@\xykparsetips@{%
 \def\xyknotTIPS@@{}\def\xyknotPLACE{}%
 \let\xykparser@=\xykparsetips@@
 \xyFN@\xykparser@ }
\xydef@\xykparsetips@@{%
 \ifx\space@\next \expandafter\DN@\space{\xyFN@\xykparsetips@@}%
 \else\addLT@\ifx\next
 \ifx\xyknotTIPS@@\empty \def\xyknotTIPS@@{TF}%
 \else\DN@{FF}\ifx\next@\xyknotTIPS@@ \def\xyknotTIPS@@{TF}%
 \else\DN@{FT}\ifx\next@\xyknotTIPS@@ \def\xyknotTIPS@@{TT}%
 \fi\fi\fi
 \addLT@\DN@{\xyFN@\xykparser@}%
 \else\addGT@\ifx\next
 \ifx\xyknotTIPS@@\empty \def\xyknotTIPS@@{FT}%
 \else\DN@{FF}\ifx\next@\xyknotTIPS@@ \def\xyknotTIPS@@{FT}%
 \else\DN@{TF}\ifx\next@\xyknotTIPS@@ \def\xyknotTIPS@@{TT}%
 \fi\fi\fi
 \addGT@\DN@{\xyFN@\xykparser@}%
 \else\addEQ@\ifx\next \def\xyknotTIPS@@{TT}%
 \addEQ@\DN@{\xyFN@\xykparser@}%
 \else \ifx!\next \def\xyknotTIPS@@{FF}\DN@!{\xyFN@\xykparser@}%
 \else\DN@{\xyFN@\xykparser@}%
 \fi\fi\fi\fi\fi \next@ }
\xydef@\xykcheckTIPS@{%
 \ifx\xyknotTIPS@@\empty \edef\xyknotTIPS@@{\xyknotTIPS@}\fi
 \DN@{FF}\ifx\next@\xyknotTIPS@@\def\tmp@{}%
 \else\DN@{FT}\ifx\next@\xyknotTIPS@@
 \expandafter\def\expandafter\tmp@\expandafter{\xykforetips@}%
 \else\DN@{TF}\ifx\next@\xyknotTIPS@@
 \expandafter\def\expandafter\tmp@\expandafter{\xykbacktips@}%
 \else 
 \DN@##1\next@{\DN@{\xykforetips@##1}}%
 \expandafter\next@\xykbacktips@\next@
 \DNii@{\expandafter\def\expandafter\tmp@\expandafter}%
 \expandafter\nextii@\expandafter{\next@}%
 \fi\fi\fi \def\xyknotTIPS@@{}}
\xydef@\xyknottips@{%
 \ifx\tmp@\empty\addtotoks@{{}}\else
 \expandafter\addtotoks@\expandafter{\expandafter{\tmp@}}\fi}
\xydef@\xykparsejoin@{%
 \def\xykSCALE@@{}%
 \edef\xyknotPLACE{\xykmidPLACE@}%
 \let\xykparser@=\xykparsejoin@@
 \def\xykdefaultbreak@{\let\xykbreak@=\xykforetemp@
 \def\xyknotPLACE{(.5)}\appendtoholder@}%
 \xyFN@\xykparsescale@ }
{\xyuncatcodes \catcode`@=11
\gdef\next{%
 \ifx\space@\next \expandafter\DN@\space{\xyFN@\xykparsejoin@@}%
 \else\addLT@\ifx\next \let\xykbreak@=\xykbacktemp@
 \def\xykdefaultbreak@{\def\xyknotPLACE{(.5)}%
 \appendtoholder@}\addLT@\DN@{\xyprecross@}%
 \else\addGT@\ifx\next \let\xykbreak@=\xykforetemp@
 \def\xykdefaultbreak@{\def\xyknotPLACE{(.5)}%
 \appendtoholder@}\addGT@\DN@{\xypostcross@}%
 \else\ifx|\next \let\xykbreak@=\xyknulltemp@
 \def\xykdefaultbreak@{\def\xyknotPLACE{(.5)}%
 \appendtoholer@}\DN@|{\xymidcross@}%
 \else\addEQ@\ifx\next \addEQ@\DN@{\xyFN@\xykparsetips@@}%
 \else\addAT@\ifx\next \addAT@\DN@(##1){%
 \xyadjustJOIN@i##1@@\xyFN@\xykparsejoin@@}%
 \else\DN@{\afterknot@}%
 \fi\fi\fi\fi\fi\fi \next@ }}
\xylet@\xykparsejoin@@=\next
\xydef@\xykjoincontrol@@{.75}%
\xydef@\xyk@joincontrol@#1{\DN@{#1}%
 \ifx\next@\empty\edef\xykjoincontrol@@{.75}%
 \else\dimen@=#1\p@
 \edef\xykjoincontrol@@{\expandafter\removePT@\the\dimen@}\fi}
\xylet@\xykjoincontrol\empty
\xydef@\xykjoincontrol@(#1){\DN@{#1}%
 \ifx\next@\empty\edef\xykjoincontrol{\xykjoincontrol@@}%
 \else\dimen@=#1\p@
 \edef\xykjoincontrol{\expandafter\removePT@\the\dimen@}%
 \fi \xyFN@\xykparsejoin@@ }
\xydef@\xykjoincontrol@i#1{\DN@{#1}%
 \ifx\next@\empty\edef\xykjoincontrol{\xykjoincontrol@@}%
 \else\dimen@=#1\p@
 \edef\xykjoincontrol{\expandafter\removePT@\the\dimen@}\fi}
\xydef@\xykjoin@#1{%
 \expandafter\toks@\expandafter{\expandafter#1\knotSTYLE}}
\xydef@\xyksetjoin@{\xykcheckTIPS@ 
 \xykprebreak@ \xykmidbreak@ \xykpostbreak@ \xyknottips@ }
\xydef@\hcap{\begingroup\def\afterknot@{\xyhcap}%
 \def\xykprePLACE@{(.385)}\def\xykpostPLACE@{(.615)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.25}%
 \xyFN@\xykparsejoin@ }%
\xydef@\vcap{\begingroup\def\afterknot@{\xyvcap}%
 \def\xykprePLACE@{(.385)}\def\xykpostPLACE@{(.615)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.25}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xcapv{\begingroup\def\afterknot@{\xyxcapv}%
 \def\xykprePLACE@{(.2)}\def\xykpostPLACE@{(.8)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.5}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xcaph{\begingroup\def\afterknot@{\xyxcaph}%
 \def\xykprePLACE@{(.2)}\def\xykpostPLACE@{(.8)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.5}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xyvcap{\xykjoin@\xykcapv \xyksetjoin@ \xykhobject@{}}
\xydef@\xyhcap{\xykjoin@\xykcaph \xyksetjoin@ \xykvobject@{}}
\xydef@\xyxcapv{\xykjoin@\xykxcapv \xyksetjoin@ \xykvobject@{+(0,-1)}}
\xydef@\xyxcaph{\xykjoin@\xykxcaph \xyksetjoin@ \xykhobject@{+(1,0)}}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_>",{\xyksaveEdgec},{\xykz_\ar #1@'{"^>"**{}?(\xykjoincontrol)@+
 ,?-(.25,0)@+,"_<";"^<"**{}?+(.25,0)@+,?(\xykjoincontrol)@+}
 "_<"#3#4#5#6},\restore \POS#7}}
\xylet@\xykcapv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_<",{\xyksaveEdgec},{\xykz_\ar #1@'{"_>"**{}?(\xykjoincontrol)@+,
 ?+(0,.25)@+,"^<";"^>"**{}?-(0,.25)@+,?(\xykjoincontrol)@+}
 "^<"#3#4#5#6}
 \restore \POS#7}}
\xylet@\xykcaph=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^>";"_>"**{}?="^_","^<";"_<"**{}?;"^_",**{}?(\xykjoincontrol)="^_",
 "_<",{\xyksaveEdgec},{\xykz_\ar #1@'{"^_"@+}
 "^<"#3#4#5#6},\restore \POS#7}}
\xylet@\xykxcapv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^<";"^>"**{}?="^_","_<";"_>"**{}?;"^_",**{}?(\xykjoincontrol)="^_",
 "_>",{\xyksaveEdgec},{\xykz_\ar #1@'{"^_"@+}
 "_<"#3#4#5#6},\restore \POS#7}}
\xylet@\xykxcaph=\next
\xydef@\hloop{\begingroup\def\afterknot@{\xyhloop}%
 \def\xykprePLACE@{(.07)}\def\xykpostPLACE@{(.93)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.75}%
 \xyFN@\xykparsejoin@ }%
\xydef@\vloop{\begingroup\def\afterknot@{\xyvloop}%
 \def\xykprePLACE@{(.07)}\def\xykpostPLACE@{(.93)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.75}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xyvloop{\xykjoin@\xykloopv \xyksetjoin@ \xykhobject@{}}
\xydef@\xyhloop{\xykjoin@\xyklooph \xyksetjoin@ \xykvobject@{}}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_>",{\xykz_\ar #1@'{"^>"**{}?(\xykjoincontrol)@+,?(1.25)-(.25,0)@+,
 "_<";"^<"**{}?(1.25)+(.25,0)@+,?(\xykjoincontrol)@+}"_<"#3#4#5#6}
 \restore \POS#7}}
\xylet@\xykloopv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_<",{\xykz_\ar #1@'{"_>"**{}?(\xykjoincontrol)@+,?(1.25)+(0,.25)@+,
 "^<";"^>"**{}?(1.25)+(0,-.25)@+,?(\xykjoincontrol)@+}"^<"#3#4#5#6}
 \restore \POS#7}}
\xylet@\xyklooph=\next
\xydef@\zbendh{\begingroup\def\afterknot@{\xyzbendh}%
 \def\xykprePLACE@{(.25)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{\xykjoincontrol@@}%
 \xyFN@\xykparsejoin@ }%
\xydef@\sbendv{\begingroup\def\afterknot@{\xysbendv}%
 \def\xykprePLACE@{(.25)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{\xykjoincontrol@@}%
 \xyFN@\xykparsejoin@ }%
\xydef@\sbendh{\begingroup\def\afterknot@{\xysbendh}%
 \def\xykprePLACE@{(.25)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{\xykjoincontrol@@}%
 \xyFN@\xykparsejoin@ }%
\xydef@\zbendv{\begingroup\def\afterknot@{\xyzbendv}%
 \def\xykprePLACE@{(.25)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{\xykjoincontrol@@}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xbendr{\begingroup\def\afterknot@{\xyxbendr}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.5}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xbendl{\begingroup\def\afterknot@{\xyxbendl}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.5}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xbendu{\begingroup\def\afterknot@{\xyxbendu}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.5}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xbendd{\begingroup\def\afterknot@{\xyxbendd}%
 \def\xykprePLACE@{(.15)}\def\xykpostPLACE@{(.75)}%
 \def\xykmidPLACE@{(.5)}\edef\xykjoincontrol{.5}%
 \xyFN@\xykparsejoin@ }%
\xydef@\xyzbendh{\xykjoin@\xykzbendh \xyksetjoin@ \xykhvobject@{+(1,-1)}}
\xydef@\xysbendv{\xykjoin@\xyksbendv \xyksetjoin@ \xykhvobject@{+(1,-1)}}
\xydef@\xysbendh{\xykjoin@\xyksbendh \xyksetjoin@ \xykhuobject@{+(1,1)}}
\xydef@\xyzbendv{\xykjoin@\xykzbendv \xyksetjoin@ \xykhuobject@{+(1,1)}}
\xydef@\xyxbendr{\xykjoin@\xykxbendr \xyksetjoin@ \xykhvobject@{+(1,-1)}}
\xydef@\xyxbendl{\xykjoin@\xykxbendl \xyksetjoin@ \xykhvobject@{+(0,-1)}}
\xydef@\xyxbendu{\xykjoin@\xykxbendu \xyksetjoin@ \xykhvobject@{+(1,0)}}
\xydef@\xyxbendd{\xykjoin@\xykxbendd \xyksetjoin@ \xykhvobject@{+(1,-1)}}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^<",{\xyksaveEdgec},
 {\xykz^\ar #1@'{"^>"**{}?(\xykjoincontrol)@+,
 "_>";"_<"**{}?(\xykjoincontrol)@+}"_>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xykzbendh=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^<",{\xyksaveEdgec},
 {\xykz_\ar #1@'{"_<"**{}?(\xykjoincontrol)@+,
 "_>";"^>"**{}?(\xykjoincontrol)@+}"_>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xyksbendv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_<",{\xyksaveEdgec},
 {\xykz_\ar #1@'{"_>"**{}?(\xykjoincontrol)@+,
 "^>";"^<"**{}?(\xykjoincontrol)@+}"^>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xyksbendh=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_<",{\xyksaveEdgec},
 {\xykz^\ar #1@'{"^<"**{}?(\xykjoincontrol)@+,
 "^>";"_>"**{}?(\xykjoincontrol)@+}"^>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xykzbendv=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^<"-(0,.5),{\xyksaveEdgec},
 {\xykz_\ar #1@'{"_<";"_>"**{}?(\xykjoincontrol)@+,}"_>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xykxbendr=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^>"-(0,.5),{\xyksaveEdgec},
 {\xykz^\ar #1@'{"_>";"_<"**{}?(\xykjoincontrol)@+,}"_<"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xykxbendl=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "_<"+(.5,0),{\xyksaveEdgec},
 {\xykz_\ar #1@'{"_>";"^>"**{}?(\xykjoincontrol)@+,}"^>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xykxbendu=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\save,
 "^<"+(.5,0),{\xyksaveEdgec},
 {\xykz^\ar #1@'{"^>";"_>"**{}?(\xykjoincontrol)@+,}"_>"#3#4#5#6}%
 \restore \POS#7}}
\xylet@\xykxbendd=\next
{\xyuncatcodes \gdef\next{{@{-}}{@{-}}}}
\xylet@\knotSTYLE=\next 
{\xyuncatcodes \gdef\next#1{\def\knotSTYLE{{@{#1}}{@{#1}}}}}
\xylet@\knotstyle=\next 
{\xyuncatcodes \gdef\next#1#2{\def\knotSTYLE{{@{#1}}{@{#2}}}}}
\xylet@\knotstyles=\next 
{\xyuncatcodes \gdef\next#1{\def\knotSTYLE{#1}}}
\xylet@\KNOTstyle=\next 
\xydef@\knotholesize@#1{\def\xykholesize{#1}}
\xydef@\xykholesize{5pt}
\xylet@\knotholesize=\knotholesize@
\xylet@\holesize=\knotholesize@
\xydef@\knottips#1{\def\xyknotTIPS@{#1}}
\xydef@\xyknotTIPS@{FF}
\xydef@\xyknotTIPS@@{}
\xydef@\xykSCALE@@{}
\xydef@\xykprebreak@@{}%
\xydef@\xykpostbreak@@{}%
\xydef@\xykmidbreak@@{}%
\xydef@\xykprePLACE@{(.25)}%
\xydef@\xykpostPLACE@{(.75)}%
\xydef@\xykmidPLACE@{}%
\xylet@\xykPLACE@=\xykmidPLACE@
{\gdef\next#1#2#3#4{%
 \save(0,0);"#2"-"#1"+"#4"-"#3":(.5,0):
 "#3"-"#1"+"#4"-"#2"::(0,.5)::}}
\xylet@\xykflexbase@=\next
\xylet@\xykflexbase=\xykflexbase@
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8{\xykflexbase{#1}{#2}{#3}{#4}%
 "#1",{\ar @{#5}@'{"#1"+(0,.125)@++(.1875,.125)@+,
 "#4"-(.1875,.25)@++(.1875,.125)@+}"#4" #6},
 "#2",{\ar @{#5}@'{"#2"+(0,.125)@++(-.1875,.125)@+,
 "#3"+(.1875,-.25)@++(-.1875,.125)@+}"#3" #7}%
\restore \POS#8}}
\xylet@\Xtwist=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8{\xykflexbase{#1}{#2}{#3}{#4}%
 "#1",{\ar @{#5}@'{"#1"+(0,.0625)@++(.1875,.0625)@+,
 "#3"+(.1875,-.125)@++(-.1875,.0625)@+}"#3" #6},
 "#2",{\ar @{#5}@'{"#2"+(0,.0625)@++(-.1875,.0625)@+,
 "#4"-(.1875,.125)@++(.1875,.0625)@+}"#4" #7}%
\restore \POS#8}}
\xylet@\Xuntwist=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\xykflexbase{#1}{#2}{#3}{#4}%
 "#1",{\ar @{#5}@'{"#1"+(.1875,.0625)@++(.1875,.1875)@+,
 "#4"+(-#9,-.125)@+}"#4" #6},
 "#2",{\ar @{#5}@'{"#2"+(-.1875,.0625)@++(-.1875,.1875)@+,
 "#3"+(#9,-.125)@+}"#3" #7}%
\restore \POS#8}}
\xylet@\Xover=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{\xykflexbase{#1}{#2}{#3}{#4}%
 "#1",{\ar @{#5}@'{"#1"+(.1875,.0625)@++(.1875,.1875)@+,
 "#2"+(-.1875,.0625)@+}"#2" #6},
 "#3",{\ar @{#5}@'{"#3"+(#9,-.125)@+,"#3"+(.25,-.25)@+,
 "#4"+(-#9,-.125)@+}"#4" #7}%
\restore \POS#8}}
\xylet@\Xunover=\next
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7{\xykflexbase{#1}{#2}{#3}{#4}%
 "#1",{\ar @{#5}@'{"#1"+(0,.125)@++(.125,.25)@+,
 "#4"+(-.125,.375)@++(.125,-.25)@+}"#4" #6},
\restore \POS#7}}
\xylet@\Xcap=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next#1#2#3#4#5#6#7#8#9{\dimen@=#1\p@
 \ifdim\dimen@=\z@ \DN@{\Xunover{#2}{#3}{#4}{#5}{#8}{#6}{#7}{"#5"}}%
 \else\ifdim\dimen@>\z@
 \DNii@{#6}\ifx\nextii@\empty
 \DN@{\Xover{#2}{#3}{#4}{#5}{#8}{|(.45)\knothole}{#7}{"#5"}}%
 \else \DN@{\Xover{#2}{#3}{#4}{#5}{#8}{#6}{#7}{"#5"}}\fi
 \else
 \DNii@{#7}\ifx\nextii@\empty
 \DN@{\Xover{#2}{#3}{#4}{#5}{#8}{#6}{|(.45)\knothole}{"#5"}}%
 \else\DN@{\Xover{#2}{#3}{#4}{#5}{#8}{#6}{#7}{"#5"}}\fi
 \fi\fi 
 \def\tmp@{{#9}}\ifx\tmp@\empty\def\tmp@{{0}}\else\dimen@=#9\p@\fi
 \expandafter\next@\tmp@ }}
\xylet@\XXover=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next#1#2#3#4#5#6#7#8{\dimen@=#1\p@
 \ifdim\dimen@=\z@ \DN@{\Xuntwist{#2}{#4}{#3}{#5}{#8}{#6}{#7}{"#5"}}%
 \else\ifdim\dimen@>\z@
 \DNii@{#6}\ifx\nextii@\empty
 \DN@{\Xtwist{#2}{#4}{#3}{#5}{#8}{|(.45)\knothole}{#7}{"#5"}}%
 \else \DN@{\Xtwist{#2}{#4}{#3}{#5}{#8}{#6}{#7}{"#5"}}\fi
 \else
 \DNii@{#7}\ifx\nextii@\empty
 \DN@{\Xtwist{#2}{#4}{#3}{#5}{#8}{#6}{|(.45)\knothole}{"#5"}}%
 \else\DN@{\Xtwist{#2}{#4}{#3}{#5}{#8}{#6}{#7}{"#5"}}\fi
 \fi\fi \next@ }}
\xylet@\XXtwist=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next#1#2#3#4{\dimen@=#1\p@
 \ifdim\dimen@=\z@ \DN@{\xykuncrossv{#4}{#2}{#3}{+(0,-1)}}%
 \else\ifdim\dimen@>\z@
 \DNii@{#2}\ifx\nextii@\empty
 \DN@{\xyktwistv{#4}{|\knothole}{#3}{+(1,0)}}%
 \else \DN@{\xyktwistv{#4}{#2}{#3}{+(1,0)}}\fi
 \else
 \DNii@{#3}\ifx\nextii@\empty
 \DN@{\xyktwistv{#4}{#2}{|\knothole}{+(0,-1)}}%
 \else\DN@{\xyktwistv{#4}{#2}{#3}{+(0,-1)}}\fi
 \fi\fi \next@ }}
\xylet@\Vcross=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next#1#2#3#4{\dimen@=#1\p@
 \ifdim\dimen@=\z@ \DN@{\xykuncrossh{#4}{#2}{#3}{+(0,-1)}}%
 \else\ifdim\dimen@<\z@
 \DNii@{#2}\ifx\nextii@\empty
 \DN@{\xyktwisth{#4}{|\knothole}{#3}{+(1,0)}}%
 \else \DN@{\xyktwisth{#4}{#2}{#3}{+(1,0)}}\fi
 \else
 \DNii@{#3}\ifx\nextii@\empty
 \DN@{\xyktwisth{#4}{}{|\knothole}{+(1,0)}}%
 \else\DN@{\xyktwisth{#4}{#2}{#3}{+(1,0)}}\fi
 \fi\fi \next@ }}
\xylet@\Hcross=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next#1#2#3{\dimen@=#1\p@ \save
 \ifdim\dimen@<\z@
 \DN@{\POS="@",p="@@",(0,0);(-1,0):(0,-1)::"@@";"@",}%
 \else\DN@{}\fi
 \next@ \xykcaph{#3}{#2}\restore }}
\xylet@\Hcap=\next
{\xyuncatcodes \catcode`@=11
 \gdef\next#1#2#3{\dimen@=#1\p@ \save
 \ifdim\dimen@<\z@
 \DN@{\POS="@",p="@@",(0,0);(0,-1)::"@@";"@",}%
 \else\DN@{}\fi
 \next@ \xykcapv{#3}{#2}\restore }}
\xylet@\Vcap=\next
\xyendinput