Você está na página 1de 81

XY-pic Reference Manual

Kristoffer H. Rose Ross Moore


hkrisrose@brics.dki× hross@mpce.mq.edu.aui†

Version 3.7 h1999/02/16i

Abstract the diagram


This document summarises the capabilities of the XY-pic
package for typesetting graphs and diagrams in TEX. For
a general introduction as well as availability information
U H
and conditions refer to the User’s Guide [14]. H HH x
A characteristic of XY-pic is that it is built around a HH
HH
kernel drawing language which is a concise notation for H#
/% X

' G jjjj(/5 ).B*-+,


general graphics, e.g., X ×Z Y p
y
q f
jj j  
A jj g
/Z
Y
was drawn by the XY-pic kernel code
\xy (3,0)*{A} ; (20,6)*+{B}*\cir{} **\dir{-}
? *_!/3pt/\dir{)} *_!/7pt/\dir{:} was typeset using the ‘matrix’ features by the XY-pic input
?>* \dir{>} \endxy lines
It is an object-oriented graphic language in the most lit- \xymatrix{
eral sense: ‘objects’ in the picture have ‘methods’ describ- U \ar@/_/[ddr]_y \ar[dr] \ar@/^/[drr]^x \\
ing how they typeset, stretch, etc. However, the syntax & X \times_Z Y \ar[d]^q \ar[r]_p
is rather terse. & X \ar[d]_f \\
Particular applications make use of extensions that & Y \ar[r]^g & Z }
enhance the graphic capabilities of the kernel to handle
such diagrams as & Features exist for many kinds of input; here is a knot
Square typeset using the ‘knots and links’ feature:

