Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 105 additions & 13 deletions export.typ
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,13 @@
// 导入并重导出所有公共符号
#import "lib/config.typ": appendix, 字体, 字号, 引用记号
#import "lib/utils.typ": chinesenumbering
#import "lib/components.typ": (
as-booktab, booktab, chineseoutline, codeblock, listoffigures,
)
#import "lib/styles.typ": (
style-config, sym-bullet, sym-square-filled, sym-square-filled-rotated,
)
#import "lib/pages.typ": (
abstract-page-en, abstract-page-zh, copyright-page, cover-page,
)
#import "lib/components.typ": as-booktab, booktab, chineseoutline, codeblock, listoffigures
#import "lib/styles.typ": style-config, sym-bullet, sym-square-filled, sym-square-filled-rotated
#import "lib/pages.typ": *

// 高级用户 API:导出内部计数器和状态,用于自定义章节编号等场景
// 注意:这些是内部实现细节,未来版本可能会有变化
#import "lib/config.typ": (
appendixcounter, chaptercounter, partcounter, skippedstate,
)
#import "lib/config.typ": appendixcounter, chaptercounter, partcounter, skippedstate

// 内部使用的模块
#import "lib/pages.typ"
Expand Down Expand Up @@ -250,7 +242,7 @@
// ========== 中文摘要 ==========
set align(left + top)
pages.abstract-page-zh(
ckeywords: ckeywords,
keywords: ckeywords,
first-line-indent: first-line-indent,
)[#cabstract]

Expand Down Expand Up @@ -359,3 +351,103 @@
pages.declaration-page(cleandeclaration: cleandeclaration)
}
}



// 致谢页
#let acknowledgements-page(first-line-indent: 2em, acknowledgements) = {
back-heading("致谢")
set par(
first-line-indent: first-line-indent,
leading: 10.5pt,
spacing: 10.5pt,
)
acknowledgements
}

// 原创性声明和授权说明页
#let declaration-page(cleandeclaration: false) = {
// Word 模板中首行缩进固定为 2em
set par(first-line-indent: 2em)
back-heading(
"北京大学学位论文原创性声明和使用授权说明",
pagebreak: true,
// Word 模板中原创性声明页有页眉,如果不想要,可以在这里手动关闭
show-header: not cleandeclaration,
)

// 放置一个占位元素,用于清除页码
if cleandeclaration {
[#[]<__clean_declaration__>]
}

align(center)[#text(
字号.四号,
weight: "bold",
show-cn-fakebold[原创性声明],
)]
v(1fr)
[
#set par(leading: 0.95em, spacing: 0.95em)
本人郑重声明:所呈交的学位论文,是本人在导师的指导下,独立进行研究工作所取得的成果。除文中已经注明引用的内容外,本论文不含任何其他个人或集体已经发表或撰写过的作品或成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。本声明的法律结果由本人承担。

#v(1fr)

#align(right)[
论文作者签名:#h(10em)
#v(1em)
#h(5em)
日期:
#h(2em)
#h(2em)
#h(2em)
]

#v(1fr)
#align(center)[#text(
字号.四号,
weight: "bold",
show-cn-fakebold[学位论文使用授权说明],
)]
// #align(center)[#text(字号.五号)[(必须装订在提交学校图书馆的印刷本)]]
#v(1fr)

