Other drawing systems

“PSTricks is a thing of the past, TikZ is what people use.” It is a common summary, and looking inside TeX Live 2024 turns it upside down. The PSTricks it ships is v3.19c, dated 2 February 2024 — still receiving releases. Meanwhile Xy-pic, famous as the classic tool for commutative diagrams, was last updated on 6 October 2013, and announces that date in the log on every single run. This page walks through the four drawing systems available in LaTeX besides TikZ — PSTricks, which calls on PostScript; the diagram veteran Xy-pic; Asymptote, a standalone language; and MetaPost, descended from METAFONT — organised around each one’s output route. What separates them in practice is less expressive power than which engine can typeset them and how.

If you are starting a new figure, is TikZ still the right default?

Yes — almost certainly TikZ. The reason is not features but the absence of friction. TikZ runs under pdflatex, lualatex, or xelatex, with no external program and no extra compilation stage. Every one of the four systems on this page breaks at least one of those conditions: PSTricks does not run directly under pdfLaTeX, Asymptote demands an external binary and a three-stage compile, MetaPost presupposes LuaLaTeX or a dedicated program, and Xy-pic runs fine but stopped being updated in 2013. The other systems are still worth knowing for three reasons: maintaining existing documents, serious 3D, and specific ecosystems such as ConTeXt.

PSTricks: thirty years old and still shipping releases

PSTricks is a set of macros that call PostScript’s drawing facilities directly from TeX/LaTeX source. The copyright lines at the head of pstricks.tex tell the system’s whole history: Timothy Van Zandt (1993, 1994, 1999), Denis Girou (2000–2003), and Herbert Voß (2004 onward). Handed down across three maintainers, the version in TeX Live 2024 is v3.19c, dated 2 February 2024. What is old about PSTricks is its design premise, not its state of upkeep.

The syntax mostly reads off its own names. \psline draws a line or polyline, \pscircle a circle, \psframe a rectangle. Coordinates go in parentheses, as in \psline(0,0)(3,2), and a circle takes a centre and a radius: \pscircle(2,2){1}. The whole figure lives in a pspicture environment, whose opening carries the lower-left and upper-right corners: \begin{pspicture}(0,0)(4,3). To place anything at a coordinate use \rput; when you also want an angle or an offset, \uput. Line style, arrowheads, and colour are given together as options in square brackets.

latex
\begin{pspicture}(0,0)(4,3)
  \psframe(0,0)(4,3)
  \psline[linewidth=1pt]{->}(0,0)(3,2)
  \pscircle(2,1.5){1}
  \rput(2,1.5){$O$}
\end{pspicture}

This draws a frame four units wide and three tall, runs an arrowed segment from the origin to (3,2), lays a circle of radius 1 centred at (2,1.5) over it, and puts an O at the circle’s centre. There is a rich family of add-ons too: pst-plot for function plots, pst-node for nodes and connectors, pst-3dplot for 3D, and many more. In expressive power it is still entirely strong. The problem is the single point of the next section.

The error PSTricks gives under pdfLaTeX, and the ways around it

You get ! Undefined control sequence. at the first drawing command. Running a document with \usepackage{pstricks} through pdflatex on TeX Live 2024, it stopped on the \psframe line with: "! Undefined control sequence. \c@lor@to@ps ->\PSTricks _Not_Configured_For_This_Format". Mid-expansion a marker token named \PSTricks_Not_Configured_For_This_Format appears — deliberately left undefined — shouting in its own name that this format is not supported. The nasty part is that under nonstopmode it emits that error dozens of times and still produces a PDF to the end: a PDF with the figure simply missing.

The cause lies in the output mechanism itself. PSTricks is designed to emit its drawing as PostScript \specials — special instructions embedded in the DVI — and pdflatex, which produces PDF directly, has nowhere to put them. There are three ways out, and all three were confirmed working on TeX Live 2024.

terminal
# route 1: the classic DVI path
latex figure.tex
dvips figure.dvi -o figure.ps
ps2pdf figure.ps

# route 2: stay in pdflatex, let auto-pst-pdf shell out
pdflatex --shell-escape figure.tex

# route 3: just use xelatex - no extra package needed
xelatex figure.tex

