v0.3.0, add customizable fill lightness
This commit is contained in:
parent
83a32d4fa0
commit
8668ad46e8
4 changed files with 19 additions and 13 deletions
|
|
@ -17,7 +17,7 @@ typship download -n local https://imsc.uni-graz.at/git/gjankowiak/typst-exam/
|
|||
```bash
|
||||
mkdir -p ~/.local/share/typst/packages/local/exam
|
||||
cd ~/.local/share/typst/packages/local/exam
|
||||
curl https://imsc.uni-graz.at/git/gjankowiak/typst-exam/archive/v0.2.0.tar.gz | tar zx --xform 's/typst-exam/0.2.0/'
|
||||
curl https://imsc.uni-graz.at/git/gjankowiak/typst-exam/archive/v0.3.0.tar.gz | tar zx --xform 's/typst-exam/0.3.0/'
|
||||
```
|
||||
|
||||
## Quickstart (CLI)
|
||||
|
|
@ -26,7 +26,7 @@ This will create an `exam` directory in the current directory,
|
|||
containing the example below.
|
||||
|
||||
```sh
|
||||
typst init @local/exam:0.2.0 exam
|
||||
typst init @local/exam:0.3.0 exam
|
||||
```
|
||||
|
||||
Tested typst version: `0.14.0`.
|
||||
|
|
@ -36,7 +36,7 @@ Tested typst version: `0.14.0`.
|
|||
Writing an exam is now easy (see [API](#api) for all options):
|
||||
|
||||
```typ
|
||||
#import "@local/exam:0.2.0": exam, exercise, exercise-items, mtext, horiz-only
|
||||
#import "@local/exam:0.3.0": exam, exercise, exercise-items, mtext, horiz-only
|
||||
|
||||
#show: exam.with(
|
||||
title: "Exam",
|
||||
|
|
|
|||
15
src/lib.typ
15
src/lib.typ
|
|
@ -2,8 +2,6 @@
|
|||
* Customisation
|
||||
*/
|
||||
|
||||
#let lightgray = rgb("#eeeeee")
|
||||
|
||||
// Default font (embedded in Typst)
|
||||
#let font-text = "libertinus serif"
|
||||
|
||||
|
|
@ -117,7 +115,7 @@
|
|||
}
|
||||
let exercise_label = exercise_counter.display(exercise-numbering)
|
||||
exercise_registry.update(entries => entries + ((exercise_label, title, points),))
|
||||
block(radius: 1cm, stroke: none, fill: lightgray, inset: 1pt,
|
||||
block(radius: 1cm, stroke: none, fill: luma(state("fill-luma").get()), inset: 1pt,
|
||||
table(
|
||||
columns: (auto, 1fr, auto),
|
||||
align: (left, center, right),
|
||||
|
|
@ -151,6 +149,8 @@
|
|||
|
||||
exercise-numbering: "1",
|
||||
|
||||
fill-luma: 200,
|
||||
|
||||
body
|
||||
) = {
|
||||
|
||||
|
|
@ -163,6 +163,7 @@ set page(paper: paper-size)
|
|||
set text(size: font-size, lang: language, hyphenate: true)
|
||||
|
||||
state("exercise-numbering").update(exercise-numbering)
|
||||
state("fill-luma").update(fill-luma)
|
||||
|
||||
/*
|
||||
* Localization
|
||||
|
|
@ -224,7 +225,7 @@ let exercise_overview_table() = context {
|
|||
columns.push(1fr)
|
||||
[== #get_L("points_obtained")]
|
||||
set text(size: 14pt)
|
||||
block(radius: 0.3cm, stroke: none, fill: lightgray, inset: (x:0pt, y:4pt),
|
||||
block(radius: 0.3cm, stroke: none, fill: luma(state("fill-luma").get()), inset: (x:0pt, y:4pt),
|
||||
table(
|
||||
columns: columns,
|
||||
stroke: none,
|
||||
|
|
@ -287,8 +288,9 @@ v(1fr)
|
|||
|
||||
v(0.5cm)
|
||||
|
||||
block(radius: 0.2cm, fill: lightgray, inset: 3pt, clip: true, table(
|
||||
fill: lightgray,
|
||||
context{
|
||||
block(radius: 0.2cm, fill: luma(state("fill-luma").get()), inset: 3pt, clip: true, table(
|
||||
fill: luma(state("fill-luma").get()),
|
||||
stroke: none,
|
||||
columns: (auto, 1fr),
|
||||
gutter: 3pt,
|
||||
|
|
@ -305,6 +307,7 @@ block(radius: 0.2cm, fill: lightgray, inset: 3pt, clip: true, table(
|
|||
([#get_L("group")], rect(fill: white, width: 100%, radius: 0.2cm))
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
v(0.5cm)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#import "@local/exam:0.2.0": exam, exercise, exercise-items, mtext, horiz-only
|
||||
#import "@local/exam:0.3.0": exam, exercise, exercise-items, horiz-only, mtext
|
||||
|
||||
// General configuration
|
||||
#show: exam.with(
|
||||
|
|
@ -36,6 +36,9 @@
|
|||
|
||||
// custom numbering of exercises
|
||||
// exercise-numbering: "1",
|
||||
|
||||
// custom filling lightness for headings
|
||||
// fill-luma: 150,
|
||||
)
|
||||
|
||||
// First exercise
|
||||
|
|
@ -54,8 +57,8 @@ Let $f : (0, +infinity) → (0, +infinity)$ with $f (x) = e^(-x)$.
|
|||
|
||||
// Several sub-questions
|
||||
#exercise-items((
|
||||
(1, [Is $f$ injective?]), // The first argument is the number
|
||||
// of points the item is worth
|
||||
(1, [Is $f$ injective?]), // The first argument is the number
|
||||
// of points the item is worth
|
||||
(1, [Is $f$ surjective?]),
|
||||
(2, [Is $f$ bijective?]),
|
||||
))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "exam"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
entrypoint = "src/lib.typ"
|
||||
authors = ["Gaspard Jankowiak"]
|
||||
license = "MIT"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue