A minimal template for writing novels with Typst.
Recommended one-command project creation (creates a new folder + fresh Git repo):
curl -fsSL https://raw.githubusercontent.com/anitasv/StoryTemplate/main/scripts/bootstrap.sh | bashOn macOS, the bootstrap script will also offer to install missing prerequisites (Homebrew, Typst, Pandoc). It will skip anything that’s already installed.
Then:
cd YourProjectFolder
make pdfYou’ll need the following tools installed locally:
- Typst (required) — compiles the
.typsources to PDF/HTML.
- Website: https://typst.app/
- Install instructions: https://github.com/typst/typst#installation
- Pandoc (required for EPUB + ODT) — converts the generated HTML into EPUB, and (optionally) chapter ODT files.
- Website: https://pandoc.org/
- Install instructions: https://pandoc.org/installing.html
- make (recommended) — runs the build recipes in the included
Makefile.
- Usually preinstalled on macOS/Linux.
- On Windows, consider using WSL.
chapters/— your manuscript content (start withchapters/chapter1.typ)story.typ— chapter ordering (includes chapters in order)print.typ— print/PDF entrypoint (cover + title page + includesstory.typ)ebook.typ— ebook/HTML entrypoint (includesstory.typ)
Build a PDF:
make pdfNote: the bootstrap script runs ./scripts/template-init.sh and stamps your
title/author/language/rights into styles/metadata.yaml, print.typ, and the
Makefile output name.
Run this any time you want to change the title/author/language/rights across outputs.
From the repo root:
./scripts/template-init.shYou’ll be prompted for:
- Title
- Author
- Language (BCP-47 tag like
enoren-US) - Rights
./scripts/template-init.sh \
--title "My Awesome Novel" \
--author "My Pen Name" \
--language en \
--rights "All rights reserved"./scripts/template-init.sh --showIf you have typst installed, you can build outputs via the provided Makefile.
All build outputs go into output/.
Build everything (PDF + HTML + EPUB):
makeBuild PDF (print layout):
make pdfBuild HTML (ebook layout, used as the source for EPUB):
make htmlBuild EPUB (requires pandoc):
make epubBuild chapter ODT files (one .odt per chapters/*.typ, requires pandoc):
make odtPrint word count across all chapters/*.typ:
make wcClean generated files:
make clean
make clean-odtYou can also build individual files directly (these are defined in the Makefile):
make print.pdfIf typst isn’t on your PATH, you can override it:
make pdf TYPST=/path/to/typst- Chapters: add/edit files in
chapters/(e.g.chapters/chapter2.typ). - Chapter list / ordering:
story.typis the “table of contents” for Typst. It#includes chapter files in the order they should appear. - Print entrypoint:
print.typ(cover + title page + includesstory.typ). - Ebook entrypoint:
ebook.typ(currently just includesstory.typ).
- Create a new file, e.g.
chapters/chapter2.typ. - Add it to
story.typ:
// Include chapters
#include "chapters/chapter1.typ"
#include "chapters/chapter2.typ"- Rebuild:
make pdf- Book metadata:
styles/metadata.yaml(used by Pandoc for EPUB metadata) - Title page variables:
print.typ(#let book_title = ...,#let book_author = ...) - Cover image:
images/cover.png - EPUB CSS:
styles/epub.css
Additional project docs live in docs/:
docs/WRITING_INSTRUCTIONS.md— writing style instructions, mainly intended for LLMs.docs/OUTLINE.md— story outline notesdocs/CHARACTERS.md— character notes