-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate.typ
150 lines (138 loc) · 2.74 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
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
#import "@preview/fontawesome:0.1.0" as fa
// 小标题的蓝色
#let cv-blue = rgb(56, 115, 192)
// 日期的灰色
#let gray = rgb(128, 128, 128)
#let en-font = "New Computer Modern"
#let cn-font = "Source Han Serif SC"
#let cn-italic-font = "KaiTi"
#let font-list = (en-font, cn-font)
#let italic-font-list = (en-font, cn-italic-font)
#let project(
name: "",
body,
font-list: font-list,
italic-font-list: italic-font-list,
) = {
// 标题
set document(title: name)
// 页边距设定
set page(
paper: "a4",
numbering: none,
margin: (top: 2cm, bottom: 2.5cm, left: 2.5cm, right: 2.5cm),
)
set text(
font: font-list,
lang: "zh",
region: "cn",
)
set par(
justify: true,
linebreaks: "optimized",
leading: 0.8em,
)
// 行间距
show par: set block(spacing: 1em)
// 段间距
show emph: it => [
#set text(font: italic-font-list)
#it
]
show heading.where(level: 1): it => block(width: 100%)[
#it
#place(dy: 0.3em, left)[#line(length: 100%, stroke: 0.7pt + cv-blue)]
]
show heading: set block(spacing: 0.2em)
// 设置标题(名字)字体
align(center)[
#block(text(weight: 400, 2.4em, name))
]
body
}
// 日期
#let date-style(y) = {
set text(fill: gray)
y
}
// 个人信息
#let info(phone: "", email: "", github: "") = {
set align(center)
grid(columns: 3, column-gutter: 5pt)[
#fa.fa-phone() #phone
][
#fa.fa-envelope() #email
][
#fa.fa-github() #github
]
}
// 教育背景
#let education(
school: [],
major: [],
degree: [],
date: [],
grade: [],
English: [],
body,
) = {
[
*#school*
#h(10pt)#major
#h(10pt)#degree
#h(1fr) #date-style(date)
#grade
#h(10pt)#English
]
body
}
#let prize(data) = {
let cells = ()
for d in data {
cells.push(strong(d.at("game", default: "")))
cells.push(strong(d.at("grade", default: "")))
cells.push(date-style(d.at("date", default: "")))
}
[
#v(-0.4em)
#table(
columns: (1fr, 1fr, auto),
inset: (x: 0pt, y: 0.4em),
stroke: none,
..cells,
)
#v(-0.4em)
]
}
// 项目经历
#let proj-exps(exps) = {
let cells = ()
for exp in exps {
cells.push(strong(exp.at("name", default: [])))
cells.push(strong(exp.at("type", default: [])))
cells.push(date-style(exp.at("date", default: [])))
cells.push(
table.cell(
colspan: 3,
[
#if "tech" in exp [
#emph(exp.tech)
#linebreak()
]
#exp.at("description", default: [])
],
),
)
}
[
#v(-0.4em)
#table(
columns: (auto, 1fr, auto),
column-gutter: 1em,
inset: (x: 0pt, y: 0.4em),
stroke: none,
..cells,
)
#v(-0.4em)
]
}