@uniweb/unipress 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/cli.js +2 -1
- package/src/foundations-data.js +29 -0
- package/src/templates-data.js +42 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/unipress",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Compile a content directory into a document (PDF, EPUB, Paged.js HTML, Typst source bundle, DOCX, XLSX) using a Uniweb foundation. Five built-in templates: book, monograph, report, data-report, directory.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"prompts": "^2.4.2",
|
|
50
50
|
"react": "^18.0.0 || ^19.0.0",
|
|
51
51
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
52
|
-
"@uniweb/build": "0.11.
|
|
53
|
-
"@uniweb/
|
|
54
|
-
"@uniweb/
|
|
55
|
-
"@uniweb/
|
|
56
|
-
"@uniweb/
|
|
52
|
+
"@uniweb/build": "0.11.5",
|
|
53
|
+
"@uniweb/content-reader": "1.1.7",
|
|
54
|
+
"@uniweb/runtime": "0.8.7",
|
|
55
|
+
"@uniweb/semantic-parser": "1.1.14",
|
|
56
|
+
"@uniweb/core": "0.7.6"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"test": "echo \"no tests yet\" && exit 0",
|
package/src/cli.js
CHANGED
|
@@ -19,9 +19,10 @@ Usage:
|
|
|
19
19
|
|
|
20
20
|
Commands:
|
|
21
21
|
compile <dir> Compile a content directory into a document
|
|
22
|
-
--format <fmt> output format (pdf | typst | docx | xlsx | epub)
|
|
22
|
+
--format <fmt> output format (pdf | typst | latex | docx | xlsx | epub | pagedjs)
|
|
23
23
|
overrides format: in document.yml
|
|
24
24
|
pdf compiles via typst source bundle
|
|
25
|
+
latex emits a LaTeX source bundle (run latexmk yourself)
|
|
25
26
|
--foundation <ref> override document.yml's foundation: field
|
|
26
27
|
--out <path> output file (default: ./<dir>.<ext>)
|
|
27
28
|
--config <path> explicit config file (default: <dir>/unipress.config.js)
|
package/src/foundations-data.js
CHANGED
|
@@ -81,6 +81,11 @@ const DATA_FOUNDATION = {
|
|
|
81
81
|
source: { url: publicUrl('data', '0.1.0') },
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
const BUSINESS_DOCS_FOUNDATION = {
|
|
85
|
+
ref: '@uniweb/business-docs@0.1.0',
|
|
86
|
+
source: { url: publicUrl('business-docs', '0.1.0') },
|
|
87
|
+
}
|
|
88
|
+
|
|
84
89
|
export const FOUNDATIONS = [
|
|
85
90
|
{
|
|
86
91
|
id: 'book',
|
|
@@ -113,6 +118,19 @@ export const FOUNDATIONS = [
|
|
|
113
118
|
foundation: BOOK_FOUNDATION,
|
|
114
119
|
scaffold: 'report',
|
|
115
120
|
},
|
|
121
|
+
{
|
|
122
|
+
id: 'thesis',
|
|
123
|
+
name: 'Thesis (UofT-shaped)',
|
|
124
|
+
description:
|
|
125
|
+
'Graduate thesis targeting the University of Toronto SGS formatting ' +
|
|
126
|
+
'requirements. Includes title page, abstract, list of figures, ' +
|
|
127
|
+
'theorem/lemma/proof environments, biblatex bibliography, and ' +
|
|
128
|
+
'autoref cross-references. Compiles to PDF/A-1b for ProQuest archival ' +
|
|
129
|
+
'via `latexmk` once `tlmgr install ut-thesis` has run locally.',
|
|
130
|
+
outputs: ['latex', 'pdf', 'typst', 'pagedjs', 'epub'],
|
|
131
|
+
foundation: BOOK_FOUNDATION,
|
|
132
|
+
scaffold: 'thesis',
|
|
133
|
+
},
|
|
116
134
|
{
|
|
117
135
|
id: 'data-report',
|
|
118
136
|
name: 'Data Report',
|
|
@@ -133,4 +151,15 @@ export const FOUNDATIONS = [
|
|
|
133
151
|
foundation: DATA_FOUNDATION,
|
|
134
152
|
scaffold: 'directory',
|
|
135
153
|
},
|
|
154
|
+
{
|
|
155
|
+
id: 'invoice',
|
|
156
|
+
name: 'Invoice',
|
|
157
|
+
description:
|
|
158
|
+
'A multi-line subscription invoice referencing a signed statement of ' +
|
|
159
|
+
'work. Demonstrates the @uniweb/business-docs foundation: SOW + invoice ' +
|
|
160
|
+
'collections, computed totals, and the SHOW-default Loom shorthand.',
|
|
161
|
+
outputs: ['docx', 'pagedjs'],
|
|
162
|
+
foundation: BUSINESS_DOCS_FOUNDATION,
|
|
163
|
+
scaffold: 'invoice',
|
|
164
|
+
},
|
|
136
165
|
]
|
package/src/templates-data.js
CHANGED
|
@@ -11,7 +11,7 @@ export const TEMPLATES = {
|
|
|
11
11
|
"content/02-formatting.md": "# What the Template Can Do\n\nThis chapter exercises the formatting features the book template supports. You can keep it around as a reference while you work, or delete it once you've seen what's here.\n\n## Headings\n\nA first-level heading like the one above starts a new chapter. Second-level headings like this one mark sections within a chapter. Third-level headings exist if you need them, but most books don't.\n\n## Emphasis and quotation\n\nBody text can be *italic* or **bold** or even ***both at once***. You can mark technical terms in `monospace`, which the template renders in a slightly smaller size to keep them from disrupting the line.\n\nFor longer quotations, blockquotes pull away from the body:\n\n> The book template treats quotations as a separate visual register, not just indented prose. The result is that a long passage of someone else's words looks like quotation, not like a paragraph that wandered off-margin.\n\nThat's the kind of detail typography handles for you.\n\n## Lists\n\nNumbered lists are useful when order matters:\n\n1. First, the order matters.\n2. Then, the order matters more.\n3. Finally, the order has mattered enough.\n\nBulleted lists are useful when it doesn't:\n\n- One thing.\n- Another thing.\n- A third thing, related to the first two.\n\n## Mathematics\n\nIf your book includes equations, write them in LaTeX style. Inline equations sit in the flow of a sentence, like $E = mc^2$, without disrupting the line. Displayed equations get their own line and centered position:\n\n$$\n\\int_{-\\infty}^{\\infty} e^{-x^2} \\, dx = \\sqrt{\\pi}\n$$\n\nThe book template knows how to size and space these properly.\n\n## Footnotes\n\nFootnotes attach to the end of the relevant page.[^1] Multiple footnotes work fine.[^2] You don't have to manage their numbering — the template does.\n\n[^1]: Like this one. The numbering is automatic; you can refer to footnotes by name in the markdown source and the template renumbers them in the order they appear.\n\n[^2]: This is the second footnote. It's longer, to show that footnotes wrap properly across multiple lines if they need to, and that the typography of footnote text is different from the body text.\n\n## Code blocks\n\nIf your book includes code, fenced code blocks render with monospace typography and proper spacing:\n\n```\nfunction example() {\n return \"this is a code block\"\n}\n```\n\nYou can name a language for syntax highlighting in printed and digital outputs.\n\n## Images\n\nImages live in your project's `assets/` folder. Reference them with standard markdown — site-absolute paths are checked against `assets/` automatically:\n\n```\n\n```\n\nThe book template handles figure numbering, captions, and placement.\n\nThat's most of it. The next chapter points you toward where to go from here.\n",
|
|
12
12
|
"content/03-where-next.md": "# Where to Go from Here\n\nYou've seen what a unipress book looks like. The next steps depend on what you're working on.\n\nIf you're starting a new book, replace the contents of these chapter files with your own writing. Adjust the title and author in `document.yml`. Add or remove chapters as your book takes shape.\n\nIf you want a different look — a different page size, different fonts, a different cover treatment — open `document.yml` and look at the settings the book template exposes. Most visual aspects are configurable without leaving the template.\n\nIf you have your own cover artwork, replace `assets/front.jpg` and `assets/back.jpg` with your own files (any common image format works — adjust the `book.covers.front` and `.back` paths in `document.yml` if you change the extension). The template will use yours instead of the placeholders.\n\nIf the book template isn't quite right for what you're writing — if you're producing an academic monograph, a thesis, a paper, or a report — try one of the other templates. Run `unipress list-templates` to see what's available.\n\nIf you want to take the typesetting further than the template allows, ask unipress for the Typst source: `unipress compile --format typst`. You'll get a folder of source files you can take into Typst directly, customize without limit, and compile yourself.\n\nWhen you're ready to share your book, the formats are at your disposal: PDF for printing or sharing, EPUB for ebook readers, Word for committees and collaborators. One source, many outputs.\n\nWhen you're ready to publish — to find readers, to put your book in stores or libraries — see the project's `PUBLISHING.md` for notes on what's next.\n\nThat's the tour. The blank chapters above this one are waiting for your own writing.\n",
|
|
13
13
|
"content/99-colophon.md": "---\ntype: BackMatter\ntitle: Colophon\n---\n\n# Colophon\n\nThis book was set in the book template's default typography and produced with [unipress](https://github.com/uniweb/unipress), a tool for turning markdown into finished documents. The text faces are the foundation's defaults; the cover image is a placeholder and should be replaced before publication.\n\nThe structure of this book — its chapters, its title page, its page numbering, its back matter — is the work of the book foundation, which is itself part of the [Uniweb](https://uniweb.app) ecosystem. The foundation handles the typography; the markdown handles the content. Each is what it does well.\n\nIf you're reading this in a published version of the book, it means the author kept the colophon. If you're reading it in the placeholder version that ships with unipress, replace it with your own when you're ready, or remove the file from `content/` if you don't want a colophon at all.\n",
|
|
14
|
-
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.
|
|
14
|
+
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.3.0'\nformat: pdf\n\nbook:\n title: \"{{title}}\"\n subtitle: \"\"\n author: \"{{author}}\"\n language: en\n rights: \"© {{year}} {{author}}. All rights reserved.\"\n\n # Trim size. Common values:\n # trade-6x9 (default), trade-7x10, crown-octavo, royal-octavo, a5\n trim: trade-6x9\n\n # Front matter and structure.\n structure:\n titlePage: true\n copyrightPage: true\n toc: true\n tocDepth: 2\n frontMatterNumbering: roman\n\n # Cover artwork. The scaffold ships placeholder front + back files so\n # the first compile produces a complete-looking book; replace both files\n # in `assets/` with your own artwork when you have it. The back cover\n # appears at the end of the PDF; the front is referenced by EPUB\n # readers and most PDF viewers as the book's thumbnail.\n covers:\n front: assets/front.jpg\n back: assets/back.jpg\n\n # Optional typography overrides. Defaults work for most books — uncomment\n # to customize.\n #\n # typography:\n # bodySize: 11pt\n # leading: 0.72em\n # firstLineIndent: 1.4em\n # bodyFont: [\"EB Garamond\", \"Garamond\", \"Georgia\"]\n # headingFont: [\"EB Garamond\", \"Garamond\", \"Georgia\"]\n\n # Optional citation system. Trade books rarely cite sources; the\n # `monograph` template ships with this turned on by default. To opt in\n # here, uncomment the two blocks below, add a `collections/bibliography/`\n # directory of YAML records, and a `99-bibliography.md` content file\n # with `type: Bibliography`. See the monograph template's README for\n # the full pattern.\n #\n # citationStyle: chicago-author-date\n # bibliography:\n # sortBy: author\n\n# collections:\n# bibliography:\n# path: collections/bibliography\n\n# Reading order. Files in content/ are sorted by name; the explicit list\n# below makes the order predictable. Add new chapters by creating\n# content/<name>.md and adding the base name (without `.md`) here.\ncontent:\n - 01-welcome\n - 02-formatting\n - 03-where-next\n - 99-colophon\n",
|
|
15
15
|
},
|
|
16
16
|
"data-report": {
|
|
17
17
|
"README.md": "# `data-report` template\n\nA data-driven report aggregating metrics across a set of records (members, publications, funding, supervisions). Pinned to `@uniweb/data` — outputs both an Excel workbook (one sheet per section) and a Word report.\n\n```bash\nunipress compile . --format xlsx --out my-report.xlsx\nunipress compile . --format docx --out my-report.docx\n```\n\n## What's here\n\n```\ndata-report/\n├── document.yml pinned to @uniweb/data\n├── theme.yml\n├── collections/\n│ ├── members/ three sample records (19th-century naturalists)\n│ └── queries/ saved query examples\n└── content/\n └── report/ cover, members, publications-by-*, funding, supervisions\n```\n\nThe starter ships three sample members (Darwin, Lyell, Wallace) so the first compile produces a non-empty workbook. Replace the YAML files under `collections/members/` with your own data — the foundation reads any record matching the queryable schema declared in `document.yml`.\n\n## Customize\n\n### Add a member\n\nDrop a YAML file under `collections/members/`:\n\n```yaml\n# collections/members/your-name.yml\nname: \"Jane Doe\"\ndepartment: biology\nrank: professor\ntenured: true\nstart_year: 2018\npublications:\n - { type: article, title: \"...\", year: 2024, journal: \"...\", doi: \"...\" }\nfunding:\n - { title: \"...\", amount: 250000, year: 2023, source: \"...\" }\nsupervisions:\n - { name: \"...\", level: PhD, year: 2024 }\n```\n\nThe Cover section's Loom expressions (`{COUNT OF members}`, `{totalPublications}`, etc.) update automatically.\n\n### Filter the active selection\n\nEdit `document.yml`'s `collections.members.queryable:` to declare the filterable fields you want exposed in the FilterPanel UI. Each field becomes a control; `enum` fields render as multi-select, `boolean` as toggles, `range` as numeric range inputs.\n\n### Switch from static files to a backend\n\nWhen the data outgrows the YAML files (`/data/members.json`-shaped backed by `collections/members/`), declare a backend fetcher:\n\n```yaml\ncollections:\n members:\n path: collections/members\n fetcher:\n url: https://api.example.com/members\n supports: [where, limit, sort]\n```\n\n`supports: [where]` ships the active where-object to the backend; the same foundation code, same components, same compile output — what changed is *where the predicate runs*.\n",
|
|
@@ -43,6 +43,17 @@ export const TEMPLATES = {
|
|
|
43
43
|
"content/directory/page.yml": "title: Directory\ndescription: A simple listing of records, filterable by department, role, and active status. Same data feeds the web preview and the downloadable Excel listing.\n\nfetch:\n - { collection: members }\n",
|
|
44
44
|
"document.yml.hbs": "name: \"{{title}}\"\n{{#if author}}\nauthor: \"{{author}}\"\n{{/if}}\nyear: {{year}}\n\nfoundation: '@uniweb/data@0.1.0'\nformat: xlsx\n\n# content/directory/ holds one page-folder; the listing renders into a\n# single workbook (xlsx) with one sheet, or a docx tabular report.\nindex: directory\n\ncollections:\n members:\n path: collections/members\n queryable:\n department:\n type: enum\n label: Department\n options: [engineering, sciences, humanities]\n role:\n type: enum\n label: Role\n options: [member, lead, advisor]\n active:\n type: boolean\n label: Active\n",
|
|
45
45
|
},
|
|
46
|
+
"invoice": {
|
|
47
|
+
"README.md": "# `invoice` document template\n\nA self-contained worked invoice for the [`@uniweb/business-docs`](../../foundations/business-docs/)\nfoundation. Demonstrates a multi-line subscription bill referencing a\nsigned statement of work in the same project.\n\n## Compile\n\n```bash\nunipress compile . --format docx --out invoice-0001.docx\nunipress compile . --format pagedjs --out invoice-0001.html\n```\n\n`--format docx` produces a Word file directly. `--format pagedjs`\nproduces a Paged.js-wired HTML — open it in a browser and use the\nbrowser's Print → Save as PDF for the printable artifact. (A native\nPDF output via Paged.js or Typst is on the v2 roadmap; today's\nunipress hardcodes `pdf → typst`, and `@uniweb/business-docs` doesn't\nship a Typst path.)\n\n## Layout\n\n```\ninvoice/\n├── document.yml.hbs # vendor + defaults + foundation reference\n├── collections/\n│ ├── sows/sow0001.yml # signed SOW the invoice bills against\n│ └── invoices/0001.yml # the multi-line subscription invoice\n└── content/invoice/\n ├── page.yml # fetches both collections so cross-record validation runs\n ├── 01-cover.md # invoice header (vendor, client, dates, period)\n ├── 02-line-items.md # source: items — divider-split table body\n ├── 03-totals.md # uses computed {subtotal}, {tax_amount}, {total}\n └── 04-payment.md # remit instructions\n```\n\n## Loom in this template\n\n`SHOW` is the default verb. `{number}` is the same as `{SHOW number}`.\nReserve explicit verbs for cases that need them:\n\n- `{SHOW tax_amount IF tax_amount}` — render the tax amount only when\n it's > 0. The `IF` returns empty when falsy, leaving the surrounding\n table cell blank without breaking column structure.\n- `{SHOW period.from IF period} – {SHOW period.to IF period}` — render\n the period column only when the line carries one.\n- `{* qty unit_price}` — Compact-form arithmetic for the per-line\n amount (mixed Plain and Compact in the same template is fine).\n\nThe `{subtotal}`, `{tax_amount}`, `{tax_rate}`, `{tax_label}`, and\n`{total}` placeholders are computed by the foundation handler before the\ntotals slice renders, so the slice itself stays declarative.\n\n## Customization\n\nSwap `business_docs.vendor` in `document.yml.hbs` for your real vendor\nidentity, set `defaults.tax_jurisdiction` to a registry key the\nfoundation ships with (`HST`, `GST`, `PST`, `QST`, `VAT`) or extend the\nregistry via `business_docs.registries.tax:`. Add invoices by dropping\nnew files into `collections/invoices/` and re-running compile.\n",
|
|
48
|
+
"collections/invoices/0001.yml": "# Demo invoice — multi-line subscription bill billing against sow0001.\n# Demonstrates the array-of-items shape the schema is designed around.\nstatus: open\nnumber: 'INV-0001'\nsow_ref: '0001'\nissued: 2026-03-01\ndue: 2026-03-31\nperiod:\n from: 2026-01-01\n to: 2026-12-31\nclient:\n organization: Globex Corporation\n contact: Jane Example\n email: jane@globex.example\npo_number: PO-2026-001\n\nitems:\n - description: Hosting (Year 1)\n qty: 1\n unit_price: 8000\n period: { from: 2026-01-01, to: 2026-12-31 }\n - description: Platform support (Year 1)\n qty: 1\n unit_price: 24000\n period: { from: 2026-01-01, to: 2026-12-31 }\n - description: Quarterly review sessions\n qty: 4\n unit_price: 1500\n period: null # No period: hourly/per-event line; demonstrates {IF period} drop.\n - description: Migration assistance\n qty: 12\n unit_price: 250\n period: null\n\ntax:\n jurisdiction: NONE # Demo template only; real users override per jurisdiction.\n\nnotes: |\n Annual subscription bill covering hosting, support, and the agreed\n quarterly review cadence. Migration assistance is hourly, billed\n against the discovery phase of SOW 0001.\n\npayment:\n paid_on: null\n remittance_ref: null\n\nfoundation_version: '@uniweb/business-docs@0.1.0'\n",
|
|
49
|
+
"collections/sows/sow0001.yml": "# Demo SOW — fictional companies, plausible numbers.\nstatus: signed\nnumber: '0001'\ntitle: Platform redesign — Phase 1\nclient:\n organization: Globex Corporation\n contact: Jane Example\n email: jane@globex.example\nissued: 2025-09-01\nsigned: 2025-09-15\nexpires: 2026-12-31\nfee_model: fixed\nbudget:\n total: 48000\n hourly_rate: 120\n\nscope: |\n Redesign Globex Corporation's customer-facing platform: information\n architecture review, visual system, and a working prototype of three\n representative flows (sign-up, account, checkout). All deliverables\n remain Globex's property on acceptance.\n\ndeliverables:\n - milestone: M1\n description: Discovery + IA review\n due: 2025-10-31\n fee: 12000\n - milestone: M2\n description: Visual system + component library\n due: 2025-12-15\n fee: 18000\n - milestone: M3\n description: Prototype of three flows + handoff\n due: 2026-02-28\n fee: 18000\n\nsignatures:\n - party: vendor\n name: First Last\n role: Director\n signed: 2025-09-15\n - party: client\n name: Jane Example\n role: VP Engineering\n signed: 2025-09-15\n\nfoundation_version: '@uniweb/business-docs@0.1.0'\n",
|
|
50
|
+
"content/invoice/01-cover.md": "---\ntype: Invoice\ntitle: Invoice\ntheme: light\n---\n\nInvoice number: **{number}**\nIssued: **{issued}** · Due: **{due}**\nPeriod: **{period.from} – {period.to}**\nPO number: **{po_number}** · Bills against SOW: **{sow_ref}**\n\n**From:** {vendor.organization}\n{vendor.address}\n\n**Bill to:** {client.organization}\n{client.contact}\n",
|
|
51
|
+
"content/invoice/02-line-items.md": "---\ntype: Invoice\ntitle: Line items\nsource: items\ntheme: light\n---\n\n---\n\n**{description}** — {qty} × {unit_price} = {amount}\n{SHOW period.from IF period} – {SHOW period.to IF period}\n",
|
|
52
|
+
"content/invoice/03-totals.md": "---\ntype: Invoice\ntitle: Totals\ntheme: light\n---\n\nSubtotal: **{subtotal}**\n{SHOW tax_label IF tax_amount}: **{SHOW tax_amount IF tax_amount}**\n**Total: {total}**\n",
|
|
53
|
+
"content/invoice/04-payment.md": "---\ntype: Invoice\ntitle: Payment\ntheme: light\n---\n\nPlease remit by **{due}** to {vendor.email}, referencing **{number}** and PO **{po_number}**.\n\n{notes}\n",
|
|
54
|
+
"content/invoice/page.yml": "title: Invoice INV-0001\ndescription: Demo subscription invoice billing against the platform-redesign SOW.\n\n# Page-level fetch surfaces the active collection on every section as\n# data.invoices. SOWs are reachable via block.website.config.collections.sows.records\n# (unipress's synchronous cross-page fallback), which the foundation\n# handler uses for cross-record validation without a second fetch\n# declaration. Multi-fetch (`fetch: [a, b]`) isn't yet supported by\n# the unipress orchestrator (see content-loader.js).\ndata: invoices\n",
|
|
55
|
+
"document.yml.hbs": "name: \"{{title}}\"\n{{#if author}}\nauthor: \"{{author}}\"\n{{/if}}\nyear: {{year}}\n\nfoundation: '@uniweb/business-docs@0.1.0'\nformat: docx\n\n# content/invoice/ holds one page-folder; everything renders into a\n# single downloadable invoice. `--format docx` produces a Word file\n# directly; `--format pagedjs --out invoice.html` produces a Paged.js-\n# wired HTML you print-to-PDF in a browser.\nindex: invoice\n\nbusiness_docs:\n vendor:\n organization: Acme Studios\n contact: First Last\n email: billing@acme.example\n address: |\n 123 Example Street\n City, Region 00000\n Country\n defaults:\n currency: USD\n locale: en-US\n tax_jurisdiction: NONE # Demo template: no tax. Real users override.\n payment_terms_days: 30\n\ncollections:\n sows:\n path: collections/sows\n invoices:\n path: collections/invoices\n",
|
|
56
|
+
},
|
|
46
57
|
"monograph": {
|
|
47
58
|
"README.md": "# `monograph` template\n\nA scholarly monograph: royal-octavo trim, classical typography (EB Garamond by default), three-deep TOC, roman-numeralled front matter, and a working citation system. Same `@uniweb/book` foundation as the `book` and `report` templates — different defaults to fit academic press conventions.\n\n```bash\nunipress compile . --format pdf --out my-monograph.pdf\nunipress compile . --format epub --out my-monograph.epub\n```\n\n## What's here\n\n```\nmonograph/\n├── document.yml pinned to @uniweb/book; royal-octavo, EB Garamond\n├── collections/\n│ └── bibliography/\n│ └── refs.bib BibTeX records — one .bib file, every @entry is one record\n├── content/\n│ ├── 01-preface.md type: BackMatter\n│ ├── 02-introduction.md type: Chapter\n│ ├── 03-chapter-one.md type: Chapter (worked cite example)\n│ └── 99-bibliography.md type: Bibliography (back-matter list)\n└── README.md this file\n```\n\nThe starter ships a small Victorian-naturalist bibliography and a chapter that exercises every inline-cite shape — bare, page locator, multi-cite cluster, suppress-author. Compile out of the box and read the result alongside the markdown source to see what each shape produces.\n\n## Citations\n\n### Pick a style\n\nSet `book.citationStyle:` in `document.yml`. Nine styles ship:\n\n| Style | Shape | Use case |\n|---|---|---|\n| `chicago-author-date` (default) | (Darwin 1859, 42) | Humanities, history, social sciences |\n| `apa` | (Darwin, 1859) | Psychology, education, social sciences |\n| `mla` | (Darwin 42) | Literature, modern languages |\n| `harvard` | (Darwin 1859: 42) | UK humanities, business |\n| `ieee` | [1, p. 42] | Engineering, computer science |\n| `vancouver` | (1) | Medicine, biomedicine |\n| `ama` | ¹ | Medical journals |\n| `nature` | ¹ | Nature journals |\n| `science` | (1) | Science journals |\n\nSwitching the style re-formats every inline cite and the back-matter bibliography to match. No other change is needed.\n\n### Author bibliography entries\n\nDrop a `.bib` file into `collections/bibliography/`. Every `@entry{key, ...}` becomes one record; the BibTeX cite key is the entry id you reference from prose with `[@key]`. Standard BibTeX entry types — `@article`, `@book`, `@incollection`, `@inproceedings`, `@phdthesis`, `@techreport`, `@misc`, and the rest — all work; LaTeX accents (`\\\"u`, `\\'e`, `\\v{c}`) are converted to Unicode automatically.\n\n```bibtex\n% collections/bibliography/refs.bib\n\n@book{darwin1859,\n author = {Darwin, Charles},\n title = {On the Origin of Species},\n publisher = {John Murray},\n address = {London},\n year = {1859}\n}\n\n@article{wallace1858,\n author = {Wallace, Alfred Russel},\n title = {On the Tendency of Varieties to Depart Indefinitely from the Original Type},\n journal = {Journal of the Proceedings of the Linnean Society of London. Zoology},\n volume = {3},\n number = {9},\n pages = {53--62},\n year = {1858}\n}\n```\n\nAlready have records as YAML or JSON in CSL-JSON shape? Drop them in the same folder — the loader merges every `.bib`, `.yml`, and `.json` it finds into one collection. Use whatever your reference manager exports; reach for hand-written YAML when an entry needs a field BibTeX can't carry. The full list of CSL types and fields is at [docs.citationstyles.org](https://docs.citationstyles.org/en/stable/specification.html#appendix-iii-types).\n\n### Cite in prose\n\n```markdown\nDarwin (1859) showed [@darwin1859]{suppress-author} that selection\nacts on heritable variation [@darwin1859]{page=42}.\nIndependent contemporary work [@wallace1858; @lyell1830] reached\ncompatible conclusions.\n```\n\n| Markdown | Renders as (chicago-author-date) |\n|---|---|\n| `[@darwin1859]` | (Darwin 1859) |\n| `[@darwin1859]{page=42}` | (Darwin 1859, 42) |\n| `[@a; @b]` | (Author A 1900; Author B 1910) |\n| `[@darwin1859]{suppress-author}` | (1859) — for prose where the author is already named |\n| `[@nope]` | [?] — visible placeholder, no compile failure |\n\nA missing key never breaks the compile — the `[?]` mark is a visible reminder to fix the citation.\n\n### The back-matter bibliography\n\n`content/99-bibliography.md` is a one-line back-matter section that lists every record from the collection in style-correct order:\n\n```markdown\n---\ntype: Bibliography\ntitle: References\ndata: bibliography\n---\n```\n\nFor numbered styles (IEEE, Vancouver, etc.), the bibliography list reuses the same numbering the inline cites use — `[1]` inline matches `[1]` in the back-matter list.\n\n## When to pick `monograph` over `book`\n\n- You need cited bibliographic references in your prose.\n- You want section numbering deeper than two levels (default `tocDepth: 3`).\n- You want classical book typography (EB Garamond) rather than the foundation's default sans/serif fall-back.\n- You want a slightly larger page (royal-octavo, 6.14×9.21in) common in academic hardcovers.\n\nFor trade-paperback fiction or non-fiction prose, use `book` instead.\n\n## Customize\n\nEdit `document.yml`:\n\n- `book.citationStyle:` — pick from the nine styles above.\n- `book.bibliography.sortBy:` — `author` (default), `year`, or `collection-order`.\n- `book.typography.bodyFont`, `book.typography.headingFont` — the EB Garamond fallback chain.\n- `book.trim:` — `royal-octavo` (default), `crown-octavo`, `trade-6x9`, `trade-7x10`, `a5`.\n- `book.structure.tocDepth:` — bump to 4 for very subdivided arguments.\n\nFor the full list of foundation knobs, see `framework/unipress/foundations/book/README.md`.\n",
|
|
48
59
|
"collections/bibliography/refs.bib": "@book{darwin1859,\n author = {Darwin, Charles},\n title = {On the Origin of Species by Means of Natural Selection},\n publisher = {John Murray},\n address = {London},\n year = {1859}\n}\n\n@book{darwin1871,\n author = {Darwin, Charles},\n title = {The Descent of Man, and Selection in Relation to Sex},\n publisher = {John Murray},\n address = {London},\n year = {1871}\n}\n\n@incollection{hooker1859,\n author = {Hooker, Joseph Dalton},\n title = {On the flora of {Australia}, its origin, affinities, and distribution},\n booktitle = {The Botany of the Antarctic Voyage of H.M. Discovery Ships Erebus and Terror},\n editor = {Hooker, Joseph Dalton},\n volume = {3},\n publisher = {Lovell Reeve},\n address = {London},\n pages = {i--cxxviii},\n year = {1859}\n}\n\n@book{huxley1863,\n author = {Huxley, Thomas Henry},\n title = {Evidence as to Man's Place in Nature},\n publisher = {Williams \\& Norgate},\n address = {London},\n year = {1863}\n}\n\n@book{lyell1830,\n author = {Lyell, Charles},\n title = {Principles of Geology},\n volume = {1},\n publisher = {John Murray},\n address = {London},\n year = {1830}\n}\n\n@article{mendel1866,\n author = {Mendel, Gregor},\n title = {Versuche \\\"uber Pflanzen-Hybriden},\n journal = {Verhandlungen des naturforschenden Vereines in Br\\\"unn},\n volume = {4},\n pages = {3--47},\n year = {1866}\n}\n\n@book{spencer1864,\n author = {Spencer, Herbert},\n title = {The Principles of Biology},\n volume = {1},\n publisher = {Williams \\& Norgate},\n address = {London},\n year = {1864}\n}\n\n@article{wallace1858,\n author = {Wallace, Alfred Russel},\n title = {On the Tendency of Varieties to Depart Indefinitely from the Original Type},\n journal = {Journal of the Proceedings of the Linnean Society of London. Zoology},\n volume = {3},\n number = {9},\n pages = {53--62},\n year = {1858}\n}\n\n@book{wallace1869,\n author = {Wallace, Alfred Russel},\n title = {The Malay Archipelago},\n publisher = {Macmillan},\n address = {London},\n year = {1869}\n}\n",
|
|
@@ -50,13 +61,41 @@ export const TEMPLATES = {
|
|
|
50
61
|
"content/02-introduction.md": "---\ntype: Chapter\ntitle: \"Introduction\"\n---\n\nEvery monograph opens with an introduction that does three things at once: it situates the work in its existing scholarship, it states the question the rest of the book will pursue, and it tells the reader what to expect chapter by chapter. The first task is the most contested — too brief and the reader doubts that you know the literature, too thorough and you have written a literature review instead of an introduction.\n\nThe starter chapter that follows treats Victorian-naturalist sources as a worked example of the citation apparatus this template ships with. The author of this template assumes you will replace both the sample bibliography (`collections/bibliography/`) and the chapter prose with your own material — the structural pattern is what's reusable.\n\n## The argument in brief\n\nState the argument once, plainly, in a paragraph. The remainder of the introduction can elaborate, but the reader should leave this section knowing the claim before the evidence arrives.\n\n## How citations work in this template\n\nInline citations use a Pandoc-style sugar: `[@key]` for a bare cite, `[@key]{page=42}` for a page locator, `[@a; @b]` for a multi-cite cluster, and `[@key]{suppress-author}` when the author is named in the running prose (\"Darwin (1859) showed…\"). The `key` is the BibTeX cite key in `collections/bibliography/refs.bib` — every `@entry{key, ...}` becomes one record the cites can reach. Pick a citation style by setting `book.citationStyle:` in `document.yml`; the same nine styles citestyle ships are wired in (Chicago author-date, APA, MLA, IEEE, Vancouver, Harvard, AMA, Nature, Science). Change one line and every cite plus the back-matter list re-formats to match.\n\n## The chapters ahead\n\nA monograph rewards readers who know the road map. Sketch each chapter in two or three sentences — what it does and why it has to be there.\n",
|
|
51
62
|
"content/03-chapter-one.md": "---\ntype: Chapter\ntitle: \"Variation and Its Discontents\"\n---\n\nThe first decade after the *Origin* unsettled the relations between three audiences for natural history — gentleman-naturalists in correspondence, Continental experimentalists working with quantitative methods, and the lay public reached by trade publishers. Each read the new mechanism through prior commitments. The geological gradualism that Darwin (1859) inherited from Lyell — laid out a generation earlier in the *Principles of Geology* [@lyell1830] — gave him a vocabulary of slow, cumulative change that the British reading public was already prepared to accept [@darwin1859]{suppress-author}. The independent paper Wallace had sent from Ternate the year before [@wallace1858] proposed the same mechanism in compatible terms; the joint reading at the Linnean Society in 1858 made the priority public without making either author the popular face of the idea.\n\n## Two readings of the mechanism\n\nTwo strands of reception ran through the 1860s. The first, exemplified by Huxley's polemical defense [@huxley1863], used the new framework to argue continuity between humans and other primates. The second, advanced most systematically in Spencer's *Principles* [@spencer1864], read selection as a special case of a more general law of progress that Spencer thought already operated in non-biological domains. The two strands diverged on what the mechanism was a mechanism *of*: in Huxley's reading it was a tool for reorganizing the boundary between the human and the animal; in Spencer's, it was confirmation of a metaphysics he had already published.\n\n## The variation problem\n\nSelection acts on heritable variation. Where the variation comes from, in what proportion, and whether it has any direction the organism contributes to — these were open questions in the 1860s that the *Origin* did not answer. Mendel's experiments on hybridization [@mendel1866]{page=12}, published in an obscure proceedings in Brünn the same decade, addressed the question of what was inherited at the level of single traits. The paper sat unread by the principals — Darwin, Wallace, Hooker, Huxley — for three and a half decades [@mendel1866]{suppress-author}. When it was rediscovered around 1900, it slotted into the variation problem in a way the Victorian generation could not have arranged for it to.\n\n### A note on sources\n\nFor the geographical-distribution side of the argument, Wallace's *Malay Archipelago* [@wallace1869]{page=78} remains the best-known synthesis. Hooker's flora-of-Australia essay [@hooker1859]{page=ii} predates the *Origin* by a few months and reads, in retrospect, as one of the cleanest pre-publication endorsements of the mechanism — Hooker had seen the manuscript. Darwin's later *Descent* [@darwin1871] makes the case for selection's reach into human evolution that Huxley had been making polemically since 1863 [@huxley1863]{page=125}.\n\n## The argument's afterlife\n\nBy the end of the 1870s, three of the period's central works — the *Origin*, the *Descent*, and Wallace's geographical essays — had crossed into the popular canon [@darwin1859; @darwin1871; @wallace1869]. The mechanism had found audiences the authors had not written for. The next chapter takes up the question of what those audiences read into it.\n",
|
|
52
63
|
"content/99-bibliography.md": "---\ntype: Bibliography\ntitle: References\ndata: bibliography\n---\n",
|
|
53
|
-
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.
|
|
64
|
+
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.3.0'\nformat: pdf\n\nbook:\n title: \"{{title}}\"\n subtitle: \"\"\n author: \"{{author}}\"\n language: en\n rights: \"© {{year}} {{author}}.\"\n trim: royal-octavo\n typography:\n bodySize: 10.5pt\n leading: 0.68em\n firstLineIndent: 1.2em\n bodyFont: [\"EB Garamond\", \"Garamond\", \"Georgia\"]\n headingFont: [\"EB Garamond\", \"Garamond\", \"Georgia\"]\n structure:\n titlePage: true\n copyrightPage: true\n toc: true\n tocDepth: 3\n frontMatterNumbering: roman\n # Citation style for inline cites and the back-matter bibliography.\n # Pick from: chicago-author-date (default — the scholarly humanities\n # convention), apa, mla, harvard, ieee, vancouver, ama, nature, science.\n # Switch the document's whole bibliographic apparatus by changing one\n # value here; nothing else in the project needs editing.\n citationStyle: chicago-author-date\n bibliography:\n sortBy: author\n\n# Bibliographic records the inline `[@key]` cites and the back-matter\n# Bibliography section read from. Drop a `.bib` file into\n# `collections/bibliography/` — every `@entry{key, ...}` becomes one\n# record, with the BibTeX cite key used as the lookup id. YAML and JSON\n# files in the same directory are merged in (handy for one-off entries\n# you want to maintain by hand alongside an exported `.bib`).\ncollections:\n bibliography:\n path: collections/bibliography\n\ncontent:\n - 01-preface\n - 02-introduction\n - 03-chapter-one\n - 99-bibliography\n",
|
|
54
65
|
},
|
|
55
66
|
"report": {
|
|
56
67
|
"README.md": "# `report` template\n\nA technical report: trade-7x10 trim, block paragraphs (no first-line indent), tables and code listings styled for clarity, code-block margin relief so wide content doesn't wrap awkwardly. Same `@uniweb/book` foundation as the `book` and `monograph` templates — configured for technical writing.\n\n```bash\nunipress compile . --format pdf --out my-report.pdf\nunipress compile . --format pagedjs --out my-report.html\n```\n\n## What's here\n\n```\nreport/\n├── document.yml pinned to @uniweb/book; trade-7x10, block paragraphs\n├── content/\n│ ├── 01-summary.md executive summary + recommendations table\n│ ├── 02-findings.md body, with code listing and pull-quote\n│ └── 03-methodology.md\n└── README.md this file\n```\n\n## When to pick `report` over `book` or `monograph`\n\n- The reader expects a summary up top and methodology at the bottom.\n- The body has tables, code, configuration snippets, or numbered findings.\n- Block paragraphs (no indent) read better than first-line-indented prose for the content.\n- A wider page (trade-7x10) gives long code lines and wide tables more room.\n\nFor prose-driven content, pick `book` (trade-6x9) or `monograph` (royal-octavo, classical typography).\n\n## Adding citations\n\nReports often cite — primary sources backing findings, prior work in methodology, regulatory references in compliance reports. The same `@uniweb/book` foundation supports inline cites and a back-matter bibliography; this template ships them commented out so a report that doesn't need them isn't carrying empty scaffolding. To opt in:\n\n1. Uncomment the `citationStyle:` block under `book:` and the `collections:` block at the bottom of `document.yml`.\n2. Create `collections/bibliography/` and drop a `.bib` file in (each `@entry{key, ...}` becomes one record; the cite key is what you reference with `[@key]`). Hand-written YAML in CSL-JSON shape works alongside it if you'd rather edit entries directly.\n3. Cite in prose: `[@smith2024]`, `[@smith2024]{page=12}` for a locator, `[@a; @b]` for a multi-cite cluster, `[@key]{suppress-author}` when the author is named in the running prose.\n4. Add a back-matter content file (e.g. `99-bibliography.md`) with `type: Bibliography` and `data: bibliography` in frontmatter.\n\nPick a citation style by setting `book.citationStyle:` to one of `chicago-author-date`, `apa`, `mla`, `harvard`, `ieee`, `vancouver`, `ama`, `nature`, `science`. For numbered styles (IEEE, Vancouver, Nature, etc.), the back-matter list reuses the same numbering as the inline cites — `[1]` inline matches `[1]` in the back-matter.\n\nThe `monograph` template ships with this turned on as a worked example — `unipress create my-mono --template monograph` to see it, including a Victorian-naturalist bibliography that exercises every cite shape.\n\n## Customize\n\nEdit `document.yml`:\n\n- `book.trim:` — `trade-7x10` (default), `trade-6x9`, `crown-octavo`, `royal-octavo`, `a5`.\n- `book.typography.codeMarginRelief:` — `0pt` to disable; `0.25in` (default) lets code blocks extend past the body column.\n- `book.typography.firstLineIndent:` — `0pt` (default for reports) for block paragraphs; `1.25em` for prose-style indented paragraphs.\n- `book.structure.copyrightPage:` — `false` (default for reports) to drop the copyright spread.\n- `book.citationStyle:` — one of nine supported styles; pairs with the `collections.bibliography` block above.\n",
|
|
57
68
|
"content/01-summary.md": "---\ntype: BackMatter\ntitle: Executive Summary\n---\n\n# Executive Summary\n\nA technical report opens with a summary because most readers will read no further. State the question, the headline answer, and the practical implications in three or four short paragraphs. Save the methodology, caveats, and full evidence for the body.\n\nThis template is configured for technical writing rather than narrative prose: a wider trade-7x10 trim, no first-line paragraph indent (block paragraphs read better with technical content), and a code-block margin relief that lets long code lines and wide tables push past the body column.\n\n## Headline result\n\nLead with the single most important finding. One sentence, plain language. The reader who stops here should still leave with the one thing you most want them to know.\n\n## Recommendations\n\n| # | Recommendation | Owner | Timeline |\n|---|----------------|-------|----------|\n| 1 | First action item, stated as an imperative. | Team A | Q3 |\n| 2 | Second action item. | Team B | Q4 |\n| 3 | Third — typically a measurement or follow-up. | Team A | Q4 |\n\nTables work in both PDF and EPUB output. The Paged.js stylesheet keeps rows together so a table doesn't break across pages mid-row.\n",
|
|
58
69
|
"content/02-findings.md": "# Findings\n\nThe body of the report. Replace this content with the substance of what you measured, observed, or analyzed. Each subsection is one finding; lead with the conclusion and follow with the evidence.\n\n## Finding one\n\nA finding is a claim plus a justification. State the claim in the heading or the first sentence; let the rest of the paragraph carry the evidence.\n\nThe numbers you cite should be reproducible. Where they came from, what time window they cover, and how you computed them should be obvious to a reader six months from now who finds the report and has lost the original spreadsheet.\n\n```js\n// A short, runnable code listing.\nconst median = (xs) =>\n xs.sort((a, b) => a - b)[Math.floor(xs.length / 2)]\n```\n\nThe `codeMarginRelief: 0.25in` setting in `document.yml` lets code blocks extend 0.25in past the body column on each side. For wide listings — long config files, full SQL queries, JSON snapshots — that extra room means lines don't wrap mid-statement.\n\n## Finding two\n\nA second finding, with its own claim and its own evidence. Keep the structure consistent across findings so the reader builds an expectation about how each section is going to be organized.\n\n> A pull-quote or block quotation can break up a long stretch of body text and signal that what follows deserves extra attention.\n\n## Finding three\n\nThe third typically points the reader toward whatever comes next — the methodology section that explains how the findings were obtained, an appendix with the raw data, or a follow-up report.\n",
|
|
59
70
|
"content/03-methodology.md": "# Methodology\n\nA reader who acts on the report's recommendations needs to know how the findings were obtained — not because they will redo the work, but because they need a sense of how confident the numbers are.\n\n## Data sources\n\nList the inputs. For each: what it is, when you collected it, who provided it, and any cleanup or filtering you applied before analysis.\n\n- Source A — origin, time window, sample size.\n- Source B — origin, time window, sample size.\n- Source C — origin, time window, sample size.\n\n## Analysis\n\nDescribe the steps from raw input to the numbers cited in the findings. A short section is fine — a paragraph per step, with code or formulas inline where they sharpen the explanation.\n\n## Limitations\n\nEvery report has limits. Naming them up front is more credible than letting a reader find them. A short list is enough — \"the sample only covers Q1–Q3, not the holiday period\" or \"we relied on self-reported timing rather than logged events\" — and it earns the reader's trust on the rest of the analysis.\n",
|
|
60
|
-
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.
|
|
71
|
+
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.3.0'\nformat: pdf\n\nbook:\n title: \"{{title}}\"\n subtitle: \"\"\n author: \"{{author}}\"\n language: en\n rights: \"© {{year}} {{author}}.\"\n trim: trade-7x10\n typography:\n bodySize: 10.5pt\n leading: 0.7em\n firstLineIndent: 0pt\n codeMarginRelief: 0.25in\n structure:\n titlePage: true\n copyrightPage: false\n toc: true\n tocDepth: 2\n frontMatterNumbering: none\n\n # Optional citation system. Reports often cite — primary sources for\n # findings, prior work in methodology, regulatory references. To opt\n # in, uncomment the two blocks below, add a `collections/bibliography/`\n # directory of YAML records, and a content file with `type: Bibliography`\n # at the back. See the `monograph` template's README for the full\n # pattern (style table, two YAML shapes, every cite spelling worked).\n #\n # citationStyle: chicago-author-date\n # bibliography:\n # sortBy: author\n\n# collections:\n# bibliography:\n# path: collections/bibliography\n\ncontent:\n - 01-summary\n - 02-findings\n - 03-methodology\n",
|
|
72
|
+
},
|
|
73
|
+
"thesis": {
|
|
74
|
+
"README.md": "# Thesis template (UofT-shaped)\n\nA starter unipress template for an academic thesis. Produces a\nPDF that meets the University of Toronto School of Graduate Studies\nformatting requirements via `latexmk` on the LaTeX path; comparable\ntypography is available on the Typst path. Theses from other\ninstitutions can switch the template by editing one value (see\n[Switching institutions](#switching-institutions) below).\n\n## Quick start\n\n```sh\nunipress create my-thesis --template thesis \\\n --title \"Your Thesis Title\" \\\n --author \"Your Name\"\n\ncd my-thesis\nunipress compile . --format latex --out my-thesis.zip\nunzip -o my-thesis.zip -d build\ncd build && latexmk -pdf main.tex\nopen main.pdf\n```\n\nThat gives you a clean PDF with a UofT title page, a stub abstract, an\nauto-generated list of figures, four chapters of placeholder\nalgorithmic-CS prose, a worked theorem and proof, a 12-entry\nbibliography, and one appendix.\n\n## What you edit, what you don't\n\nThe thesis template uses two distinct config files:\n\n**`document.yml`** holds technical configuration — output format,\nfoundation reference, citation style, structural settings. You'll\ntypically only touch the `citationStyle:` field, and only if you\nprefer something other than IEEE.\n\n**`thesis.yml`** holds your institutional / candidate metadata. This\nis where you replace four or five values that are personal to you:\n\n```yaml\ntitle: \"Your Thesis Title\"\ncandidate:\n name: \"Your Name\"\ndegree:\n level: M.Sc. # or Ph.D., M.A., M.Eng.\n field: Computer Science\ndepartment: Department of Computer Science\ninstitution: University of Toronto\nyear: 2026\n```\n\nThe `TitlePage` section type reads this and renders the canonical\nUofT-styled title page. You shouldn't need to edit `00-titlepage.md`\nitself — the section just declares its type and the foundation does\nthe rest.\n\n## Authoring chapters\n\nEach chapter is one Markdown file under `content/`. Files are emitted\nin alphabetical order by filename, so the `NN-` prefix gates the\nsequence. `00-` / `01-` / `02-` are conventionally front-matter,\n`10-`–`19-` are body chapters, `90-` is references / bibliography,\n`99-` is appendices.\n\nA chapter file looks like:\n\n```markdown\n---\ntype: Chapter\ntitle: \"Introduction\"\nid: sec-intro\n---\n\nThe introduction begins here. Cite earlier work like\n[@christofides1976] or with a locator [@cormen2009]{page=87}.\n\n## A subsection {#sec-method}\n\nReference the section with [#sec-method] later in the chapter.\n\nA figure with cross-reference:\n\n{#fig-1 caption=\"The diagram caption.\"}\n\nIn a later chapter, [#fig-1] resolves to \"Fig. 1\" or \"Figure 1\"\ndepending on the citation/xref preset.\n```\n\nThe frontmatter `id:` on a chapter sets the cross-reference label for\nthe chapter as a whole — `[#sec-intro]` resolves to the chapter\nnumber. Subsections get their own ids via `{#sec-id}` after the\nheading.\n\n## Theorems, lemmas, definitions, proofs\n\nThe foundation ships dedicated section types for math-style content:\n\n```markdown\n---\ntype: Theorem\nid: thm-main\nname: \"Main Result\"\n---\n\nThe body of the theorem statement.\n```\n\n```markdown\n---\ntype: Proof\n---\n\nThe body of the proof.\n```\n\nTheorem, Lemma, and Definition are numbered per chapter (\"Theorem\n4.1, Lemma 4.2\"). Lemma shares Theorem's counter so a Theorem\nfollowed by a Lemma in the same chapter numbers consecutively.\nDefinition has its own counter. Proof is unnumbered.\n\nCross-reference a labelled theorem from anywhere in the document with\n`[#thm-main]` — resolves to \"Theorem 4.1\" automatically via biblatex\nhyperref's `\\autoref`.\n\n## Switching citation style\n\n```yaml\n# document.yml\nbook:\n citationStyle: chicago-author-date # or apa, mla, harvard, ieee, vancouver, ama, nature, science\n```\n\nNine styles are available. The setting drives both the inline `[@key]`\ncite formatting and the back-matter `\\printbibliography` rendering.\nbiblatex picks up the change on next compile; biber is invoked\nautomatically by `latexmk`.\n\n## Switching institutions\n\nThe default template targets the UofT SGS formatting requirements\nvia the community-maintained `ut-thesis.cls` on CTAN. Other\ninstitutions usually publish their own LaTeX class. To switch:\n\n1. **Drop the institutional class file into the project**. If your\n institution publishes a `.cls` file (e.g. `mit-thesis.cls`), put\n it in `assets/` and the foundation will bundle it.\n2. **Or rely on `tlmgr install`** if your institution's class is on\n CTAN — most major research universities have one.\n3. **Comment out `book.kind: thesis-uoft`** in `document.yml` to fall\n back to the foundation's generic book template, then add a custom\n preamble to override `\\documentclass` to your institution's class.\n\nFuture versions of the foundation may ship parameterised\n`book.kind: 'thesis-mit'` / `'thesis-stanford'` etc. as the\necosystem matures. Open an issue if you want yours added.\n\n## ProQuest submission\n\nThe thesis-uoft template enables PDF/A-1b output for ProQuest\narchival via the `pdfx` package. Confirm your generated PDF is\nPDF/A-compliant before submission — Adobe Acrobat's\n\"Preflight → PDF/A → Verify Compliance\" or the open-source\n[veraPDF](https://verapdf.org/) tool both work.\n\nUofT's specific submission flow is covered at\nhttps://www.sgs.utoronto.ca/current-students/program-completion/\n— the thesis template aims to produce output that meets the\nformatting requirements there but cannot guarantee anti-drift; SGS\noccasionally updates margin / spacing rules. Re-validate against\ntheir current page before final submission.\n\n## What's NOT covered yet\n\nA few thesis features that authors sometimes want haven't been\nshipped as first-class section types yet:\n\n- **Glossary / list of abbreviations / list of symbols** — useful in\n long theses; for now, build via `BackMatter` sections.\n- **Custom theorem-style declarations** (\"Conjecture\", \"Observation\",\n \"Remark\") — extend `foundation.xref.kinds` per project to add new\n named environments.\n- **Equation labels for cross-reference** (`{#eq-id}` on a math\n display) — labels are emitted in the LaTeX source; runtime\n cross-referencing with `[#eq-id]` is implemented but the math\n display must carry the id explicitly via an inline attribute that\n is being rolled out.\n\nIf you need any of these badly, see the foundation's source under\n`@uniweb/book` and extend; or open an issue.\n\n## Verifying the structure compiles\n\n```sh\nunipress compile . --format pagedjs --out my-thesis.html\nunipress compile . --format epub --out my-thesis.epub\nunipress compile . --format typst --out my-thesis.zip\nunipress compile . --format latex --out my-thesis.zip\n```\n\nAll four outputs should produce files. Open `my-thesis.html` in a\nbrowser; extract the typst zip and compile via `typst compile main.typ`;\nextract the latex zip and compile via `latexmk -pdf main.tex`. UofT\nis satisfied by either the typst PDF or the latex PDF — pick by\nyour advisor's preference.\n\nThis template was last validated against SGS formatting guidelines on\n2026-04-26.\n",
|
|
75
|
+
"collections/bibliography/arora1998.yml": "id: arora1998\ntype: article-journal\nauthor: \"Arora, Sanjeev\"\ntitle: \"Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems\"\ncontainer-title: \"Journal of the ACM\"\nvolume: 45\nissue: 5\npage: \"753-782\"\nyear: 1998\n",
|
|
76
|
+
"collections/bibliography/christofides1976.yml": "id: christofides1976\ntype: report\nauthor: \"Christofides, Nicos\"\ntitle: \"Worst-case analysis of a new heuristic for the travelling salesman problem\"\ngenre: \"Technical Report\"\nnumber: \"388\"\npublisher: \"Graduate School of Industrial Administration, Carnegie Mellon University\"\npublisher-place: Pittsburgh, PA\nyear: 1976\n",
|
|
77
|
+
"collections/bibliography/cook1971.yml": "id: cook1971\ntype: paper-conference\nauthor: \"Cook, Stephen A.\"\ntitle: \"The complexity of theorem-proving procedures\"\ncontainer-title: \"Proceedings of the Third Annual ACM Symposium on Theory of Computing (STOC)\"\npublisher: ACM\npage: \"151-158\"\nyear: 1971\n",
|
|
78
|
+
"collections/bibliography/cormen2009.yml": "id: cormen2009\ntype: book\nauthor:\n - \"Cormen, Thomas H.\"\n - \"Leiserson, Charles E.\"\n - \"Rivest, Ronald L.\"\n - \"Stein, Clifford\"\ntitle: \"Introduction to Algorithms\"\nedition: \"3rd\"\npublisher: \"MIT Press\"\npublisher-place: Cambridge, MA\nyear: 2009\n",
|
|
79
|
+
"collections/bibliography/frieze-galbiati-maffioli1982.yml": "id: frieze-galbiati-maffioli1982\ntype: article-journal\nauthor:\n - \"Frieze, Alan M.\"\n - \"Galbiati, Giulia\"\n - \"Maffioli, Francesco\"\ntitle: \"On the worst-case performance of some algorithms for the asymmetric traveling salesman problem\"\ncontainer-title: Networks\nvolume: 12\nissue: 1\npage: \"23-39\"\nyear: 1982\n",
|
|
80
|
+
"collections/bibliography/garey-johnson1979.yml": "id: garey-johnson1979\ntype: book\nauthor:\n - \"Garey, Michael R.\"\n - \"Johnson, David S.\"\ntitle: \"Computers and Intractability: A Guide to the Theory of NP-Completeness\"\npublisher: \"W. H. Freeman\"\npublisher-place: New York\nyear: 1979\n",
|
|
81
|
+
"collections/bibliography/held-karp1970.yml": "id: held-karp1970\ntype: article-journal\nauthor:\n - \"Held, Michael\"\n - \"Karp, Richard M.\"\ntitle: \"The traveling-salesman problem and minimum spanning trees\"\ncontainer-title: \"Operations Research\"\nvolume: 18\nissue: 6\npage: \"1138-1162\"\nyear: 1970\n",
|
|
82
|
+
"collections/bibliography/karp1972.yml": "id: karp1972\ntype: chapter\nauthor: \"Karp, Richard M.\"\ntitle: \"Reducibility Among Combinatorial Problems\"\ncontainer-title: \"Complexity of Computer Computations\"\neditor:\n - \"Miller, Raymond E.\"\n - \"Thatcher, James W.\"\npublisher: Plenum Press\npublisher-place: New York\npage: \"85-103\"\nyear: 1972\n",
|
|
83
|
+
"collections/bibliography/motwani-raghavan1995.yml": "id: motwani-raghavan1995\ntype: book\nauthor:\n - \"Motwani, Rajeev\"\n - \"Raghavan, Prabhakar\"\ntitle: \"Randomized Algorithms\"\npublisher: \"Cambridge University Press\"\nyear: 1995\n",
|
|
84
|
+
"collections/bibliography/svensson-tarnawski-vegh2018.yml": "id: svensson-tarnawski-vegh2018\ntype: paper-conference\nauthor:\n - \"Svensson, Ola\"\n - \"Tarnawski, Jakub\"\n - \"Végh, László A.\"\ntitle: \"A constant-factor approximation algorithm for the asymmetric traveling salesman problem\"\ncontainer-title: \"Proceedings of the 50th Annual ACM Symposium on Theory of Computing (STOC)\"\npublisher: ACM\npage: \"204-213\"\nyear: 2018\n",
|
|
85
|
+
"collections/bibliography/turing1936.yml": "id: turing1936\ntype: article-journal\nauthor: \"Turing, Alan M.\"\ntitle: \"On Computable Numbers, with an Application to the Entscheidungsproblem\"\ncontainer-title: \"Proceedings of the London Mathematical Society\"\nvolume: \"s2-42\"\nissue: 1\npage: \"230-265\"\nyear: 1936\n",
|
|
86
|
+
"collections/bibliography/vazirani2001.yml": "id: vazirani2001\ntype: book\nauthor: \"Vazirani, Vijay V.\"\ntitle: \"Approximation Algorithms\"\npublisher: Springer\npublisher-place: Berlin\nyear: 2001\n",
|
|
87
|
+
"content/00-titlepage.md": "---\ntype: TitlePage\n---\n",
|
|
88
|
+
"content/01-abstract.md": "---\ntype: Abstract\ntitle: Abstract\n---\n\nReplace this paragraph with your abstract — UofT's School of Graduate\nStudies caps the abstract at 350 words for both M.Sc. and Ph.D.\ntheses. The abstract is a single page on which you summarise the\nproblem, the contribution, and the result. ProQuest indexes it\nverbatim for everyone who searches your work, so write it for someone\nwho hasn't read your introduction.\n\nA working draft template: state what is known, what is missing, what\nyou did, what you found, and what it means. A reader in a related\nfield should recognise the problem from the first sentence and the\ncontribution from the last.\n",
|
|
89
|
+
"content/02-acknowledgments.md": "---\ntype: BackMatter\ntitle: Acknowledgments\n---\n\nReplace with your own acknowledgments. The conventional structure for\na thesis is: supervisor and committee first, then collaborators and\nco-authors, then funding sources, then friends and family. Most\nacknowledgments sections are a single page; some are longer and that\nis fine.\n",
|
|
90
|
+
"content/03-list-of-figures.md": "---\ntype: ListOfFigures\n---\n",
|
|
91
|
+
"content/10-introduction.md": "---\ntype: Chapter\ntitle: \"Introduction\"\n---\n\nApproximation algorithms occupy a particular niche in the theory of\ncomputation: the study of polynomial-time algorithms whose output is\nprovably within a guaranteed factor of the optimal solution to a\nproblem we cannot solve exactly in polynomial time, assuming\n$\\\\text{P} \\\\neq \\\\text{NP}$. This thesis examines one such problem —\nthe asymmetric traveling salesman problem (ATSP) — and presents a new\napproximation algorithm with an improved performance guarantee.\n\n## Background {#sec-background}\n\nThe traveling salesman problem (TSP) is a foundational problem in\ncombinatorial optimisation: given a set of cities and the cost of\ntravel between every pair, find the cheapest tour that visits each\ncity exactly once and returns to the starting city. The general TSP\nis NP-hard [@karp1972; @garey-johnson1979], and the metric TSP — the\nrestricted setting where costs satisfy the triangle inequality — has\nbeen the subject of intensive algorithmic study since\n[@christofides1976], whose algorithm achieves a $3/2$-approximation\nthat resisted improvement for over four decades.\n\n## The asymmetric variant {#sec-asymmetric}\n\nThe asymmetric TSP relaxes the symmetry assumption: travel from city\n$a$ to city $b$ may cost different from travel from $b$ to $a$. This\ncaptures real-world routing problems where one-way streets, prevailing\nwinds, or directional pricing make round-trip costs asymmetric. The\nasymmetric setting is harder; for many years the best known\napproximation factor was $O(\\\\log n)$ [@frieze-galbiati-maffioli1982],\nand only recently has constant-factor approximation become available\n[@svensson-tarnawski-vegh2018].\n\n## Contribution\n\nThis thesis presents a refined analysis of a randomised rounding\nscheme for ATSP that improves the constant of approximation. The main\ntechnical contribution is described in [#sec-main-result], with\npreliminaries in [#sec-preliminaries] and concluding remarks in\n[#sec-conclusion].\n",
|
|
92
|
+
"content/11-preliminaries.md": "---\ntype: Chapter\ntitle: \"Preliminaries\"\nid: sec-preliminaries\n---\n\nThis chapter fixes notation and recalls the definitions and facts the\nmain result builds on. Readers familiar with [@cormen2009] and\n[@vazirani2001] can skim or skip.\n\n## Graph notation\n\nThroughout the thesis, $G = (V, E)$ denotes a directed graph on $n$\nvertices with non-negative edge costs $c : E \\\\to \\\\mathbb{R}_{\\\\ge 0}$.\nWe assume connectivity in both directions: there is a directed path\nfrom every vertex to every other vertex, ruling out trivially\nunsolvable instances. The asymmetric TSP asks for a Hamiltonian cycle\nof minimum total cost.\n",
|
|
93
|
+
"content/12-main-result-proof.md": "---\ntype: Proof\n---\n\nBy analysis of a randomised rounding scheme applied to the Held–Karp\nLP relaxation [@held-karp1970]. The rounding decomposes the LP\nsolution into a convex combination of cycle covers; randomly\nselecting one and patching the resulting cycle structure into a\nsingle tour yields the claimed approximation ratio. The technical\nheart of the argument is bounding the expected patching cost, which\nthe cycle-cover decomposition of [@svensson-tarnawski-vegh2018]\nallows us to do tighter than previous analyses.\n",
|
|
94
|
+
"content/12-main-result-theorem.md": "---\ntype: Theorem\nid: thm-main\nname: \"Main Result\"\n---\n\nFor every instance of the asymmetric traveling salesman problem,\nthere is a polynomial-time randomised algorithm that, with high\nprobability, returns a tour of cost at most $\\\\alpha \\\\cdot\n\\\\text{OPT}$ where $\\\\alpha$ is a constant strictly less than the\nconstant established in [@svensson-tarnawski-vegh2018].\n",
|
|
95
|
+
"content/12-main-result.md": "---\ntype: Chapter\ntitle: \"Main Result\"\nid: sec-main-result\n---\n\nThis chapter states the main theorem and gives its proof.\n\nThe proof proceeds by analysing a randomised rounding of the\nHeld–Karp linear programming relaxation [@held-karp1970], using ideas\nfrom the cycle-cover decomposition that has been the workhorse of\nATSP analyses since [@svensson-tarnawski-vegh2018].\n",
|
|
96
|
+
"content/13-conclusion.md": "---\ntype: Chapter\ntitle: \"Conclusion and Future Work\"\nid: sec-conclusion\n---\n\nWe presented a refined analysis of randomised rounding for ATSP that\nimproves the leading constant in the approximation factor. The result\nin [#sec-main-result] complements the constant-factor approximation\nof [@svensson-tarnawski-vegh2018] and the structural insights of\n[@christofides1976] for the symmetric setting.\n\nThree directions for future work suggest themselves. First, the gap\nbetween our upper bound and the integrality gap of the Held–Karp\nrelaxation [@held-karp1970] remains a constant factor; closing it\nwould yield a tight analysis. Second, the rounding scheme in\n[#sec-main-result] is randomised; derandomisation by the method of\nconditional expectations [@motwani-raghavan1995] is a natural next\nstep. Third, we have not addressed the *Euclidean* asymmetric TSP, a\ngeometric specialisation where stronger structural properties may\nadmit a PTAS in the spirit of [@arora1998].\n",
|
|
97
|
+
"content/90-references.md": "---\ntype: Bibliography\ntitle: References\ndata: bibliography\n---\n",
|
|
98
|
+
"content/99-appendix-a.md": "---\ntype: Appendix\ntitle: \"Implementation Notes\"\n---\n\nThis appendix collects implementation details that would distract from\nthe main exposition. The randomised rounding scheme described in\n[#sec-main-result] is implemented in approximately 200 lines of\nPython; the source is available at the URL given in the\nacknowledgments.\n\nReplace this content with your own appendix material. Subsequent\nappendices land as `99-appendix-b.md`, `99-appendix-c.md`, … — the\nfoundation enumerates them A / B / C automatically based on document\norder, so the filenames just need to sort in the order you want.\n",
|
|
99
|
+
"document.yml.hbs": "name: \"{{title}}\"\nfoundation: '@uniweb/book@0.3.0'\nformat: latex\n\nbook:\n # Selects the UofT-shaped LaTeX template. Requires `tlmgr install\n # ut-thesis` on your TeX install (the community-maintained UofT SGS-\n # compliant class on CTAN). Comment this out to use the generic book\n # template if you don't want the institution-specific layout —\n # everything else still works.\n kind: thesis-uoft\n title: \"{{title}}\"\n author: \"{{author}}\"\n language: en\n rights: \"© {{year}} {{author}}.\"\n # Citation style for inline cites and the back-matter bibliography.\n # Pick from: chicago-author-date (the humanities default), apa, mla,\n # harvard, ieee, vancouver, ama, nature, science. Switch the\n # document's whole bibliographic apparatus by changing this one\n # value; nothing else in the project needs editing. biblatex picks\n # up the change automatically on the next compile.\n citationStyle: ieee\n bibliography:\n sortBy: author\n\n# Bibliographic records. Drop a `.bib` file into collections/bibliography/\n# and every `@entry{key, ...}` becomes one record. YAML / JSON files in\n# the same directory are merged in.\ncollections:\n bibliography:\n path: collections/bibliography\n\n# Structured thesis metadata read by the TitlePage section type.\n# Edit these four-five values to your own thesis; the rest of the\n# title-page text is institutional boilerplate handled by the\n# foundation.\nthesis:\n title: \"{{title}}\"\n candidate:\n name: \"{{author}}\"\n degree:\n level: M.Sc. # or Ph.D., M.A., M.Eng.\n field: Computer Science\n department: Department of Computer Science\n institution: University of Toronto\n year: {{year}}\n\ncontent:\n - 00-titlepage\n - 01-abstract\n - 02-acknowledgments\n - 03-list-of-figures\n - 10-introduction\n - 11-preliminaries\n - 12-main-result\n - 12-main-result-theorem\n - 12-main-result-proof\n - 13-conclusion\n - 90-references\n - 99-appendix-a\n",
|
|
61
100
|
},
|
|
62
101
|
}
|