
LaTeX renderer
Simon Willison describes using Claude Code (Opus 5.5) to build a browser LaTeX renderer inspired by Tiny Little Office, which stores document data in the URL #fragment and ships an llms.txt so agents can construct document links. He lists the prompts: fragment-hash rendering, a custom compression dictionary for LaTeX, an iframe sandbox against XSS copied from his SVG-in-Markdown tool, and loading from a URL or Gist. The finished tool uses Pako 2.1.0, MathJax 4.1.3, faster-latex 0.3.1 and DOMPurify 3.4.16.
What it claims
Simon Willison had Claude Code (Opus 5.5 Extra) build a client-side LaTeX renderer from three prompts. The whole document lives in the URL #fragment, which makes every rendered document a bookmarkable link. The design copies Tiny Little Office's URL-as-document trick. Tiny Little Office is Paul Ford and Aboard Foundary's suite of ten fragment-based editors, ranging from a word processor to a trip planner.
How it works
The first prompt specified the behaviour. Here it is verbatim, since it is the reproducible part of the post:
I want a tool where you can link to it with a fragment hash #code-here and it treats that code as LaTeX and renders it really effectively. It should also support a prefix which means the latex is compressed with a custom compression dictionary optimized for latex. Use the best available latex render library from a CDN (consider WebAssembly too). If loaded without a fragment hash show an editor you can paste latex into and then toggle to a "rendered" view. That rendered view should be bookmarkable. The #fragment view should let you switch to edit source too.
flowchart TD
A[Page load] --> B{Fragment present?}
B -- no --> E[Editor: paste LaTeX]
E --> R
B -- yes --> C{Compression prefix?}
C -- yes --> D[Decompress with LaTeX dictionary]
C -- no --> R[Render view]
D --> R
R <--> S[Edit source]Two follow-up prompts reused patterns from Willison's existing SVG-in-Markdown tool in the same repo:
- XSS protection. The prompt was "Safe from XSS? We could run in an iframe sandbox like we do on the SVG markdown render project". It points the agent at an existing
<iframe sandbox="...">setup rather than describing one. - Remote loading. The prompt was "load latex from a URL (or gist) similar to the markdown SVG tool".
The shipped dependencies are Pako 2.1.0, MathJax 4.1.3, faster-latex 0.3.1 and DOMPurify 3.4.16.
Limits
- The page does not give:
- the compression prefix string or the dictionary contents
- any compression ratio or size limits
- the sandbox attributes used
- which library handles which step
- The post does not mention an llms.txt for this tool. That was a feature of Tiny Little Office, so agents generating links would have to learn the format from the source.
- No testing of LaTeX coverage or rendering fidelity is reported.
- The post is a build log from a personal tools repo, not a documented or maintained project.
Organisations named here
- Aboard Foundary
- Anthropic
- Claude Code
- Paul Ford
- Simon Willison
Technologies named here
- Claude Opus 5.5 Extra
- Tiny Little Office
- Claude Code
- LaTeX renderer
- llms.txt
- Pako
- MathJax
- faster-latex
- DOMPurify
- SVG in Markdown tool
- WebAssembly
- Claude Opus 5.5
- Claude
- JavaScript
- LaTeX
Techniques named here
- Storing document data in the URL fragment
- Sandboxed iframe rendering
Related in coding-agents
