OptionalfontsOptionalmathWhere mathematics is set, for $…$ and the display environments.
Injected for exactly the reasons fonts is, plus one of its own:
createMathRenderer() is async (MathJax's init() loads components and
warms its font ranges) and compile() is synchronous by design, so
construction has to happen outside — once, by the caller — and the built
renderer handed in.
import { compile, createMathRenderer } from "@ebook-reader/typeset";
const math = await createMathRenderer(); // once, at startup
compile(files, "main.tex", { fonts, math });
Omitting it is free for a document with no mathematics — nothing is built and nothing is loaded. A document that does contain mathematics and gets no renderer produces a diagnostic and no PDF, deliberately: silently dropping every formula out of a published document is the failure this whole engine's contract exists to rule out (D38), and it is the failure this option's absence used to cause.
OptionalmaxCap on the emitted PDF, so a runaway document cannot fill a disk.
OptionalmaxCap on page count — the other way a runaway loop shows up.
OptionalsignalCooperative cancellation, polled at step boundaries. The outer wall-clock backstop lives in the caller's job runner, not in here.
OptionalstepMaximum number of engine steps — one macro expansion, one node visited,
one line-break candidate weighed. A deterministic budget rather than a
wall clock, because a budget gives the same answer on every machine and a
timer does not (D38). Runaway \newcommand recursion dies here.
Where faces come from. Injected because the engine performs no I/O: in Node the caller passes the committed Latin Modern set, in a browser whatever it fetched.
Effectively required. There is no built-in fallback and there cannot be one — a fallback would mean reading a file, which is the thing this engine does not do. Omit it and the compile stops with a
missing-fonterror and an empty result, deliberately: silently setting a document in some other face would be wrong output presented as success. It stays optional in the type only soCompileOptionshas one uniform shape.