\documentclass[12pt]{article} \input diagxy \xyoption{curve} \textwidth 6in \oddsidemargin 0pt \makeindex \begin{document} \def\xypic{\hbox{\rm\Xy-pic}} \title{A new diagram package (Version \thedate)} \author{Michael Barr\\Dept of Math and Stats\\McGill University\\805 Sherbrooke St. W\\Montreal, QC Canada H3A 2K6\\[5pt] barr@barrs.org} \date{} \maketitle \makeatletter \contentsline {section}{\numberline {1}Why another diagram package?}{2} \contentsline {subsection}{\numberline {1.1}The latest version}{3} \contentsline {subsection}{\numberline {1.2}Main features}{3} \contentsline {subsection}{\numberline {1.3}Compatibility}{3} \contentsline {subsection}{\numberline {1.4}Errant spaces}{4} \contentsline {subsection}{\numberline {1.5}Font sizes}{4} \contentsline {subsection}{\numberline {1.6}On \LaTeX \ 2.09 and \LaTeX \ 2e}{5} \contentsline {subsection}{\numberline {1.7}Acknowledgments}{5} \contentsline {subsection}{\numberline {1.8}License}{6} \contentsline {section}{\numberline {2}The basic syntax}{6} \contentsline {subsection}{\numberline {2.1}A word about parameters}{7} \contentsline {section}{\numberline {3}Defined diagrams}{8} \contentsline {section}{\numberline {4}Examples}{10} \contentsline {subsection}{\numberline {4.1}Complex diagrams}{19} \contentsline {subsection}{\numberline {4.2}Empty placement and moving labels}{23} \contentsline {subsection}{\numberline {4.3}Inline macros}{25} \contentsline {subsubsection}{\numberline {4.3.1}Added:}{26} \contentsline {subsection}{\numberline {4.4}2-arrows}{26} \contentsline {subsection}{\numberline {4.5}Mixing \hbox {\rm \unhbox \voidb@x \hbox {\kern -.1em X\kern -.3em\lower .4ex\hbox {Y\kern -.15em}}-pic}\ code}{27} \contentsline {subsection}{\numberline {4.6}Diagram from TTT}{29} \makeatother \kern 40pt {\narrower For the fashion of Minas Tirith was such that it was built on seven levels, each delved into a hill, and about each was set a wall, and in each wall was a gate. -- J.R.R.\ Tolkien, ``The Return of the King''\footnote{These macros are at the seventh level of nesting. The first level is the code actually executed directly by the processor. The second is the microcode, burned into the chip, that interprets the assembly language instructions into the ones that are directly executed. Level three is the language, usually C, but originally Pascal, into which the Web code, the fourth level, is compiled. The fifth level is \TeX\ itself, which is best seen as a high level programming language for mathematical text processing. Level six is the \xypic\ code in which these macros, level seven, are written.} } \kern 5pt Note: This is the first increase in functionality since the original general release. The macros \index{\backslash to}\verb.\to. and \index{\backslash two}\verb.\two. that make inline arrows and pairs of arrows now accept an option to vary the types of the arrow, for example to get a pair of adjoints going in opposite directions. A macro that makes three arrows has been added as well as a macro for a 3 x 3 diagram that can be expanded into a map between two exact sequences. A new optional parameter has been added to \index{\backslash to}\verb.\to., \index{\backslash two}\verb.\two. and \index{\backslash three}\verb.\three. to allow the user to override the automatic computation of the arrow size. See the sections on inline arrows, page~\pageref{added} and page~\pageref{complex} for details. \section{Why another diagram package?} This started when a user of my old package, diagram, wrote to ask me if dashed lines were possible. The old package had dashed lines for horizontal and vertical arrows, but not any other direction. The reason for this was that \LaTeX\ used rules for horizontal and vertical arrows, but had its own fonts for other directions. While rules could be made any size, the smallest lines in other directions were too long for decent looking dashes. Presumably, Lamport was worried about compile time and file size if the lines were too short, considerations that have diminished over the years since. Also arrows could be drawn in only 48 different directions, which is limiting. My macros were not very well implemented for slopes like 4 and 1/4, since I never used such lines. There was certainly an alternative, \xypic, for those who wanted something better. But it was hard to learn and I was not entirely happy with the results. The basic interface used an \index{\backslash halign}\verb.\halign.. This meant that no extra space was allotted to an arrow that had a large label. In addition, the different slots could have different horizontal size, which could result in a misshapen diagram. I used it in a paper that had a `W' shaped diagram whose nodes had different widths and the result was quite obviously misshapen. On the other hand, the graphics engine underlying \xypic\ is really quite remarkable and it occurred to me that I could try to redraft diagram as a front end. The result is the current package. It has been tested mainly with version 3.7, so there is no guarantee it would work with any earlier version (or, for that matter, later). A limited amount of testing with version 3.6 suggests that the only thing that does not work is the 2-arrows; these come out vanishingly short. So despite the desire for logical programming, it still seems that for some purposes, it is desirable to have a system in which you specify what goes where and where the arrows are drawn. \subsection{The latest version} The latest version can be downloaded at \verb,ftp://ftp.math.mcgill.ca/pub/barr/diagxy.zip, or by anonymous ftp from \verb,ftp.math.mcgill.ca//pub/barr/diagxy.zip,. \subsection{Main features} \begin{itemize} \item A general arrow drawing function \index{\backslash morphism}\verb.\morphism.. \item Various common diagram shapes such as squares, triangles, etc. \item A few special shapes such as cube and $3\times3$ diagrams. \item Small 2-arrows that can be placed anywhere in a diagram, much like \LaTeX's picture environment. \item A uniform syntax, while allowing access to all of \xypic's capabilities \item Never expires and does not request acknowledgment. \end{itemize} \subsection{Compatibility} The syntax described below is not compatible with the original diagram package. Every front end of this sort represents a trade-off between simplicity and utility. A package that simply upgraded the syntax to allow more dashed (and dotted) lines would have been just as easy to implement, but would have made poor use of the wonderful possibilities of the underlying \xypic\ package. Also there would have been too many different arrow specifications (they would have had to go at least in the range $[-9,9]$) for easy memory) and still would not have included things like inclusion arrows. To those who would have liked a simpler syntax, I apologize. Those who would want more flexibility, I remind that the entire \xypic\ package is there for use. \subsection{Errant spaces} There is one point that cannot be made too strongly. {\em Watch for errant spaces.} Unlike the old diagram package, which was carried out in math mode so that spaces were ignored, \xypic\ is not in math mode and spaces will mess up your diagrams. On the other hand, it will not be necessary to enclose duplicate nodes inside \index{\backslash phantom}\verb.\phantom., since the registration between different nodes is perfect. In the old package, for reasons that I now understand, objects did not always register properly. This was a flaw built in to the very heart of the package and is not worth correcting, although it could have been done better in the first place. If you see an object in double vision, then the almost certain cause is that a space has gotten in there somewhere. I have attempted to prevent this by liberal use of \index{\backslash ignorespaces}\verb.\ignorespaces. in the definitions, but one cannot always be sure and while testing, I found a number seemingly innocuous spaces that messed up diagrams. When in doubt, always terminate a specification with a \index{%}\verb.%.. See the examples. \subsection{Font sizes} According to the documentation of \xypic, the declarations \begin{verbatim} \xyoption{tips} \SelectTips{xy}{12} \end{verbatim} \index{tips} will cause 12 point tips to be used. This does not appear to be the case. The only way I can seem to get larger font sizes is to add \index{\backslash fontscale{x}}\verb.\fontscale{x}., with \index{x}\verb.x. taking on the values \verb.0,h,1,2,3,4,5., after \xypic\ is loaded. With \verb.11pt. you will want \verb.h. and with \verb.12pt. you will want 1. The others are in case you use larger sizes for transparencies or for later reduction. While on the subject, I might mention that if you want thicker arrow shafts without enlarging anything else you could add the declaration \begin{verbatim} \font\xydashfont=xydash scaled \magstep1 \end{verbatim} or even larger. However, this does not thicken the arrow tips and is not really recommended. There is probably no way (short of creating your own fonts) to thicken the tips without also lengthening them. \subsection{On \LaTeX\ 2.09 and \LaTeX\ 2e} Since I have no other forum to do so, I use this space to indulge in a personal rant, which you may skip since it has nothing to do with the package (except periphally, since it explains why I have not made 14, 17, and 20 point style files for \LaTeX\ 2e). Recent distributions of \TeX\ have omitted latex.tex, the source file for \LaTeX\ 2.09. If you make a posting on comp.text.tex, admitting to using the older version, you are certain to get one or more replies admonishing you that \LaTeX\ 2.09 is obsolete and should not be used. There are at least a couple of good reasons for continuing to use the older version (along with some reasons for switching, especially if you are using a language other than English). For one thing, the compatibility mode is useless if you have used additional fonts, as I have (most importantly, cmssbx, where many use bbbold, one of the ugliest fonts to see the light of day). In fact, the most significant change in \LaTeX\ 2e is that it uses the new font selection system and the compatibility mode makes no attempt to be compatible with the old one. The second reason for not switching is that, ``If it ain't broke, don't fix it.'' For many the old \LaTeX\ worked fine, why change? If you want to use new fonts in \LaTeX\ 2e it is certainly possible, but the instructions for doing so are embedded holographically in Chapter 7 of The \LaTeX\ Companion and took me days to decipher. I am still not convinced that I am doing it right, although it seems to work. The third---and to me most important---is that the file latex.tex is extensively documented internally and it is relatively easy to make whatever changes one wants. I have never changed the source, but always put the changes in another file. In this way, I have changed, for example, \index{\backslash @startsection}\verb.\@startsection. in various ways. It is clear that Lamport intended that his version of \LaTeX\ be user-modifiable. It is equally clear that the implementers of the new version had no interest in that. They didn't go out of their way to make it hard, but they did nothing to encourage it and the documentation is entirely on how to use it. \subsection{Acknowledgments} First, I would like to thank Kris Rose for a superb programming job that made this package possible. The original versions of \xypic\ were based on matrices, but this version includes code to place an arrow with two nodes (more precisely, their centers) a user-definable distance apart and that is exactly what I needed. Second I would like to thank Ross Moore who answered innumerable questions about the use of the macros that the documentation did not answer or at least I could not understand what it said. I thank Donald Arsenau answered several of my questions about the internals of \TeX\ that I did not understand clearly and Steve Bloom who found a couple of typos in the first version of these notes. Finally, I would like to thank all those, but especially Charles Wells, who gave me opinions on the best syntax. But I made the final decisions and if you have any complaints, you can direct them to me. Not that I am likely to change anything at this date. \subsection{License} The use of this package is unrestricted. It may be freely distributed, unchanged, for non-commercial or commercial use. If changed, it must be renamed. Inclusion in a commercial software package is also permitted, but I would appreciate receiving a free copy for my personal examination and use. There are no guarantees that this package is good for anything. I have tested it with LaTeX 2e, LaTeX 2.09 and Plain TeX. Although I know of no reason it will not work with AMSTeX, I have not tested it. \section{The basic syntax} The basic syntax is built around an operation \index{\backslash morphism}\verb.\morphism. that is used as \index{\backslash morphism} \begin{verbatim} \morphism(x,y)|p|/{sh}/[N`N;L] \end{verbatim} The last group of parameters is required. They are the source and target nodes of the arrow and the label. The remaining parameters are optional and default to commonly used values. Currently, the \verb.L.\index{label} is set in \index{\backslash scriptstyle}\verb.\scriptstyle. size, but this can easily be changed by putting \index{\backslash let\backslash labelstyle=\backslash textstyle} \verb.\let\labelstyle=\textstyle. in your file. The parameters \verb.x. and \verb.y. give the location of the source node within a fixed local coordinate system and \verb-x+dx- and \verb-y+dy- locate the target. To be precise, the first coordinate is the horizontal center of the node and the second is that of the base line. These distances are given in terms of \index{\backslash ul}\verb.\ul.'s, (for unitlength), which is user assignable, but currectly is .01em. The placement parameter \verb.p. is one of \verb.a,b,l,r,m. that stand for above, below, left, right, or mid and describe the positioning of the arrow label on the arrow. If it is given any value other than those five, it is ignored. We describe below why you might want it ignored. The label \index{m}\verb.m. stands for a label positioned in the middle of a split arrow. When used on a non-vertical arrow, \index{a}\verb.a. positions the label above the arrow and \index{b}\verb.b. positions it below. On a vertical arrow, the positioning depends on whether the arrow points up or down. Similarly, when used on a non-horizontal arrow, \index{l}\verb.l. positions the label to the left and \index{r}\verb.r. positions it to the right, while on a horizontal arrow it depends on which way it points. The shape parameter \verb.sh. describes the shape of the arrow. An arrow is thought of as consisting of three parts, the tail, the shaft and the head. You may specify just the head, in which case the shaft will be an ordinary line, or all three. However, since the tail can be (and usually is) empty, in practice you can also describe the shaft and tail. In addition, it is possible to modify the arrow in various ways. Although the parameter is shown within braces, the braces can be omitted unless one of the modifier characters is \verb./., in which case, {\em the entire parameter} must be put in braces. It is important to note that it will not work just to put the \verb./. inside the braces, since this will interfere with the internal parsing of \xypic. The head and tail shapes are basically one of \index{>}\verb.>., \index{>>}\verb.>>., \verb.(., \verb.)., \index{>}\verb*+>+, and \index{<}\verb*+<+. Each of these may also be preceded by \index{^}\verb.^. or \index{_}\verb._. and others are user definable. For details, see the \xypic\ reference manual. The first of these is an ordinary head, while the second is for an epic arrow. The third is not much used, but the superscripted version makes and inclusion tail, as will be illustrated below. The reverse ones give reversed arrowheads. The sign \verb*+ + stands for an obligatory space and it leaves extra space for a tailed (monic) arrow, which otherwise runs into the source node. Although there are many possibilities for shafts, including alphanumeric characters, the ones that mainly interest us are: \index{-}\verb.-., which is an ordinary shaft, \index{--}\verb.--., which produces a dashed arrow, \index{=}\verb.=., which gives a double arrow (although with only one arrowhead), and ., which makes a dotted arrow. Thus \index{>}\verb.>. or \index{->}\verb.->. will produce an ordinary arrow, \index{->>}\verb.->>. an epic arrow, \index{ >->}\verb*+ >->+ makes a monic arrow, and \index{-->>}\verb.-->>. would make a dashed epic arrow. The descriptions \index{<-}\index{<<-}\verb.<-,<<-,. \index{<-< }\verb*+<-< +, and \index{<<--}\verb.<<--. give the reversed versions. Note that \index{<}\verb.<. does not give a reversed arrow, since \xypic\ interprets that as a reversed head, not a tail. If the shape parameter begins with an \index{@}\verb.@., it is interpreted differently. In that case, it has the form \index{@{shape}@}\verb.@{shape}@. modifier, where the modifier is as described in the \xypic\ reference guide. I just mention a couple of them. The parameter \index{@{->}@<3pt>}\verb.@{->}@<3pt>., for example, would give an ordinary arrow moved three points in the direction perpendicular to that of the arrow. If you give \index{{@{-->}@/^5pt/}}\verb.{@{-->}@/^5pt/}., you will get an epic arrow that is curved in the direction perpendicular to the direction of the arrow by five points. It is imperative that a specification such as \index{@{>}@/5pt/}\verb.@{>}@/5pt/. be enclosed in braces because of the \index{/}\verb./.s. \subsection{A word about parameters} I have already mentioned the necessity of enclosing certain arrow shape specifications in braces. Because of the way \TeX\ operates, I have used a number of different delimiters: \index{(}\verb.(., \index{)}\verb.)., \index{|}\verb.|., \index{/}\verb./., \index{<}\verb.<., \index{>}\verb.>., \index{[}\verb.[., \index{]}\verb.]., \index{`}\verb.`., and \index{;}\verb.;.. Any of these that appear inside an argument could conceivably cause problems. They were chosen as the least likely to appear inside mathematics (except for \index{(,)}\verb.(,). which appear in positions that are unlikely to cause problems). However, be warned that this is a possible cause of mysterious error messages. If this happens, enclosing the offending parameter in braces should cure the problem. The exceptions come when the braces interfere with \xypic's somewhat arcane parsing mechanism. One place it imperative to use braces is if you attempt to use a disk as a tip. Although most tips do not have to be enclosed in braces, you get a small solid disk tip from \index{{*}}\verb.{*}. and not from \index{*}\verb.*. (see the note at the bottom of the first column of page 42 in the reference manual. The first three of \begin{verbatim} \morphism(0,300)|a|/-*/<500,0>[A`B;f] \morphism(0,0)|a|/{-*}/<500,0>[A`B;f] \morphism(0,0)|a|/{*}/<500,0>[A`B;f] \morphism(0,0)|a|/-{*}/<500,0>[A`B;f] \end{verbatim} give error messages. Only the fourth works: $$\bfig \morphism(0,0)|a|/-{*}/<500,0>[A`B;f] \efig$$ In addition to the diagrams, there are macros that are intended to be used inline to make horizontal arrows, pointing left or right, plain, monic, epic, or user-definable shapes, and calculating their own length to fit the label. Finally, there is a macro for making short 2-arrows that may be placed (actually, \index{\backslash place}\verb.\place.d) anywhere in a diagram. \section{Defined diagrams} Using the basic \index{\backslash morphism}\verb.\morphism. macro, I have a defined a number of diagrams: squares (really rectangles) and variously oriented triangles and a few compound diagrams. The basic shapes are exactly the same as in the old diagram package, but the options are done entirely differently. Here is the syntax of the \index{\backslash square}\verb.\square. macro: \begin{verbatim} \square(x,y)|pppp|/{sh}`{sh}`{sh}`{sh}/[N`N`N`N;L`L`L`L] \end{verbatim} Each of the first four sets of parameters is optional and any subset of them can be omitted. (Note that only the sets can be omitted, once you give \index{dx}\verb.dx., you also have to give \index{dy}\verb.dy. and so on.) The first set gives the horizontal and vertical position (in a local coordinate system) of the lower left corner of the square, the next four give the label placements using the same five characters previously described. The next four give the shapes of the arrows using the same syntax as discussed above. The last group is horizontal and vertical size of the square. More precisely, the \index{x}\verb.x. coordinate is that of the midpoint of the node, while the \index{y}\verb.y. coordinate is that of the baseline of the node. This is entirely based on \xypic. In the case of other shapes, discussed below, the positioning parameter may be different. The \index{x}\verb.x. coordinate is the midpoint of the leftmost node and the \index{y}\verb.y. coordinate is the baseline of the lowest node. In the case of the \index{\backslash qtriangle}\verb.\qtriangle., \index{\backslash Vtriangle}\verb.\Vtriangle., and \index{\backslash Ctriangle}\verb.\Ctriangle. described below, these are different nodes. What this positioning means is that if you specify the coordinates and sizes correctly the shapes will automatically fit together. The last example on Page~\pageref{TTTdiag} illustrates this. Here is a listing of the shapes, together with the groups of parameters. In all cases, the first four groups are optional and any subset of them will work. However, they must come in the order given. Note that the names of the triangles are related to the shape as the shape that best approximates the shape of the letter. For example, a \index{\backslash ptriangle}\verb.\ptriangle. is a right triangle that has its hypotenuse going from upper right to lower left. Triangles with lower case names have their legs horizontal and vertical and the dimension parameters are the lengths of the legs. Those with capitalized names have their hypotenuse horizontal or vertical. In those cases, one of \index{dx}\verb.dx. or \index{dy}\verb.dy. is the length of a leg and the other is {\em half} the length of the hypotenuse. In all cases, the order of the nodes and of the arrows is linguistic, first moving from left to right and then down. The defaults are reasonable, but with triangles, there is not always a natural direction for arrows. I always made mistakes in the order with my macros and this is certainly a defect. But the order is the same. In every case the braces around the shape specification can be removed unless it includes the following delimiter (that is, \index{`}\verb.`. or \index{/}\verb./., as the case may be.) \begin{verbatim} \square(x,y)|pppp|/{sh}`{sh}`{sh}`{sh}/% [N`N`N`N;L`L`L`L] \ptriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \qtriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \dtriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \btriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \Atriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \Vtriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \Ctriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \Dtriangle(x,y)|ppp|/{sh}`{sh}`{sh}/[N`N`N;L`L`L] \Atrianglepair(x,y)|ppppp|/{sh}`{sh}`{sh}`{sh}`{sh}/% [N`N`N`N;L`L`L`L`L] \Vtrianglepair(x,y)|ppppp|/{sh}`{sh}`{sh}`{sh}`{sh}/% [N`N`N`N;L`L`L`L`L] \Ctrianglepair(x,y)|ppppp|/{sh}`{sh}`{sh}`{sh}`{sh}/% [N`N`N`N;L`L`L`L`L] \Dtrianglepair(x,y)|ppppp|/{sh}`{sh}`{sh}`{sh}`{sh}/% [N`N`N`N;L`L`L`L`L] \end{verbatim} \index{\backslash square} \index{\backslash ptriangle} \index{\backslash qtriangle} \index{\backslash dtriangle} \index{\backslash btriangle} \index{\backslash Atriangle} \index{\backslash Vtriangle} \index{\backslash Ctriangle} \index{\backslash Dtriangle} \index{\backslash Atrianglepair} \index{\backslash Vtrianglepair} \index{\backslash Ctrianglepair} \index{\backslash Dtrianglepair} Note that the \verb.%. signs are required if you break the macro at such points. See also the discussion of errant spaces above. To make a diagram, you have to enclose it inside \index{\backslash xy ... \backslash endxy}.\verb,\xy ... \endxy,. You will usually want it displayed, for which the simplest way is to enclose it in \index{$$\xy ... \endxy$$}\verb,$$\xy...\endxy$$,. For old times' sake, I have also let \index{\backslash bfig}\verb.\bfig. and \index{\backslash efig}\verb.\efig. be synonyms for \index{\backslash xy}\verb.\xy. and \index{\backslash endxy}\verb.\endxy., resp. (In case you wonder, these go all the way back to a main frame formatter running at McGill when Charles Wells and I were first writing TTT, where \verb,.BFIG, and \verb,.EFIG, were used to make display---at least as far as that primitive formatter was capable of.) \section{Examples} Many people---including me---learn mainly by example and I will give a number of examples here. The formal syntax that is not given here can be learned in the \xypic\ reference manual. More samples from an actual paper can be found in \verb,ftp.math.mcgill.ca/pub/barr/derfun.tex,. If you want to compile that paper, you will need \verb,tac.cls,, available from \verb,tac.ca,. We begin with \index{\backslash morphism} \begin{verbatim} $$\bfig \morphism[A`B;f] \morphism(0,300)[A`B;f] \morphism(0,600)|m|[A`B;f] \morphism(0,900)/<-/[A`B;f] \morphism(900,500)<0,-500>[A`B;f] \morphism(1200,0)<0,500>[A`B;f] \efig$$ \end{verbatim} which gives the diagram $$\bfig \morphism[A`B;f] \morphism(0,300)[A`B;f] \morphism(0,600)|m|[A`B;f] \morphism(0,900)/<-/[A`B;f] \morphism(900,500)<0,-500>[A`B;f] \morphism(1200,0)<0,500>[A`B;f] \efig$$ \begin{verbatim} $$\bfig \square[A`B`C`D;e`f`g`m] \efig$$ \end{verbatim} produces $$\bfig \square[A`B`C`D;e`f`g`m] \efig$$ This can be modified, for example \begin{verbatim} $$\bfig \square/>>`>`>` >->/[A`B`C`D;e`f`g`m] \efig$$ \end{verbatim} produces $$\bfig \square/>>`>`>` >->/[A`B`C`D;e`f`g`m] \efig$$ This can be put together with a morphism as follows: \begin{verbatim} $$\bfig \square/>>`>`>` >->/[A`B`C`D;e`f`g`m] \morphism(500,500)|m|/.>/<-500,-500>[B`C;h] \efig$$ \end{verbatim} \index{\backslash square} which makes a familiar diagram: $$\bfig \square/>>`>`>` >->/[A`B`C`D;e`f`g`m] \morphism(500,500)|m|/.>/<-500,-500>[B`C;h] \efig$$ The same diagram could have been made by \begin{verbatim} $$\bfig \ptriangle|alm|/>>`>`.>/[A`B`C;e`f`h] \dtriangle/`>` >->/[B`C`D;`g`m] \efig$$ \end{verbatim} \index{\backslash ptriangle} \index{\backslash dtriangle} There are four macros for making pairs of triangles put together: $$\bfig \Vtrianglepair[A`B`C`D;f`g`h`k`l] \efig$$ comes from \begin{verbatim} $$\bfig \Vtrianglepair[A`B`C`D;f`g`h`k`l] \efig$$ \end{verbatim} \index{\backslash Vtrianglepair} \index{\backslash Atrianglepair} \index{\backslash Ctrianglepair} \index{\backslash Dtrianglepair} The other three are called \verb.\Atrianglepair., \verb.\Ctrianglepair., and \verb.\Dtrianglepair.. You can fit two squares together, horizontally: \begin{verbatim} $$\bfig \square|almb|[A`B`C`D;f`g`h`k] \square(500,0)/>``>`>/[B`E`D`F;l``m`n] \efig$$ \end{verbatim} $$\bfig \square|almb|[A`B`C`D;f`g`h`k] \square(500,0)/>``>`>/[B`E`D`F;l``m`n] \efig$$ or vertically \begin{verbatim} $$\bfig \square(0,500)|alrm|[A`B`C`D;f`g`h`k] \square/`>`>`>/[C`D`E`F;`l`m`n] \efig$$ \end{verbatim} $$\bfig \square(0,500)|alrm|[A`B`C`D;f`g`h`k] \square/`>`>`>/[C`D`E`F;`l`m`n] \efig$$ or a square and a triangle \begin{verbatim} $$\bfig \Ctriangle/<-`>`>/<400,400>[\hbox{\rm rec}(A,B)`B`X;r_0(A,B)`f`t_0] \square(400,0)/<-``>`<-/<1000,800>[\hbox{\rm rec}(A,B)`A\times\hbox{\rm rec}(A,B)`X`A\times X;r(A,B)``\hbox{\rm id}_A\times f`t] \efig$$ \end{verbatim} gives the diagram $$\bfig \Ctriangle/<-`>`>/<400,400>[\hbox{\rm rec}(A,B)`B`X;r_0(A,B)`f`t_0] \square(400,0)/<-``>`<-/<1000,800>[\hbox{\rm rec}(A,B)`A\times\hbox{\rm rec}(A,B)`X`A\times X;r(A,B)``\hbox{\rm id}_A\times f`t] \efig$$ This diagram is on page 361 of the third edition of Category Theory for Computing Science to describe recursion. Here is an example using the procedure for sliding an arrow sideways. This one could even be used in a text, \index{sliding arrows} $\xy \morphism(0,0)|a|/@{>}@<3pt>/<400,0>[A`B;d] \morphism(0,0)|b|/@{>}@<-3pt>/<400,0>[A`B;e]\endxy$ which was made using \begin{verbatim} $\xy \morphism(0,0)|a|/@{>}@<3pt>/<400,0>[A`B;d] \morphism(0,0)|b|/@{>}@<-3pt>/<400,0>[A`B;e]\endxy$ \end{verbatim} Indidentally, if you don't put this in math mode, the diagram will come out too low, for reasons I do not understand but must be buried within the \xypic\ code. Later we will introduce a number of inline procedures. Something a bit different that illustrates the use of another shaft \index{=}\verb.=. that gives a 2-arrow, as well as curved arrows: \begin{verbatim} $$\bfig \morphism(0,0)|a|/{@{>}@/^1em/}/<500,0>[A`B;f] \morphism(0,0)|b|/{@{>}@/_1em/}/<500,0>[A`B;g] \morphism(250,50)|a|/=>/<0,-100>[``] \efig$$ \end{verbatim} $$\bfig \morphism(0,0)|a|/{@{>}@/^1em/}/<500,0>[A`B;f] \morphism(0,0)|b|/{@{>}@/_1em/}/<500,0>[A`B;g] \morphism(250,50)|a|/=>/<0,-100>[`;] \efig$$ In order to use curved arrows, you must insert \index{\backslash xyoption{curve}}\verb.\xyoption{curve}. into your file. Here are two ways of doing three arrows between two objects, depending on what you like: \begin{verbatim} $$\bfig \morphism(0,0)|a|/@{>}@<5pt>/<500,0>[A`B;f] \morphism(0,0)|m|/@{>}/<500,0>[A`B;g] \morphism(0,0)|b|/@{>}@<-5pt>/<500,0>[A`B;h] \efig$$ \end{verbatim} which gives $$\bfig \morphism(0,0)|a|/@{>}@<5pt>/<500,0>[A`B;f] \morphism(0,0)|m|/@{>}/<500,0>[A`B;g] \morphism(0,0)|b|/@{>}@<-5pt>/<500,0>[A`B;h] \efig$$ and \begin{verbatim} $$\bfig \morphism(0,0)|a|/{@{>}@/^5pt/}/<500,0>[A`B;f] \morphism(0,0)|m|/@{>}/<500,0>[A`B;g] \morphism(0,0)|b|/{@{>}@/^-5pt/}/<500,0>[A`B;h] \efig$$ \end{verbatim} which gives $$\bfig \morphism(0,0)|a|/{@{>}@/^5pt/}/<500,0>[A`B;f] \morphism(0,0)|m|/@{>}/<500,0>[A`B;g] \morphism(0,0)|b|/{@{>}@/^-5pt/}/<500,0>[A`B;h] \efig$$ Either of these could also be used inline. There is a macro \index{\backslash place}\verb.\place. that places that object anywhere. I have changed the name from \verb.\put. in order to avoid clashing with the \LaTeX\ picture mode's \index{\backslash put}\verb.\put.. Here is an example that uses a construction that is undocumented here, but uses a documented \Xy\ construction: \begin{verbatim} \newbox\anglebox \setbox\anglebox=\hbox{\xy \POS(75,0)\ar@{-} (0,0) \ar@{-} (75,75)\endxy} \def\angle{\copy\anglebox} $$\bfig \square[A`B`C`D;f`g`h`k] \place(100,400)[\angle] \efig$$ \end{verbatim} \newbox\anglebox \setbox\anglebox=\hbox{\xy \POS(75,0)\ar@{-} (0,0) \ar@{-} (75,75)\endxy} \def\angle{\copy\anglebox} $$\bfig \square[A`B`C`D;f`g`h`k] \place(100,400)[\angle] \efig$$ Notice that you get a headless arrow by using \index{\backslash ar@{-}}\verb.\ar@{-}.. Here is a special code installed at the request of Jonathon Funk: \begin{verbatim} $$\bfig \pullback|brrb|<800,800>[P`X`Y`Z;t`u`v`w]% |amb|/>`-->`>/<500,500>[A;f`g`h] \efig$$ \end{verbatim} \index{\backslash pullback} $$\bfig \pullback|brrb|<800,800>[P`X`Y`Z;t`u`v`w]% |amb|/>`-->`>/<500,500>[A;f`g`h] \efig$$ The full syntax for this is \begin{verbatim} \pullback(x,y)|pppp|/{sh}`{sh}`{sh}`{sh}/[N`N`N`N;L`L`L]% |ppp|/{sh}`{sh}`{sh}/[N;L`L`L] \end{verbatim} Of these only the nodes placed inside brackets are obligatory. The first sets of parameters are exactly as for \index{\backslash square}\verb.\square. and the remaining parameters are for the nodes and labels of the outer arrows. There is no positioning parameters for them; rather you set the horizontal and vertical separations of the outer node from the square. Here are some more special constructions. In general, if you are doing a square, you should use \index{\backslash Square}\verb.\Square. instead of \index{\backslash square}\verb.\square. because if figures its own width. The syntax is almost the same, except that \index{dx}\verb.dx. is omitted. For example, \begin{verbatim} $$\bfig \Square/^{ (}->`>`>`^{ (}->/<350>[{\rm Hom}(A,2^B)`{\rm Sub}(A\times B)` {\rm Hom}(A',2^{B'})`{\rm Sub}(A'\times B');\alpha(A,B)```\alpha(A',B')] \efig$$ \end{verbatim} will produce the square $$\bfig \Square/^{ (}->`>`>`^{ (}->/<350>[{\rm Hom}(A,2^B)`{\rm Sub}(A\times B)` {\rm Hom}(A',2^{B'})`{\rm Sub}(A'\times B');\alpha(A,B)```\alpha(A',B')] \efig$$ There are a couple of points to note here. Note the use of the argument \index{^{ (}->}\verb.^{ (}->. to get the inclusion arrow. The complication is created by the necessity of adding a bit of extra space before the hook. You get pretty much the same effect by putting a bit of extra space after the node: \begin{verbatim} $$\bfig \Square/^(->`>`>`^(->/<350>[{\rm Hom}(A,2^B)\,`{\rm Sub}(A\times B)` {\rm Hom}(A',2^{B'})\,`{\rm Sub}(A'\times B');\alpha(A,B)```\alpha(A',B')] \efig$$ \end{verbatim} The full syntax is \begin{verbatim} \Square(x,y)|pppp|/{sh}`{sh}`{sh}`{sh}/[N`N`N`N;L`L`L`L] \end{verbatim} There are also macros for placing two \index{\backslash Square}\verb.\Square.s together horizontally or vertically. The first is \index{\backslash hSquares}\verb.\hSquares. with the syntax \begin{verbatim} \hSquares(x,y)|ppppppp|/{sh}`{sh}`{sh}`{sh}`{sh}`{sh}`{sh}/% [N`N`N`N`N`N;L`L`L`L`L`L`L] \end{verbatim} The second is \index{\backslash vSquares}\verb.\vSquares. with a similar syntex except that there are two \index{dy}\verb.dy. parameters, one for each square: \begin{verbatim} \hSquares(x,y)|ppppppp|/{sh}`{sh}`{sh}`{sh}`{sh}`{sh}`{sh}/% [N`N`N`N`N`N;L`L`L`L`L`L`L] \end{verbatim} Similarly, there are four macros for making pairs of triangles put together. For example, $$\bfig \Vtrianglepair[A`B`C`D;f`g`h`k`l] \efig$$ comes from \begin{verbatim} $$\bfig \Vtrianglepair[A`B`C`D;f`g`h`k`l] \efig$$ \end{verbatim} There is a macro for making cubes\index{\backslash cube}. The syntax is \begin{verbatim} \cube(x,y)|pppp|/{sh}`{sh}`{sh}`{sh}/[N`N`N`N;L`L`L`L]% (x,y)|pppp|/{sh}`{sh}`{sh}`{sh}/[N`N`N`N;L`L`L`L]% |pppp|/{sh}`{sh}`{sh}`{sh}/[L`L`L`L] \end{verbatim} The first line of parameters is for the outer square and the second for the inner square, while the remaining parameters are for the arrows between the squares. Only the parameters in square brackets are required; there are defaults for the others. Here is an example: \begin{verbatim} $$\bfig \cube(0,0)|arlb|/ >->` >->`>`>/<1500,1500>[A`B`C`D;f`g`h`k]% (300,300)|arlb|/>`>`>`>/<400,400>[A'`B'`C'`D';f'`g'`h'`k']% |mmmm|/<-`<-`<-`<-/[\alpha`\beta`\gamma`\delta] \efig$$ \end{verbatim} gives the somewhat misshapen diagram $$\bfig \cube(0,0)|arlb|/ >->` >->`>`>/<1500,1500>[A`B`C`D;f`g`h`k]% (300,300)|arlb|/>`>`>`>/<400,400>[A'`B'`C'`D';f'`g'`h'`k']% |mmmm|/<-`<-`<-`<-/[\alpha`\beta`\gamma`\delta] \efig$$ because the parameters were oddly chosen. The defaults center the squares. I discovered accidently, while debugging the cube that what I thought was an out-of-range choice of parameters would produce an offset cube: \begin{verbatim} $$\bfig \cube|arlb|/ >->` >->`>`>/<1000,1000>[A`B`C`D;f`g`h`k]% (400,400)|arlb|/>`>`>`>/<900,900>[A'`B'`C'`D';f'`g'`h'`k']% |rrrr|/<-`<-`<-`<-/[\alpha`\beta`\gamma`\delta] \efig$$ \end{verbatim} gives $$\bfig \cube|arlb|/ >->` >->`>`>/<1000,1000>[A`B`C`D;f`g`h`k]% (400,400)|arlb|/>`>`>`>/<900,900>[A'`B'`C'`D';f'`g'`h'`k']% |r`r`r`r|/<-`<-`<-`<-/[\alpha`\beta`\gamma`\delta] \efig$$ \subsection{Complex diagrams}\label{complex} In homological algebra one often has a $3\times3$ diagram, with or without 0's on the margins. There is a macro to do that: \index{3 by 3}\index{\backslash iiixiii} \begin{verbatim} $$\bfig \iiixiii(0,0)|aammbblmrlmr|/>`>`>`>`>`>`>`>`>`>`>`>/<500,500>{'5436}% <400,400>[A'`B'`C'`A`B`C`A''`B''`C'';f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ \end{verbatim} that gives $$\bfig \iiixiii(0,0)|aammbblmrlmr|/>`>`>`>`>`>`>`>`>`>`>`>/<500,500>{'5436}% <400,400>[A'`B'`C'`A`B`C`A''`B''`C'';f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ Here is the explanation. The arrow parameters are not given in the usual order, but rather first all the horizontal arrows and then all the vertical ones, each in their usual order. The nodes are given in the usual order. The fifth parameter is the octal number \verb.`5436. (In \TeX, the \verb.'. introduces octal numbers and \verb.". introduces hexadecimal numbers) which corresponds to the binary number 101,100,011,110 that describes the distribution of the 0's around the margins. The same results would have been obtained if the number had been the hexadecimal number \verb."B1E. or the decimal number \verb.2846.. The sixth parameter gives the horizontal and vertical offset of the 0's, which you often want smaller than the others. You must not give the sixth parameter unless you have given a value (which could be 0) to the fifth or an error condition will result. Note that the positioning parameters ignore the 0's so that it is the lower left node that appears at the position \verb.(x,y).. As usual, there are defaults. \begin{verbatim} $$\bfig \iiixiii[A'`B'`C'`A`B`C`A''`B''`C'';f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ $$\bfig \iiixiii% {'5436}[A'`B'`C'`A`B`C`A''`B''`C'';f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ $$\bfig \iiixiii{'5436}<250,450>[A'`B'`C'`A`B`C`A''`B''`C'';% f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ \end{verbatim} $$\bfig \iiixiii[A'`B'`C'`A`B`C`A''`B''`C'';f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ $$\bfig \iiixiii% {'5436}[A'`B'`C'`A`B`C`A''`B''`C'';f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ $$\bfig \iiixiii{'5436}<250,450>[A'`B'`C'`A`B`C`A''`B''`C'';% f'`g'`f`g`f''`g''`u`v`w`u'`v'`w'] \efig$$ A similar macro\index{3 by 2}% \index{\backslash iiixii}\verb.\iiixii. has been added for a map between exact sequences, with parameters similar to the above. An actual example is \begin{verbatim} $$\bfig \iiixii|aaaalmr|<1000,800>[H`G`F`H\oplus H_0`G\oplus H_0\oplus F_0` F\oplus F_0; f`g`\pmatrix{f&0\cr0&1\cr0&0}`\pmatrix{g&0&0\cr0&0&1}` \pmatrix{1\cr0}`\pmatrix{1\cr0\cr0}`\pmatrix{1\cr0}] \efig$$ \end{verbatim} which gives $$\bfig \iiixii|aaaalmr|<1000,800>[H`G`F`H\oplus H_0`G\oplus H_0\oplus F_0` F\oplus F_0; f`g`\pmatrix{f&0\cr0&1\cr0&0}`\pmatrix{g&0&0\cr0&0&1}` \pmatrix{1\cr0}`\pmatrix{1\cr0\cr0}`\pmatrix{1\cr0}] \efig$$ The general syntax is \begin{verbatim} \iiixii(x,y)|ppppppp|/1`2`3`4`5`6`7/{n}[...] \end{verbatim} with the usual meaning. The number n is a number between 0 and 15 (default 15) that specifies whether and where 0's appear (think binary, with the high bit at the upper left) and dx' specifies the separation of the zeroes. You get two squares side by side if both n and dx' are 0. \subsection{Empty placement and moving labels} The label placements within \verb.|p|. is valid only for \verb.x=a,b,r,l,m.. If you use any other value (or leave it empty) the label entry is ignored, but you can use any valid \xypic\ label, as described in Figure 13 of the reference manual. One place you might want to use this is for the placement of the labels along an arrow. In \xypic\ the default placement of the label is midway between the midpoints of the nodes. If the two nodes are of widely different sizes, this can result in strange placements; therefore I always place them midway along the arrow. However, as the following illustrates, this can be changed. \begin{verbatim} $$\bfig \morphism(0,900)||/@{->}^<>(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \morphism(0,600)||/@{->}^<(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \morphism(0,300)||/@{->}^>(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \morphism(0,0)||/@{->}^(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \efig$$ \end{verbatim} which produces $$\bfig \morphism(0,900)||/@{->}^<>(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \morphism(0,600)||/@{->}^<(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \morphism(0,300)||/@{->}^>(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \morphism(0,0)||/@{->}^(0.7){f}/<800,0>[A^B\times B^C\times C`C;] \efig$$ Here is the explanation. The label placement argument is empty (it cannot be omitted) and the arrow entry is empty. However, placing \verb.^(0.7){f}. inside the arrow shape places the label $f$ 7/10 of the way between the nodes. Unmodified, this places it 7/10 of the way between the centers of the nodes. This may be modified by \index{<}\verb.<., which moves the first (here the left) reference point to the beginning of the arrow, \index{>}\verb.>. which moves the second reference point to the end of the arrow, or by both, which moves both reference points. In most cases, you will want both. Incidentally, \index{-}\verb.-. is a synonym for the sequence \index{<>(}5).\verb.<>(.5). and that is the default placement in my package. Here are some more examples that illustrates the special sequence \index{\backslash hole}\verb.\hole. used in conjunction with \index{|}\verb.|. that implements \index{m}\verb.m. as well as the fact that these things can be stacked. For more details, I must refer you to the \xypic\ reference manual. \begin{verbatim} $$\bfig \morphism(0,600)||/@{->}|-\hole/<800,0>[A^B\times B^C\times C`C;] \morphism(0,300)||/@{->}|-\hole^<>(.7)f/<800,0>[A^B\times B^C\times C`C;] \morphism(0,0)||/@{->}|-\hole^<>(.7)f_<>(.3)g/<800,0>[A^B\times B^C\times C`C;] \efig$$ \end{verbatim} produces $$\bfig \morphism(0,600)||/@{->}|-\hole/<800,0>[A^B\times B^C\times C`C;] \morphism(0,300)||/@{->}|-\hole^<>(.7)f/<800,0>[A^B\times B^C\times C`C;] \morphism(0,0)||/@{->}|-\hole^<>(.7)f_<>(.3)g/<800,0>[A^B\times B^C\times C`C;] \efig$$ Here is another version of the cube we looked at above, using these special placements and\index{\backslash cube} \index{\backslash hole}\verb.\hole.'s to break some lines and make it neater. \begin{verbatim} $$\bfig \cube|arlb|/@{ >->}^<>(.6){f}` >->`@{>}_<>(.4){h}`>/% <1000,1000>[A`B`C`D;`g``k]% (400,400)|axxb|/>`@{>}|!{(300,1000);(500,1000)}\hole^<>(.6){g'}`>`@{>}% |!{(1000,500);(1000,300)}\hole_<>(.4){k'}/<900,900>[A'`B'`C'`D';f'``h'`]% |rrrr|/<-`<-`<-`<-/[\alpha`\beta`\gamma`\delta] \efig$$ \end{verbatim} $$\bfig \cube|arlb|/@{ >->}^<>(.6){f}` >->`@{>}_<>(.4){h}`>/% <1000,1000>[A`B`C`D;`g``k]% (400,400)|axxb|/>`@{>}|!{(300,1000);(500,1000)}\hole^<>(.6){g'}`>`@{>}% |!{(1000,500);(1000,300)}\hole_<>(.4){k'}/<900,900>[A'`B'`C'`D';f'``h'`]% |rrrr|/<-`<-`<-`<-/[\alpha`\beta`\gamma`\delta] \efig$$ This one is probably worth saving as a template. Later I will explain the meaning of the strings \verb.!{(300,1000);(500,1000)}\hole. and \verb.!{(1000,500);(1000,300)}\hole. along with a caveat on their use. If the nodes are unusually large, the cube may be magnified using \index{\backslash scalefactor}\verb.\scalefactor. . \subsection{Inline macros} Here we illustrate a few of the macros for inline---or displayed---equations the package contains. In each case, the macro may have a superscript or subscript or both (in which case the superscript must come first) and the arrow(s) grow long enough to hold the super- or subscript. If you type\par\noindent \verb.$A\to B\to^f C\to_g D\to^h_{{\rm Hom}(X,Y)} E$., you get $A\to B\to^f C\to_g D\to^h_{{\rm Hom}(X,Y)} E$. Similarly, the macro \index{\backslash toleft}\verb.\toleft. reverses the arrows. The remaining macros of this sort are \index{\backslash mon}\verb.\mon. which gives a monic arrow, \index{\backslash epi}\verb.\epi. which gives an epic arrow, \index{\backslash two}\verb.\two. that gives a pair of arrows, as well as leftwards pointing versions, \index{\backslash monleft}\verb.\monleft., \index{\backslash epileft}\verb.\epileft., and \index{\backslash twoleft}\verb.\twoleft. of each of them. Here is one more example: \begin{verbatim} $A\twoleft B\twoleft^f C\twoleft_g D\twoleft^h_{{\rm Hom}(X,Y)} E$ \end{verbatim} gives $A\twoleft B\twoleft^f C\twoleft_g D\twoleft^h_{{\rm Hom}(X,Y)} E$. There is an almost unlimited variety of such procedures possible. The ones that are provided can be used as templates to define new ones with, say, curved arrows or three arrows or whatever a user might have need of. \subsubsection{Added:}\label{added} The macros \index{\backslash to}\verb.\to. and \index{\backslash two}\verb.\two. can each have optional parameters of the form \index{/{sh}/}\verb./{sh}/. and \index{/{sh}`{sh}/}\verb./{sh}`{sh}/., resp. that allow you to specify the shapes of the arrows and to override the automatic computation of the lengths of the arrows. For example, \begin{verbatim} $$A\to/<-/ B\to^f C \to/ >->/<500>_g D\to/<-< /^f_g E$$ $$A\two/<-`->/<100> B\two^f C \two/ >->` >->/_g D\two/<-< `<-< /^f_g E$$ \end{verbatim} gives $$A\to/<-/ B\to^f C \to/ >->/<500>_g D\to/<-< /^f_g E$$ $$A\two/<-`->/<100> B\two^f C \two/ >->` >->/_g D\two/<-< `<-< /^f_g E$$ This renders \index{\backslash mon}\verb.\mon., \index{\backslash epi}\verb.\epi., \index{\backslash toleft}\verb.\toleft., \index{\backslash monleft}\verb.\monleft., \index{\backslash epileft}\verb.\epileft., and \index{\backslash twoleft}\verb.\twoleft. obsolete, but they have been retained for back compatibility and convenience. A three arrow macro that works similarly has been added. For example \begin{verbatim} $$A\threepppp/>`<-`>/<400>^{d^0}|{s^0}_{d^1}B\three<100> C\three/->>`<-< `->>/ D$$ \end{verbatim} gives $$A\threepppp/>`<-`>/<400>^{d^0}|{s^0}_{d^1}B\three<100> C\three/->>`<-< `->>/ D$$ \subsection{2-arrows} There is a macro for making 2-arrows of a fixed size, but varying orientation. They should be put at the appropriate position in a diagram. The two parameters are two integers \index{dx}\verb.dx. and \index{dy}\verb.dy. whose ratio is the slope of the arrow. They need not be relatively prime, but arithmetic overflow could occur if they are too large. Note that although \index{(dx,dy)}\verb.(dx,dy). and \index{(-dx,-dy)}\verb.(-dx,-dy). describe the same slope, the arrows point in opposite directions. Here is a sampler \begin{verbatim} $$\bfig \place(0,0)[\twoar(1,0)] \place(200,0)[\twoar(0,1)] \place(400,0)[\twoar(1,1)] \place(600,0)[\twoar(0,-1)] \place(800,0)[\twoar(1,2)] \place(1000,0)[\twoar(1,3)] \place(1200,0)[\twoar(1,-3)] \place(1400,0)[\twoar(-3,1)] \place(1600,0)[\twoar(-1,-3)] \place(1800,0)[\twoar(255,77)] \efig$$ \end{verbatim} $$\bfig \place(0,0)[\twoar(1,0)] \place(200,0)[\twoar(0,1)] \place(400,0)[\twoar(1,1)] \place(600,0)[\twoar(0,-1)] \place(800,0)[\twoar(1,2)] \place(1000,0)[\twoar(1,3)] \place(1200,0)[\twoar(1,-3)] \place(1400,0)[\twoar(-3,1)] \place(1600,0)[\twoar(-1,-3)] \place(1800,0)[\twoar(255,77)] \efig$$ Here is little amusement. \begin{verbatim} $$\bfig \square/@3{->}`~)`=o`--x/[A`B`C`D;```] \place(400,100)[\twoar(-1,-1)] \place(100,400)[\twoar(1,1)] \morphism(500,500)||/{*}.{*}/<-500,-500>[B`C;] \efig$$ \end{verbatim} $$\bfig \square/@3{->}`~)`=o`--x/[A`B`C`D;```] \place(400,100)[\twoar(-1,-1)] \place(100,400)[\twoar(1,1)] \morphism(500,500)||/{*}.{*}/<-500,-500>[B`C;] \efig$$ \subsection{Mixing \xypic\ code} Here is a sample in which I have mixed code from \xypic\ with my own. \let\tilde\widetilde \let\hat\widehat \begin{verbatim} $$\bfig \square(1500,500)/>`>`>`@{>}^<>(.2){r_{n-1}}/[T_{n-1}`T_{n-2}`R_{n-1} `R_{n-2}; t_{n-1}``\sigma_{n-2}`] \square(1500,0)/`>`>`>/[R_{n-1}`R_{n-2}`S_{n-1}`S_{n-2}; `f_{n-1}`f_{n-2}`s_{n-1}] \morphism|b|[\tilde S_{n+1}`S_n;\tilde s_{n+1}] \square(1000,500)/>`>`>`>/[\tilde T_n`T_{n-1}`\tilde R_n`{R_{n-1}};\tilde t_n`\tilde \sigma_n`\sigma_{n-1}`] \square(1000,0)/>`>``>/[\tilde R_n`R_{n-1}`\tilde S_n`{S_{n-1}};\tilde r_n\quad ```\tilde s_n] \square(500,0)/>`>``>/[R_n`{R_n}`{S_n}`{S_{n}}; \hat r_n`f_n`\tilde f_n`\hat s_n] \POS(1500,1000)*+!!<0ex,.75ex>{T_{n-1}} \ar@{-}|!{(1000,500);(1500,500)}\hole(1167,334)% \POS(1167,334)\ar|!{(1000,500);(1000,0)}\hole_<>(.6){h_{n-1}} (500,0)*+!!<0ex,.75ex>{S_n} \morphism(2000,1000)/@{>}|\hole^<>(.8){h_{n-2}}/% <-500,-1000>[T_{n-2}`S_{n-1};] \efig$$ \end{verbatim} $$\bfig \square(1500,500)/>`>`>`@{>}^<>(.2){r_{n-1}}/[T_{n-1}`T_{n-2}`R_{n-1} `R_{n-2}; t_{n-1}``\sigma_{n-2}`] \square(1500,0)/`>`>`>/[R_{n-1}`R_{n-2}`S_{n-1}`S_{n-2}; `f_{n-1}`f_{n-2}`s_{n-1}] \morphism|b|[\tilde S_{n+1}`S_n;\tilde s_{n+1}] \square(1000,500)/>`>`>`>/[\tilde T_n`T_{n-1}`\tilde R_n`{R_{n-1}};\tilde t_n`\tilde \sigma_n`\sigma_{n-1}`] \square(1000,0)/>`>``>/[\tilde R_n`R_{n-1}`\tilde S_n`{S_{n-1}};\tilde r_n\quad ```\tilde s_n] \square(500,0)/>`>``>/[R_n`{R_n}`{S_n}`{S_{n}}; \hat r_n`f_n`\tilde f_n`\hat s_n] \POS(1500,1000)*+!!<0ex,.75ex>{T_{n-1}} \ar@{-}|!{(1000,500);(1500,500)}\hole(1167,334)% \POS(1167,334)\ar|!{(1000,500);(1000,0)}\hole_<>(.6){h_{n-1}} (500,0)*+!!<0ex,.75ex>{S_n} \morphism(2000,1000)/@{>}|\hole^<>(.8){h_{n-2}}/% <-500,-1000>[T_{n-2}`S_{n-1};] \efig$$ There are three points to note here in connection with the two lines that begin with \index{\backslash POS}\verb.\POS. First the objects that are the source of the first and the target of the second are preceded by \verb;!!<0ex,.75ex>;\verb;!!<0ex,.75ex>;. The effect is to reset the baseline to the baseline of the object (rather than the vertical center) and then to lower that by 3/4 of xheight so that the arrow goes in the right place. This string precedes all objects. Without that, an object like $\tilde R $ would be set lower that $R$. Second, the first arrow has no target and the second no source. This does not give the same result as empty source and target since in the latter cases, there would be spaces allowed around them and then the two lines would not meet. It would be possible to add code that tests for empty nodes, but it comes up so seldom that I have refrained. In the meantime, the only recourse is to revert to the underlying \xypic\ code. Thirdly the string \verb.|!{(1000,500);(1500,500)}\hole. specifies that the line should be broken at the place where the current arrow intersects the line between the nodes located at (1000,500) and (1500,500). One must be careful using this construction, however, as it does not seem to work correctly if the line segment fails to intersect the current line, or if it does intersect, but happens to be too long. I have not worked out how long is too long, but you can get odd results. I assume that this bug will be fixed eventually. (Ross Moore says that it works correctly in the version he has, which, however, has not been released.) There is a similar string, with similar effect, in the following line. The last line uses simply \index{|\hole}\verb.|\hole. which positions the gap in the middle of the arrow. \subsection{Diagram from TTT} The last example is a complicated diagram from TTT. If you have the documentation from the old diagram macros (or the errata from TTT), you can see how much easier it is to describe this diagram with these macros. Note the use of \index{\backslash scalefactor}\verb.\scalefactor. to change the default length from 500 to 700 that made it unnecessary to specify the scales on the squares and triangles. \begin{verbatim} $$\bfig \scalefactor{1.4}% \qtriangle(0,1000)/>`>`/[TT`T`TTT';\mu`TT\eta'`]% \btriangle(500,1000)/`>`@<-14\ul>/[T`TTT'`TT';`T\eta`T\sigma]% \morphism(0,1500)|l|/>/<0,-1000>[TT`TT'T;T\eta'T]% \square(500,500)|ammx|/@<14\ul>`>`>`/[TTT'`TT'`TT'TT'`TT'T';% \mu T'`T\eta'TT'`T\eta'T'`]% \morphism(1000,1000)|r|/>/<500,-500>[TT'`TT';\hbox{\rm id}]% \square/>`>``>/[TT'T`TT'TT'`T'T`T'TT';TT'T\eta'`\sigma T``T'T\eta']% \square(500,0)|ammb|[TT'TT'`TT'T'`T'TT'`T'T';% TT'\sigma`\sigma TT'`\sigma T'`T'\sigma T']% \square(1000,0)/>``>`>/[TT'T'`TT'`T'T'`T';T\mu'``\sigma`\mu']% \place(500,1250)[1]\place(215,1000)[2]\place(750,750)[3]% \place(215,250)[4]\place(750,250)[5]\place(1140,750)[6]% \place(1250,250)[7]% \efig$$ \end{verbatim} $$\bfig\label{TTTdiag} \scalefactor{1.4}% \qtriangle(0,1000)/>`>`/[TT`T`TTT';\mu`TT\eta'`]% \btriangle(500,1000)/`>`@<-14\ul>/[T`TTT'`TT';`T\eta`T\sigma]% \morphism(0,1500)|l|/>/<0,-1000>[TT`TT'T;T\eta'T]% \square(500,500)|ammx|/@<14\ul>`>`>`/[TTT'`TT'`TT'TT'`TT'T';\mu T'`% T\eta'TT'`T\eta'T'`]% \morphism(1000,1000)|r|/>/<500,-500>[TT'`TT';\hbox{\rm id}]% \square/>`>``>/[TT'T`TT'TT'`T'T`T'TT';TT'T\eta'`\sigma T``T'T\eta']% \square(500,0)|ammb|[TT'TT'`TT'T'`T'TT'`T'T';TT'\sigma`\sigma TT'% `\sigma T'`T'\sigma T']% \square(1000,0)/>``>`>/[TT'T'`TT'`T'T'`T';T\mu'``\sigma`\mu']% \place(500,1250)[1]\place(215,1000)[2]\place(750,750)[3]% \place(215,250)[4]\place(750,250)[5]\place(1140,750)[6]% \place(1250,250)[7]% \efig$$ \begin{theindex} \item \verb@%@, 3 \item \verb@(@, 7 \item \verb@(@,), 7 \item \verb@(-dx@,-dy), 25 \item \verb@(dx@,dy), 25 \item \verb@)@, 7 \item \verb@*@, 7 \item \verb@-@, 6, 23 \item \verb@--@, 6 \item \verb@-->>@, 7 \item \verb@->@, 7 \item \verb@->>@, 7 \item \verb@/@, 7, 9 \item \verb@/{sh}/@, 25 \item \verb@/{sh}`{sh}/@, 25 \item \verb@;@, 7 \item \verb@<@, 6, 7, 22 \item \verb@<-@, 7 \item \verb@<-< @, 7 \item \verb@<<-@, 7 \item \verb@<<--@, 7 \item \verb@<>(@, 23 \item \verb@=@, 6, 13 \item \verb@>@, 6, 7, 22 \item \verb@>>@, 6 \item \verb@[@, 7 \item \verb@\startsection@, 5 \item \verb@\Atriangle@, 9 \item \verb@\Atrianglepair@, 9, 12 \item \verb@\Ctriangle@, 8, 9 \item \verb@\Ctrianglepair@, 9, 12 \item \verb@\Dtriangle@, 9 \item \verb@\Dtrianglepair@, 9, 12 \item \verb@\POS@, 27 \item \verb@\Square@, 15, 16 \item \verb@\Vtriangle@, 8, 9 \item \verb@\Vtrianglepair@, 9, 12 \item \verb@{-}@, 14 \item \verb@\bfig@, 9 \item \verb@\btriangle@, 9 \item \verb@\cube@, 16, 23 \item \verb@\dtriangle@, 9, 11 \item \verb@\efig@, 9 \item \verb@\endxy@, 9 \item \verb@\epi@, 24, 25 \item \verb@\epileft@, 24, 25 \item \verb@\fontscale{x}@, 4 \item \verb@\hSquares@, 16 \item \verb@\halign@, 2 \item \verb@\hole@, 23 \item \verb@\ignorespaces@, 3 \item \verb@\iiixii@, 21 \item \verb@\iiixiii@, 18 \item \verb@\let\labelstyle=\textstyle@, 6 \item \verb@\mon@, 24, 25 \item \verb@\monleft@, 24, 25 \item \verb@\morphism@, 2, 5, 8, 10 \item \verb@\phantom@, 3 \item \verb@\place@, 8, 14 \item \verb@\ptriangle@, 8, 9, 11 \item \verb@\pullback@, 15 \item \verb@\put@, 14 \item \verb@\qtriangle@, 8, 9 \item \verb@\scalefactor@, 24, 28 \item \verb@\scriptstyle@, 6 \item \verb@\square@, 8, 9, 11, 15 \item \verb@\three@, 1 \item \verb@\to@, 1, 25 \item \verb@\toleft@, 24, 25 \item \verb@\two@, 1, 24, 25 \item \verb@\twoleft@, 24, 25 \item \verb@\ul@, 6 \item \verb@\vSquares@, 16 \item \verb@\xy@, 9 \item \verb@\xy ... \endxy@, 9 \item \verb@\xyoption{curve}@, 13 \item \verb@]@, 7 \item \verb@^@, 6 \item \verb@^{ (}->@, 16 \item \verb@_@, 6 \item \verb@`@, 7, 9 \item \verb@{*}@, 7 \item \verb@3 by 2@, 21 \item \verb@3 by 3@, 18 \indexspace \item \verb@ >->@, 7 \indexspace \item \verb@a@, 6 \indexspace \item \verb@b@, 6 \indexspace \item \verb@dx@, 8, 15, 25 \item \verb@dy@, 8, 16, 25 \indexspace \item \verb@l@, 6 \item \verb@label@, 6 \indexspace \item \verb@m@, 6, 23 \indexspace \item \verb@r@, 6 \indexspace \item \verb@sliding arrows@, 13 \indexspace \item \verb@tips@, 4 \indexspace \item \verb@x@, 4, 8 \indexspace \item \verb@y@, 8 \end{theindex} \end{document}