Disclaimer: Readme was written with LLMs.
A set of complex analysis notes, written in Typst and published
from a single source as both a paged PDF and a website. The web
build uses Typst's experimental html and bundle features.
Project links: source repository and published website.
- Python 3.12 or newer, with the packages in
requirements.txt. - The repository's modified Typst 0.15 compiler. On Windows, this is
typst.exe.
The patched compiler raises Typst's convergence limit from 5 to 25 passes and adds selector targets for references.
Install the Python dependencies once:
python -m pip install -r requirements.txtA complete production build consists of preprocessing, Typst compilation, and search-index generation:
python scripts/build.py
./typst.exe compile --features bundle,html --format bundle --package-path packages main.typ dist
python build-search-index.pyThe result is a static website in dist/, including the routed HTML pages,
assets, search index, and the downloadable PDF at dist/pdf/notes.pdf.
scripts/build.py runs every other Python script below scripts/. These scripts generate the geometric data for visuals under build/visual-output/.
build-search-index.py runs after the bundle exists by scanning the generated
HTML, copying the search assets, and writing the index. A list of todos exist at the /todo subdirectory.
The optional debug-build input may be passed to skip drawings produced through the project's canvas helper (including quick-plot) while working on prose, equations, or layout; it also disables the generation of the List of Theorems and the List of Figures pages:
./typst.exe compile --features bundle,html --format bundle --package-path packages --input debug-build=true main.typ distThis only shortens the Typst compilation step; preprocessing and search-index
generation are unchanged when they are needed. Figures are rendered normally
when the input is omitted or has any value other than the string true.
Individual canvases can be opted back in during a hidden-figure build with
canvas(..., debug-show: true).
To build with the older modified compiler that only raises the convergence
limit, enable the legacy synthetic-label routing used by lbl:
./typst.exe compile --features bundle,html --format bundle --package-path packages --input legacy-label-routing=true main.typ distIn this compatibility mode, repeated PDF/HTML labels should continue to use
lbl; ordinary labels shared by both outputs require the newer compiler.
It is also possible to emit only a PDF output in the generation. This can be advantageous as it compiles much faster and uses less memory, and is more optimal to write with. The command is then:
./typst.exe compile --features bundle,html --package-path packages --input legacy-label-routing=true main.typTo emit the website bundle without also compiling the downloadable PDF, pass
the html-only input:
./typst.exe compile --features bundle,html --format bundle --package-path packages --input html-only=true main.typ dist
python build-search-index.pyFor an HTML-only debug build, pass both inputs (highly recommended when writing locally):
./typst.exe compile --features bundle,html --format bundle --package-path packages --input html-only=true --input debug-build=true main.typ dist
python build-search-index.pyThis omits dist/pdf/notes.pdf and the PDF links from the generated site. In
this mode, reference tooltips contain only the in-page preview control.
Press Ctrl+Shift+B in VS Code to start the default WATCHER: HTML only (debug) task. Use the Tasks: Run Task command to choose another watcher or
one-off compile task from .vscode/tasks.json. Each group contains combined
bundle, PDF-only, and HTML-only variants with and without debug-build=true.
Watcher tasks remain active and recompile after source changes. Stop one with
the Tasks: Terminate Task command. These tasks run the Typst compiler only;
run the preprocessing and search-index commands separately when those outputs
need to be refreshed.
.
|-- main.typ # Build entry point; calls notes()
|-- lib.typ # Shared public imports used by chapters
|-- chapters/ # Hierarchical mathematical content and routes
| |-- index.typ # Chapter order, numbering, and bibliography
| `-- appendices/ # Table of figures and theorem list
|-- src/
| |-- source.typ # Title, authors, abstract, cover, and source URL
| |-- components/
| | |-- web.typ # PDF/bundle orchestration and routed page helpers
| | |-- styles.typ # Shared PDF and web document styles
| | |-- references.typ # Cross-output labels and reference formatting
| | |-- theorems.typ # Theorem environments
| | |-- graphics.typ # CetZ and figure-layout helpers
| | |-- math.typ # Project-wide mathematical helpers
| | |-- packages.typ # Typst package imports
| | `-- ctheorems/ # Local customized theorem implementation
| `-- assets/ # CSS, JavaScript, icons, and bundled fonts
|-- scripts/ # Python visual-data preprocessors and runner
|-- build-search-index.py # Post-processes dist/ for client-side search
|-- references.bib # Bibliography database
|-- requirements.txt # Python preprocessing dependencies
|-- packages/ # Local Typst package path (currently empty)
|-- build/ # Generated preprocessing output (ignored)
`-- dist/ # Generated website and PDF bundle (ignored)
Chapter files import lib.typ and declare their place in the output with
helpers such as docs-chapter, docs-subchapter, docs-subsubchapter, and
docs-appendix. src/components/web.typ uses those declarations to produce
one continuous PDF document and the corresponding nested website routes.
The --package-path packages option is retained for local-package support,
although the custom packages previously stored there have now been incorporated
or refactored into src/components/.
See LICENSE for details.