feat: revamp template API and box components
This commit is contained in:
8 files changed
+211
-130
No files matched your search
@@ -9,13 +9,13 @@ and small helpers for mathematical and German-language course material.
|
||||
Create a ready-to-edit project:
|
||||
|
||||
```sh
|
||||
typst init @preview/clean-sheets:0.2.2
|
||||
typst init @preview/clean-sheets:0.3.0
|
||||
```
|
||||
|
||||
Or import the package in an existing document:
|
||||
|
||||
```typst
|
||||
#import "@preview/clean-sheets:0.2.2": base-template, ex_box, qed
|
||||
#import "@preview/clean-sheets:0.3.0": base-template, ex_box, qed
|
||||
|
||||
#show: body => base-template(
|
||||
1,
|
||||
@@ -49,32 +49,53 @@ and `body`.
|
||||
Optional arguments:
|
||||
|
||||
- `tutor-label`: custom label beside the tutor name (`none`)
|
||||
- `sheet`: name displayed before the sheet number (`[Exercise Sheet]`)
|
||||
- `logo`: logo content, usually `image("logo.png")` (`none`)
|
||||
- `show-logo`: whether to display the provided logo (`true`)
|
||||
- `sheet-label`: name displayed before the sheet number (`[Exercise Sheet]`)
|
||||
- `logo`: logo content, usually `image("logo.png")` or similar (`none`)
|
||||
- `page-numbering`: custom page-numbering function
|
||||
- `table-header-smallcaps`: use small capitals in table headers (`false`)
|
||||
- `text-font` and `math-font`: font families with portable fallbacks
|
||||
- `show-end-message`: display the package credit (`false`)
|
||||
- `end-message`: custom credit content
|
||||
- `no-pagebreak`: whether to avoid page breaks between exercises (level 1
|
||||
headings) (`true`)
|
||||
- `show-credits`: display the package credit (`false`)
|
||||
- `credits`: custom credit content
|
||||
|
||||
### `computer-science-template`
|
||||
|
||||
A denser layout with submission and test dates, optional digit grouping, and
|
||||
decimal-comma formatting. Required arguments are `course`, `students`,
|
||||
`semester`, `university`, `institute`, and `body`.
|
||||
A denser layout with (German) submission and attestation dates, optional digit
|
||||
grouping, and decimal-comma formatting. Required arguments are `sheetnumber`,
|
||||
`course`, `students`, `semester`, `university`, `institute`, and `body`.
|
||||
|
||||
Optional arguments are `sheetnumber`, `subtitle`, `department`, `submit_until`,
|
||||
`testats_from`, `testats_until`, `group-digits`, `decimal-comma`,
|
||||
`page-numbering`, `raw-syntaxes`, `info-text`, `text-font`, `math-font`,
|
||||
`table-header-smallcaps`, and `no-pagebreak`.
|
||||
Optional arguments:
|
||||
|
||||
- `subtitle`: custom subtitle for this exercise sheet (`none`)
|
||||
- `department`: custom department name (`none`)
|
||||
- `submit-until`: a `datetime` object for the submission deadline (`none`)
|
||||
- `attestations-from`: a `datetime` object for the beginning of the attestation
|
||||
period (`none`)
|
||||
- `attestations-until`: a `datetime` object for the end of the attestation
|
||||
period (`none`)
|
||||
- `info-text`: custom text to be displayed in the very beginning of the
|
||||
document (`none`)
|
||||
- `page-numbering`: custom page-numbering function
|
||||
- `group-digits`: whether to group digits in numbers, e.g. `1 000` instead of
|
||||
`1000` (`true`)
|
||||
- `decimal-comma`: whether to use a decimal comma instead of a decimal point
|
||||
(`false`)
|
||||
- `raw-syntaxes`: a list of syntax names to be rendered as raw code blocks
|
||||
- `text-font` and `math-font`: font families with portable fallbacks
|
||||
- `table-header-smallcaps`: whether to use small capitals in table headers
|
||||
(`false`)
|
||||
- `no-pagebreak`: whether to avoid page breaks between exercises (level 1
|
||||
headings) (`false`)
|
||||
|
||||
## Components and helpers
|
||||
|
||||
- `ex_box`: exercise box with optional `heading`, `points`, `color`,
|
||||
- `exercise`: exercise box with optional `heading`, `points`, `color`,
|
||||
`stroke-color`, `text-color`, and `radius`
|
||||
- `def`, `axiom`, `satz`, `lemma`, `kor`: numbered statement boxes; each takes
|
||||
a body and the optional arguments `label` and `nobreak`
|
||||
- `definition`, `axiom`, `theorem`, `lemma`, `corollary`: numbered statement
|
||||
boxes; each takes a body and the optional arguments `label`, `nobreak`, and
|
||||
`lang`.
|
||||
There are also the aliases `satz` and `korollar` for German-language documents.
|
||||
- `Cal` and `Complement`: calligraphic and complement math helpers
|
||||
- `chevrons`: wraps comma-separated math content in angle brackets
|
||||
- `german-date-time`: formats a datetime in German
|
||||
@@ -87,10 +108,21 @@ examples.
|
||||
|
||||
## Fonts
|
||||
|
||||
The defaults use New Computer Modern, New Computer Modern Math, and DejaVu Sans
|
||||
Mono. All three are bundled with Typst, so the template renders consistently in
|
||||
the web app and on the command line. Pass `text-font` and `math-font` to either
|
||||
template if you prefer locally installed fonts such as Fira Sans and Fira Math.
|
||||
The default font stack prefers Fira Sans, Fira Math, and Fira Code, with
|
||||
fallbacks that are available in a standard Typst installation:
|
||||
|
||||
* body text: `Fira Sans`, falling back to `New Computer Modern`
|
||||
* math: `Fira Math`, falling back to `New Computer Modern Math`
|
||||
* code: `Fira Code`, falling back to `DejaVu Sans Mono`
|
||||
|
||||
The Fira fonts are available by default in the Typst web app. The local Typst
|
||||
CLI, however, only bundles a small set of fonts, including New Computer Modern,
|
||||
New Computer Modern Math, and DejaVu Sans Mono. When the Fira fonts are not
|
||||
installed locally, Typst therefore uses the respective fallback fonts.
|
||||
|
||||
You can check which fonts are available to your local Typst installation with
|
||||
`typst fonts`. If you prefer different fonts, pass `text-font` and `math-font`
|
||||
to either template.
|
||||
|
||||
## License and credits
|
||||
|
||||
|
||||
Reference in new issue
Block a user