I’d like to share meshpad, a small package that draws grid paper: square grids, ruled paper (horizontal or vertical lines only) and dot grids, with an optional darker “major” line or dot every N steps. I wrote it for printable maths worksheets, where students need a patch of graph paper next to an exercise.
It is a single function. Use it on its own, next to other content, or as a whole-page background.
#import "@preview/meshpad:0.1.1": grid-paper
// Square grid, 6 × 4 cm: a line every 5 mm, a darker one every 2 steps.
#grid-paper(size: (6, 4), step: 0.5, major-every: 2)
// Dot grid, with explicit lengths.
#grid-paper(size: (5cm, 3cm), kind: "dot", step: 5mm)
// Ruled paper as a whole-page background.
#set page(background: grid-paper(size: (21, 29.7), lines: "horizontal", step: 0.8))
Options include a background fill, custom colors for minor and major marks, and a frame you can switch off. When the size is not a whole multiple of the step, the grid draws every full cell that fits and leaves a narrower strip at the edge; it never overflows. Invalid arguments (a zero step, mixed units, an unknown kind) give a clear meshpad: message instead of an internal error.
The package is drawn with CeTZ 0.5.2, is MIT-licensed, and works with Typst 0.14.0 and later.
Version 0.1.1 is already available on Universe. A 0.1.2 patch is under review: it makes dot grids much faster (a full A4 page of dots 1 mm apart goes from over a minute to under a second) and stops minor lines from cutting into the major lines they cross. Until it lands, prefer line grids for whole-page backgrounds. The example above uses the currently published version.
Feedback is welcome, and so are examples of how you use it in your own materials.