gfed
`abc
XYZ[
_^]\
Bend
Round

which was typeset by


\xy *[o]=<40pt>\hbox{Round}="o"*\frm{oo},
+<5em,-5em>@+,
(46,11)*+\hbox{Square}="s" *\frm{-,},
-<5em,-5em>@+,
"o";"s" **{} ?*+\hbox{Bend}="b"*\frm{.},
"o";"s"."b" **\crvs{-},
"o"."b";"s" **\crvs{-} ?>*\dir{>} The current implementation is programmed entirely
\endxy within “standard TEX and METAFONT”, i.e., using TEX
using the ‘curve’ and ‘frame’ extensions. macros (no \specials) and with fonts designed using
All this is made accessible through the use of features METAFONT. Optionally special ‘drivers’ make it possi-
that provide convenient notation such that users can en- ble to produce DVI files with ‘specials’ for extra graphics
ter special classes of diagrams in an intuitive form, e.g., capabilities, e.g., using PostScript.1
× BRICS, Computer Science, Aarhus University (bld. 540), Ny Munkegade, DK–8000 Aarhus C, Denmark.
† MPCE (Mathematics dept.), Macquarie University, North Ryde, Sydney, Australia NSW 2109.
1 PostScript is a registered Trademark of Adobe, Inc. [1].

1
Contents 15 Import graphics extension 33

16 Movie Storyboard extension 34


I The Kernel 4
17 PostScript backend 34
1 The XY-pic implementation 4 17.1 Choosing the DVI-driver . . . . . . . . 34
1.1 Loading XY-pic . . . . . . . . . . . . . 4 17.2 Why use PostScript . . . . . . . . . 35
1.2 Logo, version, and messages . . . . . . 5
1.3 Fonts . . . . . . . . . . . . . . . . . . . 5 18 TPIC backend 36
1.4 Allocations . . . . . . . . . . . . . . . 5
19 em-TeX backend 37
2 Picture basics 6
2.1 Positions . . . . . . . . . . . . . . . . . 6 20 Necula’s extensions 37
2.2 Objects . . . . . . . . . . . . . . . . . 6 20.1 Expansion . . . . . . . . . . . . . . . . 37
2.3 Connections . . . . . . . . . . . . . . . 6 20.2 Polygon shapes . . . . . . . . . . . . . 37
2.4 Decorations . . . . . . . . . . . . . . . 6
2.5 The XY-pic state . . . . . . . . . . . . . 6
III Features 37
3 Positions 7
21 All features 37
4 Objects 11
22 Dummy option 37
5 Decorations 15
23 Arrow and Path feature 38
6 Kernel object library 16 23.1 Paths . . . . . . . . . . . . . . . . . . 38
6.1 Directionals . . . . . . . . . . . . . . . 16 23.2 Arrows . . . . . . . . . . . . . . . . . . 40
6.2 Circle segments . . . . . . . . . . . . . 18
6.3 Text . . . . . . . . . . . . . . . . . . . 18 24 Two-cell feature 43
24.1 Typesetting 2-cells in Diagrams . . . . 43
7 XY-pic options 18 24.2 Standard Options . . . . . . . . . . . . 44
7.1 Loading . . . . . . . . . . . . . . . . . 19 24.3 Nudging . . . . . . . . . . . . . . . . . 44
7.2 Option file format . . . . . . . . . . . 19 24.4 Extra Options . . . . . . . . . . . . . . 46
7.3 Driver options . . . . . . . . . . . . . . 20
24.5 2-cells in general XY-pictures . . . . . . 47

25 Matrix feature 48
II Extensions 20 25.1 XY-matrices . . . . . . . . . . . . . . . 48
8 Curve and Spline extension 20 25.2 New coordinate formats . . . . . . . . 49
8.1 Curved connections . . . . . . . . . . . 20 25.3 Spacing and rotation . . . . . . . . . . 49
8.2 Circles and Ellipses . . . . . . . . . . . 24 25.4 Entries . . . . . . . . . . . . . . . . . . 50
8.3 Quadratic Splines . . . . . . . . . . . . 24
26 Graph feature 51
9 Frame and Bracket extension 24
9.1 Frames . . . . . . . . . . . . . . . . . . 24 27 Polygon feature 53
9.2 Brackets . . . . . . . . . . . . . . . . . 26
28 Lattice and web feature 56
9.3 Filled regions . . . . . . . . . . . . . . 26
9.4 Framing as object modifier . . . . . . 27
29 Circle, Ellipse, Arc feature 58
9.5 Using curves for frames . . . . . . . . 27
29.1 Full Circles . . . . . . . . . . . . . . . 58
10 More Tips extension 27 29.2 Ellipses . . . . . . . . . . . . . . . . . 58
29.3 Circular and Elliptical Arcs . . . . . . 59
11 Line styles extension 27
30 Knots and Links feature 61
12 Rotate and Scale extension 29
31 Smart Path option 66
13 Colour extension 30

14 Pattern and Tile extension 31 IV Drivers 66

2
32 Support for Specific Drivers 66 17 hgraphis . . . . . . . . . . . . . . . . . 52
32.1 dvidrv driver . . . . . . . . . . . . . . 66 18 hknot-piecei construction set . . . . . 62
32.2 DVIPS driver . . . . . . . . . . . . . . 66 19 knot crossings with orientations and
32.3 DVITOPS driver . . . . . . . . . . . . 67 label positions . . . . . . . . . . . . . . 63
32.4 OzTeX driver . . . . . . . . . . . . . . 67 20 knot joins, with orientations, labels
32.5 OzTeX v1.7 driver . . . . . . . . . . . 67 and shifts . . . . . . . . . . . . . . . . 65
32.6 Textures driver . . . . . . . . . . . . . 68 21 Extension implementation replaced by
32.7 Textures v1.6 driver . . . . . . . . . . 68 use of hdriveri specials. . . . . . . . . . 69
32.8 XDVI driver . . . . . . . . . . . . . . . 68
32.9 CMacTeX driver . . . . . . . . . . . . 69

33 Extra features using PostScript drivers 69


33.1 Colour . . . . . . . . . . . . . . . . . . 70
33.2 Frames . . . . . . . . . . . . . . . . . . 70 kris.eps ross.eps
33.3 Line-styles . . . . . . . . . . . . . . . . 70
33.4 Rotations and scaling . . . . . . . . . 70 Kristoffer Rose
33.5 Patterns and tiles . . . . . . . . . . . . 71
Ross Moore
34 Extra features using tpic drivers 71
34.1 frames. . . . . . . . . . . . . . . . . . . 71
Preface
Appendices 71 This reference manual gives concise descriptions of
the modules of XY-pic, written by the individual au-
A Answers to all exercises 71 thors. Please direct any TEXnical question or sug-
gestion for improvement directly to the author of the
B Version 2 Compatibility 75 component in question, preferably by electronic mail
B.1 Unsupported incompatibilities . . . . . 75 using the indicated address. Complete documents
B.2 Obsolete kernel features . . . . . . . . 75 and printed technical documentation or software is
B.3 Obsolete extensions & features . . . . 76 most useful.
B.4 Obsolete loading . . . . . . . . . . . . 77 The first part documents the XY-pic kernel which
B.5 Compiling v2-diagrams . . . . . . . . . 77 is always loaded. The remaining parts describe the
three kinds of options: extensions in part II extend
C Common Errors 77 the kernel graphic capabilities, features in part III
provide special input syntax for particular diagram
References 77 types, and drivers in part IV make it possible to
exploit the printing capabilities supported by DVI
Index 78
driver programs. For each option it is indicated how
it should be loaded. The appendices contain answers
List of Figures to all the exercises, a summary of the compatibil-
ity with version 2, and list some reasons why XY-pic
1 hposiitions. . . . . . . . . . . . . . . . 8 might sometimes halt with a cryptic TEX error.
2 Example hplaceis . . . . . . . . . . . . 10
3 hobjectis. . . . . . . . . . . . . . . . . 12 License. XY-pic is free software in the sense that it
4 hdecoriations. . . . . . . . . . . . . . . 16 is available under the following license conditions:
5 Kernel library hdiriectionals . . . . . . 17
6 hciricles. . . . . . . . . . . . . . . . . . 19 XY-pic: Graphs and Diagrams with TEX
7 Syntax for curves. . . . . . . . . . . . 22 c 1991–1998 Kristoffer H. Rose
8 Plain hframeis. . . . . . . . . . . . . . 25 c 1994–1998 Ross Moore
9 Bracket hframeis. . . . . . . . . . . . . 25
10 Rotations, scalings and flips . . . . . . 31 The XY-pic package is free software; you can redis-
11 The 38 standard Macintosh patterns. . 32 tribute it and/or modify it under the terms of the
12 importing a graphic for labelling . . . 34 GNU General Public License as published by the Free
13 hpathis . . . . . . . . . . . . . . . . . . 39 Software Foundation; either version 2 of the License,
14 harrowis. . . . . . . . . . . . . . . . . . 41 or (at your option) any later version.
15 Pasting diagram. . . . . . . . . . . . . 44 The XY-pic package is distributed in the hope that
16 htwocellis . . . . . . . . . . . . . . . . 45 it will be useful, but without any warranty; without

3
even the implied warranty of merchantability or fit- most formats a single line with the command
ness for a particular purpose. See the GNU General
\input xy
Public License for more details.
You should have received a copy of the GNU Gen- in the preamble of a document file should load the
eral Public License along with this package; if not, kernel (see ‘integration with standard formats’ below
write to the Free Software Foundation, Inc., 675 Mass for variations possible with certain formats, in par-
Ave, Cambridge, MA 02139, USA. ticular LATEX [9]).
In practice this means that you are free to use The rest of this section describes things you must
XY-pic for your documents but if you distribute any consider if you need to use XY-pic together with other
part of XY-pic (including modified versions) to some- macro packages, style options, or formats. The less
one then you are obliged to ensure that the full source your environment deviates from plain TEX the eas-
text of XY-pic is available to them (the full text of the ier it should be. Consult the TEXnical documenta-
license in the file COPYING explains this in somewhat tion [15] for the exact requirements for other defini-
more detail ^¨ ). tions to coexist with XY-pic.

Notational conventions. We give descriptions of Privacy: XY-pic will warn about control sequences
the syntax of pictures as BNF2 rules; in explana- it redefines—thus you can be sure that there are
tions we will use upper case letters like X and Y for no conflicts between XY-pic-defined control sequences,
hdimenisions and lower case like x and y for hfactoris. those of your format, and other macros, provided you
load XY-pic last and get no warning messages like
Xy-pic Warning: ‘ . . . ’ redefined.
Part I
In general the XY-pic kernel will check all control
The Kernel sequences it redefines except that (1) generic tem-
poraries like \next are not checked, (2) predefined
Vers. 3.7 by Kristoffer H. Rose hkrisrose@brics.dki font identifiers (see §1.3) are assumed intentionally
preloaded, and (3) some of the more exotic control
After giving an overview of the XY-pic environment sequence names used internally (like @{-}) are only
in §1, this part document the basic concepts of XY- checked to be different from \relax.
picture construction in §2, including the maintained
‘graphic state’. The following sections give the pre- Category codes: The situation is complicated by
cise syntax rules of the main XY-pic constructions: the flexibility of TEX’s input format. The culprit is
the position language in §3, the object constructions the ‘category code’ concept of TEX (cf. [6, p.37]):
in §4, and the picture ‘decorations’ in §5. §6 presents when loaded XY-pic requires the characters \{}% (the
the kernel repertoire of objects for use in pictures; first is a space) to have their standard meaning and all
§7 documents the interface to XY-pic options like the other printable characters to have the same category
standard ‘feature’ and ‘extension’ options. as when XY-pic will be used —in particular this means
Details of the implementation are not discussed that (1) you should surround the loading of XY-pic
here but in the complete TEXnical documenta- with \makeatother . . . \makeatletter when load-
tion [15]. ing it from within a LATEX package, and that (2) XY-
pic should be loaded after files that change category
1 The XY-pic implementation codes like the german.sty that makes " active. Some
styles require that you reset the catcodes for every
This section briefly discusses the various aspects of diagram, e.g., with french.sty you should use the
the present XY-pic kernel implementation of which the command \english before every \xymatrix.
user should be aware. However, it is possible to ‘repair’ the problem in case
any of the characters #$&’+-.<=>‘ change category
code:
1.1 Loading XY-pic
\xyresetcatcodes
XY-pic is careful to set up its own environment in or-
der to function with a large variety of formats. For will load the file xyrecat.tex (version 3.3) to do it.
2 BNF is the notation for “meta-linguistic formulae” first used by [10] to describe the syntax of the Algol programming language.
We use it with the conventions of the TEXbook [6]: ‘−→’ is read “is defined to be”, ‘ | ’ is read “or”, and ‘hemptyi’ denotes “noth-
ing”; furthermore, ‘hidi’ denotes anything that expands into a sequence of TEX character tokens, ‘hdimeni’ and ‘hfactori’ denote
decimal numbers with, respective without, a dimension unit (like pt and mm), hnumberi denotes possibly signed integers, and htexti
denotes TEX text to be typeset in the appropriate mode. We have chosen to annotate the syntax with brief explanations of the
‘action’ associated with each rule; here ‘←’ should be read ‘is copied from’.

4
Integration with standard formats This is han- that now the package allows explicit absolute orien-
dled by the xyidioms.tex file and the integration as tation as well.
a LATEX [9] package by xy.sty. Messages that start with “Xy-pic Warning” are
indications that something needs your attention; an
xyidioms.tex: This included file provides some “Xy-pic Error” will stop TEX because XY-pic does
common idioms whose definition depends on the used not know how to proceed.
format such that XY-pic can use predefined dimen-
sion registers etc. and yet still be independent of the
format under which it is used. The current version
(3.4) handles plain TEX (version 2 and 3 [6]), AMS- 1.3 Fonts
TEX (version 2.0 and 2.1 [16]), LATEX (version 2.09 [8]
and 2ε [9]), AMS-LATEX (version 1.0, 1.1 [2], and 1.2), The XY-pic kernel implementation makes its drawings
and eplain (version 2.6 [3])3 . using five specially designed fonts:

Font Characters Default


xy.sty: If you use LATEX then this file makes it
\xydashfont dashes xydash10
possible to load XY-pic as a ‘package’ using the
\xyatipfont arrow tips, upper half xyatip10
LATEX 2ε [9] \usepackage command:
\xybtipfont arrow tips, lower half xybtip10
\xybsqlfont quarter circles for xybsql10
\usepackage [hoptioni,. . . ] {xy} hooks and squiggles
\xycircfont 1/8 circle segments xycirc10
where the hoptionis will be interpreted as if passed to
\xyoption (cf. §7).
The only exceptions to this are the options hav- The first four contain variations of characters in a
ing the same names as those driver package options large number of directions, the last contains 1/8 cir-
of part IV, which appear in cf. [4, table 11.2, p.317] cle segments.
or the LATEX 2ε graphics bundle. These will auto-
matically invoke any backend extension required to
best emulate the LATEX 2ε behaviour. (This means Note: The default fonts are not part of the XY-pic
that, e.g., [dvips] and [textures] can be used as kernel specification: they just set a standard for what
options to the \documentclass command, with the drawing capabilities should at least be required by an
normal effect.) XY-pic implementation. Implementations exploiting
The file also works as a LATEX 2.09 [8] ‘style op- capabilitites of particular output devices are in use.
tion’ although you will then have to load options with Hence the fonts are only loaded by XY-pic if the con-
the \xyoption mechanism described in §7. trol sequence names are undefined—this is used to
preload them at different sizes or prevent them from
1.2 Logo, version, and messages being loaded at all.

Loading XY-pic prints a banner containing the version


and author of the kernel; small progress messages are
printed when each major division of the kernel has 1.4 Allocations
been loaded. Any options loaded will announce them-
self in a similar fashion. One final thing that you must be aware of is that XY-
If you refer to XY-pic in your written text (please pic allocates a significant number of dimension regis-
do ¨ ) then you can use the command \Xy-pic to
^ ters and some counters, token registers, and box reg-
typeset the “XY-pic” logo. The version of the ker- isters, in order to represent the state and do computa-
nel is typeset by \xyversion and the release date by tions. The current kernel allocates 4 counters, 28 di-
\xydate (as found in the banner). By the way, the mensions, 2 box registers,4 token registers, 1 read
XY-pic name 4 originates from the fact that the first channel, and 1 write channel (when running under
version was little more than support for (x, y) coordi- LATEX; some other formats use slightly more because
nates in a configurable coordinate system where the standard generic temporaries are used). Options may
main idea was that all operations could be specified allocate further registers (currently loading every-
in a manner independent of the orientation of the co- thing loads 6 dimen-, 3 toks-, 1 box-, and 9 count-
ordinates. This property has been maintained except registers in addition to the kernel ones).
3 The ‘v2’ feature introduces some name conflicts, in order to maintain compatibility with earlier versions of XY-pic.
4 No description of a TEX program is complete without an explanation of its name.

5
2 Picture basics that the TEX reference point of an object is at its left
edge, thus shifted <−L,0pt> from the center—so a
The basic concepts involved when constructing XY- TEX box may be said to be a rectangular object with
pictures are positions and objects, and how they com- L = 0pt. Here is an example:
bine to form the state used by the graphic engine.
The general structure of an XY-picture is as fol-
U
lows: • ◦
L R
D
\xy hposi hdecori \endxy TEX reference point

The object shown has a rectangle edge but others are


builds a box with an XY-picture (LATEX users may
available even though the kernel only supports rect-
substitute \begin{xy} . . . \end{xy} if they prefer).
angle and circle edges. It is also possible to use entire
hposi and hdecori are components of the special
XY-pictures as objects with a rectangle edge, 0 as the
‘graphic language’ which XY-pictures are specified in.
reference point, L = −Xmin , R = Xmax , D = −Ymin ,
We explain the language components in general terms
and U = Ymax . The commands for objects are de-
in this § and in more depth in the following §§.
scribed in §4.

2.1 Positions
2.3 Connections
All positions may be written <X,Y > where X is the
TEX dimension distance right and Y the distance up Besides having the ability to be dropped at a position
from the zero position 0 of the XY-picture (0 has co- in a picture, all objects may be used to connect the
ordinates <0mm,0mm>, of course). The zero position two current objects of the state, i.e., p and c. For
of the XY-picture determines the box produced by the most objects this is done by ‘filling’ the straight line
\xy. . . \endxy command together with the four pa- between the centers with as many copies as will fit
rameters Xmin , Xmax , Ymin , and Ymax set such that between the objects:
all the objects in the picture are ‘contained’ in the g
g g g
U c
U L◦R
following rectangle: U L◦R D
U L◦R D
g g g
g g g
U L◦R D
O U L◦R D
g
(/.)p*-,+g g
U L◦R D
g
g g g
U L◦R D
U L◦R D
U L◦R D
L◦R D
D
Ymax

•o ◦ / The ways the various objects connect are described


TEX reference point Xmin 0 Xmax along with the objects.
Ymin

2.4 Decorations
where the distances follow the “up and right > 0”
principle, e.g., the indicated TEX reference point has When the \xy command reaches something that can
coordinates <Xmin ,0pt> within the XY-picture. The not be interpreted as a continuation of the position
zero position does not have to be contained in the pic- being read, then it is expected to be a decoration,
ture, but Xmin ≤ Xmax ∧ Ymin ≤ Ymax always holds. i.e., in a restricted set of TEX commands which add
The possible positions are described in detail in §3. to pictures. Most such commands are provided by
When an XY-picture is entered in math mode then the various user options (cf. §7)—only a few are pro-
the reference point becomes the “vcenter” instead, vided within the kernel to facilitate programming of
i.e., we use the point <Xmin ,-\the\fontdimen22> such options (and user macros) as described in §5.
as reference point.
2.5 The XY-pic state
2.2 Objects
Finally we summarise the user-accessible parts of the
The simplest form of putting things into the picture XY-picture state of two positions together with the
is to ‘drop’ an object at a position. An object is like last object associated with each: the previous, p, is
a TEX box except that it has a general Edge around the position <Xp , Yp > with the object Lp , Rp , Dp ,
its reference point—in particular this has the extents Up , Edgep , and the current, c, is the position <Xc ,
(i.e., it is always contained within) the dimensions L, Yc > with the object Lc , Rc , Dc , Uc , Edgec .
R, U , and D away from the reference point in each Furthermore, XY-pic has a configurable carte-
of the four directions left, right, up, and down. Ob- sian coordinate system described by an origin
jects are encoded in TEX boxes using the convention position <Xorigin ,Yorigin > and two base vectors

6
<Xxbase ,Yxbase > and <Xybase ,Yybase > accessed by the 3b. Skewing using ! just means that the reference
usual notation using parentheses: point of c is moved with as little change to the
shape of the object as possible, i.e., the edge of c
(x,y) = < Xorigin + x × Xxbase + y × Xybase , will remain in the same location except that it
Yorigin + x × Yxbase + y × Yybase > will grow larger to avoid moving the reference
point outside c.
This is explained in full when we show how to set the
base in note 3d of §3.
Finally typesetting a connection will setup a Exercise 3: What does the hposi . . . !R-L do?
“placement state” for referring to positions on the Bug: The result of ! is always a rectangle cur-
connection that is accessed through a special ? po- rently.
sition construction; this is also discussed in detail in 3c. A hposi covers another if it is a rectangle with
§3. size sufficiently large that the other is “under-
The XY-pic state consists of all these parameters neath”. The . operation “extends” a hposi to
together. They are initialised to zero except for cover an additional one—the reference point of c
Xxbase = Yybase = 1mm. is not moved but the shape is changed to a rect-
The edges are not directly available but points on angle such that the entire p object is covered.
the edges may be found using the different hcorneri Bug: non-rectangular objects are first “trans-
forms described in §3. lated” into a rectangle by using a diagonal
It is possible to insert an ‘initial’ piece of hposi through the object as the diagonal of the rect-
hdecori at the start of every XY-picture with the dec- angle.
laration
3d. The operations : and :: set the base used for
\everyxy={ htexti } hcoordiinates having the form (x,y). The : op-
eration will set <Xorigin , Yorigin > to p, <Xxbase ,
This will act as if the htexti was typed literally right Yxbase > to c − origin, and <Xybase , Yybase > to
after each \xy command, parsing the actual contents <−Yxbase , Xxbase > (this ensures that it is a usual
as if it follows this – thus it is recommended that square coordinate system). The :: operation
htexti has the form hposi, such that users can con- may then be used afterwards to make nonsqare
tinue with hposi hdecori. bases by just setting ybase to c − origin. Here
are two examples: firstly 0;<1cm,0cm>: sets the
coordinate system
3 Positions O
ybase × (1,1)
A hposiition is a way of specifying locations as well
as dropping objects at them and decorating them— ◦ / xbase
in fact any aspect of the XY-pic state can be changed origin
by a hposi but most will just change the coordinates while <1cm,.5cm>;<2cm,1.5cm>:<1cm,1cm>::
and/or shape of c. defines
All possible positions are shown in figure 1 with
explanatory notes below. ybase
× (1,1)
before _? ? ?
 xbase
Exercise 1: Which of the positions 0, <0pt,0pt>, :: O 
?ybase
? 
<0pt>, (0,0), and /0pt/ is different from the oth- ?
ers? origin

where in each case the ◦ is at 0, the base vectors


Notes
have been drawn and the × is at (1,1).
3a. When doing arithmetic with + and - then the When working with cartesian coordinates these
resulting current object inherits the size of the three special hfactoris are particularly useful:
hcoordi, i.e., the right argument—this will be √
zero if the hcoordi is a hvectori. \halfroottwo 0.70710678 ≈ 12 2

\partroottwo 0.29289322 ≈ 1 − 12 2

\halfrootthree 0.86602540 ≈ 12 3
Exercise 2: How do you set c to an object the
same size as the saved object "ob" but moved More can be defined using \def (or \newcommand
<X,Y >? in LATEX).

7
Syntax Action
hposi −→ hcoordi c ← hcoordi
| hposi + hcoordi c ← hposi + hcoordi3a
| hposi - hcoordi c ← hposi − hcoordi3a
| hposi ! hcoordi c ← hposi then skew3b c by hcoordi
| hposi . hcoordi c ← hposi but also covering3c hcoordi
| hposi , hcoordi c ← hposi then c ← hcoordi
| hposi ; hcoordi c ← hposi, swap p and c, c ← hcoordi
| hposi : hcoordi c ← hposi, set base3d , c ← hcoordi
| hposi :: hcoordi c ← hposi, ybase ← c − origin, c ← hcoordi
| hposi * hobjecti c ← hposi, drop3f hobjecti
| hposi ** hobjecti c ← hposi, connect3g using hobjecti
| hposi ? hplacei c ← hposi, c ← hplacei3h
| hposi @ hstackingi c ← hposi, do hstackingi3o
| hposi = hsavingi c ← hposi, do hsavingi3p
hcoordi −→ hvectori hposi is hvectori with zero size
| hemptyi | c reuse last c (do nothing)
| p p
| x | y axis intersection3k with pc
| shdigiti | s{hnumberi} stack3o position hdigiti or hnumberi below the top
| "hidi" restore what was saved3p as hidi earlier
| { hposi hdecori } the c resulting from interpreting the group3l
hvectori −→ 0 zero
| < hdimeni , hdimeni > absolute
| < hdimeni > absolute with equal dimensions
| ( hfactori , hfactori ) in current base3d
| a ( hnumberi ) angle in current base3e
| hcorneri from reference point to hcorneri of c
| hcorneri ( hfactori ) The hcorneri multiplied with hfactori
| / hdirectioni hdimeni / vector hdimeni in hdirectioni3m
hcorneri −→ L|R|D|U offset3n to left, right, down, up side
| CL | CR | CD | CU | C offset3n to center of side, true center
| LD | RD | LU | RU offset3n to actual left/down, . . . corner
| E|P offset3n to nearest/proportional edge point to p
hplacei −→ < hplacei | > hplacei shave3h (0)/(1) to edge of p/c, f ← 0/1
| ( hfactori ) hplacei f ← hfactori
| hslidei pick place3h and apply hslidei
| ! {hposi} hslidei intercept3j with line setup by hposi and apply hslidei
hslidei −→ / hdimeni / slide3i hdimeni further along connection
| hemptyi no slide

Figure 1: hposiitions.

8
3e. An angle α in XY-pic is the same as the coor- in the tangent direction, i.e., ? . . . /A/ is the same
dinate pair ( cos α, sin α) where α must be an as ? . . . +/A/.
integer interpreted as a number of degrees. Thus
the hvectori a(0) is the same as (1,0) and a(90) 3j. This special hplacei finds the point where the
as (0,1), etc. last connection intercepts with the line from p
to c as setup by the hposi, thus usually this will
3f. To drop an hobjecti at c with * means to actu- have the form !{hcoordi;hcoordi}5 , for example,
ally physically typeset it in the picture with ref- Bug: Only works for straight arrows at present.
erence position at c—how this is done depends \xy <1cm,0cm>:
on the hobjecti in question and is described in (0,0)*=0{+}="+" ;
detail in §4. The intuition with a drop is that it (2,1)*=0{\times}="*" **@{.} ,
typesets something at <Xc ,Yc > and sets the edge (1,0)*+{A} ; (2,2)*+{B} **@{-}
of c accordingly. ?!{"+";"*"} *{\bullet}
\endxy
3g. The connect operation ** will first compute a
number of internal parameters describing the di- will typeset
rection from p to c and then typesets a connection B
filled with copies of the hobjecti as illustrated 
in §2.3. The exact details of the connection de- 
pend on the actual hobjecti and are described in  ×
•
general in §4. The intuition with a connection 
is that it typesets something connecting p and c + A
and sets the ? hposi operator up accordingly.
3k. The positions denoted by the axis intersection
3h. Using ? will “pick a place” along the most recent hcoordiinates x and y are the points where the
connection typeset with **. What exactly this line through p and c intersects with each axis.
means is determined by the object that was used The following figure illustrates this:
for the connection and by the modifiers described
in general terms here. x
ybase _? xbase 7 •
?? o
The “shave” modifiers in a hplacei, < and >, ?? ooooo ◦ c
o
change the default hfactori, f , and how it is used, origin ◦p
by ‘moving’ the positions that correspond to (0) •
and (1) (respectively): These are initially set y
equal to p and c, but shaving will move them
to the point on the edge of p and c where the
connection “leaves/enters” them, and change the Exercise 4: Given predefined points A, B, C,
default f as indicated. When one end has already and D (stored as objects "A", "B", "C", and "D"),
been shaved thus then subsequent shaves will cor- write a hcoordi specification that will return the
respond to sliding the appropriate position(s) a point where the lines AB and CD cross (the point
TEX \jot (usually equal to 3pt) further towards marked with a large circle here):


the other end of the connection (and past it). Fi-

B 
nally the pick action will pick the position located
 C
the fraction f of the way from (0) to (1) where
 D
f = 0.5 if it was not set (by <, >, or explicitly).
All this is probably best illustrated with some A 
examples: each ⊗ in figure 2 is typeset by
a sequence of the form p; c **@{.} ?hplacei
*{\oplus} where we indicate the ?hplacei in each
case. (We also give examples of hslideis.) 3l. A hposi hdecori grouped in {}-braces6 is inter-
preted in a local scope in the sense that any p
3i. A hslidei will move the position a dimension fur- and base built within it are forgotten afterwards,
ther along the connection at the picked position. leaving only the c as the result of the hcoordi.
For straight connections (the only ones kernel XY- Note: Only p and base are restored – it is not a
pic provides) this is the same as adding a vector TEX group.
5 The braces can be replaced by (*. . . *) once, i.e., there can be no other braces nested inside it.
6 One can use (*. . . *) instead also here.

9
p is circular: rGFED
@ABC
0123
7654
?<(0) r?<
r
 yrrrr
9r rR⊕
⊕ 9 R
r r R R
rrrrrrr 9 R R

rrr R R
rrr
?(0)
?<<<
?<<</1cm/ R R
R R?<>(.5)rrr?<>(.2)(.5)
R R yrrr
⊕⊕ 9 R R R ?>(.7) rr?<>(.7)
rrrrr R R yrrrr
r ⊕R R
? 9
rrr R R R ?>>>>

rrr r?>
?(.7)
R R
R r
y rrrr
⊕ ⊕ c is a
9

rrr
square
rrr text!
?(1)

Figure 2: Example hplaceis

Exercise 5: What effect is achieved by using Exercise 7: What does this typeset?
the hcoordiinate “{;}”? \xy *=<3cm,1cm>\txt{Box}*\frm{-}
!U!R(.5) *\frm{..}*{\bullet} \endxy
3m. The vector /Z/, where Z is a hdimenision, is the
same as the vector <Z cos α,Z sin α> where α is Hint: \frm is defined by the frame extension and
the angle of the last direction set by a connec- just typesets a frame of the kind indicated by the
tion (i.e., with **) or subsequent placement (?) argument.
position. Bug: Currently only the single-letter corners (L,
It is possible to give a hdirectioni as described in R, D, U, C, E, and P) will work for any shape—the
the next section (figure 3, note 4l in particular) others silently assume that the shape is rectan-
that will then be used to set the value of α. It is gular.
also possible to omit the hdimeni in which case 3o. The stack is a special construction useful for stor-
it is set to a default value of .5pc. ing a sequence of hposiitions that are accessible
using the special hcoordiinates sn, where n is ei-
3n. A hcorneri is an offset from the current <Xc ,Yc > ther a single digit or a positive integer in {}s: s0
position to a specific position on the edge of the is always the ‘top’ element of the stack and if the
c object (the two-letter ones may be given in any stack has depth d then the ‘bottom’ element of
combination): the stack has number s{d − 1}. The stack is said
to be ‘empty’ when the depth is 0 and then it is
LU1 U UC an error to access any of the sn or ‘pop’ which
11 RU
   yrrr means remove the top element, shifting what is
CL OOO in s1 to s0, s2 to s1, etc. Similarly, ‘push c’
wooo
C d
' rdd CR means to shift s0 to s1, etc., and then insert the
L dddl26/ c o R
P ll < O bEEE kVVV c as the new s0.
E yyy RD
p LD DC The stack is manipulated as follows:
D
@hstackingi Action
The ‘edge point’ E lies on the edge along the line
@+hcoordi push hcoordi
from p to the centre of the object, in contrast to
the ‘proportional’ point P which is also a point @-hcoordi c ← hcoordi then pop
on the edge but computed in such a way that the @=hcoordi load stack with hcoordi
object looks as much ‘away from p’ as possible. @@hcoordi do hcoordi for c ← stack
@i initialise
Finally, a following (f ) suffix will multiply the @( enter new frame
offset vector by the hfactori f . @) leave current frame

To ‘load stack’, means to load the entire stack


Exercise 6: What is the difference between the with the positions set by hcoordi within which ,
hposiitions c?< and c+E? means ‘push c’.

10
To ‘do hcoordi for all stack elements’ means to You can pass parameters to such a macro by let-
set c to each element of the stack in turn, from ting it use coordinates named "1", "2", etc., and
the bottom and up, and for each interpret the then use ="1", ="2", etc., just before every use
hcoordi. Thus the first interpretation has c set of it to set the actual values of these. Note: it is
to the bottom element of the stack and the last not possible to use a hcoordi of the form "hidi"
has c set to s0. If the stack is empty, the hcoordi directly: write it as {"hidi"}.
is not interpreted at all.
These two operations can be combined to repeat
Exercise 9: Write a macro "dbl" to double the
a particular hcoordi for several points, like this:
size of the current c object, e.g., changing it from
\xy the dotted to the dashed outline in this figure:
@={(0,-10),(10,3),(20,-5)} @@{*{P}} _ _ _ _ _ _ _ _ _ 
\endxy  
will typeset  
P  + 
 
 
P _ _ _ _ _ _ _ _ _
P
Finally, the stack can be forcibly cleared using The final form defines a special kind of macro
@i, however, this is rarely needed because of @(, that should only be used after the @= stack oper-
which saves the stack as it is, and then clears it, ation: the entire current stack is saved such that
such when it has been used (and is empty), and the stack operation @="hidi" will reload it.
@) is issued, then it is restored as it was at the Note: There is no distinction between the ‘name
time of the @(. spaces’ of hidis used for saved coordinates and
other things.
Exercise 8: How would you change the exam-
ple above to connect the points as shown below?
E 4 Objects
 EEEE
 EE
 gE
ggggg g
 gg Objects are the entities that are manipulated with
 g
gg the * and ** hposi operations above to actually get
some output in XY-pictures. As for hposiitions the
operations are interpreted strictly from left to right,
3p. It is possible to define new hcoordiinates on the however, the actual object is built before all the
form "hidi" by saving the current c using the hmodifieris take effect. The syntax of objects is given
. . . ="hidi" hposiition form. Subsequent uses of in figure 3 with references to the notes below. Re-
"hidi" will then reestablish the c at the time of mark: It is never allowed to include braces {} inside
the saving. hmodifieris! In case you wish to do something that
Using a "hidi" that was never defined is an error, requires {. . . } then check in this manual whether you
however, saving into a name that was previously can use (*. . . *) instead. If not then you will have to
defined just replaces the definition without warn- use a different construction!
ing, i.e., "hidi" always refers to the last thing
saved with that hidi.
Notes
However, many other things can be ‘saved’: in
general @hsavingi has either of the forms 4a. An hobjecti is built using \objectbox {htexti}.
\objectbox is initially defined as
@:"hidi" "hidi" restores current \def\objectbox#1{%
base \hbox{$\objectstyle{#1}$}}
@hcoordi"hidi" "hidi" reinterprets hcoordi
\let\objectstyle=\displaystyle
@@"hidi" @="hidi" reloads this stack
but may be redefined by options or the user.
The first form defines "hidi" to be a macro that The htexti should thus be in the mode required
restores the current base. by the \objectbox command—with the default
The second does not depend on the state at the \objectbox shown above it should be in math
time of definition at all; it is a macro definition. mode.

11
Syntax Action
hobjecti −→ hmodifieri hobjecti apply hmodifieri to hobjecti
| hobjectboxi build hobjectboxi then apply its hmodifieris

hobjectboxi −→ { htexti } build default4a object


| hlibrary objecti | @hdiri use hlibrary objecti or hdiriectional (see §6)
| hTEX boxi { htexti } build box4b object with htexti using the given hTEX boxi
command, e.g., \hbox
| \object hobjecti wrap up the hobjecti as a finished object box4c
| \composite { hcompositei } build composite object box4d
| \xybox { hposi hdecori } package entire XY-picture as object4e
hmodifieri −→ ! hvectori hobjecti has its reference point shifted4f by hvectori
| ! hobjecti has the original reference point reinstated
| hadd opi hsizei change hobjecti size4g
| h | i hobjecti is hidden4h , invisible4i
| [ hshapei ] hobjecti is given the specified hshapei4j
| [= hshapei ] define hshapei4k to reestablish current object style
| hdirectioni set current direction for this hobjecti
hadd opi −→ + | - | = | += | -= grow, shrink, set, grow to, shrink to
hsizei −→ hemptyi default size4g
| hvectori size as sides of rectangle covering the hvectori
hdirectioni −→ hdiagi hdiagional direction4l
| v hvectori direction4l of hvectori
| q{ hposi hdecori } direction4l from p to c after hposi hdecori
| hdirectioni : hvectori vector relative to hdirectioni4m
| hdirectioni _ | hdirectioni ^ 90◦ clockwise/anticlockwise to hdirectioni4m
hdiagi −→ hemptyi last used direction (not necessarily diagonal4l )
| l|r|d|u left, right, down, up diagonal4l
| ld | rd | lu | ru left/down, . . . diagonal4l
hcompositei −→ hobjecti first object is required
| hcompositei * hobjecti add hobjecti to composite object box4d

Figure 3: hobjectis.

12
4b. An hobjecti built from a TEX box with dimen- opi:
sions w × (h + d) will have Lc = Rc = w/2,
Uc = Dc = (h + d)/2, thus initially be equipped hadd opi default
with the adjustment !C (see note 4f). In partic- + +<2 × objectmargin>
ular: in order to get the reference point on the - -<2 × objectmargin>
(center of) the base line of the original hTEX boxi = =<objectwidth,objectheight>
then you should use the hmodifieri !; to get the += +=< max(Lc + Rc , Dc + Uc )>
reference point identical to the TEX reference -= -=< min(Lc + Rc , Dc + Uc )>
point use the modifier !!L.
The defaults for the first three are set with the
TEXnical remark: Any macro that expands to
commands
something that starts with a hboxi may be used
as a hTEX boxi here. \objectmargin hadd opi {hdimeni}
4c. Takes an object and constructs it, building a box; \objectwidth hadd opi {hdimeni}
it is then processed according to the preceeding \objectheight hadd opi {hdimeni}
modifiers. This form makes it possible to use
any hobjecti as a TEX box (even outside of XY- where hadd opi is interpreted in the same way as
pictures) because a finished object is always also above.
a box. The defaults for +=/-= are such that the result-
ing object will be the smallest containing/largest
4d. Several hobjectis can be combined into a single
contained square.
object using the special command \composite
with a list of the desired objects separated with
*s as the argument. The resulting box (and ob- Exercise 11: How are the objects typeset by
ject) is the least rectangle enclosing all the in- the hposiitions “*+UR{\sum}” and “*+DL{\sum}”
cluded objects. enlarged?
4e. Take an entire XY-picture and wrap it up as a Bug: Currently changing the size of a circular
box as described in §2.1. Makes nesting of XY- object is buggy—it is changed as if it is a rect-
pictures possible: the inner picture will have its angle and then the change to the R parameter
own zero point which will be its reference point affects the circle. This should be fixed probably
in the outer picture when it is placed there. by a generalisation of the o shape to be ovals or
ellipses with horizontal/vertical axes.
4f. An object is shifted a hvectori by moving the
point inside it which will be used as the refer- 4h. A hidden object will be typeset but hidden from
ence point. This effectively pushes the object the XY-pic in that it won’t affect the size of the entire
same amount in the opposite direction. picture as discussed in §2.1.

4i. An invisible object will be treated completely


Exercise 10: What is the difference between normal except that it won’t be typeset, i.e., XY-
the hposiitions 0*{a}!DR and 0*!DR{a}? pic will behave as if it was.
4g. A hsizei is a pair <W ,H> of the width and height 4j. Setting the shape of an object forces the shape of
of a rectangle. When given as a hvectori these its edge to be as indicated. The kernel provides
are just the vector coordinates, i.e., the hvectori three shapes that change the edge, namely [.],
starts in the lower left corner and ends in the up- [], and [o], corresponding to the outlines
per right corner. The possible hadd opierations

, and g̀a
f
L ×b
e
Rdc
that can be performed are described in the fol- U U
lowing table. × , L × R
D
D
hadd opi description
+ grow where the × denotes the point of the reference
- shrink position in the object (the first is a point). Ex-
= set to tensions can provide more shapes, however, all
+= grow to at least shapes set the extent dimensions L, R, D, and
-= shrink to at most U.
In each case the hvectori may be omitted which The default shape for objects is [] and for plain
invokes the “default size” for the particular hadd coordinates it is [.].

13
Furthermore the hshapeis [r], [l], [u], and [d], Note 1: The current colour is regarded as part
are defined for convenience to adjust the object to of the style for this purpose.
the indicated side by setting the reference point Note 2: Such namings are global in scope. They
such that the reference point is the same dis- are intended to allow a consistent style to be eas-
tance from the opposite of the indicated edge ily maintained between various pictures and dia-
and the two neighbour edges but never closer grams within the same document.
to the indicated side than the opposite edge,
e.g., the object [r]\hbox{Wide text} has refer- If the same hstylei is intended for several
ence point at the × in × hobjectis occurring in succession, the [|*]
Wide text but the object
[d]\hbox{Wide text} has reference point at the hmodifieri can be used on the later hobjectis.
× in Wide × text. Finally, [c] puts the reference This only works when [|*] precedes any other
point at the center. hstylei modifiers; it is local in scope, recovering
the last hstyleis used at the same level of TEX
Note: Extensions can add new hshapei object grouping.
hmodifieris which are then called hstyleis. These
will always be either of the form [hkeywordi] or 4l. Setting the current direction is simply pretending
[hcharacteri hargumenti]. Some of these hstyleis for the typesetting of the object (and the follow-
do other things than set the edge of the object. ing hmodifieris) that some connection set it – the
hemptyi case just inherits the previous direction.
4k. While typesetting an object, some of the prop- It is particularly easy to set hdiagional directions:
erties are considered part of the ‘current object
style’. Initially this means nothing but some of uO
the hstyleis defined by extensions have this sta- ul = _?lu ur ? = ru
tus, e.g., colours [red], [blue] say, using the ?? 
?? 
HON
IJ MKL
xycolor extension, or varying the width of lines ? 
using xyline. Such styles are processed left-to- lo /r
 ??
right; for example,  ??
 ??
  
*[red][green][=NEW][blue]{A} dl = ld  dr = rd
d
will typeset a blue A and define [NEW] to set the
colour to green (all provided that xycolor has Alternatively vhvectori sets the direction as if the
been loaded, of course). connection from 0 to the hvectori had been type-
set except that the origin is assumed zero such
that directions v(x,y) mean the natural thing,
Saving styles: Once specified for an hobjecti,
i.e., is the direction of the connection from (0,0)
the collection of hstyleis can be assigned a name,
to (x,y).
using [=hwordi]. Then [hwordi] becomes a new
hstylei, suitable for use with the same or other In case the direction is not as simple, you can
hobjectsis. Use a single hwordi built from ordi- construct { hposi hdecori } that sets up p and
nary letters. If [hwordi] already had meaning c such that pc has the desired direction. Note:
the new definition will still be imposed, but the that you must use the (*. . . *) form if this is to
following type of warning will be issued: appear in an object hmodifieri!

Xy-pic Warning: Redefining style [hwordi] Exercise 12: What effect is achieved by using
hmodifieris v/1pc/ and v/-1pc/?
The latter warning will appear if the definition
occurs within an \xymatrix. This is perfectly 4m. Once the initial direction is established as either
normal, being a consequence of the way that the the last one or an absolute one then the remain-
matrix code is handled. Similarly the message der of the hdirectioni is interpreted.
may appear several times if the style definition is
Adding a single ^ or _ denotes the result of rotat-
made within an \ar.
ing the default direction a right angle in the pos-
The following illustrates how to avoid these mes- itive and negative direction, i.e., anti-/clockwise,
sages by defining the style without typesetting respectively. Note: Do not use ^^ but only __
anything. to reverse the direction!
\setbox0=\hbox{% A trailing :hvectori is like vhvectori but uses
\xy\drop[OrangeRed][=A]{}\endxy} the hdirectioni to set up a standard square base

14
such that :(0,1) and :(0,-1) mean the same as tracing of all XY-pic commands executed, with
:a(90) and :a(-90) and as ^ and _, respectively. line numbers. \xytracing traces even more: the
entire XY-pic state is printed after each modifica-
tion. \xyquiet restores default quiet operation.
Exercise 13: What effect is achieved by using
hmodifieris v/1pc/:(1,0) and v/-1pc/__? 5d. Ignoring means that the hposi hdecori is still
parsed the usual way but nothing is typeset and
the XY-pic state is not changed.
5 Decorations
5e. It is possible to save an intermediate form of com-
hDecoriations are actual TEX macros that decorate mands that generate parts of an XY-picture to
the current picture in manners that depend on the a file such that subsequent typesetting of those
state. They are allowed after the hposiition either of parts is significantly faster: this is called com-
the outer \xy. . . \endxy or inside {. . . }. The possi- piling. The produced file contains code to check
bilities are given in figure 4 with notes below. that the compiled code still corresponds to the
Most options add to the available hdecori, in same hposihdecori as well as efficient XY-code to
particular the v2 option loads many more since XY- redo it; if the hposihdecori has changed then the
pic versions prior to 2.7 provided most features as compilation is redone.
hdecori.
There are two ways to use this. The direct is
to invent a hnamei for each diagram and then
Notes embrace it in \xycompileto{hnamei}|{. . . } –
5a. Saving and restoring allows ‘excursions’ where this dumps the compiled code into the file
lots of things are added to the picture without hnamei.xyc.
affecting the resulting XY-pic state, i.e., c, p, and When many diagrams are compiled then it
base, and without requiring matching {}s. The is easier to add \xycompile{. . . } around the
independence of {} is particularly useful in con- hposihdecori to be compiled. This will assign
junction with the \afterPOS command, for ex- file names numbered consecutively with a hprefixi
ample, the definition which is initially the expansion of \jobname- but
\def\ToPOS{\save\afterPOS{% may be set with
\POS**{}?>*@2{>}**@{-}\restore};p,}
\CompilePrefix{hprefixi}
will cause the code \ToPOShposi to construct a
double-shafted arrow from the current object to This has the disadvantage, however, that if addi-
the hposi (computed relative to it) such that \xy tional compiled XY-pictures are inserted then all
*{A} \ToPOS +<10mm,2mm>\endxy will typeset subsequent pictures will have to be recompiled.
.6
the pictureAeeeee . One particular situation is provided, though:
when used within constructions that typeset their
contents more than once (such as most AMS-
Note: Saving this way in fact uses the same LATEX equation constructs) then the declaration
state as the {} ‘grouping’, so the code p1 ,
{p2 \save}, . . . {\restore} will have c = p1
\CompileFixPoint{hidi}
both at the . . . and at the end!

5b. One very tempting kind of TEX commands to can be used inside the environment to fix the
perform as hdecori is arithmetic operations on counter to have the same value at every passage.
the XY-pic state. This will work in simple XY- Finally, when many ‘administrative typesetting
pictures as described here but be warned: it is runs’ are needed, e.g., readjusting LATEX cross
not portable because all XY-pic execution is indi- references and such, then it may be an advan-
rect, and this is used by several options in non- tage to not typeset any XY-pictures at all during
trivial ways. Check the TEX-nical documenta- the intermediate runs. This is supported by the
tion [15] for details about this! following declarations which for each compilation
Macros that expand to hdecori will always do the creates a special file with the extension .xyd con-
same, though. taining just the size of the picture:

5c. \xyecho will turn on echoing of all interpreted \MakeOutlines


XY-pic hposi characters. Bug: Not completely \OnlyOutlines
implemented yet. \xyverbose will switch on a \ShowOutlines

15
Syntax Action
hdecori −→ hcommandi hdecori either there is a command. . .
| hemptyi . . . or there isn’t.
hcommandi −→ \save hposi save state5a , then do hposi
| \restore restore state5a saved by matcing \save
| \POS hposi interpret hposi
| \afterPOS { hdecori } hposi interpret hposi and then perform hdecori
| \drop hobjecti drop hobjecti as the hposi * operation
| \connect hobjecti connect with hobjecti as the hposi ** operation
| \relax do nothing
| hTEX commandsi any TEX commands5b and user-defined macros
that neither generates output (watch out for stray
spaces!), nor changes the grouping, may be used
| \xyverbose | \xytracing | \xyquiet tracing5c commands
| \xyignore {hposi hdecori} ignore5d XY-code
| \xycompile {hposi hdecori} compile5e to file hprefixihnoi.xyc
| \xycompileto{hnamei}{hposihdecori} compile5e to file hnamei.xyc

Figure 4: hdecoriations.

\NoOutlines with hvarianti being hemptyi or one of the characters


^_23 and hmaini some mnemonic code.
The first does no more. The second uses the
file to typesets a dotted frame of the appropri- We will classify the directionals primarily in-
ate size instead of the picture (unless the picture tended for building connections as connectors and
has changed and is recompiled, then it is type- those primarily intended for placement at connection
set as always and the .xyd file is recreated for ends or as markers as tips.
subsequent runs). The third shows the outlines Figure 5 shows all the hdiriectionals defined by
as dotted rectangles. The last switches outline the kernel with notes below; each hmaini type has a
processing completely off. line showing the available hvariantis. Notice that only
some variants exist for each hdiri—when a nonexist-
ing variant of a hdiri is requested then the hemptyi
6 Kernel object library variant is used silently. Each is shown in either of the
two forms available in each direction as applicable:
In this section we present the library objects provided
connecting a to a (typeset by **\dirhdiri) and
with the kernel language—several options add more
as a tip at the end of a dotted connection of the same
library objects. They fall into three types: Most of
variant (i.e., typeset by the hposi **\dirhvarianti{.}
the kernel objects (including all those usually used
?> *\dirhdiri).
with ** to build connections) are directionals, de-
scribed in §6.1. The remaining kernel library objects As a special case an entire hobjecti is allowed as
are circles of §6.2 and text of §6.3. a hdiri by starting it with a *: \dir* is equivalent to
\object.
6.1 Directionals
The kernel provides a selection of directionals: ob-
jects that depend on the current direction. They all Notes
take the form
\dirhdiri 6a. You may use \dir{} for a “dummy” directional
object (in fact this is used automatically by
to typeset a particular hdiriectional object. All have **{}). This is useful for a uniform treatment of
the structure connections, e.g., making the ? hposi able to find
a point on the straight line from p to c without
hdiri −→ hvarianti{hmaini}
actually typesetting anything.

16
Dummy6a
\dir{}

Plain connectors6b
iii
'!&"%#$iii '!&%"#$ '!&"%$# i
ii iii iiiiiiiiiii
\dir{-} iiii \dir2{-} iiiiii \dir3{-} i i
i

\dir{.} '!&"%#$ \dir2{.} '!&%"#$ \dir3{.} '!&"%$#

'!&%"#$ t4 '!&%"#$ 4t '!&"%$# t4 4t


4t
t4 4t t4
4t t4 4t 4t
\dir{~} t4 t4 4t \dir2{~} \dir3{~} 4t t4 t4 t4 4t
ii
'!&"%#$ '!&%"#$ '!&"%$# i
ii
i i i ii ii i i
\dir{--} i i \dir2{--} i ii \dir3{--} i

'!&"%#$ 4t '!&%"#$ '!&"%$# 4t


4t 4t 4t 4t
4t 4t 4t 4t
\dir{~~} \dir2{~~} t 4 \dir3{~~} t 4

Plain tips6c
4 4 4 08 i/:
\dir{>} \dir^{>} \dir_{>} \dir2{>} \dir3{>}
t t t xp ioz
\dir{<} ) \dir^{<} ) \dir_{<}
)
\dir2{<} ) \dir3{<} ))
\dir{|}
'
\dir^{|} ' \dir_{|}
'
\dir2{|} \dir3{|}
Gg
\dir{(} \dir^{(} \dir_{(}
\dir{)} Gg \dir^{)} \dir_{)} Gg
' 
\dir^{‘} \dir_{‘}
G g
\dir^{’} \dir_{’}

Constructed tips6d
44 44 44 08 08 ii/: /:
\dir{>>} \dir^{>>} \dir_{>>} \dir2{>>} \dir3{>>}
tt tt tt xp px oz i
ioz
\dir{<<} )) \dir^{<<} ) ) \dir_{<<} ))
\dir2{<<} )) \dir3{<<} ))))
\dir{||} )i \dir^{||} )i \dir_{||} )i
\dir2{||} )i \dir3{||} )i)
\dir{|-} \dir^{|-} \dir_{|-} \dir2{|-} \dir3{|-} i
)4 4 )4 )t )t t •
\dir{>|} \dir{>>|} \dir{|<}  \dir{|<<}  \dir{*}
i) N ◦
\dir{+} \dir{x} \dir{/} \dir{//} \dir{o}

Figure 5: Kernel library hdiriectionals

17
6b. The plain connectors group contains basic direc- The default is to generate a full circle with the
tionals that lend themself to simple connections. specified radius, e.g.,
typesets “”
'!&"%$# ”
By default XY-pic will typeset horizontal and ver- \xy*\cir<4pt>{}\endxy
tical \dir{-} connections using TEX rules. Un- \xy*{M}*\cir{}\endxy — “M
fortunately rules is the feature of the DVI format
most commonly handled wrong by DVI drivers. All the other circle segments are subsets of this and
Therefore XY-pic provides the hdecoriations have the shape that the full circle outlines.
Partial circle segments with horientiation are the
\NoRules part of the full circle that starts with a tangent vec-
\UseRules tor in the direction of the first hdiagional (see note 4l)
and ends with a tangent vector in the direction of the
that will switch the use of such off and on. other hdiagional after a clockwise (for _) or anticlock-
wise (for ^) turn, e.g.,

typesets “ ”
As can be seen by the last two columns, these

“ ”
(and most of the other connectors) also ex- \xy*\cir<4pt>{l^r}\endxy

“”
ist in double and triple versions with a 2 \xy*\cir<4pt>{l_r}\endxy —

“ ”
or a 3 prepended to the name. For conve- \xy*\cir<4pt>{dl^u}\endxy —

“ 8?9:;
M <”
nience \dir{=} and \dir{:} are synonyms for \xy*\cir<4pt>{dl_u}\endxy —
\dir2{-} and \dir2{.}, respectively; similarly \xy*+{M}*\cir{dr_ur}\endxy —
\dir{==} is a synonym for \dir2{--}.
If the same hdiagi is given twice then nothing is type-
6c. The group of plain tips contains basic objects set, e.g.,
that are useful as markers and arrowheads mak-
\xy*\cir<4pt>{u^u}\endxy typesets “ ”
ing connections, so each is shown at the end of a
dotted connection of the appropriate kind. Special care is taken to setup the hdiagional defaults:
They may also be used as connectors and will • After ^ the default is the diagonal 90◦ anticlock-
build dotted connections. e.g., **@{>} typesets wise from the one before the ^.
4 4 4 • After _ the default is the diagonal 90◦ clockwise
4 4 4
from the one before the _.
The hdiagi before ^ or _ is required for \cir hobjectsi.

Exercise 14: Typeset the following two +s and Exercise 15: Typeset the following shaded circle

'!&!"#
"%$#
a tilted square:
/o/ with radius 5pt:
+o
+
Hint: the dash created by \dir{-} has the length
5pt (here).
6.3 Text
6d. These tips are combinations of the plain tips Text in pictures is supported through the hobjecti
provided for convenience (and optimised for ef- construction
ficiency). New ones can be constructed using
\composite and by declarations of the form \txt hwidthi hstylei {htexti}

\newdir hdiri {hcompositei} that builds an object containing htexti typeset to


hwidthi using hstylei; in htexti \\ can be used as an
which defines \dirhdiri as the hcompositei (see explicit line break; all lines will be centered. hstylei
note 4d for the details). should either be a font command or some other stuff
to do for each line of the htexti and hwidthi should
be either <hdimeni> or hemptyi.
6.2 Circle segments
Circle hobjectis are round and typeset a segment of 7 XY-pic options
the circle centered at the reference point. The syntax
of circles is described in figure 6 with explanations Note: LATEX 2ε users should also consult the para-
below. graph on “xy.sty” in §1.1.

18
Syntax Action
\cir hradiusi { hciri } hciricle segment with hradiusi
hradiusi −→ hemptyi use Rc as the radius
| hvectori use X of the hvectori as radius
hciri −→ hemptyi full circle of hradiusi
| hdiagi horienti hdiagi partial circle from first hdiagional through to the second
hdiagional in the horientiation
horienti −→ ^ anticlockwise
| _ clockwise

Figure 6: hciricles.

7.1 Loading (collectively called ‘requests’)::


XY-pic is provided with a growing number of options
\xyeverywithoption { hoptioni } { hcodei }
supporting specialised drawing tasks as well as exotic
\xyeveryrequest { hoptioni } { hcodei }
output devices with special graphic features. These
should all be loaded using this uniform interface in
This is most often used by an option to activate some
order to ensure that the XY-pic environment is prop-
hook every time it is requested itself.
erly set up while reading the option.

\xyoption { hoptioni } 7.2 Option file format


\xyrequire { hoptioni } Option files must have the following structure:

\xyoption will cause the loading of an XY-pic option %% hidentificationi


file which can have one of several names. These are %% hcopyright, etc.i
tried in sequence: xyhoptioni.tex, xyhoptioni.doc, \ifx\xyloaded\undefined \input xy \fi
xyhshorti.tex, and xyhshorti.doc, where hshorti is
hoptioni truncated to 6 (six) characters to conform \xyprovide{hoptioni}{hnamei}{hversioni}%
with the TWG-TDS [17]. {hauthori}{hemaili}{haddressi}
\xyrequire is the same except it is ignored if an hbody of the optioni
option with the same name is already present (thus \xyendinput
does not check the version etc.).
Sometimes some declarations of an option or The 6 arguments to \xyprovide should contain the
header file or whatever only makes sense after some following:
particular other option is loaded. In that case the
code should be wrapped in the special command hoptioni Option load name as used in the \xyoption
command. This should be safe and distinguish-
\xywithoption { hoptioni } { hcodei } able for any operating system and is thus lim-
ited to characters chosen among the lowercase
letters (a–z), digits (0–9), and dash (-), and all
which indicates that if the hoptioni is already loaded
options should be uniquely identifiable by the
then hcodei should be executed now, otherwise it
first 6 (six) characters only.
should be saved and if hoptioni ever gets loaded
then hcodei should be executed afterwards. Note: hnamei Descriptive name for the option.
The hcodei should allow more than one execution;
it is saved with the catcodes at the time of the hversioni Identification of the version of the option.
\xywithoption command.
Finally, it is possible to declare hcodei as hauthori The name(s) of the author(s).
some commands to be executed before every ac- hemaili The electronic mail address(es) of the au-
tual execution of \xywithoption{hoptioni}{. . . }, thor(s) or the affiliation if no email is available.
and similarly hcodei to be executed before ev-
ery \xyoption{hoptioni} and \xyrequire{hoptioni} haddressi The postal address(es) of the author(s).

19
This information is used not only to print a nice ban- As the above suggests it sometimes makes sense
ner but also to (1) silently skip loading if the same to load hdriveris in the actual textual part of a doc-
version was preloaded and (2) print an error message ument, however, it is recommended that only drivers
if a different version was preloaded. also loaded in the preamble are reloaded later, and
The ‘dummy’ option described in §22 is a minimal that \xyReloadDrivers is used when there is doubt
option using the above features. It uses the special about the state of affairs. In case of confusion
DOCMODE format to include its own documentation for the special command \xyShowDrivers will list all
this document (like all official XY-pic options) but this the presently supported and selected driver-extension
is not a requirement. pairs to the TEX log.
It is not difficult to add support for additional
hdriveris; how is described in the TEXnical documen-
7.3 Driver options tation.
Most extensions will print a warning when a capa-
The hdriveri options described in part IV require spe-
bility is used which is not supported by the presently
cial attention because each driver can support several
loaded hdriveri. Such messages are only printed once,
extension options, and it is sometimes desirable to
however, (for some formats they are repeated at the
change hdriveri or even mix the support provided by
end). Similarly, when the support of an extension
several.7
that exploits a particular hdriveri is used a warn-
A hdriveri option is loaded as other options with
ing message will be issued that the DVI file is not
\xyoption{hdriveri} (or through LATEX 2ε class or
portable.
package options as described in §1.1). The special
thing about a hdriveri is that loading it simply de-
clares the name of it, establishes what extensions it
will support, and selects it temporarily. Thus the Part II
special capabilities of the driver will only be exploited
in the produced DVI file if some of these extensions Extensions
are also loaded and if the driver is still selected when
output is produced. Generally, the order in which the This part documents the graphic capabilities added
options are loaded is immaterial. (Known exceptions by each standard extension option. For each is indi-
affect only internal processing and are not visible to cated the described version number, the author, and
the user in terms of language and expected output.) how it is loaded.
In particular one driver can be preloaded in a format Many of these are only fully supported when a
and a different one used for a particular document. suitable driver option (described in part IV) is also
The following declarations control this: loaded, however, all added constructions are always
accepted even when not supported.
\UseSingleDriver forces one driver only
\MultipleDrivers allows multiple drivers
\xyReloadDrivers resets driver information
8 Curve and Spline extension
Vers. 3.7 by Ross Moore hross@mpce.mq.edu.aui
The first command restores the default behaviour: Load as: \xyoption{curve}
that ony one hdriveri is allowed, i.e., each loading
This option provides XY-pic with the ability to type-
of a hdriveri option cancels the previous. The sec-
set spline curves by constructing curved connections
ond allows consecutive loading of drivers such that
using arbitrary directional objects and by encircling
when loading a hdriveri only the extensions actually
objects similarly. Warning: Using curves can be
supported are selected, leaving other extensions sup-
quite a strain on TEX’s memory; you should there-
ported by previously selected drivers untouched. Be-
fore limit the length and number of curves used on a
ware that this can be used to create DVI files that
single page. Memory use is less when combined with
cannot be processed by any actual DVI driver pro-
a backend capable of producing its own curves; e.g.,
gram!
the PostScript backend).
The last command is sometimes required to reset
the XY-pic hdriveri information to a sane state, for
example, after having applied one of the other two 8.1 Curved connections
in the middle of a document, or when using simple Simple ways to specify curves in XY-pic are as follows:
formats like plain TEX that do not have a clearly dis-
tinguished preamble. **\crv{hposlisti} curved connection
7 The kernel support described here is based on the (now defunct) xydriver include file by Ross Moore.

20
**\crvs{hdiri} get hposlisti from the stack
\curve{hposlisti} as a hdecoriation
Q NN
Ao NNN
NNN
in which hposlisti is a list of valid hposiitions. The ⊗ NN
NNN
decoration form \curve is just an abbreviation for NNN
\connect\crv. As usual, the current p and c are N
P
used as the start and finish of the connection, respec-
tively. Within hposlisti the hposiitions are separated BN
by &. A full description of the syntax for \crv is given
in figure 7. x 0
⊕ x

2 Exercise 17: Suggest code to produce something


like the above picture; the spline curve is the same as
in the previous picture. Hints: The line is 140pt long
1 and touches 0.28 of the way from A to B and the x
A TTTTT
TTTT is 0.65 of the way from A to B.
TTTT
TTTT The positions in hposlisti specify control points
TTTT
0 TTTT which determine the initial and final directions of
TTTT
TTTT the curve—leaving p and arriving at c—and how the
T curve behaves in between, using standard spline con-
B
4 structions. In general, control points need not lie
upon the actual curve.
A natural spline parameter varies in the interval
[0, 1] monotonically along the curve from p to c. This
If hposlisti is empty a straight connection is com- is used to specify hplaceis along the curve, however
puted. When the length of hposlisti is one or two then there is no easy relation to arc-length. Generally the
the curve is uniquely determined as a single-segment parameter varies more rapidly where the curvature is
Bézier quadratic or cubic spline. The tangents at p greatest. The following diagram illustrates this effect
and c are along the lines connecting with the adjacent for a cubic spline of two segments (3 control points).
control point. With three or more hposiitions a cubic
.5

y^^^r_^_^_^__^_^* ^^ .7
B-spline construction is used. Bézier cubic segments .3
.4 .6

are calculated from the given control points. .2 \


 \\\\\\\\\\\
The previous picture was typeset using: \\ .8
.1 Y
YYYYYY
\xy (0,20)*+{A};(60,0)*+{B} YYYYYY
YYYY .9
**\crv{}
(<)
**\crv{(30,30)} A TTTTT
TTTT
**\crv{(20,40)&(40,40)} TTTT
**\crv{(10,20)&(30,20)&(50,-20)&(60,-10)} TTT (>)
B
\endxy
except for the labels, which denote the number of en-
tries in the hposlisti. (Extending this code to include Exercise 18: Write code to produce a picture such
the labels is set below as an exercise). as the one above. (Hint: Save the locations of places
The ?-operator of §3 (note 3h) is used to find ar- along the curve for later use with straight connec-
bitrary hplaceis along a curve in the usual way. tions.)
To have the same hposi occuring as a multiple
control point simply use a delimiter, which leaves the
Exercise 16: Extend the code given for the curves hposi unchanged. Thus \curve{hposi&} uses a cubic
in the previous picture so as to add the labels giving spline, whereas \curve{hposi} is quadratic.
the number of control points. Repeating the same control point three times in
Using ? will set the current direction to be tan- succession results in straight segments to that con-
gential at that hplacei, and one can hslidei specified trol point. Using the default styles this is an expen-
distances along the curve from a found hplacei using sive way to get straight lines, but it allows for extra
the ?. . . /hdimeni/ notation: effects with other styles.

21
Syntax Action
\curvehmodifieri{hcurve-objectihposlisti} construct curved connection
hmodifieri −→ hemptyi zero or more modifiers possible; default is ~C
| ~hcurve-optioni hmodifieri set hcurve-optioni
hcurve-optioni −→ p | P | l | L | c | C show only8d control points (p=points), joined by lines
(l=lines), or curve only (c=curve)
| pc | pC | Pc | PC show control points8f and curve8e
| lc | lC | Lc | LC show lines joining8g control points and curve8e
| cC plot curve twice, with and without specified formatting
hcurve-objecti −→ hemptyi use the appropriate default style
| ~*hobjecti hcurve-objecti specify the “drop” object8a and maybe more8c
| ~**hobjecti hcurve-objecti specify “connect” object8b and maybe more8c
hposlisti −→ hemptyi | hposi hdelimi hposlisti list of positions for control points
| ~@ | ~@ hdelimi hposlisti add the current stack8h to the control points
hdelimi −→ & allowable delimiter

Figure 7: Syntax for curves.

Notes a saving of time and memory; this is the default


behaviour.
8a. The “drop” object is set once, then “dropped”
many times at appropriately spaced places along
the curve. If directional, the direction from p to 8c. The “drop” and “connect” objects can be spec-
c is used. Default behaviour is to have tiny dots ified as many times as desired. Only the last
spaced sufficiently closely as to give the appear- specification of each type will actually have any
ance of a smooth curve. Specifying a larger size effect. (This makes it easy to experiment with
for the “drop” object is a way of getting a dotted different styles.)
curve (see the example in the next note).
8d. Complicated diagrams having several spline
8b. The “connect” object is also dropped at each curves can take quite a long time to process and
place along the curve. However, if non-empty, may use a lot of TEX’s memory. A convenient
this object uses the tangent direction at each device, especially while developing a picture, is
place. This allows a directional object to be spec- to show only the location of the control points or
ified, whose orientation will always match the to join the control points with lines, as a stylized
tangent. To adjust the spacing of such objects, approximation to the spline curve. The hcurve-
use an empty “drop” object of non-zero size as optionis ~p and ~l are provided for this purpose.
shown here: Uppercase versions ~P and ~L do the same thing
. . . . . . . .... but use any hcurve-objectis that may be speci-
. . . ...... .. . . . ..
.. . ..
..
fied, whereas the lowercase versions use plain de-
A faults: small cross for ~p, straight line for ~l.
..
 .. Similarly ~C and ~c set the spline curve using any
 .
specified hcurve-optionis or as a (default) plain
$ '
) 3 4 B
+ - . / 0 1 2 curve.

\xy (0,0)*+{A}; (50,-10)*+{B} 8e. Use of ~p, ~l, etc. is extended to enable both the
**\crv{~*=<4pt>{.} (10,10)&(20,0)&(40,15)} curve and the control points to be easily shown in
**\crv{~*=<8pt>{}~**!/-5pt/\dir{>}(10,-20) the same picture. Mixing upper- and lower-case
&(40,-15)} \endxy specifies whether the hcurve-optionis are to be
applied to the spline curve or the (lines joining)
When there is no “connect” object then the tan- control points. See the examples accompanying
gent calculations are not carried out, resulting in the next two notes.

22
8f. By default the control points are marked with a ,"A"+<4pc,-1pc>*+{D}="D",{\ar@/_/"C"}
small cross, specified by *\dir{x}. The “con- ,?!{"A";"B"**@{-}}*++{\oplus}
nect” object is ignored completely. \endxy \quad \xy
*+{A}="A";p+/r5pc/+(0,15)*+{B}="B",
u5 u5 ,p+<1pc,3pc>*+{C}="C"
................
.... .. ,"A"+<4pc,-1pc>*+{D}="D","A";"B"**@{-}
..... ...
... ... ,?!{"D",{\ar@/_/"C"}}*++{\oplus}
... ...
.. ... \endxy
A .. ..
.... . ..... ..
..
.. When the line separates the end-points of a curve
u5 B an intersection can always be found. If there is more
than one then that occurring earliest along the curve
was typeset by . . . is the one found.
\xy (0,0)*+{A};(50,-10)*+{B} If the line does not separate the end-points then
**\crv~pC{~*=<\jot>{.}(10,-10)&(20,15) there may be no intersection with the curve. If there
&(40,15)} \endxy is one then either the line is tangential or necessarily
there will also be at least one other intersection. A
8g. With lines connecting control points the default message
“drop” object is empty, while the “connect” ob- perhaps no curve intersection, or many.
ject is \dir{-} for simple straight lines. If non-
empty, the “drop” object is placed at each con- is written to the log-file, but a search for an inter-
trol point. The “connect” object may be used to section will still be performed and a “sensible” place
specify a fancy line style. found on the curve. In the usual case of a single
quadratic or cubic segment, the place nearest the line
T is found and the tangent direction is established.
⊕ T T T
 ⊕2 The following examples show this, and show how
 2 to get the place on the line nearest to the curve.

 2
 2
 2
A 2 BN BR
2
2
B
jj D
A K &
& ff D
A
jjjjjjj
was typeset by . . .
ff⊗f&ffff jj⊗jj
fffff && jjjj
\xy (0,0)*+{A};(50,-10)*+{B} C C
**\crv~Lc{~**\dir{--}~*{\oplus}
(20,20)&(35,15)} \endxy \xy *+{A}="A";p+/r5pc/+(0,15)*+{B}="B",
,p-<.5pc,2pc>*+{C}="C","A"+<6pc,-.5pc>
8h. When a stack of hposiitions has been established ,*+{D}="D","A",{\ar@/_25pt/"B"}
using the @i and @+ commands, these positions ,?!{"C";"D"**@{-}}*\dir{x}="E"
can be used and are appended to the hposlisti. ,+/_2pc/="F";"E"**@{-},?!{"C";"D"}
,*{\otimes}\endxy\qquad\xy
*+{A}="A";p+/r5pc/+(0,15)*+{B}="B",
Intersection with a curved connection Just as
,p-<.5pc,2pc>*+{C}="C"
the intersection of two lines (3j) can be found, so can
,"A"+<7pc,.5pc>*+{D}="D","A"
the intersection of a straight line with a curved con-
,{\ar@/_40pt/"B"},?!{"C";"D"**@{-}}
nection, or the intersection of a curve with a straight
,*{\otimes}\endxy
connection.
Sometimes TEX will run short of memory when many
B B curves are used without a backend with special sup-
Cc vvv Cc vvv
v v port for curves. In that case the following commands,
vv vv
vvv⊕ vvv⊕ that obey normal TEX groupings, may be helpful:
v v
vv vv
A A \SloppyCurves
D D \splinetolerance{hdimeni}

\xy*+{A}="A";p+/r5pc/+(0,15)*+{B}="B" allow adjustment of the tolerance used to typeset


,p+<1pc,3pc>*+{C}="C" curves. The first sets tolerance to .8pt, after which

23
\splinetolerance{0pt} resets to the original de- straight segments, half the length to the correspond-
fault of fine curves. ing adjacent control-point. Furthermore the mid-
point between successive control-points lies on the
spline, with the line joining the control-points being
8.2 Circles and Ellipses
tangent there.
Here we describe the means to a specify circles of arbi- Such curves are specified, either as a hdecori or as
trary radius, drawn with arbitrary line styles. When an hobjecti, using. . .
large-sized objects are used they are regularly spaced
around the circle. Similarly ellipses may be speci- \qspline{hstylei}
fied, but only those having major/minor axes aligned
in the standard directions; spacing of objects is no where the start and end of the curve are at p and
longer regular, but is bunched toward the narrower c respectively. The control-points are taken from the
ends. current stack, see 3o. If this stack is empty then a
Such a circle or ellipse is specified using. . . straight line is constructed.
The following example compares the quadratic
\xycirclehvectori{hstylei} spline with the gentler curving B-spline having the
same control points, using \crvs.
where the components of the hvectori determine the
lengths of the axis for the ellipse; thus giving a cir- + + ___C
cle when equal. The hstylei can be any hconni, as


in 14 that works with curved arrows—many do. Al-
ternatively hstylei can be any hobjecti, which will be P +
placed equally-spaced about the circle at a separa-
tion to snugly fit the hobjectis. If hemptyi then a
solid circle or ellipse is drawn. \xy /r1.5pc/:,+<5pc,3pc>*+{P};p
o l @(,+(2,2)*{+}@+, +(2,-2)*{+}@+
v r h
z d ,+(2,2)*{+}@+, +(2,0)*+{C}="C"
....... ^ ,*\qspline{},"C",**\crvs{.}
. .
 .. •? .. Y
?
6 ....3 ....2 ?..??0 / . , + ( U
,@i @)\endxy
@ 9 ?? % R
I ?? 
Q Z •
 N
b g c |
j k m u w K 9 Frame and Bracket extension
 n p q s G
 C
! = Vers. 3.7 by Kristoffer H. Rose hkrisrose@brics.dki
& * 4 8 Load as: \xyoption{frame}
- 1
\xy 0;/r5pc/:*\dir{*} The frame extension provides a variety of ways to
;p+(.5,-.5)*\dir{*}="c" puts frames in XY-pictures.
,**\dir{-},*+!UL{c},"c" The frames are XY-pic hobjectis on the form
,*\xycircle(1,.4){++\dir{<}}
,*\xycircle(1,1){++\dir{>}} \frm{ hframei }
,*\xycircle<15pt,10pt>{}
;*\xycircle<10pt>{{.}} to be used in hposiitions: Dropping a frame with
\endxy *. . . \frm{hframei} will frame the c object; connect-
ing with **. . . \frm{. . . hframei} will frame the result
of c.p.
8.3 Quadratic Splines Below we distinguish between ‘ordinary’ frames,
Quadratic Bézier splines, as distinct from cubic ‘brackets’ and ‘fills’; last we present how some frames
Bézier splines, are constructed from parabolic arcs, can be added to other objects using object modifier
using ‘control points’ to determine the tangents where hshapeis.
successive arcs are joined.
Various implementations of such curves exist. 9.1 Frames
The one adopted here is consistent with the xfig
drawing utility and tpic implementations. These Figure 8 shows the possible frames and the applicable
have the property of beginning and ending with hmodifieris with reference to the notes below.

24
Framed with Framed with Framed with
\frm{} \frm{.} \frm<44pt>{.}
frame9a frame9b frame9b

?>Framed with=<
_^ ]\
XY Z[

Framed with Framed with

89 frame9b :;





 \frm{-} \frm<8pt>{-} \frm<44pt>{-}
frame9b frame9b


?>
/.Framed with-,=<

_^ ]\

_^ ]\

XY
XY Z[
Z[



Framed with Framed with

89
() frame9b *+ :;





 \frm{=} \frm<8pt>{=} \frm<44pt>{=}
frame9b frame9b

 _ _ _ _ 



_ _ _ _ _ _  v __ _ _ _ _ T 6



 Framed with 

 Framed with  Framed with
 \frm<44pt>{--}  

 _frame
_ _ _ 

 \frm{--} 

 \frm{o-} 


6 

 frame9b  9b 9b

_ _ _ _ _ _ T _ frame
_ _ _ __ v




These are 


 Framed with Framed with Framed with

overlayed 
with the 

 \frm{,} \frm<5pt>{,} \frm{-,}
frame9c frame9c

frame9c

\frm{.}  
frame above

pqrs
wvut ?>=<
89:;
to show the  Framed with

 Framed with Framed with
way they are  \frm<8pt>{o}
 \frm{o} \frm{.o}


centered on  9d frame9d 9d
 frame j _W J
frame


the object  x 8

pqrs
wvut ?>=<
89:;
'&%$
!"#
*



Framed with Framed with Framed with






\frm{oo} \frm<8pt>{oo} \frm{-o}
*




frame9d frame9d 8 frame
9d



JW x


_ j

hijk
onml PQRS
WVUT






 Framed with Framed with Framed with


 \frm{e} \frm<20pt,8pt>{e} \frm{.e}
frame9e frame9e frame9e



n _T B




hijk
onml
`abc
gfed PQRS
WVUT
HIJK
ONML

.


Framed with Framed with Framed with






\frm{ee} \frm<20pt,8pt>{ee}
.\frm{-e}




frame9e frame9e 9e
Bframe 


T_ n

Figure 8: Plain hframeis.

z }| {  
Framed with Framed with Framed with
 Framed with

\frm{_\}} \frm{^\}} \frm{\{} \frm{\}}
9f frame9f frame9f frame9f
 
| frame
 
{z }
z {  
Framed with Framed with 

Framed with Framed with


\frm{_)} \frm{^)} 

 \frm{(} \frm{)} 

9g frame9g frame9g frame9g
 
| frame
 
}

Figure 9: Bracket hframeis.

25
Notes 9.2 Brackets
9a. The \frm{} frame is a dummy useful for not The possible brackets are shown in figure 9 with notes
putting a frame on something, e.g., in macros below.
that take a hframei argument.
9b. Rectangular frames include \frm{.}, \frm{-},
Notes
\frm{=}, \frm{--}, \frm{==}, and \frm{o-}.
They all make rectangular frames that essentially 9f. Braces are just the standard plain TEX large
trace the border of a rectangle-shaped object. braces inserted correctly in XY-pic pictures with
The hframeis \frm{-} and \frm{=} allow an op- the ‘nib’ aligned with the reference point of the
tional corner radius that rounds the corners of object they brace.
the frame with quarter circles of the specified ra-
dius. This is not allowed for the other frames—
the \frm{o-} frame always gives rounded cor-
Exercise 21: How do you think the author
ners of the same size as the used dashes (when
typeset the following?
\xydashfont is the default one then these are
5pt in radius). z }| {
B
Exercise 19: How do you think the author A
typeset the following?
7654
0123
| {z }

/.-,
()*+
B
A 9g. Parenthesis are like braces except they have no
nib and thus do not depend on where the refer-
ence point of c is.
9c. The frame \frm{,} puts a shade, built from
rules, into the picture beneath the (assumed rect- Bug: The brackets above require that the com-
angular) object, thereby giving the illusion of puter modern cmex font is loaded in TEX font posi-
‘lifting’ it; \frm<hdimeni>{,} makes this shade tion 3.
hdimeni deep.
\frm{-,} combines a \frm{-} with a \frm{,}.
9d. Circles done with \frm{o} have radius as (R +
9.3 Filled regions
L)/2 and with \frm<hdimeni>{o} have radius In addition to the above there is a special frame that
as the hdimeni; \frm{oo} makes a double cir- “fills” the inside of the current object with ink: \frm
cle with the outermost circle being the same as {*} and \frm {**}; the latter is intended for em-
that of \frm{o}. phasizing and thus “strokes” the outline, using the
thinnest black line available on the printer or out-
Exercise 20: What is the difference between put device; furthermore it moits the actual filling
*\cir{} and *\frm{o}? in case this would obscure further text typeset on
top. Some alteration to the shape is possible, using
9e. Ellipses specified using \frm{e} have axis lengths *\frm<dimen>{*}. Hence rectangular, oval, circular
(R + L)/2 and (U + D)/2, while those with and elliptical shapes can be specified for filling. The
\frm<hdimen,dimeni>{e} use the given lengths following examples illustrate this in each case:
for the axes. \frm{ee} makes a double ellipse
with outermost ellipse being the same as that of
hobjecti \frm{*} \frm{**} \frm<6pt>{*}
\frm{e}.
Without special support to render the ellipses,
either via a hdriveri or using the arc feature, the
ellipse will be drawn as a circle of radius approx-
imately the average of the major and minor axes.
However, filling non-rectangular shapes will result in
To Do: Allow hframe variantis like those used a rectangle unless a driver is used that supports ar-
for directionals, i.e., \frm2{-} should be the same as bitrary filling. With some drivers the above fills will
\frm{=}. Add \frm{o,} and more brackets. thus all be identical, as rectangular.

26
9.4 Framing as object modifier Font selection is done with the command
In addition, frames may be accessed using the special \SelectTips {hfamilyi} {hsizei}
[Fhframei] object modifier hshapeis that will add the
desired hframei to the current object. The frame ap-
where the hfamilyi and hsizei should be selected from
propriate to the edge of the object will be chosen
the following table.
(presently either rectangular or elliptical).
If shape modifiers need to be applied to the Family 10 11 12
hframei alone then they can be included using : as xy −/ +3 _*4 −/ +3 _*4 −/ +3 _*4
separator. Thus [F-:red] will make a red frame cm −/ +3 _*4 −/ +3 _*4 −/ +3 _*4
(provided the color extension is active, of course). eu −/ %9 _%9 −/ %9 _%9 −/ %9 _%9
Additionally the variant of frames using <hdimeni>
can be accessed by specifying [. . . :<hdimeni>]. Once a selection is made, the following commands
Here are some simple examples using this feature. are available:

\UseTips activate selected tips


text with background
\NoTips deactivate
bold white on black
They are local and thus can be switched on and/or off
for individual pictures using the TEX grouping mech-
\xy *+<1.5pt>[F**:white]++[F**:red] anism, e.g.,
\txt{text with background}
,+!D+/d1pc/,*++[F**:black][white] \SelectTips{cm}{10}
\txt\bf{bold white on black}\endxy \xy*{} \ar
@{*{\UseTips\dir_{<<}}-*{\NoTips\dir{>}}}
Notice that when multiple frame-modifiers are (20,5)*{} \endxy
used, the frames are actually placed in reverse or-
will typeset
der, so that earlier ones are printed on top of later gg3
ggggggggg
ones. gss
To Do: The frame option is not quite com-
plete yet: some new frames and several new brackets regardless of which tips are used otherwise in the doc-
should be added. ument.

9.5 Using curves for frames


If the curve option is loaded, then circular and ellipti-
11 Line styles extension
cal frames of arbitrary radius can be constructed, by Vers. 3.6 by Ross Moore hross@mpce.mq.edu.aui
specifying \UseCurvedFrames. This can be negated Load as: \xyoption{line}
by \UseFontFrames. Both of these commands obey
normal TEX grouping. Furthermore, dotted and This extension provides the ability to request vari-
dashed frames now have a regular spacing of their ous effects related to the appearance of straight lines;
constituent objects. The usual warnings about mem- e.g.. thickness, non-standard dashing, and colour.
ory requirements for large numbers of curves apply These are effects which are not normally avail-
here also. able within TEX. Instead they require a suitable
‘back-end’ option to provide the necessary \special
commands, or extra fonts, together with appropriate
10 More Tips extension commands to implement the effects. Thus

Vers. 3.3 by Kristoffer H. Rose hkris@diku.dki Using this extension will have no
Load as: \xyoption{tips} effect on the output unless used with
a backend that explicitly supports it.
This extension provides several additional styles of
‘tips’ for use (primarily) as arrow heads, and makes The extension provides special effects that can be
it possible to define customised tips. This is used used with any XY-pic hobjecti, by defining [hshapei]
to support tips that mimic the style of the Computer modifiers. The modification is local to the hobjecti
Modern fonts8 by Knuth (see [7] and [6, appendix F]) currently being built, so will have no effect if this
and of the Euler math fonts distributed by the AMS. object is never actually used.
8 This function was earlier supported by the cmtip extension which is still included in the distribution but is now obsolete.

27
Adjusting line thickness The following table lines have appreciable thickness. Then there are sev-
lists the modifiers primarily to alter the thickness of eral standard ways to fashion the ‘joins’ (where seg-
lines used by XY-pic. They come in two types — ei- ments meet). Also the shape of the ‘caps’ at either
ther a single keyword, or using the key-character | end of the poly-line can be altered.
with the following text parsed. The following modifiers are used to determine the
shapes of the line ‘caps’ and ‘joins’:
[thicker] double line thickness [|Jhvali] join style, hvali = 0, 1 or 2
[thinner] halve line thickness [mitre] mitre-join, same as [|J0]
[|(hnumi)] multiple of usual thickness [roundjoin] round join, same as [|J1]
[|<hdimeni>] set thickness to hdimeni [bevel] bevel-join, same as [|J2]
[|hdimeni] also sets to hdimeni [|Chvali] end-cap, hvali = 0, 1 or 2
[|=hwordi] make [hwordi] set current [butt] “butt” cap, same as [|C0]
style settings [roundcap] round cap, same as [|C1]
[|*] reuse previous style
[projcap] “projecting square” cap,
[butt] butt cap at ends
same as [|C2]
[roundcap] round cap at ends [|M(hnumi)] set mitrelimit to hnumi≥ 1
[projcap] projecting square cap.
These effects are currently implemented only
Later settings of the linewidth override earlier set- with the PostScript back-end or when using
tings; multiple calls to [thicker] and [thinner] \xypolyline (described below) with a PostScript
compound, but the other variants set an absolute hdriveri. In this case the ‘cap’ setting can be applied
thickness. The line-thickness specification affects to any segment, straight or curved, whether part of
arrow-tips as well as the thickness of straight lines a poly-line or not; however the ‘join’ setting applies
and curves. Three kinds of line-caps are available; only to poly-lines. Arrow-tips are not affected. The
they are discussed below in the section on ‘poly-lines’. defaults are to use round joins and round-cap ends.
Adjusting the miter-limit affects how far miters
/
/ are allowed to protrude when two wide lines meet
/ at small angles. The hnumi is in units of the line-
P /
C thickness. Higher values mean using bevels only at
smaller angles, while the value of 1 is equivalent to
using bevels at all angles. The default miter-limit is
10.
\xy/r8pc/:*++\txt\huge{C}="c"
The path taken by the ‘poly-line’ this is read as
,0*++\txt\huge{P}="p",
the list of hposiitions in the current ‘stack’, ignoring
,"p",{\ar@*{[|(1)]}"p";"c"<20pt>}
size extents. The macro \xypolyline is used as a
,"p",{\ar@*{[|(4)]}"p";"c"<14pt>}
hdecori; it reads the hposiitions from the stack, but
,"p",{\ar@*{[|(10)]}"p";"c"<4pt>}
leaves the stack intact for later use.
,"p",{\ar@*{[|(20)]}"p";"c"<-16pt>}
The following diagram illustrates the use of line-
\endxy
thickness, line-joins and line-caps with poly-lines. It
Using the PostScript back-end, the size of the contains an example of each of the styles.
arrow-head grows aesthetically with the thickness of
the line used to draw it. This growth varies as the
square-root of the thickness; thus for very thick lines
(20+ times normal) the arrowhead begins to merge
with the stem.
The diagram in figure 10, page 31, uses different A B
line-thicknesses and colours.

Poly-lines By a ‘poly-line’ we mean a path built


from straight line segments having no gaps where \xycompileto{poly}%
each segment abuts the next. The poly-line could {/r4pc/:,*[|<5pt>][thicker]\xybox{%
be the edges of a polygon, either closed or open if the *+(3,2){}="X"
end-points are different. ;@={p+CU,p+LU,p+LD,p+RD,p+RU,p+CU}
The reason for considering a poly-line as a sep- ,{0*[miter]\xypolyline{}}
arate hobjecti, rather than simply as a hpathi built ,{\xypolyline{*}},@i@)
from straight lines, becomes apparent only when the ,"X",*+(2.5,1.5){}="X"

28
,@={!CU,!LU,!LD,!RD,!RU,!CU} commands, or extra fonts, together with appropriate
,{0*[gray][roundjoin]\xypolyline{}} commands to implement the effects. Thus
,{0*[gray]\xypolyline{*}},@i@)
,"X",*+(2,1){}="X" Using this extension will have no
,@={!CU,!LU,!LD,!RD,!RU,!CU} effect on the output unless used with
,{0*[white]\xypolyline{*}} a backend that explicitly supports it.
,{0*[bevel]\xypolyline{}},@i@) The extension provides special effects that can be
,"X"-(.7,0)*++\txt\LARGE{A}="a" used with any XY-pic hobjecti by defining [hshapei]
,"X"+(.7,0)*++\txt\LARGE{B}="b" modifiers. The modification is local to the hobjecti
,{\ar@{-}@*{[butt][thinner]}"a";"b"<1pc>} currently being built, so will have no effect if this
,{\ar@{-}@*{[roundcap][thinner]}"a";"b"} object is never actually used.
,{\ar@{-}@*{[projcap][thinner]}"a";"b"<-1pc>} The following table lists the modifiers that have
}} so far been defined. They come in two types – either a
Note the use of {0*[...]\xypolyline{..}} to apply single keyword, or a key-character with the following
style-modifiers to a polyline. The @={!..} method text treated as a single argument.
for loading the stack gives equivalent results to us-
ing ;@={p+..}, since \xypolyline ignores the edge [@] align with current direc-
extents of each hposi in the stack. tion
[@hdirectioni] align to hdirectioni
Note also that the argument #1 to \xypolyline
[@!hnumberi] rotate hnumberi degrees
affects what is typeset. Allowable arguments are:
[*hnumberi] scale by hnumberi
\xypolyline{} solid line [*hnumix ,hnumiy ] scale x and y separately
\xypolyline{.} dotted line [left] rotate anticlockwise by
\xypolyline{-} dashed line 90◦
\xypolyline{*} fill enclosed polygon [right] rotate (clockwise) by 90◦
\xypolyline{?} fill enclosed polygon using [flip] rotate by 180◦ ; same as
even-odd rule [*-1,-1]
\xypolyline{{*}} use \dir{*} for lines [dblsize] scale to double size
\xypolyline{<toks>} using \dir{<toks>} [halfsize] scale to half size

The latter cases one has **\dir{...} being used These [hshapei] modifiers specify transformations
to connect the vertices of the polyline, with {{*}} of the hobjecti currently being built. If the object
being needed to get **\dir{*}. Similarly **\dir is has a rectangle edge then the size of the rectangle is
used when a hdriveri is not available to specifically transformed to enclose the transformed object; with
support polylines; in particular the two ‘fill’ options a circle edge the radius is altered appropriately.
* and ? will result in a dotted polygon outline the Each successive transformation acts upon the re-
region intended to be filled. sult of all previous. One consequence of this is that
In all cases it is up to the user to load the stack be- the order of the shape modifiers can make a signif-
fore calling \xypolyline{. . . }. A particularly com- icant difference in appearance—in general, transfor-
mon case is the outline of an existing XY-pic hobjecti, mations do not commute. Even successive rotations
as in the example above. Future extensions to \frm can give different sized rectangles if taken in the re-
will provide a simplified mechanism whereby the user verse order.
need not call \xypolyline explicitly for such effects. Sometimes this change of size is not desirable.
The following commands are provided to modify this
behaviour.
12 Rotate and Scale extension \NoResizing prevents size adjustment
\UseResizing restores size adjustments
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Load as: \xyoption{rotate}
The \NoResizing command is also useful to have at
This extension provides the ability to request that the beginning of a document being typeset using a
any object be displayed rotated at any angle as well driver that cannot support scaling effects, in partic-
as scaled in various ways. ular when applied to whole diagrams. In any case an
These are effects which are not normally avail- unscaled version will result, but now the spacing and
able within TEX. Instead they require a suitable positioning will be appropriate to the unscaled rather
‘back-end’ option to provide the necessary \special than the scaled size.

29
Scaling and Scaled Text The hshapei modifier 13 Colour extension
can contain either a single scale factor, or a pair in-
dicating different factors in the x- and y-directions. Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Negative values are allowed, to obtain reflections in Load as: \xyoption{color}
the coordinate axes, but not zero.
This extension provides the ability to request that
any object be displayed in a particular colour.
Rotation and Rotated Text Within [@...] the It requires a suitable ‘driver’ option to provide
... are parsed as a hdirectioni locally, based on the necessary \special commands to implement the
the current direction. The value of count regis- effects. Thus
ter \Direction contains the information to deter-
mine the requested direction. When no hdirectioni is Using this extension will have no effect
parsed then [@] requests a rotation to align with the on the output unless used with a
current direction. dvi-driver that explicitly supports it.
The special sequence [@!...] is provided to pass
an angle directly to the back-end. The XY-pic size Colours are specified as a hshapei modifier which
and shape of the hobjecti with \rectangleEdge is gives the name of the colour requested. It is applied
unchanged, even though the printed form may appear to the whole of the current hobjecti whether this be
rotated. This is a feature that must be implemented text, an XY-pic line, curve or arrow-tip, or a compos-
specially by the back-end. For example, using the ite object such as a matrix or the complete picture.
PostScript back-end, [@!45] will show the object However some DVI drivers may not be able to sup-
rotated by 45◦ inside a box of the size of the unro- port the colour in all of these cases.
tated object.
To Do: Provide example of repeated, named [hcolour namei] use named colour
transformation. \newxycolor{hnamei}{hcodei} define colour
\UseCrayolaColors load colour names
Reflections Reflections can be specified by a com-
bination of rotation and a flip — either [hflip] or If the DVI-driver cannot support colour then a re-
[vflip]. quest for colour only produces a warning message in
the log file. After two such messages subsequent re-
quests are ignored completely.
Shear transformations To Do: Provide the
structure to support these; then implement it in
Named colours and colour models New colour
PostScript.
names are created with \newxycolor, taking two ar-
guments. Firstly a name for the colour is given, fol-
Example The diagram in figure 10 illustrates many lowed by the code which will ultimately be passed to
of the effects described above as well as some addi- the output device in order to specify the colour. If
tional ones defined by the color and rotate exten- the current driver cannot support colour, or grayscale
sions. shading, then the new name will be recognised, but
ignored during typesetting.
For PostScript devices, the XY-ps PostScript
Exercise 22: Suggest the code used by the author
dictionary defines operators rgb, cmyk and gray cor-
to typeset 10.
responding to the standard RGB and CMYK colour
The actual code is given in the solution to the
models and grayscale shadings. Colours and shades
exercise. Use it as a test of the capabilities of your
are described as: r g b rgb or c m y k cmyk or s
DVI-driver. The labels should fit snugly inside the
gray, where the parameters are numbers in the range
accompanying rectangles, rotated and flipped appro-
0 ≤ r, g, b, c, m, y, k, s ≤ 1. The operators link to the
priately.
built-in colour models or, in the case of cmyk for ear-
Bug: This figure also uses colours, alters line-
lier versions of PostScript, give a simple emulation
thickness and includes some PostScript drawing.
in terms of the RGB model.
The colours may print as shades of gray, with the
line from A to B being thicker than normal. The
wider band sloping downwards may have different Saving colour and styles When styles are saved
width and length according to the DVI-driver used; using [=hwordi], see , then the current colour setting
this depends on the coordinate system used by the (if any) is saved also. Subsequent use of [hwordi]
driver, when ‘raw’ PostScript code is included. recovers the colour and accompanying line-style set-
tings.

30
label 8ll♣ B
l
lll
l llll
lll 7
label
llll6l
l
label
lll
lllll
l
lll× 5
label
ll lll
ll 4
llabel
lllll special
label 3
label 1 label
l× l
.l 2 effect: aligned text
l ll
l
lll
♥lll
A

Figure 10: Rotations, scalings and flips

Further colour names are defined by the command or the complete picture. However some DVI-drivers
\UseCrayolaColours that loads the crayon option, may not support use of patterns in all cases.
in which more colours are defined. Consult the file If the current DVI-driver cannot support patterns
xyps-col.doc for the colours and their specifications then a request for one simply produces a warning
in the RGB or CMYK models. message in the log file. After two such messages sub-
sequent requests are ignored completely.
xycrayon.tex: This option provides the com-
mand to install definitions for the 68 colours recog- [hnamei] use named pattern
nised by name by Tomas Rokicki’s dvips driver [11]. \newxypattern{hnamei}{hdatai}
This command must be called from a hdriveri-file specify new pattern using hdatai
which can actually support the colours.
\UsePatternFile{hfilei}
sets default file for patterns
\LoadAllPatterns{hfilei}
14 Pattern and Tile extension load all patterns in hfilei
Vers. 3.4 by Ross Moore hross@mpce.mq.edu.aui \LoadPattern{hnamei}{hfilei}
Load as: \xyoption{tile} load named pattern from hfilei
\AliasPattern{haliasi}{hnamei}{hfilei}
This extension provides the ability to request that a
let haliasi denote pattern from hfilei.
filled region be tiled using a particular pattern.
This is an effect not normally available within
Although pattern data may be specified directly us-
TEX. Instead it requires a suitable hdriveri option to
ing \newxypattern, it is more usual to load it from
provide the necessary \special commands, together
a hfilei in which many patterns are defined by name,
with any extra commands needed to implement the
each on a separate line. By convention such files al-
effects. Thus
ways end in .xyp (XY-pattern) so no extension should
Using this extension will have no effect be specified. The pattern is then requested using ei-
on the output unless used with a ther the name supplied in the file or by an alias. Once
dvi-driver that explicitly supports it. \UsePatternFile has been used, then a null hfilei ar-
gument to the other commands will still find patterns
All effects defined in the tile extension can be im- in the default file. The default remains in effect for
plemented using most PostScript hdriveris, loaded the current level of TEX grouping.
as \xyoption{hdriveri}. For example, the following picture

Patterns Patterns are specified as a hshapei modi-


fier, similar to the way colours are specified by name.
The pattern is applied to the whole of the current
hobjecti whether this be text, an XY-pic line, curve
or arrow-tip, or a composite object such as a matrix uses ‘filled’ frames from the frame feature:

31
mac01 mac02 mac03 mac04 mac05 mac06 mac07 mac08

mac09 mac10 mac11 mac12 mac13 mac14 mac15 mac16

mac17 mac18 mac19 mac20 mac21 mac22 mac23 mac24

mac25 mac26 mac27 mac28 mac29 mac30 mac31 mac32

mac33 mac34 mac35 mac36 mac37 mac38

Figure 11: The 38 standard Macintosh patterns.

\AliasPattern{bricks}{mac12}{xymacpat} pattern and even to expand or contract the sizes of


\AliasPattern{bars}{mac08}{xymacpat} the basic cell.
\xy *+<5pc,3.1pc>{},{*[bricks]\frm{**}}
,*+<2.5pc>[o]{},*[bars]\frm{**} Due to the raster nature of output devices, not
\endxy all such requests can be guaranteed to produce aes-
thetic results on all devices. In practice only rota-
tions through specific angles (e.g 30◦ , 45◦ , 60◦ ) and
Pattern data A region is tiled using copies of a particular scaling ratios can be reliably used. Thus
single ‘cell’ regularly placed so as to seamlessly tile there is no sophisticated interface provided by XY-pic
the entire region. The hdatai appearing as an argu- to access these features. However the ‘PostScript
ment to \newxypattern is ultimately passed to the escape’ mechanism does allow a form of access, when
dvi-driver. a PostScript hdriveri is handling pattern requests.
The simplest form of pattern data is: hnumi hHex-
datai, where the data is a 16-character string of Special PostScript operators pa and pf set
Hexadecimal digits; i.e. 0–9, A–F . Each Hex-digit the pattern angle (normally 0) and ‘frequency’ mea-
equates to 4 binary bits, so this data contains 64 bits sured in cells per inch. Hence, when used as an
representing pixels in an 8 × 8 array. The hnumi is hobjecti-modifier, [! 30 pa 18.75 pq] rotates the
an integer counting the number of ‘0’s among the 64 pattern by 30◦ clockwise and uses a smaller pat-
bits. Taken as a fraction of 64, this number or its tern cell (larger frequency). The default frequency
complement, represents the average density of ‘on’ of 12.5 = 300/(8 × 3) means that each pixel in a pat-
pixels within a single cell of the pattern. Drivers un- tern cell corresponds, on a device of resolution 300dpi,
able to provide the fine detail of a pattern may simply to a 3 × 3 square of device pixels; on such a device
use this number, or its complement, as a gray-level 18.75 uses 2 × 2 squares.
or part of a colour specification for the whole region
to be tiled. At 300dpi a frequency of 9.375 = 300/(8 × 4)
uses 4 × 4 squares. These match the natural size
The file xymacpat.xyp contains defining data for the for pixels on a 75dpi screen and are pretty close for
38 standard patterns available with the Macintosh 72dpi screens. Though appropriate for screen dis-
Operating system. Figure 11 displays all these pat- plays, these are ‘too chunky’ for high quality printed
terns. work. Doubling the frequency is too fine for some
patterns, hence the intermediate choice of 12.5 as de-
Rotating and Resizing Patterns Some imple- fault. In order for printed output to match the screen
mentations of patterns are sufficiently versatile to al- view, a PostScript operator macfreq has been de-
low extra parameters to affect the way the pattern fined to facilitate requests for 9.375, via [!macfreq].
data is interpreted. PostScript is one such imple-
mentation in which it is possible to rotate the whole The next diagram displays changes to the fre-

