add types for code blocks in README
This commit is contained in:
parent
c81d8f65b2
commit
6114e7b036
1 changed files with 60 additions and 50 deletions
110
README.md
110
README.md
|
|
@ -8,85 +8,95 @@ A summary is then printed on the front page.
|
||||||
|
|
||||||
#### Using `typship`
|
#### Using `typship`
|
||||||
|
|
||||||
typship download -n local https://imsc.uni-graz.at/git/gjankowiak/typst-exam/
|
```bash
|
||||||
|
typship download -n local https://imsc.uni-graz.at/git/gjankowiak/typst-exam/
|
||||||
|
```
|
||||||
|
|
||||||
#### Manually
|
#### Manually
|
||||||
|
|
||||||
mkdir -p ~/.local/share/typst/packages/local/exam
|
```bash
|
||||||
cd ~/.local/share/typst/packages/local/exam
|
mkdir -p ~/.local/share/typst/packages/local/exam
|
||||||
curl https://imsc.uni-graz.at/git/gjankowiak/typst-exam/archive/v0.1.0.tar.gz | tar zx --xform 's/typst-exam/0.1.0/'
|
cd ~/.local/share/typst/packages/local/exam
|
||||||
|
curl https://imsc.uni-graz.at/git/gjankowiak/typst-exam/archive/v0.1.0.tar.gz | tar zx --xform 's/typst-exam/0.1.0/'
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Writing an exam is now easy (see [API](#api) for all options):
|
Writing an exam is now easy (see [API](#api) for all options):
|
||||||
|
|
||||||
#import "@local/exam:0.1.0": exam, exercise, exercise-items, mtext
|
```typ
|
||||||
|
#import "@local/exam:0.1.0": exam, exercise, exercise-items, mtext
|
||||||
|
|
||||||
#show: exam.with(
|
#show: exam.with(
|
||||||
title: "Exam",
|
title: "Exam",
|
||||||
|
|
||||||
course_title: [Abstract Binary Computation & Elegent Finite Graphs],
|
course_title: [Abstract Binary Computation & Elegent Finite Graphs],
|
||||||
|
|
||||||
institution: [Super University],
|
institution: [Super University],
|
||||||
|
|
||||||
date: "1. January 1970",
|
date: "1. January 1970",
|
||||||
course_short_title: "ABC & EFG",
|
course_short_title: "ABC & EFG",
|
||||||
|
|
||||||
course_code: "π",
|
course_code: "π",
|
||||||
duration_minutes: "90",
|
duration_minutes: "90",
|
||||||
|
|
||||||
ask_trainer_name: false,
|
ask_trainer_name: false,
|
||||||
ask_group: true,
|
ask_group: true,
|
||||||
|
|
||||||
language: "en",
|
language: "en",
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
### Defining exercises and items
|
### Defining exercises and items
|
||||||
|
|
||||||
A new exercise can be started using `#exercise("title", nb_points)`, for example:
|
A new exercise can be started using `#exercise("title", nb_points)`, for example:
|
||||||
|
|
||||||
#exercise("Relations and their properties", 2)
|
```typ
|
||||||
|
#exercise("Relations and their properties", 2)
|
||||||
Consider the relation $R subset NN^2$, defined as follows:
|
|
||||||
|
Consider the relation $R subset NN^2$, defined as follows:
|
||||||
$ (x, y) in R #h(0.5cm) <==> #h(0.5cm) x + y #mtext[is odd]. $
|
|
||||||
|
$ (x, y) in R #h(0.5cm) <==> #h(0.5cm) x + y #mtext[is odd]. $
|
||||||
Is $R$ reflexive? transitive? symmetric? antisymmetric?
|
|
||||||
|
Is $R$ reflexive? transitive? symmetric? antisymmetric?
|
||||||
|
```
|
||||||
|
|
||||||
On can also defined (sub-)items for the exercise using `#exercise-items(override_points:true, numbering:"a)", items)`,
|
On can also defined (sub-)items for the exercise using `#exercise-items(override_points:true, numbering:"a)", items)`,
|
||||||
where `items` is an array of `(nb_points, statement)`. By default, the number of points the exercise
|
where `items` is an array of `(nb_points, statement)`. By default, the number of points the exercise
|
||||||
is worth is recomputed as the sum of points for all items. This behaviour can be turned off by
|
is worth is recomputed as the sum of points for all items. This behaviour can be turned off by
|
||||||
setting `override_points: false`.
|
setting `override_points: false`.
|
||||||
|
|
||||||
#exercise("Properties of functions", 3)
|
```typ
|
||||||
|
#exercise("Properties of functions", 3)
|
||||||
Let $f : (0, +infinity) → (0, +infinity)$ with $f (x) = e^(-x)$.
|
|
||||||
|
|
||||||
#exercise-items((
|
|
||||||
(1, [Is $f$ injective?]),
|
|
||||||
(1, [Is $f$ surjective?]),
|
|
||||||
(1, [Is $f$ bijective?]),
|
|
||||||
))
|
|
||||||
|
|
||||||
#exercise("Logical operators", 3.14)
|
Let $f : (0, +infinity) → (0, +infinity)$ with $f (x) = e^(-x)$.
|
||||||
|
|
||||||
Consider the following truthtable:
|
#exercise-items((
|
||||||
|
(1, [Is $f$ injective?]),
|
||||||
|
(1, [Is $f$ surjective?]),
|
||||||
|
(1, [Is $f$ bijective?]),
|
||||||
|
))
|
||||||
|
|
||||||
#align(center, table(
|
#exercise("Logical operators", 3.14)
|
||||||
stroke: frame(0.5pt),
|
|
||||||
columns: (auto, auto, auto),
|
|
||||||
align: center,
|
|
||||||
[$A$], [$B$], [$A or B$],
|
|
||||||
[1], [1], [1],
|
|
||||||
[1], [0], [1],
|
|
||||||
[0], [1], [1],
|
|
||||||
[0], [0], [1]
|
|
||||||
))
|
|
||||||
|
|
||||||
#exercise-items(override-points: false, numbering: "i)", (
|
Consider the following truthtable:
|
||||||
(1, [Is the truthtable correct?]),
|
|
||||||
(1, [If not, fix it.]),
|
#align(center, table(
|
||||||
))
|
stroke: frame(0.5pt),
|
||||||
|
columns: (auto, auto, auto),
|
||||||
|
align: center,
|
||||||
|
[$A$], [$B$], [$A or B$],
|
||||||
|
[1], [1], [1],
|
||||||
|
[1], [0], [1],
|
||||||
|
[0], [1], [1],
|
||||||
|
[0], [0], [1]
|
||||||
|
))
|
||||||
|
|
||||||
|
#exercise-items(override-points: false, numbering: "i)", (
|
||||||
|
(1, [Is the truthtable correct?]),
|
||||||
|
(1, [If not, fix it.]),
|
||||||
|
))
|
||||||
|
```
|
||||||
|
|
||||||
All together, this should output something like:
|
All together, this should output something like:
|
||||||
|
|
||||||
|
|
@ -103,7 +113,7 @@ top and bottom lines are bold.
|
||||||
### API
|
### API
|
||||||
|
|
||||||
```typ
|
```typ
|
||||||
exam(
|
#exam(
|
||||||
title: "%KLAUSUR or EXAM%",
|
title: "%KLAUSUR or EXAM%",
|
||||||
|
|
||||||
course-title: [%COURSE_TITLE_FIRST_LINE% \ %COURSE_TITLE_SECOND_LINE%],
|
course-title: [%COURSE_TITLE_FIRST_LINE% \ %COURSE_TITLE_SECOND_LINE%],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue