deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

TeXbrain compiles LaTeX to PDF entirely in the browser with no server or account

TeXbrain is a free, open-source LaTeX editor that runs pdfTeX in the browser via WebAssembly, with on-demand CTAN packages, git integration and no backend.

TeXbrain compiles LaTeX to PDF entirely in the browser with no server or account

What TeXbrain does

TeXbrain, a free and open-source LaTeX editor built by Braian Plaku, turns .tex files into PDFs without any server-side processing. According to the project's GitHub README, which surfaced on Hacker News, every component — editor, compiler and git client — runs client-side, with no accounts or installs required. The app is deployed as static files on GitHub Pages and released under the MIT licence.

The developer's stated motivation was writing a thesis in LaTeX and spending more time fighting tooling than writing: hosted services put git synchronisation behind paywalls, while local setups broke between machines.

WebAssembly pdfTeX with lazy-loaded packages

Compilation relies on SwiftLaTeX's WebAssembly port of pdfTeX. Before each build, project files are written into an in-memory filesystem that the engine operates on. When the engine asks for a file it lacks — a class, package or font — a service worker resolves it through a fallback chain: previously cached files, then the package subset bundled with the app, then a TeX Live mirror on jsDelivr, with a community SwiftLaTeX server as last resort. Every resolved file goes into the browser's cache, so each package is downloaded at most once.

Common packages ship with the app, and most of CTAN is resolved automatically the first time a document needs it. Recompiles are reported to take between one and five seconds, depending on project complexity. Once packages are cached, the app works fully offline; only a never-before-used package needs the network once. Output is previewed live via pdf.js, with multi-page rendering, zoom and a text layer for selection and search.

Editing, git and local files

The editor is built on CodeMirror 6, with a custom LaTeX grammar written as a Lezer parser, autocomplete covering more than 70 commands, code folding, snippets and a command palette. Multi-file projects get a file tree, tabs and drag-and-drop across .tex, .bib, .sty and .cls files, plus templates for articles, theses, beamer slides, reports, CVs and letters.

Git support runs on isomorphic-git, a pure JavaScript git implementation, with the repository held in memory and backed by IndexedDB. Users can clone, branch, stage, commit, push, pull and merge from the same tab. Because browsers cannot speak the git protocol directly, remote operations pass through a CORS proxy — the default is the isomorphic-git project's public proxy, and it can be replaced with a self-hosted one.

Local projects are read and written through the File System Access API, which requires a Chromium-based browser such as Chrome, Edge, Arc, Brave or Opera. Firefox and Safari fall back to a virtual filesystem (OPFS).

Stated limitations

The README is candid about gaps. Only pdfTeX is available — no XeTeX or LuaTeX — so documents depending on fontspec or polyglossia will not compile. Neither bibtex nor biber ships: biblatex documents get a plain thebibliography generated from the .bib file, so references appear but citation styles are ignored, and classic workflows need a checked-in .bbl file. A WebAssembly bibtex is next on the roadmap. Packages are also pinned to the TeX Live 2020 era to match the engine's format files.

On privacy, the project states there is no telemetry, analytics or tracking; git tokens stay in browser localStorage; and compilation happens inside the WASM sandbox with no shell commands executed. On-demand package fetching sends only filenames, never document content.

Why it matters

LaTeX tooling has long been split between heavyweight local installations and hosted services that monetise convenience. TeXbrain demonstrates that a complete pdflatex workflow — compiler, package handling, editor and version control — can live entirely in a browser tab with no account and no backend. That matters for students and researchers on locked-down or shared machines, and for anyone who wants documents to never leave their device.

The package-resolution design also illustrates a broader pattern: shipping a decades-old compiler to the client while treating a distribution like TeX Live as a lazy-loading problem. The current gaps — no XeTeX, no real biber, a 2020-era package freeze — mark the boundary of that approach, and they hit thesis writers with bibliographies hardest. Since it is a self-hostable static site under an MIT licence, it is also a building block others can fork rather than a service to depend on.

  • #latex
  • #webassembly
  • #open-source
  • #browser
  • #pdf

Related posts