32
quency. \xyimport(width,height)(x-off,y-off){hgraphici}

filled filled filled filled


pattern pattern pattern pattern Normally the hgraphicsi will be a box containing a
9.375 12.5 18.75 37.5 graphic imported using the commands from packages
such as graphics, epsf or epsfig, or using other
filled filled filled filled commands provided by the local TEX implementa-
pattern pattern pattern pattern
tion. However the hgraphici could be any balanced
9.375 12.5 18.75 37.5 TEX material whatsoever; provided it occupies non-
zero size, both vertically and horizontally.
Saving patterns: When styles are saved using The width and height are hnumberis given in the
hwordi], see note 4k of §4, then the current pattern coordinate system for the contents of the hgraphicsi.
(if any) is also saved. Subsequent use of [hwordi] These are not dimensions, but coordinate-lengths, us-
recovers the pattern as well as colour and line-style ing the units appropriate to the picture displayed by
settings. This includes any explicit variations applied hgraphici.
using the “Style Escape” mechanism. When provided, (x-off,y-off) give the distance
Here is a variation of an earlier example, with ex- in coordinate units from bottom-left corner to where
tra effects. the origin of coordinates should be located, usually
within area covered by the hgraphici. Usually the
PQRS
WVUT Kilroy negatives of these numbers will give the coordinate
location of the bottom-left corner of the hgraphici. If
was here no offsets are supplied then the origin is presumed to
lie at the bottom-left corner.
\UsePatternFile{xymacpat} Normally the \xyimport command is used at the
\AliasPattern{bricks}{mac12}{} beginning of an \xy..\endxy environment. It is not
\LoadPattern{mac28}{}\LoadPattern{mac05}{} necessary to give any basis setup, for this is deduced
\xy *=0[! macfreq -45 pa][mac28][|=Bars]{} by measuring the dimensions of the hgraphici and
,*+<12pc,4pc>{}*[bricks]\frm{**} using the supplied width, height and offsets. The
,-<3.5pc,0pt>,*+<2.65pc>[o]{},*[Bars]\frm{**} hgraphici itself defines named hposi called "import",
,*[thicker]\frm{o},+<6pc,0pt> located at the origin and having appropriate extents
,*+<5pc, 2.7pc>{},*[mac05]\frm{**},*\frm{-,} to describe the area covered by the hgraphici. This
,*[white]\txt\Large\bf\sf{Kilroy\\was here} makes it particularly easy to surround the hgraphici
\endxy with a frame, as on the left side of figure 12, or to
draw axes passing through the origin.
Here is the code used to apply the labelling in
figure 12:
15 Import graphics extension \def\ellipA{\resizebox{6cm}{!}{%
\includegraphics{import1.eps}}}
Vers. 3.6 by Ross Moore hross@mpce.mq.edu.aui
\xy
Load as: \xyoption{import}
\xyimport(3.7,3.7)(1.4,1.4){\ellipA}*\frm{-}
This feature provides the ability to easy add labels ,!D+<2pc,-1pc>*+!U\txt{%
and annotations to graphics prepared outside TEX or framed contents of graphics file}\endxy
LATEX. An XY-pic graphics environment is established \qquad\qquad
whose coordinates match that within the contents of \xy\xyimport(3.7,3.7)(1.4,1.4){\ellipA}
the imported graphic, making it easy to specify ex- ,!D+<2pc,-1pc>*+!U\txt{Rational points
actly where a label should be placed, or arrow drawn on the elliptic curve: $x^3+y^3=7$}
to highlight a particular feature. ,(1,0)*+!U{1},(-1,0)*+!U{-1}
A command \xyimport is defined which is used, ,(0,1)*+!R{1},(0,-1)*+!R{-1}
in conjunction with imported graphics, to establish ,(2,-1)*+!RU{P},(-1,2)*+!RU{-P}
a coordinate system appropriate to the particular ,(1.3333,1.6667)*+!UR{-2P}
graphics. This enables hposiitions within the graphic ,(1.6667,1.3333)*!DL{\;2P}
to be easily located, either for labelling or adding ex- ,(-.5,1.9)*++!DL{3P},(1.9,-.5)*!DL{\;-3P}
tra embellishing features. It is used in either of the ,(-1,2.3)*+++!D{\infty}*=0{},{\ar+(-.2,.2)}
follow ways: ,(.5,2.3)*+++!D{\infty}*=0{},{\ar+(-.2,.2)}
,(2.3,-1)*+++!L{\infty}*=0{},{\ar+(.2,-.2)}
\xyimport(width,height){hgraphici} \endxy

33
_??∞ _??∞
? ?
3P
−P
import1.eps import1.eps −2P
2P
1

−1 1
−3P

−1 ?? ∞
P ?

framed contents of graphics file Rational points on the elliptic curve: x3 + y 3 = 7

Figure 12: importing a graphic for labelling

This example uses the LATEX 2ε standard 17 PostScript backend


graphics package to import the graphics file
import1.eps; other packages could have been used Vers. 3.7 by Ross Moore hross@mpce.mq.edu.aui
instead. e.g. epsfig, epsf, or the \picture Load as: \xyoption{ps}
or \illustration commands in Textures on the
Macintosh. XY-ps is a ‘back-end’ which provides XY-pic with the
The only possible problems that can occur are ability to produce DVI files that use PostScript
when the graphics package is loaded after XY-pic has \specials for drawing rather than the XY-pic fonts.
been loaded. Generally it is advisable to have XY-pic In particular this makes it possible to print XY-pic
loading after all other macro packages. DVI files on systems which do not have the ability
to load the special fonts. The penalty is that the
generated DVI files will only function with one par-
ticular DVI driver program. Hence whenever XY-ps is
16 Movie Storyboard extension activated it will warn the user:

Vers. 3.5 by Kristoffer H. Rose hkrisrose@brics.dki XY-pic Warning: The produced DVI file
Load as: \xyoption{movie} is not portable: It contains PostScript
\specials for hone particulari driver
This extension interprets the \scene primitive of the
movie class, setting the progress indicators to dummy A more complete discussion of the pros and cons of
values. The following assumes that your are familiar using this backend is included below.
with the movie class.
The size of the frame is determined by the com-
mand 17.1 Choosing the DVI-driver
\MovieSetup{width=width,height=height,. . . } Including \xyoption{ps} within the document
preamble, tells XY-pic that the PostScript alterna-
(the . . . indicate the other arguments required by the tive to the fonts should be used, provided the means
movie class but silently ignored by the XY-pic movie to do this is also specified. This is done by also speci-
extension). fying a dvi-driver which is capable of recognising and
Note: This extension still experimental and sub- interpreting \special commands. Although the file
ject to change. The only documentation is in the xyps.tex is read when the option request is encoun-
movie.cls source file. tered, the macros contained therein will have no effect
until an appropriate driver has also been loaded.

34
With LATEX 2ε both the backend and driver may turned off and on again at will, using the user follow-
be specified, along with other options, via a single ing commands:
\usepackage command, see [4, page 317]; e.g.
\NoPSspecials cancels PostScript
\UsePSspecials {} restores PostScript
\usepackage[ps,textures,color,arrow]{xy}
These obey normal TEX scoping rules for environ-
The rebindings necessary to support PostScript are ments; hence it is sufficient to specify \NoPSspecials
not effected until the \begin{document} command is within an environment or grouping. Use of Post-
encountered. This means that an alternative driver Script will be restored upon exiting from the envi-
may be selected, by another \xyoption{hdriveri}, ronment.
at any time until the \begin{document}. Only the
macros relevant to last named hdriveri will actually 17.2 Why use PostScript
be installed.
The following table describes available support for At some sites users have difficulty installing the ex-
PostScript drivers. Please consult the individual tra fonts used by XY-pic. The .tfm files can always
driver sections in part IV for the exact current list. be installed locally but it may be necessary for the
For each hdriveri there is a corresponding file named .pk bitmap fonts (or the .mf METAFONT fonts) to
xyhdriveri.tex which defines the necessary macros, be installed globally, by the system administrator, for
as well as a documentation file named xyhdriveri.doc. printing to work correctly. If PostScript is avail-
The spelling is all lower-case, designed to be both de- able then XY-ps allows this latter step to be bypassed.
scriptive and unique for the 1st 8 characters of the Note: with XY-ps it is still necessary to have the
file names. .tfm font metric files correctly installed, as these con-
tain information vital for correct typesetting.
hdriveri Description
dvips Tomas Rokicki’s dvips Other advantages obtained from using XY-ps are the
dvips Karl Berry’s dvipsk following:
dvips Thomas Kiffe’s dvips for Macintosh • Circles and circle segments can be set for arbi-
textures Blue Sky Research’s Textures v1.7+ trary radii.
16textures Blue Sky Research’s Textures v1.6
• solid lines are straighter and cleaner.
oztex Andrew Trevorrow’s OzTEX v1.8+
17oztex Andrew Trevorrow’s OzTEX v1.7 • The range of possible angles of directionals is
greatly increased.
Other DVI-drivers may also work using one of
these files, if they use conventions similar to dvips, • Spline curves are smoother. True dotted and
OzTEX or Textures. Alternatively it should not be dashed versions are now possible, using equally
too difficult to write the files required, using these spaced segments which are themselves curved.
as a basis indicating the type of information needed • The PostScript file produced by a driver from
to support the specific \special commands. Any- an XY-ps DVI file is in general significantly
one attempting to do this should inform the author smaller than one produced by processing an ‘or-
and convey a successful implementation to him for dinary’ DVI file using the same driver. One rea-
inclusion within the XY-pic distribution. son for this is that no font information for the
Note: In some previous versions of XY- XY-pic fonts is required in the PostScript file;
pic the PostScript backend and driver were this furthermore means that the use of XY-pic
loaded simultaneously by a command of the does not in itself limit the PostScript file to
form \UsePSspecials{hdriveri}. For backward- a particular resolution.9
compatibility these commands should still work,
but now loading the latest version of the given • The latest version of XY-pic now enables special
hdriveri. However their future use is discouraged effects such as variable line thickness, gray-level
in favour of the option-loading mechanism, via and colour. Also, rotation of text and (por-
\xyoption{hdriveri}. This latter mechanism is more tions of) diagrams is now supported with some
flexible, both in handling upgrades of the actual drivers. Similarly whole diagrams can be scaled
driver support and in being extensible to support up or down to fit a given area on the printed
more general forms of \special commands. page. Future versions will allow the use of re-
gions filled with colour and/or patterns, as well
Once activated the PostScript backend can be as other attractive effects.
9 Most TEX PostScript drivers store the images of characters used in the text as bitmaps at a particular resolution. This means
that the PostScript file can only be printed without loss of quality (due to bitmap scaling) at exactly this resolution.

35
Some of the above advantages are significant, but 18 TPIC backend
they come at a price. Known disadvantages of using
XY-ps include the following: Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Load as: \xyoption{tpic}
• A DVI file with specials for a particular Post-
Script driver can only be previewed if a pre- This option allows the XY-pic fonts to be replaced by
viewer is available that supports exactly the tpic \specials, when used with a dvi-driver capa-
same \special format. A separate Post- ble of supporting them. Extra capabilities include
Script previewer will usually be required. smoother lines, evenly spaced dotted/dashed curves,
However recent versions of xdvi sup- variable line-widths, gray-scale fills of circles, ellipses
port viewing of PostScript using either and polygonal regions.
the GhostScript program or via “Display Use of tpic \specials offers an alternative to
PostScript”. The PostScript produced by the XY-pic fonts. However they require a dvi-driver
XY-ps can be viewed this way that is capable of recognizing and interpreting them.
One such viewer is xdvik, Karl Berry’s modification
• DVI files created using XY-ps in fact lose their to the xdvi viewer on unix10 systems running X-
“device-independence”. So please do not dis- windows or a derivative. dvipsk, Karl Berry’s mod-
tribute DVI files with PostScript specials— ification to dvips also handles tpic \specials, so
send either the TEX source code, expecting the xdvik/dvipsk is an good combination for quality
recipient to have XY-pic ¨ , or send a (com-
^ screen-display and PostScript printing.
pressed) PostScript file. Once loaded using \xyoption{tpic}, with an ap-
The latter comment applies to files in which any spe- propriate hdriveri also specified either already or sub-
cial ‘back-end’ support is required, not just to Post- sequently, the following commands are available to
Script. Of course it can be ignored when you know turn the tpic backend off/on.
the configuration available to the intended recipient.
\NoTPICspecials turns off tpic specials.
PostScript header file: With some DVI-drivers \UseTPICspecials reinstates tpic specials.
it is more efficient to have the PostScript com-
mands that XY-ps needs loaded initially from a sepa-
rate “header” file. To use this facility the following There is a limit to the number of points allowable
commands are available. . . in a path. For paths constructed by XY-pic, which
includes spline curves, when the limit is reached the
\UsePSheader {} path is automatically flushed and a new path com-
\UsePSheader {<filename>} menced. The following command can be used to cus-
\dumpPSdict {<filename>} tomise this limit—initially set at 300 for use with
\xyPSdefaultdict xdvi—to suit alternative hdriveris.
Normally it is sufficient to invoke \UsePSheader{},
which invokes the default name of xy37dict.pro, re- \maxTPICpoints{hnumi} set maximum for paths
ferring to the current version of XY-pic. The optional
hfilenamei allows a different file to be used. Plac-
ing \dumpPSdict{..} within the document preamble Of the curves defined in the xycurve extension, only
causes the dictionary to be written to the supplied solid spline curves are supported. This is done by
hfilenamei. treating the spline as a polygon (poly-line) with many
See the documentation for the specific driver to segments. The dotted or dashed variants do not work
establish where the dictionary file should be located correctly.
on any particular TEX system. Usually it is suffi- Implementations of tpic draw dashed polygons
cient to have a copy in the current working directory. such that the start and finish of each segment is solid.
Invoking the command \dumpPSdict{} will place a Since these segments can be very short, the effect is
copy of the requisite file, having the default name, in simply to create a solid line. Similarly the shortness
the current directory. This file will be used as the of the segments tends to give nothing at all for large
dictionary for the current processing, provided it is portions of a dotted curve. What is needed is an im-
on the correct directory path, so that the driver can plementation whereby the on/off nature of a dashed
locate it when needed. Consult your local system or dotted polygon is determined by the accumulated
administrator if you experience difficulties. length, not the length along just the current segment.

10 Unix is a trademark of Bell Labs.

36
19 em-TeX backend where [P:p1 ,. . . ,pn ] denotes the shape obtained by
tracking the edge with each pi a position relative to
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui the object reference point. hvectoris and hcorneris
Load as: \xyoption{emtex} can be used directly; otherwise use -p to get the rel-
Eberhard Matte’s em-TEX implementation provides ative position.
a suite of \special commands to facilitate the draw- Note: Do not use {} or [] in the hposiitions.
ing of lines, both on-screen and with various printing Bug: The algorithm assumes that the reference
devices. This ‘back-end’ extension allows the lines in point is always inside the polygon.
XY-pic diagrams to be drawn using these methods. It is possible to frame polygons is also possible.
Note that this extension does not have to be used Bug: This code should be merged with the
with em-TEX. Better results may be obtained using ‘frame’ and ‘poly’ options.
the PostScript back-end and dvips hdriveri, since The example at the end of §?? illustrates the ex-
a version of dvips is available for em-TEX. How- tensions.
ever, in particular for screen previewing purposes, it
may be convenient to use this back-end. Further-
more note that dvips is capable of supporting em-
TEX\specials.
Part III
Once loaded using \xyoption{emtex}, with an
appropriate hdriveri also specified either already or Features
subsequently, the following commands are available
to turn the em-TEX backend off/on. This part documents the notation added by each
standard feature option. For each is indicated the
\NoEMspecials turns off em-TEX specials. described version number, the author, and how it is
\UseEMspecials reinstates em-TEX specials. loaded.
The first two, ‘all’ and ‘dummy’, described in §§21
Of the curves defined in the xycurve extension, only and 22, are trivial features that nevertheless prove
solid spline curves are supported. This is done by useful sometimes. The next two, ‘arrow’ and ‘2cell’,
treating the spline as a polygon (poly-line) with many described in §23 and 24, provide special commands
segments. for objects that ‘point’. The following, ‘matrix’
in §25, ‘graph’ in §26, ‘poly’ in §27, and ‘knot’ in §30,
are input modes that support different overall struc-
20 Necula’s extensions turing of (parts of) XY-pictures.

Vers. 0.0 by George C. Necula hnecula@cs.cmu.edui


Load as: \xyoption{necula} 21 All features
This option contains two extensions of the XY-pic Vers. 3.3 by Kristoffer H. Rose hkrisrose@brics.dki
kernel: A way to expand TEX macros in object Load as: \xyoption{all}
hmodifieris, and a way to specify arbitrary polygons
as the hshapei of an object. As a special convenience, this feature loads a subset
of XY-pic,11 namely the extensions: curve (cf. §8),
20.1 Expansion frame (§9), cmtip (§10), line (§11), rotate (§12),
color (§13), and the following features: matrix
The special syntax e|hmacrosi| is introduced in an (§25), arrow (§23), and graph (§26).
object hmodifieris and hcoordiinates. It expands the
given TEX hmacrosi (with \edef) before reinterpre-
tation as a hmodifieri of hcoordi, respectively.
This code may become part of the XY-pic kernel 22 Dummy option
at a certain point.
Vers. 3.3 by Kristoffer H. Rose hkrisrose@brics.dki
Load as: \xyoption{dummy}
20.2 Polygon shapes
A polygon hshapei is specified as This option is provided as a template for new options,
it provides neither features nor extensions but it does
[P:hposi,. . . ,hposi] count how many times it is requested.

11 The name ‘all’ hints at the fact that these were all the available options at the time ‘all’ was added.

37
23 Arrow and Path feature This is useful to draw connections with a ‘center
marker’ in particular with arrows, e.g., the ‘map-
Vers. 3.5 by Kristoffer H. Rose hkrisrose@brics.dki sto’ example explained below can be changed into
Load as: \xyoption{arrow} a ‘breakto’ example: typing
This feature provides XY-pic with the arrow paradigm \xy*+{0}\PATH
presented in [12]. ~={**\dir{-}}
Note: \PATH command incompatibly changed for ~>{|>*\dir{>}}
version 3.3 (the \ar command is unaffected). ~+{|*\dir{/}}
The basic concept introduced is the path: a con- ’(10,1)*+{1} ’(20,-2)*+{2} (30,0)*+{3}
nection that starts from c (the current object), ends \endxy
at a specified object, and may be split into sev- will typeset
eral segments between intermediate specified objects
b
that can be individually labelled, change style, have 0 bbb 1 UU UU eee2 3
breaks, etc. 2e
§23.1 is about the \PATH primitive, including the Note, however, that what goes into ~+{. . . } is
syntax of paths, and §23.2 is about the \ar customi- hlabelsi and thus not a hposi – it is not an action
sation of paths to draw arrows using XY-pic directional in the sense explained above.
objects.
23c. Specifying ~{hstuffi} will set the “failure contin-
uation” to hstuffi. This will be inserted when the
23.1 Paths last hsegmenti is expected—it can even replace it
The fundamental commands of this feature are \PATH or add more hsegmentis, i.e.,
and \afterPATH that will parse the hpathi according \xy *+{0} \PATH ~={**\dir{-}}
to the grammar in figure 13 with notes below. ~{’(20,-2)*+{2} (30,0)*+{3}} ’(10,1)*+{1}
\endxy
Notes is equivalent to
23a. An hactioni can be either of the characters =/. \xy *+{0} \PATH ~={**\dir{-}}
The associated hstuffi is saved and used to call ’(10,1)*+{1} ’(20,-2)*+{2} (30,0)*+{3}
\endxy
\PATHactionhactioni{hstuffi}
typesetting
before and after each segment (including all b
0 bbb 1 UUUU eee 3
hlabelsi) for = and /, respectively. 2e
The default \PATHaction macro just expands to because when \endxy is seen then the parser
“\POS hstuffi \relax” thus hstuffi should be of knows that the next symbol is neither of the char-
the form hposi hdecori. The user can redefine acters ~’‘ and hence that the last hsegmenti is to
this—in fact the \ar command described in §23.2 be expected. Instead, however, the failure con-
below is little more than a special \PATHaction tinuation is inserted and parsed, and the hpathi
command and a clever defaulting mechanism. is finished by the inserted material.
23b. It is possible to include a number of de- Failure continuations can be nested:
fault hlabelsi before the hlabelsi of the \xy *+{0} \PATH ~={**\dir{-}}
actual hsegmenti are interpreted, using ~{~{(30,0)*+{3}}
~hwhichi{hlabelsi}. The specified hwhichi deter- ’(20,-2)*+{2}} ’(10,1)*+{1}
mines for which segments the indicated hlabelsi \endxy
should be prefixed as follows:
will also typeset the connected digits.
hwhichi applied to. . . 23d. A “straight segment” is interpreted as follows:
< next segment only
> last segment only 1. First p is set to the end object of the previ-
= every segment ous segment (for the first segment this is c
just before the path command) and c is set
(when several apply to the same segment they to the hposi starting the hsegmenti, and the
are inserted in the sequence <>+). current hslidei is applied.

38
Syntax Action
\PATH hpathi interpret hpathi
\afterPATH{hdecori} hpathi interpret hpathi and then run hdecori
hpathi −→ ~ hactioni { hstuffi } hpathi set hactioni23a to hstuffi
| ~ hwhichi { hlabelsi } hpathi add hlabelsi prefix for some segments23b
| ~ { hstuffi } hpathi set failure continuation23c to hstuffi
| ’ hsegmenti hpathi make straight segment23d
| ‘ hturni hsegmenti hpathi make turning segment23f
| hsegmenti make last segment23g
hturni −→ hdiagi hturnradiusi 1/4 turn23f starting in hdiagi
| hciri hturnradiusi explicit turn23f
hturnradiusi −→ hemptyi use default turn radius
| / hdimeni set turnradius to hdimeni
hsegmenti −→ hpath-posi hslidei hlabelsi segment23e with hslidei and hlabelsi
hslidei −→ hemptyi | < hdimeni > optional slide23h : hdimeni in the “above” direction
hlabelsi −→ ^ hanchori hiti haliasi hlabelsi label with hiti23i above hanchori
| _ hanchori hiti haliasi hlabelsi label with hiti23i below hanchori
| | hanchori hiti haliasi hlabelsi break with hiti23j at hanchori
| hemptyi no more labels
hanchori −→ - hanchori | hplacei label/break placed relative to the hplacei where - is a
synonym for <>(.5)
hiti −→ hdigiti | hletteri | {htexti} | hcsi hiti is a default label23k
| * hobjecti hiti is an hobjecti
| @ hdiri hiti is a hdiriectional
| [ hshapei ] hiti use [hshapei] for hiti
haliasi −→ hemptyi | ="hidi" optional name for label object23l

Figure 13: hpathis

2. Then the = and < segment actions are ex- will start from there, in particular the last seg-
panded (in that sequence) and the < action ment (which is always straight) can be used to
is cleared. The resulting p and c become the finish a winding line.
start and end object of the segment. What the turn looks like is determined by the
3. Then all hlabelsi (starting with the ones de- hturni form:
fined as described in note 23b below). hemptyi Nothing between the ‘ and the hposi
is interpreted the same as giving just the
23e. A segment is a part of a hpathi between a previ-
hdiagi last used out of a turn.
ous and a new target given as a hpath-posi: nor-
mally this is just a hposi as described in §3 but hdiagi Specifying a single hdiagi d is the same as
it can be changed to something else by changing specifying either of the hciricles d^ or d_, de-
the control sequence \PATHafterPOS to be some- pending on whether the specified hposi has
thing other than \afterPOS. its center ‘above’ or ‘below’ the line from p
in the hdiagional direction.
23f. A turning segment is one that does not go all hciri When a full explicit hciricle is available
the way to the given hposi but only as far as re- then the corresponding hciricle object is
quired to make a turn towards it. The c is set placed such that its ingoing direction is a
to the actual turn object after a turning segment continuation of a straight connection from p
such that subsequent turning or other segments and the outgoing direction points such that

39
a following straight (or last) segment will details). The only difference between ^ and _ is
connect it to c (with the same slide). that they shift the label in the ^ respectively _
direction; for straight segments it is placed in the
Here is an example using all forms of hturnis: “superscript” or “subscript” position.

GF E ???
o base o C_? Labels will be separated from the connection by
a e
?? the label margin that you can set with the opera-

@A
??
b
?? tion
??

??AB
ECD
d ??
?? /
c
A B \labelmargin hadd opi {hdimeni}

was typeset by that works like the kernel \objectmargin com-


mand; in fact labelmargin defaults to use object-
\xy <4pc,0pc>:(0,0)
margin if not set.
*+\txt{base}="base"
\PATH ~={**\dir{-}?>*\dir{>}}
‘l (-1,-1)*{A} ^a 23j. Breaking means to “slice a hole” in the connec-
‘ (1,-1)*{B} ^b tion and insert hiti there. This is realized by
‘_ul (1, 0)*{C} ^c typesetting the connection in question in subseg-
‘ul^l "base" ^d ments, one leading to the break and one contin-
"base" ^e uing after the break as described in notes 23a
\endxy and 23d.

Bug: Turns are only really resonable for paths The special control sequence \hole is provided
that use straight lines like the one above. to make it easy to make an empty break.
Note: Always write a valid hposi after a hturni,
otherwise any following ^ or _ labels can con- 23k. Unless hiti is a full-fledged hobjecti (by using
fuse the parser. So if you intend the ^r in ‘^r the * form), it is typeset using a \labelbox ob-
to be a label then write ‘,^r, using a dummy , ject (initially similar to \objectbox of basic XY-
hposiition. pic but using \labelstyle for the style).

The default used for turnradius can be set by the Remark: You can only omit the {}s around sin-
operation gle letters, digits, and control sequences.

\turnradius hadd opi {hdimeni} 23l. A label is an object like any other in the XY-
picture. Inserting an haliasi ="hidi" saves the
that works like the kernel \objectmargin etc. label object as "hidi" for later reference.
commands; it defaults to 10pt.

Exercise 23: Typeset Exercise 24: Typeset

@GA
FBE@GA
FBECD
9A label
55
 f3
