Asymptote

Asymptote

A programming language for mathematical figures

Description

A force diagram or a function plot for a paper, drawn in a graphics program, comes out with formula labels as bitmaps, fonts that do not match the body text, and no way to change one parameter without redrawing the whole thing. Asymptote takes the other approach: the figure is not drawn but written — a few lines in a descriptive language, with the program computing the coordinates, emitting vector output, and handing labels to LaTeX so fonts, sizes and math styling match the surrounding text exactly.

The syntax is close to C++, with variables, functions, loops and user-defined types, so changing a decay coefficient from 0.3 to 0.5 is one edit and a rerun rather than a redraw. Parametric curves, 3D surfaces and precise geometric constructions — the things a mouse is bad at — are the cases where writing the formula is the direct route. Output covers PostScript, PDF, SVG and PNG, plus interactive WebGL and 3D figures embedded in PDFs.

Features



A descriptive drawing language: C++-like syntax with variables, functions, loops, arrays and user-defined types, so figures are computed from code and a changed parameter just means rerunning it.

LaTeX-typeset labels: text and formulas inside the figure are rendered by LaTeX, keeping font, size and math styling identical to the document instead of mixing two typefaces.

Vector output: PostScript, PDF and SVG export stays sharp at any magnification, which takes resolution worries out of submission and print.

3D graphics: surfaces, paths and solids can be described directly and exported as WebGL pages or rotatable 3D figures embedded in a PDF that readers can turn themselves.

Flexible coordinates: true coordinates and scale-invariant coordinates coexist, so line widths, arrowheads and labels do not distort when the whole figure is scaled.

Extensive module library: bundled graph, geometry, three and contour modules provide high-level functions for function plots, geometric constructions, contour maps and statistical charts.

Runs in a browser: an official web application lets you write and run code and see the result without installing anything, which makes trying it before committing easy.

Cross-platform and open source: Windows, macOS and Linux builds under the GNU LGPL, and it can be embedded in a LaTeX document so figures are generated during compilation.