Skip to content

Commit 6aec572

Browse files
committed
➕ Add font-awesome
1 parent 01fe973 commit 6aec572

File tree

4 files changed

+128
-27
lines changed

4 files changed

+128
-27
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
- uses: typst-community/setup-typst@v3
1920
- uses: actions/checkout@v4
2021
with:
2122
repository: chengda/popular-fonts
@@ -24,8 +25,13 @@ jobs:
2425
with:
2526
repository: StellarCN/scp_zh
2627
path: fonts/scp_zh
27-
- uses: typst-community/setup-typst@v3
28+
- uses: actions/checkout@v4
29+
with:
30+
repository: siaimes/pytorch
31+
path: fonts/pytorch
2832
- run: |
33+
sudo apt-get -y update
34+
sudo apt-get -y install fonts-font-awesome
2935
mkdir -p ~/.local/share
3036
mv fonts ~/.local/share
3137
typst compile main.typ

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ repos:
7272
- id: markdownlint-cli2
7373
additional_dependencies:
7474
- markdown-it-texmath
75+
- repo: https://github.com/Enter-tainer/typstyle
76+
rev: v0.12.14
77+
hooks:
78+
- id: typstyle
7579
- repo: https://github.com/NixOS/nixfmt
7680
rev: 8d4bd690c247004d90d8554f0b746b1231fe2436
7781
hooks:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
- [华文字体](https://github.com/chengda/popular-fonts)
3333
- [中易字体](https://github.com/StellarCN/scp_zh/tree/master/fonts)
34+
- [Times New Roman](https://github.com/siaimes/pytorch/tree/main/fonts)
35+
- [font-awesome](https://github.com/FortAwesome/Font-Awesome)
3436

3537
## Build
3638

template.typ

Lines changed: 115 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1+
#import "@preview/fontawesome:0.5.0": fa-icon
12
#let project(
23
title: "论文题目",
34
subtitle: "",
45
author: "学生姓名",
5-
id: "学生学号",
6+
student-id: "学生学号",
67
teacher: "指导教师",
78
teacher2: "实践导师",
89
college: "所在院系",
910
major: "学科专业",
1011
field: "研究方向",
1112
date: datetime.today(),
12-
english_title: "",
13-
abstract: [],
14-
// A list of index terms to display after the abstract.
15-
index-terms: (),
16-
// The article's paper size. Also affects the margins.
17-
paper-size: "us-letter",
18-
// The result of a call to the `bibliography` function or `none`.
19-
bibliography: none,
20-
// How figures are referred to from within the text.
21-
// Use "Figure" instead of "Fig." for computer-related publications.
22-
figure-supplement: [Fig.],
23-
// The paper's content.
13+
gender: "",
14+
id: "身份证号",
15+
birth-date: datetime.today(),
16+
admission-date: datetime.today(),
17+
off-work: true,
18+
doctor: true,
19+
academic: false,
20+
english-title: [English Title],
21+
abstract: [摘要],
22+
keywords: ([一], [二], [三]),
23+
english-keywords: ([one], [two], [three]),
2424
body,
2525
) = {
26+
show strong: set text(font: "SimHei", weight: "bold")
27+
show emph: set text(font: "STXingkai", style: "italic")
28+
show heading.where(level: 1): set text(font: "SimHei", weight: "bold")
29+
2630
set document(title: title + subtitle, author: author)
27-
set text(font: "SimSun", size: 10.5pt)
31+
set text(font: ("Times New Roman", "SimSun"), size: 10.5pt, lang: "zh")
2832
set enum(numbering: "1.a.i.")
29-
show strong: set text(font: "SimHei", weight: "bold")
33+
set heading(
34+
level: 1,
35+
numbering: (
36+
(..args) => (
37+
numbering("一.", ..args)
38+
)
39+
),
40+
)
3041

3142
let table_underline(s) = [
3243
#s
@@ -45,14 +56,14 @@
4556
#v(52pt)
4657
#set text(font: "SimSun", size: 22pt)
4758
#table(
48-
columns: (30%, 70%),
59+
columns: (30%, auto),
4960
rows: 35.75pt,
5061
align: (right, center),
5162
stroke: none,
5263
[论文题目], table_underline[#title],
5364
[    ], table_underline[#subtitle],
5465
[学生姓名], table_underline[#author],
55-
[学生学号], table_underline[#id],
66+
[学生学号], table_underline[#student-id],
5667
[指导教师], table_underline[#teacher],
5768
[实践导师], table_underline[#teacher2],
5869
[所在院系], table_underline[#college],
@@ -72,7 +83,8 @@
7283
align(center)[
7384
#set text(font: "SimSun", size: 22pt)
7485
#v(22pt)
75-
*说 明*
86+
#set text(font: "SimHei", size: 22pt)
87+
说 明
7688
#v(44pt)
7789
#set align(left)
7890
#set text(font: "STKaiti", size: 18pt, spacing: 18pt)
@@ -86,15 +98,92 @@
8698
]
8799
pagebreak()
88100

89-
show heading.where(level: 1): it => block(width: 100%)[
90-
#set text(weight: "bold")
91-
#smallcaps(it.body)
101+
[= 简况
102+
103+
#table(
104+
inset: 0pt,
105+
columns: (4%, auto),
106+
rows: (33pt, 33pt, 33pt, 33pt, 33pt, 33pt, 220pt, 33pt, 33pt, 33pt),
107+
align: center + horizon,
108+
table.cell(
109+
rowspan: 4,
110+
[研究生简介],
111+
),
112+
table(
113+
columns: (13%, auto, 13%, 20%, 13%, 20%),
114+
box(height: 100%, width: 100%, [姓 名]),
115+
box(height: 100%, width: 100%, author),
116+
box(height: 100%, width: 100%, [学 号]),
117+
box(height: 100%, width: 100%, student-id),
118+
box(height: 100%, width: 100%, [出生年月]),
119+
box(height: 100%, width: 100%, birth-date.display("[year]年[month]月")),
120+
),
121+
table(
122+
columns: (13%, 7%, auto, 66%),
123+
box(height: 100%, width: 100%, [性 别]),
124+
box(height: 100%, width: 100%, gender),
125+
box(height: 100%, width: 100%, [身份证号]),
126+
box(height: 100%, width: 100%, id),
127+
),
128+
table(
129+
columns: (13%, auto, 20%, 33%),
130+
box(height: 100%, width: 100%, [入学时间]),
131+
box(height: 100%, width: 100%, birth-date.display("[year]年[month]月")),
132+
box(height: 100%, width: 100%, [培养方式]),
133+
box(height: 100%, width: 100%, [#fa-icon("check-square", solid: false) 脱产 #fa-icon("square", solid: false) 不脱产]),
134+
),
135+
table(
136+
columns: (20%, auto),
137+
box(height: 100%, width: 100%, [学生类别]), box(height: 100%, width: 100%, [#fa-icon("square", solid: false) 学术硕士#h(10pt)#fa-icon("square", solid: false) 专业硕士 □ 学术博士 #fa-icon("check-square", solid: false) 专业博士]),),
138+
),
139+
table.cell(rowspan: 6, [论文内容和意义]),
140+
table.cell(
141+
rowspan: 2,
142+
table(
143+
columns: (5%, 10%, auto),
144+
rows: (50%, auto),
145+
table.cell(
146+
rowspan: 2,
147+
[题目],
148+
),
149+
[中文], box(height: 100%, width: 100%, title),
150+
[英文], box(height: 100%, width: 100%, english-title),
151+
),
152+
),
153+
table(
154+
columns: (5%, auto),
155+
[摘要], box(height: 100%, width: 100%, abstract),
156+
),
157+
table.cell(
158+
rowspan: 3,
159+
table(
160+
columns: (5%, 10%, auto),
161+
rows: (33%, 33%, auto),
162+
table.cell(
163+
rowspan: 3,
164+
[主题词],
165+
),
166+
table.cell(
167+
colspan: 2,
168+
[主题词数量不多于三个,主题词之间空一格(英文用“/ ”分隔)],
169+
),
170+
[中文], box(height: 100%, width: 100%, keywords.join([ ])),
171+
[英文], box(height: 100%, width: 100%, english-keywords.join([/])),
172+
),
173+
),
174+
)
92175
]
93-
set heading(numbering: "一.", )
94-
[= 简况]
176+
pagebreak()
95177

96-
body
178+
[= 选题依据]
179+
180+
[= 已取得的与论文研究内容相关的成果]
181+
182+
[= 研究内容和研究方法]
97183

98-
// Display bibliography.
99-
bibliography
184+
[= 课题研究的创新之处]
185+
186+
[= 研究工作进度安排]
187+
188+
body
100189
}

0 commit comments

Comments
 (0)