A f f f
using hturnis. f f
f f f
23g. The last segment is exactly as a straight one ex-
cept that the > action (if any) is executed (and
cleared) just after the < action.
23h. “Sliding” a segment means moving each of the
p, c objects in the direction perpendicular to the 23.2 Arrows
current direction at each.
Arrows are paths with a particularly easy syntax for
23i. Labelling means that hiti is dropped relative to setting up arrows with tail , stem, and head in the
the current segment using a ? hposiition. This style of [12]. This is provided by a single hdecoriation
thus depends on the user setting up a connection the syntax of which is described in figure 14 (with the
with a ** hposi as one of the actions—typically added convention that a raised ‘*’ means 0 or more
the = action is used for this (see note 23d for the repetitions of the preceeding nonterminal).

40
Syntax Action
\ar harrowi hpathi make harrowi along hpathi
harrowi −→ hformi* harrowi has the hformis
hformi −→ @ hvarianti use hvarianti of arrow
| @ hvarianti { htipi } build arrow23m using hvarianti of a standard stem and
htipi for the head
| @ hvarianti { htipi hconni htipi } build arrow23m using hvarianti of htipi, hconni, htipi as
arrow tail, stem, and head (in that order)
| @ hconnchari change stem to the indicated hconnchari
| @! dash the arrow stem by doubling it
| @/ hdirectioni hdisti / curve23o arrow the hdistiance towards hdirectioni
| @( hdirectioni , hdirectioni ) curve to fit with in-out directions23p
| @‘ { hcontrol point listi } curve setup23q with explicit control points
| @[ hshapei ] add [hshapei] to object hmodifieris23r for all objects
| @* { hmodifieri* } add object hmodifieris23r for all objects
| @< hdimeni > slide arrow23s the hdimeni
| | hanchori hiti break each segment at hanchori with hiti
| ^ hanchori hiti | _ hanchori hiti label each segment at hanchori with hiti
| @? reverse meaning of above and below23t
hvarianti −→ hemptyi | ^ | _
| 0 | 1 | 2 | 3 hvarianti: plain, above, below, double, or triple
htipi −→ htipchari* directional named as the sequence of htipcharis
| hdiri any hdiriectional23n
htipchari −→ <|>|(|)|||’|‘|+|/ recognised tip characters
| hletteri | hspacei more tip characters
hconni −→ hconnchari* directional named as the sequence of hconncharis
| hdiri any hdiriectional23n
hconnchari −→ -|.|~|=|: recognised connector characters

Figure 14: harrowis.

Notes Exercise 25: Typeset these arrows:

23m. Building an harrowi is simply using the spec- 8?9


>
A:=0 <; 8?A
9
>:=00<; @GA FB
A E
000CD ?89
>
B:=0 <; ?8B9
>: =00<; G@B FB
A E
000CD
Z44 KS ZZ SKSK
44

<J

<J
<J
44

ified directionals (using \dir of §6.1) to build a


path: the first htipi becomes the arrow tail of the

_JJJJ
__
tt_
arrow, the hconniection in the middle becomes A B
the arrow stem, and the second htipi becomes
the arrow head . If a hvarianti is given before the
{ then that variant \dir is used for all three. For The above is a flexible scheme when used in con-
example, junction with the kernel \newdir to define all
\xy\ar @^{(->} (20,7)\endxy sorts of arrowheads and -tails. For example,
\newdir{|>}{!/4.5pt/\dir{|}
typesets *:(1,-.2)\dir^{>}
*:(1,+.2)\dir_{>}}
j5
jjjjjjj
'  jjjjj
defines a new arrow tip that makes
\xy (0,0)*+{A}
\ar @{=|>} (20,3)*+{B}

41
\endxy Exercise 27: Typeset
* O* u
*
O *
O
j * jO*jO*jOju
O
j

*
* O* jO* jOj 
typeset
d$ .5 5 jO*5 jOj 
dddddddd B
A
using only one \ar command.
Notice that the fact that the directional uses only
htipchari characters means that it blends natu- 23o. Curving the arrow using /d`/, where d is a
rally with the existing tips. hdirectioni and ` a hdimenision, makes the stem
a curve which is similar to a straight line but has


 

had it’s center point ‘dragged’ the distance ` in d:
Exercise 26: Often tips used as ‘tails’ have
their ink on the wrong side of the point where
they are placed. Fortunately space is also a ↑ u
htipchari so we can define \dir{ >} to generate ↓ d

$ 
$ 

a ‘tail’ arrow. Do this such that
\xy (0,0)*+{A}="a", (20,3)*+{B}="b"
\ar @{>->} "a";"b" < 2pt> was typeset by
\ar @{ >->} "a";"b" <-2pt> \xy
\endxy \POS (0,10) *\cir<2pt>{} ="a"
, (20,-10)*\cir<2pt>{} ="b"
typesets
\POS"a" \ar @/^1ex/ "b"|\uparrow
d1
d1 dddddddddddd1 B
A d1 ddd
\POS"a" \ar @/_1ex/ "b"|\downarrow
%
\POS (20,10) *\cir<2pt>{} ="a"
, (40,-10)*\cir<2pt>{} ="b"
23n. Specifying a hdiri as a htipi or hconni means \POS"a" \ar @/u1ex/ "b"|u
that \dirhdiri is used for that htipi or hconni. \POS"a" \ar @/d1ex/ "b"|d
For example, \endxy
\xy\ar @{<^{|}>} (20,7)\endxy ` defaults to .5pc if omitted.
This is really just a shorthand for curving using
* * * * *5
typesets
*****
the more general form described next: @/d`/ is
**
*u * * * * the same as @‘{{**{} ?+/d 2` /}} which makes
the (quadratic) curve pass through the point de-
fined by the hposi **{} ?+/d`/.
When using this you must specify a {} dummy
hdiriectional in order to ignore one of the tail, 23p. Using @(d2 ,d2 ) where d1 , d2 are simple
stem, or tip components, e.g., hdirectionis (as described in note 4l except it is
\xy\ar @{{}{+}>} (20,7)\endxy not possible to use ()s) will typeset the arrow
curved such that it leaves the source in direction
typesets d1 and enters the target from direction d2 .
**
* *
j * j* j* jj5
j
*
* j* jj
j* j* j Exercise 28: Typeset

In particular *hobjecti is a hdiri so any hobjecti


can be used for either of the tail, stem, or head
component: ◦ •!

\xy\ar @{*{x}*{y}*{z}} (20,7)\endxy


To Do: implement this efficiently and properly
typesets
get rid of the no-() restriction!
y y yz
y yyy
xy y 23q. The final curve form is the most general one:
@‘{hcontrol point listsi} sets the control points
Note: A * introduces an hobjecti whereas the explicitly to the ones in the hcontrol point listsi
directional ‘ • ’ is typeset by the hdiri {*}. (where they should be separated by ,). See the

42
curve extension described in §8 for the way the
control points are used; when the control points f
list is parsed p is the source and c the target of  
 α #
the arrow. A   /B
g ;
 β
23r. @[. . . ] and @*{. . . } formations define what ob- h
ject hmodifieris should be used when building ob-
jects that are part of the arrow. This is mostly
useful in conjunction with extensions that define \diagram
additional [hshapei] modifiers, e.g., if a [red] A\ruppertwocell^f{\alpha}
hmodifieri changes the colour of an object to red \rlowertwocell_h{\beta}
then @[red] will make the entire arrow red; sim- \rto_(.35)g & B\\
ilarly if it is desired to make and entire arrow \enddiagram
invisible then @*{i} can be used. These categorical diagrams frequently have a
matrix-like layout, as with commutative diagrams.
23s. @<D> will slide (each segment of) the arrow the To facilitate this there are control sequences of the
dimension D as explained in note 23h. form: \rtwocell , \ultwocell , \xtwocell , . . .
analogous to the names defined in xyv2 for use in
23t. @? reverse the meaning of ‘above’ and ‘below’ diagrams produced using xymatrix. As this involves
for this particular arrow. the definition of 21 new control sequences, many of
which may never be used, these are not defined im-
All the features of hpathis described above are mediately upon loading xy2cell. Instead the user
available for arrows. must first specify \UseTwocells.
As in the second example above, just the
upper or lower curved arrow may be set using
24 Two-cell feature control sequences of the form \..uppertwocell
and \..lowertwocell. These together with the
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui \..compositemap family, in which two abutting ar-
Load as: \xyoption{2cell} rows are set with an empty object at the join, al-
low for the construction of complicated “pasting dia-
This feature is designed to facilitate the typesetting grams” (see figure 15 for an example).
of curved arrows, either singly or in pairs, together The following initialise the families of control se-
with labels on each part and between. The intended quences for use in matrix diagrams.
mathematical usage is for typesetting categorical “2-
cell” morphisms and “pasting diagrams”, for which
special features are provided. These features also al- \UseTwocells two curves
low attractive non-mathematical effects. \UseHalfTwocells one curve
\UseCompositeMaps 2 arrows, end-to-end
\UseAllTwocells (all the above)
24.1 Typesetting 2-cells in Diagrams
Categorical “2-cell” morphisms are used in the study
of tensor categories and elsewhere. The morphisms Alternatively 2-cells can be set directly in XY-
are displayed as a pair of curved arrows, symmetri- pictures without using the matrix feature. In this
cally placed, together with an orientation indicated case the above commands are not needed. This is
by a short broad arrow, or Arrow. Labels may be described in §24.5.
placed on all three components. Furthermore a new directional \dir{=>} can be
Bug: This document still uses version 2-style used to place an “Arrow” anywhere in a picture, after
commmands, as described in appendix B. the direction has been established appropriately. It
is used with all of the 2-cell types.
f Labels are placed labels on the upper and lower
  )
A  5B arrows, more correctly ‘anti-clockwise’ and ‘clock-
g wise’, using ^ and _. These are entirely optional with
the following token, or grouping, giving the contents
\diagram of the label. When used with \..compositemap the
A\rtwocell^f_g &B\\ ^ and _ specify labels for the first and second arrows,
\enddiagram respectively.

43
5 f3
/ MM
f2 jjjj F MMMf4
jj jj MMM
={j j M&
{ 2222 
8C
f1 {{
{
 
tt9 JJJ  888
{ tt JJf5 f7
{ t JJ    888
f
{{ t t JJ 
4 tt % f6
/  
A LL iiii
mm m6 6B
LLL iii 
mm
g1 LLL iiii mmm g4
L% i\iiiii m mmmmg3
\\\\\\\\\\\
g2
\\\\\-mmmm

Figure 15: Pasting diagram.

Normally the label is balanced text, set in TEX’s


math mode, with \twocellstyle setting the style. When none of these occurs then the default of _ is
The default definition is given by . . . assumed. If the label itself starts with one of these
\def\twocellstyle{\scriptstyle} characters then specify _ explicitly, or enclose the la-
This can be altered using \def in versions of TEX bel within a group {...}. See Extra Options 1, for
or \redefine in LATEX. However labels are not re- more values of htoki. Also note that * has a special
stricted to being simply text boxes. Any effect ob- role when used as the first character; however it is
tainable using the XY-pic kernel language can be set considered to be part of the hlabeli, see above.
within an \xybox and used as a label. Alternatively
if the first character in the label is * then the label is
set as an XY-pic hobjecti, as if with \drop<object> or
24.3 Nudging
*<object> in the kernel language. The current direc- Positions of all labels may be adjusted, as can the
tion is tangential to the curved arrows. Extra braces amount of curvature for the curved arrows. The way
are needed to get a * as the label, as in ^{{{*}}} or this is done is by specifying a “nudge” factor hnumi
_{{}*}. at the beginning of the label. Here hnumi is a num-
The position of a label normal to the tangential ber which specifies the actual position of the label in
direction can also be altered by nudging (see below). units of \xydashl@ (the length of a single dash, nor-
Although it is possible to specify multiple labels, only mally 5pt) except with \..compositemap, see below.
the last usage of each of ^ and _ is actually set, pre- Movement is constrained to the perpendicular bisec-
vious specifications being ignored. tor of the line cp. When nudging the label for the
Similarly a label for the central Arrow must be central Arrow it is the whole Arrow which is moved,
given, after the other labels, by enclosing it within along with its label.
braces {...}. An empty group {} gives an empty Curvature of the arrows themselves is altered by
label; this is necessary to avoid misinterpretation of a nudge of the form \..twocellhnumi.... The sep-
subsequent tokens. As above if the first character is * aration of the arrows, along the bisector, is set to
then the label is set as an XY-pic hobjecti, the current be hnumi\xydashl@. When hnumi is zero, that is
direction being along the Arrow. \..twocell<0>..., the result is a single straight ar-
row, its mid-point being the origin for nudging labels.
24.2 Standard Options A negative value for hnumi is also acceptable; but
check the orientation on the Arrow and which of ^
The orientation of the central Arrow may be reversed, and _ correspond to which component.
turned into an equality, or omitted altogether. In The origin for nudging labels is where the arrow
each case a label may still be specified, so in effect crosses the bisector. Positive nudges move the label
the Arrow may be replaced by anything at all. outwards while negative nudges move towards pc and
These effects are specified by the first token in the possibly beyond. The default position of a label is on
central label, which thus has the form: {htokihlabeli} the outside, with edge at the origin.
where htoki may be one of . . . The origin for nudging the Arrow is at the mid-
point of pc. A positive nudge moves in the clockwise
direction. This will be the direction of the arrowhead,
_ Arrow points clockwise unless it has been reversed using ^.
^ Arrow points anti-clockwise
= no tip, denotes equality Labels on a \..compositemap are placed relative
\omit no Arrow at all. to the midpoint of the component arrows. Nudges
are in units of 1pt. Movement is in the usual XY-pic

44
Syntax Action
htwocelli −→ h2-cellihswitchesihArrowi typeset h2-celli with the hswitchesi and hArrowi
h2-celli −→ \..twocell typeset two curved arrows
| \..uppertwocell typeset upper curved arrow only
| \..lowertwocell typeset lower curved arrow only
| \..compositemap use consecutive straight arrows
hArrowi −→ {htokihtexti} specifies orientation and label
| {hnudgeihtexti} adjust position, use default orientation
| {htexti} use default position and orientation
| {htoki*hobjecti} use hobjecti as the label
| {hnudgei*hobjecti} | {*hobjecti}
htoki −→ ^ | _ | = oriented anti-/clockwise/equality
| \omit no Arrow, default is clockwise
| ‘ |’ |" |! no Arrow; tips on two curved arrows as:
anti-/clockwise/double-headed/none
hswitchesi −→ hswitchihswitchesi list of optional modifications
hswitchi −→ hemptyi use defaults
| ^ hlabeli place hlabeli on the upper arrow
| _ hlabeli place hlabeli on the lower arrow
| hnudgei set the curvature, based on hnudgei value
| \omit do not set the curved arrows
| ! place \modmapobject midway along arrows
| ~ hwhati { hobjecti } use hobjecti in place specified by hwhati
hwhati −→ hemptyi set curves using the specified hobjecti
| ^ |_ use hobjecti with upper/lower curve
| ‘ |’ use hobjecti for arrow head/tail
hlabeli −→ htexti | hnudgei htexti set htexti, displaced by hnudgei
| *hobjecti | hnudgei*hobjecti set hobjecti, displaced by hnudgei
hnudgei −→ <hnumberi> use hnumberi in an appropriate way, e.g., to position
object or label along a fixed axis
| <\omit> do not typeset the object/label

Figure 16: htwocellis

45
above and below directions, such that a positive nudge
theory
is always outside the triangle formed by the arrows r ,
and line pc. Mathematics l 2 Physics
experiment
The special nudge value <\omit> typesets just the
Arrow, omitting the curved arrows entirely. When \xymatrixcolsep{5pc}
used with labels, the nudge value <\omit> causes the \diagram
following label to be ignored. \relax\txt{\llap{Math}ematics }\rtwocell
_{\hbox{\tiny experiment }}
Exercise 29: Give code to typeset figure 15. ^{\hbox{\tiny theory }}{"}
Such code is relatively straight-forward, using “nudg- & \relax\txt{Physics} \\
ing” and \omit to help position the arrows, curves \enddiagram
and Arrows. It also uses an excursion, as described
below in the subsection Extra Options 3.
2. Changing Tips and Module Maps

24.4 Extra Options The following commands are provided for specifying
the hobjecti to be used when typesetting various parts
The following features are useful in non-mathematical of the twocells.
applications.
command default
1. no Arrow \modmapobject{hobjecti} \dir{|}
This is determined by special values for htoki as the \twocellhead{hobjecti} \dir{>}
first (or only) character in the central label, as in the \twocelltail{hobjecti} \dir{}
above description of the standard switches. \arrowobject{hobjecti} \dir{=>}
\curveobject{hobjecti}
\uppercurveobject{hobjecti} {}
’ arrowheads pointing clockwise; \lowercurveobject{hobjecti} {}
‘ arrowheads pointing anti-clockwise;
" arrow tips on both ends; These commands set the object to be used for all
! no tips at all. subsequent 2-cells at the same level of TEX grouping.
\curveobject specifies both of the upper- and lower-
curve objects. For some of these there is also a way
The central Arrow is omitted, leaving symmetrically to change the object for the current 2-cell only. This
placed curved connections with arrowheads at the requires a ~-hswitchi which is described below, except
specified ends. A label can be placed where the Ar- for the \..curveobject types, which are discussed in
row would have been. Extra Options 4.
If a special arrowhead is specified using ~’{..}
(see Extra Options 2, below) then this will be used These effects are specified by placing switches af-
instead of the standard \dir{>}. ter the \..twocell control sequence, e.g. \rtwocell
switches labels. . . . Each switch is either a sin-
gle token htoki, or a ~htoki with a single argument:
precipitation ~htoki{arg}. Possibilities are listed in the following
table, in which {..} denotes the need for an argu-
! ment.
Clouds
a H2 O Oceans

evaporation
\omit no arrows, Arrow and label only;
! place module-map indicator;
~’{..} change arrow-head to {..};
\xymatrixcolsep{5pc} ~‘{..} place/change tail on arrow(s);
\diagram ~{..} change object used to set curves;
\relax\txt{Clouds }\rtwocell<10> ~^{..} use object {..} to set upper curve;
_{\hbox{\tiny evaporation }} ~_{..} use object {..} to set lower curve;
^{\hbox{\tiny precipitation }}
{’{\mathbf{H_2 O}}} Here we discuss the use of !, ~’, ~‘ and \omit. The
&\relax\txt{Oceans}\\ description of ~^, ~_ and ~{..} is given in Extra Op-
\enddiagram tions 4.

46
The default module map indicator places a sin- used with the upper and lower curves by specifying
gle dash crossing the arrow at right-angles, located \uppercurveobject and \lowercurveobject.
roughly midway along the actual printed portion of These specifications apply to all 2-cells subse-
the arrow, whether curved or straight. This takes quently constructed at the same level of TEX group-
into account the sizes of the objects being connected, ing. Alternatively using a ~-switch, as in Extra Op-
thereby giving an aesthetic result when these sizes dif- tions 2, allows such a specification for a single 2-cell
fer markedly. This also works with \..compositemap or curved part.
where an indicator is placed on each arrow. The ac- Objects used to construct curves can be of two
tual object can be changed using \modmapobject. types. Either a single hobjecti is set once, with copies
Any of the standard XY-pic tips may be used for placed along the curve. Alternatively a directional
arrow-heads. This is done using ~’{..}, for example object can be aligned with the tangent along the
~’{\dir{>>}} gives double-headed arrows. Similarly curve. In this case use a specification takes the form:
~‘{..} can be used to place an arrow-tail. Normally \curveobject{hspaceri~**hobjecti}.
the arrow-tail is , so is not placed; but if a non-empty Here hspaceri may be any hobjecti of non-zero size.
tail has been specified then it will be placed, using Typically it is empty space, e.g. +hdimeni{}.
\drop. No guarantee is offered for the desired result
being obtained when an arrow-tail is mixed with the Exercise 30: Give code to typeset the following di-
features of Extra Options 1. agrams.
M

- ⊗ ((
P f 66S ??????????
⊗ ?? ?
M0 FUn & gaMES
◦◦ ◦
◦◦◦ ◦
◦ ◦◦◦ ◦ ◦ ◦
\modmapobject{\objectbox{\otimes}}
\xymatrixcolsep{5pc}
\diagram
P\rtwocell~!~’{\dir{>>}}~‘{\dir{|}}
^{<1.5>M}_{<1.5>M’}{=f} & S \\
\enddiagram continuous power
2 1 1 0 / . - - , +
5 5 4 3 * ) )
89 7 6 ( ' &
`abc
gfed
XYZ[
_^]\
%
3. Excursions Ground Excited
Ni Cd
State e e State
Syntax for \xcompositemap and \x..twocell types gg i yy
is a little different to what might be expected from
i jj
ll mm oo qq rr tt uu w w
that for \xto, \xline, etc. For example, pulsed emission

\xtwocell[hhopi]{hdisplacei}...

connects to the hposi displaced by hdisplacei from the 24.5 2-cells in general XY-pictures
relative cell location specified by hhopi. The displace-
Two-cells can also be set directly within any XY-
ment can be any string of valid XY-pic commands, but
picture, without the matrix feature, using either
they must be enclosed within a group {...}. When
\drop or \connect.
the cell location is the target, a null grouping {} must
be given. \def\myPOS#1{\POS}\def\goVia#1{%
When used with the <\omit> nudge, such excur- \afterPOS{\connect#1\myPOS}}
sions allow a labelled Arrow to be placed anywhere \xy
within an XY-pic diagram; furthermore the Arrow can *+{A}="A",+<1cm,1.5cm>*+{B}="B",
be oriented to point in any direction. +<2.0cm,0pt>*+{C}="C",
+<1cm,-1.5cm>*+{D}="D",
4. Fancy curves "A";\goVia{\uppertwocell^\alpha{}}"B"{}
;\goVia{\twocell^\zeta_\xi{\gamma}}"C"{}
By specifying \curveobject an arbitrary object ;\goVia{\compositemap{}}"D"{},
may be used to construct the curved arrows. In- "A";\goVia{\lowertwocell{}}"D"{}
deed with a \..twocell different objects can be \endxy

47
discuss in the following sections what hsetupi can
ζ be). Thus a matrix with maxrow rows and maxcol
1B
  (
 γ 6 C RRRR columns where each entry contains row ,col is entered
α JJ
JJ R(
!) ξ  as
v~ tttt 

 \xymatrix{
A   8D 1,1 & 1,2 & · · · 1,maxcol \\
 2,1 & 2,2 & 2,maxcol \\
.. ..
. .
The code shown is a compact way to place a chain maxrow ,1 & maxrow ,2 & maxrow ,maxcol }
of 2-cells within a picture. It illustrates a standard
technique for using \afterPOS to find a hposi to be (TEXnically the & character represents any ‘alignment
used for part of a picture, then subsequently reuse it. tab’, i.e., character with category code 4).
Also it is possible to use \drop or hdecoris to specify A hmatrixi can appear either in an XY-picture (as
the 2-cells, giving the same picture. hdecori) or “stand-alone”.
The aspects in which \xymatrix differs from or-
\xy *+{A}="A",+<1cm,1.5cm>*+{B}="B",
dinary matrix constructions, such as Plain TEX’s
+<2cm,0pt>*+{C}="C",
\matrix{. . . } and LATEX’s array environment, are
+<1cm,-1.5cm>*+{D}="D",
"A";"B",{\uppertwocell^\alpha{}}, • arbitrary XY-pic hdecoriations may be specified
"B";"C",{\twocell^\zeta_\xi{\gamma}}, in each entry and will be interpreted in a state
"C"; \afterPOS{\drop\compositemap{}}"D" where c is the current entry,
\POS "A";
\afterPOS{\drop\lowertwocell{}}"D" • the entire matrix is an object itself with refer-
\endxy ence point as the top left entry, and
The \connect variant is usually preferable as this • a progress message “<xymatrix rowsxcols
maintains the size of the object at c, while the \drop size>” is printed for each matrix with rows ×
variant leaves a rectangular object having p and c on cols entries and XY-pic complexity size (the
opposite sides. number of primitive operations performed), un-
less the declaration \SilentMatrices is issued.

25 Matrix feature • Entries starting with a * are special (described


in §25.4)12 , so use {*} to get a *.
Vers. 3.4 by Kristoffer H. Rose hkrisrose@brics.dki
Load as: \xyoption{matrix} For example,

This option implements “XY-matrices”, i.e., matrices \xy


where it is possible to refer to the entry objects by \xymatrix{A&B\\C&D}
their row/column address. We first describe the gen- \drop\frm{-}
eral form of XY-matrices in §25.1, then in §25.2 we \drop\cir<8pt>{}
summarise the new hcoordiinate forms used to refer \endxy

8?9
>A=
:;<
to entries. In §25.3 we explain what parameters can will typeset
be set to change the spacing and orientation of the B
matrix, and in §25.4 we explain how the appearance
of the entries can be changed.
C D
25.1 XY-matrices
Bug: Matrix nesting is not safe.
The fundamental command of this feature is Matrices are often quite slow to typeset so as a
convenience all matrices can be set to compile (and
\xymatrix hsetupi {hrowsi} not) automatically with the declarations

that reads a matrix of entries in the generic TEX \CompileMatrices


row&column format, i.e., where rows are separated \NoCompileMatrices
with \\ and contain columns separated with & (we
12 In general it is recommended that entries start with a non-expanding token, i.e., an ordinary (non-active) character, {, or

\relax, for compilation to work.

48
Matrices can be compiled or not individually, by us- ["hprefixi" hhopi* ]
ing the explicit commands \xymatrixcompile and ["hprefixi" hhopi+ hplacei ]
\xymatrixnocompile as well as by encapsulating in
the usual \xycompileto{name}{. . . } (see note 5e). In fact absolute references must always be given using
Note: Matrices will only compile correctly if all "hprefixihrowi,hcoli", even inside the matrix itself .
entries start with a nonexpandable token, i.e., { or Here is an example using this:
\relax or some non-active character. _ _ _ _ _ 
_ _ _  _A _ _  B 
 A0  B 
0

25.2 New coordinate formats  
 
It is possible within entries to refer to all the entries of  C  D
 C0 _ _ 0_ _ _
the XY-matrix using the following special hcoordiinate _ _ _ _ _D _
forms:
was typeset (using the ‘frame’ extension and ‘arrow’
"r,c" Position and extents of en- feature) by
try in row r, column c (top \xy
left is "1,1") \xymatrix"*"{%
[∆r,∆c] ∆r rows below, ∆c A & B \\
columns right of current C & D }%
entry \POS*\frm{--}
[ hhopi* ] entry reached by hhopis;
\POS-(10,3)
each hhopi is one of dulr
\xymatrix{%
describing one ‘move’ to a
A’ \ar@{.}["*"] & B’ \ar@{.}["*"] \\
neighbor entry
C’ \ar@{.}["*"] & D’ \ar@{.}["*"] }%
[ hhopi+ hplacei ] hplacei on straight line to
\POS*\frm{--}
non-empty [hhopi*]
\endxy
So the current entry has the synonyms [0,0], [],
[rl], [ud], [dudu], etc., as well as its ‘absolute’
25.3 Spacing and rotation
name "r,c".
These forms are useful for defining diagrams Any matrix can have its spacing and orienta-
where the entries are related, e.g., tion changed by adding hsetupi ‘switches’ between
\xymatrix and the opening {.
A@ The default spacing between entries of matrix is
O @@
O @@ changed with the switches
O @@
B C @Rhadd opi hdimeni
@Chadd opi hdimeni
was typeset by @ hadd opi hdimeni
$$\xy
\xymatrix{ that change row spacing, column spacing, and both,
A \POS[];[d]**\dir{~}, respectively, as indicated by the hadd opi and
[];[dr]**\dir{-} \\ hdimeni, where the hdimeni may be omitted and can
B & C \POS[];[l]**\dir{.} } be given as one of R and C to indicate the current
\endxy$$ value of the parameter in question. Note: there is
If an entry outside the XY-matrix is referenced no default.
then an error is reported. In addition, XY-pic can be instructed to use a ‘fixed
In case several matrices are used in the same di- grid’ for the matrix with the switches
agram, and they refer to each other, then it is useful
to give the matrices different "hprefixi" hsetupi such @!R
that they can refer to each other using the following @!C
special coordinate forms that all have the same mean- @!
ing except the target entry is picked from a particular
matrix: that ensure that the row spacing, column spacing,
and both, respectively, pretending that all entries
"hprefixir,c" have the size of the largest entry (without modify-
["hprefixi"∆r,∆c] ing the real size of the entries, of course, only the

49
spacing – to get the entries to really have the same **{hmodifieri*} hentryi
size use a @*. . . hsetupi described in §25.4 below).
The special variants The first sets the default hshapei for objects
(cf. note 4j), the second a default size (change,
@!0 cf. note 4g), and the last makes it possible to add
@!=hdimeni any hobjecti modifier of §4, e.g., for recentering en-
tries after the default entry form which is equivalent
pretend that entries have zero or hdimeni height and to ‘!C +<2 × objectmargin>’ (with the effect of cen-
width for computing row and column spacing; as tering the object and add the objectmargin) to all
above inserting R or C just after the ! makes this af- sides.
fect only the row or column spacing, e.g., @!R0 means
that the row spacing only is between the centers of Exercise 31: Typeset the following diagram:
the rows.
Finally, the spacing of things that are typeset can /A
/B
A×B
be adjusted separately:
/B ×A
@Mhadd opi hdimeni  
A / B×A
@Whadd opi hdimeni B×
@Hhadd opi hdimeni
@Lhadd opi hdimeni It is also possible to use these @hsetupis (as usual
between \xymatrix and the leading {):
will adjust the entry margin, entry width, entry
height, and label separation used (the latter is ac- @*[hshapei]
tually passed to the arrow feature). @* hadd opi hsizei
The spacing can also be changed for en entire TEX
group by the declarations which are equivalent to changing all entries to behave
as if they had started with the similar **-form. To
\xymatrixrowsep hadd opi {hdimeni} Do: Allow **hadd opihsizei hentryi for entries.
\xymatrixcolsep hadd opi {hdimeni} If the default set of entry modifiers should be
changed then the following declaration must be issued
The default spacing for both is 2pc. before the \xymatrix command; this is the only way
To Do: optimize processing of matrices with con- to actually switch the initial default centering and
stant grid. spacing off:
An entire matrix can be rotated by adding a ro-
tation hsetupi of the form \entrymodifiers={ hmodifieri* }

@hdirectioni

This will set the orientation of the rows to hdirectioni Exercise 32: How did the author typeset the fol-
lowing matrix?
()*+
/.-,
(the default corresponds to r, i.e., rows are oriented
left to right).
B

()*+
/.-, /.-,
()*+

25.4 Entries 
A ?? D
??
()*+
/.-,
The appearance of a single entry can be modified by ??
entering it as
C
* hobjecti hposi hdecori
Bug: The four constructions @*[. . . ], **[. . . ],
This makes the particular entry ignore the entry mod- @* hadd opi hsizei, and, **{. . . }, accumulate in re-
ifiers and typeset as a kernel object with the same verse order . Only entries starting with a single *
reference point as the (center of) the default object completely override the modifiers hsetupi with a @*-
would have had. construction.
Additional object hmodifieris may be added to an Finally, the following is specially suited for ‘one-
otherwise ordinary entry by using the forms line’ matrices included in text:

@1
**[hshapei] hentryi

50
will insert a ‘math strut’ (\vphantom() into each en- PIC [5] language because it uses a notion of the ‘cur-
try to make its centering appropriate for text. rent location’ and is based on ‘moves’. But the central
This is just an abbreviation using the following construction is a ‘map’ combinator that is borrowed
declaration which will setup hdecori that should be from functional programming.
inserted before everything else in each entry. Initially XY-graph makes use of facilities of the ‘arrow’ fea-
it is empty but ture option of §23, which is therefore required.
Figure 17 summarises the syntax of a hgraphi with
\everyentry={ hdecori } notes below. A hgraphi can appear either in an XY-
picture (as hdecori) or “stand-alone”.13 Note: If
will insert hdecori first in each entry; inside the you use \xygraph{. . . } inside constructions where &
counter registers \Row and \Col are set to the current is significant (like plain TEX’s \halign or LATEX’s
entry’s row and column, respectively. For example, array environment) then make sure to add an extra
level of braces around it.
\everyentry={{\the\Row,\the\Col}}
\xymatrix @*[F]@*[o] {
{} \POS[];[r]**\dir{..} & \\ Notes
{} \POS[];[ur]**\dir{--} 26a. A move is to establish a new current node.
}

?>=<
89:; 89:;
?>=<
26b. To draw something is simply to draw a line or
will typeset
the specified harrowi from the current node to the
1, 1 1, 2
{ specified target node. The target then becomes
{
{ the current node. All the features of arrows as
89:;
?>=<
{
{ described in §23 can be used, in particular ar-
2, 1 rows can be labelled and segmented, but with
Note: When using compilation, changes to the change that hpath-posi means hnodei as ex-
\everyentry and \entrymodifiers will not result plained in note §23e.
in recompilation even when the constructed matrix 26c. To map over a list is simply to save the cur-
changes – you may have to remove the .xyc file man- rent node and then interpret the hlisti with the
ually. following convention:

Exercise 33: How did the author typeset the fol- • Start each element of the list with the cur-
lowing diagram? rent node as saved and p as the previous list
element, and
rootWWWW+
GF
/ : • let the ? hnodei refer to the saved current
node explicitly.
ED

ED BC
26d. The & and \\ special moves are included to
• make it simple to enter ‘matrix-like’ things as

@A BC
1 o graphs – note that they will not be automati-
cally aligned, however, for that you should use
the !M escape.
Hints: The arrow feature was used to make the bend- & is the same as [r] and \\ is the same as
ing arrows and the frame extension for the frames [r]!{y+(0,-1)-(0,0)} which uses a kernel es-
around each cell. cape to moves to the first column in the next row
(where the first column is on the y-axis of the
current coordinate system).
26 Graph feature Note: If you use the form *{. . . } for nodes then
you don’t have to change them if you decide to
Vers. 3.7 by Kristoffer H. Rose hkrisrose@brics.dki use an XY-matrix.
Load as: \xyoption{graph}
26e. Typeset hiti and make it the current node. Also
This option implements ‘XY-graph’, a special combi- saves hiti for later reference using "hidi": if hiti
natoric drawing language suitable for diagrams like is a simple letter, or digit, then just as "hiti"; if
flow charts, directed graphs, and various forms of hiti is of the form {text} or *. . . {text} then as
trees. The base of the language is reminiscent of the "text".
13 In fact LATEX users can use a graph environment.

51
Syntax Action
\xygraph{hgraphi} typeset hgraphi
hgraphi −→ hstepi* interpret hstepis in sequence
hstepi −→ hnodei move26a to the hnodei
| -harrowi hnodei hlabelsi draw26b line to hnodei, with hlabelsi
| :harrowi hnodei hlabelsi draw26b harrowi to hnodei, with hlabelsi
| ( hlisti ) map26c current node over hlisti
hnodei −→ [ hmovei ] new node hmoveid relative to current
| & | \\ new node in next column/row26d
| "hidi" previously saved26e node
| ? currently mapped26c node
| hnodei hiti hnodei with hiti typeset and saved26e there
| hnodei = "hidi" hnodei saved26e as "hidi"
| hnodei ! hescapei augment node with material in another mode
hmovei −→ hhopi* hhopis26f (dulr) from current node
| hhopi* hplacei hmovei do hhopis26f but use its hplacei and hmovei again
hlisti −→ hgraphi , hlisti | hgraphi list of subgraphs26c
hescapei −→ { hposi hdecori } perform hposi hdecori26g
| M hmatrixi insert hmatrixi26h
| P hpolygoni insert hpolygoni26i
| E hellipsei insert hellipsei26i
| ~ hsetupi setup parameters26j

Figure 17: hgraphis

With the = addition it is possible to save explic- To Do: Describe the use of hmoveis with hplaceis
itly in case several nodes have the same text or in detail . . . in particular (1) ‘until perpendicular
a node has a text that it is impractical to use for to . . . ’ and (2) ‘until intercepts with . . . ’ can be
reference. In fact using the form hiti="hidi" will coded. . .
only save the node as "hidi" and not as "hiti"! As
a special convenience "" (thus the empty hidi) al- 26g. This ‘escapes’ into the XY-pic kernel language
ways refers to the last completed node, so adding and interprets the hposi hdecori. The current
="" after a node merely means it should not be node is then set to the resulting c object and the
saved under its proper name. grid from the resulting base.
The effect of the hposi hdecori can be completely
hidden from XY-graph by entering it as {\save
Exercise 34: How did the author typeset this?
hposi hdecori \restore}.
( (
Ak A A 26h. It is possible to insert a hmatrixi in a graph
provided the ‘matrix’ option described in §25 has
been loaded: it overwrites the node with the re-
26f. Moving by a series of hops is simply mov- sult of \xymatrixhmatrixi. Afterwards the graph
ing in a grid as the sequence of dulr (for grid is set as the top left ‘square’ of the matrix,
down/up/left/right) indicates. The grid is a i.e., with [d] and [r] adjusted as they work in
standard cartesian coordinate system with 3pc the top left entry.
unit unless the current base is redefined using Bug: [dr] immediately after the matrix will
[]!{. . . } with an appropriate hposiition contain- work as expected, e.g., make the center of "2,2"
ing : and :: as described in note 3d. the current node, but others might not, e.g., [rr]

52
will not necessarily place the current node on top Exercise 35: Typeset
of "1,3".
w???

26i. It is possible to insert a hpolygoni or an hellipsei
g x1
Wgggsggg O
in a graph provided the poly option described
in §27 or the arc option described in §29 has O z ?g W W
??? WW + WWW
been loaded, respectively: it will have c as the ? ? x2
?  ?
current node, p as the previous one, and the the y
current base has the hhopis [r] and [u] as base
vectors.
Note: lattices, knots, etc., can also be used but
no special syntax is useful since the !{. . . } syntax
is adequate.
27 Polygon feature
26j. This allows setting of some parameters of the
graph: !~hsetupi should be one of the following: Vers. 3.7 by Ross Moore hross@mpce.mq.edu.aui
!~:{ harrowi } include with every : arrow Load as: \xyoption{poly}
!~-{ harrowi } include with every - line
This feature provides a means for specifying the loca-
!~*{ hmodifiersi } include with every non-*
tions of vertices for regular polygons, with any num-
node
!~hletteri{ hgraphi } define new graph escape ber (≥ 3) of sides. Polygons can be easily drawn
!hletteri and/or the vertex positions used to constuct com-
plex graphics within an XY-picture. Many non-regular
These are destructive: the previous value is lost; polygons can be specified by setting a non-square ba-
the default is established by the sequence !~:{} sis.
!~-{@{-}} !~*{+} making : create simple ar-
rows, - plain lines, and formatting default nodes A polygon is most easily specified using . . .
in math mode with the default objectmargin.
The last possibility is also available as a com- \xypolygonhnumberi{} with hnumberi sides;
mand \xypolygonhnumberi{htoki} htoki at vertices;
\newgraphescape{hletteri}{hgraphi} \xypolygonhnumberi{hobjecti}
with a general hobjecti at each vertex;
that makes the specified escape generate the
hgraphi as a macro; with it it is possible to pass
arguments to the hgraphi using the standard TEX Here hnumberi is a sequence of digits, giving the num-
\def method: The declaration code ber of sides. If used within an \xy. . . \endxy envi-
ronment then the polygon will be centred on c, the
\newgraphescape{i}#1#2{
current hposi. However an \xypolygon can be used
[]!{+0="o#2"*=<10pt>{};p!#1**{},"o#2"
outside such an environment, as “stand-alone” poly-
-/4pt/*!E\cir<2pt>{}
gon; the whole picture must be specified within the
+0;p-/:a(-30)24pt/**\dir{-}="X2"
\xypolygon command.
;p-/:a(-60)24pt/="X1"**\dir{-}
In either case the shape is obtained by spacing ver-
;?(.5),="i#2",
tices equally around the “unit circle” with respect to
p-/:a(-60)24pt/**\dir{-},
the current basis. If this basis is non-square then the
"o#2"."i#2"."X1"."X2"}}
vertices will lie on an ellipse. Normally the polygon,
is (rather complicated kernel code) that makes with at most 12 vertices, is oriented so as to have
the node escape !idn typeset an ‘inverter’ ori- a flat base when specified using a standard square
ented with the d corner as the output with input basis. With more than 12 vertices the orientation is
named "in" and output named "on" such that such that the line from the centre to the first vertex
the graph is horizontal, pointing to the right. Any other de-
\xygraph{ []!iR1 ("i1"[l]x - "i1") - [r]z } sired orientation can be obtained, with any number
of vertices, by using the ~={. . . } as described below.
will typeset
MM

MMM The general form for \xypolygon is . . .
x
qqq z
qq
\xypolygonhnumberi"hprefixi"{hswitchesi. . . }
The final exercise illustrates much of the above.

53
where the "hprefixi" and hswitchesi are optional. vHH
Their uses will be described shortly. v vv HHH
v 8 H
vv  888 HHH
vvv  8 HH
A \xypolygon establishes positions for the ver- v  88 HH
v vv j
6 TT HH
tices of a polygon. At the same time various things v
Uv)) UU5jjjj jj 666  T TTTTiiiH
)
  
may be typeset, according to the specified hswitchesi. )) 55  )) 
)) 55 5  )
An hobjecti may be dropped at each vertex, “spokes”
5iiiiH HH
) 
)) v vUUUU
H 
drawn to the centre and successive vertices may Hvvv
be connected as the polygon’s “sides”. Labels and
))
 
))  
breaks can be specified along the spokes and sides. ))
hh h hhhVVVVVVV 
Each vertex is automatically named: "1", "2", )) h 66 
 6
. . . , "hnumberi" with "0" as centre. When a
hprefixi has been given, names "hprefixi0", . . . , \xy /l1.5pc/:,{\xypolygon5"A"{}},
"hprefixihnumberi" are used instead. While the poly- {\xypolygon5"B"{~:{(1.875,0):}~>{}}},
gon is being constructed the macro \xypolynum ex- {\xypolygon5"C"{~:{(-2.95,0):}~>{}}},
pands to the number of sides, while \xypolynode {\xypolygon5"D"{~:{(-3.75,0):}}},
expands to the number of each vertex, spoke and {"A1"\PATH~={**@{-}}’"B1"’"C4"’"B2"},
side at the time it is processed. This occurs in the {"A2"\PATH~={**@{-}}’"B2"’"C5"’"B3"},
following order: vertex 1, spoke 1, vertex 2, spoke 2, {"A3"\PATH~={**@{-}}’"B3"’"C1"’"B4"},
side 1, vertex 3, spoke 3, side 2, . . . , vertex n, spoke n, {"A4"\PATH~={**@{-}}’"B4"’"C2"’"B5"},
side n − 1, side n where the final side joins the last {"A5"\PATH~={**@{-}}’"B5"’"C3"’"B1"},
vertex to the first. "C1";"D1"**@{-},"C2";"D2"**@{-},
The macro \xypolyname holds the name of the "C3";"D3"**@{-},"C4";"D4"**@{-},
polygon, which is hprefixi if supplied. In this "C5";"D5"**@{-} \endxy
case the value of \xypolynum is also stored as
Next a hexagonal pyramid, a rectangular box and
\hprefixiNUMSIDES, accessible outside the polygon.
an octahedral crystal specified as a triangular anti-
As stated above, a polygon with up to 12 ver-
prism. Notice how the ~:{. . . } switch is used to
tices is oriented so as to have a flat base, when drawn
create non-square bases, allowing the illusion of 3D-
using a standard square basis. Its vertices are num-
perspective in the resulting diagrams:
bered in anti-clockwise order, commencing with the
one at horizontal-right of centre, or the smallest angle
$'/ <<
above this (see example below). With more than 12    $'$/' / << 

 $ '' //
 < 
vertices then vertex "1" is located on the horizontal,   $$ '' // <
99 < 
extending to the right from centre (assuming a stan-  \ \\
mHmm \\$$ HH/H/
H  999 
H\ \\\\$ mm  99
dard square basis). By providing a switch of the form m 
~={hanglei} then the vertex "1" will be located on
the unit circle at hanglei◦ anti-clockwise from “hor- \xy/r2pc/: ="A", +(.2,1.5)="B","A",
izontal” — more correctly, from the X-direction in {\xypolygon6{~:{(1,-.1):(0,.33)::}
the basis to be used when setting the polygon, which ~<>{;"B"**@{-}}}}\endxy
may be established using a ~:{. . . } switch. \quad \xy /r2pc/:
{\xypolygon4"A"{~:{(0,.7)::}}},+(.7,1.1),

'!&3%"1#$ '!&2%"1#$
{\xypolygon4"B"{~:{(.8,0):(0,.75)::}}},
•1
1

111 kk 3 SS 2 "A1";"B1"**@{.},"A2";"B2"**@{.},

'!&4"% 1#$ '!&0"%1 #$ '!&1"%$#


11 11 4 11
11 "A3";"B3"**@{.},"A4";"B4"**@{.}
11 %%
5 1 \endxy\quad \xy /r2pc/:

'!&%" #$ '!&%" #$
1
0

11 11
DD {\xypolygon3"A"{~:{(0,.7)::}}},+(.7,1.1),
zz
• • 6 9
2 3
5 6 7 8 {\xypolygon3"B"{~:{(-.85,0):(-.15,.8)::}}}
,"A1"\PATH~={**@{.}}’"B2"’"A3"’"B1"
’"A2"’"B3"’"A1" \endxy
Exercise 36: Give code to typeset these.
One important use of hprefixi is to allow the ver- Vertex object: Unless the first character is ~, sig-
tices of more than one polygon to be accessed sub- nifying a “switch”, then the whole of the braced ma-
sequently within the same picture. Here are some terial is taken as specifying the hobjecti for each ver-
examples of this, incorporating the ~:{. . . } switch tex. It will be typeset with a circular edge using
to perform simple rescalings. Firstly the edges of a \drop[o]..., except when there is just a single token
dodecahedron as a planar graph: htoki. In this case it is dropped as \drop=0{htoki},

54
having zero size. An object can also be dropped at
each vertex using the switch ~*{. . . }, in which case
WSW S JJ
sWz_____ n B Pg PαPP1
s\ s zs \ \W\WWS\WJeWJ\eWSJ-%!
α2
nw nn
it will be circular, with the current objectmargin ap-
s
z eeee  !! -- C EEE ?
%:zee e eeee
plied. A
  ! % --  b"EE  y\yyy S&&& α
##  % : :: α3  E y
  !! % 
The next example illustrates three different ways
 fffK ffffEX
y..yXXX4XX &
7
:## :  ::
of specifying a \circ at the vertices. #:%:: ::   !! %  . t X
:%::: ::  z lz!  99 k+ S... B
D9 G
 :: \:S: \ :\: l\ ll\l 
S\ α4 9  .  α6
UUU:UlSUllS:hlh hzh 
q◦ ◦MMM1 E α5 / F
◦qq
◦) ◦ ◦ ◦? h z

◦11 ◦HH ))  v◦
) R ,,,,,,  ?
H 
HH)  v v ◦ RR ,,lll ◦
◦ vvHv)) HvH ◦
◦ ◦ lR,lR, R
◦111 ◦ vv  ) HH lll,,,, RR
v 
◦  ) ◦ ) ◦ ? ?  ,, ◦

◦MMM q◦
\def\alphanum{\ifcase\xypolynode\or A
◦ ◦qq ◦ ◦ ◦ ◦ \or B\or C\or D\or E\or F\or G\or H\fi}
\xy/r3pc/: {\xypolygon3{~={40}}},
\xy/r2pc/: {\xypolygon12{\circ}}, {\xypolygon4{~={40}~>{{--}}}},
+/r5pc/,{\xypolygon10{~<{-}~>{}{\circ}}}, {\xypolygon5{~={40}}},
+/r5pc/,{\xypolygon8{~*{\circ}~<=}}\endxy {\xypolygon6{~={40}~>{{--}}}},
{\xypolygon11{~={40}}},
{\xypolygon50{~={40}~>.}}, +/r8pc/,
Switches
{\xypolygon7{~<<{@{-}}~><{}
The allowable switches are given in the following ta-
~<>{|*@{x}}~*{\alphanum}
ble:
~>>{_{\alpha_\xypolynode^{}}}}}
~:{. . . } useful for rescaling. \endxy
~*{hobjecti} hobjecti at each vertex. Use of the ~={. . . } switch was described earlier.
~={hanglei} align first vertex. When using the ~:{. . . } more can be done than just
~<{. . . } directional for “spokes”; setting the base. In fact any kernel code can be sup-
~<<{harrowi} use harrowi for spokes; plied here. It is processed prior to any other part of
~<>{. . . } labels & breaks on spokes. the polygon. The graphics state has c at the centre
~>{. . . } directional for “sides”; of the polygon, p at the origin of coordinates within
~><{harrowi} use harrowi for sides; the picture and has basis unchanged from what has
~>>{. . . } labels & breaks on sides. previously been established. The current point c will
be reset to the centre following any code interpreted
Using ~<<{harrowi} or ~><{harrowi} is most ap- using this switch.
propriate when arrowheads are required on the sides
A further simplification exists for sides and spokes
or spokes, or when labels/breaks are required. Here
without harrowis. If htoki is a single character then
harrowi is as in figure 14, so it can be used simply to
~>htoki, ~>{htoki}, ~>{{htoki}} all specify the direc-
specify the style of directional to be used. Thus ~<<{}
tional \dir{htoki}; similarly with the ~< switch. On
sets each spoke as a default arrow, pointing outwards
the other hand, compound directionals require all the
from the centre; ~<<{@{-}} suppresses the arrow-
braces, e.g. ~>{{--}} and ~>{2{.}}.
head, while ~><{@{}} uses an empty arrow along the
sides. Labels and breaks are specified with ~<>{. . . } After all switches have been processed, remaining
and ~>>{. . . }, where the {. . . } use the notation for a tokens are used to specify the hobjecti for each ver-
hlabeli, as in figure 13. tex. Such tokens will be used directly after a \drop,
When no tips or breaks are required then the so can include object hmodifieris as in figure 3. If
switches ~<{. . . } and ~>{. . . } are somewhat faster, an hobjecti has already been specified, using the ~*
since less processing is needed. Labels can still be switch, then the following message will be written to
specified with ~<>{. . . } and ~>>{. . . }, but now us- the TEX log:
ing the kernel’s hplacei notation of figure 1. In fact
any kernel code can be included using these switches. Xy-pic Warning: vertex already specified,
With ~<> the current p and c are the centre and discarding unused tokens:
vertex respectively, while for ~>> they are the cur-
rent vertex and the previous vertex. (The connection
with tokens at the end indicating what remains un-
from vertex "hnumberi" to vertex "1" is done last.)
processed. Similarly extra tokens before the {. . . }
The pyramid above is an example of how this can be
generate a message:
used. Both ~<{. . . } and ~<<{harrowi} can be speci-
fied together, but only the last will actually be used;
similarly for ~>{. . . } and ~><{harrowi}. Xy-pic Warning: discarding unused tokens:

55
Nested Polygons \xypolygon3{~:{/r5.2pc/:}
When \xypolygon is specified within either a ~>{}~<>{?\xypolygon3"a"{~:{(.5,0):}
~<>{. . . } or ~>>{. . . } switch for another polygon, ~>{}~<>{?\xypolygon3"b"{~:{(.5,0):}
then the inner polygon inherits a name which in- ~>{}~<>{?\xypolygon3"c"{~:{(.5,0):}
corporates also the number of the part on which it ~>{}~<>{?\xypolygon3"d"{~:{(.5,0):}
occurs, as given by \xypolynode. This name is ac- ~<>{?*!/d.5pt/=0\hbox{\blacktriangle}}
cessed using \xypolyname. In the following example }} }} }} }} }
the inner polygon is placed using ~<> in order to eas- Note the use of naming in this example; when pro-
ily adjust its orientation to the outward direction of cessing this manual it saves 13,000+ words of main
the spokes. memory and 10,000+ string characters as well as 122
strings and 319 multi-letter control sequences.
2, 2? 1, 3?
 ???  ???
2, 3? ?>=<
89:; 1, 4? 89:;
?>=<
 
2 2, 1 1 1, 2 28 Lattice and web feature
??  ?? 
?  ? 
2, 4 1, 1 Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Load as: \xyoption{web}

3, 1? 4, 4? This feature provides macros to facilitate typesetting


 ???  ???
3, 2? ?>=<
89:; 4, 1? ?>=<
89:;
  of arrangements of points within a 2-dimensional lat-
  tice or “web-like” structure.
3 3, 4 4 4, 3
??  ?? 
?  ?  Currently the only routines implemented with this
3, 3 4, 2 feature are some “quick and dirty” macros for drop-
ping objects at the points of an integer lattice. To
\xypolygon4{~:{/r5pc/:} Do: More sophisticated routines will be developed
~<>{*\frm<8pt>{o}\xypolygon4{~:{/-2pc/:} for later versions of XY-pic, as the need arises.
~*{\xypolyname\xypolynode}}} Mathematically speaking, let ~u and ~v be vectors
[o]=<5pc>{\xypolynode}} pointing in independent directions within the plane.
Then the lattice spanned by ~u and ~v is the infinite
Notice how nested polygons inherit names "1,1", set of points L given by:
"1,2", . . . , "4,1", . . . , "4,4" for their vertices. If 
a hprefixi is supplied at the outermost level then the L = a ~u + b ~v ; for a, b integers .
names become: "hprefixii, j". Specifying a hprefixi
Within XY-pic the vectors ~u and ~v can be established
for the inner polygon overrides this naming scheme.
as the current coordinate basis vectors. The following
The same names may then be repeated for each of
macros typeset a finite subset of an abstract lattice.
the inner polygons, allowing access afterwards only
to the last—possibly useful as a memory saving fea- \xylattice#1#2#3#4 points in lattice
ture when the vertices are not required subsequently. \croplattice#1#2#3#4#5#6#7#8
Four levels of nesting gives a quite acceptable . . . in specific rectangle.
“Sierpinski gasket”. The innermost triangle is pro-
vided by \blacktriangle from the AMS symbol font The parameters #1 . . . #4 are to be integers amin ,
msam5, at 5-point size. Further levels can be achieved amax , bmin and bmax , so that the portion of the lat-
using the PostScript backend, otherwise line seg- tice to be typeset is that collection of vectors in L for
ments become too small to be rendered using XY-fonts. which amin ≤ a ≤ amax and bmin ≤ b ≤ bmax .
1
1 NN1 s(2)
O

1 N1
N
N N

1 NN1 N1 NN1 ◦
N NN
◦ ◦

1 N N1
N
N N N N

1 NN1 1N1 ◦
N NN NN NN
◦ ◦ ◦ ◦
1N NNN NNN1 NN1 NNN NNN1
N N
◦ ◦ ◦
1N NN1 NN1 NN1 NN1 NN1 NN1 NN1
N
◦ ◦
1 NN NN NN NN NN NN NN NN1
N
◦ ◦ ◦ ◦
1 NN1 1 N1
N
◦ ◦
1N NNN NNN1 1 NNN NNN1 ◦
N N
◦ ◦

1 N1 N
1 N1
1 N1 N 1 N1
N N
N
◦ ◦
1 NNN NNN NNN NNN1 1 NNN NNN NNN NNN1 ◦
N N
◦ ◦ ◦

1
N
N1
N

1 N1
1 N
N1
N
1 N1 ◦ ◦ / s(1)
1 NNN NNN1 NN1 NNN NNN1 NN1 NNN NNN1 NN1 NNN NNN1 ◦
N N N N
◦ ◦ ◦

1 N1 N 1
N1 N
1 N1 N
1 N1 N
1 N1 N
1 N1 N
NNN NNN NNN NNN NNN NNN NNN NNN NNN NNN NNN NNN NNN NNN NN1 NN NN1
1 N1 N
N
N
N
◦ ◦ ◦
N ◦ •a
◦ ◦ ◦
◦ ◦ ◦
\font\msamv=msam5 at 5pt ◦ ◦ ◦
◦ ◦ ◦
\def\blacktriangle{{\msamv\char’116}} ◦ ◦ ◦ ◦
◦ ◦
\def\objectstyle{\scriptscriptstyle} ◦ ◦
◦ ◦

56
\def\latticebody{% ,"o"+(0,1)="a"*{\bullet}*+!D{\alpha}
\ifnum\latticeA=1 \ifnum\latticeB=-1 % ,"o"+(1,-1)="b"*{\bullet}*+!L{\beta}
\else\drop{\circ}\fi\else\drop{\circ}\fi} ,"o"+(0,-1)="c","o"+(-1,1)="d"
\xy *\xybox{0;<1.5pc,1mm>:<1mm,1.5pc>:: ,"a"."c"="e",!DR*{};"a"**\dir{.}
,0,{\xylattice{-4}4{-3}3} ,"e",!UL*{};"c"**\dir{.}
,(1,-1)="a"*{\bullet}*+<2pt>!UL{a} ,"b"."d"="f",!DL*{};"b"**\dir{.}
,(-1,1)."a"*\frm{.}}="L" ,"f",!UR*{};"d"**\dir{.}
,{"L"+L \ar "L"+R*+!L{s^{(1)}}} ,"e"."f"*\frm{.}}="L","o"."L"="L"
,{"L"+D \ar "L"+U*+!D{s^{(2)}}} ,{"L"+L \ar "L"+R*+!L{s^{(1)}}}
\endxy ,{"L"+D \ar "L"+U*+!D{s^{(2)}}}
In the above code, notice how the basis is first \endxy
established then the \xylattice typeset. Doing
this within an \xybox allows axes to be sized and The \latticebody macro. At each lattice point
placed appropriately. Since lattice points are deter- within the specified range for a, b (and within the
mined by their (integer) coordinate displacements, cropping rectangle when \croplattice is used), a
they can be revisited to add extra hobjectis into macro called \latticebody is expanded. This is
the overall picture. More generally, the origin for meant to be user-definable, so as to be able to adapt
lattice-coordinates is the current hposi c, when the to any specific requirement. It has a default expan-
\xylattice command is encountered. Easy accessi- sion given by . . .
bility is maintained, as seen in the next example.
\def\latticebody{\drop{\bullet}} .
When the basis vectors ~u and ~v are not perpendic-
ular the collection of points with a, b in these ranges The following macros may be useful when specifying
will fill out a skew parallelogram. Generally it is use- what to do at each point of the lattice.
ful to plot only those points lying within a fixed rect- \latticebody expanded at lattice points
angle. This is the purpose of \croplattice, with its \defaultlatticebody resets to default
extra parameters #5 . . . #8 determining the ‘cropping’ \latticeA a-value of lattice point
rectangle within which lattice points will be typeset. \latticeB b-value of lattice point
Other points will not be typeset even when a and b \latticeX X-coord, offset in pts. . .
are within the specified ranges. Explicitly the hor- \latticeY Y -coord, . . . from lattice
izontal range of the cropping rectangle is Xmin to origin.
Xmax , with Xmin being the X-coordinate of the vec-
As in the examples presented above, the object
tor #5 × ~u, where #5 is a hnumberi (not necessarily
dropped at the lattice point can be varied according
an integer). Similarly Xmax is the X-coordinate of
to its location, or omitted altogether.
#6 × ~u. The vertical extents are Ymin and Ymax , given
In the final example the \latticebody macro per-
by the Y -coordinates of #7×~v and #8×~v respectively.
forms a calculation to decide which lattice points
s(2) should be emphasised:
O ◦
◦ ◦
◦ ◦ ◦ σ (2)
O
◦ .
◦ ◦ .
◦ α ◦ ◦ • .
• . .
◦ ◦ .
◦ ◦ .
◦ / s(1) . .
◦ ◦ . .
•β ◦ .
◦ . .
◦ ◦ ◦ . .
◦ ◦ .
◦ ◦ .
◦ ◦ • .
◦ ◦ . .
◦ .

\def\latticebody{% . • / σ (1)
. •
\ifnum\latticeA=1 \ifnum\latticeB=-1 % .
• .
\else \drop{\circ}\fi\else . .
. .
\ifnum\latticeA=0 \ifnum\latticeB=1\else .
. .
\drop{\circ}\fi\else\drop{\circ}\fi\fi} . .
\xy +(2,2)="o",0*\xybox{% .
.
0;<3pc,1.5mm>:<0.72pc,1.65pc>::,{"o" • .
. .
\croplattice{-4}4{-4}4{-2.6}{2.6}{-3}3} .

57
\def\latticebody{\dimen0=\latticeX pt ,{\ellipse<5pt>{=}}\endxy
\ifdim\dimen0>0pt \divide\dimen0 by 64 The following give circles centred at c.
\dimen0=\latticeY\dimen0 \relax
\ifdim 0pt>\dimen0 \dimen0=-\dimen0 \fi \ellipse<>{hstylei} radius = dist(p, c)
\ifdim 10pt>\dimen0 \drop{\bullet}% \ellipse<hdimeni>{..} radius is the hdimeni
\else\drop{.}\fi \else\drop{.}\fi} \ellipse(hnumi){hstylei} unit circle scaled hnumi,
\xy*\xybox{0;<3pc,2.57mm>:<.83pc,2.25pc>:: in the current basis.
,0,{\croplattice{-3}5{-5}5
{-1.3}{4.5}{-3.4}{4.4}}}="L" Note that if the current basis is not square then the
,{"L"+L \ar "L"+!R*+!L{\sigma^{(1)}}} latter variant, namely \ellipse(hnumi), will type-
,{"L"+D \ar "L"+!U*+!D{\sigma^{(2)}}} set an ellipse rather than a circle. On the other hand
\endxy the first two variants always specify true circles. In
the 2nd case, i.e. when hdimeni is hemptyi, the size
of the object at p is taken into account when drawing
the circle; if this is not desired then kill the size using
29 Circle, Ellipse, Arc feature a null object, e.g. ;*{};.
Currently the \ellipse macro works only as a
Vers. 3.4 by Ross Moore hross@mpce.mq.edu.aui hdecori. In future versions there will be an hobjecti
Load as: \xyoption{arc} called \arc having elliptical shape, via \circleEdge
This feature provides a means to a specify circles of with possibly unequal extents. Also it will be possible
arbitrary radius, drawn with a variety of line styles. to \connect\arc, which will set the current connec-
Similarly ellipses may be specified, having arbitrary tion so that any place on the full ellipse, not just the
major/minor axes aligned in any direction. A circu- visible sector, will be accessible using an extension to
lar arc joining two points can be constructed with the usual hplacei mechanism.
specified tangent direction at one end. To Do: make this be!!
All the curves described here—circles, ellipses and
sectors of these—are constructed using the curves 29.2 Ellipses
from the xycurve extension. As such any com-
There are several ways to specify an ellipse, apart
ments given there concerning memory requirements
from the method illustrated above in which the ba-
are equally valid here, perhaps even more so. Use
sis must be changed from square. Basically we must
of the xyps PostScript back-end is highly recom-
specify the lengths of the major and minor axes. Also
mended.
it is necessary to specify an alignment for one axis.
In the following, the ellipse is centred on c and one
29.1 Full Circles
axis is aligned along the line pc, except with the final
The xyarc feature allows a much wider range of pos- variant where it aligns with the current basis. When
sibilities for typesetting circles than is available with used hnumi is treated as a scale factor, multiplying
\cir. Firstly the radius is no longer restricted to a an appropriate length.
finite collection of sizes. Secondly fancy line (curve)
styles are available, as with curved arrows. Finally \ellipse<hdimeni,hdimeni>{..} given axes lengths
there are a variety of ways of specifying the desired \ellipse<,hdimeni>{hstylei} one axis is pc
radius, relative to other parts of the picture being \ellipse(,hnumi){hstylei} ...perp. axis scaled
built, as in the following example. \ellipse(hnumi,hnumi){..} scaled axes aligned
with basis.
p?
•? In the latter variant, if the second hnumi is
??
?? hemptyi then this is equivalent to both hnumis hav-
??
? ing the same value, which is in turn equivalent to the
• c
final variant for circles.

p
•?
??
??
??
\xy 0;/r5pc/:*\dir{*}="p",*+!DR{p}; ?

p+(.5,-.5)*\dir{*}="c",*+++!L{c}**\dir{-} c
,{\ellipse<>{:}},{\ellipse(.5){}}
,0;(.5,.5)::,"p";"c",{\ellipse(.5){.}}

58
\xy 0;/r5pc/:*\dir{*},*++!DR(.5){p} ,"o"+(1.5,.2)*\dir{*}="a"*+!UL{a}
*\frm{-};p+(.5,-.5)*\dir{*}="c", ,"o";p+/_1pc/,**{},"a",{\ellipse_{}}
**\dir{-},*+!UL{c},"c", \endxy
,{\ellipse(1,.4){:}},{\ellipse(,.75){}} Note how the remainder of the circle can be specified
,{\ellipse<15pt,10pt>{=}} separately. The example also shows how to specify
;*{};{\ellipse<,10pt>{.}}\endxy an arc which leaves a particular point perpendicular
to a specific direction.
29.3 Circular and Elliptical Arcs Slightly more complicated is when the tangent di-
rection at p is specified, but different from the current
The xyarc feature handles arcs to be specified in
direction; a unique circular arc can still be defined.
two essentially different ways, according to what in-
More complicated is when a specific tangent direction
formation is provided by the user. We call these
is required also at c. In this case the arc produced is
the “radius-unknown/end-points known” and the
a segment of an ellipse. (If the required tangent at
“radius-known/end-points unknown” cases.
p points to c then a straight segment is drawn, as in
the circular case described above.)
radius unknown, end-points known
The simplest case, though not necessarily the most \ellipsehdirip ,horienti{..} circular
common, is that of a circular arc from p to c, with ra- \ellipsehdirip ,horienti,hdiric {..} elliptical
dius and centre unspecified. To uniquely specify the \ellipsehdirip ,horientihdiric {..} elliptical
arc, the tangent direction at p is taken to be along the \ellipsehdirip ,horienti,=hdiric {..} elliptical
current direction, given by \Direction, as set by the \ellipse‘hcoordihorienti{..} elliptical
latest hconnectiion. If no connection has been used,
then the default hdirectioni is “up”. In these cases hdirip and hdiric are hdirectioni spec-
ifications, as in figure 3 and note 4l, and horienti
\ellipse_{hstylei} clockwise arc from p to c must be either ^ or _ for anti-/clockwise respec-
\ellipse^{hstylei} counter-clockwise arc tively, defaulting to ^ if hemptyi. Beware that
\ellipse{hstylei} also counter-clockwise the (*hposihdecori*) form must be used for this
hdirectioni variant, as if an object modifier.
With this information only, a unique circle can be The second and third cases in the above table gen-
found whose radius and centre need not be specified erally give identical results. The second ‘,’ is thus
in advance. For a unique arc it is sufficient to specify optional, except in two specific situations:
the orientation around the circle. 1. horienti is empty and hdiric has ^ or _ as the
The exception is when the current direction is first token;
from p to c, in which case no circle exists. Instead a
straight line is typeset accompanied by the following 2. horienti is ^ and hdiric has ^ as first token.
message: Without the , then ^^ would be interpreted
by TEX as part of a special ligature for a hex-
Xy-pic Warning: straight arc encountered adecimal character code.

The following example shows how, given three If both horienti and hdiric are hemptyi then even the
points o, p and c, to continue the line op by a cir- first ‘,’ can be omitted.
cular arc to c joining smoothly at p.


c
• c
•??
p ?? •??
??
?? • p ???
? a ??

o ??

o
\xy 0;/r5pc/:*=+\dir{*}*+!UR{p};
p+(.5,-.5)*\dir{*}="o",*+!UL{o} \xy 0;/r5pc/:*=<8.1pt>\dir{*}="p",*\frm{-}
,+(0,.81)*=<6.1pt>\dir{*}*\frm{-}="c" ,*++!U{p},"p";p+(.5,-.5)*+\dir{*}="o"
,*+!DL{c},"o",**\dir{-}, ,*+!UL{o},+(0,.81)*=<8.1pt>\dir{*}="c"
"c",{\ellipse_{}},{\ellipse^{.}} ,*\frm{-},*++!L{c},"o"**\dir{-},"c"
% ,{\ellipse :a(50),_:0{:}}

59
,{\ellipse :a(30),_:a(-45){}} The final variant uses the directions from p and c
,{\ellipse :a(40),_{.}}, to the given hcoordi. If horienti is hemptyi then the
;*{};{\ellipse :a(20),^=_{=}}\endxy orientation is determined to give the shortest path
Note that only the slope of hdirip and hdiric is along the ellipse. Specifying an horienti of ^ or _ will
significant; rotations by 180◦ being immaterial. force the orientation, even if this means travelling ‘the
long way’ around the ellipse. For example, see next
figure.
c bbbbbbbbbb• q
•bbb
Alternative curves In some cases the circular or
elliptic curve can be replaced by a curve with differ-
•?
p ??? ent shape, having the same tangent directions at the
??
?? end-points. When a full circle/ellipse is specified then
?
• o one gets instead a closed curve constructed from 4
spline segments. Other variants use a single segment,
\xy 0;/r5pc/:*\dir{*}="p",*+!UR{p} 2 or 3 segments, or some portion of all 4 segments.
;p+(.5,-.5)*\dir{*}="o",*++!L{o}**\dir{-} Possibilities are given in the following table.
,p+(.5,.5)*\dir{*}="c",*++!D{c},"c" \ellipse~e ...{h..i} elliptical, as above
;p+(1,.1)*\dir{*}="q",*++!L{q}**\dir{-} \ellipse~q ...{h..i} parabolic segments
,"o";"p",**{};"c" \ellipse~c ...{h..i} cubic segments
,{\ellipse![["o";"p"]],_![["q";"c"]]{}} \ellipse~i ...{h..i} interpolating cubic
,{\ellipse![["o";"p"]],![["c";"q"]]{.}} \ellipse~p ...{h..i} cuspidal cubic
\endxy \ellipse~c(hnumi)...{h..i} cubic segments,
The = variant establishes the hdirectioni parsing with “looseness”
to begin with the direction resulting from hdirip in- In the latter case the hnumi, typically between 0
stead of the original direction. If hdiric is required to and 1, controls how soon the curve begins to bend
be the original direction then use :0. It cannot be away from the tangent direction. Smaller values give
hemptyi since this is interpreted as requiring a circu- tighter curves — 0 for straight lines — with ~c be-
lar arc with unspecified tangent at c; see the example ing the same as ~c(1) and ~q is ~c(.66667), that is
above. However when hdirip and hdiric are parallel hnumi= 23 .
there is a whole family14 of possible ellipses with the The curve produced by the “interpolating” vari-
specified tangents. ant ~i actually passes through the control point "x",
With no further hint available, a choice is made with slope parallel to the line pc. Since the tan-
based on the distance between p and c. If the required gents at p and c point toward "x" the curvature is
direction is perpendicular to pc this choice results in a quite gentle until near "x" where the curve bends
circular arc. The optional factor in =(hnumi) is used rapidly, yet smoothly. This is obtained also by using
to alter this choice; the default (1) is assumed when ~c(1.33333), that is hnumi= 43 . Since <num> > 1
nothing follows the =. This factor is used to “stretch” the “convex hull property” does not hold; indeed the
the ellipse along the specified direction. For a nega- curve is entirely outside the convex hull of p, c and
tive hnumi the orientation reverses. "x", apart from those points themselves.
The ‘cuspidal’ variant ~p is equivalent to ~c(2).
c It exhibits a cusp. For <num> > 2 the curve is so

“loose” that it exhibits loops. (The author offers no
•?? guarantees on the usefulness of such curves for any
p ??
?? particular purpose; however they do look nice. ^¨)
??
?

o

\xy ;/r5pc/:*+=<10.1pt>\dir{*}="p";p*\frm{-}

,*++!UR{p},p+(.5,-.5)*\dir{*}="o",**\dir{-} p
,*+!UL{o},+(0,.81)*=<8.1pt>\dir{*}="c" _
,*\frm{-},*++!DL{c},"c"

,{\ellipse r,={}},{\ellipse r,=(2){.}} c
,{\ellipse r,^=(3){.}},{\ellipse r,=(-2){}}
,{\ellipse r,=(-1){.}}\endxy
14 Indeed this is always so. The algorithm used for the general case tends toward parallel lines—clearly unsuitable.

60
\xy 0;/r6pc/:*+\dir{*}="p",*+!UR{p},"p"; ellipse/circle. Reversing the horienti no longer gives
p+(.5,-.5)*+\dir{*}="c",*+!UL{c} the complementary arc, but this complement rotated
,"p"+(.825,-.25)="x"*\dir{+},"c" 180◦ .
,{\xycompile{\ellipse‘"x"{-}}} p?
•?
,{\xycompile{\ellipse~q‘"x"^{.}}} ??
??
,{\xycompile{\ellipse~c‘"x"{.}}} ??
,{\xycompile{\ellipse~c(.3)‘"x"^{:}}} ?

,{\xycompile{\ellipse~c(2.3)‘"x"{-}}} c
,{\xycompile{\ellipse~i‘"x"^{.}}}
,{\xycompile{\ellipse~p‘"x"^{-}}}
\endxy
Hint: When exploring to find the best location \xy 0;/r5pc/:*\dir{*}="p",*+!DR{p};
for the “control-point” (e.g. the "x" in the above ex- p+(.5,-.5)*\dir{*}="c",*+!UL{c}**\dir{-}
ample), then use \xycompile as shown, changing the ,"c",{\ellipse<15pt>_,=:a(45){=}}
location outside of the compilation. This speeds up ,{\ellipse<>__,=:a(30){-}}
the reprocessing with the changed value. ,{\ellipse(1,.4){.}}
,{\ellipse(1,.4)_,=:a(120){-}}
,{\ellipse(,.75){.}}
Avoiding overflows If hdirip and hdiric are in- ,{\ellipse(,.75)_,^,^{-}}\endxy
tended to be equal then the method of the previ-
ous paragraph should be used. However it may hap-
pen that “nearly parallel” directions may be specified,
perhaps by accident. There is then the possibility of 30 Knots and Links feature
“numerical overflow” or a “division by zero” error.
The latter may be accompanied by a warning mes- Vers. 3.4 by Ross Moore hross@mpce.mq.edu.aui
sage: Load as: \xyoption{knot}

Xy-pic Warning: division by 0 in This feature provides a language for specifying knots,
links and general arrangements of crossing strings.
\intersect@, replaced by 50
This knot feature is really a ‘construction kit’,
providing pieces which may be placed appropriately
This indicates that the number 50 has been used
to form knots and links. The types of pieces pro-
as the result of a division by zero. In many con-
vided are of two kinds: the “crossings”, representing
texts this will produce an acceptable result. How-
one string crossing over or under another; and “joins”
ever it may lead to an “overflow” in other situa-
which are used to connect what would otherwise be
tions, or to drawing beyond the normal page bound-
loose ends. Several types of each are provided, along
ary. This can be controlled using a hdecori of type
with a simple way of specifying where to place arrow-
,{\zeroDivideLimit{hnumi}}, prior to specifying
heads and labels.
the \ellipse. The value 50 will be replaced by hnumi
All the pieces ultimately use curves from the
whenever a “division by zero” would otherwise be en-
curve extension, usually indirectly via the arrow fea-
countered in an intersection calculation.
ture. As such, processing can be memory-intensive
and may seem rather slow. All the warnings and ad-
radius known, end-points unknown vice given elsewhere on techniques to handle pages
The language for these is a combination of most and individual diagrams with many curves are espe-
of that used above, but the interpretation of the cially applicable when using this feature.
hdirectionis is different... 
2
\ellipse<hradiusi>hdiri1 ,horienti,hdiri2 {..}
\ellipse<hradiusi>hdiri1 ,horienti,=hdiri2 {..} J 
M
g
where hradiusi is one of the forms used above to de-
scribe a circle or ellipse. Not all of the ellipse will be simple link figure-8 knot cinquefoil
typeset—only that arc starting with hdiri1 as tangent
vector, tracing via horienti until the tangent points in
Crossings
direction hdiri2 . This effectively extends the notation
used with \cir in 6.2. Note that rotating a given A “crossing” is intended to represent two strings pass-
hdirii by 180◦ specifies a different arc on the same ing close by, but not meeting. The macros provided

61
Syntax Action
hknot-piecei −→ hpieceihscaleihknot-labelsi interpret knot-piece
hpiecei −→ hcrossingi | hjoini piece is a crossing30a or a join30l
hscalei −→ hemptyi | - | [hnumi] invert or scale the knot piece30b ;
| ~hposihposihposihposi alter size and shape30c using the hposis
hknot-labelsi −→ hemptyi | hknot-tipsihknot-labelsi arrowtips at ends, aligned with orientation
| hwhereihwhatihknot-labelsi list30k of arrowtips, breaks and labels30e
| @hadjustihknot-labelsi adjust hole30d position for a hcrossingi;
adjust other parameter30n for a hjoini.
hknot-tipsi −→ == | =! arrowtips30k at both/neither end
| =< | => arrowtips30k also at start/finish
hwherei −→ | | |hadjusti ‘over’ string on a hcrossingi;30f
middle30m place on a hjoini.
| < | <hadjusti initial portion of ‘under’ string on a hcrossingi;30f
earlier30m place on a hjoini.
| > | >hadjusti final portion of ‘under’ string on a hcrossingi;30f
later30m place on a hjoini.
hadjusti −→ (+hnumi) | (-hnumi) adjustment30k from current value of parameter
| (=hnumi) | (hnumi) set parameter value30k
hwhati −→ >|< arrowhead aligned with/against orientation30i
| \knothole | \khole leave hole in the string30j
| {htexti} set30g htexti as label, using \labelstyle
| {*hobjecti} drop hobjecti30h
| {hanchorihiti} hbreaki or label30h as on an harrowi
| | null-break30k

Figure 18: hknot-piecei construction set

specify typesetting within a square cell of coordinate the final letter indicating which for the \xover..
values; using a non-square basis alters this shape, but families.
see also note 30c below, for the technique that was Furthermore there is a natural orientation for
used in the “cinquefoil” example above. each crossing, as well as along each strand. This
corresponds to the order in which ink is ap-
Notes plied to the printed page, following the natural
parametrization of each strand as a curved con-
30a. Several families of crossing are provided. Those nection or arrow. This orientation determines
having names as \v... and \h... are designed whether a crossing is ‘over’ (mathematically, pos-
to stack respectively vertically and horizontally. itive or right-handed) or ‘under’ (mathematically,
More precisely the current hposi starts at the top- negative or left-handed). It is used in determin-
left corner and finishes at either the bottom-left ing the location of labels and the direction of
or top-right. Say that a crossing is either a ‘verti- arrowheads placed along the strings. Note that
cal crossing’ or ‘horizontal crossing’ respectively. \..cross.. and \..twist.. crossings may set
This certainly applies to the \..cross.. and the same curves, but with different orientation
\..twist.. families, see figure 19 in which the and label-positioning.
strings enter and leave the square all with vertical Figure 19 displays the orientation on all the
tangents or all with horizontal tangents. Indeed crossings, grouping them into subfamilies con-
all crossings are either vertical or horizontal, with sisting of right-handed, left-handed and non-

62
F F E f 7 f 7 e z :
z
x  y y
z y y z y
x F y  z  x E z f 7 e
x x x
\vcross \vcrossneg \vuncross \hcross \hcrossneg \huncross

z7 ( y
7 y
:
x x  x x
y  z z  y  z
y x7 ( ( x:
$z
y z
\vtwist \vtwistneg \vuntwist \htwist \htwistneg \huntwist

    x   ?  ? y
9
x y y x y y z x y
 ? x9
  z  %z
z z x z
\xoverv \xunderv \xunoverv \xoverh \xunderh \xunoverh

z1 x- y
3 z3
Q
y
4 z4
S
z y
J y y J z K M
x
x z j x j k
x y x
\vover \vunder \vunover \hover \hunder \hunover

Figure 19: knot crossings with orientations and label positions

crossings. Also indicated are the default po- bel or arrow-tip specifiers, see below). Vertical
sitions for labels and arrow-tips; each piece crossings remain vertical under scalings; the cur-
uses the same code for tips and labels, e.g. rent hposi still moves by 1 coordinate unit in the
\vover<>|>>><{x}|{y}>{z}. ‘down’ direction. Similarly horizontal crossings
The \x... crossings do not stack easily since remain horizontal. The single character - is a
their tangents are at 45◦ to the coordinate axes. shorthand version for [-1], effectively giving a
It is the last letter in the name which denotes half-turn rotation in a rectangular basis.
whether the particular crossing is vertical or hor- 30c. A knot-piece need not be rectangular. By spec-
izontal. On the other hand \vover , \vunder ifying ~hposi1 hpos2 ihpos3 ihpos4 i the four corners
etc. stack vertically on top of a \vcross , UL, UR, DL, DR are set to the given hposis respec-
\vtwist etc.; similarly \hover stacks at the left tively. The local basis is established so that
of \hcross , \htwist etc.
r–hop ↔ 21 hpos2 i − hpos1 i + hpos4 i − hpos3 i


u–hop ↔ 12 hpos1 i − hpos3 i + hpos2 i − hpos1 i .




30d. With a non-rectangularly shaped piece it will


usually be necessary to adjust the place where the
‘hole’ occurs in the ‘under’ string. This is done
by specifying @(hnumi), with 0 ≤ hnumi ≤ 1 be-
$$\xy 0;/r1pc/: ing the parameter value of the new location for
,{\vunder\vtwist\vtwist\vunder-}\endxy the hole.
\qquad\qquad\qquad \xy 0;/r1pc/:+(0,-1.5)
,{\hover\hcross\hcross\hover-}\endxy$$ 30e. The knot feature allows for the easy placement
of the following objects along the strings of a
30b. The above examples also show how to use - crossing:
to get the mirror-image of a particular crossing.
• labels on the strings;
Any numerical scale factor can be used by en-
closing it within [..] e.g. [2.3] scaling a sin- • arrowheads for direction or orientation;
gle piece without affecting the rest of the pic- • holes in strings, allowing another string to
ture. The scale-factor must occur before any la- be drawn passing over.

63
30f. The characters <, > and | are used to indi- parameter position. On the ‘crossed’ string this
cate to which string portion the object is asso- includes the automatic ‘hole’ to create space for
ciated; with | denoting the string which crosses the other string. Hence it is advisable to use just
the other, while < and > denote the initial and the (+..) and (-..) variants for small adjust-
final portions of the ‘crossed’ string. ments, and to keep these correctly ordered.

30g. A simple label enclosed in braces, for exam- Adjustment of position along the strings can be
achieved using a hfactori, as in \vover|(+.1)>.
ple \vcross>{x}, is set in math-mode using the
Allowed syntax is (hsignihnumi) where hsigni is
\labelstyle, at a pre-determined place on the
+ or - to increment or decrement from the pre-
string portion, shifted in either the ‘above’ or ‘be-
defined value. Also allowable are = or hemptyi to
low’ direction from the curve at this point. (For
set the parameter position to hnumi, which must
each crossing depicted in figure 19 only default
lie between 0 and 1 to have any meaning.
values are used for the place and shift-direction.)
Arrowheads can also be placed at either, or both,
30h. If the first character within the braces {..} ends of of the strings forming a crossing. This is
is * e.g. \htwist>{*hobjecti}, then a general governed by a pair of booleans, initially {FF}. It
hobjecti may be placed as a label. Furthermore is changed for all subsequent strings in a diagram
if the first character is ^ or _ or |, then the in- by \knottips{..} where the recognised values
terpretation is, e.g. \vtwist<{^hanchorihiti}, as are {FF}, {FT}, {TF} and {TT}, denoting tips (T)
in 14 to place hiti as a label along an \ar of the or not (F) at the start and end of each string.
arrow feature. To add arrowtips at the start of strings in a par-
ticular crossing, append the 2-character combi-
30i. A second character < or > specifies that an ar-
nation =< ; similarly => adds tips at the ends, if
rowhead should appear at the pre-determined
not already requested. The combinations == and
place on the chosen string. Here > denotes
=! specify both ({TT}) and none ({FF}) respec-
an arrowhead pointing with the natural orien-
tively. These 2-character pairs can be mixed in
tation, while < points against. Due to the
with any specifications for labels and breaks, etc.
curvature of the strings, it is usually best to
Multiple pairs compound their effect; in particu-
\UseComputerModernTips rather than normal
lar =<=> gives the same result as ==, while =!=<
arrow-tips.
is needed to change {FT} into {TF}.
30j. To generate a ‘hole’ use \knothole, or simply These are best used with single pieces, as in the
\khole, as following token. This generates a following equation.
‘break’, in the sense of 23j. Indeed such a ‘hole’ is h / i h / i h / i
used to separate the two portions of the ‘crossed’ ∇ / − ∇ / = −z ∇ /
string. Default size for the hole is 5pt, which is al-
terable via \knotholesize{hdimeni}; normally \UseComputerModernTips \knottips{FT}
used to set the size for all holes in a diagram. \def\Conway#1{\mathord{\nabla\Bigl[\,
30k. If the resulting \khole is either too large or \raise5pt\xybox{0;/r1pc/:#1}\,\Bigr]}}
perhaps non-existent, this could be due to a tech- $$
nicality in the way breaks in curves are handled. \Conway\htwist - \Conway\htwistneg
This problem should not occur with the standard \;=\; -z\,\Conway\huntwist $$
crossings, using a rectangular basis, but it may
occur with non-rectangular bases. An easy ‘fix’
is to include an extra null-break on the string,
Joins
using <|, >| or ||, which should place the zero-
30l. The “joins” are used to connect the loose ends of
sized break at parameter value .5 on the curve. crossing strings. In particular “loops” and “caps”
The specification should precede a \khole at a
are for placing on ends of horizontal or vertical
higher parameter value, or come after one at a ‘twist’ and ‘cross’ crossings, leaving the current
lower value.
hposi fixed. The “bends” join non-adjacent cross-
Multiple breaks, arrow-heads and labels may be ings of the same type, either horizontal or verti-
specified along the two strings of a crossing; sim- cal.
ply place their specifications one after another; The \xcap.. pieces are designed to join adja-
e.g. <>|>>><{x}|{y}>{z} was used in figure 19. cent \xover.. pieces; they move c either verti-
The only proviso is that all ‘breaks’ along a sin- cally or horizontally, as appropriate. Finally the
gle strand must occur with increasing order of \xbend.. pieces allow for smooth joins of 45◦

64
?


o
y
? x  Nz ? zn ? ? xp ?
◦ 
◦ 
◦ 
◦ 

TO z
z  P x
zt yo j x */4
xy z /
O y J xy
x
y 
 y 
?


?

◦ y 0 z
.
x z
\vloop \vcap \vcap- \vloop- \hloop \hcap \hcap- \hloop-

◦Y z
?
 C ?

# ;
yz
◦ x
Oy x y+ # x; 3 K yz y
E C  z? y
y
o e x
_ x
z
z ? ◦ ◦ x  ◦ _
\xcapv \sbendv \zbendv \sbendh \zbendh \xcaph

O O ◦ y 3
z kz g y
K x  x = 7
◦ ◦ ◦ ◦ ◦S ◦x ◦
G yz y z W y  ax
! } A z y
] z
x ' + O o/ sz w y x
x o/ x o/ o/ O
y z
\xbendr \xbendl \xbendu \xbendd \xbendd- \xbendu- \xbendl- \xbendr-

Figure 20: knot joins, with orientations, labels and shifts

slopes to horizontal or vertical slopes. For these piece value effect on. . .
the actual positioning of the piece, see figure 20, \..cap .25 flatness of cap;
is not entirely obvious. \..loop .75 flatness of loop;
Figure 20 displays the orientation on the joins. \sbend.. .75 curvature in the ‘s’;
Also indicated are default positions for labels and \zbend.. .75 curvature in the ‘z’;
arrow-tips; each piece uses the same code, e.g. \xcap.. .5 height of cap, slope at base;
\vloop <>|>>><{x}|{y}>{z}. Furthermore the \xbend.. .5 curvature, slope at base.
current hposi before the piece is drawn is marked
? _
using ◦ ; that afterwards is indicated by  or . The following example gives three ways of spec-
ifying a ‘trefoil’ knot, using the poly feature to es-
The ability to scale in size and place arrow-tips, tablish the location of the vertices for knot-pieces.
breaks, labels etc. apply also to hjoini pieces. In each the hcrossingis are calculated to fit together
The only difference is. . . smoothly; a different way of creating hjoinis is used
30m. The three places referred to by < ,| ,> are all on in each. Also the third displays subtle changes of the
30n join control.
a single string. In particular | is always at the
middle of the hjoini, whereas < and > are at ear-
lier and later parameter values respectively. Any
adjustments30k involving breaks should occur in
increasing parameter order.
30n. A parameter can be altered, using @hadjusti,
to effect subtle adjustments to the shape of any \def\TrefoilA{\xygraph{!{0;/r.75pc/:}
join. Within a rectangular basis the horizontal !P3"a"{~>{}}!P9"b"{~:{(1.3288,0):}~>{}}
or vertical tangents are preserved and overall re- !P3"c"{~:{(2.5,0):}~>{}}
flection or rotation symmetry is preserved. Thus !{\vover~{"b2"}{"b1"}{"a1"}{"a3"}}
this parameter affects the ‘flatness’ of a cap or !{"b4";"b2"**\crv{"c1"}}
loop, or the amount of curvature is s-bends and !{\vover~{"b5"}{"b4"}{"a2"}{"a1"}}
z-bends. For \xcap..s and \xbend..s the 45◦ !{"b7";"b5"**\crv{"c2"}}
angle is altered; this is especially useful to match !{\vover~{"b8"}{"b7"}{"a3"}{"a2"}}
the tangents when a knot-piece has been specified !{"b1";"b8"**\crv{"c3"}}}}
using the technique of note 30c. %
The normal range for these parameters is be- \def\TrefoilB{\xygraph{!{0;/r.75pc/:}
tween 0 and 1. Other values can be used with in- !P3"a"{~>{}}!P9"b"{~:{(1.3288,0):}~>{}}
teresting results—the parameter determines the !P3"c"{~:{(2.5,0):}~>{}}
location of control points for a Bézier cubic curve. !{\vover~{"b2"}{"b1"}{"a1"}{"a3"}}

65
!{\vcap~{"c1"}{"c1"}{"b4"}{"b2"}@(+.1)} hdiagional direction, using 5pt turns. The connec-
!{\vover~{"b5"}{"b4"}{"a2"}{"a1"}} tor contains only horizontal or vertical lines and 18
!{\vcap~{"c2"}{"c2"}{"b7"}{"b5"}@(+.2)} sectors of circles of the given (optional) hturnradiusi.
!{\vover~{"b8"}{"b7"}{"a3"}{"a2"}} Bug: Any labels are placed at the end of the con-
!{\vcap~{"c3"}{"c3"}{"b1"}{"b8"}}}} nection.
% Bug: This code should probably be merged with
\def\TrefoilC{\xygraph{!{0;/r.75pc/:} the ‘arrow’ feature.
!P3"a"{~>{}}
!P12"b"{~:{(1.414,0):}~>{}}
!{\vover~{"b2"}{"b1"}{"a1"}{"a3"}} Part IV
!{\save 0;"b2"-"b5":"b5",
\xcaph @(+.1)\restore}
!{\vover~{"b6"}{"b5"}{"a2"}{"a1"}}
Drivers
!{\save 0;"b6"-"b9":"b9",
This part describes ‘drivers’ that customise the parts
\xcaph @(+.2)\restore}
of the DVI file generated from XY-pictures to exploit
!{\vover~{"b10"}{"b9"}{"a3"}{"a2"}}
special capabilities of particular DVI driver programs
!{\save 0;"b10"-"b1":"b1",
through TEXś \special command. This makes the
\xcaph @(+.3)\restore} }}
DVI files non-portable but is needed for full support
$$\TrefoilA\quad\TrefoilB
of some of the XY-pic extensions (described in part II).
\quad\TrefoilC$$
Figure 21 at the end of this part summarises the
extensions supported by all drivers.
Changing the string-style
It is not necessary to use solid curves; any style avail- 32 Support for Specific Drivers
able to curves and arrows can be chosen using. . .
32.1 dvidrv driver
\knotstyle{hchari} use \dir{hchari} Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
\knotstyles{hchari}{hchari} two styles Load as: \xyoption{dvidrv}
\knotSTYLE{hcodei} use hcodei
This driver provides support for the “emtex”
In each case the new style applies to all subse- \special commands, when using one of the stan-
quent knot pieces, except that the two styles apply dard dvi-drivers: dvidot, dvihplj, dvimsp, dviscr
only to crossings. The latter case allows use of ob- or dvivik, that come with Eberhard Mattes’ em-TEX
ject hmodifieris. The hcodei consists of two groups distribution.
{..}{..} , each containing harrowi forms, as in 14 Supported \special effects are...
and notes 23m, 23r. Only the first harrowi form is • em-TEX line-drawing \specials.
used with hjoinis whereas the two forms are used re- • variable line-widths
spectively with the two strings of a hcrossingi in the
order that they are drawn.
32.2 DVIPS driver
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
31 Smart Path option Load as: \xyoption{dvips}
This driver provides support for all extensions when
Vers. 0.0 by George C. Necula hnecula@cs.cmu.edui
using the dvips driver by Tomas Rokicki [11]. It has
Load as: \xyoption{smartpath}
been tested with dvips version 5.55a and dvipsk ver-
This extends the ‘arrow’ feature, which is there- sion 5.58f.
fore required, with a “smart” hpathi between two Supported \special effects are...
hposiitions. • colour, using direct color specials and PostScript.
The hturni syntax is extended with the construc- • crayon colours.
tion
• PostScript back-end.
hturni −→‘s hdiagi _ hdiagi hturnradiusi • rotated/scaled diagrams and text, using Post-
Script.
\arin_out/5pt which draws a connector leaving p in • variable line-widths and poly-lines, using Post-
the in hdiagional direction and arrives at c in the out Script.

66
• extra frames and fills, using PostScript. of using the dvips hdriveri, which does support all
• patterns and tiles, using PostScript. the PostScript effects available in XY-pic.
Note: To use XY-pic effectively with OzTEX re-
• tpic drawing commands. quires changing several memory parameters. In par-
• em-TEX drawing commands. ticular a ‘Big-TEX’ is needed, along with an increase
in the pool_size parameter. Explicit instructions
are contained in the file INSTALL.OzTeX of the XY-pic
32.3 DVITOPS driver distribution.
Supported \special effects are...
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
• colour, using PostScript, but not of font-
Load as: \xyoption{dvitops}
characters.
This file provides support for the dvitops driver by • crayon colours, similarly restricted.
James Clark. As of September 1995, it has not been
fully tested. • PostScript back-end.
Supported \special effects are... • variable line-widths and poly-lines, using Post-
Script.
• colour, using direct color specials for gray, rgb and
hsb colour models; and PostScript colour within • extra frames and fills, using PostScript.
diagrams; • patterns and tiles, using PostScript.
• crayon colours. • rotated/scaled diagrams and text, recognised but
• PostScript back-end. not supported.

• rotated/scaled diagrams and text, using dvitops


specials; however these may not be nested. 32.5 OzTeX v1.7 driver
• variable line-widths and poly-lines, using Post- Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Script. Load as: \xyoption{17oztex}
• extra frames and fills, using PostScript. This option provides the necessary interface to sup-
• patterns and tiles, using PostScript port the PostScript back-end and other Post-
Script effects when using the DVI driver of ver-
• tpic drawing commands.
sion 1.7 of OzTEX by Andrew Trevorrow,16 Later
versions of OzTEX should instead use the driver op-
32.4 OzTeX driver tion \xyoption{oztex}. Upgrading to version 1.9+
ofOzTEX is recommended.
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui Does not support rotations, scaling and coloured
Load as: \xyoption{oztex} text within diagrams and the PostScript dictionary
must be available in a file called global.ps.
This driver provides the necessary interface to sup-
Note: To use XY-pic effectively with OzTEX re-
port the PostScript back-end and other Post-
quires changing several memory parameters. In par-
Script effects when using the DVI driver of versions
ticular a ‘Big-TEX’ is needed, along with an increase
1.8+ of OzTEX by Andrew Trevorrow,15 Earlier ver-
in the pool_size parameter. Explicit instructions
sions of OzTEX should instead use the driver option
are contained in the file INSTALL.OzTeX of the XY-pic
\xyoption{17oztex}.
distribution.
Effects such as colour, line-thickness and rotated
Supported \special effects are...
or scaled diagrams are only partially supported in
that the effects cannot be applied to any text or sym- • colour, using PostScript, but not of font-
bols placed using fonts. This is due to the nature characters.
of OzTEX hdriveri, whose optimization of the place- • crayon colours, similarly restricted.
ment of font-characters precludes the applicability of • PostScript back-end.
such effects. Furthermore the PostScript dictionary
must be available in a file called global.ps or ap- • variable line-widths and poly-lines, using Post-
pended to the OzTeXdict.pro. However with ver- Script.
sion 1.8 and later of OzTEX, there is the alternative • extra frames and fills, using PostScript.
15 OzT X is a shareware implementation of T X for Macintosh available from many bulletin boards and ftp sites; v1.5 and earlier
E E
versions were freeware. Email contact: hakt@kagi.comi.
16 OzT X is a shareware implementation of T X for Macintosh available from many bulletin boards and ftp sites; v1.5 and earlier
E E
versions were freeware. Email contact: hakt@kagi.comi.

67
• patterns and tiles, using PostScript. • extra frames and fills, using PostScript.
• rotated/scaled diagrams and text, recognised but • patterns and tiles, using PostScript.
not supported.

32.6 Textures driver 32.8 XDVI driver


Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Load as: \xyoption{textures}
Load as: \xyoption{xdvi}
This driver provides support for version 1.7+ of
Blue Sky Research’s Textures application for Mac- This driver provides support for extensions when us-
intosh17 . It incorporates support for colour and ing variants of the xdvi driver, by Eric Cooper, Bob
all of XY-pic’s PostScript effects. Earlier versions Scheifler, Mark Eichin and others. It has been used
of Textures should instead use the driver option successfully with xdvi patchlevel 20, by Paul Vojta,
\xyoption{16textures}. and xdvik version 18f, by Karl Berry.
Notice that version 1.7 suffers from a printing bug Some of the supported features assume that the
which may cause a PostScript error. A fix is kludged implementation of xdvi is linked to a PostScript
by making sure the first page has been shown in the renderer; e.g. Ghostscript or Display PostScript. If
viewer before any pages with diagrams are sent to the such support is not available, then invoking xdvi us-
printer. ing the command xdvi -hushspecials will suppress
Supported \special effects are... warning messages that might otherwise be produced.
One drawback of such a setup is that much of the
• colour, both on-screen and with PostScript
PostScript is not rendered until after all of the font
• crayon colours. characters, etc. have been placed on the page. Thus
• PostScript back-end. text that was meant to be placed on top of a filled
or patterned region may appear to be obscured by it.
• rotated/scaled diagrams and text, using Post-
However when printed, using a PostScript printer,
Script.
the correct placement is obtained.
• variable line-widths and poly-lines, using Post- Supported \special effects are...
Script.
• extra frames and fills, using PostScript. • colour, using PostScript.
• patterns and tiles, using PostScript. Not all versions of xdvi support color \specials,
so there is no direct support for colour. However
parts of pictures rendered using PostScript may
32.7 Textures v1.6 driver appear coloured, due to interpretation of colour
commands within the PostScript.
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Load as: \xyoption{16textures} • crayon colours.
This driver provides support for versions 1.5b and
• PostScript back-end.
1.6 of Blue Sky Research’s Textures application for
Macintosh18 . It incorporates support for PostScript • rotated/scaled diagrams and text, using Post-
colour and the XY-ps PostScript back-end. This will Script.
not work with versions 1.7 and later; these require
the hdriveri option \xyoption{textures}. • variable line-widths and poly-lines, using Post-
Supported \special effects are... Script.
• colour, using PostScript • extra frames and fills, using PostScript.
• crayon colours.
• patterns and tiles, using PostScript.
• PostScript back-end.
• rotated/scaled diagrams and text, using Post- • tpic drawing commands.
Script.
• variable line-widths and poly-lines, using Post- The following TEX implementation is also supported,
Script. but currently uses the dvips driver.
17 Macintosh is a trademark of Apple Computer Inc.
18 Macintosh is a trademark of Apple Computer Inc.

68

hdriveri
hextensioni frame line rotate color tile ps
dvidrv - + - - - -
dvips + + + + + +
dvitops + + + + + +
oztex + + + + + +
17oztex + + + + + +
textures + + + + + +
16textures + + + + + +
xdvi + + + + + +

Figure 21: Extension implementation replaced by use of hdriveri specials.

32.9 CMacTeX driver PostScript escape


An extra hshapei modifier key allows arbitrary Post-
Vers. 3.3 by Ross Moore hross@mpce.mq.edu.aui
Script code to be applied to the current hobjecti.
Load as: \xyoption{cmactex}
[!hpostscript codei] for special effects
Thomas Kiffe’s CMacTEX application uses dvips as [psxy] stores current location.
its dvi-driver.

Normally the hpostscript codei will be a simple com-


Other implementations not specifically mentioned mand to alter the PostScript graphics state: e.g.
here may well work with one of the named hdriveris, [!1 0 0 setrgbcolor] changes the colour used to
though perhaps not all features will actually be sup- render parts of the hobjecti. Any number of such
ported. hshapei modifiers is allowable, however it is more ef-
ficient to combine them into a single modifier, when-
ever possible.
It is very important that braces { and } do not
33 Extra features using Post- appear explicitly in any hpostscript codei, as this may
upset the XY-pic hobjecti parsing. However it is ac-
Script drivers ceptable to have a control sequence name here, ex-
panding into more intricate PostScript code. This
This section acknowledges the support for extra fea- will not be expanded until a later (safe) time.
tures available when using a hdriveri that supports Due to differences within the DVI-drivers, such
use of \special commands with native PostScript. simple PostScript commands need not affect every
Extra macros are required to take advantage of this; part of an hobjecti. In particular the lines, curves and
these are loaded automatically in conjunction with arrowheads generated by XY-pic use a different mech-
extensions specified using the \xyoption command, anism, which should give the same result with all
provided a hdriveri which supports the extension, as drivers. This involves redefining some PostScript
indicated in 21, has also been specified. procedures which are always read prior to rendering
Commands are also provided to turn off/on use one of these objects. One simple way to specify a
of these features. Such switches are particularly use- red line is as follows; the xycolor extension provides
ful when developing complicated diagrams, or when more sophisticated support for colour. The hshapei
the intended output device does not support Post- modifiers described in the previous section also use
Script; e.g. for on-screen display. Alternatively, this mechanism, so should work correctly with all
when attempting to use drivers for which no explicit drivers.
support has been provided, some features may work \def\colorxy(#1){%
others may not. Please inform the authors of XY-pic /xycolor{#1 setrgbcolor}def}
of any successes or failures of such attempts. ...
The included file xyps-ps.tex (version3.7) pro- \connect[!\colorxy(1 0 0)]\dir{-}
vides support for PostScript \special commands ...
used by the ps backend extension as well as Post- Note how the braces are inserted within the expan-
Script-based options, to produce special effects not sion of the control sequence \colorxy, which happens
available directly with TEX. after parsing of the hconnectioni. The following table

69
shows which graphics parameters are treated in this to turn off this support, the following commands are
way, their default settings, and the type of Post- available; they obey usual TEX groupings.
Script code needed to change them.
\NoPSframes remove PostScript support
colour /xycolor{0 setgray}def \UsePSframes reinstate PostScript.
line-width /xywidth{.4 setlinewidth}def
dashing /xydash{[] 0 setdash}def Without PostScript support ellipses may be shown
line-cap /xycap{1 setlinecap}def as circles and all filled regions may be represented
line-join /xyjoin{1 setlinejoin}def as black rectangles. These commands are provided
primarily for testing and trouble-shooting; e.g. with
This feature is meant primarily for modifying the hdriveri configurations untested by the authors of XY-
rendering of objects specified in TEX and XY-pic, not pic, who should be notified of any difficulties.
for drawing new objects within PostScript. No
guarantee can be given of the current location, or 33.3 Line-styles
scale, which may be different with different drivers.
However a good PostScript programmer will be The included file xyps-l.tex (version 3.7) provides
able to overcome such difficulties and do much more. PostScript support for the effects defined in the
To aid in this the special modifier [psxy] is provided line extension described in §11.
to record the location where the reference point of This file is loaded and its effects are activated au-
the current hobjecti will be placed. Its coordinates tomatically whenever \xyoption{line} is requested
are stored with keys xyXpos and xyYpos. and the current hdriveri supports PostScript line
styles. Should there be any need to turn off this
support, the following commands are available; they
33.1 Colour obey usual TEX groupings.
The included file xyps-c.tex (version 3.7) provides \NoPSlines remove PostScript support
PostScript support for the effects defined in the \UsePSlines reinstate PostScript.
color extension in §13.
This file is loaded and its effects are activated Without PostScript support lines can be expected
automatically whenever \xyoption{color} is re- to be displayed in the default style, having thickness
quested and the current hdriveri supports colours us- of .4pt. These commands are provided primarily for
ing PostScript. Should there be any need to turn testing and trouble-shooting; e.g. with hdriveri con-
off this support, the following commands are avail- figurations untested by the authors of XY-pic, who
able; they obey usual TEX groupings. should be notified of any difficulties.

\NoPScolor remove PostScript support


\UsePScolor reinstate PostScript. 33.4 Rotations and scaling
The included file xyps-r.tex (version 3.7) provides
Without PostScript support some drivers may still PostScript support for the effects defined in the
be able to provide some support for colours. These rotate extension described in §12.
commands are not guaranteed to work adequately This file is loaded and its effects are activated
with all drivers. They are provided primarily for test- automatically whenever \xyoption{rotate} is re-
ing and trouble-shooting; e.g. with hdriveri configu- quested and the current hdriveri supports Post-
rations untested by the authors of XY-pic, who should Script rotations. Should there be any need to turn
be notified of any difficulties. off this support, the following commands are avail-
able; they obey usual TEX groupings.

33.2 Frames \NoPSrotate remove PostScript support


\UsePSrotate reinstate PostScript.
The included file xyps-f.tex (version 3.7) provides
PostScript support for the effects defined in the Without PostScript support diagrams can be
frame extension described in §9. It implements some expected to be displayed unrotated and unscaled.
effects otherwise unattainable. These commands are provided primarily for testing
This file is loaded and its effects are activated and trouble-shooting; e.g. with hdriveri configura-
automatically whenever \xyoption{frame} is re- tions untested by the authors of XY-pic, who should
quested and the current hdriveri supports Post- be notified of persistent difficulties.
Script effects for frames. Should there be any need

70
33.5 Patterns and tiles Answer to exercise 2 (p.7): Use the hposiition
<X,Y >+"ob".
The included file xyps-t.tex (version 3.7) provides
PostScript support for the effects defined in the
tile extension described in §14.
Answer to exercise 3 (p.7): It first sets c accord-
This file is loaded and its effects are activated au-
ing to “. . . ”. Then it changes c to the point right of
tomatically whenever \xyoption{tile} is requested
c at the same distance from the right edge of c as its
and the current hdriveri supports PostScript pat-
width, w, i.e.,
terns. Should there be any need to turn off this
support, the following commands are available; they
obey usual TEX groupings. |The
{z. . . }| {z }×
w w
\NoPStiles remove PostScript support
\UsePStiles reinstate PostScript.
Answer to exercise 4 (p.9): The hcoordi
Without PostScript support tile patterns can be “{"A";"B": "C";"D", x}” returns the cross point.
expected to be displayed as solid black. These com- Here is how the author typeset the diagram in the
mands are provided primarily for testing and trouble- exercise:
shooting; e.g. with hdriveri configurations untested by
the authors of XY-pic, who should be notified of any \xy
difficulties. %
% set up and mark A, B, C, and D:
(0,0)="A" *\cir<1pt>{}*+!DR{A},
34 Extra features using tpic (7,10)="B" *\cir<1pt>{}*+!DR{B},
(13,8)="C" *\cir<1pt>{}*+!DL{C},
drivers (15,4)="D" *\cir<1pt>{}*+!DL{D},
%
Similarly a few extensions are supported better when % goto intersection and name+circle it:
\special commands in the tpic format are sup- {"A";"B":"C";"D",x} ="I" *\cir<3pt>{},
ported. %
% make dotted lines:
34.1 frames. "I";"A"**{} +/1pc/;-/1pc/ **@{..},
"I";"D"**{} +/1pc/;-/1pc/ **@{..}
The included file xytp-f.tex (version 3.3) pro-
%
vides tpic support for some of the effects de-
\endxy
fined in the frame extension. This file is loaded
and its effects are activated automatically when- A ?!. . . hplacei could also have been used.
ever \xyoption{frame} is requested and the current
hdriveri supports both tpic and frames. Should there
be any need to turn off this support, the following Answer to exercise 5 (p.9): To copy the p value
commands are available; they obey usual TEX group- to c, i.e., equivalent to “p”.
ings.

\NoTPICframes remove tpic support Answer to exercise 6 (p.10): When using the
\UseTPICframes reinstate tpic. kernel connections that are all straight there is no
difference, e.g., **{}?< and **{}+E denote exactly
the same position. However, for other connections it
is not necessarily the case that the point where the
connection enters the current object, denoted by ?<,
Appendices and the point where the straight line from p enters
the object, denoted by +E, coincide.
A Answers to all exercises
Answer to exercise 1 (p.7): In the default setup Answer to exercise 7 (p.10): The code typesets
they are all denote the reference point of the XY- the picture
picture but the cartesian coordinate hposi (0,0) de- •
notes the point origo that may be changed to some- Box
thing else using the : operator.

71
Answer to exercise 8 (p.11): This does the job, Answer to exercise 15 (p.18): One way is to add
saving each point to make the previous point avail- extra half circles skewed such that they create the il-
able for the next piece: lusion of a shade:
\xy $$\xy
@={(0,-10),(10,3),(20,-5)}, *\cir<5pt>{}
s0="prev" @@{;"prev";**@{-}="prev"} *!<-.2pt,.2pt>\cir<5pt>{dr^ul}
\endxy *!<-.4pt,.4pt>\cir<5pt>{dr^ul}
Notice how we close the line by first saving s0, the *!<-.6pt,.6pt>\cir<5pt>{dr^ul}
last point visited, such that the first point will be \endxy$$
connected to it.
Answer to exercise 16 (p.21): This is the code
Answer to exercise 9 (p.11): The author used that was actually used:

\xy ={.{+DL(2)}.{+UR(2)}}"dbl", \xy (0,20)*[o]+{A};(60,0)*[o]+{B}="B"


*+<3pc,2pc>{+}*\frm{.}, "dbl"*\frm{--} **\crv{} \POS?(.4)*_+!UR{0},"B"
\endxy **\crv{(30,30)} \POS?*^+!D{1},"B"
**\crv{(20,40)&(40,40)} \POS?*^+!D{2},"B"
to typeset the figure in the exercise. **\crv{(10,20)&(30,20)&(50,-20)&(60,-10)}
\POS?*+^!UR{4} \endxy
Answer to exercise 10 (p.13): The first type-
sets “a” centered around 0 and then moves c to the Answer to exercise 17 (p.21): This is the code
lower right corner, the second typesets “a” above the that was used to typeset the picture:
0 point and does not change c. With a “+” at 0 they
a and a+.
look like this: + \xy (0,20)*+{A};(60,0)*+{B}
**\crv{(10,20)&(30,20)&(50,-20)&(60,-10)}
?<*\dir{<} ?>*\dir{>}
Answer to exercise 11 (p.13): They have the ?(.65)*{\oplus} *!LD!/^-5pt/{x}
outlines ?(.65)/12pt/*{\oplus} *!LD!/^-5pt/{x’}
P P
+ and + ?(.28)*=0{\otimes}-/40pt/*+{Q}="q"
+/100pt/*+{P};"q" **\dir{-}
because the first is enlarged by the positive offset to
\endxy
the upper right corner and the second by the negative
offset to the lower left corner.
Answer to exercise 18 (p.21): Here is the code
Answer to exercise 12 (p.14): The first has no that was used to typeset the picture:
effect since the direction is set to be that of a vector \def\ssz#1{\hbox{$_{^{#1}}$}}
in the current direction, however, the second reverses \xy (0,0)*+{A};(30,-10)*+{B}="B",**\dir{-},
the current direction. "B"**\crv{(5,20)&(20,25)&(35,20)}
?<(0)*\dir{<}="a" ?>(1)*\dir{>}="h"
Answer to exercise 13 (p.15): None in both ?(.1)*\dir{<}="b" ?(.9)*\dir{>}="i"
cases. ?(.2)*\dir{<}="c" ?(.8)*\dir{>}="j"
?(.3)*\dir{<}="d" ?(.7)*\dir{>}="k"
?(.4)*\dir{<}="e" ?(.6)*\dir{>}="l"
Answer to exercise 14 (p.18): One way is ?(.5)*\dir{|}="f",
$$\xy "a"*!RC\txt{\ssz{(\lt)}};
*{+}; p+(6,3)*{+} **{} ?(1) "h"*!LC\txt{\ssz{\;(\gt)}},**\dir{.},
*@{-} *!/-5pt/^\dir{-} "b"*!RD{\ssz{.1}};
*^\dir{-} *!/^-5pt/\dir{-} "i"*!L{\ssz{\;.9}},**\dir{-},
\endxy$$ "c"*!RD{\ssz{.2}};
"j"*!L{\ssz{\;.8}},**\dir{-},
Thus we first create the two +s as p and c and
"d"*!RD{\ssz{.3}};
connect them with the dummy connection **{} to
"k"*!L{\ssz{\;.7}},**\dir{-},
setup the direction parameters. Then we move ‘on
"e"*!RD{\ssz{.4}};
top of c’ with ?(1) and position the four sides of the
"l"*!LD{\ssz{.6}},**\dir{-},
square using ^ and _ for local direction changes and
"f"*!D!/^-3pt/{\ssz{.5}}
/hdimeni/ for skewing the resulting object by moving
\endxy
its reference point in the opposite direction.

72
Answer to exercise 19 (p.26): Here is how: The trick is getting the arrow head right: the :
\xy modifier to the explicit \dir hobjecti does that.
(0,0) *++={A} *\frm{o} ;
(10,7) *++={B} *\frm{o} **\frm{.} Answer to exercise 24 (p.40): The author did
\endxy \xy(0,0)
\ar @{-->} (30,7) ^A="a"
\POS(10,12)*+\txt{label} \ar "a"
Answer to exercise 20 (p.26): The *\cir {} op-
\endxy
eration changes c to be round whereas *\frm {o}
does not change c at all.
Answer to exercise 25 (p.41): Here is the entire
XY-picture of the exercise:
Answer to exercise 21 (p.26): Here is how:
\xy ;<1pc,0pc>:
\xy
\POS(0,0)*+{A}
(0,0) *+++{A} ;
\ar +(-2,3)*+{A’}*\cir{}
(10,7) *+++{B} **\frm{.}
\ar @2 +( 0,3)*+{A’’}*\cir{}
**\frm{^\}} ; **\frm{_\}}
\ar @3 +( 2,3)*+{A’’’}*\cir{}
\endxy
\POS(6,0)*+{B}
The trick in the last line is to ensure that the ref- \ar @1{||.>>} +(-2,3)*+{B’}*\cir{}
erence point of the merged object to be braced is the \ar @2{||.>>} +( 0,3)*+{B’’}*\cir{}
right one in each case. \ar @3{||.>>} +( 2,3)*+{B’’’}*\cir{}
\endxy
Answer to exercise 22 (p.30): This is how the The first batch use the default {->} specification.
author specified the diagram:
\UseCrayolaColors Answer to exercise 26 (p.42): The author used
\xy\drop[*1.25]\xybox{\POS \newdir{ >}{{}*!/-5pt/\dir{>}}
(0,0)*{A};(100,40)*{B}**{}
?<<*[@_][red][o]=<5pt>{\heartsuit};
?>>>*[@_][Plum][o]=<3pt>{\clubsuit} Answer to exercise 27 (p.42): The author used
**[|*][|.5pt][thicker]\dir{-}, \xy
?(.1)*[left]!RD\txt{label 1}*[red]\frm{.} \ar @{>>*\composite{\dir{x}*\dir{+}}<<}
?(.2)*[!gsave newpath (20,7)
xyXpos xyYpos moveto 50 dup rlineto \endxy
20 setlinewidth 0 0 1 setrgbcolor stroke
grestore][psxy]{.},
?(.2)*[@]\txt{label 2}*[red]\frm{.}, Answer to exercise 28 (p.42): The author used
?(.2)*[BurntOrange]{*}, \xy *{\circ}="b" \ar@(ur,ul) c
?(.3)*[halfsize]\txt{label 3}*[red]\frm{.} \ar@{.>}@(dr,ul) (20,0)*{\bullet}
?(.375)*[flip]\txt{label 4}*[red]\frm{.} \endxy
?(.5)*[dblsize]\txt{label 5}*[red]\frm{.}
Note that it is essential that the curving specification
?(.5)*[WildStrawberry]{*},
comes after the arrow style.
?(.7)*[hflip]\txt{label 6}*[red]\frm{.}
?(.8)*[vflip]\txt{label 7}*[red]\frm{.}
?(.9)*[right]!LD\txt{label 8}*[red]\frm{.} Answer to exercise 29 (p.46): Here is the code
?(.5)*[@][*.66667]!/^30pt/ used to typeset the pasting diagram in figure 15.
\txt{special effect: aligned text} \xymatrixrowsep{1.5pc}
*[red]\frm{.} \xymatrixcolsep{3pc}
}\endxy \diagram
&&\relax\rtwocell<0>^{f_3^{}\;\;}{\omit}
&\relax\ddtwocell<0>{\omit}
Answer to exercise 23 (p.40): Here is what the \drtwocell<0>^{\;\;f_4^{}}{<3>}
author did: \ddrrtwocell<\omit>{<8>}\\
\xy *+{A}*\cir<10pt>{}="me" &&&&\relax\drtwocell<0>^{\;\;f_5^{}}{\omit}\\
\PATH ‘ul^ur,"me" "me" |>*:(1,-.25)\dir{>} A \uurrlowertwocell<-6>{\omit}\relax
\endxy \uurrcompositemap<2>_{f_1^{}}^{f_2^{}}{<.5>}

73
\drtwocell<0>_{g_1^{}\;}{\omit} Answer to exercise 32 (p.50): Modifiers are
&&&\relax\urtwocell<0>{\omit} used to make all entries round with a frame – the
&&\relax\rtwocell<0>^{f_6^{}\;}{\omit} general form is used to ensure that the sequence is
&\relax\rlowertwocell<-3>_{g_4^{}}{<-1>} well-defined. Finally the matrix is rotated to make it
\rcompositemap<6>_{f_7^{}}^{f_8^{}}{\omit} possible to enter it as a simple square:
& B \\ \entrymodifiers={=<1pc>[o][F-]}
&\relax\urrtwocell<0>{\omit} \xymatrix @ur {
\xcompositemap[-1,4]{}% A \save[];[r] **\dir{-},
<-4.5>_{g_2^{}}^{g_3^{}}{\omit}\\ [];[dr]**\dir{-},
\enddiagram [];[d] **\dir{-}\restore
& B \\
For the straight arrows, it would have been simpler
C & D }
to use \..to provided xyarrow has been loaded. In-
stead \..twocell<0>...{\omit } was used to illus-
trate the versatility of nudging and \omit ; thus
xy2cell can completely handle a wide range of di- Answer to exercise 33 (p.51): Here is how:
agrams, without requiring xyarrow. Note also the \xymatrix @W=3pc @H=1pc @R=0pc @*[F-] {%
use of \relax at the start of each new cell, to avoid : \save+<-4pc,1pc>*\hbox{\it root}
premature expansion of a complicated macro, which \ar[]
can upset the compiling mechanism. \restore
\\
Answer to exercise 30 (p.47): Here is the code {\bullet}
used by the author to set the first diagram. \save*{}
\ar‘r[dd]+/r4pc/‘[dd][dd]
{\uppercurveobject{{?}} \restore
\lowercurveobject{{\circ}} \\
\xymatrixcolsep{5pc} {\bullet}
\xymatrixrowsep{2pc} \save*{}
\diagram \ar‘r[d]+/r3pc/‘[d]+/d2pc/
\relax\txt{ FUn }\rtwocell<8>{!\&} ‘[uu]+/l3pc/‘[uu][uu]
& \relax\txt{ gaMES } \restore
\enddiagram} \\
Here is the code used for the second diagram. 1 }
\xymatrixcolsep{2.5pc}
\xymatrixrowsep{4pc}
\diagram Answer to exercise 34 (p.52): The first A was
\relax\txt<1.5cm>{\bf Ground State} named to allow reference from the last:
\rrtwocell<12>~^{+{}~**!/-2.5pt/\dir{>}}
\xygraph{
~_{++{}~**!/5pt/\dir{<<}}
[]A="A1" :@/^/ [r]A
^{<1.5>\txt{\small continuous power}}
:@/^/ [r]A
_{<1.5>\txt{\small pulsed emission}}{!}
:@/^/ "A1" }
& \relax\;\; N\!i\,C\!d\;\; \Circled
& \relax\txt<1.50cm>{\bf Excited State}
\enddiagram
Answer to exercise 35 (p.53): The author did
\SelectTips{cm}{}
Answer to exercise 31 (p.50): The author did \objectmargin={1pt}
\xymatrix @!=1pc { \xygraph{ !{0;(.77,-.77):0}
**[l] A\times B !~:{@{-}|@{>}}
\ar[r]^{/A} \ar[d]_{/B} w (:[r(.6)]{x_1}
& B \ar[d]^{\times A} ,:[d]z:[r]y:[u(.6)]{x_2}:"x_1":"z"
\\ :@( {"w";"z"}, {"y";"z"})"z":"x_2") }
A \ar[r]_{B\times}
It also shows that one can use {}s inside delimited
& **[r] B\times A
arguments provided one adds a space to avoid the {}s
}
being shaved off!

74
Answer to exercise 36 (p.54): Here is the code • The version 2.6 * position operator is not avail-
actually used to typeset the \xypolygon s, within an able. The version 2.6 construction t0 ;t1 *(x,y)
\xygraph . It illustrates three different ways to place should be replaced by the rather long but equiv-
the numbers. Other ways are also possible. alent construction
\def\objectstyle{\scriptscriptstyle} { t0 ;p+/r/: t1 ="1";p+/u/,x;(0,0);:
\xy \xygraph{!{/r2pc/:} "1";p+/r/,y;(0,0);:: (x,y)}
[] !P3"A"{\bullet}
"A1"!{+U*++!D{1}} "A2"!{+LD*+!RU{2}} In most cases t0 ;t1 **{}?(x), possibly with a
"A3"!{+RD*+!LU{3}} "A0" trailing +/^ . . . /, suffices instead.
[rrr]*{0}*\cir<5pt>{}
!P6"B"{~<-\cir<5pt>{}} • Using t0 ;t1 :(x,y) as the target of an arrow
"B1"1 "B2"2 "B3"3 "B4"4 "B5"5 "B6"6 "B0" command does not work. Enclose it in braces,
[rrr]0 !P9"C"{~*{\xypolynode}}}\endxy i.e., write
{ t0 ; t1 :(x,y)}

B Version 2 Compatibility • The older \pit, \apit, and \bpit commands


are not defined. Use \dir{>} (or \tip) with
Vers. 3.4 by Kristoffer H. Rose hkrisrose@brics.dki variants and rotation.
Load as: \xyoption{v2}
• The even older notation where an argument in
This appendix describes the special backwards com- braces to \rto and the others was automati-
patibility with XY-pic version 2: diagrams written ac- cally taken to be a ‘tail’ is not supported. Use
cording to the “Typesetting diagrams with XY-pic: the supported |<. . . notation.
User’s Manual” [13] should typeset correctly with this
loaded. The compatibility is available either as an If you do not use these features then your version 2
XY-option or through the special files xypic.sty and (and earlier) diagrams should typeset the same with
xypic.tex described below. this option loaded except that sometimes the spac-
There are a few exceptions to the compatibility: ing with version 3 is slightly different from that of
the features described in §B.1 below are not provided version 2.6 which had some spacing bugs.
because they are not as useful as the author originally
thought and thus virtually never used. And one extra B.2 Obsolete kernel features
command is provided to speed up typesetting of doc-
The following things are added to the kernel by this
uments with XY-pic version 2 diagrams by allowing
option and described here: idioms, obsolete positions,
the new compilation functionality with old diagrams.
obsolete connections, and obsolete objects. For each
The remaining sections list all the obsolete com-
we show the suggested way of doing the same thing
mands and suggest ways to achieve the same things
without this option:
using XY-pic 3.7, i.e., without the use of this option.
They are grouped as to what part of XY-pic replaces
them; the compilation command is described last. Removed AMS-TEX idioms
Note: “version 2” is meant to cover all public Some idioms from AMS-TEX are no longer used
releases of XY-pic in 1991 and 1992, i.e., version 1.40 by XY-pic: the definition commands \define
and versions 2.1 through 2.6. The published manual and \redefine, and the size commands \dsize,
cited above (for version 2.6) is the reference in case \tsize, \ssize, and \sssize. Please use
of variations between these versions, and only things the commands recommended for your format—for
documented in that manual will be supported by this plain TEX these are \def for the first two and
option!19 \displaystyle, \textstyle, \scriptstyle, and
\scriptscriptstyle for the rest. The v2 option en-
B.1 Unsupported incompatibilities sures that they are available anyway.
Version also 2 used the AMS-TEX \text and
Here is a list of known incompatibilities with version
a (non-object) box construction \Text which are
2 even when the v2 option is loaded.
emulated—\text is only defined if not already de-
• Automatic ‘shortening’ of arrow tails using |<< fined, however, using the native one (of AMS-TEX or
breaks was a bug and has been ‘fixed’ so it does AMS-LATEX or whatever) if possible. Please use the
not work any more. Put a |<\hole break before \txt object construction described in §6.3 directly
it. since it is more general and much more efficient!
19 In addition a few of the experimental facilities supported in v2.7–2.12 are also supported.

75
Obsolete state \astop \dir^{|}
\bstop \dir_{|}
Upto version 2.6 users could access the state variables
\tip \dir{>}
\cL, \cR, \cH, and \cD, which are defined.
\atip \dir^{>}
From v2.7 to 2.12 users could use the names
\btip \dir_{>}
of the state \dimen registers \Xmin, \Xmax, \Ymin,
\Tip \dir2{>}
and \Ymax; \Xp, \Yp \Dp, \Up, \Lp, and \Rp; \Xc,
\aTip \object=<5pt>:(32,-1)\dir^{>}
\Yc \Dc, \Uc, \Lc, and \Rc; \Xorigin, \Yorigin,
\bTip \object=<5pt>:(32,+1)\dir_{>}
\Xxbase, \Yxbase, \Xybase, and \Yybase. Now the
\Ttip \dir3{>}
same effect can be achieved using hcorneris but v2
\ahook \dir^{(}
defines the aliases.
\bhook \dir_{(}
\aturn \dir^{’}
Obsolete position manipulation \bturn \dir_{’}
In version 2 many things were done using individual
hdecori control sequences that are now done using The older commands \pit, \apit, and \bpit, are
hposi operators. not provided.

Version 2 positioning Replacement Obsolete object constructions


\gohposi \POS;p,hposi The following object construction macros are made
\aftergo{hdecori}hposi obsolete by the enriched hobjecti format:
\afterPOS{hdecori};p,hposi
\merge \POS.p\relax Version 2 object Replacement
\swap \POS;\relax
\Drop{htexti} \drop+{htexti} \rotate(hfactori)htipi
\object:(hfactori,hfactori){htipi}
\hole \object+{}
\squashhtipi \object=0{htipi}
Obsolete connections \growhtipi \object+{htipi}
These connections are now implemented using direc- \grow<hdimeni>htipi \object+<hdimeni>{htipi}
tionals. \squarify{htexti} \object+={htexti}
\squarify<hdimeni>{htexti}
Version 2 connection Replacement \object+=<hdimeni>{htexti}

\none \connect h\dir{} where rotation is done in a slightly different manner


\solid \connect h\dir{-} in version 3.7 (it was never accurate in version 2).
\Solid \connect h\dir2{-}
\Ssolid \connect h\dir3{-}
B.3 Obsolete extensions & features
\dashed \connect h\dir{--}
\Dashed \connect h\dir2{--} Version 2 had commutative diagram functionality
\Ddashed \connect h\dir3{--} corresponding to the frames extension and parts of
\dotted \connect h\dir{.} the matrix and arrow features. These are therefore
\Dotted \connect h\dir2{.} loaded and some extra definitions added to emulate
\Ddotted \connect h\dir3{.} commands that have disappeared.
\dottedwith{htexti} \connect h{htexti}
Frames
Note how the ‘hidden’ specifier h should be used be-
cause version 2 connections did not affect the size of The version 2 frame commands are emulated us-
diagrams. ing the frame extension (as well as the \dotframed,
\dashframed, \rounddashframed commands comm-
unicated to some users by electronic mail):
Obsolete tips
These objects all have \dir-names now: Version 2 object Replacement
\framed \drop\frm{-}
Version 2 tip Replacement
\framed<hdimeni> \drop\frm<hdimeni>{-}
\notip \dir{} \Framed \drop\frm{=}
\stop \dir{|} \Framed<hdimeni> \drop\frm<hdimeni>{=}

76
\dotframed \drop\frm{.} v2, the following command was added in v2.12:
\dashframed \drop\frm{--}
\rounddashframed \drop\frm{o-}
\diagramcompileto{ hnamei } . . . \enddiagram
\circled \drop\frm{o}
\Circled \drop\frm{oo}
which is like the ordinary diagram command except
the result is compiled (see note 5e). Note that com-
pilation is not quite safe in all cases!
Matrices There is also the following command that switches
The \diagram hrowsi \enddiagram command is pro- on automatic compilation of all diagrams created
vided as an alias for \xymatrix{ hrowsi } centered with the v2 \diagram . . . \enddiagram command:
in math mode and \LaTeXdiagrams changes it to use
\begin . . . \end syntax. v2 sets a special internal \CompileAllDiagrams { hprefixi }
‘old matrix’ flag such that trailing \\ are ignored and \NoCompileAllDiagrams
entries starting with * are safe. \ReCompileAllDiagrams
\NoisyDiagrams is ignored because the matrix
feature always outputs progress messages.
Finally the version 2 \spreaddiagramrows, will apply \xycompileto{hprefixin}{. . . } to each di-
\spreaddiagramcolumns spacing commands agram with n a sequence number starting from 1. Use
are emulated using \xymatrixrowsep and \CompileMatrices and \CompilePrefix instead!
\xymatrixcolsep: If for some reason a diagram does not work when
compiled then replace the \diagram command with
\diagramnocompile (or in case you are using the
Arrows
LATEX form, \begin{diagramnocompile}).
The main arrow commands of version 2 were the
\morphism and \definemorphism commands which
now have been replaced by the \ar command.
v2 provides them as well as uses them to define C Common Errors
the version 2 commands \xto, \xline, \xdashed,
\xdotted, \xdouble, and all the derived commands
In this appendix we describe some common cases
\dto, \urto, . . . ; the \arrow commands of the β-
where small mistakes in XY-pictures result in TEX er-
releases of v3 is also provided.
ror messages that may seem cryptic.
Instead of commands like \rrto and \uldouble
you should use the arrow feature replacements
\ar[rr] and \ar@{=}[ul].
! Box expected.
The predefined turning solid arrows \lltou, . . . ,
! A hboxi was supposed to be here. This mes-
\tord are defined as well; these are now easy to do
sage is common when an XY-pic hobjecti is mistyped
with hturnis.
such that XY-pic expects but does not find a TEX
hboxi construction.
B.4 Obsolete loading
The v2 User’s Manual says that you can load XY-pic ! LaTeX Error: Bad math environment delim-
with the command \input xypic and as a LATEX 2.09 iter.
‘style option’ [xypic]. This is made synonymous ! File ended while scanning use of \xycompiled.
with loading this option by the files xypic.tex and ! Argument of \codeof@ has an extra }. These
xypic.sty distributed with the v2 option. errors can happen while reading an incomplete com-
piled picture (such a beast is created when XY-pic
xypic.tex: This file (version 3.3) just loads the v2
crashes during compilation due to a syntax error or
feature.
other such problem).

xypic.sty: Loads xy.sty and the v2 feature.


! Missing } inserted. This happens when \endxy
B.5 Compiling v2-diagrams was left out.

In order to make it possible to use the new compila-


tion features even on documents written with XY-pic To Do: Also include the more obscure ones. . .

77
References [11] Tomas Rokicki. DVIPS: A TEX Driver. Dis-
tributed with the dvips program found on CTAN
[1] Adobe Systems Incorporated. PostScript Lan- archives.
guage Reference Manual, second edition, 1990.
[12] Kristoffer H. Rose. How to typeset pretty dia-
[2] American Mathematical Society. AMS-LATEX gram arrows with TEX—design decisions used in
Version 1.1 User’s Guide, 1.1 edition, 1991. XY-pic. In Jiřı́ Zlatuška, editor, EuroTEX ’92—
Proceedings of the 7th European TEX Con-
[3] Karl Berry. Expanded plain TEX, version 2.6 edi- ference, pages 183–190, Prague, Czechoslo-
tion, May 1994. Available for anonymous ftp vakia, September 1992. Czechoslovak TEX Users
from CTAN in macros/eplain/doc. Group.

[4] Michel Goossens, Frank Mittelbach, and Alexan- [13] Kristoffer H. Rose. Typesetting diagrams with
der Samarin. The LATEX Companion. Addison- XY-pic: User’s manual. In Jiřı́ Zlatuška, edi-
Wesley, 1994. tor, EuroTEX ’92—Proceedings of the 7th Eu-
ropean TEX Conference, pages 273–292, Prague,
[5] Brian W. Kernighan. PIC—a language for type- Czechoslovakia, September 1992. Czechoslovak
setting graphics. Software Practice and Experi- TEX Users Group.
ence, 12(1):1–21, 1982.
[14] Kristoffer H. Rose. XY-pic User’s Guide. DIKU,
University of Copenhagen, Universitetsparken 1,
[6] Donald E. Knuth. The TEXbook. Addison-
DK–2100 København Ø, 3.0 edition, June 1995.
Wesley, 1984.
[15] Kristoffer H. Rose and Ross R. Moore. XY-
[7] Donald E. Knuth. Computer Modern Typefaces, pic complete sources with TEXnical commentary.
volume A of Computers & Typesetting. Addison- not yet available, June 1995.
Wesley, 1986.
[16] Michael D. Spivak. The Joy of TEX—A Gourmet
[8] Leslie Lamport. LATEX—A Document Prepara- Guide to Typesetting with the AMS-TEX Macro
tion System. Addison-Wesley, 1986. Package. American Mathematical Society, sec-
ond edition, 1990.
[9] Leslie Lamport. LATEX—A Document Prepara-
tion System. Addison-Wesley, 2nd edition, 1994. [17] TUG Working Group TWG-TDS. A directory
structure for TEX files version 0.98. URL, May
[10] P. Naur et al. Report on the algorithmic lan- 1995. Available with URL ftp://jasper.ora.com/
guage ALGOL 60. Communications of the ACM, pub/twg-tds/.
3:299–314, 1960.

Index
!, 8 ::, 8 @+, 10
&, 48 ;, 8 @-, 10
’, 39 <, 8, 38–40 @/, 41, 42
(), 8 <>, 8 @1, 50
(0), 8 <>(.5), 39 @<, 41, 43
(0,0), 71 =, 8, 38–40 @=, 10
(1), 8 >, 8, 38–40 @?, 41, 43
*, 8, 39, 40, 42, 48, 50, 75 ?, 8, 40 @@, 10
**, 8, 40, 50 @, 8, 39, 41, 49 @C, 49
+, 8 @!, 41, 49 @H, 50
,, 8, 40 @!0, 50 @L, 50
-, 8, 39 @!=, 50 @M, 50
., 8 @!C, 49 @R, 49
.xyd, 15 @!R, 49 @W, 50
/, 38, 39, 42 @(, 10, 41, 42 @‘, 41
//, 8 @), 10 @i, 10
:, 8, 12 @*, 41, 50 [.], 13

78
[=, 12, 14, 30, 33 C, 8, 10 \dotframed , 77
[P:, 37 c, 6 \Dotted , 76
[], 13 c, 8 \dotted , 76
[c], 14 cartesian coordinate system, 6 \dottedwith , 76
[d], 14 category code, 4 \Dp , 76
[dvips], 5 CD, 8 hdriveri, 20
[l], 14 \cD , 76 \Drop , 76
[o], 13 \cH , 76 \drop , 16
[r], 14 hciri, 19 \dsize , 75
[textures], 5 \cir , 18, 73 \dumpPSdict {<filename>},
[u], 14 \Circled , 77 36
\\, 48 \circled , 77
E, 8, 10
^, 39–41 circles, 5
Edge, 6
_, 39–41 CL, 8
Edgec , 6
‘, 39 \cL , 76
Edgep , 6
‘s, 66 cm, 27
\enddiagram , 77
|, 39, 41 \Col , 51
\endxy , 6, 15
|<<, 75 column spacing, 49
entry height, 50
~, 39 hcommandi, 16
entry margin, 50
\CompileFixPoint , 15
0, 6, 8, 41 entry width, 50
\CompilePrefix , 15
1, 41 \entrymodifiers , 50
compiling, 15
2, 41 Error, 5
hcompositei, 12
3, 41 hescapei, 52
\composite , 12, 13, 18
10, 27 eu, 27
connect, 6
11, 27 \everyentry , 51
\connect , 16
12, 27 extension, 20
hcoordi, 8, 37
a, 8 COPYING, 4 extents, 6
active characters, 4 copyright, 3 e|, 37
hadd opi, 12 hcorneri, 8 fixed grid, 49
\aftergo , 76 CR, 8 fonts, 5
\afterPATH , 38 \cR , 76 format dependencies, 5
\afterPOS , 15, 16, 39 CU, 8 formats, 5
\ahook , 76 current object style, 12, 14 \Framed , 76
allocation, 5 \framed , 76
D, 6
AMS-LATEX, 5, 15 free software, 3
D, 8, 10
AMS-TEX, 5 french.sty, 4
Dc , 6
\apit , 75 \frm , 10, 24
Dp , 6
\ar , 14, 38, 66 \frm {**}, 26
\Dashed , 76
array, 51 \frm {*}, 26
\dashed , 76
arrow head, 41
dashes, 5 german.sty, 4
arrow stem, 41
\dashframed , 77 GNU General Public License, 3
arrow tail, 41
\Dc , 76 \go , 76
\astop , 76
\Ddashed , 76 hgraphi, 52
\aTip , 76 \Ddotted , 76
\atip , 76 \grow , 76
hdecori, 16
\aturn , 76 h, 12
decoration, 6
banner, 5 \halfrootthree , 7
default entry, 50
\bhook , 76 \halfroottwo , 7
\define , 75
BNF, 4 \halign , 51
\definemorphism , 77
hbody of the optioni, 19 hdiagi, 12 \hbox , 12
\bpit , 75 \diagram , 77 \hole , 40, 76
\bstop , 76 dimension registers, 5 hooks, 5
\bTip , 76 \dir , 16, 18, 41, 42 i, 12
\btip , 76 hdirectioni, 12 idioms, 5
\bturn , 76 \documentclass , 5 \input xy, 4

79
\input xypic, 77 \objectbox , 11, 40 \squarify , 76
\jot , 9 \objectheight , 13 \squash , 76
\objectmargin , 13, 40 squiggles, 5
L, 6 \objectwidth , 13 \ssize , 75
L, 8, 10 \OnlyOutlines , 15 \Ssolid , 76
Lc , 6 horienti, 19 \sssize , 75
Lp , 6 orientation, 49 state, 7
label separation, 50 hstepi, 52
\labelbox , 40 P, 8, 10
p, 6 \stop , 76
\labelmargin , 40 style, 14
\labelstyle , 40 p, 8
style option, 5
LATEX, 5 package, 5
\swap , 76
\LaTeXdiagrams , 77 \partroottwo , 7
system dependencies, 5
LATEX 2ε , 5 \PATH , 38
\Lc , 76 \PATHaction , 38 TEX reference point, 6
LD, 8 \PATHafterPOS , 39 \Text , 75
license, 3 \pit , 75 \text , 75
hlisti, 52 hplacei, 8 \Tip , 76
loading, 4, 5 placement state, 7 \tip , 76
logo, 5 plainTEX, 5 tips, 5
\Lp , 76 hposi, 8 \tsize , 75
LU, 8 \POS , 16, 38 \Ttip , 76
positions, 6 hturni, 66
\makeatletter , 4 \turnradius , 40
privacy, 4
\makeatother , 4 \txt , 18
\MakeOutlines , 15 q, 12
math mode, 6 U, 6
R, 6
hmatrixi, 48 U, 8, 10
R, 8, 10
matrix, 48 Uc , 6
Rc , 6
matrix orientation, 49 Up , 6
Rp , 6
matrix spacing, 49 \Uc , 76
hradiusi, 19
\merge , 76 \Up , 76
\Rc , 76
messages, 5 \UseCrayolaColors , 30
RD, 8
hmodifieri, 12, 37 \usepackage , 5
\redefine , 75
\morphism , 77 \UsePSheader {<filename>},
redefined, 4
hmovei, 52 36
\relax , 4, 16
movie, 34 \UsePSheader {}, 36
\restore , 16
\MovieSetup , 34 \UsePSspecials {}, 35
\rotate , 76 \UseRules , 18
\MultipleDrivers , 20 \rounddashframed , 77 \UseSingleDriver , 20
\newdir , 18, 41 \Row , 51 \UseTips , 27
\newgraphescape , 53 row spacing, 49
\newxycolor , 30 \Rp , 76 v, 12
\newxypattern , 31 RU, 8 hvectori, 8
\next , 4 version, 5
s, 8
hnodei, 52 \save , 16 Warning, 5
\NoisyDiagrams , 77 \scene , 34 warning messages, 4
\none , 76 \SelectTips , 27 warranty, 3
\NoOutlines , 16 \ShowOutlines , 15 X, 6
\NoPSspecials , 35 \SilentMatrices , 48 x, 8, 9
\NoRules , 18 hsizei, 12 Xorigin , 6
\notip , 76 hslidei, 8 Xxbase , 7
\NoTips , 27 \Solid , 76 Xybase , 7
hobjecti, 12 \solid , 76 Xc , 6
object, 6 spacing, 49 Xp , 6
\object , 12, 16 \spreaddiagramcolumns , 77 Xmax , 6
hobjectboxi, 12 \spreaddiagramrows , 77 Xmin , 6

80
\Xc , 76 xycirc10, 5 \xyrequire , 19
\xdashed , 77 \xycircfont , 5 \xyShowDrivers , 20
\xdotted , 77 \xycompile , 15, 16 \xytracing , 15, 16
\xdouble , 77 \xycompileto , 16 \xyverbose , 15, 16
\xline , 77 xydash10, 5 \xyversion , 5
\Xmax , 76 \xydashfont , 5 \xywithoption , 19
\Xmin , 76 \xydate , 5
\Xorigin , 76 \xyecho , 15 Y, 6
\Xp , 76 \xyendinput , 19 y, 8, 9
\xto , 77 \xyeveryrequest , 19 Yorigin , 6
\Xxbase , 76 \xyeverywithoption , 19 Yxbase , 7
xy, 27 \xygraph , 51 Yybase , 7
\Xy , 5 xyidioms.tex, 5 Yc , 6
\xy , 6, 7, 15 \xyignore , 16 Yp , 6
XY-pic, 5 \xymatrix , 14, 48 Ymax , 6
XY-picture state, 6 \xymatrixcompile , 49 Ymin , 6
xy.sty, 5 \xymatrixnocompile , 49 \Yc , 76
xyatip10, 5 \xyoption , 5, 19 \Ymax , 76
\xyatipfont , 5 xypic.sty, 77 \Ymin , 76
\Xybase , 76 xypic.tex, 77 \Yorigin , 76
\xybox , 12 \xyprovide , 19 \Yp , 76
xybsql10, 5 \xyPSdefaultdict , 36 \Yxbase , 76
\xybsqlfont , 5 \xyquiet , 15, 16
\Yybase , 76
xybtip10, 5 xyrecat.tex, 4
\xybtipfont , 5 \xyReloadDrivers , 20 zero position, 6

81

Você também pode gostar