Xy-pic is a package for typesetting graphs and diagrams using the
principle of logical composition of visual components.

It is
structured as several modules, each defining a mnemonic plain text
notation for a particular kind of graphical object or structure.
Example objects are arrows, curves, frames, and colouring/rotation
on drivers that support it; these can be organised in matrix,
directed graph, path, polygon, knot, and 2-cell structure (a more
complete list of the features is given below).

Xy-pic works with most formats, including all variants of LaTeX, AMS-TeX, and plain TeX, and has been used to typeset complicated diagrams from many application areas including category theory, automata theory, algebra, neural networks, topology (knots and braids), database theory, chemistry, and genealogy.

Xy-pic has been designed with great care to allow the style of pictures to match well with the exquisite quality of the surrounding TeX typeset material.

You can get Xy-pic from
CTAN
or directly from the
SourceForge development project home,
however, chances are that Xy-pic is already included with your TeX installation
(for TeX Live, for example,
Xy-pic is part of the pictures

bundle).

Xy-pic was conceived by Kristoffer Høgsbro Rose, the present version is the result of several years of collaboration with Ross Moore with essential contributions from George Necula, Jeremy Gibbons, Daniel Müllner, and Alex Perlis, and with many suggestions from more than two decades of users.

Xy-pic is © by its authors as free software.

Xy-pic is structured as a kernel

and several orthogonal modules
called options

, each defining a custom notation for a particular
kind of graphical object or structure.

These (combinable) logical composition

structures are available:

- A graph combinator mode where diagrams are specified the way they are composed as graphs.
- A matrix-like mode where the dimensions of the drawing are computed by
aligning diagram entries in rows and columns (this is the
diagram

mode Xy-pic version 2 users are used to). - A polygon mode where diagrams shaped as regular polygons are entered in a simple way.
- A mode for typesetting beautiful knots and links.
- A general object-oriented
turtle graphic

drawing language for specifying graphs with objects and connections between them in a manner independent of orientation.

visual componentobjects can be used:

- Positions can be given in variety of formats (extendable) including user defined coordinates (x,y) and relative to previous positions, objects, object edges, and points on connections.
- Objects may be circular, elliptic, or rectangular (more shapes can be added) and adjusted in several ways.
- Large library of objects with mnemonic names.
- Objects that orient themself along a connection when placed relative
to it, e.g.,

is like`@{|-}`

but thus oriented; new such objects can be defined in a convenient way.`\vdash`

- TeX
boxes

, i.e., text and mathematical formulae. - Includes circle segments and optionally arbitrary elliptical, quadratic, and cubic arcs.
- Connections are aligned between the reference points of objects but start and end on the edges.
- Any object can be used to build a connection (using
diagonal filling

); library objects provide common line types. - Flexible notation for drawing arrows and general paths with
tail, stem, and head built from any object(s). Special support
for arrows that cross each other, arrows that
go by

other entries, paired arrows (including support for 2-cells), curved arrows, and arrows with bends. The style of arrow tips can be configured to match several styles of symbol arrows. - Library of frames and braces.
- Special notation for rotation, scaling, colour, and line thickness. The correct typesetting of these features requires a backend that supports it but even when this is not available Xy-pic tries to approximate what is requested such that at least the picture size is stable (and thus page breaks).
- Output can use PostScript* for drawing (several \special formats are
supported: dvips, Textures, and OzTeX - more are being added
continuously: contact Ross Moore
for the current list). Notation for inclusion of literal PostScript* is available. - Support for Adobe PDF* output is available from version 3.8 (thanks to support by Daniel Müllner and font conversion software by Scott Pakin).).

*Xy-pic User's Guide*by Kristoffer H. Rose. Explains how to use the Xy-pic macro package to typeset basicmatrix-like

diagrams with TeX (pdf).*Xy-pic Reference Manual*by Kristoffer H. Rose & Ross Moore. Reference manual for Xy-pic summarising syntax anddrawing semantics

of the capabilities in the kernel, all extensions and features, and the PostScript* backend (pdf).*Xy-pic Complete Sources with TeXnical Commentary*by Kristoffer H. Rose & Ross Moore. Just that (a large document, pdf).*The xypdf package*by Daniel Müllner. Detailed user and TeXnical documentation of the PDF* support for Xy-pic (pdf).

*An Introduction to Xy-pic*by Cameron McLeman (pdf slides).*Commutative Diagrams with XY-pic---I. Kernel Functions and Arrows*by Paul A. Blaga (pdf).*The LaTeX Graphics Companion*, Second Edition by Michel Goossens, Sebastian Rahtz, Frank Mittelbach, Denis Roegel, and Herbert Voß, Addison-Wesley, 2007. Chapter 7 gives a concise introduction to some advanced uses of Xy-pic (official page; in the first edition on Google books chapter 5 is dedicated to Xy-pic).*Using Xy-pic in LyX*by H. Peter Gumm (pdf).*Tutorial de Xy-pic*(in Portuguese).

If you know of other tutorials, interesting papers, or instructive examples, that can be shared, then please drop a note to the mailing list!

* PostScript and PDF are trademarks of Adobe, Inc.

Kristoffer Høgsbro Rose