Professional Documents
Culture Documents
be enclosed in braces. Sometimes they are un- There are other optional parameters to tell
necessary, but they can never hurt and I have where the arrow labels should go and to change
not actually worked out what situations require the arrow style. The latter can get very com-
their use. plicated, as complicated as XY-pic allows. Arbi-
Suppose the square is not large enough. If trary XY-pic arrow styles, including arrows that
you want the diagram follow arbitrary Bezier curves, are allowed.
Hom(f,B) There are a number of basic triangle shapes,
Hom(A, B) / Hom(A0 , B)
which are named according to the letter in the
alphabet that most neatly fits in the triangle.
Hom(A,g) Hom(A0 ,g) For example, a \ptriangle is a right triangle
whose hypotenuse goes from east to south and
Hom(A, B 0 ) / Hom(A0 , B 0 ) an \Atriangle is an isoceles triangle whose base
0
Hom(f,B )
is horizontal. This example
you use size parameters set off by < and > as in
A
f
/B
$$\bfig\square<1000,500>[\Hom(A,B)‘
\Hom(A’,B) ‘\Hom(A,B’)‘\Hom(A’,B’);
h g k
\Hom(f,B)‘\Hom(A,g)‘ \Hom(A’,g)
‘\Hom(f,B’)]\efig$$
C /D
Here the numbers 1000 and 500 refer to the l
width and height of the square in units of .01 em. is produced by
This is doubtless too fine; I hardly ever use a dis- $$\bfig\ptriangle[A‘B‘C;f‘h‘g]
tance not a multiple of 10 (or, occasionally, 5), \dtriangle[B‘C‘D;‘k‘l]\efig$$
but I feel that now I am stuck with that choice.
The default is <500,500> and will be supplied An alternate way of making the same diagram
if not specified. is given by
$$\bfig\square[A‘B‘C‘D;f‘h‘k‘l]
3 Lego blocks \morphism(500,500)<-500,-500>[B‘C;g]
Although simple diagrams are the most com- \efig$$
mon, the real power of diagxy is the ease of where \morphism creates the arrow from B to
putting blocks together to make more compli- C.
cated diagrams. In order to do this, there are Incidentally, the effect of \bfig. . .\efig in
parameters, enclosed in (), that tell where to a displayed diagram is nearly the same as \xy
place a block in the given coordinate system. . . . \endxy except that it has the effect of enclos-
For example: ing the whole in a \vcenter box so that equa-
tion numbers, if any, are vertically centred. In
A
f
/B
case you are curious about the names \bfig and
\efig, I used an NROFF-type system briefly in
g h
the very early 1980s (in the paleolithic era be-
fore TEX) and figures were set off using .BFIG
C /D and .EFIG.
k
l m 4 In-line arrows
One of my minor gripes about LATEX is that
E /F the arrows used in text look quite different from
n
those used in diagrams. So one of the things
This is produced by
I have done is define a macro \to that works
$$\bfig\square(0,500)[A‘B‘C‘D;f‘g‘h‘k] somewhat like \rightarrow but uses the XY-pic
\square[C‘D‘E‘F;‘l‘m‘n]\efig$$ arrowheads. It has several other features, in-
This is an example of the Lego block approach. cluding various options, but the most important
Note that C and D are repeated. This is nec- is that it grows to accommodate long labels. An
essary in order that the arrows be the correct a long label /
lengths. On the other hand, there is no need example is A B, for which the
to repeat k and, if you did, it would by default source is
appear both above and below the middle arrow. $A\to^{\mbox{\rm a long label}}B$.
248 TUGboat, Volume 26 (2005), No. 3
o S OOOO
ooooo OOO
o OOO
ooo
NP? VP?
??? ???
? ?
Art N Vt NP?
???
?
the man hit Art N
the ball
There are other macros, such as \two and three, lier code, it is much more systematic to describe
which make double and triple arrows. The di- trees in this way:
rections of the arrows (right or left) can be in-
dependently set, using standard XY-pic controls. $$\bfig
\newcommand{\NP}{\hbox{\mit NP}}
5 Compatibility \newcommand{\VP}{\hbox{\mit VP}}
There is nothing in this code (or in XY-pic) that \newcommand{\Art}{\hbox{\mit Art}}
uses anything but plain TEX. I have used it ex- \node 1a(0,0)[S]
tensively under LATEX and never unearthed any \node 2a(-600,-300)[\NP]
\node 2b(600,-300)[\VP]
incompatibility. I have not used it much with
\arrow/-/[1a‘2a;]
AMS-LATEX but there is one known incompat- \arrow/-/[1a‘2b;]
ibility. One of the AMS symbol fonts makes a \node 3a(-900,-600)[\Art]
little box which is named \square. A simple \node 3b(-300,-600)[N]
fix is to load the amsfonts first. If you actu- \node 3c(300,-600)[V_t]
ally require that character, then before loading \node 3d(900,-600)[\NP]
diagxy, simply say \let\Box\square, to call it \arrow/-/[2a‘3a;]
\Box. Incidentally, the @ sign is used in the \arrow/-/[2a‘3b;]
XY-pic syntax, along with just about every other \arrow/-/[2b‘3c;]
non-alphanumeric character. Thus you cannot \arrow/-/[2b‘3d;]
change the catcodes of any of them, which means \node 4a(-900,-900)[{\sf the}]
\node 4b(-300,-900)[{\sf man}]
there are no private control sequences. Thus one
\node 4c(300,-900)[{\sf hit}]
must be careful not to redefine any of the inter- \node 4d(600,-900)[\Art]
nal sequences used. \node 4e(1200,-900)[N]
\arrow/-/[3a‘4a;]
6 An alternate syntax
\arrow/-/[3b‘4b;]
A couple years after this package was released, I \arrow/-/[3c‘4c;]
received a note from a graduate student named \arrow/-/[3d‘4d;]
Gerd Zeibig who suggested an alternate syntax \arrow/-/[3d‘4e;]
in which you specify the placement of nodes in \node 5a(600,-1200)[{\sf the}]
the coordinate system and then draw arrows be- \node 5b(1200,-1200)[{\sf ball}]
tween them. He had also implemented this in a \arrow/-/[4d‘5a;]
\arrow/-/[4e‘5b;]
way that used two counters for each node. Given
\efig$$
the shortage of counters in standard LATEX, I de-
cided to reimplement it using macro definitions
in place of these counters. So it is now possible First you define the nodes and then draw
to describe diagrams as illustrated below. The arrows between them. In this case, we wanted
diagram in Figure 1 appears in a set of notes only lines, whence the /-/ specification on the
on mathematical linguistics. While there is cer- arrows. The labels on the nodes are almost com-
tainly no problem producing it using the ear- pletely arbitrary (limited only by what \csname
. . . \endcsname allows).
TUGboat, Volume 26 (2005), No. 3 249
T T?
µ
/T
?? ??
?? ??
?? ??
?? ?? T η
? 1 ??
T T η0 ?? ??
?? ??
?? ??
0
T η0 T 2 TTT0
µT
// T T 0
??
Tσ ??
??
?? id
0
Tη TT 0
3 0 0
Tη T 6 ??
??
??
??
T T 0 T η0
0 T µ0
TT T 0 / TT TT0 0 T T σ / TT T 0 0 / TT0
σT 4 σT T 0 5 σT 0 7 σ
T 0T / T 0T T 0 / T 0T 0 / T0
T 0 T η0 T 0 σT 0 µ0