Skip to content

Commit 177ab41

Browse files
committed
feat: add fonts
Signed-off-by: Juntong Chen <[email protected]>
1 parent c103828 commit 177ab41

File tree

13 files changed

+37
-24
lines changed

13 files changed

+37
-24
lines changed

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
![1736643710702](https://jtchen.s3.ap-northeast-1.amazonaws.com/v1/img/2025/01/11/1736643710702.png)
2020

2121
示例文档:
22+
2223
- 本科学位论文 [modern-ecnu-thesis-bachelor.pdf](https://github.com/jtchen2k/modern-ecnu-thesis/releases/latest/download/modern-ecnu-thesis-bachelor.pdf)
2324
- 硕士学位论文,学术学位 [modern-ecnu-thesis-master-academic.pdf](https://github.com/jtchen2k/modern-ecnu-thesis/releases/latest/download/modern-ecnu-thesis-master-academic.pdf)
2425
- 硕士学位论文,专业学位 [modern-ecnu-thesis-master-professional.pdf](https://github.com/jtchen2k/modern-ecnu-thesis/releases/latest/download/modern-ecnu-thesis-master-professional.pdf)
@@ -41,6 +42,8 @@ Typst 是一个基于 Rust 的现代化的排版引擎。它具备类似 Markdow
4142

4243
1. 在 VSCode 中安装 [Tinymist Typst](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) 插件。
4344
2. 按下 `Cmd / Ctrl + Shift + P` 打开命令界面,输入 `Typst: Show available Typst templates (gallery) for picking up a template` 打开 Tinymist 提供的 Template Gallery。在列表中搜索 `modern-ecnu-thesis`,点击 `` 按钮收藏,点击 `+` 来创建论文模板。
45+
46+
![1736800054020](https://jtchen.s3.ap-northeast-1.amazonaws.com/v1/img/2025/01/13/1736800054020.png)
4447
3. 用 VS Code 打开生成的目录,打开 `thesis.typ` 文件,按下 `Ctrl / Cmd + K V` 或者是点击文档顶部的 Preview 来实时预览。
4548

4649
#### 从 git 获取模板
@@ -73,9 +76,12 @@ ln -s </path/to/modern-ecnu-thesis> $DATA_DIR/typst/packages/preview/modern-ecnu
7376

7477
### 在线编辑
7578

76-
在 Typst Web App 中选择 `Start from template`,随后搜索 `modern-ecnu-thesis` 即可开始使用。
79+
[Typst Web App](https://typst.app/app/) 中选择 `Start from template`,随后搜索 `modern-ecnu-thesis` 即可开始使用。
7780

78-
为了在 Web 编辑器中正确显示字体,你需要将[这里](https://github.com/jtchen2k/modern-ecnu-thesis/tree/main/fonts)的字体文件上传到 Typst Web App。
81+
![1736800622590](https://jtchen.s3.ap-northeast-1.amazonaws.com/v1/img/2025/01/13/1736800622590.png)
82+
83+
> [!IMPORTANT]
84+
> 为了在 Web 编辑器中正确显示字体(宋体、黑体、楷体、仿宋、Times、Arial 等),你需要将[该文件夹](https://github.com/jtchen2k/modern-ecnu-thesis/tree/main/fonts)内的字体文件**全部**上传到 Typst Web App。将整个 fonts 文件夹上传到工程任意位置即可。
7985
8086
## Tips
8187

@@ -103,19 +109,18 @@ context state("total-characters").final()
103109

104110
- Typst 支持的图片格式包括 png, jpeg, gif 与 svg,不支持 pdf 与 eps。你可以使用 InkSpace 或 [pdf2svg](https://github.com/dawbarton/pdf2svg) 等工具将 pdf 转换为 svg 格式:
105111

106-
```bash
107-
pdf2svg input.pdf output.svg
108-
```
109-
112+
```bash
113+
pdf2svg input.pdf output.svg
114+
```
110115
- Typst 现在已经支持图片的浮动排版了。你可以使用 `figure``placement` 属性来控制图片位置,可以实现类似 LaTeX 的 `[htbp]` 功能:
111116

112-
```typst
113-
figure {
114-
placement: "top";
115-
caption: "image caption";
116-
...
117-
}[#image("...)] <label>
118-
```
117+
```typst
118+
figure {
119+
placement: "top";
120+
caption: "image caption";
121+
...
122+
}[#image("...)] <label>
123+
```
119124
- Typst 有一套自己的公式语法,与 LaTeX 大同小异且更加简洁。如果你已经十分熟悉 LaTeX 的语法并希望继续使用,可以引入 [MiTeX](https://github.com/mitex-rs/mitex),它将允许你在 Typst 中使用 LaTeX 数学语法。
120125
- Typst 原生兼容了 biblatex 引用格式,直接修改 ref.bib 即可。
121126

@@ -146,4 +151,4 @@ context state("total-characters").final()
146151

147152
## License
148153

149-
This project is licensed under the MIT License.
154+
This project is licensed under the MIT License.

fonts/Arial/Arial.otf

-749 KB
Binary file not shown.

fonts/Arial/Arial.ttf

359 KB
Binary file not shown.

fonts/SinoType/STHeiti.ttf

13 MB
Binary file not shown.

fonts/SinoType/STSongti-SC-Bold.ttf

2.82 MB
Binary file not shown.
12.8 MB
Binary file not shown.

layouts/doc.typ

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
fallback: false, // 字体缺失时使用 fallback,不显示豆腐块
1010
lang: "zh",
1111
fix-cjk: true,
12+
fix-cjk-debug: false,
1213
margin: (top: 3cm, bottom: 2.5cm, left: 3.18cm, right: 3.18cm),
1314
it,
1415
) = {
@@ -36,7 +37,7 @@
3637

3738

3839
show: if fix-cjk {
39-
fix-cjk-linebreak
40+
fix-cjk-linebreak.with(debug: fix-cjk-debug)
4041
} else {
4142
it
4243
}

layouts/mainmatter.typ

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@
229229
show quote: set text(font: fonts.楷体)
230230
show quote: set pad(x: 2em)
231231

232+
set underline(stroke: 0.5pt + black, offset: 0.35em)
233+
232234
// 字数统计(正文 + 附录)
233235
// typst query main.typ '<total-words>' 2>/dev/null --field value --one
234236
context [

0 commit comments

Comments
 (0)