Route 1 is the classic and the most reliable: latex makes the DVI, dvips turns it into PostScript, and ps2pdf (from Ghostscript) turns that into PDF. One measured caveat here — Ghostscript 10.03.0 printed "WARNING: Transparency operations ignored - need to use -dALLOWPSTRANSPARENCY" along the way. That means PSTricks transparency (the opacity family) is silently dropped, so if you use translucent fills, check the result with your eyes.

Route 2 keeps the pdflatex workflow and hands the backstage work to auto-pst-pdf. The mechanism is plain: during the pdflatex run, auto-pst-pdf launches a second LaTeX as a child process, renders only the PSTricks parts through PostScript into <jobname>-pics.pdf, and folds that in. Run it and the log shows "auto-pst-pdf: Auxiliary LaTeX compilation" — route 1 turning over behind the scenes. Because it spawns an external process, --shell-escape is mandatory; forget it and you are told off quite plainly: "! Package auto-pst-pdf Error: auto-pst-pdf will not work!" This route is the strong choice when you need PNG or JPEG images in the same document.

Route 3 is the most surprising and the easiest: run the same source, unchanged by a single character, through xelatex. No extra package to install — the PSTricks bundle in TeX Live 2024 itself ships a configuration file at tex/generic/pstricks/config/xdvipdfmx.cfg, loaded automatically when the run is XeLaTeX (its name duly appears in the log). Because XeLaTeX goes through a DVI-family intermediate internally, PostScript \specials pass straight through. If your document is already set with XeLaTeX, you can fairly say PSTricks needs no workaround at all.

Xy-pic and \xymatrix: still works, frozen since 2013

Xy-pic (package name xy) is a general-purpose package for typesetting graphs and diagrams, working under plain TeX, LaTeX, and AMS-LaTeX alike. It needs no special output route — pdflatex handles it directly. What is charming is that it writes its own particulars into the log on every compile; on TeX Live 2024 it prints " Xy-pic version 3.8.9 <2013/10/06>". The copyright in xy.tex runs from 1991 to 2013, Kristoffer H. Rose and others. Over twenty years of use, and over ten years without an update, compressed into a single line.

In practice the part people use is \xymatrix, for commutative diagrams. It 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 \ar, whose target is a direction key — [r] right, [l] left, [u] up, [d] down, and combinations such as [rd] for the cell one step right and down. Arrow labels reuse the notation of math scripts: ^ puts the label above the arrow (left, as seen along its direction) and _ below it (right). The usual load is \usepackage[all]{xy}, where [all] turns on the standard set of features.

latex
\usepackage[all]{xy}
% ...
\[
\xymatrix{
  A \ar[r]^{f} \ar[d]_{\alpha} & B \ar[d]^{\beta} \\
  C \ar[r]_{g}                  & D
}
\]

This gives a commutative square with A, B, C, D at the corners: f rightward along the top, α downward on the left, β downward on the right, g rightward along the bottom. A diagram is itself a piece of mathematics, so it sits inside a display math environment. For a new commutative diagram, the modern choice today is the TikZ-based tikz-cd — easier with curves, elaborate arrowheads, and intricate multi-row diagrams, and its error messages are readable. The value of this section is in reading and editing manuscripts already written in Xy-pic. The comparison of the two belongs to the commutative-diagrams page.

Asymptote: a language whose compiler ships inside TeX Live

Hearing that an external program is required puts people on guard — but Asymptote’s asy is part of TeX Live. Look in TeX Live 2024’s binary directory and a roughly 45 MB asy sits alongside mpost and mf; asy --version answers "Asymptote version 2.88" and lists "V3D 3D vector graphics output" among its enabled options. In other words, installing TeX Live already gives you Asymptote, with nothing further to fetch. That is the decisive difference from gnuplot, which is not in TeX Live and has to be installed yourself.

Asymptote is not a set of TeX macros but a standalone vector-graphics language. With C++-like syntax, it describes figures as a genuine programming language, complete with variables, functions, loops, and types. Its design intent is interesting too: the official manual presents Asymptote as a language inspired by MetaPost while advertising a cleaner, C++-like syntax. The most unusual part is how it settles dimensions. When an overall size such as size(6cm) collides with elements that do not scale — labels and arrowheads — Asymptote resolves the constraints using the simplex method, that is, linear programming. Drawing languages that run a linear program to decide how big a figure is are not thick on the ground.

To embed it in LaTeX, load \usepackage{asymptote} and write the figure code inside an asy environment. By construction, compiling takes three steps — and running it on TeX Live 2024 went like this. First, pdflatex writes the contents of the asy environment out as <jobname>-1.asy and at the same time reports "Package asymptote Warning: file ... not found on input line 11." — naturally, since the figure does not exist yet. Then asy <jobname>-1.asy produces <jobname>-1.pdf, and a second pdflatex pulls that PDF in. Turning the three steps by hand is tiresome, so in practice you let latexmk do it.

terminal
pdflatex document        # writes document-1.asy
asy document-1.asy       # produces document-1.pdf
pdflatex document        # includes it

# or, in one go:
latexmk -pdf document
asymptote
// a standalone .asy file, run with:  asy figure.asy
import three;
size(6cm);
draw(unitcube);
draw(O--X, red,   Arrow3);
draw(O--Y, green, Arrow3);
draw(O--Z, blue,  Arrow3);

This code imports the three module (its 3D facilities), draws a unit cube, and runs red, green, and blue three-dimensional arrows from the origin along the x, y, and z axes. Figures need not be embedded: written as a standalone .asy file like this one and run on their own with asy figure.asy, they can be output as PDF, EPS, SVG, WebGL, or 3D formats embeddable in a PDF. Because TeX typesets the labels, math inside a figure matches the body typeface. For serious 3D — solids and surfaces with coordinate axes — Asymptote is far more natural to write than TikZ. A GUI front end, xasy, comes along too, letting you draw interactively and export .asy source.

MetaPost: with LuaLaTeX you need no external program at all

MetaPost is John Hobby’s reworking of Knuth’s METAFONT — a language for describing fonts — with PostScript as its output. It inherits METAFONT’s notation for solving smooth curves out of points and directions (Hobby’s algorithm), and lets you state coordinates declaratively, as equations. The classical way to use it is as a standalone language: hand a .mp file to the dedicated program mpost and get EPS back.

In modern LaTeX, though, that external call is unnecessary. Load the luamplib package and you can write MetaPost straight into an mplibcode environment. LuaTeX has the MetaPost engine built in as the mplib library, so there is no separate mpost to launch and no --shell-escape to enable. Running the example below through lualatex on TeX Live 2024 produced a PDF in a single pass without invoking any external process. Of the four systems on this page, MetaPost by way of LuaLaTeX is the only one that demands no extra external tool at all.

document.tex
% 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 mplibcode are pure MetaPost. beginfig(1)endfig delimit one figure; it draws the unit circle scaled to a 2 cm diameter with a 1 pt pen, then rules one horizontal and one vertical diameter across it. fullcircle, pencircle, and scaled are all part of MetaPost’s built-in vocabulary. The key piece of its ecosystem is MetaFun, a feature-rich format through which the typesetting system ConTeXt integrates MetaPost deeply. If you work in ConTeXt, MetaPost is the central drawing facility; if you work mainly in LaTeX, the position is TikZ by default and MetaPost when you want its METAFONT-descended way of describing curves.

The four compared: which to choose, and when

Laid out by output route and engine, the basis for choosing becomes visible. For maintaining an existing document, make yourself able to read and write whatever system it already uses. If you need 3D figures, Asymptote. If you work in ConTeXt, MetaPost through MetaFun. For a new commutative diagram, tikz-cd rather than Xy-pic. And for the great majority of drawing that fits none of these, the soundest judgment is TikZ — no external tool, no special output route.

SystemOutput route / engineExternal toolStrength / main use
PSTrickslatex → dvips → ps2pdf, or pdfLaTeX with auto-pst-pdf, or XeLaTeX on its owndvips and Ghostscript; the auto-pst-pdf route also needs --shell-escapeHigh-quality PostScript fills and effects; many legacy documents; still maintained (v3.19c, 2024)
Xy-picRuns under ordinary LaTeX; no special routeNoneThe commutative-diagram veteran; tikz-cd is the modern replacement; frozen at 3.8.9 (2013)
Asymptotelatex/pdflatex → asy → latex again; or a standalone .asyasy ships with TeX Live; latexmk can automate the passesSerious 2D and 3D; solids and surfaces with axes; outputs SVG, WebGL, even 3D PDF
MetaPostProcess .mp with mpost; or LuaLaTeX plus luamplib’s mplibcodeNone via LuaLaTeX — mplib is built into LuaTeXMETAFONT-descended curves and coordinates as equations; central to ConTeXt (MetaFun)