% a manual is available from       http://www.math.ksu.edu/~lub/
% \usepackage[emtex]{t-angles}  % for emtex drivers, dviwin and dvips or
% \usepackage{t-angles} = \usepackage[TPIC]{t-angles}
%                       % for TPIC drivers such as dviwin, xdvi, dvips
% \usepackage[kluwer]{t-angles} or \usepackage[emtex,kluwer]{t-angles}
%                       % to use with kluwer.cls

     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     %                                                                 %
     %    This is file    t-angles.sty    ( version 10.09.00 )         %
     %                                                                 %
     %    Diagrammatic macros for tangles and braided Hopf algebras    %
     %                                                                 %
     %                 (Yu. Bespalov, V. Lyubashenko)                  %
     %                                                                 %
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcount{\hstretch} \hstretch 100
\newcount{\vstretch} \vstretch 100
\newlength{\unitlens} \unitlens 10pt
\def\FillCircDiam{3}

\DeclareOption{emtex}{%
\gdef\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc
  \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth
        \special{em:linewidth \the\@wholewidth}}    %\@wholewidth=0.4pt
\gdef\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
  \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth
        \special{em:linewidth \the\@wholewidth}}    %\@wholewidth=0.8pt
\def\emline#1#2#3#4#5#6{%
       \put(#1,#2){\special{em:moveto}}%
       \put(#4,#5){\special{em:lineto}}}%
\def\drawpath#1#2#3#4{\emline{#1}{#2}1{#3}{#4}2} % graphics for *.lp
}
%
\newcount\@gphlinewidth
%
\DeclareOption{TPIC}{%
\@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736
        \advance\@gphlinewidth\@ne      %\@gphlinewidth=6
\gdef\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc
  \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth
        \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736
        \advance\@gphlinewidth\@ne}     %\@gphlinewidth=6
\gdef\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
  \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth
        \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736}
                                        %\@gphlinewidth=11
