Daniel Müllner |
The xypdf package
PDF output for diagrams in TEX and LaTEX with the XY-pic package
Most mathematicians and many scientists from other fields use the typesetting system TEX with the macro package LaTEX for their publications. These programs can produce highest quality typesetting, ready for publication and printing, and they have been used for countless books, journals and lecture notes over the years.
One extension for TEX and LaTEX for drawing graphs and diagrams is the package XY-pic. This package is a classic in the TEX world and is widely used in mathematical publications for diagrams of all sorts. To draw graphical elements, the XY-pic package assembles glyphs in special fonts by default; e.g. diagonal lines are composed of short dashes, and curves are drawn with many tiny, overlapping dots. Alternatively, XY-pic contains Postscript drivers which output at least some graphical elements with generic Postscript commands and thus produce much better quality.
Today's preferred format for circulating documents has become PDF, not Postscript, however. Since the XY-pic package was written in times when PDF was not widespread, it lacked PDF support. My package xypdf fills that gap. It gives XY-pic the ability to draw graphical elements (lines, curves and circles in various styles) by generic PDF commands, thus producing high-quality output and reducing file size. Compare the output in the following figure (10 times magnified, resolution 960dpi).
without xypdf |
|
with xypdf |
|
For a more detailed description, which describes all features and the technical highlights, read the documentation. There are a few hidden gems in the source code. E.g., the package features a Bézier curve offset algorithm completely written in TEX with its 31-bit fixed point arithmetic, only the four basic arithmetic operations supported and no chances to recover from an overflow.
When I wrote the xypdf package in 2010, the most recent XY-pic version 3.7, which was stable for many years, dated from 1999. Having triggered a new release of XY-pic after 11 years, xypdf is now integrated in and distributed together with XY-pic. This makes it easy to obtain and to use: install the XY-pic package or update it to version 3.8 or newer, by the specific method of your TEX distribution. Then write \xyoption{pdf} in your documents, and enjoy!