Debian Codegraph @

texmf-dist/doc/latex/page-canons/page-canons.tex

raw
1 \DocumentMetadata{
2 lang=en-US,
3 pdfversion=2.0,
4 pdfstandard={UA-2,a-4f},
5 tagging=on,
6 tagging-setup={activate-all},
7 tagging-setup={math/setup=mathml-SE},
8 tagging-setup={math/alt/use},
9 tagging-setup={table/tagging=true},
10 }
11 \documentclass[11pt, twoside, openany]{book}
12 \usepackage{fontspec}
13 \usepackage{unicode-math}
14 \usepackage[canon=vdg, margins=symmetric, paper=letterpaper, showframe]{page-canons}
15 \usepackage{tikz}
16 \usepackage{float}
17 \usepackage{booktabs}
18 \usepackage{lipsum}
19 \usepackage[
20 activate={true,nocompatibility},
21 final,
22 tracking=true,
23 factor=1100,
24 stretch=10,
25 shrink=10
26 ]{microtype}
27 \DisableLigatures{encoding = *, family = *} % disable all ligatures
28 \let\CheckCommand\providecommand
29 \UseMicrotypeSet[protrusion]{basicmath}
30 \setlength\parindent{0pt}
31 \usepackage{parskip}
32 \linespread{1.05}
33 \usepackage{biblatex}
34 \addbibresource{sources.bib}
35 \usepackage{hyperref}
36 \hypersetup{hidelinks}
37
38
39 \newcommand{\showlen}[2]{\noindent\texttt{#1} = \the#2\par}
40 \newcommand{\pkg}[1]{\textsf{#1}}
41 \newcommand{\opt}[1]{\texttt{#1}}
42 \newcommand{\cmd}[1]{\texttt{\textbackslash #1}}
43 \newcommand{\meta}[1]{\textit{\texttt{#1}}}
44 \newcommand{\dimval}[1]{\texttt{#1}}
45
46 \newcommand{\testbox}[1]{%
47 \fboxsep=4pt\fboxrule=0.4pt%
48 \fbox{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{#1}}}
49
50 \newcounter{testnum}
51 \newcommand{\test}[1]{%
52 \stepcounter{testnum}%
53 \par\medskip\noindent
54 \textbf{Test \thetestnum: #1}\par\smallskip}
55
56 \makeatletter
57
58 % tagging hooks
59 \newcommand*{\cns@tag@artifact@begin}{}
60 \newcommand*{\cns@tag@artifact@end}{}
61 \newif\ifcns@luatex
62 \cns@luatexfalse
63 \ifx\directlua\undefined\else \cns@luatextrue \fi
64 \ifcns@luatex
65 \ExplSyntaxOn
66 \AtBeginDocument{
67 \@ifpackageloaded{tagpdf}{
68 \cs_gset:Npn \cns@tag@artifact@begin { \tag_mc_begin:n {artifact} }
69 \cs_gset:Npn \cns@tag@artifact@end { \tag_mc_end: }
70 }{}
71 }
72 \ExplSyntaxOff
73 \fi
74
75 %% helpers
76 \long\def\cns@ifnotempty#1{%
77 \def\cns@tmp{#1}%
78 \ifx\cns@tmp\@empty
79 \expandafter\@gobble
80 \else
81 \expandafter\@firstofone
82 \fi}
83
84 %% counter (scoped to chapter if present, else section)
85 \@ifundefined{chapter}%
86 {\def\cns@parent{section}}%
87 {\def\cns@parent{chapter}}
88 \newcounter{EnvDefinition}[\cns@parent]
89 \renewcommand{\theEnvDefinition}{%
90 \csname the\cns@parent\endcsname.\arabic{EnvDefinition}}
91
92 %% shared dimensions
93 \newbox\cns@box
94 \newdimen\cns@boxsep \cns@boxsep=0.9em
95 \newdimen\cns@boxrule \cns@boxrule=0.4pt
96 \newdimen\cns@indent \cns@indent=2em
97
98 % EnvDefinition
99 \newenvironment{EnvDefinition}[1][]{%
100 \par\addvspace{0.5\baselineskip plus 2pt}%
101 \refstepcounter{EnvDefinition}%
102 \protected@edef\@currentcounter{EnvDefinition}%
103 \setbox\cns@box=\vbox\bgroup
104 \hsize=\linewidth
105 \advance\hsize -2\cns@boxsep
106 \advance\hsize -2\cns@boxrule
107 \linewidth=\hsize \columnwidth=\hsize
108 \parindent=\z@
109 \noindent\textbf{\sffamily Definition~\theEnvDefinition
110 \cns@ifnotempty{#1}{\ \mdseries\sffamily(#1)}%
111 }\strut.\par\nobreak
112 \@afterindentfalse\@afterheading
113 \leftskip=\cns@indent\relax
114 \ignorespaces
115 }{%
116 \par
117 \egroup
118 \vbox{%
119 \cns@tag@artifact@begin\hrule height \cns@boxrule\cns@tag@artifact@end
120 \hbox{%
121 \cns@tag@artifact@begin\vrule width \cns@boxrule\cns@tag@artifact@end
122 \hskip\cns@boxsep
123 \vbox{\vskip\cns@boxsep \box\cns@box \vskip\cns@boxsep}%
124 \hskip\cns@boxsep
125 \cns@tag@artifact@begin\vrule width \cns@boxrule\cns@tag@artifact@end
126 }%
127 \cns@tag@artifact@begin\hrule height \cns@boxrule\cns@tag@artifact@end
128 }%
129 \par\addvspace{0.5\baselineskip plus 2pt}%
130 }
131
132 % TodoNote
133 \newenvironment{TodoNote}[1][]{%
134 \par\addvspace{0.5\baselineskip plus 2pt}%
135 \setbox\cns@box=\vbox\bgroup
136 \hsize=\linewidth
137 \advance\hsize -10pt
138 \linewidth=\hsize \columnwidth=\hsize
139 \parindent=\z@
140 \noindent\textbf{\sffamily Note\cns@ifnotempty{#1}{ \textmd{(#1)}}.}%
141 \par\nobreak
142 \@afterindentfalse\@afterheading
143 \leftskip=\cns@indent\relax
144 \ignorespaces
145 }{%
146 \par
147 \egroup
148 \vbox{\hbox{%
149 \cns@tag@artifact@begin\vrule width 4pt\cns@tag@artifact@end
150 \hskip 6pt\relax
151 \box\cns@box
152 }}%
153 \par\addvspace{0.5\baselineskip plus 2pt}%
154 }
155
156 % description replacement
157 \newenvironment{widedesc}[1][12em]{%
158 \list{}{%
159 \labelwidth=#1\relax
160 \labelsep=0.5em\relax
161 \leftmargin=\labelwidth \advance\leftmargin\labelsep
162 \itemindent=\z@
163 \def\makelabel##1{\normalfont\bfseries ##1\hfil}%
164 }%
165 }{\endlist}
166
167 \makeatother
168
169
170
171
172
173
174 \title{\texttt{page-canons.sty}\\[0.5\baselineskip]
175 \large classical-inspired page layouts with margin functionality}
176 \author{Daniel Quigley}
177 \date{\today}
178
179 \begin{document}
180 \maketitle
181 \tableofcontents
182
183
184 \part{Concepts}\label{part:concepts}
185
186
187 \chapter{Overview}\label{chapter:overview}
188
189 \pkg{page-canons} implements classical page-layout canons with in-house margin notes and sidenotes. Its one declared external dependency is \pkg{geometry}; all other functionality is self-contained. The package recommends Lua\LaTeX.
190
191 The implemented canons are:
192 \begin{widedesc}[12em]
193 \item[Van de Graaf] medieval proportions; text block matches page aspect;
194 \item[Villard de Honnecourt] parametric family ($N=3,6,9,12,15$) with flexible margins;
195 \item[Tufte] asymmetric with wide outer margin for extensive notes;
196 \item[Canon des Ateliers] three styles (ordinary, neater, luxury) from French typographic tradition;
197 \item[Grid] modern $N\times N$ modular system with full control.
198 \end{widedesc}
199
200 \pkg{page-canons} offers four margin modes (\texttt{symmetric}, \texttt{antisymmetric}, \texttt{right}, \texttt{left}), gutter support with two calculation modes, a \texttt{fullwidth} environment, and exported dimensions for margin-aware content.
201
202 Use \pkg{page-canons} when you want canonical proportions and consistent marginalia defaults without adopting a full document class. It sits above \pkg{geometry}: \pkg{page-canons} handles the math; \pkg{geometry}, the implementation. For end-to-end book production, use \pkg{memoir} or KOMA-Script; for a curated editorial idiom, use \pkg{tufte-book}.
203
204 Part I fixes concepts; Part II is the user manual; Part III consolidates tests, edge cases, and a quick reference. All compiled pages show geometry frames (\texttt{showframe}) such that the reader can see the effect of each option directly.
205
206
207 \chapter{Page canons}\label{chapter:pagecanons}
208
209 \section{What is a canon}\label{sec:whatis}
210
211 Page-construction canons are modern reconstructions of historical text-setting, derived from measuring surviving books and inferring the geometry used to divide a page into proportionate text areas and margins. Popularized in the 20th century by Jan Tschichold after work by J. A. van de Graaf, Raúl Rosarivo, Hans Kayser, and others, these rules still influence contemporary book design, adapted to standardized papers and diverse production needs.
212
213 \emph{Canon} comes via Latin \textit{canon} `rule; standard' from Greek \textit{kan\={o}n} `straight rod; measuring rule'. The same sense underlies \textit{canon law} and the musical \textit{canon}.
214
215 In practical terms, a canon takes a page's dimensions and non-arbitrarily calculates margin sizes, positions the text block on the page, maintains proportions across paper sizes, and optionally allocates space for marginalia, headers, and footers.
216
217 \section{Formal definition}\label{sec:formaldef}
218
219 Let $W=\cmd{paperwidth}$, $H=\cmd{paperheight}$, and $g$ be the gutter width.
220
221 \begin{EnvDefinition}\label{def:pagecanon}
222 A \textbf{page canon} is a \emph{scale-equivariant} layout rule
223 \[
224 \mathcal{C} : (F,\Xi) \longrightarrow \Theta,
225 \]
226 where $F$ is a rectangular frame, $\Xi$ is an optional set of parameters and constraints, and $\Theta$ is a layout solution.
227 \end{EnvDefinition}
228
229 The frame is chosen from:
230 \begin{itemize}
231 \item the \textbf{page frame} $P=[0,W]\times[0,H]$, whose four edges are designated \emph{inner}, \emph{outer}, \emph{top}, \emph{bottom} according to binding orientation;
232 \item the \textbf{leaf frame} with gutter $g$: for recto leaf $L_r=[g,W]\times[0,H]$; for verso leaf $L_v=[0,W-g]\times[0,H]$.
233 \end{itemize}
234
235 $\Xi$ may include grid divisions $N$, a baseline step, desired ratios, or style flags. $\Theta$ at minimum specifies a textblock rectangle $T\subseteq F$, equivalently given by margins $(m_i,m_o,m_t,m_b)$; it may also include footer and header bands and marginalia measures (\texttt{marginparwidth}, \texttt{marginparsep}).
236
237 Scale-equivariance requires that, for any $\lambda>0$, $\mathcal{C}(\lambda F,\Xi) = \lambda\mathcal{C}(F,\Xi)$: scaling the frame scales the output proportionally. A canon must declare whether it operates on $P$ or on $L$.
238
239 \section{Two presentations}\label{sec:two}
240
241 The same canon admits two presentations.
242
243 \begin{EnvDefinition}\label{def:parametric}
244 The \textbf{parametric (algebraic) canon} gives functions of the operative frame dimensions.
245 \end{EnvDefinition}
246
247 Define the operative dimensions $W_\ast$, $H_\ast$:
248 \[
249 W_\ast = \begin{cases}
250 W & \mathrm{(page\,frame\, \texttt{guttermode=geometry})}\\
251 W-g & \mathrm{(leaf\,frame\, \texttt{guttermode=satzspiegel})}
252 \end{cases},
253 \qquad H_\ast = H.
254 \]
255
256 Margins are then
257 \[
258 m_j = f_j(W_\ast,H_\ast,\Xi) \cdot \begin{cases}
259 W_\ast & \mathrm{horizontal}, \\
260 H_\ast & \mathrm{vertical},
261 \end{cases}
262 \]
263 where each $f_j$ is a dimensionless ratio.
264
265 \begin{EnvDefinition}\label{def:constructive}
266 The \textbf{constructive (geometric) canon} specifies a procedure on $F$ (subdivide, draw diagonals, intersect lines) that yields a unique textblock $T$.
267 \end{EnvDefinition}
268
269 The resulting fractions are derived; they may depend on the page aspect $H/W$ and need not be `nice' rationals. The parametric form is what \pkg{page-canons} implements; the constructive form shows where the proportions come from and helps justify why certain relationships exist: formulas build, constructions justify.
270
271 \section{Requirements of a page canon}\label{sec:reqpagecanons}
272
273 A canon, then, is a rule we can test; it should behave predictably under scaling, declare the space it acts on, say where it works and what happens when it does not, produce an unambiguous textblock, and change smoothly when inputs do:
274 \begin{enumerate}
275 \item all outputs scale by $\lambda>0$; units do not matter;
276 \item the canon declares its operative frame (page or leaf) and the recto/verso mapping of inner/outer;
277 \item aspect ratios and parameters for which the construction is valid are stated, with a fallback policy otherwise;
278 \item fixed inputs give a unique $T$, with no eyeball steps;
279 \item small input changes do not cause discontinuous jumps (piecewise definitions are allowed, but should be noted).
280 \end{enumerate}
281
282 \pkg{page-canons} implements canons as parametric rules, with an optional \texttt{guttermode=satzspiegel} that switches the operative frame from page $P$ to leaf $L$ by recomputing on $W_\ast=W-g$. The Honnecourt family is encoded algebraically (a constructive origin; an algebraic implementation).
283
284 \section{Related work}\label{sec:relatedwork}
285
286 KOMA-Script \cite{koma-script} \pkg{typearea} chooses a typeblock via \texttt{DIV}, \texttt{BCOR}, and class-level heuristics sensitive to font details; \pkg{page-canons} fixes canonical ratios and shims the result through \pkg{geometry}. Use KOMA for class-integrated page design; use \pkg{page-canons} for literal canons.
287
288 \pkg{memoir} \cite{memoir} offers a comprehensive layout calculus (\cmd{settypeblocksize}, \cmd{setlrmargins}, diagnostics) and is a full publishing toolkit. For end-to-end book production, \pkg{memoir} is the right hammer; \pkg{page-canons} is a small wrench: canons, gutters, marginalia.
289
290 \pkg{tufte-book} \cite{tufte-latex} embodies a coherent editorial idiom beyond raw geometry: wide outer margins, sidenotes, specialized floats. \pkg{page-canons} can mimic the broad proportions but does not implement the idiom.
291
292 \begin{TodoNote}
293 Given $W,H$ and options, margins are fixed by explicit fractions without heuristics. The four margin modes place margin material predictably across \pkg{book}, \pkg{report}, and \pkg{article}. Two gutter modes (invariant textwidth; recomputed on leaf width) are available. Exported lengths (\cmd{marginandtext}, \cmd{fullwidthoverhang}, \cmd{overflowingheadlen}) make margin-aware figures, rules, and floats routine. The package inherits \pkg{geometry}'s flexibility for anything it does not explicitly cover.
294 \end{TodoNote}
295
296 If you already know your exact margins, \pkg{geometry} alone is simpler; if you want canonical proportions and consistent marginalia defaults, \pkg{page-canons} saves you from re-deriving them.
297
298 \section{Limitations}\label{sec:limits}
299
300 \pkg{page-canons} deliberately restricts itself to page geometry:
301 \begin{itemize}
302 \item layout is resolved once at \cmd{AtBeginDocument}; \cmd{pagecanonsetup} can adjust mid-document, but recomputation is global, not per-page or per-chapter;
303 \item the package does not manage line spacing or enforce a baseline grid;
304 \item it is not compatible with classes that manage layout internally (\pkg{memoir}, \pkg{tufte-book}, KOMA-Script); warnings are issued if such classes are detected;
305 \item for Honnecourt and Ateliers, vertical margins are expressed as fractions of $W$ (not $H$), coupling textblock aspect to paper aspect $H/W$; a defensible but contested reading;
306 \item in \texttt{guttermode=geometry}, large binding allowances can collapse the outer margin to zero (warning issued); use \texttt{guttermode=satzspiegel} to preserve proportions;
307 \item the package only computes and applies margins; it does not style headings, floats, front matter, running heads, or captions.
308 \end{itemize}
309
310
311 \part{Using page-canons}\label{part:using}
312
313
314 \chapter{Loading and compatibility}\label{chapter:loading}
315
316 \section{Syntax}\label{sec:syntax}
317
318 \begin{verbatim}
319 \usepackage[<options>]{page-canons}
320 \end{verbatim}
321
322 Options fall into three categories: canon selection; margin and marginalia configuration; canon-specific parameters. Unrecognized options are forwarded to \pkg{geometry}.
323
324 \section{Dependencies}\label{sec:dependencies}
325
326 \pkg{page-canons} targets Lua\LaTeX{} as the recommended engine for PDF/UA-2 accessibility support. The package loads under any modern engine (pdf\LaTeX, Xe\LaTeX, Lua\LaTeX), but emits a warning on non-Lua\LaTeX{} engines; accessibility features may be limited.
327
328 \begin{table}
329 \centering
330 \caption{Package dependencies}
331 \label{tab:packagedependencies}
332 \tagpdfsetup{table/header-rows={1}}
333 \begin{tabular}{ll}
334 \textbf{Package} & \textbf{Role} \\
335 \hline
336 \pkg{geometry} & page layout application \\
337 \end{tabular}
338 \end{table}
339
340 Odd/even page detection is implemented in-house. The package checks for \pkg{ifoddpage} at load time and uses it if already present, but does not require it.
341
342 \section{Document classes}\label{sec:classes}
343
344 \pkg{book} and \pkg{report} default to \texttt{margins=symmetric}. \pkg{article} defaults to \texttt{margins=right}. Warnings are issued for \pkg{memoir} and KOMA-Script classes, which manage layout internally.
345
346 \section{This document's layout}\label{sec:thislayout}
347
348 This primer is compiled with \texttt{canon=vdg}, \texttt{margins=symmetric}, \texttt{paper=letterpaper}, \texttt{showframe}. Exported dimensions at this point in the document:
349
350 \showlen{\string\textwidth}{\textwidth}
351 \showlen{\string\marginparwidth}{\marginparwidth}
352 \showlen{\string\marginparsep}{\marginparsep}
353 \showlen{\string\marginandtext}{\marginandtext}
354 \showlen{\string\fullwidthoverhang}{\fullwidthoverhang}
355
356 Margin mode: \texttt{\pagecanonmargins}.
357
358
359 \chapter{The canons}\label{chapter:canons}
360
361 Each canon is a rule (constructive or parametric) that maps a page or leaf rectangle and optional parameters to a textblock and margins. The default operative frame is the page (\texttt{guttermode=geometry}); if \texttt{guttermode=satzspiegel} is selected, we recompute on the leaf width $W_\ast=W-g$ before mapping back.
362
363 Canon formulas use $W$ and $H$ for page dimensions. In leaf-frame mode, substitute $W_\ast = W - g$ for all $W$ in horizontal calculations; vertical calculations use $H$ unchanged. In the default page-frame mode, $W_\ast = W$ and formulas apply directly.
364
365 \section{Van de Graaf (\texttt{vdg})}\label{sec:vdg}
366
367 The Van de Graaf canon, named after Dutch book designer J. A. van de Graaf, reconstructs medieval manuscript proportions that appear consistently in incunabula and hand-copied texts from the 12th--16th centuries.
368
369 The construction begins with the insight that the text block should maintain the same proportions as the page itself:
370 \begin{enumerate}
371 \item draw both diagonals of the full page spread (verso and recto together);
372 \item draw the diagonal of a single page;
373 \item where the single-page diagonal intersects the spread diagonal determines the text block corner;
374 \item this intersection occurs at exactly $1/9$ of the page width and height.
375 \end{enumerate}
376
377 The $1/9$ fractions are the outcome of the diagonal construction under the usual single-page-within-spread setup; other historical reconstructions exist. The construction is primary; the fractions, derived. Our implementation codifies the fractions.
378
379 \begin{figure}[h]
380 \centering
381 \begin{tikzpicture}[alt={A representation of leylines along a page spread resulting in Van de Graaf canon},scale=0.5]
382 \draw[ultra thick] (0,0) rectangle ++(17,11);
383 \draw (8.5,-0.5) -- (8.5,11.5);
384 \draw[ultra thin] (0,0) -- (17,11);
385 \draw[ultra thin] (0,11) -- (17,0);
386 \draw[ultra thin] (0,0) -- (8.5,11);
387 \draw[ultra thin] (17,0) -- (8.5,11);
388 \draw[ultra thin] (11.333,7.333) -- (11.333,11);
389 \draw[ultra thin] (5.667,7.333) -- (11.333,11);
390 \draw[ultra thin] (5.667,7.333) -- (5.667,11);
391 \draw[ultra thin] (11.333,7.333) -- (5.667,11);
392 \draw[ultra thick] (9.44,9.78) -- (15.11,9.78);
393 \draw[ultra thick] (15.11,9.78) -- (15.11,2.45);
394 \draw[ultra thick] (15.11,2.45) -- (9.44,2.45);
395 \draw[ultra thick] (9.44,2.45) -- (9.44,9.78);
396 \draw[ultra thick] (7.56,9.78) -- (1.89,9.78);
397 \draw[ultra thick] (1.89,9.78) -- (1.89,2.45);
398 \draw[ultra thick] (1.89,2.45) -- (7.56,2.45);
399 \draw[ultra thick] (7.56,2.45) -- (7.56,9.78);
400 \end{tikzpicture}
401 \caption{Van de Graaf canon; textarea shown with spread.}
402 \label{fig:vdg}
403 \end{figure}
404
405 For a page of width $W$ and height $H$:
406 \[
407 m_i = W/9,\quad m_o = 2W/9,\quad m_t = H/9,\quad m_b = 2H/9,
408 \]
409 yielding $\cmd{textwidth} = \tfrac{2}{3}W$ and $\cmd{textheight} = \tfrac{2}{3}H$. Marginalia allocation: $\texttt{marginparwidth} \approx 8W/45$, $\texttt{marginparsep} \approx W/45$. Footer: $\texttt{footskip} = \tfrac{1}{2}m_b$.
410
411 \section{Villard de Honnecourt (\texttt{vdh})}\label{sec:vdh}
412
413 Villard de Honnecourt was a 13th-century French architect whose sketchbook contains about 250 highly precise drawings, 74 of which are architectural; the remainder span naturalism, allegory, scenes, animals, and machines. His \textit{canon de division harmonieuse} uses recursive subdivision of the page, creating a parametric family of layouts based on $N$-fold divisions.
414
415 Define $u = W/(N+3)$. Then
416 \[
417 m_i = u,\quad m_o = 2u,\quad m_t = \tfrac{3}{2}u,\quad m_b = 3u,
418 \]
419 so $\cmd{textwidth} = \tfrac{N}{N+3}W$ and $\cmd{textheight} = H - \tfrac{9}{2}\tfrac{W}{N+3}$.
420
421 Because vertical margins depend on $W$, the block aspect varies with $H/W$.
422
423 \begin{figure}[h]
424 \centering
425 \begin{tikzpicture}[alt={A representation of leylines along a page spread resulting in Honnecourt canon},scale=0.5]
426 \draw[ultra thick] (0,0) rectangle ++(17,11);
427 \draw (8.5,-0.5) -- (8.5,11.5);
428 \draw[ultra thin] (0,0) -- (17,11);
429 \draw[ultra thin] (0,11) -- (17,0);
430 \draw[ultra thin] (0,0) -- (8.5,11);
431 \draw[ultra thin] (17,0) -- (8.5,11);
432 % N=15
433 \draw[ultra thin] (8.98, 10.38) -- (8.02, 10.38);
434 \draw[ultra thin] (8.98, 10.38) -- (8.98,11);
435 \draw[ultra thin] (8.02, 10.38) -- (8.02,11);
436 \draw[ultra thin] (9.07, 10.26) -- (7.93,10.26);
437 \draw[ultra thin] (8.5,10.26) -- (11.333,11);
438 \draw[ultra thin] (8.5,10.26) -- (5.667,11);
439 \draw[ultra thick] (8.98, 10.38) -- (16.04,10.38);
440 \draw[ultra thick] (16.04,10.38) -- (16.04,1.24);
441 \draw[ultra thick] (16.04,1.24) -- (8.98,1.24);
442 \draw[ultra thick] (8.98,1.24) -- (8.98, 10.38);
443 % N=12
444 \draw[ultra thin] (9.07, 10.26) -- (9.07,11);
445 \draw[ultra thin] (7.93, 10.26) -- (7.93,11);
446 \draw[ultra thin] (9.21, 10.08) -- (7.79,10.08);
447 \draw[ultra thin] (8.5,10.08) -- (11.333,11);
448 \draw[ultra thin] (8.5,10.08) -- (5.667,11);
449 \draw[ultra thick] (9.07, 10.26) -- (15.86,10.26);
450 \draw[ultra thick] (15.86,10.26) -- (15.86,1.48);
451 \draw[ultra thick] (15.86,1.48) -- (9.07,1.48);
452 \draw[ultra thick] (9.07,1.48) -- (9.07, 10.26);
453 % N=9
454 \draw[ultra thin] (9.21, 10.08) -- (9.21,11);
455 \draw[ultra thin] (7.79, 10.08) -- (7.79,11);
456 \draw[ultra thin] (9.44, 9.78) -- (7.56,9.78);
457 \draw[ultra thin] (8.5,9.78) -- (11.333,11);
458 \draw[ultra thin] (8.5,9.78) -- (5.667,11);
459 \draw[ultra thick] (9.21, 10.08) -- (15.58,10.08);
460 \draw[ultra thick] (15.58,10.08) -- (15.58, 1.84);
461 \draw[ultra thick] (15.58, 1.84) -- (9.21, 1.84);
462 \draw[ultra thick] (9.21, 1.84) -- (9.21, 10.08);
463 % N=6
464 \draw[ultra thin] (9.44, 9.78) -- (9.44,11);
465 \draw[ultra thin] (7.56, 9.78) -- (7.56,11);
466 \draw[ultra thin] (9.92, 9.17) -- (7.08,9.17);
467 \draw[ultra thin] (8.5,9.17) -- (11.333,11);
468 \draw[ultra thin] (8.5,9.17) -- (5.667,11);
469 \draw[ultra thick] (9.44, 9.78) -- (15.11,9.78);
470 \draw[ultra thick] (15.11,9.78) -- (15.11,2.45);
471 \draw[ultra thick] (15.11,2.45) -- (9.44,2.45);
472 \draw[ultra thick] (9.44,2.45) -- (9.44, 9.78);
473 % N=3
474 \draw[ultra thin] (11.333,7.333) -- (11.333,11);
475 \draw[ultra thin] (5.667,7.333) -- (5.667,11);
476 \draw[ultra thin] (9.92, 9.17) -- (9.92,11);
477 \draw[ultra thin] (7.08, 9.17) -- (7.08,11);
478 \draw[ultra thin] (11.333,7.333) -- (5.667,7.333);
479 \draw[ultra thin] (8.5,7.333) -- (11.333,11);
480 \draw[ultra thin] (8.5,7.333) -- (5.667,11);
481 \draw[ultra thick] (9.92, 9.17) -- (14.17,9.17);
482 \draw[ultra thick] (14.17,9.17) -- (14.17,3.66);
483 \draw[ultra thick] (14.17,3.66) -- (9.92,3.66);
484 \draw[ultra thick] (9.92,3.66) -- (9.92, 9.17);
485 \end{tikzpicture}
486 \caption{Honnecourt canon, textareas drawn for each $N$; shown with spread.}
487 \label{fig:vdh}
488 \end{figure}
489
490 Configurations are given in Table~\ref{tab:vdhconfig}. Exact recovery on an integer grid occurs only for special paper aspects.
491
492 \begin{table}[h]
493 \centering
494 \caption{Honnecourt configurations.}
495 \label{tab:vdhconfig}
496 \tagpdfsetup{table/header-rows={1}}
497 \begin{tabular}{@{}llllll@{}}
498 \toprule
499 $N$ & \bfseries Inner & \bfseries Outer & \bfseries Top & \bfseries Bottom & \bfseries Margin space \\
500 \midrule
501 3 & $W/6$ & $W/3$ & $W/4$ & $W/2$ & generous \\
502 6 & $W/9$ & $2W/9$ & $W/6$ & $W/3$ & classic \\
503 9 & $W/12$ & $W/6$ & $W/8$ & $W/4$ & moderate \\
504 12 & $W/15$ & $2W/15$ & $W/10$ & $W/5$ & economic \\
505 15 & $W/18$ & $W/9$ & $W/12$ & $W/6$ & compact \\
506 \bottomrule
507 \end{tabular}
508 \end{table}
509
510 \begin{TodoNote}
511 With $N=3$, division into six reproduces the method Tschichold identifies as Marcus Vencentinus's 15th-century prayer-book scheme. The Honnecourt family subsumes it via parameter choice.
512 \end{TodoNote}
513
514 \section{Tufte (\texttt{tufte})}\label{sec:tufte}
515
516 Edward Tufte's page design \cite{tufte2001visual,tufte1990envisioning,tufte1997visual,tufte2006beautiful,tufte2020seeing} prioritizes generous margins for annotations, figures, and marginalia: wide margins accommodate figures without interrupting text flow; multiple information streams coexist; deliberate asymmetry creates dynamic tension; margins invite reader participation.
517
518 This is an algebraic house-style, not a medieval geometric canon; the fractions below are abstracted from Tufte-style layouts.
519
520 \begin{figure}[h]
521 \centering
522 \begin{tikzpicture}[alt={A representation of measured spaces on a page spread resulting in Tufte canon},scale=0.5]
523 \draw[ultra thick] (0,0) rectangle ++(17,11);
524 \draw (8.5,-0.5) -- (8.5,11.5);
525 \draw[ultra thin] (9.5,0) -- (9.5,11);
526 \draw[ultra thin] (0,1.5) -- (17,1.5);
527 \draw[ultra thin] (0,10) -- (17,10);
528 \draw[ultra thin] (13.83,0) -- (13.83,11);
529 \draw[ultra thin] (1,0) -- (1,11);
530 \draw[ultra thin] (5.33,0) -- (5.33,11);
531 \draw[ultra thick] (9.5,1.5) -- (9.5,10);
532 \draw[ultra thick] (9.5,10) -- (13.83,10);
533 \draw[ultra thick] (13.83,10) -- (13.83,1.5);
534 \draw[ultra thick] (9.5,1.5) -- (13.83,1.5);
535 \draw[ultra thick] (1,0) -- (1,10);
536 \draw[ultra thick] (1,10) -- (5.33,10);
537 \draw[ultra thick] (5.33,10) -- (5.33,1.5);
538 \draw[ultra thick] (1,1.5) -- (5.33,1.5);
539 \end{tikzpicture}
540 \caption{Tufte canon; textareas shown with spread.}
541 \label{fig:tufte}
542 \end{figure}
543
544 The ratios are derived directly from the \pkg{tufte-latex} document classes on letterpaper:
545 \begin{itemize}
546 \item inner margin: $W/8.5 \approx 0.1176\,W$;
547 \item outer margin: $\approx 0.372941\,W$ (empirical from \pkg{tufte-latex} on letterpaper; not exactly $3/8$);
548 \item top: $H/11 \approx 0.0909\,H$;
549 \item bottom: $3H/22 \approx 0.1364\,H$;
550 \item textwidth: $\approx 0.509\,W$;
551 \item marginparwidth: $4W/17 \approx 0.235\,W$;
552 \item marginparsep: $W/26 \approx 0.038\,W$.
553 \end{itemize}
554
555 The layout exhibits strong asymmetry with extensive annotation space.
556
557 \section{Canon des Ateliers (\texttt{ateliers})}\label{sec:ateliers}
558
559 The \textit{canon des ateliers} (`workshop canon') follows from French printing tradition. It supplies three distinct styles:
560 \begin{enumerate}
561 \item \textbf{ordinary} (\textit{ordinaire}) maximizes text area while maintaining readability; educational texts and technical manuals;
562 \item \textbf{neater} (\textit{plus soigné}) balanced aesthetic for literary works; increased margins for readability;
563 \item \textbf{luxury} (\textit{luxe}) generous margins for prestigious editions; maximum annotation space.
564 \end{enumerate}
565
566 \begin{figure}[h]
567 \centering
568 \begin{tikzpicture}[alt={A representation of measured spaces on a page spread resulting in canon des ateliers},scale=0.5]
569 \draw[ultra thick] (0,0) rectangle ++(17,11);
570 \draw (8.5,-0.5) -- (8.5,11.5);
571 % ordinary
572 \draw[ultra thin] (9.35,0) -- (9.35,11);
573 \draw[ultra thin] (15.725,0) -- (15.725,11);
574 \draw[ultra thin] (0,9.9375) -- (17,9.9375);
575 \draw[ultra thin] (0,1.4875) -- (17,1.4875);
576 \draw[ultra thick] (9.35,1.4875) -- (15.725,1.4875);
577 \draw[ultra thick] (15.725,1.4875) -- (15.725,9.9375);
578 \draw[ultra thick] (15.725,9.9375) -- (9.35,9.9375);
579 \draw[ultra thick] (9.35,9.9375) -- (9.35,1.4875);
580 % neater
581 \draw[ultra thin] (9.6333,0) -- (9.6333,11);
582 \draw[ultra thin] (15.3,0) -- (15.3,11);
583 \draw[ultra thin] (0,9.5833) -- (17,9.5833);
584 \draw[ultra thin] (0,1.9833) -- (17,1.9833);
585 \draw[ultra thick] (9.6333,1.9833) -- (15.3,1.9833);
586 \draw[ultra thick] (15.3,1.9833) -- (15.3,9.5833);
587 \draw[ultra thick] (15.3,9.5833) -- (9.6333,9.5833);
588 \draw[ultra thick] (9.6333,9.5833) -- (9.6333,1.9833);
589 % luxury
590 \draw[ultra thin] (9.775,0) -- (9.775,11);
591 \draw[ultra thin] (15.0875,0) -- (15.0875,11);
592 \draw[ultra thin] (0,9.40625) -- (17,9.40625);
593 \draw[ultra thin] (0,2.23125) -- (17,2.23125);
594 \draw[ultra thick] (9.775,2.23125) -- (15.0875,2.23125);
595 \draw[ultra thick] (15.0875,2.23125) -- (15.0875,9.40625);
596 \draw[ultra thick] (15.0875,9.40625) -- (9.775,9.40625);
597 \draw[ultra thick] (9.775,9.40625) -- (9.775,2.23125);
598 % mirrors
599 \draw[ultra thin] (7.65,0) -- (7.65,11);
600 \draw[ultra thin] (1.275,0) -- (1.275,11);
601 \draw[ultra thin] (7.3667,0) -- (7.3667,11);
602 \draw[ultra thin] (1.7,0) -- (1.7,11);
603 \draw[ultra thin] (7.225,0) -- (7.225,11);
604 \draw[ultra thin] (1.9125,0) -- (1.9125,11);
605 \end{tikzpicture}
606 \caption{\textit{Canon des ateliers}; textareas drawn for each style; shown with spread.}
607 \label{fig:ateliers}
608 \end{figure}
609
610 Textwidth is set first:
611 \[
612 \texttt{textwidth} =
613 \begin{cases}
614 \tfrac{3}{4}W & \mathrm{(ordinary)}, \\
615 \tfrac{2}{3}W & \mathrm{(neater)}, \\
616 \tfrac{5}{8}W & \mathrm{(luxury)}.
617 \end{cases}
618 \]
619 The remaining whitespace $w = W - \texttt{textwidth}$ is then distributed: $m_i = 0.4w$, $m_o = 0.6w$, $m_t = 0.5w$, $m_b = 0.7w$.
620
621 The three-tiered system reflects material and economic realities of printing; subject matter, print runs, and material costs determined the style. Luxury editions could afford more white space; higher sale price offset the cost of paper. Better bindings (particularly sewn bindings for luxury editions) accommodated wider inner margins without compromising visibility at the spine; cheaper bindings required narrower inner margins.
622
623 \section{Grid (\texttt{grid})}\label{sec:grid}
624
625 The Grid canon is a modern, systematic approach based on modular design popularized by the Swiss International Style. Unlike historical canons, it offers complete parametric control while maintaining modular discipline.
626
627 The page is divided into an $N \times N$ grid. For some $N \geq 3$, let $c_w = W_\ast/N$, $c_h = H/N$. Choose integer cell counts $(L,R,T,B)$ with $L+R < N$ and $T+B < N$. Set
628 \[
629 m_i = Lc_w,\quad m_o = Rc_w,\quad m_t = Tc_h,\quad m_b = Bc_h.
630 \]
631 The text block is
632 \[
633 \cmd{textwidth} = (N-L-R)c_w,\qquad \cmd{textheight} = (N-T-B)c_h.
634 \]
635 The text-area fraction (relative to the operative frame $W_\ast \times H$) is
636 \[
637 \frac{\cmd{textwidth}}{W_\ast}\cdot\frac{\cmd{textheight}}{H}
638 = \Bigl(1-\frac{L+R}{N}\Bigr)\Bigl(1-\frac{T+B}{N}\Bigr),
639 \]
640 and the text-block aspect is
641 \[
642 \frac{\cmd{textheight}}{\cmd{textwidth}}
643 = \frac{N-T-B}{N-L-R}\cdot\frac{H}{W_\ast}.
644 \]
645
646 \begin{figure}[h]
647 \centering
648 \begin{tikzpicture}[alt={A representation of grid on a page spread resulting in grid canon},scale=0.5]
649 \draw[ultra thick] (0,0) rectangle ++(17,11);
650 \draw (8.5,-0.5) -- (8.5,11.5);
651 \foreach \x in {0, 0.9444, 1.8888, 2.8332, 3.7776, 4.722, 5.6664, 6.6108, 7.5552, 8.4996, 9.444, 10.3884, 11.3328, 12.2772, 13.2216, 14.166, 15.1104, 16.0548, 16.9992} {
652 \draw[ultra thin] (\x,0) -- (\x,11);
653 }
654 \foreach \x in {0, 1.2222, 2.4444, 3.6666, 4.8888, 6.111, 7.3332, 8.5554, 9.7776, 10.9998} {
655 \draw[ultra thin] (0,\x) -- (17,\x);
656 }
657 \draw[ultra thick] (9.444,2.4444) -- (15.1104,2.4444);
658 \draw[ultra thick] (15.1104,2.4444) -- (15.1104,9.7776);
659 \draw[ultra thick] (15.1104,9.7776) -- (9.444,9.7776);
660 \draw[ultra thick] (9.444,9.7776) -- (9.444,2.4444);
661 \draw[ultra thick] (7.5552,2.4444) -- (1.8888,2.4444);
662 \draw[ultra thick] (1.8888,2.4444) -- (1.8888,9.7776);
663 \draw[ultra thick] (1.8888,9.7776) -- (7.5552,9.7776);
664 \draw[ultra thick] (7.5552,9.7776) -- (7.5552,2.4444);
665 \end{tikzpicture}
666 \caption{Grid canon for $N=9$; textarea shown with spread.}
667 \label{fig:grid}
668 \end{figure}
669
670 Grid verticals are multiples of $H/N$, \emph{not} fractions of $W$; therefore, the block aspect depends on both $H/W$ and the chosen cell counts. Parameters and defaults are given in Table~\ref{tab:params}.
671
672 \begin{table}[h]
673 \centering
674 \caption{Grid canon parameters (*clamped to 1 when $N=3$).}
675 \label{tab:params}
676 \tagpdfsetup{table/header-rows={1}}
677 \begin{tabular}{@{}llll@{}}
678 \toprule
679 \bfseries Parameter & \bfseries Default & \bfseries Range & \bfseries Description \\
680 \midrule
681 \texttt{gridN} & 6 & $\geq 3$ & grid divisions ($N \times N$) \\
682 \texttt{gridinner} & 1 & $< N$ & inner margin cells \\
683 \texttt{gridouter} & 2* & $< N$ & outer margin cells \\
684 \texttt{gridtop} & 1 & $< N$ & top margin cells \\
685 \texttt{gridbottom} & 2* & $< N$ & bottom margin cells \\
686 \bottomrule
687 \end{tabular}
688 \end{table}
689
690 Useful configurations appear in Table~\ref{tab:useful}.
691
692 \begin{table}[h]
693 \centering
694 \caption{Common grid configurations.}
695 \label{tab:useful}
696 \tagpdfsetup{table/header-rows={1}}
697 \begin{tabular}{@{}lccccc l@{}}
698 \toprule
699 \bfseries Style & $N$ & \bfseries Inner & \bfseries Outer & \bfseries Top & \bfseries Bottom & \bfseries Description \\
700 \midrule
701 minimal & 3 & 1 & 1 & 1 & 1 & maximum text area \\
702 classic & 6 & 1 & 2 & 1 & 2 & balanced proportions \\
703 editorial & 8 & 1 & 3 & 1 & 2 & wide margin notes \\
704 technical & 12 & 1 & 2 & 2 & 3 & documentation layout \\
705 dense & 12 & 1 & 1 & 1 & 2 & maximized content \\
706 \bottomrule
707 \end{tabular}
708 \end{table}
709
710 \section{Disabled (\texttt{canon=false})}\label{sec:false}
711
712 Bypasses all canon calculations. \pkg{geometry} controls layout via its own defaults or any forwarded options. The \texttt{margins} key still applies (\texttt{reversemarginpar} or \texttt{asymmetric} where relevant).
713
714
715 \chapter{Canon relationships}\label{chapter:relationships}
716
717 Historical canons encode specific aesthetic judgments about proportion. The Grid canon provides a framework for systematic decision-making and can reproduce some historical relationships exactly, approximate others, and create new ones.
718
719 \section{Grid as a superset}\label{sec:superset}
720
721 \begin{table}[h]
722 \centering
723 \caption{Classical canons and Grid compared.}
724 \label{tab:superset}
725 \tagpdfsetup{table/header-rows={1}}
726 \begin{tabular}{@{}lccc@{}}
727 \toprule
728 \bfseries Canon & \bfseries Computation & \bfseries Parameters & \bfseries Flexibility \\
729 \midrule
730 Van de Graaf & fixed fractions & 0 & none \\
731 Villard & formula with $N$ & 1 ($N$) & discrete (5) \\
732 Ateliers & whitespace split & 1 (style) & discrete (3) \\
733 Grid & cell counting & 5 ($N$ + 4) & continuous \\
734 \bottomrule
735 \end{tabular}
736 \end{table}
737
738 \begin{TodoNote}
739 Van de Graaf is effectively a $9 \times 9$ grid with fixed allocations: $m_i/W_\ast=1/9$, $m_o/W_\ast=2/9$, $m_t/H=1/9$, $m_b/H=2/9$. The Grid canon recovers Van de Graaf exactly when $N$ is a multiple of $9$ and $(L,R,T,B) = (N/9, 2N/9, N/9, 2N/9)$. If $N$ is not divisible by $9$, the result is a best rational approximation in steps of $1/N$.
740 \end{TodoNote}
741
742 \begin{table}[h]
743 \centering
744 \caption{Van de Graaf canon and Grid compared.}
745 \label{tab:vdggrid}
746 \tagpdfsetup{table/header-rows={1}}
747 \begin{tabular}{@{}lccc@{}}
748 \toprule
749 \bfseries Aspect & \bfseries Van de Graaf & \bfseries Grid equivalent & \bfseries Grid notation \\
750 \midrule
751 division & $9 \times 9$ (implicit) & $9 \times 9$ (explicit) & \texttt{gridN=9} \\
752 inner margin & $W_\ast/9$ (fixed) & 1 cell & \texttt{gridinner=1} \\
753 outer margin & $2W_\ast/9$ (fixed) & 2 cells & \texttt{gridouter=2} \\
754 top margin & $H/9$ (fixed) & 1 cell & \texttt{gridtop=1} \\
755 bottom margin & $2H/9$ (fixed) & 2 cells & \texttt{gridbottom=2} \\
756 text block & $6 \times 6$ cells & $6 \times 6$ cells & computed \\
757 user control & none & full & all parameters \\
758 \bottomrule
759 \end{tabular}
760 \end{table}
761
762 To reproduce Van de Graaf with Grid:
763 \begin{fullwidth}
764 \begin{verbatim}
765 \usepackage[canon=grid, gridN=9, gridinner=1, gridouter=2, gridtop=1, gridbottom=2]{page-canons}
766 \end{verbatim}
767 \end{fullwidth}
768
769 Grid admits variations Van de Graaf does not, e.g.:
770 \begin{verbatim}
771 % same 9x9 grid, but 1:3 horizontal ratio instead of 1:2
772 \usepackage[canon=grid, gridN=9, gridinner=1, gridouter=3]{page-canons}
773 \end{verbatim}
774
775 \begin{TodoNote}
776 Our Honnecourt family sets verticals as fractions of $W$: $m_t = \tfrac{3}{2}u$, $m_b = 3u$ with $u = W/(N+3)$. Grid fixes verticals in steps of $H/N$. Exact equality would require
777 \[
778 T = \frac{3N}{2(N+3)}\cdot \frac{W}{H},\qquad
779 B = \frac{3N}{N+3}\cdot \frac{W}{H},
780 \]
781 which are rarely integers unless the paper aspect is specially tuned. Grid $\to$ Honnecourt is therefore generally an approximation, good for large $N$.
782 \end{TodoNote}
783
784 \begin{TodoNote}
785 Ateliers distributes a fixed whitespace fraction by ratios $0.4:0.6:0.5:0.7$. Integer cell counts cannot reproduce these exactly; choose large $N$ and round.
786
787 \end{TodoNote}
788
789 \begin{table}[h]
790 \centering
791 \caption{Non-integer values ($^{*}$) mark where Grid cannot exactly reproduce Ateliers.}
792 \label{tab:todonote}
793 \tagpdfsetup{table/header-rows={1}}
794 \begin{tabular}{@{}lcccc@{}}
795 \toprule
796 \bfseries Style & \bfseries Text width & \bfseries Whitespace & \bfseries Distribution & \bfseries Grid approximation \\
797 \midrule
798 ordinary & $75\%$ & $25\%$ & $0.4:0.6:0.5:0.7$ & $N=20$, cells $2:3:2.5^{*}:3.5^{*}$ \\
799 neater & $66.7\%$ & $33.3\%$ & $0.4:0.6:0.5:0.7$ & $N=15$, cells $2:3:2.5^{*}:3.5^{*}$ \\
800 luxury & $62.5\%$ & $37.5\%$ & $0.4:0.6:0.5:0.7$ & $N=16$, cells $2.4^{*}:3.6^{*}:3:4.2^{*}$ \\
801 \bottomrule
802 \end{tabular}
803 \end{table}
804
805 Grid can reproduce exactly:
806
807 \begin{itemize}
808 \item Van de Graaf with $N=9$, margins $1:2:1:2$;
809 \item simple ratios like $1:2$, $1:3$, $2:3$.
810 \end{itemize}
811
812 It can approximate:
813
814 \begin{itemize}
815 \item Honnecourt's $1.5:3$ vertical ratio (needs $N=6k$ for a $k:2k$ approximation);
816 \item Ateliers' $0.4:0.6$ split (needs large $N$).
817 \end{itemize}
818
819 It can express novel configurations: asymmetric layouts (e.g., $1:4:2:1$), golden-ratio approximations with appropriate $N$, Fibonacci margins.
820
821 \chapter{Margin modes}\label{chapter:marginmodes}
822
823 The \texttt{margins} key controls how inner/outer asymmetry is applied and which side receives marginalia. All four modes compose with any canon.
824
825 \section{\texttt{symmetric} (default for book/report)}\label{sec:symmetric}
826
827 Standard two-sided layout. Marginalia appear in the outer margin. Fullwidth content extends into the outer margin and shifts direction on verso pages.
828
829 \section{\texttt{antisymmetric}}\label{sec:antisymmetric}
830
831 Two-sided layout with marginalia on the \emph{inner} (spine-side) margin. Unusual; useful where annotations face the gutter in spread view.
832
833 \section{\texttt{right}}\label{sec:right}
834
835 Single-sided. Every page has the wider margin on the right. Default for \pkg{article}.
836
837 \section{\texttt{left}}\label{sec:left}
838
839 Single-sided. Every page has the wider margin on the left.
840
841 \section{Geometry flags}\label{sec:geometryflags}
842
843 Each mode maps to \pkg{geometry} as follows:
844
845 \begin{table}[h]
846 \centering
847 \caption{Margin-mode placement}
848 \label{tab:marginplacement}
849 \tagpdfsetup{table/header-rows={1}}
850 \begin{tabular}{@{}lll@{}}
851 \toprule
852 \bfseries Mode & \bfseries Geometry flags & \bfseries Effect \\
853 \midrule
854 \texttt{symmetric} & (default) & two-sided; notes on outer edge \\
855 \texttt{antisymmetric} & \texttt{reversemarginpar} & two-sided; notes on inner edge \\
856 \texttt{right} & \texttt{asymmetric} & one-sided; notes on right \\
857 \texttt{left} & \texttt{asymmetric} & one-sided; notes on left \\
858 \bottomrule
859 \end{tabular}
860 \end{table}
861
862
863 \chapter{Gutters}\label{chapter:gutters}
864
865 The \texttt{gutterval} key adds binding allowance. Two application modes are available via \texttt{guttermode}.
866
867 \section{\texttt{geometry} (default)}\label{sec:guttergeometry}
868
869 Adds the gutter to the inner margin and subtracts it from the outer margin, preserving page width but shifting the text block toward the outer edge. Since $\cmd{textwidth} = W - (m_i + m_o)$ and the change is $+g$ inner, $-g$ outer, the sum is unchanged.
870
871 Caveat: large binding allowances can collapse the outer margin to zero (warning issued).
872
873 \section{\texttt{satzspiegel}}\label{sec:guttersatzspiegel}
874
875 Reduces the effective leaf width to $W_\ast = W - g$ before computing the canon, then adds the gutter back to the inner margin. This shrinks the text block rather than stealing from the outer margin: $\Delta\cmd{textwidth} = -\alpha\,g$ with $\alpha = \tfrac{2}{3}$ (vdg), $\tfrac{N}{N+3}$ (vdh), $\approx 0.509412$ (tufte), $k$ (ateliers), or $\tfrac{N-L-R}{N}$ (grid).
876
877
878 \chapter{Marginalia}\label{chapter:marginalia}
879
880 \pkg{page-canons} provides margin notes and sidenotes with in-house collision avoidance, font isolation, and position-aware placement. Implementation writes position labels to the \texttt{.aux} file on the first pass and reads them on the second; \textbf{two compilation passes are required} for accurate vertical positioning. On the first pass, notes appear at the call-site baseline without collision adjustment.
881
882 Margin notes always land in the outer margin, following the current margin mode. On two-sided symmetric documents, the outer margin alternates sides.
883
884 \section{Margin notes}\label{sec:marginnotes}
885
886 The functionality of margin notes follows from \cite{marginnote}.
887
888 \subsection{Syntax}\label{subsec:marginnotessyntax}
889
890 \begin{verbatim}
891 \marginnote{text} % auto-positioned, collision-aware
892 \marginnote{text}[2cm] % shifted 2cm below call-site baseline
893 \marginnote{text}[-1cm] % shifted 1cm above call-site baseline
894 \end{verbatim}
895
896 The optional \texttt{voffset} is \emph{additive} to the collision accumulator. A note that would already be pushed down by collision avoidance is pushed further by a positive offset.
897
898 \subsection{Font isolation}\label{subsec:marginnotesfont}
899
900 Margin notes always typeset in upright, medium-weight roman regardless of the call-site font; this is enforced by \cmd{normalfont} prepended before \cmd{marginfont} in the content builder. A margin note inside italic or bold body text does not inherit the variant.
901
902 \subsection{Collision avoidance}\label{subsec:marginnotescollision}
903
904 Adjacent notes on the same page accumulate vertically. If the notes exceed the available margin depth they overflow the page foot; no silent truncation occurs.
905
906 \section{Sidenotes}\label{sec:sidenotes}
907
908 Sidenotes are numbered annotations: a mark appears inline in the body, and the note text appears in the outer margin at the corresponding vertical position. The functionality of side notes follows from \cite{sidenotes}.
909
910 \subsection{Syntax}\label{subsec:sidenotessyntax}
911
912 \begin{verbatim}
913 \sidenote{text} % auto-number, auto-position
914 \sidenote{text}[2cm] % auto-number, shifted 2cm down
915 \sidenote[3]{text} % explicit number 3, auto-position
916 \sidenote[3]{text}[-1cm] % explicit number, shifted up
917
918 \sidenotemark % place mark only (steps counter)
919 \sidenotemark[3] % place mark with explicit number
920 \sidenotetext{text} % place note text (does not step counter)
921 \sidenotetext{text}[1cm] % place note text, shifted down
922 \end{verbatim}
923
924 The optional leading \texttt{[num]} overrides the sidenote counter. The optional trailing \texttt{[voffset]} shifts the note from the call-site baseline; it is additive to collision avoidance, identical in mechanics to \cmd{marginnote}'s offset.
925
926 \subsection{Separated mark and text}\label{subsec:sidenotesmark}
927
928 Use \cmd{sidenotemark} and \cmd{sidenotetext} when the mark and the note body need to appear at different call sites, for instance when the mark must land inside an environment incompatible with \cmd{vadjust} such as \texttt{tabular}.
929
930 \subsection{Mark formatting hooks}\label{subsec:sidenotesmarkhooks}
931
932 Two commands control rendering:
933 \begin{verbatim}
934 \canonssidenotemarkformat{num} % inline mark (default: superscript)
935 \canonssidenotelabelformat{num} % margin label (default: superscript + thin space)
936 \end{verbatim}
937
938 Redefine to change mark style document-wide:
939 \begin{verbatim}
940 \renewcommand*{\canonssidenotemarkformat}[1]{$^{#1}$}
941 \renewcommand*{\canonssidenotelabelformat}[1]{\textbf{#1}\enspace}
942 \end{verbatim}
943
944 \subsection{Numbering modes}\label{subsec:sidenotesnumbering}
945
946 The \texttt{numbering} key controls counter resets. Set at load time via the package option or in the preamble via \cmd{pagecanonsetup}.
947
948 \begin{table}[h]
949 \centering
950 \caption{Numbering options}
951 \label{tab:numopts}
952 \tagpdfsetup{table/header-rows={1}}
953 \begin{tabular}{ll}
954 \textbf{Value} & \textbf{Behavior} \\
955 \hline
956 \texttt{global} (default) & one counter for the entire document \\
957 \texttt{persection} & reset at each \cmd{section} \\
958 \texttt{perchapter} & reset at each \cmd{chapter} (book/report only) \\
959 \texttt{perpage} & reset at each page (requires two passes) \\
960 \end{tabular}
961 \end{table}
962
963 \section{Shared configuration}\label{sec:shared}
964
965 Size, line spread, and justification apply to both margin notes and sidenotes via unified keys; split keys override the unified setting.
966
967 \begin{table}[h]
968 \centering
969 \caption{Shared options}
970 \label{tab:sharedopts}
971 \tagpdfsetup{table/header-rows={1}}
972 \begin{tabular}{ll}
973 \textbf{Unified} & \textbf{Split overrides} \\
974 \hline
975 \texttt{size=} & \texttt{marginnotesize=}, \texttt{sidenotesize=} (with \texttt{marginsize=false}) \\
976 \texttt{justification=} & \texttt{marginnotejustify=}, \texttt{sidenotejustify=} (with \texttt{marginjustify=false}) \\
977 \texttt{notespread=} & (no split) \\
978 \end{tabular}
979 \end{table}
980
981 Changes via \cmd{pagecanonsetup} take effect immediately on the next note call; no page break is triggered because the underlying macros are evaluated at typesetting time.
982
983 \section{Disabling marginalia and deferment}\label{sec:nomarginalia}
984
985 The marginalia engine can be disabled at load time:
986
987 \begin{verbatim}
988 \usepackage[nomarginalia]{page-canons}
989 \end{verbatim}
990
991 With \texttt{nomarginalia}, \pkg{page-canons} does not redefine \cmd{marginnote}, does not install the sidenote commands, and does not integrate with \pkg{sidenotes} if loaded. The canon, margin mode, gutter, and fullwidth machinery are unaffected; only marginalia is suppressed. Use this when another package owns marginal placement and \pkg{page-canons} is wanted purely for its geometry.
992
993 Furthermore, \pkg{page-canons} checks at \cmd{begin{document}} whether \cmd{marginnote} is already defined; if so, it leaves the existing definition intact and emits a \texttt{PackageInfo} log entry. This handles loading another marginalia provider (\pkg{marginnote} \cite{marginnote}, \pkg{marginalia}, similar) alongside \pkg{page-canons} without an explicit \texttt{nomarginalia} flag.
994
995 \pkg{sidenotes} \cite{sidenotes} is detected separately and integrated rather than stepped aside from; the in-house sidenote system defers to it when present.
996
997 Pass \texttt{nomarginalia} explicitly when intent is to silence the \texttt{PackageInfo} entry as well.
998
999 \section{Accessibility and tagging}\label{sec:tagging}
1000
1001 \begin{TodoNote}
1002 Design for accessibility is a work-in-progress. Feedback and constructive criticism is welcome here! I outline the general architecture; whether this is correct or how this can be improved with specific feedback would be much appreciated.
1003 \end{TodoNote}
1004
1005 \pkg{page-canons} wraps margin notes and sidenotes in PDF \texttt{Aside} structure elements when document-level tagging is active. PDF/UA-2 designates \texttt{Aside} as the structure type for content tangential to the main reading flow; margin notes and sidenotes fit this categorization.
1006
1007 \pkg{page-canons} does not enable tagging itself; tagging is enabled via \cmd{DocumentMetadata}. This manual is compiled with
1008
1009 \begin{verbatim}
1010 \DocumentMetadata{
1011 pdfversion=2.0,
1012 pdfstandard={UA-2,a-4f},
1013 tagging=on,
1014 tagging-setup={activate-all},
1015 ...
1016 }
1017 \end{verbatim}
1018
1019 declared before \cmd{documentclass}. At \cmd{begin{document}}, \pkg{page-canons} tests for an active tagging session via \cmd{tag\_if\_active:TF} (with a fallback path for older \pkg{tagpdf} releases that exposed the state as \cmd{g\_\_tag\_active\_bool}). If tagging is active, then marginalia hooks install and emit a confirming \texttt{PackageInfo}; if not, the hooks remain no-ops.
1020
1021 \begin{TodoNote}
1022 Disabling marginalia (or deferring to another marginalia provider) also disables the \texttt{Aside} hooks: the hooks are invoked only from \pkg{page-canons}'s own \cmd{marginnote} implementation. If marginalia comes from another package, that package is responsible for any tagging.
1023 \end{TodoNote}
1024
1025 Margin notes called in horizontal mode (inline within paragraphs) are not nested inside the surrounding paragraph element. Doing so would place tangential content inside the main reading flow, contradicting the semantics of \texttt{Aside}. Instead, the implementation ends the current marked-content sequence, walks the \pkg{tagpdf} structure stack upward for the nearest \texttt{Part} or \texttt{Sect} ancestor, begins an \texttt{Aside} as a child of that ancestor, places the note content, closes the \texttt{Aside}, and resumes the marked-content sequence.
1026
1027 Margin notes called in vertical mode begin an \texttt{Aside} in the local context without parent rerouting; vertical placement is already outside the inline flow.
1028
1029 Geometric placement uses \cmd{vadjust}, \cmd{rlap}/\cmd{llap}, and zero-dimension boxes whose internals are positioning machinery. \pkg{page-canons} suspends tagging during these operations and resumes after, preventing the placement scaffolding from affecting the structure tree.
1030
1031
1032
1033
1034 \chapter{Fullwidth and captions}\label{chapter:fullwidth}
1035
1036 \section{The \texttt{fullwidth} environment}\label{sec:fullwidth}
1037
1038 \begin{verbatim}
1039 \begin{fullwidth}[skip=<dim>, justification=<value>]
1040 <content>
1041 \end{fullwidth}
1042 \end{verbatim}
1043
1044 Extends content into the outer margin by setting a minipage of width $\cmd{linewidth} + \cmd{fullwidthoverhang}$. Does not float, does not break across pages. Inside the environment, \cmd{linewidth} gives the full container width; \cmd{textwidth} is reset to the minipage width.
1045
1046 Options:
1047 \begin{table}[h]
1048 \centering
1049 \caption{Fullwidth options}
1050 \label{tab:fullopts}
1051 \tagpdfsetup{table/header-rows={1}}
1052 \begin{tabular}{lll}
1053 \textbf{Key} & \textbf{Values} & \textbf{Default} \\
1054 \hline
1055 \texttt{skip} & dimension & \texttt{0.5\cmd{baselineskip}} \\
1056 \texttt{justification} & \texttt{centering}, \texttt{raggedright},
1057 \texttt{raggedleft}, \texttt{justified}
1058 & \texttt{centering} \\
1059 \end{tabular}
1060 \end{table}
1061
1062 \section{Captions inside fullwidth}\label{sec:captions}
1063
1064 Inside \texttt{fullwidth}, captions align to the text-block width rather than the full minipage width, on the side matching the current margin mode (symmetric: outer; antisymmetric: opposite; right: flush left; left: indented by overhang). The package installs its own \cmd{@makecaption} when \pkg{caption} is not loaded; if \pkg{caption} is present, its formatting takes precedence.
1065
1066 \begin{TodoNote}
1067 This is a design decision encoded into the source code.
1068 \end{TodoNote}
1069
1070
1071 \chapter{Runtime reconfiguration}\label{chapter:reconfiguration}
1072
1073 \cmd{pagecanonsetup}\texttt{\{key=value, \ldots\}} reconfigures the layout at any point. Mid-document calls that change layout keys invoke \cmd{newgeometry} internally and therefore trigger a page break. Margin-related keys (\texttt{size=}, \texttt{notespread=}, etc.) take effect immediately without a page break.
1074
1075 \section{Two-pass key processing}\label{sec:twopass}
1076
1077 The first pass scans for \texttt{canon=} and resets all canon-specific parameters (\texttt{vdhN}, \texttt{ateliersstyle}, \texttt{gridN}, \texttt{gridinner}, \texttt{gridouter}, \texttt{gridtop}, \texttt{gridbottom}) to compiled defaults if the canon value is changing. The second pass processes all keys left-to-right. Key order is therefore irrelevant when switching canons.
1078
1079 \section{Reset semantics}\label{sec:reset}
1080
1081 \begin{enumerate}
1082 \item Canon changes reset canon-specific parameters. Supply overrides in the same call.
1083 \item Same-canon calls do not reset. Existing parameters persist, enabling incremental adjustment.
1084 \item Omitting \texttt{canon=} never resets anything.
1085 \end{enumerate}
1086
1087 \section{Preamble safety}\label{sec:preamblesafety}
1088
1089 \cmd{pagecanonsetup} is safe in the preamble. Layout keys are stored and applied at \cmd{begin}\texttt{\{document\}}. Margin-related keys are also applied at load time, so their defaults are in effect before \cmd{begin}\texttt{\{document\}}.
1090
1091
1092 \part{Reference and validation}\label{part:reference}
1093
1094
1095 \chapter{Test suite}\label{chapter:testsuite}
1096
1097 Tests live here rather than in the feature chapters. Each test is a minimal check: the preamble gives the configuration, the body exercises the feature, and expected output is stated briefly. Visual tests rely on the page's \texttt{showframe} rules; numerical tests print computed dimensions.
1098
1099 \section{Basic dimensions}\label{sec:dimensions}
1100
1101 \test{Exported dimensions (VdG, letterpaper)}
1102
1103 \showlen{\string\textwidth}{\textwidth}
1104 \showlen{\string\marginparwidth}{\marginparwidth}
1105 \showlen{\string\marginparsep}{\marginparsep}
1106 \showlen{\string\marginandtext}{\marginandtext}
1107 \showlen{\string\marginandsep}{\marginandsep}
1108 \showlen{\string\textandsep}{\textandsep}
1109 \showlen{\string\fullwidthoverhang}{\fullwidthoverhang}
1110 \showlen{\string\overflowingheadlen}{\overflowingheadlen}
1111
1112 \test{VdG text block proportion}
1113
1114 Expected: $\cmd{textwidth} \approx 2/3 \times 8.5\,\text{in} \approx 408$\,pt.
1115
1116 Computed: \the\textwidth.
1117
1118 \section{Canon switching}\label{sec:switching}
1119
1120 \test{VdH N=9}
1121
1122 \pagecanonsetup{canon=vdh, vdhN=9}
1123
1124 \showlen{\string\textwidth}{\textwidth}
1125 \showlen{\string\marginparwidth}{\marginparwidth}
1126
1127 Frames should show narrower margins than the preceding VdG pages.
1128 \lipsum[1]
1129
1130 \test{Tufte}
1131
1132 \pagecanonsetup{canon=tufte}
1133
1134 \showlen{\string\textwidth}{\textwidth}
1135 \showlen{\string\marginparwidth}{\marginparwidth}
1136
1137 \lipsum[2]
1138
1139 \test{Ateliers luxury}
1140
1141 \pagecanonsetup{canon=ateliers, ateliersstyle=luxury}
1142
1143 \showlen{\string\textwidth}{\textwidth}
1144 \showlen{\string\marginparwidth}{\marginparwidth}
1145
1146 \lipsum[3]
1147
1148 \test{Grid 9$\times$9 with custom cells}
1149
1150 \pagecanonsetup{canon=grid, gridN=9, gridinner=1, gridouter=3, gridtop=1, gridbottom=2}
1151
1152 \showlen{\string\textwidth}{\textwidth}
1153 \showlen{\string\marginparwidth}{\marginparwidth}
1154
1155 \lipsum[4]
1156
1157 \test{\texttt{canon=false}}
1158
1159 \pagecanonsetup{canon=false}
1160
1161 \showlen{\string\textwidth}{\textwidth}
1162
1163 Expected: geometry default ($\approx 345$\,pt on letterpaper).
1164
1165 % restore for subsequent tests
1166 \pagecanonsetup{canon=vdg}
1167
1168 \section{Margin notes}\label{sec:marginnotestest}
1169
1170 \test{Single note}
1171
1172 \noindent This sentence contains a margin note.\marginnote{Single note. Should appear in the outer margin at the call-site baseline. Width: \the\marginparwidth.} The note should appear in the outer margin without disturbing the flow of body text.
1173
1174 \lipsum[66]
1175
1176 \test{Three adjacent notes (collision)}
1177
1178 \noindent Three notes are placed in quick succession.
1179 \marginnote{First note.}
1180 \marginnote{Second note: pushed below first by collision avoidance.}
1181 \marginnote{Third note: pushed below second.} All three should appear without overlapping. If the notes exceed the available margin depth they overflow the page foot.
1182
1183 \lipsum[1]
1184
1185 \test{Positive offset}
1186
1187 \noindent Call site for a note pushed 2\,cm down.\marginnote{Shifted 2\,cm below baseline.}[2cm]
1188
1189 \test{Negative offset}
1190
1191 \noindent Call site for a note pulled 1\,cm up.\marginnote{Shifted 1\,cm above baseline.}[-1cm]
1192
1193 \test{Zero explicit offset}
1194
1195 \noindent Call site for a note with explicit zero offset.\marginnote{Zero offset: same as auto.}[0pt] Behaviorally identical to the auto path.
1196
1197 \lipsum[2]
1198
1199 \test{Font isolation inside italic}
1200
1201 \noindent This sentence is \textit{entirely italic and contains a margin note\marginnote{Upright despite italic context.} mid-run}, and the italic continues after.
1202
1203 \test{Font isolation inside bold}
1204
1205 \noindent \textbf{Bold sentence with a margin note\marginnote{Normal weight despite bold context.} inside.}
1206
1207 \lipsum[3]
1208
1209 \test{Small-font notes}
1210
1211 \pagecanonsetup{size=small}
1212
1213 \marginnote{Small-font note.}
1214 \noindent Margin note text is now typeset in \texttt{small}.
1215 \lipsum[67]
1216
1217 \test{Wider line spread}
1218
1219 \pagecanonsetup{notespread=1.2}
1220
1221 \marginnote{Wider spread: 1.2. Lines in this note are more widely spaced.}
1222 \noindent Line spacing increased to 1.2.
1223 \lipsum[68]
1224
1225 \pagecanonsetup{size=footnotesize, notespread=1.05}
1226
1227 \test{Ragged-left notes}
1228
1229 \pagecanonsetup{justification=raggedleft}
1230
1231 \marginnote{Ragged left note. Text is flush right inside the margin column.}
1232 \noindent Note justification changed to \texttt{raggedleft}.
1233 \lipsum[69]
1234
1235 \pagecanonsetup{justification=default}
1236
1237 \section{Sidenotes}\label{sec:sidenotestest}
1238
1239 \test{Auto-numbered sidenote}
1240
1241 The sidenote command attaches a mark in the text\sidenote{First sidenote. Auto-numbered from the global counter. Should appear in the outer margin.} and places the numbered annotation in the margin.
1242
1243 \lipsum[1]
1244
1245 \test{Sidenote with positive offset}
1246
1247 Sidenote pushed 2\,cm down from baseline.\sidenote{Shifted 2cm below baseline.}[2cm]
1248
1249 \test{Sidenote with negative offset}
1250
1251 Sidenote pulled 1\,cm up.\sidenote{Shifted 1cm above baseline.}[-1cm]
1252
1253 \lipsum[2]
1254
1255 \test{Separated mark and text}
1256
1257 \noindent\sidenotemark\ The mark was placed here by
1258 \texttt{\string\sidenotemark}.%
1259 \sidenotetext{This note text was placed by \texttt{\string\sidenotetext} immediately after the mark, with a 1\,cm push.}[1cm]
1260
1261 \lipsum[3]
1262
1263 \test{Independent margin-note and sidenote sizes}
1264
1265 \pagecanonsetup{marginsize=false, marginnotesize=small, sidenotesize=footnotesize}
1266
1267 \marginnote{Small margin note.} Text with a sidenote\sidenote{Footnotesize sidenote.} next to a margin note. The margin note uses \texttt{small}; the sidenote uses \texttt{footnotesize}.
1268
1269 \lipsum[67]
1270
1271 \pagecanonsetup{marginsize=true, size=footnotesize}
1272
1273 \section{Margin modes}
1274
1275 \test{Symmetric fullwidth on odd page}
1276
1277 \begin{fullwidth}
1278 \testbox{Symmetric, odd page: fullwidth extends into the right (outer) margin.}
1279 \end{fullwidth}
1280
1281 \test{Symmetric fullwidth on forced even page}
1282
1283 \cleardoublepage\mbox{}\clearpage
1284 \begin{fullwidth}
1285 \testbox{Symmetric, even page: fullwidth extends leftward into the outer margin.}
1286 \end{fullwidth}
1287
1288 \clearpage
1289
1290 \test{Antisymmetric margin note and fullwidth}
1291
1292 \pagecanonsetup{canon=vdg, margins=antisymmetric}
1293
1294 \marginnote{Antisymmetric: note is in the inner (spine-side) margin.}
1295 \noindent Margin note should appear on the inner margin.
1296
1297 \begin{fullwidth}
1298 \testbox{Antisymmetric: fullwidth extends into the inner margin.}
1299 \end{fullwidth}
1300
1301 \lipsum[5]
1302
1303 \test{Right-margin fullwidth}
1304
1305 \pagecanonsetup{canon=vdg, margins=right}
1306
1307 \begin{fullwidth}
1308 \testbox{Right-margin mode: fullwidth always extends rightward.}
1309 \end{fullwidth}
1310
1311 \test{Left-margin fullwidth}
1312
1313 \pagecanonsetup{canon=vdg, margins=left}
1314
1315 \begin{fullwidth}
1316 \testbox{Left-margin mode: fullwidth always extends leftward.}
1317 \end{fullwidth}
1318
1319 \pagecanonsetup{canon=vdg, margins=symmetric}
1320
1321 \section{Gutters}\label{sec:gutterstest}
1322
1323 \test{Gutter in \texttt{geometry} mode}
1324
1325 \pagecanonsetup{canon=vdg, gutterval=12mm, guttermode=geometry}
1326
1327 \showlen{\string\textwidth}{\textwidth}
1328
1329 Text width unchanged from zero-gutter VdG; inner margin is 12\,mm wider.
1330
1331 \test{Gutter in \texttt{satzspiegel} mode}
1332
1333 \pagecanonsetup{canon=vdg, gutterval=12mm, guttermode=satzspiegel}
1334
1335 \showlen{\string\textwidth}{\textwidth}
1336
1337 Text width narrower: canon computed on reduced leaf width $W - 12$\,mm.
1338
1339 \pagecanonsetup{canon=vdg, gutterval=0mm}
1340
1341 \section{Fullwidth environment}
1342
1343 \test{Default fullwidth}\label{sec:fullwidthtest}
1344
1345 \begin{fullwidth}
1346 \testbox{Default: 0.5\string\baselineskip\ skip, centered. Width = \the\linewidth.}
1347 \end{fullwidth}
1348
1349 \test{Custom skip and justification}
1350
1351 \begin{fullwidth}[skip=2\baselineskip, justification=raggedright]
1352 \testbox{2\string\baselineskip\ skip above. Ragged right.}
1353 \end{fullwidth}
1354
1355 \test{Justified}
1356
1357 \begin{fullwidth}[justification=justified]
1358 \testbox{\lipsum[6]}
1359 \end{fullwidth}
1360
1361 \test{Zero skip}
1362
1363 \begin{fullwidth}[skip=0pt]
1364 \testbox{Zero skip.}
1365 \end{fullwidth}
1366
1367 \test{Figure with caption in fullwidth}
1368
1369 \begin{fullwidth}
1370 \begingroup
1371 \centering
1372 \rule{\linewidth}{3cm}
1373 \par\smallskip
1374 \makeatletter
1375 \FW@makecaption{Figure}{Caption confined to text column width. On odd pages it is flush left; on even pages it is indented by the overhang distance.}
1376 \makeatother
1377 \endgroup
1378 \end{fullwidth}
1379
1380 \section{Runtime reconfiguration}\label{sec:runtumeconfig}
1381
1382 \test{Chained reconfiguration}
1383
1384 \showlen{\string\textwidth}{\textwidth}
1385
1386 \pagecanonsetup{canon=tufte, margins=right}
1387
1388 After Tufte + right:
1389 \showlen{\string\textwidth}{\textwidth}
1390 \showlen{\string\marginparwidth}{\marginparwidth}
1391
1392 \begin{fullwidth}
1393 \testbox{Tufte + right: fullwidth extends rightward on every page.}
1394 \end{fullwidth}
1395
1396 \pagecanonsetup{canon=ateliers, ateliersstyle=neater, margins=symmetric}
1397
1398 After Ateliers neater + symmetric:
1399 \showlen{\string\textwidth}{\textwidth}
1400
1401 \begin{fullwidth}
1402 \testbox{Ateliers neater + symmetric. Narrower overhang than Tufte.}
1403 \end{fullwidth}
1404
1405 \pagecanonsetup{canon=vdg, margins=symmetric}
1406
1407 \test{Canon switch resets stale parameters}
1408
1409 \pagecanonsetup{canon=grid, gridN=9, gridouter=3}
1410
1411 Grid 9$\times$9, outer=3: \showlen{\string\textwidth}{\textwidth}
1412
1413 \pagecanonsetup{canon=vdg}
1414
1415 VdG (grid params discarded): \showlen{\string\textwidth}{\textwidth}
1416
1417 \pagecanonsetup{canon=grid}
1418
1419 Grid defaults (should be 6$\times$6, outer=2): \showlen{\string\textwidth}{\textwidth}
1420
1421 The last width must match the 6$\times$6 default, not the prior 9$\times$9 outer=3 value.
1422
1423 \test{Key order independence}
1424
1425 \pagecanonsetup{gridN=12, canon=grid, gridouter=3}
1426
1427 Order \texttt{gridN, canon, gridouter}: \showlen{\string\textwidth}{\textwidth}
1428
1429 \pagecanonsetup{canon=vdg}
1430 \pagecanonsetup{canon=grid, gridouter=3, gridN=12}
1431
1432 Order \texttt{canon, gridouter, gridN}: \showlen{\string\textwidth}{\textwidth}
1433
1434 Both widths must be identical.
1435
1436 \test{Same-canon persistence}
1437
1438 \pagecanonsetup{canon=grid, gridN=9, gridouter=3}
1439
1440 Grid 9$\times$9, outer=3: \showlen{\string\textwidth}{\textwidth}
1441
1442 \pagecanonsetup{canon=grid}
1443
1444 Same canon, no reset: \showlen{\string\textwidth}{\textwidth}
1445
1446 Both widths must be identical.
1447
1448 \test{Recovery from \texttt{canon=false}}
1449
1450 \pagecanonsetup{canon=false}
1451
1452 \showlen{\string\textwidth}{\textwidth}
1453
1454 \pagecanonsetup{canon=tufte, margins=symmetric}
1455
1456 \showlen{\string\textwidth}{\textwidth}
1457
1458 Should match earlier Tufte values; \texttt{canon=false} must not corrupt state.
1459
1460 \pagecanonsetup{canon=vdg, margins=symmetric}
1461
1462
1463 \chapter{Edge cases and invariants}\label{chapter:edge}
1464
1465 \section{Margin guard}\label{sec:guard}
1466
1467 For non-grid canons, $\texttt{marginparwidth} + 2\,\texttt{marginparsep} \leq \texttt{outermargin}$ is enforced. If violated, \texttt{marginparwidth} is shrunk with a warning.
1468
1469 \test{Margin guard invariant}
1470
1471 $\texttt{marginparwidth} + 2\,\texttt{marginparsep} = \the\dimexpr\marginparwidth+2\marginparsep\relax$.
1472
1473 Must not exceed the outer margin width visible in the \texttt{showframe} rules.
1474
1475 \section{Grid $N=3$ failsafe}\label{sec:N3}
1476
1477 When \texttt{gridN=3} with default cell counts (inner=1, outer=2, top=1, bottom=2), the text area would be zero. The package adjusts to 1:1 allocation.
1478
1479 \test{Grid $N=3$ failsafe}
1480
1481 \pagecanonsetup{canon=grid, gridN=3, gridinner=1, gridouter=2, gridtop=1, gridbottom=2}
1482
1483 \showlen{\string\textwidth}{\textwidth}
1484
1485 Expected: $\approx 1/3$ of paper width (one cell of three).
1486
1487 \pagecanonsetup{canon=vdg, margins=symmetric}
1488
1489 \section{Font isolation}\label{sec:isolation}
1490
1491 \cmd{normalfont} is prepended before \cmd{marginfont} at every content-building site. Notes cannot inherit italic, bold, or any other font variant from the call site. See the margin-notes test section.
1492
1493 \section{Twocolumn}\label{sec:twocolumn}
1494
1495 Loading \pkg{page-canons} in twocolumn mode emits a package warning; marginalia placement is not guaranteed. Not tested here.
1496
1497 \section{Unknown canon}\label{sec:unknown}
1498
1499 Passing an unrecognized \texttt{canon} value triggers a warning and falls back to \texttt{vdg}.
1500
1501
1502 \chapter{Quick reference}\label{chapter:quickreference}
1503
1504 \section{Package options}\label{sec:options}
1505
1506
1507 \begin{table}[h]
1508 \caption{Canon selection options}
1509 \label{tab:cononselection}
1510 \tagpdfsetup{table/header-rows={1}}
1511 \centering
1512 \begin{tabular}{lll}
1513 \textbf{Key} & \textbf{Values} & \textbf{Default} \\
1514 \hline
1515 \texttt{canon} & \texttt{vdg}, \texttt{vdh}, \texttt{tufte},
1516 \texttt{ateliers}, \texttt{grid}, \texttt{false}
1517 & \texttt{vdg} \\
1518 \texttt{vdhN} & 3, 6, 9, 12, 15 & 6 \\
1519 \texttt{ateliersstyle} & \texttt{ordinary}, \texttt{neater}, \texttt{luxury}
1520 & \texttt{ordinary} \\
1521 \texttt{gridN} & integer $\geq 3$ & 6 \\
1522 \texttt{gridinner} & integer & 1 \\
1523 \texttt{gridouter} & integer & 2 \\
1524 \texttt{gridtop} & integer & 1 \\
1525 \texttt{gridbottom} & integer & 2 \\
1526 \end{tabular}
1527 \end{table}
1528
1529
1530
1531
1532
1533 \begin{table}[h]
1534 \caption{Layout selection options}
1535 \label{tab:layoutselection}
1536 \tagpdfsetup{table/header-rows={1}}
1537 \centering
1538 \begin{tabular}{lll}
1539 \textbf{Key} & \textbf{Values} & \textbf{Default} \\
1540 \hline
1541 \texttt{margins} & \texttt{symmetric}, \texttt{antisymmetric},
1542 \texttt{right}, \texttt{left} & class-dep. \\
1543 \texttt{gutterval} & dimension & \texttt{0mm} \\
1544 \texttt{guttermode} & \texttt{geometry}, \texttt{satzspiegel}
1545 & \texttt{geometry} \\
1546 \texttt{showframe} & bare boolean & off \\
1547 \texttt{landscape} & bare boolean & off \\
1548 \texttt{debug} & bare boolean & off \\
1549 \end{tabular}
1550 \end{table}
1551
1552
1553
1554
1555 \begin{table}[h]
1556 \caption{Marginalia options; unified}
1557 \label{tab:marginaliaunifiedselection}
1558 \tagpdfsetup{table/header-rows={1}}
1559 \centering
1560 \begin{tabular}{lll}
1561 \textbf{Key} & \textbf{Values} & \textbf{Default} \\
1562 \hline
1563 \texttt{size} & font size name & \texttt{footnotesize} \\
1564 \texttt{justification} & \texttt{default}, \texttt{raggedright},
1565 \texttt{raggedleft}, \texttt{centered}, \texttt{justified}
1566 & \texttt{default} \\
1567 \texttt{notespread} & factor & \texttt{1.05} \\
1568 \texttt{numbering} & \texttt{global}, \texttt{persection},
1569 \texttt{perchapter}, \texttt{perpage}
1570 & \texttt{global} \\
1571 \texttt{nomarginalia} & bare boolean & off \\
1572 \end{tabular}
1573 \end{table}
1574
1575
1576 \begin{table}[h]
1577 \caption{Marginalia options; split (override unified)}
1578 \label{tab:marginaliasplitselection}
1579 \tagpdfsetup{table/header-rows={1}}
1580 \centering
1581 \begin{tabular}{lll}
1582 \textbf{Key} & \textbf{Values} & \textbf{Default} \\
1583 \hline
1584 \texttt{marginsize} & \texttt{true}/\texttt{false} & \texttt{true} \\
1585 \texttt{marginnotesize} & font size name & follows \texttt{size} \\
1586 \texttt{sidenotesize} & font size name & follows \texttt{size} \\
1587 \texttt{marginjustify} & \texttt{true}/\texttt{false} & \texttt{true} \\
1588 \texttt{marginnotejustify} & justification value & follows \texttt{justification} \\
1589 \texttt{sidenotejustify} & justification value & follows \texttt{justification} \\
1590 \end{tabular}
1591 \end{table}
1592
1593 \section{Fullwidth options}\label{sec:fulloptions}
1594
1595 \begin{table}
1596 \centering
1597 \caption{Options for fullwidth}
1598 \label{tab:fullwidthoptions}
1599 \tagpdfsetup{table/header-rows={1}}
1600 \begin{tabular}{lll}
1601 \textbf{Key} & \textbf{Values} & \textbf{Default} \\
1602 \hline
1603 \texttt{skip} & dimension & \texttt{0.5\string\baselineskip} \\
1604 \texttt{justification} & \texttt{centering}, \texttt{raggedright},
1605 \texttt{raggedleft}, \texttt{justified}
1606 & \texttt{centering} \\
1607 \end{tabular}
1608 \end{table}
1609
1610 \section{Commands}\label{sec:commands}
1611
1612 \begin{table}
1613 \centering
1614 \caption{Options for commands}
1615 \label{tab:commandsoptions}
1616 \tagpdfsetup{table/header-rows={1}}
1617 \begin{tabular}{ll}
1618 \textbf{Command} & \textbf{Action} \\
1619 \hline
1620 \cmd{pagecanonsetup}\texttt{\{\ldots\}} & reconfigure; layout keys trigger page break \\
1621 \cmd{pagecanonmargins} & expands to current margin mode \\[3pt]
1622 \cmd{marginnote}\texttt{\{text\}} & margin note at call-site baseline \\
1623 \cmd{marginnote}\texttt{\{text\}[dim]} & margin note with explicit voffset \\[3pt]
1624 \cmd{sidenote}\texttt{\{text\}} & numbered sidenote, auto-position \\
1625 \cmd{sidenote}\texttt{\{text\}[dim]} & numbered sidenote with voffset \\
1626 \cmd{sidenote}\texttt{[n]\{text\}} & sidenote with explicit number \\
1627 \cmd{sidenote}\texttt{[n]\{text\}[dim]} & explicit number and voffset \\
1628 \cmd{sidenotetext}\texttt{\{text\}} & note text only (no mark, no step) \\
1629 \cmd{sidenotetext}\texttt{\{text\}[dim]} & note text with voffset \\
1630 \cmd{sidenotemark} & inline mark only (steps counter) \\
1631 \cmd{sidenotemark}\texttt{[n]} & inline mark with explicit number \\[3pt]
1632 \cmd{canonssidenotemarkformat}\texttt{\{n\}} & format hook: inline mark \\
1633 \cmd{canonssidenotelabelformat}\texttt{\{n\}} & format hook: margin label \\[3pt]
1634 \cmd{canonsswitchmargin} & toggle current marginpar side \\
1635 \cmd{canonsresetmargin} & restore marginpar side to mode default \\
1636 \end{tabular}
1637 \end{table}
1638
1639 \section{Exported lengths}\label{sec:lengths}
1640
1641 \begin{table}
1642 \centering
1643 \caption{Exported lengths}
1644 \label{tab:exportlengths}
1645 \tagpdfsetup{table/header-rows={1}}
1646 \begin{tabular}{ll}
1647 \textbf{Length} & \textbf{Value} \\
1648 \hline
1649 \cmd{marginandtext} & $\cmd{textwidth} + \cmd{marginparwidth} + \cmd{marginparsep}$ \\
1650 \cmd{marginandsep} & $\cmd{marginparwidth} + \cmd{marginparsep}$ \\
1651 \cmd{textandsep} & $\cmd{textwidth} + \cmd{marginparsep}$ \\
1652 \cmd{fullwidthoverhang} & $\cmd{marginparwidth} + \cmd{marginparsep}$ \\
1653 \cmd{overflowingheadlen} & same as \cmd{marginandtext} \\
1654 \end{tabular}
1655 \end{table}
1656
1657 \printbibliography
1658
1659
1660 \appendix
1661 \chapter{Formulary}\label{chapter:formulary}
1662
1663
1664 \section*{Frames, symbols, order}\label{sec:formulary1}
1665 \[
1666 W = \cmd{paperwidth},\quad H = \cmd{paperheight},\quad
1667 W_\ast = \begin{cases}
1668 W & \text{(default)}\\
1669 W-g & \text{if \texttt{guttermode=satzspiegel}}
1670 \end{cases}
1671 \]
1672 Order: (1) paper $\to$ (2) canon $\to$ (3) gutter mode $\to$ (4) margin mode $\to$ (5) export lengths.
1673
1674 \section*{Canon summaries}\label{sec:formulary2}
1675
1676 \paragraph{Van de Graaf (vdg).}
1677 $m_i = W_\ast/9$, $m_o = 2W_\ast/9$, $m_t = H/9$, $m_b = 2H/9$. $\cmd{textwidth} = \tfrac{2}{3}W_\ast$, $\cmd{textheight} = \tfrac{2}{3}H$. Not centered; outer/bottom $>$ inner/top.
1678
1679 \paragraph{Villard de Honnecourt (vdh, $N\in\{3,6,9,12,15\}$).}
1680 With $u = W_\ast/(N+3)$: $m_i = u$, $m_o = 2u$, $m_t = 1.5u$, $m_b = 3u$. $\cmd{textwidth} = \tfrac{N}{N+3}W_\ast$, $\cmd{textheight} = H - 4.5u$. Verticals depend on $W_\ast$, so block aspect varies with $H/W$.
1681
1682 \paragraph{Tufte (tufte).}
1683 $m_i \approx 2W/17$, $m_o \approx 3W/8$ (code $0.372941W$), $m_t = H/11$, $m_b = 3H/22$. $\cmd{textwidth} \approx 0.509412\,W$. Notes: $\texttt{marginparwidth} \approx 4W/17$, $\texttt{marginparsep} \approx W/26$.
1684
1685 \paragraph{Canon des Ateliers (ateliers).}
1686 With $k \in \{\tfrac{3}{4}, \tfrac{2}{3}, \tfrac{5}{8}\}$ (ordinary/neater/luxury) and $w = (1-k)W$: $m_i = 0.4w$, $m_o = 0.6w$, $m_t = 0.5w$, $m_b = 0.7w$.
1687
1688 Explicitly:
1689 \[
1690 \begin{array}{l@{\ }l}
1691 \mathrm{ordinary:} & (m_i,m_o,m_t,m_b) = (\tfrac{1}{10},\tfrac{3}{20},\tfrac{1}{8},\tfrac{7}{40})W \\
1692 \mathrm{neater:} & (\tfrac{2}{15},\tfrac{1}{5},\tfrac{1}{6},\tfrac{7}{30})W \\
1693 \mathrm{luxury:} & (\tfrac{3}{20},\tfrac{9}{40},\tfrac{3}{16},\tfrac{21}{80})W
1694 \end{array}
1695 \]
1696 $\cmd{textwidth} = kW$. Aspect varies with $H/W$.
1697
1698 \paragraph{Grid (grid).}
1699 Pick $N \geq 3$. Cell size $c_w = W_\ast/N$, $c_h = H/N$. Choose integers $L,R,T,B \geq 0$ with $L+R < N$ and $T+B < N$: $m_i = Lc_w$, $m_o = Rc_w$, $m_t = Tc_h$, $m_b = Bc_h$. $\cmd{textwidth} = (N{-}L{-}R)c_w$, $\cmd{textheight} = (N{-}T{-}B)c_h$.
1700
1701 Area fraction (relative to $W_\ast \times H$):
1702 \[
1703 \frac{\cmd{textwidth}}{W_\ast}\cdot\frac{\cmd{textheight}}{H}
1704 = \Bigl(1-\tfrac{L+R}{N}\Bigr)\Bigl(1-\tfrac{T+B}{N}\Bigr).
1705 \]
1706 VdG exactly if $N$ multiple of $9$ and $(L,R,T,B) = (N/9, 2N/9, N/9, 2N/9)$. Honnecourt is generally approximated; Ateliers, rounded.
1707
1708 \paragraph{Footers (all canons).} $\texttt{footskip} = \tfrac{1}{2}m_b$.
1709
1710 \section*{Gutter modes}\label{sec:formulary3}
1711
1712 \begin{widedesc}[7em]
1713 \item[\texttt{geometry}] $\mathrm{inner}_\mathrm{final} = m_i + g$, $\mathrm{outer}_\mathrm{final} = m_o - g$. Preserves \cmd{textwidth}; may clamp outer to 0 if $g$ is large.
1714 \item[\texttt{satzspiegel}] Compute canon on $W_\ast = W - g$, then add $+g$ to inner. Preserves proportions; $\Delta\cmd{textwidth} = -\alpha\,g$ with $\alpha = \tfrac{2}{3}$ (vdg), $\tfrac{N}{N+3}$ (vdh), $\approx 0.509412$ (tufte), $k$ (ateliers), $\tfrac{N-L-R}{N}$ (grid).
1715 \end{widedesc}
1716
1717
1718 \end{document}