Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/preview/sheetstorm/0.3.3/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Rasmus Buurman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions packages/preview/sheetstorm/0.3.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# sheetstorm
A Typst template for university exercise sheets.

## Quick Start

### Template CLI
```sh
typst init @preview/sheetstorm
```

### Manual
```typst
#import "@preview/sheetstorm:0.3.3"

#show: sheetstorm.setup.with(
course: smallcaps[A very interesting course 101],
title: "Assignment 42",
authors: (
(name: "John Doe", id: 123456),
(name: "Erika Mustermann", id: 654321),
),

info-box-enabled: true,
)
```

## Preview
![Preview of the sheetstorm template](./thumbnail.png)

There are more [examples](./examples).

## Development
For local development, install the package to the `@local` namespace.

This is very easy with a tool like [typship](https://github.com/sjfhsjfh/typship):
```sh
typship install local
```

Then, you can use it in a Typst file:
```typst
#import "@local/sheetstorm:0.3.3"
```
18 changes: 18 additions & 0 deletions packages/preview/sheetstorm/0.3.3/examples/german.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import "@preview/sheetstorm:0.3.3" as sheetstorm: task

#set text(lang: "de")

#show: sheetstorm.setup.with(
title: "Deutsches Beispiel",
authors: "Max Mustermann",
)

#task(points: 42)[
Es ist sehr einfach, das Template für deutschsprachige Dokumente zu benutzen.
Es muss lediglich die Sprache umgestellt werden:
```typst
#set text(lang: "de")
```
]

#task(lorem(1000))
12 changes: 12 additions & 0 deletions packages/preview/sheetstorm/0.3.3/examples/minimal.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import "@preview/sheetstorm:0.3.3" as sheetstorm: task

#show: sheetstorm.setup.with(
title: "Minimal Example",
authors: "John Doe",
)

#task[
This is how the template looks with no/minimal configuration.
]

#task(lorem(1000))
31 changes: 31 additions & 0 deletions packages/preview/sheetstorm/0.3.3/examples/task-config.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#import "@preview/sheetstorm:0.3.3" as sheetstorm: task

#show: sheetstorm.setup.with(
title: "Task Configuration Example",
authors: "John Doe",
initial-task-number: 3,
)

#let my-custom-numbering-pattern(depth) = {
if depth == 1 { "i)" }
else if depth == 2 { "1." }
else { "(a)" }
}

// You can customize the task command like so:
#let task = task.with(
counter-show: false,
subtask-numbering: true,
subtask-numbering-pattern: my-custom-numbering-pattern,
)

#task(name: "Unnumbered Task")[
Now, the task numbers are disabled for the whole document.

Also, we have our custom numbering pattern enabled by default:
+ Hi
+ Hey
+ Ho
]

#task(counter-show: true)[Unless you explicitely enable the counter.]
60 changes: 60 additions & 0 deletions packages/preview/sheetstorm/0.3.3/src/header.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#import "i18n.typ"
#import "util.typ": is-some

/// Helper function that takes an array of content and puts it together as a block
#let header-section(xs) = box(
for i in xs.filter(is-some).intersperse(linebreak()) { i }
)

/// Create the contents of the header
#let header-content(
course: none,
title: none,
authors: none,
tutor: none,

date: datetime.today(),
date-format: none,

show-title-on-first-page: false,

extra-left: none,
extra-center: none,
extra-right: none,
) = {
let header = grid(
columns: (1fr, 3fr, 1fr),
align: (left, center, right),
rows: (auto, auto),
row-gutter: 0.5em,

// left
header-section((
if date != none {
context date.display(if date-format != none { date-format } else { i18n.default-date() })
},
if date-format != none { datetime.today().display(date-format) },
if tutor != none [Tutor: #tutor],
extra-left,
)),

// center
header-section((
course,
if show-title-on-first-page { title } else {
context {
let n = counter(page).get().first()
if n != 1 { title }
}
},
extra-center,
)),

// right
header-section(authors + (extra-right,)),

grid.hline(),
)

return pad(top: 0.8cm, bottom: 1cm, header)
}
14 changes: 14 additions & 0 deletions packages/preview/sheetstorm/0.3.3/src/i18n.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#let default-date() = {
if text.lang == "de" { "[day].[month].[year]" }
else { "[day] [month repr:long] [year]" }
}

#let task() = {
if text.lang == "de" { "Aufgabe" }
else { "Task" }
}

#let points() = {
if text.lang == "de" { "Punkte" }
else { "Points" }
}
3 changes: 3 additions & 0 deletions packages/preview/sheetstorm/0.3.3/src/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#import "setup.typ": setup
#import "task.typ": task
#import "widgets.typ" as widgets
19 changes: 19 additions & 0 deletions packages/preview/sheetstorm/0.3.3/src/numbering.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#let default-numbering-pattern(depth) = {
if calc.rem(depth, 3) == 1 { "1." }
else if calc.rem(depth, 3) == 2 { "a." }
else { "i." }
}

#let subtask-numbering-pattern(depth) = {
if depth == 1 { "(a)" }
else if depth > 1 and calc.rem(depth, 2) == 0 { "1." }
else { "i." }
}

#let apply-numbering-pattern(
numbering-pattern: default-numbering-pattern,
..nums,
) = {
let nums = nums.pos()
numbering(numbering-pattern(nums.len()), nums.last())
}
Loading