Asymptote
A powerful vector graphics language that extends MetaPost to three dimensions with C-like syntax and native LaTeX integration, designed as a standard for mathematical figure creation.
Created by Andy Hammerlindl, John C. Bowman, and Tom Prince
Asymptote is a powerful, open-source vector graphics programming language designed specifically for creating publication-quality mathematical and scientific figures. Conceived as the spiritual successor to MetaPost, it extends two-dimensional path construction algorithms to three dimensions, provides native LaTeX typesetting integration for labels and equations, and adopts a clean C-like syntax — positioning itself as a standard for scientific illustration in the same way that TeX became the standard for mathematical typesetting.
History & Origins
Asymptote emerged from frustration with the limitations of MetaPost, the dominant tool for technical drawing in the TeX ecosystem in the early 2000s. MetaPost, written by John Hobby in 1989, inherited a fundamental constraint from its predecessor MetaFont: it used only fixed-point arithmetic, a design choice dating back to Donald Knuth’s work in the late 1970s. This limitation caused numerical precision problems in complex drawings and made extension to three-dimensional graphics impractical.
Andy Hammerlindl, John C. Bowman of the University of Alberta Department of Mathematical and Statistical Sciences, and Tom Prince set out to build a replacement that would preserve what was best about MetaPost — particularly its elegant Bezier curve path construction system — while modernizing everything else. The result was Asymptote version 0.51, released on SourceForge on November 7, 2004.
The project was supported financially by the Natural Sciences and Engineering Research Council of Canada (NSERC), the Pacific Institute for Mathematical Sciences (PIMS), and the University of Alberta Faculty of Science. This institutional backing enabled the sustained development necessary to move from an initial prototype to a mature, widely deployed tool.
The name “Asymptote” plays on the mathematical concept — a curve that approaches but never quite reaches a limit — reflecting both the mathematical domain of the tool and a touch of self-deprecating humor about software that is always approaching perfection.
The MetaPost Lineage
Understanding Asymptote requires understanding the lineage it descends from:
- TeX (Knuth, 1978) — Revolutionized mathematical typesetting
- MetaFont (Knuth, 1979) — Described fonts using Bezier paths and constraint solving
- MetaPost (Hobby, 1989) — Adapted MetaFont for general figure creation, using PostScript output
- Asymptote (Hammerlindl, Bowman, Prince, 2004) — Extended MetaPost with 3D, floating-point arithmetic, and modern syntax
Each step in this lineage solved a problem with its predecessor while preserving the core mathematical elegance of Bezier path construction and deferred constraint solving.
Design Philosophy
Asymptote’s design reflects a set of clear, interrelated goals:
Mathematical precision over convenience. The language was designed for scientists and mathematicians who care deeply about the correctness and aesthetics of their figures. This means native support for mathematical objects like 2D coordinates (pair), 3D coordinates (triple), and LaTeX-rendered labels as first-class elements of the language.
Typographic integration. A figure is not complete if its labels are typeset in a different font or at a different size than the surrounding document. Asymptote labels are processed directly by LaTeX, ensuring that a figure’s annotations are typographically indistinguishable from the document text.
Compiled, not interpreted. Asymptote compiles to virtual machine bytecode rather than being interpreted line-by-line, giving it a performance advantage for complex drawings that involve large numbers of computed paths.
MetaPost compatibility, not compatibility at any cost. Asymptote deliberately adopted MetaPost’s proven path construction model but did not try to be a drop-in replacement for MetaPost syntax. The C-like syntax was chosen to be more immediately readable to programmers familiar with C, C++, or Java.
Language Features
Primitive Types
Asymptote’s type system reflects its domain. In addition to familiar types like bool, int, real, and string, it defines:
pair: A 2D point or complex number(x, y). Arithmetic on pairs is well-defined (including complex multiplication), making vector rotation and scaling natural operations.triple: A 3D coordinate(x, y, z), the key enabler of Asymptote’s 3D graphics capabilities.bool3: A three-state boolean with valuestrue,false, anddefault. This unusual type is used in graphics context settings where a value may be explicitly set or may inherit from a parent context.pathandpath3: First-class representations of 2D and 3D Bezier curves and paths.pen: Encapsulates drawing attributes — color, line width, dash pattern, and font.picture: A drawing canvas that accumulates paths and labels for deferred rendering.
// Declaring and using pairs and triples
pair A = (0, 0);
pair B = (3, 0);
pair C = (1.5, 2.6);
// Drawing a triangle
draw(A--B--C--cycle);
label("$A$", A, SW);
label("$B$", B, SE);
label("$C$", C, N);
Path Construction
Asymptote inherits MetaPost’s elegant path notation, using -- for straight line segments and .. for smooth Bezier curves with automatically computed control points:
// Smooth curve through points
path p = (0,0)..(1,1)..(2,0)..(3,1);
draw(p, blue+1.5bp);
// Circle approximation
path circle = unitcircle scaled 2cm;
filldraw(circle, yellow, black);
The .. operator invokes Knuth’s spline algorithm to find control points that produce visually smooth curves — the same algorithm used in MetaFont and MetaPost.
Three-Dimensional Graphics
The extension to 3D is Asymptote’s most significant technical contribution. Three-dimensional paths, surfaces, and solids are fully supported:
import three;
import graph3;
size(200);
currentprojection = perspective(5,4,3);
// Draw a 3D surface
triple f(pair t) {
return (cos(t.x)*sin(t.y), sin(t.x)*sin(t.y), cos(t.y));
}
surface s = surface(f, (0,0), (2pi,pi), 16, 8, Spline);
draw(s, surfacepen=material(blue+opacity(0.7)));
3D figures can be exported to multiple formats:
- PostScript/PDF — For static print publication
- PRC — Interactive 3D objects embeddable in PDF (viewable in Adobe Acrobat)
- WebGL — Interactive 3D for web browsers
LaTeX Integration
Labels in Asymptote are LaTeX strings rendered by a full LaTeX installation:
label("$\displaystyle\int_0^\infty e^{-x^2}\,dx = \frac{\sqrt{\pi}}{2}$",
(0,0));
This means any LaTeX construct — including AMS math, custom macros, and font commands — can appear in a figure label, ensuring perfect typographic consistency with the enclosing document.
Object-Oriented Features
While primarily procedural, Asymptote supports structures (similar to C++ struct) with access control modifiers:
struct Point {
real x, y;
void operator init(real x, real y) {
this.x = x;
this.y = y;
}
real distance(Point other) {
return sqrt((x-other.x)^2 + (y-other.y)^2);
}
}
Point p = Point(3, 4);
Point q = Point(0, 0);
write(p.distance(q)); // Outputs: 5
Higher-Order Functions
Functions are first-class values in Asymptote, allowing them to be assigned to variables, passed as arguments, and returned from other functions:
typedef real realfunc(real);
realfunc compose(realfunc f, realfunc g) {
return new real(real x) { return f(g(x)); };
}
realfunc sinOfSin = compose(sin, sin);
write(sinOfSin(pi/2)); // sin(sin(π/2))
The xasy Graphical Frontend
In addition to the text-based language, Asymptote ships with xasy, a graphical editor written in Python using the Qt framework (Qt5 through version 3.05; updated to Qt6 in version 3.06). Xasy allows interactive drawing with the mouse; the resulting diagram is saved as editable .asy source code rather than a binary file. This design philosophy — keeping source code as the canonical representation — means that interactively drawn figures remain programmable and reproducible.
Distribution and Ecosystem
Asymptote is distributed through several channels:
- TeX Live — Included in the standard TeX Live distribution, reaching a large portion of the global LaTeX user base
- MiKTeX — Available in the MiKTeX package manager for Windows
- Linux package managers — Available as
asymptotein Debian, Ubuntu, Fedora, and other distributions (though often behind the latest release) - SourceForge — Official binary releases for Linux (x86_64) and Windows
- Web application — The University of Alberta hosts an online runner at asymptote.ualberta.ca, enabling browser-based code execution without local installation
Docker: As of early 2026, there is no official Docker Hub image for Asymptote. Community images exist, but the project’s recommended installation paths are through TeX Live and the package managers listed above.
Specialized Modules
Asymptote ships with an extensive library of modules for specific drawing tasks:
| Module | Purpose |
|---|---|
geometry | Classical Euclidean geometry constructions |
graph | 2D function and data plotting |
graph3 | 3D surface and space curve plotting |
three | Core 3D drawing primitives |
solids | Standard 3D solids (sphere, cylinder, cone, torus) |
feynman | Particle physics Feynman diagrams |
flowchart | Flowchart elements and connectors |
tree | Tree and graph data structure visualization |
bsp | Binary space partition for hidden surface removal |
contour | Contour line plotting for scalar fields |
The feynman module, contributed by Martin Wiebusch, is particularly notable — it provides a complete environment for drawing the Feynman diagrams used in quantum field theory calculations, making Asymptote a useful tool for theoretical physics papers.
Evolution and Milestones
Asymptote’s development has been remarkably consistent over more than two decades. The project reached version 3.00 on February 17, 2025, marking a significant milestone that was celebrated by the community after more than twenty years of active development.
A notable aspect of recent development is the dramatic increase in release cadence: the project published more than ten releases between February and July 2025 alone, reflecting a period of intense development activity. Version 3.06 (February 2, 2026) updated the xasy GUI from Qt5 to Qt6 and added WebGL animation support, while version 3.09 (approximately February 25, 2026) is the latest release at the time of writing.
The codebase, hosted on GitHub at vectorgraphics/asymptote, has accumulated more than 10,000 commits, with John Bowman and Andy Hammerlindl remaining the primary maintainers since the project’s founding.
Current Relevance
Asymptote occupies a well-defined and durable niche in the scientific publishing workflow. Within the mathematics and physics communities, the principal alternatives for programmatic figure creation are:
- TikZ/PGF — A TeX-native drawing system with more users and an enormous library of packages, but a more verbose syntax and no built-in 3D rendering
- MetaPost — The direct predecessor, still actively maintained but without 3D support or floating-point arithmetic
- PGFPlots — A TikZ-based package focused specifically on data plots
- Matplotlib (Python) — Widely used in scientific computing but produces figures that require extra effort to match LaTeX typography
For authors who need true 3D figures, interactive PDF graphics, or WebGL output integrated with LaTeX — particularly in mathematics, mathematical physics, and computer science — Asymptote remains the tool with the most complete feature set. The Art of Problem Solving community’s adoption of Asymptote as its standard diagram tool has also ensured a steady stream of new users from the competitive mathematics world.
Why It Matters
Asymptote represents a thoughtful answer to a specific problem: how do you create figures for mathematical documents that are as carefully crafted as the mathematics itself? By treating figure creation as a programming problem rather than a GUI design task, Asymptote aligns with the same philosophy that made TeX successful — reproducibility, precision, and source code as the canonical representation of a document.
The language’s willingness to introduce domain-specific types like pair, triple, and bool3, rather than forcing users to work through generic data structures, demonstrates a design sensibility that puts the user’s mathematical intuition first. The result is a language where geometric operations read like geometry, and where a circle is drawn with the same natural syntax you would use to describe it mathematically.
After more than twenty years of active development, Asymptote continues to be maintained at a high release cadence, remains the best available option for TeX-integrated 3D technical graphics, and shows no sign of being superseded in its niche.
Timeline
Notable Uses & Legacy
Art of Problem Solving (AoPS)
AoPS uses Asymptote as its primary vector graphics tool for mathematical diagrams across its wiki, forums, and competition mathematics textbooks. The AoPS wiki hosts the project's community documentation.
Academic Mathematics and Physics Publications
Researchers in mathematics, physics, and computer science use Asymptote to generate publication-quality figures for journal papers, leveraging its native LaTeX label integration for typographic consistency.
TeX Live and MiKTeX Distributions
Asymptote is bundled with both major TeX distributions — TeX Live and MiKTeX — making it available to millions of LaTeX users worldwide without separate installation.
Particle Physics Feynman Diagrams
The bundled `feynman` module (contributed by Martin Wiebusch) provides a specialized drawing environment for particle physics Feynman diagrams, used by physicists preparing papers for journals.
University of Alberta Web Application
The Asymptote web application (asymptote.ualberta.ca), developed by Pedram Emami, allows code to be executed in a browser, supporting classroom instruction and quick experimentation without local installation.