forked from klemengit/typst_templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.typ
More file actions
102 lines (89 loc) · 1.79 KB
/
Copy pathtemplate.typ
File metadata and controls
102 lines (89 loc) · 1.79 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
#let project(
title: none,
authors: (),
date: none,
logo_path: none,
body
) = {
// Set document metadata
if title != none {
set document(title: title)
}
if authors != () {
set document(author: authors)
}
// Page setup
set page(
paper: "a4",
margin: (x: 1.1in, y: 1in),
numbering: "1",
header: [
#grid(
columns: (2fr, 3fr),
align: (left, right),
if logo_path != none {
image(logo_path, width: 90%)
},
title
)
],
)
set par(
justify: true,
leading: 0.65em,
)
set text(
font: "new computer modern",
// font: "Latin Modern Sans 12",
size: 11pt
)
set math.equation(numbering: "(1)")
// Figure and table formatting
show figure: set figure(supplement: [Figure])
show figure.where(kind: table): set figure.caption(position: top)
// Custom reference formatting
show ref: it => {
let el = it.element
if el == none {
return it
}
if el.func() == figure {
let num = counter(figure).at(el.location())
let supplement = if el.kind == table {
[Tab.]
} else {
[Fig.]
}
link(it.target)[#supplement #numbering(el.numbering, ..num)]
}
else if el.func() == math.equation {
let num = counter(math.equation).at(el.location())
link(it.target)[Eq. #numbering(el.numbering, ..num)]
}
else {
it
}
}
set heading(numbering: "1.1")
show heading: set block(above: 1.4em, below: 0.8em)
// Title block
if title != none {
align(center)[
#text(size: 17pt, weight: "bold")[#title]
]
v(1em)
}
if authors != () {
align(center)[
#authors.join(", ")
]
v(1em)
}
if date != none {
align(center)[
#date
]
v(2em)
}
body
}