Skip to content

Commit

Permalink
problemst:0.1.1 (#1618)
Browse files Browse the repository at this point in the history
  • Loading branch information
carreter authored Jan 24, 2025
1 parent a3db0ed commit 1edb2ee
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/preview/problemst/0.1.1/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Willow Carretero Chavez

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.
23 changes: 23 additions & 0 deletions packages/preview/problemst/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# problemst

Simple and easy-to-use template for problem sets/homeworks/assignments.

![Example use of the template](./thumbnail.png)

## Usage
Click "Start from template" in the Typst web app and search for `problemst`.

Alternatively, run the following command to create a directory initialized with all necessary files:

```
typst init @preview/problemst:0.1.1
```

## Configuration
The `pset` function takes the following named arguments:
- `class` (string): Class the assignment is for.
- `student` (string): Student completing the assignment.
- `title` (string): Title of the assignment.
- `date` (datetime): Date to be displayed on the assignment.
- `collaborators` (array of strings): Collaborators that worked on the assignment with the student. Can be `()`.
- `subproblems` (string): Numbering scheme for the subproblems.
78 changes: 78 additions & 0 deletions packages/preview/problemst/0.1.1/pset.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#let pset(class: "6.100",
title: "PSET 0",
student: "Alyssa P. Hacker",
date: datetime.today(),
subproblems: "1.1.a.i",
collaborators: (),
doc
) = {[
/* Convert collaborators to a string if necessary */
#let collaborators=if type(collaborators) == array {collaborators.join(", ")} else {collaborators}

/* Problem + subproblem headings */
#set heading(numbering: (..nums) => {
nums = nums.pos()
if nums.len() == 1 {
[Problem #nums.at(0):]
} else {
numbering(subproblems, ..nums)
}
})

/* Set metadata */
#set document(
title: [#class - #title],
author: student,
date: date,
)

/* Set up page numbering and continued page headers */
#set page(
numbering: "1",
header: context {
if counter(page).get().first() > 1 [
#set text(style: "italic")
#class -- #title
#h(1fr)
#student
#if collaborators != none {[w/ #collaborators]}
#block(line(length: 100%, stroke: 0.5pt), above: 0.6em)
]
})

/* Add numbering and some color to code blocks */
#show raw.where(block: true): it => {
block[
#h(1fr)
#box(
width: 100%-0.5em,
radius: 0.3em,
stroke: luma(50%),
inset: 1em,
fill: luma(98%)
)[
#show raw.line: l => context {
box(width:measure([#it.lines.last().count]).width, align(right, text(fill: luma(50%))[#l.number]))
h(0.5em)
l.body
}
#it
]
]
}

/* Make the title */
#align(center, {
text(size: 1.6em, weight: "bold")[#class -- #title \ ]
text(size: 1.2em, weight: "semibold")[#student \ ]
emph[
#date.display("[year]-[month]-[day]")
#if collaborators != none {[
\ Collaborators: #collaborators
]}
]
box(line(length: 100%, stroke: 1pt))
})
#doc
]}
34 changes: 34 additions & 0 deletions packages/preview/problemst/0.1.1/template/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#import "@preview/problemst:0.1.1": pset

#show: pset.with(
class: "6.100",
student: "Alyssa P. Hacker",
title: "PSET 0",
date: datetime.today(),
collaborators: ("Ben Bitdiddle", "Louis Reasoner")
)

#let deriv(num, dnm)=[$ (d num) / (d dnm) $]

= Definition of the derivative
Something something infinitesimals something something. We can then define the derivative as the limit of the difference quotient as $Delta x arrow 0$:
$ deriv(f(x), x)&= lim_(Delta x arrow 0) (f(x + Delta x) - f(x)) / (Delta x). $

== Code!
```go
import "fmt"
func main() {
fmt.Println("python sux!!1!")
}
```

=== Subproblem
We can nest subproblems!

==== Subsubproblem
As far as we want!

#pagebreak()

We also have a nice little header for the ensuing pages!
Binary file added packages/preview/problemst/0.1.1/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions packages/preview/problemst/0.1.1/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "problemst"
version = "0.1.1"
entrypoint = "pset.typ"
authors = ["Willow Carretero Chavez <@carreter>"]
license = "MIT"
repository = "https://github.com/carreter/problemst"
description = "Simple and easy-to-use template for problem sets/homeworks/assignments."
keywords = ["template", "homework", "problem set", "pset", "assignment"]
categories = ["report"]
compiler = "0.12.0"

[template]
path = "template"
entrypoint = "main.typ"
thumbnail = "thumbnail.png"

0 comments on commit 1edb2ee

Please sign in to comment.