TikZ is now the de facto standard for drawing, but it is not the only option. Several drawing systems predate it and still hold their own: PSTricks, which borrows the power of PostScript; the veteran Xy-pic, strong on diagrams; Asymptote, a standalone language that handles both 2D and 3D; and MetaPost, which descends from METAFONT. This page sorts out what each of these non-TikZ systems is and when you reach for it — with special attention to each one’s quirk in the output pipeline. For new work, TikZ is usually enough; these are worth knowing for legacy documents, 3D, or specific ecosystems.
TikZ is the default first
Before we begin, let us be clear about the recommendation. If you are starting to draw figures in LaTeX today, the right move is to reach for TikZ first. TikZ is actively maintained, runs under pdflatex, lualatex, or xelatex with no extra external tool, blends naturally with your document’s fonts and colours, and has a vast surrounding ecosystem of libraries (tikz-cd, PGFPlots, circuitikz, and more). TikZ itself is covered on the “TikZ basics” page.
So why know the other systems at all? Mainly for three reasons. First, existing documents: older papers, books, and templates may be written in PSTricks or Xy-pic, and you must be able to read them to maintain or revise them. Second, 3D: for serious three-dimensional figures, Asymptote is the strongest of the lot. Third, specific ecosystems: in the ConTeXt world, MetaPost (via MetaFun) is the central drawing facility. We take them in turn below.
PSTricks — the power of PostScript
PSTricks is a set of macros that call PostScript’s drawing facilities directly from TeX/LaTeX source. As the name says, it uses PostScript internally, so it does fills, gradients, and coordinate transformations at high quality. Load it in the preamble with \usepackage{pstricks} and write the figure inside a **pspicture environment**. You give the coordinates when opening the environment — the lower-left and upper-right corners — as in \begin{pspicture}(0,0)(4,3).
The basic drawing commands mostly read off their names. \psline draws a line (or polyline), \pscircle a circle, and \psframe a rectangle. Coordinates go in parentheses, as in \psline(0,0)(3,2), and a circle takes a centre and radius, as in \pscircle(2,2){1}. To place an arbitrary object (text or another picture) at given coordinates, use **\rput**, written \rput(2,1){text}. When you want an angle or an offset on the placement, \uput is available too. Here is a minimal example.
\begin{pspicture}(0,0)(4,3)
\psframe(0,0)(4,3)
\psline{->}(0,0)(3,2)
\pscircle(2,1.5){1}
\rput(2,1.5){$O$}
\end{pspicture}This draws a rectangular frame 4 wide and 3 tall, a line with an arrowhead running from the origin to (3,2) inside it, a circle of radius 1 centred at (2,1.5) on top, and the math symbol O at the circle’s centre. The {->} in \psline{->} specifies the arrowhead; in PSTricks you give line style, arrowheads, colour, and so on together as options in square brackets [...] (for example \psline[linewidth=2pt,linecolor=red]{->}(...)).
Here is the chief caveat. Because PSTricks relies on PostScript \specials (special instructions embedded in the DVI), it **does not work directly under pdflatex, which produces PDF straight away. The classic, reliable route goes through DVI: latex → dvips → ps2pdf**. That is, latex makes the DVI, dvips converts it to PostScript, and ps2pdf (from Ghostscript) turns that into PDF.
latex figure.tex
dvips figure.dvi -o figure.ps
ps2pdf figure.psWhen you must fit it into a pdflatex workflow, or want to mix in PNG/JPEG images, there are workarounds. The **pst-pdf and auto-pst-pdf** packages render just the PSTricks parts via PostScript behind the scenes, convert them to PDF fragments, and fold those into the pdflatex output (auto-pst-pdf calls an external process, so it must be run with --shell-escape; the related pdftricks likewise needs -shell-escape). Another route is to compile with XeLaTeX: with the xetex-pstricks package installed, xelatex can handle PSTricks without changing your source.
PSTricks has a rich family of add-on packages — pst-plot (function plots), pst-node (nodes and connectors), pst-3dplot (3D plots), and many more — so its expressive power remains high. But given the constraint on its output route, TikZ is often easier to live with for new documents.
Xy-pic — the diagram veteran
Xy-pic (package name xy) is a long-standing general-purpose package for typesetting graphs and diagrams. It works with plain TeX, LaTeX, and AMS-LaTeX, and has been used for diagrams across many fields — category theory, algebra, and topology, but also automata, databases, chemistry, and genealogy. In LaTeX the usual load is \usepackage[all]{xy}, where [all] turns on the standard set of features.
The most-used part, especially for commutative diagrams, is **\xymatrix**. This is a mode that lays a diagram out like a matrix: as in tabular, entries are separated by & and rows by \\. Arrows between objects are drawn with the **\ar** command, whose target is given by direction keys: [r] right, [l] left, [u] up, [d] down, and combinations like [rd] for a diagonal (the cell one step right and down). To put a label on an arrow, you reuse the same notation as math scripts: **^ places the label above (to the left of) the arrow, and _** places it below (to the right).
\[
\xymatrix{
A \ar[r]^{f} \ar[d]_{\alpha} & B \ar[d]^{\beta} \\
C \ar[r]_{g} & D
}
\]This produces a commutative square with A, B, C, D at the corners: f pointing right along the top, α pointing down the left side, β pointing down the right side, and g pointing right along the bottom. The label f sits above the top arrow and g below the bottom one. Since a diagram is itself a piece of mathematics, it is placed inside a display math environment (\[ … \]).
Xy-pic is historically important and still appears in many documents, but for commutative diagrams the **modern alternative is the TikZ-based tikz-cd**. tikz-cd handles curves, elaborate arrowheads, and intricate multi-row diagrams more easily, with friendlier error messages. A good split: use tikz-cd for new work, and the knowledge in this section for maintaining existing Xy-pic documents. The two are compared in detail on the “Commutative diagrams” page.
Asymptote — a language for 2D and 3D
Asymptote is not a set of TeX macros but a standalone vector-graphics language. With C++-like syntax, it describes figures as a full programming language, complete with variables, functions, loops, and types. It aims to give figures the same high-quality typesetting that LaTeX brings to scientific text, and its standout feature is that it draws 3D as well as 2D figures at high quality. Because it uses TeX to typeset labels, the math in a figure matches the body text’s fonts.
To embed it in LaTeX, load \usepackage{asymptote} in the preamble and write the figure code inside an **asy environment** (\begin{asy} … \end{asy}). By construction, compilation takes three steps. First, running latex (or pdflatex) writes the contents of each asy environment out to temporary .asy files. Next you run the external program **asy** on them to generate the figures (PDF for pdflatex, EPS for latex/dvips). Finally, running latex/pdflatex once more pulls the finished figures in.
pdflatex document
asy document-*.asy
pdflatex documentRunning these three steps by hand is tedious, so in practice you normally let **latexmk automate it. Asymptote figures can also be written as standalone .asy files** rather than embedded in the document, and run on their own with asy figure.asy to produce PDF, EPS, or (formats that include interactive 3D) output. Here is a minimal .asy example.
import three;
size(6cm);
draw(unitcube);
draw(O--X, red, Arrow3);
draw(O--Y, green, Arrow3);
draw(O--Z, blue, Arrow3);This Asymptote code imports the three module (its 3D facilities), draws a unit cube, and then draws red, green, and blue three-dimensional arrows from the origin along the x, y, and z axes. size(6cm) sets the finished size. So Asymptote’s strength is that serious 3D — solids with coordinate axes, surfaces, and the like, which is laborious in TikZ — can be written relatively naturally. There is also a GUI front end, xasy, that lets you draw interactively and export the result as .asy source for hand-editing.
MetaPost — the METAFONT lineage
MetaPost is John Hobby’s reworking of Knuth’s METAFONT (a language for describing fonts), with PostScript as its output. It inherits METAFONT’s distinctive notation for solving smooth curves from points and directions (Hobby’s algorithm) and lets you declare coordinates as equations, declaratively. Classically it is a standalone language: you process a .mp file with the dedicated program **mpost** to obtain EPS.
In modern practice it is easiest to write it inline inside LuaLaTeX. Loading the **luamplib** package (\usepackage{luamplib}) lets you write MetaPost code directly inside an **mplibcode environment. This typesets the figure using LuaTeX’s built-in mplib library**, so it needs no separate mpost call and no --shell-escape. It works in PDF mode or DVI mode (DVI output presumes dvipdfmx). Here is a minimal example.
% lualatex で処理する / compile with lualatex
\documentclass{article}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
draw fullcircle scaled 2cm withpen pencircle scaled 1pt;
draw (-1cm,0)--(1cm,0);
draw (0,-1cm)--(0,1cm);
endfig;
\end{mplibcode}
\end{document}The contents of this mplibcode are MetaPost code. beginfig(1) … endfig delimit one figure; it draws a circle of radius 1cm (the unit circle scaled to a 2cm diameter) with a 1pt pen, then draws one horizontal and one vertical diameter across it. Compiled with LuaLaTeX, this figure is folded straight into the PDF with no external tool. fullcircle, pencircle, and scaled are part of MetaPost’s built-in vocabulary.
A key part of the MetaPost ecosystem is MetaFun, a feature-rich format for MetaPost; the typesetting system ConTeXt integrates MetaPost deeply through MetaFun. For ConTeXt users, MetaPost (via MetaFun) is the central drawing facility. If you work mainly in LaTeX, by contrast, you normally use TikZ and keep MetaPost in reserve for when you want its METAFONT-style curve description or for working with ConTeXt.
Comparing the systems and choosing
Laying the four systems out by output route, engine, and strength gives the table below. The common thread: for new work, start with TikZ, and reach for the systems here only when there is a specific reason — a legacy document, 3D, or a particular ecosystem.
| System | Output route / engine | Strength / main use |
|---|---|---|
PSTricks | latex → dvips → ps2pdf; or pst-pdf/auto-pst-pdf (needs --shell-escape), or XeLaTeX | High-quality PostScript fills and effects; many legacy documents |
Xy-pic | Works under ordinary LaTeX (no special route) | Commutative diagrams (the veteran); tikz-cd is the modern alternative |
Asymptote | latex/pdflatex → external asy → latex again (automate with latexmk); or standalone .asy | Serious 2D and 3D; solids and surfaces with axes |
MetaPost | Process .mp with mpost; or LuaLaTeX + luamplib’s mplibcode (no external tool) | METAFONT-style curves; central to ConTeXt (MetaFun) |
A practical rule of thumb. For maintaining an existing document, make yourself able to read and write whatever system it uses (PSTricks or Xy-pic). If you need 3D figures, Asymptote is the first candidate. If you work in ConTeXt, MetaPost (MetaFun) is the natural fit. For new commutative diagrams, choose tikz-cd rather than Xy-pic. And for the great majority of drawing that fits none of these, the safest choice is TikZ — no extra external tool and no special output route.