STACKS
As of +30 days +90 days +1 yearToday
typesetting-documents-with-claude-code
0 within valid-until
33 past it, not rechecked

How to get Claude Code to typeset beautiful documents: Typst, LaTeX or ConTeXt, and with what working method

Which typesetting system (Typst, LaTeX, ConTeXt) fits Claude Code best, how well models write each of them, what a loop with a PNG preview gives and where each system wins typographically, also in Polish typesetting (November 2026).

Typst 0.15 by default, and beauty is decided by the working method.

Models write LaTeX more surely than Typst: in source repair 74.2% against 60.3% of compilations, in a benchmark without Claude c1, and the authors put this down to newer syntax and less data, which they do not verify themselves c2. On the small TypstBench Claude 4 Sonnet was the best of those tested c3. Errors in Typst are predictable: mathematics in LaTeX syntax c7 and old syntax habits, which is why Typst skills make the agent read the local documentation before writing c8 c9. The strongest evidence concerns method: one shot by frontier models gives 37–43/100 c4, the Claude Code loop of edit, compile, score gives 81.6 c5, and the image preview alone adds a few points c6. That harness measures fidelity to a pdfLaTeX reference, not beauty.

A compile without errors says nothing about the look, so the loop has to have PNGs.

The preview caught a table running off the page that check did not see c17; the same holds for LaTeX c18. Typst gives a PNG of every page with one command c16, has more readable messages than TeX's noisy log c19, and since 0.15 supports variable fonts c14 c15. It is better to render the pages to PNG oneself, because the API counts a PDF page as at most 1,568 image tokens c21. By default Claude designs poorly (tight leading, half the page empty) c10, and precise layout in LaTeX with it can be agony c11, hence a house template tuned once by a human. In its own PDF skill Anthropic uses reportlab, not a typesetting system c12.

LaTeX (LuaLaTeX + microtype) still sets a paragraph better.

Typst has the same basic paragraph algorithm, but LaTeX has extra tricks c22. Typst has no font expansion c24, which microtype gives in pdfTeX and LuaTeX c25; it does have character-level justification c23. In Ueding's comparison Typst's right margin was restless c26, and LWN sees weaker control of widows and orphans c27. Tectonic is convenient for an agent c20, but it stands on XeTeX, so it has no expansion (our inference from c25). For long, dense texts where microtypography counts, LuaLaTeX; for reports and company documents with one's own template, Typst.

Polish typesetting: in Typst the care for single-letter words has to be added.

Typst has Polish hyphenation patterns c28, but it does not keep single-letter words off the end of a line, and the workaround with a show rule sometimes breaks justification c29; LuaLaTeX has the ready-made luavlna c30. […]

ConTeXt is out for an agent.

There are no measurements of how models write it; Hagen describes a mix-up of its syntax with LaTeX c13, and ConTeXt itself assumes that the author does the layout c32. Practitioners of LaTeX with Claude say the breakthrough comes only when the agent builds the document itself and reads the log c33; for LaTeX there is a ready-made skill with a visual loop (PaperFit) c34.

Claims

In our words

In the source's words

c1checked on 24 Nov 2026not rechecked since 24 Dec 2026

In TeXFix-Bench repaired sources compile less often in Typst (60.3%) than in LaTeX (74.2%).

