%
%               =========================================
\title          {       Commutative Diagrams in \TeX\   %
                                (version 4)}
%               |                                       |
%               |                   by                  |
%               |                                       |
\author     {{\bf               Paul Taylor             }\\
%               =========================================
%
                        Department of Computing,\\
           Imperial College of Science, Technology and Medicine,\\
                   180 Queen's Gate, London SW7 2BZ \\
                            +44 71 594 8263\\
                        {\tt<pt@doc.ic.ac.uk>}\\
                FTP: {\tt theory.doc.ic.ac.uk} (146.169.2.27)}
%
\date                           {12 July 1994}
%
\def\abstracttext
        {\TeX\ and \LaTeX\ have become standard as a way of writing papers
        in Computer Science and Category Theory.
        Even in source form they are easier to compose and read than
        attempts to write mathematics in ASCII.  In~Category Theory
        ``commutative diagrams'' are essential for a clear visual
        understanding of the paper, but the graphics capabilities of \TeX\
        are so limited that it is very difficult to draw them nicely, if at
        all. This manual describes a new but reverse-compatible version of
        a package to draw such diagrams, expressed in a language in which many
        users have already found it very easy to express themselves.}
%
% ===============================================================
\documentstyle{article}
\makeatletter
\def\pt@input#1#2#3{\openin1 #1 \ifeof1 \typeout{#2}#3%
  \else\closein1 \relax\input #1 \fi}%
