Skip to content

Commit 7d61990

Browse files
committed
feat: add abstract
1 parent c87de52 commit 7d61990

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

main.typ

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#import "template.typ": *
2+
3+
#show: BUPTBachelorThesis.with(
4+
title-zh: "这是一个毕业设计的中文标题",
5+
abstract-zh: [
6+
中文摘要。
7+
8+
长中文摘要长中文摘要长中文摘要长中文摘要长中文摘要长中文摘要长中文摘要长中文摘要长中文摘要。
9+
10+
中 English 混杂测试。
11+
],
12+
keywords-zh: ("北京邮电大学", "本科生", "毕业设计", "模板", "示例"),
13+
14+
title-en: "This is English Title",
15+
abstract-en: [
16+
English Abstract.
17+
18+
Long English Abstract Long English Abstract Long English Abstract Long English Abstract Long English Abstract.
19+
],
20+
keywords-en: ("BUPT", "undergraduate", "thesis", "template", "example"),
21+
)
22+
23+
= 一级标题
24+
#lorem(20)
25+
26+
== 二级标题
27+
#lorem(20)
28+
29+
=== 三级标题
30+
#lorem(20)
31+
32+
==== 四级标题
33+
#lorem(20)

template.typ

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// 三号 16pt,小三号 15pt,四号 14pt,小四号 12pt,五号 10.5pt
2+
3+
#let HeiTi = "Noto Sans CJK SC"
4+
#let SongTi = "Noto Serif CJK SC"
5+
6+
#let BUPTBachelorThesis(
7+
title-zh: "",
8+
abstract-zh: "",
9+
keywords-zh: (),
10+
11+
title-en: "",
12+
abstract-en: "",
13+
keywords-en: (),
14+
15+
bibliography-file: none,
16+
17+
body
18+
) = {
19+
set page(paper: "a4", margin: 2.5cm)
20+
21+
// Display Chinese abstract
22+
set text(font: HeiTi, weight: "bold")
23+
align(center)[
24+
#text(size: 16pt, title-zh) \ \
25+
#text(size: 15pt, tracking: 1em, "摘要") \ \
26+
]
27+
28+
set text(font: ("Times New Roman", SongTi), weight: "regular", size: 12pt)
29+
set par(first-line-indent: 2em, leading: 1.2em)
30+
show par: set block(spacing: 1.2em)
31+
abstract-zh
32+
33+
[\ \ ]
34+
text(font: HeiTi, weight: "bold", size: 12pt, "关键词")
35+
text(size: 12pt,
36+
for value in keywords-zh {
37+
box(width: 1em) + value
38+
}
39+
)
40+
pagebreak()
41+
42+
// Display English abstract
43+
set text(font: "Times New Roman", weight: "bold")
44+
align(center)[
45+
#text(size: 16pt, title-en) \ \
46+
#text(size: 15pt, "ABSTRACT") \ \
47+
]
48+
set text(font: "Times New Roman", weight: "regular", size: 12pt)
49+
abstract-en
50+
51+
[\ \ ]
52+
text(font: "Times New Roman", weight: "bold", size: 12pt, "KEY WORDS")
53+
text(size: 12pt,
54+
for value in keywords-en {
55+
box(width: 1em) + value
56+
}
57+
)
58+
pagebreak()
59+
60+
// Display contents
61+
set page(numbering: "1")
62+
counter(page).update(1)
63+
body
64+
}

0 commit comments

Comments
 (0)