%% xyknot.tex from $Id: xyknot.doc,v 3.3 1996/12/18 09:20:49 ross Exp $
%%
%% Xy-pic ``Knots and Links'' feature.
%% Copyright (c) 1994-1996 Ross Moore <ross@mpce.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-1996 Kristoffer H. Rose <krisrose@brics.dk>
%%
%% 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, write to the Free Software Foundation,
%% Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{knot}{Knots and Links feature}{\stripRCS$Revision: 3.3 $}%
 {Ross Moore}{ross@mpce.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
