Valeon

Start typing to search posts by title.

A futuristic digital landscape featuring an open book surrounded by data displays, charts, and holographic graphics.

Introducing Galley: TeX engine in your browser tab

SFSayed Hamid Fatimi
7 min read
Listen to this post0:00 / --:--

A galley is a tray. Shallow, metal, long enough to hold a column of set type before it goes to the press, and the proof you pull from one is the first moment a writer sees the work as a printed object instead of a manuscript. That moment has mostly gone. What replaced it is a button labelled Export to PDF, and what comes out the other side of that button is almost never a printed object at all.

Here is what those tools actually do. They render your Markdown as a web page, then they print the web page. The evidence is all over the output once you know to look: headings carry browser font weights, the paragraph spacing is CSS, the line breaks fall wherever the box happened to end, and there is no hyphenation worth the name because browsers were never asked to care about the grey of a paragraph. It reads like a website that has been photographed. For a memo, fine. For anything you intend to hand someone in print, it is an embarrassment.

Markdown to LaTeX to PDF was always the natural progression, and I think the reason nobody walked it is that the wrong half of the problem looked hard. Writing LaTeX inside Markdown has been solved for years. Obsidian renders $…$ and $$…$$ cleanly as you type; so does every other serious editor in that family. A physicist can already sit in a plain text file and watch an integral resolve itself in the margin of their notes. The maths was never where people got stuck. Where they got stuck was the last mileturning that file into something a printer or a supervisor would acceptand the workarounds for that mile are all miserable. Export to Word and repair it by hand. Print to PDF from a browser and pretend. Learn LaTeX properly, which is a real answer and a genuinely good one, and also a month of your life you may have wanted to spend on the actual writing.

Galley closes that mile. It walks the Markdown structure straight into LaTeX and hands that LaTeX to a real TeX engine, so the page you get back has been typesetproperly, with the line-breaking algorithm that has been quietly winning this argument since 1978. You choose whether you are making an article, a report, or a book, and the same Markdown produces a different document accordingly. In a book, # is a chapter. No heading is ever swallowed into the title block, which is a small decision that will save you an afternoon of confusion; the title comes from your frontmatter or from the setup dialog, and a # at the top of your file stays exactly where you put it.

The point of doing it in the browser is that you never have to meet the LaTeX at all unless you want to. You write Markdown, which is about as demanding as a text editor and can be learned over a coffee. Galley writes the LaTeX. There is a rich editor with slash commands, a table of contents, a live-typeset maths mode with a searchable catalogue of symbols for when you cannot remember the command, and a source view for when you would rather see the raw file. Underneath all of it the Markdown remains the real documentevery edit serialises straight back to it, so you are never editing a proprietary shadow of your own work.

Your document is saved in your browser's local storage, so closing the tab and coming back later does not lose it. That matters more than it sounds. A book is written over months and a dissertation over a term, and neither is the kind of thing anyone completes in one sitting in front of a tool that forgets. Come back tomorrow, and the manuscript, the configuration and the last state of the editor are where you left them, on your machine and nowhere else. The bin button clears it when you are done, and it asks first.

The part I am most pleased with is the part you cannot see. The TeX engineSwiftLaTeX's XeTeX and dvipdfmx, compiled to WebAssemblyruns in a Web Worker inside your own browser tab. There is no backend. Your manuscript is never transmitted anywhere because there is nowhere for it to go. The only requests galley makes are for its own static files, and they are cached after the first render. This is not a privacy policy I am asking you to trust; it is an architecture, and you can read it. The cost is honest and bounded: the first render pulls down roughly 25 MB of engine and format, and a worst case around 36 MB once your document has touched every font and package it needs. After that, nothing. Compiles are limited by your own CPU rather than by a queue, with a sixty-second ceiling on any single run.

You also get the .tex. Always, including when the render fails, which is deliberatea failed compile must never leave you holding nothing. That file is ordinary LaTeX with a preamble organised and commented for a human being to read. Compile it with xelatex, hand it to a typesetter, edit the geometry by hand, keep it for twenty years. It is yours in the way that a rendered PDF never quite is. And if it turns you into someone who wants to learn LaTeX after all, the source is right there to learn from.

There is a feature in there for anyone self-publishing. Amazon KDP specifies a minimum inside margin that depends on the finished page count of the book, which is a genuinely circular requirement: you cannot know the page count until the thing has been typeset. Galley refuses to guess on your behalf. You state the length you expect, it tells you plainly which assumption it is working under, and after every render it checks that assumption against the real page count and says so when it no longer holds.

I built this partly for the version of myself who spent his physics degree writing papers in LaTeX. That was worth doing and I do not regret the fluency, but I remember exactly how much of it was wrestling with the tool rather than with the argument. If you are a student sitting on a term's worth of Markdown notes and you need a submission-ready report by Thursday, you should not have to become a typesetter first. If you are writing a book, you should be able to see it as a book early, and often, and without an account.

What it will not do yet, it will tell you about. Images are not placedeach one is marked in the output so you can see where it belongs, and a notice names the file that was referenced. Raw HTML comes through as literal text. Lowercase Greek in body prose loses its letters, because the bundled Latin Modern fonts have no coverage for them; inside maths it is fine. Maths itself passes through untouched, with no allow-list and no sanitiser, which is safe precisely because a runaway expression costs you a spinner and your own sixty seconds rather than a shared machine.

It is live at galley.valeon.blog with no account and nothing to configure, and the source is at github.com/sayedhfatimi/galley under AGPL-3.0-or-later, because the WebAssembly TeX engines are. Paste a manuscript in and pull a proof.

Related posts

A gold line art design featuring a swirling vortex, sound waves, and atomic symbols against a dark background.

Growing in the Gaps

In this update, we unveil a revamped OEMI interface that aligns with Valeon's design philosophy, introduce Wavegram — an innovative tool for visualizing and reconstructing audio using Fourier transforms, and hint at a promising new direction we’re exploring in audio synthesis.

SFSayed Hamid Fatimi
6 min read
A stylized digital tree with glowing orange roots and branches, surrounded by various icons representing communication, security, and technology.

Introducing vemail

Introducing vemail: a self-hosted, open-source email client that lets you send and receive emails on your own domain without relying on big-name providers, all while ensuring privacy and ease of use for multi-user setups at a fraction of the cost.

SFSayed Hamid Fatimi
8 min read