#set par(leading: 0.95em, spacing: 0.95em)
本人完全了解北京大学关于收集、保存、使用学位论文的规定,即:
#[
#set list(
marker: [#grid(
columns: (auto, 1em),
circle(radius: 0.3em, fill: black, stroke: none), [],
)],
indent: 1.5em,
)
- 按照学校要求提交学位论文的印刷本和电子版本;
- 学校有权保存学位论文的印刷本和电子版,并提供目录检索与阅览服务,在校园网上提供服务;
- 学校可以采用影印、缩印、数字化或其它复制手段保存论文;
// - 因某种特殊原因须要延迟发布学位论文电子版,授权学校#box(width: 12pt, align(center, square(size: 9pt)))一年/#box(width: 12pt, align(center, square(size: 9pt)))两年/#box(width: 12pt, align(center, square(size: 9pt)))三年以后,在校园网上全文发布。
]
// #v(4em)
// #align(center)[(保密论文在解密后遵守此规定)]
#v(2fr)
#align(right)[
论文作者签名:
#h(5em)
导师签名:
#h(5em)
#v(1em)
日期:
#h(2em)
#h(2em)
#h(2em)
#h(5em)
]
#v(2fr)
]
}
11 changes: 4 additions & 7 deletions lib/components.typ
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// lib/components.typ - UI 组件
// 目录、图表列表、代码块、三线表等可复用组件

#import "config.typ": (
appendixcounter, chaptercounter, front-heading, partcounter, 字号, 引用记号,
)
#import "config.typ": appendixcounter, chaptercounter, front-heading, partcounter, 字号, 引用记号
#import "utils.typ": caption-to-text, chinesenumbering

// 中文目录
Expand Down Expand Up @@ -44,6 +42,8 @@
// Word 模板中目录中一级标题的段前间距为 6pt
if el.level == 1 {
v(6pt)
} else if el.level == 2 {
h(3em)
}

// 编号
Expand Down Expand Up @@ -73,10 +73,7 @@
let heading_counter = counter(heading).at(el_loc)
let is-appendix = appendixcounter.at(el_loc).first() >= 10
let is-first-body-chapter = (
el.level == 1
and el.numbering != none
and heading_counter == (1,)
and not is-appendix
el.level == 1 and el.numbering != none and heading_counter == (1,) and not is-appendix
)

// 页码可点击跳转
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/abstract.typ
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
v(1fr)
[关键词:]
keywords.join(",")
v(1em)
v(1fr)
}

/// 英文摘要页
Expand Down Expand Up @@ -72,5 +72,5 @@
}
[#keyword-prefix]
keywords.join(", ")
v(1em)
v(1fr)
}
15 changes: 6 additions & 9 deletions lib/styles.typ
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// 页眉页脚、heading、figure、ref 等 show/set 规则

#import "config.typ": (
appendixcounter, chaptercounter, equationcounter, footnotecounter,
imagecounter, partcounter, rawcounter, skippedstate, tablecounter, 字体, 字号,
引用记号,
appendixcounter, chaptercounter, equationcounter, footnotecounter, imagecounter, partcounter, rawcounter,
skippedstate, tablecounter, 字体, 字号, 引用记号,
)
#import "utils.typ": chinesenumbering

Expand Down Expand Up @@ -76,9 +75,7 @@

// 检查当前页面是否是正文第一页(包含第一个带编号的一级标题)
let is-body-first-page = (
current-page-heading != none
and current-page-heading.numbering != none
and part < 2
current-page-heading != none and current-page-heading.numbering != none and part < 2
)

// 封面区域无页眉(但如果当前页是前置部分第一页则显示)
Expand Down Expand Up @@ -161,8 +158,7 @@

// 当存在 <__clean_declaration__> 元素时,不显示原创性声明页的页码
if (
query(selector(heading).after(here())).len() == 0
and query(selector(<__clean_declaration__>)).len() > 0
query(selector(heading).after(here())).len() == 0 and query(selector(<__clean_declaration__>)).len() > 0
) { return }

set text(字号.页码)
Expand All @@ -175,7 +171,7 @@
#if part == 1 {
numbering("I", page-num)
} else {
str(page-num)
"第" + str(page-num) + "页"
}
// 对应 Word 模板中页脚下边距
#v(1.75cm)
Expand Down Expand Up @@ -438,6 +434,7 @@
header: make-header(cheader: cheader),
footer: make-footer(),
)
set par(first-line-indent: first-line-indent)

set text(字号.正文, font: 字体.宋体, lang: "zh")
set heading(numbering: chinesenumbering)
Expand Down