0%

Typst体验

Typst是一个Rust编写的基于标记的排版系统, 正在积极开发中, 截至2023.5最新版本为0.3.0.

暂时取代LaTex不太现实, 因为各报刊杂志只会提供LaTex模板; 但是排版能力比MarkDown强太多, 可读性也比LaTex好, 而且很轻量, 只需要20MB(目前)的单二进制文件便可使用, 所以很适合处理一些轻量的排版任务.

官网: https://typst.app

GitHub: https://github.com/typst/typst

文档: https://typst.app/docs/

安装

macOS/Linux

1
brew install typst

Arch Linux

1
pacman -S typst

其他平台可参考https://github.com/typst/typst#installation

命令行使用

编译

1
typst compile file.typ

监听改动自动编译

1
typst watch file.typ

查看已安装字体

1
typst fonts

与vscode配合使用

Typst LSP插件提供了typst的lsp, 支持语法高亮和补全.

示例: 制作简历

语法很简单, 看一遍文档即可上手.

效果

代码

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
#set text(
font: (
// "Source Han Serif SC", // 衬线字体, 用于打印
// "Times New Roman",
// "Songti SC",
// "STSong",
"Source Han Sans SC", // 无衬线字体, 用于显示
"Hiragino Sans GB",
"Helvetica",
),
size: 12pt,
lang: "zh",
)
#set page(
paper: "a4",
margin: (x: 1.5cm, y: 1.5cm),
footer: [
#h(1fr) #text(fill: rgb("#d9d9d9"))[powered by typst]
]
)

#set par(justify: true)

// #show heading.where(level: 2): it => text(
// weight: "medium",
// it.body,
// )

#show link: underline

#let section_line() = {
v(2pt);
line(length: 100%, stroke: 1pt + green);
v(-5pt);
}

= Alan

simpleslight\@icloud.com |
195\*\*\*\*2202 |
#link("https://github.com/suransea")[github.com/suransea] |
#link("https://shoco.top")[shoco.top]

== Summary
#section_line()

#lorem(18)

== Key Skills
#section_line()

- #lorem(7)
- #lorem(6)
- #lorem(8)
- #lorem(7)
- #lorem(6)
- #lorem(9)

== Experience
#section_line()

==== #lorem(4) #h(1fr) 2021 --

- #lorem(10)
- #lorem(18)
- #lorem(15)
- #lorem(12)
- #lorem(19)
- #lorem(13)

==== #lorem(5) #h(1fr) 2020 -- 2021

- #lorem(19)
- #lorem(15)
- #lorem(10)
- #lorem(18)
- #lorem(13)

== Education
#section_line()

#lorem(3)

#lorem(4)

2020