Why PhiTeX

A compiler you never wait for.

A paragraph lit on a page; the edit lands in milliseconds

Edits in milliseconds

Change a word and only what it touches is rebuilt. A 400-page thesis is as quick as a letter.

Overleaf, VS Code, Neovim and Emacs around one page

Any editor, Overleaf included

Overleaf, VS Code, Neovim, Emacs, any LSP editor, or a browser tab.

A laptop in flight mode, the page still building

Private and offline

Your paper never leaves your machine or your browser. With TeX Live installed, the network is used only to check for updates, and only if you turn that on.

A shelf where only the packages a paper uses are filled in

TeX Live optional

Without it, each package your paper uses is downloaded once, on first use, and kept.

Lanes of work on every core, pages filling

Multi-threaded Experimental

Paragraphs, pages and the PDF are built in parallel on every core, identical at any thread count. Experimental: not yet stable.

§1 One engine, everywhere

Works where you write.

The same compiler, the same instant page, in the editor you already use.

OverleafA PDF | ⚡ Instant switch in Overleaf's toolbar. It compiles inside your browser: nothing to install.Set up →
VS CodeA live page beside your editor, errors in the Problems panel, click-to-source both ways.Set up →
Neovimphitex.lua (Neovim 0.11+): the page follows your cursor, diagnostics inline.Set up →
Emacsphitex.el (Emacs 29+): the same, beside eglot or lsp-mode.Set up →
Any LSP editorphitex watch --lsp: your buffers built as you type, problems published, your cursor shown on the page.Set up →
A browser tabphitex watch paper.tex serves the live page on 127.0.0.1: open it in any browser, beside any editor. Double-click the page to reach the source.Set up →

§2 Try it

Type in it. The page follows.

A taste of writing with PhiTeX, below. The real engine, compiled to WebAssembly, runs in the demo: in your tab, nothing installed, nothing uploaded, your projects kept in the browser.

Open the demo ↗

main.tex — thesis runs locally · WebAssembly
main.tex
Live preview Fit ▾
This page is a mock-up, not typeset. Edit for real in the demo ↗
⚡ 9 ms · 1 of 12 chunks

A design preview. PhiTeX's own editor, drawn in your browser: the page here is a mock-up, not typeset. To edit a real document, open the demo ↗.

§3 In the terminal

One binary. One command.

phitex watch paper.tex does what latexmk does, in one build: BibTeX or biber, makeindex and the reruns for references all happen inside it, and only when their input changes. No stale ??: every frame is perfect.

§4 Friendly errors

Errors that show in the PDF itself.

No wall of log. The preview says why the page looks the way it does, at the line to look at, and it never breaks. Incomplete input doesn't trap: an open { just runs to the end, and the last good page stays up, dimmed, with a banner saying why.

Every message comes from the compiler itself, with the exact place in your source. There's a --json mode for tools too.

§5 Measured

Measured, in the open.

PhiTeX's PDF is compared byte for byte with pdfLaTeX's and XeLaTeX's on TeX Live's own manuals and the common journal templates, and its speed is measured on the same documents.

Every document, compared and timed →

§6 How it works

An edit rebuilds what it reaches.

A TeX compiler reads your document from the top, every time. PhiTeX keeps the whole build as a graph instead, and an edit changes only what depends on it.

  1. Cut at every paragraph end

    Each piece of your document (a paragraph, a display, a table, a picture) becomes a node of the build, a node that runs TeX on its own text.

  2. Every piece runs at once

    On a cold build the pieces all run at once, on every core. Each starts from what the pieces before it are expected to define, and is checked when they finish. A wrong guess reruns only that piece.

  3. References settle in one build

    What the document writes and reads back (.aux, .toc, .bbl, .ind) is tracked entry by entry. When ¶6 writes eq:main, only ¶2, its reader, runs again. BibTeX, biber and makeindex run inside the build, only when their input changes.

  4. Then the pages

    Line breaking per paragraph, then page breaking, then a node per page for the output routine (headers, footnotes, floats), then the PDF writer.

  5. An edit runs again only what it reaches

    The piece you edited runs again. Pieces after it run again only if they read something whose value changed. A word that moves no line break leaves the other pages alone; a change that reflows text redoes only the pages that actually change. On screen, only the changed part of the page is drawn again, not the whole PDF.

  6. Exactly pdfLaTeX's output

    The engine follows pdfTeX's own specification, and the tests compare its PDF byte for byte with pdfTeX 1.40.29's, object numbers included, at every thread count. A cold build is an edit from nothing: one code path.

§7 FAQ

Questions.

Why “Phi”, and how do I say it?

Fee- or fye-, -tek or -tex, whichever you like. Nobody agrees on how to say LaTeX either ;)

The Phi is φ, the golden ratio. Knuth numbers TeX's versions toward π, and it's at 3.141592653 now. We number PhiTeX's toward φ: this is 1.0, and next come 1.6, 1.61 and 1.618.

Is my document uploaded?

No. On this page and in the browser extension, everything runs locally as WebAssembly; the phitex CLI runs on your own machine. The extension's requests go to overleaf.com, as you, for your own project's files, and to PhiTeX's package shelf for the packages your document uses. None of them carries your text, your file names or who you are. No analytics, no server, no remote code. This site makes no third-party requests either: its fonts and libraries are bundled.

Which documents does it build?

pdfLaTeX and XeLaTeX documents with your packages, BibTeX, biber and makeindex, Unicode and OpenType fonts, and the PDF matches pdfLaTeX's byte for byte. We publish the comparison on TeX Live's own manuals and the common journal templates, with every difference explained: correctness and speed. LuaLaTeX is planned.

What does “incremental = fresh build” mean?

It's PhiTeX's core invariant: after any sequence of edits, the incremental program equals a fresh build of the same text. The tests check it after random edits, and the extension can check it live against a fresh build.

Are there known limits?

Parallel builds (-j) are experimental in PhiTeX 1.0 and not yet stable, so a build uses one thread unless you ask for more. Beyond that, two limits, both on very large TikZ documents, and both will be fixed in a 1.0.x update. In the browser, a document the size of the TikZ manual (1,180 pages) runs out of memory around page 1,000; build it with the phitex CLI instead. On that manual, the live preview also takes about 1.9 times as long as a build without it. Normal documents aren't affected.

Do I need TeX Live?

No. Without it, PhiTeX downloads each package your document uses once, on first use, checks it, and keeps it for offline builds. With TeX Live installed, it uses yours.

What does it cost, and is it open source?

Nothing, and yes. The PhiTeX engine is free software under the GNU Affero General Public License v3.0 (AGPL-3.0-only).

Are these questions really FAQs (Frequently Asked)?

No, I just made them up :'(