Turn a LaTeX project into a PDF.
files is the whole project as an in-memory map — keys are project-relative
paths (main.tex, chapters/one.tex), values are the raw bytes.
entrypoint names the file to start from and must be a key of files.
Two guarantees, both load-bearing, both relied on by callers:
It never throws. Every failure — malformed source, an unimplemented
command, an exhausted budget, an outright bug in the engine — comes back
as a Diagnostic in the result. A caller may write const r = compile(…)
with no try. Bugs are caught at this boundary and reported with code
internal; that is the only thing the catch below is for.
It performs no I/O of its own, and nothing the document says can cause
any. No file, no socket, no child process, no eval is opened by code
under src/: every byte the engine reads arrives as an argument to this
function, and tsconfig.json withholds the Node types so fs, process
and Buffer cannot even be named there — the guarantee is enforced by
the compiler rather than by review. This is the engine's entire security
design (D38) rather than a style preference: \write18 cannot execute
because no shell escape exists, and \input{/etc/passwd} cannot read
anything because there is nothing to read from — \input resolves
against files or it is a diagnostic. No path, name or byte a document
controls reaches a host API, so path traversal and sandbox escape stop
being engine concerns.
Stated precisely, because the weaker claim is the true one: this is a
guarantee about first-party code and about reachability from the
document, not a claim that node:fs is absent from the module graph.
It is not — fontkit, the third-party font parser, imports it. See the
known limitation in font/fontkit-handle.ts, which also explains why no
input can reach it.
Unsupported LaTeX is never silently skipped: it produces a diagnostic naming the construct, with a file and a line (the loud-failure contract, D38).
@ebook-reader/typeset— Atrium's own typesetting engine (D38).It reads a subset of LaTeX and writes a PDF. It is not a TeX reimplementation and never will be: the scope line is syntax, not semantics, and anything outside the subset produces a diagnostic rather than a guess.
The package is a pure library — no filesystem, no network, no processes — so it runs unchanged in Node and in a browser.
compile()is the supported entry point, and the only one a normal caller needs. Everything below it is exported too — the box/glue vocabulary, the parser, the document model, the line breaker, the PDF writer — so a caller can drive one stage alone (the golden tests do, and an editor could ask for diagnostics without paying for layout). Treat those as the engine's internals made reachable, not as a stable API: they move when the engine moves.