Dual EPUB and Print Book Pipelines
Keep one canonical Markdown manuscript feeding Typst for print PDF and a clean semantic converter for EPUB 3 so you never maintain two separate book drafts.
Typst's native strength is paginated print layout: exact trim geometry, hyphenation, widow control, running headers, and vector tables. While Typst's experimental HTML export continues evolving, Kindle Direct Publishing and Apple Books expect strict reflowable EPUB 3 packages with clean XHTML5 chapter splits, semantic <nav epub:type="toc"> manifests, high-resolution JPEG covers (1600x2560 px), and zero fixed page numbers. Trying to convert a finished print PDF into an ebook guarantees broken line wraps, orphaned running headers, and mangled footnotes.
Single-Source Architecture
Store book chapters as plain numbered Markdown files with YAML front matter, then compile print and digital outputs in parallel from that shared tree.
book/
book.yaml # title, author, isbn, trim, paper stock
chapters/
01-introduction.md
02-architecture.md
03-deployment.md
assets/
cover-front.jpg # 1600x2560 sRGB JPEG for ebook + cover base
fig-01.png # 300 DPI print / scaled digital figure
build/
interior.typ # Typst layout consuming parsed chapters
epub.css # Minimal reflowable Kindle/Apple stylesheet
Separating prose from layout fixes the single worst bottleneck in self-publishing: post-proof typo corrections. When a beta reader catches twelve errors right before launch, you edit the Markdown chapter once and re-run your build script. Typst regenerates the 6x9 print PDF with refreshed table-of-contents page numbers, your spine wrap recalculates automatically if page count shifts, and your EPUB 3 bundle updates identically in the same five-second run.
Print vs Reflowable Rules
Respect the physical differences between fixed paper spreads and user-resizable e-reader viewports instead of forcing identical styling onto both targets.
| Element | Typst Print PDF Rule | Reflowable EPUB 3 Rule |
|---|---|---|
| Font family | Embed explicit print serif/sans | Omit body font so reader chooses |
| Margins | Mirrored inside/outside inches | Minimal padding; device sets edges |
| Page numbers | Running footers + TOC leaders | Omit completely; link TOC anchors |
| Code blocks | Fixed 8.5pt mono, 68-char wrap | white-space: pre-wrap + scroll safe |
| Images | 300 DPI, explicit width % | sRGB JPEG/PNG, max-width: 100% |
| Tables | Multi-column tabular grid | Narrow 2-4 cols or stacked lists |
Pay special attention to EPUB typography overrides. Hard-coding color: #111111 or background: #ffffff on body paragraphs breaks dark mode on Kindle Paperwhite and Apple Books, leaving readers staring at black text on a charcoal screen. Leave body foreground and background unset in your EPUB stylesheet so every reading device renders clean day, sepia, and night themes natively.
Validation Before Upload
Run automated validation on both artifacts before touching KDP because silent packaging bugs cost days in manual review loops.
For the EPUB target, run W3C epubcheck as a hard CI failure gate; zero errors and zero fatals should be non-negotiable. Open the resulting file in Kindle Previewer 3 to verify clickable TOC links, chapter starts, image aspect ratios, and footnote pop-ups across phone, tablet, and e-ink viewports. For the print PDF target, inspect font embedding via pdffonts (every row must show emb: yes) and verify exact trim dimensions with pdfinfo.
Two recurring edge cases break single-source book pipelines right before launch: footnotes and wide technical tables. On paper, Typst sets crisp bottom-of-page footnotes numbered automatically per chapter or book. In Kindle EPUB 3, footnotes work best as end-of-chapter aside notes linked with epub:type="noteref" and epub:type="footnote" attributes so Kindle displays clean inline pop-up cards without jumping the reader away from their place. Wide five-column reference tables that fit neatly across a 6x9 print spread frequently clip horizontally on narrow 6-inch e-ink screens; keep digital comparison tables under four compact columns or convert dense multi-column specs into clean definition lists during EPUB generation.
Front matter order also differs subtly between print paperbacks and Kindle ebooks. A physical paperback opens with a half-title page, title page, copyright verso, optional dedication, and paginated table of contents before Chapter 1 starts on an odd recto page. On Kindle, Amazon automatically opens readers at the start of Chapter 1 based on the EPUB landmark tag, while placing front matter ahead of the cover break hurts the Look Inside sample preview. Keep your EPUB landmark pointing cleanly to body content and place copyright boilerplate neatly either right after the title page or in back matter so retail buyers land directly in your strongest opening prose.
Zero-Maintenance Hosted Alternative
Skip maintaining custom Pandoc filters, EPUB manifests, and Typst bridges by using a hosted single-source compiler built specifically for KDP dual delivery.
Maintaining both a Typst print layout and an epubcheck-clean EPUB 3 compiler takes real engineering time, especially once you add callout boxes, scene breaks, multi-level tables of contents, and ISBN metadata. If you want single-source Markdown or DOCX compilation into a KDP-ready Typst print PDF, recalculated full-wrap cover, and validated EPUB 3 in one pass, MakeThisABook ships all three formats together from $19 per book ($59 lifetime for formatting your own manuscripts). Compare the build-vs-buy tradeoff in Hosted vs DIY Typst, or check KDP cover wrap geometry for final paperback assembly.
Automating both targets from one clean source repository means you never ship an outdated Kindle edition after fixing a paperback typo, and never burn launch week rebuilding CSS overrides or spine geometry by hand.