znote-data / src /books /guide.md
arsalan-anwari's picture
Sync templates from znote
16b79eb verified
|
Raw History Blame Contribute Delete
6.19 kB
# Books and newsletters templates
Three templates for long-form writing: a non-fiction book (`ilm`), a novel (`wonderous-book`) and a
one-page department newsletter (`dashing-dept-news`). A page uses one of them; check its header to see
which, and use only that template's section below.
## Templates
### Book
`ilm` 2.1.1. Use for manuals, reports and non-fiction books with chapters. Parameters of `ilm`:
- `title` (`[Your Title]`), `authors` (`"Author"`, a string or an array of strings), `date`
(`datetime.today()`), `date-format` (`"[month repr:long] [day padding:zero], [year repr:full]"`),
`abstract` (`none`): shown on the cover page.
- `cover-page` (`"use-ilm-default"`; `none` skips it, content replaces it).
- `preface` (`none`): content on its own page after the cover.
- `table-of-contents` (`outline()`; `none` disables it).
- `appendix` (`(enabled: false, title: "", heading-numbering-format: "", body: none)`).
- `bibliography` (`none`; the result of `bibliography("file.bib")`).
- `chapter-pagebreak` (`true`): each `=` heading starts a new page.
- `external-link-circle` (`true`): small circle after external links.
- `footer` (`"page-number-alternate-with-chapter"`), `paper-size` (`"a4"`), `raw-text`
(`(font: ("Iosevka", "DejaVu Sans Mono"), size: 9pt)`).
- `figure-index`, `table-index`, `listing-index` (`(enabled: false, title: "")`): lists at the end.
### Novel
`wonderous-book` 0.1.2. Use for fiction. Parameters of `book`: `title` (`[Book title]`), `author`
(`"Author"`), `paper-size` (`"iso-b5"`), `dedication` (`none`, shown on the third page),
`publishing-info` (`none`, shown at the bottom of the second page).
### Newsletter
`dashing-dept-news` 0.1.1. Use for a short newsletter with a main column and a red sidebar.
Parameters of `newsletter`: `title` (`[Newsletter title]`, printed in capitals), `edition` (`none`,
top of the sidebar), `hero-image` (`none`; a dictionary with keys `image` and `caption`),
`publication-info` (`none`, small print at the end of the main column).
These values live in the header. Write the page body below it.
## Writing a page
### Book
- `=` is a chapter: numbered `1.`, starts a new page, and its name appears in the footer next to
the page number. `==` and `===` are numbered sections (`1.1.`, `1.1.1.`).
- The cover, preface and table of contents are generated; do not write your own title or contents.
- Body text is 12pt, justified. Equations in `$ ... $` blocks are numbered `(1)`.
- Tables get thin grey lines and a small-caps header row; wrap them in `#figure(..., caption: [...])`
and use `table.header`. Long tables break across pages.
- Inline code gets a light grey box; code blocks use the monospace font set by the template.
- For an unnumbered heading use `#heading(numbering: none)[Title]`.
- Cite with `@key` only if the user has a bibliography file set in the header.
### Novel
- The template prints the title page, publishing info, dedication and a "Chapters" outline itself.
- `=` is a chapter: it starts on a right-hand (odd) page with a large bold title. Chapters are not
numbered; put the number in the title if wanted (`= Chapter One: Mondays`).
- Avoid `==` and deeper: they render like body text and still appear in the outline.
- Write plain paragraphs separated by blank lines; the template indents first lines and justifies.
- Running headers (title on odd pages, author on even pages) and page numbers are automatic.
- Use `_italics_` for thoughts or emphasis. A scene break can be a centred line:
`#align(center)[\* \* \*]`.
### Newsletter
- Everything written directly in the page goes into the main (left) column.
- `=` is a story headline, `==` a sub-heading. Headings use the template's display font.
- `#quote(block: true, attribution: [Name])[...]` becomes a large pull quote with a rule.
- `#figure(..., caption: [...])` gets a coloured backdrop and a centred `-- caption --` line.
- Links are underlined automatically.
- Short side stories go in the sidebar with `article` (see Helpers).
## Helpers
### Book
The header imports everything from `ilm`.
`blockquote`: a quotation set off in a light block with thin rules above and below.
```typ
#blockquote[
Knowledge is the life of the mind.
--- Abu Bakr
]
```
`smallcaps` and `upper`: the template's versions with wider letter spacing. Use them instead of
Typst's own; `std-smallcaps` and `std-upper` give the plain Typst versions.
```typ
The #smallcaps[Board] approved it. Read the #upper[warning] first.
```
### Novel
The header imports only `book`. There are no helpers; use plain markup.
```typ
= Mondays
Liam hated Mondays. He hated waking up to the sound of the old car outside.
He got off the bus and made his way to his locker.
#align(center)[\* \* \*]
That evening, everything changed.
```
### Newsletter
The header imports `newsletter` and `article`.
`article`: puts its content in the sidebar (white text on red). Can be written anywhere in the page;
all articles are collected in order. Start each with a `=` heading and keep it short.
```typ
#article[
= Safety first
Next Tuesday there is a lab safety training. *Attendance is mandatory.*
]
```
Main column story with a pull quote:
```typ
= The award goes to our department
We are proud to announce the award for excellence in research.
#quote(block: true, attribution: [Prof. Herzog])[
Our lab has done remarkable work this year.
]
```
## Do not
- Do not add `#set page`, `#set text`, `#set par` or font changes; the template sets them.
- Do not pick your own colours (`fill:`, `rgb(...)`, `text(fill: ...)`); the Newsletter sidebar is
already white on red.
- Do not draw your own boxes, rectangles or quote blocks: use `blockquote` (Book), `#quote(block: true)`
(Newsletter) or `article` (Newsletter sidebar).
- Do not remove or edit the template header between `// znote:template` and `// znote:end`.
- Do not use helpers from another template: `blockquote` exists only in Book, `article` only in
Newsletter.
- Book and Novel: do not write a title page, table of contents or manual `#pagebreak()` before chapters.
- Newsletter: do not put `=` page titles in the body for the newsletter name; it comes from `title`.