Skip to content

Commit 096e358

Browse files
committed
style fixes
1 parent 69d771f commit 096e358

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

lib/assignment.typ

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// [v1.0] Tim Xie, Fall 2025
2-
// Please retain attribution for future semesters, and direct any questions to xie@berkeley.edu.
3-
41
#import "utils.typ": *
52

63
#let assignment(doc,

lib/exam.typ

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// [v1.0] Tim Xie, Fall 2025
2-
// Please retain attribution for future semesters, and direct any questions to xie@berkeley.edu.
3-
41
#import "utils.typ": *
52

63
#let exam(doc,
@@ -72,8 +69,7 @@
7269

7370
// set doc
7471
set document(
75-
title: examtitle + " " + coursename + " " + semester,
76-
author: "Tim Xie"
72+
title: examtitle + " " + coursename + " " + semester
7773
)
7874

7975
box[
@@ -152,17 +148,17 @@
152148
#v(-6pt)
153149

154150
#context[
155-
You have *#length* to complete the exam. There are *#section_counter.final().at(0) questions* and *#counter(page).final().at(0) pages* on this exam, including this cover page.
151+
You have *#length* to complete the exam. There are *#section-counter.final().at(0) questions* and *#counter(page).final().at(0) pages* on this exam, including this cover page.
156152
]
157153

158154
#show table.cell: set text(size: 10pt)
159155
#context [#align(center)[
160-
#table(columns: section_counter.final().at(0) + 2,
156+
#table(columns: section-counter.final().at(0) + 2,
161157
inset: (x: 6pt, y: 4pt),
162158
fill: white,
163-
[Question], ..(range(1, section_counter.final().at(0) + 1).map(x => [#x])), [Total],
159+
[Question], ..(range(1, section-counter.final().at(0) + 1).map(x => [#x])), [Total],
164160

165-
[Points], ..(section_points.final().map(x => [#x])), [#section_points.final().sum(default: 0)]
161+
[Points], ..(section-points.final().map(x => [#x])), [#section-points.final().sum(default: 0)]
166162
)
167163
]]
168164

lib/utils.typ

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
// [v1.0] Tim Xie, Fall 2025
2-
// Please retain attribution for future semesters, and direct any questions to xie@berkeley.edu.
3-
41
#import "@preview/codly:1.3.0": *
52
#import "@preview/codly-languages:0.1.1": *
63

7-
#let section_counter = counter("sectioncounter")
8-
#let section_points = state("sectionpoints", ())
4+
#let section-counter = counter("sectioncounter")
5+
#let section-points = state("sectionpoints", ())
96

10-
#let add_points = p => {
11-
let section = section_counter.get().at(0) - 1
7+
#let add-points = p => {
8+
let section = section-counter.get().at(0) - 1
129

13-
section_points.update(it => {
10+
section-points.update(it => {
1411
for i in range(it.len(), section + 1) {
1512
it.push(0)
1613
}
@@ -108,16 +105,16 @@
108105
#let section(title, height: auto, number: true, points: false, content) = {
109106
block(height: height)[
110107
#if number == true [
111-
#section_counter.step()
108+
#section-counter.step()
112109
#context {
113-
let pts = section_points.final().at(section_counter.get().at(0) - 1, default: 0)
110+
let pts = section-points.final().at(section-counter.get().at(0) - 1, default: 0)
114111

115112
let pstr = if pts == 1 { "point" } else { "points" }
116-
add_points(0.0)
113+
add-points(0.0)
117114
if points {
118-
text(section_counter.display("1. ") + "[" + repr(pts) + " " + pstr + "] " + title, size: 14.5pt, weight: 500, tracking: -0.01em)
115+
text(section-counter.display("1. ") + "[" + repr(pts) + " " + pstr + "] " + title, size: 14.5pt, weight: 500, tracking: -0.01em)
119116
} else {
120-
text(section_counter.display("1. ") + title, size: 14.5pt, weight: 500, tracking: -0.01em)
117+
text(section-counter.display("1. ") + title, size: 14.5pt, weight: 500, tracking: -0.01em)
121118
}
122119
}
123120

@@ -173,7 +170,7 @@
173170

174171
block(width: 100%)[
175172
#if points != "" [
176-
#context add_points(points);
173+
#context add-points(points);
177174
#text("[" + repr(points) + " " + pstr + "] ", weight: 500) #text(question)
178175
] else [
179176
#question
@@ -246,7 +243,7 @@
246243

247244
block(width: 100%)[
248245
#if points != "" [
249-
#context add_points(points);
246+
#context add-points(points);
250247
#text("[" + repr(points) + " " + pstr + "] ", weight: 500) #text(question)
251248
] else [
252249
#question

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ You can draw boxes (like Latex) around answers with `#boxed(...)`.
275275
276276
> **Example**
277277
> ```typst
278-
> $ y = 1/10x ==> boxed(x = 10 y) $]
278+
> $ y = 1/10x ==> boxed(x = 10 y) $
279279
> ```
280280
> <p align="center"><img width=90% alt="Screenshot 2026-01-17 at 18 32 18" src="https://github.com/user-attachments/assets/c856cdd8-84ad-49a0-84b7-62aa07126ee5" /></p>
281281

0 commit comments

Comments
 (0)