main
1#import "../utils/style.typ": fix-smartquote
2
3// 文稿设置,可以进行一些像页面边距这类的全局设置
4#let doc(
5 // documentclass 传入参数
6 info: (:),
7 // 其他参数
8 fallback: false, // 字体缺失时使用 fallback,不显示豆腐块
9 lang: "zh", // 语言设置
10 margin: (left: 3cm, top: 3cm, right: 2.5cm, bottom: 2.5cm), // 页面边距
11 it,
12) = {
13 // 1. 默认参数
14 info = ((title: ("基于 Typst 的", "厦门大学学位论文"), author: "张三") + info)
15
16 // 2. 对参数进行处理
17 // 2.1 如果是字符串,则使用换行符将标题分隔为列表
18 if type(info.title) == str {
19 info.title = info.title.split("\n")
20 }
21
22 // 3. 基本的样式设置
23 set text(fallback: fallback, lang: lang)
24 set page(margin: margin)
25 show: fix-smartquote
26
27 // 4. PDF 元信息
28 set document(title: (("",) + info.title).sum(), author: info.author)
29
30 it
31}