%
% Read the diagram macros file, saving the banner from the top.
\let\messagex\message
\def\getbanner<#1>{\def\banner{#1}}%
\def\message#1{\getbanner#1\let\message\messagex\message{#1}}%
\pt@input{diagrams}%
{I can't find the commutative diagrams package,
so I can't process the manual!}\endinput
\ifx\newarrow\undefined
\message{This manual cannot be processed by any version earlier than 3.24.}%
\message{Please get an up-to-date version from theory.doc.ic.ac.uk.}%
\expandafter\endinput\fi
%
%  **********************************************************
%  * You can experiment with changing the following options *
%  *  as explained in the "Options" section of this manual. *
%  **********************************************************
%
\diagramstyle[tight,centredisplay%
,dpi=300%              300dpi is default; applies to most laser-printers
%,dpi=212%               for two-up (A4 on A5) reduction of 300dpi
%,noPostScript%
,noPostScript=Rokicki%
%,TPIC%
,heads=LaTeX%
%,heads=vee%
%,heads=triangle%
%,heads=curlyvee%       uses AMS symbols
%,heads=littlevee%
%,heads=boldlittlevee%   needs good-bold-math below
%,heads=littleblack%    uses AMS symbols
%,heads=blacktriangle%  uses AMS symbols
]
% The boldhook tails and boldlittlevee heads use sizes of cmsy and cmmi
% fonts which you may not have available. In this case, please change
% the following to \havegoodboldmathfalse.
\newif\ifhavegoodboldmath\havegoodboldmathtrue
%
% ===============================================================
% ===============================================================
% Try to read various non-essential auxiliary input files.
%
\iftrue
   \ifx\ds@amssymb\undefined
   \ifx\ds@mssymb\undefined
   \ifx\ds@amssymbols\undefined
   \pt@input{amssymb.sty}{}{%
   \pt@input{mssymb.tex}{}{%
   \pt@input{amssymbols.sty}%
   {Some of the arrowheads in the diagrams package use symbols from the extra
   ^^Jfonts (msxm/msym or msam/msbm) provided by the American Mathematical
   Society.^^JYou can get these by anonymous FTP from e-math.ams.com and
   elsewhere.
   ^^JIn this manual the relevant examples will just be left out.^^J}{}}}%
   \else\ds@amssymbols\fi\else\ds@mssymb\fi\else\ds@amssymb\fi
   \makeatletter % old versions of mssymb b*gg*r up \catcode`\@
\fi
%
\pt@input{a4.sty}%
{^^JThis manual was written for European A4 paper, but you do not have a4.sty.
^^JYou'll get lots of Over-full \string\hbox'es, but don't worry.
It doesn't matter.^^JWe can carry on without any real harm.}{}%
\advance\textheight 5mm
%
\def\AMS{$\cal A$\kern-.1667em\lower.5ex\hbox{$\cal M$}\kern-.125em$\cal S$}
\def\AmSTeX{\AMS-\TeX}
\def\LAMSTeX{L\raise.42ex\hbox{\kern-.3em\the\scriptfont2 A}%
                 \kern-.2em\lower.376ex\hbox{\the\textfont2 M}%
                 \kern-.125em {\the\textfont2 S}-\TeX}
\def\AMSLaTeX{\AMS-\LaTeX}
\def\LaTeXe{\mbox{\LaTeX\kern.15em$2_{\textstyle\varepsilon}$}}
%
%  I prefer paragraphs spaced rather than indented
\parskip=2pt plus 2pt minus 1pt
%  and I don't like hyphenation
\spaceskip=.5em plus .6em minus .2em
\pretolerance=2000
\binoppenalty=2000
\relpenalty=1500
%  Penalty for splitting paragraphs
\interlinepenalty=150
\predisplaypenalty=10000
\postdisplaypenalty=400
\@beginparpenalty=\predisplaypenalty
%
%
%\let\@mkboth\markboth
\def\@oddfoot{}%
\def\@evenfoot{}%
\def\@evenhead{{\bf\thepage}\hfil{\rm\topmark}}%
\def\@oddhead{{\rm\banner}\hfil{\bf\thepage}}%
\def\sectionmark#1{\mark{\S\thesection. #1}}%
%\def\section@mark#1{\markboth{#1}{\banner}}%
\@twosidetrue
%
%
\let\volx\relax % for ltugbot.sty
\newcommand{\bsl}{$\backslash$}
%

\newarrow{Congruent}33333
\newarrow{Curlyto}----{curlyvee}
\newarrow{TeXto}----{->}
\newarrow{TeXonto}----{->>}
\newarrow{Blackinto}{blacktriangle}--->
\newarrow{Openinto}{triangle}--->
\newarrow{EEmbedd}{>>}---{>>}
\newarrow{Corresponds}<--->
\newarrow{Backwards}<----
\newarrow{Multi}----o
\newarrow{Crossto}----X
\newarrow{Partial}----{harpoon}
\newarrow{Into}{\ifhavegoodboldmath bold\fi hook}--->

%=================================================================
%
%               verbatim array
%
%=================================================================


% This defines two new LaTeX environments: verbarray and verbdiag.

% The first is like the verbatim environment, except that it treats each
% cell of an array individually, centring the text within aligned &s. The two
% arguments specify the text to be used for & and \\.  Because of the
% eager parsing at the beginning of a cell, \relax is needed before
% commands that expand to anything other than their own text.
% For example,
%   \begin{verbarray}{\ \&\ }{\ \string\\ \ }
%   A&\relax\rTo^f&B\\
%   \relax\dTo^g&&\relax\dTo^h\\
%   C&\relax\rTo^k&D
%   \end{verbarray}
% produces the contents of a simple diagram.

% The second packages this to produce a verbatim diagram, ie it encloses
% the text in ``\begin{diagram}'' and ``\end{diagram}''. Any text which
% follows ``\begin{verbdiag}'' on the same line is copied verbatim after
% \begin{diagram}.

% Here is a list of the characters that have been specially catcoded
% except &  [adapted from plain.tex]
\def\dospecialsexceptand{\do\\\do\{\do\}\do\$%
  \do\^\do\^^K\do\_\do\^^A\do\%\do\~}
% (not counting ascii null, tab, linefeed, formfeed, return, delete)
% Each symbol in the list is preceded by \do, which can be defined
% if you want to do something to every item in the list.

\def\lverbcell{\begingroup \catcode``=13 \@noligs 
\tt \let\do\@makeother \dospecialsexceptand \dolverbcell}
\def\dolverbcell#1\rverbcell{#1\endgroup}

\def\verbarraycr{\omit{\verbarraycrstring}\cr}

\newenvironment{verbarray}[2]%
{\abovedisplayskip\z@ \abovedisplayshortskip\abovedisplayskip
\belowdisplayskip\abovedisplayskip\belowdisplayshortskip\abovedisplayskip
$$\hss\vbox\bgroup
\tabskip\z@
\let\\\verbarraycr\edef\verbarraycrstring{#2}%
\halign\bgroup
\hfil\lverbcell##\rverbcell\hfil&&{#1}\hfil\lverbcell##\rverbcell\hfil\cr
%$$
}%
{%$$
\verbarraycr\egroup\egroup\hss$$}

\def\ke{\kern.25em}

\newenvironment{verbdiag}%
{\begin{pageblock}%
  \vspace{2ex}%
  \let\do\@makeother
  \def\beginverbdiag{\begin{verbarray}{\ke\tt\&\ke}{\ke\string\\}}%
  \noindent\tt\string\begin\{diagram\}
  \bgroup\aftergroup\beginverbdiag\let\par\egroup
  \obeylines\dospecials
}%
{\end{verbarray}%
  \string\end\{diagram\}%\$\$
  \vspace{2ex}%
  \end{pageblock}%
}

\newenvironment{clean}{}{}
\newenvironment{pageblock}{\vbox\bgroup}{\egroup}

\makeatother
%=============================================================================
%=============================================================================
%=============================================================================

\begin{document}
\maketitle
\begin{abstract}\noindent\abstracttext\end{abstract}

\section{Introduction}
In papers in mathematics and computer science which employ Category Theory,
there is much benefit in clarity if ``commutative diagrams'' are used as
much as possible to illustrate definitions, equations and universal
properties.  Here is a typical such diagram: it is one of the
Mac~Lane-Kelly equations.
\def\Id{{\rm id}}\def\Assl{{\rm assl}}%
\begin{diagram}[width=6em]
A*(B*(C*D))&\relax\rTo^\Assl&(A*B)*(C*D)&\relax\rTo^\Assl&((A*B)*C)*D\\
\dTo^{\Id*\Assl} &       &   =    &      &\relax\uTo_{\Assl*\Id}\\
  A*((B*C)*D)  &       &\relax\rTo^\Assl &      &  (A*(B*C))*D\\
\end{diagram}
This manual describes version~4 of the author's package for drawing 
diagrams line this in (plain) \TeX\ or \LaTeX.
Version~3 is already very widely used in
the Category Theory and Theoretical Computer Science communities.
Most of the underlying code has been rewritten, with a great improvement to
the appearance of the diagrams, but it remains compatible with the previously
developed and very popular straightforward language.

\section{Design Criteria}
Drawing such a diagram using the \LaTeX\ \verb/picture/ environment takes
about sixty lines of code, though some saving is possible (with the positioning
of labels on arrows) by means of some simple macro programming.
To get the arrows to match up neatly with the objects takes quite a lot of
experimentation, and the whole job has to be repeated with each new diagram
or each modification.
Again, the use of macros for commonly occurring diagrams such as squares and
triangles can save effort, but this does not postpone the difficulty very
far, because as soon as we want to draw a slightly more complicated diagram
we're back to square one.

The now widespread use of workstations with big screens and ``personal''
computers has lead to a kind of religious fervour that a mouse with at most
three buttons is always easier to use than a keyboard with maybe over a hundred.
This might be so if the tracking software were accurate and could use telepathy
to ascertain what the user wanted, but in reality the attempts I have seen to
``draw it on the screen'' and include the result in a \TeX\ document have
looked as professional as what children bring home from their first
day at school. My view is, if you want {\em wysiwyg,} use pen and paper!

Besides the awful results, mouse-driven methods take longer and are less
portable. If you want to write a joint paper with a colleague on the other
side of the world, it is a great deal simpler to send a single ascii file
by electronic mail than to package twenty of them (including one file per
diagram as well as the main text) encoded in some weird commercial binary
format.

On the basis of these remarks, the design criteria of this package are as
follows:

\begin{enumerate}

\item The entire diagram must form part of the source of the document itself.
In other words, there must be no preprocessing 
({\em cf.}~{\tt eqn} in {\sc Unix})
or inclusion of files (such as {\sc PostScript} pictures).

\item Simple diagrams must be able to be drawn ``on the fly'' and not
need to be drawn on paper first.
Obviously, complex diagrams will already have been worked out on paper anyway.

\item The layout of the source code must resemble the intended
diagram as far as syntactically possible.

\item There must be no measuring of labels to calculate co-ordinates
or lengths of arrows.

\item There must be a variety of arrow styles, with facilities for
defining new ones.
Diagonal arrows (which, through lack of appropriate primitives,
\TeX\ makes very difficult to draw) should be provided at various
slopes, albeit with limited choice and features.

\item The package must be compatible both with {\tt plain}~\TeX\ and
with \LaTeX, and not rely on non-standard fonts\footnote{Diagonal lines
can {\em only\/} be drawn using \LaTeX's {\tt line10} and {\tt linew10}
fonts, and for exotic arrow styles the AMS maths symbols fonts may be
useful: we regard these as standard.} or language features.

\item Future versions which improve the appearance of the diagrams
must, as far as possible, be compatible with past papers written using the
package --- but you hack at your own risk!

\end{enumerate}

\noindent In addition there are {\ae}sthetic criteria,
some of which may be a matter of opinion:

\begin{itemize}

\item Arrows should stretch to meet the objects which are intended to
be their endpoints.

\item Arrows should be aligned (both horizontally and vertically)
with the centres of the objects.

\item Labels on arrows should not affect the spacing of the diagram
except to avoid overlapping.

\item Stretching of arrows should not affect the centring of their
labels.

\end{itemize}

%=================================================================
%
%               my version
%
%=================================================================

\section{Typing the diagram}\label{typing}

The diagram above is produced in \LaTeX\ as follows:

\vskip2ex

\begin{pageblock}
\noindent\verb/\input diagrams/\\
\verb/\def\Assl{{\rm assl}}\def\Id{{\rm id}}/\\[-2ex]
\begin{verbdiag}
A*(B*(C*D))&\relax\rTo^\Assl&(A*B)*(C*D)&\relax\rTo^\Assl&((A*B)*C)*D&\\
\relax\dTo^{\Id*\Assl}&&=&&\relax\uTo_{\Assl*\Id}&\\
A*((B*C)*D)&&\relax\rTo^\Assl&&(A*(B*C))*D&
\end{verbdiag}
\end{pageblock}
In {\tt plain} \TeX\ you do the same thing,  writing \verb/\diagram/ and
\verb/\enddiagram/ wherever we have \verb/\begin{diagram}/ and
\verb/\end{diagram}/.

In \LaTeXe\ you can put
\begin{verbatim}
\usepackage{diagrams}
\end{verbatim}
in place of the \verb/\input/ command, but you have to rename or alias
the file to \verb/diagrams.sty/.

The basic rule is to divide the diagram into cells,
\diagram[height=1em,width=0pt,loose,textflow]
%&&\relax\ && \ && \ && \ \\%39
&A*(B*(C*D))&&\rTo^{\qquad\Assl\qquad}&&(A*B)*(C*D)&&
\rTo^{\qquad\Assl\qquad}&&((A*B)*C)*D\\%38
\ &\HonV&&&& \rDots &&&&\HonV& \ \\%37
\\
&\dTo[abut]^{\Id*\Assl} &
        \uDots && \uDots &=& \uDots && \uDots &
        \uTo[abut]_{\Assl*\Id}\\%36
\\
\ &\HonV&&&& \rDots &&&&\HonV& \ \\%35
&A*((B*C)*D) & & & & \rTo_\Assl & & & & (A*(B*C))*D \\%34
%&& \ && \ && \ && \ \\%33
\enddiagram
just like the cells of a matrix, and then type the contents
of the cells with columns delimited by ``{\tt\&}'' and rows by
``\verb/\\/''. The bottom arrow extends through the empty cells either
side of~it. Notice that although the matrix imposes a kind of co-ordinate
system, the widths of the columns and the heights of the rows are variable
and chosen automatically --- by \TeX, in the same way as it does for matrices,
tables,~{\it etc.}

At first you will probably need to draw the diagram carefully on paper and
divide it into cells in this way before typing it in.
The main difficulty is working out how many \verb/&/s to insert;
for this it is useful to observe that {\em in the simplest cases\/}%
   \footnote{The bottom arrow disobeys this rule, since it goes across
   three columns.}
\begin{itemize}
\item objects and verticals go in odd-numbered columns, and
\item horizontals and diagonals go in even-numbered columns.
\end{itemize}
Then, of course, you need an even number of \verb/&/s between columns
of the same parity and an odd number between different ones.
After a little practice you'll learn other rules of thumb,
but even if you make a mistake, the DVI previewer will make it clear how
to correct~it.
Error messages about {\em clashing\/} or {\em unterminated\/} arrows indicate
that something is wrong without previewing.

Each cell should contain {\it either\/} an object (an~ordinary
mathematical expression, set in maths mode) {\it or\/}~a~morphism
(an~arrow such as \verb/\rTo^f/). Horizontal and vertical arrows cannot
be mixed in one cell; moreover only one horizontal arrow per cell is allowed,
but see the section~\ref{parallels} on parallel maps below.

The horizontal and vertical arrows extend through the empty cells either
side until they meet a non-empty cell, just like the rook (castle) in chess.
For this purpose anything other than white space (space, tab and newline),
comments (\verb/%/) and \verb/\empty/ in the source make a cell non-empty
For example \verb/\null/, \verb*/\ / or \verb/{}/ may be used to terminate
arrows: it's not necessary that anything be printed.
If you don't terminate an arrow, it will extend to the edge of the diagram,
but just exactly where the ``edge'' {\em is}, particularly the right one,
will be determined somewhat arbitrarily.

The chess rule does not apply to diagonals, whose endpoints are specified
differently: see section~\ref{diagonals}.

Do not enclose the arrow commands in boxes or braces, because this
prevents the automatic stretching from working.

The {\em horizontal\/} arrow commands (including \verb/\pile/) may also be
used in text, $A \rTo^f B$.
Since there is no enclosing matrix, this is written
as \verb/$A \rTo^f B$/ {\em without\/}~\verb/&/.
You still need the dollars because it's still a mathematical expression.
Arrows participate in the horizontal stretching and shrinking of spaces
between words in a paragraph, but of course their labels also stretch the
space between lines.

The arrow commands are {\em fragile\/} in the \LaTeX\ sense:
if you want to use them in section headings you must \verb/\protect/ them.


%===========================================================================

\section{Labels}

Each arrow  carries up to three labels, whose position is specified
analogously to superscripts%
   \footnote{However they are {\em not\/} recognised syntactically in the
   same way, and so for instance {\tt\bsl nolimits} will not work.
   The sub- and superscript characters are recognised by their
   {\tt\string\catcode}s, so {\tt\string\sp} and {\tt\string\sb} will work,
   but the others are compared using {\tt\string\ifx}, so have to be the
   same characters, with the same {\tt\string\catcode}s as when
   {\tt diagrams.tex} was read in. The {\tt Sb} and {\tt Sp} environments
   in \AmSTeX\space and \AMSLaTeX\space will not work, and the text of the
   label itself must be either a single token or be explicitly enclosed in
   {\tt\string{\string}} or {\tt\string\bgroup\string\egroup}.}
by
\begin{center}
\vskip-2ex
\verb/^/ above,\qquad \verb/_/ below,\qquad \verb/</ left,\qquad
\verb/>/ right\qquad and\qquad \verb/~/ middle.
\end{center}
For reverse compatibility, above=left and below=right for vertical arrows.
Very old versions of the package used positional arguments; these are also
still supported, but {\em must be enclosed in braces, e.g.\/}~\verb/\rTo{f}{g}/
but not \verb/\rTo f g/.

Explicitly, the labels are placed as follows:
\begin{itemize}
\item for {\bf horizontal} arrows, \verb/\rTo^f_g/ and \verb/\rTo{f}{g}/
   give \smash{$\mathop{\longrightarrow}\limits^f_g$};
\item for {\bf vertical} arrows, \verb/\dTo <f >g/, \verb/\dTo^f_g/ and
   \verb/\dTo{f}{g}/ give $f{\big\downarrow}g$;
\item for {\bf positive\/} gradient {\bf diagonal} arrows, \verb/\ldTo^f_g/,
   \verb/\ldTo <f >g/ and \verb/\ldTo{f}{g}/ all give
   ${}^f\!\!\!\!\swarrow\!\!\!\!_g$ (similarly \verb/\ruTo/).
\item but for {\bf negative\/} gradient arrows, above=right and below=left,
   so \verb/\rdTo^f_g/, \verb/\rdTo <g >f/ and \verb/\rdTo{f}{g}/ give
   ${}_g\!\!\!\searrow\!\!\!^f$ (similarly \verb/\luTo/);
\item Using tilde, the label may instead {\bf break} the arrow: \verb/\rTo~f/
   gives \hbox to5em{$A\rTo~{\textstyle f}B$}.
   If~the arrow had a middle, the label would replace~it.
   This is sometimes useful to preserve the symmetry of a diagram with three
   verticals.
\end{itemize}
Although the arrows extend into adjacent cells, the labels on horizontal and
vertical maps remain centred {\em in~the cell in which the arrow was declared.}

Any ordinary (mathematical) text you put in the cell with an arrow will
appear in the usual way:
\begin{itemize}
\item For horizontal arrows it will therefore be attached to the arrowhead
  or tail.

  This offers a simple way of annotating the head of an arrow, for example
  \begin{quote}
    \verb/$ A \rTo^f \relax ^*  B  {}_s \lTo_g C$/\quad gives\quad
     $ A \rTo^f \relax ^* B  {}_s \lTo_g C$.
  \end{quote}
  where \verb/\relax/ is needed to stop \verb/\rTo/ from reading \verb/^*/
  as another label and \verb/{}/ serves as an object to which $s$ is
  subscripted.
  The spacing in this example is not entirely satisfactory, because
  \verb/\rTo/ and \verb/\lTo/ generate the \verb/shortfall/ spacing as
  part of themselves and regard everything else as their targets.
  You can use \verb/\!/ and \verb/\;/ commands to compensate for this,
  remembering that should you subsequently change the \verb/shortfall/
  amount then you must also adjust the compensation.

  An alternative way of doing this is to define a new arrow command:
  section~\ref{newarrow} explains how.

  Don't make a habit of putting \verb/\relax/ after arrow commands:
  it can lead to gaps in short double-shafted arrows, for reasons which
  are too complicated to explain here.
\item For vertical and diagonal arrows additional text will lie to the
  side of (or between) the arrows.
  In the case of verticals this is at the same height as the middle and labels
  of the arrows; see section~\ref{parallels}.
\end{itemize}

By default the labels on the arrows are set in \verb/\textstyle/ 
(the same size as in text) when they are part of a matrix, and in
\verb/\scriptstyle/ (like subscripts) in text. However this may be changed
by re-defining the command \verb/\labelstyle/, for instance
\begin{quote}
\begin{verbatim}
\begin{displaymath}
\renewcommand\labelstyle{\scriptscriptstyle}
\begin{diagram}
A &\rTo^{\sum^n_1 f_i}_{\rm scriptscript} & B
\end{diagram}
\qquad
...
\end{displaymath}
\end{verbatim}
\end{quote}
\noindent gives \vadjust{\vskip-4ex}%
\begin{displaymath}
\hss\begin{diagram}[inline,labelstyle=\scriptscriptstyle]
A & \rTo^{\sum^n_1 f_i}_{\rm scriptscript} & B
\end{diagram}
\qquad
\begin{diagram}[inline,labelstyle=\scriptstyle]
A & \rTo^{\sum^n_1 f_i}_{\rm script} & B
\end{diagram}
\qquad
\begin{diagram}[inline,labelstyle=\textstyle]
A & \rTo^{\sum^n_1 f_i}_{\rm text} & B
\end{diagram}
\qquad
\begin{diagram}[inline,labelstyle=\displaystyle]
A &\relax\rTo^{\sum^n_1 f_i}_{\rm display} & B
\end{diagram}
\hss\end{displaymath}
Similarly, objects are set in \verb/\displaystyle/ unless the
\verb/\objectstyle/ command is redefined.

%===========================================================================

\section{The Cube}
The cube offers a good example of how horizontal and vertical arrows
stretch. Notice how the cells have been sub-divided further to give the
``3D'' effect, and that the positions of the labels on the maps betray
the cells in which they were declared.
Because of the sub-division, the parity rule for the column in which the
horizontal arrows go has broken down.
You should now formulate for yourself a new rule of thumb
for the cases when you need one, two, three or four \verb/&/s between
two commands.

\begin{verbdiag}
A'&&\relax\rTo^{f'}&&B'&&&\\
&\relax\rdTo_a&&&\relax\vLine^{h'}&\relax\rdTo_b&&\\
\relax\dTo^{g'}&&A&\relax\rTo^f&\relax\HonV&&B&\\
&&\relax\dTo^g&&\relax\dTo&&&\\
C'&\relax\hLine&\relax\VonH&\relax\rTo^{k'}&D'&&\relax\dTo_h&\\
&\relax\rdTo_c&&&&\relax\rdTo_d&&\\
&&C&&\relax\rTo^k&&D&
\end{verbdiag}

The broken lines ($h'$~and~$k'$) are simply two arrows. The commands
\verb/\HonV/ (``horizontal on vertical'') and \verb/\VonH/ (``vertical
on horizontal'') allow arrows in one direction to pass through, whilst
obstructing arrows in the other direction as if an object were present.
They each have an optional argument: \verb/\HonV[=]/ and \verb/\VonH[\|]/
should be used to allow extra space for double lines.
An~alternative is to declare the ``front'' line in the intersection cell,
where it will have the effect of obstructing the other arrow, but I~do
not recommend this.

There is also a command \verb/\HmeetV/ which causes single horizontal and
vertical lines to meet, forming a corner.
\begin{diagram}[notextflow]
   A'  &    &\rTo^{f'} &      &   B'   \\
      & \rdTo_a &      &      & \vLine^{h'}& \rdTo_b  \\
\dTo^{g'} &    &   A   & \rTo^f  & \HonV   &    &  B  \\
      &    & \dTo^g  &      & \dTo   \\
   C'  & \hLine & \VonH   & \rTo^{k'} &   D'   &    & \dTo_h \\
      & \rdTo_c &      &      &      & \rdTo_d  \\
      &    &   C   &      & \rTo^k  &    &  D  \\
\end{diagram}
You should soon be able to read and compose the source of
these diagrams as easily as the printed version, although one would not
normally go to the trouble of aligning the \verb/&/s in the source code!%
\footnote{To do so neatly in this manual required special programming: the
{\tt verbatim} environment produced unsatisfactory results.}

%==========================================================================

\section{Parallel arrows}\label{parallels}
You can draw two arrows between the same two vertices,
including extra things like 2-cells ($\Downarrow$, \verb/\Downarrow/),
the adjoint symbol ($\dashv$, \verb/\dashv/) in between.
Peter Freyd's \verb/\puncture/ symbol is also defined in the diagrams
package. 

\begin{verbdiag}
A&\relax\pile{\rTo^f\\
\puncture\alpha \\
\rTo_g}&B&\\
\relax\dTo^h\dashv\uTo_k&&&\\
C&&&
\end{verbdiag}

\vskip-4ex
\diagram
A & \pile{ \rTo^f \\ \puncture\alpha \\ \rTo_g } & B \\
\dTo^h \relax\dashv \uTo_k \\
C \\
\enddiagram

{\bf Horizontal} arrows may be \verb/\pile/d on top of each other.
Effectively, a one-column diagram is created, which may have {\em either\/}
a horizontal arrow {\em or\/} an object in each row. This works both
in diagrams and in text. The spacing (\verb/\baselineskip/) between the rows
is {\em half\/} of that specified by the \verb/pilespacing/ option,
on the assumption that you will put something
between parallel arrows; a blank line (\verb/\\ \\/) will suffice, then
the spacing is the same as that for vertical arrows.

{\bf Vertical} arrows may simply be put together in the same cell,
with any text between them. The spacing is always that given by
\verb/\pilespacing/.
(\verb/\pile/ must not be used.)

{\bf Diagonal} lines are currently implemented as fixed (non-stretching)
boxes and can therefore be juxtaposed, separated with explicit space and 
moved with \verb/\raise/ or \verb/\raisebox/ commands.
\begin{quote}
\verb/\raise 5pt \hbox{$\ldTo^R$}\rightthreetimes\raise-5pt\hbox{$\ruTo^L$}/
\end{quote}
However this will be incompatible with future versions;
there is an error message (``you must not put arrows in braces'')
to warn you of this but you can ignore it for the time being.

%==========================================================================
\section{Defining arrow styles}\label{newarrow}
It is easy to define other arrows besides the basic line with arrowhead given
by \verb/\rTo/ and friends. For example,

\vskip-3\baselineskip

\ifx\twoheadrightarrow\undefined % a typical AMS symbol name
  \let\amsarrows\empty
\else\def\amsarrows{%
  TeXonto&----\{->>\}&\rTeXonto\cr
}\fi

\ifhavegoodboldmath
  \def\boldarrows{CrossedInto&\{boldhook\}-+->&\rCrossedInto\cr}%
  \newarrow{CrossedInto}{boldhook}-+->
\else
  \def\boldarrows{CrossedInto&C-+->&\rCrossedInto\cr}%
  \newarrow{CrossedInto}C-+->
\fi

\begin{quote}\leavevmode
\vbox{\halign{\tt\string\newarrow\kern2pt\{#\}\kern2pt\hfil&\tt#\quad\hfil&%
   $#$\cr\omit&&\omit\kern80pt\cr
  To&---->&\rTo\cr
  Line&-----&\rLine\cr
  Embed&>--->&\rEmbed\cr
  Onto&----\{>>\}&\rOnto\cr
  EEmbedd&\{>>\}---\{>>\}&\rEEmbedd\cr
  Dotsto&....>&\rDotsto\cr
  Dashto&\{\}\{dash\}\{\}\{dash\}>&\rDashto\cr
  Corresponds&<--->&\rCorresponds\cr
  \boldarrows
  Implies&====\{=>\}&\rImplies\cr
  Mapsto&|--->&\rMapsto\cr
  Into&C--->&\rInto\cr
  Openinto&\{triangle\}--->&\rOpeninto\cr
  Congruent&33333&\rCongruent\cr
  TeXto&----\{->\}&\rTeXto\cr
  Backwards&<----&\rBackwards\cr
  Multi&----o&\rMulti\cr
  Crossto&----X&\rCrossto\cr
  Partial&----\{harpoon\}&\rPartial\cr
  \amsarrows
}}\end{quote}
\noindent Note that the
\ifx\twoheadrightarrow\undefined\else\verb/{->>}/, \fi
\verb/{harpoon}/, \verb/{->}/ and \verb/{=>}/ heads
use \TeX's \verb/\rightharpoondown/ ($\rightharpoondown$), \verb/\rightarrow/
($\rightarrow$) and \verb/\Rightarrow/ ($\Rightarrow$) symbols, consisting
of heads {\em with shafts.}
\ifhavegoodboldmath
   Also, the \verb/boldbook/ tail uses \LaTeX's \verb/\boldmath/:
\else
   There is also a \verb/boldhook/ tail, which is not shown because the
   appropriate fonts were not available when this copy of the manual
   was printed:
\fi
please see the note about \verb/heads=littlevee/ in section~\ref{options}.
The \verb/hook/ and \verb/C/ tails are the same.

Each declaration
\begin{center}
\verb/\newarrow{/{\em Name\/}\verb/}{/{\em tail\/}\verb/}{/{\em filler\/}%
\verb/}{/{\em middle\/}\verb/}{/{\em filler\/}\verb/}{/{\em head\/}\verb/}/
\end{center}
defines eight arrow commands
$$\vcenter{\advance\hsize-2.5\baselineskip\advance\hsize-6em
  \halign{\tt\bsl#\it Name\quad\hfil&#\hfil\quad or\quad&#\hfil\cr
  r&right&east\cr
  l&left&west\cr
  d&down&south\cr
  u&up&north\cr
  ru&right \& up&northeast\cr
  rd&right \& down&southeast\cr
  lu&left \& up&northwest\cr
  ld&left \& down&southwest\cr
}}\qquad\qquad
  \begin{diagram}[vcentre,inline,size=1.75\baselineskip,abut,shortfall=4pt]
   \hbox{\tt lu}&&\hbox{\tt u}&&\hbox{\tt ru}\\
   &\luTo[lowershortfall=2pt]&\uTo[lowershortfall=2pt]&
     \ruTo[lowershortfall=2pt]\\
   \hbox{\tt l}&\lTo[rightshortfall=2pt]&\vcenter{}&\rTo[leftshortfall=2pt]&
     \hbox{\tt r}\\
   &\ldTo[uppershortfall=2pt]&\dTo[uppershortfall=2pt]&
     \rdTo[uppershortfall=2pt]\\
   \hbox{\tt ld}&&\hbox{\tt d}&&\hbox{\tt rd}
  \end{diagram}$$
from the five named components.

Some but not all of the names given in the examples above are defined in the
source of the package as distributed.
However this is only really intended for reverse compatibility, because
just as it is better to define a macro \verb/\isomorphic/ for the
symbol $\cong$ (if that is what you use it to mean) than to write
\verb/\cong/ in your documents, so it is advisable to define the arrow
command names in the file where you keep your private collection of symbols.

For example, if in your subject there are special kinds of functions known
standardly as immersions, inclusions and internalisations and written as
$\rInto$, $\rEmbed$ and $\rOpeninto$, then you should define
\verb/\rImmerse/, \verb/\rInclude/ and \verb/\rInternalise/ instead of
using the names \verb/\rInto/, \verb/\rEmbed/ and \verb/\rOpeninto/.
The motto is {\em what you see is what you mean\/}!
This avoids  remembering or getting confused about the so-called
standard macro names, and also enables you to change your mind about the
notation if it is not standard but subject to experimentation.

The components as given in the \verb/\newarrow/ command are mnemonics,
which are themselves defined using the commands
\begin{center}
\verb/\newarrowhead/, \verb/\newarrowtail/, \verb/\newarrowfiller/
and \verb/\newarrowmiddle/.
\end{center}
Most of the characters in the standard \TeX\ Computer Modern fonts which
are appropriate for these components have already been used in the package
and are illustrated above.
If you wish to define other components, the examples at the end of the
source show how to do this.
If you are doing this with publicly available fonts, please contribute
them for the benefit of other users by sending the definitions to me by
electronic mail.
It is in your interests to do so --- and to confine use of these four
component-declaration commands to a single macro file --- because a more
elaborate syntax may be used in future to facilitate adjustment of
positioning. The \verb/\newarrow/ command itself, however, will remain
as it is.

The components \verb/>/, \verb/{>>}/, \verb/</, \verb/{<<}/, \verb/x/,
\verb/+/, \verb/O/ and \verb/o/ can be used both as heads (fifth position)
and tails (first).
The declaration \verb/<----/ defines \verb/\rBackwards/ to be a left-ward
pointing arrow and \verb/\lBackwards/ to point right;
this is not recommended, as you're certain to get confused.
We shall see in the next section how to change the style of the four
arrowhead components in a systematic way, thereby avoiding the ugly mixture
of vee and \LaTeX\ arrowheads obtained using earlier versions of this package.

In some of the examples above (with the dot and rule fillers) the filler was
repeated as the middle and one or both of the tips, whereas with others
(dash) we used empty middle and tips instead.
This was just to make the definitions easier to type: \verb/\newarrow/
treats middles and tips which agree with the fillers as empty ones.
It is possible to use two different fillers, but this is not recommended.

The commands \verb/\HorizontalMap/ and \verb/\VerticalMap/ are still
supported, but should be replaced by \verb/\newarrow/.
These ought only to have been used in macro files --- not in the text of
documents --- to define four arrow commands together (right, left, up and down).
The twenty arguments defining the five components of each of these four
arrows can (if they're not already provided) be re-arranged as the four
arguments of each of five \verb/\newarrowhead/, {\em etc.,} declarations
with the same effect.
The mnemonics of the five components are then given to \verb/\newarrow/.
If~you have any difficulty doing this conversion, please contact me.


%==========================================================================

\section{Options}\label{options}
The \verb/\diagram/ or \verb/\begin{diagram}/ command and the arrow
commands may be followed by a list of options in square brackets, for example
\begin{center}
\verb/\begin{diagram}[size=2em,textflow]/ \qquad \verb/\rTo[abut]/
\end{center}
which apply to the diagram or arrow to which they are attached.
Options may be given for an entire document, or within \TeX's normal
scoping rules, by a stand-alone command such as
\begin{center}
\verb/\diagramstyle[centredisplay,PostScript=dvips]/
\end{center}
You may use any number of \verb/\diagramstyle/ commands.
In \LaTeXe\ these options can be given when loading:
\begin{center}
\verb/\usepackage[centredisplay,PostScript=dvips]{diagrams}/
\end{center}
though you should avoid using macros in the option values.

{\bf Note:} if the text of the first cell in a diagram begins with a
square bracket, the program will attempt to read it as an option, just
as square brackets within \LaTeX\ \verb/array/s can cause trouble.
This usually leads to a catastrophic
error, which can be avoided using \verb/\diagramstyle[nooptions]/.

Some options take a value, using an equals sign; those enclosed in square
brackets below are optional, the others mandatory.
Most of the options are appropriate for diagrams rather than arrows.

\begin{description}
\def\makelabel#1{{\tt#1} --- }
\item[abut] Leave no gap between maps and objects; useful for (``Hasse'')
   diagrams displaying order structures.
\item[alignlabels] The labels on horizontal arrows remain centred in the 
   cells where they are defined, despite different size endpoints;
   {\em cf.} \verb/midshaft/.
   This is the default, and it is recommended for diagrams of a regular
   character.
   If there is insufficient space to position the labels in this way, they
   are centred (automatically and silently) instead.
   Whichever option is used, the middle of the arrow, if present, is always
   positioned with the labels.
\item[amstex] Enable recognition of \AmSTeX's commutative diagram commands;
   see section~\ref{emulate}.
\item[balance] The whole diagram is centred horizontally without regard to
   the left- and rightmost labels,
   so that its weight lies in the middle of the page.
   This is not the default, because if you were not aware of it the gaps
   would come as a surprise, but it is recommended.
\item[bottom] When the diagram is placed alongside some simple text,
   the baseline of that text is aligned with that of the bottom row of the
   diagram.
\item[centre {\em or\/} center] The diagram is centred%
    \footnote{Notice that I have provided the ``-er'' alternative as a
    courtesy to American users which Knuth and Lamport did not afford
    to British ones.}
   na\"{\i}vely, using \verb/nobalance/ and \verb/vcentre/;
   {\em cf.}~\verb/middle/.
\item[centredisplay {\em or\/} centerdisplay] Disables \verb/flushleft/,
   enables \verb/balance/ and gives a warning when used within \verb/$$...$$/
   (see below).
%\item[displayoneliner] Disables \verb/inlineoneliner/.
\item[dpi={\em resolution\/}] Anticipate the output resolution in pixels per
   inch (default 300). A~fudge factor is applied to horizontal and vertical
   ruled lines, without which pixel rounding at 300dpi would cause the
   {\em bottom\/} rather than the middle of the horizontal rule to align
   with the cusp of the vee arrowhead: compare $\rTo$ and $\rTo[nopixel]$.
   Other similar adjustments may also be made to character positioning.
   Most office laser printers are 300dpi, but if you intend to use a printer
   of a different resolution for your final output, set {\tt dpi=1270} or
   whatever --- otherwise the shafts will be too low instead. The same applies
   if you intend to magnify or reduce; for example {\tt dpi=212} should be
   used for two-up or A4-on-A5 final printing.
   In \verb/plain/ \TeX\ you may set \verb/\magnification/ at the beginning
   of the file, but {\em do not\/} change \verb/dpi/ as this compensates
   automatically.
   The \verb/nopixel/ option disables the fudge factor.
\item[dpm={\em resolution\/}] As {\tt dpi} but in dots per metre; {\em e.g.}
   1270dpi=50000dpm.
\item[eqno={\em label\/}] Place {\em label\/} (in maths mode) beside the
  diagram, as an equation number.
%\item[fixed] Force diagonal arrows to be set on the first pass and not
%   stretched. (Not implemented: this is what happens anyway.)
\item[flushleft{[={\em width\/}]}] Display the diagram on the left of the page
  instead of the centre.
  If {\em width\/} is given, the leftmost vertical of the diagram is,
  if possible, aligned at that distance from the left edge of the page;
  {\em cf.} \verb/fleqn.sty/.
  This is considered good book design by certain publishers.
  (This option is experimental: in future versions it may do something slightly
  different if the first column contains parallel verticals or none at all.)
\item[h={\em distance\/}] Same as \verb/height/.
\item[hcentre {\em or\/} hcenter] Same as \verb/nobalance/.
\item[heads={\em name\/}] Set the \verb/>/ and \verb/{>>}/ arrow heads
  and tails to those defined by \verb/\newarrowhead{/{\em name\/}\verb/}/ and
  \verb/\newarrowtail{/{\em name\/}\verb/}/.
  The following styles are currently available:
  \message{(There may follow a warning message about LaTeX diagonals
    - please ignore it.)}%
  \begin{quote}
    \ifx\twoheadrightarrow\undefined\else\def\amsarrows{%
   \dohead{curlyvee}(uses AMS symbols)\cr
   \dohead{blacktriangle}(uses AMS symbols)\cr
   \dohead{littleblack}(uses AMS symbols)\cr
    }\fi
    \ifhavegoodboldmath\def\boldarrows{%
   \dohead{boldlittlevee}(uses {\tt\string\boldmath})\cr
    }\else\let\boldarrows\empty\fi
  \diagramstyle[l>=50pt]\leavevmode
  \def\dohead#1{\tt#1\quad&\relax
  \csname diagramstyle\endcsname[heads=#1]$\rEmbed\quad\rEEmbedd$&\quad}
 \vbox{\halign{#&#&#\hfil\cr&\omit\kern100pt\cr
   \dohead{LaTeX}(default; uses {\tt line10})\cr
   \dohead{vee}\cr
   \dohead{littlevee}\cr
   \boldarrows
   \dohead{triangle}\cr
   \dohead{o}\cr
   \dohead{O}\cr
   \dohead{X}\cr
   \dohead{+}\cr
   \amsarrows
  }}\end{quote}
  \ifx\twoheadrightarrow\undefined
     There are also heads called
     \verb/curlyvee/, \verb/blacktriangle/ and \verb/littleblack/,
     but these require the AMS symbols fonts, which were unfortunately
     not available when this copy of the manual was printed.
     If~you try to use them 
  \else
     The vertical \verb/curlyvee/ heads come from the AMS symbols, and
     the horizontals, from \verb/cmsy/ in the Computer Modern Fonts,
     seem appear to be slightly mis-aligned with the \verb/vee/ heads
     from \verb/cmmi/.
     If~you use them but forget to
       \ifx\usepackage\undefined
         \verb/\input mssymb/,
       \else
         \verb/\usepackage{amssymb}/,
       \fi
  \fi
  you'll get an ``{\tt undefined control sequence}'' error in the middle of
  a lot of garbage (deeply nested): hit return several times and carry on.

  The \verb/boldlittlevee/ heads \ifhavegoodboldmath\else(not shown above) \fi
  rely on \LaTeX's \verb/\boldmath/ command, and default to \verb/littlevee/
  in \verb/plain/ \TeX. They~may not work correctly if you use the old \LaTeX\
  font selection. Even if you use the new (Mittelbach-Sch\"opf) one some PK
  files
    \ifhavegoodboldmath
      which are not in the standard distribution may be needed.
    \else
      are needed which were not available when this copy of the manual
      was printed.
    \fi
  It~is only intended for final copy in the event that the \verb/littlevee/
  appears too feint. The same applies to the \verb/boldhook/ tails.
\item[height={\em distance\/}] The distance between the baselines of
  successive rows in the diagram is as specified; note that as objects and
  arrows commonly alternate, this is usually half the distance between
  one horizontal arrow and the next.
\item[hmiddle] Same as \verb/balance/.
%\item[hug] If \verb/PostScript/ is enabled, rotate labels on %vertical and
%  diagonal maps. %The text then runs {\em up\/} the verticals.
%  (Not yet implemented --- in fact the \verb/PostScript/ option currently
%  {\em always\/} does this to diagonals, but not to verticals.
\item[htriangleheight={\em distance\/}] Set \verb/height/={\em distance\/}
  and then \verb/width/ in such a way that the minimal $3\times5$-grid
  will make an equilateral $\triangleright$ triangle,
  and a $5\times7$-grid makes a regular hexagon.
\item[htrianglewidth={\em distance\/}] Set \verb/width/={\em distance\/}
  and then \verb/height/ to make these figures.
\item[inline] Use this option on individual diagrams which are being displayed
  alongside one another, for example in \verb/$$/...\verb/$$/ or \LaTeX's
  \verb/center/ or \verb/displaymath/ environments, when the global display
  option is \verb/flushleft/ or \verb/centredisplay/.
%\item[inlineoneliner] If the diagram has only one row, run it on in the text
%  instead of displaying~it. (This is highly questionable.)
\item[l>={\em distance\/}] Forces arrows (particularly horizontals and
  rotated diagonals) to have   at least the specified length (default 2em),
  to avoid getting birds' feet instead of arrows:
  \hbox to2.8em{$A\rTo[l>=0pt,heads=vee]B$}.
  Sometimes this makes the arrow overprint an object or appear displaced;
  in this case you'll see an ``over-full \verb/\hbox/'' or ``increase
  \verb/\DiagramCellWidth/'' error message.
\item[labelstyle={\em command\/}] Inserts this command in every label text;
  \verb/\scriptstyle/ is the commonest choice apart from the default.
\item[landscape] If \verb/PostScript/ is enabled, rotate the entire diagram
  by $90^\circ$ anticlockwise.
  Options which refer to the extreme rows and columns are modified
  accordingly. Useful for big diagrams with long objects or labels.
\item[landscape] If \verb/PostScript/ is enabled, rotate the entire diagram
  by $90^\circ$ anticlockwise.
  Options which refer to the extreme rows and columns are modified
  accordingly. Useful for big diagrams with long objects or labels.
\item[large] Same as \verb/size=5em/.
\item[lefteqno] Place the equation number, as given by \verb/eqno/, on the
  left of the diagram.
\item[leftshortfall={\em distance\/}] The gap between the arrow (to which it
  is applied individually) and the object on its left is as specified.
%\item[locate=$x$:$y$] Move the origin of the diagonals. Not yet implemented.
\item[lowershortfall={\em distance\/}] Similarly below.
\item[loose] The rows and columns of the diagram have {\em at least\/} the
  \verb/height/ and \verb/width/ specified, but may stretch, in the same
  way as those of an array or table.
  This is the default, because the results are more of less right in most
  circumstances, but this can result in gaps in the diagram, so it is
  recommended that \verb/tight/ be used in the final version of a document,
  with appropriate manual adjustment of the size of the grid.
\item[middle] The diagram is centred both horizontally
   using \verb/balance/ and vertically using \verb/vmiddle/, {\em q.v.}
\item[midhshaft {\em or\/} midshaft] Labels are centred in the shafts of
  horizontal arrows; {\em cf.} \verb/alignlabels/. 
\item[midvshaft] The same for vertical arrows: not recommended.
\item[moreoptions] Allow another list of options in square brackets.
  This is intended for macros of the form
  %\begin{center}
  \verb/\def\funnydiagram{\diagram[/{\em options\/}\verb/,moreoptions]}/
  %\end{center}
  to allow \verb/\funnydiagram[/{\em options\/}\verb/]/.
  The arrow commands always allow any number of lists of options.
\item[nobalance] Horizontal centring of diagrams is done with respect to the
  extremities.
\item[nohcheck] Disables certain error checking.
%\item[nohug] Do not rotate the labels on vertical and diagonal maps, but
%  print them horizontally.
%  (Not yet implemented --- in fact the \verb/PostScript/ option currently
%  {\em always\/} rotates labels on diagonals, but not on verticals.
\item[nooptions] Used in \verb/\diagramstyle/, this disables the parsing
  of options.
  This is for reverse compatibility in the case where several diagrams
  begin with a square bracket.
\item[noorigin] Disables \verb/origin/ and \verb/balance/.
\item[nopixel] Disable the \verb/dpi/ fudge factor, {\em q.v.}, by setting
  a very high resolution.
\item[noPostScript] Disables the use of embedded {\sc PostScript} {\em and\/}
  the \verb/PS/ and \verb/noPS/ options.
  The value, if any, is ignored, so you need only edit in/out the prefix
  \verb/no/ whilst leaving the choice of {\sc PostScript} translator intact.
\item[noPS] Disable {\sc PostScript} on individual maps and diagrams.
\item[notextflow] Disables \verb/textflow/. This is needed on some individual
  diagrams (where they appear as nouns in a sentence, for instance) when you
  use \verb/\diagramstyle[textflow]/.
\item[noTPIC] Disable the use of TPIC \verb/\special/s.
\item[objectstyle={\em command\/}] Inserts this command in every object text;
  \verb/\scriptstyle/ is the commonest choice apart from the default.
\item[origin] Makes the width, height and depth of the whole diagram zero,
  locating it at the baseline of the bottom row, in the centre of the leftmost
  column.
  This allows it to be positioned by the user; useful for mixing diagrams with
  \LaTeX\ pictures and other graphics.
\item[p={\em distance or\/} pilespacing={\em distance\/}] Set the distance
  between parallel verticals (in the same cell); that between the rows of a
  \verb/\pile/ is half of this to allow things to be put between parallel
  horizontals.
\item[pixelsize={\em distance\/}] Anticipate this output resolution;
  {\tt pixelsize=.02true mm} is the same as {\tt dpi=1270} or {\tt dpm=50000}.
\item[portrait] Disable \verb/landscape/ option, {\em q.v.}
\item[PostScript={\em author\/}] Enable the use of embedded Adobe
  {\sc PostScript} \verb/\special/ commands in a form supported by
  {\em author\/}'s translator.
  The following are currently recognised by the {\em author\/}s' surnames,
  their programs or their companies.
  The surname is the preferable form, since the programs have very similar
  names.
  The master FTP source is also given.
  \begin{itemize}
  \item (Toma\v s) \verb/Rokicki/, \verb/dvips/, \verb/RadicalEye/:
    labrea.stanford.edu /pub/dvips9999.tar.Z
  \item (Stephan) \verb/Bechtolsheim/, \verb/dvitps/,
    \verb/IntegratedComputerSystems/:\\
    arthur.cs.purdue.edu /pub/TeXPS-9.99.tar.Z
  \item (James) \verb/Clark/, \verb/dvitops/
  \end{itemize}
  It is not possible to use Andrew Trevorrow's Oz\TeX.
  These are currently used to implement diagonals by rotating horizontals.
\item[PS] Suppose you want to use {\sc PostScript} for some but not all
  maps and diagrams in the final version. Then use \verb/PS/ for each of them
  but put \verb/\diagramstyle{noPostScript}/ in the preamble during drafting.
\item[righteqno] Put the equation number (\verb/eqno/), if any, on the right.
\item[rightshortfall={\em distance\/}] Analogous to \verb/leftshortfall/.
\item[s={\em distance\/}] Same as \verb/size/.
\item[scriptlabels] Labels on  maps are set in \verb/\scriptstyle/; useful
  if they're rather long.
\item[shortfall={\em distance\/}] Set the gap between arrows and the objects
  to which they point.
\item[size={\em distance\/}] Set both \verb/height=/{\em distance\/} and
  \verb/width=/{\em distance}.
  \begin{center}
  {\bf Most geometrical problems with diagrams can be solved by enlarging
  the cells.} Please try this and the \verb/tight/ option before contacting me.
  \end{center}
\item[small] Same as \verb/size=2em/.
\item[textflow] The text which follows the diagram in the \TeX\ source is
  brought up to fill out the line preceding it; useful to avoid the
  ``such that the diagram $\clubsuit$ commutes'' clich\'e.
  This has been used for several diagrams in this manual.
\item[thick{[={\em breadth\/}]}] As \LaTeX\ \verb/\thicklines/, optionally
  setting the width of orthogonal ruled lines. The \LaTeX\ command itself has
  no effect within diagrams. The default rule breadth is twice that for the
  \verb/thin/ option.
\item[thin{[={\em breadth\/}]}] This is similarly analogous to \verb/\thinlines/.
  The default rule breadth is the same as that used by \TeX, namely the value
  of (?).
\item[tight] Force all of the cells in the grid to have exactly the height
  and width you specify.
  This is recommended for the final version of a document, but
  is not the default because it may cause overprinting, which requires the
  intervention of the user to cure (by setting \verb/height/ and \verb/width/);
  {\em cf.} \verb/loose/.
\item[top] Analogous to \verb/bottom/, except that the top row is used.
\item[TPIC] Use TPIC \verb/\special/ commands instead of \LaTeX\ line
  segments to draw diagonal lines.
  These are supported by {\sc Textures}, Tomas Rokicki's \verb/dvips/ and
  Paul Vojta's \verb/xdvi/.
\item[uppershortfall={\em distance\/}] Analogous to \verb/leftshortfall/,
  except above.
\item[vcentre {\em or\/} vcenter] Vertical positioning is the same as with
  \TeX's \verb/\vcenter/
  command or \LaTeX's \verb/[c]/ option.
  However \verb/vmiddle/ is what is usually wanted.
\item[vtriangleheight={\em distance\/}] Set \verb/height/={\em distance\/}
  and then \verb/width/ in such a way that the minimal $5\times3$-grid
  will make an equilateral $\bigtriangleup$ triangle and a $9\times 5$-grid
  makes a regular hexagon (page~\pageref{hexagon}).
\item[vtrianglewidth={\em distance\/}] Set \verb/width/={\em distance\/}
  and then \verb/height/ to make these figures.
\item[vmiddle] If a diagram with an odd number of rows of constant height
  (the usual case) is placed alongside some simple text,
  the baseline of the text will be aligned
  with that of the middle row, irrespectively of the height and depth of the
  labels on the top and bottom rows.
  In general, the baseline of the diagram is half-way between those of the
  top and bottom rows.
\item[w={\em distance or\/} width={\em distance\/}] Set the distance between
  the centre of one column and the next.
\end{description}


%==========================================================================

\section{Application to adjunctions}
Here is a side application of commutative diagrams to displaying
``adjoint correspondences.'' It also illustrates the way arrows
stretch to meet their endpoints but keep their labels centred in
the column of arrows. The options are chosen to avoid getting
lots of extra space around the cells, which in this case we don't want.
Notice also the invisible ``objects'' terminating the \verb/\hLine/
``morphism'' command.

\begin{verbdiag}[loose,height=.8em,width=3em]
&Z\times X&\relax\rTo^f&Y&\\
\relax\ &&\relax\hLine&&\relax\ &\\
&Z&\relax\rTo^{{\bf curry}(f)}&Y^X&
\end{verbdiag}

\vskip-6ex
\diagram[loose,height=.8em,width=3em]
&Z \times X &\relax\rTo^f & Y \\
\ &&\relax\hLine && \ \\
&Z & \rTo^{\ {\bf curry}(f)\ } & Y^X \\
\enddiagram

If you want the $Z$s lined up, it's no good \verb/\hfill/ing the second
one on the right, because the arrow wont stretch to meet
it\footnote{There is no way of detecting {\em where\/} glue is placed
inside a box, so the stretching algorithm {\em assumes\/} the object
is centred and extends the arrow by half the amount of glue in the
object box.}. The best solution is probably to split the object into
two cells:

\begin{verbdiag}[loose,height=.8em,width=0pt,l>=3em,midshaft]
&Z&\relax{}\times X&\relax\rTo^f&Y&\\
\relax\ &&&\relax\hLine&&\relax\ &\\
&Z&&\relax\rTo^{{\bf curry}(f)}&Y^X&
\end{verbdiag}

\vskip-6ex
\diagram[loose,height=.8em,width=0pt,l>=3em,midshaft]
&Z & {} \times X &\relax\rTo^f & Y \\
\ &&& \hLine&& \  \\
&Z & & \rTo^{{\bf curry}(f)} & Y^X \\
\enddiagram

\noindent The \verb/{}/ makes sure \verb/\times/ still gets the spacing
appropriate to a binary operator.

%==========================================================================
\section{Diagonal lines}\label{diagonals}
Whereas horizontal and vertical arrows such as \verb/\rTo/ and \verb/\dTo/
stretch to meet their endpoints without your telling them where those are,
the diagonals (\verb/\ruTo/) need to be told explicitly if you want to use
them for anything other than to go across a $3\times3$ square.

The approximate direction of the arrow stays the same ---
right/left and up/down --- as given by its name.
The length (and exact direction) are given by {\em positive\/} coordinates.
As with \LaTeX's \verb/\line/s and \verb/\vector/s,
these are given pairs of (small) positive integers in round brackets, except
that there is no restriction on the values.

However these numbers count the {\em cells,} horizontally and vertically,
through which the arrow passes, rather than the absolute distance.
This means%
   \footnote{This represents a change from version~3, in which they were
   required to be the same for the diagonals to work. The coordinates are
   now converted internally into distances, and then back into a rational
   number, and the appropriate \LaTeX\ arrow characters chosen.
   The macros {\tt\string\laf}, {\tt\string\lah}, {\em etc.} and their octal
   arguments are now obsolete.}
that if the \verb/height/ of the rows and the \verb/width/ of the
columns are different, \verb/\ruTo(2,2)/ is no longer a $45^\circ$ slope.

The names of the arrow commands specify the horizontal direction first,
as a reminder that this is also the convention for coordinates.

Another difference from the orthogonal arrows is the rule for where to place
the command. Somewhat arbitrarily, this is
\begin{quote}
   in the row {\em below the upper endpoint\/} (irrespectively of the direction
   of the arrowheads, if any), and in the adjoining column
\end{quote}
In the commonest case (the diagonal of a small square) this means the middle
of the square; more generally for positive gradients (\verb/\ruTo/ and
\verb/\ldTo/) the arrow command goes below and to the left of the upper
endpoint, and for negative gradients (\verb/\rdTo/ and \verb/\luTo/) below
and to the right.

For example, here is the diagram which defines a pullback.
The corner symbol is a macro (\verb/\SEpbk/) placed in the same cell as the
object, but which prints way outside it.
$$\begin{verbdiag}
U&&&&&\\
&\relax\rdTo~{(x,y)}\rdTo(4,2)^x\rdTo(2,4)_y&&&&\\
&&X\times_Z\SEpbk Y&\relax\rTo_p&X&\\
&&\relax\dTo^q&&\relax\dTo_f&\\
&&Y&\relax\rTo^g&Z&
\end{verbdiag}$$
\vskip-6ex
\begin{diagram}
U \\
  &\relax\rdTo~{(x,y)}     \rdTo(4,2)^x
    \rdTo(2,4)_y  \\
  &         & X\times_Z \SEpbk Y & \rTo_p & X      \\
  &         & \dTo^q             &        & \dTo_f \\
  &         & Y                  & \rTo^g & Z      \\
\end{diagram}

For reverse compatibility, some commands with ``compass''
names are provided, such as \verb/\NW/, \verb/\WNW/, \verb/\NNNW/,
together with dotted and other variants. However
{\em the auxiliary file \verb/extra-diagonals.tex/ is obsolete and must
not be used.}

The main use of diagonals other than the simplest ones is for illustrating
order structures (``Hasse diagrams'').
Posets are trivial categories, but in practice they're the most difficult
diagrams to draw!
\begin{quote}
\begin{verbatim}
\begin{diagram}[size=1.5em,abut]
o&&&&o&&&&o&&&&o\\
&\luLine\luLine(10,2)&&\ruLine&&\relax\luLine(6,2)&&
\ruLine(6,2)&&\luLine&&\ruLine\ruLine(10,2)&\\
&&o&&&&&&&&o&
\end{diagram}
\end{verbatim}
\end{quote}

\begin{diagram}[size=1.5em,abut]
o&&&&o&&&&o&&&&o\\
&\relax\luLine\luLine(10,2)&&\relax\ruLine&&\relax\luLine(6,2)&&
\relax\ruLine(6,2)&&\relax\luLine&&\relax\ruLine\ruLine(10,2)\\
&&o&&&&&&&&o
\end{diagram}

The obsolete command \verb/\DiagonalMap/ is also still supported, but should
be replaced by the new commands. If you have used this with fonts other than
\verb/line10/ (for example the Spivak fonts \verb/lams1/ to \verb/lams5/),
please contact me to assist with conversion.

At the moment the diagonal arrows are set on the first pass, whereas the
horizontals and verticals are adjusted on a second pass of the diagram
(within the \verb/\enddiagram/ command) to meet their endpoints.
The lengths of the diagonals are chosen somewhat arbitrarily, though the
\verb/abut/ option will make them touch a \verb/\cdot/.
Code to reformat the diagonals will be added as the next project, after the
pending minor infelicities and ideas have been dealt with.
Beware that when this is done it will not be possible to use
\verb/\raise/ (or \verb/\raisebox/) or horizontal spacing to adjust the
positions of the diagonal arrows.

%==========================================================================
\section{Alternative \TeX nology}
In order to get the best results, you should be aware of the way in which
diagonals are constructed.
\TeX\ is ultimately only capable of positioning characters from various fonts
and drawing black rectangles with horizontal and vertical sides: there
is no primitive for diagonal lines or rotation.
This means that we have
\begin{itemize}
\item either to juxtapose characters with a limited choice of angles,
  as \LaTeX's \verb/\line/ and \verb/\vector/ commands do,
  with the result that (because of pixel rounding
  errors) they may not line up correctly,
\item or to use the loophole in the DVI language provided by the
  \verb/\special/ command to tell some post-processing software
  (such as \verb/dvips/) to do the work for us, thereby surrendering
  portability,
\item or to over-print a large number of dots, making the DVI file very
  large since at least 12 bytes are needed for each dot.
  This is what \verb/pictex/ does.
\end{itemize}
In this package options are provided to employ the first two of these methods.
\begin{itemize}
\item By default, characters from \LaTeX's%
    \footnote{The code is similar to that underlying the \LaTeX\ commands,
    but is not the same. In particular, the line segment characters are
    equally spaced, instead of a single overlap between the last two.}
  \verb/line10/ font are used.
  Arrowheads from this font are used irrespectively of those chosen by the
  \verb/heads/ option.
  The nearest%
    \footnote{The approximation uses continued fractions, {\em alias\/}
    Euclid's algorithm, with a correction.
    There is also code for computing Pythagorean sums (for the lengths of
    rotated diagonals) and trigonometric functions (currently unused).}
  available \LaTeX\ slope is chosen, with the effect that arrows
  may sometimes fall short or overshoot: \verb/height/ and \verb/depth/
  should be set with this in mind.
\item If the \verb/PostScript/ option is enabled, horizontal arrows are
  used, and \verb/\special/ commands%
     \footnote{The code is adapted from Tomas Rokicki's {\tt rotate.sty}.}
  are embedded in the DVI file which have the effect of rotating them.
  If the DVI file is post-processed
  by a program which does not understand Adobe {\sc PostScript} an error
  message will probably be generated and the arrows will appear horizontal.

  Currently the labels are rotated with the arrows; later there will be an
  option either to do this or to set them horizontally.

     Literal {\sc PostScript} commands are included in the DVI file
     using \TeX's \verb/\special/ command.
     The various DVI to {\sc PostScript} translators may use of this in
     different ways, so it is necessary to specify which one you are using.
     At~Imperial College we use Tomas Rokicki's \verb/dvips/;
     if the program you use is not listed,
     please consult its manual for the appropriate way of including literal
     {\sc PostScript} commands and tell me the result
     so that I can add this as an option.
     The rotation code should be independent of the design of the translator.

     It does not and cannot work with the Oz\TeX\ {\sc PostScript} translator
     because this sorts the characters on each page by font and cannot deal
     with \verb/\special/ commands.
\item If the \verb/TPIC/%
     \footnote{TPIC is a graphics preprocessor for \TeX\ by Tim Morgan
     which uses this set of {\tt\string\special} commands.
     The same ones were also adopted by
     Dirk Grunwald for {\tt  texpictex} and by Conrad Kwok for {\tt  eepic},
     which are \LaTeX\ macro packages for graphics.}
  option is enabled, a simpler set of \verb/\special/
  commands is used to draw diagonal lines, but rotation is not available.
  \verb/dvips/ and \verb/xdvi/ understand these, but other post-processors
  may give error messages and print nothing.
\end{itemize}
No additional macro packages or special knowledge are needed to make use of
these methods: all of the necessary code is built in to the diagrams package.

The difference between these options can be seen by trying to draw a
regular hexagon.\label{hexagon}
$$\begin{verbdiag}[vtrianglewidth=1em,abut,tight]
   &&\relax{}&&\relax\rLine&&\relax{}&\\
   &\relax\ruLine&&&&&&\relax\luLine&\\
   \relax{}&&&&&&&&\relax{}&\\
   &\relax\luLine&&&&&&\relax\ruLine&\\
   &&\relax{}&&\relax\rLine&&\relax{}&
\end{verbdiag}$$
The \verb/PostScript/ and
\verb/TPIC/ options will make it meet up exactly, whereas the default \LaTeX\
method does not (quite).
\begin{center}
   \begin{diagram}[vtrianglewidth=1em,abut,tight,inline,PS]
   &&{}&&\rLine&&{}\\
   &\ruLine&&&&&&\luLine\\
   {}&&&&&&&&{}\\
   &\luLine&&&&&&\ruLine\\
   &&{}&&\rLine&&{}
   \end{diagram}
 \qquad\qquad
   \begin{diagram}[vtrianglewidth=1em,abut,tight,inline,noTPIC,noPS]
   &&{}&&\rLine&&{}\\
   &\ruLine&&&&&&\luLine\\
   {}&&&&\hbox{\rm\LaTeX}&&&&{}\\
   &\luLine&&&&&&\ruLine\\
   &&{}&&\rLine&&{}
   \end{diagram}
\end{center}
Drawing a regular pentagon would require rows and columns
of different sizes, which are not currently%
   \footnote{I cannot think of a natural way of specifying the distances
   without coding general Gaussian elimination. What could be set easily is the
   distance between the centres of two successive rows or columns; however
   the sides of the pentagon span three rows or columns. I'm~quite happy
   to accept angles expressed in degrees.}
available.


Future versions may exploit these extensions to provide other features, such
as curved lines; indeed this is likely to be the main direction of further
development. Other methods may also be provided.
However {\bf if no extension option is selected a standard DVI file
(using the \verb/line10/ font) will be always generated},
giving an approximation to the features requested.

%===========================================================================

\iffalse
\section{Bent lines --- not currently implemented}

The diagonal lines in the previous section were difficult to draw and
rather ugly. Here is a prettier way of doing it:
\begin{verbdiag}
U&&\relax\hLine^x&&\relax\dlBentto&\\
&\relax\rdTo^{\langle x,y\rangle}&\\
\vLine^y&&X\times_Z\SEpbk Y&\relax\rTo^p&X&\\
&&\relax\dTo^q&&\relax\dTo_f\\
\relax\ruBentto&&Y&\relax\rTo^g&Z&\\
\end{verbdiag}
which gives:
\begin{diagram}
U && \hLine^x & &
\dlBentto \\
& \rdTo^{\langle x,y\rangle} \\
\vLine^y && X \times_Z \SEpbk Y & \rTo^p & X \\
&&\dTo^q && \dTo_f \\
\ruBentto&& Y & \rTo^g & Z \\
\end{diagram}

Notice that the bent lines consist of two separate arrow commands,
one of them an ordinary \verb/\hLine/ or \verb/\vLine/ and the other
a ``bent'' arrow.  The latter are designed to meet orthogonal lines
exactly. To be precise,
\begin{itemize}

\item \verb/\dlBentto/, {\em etc.}, has a corner which is vertically
positioned on the maths axis and includes a short horizontal line to
compensate for the space at the end of \verb/\hLine/.
{\em It~must be placed in the cell corresponding to the corner.}
There are similar commands \verb/\ulBentto/
for upward maps, \verb/\drBentto/ to meet lines on the right and
\verb/\dlBent/ without an arrowhead (and all the combinations).

\item \verb/\ruBentto/, {\em etc.}, has a corner which is horizontally
positioned in the centre of the {\em next\/} cell (assuming that's
empty). So {\em it must be placed in the cell next to the corner,
in fact that corresponding to the edge.} The arrow is extended 
automatically.
Again there are commands with variant names.

\end{itemize}

These bent line commands are defined in exactly the same way as ordinary
horizontal and vertical arrows, except that
\begin{itemize}

\item \verb/\dlBentto/ has only a bottom half, {\em i.e.}~the leading
tip and first filler are \verb/\empty/. The second filler and trailing
tip are quite ordinary but the middle is special (\verb/\ldmcorner/).

\item \verb/\ruBentto/, on the other hand, is a complete arrow, the
{\em tail\/} now being a special corner.

\end{itemize}
Other middles could be defined to give rounded corners, using \LaTeX's
{\tt circle10} font.
\fi


%=========================================================================
\section{Emulation of \TeX ercise 18.46}\label{18.46}
This and the next section describe how to convert diagrams in your existing
documents which were drawn using other commutative diagram macro packages to
use this one, wherever possible changing only the preamble or macro
file and not the text itself.

Exercise 18.46 of {\em The \TeX book\/} provided some ideas for commutative
diagrams, from which the present package was originally developed.
The following instructions are based on what is given there,
but if you have added other arrow macros you will have to work out how to
re-define them by following the examples given.

If you have used the {\em\TeX book\/} macros as they stand --- with
\verb/\matrix/ enclosing the diagram --- you will first have to distinguish
between the diagrams and real matrices.
(If~you give arrays of numbers to the commutative diagrams  package, they
will come out rather widely spaced.)
This process is unnecessary if you already have a macro for diagrams
rather than matrices: just re-define that in a similar way.

In~your macro file you probably have something like what follows the
\verb/\iffalse/ command below, but with additional macros written in
a similar way (this is the reason for setting it all out in gory detail
in the manual rather than providing an extra input file as in the case
of some of the ``packages'' described in the next section).
If~you make the following additions you will be able to revert to the 
original (in the unlikely event that you are not satisfied)
by changing this to \verb/\iftrue/.

This is not particularly difficult: when, as a \TeX\ novice, I~wrote my
Ph.D.~thesis in August 1986, I~had sixty diagrams drawn using the \TeX book
macros, together with several others that had to be drawn by hand.
Recovering that from an archive tape, I~recently found that all but five
of the sixty could be converted without any change at all to the text,
whilst the hand-drawn ones can now be drawn with the up-to-date package.

\begin{quote}\small
\begin{verbatim}
\iffalse
  % your macros, copied or adapted from TeXercise 18.46 (page 325)
  \def\mapright#1{\smash{\mathop{\longrightarrow}\limits^{#1}}}}
  \def\mapdown#1{\Big\downarrow\rlap{$\vcenter{\hbox{$\scriptstyle#1$}}$}}
  %
  \let\cdmatrix\matrix % revert to using \matrix for diagrams
\else
  % Replacement for the above using ...
  \input diagrams % Paul Taylor's diagrams.
%
  \def\mapright#1{\global\matrixwascdtrue\rTo^{#1}\relax}
  \def\mapleft #1{\global\matrixwascdtrue\lTo^{#1}\relax}
  \def\mapup   #1{\global\matrixwascdtrue\uTo>{#1}\relax}
  \def\mapdown #1{\global\matrixwascdtrue\dTo>{#1}\relax}
%
  % Maybe you have some variants like this:
  \def\mapupbefore#1{\global\matrixwascdtrue\uTo<{#1}\relax}
%
  % The following examples may also be useful:
  \let\into\rInto
  \def\horizadjoint#1#2{\pile{\lTo^{#1}\\\bot\\\rTo_{#2}}}
  \def\vertadjoint #1#2{\dTo<{#1}\dashv\uTo>{#2}}
%
  % Here is a replacement for \matrix which gives a commutative
  % diagram, including some extra macros for use inside them.
  \def\cdmatrix{\bgroup
    \edef\matrixlineno{\the\inputlineno}\global\matrixwascdfalse
    % 
    \let\matrix\pile   % inner \matrix is probably parallel horizontals
    %
    % re-define the diagonal arrows
    \let\nwarrow\luTo\let\nearrow\ruTo\let\swarrow\ldTo\let\searrow\rdTo
    % 
    \diagram[]% begin the diagram (without options)
    \getthematrix% delete this line if you use amstex rather than plain
    }
  \def\getthematrix#1{#1\endcdmatrix}
  \newif\ifmatrixwascd
  \def\endcdmatrix{\enddiagram\egroup}
%
  % The following tells you whether it was actually a diagram or
  % a matrix. Remove this when you've changed those \matrix
  % commands in your text which should be diagrams to \cdmatrix.
  \def\endcdmatrix{\enddiagram\egroup
    \expandafter\message{^^JThe \string\matrix\space at lines
      \matrixlineno--\the\inputlineno\space was really a
      \ifmatrixwascd diagram\else matrix\fi.^^J}}
  \let\matrix\cdmatrix \let\endmatrix\endcdmatrix
%
\fi
\end{verbatim}\end{quote}

The code as shown above assumes you have \TeX\ version~3 (to provide
\verb/\inputlineno/); it prints a \verb/\message/ to tell you whether
each \verb/\matrix/ has used any arrow commands.
With a clever choice of this message you can even get your editor
to make the necessary changes to the text for you in batch mode!
Delete the extra code after you have done this.

Beware that \AmSTeX\space uses \verb/\matrix#1\endmatrix/ instead of
\verb/\matrix#1/.
In~this case, delete \verb/\getthematrix/ as indicated.
Then (where appropriate) change \verb/\endmatrix/ as well as \verb/\matrix/.
The same applies if you have used the \verb/array/ enviroment in \LaTeX.

%       \begin{itemize}
%       \item \verb/\matrix{..}/ must be changed to 
%               \verb/\diagram..\enddiagram/ (or~\verb/\commdiag{..}/).
%       \item \verb/\mapright/, {\em etc.,} must be changed to (or~defined
%               as) \verb/\rTo/. Positional arguments are still recognised,
%               {\em so long as they are enclosed in braces.}
%       \item \verb/\cr/ should be changed to \verb/\\/.
%       \end{itemize}

%=========================================================================
\section{Emulation of other macro packages}\label{emulate}
There are several other \TeX\ macro packages in circulation for drawing
commutative diagrams, of varying degrees of sophistication.
This section describes how to adapt the preamble of an existing document
which was written to use such macros so that it prints diagrams like those
in this manual instead.
When you publish documents prepared in this fashion, please remember to
acknowledge the authors of both packages, making it clear which you used to
type the original source and which produced the finished product.

\bigskip
\noindent{\bf American Mathematical Society}
(\AmSTeX, and \AMSLaTeX's \verb/amscd.sty/): see Michael Spivak below.

\bigskip
\noindent{\bf Michael Barr}'s \verb/catmac/ macros were based on a principle
   of overlapping squares.  Whilst this is perhaps closer conceptually to the
   categorical ideas which are being expressed, it is not possible to emulate
   the language using the matrix syntax. The simple shape macros can, however,
   be replaced by
\begin{quote}\begin{verbatim}
\def\square[#1`#2`#3`#4;#5`#6`#7`#8]{%
   \diagram[]
      {#1} & \rTo^{#5} & {#2} \\
      \dTo<{#6} & & \dTo>{#7} \\
      {#3} & \rTo^{#8} & {#4}
   \enddiagram}
\end{verbatim}\end{quote}
   and similarly \verb/\atriangle/, \verb/\btriangle/, \verb/\dtriangle/,
   \verb/\ptriangle/, \verb/\qtriangle/, \verb/\Atriangle/, \verb/\Ctriangle/,
   \verb/\Driangle/, \verb/\Vriangle/,
   \verb/\Arianglepair/, \verb/\Vrianglepair/ and  \verb/\recurse/,
   which are easy exercises.   

\bigskip
\noindent{\bf Karl Berry}'s \verb/eplain/: see Steven Smith below.

\bigskip
\noindent{\bf Francis Borceux}'s \verb/diagram/ package uses \LaTeX's
   \verb/picture/ environment instead of \TeX\ arrays, but since it is
   designed in an array fashion it can be interpreted.
   Instead of that file, use
\begin{quote}\begin{verbatim}
\input diagrams
\input Borceux-to-Taylor
\end{verbatim}\end{quote}
   This is available from the same place as (my) \verb/diagrams.tex/ itself.
   Currently the ternary ($4\times2$-cell), curved, free and multiple arrows
   are not implemented, and all size parameters are ignored.

\bigskip
\noindent{\bf Eitan Gurari}'s \verb/dratex/:
I haven't looked in to this package yet.

\bigskip
\noindent{\bf Donald Knuth}: see section~\ref{18.46} of this manual.
   
%\bigskip
%\noindent{\bf J\"urgen Koslowski}: I haven't looked in to this package yet.

\bigskip
\noindent{\bf Frank Mittelbach}'s  \AMSLaTeX\space \verb/amscd.sty/:
see Michael Spivak below.

\bigskip
\noindent{\bf John Reynolds}: I haven't looked in to this package yet.

\bigskip
\noindent{\bf Kristoffer Rose}'s \verb/xypic/ uses a different convention for
   where to declare arrows, namely in the cells with their sources.
   This convention will be supported in the next release.
   The syntax of Rose's arrow commands is also more complicated.
   I~do not intend to support his fonts or turning commands.

\bigskip
\noindent{\bf Rainer Sch\"opf}'s  \AMSLaTeX\space \verb/amscd.sty/:
see Michael Spivak below.

\bigskip
\noindent{\bf Steven Smith}: I haven't looked in to this package yet.

\bigskip
\noindent{\bf Michael Spivak}'s \LAMSTeX: similar comments apply here as
   to Kris Rose's package.

\bigskip\noindent{\bf Michael Spivak}'s \AmSTeX\space (as described in
   {\em The Joy of \TeX\/}) had some very primitive commutative diagrams,
   enclosed in \verb/\CD...\endCD/.
   \iffalse
   Horizontal arrows were drawn with the commands
   \verb/@</$f$\verb/</$g$/\verb/</ or \verb/@(/$f$\verb/(/$g$/\verb/(/
   and \verb/@>/$f$\verb/>/$g$/\verb/>/ or \verb/@)/$f$\verb/)/$g$/\verb/)/,
   where $f$ and $g$ are the upper and lower labels.
   Vertical arrows used
   \verb/@A/$f$\verb/A/$g$/\verb/A/ and \verb/@V/$f$\verb/V/$g$/\verb/V/
   where $f$ and $g$ are the left and right labels.
   These arrows were only as long as their labels.
   A~long equals without labels could be drawn with % ??? \verb/@-/,
   \verb/@=/ and \verb/@|/ or \verb/@\vert/.  % ?? \verb/@\|/ and \verb/@\Vert/
   for single and double lines.
   \fi

   You can obtain a dramatic improvement in these diagrams without changing
   the text of your document by using my package with the \verb/amstex/ option.
   Given a (complete, correct) \AmSTeX\ document, change the header to read
   \begin{quote}\begin{verbatim}
        \input amstex
        \input diagrams
        \diagramstyle[amstex]
   \end{verbatim}\end{quote}
   \vskip-2ex
   If~\AmSTeX\space or \AMSLaTeX\space (\verb/amscd.sty/) had been loaded,
   this will replace the definitions.

   You can also include \AmSTeX\space diagrams extracted from old papers
   in new \verb/plain/ \TeX\ or \LaTeX\ documents. In~this case,
   do not load \AmSTeX\ (unless you want it for some other reason)
   but instead use
   \begin{quote}\begin{verbatim}
        \input diagrams
        \def\CD{\diagram[amstex]}
   \end{verbatim}\end{quote}
   \vskip-2ex
   to confine the changes to the meaning of the \verb/@/ character to the
   diagrams themselves.
   The in-line horizontal arrows will then not be interpreted.

\bigskip
\noindent{\bf Timothy van Zandt}'s \verb/pstricks/:
I haven't looked in to this package yet.

%=========================================================================
\section{Frequently asked questions}\label{faq}
\noindent{\bf Wouldn't it be better to draw it with a mouse?} No.

\bigbreak\noindent{\bf Is it compatible with ...?} From 1986 until after
version~3 of this package was announced in July~1990 I~used \verb/plain/
\TeX, whilst giving assistance to colleagues who used \LaTeX.
In~December 1991 the local \TeX\ system was converted to use the
Mittelbach-Sch\"opf font selection for \LaTeX.
Consequently there is a great deal of collective experience in using the
diagrams package in all of these environments. I~do not have experience
of \AmSTeX, \AMSLaTeX, \verb/eplain/ or commercial \TeX\ packages, but
do not know of any reason why it should not work with them:
please tell me if you find any difficulties.

Richard Stallman's \verb/texinfo/ is designed for documenting other software,
in which \TeX's special characters often have important meanings.
For this reason many of the \verb/\catcode/s have been changed, and in
particular \verb/@/ is used where \TeX\ uses \verb/\/.
The usual \TeX\ meanings are restored within \verb/@tex..\Etex/.
It~is possible to load this package without this, but you must do
\begin{quote}\begin{verbatim}
@catcode`@\=0 \catcode`\%=14 \input diagrams \catcode`\%=12 \catcode`\\=13
\end{verbatim}\end{quote}
You must also do \verb/@catcode`@&=4/ before using \verb/@diagram/.
Braces \verb/{}/ stay the same.

\bigbreak\noindent{\bf Does it use any special fonts?} No. One of the design
criteria of the package is that all of the components come from the standard
Computer Modern fonts that come with \TeX, except that the diagonal arrowhead
characters come from \LaTeX's \verb/line10/ font. As~one user said,
\begin{quote}
``I agree with you in being against the use of additional 
fonts. It takes some time and experience to port, say, 
\LAMSTeX\space fonts to [my `personal' computer]. I would much prefer 
embedded {\sc PostScript} commands. Custom DVI drivers such as 
\verb/xdvi/, on the other hand, are not widely available, at 
least not for [my computer].''
\end{quote}
There are {\em optional\/} arrowheads from the AMS symbols fonts, which were
\ifx\twoheadrightarrow\undefined not available\else used\fi\space
when this copy of the manual was printed. They may be obtained by anonymous
FTP from \verb/e-math.ams.com/.

It is sometimes claimed that it is advantageous to have specially designed
fonts in order to ensure that the components match up correctly.
However the reason why they frequently do not is pixel-rounding,
{\em even when the DVI-driver does this correctly according to the rules
specified by Donald Knuth}.%
   \footnote{If you don't believe me, calculate for yourself which pixels
   are inked when a 0.4pt-wide rule is centered on the maths axis of
   {\tt cmmi10} (2.5pt above the baseline) at 300dpi (1~point~=~4.15~pixels),
   and compare this with characters such as $\greaterthan$ in the output of
   {\tt gftype -i cmmi10.300gf}. The character $\succ$ in {\tt cmsy} is
   one pixel lower than this.}
The \verb/dpi/ option has been included to correct for this.

If you have other arrowhead fonts available, such as those provided by
Kristoffer Rose for \verb/xypic/ and Michael Spivak for \LAMSTeX,
you may use them if you write your own \verb/\newarrowhead/ commands.

\bigbreak\noindent{\bf Corruption by electronic mail.} It~is easiest to get
this package by anonymous FTP. This stands for ``file transfer protocol'';
it is a way in which you can log on interactively to my computer and fetch
(some of) my files. A~very large amount of software is now freely available
by this method, so it is well worth putting pressure on your system
administrator to get your machines connected.

If you cannot get it by FTP and the route to you by electronic mail passes
through non-ASCII machines (such as through BITNET), the file may suffer
corruption. This doesn't matter very much with the manual, but the macro
package itself has a list of characters at the top, and use of most of those
which experience has shown to be vulnerable has been confined to the first
section, wherever possible. Search for the word ASCII if in doubt.

\bigbreak\noindent{\bf \TeX\ capacity exceeded.}
\TeX\ was designed in the early 1980s, when RAM was measured in kilobytes,
and does not have dynamic memory allocation.
Although \verb/tex.web/ says loudly ``Don't Touch!'', the compile-time
parameters listed on page 300 of the \TeX book {\em are\/} meant to be
changeable, and Donald Knuth provided a mechanism (\verb/tex.ch/) for doing
so.  Karl Barry's widely used \verb/web-to-C/ {\sc Unix} port of \TeX\
increases them substantially --- in accordance with the RAM available in
1990s hardware and that needed by 1990s software. There is nothing
{\sc Unix}-specific about these changes: they can just as well be made in
any other compilation environment. Currently it seems Oz\TeX\ has not made
the changes --- please complain about this to its author, Andrew Trevorrow,
not~me.

The increase in size over version~3 is largely due to the diagnostics,
{\em i.e.} helping you to use the package!

If you get ``no room for another \verb/\dimen/'' it probably means you're
using \verb/pictex/, which uses 110 out of the available~256; I~use~20.

The process of stretching the arrows in a completed diagram is quite slow,
but at least in this package \TeX\ spends the time doing something useful
rather than parsing (\LaTeX\ \verb/picture/) \verb/\put/ commands inside
macros. The emulation of Borceux's macros, for instance, is 50\% faster
than the original.
Kris Rose's \verb/XYpic/ takes about six times as long to draw the
same diagram.

\bigbreak\noindent{\bf Default arrowheads.} Even when you define your own
arrows with special arrowheads, you still get get \LaTeX\ heads on diagonals.
This is because \LaTeX\ heads are available in a variety of directions,
but your special ones are only defined for up, down, left and right.
To~get special heads on diagonals, it is necessary to rotate them, and to
do that you need the \verb/PostScript/ option.

\bigbreak\noindent{\bf Display options.} If, as was advised in earlier versions
of this manual, you enclose the diagram in \verb/$$...$$/ or a display
environment, the new options in section~\ref{options} for positioning it
cannot work.
Except in those cases where you want two or more diagrams side by side,
or a small diagram in-line in the text, it is better to remove such
enclosings; then you can experiment with the options using
\verb/\diagramstyle/.
\LaTeX's \verb/center/ environment is, for this purpose, {\em not\/} a
display but a paragraph of text, with some strange results if you use the
\verb/textflow/ option; in this case you should use the \verb/inline/ option
on the individual diagrams to make them appear side by side.

\bigskip\noindent{\bf Large gaps between diagonals and their endpoints.}
This happens if you try to use the default \verb/\LaTeX/ line segments
to draw very steep or very shallow diagonals.
Try using the \verb/PostScript/ option.

By~default, the (rows and) columns of the matrix forming the diagram can
stretch to accommodate long pieces of text as objects and arrow labels.
This is appropriate for rectangular diagrams and requires no user intervention.
If,~however, you have diagonals, this stretching causes them to fall short of
the objects to which they are meant to point, because currently they are
(unlike the horizontals and verticals) rigid.
\message{A message about "badly drawn diagonals" follows. It is deliberate.}%

\vskip-5ex
\begin{diagram}[loose,size=3em,notextflow,heads=LaTeX,noPS]
   A & \rTo^{\lessthan 1_A,0_A\greaterthan} & A\times N\\
   & \rdTo[fixed]_f&\dDotsto>h\\
   &&B
\end{diagram}
An example provided by a user is shown. The solution is to use options like
\begin{quote}
  \verb/\begin{diagram}[tight,width=4em,height=3em]/
\end{quote}
See section~\ref{options} for details.
Sometimes there isn't room on the page to increase the width sufficiently.
Try using the \verb/scriptlabels/ option, or, failing that, put the whole
diagram in the scope of a \LaTeX\ \verb/\small/ or even \verb/\tiny/
declaration.

This real-life example illustrates another common problem: the symbols
$\lessthan$ and $\greaterthan$ are {\em relations\/}
$\langle$not~brackets$\rangle$ --- and it's not uncommon to see line-breaks
the wrong side of them, even in published, supposedly proof-read, books.
If~you don't often use the strict arithmetical relations and find it a bore
to type \verb/\langle..\rangle/, put the following in your macro file:
\begin{quote}\begin{verbatim}
\mathcode`\<="4268     % < = \langle
\mathcode`\>="5269     % > = \rangle
\mathchardef\gt="313E  % arithmetic
\mathchardef\lt="313C  % strict order
\end{verbatim}\end{quote}
As another piece of general advice, many people use \verb/\mbox/ when it is
completely unnecessary. Amongst other things, it inhibits the reduction of
the contents when used as a sub- or superscript.

%\bigskip\noindent{\bf Diagonals overprint or don't quite meet their
%endpoints.} I'm~sorry about this: it's because I~haven't got round to writing
%the code to stretch the diagonals in the same way as the horizontals and
%verticals. This will be done in the next release, because I~need it for my
%book.
%
%In~the case of poset diagrams, the \verb/[tight,abut]/ options should work
%satisfactorily.

\bigskip\noindent{\bf ``Badly drawn diagonals'' error message.}
This warning is given if (a)~you use diagonals which are set on the first
pass ({\em i.e.}~\LaTeX, TPIC or \verb/fixed/) {\em and\/}
(b)~some of the columns are significantly wider than was specified by
the \verb/width/ or \verb/size/ option.
It~indicates that the problem above, with big gaps at the ends of diagonals,
may have occurred.
Check this, and if necessary set the \verb/tight/ option and specify the
necessary (increased) \verb/width/ yourself.
Alternatively, use the \verb/PostScript/ option to get the diagonals
set on the second pass; then they will meet their endpoints.

\bigskip\noindent{\bf Labels on arrows over-print objects or arrowheads
become detached.} You're trying to squeeze too much into the column: increase
\verb/width/ (as it tells you to do). If~the object at one end is much
longer than that at the other, the \verb/midshaft/ option may be appropriate.

\bigskip\noindent{\bf Mixed or missing arrowheads.} The idea of providing the
\verb/heads/ option is that you should specify at the beginning of your
document which style you want. The default is \verb/heads=LaTeX/ since this
provides consistency between orthogonal and diagonal arrowheads when rotation
is not available.

\bigskip\noindent{\bf Undefined symbols.} To~use the curly and black
arrowheads you need the AMS symbols; if one of these (\verb/\curlyvee/,
\verb/\blacktriangleleft/) is undefined, hit return several times to complete
the run of \TeX\ on your document, then go back and insert
       \ifx\usepackage\undefined
         \verb/\input mssymb/
       \else
         \verb/\usepackage{amssymb}/
       \fi
 or change the heads declaration.

If~you find a symbol with a meaningless name like \verb/\CD@gF/ or
\verb/\cD@hA/ is undefined, it means that you have used internal macros
from a previous version of the diagrams package. Please remove them:
the names are deliberately meaningless to persuade you not to use them.

\bigbreak\noindent{\bf Can you put diagrams within diagrams?}
Yes, but it's not often that such things are needed. Remember that
\verb/\pile/ is used for parallel horizontals. Sometimes you may want an
array of diagrams.

During development I~found problems when the first cell of the inner
diagram was empty, and version 3.22 resulted in \TeX's elusive
``interwoven alignment preambles are not allowed'' error (\TeX book page 299).
Although I believe these bugs have now been fixed, this is a delicate area
and it is possible that others may arise.

\bigskip\noindent{\bf \verb/Missing \endcsname inserted./}
This can happen if a macro occurs within an option [in~square brackets].
In~general you must ensure that such macros expand to text characters only.
For example in \LaTeXe:
\begin{quote}
  \verb/\usepackage[flushleft=\mainindent]{diagrams}/
\end{quote}
where \verb/\mainindent/ is a \verb/\dimen/;
in this case \verb/\the\mainindent/ will work (see the \TeX book for why).
Values for options to individual diagrams and arrows, or parsed by
\verb/\diagramstyle/ instead of \verb/\usepackage/, may safely contain
macros where appropriate.

\bigskip\noindent{\bf Horizontal arrows overprint objects.}
You must not use \verb/\hfill/, \verb/\hss/, \verb/\hspace/,
\verb/\hidewidth/ or other similar commands to try to
alter the effective size of the object.

\bigskip\noindent{\bf What if it still doesn't work?} If you have a problem
which is not answered by this manual, please compile a {\em short\/} file
containing your problem diagram and any macros (such as \verb/\Assl/ in
section~\ref{typing}) it contains. Run it through \verb/tex/ or \verb/latex/
to check that no definitions are missing, and include a note of the date
and version number which you are using. Then send it by {\em electronic\/}
mail: please do not use the telephone or postal mail.

I am keen to know about any adverse interactions with other software,
anything which is not well explained in this manual, or any cases of
mis-typing in which \verb/\scrollmode/ does not get to the end of the
document because of a diagrams error.

% automatic floats
% picture-mode inserts for braids, etc

%=========================================================================
\section{Conditions of use}
You may freely copy and pass on this package and include it in collections
of free software, but may not alter it or charge a fee for it.

Please ensure that you are registered with me as a user, so that you can be
informed of new versions. Any electronic mail message containing the words
``commutative'' or ``diagram'' automatically registers you, as does quoting
your electronic mail address when fetching it by~FTP from
\verb/theory.doc.ic.ac.uk/.

If you consider this package good enough to use, then it is good enough to
acknowledge.  After all, it is academic protocol to credit prior or
simultaneous discovery of techniques related to your own, even if you were
unaware of them or did not rely on them when you made your own discovery.
Such acknowledgement is a condition of use of this package.
However this condition is waived if use amounts to no more than five diagrams,
each of which is either a square or a triangle.
This acknowledgement must, of course, be removed if the document is re-typeset
by methods which do not use this package.

No permission was in the past given to use this package for commercial purposes.
This includes a document whose copyright is ceded by the author (for valuable
consideration or not) to another person or body which subsequently intends to
collect royalties for its reproduction.
Permission is now granted for its use for the production of academic
research and textbooks, journals and conference proceedings,
subject to the conditions that
\begin{itemize}
\item acknowledgement be given as above,
\item an up-to-date version of the package be used for the final production,
\item and one copy of the book be sent to me on publication in lieu of royalty,
  at the above address.
\end{itemize}
Publications by commercial organisations are considered (for this purpose)
to be academic if they are made in an academic forum, concern pure research
and do not relate to any particular commercial product.

The software may not be used for any military purpose under any circumstances.

No warranty is given with this software. It is supplied ``as is'', and neither
the source nor this manual nor anything else shall be taken as a representation
that it will perform any particular function, is suitable for any particular
purpose or is of merchantable quality. In executing the software, the user
implicitly accepts the above conditions and indemnifies the author, Imperial
College and any person through whom the software was obtained, against
liability for direct or consequential damages arising from the use of this
software.

%=========================================================================
\section{Reverse compatibility}
Compatibility with past and future versions (the numbers of some of which have
been assigned {\em post facto\/}) is as follows. Note the difference between
``should'' and ``must''.

\begin{description}
\item[Version 0:] See section~\ref{18.46}.
\item[Version 1:] Horizontal arrows made to stretch to edge of cell; 1987--9.
        \begin{itemize}
        \item \verb/\rTo{f}{g}/ works, but \verb/\rTo f g/ doesn't: it must
                be changed to \verb/\rTo^f_g/.
        \item the \verb/\mkern-20mu\rTo{f}{g}\mkern-20mu/ idiom for manual
                stretching of horizontal arrows to meet objects must be
                removed.
        \item \verb/\VerticalMapHeight/ and \verb/\VerticalMapDepth/ commands
                are obsolete and are ignored: they should be removed.
        \item Three- or four-argument uses of \verb/\HorizontalMap/,
                \verb/\VerticalMap/ and \verb/\DiagonalMap/ must be
                changed to five-argument uses or, preferably, to
                \verb/\newarrow/.
        \item Nested \verb/\commdiag/ commands for parallel maps must be
                changed to \verb/\pile/.
        \item Parallel maps constructed by putting them in the rows or columns
                before and after must be moved to the correct cell and
                (in the case of horizontals) put in a \verb/\pile/.
        \end{itemize}
\item[Version 2:] Horizontal arrows made to stretch to meet objects and
``superscript'' labels introduced;  versions with banners
dated September to December 1989.
        \begin{itemize}
        \item \verb/&\rTo\across3&/ now works more accurately than in
                version~3, but should be changed to \verb/&&\rTo&&/.
        \item {\raggedright The parameters \verb/\HorizontalMapLength/,
                \verb/\VerticalMapHeight/, \verb/\VerticalMapDepth/,
                \verb/\VerticalMapExtraHeight/, \verb/\VerticalMapExtraDepth/
                and \verb/\DiagonalLineSegments/ are obsolete and are ignored:
                they should be removed.\par}
        \item The labels on southeast and northwest diagonal lines have
                changed their position. \verb/^/~and \verb/_/ previously meant
                left and right respectively for diagonals; they now mean ---
                more logically --- above and below; \verb/</ and \verb/>/ are
                used for left and right, respectively. Unqualified labels
                are positioned as they originally were: the first above and
                the second below.
        \item Diagonal lines are constructed differently; user-defined
                diagonal arrows should be replaced with \verb/\ruTo(2,4)/ 
                {\em etc.,} and explicit movement of them removed.
        \item Bent lines, with \verb/\dlBent/ and \verb/\ruBentto/, currently
                do not work. Instead \verb/\HmeetV/ must be
                placed at the corner. Bent or half arrows will be reintroduced
                later but with a different naming convention.
        \end{itemize}
\item[Version 3:] Vertical maps also made to stretch to meet objects; widely
circulated with banners dated July 1990 to April 1992.
        \begin{itemize}
        \item \verb/\HorizontalMap/, \verb/\VerticalMap/ and 
                \verb/\DiagonalMap/ should be replaced by \verb/\newarrow/
                declarations.
        \item Negative spacing around wide objects (used to avoid the
                stretching of the diagram which they caused) should be
                removed, and the \verb/tight/ option used instead.
                This is because objects are now allowed to extend into the
                neighbouring columns, with a check that there is enough space.
        \item Enclosing \verb/$$...$$/ or display environments should be
                removed, as they prevent the new display positioning options
                from working.
        \item Diagonal arrows with ``compass'' names, particularly the ones
                from \verb/extra-diagonals.tex/ (which must not be used any
                more), should be changed to the new geometrical names.
        \item The command names \verb/\lt/ and \verb/\gt/ (for $\lessthan$ and
                $\greaterthan$) have been removed, at the request of a user
                who considered these to be unreasonable names for internal
                commands.
        \item The arrow commands with names like \verb/\rArr/ and \verb/\rTo/
                now all use the default arrowheads; the original behaviour
               (\verb/\rArr/ used \verb/LaTeX/ and \verb/\rTo/ used \verb/vee/)
               may be restored by changing a switch \verb/\iffalse/ in the
               final section of the source.
        \end{itemize}
\item[Version 4:] Advertised in September 1992.
        \begin{itemize}
        \item The default arrowhead has been changed from \verb/vee/ to
               \verb/LaTeX/ to ensure consistency if \verb/PostScript/
               is not used.
        \end{itemize}
\item[Future:] Diagonal lines will be made to stretch in so far as this is
possible, so explicit movement of diagonals will become incompatible.
\end{description}

Suggestions for improvements and further applications ({\em e.g.\/} proof nets,
Petri nets and circuit diagrams) are welcome.

%==========================================================================

\section{Availability}

The diagram package is currently available as a single
94kb\footnote{Without comments; the development version is about 250kb.}
printable \TeX\ source file which is compatible with both \LaTeX\
and {\tt plain} \TeX. It loads the \LaTeX\ {\tt line10} font as \verb/\tenln/
(its \LaTeX\ name) and also defines some (exotic) arrow commands in terms
the AMS symbols, but if these are to be used then the
       \ifx\usepackage\undefined
         file \verb/mssymb/
       \else
         package \verb/amssymb/
       \fi
must be loaded separately.

In Imperial College, the package is available on {\tt/home/leonardo}
and will be picked up automatically by the {\tt tex} and {\tt latex} commands.
Users should not make their own copies unless they intend to take them away.

The easiest way to obtain it is by {\bf anonymous FTP}
as
\begin{quote}
{\tt/tex/contrib/Taylor/tex/diagrams.tex} from
{\tt theory.doc.ic.ac.uk} (146.169.2.27)
\end{quote}
Please do not ask for it by electronic mail (or less convenient media) unless
you are unable to use~FTP.
I~shall assume that users in Europe (apart from the formerly Communist
countries), North America, Australia, New Zealand, Japan and Israel are
able to use FTP unless they make the contrary clear.

Users in Britain (only) without access to FTP may obtain it from the
UK~\TeX\ archive at Aston University (\verb/uk.ac.tex/),
in the directory [tex-archive.macros.generic.diagrams.taylor].
You can log in to this (VMS) machine {\em via\/} JANET (000020120091)
with username ``public'' and password ``public''.
You can also obtain the package by electronic mail, by sending the
following message to \verb/texserver@uk.ac.tex/:
\begin{quote}\begin{verbatim}
FILES
[TEX-ARCHIVE.MACROS.GENERIC.DIAGRAMS.TAYLOR]diagrams.tex
[TEX-ARCHIVE.MACROS.GENERIC.DIAGRAMS.TAYLOR]diagrams-manual.tex
[TEX-ARCHIVE.MACROS.GENERIC.DIAGRAMS.TAYLOR]borceux-to-taylor.tex
[TEX-ARCHIVE.MACROS.GENERIC.DIAGRAMS.TAYLOR]diagrams-v4-news
[TEX-ARCHIVE.MACROS.GENERIC.DIAGRAMS.TAYLOR]qed.sty
\end{verbatim}\end{quote}
You will get an acknowledgement message first, followed by the files.
They may be split up into several messages, in which case the \verb/Subject:/
lines will begin \verb/[part /$n$\verb/ of /$m$\verb/]/.
%
\iffalse Other availability information will be added later, after checking.
Also available from
archive.cs.ruu.nl [131.211.80.17] /pub/TEX/DIAGRAM/diagrams.tex
%
Other \TeX\ FTP sources:
e-math.ams.com [130.44.1.100] for AMS symbols and AMS-\LaTeX.
ftp.cs.umb.edu [192.12.26.23] for Karl Berry's web-to-C \TeX\ port.
\fi
%============================================================================
\end{document} 

% Ideas for future editions of this manual:

% Use bezier.sty and the origin option in a picture environment to draw
% braids on top of a diagram - Robert Seely had an example.

% I haven't composed the example yet.
%\newif\ifHaveBezier\HaveBeziertrue
%\pt@input{bezier.sty}%
%{^^JYou don't have bezier.sty. That's a pity, because I wanted to show you an
%^^Jexample of drawing curved lines on top of a diagram. We'll do without it.}%
%\HaveBezierfalse

% Use \matrix or array environment to put long objects on two lines within
% a diagram. LFPP.tex has a suitable example.

% Commutative diagram of posets. Example in my thesis (fig 2.2.13) (5.2.2)