\def\@paspecial#1#2{%
    \special{pa #1 #2}}
\def\path(#1,#2){%
    \special{pn \the\@gphlinewidth}%
    \@path(#1,#2)}
\def\@path(#1,#2){%
    \@tempdima #1\unitlength
    \@tempdimb #2\unitlength
    \@tempcnta \@tempdima \advance\@tempcnta 2368 \divide\@tempcnta 4736
    \@tempcntb -\@tempdimb \advance\@tempcntb -2368 \divide\@tempcntb 4736
    \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
    \@ifnextchar ({\@path}{\special{fp}}}
\providecommand{\drawpath}[4]{\path(#1,#2)(#3,#4)} % TPIC graphics for *.lp
\providecommand{\emline}[6]{\path(#1,#2)(#4,#5)}   % TPIC graphics for *.pic
}
\DeclareOption{kluwer}{%
\def\tangle{\begingroup\let\hline\savehline\t@ngle\array{l}}
\def\tanglec{\begingroup\let\hline\savehline\t@ngle\array{c}}
\def\tangler{\begingroup\let\hline\savehline\t@ngle\array{r}}
\def\tangles{\begingroup\let\hline\savehline\t@ngle\array}
}
\ExecuteOptions{TPIC}

\newcount{\h@r}
\newcount{\v@r}
\newcount{\h@z}
\newcount{\v@t}
\newlength{\unith}
\newlength{\unitv}
\newlength{\textwd}
%
\let\kilglu\@killglue
%
\def\@step[#1]{\unith\unitlens
\divide\unith 1000 \multiply\unith 10 \multiply\unith\hstretch
\@killglue\kern #1\unith}
\def\step{\@ifnextchar[{\@step}{\@step[1]}}
\def\hhstep{\step[-.5]}  \def\hstep{\step[.5]}  \def\Step{\step[2]}
%
\def\object#1{\settowidth{\textwd}{${#1}$}
\hbox{\put(0,0){\kern -.5\textwd${#1}$}\hss}}
%
\def\t@ngl@{%
\gdef\hm@dehalf{1}\gdef\hm@de{2}\gdef\hm@defives{10}\gdef\hm@detens{20}
\gdef\hm@dethree{7}\gdef\hm@deseven{13}\gdef\hm@defiveteen{15}}
%
\def\t@ngle{\t@ngl@
\gdef\above@bjectskip{0pt}\gdef\below@bjectskip{4pt}
%
\def\object##1{{\settowidth{\textwd}{${##1}$}
\@killglue\setbox0=\hbox{\kern -.5\textwd${##1}$}%
\unith\ht0\unitv\dp0%
\advance\unith\above@bjectskip\advance\unitv\below@bjectskip%
\ht0=\unith\dp0=\unitv\wd0=0pt\box0}}
%
\unitlength\unitlens\divide\unitlength 1000
\unith\unitlength \multiply\unith10 \multiply\unith\hstretch
\unitv\unitlength \multiply\unitv10 \multiply\unitv\vstretch
\def\@step[##1]{\@killglue\kern ##1\unith}
%
\def\hbx(##1,##2)##3{%
\@killglue\setbox0=\hbox{##3}\ht0=##2\unitv\dp0=0pt\wd0=##1\unith\box0}
\def\hln##1{\hbx(##1,0){\hbox to ##1\unith{\hrulefill}}}
%
\def\hstr##1{\unith\unitlength \multiply\unith10
\hstretch ##1 \multiply\unith\hstretch}
\def\vstr##1{\unitv\unitlength \multiply\unitv10
\vstretch ##1 \multiply\unitv\vstretch}
%
\def\c@@rds(##1,##2,##3,##4){%
\h@r\hstretch\v@r\vstretch\h@z\hstretch\v@t\vstretch%
\multiply\h@r ##1 \multiply\v@r ##2 \multiply\h@z ##3 \multiply\v@t ##4%
\put(\h@r,\v@r)}
\def\EMl@ne(##1,##2,##3,##4){%
\h@r\hstretch\v@r\vstretch\h@z\hstretch\v@t\vstretch%
\multiply\h@r ##1 \multiply\v@r ##2 \multiply\h@z ##3 \multiply\v@t ##4%
\emline{\h@r}{\v@r}1{\h@z}{\v@t}2}
%
%                      N O D E S   A N D   L I N E S
\def\id{\hbx(0,\hm@de){\c@@rds(0,0,0,\hm@detens){\line(0,1){\v@t}}}}
\def\idash{\hbx(0,2){\c@@rds(0,0,0,3){\line(0,1){\v@t}}%
\c@@rds(0,5,0,2){\line(0,1){\v@t}}\c@@rds(0,9,0,2){\line(0,1){\v@t}}%
\c@@rds(0,13,0,2){\line(0,1){\v@t}}\c@@rds(0,17,0,3){\line(0,1){\v@t}}}}
\def\node{\hbx(0,0){\c@@rds(0,0,\FillCircDiam,0){\circle*{\h@z}}}}
\def\n{\hbx(0,\hm@de){\c@@rds(0,0,0,\hm@detens){\line(0,1){\v@t}}%
\c@@rds(0,0,\FillCircDiam,0){\circle*{\h@z}}}}
\def\s{\hbx(0,\hm@de){\c@@rds(0,0,0,\hm@detens){\line(0,1){\v@t}}%
\c@@rds(0,\hm@detens,\FillCircDiam,0){\circle*{\h@z}}}}
\def\unit{\hbx(0,\hm@de){\c@@rds(0,0,0,10){\line(0,1){\v@t}}%
\c@@rds(0,12,4,0){\circle{\h@z}}}}
\def\counit{\hbx(0,\hm@de){\c@@rds(0,10,0,10){\line(0,1){\v@t}}%
\c@@rds(0,8,4,0){\circle{\h@z}}}}
%
%%%% ARGUMENT OF \ne,\nw,\se,\sw,\ned,\nwd,\sed,\swd IS 0,1,2,3 OR 4;
%%%% 0 PRODUCES EMPTY BOX AND
%%%% OTHER PRODUCE LINES WITH HORIZONTAL PROJECTIONS =##1
\def\@nsew##1##2##3##4##5{\hbx(1,\hm@de){\ifcase##1
\or\EMl@ne(##2)\or\EMl@ne(##3)\or\EMl@ne(##4)\or\EMl@ne(##5)\fi}}
\def\ne##1{\@nsew{##1}{0,0,10,\hm@detens}{-10,0,10,\hm@detens}%
{-20,0,10,\hm@detens}{-30,0,10,\hm@detens}}
\def\nw##1{\@nsew{##1}{0,\hm@detens,10,0}{0,\hm@detens,20,0}%
{0,\hm@detens,30,0}{0,\hm@detens,40,0}}
\def\se##1{\@nsew{##1}{10,0,0,\hm@detens}{10,0,-10,\hm@detens}%
{10,0,-20,\hm@detens}{10,0,-30,\hm@detens}}
\def\sw##1{\@nsew{##1}{0,0,10,\hm@detens}{0,0,20,\hm@detens}%
{0,0,30,\hm@detens}{0,0,40,\hm@detens}}
%
\def\nd{\hbx(0,2){\c@@rds(0,0,0,3){\line(0,1){\v@t}}%
\c@@rds(0,5,0,2){\line(0,1){\v@t}}\c@@rds(0,9,0,2){\line(0,1){\v@t}}%
\c@@rds(0,13,0,2){\line(0,1){\v@t}}\c@@rds(0,17,0,3){\line(0,1){\v@t}}%
\c@@rds(0,0,\FillCircDiam,0){\circle*{\h@z}}}}
\def\ned##1{\hbx(1,2){\ifcase##1\or%
\EMl@ne(0,0,1,2)\EMl@ne(2,4,4,8)\EMl@ne(5,10,7,14)\EMl@ne(8,16,10,20)\or%
\EMl@ne(-10,0,-7,3)\EMl@ne(-5,5,-3,7)\EMl@ne(-1,9,1,11)%
\EMl@ne(3,13,5,15)\EMl@ne(7,17,10,20)\or%
\EMl@ne(-20,0,-14,4)\EMl@ne(-11,6,-8,8)\EMl@ne(-5,10,-2,12)
\EMl@ne(1,14,4,16)\EMl@ne(7,18,10,20)\or%
\EMl@ne(-30,0,-26,2)\EMl@ne(-24,3,-20,5)\EMl@ne(-18,6,-14,8)%
\EMl@ne(-12,9,-8,11)\EMl@ne(-6,12,-2,14)\EMl@ne(0,15,4,17)%
\EMl@ne(6,18,10,20)\fi}}
\def\nwd##1{\hbx(1,2){\ifcase##1\or%
\EMl@ne(0,20,2,16)\EMl@ne(3,14,5,10)\EMl@ne(6,8,8,4)\EMl@ne(9,2,10,0)\or%
\EMl@ne(0,20,3,17)\EMl@ne(5,15,7,13)\EMl@ne(9,11,11,9)%
\EMl@ne(13,7,15,5)\EMl@ne(17,3,20,0)\or%
\EMl@ne(0,20,3,18)\EMl@ne(6,16,9,14)\EMl@ne(12,12,15,10)%
\EMl@ne(18,8,21,6)\EMl@ne(24,4,30,0)\or%
\EMl@ne(0,20,4,18)\EMl@ne(6,17,10,15)\EMl@ne(12,14,16,12)\EMl@ne(18,11,22,9)%
\EMl@ne(24,8,28,6)\EMl@ne(30,5,34,3)\EMl@ne(36,2,40,0)\fi}}
\def\sd{\hbx(0,2){\c@@rds(0,0,0,3){\line(0,1){\v@t}}%
\c@@rds(0,5,0,2){\line(0,1){\v@t}}\c@@rds(0,9,0,2){\line(0,1){\v@t}}%
\c@@rds(0,13,0,2){\line(0,1){\v@t}}\c@@rds(0,17,0,3){\line(0,1){\v@t}}%
\c@@rds(0,20,\FillCircDiam,0){\circle*{\h@z}}}}
\def\sed##1{\hbx(1,2){\ifcase##1\or%
\EMl@ne(10,0,8,4)\EMl@ne(7,6,5,10)\EMl@ne(4,12,2,16)\EMl@ne(1,18,0,20)\or%
\EMl@ne(10,0,7,3)\EMl@ne(5,5,3,7)\EMl@ne(1,9,-1,11)%
\EMl@ne(-3,13,-5,15)\EMl@ne(-7,17,-10,20)\or%
\EMl@ne(10,0,7,2)\EMl@ne(4,4,1,6)\EMl@ne(-2,8,-5,10)%
\EMl@ne(-8,12,-11,14)\EMl@ne(-14,16,-20,20)\or%
\EMl@ne(10,0,6,2)\EMl@ne(4,3,0,5)\EMl@ne(-2,6,-6,8)\EMl@ne(-8,9,-12,11)%
\EMl@ne(-14,12,-18,14)\EMl@ne(-20,15,-24,17)\EMl@ne(-26,18,-30,20)\fi}}
\def\swd##1{\hbx(1,2){\ifcase##1\or%
\EMl@ne(0,0,2,4)\EMl@ne(3,6,5,10)\EMl@ne(6,12,8,16)\EMl@ne(9,18,10,20)\or%
\EMl@ne(0,0,3,3)\EMl@ne(5,5,7,7)\EMl@ne(9,9,11,11)%
\EMl@ne(13,13,15,15)\EMl@ne(17,17,20,20)\or%
\EMl@ne(0,0,3,2)\EMl@ne(6,4,9,6)\EMl@ne(12,8,15,10)%
\EMl@ne(18,12,21,14)\EMl@ne(24,16,30,20)\or%
\EMl@ne(0,0,4,2)\EMl@ne(6,3,10,5)\EMl@ne(12,6,16,8)\EMl@ne(18,9,22,11)%
\EMl@ne(24,12,28,14)\EMl@ne(30,15,34,17)\EMl@ne(36,18,40,20)\fi}}
%
%                      D A S H E D   C R O S S E S
\def\xd{\hbx(2,2){\EMl@ne(0,0,4,4)\EMl@ne(6,6,8,8)\EMl@ne(12,12,14,14)%
\EMl@ne(16,16,20,20)\EMl@ne(0,20,4,16)\EMl@ne(6,14,14,6)\EMl@ne(16,4,20,0)}}
\def\xxd{\hbx(2,2){\EMl@ne(0,0,4,4)\EMl@ne(6,6,14,14)\EMl@ne(16,16,20,20)%
\EMl@ne(0,20,4,16)\EMl@ne(6,14,8,12)\EMl@ne(12,8,14,6)\EMl@ne(16,4,20,0)}}
\def\hxd{\hbx(1,2){\EMl@ne(0,0,2,4)\EMl@ne(3,6,4,8)\EMl@ne(6,12,7,14)%
\EMl@ne(8,16,10,20)\EMl@ne(0,20,2,16)\EMl@ne(3,14,7,6)\EMl@ne(8,4,10,0)}}
\def\hxxd{\hbx(1,2){\EMl@ne(0,0,2,4)\EMl@ne(3,6,7,14)\EMl@ne(8,16,10,20)%
\EMl@ne(0,20,2,16)\EMl@ne(3,14,4,12)\EMl@ne(6,8,7,6)\EMl@ne(8,4,10,0)}}
%
%                        O T H E R   L I N E S
\def\@d##1##2{\hbx(\hm@dehalf,\hm@de){%
\EMl@ne(##1\hm@defives,##2\hm@detens)}}
\def\d{\@d{}{0,0,}}   \def\dd{\@d{0,0,}{}}
\def\@hd##1##2##3{\hbx(.5,\hm@de){\EMl@ne(##1,\hm@defives,##2)%
\c@@rds(##1,\hm@defives,0,\hm@defives){\line(0,##31){\v@t}}}}
\def\hd{\@hd{5}{0,\hm@detens}{-}}     \def\dh{\@hd{0}{5,0}{}}
\def\hdd{\@hd{0}{5,\hm@detens}{-}}    \def\ddh{\@hd{5}{0,0}{}}
%
%             P U T   S O M E T H I N G   A N Y W H E R E
\def\n@de##1##2##3{\hbx(0,0){%
\c@@rds(##1,0,0){\makebox(0,0)[##2]{$\scriptstyle ##3$}}}}
\def\nodeu##1{\hbx(0,0){\n@de{0,3}{cb}{##1}}}
\def\noded##1{\hbx(0,0){\n@de{0,-3}{ct}{##1}}}
\def\nodel##1{\hbx(0,0){\n@de{-2,0}{rc}{##1}}}
\def\noder##1{\hbx(0,0){\n@de{2,0}{lc}{##1}}}
\def\noderu##1{\hbx(0,0){\n@de{5,2}{lb}{##1}}}
\def\noderd##1{\hbx(0,0){\n@de{5,-2}{lt}{##1}}}
\def\nodelu##1{\hbx(0,0){\n@de{-5,2}{rb}{##1}}}
\def\nodeld##1{\hbx(0,0){\n@de{-5,-2}{rt}{##1}}}
\def\Put(##1,##2)[##3]##4{%
\h@r\hstretch \multiply\h@r ##1
\v@r\vstretch \multiply\v@r ##2
\put(\h@r,\v@r){\makebox(\h@z,\v@t)[##3]{\scriptsize$##4$}}}
% \def\negobj##1{\raise -0.2\unitv\hbox{\put(0,0){$##1$}}}
% \def\obj##1{\raise .2\unitv\hbox{\put(0,0){$##1$}}}
% \def\Obj##1{\settowidth{\textwd}{$##1$}%
% \raise 1.1\unitv\hbox{\kern -1\textwd $##1$}}
%
%                            B O X E S
\def\dbox##1##2{\hbx(##1,\hm@de){\multiply\hstretch ##1%
\c@@rds(0,0,10,\hm@detens){\dashbox{100}(\h@z,\v@t){\scriptsize$##2$}}}}
\def\ffbox##1##2{\hbx(##1,\hm@de){\multiply\hstretch ##1%
\c@@rds(0,0,10,\hm@detens){\framebox(\h@z,\v@t){\scriptsize$##2$}}}}
\def\obox##1##2{\hbx(##1,\hm@de){\multiply\hstretch ##1%
\c@@rds(5,\hm@defives,10,\hm@detens){\oval(\h@z,\v@t)}%
\c@@rds(0,0,10,\hm@detens){\makebox(\h@z,\v@t)[cc]{\scriptsize$##2$}}}}
\def\tbox##1##2{\hbx(##1,\hm@de){\multiply\hstretch ##1%
\c@@rds(0,0,10,\hm@detens){\makebox(\h@z,\v@t)[cc]{\scriptsize$##2$}}}}
%
%                       ( C O ) P A I R I N G S
\def\@ev##1##2##3##4{\hbx(##1){\c@@rds(##2,##3,##3){\oval(\h@z,\v@t)[##4]}}}
\def\ev{\@ev{\hm@de,\hm@de}{\hm@defives,\hm@detens}\hm@detens b}
\def\coev{\@ev{\hm@de,\hm@de}{\hm@defives,0}\hm@detens t}
\def\hcoev{\@ev{1,\hm@de}{5,0}{10}t}
\def\hev{\@ev{1,\hm@de}{5,\hm@detens}{10}b}
\def\Coev{\@ev{1,\hm@de}{15,0}{30}t}
\def\Ev{\@ev{1,\hm@de}{15,\hm@detens}{30}b}
\def\COEV{\@ev{2,2}{30,0}{60}t}
\def\EV{\@ev{2,2}{30,20}{60}b}
%
%             ( O V E R / U N D E R ) C R O S S I N G S
\def\X{\hbx(1,\hm@de){\EMl@ne(0,\hm@detens,10,0)\EMl@ne(0,0,10,\hm@detens)}}
\def\XX{\hbx(\hm@de,\hm@de){\EMl@ne(0,\hm@detens,\hm@detens,0)%
\EMl@ne(0,0,\hm@detens,\hm@detens)}}
\def\x{\hbx(\hm@de,\hm@de){\EMl@ne(0,\hm@detens,\hm@detens,0)%
\EMl@ne(0,0,\hm@dethree,\hm@dethree)%
\EMl@ne(\hm@detens,\hm@detens,\hm@deseven,\hm@deseven)}}
\def\xx{\hbx(\hm@de,\hm@de){\EMl@ne(0,\hm@detens,\hm@dethree,\hm@deseven)%
\EMl@ne(0,0,\hm@detens,\hm@detens)%
\EMl@ne(\hm@detens,0,\hm@deseven,\hm@dethree)}}
\def\hx{\hbx(1,2){\EMl@ne(0,20,10,0)\EMl@ne(0,0,3,6)\EMl@ne(10,20,7,14)}}
\def\hxx{\hbx(1,2){\EMl@ne(0,20,3,14)\EMl@ne(0,0,10,20)\EMl@ne(10,0,7,6)}}
%
%                    ( C O ) P R O D U C T S
\def\pr@d##1##2##3{%
\c@@rds(##1){\oval(\h@z,\v@t)[c##2]}\c@@rds(##3){\line(0,1){\v@t}}}%
\def\pr@dd##1##2##3##4{\c@@rds(5,##1,10,10){\oval(\h@z,\v@t)[c##2]}%
\EMl@ne(5,10,##3)\c@@rds(5,##4,0,5){\line(0,1){\v@t}}}
\def\c@cyc##1{\c@@rds(##1,\FillCircDiam,0){\circle*{\h@z}}}
\def\cu{\@ifnextchar*%
{\hbx(\hm@de,\hm@de){\pr@d{\hm@defives,\hm@detens,\hm@detens,\hm@detens}%
{b}{\hm@defives,0,0,\hm@defives}%
\c@cyc{\hm@defives,\hm@defives}}\@gobble}%
{\hbx(\hm@de,\hm@de){\pr@d{\hm@defives,\hm@detens,\hm@detens,\hm@detens}%
{b}{\hm@defives,0,0,\hm@defives}}}}
\def\cd{\@ifnextchar*%
{\hbx(\hm@de,\hm@de){\pr@d{\hm@defives,0,\hm@detens,\hm@detens}%
{t}{\hm@defives,\hm@defives,0,\hm@defives}%
\c@cyc{\hm@defives,\hm@defives}}\@gobble}%
{\hbx(\hm@de,\hm@de){\pr@d{\hm@defives,0,\hm@detens,\hm@detens}%
{t}{\hm@defives,\hm@defives,0,\hm@defives}}}}
\def\hcu{\@ifnextchar*%
{\hbx(1,\hm@de){\pr@d{5,\hm@detens,10,10}{b}{5,0,0,\hm@defiveteen}%
\c@cyc{5,\hm@defiveteen}}\@gobble}%
{\hbx(1,\hm@de){\pr@d{5,\hm@detens,10,10}{b}{5,0,0,\hm@defiveteen}}}}
\def\hcd{\@ifnextchar*%
{\hbx(1,\hm@de){\pr@d{5,0,10,10}{t}{5,5,0,\hm@defiveteen}%
\c@cyc{5,5}}\@gobble}%
{\hbx(1,\hm@de){\pr@d{5,0,10,10}{t}{5,5,0,\hm@defiveteen}}}}
\def\Cu{\@ifnextchar*%
{\hbx(4,2){\pr@d{20,20,40,20}{b}{20,0,0,10}\c@cyc{20,10}}\@gobble}%
{\hbx(4,2){\pr@d{20,20,40,20}{b}{20,0,0,10}}}}
\def\Cd{\@ifnextchar*%
{\hbx(4,2){\pr@d{20,0,40,20}{t}{20,10,0,10}\c@cyc{20,10}}\@gobble}%
{\hbx(4,2){\pr@d{20,0,40,20}{t}{20,10,0,10}}}}
\def\hd@cd##1{\@ifnextchar*%
{\hbx(1,2){\pr@dd{0}{t}{##1,20}{5}\c@cyc{5,5}}\@gobble}%
{\hbx(1,2){\pr@dd{0}{t}{##1,20}{5}}}}
\def\hd@cu##1{\@ifnextchar*%
{\hbx(1,2){\pr@dd{20}{b}{##1,0}{10}\c@cyc{5,15}}\@gobble}%
{\hbx(1,2){\pr@dd{20}{b}{##1,0}{10}}}}
\def\hdcd{\hd@cd 0}   \def\hddcd{\hd@cd{10}}
\def\hdcu{\hd@cu{10}}   \def\hddcu{\hd@cu 0}
%
%                          A C T I O N S
\def\@ct##1##2##3##4##5{\hbx(##1,\hm@de){%
\c@@rds(##2,##3,##4,##4){\oval(\h@z,\v@t)[##5]}%
\c@@rds(##2,0,0,\hm@detens){\line(0,1){\v@t}}}}
\def\@lu[##1]{{\multiply\hstretch##1\@ct{##1}{10}{\hm@detens}{20}{lb}}}
\def\@ru[##1]{{\multiply\hstretch##1\@ct{##1}{0} {\hm@detens}{20}{rb}}}
\def\@ld[##1]{{\multiply\hstretch##1\@ct{##1}{10}{0}{20}{lt}}}
\def\@rd[##1]{{\multiply\hstretch##1\@ct{##1}{0}{0}{20}{rt}}}
\def\lu{\@ifnextchar[{\@lu}{\@lu[1]}}
\def\ru{\@ifnextchar[{\@ru}{\@ru[1]}}
\def\ld{\@ifnextchar[{\@ld}{\@ld[1]}}
\def\rd{\@ifnextchar[{\@rd}{\@rd[1]}}
\def\Lu{\lu[2]}\def\Ru{\ru[2]}\def\Ld{\ld[2]}\def\Rd{\rd[2]}
\def\@hlu[##1]{{\divide\unith2\multiply\hstretch##1%
\@ct{##1}{5}{\hm@detens}{10}{lb}}}
\def\@hru[##1]{{\divide\unith2\multiply\hstretch##1%
\@ct{##1}{0}{\hm@detens}{10}{rb}}}
\def\@hld[##1]{{\divide\unith2\multiply\hstretch##1%
\@ct{##1}{5}{0}{10}{lt}}}
\def\@hrd[##1]{{\divide\unith2\multiply\hstretch##1%
\@ct{##1}{0}{0}{10}{rt}}}
\def\hlu{\@ifnextchar[{\@hlu}{\@hlu[1]}}
\def\hru{\@ifnextchar[{\@hru}{\@hru[1]}}
\def\hld{\@ifnextchar[{\@hld}{\@hld[1]}}
\def\hrd{\@ifnextchar[{\@hrd}{\@hrd[1]}}
% \def\hlu{\@ct{.5}{5}{\hm@detens}{10}{lb}}
% \def\hru{\@ct{.5}{0}{\hm@detens}{10}{rb}}
% \def\hld{\@ct{.5}{5}{0}{10}{lt}}
% \def\hrd{\@ct{.5}{0}{0}{10}{rt}}
%
%                       C O M P O S I T I O N S
\def\c@mp##1##2##3##4##5##6{\hbx(##1,2){%
\c@@rds(##2,0,##3){\oval(\h@z,\v@t)[##4t]}%
\c@@rds(##2,20,##3){\oval(\h@z,\v@t)[##4b]}%
\c@@rds(##2,##5,0,##6){\line(0,1){\v@t}}}}
\def\cucd{\c@mp{1}{5}{10,10}{}{5}{10}}
\def\k{\c@mp{1}{0}{20,10}{r}{0}{20}}
\def\kk{\c@mp{1}{10}{20,10}{l}{0}{20}}
\def\rurd{\c@mp{.5}{0}{10,10}{r}{0}{20}}
\def\luld{\c@mp{.5}{5}{10,10}{l}{0}{20}}
%
%                M O R P H I S M S   I N   A   C I R C L E
\def\c@rcled##1##2{\c@@rds(##1,12,12){\oval(\h@z,\v@t)}%
\c@@rds(##1,0,0){\makebox(\h@z,\v@t)[cc]{\scriptsize$##2$}}}
%               ( 1, 0 ) -,  ( 0, 1 ) -  T E N S O R S
\def\@Q##1##2{\hbx(0,\hm@de){%
\c@@rds(0,##1,0,4){\line(0,1){\v@t}}\c@rcled{0,10}{##2}}}
\def\Q##1{\@Q{0}{##1}}     \def\QQ##1{\@Q{16}{##1}}
%                    ( 1, 1 ) - T E N S O R S
\def\O##1{\hbx(0,\hm@de){\c@@rds(0,0,0,4){\line(0,1){\v@t}}%
\c@@rds(0,16,0,4){\line(0,1){\v@t}}\c@rcled{0,10}{##1}}}
\def\S{\O{S}}              \def\SS{\O{S^{-1}}}
%\def\circ##1{\hbx(2,2){\c@rcled{10,4}{##1}}}
\def\morph##1{\hbx(2,2){\c@@rds(10,10,10,10){\oval(\h@z,\v@t)}%
\c@@rds(5,5,10,10){\makebox(\h@z,\v@t)[cc]{\scriptsize$##1$}}%
\c@@rds(10,0,0,5){\line(0,1){\v@t}}%
\c@@rds(10,15,0,5){\line(0,1){\v@t}}}}
%               ( 2, 0 ) -,  ( 0, 2 ) -  T E N S O R S
\def\r@##1##2##3##4##5{\hbx(2,\hm@de){%
\c@@rds(0,##1,0,4){\line(0,##41){\v@t}}%
\c@@rds(20,##1,0,4){\line(0,##41){\v@t}}%
\c@@rds(4,##1,8,8){\oval(\h@z,\v@t)[l##2]}%
\c@@rds(16,##1,8,8){\oval(\h@z,\v@t)[r##2]}\c@rcled{##3}{##5}}}
\def\ro##1{\r@{4}{t}{10,8}{-}{##1}}
\def\coro##1{\r@{16}{b}{10,12}{}{##1}}
%
\def\R@##1##2##3{\hbx(4,\hm@de){%
\c@@rds(14,##1,28,20){\oval(\h@z,\v@t)[l##2]}%
\c@@rds(26,##1,28,20){\oval(\h@z,\v@t)[r##2]}\c@rcled{20,10}{##3}}}
\def\Ro##1{\R@{0}{t}{##1}}
\def\coRo##1{\R@{20}{b}{##1}}
%               ( 2, 1 ) -,  ( 1, 2 ) -  T E N S O R S
\def\t@##1##2##3##4##5##6{\hbx(2,2){%
\c@@rds(4,##1,8,8){\oval(\h@z,\v@t)[l##2]}%
\c@@rds(16,##1,8,8){\oval(\h@z,\v@t)[r##2]}%
\c@@rds(0,##1,0,5){\line(0,##31){\v@t}}%
\c@@rds(20,##1,0,5){\line(0,##31){\v@t}}%
\c@@rds(10,##4,0,5){\line(0,##31){\v@t}}%
\c@rcled{10,##5}{##6}}}
\def\tu##1{\t@{15}b{}{0}{11}{##1}}  \def\td##1{\t@{5}t{-}{20}{9}{##1}}
%                    ( 2, 2 ) - T E N S O R S
\def\ox##1{\hbx(2,2){\c@@rds(10,10,14,14){\oval(\h@z,\v@t)}%
\c@@rds(10,10,0,0){\makebox(\h@z,\v@t)[cc]{\scriptsize$##1$}}
\EMl@ne(0,0,5,5)\EMl@ne(0,20,5,15)\EMl@ne(20,20,15,15)\EMl@ne(20,0,15,5)}}
%
% HALF HEIGHT ROW IS PRODUCED BY \hh or \HH AT THE BEGINNING OF THE ROW
%   \HH is global for a row, \hh is local
\def\HH{\gdef\hm@dehalf{.5}\gdef\hm@de{1}
\gdef\hm@dethree{3}\gdef\hm@defives{5}\gdef\hm@deseven{7}
\gdef\hm@detens{10}\gdef\hm@defiveteen{5}}
\def\hh{\def\hm@dehalf{.5}\def\hm@de{1}
\def\hm@dethree{3}\def\hm@defives{5}\def\hm@deseven{7}
\def\hm@detens{10}\def\hm@defiveteen{5}}
%
\def\array{\let\@acol\@arrayacol \let\@classz\@arrayclassz
\let\@classiv\@arrayclassiv \def\arraystretch{0}\arraycolsep0pt
\def\\{\gdef\above@bjectskip{4pt}\gdef\below@bjectskip{0pt}\t@ngl@\@arraycr}
\let\@halignto\@empty\@tabarray}
}
%        E N D   \def\t@ngle
%
\def\tangle{\t@ngle\array{l}}    \def\endtangle{\endarray\t@ngl@}
\def\tanglec{\t@ngle\array{c}}   \let\endtanglec\endtangle
\def\tangler{\t@ngle\array{r}}   \let\endtangler\endtangle
\def\tangles{\t@ngle\array}      \let\endtangles\endtangle
%
\ProcessOptions
\endinput