LaTeX (74.2%, N=30,814N{=}30{,}814), then Typst (60.3%

arxiv.org · T1

c2checked on 24 Nov 2026not rechecked since 24 Dec 2026

The authors of TeXFix-Bench link the Typst gap to newer syntax and less training data, but do not verify this.

is consistent with newer syntax and less public training mass, though we do not observe training corpora directly

arxiv.org · T1

c3checked on 24 Nov 2026not rechecked since 24 Dec 2026

On TypstBench (61 tasks) Claude 4 Sonnet had 70.49%, the most of the models tested.

| Claude 4 Sonnet | 70.49% |

github.com · T2

c4checked on 24 Nov 2026not rechecked since 24 Dec 2026

One-shot conversion of hard LaTeX documents to Typst by frontier models (Opus 4.7 among them) gave 37–43/100 and 0 of 6 quality gates.

| Frontier LLM, one shot (Gemini 3.1 Flash-Lite / Sonnet 4.6 / Opus 4.7) | 37–43/100 overall, 0 of 6 pass the quality gates |

github.com · T2

c5checked on 24 Nov 2026not rechecked since 24 Dec 2026

The Claude Code loop of edit, compile, score raised the result from 37 to 81.6.

**1. An agentic harness that improves scores from 37 to 81.6.**

github.com · T2

c6checked on 24 Nov 2026not rechecked since 24 Dec 2026

In that loop Opus without a preview had 67.4, with diff images 75.1, and with images and raster scoring 81.6.

| Agentic, Opus, visual feedback (harness v1) | 75.1 |

github.com · T2

c7checked on 24 Nov 2026not rechecked since 24 Dec 2026

A practitioner: models writing mathematics in Typst almost always use LaTeX mathematics.

They almost always use LaTeX math

gatlen.blog · T4

c8checked on 24 Nov 2026not rechecked since 24 Dec 2026

Typst skills for agents exist because models fall back on LaTeX habits and old syntax.

When you ask an LLM to write Typst markup, it can fall back on LaTeX habits or outdated syntax.

github.com · T4

c9checked on 24 Nov 2026not rechecked since 24 Dec 2026

A Typst skill makes the agent search the local documentation instead of guessing from old data.

Instead of hallucinating syntax or guessing based on outdated training data, the agent is instructed to search through these local resources

github.com · T4

c10checked on 24 Nov 2026not rechecked since 24 Dec 2026

A practitioner: Claude Code with Opus 4.8 knows Typst, but by default designs a PDF badly (too little leading, half the page empty).

Claude by default is crap at designing even a reasonably formatted PDF

news.ycombinator.com · T4

c11checked on 24 Nov 2026not rechecked since 24 Dec 2026

A practitioner: precise page layout in LaTeX with Claude Code (Opus 4.7) was agony.

It was agonizing directing Claude Code (Opus 4.7 at that time) to create a (non-mathematical) preso using LaTex.

news.ycombinator.com · T4

c12checked on 24 Nov 2026not rechecked since 24 Dec 2026

Anthropic's PDF skill creates new PDFs with the reportlab library.

| Create PDFs | reportlab | Canvas or Platypus |

github.com · T1

c13checked on 24 Nov 2026not rechecked since 24 Dec 2026

Hans Hagen describes a conversation with a chat model that ended in a mix-up of ConTeXt and LaTeX syntax.

mixups of context and

mail-archive.com · T4

c14checked on 24 Nov 2026not rechecked since 22 Feb 2027

The current version of Typst is 0.15.1, of 17 July 2026.

## Version 0.15.1 (July 17, 2026)

github.com · T1

c15checked on 24 Nov 2026not rechecked since 22 Feb 2027

Typst 0.15 added variable fonts.

Added support for variable fonts

typst.app · T1

c16checked on 24 Nov 2026not rechecked since 22 Feb 2027

Typst exports every page to PNG with one command.

typst compile /tmp/hello.typ "page-{p}.png" -f png

github.com · T4

c17checked on 24 Nov 2026not rechecked since 24 Dec 2026

A successful compile (check) did not catch a table running off the page; only the PNG preview caught it.

had said `ok`, but `preview` of page 2 shows the table running past the right edge.

casoon.github.io · T2

c18checked on 24 Nov 2026not rechecked since 22 Feb 2027

A LaTeX document can compile without errors and still look wrong.

A LaTeX document can compile with zero errors and still look wrong.

github.com · T4

c19checked on 24 Nov 2026not rechecked since 22 Feb 2027

The author of texfot wrote it because TeX's important warnings got lost in a mass of irrelevant output.

It was easy to lose warnings I needed to see in the mass of unvarying and uninteresting output from TeX

mankier.com · T1

c20checked on 24 Nov 2026not rechecked since 22 Feb 2027

Tectonic is quiet and never stops to ask for input.

**quiet and never stops to ask for input**

tectonic-typesetting.github.io · T1

c21checked on 24 Nov 2026not rechecked since 24 Dec 2026

The Claude API counts a PDF page as at most 1,568 image tokens.

Each page’s image uses at most 1,568 visual tokens on every model

platform.claude.com · T1

c22checked on 24 Nov 2026not rechecked since 23 May 2027

Typst uses the same basic paragraph optimisation algorithm as LaTeX, but LaTeX has extra tricks.

even though Typst uses the same fundamental algorithm as LaTeX does to optimize paragraphs, it's true that LaTeX has some extra tricks up its sleeve

typst.app · T1

c23checked on 24 Nov 2026not rechecked since 23 May 2027

Typst has character-level justification; the documentation recommends about 0.01–0.02 em for min and max.

a good value for the `min` and `max` keys is around `0.01em` to `0.02em`

typst.app · T1

c24checked on 24 Nov 2026not rechecked since 23 May 2027

There is no automatic font expansion in Typst.

However, expansion is currently completely absent from Typst, as far as I'm aware.

github.com · T4

c25checked on 24 Nov 2026not rechecked since 23 May 2027

Font expansion in microtype works with pdfTeX and LuaTeX.

Font expansion works with pdfTeX (version 1.20

mirrors.ctan.org · T1

c26checked on 24 Nov 2026not rechecked since 23 May 2027

Ueding, comparing Typst with LaTeX, found Typst's right margin restless and LaTeX's even.

Allerdings finde ich den rechten Rand unruhig, das ist bei LaTeX nicht der Fall.

Paraphrase, not a quote: However, I find the right margin restless; that is not the case with LaTeX.

martin-ueding.de · T4

c27checked on 24 Nov 2026not rechecked since 23 May 2027

LWN: Typst is worse than LaTeX at avoiding widows and orphans.

Typst is not as good as LaTeX at avoiding

lwn.net · T3

c28checked on 24 Nov 2026not rechecked since 23 May 2027

Typst has Polish hyphenation patterns.

| Polish | 16 KiB |

github.com · T1

c29checked on 24 Nov 2026not rechecked since 23 May 2027

Typst does not handle single-letter words at the end of a line by itself; the workaround with a show rule sometimes breaks justification.

sometimes will break the next word in justified text.

github.com · T4

c30checked on 24 Nov 2026not rechecked since 23 May 2027

LuaLaTeX has the luavlna package, which takes care of Polish single-letter words.

In some languages, like Czech or Polish, there should be no single letter words at the end of a line, according to typographical norms.

ctan.org · T1

c32checked on 24 Nov 2026not rechecked since 23 May 2027

ConTeXt assumes that the author does the layout personally.

the expected “end user” is the person doing all the layout.

wiki.contextgarden.net · T1

c33checked on 24 Nov 2026not rechecked since 24 Dec 2026

A practitioner: the rebuilding of a PDF got moving once Claude could build the document itself and read the LaTeX log.

It was that Claude could build the book and read the LaTeX log itself

konradvoelkel.com · T4

c34checked on 24 Nov 2026not rechecked since 24 Dec 2026

There is a skill, PaperFit: a LaTeX agent with a visual loop (compile, render, diagnose, fix).

Vision-in-the-loop LaTeX typesetting agent

github.com · T4

This card

Last checked on 24 Nov 2026. As data: JSON, Markdown. A claim's permanent address is its number: stacks.jakubdudek.com/typesetting-documents-with-claude-code/c1.