commit 05ce78a4e3574a8ca78adac8e4ca01d13167263d Author: un-lock-able Date: Tue May 12 10:45:51 2026 +0800 Initial commit diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..41f2419 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,104 @@ +{ + "latex-workshop.latex.build.enableMagicComments": false, + "latex-workshop.latex.recipes": [ + { + "name": "latexmk (xelatex)", + "tools": [ + "unpack-thuthesis", + "xelatexmk" + ] + }, + { + "name": "latexmk (lualatex)", + "tools": [ + "unpack-thuthesis", + "lualatexmk" + ] + }, + { + "name": "make thesis", + "tools": [ + "make-thesis" + ] + } + ], + "latex-workshop.latex.tools": [ + { + "name": "unpack-thuthesis", + "command": "xetex", + "args": [ + "-file-line-error", + "-halt-on-error", + "-interaction=nonstopmode", + "thuthesis.ins" + ], + "env": {} + }, + { + "name": "xelatexmk", + "command": "latexmk", + "args": [ + "-xelatex", + "-file-line-error", + "-halt-on-error", + "-interaction=nonstopmode", + "-synctex=1", + "-outdir=%OUTDIR%", + "%DOC%" + ], + "env": {} + }, + { + "name": "lualatexmk", + "command": "latexmk", + "args": [ + "-lualatex", + "-file-line-error", + "-halt-on-error", + "-interaction=nonstopmode", + "-synctex=1", + "-outdir=%OUTDIR%", + "%DOC%" + ], + "env": {} + }, + { + "name": "make-thesis", + "command": "make", + "args": [], + "env": {} + } + ], + "latex-workshop.latex.watch.files.ignore": [ + "**/thuthesis.cls", + "**/*.bbx", + "**/*.bbl", + "**/*.cbx", + "**/*.cfg", + "**/*.clo", + "**/*.cnf", + "**/*.def", + "**/*.dfu", + "**/*.enc", + "**/*.fd", + "**/*.fmt", + "**/*.lbx", + "**/*.map", + "**/*.mkii", + "**/*.pfb", + "**/*.tfm", + "**/*.vf", + "**/*.code.tex", + "**/*.sty", + "**/texmf-{dist,var}/**", + "**/Local/MiKTeX/**", + "**/Local/Programs/MiKTeX/**", + "**/Roaming/MiKTeX/**", + "**/Program*/MiKTeX*/**", + "**/.miktex/texmfs/**", + "/var/cache/miktex-texmf/**", + "/usr/local/share/miktex-texmf/**", + "**/Library/Application Support/MiKTeX/texmfs/**", + "/dev/null" + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6c70298 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1152 @@ +# Changelog + +此处记载了 ThuThesis 中所有值得留意的改动,格式参照 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)。 + +点击版本号即可在 GitHub 上查看相邻版本间的代码变动。 + +## [Unreleased] + +## [v7.7.0] - 2026-05-10 + +本次模板更新包含了对教务处 2026 年 4 月更新的本科生综合论文训练写作指南([#1059](https://github.com/tuna/thuthesis/pull/1059))的适配。 + +### Added + +- 添加多个格式控制选项,并在此基础上支持苏世民学院的格式变体([#1038](https://github.com/tuna/thuthesis/pull/1038))。增加的选项包括(加粗为默认值): + - `footnote-style`: **`circled`** / `plain` + - `figure-numbering`: **`chapter`** / `global` + - `table-numbering`: **`chapter`** / `global` + - `equation-numbering`: **`chapter`** / `global` + - `footnote-numbering`: **`page`** / `chapter` / `global`(只能在 `\documentclass` 中使用) + - `style-override`: **`none`** / `schwarzman`(只能在 `\documentclass` 中使用) + +### Changed + +- `Biblatex` 的斜线不再默认使用等宽字体([#1018](https://github.com/tuna/thuthesis/discussions/1018))。 +- 使用“学科”作为 PDF 文档属性的“主题”([#1025](https://github.com/tuna/thuthesis/issues/1025))。 +- 中文著者-出版年制引用标注的括号改为全角([#1054](https://github.com/tuna/thuthesis/issues/1054))。 +- 声明页改为默认带页眉页脚([#1056](https://github.com/tuna/thuthesis/pull/1056))。 +- 著者-出版年制参考文献表的悬挂缩进改为 2 em。 + +### Deprecated + +- 外文资料的调研报告(`survey`)和书面翻译(`translation`)环境已被弃用。 + +### Fixed + +- 改进声明页的排版,与 Word 模板一致([#1011](https://github.com/tuna/thuthesis/issues/1011))。 +- 修正 LuaTeX 部分符号错误地使用西文字体([#1022](https://github.com/tuna/thuthesis/issues/1022))。 +- 修正本科生封面“联合指导教师”过窄的问题([#1017](https://github.com/tuna/thuthesis/issues/1017))。 +- 本科生的顺序编码制引用中两个连续序号之间使用逗号分割([#1027](https://github.com/tuna/thuthesis/discussions/1027))。 +- 修正了调用 `mathtools` 后 `\eqref` 与前文间距的问题([#1043](https://github.com/tuna/thuthesis/discussions/1043))。 +- 修正本科生附录的参考文献标题格式([#1058](https://github.com/tuna/thuthesis/issues/1058))。 +- 修正本科生 `biblatex` 顺序编码制参考文献表的悬挂缩进为 1cm。 +- 修正 `biblatex` 的 `\citet` 错误的上标([#1032](https://github.com/tuna/thuthesis/issues/1032))。 + +## [v7.6.0] - 2025-03-28 + +### Added + +- 同步研究生论文《写作指南》对 2025 年 3 月版本的修改: + - 非涉密论文的声明页中增加“不包含涉及国家秘密的内容”字样([#1000](https://github.com/tuna/thuthesis/issues/1000)) + - 授权页的“《中华人民共和国学位条例暂行实施办法》”更新为“《中华人民共和国学位法》”([#1003](https://github.com/tuna/thuthesis/issues/1003))。 +- 根据 2025 年 1 月教务处发布的《清华大学综合论文训练写作规范(试行)》更新本科生格式。 + - 本次格式修改幅度较大,不再一一列出。具体请参见 [#987](https://github.com/tuna/thuthesis/issues/987)、[#1002](https://github.com/tuna/thuthesis/issues/1002)。尤其感谢 @lrf21 的整理! + +### Changed + +- 研究生的声明页改为编译时默认不含页眉页脚、插入扫描页时加上页眉页脚([#999](https://github.com/tuna/thuthesis/issues/999))。 + +### Deprecated + +- 带星号版本的 `\listoffigures*` 等命令已过时。 +- 公式索引 `\listofequations` 和相关的 `\equcaption` 命令已过时。 +- `toc-chapter-style` 选项已过时。 + +### Removed + +- 移除 `statement-page-numer` 选项,请使用 `\statement` 命令的 `page-style` 参数控制行为(可参见样例文档)。 +- 移除 `degree-name` 选项,请改为 `degree-category`(包括带星号的版本)。 + +### Fixed + +- 修正目录中顶格标题的断行问题([#963](https://github.com/tuna/thuthesis/issues/963))。 +- 统一选题报告与学位论文的封面格式,修复信息偏移问题([#977](https://github.com/tuna/thuthesis/issues/977))。 +- 修正 `siunitx` 的连接符设置([#990](https://github.com/tuna/thuthesis/issues/990))。 +- 修正“符号和缩略语说明”的行距。 +- 修正参考文献表内容的第一项段前距离。 + +## [v7.5.2] - 2024-07-01 + +### Added + +- 增加选项 `eqn-paren-style` 控制公式编号的括号样式([#959](https://github.com/tuna/thuthesis/pull/959))。 + +### Fixed + +- 解决本科生的多篇“书面翻译对应的原文索引”([#956](https://github.com/tuna/thuthesis/issues/956))。 +- 修复 GitHub 发布的 Release 压缩包缺少部分文件的问题([#965](https://github.com/tuna/thuthesis/issues/965))。 + +## [v7.5.1] - 2024-05-20 + +### Changed + +- 更新 `student-id` 选项的处理逻辑,非 `proposal` 类型默认忽略,并增加警告([#945](https://github.com/tuna/thuthesis/issues/945))。 + +### Fixed + +- 修复参考文献 URL 中带有 DOI 时,重复打印 DOI 的问题([#952](https://github.com/tuna/thuthesis/discussions/952))。 +- 修复文档中的部分错别字。 + +## [v7.5.0] - 2024-03-29 + +### Added + +- 本科生的附录(调研阅读报告和书面翻译)支持 `biblatex`([#893](https://github.com/tuna/thuthesis/issues/893))。 +- 适配生命科学学院要求的 Cell 参考文献格式([#921](https://github.com/tuna/thuthesis/discussions/921))。 +- 增加 GitHub Actions 配置,自动从 master 分支发布预览版本、自动在多平台进行测试。 + +### Changed + +- 同步《写作指南》对 2023 年 3 月版本的后续修改: + - 封面的学科门类的字号改为三号(16bp)([#899](https://github.com/tuna/thuthesis/issues/899))。 + - 修改研究生目录的章标题段前距离([#926](https://github.com/tuna/thuthesis/issues/926))。 + - 统一并简化封面的布局([#900](https://github.com/tuna/thuthesis/issues/900))。 +- 不再插入 PDF 版书脊,改为编译生成([#551](https://github.com/tuna/thuthesis/issues/551))。 +- 本科生附录的参考文献编译方式改为 `bibtex thuthesis-appendix-{a,b,c...}`,同研究生一致。 +- 英文封面的导师姓名居中对齐([#883](https://github.com/tuna/thuthesis/issues/883))。 +- 修正 macOS 的 MS Office 字体名([#913](https://github.com/tuna/thuthesis/issues/913))。 +- 自动检测并使用 Windows 字体文件,默认从当前目录查找([#747](https://github.com/tuna/thuthesis/discussions/747))。 + +### Fixed + +- 修正封面的职称字距问题([#879](https://github.com/tuna/thuthesis/discussions/879))。 +- 解决了本科生附录的 `\printbibliography` 报错的问题([#882](https://github.com/tuna/thuthesis/issues/882))。 +- 修复了同时调用 `glossaries` 和 `hyperref` 时的多余空格([#901](https://github.com/tuna/thuthesis/issues/901))。 + +## [v7.4.0] - 2023-05-15 + +### Added + +- 允许本科生附录翻译的摘要中使用 `\thusetup{keywords = *}` 设置关键词([#865](https://github.com/tuna/thuthesis/issues/865))。 +- 添加选项 `degree-category` 和 `degree-category*` 设置学科门类([#840](https://github.com/tuna/thuthesis/issues/840))。 +- 添加选项 `professional-field` 和 `professional-field*` 设置专业领域([#840](https://github.com/tuna/thuthesis/issues/840))。 +- 添加选项 `engineering-field` 和 `engineering-field*` 设置工业领域([#840](https://github.com/tuna/thuthesis/issues/840))。 + +### Changed + +- 专业学位的“工程领域”改为“专业领域”,同步《指南》2023 年 3 月版的更改([#862](https://github.com/tuna/thuthesis/issues/862))。 +- 附录中的参考文献另行编号([#837](https://github.com/tuna/thuthesis/issues/837),感谢 [@hushidong](https://github.com/hushidong) 和 [@atxy-blip](https://github.com/atxy-blip))。 + +### Deprecated + +- 选项 `degree-name` 和 `degree-name*` 已经过时([#840](https://github.com/tuna/thuthesis/issues/840))。 + +### Fixed + +- 修正研究生“学术成果”列表的行距([#850](https://github.com/tuna/thuthesis/issues/850))。 +- 修正封面的布局,同步《指南》2023 年 3 月版的更改([#861](https://github.com/tuna/thuthesis/issues/861))。 + +## [v7.3.2] - 2023-04-06 + +### Fixed + +- 修复学术成果没有连续编号的问题([#825](https://github.com/tuna/thuthesis/issues/825))。 +- 修复研究生个人简历部分行距过窄的问题 ([#850](https://github.com/tuna/thuthesis/issues/850)) + +### Changed + +- 修改部分选项的说明,同步《指南》2023 年 1、3 月版的更改。 + +## [v7.3.1] - 2022-10-05 + +### Added + +- 增加选项 `appendix-figure-in-lof` 控制附录中的图/表是否列入插图清单/附表清单。 + +### Changed + +- 修改“指导教师/小组评语”章节的名称,同步《指南》2022 年 9 月版的修改。 + +### Fixed + +- 修正答辩委员会名单页的行距。 +- 修复导言区中设置 `toc-depth` 导致空白插图清单的 bug。 + +## [v7.3.0] - 2022-05-17 + +### Added + +- 新增 LuaTeX 支持(试验性)([#771](https://github.com/tuna/thuthesis/issues/771))。 + +### Changed + +- 研究生英文版目录中的标签分隔符由 `\quad` 改为空格([#759](https://github.com/tuna/thuthesis/discussions/759))。 +- 研究生英文版章节标题的标签分隔符由 `\quad` 改为空格([#759](https://github.com/tuna/thuthesis/discussions/759))。 +- 研究生英文封面的“Submitted”改为小写,同步《指南》2022 年 5 月版的修改。 +- 更改示例文档中 `longtable` 的“续表”标题格式,同步《指南》2021 年 6 月版的修改([#766](https://github.com/tuna/thuthesis/issues/766))。 + +### Fixed + +- 修正英文版研究成果的格式([#755](https://github.com/tuna/thuthesis/issues/755))。 +- 修复脚注内容可能跨页的问题([#778](https://github.com/tuna/thuthesis/issues/778))。 + +## [v7.2.4] - 2022-03-19 + +### Added + +- 增加警告提醒本科生将附录置于声明后([#682](https://github.com/tuna/thuthesis/issues/682))。 +- 增加警告提醒本科生将插图索引和表格索引置于正文后。 +- 本科生的 `\listoffiguresandtables` 改为分开的插图索引和表格索引。 + +### Changed + +- 本科生的“答辩委员会名单”、“指导教师/小组学术评语”和“答辩委员会决议书”改为不输出内容([#688](https://github.com/tuna/thuthesis/issues/688))。 +- 研究生和博后不再默认载入 `bibunits`([#710](https://github.com/tuna/thuthesis/issues/710))。 +- 参考文献表中预印本的文献类型标识改为“A”。 +- 允许多行页眉([#735](https://github.com/tuna/thuthesis/issues/735))。 + +### Fixed + +- 修复本科生“使用授权说明”中“日期”后缺失的冒号([#679](https://github.com/tuna/thuthesis/issues/679))。 +- 修复 `TikZ` 的 `external` 库与 `pdfpages` 的兼容性问题([#693](https://github.com/tuna/thuthesis/issues/693))。 +- 参考文献表中专利文献使用 `address`/`lcoation` 输出专利国别。 +- 修正一章内脚注数量超过 10 个时的报错问题,改为警告([#742](https://github.com/tuna/thuthesis/issues/742))。 + +### Removed + +- 去掉了 `siunitx` 的 `inter-unit-product` 设置。 + +## [v7.2.3] - 2021-05-31 + +### Changed + +- 中文模板的公式编号改为中文括号([#287](https://github.com/tuna/thuthesis/issues/287))。 + +### Fixed + +- 修正硕士论文书脊的字号([#647](https://github.com/tuna/thuthesis/issues/647))。 +- 修正本科生附录(调研和翻译)的目录在 TeX Live 2019 前无法生成的问题([#659](https://github.com/tuna/thuthesis/issues/659))。 +- 修正本科生主要符号表的标题([#661](https://github.com/tuna/thuthesis/issues/661))。 + +## [v7.2.2] - 2021-04-03 + +### Changed + +- 修改授权说明的内容和格式,同 2020 年 12 月版 Word 模板一致([#625](https://github.com/tuna/thuthesis/issues/625))。 +- 参考文献的页码前与冒号之间加上空格,同步 2021 年 3 月版《指南》的格式修改([#629](https://github.com/tuna/thuthesis/issues/629))。 +- 著者-出版年制参考文献表的著者姓名与年份之间改为逗号。 + +### Fixed + +- 修正图表等浮动体与文字之间的距离([#614](https://github.com/tuna/thuthesis/issues/614)、[#617](https://github.com/tuna/thuthesis/issues/617))。 +- 修正表格、算法等浮动体的行距([#619](https://github.com/tuna/thuthesis/issues/619))。 +- 修正了上标式引用后与中文之间多余的空格([#624](https://github.com/tuna/thuthesis/issues/624))。 +- 修正了参考文献的姓名或年份中含有中括号时的引用错误([#630](https://github.com/tuna/thuthesis/issues/630))。 + +## [v7.2.1] - 2021-03-21 + +### Added + +- 在文档中添加更多关于数学公式样式的说明。 + +### Changed + +- 允许控制研究生的声明页是否添加页眉页脚。 + +### Fixed + +- 调整文字与图表等浮动体之间的距离([#614](https://github.com/tuna/thuthesis/issues/614))。 +- 修复一些字体选择相关的问题。 + +## [v7.2.0] - 2021-03-12 + +### Added + +- 新增英文版写作指南要求的格式。 +- 新增选题报告的格式([#579](https://github.com/tuna/thuthesis/issues/579))。 +- 新增 `figure-number-sepatator` 等选项设置图表编号的连接符。 +- 新增数学符号字体风格选项 `math-style`。 +- 新增选项控制数学字体风格的细节:`uppercase-greek`、`less-than-or-equal`、`integral`、`integral-limits`、`partial` 和 `math-ellipsis`。 +- 新增数学字体试验性选项 `math-font = newtx`。 + +### Changed + +- 研究生的声明页默认加上页眉和页码,不受 `page-style` 的控制([#574](https://github.com/tuna/thuthesis/issues/574))。 +- 取消图表标题的悬挂缩进([#589](https://github.com/tuna/thuthesis/issues/589))。 +- 英文封面的联合导师改为“Co-supervisor”。 +- 联合导师的 key 改为 `co-supervisor`,同英文版模板一致。 + +### Fixed + +- 修正 `longtable` 宏包的配置([#584](https://github.com/tuna/thuthesis/issues/584))。 +- 修正本科生的“目录”、“声明”和“致谢”等标题中的空白([#591](https://github.com/tuna/thuthesis/issues/591))。 +- 修正参考文献的格式,取消页码与前面冒号之间的空格。 +- 修正中文封面的字距。 + +## [v7.1.0] - 2020-10-14 + +### Changed + +- 更新摘要的标题格式(研究生 2020-09-18 版)。 +- 更新目录的格式(研究生 2020-09-18 版)。 +- 图表浮动体的位置参数默认为 `h`。 +- 更新示例文档。 + +### Fixed + +- 修正 “keywords” 的拼写。 +- 修正授权使用说明的内容。 +- 修正授伪粗字体的粗度。 +- 修正 `\small` 等字号命令的行距。 +- 修正数学公式前后的距离。 +- 修正个人简历和学术成果的格式。 +- 修正图表标题的行距。 +- 禁止同一条参考文献中间分页。 +- 修正脚注的行距和缩进距离。 + +## [v7.0.0] - 2020-09-09 + +### Changed + +- 更新 2020 年版目录、插图和附表清单的格式。 +- 更新 2020 年版使用授权说明的内容。 +- 更新 2020 年版参考文献表的格式。 + +### Added + +- 新增 2020 年版“答辩委员会名单”页。 +- 新增 biblatex 支持。 +- 新增本科生外文系格式的支持。 + +### Fixed + +- 修正本科生密级的字体。 +- 修正表格的默认字号。 +- 修正参考文献表的行距和段前段后间距。 +- 修正 `\citep` 数字式引用的页码位置。 +- 修改摘要中关键词的格式。 +- 修正封面的语言切换。 + +## [v6.1.3] - 2020-07-09 + +### Added + +- 新增选项 `statement-page-style = empty / plain` 同时控制声明的页眉和页脚。 + +### Fixed + +- `\record` 命令中,如果 `output` 配置为 `print`,则强制进行 `\cleardoublepage`,保证记录表独立成页。 +- 修正了在导言区设置论文主要语言无效的问题([#560](https://github.com/tuna/thuthesis/issues/560))。 +- 修正了研究生插入扫描版声明页时的页眉。 + +### Deprecated + +- 选项 `statement-page-number` 已过时。 + +## [v6.1.2] - 2020-06-14 + +### Changed + +- `\statement` 和 `\copyrightpage` 命令都会在 PDF 中生成相应位置的书签。 +- `\statement` 命令编译生成声明页默认不含页码。 +- `\statement[xxx.pdf]` 插入扫描页时在页脚生成页码,以解决打印版与电子版页码不一致的情况。 +- 使用 `l3build` 编译的版本,在提交到 CTAN 时提供 TDS 结构,以解决编译时 `tsinghua-name-bachelor.pdf` 找不到的问题。 + +### Added + +- 添加 `\record` 命令用于本科生插入综合论文训练记录表,同时在 PDF 中生成对应书签。 +- 添加选项 `statement-page-number` 控制编译声明页时是否含页码。 + +### Fixed + +- 修正示例代码中关于 `\statement` 的 typo。 + +## [v6.1.1] - 2020-06-12 + +### Changed + +- 书脊中的西文不再需要调整高度。 +- 修改预生成的隶书版本本科生封面学校名称的文件名为 `tsinghua-name-bachelor.pdf`,不再尝试使用系统字体生成。 +- 将论文示例的文件名更改为 `thuthesis-example.tex / pdf`,以符合 CTAN 的要求。 + +### Added + +- 添加选项 `include-spine`,允许在正文中插入书脊页([#551](https://github.com/tuna/thuthesis/issues/551))。 +- 添加选项 `spine-title`、`spine-author` 控制书脊的内容。 +- 添加选项 `spine-font` 控制书脊的字号。 +- 添加选项 `output` 选择输出格式为打印版或用于提交的电子版([#553](https://github.com/tuna/thuthesis/issues/553))。 + +### Fixed + +- 修正书脊的格式。 +- 修复文档中 Changelog 的格式问题。 + +## [v6.1.0] - 2020-06-08 + +### Changed + +- 在 `translation` 环境中使用 `\bibliography` 改为生成参考文献, + 对应的原文索引改为 `translation-index` 环境([#529](https://github.com/tuna/thuthesis/issues/529))。 +- 附录的图、表不再加入索引。 +- 使用 `threeparttable` 示例表内脚注。 +- 本科生的目录章标题的西文字母和数字默认使用 Arial([#542](https://github.com/tuna/thuthesis/issues/542))。 +- GitHub repo 所有者更改为清华大学 TUNA 协会。 +- 接管 `ctex` 的 `fontset` 选项,允许更灵活的字体配置([#498](https://github.com/tuna/thuthesis/issues/498))。 + +### Fixed + +- 本科生附录的调研报告使用英文([#479](https://github.com/tuna/thuthesis/issues/479))。 +- 修正本科生附录的 `algorithm` 和 `listings` 环境的编号格式。 +- 研究生的“使用授权说明”增加一空白页([#504](https://github.com/tuna/thuthesis/issues/504))。 +- 修正 publication 列表行距问题([#507](https://github.com/tuna/thuthesis/issues/507))。 +- 修正研究生目录的行距。 +- 调整本科生封面有辅导教师、联合指导教师时的格式([#522](https://github.com/tuna/thuthesis/issues/522), [#537](https://github.com/tuna/thuthesis/issues/537))。 +- 修正本科生封面日期的字体([#532](https://github.com/tuna/thuthesis/issues/532))。 +- 设置三线表横线的默认粗度。 +- 修正文档中关于本科生学科(专业)名称的说明。 +- 允许用户使用文档类选项 `openright`。 +- 修正本科生的“单设一页”格式([#545](https://github.com/tuna/thuthesis/issues/545))。 +- 研究生的正文(main matter)起始于奇数页。 + +### Added + +- 允许使用边注。 +- 新增 `amsthm` 支持。 +- 支持单个关键词设置样式。 +- 在 `survey` 和 `translation` 环境中生成独立目录。 +- 添加选项 `toc-chapter-style` 控制本科生的目录章标题的西文字体。 + +## [v6.0.2] - 2020-02-23 + +### Fixed + +- 修复图表公式目录内容缺失([#467](https://github.com/tuna/thuthesis/issues/467))。 +- 修复 Github Actions 执行 l3build check 问题。 +- 文本模式使用 `\checkmark`。 + +### Added + +- 补充 PDF 元信息:文档标题,语言。 + +### Changed + +- 补充“著者-出版年”引用命令使用方法。 +- 使用 `xeCJKfntef` 替换 `CJKfntef`。 + +## [v6.0.1] - 2020-02-03 + +### Changed + +- 更新文档。 +- 更新 bib 测试用例。 + +### Fixed + +- 修复 PDF 目录层级问题([#457](https://github.com/tuna/thuthesis/issues/457))。 +- 修复 PDF 中章节连接问题([#453](https://github.com/tuna/thuthesis/issues/453))。 + +## [v6.0.0] - 2020-01-06 + +### Added + +- 新增 `survey`(调研阅读报告)和 `translation`(书面翻译)环境用于本科生的附录, + 其中的参考文献引用独立于论文正文([#343](https://github.com/tuna/thuthesis/issues/343))。 +- 新增论文语言选项。 +- 增加 `l3build` 测试。 + +### Changed + +- 重新设计 `\thusetup` 的接口。 +- 指导教师的姓名和职称用英文逗号分开([#424](https://github.com/tuna/thuthesis/issues/424))。 +- 重新设计封面(题名页)。 +- `\makecover` 拆分为 `\maketitle`、`\copyrightpage`。 +- 中英文摘分别用 `abstract`、`abstract*` 环境生成。 +- 附录使用 `\appendix` 命令开始,不再使用 `appendix` 环境。 +- 修改 `shuji` 为 `spine`。 +- 修改 `acknowledgement` 为 `acknowledgements`。 +- 从 travis 切换到 github actions。 +- 更改日志从 `thuthesis.dtx` 挪到 `CHANGELOG.md`。 +- 整理 Makefile,便于日常使用。 + +## Removed + +- 移除 `secret` 选项。 +- 移除 `translationbib` 环境。 +- 移除 `tocarialchapter`、`tocarialchapterentry` 和 `tocarialchapterpage` 选项。 +- 只保留 xelatex 编译方式。 + +### Fixed + +- 修正本科生的文献引用样式。 +- 修正本科生目录章标题的字体。 +- 处理 `hyperref` 与 `unicode-math` 的兼容性问题。 + +## [v5.5.2] - 2019-04-21 + +### Changed + +- 使用 XITS 数学字体。 + +## [v5.5.1] - 2019-04-16 + +### Changed + +- `\thu@textcircled`: 修复 minipage 中 footnote 编号问题。 + +## [v5.5.0] - 2019-03-15 + +### Changed + +- 增加选项使用英文模板。 +- 使用 `unicode-math` 处理数学字体。 +- Windows 的中文字体开启伪粗。 +- `\thu@textcircled`: 去掉 `pifootnote` 选项。 +- 移除 cfg 文件。 +- 修正图表标题与文字之间的距离。 +- `\thu@first@titlepage`: 修正博士后封面的格式。 +- 增加 `nomencl` 宏包的支持。 + +## [v5.4.5] - 2018-05-17 + +### Changed + +- `\normalsize`: 调整公式和正文间距。 + +## [v5.4.4] - 2018-04-22 + +### Changed + +- 删除 `arialtitle`,所有论文格式都一样。 +- 让目录中的引用不影响正文中引用序号。 +- 参考文献列表的页码使用 hyphen 取代 en dash。 +- 参考文献标号左对齐。 +- 允许连续两个文献引用使用连接号。 + +## [v5.4.2] - 2017-12-18 + +### Changed + +- 删除 `\pozhehao`。 +- 使用 degree 取代 type 选项。 + +## [v5.4.1] - 2017-12-04 + +### Changed + +- bst 在 ctan 上不分路径,故加前缀。 + +## [v5.4.0] - 2017-12-3 + +### Changed + +- 基于 `natbib` 的环境调整距离兼容性更好。 +- `\bibliographystyle{}` will cause `\bibstyle@newbib` to be called on THE NEXT LATEX RUN (via the aux file). + +## [v5.3.2] - 2017-05-01 + +### Changed + +- 定理环境格式设置(环境标题和环境正文字体设置)统一放置到 .cfg 文件中。 + +## [v5.3.1] - 2016-03-20 + +### Changed + +- 使用 CTeX 默认中文字体配置,支持不同引擎。 +- `ctex` 默认加载 `CJKspace`。 +- 几乎没人主动安装 Arial 字体。 + +## [v5.3.0] - 2016-03-11 + +### Changed + +- 更新到研究生院 2016.3 指南。 + +## [v5.2.3] - 2016-02-13 + +### Changed + +- `\thu@def@fontsize`: 改写字体定义命令。 +- 安全注释本科公式部分。 + +## [v5.2.2] - 2016-02-01 + +### Changed + +- 不希望 `newtx` 修改 `\@makefnmark`。 +- 利用 `environ` 的 `\Collect@Body`。 +- 目录中标题和页码都是链接。 +- `\thu@textcircled`: 脚注编号每页允许至多 9 个。 +- 基于 `footmisc` 来设置不同位置 footnote marker 样式。 +- `\tableofcontents`: 用 `\patchcmd` 修改 `\@dottedtocline`。 +- 用 `environ` 封装的 `\Collect@Body`。 + +## [v5.2.1] - 2016-01-14 + +### Changed + +- 使用 `newtx` 替换 `txfonts`。 +- 使用 `newtx` 字体。 +- `denotation`: 利用 `enumitem` 改造环境定义,更直观。 +- `acknowledgement`: 用 `acknowledgement` 替换 `ack`。 + +## [v5.2.0] - 2016-01-11 + +### Changed + +- `\title`: 增加 `\title` 排版翻译标题。 +- `translationbib`: 增加翻译文献环境 `translationbib`。 +- `\publicationskip`: 增加 `\publicationskip`。 + +## [v5.1.0] - 2015-12-27 + +### Changed + +- `\thusetup`: 通过 `\thusetup` 统一设置封面信息。 +- `\thu@first@titlepage`: 利用 `CJKfilltwosides` 优化封面排版。 +- `\thu@first@titlepage`: 修改联合指导教师显示问题。 + +## [v5.0.0] - 2015-12-21 + +### Changed + +- 使用 `kvoptions` 简化选项 type。 +- norggedbottom 选项修改为 raggedbottom。 +- 删除 `paralist` 选项。 +- 固定字体设置,同时改善与 `ctex` 兼容性。 +- 不再将页面尺寸写入 dvi,因为已不支持 dvips, 而该方案会使得在使用 tikzexternalize 时外部 PDF 图片 BBox 不对。 +- 用 `geometry` 简化设置。 +- `\ps@thu@headings`: 利用 `fancyhdr` 设置页眉页脚。 +- 修正定理字样为黑体([#104](https://github.com/tuna/thuthesis/issues/104))。 +- 本科附录图表编号用-不用.(如图A-1,表A-2)。 +- 用 `\ctexset` 来设置,替换复杂的 `\@startsection`。 +- 修正章节间距问题([#57](https://github.com/tuna/thuthesis/issues/57))。 +- 硕士博士论文目录只出现到第 3 级标题即可。其他未明确要求。 +- `\tableofcontents`: 修正学位论文中目录里节前缩进([#103](https://github.com/tuna/thuthesis/issues/103))。 +- `\makecover`: 使用 `pdfpages` 宏包支持本硕博论文授权说明扫描版([#36](https://github.com/tuna/thuthesis/issues/36))。 +- `acknowledgement`: 使用 pdfpages 宏包支持本硕博论文声明扫描版([#36](https://github.com/tuna/thuthesis/issues/36))。 +- `\inlinecite`: 用 `\inlinecite` 替换 `\onlinecite`。为保证兼 容性,`\onlinecite` 会保留。 +- `achievements`: 博士后就不提在学期间了,不合适([#100](https://github.com/tuna/thuthesis/issues/100))。 +- `achievements`: 让简历部分更符合格式指南和示例文件([#122](https://github.com/tuna/thuthesis/issues/122))。 +- `\shuji`: 扩展 `\shuji[<标题>][<作者>]`。 + +## [v4.8.1] - 2014-12-09 + +### Changed + +- 按照 CTAN 的要求整理一下文件。 + +## [v4.8] - 2014-11-25 + +### Changed + +- no need to load `indentfirst` directly since we use `ctex`. +- 内部调用 `ctex` 宏包,自动检测编译引擎。 +- dvips method is deprecated. We ask their users to load it manually. +- reset baselinestretch after ctex's change. +- 好几年累积的一些更新,最重要的是切换到 CTeX。 +- v4.7曾经想发布,但是一直没有做,于是就被跳过了,算是造一个段子吧。 +- 增加 noraggedbottom 选项。 +- 添加 nocap 选项,恢复默认标题样式,模板会进一步定制。 +- no need to load amssymb since we use txfonts. +- 在 CJK 模式下用 `CJKspace` 保留中英文间空格。 + +## [v4.7] - 2012-06-12 + +### Changed + +- 去掉 `hypernat` 依赖,`hyperref` 和 `natbib` 可以很好配合了。 +- 修改本科生页脚间距与样例基本一致。 +- `\ps@thu@headings`: 本科页码用小五号字。 +- 修正本科生作者信息名称。 +- 本科生关键字也用分号分割了。 +- `\thu@first@titlepage`: 硕士中文封面不再需要英文标题。 +- `\thu@first@titlepage`: 本科生题目下划线长度自动适应字数。 +- `\thu@doctor@engcover`: 硕士生新增英文封面。 +- `\makecover`: 硕士论文也需要英文封面。 +- `\thu@makeabstract`: Bachelor sample uses Keywords w/o space `-_-` + +## [v4.6] - 2011-10-22 + +### Changed + +- 增加博士后文档部分。 +- 使用手册更新。 +- 增加 postdoctor 选项。 +- 增加博士后相关指令。 +- 增加博士后相关配置。 +- `\thu@first@titlepage`: 增加博士后封面。 +- `\makecover`: 博士后报告无授权说明。 +- `resume`: 支持可选参数,自己定义简历章节标题。 + +## [v4.5.2] - 2010-09-19 + +### Changed + +- 研究生页面边距由 3.2cm 改为 3cm。 +- 本科论文日期具体到日。 +- `\makecover`: 本科封面和授权说明之间不要空白页。 +- `\thu@makeabstract`: 本科论文摘要亦无需右开。 +- `acknowledgement`: 研究生论文的致谢和声明终于分开了。 + +## [v4.5.1] - 2009-01-06 + +### Changed + +- 太好了,不用处理 `longtable` 的 `\caption` 了。 +- `\listoftables*`: 更优雅的插图/表格索引,避免跟 `caption` 包冲 突。`\thu@listof` 相应修改。 + +## [v4.5] - 2009-01-04 + +### Changed + +- 加入 XeTeX 支持,需要 `xeCJK`。 +- 彻底转向 UTF-8,并支持 XeLaTeX。 +- 增加 xetex, pdftex 选项。 +- `\shuji`: 简化代码,同时支持 XeLaTeX。 + +## [v4.4.4] - 2008-06-12 + +### Changed + +- 修复了一个从 v4.3 升级到 v4.4 过程中的丢失公式索引的 bug,原修改代码保留备忘。 + +## [v4.4.3] - 2008-06-09 + +### Changed + +- `\thu@first@titlepage`: 修改本科生论文封面格式以符合新样例。 +- `\thu@first@titlepage`: 修改本科生论文封面日期格式以符合新样例。 + +## [v4.4.2] - 2008-06-07 + +### Changed + +- 本科生格式终于也开始用空格作为关键字分隔符了。 +- 本科生签名之间距离改为 `\hskip1em`。 +- `\thu@authorization@mk`: 修改本科生的授权部分,按照 2008 年的新样例。 +- `\thu@makeabstract`: 本科生格式中文关键词采用首行缩进且无悬挂缩进。 +- `\thu@makeabstract`: Bachelor English abstract format requires indent and no hang-indent. + +## [v4.4] - 2008-06-18 + +### Changed + +- 修复网址断字。 +- `\backmatter`: 本科正文后的页码延续前面的阿拉伯数字,不再用罗马数 字。 +- `\backmatter`: 本科取消了所有页眉。 +- 本科论文终于去掉了**公式**二字。 +- 调整段前距为 -20bp 而不是原来的 -24bp。 +- 修改本科生模板的二级节标题为小四而不是半小四。 +- 调整段前距为 -12bp 而不是原来的 -16bp。 +- 调整段前距为 -12bp 而不是原来的 -16bp。 +- `\tableofcontents`: 本科生目录字号改回`\xiaosi[<1.8>]`。 +- `\tableofcontents`: 本科生目录缩进要求不同。 +- `\tableofcontents`: 本科章目录项一直用黑体(Arial)。 + +## [v4.3] - 2008-03-11 + +### Changed + +- 子图引用时加括号。 + +## [v4.2] - 2008-03-07 + +### Changed + +- `\eqref` 加括号。 +- 调整证明环境的编号和结尾的方块。 +- `\thu@doctor@engcover`: 博士英文封面补充联合导师。 + +## [v4.0] - 2007-11-08 + +### Changed + +- `\tableofcontents`: 本科研究生目录字号行距都不同。 +- **内部**密级前面终究还是不要五角星了。 +- `\thu@authorization@mk`: 研究生的授权部分调整了一下,不知道老师为什么总爱修改 那些无关紧要的格式,郁闷。感谢 PMHT@newsmth 的认真比对。 + +## [v3.1] - 2007-10-09 + +### Changed + +- 本科的目录又不要 arial 字体了。 +- replace `mathptmx` with `txfonts`. +- 英文摘要标题要搞特殊化。 +- 博士论文目录只出现到第 3 级标题即可。 +- `\thu@def@term`: 重新定义摘要为环境,long 选项不需要了。 +- 重新定义摘要成为环境。 +- 增强的关键词命令。 +- 去掉配置文件中的 `\hfill`。 +- **内部**密级前面要五角星了。 +- `\thu@first@titlepage`: 重新放置封面表格的提示元素。 +- `\thu@makeabstract`: 研究生关键词不再沉底。 + +## [v3.0] - 2007-05-13 + +### Changed + +- 不用专门为本科论文生成“**提交**”版本了。 +- 没有了综合论文训练页面,很多本科论文专用命令就消失了。 +- 删除 submit 选项。 +- 本科公式又要取消全文统一编号了。 +- `\tableofcontents`: 缩小目录中标题与页码之间**点**之间的距离。 +- `\makecover`: 本科论文评语取消。 +- `\makecover`: 本科论文授权图片扫描取消。 +- `\makecover`: 本科综合论文训练在电子版中取消。 +- `\thu@makeabstract`: **Key words** but not **Keywords**. What are you doing? +- `acknowledgement`: 本科论文声明部分图片扫描取消。 + +## [v2.6.4] - 2006-10-23 + +### Changed + +- 增加 `neverdecrease` 选项。 +- `\thu@makeabstract`: **Keywords** but not **Key words**. +- `\listoftables*`: 增加 `\listoffigures*`,`\listoftables*`。 +- `\listofequations*`: 增加 `\listofequations*`。 +- 调整参考文献标签宽度,使得条目增多时仍能对齐。 + +## [v2.6.3] - 2006-07-01 + +### Changed + +- `\thu@makeabstract`: 为本科正确设置目录及以后的页码。 +- `acknowledgement`: 重画双虚线,自适应页面宽度。 + +## [v2.6.2] - 2006-06-20 + +### Changed + +- 改正 groupmembers 的拼写错误。 +- 去掉 `paralist` 的 `newitem` 和 `newenum` 选项,因为默认是打开的。 +- `\thu@def@fontsize`: 引入此命令重新定义字号。 +- 根据不同论文格式显示不同公式编号,并自动加入索引。 +- 增加问题和猜想两个数学环境。 +- `\thu@def@term`: 引入 `\thu@def@term` 定义封面命令。 +- `\thu@first@titlepage`: 如果本科生没有辅导教师则不显示。 +- `\thu@makeabstract`: 取消最后一列的空白。 +- `\thu@makeabstract`: 取消 tabular 环境,用 `\hangindent` 实现关键词 悬挂缩进,英文摘要同。 +- `\thu@makeabstract`: 取消最后一列的空白。 +- `\equcaption`: 此命令配合 `amsmath` 命令基本可以满足所有 公式需要。 + +## [v2.6.1] - 2006-06-16 + +### Changed + +- 取消 `thubib.bst` 中 inbook 类 volume 后的页 码。 + +## [v2.6] - 2006-06-09 + +### Changed + +- 增加 dvipdfm 选项。 +- 增加 `longtable`。 +- 去除 hyperref 选项,等待全局传递。 +- 脚注改成 1.5 倍行距,漂亮。 +- 增加 `\floatsep`,`\@fptop`,`\@fpsep` 和 `\@fpbot`。 +- `\thu@first@titlepage`: 本科生题目加长,最多 24 个字。 + +## [v2.5.3] - 2006-06-08 + +### Changed + +- submit 选项的一个笔误。 +- `\backmatter`: 第一章永远右开。 +- 不管 caption 出现在什么位置,`\aboveskip` 总是出现在标题和浮动体之间的距离。 +- 增加对 `longtable` 的处理。 +- `\thu@makeabstract`: `\pagenumber` 会自动设置页码为 1。 +- `\equcaption`: 取消 `\equcaption` 的参数 + +## [v2.5.2] - 2006-06-01 + +### Changed + +- 更改默认列表距离。 +- 上一个版本忘了把研究生的公式编号排除。 +- `\thu@chapter*`: 定义自己的 `\thu@chapter*`。 +- `\tableofcontents`: 用 `\thu@chapter*` 改写目录命令。 +- `\thu@first@titlepage`: 研究生论文标题中英文用 arial 字体。 +- `\thu@makeabstract`: 在研究生论文中,摘要不出现在目录中,但是要在书签中出现。 +- `acknowledgement`: 研究生致谢右开。 +- `acknowledgement`: 研究生致谢题目是致谢,目录是致谢与声明。 +- `resume`: 研究生的个人介绍要右开。 + +## [v2.5.1] - 2006-05-28 + +### Changed + +- 如果选项设置了 dvips,但是用 PDFLaTeX 编译,报错。 +- 根据教务处的新要求调整附录部分。 +- 参考文献中杂志文章如果没有卷号,那么页码直接跟在 年份后面,并用句点分割。在 `thubib.bst` 中增加 output.year 函数。 +- 如果没有设置格式选项,报错。 +- submit 只能由本科用。 +- 研究生院目录要 times,而教务处要 arial。 +- 本科 openright,研究生 openany。 +- `\backmatter`: 本科正文之后页码即用罗马数字,研究生不变。 +- `\thu@textcircled`: 脚注编号使用 `\textcircled` 命令,每页允许至多 99 个。 +- 本科公式编号前添加**公式**二字。需要修 `amsmath` 极其深的一个命令。 +- 教务处居然要本科论文公式全文编号! +- 增加 `subfigure` 和 `subtable` 的 caption 配置。 +- 重新定义表格默认字体。 +- 让 `\chapter*` 自动 `\markboth`。 +- `\tableofcontents`: 减小目录项中的导引小点跟页码之间的留白。 +- 硕士封面的冒号前居然有点小距离! +- `\thu@first@titlepage`: 本科封面标题调整微小的空隙。 +- `\thu@first@titlepage`: 本科封面标题第二行的横线上移一点。 +- `\thu@makeabstract`: 教务处又不要正文前的页眉了。 +- `\thu@makeabstract`: 不管是哪种论文格式,摘要都要右开。 +- `\thu@makeabstract`: 研究生封面英文摘要连续。 +- `\listofequations*`: 公式索引项 numwidth 增加。 +- `resume`: 教务处和研究生院非要搞的不一样! + +## [v2.5] - 2006-05-20 + +### Changed + +- 对本科论文进行大幅度的重写,因为教务处修改了格式要求。 +- 重新整理代码,使其布局更易读。 +- 增加本科论文的提交选项 submit。 +- `\ps@thu@headings`: 本科的奇偶页眉不同。 +- `\ps@thu@headings`: 增加 empty 页面样式。 +- 修正 minipage 中的脚注。 +- 标题上下间距重调,以前没有考虑 `\intextsep` 的影响。 +- 增加索引名称定义。 +- 取消 `titlesec` 宏包,用基本 LaTeX 命令格式化标题。 +- `\tableofcontents`: 取消 `titletoc` 宏包,用 `\dottedtocline` 调整 目录。 +- 院系和专业分别改名用 department 和 major,代替原来 的 affil 和 subject。 +- `\makecover`: 本科论文评语位置调整。 +- `\makecover`: 综合论文训练在授权说明之后。 +- `acknowledgement`: 本科论文要求致谢声明分页,但是研究生的不分。 +- `\listoftables*`: 增加插图、表格和公式索引。 +- `\listoftables*`: 为了让索引中能出现**图 xxx**,不得不修改 LaTeX内部命令 `\@caption`。 +- `\equcaption`: 将公式编号写入临时文件以便生成公式列表。 +- `\listofequations*`: 增加公式索引命令。 +- 参考文献序号靠左,而不是靠右。 +- 不用 `\CJKcaption`,在导言区直接引入配置文件。 + +## [v2.4.2] - 2006-04-18 + +### Changed + +- 去掉参考文献第二个作者后面烦人的逗号。 + +## [v2.4.1] - 2006-04-17 + +### Changed + +- 2.4 忘了把关键词的 tabular 改成 thu@tabular。 +- 参考文献最后一个作者前是逗号而不是 and。 + +## [v2.4] - 2006-04-15 + +### Changed + +- Fill more pdf info. with `\hypersetup`. +- 自动隐藏密级为内部时后面的五角星。 +- 增加“注释(Remark)”环境。 +- 压缩 item 之间的距离。 +- `thubib.bst` 文献标题取消自动小写。 +- 中文参考文献取消 In: Proceedings。 +- 英文文参考文献调整 In: editor, Proceedings。 +- 参考文献为学位论文时,加方括号,作者后面为实心点。 +- 中文参考文献作者超过三个加等。 +- 中文参考文献需要在 bib 中指定 `lang="chinese"`。 +- 学位论文不在需要 type 字段。 +- 为摘要等条目增加书签。 +- 章节的编号用黑体,也就是自动打开 `arialtitle` 选项。 +- 添加模板名称命令。 +- 把页面尺寸写入 dvi,避免有的用户通 过 dvips 不指定页面类型而得到古怪的结果。 +- 表格内容为 11 磅。 +- 图表标题左对齐,取消原先漂亮的 hang 模式。 +- `\thu@makeabstract`: It is **Key words**, but not **Key Words**. +- `denotation`: 为主要符号表环境增加一个可选参数,调节符号列的宽度。 +- `acknowledgement`: 调整**致谢**等中间的距离。 +- 参考文献间距调小一点,label 长度增加一点,以便让超过 100 的参考文献更好地对齐。 + +## [v2.3] - 2006-04-09 + +### Changed + +- Fix a great bug: `\PassOptionsToClass` and `\LoadClass` rather than `\PassOptionToPackage` and `\LoadPackage`. +- Reorganize the codes in cover, make the pagestyle more readable. +- Add gbk2uni into the document. +- Support `openright` and openany. +- Adjust `\hypersetup` to remove color and box. +- Adjust margins again. +- Adjust references formats. +- Redefine frontmatter and mainmatter to fit our case. +- Add assumption environment. +- Change the brace in the cover. + +## [v2.2] - 2006-03-26 + +### Changed + +- Adjust margins. How bad it is to simulate MS WORD!. +- Add bachelor training overview details supporting. +- CJK support in preamble. +- Adjust hyperref to avoid boxes around links. + +## [v2.1] - 2006-03-03 + +### Changed + +- Add support to bachelor thesis. +- Remove `fancyhdr` and `geometry`. +- Redefine footnote marks. +- Replace `thubib.bst` with `chinesebst.bst`. +- Merge the modification of `ntheorem`. +- Remove `footmisc` and refine the document. +- Work very hard on the document. +- Add `\checklab` code to reduce “unresolved labels“ warning +- `\ps@thu@headings`: 彻底放弃 fancyhdr,定义自己的样式。 +- 让脚注它悬挂起来,而且中文中用上标,脚注中用正体。 +- `\thu@first@titlepage`: 增加本科部分。 +- `\makecover`: 分成几个小模块来搞,不然这个 macro 太大了,看不过来。 + +## [v2.0e] - 2005-12-18 + +### Changed + +- `denotation`: 主要符号表定义为一个 list,用起来方便。 + +## [v2.0] - 2005-12-20 + +### Changed + +- `\ps@thu@headings`: 以前的太乱了,重新整理过清晰多了。 +- `\tableofcontents`: 附录的目录项需要调整一下。以及公式编号方式等等。 +- 增加了封面密级,增加博士封面支持 +- `\thu@first@titlepage`: 封面的培养单位,学科等内容字距自动调整。 +- `acknowledgement`: 将致谢定义为一个环境更合适,里面也不用像以前段首需 要自己缩进。 +- `resume`: 最后决定将 resume 定义为环境。这样与前面的主要符号 表、致谢等对应。 + +## [v1.5] - 2005-12-16 + +### Changed + +- `acknowledgement`: 在那些不显示编号的章节前面先执行一次 `\cleardoublepage`,使新开章节的页码到达正确的状态。否则会因为 `\addcontentsline` 在 chapter 之前而导致目录页码错误。 +- `resume`: 增加个人简历章节的命令,去掉主文件中需要重新 定义 `\cleardoublepage` 和自己写 `\markboth`,`\addcontentsline` 的部分。 + +## [v1.4rc1] - 2005-12-14 + +### Changed + +- I do not know why `\thu@authorizationaddon` does not work now for v1.3, while it's fine in v1.2. Temporarily, I remove the directive :(. There might be better solution. Other changes: add `config` option to subfig to be compatible with subfigure. add `courier` package for tt font. +- I have to put all chinese chars into cfg, otherwise they would not appear. + +## [v1.4] - 2005-12-05 + +### Changed + +- Fix the problem of **chinese**, which is because both CJK and everysel redefine the `\selectfont`. So, a not so good workaround is to merge them up. Add `shuji.tex` example. Add `\pozhehao` command. + +## [v1.3] - 2005-11-14 + +### Changed + +- Replace `subfigure` with `subfig`, replace `caption2` with `caption`, add details about using figure are in the example. + +## [v1.2] - 2005-11-04 + +### Changed + +- Remove `fancyref`; Remove `ucite` and implement `\onlinecite`; use package `arial` or `helvet` selectively. + +## [v1.1] - 2005-11-03 + +### Changed + +- Initial version, migrate from the old ``Bao--Pan'' version. Make the template a class instead of package. + +## [v1.0] - 2005-07-06 + +### Changed + +- Please refer to ``Bao--Pan'' version. + + + +[Unreleased]: https://github.com/tuna/thuthesis/compare/v7.7.0...HEAD +[v7.7.0]: https://github.com/tuna/thuthesis/compare/v7.6.0...v7.7.0 +[v7.6.0]: https://github.com/tuna/thuthesis/compare/v7.5.2...v7.6.0 +[v7.5.2]: https://github.com/tuna/thuthesis/compare/v7.5.1...v7.5.2 +[v7.5.1]: https://github.com/tuna/thuthesis/compare/v7.5.0...v7.5.1 +[v7.5.0]: https://github.com/tuna/thuthesis/compare/v7.4.0...v7.5.0 +[v7.4.0]: https://github.com/tuna/thuthesis/compare/v7.3.2...v7.4.0 +[v7.3.2]: https://github.com/tuna/thuthesis/compare/v7.3.1...v7.3.2 +[v7.3.1]: https://github.com/tuna/thuthesis/compare/v7.3.0...v7.3.1 +[v7.3.0]: https://github.com/tuna/thuthesis/compare/v7.2.4...v7.3.0 +[v7.2.4]: https://github.com/tuna/thuthesis/compare/v7.2.3...v7.2.4 +[v7.2.3]: https://github.com/tuna/thuthesis/compare/v7.2.2...v7.2.3 +[v7.2.2]: https://github.com/tuna/thuthesis/compare/v7.2.1...v7.2.2 +[v7.2.1]: https://github.com/tuna/thuthesis/compare/v7.2.0...v7.2.1 +[v7.2.0]: https://github.com/tuna/thuthesis/compare/v7.1.0...v7.2.0 +[v7.1.0]: https://github.com/tuna/thuthesis/compare/v7.0.0...v7.1.0 +[v7.0.0]: https://github.com/tuna/thuthesis/compare/v6.1.3...v7.0.0 +[v6.1.3]: https://github.com/tuna/thuthesis/compare/v6.1.2...v6.1.3 +[v6.1.2]: https://github.com/tuna/thuthesis/compare/v6.1.1...v6.1.2 +[v6.1.1]: https://github.com/tuna/thuthesis/compare/v6.1.0...v6.1.1 +[v6.1.0]: https://github.com/tuna/thuthesis/compare/v6.0.2...v6.1.0 +[v6.0.2]: https://github.com/tuna/thuthesis/compare/v6.0.1...v6.0.2 +[v6.0.1]: https://github.com/tuna/thuthesis/compare/v6.0.0...v6.0.1 +[v6.0.0]: https://github.com/tuna/thuthesis/compare/v5.5.2...v6.0.0 +[v5.5.2]: https://github.com/tuna/thuthesis/compare/v5.5.1...v5.5.2 +[v5.5.1]: https://github.com/tuna/thuthesis/compare/v5.5.0...v5.5.1 +[v5.5.0]: https://github.com/tuna/thuthesis/compare/v5.4.5...v5.5.0 +[v5.4.5]: https://github.com/tuna/thuthesis/compare/v5.4.4...v5.4.5 +[v5.4.4]: https://github.com/tuna/thuthesis/compare/v5.4.2...v5.4.4 +[v5.4.2]: https://github.com/tuna/thuthesis/compare/v5.4.1...v5.4.2 +[v5.4.1]: https://github.com/tuna/thuthesis/compare/v5.4.0...v5.4.1 +[v5.4.0]: https://github.com/tuna/thuthesis/compare/v5.3.2...v5.4.0 +[v5.3.2]: https://github.com/tuna/thuthesis/compare/v5.3.1...v5.3.2 +[v5.3.1]: https://github.com/tuna/thuthesis/compare/v5.3.0...v5.3.1 +[v5.3.0]: https://github.com/tuna/thuthesis/compare/v5.2.3...v5.3.0 +[v5.2.3]: https://github.com/tuna/thuthesis/compare/v5.2.2...v5.2.3 +[v5.2.2]: https://github.com/tuna/thuthesis/compare/v5.2.1...v5.2.2 +[v5.2.1]: https://github.com/tuna/thuthesis/compare/v5.2.0...v5.2.1 +[v5.2.0]: https://github.com/tuna/thuthesis/compare/v5.1.0...v5.2.0 +[v5.1.0]: https://github.com/tuna/thuthesis/compare/v5.0.0...v5.1.0 +[v5.0.0]: https://github.com/tuna/thuthesis/compare/v4.8.1...v5.0.0 +[v4.8.1]: https://github.com/tuna/thuthesis/compare/v4.8...v4.8.1 +[v4.8]: https://github.com/tuna/thuthesis/compare/v4.7...v4.8 +[v4.7]: https://github.com/tuna/thuthesis/compare/v4.6...v4.7 +[v4.6]: https://github.com/tuna/thuthesis/compare/v4.5.2...v4.6 +[v4.5.2]: https://github.com/tuna/thuthesis/compare/v4.5.1...v4.5.2 +[v4.5.1]: https://github.com/tuna/thuthesis/compare/v4.5...v4.5.1 +[v4.5]: https://github.com/tuna/thuthesis/compare/v4.4.4...v4.5 +[v4.4.4]: https://github.com/tuna/thuthesis/compare/v4.4.3...v4.4.4 +[v4.4.3]: https://github.com/tuna/thuthesis/compare/v4.4.2...v4.4.3 +[v4.4.2]: https://github.com/tuna/thuthesis/compare/v4.4...v4.4.2 +[v4.4]: https://github.com/tuna/thuthesis/compare/v4.3...v4.4 +[v4.3]: https://github.com/tuna/thuthesis/compare/v4.2...v4.3 +[v4.2]: https://github.com/tuna/thuthesis/compare/v4.0...v4.2 +[v4.0]: https://github.com/tuna/thuthesis/compare/v3.1...v4.0 +[v3.1]: https://github.com/tuna/thuthesis/compare/v3.0...v3.1 +[v3.0]: https://github.com/tuna/thuthesis/compare/v2.6.4...v3.0 +[v2.6.4]: https://github.com/tuna/thuthesis/compare/v2.6.3...v2.6.4 +[v2.6.3]: https://github.com/tuna/thuthesis/compare/v2.6.2...v2.6.3 +[v2.6.2]: https://github.com/tuna/thuthesis/compare/v2.6.1...v2.6.2 +[v2.6.1]: https://github.com/tuna/thuthesis/compare/v2.6...v2.6.1 +[v2.6]: https://github.com/tuna/thuthesis/compare/v2.5.3...v2.6 +[v2.5.3]: https://github.com/tuna/thuthesis/compare/v2.5.2...v2.5.3 +[v2.5.2]: https://github.com/tuna/thuthesis/compare/v2.5.1...v2.5.2 +[v2.5.1]: https://github.com/tuna/thuthesis/compare/v2.5...v2.5.1 +[v2.5]: https://github.com/tuna/thuthesis/compare/v2.4.2...v2.5 +[v2.4.2]: https://github.com/tuna/thuthesis/compare/v2.4.1...v2.4.2 +[v2.4.1]: https://github.com/tuna/thuthesis/compare/v2.4...v2.4.1 +[v2.4]: https://github.com/tuna/thuthesis/compare/v2.3...v2.4 +[v2.3]: https://github.com/tuna/thuthesis/compare/v2.2...v2.3 +[v2.2]: https://github.com/tuna/thuthesis/compare/v2.1...v2.2 +[v2.1]: https://github.com/tuna/thuthesis/compare/v2.0e...v2.1 +[v2.0e]: https://github.com/tuna/thuthesis/compare/v2.0...v2.0e +[v2.0]: https://github.com/tuna/thuthesis/compare/v1.5...v2.0 +[v1.5]: https://github.com/tuna/thuthesis/compare/v1.4rc1...v1.5 +[v1.4rc1]: https://github.com/tuna/thuthesis/compare/v1.4...v1.4rc1 +[v1.4]: https://github.com/tuna/thuthesis/compare/v1.3...v1.4 +[v1.3]: https://github.com/tuna/thuthesis/compare/v1.2...v1.3 +[v1.2]: https://github.com/tuna/thuthesis/compare/v1.1...v1.2 +[v1.1]: https://github.com/tuna/thuthesis/compare/v1.0...v1.1 +[v1.0]: https://github.com/tuna/thuthesis/releases/tag/v1.0 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2244313 --- /dev/null +++ b/LICENSE @@ -0,0 +1,416 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 or later is part of all distributions of LaTeX + % version 2005/12/01 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dc74697 --- /dev/null +++ b/Makefile @@ -0,0 +1,82 @@ +# Makefile for ThuThesis + +PACKAGE = thuthesis +THESIS = thuthesis-example + +SOURCES = $(PACKAGE).ins $(PACKAGE).dtx +CLSFILE = dtx-style.sty $(PACKAGE).cls + +LATEXMK = latexmk +SHELL := /usr/bin/env bash + +# make deletion work on Windows +ifdef SystemRoot + RM = del /Q +else + RM = rm -f +endif + +.PHONY: all all-dev clean distclean dist thesis viewthesis doc viewdoc cls check save test FORCE_MAKE + +thesis: $(THESIS).pdf + +all: thesis + +all-dev: doc all + +cls: $(CLSFILE) + +$(CLSFILE): $(SOURCES) + xetex $(PACKAGE).ins + +doc: $(PACKAGE).pdf + +$(PACKAGE).pdf: cls FORCE_MAKE + $(LATEXMK) $(PACKAGE).dtx + +$(THESIS).pdf: cls FORCE_MAKE + $(LATEXMK) $(THESIS) + +viewdoc: doc + $(LATEXMK) -pv $(PACKAGE).dtx + +viewthesis: thesis + $(LATEXMK) -pv $(THESIS) + +save: +ifeq ($(target),) + bash testfiles/save.sh +else + bash testfiles/save.sh $(target) +endif + +test: +ifeq ($(target),) + l3build check +else + bash testfiles/test.sh $(target) +endif + +clean: + $(LATEXMK) -c $(PACKAGE).dtx $(THESIS) + -@$(RM) -rf *~ main-survey.* main-translation.* _markdown_thuthesis* thuthesis.markdown.* + +cleanall: clean + -@$(RM) $(PACKAGE).pdf $(THESIS).pdf + +distclean: cleanall + -@$(RM) $(CLSFILE) + -@$(RM) -r dist + +check: FORCE_MAKE +ifeq ($(version),) + @echo "Error: version missing: \"make [check|dist] version=X.Y.Z\""; exit 1 +else + @[[ $(shell grep -E -c '$(version) Tsinghua University Thesis Template|\\def\\version\{$(version)\}' thuthesis.dtx) -eq 3 ]] || (echo "bump version with \"l3build tag\" before release"; exit 1) +endif + +dist: check all-dev + # use l3build for CTAN release (zip with .tds.zip) + l3build ctan --config utils/build-ctan + # use gulp for GitHub release (zip with generated file) + python3 utils/create_release.py --version="v$(version)" diff --git a/README.md b/README.md new file mode 100644 index 0000000..6497c53 --- /dev/null +++ b/README.md @@ -0,0 +1,183 @@ +# ThuThesis + +[![GitHub Actions](https://github.com/tuna/thuthesis/actions/workflows/test.yml/badge.svg)](https://github.com/tuna/thuthesis/actions/workflows/test.yml) +[![GitHub downloads](https://img.shields.io/github/downloads/tuna/thuthesis/total)](https://github.com/tuna/thuthesis/releases) +[![GitHub commits](https://img.shields.io/github/commits-since/tuna/thuthesis/latest)](https://github.com/tuna/thuthesis/commits/master) +[![GitHub release](https://img.shields.io/github/v/release/tuna/thuthesis)](https://github.com/tuna/thuthesis/releases/latest) +[![CTAN](https://img.shields.io/ctan/v/thuthesis)](https://www.ctan.org/pkg/thuthesis) + +> Scroll down for the English version of README. + +**ThuThesis** 是 **T**sing**h**ua **U**niversity **Thesis** LaTeX Template 的缩写。 + +此宏包旨在建立一个简单易用的清华大学学位论文 LaTeX 模板,包括本科综合论文训练、硕士论文、博士论文以及博士后出站报告。 + +**由于模板升级频繁,在开始使用和提问前,请确保您已经认真完整地阅读了使用说明文档和示例代码。** + +## 版权 + +本项目采用 [LaTeX项目公共许可证 v1.3c](https://www.latex-project.org/lppl/lppl-1-3c/) 授权,任何违反该许可证使用 ThuThesis 的行为将被记录在 [耻辱柱](https://github.com/tuna/thuthesis/issues/754) 页面中,以示警告。 + +本项目分发的 `thu-fig-logo.pdf` 与 `thu-text-logo.pdf` 为载有清华大学校徽与校名的图形文件,用于制作本科生综合论文训练封面。这些图形从 [清华大学视觉形象系统](https://vi.tsinghua.edu.cn/) 获取,除裁剪周边空白外,项目维护者未进行任何其他修改。 +请注意:相关图形与文字均是清华大学的注册商标,除此模板外,请勿用于任何其他用途。 + +## 下载 + +推荐下载**发布版**模板,里面包括具体使用说明以及示例文档: + +* 模板使用说明(`thuthesis.pdf`) +* 示例文档(`thuthesis-example.pdf`) + +在开始书写前,建议将 `thuthesis-example.tex` 复制或重命名为其他有意义的名称。 + +### 下载途径 + +* 发布版: + * 仅下载: + * [CTAN](https://www.ctan.org/pkg/thuthesis):可能滞后正式发布少许时间。 + * [GitHub Releases](https://github.com/tuna/thuthesis/releases):最新版的及时发布途径。 + * [TUNA 镜像站](https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/):GitHub Releases 的镜像。 + * 在线编辑: + * [TeXPage 模板](https://www.texpage.com/template/72b580ca-51fa-4ecc-82b3-0509bc1d6a07)(提供 Windows 中文字体) + * [Overleaf 模板](https://www.overleaf.com/latex/templates/thuthesis-tsinghua-university-thesis-latex-template/cfwgcxtvkbsx) ([Overleaf 降低了免费账户的编译时间](https://www.overleaf.com/blog/changes-to-free-compile-timeouts-and-servers), 使用本模板的项目会因为规模较大[容易超时](https://github.com/tuna/thuthesis/issues/984)) +* 开发版:[GitHub](https://github.com/tuna/thuthesis) + +### 注意事项 + +* GitHub 仓库的开发版仅供开发者与需要尚未发布的功能的有经验的 TeX 用户使用,不提供任何保证。 +* **任何在其他途径分发的 ThuThesis(包含其变体或衍生物)均不是官方版本,请谨慎使用。** + +## 更新日志 + +每个版本的详细更新日志,请见 [CHANGELOG.md](CHANGELOG.md)。使用文档中也包含了这一内容。 + +## 升级 + +### 自动更新 + +通过 TeX 发行版工具(如 `tlmgr`)自动从 [CTAN](https://www.ctan.org/pkg/thuthesis) 更新。 + +### 手动更新 + +#### 发布版 + +下载发布版的 zip 包,使用其中的 `thuthesis.cls` 等文件覆盖原有的即可,无须额外操作。 + +#### 开发版 + +有两种获得开发版编译结果的方式: + +1. 从 GitHub 上对应 commit 的名为 `Test` 的 workflow 中下载 `thuthesis-snapshot-release` 并解压,其中的 `dist` 文件夹包含了编译后的开发版代码。 +2. 从 GitHub clone 项目源码或者下载源码 zip 包,执行 `xetex thuthesis.ins`。 + +## 提问 + +按推荐顺序排序: + +* 先到 [FAQ](https://github.com/tuna/thuthesis/wiki/FAQ) 看看常见问题; +* 在 [GitHub Discussions](https://github.com/tuna/thuthesis/discussions) 搜索已有讨论,如果没有则提出新问题; +* 如果认为模板存在问题,可在 Issues 中使用相应的模板提出。 +* 入门问题可以参考[wiki/新手指南](https://github.com/tuna/thuthesis/wiki/新手指南)学习 + +## Makefile的用法 + +```shell +make [{all|thesis|doc|clean|cleanall|distclean}] +``` + +### 目标 +* `make thesis` 生成论文 `thuthesis-example.pdf`; +* `make doc` 生成模板使用说明书 `thuthesis.pdf`; +* `make clean` 删除示例文件的中间文件(不含 `thuthesis-example.pdf`); +* `make cleanall` 删除示例文件的中间文件和 `thuthesis-example.pdf`; +* `make distclean` 删除示例文件和模板的所有中间文件和 PDF。 + +--- + +# ThuThesis + +**ThuThesis** is an abbreviation of **T**sing**h**ua **U**niversity **Thesis** LaTeX Template. + +This package establishes a simple and easy-to-use LaTeX template for Tsinghua dissertations, including general undergraduate research papers, master's theses, doctoral dissertations, and postdoctoral reports. + +**This template is subject to frequent changes. Please make sure you have read the usage documentation and example code completely and carefully before using and asking questions.** + +## Copyright + +This project is licensed under the [The LaTeX project public license v1.3c](https://www.latex-project.org/lppl/lppl-1-3c/). Any use of ThuThesis that violates this license will be recorded in the [Hall of Shame](https://github.com/tuna/thuthesis/issues/754). + +The distributed `thu-fig-logo.pdf` and `thu-text-logo.pdf` files in this project contain the graphical emblem and name of Tsinghua University, and are used for creating undergraduate thesis covers only. +These graphics were obtained from the [Tsinghua University Visual Identity System](https://vi.tsinghua.edu.cn). No modifications were made by the project maintainers except cropping the white space. +Note: Both the relevant graphics and text are registered trademarks of Tsinghua University. You must not use them for any other purposes except within this template. + +## Downloads + +**Published versions** are recommended. Specific usage documentation and examples can be found in the archive. At present, these documents are **only available in Chinese**: + +* Template usage documentation (`thuthesis.pdf`) +* Template example (`thuthesis-example.pdf`) + +Before you start writing, it is recommended to copy or rename `thuthesis-example.tex` to another meaningful name. + +### Download Methods + +* Published versions: + * Download only: + * [CTAN](https://www.ctan.org/pkg/thuthesis) + * [GitHub Releases](https://github.com/tuna/thuthesis/releases) + * [TUNA Mirrors](https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/): mirror of GitHub Releases + * Online editor: + * [TeXPage template](https://www.texpage.com/template/72b580ca-51fa-4ecc-82b3-0509bc1d6a07) (providing Chinese fonts of Windows) + * [Overleaf template](https://www.overleaf.com/latex/templates/thuthesis-tsinghua-university-thesis-latex-template/cfwgcxtvkbsx) ([free compile time was reduced](https://www.overleaf.com/blog/changes-to-free-compile-timeouts-and-servers); projects using this template will be relatively large, and thus [likely to time-out](https://github.com/tuna/thuthesis/issues/984)) +* Developer versions: [GitHub](https://github.com/tuna/thuthesis) + +### Notes + +* The development version in the GitHub repository is intended for developers and experienced TeX users who require unreleased features, and no guarantees are provided. +* **ThuThesis (including its variants / derivatives) distributed in any other way is NOT an official version. Use at your own risk.** + +## Changelog + +See [CHANGELOG.md](CHANGELOG.md) for detailed changes in each release. They are also included in the usage documentation. + +## Updates + +### Automatic + +Get the most up-to-date published version with your TeX distribution from [CTAN](https://www.ctan.org/pkg/thuthesis). + +### Manual + +#### Published versions + +Download the published zip files, extract `thuthesis.cls` and other files (if needed) and override the existing ones in your thesis. + +#### Development versions + +There are two ways to obtain the compiled development version: + +1. Download the `thuthesis-snapshot-release` from the `Test` workflow of the corresponding commit on GitHub and extract it. The `dist` folder contains the compiled template of development version. +2. Clone the project source code from GitHub or download the source code tarball, and run `xetex thuthesis.ins`. + +## Reporting Issues + +Please follow the procedure below: + +* Check the [FAQ](https://github.com/tuna/thuthesis/wiki/FAQ). +* Search [GitHub Discussions](https://github.com/tuna/thuthesis/discussions) and create a new discussion if none exists. +* Create an issue (with specified template) if you believe there is a bug. +* Beginners may go to [wiki/新手指南](https://github.com/tuna/thuthesis/wiki/新手指南) for basic information. + +## Makefile Usage + +```shell +make [{all|thesis|doc|clean|cleanall|distclean}] +``` + +### Targets +* `make all` same as `make thesis`; +* `make thesis` generate thesis `thuthesis-example.pdf`; +* `make doc` generate template documentation `thuthesis.pdf`; +* `make clean` delete all intermediate files of the example (excluding `thuthesis-example.pdf`); +* `make cleanall` delete all intermediate files of the example and `thuthesis-example.pdf`; +* `make distclean` delete all examples' and templates' files and PDFs. diff --git a/data/abstract.tex b/data/abstract.tex new file mode 100644 index 0000000..6fcf779 --- /dev/null +++ b/data/abstract.tex @@ -0,0 +1,39 @@ +% !TEX root = ../thuthesis-example.tex + +% 中英文摘要和关键字 + +\begin{abstract} + 论文的摘要是对论文研究内容和成果的高度概括。 + 摘要应对论文所研究的问题及其研究目的进行描述,对研究方法和过程进行简单介绍,对研究成果和所得结论进行概括。 + 摘要应具有独立性和自明性,其内容应包含与论文全文同等量的主要信息。 + 使读者即使不阅读全文,通过摘要就能了解论文的总体内容和主要成果。 + + 论文摘要的书写应力求精确、简明。 + 切忌写成对论文书写内容进行提要的形式,尤其要避免“第 1 章……;第 2 章……;……”这种或类似的陈述方式。 + + 关键词是为了文献标引工作、用以表示全文主要内容信息的单词或术语。 + 关键词不超过 5 个,每个关键词中间用分号分隔。 + + % 关键词用“英文逗号”分隔,输出时会自动处理为正确的分隔符 + \thusetup{ + keywords = {关键词 1, 关键词 2, 关键词 3, 关键词 4, 关键词 5}, + } +\end{abstract} + +\begin{abstract*} + An abstract of a dissertation is a summary and extraction of research work and contributions. + Included in an abstract should be description of research topic and research objective, brief introduction to methodology and research process, and summary of conclusion and contributions of the research. + An abstract should be characterized by independence and clarity and carry identical information with the dissertation. + It should be such that the general idea and major contributions of the dissertation are conveyed without reading the dissertation. + + An abstract should be concise and to the point. + It is a misunderstanding to make an abstract an outline of the dissertation and words “the first chapter”, “the second chapter” and the like should be avoided in the abstract. + + Keywords are terms used in a dissertation for indexing, reflecting core information of the dissertation. + An abstract may contain a maximum of 5 keywords, with semi-colons used in between to separate one another. + + % Use comma as separator when inputting + \thusetup{ + keywords* = {keyword 1, keyword 2, keyword 3, keyword 4, keyword 5}, + } +\end{abstract*} diff --git a/data/acknowledgements.tex b/data/acknowledgements.tex new file mode 100644 index 0000000..f6344f3 --- /dev/null +++ b/data/acknowledgements.tex @@ -0,0 +1,11 @@ +% !TEX root = ../thuthesis-example.tex + +\begin{acknowledgements} + 衷心感谢导师×××教授和物理系××副教授对本人的精心指导。他们的言传身教将使我终生受益。 + + 在美国麻省理工学院化学系进行九个月的合作研究期间,承蒙 Robert Field 教授热心指导与帮助,不胜感激。 + + 感谢×××××实验室主任×××教授,以及实验室全体老师和同窗们学的热情帮助和支持! + + 本课题承蒙国家自然科学基金资助,特此致谢。 +\end{acknowledgements} diff --git a/data/appendix.tex b/data/appendix.tex new file mode 100644 index 0000000..b71acb6 --- /dev/null +++ b/data/appendix.tex @@ -0,0 +1,60 @@ +% !TEX root = ../thuthesis-example.tex + +\chapter{补充内容} + +附录是与论文内容密切相关、但编入正文又影响整篇论文编排的条理和逻辑性的资料,例如某些重要的数据表格、计算程序、统计表等,是论文主体的补充内容,可根据需要设置。 + +附录中的图、表、数学表达式、参考文献等另行编序号,与正文分开,一律用阿拉伯数字编码, +但在数码前冠以附录的序号,例如“图~\ref{fig:appendix-figure}”, +“表~\ref{tab:appendix-table}”,“式\eqref{eq:appendix-equation}”等。 + + +\section{插图} + +% 附录中的插图示例(图~\ref{fig:appendix-figure})。 + +\begin{figure} + \centering + \includegraphics[width=0.6\linewidth]{example-image-a.pdf} + \caption{附录中的图片示例} + \label{fig:appendix-figure} +\end{figure} + + +\section{表格} + +% 附录中的表格示例(表~\ref{tab:appendix-table})。 + +\begin{table} + \centering + \caption{附录中的表格示例} + \begin{tabular}{ll} + \toprule + 文件名 & 描述 \\ + \midrule + thuthesis.dtx & 模板的源文件,包括文档和注释 \\ + thuthesis.cls & 模板文件 \\ + thuthesis-*.bst & BibTeX 参考文献表样式文件 \\ + thuthesis-*.bbx & BibLaTeX 参考文献表样式文件 \\ + thuthesis-*.cbx & BibLaTeX 引用样式文件 \\ + \bottomrule + \end{tabular} + \label{tab:appendix-table} +\end{table} + + +\section{数学表达式} + +% 附录中的数学表达式示例(式\eqref{eq:appendix-equation})。 +\begin{equation} + \frac{1}{2 \uppi \symup{i}} \int_\gamma f = \sum_{k=1}^m n(\gamma; a_k) \mathscr{R}(f; a_k) + \label{eq:appendix-equation} +\end{equation} + + +\section{文献引用} + +附录\cite{dupont1974bone}中的参考文献引用\cite{zhengkaiqing1987}示例 +\cite{dupont1974bone,zhengkaiqing1987}。 + +\printbibliography diff --git a/data/chap01.tex b/data/chap01.tex new file mode 100644 index 0000000..143ec4b --- /dev/null +++ b/data/chap01.tex @@ -0,0 +1,78 @@ +% !TEX root = ../thuthesis-example.tex + +\chapter{论文主要部分的写法} + +研究生学位论文撰写,除表达形式上需要符合一定的格式要求外,内容方面上也要遵循一些共性原则。 + +通常研究生学位论文只能有一个主题(不能是几块工作拼凑在一起),该主题应针对某学科领域中的一个具体问题展开深入、系统的研究,并得出有价值的研究结论。 +学位论文的研究主题切忌过大,例如,“中国国有企业改制问题研究”这样的研究主题过大,因为“国企改制”涉及的问题范围太广,很难在一本研究生学位论文中完全研究透彻。 + + + +\section{论文的语言及表述} + +除国际研究生外,学位论文一律须用汉语书写。 +学位论文应当用规范汉字进行撰写,除古汉语研究中涉及的古文字和参考文献中引用的外文文献之外,均采用简体汉字撰写。 + +国际研究生一般应以中文或英文书写学位论文,格式要求同上。 +论文须用中文封面。 + +研究生学位论文是学术作品,因此其表述要严谨简明,重点突出,专业常识应简写或不写,做到立论正确、数据可靠、说明透彻、推理严谨、文字凝练、层次分明,避免使用文学性质的或带感情色彩的非学术性语言。 + +论文中如出现一个非通用性的新名词、新术语或新概念,需随即解释清楚。 + + + +\section{论文题目的写法} + +论文题目应简明扼要地反映论文工作的主要内容,力求精炼、准确,切忌笼统。 +论文题目是对研究对象的准确、具体描述,一般要在一定程度上体现研究结论,因此,论文题目不仅应告诉读者这本论文研究了什么问题,更要告诉读者这个研究得出的结论。 +例如:“在事实与虚构之间:梅乐、卡彭特、沃尔夫的新闻观”就比“三个美国作家的新闻观研究”更专业、更准确。 + + + +\section{摘要的写法} + +论文摘要是对论文研究内容的高度概括,应具有独立性和自含性,即应是 一篇简短但意义完整的文章。 +通过阅读论文摘要,读者应该能够对论文的研究 方法及结论有一个整体性的了解,因此摘要的写法应力求精确简明。 +论文摘要 应包括对问题及研究目的的描述、对使用的方法和研究过程进行的简要介绍、 对研究结论的高度凝练等,重点是结果和结论。 + +论文摘要切忌写成全文的提纲,尤其要避免“第 1 章……;第 2 章……;……”这样的陈述方式。 + + + +\section{引言的写法} + +一篇学位论文的引言大致包含如下几个部分: +1、问题的提出; +2、选题背 景及意义; +3、文献综述; +4、研究方法; +5、论文结构安排。 +\begin{itemize} + \item 问题的提出:要清晰地阐述所要研究的问题“是什么”。 + \footnote{选题时切记要有“问题意识”,不要选不是问题的问题来研究。} + \item 选题背景及意义:论述清楚为什么选择这个题目来研究,即阐述该研究对学科发展的贡献、对国计民生的理论与现实意义等。 + \item 文献综述:对本研究主题范围内的文献进行详尽的综合述评,“述”的同时一定要有“评”,指出现有研究状态,仍存在哪些尚待解决的问题,讲出自己的研究有哪些探索性内容。 + \item 研究方法:讲清论文所使用的学术研究方法。 + \item 论文结构安排:介绍本论文的写作结构安排。 +\end{itemize} + + + +\section{正文的写法} + +本部分是论文作者的研究内容,不能将他人研究成果不加区分地掺和进来。 +已经在引言的文献综述部分讲过的内容,这里不需要再重复。 +各章之间要存在有机联系,符合逻辑顺序。 + + + +\section{结论的写法} + +结论是对论文主要研究结果、论点的提炼与概括,应精炼、准确、完整,使读者看后能全面了解论文的意义、目的和工作内容。 +结论是最终的、总体的结论,不是正文各章小结的简单重复。 +结论应包括论文的核心观点,主要阐述作者的创造性工作及所取得的研究成果在本领域中的地位、作用和意义,交代研究工作的局限,提出未来工作的意见或建议。 +同时,要严格区分自己取得的成果与指导教师及他人的学术成果。 + +在评价自己的研究工作成果时,要实事求是,除非有足够的证据表明自己的研究是“首次”、“领先”、“填补空白”的,否则应避免使用这些或类似词语。 diff --git a/data/chap02.tex b/data/chap02.tex new file mode 100644 index 0000000..78efa90 --- /dev/null +++ b/data/chap02.tex @@ -0,0 +1,149 @@ +% !TEX root = ../thuthesis-example.tex + +\chapter{图表示例} + +\section{插图} + +图片通常在 \env{figure} 环境中使用 \cs{includegraphics} 插入,如图~\ref{fig:example} 的源代码。 +建议矢量图片使用 PDF 格式,比如数据可视化的绘图; +照片应使用 JPG 格式; +其他的栅格图应使用无损的 PNG 格式。 +注意,LaTeX 不支持 TIFF 格式;EPS 格式已经过时。 + +\begin{figure} + \centering + \includegraphics[width=0.5\linewidth]{example-image-a.pdf} + \caption*{国外的期刊习惯将图表的标题和说明文字写成一段,需要改写为标题只含图表的名称,其他说明文字以注释方式写在图表下方,或者写在正文中。} + \caption{示例图片标题} + \label{fig:example} +\end{figure} + +若图或表中有附注,采用英文小写字母顺序编号,附注写在图或表的下方。 +国外的期刊习惯将图表的标题和说明文字写成一段,需要改写为标题只含图表的名称,其他说明文字以注释方式写在图表下方,或者写在正文中。 + +如果一个图由两个或两个以上分图组成时,各分图分别以 (a)、(b)、(c)...... 作为图序,并须有分图题。 +推荐使用 \pkg{subcaption} 宏包来处理, 比如图~\ref{fig:subfig-a} 和图~\ref{fig:subfig-b}。 + +\begin{figure} + \centering + \subcaptionbox{分图 A\label{fig:subfig-a}} + {\includegraphics[width=0.35\linewidth]{example-image-a.pdf}} + \subcaptionbox{分图 B\label{fig:subfig-b}} + {\includegraphics[width=0.35\linewidth]{example-image-b.pdf}} + \caption{多个分图的示例} + \label{fig:multi-image} +\end{figure} + + + +\section{表格} + +表应具有自明性。表中参数应标明量和单位的符号。 +为使表格简洁易读,均采用三线表(例如表~\ref{tab:three-line})。 +必要时可加辅助线,三线表无法清晰表达时可采用其他格式。 + +表序与表题置于表的上方。表单元格中的文字一般应居中书写(上下居中,左右居中), +不宜左右居中书写的,可采取两端对齐的方式书写。 + +\begin{table} + \centering + \caption{三线表示例} + \begin{tabular}{cc} + \toprule + 文件名 & 描述 \\ + \midrule + thuthesis.dtx & 模板的源文件,包括文档和注释 \\ + thuthesis.cls & 模板文件 \\ + thuthesis-*.bst & BibTeX 参考文献表样式文件 \\ + \bottomrule + \end{tabular} + \label{tab:three-line} +\end{table} + +若表中有附注,采用英文小写字母顺序编号,附注写在表的下方。 +推荐使用 \pkg{threeparttable} 宏包。 + +\begin{table} + \centering + \begin{threeparttable}[c] + \caption{带附注的表格示例} + \label{tab:three-part-table} + \begin{tabular}{cc} + \toprule + 文件名 & 描述 \\ + \midrule + thuthesis.dtx\tnote{a} & 模板的源文件,包括文档和注释 \\ + thuthesis.cls\tnote{b} & 模板文件 \\ + thuthesis-*.bst & BibTeX 参考文献表样式文件 \\ + \bottomrule + \end{tabular} + \begin{tablenotes} + \item [a] 可以通过 xelatex 编译生成模板的使用说明文档; + 使用 xetex 编译 \file{thuthesis.ins} 时则会从 \file{.dtx} 中去除掉文档和注释,得到精简的 \file{.cls} 文件。 + \item [b] 更新模板时,一定要记得编译生成 \file{.cls} 文件,否则编译论文时载入的依然是旧版的模板。 + \end{tablenotes} + \end{threeparttable} +\end{table} + +如某个表需要转页接排,可以“续表”的形式另页打印,格式同前,只需在每页表序前加“续”字即可。 +续表均应重复表头。 +推荐使用 \pkg{longtable} 宏包。 + +\begin{longtable}{cccc} + \caption{跨页长表格的表题} + \label{tab:longtable} \\ + \toprule + 表头 1 & 表头 2 & 表头 3 & 表头 4 \\ + \midrule + \endfirsthead + \caption*{续表~\thetable\quad 跨页长表格的表题} \\ + \toprule + 表头 1 & 表头 2 & 表头 3 & 表头 4 \\ + \midrule + \endhead + \bottomrule + \endfoot + Row 1 & & & \\ + Row 2 & & & \\ + Row 3 & & & \\ + Row 4 & & & \\ + Row 5 & & & \\ + Row 6 & & & \\ + Row 7 & & & \\ + Row 8 & & & \\ + Row 9 & & & \\ + Row 10 & & & \\ +\end{longtable} + + + +\section{算法} + +算法环境可以使用 \pkg{algorithms} 或者 \pkg{algorithm2e} 宏包。 + +\renewcommand{\algorithmicrequire}{\textbf{输入:}\unskip} +\renewcommand{\algorithmicensure}{\textbf{输出:}\unskip} + +\begin{algorithm} + \caption{Calculate $y = x^n$} + \label{alg1} + \small + \begin{algorithmic} + \REQUIRE $n \geq 0$ + \ENSURE $y = x^n$ + + \STATE $y \leftarrow 1$ + \STATE $X \leftarrow x$ + \STATE $N \leftarrow n$ + + \WHILE{$N \neq 0$} + \IF{$N$ is even} + \STATE $X \leftarrow X \times X$ + \STATE $N \leftarrow N / 2$ + \ELSE[$N$ is odd] + \STATE $y \leftarrow y \times X$ + \STATE $N \leftarrow N - 1$ + \ENDIF + \ENDWHILE + \end{algorithmic} +\end{algorithm} diff --git a/data/chap03.tex b/data/chap03.tex new file mode 100644 index 0000000..71952a7 --- /dev/null +++ b/data/chap03.tex @@ -0,0 +1,97 @@ +% !TEX root = ../thuthesis-example.tex + +\chapter{数学符号和公式} + +\section{数学符号} + +中文论文的数学符号默认遵循 GB/T 3102.11—1993《物理科学和技术中使用的数学符号》 +\footnote{原 GB 3102.11—1993,自 2017 年 3 月 23 日起,该标准转为推荐性标准。}。 +该标准参照采纳 ISO 31-11:1992 \footnote{目前已更新为 ISO 80000-2:2019。}, +但是与 \TeX{} 默认的美国数学学会(AMS)的符号习惯有所区别。 +具体地来说主要有以下差异: +\begin{enumerate} + \item 大写希腊字母默认为斜体,如 + \begin{equation*} + \Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega. + \end{equation*} + 注意有限增量符号 $\increment$ 固定使用正体,模板提供了 \cs{increment} 命令。 + \item 小于等于号和大于等于号使用倾斜的字形 $\le$、$\ge$。 + \item 积分号使用正体,比如 $\int$、$\oint$。 + \item + 偏微分符号 $\partial$ 使用正体。 + \item + 省略号 \cs{dots} 按照中文的习惯固定居中,比如 + \begin{equation*} + 1, 2, \dots, n \quad 1 + 2 + \dots + n. + \end{equation*} + \item + 实部 $\Re$ 和虚部 $\Im$ 的字体使用罗马体。 +\end{enumerate} + +以上数学符号样式的差异可以在模板中统一设置。 +另外国标还有一些与 AMS 不同的符号使用习惯,需要用户在写作时进行处理: +\begin{enumerate} + \item 数学常数和特殊函数名用正体,如 + \begin{equation*} + \uppi = 3.14\dots; \quad + \symup{i}^2 = -1; \quad + \symup{e} = \lim_{n \to \infty} \left( 1 + \frac{1}{n} \right)^n. + \end{equation*} + \item 微分号使用正体,比如 $\dif y / \dif x$。 + \item 向量、矩阵和张量用粗斜体(\cs{symbf}),如 $\symbf{x}$、$\symbf{\Sigma}$、$\symbfsf{T}$。 + \item 自然对数用 $\ln x$ 不用 $\log x$。 +\end{enumerate} + + +英文论文的数学符号使用 \TeX{} 默认的样式。 +如果有必要,也可以通过设置 \verb|math-style| 选择数学符号样式。 + +关于量和单位推荐使用 +\href{http://mirrors.ctan.org/macros/latex/contrib/siunitx/siunitx.pdf}{\pkg{siunitx}} +宏包, +可以方便地处理希腊字母以及数字与单位之间的空白, +比如: +\SI{6.4e6}{m}, +\SI{9}{\micro\meter}, +\si{kg.m.s^{-1}}, +\SIrange{10}{20}{\degreeCelsius}。 + + + +\section{数学公式} + +数学公式可以使用 \env{equation} 和 \env{equation*} 环境。 +注意数学公式的引用应前后带括号,通常使用 \cs{eqref} 命令,比如式\eqref{eq:example}。 +\begin{equation} + \frac{1}{2 \uppi \symup{i}} \int_\gamma f = \sum_{k=1}^m n(\gamma; a_k) \mathscr{R}(f; a_k). + \label{eq:example} +\end{equation} + +多行公式尽可能在“=”处对齐,推荐使用 \env{align} 环境。 +\begin{align} + a & = b + c + d + e \\ + & = f + g +\end{align} + + + +\section{数学定理} + +定理环境的格式可以使用 \pkg{amsthm} 或者 \pkg{ntheorem} 宏包配置。 +用户在导言区载入这两者之一后,模板会自动配置 \env{theorem}、\env{proof} 等环境。 + +\begin{theorem}[Lindeberg--Lévy 中心极限定理] + 设随机变量 $X_1, X_2, \dots, X_n$ 独立同分布, 且具有期望 $\mu$ 和有限的方差 $\sigma^2 \ne 0$, + 记 $\bar{X}_n = \frac{1}{n} \sum_{i+1}^n X_i$,则 + \begin{equation} + \lim_{n \to \infty} P \left(\frac{\sqrt{n} \left( \bar{X}_n - \mu \right)}{\sigma} \le z \right) = \Phi(z), + \end{equation} + 其中 $\Phi(z)$ 是标准正态分布的分布函数。 +\end{theorem} +\begin{proof} + Trivial. +\end{proof} + +同时模板还提供了 \env{assumption}、\env{definition}、\env{proposition}、 +\env{lemma}、\env{theorem}、\env{axiom}、\env{corollary}、\env{exercise}、 +\env{example}、\env{remar}、\env{problem}、\env{conjecture} 这些相关的环境。 diff --git a/data/chap04.tex b/data/chap04.tex new file mode 100644 index 0000000..a2dd4ef --- /dev/null +++ b/data/chap04.tex @@ -0,0 +1,76 @@ +% !TEX root = ../thuthesis-example.tex + +\chapter{引用文献的标注} + +模板支持 BibTeX 和 BibLaTeX 两种方式处理参考文献。 +下文主要介绍 BibTeX 配合 \pkg{natbib} 宏包的主要使用方法。 + + +\section{顺序编码制} + +在顺序编码制下,默认的 \cs{cite} 命令同 \cs{citep} 一样,序号置于方括号中, +引文页码会放在括号外。 +统一处引用的连续序号会自动用短横线连接。 + +\thusetup{ + cite-style = super, +} +\noindent +\begin{tabular}{l@{\quad$\Rightarrow$\quad}l} + \verb|\cite{zhangkun1994}| & \cite{zhangkun1994} \\ + \verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\ + \verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\ + \verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} \\ + \verb|\cite{zhangkun1994,zhukezhen1973}| & \cite{zhangkun1994,zhukezhen1973} \\ +\end{tabular} + + +也可以取消上标格式,将数字序号作为文字的一部分。 +建议全文统一使用相同的格式。 + +\thusetup{ + cite-style = inline, +} +\noindent +\begin{tabular}{l@{\quad$\Rightarrow$\quad}l} + \verb|\cite{zhangkun1994}| & \cite{zhangkun1994} \\ + \verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\ + \verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\ + \verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} \\ + \verb|\cite{zhangkun1994,zhukezhen1973}| & \cite{zhangkun1994,zhukezhen1973} \\ +\end{tabular} + + + +\section{著者-出版年制} + +著者-出版年制下的 \cs{cite} 跟 \cs{citet} 一样。 + +\thusetup{ + cite-style = author-year, +} +\noindent +\begin{tabular}{@{}l@{$\Rightarrow$}l@{}} + \verb|\cite{zhangkun1994}| & \cite{zhangkun1994} \\ + \verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\ + \verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\ + \verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} \\ + \verb|\citep{zhangkun1994,zhukezhen1973}| & \citep{zhangkun1994,zhukezhen1973} \\ +\end{tabular} + +\vskip 2ex +\thusetup{ + cite-style = super, +} +注意,引文参考文献的每条都要在正文中标注 +\cite{zhangkun1994,zhukezhen1973,dupont1974bone,zhengkaiqing1987,% + jiangxizhou1980,jianduju1994,merkt1995rotational,mellinger1996laser,% + bixon1996dynamics,mahui1995,carlson1981two,taylor1983scanning,% + taylor1981study,shimizu1983laser,atkinson1982experimental,% + kusch1975perturbations,guangxi1993,huosini1989guwu,wangfuzhi1865songlun,% + zhaoyaodong1998xinshidai,biaozhunhua2002tushu,chubanzhuanye2004,% + who1970factors,peebles2001probability,baishunong1998zhiwu,% + weinstein1974pathogenic,hanjiren1985lun,dizhi1936dizhi,% + tushuguan1957tushuguanxue,aaas1883science,fugang2000fengsha,% + xiaoyu2001chubanye,oclc2000about,scitor2000project% +}。 diff --git a/data/comments.tex b/data/comments.tex new file mode 100644 index 0000000..8304a7c --- /dev/null +++ b/data/comments.tex @@ -0,0 +1,10 @@ +% !TEX root = ../thuthesis-example.tex + +\begin{comments} +% \begin{comments}[name = {指导小组评语}] +% \begin{comments}[name = {Comments from Thesis Supervisor}] +% \begin{comments}[name = {Comments from Thesis Supervision Committee}] + + 论文提出了…… + +\end{comments} diff --git a/data/committee.tex b/data/committee.tex new file mode 100644 index 0000000..711dbd6 --- /dev/null +++ b/data/committee.tex @@ -0,0 +1,49 @@ +% !TEX root = ../thuthesis-example.tex + +\begin{committee}[name={学位论文指导小组、公开评阅人和答辩委员会名单}] + + \newcolumntype{C}[1]{@{}>{\centering\arraybackslash}p{#1}} + + \section*{指导小组名单} + + \begin{center} + \begin{tabular}{C{3cm}C{3cm}C{9cm}@{}} + 李XX & 教授 & 清华大学 \\ + 王XX & 副教授 & 清华大学 \\ + 张XX & 助理教授 & 清华大学 \\ + \end{tabular} + \end{center} + + + \section*{公开评阅人名单} + + \begin{center} + \begin{tabular}{C{3cm}C{3cm}C{9cm}@{}} + 刘XX & 教授 & 清华大学 \\ + 陈XX & 副教授 & XXXX大学 \\ + 杨XX & 研究员 & 中国XXXX科学院XXXXXXX研究所 \\ + \end{tabular} + \end{center} + + + \section*{答辩委员会名单} + + \begin{center} + \begin{tabular}{C{2.75cm}C{2.98cm}C{4.63cm}C{4.63cm}@{}} + 主席 & 赵XX & 教授 & 清华大学 \\ + 委员 & 刘XX & 教授 & 清华大学 \\ + & \multirow{2}{*}{杨XX} & \multirow{2}{*}{研究员} & 中国XXXX科学院 \\ + & & & XXXXXXX研究所 \\ + & 黄XX & 教授 & XXXX大学 \\ + & 周XX & 副教授 & XXXX大学 \\ + 秘书 & 吴XX & 助理研究员 & 清华大学 \\ + \end{tabular} + \end{center} + +\end{committee} + + + +% 也可以导入 Word 版转的 PDF 文件 +% \begin{committee}[file=figures/committee.pdf] +% \end{committee} diff --git a/data/denotation.tex b/data/denotation.tex new file mode 100644 index 0000000..b18776c --- /dev/null +++ b/data/denotation.tex @@ -0,0 +1,93 @@ +% !TEX root = ../thuthesis-example.tex + +\begin{denotation}[3cm] + \item[PI] 聚酰亚胺 + \item[MPI] 聚酰亚胺模型化合物,N-苯基邻苯酰亚胺 + \item[PBI] 聚苯并咪唑 + \item[MPBI] 聚苯并咪唑模型化合物,N-苯基苯并咪唑 + \item[PY] 聚吡咙 + \item[PMDA-BDA] 均苯四酸二酐与联苯四胺合成的聚吡咙薄膜 + \item[MPY] 聚吡咙模型化合物 + \item[As-PPT] 聚苯基不对称三嗪 + \item[MAsPPT] 聚苯基不对称三嗪单模型化合物,3,5,6-三苯基-1,2,4-三嗪 + \item[DMAsPPT] 聚苯基不对称三嗪双模型化合物(水解实验模型化合物) + \item[S-PPT] 聚苯基对称三嗪 + \item[MSPPT] 聚苯基对称三嗪模型化合物,2,4,6-三苯基-1,3,5-三嗪 + \item[PPQ] 聚苯基喹噁啉 + \item[MPPQ] 聚苯基喹噁啉模型化合物,3,4-二苯基苯并二嗪 + \item[HMPI] 聚酰亚胺模型化合物的质子化产物 + \item[HMPY] 聚吡咙模型化合物的质子化产物 + \item[HMPBI] 聚苯并咪唑模型化合物的质子化产物 + \item[HMAsPPT] 聚苯基不对称三嗪模型化合物的质子化产物 + \item[HMSPPT] 聚苯基对称三嗪模型化合物的质子化产物 + \item[HMPPQ] 聚苯基喹噁啉模型化合物的质子化产物 + \item[PDT] 热分解温度 + \item[HPLC] 高效液相色谱(High Performance Liquid Chromatography) + \item[HPCE] 高效毛细管电泳色谱(High Performance Capillary lectrophoresis) + \item[LC-MS] 液相色谱-质谱联用(Liquid chromatography-Mass Spectrum) + \item[TIC] 总离子浓度(Total Ion Content) + \item[\textit{ab initio}] 基于第一原理的量子化学计算方法,常称从头算法 + \item[DFT] 密度泛函理论(Density Functional Theory) + \item[$E_a$] 化学反应的活化能(Activation Energy) + \item[ZPE] 零点振动能(Zero Vibration Energy) + \item[PES] 势能面(Potential Energy Surface) + \item[TS] 过渡态(Transition State) + \item[TST] 过渡态理论(Transition State Theory) + \item[$\increment G^\neq$] 活化自由能(Activation Free Energy) + \item[$\kappa$] 传输系数(Transmission Coefficient) + \item[IRC] 内禀反应坐标(Intrinsic Reaction Coordinates) + \item[$\nu_i$] 虚频(Imaginary Frequency) + \item[ONIOM] 分层算法(Our own N-layered Integrated molecular Orbital and molecular Mechanics) + \item[SCF] 自洽场(Self-Consistent Field) + \item[SCRF] 自洽反应场(Self-Consistent Reaction Field) +\end{denotation} + + + +% 也可以使用 nomencl 宏包,需要在导言区 +% \usepackage{nomencl} +% \makenomenclature + +% 在这里输出符号说明 +% \printnomenclature[3cm] + +% 在正文中的任意为都可以标题 +% \nomenclature{PI}{聚酰亚胺} +% \nomenclature{MPI}{聚酰亚胺模型化合物,N-苯基邻苯酰亚胺} +% \nomenclature{PBI}{聚苯并咪唑} +% \nomenclature{MPBI}{聚苯并咪唑模型化合物,N-苯基苯并咪唑} +% \nomenclature{PY}{聚吡咙} +% \nomenclature{PMDA-BDA}{均苯四酸二酐与联苯四胺合成的聚吡咙薄膜} +% \nomenclature{MPY}{聚吡咙模型化合物} +% \nomenclature{As-PPT}{聚苯基不对称三嗪} +% \nomenclature{MAsPPT}{聚苯基不对称三嗪单模型化合物,3,5,6-三苯基-1,2,4-三嗪} +% \nomenclature{DMAsPPT}{聚苯基不对称三嗪双模型化合物(水解实验模型化合物)} +% \nomenclature{S-PPT}{聚苯基对称三嗪} +% \nomenclature{MSPPT}{聚苯基对称三嗪模型化合物,2,4,6-三苯基-1,3,5-三嗪} +% \nomenclature{PPQ}{聚苯基喹噁啉} +% \nomenclature{MPPQ}{聚苯基喹噁啉模型化合物,3,4-二苯基苯并二嗪} +% \nomenclature{HMPI}{聚酰亚胺模型化合物的质子化产物} +% \nomenclature{HMPY}{聚吡咙模型化合物的质子化产物} +% \nomenclature{HMPBI}{聚苯并咪唑模型化合物的质子化产物} +% \nomenclature{HMAsPPT}{聚苯基不对称三嗪模型化合物的质子化产物} +% \nomenclature{HMSPPT}{聚苯基对称三嗪模型化合物的质子化产物} +% \nomenclature{HMPPQ}{聚苯基喹噁啉模型化合物的质子化产物} +% \nomenclature{PDT}{热分解温度} +% \nomenclature{HPLC}{高效液相色谱(High Performance Liquid Chromatography)} +% \nomenclature{HPCE}{高效毛细管电泳色谱(High Performance Capillary lectrophoresis)} +% \nomenclature{LC-MS}{液相色谱-质谱联用(Liquid chromatography-Mass Spectrum)} +% \nomenclature{TIC}{总离子浓度(Total Ion Content)} +% \nomenclature{\textit{ab initio}}{基于第一原理的量子化学计算方法,常称从头算法} +% \nomenclature{DFT}{密度泛函理论(Density Functional Theory)} +% \nomenclature{$E_a$}{化学反应的活化能(Activation Energy)} +% \nomenclature{ZPE}{零点振动能(Zero Vibration Energy)} +% \nomenclature{PES}{势能面(Potential Energy Surface)} +% \nomenclature{TS}{过渡态(Transition State)} +% \nomenclature{TST}{过渡态理论(Transition State Theory)} +% \nomenclature{$\increment G^\neq$}{活化自由能(Activation Free Energy)} +% \nomenclature{$\kappa$}{传输系数(Transmission Coefficient)} +% \nomenclature{IRC}{内禀反应坐标(Intrinsic Reaction Coordinates)} +% \nomenclature{$\nu_i$}{虚频(Imaginary Frequency)} +% \nomenclature{ONIOM}{分层算法(Our own N-layered Integrated molecular Orbital and molecular Mechanics)} +% \nomenclature{SCF}{自洽场(Self-Consistent Field)} +% \nomenclature{SCRF}{自洽反应场(Self-Consistent Reaction Field)} diff --git a/data/resolution.tex b/data/resolution.tex new file mode 100644 index 0000000..7c4e310 --- /dev/null +++ b/data/resolution.tex @@ -0,0 +1,19 @@ +% !TEX root = ../thuthesis-example.tex + +\begin{resolution} + + 论文提出了…… + + 论文取得的主要创新性成果包括: + + 1. …… + + 2. …… + + 3. …… + + 论文工作表明作者在×××××具有×××××知识,具有××××能力,论文××××,答辩××××。 + + 答辩委员会表决,(×票/一致)同意通过论文答辩,并建议授予×××(姓名)×××(门类)学博士/硕士学位。 + +\end{resolution} diff --git a/data/resume.tex b/data/resume.tex new file mode 100644 index 0000000..feeb7b5 --- /dev/null +++ b/data/resume.tex @@ -0,0 +1,66 @@ +% !TEX root = ../thuthesis-example.tex + +\begin{resume} + + \section*{个人简历} + + 197× 年 ×× 月 ×× 日出生于四川××县。 + + 1992 年 9 月考入××大学化学系××化学专业,1996 年 7 月本科毕业并获得理学学士学位。 + + 1996 年 9 月免试进入清华大学化学系攻读××化学博士至今。 + + + \section*{在学期间完成的相关学术成果} + + \subsection*{学术论文} + + \begin{achievements} + \item Yang Y, Ren T L, Zhang L T, et al. Miniature microphone with silicon-based ferroelectric thin films[J]. Integrated Ferroelectrics, 2003, 52:229-235. + \item 杨轶, 张宁欣, 任天令, 等. 硅基铁电微声学器件中薄膜残余应力的研究[J]. 中国机械工程, 2005, 16(14):1289-1291. + \item 杨轶, 张宁欣, 任天令, 等. 集成铁电器件中的关键工艺研究[J]. 仪器仪表学报, 2003, 24(S4):192-193. + \item Yang Y, Ren T L, Zhu Y P, et al. PMUTs for handwriting recognition. In press[J]. (已被Integrated Ferroelectrics录用) + \end{achievements} + + + \subsection*{专利} + + \begin{achievements} + \item 任天令, 杨轶, 朱一平, 等. 硅基铁电微声学传感器畴极化区域控制和电极连接的方法: 中国, CN1602118A[P]. 2005-03-30. + \item Ren T L, Yang Y, Zhu Y P, et al. Piezoelectric micro acoustic sensor based on ferroelectric materials: USA, No.11/215, 102[P]. (美国发明专利申请号.) + \end{achievements} + +\end{resume} + + + +% 本科生格式: + +% \begin{resume} +% \section*{学术论文} +% +% \begin{achievements} +% \item ZHOU R, HU C, OU T, et al. Intelligent GRU-RIC Position-Loop +% Feedforward Compensation Control Method with Application to an +% Ultraprecision Motion Stage[J], IEEE Transactions on Industrial +% Informatics, 2024, 20(4): 5609-5621. +% +% \item 杨轶, 张宁欣, 任天令, 等. 硅基铁电微声学器件中薄膜残余应力的研究[J]. +% 中国机械工程, 2005, 16(14):1289-1291. +% +% \item YANG Y, REN T L, ZHU Y P, et al. PMUTs for handwriting recognition. +% In press[J]. (已被Integrated Ferroelectrics录用) +% +% \end{achievements} +% +% +% \section*{专利} +% +% \begin{achievements} +% \item 胡楚雄, 付宏, 朱煜, 等. 一种磁悬浮平面电机: ZL202011322520.6[P]. 2022-04-01. +% +% \item REN T L, YANG Y, ZHU Y P, et al. Piezoelectric micro acoustic sensor +% based on ferroelectric materials: No.11/215, 102[P]. (美国发明专利申请号.) +% +% \end{achievements} +% \end{resume} diff --git a/figures/committee.pdf b/figures/committee.pdf new file mode 100644 index 0000000..37f210a Binary files /dev/null and b/figures/committee.pdf differ diff --git a/figures/example-image-a.pdf b/figures/example-image-a.pdf new file mode 100644 index 0000000..6d7ecb8 Binary files /dev/null and b/figures/example-image-a.pdf differ diff --git a/figures/example-image-b.pdf b/figures/example-image-b.pdf new file mode 100644 index 0000000..7b404af Binary files /dev/null and b/figures/example-image-b.pdf differ diff --git a/figures/scan-copyright.pdf b/figures/scan-copyright.pdf new file mode 100644 index 0000000..9d5c5a5 Binary files /dev/null and b/figures/scan-copyright.pdf differ diff --git a/figures/scan-record.pdf b/figures/scan-record.pdf new file mode 100644 index 0000000..db0dcef Binary files /dev/null and b/figures/scan-record.pdf differ diff --git a/figures/scan-statement.pdf b/figures/scan-statement.pdf new file mode 100644 index 0000000..25e1494 Binary files /dev/null and b/figures/scan-statement.pdf differ diff --git a/latexmkrc b/latexmkrc new file mode 100644 index 0000000..848fd13 --- /dev/null +++ b/latexmkrc @@ -0,0 +1,19 @@ +# vim: set ft=perl: + +$pdf_mode = 5; + +$xelatex = "xelatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -no-pdf -synctex=1 %O %S"; +$lualatex = "lualatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -synctex=1 %O %S"; +$xdvipdfmx = "xdvipdfmx -q -E -o %D %O %S"; + +$bibtex_use = 1.5; + +$clean_ext = "hd loe ptc run.xml synctex.gz thm xdv"; + +$makeindex = "makeindex -s gind.ist %O -o %D %S"; + +add_cus_dep('nlo', 'nls', 0, 'nlo2nls'); +sub nlo2nls { + system("makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\""); +} +push @generated_exts, 'nlo', 'nls'; diff --git a/ref/refs.bib b/ref/refs.bib new file mode 100644 index 0000000..6eb5862 --- /dev/null +++ b/ref/refs.bib @@ -0,0 +1,335 @@ +@article{zhangkun1994, + author = {张昆 and 冯立群 and 余昌钰 and others}, + title = {机器人柔性手腕的球面齿轮设计研究}, + journal = {清华大学学报: 自然科学版}, + volume = {34}, + number = {2}, + pages = {1--7}, + year = {1994}, + key = {zhang1 kun1}, +} + +@book{zhukezhen1973, + author = {竺可桢}, + title = {物理学论}, + address = {北京}, + publisher = {科学出版社}, + year = {1973}, + pages = {56--60}, + key = {zhu2 ke3 zhen1}, +} + +@inproceedings{dupont1974bone, + author = {Dupont, B}, + title = {Bone marrow transplantation in severe combined immunodeficiency with an unrelated MLC compatible donor}, + editor = {White, H J and Smith, R}, + booktitle = {Proceedings of the third annual meeting of the International Society for Experimental Hematology}, + address = {Houston}, + publisher = {International Society for Experimental Hematology}, + year = {1974}, + pages = {44--46}, +} + +@mastersthesis{zhengkaiqing1987, + author = {郑开青}, + title = {通讯系统模拟及软件}, + address = {北京}, + school = {清华大学无线电系}, + year = {1987}, + key = {zheng4 kai1 qing1}, +} + +@patent{jiangxizhou1980, + author = {姜锡洲}, + title = {一种温热外敷药制备方案}, + address = {中国}, + number = {88105607.3}, + year = {1980}, + date = {1980-07-26}, + key = {jiang1 xi1 zhou1}, +} + +@standard{jianduju1994, + author = {中华人民共和国国家技术监督局}, + title = {GB3100-3102. 中华人民共和国国家标准-量与单位}, + address = {北京}, + publisher = {中国标准出版社}, + year = {1994}, + key = {zhong1 hua2 ren2 min2 gong4 he2 guo2}, +} + +@article{merkt1995rotational, + author = {Merkt, Fr{\'e}d{\'e}ric and Mackenzie, S R and Softley, Timothy P}, + title = {Rotational Autoionization Dynamics in High Rydberg States of Nitrogen}, + journal = {J Chem Phys}, + year = {1995}, + volume = {103}, + pages = {4509--4518}, +} + +@article{mellinger1996laser, + author = {Mellinger, A and Vidal, C R and Jungen, {Ch}}, + title = {Laser reduced fluorescence study of the carbon monoxide nd triplet Rydberg series - Experimental results and multichannel quantum defect analysis}, + journal = {J Chem Phys}, + year = {1996}, + volume = {104}, + pages = {8913--8921}, +} + +@article{bixon1996dynamics, + author = {Bixon, M and Jortner, Joshua}, + title = {The dynamics of predissociating high {Rydberg} states of {NO}}, + journal = {J Chem Phys}, + year = {1996}, + volume = {105}, + pages = {1363--1382}, +} + +@article{mahui1995, + author = {马辉 and 李俭 and 刘耀明 and others}, + title = {利用 {REMPI} 方法测量 {BaF} 高里德堡系列光谱}, + journal = {化学物理学报}, + year = {1995}, + volume = {8}, + pages = {308--311}, + key = {ma3 hui1}, +} + +@article{carlson1981two, + author = {Carlson, N W and Taylor, A J and Jones, K M and Schawlow, A L}, + title = {Two-step polarization-labeling spectroscopy of excited states of {Na2}}, + journal = {Phys Rev A}, + year = {1981}, + volume = {24}, + pages = {822--834}, +} + +@article{taylor1983scanning, + author = {Taylor, A J and Jones, K M and Schawlow, A L}, + title = {Scanning pulsed-polarization spectrometer applied to {Na2}}, + journal = {J Opt Soc Am}, + year = {1983}, + volume = {73}, + pages = {994--998}, +} + +@article{taylor1981study, + author = {Taylor, A J and Jones, K M and Schawlow, A L}, + title = {A study of the excited {1$\Sigma$g+} states in {Na2}}, + journal = {Opt Commun}, + year = {1981}, + volume = {39}, + pages = {47--50}, +} + +@article{shimizu1983laser, + author = {Shimizu, Kazuko and Shimizu, Fujio}, + title = {Laser induced fluorescence spectra of the a {3$\Pi$u--X 1$\Sigma$g+} band of {Na2} by molecular beam}, + journal = {J Chem Phys}, + year = {1983}, + volume = {78}, + pages = {1126--1131}, +} + +@article{atkinson1982experimental, + author = {Atkinson, J B and Becker, J and Demtr{\"o}der, W}, + title = {Experimental observation of the a {3$\Pi$u} state of {Na2}}, + journal = {Chem Phys Lett}, + year = {1982}, + volume = {87}, + pages = {92--97}, +} + +@article{kusch1975perturbations, + author = {Kusch, P and Hessel, M M}, + title = {Perturbations in the A {1$\Sigma$u+} state of {Na2}}, + journal = {J Chem Phys}, + year = {1975}, + volume = {63}, + pages = {4087--4088}, +} + +@book{guangxi1993, + author = {广西壮族自治区林业厅}, + title = {广西自然保护区}, + address = {北京}, + publisher = {中国林业出版社}, + year = {1993}, + key = {guang3 xi1 zhuang4 zu2 zi4 zhi4 qu1}, +} + +@book{huosini1989guwu, + author = {霍斯尼}, + title = {谷物科学与工艺学原理}, + translator = {李庆龙}, + edition = {2}, + address = {北京}, + publisher = {中国食品出版社}, + year = {1989}, + pages = {15--20}, + key = {huo4 si1 ni2}, +} + +@book{wangfuzhi1865songlun, + author = {王夫之}, + title = {宋论}, + edition = {刻本}, + address = {金陵}, + publisher = {曾氏}, + year = {1865(清同治四年)}, + key = {wang2 fu1 zhi1}, +} + +@book{zhaoyaodong1998xinshidai, + author = {赵耀东}, + title = {新时代的工业工程师}, + address = {台北}, + publisher = {天下文化出版社}, + year = {1998}, + urldate = {1998-09-26}, + url = {http://www.ie.nthu.edu.tw/info/ie.newie.htm}, + key = {zhao4 yao4 dong1}, +} + +@standard{biaozhunhua2002tushu, + author = {全国信息与文献工作标准化技术委员会出版物格式分委员会}, + title = {GB/T 12450-2001 图书书名页}, + address = {北京}, + publisher = {中国标准出版社}, + year = {2002}, + pages = {1}, + key = {quan2 guo2 xin4 xi1}, +} + +@book{chubanzhuanye2004, + author = {全国出版专业职业资格考试办公室}, + title = {全国出版专业职业资格考试辅导教材: 出版专业理论与实务•中级}, + edition = {2014}, + address = {上海}, + publisher = {上海辞书出版社}, + year = {2004}, + pages = {299--307}, + key = {quan2 guo2 chu1 ban3 ye4}, +} + +@techreport{who1970factors, + author = {{World Health Organization}}, + title = {Factors Regulating the Immune Response: Report of {WHO Scientific Group}}, + address = {Geneva}, + publisher = {WHO}, + year = {1970}, +} + +@book{peebles2001probability, + author = {Peebles, Jr, Peyton Z.}, + title = {Probability, Random Variables, and Random Signal Principles}, + edition = {4}, + address = {New York}, + publisher = {McGraw Hill}, + year = {2001}, +} + +@incollection{baishunong1998zhiwu, + author = {白书农}, + title = {植物开花研究}, + editor = {李承森}, + booktitle = {植物科学进展}, + address = {北京}, + publisher = {高等教育出版社}, + year = {1998}, + pages = {146--163}, + key = {bai2 shu1 nong2}, +} + +@incollection{weinstein1974pathogenic, + author = {Weinstein, L and Swertz, M N}, + title = {Pathogenic Properties of Invading Microorganism}, + editor = {Sodeman, Jr, William A and Sodeman, William A}, + booktitle = {Pathologic physiology: mechanisms of disease}, + address = {Philadelphia}, + publisher = {Saunders}, + year = {1974}, + pages = {745--772}, +} + +@inproceedings{hanjiren1985lun, + author = {韩吉人}, + title = {论职工教育的特点}, + editor = {中国职工教育研究会}, + booktitle = {职工教育研究论文集}, + address = {北京}, + publisher = {人民教育出版社}, + year = {1985}, + pages = {90--99}, + key = {han2 ji2 ren2}, +} + +@periodical{dizhi1936dizhi, + author = {中国地质学会}, + title = {地质评论}, + year = {1936}, + volume = {1}, + number = {1}, + address = {北京}, + publisher = {地质出版社}, + key = {zhong1 guo2 di4 zhi3 xue2 hui4}, +} + +@periodical{tushuguan1957tushuguanxue, + author = {中国图书馆学会}, + title = {图书馆学通讯}, + year = {1957/1990}, + number = {1--4}, + address = {北京}, + publisher = {北京图书馆}, + key = {zhong1 guo2 tu2 shu1 guan3 xue2 hui4}, +} + +@periodical{aaas1883science, + author = {{American Association for the Advancement of Science}}, + title = {Science}, + year = {1883}, + volume = {1}, + number = {1}, + address = {Washington, D.C.}, + publisher = {American Association for the Advancement of Science}, +} + +@newspaper{fugang2000fengsha, + author = {傅刚 and 赵承 and 李佳路}, + title = {大风沙过后的思考}, + journal = {北京青年报}, + year = {2000}, + date = {2000-04-12}, + number = {14}, + urldate = {2002-03-06}, + url = {http://www.bjyouth.com.cn/Bqb/20000412/B/4216%5ED0412B1401.htm}, + key = {fu4 gang1}, +} + +@online{xiaoyu2001chubanye, + author = {萧钰}, + title = {出版业信息化迈入快车道}, + year = {2001}, + date = {2001-12-19}, + urldate = {2002-04-15}, + url = {http://www.creader.com/news/20011219/200112190019.htm}, + key = {xiao1 yu4}, +} + +@online{oclc2000about, + author = {{Online Computer Library Center, Inc}}, + title = {About {OCLC}: History of Cooperation}, + year = {2000}, + urldate = {2000-01-08}, + url = {http://www.oclc.org/about/cooperation.en.htm}, +} + +@software{scitor2000project, + author = {{Scitor Corporation}}, + title = {Project scheduler}, + address = {Sunnyvale, Calif.}, + publisher = {Scitor Corporation}, + year = {1983}, + medium = {DK}, +} diff --git a/thu-fig-logo.pdf b/thu-fig-logo.pdf new file mode 100644 index 0000000..594a342 Binary files /dev/null and b/thu-fig-logo.pdf differ diff --git a/thu-text-logo.pdf b/thu-text-logo.pdf new file mode 100644 index 0000000..7f20baf Binary files /dev/null and b/thu-text-logo.pdf differ diff --git a/thusetup.tex b/thusetup.tex new file mode 100644 index 0000000..6b8172e --- /dev/null +++ b/thusetup.tex @@ -0,0 +1,199 @@ +% !TEX root = ./thuthesis-example.tex + +% 论文基本信息配置 + +\thusetup{ + %****************************** + % 注意: + % 1. 配置里面不要出现空行 + % 2. 不需要的配置信息可以删除 + % 3. 建议先阅读文档中所有关于选项的说明 + %****************************** + % + % 输出格式 + % 选择打印版(print)或用于提交的电子版(electronic),前者会插入空白页以便直接双面打印 + % + output = print, + % 格式类型 + % 默认为论文(thesis),也可以设置为开题报告(proposal) + % thesis-type = proposal, + % + % 标题 + % 可使用“\\”命令手动控制换行 + % + title = {清华大学学位论文 \LaTeX{} 模板\\使用示例文档 v\version}, + title* = {An Introduction to \LaTeX{} Thesis Template of Tsinghua + University v\version}, + % + % 学科门类 + % 1. 学术型 + % - 中文 + % 需注明所属的学科门类,例如: + % 哲学、经济学、法学、教育学、文学、历史学、理学、工学、农学、医学、 + % 军事学、管理学、艺术学 + % - 英文 + % 博士:Doctor of Philosophy + % 硕士: + % 哲学、文学、历史学、法学、教育学、艺术学门类,公共管理学科 + % 填写“Master of Arts“,其它填写“Master of Science” + % 2. 专业型 + % 直接填写专业学位的名称,例如: + % 教育博士、工程硕士等 + % Doctor of Education, Master of Engineering + % 3. 本科生不需要填写 + % + degree-category = {工学硕士}, + degree-category* = {Master of Science}, + % + % 培养单位 + % 填写所属院系的全名 + % + department = {计算机科学与技术系}, + % + % 学科 + % 1. 研究生学术型学位,获得一级学科授权的学科填写一级学科名称,其他填写二级学科名称 + % 2. 本科生填写专业名称,第二学位论文需标注“(第二学位)” + % + discipline = {计算机科学与技术}, + discipline* = {Computer Science and Technology}, + % + % 专业领域 + % 1. 设置专业领域的专业学位类别,填写相应专业领域名称 + % 2. 2019 级及之前工程硕士学位论文,在 `engineering-field` 填写相应工程领域名称 + % 3. 其他专业学位类别的学位论文无需此信息 + % + % professional-field = {计算机技术}, + % professional-field* = {Computer Technology}, + % + % 姓名 + % + author = {薛瑞尼}, + author* = {Xue Ruini}, + % + % 学号 + % 仅当书写开题报告时需要(同时设置 `thesis-type = proposal') + % + % student-id = {2000310000}, + % + % 指导教师 + % 中文姓名和职称之间以英文逗号“,”分开,下同 + % + supervisor = {郑纬民, 教授}, + supervisor* = {Professor Zheng Weimin}, + % + % 副指导教师 + % + associate-supervisor = {陈文光, 教授}, + associate-supervisor* = {Professor Chen Wenguang}, + % + % 联合指导教师 + % + % co-supervisor = {某某某, 教授}, + % co-supervisor* = {Professor Mou Moumou}, + % + % 日期 + % 使用 ISO 格式;默认为当前时间 + % + % date = {2019-07-07}, + % + % 是否在中文封面后的空白页生成书脊(默认 false) + % + include-spine = false, + % + % 密级和年限 + % 秘密, 机密, 绝密 + % + % secret-level = {秘密}, + % secret-year = {10}, + % + % 博士后专有部分 + % + % clc = {分类号}, + % udc = {UDC}, + % id = {编号}, + % discipline-level-1 = {计算机科学与技术}, % 流动站(一级学科)名称 + % discipline-level-2 = {系统结构}, % 专业(二级学科)名称 + % start-date = {2011-07-01}, % 研究工作起始时间 +} + +% 载入所需的宏包 + +% 定理类环境宏包 +\usepackage{amsthm} +% 也可以使用 ntheorem +% \usepackage[amsmath,thmmarks,hyperref]{ntheorem} + +\thusetup{ + % + % 数学字体 + % math-style = GB, % GB | ISO | TeX + math-font = xits, % stix | xits | libertinus +} + +% 可以使用 nomencl 生成符号和缩略语说明 +% \usepackage{nomencl} +% \makenomenclature + +% 表格加脚注 +\usepackage{threeparttable} + +% 表格中支持跨行 +\usepackage{multirow} + +% 固定宽度的表格。 +% \usepackage{tabularx} + +% 跨页表格 +\usepackage{longtable} + +% 算法 +\usepackage{algorithm} +\usepackage{algorithmic} + +% 量和单位 +\usepackage{siunitx} + +% 参考文献使用 BibTeX + natbib 宏包 +% 顺序编码制 +\usepackage[sort]{natbib} +\bibliographystyle{thuthesis-numeric} + +% 著者-出版年制 +% \usepackage{natbib} +% \bibliographystyle{thuthesis-author-year} + +% 生命科学学院要求使用 Cell 参考文献格式(2023 年以前使用 author-date 格式) +% \usepackage{natbib} +% \bibliographystyle{cell} + +% 本科生参考文献的著录格式 +% \usepackage[sort]{natbib} +% \bibliographystyle{thuthesis-bachelor} + +% 参考文献使用 BibLaTeX 宏包 +% \usepackage[style=thuthesis-numeric]{biblatex} +% \usepackage[style=thuthesis-author-year]{biblatex} +% \usepackage[style=thuthesis-bachelor]{biblatex} +% \usepackage[style=apa]{biblatex} +% \usepackage[style=mla-new]{biblatex} + +% 声明 BibLaTeX 的数据库 +% \addbibresource{ref/refs.bib} + +% 定义所有的图片文件在 figures 子目录下 +\graphicspath{{figures/}} + +% 数学命令 +\makeatletter +\newcommand\dif{% % 微分符号 + \mathop{}\!% + \ifthu@math@style@TeX + d% + \else + \mathrm{d}% + \fi +} +\makeatother + +% hyperref 宏包在最后调用 +\usepackage{hyperref} diff --git a/thuthesis-author-year.bbx b/thuthesis-author-year.bbx new file mode 100644 index 0000000..a1973c1 --- /dev/null +++ b/thuthesis-author-year.bbx @@ -0,0 +1,53 @@ +\ProvidesFile{thuthesis-author-year.bbx}[2020/08/01 v1.0 ThuThesis biblatex + bibliography style] + +\RequireBibliographyStyle{gb7714-2015ay} + +\ExecuteBibliographyOptions{ + gbnamefmt = lowercase, + gbpub = false, +} + +\defbibenvironment{bibliography} + {\list + {} + {\setlength{\leftmargin}{\bibhang}% + \setlength{\itemindent}{-\leftmargin}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}} + {\endlist} + {\item} + +% +% 重设专利title的输出,将文献类型标识符输出出去 +% +\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}} + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{} + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + % \setunit{\subtitlepunct}\printfield{number}%写专利号 + \setunit{\subtitlepunct}% + \iflistundef{location}{} + {\printlist{location}\setunit{\addcomma\space}}% 专利国别 + \printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +\clearlist{location}\clearlist{address}% +} + +% 斜线默认使用原字体,不再使用等宽字体 +% +\def\SlashFont{} diff --git a/thuthesis-author-year.bst b/thuthesis-author-year.bst new file mode 100644 index 0000000..03d0286 --- /dev/null +++ b/thuthesis-author-year.bst @@ -0,0 +1,2663 @@ +%% +%% This is file `variants/thu/thuthesis-author-year.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `2015,thu,author-year') +%% ------------------------------------------------------------------- +%% GB/T 7714 BibTeX Style +%% https://github.com/zepinglee/gbt7714-bibtex-style +%% Version: 2024/03/08 v2.1.6 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016--2024 by Zeping Lee +%% ------------------------------------------------------------------- +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% ------------------------------------------------------------------- +INTEGERS { + citation.et.al.min + citation.et.al.use.first + bibliography.et.al.min + bibliography.et.al.use.first + uppercase.name + terms.in.macro + year.after.author + period.after.author + italic.book.title + sentence.case.title + link.title + title.in.journal + show.patent.country + show.mark + space.before.mark + show.medium.type + short.journal + italic.journal + link.journal + bold.journal.volume + show.missing.address.publisher + space.before.pages + only.start.page + wave.dash.in.pages + show.urldate + show.url + show.doi + show.preprint + show.note + show.english.translation + end.with.period + lang.zh.order + lang.ja.order + lang.en.order + lang.ru.order + lang.other.order +} + +STRINGS { + component.part.label +} + +FUNCTION {load.config} +{ + #2 'citation.et.al.min := + #1 'citation.et.al.use.first := + #4 'bibliography.et.al.min := + #3 'bibliography.et.al.use.first := + #0 'uppercase.name := + #0 'terms.in.macro := + #1 'year.after.author := + #0 'period.after.author := + #0 'italic.book.title := + #1 'sentence.case.title := + #0 'link.title := + #1 'title.in.journal := + #1 'show.patent.country := + #1 'show.mark := + #0 'space.before.mark := + #1 'show.medium.type := + "slash" 'component.part.label := + #0 'short.journal := + #0 'italic.journal := + #0 'link.journal := + #0 'bold.journal.volume := + #0 'show.missing.address.publisher := + #1 'space.before.pages := + #0 'only.start.page := + #0 'wave.dash.in.pages := + #1 'show.urldate := + #1 'show.url := + #1 'show.doi := + #1 'show.preprint := + #0 'show.note := + #0 'show.english.translation := + #1 'end.with.period := + #1 'lang.zh.order := + #2 'lang.ja.order := + #3 'lang.en.order := + #4 'lang.ru.order := + #5 'lang.other.order := +} + +ENTRY + { address + archivePrefix + author + booktitle + date + doi + edition + editor + eprint + eprinttype + entrysubtype + howpublished + institution + journal + journaltitle + key + langid + language + location + mark + medium + note + number + organization + pages + publisher + school + series + shortjournal + title + translation + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic is.pure.electronic entry.numbered } + { label extra.label sort.label short.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ entry.lang lang.zh = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "\ " } + { " " } + if$ +} + +FUNCTION {bbl.and} +{ "" } + +FUNCTION {bbl.et.al} +{ entry.lang lang.zh = + { "等" } + { entry.lang lang.ja = + { "他" } + { entry.lang lang.ru = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {citation.and} +{ terms.in.macro + { "{\biband}" } + 'bbl.and + if$ +} + +FUNCTION {citation.et.al} +{ terms.in.macro + { "{\bibetal}" } + 'bbl.et.al + if$ +} + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.pages.colon} +{ space.before.pages + { ": " } + { ":\allowbreak " } + if$ +} + +FUNCTION {bbl.wide.space} { "\quad " } + +FUNCTION {bbl.slash} { "//\allowbreak " } + +FUNCTION {bbl.sine.loco} +{ entry.lang lang.zh = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ entry.lang lang.zh = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ entry.lang lang.zh = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { x y } + +FUNCTION {contains} +{ 'y := + 'x := + y text.length$ 'len := + x text.length$ len - #1 + 'charptr := + { charptr #0 > + x charptr len substring$ y = not + and + } + { charptr #1 - 'charptr := } + while$ + charptr #0 > +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ + newline$ + } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ end.with.period + 'add.period$ + 'skip$ + if$ + write$ + show.english.translation entry.lang lang.zh = and + { ")" + write$ + } + 'skip$ + if$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { component.part.label "slash" = + { after.slash 'output.state := } + { new.block + component.part.label "in" = + { entry.lang lang.en = + { "In: " output + write$ + "" + before.all 'output.state := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "\emph{" swap$ * "}" * } + if$ +} + +FUNCTION {format.btitle} +{ italic.book.title + entry.lang lang.en = and + 'emphasize + 'skip$ + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +STRINGS { entry.langid } + +FUNCTION {set.entry.lang} +{ "" 'entry.langid := + language empty$ not + { language 'entry.langid := } + 'skip$ + if$ + langid empty$ not + { langid 'entry.langid := } + 'skip$ + if$ + entry.langid empty$ + { check.entry.lang } + { entry.langid "english" = entry.langid "american" = or entry.langid "british" = or + { lang.en } + { entry.langid "chinese" = + { lang.zh } + { entry.langid "japanese" = + { lang.ja } + { entry.langid "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.name} +{ "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{ f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ +} + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + "" + numnames 'namesleft := + { namesleft #0 > } + { s nameptr format.name bbl.et.al = + numnames bibliography.et.al.min #1 - > nameptr bibliography.et.al.use.first > and or + { ", " * + bbl.et.al * + #1 'namesleft := + } + { nameptr #1 > + { namesleft #1 = bbl.and "" = not and + { bbl.and * } + { ", " * } + if$ + } + 'skip$ + if$ + s nameptr format.name * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ + bbl.anonymous + } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + entry.lang lang.zh = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label ")" * + make.full.names duplicate$ short.list = + { pop$ } + { duplicate$ "]" contains + { "{" swap$ * "}" * } + 'skip$ + if$ + * + } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{https://doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * + type$ "patent" = show.patent.country and + { address empty$ not + { address * ", " * } + { location empty$ not + { location * ", " * } + { entry.lang lang.zh = + { "中国" * ", " * } + 'skip$ + if$ + } + if$ + } + if$ + } + 'skip$ + if$ + number * + } + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "Vol." volume tie.or.space.connect } + if$ + } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.number} +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "No." number tie.or.space.connect } + if$ + } + { number } + if$ + } + { "" } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + } + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + } + { format.title.vol.num } + if$ + format.btitle + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + entry.numbered not s empty$ not and + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { format.booktitle.vol.num } + if$ + format.btitle +} + +FUNCTION {remove.period} +{ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ 'tmp.str := + tmp.str "." = not + { s tmp.str * 's := } + 'skip$ + if$ + t #2 global.max$ substring$ 't := + } + while$ + s +} + +FUNCTION {abbreviate} +{ remove.period + 't := + t "l" change.case$ 's := + "" + s "physical review letters" = + { "Phys Rev Lett" } + 'skip$ + if$ + 's := + s empty$ + { t } + { pop$ s } + if$ +} + +FUNCTION {get.journal.title} +{ short.journal + { shortjournal empty$ not + { shortjournal } + { journal empty$ not + { journal abbreviate } + { journaltitle empty$ not + { journaltitle abbreviate } + { "" } + if$ + } + if$ + } + if$ + } + { journal empty$ not + { journal } + { journaltitle empty$ not + { journaltitle } + { shortjournal empty$ not + { shortjournal } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {check.arxiv.preprint} +{ #1 #5 substring$ purify$ "l" change.case$ "arxiv" = + { #1 } + { #0 } + if$ +} + +FUNCTION {format.journal} +{ get.journal.title + duplicate$ empty$ not + { italic.journal entry.lang lang.en = and + 'emphasize + 'skip$ + if$ + link.journal + 'add.link + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { entry.mark + show.medium.type + { medium empty$ not + { "/" * medium * } + { entry.is.electronic + { "/OL" * } + 'skip$ + if$ + } + if$ + } + 'skip$ + if$ + 'entry.mark := + space.before.mark + { " " } + { "\allowbreak" } + if$ + "[" * entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { edition "1" = not + { entry.lang lang.zh = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + 'skip$ + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." * } + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address } + { location empty$ not + { location } + { "" } + if$ + } + if$ + duplicate$ empty$ not + { format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { pop$ + entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {extract.before.slash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "/" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.slash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + s charptr #1 substring$ "/" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + s charptr #1 substring$ "/" = + or + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extra.label * } + { date empty$ not + { date extract.before.dash extra.label * } + { entry.is.electronic not + { "empty year in " cite$ * warning$ } + 'skip$ + if$ + urldate empty$ not + { "[" urldate extract.before.dash * extra.label * "]" * } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.periodical.year} +{ year empty$ not + { year extract.before.slash + "--" * + year extract.after.slash + duplicate$ empty$ + 'pop$ + { * } + if$ + } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.date} +{ date empty$ not + { type$ "patent" = type$ "newspaper" = or + { date } + { entrysubtype empty$ not + { type$ "article" = entrysubtype "newspaper" = and + { date } + { format.year } + if$ + } + { format.year } + if$ + } + if$ + } + { year empty$ not + { format.year } + { "" } + if$ + } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ show.urldate show.url and entry.url empty$ not and + is.pure.electronic or + urldate empty$ not and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { wave.dash.in.pages + { "~" * } + { "-" * } + if$ + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.extracted.pages} +{ pages empty$ + { "" } + { pages + only.start.page + 'extract.before.dash + 'hyphenate + if$ + } + if$ +} + +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\allowbreak (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { format.extracted.pages } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.slash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\allowbreak (" * number extract.before.dash * ")" * } + 'skip$ + if$ + "--" * + year extract.after.slash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.slash empty$ not + { year extract.after.slash * } + { year extract.before.slash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\allowbreak (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { url 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {output.url} +{ show.url is.pure.electronic or + entry.url empty$ not and + { new.block + entry.url #1 #5 substring$ "\url{" = + { entry.url } + { "\url{" entry.url * "}" * } + if$ + output + } + 'skip$ + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url "l" change.case$ text.length$ 'charptr := + { entry.url "l" change.case$ charptr len substring$ s "l" change.case$ = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + } + 'skip$ + if$ +} + +FUNCTION {output.doi} +{ doi empty$ not show.doi and + show.english.translation entry.lang lang.zh = and not and + { new.block + format.doi output + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.eprint} +{ archivePrefix empty$ not + { archivePrefix } + { eprinttype empty$ not + { archivePrefix } + { "" } + if$ + } + if$ + 's := + s empty$ not + { s ": \eprint{" * + url empty$ not + { url } + { "https://" s "l" change.case$ * ".org/abs/" * eprint * } + if$ + * "}{" * + eprint * "}" * + } + { eprint } + if$ +} + +FUNCTION {output.eprint} +{ show.preprint eprint empty$ not and + { new.block + format.eprint output + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {output.translation} +{ show.english.translation entry.lang lang.zh = and + { translation empty$ not + { translation } + { "[English translation missing!]" } + if$ + " (in Chinese)" * output + write$ + format.doi duplicate$ empty$ not + { newline$ + write$ + } + 'pop$ + if$ + " \\" write$ + newline$ + "(" write$ + "" + before.all 'output.state := + } + 'skip$ + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + output.translation + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + bbl.anonymous + } + if$ + } + if$ + output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + year.after.author not + { format.year "year" output.check } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + year.after.author not + { format.year "year" output.check } + 'skip$ + if$ + format.extracted.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + year.after.author not + { format.periodical.year "year" output.check } + 'skip$ + if$ + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {journal.article} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + title.in.journal + { format.title "title" output.check + entrysubtype empty$ not + { + entrysubtype "newspaper" = + { "N" set.entry.mark } + { "J" set.entry.mark } + if$ + } + { "J" set.entry.mark } + if$ + format.mark "" output.after + new.block + } + 'skip$ + if$ + format.journal "journal" output.check + year.after.author not + { format.date "year" output.check } + 'skip$ + if$ + format.journal.volume output + format.journal.number "" output.after + format.journal.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + #1 'is.pure.electronic := + output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + year.after.author not + { date empty$ + { format.date output } + 'skip$ + if$ + } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.editdate "" output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {preprint} +{ output.bibitem + output.translation + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + bbl.anonymous + } + if$ + } + if$ + output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + title.in.journal + { format.series.vol.num.title "title" output.check + "A" set.entry.mark + format.mark "" output.after + new.block + } + 'skip$ + if$ + format.translators output + new.sentence + format.edition output + new.block + year.after.author not + { date empty$ + { format.date output } + 'skip$ + if$ + } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.editdate "" output.after + format.urldate "" output.after + output.eprint + output.url + show.preprint not eprint empty$ or + 'output.doi + 'skip$ + if$ + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ get.journal.title + duplicate$ empty$ not + { check.arxiv.preprint + 'preprint + 'journal.article + if$ + } + { pop$ + booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { eprint empty$ not archivePrefix empty$ not or + 'preprint + { entry.is.electronic + 'electronic + { + "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {article} { misc } + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { + booktitle empty$ + 'book + 'incollection + if$ +} + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {legislation} { archive } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ "D" set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} { mastersthesis } + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} { misc } + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.name} +{ "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t "others" = + { citation.et.al } + { t get.str.lang 'name.lang := + name.lang lang.zh = name.lang lang.ja = or + { t #1 "{ll}{ff}" format.name$ } + { t #1 "{vv~}{ll}" format.name$ } + if$ + } + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 format.lab.name 'short.label := + #1 'nameptr := + s num.names$ 'numnames := + "" + numnames 'namesleft := + { namesleft #0 > } + { s nameptr format.lab.name citation.et.al = + numnames citation.et.al.min #1 - > nameptr citation.et.al.use.first > and or + { bbl.space * + citation.et.al * + #1 'namesleft := + } + { nameptr #1 > + { namesleft #1 = citation.and "" = not and + { citation.and * } + { ", " * } + if$ + } + 'skip$ + if$ + s nameptr format.lab.name * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ "" 'short.label := + type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := + short.label empty$ + { short.list 'short.label := } + 'skip$ + if$ +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list "]" contains + { "{" short.list * "}" * } + { short.list } + if$ + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + duplicate$ "]" contains + { "{" swap$ * "}" * } + 'skip$ + if$ + * + 'label := + short.label + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'short.label := +} + +FUNCTION {sort.language.label} +{ entry.lang lang.zh = + { lang.zh.order } + { entry.lang lang.ja = + { lang.ja.order } + { entry.lang lang.en = + { lang.en.order } + { entry.lang lang.ru = + { lang.ru.order } + { lang.other.order } + if$ + } + if$ + } + if$ + } + if$ + #64 + + int.to.chr$ +} + +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { + s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := + nameptr #1 > + { + " " * + namesleft #1 = t "others" = and + { "zzzzz" * } + { numnames #2 > nameptr #2 = and + { "zz" * year field.or.null * " " * } + 'skip$ + if$ + t sortify * + } + if$ + } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +FUNCTION {anonymous.sort} +{ entry.lang lang.zh = + { "yi4 ming2" } + { "anon" } + if$ +} + +FUNCTION {warn.empty.key} +{ entry.lang lang.zh = + { "empty key in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {author.sort} +{ key empty$ + { warn.empty.key + author empty$ + { anonymous.sort } + { author sort.format.names } + if$ + } + { key } + if$ +} + +FUNCTION {author.editor.sort} +{ key empty$ + { warn.empty.key + author empty$ + { editor empty$ + { anonymous.sort } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ + } + { key } + if$ +} + +FUNCTION {author.organization.sort} +{ key empty$ + { warn.empty.key + author empty$ + { organization empty$ + { anonymous.sort } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ + } + { key } + if$ +} + +FUNCTION {editor.organization.sort} +{ key empty$ + { warn.empty.key + editor empty$ + { organization empty$ + { anonymous.sort } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ + } + { key } + if$ +} + +FUNCTION {presort} +{ set.entry.lang + set.entry.numbered + show.url show.doi check.electronic + #0 'is.pure.electronic := + calc.label + label sortify + " " + * + sort.language.label + " " + * + type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.sort + { type$ "collection" = + type$ "proceedings" = + or + 'editor.organization.sort + 'author.sort + if$ + } + if$ + * + " " + * + year field.or.null sortify + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra last.extra.label } + +INTEGERS { longest.label.width number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'number.label := + "" 'last.extra.label := +} + +FUNCTION {forward.pass} +{ + last.label short.label = + { "" 'extra.label := + last.extra.label text.length$ 'charptr := + { last.extra.label charptr #1 substring$ "z" = + charptr #0 > and + } + { "a" extra.label * 'extra.label := + charptr #1 - 'charptr := + } + while$ + charptr #0 > + { last.extra.label charptr #1 substring$ chr.to.int$ #1 + int.to.chr$ + extra.label * 'extra.label := + last.extra.label #1 charptr #1 - substring$ + extra.label * 'extra.label := + } + { "a" extra.label * 'extra.label := } + if$ + extra.label 'last.extra.label := + } + { "a" 'last.extra.label := + "" 'extra.label := + short.label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + +FUNCTION {reverse.pass} +{ + next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label + duplicate$ empty$ + 'skip$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + terms.in.macro + { "\providecommand{\biband}{和}" + write$ newline$ + "\providecommand{\bibetal}{等}" + write$ newline$ + } + 'skip$ + if$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + "\expandafter\ifx\csname href\endcsname\relax" + write$ newline$ + " \DeclareUrlCommand\doi{\urlstyle{rm}}" + write$ newline$ + " \def\eprint#1#2{#2}" + write$ newline$ + "\else" + write$ newline$ + " \def\doi#1{\href{https://doi.org/#1}{\nolinkurl{#1}}}" + write$ newline$ + " \let\eprint\href" + write$ newline$ + "\fi" + write$ newline$ + } + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/thuthesis-author-year.cbx b/thuthesis-author-year.cbx new file mode 100644 index 0000000..6bd4145 --- /dev/null +++ b/thuthesis-author-year.cbx @@ -0,0 +1,28 @@ +\ProvidesFile{thuthesis-author-year.cbx}[2020/08/01 v1.0 ThuThesis biblatex + citation style] + +\RequireCitationStyle{gb7714-2015ay} + +\renewrobustcmd{\mkbibleftborder}{% + \ifthu@language@chinese + (% + \else + (% + \fi +} +\renewrobustcmd{\mkbibrightborder}{% + \ifthu@language@chinese + )% + \else + )% + \fi +} +\def\gbpunctcommacite{\addcomma\space} +\def\gbpunctmarkcite{\addcomma\space} +\def\gbpunctsemicoloncite{% + \ifthu@language@chinese + ;% + \else + \addsemicolon\space + \fi +} diff --git a/thuthesis-bachelor.bbx b/thuthesis-bachelor.bbx new file mode 100644 index 0000000..e7b95ff --- /dev/null +++ b/thuthesis-bachelor.bbx @@ -0,0 +1,28 @@ +\ProvidesFile{thuthesis-bachelor.bbx}[2020/08/01 v1.0 ThuThesis biblatex + bibliography style] + +\RequireBibliographyStyle{gb7714-2015} + +\ExecuteBibliographyOptions{ + gbpub = false, + gbalign = left, +} + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\setlength{\labelwidth}{1cm}% + \setlength{\leftmargin}{\labelwidth}% + \setlength{\labelsep}{\biblabelsep}% + \addtolength{\leftmargin}{\labelsep}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + \renewcommand*{\makelabel}[1]{\hss##1}} + {\endlist} + {\item} + +% 斜线默认使用原字体,不再使用等宽字体 +% +\def\SlashFont{} diff --git a/thuthesis-bachelor.bst b/thuthesis-bachelor.bst new file mode 100644 index 0000000..aea8c15 --- /dev/null +++ b/thuthesis-bachelor.bst @@ -0,0 +1,2470 @@ +%% +%% This is file `variants/thu/thuthesis-bachelor.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `2015,numerical') +%% ------------------------------------------------------------------- +%% GB/T 7714 BibTeX Style +%% https://github.com/zepinglee/gbt7714-bibtex-style +%% Version: 2024/03/08 v2.1.6 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016--2024 by Zeping Lee +%% ------------------------------------------------------------------- +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% ------------------------------------------------------------------- +INTEGERS { + citation.et.al.min + citation.et.al.use.first + bibliography.et.al.min + bibliography.et.al.use.first + uppercase.name + terms.in.macro + year.after.author + period.after.author + italic.book.title + sentence.case.title + link.title + title.in.journal + show.patent.country + show.mark + space.before.mark + show.medium.type + short.journal + italic.journal + link.journal + bold.journal.volume + show.missing.address.publisher + space.before.pages + only.start.page + wave.dash.in.pages + show.urldate + show.url + show.doi + show.preprint + show.note + show.english.translation + end.with.period +} + +STRINGS { + component.part.label +} + +FUNCTION {load.config} +{ + #2 'citation.et.al.min := + #1 'citation.et.al.use.first := + #4 'bibliography.et.al.min := + #3 'bibliography.et.al.use.first := + #1 'uppercase.name := + #0 'terms.in.macro := + #0 'year.after.author := + #1 'period.after.author := + #0 'italic.book.title := + #1 'sentence.case.title := + #0 'link.title := + #1 'title.in.journal := + #0 'show.patent.country := + #1 'show.mark := + #0 'space.before.mark := + #1 'show.medium.type := + "slash" 'component.part.label := + #0 'short.journal := + #0 'italic.journal := + #0 'link.journal := + #0 'bold.journal.volume := + #0 'show.missing.address.publisher := + #1 'space.before.pages := + #0 'only.start.page := + #0 'wave.dash.in.pages := + #1 'show.urldate := + #1 'show.url := + #1 'show.doi := + #1 'show.preprint := + #0 'show.note := + #0 'show.english.translation := + #1 'end.with.period := +} + +ENTRY + { address + archivePrefix + author + booktitle + date + doi + edition + editor + eprint + eprinttype + entrysubtype + howpublished + institution + journal + journaltitle + key + langid + language + location + mark + medium + note + number + organization + pages + publisher + school + series + shortjournal + title + translation + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic is.pure.electronic entry.numbered } + { label extra.label sort.label short.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ entry.lang lang.zh = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "\ " } + { " " } + if$ +} + +FUNCTION {bbl.and} +{ "" } + +FUNCTION {bbl.et.al} +{ entry.lang lang.zh = + { "等" } + { entry.lang lang.ja = + { "他" } + { entry.lang lang.ru = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {citation.and} +{ terms.in.macro + { "{\biband}" } + 'bbl.and + if$ +} + +FUNCTION {citation.et.al} +{ terms.in.macro + { "{\bibetal}" } + 'bbl.et.al + if$ +} + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.pages.colon} +{ space.before.pages + { ": " } + { ":\allowbreak " } + if$ +} + +FUNCTION {bbl.wide.space} { "\quad " } + +FUNCTION {bbl.slash} { "//\allowbreak " } + +FUNCTION {bbl.sine.loco} +{ entry.lang lang.zh = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ entry.lang lang.zh = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ entry.lang lang.zh = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { x y } + +FUNCTION {contains} +{ 'y := + 'x := + y text.length$ 'len := + x text.length$ len - #1 + 'charptr := + { charptr #0 > + x charptr len substring$ y = not + and + } + { charptr #1 - 'charptr := } + while$ + charptr #0 > +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ + newline$ + } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ end.with.period + 'add.period$ + 'skip$ + if$ + write$ + show.english.translation entry.lang lang.zh = and + { ")" + write$ + } + 'skip$ + if$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { component.part.label "slash" = + { after.slash 'output.state := } + { new.block + component.part.label "in" = + { entry.lang lang.en = + { "In: " output + write$ + "" + before.all 'output.state := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "\emph{" swap$ * "}" * } + if$ +} + +FUNCTION {format.btitle} +{ italic.book.title + entry.lang lang.en = and + 'emphasize + 'skip$ + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +STRINGS { entry.langid } + +FUNCTION {set.entry.lang} +{ "" 'entry.langid := + language empty$ not + { language 'entry.langid := } + 'skip$ + if$ + langid empty$ not + { langid 'entry.langid := } + 'skip$ + if$ + entry.langid empty$ + { check.entry.lang } + { entry.langid "english" = entry.langid "american" = or entry.langid "british" = or + { lang.en } + { entry.langid "chinese" = + { lang.zh } + { entry.langid "japanese" = + { lang.ja } + { entry.langid "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.name} +{ "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{ f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ +} + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + "" + numnames 'namesleft := + { namesleft #0 > } + { s nameptr format.name bbl.et.al = + numnames bibliography.et.al.min #1 - > nameptr bibliography.et.al.use.first > and or + { ", " * + bbl.et.al * + #1 'namesleft := + } + { nameptr #1 > + { namesleft #1 = bbl.and "" = not and + { bbl.and * } + { ", " * } + if$ + } + 'skip$ + if$ + s nameptr format.name * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ + "" + } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + entry.lang lang.zh = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label ")" * + make.full.names duplicate$ short.list = + { pop$ } + { duplicate$ "]" contains + { "{" swap$ * "}" * } + 'skip$ + if$ + * + } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{https://doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * + type$ "patent" = show.patent.country and + { address empty$ not + { address * ", " * } + { location empty$ not + { location * ", " * } + { entry.lang lang.zh = + { "中国" * ", " * } + 'skip$ + if$ + } + if$ + } + if$ + } + 'skip$ + if$ + number * + } + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "Vol." volume tie.or.space.connect } + if$ + } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.number} +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "No." number tie.or.space.connect } + if$ + } + { number } + if$ + } + { "" } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + } + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + } + { format.title.vol.num } + if$ + format.btitle + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + entry.numbered not s empty$ not and + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { format.booktitle.vol.num } + if$ + format.btitle +} + +FUNCTION {remove.period} +{ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ 'tmp.str := + tmp.str "." = not + { s tmp.str * 's := } + 'skip$ + if$ + t #2 global.max$ substring$ 't := + } + while$ + s +} + +FUNCTION {abbreviate} +{ remove.period + 't := + t "l" change.case$ 's := + "" + s "physical review letters" = + { "Phys Rev Lett" } + 'skip$ + if$ + 's := + s empty$ + { t } + { pop$ s } + if$ +} + +FUNCTION {get.journal.title} +{ short.journal + { shortjournal empty$ not + { shortjournal } + { journal empty$ not + { journal abbreviate } + { journaltitle empty$ not + { journaltitle abbreviate } + { "" } + if$ + } + if$ + } + if$ + } + { journal empty$ not + { journal } + { journaltitle empty$ not + { journaltitle } + { shortjournal empty$ not + { shortjournal } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {check.arxiv.preprint} +{ #1 #5 substring$ purify$ "l" change.case$ "arxiv" = + { #1 } + { #0 } + if$ +} + +FUNCTION {format.journal} +{ get.journal.title + duplicate$ empty$ not + { italic.journal entry.lang lang.en = and + 'emphasize + 'skip$ + if$ + link.journal + 'add.link + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { entry.mark + show.medium.type + { medium empty$ not + { "/" * medium * } + { entry.is.electronic + { "/OL" * } + 'skip$ + if$ + } + if$ + } + 'skip$ + if$ + 'entry.mark := + space.before.mark + { " " } + { "\allowbreak" } + if$ + "[" * entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { edition "1" = not + { entry.lang lang.zh = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + 'skip$ + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." * } + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address } + { location empty$ not + { location } + { "" } + if$ + } + if$ + duplicate$ empty$ not + { format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { pop$ + entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {extract.before.slash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "/" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.slash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + s charptr #1 substring$ "/" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + s charptr #1 substring$ "/" = + or + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extra.label * } + { date empty$ not + { date extract.before.dash extra.label * } + { entry.is.electronic not + { "empty year in " cite$ * warning$ } + 'skip$ + if$ + urldate empty$ not + { "[" urldate extract.before.dash * extra.label * "]" * } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.periodical.year} +{ year empty$ not + { year extract.before.slash + "--" * + year extract.after.slash + duplicate$ empty$ + 'pop$ + { * } + if$ + } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.date} +{ date empty$ not + { type$ "patent" = type$ "newspaper" = or + { date } + { entrysubtype empty$ not + { type$ "article" = entrysubtype "newspaper" = and + { date } + { format.year } + if$ + } + { format.year } + if$ + } + if$ + } + { year empty$ not + { format.year } + { "" } + if$ + } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ show.urldate show.url and entry.url empty$ not and + is.pure.electronic or + urldate empty$ not and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { wave.dash.in.pages + { "~" * } + { "-" * } + if$ + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.extracted.pages} +{ pages empty$ + { "" } + { pages + only.start.page + 'extract.before.dash + 'hyphenate + if$ + } + if$ +} + +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\allowbreak (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { format.extracted.pages } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.slash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\allowbreak (" * number extract.before.dash * ")" * } + 'skip$ + if$ + "--" * + year extract.after.slash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.slash empty$ not + { year extract.after.slash * } + { year extract.before.slash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\allowbreak (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { url 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {output.url} +{ show.url is.pure.electronic or + entry.url empty$ not and + { new.block + entry.url #1 #5 substring$ "\url{" = + { entry.url } + { "\url{" entry.url * "}" * } + if$ + output + } + 'skip$ + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url "l" change.case$ text.length$ 'charptr := + { entry.url "l" change.case$ charptr len substring$ s "l" change.case$ = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + } + 'skip$ + if$ +} + +FUNCTION {output.doi} +{ doi empty$ not show.doi and + show.english.translation entry.lang lang.zh = and not and + { new.block + format.doi output + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.eprint} +{ archivePrefix empty$ not + { archivePrefix } + { eprinttype empty$ not + { archivePrefix } + { "" } + if$ + } + if$ + 's := + s empty$ not + { s ": \eprint{" * + url empty$ not + { url } + { "https://" s "l" change.case$ * ".org/abs/" * eprint * } + if$ + * "}{" * + eprint * "}" * + } + { eprint } + if$ +} + +FUNCTION {output.eprint} +{ show.preprint eprint empty$ not and + { new.block + format.eprint output + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {output.translation} +{ show.english.translation entry.lang lang.zh = and + { translation empty$ not + { translation } + { "[English translation missing!]" } + if$ + " (in Chinese)" * output + write$ + format.doi duplicate$ empty$ not + { newline$ + write$ + } + 'pop$ + if$ + " \\" write$ + newline$ + "(" write$ + "" + before.all 'output.state := + } + 'skip$ + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + output.translation + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + "" + } + if$ + } + if$ + output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + year.after.author not + { format.year "year" output.check } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + year.after.author not + { format.year "year" output.check } + 'skip$ + if$ + format.extracted.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + year.after.author not + { format.periodical.year "year" output.check } + 'skip$ + if$ + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {journal.article} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + title.in.journal + { format.title "title" output.check + entrysubtype empty$ not + { + entrysubtype "newspaper" = + { "N" set.entry.mark } + { "J" set.entry.mark } + if$ + } + { "J" set.entry.mark } + if$ + format.mark "" output.after + new.block + } + 'skip$ + if$ + format.journal "journal" output.check + year.after.author not + { format.date "year" output.check } + 'skip$ + if$ + format.journal.volume output + format.journal.number "" output.after + format.journal.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + #1 'is.pure.electronic := + output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + year.after.author not + { date empty$ + { format.date output } + 'skip$ + if$ + } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.editdate "" output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {preprint} +{ output.bibitem + output.translation + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + "" + } + if$ + } + if$ + output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + title.in.journal + { format.series.vol.num.title "title" output.check + "A" set.entry.mark + format.mark "" output.after + new.block + } + 'skip$ + if$ + format.translators output + new.sentence + format.edition output + new.block + year.after.author not + { date empty$ + { format.date output } + 'skip$ + if$ + } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.editdate "" output.after + format.urldate "" output.after + output.eprint + output.url + show.preprint not eprint empty$ or + 'output.doi + 'skip$ + if$ + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ get.journal.title + duplicate$ empty$ not + { check.arxiv.preprint + 'preprint + 'journal.article + if$ + } + { pop$ + booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { eprint empty$ not archivePrefix empty$ not or + 'preprint + { entry.is.electronic + 'electronic + { + "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {article} { misc } + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { + booktitle empty$ + 'book + 'incollection + if$ +} + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {legislation} { archive } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ "D" set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} { mastersthesis } + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} { misc } + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.name} +{ "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t "others" = + { citation.et.al } + { t get.str.lang 'name.lang := + name.lang lang.zh = name.lang lang.ja = or + { t #1 "{ll}{ff}" format.name$ } + { t #1 "{vv~}{ll}" format.name$ } + if$ + } + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 format.lab.name 'short.label := + #1 'nameptr := + s num.names$ 'numnames := + "" + numnames 'namesleft := + { namesleft #0 > } + { s nameptr format.lab.name citation.et.al = + numnames citation.et.al.min #1 - > nameptr citation.et.al.use.first > and or + { bbl.space * + citation.et.al * + #1 'namesleft := + } + { nameptr #1 > + { namesleft #1 = citation.and "" = not and + { citation.and * } + { ", " * } + if$ + } + 'skip$ + if$ + s nameptr format.lab.name * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ "" 'short.label := + type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := + short.label empty$ + { short.list 'short.label := } + 'skip$ + if$ +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list "]" contains + { "{" short.list * "}" * } + { short.list } + if$ + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + duplicate$ "]" contains + { "{" swap$ * "}" * } + 'skip$ + if$ + * + 'label := + short.label + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'short.label := +} + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num :=} + +FUNCTION {int.to.fix} +{ "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + +FUNCTION {presort} +{ set.entry.lang + set.entry.numbered + show.url show.doi check.electronic + #0 'is.pure.electronic := + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra last.extra.label } + +INTEGERS { longest.label.width number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'number.label := + "" 'last.extra.label := +} + +FUNCTION {forward.pass} +{ + number.label #1 + 'number.label := +} + +FUNCTION {reverse.pass} +{ + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + terms.in.macro + { "\providecommand{\biband}{和}" + write$ newline$ + "\providecommand{\bibetal}{等}" + write$ newline$ + } + 'skip$ + if$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + "\expandafter\ifx\csname href\endcsname\relax" + write$ newline$ + " \DeclareUrlCommand\doi{\urlstyle{rm}}" + write$ newline$ + " \def\eprint#1#2{#2}" + write$ newline$ + "\else" + write$ newline$ + " \def\doi#1{\href{https://doi.org/#1}{\nolinkurl{#1}}}" + write$ newline$ + " \let\eprint\href" + write$ newline$ + "\fi" + write$ newline$ + } + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +EXECUTE {init.seq} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/thuthesis-bachelor.cbx b/thuthesis-bachelor.cbx new file mode 100644 index 0000000..f945bec --- /dev/null +++ b/thuthesis-bachelor.cbx @@ -0,0 +1,40 @@ +\ProvidesFile{thuthesis-bachelor.cbx}[2020/08/01 v1.0 ThuThesis biblatex + citation style] + +\RequireCitationStyle{gb7714-2015} + +% 本科生的顺序编码制引用两个连续序号之间使用逗号分割。 +\setcounter{gbrefcompress}{3} + +\renewrobustcmd{\mkbibsuperscript}[1]{% + \unspace\allowhyphens\textsuperscript{% + \begingroup + \protected\long\def\mkbibsuperscript##1{% + \blx@warning{Nested superscript}% + \mkbibbrackets{##1}}% + #1\endgroup}\kern\z@} + +\renewbibmacro*{citet}{% + \iffieldequals{namehash}{\cbx@lasthash}% + {\mkbibsuperscript{\usebibmacro{cite:comp}}}% + {\usebibmacro{cite:dump}% + \ifbool{cbx:parens}% + {\mkbibsuperscript{{\hspace{-0.075em}\mkbibrightborder}}%\bibclosebracket + \global\boolfalse{cbx:parens}}%\printtext + {}% + \iffirstcitekey + {} + {\textcitedelim}% + \usebibmacro{cite:init}% + \ifnameundef{labelname} + {\printfield[citetitle]{labeltitle}} + {\printnames{labelname}}% + %\setunit*{\printdelim{namelabeldelim}}% + \mkbibsuperscript{\printtext{\mkbibleftborder}%\bibopenbracket + \global\booltrue{cbx:parens}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}}% + {}% + \usebibmacro{cite:comp}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@lasthash}}}} diff --git a/thuthesis-example.pdf b/thuthesis-example.pdf new file mode 100644 index 0000000..766150c Binary files /dev/null and b/thuthesis-example.pdf differ diff --git a/thuthesis-example.tex b/thuthesis-example.tex new file mode 100644 index 0000000..c73eef9 --- /dev/null +++ b/thuthesis-example.tex @@ -0,0 +1,97 @@ +% !TEX encoding = UTF-8 +% !TEX program = xelatex +% !TEX spellcheck = en_US + +\documentclass[degree=master]{thuthesis} + % 学位 degree: + % doctor | master | bachelor | postdoc + % 学位类型 degree-type: + % academic(默认)| professional + % 特殊格式 style-override: + % none(默认)| schwarzman(苏世民学院) + % 语言 language + % chinese(默认)| english + % 字体库 fontset + % windows | mac | fandol | ubuntu + % 建议终版使用 Windows 平台的字体编译 + + +% 论文基本配置,加载宏包等全局配置 +\input{thusetup} + + +\begin{document} + +% 封面 +\maketitle + +% 学位论文指导小组、公开评阅人和答辩委员会名单 +% 本科生不需要 +\input{data/committee} + +% 使用授权的说明 +% 本科生开题报告不需要 +\copyrightpage +% 将签字扫描后授权文件 scan-copyright.pdf 替换原始页面 +% \copyrightpage[file=scan-copyright.pdf] + +\frontmatter +\input{data/abstract} + +% 目录 +\tableofcontents + +% 插图和附表清单 +\listoffigures % 插图清单 +\listoftables % 附表清单 +% \listoffiguresandtables % 插图和附表清单 + +% 符号对照表 +\input{data/denotation} + + +% 正文部分 +\mainmatter +\input{data/chap01} +\input{data/chap02} +\input{data/chap03} +\input{data/chap04} + +% 参考文献 +\bibliography{ref/refs} % 参考文献使用 BibTeX 编译 +% \printbibliography % 参考文献使用 BibLaTeX 编译 + +% 附录 +\appendix +\input{data/appendix} + +% 其他部分 +\backmatter + +% 致谢 +\input{data/acknowledgements} + +% 声明 +% 各类开题报告通常不需要 +\statement +% 在提交终稿 PDF 时,先编译不含页眉页脚的声明页,以避免页码变化带来问题 +% \statement[page-style=empty] +% 打印、签名、扫描为 PDF 文档后,将 scan-statement.pdf 替换原始页面,并生成页眉页脚 +% \statement[file=scan-statement.pdf] + +% 个人简历、在学期间完成的相关学术成果 +% 本科生可以附个人简历,也可以不附个人简历 +\input{data/resume} + +% 指导教师/指导小组评语 +% 本科生不需要 +\input{data/comments} + +% 答辩委员会决议书 +% 本科生不需要 +\input{data/resolution} + +% 本科生的综合论文训练记录表(扫描版) +% \record{file=scan-record.pdf} + +\end{document} diff --git a/thuthesis-inline.cbx b/thuthesis-inline.cbx new file mode 100644 index 0000000..d268a5b --- /dev/null +++ b/thuthesis-inline.cbx @@ -0,0 +1,28 @@ +\ProvidesFile{thuthesis-inline.cbx}[2020/08/01 v1.0 ThuThesis biblatex + citation style] + +\RequireCitationStyle{gb7714-2015} + +\ExecuteBibliographyOptions{ + autocite = inline , +} + +% 修改 \mkbibsuperscript 宏在最后加上一个空白使得 xeCJK 不会自动在引用标签后面加上中英文之间的空白 +\DeclareRobustCommand{\mkbibsuperscriptusp}[1]{% + \unspace\allowhyphens\textsuperscript{% + \begingroup + \protected\long\def\mkbibsuperscriptusp##1{% + \blx@warning{Nested superscript}% + \mkbibbrackets{##1}}% + #1\endgroup}} + +% 这里把 gb7714-2015.cbx 中 \parencite 定义借鉴过来 +\DeclareCiteCommand{\cite}%[\mkbibbrackets] + {[\usebibmacro{cite:init}%] + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {%[ + \usebibmacro{cite:dump}]% + \mkbibsuperscriptusp{\printfield{postnote}}} diff --git a/thuthesis-numeric.bbx b/thuthesis-numeric.bbx new file mode 100644 index 0000000..1f2ad8f --- /dev/null +++ b/thuthesis-numeric.bbx @@ -0,0 +1,59 @@ +\ProvidesFile{thuthesis-numeric.bbx}[2020/08/01 v1.0 ThuThesis biblatex + bibliography style] + +\RequireBibliographyStyle{gb7714-2015} + +\ExecuteBibliographyOptions{ + gbnamefmt = lowercase, + gbpub = false, + gbalign = left, +} + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\setlength{\labelwidth}{1cm}% + \setlength{\leftmargin}{\labelwidth}% + \setlength{\labelsep}{\biblabelsep}% + \addtolength{\leftmargin}{\labelsep}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + \renewcommand*{\makelabel}[1]{\hss##1}} + {\endlist} + {\item} + +% +% 重设专利title的输出,将文献类型标识符输出出去 +% +\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}} + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{} + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + % \setunit{\subtitlepunct}\printfield{number}%写专利号 + \setunit{\subtitlepunct}% + \iflistundef{location}{} + {\printlist{location}\setunit{\addcomma\space}}% 专利国别 + \printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +\clearlist{location}\clearlist{address}% +} + +% 斜线默认使用原字体,不再使用等宽字体 +% +\def\SlashFont{} diff --git a/thuthesis-numeric.bst b/thuthesis-numeric.bst new file mode 100644 index 0000000..ff99c42 --- /dev/null +++ b/thuthesis-numeric.bst @@ -0,0 +1,2470 @@ +%% +%% This is file `variants/thu/thuthesis-numeric.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `2015,thu,numerical') +%% ------------------------------------------------------------------- +%% GB/T 7714 BibTeX Style +%% https://github.com/zepinglee/gbt7714-bibtex-style +%% Version: 2024/03/08 v2.1.6 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016--2024 by Zeping Lee +%% ------------------------------------------------------------------- +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% ------------------------------------------------------------------- +INTEGERS { + citation.et.al.min + citation.et.al.use.first + bibliography.et.al.min + bibliography.et.al.use.first + uppercase.name + terms.in.macro + year.after.author + period.after.author + italic.book.title + sentence.case.title + link.title + title.in.journal + show.patent.country + show.mark + space.before.mark + show.medium.type + short.journal + italic.journal + link.journal + bold.journal.volume + show.missing.address.publisher + space.before.pages + only.start.page + wave.dash.in.pages + show.urldate + show.url + show.doi + show.preprint + show.note + show.english.translation + end.with.period +} + +STRINGS { + component.part.label +} + +FUNCTION {load.config} +{ + #2 'citation.et.al.min := + #1 'citation.et.al.use.first := + #4 'bibliography.et.al.min := + #3 'bibliography.et.al.use.first := + #0 'uppercase.name := + #0 'terms.in.macro := + #0 'year.after.author := + #1 'period.after.author := + #0 'italic.book.title := + #1 'sentence.case.title := + #0 'link.title := + #1 'title.in.journal := + #1 'show.patent.country := + #1 'show.mark := + #0 'space.before.mark := + #1 'show.medium.type := + "slash" 'component.part.label := + #0 'short.journal := + #0 'italic.journal := + #0 'link.journal := + #0 'bold.journal.volume := + #0 'show.missing.address.publisher := + #1 'space.before.pages := + #0 'only.start.page := + #0 'wave.dash.in.pages := + #1 'show.urldate := + #1 'show.url := + #1 'show.doi := + #1 'show.preprint := + #0 'show.note := + #0 'show.english.translation := + #1 'end.with.period := +} + +ENTRY + { address + archivePrefix + author + booktitle + date + doi + edition + editor + eprint + eprinttype + entrysubtype + howpublished + institution + journal + journaltitle + key + langid + language + location + mark + medium + note + number + organization + pages + publisher + school + series + shortjournal + title + translation + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic is.pure.electronic entry.numbered } + { label extra.label sort.label short.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ entry.lang lang.zh = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "" } + { " " } + if$ +} + +FUNCTION {bbl.and} +{ "" } + +FUNCTION {bbl.et.al} +{ entry.lang lang.zh = + { "等" } + { entry.lang lang.ja = + { "他" } + { entry.lang lang.ru = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {citation.and} +{ terms.in.macro + { "{\biband}" } + 'bbl.and + if$ +} + +FUNCTION {citation.et.al} +{ terms.in.macro + { "{\bibetal}" } + 'bbl.et.al + if$ +} + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.pages.colon} +{ space.before.pages + { ": " } + { ":\allowbreak " } + if$ +} + +FUNCTION {bbl.wide.space} { "\quad " } + +FUNCTION {bbl.slash} { "//\allowbreak " } + +FUNCTION {bbl.sine.loco} +{ entry.lang lang.zh = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ entry.lang lang.zh = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ entry.lang lang.zh = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { x y } + +FUNCTION {contains} +{ 'y := + 'x := + y text.length$ 'len := + x text.length$ len - #1 + 'charptr := + { charptr #0 > + x charptr len substring$ y = not + and + } + { charptr #1 - 'charptr := } + while$ + charptr #0 > +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ + newline$ + } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ end.with.period + 'add.period$ + 'skip$ + if$ + write$ + show.english.translation entry.lang lang.zh = and + { ")" + write$ + } + 'skip$ + if$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { component.part.label "slash" = + { after.slash 'output.state := } + { new.block + component.part.label "in" = + { entry.lang lang.en = + { "In: " output + write$ + "" + before.all 'output.state := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {emphasize} +{ duplicate$ empty$ + { pop$ "" } + { "\emph{" swap$ * "}" * } + if$ +} + +FUNCTION {format.btitle} +{ italic.book.title + entry.lang lang.en = and + 'emphasize + 'skip$ + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +STRINGS { entry.langid } + +FUNCTION {set.entry.lang} +{ "" 'entry.langid := + language empty$ not + { language 'entry.langid := } + 'skip$ + if$ + langid empty$ not + { langid 'entry.langid := } + 'skip$ + if$ + entry.langid empty$ + { check.entry.lang } + { entry.langid "english" = entry.langid "american" = or entry.langid "british" = or + { lang.en } + { entry.langid "chinese" = + { lang.zh } + { entry.langid "japanese" = + { lang.ja } + { entry.langid "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.name} +{ "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{ f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ +} + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + "" + numnames 'namesleft := + { namesleft #0 > } + { s nameptr format.name bbl.et.al = + numnames bibliography.et.al.min #1 - > nameptr bibliography.et.al.use.first > and or + { ", " * + bbl.et.al * + #1 'namesleft := + } + { nameptr #1 > + { namesleft #1 = bbl.and "" = not and + { bbl.and * } + { ", " * } + if$ + } + 'skip$ + if$ + s nameptr format.name * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ + "" + } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + entry.lang lang.zh = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label ")" * + make.full.names duplicate$ short.list = + { pop$ } + { duplicate$ "]" contains + { "{" swap$ * "}" * } + 'skip$ + if$ + * + } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{https://doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * + type$ "patent" = show.patent.country and + { address empty$ not + { address * ", " * } + { location empty$ not + { location * ", " * } + { entry.lang lang.zh = + { "中国" * ", " * } + 'skip$ + if$ + } + if$ + } + if$ + } + 'skip$ + if$ + number * + } + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "Vol." volume tie.or.space.connect } + if$ + } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.number} +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "No." number tie.or.space.connect } + if$ + } + { number } + if$ + } + { "" } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + } + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + } + { format.title.vol.num } + if$ + format.btitle + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + entry.numbered not s empty$ not and + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { format.booktitle.vol.num } + if$ + format.btitle +} + +FUNCTION {remove.period} +{ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ 'tmp.str := + tmp.str "." = not + { s tmp.str * 's := } + 'skip$ + if$ + t #2 global.max$ substring$ 't := + } + while$ + s +} + +FUNCTION {abbreviate} +{ remove.period + 't := + t "l" change.case$ 's := + "" + s "physical review letters" = + { "Phys Rev Lett" } + 'skip$ + if$ + 's := + s empty$ + { t } + { pop$ s } + if$ +} + +FUNCTION {get.journal.title} +{ short.journal + { shortjournal empty$ not + { shortjournal } + { journal empty$ not + { journal abbreviate } + { journaltitle empty$ not + { journaltitle abbreviate } + { "" } + if$ + } + if$ + } + if$ + } + { journal empty$ not + { journal } + { journaltitle empty$ not + { journaltitle } + { shortjournal empty$ not + { shortjournal } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {check.arxiv.preprint} +{ #1 #5 substring$ purify$ "l" change.case$ "arxiv" = + { #1 } + { #0 } + if$ +} + +FUNCTION {format.journal} +{ get.journal.title + duplicate$ empty$ not + { italic.journal entry.lang lang.en = and + 'emphasize + 'skip$ + if$ + link.journal + 'add.link + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { entry.mark + show.medium.type + { medium empty$ not + { "/" * medium * } + { entry.is.electronic + { "/OL" * } + 'skip$ + if$ + } + if$ + } + 'skip$ + if$ + 'entry.mark := + space.before.mark + { " " } + { "\allowbreak" } + if$ + "[" * entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { edition "1" = not + { entry.lang lang.zh = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + 'skip$ + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." * } + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address } + { location empty$ not + { location } + { "" } + if$ + } + if$ + duplicate$ empty$ not + { format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { pop$ + entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {extract.before.slash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "/" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.slash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + s charptr #1 substring$ "/" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + s charptr #1 substring$ "/" = + or + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extra.label * } + { date empty$ not + { date extract.before.dash extra.label * } + { entry.is.electronic not + { "empty year in " cite$ * warning$ } + 'skip$ + if$ + urldate empty$ not + { "[" urldate extract.before.dash * extra.label * "]" * } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.periodical.year} +{ year empty$ not + { year extract.before.slash + "--" * + year extract.after.slash + duplicate$ empty$ + 'pop$ + { * } + if$ + } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.date} +{ date empty$ not + { type$ "patent" = type$ "newspaper" = or + { date } + { entrysubtype empty$ not + { type$ "article" = entrysubtype "newspaper" = and + { date } + { format.year } + if$ + } + { format.year } + if$ + } + if$ + } + { year empty$ not + { format.year } + { "" } + if$ + } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ show.urldate show.url and entry.url empty$ not and + is.pure.electronic or + urldate empty$ not and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { wave.dash.in.pages + { "~" * } + { "-" * } + if$ + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.extracted.pages} +{ pages empty$ + { "" } + { pages + only.start.page + 'extract.before.dash + 'hyphenate + if$ + } + if$ +} + +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\allowbreak (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { format.extracted.pages } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.slash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\allowbreak (" * number extract.before.dash * ")" * } + 'skip$ + if$ + "--" * + year extract.after.slash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.slash empty$ not + { year extract.after.slash * } + { year extract.before.slash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\allowbreak (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { url 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {output.url} +{ show.url is.pure.electronic or + entry.url empty$ not and + { new.block + entry.url #1 #5 substring$ "\url{" = + { entry.url } + { "\url{" entry.url * "}" * } + if$ + output + } + 'skip$ + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url "l" change.case$ text.length$ 'charptr := + { entry.url "l" change.case$ charptr len substring$ s "l" change.case$ = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + } + 'skip$ + if$ +} + +FUNCTION {output.doi} +{ doi empty$ not show.doi and + show.english.translation entry.lang lang.zh = and not and + { new.block + format.doi output + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.eprint} +{ archivePrefix empty$ not + { archivePrefix } + { eprinttype empty$ not + { archivePrefix } + { "" } + if$ + } + if$ + 's := + s empty$ not + { s ": \eprint{" * + url empty$ not + { url } + { "https://" s "l" change.case$ * ".org/abs/" * eprint * } + if$ + * "}{" * + eprint * "}" * + } + { eprint } + if$ +} + +FUNCTION {output.eprint} +{ show.preprint eprint empty$ not and + { new.block + format.eprint output + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {output.translation} +{ show.english.translation entry.lang lang.zh = and + { translation empty$ not + { translation } + { "[English translation missing!]" } + if$ + " (in Chinese)" * output + write$ + format.doi duplicate$ empty$ not + { newline$ + write$ + } + 'pop$ + if$ + " \\" write$ + newline$ + "(" write$ + "" + before.all 'output.state := + } + 'skip$ + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + output.translation + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + "" + } + if$ + } + if$ + output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + year.after.author not + { format.year "year" output.check } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + year.after.author not + { format.year "year" output.check } + 'skip$ + if$ + format.extracted.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + year.after.author not + { format.periodical.year "year" output.check } + 'skip$ + if$ + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {journal.article} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + title.in.journal + { format.title "title" output.check + entrysubtype empty$ not + { + entrysubtype "newspaper" = + { "N" set.entry.mark } + { "J" set.entry.mark } + if$ + } + { "J" set.entry.mark } + if$ + format.mark "" output.after + new.block + } + 'skip$ + if$ + format.journal "journal" output.check + year.after.author not + { format.date "year" output.check } + 'skip$ + if$ + format.journal.volume output + format.journal.number "" output.after + format.journal.pages bbl.pages.colon output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.title "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + #1 'is.pure.electronic := + output.bibitem + output.translation + format.authors output + author format.key output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + year.after.author not + { date empty$ + { format.date output } + 'skip$ + if$ + } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.editdate "" output.after + format.urldate "" output.after + output.url + output.doi + new.block + format.note output + fin.entry +} + +FUNCTION {preprint} +{ output.bibitem + output.translation + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + "" + } + if$ + } + if$ + output + year.after.author + { period.after.author + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + } + 'skip$ + if$ + new.block + title.in.journal + { format.series.vol.num.title "title" output.check + "A" set.entry.mark + format.mark "" output.after + new.block + } + 'skip$ + if$ + format.translators output + new.sentence + format.edition output + new.block + year.after.author not + { date empty$ + { format.date output } + 'skip$ + if$ + } + 'skip$ + if$ + format.pages bbl.pages.colon output.after + format.editdate "" output.after + format.urldate "" output.after + output.eprint + output.url + show.preprint not eprint empty$ or + 'output.doi + 'skip$ + if$ + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ get.journal.title + duplicate$ empty$ not + { check.arxiv.preprint + 'preprint + 'journal.article + if$ + } + { pop$ + booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { eprint empty$ not archivePrefix empty$ not or + 'preprint + { entry.is.electronic + 'electronic + { + "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {article} { misc } + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { + booktitle empty$ + 'book + 'incollection + if$ +} + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {legislation} { archive } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ "D" set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} { mastersthesis } + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} { misc } + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.name} +{ "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t "others" = + { citation.et.al } + { t get.str.lang 'name.lang := + name.lang lang.zh = name.lang lang.ja = or + { t #1 "{ll}{ff}" format.name$ } + { t #1 "{vv~}{ll}" format.name$ } + if$ + } + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 format.lab.name 'short.label := + #1 'nameptr := + s num.names$ 'numnames := + "" + numnames 'namesleft := + { namesleft #0 > } + { s nameptr format.lab.name citation.et.al = + numnames citation.et.al.min #1 - > nameptr citation.et.al.use.first > and or + { bbl.space * + citation.et.al * + #1 'namesleft := + } + { nameptr #1 > + { namesleft #1 = citation.and "" = not and + { citation.and * } + { ", " * } + if$ + } + 'skip$ + if$ + s nameptr format.lab.name * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ "" 'short.label := + type$ "book" = + type$ "inbook" = booktitle empty$ not and + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := + short.label empty$ + { short.list 'short.label := } + 'skip$ + if$ +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list "]" contains + { "{" short.list * "}" * } + { short.list } + if$ + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + duplicate$ "]" contains + { "{" swap$ * "}" * } + 'skip$ + if$ + * + 'label := + short.label + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'short.label := +} + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num :=} + +FUNCTION {int.to.fix} +{ "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + +FUNCTION {presort} +{ set.entry.lang + set.entry.numbered + show.url show.doi check.electronic + #0 'is.pure.electronic := + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra last.extra.label } + +INTEGERS { longest.label.width number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'number.label := + "" 'last.extra.label := +} + +FUNCTION {forward.pass} +{ + number.label #1 + 'number.label := +} + +FUNCTION {reverse.pass} +{ + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + terms.in.macro + { "\providecommand{\biband}{和}" + write$ newline$ + "\providecommand{\bibetal}{等}" + write$ newline$ + } + 'skip$ + if$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + "\expandafter\ifx\csname href\endcsname\relax" + write$ newline$ + " \DeclareUrlCommand\doi{\urlstyle{rm}}" + write$ newline$ + " \def\eprint#1#2{#2}" + write$ newline$ + "\else" + write$ newline$ + " \def\doi#1{\href{https://doi.org/#1}{\nolinkurl{#1}}}" + write$ newline$ + " \let\eprint\href" + write$ newline$ + "\fi" + write$ newline$ + } + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +EXECUTE {init.seq} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/thuthesis-numeric.cbx b/thuthesis-numeric.cbx new file mode 100644 index 0000000..e6ab4a7 --- /dev/null +++ b/thuthesis-numeric.cbx @@ -0,0 +1,44 @@ +\ProvidesFile{thuthesis-numeric.cbx}[2020/08/01 v1.0 ThuThesis biblatex + citation style] + +\RequireCitationStyle{gb7714-2015} + +\renewrobustcmd{\mkbibsuperscript}[1]{% + \unspace\allowhyphens\textsuperscript{% + \begingroup + \protected\long\def\mkbibsuperscript##1{% + \blx@warning{Nested superscript}% + \mkbibbrackets{##1}}% + #1\endgroup}\kern\z@} + +\ifthu@main@language@chinese + \DefineBibliographyStrings{english}{ + andothersincitecn={\unspace 等},% + andothersincite = {等} + } +\fi + +\renewbibmacro*{citet}{% + \iffieldequals{namehash}{\cbx@lasthash}% + {\mkbibsuperscript{\usebibmacro{cite:comp}}}% + {\usebibmacro{cite:dump}% + \ifbool{cbx:parens}% + {\mkbibsuperscript{{\hspace{-0.075em}\mkbibrightborder}}%\bibclosebracket + \global\boolfalse{cbx:parens}}%\printtext + {}% + \iffirstcitekey + {} + {\textcitedelim}% + \usebibmacro{cite:init}% + \ifnameundef{labelname} + {\printfield[citetitle]{labeltitle}} + {\printnames{labelname}}% + %\setunit*{\printdelim{namelabeldelim}}% + \mkbibsuperscript{\printtext{\mkbibleftborder}%\bibopenbracket + \global\booltrue{cbx:parens}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}}% + {}% + \usebibmacro{cite:comp}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@lasthash}}}} diff --git a/thuthesis.cls b/thuthesis.cls new file mode 100644 index 0000000..ba4eb6a --- /dev/null +++ b/thuthesis.cls @@ -0,0 +1,4264 @@ +%% +%% This is file `thuthesis.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% thuthesis.dtx (with options: `cls') +%% +%% This is a generated file. +%% +%% Copyright (C) 2005-2026 by Tsinghua University TUNA Association +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% +%% To produce the documentation run the original source files ending with `.dtx' +%% through LaTeX. +%% +\NeedsTeXFormat{LaTeX2e}[2017/04/15] +\ProvidesClass{thuthesis} +[2026/05/10 7.7.0 Tsinghua University Thesis Template] +\newcommand\thu@error[1]{% + \ClassError{thuthesis}{#1}{}% +} +\newcommand\thu@warning[1]{% + \ClassWarning{thuthesis}{#1}% +} +\newcommand\thu@debug[1]{% + \typeout{Package thuthesis Info: #1}% +} +\newcommand\thu@patch@error[1]{% + \thu@error{Failed to patch command \protect#1}% +} +\newcommand\thu@deprecate[2]{% + \def\thu@@tmp{#2}% + \thu@warning{% + The #1 is deprecated% + \ifx\thu@@tmp\@empty\else + . Use #2 instead% + \fi + }% +} +\newcommand\thu@replace@with@error[1]{% + \expandafter\def\csname #1\endcsname{% + \thu@error{% + \expandafter\protect\csname #1\endcsname\space can only be used once. + \MessageBreak + Please remove the duplicate call% + }% + }% +} +\@ifl@t@r\fmtversion{2017/04/15}{}{ + \thu@error{% + TeX Live 2017 or later version is required to compile this document% + } +} +\RequirePackage{iftex} +\ifXeTeX\else + \ifLuaTeX\else + \thu@error{XeLaTeX or LuaLaTeX is required to compile this document} + \fi +\fi +\InputIfFileExists{thuthesis-pdf-test-config.tex}{}{ + \InputIfFileExists{thuthesis-log-test-config.tex}{}{} +} +\hyphenation{Thu-Thesis} +\def\thuthesis{ThuThesis} +\def\version{7.7.0} +\RequirePackage{kvdefinekeys} +\RequirePackage{kvsetkeys} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{ + family=thu, + prefix=thu@, + setkeys=\kvsetkeys} +\let\thu@setup@hook\@empty +\newcommand\thusetup[1]{% + \let\thu@setup@hook\@empty + \kvsetkeys{thu}{#1}% + \thu@setup@hook +} +\newcommand\thu@define@key[1]{% + \kvsetkeys{thu@key}{#1}% +} +\kv@set@family@handler{thu@key}{% + \@namedef{thu@#1@@name}{#1}% + \def\thu@@default{}% + \def\thu@@choices{}% + \kv@define@key{thu@value}{name}{% + \@namedef{thu@#1@@name}{##1}% + }% + \@namedef{thu@#1@@check}{}% + \@namedef{thu@#1@@code}{}% + \kv@define@key{thu@value}{choices}{% + \def\thu@@choices{##1}% + \@namedef{thu@#1@@reset}{}% + \@namedef{thu@#1@@check}{% + \@ifundefined{% + ifthu@\@nameuse{thu@#1@@name}@\@nameuse{thu@\@nameuse{thu@#1@@name}}% + }{% + \thu@error{Invalid value "#1 = \@nameuse{thu@\@nameuse{thu@#1@@name}}"}% + }% + \@nameuse{thu@#1@@reset}% + \@nameuse{thu@\@nameuse{thu@#1@@name}@\@nameuse{thu@\@nameuse{thu@#1@@name}}true}% + }% + }% + \kv@define@key{thu@value}{default}{% + \def\thu@@default{##1}% + }% + \kvsetkeys{thu@value}{#2}% + \@namedef{thu@\@nameuse{thu@#1@@name}}{}% + \kv@set@family@handler{thu@choice}{% + \ifx\thu@@default\@empty + \def\thu@@default{##1}% + \fi + \expandafter\newif\csname ifthu@\@nameuse{thu@#1@@name}@##1\endcsname + \expandafter\g@addto@macro\csname thu@#1@@reset\endcsname{% + \@nameuse{thu@\@nameuse{thu@#1@@name}@##1false}% + }% + }% + \kvsetkeys@expandafter{thu@choice}{\thu@@choices}% + \expandafter\let\csname thu@\@nameuse{thu@#1@@name}\endcsname\thu@@default + \expandafter\ifx\csname thu@\@nameuse{thu@#1@@name}\endcsname\@empty\else + \@nameuse{thu@#1@@check}% + \fi + \kv@define@key{thu}{#1}{% + \@namedef{thu@\@nameuse{thu@#1@@name}}{##1}% + \@nameuse{thu@#1@@check}% + \@nameuse{thu@#1@@code}% + }% +} +\newcommand\thu@option@hook[2]{% + \expandafter\g@addto@macro\csname thu@#1@@code\endcsname{#2}% +} +\thu@define@key{ + thesis-type = { + name = thesis@type, + choices = { + thesis, + proposal, + }, + default = thesis, + }, + degree = { + choices = { + bachelor, + master, + doctor, + postdoc, + }, + default = doctor, + }, + degree-type = { + choices = { + academic, + professional, + }, + name = degree@type, + }, + main-language = { + name = main@language, + choices = { + chinese, + english, + }, + }, + language = { + choices = { + chinese, + english, + }, + }, + system = { + choices = { + auto, + mac, + unix, + windows, + }, + default = auto, + }, + fontset = { + choices = { + auto, + windows, + mac, + ubuntu, + fandol, + none, + }, + default = auto, + }, + font = { + choices = { + auto, + times, + termes, + stix, + xits, + libertinus, + newcm, + lm, + newtx, + none, + }, + default = auto, + }, + cjk-font = { + name = cjk@font, + choices = { + auto, + windows, + windows-local, + mac, + mac-word, + noto, + fandol, + none, + }, + default = auto, + }, + windows-font-dir = { + name = windows@font@dir, + default = {.}, + }, + math-font = { + name = math@font, + choices = { + auto, + stix, + xits, + libertinus, + newcm, + lm, + newtx, + none, + }, + default = auto, + }, + math-style = { + name = math@style, + choices = { + GB, + ISO, + TeX, + }, + }, + uppercase-greek = { + name = uppercase@greek, + choices = { + italic, + upright, + }, + }, + less-than-or-equal = { + name = leq, + choices = { + slanted, + horizontal, + }, + }, + integral = { + choices = { + upright, + slanted, + }, + }, + integral-limits = { + name = integral@limits, + choices = { + true, + false, + }, + }, + partial = { + choices = { + upright, + italic, + }, + }, + math-ellipsis = { + name = math@ellipsis, + choices = { + centered, + lower, + AMS, + }, + }, + real-part = { + name = real@part, + choices = { + roman, + fraktur, + }, + }, + output = { + choices = { + print, + electronic, + }, + default = print, + }, + eqn-paren-style = { + name = eqn@paren@style, + choices = { + full, + half, + } + }, + style-override = { + name = style@override, + choices = { + none, + schwarzman, + }, + }, + footnote-numbering = { + name = footnote@numbering, + choices = { + page, + chapter, + global, + }, + }, + footnote-style = { + name = footnote@style, + choices = { + circled, + plain, + }, + }, + figure-numbering = { + name = figure@numbering, + choices = { + chapter, + global, + }, + }, + table-numbering = { + name = table@numbering, + choices = { + chapter, + global, + }, + }, + equation-numbering = { + name = equation@numbering, + choices = { + chapter, + global, + }, + }, +} +\newif\ifthu@degree@graduate +\newcommand\thu@set@graduate{% + \thu@degree@graduatefalse + \ifthu@degree@doctor + \thu@degree@graduatetrue + \fi + \ifthu@degree@master + \thu@degree@graduatetrue + \fi +} +\thu@set@graduate +\thu@option@hook{degree}{% + \thu@set@graduate +} +\DeclareBoolOption[false]{openright} +\DeclareComplementaryOption{openany}{openright} +\DeclareBoolOption[true]{raggedbottom} +\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}} +\ProcessKeyvalOptions* +\ifthu@openright + \PassOptionsToClass{openright}{book} +\else + \PassOptionsToClass{openany}{book} +\fi +\PassOptionsToPackage{no-math}{fontspec} +\ifthu@style@override@schwarzman + \thusetup{ + footnote-numbering = global, + footnote-style = plain, + figure-numbering = global, + table-numbering = global, + equation-numbering = global, + } +\fi +\thu@option@hook{style-override}{\thu@error{% + The 'style-override' option is only valid in class options.% +}}% +\thu@option@hook{footnote-numbering}{\thu@error{% + The 'footnote-numbering' option is only valid in class options.% +}}% +\ifthu@footnote@numbering@page + \PassOptionsToPackage{perpage}{footmisc}% +\fi +\LoadClass[a4paper,UTF8,zihao=-4,scheme=plain,fontset=none]{ctexbook}[2017/04/01] +\RequirePackage{etoolbox} +\RequirePackage{filehook} +\RequirePackage{xparse} +\RequirePackage{geometry}% +\RequirePackage{fancyhdr} +\RequirePackage{titletoc} +\RequirePackage{notoccite} +\RequirePackage{amsmath} +\RequirePackage{graphicx} +\RequirePackage[labelformat=simple]{subcaption} +\RequirePackage{pdfpages} +\includepdfset{fitpaper=true} +\AtEndPreamble{ + \ifx\tikzifexternalizing\@undefined\else + \tikzifexternalizing{ + \renewcommand*\includepdf[2][]{} + }{} + \fi +} +\RequirePackage[shortlabels]{enumitem} +\RequirePackage{environ} +\ifthu@raggedbottom + \RequirePackage[bottom,hang]{footmisc} + \raggedbottom +\else + \RequirePackage[hang]{footmisc} +\fi +\ifXeTeX + \RequirePackage{xeCJKfntef} +\else + \RequirePackage{ulem} +\fi +\RequirePackage{array} +\RequirePackage{booktabs} +\RequirePackage{url} +\AtEndPreamble{ + \@ifpackageloaded{biblatex}{}{ + \@ifpackageloaded{apacite}{}{ + \RequirePackage{natbib} + } + } +} +\AtEndOfPackageFile*{natbib}{ + \@ifpackageloaded{apacite}{}{ + \RequirePackage{bibunits} + } +} +\newcommand\thu@package@conflict[2]{% + \AtEndOfPackageFile*{#1}{% + \AtBeginOfPackageFile*{#2}{% + \thu@error{The "#2" package is incompatible with "#1"}% + }% + }% +} +\thu@package@conflict{biblatex}{bibunits} +\thu@package@conflict{biblatex}{chapterbib} +\thu@package@conflict{biblatex}{cite} +\thu@package@conflict{biblatex}{multibib} +\thu@package@conflict{biblatex}{natbib} + +\thu@package@conflict{bibunits}{biblatex} +\thu@package@conflict{bibunits}{chapterbib} +\thu@package@conflict{bibunits}{multibib} + +\thu@package@conflict{unicode-math}{amscd} +\thu@package@conflict{unicode-math}{amsfonts} +\thu@package@conflict{unicode-math}{amssymb} +\thu@package@conflict{unicode-math}{bbm} +\thu@package@conflict{unicode-math}{bm} +\thu@package@conflict{unicode-math}{eucal} +\thu@package@conflict{unicode-math}{eufrak} +\thu@package@conflict{unicode-math}{mathrsfs} +\thu@package@conflict{unicode-math}{newtxmath} +\thu@package@conflict{unicode-math}{upgreek} + +\thu@package@conflict{natbib}{biblatex} +\thu@package@conflict{natbib}{cite} + +\thu@package@conflict{newtxmath}{amsfonts} +\thu@package@conflict{newtxmath}{amssymb} +\thu@package@conflict{newtxmath}{unicode-math} +\thu@package@conflict{newtxmath}{upgreek} +\AtBeginOfPackageFile*{amsthm}{ + \@ifpackageloaded{newtxmath}{ + \thu@error{The "amsthm" package should be loaded before setting "newtxmath"} + }{} +}% +\geometry{ + paper = a4paper, % 210 * 297mm + marginparwidth = 2cm, + marginparsep = 0.5cm, +} +\newcommand\thu@set@geometry{% + \ifthu@degree@bachelor + \geometry{ + margin = 3cm, + footskip = 1.5cm, + }% + \else + \geometry{ + margin = 3cm, + headheight = 2.7cm, + headsep = 0.3cm, + footskip = 0.8cm, + }% + \fi +} +\thu@set@geometry +\thu@option@hook{degree}{\thu@set@geometry} +\thu@option@hook{output}{\thu@set@geometry} +\thusetup{main-language=\thu@language}% +\let\thu@main@language\thu@language +\thu@option@hook{language}{% + \ifx\@begindocumenthook\@undefined\else + \thusetup{main-language=\thu@language}% + \let\thu@main@language\thu@language + \fi +} +\newcommand\thu@reset@main@language{% + \thusetup{language = \thu@main@language}% + \let\thu@language\thu@main@language +} +\newcommand\thu@set@chapter@names{% + \ifthu@degree@bachelor + \def\thu@statement@name{声明}% + \else + \def\thu@statement@name{声\hspace{1em}明}% + \fi + \ifthu@main@language@chinese + \def\listfigurename{插图清单}% + \def\listtablename{附表清单}% + \def\thu@list@figure@table@name{插图和附表清单}% + \def\thu@list@algorithm@name{算法清单}% + \def\thu@denotation@name{符号和缩略语说明}% + \def\thu@comments@name{指导教师评语}% + \def\bibname{参考文献}% + \def\appendixname{附录}% + \def\indexname{索引}% + \def\thu@resolution@name{答辩委员会决议书}% + \ifthu@degree@bachelor + \def\contentsname{目录}% + \def\thu@acknowledgements@name{致谢}% + \def\listequationname{公式索引}% + \def\thu@resume@name{在学期间参加课题的研究成果}% + \else + \def\listequationname{公式清单}% + \def\thu@acknowledgements@name{致\quad 谢}% + \ifthu@degree@graduate + \def\contentsname{目\quad 录}% + \def\thu@resume@name{个人简历、在学期间完成的相关学术成果}% + \else % degree = postdoc + \def\contentsname{目\qquad 次}% + \def\thu@denotation@name{符号表}% + \def\thu@resume@name{个人简历、发表的学术论文与科研成果}% + \fi + \fi + \else + \ifthu@main@language@english + \def\thu@comments@name{Comments from Thesis Supervisor}% + \def\thu@resolution@name{Resolution of Thesis Defense Committee}% + \def\indexname{Index}% + \ifthu@degree@bachelor + \def\contentsname{CONTENTS}% + \def\listfigurename{FIGURES}% + \def\listtablename{TABLES}% + \def\thu@list@figure@table@name{FIGURES AND TABLES}% + \def\thu@list@algorithm@name{ALGORITHMS}% + \def\listequationname{EQUATIONS}% + \def\thu@denotation@name{ABBREVIATIONS}% + \def\bibname{REFERENCES}% + \def\appendixname{APPENDIX}% + \def\thu@acknowledgements@name{ACKNOWLEDGEMENTS}% + \def\thu@resume@name{PUBLICATIONS}% + \else + \def\contentsname{Table of Contents}% + \def\listfigurename{List of Figures}% + \def\listtablename{List of Tables}% + \def\thu@list@figure@table@name{List of Figures and Tables}% + \def\thu@list@algorithm@name{List of Algorithms}% + \def\listequationname{List of Equations}% + \def\thu@denotation@name{List of Symbols and Acronyms}% + \def\bibname{References}% + \def\appendixname{Appendix}% + \def\thu@acknowledgements@name{Acknowledgements}% + \def\thu@resume@name{Resume}% + \fi + \fi + \fi +} +\thu@set@chapter@names +\thu@option@hook{degree}{\thu@set@chapter@names} +\thu@option@hook{main-language}{\thu@set@chapter@names} +\newcommand\thu@set@names{% + \ifthu@language@chinese + \ctexset{ + figurename = 图, + tablename = 表, + }% + \def\thu@algorithm@name{算法}% + \def\thu@equation@name{公式}% + \def\thu@assumption@name{假设}% + \def\thu@definition@name{定义}% + \def\thu@proposition@name{命题}% + \def\thu@lemma@name{引理}% + \def\thu@theorem@name{定理}% + \def\thu@axiom@name{公理}% + \def\thu@corollary@name{推论}% + \def\thu@exercise@name{练习}% + \def\thu@example@name{例}% + \def\thu@remark@name{注释}% + \def\thu@problem@name{问题}% + \def\thu@conjecture@name{猜想}% + \def\thu@proof@name{证明}% + \def\thu@theorem@separator{:}% + \else + \ifthu@language@english + \ctexset{ + figurename = {Figure}, + tablename = {Table}, + }% + \def\thu@algorithm@name{Algorithm}% + \def\thu@equation@name{Equation}% + \def\thu@assumption@name{Assumption}% + \def\thu@definition@name{Definition}% + \def\thu@proposition@name{Proposition}% + \def\thu@lemma@name{Lemma}% + \def\thu@theorem@name{Theorem}% + \def\thu@axiom@name{Axiom}% + \def\thu@corollary@name{Corollary}% + \def\thu@exercise@name{Exercise}% + \def\thu@example@name{Example}% + \def\thu@remark@name{Remark}% + \def\thu@problem@name{Problem}% + \def\thu@conjecture@name{Conjecture}% + \def\thu@proof@name{Proof}% + \def\thu@theorem@separator{: }% + \fi + \fi +} +\thu@set@names +\thu@option@hook{language}{\thu@set@names} +\ifLuaTeX + % ctex 将带圈数字 U+2460–U+2473 归入字符范围 3(ALchar),这里改回范围 6(JAchar) + \ltjdefcharrange{6}{"2460-"2473, "2605} +\else + \ifXeTeX + \xeCJKDeclareCharClass{CJK}{"2460 -> "2473, "2605} + \fi +\fi +\newcommand\thu@set@punctuations{% + \ifthu@language@chinese + \ifLuaTeX + \ltjsetparameter{jacharrange={+9}} + \else + \ifXeTeX + \xeCJKDeclareCharClass{FullLeft}{"2018, "201C}% + \xeCJKDeclareCharClass{FullRight}{ + "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A, + }% + \fi + \fi + \else + \ifthu@language@english + \ifLuaTeX + \ltjsetparameter{jacharrange={-9}} + \else + \ifXeTeX + \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}% + \xeCJKDeclareCharClass{HalfRight}{ + "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A, + }% + \fi + \fi + \fi + \fi +} +\thu@set@punctuations +\thu@option@hook{language}{\thu@set@punctuations} +\renewcommand\normalsize{% + \@setfontsize\normalsize{12bp}{20bp}% + \abovedisplayskip 6bp% + \abovedisplayshortskip 6bp% + \belowdisplayshortskip 6bp% + \belowdisplayskip \abovedisplayskip +} +\normalsize +\ifx\MakeRobust\@undefined \else + \MakeRobust\normalsize +\fi +\def\thu@def@fontsize#1#2{% + \expandafter\newcommand\csname #1\endcsname[1][1.3]{% + \fontsize{#2}{##1\dimexpr #2}\selectfont}} +\thu@def@fontsize{chuhao}{42bp} +\thu@def@fontsize{xiaochu}{36bp} +\thu@def@fontsize{yihao}{26bp} +\thu@def@fontsize{xiaoyi}{24bp} +\thu@def@fontsize{erhao}{22bp} +\thu@def@fontsize{xiaoer}{18bp} +\thu@def@fontsize{sanhao}{16bp} +\thu@def@fontsize{xiaosan}{15bp} +\thu@def@fontsize{sihao}{14bp} +\thu@def@fontsize{xiaosi}{12bp} +\thu@def@fontsize{wuhao}{10.5bp} +\thu@def@fontsize{xiaowu}{9bp} +\thu@def@fontsize{liuhao}{7.5bp} +\thu@def@fontsize{xiaoliu}{6.5bp} +\thu@def@fontsize{qihao}{5.5bp} +\thu@def@fontsize{bahao}{5bp} +\ifthu@system@auto + \IfFileExists{/System/Library/Fonts/Menlo.ttc}{ + \thusetup{system = mac} + }{ + \IfFileExists{/dev/null}{ + \IfFileExists{null:}{ + \thusetup{system = windows} + }{ + \thusetup{system = unix} + } + }{ + \thusetup{system = windows} + } + } + \thu@debug{Detected system: \thu@system} +\fi +\newcommand\thu@mac@word@font@dir{% + /Applications/Microsoft Word.app/Contents/Resources/DFonts% +} +\ifthu@fontset@auto + \ifthu@system@windows + \thusetup{fontset = windows} + \else + \IfFontExistsTF{SimSun}{ + \thusetup{fontset = windows} + }{ + \IfFileExists{\thu@windows@font@dir/Simsun.ttc}{ + \thusetup{fontset = windows, cjk-font = windows-local} + }{ + \IfFileExists{\thu@mac@word@font@dir/Simsun.ttc}{ + \thusetup{fontset = windows, cjk-font = mac-word} + }{ + \ifthu@system@mac + \thusetup{fontset = mac} + \else + \IfFontExistsTF{Noto Serif CJK SC}{ + \thusetup{fontset = ubuntu} + }{ + \thusetup{fontset = fandol} + } + \fi + } + } + } + \fi + \thu@debug{Detected fontset: \thu@fontset} +\fi +\newcommand\thu@set@font{% + \@nameuse{thu@set@font@\thu@font}% +} +\thu@option@hook{font}{\thu@set@font} +\newcommand\thu@set@font@auto{% + \ifthu@font@auto + \ifthu@fontset@windows + \thusetup{font=times}% + \else + \ifthu@fontset@mac + \thusetup{font=times}% + \else + \thusetup{font=termes}% + \fi + \fi + \fi +} +\thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@font@auto}} +\AtBeginOfPackageFile*{siunitx}{\thu@set@font@auto} +\AtEndPreamble{\thu@set@font@auto} +\newcommand\thu@set@font@times{% + \setmainfont{Times New Roman}% + \setsansfont{Arial}% + \ifthu@fontset@mac + \setmonofont{Menlo}[Scale = MatchLowercase]% + \else + \setmonofont{Courier New}[Scale = MatchLowercase]% + \fi +} +\newcommand\thu@set@font@termes{% + \setmainfont{texgyretermes}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \thu@set@texgyre@sans@mono +} +\newcommand\thu@set@texgyre@sans@mono{% + \setsansfont{texgyreheros}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \setmonofont{texgyrecursor}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Scale = MatchLowercase, + Ligatures = CommonOff, + ]% +} +\let\thu@font@family@stix\@empty +\newcommand\thu@set@stix@names{% + \ifx\thu@font@family@stix\@empty + \IfFontExistsTF{STIXTwoText-Regular.otf}{% + \gdef\thu@font@family@stix{STIXTwoText}% + \gdef\thu@font@name@stix@math{STIXTwoMath-Regular}% + }{% + \gdef\thu@font@family@stix{STIX2Text}% + \gdef\thu@font@name@stix@math{STIX2Math}% + }% + \fi +} +\newcommand\thu@set@font@stix{% + \thu@set@stix@names + \setmainfont{\thu@font@family@stix}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic, + ]% + \thu@set@texgyre@sans@mono +} +\let\thu@font@family@xits\@empty +\newcommand\thu@set@xits@names{% + \ifx\thu@font@family@xits\@empty + \IfFontExistsTF{XITSMath-Regular.otf}{% + \gdef\thu@font@family@xits{XITS}% + \gdef\thu@font@style@xits@rm{Regular}% + \gdef\thu@font@style@xits@bf{Bold}% + \gdef\thu@font@style@xits@it{Italic}% + \gdef\thu@font@style@xits@bfit{BoldItalic}% + \gdef\thu@font@name@xits@math{XITSMath-Regular}% + }{% + \gdef\thu@font@family@xits{xits}% + \gdef\thu@font@style@xits@rm{regular}% + \gdef\thu@font@style@xits@bf{bold}% + \gdef\thu@font@style@xits@it{italic}% + \gdef\thu@font@style@xits@bfit{bolditalic}% + \gdef\thu@font@name@xits@math{xits-math}% + }% + \fi +} +\newcommand\thu@set@font@xits{% + \thu@set@xits@names + \setmainfont{\thu@font@family@xits}[ + Extension = .otf, + UprightFont = *-\thu@font@style@xits@rm, + BoldFont = *-\thu@font@style@xits@bf, + ItalicFont = *-\thu@font@style@xits@it, + BoldItalicFont = *-\thu@font@style@xits@bfit, + ]% + \thu@set@texgyre@sans@mono +} +\let\thu@font@family@libertinus\@empty +\newcommand\thu@set@libertinus@names{% + \ifx\thu@font@family@libertinus\@empty + \IfFontExistsTF{LibertinusSerif-Regular.otf}{% + \gdef\thu@font@family@libertinus@serif{LibertinusSerif}% + \gdef\thu@font@family@libertinus@sans{LibertinusSans}% + \gdef\thu@font@name@libertinus@math{LibertinusMath-Regular}% + \gdef\thu@font@style@libertinus@rm{Regular}% + \gdef\thu@font@style@libertinus@bf{Bold}% + \gdef\thu@font@style@libertinus@it{Italic}% + \gdef\thu@font@style@libertinus@bfit{BoldItalic}% + }{% + \gdef\thu@font@family@libertinus@serif{libertinusserif}% + \gdef\thu@font@family@libertinus@sans{libertinussans}% + \gdef\thu@font@name@libertinus@math{libertinusmath-regular}% + \gdef\thu@font@style@libertinus@rm{regular}% + \gdef\thu@font@style@libertinus@bf{bold}% + \gdef\thu@font@style@libertinus@it{italic}% + \gdef\thu@font@style@libertinus@bfit{bolditalic}% + }% + \fi +} +\newcommand\thu@set@font@libertinus{% + \thu@set@libertinus@names + \setmainfont{\thu@font@family@libertinus@serif}[ + Extension = .otf, + UprightFont = *-\thu@font@style@libertinus@rm, + BoldFont = *-\thu@font@style@libertinus@bf, + ItalicFont = *-\thu@font@style@libertinus@it, + BoldItalicFont = *-\thu@font@style@libertinus@bfit, + ]% + \setsansfont{\thu@font@family@libertinus@sans}[ + Extension = .otf, + UprightFont = *-\thu@font@style@libertinus@rm, + BoldFont = *-\thu@font@style@libertinus@bf, + ItalicFont = *-\thu@font@style@libertinus@it, + ]% + \setmonofont{lmmonolt10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% +} +\newcommand\thu@set@font@newcm{% + \setmainfont{NewCM10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookItalic, + BoldItalicFont = *-BoldItalic, + ]% + \setsansfont{NewCMSans10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookOblique, + BoldItalicFont = *-BoldOblique, + ]% + \setmonofont{NewCMMono10}[ + Extension = .otf, + UprightFont = *-Book, + ItalicFont = *-BookItalic, + BoldFont = *-Bold, + BoldItalicFont = *-BoldOblique, + ]% +} +\newcommand\thu@set@font@lm{% + \setmainfont{lmroman10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \setsansfont{lmsans10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% + \setmonofont{lmmonolt10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% +} +\newcommand\thu@set@font@newtx{% + \RequirePackage{newtxtext}% +} +\ifthu@cjk@font@auto + \ifthu@fontset@mac + \thusetup{cjk-font = mac} + \else + \ifthu@fontset@windows + \IfFontExistsTF{SimSun}{ + \thusetup{cjk-font = windows} + }{ + \IfFileExists{\thu@windows@font@dir/Simsun.ttc}{ + \thusetup{cjk-font = windows-local} + }{ + \IfFileExists{\thu@mac@word@font@dir/Simsun.ttc}{ + \thusetup{cjk-font = mac-word} + }{ + \thu@error{Cannot find "SimSun" font} + } + } + } + \else + \ifthu@fontset@ubuntu + \thusetup{cjk-font = noto} + \else + \thusetup{cjk-font = fandol} + \fi + \fi + \fi + \thu@debug{Detected CJK font: \thu@cjk@font} +\fi +\newcommand\thu@set@cjk@font@windows{% + \setCJKmainfont{SimSun}[ + AutoFakeBold = 3, + ItalicFont = KaiTi, + ]% + \setCJKsansfont{SimHei}[AutoFakeBold = 3]% + \setCJKmonofont{FangSong}% + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold = 3]% + \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold = 3]% + \setCJKfamilyfont{zhkai}{KaiTi}% + \setCJKfamilyfont{zhfs}{FangSong}% +} +\@namedef{thu@set@cjk@font@windows-local}{% + \IfFileExists{\thu@windows@font@dir/Kaiti.ttf}{ + \setCJKmainfont{SimSun}[% + Path = \thu@windows@font@dir/, + Extension = .ttc, + AutoFakeBold = 3, + ItalicFont = Kaiti, + ItalicFeatures = {Extension = .ttf}, + ]% + \setCJKmonofont{Fangsong}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhkai}{Kaiti}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhfs}{Fangsong}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + }{ + \setCJKmainfont{SimSun}[% + Path = \thu@windows@font@dir/, + Extension = .ttc, + AutoFakeBold = 3, + ItalicFont = Simkai, + ItalicFeatures = {Extension = .ttf}, + ]% + \setCJKmonofont{Simfang}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhkai}{Simkai}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhfs}{Simfang}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + } + \setCJKsansfont{SimHei}[% + Path = \thu@windows@font@dir/, + Extension = .ttf, + AutoFakeBold = 3, + ]% + \setCJKfamilyfont{zhsong}{SimSun}[% + Path = \thu@windows@font@dir/, + Extension = .ttc, + AutoFakeBold = 3, + ]% + \setCJKfamilyfont{zhhei}{SimHei}[% + Path = \thu@windows@font@dir/, + Extension = .ttf, + AutoFakeBold = 3, + ]% +} +\@namedef{thu@set@cjk@font@mac-word}{% + \let\thu@windows@font@dir\thu@mac@word@font@dir + \@nameuse{thu@set@cjk@font@windows-local}% +} +\newcommand\thu@set@cjk@font@mac{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{Songti SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ItalicFont = Kaiti SC Regular, + BoldItalicFont = Kaiti SC Bold, + ]% + \setCJKsansfont{Heiti SC}[ + UprightFont = * Light, + BoldFont = * Medium, + ]% + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ]% + \setCJKfamilyfont{zhhei}{Heiti SC}[ + UprightFont = * Light, + BoldFont = * Medium, + ]% + \setCJKfamilyfont{zhfs}{STFangsong}% + \setCJKfamilyfont{zhkai}{Kaiti SC}[ + UprightFont = * Regular, + BoldFont = * Bold, + ]% + \setCJKfamilyfont{zhli}{Baoli SC}% + \setCJKfamilyfont{zhyuan}{Yuanyi SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ]% +} +\newcommand\thu@set@cjk@font@noto{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{Noto Serif CJK SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ItalicFont = FandolKai-Regular, + ItalicFeatures = {Extension = .otf}, + Script = CJK, + ]% + \setCJKsansfont{Noto Sans CJK SC}[ + BoldFont = * Medium, + Script = CJK, + ]% + \setCJKmonofont{Noto Sans Mono CJK SC}[ + Script = CJK, + ]% + \setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[ + UprightFont = * Light, + UprightFont = * Bold, + Script = CJK, + ]% + \setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[ + BoldFont = * Medium, + Script = CJK, + ]% + \setCJKfamilyfont{zhfs}{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhkai}{FandolKai}[ + Extension = .otf, + UprightFont = *-Regular, + ]% +} +\newcommand\thu@set@cjk@font@fandol{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{FandolSong}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = FandolKai-Regular, + ItalicFeatures = {Extension = .otf}, + ]% + \setCJKsansfont{FandolHei}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKmonofont{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhsong}{FandolSong}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKfamilyfont{zhhei}{FandolHei}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKfamilyfont{zhfs}{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhkai}{FandolKai}[ + Extension = .otf, + UprightFont = *-Regular, + ]% +} +\ifthu@cjk@font@none\else + \providecommand\songti{\CJKfamily{zhsong}} + \providecommand\heiti{\CJKfamily{zhhei}} + \providecommand\fangsong{\CJKfamily{zhfs}} + \providecommand\kaishu{\CJKfamily{zhkai}} +\fi +\newcommand\thu@set@cjk@font{% + \@nameuse{thu@set@cjk@font@\thu@cjk@font}% +} +\thu@set@cjk@font +\thu@option@hook{cjk-font}{\thu@set@cjk@font} +\newcommand\thu@set@math@style{% + \ifthu@math@style@TeX + \thusetup{ + uppercase-greek = upright, + less-than-or-equal = horizontal, + integral = slanted, + integral-limits = false, + partial = italic, + math-ellipsis = AMS, + real-part = fraktur, + }% + \else + \thusetup{ + uppercase-greek = italic, + integral = upright, + partial = upright, + real-part = roman, + }% + \ifthu@math@style@ISO + \thusetup{ + less-than-or-equal = horizontal, + integral-limits = true, + math-ellipsis = lower, + }% + \else + \ifthu@math@style@GB + \thusetup{ + less-than-or-equal = slanted, + integral-limits = false, + math-ellipsis = centered, + }% + \fi + \fi + \fi +} +\ifthu@main@language@chinese + \thusetup{math-style=GB}% +\else + \thusetup{math-style=TeX}% +\fi +\thu@set@math@style +\thu@option@hook{math-style}{\thu@set@math@style} +\thu@option@hook{main-language}{% + \ifthu@main@language@chinese + \thusetup{math-style=GB}% + \else + \thusetup{math-style=TeX}% + \fi +} +\newcommand\thu@set@unimath@leq{% + \ifthu@leq@horizontal + \ifx\@begindocumenthook\@undefined + \let\le\thu@save@leq + \let\ge\thu@save@geq + \let\leq\thu@save@leq + \let\geq\thu@save@geq + \else + \AtBeginDocument{% + \let\le\thu@save@leq + \let\ge\thu@save@geq + \let\leq\thu@save@leq + \let\geq\thu@save@geq + }% + \fi + \else + \ifthu@leq@slanted + \ifx\@begindocumenthook\@undefined + \let\le\leqslant + \let\ge\geqslant + \let\leq\leqslant + \let\geq\geqslant + \else + \AtBeginDocument{% + \let\le\leqslant + \let\ge\geqslant + \let\leq\leqslant + \let\geq\geqslant + }% + \fi + \fi + \fi +} +\newcommand\thu@set@unimath@integral@limits{% + \ifthu@integral@limits@true + \removenolimits{% + \int\iint\iiint\iiiint\oint\oiint\oiiint + \intclockwise\varointclockwise\ointctrclockwise\sumint + \intbar\intBar\fint\cirfnint\awint\rppolint + \scpolint\npolint\pointint\sqint\intlarhk\intx + \intcap\intcup\upint\lowint + }% + \else + \addnolimits{% + \int\iint\iiint\iiiint\oint\oiint\oiiint + \intclockwise\varointclockwise\ointctrclockwise\sumint + \intbar\intBar\fint\cirfnint\awint\rppolint + \scpolint\npolint\pointint\sqint\intlarhk\intx + \intcap\intcup\upint\lowint + }% + \fi +} +\newcommand\thu@set@unimath@ellipsis{% + \ifthu@math@ellipsis@centered + \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}% + \else + \DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}% + \fi +} +\newcommand\thu@set@unimath@real@part{% + \ifthu@real@part@roman + \AtBeginDocument{% + \def\Re{\operatorname{Re}}% + \def\Im{\operatorname{Im}}% + }% + \else + \AtBeginDocument{% + \let\Re\thu@save@Re + \let\Im\thu@save@Im + }% + \fi +} +\newcommand\thu@set@unimath@style{% + \ifthu@uppercase@greek@upright + \unimathsetup{math-style = TeX}% + \else + \ifthu@uppercase@greek@italic + \unimathsetup{math-style = ISO}% + \fi + \fi + \ifthu@math@style@TeX + \unimathsetup{bold-style = TeX}% + \else + \unimathsetup{bold-style = ISO}% + \fi + \thu@set@unimath@leq + \thu@set@unimath@integral@limits + \ifthu@partial@upright + \unimathsetup{partial = upright}% + \else + \ifthu@partial@italic + \unimathsetup{partial = italic}% + \fi + \fi + \thu@set@unimath@ellipsis + \thu@set@unimath@real@part +} +\newcommand\thu@qed{\rule{1ex}{1ex}} +\newcommand\thu@load@unimath{% + \@ifpackageloaded{unicode-math}{}{% + \RequirePackage{unicode-math}% + \AtBeginDocument{% + \let\thu@save@leq\leq + \let\thu@save@geq\geq + \let\thu@save@Re\Re + \let\thu@save@Im\Im + }% + \DeclareRobustCommand\bm[1]{{\symbfit{##1}}}% + \DeclareRobustCommand\boldsymbol[1]{{\symbfit{##1}}}% + \newcommand\square{\mdlgwhtsquare}% + \newcommand\blacksquare{\mdlgblksquare}% + \AtBeginDocument{% + \renewcommand\checkmark{\ensuremath{\symbol{"2713}}}% + }% + \renewcommand\thu@qed{\ensuremath{\QED}}% + }% +} +\newcommand\thu@set@math@font@stix{% + \thu@set@stix@names + \setmathfont{\thu@font@name@stix@math}[ + Extension = .otf, + Scale = MatchLowercase, + StylisticSet = \thu@xits@integral@stylistic@set, + ]% + \setmathfont{\thu@font@name@stix@math}[ + Extension = .otf, + Scale = MatchLowercase, + StylisticSet = 1, + range = {scr,bfscr}, + ]% +} +\newcommand\thu@xits@integral@stylistic@set{% + \ifthu@integral@upright + 8% + \fi +} +\newcommand\thu@set@math@font@xits{% + \thu@set@xits@names + \setmathfont{\thu@font@name@xits@math}[ + Extension = .otf, + StylisticSet = \thu@xits@integral@stylistic@set, + ]% + \setmathfont{\thu@font@name@xits@math}[ + Extension = .otf, + StylisticSet = 1, + range = {cal,bfcal}, + ]% +} +\newcommand\thu@libertinus@integral@stylistic@set{% + \ifthu@integral@slanted + 8% + \fi +} +\newcommand\thu@set@math@font@libertinus{% + \thu@set@libertinus@names + \setmathfont{\thu@font@name@libertinus@math}[ + Extension = .otf, + StylisticSet = \thu@libertinus@integral@stylistic@set, + ]% +} +\newcommand\thu@newcm@integral@stylistic@set{% + \ifthu@integral@upright + 2% + \fi +} +\newcommand\thu@set@math@font@newcm{% + \setmathfont{NewCMMath-Book}[ + Extension = .otf, + StylisticSet = \thu@newcm@integral@stylistic@set, + ]% + \setmathfont{NewCMMath-Book}[ + Extension = .otf, + StylisticSet = 1, + range = {scr,bfscr}, + ]% + \setmathrm{NewCM10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookItalic, + BoldItalicFont = *-BoldItalic, + ]% + \setmathsf{NewCMSans10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookOblique, + BoldItalicFont = *-BoldOblique, + ]% + \setmathtt{NewCMMono10}[ + Extension = .otf, + UprightFont = *-Book, + ItalicFont = *-BookItalic, + BoldFont = *-Bold, + BoldItalicFont = *-BoldOblique, + ]% +} +\newcommand\thu@set@math@font@lm{% + \setmathfont{latinmodern-math}[Extension=.otf]% + \setmathrm{lmroman10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \setmathsf{lmsans10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% + \setmathtt{lmmonolt10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% +} +\newcommand\thu@set@math@font@newtx{% + \ifthu@font@newtx\else + \let\thu@save@encodingdefault\encodingdefault + \let\thu@save@rmdefault\rmdefault + \let\thu@save@sfdefault\sfdefault + \let\thu@save@ttdefault\ttdefault + \RequirePackage[T1]{fontenc}% + \renewcommand{\rmdefault}{ntxtlf}% + \renewcommand{\sfdefault}{qhv}% + \renewcommand{\ttdefault}{ntxtt}% + \fi + \ifthu@uppercase@greek@italic + \PassOptionsToPackage{slantedGreek}{newtxmath}% + \fi + \ifthu@integral@upright + \PassOptionsToPackage{upint}{newtxmath}% + \fi + \RequirePackage{newtxmath}% + \let\thu@save@leq\leq + \let\thu@save@geq\geq + \ifthu@leq@slanted + \let\le\leqslant + \let\ge\geqslant + \let\leq\leqslant + \let\geq\geqslant + \fi + \ifthu@integral@limits@true + \let\ilimits@\displaylimits + \fi + \let\thu@save@partial\partial + \ifthu@partial@upright + \let\partial\uppartial + \fi + \ifthu@math@ellipsis@centered + \DeclareRobustCommand\mathellipsis{\mathinner{\cdotp\cdotp\cdotp}}% + \else + \DeclareRobustCommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}% + \fi + \let\thu@save@Re\Re + \let\thu@save@Im\Im + \ifthu@real@part@roman + \def\Re{\operatorname{Re}}% + \def\Im{\operatorname{Im}}% + \fi + \RequirePackage{bm}% + \ifthu@font@newtx\else + \let\encodingdefault\thu@save@encodingdefault + \let\rmdefault\thu@save@rmdefault + \let\sfdefault\thu@save@sfdefault + \let\ttdefault\thu@save@ttdefault + \fi + \DeclareRobustCommand\symup[1]{{\mathrm{##1}}}% + \DeclareRobustCommand\symbf[1]{{\bm{##1}}}% + \DeclareRobustCommand\symbfsf[1]{{\bm{\mathsf{##1}}}}% + \let\increment\upDelta% + \renewcommand\thu@qed{\openbox}% +} +\newcommand\thu@set@math@font{% + \ifthu@math@font@none\else + \ifthu@math@font@newtx + \thu@set@math@font@newtx + \else + \thu@load@unimath + \thu@set@unimath@style + \@nameuse{thu@set@math@font@\thu@math@font}% + \fi + \fi +} +\thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@math@font}} +\newcommand\thu@set@math@font@auto{% + \ifthu@math@font@auto + \thusetup{math-font=xits}% + \fi +} +\AtBeginOfPackageFile*{siunitx}{\thu@set@math@font@auto} +\AtEndPreamble{\thu@set@math@font@auto} +\def\cleardoublepage{% + \clearpage + \if@twoside + \ifthu@output@print + \ifodd\c@page + \else + \thispagestyle{empty}% + \hbox{}% + \newpage + \if@twocolumn + \hbox{}\newpage + \fi + \fi + \fi + \fi +} +\renewcommand\frontmatter{% + \cleardoublepage + \@mainmatterfalse + \pagenumbering{Roman}% +} +\renewcommand\mainmatter{% + \cleardoublepage + \@mainmattertrue + \pagenumbering{arabic}% +} +\renewcommand\backmatter{% + \clearpage + \@mainmatterfalse + \thusetup{toc-depth = 0}% +} +\pagestyle{fancy} +\fancypagestyle{plain}{% + \fancyhf{}% + \renewcommand\footrulewidth{0pt}% + \ifthu@degree@bachelor + \renewcommand\headrulewidth{0pt}% + \fancyfoot[C]{ + \ifthu@main@language@chinese + \fontsize{10.5bp}{12.075bp}\selectfont + \else + \normalsize + \fi + \thepage + }% + \let\@mkboth\@gobbletwo + \let\chaptermark\@gobble + \else + \renewcommand\headrulewidth{0.75bp}% + \fancyhead[C]{% + \wuhao + \ifthu@main@language@chinese + \leftmark + \else + \MakeUppercase{\leftmark}% + \fi + }% + \fancyfoot[C]{\wuhao\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markboth{% + \CTEXifname{% + \CTEXthechapter + \ifthu@main@language@chinese + \quad + \else + \space + \fi + }{}##1% + }{}% + }% + \fi + \let\sectionmark\@gobble +} +\pagestyle{plain} +\def\ps@chapter{} +\ctexset{chapter/pagestyle = chapter} +\ctexset{% + punct=quanjiao, +} +\newcommand\thu@set@indent{% + \ifthu@main@language@chinese + \ctexset{autoindent=2}% + \else + \ifthu@degree@bachelor + \ctexset{autoindent=0.8cm}% + \else + \ctexset{autoindent=0.74cm}% + \fi + \fi +} +\thu@set@indent +\thu@option@hook{degree}{\thu@set@indent} +\thu@option@hook{main-language}{\thu@set@indent} +\urlstyle{same} +\g@addto@macro\UrlBreaks{% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9% + \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M + \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m + \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z +} +\Urlmuskip=0mu plus 0.1mu +\partopsep=\z@skip +\def\@listi{\leftmargin\leftmargini + \parsep \z@skip + \topsep \z@skip + \itemsep\z@skip} +\let\@listI\@listi +\@listi +\def\@listii {\leftmargin\leftmarginii + \labelwidth\leftmarginii + \advance\labelwidth-\labelsep + \topsep \z@skip + \parsep \z@skip + \itemsep \z@skip} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii + \advance\labelwidth-\labelsep + \topsep \z@skip + \parsep \z@skip + \partopsep \z@skip + \itemsep \z@skip} +\setlist{nosep} +\interfootnotelinepenalty=10000 +\ifthu@footnote@numbering@global + \@removefromreset{footnote}{chapter}% +\fi +\newcommand\thu@circled[1]{% + \ifnum#1 >10\relax + \thu@warning{% + Too many footnotes in this page. + Keep footnote less than 10% + }% + \fi + {\symbol{\the\numexpr#1+"245F\relax}}% +} +\ifthu@footnote@style@circled + \renewcommand{\thefootnote}{\thu@circled{\c@footnote}}% + \renewcommand{\thempfootnote}{\thu@circled{\c@mpfootnote}}% +\else + \renewcommand{\thefootnote}{\arabic{footnote}}% + \renewcommand{\thempfootnote}{\arabic{mpfootnote}}% +\fi +\def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@} +\footnotemargin=13.5bp +\long\def\@makefntext#1{% + \begingroup + % 序号取消上标 + \def\@makefnmark{\hbox{\normalfont\@thefnmark}}% + \xiaowu + \ifFN@hangfoot + \bgroup + \setbox\@tempboxa\hbox{% + \ifdim\footnotemargin>\z@ + \hb@xt@\footnotemargin{\@makefnmark\hss}% + \else + \@makefnmark + \fi + }% + \leftmargin\wd\@tempboxa + \rightmargin\z@ + \linewidth \columnwidth + \advance \linewidth -\leftmargin + \parshape \@ne \leftmargin \linewidth + % \footnotesize + \xiaowu + \@setpar{{\@@par}}% + \leavevmode + \llap{\box\@tempboxa}% + \parskip\hangfootparskip\relax + \parindent\hangfootparindent\relax + \else + \parindent1em% + \noindent + \ifdim\footnotemargin>\z@ + \hb@xt@ \footnotemargin{\hss\@makefnmark}% + \else + \ifdim\footnotemargin=\z@ + \llap{\@makefnmark}% + \else + \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}}% + \fi + \fi + \fi + \footnotelayout#1% + \ifFN@hangfoot + \par\egroup + \fi + \endgroup +} +\allowdisplaybreaks[4] +\newcommand\thu@put@parentheses[1]{% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \kern 0pt\relax + (#1)% + \else + (#1)% + \fi + \else + (#1)% + \fi +} +\def\tagform@#1{% + \maketag@@@{\thu@put@parentheses{\ignorespaces#1\unskip\@@italiccorr}}% +} +\DeclareRobustCommand{\eqref}[1]{% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \unskip + \fi + \fi + \textup{\tagform@{\ref{#1}}}% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \ignorespaces + \fi + \fi +} +\def\fps@figure{htbp} +\def\fps@table{htbp} +\setlength{\floatsep}{12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength{\textfloatsep}{12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength{\intextsep}{12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength{\@fptop}{0bp \@plus1.0fil} +\setlength{\@fpsep}{12bp \@plus2.0fil} +\setlength{\@fpbot}{0bp \@plus1.0fil} +\patchcmd{\@addtocurcol}% + {\vskip \intextsep}% + {\edef\save@first@penalty{\the\lastpenalty}\unpenalty + \ifnum \lastpenalty = \@M % hopefully the OR penalty + \unpenalty + \else + \penalty \save@first@penalty \relax % put it back + \fi + \ifnum\outputpenalty <-\@Mii + \addvspace\intextsep + \vskip\parskip + \else + \addvspace\intextsep + \fi}% + {}{\thu@patch@error{\@addtocurcol}} +\patchcmd{\@addtocurcol}% + {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}% + {\ifnum\outputpenalty <-\@Mii + \aftergroup\vskip\aftergroup\intextsep + \aftergroup\nointerlineskip + \else + \vskip\intextsep + \fi}% + {}{\thu@patch@error{\@addtocurcol}} +\patchcmd{\@getpen}{\@M}{\@Mi} + {}{\thu@patch@error{\@getpen}} +\renewcommand{\textfraction}{0.15} +\renewcommand{\topfraction}{0.85} +\renewcommand{\bottomfraction}{0.65} +\renewcommand{\floatpagefraction}{0.60} +\thu@define@key{ + figure-number-separator = { + name = figure@number@separator, + default = {.}, + }, + table-number-separator = { + name = table@number@separator, + default = {.}, + }, + equation-number-separator = { + name = equation@number@separator, + default = {.}, + }, + number-separator = { + name = number@separator, + default = {.}, + }, +} +\newcommand\thu@set@figure@numbering{% + \ifthu@figure@numbering@chapter + \@addtoreset{figure}{chapter}% + \else + \@removefromreset{figure}{chapter}% + \fi +} +\thu@set@figure@numbering +\thu@option@hook{figure-numbering}{\thu@set@figure@numbering} +\renewcommand\thefigure{% + \ifthu@figure@numbering@chapter + \ifnum\c@chapter>\z@ + \thechapter + \thu@figure@number@separator + \fi + \fi + \@arabic\c@figure +} +\newcommand\thu@set@table@numbering{% + \ifthu@table@numbering@chapter + \@addtoreset{table}{chapter}% + \else + \@removefromreset{table}{chapter}% + \fi +} +\thu@set@table@numbering +\thu@option@hook{table-numbering}{\thu@set@table@numbering} +\renewcommand\thetable{% + \ifthu@table@numbering@chapter + \ifnum\c@chapter>\z@ + \thechapter + \thu@table@number@separator + \fi + \fi + \@arabic\c@table +} +\newcommand\thu@set@equation@numbering{% + \ifthu@equation@numbering@chapter + \@addtoreset{equation}{chapter}% + \else + \@removefromreset{equation}{chapter}% + \fi +} +\thu@set@equation@numbering +\thu@option@hook{equation-numbering}{\thu@set@equation@numbering} +\renewcommand\theequation{% + \ifthu@equation@numbering@chapter + \ifnum\c@chapter>\z@ + \thechapter + \thu@equation@number@separator + \fi + \fi + \@arabic\c@equation +} +\newcommand\thu@set@number@separator{% + \let\thu@figure@number@separator\thu@number@separator + \let\thu@table@number@separator\thu@number@separator + \let\thu@equation@number@separator\thu@number@separator +} +\thu@option@hook{number-separator}{\thu@set@number@separator} +\DeclareCaptionFont{thu}{% + \ifthu@degree@bachelor + \fontsize{11bp}{15bp}\selectfont + \else + \ifthu@language@chinese + \fontsize{11bp}{14.3bp}\selectfont + \else + \fontsize{11bp}{12.65bp}\selectfont + \fi + \fi +} +\captionsetup{ + font = thu, + labelsep = quad, + skip = 6bp, + figureposition = bottom, + tableposition = top, +} +\captionsetup[sub]{font=thu} +\renewcommand{\thesubfigure}{(\alph{subfigure})} +\renewcommand{\thesubtable}{(\alph{subtable})} +\newcommand\thu@set@table@font{ + \ifthu@language@chinese + \def\thu@table@font{% + \fontsize{11bp}{14.3bp}\selectfont + \renewcommand\arraystretch{1.42}% + }% + \else + \def\thu@table@font{% + \fontsize{11bp}{12.65bp}\selectfont + \renewcommand\arraystretch{1.47}% + }% + \fi +} +\thu@set@table@font +\thu@option@hook{language}{\thu@set@table@font} +\patchcmd\@floatboxreset{% + \normalsize +}{% + \thu@table@font +}{}{\thu@patch@error{\@floatboxreset}} +\AtEndOfPackageFile*{longtable}{ + \AtBeginEnvironment{longtable}{% + \thu@table@font + } +} +\heavyrulewidth=1.5bp +\lightrulewidth=1bp +\AtEndOfPackageFile*{threeparttable}{ + \g@addto@macro\TPT@defaults{\wuhao} +} +\newcommand{\thu@abstract@name}{摘\quad 要} +\newcommand{\thu@abstract@name@en}{Abstract} +\ctexset{% + chapter = { + nameformat = {}, + numberformat = {}, + titleformat = {}, + fixskip = true, + afterindent = true, + lofskip = 0pt, + lotskip = 0pt, + }, + section = { + afterindent = true, + }, + subsection = { + afterindent = true, + }, + subsubsection = { + afterindent = true, + }, + paragraph/afterindent = true, + subparagraph/afterindent = true, +} +\newcommand\thu@set@section@format{% + \ifthu@degree@bachelor + \ctexset{% + chapter = { + format = \centering\sffamily\fontsize{16bp}{20.8bp}\selectfont, + titleformat = \thu@stretch{3em}, + aftername = \quad, + beforeskip = 27bp, + afterskip = 27bp, + }, + section = { + format = \sffamily\fontsize{14bp}{20bp}\selectfont, + aftername = \quad, + beforeskip = 24bp, + afterskip = 6bp, + }, + subsection = { + format = \sffamily\fontsize{13bp}{20bp}\selectfont, + aftername = \quad, + beforeskip = 12bp, + afterskip = 6bp, + }, + subsubsection = { + format = \sffamily\fontsize{12bp}{20bp}\selectfont, + aftername = \quad, + beforeskip = 12bp, + afterskip = 6bp, + }, + }% + \ifthu@main@language@chinese + \ctexset{ + chapter = { + name = {第,章}, + number = \thechapter, + }, + }% + \else + \ctexset{ + chapter = { + name = \chaptername\space, + number = \thu@english@number{chapter}, + }, + }% + \fi + \else + \ctexset{% + chapter = { + titleformat = {}, + beforeskip = 27bp, + afterskip = 27bp, + number = \thechapter, + }, + section = { + beforeskip = 24bp, + afterskip = 6bp, + }, + subsection = { + beforeskip = 12bp, + afterskip = 6bp, + }, + subsubsection = { + beforeskip = 12bp, + afterskip = 6bp, + }, + }% + \ifthu@main@language@chinese + \ctexset{% + chapter = { + format = \centering\sffamily\sanhao, + nameformat = {}, + titleformat = {}, + name = {第,章}, + aftername = \quad, + }, + section = { + format = \sffamily\fontsize{14bp}{20bp}\selectfont, + aftername = \quad, + }, + subsection = { + format = \sffamily\fontsize{13bp}{20bp}\selectfont, + aftername = \quad, + }, + subsubsection = { + format = \sffamily\fontsize{12bp}{20bp}\selectfont, + aftername = \quad, + }, + }% + \else + \ctexset{% + chapter = { + format = \centering\sffamily\bfseries\fontsize{16bp}{20bp}\selectfont, + nameformat = \MakeUppercase, + titleformat = \MakeUppercase, + name = \chaptername\space, + aftername = \space, + }, + section = { + format = \sffamily\bfseries\fontsize{14bp}{20bp}\selectfont, + aftername = \space, + }, + subsection = { + format = \sffamily\bfseries\fontsize{13bp}{20bp}\selectfont, + aftername = \space, + }, + subsubsection = { + format = \sffamily\bfseries\fontsize{12bp}{20bp}\selectfont, + aftername = \space, + }, + }% + \fi + \fi +} +\thu@set@section@format +\thu@option@hook{degree}{\thu@set@section@format} +\thu@option@hook{main-language}{\thu@set@section@format} +\newcommand\thu@english@number[1]{% + \expandafter\ifcase\csname c@#1\endcsname + Zero\or + One\or + Two\or + Three\or + Four\or + Five\or + Six\or + Seven\or + Eight\or + Nine\or + Ten\or + Eleven\or + Twelve\or + Thirteen\or + Fourteen\or + Fifteen\or + Sixteen\or + Seventeen\or + Eighteen\or + Nineteen\or + Twenty\or + \thu@error{You are genius}% + \fi +} +\newcommand\thu@pdfbookmark[2]{} +\newcommand\thu@phantomsection{} +\NewDocumentCommand\thu@chapter{s o m o}{% + \IfBooleanF{#1}{% + \thu@error{You have to use the star form: \string\thu@chapter*}% + }% + \if@openright\cleardoublepage\else\clearpage\fi% + \IfValueTF{#2}{% + \ifthenelse{\equal{#2}{}}{% + \thu@pdfbookmark{0}{#3}% + }{% + \thu@phantomsection + \addcontentsline{toc}{chapter}{#2}% + }% + }{% + \thu@phantomsection + \addcontentsline{toc}{chapter}{#3}% + }% + \chapter*{#3}% + \IfValueTF{#4}{% + \ifthenelse{\equal{#4}{}}{% + \@mkboth{}{}% + }{% + \@mkboth{#4}{#4}% + }% + }{% + \@mkboth{#3}{#3}% + }% +} +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{2} +\renewcommand\tableofcontents{% + \ifthu@degree@graduate + \thu@chapter*{\contentsname}% + \else + \ifthu@degree@bachelor + \ctexset{chapter/titleformat = \thu@stretch{2.5em}}% + \thu@chapter*[]{\contentsname}% + \ctexset{chapter/titleformat = \thu@stretch{3em}}% + \else + \thu@chapter*[]{\contentsname}% + \fi + \fi + \@starttoc{toc}% +} +\thu@define@key{ + toc-chapter-style = { + name = toc@chapter@style, + choices = { + arial, + times, + }, + default = arial, + }, +} +\thu@option@hook{toc-chapter-style}{\thu@deprecate{"toc-chapter-style" option}{}} +\newcommand\thu@contents@label@delimiter{% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \space + \else + \quad + \fi + \else + \quad + \fi +} +\newcommand\thu@leaders{\nobreak\titlerule*[4bp]{.}\nobreak} +\newcommand\thu@set@toc@format{% + \contentsmargin{\z@}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \titlecontents{chapter} + [0pt]{\sffamily} + {\contentspush{\thecontentslabel\space}\thu@stretch{3em}}{\thu@stretch{3em}} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \else + \ifthu@main@language@english + \titlecontents{chapter} + [\z@]{\addvspace{6bp}\sffamily} + {\contentspush{\thecontentslabel\quad}}{} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [0.5cm]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [1cm]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \fi + \fi + \else + \ifthu@main@language@chinese + \titlecontents{chapter} + [\z@]{\sffamily} + {\contentspush{\thecontentslabel\quad}}{} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \else + \titlecontents{chapter} + [\z@]{\heiti} + {\contentspush{\MakeUppercase{\thecontentslabel}\space}\MakeUppercase}{\MakeUppercase} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \fi + \fi +} +\thu@set@toc@format +\thu@option@hook{degree}{\thu@set@toc@format} +\thu@option@hook{main-language}{\thu@set@toc@format} +\thu@define@key{ + secret-level = { + name = secret@level, + }, + secret-year = { + name = secret@year, + }, + title = { + default = {标题}, + }, + title* = { + default = {Title}, + name = title@en, + }, + author = { + default = {姓名}, + }, + author* = { + default = {Name of author}, + name = author@en, + }, + student-id = { + name = student@id, + }, + supervisor = { + default = {导师姓名}, + }, + supervisor* = { + default = {Name of supervisor}, + name = supervisor@en, + }, + associate-supervisor = { + name = associate@supervisor, + }, + associate-supervisor* = { + name = associate@supervisor@en, + }, + co-supervisor = { + name = co@supervisor, + }, + co-supervisor* = { + name = co@supervisor@en, + }, + % Reserved for compatibility + joint-supervisor = { + name = co@supervisor, + }, + joint-supervisor* = { + name = co@supervisor@en, + }, + degree-category = { + default = {工学博士}, + name = degree@category, + }, + degree-category* = { + default = {Doctor of Philosophy}, + name = degree@category@en, + }, +} +\thu@define@key{ + department = { + default = {计算机科学与技术系}, + }, + discipline = { + % default = {计算机科学与技术}, + }, + discipline* = { + % default = {Computer Science and Technology}, + name = discipline@en, + }, +} +\thu@option@hook{discipline}{% + \ifthu@degree@type@professional + \thu@warning{`discipline' for professional degree is deprecated. Use `professional-field' instead.}% + \let\thu@professional@field\thu@discipline + \let\thu@discipline\@empty + \fi +} +\thu@option@hook{discipline*}{% + \ifthu@degree@type@professional + \thu@warning{`discipline*' for professional degree is deprecated. Use `professional-field*' instead.}% + \let\thu@professional@field@en\thu@discipline@en + \let\thu@discipline@en\@empty + \fi +} +\thu@define@key{ + professional-field = { + name = professional@field, + }, + professional-field* = { + name = professional@field@en, + }, + engineering-field = { + name = engineering@field, + }, + engineering-field* = { + name = engineering@field@en, + }, + date = { + default = {\the\year-\two@digits{\month}-\two@digits{\day}}, + }, + clc, + udc, + id, + discipline-level-1 = { + default = {一级学科名称}, + name = discipline@level@i, + }, + discipline-level-2 = { + default = {二级学科名称}, + name = discipline@level@ii, + }, + start-date = { + name = start@date, + default = {\the\year-\two@digits{\month}-\two@digits{\day}}, + }, + end-date = { + name = end@date, + default = {\the\year-\two@digits{\month}-\two@digits{\day}}, + }, + include-spine = { + name = include@spine, + choices = { + false, + true, + }, + default = false, + }, +} +\newcommand\thu@format@date[2]{% + \edef\thu@@date{#2}% + \def\thu@@process@date##1-##2-##3\@nil{% + #1{##1}{##2}{##3}% + }% + \expandafter\thu@@process@date\thu@@date\@nil +} +\newcommand\thu@date@zh@digit[3]{#1 年 \number#2 月 \number#3 日} +\newcommand\thu@date@zh@digit@short[3]{#1 年 \number#2 月} +\newcommand\thu@date@zh@short[3]{\zhdigits{#1}年\zhnumber{#2}月} +\newcommand\thu@date@month[1]{% + \ifcase\number#1\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December% + \fi +} +\newcommand\thu@date@en@short[3]{\thu@date@month{#2}, #1} +\newcommand\thu@underline[2][6em]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt} +\newcommand\thu@uline[2][6em]{\uline{\hb@xt@ #1{\hss#2\hss}}} +\newcommand\thu@fixed@box[2]{% + \begingroup + \ifLuaTeX + \ltjsetparameter{kanjiskip = {0pt plus 2filll minus 1filll}}% + \else + \renewcommand\CJKglue{\hspace{0pt plus 2filll minus 1filll}}% + \fi + \makebox[#1][l]{#2}% + \endgroup +} +\newbox\thu@stretch@box +\newcommand\thu@stretch[2]{% + \sbox\thu@stretch@box{#2}% + \ifdim \wd\thu@stretch@box < #1\relax + \begingroup + \ifLuaTeX + \ltjsetparameter{kanjiskip = {0pt plus 2filll}}% + \else + \renewcommand\CJKglue{\hspace{0pt plus 2filll}}% + \fi + \makebox[#1][l]{#2}% + \endgroup + \else + \box\thu@stretch@box + \fi +} +\newbox\thu@pad@box +\newcommand\thu@pad[2]{% + \sbox\thu@pad@box{#2}% + \ifdim \wd\thu@pad@box < #1\relax + \makebox[#1][l]{\box\thu@pad@box}% + \else + \box\thu@pad@box + \fi +} +\newcounter{thu@csl@count} +\newcommand\thu@name@title@process[1]{% + \ifcase\c@thu@csl@count % == 0 + \gdef\thu@@name{#1}% + \or % == 1 + \gdef\thu@@title{#1}% + \fi + \stepcounter{thu@csl@count}% +} +\newcommand\thu@name@title@format[2]{% + \thu@pad{3cm}{\thu@stretch{4em}{#1}}% + \thu@stretch{3em}{#2}% +} +\newcommand\thu@name@title[1]{% + \setcounter{thu@csl@count}{0}% + \gdef\thu@@name{}% + \gdef\thu@@title{}% + \expandafter\comma@parse\expandafter{#1}{\thu@name@title@process}% + \thu@name@title@format{\thu@@name}{\thu@@title}% +} +\renewcommand\maketitle{% + \cleardoublepage + \pagenumbering{Alph}% + \thu@pdfbookmark{-1}{\thu@title}% + \thu@titlepage + \ifthu@include@spine@true + \spine + \fi + \ifthu@degree@graduate + \ifthu@thesis@type@thesis + \cleardoublepage + \thu@titlepage@en + \fi + \fi + \clearpage +} +\newcommand\thu@titlepage{% + \thusetup{language = chinese}% + \ifthu@degree@graduate + % 研究生 + \thu@titlepage@thesis + \else + \ifthu@degree@bachelor + % 本科生 + \thu@titlepage@bachelor + \else + \ifthu@degree@postdoc + % 博后 + \thu@cover@postdoc + \cleardoublepage + \thu@titlepage@postdoc + \fi + \fi + \fi + \thu@reset@main@language +} +\newcommand\thu@titlepage@thesis{% + \newgeometry{ + top = 2cm, + bottom = 6cm, + hmargin = 3.5cm, + }% + \thispagestyle{empty}% + \null\vskip 8.1pt% + \begingroup + \centering + \parbox[t][2cm][t]{\textwidth}{% + \hskip -21.5pt% + \thu@titlepage@secret + }\par + \vskip 40.5pt% + \begingroup + \sffamily\fontsize{26bp}{46.8bp}\selectfont + \thu@title\par + \endgroup + \ifthu@main@language@english + \vskip 5.4pt% + \begingroup + \sffamily\bfseries\fontsize{20bp}{31.2bp}\selectfont + \thu@title@en\par + \endgroup + \vskip -9.2pt% + \fi + \vskip 24.1pt% + \thu@title@page@degree@category\par + \vfill + \ifthu@degree@type@academic + \parbox[t][7.25cm][t]{\textwidth}{% + \fangsong\fontsize{16bp}{31.2bp}\selectfont + \thu@titlepage@info + }\par + \else + \parbox[t][5.25cm][b]{\textwidth}{% + \fangsong\fontsize{16bp}{31.2bp}\selectfont + \thu@titlepage@info + }\par + \vskip 62pt% + \fi + \parbox[t][1.03cm][t]{\textwidth}{\centering\thu@titlepage@date}\par + \endgroup + \clearpage + \restoregeometry +} +\newcommand\thu@set@student@id{% + \ifthu@thesis@type@proposal\else + \ifx\thu@student@id\@empty\else + \thu@warning{`student-id' in "\protect\thusetup" would be ignored when `thesis-type' is not proposal.}% + \fi + \fi +} +\thu@set@student@id +\thu@option@hook{thesis-type}{\thu@set@student@id} +\thu@option@hook{student-id}{\thu@set@student@id} +\newcommand\thu@titlepage@secret{% + \sffamily\sanhao + \ifx\thu@secret@level\@empty + \phantom{秘密}% + \else + \thu@secret@level\symbol{"2605}\makebox[3em][c]{\thu@secret@year}年% + \fi\par +} +\newcommand\thu@title@page@degree@category{% + \begingroup + \fontsize{16bp}{22bp}\selectfont + \ifLuaTeX + \fontspec{\CJK@family}% + \ltjsetparameter{kanjiskip = {1bp}}% + \else + \CJKfamily+{}% + \renewcommand\CJKglue{\hspace{1bp}}% + \fi + \ifthu@thesis@type@thesis + (申请清华大学\thu@degree@category + \ifthu@degree@type@professional + 专业% + \fi + 学位论文)% + \else + \ifthu@thesis@type@proposal + (清华大学% + \ifthu@degree@doctor + 博士% + \else + \ifthu@degree@master + 硕士% + \fi + \fi + 学位论文选题报告)% + \fi + \fi + \par + \endgroup +} +\newcommand\thu@titlepage@info{% + \thu@titlepage@info@tabular{2.3cm}{2.85cm}{2.75cm}{0.77cm}{% + \thu@info@item{培养单位}{}{\thu@department}% + \ifthu@degree@type@academic + \thu@info@item{学科}{}{\thu@discipline}% + \thu@info@item{研究生}{\thu@name@title}{\thu@author}% + \else + \thu@info@item{专业领域}{}{\thu@professional@field}% + \thu@info@item{工程领域}{}{\thu@engineering@field}% + \thu@info@item{申请人}{\thu@name@title}{\thu@author}% + \fi + \ifthu@thesis@type@proposal + \ifx\thu@student@id\@empty + \thu@warning{Missing option `student-id' in "\protect\thusetup", ID will not appear on cover.}% + \else + \thu@info@item{学号}{}{\thu@student@id}% + \fi + \fi + \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}% + \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}% + \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}% + }\par +} +\newcommand\thu@titlepage@info@tabular[5]{% + \def\thu@info@item##1##2##3{% + \ifx##3\@empty\else + \thu@pad{#2}{\thu@fixed@box{#3}{##1}}% + \thu@pad{#4}{:}% + ##2{##3}\\ + \fi + }% + \hspace{#1}% + \begin{tabular}{l}% + \renewcommand\arraystretch{1}% + #5% + \end{tabular}% +} +\newcommand\thu@titlepage@date{% + \begingroup + \sanhao + \ifLuaTeX + \ltjsetparameter{kanjiskip = {1bp}}% + \else + \renewcommand\CJKglue{\hspace{1bp}}% + \fi + \thu@format@date{\thu@date@zh@short}{\thu@date}\par + \endgroup +} +\newcommand{\thu@titlepage@en}{% + \newgeometry{ + top = 5.5cm, + bottom = 5cm, + hmargin = 3.4cm, + }% + \thispagestyle{empty}% + \thusetup{language = english}% + \ifthu@degree@type@academic + \thu@titlepage@en@graduate@academic + \else + \thu@titlepage@en@graduate@professional + \fi + \thu@reset@main@language + \clearpage + \restoregeometry +} +\newcommand\thu@titlepage@en@graduate@academic{% + \begingroup + \centering + \null\vskip -0.31cm% + \parbox[t][143bp][t]{\textwidth}{% + \centering\thu@titlepage@en@title + }\par + \sanhao[1.725]% + \thu@titlepage@en@degree + \vskip 3bp% + in\par + \vskip 3.5bp% + {\bfseries\sffamily\thu@discipline@en\par}% + \vfill + {\sffamily by\par}% + \vskip 0.24cm% + {\sffamily\bfseries\thu@author@en\par}% + \vskip 0.18cm% + \parbox[t][3.0cm][t]{\textwidth}{% + \centering + \xiaosan[2.1]% + \thu@titlepage@en@supervisor + }\par + \thu@titlepage@en@date + \vskip 0.7cm% + \endgroup +} +\newcommand\thu@titlepage@en@graduate@professional{% + \begingroup + \centering + \null\vskip -0.31cm% + \parbox[t][143bp][t]{\textwidth}{% + \centering\thu@titlepage@en@title + }\par + \sanhao[1.725]% + \thu@titlepage@en@degree + \vfill + {\sffamily by\par}% + \vskip 0.24cm% + {\sffamily\bfseries\thu@author@en\par}% + \ifx\thu@professional@field@en\empty + \vskip 1.95cm% + \else + \vskip -0.1cm% + {\sffamily\bfseries(\thu@professional@field@en)\par}% + \vskip 1.1cm% + \fi + \parbox[t][3.37cm][t]{\textwidth}{% + \centering + \xiaosan[1.82]% + \thu@titlepage@en@supervisor + }\par + \thu@titlepage@en@date + \vskip 0.3cm% + \endgroup +} +\newcommand\thu@titlepage@en@title{% + \begingroup + % 对齐到网格,每行 15.6bp + \sffamily\bfseries\fontsize{20bp}{31.2bp}\selectfont + \thu@title@en\par + \endgroup +} +\newcommand\thu@thesis@name@en{% + \ifthu@degree@master + Thesis% + \else + Dissertation% + \fi +} +\newcommand\thu@titlepage@en@degree{% + \thu@thesis@name@en{} submitted to\par + {\bfseries Tsinghua University\par}% + in partial fulfillment of the requirement\par + for the + \ifthu@degree@type@professional + professional + \fi + degree of\par + {\sffamily\bfseries\thu@degree@category@en\par}% +} +\newcommand\thu@titlepage@en@supervisor{% + \begin{tabular}{r@{\makebox[20.5bp][l]{\hspace{2bp}:}}l}% + \renewcommand\arraystretch{1}% + \thu@thesis@name@en{} Supervisor & \thu@supervisor@en \\ + \ifx\thu@associate@supervisor@en\@empty\else + Associate Supervisor & \thu@associate@supervisor@en \\ + \fi + \ifx\thu@co@supervisor@en\@empty\else + Co-supervisor & \thu@co@supervisor@en \\ + \fi + \end{tabular}% +} +\newcommand\thu@titlepage@en@date{% + \begingroup + \sffamily\bfseries\sanhao + \thu@format@date{\thu@date@en@short}{\thu@date}\par + \endgroup +} +\newlength\thu@info@label@width +\newlength\thu@info@label@text@width +\newcommand\thu@titlepage@bachelor{% + \newgeometry{ + top = 3.8cm, + bottom = 3.2cm, + left = 3.2cm, % 装订线靠左 0.2 cm + right = 3cm, + }% + \thispagestyle{empty}% + \begingroup + \centering + \parbox[t][0cm][t]{\textwidth}{% + \hfill + \xiaosi + \ifx\thu@secret@level\@empty\else + \thu@secret@level\space\thu@secret@year 年\par + \fi + }\par + \endgroup + \vspace{19bp}% + \begingroup + \centering + \hspace*{-5bp}% + \includegraphics[width=50.4bp]{thu-fig-logo.pdf}% + \hspace{10bp}% + \raisebox{7bp}{\includegraphics[width=117bp]{thu-text-logo.pdf}}% + \par + \vspace{17bp}% + \begingroup + \sffamily\bfseries\xiaochu\ziju{0.3}% + 综合论文训练% + \ifthu@thesis@type@proposal + \\开题报告 + \fi + \par + \endgroup + \vspace{48bp}% + \parbox[t][136bp]{\linewidth}{% + \centering + \heiti\fontsize{26bp}{32.5bp}\selectfont + \thu@title\par + \ifthu@main@language@english + \thusetup{language=english}% + \thu@title@en\par + \thusetup{language=chinese}% + \fi + }\par + \endgroup + \begingroup + \fangsong + \fontsize{16bp}{30.96bp}\selectfont + \noindent + \def\thu@name@title@format##1##2{% + \thu@stretch{4em}{##1}% + \hspace{1.5em}% + \thu@stretch{2.5em}{##2}% + }% + \ifx\thu@co@supervisor\@empty + \setlength\thu@info@label@width{2.5cm}% + \setlength\thu@info@label@text@width{4em}% + \else + \setlength\thu@info@label@width{86bp}% + \setlength\thu@info@label@text@width{5em}% + \fi + \thu@titlepage@info@tabular{81bp}{\thu@info@label@width}{\thu@info@label@text@width}{0.82cm}{% + \thu@info@item{系别}{}{\thu@department}% + \thu@info@item{专业}{}{\thu@discipline}% + \thu@info@item{姓名}{\thu@name@title}{\thu@author}% + \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}% + \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}% + \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}% + }\par + \endgroup + \vfill + \begingroup + \centering + \fontsize{16bp}{24bp}\selectfont + \ziju{0.03}% + \thu@format@date{\thu@date@zh@short}{\thu@date}\par + \endgroup + \vspace*{60bp}% + \clearpage + \restoregeometry +} +\newcommand\thu@cover@postdoc{% + \thispagestyle{empty}% + \begin{center}% + \renewcommand\ULthickness{0.7pt}% + \vspace*{0.35cm}% + {\sihao[2.6]% + \thu@stretch{3.1em}{分类号}\thu@underline[3.7cm]{\thu@clc}\hfill + 密级\thu@underline[3.7cm]{\thu@secret@level}\par + \thu@stretch{3.1em}{U D C}\thu@underline[3.7cm]{\thu@udc}\hfill + 编号\thu@underline[3.7cm]{\thu@id}\par + }% + \vskip 3.15cm% + {\sffamily\bfseries\xiaoer[2.6]% + {\ziju{1.5}清华大学\par}% + {\ziju{0.5}博士后研究工作报告\par}% + }% + \vskip 0.2cm% + \parbox[t][4.0cm][c]{\textwidth}{% + \centering\sihao[3.46]% + \renewcommand\ULdepth{1em}% + \expandafter\uline\expandafter{\thu@title}\par + }\par + \vskip 0.4cm% + {\xiaosi\thu@author\par}% + \vskip 1.4cm% + {\xiaosi[1.58]% + \renewcommand\ULdepth{0.9em}% + 工作完成日期\quad + \thu@uline[5.9cm]{% + \thu@format@date{\thu@date@zh@digit@short}{\thu@start@date}—% + \thu@format@date{\thu@date@zh@digit@short}{\thu@end@date}% + }\par + \vskip 0.55cm% + 报告提交日期\quad + \thu@uline[5.9cm]{\thu@format@date{\thu@date@zh@digit@short}{\thu@date}}\par + }% + \vskip 0.45cm% + {\xiaosi[2]{\ziju{1}清华大学}\quad (北京)\par}% + \vskip 0.25cm% + {\xiaosi[2]\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}% + \end{center}% +} +\newcommand\thu@titlepage@postdoc{% + \thispagestyle{empty}% + \begin{center}% + \vspace*{1.5cm}% + \parbox[t][3cm][c]{\textwidth}{% + \centering\sanhao[1.95]\thu@title\par + }\par + \vskip 0.15cm% + \parbox[t][3cm][c]{\textwidth}{% + \centering\sihao[1.36]\thu@title@en\par + }\par + \vskip 0.4cm% + {\xiaosi[2.6]% + \begin{tabular}{l@{\quad}l}% + \renewcommand\arraystretch{1}% + \thu@stretch{11em}{博士后姓名} & \thu@author \\ + \thu@stretch{11em}{流动站(一级学科)名称} & \thu@discipline@level@i \\ + \thu@stretch{11em}{专\quad{}业(二级学科)名称} & \thu@discipline@level@ii \\ + \end{tabular}\par + }% + \vskip 2.7cm% + {\xiaosi[2.6]% + 研究工作起始时间\quad\thu@format@date{\thu@date@zh@digit}{\thu@start@date}\par + \vskip 0.1cm% + 研究工作期满时间\quad\thu@format@date{\thu@date@zh@digit}{\thu@end@date}\par + }% + \vskip 2.1cm% + {\xiaosi[2.6]清华大学人事处(北京)\par}% + \vskip 0.6cm% + {\wuhao\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}% + \end{center}% +} +\def\thu@committee@name{学位论文指导小组、公开评阅人和答辩委员会名单} +\NewEnviron{committee}[1][]{% + \ifthu@degree@graduate + \cleardoublepage + \let\thu@committee@file\@empty + \kv@define@key{thu@committee}{name}{\let\thu@committee@name\kv@value}% + \kv@define@key{thu@committee}{file}{\let\thu@committee@file\kv@value}% + \kv@set@family@handler{thu@committee}{% + \ifx\kv@value\relax + \let\thu@committee@file\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@committee}{#1}% + \ifx\thu@committee@file\@empty + \begingroup + \ctexset{ + chapter = { + format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont, + afterskip = 49bp, + }, + section = { + beforeskip = 26bp, + afterskip = 9.5bp, + format += \centering, + numbering = false, + afterindent = false, + }, + }% + \thu@chapter*[]{\thu@committee@name}% + \thispagestyle{empty}% + \thusetup{language=chinese}% + \BODY\clearpage + \thu@reset@main@language + \endgroup + \else + \thu@pdfbookmark{0}{\thu@committee@name}% + \includepdf{\thu@committee@file}% + \fi + \fi +} +\newcommand\copyrightpage[1][]{% + \ifthu@degree@postdoc\relax\else + \cleardoublepage + \def\thu@@tmp{#1}% + \ifx\thu@@tmp\@empty + \thusetup{language=chinese}% + \ifthu@degree@bachelor + \thu@copyright@page@bachelor + \else + \thu@copyright@page@graduate + \fi + \clearpage + \thu@reset@main@language + \else + \thispagestyle{empty}% + \thu@pdfbookmark{0}{关于学位论文使用授权的说明}% + \thu@phantomsection + \kv@define@key{thu@copyright}{file}{\includepdf{\kv@value}}% + \kv@set@family@handler{thu@copyright}{% + \ifx\kv@value\relax + \includepdf{\kv@key}% + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@copyright}{#1}% + \fi + \fi + \thu@replace@with@error{copyrightpage} +} +\newcommand{\thu@authorization@frontdate}{% + 日\ifthu@degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:} +\newcommand\thu@copyright@page@graduate{% + \begingroup + \ctexset{ + chapter = { + format = {\centering\sffamily\erhao}, + beforeskip = 40bp, + afterskip = 36bp, + }, + }% + \thu@chapter*[]{关于学位论文使用授权的说明}% + \endgroup + \thispagestyle{empty}% + \vskip 13bp% + \begingroup + \fontsize{14bp}{26bp}\selectfont + 本人完全了解清华大学有关保留、使用学位论文的规定,即:\par + 清华大学拥有在著作权法规定范围内学位论文的使用权,其中包括:% + (1)\nobreak 已获学位的研究生必须按学校规定提交学位论文,% + 学校可以采用影印、缩印或其他复制手段保存研究生上交的学位论文;\allowbreak + (2)\nobreak 为教学和科研目的,学校可以将公开的学位论文作为资料在图书馆、资料室等场所供校内师生阅读,% + 或在校园网上供校内师生浏览部分内容;\allowbreak + \ifthu@degree@doctor + (3)\nobreak 根据《中华人民共和国学位法》及上级教育主管部门具体要求,向国家图书馆报送相应的学位论文。% + \else + (3)\nobreak 按照上级教育主管部门督导、抽查等要求,报送相应的学位论文。% + \fi + \par + 本人保证遵守上述规定。\par + \endgroup + \vskip 33bp% + \begingroup + \fontsize{12bp}{23.4bp}\selectfont + \parindent\z@ + \leftskip 43bp% + 作者签名:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}% + 导师签名:\hspace{4bp}\thu@underline[7em]{}\par + \vskip 6bp% + 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}% + 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\par + \endgroup +} +\newcommand\thu@copyright@page@bachelor{% + \begingroup + \ctexset{ + chapter = { + format = {\centering\sffamily\erhao}, + beforeskip = 40bp, + afterskip = 37bp, + }, + }% + \thu@chapter*[]{关于论文使用授权的说明}% + \endgroup + \thispagestyle{empty}% + \vspace*{13bp}% + \begingroup + \fontsize{14bp}{26bp}\selectfont + 本人完全了解清华大学有关保留、使用综合论文训练论文的规定,即:% + 学校有权保留论文的复印件,允许论文被查阅和借阅;% + 学校可以公布论文的全部或部分内容,可以采用影印、缩印或其他复制手段保存论文。\par + \endgroup + \vspace{71bp}% + \begingroup + \setlength{\parindent}{0pt}% + \fontsize{12bp}{18bp}\selectfont + \hspace*{42bp}作者签名:\hspace{118bp}导师签名:\par + \vspace{11bp}% + \hspace*{42bp}日\hspace{2em}期:\hspace{118bp}日\hspace{2em}期:\par + \endgroup +} +\thu@define@key{ + keywords, + keywords* = { + name = keywords@en, + }, +} +\newcommand\thu@clist@use[2]{% + \def\thu@@tmp{}% + \def\thu@clist@processor##1{% + \ifx\thu@@tmp\@empty + \def\thu@@tmp{#2}% + \else + #2% + \fi + ##1% + }% + \expandafter\comma@parse\expandafter{#1}{\thu@clist@processor}% +} +\newenvironment{abstract}{% + \thusetup{language = chinese}% + \ifthu@degree@graduate + \begingroup + \ifthu@main@language@english + \ctexset{% + chapter/format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont, + }% + \fi + \thu@chapter*{\thu@abstract@name}% + \endgroup + \else + \thu@chapter*[]{\thu@abstract@name}% + \fi +}{% + \par + \null\par + \ifthu@degree@postdoc + \textbf{关键词:}% + \else + \noindent + \textsf{关键词:}% + \fi + \thu@clist@use{\thu@keywords}{;}\par + \gdef\thu@keywords{}% + \thu@reset@main@language % switch back to main language +} +\newenvironment{abstract*}{% + \thusetup{language = english}% + \ifthu@degree@bachelor + \begingroup + \ctexset{chapter/afterskip = 30bp}% + \thu@chapter*[]{\thu@abstract@name@en}% + \endgroup + \else + \ifthu@degree@graduate + \thu@chapter*{\thu@abstract@name@en}% + \else + \thu@chapter*[]{\thu@abstract@name@en}% + \fi + \fi +}{% + \par + \null\par + \ifthu@degree@postdoc\else + \noindent + \fi + \textbf{Keywords:} \thu@clist@use{\thu@keywords@en}{; }\par + \thu@reset@main@language % switch back to main language +} +\newenvironment{denotation}[1][2.5cm]{% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \thu@chapter*[]{\thu@denotation@name}% + \else + \thu@chapter*{\thu@denotation@name}% + \fi + \else + \ifthu@degree@graduate + \thu@chapter*{\thu@denotation@name}% + \else + \thu@chapter*[]{\thu@denotation@name}% + \fi + \fi + \begin{thu@denotation}[labelwidth=#1]% +}{% + \end{thu@denotation}% +} +\newlist{thu@denotation}{description}{1} +\setlist[thu@denotation]{% + nosep, + font=\normalfont, + align=left, + leftmargin=!, % sum of the following 3 lengths + labelindent=0pt, + labelwidth=2.5cm, + labelsep*=0.5cm, + itemindent=0pt, +} +\newcommand{\thu@statement@text@bachelor}{% + 本人郑重声明:所呈交的综合论文训练论文,是本人在导师指导下,独立进行研究工作所取得的成果。% + 尽我所知,除文中已经注明引用的内容外,本论文的研究成果不包含任何他人享有著作权的内容。% + 对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式标明。% +} +\newcommand{\thu@statement@text@graduate}{% + 本人郑重声明:所呈交的学位论文,是本人在导师指导下,独立进行研究工作所取得的成果% + \ifx\thu@secret@level\@empty + ,不包含涉及国家秘密的内容% + \fi% + 。尽我所知,除文中已经注明引用的内容外,本学位论文的研究成果不包含任何他人享有著作权的内容。% + 对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式标明。% +} +\newcommand{\thu@signature}{签\hspace{1em}名:} +\newcommand{\thu@backdate}{日\hspace{1em}期:} +\newenvironment{acknowledgements}{% + \@mainmatterfalse + \thu@end@appendix@ref@section + \thu@chapter*{\thu@acknowledgements@name}% +}{% +} +\thu@define@key{ + statement-page-style = { + name = statement@page@style, + choices = { + plain, + empty, + }, + default = plain, + } +} +\newcommand\statement[1][]{% + \@mainmatterfalse + \thu@end@appendix@ref@section + \let\thu@statement@file\@empty + \kv@define@key{thu@statement}{page-style}{\thusetup{statement-page-style=##1}}% + \kv@define@key{thu@statement}{file}{\let\thu@statement@file\kv@value}% + \kv@set@family@handler{thu@statement}{% + \ifx\kv@value\relax + \let\thu@statement@file\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@statement}{#1}% + \ifx\thu@statement@file\@empty + \thusetup{language=chinese}% + \begingroup + \ifthu@degree@graduate + \ifthu@main@language@english + \ctexset{% + chapter/format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont, + }% + \fi + \fi + \thu@chapter*{\thu@statement@name}% + \endgroup + \thispagestyle{\thu@statement@page@style}% + \ifthu@degree@graduate + \vspace{13bp}% + \fontsize{12bp}{21bp}\selectfont + \begingroup + \renewcommand\CJKglue{\hspace{.15bp plus .1bp}}% + \thu@statement@text@graduate\par + \endgroup + \vspace{78.5bp}% + \begingroup + \noindent\hspace{153.5bp}\fontsize{13bp}{18bp}\selectfont + \thu@signature\thu@underline[76bp]{}\hspace{-3bp}% + \thu@backdate\thu@underline[65bp]{}\par + \endgroup + \else + \ifthu@degree@bachelor + \begingroup + \renewcommand\CJKglue{\hspace{.1bp}}% + \thu@statement@text@bachelor\par + \endgroup + \vspace{40bp}% + \hfill 签\hspace{.5em}名:\thu@underline[2.75cm]{}\hspace{.5em}% + 日\hspace{.5em}期:\thu@underline[2.75cm]{}\par + \fi + \fi + \thu@reset@main@language + \else + \includepdf[pagecommand={% + \markboth{\thu@statement@name}{}% + \thu@phantomsection + \addcontentsline{toc}{chapter}{\thu@statement@name}% + \thispagestyle{\thu@statement@page@style}% + }]{\thu@statement@file}% + \fi + \thu@replace@with@error{statement} +} +\let\acknowledgement\acknowledgements +\let\endacknowledgement\endacknowledgements +\def\thu@listof#1{% #1: float type + \setcounter{tocdepth}{2}% restore tocdepth in case being modified + \@ifstar{\thu@deprecate{starred form of \protect\listof... command}{}}{}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \thu@chapter*[]{\csname list#1name\endcsname}% + \else + \thu@chapter*{\csname list#1name\endcsname}% + \fi + \else + \ifthu@degree@graduate + \thu@chapter*{\csname list#1name\endcsname}% + \else + \thu@chapter*[]{\csname list#1name\endcsname}% + \fi + \fi + \@starttoc{\csname ext@#1\endcsname}% +} +\renewcommand\listoffigures{% + \thu@listof{figure}% +} +\titlecontents{figure} + [\z@]{} + {\contentspush{\figurename~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +\renewcommand\listoftables{% + \thu@listof{table}% +} +\titlecontents{table} + [\z@]{} + {\contentspush{\tablename~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +\newcommand\listoffiguresandtables{% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \thu@chapter*[]{\thu@list@figure@table@name}% + \else + \thu@chapter*{\thu@list@figure@table@name}% + \fi + \else + \ifthu@degree@graduate + \thu@chapter*{\thu@list@figure@table@name}% + \else + \thu@chapter*[]{\thu@list@figure@table@name}% + \fi + \fi + \@starttoc{lof}% + \par + \null\par + \@starttoc{lot}% +} +\def\ext@equation{loe} +\def\equcaption#1{% + \thu@deprecate{"\protect\equcaption" command}{}% + \addcontentsline{\ext@equation}{equation}% + {\protect\numberline{#1}}} +\newcommand\listofequations{% + \thu@deprecate{"\protect\listofequations" command}{}% + \thu@listof{equation}% +} +\titlecontents{equation} + [0pt]{\addvspace{6bp}} + {\contentspush{\thu@equation@name~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +\contentsuse{equation}{loe} +\thu@define@key{ + cite-style = { + name = cite@style, + choices = { + super, + inline, + author-year, + } + } +} +\newcommand\thu@bib@heading[1]{\thu@chapter*{#1}} +\def\bibliographystyle#1{% + \gdef\bu@bibstyle{#1}% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \immediate\write\@auxout{\string\bibstyle{#1}}% + \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}% + \fi}% +} +\def\bibliography#1{% + \if@filesw + \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}% + \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}% + \fi + \gdef\bu@bibdata{#1}% + \@input@{\jobname.bbl}} +\PassOptionsToPackage{compress}{natbib} +\AtEndOfPackageFile*{natbib}{ + \DeclareRobustCommand\inlinecite{\@inlinecite} + \def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup} + \let\onlinecite\inlinecite + \newcommand\bibstyle@super{% + \bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}} + \newcommand\bibstyle@inline{% + \bibpunct{[}{]}{,}{n}{,}{,}} + \@namedef{bibstyle@author-year}{% + \bibpunct{(}{)}{;}{a}{,}{,}} + \thu@option@hook{cite-style}{\@nameuse{bibstyle@\thu@cite@style}} + \@namedef{bibstyle@thuthesis-numeric}{\citestyle{super}} + \@namedef{bibstyle@thuthesis-author-year}{\citestyle{author-year}} + \@namedef{bibstyle@cell}{\citestyle{author-year}} + \@namedef{bibstyle@thuthesis-bachelor}{\citestyle{super}} + \renewcommand\NAT@citesuper[3]{% + \ifNAT@swa + \if*#2*\else + #2\NAT@spacechar + \fi + % \unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}% + % \if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup} + \unskip\kern\p@ + \textsuperscript{% + \NAT@@open#1\NAT@@close + \if*#3*\else#3\fi + }% + \kern\p@ + \else + #1% + \fi + \endgroup + } + \renewcommand\NAT@citenum[3]{% + \ifNAT@swa + \NAT@@open + \if*#2*\else + #2\NAT@spacechar + \fi + % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close + #1\NAT@@close + \if*#3*\else + \textsuperscript{#3}% + \fi + \else + #1% + \fi + \endgroup + } + \def\NAT@citexnum[#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty + \@for\@citeb:=\NAT@cite@list\do + {\@safe@activestrue + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \@safe@activesfalse + \@ifundefined{b@\@citeb\@extra@b@citeb}{% + {\reset@font\bfseries?} + \NAT@citeundefined\PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}}% + {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm + \NAT@parse{\@citeb}% + \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% + \let\NAT@name=\NAT@all@names + \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% + \fi + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \ifNAT@swa + \@ifnum{\NAT@ctype>\@ne}{% + \@citea + \NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}% + }{% + \@ifnum{\NAT@cmprs>\z@}{% + \NAT@ifcat@num\NAT@num + {\let\NAT@nm=\NAT@num}% + {\def\NAT@nm{-2}}% + \NAT@ifcat@num\NAT@last@num + {\@tempcnta=\NAT@last@num\relax}% + {\@tempcnta\m@ne}% + \@ifnum{\NAT@nm=\@tempcnta}{% + \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}% + }{% + \advance\@tempcnta by\@ne + \@ifnum{\NAT@nm=\@tempcnta}{% + % \ifx\NAT@last@yr\relax + % \def@NAT@last@yr{\@citea}% + % \else + % \def@NAT@last@yr{--\NAT@penalty}% + % \fi + \ifthu@degree@bachelor + \ifx\NAT@last@yr\relax + \def@NAT@last@yr{\@citea}% + \else + \def@NAT@last@yr{-\NAT@penalty}% + \fi + \else + \def@NAT@last@yr{-\NAT@penalty}% + \fi + }{% + \NAT@last@yr@mbox + }% + }% + }{% + \@tempswatrue + \@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}% + \if@tempswa\NAT@citea@mbox\fi + }% + }% + \NAT@def@citea + \else + \ifcase\NAT@ctype + \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else + \@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}% + \fi + \if*#1*\else#1\NAT@spacechar\fi + \NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}% + \NAT@def@citea@box + \or + \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space\NAT@alias + \fi + \fi + }% + }% + \@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}% + \ifNAT@swa\else + % \@ifnum{\NAT@ctype=\z@}{% + % \if*#2*\else\NAT@cmt#2\fi + % }{}% + \NAT@mbox{\NAT@@close}% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else + \textsuperscript{#2}% + \fi + }{}% + \NAT@super@kern + \fi + }{#1}{#2}% + }% + \renewcommand\NAT@cite% + [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi + % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup} + #1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup} + \def\NAT@citex% + [#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty + \@for\@citeb:=\NAT@cite@list\do + {\@safe@activestrue + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \@safe@activesfalse + \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea% + {\reset@font\bfseries ?}\NAT@citeundefined + \PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}% + {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year + \NAT@parse{\@citeb}% + \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% + \let\NAT@name=\NAT@all@names + \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% + \fi + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \ifNAT@swa\ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}% + \else + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep + \ifx\NAT@last@yr\NAT@year + \def\NAT@temp{{?}}% + \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% + {Multiple citation on page \thepage: same authors and + year\MessageBreak without distinguishing extra + letter,\MessageBreak appears as question mark}\fi + \NAT@hyper@{\NAT@exlab}% + \else\unskip\NAT@spacechar + \NAT@hyper@{\NAT@date}% + \fi + \else + \@citea\NAT@hyper@{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{% + \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb + }% + \NAT@date + }% + \fi + \fi + \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NAT@hyper@{\NAT@date}% + \or\@citea\NAT@hyper@{\NAT@alias}% + \fi \NAT@def@citea + \else + \ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \else + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep + \ifx\NAT@last@yr\NAT@year + \def\NAT@temp{{?}}% + \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% + {Multiple citation on page \thepage: same authors and + year\MessageBreak without distinguishing extra + letter,\MessageBreak appears as question mark}\fi + \NAT@hyper@{\NAT@exlab}% + \else + \unskip\NAT@spacechar + \NAT@hyper@{\NAT@date}% + \fi + \else + \@citea\NAT@hyper@{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}% + {\@citeb\@extra@b@citeb}% + \NAT@date + }% + \fi + \fi + \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NAT@hyper@{\NAT@date}% + \or\@citea\NAT@hyper@{\NAT@alias}% + \fi + \if\relax\NAT@date\relax + \NAT@def@citea + \else + \NAT@def@citea@close + \fi + \fi + }}\ifNAT@swa\else + % \if*#2*\else\NAT@cmt#2\fi + \if\relax\NAT@date\relax\else\NAT@@close\fi + \if*#2*\else\textsuperscript{#2}\fi + \fi}{#1}{#2}} + \renewcommand\bibsection{\thu@bib@heading{\bibname}} + \newcommand\thu@set@bibliography@format{% + \renewcommand\bibfont{\fontsize{10.5bp}{16bp}\selectfont}% + \setlength{\bibsep}{3bp \@plus 3bp \@minus 3bp}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \setlength{\bibhang}{21bp}% 2em + \else + \renewcommand\bibfont{\fontsize{10.5bp}{17bp}\selectfont}% + \setlength{\bibsep}{6bp \@plus 3bp \@minus 3bp}% + \setlength{\bibhang}{0.5in}% + \fi + \else + \setlength{\bibhang}{21bp}% 2em + \fi + } + \thu@set@bibliography@format + \thu@option@hook{degree}{\thu@set@bibliography@format} + \thu@option@hook{main-language}{\thu@set@bibliography@format} + \patchcmd\thebibliography{% + \clubpenalty4000% + }{% + \interlinepenalty=5000\relax + \clubpenalty=10000\relax + }{}{\thu@patch@error{\thebibliography}} + \patchcmd\thebibliography{% + \widowpenalty4000% + }{% + \widowpenalty=10000\relax + }{}{\thu@patch@error{\thebibliography}} + \def\@biblabel#1{[#1]\hfill} + \renewcommand\NAT@bibsetnum[1]{% + % \settowidth\labelwidth{\@biblabel{#1}}% + % \setlength{\leftmargin}{\labelwidth}% + % \addtolength{\leftmargin}{\labelsep}% + \setlength{\labelwidth}{1cm}% + \setlength{\leftmargin}{\labelwidth}% + \setlength{\labelsep}{\z@}% + \setlength{\itemsep}{\bibsep}% + \setlength{\parsep}{\z@}% + \ifNAT@openbib + \addtolength{\leftmargin}{\bibindent}% + \setlength{\itemindent}{-\bibindent}% + \setlength{\listparindent}{\itemindent}% + \setlength{\parsep}{0pt}% + \fi + } +} +\AtEndOfPackageFile*{biblatex}{ + \AtBeginDocument{ + \ifthenelse{\equal{\blx@bbxfile}{apa}}{\def\bibname{REFERENCES}}{} + \ifthenelse{\equal{\blx@bbxfile}{apa6}}{\def\bibname{REFERENCES}}{} + \ifthenelse{\equal{\blx@bbxfile}{mla}}{\def\bibname{WORKS CITED}}{} + \ifthenelse{\equal{\blx@bbxfile}{mla-new}}{\def\bibname{WORKS CITED}}{} + } + \DeclareRobustCommand\inlinecite{\parencite} + \defbibheading{bibliography}[\bibname]{\thu@bib@heading{#1}} + \newcommand\thu@set@bibliography@format{% + \renewcommand\bibfont{\fontsize{10.5bp}{16bp}\selectfont}% + \setlength{\bibitemsep}{3bp \@plus 3bp \@minus 3bp}% + % 在 .bbx 中设置 \labelwidth 为 1 cm,\labelsep 为 0 pt。 + \setlength{\biblabelsep}{0pt}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \setlength{\bibhang}{21bp}% 2em + \else + \renewcommand\bibfont{\fontsize{10.5bp}{17bp}\selectfont}% + \setlength{\bibitemsep}{6bp \@plus 3bp \@minus 3bp}% + \setlength{\bibhang}{0.5in}% + \fi + \else + \setlength{\bibhang}{21bp}% 2em + \fi + } + \thu@set@bibliography@format + \thu@option@hook{degree}{\thu@set@bibliography@format} + \thu@option@hook{main-language}{\thu@set@bibliography@format} +} +\AtEndOfPackageFile*{apacite}{ + \AtBeginDocument{ + \thu@set@chapter@names + } + \renewcommand\bibliographytypesize{\fontsize{10.5bp}{16bp}\selectfont} + \setlength{\bibitemsep}{3bp \@plus 3bp \@minus 3bp}% + \ifthu@degree@bachelor + \ifthu@main@language@english + \renewcommand\bibliographytypesize{\fontsize{10.5bp}{17bp}\selectfont}% + \setlength{\bibitemsep}{6bp \@plus 3bp \@minus 3bp}% + \fi + \fi + \ifthu@main@language@chinese + \setlength{\bibleftmargin}{1cm} + \setlength{\bibindent}{-\bibleftmargin} + \else + \setlength{\bibleftmargin}{0.5in} + \setlength{\bibindent}{-\bibleftmargin} + \fi + \def\st@rtbibchapter{% + \if@numberedbib% + \chapter{\bibname}% e.g., 6. References + \else% + \thu@chapter*{\bibname}% e.g., References + \fi% + }% +} +\g@addto@macro\appendix{% + \@mainmattertrue +} +\thu@define@key{ + toc-depth = { + name = toc@depth, + }, +} +\thu@option@hook{toc-depth}{% + \ifx\@begindocumenthook\@undefined + \protected@write\@auxout{}{% + \string\ttl@writefile{toc}{% + \protect\setcounter{tocdepth}{\thu@toc@depth}% + }% + }% + \else + \setcounter{tocdepth}{\thu@toc@depth}% + \fi +} +\g@addto@macro\appendix{% + \thusetup{ + toc-depth = 0, + }% +} +\thu@define@key{ + appendix-figure-in-lof = { + name = appendix@figure@in@lof, + choices = { + true, + false, + }, + default = false, + }, +} +\thu@option@hook{appendix-figure-in-lof}{% + \ifthu@appendix@figure@in@lof@true + \addtocontents{lof}{\string\let\string\contentsline\string\ttl@contentsline}% + \addtocontents{lot}{\string\let\string\contentsline\string\ttl@contentsline}% + \addtocontents{loe}{\string\let\string\contentsline\string\ttl@contentsline}% + \else + \addtocontents{lof}{\string\let\string\contentsline\string\ttl@gobblecontents}% + \addtocontents{lot}{\string\let\string\contentsline\string\ttl@gobblecontents}% + \addtocontents{loe}{\string\let\string\contentsline\string\ttl@gobblecontents}% + \fi +} +\g@addto@macro\appendix{% + \thusetup{ + appendix-figure-in-lof = false, + }% +} +\newcommand\thu@appendix@bib@heading[1]{% + \begingroup + \ctexset{section/numbering = false}% + \ifthu@degree@bachelor + \ctexset{section = { + format = \centering\fontsize{12bp}{14.4bp}\selectfont, + beforeskip = 66bp, + afterskip = 4bp, + }}% + \fi + \section{#1}% + \endgroup +} +\g@addto@macro\appendix{% + \let\thu@bib@heading\thu@appendix@bib@heading +} +\newcommand\thu@end@appendix@ref@section{} +\AtBeginOfPackageFile*{bibunits}{ + \def\bibliography#1{% + \if@filesw + \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}% + \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}% + \fi + \@input@{\jobname.bbl}% + \gdef\bu@bibdata{#1}% + } + \def\bibliographystyle#1{% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \immediate\write\@auxout{\string\bibstyle{#1}}% + \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}% + \fi}% + \gdef\bu@bibstyle{#1}% + } +} +\AtEndOfPackageFile*{bibunits}{ + \def\@startbibunit{% + \global\let\@startbibunitorrelax\relax + \global\let\@finishbibunit\@finishstartedbibunit + \global\advance\@bibunitauxcnt 1 + \if@filesw + {\endlinechar-1 + \makeatletter + \@input{\@bibunitname.aux}}% + \immediate\openout\@bibunitaux\@bibunitname.aux + \immediate\write\@bibunitaux{\string\bibstyle{\@localbibstyle}}% + \fi + } + \def\bu@bibliography#1{% + \putbib[#1]% + } + \def\bu@bibliographystyle#1{% + \if@filesw + \immediate\write\@bibunitaux{\string\gdef\string\@localbibstyle{#1}}% + \fi + \gdef\@localbibstyle{#1}% + } + \providecommand\printbibliography{\putbib\relax}% + \g@addto@macro\appendix{% + \renewcommand\@bibunitname{\jobname-appendix-\@alph\c@chapter}% + \bibliographyunit[\chapter]% + \renewcommand\@extra@binfo{@-\@alph\c@chapter}% + \renewcommand\@extra@b@citeb{@-\@alph\c@chapter}% + \ifthu@degree@bachelor\else + \renewcommand\citenumfont{\@Alph\c@chapter.}% + \renewcommand\bibnumfmt[1]{[\@Alph\c@chapter.#1]\hfill}% + \fi + } + \renewcommand\thu@end@appendix@ref@section{% + \bibliographyunit\relax + } + \AtEndDocument{\thu@end@appendix@ref@section} + % \let\@xtestdef\@gobbletwo % This doesn't work + \def\bibunits@rerun@warning{\relax} +} +\PassOptionsToPackage{defernumbers=true}{biblatex} +\AtEndOfPackageFile*{biblatex}{ + \DeclareRefcontext{appendix}{labelprefix=\@Alph\c@chapter.} + \g@addto@macro\appendix{% + % 参考 biblatex 的 refsection=chapter 选项实现方式, + % 在 \@makechapterhead 和 \@makeschapterhead 进行 patch + \pretocmd\@makechapterhead{% + \newrefsection + \ifthu@degree@bachelor\else + \newrefcontext{appendix}% + \fi + }{}{\thu@patch@error{\@makechapterhead}}% + \pretocmd\@makeschapterhead{% + \newrefsection + \ifthu@degree@bachelor\else + \newrefcontext{appendix}% + \fi + }{}{\thu@patch@error{\@makeschapterhead}}% + } + \def\bibliographystyle#1{% + \thu@warning{'bibliographystyle' invalid for 'biblatex'.}% + } +} +\@ifpackagelater{titletoc}{2019/07/14}{ + \newcommand\thu@print@contents[5]{% + \printcontents[#1]{#2}{#3}[#4]{}% + } +}{ + \newcommand\thu@print@contents[5]{% + \printcontents[#1]{#2}{#3}{\setcounter{tocdepth}{#4}#5}% + } +} +\newenvironment{survey}{% + \thu@deprecate{"survey" environment}{}% + \chapter{外文资料的调研阅读报告}% + \thusetup{language = english}% + \let\title\@gobble + \let\maketitle\relax + \let\tableofcontents\relax + \let\appendix\relax + \renewcommand\bibname{参考文献}% +}{% + \thu@reset@main@language % restore language +} +\newenvironment{translation}{% + \thu@deprecate{"translation" environment}{}% + \chapter{外文资料的书面翻译}% + \thusetup{language = chinese}% + \let\title\@gobble + \let\maketitle\relax + \renewenvironment{abstract}{% + \ctexset{ + section = { + format += \centering, + numbering = false, + }, + }% + \section{摘要}% + }{% + \par + \ifx\thu@keywords\@empty\else + \textbf{关键词:}\thu@clist@use{\thu@keywords}{;}\par + \fi + }% + \let\tableofcontents\relax + \let\appendix\relax +}{% + \thu@reset@main@language % restore language +} +\NewEnviron{translation-index}{% + \thu@deprecate{"translation-index" environment}{}% +}{} +\newenvironment{resume}{% + \@mainmatterfalse + \thu@end@appendix@ref@section + \thu@chapter*{\thu@resume@name}% + \ctexset{section/numbering = false}% + \ifthu@degree@bachelor + \ctexset{section/aftertitle = {:\@@par}}% + \else + \ctexset{section/format += \centering}% + \fi + \ifthu@language@chinese + \ctexset{ + subsection = { + format = \sffamily\fontsize{14bp}{20bp}\selectfont, + numbering = false, + aftertitle = {:\@@par}, + }, + }% + \setlist[achievements]{ + topsep = 6bp, + itemsep = 6bp, + leftmargin = 1cm, + labelwidth = 1cm, + labelsep = 0pt, + first = { + \ifthu@degree@graduate + \fontsize{12bp}{16bp}\selectfont + \fi + }, + align = left, + label = [\arabic*], + resume = achievements, + }% + \else + \ctexset{ + subsection = { + beforeskip = 0pt, + afterskip = 0pt, + format = \bfseries\normalsize, + indent = \parindent, + numbering = false, + }, + }% + \ifthu@degree@bachelor + % 内容部分用Arial字体,字号15pt,行距采用固定值20pt, 段前后 0pt。 + \sffamily\fontsize{15bp}{20bp}\selectfont + \fi + \setlist[achievements]{ + topsep = 0bp, + itemsep = 0bp, + leftmargin = 1.75cm, + labelsep = 0.5cm, + align = right, + label = [\arabic*], + resume = achievements, + }% + \fi +}{} +\newcommand\resumeitem[1]{% + \thu@error{The "\protect\resumeitem" is obsolete. Please update to the new format}% +} +\newcommand\researchitem[1]{% + \thu@error{The "\protect\researchitem" is obsolete. Please update to the new format}% +} +\newlist{achievements}{enumerate}{1} +\setlist[achievements]{ + topsep = 6bp, + partopsep = 0bp, + itemsep = 6bp, + parsep = 0bp, + leftmargin = 10mm, + itemindent = 0pt, + align = left, + label = [\arabic*], + resume = achievements, +} +\newenvironment{publications}{% + \thu@deprecate{"publications" environment}{"achievements"}% + \begin{achievements}% +}{% + \end{achievements}% +} +\newcommand\publicationskip{% + \thu@error{The "\protect\publicationskip" is obsolete. Do not use it}% +} +\NewEnviron{comments}[1][]{% + \thu@end@appendix@ref@section + \ifthu@degree@graduate + \@mainmatterfalse + \kv@define@key{thu@comments}{name}{\let\thu@comments@name\kv@value}% + \kv@set@family@handler{thu@comments}{% + \ifx\kv@value\relax + \let\thu@comments@name\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@comments}{#1}% + \chapter{\thu@comments@name}% + \BODY\clearpage + \fi +} +\NewEnviron{resolution}{% + \thu@end@appendix@ref@section + \ifthu@degree@graduate + \@mainmatterfalse + \chapter{\thu@resolution@name}% + \BODY\clearpage + \fi +} +\newcommand{\record}[1]{% + \ifthu@degree@bachelor + \let\thu@record@file\@empty + \kv@define@key{thu@record}{file}{\let\thu@record@file\kv@value}% + \kv@set@family@handler{thu@record}{% + \ifx\kv@value\relax + \let\thu@record@file\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@record}{#1}% + \ifx\thu@record@file\@empty + \thu@error{File path of \protect\record\space is required} + \fi + \clearpage + \thu@pdfbookmark{0}{综合论文训练记录表}% + \includepdf[pages=-]{\thu@record@file}% + \fi + \thu@replace@with@error{record} +} +\PassOptionsToPackage{ + linktoc = all, + bookmarksdepth = 2, + bookmarksnumbered = true, + bookmarksopen = true, + bookmarksopenlevel = 1, + bookmarksdepth = 3, + unicode = true, + psdextra = true, + breaklinks = true, + plainpages = false, + pdfdisplaydoctitle = true, + hidelinks, +}{hyperref} +\AtEndOfPackageFile*{hyperref}{ + \newcounter{thu@bookmark} + \renewcommand\thu@pdfbookmark[2]{% + \phantomsection + \stepcounter{thu@bookmark}% + \pdfbookmark[#1]{#2}{thuchapter.\thethu@bookmark}% + } + \renewcommand\thu@phantomsection{% + \phantomsection + } + \pdfstringdefDisableCommands{% + \let\\\relax + \let\quad\relax + \let\qquad\relax + \let\hspace\@gobble + }% + \@ifpackagelater{hyperref}{2019/04/27}{}{% + \g@addto@macro\psdmapshortnames{\let\mu\textmu} + }% + \ifthu@main@language@chinese + \hypersetup{ + pdflang = zh-CN, + }% + \else + \hypersetup{ + pdflang = en-US, + }% + \fi + \AtBeginDocument{% + \ifthu@main@language@chinese + \hypersetup{ + pdftitle = \thu@title, + pdfauthor = \thu@author, + pdfsubject = \thu@discipline, + pdfkeywords = \thu@keywords, + }% + \else + \hypersetup{ + pdftitle = \thu@title@en, + pdfauthor = \thu@author@en, + pdfsubject = \thu@discipline@en, + pdfkeywords = \thu@keywords@en, + }% + \fi + \hypersetup{ + pdfcreator={\thuthesis-v\version}} + }% +} +\AtEndOfPackageFile*{mathtools}{ + \@ifpackageloaded{unicode-math}{ + \let\underbrace\LaTeXunderbrace + \let\overbrace\LaTeXoverbrace + }{} + \expandafter\def\csname MT_extended_eqref:n\endcsname#1{% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \unskip + \fi + \fi + \protected@write\@auxout{} + {\string\MT@newlabel{#1}}% + \textup{\let\df@label\@empty\csname MT_prev_tagform:n\endcsname{\ref{#1}}}% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \ignorespaces + \fi + \fi + } + \expandafter\MakeRobust\csname MT_extended_eqref:n\endcsname +} +\PassOptionsToPackage{notocbasic}{nomencl} +\AtEndOfPackageFile*{nomencl}{ + \let\nomname\thu@denotation@name + \def\thenomenclature{\begin{denotation}[\nom@tempdim]} + \def\endthenomenclature{\end{denotation}} +} +\AtEndOfPackageFile*{siunitx}{% + \newcommand\thu@set@siunitx@language{% + \ifthu@language@chinese + \sisetup{ + list-final-separator = {\TextOrMath{\space}{\ }\text{和}\TextOrMath{\space}{\ }}, + list-pair-separator = {\TextOrMath{\space}{\ }\text{和}\TextOrMath{\space}{\ }}, + range-phrase = {\text{~}}, + }% + \else + \ifthu@language@english + \sisetup{ + list-final-separator = {\TextOrMath{\space}{\ }\text{and}\TextOrMath{\space}{\ }}, + list-pair-separator = {\TextOrMath{\space}{\ }\text{and}\TextOrMath{\space}{\ }}, + range-phrase = {\TextOrMath{\space}{\ }\text{to}\TextOrMath{\space}{\ }}, + }% + \fi + \fi + } + \thu@set@siunitx@language + \thu@option@hook{language}{\thu@set@siunitx@language} +} +\AtEndOfPackageFile*{amsthm}{% + \newtheoremstyle{thu} + {\z@}{\z@} + {\normalfont}{\z@} + {\normalfont\sffamily}{\thu@theorem@separator} + {0.5em}{} + \theoremstyle{thu} + \newtheorem{assumption}{\thu@assumption@name}[chapter]% + \newtheorem{definition}{\thu@definition@name}[chapter]% + \newtheorem{proposition}{\thu@proposition@name}[chapter]% + \newtheorem{lemma}{\thu@lemma@name}[chapter]% + \newtheorem{theorem}{\thu@theorem@name}[chapter]% + \newtheorem{axiom}{\thu@axiom@name}[chapter]% + \newtheorem{corollary}{\thu@corollary@name}[chapter]% + \newtheorem{exercise}{\thu@exercise@name}[chapter]% + \newtheorem{example}{\thu@example@name}[chapter]% + \newtheorem{remark}{\thu@remark@name}[chapter]% + \newtheorem{problem}{\thu@problem@name}[chapter]% + \newtheorem{conjecture}{\thu@conjecture@name}[chapter]% + \renewenvironment{proof}[1][\thu@proof@name]{\par + \pushQED{\qed}% + % \normalfont \topsep6\p@\@plus6\p@\relax + \normalfont \topsep\z@\relax + \trivlist + \item[\hskip\labelsep + % \itshape + % #1\@addpunct{.}]\ignorespaces + \sffamily + #1]\ignorespaces + }{% + \popQED\endtrivlist\@endpefalse + } + \renewcommand\qedsymbol{\thu@qed} +} +\AtEndOfPackageFile*{ntheorem}{% + \theorembodyfont{\normalfont}% + \theoremheaderfont{\normalfont\sffamily}% + \theoremsymbol{\thu@qed}% + \newtheorem*{proof}{\thu@proof@name}% + \theoremstyle{plain}% + \theoremsymbol{}% + \theoremseparator{\thu@theorem@separator}% + \newtheorem{assumption}{\thu@assumption@name}[chapter]% + \newtheorem{definition}{\thu@definition@name}[chapter]% + \newtheorem{proposition}{\thu@proposition@name}[chapter]% + \newtheorem{lemma}{\thu@lemma@name}[chapter]% + \newtheorem{theorem}{\thu@theorem@name}[chapter]% + \newtheorem{axiom}{\thu@axiom@name}[chapter]% + \newtheorem{corollary}{\thu@corollary@name}[chapter]% + \newtheorem{exercise}{\thu@exercise@name}[chapter]% + \newtheorem{example}{\thu@example@name}[chapter]% + \newtheorem{remark}{\thu@remark@name}[chapter]% + \newtheorem{problem}{\thu@problem@name}[chapter]% + \newtheorem{conjecture}{\thu@conjecture@name}[chapter]% +} +\PassOptionsToPackage{chapter}{algorithm} +\AtEndOfPackageFile*{algorithm}{ + \floatname{algorithm}{\thu@algorithm@name} + \renewcommand\listofalgorithms{% + \thu@listof{algorithm}% + } + \renewcommand\listalgorithmname{\thu@list@algorithm@name} + \def\ext@algorithm{loa} + \contentsuse{algorithm}{loa} + \titlecontents{algorithm} + [\z@]{} + {\contentspush{\fname@algorithm~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +} +\PassOptionsToPackage{algochapter}{algorithm2e} +\AtEndOfPackageFile*{algorithm2e}{ + \renewcommand\algorithmcfname{\thu@algorithm@name} + \SetAlgoCaptionLayout{thu@caption@font} + \SetAlCapSty{relax} + \SetAlgoCaptionSeparator{\hspace*{1em}} + \SetAlFnt{\fontsize{11bp}{14.3bp}\selectfont} + \renewcommand\listofalgorithms{% + \thu@listof{algorithmcf}% + } + \renewcommand\listalgorithmcfname{\thu@list@algorithm@name} + \def\ext@algorithmcf{loa} + \contentsuse{algocf}{loa} + \titlecontents{algocf} + [\z@]{} + {\contentspush{\algorithmcfname~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +} +\AtEndOfPackageFile*{minted}{ + \newcommand\thu@set@listing@language{% + \ifthu@language@chinese + \floatname{listing}{代码}% + \else + \floatname{listing}{Listing}% + \fi + } + \thu@set@listing@language + \thu@option@hook{language}{\thu@set@listing@language} +} +\thu@define@key{ + spine-font = { + name = spine@font, + }, + spine-title = { + name = spine@title, + }, + spine-author = { + name = spine@author, + }, +} +\renewcommand\thu@spine@font{% + \ifthu@degree@doctor + \fontsize{16bp}{20.8bp}\selectfont + \else + \fontsize{15bp}{19.5bp}\selectfont + \fi +} +\newcommand*\CJKmovesymbol[1]{\raise.3em\hbox{#1}} +\newcommand*\CJKmove{% + \punctstyle{plain}% + \let\CJKsymbol\CJKmovesymbol + \let\CJKpunctsymbol\CJKsymbol +} +\NewDocumentCommand{\spine}{ + O{ + \ifx\thu@spine@title\@empty + \thu@title + \else + \thu@spine@title + \fi + } + O{ + \ifx\thu@spine@author\@empty + \thu@author + \else + \thu@spine@author + \fi + }}{% + \clearpage + \ifthu@degree@bachelor + \newgeometry{ + vmargin = 3cm, + hmargin = 1cm, + }% + \else + \newgeometry{ + vmargin = 5.5cm, + hmargin = 1cm, + }% + \fi + \thispagestyle{empty}% + \ifthu@main@language@chinese + \thu@pdfbookmark{0}{书脊}% + \else + \thu@pdfbookmark{0}{Spine}% + \fi + \begingroup + \noindent\hfill + \rotatebox[origin=lt]{-90}{% + \makebox[\textheight]{% + \fangsong + \addCJKfontfeatures*{RawFeature={vertical}}% + \thu@spine@font + \CJKmove + #1\hfill + \thu@stretch{4.5em}{#2}% + }% + }% + \endgroup + \clearpage + \restoregeometry +} +\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} +\DeclareRobustCommand\file{\nolinkurl} +\DeclareRobustCommand\env{\textsf} +\DeclareRobustCommand\pkg{\textsf} +\DeclareRobustCommand\cls{\textsf} +\sloppy +\endinput +%% +%% End of file `thuthesis.cls'. diff --git a/thuthesis.dtx b/thuthesis.dtx new file mode 100644 index 0000000..2ccf7df --- /dev/null +++ b/thuthesis.dtx @@ -0,0 +1,7052 @@ +% \iffalse meta-comment +% +% Copyright (C) 2005-2026 by Tsinghua University TUNA Association +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008 or later. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{thuthesis.dtx}[2026/05/10 7.7.0 Tsinghua University Thesis Template] +\documentclass{ltxdoc} +\usepackage{dtx-style} + +\EnableCrossrefs +\CodelineIndex + +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +% +% \fi +% +% \DoNotIndex{\newenvironment,\@bsphack,\@empty,\@esphack,\sfcode} +% \DoNotIndex{\addtocounter,\label,\let,\linewidth,\newcounter} +% \DoNotIndex{\noindent,\normalfont,\par,\parskip,\phantomsection} +% \DoNotIndex{\providecommand,\ProvidesPackage,\refstepcounter} +% \DoNotIndex{\RequirePackage,\setcounter,\setlength,\string,\strut} +% \DoNotIndex{\textbackslash,\texttt,\ttfamily,\usepackage} +% \DoNotIndex{\begin,\end,\begingroup,\endgroup,\par,\\} +% \DoNotIndex{\if,\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi} +% \DoNotIndex{\let,\def,\xdef,\edef,\newcommand,\renewcommand} +% \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect} +% \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize} +% \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny} +% \DoNotIndex{\normalfont,\bfseries,\slshape,\sffamily,\interlinepenalty} +% \DoNotIndex{\textbf,\textit,\textsf,\textsc} +% \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad} +% \DoNotIndex{\centering,\raggedright,\ref} +% \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize} +% \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne} +% \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument} +% +% \GetFileInfo{\jobname.dtx} +% +% \def\indexname{索引} +% \IndexPrologue{\section{\indexname}} +% +% \title{\bfseries\color{violet}\thuthesis:清华大学学位论文模板} +% \author{{\fangsong 清华大学 TUNA 协会}\\[5pt]\texttt{tuna@tsinghua.edu.cn}} +% \date{v\fileversion\ (\filedate)} +% \maketitle\thispagestyle{empty} +% +% +% \begin{abstract}\noindent +% 此宏包旨在建立一个简单易用的清华大学学位论文模板,包括本科综合论文训练、硕士 +% 论文、博士论文以及博士后出站报告。 +% \end{abstract} +% +% \vskip2cm +% \def\abstractname{免责声明} +% \begin{abstract} +% \noindent +% \begin{enumerate} +% \item 本模板的发布遵守 \href{https://www.latex-project.org/lppl/lppl-1-3c.txt}{\LaTeX{} Project Public License (1.3.c)},使用前请认真阅读协议内 +% 容。 +% \item 本模板为作者根据 +% 清华大学研究生院颁发的《 +% \href{https://info2021.tsinghua.edu.cn/f/info/xxfb_fg/xnzx/template/detail?xxid=fa880bdf60102a29fbe3c31f36b76c7e}{% +% 研究生学位论文写作指南}》(更新到 2025 年 3 月版本,限校内网络访问)、 +% 英文版 \emph{Guide to Thesis Writing for Graduate Students}、 +% 清华大学教务处颁发的《 +% \href{https://info2021.tsinghua.edu.cn/f/info/xxfb_fg/xnzx/template/detail?xxid=b2d1a49d7e48c8e9b0f7e82f033dbb2b}{% +% 清华大学综合论文训练写作规范(试行)}》、 +% 外文系的《英语专业本科生综合论文训练》和 +% 清华大学《 +% \href{http://postdoctor.tsinghua.edu.cn/info/czxz/1283}{% +% 编写“清华大学博士后研究报告”参考意见}》 +% 编写而成,旨在供清华大学毕业生撰写学位论文使用。 +% \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵 +% 守 \LaTeX{} Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与 +% 本模板作者无关。 +% \end{enumerate} +% \end{abstract} +% +% +% \clearpage +% \pagestyle{fancy} +% \begin{multicols}{2}[ +% \setlength{\columnseprule}{.4pt} +% \setlength{\columnsep}{18pt}] +% \tableofcontents +% \end{multicols} +% \clearpage +% +% \section{模板介绍} +% \thuthesis{}(\textbf{T}sing\textbf{h}ua \textbf{U}niversity \LaTeX{} +% \textbf{Thesis} Template)是为了帮助清华大学毕业生撰写毕业论文而编写 +% 的 \LaTeX{} 论文模板。 +% +% 本文档将尽量完整地介绍模板的使用方法,如有不清楚之处,或者想提出改进建议, +% 可以在 \href{https://github.com/tuna/thuthesis/issues/}{GitHub Issues} +% 参与讨论或提问。 +% 有兴趣者都可以参与完善此手册,也非常欢迎对代码的贡献。 +% +% \note[注意:]{模板的作用在于减少论文写作过程中格式调整的时间。前提是遵守模板的 +% 用法,否则即便用了 \thuthesis{} 也难以保证输出的论文符合学校规范。} +% +% 用户如果遇到 bug,或者发现与学校《写作指南》 的要求不一致,可以尝试以下办法: +% \begin{enumerate} +% \item 将模板升级到最新,见第~\ref{sec:upgrade} 节; +% \item 阅读 \href{https://github.com/tuna/thuthesis/wiki/FAQ}{FAQ}; +% \item 在 GitHub Issues 中按照说明 +% \href{https://github.com/tuna/thuthesis/issues/new?template=bug_report.md}{报告 bug}。 +% \end{enumerate} +% +% \section{贡献者} +% \label{sec:contributors} +% +% \thuthesis{} 的开发过程中,主要的维护者包括: +% +% \begin{itemize} +% \item 薛瑞尼(\githubuser{xueruini}):最早的开发者,2005 年创建 \thuthesis{} 并长期进行维护工作。 +% \item 赵涛(\githubuser{alick}):2011-2015 年活跃,较早期阶段的开发者。 +% \item 李泽平(\githubuser{zepinglee}):2016 年至今活跃,为目前主要维护者。 +% \item 陈晟祺(\githubuser{Harry-Chen}):2020 年至今活跃,主要负责非开发性事宜。 +% \end{itemize} +% +% 同时,也要感谢所有在 GitHub 上提出问题与贡献代码的同学、老师们。 +% \thuthesis{} 的持续发展,离不开你们的帮助与支持。 +% +% \section{安装} +% \label{sec:installation} +% +% \thuthesis{} 已经包含在主要的 \TeX{} 发行版中,但是通常版本较旧,而且不方便更新。 +% 建议从下列途径下载最新版: +% \begin{description} +% \item[GitHub] \url{https://github.com/tuna/thuthesis},从 Release 中下载 zip 文件。 +% \item[TUNA 镜像站] \url{https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/},也可在首页选择“获取下载链接——应用软件——\thuthesis{}论文模板”。 +% \end{description} +% +% +% 模板支持在 TeX Live、MacTeX 和 MiKTeX 平台下进行编译,但要求 2017 年或更新的发行版。 +% 当然,尽可能使用最新的版本可以避免 bug。 +% +% \subsection{模板的组成} +% 下表列出了 \thuthesis{} 的主要文件及其功能介绍: +% +% \begin{longtable}{l|p{8cm}} +% \toprule +% {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule +% \endfirsthead +% \midrule +% {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule +% \endhead +% \endfoot +% \endlastfoot +% thuthesis.ins & \textsc{DocStrip} 驱动文件(开发用) \\ +% thuthesis.dtx & \textsc{DocStrip} 源文件(开发用)\\\midrule +% thuthesis.cls & 模板类文件\\ +% thuthesis-*.bst & \hologo{BibTeX} 参考文献表样式文件\\ +% thuthesis-*.bbx & BibLaTeX 参考文献表样式文件\\ +% thuthesis-*.cbx & BibLaTeX 参考文献引用样式文件\\ +% tsinghua-name-bachelor.pdf & 校名 logo,本科生封面使用 \\\midrule +% thuthesis-example.tex & 示例文档主文件\\ +% ref/ & 示例文档参考文献目录\\ +% data/ & 示例文档章节具体内容\\ +% figures/ & 示例文档图片路径\\ +% thusetup.tex & 示例文档基本配置\\\midrule +% Makefile & Makefile\\ +% latexmkrc & latexmk 配置文件 \\ +% README.md & Readme\\ +% \textbf{thuthesis.pdf} & 用户手册(本文档)\\\bottomrule +% \end{longtable} +% +% 几点说明: +% \begin{itemize} +% \item \file{thuthesis.cls} 可由 \file{thuthesis.ins} +% 和 \file{thuthesis.dtx} 生成,但为了降低新手用户的使用难度,故 +% 将 \file{thuthesis.cls} 文件一起发布。 +% \item 使用前阅读文档:\file{thuthesis.pdf}。 +% \end{itemize} +% +% \subsection{生成模板} +% \label{sec:generate-cls} +% 模板的源文件(\file{thuthesis.dtx})中包含了大量的注释,需要将注释去掉生成轻量 +% 级的 \file{.cls} 文件供 \cs{documentclass} 调用。 +% +% \begin{shell} +% $ xetex thuthesis.ins +% \end{shell} +% +% \note[注意:]{如果没有生成的模板 \file{thuthesis.cls} 文件 +% (跟 \file{thuthesis-example.tex} 同一目录下), +% \LaTeX{} 在编译时可能找到发行版中较旧版本的 \file{.cls},从而造成冲突。} +% +% \subsection{编译论文} +% \label{sec:generate-thesis} +% 本节介绍几种常见的生成论文的方法。用户可根据自己的情况选择。 +% +% 在撰写论文时,我们\textbf{不推荐}使用原有的 \file{thuthesis-example.tex} 这一名称。 +% 建议将其复制一份,改为其他的名字(如 \file{thesis.tex} 或者 \file{main.tex})。 +% 需要注意,如果使用了来自 \file{data} 目录中的 \file{tex} 文件, +% 则重命名主文件后,其顶端的 \texttt{!TEX root} 选项也需要相应修改。 +% +% \subsubsection{GNU make} +% \label{sec:make} +% 如果用户可以使用 GNU make 工具,这是最方便的办法。 +% 所以 \thuthesis{} 提供了 \file{Makefile}: +% \begin{shell} +% $ make thesis # 生成论文示例 thuthesis-example.pdf +% $ make doc # 生成说明文档 thuthesis.pdf +% $ make clean # 清理编译生成的辅助文件 +% \end{shell} +% +% 需要注意,如果更改了主文件的名称,则需要修改 \file{Makefile} 顶端的 \texttt{THESIS} 变量定义。 +% +% \subsubsection{latexmk} +% \label{sec:latexmk} +% \texttt{latexmk} 命令支持全自动生成 \LaTeX{} 编写的文档,并且支持使用不同的工具 +% 链来进行生成,它会自动运行多次工具直到交叉引用都被解决。 +% \begin{shell} +% $ latexmk thuthesis-example.tex # 生成示例论文 thuthesis-example.pdf +% $ latexmk thuthesis.dtx # 生成说明文档 thuthesis.pdf +% $ latexmk -c # 清理编译生成的辅助文件 +% \end{shell} +% \texttt{latexmk} 的编译过程是通过 \file{latexmkrc} 文件来配置的,如果要进一步了解, +% 可以参考 \pkg{latexmk} 文档。 +% +% \subsubsection{\XeLaTeX} +% \label{sec:xelatex} +% 如果用户无法使用以上两种较为方便的编译方法,就只能按照以下复杂的办法手动编译。 +% +% 首先,更新模板: +% \begin{shell} +% $ xetex thuthesis.ins # 生成 thuthesis.cls +% \end{shell} +% +% 然后,生成论文以及书脊: +% \begin{shell} +% $ xelatex thuthesis-example.tex +% $ bibtex thuthesis-example.aux # 生成 bbl 文件 +% $ bibtex thuthesis-example-appendix-a.aux # 附录 A 的的参考文献 +% $ bibtex thuthesis-example-appendix-b.aux # 附录 B 的的参考文献…… +% $ xelatex thuthesis-example.tex # 解决引用 +% $ xelatex thuthesis-example.tex # 生成论文 PDF +% +% $ xelatex spine.tex # 生成书脊 PDF +% \end{shell} +% +% 下面的命令用来生成用户手册: +% \begin{shell} +% $ xelatex -shell-escape thuthesis.dtx +% $ makeindex -s gind.ist -o thuthesis.ind thuthesis.idx +% $ xelatex -shell-escape thuthesis.dtx +% $ xelatex -shell-escape thuthesis.dtx # 生成说明文档 thuthesis.pdf +% \end{shell} +% +% \subsection{升级} +% \label{sec:upgrade} +% 如果需要升级 \thuthesis{},应当从 GitHub 下载最新的版本, +% 将 \file{thuthesis.dtx},\file{thuthesis.ins},\file{tsinghua-name-bachelor.pdf} 和 +% \file{thuthesis-*.bst} 拷贝至工作目录覆盖相应的文件,然后按照 +% 第~\ref{sec:generate-cls} 节的内容生成新的模板和使用说明。 +% +% 有时模板可能进行了重要的修改,不兼容已写好的正文内容,用户应按照示例 +% 文档重新调整。 +% +% \section{使用说明} +% \label{sec:usage} +% 本手册假定用户已经能处理一般的 \LaTeX{} 文档,并对 \hologo{BibTeX} 有一定了解。如果 +% 从未接触过 \TeX{} 和 \LaTeX,建议先学习相关的基础知识。 +% +% \subsection{示例文件} +% \label{sec:userguide} +% +% 模板核心文件有:\file{thuthesis.cls},\file{tsinghua-name-bachelor.pdf}, +% \file{thuthesis-*.bst}(\hologo{BibTeX}), +% \file{thuthesis-*.bbx} 和 \file{thuthesis-*.cbx}(BibLaTeX), +% 但如果没有示例文档会较难下手,所以推荐从模板自带的示例文档入手。其中包括了论文 +% 写作用到的所有命令及其使用方法,只需用自己的内容进行相应替换就可以。对于不清 +% 楚的命令可以查阅本手册。下面的例子描述了模板中章节的组织形式,来自于示例文档, +% 具体内容可以参考模板附带的 \file{thuthesis-example.tex} 和 \file{data/}。 +% +% \subsection{论文选项} +% \label{sec:option} +% +% \subsubsection{学位} +% \DescribeOption{degree} +% 选择学位,可选: +% \option{bachelor},\option{master},\option{doctor}(默认),\option{postdoc}。 +% 本节中的 \emph{key-value} 选项只能在文档类的选项中进行设置, +% 不能用于 \cs{thusetup} 命令。 +% \begin{latex} +% % 博士论文 +% \documentclass[degree=doctor]{thuthesis} +% \end{latex} +% +% \subsubsection{学位类型} +% \label{sec:degree-type} +% \DescribeOption{degree-type} +% 定义研究生学位的类型,可选:\option{academic}(默认)、\option{professional}, +% 本科生不受影响。 +% \begin{latex} +% \documentclass[degree=master, degree-type=professional]{thuthesis} +% \end{latex} +% +% \subsubsection{学院特殊格式} +% \label{sec:style-override} +% \DescribeOption{style-override} +% 选择苏世民学院的特殊格式,可选:\option{none}(默认)、\option{schwarzman}。 +% \begin{latex} +% \documentclass[degree=master, style-override=schwarzman]{thuthesis} +% \end{latex} +% +% \subsubsection{字体配置} +% \label{sec:font-config} +% \DescribeOption{fontset} +% 模板默认会自动根据操作系统配置合适的字体, +% 用户也可以通过 \option{fontset} 时指定使用预设的字库,如: +% \begin{latex} +% \documentclass[fontset=windows]{thuthesis} +% \end{latex} +% 允许的选项有 \option{windows}、\option{mac}、\option{ubuntu} 和 \option{fandol}, +% 具体使用的字体见表~\ref{tab:fontset}。 +% 用户也可以设置为 \option{none} 并自行配置字体。 +% +% \begin{table}[htb] +% \centering +% \caption{\thuthesis{} 预设的字体} +% \label{tab:fontset} +% \begin{tabular}{cccc} +% \toprule +% \option{windows} & \option{mac} & \option{ubuntu} & \option{fandol} \\ +% \midrule +% Times New Roman & Times New Roman & TeX Gyre Termes & TeX Gyre Termes \\ +% Arial & Arial & TeX Gyre Heros & TeX Gyre Heros \\ +% Courier & Menlo & TeX Gyre Cursor & TeX Gyre Cursor \\ +% 中易宋体 & 华文宋体 & 思源宋体 & Fandol 宋体 \\ +% 中易黑体 & 华文黑体 & 思源黑体 & Fandol 黑体 \\ +% 中易仿宋 & 华文仿宋 & Fandol 仿宋 & Fandol 仿宋 \\ +% 中易楷体 & 华文楷体 & Fandol 楷体 & Fandol 楷体 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% 需要注意,建议用户在提交终版前使用 Windows 平台的字体进行编译。 +% 这样中文字体同 Word 模板一致。 +% +% 关于字体的配置, +% 详见 \pkg{fontspec}、\pkg{xeCJK}、\pkg{ctex} 等宏包的使用说明和代码。 +% +% \DescribeOption{font} +% 配置全文使用的西文字体。所有可选项目为 \option{auto}(默认)、\option{times}、\option{termes}、 +% \option{stix}、\option{xits}、\option{libertinus}、\option{newcm}、\option{lm}、 +% \option{newtx}、\option{none}。 +% 通常来说,用户\textbf{不需要}调整此选项。 +% +% \DescribeOption{cjk-font} +% 配置全文使用的中文字体。所有可选项为 \option{auto}(默认)、\option{windows}、\option{windows-local}、 +% \option{mac}、\option{mac-word}、\option{noto}、\option{fandol} 和 \option{none}。 +% 通常来说,用户\textbf{不需要}调整此选项,模板会自动通过 \option{fontset} 选项选择合适的字体。 +% +% \DescribeOption{windows-font-dir} +% 配置搜索 Windows 字体的路径,仅适用于 Overleaf 等不方便全局安装字体的环境。如果此目录下能找到中易宋体, +% 则将自动使用这些字体编译。如有可能,始终建议全局安装相应字体,模板能够自动检测。 +% +% \subsection{论文设置} +% 论文的设置可以通过统一命令 \cs{thusetup} 设置 \emph{key=value} 形式完成。 +% +% \DescribeMacro{\thusetup} +% \cs{thusetup} 用法与常见 \emph{key=value} 命令相同,如下: +% \begin{latex} +% \thusetup{ +% key1 = value1, +% key2 = {a value, with comma}, +% } +% % 可以多次调用 +% \thusetup{ +% key3 = value3, +% key1 = value11, % 覆盖 value1 +% } +% \end{latex} +% +% \note[注意:]{\cs{thusetup} 使用 \pkg{kvsetkeys} 机制,所以配置项之间不能有空行,否则 +% 会报错。} +% +% \subsubsection{输出格式} +% \DescribeOption{output} +% 选择输出的格式是打印版还是电子版(用于提交),可选:\option{print}(默认)、\option{electronic}。 +% 打印版 \option{print} 自动在单面打印的部分插入空白页(比如封面),并且保证正文第 1 页在右侧。 +% 电子版 \option{electronic} 选项会去掉空白页,这是因为一些院系要求提交的电子版不含空白页。 +% +% \begin{latex} +% \thusetup{ +% output = electronic, +% } +% \end{latex} +% +% 另外本科生要求有 0.2cm 留给装订线的宽度,这只有在打印版中才会生效。 +% +% +% \subsubsection{书写语言} +% \DescribeOption{language} +% 在导言区设置 \option{language} 会修改论文的主要语言,如章节标题等。 +% 在正文中设置 \option{language} 只修改接下来部分的书写语言, +% 如标点格式、图表名称,但不影响章节标题等。 +% +% \begin{latex} +% \thusetup{ +% language = english, +% } +% \end{latex} +% +% 论文的一些部分(如英文摘要、本科生的外文调研报告)要求使用特定的语言, +% 模板已经进行配置,并在这些部分结束后自动恢复为主要语言。 +% +% 注意,本科生《写作规范》要求“本科生(含国外来华留学本科生)非外语专业论文统一要求 +% 用中文书写。”研究生《写作指南》要求“外国人来华留学生可以用英文撰写学位论文,但 +% 须采用中文封面”,“除留学生外,学位论文一律须用汉语书写”,用户须提前与导师和院系 +% 的审查教师协商使用何种语言书写论文。 +% +% \subsubsection{开题报告} +% \DescribeOption{thesis-type} +% 模板还支持本科生、研究生论文开题报告的格式,可以通过设置 \option{thesis-type=proposal} 得到。 +% +% 开题报告与学位论文有两点不同: +% \begin{enumerate} +% \item 封面的信息和格式有区别,尤其是增加了一行“学号”信息,需要通过 \option{student-id} 填写; +% \item 开题报告不含英文标题页。 +% \end{enumerate} +% \begin{latex} +% \thusetup{ +% thesis-type = proposal, +% student-id = {2000310000}, +% } +% \end{latex} +% +% \subsection{封面信息} +% \label{sec:titlepage} +% 封面信息可以通过统一设置命令 \cs{thusetup} 设置 \emph{key=value} 形式完成; +% 带 * 号的键通常是对应的英文。 +% +% \subsubsection{论文标题} +% 中英文标题。可以在标题内部使用换行|\\|。 +% \begin{latex} +% \thusetup{ +% title = {论文中文题目}, +% title* = {Thesis English Title}, +% } +% \end{latex} +% +% \subsubsection{申请学位名称} +% \label{sec:degree-category} +% 学位名称的设置比较复杂,见表~\ref{tab:degree-category}。 +% +% \begin{table}[h] +% \caption{学位名称的要求} +% \label{tab:degree-category} +% \begin{tabular}{p{2cm}p{6cm}p{6cm}} +% \toprule +% 学位类型 & degree-category & degree-category* \\ +% \midrule +% 学术型博士 & 需注明所属的学科门类,例如: +% 哲学、经济学、法学、教育学、文学、历史学、理学、工学、农学、医学、 +% 军事学、管理学、艺术学 +% & Doctor of Philosophy \\ +% \midrule +% 学术型硕士 & 同上 +% & 哲学、文学、历史学、法学、教育学、艺术学门类 +% 填写“Master of Arts“,其它填写“Master of Science” \\ +% \midrule +% 专业型研究生学位 & 专业学位的名称,例如:教育博士、工程硕士 +% & 专业学位的名称,例如:Doctor of Education, Master of Engineering \\ +% \midrule +% 本科生 & - & - \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \begin{latex} +% \thusetup{ +% degree-category = {工学硕士}, +% degree-category* = {Master of Science}, +% } +% \end{latex} +% +% \subsubsection{院系名称} +% 院系名称。 +% \begin{latex} +% \thusetup{ +% department = {计算机科学与技术系}, +% } +% \end{latex} +% +% \subsubsection{学科名称} +% +% \begin{itemize} +% \item 研究生学术型学位:获得一级学科授权的学科填写一级学科名称,其他填写二级学科名称; +% \item 本科生:专业名称,第二学位论文需标注“(第二学位)”。 +% \end{itemize} +% +% \begin{latex} +% \thusetup{ +% discipline = {学科名称}, +% discipline* = {Discipline in English}, +% } +% \end{latex} +% +% \subsubsection{专业领域} +% +% 仅用于研究生专业型学位。 +% +% \begin{itemize} +% \item 设置专业领域的专业学位类别,填写相应专业领域名称; +% \item 2019 级及之前工程硕士学位论文,在 \option{engineering-field} 填写相应工程领域名称; +% \item 其他专业学位类别的学位论文无需此信息。 +% \end{itemize} +% +% \begin{latex} +% \thusetup{ +% professional-field = {计算机技术}, +% professional-field* = {Computer Technology}, +% } +% \end{latex} +% +% +% \subsubsection{作者姓名} +% 作者姓名。 +% \begin{latex} +% \thusetup{ +% author = {中文姓名}, +% author* = {Name in Pinyin}, +% } +% \end{latex} +% +% \subsubsection{学号} +% 学号,仅用于本、研论文开题报告。 +% \begin{latex} +% \thusetup{ +% student-id = {20000310000}, +% } +% \end{latex} +% +% \subsubsection{导师} +% \myentry{导师} +% 导师的姓名与职称之间以“,”(西文逗号,U+002C)隔开,下同。 +% \begin{latex} +% \thusetup{ +% supervisor = {导师姓名, 教授}, +% supervisor* = {Professor Supervisor Name}, +% } +% \end{latex} +% +% \myentry{副导师} +% 本科生的辅导教师,硕士的副指导教师。 +% \begin{latex} +% \thusetup{ +% associate-supervisor = {副导师姓名, 副教授}, +% associate-supervisor* = {Professor Assoc-Supervisor Name}, +% } +% \end{latex} +% +% \myentry{联合指导教师} +% \begin{latex} +% \thusetup{ +% co-supervisor = {联合指导教师姓名, 教授}, +% co-supervisor* = {Professor Join-Supervisor Name}, +% } +% \end{latex} +% +% \subsubsection{成文日期} +% 默认为当前日期,也可以自己指定,要求使用 ISO 格式。 +% \begin{latex} +% \thusetup{ +% date = {2011-07-01}, +% } +% \end{latex} +% +% \subsubsection{密级} +% \label{sec:setup-secret} +% 定义秘密级别和年限。如果定义了 \option{secret-level}, +% 则会在封面上显示对应密级,并且从声明页中将移除“不包含涉及国家秘密的内容”字样(2025年3月写作指南更新有此要求)。 +% \begin{latex} +% \thusetup{ +% secret-year = 10, +% secret-level = {秘密}, +% } +% \end{latex} +% +% \subsubsection{博士后专用参数} +% \begin{latex} +% \thusetup{ +% clc = {分类号}, +% udc = {udc}, +% id = {id}, +% discipline-level-1 = {流动站(一级学科)名称}, +% discipline-level-2 = {专业(二级学科)名称}, +% start-date = {2011-07-01}, % 研究工作起始时间 +% } +% \end{latex} +% +% \myentry{生成封面} +% \DescribeMacro{\maketitle} +% 生成封面,不含授权说明,摘要等。 +% \begin{latex} +% % 直接生成封面 +% \maketitle +% \end{latex} +% +% \subsection{前言部分} +% +% \subsubsection{指导小组、公开评阅人和答辩委员会名单} +% \myentry{答辩委员会名单} +% \DescribeEnv{committee} +% 学位论文指导小组、公开评阅人和答辩委员会名单可以由 \env{committee} 环境生成, +% 其中的可选参数可以使用 \option{name} 根据是有无指导小组设置合适的标题,比如 +% \begin{latex} +% \begin{committee}[name={学位论文公开评阅人和答辩委员会名单}] +% ... +% \end{committee} +% \end{latex} +% +% 答辩委员会名单中的表格使用 LaTeX 生成可能略麻烦,也可以导入 Word 版转成的 PDF 文件, +% \begin{latex} +% \begin{committee}[file=figures/committee.pdf] +% \end{committee} +% \end{latex} +% +% \subsubsection{授权说明} +% \myentry{授权说明} +% \DescribeMacro{\copyrightpage} +% 可选参数为扫描得到的 PDF 文件名,例如: +% \begin{latex} +% % 将签字扫描后授权文件 scan-copyright.pdf 替换原始页面 +% \copyrightpage[file=scan-copyright.pdf] +% \end{latex} +% +% \textbf{注意:}此命令只能使用一次。如果多次使用将会报错。 +% +% \subsubsection{摘要} +% \myentry{摘要正文} +% \DescribeEnv{abstract} +% \DescribeEnv{abstract*} +% +% 摘要直接在正文中使用 \env{abstract}、\env{abstract*} 环境生成。 +% +% \begin{latex} +% \begin{abstract} +% 摘要请写在这里... +% \end{abstract} +% +% \begin{abstract*} +% Here comes the abstract in English... +% \end{abstract*} +% \end{latex} +% +% \myentry{关键词} +% 关键词需要使用 \cs{thusetup} 进行设置。关键词之间以\emph{西文逗号}隔开,模板会 +% 自动调整为要求的格式。关键词的设置只要在摘要环境结束前即可。 +% \begin{latex} +% \thusetup{ +% keywords = {关键词 1, 关键词 2}, +% keywords* = {keyword 1, keyword 2}, +% } +% \end{latex} +% +% \subsubsection{目录和索引表} +% 目录、插图、表格、公式和算法等索引命令分别如下,将其插入到期望的位置即可(带*的命令表 +% 示对应的索引表不会出现在目录中): +% +% \DescribeMacro{\tableofcontents} +% \DescribeMacro{\listoffigures} +% \DescribeMacro{\listoftables} +% \DescribeMacro{\listoffiguresandtables} +% \DescribeMacro{\listofalgorithms} +% \begin{longtable}{ll} +% \toprule +% {\heiti 用途} & {\heiti 命令} \\\midrule +% 目录 & \cs{tableofcontents} \\ +% 插图清单 & \cs{listoffigures} \\ +% 附表清单 & \cs{listoftables} \\ +% 插图和附表清单 & \cs{listoffiguresandtables} \\ +% 算法清单 & \cs{listofalgorithms} \\ +% \bottomrule +% \end{longtable} +% +% \LaTeX{} 默认支持插图和表格索引,是通过 \cs{caption} 命令完成的,因此它们必须出 +% 现在浮动环境中,否则不被计数。 +% +% 如果不想让某个表格或者图片出现在索引里面,那么请使用命令 \cs{caption*},这 +% 个命令不会给表格编号,也就是出来的只有标题文字而没有“表~xx”,“图~xx”,否则 +% 索引里面序号不连续就显得不伦不类,这也是 \LaTeX{} 里星号命令默认的规则。 +% +% 如果的确想让其编号,但又不想出现在索引中的话,目前模板暂不支持。 +% +% \subsubsection{符号对照表} +% \DescribeEnv{denotation} +% 主要符号表环境,跟 \env{description} 类似,使用方法参见示例文件。带一个可选参数, +% 用来指定符号列的宽度(默认为 2.5cm)。 +% \begin{latex} +% \begin{denotation} +% \item[E] 能量 +% \item[m] 质量 +% \item[c] 光速 +% \end{denotation} +% \end{latex} +% +% 如果默认符号列的宽度不满意,可以通过参数来调整: +% \begin{latex} +% \begin{denotation}[1.5cm] % 设置为 1.5cm +% \item[E] 能量 +% \item[m] 质量 +% \item[c] 光速 +% \end{denotation} +% \end{latex} +% +% 符号对照表的另外一种方法是调用 \pkg{nomencl} 宏包,需要在导言区设置: +% +% \begin{latex} +% \usepackage{nomencl} +% \makenomenclature +% \end{latex} +% +% 然后在正文中任意位置使用 \cs{nomenclature} 声明需要添加到主要符号表的符号: +% +% \begin{latex} +% \nomenclature{$m$}{The mass of one angel} +% \end{latex} +% +% 最后使用 \cs{printnomenclature} 命令生成符号表。更详细的使用方法参 +% 见 \pkg{nomencl} 宏包的文档。 +% +% \subsection{正文部分} +% \subsubsection{图表编号} +% \DescribeOption{figure-number-separator} +% \DescribeOption{table-number-separator} +% \DescribeOption{equation-number-separator} +% 研究生要求图表和公式的编号使用“.”或“-”连接,模板默认使用句点“.”。 +% 用户也可以通过 \option{figure-number-separator}、\option{table-number-separator} +% 等选项分别设置: +% \begin{latex} +% \thusetup{ +% figure-number-separator = {-}, +% table-number-separator = {-}, +% equation-number-separator = {-}, +% } +% \end{latex} +% \DescribeOption{number-separator} +% 也可以使用 \option{number-separator} 同时设置图、表、公式三项的编号连接符, +% 比如 |\thusetup{number-separator = -}|。 +% +% 本科生要求“附录中图、表、公式的编号,应与正文中的编号区分开”, +% 应理解为将章号改变为附录对应的大写字母编号,连接符不宜改变。 +% +% \subsubsection{数学符号} +% \label{sec:math} +% 中文论文的数学符号默认遵循 GB/T 3102.11—1993《物理科学和技术中使用的数学符号》 +% \footnote{原 GB 3102.11—1993,自 2017 年 3 月 23 日起,该标准转为推荐性标准。}。 +% 该标准参照采纳 ISO 31-11:1992 \footnote{目前已更新为 ISO 80000-2:2019。}, +% 但是与 \TeX{} 默认的美国数学学会(AMS)的习惯有许多差异。 +% 这将在下文详细论述。 +% +% \DescribeOption{math-style} +% 用户可以通过设置 \option{math-style} 选择数学符号样式(可选: +% \option{GB}(中文默认),\option{TeX}(英文默认)和 \option{ISO}),比如: +% \begin{latex} +% \thusetup{ +% math-style = TeX, +% } +% \end{latex} +% +% 用户也可以逐项修改数学样式,包括: +% \newcommand\dif{\mathop{}\!\mathrm{d}} +% \begin{enumerate} +% \item \DescribeOption{uppercase-greek} +% 大写希腊字母的正/斜体,可选:\option{italic}、\option{upright}。 +% 有限增量符号 $\increment x$ 固定使用正体,推荐使用 \cs{increment} 表示。 +% \item \DescribeOption{less-than-or-equal} +% 小于等于号和大于等于号的字形,可选:\option{slanted}、\option{horizontal}。 +% 这将控制 \cs{le}、\cs{ge}、\cs{leq} 和 \cs{geq} 的符号 +% 是“$\leqslant$、$\geqslant$”还是“$\leq$、$\geq$”。 +% \item \DescribeOption{integral} +% 积分号的正/斜体,可选:\option{upright}、\option{slanted}。 +% 该选项需要字体的支持,目前仅限 \option{xits}、\option{stix}、 +% \option{libertinus} 和 \option{newcm}。参考下文关于数学字体的选择。 +% \item \DescribeOption{integral-limits} +% 积分号上下限的位置,可选:\option{true}(在上下)、\option{false}(在右侧)。 +% 这个设置只影响行间公式,行内公式统一居右侧,不受影响。 +% \item \DescribeOption{partial} +% 偏微分符号的正/斜体,可选:\option{upright}、\option{italic}。 +% \item \DescribeOption{math-ellipsis} +% 省略号 \cs{dots} 的样式,可选:\option{centered}(按照中文的习惯固定居中)、 +% \option{lower} 和 \option{AMS}(取决于前后符号的位置)。 +% 其他的省略号命令如 \cs{ldots}、\cs{cdots} 则不受影响。 +% \item \DescribeOption{real-part} +% 实部 \cs{Re} 和虚部 \cs{Im} 的字体,可选:\option{roman} 和 \option{fraktur}。 +% \end{enumerate} +% +% 如果数学符号选择国标样式 |math-style = GB|,相当于设置了 +% \begin{latex} +% \thusetup{ +% uppercase-greek = italic, +% less-than-or-equal = slanted, +% integral = upright, +% integral-limits = false, +% partial = upright, +% math-ellipsis = centered, +% real-part = roman, +% } +% \end{latex} +% +% 另外,国标的数学样式与 AMS 还有一些差异无法统一设置,需要用户在写作时进行处理。 +% \begin{enumerate} +% \item 数学常数和特殊函数名用正体,如 $\uppi = 3.14\dots$;$\symup{i}^2 = -1$; +% $\symup{e} = \lim_{n \to \infty} \left( 1 + \frac{1}{n} \right)^n$。 +% \item 微分号使用正体,比如 $\dif y / \dif x$。 +% \item 向量、矩阵和张量用粗斜体(\cs{symbf}),如 $\symbf{x}$、$\symbf{\Sigma}$、$\symbfsf{T}$。 +% \end{enumerate} +% +% 需要注意,上述关于数学符号风格的设置在设置数学字体(\option{math-font})时才会生效。 +% +% \DescribeOption{math-font} +% 模板使用默认使用 XITS Math 作为数学字体。 +% 用户也可以使用 \option{math-font} 选项切换其他数学字体,可选: +% \option{stix}(STIX Two Math)、 +% \option{libertinus}(Libertinus Math)、 +% \option{newcm}(New Computer Modern Math)、 +% \option{lm}(Latin Modern Math)。 +% +% 其中 \option{lm} 和 \option{newcm} 的字形比较搭配 TeX 原生的 Computer Modern 字体, +% 但与《指南》要求的西文字体 Times New Roman 并不搭配。 +% 可能会造成正文和公式中的数字字体不一致,需要谨慎使用。 +% +% 以上字体都是 OpenType 格式的字体,需要配合 +% \href{http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unicode-math.pdf}{\pkg{unicode-math}} +% 宏包使用。 +% 全部数学符号的命令参考 +% \href{http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unimath-symbols.pdf}{\pkg{unimath-symbols}}。 +% 注意,\pkg{unicode-math} 宏包与 \pkg{amsfonts}、\pkg{amssymb}、\pkg{bm}、 +% \pkg{mathrsfs}、\pkg{upgreek} 等宏包\emph{不}兼容。 +% 模板作了处理,用户可以直接使用这些宏包的命令,如 \cs{bm}、\cs{mathscr}、 +% \cs{uppi}。 +% +% 另外,模板还为 |math-font| 提供了传统的 Type 1 字体 \option{newtx}。 +% 该选项会调用 \pkg{newtxmath} 宏包。 +% 但是,如果西文字体已经使用了 OpenType 的 Times New Roman, +% 混用 Type 1 字体可能会导致问题,尤其是使用 \pkg{siunitx} 宏包时。 +% 该选项还处于测试阶段,需要谨慎使用。 +% +% \DescribeOption{eqn-paren-style} +% 控制中文论文中,数学公式编号两边的括号样式。可选项包括:\option{full}(全角,默认) / \option{half}(半角)。 +% 在语言为英语(|language = english|)时,此选项无效,仅使用半角括号。 +% +% \subsubsection{定理环境} +% \label{sec:theorem} +% \thuthesis{} 定义了常用的数学环境: +% +% \begin{center} +% \begin{tabular}{*{7}{l}}\toprule +% axiom & theorem & definition & proposition & lemma & conjecture &\\ +% 公理 & 定理 & 定义 & 命题 & 引理 & 猜想 &\\\midrule +% proof & corollary & example & exercise & assumption & remark & problem \\ +% 证明 & 推论 & 例子& 练习 & 假设 & 注释 & 问题\\\bottomrule +% \end{tabular} +% \end{center} +% +% 比如: +% \begin{latex} +% \begin{definition} +% 道千乘之国,敬事而信,节用而爱人,使民以时。 +% \end{definition} +% \end{latex} +% 产生(自动编号): +% \medskip +% +% \noindent\framebox[\linewidth][l]{{\heiti 定义~1.1~~~} % {道千乘之国,敬事而信,节用而爱人,使民以时。}} +% +% \smallskip +% 列举出来的数学环境毕竟是有限的,如果想用\emph{胡说}这样的数学环境,那么可以定义: +% \begin{latex} +% \newtheorem{nonsense}{胡说}[chapter] +% \end{latex} +% +% 然后这样使用: +% \begin{latex} +% \begin{nonsense} +% 契丹武士要来中原夺武林秘笈。—— 慕容博 +% \end{nonsense} +% \end{latex} +% +% 产生(自动编号): +% +% \medskip +% \noindent\framebox[\linewidth][l]{{\heiti 胡说~1.1~~~} % {契丹武士要来中原夺武林秘笈。—— 慕容博}} +% +% \subsubsection{列表环境} +% \DescribeEnv{itemize} +% \DescribeEnv{enumerate} +% \DescribeEnv{description} +% 为了适合中文习惯,模板将这三个常用的列表环境用 \pkg{enumitem} 进行了纵向间距压 +% 缩。一方面清除了多余空间,另一方面用户可以自己指定列表环境的样式(如标签符号, +% 缩进等)。细节请参看 \pkg{enumitem} 文档,此处不再赘述。 +% +% \subsubsection{引用方式} +% \label{sec:citestyle} +% 模板支持两种引用方式,分别为理工科常用的“顺序编码制”和文科常用 +% 的“著者-出版年制”。 +% 使用者在设置参考文献表的格式 +% (\cs{bibliographystyle},见第~\ref{sec:bibliography} 节)时, +% 正文中引用文献的标注会自动调整为对应的格式。 +% +% 如果需要标出引文的页码,可以写在 \cs{cite} 的可选参数中,如 +% |\cite[42]{knuth84}|。 +% +% \paragraph{顺序编码制} +% \DescribeMacro{\inlinecite} +% 顺序编码制的参考文献引用分为两种模式: +% \begin{enumerate} +% \item 上标模式,比如“同样的工作有很多\textsuperscript{[1-2]}……”; +% \item 正文模式,比如“文 [3] 中详细说明了……”。 +% \end{enumerate} +% +% \DescribeOption{cite-style} +% 用户可以将引用标注的格式设为正文模式: +% \begin{latex} +% \thusetup{ +% cite-style = inline, +% } +% \end{latex} +% 也可以使用 \cs{inlinecite}\marg{key} 临时使用正文模式的引用标注。 +% +% \paragraph{著者-出版年制} +% 著者-出版年制的参考文献引用有两种模式: +% \begin{enumerate} +% \item \cs{citep}:著者与年份均在括号中,比如“(Zhang, 2008)”, +% 同默认的 \cs{cite} 命令; +% \item \cs{citet}:著者姓名作为正文的一部分,比如“Zhang (2008)”; +% \end{enumerate} +% +% 另外,\pkg{natbib} 还提供了其他方便引用的命令, +% 比如 \cs{citeauthor}、\cs{citeyear} 等, +% 更多细节参考 \pkg{natbib} 的文档。 +% +% \subsection{其他部分} +% +% \subsubsection{参考文献} +% \label{sec:bibliography} +% +% 参考文献通常可以使用 \hologo{BibTeX} 或 biblatex 生成。 +% \hologo{BibTeX} 是 LaTeX 处理参考文献的传统的方式, +% 需要在使用 \cs{bibliographystyle}\marg{style} 选择样式 +% 并用 \cs{bibliography} 设置 \file{.bib} 的路径。 +% 然后使用 \texttt{bibtex} 对 \file{.aux} 文件进行编译得到 \file{.bbl} 文件。 +% 其中的参考文献表内容会在后续编译时替换到 \cs{bibliography} 的位置。 +% Biblatex 是较新的方式,需要在载入宏包时通过 \option{style} 选择样式, +% 在导言区使用 \cs{addbibresource} 声明数据库的路径, +% 并在输出参考文献表的位置使用 \cs{printbibliography} 命令, +% 而且编译参考文献的命令需要换为 biber。 +% 这两种方式各有优缺点,比如 BibTeX 无法对中文按照拼音排序,一些样式更新不够及时; +% Biblatex 运行较缓慢,无法对多个参考文献表使用不同样式。 +% 用户需要根据实际选择合适的方式。 +% +% 研究生要求的参考文献格式基于《信息与文献 参考文献著录规则》(GB/T 7714—2015) +% 进行了少量改编(如英文姓名不使用全大写), +% 可以选择“顺序编码制”和“著者-出版年制”。 +% 如果使用 BibTeX 的方式,需要在导言区载入 \pkg{natbib} 宏包并选择样式,如: +% \begin{latex} +% % 顺序编码制 +% \usepackage[sort]{natbib} +% \bibliographystyle{thuthesis-numeric} +% \end{latex} +% 或 +% \begin{latex} +% % 著者-出版年制 +% \usepackage{natbib} +% \bibliographystyle{thuthesis-author-year} +% \end{latex} +% 其中的 \option{sort} 选项会将同一处引用的多个文献编号严格按照顺序排序, +% 这并非《写作指南》要求,但是推荐使用。 +% 这里调用的样式由 \href{http://ctan.org/pkg/gbt7714}{\pkg{gbt7714}} 的 \file{.bst} 进行了少量修改。 +% +% 参考文献表采用“著者-出版年”制组织时,各篇文献首先按文种集中,然后按著者字 +% 顺和出版年排列;中文文献可以按著者汉语拼音字顺排列,也可以按著者的笔画笔顺排列。 +% 但由于 \hologo{BibTeX} 功能的局限性,无法自动获取著者姓名的拼音或笔画笔顺进行正确排序。 +% 一种解决方法是在 \file{.bib} 数据库的中文文献的 |key| 域手动录入著者姓名的拼音, +% 这比较适合中文文献数量较少的情况,如: +% \begin{latex} +% @book{capital, +% author = {马克思 and 恩格斯}, +% key = {ma3 ke4 si1 & en1 ge2 si1}, +% ... +% } +% \end{latex} +% 另一种方式是使用 biblatex,应在导言区设置 +% \begin{latex} +% \usepackage[style=thuthesis-author-year]{biblatex} +% \addbibresource{ref/refs.bib} +% \end{latex} +% 这里的样式由 \href{https://ctan.org/pkg/biblatex-gb7714-2015}{biblatex-gb7714-2015} 进行了少量改编, +% 一些额外用法可以参考该宏包的文档。 +% 注意 \pkg{biblatex} 跟 \pkg{natbib} 不兼容, +% 而且 \cs{addbibresource} 必须在导言区设置。 +% 输出参考文献表应使用 \cs{printbibliography} 命令。 +% +% 本科生要求的中文参考文献格式严格遵从 GB/T 7714—2015, +% 附录中调研报告的英文参考文献可以自行选择合适的风格。 +% 但是 biblatex 不支持同一文档中使用不同的格式, +% 所以只能使用 \hologo{BibTeX}: +% \begin{latex} +% % 本科生参考文献的著录格式 +% \usepackage[sort]{natbib} +% \bibliographystyle{thuthesis-bachelor} +% \end{latex} +% 调研报告的参考文献需要选择与 \pkg{natbib} 兼容的样式。 +% +% 本科生外文系要求使用 APA 或 MLA。 +% APA 的 BibTeX 样式由 \pkg{apacite} 宏包提供,需要在导言区调用: +% \begin{latex} +% \usepackage[natbibapa]{apacite} +% \bibliographystyle{apacite} +% \end{latex} +% 其中 \option{natbibapa} 会调用 \pkg{natbib} 来处理引用, +% 这也是宏包推荐的用法。 +% 注意目前的 \pkg{apacite} 只支持到 APA 第 6 版。 +% 更推荐使用已经更新到 APA 第 7 版的 \pkg{biblatex-apa}: +% \begin{latex} +% \usepackage[style=apa]{biblatex} +% \addbibresource{refs-apa.bib} +% \end{latex} +% 注意,如果参考文献中引用了中文文献的话,这两种方法都不能正确调整格式, +% 需要手动进行修改 \file{.bbl} 文件的内容, +% 这时 BibTeX 比 biblatex 更简单些。 +% +% BibTeX 没有用于 MLA 的样式,所以对于 MLA 只能使用 biblatex: +% \begin{latex} +% \usepackage[style=mla-new]{biblatex} +% \addbibresource{refs-apa.bib} +% \end{latex} +% 注意这里 \option{mla-new} 对应于 MLA 第 8 版的格式, +% \option{mla} 是第 7 版的。 +% +% \subsubsection{致谢} +% +% \DescribeEnv{acknowledgements} +% 把致谢做成一个环境更好一些,直接往里面写感谢的话就可以啦。 +% +% \begin{latex} +% \begin{acknowledgements} +% … +% 还要特别感谢 \thuthesis{} 节省了论文排版时间! +% \end{acknowledgements} +% \end{latex} +% +% \subsubsection{声明} +% \DescribeMacro{\statement} +% 直接使用 \cs{statement} 命令可以编译生成声明页。 +% 在打印、签字、扫描后如果要插入扫描页,将可选参数 \option{file} 指定为 PDF 文件名,例如: +% \begin{latex} +% \statement[file=scan-statement.pdf] +% \end{latex} +% +% 由于正文篇幅可能有变化,声明的页码可能不同。 +% 而且扫描件的页眉线可能有偏差 +% 所以为了避免重复打印扫描, +% 在提交终稿 PDF 时,先编译不含页眉页脚的声明页。 +% 在打印、签名、扫描成 PDF 文档后,再插入 \file{scan-statement.pdf} 替换原始页面, +% 并加上页眉页脚。 +% +% 用户可以通过可选参数 \option{page-style} 手动控制声明页是否含页眉页脚。 +% 例如编译生成声明页时不含页眉页脚: +% \begin{latex} +% \statement[page-style=empty] +% \end{latex} +% 插入扫描页时加上页眉页脚: +% \begin{latex} +% \statement[file=scan-statement.pdf, page-style=plain] +% \end{latex} +% +% \textbf{注意:}此命令只能使用一次。如果多次使用将会报错。 +% +% \subsubsection{附录} +% +% 附录由 \cs{appendix} 命令开启,然后像正文一样书写。 +% \begin{latex} +% \appendix +% \chapter{...} +% ... +% \end{latex} +% +% \DescribeOption{toc-depth} +% 一些院系要求目录中只出现附录的章标题,不出现附录中的一级、二级节标题。模板默认 +% 如此设置,用户也可以在 \cs{appendix} 命令后手动控制加入目录的标题层级,其 +% 中 |0| 表示章标题,|1| 表示一级节标题,以此类推。 +% +% \begin{latex} +% \appendix +% \thusetup{toc-depth=0} % 目录只出现章标题 +% \end{latex} +% +% \subsubsection{个人简历、在学期间完成的相关学术成果} +% \DescribeEnv{resume} +% 研究生的标题为“个人简历、在学期间完成的相关学术成果”, +% 本科生的标题为“在学期间参加课题的研究成果”或“PUBLICATIONS”。 +% +% \DescribeEnv{achievements} +% 本章的其他标题同样使用 \cs{section*},\cs{subsection*} 等命令生成, +% 研究成果用 \env{achievements} 环境罗列。 +% +% \begin{latex} +% \begin{resume} +% \section*{个人简历} +% …… +% +% \section*{在学期间完成的相关学术成果} +% +% \subsection*{学术论文} +% \begin{achievements} +% \item …… +% \item …… +% \end{achievements} +% +% \subsection*{专利} +% \begin{achievements} +% \item …… +% \item …… +% \end{achievements} +% \end{resume} +% \end{latex} +% +% \subsubsection{综合论文训练记录表} +% \DescribeMacro{\record} +% 本科生需要在最后附上综合论文训练记录表,可以用如下命令: +% +% \begin{latex} +% \record{file=scan-record.pdf} +% \end{latex} +% +% \textbf{注意:}此命令只能使用一次。如果多次使用将会报错。 +% +% +% \subsection{书脊} +% \DescribeMacro{\spine} +% \DescribeOption{spine-font} +% \DescribeOption{spine-title} +% \DescribeOption{spine-author} +% 生成装订的书脊,为竖排格式。内容默认使用论文的标题和作者。 +% 可以设置 \option{spine-title} 和 \option{spine-author} 来修改。 +% +% 博士论文的书脊字体默认为三号字,硕士的为小三号。 +% 本科生要求字体大小根据论文的薄厚而定,可以使用 \option{spine-font} 设置字号。 +% \begin{latex} +% \thusetup{ +% spine-font = {\zihao{3}}, +% spine-title = {书脊的标题}, +% spine-author = {书脊的作者姓名}, +% } +% \end{latex} +% +% 由于 Fandol 字体在 \XeTeX 中的竖排存在一些问题,如果书脊使用的字体是 Fandol 仿宋 +%(\option{fontset} 为 \texttt{fandol} 或者 \texttt{ubuntu} 时),则它\textbf{必须作为独立文件生成}, +% 否则可能导致后续内容文字方向错乱的问题。 +% +% \DescribeOption{include-spine} +% 一些院系要求把书脊插进论文里,需要在 \cs{maketitle} 前设置。 +% \begin{latex} +% \thusetup{ +% include-spine = true, +% } +% \end{latex} +% 打开此选项后,书脊会出现在中文封面后面的第一个空白页。如果有英文封面,则在英文封面之前。 +% 如果需要书脊出现在其他位置,请手工使用 \cs{spine} 生成,不要使用此选项。 +% +% \section{致谢} +% \label{sec:thanks} +% 感谢这些年来一直陪伴 \thuthesis{} 成长的新老同学! +% +% 欢迎各位到 \href{http://github.com/tuna/thuthesis/}{\thuthesis{} GitHub 主页}贡献! +% +% +% ^^A redefine some commands in markdown package to remove annoying section numbering +% \renewcommand{\markdownRendererHeadingTwo}[1]{\subsection*{#1}} +% \renewcommand{\markdownRendererHeadingThree}[1]{\subsubsection*{#1}} +% ^^A render changelog from markdown +% \markdownInput{CHANGELOG.md} +% +% +% \StopEventually{\PrintIndex} +% \clearpage +% +% \section{实现细节} +% +% \subsection{基本信息} +% \begin{macrocode} +%\NeedsTeXFormat{LaTeX2e}[2017/04/15] +%\ProvidesClass{thuthesis} +%[2026/05/10 7.7.0 Tsinghua University Thesis Template] +% \end{macrocode} +% +% 报错 +% \begin{macrocode} +\newcommand\thu@error[1]{% + \ClassError{thuthesis}{#1}{}% +} +\newcommand\thu@warning[1]{% + \ClassWarning{thuthesis}{#1}% +} +\newcommand\thu@debug[1]{% + \typeout{Package thuthesis Info: #1}% +} +\newcommand\thu@patch@error[1]{% + \thu@error{Failed to patch command \protect#1}% +} +\newcommand\thu@deprecate[2]{% + \def\thu@@tmp{#2}% + \thu@warning{% + The #1 is deprecated% + \ifx\thu@@tmp\@empty\else + . Use #2 instead% + \fi + }% +} +% \end{macrocode} +% +% 将某个宏的定义替换为报错信息,用于只应该使用一次的命令。 +% 如:\cs{statement}、\cs{copyrightpage}, \cs{record} 等。 +% \begin{macrocode} +\newcommand\thu@replace@with@error[1]{% + \expandafter\def\csname #1\endcsname{% + \thu@error{% + \expandafter\protect\csname #1\endcsname\space can only be used once. + \MessageBreak + Please remove the duplicate call% + }% + }% +} +% \end{macrocode} +% +% 检查 \LaTeXe{} kernel 版本 +% \begin{macrocode} +\@ifl@t@r\fmtversion{2017/04/15}{}{ + \thu@error{% + TeX Live 2017 or later version is required to compile this document% + } +} +% \end{macrocode} +% +% 检查编译引擎,要求使用 \XeLaTeX。 +% \begin{macrocode} +\RequirePackage{iftex} +\ifXeTeX\else + \ifLuaTeX\else + \thu@error{XeLaTeX or LuaLaTeX is required to compile this document} + \fi +\fi +% \end{macrocode} +% +% 载入用于测试的配置。 +% \begin{macrocode} +\InputIfFileExists{thuthesis-pdf-test-config.tex}{}{ + \InputIfFileExists{thuthesis-log-test-config.tex}{}{} +} +% \end{macrocode} +% +% \subsection{定义选项} +% \label{sec:defoption} +% 定义论文类型以及是否涉密 +% \begin{macrocode} +%<*cls> +\hyphenation{Thu-Thesis} +\def\thuthesis{ThuThesis} +\def\version{7.7.0} +\RequirePackage{kvdefinekeys} +\RequirePackage{kvsetkeys} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{ + family=thu, + prefix=thu@, + setkeys=\kvsetkeys} +% \end{macrocode} +% +% \begin{macro}{\thusetup} +% 提供一个 \cs{thusetup} 命令支持 \emph{key-value} 的方式来设置。 +% \begin{macrocode} +\let\thu@setup@hook\@empty +\newcommand\thusetup[1]{% + \let\thu@setup@hook\@empty + \kvsetkeys{thu}{#1}% + \thu@setup@hook +} +% \end{macrocode} +% \end{macro} +% +% 同时用 \emph{key-value} 的方式来定义这些接口: +% \begin{latex} +% \thu@define@key{ +% = { +% name = , +% choices = { +% , +% , +% }, +% default = , +% }, +% } +% \end{latex} +% +% 其中 |choices| 设置允许使用的值,默认为第一个(或者 \meta{default}); +% \meta{code} 是相应的内容被设置时执行的代码。 +% +% \begin{macrocode} +\newcommand\thu@define@key[1]{% + \kvsetkeys{thu@key}{#1}% +} +\kv@set@family@handler{thu@key}{% +% \end{macrocode} +% +% \cs{thusetup} 会将 \meta{value} 存到 \cs{thu@\meta{key}}, +% 但是宏的名字包含 “-” 这样的特殊字符时不方便直接调用,比如 |key = math-style|, +% 这时可以用 |name| 设置 \meta{key} 的别称,比如 |key = math@style|, +% 这样就可以通过 \cs{thu@math@style} 来引用。 +% |default| 是定义该 \meta{key} 时默认的值,缺省为空。 +% +% \begin{macrocode} + \@namedef{thu@#1@@name}{#1}% + \def\thu@@default{}% + \def\thu@@choices{}% + \kv@define@key{thu@value}{name}{% + \@namedef{thu@#1@@name}{##1}% + }% +% \end{macrocode} +% +% 由于在定义接口时,\cs{thu@\meta{key}@@code} 不一定有定义, +% 而且在文档类/宏包中还有可能对该 |key| 的 |code| 进行添加。 +% 所以 \cs{thu@\meta{key}@@code} 会检查如果在定义文档类/宏包时则推迟执行,否则立即执行。 +% +% \begin{macrocode} + \@namedef{thu@#1@@check}{}% + \@namedef{thu@#1@@code}{}% +% \end{macrocode} +% +% 保存下 |choices = {}| 定义的内容,在定义 \cs{thu@\meta{name}} 后再执行。 +% +% \begin{macrocode} + \kv@define@key{thu@value}{choices}{% + \def\thu@@choices{##1}% + \@namedef{thu@#1@@reset}{}% +% \end{macrocode} +% +% \cs{thu@\meta{key}@check} 检查 |value| 是否有效, +% 并设置 \cs{ifthu@\meta{name}@\meta{value}}。 +% +% \begin{macrocode} + \@namedef{thu@#1@@check}{% + \@ifundefined{% + ifthu@\@nameuse{thu@#1@@name}@\@nameuse{thu@\@nameuse{thu@#1@@name}}% + }{% + \thu@error{Invalid value "#1 = \@nameuse{thu@\@nameuse{thu@#1@@name}}"}% + }% + \@nameuse{thu@#1@@reset}% + \@nameuse{thu@\@nameuse{thu@#1@@name}@\@nameuse{thu@\@nameuse{thu@#1@@name}}true}% + }% + }% + \kv@define@key{thu@value}{default}{% + \def\thu@@default{##1}% + }% + \kvsetkeys{thu@value}{#2}% + \@namedef{thu@\@nameuse{thu@#1@@name}}{}% +% \end{macrocode} +% +% 第一个 \meta{choice} 设为 \meta{default}, +% 并且对每个 \meta{choice} 定义 \cs{ifthu@\meta{name}@\meta{choice}}。 +% +% \begin{macrocode} + \kv@set@family@handler{thu@choice}{% + \ifx\thu@@default\@empty + \def\thu@@default{##1}% + \fi + \expandafter\newif\csname ifthu@\@nameuse{thu@#1@@name}@##1\endcsname + \expandafter\g@addto@macro\csname thu@#1@@reset\endcsname{% + \@nameuse{thu@\@nameuse{thu@#1@@name}@##1false}% + }% + }% + \kvsetkeys@expandafter{thu@choice}{\thu@@choices}% +% \end{macrocode} +% +% 将 \meta{default} 赋值到 \cs{thu@\meta{name}},如果非空则执行相应的代码。 +% +% \begin{macrocode} + \expandafter\let\csname thu@\@nameuse{thu@#1@@name}\endcsname\thu@@default + \expandafter\ifx\csname thu@\@nameuse{thu@#1@@name}\endcsname\@empty\else + \@nameuse{thu@#1@@check}% + \fi +% \end{macrocode} +% +% 定义 \cs{thusetup} 接口。 +% +% \begin{macrocode} + \kv@define@key{thu}{#1}{% + \@namedef{thu@\@nameuse{thu@#1@@name}}{##1}% + \@nameuse{thu@#1@@check}% + \@nameuse{thu@#1@@code}% + }% +} +% \end{macrocode} +% +% 定义接口向 |key| 添加 |code|: +% +% \begin{macrocode} +\newcommand\thu@option@hook[2]{% + \expandafter\g@addto@macro\csname thu@#1@@code\endcsname{#2}% +} +% \end{macrocode} +% +% \begin{macrocode} +\thu@define@key{ + thesis-type = { + name = thesis@type, + choices = { + thesis, + proposal, + }, + default = thesis, + }, + degree = { + choices = { + bachelor, + master, + doctor, + postdoc, + }, + default = doctor, + }, + degree-type = { + choices = { + academic, + professional, + }, + name = degree@type, + }, +% \end{macrocode} +% +% 论文的主要语言。 +% \begin{macrocode} + main-language = { + name = main@language, + choices = { + chinese, + english, + }, + }, +% \end{macrocode} +% +% 用于设置局部语言。 +% \begin{macrocode} + language = { + choices = { + chinese, + english, + }, + }, +% \end{macrocode} +% +% 字体 +% \begin{macrocode} + system = { + choices = { + auto, + mac, + unix, + windows, + }, + default = auto, + }, + fontset = { + choices = { + auto, + windows, + mac, + ubuntu, + fandol, + none, + }, + default = auto, + }, + font = { + choices = { + auto, + times, + termes, + stix, + xits, + libertinus, + newcm, + lm, + newtx, + none, + }, + default = auto, + }, + cjk-font = { + name = cjk@font, + choices = { + auto, + windows, + windows-local, + mac, + mac-word, + noto, + fandol, + none, + }, + default = auto, + }, + windows-font-dir = { + name = windows@font@dir, + default = {.}, + }, + math-font = { + name = math@font, + choices = { + auto, + stix, + xits, + libertinus, + newcm, + lm, + newtx, + none, + }, + default = auto, + }, + math-style = { + name = math@style, + choices = { + GB, + ISO, + TeX, + }, + }, + uppercase-greek = { + name = uppercase@greek, + choices = { + italic, + upright, + }, + }, + less-than-or-equal = { + name = leq, + choices = { + slanted, + horizontal, + }, + }, + integral = { + choices = { + upright, + slanted, + }, + }, + integral-limits = { + name = integral@limits, + choices = { + true, + false, + }, + }, + partial = { + choices = { + upright, + italic, + }, + }, + math-ellipsis = { + name = math@ellipsis, + choices = { + centered, + lower, + AMS, + }, + }, + real-part = { + name = real@part, + choices = { + roman, + fraktur, + }, + }, +% \end{macrocode} +% +% 选择打印版还是用于上传的电子版。 +% \begin{macrocode} + output = { + choices = { + print, + electronic, + }, + default = print, + }, +% \end{macrocode} +% +% 数学公式编号的括号使用全角还是半角。 +% \begin{macrocode} + eqn-paren-style = { + name = eqn@paren@style, + choices = { + full, + half, + } + }, +% \end{macrocode} +% +% 苏世民学院的格式相比学校有如下变动:全文的脚注都连续编号(包括到附录中),不使用带圈数字; +% 全文图、表、公式连续编号。 +% \begin{macrocode} + style-override = { + name = style@override, + choices = { + none, + schwarzman, + }, + }, + footnote-numbering = { + name = footnote@numbering, + choices = { + page, + chapter, + global, + }, + }, + footnote-style = { + name = footnote@style, + choices = { + circled, + plain, + }, + }, + figure-numbering = { + name = figure@numbering, + choices = { + chapter, + global, + }, + }, + table-numbering = { + name = table@numbering, + choices = { + chapter, + global, + }, + }, + equation-numbering = { + name = equation@numbering, + choices = { + chapter, + global, + }, + }, +} +\newif\ifthu@degree@graduate +\newcommand\thu@set@graduate{% + \thu@degree@graduatefalse + \ifthu@degree@doctor + \thu@degree@graduatetrue + \fi + \ifthu@degree@master + \thu@degree@graduatetrue + \fi +} +\thu@set@graduate +\thu@option@hook{degree}{% + \thu@set@graduate +} +% \end{macrocode} +% +% 设置默认 \option{openany}。 +% \begin{macrocode} +\DeclareBoolOption[false]{openright} +\DeclareComplementaryOption{openany}{openright} +% \end{macrocode} +% +% \option{raggedbottom} 选项(默认打开) +% \begin{macrocode} +\DeclareBoolOption[true]{raggedbottom} +% \end{macrocode} +% +% 将选项传递给 \pkg{ctexbook}。 +% \begin{macrocode} +\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}} +% \end{macrocode} +% +% 解析用户传递过来的选项,并加载 \pkg{ctexbook}。 +% \begin{macrocode} +\ProcessKeyvalOptions* +% \end{macrocode} +% +% 设置默认 \option{openany}。 +% \begin{macrocode} +\ifthu@openright + \PassOptionsToClass{openright}{book} +\else + \PassOptionsToClass{openany}{book} +\fi +% \end{macrocode} +% +% \pkg{unicode-math} 和 \pkg{newtx} 都不需要 \pkg{fontspec} 设置数学字体。 +% \begin{macrocode} +\PassOptionsToPackage{no-math}{fontspec} +% \end{macrocode} +% +% 处理苏世民学院的格式。 +% \begin{macrocode} +\ifthu@style@override@schwarzman + \thusetup{ + footnote-numbering = global, + footnote-style = plain, + figure-numbering = global, + table-numbering = global, + equation-numbering = global, + } +\fi +\thu@option@hook{style-override}{\thu@error{% + The 'style-override' option is only valid in class options.% +}}% +\thu@option@hook{footnote-numbering}{\thu@error{% + The 'footnote-numbering' option is only valid in class options.% +}}% +\ifthu@footnote@numbering@page + \PassOptionsToPackage{perpage}{footmisc}% +\fi +% \end{macrocode} +% +% 使用 \pkg{ctexbook} 类,优于调用 \pkg{ctex} 宏包。 +% \begin{macrocode} +\LoadClass[a4paper,UTF8,zihao=-4,scheme=plain,fontset=none]{ctexbook}[2017/04/01] +% \end{macrocode} +% +% +% \subsection{装载宏包} +% \label{sec:loadpackage} +% +% 引用的宏包和相应的定义。 +% \begin{macrocode} +\RequirePackage{etoolbox} +\RequirePackage{filehook} +\RequirePackage{xparse} +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{geometry}% +% \end{macrocode} +% +% 利用 \pkg{fancyhdr} 设置页眉页脚。 +% \begin{macrocode} +\RequirePackage{fancyhdr} +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{titletoc} +% \end{macrocode} +% +% 利用 \pkg{notoccite} 避免目录中引用编号混乱。 +% \begin{macrocode} +\RequirePackage{notoccite} +% \end{macrocode} +% +% \AmSTeX\ 宏包,用来排出更加漂亮的公式。 +% \begin{macrocode} +\RequirePackage{amsmath} +% \end{macrocode} +% +% 图形支持宏包。 +% \begin{macrocode} +\RequirePackage{graphicx} +% \end{macrocode} +% +% 并排图形。\pkg{subfigure}、\pkg{subfig} 已经不再推荐,用新的 \pkg{subcaption}。 +% 浮动图形和表格标题样式。\pkg{caption2} 已经不推荐使用,采用新的 \pkg{caption}。 +% \begin{macrocode} +\RequirePackage[labelformat=simple]{subcaption} +% \end{macrocode} +% +% \pkg{pdfpages} 宏包便于我们插入扫描后的授权说明和声明页 PDF 文档。 +% +% 由于 \pkg{pdfpages} 跟 \pkg{TikZ} 的 \pkg{external} 库冲突, +% 需要在导言区的结尾进行处理,见 +% \href{https://github.com/tuna/thuthesis/issues/693}{\#693}。 +% \begin{macrocode} +\RequirePackage{pdfpages} +\includepdfset{fitpaper=true} +\AtEndPreamble{ + \ifx\tikzifexternalizing\@undefined\else + \tikzifexternalizing{ + \renewcommand*\includepdf[2][]{} + }{} + \fi +} +% \end{macrocode} +% +% 更好的列表环境。 +% \begin{macrocode} +\RequirePackage[shortlabels]{enumitem} +\RequirePackage{environ} +% \end{macrocode} +% +% 禁止 \LaTeX{} 自动调整多余的页面底部空白,并保持脚注仍然在底部。 +% 脚注按页编号。 +% \begin{macrocode} +\ifthu@raggedbottom + \RequirePackage[bottom,hang]{footmisc} + \raggedbottom +\else + \RequirePackage[hang]{footmisc} +\fi +% \end{macrocode} +% +% 利用 \pkg{xeCJKfntef} 实现汉字的下划线和盒子内两段对齐,并可以避免 +% \cs{makebox}\oarg{width}\oarg{s} 可能产生的 underful boxes。 +% \begin{macrocode} +\ifXeTeX + \RequirePackage{xeCJKfntef} +\else + \RequirePackage{ulem} +\fi +% \end{macrocode} +% +% 表格控制 +% \begin{macrocode} +\RequirePackage{array} +% \end{macrocode} +% +% 使用三线表:\cs{toprule},\cs{midrule},\cs{bottomrule}。 +% \begin{macrocode} +\RequirePackage{booktabs} +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{url} +% \end{macrocode} +% +% 如果用户在导言区未调用 \pkg{biblatex},则自动调用 \pkg{natbib}。 +% \begin{macrocode} +\AtEndPreamble{ + \@ifpackageloaded{biblatex}{}{ + \@ifpackageloaded{apacite}{}{ + \RequirePackage{natbib} + } + } +} +\AtEndOfPackageFile*{natbib}{ + \@ifpackageloaded{apacite}{}{ + \RequirePackage{bibunits} + } +} +% \end{macrocode} +% +% 对冲突的宏包报错。 +% \begin{macrocode} +\newcommand\thu@package@conflict[2]{% + \AtEndOfPackageFile*{#1}{% + \AtBeginOfPackageFile*{#2}{% + \thu@error{The "#2" package is incompatible with "#1"}% + }% + }% +} +\thu@package@conflict{biblatex}{bibunits} +\thu@package@conflict{biblatex}{chapterbib} +\thu@package@conflict{biblatex}{cite} +\thu@package@conflict{biblatex}{multibib} +\thu@package@conflict{biblatex}{natbib} + +\thu@package@conflict{bibunits}{biblatex} +\thu@package@conflict{bibunits}{chapterbib} +\thu@package@conflict{bibunits}{multibib} + +\thu@package@conflict{unicode-math}{amscd} +\thu@package@conflict{unicode-math}{amsfonts} +\thu@package@conflict{unicode-math}{amssymb} +\thu@package@conflict{unicode-math}{bbm} +\thu@package@conflict{unicode-math}{bm} +\thu@package@conflict{unicode-math}{eucal} +\thu@package@conflict{unicode-math}{eufrak} +\thu@package@conflict{unicode-math}{mathrsfs} +\thu@package@conflict{unicode-math}{newtxmath} +\thu@package@conflict{unicode-math}{upgreek} + +\thu@package@conflict{natbib}{biblatex} +\thu@package@conflict{natbib}{cite} + +\thu@package@conflict{newtxmath}{amsfonts} +\thu@package@conflict{newtxmath}{amssymb} +\thu@package@conflict{newtxmath}{unicode-math} +\thu@package@conflict{newtxmath}{upgreek} +% \end{macrocode} +% +% \pkg{amsthm} 需要在 \pkg{newtx} 前载入,参考 \pkg{newtx} 的文档。 +% \begin{macrocode} +\AtBeginOfPackageFile*{amsthm}{ + \@ifpackageloaded{newtxmath}{ + \thu@error{The "amsthm" package should be loaded before setting "newtxmath"} + }{} +}% +% \end{macrocode} +% +% \subsection{页面设置} +% \label{sec:layout} +% +% 研究生《写作指南》: +% 页边距:上下左右均为 3.0 厘米,装订线 0 厘米; +% 页眉距边界:2.2 厘米,页脚距边界:2.2 厘米。 +% +% 本科生《写作规范》: +% 页边距:3 厘米,装订线:0 厘米。 +% 本科生 Word 模板: +% 无页眉,页脚距边界:1.5 厘米。 +% +% \pkg{fancyhdr} 的页眉是沿底部对齐的,所以只需设置 \cs{headsep}, +% \cs{headheight} 可以适当增加高度允许多行页眉。 +% 研究生:\cs{headsep} = $\SI{3}{cm} - \SI{2.2}{cm} - \SI{10.5}{bp} \times 1.3 +% \approx \SI{0.3}{cm}$。 +% +% \begin{macrocode} +\geometry{ + paper = a4paper, % 210 * 297mm + marginparwidth = 2cm, + marginparsep = 0.5cm, +} +\newcommand\thu@set@geometry{% + \ifthu@degree@bachelor + \geometry{ + margin = 3cm, + footskip = 1.5cm, + }% + \else + \geometry{ + margin = 3cm, + headheight = 2.7cm, + headsep = 0.3cm, + footskip = 0.8cm, + }% + \fi +} +\thu@set@geometry +\thu@option@hook{degree}{\thu@set@geometry} +\thu@option@hook{output}{\thu@set@geometry} +% \end{macrocode} +% +% +% \subsection{语言设置} +% +% 定义 \cs{thu@main@language},当在导言区修改 \option{language} 时, +% 保存为论文的主要语言; +% \cs{thu@reset@main@language} 则用于正文中恢复为主要语言。 +% \begin{macrocode} +\thusetup{main-language=\thu@language}% +\let\thu@main@language\thu@language +\thu@option@hook{language}{% + \ifx\@begindocumenthook\@undefined\else + \thusetup{main-language=\thu@language}% + \let\thu@main@language\thu@language + \fi +} +\newcommand\thu@reset@main@language{% + \thusetup{language = \thu@main@language}% + \let\thu@language\thu@main@language +} +% \end{macrocode} +% +% 根据语言设置各章节的名称,只有在导言区设置 \option{degree} 和 +% \option{language} 时会修改,而在正文局部切换语言时则不变。 +% \begin{macrocode} +\newcommand\thu@set@chapter@names{% + \ifthu@degree@bachelor + \def\thu@statement@name{声明}% + \else + \def\thu@statement@name{声\hspace{1em}明}% + \fi + \ifthu@main@language@chinese + \def\listfigurename{插图清单}% + \def\listtablename{附表清单}% + \def\thu@list@figure@table@name{插图和附表清单}% + \def\thu@list@algorithm@name{算法清单}% + \def\thu@denotation@name{符号和缩略语说明}% + \def\thu@comments@name{指导教师评语}% + \def\bibname{参考文献}% + \def\appendixname{附录}% + \def\indexname{索引}% + \def\thu@resolution@name{答辩委员会决议书}% + \ifthu@degree@bachelor + \def\contentsname{目录}% + \def\thu@acknowledgements@name{致谢}% + \def\listequationname{公式索引}% + \def\thu@resume@name{在学期间参加课题的研究成果}% + \else + \def\listequationname{公式清单}% + \def\thu@acknowledgements@name{致\quad 谢}% + \ifthu@degree@graduate + \def\contentsname{目\quad 录}% + \def\thu@resume@name{个人简历、在学期间完成的相关学术成果}% + \else % degree = postdoc + \def\contentsname{目\qquad 次}% + \def\thu@denotation@name{符号表}% + \def\thu@resume@name{个人简历、发表的学术论文与科研成果}% + \fi + \fi + \else + \ifthu@main@language@english + \def\thu@comments@name{Comments from Thesis Supervisor}% + \def\thu@resolution@name{Resolution of Thesis Defense Committee}% + \def\indexname{Index}% + \ifthu@degree@bachelor + \def\contentsname{CONTENTS}% + \def\listfigurename{FIGURES}% + \def\listtablename{TABLES}% + \def\thu@list@figure@table@name{FIGURES AND TABLES}% + \def\thu@list@algorithm@name{ALGORITHMS}% + \def\listequationname{EQUATIONS}% + \def\thu@denotation@name{ABBREVIATIONS}% + \def\bibname{REFERENCES}% + \def\appendixname{APPENDIX}% + \def\thu@acknowledgements@name{ACKNOWLEDGEMENTS}% + \def\thu@resume@name{PUBLICATIONS}% + \else + \def\contentsname{Table of Contents}% + \def\listfigurename{List of Figures}% + \def\listtablename{List of Tables}% + \def\thu@list@figure@table@name{List of Figures and Tables}% + \def\thu@list@algorithm@name{List of Algorithms}% + \def\listequationname{List of Equations}% + \def\thu@denotation@name{List of Symbols and Acronyms}% + \def\bibname{References}% + \def\appendixname{Appendix}% + \def\thu@acknowledgements@name{Acknowledgements}% + \def\thu@resume@name{Resume}% + \fi + \fi + \fi +} +\thu@set@chapter@names +\thu@option@hook{degree}{\thu@set@chapter@names} +\thu@option@hook{main-language}{\thu@set@chapter@names} +% \end{macrocode} +% +% 这部分名称在正文中局部地修改语言时会发生变化,比如英文摘要、 +% 本科生附录的阅读报告。 +% \begin{macrocode} +\newcommand\thu@set@names{% + \ifthu@language@chinese + \ctexset{ + figurename = 图, + tablename = 表, + }% + \def\thu@algorithm@name{算法}% + \def\thu@equation@name{公式}% + \def\thu@assumption@name{假设}% + \def\thu@definition@name{定义}% + \def\thu@proposition@name{命题}% + \def\thu@lemma@name{引理}% + \def\thu@theorem@name{定理}% + \def\thu@axiom@name{公理}% + \def\thu@corollary@name{推论}% + \def\thu@exercise@name{练习}% + \def\thu@example@name{例}% + \def\thu@remark@name{注释}% + \def\thu@problem@name{问题}% + \def\thu@conjecture@name{猜想}% + \def\thu@proof@name{证明}% + \def\thu@theorem@separator{:}% + \else + \ifthu@language@english + \ctexset{ + figurename = {Figure}, + tablename = {Table}, + }% + \def\thu@algorithm@name{Algorithm}% + \def\thu@equation@name{Equation}% + \def\thu@assumption@name{Assumption}% + \def\thu@definition@name{Definition}% + \def\thu@proposition@name{Proposition}% + \def\thu@lemma@name{Lemma}% + \def\thu@theorem@name{Theorem}% + \def\thu@axiom@name{Axiom}% + \def\thu@corollary@name{Corollary}% + \def\thu@exercise@name{Exercise}% + \def\thu@example@name{Example}% + \def\thu@remark@name{Remark}% + \def\thu@problem@name{Problem}% + \def\thu@conjecture@name{Conjecture}% + \def\thu@proof@name{Proof}% + \def\thu@theorem@separator{: }% + \fi + \fi +} +\thu@set@names +\thu@option@hook{language}{\thu@set@names} +% \end{macrocode} +% +% 带圈数字和星号使用中文字体。 +% \begin{macrocode} +\ifLuaTeX + % ctex 将带圈数字 U+2460–U+2473 归入字符范围 3(ALchar),这里改回范围 6(JAchar) + \ltjdefcharrange{6}{"2460-"2473, "2605} +\else + \ifXeTeX + \xeCJKDeclareCharClass{CJK}{"2460 -> "2473, "2605} + \fi +\fi +% \end{macrocode} +% +% \newcommand\unicodechar[1]{U+#1(\symbol{"#1})} +% 由于 Unicode 的一些标点符号是中西文混用的: +% \unicodechar{00B7}、 +% \unicodechar{2013}、 +% \unicodechar{2014}、 +% \unicodechar{2018}、 +% \unicodechar{2019}、 +% \unicodechar{201C}、 +% \unicodechar{201D}、 +% \unicodechar{2025}、 +% \unicodechar{2026}、 +% \unicodechar{2E3A}, +% 所以要根据语言设置正确的字体。 +% \footnote{\url{https://github.com/CTeX-org/ctex-kit/issues/389}} +% 此外切换语言时,有一部分名称是需要被重新定义的。 +% \begin{macrocode} +\newcommand\thu@set@punctuations{% + \ifthu@language@chinese + \ifLuaTeX + \ltjsetparameter{jacharrange={+9}} + \else + \ifXeTeX + \xeCJKDeclareCharClass{FullLeft}{"2018, "201C}% + \xeCJKDeclareCharClass{FullRight}{ + "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A, + }% + \fi + \fi + \else + \ifthu@language@english + \ifLuaTeX + \ltjsetparameter{jacharrange={-9}} + \else + \ifXeTeX + \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}% + \xeCJKDeclareCharClass{HalfRight}{ + "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A, + }% + \fi + \fi + \fi + \fi +} +\thu@set@punctuations +\thu@option@hook{language}{\thu@set@punctuations} +% \end{macrocode} +% +% \subsection{字体} +% \label{sec:font} +% +% \subsubsection{字号} +% +% \begin{macro}{\normalsize} +% 正文小四号(12bp)字,行距为固定值 20 bp。 +% 其他字号的行距按照相同的比例设置。 +% +% 注意重定义 \cs{normalsize} 应在 \pkg{unicode-math} 的 \cs{setmathfont} 前。 +% +% 表达式行的行距为单倍行距,段前空 6 磅,段后空 6 磅。 +% +% \cs{small} 等其他命令通常用于表格等环境中,这部分要求单倍行距,与正文的字号-行距比例不同, +% 所以保留默认的 1.2 倍字号的行距,作为单倍行距在英文(1.15 倍字号)和中文(1.3倍字号) +% 两种情况的折衷。 +% \begin{macrocode} +\renewcommand\normalsize{% + \@setfontsize\normalsize{12bp}{20bp}% + \abovedisplayskip 6bp% + \abovedisplayshortskip 6bp% + \belowdisplayshortskip 6bp% + \belowdisplayskip \abovedisplayskip +} +\normalsize +\ifx\MakeRobust\@undefined \else + \MakeRobust\normalsize +\fi +% \end{macrocode} +% \end{macro} +% +% WORD 中的字号对应该关系如下(1bp = 72.27/72 pt): +% \begin{center} +% \begin{longtable}{llll} +% \toprule +% 初号 & 42bp & 14.82mm & 42.1575pt \\ +% 小初 & 36bp & 12.70mm & 36.135 pt \\ +% 一号 & 26bp & 9.17mm & 26.0975pt \\ +% 小一 & 24bp & 8.47mm & 24.09pt \\ +% 二号 & 22bp & 7.76mm & 22.0825pt \\ +% 小二 & 18bp & 6.35mm & 18.0675pt \\ +% 三号 & 16bp & 5.64mm & 16.06pt \\ +% 小三 & 15bp & 5.29mm & 15.05625pt \\ +% 四号 & 14bp & 4.94mm & 14.0525pt \\ +% 小四 & 12bp & 4.23mm & 12.045pt \\ +% 五号 & 10.5bp & 3.70mm & 10.59375pt \\ +% 小五 & 9bp & 3.18mm & 9.03375pt \\ +% 六号 & 7.5bp & 2.56mm & \\ +% 小六 & 6.5bp & 2.29mm & \\ +% 七号 & 5.5bp & 1.94mm & \\ +% 八号 & 5bp & 1.76mm & \\\bottomrule +% \end{longtable} +% \end{center} +% +% \begin{macro}{\thu@def@fontsize} +% 根据习惯定义字号。用法: +% +% \cs{thu@def@fontsize}\marg{字号名称}\marg{磅数} +% +% 避免了字号选择和行距的紧耦合。所有字号定义时为单倍行距,并提供选项指定行距倍数。 +% \begin{macrocode} +\def\thu@def@fontsize#1#2{% + \expandafter\newcommand\csname #1\endcsname[1][1.3]{% + \fontsize{#2}{##1\dimexpr #2}\selectfont}} +% \end{macrocode} +% \end{macro} +% +% 一组字号定义。 +% \begin{macrocode} +\thu@def@fontsize{chuhao}{42bp} +\thu@def@fontsize{xiaochu}{36bp} +\thu@def@fontsize{yihao}{26bp} +\thu@def@fontsize{xiaoyi}{24bp} +\thu@def@fontsize{erhao}{22bp} +\thu@def@fontsize{xiaoer}{18bp} +\thu@def@fontsize{sanhao}{16bp} +\thu@def@fontsize{xiaosan}{15bp} +\thu@def@fontsize{sihao}{14bp} +\thu@def@fontsize{xiaosi}{12bp} +\thu@def@fontsize{wuhao}{10.5bp} +\thu@def@fontsize{xiaowu}{9bp} +\thu@def@fontsize{liuhao}{7.5bp} +\thu@def@fontsize{xiaoliu}{6.5bp} +\thu@def@fontsize{qihao}{5.5bp} +\thu@def@fontsize{bahao}{5bp} +% \end{macrocode} +% +% 检测系统。 +% \begin{macrocode} +\ifthu@system@auto + \IfFileExists{/System/Library/Fonts/Menlo.ttc}{ + \thusetup{system = mac} + }{ + \IfFileExists{/dev/null}{ + \IfFileExists{null:}{ + \thusetup{system = windows} + }{ + \thusetup{system = unix} + } + }{ + \thusetup{system = windows} + } + } + \thu@debug{Detected system: \thu@system} +\fi +% \end{macrocode} +% +% 使用 \pkg{fontspec} 配置字体。 +% \begin{macrocode} +\newcommand\thu@mac@word@font@dir{% + /Applications/Microsoft Word.app/Contents/Resources/DFonts% +} +\ifthu@fontset@auto + \ifthu@system@windows + \thusetup{fontset = windows} + \else + \IfFontExistsTF{SimSun}{ + \thusetup{fontset = windows} + }{ + \IfFileExists{\thu@windows@font@dir/Simsun.ttc}{ + \thusetup{fontset = windows, cjk-font = windows-local} + }{ + \IfFileExists{\thu@mac@word@font@dir/Simsun.ttc}{ + \thusetup{fontset = windows, cjk-font = mac-word} + }{ + \ifthu@system@mac + \thusetup{fontset = mac} + \else + \IfFontExistsTF{Noto Serif CJK SC}{ + \thusetup{fontset = ubuntu} + }{ + \thusetup{fontset = fandol} + } + \fi + } + } + } + \fi + \thu@debug{Detected fontset: \thu@fontset} +\fi +% \end{macrocode} +% +% \subsubsection{西文字体} +% +% 《指南》要求西文字体使用 Times New Roman 和 Arial, +% 但是在 Linux 下没有这两个字体,所以使用它们的克隆版 TeX Gyre Termes 和 +% TeX Gyre Heros。 +% \begin{macrocode} +\newcommand\thu@set@font{% + \@nameuse{thu@set@font@\thu@font}% +} +\thu@option@hook{font}{\thu@set@font} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\thu@set@font@auto{% + \ifthu@font@auto + \ifthu@fontset@windows + \thusetup{font=times}% + \else + \ifthu@fontset@mac + \thusetup{font=times}% + \else + \thusetup{font=termes}% + \fi + \fi + \fi +} +\thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@font@auto}} +\AtBeginOfPackageFile*{siunitx}{\thu@set@font@auto} +\AtEndPreamble{\thu@set@font@auto} +% \end{macrocode} +% +% Times New Roman + Arial +% \begin{macrocode} +\newcommand\thu@set@font@times{% + \setmainfont{Times New Roman}% + \setsansfont{Arial}% + \ifthu@fontset@mac + \setmonofont{Menlo}[Scale = MatchLowercase]% + \else + \setmonofont{Courier New}[Scale = MatchLowercase]% + \fi +} +% \end{macrocode} +% +% TeX Gyre Termes +% \begin{macrocode} +\newcommand\thu@set@font@termes{% + \setmainfont{texgyretermes}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \thu@set@texgyre@sans@mono +} +\newcommand\thu@set@texgyre@sans@mono{% + \setsansfont{texgyreheros}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \setmonofont{texgyrecursor}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Scale = MatchLowercase, + Ligatures = CommonOff, + ]% +} +% \end{macrocode} +% +% STIX Two 字体。 +% STIX 文件名在 v2.10 2020-12-19 从 +% \file{STIX2Text-Regular.otf}、\file{STIX2Math.otf} 分别改为 +% \file{STIXTwoText-Regular.otf}、\file{STIXTwoMath-Regular.otf}。 +% \begin{macrocode} +\let\thu@font@family@stix\@empty +\newcommand\thu@set@stix@names{% + \ifx\thu@font@family@stix\@empty + \IfFontExistsTF{STIXTwoText-Regular.otf}{% + \gdef\thu@font@family@stix{STIXTwoText}% + \gdef\thu@font@name@stix@math{STIXTwoMath-Regular}% + }{% + \gdef\thu@font@family@stix{STIX2Text}% + \gdef\thu@font@name@stix@math{STIX2Math}% + }% + \fi +} +\newcommand\thu@set@font@stix{% + \thu@set@stix@names + \setmainfont{\thu@font@family@stix}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic, + ]% + \thu@set@texgyre@sans@mono +} +% \end{macrocode} +% +% XITS 字体。 +% XITS 的文件名在 v1.109 2018-09-30 +% 从 \file{xits-regular.otf}、\file{xits-math.otf} 分别改为 +% \file{XITS-Regular.otf}、\file{XITSMath-Regular.otf}。 +% \begin{macrocode} +\let\thu@font@family@xits\@empty +\newcommand\thu@set@xits@names{% + \ifx\thu@font@family@xits\@empty + \IfFontExistsTF{XITSMath-Regular.otf}{% + \gdef\thu@font@family@xits{XITS}% + \gdef\thu@font@style@xits@rm{Regular}% + \gdef\thu@font@style@xits@bf{Bold}% + \gdef\thu@font@style@xits@it{Italic}% + \gdef\thu@font@style@xits@bfit{BoldItalic}% + \gdef\thu@font@name@xits@math{XITSMath-Regular}% + }{% + \gdef\thu@font@family@xits{xits}% + \gdef\thu@font@style@xits@rm{regular}% + \gdef\thu@font@style@xits@bf{bold}% + \gdef\thu@font@style@xits@it{italic}% + \gdef\thu@font@style@xits@bfit{bolditalic}% + \gdef\thu@font@name@xits@math{xits-math}% + }% + \fi +} +\newcommand\thu@set@font@xits{% + \thu@set@xits@names + \setmainfont{\thu@font@family@xits}[ + Extension = .otf, + UprightFont = *-\thu@font@style@xits@rm, + BoldFont = *-\thu@font@style@xits@bf, + ItalicFont = *-\thu@font@style@xits@it, + BoldItalicFont = *-\thu@font@style@xits@bfit, + ]% + \thu@set@texgyre@sans@mono +} +% \end{macrocode} +% +% Libertinus 字体。 +% Libertinus 的文件名在 v6.7 2019-04-03 从小写改为驼峰式, +% 在大小写敏感的平台上需要进行判断。 +% \begin{macrocode} +\let\thu@font@family@libertinus\@empty +\newcommand\thu@set@libertinus@names{% + \ifx\thu@font@family@libertinus\@empty + \IfFontExistsTF{LibertinusSerif-Regular.otf}{% + \gdef\thu@font@family@libertinus@serif{LibertinusSerif}% + \gdef\thu@font@family@libertinus@sans{LibertinusSans}% + \gdef\thu@font@name@libertinus@math{LibertinusMath-Regular}% + \gdef\thu@font@style@libertinus@rm{Regular}% + \gdef\thu@font@style@libertinus@bf{Bold}% + \gdef\thu@font@style@libertinus@it{Italic}% + \gdef\thu@font@style@libertinus@bfit{BoldItalic}% + }{% + \gdef\thu@font@family@libertinus@serif{libertinusserif}% + \gdef\thu@font@family@libertinus@sans{libertinussans}% + \gdef\thu@font@name@libertinus@math{libertinusmath-regular}% + \gdef\thu@font@style@libertinus@rm{regular}% + \gdef\thu@font@style@libertinus@bf{bold}% + \gdef\thu@font@style@libertinus@it{italic}% + \gdef\thu@font@style@libertinus@bfit{bolditalic}% + }% + \fi +} +\newcommand\thu@set@font@libertinus{% + \thu@set@libertinus@names + \setmainfont{\thu@font@family@libertinus@serif}[ + Extension = .otf, + UprightFont = *-\thu@font@style@libertinus@rm, + BoldFont = *-\thu@font@style@libertinus@bf, + ItalicFont = *-\thu@font@style@libertinus@it, + BoldItalicFont = *-\thu@font@style@libertinus@bfit, + ]% + \setsansfont{\thu@font@family@libertinus@sans}[ + Extension = .otf, + UprightFont = *-\thu@font@style@libertinus@rm, + BoldFont = *-\thu@font@style@libertinus@bf, + ItalicFont = *-\thu@font@style@libertinus@it, + ]% + \setmonofont{lmmonolt10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% +} +% \end{macrocode} +% +% New Computer Modern +% \begin{macrocode} +\newcommand\thu@set@font@newcm{% + \setmainfont{NewCM10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookItalic, + BoldItalicFont = *-BoldItalic, + ]% + \setsansfont{NewCMSans10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookOblique, + BoldItalicFont = *-BoldOblique, + ]% + \setmonofont{NewCMMono10}[ + Extension = .otf, + UprightFont = *-Book, + ItalicFont = *-BookItalic, + BoldFont = *-Bold, + BoldItalicFont = *-BoldOblique, + ]% +} +% \end{macrocode} +% +% Latin Modern +% \begin{macrocode} +\newcommand\thu@set@font@lm{% + \setmainfont{lmroman10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \setsansfont{lmsans10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% + \setmonofont{lmmonolt10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% +} +% \end{macrocode} +% +% NewTX +% \begin{macrocode} +\newcommand\thu@set@font@newtx{% + \RequirePackage{newtxtext}% +} +% \end{macrocode} +% +% \subsubsection{中文字体} +% +% \begin{macrocode} +\ifthu@cjk@font@auto + \ifthu@fontset@mac + \thusetup{cjk-font = mac} + \else + \ifthu@fontset@windows + \IfFontExistsTF{SimSun}{ + \thusetup{cjk-font = windows} + }{ + \IfFileExists{\thu@windows@font@dir/Simsun.ttc}{ + \thusetup{cjk-font = windows-local} + }{ + \IfFileExists{\thu@mac@word@font@dir/Simsun.ttc}{ + \thusetup{cjk-font = mac-word} + }{ + \thu@error{Cannot find "SimSun" font} + } + } + } + \else + \ifthu@fontset@ubuntu + \thusetup{cjk-font = noto} + \else + \thusetup{cjk-font = fandol} + \fi + \fi + \fi + \thu@debug{Detected CJK font: \thu@cjk@font} +\fi +% \end{macrocode} +% +% Windows 的中易字体。 +% \begin{macrocode} +\newcommand\thu@set@cjk@font@windows{% + \setCJKmainfont{SimSun}[ + AutoFakeBold = 3, + ItalicFont = KaiTi, + ]% + \setCJKsansfont{SimHei}[AutoFakeBold = 3]% + \setCJKmonofont{FangSong}% + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold = 3]% + \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold = 3]% + \setCJKfamilyfont{zhkai}{KaiTi}% + \setCJKfamilyfont{zhfs}{FangSong}% +} +% \end{macrocode} +% +% 使用本地的 Windows 字体文件。 +% +% Windows 的中易楷体和仿宋字体文件名分别为 \file{Simkai.ttf} 和 +% \file{Simfang.ttf}(见 +% \url{https://learn.microsoft.com/en-us/typography/fonts/windows_11_font_list}), +% 而 macOS 版 Word 对应的字体名为 \file{Kaiti.ttf} 和 \file{Fangsong.ttf}。 +% 所以需要进行判断。 +% \begin{macrocode} +\@namedef{thu@set@cjk@font@windows-local}{% + \IfFileExists{\thu@windows@font@dir/Kaiti.ttf}{ + \setCJKmainfont{SimSun}[% + Path = \thu@windows@font@dir/, + Extension = .ttc, + AutoFakeBold = 3, + ItalicFont = Kaiti, + ItalicFeatures = {Extension = .ttf}, + ]% + \setCJKmonofont{Fangsong}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhkai}{Kaiti}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhfs}{Fangsong}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + }{ + \setCJKmainfont{SimSun}[% + Path = \thu@windows@font@dir/, + Extension = .ttc, + AutoFakeBold = 3, + ItalicFont = Simkai, + ItalicFeatures = {Extension = .ttf}, + ]% + \setCJKmonofont{Simfang}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhkai}{Simkai}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + \setCJKfamilyfont{zhfs}{Simfang}[ + Path = \thu@windows@font@dir/, + Extension = .ttf, + ]% + } + \setCJKsansfont{SimHei}[% + Path = \thu@windows@font@dir/, + Extension = .ttf, + AutoFakeBold = 3, + ]% + \setCJKfamilyfont{zhsong}{SimSun}[% + Path = \thu@windows@font@dir/, + Extension = .ttc, + AutoFakeBold = 3, + ]% + \setCJKfamilyfont{zhhei}{SimHei}[% + Path = \thu@windows@font@dir/, + Extension = .ttf, + AutoFakeBold = 3, + ]% +} +% \end{macrocode} +% +% macOS 的 Microsoft Word 字体。 +% \begin{macrocode} +\@namedef{thu@set@cjk@font@mac-word}{% + \let\thu@windows@font@dir\thu@mac@word@font@dir + \@nameuse{thu@set@cjk@font@windows-local}% +} +% \end{macrocode} +% +% macOS 的华文字体。 +% \begin{macrocode} +\newcommand\thu@set@cjk@font@mac{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{Songti SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ItalicFont = Kaiti SC Regular, + BoldItalicFont = Kaiti SC Bold, + ]% + \setCJKsansfont{Heiti SC}[ + UprightFont = * Light, + BoldFont = * Medium, + ]% + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ]% + \setCJKfamilyfont{zhhei}{Heiti SC}[ + UprightFont = * Light, + BoldFont = * Medium, + ]% + \setCJKfamilyfont{zhfs}{STFangsong}% + \setCJKfamilyfont{zhkai}{Kaiti SC}[ + UprightFont = * Regular, + BoldFont = * Bold, + ]% + \setCJKfamilyfont{zhli}{Baoli SC}% + \setCJKfamilyfont{zhyuan}{Yuanyi SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ]% +} +% \end{macrocode} +% +% 思源字体。 +% 注意 Noto CJK 的 regular 字重名字不带“Regular”。 +% \begin{macrocode} +\newcommand\thu@set@cjk@font@noto{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{Noto Serif CJK SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ItalicFont = FandolKai-Regular, + ItalicFeatures = {Extension = .otf}, + Script = CJK, + ]% + \setCJKsansfont{Noto Sans CJK SC}[ + BoldFont = * Medium, + Script = CJK, + ]% + \setCJKmonofont{Noto Sans Mono CJK SC}[ + Script = CJK, + ]% + \setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[ + UprightFont = * Light, + UprightFont = * Bold, + Script = CJK, + ]% + \setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[ + BoldFont = * Medium, + Script = CJK, + ]% + \setCJKfamilyfont{zhfs}{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhkai}{FandolKai}[ + Extension = .otf, + UprightFont = *-Regular, + ]% +} +% \end{macrocode} +% +% Fandol 字体。 +% \begin{macrocode} +\newcommand\thu@set@cjk@font@fandol{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{FandolSong}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = FandolKai-Regular, + ItalicFeatures = {Extension = .otf}, + ]% + \setCJKsansfont{FandolHei}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKmonofont{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhsong}{FandolSong}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKfamilyfont{zhhei}{FandolHei}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKfamilyfont{zhfs}{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhkai}{FandolKai}[ + Extension = .otf, + UprightFont = *-Regular, + ]% +} +\ifthu@cjk@font@none\else + \providecommand\songti{\CJKfamily{zhsong}} + \providecommand\heiti{\CJKfamily{zhhei}} + \providecommand\fangsong{\CJKfamily{zhfs}} + \providecommand\kaishu{\CJKfamily{zhkai}} +\fi +\newcommand\thu@set@cjk@font{% + \@nameuse{thu@set@cjk@font@\thu@cjk@font}% +} +\thu@set@cjk@font +\thu@option@hook{cjk-font}{\thu@set@cjk@font} +% \end{macrocode} +% +% \subsubsection{数学字体} +% +% 使用 \pkg{unicode-math} 配置数学符号格式。 +% \begin{macrocode} +\newcommand\thu@set@math@style{% + \ifthu@math@style@TeX + \thusetup{ + uppercase-greek = upright, + less-than-or-equal = horizontal, + integral = slanted, + integral-limits = false, + partial = italic, + math-ellipsis = AMS, + real-part = fraktur, + }% + \else + \thusetup{ + uppercase-greek = italic, + integral = upright, + partial = upright, + real-part = roman, + }% + \ifthu@math@style@ISO + \thusetup{ + less-than-or-equal = horizontal, + integral-limits = true, + math-ellipsis = lower, + }% + \else + \ifthu@math@style@GB + \thusetup{ + less-than-or-equal = slanted, + integral-limits = false, + math-ellipsis = centered, + }% + \fi + \fi + \fi +} +\ifthu@main@language@chinese + \thusetup{math-style=GB}% +\else + \thusetup{math-style=TeX}% +\fi +\thu@set@math@style +\thu@option@hook{math-style}{\thu@set@math@style} +\thu@option@hook{main-language}{% + \ifthu@main@language@chinese + \thusetup{math-style=GB}% + \else + \thusetup{math-style=TeX}% + \fi +} +% \end{macrocode} +% +% 针对 \pkg{unicode-math} 逐项配置数学符号。 +% \begin{macrocode} +\newcommand\thu@set@unimath@leq{% + \ifthu@leq@horizontal + \ifx\@begindocumenthook\@undefined + \let\le\thu@save@leq + \let\ge\thu@save@geq + \let\leq\thu@save@leq + \let\geq\thu@save@geq + \else + \AtBeginDocument{% + \let\le\thu@save@leq + \let\ge\thu@save@geq + \let\leq\thu@save@leq + \let\geq\thu@save@geq + }% + \fi + \else + \ifthu@leq@slanted + \ifx\@begindocumenthook\@undefined + \let\le\leqslant + \let\ge\geqslant + \let\leq\leqslant + \let\geq\geqslant + \else + \AtBeginDocument{% + \let\le\leqslant + \let\ge\geqslant + \let\leq\leqslant + \let\geq\geqslant + }% + \fi + \fi + \fi +} +\newcommand\thu@set@unimath@integral@limits{% + \ifthu@integral@limits@true + \removenolimits{% + \int\iint\iiint\iiiint\oint\oiint\oiiint + \intclockwise\varointclockwise\ointctrclockwise\sumint + \intbar\intBar\fint\cirfnint\awint\rppolint + \scpolint\npolint\pointint\sqint\intlarhk\intx + \intcap\intcup\upint\lowint + }% + \else + \addnolimits{% + \int\iint\iiint\iiiint\oint\oiint\oiiint + \intclockwise\varointclockwise\ointctrclockwise\sumint + \intbar\intBar\fint\cirfnint\awint\rppolint + \scpolint\npolint\pointint\sqint\intlarhk\intx + \intcap\intcup\upint\lowint + }% + \fi +} +\newcommand\thu@set@unimath@ellipsis{% + \ifthu@math@ellipsis@centered + \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}% + \else + \DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}% + \fi +} +\newcommand\thu@set@unimath@real@part{% + \ifthu@real@part@roman + \AtBeginDocument{% + \def\Re{\operatorname{Re}}% + \def\Im{\operatorname{Im}}% + }% + \else + \AtBeginDocument{% + \let\Re\thu@save@Re + \let\Im\thu@save@Im + }% + \fi +} +\newcommand\thu@set@unimath@style{% + \ifthu@uppercase@greek@upright + \unimathsetup{math-style = TeX}% + \else + \ifthu@uppercase@greek@italic + \unimathsetup{math-style = ISO}% + \fi + \fi + \ifthu@math@style@TeX + \unimathsetup{bold-style = TeX}% + \else + \unimathsetup{bold-style = ISO}% + \fi + \thu@set@unimath@leq + \thu@set@unimath@integral@limits + \ifthu@partial@upright + \unimathsetup{partial = upright}% + \else + \ifthu@partial@italic + \unimathsetup{partial = italic}% + \fi + \fi + \thu@set@unimath@ellipsis + \thu@set@unimath@real@part +} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\thu@qed{\rule{1ex}{1ex}} +\newcommand\thu@load@unimath{% + \@ifpackageloaded{unicode-math}{}{% + \RequirePackage{unicode-math}% + \AtBeginDocument{% + \let\thu@save@leq\leq + \let\thu@save@geq\geq + \let\thu@save@Re\Re + \let\thu@save@Im\Im + }% +% \end{macrocode} +% +% 兼容旧的粗体命令:\pkg{bm} 的 \cs{bm} 和 \pkg{amsmath} 的 \cs{boldsymbol}。 +% \begin{macrocode} + \DeclareRobustCommand\bm[1]{{\symbfit{##1}}}% + \DeclareRobustCommand\boldsymbol[1]{{\symbfit{##1}}}% +% \end{macrocode} +% +% 兼容 \pkg{amsfonts} 和 \pkg{amssymb} 中的一些命令。 +% \begin{macrocode} + \newcommand\square{\mdlgwhtsquare}% + \newcommand\blacksquare{\mdlgblksquare}% + \AtBeginDocument{% + \renewcommand\checkmark{\ensuremath{\symbol{"2713}}}% + }% +% \end{macrocode} +% +% 兼容 \pkg{amsthm} 的 \cs{qedsymbol}。 +% \begin{macrocode} + \renewcommand\thu@qed{\ensuremath{\QED}}% + }% +} +% \end{macrocode} +% +% STIX Two Math +% \begin{macrocode} +\newcommand\thu@set@math@font@stix{% + \thu@set@stix@names + \setmathfont{\thu@font@name@stix@math}[ + Extension = .otf, + Scale = MatchLowercase, + StylisticSet = \thu@xits@integral@stylistic@set, + ]% + \setmathfont{\thu@font@name@stix@math}[ + Extension = .otf, + Scale = MatchLowercase, + StylisticSet = 1, + range = {scr,bfscr}, + ]% +} +% \end{macrocode} +% +% XITS Math +% \begin{macrocode} +\newcommand\thu@xits@integral@stylistic@set{% + \ifthu@integral@upright + 8% + \fi +} +\newcommand\thu@set@math@font@xits{% + \thu@set@xits@names + \setmathfont{\thu@font@name@xits@math}[ + Extension = .otf, + StylisticSet = \thu@xits@integral@stylistic@set, + ]% + \setmathfont{\thu@font@name@xits@math}[ + Extension = .otf, + StylisticSet = 1, + range = {cal,bfcal}, + ]% +} +% \end{macrocode} +% +% Libertinus Math +% \begin{macrocode} +\newcommand\thu@libertinus@integral@stylistic@set{% + \ifthu@integral@slanted + 8% + \fi +} +\newcommand\thu@set@math@font@libertinus{% + \thu@set@libertinus@names + \setmathfont{\thu@font@name@libertinus@math}[ + Extension = .otf, + StylisticSet = \thu@libertinus@integral@stylistic@set, + ]% +} +% \end{macrocode} +% +% New Computer Modern Math +% \begin{macrocode} +\newcommand\thu@newcm@integral@stylistic@set{% + \ifthu@integral@upright + 2% + \fi +} +\newcommand\thu@set@math@font@newcm{% + \setmathfont{NewCMMath-Book}[ + Extension = .otf, + StylisticSet = \thu@newcm@integral@stylistic@set, + ]% + \setmathfont{NewCMMath-Book}[ + Extension = .otf, + StylisticSet = 1, + range = {scr,bfscr}, + ]% + \setmathrm{NewCM10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookItalic, + BoldItalicFont = *-BoldItalic, + ]% + \setmathsf{NewCMSans10}[ + Extension = .otf, + UprightFont = *-Book, + BoldFont = *-Bold, + ItalicFont = *-BookOblique, + BoldItalicFont = *-BoldOblique, + ]% + \setmathtt{NewCMMono10}[ + Extension = .otf, + UprightFont = *-Book, + ItalicFont = *-BookItalic, + BoldFont = *-Bold, + BoldItalicFont = *-BoldOblique, + ]% +} +% \end{macrocode} +% +% Latin Modern Math +% \begin{macrocode} +\newcommand\thu@set@math@font@lm{% + \setmathfont{latinmodern-math}[Extension=.otf]% + \setmathrm{lmroman10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]% + \setmathsf{lmsans10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% + \setmathtt{lmmonolt10}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique, + ]% +} +% \end{macrocode} +% +% NewTX Math +% \begin{macrocode} +\newcommand\thu@set@math@font@newtx{% + \ifthu@font@newtx\else + \let\thu@save@encodingdefault\encodingdefault + \let\thu@save@rmdefault\rmdefault + \let\thu@save@sfdefault\sfdefault + \let\thu@save@ttdefault\ttdefault + \RequirePackage[T1]{fontenc}% + \renewcommand{\rmdefault}{ntxtlf}% + \renewcommand{\sfdefault}{qhv}% + \renewcommand{\ttdefault}{ntxtt}% + \fi + \ifthu@uppercase@greek@italic + \PassOptionsToPackage{slantedGreek}{newtxmath}% + \fi + \ifthu@integral@upright + \PassOptionsToPackage{upint}{newtxmath}% + \fi + \RequirePackage{newtxmath}% + \let\thu@save@leq\leq + \let\thu@save@geq\geq + \ifthu@leq@slanted + \let\le\leqslant + \let\ge\geqslant + \let\leq\leqslant + \let\geq\geqslant + \fi + \ifthu@integral@limits@true + \let\ilimits@\displaylimits + \fi + \let\thu@save@partial\partial + \ifthu@partial@upright + \let\partial\uppartial + \fi + \ifthu@math@ellipsis@centered + \DeclareRobustCommand\mathellipsis{\mathinner{\cdotp\cdotp\cdotp}}% + \else + \DeclareRobustCommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}% + \fi + \let\thu@save@Re\Re + \let\thu@save@Im\Im + \ifthu@real@part@roman + \def\Re{\operatorname{Re}}% + \def\Im{\operatorname{Im}}% + \fi + \RequirePackage{bm}% + \ifthu@font@newtx\else + \let\encodingdefault\thu@save@encodingdefault + \let\rmdefault\thu@save@rmdefault + \let\sfdefault\thu@save@sfdefault + \let\ttdefault\thu@save@ttdefault + \fi + \DeclareRobustCommand\symup[1]{{\mathrm{##1}}}% + \DeclareRobustCommand\symbf[1]{{\bm{##1}}}% + \DeclareRobustCommand\symbfsf[1]{{\bm{\mathsf{##1}}}}% + \let\increment\upDelta% + \renewcommand\thu@qed{\openbox}% +} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\thu@set@math@font{% + \ifthu@math@font@none\else + \ifthu@math@font@newtx + \thu@set@math@font@newtx + \else + \thu@load@unimath + \thu@set@unimath@style + \@nameuse{thu@set@math@font@\thu@math@font}% + \fi + \fi +} +\thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@math@font}} +\newcommand\thu@set@math@font@auto{% + \ifthu@math@font@auto + \thusetup{math-font=xits}% + \fi +} +\AtBeginOfPackageFile*{siunitx}{\thu@set@math@font@auto} +\AtEndPreamble{\thu@set@math@font@auto} +% \end{macrocode} +% +% +% \subsection{主文档格式} +% \label{sec:mainbody} +% +% \subsubsection{Three matters} +% \begin{macro}{\cleardoublepage} +% 对于 \textsl{openright} 选项,必须保证章首页右开,且如果前章末页无内容须 +% 清空其页眉页脚。 +% \begin{macrocode} +\def\cleardoublepage{% + \clearpage + \if@twoside + \ifthu@output@print + \ifodd\c@page + \else + \thispagestyle{empty}% + \hbox{}% + \newpage + \if@twocolumn + \hbox{}\newpage + \fi + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frontmatter} +% \begin{macro}{\mainmatter} +% \begin{macro}{\backmatter} +% 我们的单面和双面模式与常规的不太一样。 +% \begin{macrocode} +\renewcommand\frontmatter{% + \cleardoublepage + \@mainmatterfalse + \pagenumbering{Roman}% +} +\renewcommand\mainmatter{% + \cleardoublepage + \@mainmattertrue + \pagenumbering{arabic}% +} +\renewcommand\backmatter{% + \clearpage + \@mainmatterfalse + \thusetup{toc-depth = 0}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{页眉页脚} +% \label{sec:headerfooter} +% +% \pkg{fancyhdr} 定义页眉页脚很方便,但是有一个非常隐蔽的坑。 +% 第一次调用 \pkg{fancyhdr} 定义的样式时会修改 \cs{chaptermark}, +% 这会导致页眉信息错误(多余章号并且英文大写)。 +% 这是因为在 \cs{ps@fancy} 中对 \cs{chaptermark} 进行重定义, +% 所以我们先调用 \cs{ps@fancy},再修改 \cs{chaptermark}。 +% \begin{macrocode} +\pagestyle{fancy} +% \end{macrocode} +% +% 定义页眉和页脚。 +% 研究生要求: +% 页眉宋体五号字,宋体五号字居中书写; +% 页码五号 Times New Roman 体。 +% +% 本科生要求: +% 页眉:无; +% 页码:位于页面底端,居中书写。 +% +% 本科外文专业要求页码字号 12pt。 +% \begin{macrocode} +\fancypagestyle{plain}{% + \fancyhf{}% + \renewcommand\footrulewidth{0pt}% + \ifthu@degree@bachelor + \renewcommand\headrulewidth{0pt}% + \fancyfoot[C]{ + \ifthu@main@language@chinese + \fontsize{10.5bp}{12.075bp}\selectfont + \else + \normalsize + \fi + \thepage + }% + \let\@mkboth\@gobbletwo + \let\chaptermark\@gobble + \else + \renewcommand\headrulewidth{0.75bp}% + \fancyhead[C]{% + \wuhao + \ifthu@main@language@chinese + \leftmark + \else + \MakeUppercase{\leftmark}% + \fi + }% + \fancyfoot[C]{\wuhao\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markboth{% + \CTEXifname{% + \CTEXthechapter + \ifthu@main@language@chinese + \quad + \else + \space + \fi + }{}##1% + }{}% + }% + \fi + \let\sectionmark\@gobble +} +\pagestyle{plain} +% \end{macrocode} +% +% \cs{chapter} 会调用特殊的 page style。 +% \begin{macrocode} +\def\ps@chapter{} +\ctexset{chapter/pagestyle = chapter} +% \end{macrocode} +% +% +% \subsubsection{段落} +% \label{sec:paragraph} +% +% 全文首行缩进 2 字符,标点符号用全角 +% \begin{macrocode} +\ctexset{% + punct=quanjiao, +} +\newcommand\thu@set@indent{% + \ifthu@main@language@chinese + \ctexset{autoindent=2}% + \else + \ifthu@degree@bachelor + \ctexset{autoindent=0.8cm}% + \else + \ctexset{autoindent=0.74cm}% + \fi + \fi +} +\thu@set@indent +\thu@option@hook{degree}{\thu@set@indent} +\thu@option@hook{main-language}{\thu@set@indent} +% \end{macrocode} +% +% 设置 url 样式,与上下文一致 +% \begin{macrocode} +\urlstyle{same} +% \end{macrocode} +% +% 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。 +% \begin{macrocode} +\g@addto@macro\UrlBreaks{% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9% + \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M + \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m + \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z +} +\Urlmuskip=0mu plus 0.1mu +% \end{macrocode} +% +% 取消列表的间距,以符合中文习惯。 +% \begin{macrocode} +\partopsep=\z@skip +\def\@listi{\leftmargin\leftmargini + \parsep \z@skip + \topsep \z@skip + \itemsep\z@skip} +\let\@listI\@listi +\@listi +\def\@listii {\leftmargin\leftmarginii + \labelwidth\leftmarginii + \advance\labelwidth-\labelsep + \topsep \z@skip + \parsep \z@skip + \itemsep \z@skip} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii + \advance\labelwidth-\labelsep + \topsep \z@skip + \parsep \z@skip + \partopsep \z@skip + \itemsep \z@skip} +% \end{macrocode} +% +% 使用 \pkg{enumitem} 命令调整默认列表环境间的距离, +% \begin{macrocode} +\setlist{nosep} +% \end{macrocode} +% +% +% \subsubsection{脚注} +% \label{sec:footnote} +% +% 严格禁止脚注跨页,参考 \href{https://github.com/tuna/thuthesis/issues/778}{\#778} +% 和 \url{https://texfaq.org/FAQ-splitfoot}。 +% \begin{macrocode} +\interfootnotelinepenalty=10000 +% \end{macrocode} +% +% 脚注内容采用小五号字,中文用宋体,英文和数字用 Times New Roman 体按两端对齐格式书写, +% 单倍行距,段前段后均空 0 磅。 +% 脚注的序号按页编排,不同页的脚注序号不需要连续。 +% +% 脚注处序号“1,……,10”的字体是“正文”,不是“上标”,序号与脚注内容文字之间空半个汉字符, +% 脚注的段落格式为:单倍行距,段前空 0 磅,段后空 0 磅,悬挂缩进 1.5 字符; +% 字号为小五号字,汉字用宋体,外文用 Times New Roman 体。 +% +% 苏世民学院的格式与学校不同,全文的脚注都连续编号(包括到附录中),并且不使用带圈数字。 +% \begin{macrocode} +\ifthu@footnote@numbering@global + \@removefromreset{footnote}{chapter}% +\fi +% \end{macrocode} +% +% 脚注序号使用带圈数字。 +% \begin{macro}{\thu@circled} +% 生成带圈的脚注数字,最多处理到 10。 +% \begin{macrocode} +\newcommand\thu@circled[1]{% + \ifnum#1 >10\relax + \thu@warning{% + Too many footnotes in this page. + Keep footnote less than 10% + }% + \fi + {\symbol{\the\numexpr#1+"245F\relax}}% +} +\ifthu@footnote@style@circled + \renewcommand{\thefootnote}{\thu@circled{\c@footnote}}% + \renewcommand{\thempfootnote}{\thu@circled{\c@mpfootnote}}% +\else + \renewcommand{\thefootnote}{\arabic{footnote}}% + \renewcommand{\thempfootnote}{\arabic{mpfootnote}}% +\fi +% \end{macrocode} +% \end{macro} +% +% 定义脚注分割线,字号(宋体小五),以及悬挂缩进(1.5字符)。 +% \begin{macrocode} +\def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@} +\footnotemargin=13.5bp +% \end{macrocode} +% +% 修改 \pkg{footmisc} 定义的脚注格式。 +% \begin{macrocode} +\long\def\@makefntext#1{% + \begingroup + % 序号取消上标 + \def\@makefnmark{\hbox{\normalfont\@thefnmark}}% + \xiaowu + \ifFN@hangfoot + \bgroup + \setbox\@tempboxa\hbox{% + \ifdim\footnotemargin>\z@ + \hb@xt@\footnotemargin{\@makefnmark\hss}% + \else + \@makefnmark + \fi + }% + \leftmargin\wd\@tempboxa + \rightmargin\z@ + \linewidth \columnwidth + \advance \linewidth -\leftmargin + \parshape \@ne \leftmargin \linewidth + % \footnotesize + \xiaowu + \@setpar{{\@@par}}% + \leavevmode + \llap{\box\@tempboxa}% + \parskip\hangfootparskip\relax + \parindent\hangfootparindent\relax + \else + \parindent1em% + \noindent + \ifdim\footnotemargin>\z@ + \hb@xt@ \footnotemargin{\hss\@makefnmark}% + \else + \ifdim\footnotemargin=\z@ + \llap{\@makefnmark}% + \else + \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}}% + \fi + \fi + \fi + \footnotelayout#1% + \ifFN@hangfoot + \par\egroup + \fi + \endgroup +} +% \end{macrocode} +% +% +% \subsubsection{数学相关} +% \label{sec:equation} +% 允许太长的公式断行、分页等。 +% \begin{macrocode} +\allowdisplaybreaks[4] +% \end{macrocode} +% +% 公式距前后文的距离由 4 个参数控制,参见 \cs{normalsize} 的定义。 +% +% 中文模板的公式编号使用中文括号。需要修改 \pkg{amsmath} 的 \cs{tagform@}。 +% 其中 |\kern 0pt| 防止中文左括号与前面文字的距离过窄。 +% \begin{macrocode} +\newcommand\thu@put@parentheses[1]{% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \kern 0pt\relax + (#1)% + \else + (#1)% + \fi + \else + (#1)% + \fi +} +% \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} +\def\tagform@#1{% + \maketag@@@{\thu@put@parentheses{\ignorespaces#1\unskip\@@italiccorr}}% +} +% \end{macrocode} +% +% 重定义 \cs{eqref},其中 \cs{unskip} 是为了“|式~\eqref|”这样的写法不产生额外的空格。 +% \begin{macrocode} +% \DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}} +\DeclareRobustCommand{\eqref}[1]{% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \unskip + \fi + \fi + \textup{\tagform@{\ref{#1}}}% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \ignorespaces + \fi + \fi +} +% \end{macrocode} +% +% \subsubsection{浮动对象:插图和表格} +% \label{sec:float} +% +% 图表浮动体的默认位置设为 |h|。 +% \begin{macrocode} +\def\fps@figure{htbp} +\def\fps@table{htbp} +% \end{macrocode} +% +% 设置浮动对象和文字之间的距离 +% \begin{macrocode} +\setlength{\floatsep}{12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength{\textfloatsep}{12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength{\intextsep}{12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength{\@fptop}{0bp \@plus1.0fil} +\setlength{\@fpsep}{12bp \@plus2.0fil} +\setlength{\@fpbot}{0bp \@plus1.0fil} +% \end{macrocode} +% +% 由于 LaTeX2e kernel 的问题,图表等浮动体与文字前后的距离不一致,需要进行 patch。 +% 参考 \href{https://github.com/tuna/thuthesis/issues/614}{tuna/thuthesis/issues\#614}、 +% \url{https://www.zhihu.com/question/46618031} 和 +% \url{https://tex.stackexchange.com/a/40363/82731}。 +% \begin{macrocode} +\patchcmd{\@addtocurcol}% + {\vskip \intextsep}% + {\edef\save@first@penalty{\the\lastpenalty}\unpenalty + \ifnum \lastpenalty = \@M % hopefully the OR penalty + \unpenalty + \else + \penalty \save@first@penalty \relax % put it back + \fi + \ifnum\outputpenalty <-\@Mii + \addvspace\intextsep + \vskip\parskip + \else + \addvspace\intextsep + \fi}% + {}{\thu@patch@error{\@addtocurcol}} +\patchcmd{\@addtocurcol}% + {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}% + {\ifnum\outputpenalty <-\@Mii + \aftergroup\vskip\aftergroup\intextsep + \aftergroup\nointerlineskip + \else + \vskip\intextsep + \fi}% + {}{\thu@patch@error{\@addtocurcol}} +\patchcmd{\@getpen}{\@M}{\@Mi} + {}{\thu@patch@error{\@getpen}} +% \end{macrocode} +% +% 将浮动参数设为较宽松的值。 +% \begin{macrocode} +\renewcommand{\textfraction}{0.15} +\renewcommand{\topfraction}{0.85} +\renewcommand{\bottomfraction}{0.65} +\renewcommand{\floatpagefraction}{0.60} +% \end{macrocode} +% +% 允许用户设置图表编号和连接符。 +% \begin{macrocode} +\thu@define@key{ + figure-number-separator = { + name = figure@number@separator, + default = {.}, + }, + table-number-separator = { + name = table@number@separator, + default = {.}, + }, + equation-number-separator = { + name = equation@number@separator, + default = {.}, + }, + number-separator = { + name = number@separator, + default = {.}, + }, +} +\newcommand\thu@set@figure@numbering{% + \ifthu@figure@numbering@chapter + \@addtoreset{figure}{chapter}% + \else + \@removefromreset{figure}{chapter}% + \fi +} +\thu@set@figure@numbering +\thu@option@hook{figure-numbering}{\thu@set@figure@numbering} +\renewcommand\thefigure{% + \ifthu@figure@numbering@chapter + \ifnum\c@chapter>\z@ + \thechapter + \thu@figure@number@separator + \fi + \fi + \@arabic\c@figure +} +\newcommand\thu@set@table@numbering{% + \ifthu@table@numbering@chapter + \@addtoreset{table}{chapter}% + \else + \@removefromreset{table}{chapter}% + \fi +} +\thu@set@table@numbering +\thu@option@hook{table-numbering}{\thu@set@table@numbering} +\renewcommand\thetable{% + \ifthu@table@numbering@chapter + \ifnum\c@chapter>\z@ + \thechapter + \thu@table@number@separator + \fi + \fi + \@arabic\c@table +} +\newcommand\thu@set@equation@numbering{% + \ifthu@equation@numbering@chapter + \@addtoreset{equation}{chapter}% + \else + \@removefromreset{equation}{chapter}% + \fi +} +\thu@set@equation@numbering +\thu@option@hook{equation-numbering}{\thu@set@equation@numbering} +\renewcommand\theequation{% + \ifthu@equation@numbering@chapter + \ifnum\c@chapter>\z@ + \thechapter + \thu@equation@number@separator + \fi + \fi + \@arabic\c@equation +} +\newcommand\thu@set@number@separator{% + \let\thu@figure@number@separator\thu@number@separator + \let\thu@table@number@separator\thu@number@separator + \let\thu@equation@number@separator\thu@number@separator +} +\thu@option@hook{number-separator}{\thu@set@number@separator} +% \end{macrocode} +% +% 定制浮动图形和表格标题样式: +% \begin{itemize} +% \item 图表标题字体为 11pt +% \item 去掉图表号后面的冒号,图序与图名文字之间空一个汉字符宽度 +% \item 图:caption 在下,段前空 6 磅,段后空 12 磅 +% \item 表:caption 在上,段前空 12 磅,段后空 6 磅 +% \end{itemize} +% \begin{macrocode} +\DeclareCaptionFont{thu}{% + \ifthu@degree@bachelor + \fontsize{11bp}{15bp}\selectfont + \else + \ifthu@language@chinese + \fontsize{11bp}{14.3bp}\selectfont + \else + \fontsize{11bp}{12.65bp}\selectfont + \fi + \fi +} +\captionsetup{ + font = thu, + labelsep = quad, + skip = 6bp, + figureposition = bottom, + tableposition = top, +} +\captionsetup[sub]{font=thu} +\renewcommand{\thesubfigure}{(\alph{subfigure})} +\renewcommand{\thesubtable}{(\alph{subtable})} +% \renewcommand{\p@subfigure}{:} +% \end{macrocode} +% +% 研究生要求表单元格中的文字采用 11pt 宋体字,单倍行距。段前空 3 磅,段后空 3 磅。 +% 对于中文,\cs{arraystretch} 需要调整为 $1 + 6 / (11 \times 1.3) \approx 1.42$。 +% 对于英文,\cs{arraystretch} 需要调整为 $1 + 6 / (11 \times 1.15) \approx 1.47$。 +% +% 注意不能简单地把行距设为 $\SI{11}{pt} \times 1.3 + \SI{6}{pt} = \SI{20.3}{pt}$, +% 这会导致含有多行文字的单元格中行距有误。 +% +% 其他浮动体中(比如 \env{algorithm})的字号默认同表格一致。 +% \begin{macrocode} +\newcommand\thu@set@table@font{ + \ifthu@language@chinese + \def\thu@table@font{% + \fontsize{11bp}{14.3bp}\selectfont + \renewcommand\arraystretch{1.42}% + }% + \else + \def\thu@table@font{% + \fontsize{11bp}{12.65bp}\selectfont + \renewcommand\arraystretch{1.47}% + }% + \fi +} +\thu@set@table@font +\thu@option@hook{language}{\thu@set@table@font} +\patchcmd\@floatboxreset{% + \normalsize +}{% + \thu@table@font +}{}{\thu@patch@error{\@floatboxreset}} +% \end{macrocode} +% +% 对 \pkg{longtable} 跨页表格进行相同的设置。 +% +% 在 Word 模板中按照正确的设置(需要去掉文档网格), +% 中文模板每页能装下 1 行标题、1 行表头、30 行表身, +% 英文模板每页能装下 1 行标题、1 行表头、33 行表身。 +% \begin{macrocode} +\AtEndOfPackageFile*{longtable}{ + \AtBeginEnvironment{longtable}{% + \thu@table@font + } +} +% \end{macrocode} +% +% 研究生和本科生都推荐使用三线表,并且要求表的上、下边线为单直线,线粗为 1.5 磅; +% 第三条线为单直线,线粗为 1 磅。 +% 这里设置 \pkg{booktabs} 线粗的默认值。 +% \begin{macrocode} +\heavyrulewidth=1.5bp +\lightrulewidth=1bp +% \end{macrocode} +% +% \begin{macrocode} +\AtEndOfPackageFile*{threeparttable}{ + \g@addto@macro\TPT@defaults{\wuhao} +} +% \end{macrocode} +% +% \subsubsection{章节标题} +% \label{sec:theor} +% \begin{macrocode} +\newcommand{\thu@abstract@name}{摘\quad 要} +\newcommand{\thu@abstract@name@en}{Abstract} +% \end{macrocode} +% +% 各级标题格式设置。 +% \begin{macrocode} +\ctexset{% + chapter = { + nameformat = {}, + numberformat = {}, + titleformat = {}, + fixskip = true, + afterindent = true, + lofskip = 0pt, + lotskip = 0pt, + }, + section = { + afterindent = true, + }, + subsection = { + afterindent = true, + }, + subsubsection = { + afterindent = true, + }, + paragraph/afterindent = true, + subparagraph/afterindent = true, +} +% \end{macrocode} +% +% 本科生要求: +% \begin{center} +% \begin{tabular}{lclll} +% \toprule +% 标题 & 中文 & 英文 & 段前/后间距 & 行距 \\ +% \midrule +% 章标题 & 黑体三号 & Arial 16pt & 24/18 pt & 单倍 \\ +% 一级节标题 & 黑体四号 & Arial 14pt & 24/6 pt & 20pt \\ +% 二级节标题 & 黑体 13pt & Arial 13pt & 12/6 pt & 20pt \\ +% 三级节标题 & 黑体小四号 & Arial 12pt & 12/6 pt & 20pt \\ +% \bottomrule +% \end{tabular} +% \end{center} +% +% 这里三级节标题的“中文黑体小四号”和“英文 Arial 13pt”不一致,取 13pt。 +% \begin{macrocode} +\newcommand\thu@set@section@format{% + \ifthu@degree@bachelor + \ctexset{% + chapter = { + format = \centering\sffamily\fontsize{16bp}{20.8bp}\selectfont, + titleformat = \thu@stretch{3em}, + aftername = \quad, + beforeskip = 27bp, + afterskip = 27bp, + }, + section = { + format = \sffamily\fontsize{14bp}{20bp}\selectfont, + aftername = \quad, + beforeskip = 24bp, + afterskip = 6bp, + }, + subsection = { + format = \sffamily\fontsize{13bp}{20bp}\selectfont, + aftername = \quad, + beforeskip = 12bp, + afterskip = 6bp, + }, + subsubsection = { + format = \sffamily\fontsize{12bp}{20bp}\selectfont, + aftername = \quad, + beforeskip = 12bp, + afterskip = 6bp, + }, + }% + \ifthu@main@language@chinese + \ctexset{ + chapter = { + name = {第,章}, + number = \thechapter, + }, + }% + \else + \ctexset{ + chapter = { + name = \chaptername\space, + number = \thu@english@number{chapter}, + }, + }% + \fi +% \end{macrocode} +% +% 研究生要求: +% \begin{itemize} +% \item 各章标题,例如:“\textsf{第 1 章 引言}”。 +% +% 章序号与章名之间空一个汉字符。 +% 采用黑体三号字,居中书写,单倍行距, +% 段前空 24 磅,段后空 18 磅。 +% +% \item 一级节标题,例如:“\textsf{2.1 实验装置与实验方法}”。 +% +% 节标题序号与标题名之间空一个汉字符(下同)。 +% 采用黑体四号(14pt)字居左书写,行距为固定值 20 磅, +% 段前空 24 磅,段后空 6 磅。 +% +% \item 二级节标题,例如:“\textsf{2.1.1 实验装置}”。 +% +% 采用黑体 13pt 字居左书写,行距为固定值 20 磅, +% 段前空 12 磅,段后空 6 磅。 +% +% \item 三级节标题,例如:“\textsf{2.1.2.1 归纳法}”。 +% +% 采用黑体小四号(12pt)字居左书写,行距为固定值 20 磅, +% 段前空 12 磅,段后空 6 磅。 +% \end{itemize} +% +% 由于 Word 的行距算法不同,这里进行了一些调整使得视觉上更接近。 +% \begin{macrocode} + \else + \ctexset{% + chapter = { + titleformat = {}, + beforeskip = 27bp, + afterskip = 27bp, + number = \thechapter, + }, + section = { + beforeskip = 24bp, + afterskip = 6bp, + }, + subsection = { + beforeskip = 12bp, + afterskip = 6bp, + }, + subsubsection = { + beforeskip = 12bp, + afterskip = 6bp, + }, + }% + \ifthu@main@language@chinese + \ctexset{% + chapter = { + format = \centering\sffamily\sanhao, + nameformat = {}, + titleformat = {}, + name = {第,章}, + aftername = \quad, + }, + section = { + format = \sffamily\fontsize{14bp}{20bp}\selectfont, + aftername = \quad, + }, + subsection = { + format = \sffamily\fontsize{13bp}{20bp}\selectfont, + aftername = \quad, + }, + subsubsection = { + format = \sffamily\fontsize{12bp}{20bp}\selectfont, + aftername = \quad, + }, + }% + \else + \ctexset{% + chapter = { + format = \centering\sffamily\bfseries\fontsize{16bp}{20bp}\selectfont, + nameformat = \MakeUppercase, + titleformat = \MakeUppercase, + name = \chaptername\space, + aftername = \space, + }, + section = { + format = \sffamily\bfseries\fontsize{14bp}{20bp}\selectfont, + aftername = \space, + }, + subsection = { + format = \sffamily\bfseries\fontsize{13bp}{20bp}\selectfont, + aftername = \space, + }, + subsubsection = { + format = \sffamily\bfseries\fontsize{12bp}{20bp}\selectfont, + aftername = \space, + }, + }% + \fi + \fi +} +\thu@set@section@format +\thu@option@hook{degree}{\thu@set@section@format} +\thu@option@hook{main-language}{\thu@set@section@format} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\thu@english@number[1]{% + \expandafter\ifcase\csname c@#1\endcsname + Zero\or + One\or + Two\or + Three\or + Four\or + Five\or + Six\or + Seven\or + Eight\or + Nine\or + Ten\or + Eleven\or + Twelve\or + Thirteen\or + Fourteen\or + Fifteen\or + Sixteen\or + Seventeen\or + Eighteen\or + Nineteen\or + Twenty\or + \thu@error{You are genius}% + \fi +} +% \end{macrocode} +% +% \begin{macro}{\thu@chapter*} +% 默认的 \cs{chapter*} 很难同时满足研究生院和本科生的论文要求。本科论文要求所有的 +% 章都出现在目录里,比如摘要、Abstract、主要符号表等,所以可以简单的扩展默 +% 认\cs{chapter*} 实现这个目的。但是研究生又不要这些出现在目录中,而且致谢和声明 +% 部分的章名、页眉和目录都不同,所以定义一个灵活的 \cs{thu@chapter*} 专门处理这些 +% 要求。 +% +% \cs{thu@chapter*}\oarg{tocline}\marg{title}\oarg{header}: tocline 是出现在目录 +% 中的条目,如果为空则此 chapter 不出现在目录中,如果省略表示目录出现 title; +% title 是章标题;header 是页眉出现的标题,如果忽略则取 title。通过这个宏我才真 +% 正体会到 \TeX{} macro 的力量! +% \begin{macrocode} +\newcommand\thu@pdfbookmark[2]{} +\newcommand\thu@phantomsection{} +\NewDocumentCommand\thu@chapter{s o m o}{% + \IfBooleanF{#1}{% + \thu@error{You have to use the star form: \string\thu@chapter*}% + }% + \if@openright\cleardoublepage\else\clearpage\fi% + \IfValueTF{#2}{% + \ifthenelse{\equal{#2}{}}{% + \thu@pdfbookmark{0}{#3}% + }{% + \thu@phantomsection + \addcontentsline{toc}{chapter}{#2}% + }% + }{% + \thu@phantomsection + \addcontentsline{toc}{chapter}{#3}% + }% + \chapter*{#3}% + \IfValueTF{#4}{% + \ifthenelse{\equal{#4}{}}{% + \@mkboth{}{}% + }{% + \@mkboth{#4}{#4}% + }% + }{% + \@mkboth{#3}{#3}% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{目录} +% \label{sec:toc} +% 最多 4 层,即: x.x.x.x,对应的命令和层序号分别是: +% \cs{chapter}(0), \cs{section}(1), \cs{subsection}(2), \cs{subsubsection}(3)。 +% \begin{macrocode} +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{2} +% \end{macrocode} +% +% \begin{macro}{\tableofcontents} +% 目录生成命令。 +% \begin{macrocode} +\renewcommand\tableofcontents{% + \ifthu@degree@graduate + \thu@chapter*{\contentsname}% + \else + \ifthu@degree@bachelor + \ctexset{chapter/titleformat = \thu@stretch{2.5em}}% + \thu@chapter*[]{\contentsname}% + \ctexset{chapter/titleformat = \thu@stretch{3em}}% + \else + \thu@chapter*[]{\contentsname}% + \fi + \fi + \@starttoc{toc}% +} +\thu@define@key{ + toc-chapter-style = { + name = toc@chapter@style, + choices = { + arial, + times, + }, + default = arial, + }, +} +\thu@option@hook{toc-chapter-style}{\thu@deprecate{"toc-chapter-style" option}{}} +\newcommand\thu@contents@label@delimiter{% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \space + \else + \quad + \fi + \else + \quad + \fi +} +\newcommand\thu@leaders{\nobreak\titlerule*[4bp]{.}\nobreak} +\newcommand\thu@set@toc@format{% + \contentsmargin{\z@}% +% \end{macrocode} +% +% 本科生: +% 目录从第 1 章开始,每章标题用黑体小四号字,行间距为 20pt, +% 行前空 6pt,行后空 0pt。 +% 其它级节标题用宋体小四字,行间距为 20pt。 +% +% 注意示例中章标题的字母和数字是衬线体,所以这里用 \cs{heiti}。 +% 示例中的一级和二级节标题分别缩进 1 和 1.5 个汉字符。 +% \begin{macrocode} + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \titlecontents{chapter} + [0pt]{\sffamily} + {\contentspush{\thecontentslabel\space}\thu@stretch{3em}}{\thu@stretch{3em}} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \else +% \end{macrocode} +% +% 本科生英文专业要求“左侧按级依次缩进 0.5cm”。 +% \begin{macrocode} + \ifthu@main@language@english + \titlecontents{chapter} + [\z@]{\addvspace{6bp}\sffamily} + {\contentspush{\thecontentslabel\quad}}{} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [0.5cm]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [1cm]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \fi + \fi +% \end{macrocode} +% +% 研究生: +% \begin{enumerate} +% \item 目录中的章标题行采用黑体小四号字,固定行距 20 磅,段前段后 0 磅; +% 其他内容采用宋体小四号字,行距为固定值 20 磅, +% 段前、段后均为 0 磅。 +% \item 目录中的章标题行居左书写,一级节标题行缩进 1 个汉字符, +% 二级节标题行缩进 2 个汉字符。 +% \end{enumerate} +% +% 注意示例中章标题的字母和数字是无衬线体,所以用这里用 \cs{sffamily}, +% 但是页码仍然用 \cs{rmfamily}。 +% \begin{macrocode} + \else + \ifthu@main@language@chinese + \titlecontents{chapter} + [\z@]{\sffamily} + {\contentspush{\thecontentslabel\quad}}{} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thu@leaders\thecontentspage}% + \else + \titlecontents{chapter} + [\z@]{\heiti} + {\contentspush{\MakeUppercase{\thecontentslabel}\space}\MakeUppercase}{\MakeUppercase} + {\rmfamily\thu@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\space}}{} + {\thu@leaders\thecontentspage}% + \fi + \fi +} +\thu@set@toc@format +\thu@option@hook{degree}{\thu@set@toc@format} +\thu@option@hook{main-language}{\thu@set@toc@format} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{封面和封底} +% \label{sec:cover} +% 定义密级参数。 +% \begin{macrocode} +\thu@define@key{ + secret-level = { + name = secret@level, + }, + secret-year = { + name = secret@year, + }, +% \end{macrocode} +% +% 论文中英文题目。 +% \begin{macrocode} + title = { + default = {标题}, + }, + title* = { + default = {Title}, + name = title@en, + }, +% \end{macrocode} +% +% 作者、导师、副导师、联合指导老师。 +% \begin{macrocode} + author = { + default = {姓名}, + }, + author* = { + default = {Name of author}, + name = author@en, + }, + student-id = { + name = student@id, + }, + supervisor = { + default = {导师姓名}, + }, + supervisor* = { + default = {Name of supervisor}, + name = supervisor@en, + }, + associate-supervisor = { + name = associate@supervisor, + }, + associate-supervisor* = { + name = associate@supervisor@en, + }, + co-supervisor = { + name = co@supervisor, + }, + co-supervisor* = { + name = co@supervisor@en, + }, + % Reserved for compatibility + joint-supervisor = { + name = co@supervisor, + }, + joint-supervisor* = { + name = co@supervisor@en, + }, +% \end{macrocode} +% +% 学位中英文。 +% \begin{macrocode} + degree-category = { + default = {工学博士}, + name = degree@category, + }, + degree-category* = { + default = {Doctor of Philosophy}, + name = degree@category@en, + }, +} +% \end{macrocode} +% +% 院系中英文名称。 +% \begin{macrocode} +\thu@define@key{ + department = { + default = {计算机科学与技术系}, + }, +% \end{macrocode} +% +% 学科中英文名称。 +% \begin{macrocode} + discipline = { + % default = {计算机科学与技术}, + }, + discipline* = { + % default = {Computer Science and Technology}, + name = discipline@en, + }, +} +\thu@option@hook{discipline}{% + \ifthu@degree@type@professional + \thu@warning{`discipline' for professional degree is deprecated. Use `professional-field' instead.}% + \let\thu@professional@field\thu@discipline + \let\thu@discipline\@empty + \fi +} +\thu@option@hook{discipline*}{% + \ifthu@degree@type@professional + \thu@warning{`discipline*' for professional degree is deprecated. Use `professional-field*' instead.}% + \let\thu@professional@field@en\thu@discipline@en + \let\thu@discipline@en\@empty + \fi +} +% \end{macrocode} +% +% 专业领域。 +% \begin{macrocode} +\thu@define@key{ + professional-field = { + name = professional@field, + }, + professional-field* = { + name = professional@field@en, + }, +% \end{macrocode} +% +% 工程领域。 +% \begin{macrocode} + engineering-field = { + name = engineering@field, + }, + engineering-field* = { + name = engineering@field@en, + }, +% \end{macrocode} +% +% 论文成文日期。 +% \begin{macrocode} + date = { + default = {\the\year-\two@digits{\month}-\two@digits{\day}}, + }, +% \end{macrocode} +% +% 博士后专用封面参数。 +% \begin{macrocode} + clc, + udc, + id, + discipline-level-1 = { + default = {一级学科名称}, + name = discipline@level@i, + }, + discipline-level-2 = { + default = {二级学科名称}, + name = discipline@level@ii, + }, + start-date = { + name = start@date, + default = {\the\year-\two@digits{\month}-\two@digits{\day}}, + }, + end-date = { + name = end@date, + default = {\the\year-\two@digits{\month}-\two@digits{\day}}, + }, +% \end{macrocode} +% +% 中文封面后是否生成书脊页。 +% \begin{macrocode} + include-spine = { + name = include@spine, + choices = { + false, + true, + }, + default = false, + }, +} +% \end{macrocode} +% +% 输出日期的给定格式:\cs{thu@format@date}\marg{format}\marg{date}, +% 其中格式 \meta{format} 接受三个参数分别对应年、月、日, +% \meta{date} 是 ISO 格式的日期(yyyy-mm-dd)。 +% \begin{macrocode} +\newcommand\thu@format@date[2]{% + \edef\thu@@date{#2}% + \def\thu@@process@date##1-##2-##3\@nil{% + #1{##1}{##2}{##3}% + }% + \expandafter\thu@@process@date\thu@@date\@nil +} +\newcommand\thu@date@zh@digit[3]{#1 年 \number#2 月 \number#3 日} +\newcommand\thu@date@zh@digit@short[3]{#1 年 \number#2 月} +\newcommand\thu@date@zh@short[3]{\zhdigits{#1}年\zhnumber{#2}月} +\newcommand\thu@date@month[1]{% + \ifcase\number#1\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December% + \fi +} +\newcommand\thu@date@en@short[3]{\thu@date@month{#2}, #1} +% \end{macrocode} +% +% 下划线命令。 +% \pkg{ulem} 的下划线 \cs{uline} 可以控制粗细和深度。 +% \begin{macrocode} +\newcommand\thu@underline[2][6em]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt} +\newcommand\thu@uline[2][6em]{\uline{\hb@xt@ #1{\hss#2\hss}}} +% \end{macrocode} +% +% 将内容拉伸或压缩到固定宽度。 +% \begin{macrocode} +\newcommand\thu@fixed@box[2]{% + \begingroup + \ifLuaTeX + \ltjsetparameter{kanjiskip = {0pt plus 2filll minus 1filll}}% + \else + \renewcommand\CJKglue{\hspace{0pt plus 2filll minus 1filll}}% + \fi + \makebox[#1][l]{#2}% + \endgroup +} +% \end{macrocode} +% +% 如果内容小于给定宽度,则拉伸至该宽度,否则取自然宽度。 +% \begin{macrocode} +\newbox\thu@stretch@box +\newcommand\thu@stretch[2]{% + \sbox\thu@stretch@box{#2}% + \ifdim \wd\thu@stretch@box < #1\relax + \begingroup + \ifLuaTeX + \ltjsetparameter{kanjiskip = {0pt plus 2filll}}% + \else + \renewcommand\CJKglue{\hspace{0pt plus 2filll}}% + \fi + \makebox[#1][l]{#2}% + \endgroup + \else + \box\thu@stretch@box + \fi +} +% \end{macrocode} +% +% 如果内容小于给定宽度,则在右侧填充空白至该宽度,否则取自然宽度。 +% \begin{macrocode} +\newbox\thu@pad@box +\newcommand\thu@pad[2]{% + \sbox\thu@pad@box{#2}% + \ifdim \wd\thu@pad@box < #1\relax + \makebox[#1][l]{\box\thu@pad@box}% + \else + \box\thu@pad@box + \fi +} +% \end{macrocode} +% +% 导师的姓名和职称使用“,”分开,所以这里用 \pkg{kvsetkeys} 的 \cs{comma@parse} 来处理。 +% \begin{macrocode} +\newcounter{thu@csl@count} +\newcommand\thu@name@title@process[1]{% + \ifcase\c@thu@csl@count % == 0 + \gdef\thu@@name{#1}% + \or % == 1 + \gdef\thu@@title{#1}% + \fi + \stepcounter{thu@csl@count}% +} +\newcommand\thu@name@title@format[2]{% + \thu@pad{3cm}{\thu@stretch{4em}{#1}}% + \thu@stretch{3em}{#2}% +} +\newcommand\thu@name@title[1]{% + \setcounter{thu@csl@count}{0}% + \gdef\thu@@name{}% + \gdef\thu@@title{}% + \expandafter\comma@parse\expandafter{#1}{\thu@name@title@process}% + \thu@name@title@format{\thu@@name}{\thu@@title}% +} +% \end{macrocode} +% +% \myentry{封面} +% \begin{macro}{\maketitle} +% 生成封面(题名页)总命令。 +% \begin{macrocode} +\renewcommand\maketitle{% + \cleardoublepage + \pagenumbering{Alph}% + \thu@pdfbookmark{-1}{\thu@title}% + \thu@titlepage + \ifthu@include@spine@true + \spine + \fi + \ifthu@degree@graduate + \ifthu@thesis@type@thesis + \cleardoublepage + \thu@titlepage@en + \fi + \fi + \clearpage +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\thu@titlepage} +% 中文封面(题名页) +% +% \begin{macrocode} +\newcommand\thu@titlepage{% + \thusetup{language = chinese}% + \ifthu@degree@graduate + % 研究生 + \thu@titlepage@thesis + \else + \ifthu@degree@bachelor + % 本科生 + \thu@titlepage@bachelor + \else + \ifthu@degree@postdoc + % 博后 + \thu@cover@postdoc + \cleardoublepage + \thu@titlepage@postdoc + \fi + \fi + \fi + \thu@reset@main@language +} +% \end{macrocode} +% \end{macro} +% +% \myentry{研究生中文封面} +% 《写作指南》规定中文封面页边距: +% 上—6. 0 厘米,下—5.5 厘米,左—4.0 厘米,右—4.0 厘米,装订线 0 厘米。 +% 然而作为事实标准的 Word 模板的页边距是上下 6.0 厘米,左右 4.0 厘米。 +% 这里缩小上边距以方便排版保密信息。 +% \begin{macrocode} +\newcommand\thu@titlepage@thesis{% + \newgeometry{ + top = 2cm, + bottom = 6cm, + hmargin = 3.5cm, + }% + \thispagestyle{empty}% + \null\vskip 8.1pt% + \begingroup + \centering + \parbox[t][2cm][t]{\textwidth}{% + \hskip -21.5pt% + \thu@titlepage@secret + }\par + \vskip 40.5pt% + \begingroup + \sffamily\fontsize{26bp}{46.8bp}\selectfont + \thu@title\par + \endgroup + \ifthu@main@language@english + \vskip 5.4pt% + \begingroup + \sffamily\bfseries\fontsize{20bp}{31.2bp}\selectfont + \thu@title@en\par + \endgroup + \vskip -9.2pt% + \fi + \vskip 24.1pt% + \thu@title@page@degree@category\par + \vfill + \ifthu@degree@type@academic + \parbox[t][7.25cm][t]{\textwidth}{% + \fangsong\fontsize{16bp}{31.2bp}\selectfont + \thu@titlepage@info + }\par + \else + \parbox[t][5.25cm][b]{\textwidth}{% + \fangsong\fontsize{16bp}{31.2bp}\selectfont + \thu@titlepage@info + }\par + \vskip 62pt% + \fi + \parbox[t][1.03cm][t]{\textwidth}{\centering\thu@titlepage@date}\par + \endgroup + \clearpage + \restoregeometry +} +% \end{macrocode} +% +% 选题报告封面需要提供学号 +% \begin{macrocode} +\newcommand\thu@set@student@id{% + \ifthu@thesis@type@proposal\else + \ifx\thu@student@id\@empty\else + \thu@warning{`student-id' in "\protect\thusetup" would be ignored when `thesis-type' is not proposal.}% + \fi + \fi +} +\thu@set@student@id +\thu@option@hook{thesis-type}{\thu@set@student@id} +\thu@option@hook{student-id}{\thu@set@student@id} +% \end{macrocode} +% +% 涉密信息 +% \begin{macrocode} +\newcommand\thu@titlepage@secret{% + \sffamily\sanhao + \ifx\thu@secret@level\@empty + \phantom{秘密}% + \else + \thu@secret@level\symbol{"2605}\makebox[3em][c]{\thu@secret@year}年% + \fi\par +} +% \end{macrocode} +% +% 申请学位的学科门类或专业学位类别: 三号(16bp)宋体字,字距延伸 0.5bp, +% 所以 \cs{CJKglue} 应该设为 1 bp。 +% \begin{macrocode} +\newcommand\thu@title@page@degree@category{% + \begingroup + \fontsize{16bp}{22bp}\selectfont + \ifLuaTeX + \fontspec{\CJK@family}% + \ltjsetparameter{kanjiskip = {1bp}}% + \else + \CJKfamily+{}% + \renewcommand\CJKglue{\hspace{1bp}}% + \fi + \ifthu@thesis@type@thesis + (申请清华大学\thu@degree@category + \ifthu@degree@type@professional + 专业% + \fi + 学位论文)% + \else + \ifthu@thesis@type@proposal + (清华大学% + \ifthu@degree@doctor + 博士% + \else + \ifthu@degree@master + 硕士% + \fi + \fi + 学位论文选题报告)% + \fi + \fi + \par + \endgroup +} +% \end{macrocode} +% +% 作者及指导教师信息 +% \begin{macrocode} +\newcommand\thu@titlepage@info{% + \thu@titlepage@info@tabular{2.3cm}{2.85cm}{2.75cm}{0.77cm}{% + \thu@info@item{培养单位}{}{\thu@department}% + \ifthu@degree@type@academic + \thu@info@item{学科}{}{\thu@discipline}% + \thu@info@item{研究生}{\thu@name@title}{\thu@author}% + \else + \thu@info@item{专业领域}{}{\thu@professional@field}% + \thu@info@item{工程领域}{}{\thu@engineering@field}% + \thu@info@item{申请人}{\thu@name@title}{\thu@author}% + \fi + \ifthu@thesis@type@proposal + \ifx\thu@student@id\@empty + \thu@warning{Missing option `student-id' in "\protect\thusetup", ID will not appear on cover.}% + \else + \thu@info@item{学号}{}{\thu@student@id}% + \fi + \fi + \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}% + \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}% + \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}% + }\par +} +% \end{macrocode} +% +% 标题页作者信息表 +% \texttt{\#1}: 表格左侧至版心的距离;\\ +% \texttt{\#2}: “培养单位”的边框宽度;\\ +% \texttt{\#3}: “培养单位”的文字宽度;\\ +% \texttt{\#4}: 冒号的边框;\\ +% \texttt{\#5}: 表格内容。 +% \begin{macrocode} +\newcommand\thu@titlepage@info@tabular[5]{% + \def\thu@info@item##1##2##3{% + \ifx##3\@empty\else + \thu@pad{#2}{\thu@fixed@box{#3}{##1}}% + \thu@pad{#4}{:}% + ##2{##3}\\ + \fi + }% + \hspace{#1}% + \begin{tabular}{l}% + \renewcommand\arraystretch{1}% + #5% + \end{tabular}% +} +% \end{macrocode} +% +% 论文成文打印的日期,用三号宋体汉字,字距延伸 0.5bp, +% 所以 \cs{CJKglue} 应该设为 1 bp。 +% \begin{macrocode} +\newcommand\thu@titlepage@date{% + \begingroup + \sanhao + \ifLuaTeX + \ltjsetparameter{kanjiskip = {1bp}}% + \else + \renewcommand\CJKglue{\hspace{1bp}}% + \fi + \thu@format@date{\thu@date@zh@short}{\thu@date}\par + \endgroup +} +% \end{macrocode} +% +% \myentry{研究生英文封面} +% \begin{macro}{\thu@titlepage@en} +% \begin{macrocode} +\newcommand{\thu@titlepage@en}{% + \newgeometry{ + top = 5.5cm, + bottom = 5cm, + hmargin = 3.4cm, + }% + \thispagestyle{empty}% + \thusetup{language = english}% + \ifthu@degree@type@academic + \thu@titlepage@en@graduate@academic + \else + \thu@titlepage@en@graduate@professional + \fi + \thu@reset@main@language + \clearpage + \restoregeometry +} +\newcommand\thu@titlepage@en@graduate@academic{% + \begingroup + \centering + \null\vskip -0.31cm% + \parbox[t][143bp][t]{\textwidth}{% + \centering\thu@titlepage@en@title + }\par + \sanhao[1.725]% + \thu@titlepage@en@degree + \vskip 3bp% + in\par + \vskip 3.5bp% + {\bfseries\sffamily\thu@discipline@en\par}% + \vfill + {\sffamily by\par}% + \vskip 0.24cm% + {\sffamily\bfseries\thu@author@en\par}% + \vskip 0.18cm% + \parbox[t][3.0cm][t]{\textwidth}{% + \centering + \xiaosan[2.1]% + \thu@titlepage@en@supervisor + }\par + \thu@titlepage@en@date + \vskip 0.7cm% + \endgroup +} +\newcommand\thu@titlepage@en@graduate@professional{% + \begingroup + \centering + \null\vskip -0.31cm% + \parbox[t][143bp][t]{\textwidth}{% + \centering\thu@titlepage@en@title + }\par + \sanhao[1.725]% + \thu@titlepage@en@degree + \vfill + {\sffamily by\par}% + \vskip 0.24cm% + {\sffamily\bfseries\thu@author@en\par}% + \ifx\thu@professional@field@en\empty + \vskip 1.95cm% + \else + \vskip -0.1cm% + {\sffamily\bfseries(\thu@professional@field@en)\par}% + \vskip 1.1cm% + \fi + \parbox[t][3.37cm][t]{\textwidth}{% + \centering + \xiaosan[1.82]% + \thu@titlepage@en@supervisor + }\par + \thu@titlepage@en@date + \vskip 0.3cm% + \endgroup +} +\newcommand\thu@titlepage@en@title{% + \begingroup + % 对齐到网格,每行 15.6bp + \sffamily\bfseries\fontsize{20bp}{31.2bp}\selectfont + \thu@title@en\par + \endgroup +} +\newcommand\thu@thesis@name@en{% + \ifthu@degree@master + Thesis% + \else + Dissertation% + \fi +} +\newcommand\thu@titlepage@en@degree{% + \thu@thesis@name@en{} submitted to\par + {\bfseries Tsinghua University\par}% + in partial fulfillment of the requirement\par + for the + \ifthu@degree@type@professional + professional + \fi + degree of\par + {\sffamily\bfseries\thu@degree@category@en\par}% +} +\newcommand\thu@titlepage@en@supervisor{% + \begin{tabular}{r@{\makebox[20.5bp][l]{\hspace{2bp}:}}l}% + \renewcommand\arraystretch{1}% + \thu@thesis@name@en{} Supervisor & \thu@supervisor@en \\ + \ifx\thu@associate@supervisor@en\@empty\else + Associate Supervisor & \thu@associate@supervisor@en \\ + \fi + \ifx\thu@co@supervisor@en\@empty\else + Co-supervisor & \thu@co@supervisor@en \\ + \fi + \end{tabular}% +} +\newcommand\thu@titlepage@en@date{% + \begingroup + \sffamily\bfseries\sanhao + \thu@format@date{\thu@date@en@short}{\thu@date}\par + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \myentry{本科生封面} +% 本科生封面要求: +% \begin{itemize} +% \item 题目:1 号黑体字,1.2 倍行距。 +% \item 系别、专业、姓名及指导教师信息部分使用三号仿宋\_GB2312 字。 +% \item 论文成文打印的日期用阿拉伯数字,采用小四号宋体。 +% \item 涉密的论文在封面右上角处注明论文密级,采用小四号宋体。 +% \end{itemize} +% +% 外文系英语专业要求题目先写中文标题,再写英文标题,字号 26pt,32 磅行距。 +% \begin{macrocode} +\newlength\thu@info@label@width +\newlength\thu@info@label@text@width +\newcommand\thu@titlepage@bachelor{% + \newgeometry{ + top = 3.8cm, + bottom = 3.2cm, + left = 3.2cm, % 装订线靠左 0.2 cm + right = 3cm, + }% + \thispagestyle{empty}% + \begingroup + \centering + \parbox[t][0cm][t]{\textwidth}{% + \hfill + \xiaosi + \ifx\thu@secret@level\@empty\else + \thu@secret@level\space\thu@secret@year 年\par + \fi + }\par + \endgroup + \vspace{19bp}% + \begingroup + \centering + \hspace*{-5bp}% + \includegraphics[width=50.4bp]{thu-fig-logo.pdf}% + \hspace{10bp}% + \raisebox{7bp}{\includegraphics[width=117bp]{thu-text-logo.pdf}}% + \par + \vspace{17bp}% + \begingroup + \sffamily\bfseries\xiaochu\ziju{0.3}% + 综合论文训练% + \ifthu@thesis@type@proposal + \\开题报告 + \fi + \par + \endgroup + \vspace{48bp}% + \parbox[t][136bp]{\linewidth}{% + \centering + \heiti\fontsize{26bp}{32.5bp}\selectfont + \thu@title\par + \ifthu@main@language@english + \thusetup{language=english}% + \thu@title@en\par + \thusetup{language=chinese}% + \fi + }\par + \endgroup + \begingroup + \fangsong + \fontsize{16bp}{30.96bp}\selectfont + \noindent + \def\thu@name@title@format##1##2{% + \thu@stretch{4em}{##1}% + \hspace{1.5em}% + \thu@stretch{2.5em}{##2}% + }% + \ifx\thu@co@supervisor\@empty + \setlength\thu@info@label@width{2.5cm}% + \setlength\thu@info@label@text@width{4em}% + \else + \setlength\thu@info@label@width{86bp}% + \setlength\thu@info@label@text@width{5em}% + \fi + \thu@titlepage@info@tabular{81bp}{\thu@info@label@width}{\thu@info@label@text@width}{0.82cm}{% + \thu@info@item{系别}{}{\thu@department}% + \thu@info@item{专业}{}{\thu@discipline}% + \thu@info@item{姓名}{\thu@name@title}{\thu@author}% + \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}% + \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}% + \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}% + }\par + \endgroup + \vfill + \begingroup + \centering + \fontsize{16bp}{24bp}\selectfont + \ziju{0.03}% + \thu@format@date{\thu@date@zh@short}{\thu@date}\par + \endgroup + \vspace*{60bp}% + \clearpage + \restoregeometry +} +% \end{macrocode} +% +% \myentry{博士后封面} +% \begin{macrocode} +\newcommand\thu@cover@postdoc{% + \thispagestyle{empty}% + \begin{center}% + \renewcommand\ULthickness{0.7pt}% + \vspace*{0.35cm}% + {\sihao[2.6]% + \thu@stretch{3.1em}{分类号}\thu@underline[3.7cm]{\thu@clc}\hfill + 密级\thu@underline[3.7cm]{\thu@secret@level}\par + \thu@stretch{3.1em}{U D C}\thu@underline[3.7cm]{\thu@udc}\hfill + 编号\thu@underline[3.7cm]{\thu@id}\par + }% + \vskip 3.15cm% + {\sffamily\bfseries\xiaoer[2.6]% + {\ziju{1.5}清华大学\par}% + {\ziju{0.5}博士后研究工作报告\par}% + }% + \vskip 0.2cm% + \parbox[t][4.0cm][c]{\textwidth}{% + \centering\sihao[3.46]% + \renewcommand\ULdepth{1em}% + \expandafter\uline\expandafter{\thu@title}\par + }\par + \vskip 0.4cm% + {\xiaosi\thu@author\par}% + \vskip 1.4cm% + {\xiaosi[1.58]% + \renewcommand\ULdepth{0.9em}% + 工作完成日期\quad + \thu@uline[5.9cm]{% + \thu@format@date{\thu@date@zh@digit@short}{\thu@start@date}—% + \thu@format@date{\thu@date@zh@digit@short}{\thu@end@date}% + }\par + \vskip 0.55cm% + 报告提交日期\quad + \thu@uline[5.9cm]{\thu@format@date{\thu@date@zh@digit@short}{\thu@date}}\par + }% + \vskip 0.45cm% + {\xiaosi[2]{\ziju{1}清华大学}\quad (北京)\par}% + \vskip 0.25cm% + {\xiaosi[2]\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}% + \end{center}% +} +% \end{macrocode} +% +% \myentry{博士后题名页} +% \begin{macrocode} +\newcommand\thu@titlepage@postdoc{% + \thispagestyle{empty}% + \begin{center}% + \vspace*{1.5cm}% + \parbox[t][3cm][c]{\textwidth}{% + \centering\sanhao[1.95]\thu@title\par + }\par + \vskip 0.15cm% + \parbox[t][3cm][c]{\textwidth}{% + \centering\sihao[1.36]\thu@title@en\par + }\par + \vskip 0.4cm% + {\xiaosi[2.6]% + \begin{tabular}{l@{\quad}l}% + \renewcommand\arraystretch{1}% + \thu@stretch{11em}{博士后姓名} & \thu@author \\ + \thu@stretch{11em}{流动站(一级学科)名称} & \thu@discipline@level@i \\ + \thu@stretch{11em}{专\quad{}业(二级学科)名称} & \thu@discipline@level@ii \\ + \end{tabular}\par + }% + \vskip 2.7cm% + {\xiaosi[2.6]% + 研究工作起始时间\quad\thu@format@date{\thu@date@zh@digit}{\thu@start@date}\par + \vskip 0.1cm% + 研究工作期满时间\quad\thu@format@date{\thu@date@zh@digit}{\thu@end@date}\par + }% + \vskip 2.1cm% + {\xiaosi[2.6]清华大学人事处(北京)\par}% + \vskip 0.6cm% + {\wuhao\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}% + \end{center}% +} +% \end{macrocode} +% +% \subsubsection{答辩委员会名单} +% \begin{environment}{committee} +% 学位论文指导小组、公开评阅人和答辩委员会名单。 +% \begin{macrocode} +\def\thu@committee@name{学位论文指导小组、公开评阅人和答辩委员会名单} +\NewEnviron{committee}[1][]{% + \ifthu@degree@graduate + \cleardoublepage + \let\thu@committee@file\@empty + \kv@define@key{thu@committee}{name}{\let\thu@committee@name\kv@value}% + \kv@define@key{thu@committee}{file}{\let\thu@committee@file\kv@value}% + \kv@set@family@handler{thu@committee}{% + \ifx\kv@value\relax + \let\thu@committee@file\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@committee}{#1}% + \ifx\thu@committee@file\@empty + \begingroup + \ctexset{ + chapter = { + format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont, + afterskip = 49bp, + }, + section = { + beforeskip = 26bp, + afterskip = 9.5bp, + format += \centering, + numbering = false, + afterindent = false, + }, + }% + \thu@chapter*[]{\thu@committee@name}% + \thispagestyle{empty}% + \thusetup{language=chinese}% + \BODY\clearpage + \thu@reset@main@language + \endgroup + \else + \thu@pdfbookmark{0}{\thu@committee@name}% + \includepdf{\thu@committee@file}% + \fi + \fi +} +% \end{macrocode} +% \end{environment} +% +% \subsubsection{授权说明} +% \begin{macro}{\copyrightpage} +% 授权说明 +% \begin{macrocode} +\newcommand\copyrightpage[1][]{% + \ifthu@degree@postdoc\relax\else + \cleardoublepage + \def\thu@@tmp{#1}% + \ifx\thu@@tmp\@empty + \thusetup{language=chinese}% + \ifthu@degree@bachelor + \thu@copyright@page@bachelor + \else + \thu@copyright@page@graduate + \fi + \clearpage + \thu@reset@main@language + \else + \thispagestyle{empty}% + \thu@pdfbookmark{0}{关于学位论文使用授权的说明}% + \thu@phantomsection + \kv@define@key{thu@copyright}{file}{\includepdf{\kv@value}}% + \kv@set@family@handler{thu@copyright}{% + \ifx\kv@value\relax + \includepdf{\kv@key}% + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@copyright}{#1}% + \fi + \fi + \thu@replace@with@error{copyrightpage} +} +% \end{macrocode} +% +% 支持扫描文件替换。 +% \begin{macrocode} +\newcommand{\thu@authorization@frontdate}{% + 日\ifthu@degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:} +\newcommand\thu@copyright@page@graduate{% + \begingroup + \ctexset{ + chapter = { + format = {\centering\sffamily\erhao}, + beforeskip = 40bp, + afterskip = 36bp, + }, + }% + \thu@chapter*[]{关于学位论文使用授权的说明}% + \endgroup + \thispagestyle{empty}% + \vskip 13bp% + \begingroup + \fontsize{14bp}{26bp}\selectfont + 本人完全了解清华大学有关保留、使用学位论文的规定,即:\par + 清华大学拥有在著作权法规定范围内学位论文的使用权,其中包括:% + (1)\nobreak 已获学位的研究生必须按学校规定提交学位论文,% + 学校可以采用影印、缩印或其他复制手段保存研究生上交的学位论文;\allowbreak + (2)\nobreak 为教学和科研目的,学校可以将公开的学位论文作为资料在图书馆、资料室等场所供校内师生阅读,% + 或在校园网上供校内师生浏览部分内容;\allowbreak + \ifthu@degree@doctor + (3)\nobreak 根据《中华人民共和国学位法》及上级教育主管部门具体要求,向国家图书馆报送相应的学位论文。% + \else + (3)\nobreak 按照上级教育主管部门督导、抽查等要求,报送相应的学位论文。% + \fi + \par + 本人保证遵守上述规定。\par + \endgroup + \vskip 33bp% + \begingroup + \fontsize{12bp}{23.4bp}\selectfont + \parindent\z@ + \leftskip 43bp% + 作者签名:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}% + 导师签名:\hspace{4bp}\thu@underline[7em]{}\par + \vskip 6bp% + 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}% + 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\par + \endgroup +} +\newcommand\thu@copyright@page@bachelor{% + \begingroup + \ctexset{ + chapter = { + format = {\centering\sffamily\erhao}, + beforeskip = 40bp, + afterskip = 37bp, + }, + }% + \thu@chapter*[]{关于论文使用授权的说明}% + \endgroup + \thispagestyle{empty}% + \vspace*{13bp}% + \begingroup + \fontsize{14bp}{26bp}\selectfont + 本人完全了解清华大学有关保留、使用综合论文训练论文的规定,即:% + 学校有权保留论文的复印件,允许论文被查阅和借阅;% + 学校可以公布论文的全部或部分内容,可以采用影印、缩印或其他复制手段保存论文。\par + \endgroup + \vspace{71bp}% + \begingroup + \setlength{\parindent}{0pt}% + \fontsize{12bp}{18bp}\selectfont + \hspace*{42bp}作者签名:\hspace{118bp}导师签名:\par + \vspace{11bp}% + \hspace*{42bp}日\hspace{2em}期:\hspace{118bp}日\hspace{2em}期:\par + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{摘要} +% \label{sec:abstractformat} +% +% \begin{macro}{\thu@clist@use} +% 不同论文格式关键词之间的分割不太相同,我们用 \option{keywords} 和 +% \option{keywords*} 来收集关键词列表,然后用本命令来生成符合要求的格式, +% 类似于 \LaTeX3 的 \cs{clist\_use:Nn}。 +% \begin{macrocode} +\thu@define@key{ + keywords, + keywords* = { + name = keywords@en, + }, +} +\newcommand\thu@clist@use[2]{% + \def\thu@@tmp{}% + \def\thu@clist@processor##1{% + \ifx\thu@@tmp\@empty + \def\thu@@tmp{#2}% + \else + #2% + \fi + ##1% + }% + \expandafter\comma@parse\expandafter{#1}{\thu@clist@processor}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{abstract} +% 中文摘要部分的标题为“\textbf{摘要}”,用黑体三号字。 +% 摘要内容用小四号字书写,两端对齐,汉字用宋体,外文字用 Times New Roman 体, +% 标点符号一律用中文输入状态下的标点符号。 +% \begin{macrocode} +\newenvironment{abstract}{% + \thusetup{language = chinese}% + \ifthu@degree@graduate + \begingroup + \ifthu@main@language@english + \ctexset{% + chapter/format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont, + }% + \fi + \thu@chapter*{\thu@abstract@name}% + \endgroup + \else + \thu@chapter*[]{\thu@abstract@name}% + \fi +}{% + \par + \null\par + \ifthu@degree@postdoc + \textbf{关键词:}% + \else + \noindent + \textsf{关键词:}% + \fi + \thu@clist@use{\thu@keywords}{;}\par + \gdef\thu@keywords{}% + \thu@reset@main@language % switch back to main language +} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{abstract*} +% 英文摘要部分的标题为 \textbf{Abstract},用 Arial 体三号字。 +% 摘要内容用小四号 Times New Roman。 +% \begin{macrocode} +\newenvironment{abstract*}{% + \thusetup{language = english}% + \ifthu@degree@bachelor + \begingroup + \ctexset{chapter/afterskip = 30bp}% + \thu@chapter*[]{\thu@abstract@name@en}% + \endgroup + \else + \ifthu@degree@graduate + \thu@chapter*{\thu@abstract@name@en}% + \else + \thu@chapter*[]{\thu@abstract@name@en}% + \fi + \fi +}{% + \par + \null\par + \ifthu@degree@postdoc\else + \noindent + \fi + \textbf{Keywords:} \thu@clist@use{\thu@keywords@en}{; }\par + \thu@reset@main@language % switch back to main language +} +% \end{macrocode} +% \end{environment} +% +% \subsubsection{符号和缩略语说明} +% \label{sec:denotationfmt} +% \begin{environment}{denotation} +% 符号和缩略语说明。 +% \begin{macrocode} +\newenvironment{denotation}[1][2.5cm]{% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \thu@chapter*[]{\thu@denotation@name}% + \else + \thu@chapter*{\thu@denotation@name}% + \fi + \else + \ifthu@degree@graduate + \thu@chapter*{\thu@denotation@name}% + \else + \thu@chapter*[]{\thu@denotation@name}% + \fi + \fi + \begin{thu@denotation}[labelwidth=#1]% +}{% + \end{thu@denotation}% +} +\newlist{thu@denotation}{description}{1} +\setlist[thu@denotation]{% + nosep, + font=\normalfont, + align=left, + leftmargin=!, % sum of the following 3 lengths + labelindent=0pt, + labelwidth=2.5cm, + labelsep*=0.5cm, + itemindent=0pt, +} +% \end{macrocode} +% \end{environment} +% +% +% \subsubsection{致谢以及声明} +% \label{sec:ackanddeclare} +% +% \begin{environment}{acknowledgements} +% 定义致谢环境 +% \begin{macrocode} +\newcommand{\thu@statement@text@bachelor}{% + 本人郑重声明:所呈交的综合论文训练论文,是本人在导师指导下,独立进行研究工作所取得的成果。% + 尽我所知,除文中已经注明引用的内容外,本论文的研究成果不包含任何他人享有著作权的内容。% + 对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式标明。% +} +\newcommand{\thu@statement@text@graduate}{% + 本人郑重声明:所呈交的学位论文,是本人在导师指导下,独立进行研究工作所取得的成果% + \ifx\thu@secret@level\@empty + ,不包含涉及国家秘密的内容% + \fi% + 。尽我所知,除文中已经注明引用的内容外,本学位论文的研究成果不包含任何他人享有著作权的内容。% + 对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式标明。% +} +\newcommand{\thu@signature}{签\hspace{1em}名:} +\newcommand{\thu@backdate}{日\hspace{1em}期:} +% \end{macrocode} +% +% 定义致谢与声明环境。 +% \begin{macrocode} +\newenvironment{acknowledgements}{% + \@mainmatterfalse + \thu@end@appendix@ref@section + \thu@chapter*{\thu@acknowledgements@name}% +}{% +} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{statement} +% 声明页面样式和插入声明页(支持扫描文件替换)。 +% \begin{macrocode} +\thu@define@key{ + statement-page-style = { + name = statement@page@style, + choices = { + plain, + empty, + }, + default = plain, + } +} +\newcommand\statement[1][]{% + \@mainmatterfalse + \thu@end@appendix@ref@section + \let\thu@statement@file\@empty + \kv@define@key{thu@statement}{page-style}{\thusetup{statement-page-style=##1}}% + \kv@define@key{thu@statement}{file}{\let\thu@statement@file\kv@value}% + \kv@set@family@handler{thu@statement}{% + \ifx\kv@value\relax + \let\thu@statement@file\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@statement}{#1}% + \ifx\thu@statement@file\@empty + \thusetup{language=chinese}% + \begingroup + \ifthu@degree@graduate + \ifthu@main@language@english + \ctexset{% + chapter/format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont, + }% + \fi + \fi + \thu@chapter*{\thu@statement@name}% + \endgroup + \thispagestyle{\thu@statement@page@style}% + \ifthu@degree@graduate + \vspace{13bp}% + \fontsize{12bp}{21bp}\selectfont + \begingroup + \renewcommand\CJKglue{\hspace{.15bp plus .1bp}}% + \thu@statement@text@graduate\par + \endgroup + \vspace{78.5bp}% + \begingroup + \noindent\hspace{153.5bp}\fontsize{13bp}{18bp}\selectfont + \thu@signature\thu@underline[76bp]{}\hspace{-3bp}% + \thu@backdate\thu@underline[65bp]{}\par + \endgroup + \else + \ifthu@degree@bachelor + \begingroup + \renewcommand\CJKglue{\hspace{.1bp}}% + \thu@statement@text@bachelor\par + \endgroup + \vspace{40bp}% + \hfill 签\hspace{.5em}名:\thu@underline[2.75cm]{}\hspace{.5em}% + 日\hspace{.5em}期:\thu@underline[2.75cm]{}\par + \fi + \fi + \thu@reset@main@language + \else + \includepdf[pagecommand={% + \markboth{\thu@statement@name}{}% + \thu@phantomsection + \addcontentsline{toc}{chapter}{\thu@statement@name}% + \thispagestyle{\thu@statement@page@style}% + }]{\thu@statement@file}% + \fi + \thu@replace@with@error{statement} +} +% \end{macrocode} +% \end{macro} +% +% 兼容旧版本保留 \env{acknowledgement}。 +% \begin{macrocode} +\let\acknowledgement\acknowledgements +\let\endacknowledgement\endacknowledgements +% \end{macrocode} +% +% \subsubsection{插图和附表清单} +% \label{sec:threelists} +% 定义图表以及公式目录样式。 +% \begin{macrocode} +\def\thu@listof#1{% #1: float type + \setcounter{tocdepth}{2}% restore tocdepth in case being modified + \@ifstar{\thu@deprecate{starred form of \protect\listof... command}{}}{}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \thu@chapter*[]{\csname list#1name\endcsname}% + \else + \thu@chapter*{\csname list#1name\endcsname}% + \fi + \else + \ifthu@degree@graduate + \thu@chapter*{\csname list#1name\endcsname}% + \else + \thu@chapter*[]{\csname list#1name\endcsname}% + \fi + \fi + \@starttoc{\csname ext@#1\endcsname}% +} +% \end{macrocode} +% +% \begin{macro}{\listoffigures} +% 插图清单。 +% \begin{macrocode} +\renewcommand\listoffigures{% + \thu@listof{figure}% +} +\titlecontents{figure} + [\z@]{} + {\contentspush{\figurename~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\listoftables} +% 附表清单。 +% \begin{macrocode} +\renewcommand\listoftables{% + \thu@listof{table}% +} +\titlecontents{table} + [\z@]{} + {\contentspush{\tablename~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\listoffiguresandtables} +% 将插图和附表合在一起列出“插图和附表清单”。 +% \begin{macrocode} +\newcommand\listoffiguresandtables{% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \thu@chapter*[]{\thu@list@figure@table@name}% + \else + \thu@chapter*{\thu@list@figure@table@name}% + \fi + \else + \ifthu@degree@graduate + \thu@chapter*{\thu@list@figure@table@name}% + \else + \thu@chapter*[]{\thu@list@figure@table@name}% + \fi + \fi + \@starttoc{lof}% + \par + \null\par + \@starttoc{lot}% +} +% \end{macrocode} +% \end{macro} +% +% 公式的 caption 已过时。 +% \begin{macrocode} +\def\ext@equation{loe} +\def\equcaption#1{% + \thu@deprecate{"\protect\equcaption" command}{}% + \addcontentsline{\ext@equation}{equation}% + {\protect\numberline{#1}}} +% \end{macrocode} +% +% 公式索引 \cs{listofequations} 已过时。 +% \begin{macrocode} +\newcommand\listofequations{% + \thu@deprecate{"\protect\listofequations" command}{}% + \thu@listof{equation}% +} +\titlecontents{equation} + [0pt]{\addvspace{6bp}} + {\contentspush{\thu@equation@name~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +\contentsuse{equation}{loe} +% \end{macrocode} +% +% +% \subsection{参考文献} +% \label{sec:ref} +% +% 参考文献的格式根据用户选择的 \BibTeX{}/BibLaTeX 分别进行配置, +% 所以使用 \pkg{filehook} 的方式。 +% +% 设置 \option{cite-style} 的接口,只对 \BibTeX{} 的编译方式有效。 +% \begin{macrocode} +\thu@define@key{ + cite-style = { + name = cite@style, + choices = { + super, + inline, + author-year, + } + } +} +\newcommand\thu@bib@heading[1]{\thu@chapter*{#1}} +% \end{macrocode} +% +% \subsubsection{BibTeX + \pkg{natbib} 宏包} +% +% \begin{macrocode} +\def\bibliographystyle#1{% + \gdef\bu@bibstyle{#1}% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \immediate\write\@auxout{\string\bibstyle{#1}}% + \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}% + \fi}% +} +\def\bibliography#1{% + \if@filesw + \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}% + \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}% + \fi + \gdef\bu@bibdata{#1}% + \@input@{\jobname.bbl}} +% \end{macrocode} +% +% \BibTeX{} 和 \pkg{natbib} 宏包的配置。 +% \begin{macrocode} +\PassOptionsToPackage{compress}{natbib} +\AtEndOfPackageFile*{natbib}{ +% \end{macrocode} +% \begin{macro}{\inlinecite} +% 依赖于 \pkg{natbib} 宏包,修改其中的命令。 旧命令 \cs{onlinecite} 依然可用。 +% \begin{macrocode} + \DeclareRobustCommand\inlinecite{\@inlinecite} + \def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup} + \let\onlinecite\inlinecite +% \end{macrocode} +% \end{macro} +% +% 几种种引用样式,与 \file{bst} 文件名保持一致, +% 这样在使用 \cs{bibliographystyle} 选择参考文献表的样式时也会设置对应的引用样式。 +% \begin{macrocode} + \newcommand\bibstyle@super{% + \bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}} + \newcommand\bibstyle@inline{% + \bibpunct{[}{]}{,}{n}{,}{,}} + \@namedef{bibstyle@author-year}{% + \bibpunct{(}{)}{;}{a}{,}{,}} +% \end{macrocode} +% +% \begin{macrocode} + \thu@option@hook{cite-style}{\@nameuse{bibstyle@\thu@cite@style}} +% \end{macrocode} +% +% 几种种引用样式,与 \file{bst} 文件名保持一致, +% 这样在使用 \cs{bibliographystyle} 选择参考文献表的样式时也会设置对应的引用样式。 +% \begin{macrocode} + \@namedef{bibstyle@thuthesis-numeric}{\citestyle{super}} + \@namedef{bibstyle@thuthesis-author-year}{\citestyle{author-year}} + \@namedef{bibstyle@cell}{\citestyle{author-year}} + \@namedef{bibstyle@thuthesis-bachelor}{\citestyle{super}} +% \end{macrocode} +% +% 修改引用的样式。 +% 这里在 filehook 中无法使用 \cs{patchcmd},所以只能手动重定义。 +% +% 将 \cs{citep} super 式引用的页码改为上标。 +% \begin{macrocode} + \renewcommand\NAT@citesuper[3]{% + \ifNAT@swa + \if*#2*\else + #2\NAT@spacechar + \fi + % \unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}% + % \if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup} + \unskip\kern\p@ + \textsuperscript{% + \NAT@@open#1\NAT@@close + \if*#3*\else#3\fi + }% + \kern\p@ + \else + #1% + \fi + \endgroup + } +% \end{macrocode} +% +% 将 \cs{citep} numbers 式引用的页码改为上标并置于括号外。 +% \begin{macrocode} + \renewcommand\NAT@citenum[3]{% + \ifNAT@swa + \NAT@@open + \if*#2*\else + #2\NAT@spacechar + \fi + % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close + #1\NAT@@close + \if*#3*\else + \textsuperscript{#3}% + \fi + \else + #1% + \fi + \endgroup + } +% \end{macrocode} +% +% 修改 \cs{citet} 引用的样式。 +% \begin{macrocode} + \def\NAT@citexnum[#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty + \@for\@citeb:=\NAT@cite@list\do + {\@safe@activestrue + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \@safe@activesfalse + \@ifundefined{b@\@citeb\@extra@b@citeb}{% + {\reset@font\bfseries?} + \NAT@citeundefined\PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}}% + {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm + \NAT@parse{\@citeb}% + \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% + \let\NAT@name=\NAT@all@names + \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% + \fi + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \ifNAT@swa + \@ifnum{\NAT@ctype>\@ne}{% + \@citea + \NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}% + }{% + \@ifnum{\NAT@cmprs>\z@}{% + \NAT@ifcat@num\NAT@num + {\let\NAT@nm=\NAT@num}% + {\def\NAT@nm{-2}}% + \NAT@ifcat@num\NAT@last@num + {\@tempcnta=\NAT@last@num\relax}% + {\@tempcnta\m@ne}% + \@ifnum{\NAT@nm=\@tempcnta}{% + \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}% + }{% + \advance\@tempcnta by\@ne + \@ifnum{\NAT@nm=\@tempcnta}{% +% \end{macrocode} +% +% 在顺序编码制下,\pkg{natbib} 只有在三个以上连续文献引用才会使用连接号, +% 本科生的示例仅将连接号改为短横线。 +% 研究生与国标一致,连续两个序号也使用连接号, +% 参考 \url{https://tex.stackexchange.com/a/86991/82731}。 +% \begin{macrocode} + % \ifx\NAT@last@yr\relax + % \def@NAT@last@yr{\@citea}% + % \else + % \def@NAT@last@yr{--\NAT@penalty}% + % \fi + \ifthu@degree@bachelor + \ifx\NAT@last@yr\relax + \def@NAT@last@yr{\@citea}% + \else + \def@NAT@last@yr{-\NAT@penalty}% + \fi + \else + \def@NAT@last@yr{-\NAT@penalty}% + \fi + }{% + \NAT@last@yr@mbox + }% + }% + }{% + \@tempswatrue + \@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}% + \if@tempswa\NAT@citea@mbox\fi + }% + }% + \NAT@def@citea + \else + \ifcase\NAT@ctype + \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else + \@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}% + \fi + \if*#1*\else#1\NAT@spacechar\fi + \NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}% + \NAT@def@citea@box + \or + \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space\NAT@alias + \fi + \fi + }% + }% + \@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}% + \ifNAT@swa\else +% \end{macrocode} +% +% 将页码放在括号外边,并且置于上标。 +% \begin{macrocode} + % \@ifnum{\NAT@ctype=\z@}{% + % \if*#2*\else\NAT@cmt#2\fi + % }{}% + \NAT@mbox{\NAT@@close}% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else + \textsuperscript{#2}% + \fi + }{}% + \NAT@super@kern + \fi + }{#1}{#2}% + }% +% \end{macrocode} +% +% 修改 \cs{citep} author-year 式的页码: +% \begin{macrocode} + \renewcommand\NAT@cite% + [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi + % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup} + #1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup} +% \end{macrocode} +% +% 修改 \cs{citet} author-year 式的页码: +% \begin{macrocode} + \def\NAT@citex% + [#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty + \@for\@citeb:=\NAT@cite@list\do + {\@safe@activestrue + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \@safe@activesfalse + \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea% + {\reset@font\bfseries ?}\NAT@citeundefined + \PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}% + {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year + \NAT@parse{\@citeb}% + \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% + \let\NAT@name=\NAT@all@names + \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% + \fi + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \ifNAT@swa\ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}% + \else + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep + \ifx\NAT@last@yr\NAT@year + \def\NAT@temp{{?}}% + \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% + {Multiple citation on page \thepage: same authors and + year\MessageBreak without distinguishing extra + letter,\MessageBreak appears as question mark}\fi + \NAT@hyper@{\NAT@exlab}% + \else\unskip\NAT@spacechar + \NAT@hyper@{\NAT@date}% + \fi + \else + \@citea\NAT@hyper@{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{% + \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb + }% + \NAT@date + }% + \fi + \fi + \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NAT@hyper@{\NAT@date}% + \or\@citea\NAT@hyper@{\NAT@alias}% + \fi \NAT@def@citea + \else + \ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \else + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep + \ifx\NAT@last@yr\NAT@year + \def\NAT@temp{{?}}% + \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% + {Multiple citation on page \thepage: same authors and + year\MessageBreak without distinguishing extra + letter,\MessageBreak appears as question mark}\fi + \NAT@hyper@{\NAT@exlab}% + \else + \unskip\NAT@spacechar + \NAT@hyper@{\NAT@date}% + \fi + \else + \@citea\NAT@hyper@{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}% + {\@citeb\@extra@b@citeb}% + \NAT@date + }% + \fi + \fi + \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NAT@hyper@{\NAT@date}% + \or\@citea\NAT@hyper@{\NAT@alias}% + \fi + \if\relax\NAT@date\relax + \NAT@def@citea + \else + \NAT@def@citea@close + \fi + \fi + }}\ifNAT@swa\else +% \end{macrocode} +% +% 将页码放在括号外边,并且置于上标。 +% \begin{macrocode} + % \if*#2*\else\NAT@cmt#2\fi + \if\relax\NAT@date\relax\else\NAT@@close\fi + \if*#2*\else\textsuperscript{#2}\fi + \fi}{#1}{#2}} +% \end{macrocode} +% +% 参考文献表的正文部分用五号字。 +% 行距采用固定值 16 磅,段前空 3 磅,段后空 0 磅。 +% +% 本科生要求用五号字,行距采用固定值 16 磅,段前空 3 磅,段后空 0 磅。 +% 采用悬挂格式,悬挂缩进 2 个汉字符或 1 厘米。 +% +% 英文专业要求字号 10.5pt,行距用固定值 17pt,段前后 3pt,悬挂缩进 0.5inch(1.27 厘米)。 +% +% 复用 \pkg{natbib} 的 \texttt{thebibliography} 环境,调整距离。 +% \begin{macrocode} + \renewcommand\bibsection{\thu@bib@heading{\bibname}} + \newcommand\thu@set@bibliography@format{% + \renewcommand\bibfont{\fontsize{10.5bp}{16bp}\selectfont}% + \setlength{\bibsep}{3bp \@plus 3bp \@minus 3bp}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \setlength{\bibhang}{21bp}% 2em + \else + \renewcommand\bibfont{\fontsize{10.5bp}{17bp}\selectfont}% + \setlength{\bibsep}{6bp \@plus 3bp \@minus 3bp}% + \setlength{\bibhang}{0.5in}% + \fi + \else + \setlength{\bibhang}{21bp}% 2em + \fi + } + \thu@set@bibliography@format + \thu@option@hook{degree}{\thu@set@bibliography@format} + \thu@option@hook{main-language}{\thu@set@bibliography@format} +% \end{macrocode} +% +% 研究生要求每一条文献的内容要尽量写在同一页内。 +% 遇有被迫分页的情况,可通过“留白”或微调本页行距的方式尽量将同一条文献内容放在一页。 +% 所以上述 \cs{bibsep} 的设置允许 3pt 的伸缩, +% 同时增加同一条文献内分页的惩罚, +% 这里参考 \href{https://github.com/plk/biblatex/blob/e5d6e69e61613cc33ab1fcc2083a8277eb9cfce5/tex/latex/biblatex/biblatex.def}{BibLaTeX 的设置}。 +% \begin{macrocode} + \patchcmd\thebibliography{% + \clubpenalty4000% + }{% + \interlinepenalty=5000\relax + \clubpenalty=10000\relax + }{}{\thu@patch@error{\thebibliography}} + \patchcmd\thebibliography{% + \widowpenalty4000% + }{% + \widowpenalty=10000\relax + }{}{\thu@patch@error{\thebibliography}} +% \end{macrocode} +% +% 参考文献表的编号居左,宽度 1 cm。 +% \begin{macrocode} + \def\@biblabel#1{[#1]\hfill} + \renewcommand\NAT@bibsetnum[1]{% + % \settowidth\labelwidth{\@biblabel{#1}}% + % \setlength{\leftmargin}{\labelwidth}% + % \addtolength{\leftmargin}{\labelsep}% + \setlength{\labelwidth}{1cm}% + \setlength{\leftmargin}{\labelwidth}% + \setlength{\labelsep}{\z@}% + \setlength{\itemsep}{\bibsep}% + \setlength{\parsep}{\z@}% + \ifNAT@openbib + \addtolength{\leftmargin}{\bibindent}% + \setlength{\itemindent}{-\bibindent}% + \setlength{\listparindent}{\itemindent}% + \setlength{\parsep}{0pt}% + \fi + } +} +% \end{macrocode} +% +% \subsubsection{\pkg{biblatex} 宏包} +% +% \begin{macrocode} +\AtEndOfPackageFile*{biblatex}{ + \AtBeginDocument{ + \ifthenelse{\equal{\blx@bbxfile}{apa}}{\def\bibname{REFERENCES}}{} + \ifthenelse{\equal{\blx@bbxfile}{apa6}}{\def\bibname{REFERENCES}}{} + \ifthenelse{\equal{\blx@bbxfile}{mla}}{\def\bibname{WORKS CITED}}{} + \ifthenelse{\equal{\blx@bbxfile}{mla-new}}{\def\bibname{WORKS CITED}}{} + } + \DeclareRobustCommand\inlinecite{\parencite} + \defbibheading{bibliography}[\bibname]{\thu@bib@heading{#1}} + \newcommand\thu@set@bibliography@format{% + \renewcommand\bibfont{\fontsize{10.5bp}{16bp}\selectfont}% + \setlength{\bibitemsep}{3bp \@plus 3bp \@minus 3bp}% + % 在 .bbx 中设置 \labelwidth 为 1 cm,\labelsep 为 0 pt。 + \setlength{\biblabelsep}{0pt}% + \ifthu@degree@bachelor + \ifthu@main@language@chinese + \setlength{\bibhang}{21bp}% 2em + \else + \renewcommand\bibfont{\fontsize{10.5bp}{17bp}\selectfont}% + \setlength{\bibitemsep}{6bp \@plus 3bp \@minus 3bp}% + \setlength{\bibhang}{0.5in}% + \fi + \else + \setlength{\bibhang}{21bp}% 2em + \fi + } + \thu@set@bibliography@format + \thu@option@hook{degree}{\thu@set@bibliography@format} + \thu@option@hook{main-language}{\thu@set@bibliography@format} +} +% \end{macrocode} +% +% \subsubsection{\pkg{apacite} 宏包} +% +% \pkg{apacite} 在 \cs{begindocument} 处载入的 \file{english.apc} +% 会覆盖掉 \cs{bibname} 的定义,所以需要重新 \cs{thu@set@chapter@names}。 +% \begin{macrocode} +\AtEndOfPackageFile*{apacite}{ + \AtBeginDocument{ + \thu@set@chapter@names + } + \renewcommand\bibliographytypesize{\fontsize{10.5bp}{16bp}\selectfont} + \setlength{\bibitemsep}{3bp \@plus 3bp \@minus 3bp}% + \ifthu@degree@bachelor + \ifthu@main@language@english + \renewcommand\bibliographytypesize{\fontsize{10.5bp}{17bp}\selectfont}% + \setlength{\bibitemsep}{6bp \@plus 3bp \@minus 3bp}% + \fi + \fi + \ifthu@main@language@chinese + \setlength{\bibleftmargin}{1cm} + \setlength{\bibindent}{-\bibleftmargin} + \else + \setlength{\bibleftmargin}{0.5in} + \setlength{\bibindent}{-\bibleftmargin} + \fi + \def\st@rtbibchapter{% + \if@numberedbib% + \chapter{\bibname}% e.g., 6. References + \else% + \thu@chapter*{\bibname}% e.g., References + \fi% + }% +} +% \end{macrocode} +% +% \subsection{附录} +% \label{sec:appendix} +% +% \begin{macrocode} +\g@addto@macro\appendix{% + \@mainmattertrue +} +% \end{macrocode} +% +% 研究生和本科生的写作指南均未规定附录的节标题是否加入目录, +% 但是从示例来看,目录中只出现附录的 chapter 标题, +% 不出现附录中的 section 及 subsection 的标题。 +% 部分院系(例如自动化系)的格式审查的老师甚至一致口头如此要求。 +% (\href{https://github.com/tuna/thuthesis/pull/425}{\#425}) +% \begin{macrocode} +\thu@define@key{ + toc-depth = { + name = toc@depth, + }, +} +% \end{macrocode} +% +% 这里不要使用 \cs{addcontentsline}, +% 避免写入 \pkg{titletoc} 的 \file{.ptc} 文件中, +% 造成附录的子目录中 |tocdepth| 为 0。 +% \begin{macrocode} +\thu@option@hook{toc-depth}{% + \ifx\@begindocumenthook\@undefined + \protected@write\@auxout{}{% + \string\ttl@writefile{toc}{% + \protect\setcounter{tocdepth}{\thu@toc@depth}% + }% + }% + \else + \setcounter{tocdepth}{\thu@toc@depth}% + \fi +} +\g@addto@macro\appendix{% + \thusetup{ + toc-depth = 0, + }% +} +% \end{macrocode} +% +% 附录中的图、表不列入插图清单/附表清单。 +% \begin{macrocode} +\thu@define@key{ + appendix-figure-in-lof = { + name = appendix@figure@in@lof, + choices = { + true, + false, + }, + default = false, + }, +} +\thu@option@hook{appendix-figure-in-lof}{% + \ifthu@appendix@figure@in@lof@true + \addtocontents{lof}{\string\let\string\contentsline\string\ttl@contentsline}% + \addtocontents{lot}{\string\let\string\contentsline\string\ttl@contentsline}% + \addtocontents{loe}{\string\let\string\contentsline\string\ttl@contentsline}% + \else + \addtocontents{lof}{\string\let\string\contentsline\string\ttl@gobblecontents}% + \addtocontents{lot}{\string\let\string\contentsline\string\ttl@gobblecontents}% + \addtocontents{loe}{\string\let\string\contentsline\string\ttl@gobblecontents}% + \fi +} +\g@addto@macro\appendix{% + \thusetup{ + appendix-figure-in-lof = false, + }% +} +% \end{macrocode} +% +% 附录中的参考文献等另行编序号。 +% \begin{macrocode} +\newcommand\thu@appendix@bib@heading[1]{% + \begingroup + \ctexset{section/numbering = false}% + \ifthu@degree@bachelor + \ctexset{section = { + format = \centering\fontsize{12bp}{14.4bp}\selectfont, + beforeskip = 66bp, + afterskip = 4bp, + }}% + \fi + \section{#1}% + \endgroup +} +\g@addto@macro\appendix{% + \let\thu@bib@heading\thu@appendix@bib@heading +} +\newcommand\thu@end@appendix@ref@section{} +% \end{macrocode} +% +% \pkg{bibunits} 在载入时会保存 \cs{bibliography} 和 \cs{bibliographystyle}, +% 所以在载入宏包前修改定义。 +% \begin{macrocode} +\AtBeginOfPackageFile*{bibunits}{ + \def\bibliography#1{% + \if@filesw + \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}% +% \end{macrocode} +% +% 正文的 \cs{bibliography} 同时设置附录参考文献的默认 \file{.bib} 数据库。 +% \begin{macrocode} + \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}% + \fi + \@input@{\jobname.bbl}% + \gdef\bu@bibdata{#1}% + } + \def\bibliographystyle#1{% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \immediate\write\@auxout{\string\bibstyle{#1}}% +% \end{macrocode} +% +% 正文的 \cs{bibliographystyle} 同时设置附录参考文献的默认 \file{.bst} 样式。 +% \begin{macrocode} + \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}% + \fi}% + \gdef\bu@bibstyle{#1}% + } +} +\AtEndOfPackageFile*{bibunits}{ + \def\@startbibunit{% + \global\let\@startbibunitorrelax\relax + \global\let\@finishbibunit\@finishstartedbibunit + \global\advance\@bibunitauxcnt 1 + \if@filesw + {\endlinechar-1 +% \end{macrocode} +% +% 使附录 aux 文件的 \cs{gdef}\cs{@localbibstyle} 能够生效。 +% \begin{macrocode} + \makeatletter + \@input{\@bibunitname.aux}}% + \immediate\openout\@bibunitaux\@bibunitname.aux + \immediate\write\@bibunitaux{\string\bibstyle{\@localbibstyle}}% + \fi + } + \def\bu@bibliography#1{% + \putbib[#1]% + } + \def\bu@bibliographystyle#1{% + \if@filesw + \immediate\write\@bibunitaux{\string\gdef\string\@localbibstyle{#1}}% + \fi + \gdef\@localbibstyle{#1}% + } + \providecommand\printbibliography{\putbib\relax}% + \g@addto@macro\appendix{% + \renewcommand\@bibunitname{\jobname-appendix-\@alph\c@chapter}% + \bibliographyunit[\chapter]% +% \end{macrocode} +% +% 研究生附录的引用编号加前缀,如附录 A 的引用 [1] 为 [A.1]。 +% \begin{macrocode} + \renewcommand\@extra@binfo{@-\@alph\c@chapter}% + \renewcommand\@extra@b@citeb{@-\@alph\c@chapter}% + \ifthu@degree@bachelor\else + \renewcommand\citenumfont{\@Alph\c@chapter.}% + \renewcommand\bibnumfmt[1]{[\@Alph\c@chapter.#1]\hfill}% + \fi + } + \renewcommand\thu@end@appendix@ref@section{% + \bibliographyunit\relax + } + \AtEndDocument{\thu@end@appendix@ref@section} +% \end{macrocode} +% +% 如果正文和附录引用了同一文献,\pkg{bibunits} 会给出无意义的警告,这里消除警告。 +% \begin{macrocode} + % \let\@xtestdef\@gobbletwo % This doesn't work + \def\bibunits@rerun@warning{\relax} +} +\PassOptionsToPackage{defernumbers=true}{biblatex} +\AtEndOfPackageFile*{biblatex}{ + \DeclareRefcontext{appendix}{labelprefix=\@Alph\c@chapter.} + \g@addto@macro\appendix{% + % 参考 biblatex 的 refsection=chapter 选项实现方式, + % 在 \@makechapterhead 和 \@makeschapterhead 进行 patch + \pretocmd\@makechapterhead{% + \newrefsection + \ifthu@degree@bachelor\else + \newrefcontext{appendix}% + \fi + }{}{\thu@patch@error{\@makechapterhead}}% + \pretocmd\@makeschapterhead{% + \newrefsection + \ifthu@degree@bachelor\else + \newrefcontext{appendix}% + \fi + }{}{\thu@patch@error{\@makeschapterhead}}% + } + \def\bibliographystyle#1{% + \thu@warning{'bibliographystyle' invalid for 'biblatex'.}% + } +} +% \end{macrocode} +% +% 注意 \pkg{titletoc} 在 2019/07/14 v2.11.1702 修改了 \cs{printcontents} 接口, +% 而且 \cs{@ifpackagelater} 只能用在导言区中,所以需要定义辅助宏。 +% \begin{macrocode} +\@ifpackagelater{titletoc}{2019/07/14}{ + \newcommand\thu@print@contents[5]{% + \printcontents[#1]{#2}{#3}[#4]{}% + } +}{ + \newcommand\thu@print@contents[5]{% + \printcontents[#1]{#2}{#3}{\setcounter{tocdepth}{#4}#5}% + } +} +% \end{macrocode} +% +% 外文资料的调研阅读报告(已过时)。 +% \begin{macrocode} +\newenvironment{survey}{% + \thu@deprecate{"survey" environment}{}% + \chapter{外文资料的调研阅读报告}% + \thusetup{language = english}% + \let\title\@gobble + \let\maketitle\relax + \let\tableofcontents\relax + \let\appendix\relax + \renewcommand\bibname{参考文献}% +}{% + \thu@reset@main@language % restore language +} +% \end{macrocode} +% +% 外文资料的书面翻译(已过时)。 +% \begin{macrocode} +\newenvironment{translation}{% + \thu@deprecate{"translation" environment}{}% + \chapter{外文资料的书面翻译}% + \thusetup{language = chinese}% + \let\title\@gobble + \let\maketitle\relax + \renewenvironment{abstract}{% + \ctexset{ + section = { + format += \centering, + numbering = false, + }, + }% + \section{摘要}% + }{% + \par + \ifx\thu@keywords\@empty\else + \textbf{关键词:}\thu@clist@use{\thu@keywords}{;}\par + \fi + }% + \let\tableofcontents\relax + \let\appendix\relax +}{% + \thu@reset@main@language % restore language +} +% \end{macrocode} +% +% 书面翻译对应的原文索引,区别于译文的参考文献。 +% \begin{macrocode} +\NewEnviron{translation-index}{% + \thu@deprecate{"translation-index" environment}{}% +}{} +% \end{macrocode} +% +% +% \subsection{个人简历} +% +% \begin{environment}{resume} +% 个人简历发表文章等。 +% \begin{macrocode} +\newenvironment{resume}{% + \@mainmatterfalse + \thu@end@appendix@ref@section + \thu@chapter*{\thu@resume@name}% + \ctexset{section/numbering = false}% + \ifthu@degree@bachelor + \ctexset{section/aftertitle = {:\@@par}}% + \else + \ctexset{section/format += \centering}% + \fi + \ifthu@language@chinese + \ctexset{ + subsection = { + format = \sffamily\fontsize{14bp}{20bp}\selectfont, + numbering = false, + aftertitle = {:\@@par}, + }, + }% + \setlist[achievements]{ + topsep = 6bp, + itemsep = 6bp, + leftmargin = 1cm, + labelwidth = 1cm, + labelsep = 0pt, + first = { + \ifthu@degree@graduate + \fontsize{12bp}{16bp}\selectfont + \fi + }, + align = left, + label = [\arabic*], + resume = achievements, + }% + \else + \ctexset{ + subsection = { + beforeskip = 0pt, + afterskip = 0pt, + format = \bfseries\normalsize, + indent = \parindent, + numbering = false, + }, + }% + \ifthu@degree@bachelor + % 内容部分用Arial字体,字号15pt,行距采用固定值20pt, 段前后 0pt。 + \sffamily\fontsize{15bp}{20bp}\selectfont + \fi + \setlist[achievements]{ + topsep = 0bp, + itemsep = 0bp, + leftmargin = 1.75cm, + labelsep = 0.5cm, + align = right, + label = [\arabic*], + resume = achievements, + }% + \fi +}{} +% \end{macrocode} +% \end{environment} +% +% 旧的 \cs{resumeitem} 和 \cs{researchitem} 已经过时。 +% \begin{macrocode} +\newcommand\resumeitem[1]{% + \thu@error{The "\protect\resumeitem" is obsolete. Please update to the new format}% +} +\newcommand\researchitem[1]{% + \thu@error{The "\protect\researchitem" is obsolete. Please update to the new format}% +} +% \end{macrocode} +% +% \begin{environment}{achievements} +% 学术成果由 \env{achievements} 环境罗列。 +% \begin{macrocode} +\newlist{achievements}{enumerate}{1} +\setlist[achievements]{ + topsep = 6bp, + partopsep = 0bp, + itemsep = 6bp, + parsep = 0bp, + leftmargin = 10mm, + itemindent = 0pt, + align = left, + label = [\arabic*], + resume = achievements, +} +% \end{macrocode} +% \end{environment} +% +% \begin{macrocode} +\newenvironment{publications}{% + \thu@deprecate{"publications" environment}{"achievements"}% + \begin{achievements}% +}{% + \end{achievements}% +} +\newcommand\publicationskip{% + \thu@error{The "\protect\publicationskip" is obsolete. Do not use it}% +} +% \end{macrocode} +% +% \subsection{指导教师/小组学术评语} +% \begin{environment}{comments} +% \begin{macrocode} +\NewEnviron{comments}[1][]{% + \thu@end@appendix@ref@section + \ifthu@degree@graduate + \@mainmatterfalse + \kv@define@key{thu@comments}{name}{\let\thu@comments@name\kv@value}% + \kv@set@family@handler{thu@comments}{% + \ifx\kv@value\relax + \let\thu@comments@name\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@comments}{#1}% + \chapter{\thu@comments@name}% + \BODY\clearpage + \fi +} +% \end{macrocode} +% \end{environment} +% +% \subsection{答辩委员会决议书} +% \begin{environment}{resolution} +% \begin{macrocode} +\NewEnviron{resolution}{% + \thu@end@appendix@ref@section + \ifthu@degree@graduate + \@mainmatterfalse + \chapter{\thu@resolution@name}% + \BODY\clearpage + \fi +} +% \end{macrocode} +% \end{environment} +% +% \subsection{综合论文训练记录表} +% +% \begin{macro}{\record} +% (本科生专用)插入综合论文训练记录表的 PDF 版本,并加入书签。 +% +% \begin{macrocode} +\newcommand{\record}[1]{% + \ifthu@degree@bachelor + \let\thu@record@file\@empty + \kv@define@key{thu@record}{file}{\let\thu@record@file\kv@value}% + \kv@set@family@handler{thu@record}{% + \ifx\kv@value\relax + \let\thu@record@file\kv@key + \else + \kv@handled@false + \fi + }% + \kvsetkeys{thu@record}{#1}% + \ifx\thu@record@file\@empty + \thu@error{File path of \protect\record\space is required} + \fi + \clearpage + \thu@pdfbookmark{0}{综合论文训练记录表}% + \includepdf[pages=-]{\thu@record@file}% + \fi + \thu@replace@with@error{record} +} +% \end{macrocode} +% +% \end{macro} +% +% \subsection{其他宏包的设置} +% +% 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。 +% +% \subsubsection{\pkg{hyperref} 宏包} +% +% 使用 \cs{PassOptionsToPackage} 的方式进行配置,允许用户在 \cs{usepackage} +% 覆盖配置(\href{https://github.com/tuna/thuthesis/issues/863}{tuna/thuthesis\#863})。 +% +% \begin{macrocode} +\PassOptionsToPackage{ + linktoc = all, + bookmarksdepth = 2, + bookmarksnumbered = true, + bookmarksopen = true, + bookmarksopenlevel = 1, + bookmarksdepth = 3, + unicode = true, + psdextra = true, + breaklinks = true, + plainpages = false, + pdfdisplaydoctitle = true, + hidelinks, +}{hyperref} +\AtEndOfPackageFile*{hyperref}{ + \newcounter{thu@bookmark} + \renewcommand\thu@pdfbookmark[2]{% + \phantomsection + \stepcounter{thu@bookmark}% + \pdfbookmark[#1]{#2}{thuchapter.\thethu@bookmark}% + } + \renewcommand\thu@phantomsection{% + \phantomsection + } + \pdfstringdefDisableCommands{% + \let\\\relax + \let\quad\relax + \let\qquad\relax + \let\hspace\@gobble + }% +% \end{macrocode} +% +% \pkg{hyperref} 与 \pkg{unicode-math} 存在一些兼容性问题,见 +% \href{https://github.com/ustctug/ustcthesis/issues/223}{% +% ustctug/ustcthesis\#223}, +% \href{https://github.com/ho-tex/hyperref/pull/90}{ho-tex/hyperref\#90} 和 +% \href{https://github.com/ustctug/ustcthesis/issues/235}{% +% ustctug/ustcthesis/\#235}。 +% \begin{macrocode} + \@ifpackagelater{hyperref}{2019/04/27}{}{% + \g@addto@macro\psdmapshortnames{\let\mu\textmu} + }% + \ifthu@main@language@chinese + \hypersetup{ + pdflang = zh-CN, + }% + \else + \hypersetup{ + pdflang = en-US, + }% + \fi + \AtBeginDocument{% + \ifthu@main@language@chinese + \hypersetup{ + pdftitle = \thu@title, + pdfauthor = \thu@author, + pdfsubject = \thu@discipline, + pdfkeywords = \thu@keywords, + }% + \else + \hypersetup{ + pdftitle = \thu@title@en, + pdfauthor = \thu@author@en, + pdfsubject = \thu@discipline@en, + pdfkeywords = \thu@keywords@en, + }% + \fi + \hypersetup{ + pdfcreator={\thuthesis-v\version}} + }% +} +% \end{macrocode} +% +% \subsubsection{\pkg{mathtools} 宏包} +% +% \pkg{mathtools} 会修改 \pkg{unicode-math} 的 \cs{underbrace} 和 \cs{overbrace}, +% 需要还原为 \cs{LaTeXunderbrace} 和 \cs{LaTeXoverbrace}, +% 参考 \url{https://tex.stackexchange.com/q/521394/82731}。 +% \begin{macrocode} +\AtEndOfPackageFile*{mathtools}{ + \@ifpackageloaded{unicode-math}{ + \let\underbrace\LaTeXunderbrace + \let\overbrace\LaTeXoverbrace + }{} + \expandafter\def\csname MT_extended_eqref:n\endcsname#1{% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \unskip + \fi + \fi + \protected@write\@auxout{} + {\string\MT@newlabel{#1}}% + \textup{\let\df@label\@empty\csname MT_prev_tagform:n\endcsname{\ref{#1}}}% + \ifthu@language@chinese + \ifthu@eqn@paren@style@full + \ignorespaces + \fi + \fi + } + \expandafter\MakeRobust\csname MT_extended_eqref:n\endcsname +} +% \end{macrocode} +% +% \subsubsection{\pkg{nomencl} 宏包} +% +% \begin{macrocode} +\PassOptionsToPackage{notocbasic}{nomencl} +\AtEndOfPackageFile*{nomencl}{ + \let\nomname\thu@denotation@name + \def\thenomenclature{\begin{denotation}[\nom@tempdim]} + \def\endthenomenclature{\end{denotation}} +} +% \end{macrocode} +% +% \subsubsection{\pkg{siunitx} 宏包} +% +% \begin{macrocode} +\AtEndOfPackageFile*{siunitx}{% + \newcommand\thu@set@siunitx@language{% + \ifthu@language@chinese + \sisetup{ + list-final-separator = {\TextOrMath{\space}{\ }\text{和}\TextOrMath{\space}{\ }}, + list-pair-separator = {\TextOrMath{\space}{\ }\text{和}\TextOrMath{\space}{\ }}, + range-phrase = {\text{~}}, + }% + \else + \ifthu@language@english + \sisetup{ + list-final-separator = {\TextOrMath{\space}{\ }\text{and}\TextOrMath{\space}{\ }}, + list-pair-separator = {\TextOrMath{\space}{\ }\text{and}\TextOrMath{\space}{\ }}, + range-phrase = {\TextOrMath{\space}{\ }\text{to}\TextOrMath{\space}{\ }}, + }% + \fi + \fi + } + \thu@set@siunitx@language + \thu@option@hook{language}{\thu@set@siunitx@language} +} +% \end{macrocode} +% +% \subsubsection{\pkg{amsthm} 宏包} +% +% 定理标题使用黑体,正文使用宋体,冒号隔开。 +% \begin{macrocode} +\AtEndOfPackageFile*{amsthm}{% + \newtheoremstyle{thu} + {\z@}{\z@} + {\normalfont}{\z@} + {\normalfont\sffamily}{\thu@theorem@separator} + {0.5em}{} + \theoremstyle{thu} + \newtheorem{assumption}{\thu@assumption@name}[chapter]% + \newtheorem{definition}{\thu@definition@name}[chapter]% + \newtheorem{proposition}{\thu@proposition@name}[chapter]% + \newtheorem{lemma}{\thu@lemma@name}[chapter]% + \newtheorem{theorem}{\thu@theorem@name}[chapter]% + \newtheorem{axiom}{\thu@axiom@name}[chapter]% + \newtheorem{corollary}{\thu@corollary@name}[chapter]% + \newtheorem{exercise}{\thu@exercise@name}[chapter]% + \newtheorem{example}{\thu@example@name}[chapter]% + \newtheorem{remark}{\thu@remark@name}[chapter]% + \newtheorem{problem}{\thu@problem@name}[chapter]% + \newtheorem{conjecture}{\thu@conjecture@name}[chapter]% + \renewenvironment{proof}[1][\thu@proof@name]{\par + \pushQED{\qed}% + % \normalfont \topsep6\p@\@plus6\p@\relax + \normalfont \topsep\z@\relax + \trivlist + \item[\hskip\labelsep + % \itshape + % #1\@addpunct{.}]\ignorespaces + \sffamily + #1]\ignorespaces + }{% + \popQED\endtrivlist\@endpefalse + } + \renewcommand\qedsymbol{\thu@qed} +} +% \end{macrocode} +% +% \subsubsection{\pkg{ntheorem} 宏包} +% +% 定理标题使用黑体,正文使用宋体,冒号隔开。 +% \begin{macrocode} +\AtEndOfPackageFile*{ntheorem}{% + \theorembodyfont{\normalfont}% + \theoremheaderfont{\normalfont\sffamily}% + \theoremsymbol{\thu@qed}% + \newtheorem*{proof}{\thu@proof@name}% + \theoremstyle{plain}% + \theoremsymbol{}% + \theoremseparator{\thu@theorem@separator}% + \newtheorem{assumption}{\thu@assumption@name}[chapter]% + \newtheorem{definition}{\thu@definition@name}[chapter]% + \newtheorem{proposition}{\thu@proposition@name}[chapter]% + \newtheorem{lemma}{\thu@lemma@name}[chapter]% + \newtheorem{theorem}{\thu@theorem@name}[chapter]% + \newtheorem{axiom}{\thu@axiom@name}[chapter]% + \newtheorem{corollary}{\thu@corollary@name}[chapter]% + \newtheorem{exercise}{\thu@exercise@name}[chapter]% + \newtheorem{example}{\thu@example@name}[chapter]% + \newtheorem{remark}{\thu@remark@name}[chapter]% + \newtheorem{problem}{\thu@problem@name}[chapter]% + \newtheorem{conjecture}{\thu@conjecture@name}[chapter]% +} +% \end{macrocode} +% +% \subsubsection{\pkg{algorithm} 宏包} +% +% 使 \env{algorithm} 和 \env{listing} 环境的名称随语言设置而改变, +% 并使其在附录中的编号规则与图、表等一致。 +% +% \begin{macro}{\listofalgorithm} +% \begin{macro}{\listofalgorithm*} +% \begin{macrocode} +\PassOptionsToPackage{chapter}{algorithm} +\AtEndOfPackageFile*{algorithm}{ + \floatname{algorithm}{\thu@algorithm@name} + \renewcommand\listofalgorithms{% + \thu@listof{algorithm}% + } + \renewcommand\listalgorithmname{\thu@list@algorithm@name} + \def\ext@algorithm{loa} + \contentsuse{algorithm}{loa} + \titlecontents{algorithm} + [\z@]{} + {\contentspush{\fname@algorithm~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{\pkg{algorithm2e} 宏包} +% +% \begin{macrocode} +\PassOptionsToPackage{algochapter}{algorithm2e} +\AtEndOfPackageFile*{algorithm2e}{ + \renewcommand\algorithmcfname{\thu@algorithm@name} + \SetAlgoCaptionLayout{thu@caption@font} + \SetAlCapSty{relax} + \SetAlgoCaptionSeparator{\hspace*{1em}} + \SetAlFnt{\fontsize{11bp}{14.3bp}\selectfont} + \renewcommand\listofalgorithms{% + \thu@listof{algorithmcf}% + } + \renewcommand\listalgorithmcfname{\thu@list@algorithm@name} + \def\ext@algorithmcf{loa} + \contentsuse{algocf}{loa} + \titlecontents{algocf} + [\z@]{} + {\contentspush{\algorithmcfname~\thecontentslabel\thu@contents@label@delimiter}}{} + {\thu@leaders\thecontentspage} +} +% \end{macrocode} +% +% \subsubsection{\pkg{minted} 宏包} +% +% \begin{macrocode} +\AtEndOfPackageFile*{minted}{ + \newcommand\thu@set@listing@language{% + \ifthu@language@chinese + \floatname{listing}{代码}% + \else + \floatname{listing}{Listing}% + \fi + } + \thu@set@listing@language + \thu@option@hook{language}{\thu@set@listing@language} +} +% \end{macrocode} +% +% \subsection{书脊} +% \label{sec:spine} +% \begin{macro}{\spine} +% 单独使用书脊命令会在新的一页产生竖排书脊, +% 参考 \url{https://tex.stackexchange.com/a/38585}。 +% +% 本科生: +% 书脊的书写要求:用仿宋\_GB2312 字书写,字体大小根据论文的薄厚而定。 +% 书脊上方写论文题目,下方写本科生姓名,距上下页边均为 3cm。 +% +% 研究生: +% 博士论文的书脊使用三号字,硕士的为小三号。 +% 示例中上下页边距为 5.5 cm,左右边距为 1 cm。 +% \begin{macrocode} +\thu@define@key{ + spine-font = { + name = spine@font, + }, + spine-title = { + name = spine@title, + }, + spine-author = { + name = spine@author, + }, +} +\renewcommand\thu@spine@font{% + \ifthu@degree@doctor + \fontsize{16bp}{20.8bp}\selectfont + \else + \fontsize{15bp}{19.5bp}\selectfont + \fi +} +\newcommand*\CJKmovesymbol[1]{\raise.3em\hbox{#1}} +\newcommand*\CJKmove{% + \punctstyle{plain}% + \let\CJKsymbol\CJKmovesymbol + \let\CJKpunctsymbol\CJKsymbol +} +\NewDocumentCommand{\spine}{ + O{ + \ifx\thu@spine@title\@empty + \thu@title + \else + \thu@spine@title + \fi + } + O{ + \ifx\thu@spine@author\@empty + \thu@author + \else + \thu@spine@author + \fi + }}{% + \clearpage + \ifthu@degree@bachelor + \newgeometry{ + vmargin = 3cm, + hmargin = 1cm, + }% + \else + \newgeometry{ + vmargin = 5.5cm, + hmargin = 1cm, + }% + \fi + \thispagestyle{empty}% + \ifthu@main@language@chinese + \thu@pdfbookmark{0}{书脊}% + \else + \thu@pdfbookmark{0}{Spine}% + \fi + \begingroup + \noindent\hfill + \rotatebox[origin=lt]{-90}{% + \makebox[\textheight]{% + \fangsong + \addCJKfontfeatures*{RawFeature={vertical}}% + \thu@spine@font + \CJKmove + #1\hfill + \thu@stretch{4.5em}{#2}% + }% + }% + \endgroup + \clearpage + \restoregeometry +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{其它} +% \label{sec:other} +% +% 借用 \cls{ltxdoc} 和 \cls{l3doc} 里面的几个命令方便写文档。 +% \begin{macrocode} +\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} +\DeclareRobustCommand\file{\nolinkurl} +\DeclareRobustCommand\env{\textsf} +\DeclareRobustCommand\pkg{\textsf} +\DeclareRobustCommand\cls{\textsf} +% \end{macrocode} +% +% \begin{macrocode} +\sloppy +% +% \end{macrocode} +% +% +% \iffalse +% \begin{macrocode} +%<*dtx-style> +\ProvidesPackage{dtx-style} +\RequirePackage{hypdoc} +\RequirePackage{ifthen} +\RequirePackage{fontspec}[2017/01/20] +\RequirePackage{amsmath} +\RequirePackage{unicode-math} +\RequirePackage{siunitx} +\RequirePackage[UTF8,scheme=chinese]{ctex} +\RequirePackage[ + top=2.5cm, bottom=2.5cm, + left=4cm, right=2cm, + headsep=3mm]{geometry} +\RequirePackage{hologo} +\RequirePackage{array,longtable,booktabs} +\RequirePackage{listings} +\RequirePackage{fancyhdr} +\RequirePackage{xcolor} +\RequirePackage{enumitem} +\RequirePackage{etoolbox} +\RequirePackage{metalogo} +\RequirePackage[tightLists=false]{markdown} + +\markdownSetup{ + renderers = { + link = {\href{#2}{#1}}, + } +} + +\hypersetup{ + pdflang = zh-CN, + pdftitle = {ThuThesis:清华大学学位论文模板}, + pdfauthor = {清华大学 TUNA 协会}, + pdfsubject = {清华大学学位论文模板使用说明}, + pdfkeywords = {论文模板; 清华大学; 使用说明}, + pdfdisplaydoctitle = true +}% + +\setmainfont[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, +]{texgyrepagella} +\setsansfont[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, +]{texgyreheros} +\setmonofont[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Scale = MatchLowercase, + Ligatures = CommonOff, +]{texgyrecursor} + +\unimathsetup{ + math-style=ISO, + bold-style=ISO, +} +\DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}} +\IfFontExistsTF{XITSMath-Regular.otf}{ + \setmathfont[ + Extension = .otf, + BoldFont = XITSMath-Bold, + StylisticSet = 8, + ]{XITSMath-Regular} + \setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf} +}{ + \setmathfont[ + Extension = .otf, + BoldFont = *bold, + StylisticSet = 8, + ]{xits-math} + \setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf} +} + +\colorlet{thu@macro}{blue!60!black} +\colorlet{thu@env}{blue!70!black} +\colorlet{thu@option}{purple} +\patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{} +\patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{} +\patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{} +\patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{} + +\def\DescribeOption{% + \leavevmode\@bsphack\begingroup\MakePrivateLetters% + \Describe@Option} +\def\Describe@Option#1{\endgroup + \marginpar{\raggedleft\PrintDescribeOption{#1}}% + \thu@special@index{option}{#1}\@esphack\ignorespaces} +\def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{thu@option} #1\ } +\def\thu@special@index#1#2{\@bsphack + \begingroup + \HD@target + \let\HDorg@encapchar\encapchar + \edef\encapchar usage{% + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% + }% + \index{#2\actualchar{\string\ttfamily\space#2} + (#1)\encapchar usage}% + \index{#1:\levelchar#2\actualchar + {\string\ttfamily\space#2}\encapchar usage}% + \endgroup + \@esphack} + +\lstdefinestyle{lstStyleBase}{% + basicstyle=\small\ttfamily, + aboveskip=\medskipamount, + belowskip=\medskipamount, + lineskip=0pt, + boxpos=c, + showlines=false, + extendedchars=true, + upquote=true, + tabsize=2, + showtabs=false, + showspaces=false, + showstringspaces=false, + numbers=none, + linewidth=\linewidth, + xleftmargin=4pt, + xrightmargin=0pt, + resetmargins=false, + breaklines=true, + breakatwhitespace=false, + breakindent=0pt, + breakautoindent=true, + columns=flexible, + keepspaces=true, + gobble=4, + framesep=3pt, + rulesep=1pt, + framerule=1pt, + backgroundcolor=\color{gray!5}, + stringstyle=\color{green!40!black!100}, + keywordstyle=\bfseries\color{blue!50!black}, + commentstyle=\slshape\color{black!60}} + +\lstdefinestyle{lstStyleShell}{% + style=lstStyleBase, + frame=l, + rulecolor=\color{purple}, + language=bash} + +\lstdefinestyle{lstStyleLaTeX}{% + style=lstStyleBase, + frame=l, + rulecolor=\color{violet}, + language=[LaTeX]TeX} + +\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{} +\lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{} + +\setlist{nosep} + +\DeclareDocumentCommand{\option}{m}{\textsf{#1}} +\DeclareDocumentCommand{\env}{m}{\texttt{#1}} +\DeclareDocumentCommand{\pkg}{s m}{% + \textsf{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}} +\DeclareDocumentCommand{\cls}{s m}{% + \textsf{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}} +\DeclareDocumentCommand{\file}{s m}{% + \nolinkurl{#2}\IfBooleanF#1{\thu@special@index{file}{#2}}} +\newcommand{\myentry}[1]{% + \marginpar{\raggedleft\color{purple}\bfseries\strut #1}} +\newcommand{\note}[2][Note]{{% + \color{magenta}{\bfseries #1}\emph{#2}}} + +\g@addto@macro\UrlBreaks{% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9% + \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M + \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m + \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z +} +\Urlmuskip=0mu plus 0.1mu + +\DeclareDocumentCommand{\githubuser}{m}{\href{https://github.com/#1}{@#1}} + +\def\thuthesis{\textsc{Thu}\-\textsc{Thesis}} +% +% \end{macrocode} +% \fi +% +% \Finale +% +\endinput +% \iffalse +% Local Variables: +% mode: doctex +% TeX-master: t +% End: +% \fi diff --git a/thuthesis.ins b/thuthesis.ins new file mode 100644 index 0000000..05c5920 --- /dev/null +++ b/thuthesis.ins @@ -0,0 +1,45 @@ +%% +%% Copyright (C) 2005-2021 by Tsinghua University TUNA Association +%% +%% This file is part of the ThuThesis package project. +%% --------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% + +\input docstrip + +\askforoverwritefalse +\keepsilent + +\usedir{tex/latex/thuthesis} + +\preamble + +This is a generated file. + +Copyright (C) 2005-\the\year by Tsinghua University TUNA Association + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2008 or later. + +To produce the documentation run the original source files ending with `.dtx' +through LaTeX. + +\endpreamble + +\generate{\file{\jobname.cls}{\from{\jobname.dtx}{cls}} + \file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}} + +\endbatchfile diff --git a/thuthesis.pdf b/thuthesis.pdf new file mode 100644 index 0000000..7112e11 Binary files /dev/null and b/thuthesis.pdf differ