-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.typ
More file actions
162 lines (145 loc) · 3.47 KB
/
template.typ
File metadata and controls
162 lines (145 loc) · 3.47 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#import "@preview/codly:1.3.0": *
#import "@preview/codly-languages:0.1.8": *
#import "@preview/itemize:0.2.0" as el
#let common(
title: "My Dissertation",
author: "<Insert name>",
proforma: [],
acknowledgements: [],
date: none,
logo: none,
college: "<Insert college>",
course: "Computer Science Tripos, Part III",
body,
) = {
set document(author: author, title: title)
set page(margin: 2cm)
set text(font: "New Computer Modern", lang: "en")
show math.equation: set text(weight: 400)
set heading(numbering: "1.1")
// set math.equation(numbering: "1.1")
set par(justify: true)
show raw: set text(font : "FiraCode Nerd Font")
show raw.where(block: true): set text(size: 6pt)
show: el.default-enum-list
show: el.config.ref
// TODO: Fix codly
// show: codly-init.with()
// codly(languages: codly-languages, number-format : none, display-name: false, zebra-fill: none)
show table.cell.where(y: 0): strong
set table(
stroke: (x, y) => if y == 0 {
(
bottom: 0.7pt + black,
)
},
align: (x, y) => (
{ center }
)
)
body
}
// The project function defines how your document looks.
// It takes your content and some metadata and formats it.
// Go ahead and customize it to your liking!
#let project(
title: "My Dissertation",
author: "<Insert name>",
proforma: [],
acknowledgements: [],
date: none,
logo: none,
college: "<Insert college>",
course: "Computer Science Tripos, Part II",
body,
) = {
body = common(title: title, author: author, proforma: proforma, acknowledgements: acknowledgements, date : date, logo : logo, college : college, course : course, body)
let chapternum = loc => {
str(query(heading.where(level: 1, numbering: "1.1").before(loc), ).len())
}
show heading: it => {
if it.level == 1 {
pagebreak()
// v(4.5em)
set text(size: 25pt)
if it.numbering == "1.1" {
"Chapter "; chapternum(it.location())
[: ]
it.body
v(-.75em)
line(length:100%)
v(-.5em)
}
else {
it
}
v(.5em)
}
else if it.level < 4 {
v(1em)
it
v(0.5em)
}
else {
it
}
}
// Title page.
// The page can contain a logo if you pass one with `logo: "logo.png"`.
set align(center)
if logo != none {
align(left, image(logo, width: 30%))
}
v(0.5fr)
text(1.1em, date)
v(1.2em, weak: true)
text(2em, weight: 700, title)
// Author information.
pad(
top: 0.7em,
strong(author)
)
// College
college
v(1fr)
par()[
Submitted in partial fulfilment of the requirements for the\
#course
]
set align(left)
// Declaration page.
heading(
outlined: false,
numbering: none,
"Declaration"
)
par()[
I, #author of #college, being a candidate for the \course, hereby declare that this report and the work described in it are my own work, unaided except as may be specified below, and that the report does not contain material that has already been used to any substantial extent for a comparable purpose. \
// #v(1em)
*Signed*: #author \
*Date*: #date
]
// Abstract page.
heading(
outlined: false,
numbering: none,
"Proforma"
)
proforma
// Acknowledgements page.
heading(
outlined: false,
numbering: none,
"Acknowledgements"
)
acknowledgements
// Table of contents.
outline(
depth: 3,
// indent: true,
target: heading
)
// Main body.
set par(justify: true)
body
}