# Why a LaTeX compiler can't run on Cloudflare Workers

Original title: Shipping a LaTeX Compiler Behind an Edge App

> Hacker News story 50149609 · language: en · submitted 2026-10-19
> Web version: https://zeli.app/story/50149609
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 13 · by [brgv](<https://news.ycombinator.com/user?id=brgv>) · 💬 7
[original](<https://bhargav.dev/writing/shipping-a-latex-compiler-behind-an-edge-app>) · [HN discussion](<https://news.ycombinator.com/item?id=50149609>)

## Summary

A job tracker on Cloudflare Workers needs to turn LaTeX into PDF, but Workers are V8 isolates that cannot run native TeX engines. The fix is a containerized Tectonic service called over HTTP. The write-up covers shell escape risks, per-job temp directories, path traversal defenses, and failing closed when the auth token is missing—plus the Dockerfile line that turned a three-second compile into a sixty-second timeout.

## Key quote

> Anything the compiler can read, a document can read. So nothing worth reading belongs in the container.

## HN discussion (7 comments)

### [dunham](<https://news.ycombinator.com/item?id=50174871>)

> Have you seen this one: https://github.com/kisonecat/web2js
>
> It's TeX in wasm implemented by writing a pascal to wasm compiler, which seemed like a novel approach. (TeX is written in pascal and typically translated to C before building.)
>
> TeX itself is a 500kb wasm file (compresses to 90k), but the images get much bigger with things like LaTeX pre-loaded.
>
> (The author uses it to run tikz in a browser in this repository: https://github.com/kisonecat/tikzjax)

### [WillAdams](<https://news.ycombinator.com/item?id=50175043>)

> Once upon a time I hand-coded my résumé in Plain TeX, but on multiple occasions when applying for TeX composition jobs was asked for a Word .doc version by HR.
>
> A few years later, when PDFs were more prevalent, I found out in an interview that the .pdf which I had sent in had been converted to plain text and then uploaded into a database of résumés and that it was essentially illegible due to issues with the encodings of the old-style figures, small caps, and ligatures which I had used.
>
> Perhaps it would be helpful to ensure that the PDF is tagged so as to ensure that any automated processing results in a useful extraction of text?

### [wolfi1](<https://news.ycombinator.com/item?id=50149729>)

> I'm thinking of a (La)TeX myself, but more in the lines of eXTeX[0], as it is wirtten in Java. [0] https://github.com/tex-other/extex/tree/master

---

## Cite

- Page: https://zeli.app/story/50149609
- Date: 2026-10-19
- Source: bhargav.dev (https://bhargav.dev/writing/shipping-a-latex-compiler-behind-an-edge-app)
- Hacker News: https://news.ycombinator.com/item?id=50149609

## Other languages

- zh: https://zeli.app/zh/story/50149609 · markdown: https://zeli.app/zh/story/50149609.md
- ja: https://zeli.app/ja/story/50149609 · markdown: https://zeli.app/ja/story/50149609.md
- ko: https://zeli.app/ko/story/50149609 · markdown: https://zeli.app/ko/story/50149609.md
- de: https://zeli.app/de/story/50149609 · markdown: https://zeli.app/de/story/50149609.md
- es: https://zeli.app/es/story/50149609 · markdown: https://zeli.app/es/story/50149609.md
- ru: https://zeli.app/ru/story/50149609 · markdown: https://zeli.app/ru/story/50149609.md
