-
Notifications
You must be signed in to change notification settings - Fork 10
/
simplepaper.typ
173 lines (153 loc) · 3.86 KB
/
simplepaper.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#let project(
title: "",
authors: (),
abstract: none,
keywords: (),
body
) = {
let zh_shusong = ("FZShuSong-Z01", "FZShuSong-Z01S")
let zh_xiaobiansong = ("FZXiaoBiaoSong-B05", "FZXiaoBiaoSong-B05S")
let zh_kai = ("FZKai-Z03", "FZKai-Z03S")
let zh_hei = ("FZHei-B01", "FZHei-B01S")
let zh_fangsong = ("FZFangSong-Z02", "FZFangSong-Z02S")
let en_sans_serif = "Georgia"
let en_serif = "Times New Roman"
let en_typewriter = "Courier New"
let en_code = "Menlo"
// Moidfy the following to change the font.
let title-font = (en_serif, ..zh_hei)
let author-font = (en_typewriter, ..zh_fangsong)
let body-font = (en_serif, ..zh_shusong)
let heading-font = (en_serif, ..zh_xiaobiansong)
let caption-font = (en_serif, ..zh_kai)
let header-font = (en_serif, ..zh_kai)
let strong-font = (en_serif, ..zh_hei)
let emph-font = (en_serif, ..zh_kai)
let raw-font = (en_code, ..zh_hei)
set document(author: authors.map(author => author.name), title: title)
set page(numbering: "1", number-align: center, header: align(left)[
#set text(font: header-font)
#title
])
set heading(numbering: "1.1")
set text(font: body-font, lang: "zh", region: "cn")
set bibliography(style: "gb-7714-2015-numeric")
show heading: it => box(width: 100%)[
#v(0.50em)
#set text(font: heading-font)
#if it.numbering != none { counter(heading).display() }
#h(0.75em)
#it.body
]
show heading.where(
level: 1
): it => box(width: 100%)[
#v(0.5em)
#set align(center)
#set heading(numbering: "一")
#it
#v(0.75em)
]
// Title
align(center)[
#block(text(font: title-font, weight: "bold", 1.75em, title))
#v(0.5em)
]
// Display the authors list.
for i in range(calc.ceil(authors.len() / 3)) {
let end = calc.min((i + 1) * 3, authors.len())
let is-last = authors.len() == end
let slice = authors.slice(i * 3, end)
grid(
columns: slice.len() * (1fr,),
gutter: 12pt,
..slice.map(author => align(center, {
text(12pt, author.name, font: author-font)
if "organization" in author [
\ #text(author.organization, font: author-font)
]
if "email" in author [
\ #text(link("mailto:" + author.email), font: author-font)
]
}))
)
if not is-last {
v(16pt, weak: true)
}
}
v(2em, weak: true)
// Main body
set enum(indent: 2em)
set list(indent: 2em)
set figure(gap: 0.8cm)
// 定义空白段,解决首段缩进问题
let blank_par = par()[#text()[#v(0em, weak: true)];#text()[#h(0em)]]
show figure: it => [
#v(12pt)
#set text(font: caption-font)
#it
#blank_par
#v(12pt)
]
show image: it => [
#it
#blank_par
]
show list: it => [
#it
#blank_par
]
show enum: it => [
#it
#blank_par
]
show table: it => [
#set text(font: body-font)
#it
#blank_par
]
show strong: set text(font: strong-font)
show emph: set text(font: emph-font)
show ref: set text(red)
show raw.where(block: true): block.with(
width: 100%,
fill: luma(240),
inset: 10pt,
)
show raw.where(block: true): it => [
#it
#blank_par
]
show raw: set text(font: raw-font)
show link: underline
show link: set text(blue)
set par(first-line-indent: 2em, justify: true)
if abstract != none [
#v(2pt)
#h(2em) *摘要:* #abstract
#if keywords!= () [
*关键字:* #keywords.join(";")
]
#v(2pt)
]
body
}
#let problem-counter = counter("problem")
#problem-counter.step()
#let problem(body) = {
problem-counter.step()
set enum(numbering: "(1)")
block(
fill: rgb(241, 241, 255),
inset: 8pt,
radius: 2pt,
width: 100%,
)[*题目 #problem-counter.display().* #h(0.75em) #body]
}
#let solution(body) = {
set enum(numbering: "(1)")
block(
inset: 8pt,
width: 100%
)[*解答.* #h(0.75em) #body]
}