\errorcontextlines 999 % % ========================================= \title { Commutative Diagrams in \TeX\ % (version 4)} % | | % | by | % | | \author {{\bf Paul Taylor }\\ % ========================================= % {\tt www.cs.man.ac.uk/$\sim$pt}} % \date {15 June 1997} % \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.} % % =============================================================== \documentclass[a4paper]{article} \usepackage{diagrams} \makeatletter \makeindex \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\banner{Paul Taylor's diagrams package}% %\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 ftp.dcs.qmw.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; %,dpi=212% for two-up (A4 on A5) reduction of 300dpi ,dpi=600% for more modern laser-printers %,dpi=424% for two-up (A4 on A5) reduction of 600dpi %,PostScript=Rokicki% ,UglyObsolete% formerly called ``noPostScript'' %,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}$}} \def\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} \def\PiCTeX{\PiC\kern-.11em\TeX} \def\XYpic{\leavevmode\hbox{X\kern-.3em\lower.4ex\hbox{Y\kern-.15em}-pic}} % % 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{\thesection. #1}}% should have \S but doesn't work %\def\section@mark#1{\markboth{#1}{\banner}}% \@twosidetrue % % \let\volx\relax % for ltugbot.sty \newcommand{\bsl}{$\backslash$} % \def\ix#1{#1\index{#1}}\def\person#1#2{#1 #2\index{#2, #1}}% {\escapechar-1 \xdef\bslch{\string\\}}% \def\ixcmd#1{{\escapechar-1 \xdef\cmdname{\string#1}}% \expandafter\index{\cmdname @\bslch verb/\string#1/}}% \def\ixprotect#1{{\escapechar-1 \xdef\cmdname{\string#1}}% \expandafter\index{\cmdname @\protect#1}}% \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.% \index{Mac Lane, Saunders}\index{Kelly, Gregory Max} \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% \ixprotect\LaTeX\index{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!% \index{wysiwyg}\index{mouse} 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 \ix{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 \ix{measuring} of labels to calculate \ix{co-ordinates} or lengths of arrows. \item There must be a variety of arrow styles, with facilities for defining new ones.\index{arrowheads}\index{heads}\index{diagonal arrows} 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% \index{plain \protect\TeX}\ixprotect\LaTeX\ 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,\index{line10 and linew10 fonts}\index{AMS symbols fonts} and for exotic arrow styles the AMS maths symbols fonts may be useful: we regard these as standard. \person{Alan}{Jeffery}'s \ix{St.\protect~Mary Road symbols font} is also useful.} 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 \ix{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.\index{aligned labels} \item Labels on arrows should not affect the spacing of the diagram except to avoid overlapping.\index{labels} \item Stretching of arrows should not affect the centering of their labels. \end{itemize} %================================================================= % % my version % %================================================================= \section{Typing the diagram}\label{typing} The diagram above is produced in \LaTeX\ixprotect\LaTeX\ as follows:% \ixcmd\input\ixcmd\usepackage \ixcmd\diagram\ixcmd\enddiagram \ixcmd{\begin{diagram}}\ixcmd{\end{diagram}}% \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\index{plain \protect\TeX} you do the same thing, writing \verb/\diagram/ and \verb/\enddiagram/ wherever we have \verb/\begin{diagram}/ and \verb/\end{diagram}/. In \LaTeXe\ixprotect\LaTeXe\ you can put \begin{quote} \verb/\usepackage{diagrams}/ \end{quote} in place of the \verb/\input/ command, but you have to rename or alias the file to \verb/diagrams.sty/.\index{diagrams.sty}\index{diagrams.tex} The basic rule is to divide the diagram into cells, \begin{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^{\Id*\Assl} & \uDots && \uDots &=& \uDots && \uDots & \uTo_{\Assl*\Id}\\%36 \\ \ &\HonV&&&& \rDots &&&&\HonV& \ \\%35 &A*((B*C)*D) & & & & \rTo_\Assl & & & & (A*(B*C))*D \\%34 %&& \ && \ && \ && \ \\%33 \end{diagram} just like the cells of a \ix{matrix}, and then type the contents of the cells with columns delimited by ``{\tt\&}''\ixcmd{&} and rows by ``\verb/\\/''.\expandafter\index{\string\\@\string\\} The bottom arrow extends through the \ix{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.}\index{co-ordinates} 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\ixcmd{&} 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}\index{parity rule} \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\/}\index{clashing arrows} or {\em unterminated\/} arrows\index{unterminated arrows} indicate that something is wrong without previewing.\index{error checking} Each cell should contain {\it either\/} an \ix{object} (an~ordinary mathematical expression, set in maths mode) {\it or\/}~a~\ix{morphism} (an~\ix{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 \ix{empty cells} either side until they meet a non-empty cell, just like the rook\index{rook (chess rule)} (castle\index{castle (chess rule)}) in chess. For this purpose anything other than \ix{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/{}/\index{{}} 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 \ix{edge of the diagram}, but just exactly where the ``edge'' {\em is}, particularly the right one, will be determined somewhat arbitrarily. The \ix{chess rule} does not apply to diagonals, whose endpoints are specified differently: see section~\ref{diagonals}. Do not enclose the arrow commands in \ix{boxes} or \ix{braces}, because this prevents the automatic \ix{stretch}ing from working. The {\em horizontal\/} arrow commands \index{horizontal arrows} (including \verb/\pile/) \ixcmd\pile may also be used in \ix{text}, $A \rTo^f B$. Since there is no enclosing matrix, this is written as \verb/$A \rTo^f B$/ {\em without\/}~\verb/&/.\ixcmd{&} You still need the \ix{dollars}\ixcmd{$} because it's still a \ix{mathematical expression}. Arrows participate in the horizontal stretching and shrinking of spaces between words in a paragraph, but of course their labels also force the lines of the paragraph apart. The arrow commands are {\em \ix{fragile}\/} in the \LaTeX\ sense: if you want to use them in section headings you must \verb/\protect/% \ixcmd\protect\ them. %=========================================================================== \section{Labels} Each arrow carries up to three \ix{labels}, whose position is specified analogously to \ix{superscripts}% \footnote{However they are {\em not\/} recognised syntactically in the same way, and so for instance {\tt\bsl nolimits}\ixcmd\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}% \ixcmd\catcode\ixcmd\sp\ixcmd\sb\ixcmd\ifx\ixcmd\ifcat\ 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. \index{Sp environment}\index{Sb environment}% \ixprotect\AmSTeX\ixprotect\AMSLaTeX\index{{}}\ixcmd\bgroup\ixcmd\egroup 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// right\qquad and\qquad \verb/~/ middle. \end{center} \ixcmd{^}\ixcmd{_}\ixcmd{~}\index{<@$<$}\index{>@$>$}% 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,\index{horizontal arrows} \verb/\rTo^f_g/ and \verb/\rTo{f}{g}/ give \smash{$\mathop{\longrightarrow}\limits^f_g$}; \item for {\bf vertical} arrows,\index{vertical arrows} \verb/\dTo g/, \verb/\dTo^f_g/ and \verb/\dTo{f}{g}/ give $f{\big\downarrow}g$; \item for {\bf positive\/} gradient {\bf diagonal} arrows,% \index{diagonal arrows}\index{positive gradient}\index{negative gradient} \verb/\ldTo^f_g/, \verb/\ldTo 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 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$}.\index{broken arrows} If~the arrow had a middle ({\em e.g.}~\verb/+/ in \verb/\rCrossedInto/, page~\pageref{crossedinto}), \ixcmd\newarrowmiddle\ixcmd\rCrossedInto 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 \ix{annotating the head of an arrow},% \index{arrowheads!annotating} for example \verb/$ A \rTo^f \relax ^* B {}_s \lTo_g C$/\quad gives \begin{quote} $ 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.\ixcmd\relax\index{{}} 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.\index{shortfall} An alternative way of doing this is to define a new arrow command: section~\ref{newarrow} explains how.\ixcmd\newarrow 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} \ixcmd\textstyle\ixcmd\displaystyle\ixcmd\scriptstyle\ixcmd\scriptscriptstyle \ixcmd\labelstyle\ixcmd\objectstyle 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 using the \verb/labelstyle/ option (page~\pageref{labelstyle}). %This re-defines the command \verb/\labelstyle/, for instance \begin{quote} \begin{verbatim} \begin{displaymath} \begin{diagram}[labelstyle=\scriptscriptstyle] 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 within a diagram are set in \verb/\displaystyle/ unless the \verb/objectstyle/ option is used. (In text, {\em e.g.}~\verb/$A \rTo B$/, the setting of the objects is out of the control of the diagrams package. Unless you have done some special programming of your own, they will be set in \verb/\textstyle/.) %=========================================================================== \section{The Cube}\label{cube} The \ix{cube} offers a good example of how horizontal and \ix{vertical arrows} \ix{stretch}.\index{horizontal arrows} Notice how the cells have been sub-divided further to give the ``3D'' effect,\index{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 \ix{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.\ixcmd{&} \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} \ixcmd\HonV\ixcmd\VonH\index{broken arrows}\index{hidden lines}% \index{meeting lines}\index{joining lines}\index{corners} 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 then its label (if any) would clash with the other arrow. \ixcmd\HmeetV 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.}% \index{verbatim environment} %========================================================================== \section{Parallel arrows}\label{parallels}\index{parallel arrows}% \ixcmd\pile\ixcmd\Downarrow\ixcmd\dashv\ixcmd\puncture You can draw two arrows between the same two vertices, including extra things like \ix{2-cells} ($\Downarrow$, \verb/\Downarrow/), the adjoint symbol ($\dashv$, \verb/\dashv/) in between. \person{Peter}{Freyd}'s \verb/\puncture/ symbol is also defined in the diagrams package.\index{adjunction} \begin{verbdiag} A&\relax\pile{\rTo^f\\ \puncture\quad\alpha \\ \rTo_g}&B&\\ \relax\dTo^h\dashv\uTo_k&&&\\ C&&& \end{verbdiag} \vskip-4ex \diagram A & \pile{ \rTo^f \\ \puncture\quad\alpha \\ \rTo_g } & B \\ \dTo^h \relax\dashv \uTo_k \\ C \\ \enddiagram {\bf Horizontal} arrows\index{horizontal arrows}\index{pilespacing} 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/\ixcmd\baselineskip) between the rows is {\em half\/} of that specified by the \verb/pilespacing/ option (page~\pageref{pilespacing}), 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\index{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.\index{diagonal arrows} At the moment parallel diagonal lines are not properly implemented; (there will be a \verb/crab/\index{crab} option for transverse movement). However the option \verb/fixed/\index{fixed} may be used to force the diagonals to be set on the firsr pass, as fixed (non-stretching) boxes. These can 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} \ixcmd\raise\ixcmd\raisebox\ixcmd\lower\index{error checking}% There is an error message (``you must not put arrows in \ix{braces}''), which warns you that this is not a satisfactory solution. %========================================================================== \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.\index{arrowheads} For example,\ixcmd\newarrow %\vskip-3\baselineskip \ifx\twoheadrightarrow\undefined % a typical AMS symbol name \let\amsarrows\empty \else \def\amsarrows{% TeXonto&----\{->>\}&\rTeXonto\cr }% \ixcmd\rTeXonto \fi \ifhavegoodboldmath \def\boldarrows{CrossedInto&\{boldhook\}-+->& %\showboxdepth999 \showboxbreadth 999 \tracingonline 1 %\tracingcommands1 \tracingmacros1 \rCrossedInto %\showlists \cr}% \newarrow{CrossedInto}{boldhook}-+-> \else \def\boldarrows{CrossedInto&C-+->&\rCrossedInto\cr}% \newarrow{CrossedInto}C-+-> \fi \ixcmd\rTo\ixcmd\rLine\ixcmd\rEmbed\ixcmd\rOnto\ixcmd\rEEmbedd \ixcmd\rDotsto\ixcmd\rDashto\ixcmd\rCorresponds\ixcmd\rImplies \ixcmd\rMapsto\ixcmd\rInto\ixcmd\rOpeninto\ixcmd\rCongruent \ixcmd\rTeXto\ixcmd\rBackwards\ixcmd\rMulti\ixcmd\rCrossto \ixcmd\rPartial\ixcmd\rCrossedInto \index{>@$>$ arrowhead}\index{-- filler}\index{>>@$\gg$ arrowhead} \index{. filler}% \index{dash filler}\index{| tail}\index{O arrowheads}\index{x arrowheads}% \index{harpoon arrowhead}\index{triangle arrowheads}\index{3 filler}% \index{hook tail}\index{C tail}\index{boldhook tail}% \begin{quote}\leavevmode\label{crossedinto} \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 \ixcmd\rightharpoonhown\ixcmd\twoheadrightarrow\ixcmd\rightarrow \ixcmd\Rightarrow\ixcmd\boldmath \index{->>@\protect\verb/->>/ arrowhead}% \index{->@\protect\verb/->/ arrowhead}% \index{littlevee arrowheads}\index{boldlittlevee arrowheads}% \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/ on page~\pageref{heads option}. The \verb/hook/ and \verb/C/ tails are the same. Each declaration\ixcmd\newarrow \index{north (east, west)}\index{south (east, west)}\index{east}\index{west}% \index{compass}\index{left}\index{right}\index{up}\index{down} \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. \ixcmd\isomorphic\ixcmd\cong 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. \ixcmd\rEmbed\ixcmd\rInto\ixcmd\rOpeninto\ixcmd\rImmerse\ixcmd\rInclude \ixcmd\rInternalise 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. \ixcmd\newarrowhead\ixcmd\newarrowtail\ixcmd\newarrowmiddle \ixcmd\newarrowfiller 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\ \ix{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. \index{>@$>$ arrowhead}\index{>>@$\gg$ arrowhead}% \index{heads}\index{arrowheads}\index{+ arrowhead}\index{x arrowheads}% \index{O arrowheads}% \ixcmd\rBackwards\ixprotect{\LaTeX\ arrowheads}% The components \verb/>/, \verb/{>>}/, \verb// and \verb/{>>}/ arrow heads and tails to those defined by \verb/\newarrowhead{/{\em name\/}\verb/}/ and \verb/\newarrowtail{/{\em name\/}\verb/}/. \index{arrowheads}\index{heads}\ixcmd\newarrowhead\ixcmd\newarrowtail \index{line10 and linew10 fonts}\ixprotect{\LaTeX\ arrowheads}% \index{vee arrowheads}\index{littlevee arrowheads}\index{O arrowheads}% \index{boldlittlevee arrowheads}\index{triangle arrowheads}% \index{x arrowheads}\index{curlyvee arrowheads}% \index{blacktriangle arrowheads}\index{littleblack arrowheads}% \index{AMS symbols fonts}\ixcmd\boldmath 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 \ix{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 \index{undefined control sequence}\index{cmsy}\index{amssymb.sty}% 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.\index{plain \protect\TeX}\ixprotect{\LaTeX 2.09} They~may not work correctly if you use \person{Leslie}{Lamport}'s old \LaTeX2.09 \ix{font selection}. Even if you use \person{Frank}{Mittelbach} and \person{Rainer}{Sch\"opf}'s new one (which is part of \LaTeXe\ixprotect\LaTeXe) some \ix{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.\index{height}\index{size} \item[hmiddle] Same as \verb/balance/.\index{balance}\index{centre} \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$ \ix{triangle}, and a $5\times7$-grid makes a regular \ix{hexagon} (page~\pageref{hexagon}). If~the {\em distance\/} is not specified, the existing \verb/height/ is used and the \verb/width/ adjusted accordingly. \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/.\index{in line}% \index{flush left}\index{displaymath environment}\index{center environment} %\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 \ix{birds' feet} instead of arrows: \hbox to2.8em{$A\rTo[l>=0pt,heads=vee]B$}. Sometimes this makes the arrow \ix{over-print} an object or appear displaced; in this case you'll see an ``over-full \verb/\hbox/'' or ``increase cell \ix{width}'' error message.\index{over-full hbox} \item[labelstyle={\em command\/}]\label{labelstyle} Inserts this command in every label text;\ixcmd\scriptstyle\index{labels} \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.\index{landscape}\index{PostScript} Options which refer to the extreme rows and columns are modified accordingly. Useful for big diagrams with long objects or labels.% \index{rotation} \item[large] Same as \verb/size=5em/.\index{size}\index{large} \item[LaTeXeqno] Use \LaTeX's running \verb/equation/ numbering for an \verb/eqno/ (\emph{q.v.}).\index{equation number} You can put a \LaTeX\ \verb/\label/ inside the diagram.\ixcmd{label} \item[lefteqno] Place the \ix{equation number}, as given by \verb/eqno/, on the left of the diagram. \item[leftflush{[={\em width\/}]}] Display the diagram on the left of the page instead of the centre, {\em cf.} \verb/fleqn.sty/.\index{flush left}\index{fleqn.sty} This is considered good \ix{book design} by certain publishers. 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. The idea is that the arrows, rather than the text, define the visual extent of the diagram. If the first column contains multiple verticals, the leftmost of them is used for the alignment. If there are no verticals in the leftmost column, the alignment is on the left extremity of the text. \index{indented style}\index{asymmetric design} \item[leftshortfall={\em distance\/}] The gap between the arrow (to which it is applied individually) and the object on its left is as specified.% \index{short fall} %\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.% \index{tight}\index{loose}\index{width} \item[middle] The diagram is centred both horizontally using \verb/balance/ and vertically using \verb/vmiddle/, {\em q.v.}% \index{middle}\index{centre}\index{balance} \item[midhshaft {\em or\/} midshaft] Labels are centred in the shafts of horizontal arrows; {\em cf.} \verb/alignlabels/.% \index{aligned labels}\index{midshaft} This happens automatically for in-text or one-line diagrams, or if the arrow is too short to align the labels. %\item[midvshaft] The same for vertical arrows (doesn't work). %\item[missives] Enable missives. \item[moreoptions] Allow another list of \ix{options} in square brackets. This is intended for macros like %\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.\index{balance} \item[nohcheck] Disables certain \ix{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 \ix{options}. \ixcmd\diagramstyle This is for reverse compatibility in the case where several diagrams begin with a square bracket. \item[noorigin] Disables \verb/origin/ and \verb/balance/.% \index{balance}\index{origin} \item[nopixel] Disable the \verb/dpi/ fudge factor, {\em q.v.}, by setting a very high resolution.\index{pixel size} \item[noPostScript] Disables the use of embedded {\sc \ix{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]/.\index{text flow} \item[noTPIC] Disable the use of TPIC \verb/\special/s.% \index{TPIC}\ixcmd\special \item[objectstyle={\em command\/}] Inserts this command in every \ix{object} text; \ixcmd\scriptstyle \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. \index{origin}\index{picture environment}\ixprotect\LaTeX \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.\index{parallel arrows}\ixcmd\pile\label{pilespacing} \item[pixelsize={\em distance\/}] Anticipate this output resolution; {\tt pixelsize=.02true mm} is the same as {\tt dpi=1270} or {\tt dpm=50000}.% \index{pixel size} \item[portrait] Disable the \verb/landscape/ option, {\em q.v.}\index{landscape}\index{portrait} \item[PostScript={\em author\/}]\label{PS} Enable the use of embedded \ix{Adobe} {\sc \ix{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 \ix{FTP} source is also given.\index{anonymous FTP} \begin{itemize} \item (Tomas) \verb/Rokicki/, \verb/dvips/, \verb/RadicalEye/: labrea.stanford.edu /pub/dvips9999.tar.Z% \index{Rokicki, Tomas}\index{dvips}\index{Radical Eye} \item (Stephan) \verb/Bechtolsheim/, \verb/dvitps/, \verb/IntegratedComputerSystems/:\\ arthur.cs.purdue.edu /pub/TeXPS-9.99.tar.Z% \index{Bechtolsheim, Stephen}\index{Integrated Computer Systems}% \index{dvitps} \item (James) \verb/Clark/, \verb/dvitops/\index{Clark, James}\index{dvitops} \end{itemize} These are currently used to implement diagonals by rotating horizontals. It is not possible to use \person{Andrew}{Trevorrow}'s Oz\TeX.% \index{oztex@Oz\protect\TeX} \item[PS] Suppose you want to use {\sc \ix{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[repositionpullbacks] The \ix{pullback} symbols have a fixed position relative to the cell, irrespectively of where you put the \verb/\SEpbk/ {\em etc}.~command. \item[righteqno] Put the \ix{equation number} (\verb/eqno/), if any, on the right. \item[rightshortfall={\em distance\/}] Analogous to \verb/leftshortfall/.% \index{short fall} \item[ruleaxis] Set the height of the shaft of the horizontal arrows; normally \verb/\mathaxis/. \index{ruleaxis}\index{horizontal arrow}\ixcmd\mathaxis \item[s={\em distance\/}] Same as \verb/size/.\index{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.\index{short fall} %\item[showpair=\coordpair] Debug \item[silent] Suppress \ix{warnings} and second-pass \ix{error messages}. Only use this option if either you don't care what the diagram looks like or you've typeset it and looked at the result already. Not recommended. \index{silent} \item[size={\em distance\/}] Set both \verb/height=/{\em distance\/} and \verb/width=/{\em distance}.\index{size} \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/.\index{size} \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.\index{text flow} \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.\ixcmd\thicklines \item[thin{[={\em breadth\/}]}] This is similarly analogous to \verb/\thinlines/.\ixcmd\thinlines The default rule breadth is the same as that used by \TeX, namely \verb/\fontdimen8\textfont3/. \item[tight] Force all of the cells in the grid to have exactly the \ix{size} you specify.\index{tight}\index{height}\index{width}\index{loose} This is recommended for the final version of a document, but is not the default because it may cause \ix{over-print}ing, 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 \ix{TPIC} \verb/\special/ commands instead of \LaTeX\ line segments to draw diagonal lines. These are supported by {\sc Textures}, \person{Tomas}{Rokicki}'s \verb/dvips/ and \person{Paul}{Vojta}'s \verb/xdvi/.% \ixcmd\special\index{xdvi}\index{dvips} \item[uppershortfall={\em distance\/}] Analogous to \verb/leftshortfall/, except above.\index{short fall} \item[vcentre {\em or\/} vcenter] Vertical positioning is the same as with \TeX's \verb/\vcenter/\ixcmd\vcenter\ixcmd{[c]}\index{centre} command or \LaTeX's \verb/[c]/ option. However \verb/vmiddle/ is what is usually wanted. \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.\index{centre} \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$ \ix{triangle} and a $9\times 5$-grid makes a regular \ix{hexagon} (page~\pageref{hexagon}). \index{width}\index{height} \item[vtrianglewidth={\em distance\/}] Set \verb/width/={\em distance\/} and then \verb/height/ to make these figures. \item[w={\em distance or\/} width={\em distance\/}] Set the distance between the centre of one column and the next to the right.\index{width} \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.\index{adjunction} \ixcmd\hLine\ixcmd\dashv\index{empty cells}\index{invisible objects} \begin{verbdiag}[loose,height=.8em,width=0pt] &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=0pt] &Z \times X &\relax\rTo^f & Y \\ \ &&\relax\hLine && \ \\ &Z & \rTo^{\ {\bf curry}(f)\ } & Y^X \\ \enddiagram \ixcmd\hfill If you want the $Z$s lined up, it's no good \verb/\hfill/ing the second one on the right, because the arrow will not stretch to meet it\footnote{There is no way of detecting {\em where\/} \ix{glue} is placed inside a box, so the \ix{stretch}ing 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}\index{diagonal arrows} 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. \ixcmd\line\ixcmd\vector\ixcmd\ruTo\ixcmd\rdTo\ixcmd\luTo\ixcmd\ldTo \ixcmd{()}% 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. \ixcmd\laf\ixcmd\lah\index{line10 and linew10 fonts}\index{height}\index{width} 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,% \footnote{The option \texttt{diagonalbase} changes this; it is intended for emulation of other diagrams packages.} 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. \ixcmd\SEpbk\ixcmd\SWpbk\ixcmd\NEpbk\ixcmd\NWpbk For example, here is the diagram which defines a \ix{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 ``\ix{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.} \label{Hasse} The main use of diagonals other than the simplest ones is for illustrating \ix{order structures} (``\ix{Hasse diagrams}'').\index{posets}\index{lattices} Posets are trivial categories, but in practice they're the most difficult diagrams to draw! \begin{quote} \begin{verbatim} \begin{diagram}[height=2.5em,width=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}[height=2.5em,width=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} \ixcmd\DiagonalMap\index{lams1 to 5 fonts}\index{line10 and linew10 fonts} 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 \person{Michael}{Spivak}'s fonts \verb/lams1/ to \verb/lams5/), please contact me to assist with conversion. \ixcmd\raise\ixcmd\lower\ixcmd\raisebox\index{abut}% By default, the diagonal arrows are set on the \ix{first pass} using \LaTeX\ line segments. By~contrast, the horizontals and verticals use ruled lines wherever possible and are adjusted on a \ix{second pass} of the diagram (within the \verb/\enddiagram/ command) to meet their endpoints. When the diagonals are set during the first pass, everything happens within the cell where they are declared, where the algorithm has no access to information about the size (and exact whereabouts) of the objects at which the arrows are meant to point. Therefore the lengths of the diagonals are chosen somewhat arbitrarily, though the \verb/abut/ option will make them touch a \verb/\cdot/. To get better results we have to use more sophisticated methods, and go outside what is strictly ``standard'' \TeX. %========================================================================== \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 for \ix{rotation}.\index{diagonal arrows} This means that we have \begin{itemize}\ixcmd\line\ixcmd\vector \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 \ix{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,\ixcmd\special\index{dvips} \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 \PiCTeX\ does.\ixprotect\PiCTeX \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.\index{line10 and linew10 fonts} Arrowheads from this font are used irrespectively of those chosen by the \verb/heads/ option. The nearest% \footnote{The approximation uses \ix{continued fractions}, {\em alias\/} \ix{Euclid's algorithm}, with a correction. There is also code for computing \ix{Pythagorean sums} (for the lengths of rotated diagonals) and \ix{trigonometric functions} (currently unused).} available \LaTeX\ slope is chosen, with the effect that arrows may sometimes fall short or overshoot: \verb/height/ and \verb/width/ should be set with this in mind.\index{height}\index{width}\index{size} \item If the \verb/PostScript/ option is enabled, horizontal arrows are used, and \verb/\special/ commands% \footnote{The code is adapted from \person{Tomas}{Rokicki}'s {\tt \ix{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 (page~\pageref{PS}) make use of this in different ways, so it is necessary to specify which one you are using. I~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.\index{oztex@Oz\protect\TeX} \item If the \verb/TPIC/% \footnote{\ix{TPIC} is a graphics preprocessor for \TeX\ by \person{Tim}{Morgan} which uses this set of {\tt\string\special} commands. The same ones were also adopted by \ixcmd\special \person{Dirk}{Grunwald} for {\tt \ix{texpictex}} and by \person{Conrad}{Kwok} for {\tt \ix{eepic}}, which are \LaTeX\ macro packages for \ix{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.\index{xdvi}\index{dvips} \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. 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 \begin{itemize} \item 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. \item development of new features will use \verb/PostScript/ mode, without which a ``\ix{second class service}'' will be provided. \end{itemize} %=========================================================================== \section{Regular figures} The difference between these options can be seen by trying to draw a regular \ix{hexagon}.\label{hexagon}\index{abut}\index{tight} $$\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 --- though it is surprisingly accurate! \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} The \verb/vtrianglewidth/ option and its variants set the \verb/width/ and \verb/height/\index{width}\index{height}\index{size} of the cells, but the array retains the symmetry of a rectangle. Tesselations of \ix{triangle}s and \ix{hexagon}s may be drawn in this way. Drawing a regular \ix{pentagon} requires rows and columns of different sizes. It~is envisaged that only a few special ways of doing this will be used, so this feature is provided by a \emph{declaration}% \footnote{I cannot think of a natural way of specifying the distances without coding general \ix{Gaussian elimination}. I'm~quite happy to accept angles expressed in degrees.} of the form\ixcmd\newdiagramgrid\label{grid} \begin{quote} \begin{verbatim} \newdiagramgrid{pentagon}% {0.618034,0.618034,1,1,1,1,0.618034,0.618034}% {1.17557,1.17557,1.902113,1.902113} \end{verbatim} \end{quote} (In fact this is already made within the source of the package.) The numbers in the first list specify the distances between the centres of the first and second columns, the second and third, and so on, and similarly those in the second list the distances between the baselines of the rows. The units are the specified cell \verb/height/ and \verb/width/. Once declared, the \ix{grid} is chosen by name using the obvious option. Note that this forces the \verb/tight/ option.\index{tight} \begin{verbatim} \begin{verbdiag}[grid=pentagon,PostScript] &&&&(A*B)*(C*D)& \\ &&&\ruTo(4,2)^\Assl&&\rdTo(4,2)^\Assl&\\ A*(B*(C*D))&&&&&&&&((A*B)*C)*D&\\ &\rdTo_{\Id*\Assl}&&&&&&\ruTo_{\Assl*\Id}&\\ &&A*((B*C)*D)&&\rTo^\Assl&&(A*(B*C))*D& \end{verbdiag} \end{verbatim} \begin{diagram}[grid=pentagon,small] &&&&(A*B)*(C*D)& \\ &&&\relax\ruTo(4,2)^\Assl&&\relax\rdTo(4,2)^\Assl&\\ A*(B*(C*D))&&&&&&&&((A*B)*C)*D&\\ &\relax\rdTo_{\Id*\Assl}&&&&&&\relax\ruTo_{\Assl*\Id}&\\ &&A*((B*C)*D)&&\relax\rTo^\Assl&&(A*(B*C))*D& \end{diagram} A similar grid for a pentagon with a vertical side is obtained by the \verb/gridx/ option. The grid \verb/perspective/\index{perspective} has this effect on the \ix{cube} on page~\pageref{cube}: \begin{diagram}[grid=perspective] 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} Without the \verb/PostScript/\index{PostScript} option the \ix{diagonal arrows} will not be set correctly. %=========================================================================== \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} \ixprotect{\TeX book}\index{Exercise 18.46}\ixprotect{\TeX ercise 18.46}% \index{emulation}% 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. \ixcmd\matrix 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 {\it\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. \ixcmd\mapright\ixcmd\mapleft\ixcmd\mapup\ixcmd\mapdown \ixcmd\inputlineno \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. \ixprotect\AmSTeX\index{array environment}\ixcmd\endmatrix 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}\index{emulation} 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.% \index{acknowledgement} \bigskip \noindent{\bf \ix{American Mathematical Society}}% \ixprotect\AmSTeX\ixprotect\AMSLaTeX\index{amscd.sty} (\AmSTeX, and \AMSLaTeX's \verb/amscd.sty/): see Michael Spivak below. \bigskip \noindent{\bf \person{Michael}{Barr}}'s \verb/catmac/\index{catmac.tex} 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 \ixcmd\square \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.% \ixcmd\atriangle\ixcmd\btriangle\ixcmd\dtriangle\ixcmd\ptriangle \ixcmd\qtriangle\ixcmd\Atriangle\ixcmd\Ctriangle\ixcmd\Driangle \ixcmd\Vriangle\ixcmd\Arianglepair\ixcmd\Vrianglepair\ixcmd\recurse \bigskip \noindent{\bf \person{Karl}{Berry}}'s \verb/eplain/:\index{eplain.tex} see Steven Smith below. \bigskip \noindent{\bf \person{Francis}{Borceux}}'s \verb/diagram/ package uses \LaTeX's \verb/picture/ environment\index{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 curved, free and multiple arrows are not implemented, and all size parameters are ignored. \bigskip \noindent{\bf \person{Eitan}{Gurari}}'s \verb/dratex/:\index{dratex} I haven't looked in to this package yet. \bigskip \noindent{\bf Donald Knuth}'s Exercise 18.46: 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 \person{Frank}{Mittelbach}}'s \AMSLaTeX\space \verb/amscd.sty/: see Michael Spivak below. \bigskip \noindent{\bf \person{John}{Reynolds}}: I haven't looked in to this package yet. \bigskip \noindent{\bf \person{Kris}{Rose}}'s \XYpic\ixprotect\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 \person{Rainer}{Sch\"opf}}'s \AMSLaTeX\space \verb/amscd.sty/: see Michael Spivak below. \bigskip \noindent{\bf \person{Steven}{Smith}}: I haven't looked in to this package yet. \bigskip \noindent{\bf \person{Michael}{Spivak}}'s \LAMSTeX:\ixprotect\LAMSTeX similar comments apply here as to Kris Rose's package. \bigskip\noindent{\bf Michael Spivak}'s \AmSTeX\space\ixprotect\AmSTeX (as described in {\em The Joy of \TeX\/})% \index{joy@{\em The Joy of \protect\TeX}} had some very primitive commutative diagrams,\ixcmd\CD\ixcmd\endCD enclosed in \verb/\CD...\endCD/. \iffalse Horizontal arrows were drawn with the commands \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.\ixprotect\AMSLaTeX\index{amscd.sty} 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 \person{Timothy}{van Zandt}}'s \verb/pstricks/:\index{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.% \index{mouse}\index{wysiwyg} \bigskip\noindent{\bf How do I get it?} See section~\ref{get}. \bigbreak\noindent{\bf Is it compatible with ...?}\index{compatibility} From 1986 until after version~3 of this package was announced in July~1990 I~used \verb/plain/ \TeX,\index{plain \protect\TeX} whilst giving assistance to colleagues who used \LaTeX. \ixprotect\LaTeX In~December 1991 the local \TeX\ system was converted to use \person{Frank}{Mittelbach} and \person{Rainer}{Sch\"opf}'s font selection (NFSS1)\index{NFSS} for \LaTeX. Now we use \LaTeXe\ixprotect\LaTeXe, which includes NFSS2. 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. It is, regrettably, not uncommon for publishers to copy parts of \LaTeX\ and {\tt\ix{article.sty}} into their own journal and conference styles,% \index{journals}\index{conference proceedings} and not keep these up to date with respect to bug-fixes and other changes. Many of the bug reports which I~receive in connection with the diagrams package are in fact traceable to errors of this kind in publishers' styles. My~policy is that I~will no longer fix bugs in software from commercial organisations for free, but suggest some consultancy arrangement. If, however, it is possible to make the package more robust and circumvent such bugs in other software then I~will do this. \person{Richard}{Stallman}'s \verb/texinfo/\index{texinfo.tex} 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 \ixcmd\catcode 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. Unfortunately the package does not seem to work with TeX-XeT, the extension to \TeX\ for typesetting Arabic and Hebrew. I~believe this problem is insuperable. \bigbreak\noindent{\bf Does it use any special \ix{fonts}?} No. One of the design criteria of the package is that all of the components come from the standard \ix{Computer Modern fonts} that come with \TeX, except that the diagonal arrowhead characters come from \LaTeX's \verb/line10/ font.\index{line10 and linew10 fonts} 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\ixprotect\LAMSTeX\space fonts to [my `personal' computer]. I would much prefer embedded {\sc PostScript} commands.\index{PostScript} Custom \ix{DVI} drivers such as \verb/xdvi/,\index{xdvi} on the other hand, are not widely available, at least not for [my computer].'' \end{quote} There are {\em optional\/} arrowheads from the \ix{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 \ix{FTP} from \verb/e-math.ams.com/.\index{anonymous FTP} 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 \person{Donald}{Knuth}}.\index{pixel size}% \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.\index{dpi} If you have other arrowhead fonts available, such as those provided by \person{Kris}{Rose} for \XYpic\ixprotect\XYpic\ and \person{Michael}{Spivak} for \LAMSTeX,\ixprotect\LAMSTeX\ you may use them if you write your own \verb/\newarrowhead/ commands.% \ixcmd\newarrowhead \bigbreak\noindent{\bf Corruption by \ix{electronic mail}.}\index{corruption} If you cannot use FTP and the route to you by electronic mail passes through non-\ix{ASCII} machines (such as through \ix{BITNET}), the file may suffer corruption.\index{EBCDIC} 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 \ix{dynamic memory allocation}. Although \verb/tex.web/\index{tex.web} says loudly ``Don't Touch!'', the compile-time parameters listed on page 300 of {\it The \TeX book\/} {\em are\/} meant to be changeable, and \person{Donald}{Knuth} provided a mechanism (\verb/tex.ch/) for doing so. \person{Karl}{Berry}'s widely used \verb/web-to-C/\index{web-to-C} {\sc Unix}\index{Unix} port of \TeX\ increases them substantially --- in accordance with the \ix{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\index{oztex@Oz\protect\TeX} has not made the changes --- please complain about this to its author, \person{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!\index{error recovery} If you get ``no room for another \verb/\dimen/'' \ixcmd\dimen it probably means you're using \PiCTeX\ixprotect\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/)\index{picture environment} \verb/\put/ commands inside macros. The emulation of \person{Francis}{Borceux}'s macros, for instance, is 50\% faster than the original. \person{Kris}{Rose}'s \XYpic\ixprotect\XYpic\ takes about six times as long to draw the same diagram. \bigbreak\noindent{\bf Default \ix{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.% \index{diagonal arrows}\index{PostScript} \bigbreak\noindent{\bf Display options.} If, as was advised in earlier versions of this manual, you enclose the diagram in \verb/$$...$$/\ixcmd{$$} or a \index{displaymath environment}, the new \ix{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/. \ixcmd\diagramstyle \LaTeX's \verb/center/ environment is,\index{center environment} for this purpose, {\em not\/} a display but a paragraph of text, with some strange results if you use the \verb/textflow/ option;% \index{text flow} in this case you should use the \verb/inline/ option\index{in line} on the individual diagrams to make them appear side by side. \bigskip\noindent{\bf Large \ix{gaps} between diagonals and their endpoints.} \index{PostScript}\index{diagonal arrows} 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 \ix{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.\index{tight} 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.\ixcmd\small\ixcmd\tiny This real-life example illustrates another common problem: the symbols $\lessthan$ and $\greaterthan$ are {\em \ix{relations}\/} $\langle$not~brackets$\rangle$ --- and it's not unusual 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:% \ixcmd\langle\ixcmd\rangle\ixcmd{<}\ixcmd{>}\ixcmd\mathcode \ixcmd\mathchardef \begin{quote}\begin{verbatim} \mathcode`\<="4268 % < = \langle \mathcode`\>="5269 % > = \rangle \mathchardef\gt="313E % arithmetic \mathchardef\lt="313C % strict order \end{verbatim}\end{quote} \ixcmd\mbox 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. In~\LaTeXe, try using the \verb/\text/\ixcmd\text\ and \verb/\ensuremath/\ixcmd\ensuremath\ commands. %\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.}% \index{badly drawn diagonals}\index{diagonal arrows} This warning is given if (a)~you use diagonals which are set on the first pass ({\em i.e.}~\LaTeX, \ix{TPIC} or \verb/fixed/\index{fixed}) {\em and\/} (b)~some of the columns are significantly wider than was specified by the \verb/width/ or \verb/size/ option.\index{width}\index{size} 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.% \index{PostScript}\index{width}\index{size} \bigskip\noindent{\bf Labels on arrows \ix{over-print} objects or \ix{arrowheads} become detached.}\index{labels}\index{decapitated arrows} 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.% \index{midshaft}\index{width}\index{size} \bigskip\noindent{\bf Mixed or missing \ix{arrowheads}.} The idea of providing the \verb/heads/\index{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.}% \index{undefined control sequence} To~use the curly and black arrowheads you need the \ix{AMS symbols fonts}; if one of these (\verb/\curlyvee/, \verb/\blacktriangleleft/)% \ixcmd\curlyvee\ixcmd\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.\index{amssymb.sty} If~you find a symbol with a \ix{meaningless name} like \verb/\CD@gF/ \ixcmd{\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 \ix{diagrams within diagrams}?}% \index{nested diagrams}\ixcmd\pile\index{parallel arrows} 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 ``\ix{interwoven alignment preambles} are not allowed'' error ({\it The \TeX book}, page 299).\ixprotect{\TeX book} 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./}\label{miss endcs} \index{missing \protect\verb/\endcsname/}\ixcmd\endcsname\ixcmd\the 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:\ixprotect\LaTeXe\ixcmd\usepackage \begin{quote} \verb/\usepackage[flushleft=\mainindent]{diagrams}/ \end{quote} where \verb/\mainindent/ is a \verb/\dimen/; in this case \verb/\the\mainindent/ will work, because \verb/\the/ expands the \verb/\dimen/ to its value ({\it\TeX book}, page 214). 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 \ix{overprint} objects.} \index{horizontal arrows}\ixcmd\hfill\ixcmd\hss\ixcmd\hspace\ixcmd\hidewidth 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. \index{bug reports} \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. \ixcmd\scrollmode\index{error recovery} 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}\index{conditions of use}\index{copyright} 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. \index{registration as a user} Please ensure that you are registered with me as a user, so that you can be informed of new versions. Any \ix{electronic mail} message containing the words ``commutative'' or ``diagram'' automatically registers you, as does quoting your electronic mail address when fetching it by~\ix{FTP} from \verb/ftp.dcs.qmw.ac.uk/. \index{acknowledgement} 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.\index{commercial use} This includes a document whose copyright is seded by the author (for valuable consideration or not) to another person or body which subsequently intends to collect \ix{royalties} for its reproduction. This applies to certain journals and conference proceedings. Permission is now granted for its use for the production of academic research and \ix{textbooks}, \ix{journals} and \ix{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} Use by commercial organisations is considered (for this purpose) to be academic if the results are intended for publication 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.% \index{military use} No \ix{warranty} is given with this software. It is supplied ``\ix{as is}'', and neither the source nor this manual nor anything else shall be taken as a \ix{representation} that it will perform any particular function, is suitable for any particular purpose or is of \ix{merchantable quality}. In executing the software, the user implicitly accepts the above conditions and indemnifies\index{indemnification} the author, \ix{Queen Mary and Westfield College} and any person through whom the software was obtained, against \ix{liability} for direct or consequential \ix{damages} arising from the use of this software. {\em Whenever\/} you use computers you {\em must\/} keep at least two back-up copies of all of your files, with one of them well away from the machine, in case of fire or major failure. Before sending any documents for publication or to an expendive printer make a thorough visual check using a previewer such as \verb/xdvi/\index{xdvi} and a low resolution printer. %========================================================================= \section{Reverse compatibility}\index{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.\ixcmd\mkern \item \verb/\VerticalMapHeight/ and \verb/\VerticalMapDepth/ commands are obsolete and are ignored: they should be removed.% \ixcmd\VerticalMapHeight\ixcmd\VerticalMapDepth \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/.% \ixcmd\HorizontalMap\ixcmd\VerticalMap\ixcmd\DiagonalMap \item Nested \verb/\commdiag/ commands for parallel maps must be changed to \verb/\pile/.\ixcmd\commdiag\ixcmd\pile \index{nested diagrams}\index{parallel arrows} \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 ``\ix{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&&/.% \ixcmd\across \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}% \ixcmd\HorizontalMapLength\ixcmd\VerticalMapHeight \ixcmd\VerticalMapExtraDepth\ixcmd\DiagonalLineSegments \ixcmd\VerticalMapDepth\ixcmd\VerticalMapExtraHeight \item The \ix{labels} on southeast and northwest \ix{diagonal arrows} have changed their position. \verb/^/~and \verb/_/\ixcmd{^}\ixcmd{_} previously meant left and right respectively for diagonals; they now mean --- more logically --- above and below; \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 \ix{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.% \index{bent lines}\ixcmd\dlBent\ixcmd\ruBentto\ixcmd\HmeetV \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.% \ixcmd\HorizontalMap\ixcmd\VerticalMap\ixcmd\DiagonalMap \item Negative spacing around \ix{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.\ixcmd{$$}\index{display options} \item Diagonal arrows with ``\ix{compass}'' names, particularly the ones from \verb/extra-diagonals.tex/ \index{extra-diagonals.tex}\index{diagonal arrows} (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.\ixcmd\lt\ixcmd\gt\ixcmd{>}\ixcmd{<}% \ixcmd\greaterthan\ixcmd\lessthan \item The arrow commands with names like \verb/\rArr/ and \verb/\rTo/ now all use the default \ix{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.\ixcmd\rArr\index{vee arrowheads}% \ixprotect{\LaTeX\ arrowheads} \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.\index{arrowheads} \item Explicit movement of \ix{diagonal arrows} vertically using \verb/\raise/, \verb/\lower/ or \verb/\raisebox/ \ixcmd\raise\ixcmd\lower\ixcmd\raisebox or horizontally by spacing commands or otherwise will not work for the diagonals which are adjusted to meet their endpoints.\index{stretch} For the time being use either of the options \verb/noPS/ or \verb/fixed/\index{PostScript}\index{fixed} to suppress adjustment. A~new option \verb/crab/\index{crab} will be introduced shortly to allow \ix{sideways movement of arrows}. \end{itemize} \item[Future:] The following are high on the agenda: \begin{itemize} \item Placing of labels at the head and tail of arrows. \item Curved arrows (\verb/PostScript/ only). \item Sideways movement of arrows. \item An~alternative way of specifying the positions of arrows, namely at the tail with signed relative co-ordinates for the head, to allow emulation of \person{Kris}{Rose}'s \XYpic\ixprotect\XYpic\ and \person{Michael}{Spivak}'s \LAMSTeX\ixprotect\LAMSTeX. \item Shifting objects, by specifying the left or right width. \item Option to rotate labels on diagonals or leave them horizontal. \item Application to electronic circuit diagrams. \end{itemize} \end{description} Suggestions for improvements and further applications ({\em e.g.\/} proof nets, Petri nets and circuit diagrams) are welcome. %========================================================================== \section{Availability}\label{get} The diagram package is currently available as a single 112kb\footnote{Without comments; the development version is about 300kb.} 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. \index{anonymous FTP} It~is easiest to get this package by anonymous \ix{FTP}. This stands for ``\ix{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. The authoritative version of the package may be found at the FTP address \begin{quote} {\tt ftp://ftp.dcs.qmw.ac.uk/pub/tex/contrib/pt/diagrams} \end{quote} It may also be obtained from the \ix{Comprehensive \TeX\ Archive Network} (\ix{CTAN)} at any of the sites \begin{quote} \begin{tabular}{llll} ftp.adfa.oz.au &Australia& /pub/tex/ctan\\ ftp.cs.rmit.edu.au &Australia& /tex-archive\\ ftp.muni.cz &Czech Republic& /pub/tex/CTAN\\ ftp.tex.ac.uk &England& /tex-archive\\% (/pub/tex /pub/archive)\\ ftp.loria.fr &France& /pub/unix/tex/ctan\\ ftp.uni-bielefeld.de &Germany& /pub/tex\\ ftp.uni-stuttgart.de &Germany& /tex-archive (/pub/tex)\\ ftp.dante.de &Germany& /tex-archive\\% (/pub/tex /pub/archive)\\ ftp.center.osaka-u.ac.jp &Japan& /CTAN\\ wuarchive.wustl.edu &Missouri, USA& /packages/TeX\\ ftp.cs.ruu.nl &Netherlands& /pub/tex-archive\\ ftp.duke.edu &North Carolina, USA& /tex-archive\\ sunsite.unc.edu &North Carolina, USA& /pub/packages/TeX\\ ftpserver.nus.sg &Singapore& /pub/zi/TeX\\ nic.switch.ch &Switzerland& /mirror/tex\\ dongpo.math.ncu.edu.tw &Taiwan& /tex-archive\\ ftp.uu.net &Virginia, USA& /pub/text-processing/TeX\\ ftp.shsu.edu &Texas, USA& /tex-archive\\% (/pub/tex /pub/archive)\\ \end{tabular} \end{quote} where the root of the archive is the given directory and my package is \begin{quote} {\tt macros/generic/diagrams/Taylor/diagrams.tex} \end{quote} relative to this. The ``\verb/archie/''\index{archie} utility is extremely useful as a way of locating software and other information on the \ix{Internet}. You just give it (part of) the name of the file you want ({\em e.g.}~``diagram'') and it will tell you where files of that name are located in numerous public \ix{FTP} archives around the world. Beware, however, that many of them are just ``\ix{magpies' nests}'' --- they collect things from other places without verifying their authenticity or keeping them up to date.\index{anonymous FTP} If you are unable to use FTP it is possible to get the package (and indeed anything you can get by ftp) by electronic mail. I~do not recommend this method, because it is susceptible to corruption, and you have to concatenate the files and remove the mail headers. Send the following message to \verb//: \begin{quote} \begin{verbatim} open ftp.dcs.qmw.ac.uk cd pub/tex/pt/diagrams get diagrams-V4-news get diagrams.tex get diagrams-manual.tex quit \end{verbatim} \end{quote} You will get an acknowledgement message first, followed by the files, and finally a job log file. The files 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 \makeatletter\pt@input{manual.ind}{}{} %============================================================================ \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) % new sections: % other TeX macros of mine % resource usage % list of errors % how to draw {\em nice\/} diagrams % FTP instructions