-
Notifications
You must be signed in to change notification settings - Fork 8
/
template.typ
74 lines (65 loc) · 2.11 KB
/
template.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#let problem_counter = counter("problem")
#let prob(body) = {
// let current_problem = problem_counter.step()
[== Problem #problem_counter.step() #problem_counter.display()]
block(fill:rgb(250, 255, 250),
width: 100%,
inset:8pt,
radius: 4pt,
stroke:rgb(31, 199, 31),
body)
}
// Some math operators
#let prox = [#math.op("prox")]
#let proj = [#math.op("proj")]
#let argmin = [#math.arg]+[#math.min]
// Initiate the document title, author...
#let assignment_class(title, author, course_id, professor_name, semester, due_time, body) = {
set document(title: title, author: author)
set page(
paper:"us-letter",
header: locate(
loc => if (
counter(page).at(loc).first()==1) { none }
else if (counter(page).at(loc).first()==2) { align(right,
[*#author* | *#course_id: #title* | *Problem 1*]
) }
else {
align(right,
[*#author* | *#course_id: #title* | *Problem #problem_counter.at(loc).first()*]
)
}
),
footer: locate(loc => {
let page_number = counter(page).at(loc).first()
let total_pages = counter(page).final(loc).last()
align(center)[Page #page_number of #total_pages]
}))
block(height:25%,fill:none)
align(center, text(17pt)[
*#course_id: #title*])
align(center, text(10pt)[
Due on #due_time])
align(center, [_Prof. #professor_name _, #semester, #due_time])
block(height:35%,fill:none)
align(center)[*#author*]
pagebreak(weak: false)
body
// locate(loc => {
// let i = counter(page).at(loc).first()
// if i == 1 { return }
// set text(size: script-size)
// grid(
// columns: (6em, 1fr, 6em),
// if calc.even(i) [#i],
// align(center, upper(
// if calc.odd(i) { title } else { author-string }
// )),
// if calc.odd(i) { align(right)[#i] }
// )
// })
// if student_number != none {
// align(top + left)[Student number: #student_number]
// }
// align(center)[= #title]
}