%TESTS OF DIAGRAM MACROS - J. C. Reynolds - December 1987

%This is an input file for LATEX that inputs the macros in diagmac.tex
%and tests them.  A user's manual for these macros is in diagmac.doc

\documentclass[12pt]{article}
\input diagmac
\oddsidemargin=0in
\evensidemargin=0in
\textwidth=6.5in
\begin{document}

\thispagestyle{empty}

\begin{centering}
{\large\bf TESTS OF DIAGRAM MACROS} \\[14 pt]
\today \\[21 pt]
\end{centering}


%These are the two examples given in the user's manual.

$$\diagram{
\vertex 0,100:{A}{\border{3pt}{4pt}\rect}
\vertex 150,100:{B}{\border{3pt}{4pt}\rect}
\vertex 0,0:{A'}{\border{3pt}{4pt}\rect}
\vertex 150,0:{B'}{\border{3pt}{4pt}\rect}
\setedge 0,100,150,100:
\shadeedge
\drawsolidedge
\drawedgehead{100}10
\abutabove 75:{\textstyle c}{\border{2pt}{2pt}\octagon{3pt}}
\setedge 0,0,150,0:
\shadeedge
\drawsolidedge
\drawedgehead{100}10
\abutbelow 75:{\textstyle c'}{\border{2pt}{2pt}\octagon{3pt}}
\setedge 0,100,0,0:
\shadeedge
\drawsolidedge
\drawedgehead{100}10
\abutleft 50:{\textstyle a}{\border{2pt}{2pt}\octagon{3pt}}
\setedge 150,100,150,0:
\shadeedge
\drawsolidedge
\drawedgehead{100}10
\abutright 50:{\textstyle b}{\border{2pt}{2pt}\octagon{3pt}}
}$$

$$\ctdiagram{
\ctv 0,100:{A}
\ctv 150,100:{B}
\ctv 0,0:{A'}
\ctv 150,0:{B'}
\ctet 0,100,150,100:{c}
\cteb 0,0,150,0:{c'}
\ctel 0,100,0,0:{a}
\cter 150,100,150,0:{b}
}$$

\newpage

%This gives a thorough workout to the general macros for diagrams.
%The result looks like an eye-chart for Martians.

$$\diagram{
\vertex -150,0:{X+Y}{\border{4pt}{3pt}\rorect{2pt}01\outline}
\vertex 0,-50:Y{\border{10pt}{10pt}\hexagon\outline}
\vertex 150,0:\sum{\border{10pt}{10pt}\octagon{10pt}\outline
   \border{5pt}{5pt}\octagon{12pt}\thicklines\outline\thinlines}
\vertex -100,150:\alpha{\border{4pt}{3pt}\diamond\outline}
\vertex 100,150:\sum{\border{10pt}{10pt}\rorect{20pt}00\outline
   \border{5pt}{5pt}\rorect{24pt}00\thicklines\outline\thinlines}
\vertex 0,200:{X^2+Y^2}{\border{4pt}{3pt}\rect\outline}
\place -150,-150:{X+Y^{Z^2}}
   {\leftghost X\symmetrize\borderto{0pt}{0pt}\border{4pt}{3pt}\rect\outline
   \setcircle{16pt}{\xcenter}{\bexpr}\drawcircle0110
   \drawcirclehead{0}{-1}1
   \abutcirclebelow{-10pt}\alpha{\border{2pt}{2pt}\rect\outline}
   \abutcirclebelow{10pt}\alpha{\border{2pt}{2pt}\rect\outline}}
\placed{150pt}{-150pt}{X+Y}
   {\rightghost Y\symmetrize\borderto{0pt}{26pt}\border{4pt}{0pt}\rect\outline
   \placed{\lexpr}{\ycenter}{\vrule height3.2pt depth-2.8pt width10pt}{}
   \place 0,-3:{\vrule height3.2pt depth-2.8pt width10pt}{\xcenter=\lexpr}
   \setcircle{16pt}{\rexpr}{\texpr}\shiftcircle{8pt}{8pt}\drawcircle1101
   \drawcirclehead{0}{-1}1\drawcirclehead{-1}00
   \abutcircleabove{0pt}\alpha{\border{2pt}{2pt}\rect\outline}}
\vertex 0,-150:{}{\setcircle{40pt}{\xcenter}{\ycenter}\drawcircle1111
   \drawcirclehead231\drawcirclehead{-2}30
   \drawcirclehead6{-9}0\drawcirclehead{-4}{-6}1
   \abutcircleleft{0pt}\alpha{\border{2pt}{2pt}\rect\outline}
   \abutcircleright{20pt}\alpha{\border{2pt}{2pt}\rect\outline}
   \abutcircleright{0pt}\alpha{\border{2pt}{2pt}\rect\outline}
   \abutcircleright{-20pt}\alpha{\border{2pt}{2pt}\rect\outline}}
\setedge 0,200,-100,150:\shadeedge\drawsolidedge\drawedgehead{100}10
   \abutleft 185:{\alpha+\beta}{\border{2pt}{2pt}\rorect{5pt}01\outline}
\setedge 0,200,100,150:\shadeedge\drawsolidedge\drawedgehead{100}10
   \abutright 185:{\alpha+\beta}{\border{2pt}{2pt}\rorect{5pt}01\outline}
\setedge -150,0,0,-50:\shadeedge\drawdashedge{11pt}{10pt}01\drawedgehead{80}01
   \abutleftd{-25pt}{\alpha\beta}
   {\border{2pt}{2pt}\borderto{25pt}{0pt}\rect\outline}
\setedge -150,0,150,0:\drawedgehead{50}01\shadeedge\drawsolidedge
   \abutabove -10:\rho{\border{2pt}{2pt}\diamond\outline}
\setedge -150,0,-100,150:\shadeedge\drawsolidedge\drawedgehead{100}10
   \abutleft 75:\rho{\border{10pt}{10pt}\octagon{10pt}\outline}
\setedge -150,0,100,150:\shadeedge\drawdotedge{7pt}1
   \abutaboved{-100pt}\rho{\border{10pt}{10pt}\hexagon\outline}
\setedge 0,-50,150,0:\shadeedge\drawsolidedge\drawedgehead{20}11
   \abutrightd{-25pt}\rho{\border{2pt}{2pt}\borderto{25pt}{0pt}\rect\outline}
\setedge 0,-50,-100,150:\shadeedge\drawsolidedge
\setedge 0,-50,100,150:\shadeedge\drawsolidedge
\setedge 150,0,-100,150:\shadeedge\drawsolidedge
   \abutbelowd{100pt}\rho{\border{10pt}{10pt}\hexagon\outline}
\setedge 150,0,100,150:\shadeedge\drawdashedge{40pt}{40pt}11\drawedgehead000
   \abutleft 75:\rho{\border{10pt}{10pt}\hexagon\outline}
   \shiftedge{-10pt}\shadeedge\drawdashedge{30pt}{30pt}10\drawedgehead000
   \shiftedge{-10pt}\shadeedge\drawdashedge{11pt}{5pt}01\drawedgehead000
   \shiftedge{-10pt}\shadeedge\drawdotedge{8pt}0\drawedgehead{100}10
   \abutright 75:\rho{\border{5pt}{5pt}\rorect{5pt}11\outline}
\setedge -100,150,100,150:\drawedgehead{50}11\shadeedge\drawsolidedge
   \abutbelow 0:\rho{\border{2pt}{2pt}\rect\outline}
\setedge 0,-50,-150,-150:\thicklines\drawedgehead{50}01\thinlines
   \shadeedge\drawdashedge{13pt}{3pt}01\drawedgehead{50}11
   \abutbelow -50:{X \atop Y}{\border{2pt}{2pt}\rorect{5pt}10\outline}
\setedge 0,-50,0,-150:\thicklines\shadeedge\drawsolidedge\thinlines
\setedge 0,-50,150,-150:\shadeedge\drawsolidedge
   \abutabove 75:{X \atop Y}{\border{2pt}{2pt}\rorect{5pt}10\outline}
\setedge -175,-50,-175,-100:\drawdashedge{10pt}{31pt}11
\setedge -165,-100,-165,-50:\drawdashedge{15pt}{15pt}01
\setedge -155,-50,-155,-100:\drawdashedge{5pt}{5pt}11
\setedge -145,-100,-145,-50:\drawdotedge{26pt}1
\setedge -135,-50,-135,-100:\drawdotedge{25pt}1
\setedge -125,-100,-125,-50:\drawdotedge{5pt}1
\setedge 125,-50,175,-50:\drawdashedge{10pt}{31pt}11
\setedge 175,-60,125,-60:\drawdashedge{15pt}{15pt}01
\setedge 125,-70,175,-70:\drawdashedge{5pt}{5pt}11
\setedge 175,-80,125,-80:\drawdotedge{26pt}1
\setedge 125,-90,175,-90:\drawdotedge{25pt}1
\setedge 175,-100,125,-100:\drawdotedge{5pt}1
}$$

\newpage

%These three diagrams test the macros for category-theory diagrams.

$$\ctdiagram{
\ctvg0,0:{Y'}{\ctlpbl{I_{Y'}}}
\ctvg150,0:{Z=Z_0}{\ctgl{Z}\ctlpbr{I_Z}}
\ctvg0,100:{X_0=X}{\ctgr{X}\ctlptl{I_X}}
\ctvg150,100:{Y}{\ctlptr{I_Y}}
\ctet0,100,150,100:\alpha
\cteb0,0,150,0:{\beta'}
\ctel0,100,0,0:{\alpha'}
\cter150,100,150,0:\beta
\ctetb0,100,150,0:11{\alpha;\beta}{\alpha';\beta'}
}$$

$$\ctdiagram{\ctdash
\ctvg0,0:{Y'}{\ctlpblcc{I_{Y'}}}
\ctvg150,0:{Z=Z_0}{\ctgl{Z}\ctlpbrcc{I_Z}}
\ctvg0,100:{X_0=X}{\ctgr{X}\ctlptlcc{I_X}}
\ctvg150,100:{Y}{\ctlptrcc{I_Y}}
\ctet0,100,150,100:\alpha
\ctnohead\cteb0,0,150,0:{\beta'}\cthead
\ctel0,100,0,0:{\alpha'}
\cter150,100,150,0:\beta
\ctelr0,100,150,0:11{\alpha';\beta'}{\alpha;\beta}
}$$

$$\ctdiagram{
\ctv0,0:{Y'}
\ctvg150,0:{Z=Z_0}{\ctgl{Z}}
\ctvg0,100:{X_0=X}{\ctgr{X}}
\ctv150,100:Y
\ctetg0,100,150,100;50:\alpha
\ctebg0,0,150,0;50:{\beta'}
\ctelg0,100,0,0;30:{\alpha'}
\cterg150,100,150,0;30:\beta
\ctetbg0,100,150,0;50,100:10{\rho}{\rho'}
\ctelrg0,0,150,100;70,30:01{\theta}{\theta'}
}$$

\newpage

%The next two diagrams are further tests of the macros for drawing
%double edges.

$$\ctdiagram{
\ctv0,0:X
\ctv-100,100:Y\ctv-100,0:Y\ctv-100,-100:Y
\ctv100,100:Z\ctv100,0:Z\ctv100,-100:Z
\ctetb0,0,-100,100:10\alpha\beta
\ctdash\ctetb0,0,-100,0:00\alpha\beta\ctsolid
\ctetb0,0,-100,-100:01\alpha\beta
\ctetb0,0,100,100:10\alpha\beta
\ctdash\ctetb0,0,100,0:11\alpha\beta\ctsolid
\ctetb0,0,100,-100:01\alpha\beta
}$$

$$\ctdiagram{
\ctv0,0:X
\ctv-100,100:Y\ctv0,100:Y\ctv100,100:Y
\ctv-100,-100:Z\ctv0,-100:Z\ctv100,-100:Z
\ctelr0,0,-100,100:10\alpha\beta
\ctelr0,0,0,100:00\alpha\beta
\ctelr0,0,100,100:01\alpha\beta
\ctelr0,0,-100,-100:10\alpha\beta
\ctelr0,0,0,-100:11\alpha\beta
\ctelr0,0,100,-100:01\alpha\beta
}$$

\newpage

%These two diagrams test the usage of \ctinnermid and \ctoutermid.

$$\ctdiagram{\ctv 0,0:{
{\displaystyle\sum_{i=0}^{100}x_i\cdot y_i}\over
{\displaystyle\sqrt{\biggl(\sum_{i=0}^{100}x_i^2\biggr)
+\biggl(\sum_{i=0}^{100}y_i^2\biggr)}}}
\ctv0,150:A\ctv150,150:B\ctv150,0:C\ctv150,-150:D
\ctv0,-150:E\ctv-150,-150:F\ctv-150,0:G\ctv-150,150:H
\cter0,0,0,150:A\ctinnermid\cter0,0,0,150:a\ctoutermid
\cter150,150,0,0:B\ctinnermid\cter150,150,0,0:b\ctoutermid
\cteb0,0,150,0:C\ctinnermid\cteb0,0,150,0:c\ctoutermid
\cteb150,-150,0,0:D\ctinnermid\cteb150,-150,0,0:d\ctoutermid
\ctel0,0,0,-150:E\ctinnermid\ctel0,0,0,-150:e\ctoutermid
\ctel-150,-150,0,0:F\ctinnermid\ctel-150,-150,0,0:f\ctoutermid
\ctet0,0,-150,0:G\ctinnermid\ctet0,0,-150,0:g\ctoutermid
\ctet-150,150,0,0:H\ctinnermid\ctet-150,150,0,0:h
}$$

$$\ctdiagram{\ctv 0,0:{
{\displaystyle\sum_{i=0}^{100}x_i\cdot y_i}\over
{\displaystyle\sqrt{\biggl(\sum_{i=0}^{100}x_i^2\biggr)
+\biggl(\sum_{i=0}^{100}y_i^2\biggr)}}}
\ctv-150,150:A\ctv0,150:C\ctv150,150:E\ctv150,0:G
\ctelr0,0,-150,150:11AB\ctinnermid
\ctelr0,0,-150,150:11ab\ctoutermid
\ctelr0,150,0,0:11CD\ctinnermid
\ctelr0,150,0,0:11cd\ctoutermid
\ctetb0,0,150,150:11EF\ctinnermid
\ctetb0,0,150,150:11ef\ctoutermid
\ctetb150,0,0,0:11GH\ctinnermid
\ctetb150,0,0,0:11gh
}$$

\newpage

%This is a ``real'' diagram, relating directed complete relations to
%Scott's inverse limit construction.  It is sufficiently crowded
%that it has been necessary to place some of the abutted expressions
%carefully to avoid ambiguity.

$$\ctdiagram{
\ctvg0,0:{D_0}{\border{2pt}{0pt}}
\ctv72,0:{D_1}
\ctv144,0:{D_2}
\ctv216,0:{\quad\cdots}
\ctvg288,144:{D_\infty}{\advance\ycenter by 5pt\border{50pt}{10pt}}
\ctv234,36:{\cdots}
\ctetbg0,0,72,0;48,48:10{\phi_0}{\psi_0}
\ctetbg72,0,144,0;114,114:10{\phi_1}{\psi_1}
\ctetb144,0,216,0:10{\phi_2}{\psi_2}
\ctelrg0,0,288,144;42,30:10{\Phi_0}{\Psi_0}
\ctelrg72,0,288,144;42,30:10{\Phi_1}{\Psi_1}
\ctelrg144,0,288,144;42,30:10{\Phi_2}{\Psi_2}
\ctvg0,-72:{D'_0}{\border{2pt}{0pt}}
\ctv72,-72:{D'_1}
\ctv144,-72:{D'_2}
\ctv216,-72:{\quad\cdots}
\ctvg288,-216:{D'_\infty}{\advance\ycenter by -5pt\border{50pt}{10pt}}
\ctv234,-108:{\cdots}
\ctetbg0,-72,72,-72;48,48:10{\phi'_0}{\psi'_0}
\ctetbg72,-72,144,-72;114,114:10{\phi'_1}{\psi'_1}
\ctetb144,-72,216,-72:10{\phi'_2}{\psi'_2}
\ctelrg0,-72,288,-216;-114,-102:10{\Phi'_0}{\Psi'_0}
\ctelrg72,-72,288,-216;-114,-102:10{\Phi'_1}{\Psi'_1}
\ctelrg144,-72,288,-216;-114,-102:10{\Phi'_2}{\Psi'_2}
\cter0,0,0,-72:{\alpha_0}
\cter72,0,72,-72:{\alpha_1}
\cter144,0,144,-72:{\alpha_2}
\ctv216,-36:{\cdots}
\ctdash
\cter288,144,288,-216:{\alpha_\infty}
}$$

\newpage

%This shows how a macro can be defined and then used to give two different
%views of the same diagram.

\def\testcube#1#2#3#4#5#6#7#8{
$$\ctdiagram{
\ctv#1,#3:{A_1}
\ctv#2,#3:{B_1}
\ctv#1,#4:{A_2}
\ctv#2,#4:{B_2}
\ctv#5,#7:{A'_1}
\ctv#6,#7:{B'_1}
\ctv#5,#8:{A'_2}
\ctv#6,#8:{B'_2}
\ctet#1,#3,#2,#3:{\gamma_1}
\ctet#1,#4,#2,#4:{\gamma_2}
\cter#1,#3,#1,#4:{\alpha}
\cter#2,#3,#2,#4:{\beta}
\ctet#5,#7,#6,#7:{\gamma'_1}
\ctet#5,#8,#6,#8:{\gamma'_2}
\cter#5,#7,#5,#8:{\alpha'}
\cter#6,#7,#6,#8:{\beta'}
\cter#1,#3,#5,#7:{a_1}
\cter#2,#3,#6,#7:{b_1}
\cter#1,#4,#5,#8:{a_2}
\cter#2,#4,#6,#8:{b_2}
}$$}

\testcube{0}{200}{200}{0}{50}{150}{150}{50}

\testcube{0}{150}{150}{0}{100}{250}{200}{50}

\newpage

%An example of a partial ordering with a limit point.

$${\def\diagramunit{0.25in}
\ctdiagram{\ctnohead
\ctv0,0:{\geq 0}
\ctv2,2:{\geq 1}
\ctv4,4:{\geq 2}
\ctv7,7:\infty
\ctv-2,2:{=0}
\ctv0,4:{=1}
\ctv2,6:{=2}
\cten0,0,2,2:
\cten2,2,4,4:
\cten0,0,-2,2:
\cten2,2,0,4:
\cten4,4,2,6:
\ctdot
\cten4,4,7,7:
}}$$

%An example of a binary tree, produced by user macros.

\newcount\cnx\newcount\cny\newcount\cnxx\newcount\cnyy

\def\treea#1{\cnxx=\cnx\cnyy=\cny
\ctv\cnx,\cny:{\scriptstyle #1}
\advance\cnx by -1\advance\cny by 4
\ctdot
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by 2
\cten\cnxx,\cnyy,\cnx,\cny:
\ctsolid
\cnx=\cnxx\cny=\cnyy}

\def\treeb#1{\ctv\cnx,\cny:{\scriptstyle #1}
\advance\cnx by -2\advance\cny by 4
\treea{#10}
\cnxx=\cnx\advance\cnxx by 2\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by 4
\treea{#11}
\cnxx=\cnx\advance\cnxx by -2\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by -2\advance\cny by -4}

\def\treec#1{\ctv\cnx,\cny:{\scriptstyle #1}
\advance\cnx by -4\advance\cny by 4
\treeb{#10}
\cnxx=\cnx\advance\cnxx by 4\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by 8
\treeb{#11}
\cnxx=\cnx\advance\cnxx by -4\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by -4\advance\cny by -4}

\def\treed#1{\ctv\cnx,\cny:{\scriptstyle #1}
\advance\cnx by -8\advance\cny by 4
\treec{#10}
\cnxx=\cnx\advance\cnxx by 8\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by 16
\treec{#11}
\cnxx=\cnx\advance\cnxx by -8\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by -8\advance\cny by -4}

\def\tree{\ctv\cnx,\cny:\bot\def\centerheight{2pt}
\advance\cnx by -16\advance\cny by 4
\treed{0}
\cnxx=\cnx\advance\cnxx by 16\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by 32
\treed{1}
\cnxx=\cnx\advance\cnxx by -16\cnyy=\cny\advance\cnyy by -4
\cten\cnxx,\cnyy,\cnx,\cny:
\advance\cnx by -16\advance\cny by -4}

$${\def\diagramunit{7.5pt}
\ctdiagram{\ctnohead\cnx=0\cny=0\tree}}$$

\end{document}
