Staunton — chess boards, diagrams and tournament tables

Hi all,

For my chess publishing I wanted more than “just boards”, so I built staunton, and it’s now on Typst Universe. :tada:

The idea: you hand it a position or a whole game, and it hands you a proper,
referenceable #figure. FEN and PGN both work, and there’s a small pure-Typst
legal-move engine underneath, so you can play a game forward and ask for “the board after White’s 7th move” without pre-computing anything. It also does localized move notation (with variations, figurines, NAGs), tournament tables with the usual tie-breaks, and diagram/table outlines — all in seven languages.

Parse a game, then drop in the position after a given move:


#import "@preview/staunton:0.1.0": parse-pgn, diagram-after

#let opera = parse-pgn(```

[White "Morphy"] [Black "Duke & Count"] [Result "1-0"]

1. e4 e5 2. Nf3 d6 3. d4 Bg4 4. dxe5 Bxf3 5. Qxf3 dxe5 6. Bc4 Nf6 7. Qb3 Qe7 *

```).first()

// A captioned figure of the position after Black's 7th move — you can @ref it.

#diagram-after(opera, "7b")

Just say what you mean and get a figure you can cross-reference. Everything else — themes, board flip, highlights and arrows, custom piece sets, “what-if” variation play, FEN export, HTML output — is in the manual rather than this post, so I’ll just point you there.

The package on Typst Universe:

Source + manual are on GitHub, grab the PDF from the latest release):

It’s just a start, so I genuinely would love your feedback — rough edges, missing chess things or notation quirks in your language. I also want to acknowledge boards-n-pieces
(board-n-pieces – Typst Universe) that was an inspiration for
some of the features.

— Frank

14 Likes

staunton 0.2.2 is out :tada:

Three releases since the announcement above — the highlights:

  • Chess960 / Freestyle chess (0.2.0): start positions from X-FEN or a position number 0–959, with generalized castling.
  • Custom pieces (0.2.0): install your own piece sets, or define fairy pieces and whole custom variants with define-variant.
  • New markings (0.2.0–0.2.2): in-check glow, move-quality badges, and reworked arrows/crosses/circles (clearly visible defaults, proportional strokes, settable margins).
  • Localization (0.2.1–0.2.2): diagram captions (“Position after …”, side to move) and tournament-table headers now follow the document language.

Plus smaller polish: spaced move numbers by default (with a spaced switch), cleaner separation of document defaults vs. per-position options, and an outline fix for caption-less figures.

As always: Typst Universe · GitHub (the manual PDF is attached to each release). Feedback and feature wishes welcome!

4 Likes

I’m not in the chess world but I just wanted to tell you how impressive this package is. It seems to have so many features and I could imagine it being very useful for writing strategy guides for instance.

Thanks! I’m eager to hear from users how the API feels for them usability-wise.