<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%  This should appear in a file named SQMAC.TEX
\long\def\ig#1{\relax}
\ig{Thanks to Roberto Minio for this def'n.  Compare the def'n of
\comment in AMSTeX.}
\ig{      Copyright 1988 Michael Barr
          Department of Mathematics and Statistics
          McGill University
          Montreal, Quebec, Canada
          H3P 1S4
 
          inhb@mcgillc.bitnet
 
          All commercial rights reserved.  May be freely distributed
          for non-commercial use, so long as this notice is included.}
 
\setlength{\unitlength}{.1em}
 
\newlength{\ulabeloffset}
\newlength{\ulabelwidth}
\newlength{\arrowwidth}
\newlength{\lnodewidth}
\newlength{\rnodewidth}
\newlength{\loffset}
\newlength{\roffset}
 
\newcount\tarrowflag
\newcount\larrowflag
\newcount\rarrowflag
\newcount\barrowflag
\newcount\height
\newcount\width
\newcount\arrowlen
\newcount\labelheight
 
 
% The following is like \vector, except it makes a monic (tailed) arrow.
 
\def\mvector(#1,#2)#3
{
\begin{picture}(#3,#3)(-2,0)
\put(0,4){\vector(#1,#2){#3}}
\put(0,4){\vector(#1,#2){3}}
\end{picture}
}
 
% The following is like \vector, except it makes an epic (2-headed) arrow.
 
\def\evector(#1,#2)#3
{
\arrowlen #3
\begin{picture}(\arrowlen,\arrowlen)(-2,0)
\put(0,4){\vector(#1,#2){\arrowlen}}
\advance \arrowlen by -4
\put(0,4){\vector(#1,#2){\arrowlen}}
\end{picture}
}
 
 
\catcode`@=11 % unhide @sign definitions
 
\def\absvector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
\@linelen=#3
\ifnum\@xarg =0 \@vvector
  \else \ifnum\@yarg =0 \@hvector \else \@svector\fi
\fi}
 
\catcode`@=12 % @signs are no longer letters
 
\ig{This definition of \function below is a modification of one due to
Charles Wells whose idea it was to try to make the length of the arrow
depend on the sizes of the nodes.  Much elaborated, it forms the basis
of the square macro.}
 
\newcommand{\setwidths}[4]
{
\settowidth{\lnodewidth}{#1}
\settowidth{\rnodewidth}{#2}
\setlength{\loffset}{0.5\lnodewidth}
\setlength{\roffset}{0.5\rnodewidth}
\addtolength{\loffset}{3\unitlength} %allows a little space
\addtolength{\roffset}{3\unitlength} %before &amp; after the arrow
\setlength{\arrowwidth}{#4\unitlength}
\addtolength{\arrowwidth}{-\loffset}
\addtolength{\arrowwidth}{-\roffset}
\setlength{\ulabeloffset}{\loffset}
\settowidth{\ulabelwidth}{#3}
\advance\ulabeloffset by .5\arrowwidth
\advance\ulabeloffset by -.5\ulabelwidth
}
 
\newcommand{\dofunc}[4]
{
\setwidths{#1}{#2}{#3}{#4}
\begin{picture}(0,0)
\put(0,0){\makebox(0,0){#1}}
\put(-3,0){\hspace{\loffset}\absvector(1,0){\arrowwidth}}
\put(#4,0){\makebox(0,0){#2}}
\put(0,4){\hspace{\ulabeloffset}{#3}\hspace{\ulabeloffset}}
\end{picture}
}
 
 
% The four parameters are (lnode,rnode;label,width)
\def\func(#1,#2;#3;#4)
{   %begin func
\makebox(0,0){\dofunc{#1}{#2}{#3}{#4}
}%end box
}%end func
 
 
\ig{The next procedure is to set parameters for a square.  The six
parameters are all numbers.  The first 4 flag the four arrows of the
square as follows:
 
               top or bottom           left or right
                  arrow                    arrow
 
   &lt; -3       leftwards, normal         upwards, normal   ( &lt;----- )
     -3       leftwards, epic           upwards, epic     ( &lt;&lt;---- )
     -2       leftwards, monic          upwards, monic    ( &lt;----&lt; )
     -1       leftwards, normal         upwards, normal   ( &lt;----- )
      0       omitted                   omitted
      1       rightwards, normal        downwards, normal ( -----&gt; )
      2       rightwards, epic          downwards, epic   ( ----&gt;&gt; )
      3       rightwards, monic         downwards, monic  ( &gt;----&gt; )
    &gt; 3       rightwards, normal        downwards, normal ( -----&gt; )
 
In other words, when the parameter is positive, the arrow goes in the
ordinary (linguistic) direction and when negative, in the opposite
direction.  When the parameter is 0, the arrow is omitted.  When the
absolute valute of the parameter is 2, you get a monic (tailed) arrow
and when it is 3, you get an epic (double headed) arrow.  Any other
non-zero value gives an normal arrow.
 
The last 2 parameters, for which 60 and 70 are a reasonable values, are
the distance between the vertical, resp.  horizontal arrows in
increments of .1 em.
 
The procedure \resetparms sets the first 4 of these parameters to 1 and
the last two to 60 and 70.
 
NOTE: ONE OF THE PROCEDURES \setparms OR \resetparms SHOULD BE EXECUTED
BEFORE A SQUARE IS MADE.
 
The procedure \square takes 8 parameters, in the format
[#1`#2`#3`#4;#5`#6`#7`#8] which are in order,
[NW`NE`SW`SE;t`l`r`b], the first four being the nodes and the last four
the labels on the arrows.
 
The top and bottom arrows have their lengths automatically adjusted to
compensate for the widths of the nodes.  Thus 50 will be a reasonable
value for the width parameter, but only if the labels are not too long.
The examples below show how these squares may be fitted together to make
more complicated diagrams.  Although it may be possible in principle to
superimpose the joint arrow, it seems safer to omit one of them.  Minor
arithmetic errors might otherwise result in thick lines.  Note, in the
examples, the use of the procedure \phantom to make the arrow lengths
proper, while avoiding overlapping nodes.
 
Note the \hspace and \space used to properly space them.  I don't
understand the spacing rules used in picture mode to figure out how to
do these automatically and so they are determined by trial and error.  I
suspect they depend on the widths of the nodes and the heights of the
labels.  Also note the blank lines between the two squares in the second
example.  This is necessary for proper spacing.}
 
\ig{In case you are interested why I used the peculiar syntax for the
parameters, it is because I didn't like to type braces and I also didn't
want to use things like parens and commas that I am likely to use as
parts of nodes and arrows.  But feel free to change this syntax.}
 
\def\setparms[#1`#2`#3`#4;#5`#6]
{
\tarrowflag #1
\larrowflag #2
\rarrowflag #3
\barrowflag #4
\width #5
\height #6
}
 
\newcommand{\resetparms}
{
\tarrowflag1
\larrowflag1
\rarrowflag1
\barrowflag1
\width50
\height50
}
 
\resetparms %initializes defaults
 
\ig{The parameters are the nodes and arrows in linguistic order.
Note: if one of the nodes has an asscript, then the other one on
the same line must too. Use an empty box (e.g. blah_{}) if necessary.}
\def\square[#1`#2`#3`#4;#5`#6`#7`#8]%
{
\advance \height by 30
\begin{picture}(\width,\height)(0,4)
\arrowlen\height
\labelheight\height
\divide\labelheight by 2
\advance \height by -15
\advance \arrowlen by -44
 
\setwidths{#1}{#2}{#5}{\width}
\put(0,\height){\makebox(0,0){#1}}
\ifnum\tarrowflag&gt;0
   \put(-3,\height){\hspace{\loffset}\absvector(1,0){\arrowwidth}}
   \ifnum\tarrowflag=3
      \advance\arrowwidth by -4\unitlength
      \put(-3,\height){\hspace{\loffset}\absvector(1,0){\arrowwidth}}
   \fi
   \ifnum\tarrowflag=2
       \put(-1,\height){\hspace{\loffset}\absvector(1,0){\unitlength}}
   \fi
\else\ifnum\tarrowflag&lt;0
   \advance\loffset by \arrowwidth
   \put(-3,\height){\hspace{\loffset}\absvector(-1,0){\arrowwidth}}
   \ifnum\tarrowflag=-3
      \advance\arrowwidth by -4\unitlength
      \put(-3,\height){\hspace{\loffset}\absvector(-1,0){\arrowwidth}}
   \fi
   \ifnum\tarrowflag=-2
       \put(-5,\height){\hspace{\loffset}\absvector(-1,0){\unitlength}}
   \fi
\fi\fi
 
\put(\width,\height){\makebox(0,0){#2}}
\advance \height by 4
\put(0,\height){\hspace{\ulabeloffset}{#5}\hspace{\ulabeloffset}}
 
\advance \height by -11
\ifnum\larrowflag&gt;0
   \put(0,\height){\vector(0,-1){\arrowlen}}
   \ifnum\larrowflag=3
      \advance\arrowlen by -4
      \put(0,\height){\vector(0,-1){\arrowlen}}
      \advance\arrowlen by 4
   \fi
   \ifnum\larrowflag=2
      \advance \height by -2
      \put(0,\height){\vector(0,-1){1}}
      \advance \height by 2
   \fi
\else\ifnum\larrowflag&lt;0
   \advance\height by-\arrowlen
   \put(0,\height){\vector(0,1){\arrowlen}}
   \ifnum\larrowflag=-3
      \advance\arrowlen by -4
      \put(0,\height){\vector(0,1){\arrowlen}}
      \advance\arrowlen by 4
   \fi
   \ifnum\larrowflag=-2
      \advance \height by 2
      \put(0,\height){\vector(0,1){1}}
      \advance \height by -2
   \fi
   \advance\height by\arrowlen
\fi\fi
 
\ifnum\rarrowflag&gt;0
   \put(\width,\height){\vector(0,-1){\arrowlen}}
   \ifnum\rarrowflag=3
      \advance\arrowlen by -4
      \put(\width,\height){\vector(0,-1){\arrowlen}}
   \fi
   \ifnum\rarrowflag=2
      \advance \height by -2
      \put(\width,\height){\vector(0,-1){1}}
   \fi
\else\ifnum\rarrowflag&lt;0
   \advance\height by-\arrowlen
   \put(\width,\height){\vector(0,1){\arrowlen}}
   \ifnum\rarrowflag=-3
      \advance\arrowlen by -4
      \put(\width,\height){\vector(0,1){\arrowlen}}
      \advance\arrowlen by 4
   \fi
   \ifnum\rarrowflag=-2
      \advance \height by 2
      \put(\width,\height){\vector(0,1){1}}
      \advance \height by -2
   \fi
\fi\fi
 
\put(-3,\labelheight){\makebox(0,0)[r]{#6}}
\advance \width by 3
\put(\width,\labelheight){\makebox(0,0)[l]{#7}}
\advance \width by -3
 
\setwidths{#3}{#4}{#8}{\width}
\put(0,15){\makebox(0,0){#3}}
\ifnum\barrowflag&gt;0
   \put(-3,15){\hspace{\loffset}\absvector(1,0){\arrowwidth}}
   \ifnum\barrowflag=3
      \advance\arrowwidth by -4\unitlength
      \put(-3,15){\hspace{\loffset}\absvector(1,0){\arrowwidth}}
   \fi
   \ifnum\barrowflag=2
      \put(-1,15){\hspace{\loffset}\absvector(1,0){\unitlength}}
   \fi
\else\ifnum\barrowflag&lt;0
   \advance\loffset by \arrowwidth
   \put(-3,15){\hspace{\loffset}\absvector(-1,0){\arrowwidth}}
   \ifnum\barrowflag=-3
      \advance\arrowwidth by -4\unitlength
      \put(-3,15){\hspace{\loffset}\absvector(-1,0){\arrowwidth}}
   \fi
   \ifnum\barrowflag=-2
       \put(-5,15){\hspace{\loffset}\absvector(-1,0){\unitlength}}
   \fi
\fi\fi
\put(\width,15){\makebox(0,0){#4}}
\put(0,7){\hspace{\ulabeloffset}{#8}\hspace{\ulabeloffset}}
\end{picture}
}
� SMTPUSER HMCVAX  5/14/88
� INHB@MCGILLC.BITNET DHOSEK@HMCVAX.BITNE  5/14/88 No subject
</pre></body></html>