Mirroring¶
A bound book has a spine. The margin next to it has to be wider — for the stitching, and because the page curves into the gutter — and it swaps sides between a right-hand page and a left-hand page. JournalKit resolves this once, at one place, and never again.
Margins are named by their job¶
Margins are inner (the binding side) and outer, not left and right. A
template declares side: right for a recto or side: left for a verso.
When the page's content rectangle is computed, inner becomes the left
margin on a recto and the right margin on a verso.
page:
margins: {top: 2.5, bottom: 7.5, inner: 15, outer: 5}
templates:
front: {side: right, content: [...]}
back: {side: left, content: [...]}
Write left and right explicitly instead and mirroring is off — for a
single-sided card, or a page whose two sides are genuinely different.

Modules never see the side¶
Every module receives a rectangle and draws inside it. It is not told whether the page is a recto or a verso (the render context carries the side for the engine's own use; a module that reads it is a bug). A template is therefore written once and works on both sides, and a module written for one project works in any other.
If you find yourself wanting a module to behave differently on the two
sides, the answer is two templates, or a decoration anchored to inner or
outer.
Decorations mirror through their anchors¶
Page furniture outside the content flow — a rule in the binding margin, a
running head at the thumb edge — uses the anchors inner and outer. They
are the only anchors that know the side, and their offset is measured away
from the text block towards the page edge, so
lands 4 mm into the binding margin on both sides of the spread without
changing. left and right anchors, by contrast, stay put; use them for
things that must not mirror.
Landscape pages turn with the side¶
A template with orientation: landscape is read with the book on its side,
binding at the bottom. Which way the content turns follows from the side —
clockwise on a recto, anticlockwise on a verso — so the same template is
still written once. The margins do not turn: inner is still the binding
margin, and decorations anchored to it stay beside the binding. Modules
are not told the orientation either; they get an upright rectangle in the
turned coordinates and draw in it as usual.
Each landscape page is read on its own. A recto and a verso turn opposite ways (each puts its own binding at the bottom), so two facing landscape pages are not one spread: turning the book to read one leaves the other upside down. That suits single leaves in a binder; a landscape spread across both pages is not supported.
Consequences¶
- One template per page design.
- Mirroring cannot be half-applied; there is no second place it happens.