Skip to content

Commit dcd0e79

Browse files
authored
adaptable-pset:0.1.0 (typst#2044)
1 parent a56ab54 commit dcd0e79

File tree

7 files changed

+291
-0
lines changed

7 files changed

+291
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# The `adaptable-pset` Package
2+
<div align="center">Version 0.1.0</div>
3+
4+
This is an easy to use template that can be used to submit school assignments and problem sets. Originally intended for math homeworks, it works great for other subjects like physics and computer science as well. Heavily inspired by [gRox167's now outdated template](https://github.com/gRox167/typst-assignment-template/tree/main), and modernized to take advantage of [showybox](https://typst.app/universe/package/showybox). I've been personally using this template for quite some time, and also shared it among friends and friends of friends to convert to Typst, so I figured it'd be good to make this template publicly available.
5+
6+
## Quick start
7+
8+
Click [here](https://typst.app/app?template=adaptable-pset&version=0.1.0) to get started, or click the "Create project in app" link on the typst universe link to get started easily with this template on the typst webapp.
9+
10+
## Showcase
11+
12+
For a more in-depth example, check out this [example pdf](https://github.com/stuxf/adaptable-pset/example.pdf):
13+
14+
### Cover Page
15+
16+
![Example cover page](https://raw.githubusercontent.com/stuxf/adaptable-pset/main/example_cover.png)
17+
18+
### Example problem
19+
20+
![Example problem](https://raw.githubusercontent.com/stuxf/adaptable-pset/main/example_problem.png)
21+
22+
## Starter code
23+
24+
You can use this to get started, or just use the quick start above for a more detailed template on the webapp
25+
26+
```typ
27+
#import "@preview/adaptable-pset:0.1.0": *
28+
29+
// Feel free to omit any of the below, just set it to "" and it won't show
30+
#let title = "HW5f"
31+
#let author = "Stephen Xu"
32+
#let collaborators = []
33+
#let course-id = "Math 172: Galois Theory"
34+
#let instructor = "Prof. Thonkers"
35+
#let semester = "Spring 2024"
36+
#let due-time = "Jun 14 at 1:00"
37+
38+
#show: homework.with(
39+
title: title,
40+
author: author,
41+
collaborators: collaborators,
42+
course-id: course-id,
43+
instructor: instructor,
44+
semester: semester,
45+
due-time: due-time,
46+
47+
// Optional setting to change the paper size depending on region
48+
// (Defaults to us-letter)
49+
// paper-size: "A4",
50+
)
51+
52+
// Numbering
53+
#set enum(numbering: "a)")
54+
55+
// Enable to get a latex-like look
56+
// #set text(font: "New Computer Modern")
57+
58+
// #prob(title: "", color: green)[content goes here]
59+
// Default color is green, can be changed to black if you want to print
60+
// Note that title is optional, it can be removed if you just don't set it to anything (just do #prob[content])
61+
62+
#prob(title: "24.3.7")[
63+
Let $alpha = sqrt(2+sqrt(2)) in CC$.
64+
1. Compute $f = min_QQ (alpha)$.
65+
2. Find $E subset.eq CC$ such that $E$ is the splitting field for $f$ over $QQ$. Compute $|E:QQ|$.
66+
3. Show that $"Gal"(E\/QQ)$ contains an element of order $4$.
67+
]
68+
69+
1. Consider $alpha^2 - sqrt(2) = 2$. Rearranging, we obtain $alpha^2 = 2 + sqrt(2)$. We thus have $alpha^4 = (2 + sqrt(2))^2 => alpha^4 - 4sqrt(2) -6 = 0$. We can rewrite $4sqrt(2)+6$ in terms of $alpha^2$, obtaining $4sqrt(2) +6 = 4alpha^2 -2$. Therefore $alpha^4 -4 alpha^2 +2$. As such we obtain a potential minimal polynomial $x^4 - 4x^2 +2$. Using Eisenstein's, we see it's irreducible and monic with $alpha$ as a root. Therefore $f = x^4-4x^2+2$.
70+
71+
2. We can find the roots as $plus.minus sqrt(2+sqrt(2)), plus.minus sqrt(2-sqrt(2))$. We note that because they share the same minimal polymial, $|E:QQ| = deg(min_QQ (alpha)) = 4$, and we have that $E = QQ(sqrt(2+sqrt(2)),sqrt(2-sqrt(2)))$.
72+
73+
3. Consider the automorphism $sigma in "Gal"(E\/QQ)$ such that $phi(alpha) = beta$, where $beta = sqrt(2-sqrt(2))$. Consider
74+
75+
$ phi(sqrt(2)) = phi(sqrt(alpha beta)) = phi(alpha^2 - 2) = phi(alpha)^2 - phi(2) = beta^2 - 2 = -sqrt(2) $
76+
77+
Using this, we see that we can use $sigma$ recursively to obtain $beta, alpha, -alpha, -beta$. We thus show that $sigma$ is an element of order $4$ in $"Gal"(E\/QQ)$. #emoji.heart
78+
79+
// Generally good to have a pagebreak between new problems
80+
#pagebreak(weak: true)
81+
```
82+
<!--
83+
<picture>
84+
<source media="(prefers-color-scheme: dark)" srcset="./thumbnail-dark.svg">
85+
<img src="./thumbnail-light.svg">
86+
</picture> -->
87+
88+
## Appendix
89+
90+
* `#problem` is just a wrapper to showybox, for more information I reccomend checking their [documentation](https://typst.app/universe/package/showybox).
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#import "@preview/showybox:2.0.2": showybox
2+
3+
#let problem_counter = counter("problem")
4+
5+
#let prob(title: "", color: green, ..body) = {
6+
[== Problem #problem_counter.step() #context {problem_counter.display()}]
7+
showybox(
8+
frame: (
9+
border-color: color.darken(10%),
10+
title-color: color.lighten(85%),
11+
body-color: color.lighten(90%)
12+
),
13+
title-style: (
14+
color: black,
15+
weight: "bold",
16+
),
17+
title: title,
18+
..body
19+
)
20+
}
21+
22+
#let homework(
23+
title: "Homework Assignment",
24+
author: "John Doe",
25+
collaborators: [],
26+
course-id: "ILY143",
27+
instructor: "Prof. Smith",
28+
semester: "Summer 1970",
29+
due-time: "Feb 29, 23:59",
30+
accent-color: rgb("#000000"),
31+
body,
32+
) = {
33+
// Document Metadata
34+
set document(title: title, author: author)
35+
36+
set page(paper: "us-letter")
37+
38+
// Cover Page (centered vert + horiz)
39+
align(center + horizon)[
40+
#strong(text(size: 24pt, fill: accent-color)[#title])
41+
42+
#text(size: 18pt)[#course-id]
43+
44+
#text(size: 18pt)[#due-time]
45+
46+
#emph(text(size: 18pt)[#instructor])
47+
48+
#v(24em)
49+
50+
#strong(text(size: 18pt)[#author])
51+
]
52+
53+
// Page Layout (incl. Header, Footer)
54+
set page(
55+
header: [
56+
#author #h(1fr) #title
57+
],
58+
footer: [
59+
#align(center)[Page #context counter(page).display() of #context counter(page).final().first()]
60+
],
61+
)
62+
63+
pagebreak()
64+
65+
// Header and Footer Info
66+
// Main content
67+
body
68+
}
69+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#import "@preview/adaptable-pset:0.1.0": *
2+
3+
// Feel free to omit any of the below, just set it to "" and it won't show
4+
#let title = "HW5f"
5+
#let author = "Stephen Xu"
6+
#let collaborators = []
7+
#let course-id = "Math 172: Galois Theory"
8+
#let instructor = "Prof. Thonkers"
9+
#let semester = "Spring 2024"
10+
#let due-time = "Jun 14 at 1:00"
11+
12+
#show: homework.with(
13+
title: title,
14+
author: author,
15+
collaborators: collaborators,
16+
course-id: course-id,
17+
instructor: instructor,
18+
semester: semester,
19+
due-time: due-time,
20+
21+
// Optional setting to change the paper size depending on region
22+
// (Defaults to us-letter)
23+
// paper-size: "A4",
24+
)
25+
26+
// Enable to get a latex-like look
27+
// #set text(font: "New Computer Modern")
28+
29+
// Set Numbering (optional)
30+
#set enum(numbering: "a)")
31+
32+
/*=================================
33+
Packages you may want to enable
34+
=================================*/
35+
36+
// #import "@preview/quick-maths:0.2.0": shorthands
37+
// #show: shorthands.with(
38+
// ($|=$, math.tack.double),
39+
// )
40+
41+
// #import "@preview/diverential:0.2.0": *
42+
// #import "@preview/physica:0.9.4": *
43+
44+
// #import "@preview/codly:1.2.0": *
45+
// #import "@preview/codly-languages:0.1.8": *
46+
// #codly(languages: codly-languages)
47+
// #show: codly-init
48+
49+
// #prob(title: "", color: green)[content goes here]
50+
// Default color is green, can be changed to black if you want to print
51+
// Note that title is optional, it can be removed if you just don't set it to anything (just do #prob[content])
52+
#prob(title: "24.3.7")[
53+
Let $alpha = sqrt(2+sqrt(2)) in CC$.
54+
1. Compute $f = min_QQ (alpha)$.
55+
2. Find $E subset.eq CC$ such that $E$ is the splitting field for $f$ over $QQ$. Compute $|E:QQ|$.
56+
3. Show that $"Gal"(E\/QQ)$ contains an element of order $4$.
57+
]
58+
59+
1. Consider $alpha^2 - sqrt(2) = 2$. Rearranging, we obtain $alpha^2 = 2 + sqrt(2)$. We thus have $alpha^4 = (2 + sqrt(2))^2 => alpha^4 - 4sqrt(2) -6 = 0$. We can rewrite $4sqrt(2)+6$ in terms of $alpha^2$, obtaining $4sqrt(2) +6 = 4alpha^2 -2$. Therefore $alpha^4 -4 alpha^2 +2$. As such we obtain a potential minimal polynomial $x^4 - 4x^2 +2$. Using Eisenstein's, we see it's irreducible and monic with $alpha$ as a root. Therefore $f = x^4-4x^2+2$.
60+
61+
2. We can find the roots as $plus.minus sqrt(2+sqrt(2)), plus.minus sqrt(2-sqrt(2))$. We note that because they share the same minimal polymial, $|E:QQ| = deg(min_QQ (alpha)) = 4$, and we have that $E = QQ(sqrt(2+sqrt(2)),sqrt(2-sqrt(2)))$.
62+
63+
3. Consider the automorphism $sigma in "Gal"(E\/QQ)$ such that $phi(alpha) = beta$, where $beta = sqrt(2-sqrt(2))$. Consider
64+
65+
$ phi(sqrt(2)) = phi(sqrt(alpha beta)) = phi(alpha^2 - 2) = phi(alpha)^2 - phi(2) = beta^2 - 2 = -sqrt(2) $
66+
67+
Using this, we see that we can use $sigma$ recursively to obtain $beta, alpha, -alpha, -beta$. We thus show that $sigma$ is an element of order $4$ in $"Gal"(E\/QQ)$. #emoji.heart
68+
69+
// Generally good to have a pagebreak between new problems
70+
#pagebreak(weak: true)
71+
72+
#prob(title:"New Problem")[
73+
Content 1 from part 1
74+
][
75+
Content 2 from part 2
76+
]
77+
78+
1. Answering question posed from part 1.
79+
80+
2. Answering question posed from part 2.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# for a description of available keys, see https://github.com/typst/packages/?tab=readme-ov-file#package-format
2+
3+
[package]
4+
name = "adaptable-pset"
5+
version = "0.1.0"
6+
entrypoint = "src/lib.typ"
7+
authors = ["Stephen Xu <https://stuxf.dev>"]
8+
license = "Unlicense"
9+
description = "A flexible problem set template, perfect for technical courses."
10+
repository = "https://github.com/stuxf/adaptable-pset"
11+
keywords = ["pset", "problem set", "assignment", "homework", "academic"]
12+
categories = ["report"]
13+
# compiler = ""
14+
exclude = [
15+
".github",
16+
"docs",
17+
"scripts",
18+
"tests",
19+
".typstignore",
20+
"Justfile",
21+
"thumbnail-dark.svg",
22+
"thumbnail-light.svg",
23+
]
24+
25+
[template]
26+
path = "template"
27+
entrypoint = "main.typ"
28+
thumbnail = "thumbnail.png"

0 commit comments

Comments
 (0)