Skip to content
Merged
11 changes: 10 additions & 1 deletion specifications/bachelor/abstract-en.typ
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ Both Chinese and English should be in seperated pages.

// 摘要正文下方另起一行顶格打印“关键词”款项,后加冒号,多个关键词以逗号分隔。
// (标题“Keywords”加粗)
*Keywords:* #context abstract-en-keywords.final().join(", ")
// 使用逐元素遍历渲染,每个元素直接作为 content 输出,单独处理分隔符
*Keywords:* #context {
let kws = abstract-en-keywords.final()
for (i, kw) in kws.enumerate() {
kw
if i < kws.len() - 1 {
[, ]
}
}
}
]
}
10 changes: 7 additions & 3 deletions specifications/bachelor/lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@
// 论文信息参数处理。要求必须传递,且符合规格的参数
assert(type(thesis-info) == dictionary)
assert(type(thesis-info.title) == array or type(thesis-info.title) == str)
assert(type(thesis-info.title-en) == array
or type(thesis-info.title-en) == str
)
// 避免大面积破坏:同时允许接受 content 和 str
if type(thesis-info.title-en) == str {
thesis-info.title-en = thesis-info.title-en.split("\n")
} else if type(thesis-info.title-en) != array {
thesis-info.title-en = (thesis-info.title-en,)
}
assert(type(thesis-info.title-en) == array)
// 论文信息默认参数。函数传入参数会完全覆盖参数值,因此需要提供默认参数补充。
// 彩蛋:如果论文参数不传递作者参数,那么论文就会被署名论文模板作者
let default-author = (
Expand Down
11 changes: 10 additions & 1 deletion specifications/postgraduate/abstract-en.typ
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@

// 摘要正文下方另起一行顶格打印“关键词”款项,后加冒号,多个关键词以逗号分隔。
// (标题“Keywords”加粗)
*Keywords:* #context abstract-en-keywords.final().join(", ")
// 使用逐元素遍历渲染,每个元素直接作为 content 输出,单独处理分隔符
*Keywords:* #context {
let kws = abstract-en-keywords.final()
for (i, kw) in kws.enumerate() {
kw
if i < kws.len() - 1 {
[, ]
}
}
}
]
}
10 changes: 7 additions & 3 deletions specifications/postgraduate/lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@
// 论文信息参数处理。要求必须传递,且符合规格的参数
assert(type(thesis-info) == dictionary)
assert(type(thesis-info.title) == array or type(thesis-info.title) == str)
assert(
type(thesis-info.title-en) == array or type(thesis-info.title-en) == str,
)
// 避免大面积破坏:同时允许接受 content 和 str
if type(thesis-info.title-en) == str {
thesis-info.title-en = thesis-info.title-en.split("\n")
} else if type(thesis-info.title-en) != array {
thesis-info.title-en = (thesis-info.title-en,)
}
assert(type(thesis-info.title-en) == array)
// 论文信息默认参数。函数传入参数会完全覆盖参数值,因此需要提供默认参数补充。
// 彩蛋:如果论文参数不传递作者参数,那么论文就会被署名论文模板作者
let default-author = (
Expand Down
41 changes: 27 additions & 14 deletions template/thesis.typ
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,42 @@
// #import "@preview/modern-sysu-thesis:0.4.1": postgraduate as thesis
#import thesis: abstract, acknowledgement, appendix, contents


// 你首先应该安装 https://gitlab.com/sysu-gitlab/thesis-template/better-thesis/-/tree/main/fonts 里的所有字体,
// 如果是 Web App 上编辑,你应该手动上传这些字体文件,否则不能正常使用「楷体」和「仿宋」,导致显示错误。

// 关闭 smart quote,避免英文引号自动转换为弯引号
#set smartquote(enabled: false)

// 定义斜体函数。在正文部分,若要使得某些文字(仅限英语)以斜体效果呈现,请像下面这样的示例调用:
// #ita[Sun Yat-sen University]
// 此时,文字“Sun Yat-sen University”将以斜体效果呈现。
#let ita(body) = text(style: "italic")[#body]

// 摘要
#abstract(
[博学、审问、慎思、明辨、笃行是中山大学的校训。],
keywords: ("中山大学", "校训", "学术研究"),
)

// 英文摘要:当您使用本科论文模板时,可将此处的注释取消以写入英文摘要。
// 其中当您像这样调用 keywords 时:
// keywords: ([Sun Yat-sen #ita[University]], [School Motto], [Academic Research]),
// 实际效果为:包含三个关键词,其中“University”以斜体效果呈现。
// #abstract-en(
// [Extensive learning, careful inquiry, prudent thinking, clear discernment, and resolute practice" is the motto of Sun Yat-sen University.],
// keywords: ([Sun Yat-sen #ita[University]], [School Motto], [Academic Research]),
// )

#show: thesis.doc.with(
// 毕业论文基本信息
thesis-info: (
// 论文标题,将展示在封面、扉页与页眉上
// 多行标题请使用数组传入 `("thesis title", "with part next line")`,或使用换行符:`"thesis title\nwith part next line"`
title: ("基于 Typst 的", "中山大学学位论文模板"),
title-en: "A Typst Template for SYSU thesis",
// 当您像这样调用 title-en 时:
// title-en: ([Hello SYSU], [Sun Yat-sen #ita[University]]),
// 实际效果为:“Hello SYSU”与“Sun Yat-sen University”将分为两行显示,其中“University”以斜体效果呈现。
title-en: ([Hello SYSU], [Sun Yat-sen #ita[University]]),
// 论文作者信息:学号、姓名、院系、专业、指导老师
author: (
sno: "1xxxxxxx",
Expand Down Expand Up @@ -187,15 +212,3 @@ $ F_n = floor(1 / sqrt(5) phi.alt^n) $
#acknowledgement[
感谢 NJU-LUG,感谢 NJUThesis LaTeX 模板。
]

// 摘要
#abstract(
[博学、审问、慎思、明辨、笃行是中山大学的校训。],
keywords: ("中山大学", "校训", "学术研究"),
)

// 英文摘要:当您使用本科论文模板时,可将此处的注释取消以写入英文摘要。
// #abstract-en(
// [Extensive learning, careful inquiry, prudent thinking, clear discernment, and resolute practice" is the motto of Sun Yat-sen University.],
// keywords: ("Sun Yat-sen University", "School Motto", "Academic Research"),
// )
Loading