A LuaLaTeX document class for typesetting graded readers in the nature-method tradition: a continuous text with an apparatus of glosses, notes, figures and tables in a wide outer margin, each gloss set on the same baseline as the line it explains.
The class implements its own margin layout engine in Lua. Margin items are anchored to lines, collision-pushed apart when they crowd, carried across pages when a column fills, and routed around full-width material and display pages — all with exact baseline alignment, converging over reruns the way LaTeX cross-references do.
- Marginal glosses (
\gloss,\glossblock), free-form margin blocks, margin figures and tables, lettered margin notes - Three distinct note apparatuses: margin notes (superscript letters,
per chapter), footnotes (symbols, per page), endnotes (arabic,
continuous — via the
endnotespackage) - Line numbering in the inner margin, by increment, with pause/resume
- Book structure: parts (with
\parttextargumentum pages), chapters, sections; spaced-small-caps headings and running headers with the folio hanging into the outer margin - Full-width and text-width display material; the column rule breaks around full-width blocks and margin content avoids them
- Eight paper presets from pocket (4.5 × 6.5 in) to letter, plus any
custom size;
fontsize=andlinespacing=(up to triple) so students can annotate between the lines - Configurable rules (solid, dashed, coloured, or none), PDF page labels matching the printed folios, drafting stamps
LuaLaTeX only (the margin engine is written against LuaTeX callbacks). A reasonably current TeX Live with KOMA-Script, fontspec, microtype, geometry, hyperref and the EB Garamond fonts covers everything.
Copy marginalreader.cls, marginalreader-margin.lua and
marginalreader-linenums.lua into your project directory, or install
them in your TEXMF tree with
make install
(equivalently, copy the three files into
$(kpsewhich -var-value TEXMFHOME)/tex/lualatex/marginalreader/).
\documentclass[paper=b5, fonts=ebgaramond, linenumbers=true]{marginalreader}
\begin{document}
\chapter{Uxor Tyrannicida}
Quae habebat duos filios et \gloss{tyrannum}{tyrant, usurper (acc.)}
virum, tyrannicidium fecit.\marginnote{The case is Calpurnius
Flaccus, Declamation 1.}
\end{document}Compile with lualatex, twice (or until the class stops asking for a
rerun): margin layout is a two-pass mechanism, like \ref/\label,
carried in .mrpos/.mrblocked side files.
With GNU make (or any POSIX make) and TeX Live installed:
make # user manual + all three example books
make doc # doc/marginalreader.pdf
make examples # examples/example-reader{,-letter,-pocket}.pdf
make test # compile the twelve test documents, fail on errors
make clean # remove auxiliary and side files
The Makefile recompiles each book until the class stops asking for a rerun (typically two to four passes). Without make, the equivalent by hand is:
TEXINPUTS=.:examples/: lualatex --output-directory=examples examples/example-reader.tex
# ... repeated until the "Margin positions have changed" warning stops
lualatex doc/marginalreader.tex # run from doc/, twice
The user manual is doc/marginalreader.tex (build: make doc). A
complete worked example — a full graded reader of Caesar and Nepos
with front matter, parts, apparatus and images — is in examples/:
example-reader.tex (B5, with a fully commented template of every
class option) and the same book at letter
(example-reader-letter.tex) and pocket 4.5 × 6.5 in
(example-reader-pocket.tex) via a shared example-body.tex.
Copyright © 2026 Dino Sepúlveda. Distributed under the LaTeX Project
Public License, version 1.3c or later (see LICENSE). The work is
author-maintained.
The Latin texts in tests/ are from Calpurnius Flaccus,
Declamationum excerpta (2nd c., public domain); the example uses
Caesar, De Bello Gallico I and Cornelius Nepos, Themistocles
(public domain), with image credits given in the example's imprint.