go-tex

go-tex

Pure-Go TeX that runs the real LaTeX classes — in Go and in the browser.

Try it in your browser → Documentation GitHub

Genuine LaTeX classes, in pure Go

go-tex is a pure-Go (CGO_ENABLED=0) TeX effort. Its engine is a faithful re-implementation of TeX — the category-code mouth and gullet, a scaled-point stomach with Knuth–Plass line breaking and a cost-based page builder, \halign tables, math, OpenType fonts, and PDF/SVG output — and on top of it, it loads and runs the genuine LaTeX classes: \documentclass{article}, {report} and {book} execute the real, embedded .cls files (LPPL, verbatim) — not an emulation. They typeset a numbered title, a dotted \tableofcontents, numbered sections, \chapter, numbered figure/table captions, lists, and math.

Because the class files are embedded and the resolver needs no filesystem, the real classes also run in the browser via js/wasm — genuine LaTeX class rendering client-side, with no TeXLive and no server.

Capabilities

A full pipeline, gated by objective oracles.

Real base classes
article, report and book load and run the genuine embedded LaTeX .cls files — numbered title, dotted TOC, numbered sections/chapters, figure/table captions, lists, math.
Faithful engine
Category-code mouth and gullet, a scaled-point stomach with Knuth–Plass line breaking, a cost-based page builder, and \halign tables.
Math & fonts
Math via go-tex/math (vector output); OpenType fonts with a built-in default font, kerning and ligatures — runs with no assets.
PDF & SVG output
Embedded-subset-font PDF with selectable text, and self-contained SVG pages carrying a source map for click-to-line.
In the browser
A self-contained js/wasm build renders real LaTeX classes client-side — no TeXLive, no server.
Held to fidelity
A byte-exact conformance ratchet plus a whole-document prose check against a real LaTeX engine (tectonic): ~90% median of the reference's prose words on real arXiv article papers.

Packages

4 module(s) — generated from the org's repos.

EN
engine
The pure-Go TeX engine — faithful mouth + gullet, scaled-point stomach with Knuth–Plass line breaking, ~306 primitives, e-TeX, \halign tables, math, OpenType fonts, PDF/SVG output, and the real embedded LaTeX classes (article/report/book/amsart), native and js/wasm.
MA
math
Pure-Go TeX math-mode typesetter → self-contained SVG via the OpenType MATH table (fractions, radicals, matrices, big operators with limits, stretchy delimiters, scripts, ~200 named symbols, \mathbb/\mathcal/…). Ships STIX Two Math; wasm-ready.
PR
pdfrender
Pure-Go (CGO=0) rasteriser for PDF figures. Plugs into the engine's RasterizePDF seam so \includegraphics{fig.pdf} renders raster pixels instead of a framed placeholder. A separate module, to keep the engine/wasm core free of a heavy dependency.
TM
texmf
Pure-Go on-demand TeX support-tree fetcher for machines with no TeX distribution. Redistributes nothing: fetches pinned, SHA-256-verified upstream macro source into a user cache, and supplies Tree.Resolve to the engine. Never fetches speculatively.

Scope

The engine loads and runs the standard base classes — article, report, book and now amsart as real embedded files — and any resolvable .cls/.sty runs as real TeX macros. It is functional-parity-oriented and held to real-LaTeX fidelity, not a claim of full TeXLive parity: heavy drawing (tikz/pgf) is gated and still in bring-up, biblatex is not yet supported, PDF figures need the pdfrender module, and floats typeset inline unless placement is enabled. Every supported feature — and every remaining gap — is listed in the capability reference.