diff --git a/README.md b/README.md index 44c9f37..e22a1c0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ # gdutthesis 广东工业大学 LaTeX 论文模板 + +## 欢迎使用 gdutthesis(广东工业大学论文模板) + +本模板支持博士、硕士学位论文撰写。借助现代 LaTeX 技术,希望达到用户接口简明、内容格式规范和模板样式可定制的统一。 + +本模板目前支持 XeTeX 和 LuaTeX 引擎,对其他引擎(包括 pdfTeX 和 [ApTeX](https://github.com/clerkma/ptex-ng))的支持仍在实验阶段。本模板仅支持 UTF-8 编码。 + +在您使用 `gdutthesis` 之前,请务必仔细阅读模板文档 `gdutthesis.pdf`。 + +### 模板组成 + +- 核心文档类 + - `gdutthesis.cls` +- 空白模板,可据此为基础完成论文撰写 + - `main.tex` +- 参考文献数据库 + - `gdutthesis-template.bib` +- 简要自述 + - `README.md` +- 用户手册 + - `gdutthesis.dtx` + - `fdudoc.cls` + + +### 重要提醒 + +1. 本模板未经学校相关部门审核及授权,使用前请务必斟酌; +1. 本模板仍处于开发中,不保证接口的稳定性。在撰写论文的过程中,请慎重考虑是否要同步进行更新; +1. 任何由于使⽤本模板⽽引起的论⽂格式审查问题均与本模板作者⽆关。 + +### 贡献 + +如果您有任何改进意见或者功能需求,欢迎提交 [issue](https://github.com/sikouhjw/gdutthesis/issues) 或 [pull request](https://github.com/sikouhjw/gdutthesis/pulls)。 + +### 许可证 + +本模板的发布遵守 [LaTeX Project Public License](http://www.latex-project.org/lppl.txt)(版本 1.3c 或更高)。 + +----- + +Copyright (C) 2021–2021 by sikouhjw. \ No newline at end of file diff --git a/gdutthesis-template.bib b/gdutthesis-template.bib new file mode 100644 index 0000000..31ffc87 --- /dev/null +++ b/gdutthesis-template.bib @@ -0,0 +1,15 @@ +@book{曾谨言2013量子力学, + title={量子力学: 卷 I.}, + author={曾谨言}, + year={2013}, + publisher={科学出版社}, + address={北京} +} + +@book{feynman2011feynman, + title={The Feynman lectures on physics, Vol. I: The new millennium edition: mainly mechanics, radiation, and heat}, + author={Feynman, Richard P and Leighton, Robert B and Sands, Matthew}, + volume={1}, + year={2011}, + publisher={Basic books} +} \ No newline at end of file diff --git a/gdutthesis.cls b/gdutthesis.cls new file mode 100644 index 0000000..ec9af2f --- /dev/null +++ b/gdutthesis.cls @@ -0,0 +1,1270 @@ +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplClass{gdutthesis} + {2021/05/01}{v1.0}{Thesis Template for Guangdong University of Technology} +\RequirePackage { xparse, xtemplate, l3keys2e } +\clist_map_inline:nn { expl3, xparse, xtemplate, l3keys2e } + { + \@ifpackagelater {#1} { 2018/05/12 } + { } { \msg_error:nnn { gdutthesis } { l3-too-old } {#1} } + } +\msg_new:nnn { gdutthesis } { l3-too-old } + { + Package~ "#1"~ is~ too~ old. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ the~ bundles \\ + "l3kernel"~ and~ "l3packages"~ using~ your~ TeX~ package \\ + manager~ or~ from~ CTAN. + } +\sys_if_engine_xetex:F + { + \sys_if_engine_luatex:F + { + \msg_fatal:nnx { gdutthesis } { unsupported-engine } + { \c_sys_engine_str } + } + } +\msg_new:nnn { gdutthesis } { unsupported-engine } + { + The~ gdutthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\\\ + "#1"~ is~ not~ supported~ at~ present.~ You~ must~ change \\ + your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". + } +\int_new:N \g__gdut_thesis_type_int +\clist_new:N \g__gdut_to_ctexbook_clist +\clist_new:N \g__gdut_to_hyperref_clist +\bool_new:N \g__gdut_draft_bool +\cs_generate_variant:Nn \cs_generate_variant:Nn { cn } +\cs_generate_variant:Nn \file_input:n { V } +\cs_generate_variant:Nn \int_to_arabic:n { v } +\cs_generate_variant:Nn \keys_define:nn { nx } +\cs_generate_variant:Nn \tl_map_inline:nn { xn } +\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { Vn } { T, TF } +\cs_new_protected:Npn \__gdut_appto_cmd:Nn #1#2 + { + \ctex_appto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \__gdut_define_fn_style:nn #1#2 + { \tl_const:cn { c__gdut_fn_style_ #1 _tl } {#2} } +\cs_new_protected:Npn \__gdut_define_punct:nn #1#2 + { \tl_const:cn { c__gdut_ #1 _tl } { \__gdut_symbol:n {#2} } } +\cs_new_protected:Npn \__gdut_define_name:nn #1#2 + { \tl_const:cn { c__gdut_name_ #1 _tl } {#2} } +\cs_new_protected:Npn \__gdut_define_name:nnn #1#2#3 + { + \tl_const:cn { c__gdut_name_ #1 _tl } {#2} + \tl_const:cn { c__gdut_name_ #1 _en_tl } {#3} + } +\cs_new:Npn \__gdut_msg_new:nn { \msg_new:nnn { gdutthesis } } +\cs_new:Npn \__gdut_error:n { \msg_error:nn { gdutthesis } } +\cs_new:Npn \__gdut_error:nn { \msg_error:nnn { gdutthesis } } +\cs_new:Npn \__gdut_error:nx { \msg_error:nnx { gdutthesis } } +\cs_new:Npn \__gdut_error:nnn { \msg_error:nnnn { gdutthesis } } +\cs_new:Npn \__gdut_warning:n { \msg_warning:nn { gdutthesis } } +\cs_new:Npn \__gdut_warning:nn { \msg_warning:nnn { gdutthesis } } +\cs_new:Npn \__gdut_warning:nxx { \msg_warning:nnxx { gdutthesis } } +\cs_new:Npn \__gdut_info:nx { \msg_info:nnx { gdutthesis } } +\keys_define:nn { gdut / option } + { + type .choice:, + type .value_required:n = true, + type .choices:nn = + { doctor, master, promaster } + { \int_set_eq:NN \g__gdut_thesis_type_int \l_keys_choice_int }, + type .initial:n = master, + draft .choice:, + draft / true .code:n = + { + \bool_set_true:N \g__gdut_draft_bool + \clist_gput_right:Nn \g__gdut_to_ctexbook_clist { draft } + }, + draft / false .code:n = + { \bool_set_false:N \g__gdut_draft_bool }, + draft .default:n = true, + draft .initial:n = false, + unknown .code:n = { \__gdut_error:n { unknown-option } } + } +\__gdut_msg_new:nn { unknown-option } + { Class~ option~ "\l_keys_key_tl"~ is~ unknown. } +\ProcessKeysOptions { gdut / option } +\cs_new_protected:Npn \__gdut_thesis_type: + { + \clist_item:Nn \c__gdut_thesis_type_clist + { \g__gdut_thesis_type_int } + } +\cs_new_protected:Npn \__gdut_course_name: + { + \clist_item:Nn \c__gdut_course_name_clist + { \g__gdut_thesis_type_int } + } +\cs_new_protected:Npn \__gdut_degree_type: + { + \clist_item:Nn \c__gdut_degree_type_clist + { \l__gdut_info_degree_type_int } + } +\cs_new_protected:Npn \__gdut_degree_en_type: + { + \clist_item:Nn \c__gdut_degree_type_en_clist + { \l__gdut_info_degree_type_int } + } +%% 模板需要自定义的命令 +% 西文日期 +\DeclareExpandableDocumentCommand \engdate { +m } { + \__english_date:www #1 \q_stop +} +\cs_new:Npn \__english_date:www #1/#2/#3 \q_stop { + \ifcase #2 \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#1 +} +% 独创性声明 +\tl_const:Nn \c__gdut_orig_decl_text_tl + { + 本人郑重声明:所呈交的学位论文是我个人在导师的指导下进行的研究工作 + 及取得的研究成果。尽我所知,除了文中特别加以标注和致谢的地方外,论 + 文中不包含其他人已经发表或撰写过的研究成果。与我一同工作的同志对本 + 研究所做的任何贡献均已在论文中作了明确的说明,并表示了谢意。本人依 + 法享有和承担由此论文所产生的权利和责任。 + } +\tl_const:Nn \c__gdut_auth_decl_text_tl + { + 本学位论文作者完全了解学校有关保存、使用学位论文的规定:“研究生在 + 广东工业大学学习和工作期间参与广东工业大学研究项目或承担广东工业大 + 学安排的任务所完成的发明创造及其他技术成果,除另有协议外,归广东工 + 业大学享有或特有”。同意授权广东工业大学保留并向国家有关部门或机构 + 送交该论文的印刷本和电子版本,允许该论文被查阅和借阅。同意授权广东 + 工业大学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可 + 以采用影印、缩印、扫描或数字化等其他复制手段保存和汇编本学位论文。 + 保密论文在解密后遵守此规定。 + } +% 定义可更换的名称 +\clist_const:Nn \c__gdut_thesis_type_clist + { 博士学位, 硕士学位, 硕士专业学位 } +\clist_const:Nn \c__gdut_course_name_clist + { 一级学科(二级学科), 一级学科(二级学科), 专业学位类别(领域) } +\clist_const:Nn \c__gdut_degree_type_clist + { 工学硕士, 管理学硕士, 理学硕士, 艺术学硕士, 工程硕士, 工商管理硕士, 工程管理硕士, 会计硕士, 翻译硕士 } +\clist_const:Nn \c__gdut_degree_type_en_clist + { Master~of~Engineering~Science, Master~of~Management~Science, Master~of~Science, Master~of~Art, Master~of~Engineering, Master~of~Business~Administration, Master~of~Engineering~Management, Master~of~Professional~Accounting, Master~of~Translation~and~Interpreting } +\clist_const:Nn \c__gdut_secret_clist { 秘密, 机密, 绝密 } +\PassOptionsToClass + { + UTF8, + fontset = none, + zihao = -4, + \g__gdut_to_ctexbook_clist + } + { ctexbook } +\clist_map_inline:nn + { + { no-math } { fontspec }, + { titles } { tocloft }, + { UseMSWordMultipleLineSpacing, MSWordLineSpacingMultiple=1.5 } { zhlineskip }, + } + { \PassOptionsToPackage #1 } +\RequirePackage { etoolbox } +\LoadClass { ctexbook } +\RequirePackage + { + amsmath, + unicode-math, + geometry, + fancyhdr, + graphicx, + longtable, + caption, + bicaption, + xcolor, + xeCJKfntef, + xpatch, + array, + multirow, + booktabs, + calc, + enumitem, + tocloft, + subfig, + zhlineskip, + } +%% 调整目录格式 +% 纵向间距 +\setlength{\cftbeforechapskip}{0pt} +\setlength{\cftbeforesecskip}{0pt} +\setlength{\cftbeforesubsecskip}{0pt} +% 缩进 +\setlength{\cftsecindent}{2\ccwd} +\setlength{\cftsubsecindent}{4\ccwd} +% 设置字体 +\renewcommand\cftchapfont{\sffamily} +\renewcommand\cftchapleader{\sffamily\cftdotfill{\cftchapdotsep}} +\renewcommand\cftchappagefont{\sffamily} +% 设置引导符 +\renewcommand{\cftdot}{.} +\renewcommand\cftchapdotsep{\cftdotsep} +\renewcommand{\cftdotsep}{0.1} +% 设置引导符到页码的距离 +\newlength{\yema} +\settowidth{\yema}{\cftchappagefont VII} +\cftsetpnumwidth{\yema} +% 设置计数器盒子的宽度 +\setlength\cftchapnumwidth{3\ccwd} +\newlength{\secjuli} +\settowidth{\secjuli}{\cftsecfont 1.1} +\setlength\cftsecnumwidth{\secjuli} +\newlength{\subsecjuli} +\settowidth{\subsecjuli}{\cftsubsecfont 1.1.1} +\setlength\cftsubsecnumwidth{\subsecjuli} +%% 设置中西文列表 +\newlist{gdutenum}{enumerate}{1} +\setlist[gdutenum,1]{leftmargin=0pt,labelsep=0pt,itemindent=2\ccwd+23.29015pt,parsep=0pt,itemsep=0pt,topsep=0pt,partopsep=0pt,listparindent=2\ccwd} +\renewcommand\thegdutenumi{\arabic{gdutenumi}} +\def\labelgdutenumi{(\thegdutenumi)} + +\newlist{gdutenenum}{enumerate}{1} +\newlength{\enlabellengthi} +\setlength{\enlabellengthi}{0pt} +\setlist[gdutenenum,1]{leftmargin=0pt,labelsep=3pt,itemindent=2\ccwd+\the\enlabellengthi+3pt,parsep=0pt,itemsep=0pt,topsep=0pt,partopsep=0pt,listparindent=2\ccwd} +\def\setmythegdutenenumi#1{\setlength{\enlabellengthi}{\widthof{#1}}\def\labelgdutenenumi{#1}} +\renewcommand\thegdutenenumi{\arabic{gdutenenumi}} +\setmythegdutenenumi{(\thegdutenenumi)} + + +%% 设置目录中章后面的间距 +\cs_set_protected:Npn \CTEX@toc@width@n #1 + { + \hbox_set:Nn \l__ctex_tmp_box {#1\space} + \dim_set:Nn \@tempdima + { + \box_wd:N \l__ctex_tmp_box + } + } +\xpatchcmd{\tableofcontents} + {\chapter*{\contentsname + \@mkboth{% + \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}}{\chapter{\contentsname}} + {}{} +%% 定义双语目录 +\def\en@toc@ext{tec} +\def\en@contentsname{CONTENTS} + +%% two user commands +\newcommand\enTableOfContents{ + \begingroup + % restore \contentsname + \let\contentsname\en@contentsname + % output en-toc + \@enTableOfContents + \endgroup +} + +\newcommand\enSectionTitle[1]{ + \def\@currentTitle{#1} + \ignorespaces +} + +%% provide \@enTableOfContents +\let\@enTableOfContents\tableofcontents +\@ifundefined {chapter} + { % e.g., article.cls + \xpatchcmd\@enTableOfContents + {\@starttoc{toc}} + {\endgroup\@starttoc{\en@toc@ext}} + {}{\fail} + } + { % e.g., book.cls + \xpatchcmd\@enTableOfContents + {\chapter} + { + \begingroup + \chapter + } + {}{\fail} + \xpatchcmd\@enTableOfContents + {\@starttoc{toc}} + {\endgroup\@starttoc{\en@toc@ext}} + {}{\fail} + } + +%% modify to write two toc entries +\cs_set_protected:Npn \CTEX@addtocline #1#2 + { + % write cn-toc entry + \addcontentsline { toc } {#1} + { \use:c { CTEX@#1@tocline } {#1} {#2} } + \begingroup + \@ifundefined {chapter} + {} + { + \ctexset{ + chapter/name = {Chapter\ }, + chapter/number = \arabic{chapter}, + } + } + % write en-toc entry + \addcontentsline \en@toc@ext {#1} + { \use:c { CTEX@#1@tocline } {#1} { \@currentTitle } } + \endgroup + } + +%% 设置章节格式 +\setlength{\parskip}{0pt} +\renewcommand{\theparagraph}{\arabic{paragraph}.} +\renewcommand{\thesubparagraph}{(\arabic{subparagraph})} + +\cs_new_protected:Npn \__gdut_check_package:nnn #1#2#3 + { + \@ifpackagelater {#1} {#2} + { } { \__gdut_error:nnn { package-too-old } {#1} {#3} } + } +\__gdut_msg_new:nn { package-too-old } + { + Package~ "#1"~ is~ too~ old. \\ + The~ gdutthesis~ class~ only~ supports~ "#1"~ with~ a~ version \\ + higher~ than~ v#2. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your \\ + TeX~ package~ manager~ or~ from~ CTAN. + } +\__gdut_check_package:nnn { ctex } { 2017/08/07 } { 2.4.10 } +\__gdut_check_package:nnn { fontspec } { 2017/09/22 } { 2.6e } +\__gdut_check_package:nnn { unicode-math } { 2017/11/18 } { 0.8i } +\sys_if_engine_xetex:T + { \__gdut_check_package:nnn { xeCJK } { 2017/08/07 } { 3.5.0 } } +\sys_if_engine_luatex:T + { \__gdut_check_package:nnn { xunicode-addon } { 2018/04/30 } { 3.7.1 } } +%% 设置页面 +\geometry{ + paper = a4paper, + margin = 2.6cm, + headheight = 0.77cm, + headsep = 0.415cm, + footskip = 12pt, +} +\bool_if:NT \g__gdut_draft_bool { \geometry { showframe } } +\tl_new:N \g__gdut_fontset_tl +\tl_new:N \g__gdut_cjk_fontset_tl +\keys_define:nn { gdut / style } + { + font .choices:nn = + { times, times*, none } + { \tl_set_eq:NN \g__gdut_fontset_tl \l_keys_choice_tl } + } +\keys_define:nn { gdut / style } + { + cjk-font .choices:nn = + { fandol, founder, mac, sourcehan, noto, windows, none } + { \tl_set_eq:NN \g__gdut_cjk_fontset_tl \l_keys_choice_tl } + } +\cs_new_protected:Npn \__gdut_setmainfont:nn #1#2 + { \__fontspec_main_setmainfont:nn {#2} {#1} } +\cs_new_protected:Npn \__gdut_setsansfont:nn #1#2 + { \__fontspec_main_setsansfont:nn {#2} {#1} } +\cs_new_protected:Npn \__gdut_setmonofont:nn #1#2 + { \__fontspec_main_setmonofont:nn {#2} {#1} } +\cs_new_protected:Npn \__gdut_setmathfont:nn #1#2 + { \__um_setmathfont:nn {#2} {#1} } +\cs_new_protected:Npn \__gdut_setCJKmainfont:nn #1#2 + { \__gdut_set_family:nnn { \CJKrmdefault } {#2} {#1} } +\cs_new_protected:Npn \__gdut_setCJKsansfont:nn #1#2 + { \__gdut_set_family:nnn { \CJKsfdefault } {#2} {#1} } +\cs_new_protected:Npn \__gdut_setCJKmonofont:nn #1#2 + { \__gdut_set_family:nnn { \CJKttdefault } {#2} {#1} } +\cs_new_protected:Npn \__gdut_set_cjk_font_kai:nn #1#2 + { \__gdut_set_family:nnn { gdut@kai } {#2} {#1} \newfontfamily \gdutenkai {#1} } +\cs_new_protected:Npn \gdut@kai + { \__gdut_switch_family:n { gdut@kai } } +\tl_const:Nn \__gdut_cjk_font_options: + { UprightFont = *, ItalicFont = *, AutoFakeBold = true } +\cs_new_protected:Npx \__gdut_setCJKmainfont:n #1 + { \__gdut_setCJKmainfont:nn {#1} { \__gdut_cjk_font_options: } } +\cs_new_protected:Npx \__gdut_setCJKsansfont:n #1 + { \__gdut_setCJKsansfont:nn {#1} { \__gdut_cjk_font_options: } } +\cs_new_protected:Npx \__gdut_setCJKmonofont:n #1 + { \__gdut_setCJKmonofont:nn {#1} { \__gdut_cjk_font_options: } } +\cs_new_protected:Npx \__gdut_set_cjk_font_kai:n #1 + { \__gdut_set_cjk_font_kai:nn {#1} { \__gdut_cjk_font_options: } } +\sys_if_engine_xetex:TF + { + \cs_new_eq:NN \__gdut_set_family:nnn \xeCJK_set_family:nnn + \cs_new_eq:NN \__gdut_switch_family:n \xeCJK_switch_family:n + } + { + \cs_new_eq:NN \__gdut_set_family:nnn \ctex_ltj_set_family:nnn + \cs_new_eq:NN \__gdut_switch_family:n \ctex_ltj_switch_family:n + } +\cs_new_protected:Npn \__gdut_set_font_helper:n #1 + { + \exp_args:Nc \RenewDocumentCommand { set #1 font } { O { } m O { } } + { + \ctex_at_end_preamble:n + { \use:c { __gdut_set #1 font:nn } {##2} { ##1, ##3 } } + } + } +\clist_map_inline:nn { main, sans, mono, math } { \__gdut_set_font_helper:n {#1} } +\clist_map_inline:nn { CJKmain, CJKsans, CJKmono } { \__gdut_set_font_helper:n {#1} } +\tl_new:N \g__gdut_font_family_xits_tl +\tl_new:N \g__gdut_font_style_xits_rm_tl +\tl_new:N \g__gdut_font_style_xits_bf_tl +\tl_new:N \g__gdut_font_style_xits_it_tl +\tl_new:N \g__gdut_font_style_xits_bfit_tl +\tl_new:N \g__gdut_font_name_libertinus_serif_tl +\tl_new:N \g__gdut_font_name_libertinus_sans_tl +\tl_new:N \g__gdut_font_name_libertinus_math_tl +\tl_new:N \g__gdut_font_name_xits_tl +\tl_new:N \g__gdut_font_name_xits_math_rm_tl +\tl_new:N \g__gdut_font_name_xits_math_bf_tl +\fontspec_font_if_exist:nTF { XITS-Regular.otf } + { + \tl_set:Nn \g__gdut_font_family_xits_tl { XITS } + \tl_set:Nn \g__gdut_font_style_xits_rm_tl { Regular } + \tl_set:Nn \g__gdut_font_style_xits_bf_tl { Bold } + \tl_set:Nn \g__gdut_font_style_xits_it_tl { Italic } + \tl_set:Nn \g__gdut_font_style_xits_bfit_tl { BoldItalic } + \tl_set:Nn \g__gdut_font_name_xits_math_rm_tl { XITSMath-Regular } + \tl_set:Nn \g__gdut_font_name_xits_math_bf_tl { XITSMath-Bold } + } + { + \tl_set:Nn \g__gdut_font_family_xits_tl { xits } + \tl_set:Nn \g__gdut_font_style_xits_rm_tl { regular } + \tl_set:Nn \g__gdut_font_style_xits_bf_tl { bold } + \tl_set:Nn \g__gdut_font_style_xits_it_tl { italic } + \tl_set:Nn \g__gdut_font_style_xits_bfit_tl { bolditalic } + \tl_set:Nn \g__gdut_font_name_xits_math_rm_tl { xits-math } + \tl_set:Nn \g__gdut_font_name_xits_math_bf_tl { xits-mathbold } + } +\cs_new_protected:Npn \__gdut_load_font_times: + { + \__gdut_setmainfont:nn { \g__gdut_font_family_xits_tl } + { + Extension = .otf, + UprightFont = *-\g__gdut_font_style_xits_rm_tl, + BoldFont = *-\g__gdut_font_style_xits_bf_tl, + ItalicFont = *-\g__gdut_font_style_xits_it_tl, + BoldItalicFont = *-\g__gdut_font_style_xits_bfit_tl + } + \__gdut_setsansfont:nn { texgyreheros } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \__gdut_setmonofont:nn { texgyrecursor } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Ligatures = CommonOff + } + \__gdut_setmathfont:nn { \g__gdut_font_name_xits_math_rm_tl .otf } + { BoldFont = \g__gdut_font_name_xits_math_bf_tl .otf } + } +\cs_new_protected:cpn { __gdut_load_font_ times* : } + { + \__gdut_setmainfont:nn { Times~ New~ Roman } { } + \__gdut_setsansfont:nn { Arial } { } + \__gdut_setmonofont:nn { Courier~ New } { } + \__gdut_setmathfont:nn { \g__gdut_font_name_xits_math_rm_tl .otf } + { BoldFont = \g__gdut_font_name_xits_math_bf_tl .otf } + } +\cs_new_protected:Npn \__gdut_load_cjk_font_fandol: + { + \__gdut_setCJKmainfont:nn { FandolSong } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_setCJKsansfont:nn { FandolHei } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_setCJKmonofont:nn { FandolFang } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + \__gdut_set_cjk_font_kai:nn { FandolKai } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + } +\cs_new_protected:Npn \__gdut_load_cjk_font_founder: + { + \__gdut_setCJKmainfont:n { FZShuSong-Z01 } + \__gdut_setCJKsansfont:n { FZHei-B01 } + \__gdut_setCJKmonofont:n { FZFangSong-Z02 } + \__gdut_set_cjk_font_kai:n { FZKai-Z03 } + } +\cs_new_protected:Npn \__gdut_load_cjk_font_mac: + { + \__gdut_setCJKmainfont:nn { STSongti-SC } + { + UprightFont = *-Light, + BoldFont = *-Bold, + ItalicFont = *-Light, + BoldItalicFont = *-Bold + } + \__gdut_setCJKsansfont:nn { STHeitiSC } + { + UprightFont = *-Medium, + AutoFakeBold = true, + ItalicFont = *-Medium, + BoldItalicFont = *-Medium + } + \__gdut_setCJKmonofont:n { STFangsong } + \__gdut_set_cjk_font_kai:nn { STKaitiSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + } +\cs_new_protected:Npn \__gdut_load_cjk_font_sourcehan: + { + \__gdut_setCJKmainfont:nn { Source~Han~Serif~SC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_setCJKsansfont:nn { Source~Han~Sans~SC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_setCJKmonofont:nn { FandolFang } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + \__gdut_set_cjk_font_kai:nn { FandolKai } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + } +\cs_new_protected:Npn \__gdut_load_cjk_font_noto: + { + \__gdut_setCJKmainfont:nn { Noto~Serif~CJK~SC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_setCJKsansfont:nn { Noto~Sans~CJK~SC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_setCJKmonofont:nn { Noto~Sans~Mono~CJK~SC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \__gdut_set_cjk_font_kai:nn { FandolKai } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + } +\cs_new_protected:Npn \__gdut_load_cjk_font_windows: + { + \__gdut_setCJKmainfont:n { SimSun } + \__gdut_setCJKsansfont:n { SimHei } + \__gdut_setCJKmonofont:n { FangSong } + \__gdut_set_cjk_font_kai:n { KaiTi } + } +\cs_new_protected:Npn \__gdut_load_font: + { + \use:c { __gdut_load_font_ \g__gdut_fontset_tl : } + \use:c { __gdut_load_cjk_font_ \g__gdut_cjk_fontset_tl : } + } +\ctex_at_end_preamble:n { \__gdut_load_font: } +\keys_set:nn { unicode-math } + { + math-style = ISO, + bold-style = ISO, + } +\keys_define:nn { gdut / style } + { + fullwidth-stop .choice:, + fullwidth-stop .value_required:n = true, + fullwidth-stop / catcode .code:n = + { \__gdut_set_fullwidth_stop_catcode: }, + fullwidth-stop / mapping .code:n = + { + \sys_if_engine_xetex:TF + { + \clist_gset:Nn \g__xeCJK_default_features_clist + { Mapping = fullwidth-stop } + } + { + \sys_if_engine_luatex:T + { + \__gdut_warning:n { mapping-not-available } + \__gdut_set_fullwidth_stop_catcode: + } + } + }, + fullwidth-stop / false .code:n = { } + } +\__gdut_msg_new:nn { mapping-not-available } + { + Option~ "fullwidth-stop = mapping"~ is~ not~ available~ in~ LuaTeX. \\ + "fullwidth-stop = catcode"~ will~ be~ set~ instead. + } +\cs_new:Npn \__gdut_set_fullwidth_stop_catcode: + { + \char_set_active_eq:nN { "3002 } \c__gdut_fwid_full_stop_tl + \char_set_catcode_active:n { "3002 } + } +%% 设置页眉页脚 +\fancyhf{} +\fancyfoot[C]{\zihao{-5}\thepage} +\fancyhead[CO]{\zihao{-5}\gdut@kai\gdutenkai \leftmark} +\fancyhead[CE]{\zihao{-5}\gdut@kai\gdutenkai 广东工业大学 \__gdut_thesis_type: 论文} +\renewcommand{\headrulewidth}{1.5pt} +\renewcommand{\headruleskip}{6.2pt} +\newcommand{\myheadrulewidth}{0.8pt} + \def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi + \hrule\@height\headrulewidth\@width\headwidth + \vskip0.75pt + \hrule\@height\myheadrulewidth\@width\headwidth + \vskip-\headrulewidth\vskip-\myheadrulewidth + }}% +\renewcommand{\footrulewidth}{0pt} +\pagestyle { fancy } +%% 设置章节格式 +\keys_set:nn { ctex } +{ + secnumdepth=5, + chapter = { + format = \zihao{-2}\sffamily\centering, + pagestyle = fancy, + aftername = \hspace{\ccwd}, + beforeskip = 0pt, + afterskip = 1.5\baselineskip-1.5\ccwd, + fixskip = true, + tocline = \CTEXnumberline{#1}#2, + }, + section = { + format = \zihao{-3}\sffamily\raggedright, + aftername = {~}, + beforeskip = 1.25\baselineskip-1.25\ccwd, + afterskip = 1.25\baselineskip-1.25\ccwd, + fixskip = true, + }, + subsection = { + format = \zihao{4}\sffamily\raggedright, + aftername = {~}, + beforeskip = 1.167\baselineskip-1.167\ccwd, + afterskip = 1.167\baselineskip-1.167\ccwd, + fixskip = true, + }, + subsubsection = { + runin = true, + format = \zihao{-4}\sffamily\raggedright, + aftername = {~}, + beforeskip = \baselineskip-\ccwd, + afterskip = \ccwd, + aftertitle = {}, + fixskip = true, + }, + paragraph = { + format = \zihao{-4}\sffamily\raggedright, + indent = 2\ccwd, + aftername = {~}, + beforeskip = \baselineskip-\ccwd, + afterskip = 0pt, + fixskip = true, + }, + subparagraph = { + format = \zihao{-4}\sffamily\raggedright, + indent = 2\ccwd, + aftername = {~}, + beforeskip = \baselineskip-\ccwd, + afterskip = 0pt, + fixskip = true, + }, +} +%% 设置图表格式 +\DeclareCaptionLabelFormat{english}{#1#2} +\captionsetup{labelsep=space,labelformat=english,font=small} +\captionsetup[figure][bi-second]{name=Fig.} +\captionsetup[table][bi-second]{name=Table.} +\captionsetup[subfloat]{labelformat=simple,font=small,captionskip=4pt,nearskip=-5pt,farskip=0pt} +\cs_set:Npn\thesubfigure{(\alph{subfigure})} +\cs_set:Npn\thetable{\thechapter-\arabic{table}} +\cs_set:Npn\thefigure{\thechapter-\arabic{figure}} +%% 设置引用格式 +\newcommand{\subfigureautorefname}{图} +\newcommand{\figureautorefname}{图} +\newcommand{\tableautorefname}{表} +\labelformat{equation}{(#1)} +\newcommand{\equationautorefname}{公式} +%% 设置浮动体间距 +\setlength{\floatsep}{2\baselineskip-2\ccwd-1pt} +\setlength{\textfloatsep}{2\baselineskip-2\ccwd-1pt} +\setlength{\intextsep}{2\baselineskip-2\ccwd-1pt} +\patchcmd{\@addtocurcol}% + {\ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}% + {}% + {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}} + +\patchcmd{\@addtocurcol}% + {\vskip \intextsep}% + {\addvspace\intextsep + \ifnum\outputpenalty <-\@Mii \vskip\parskip\fi}% + {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}} + +\patchcmd{\@addtocurcol}% + {\vskip\intextsep}{\fix@second@intextsep}% + {\typeout{*** SUCCESS ***}}% + {\typeout{*** FAIL ***}} + +\def\fix@second@intextsep {% +% was the float seen in vertical mode? + \ifnum\outputpenalty <-\@Mii + \aftergroup\vskip\aftergroup\intextsep + \aftergroup\nointerlineskip + \else + \vskip\intextsep + \fi +} +%% 设置浮动体格式 +\AtBeginEnvironment{figure}{% + \def\@floatboxreset{\centering}% +} +\AtBeginEnvironment{table}{% + \def\@floatboxreset{\centering}% +} +\AtBeginEnvironment{table}{\small} +\clist_map_inline:nn + { + title, date, author, supervisor, department, major, student_id, + } + { \tl_new:c { l__gdut_info_ #1 _tl } } +\clist_new:N \l__gdut_info_keywords_clist +\clist_map_inline:nn + { title, author, supervisor, department } + { \tl_new:c { l__gdut_info_ #1 _en_tl } } +\clist_new:N \l__gdut_info_keywords_en_clist +\int_new:N \l__gdut_info_degree_type_int +\keys_define:nn { gdut / info } + { + degree .choices:nn = + { Eng-Sci, Man-Sci, Sci, Art, Eng, Bus-Adm, Eng-Man, Pro-Acc, Tra-Int } + { \int_set_eq:NN \l__gdut_info_degree_type_int \l_keys_choice_int }, + title .tl_set:N = \l__gdut_info_title_tl, + title* .tl_set:N = \l__gdut_info_title_en_tl, + date .tl_set:N = \l__gdut_info_date_tl, + author .tl_set:N = \l__gdut_info_author_tl, + author* .tl_set:N = \l__gdut_info_author_en_tl, + supervisor .tl_set:N = \l__gdut_info_supervisor_tl, + supervisor* .tl_set:N = \l__gdut_info_supervisor_en_tl, + % instructors .clist_set:N = \l__gdut_info_instructors_clist, + department .tl_set:N = \l__gdut_info_department_tl, + department* .tl_set:N = \l__gdut_info_department_en_tl, + major .tl_set:N = \l__gdut_info_major_tl, + student-id .tl_set:N = \l__gdut_info_student_id_tl, + % school-id .tl_set:N = \l__gdut_info_school_id_tl, + keywords .clist_set:N = \l__gdut_info_keywords_clist, + keywords* .clist_set:N = \l__gdut_info_keywords_en_clist, + % clc .tl_set:N = \l__gdut_info_clc_tl + } +\bool_new:N \l__gdut_secret_bool +\tl_new:N \l__gdut_info_secret_level_tl +\keys_define:nn { gdut / info } + { + secret-level .choices:nn = + { none, i, ii, iii } + { + \int_compare:nTF { \l_keys_choice_int >= 2 } + { + \bool_set_true:N \l__gdut_secret_bool + \tl_set:Nn \l__gdut_info_secret_level_tl + { + \clist_item:Nn \c__gdut_secret_clist + { \l_keys_choice_int - 1 } + } + } + { \bool_set_false:N \l__gdut_secret_bool } + }, + secret-level .value_required:n = true, + } +%% 设置数学间距 +\AtBeginDocument{% + \setlength{\abovedisplayskip}{0pt}% + \setlength{\abovedisplayshortskip}{0pt}% + \setlength{\belowdisplayshortskip}{0pt}% + \setlength{\belowdisplayskip}{0pt}% +} +%% 输出封面 +\AtBeginDocument{% + \gdutmaketitle +} +%% 定义双语章节 +\let\mychapter=\chapter +\let\mysection=\section +\let\mysubsection=\subsection +\def\gdutchapter#1#2{\enSectionTitle{#2}\mychapter{#1}} +\def\gdutsection#1#2{\enSectionTitle{#2}\mysection{#1}} +\def\gdutsubsection#1#2{\enSectionTitle{#2}\mysubsection{#1}} +\def\gdutbackmatter{\ctexset{chapter/numbering=false}} +\def\gdutbacksection#1{\section*{#1}} +%% 定义成果列表 +\newenvironment{results} + {\list{\@biblabel{\@arabic\c@enumiv}}% + {\settowidth\labelwidth{\@biblabel{99}}% + \leftmargin\labelwidth + \advance\leftmargin\labelsep + \@openbib@code + \usecounter{enumiv}% + \let\p@enumiv\@empty + \renewcommand\theenumiv{\@arabic\c@enumiv}}% + \sloppy + \clubpenalty4000 + \@clubpenalty \clubpenalty + \widowpenalty4000% + \sfcode`\.\@m} + {\def\@noitemerr + {\@latex@warning{Empty `thebibliography' environment}}% + \endlist} +%% 定义独创性声明 +\def\gdutstatement{ + \chapter*{学位论文独创性声明} + \addcontentsline{toc}{chapter}{学位论文独创性声明及学位论文版权使用授权声明} + \addcontentsline{tec}{chapter}{Statement~of~original~authorship~and~copyright~licensing~declaration} + \markboth{学位论文独创性声明及学位论文版权使用授权声明}{} + \vspace*{\baselineskip+0.9\ccwd} + \c__gdut_orig_decl_text_tl\par + \vspace*{\baselineskip} + \begingroup \centering \hspace*{5\ccwd}论文作者签名:\hspace*{5\ccwd}日期:\par \endgroup + \ctexset{chapter/break = {}} + \vspace*{3\baselineskip} + \chapter*{学位论文版权使用授权声明} + \vspace*{\baselineskip+0.9\ccwd} + \c__gdut_auth_decl_text_tl\par + \vspace*{\baselineskip} + \begingroup \centering \hspace*{5\ccwd}论文作者签名:\hspace*{5\ccwd}日期:\par \endgroup + \vspace*{\baselineskip} + \begingroup \centering \hspace*{5\ccwd}指导教师签名:\hspace*{5\ccwd}日期:\par \endgroup + \ctexset{chapter/break = \if@openright\cleardoublepage\else\clearpage\fi} +} +\cs_new:Npn \gdutappendix { + \ctexset{chapter/numbering=true} + \appendix + \makeatletter + \ExplSyntaxOn + \xpatchcmd{\CTEX@addtocline} + { + chapter/name = {Chapter\ }, + chapter/number = \arabic{chapter}, + }{ + chapter/name = {Appendix\ }, + chapter/number = \Alph{chapter}, + } + {}{} + \ExplSyntaxOff + \makeatother +} +\NewDocumentEnvironment { abstract } { } + { \pagestyle{fancy}\__gdut_abstract_begin: } { \__gdut_abstract_end: } +\NewDocumentEnvironment { abstract* } { } + { \__gdut_abstract_en_begin: } { \__gdut_abstract_en_end: } +\cs_new_protected:Npn \__gdut_abstract_begin: + { \pagestyle{fancy}\pagenumbering{Roman}\gdutchapter{摘要}{ABSTRACT(IN~CHINESE)} } +\cs_new_protected:Npn \__gdut_abstract_en_begin: + { \gdutchapter{ABSTRACT}{ABSTRACT(IN~ENGLISH)} } +\cs_new_protected:Npn \__gdut_abstract_end: + { + \__gdut_keywords:nNn + { \sffamily 关键词: } + \l__gdut_info_keywords_clist { ; } + } +\cs_new_protected:Npn \__gdut_abstract_en_end: + { + \__gdut_keywords:nNn + { \bfseries Key~words:~ } + \l__gdut_info_keywords_en_clist { ; ~ } + } +\cs_new_protected:Npn \__gdut_keywords:nNn #1#2#3 + { + \par \mode_leave_vertical: \par \noindent + \group_begin: #1 \group_end: + \clist_use:Nn #2 {#3} \par + } +\NewDocumentEnvironment { notation } { O { l p { 7.5 cm } } } + { + \__gdut_notation_begin: + \group_begin: \zihao{5} + \__gdut_notation_long_table_setup: + \longtable {#1} + } + { + \endlongtable + \group_end: + } +\cs_new_protected:Npn \__gdut_notation_begin: + { + \gdutchapter{物理量名称及符号表}{Table~of~physical~quantity~names~and~symbols} + } +\cs_new_protected:Npn \__gdut_notation_long_table_setup: + { + \dim_set_eq:NN \LTpre \c_zero_dim + \dim_set_eq:NN \LTpost \c_zero_dim + } +\bool_new:N \l__gdut_bibtex_bool +\tl_new:N \l__gdut_bib_style_tl +\tl_new:N \l__gdut_bib_gb_style_tl +\tl_new:N \l__gdut_cite_style_tl +\clist_new:N \l__gdut_bib_resource_clist +\keys_define:nn { gdut / style } + { + bib-backend .choice:, + bib-backend .value_required:n = true, + bib-backend / bibtex .code:n = + { \bool_set_true:N \l__gdut_bibtex_bool }, + bib-backend / biblatex .code:n = + { \bool_set_false:N \l__gdut_bibtex_bool }, + bib-style .choice:, + bib-style .value_required:n = true, + bib-style / numerical .code:n = + { + \tl_set:Nn \l__gdut_bib_gb_style_tl { numerical } + \tl_clear:N \l__gdut_bib_style_tl + }, + bib-style / author-year .code:n = + { + \tl_set:Nn \l__gdut_bib_gb_style_tl { author-year } + \tl_clear:N \l__gdut_bib_style_tl + }, + bib-style / unknown .code:n = + { \tl_set_eq:NN \l__gdut_bib_style_tl \l_keys_value_tl }, + cite-style .code:n = + { + \bool_if:NTF \l__gdut_bibtex_bool + { \__gdut_warning:n { cite-style-not-available } } + { \tl_set:Nn \l__gdut_cite_style_tl {#1} } + }, + bib-resource .clist_set:N = \l__gdut_bib_resource_clist + } +\__gdut_msg_new:nn { cite-style-not-available } + { Option~ "cite-style"~ is~ not~ available~ in~ BibTeX. } +\ctex_at_end_preamble:n + { + \bool_if:NT \l__gdut_bibtex_bool + { + \RequirePackage [ sort & compress ] { natbib } + \__gdut_bibtex_setup: + } + } +\AddToHook + { env/document/begin } + { + \bool_if:NF \l__gdut_bibtex_bool + { + \__gdut_biblatex_pre_setup: + \RequirePackage { biblatex } + \__gdut_biblatex_post_setup: + } + } +\cs_new_protected:Npn \__gdut_bibtex_setup: + { + \tl_if_empty:NTF \l__gdut_bib_style_tl + { + \tl_if_eq:VnTF \l__gdut_bib_gb_style_tl { numerical } + { + \bibliographystyle { gbt7714-numerical } + \__gdut_set_cite_style_numerical: + } + { + \tl_if_eq:VnT \l__gdut_bib_gb_style_tl { author-year } + { + \bibliographystyle { gbt7714-author-year } + \__gdut_set_cite_style_author_year: + \cs_set_eq:NN \cite \citep + } + } + } + { \exp_args:NV \bibliographystyle \l__gdut_bib_style_tl } + \cs_set:Npn \bibsection { \gdutchapter{参考文献}{References} } + \NewDocumentCommand \printbibliography { o } + { + \exp_args:NV \bibliography \l__gdut_bib_resource_clist + \IfValueT {##1} + { \__gdut_warning:nn { invalid-option-in-bibtex } {##1} } + } + } +\__gdut_msg_new:nn { invalid-option-in-bibtex } + { Option(s)~ "#1"~ are~ invalid~ in~ BibTeX. } +\cs_new_protected:Npn \__gdut_biblatex_pre_setup: + { + \tl_if_empty:NTF \l__gdut_bib_style_tl + { + \tl_if_eq:VnTF \l__gdut_bib_gb_style_tl { numerical } + { \__gdut_pass_options_to_biblatex:n { style = gb7714-2015 } } + { + \tl_if_eq:VnT \l__gdut_bib_gb_style_tl { author-year } + { \__gdut_pass_options_to_biblatex:n { style = gb7714-2015ay } } + } + } + { \__gdut_pass_options_to_biblatex:n { style = \l__gdut_bib_style_tl } } + \tl_if_empty:NF \l__gdut_cite_style_tl + { \__gdut_pass_options_to_biblatex:n { citestyle = \l__gdut_cite_style_tl } } + \__gdut_pass_options_to_biblatex:n { backend = biber, hyperref = manual, natbib } + } +\cs_new_protected:Npn \__gdut_biblatex_post_setup: + { + \clist_map_function:NN \l__gdut_bib_resource_clist \addbibresource + \__gdut_biblatex_allow_url_break: + \defbibheading { bibliography } [ 参考文献 ] { \gdutchapter{##1}{References} } + } +\cs_new_protected:Npn \__gdut_pass_options_to_biblatex:n #1 + { \PassOptionsToPackage {#1} { biblatex } } +\cs_new:Npn \__gdut_biblatex_allow_url_break: + { + \int_set_eq:NN \c@biburlucpenalty \c_one_int + \int_set_eq:NN \c@biburlnumpenalty \c_one_int + \int_set_eq:NN \c@biburllcpenalty \c_one_int + } +\cs_new:Npn \__gdut_set_cite_style_numerical: + { + \NAT@numberstrue \NAT@supertrue + \cs_set:Npn \NAT@open { [ } + \cs_set:Npn \NAT@close { ] } + \cs_set:Npn \NAT@sep { ,~ } + } +\cs_new:Npn \__gdut_set_cite_style_author_year: + { + \NAT@numbersfalse + \cs_set_eq:NN \NAT@open \c__gdut_fwid_left_paren_tl + \cs_set_eq:NN \NAT@close \c__gdut_fwid_right_paren_tl + \cs_set_eq:NN \NAT@sep \c__gdut_fwid_semicolon_tl + \cs_set_eq:NN \NAT@aysep \c__gdut_fwid_comma_tl + \cs_set_eq:NN \NAT@yrsep \c__gdut_ideo_comma_tl + } +\NewDocumentCommand \hypersetup { m } + { \gdut_hyperref_setup:n {#1} } +\cs_new_protected:Npn \gdut_hyperref_setup:n #1 + { \clist_gput_right:Nn \g__gdut_to_hyperref_clist {#1} } +\cs_new:Npn \__gdut_set_hyperlink_color_key:n #1 + { + hyperlink-color / \clist_item:nn {#1} {1} .code:n = + { + \__gdut_define_hyperlink_color:nnn + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } + \gdut_hyperref_setup:n + { + linkcolor = gdut@link, linkbordercolor = gdut@link, + urlcolor = gdut@url, urlbordercolor = gdut@url, + citecolor = gdut@cite, citebordercolor = gdut@cite + } + }, + } +\cs_new_protected:Npn \__gdut_define_hyperlink_color:nnn #1#2#3 + { + \definecolorset { HTML } { gdut@ } { } + { link, #1; url, #2; cite, #3 } + } +\keys_define:nx { gdut / style } + { + hyperlink .choice:, + hyperlink .value_required:n = true, + hyperlink / border .code:n = { }, + hyperlink / color .code:n = + { \gdut_hyperref_setup:n { colorlinks = true } }, + hyperlink / none .code:n = + { \gdut_hyperref_setup:n { hidelinks = true } }, + hyperlink-color .choice:, + hyperlink-color .value_required:n = true, + \clist_map_function:nN + { + { autumn, D70000, D75F00, AF8700 }, + { business, D14542, 295497, 1F6E43 }, + { classic, FF0000, 0000FF, 00FF00 }, + { default, 990000, 0000B2, 007F00 }, + { elegant, 961212, C31818, 9B764F }, + { fantasy, FF4A19, FF3F94, 934BA1 }, + { material, E91E63, 009688, 4CAF50 }, + { science, CA0619, 389F9D, FF8920 }, + { summer, 00AFAF, 5F5FAF, 5F8700 }, + { graylevel, 616161, 616161, 616161 }, + { prl, 2D3092, 2D3092, 2D3092 } + } + \__gdut_set_hyperlink_color_key:n + } +\cs_new:Npn \gdut_allow_url_break: + { + \cs_new:Npn \__gdut_add_url_break_points: + { \tl_map_function:NN \c__gdut_url_break_points_tl \do } + \__gdut_appto_cmd:Nn \UrlBreaks + { \UrlOrds \__gdut_add_url_break_points: } + } +\tl_const:Nn \c__gdut_url_break_points_tl + { + abcdefghijklmnopqrstuvwxyz + ABCDEFGHIJKLMNOPQRSTUVWXYZ + 0123456789 + } +\ctex_at_end_preamble:n + { + \RequirePackage { hyperref } + \hypersetup + { + bookmarksnumbered = true, + psdextra = true, + unicode = true, + pdftitle = \l__gdut_info_title_tl, + pdfauthor = \l__gdut_info_author_tl, + pdfkeywords = \l__gdut_info_keywords_clist, + } + \exp_args:NV \hypersetup \g__gdut_to_hyperref_clist + \gdut_allow_url_break: + \bool_if:NF \l__gdut_bibtex_bool { \BiblatexManualHyperrefOn } + } +\ctex_at_end_package:nn { hyperref } + { + \pdfstringdefDisableCommands + { + \cs_set_eq:NN \gdut@kai \prg_do_nothing: + \cs_set_eq:NN \quad \c_space_tl + \cs_set_eq:NN \qquad \c_space_tl + } + } +\cs_new:Npn \gduttableofcontents { + \enSectionTitle{CONTENTS(IN~CHINESE)} + \renewcommand\cftchapaftersnumb{\hspace{6.5pt}} + \tableofcontents + \renewcommand\cftchapaftersnumb{\hspace{0pt}} + \enSectionTitle{CONTENTS(IN~ENGLISH)} + \enTableOfContents +} +\keys_define:nn { gdut } + { + info .meta:nn = { gdut / info } {#1}, + style .meta:nn = { gdut / style } {#1} + } +\keys_set:nn { gdut } + { + style / font = times, + style / cjk-font = fandol, + style / fullwidth-stop = false, + style / hyperlink-color = default, + style / bib-style = numerical, + info / secret-level = none, + info / date = { 2021/5/1 }, + } +\NewDocumentCommand \gdutsetup { m } + { \keys_set:nn { gdut } {#1} } + +\cs_new:Npn \gdutmaketitle { + \frontmatter\pagestyle{empty}\pagenumbering{Alph} + \vspace*{2\baselineskip-5pt} + \begingroup \centering\bfseries\zihao{-2} 广东工业大学 \__gdut_thesis_type: 论文\par \endgroup + \begingroup \centering \__gdut_degree_type:\par \endgroup + \vspace*{3\baselineskip-0.5pt} + \begingroup \centering\sffamily\zihao{2} \l__gdut_info_title_tl\par \endgroup + \vspace*{3.3\baselineskip-1pt} + \begingroup \centering\zihao{3} \l__gdut_info_author_tl\par \endgroup + \vspace*{9\baselineskip+2pt} + \begingroup \centering\zihao{4} \zhnumsetup{time=Chinese}\exp_args:No \zhdate{ \l__gdut_info_date_tl }\zhnumsetup{time=Arabic}\par \endgroup + \newpage + \vspace*{0.4\baselineskip-1.5pt} + \begingroup \centering + \begin{tabular}{>{\zihao{4}}r@{\hspace*{8\ccwd}}>{\zihao{4}\raggedright\arraybackslash}p{6\ccwd}@{\hspace*{6\ccwd}}>{\zihao{4}}p{12\ccwd}} + 分类号: & & 学校代号:11845 \\[5pt] + UDC: & 密级:\bool_if:NT \l__gdut_secret_bool {\l__gdut_info_secret_level_tl} & 学\hspace*{2\ccwd}号:\l__gdut_info_student_id_tl + \end{tabular} + \par \endgroup + \vspace*{1.5\baselineskip+4pt} + \begingroup \centering\bfseries\zihao{-2} 广东工业大学 \__gdut_thesis_type: 论文\par \endgroup + \begingroup \centering\zihao{4} \__gdut_degree_type:\par \endgroup + \vspace*{0.8\baselineskip+0.75pt} + \begingroup \centering\sffamily\zihao{2} \l__gdut_info_title_tl\par \endgroup + \vspace*{\baselineskip+5.75pt} + \begingroup \centering\zihao{3} \l__gdut_info_author_tl\par \endgroup + \vspace*{7.5\baselineskip-5pt} + \begingroup \centering\zihao{4} + \begin{tabular}{c>{\centering\arraybackslash}p{14\ccwd}} + \multirow{4}*{ + \begin{CJKfilltwosides*}{0pt} + 指导教师姓名、职称:\\ + \__gdut_course_name: 名称:\\ + 学生所属学院:\\ + 论文答辩日期: + \end{CJKfilltwosides*} + } & \l__gdut_info_supervisor_tl \\ + \cline{2-2} + & \l__gdut_info_major_tl \\ + \cline{2-2} + & \l__gdut_info_department_tl \\ + \cline{2-2} + & \exp_args:No \zhdate{\l__gdut_info_date_tl} \\ + \cline{2-2} + \end{tabular} + \par \endgroup + \newpage + \vspace*{0.9\baselineskip} + \begingroup \centering\zihao{4} + A~Dissertation~Submitted~to~Guangdong~University~of~Technology\\[-0.15\baselineskip] for~the~Degree~of~Master + \par \endgroup + \begingroup \centering\zihao{-4} + \__gdut_degree_en_type: + \par \endgroup + \vspace*{2\baselineskip} + \begingroup \centering\zihao{-2}\sffamily + \l__gdut_info_title_en_tl + \par \endgroup + \vspace*{6\baselineskip} + \begingroup \centering\zihao{-3}\sffamily + Candidate:~\l__gdut_info_author_en_tl\\ + Supervisor:~\l__gdut_info_supervisor_en_tl + \par \endgroup + \vspace*{9\baselineskip} + \begingroup \centering\zihao{-4}\sffamily\linespread{1.15}\selectfont + \exp_args:No \engdate{\l__gdut_info_date_tl}\\ + School~of~\l__gdut_info_department_en_tl\\ + Guangdong~University~of~Technology\\ + Guangzhou,~Guangdong,~P.~R.~China,~510006 + \par \endgroup + \if@openright \cleardoublepage \else \clearpage \fi + \pagestyle{fancy} +} +\endinput \ No newline at end of file diff --git a/main.tex b/main.tex new file mode 100644 index 0000000..eecb5a1 --- /dev/null +++ b/main.tex @@ -0,0 +1,187 @@ +%********************************************************************* +% gdutthesis: 广东工业大学论文模板 +% 2021/06/07 v0.1a +% +% 重要提示: +% 1. 请确保使用 UTF-8 编码保存 +% 2. 请使用 XeLaTeX 或 LuaLaTeX 编译 +% 3. 请仔细阅读用户文档 +% 4. 修改、使用、发布本文档请务必遵循 LaTeX Project Public License +% 5. 不需要的注释可以尽情删除 +%********************************************************************* +\documentclass[ + % type=doctor + type=master + % type=promaster +]{gdutthesis} + +% 宏包在这里加载 +\usepackage{siunitx,zhlipsum,lipsum} + +\gdutsetup{ + style = { + font = {times}, + % font = {times*}, + cjk-font = {fandol}, + % cjk-font = {founder}, + % cjk-font = {mac}, + % cjk-font = {sourcehan}, + % cjk-font = {noto}, + % cjk-font = {windows}, + % cjk-font = {none}, + bib-backend = {bibtex}, + % bib-backend = {biblatex}, + bib-resource = {gdutthesis-template.bib}, + bib-style = {numerical}, + % bib-style = {author-year}, + fullwidth-stop = {mapping}, + % fullwidth-stop = {catcode}, + % fullwidth-stop = {false}, + hyperlink = {color}, + % hyperlink = {border}, + % hyperlink = {none}, + hyperlink-color = {default}, + % hyperlink-color = {autumn}, + % hyperlink-color = {business}, + % hyperlink-color = {classic}, + % hyperlink-color = {elegant}, + % hyperlink-color = {fantasy}, + % hyperlink-color = {material}, + % hyperlink-color = {science}, + % hyperlink-color = {summer}, + % hyperlink-color = {graylevel}, + % hyperlink-color = {prl}, + }, + info = { + title = {模板射流电解加工微沟槽关键技术研究}, + title* = {Investigation on masked jet electrochemical machining of micro grooves}, + date = {2020/5/25}, + author = {张三}, + author* = {Zhang San}, + supervisor = {李四\qquad 教授}, + supervisor* = {Prof. Li Si}, + department = {自动化学院}, + department* = {Automation}, + major = {电子信息(控制工程方向)}, + student-id = {2121001234}, + degree = {Eng-Sci}, + keywords = {电解加工, 微沟槽, 模板, 射流}, + keywords* = {electrochemical machining, micro grooves, mask, jet}, + secret-level = {none}, + } +} + + +\begin{document} + +\begin{abstract} + \zhlipsum[1-4] +\end{abstract} + +\begin{abstract*} + \lipsum[1-4] +\end{abstract*} + +\begin{notation} + $E$ & 能量 \\ + $F$ & 推力 +\end{notation} + +\gduttableofcontents + +\mainmatter + +\gdutchapter{绪论}{Introduction} + +\gdutsection{本课题研究背景及研究意义}{Background and significance of research} +随着科学技术的进步,产品逐渐向精密化和高性能化发展,具有毫米及微米尺度 +微沟槽结构的金属零部件在国防军事、航空航天、新能源、新材料、生物医学、半导 +体器件等领域的高技术产品中扮演的角色愈加重要。 + +\gdutsection{微沟槽电解加工国内外相关研究现状}{Analysis of the research status at home and abroad} +\gdutsubsection{成型电极电解加工}{Shaped cathode electrochemical machining} +采用与微沟槽结构形状对应的成型阴极,例如薄板阴极,片状阴极等,进行微沟 +槽电解加工,其特点是方便一次成型微沟槽形状。南京航空航天大学吕焱明等进行了 +大长宽比深窄槽电解加工阴极设计以及工艺试验研究\cite{feynman2011feynman},如\autoref{fig:example} 所示,具体参考\autoref{sub-fig-1} 和\autoref{sub-fig-2},再参考\autoref{eq:example},再再参考\autoref{tab:example}。 +\begin{equation}\label{eq:example} + E = mc^2 +\end{equation} + +\begin{figure}[htbp] + \subfloat[贴有模板的金属喷嘴示意图]{\label{sub-fig-1} + \includegraphics[width=0.4\textwidth]{example-image.pdf} + } + \qquad + \subfloat[由点到线扫描加工原理图]{\label{sub-fig-2} + \includegraphics[width=0.4\textwidth]{example-image.pdf} + } + \bicaption{模板射流电解加工微沟槽原理图}{Principle of masked jet electrochemical machining of micro grooves} + \label{fig:example} +\end{figure} + +\begin{table} + \bicaption{DMC5400A 运动控制卡主要技术指标}{DMC5400A main specifications} + \label{tab:example} + \begin{tabular}{cc} + \toprule + 控制卡技术指标 & 具体参数 \\ + \midrule + 控制电机的脉冲信号频率范围 & $\qty{1}{Hz}\sim\qty{2}{MHz}$ \\ + 控制电机的脉冲信号频率精度 & \qty{0.0625}{Hz} \\ + 脉冲信号输出最大电流 & \qty{20}{mA} \\ + 脉冲信号长度 & 28 位有符号 \\ + 直线插补精度 & $\pm \qty{0.8}{pulse}$ \\ + 圆弧插补精度 & $\pm \qty{1.5}{pulse}$ \\ + 支持的插补坐标系个数 & 2 \\ + \bottomrule + \end{tabular} +\end{table} + + +\subsubsection{微沟槽电解加工国内外相关研究现状} +测试 test。 +\paragraph{测试 test。} +测试 test。 +\subparagraph{测试 test。} +测试 test\cite{曾谨言2013量子力学}。 + +\gdutbackmatter +\gdutchapter{结论与展望}{Conclusion and prospect} +\gdutbacksection{研究结论} +\zhlipsum[1] + +\gdutbacksection{未来研究展望} +\zhlipsum[1] + +\printbibliography + +\gdutchapter{攻读学位期间取得与学位论文相关的成果}{Publication and patents during study} + +\gdutbacksection{发表和投稿与学位论文相关学术论文} + +\begin{results} + \item \textbf{张三}, 李四, 等. Jet electrochemical machining of micro dimples with conductive mask. + Journal of Materials Processing Technology. 2018, 257:101-111. (SCI Impact Factor 3.647, + WOS:000431161400010) + \item 李四, \textbf{张三}, 王五, 等. Electrochemical direct-writing machining of micro- channel array. + Journal of Materials Processing Technology. 2019, 265:138-149. (SCI Impact Factor 3.647, + WOS:000451935100014) +\end{results} + +\gdutbacksection{申请发明专利} + +\begin{results} + \item 李四, \textbf{张三}, 王五. 一种微流道电解加工装置. 发明专利申请号: 201810467763.5. +\end{results} + +\gdutstatement + +\gdutchapter{致谢}{Acknowlegements} +\zhlipsum[1] + +\gdutappendix + +\gdutchapter{附录标题}{The appendix title} +对需要收录于学位论文中且又不适合书写于正文中的附加数据、资料、详细 +公式推导、计算机程序等有特色的内容,可做为附录排写。 +\end{document} \ No newline at end of file diff --git a/user-manual/fdudoc.cls b/user-manual/fdudoc.cls new file mode 100644 index 0000000..612381a --- /dev/null +++ b/user-manual/fdudoc.cls @@ -0,0 +1,1063 @@ +%% +%% This is file `fdudoc.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fduthesis.dtx (with options: `doc') +%% fduthesis-doc.dtx (with options: `doc') +%% +%% Copyright (C) 2017--2021 by Xiangdong Zeng +%% +%% 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: +%% +%% 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 Xiangdong Zeng. +%% +%% This work consists of the files fduthesis.dtx, +%% fduthesis-doc.dtx, +%% fduthesis-logo.dtx, +%% fduthesis-template.tex, +%% and the derived files fduthesis.ins, +%% fduthesis.cls, +%% fduthesis-en.cls, +%% fduthesis.def, +%% fdudoc.cls, +%% fdulogo.sty, +%% fdulogo-example.tex, +%% fduthesis-cover.tex, +%% fduthesis-en.tex, +%% fudan-emblem.pdf, +%% fudan-emblem-new.pdf, +%% fudan-name.pdf, +%% fduthesis.pdf, +%% fduthesis-en.pdf, +%% fduthesis-code.pdf, +%% and README.md. +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo $Id: fduthesis.dtx 0.7e 2020-08-30 12:00:00Z Xiangdong Zeng $ + {Documentation class for fduthesis} +\ProvidesExplClass{fdudoc} + {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\ExplSyntaxOff +\@namedef{ver@thumbpdf.sty}{9999/99/99} +\PassOptionsToPackage{log-declarations = false}{xparse} +\LoadClass[a4paper, full]{l3doc} +\RequirePackage[UTF8, heading, sub3section, fontset = none]{ctex} +\RequirePackage{% + caption, + geometry, + graphicx, + listings, + makecell, + siunitx, + tabularx, + threeparttable, + unicode-math, + xcolor, + xcolor-material, + xunicode, + zref-base +} +\def\macro@code{% + \topsep \MacrocodeTopsep + \@beginparpenalty \predisplaypenalty + \partopsep \z@skip + \trivlist \parskip \z@ \item[]% + \MacroFont + \leftskip\@totalleftmargin \advance\leftskip\MacroIndent + \rightskip\z@ \parindent\z@ \parfillskip\@flushglue + \blank@linefalse \def\par{\ifblank@line + \leavevmode\fi + \blank@linetrue\@@par + \penalty\interlinepenalty} + \obeylines + \let\do\do@noligs \verbatim@nolig@list + \let\do\@makeother \dospecials + \global\@newlistfalse + \global\@minipagefalse + \init@crossref} +\ExplSyntaxOn +\tl_new:N \l__fdudoc_tmpa_tl +\tl_new:N \l__fdudoc_tmpb_tl +\cs_new_protected:Npn \__fdudoc_patch_cmd:Nnn #1#2#3 + { + \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \__fdudoc_preto_cmd:Nn #1#2 + { + \ctex_preto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \__fdudoc_appto_cmd:Nn #1#2 + { + \ctex_appto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +\cs_set_protected_nopar:Npn \xmacro@code + { \__fdudoc_marco_code:w } +\cs_set_protected_nopar:Npn \sxmacro@code + { + \fontspec_print_visible_spaces: + \xmacro@code + } +\cs_new_protected_nopar:Npn \__fdudoc_marco_code:w + { + \ifcodeline@index + \__fdudoc_marco_code_every_par:n { \__fdudoc_code_line_no: } + \else: + \__fdudoc_marco_code_every_par:n { } + \fi: + \__fdudoc_make_finish_tag:x { \@currenvir } + \__fdudoc_macro_code_start:w + } +\cs_new_protected:Npn \__fdudoc_marco_code_every_par:n #1 + { + \everypar + { + \everypar {#1} + \if@inlabel + \global \@inlabelfalse \@noparlistfalse + \llap { \box \@labels \hskip \leftskip } + \fi + #1 + } + } +\group_begin: + \int_set:Nn \tex_endlinechar:D { -1 } + \use:n + { + \char_set_catcode_active:n { 32 } + \tl_const:Nn \c__fdudoc_active_space_tl + } + { } +\group_end: +\group_begin: + \char_set_catcode_active:n { 13 } + \cs_new_protected:Npx \__fdudoc_make_finish_tag:n #1 + { + \tl_set:Nn \exp_not:N \l__fdudoc_macro_code_finish_tl + { + \c_percent_str + \prg_replicate:nn { 4 } + { \exp_not:o { \c__fdudoc_active_space_tl } } + \exp_not:o { \active@escape@char } end + \c_left_brace_str #1 \c_right_brace_str + \exp_not:N ^^M + } + } + \cs_generate_variant:Nn \__fdudoc_make_finish_tag:n { x } + \cs_new_protected:Npn \__fdudoc_macro_code_start:w #1 + { + \str_if_eq:nnTF {#1} { ^^M } + { \__fdudoc_macro_code_read_line:w } + { \__fdudoc_macro_code_read_line:w #1 } + } + \cs_new_protected:Npn \__fdudoc_macro_code_read_line:w #1 ^^M + { + \tl_set:Nn \l__fdudoc_macro_code_line_tl { #1 ^^M } + \tl_if_eq:NNTF + \l__fdudoc_macro_code_line_tl \l__fdudoc_macro_code_finish_tl + { \exp_args:Nx \end { \@currenvir } } + { + \__fdudoc_macro_code_process_line: + \__fdudoc_macro_code_read_line:w + } + } + \cs_new_protected:Npn \__fdudoc_swap_cr: + { + \exp_after:wN + \__fdudoc_swap_cr_aux:w \l__fdudoc_macro_code_line_tl + } + \cs_new_protected:Npn \__fdudoc_swap_cr_aux:w #1 ^^M + { + \group_insert_after:N ^^M + \tl_set:Nn \l__fdudoc_macro_code_line_tl {#1} + } + \tl_const:Nn \c__fdudoc_active_cr_tl { ^^M } +\group_end: +\tl_new:N \l__fdudoc_macro_code_line_tl +\tl_new:N \l__fdudoc_macro_code_finish_tl +\tl_new:N \g__fdudoc_macro_code_verbatim_stop_tl +\cs_new_protected_nopar:Npn \__fdudoc_process_normal_line: + { + \str_case_e:nnF + { \str_head:N \l__fdudoc_macro_code_line_tl } + { + { \c_percent_str } + { + \__fdudoc_check_angle:x + { \tl_tail:N \l__fdudoc_macro_code_line_tl } + } + { \c_hash_str } + { \__fdudoc_output_comment_line: } + } + { \__fdudoc_output_line: } + } +\cs_new_protected_nopar:Npn \__fdudoc_process_verbatim_line: + { + \tl_if_eq:NNTF \l__fdudoc_macro_code_line_tl + \g__fdudoc_macro_code_verbatim_stop_tl + { + \tl_gclear:N \g__fdudoc_macro_code_verbatim_stop_tl + \cs_gset_eq:NN \__fdudoc_macro_code_process_line: + \__fdudoc_process_normal_line: + \__fdudoc_output_module:nn + { \color { verb@guard } } + { + \__fdudoc_swap_cr: + \__fdudoc_module_pop:n { \l__fdudoc_macro_code_line_tl } + } + } + { \tl_use:N \l__fdudoc_macro_code_line_tl } + } +\cs_new_eq:NN \__fdudoc_macro_code_process_line: + \__fdudoc_process_normal_line: +\DeclareDocumentCommand \CheckModules { } + { + \cs_set_eq:NN \__fdudoc_macro_code_process_line: + \__fdudoc_process_normal_line: + } +\DeclareDocumentCommand \DontCheckModules { } + { + \cs_set_eq:NN \__fdudoc_macro_code_process_line: + \__fdudoc_output_line: + } +\cs_new_protected:Npn \__fdudoc_check_angle:n #1 + { + \str_if_eq:eeTF { \str_head:n {#1} } { < } + { \__fdudoc_check_module:x { \tl_tail:n {#1} } } + { \__fdudoc_output_comment_line: } + } +\cs_generate_variant:Nn \__fdudoc_check_angle:n { x } +\cs_new_protected:Npn \__fdudoc_check_module:n #1 + { + \str_case_e:nnF { \str_head:n {#1} } + { + { * } { \__fdudoc_module_star:w } + { / } { \__fdudoc_module_slash:w } + { @ } { \__fdudoc_module_at:w } + { < } { \__fdudoc_module_verb:w } + } + { \__fdudoc_module_pm:w } + #1 \q_stop + } +\cs_generate_variant:Nn \__fdudoc_check_module:n { x } +\group_begin: + \char_set_catcode_active:N \> + \cs_new_protected:Npn \__fdudoc_module_star:w #1 > #2 \q_stop + { + \tl_set:Nn \l__fdudoc_tmpa_tl {#2} + \tl_if_eq:NNTF \l__fdudoc_tmpa_tl \c__fdudoc_active_cr_tl + { + \__fdudoc_output_module:nn + { \__fdudoc_star_color: } + { + \__fdudoc_module_push:n + { \__fdudoc_module_angle:n {#1} } + } + } + { + \__fdudoc_output_module_left:nn + { \__fdudoc_star_color: } + { + \__fdudoc_module_push:n + { \__fdudoc_module_angle:n {#1} } + } + } + \__fdudoc_output_line:n {#2} + } + \cs_new_protected:Npn \__fdudoc_module_slash:w #1 > #2 \q_stop + { + \tl_set:Nn \l__fdudoc_tmpa_tl {#2} + \tl_if_eq:NNTF \l__fdudoc_tmpa_tl \c__fdudoc_active_cr_tl + { + \__fdudoc_output_module:nn + { \__fdudoc_slash_color: } + { + \__fdudoc_module_pop:n + { \__fdudoc_module_angle:n {#1} } + } + } + { + \__fdudoc_output_module_left:nn + { \__fdudoc_slash_color: } + { + \__fdudoc_module_pop:n + { \__fdudoc_module_angle:n {#1} } + } + } + \__fdudoc_output_line:n {#2} + } + \cs_new_protected:Npn \__fdudoc_module_at:w @ @ = #1 > #2 \q_stop + { + \__fdudoc_output_module:nn + { \color { at@guard } } + { \__fdudoc_module_angle:n { @ @ = #1 } } + \tl_gset:Nn \g__codedoc_module_name_tl {#1} + \__fdudoc_output_line:n {#2} + } + \cs_new_protected:Npn \__fdudoc_module_verb:w #1 \q_stop + { + \cs_gset_eq:NN \__fdudoc_macro_code_process_line: + \__fdudoc_process_verbatim_line: + \tl_gset:Nx \g__fdudoc_macro_code_verbatim_stop_tl + { \c_percent_str \tl_tail:n {#1} } + \__fdudoc_output_module:nn + { \color { verb@guard } } + { + \__fdudoc_swap_cr: + \__fdudoc_module_push:n { \l__fdudoc_macro_code_line_tl } + } + } + \cs_new_protected:Npn \__fdudoc_module_pm:w #1 > #2 \q_stop + { + \__fdudoc_output_module_left:nn + { \__fdudoc_pm_color: } + { \__fdudoc_module_angle:n {#1} } + \__fdudoc_output_line:n {#2} + } +\group_end: +\cs_new_protected:Npn \__fdudoc_output_line:n #1 + { + \tl_set:Nn \l__fdudoc_macro_code_line_tl {#1} + \tl_if_eq:NNTF + \l__fdudoc_macro_code_line_tl \c__fdudoc_active_cr_tl + { \tl_use:N \l__fdudoc_macro_code_line_tl } + { + \str_if_eq:eeTF + { \str_head:N \l__fdudoc_macro_code_line_tl } { \c_percent_str } + { \__fdudoc_output_comment_line: } { \__fdudoc_output_line: } + } + } +\cs_new_protected_nopar:Npn \__fdudoc_output_line: + { + \tex_noindent:D + \__fdudoc_replace_at_at:N \l__fdudoc_macro_code_line_tl + \tl_use:N \l__fdudoc_macro_code_line_tl + } +\cs_new_protected:Npn \__fdudoc_output_comment_line: + { + \tex_noindent:D + \group_begin: + \__fdudoc_swap_cr: + \color { code@gray } \slshape \__fdudoc_output_line: + \group_end: + } +\cs_new_protected:Npn \__fdudoc_replace_at_at:N #1 + { + \tl_if_empty:NF \g__codedoc_module_name_tl + { \__fdudoc_replace_at_at_aux:No #1 \g__codedoc_module_name_tl } + } +\cs_new_protected:Npn \__fdudoc_replace_at_at_aux:Nn #1#2 + { + \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } + } +\cs_generate_variant:Nn \__fdudoc_replace_at_at_aux:Nn { No } +\cs_new_protected_nopar:Npn \__fdudoc_module_push:n + { \__fdudoc_module_push_aux:on { \int_use:N \c@HD@hypercount } } +\cs_new_protected:Npn \__fdudoc_module_push_aux:nn #1 + { + \seq_gpush:Nn \g__fdudoc_module_dest_seq {#1} + \hypersetup { hidelinks } + \exp_args:Nx \hdclindex + { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { } + } +\cs_generate_variant:Nn \__fdudoc_module_push_aux:nn { on } +\cs_new_protected_nopar:Npn \__fdudoc_module_pop:n + { + \seq_gpop:NNTF \g__fdudoc_module_dest_seq \l__fdudoc_tmpa_tl + { \__fdudoc_module_pop_aux:on { \l__fdudoc_tmpa_tl } } + { \BOOM \use:n } + } +\cs_new_protected:Npn \__fdudoc_module_pop_aux:nn #1 + { + \zref@labelbylist { HD.#1 } { fdudoc } + \hypersetup { hidelinks } + \hdclindex {#1} { } + } +\cs_generate_variant:Nn \__fdudoc_module_pop_aux:nn { on } +\seq_new:N \g__fdudoc_module_dest_seq +\zref@newlist { fdudoc } +\zref@newprop { guard@end } [ 1 ] + { \int_eval:n { \c@HD@hypercount - 1 } } +\zref@addprop { fdudoc } { guard@end } +\cs_set_protected:Npn \MacroFont + { + \linespread { 1.05 } + \small \ttfamily \mdseries \upshape + \__fdudoc_verb_addon: + } +\cs_new_protected:Npn \__fdudoc_output_module:nn #1#2 + { + \tex_noindent:D + \group_begin: + #1 + \footnotesize \normalfont \sffamily #2 + \group_end: + } +\cs_new_protected:Npn \__fdudoc_output_module_left:nn #1#2 + { + \tex_noindent:D + \hbox_overlap_left:n + { + \__fdudoc_output_module:nn {#1} {#2} + \skip_horizontal:n { \leftskip + \smallskipamount } + } + } +\cs_new_protected_nopar:Npn \__fdudoc_star_color: + { + \seq_gpop:NNTF \g__fdudoc_star_color_seq \current@color + { \set@color } + { \__fdudoc_select_color: } + \seq_gpush:No \g__fdudoc_slash_color_seq { \current@color } + } +\cs_new_protected_nopar:Npn \__fdudoc_slash_color: + { + \seq_gpop:NNTF \g__fdudoc_slash_color_seq \current@color + { + \set@color + \seq_gpush:No \g__fdudoc_star_color_seq { \current@color } + } + { \BOOM } + } +\cs_new_protected_nopar:Npn \__fdudoc_pm_color: + { + \seq_get:NNTF \g__fdudoc_star_color_seq \current@color + { \set@color } + { + \__fdudoc_select_color: + \seq_gpush:No \g__fdudoc_star_color_seq { \current@color } + } + } +\seq_new:N \g__fdudoc_star_color_seq +\seq_new:N \g__fdudoc_slash_color_seq +\cs_new_protected_nopar:Npn \__fdudoc_select_color: + { \color { guard@series!!+ } } +\definecolorseries { guard@series } + { cmyk } { last } { blue } { purple } +\resetcolorseries [ 3 ] { guard@series } +\definecolor { verb@guard } { named } { MaterialLime600 } +\definecolor { at@guard } { named } { MaterialPink } +\definecolor { code@gray } { named } { MaterialGrey } +\cs_new_protected:Npn \__fdudoc_module_angle:n #1 + { < #1 > } +\cs_new_protected_nopar:Npn \__fdudoc_code_line_no: + { + \int_gincr:N \c@CodelineNo + \hbox_overlap_left:n + { + \hbox_to_wd:nn + { \MacroIndent } + { + \HD@target + \tex_hss:D \__fdudoc_code_line_no_style: + \theCodelineNo \enspace + } + \tex_kern:D \@totalleftmargin + } + } +\tl_set:Nn \theCodelineNo { \arabic { CodelineNo } } +\cs_new_protected_nopar:Npn \__fdudoc_code_line_no_style: + { \color { code@gray } \normalfont \sffamily \tiny } +\cs_set_protected:Npn \HD@SetMacroIndent #1 + { + \group_begin: + \settowidth \MacroIndent + { + \__fdudoc_code_line_no_style: + \prg_replicate:nn { \tl_count:n {#1} } { 0 } + \enspace + } + \dim_gset_eq:NN \MacroIndent \MacroIndent + \group_end: + } +\sys_if_engine_xetex:TF + { + \cs_set_eq:NN \__fdudoc_verb_addon: \xeCJKVerbAddon + \cs_set:Nn \__fdudoc_plain_punct_style: + { \xeCJKsetup { PunctStyle = plain } } + \cs_set:Nn \__fdudoc_disable_ecglue: + { \xeCJKsetup { CJKecglue } } + \__fdudoc_appto_cmd:Nn \meta@font@select + { \mode_if_inner:T { \__fdudoc_disable_ecglue: } } + } + { + \cs_set_eq:NN \__fdudoc_verb_addon: \prg_do_nothing: + \cs_set_eq:NN \__fdudoc_plain_punct_style: \prg_do_nothing: + \cs_set:Nn \__fdudoc_disable_ecglue: + { \ltjsetparameter { autoxspacing = false } } + \__fdudoc_appto_cmd:Nn \meta@font@select + { \__fdudoc_disable_ecglue: } + } +\BeforeBeginEnvironment { function } + { \par \nointerlineskip } +\AtEndEnvironment { function } + { + \par + \cs_gset:Nx \__fdudoc_fix_previous_depth: + { \prevdepth = \the \prevdepth \space } + } +\AfterEndEnvironment { function } + { \__fdudoc_fix_previous_depth: } +\AtBeginEnvironment { syntax } + { + \linespread { 1.2 } + \__fdudoc_plain_punct_style: + \__fdudoc_disable_ecglue: + } +\AtBeginEnvironment { fdusyntax } + { + \cs_set:Npn \lparen { \textup { ( } } + \cs_set:Npn \rparen { \textup { ) } } + \char_set_catcode_active:N | + \char_set_catcode_active:N < + \char_set_catcode_active:N ( + \char_set_active_eq:NN | \orbar + \char_set_active_eq:NN < \syntaxopt@aux + \char_set_active_eq:NN ( \defaultval@aux + } +\cs_new_eq:NN \__fdudoc_ltx_changes:nnn \changes@ +\cs_set_protected:Npn \changes@ #1#2 + { + \__fdudoc_save_version_date:nn {#1} {#2} + \__fdudoc_ltx_changes:nnn {#1} {#2} + } +\prop_new:N \g__fdudoc_version_date_prop +\cs_new_protected:Npn \__fdudoc_save_version_date:nn #1#2 + { + \prop_get:NnNTF \g__fdudoc_version_date_prop + {#1} \l__fdudoc_tmpa_tl + { + \exp_after:wN + \__fdudoc_save_version_date_aux:nnnn \l__fdudoc_tmpa_tl + {#2} {#1} + } + { \__fdudoc_save_version_date_aux:nnn {#1} {#2} {#2} } + } +\cs_new_protected:Npn \__fdudoc_save_version_date_aux:nnnn #1#2#3#4 + { + \__fdudoc_if_date_later:nnTF {#1} {#3} + { \__fdudoc_save_version_date_aux:nnn {#4} {#3} {#2} } + { + \__fdudoc_if_date_later:nnT {#3} {#2} + { \__fdudoc_save_version_date_aux:nnn {#4} {#1} {#3} } + } + } +\cs_new_protected:Npn \__fdudoc_save_version_date_aux:nnn #1#2#3 + { \prop_gput:Nnn \g__fdudoc_version_date_prop {#1} { {#2} {#3} } } +\prg_new_conditional:Npnn \__fdudoc_if_date_later:nn #1#2 { TF, T } + { + \if_int_compare:w + \__fdudoc_parse_date:w #1 / / / 0 \q_stop > + \__fdudoc_parse_date:w #2 / / / 0 \q_stop \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \__fdudoc_parse_date:w #1/#2/#3/ #4 \q_stop + { #1#2#3 } +\cs_new_protected:Npn \CTEX@versionitem #1 \efill + { + \@idxitem + \prop_get:NnNTF \g__fdudoc_version_date_prop + {#1} \l__fdudoc_tmpa_tl + { + \exp_after:wN + \__fdudoc_print_version_date:nnn \l__fdudoc_tmpa_tl + {#1} + } + { \BOOM } + } +\cs_new_protected:Npn \__fdudoc_print_version_date:nnn #1#2#3 + { + \noindent + \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } } + \textbf {#3} \hfill + \hbox:n + { + \footnotesize + \str_if_eq:nnTF {#1} {#2} + { ( #1 ) } { ( #1 ~ -- ~ #2 ) } + } + \par \nopagebreak + } +\ctex_patch_cmd:Nnn \HDorg@theglossary + { \let \item \@idxitem } + { \let \item \CTEX@versionitem } +\ctex_patch_cmd:Nnn \@wrglossary + { hdpindex } + { + \ifnum \c@HD@hypercount = \z@ + hdpindex + \else + hdclindex { \the \c@HD@hypercount } + \fi + } +\ctex_patch_cmd:Nnn \@addtocurcol + { \vskip \intextsep } + { + \edef \save@first@penalty { \the \lastpenalty } \unpenalty + \ifnum \lastpenalty = \@M + \unpenalty + \else + \penalty \save@first@penalty \relax + \fi + \ifnum \outputpenalty < -\@Mii + \addvspace\intextsep + \vskip\parskip + \else + \addvspace\intextsep + \fi + } +\ctex_patch_cmd:Nnn \@addtocurcol + { + \vskip \intextsep + \ifnum \outputpenalty < -\@Mii + \vskip -\parskip + \fi + } + { + \ifnum \outputpenalty < -\@Mii + \aftergroup \vskip \aftergroup \intextsep + \aftergroup \nointerlineskip + \else + \vskip \intextsep + \fi + } +\ctex_patch_cmd:Nnn \@getpen { \@M } { \@Mi } +\ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em } +\ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em } +\__fdudoc_preto_cmd:Nn \@thehead + { \cs_set_eq:cN { MakeUppercase \space } \@iden } +\ctex_patch_cmd:Nnn \HDorg@thebibliography + { \section* } { \section } +\cs_set_eq:NN \thebibliography \HDorg@thebibliography +\__fdudoc_appto_cmd:Nn \GlossaryParms + { + \raggedcolumns + \cs_set_eq:NN \Hy@writebookmark \HDorg@writebookmark + \cs_set:Npn \@idxitem { \par \hangindent 2em } + \cs_set:Npn \subitem { \@idxitem \hspace* { 1em } } + \cs_set:Npn \subsubitem { \@idxitem \hspace* { 2em } } + } +\ctex_patch_cmd:Nnn \HoLogo@LaTeXe + { \hbox { \HOLOGO@MathSetup 2 $ _{ \textstyle \varepsilon } $ } } + { + \hbox + { + \mathsurround 0pt \relax + 2 + \if b \expandafter \@car \f@series \@nil + $ _{ \textstyle \symbf { \varepsilon } } $ + \else + $ _{ \textstyle \varepsilon } $ + \fi + } + } +\ctex_patch_cmd:Nnn \SpecialMainEnvIndex + { (environment) } { ~ 环境 } +\ctex_patch_cmd:Nnn \SpecialMainEnvIndex + { environments: } { 环境: } +\ctex_patch_cmd:Nnn \HDorg@SpecialEnvIndex + { (environment) } { ~ 环境 } +\ctex_patch_cmd:Nnn \HDorg@SpecialEnvIndex + { environments: } { 环境: } +\cs_set_eq:NN \list \__codedoc_oldlist:nn +\__fdudoc_patch_cmd:Nnn \__codedoc_function_descr_start:w + { \noindent } + { \skip_vertical:n { -\parskip } \noindent } +\__fdudoc_preto_cmd:Nn \__codedoc_function_assemble: + { + \box_if_empty:NTF \g__codedoc_syntax_box + { \skip_zero:N \medskipamount } + { \skip_add:Nn \medskipamount { \parskip } } + } +\__fdudoc_patch_cmd:Nnn \__codedoc_typeset_functions: + { \small \ttfamily } { \footnotesize \ttfamily } +\__fdudoc_preto_cmd:Nn \__codedoc_typeset_functions: + { \MacroFont } +\__fdudoc_patch_cmd:Nnn \__codedoc_macro_init: + { \hbox:n } { \MacroFont \hbox:n } +\__fdudoc_patch_cmd:Nnn \__codedoc_macro_dump: + { \hbox_unpack_drop:N } { \MacroFont \hbox_unpack_drop:N } +\__fdudoc_patch_cmd:Nnn \__codedoc_meta_original:n + { \ensuremath \langle } { \textlangle } +\__fdudoc_patch_cmd:Nnn \__codedoc_meta_original:n + { \ensuremath \rangle } { \textrangle } +\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n +\cs_set_protected:Npn \__codedoc_typeset_TF: + { + \group_begin: + \exp_args:No \__codedoc_if_macro_internal:nT \l__codedoc_tmpa_tl + { \color [ gray ] { 0.5 } } + \itshape TF + \makebox [ 0 pt ] [ r ] + { + \color { red } + \underline { \phantom { \itshape TF } \kern -0.1 em } + } + \group_end: + } +\cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2 + { + \vbox_set:Nn \l__codedoc_macro_box + { + \MacroFont + \vbox_unpack_drop:N \l__codedoc_macro_box + \hbox_set:Nn \l_tmpa_box + { \__codedoc_print_macroname:nN {#1} #2 } + \dim_set:Nn \l_tmpa_dim + { \marginparwidth - \labelsep - \marginparsep } + \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim + { + \box_resize_to_wd_and_ht:Nnn \l_tmpa_box + { \l_tmpa_dim } { \box_ht:N \l_tmpa_box } + } + \hbox_overlap_left:n + { + \box_use:N \l_tmpa_box + \skip_horizontal:n { \marginparsep - \labelsep } + } + } + \int_incr:N \l__codedoc_macro_int + } +\cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2 + { + \strut + \__codedoc_get_hyper_target:xN + { + \exp_not:n {#1} + \bool_if:NT #2 { \tl_to_str:n {TF} } + } + \l__codedoc_tmpa_tl + \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl } + { \exp_args:NNo \label@hyperref [ \l__codedoc_tmpa_tl ] } + { \use:n } + { + \tl_set:Nn \l__codedoc_tmpa_tl {#1} + \tl_replace_all:Non \l__codedoc_tmpa_tl + { \c_catcode_other_space_tl } + { \fontspec_visible_space: } + \__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl + \__codedoc_macroname_suffix:N #2 + } + } +\cs_set_protected:Npn \__codedoc_special_index_module:nnnnN #1#2#3#4#5 + { + \use:x + { + \exp_not:n { \__codedoc_special_index_aux:nnnnnnn {#1} {#2} } + \tl_if_empty:nTF {#3} + { { } { } { } { } } + { + \str_if_eq:eeTF {#3} { TeX } + { + { TeX~ and~ LaTeX2e } + { \string \TeX{}~ 和~ \string \LaTeXe{} } + } + { {#3} { \string \pkg {#3} } } + \bool_if:NTF #5 + { { commands~ internal } { ~ 内部命令: } } + { { commands } { ~ 命令: } } + } + } + {#4} + } +\cs_new_protected:Npn \__codedoc_special_index_aux:nnnnnnn #1#2#3#4#5#6#7 + { + \tl_set:Nn \l__codedoc_index_escaped_key_tl {#1} + \__codedoc_quote_special_char:N \l__codedoc_index_escaped_key_tl + \__codedoc_special_index_set:Nn + \l__codedoc_index_escaped_macro_tl {#2} + \str_if_eq:onTF { \@currenvir } { macrocode } + { \codeline@wrindex } + { + \str_case:nnF {#7} + { + { main } { \codeline@wrindex } + { usage } { \index } + } + { \HD@target \index } + } + { + \tl_if_empty:nF { #3 #4 #5 #6 } + { #3 #5 \actualchar #4 #6 \levelchar } + \l__codedoc_index_escaped_key_tl + \actualchar + { + \token_to_str:N \verbatim@font \c_space_tl + \l__codedoc_index_escaped_macro_tl + } + \encapchar + hdclindex { \the \c@HD@hypercount } {#7} + } + } +\DeclareDocumentCommand \StopSpecialIndexModule { } + { + \cs_set_eq:NN + \__codedoc_special_index_module:nnnnN \use_none:nnnnn + } +\tl_map_inline:nn { \actualchar \encapchar \levelchar } + { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } } +\RenewDocumentCommand \meta { m } + { + \group_begin: + \sys_if_engine_xetex:T { \xeCJKsetup { CJKecglue = { } } } + \__codedoc_meta:n {#1} + \group_end: + } +\msg_redirect_name:nnn { l3doc } { foreign-internal } { log } +\msg_redirect_name:nnn { l3doc } { print-changes-howto } { log } +\msg_redirect_name:nnn { l3doc } { print-index-howto } { log } +\ExplSyntaxOff +\AtBeginDocument{% + \addtocontents{toc}{\StopSpecialIndexModule}} +\pdfstringdefDisableCommands{% + \let\path\meta + \let\opt\@firstofone} +\let\@multitoc@starttoc\@starttoc +\renewcommand*\@starttoc[1]{% + \begin{multicols}{2}% + \@multitoc@starttoc{#1}% + \end{multicols}} +\renewcommand\@makefntext[1]{\parindent 0em\noindent\@makefnmark~#1} +\IndexPrologue{% + \section{\indexname}% + \textit{意大利体的数字表示对应索引项出现的页码; + 带下划线的数字表示定义对应索引项的代码行号; + 其他则表示使用对应索引项的代码行号.}} +\def\IndexLayout{% + \newgeometry{% + left = 0.85 in, + right = 0.85 in, + top = 1.25 in, + bottom = 1.00 in}% + \setlength\IndexMin{0.5\textheight}% + \ctexset{section/numbering=false}% + \StopSpecialIndexModule} +\def\indexname{代码索引} +\GlossaryPrologue{\section{\glossaryname}} +\def\glossaryname{修订记录} +\setmainfont{LibertinusSerif}[% + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic, + Scale = 1.1] +\setsansfont{IBMPlexSansCondensed}[% + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic] +\setmonofont{Iosevka Slab}[% + UprightFont = * Light, + BoldFont = * Semibold, + Scale = MatchLowercase] +\setmathfont{LibertinusMath-Regular.otf} +\setCJKmainfont{Source Han Serif SC}[% + ItalicFont = FZKai-Z03, + RawFeature = +fwid] +\setCJKsansfont{Source Han Sans SC}[% + ItalicFont = *, + RawFeature = +fwid] +\setCJKmonofont{sarasa-mono-sc-regular.ttf}[% + UprightFont = *, + BoldFont = sarasa-mono-sc-bold.ttf, + ItalicFont = sarasa-mono-sc-italic.ttf, + BoldItalicFont = sarasa-mono-sc-bolditalic.ttf, + % AutoFakeSlant = 0.1763, % = tan(10 deg) + Scale = 0.8903, + RawFeature = +fwid] +\ctexset{% + section/name = {第,节}, + section/format+ = \raggedright, + paragraph/runin = false, + paragraph/numbering = false, + punct = kaiming} +\setcounter{secnumdepth}{4} +\setcounter{tocdepth}{3} +\pagestyle{plain} +\sisetup{% + number-math-rm = \ensuremath, + inter-unit-product = \ensuremath{{}\cdot{}}, + group-digits = true, + group-minimum-digits = 4, + group-separator = \text{~}, + range-phrase = \symbol{"FF5E}, + separate-uncertainty = true} +\hypersetup{% + bookmarksdepth = 4, + bookmarksnumbered = true, + colorlinks = true, + citecolor = MaterialGreen, + linkcolor = MaterialPink, + urlcolor = MaterialIndigo} +\captionsetup{labelsep = quad, labelfont+ = bf} +\setlist{noitemsep, topsep=\smallskipamount} +\setlist[1]{labelindent=\parindent} +\setlist[enumerate]{leftmargin=*} +\setlist[itemize]{leftmargin=*} +\newlist{optdesc}{description}{3} +\setlist[optdesc]{% + font=\mdseries\small\ttfamily, align=right, + listparindent=\parindent, + labelsep=\marginparsep, labelindent=-\marginparsep, + leftmargin=*} +\renewlist{tablenotes}{description}{1} +\setlist[tablenotes]{% + format=\normalfont\tnote@item, align=right, + listparindent=\parindent, labelindent=\tabcolsep, + leftmargin=*, rightmargin=\tabcolsep, + after=\@noparlisttrue} +\AtBeginEnvironment{tablenotes}{% + \setlength\parindent{2\ccwd}% + \normalfont\footnotesize} +\AtBeginEnvironment{threeparttable}{% + \stepcounter{tpt@id}% + \edef\curr@tpt@id{tpt@\arabic{tpt@id}}} +\newcounter{tpt@id} +\def\tnote@item#1{% + \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1} +\def\TPTtagStyle#1{\hyperlink{\curr@tpt@id-#1}{#1}} +\def\UrlAlphabet{% + \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} +\def\UrlDigits{% + \do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0} +\g@addto@macro\UrlBreaks{\UrlOrds} +\g@addto@macro\UrlBreaks{\UrlAlphabet} +\g@addto@macro\UrlBreaks{\UrlDigits} +\DoNotIndex{\begin,\end, + \a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m, + \n,\o,\p,\q,\r,\s,\t,\u,\v,\w,\x,\y,\z, + \A,\B,\C,\D,\E,\F,\G,\H,\I,\J,\K,\L,\M, + \N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z, + \0,\1,\2,\3,\4,\5,\6,\7,\8,\9} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}} +\newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}} +\newcommand*\expstar{\hyperlink{expstar}{$\symbol{"263B}$}} +\newcommand*\rexpstar{\hyperlink{rexpstar}{$\symbol{"263A}$}} +\ExplSyntaxOn +\cs_set_eq:NN \__codedoc_typeset_exp: \expstar +\cs_set_eq:NN \__codedoc_typeset_rexp: \rexpstar +\ExplSyntaxOff +\renewcommand*\marg[1]{\{\meta{#1}\}} +\renewcommand*\oarg[1]{[\meta{#1}]} +\renewcommand*\parg[1]{(\meta{#1})} +\DeclareDocumentCommand\opt{m}{\texttt{#1}} +\DeclareDocumentCommand\kvopt{mm} + {\texttt{#1\breakablethinspace=\breakablethinspace#2}} +\def\breakablethinspace{\hskip 0.16667em\relax} +\def\syntaxopt#1{\textit{#1}} +\def\defaultval#1{\textbf{\textup{#1}}} +\def\syntaxopt@aux#1>{\syntaxopt{#1}} +\def\defaultval@aux#1){\defaultval{#1}} +\def\orbar{\textup{\textbar}} +\def\TF{true\orbar false} +\def\TTF{\defaultval{true}\orbar false} +\def\TFF{true\orbar\defaultval{false}} +\DeclareDocumentEnvironment{arguments}{} + {\enumerate[% + label={\texttt{\#\arabic*:~}}, labelsep=0pt, nolistsep]}% + {\endenumerate} +\def\TeX{\hologo{TeX}} +\def\LaTeX{\hologo{LaTeX}} +\def\LaTeXe{\hologo{LaTeXe}} +\def\pdfTeX{\hologo{pdfTeX}} +\def\pdfLaTeX{\hologo{pdfLaTeX}} +\def\XeTeX{\hologo{XeTeX}} +\def\XeLaTeX{\hologo{XeLaTeX}} +\def\LuaTeX{\hologo{LuaTeX}} +\def\LuaLaTeX{\hologo{LuaLaTeX}} +\def\AmSLaTeX{\hologo{AmSLaTeX}} +\def\TeXLive{\TeX\ Live} +\def\MiKTeX{\hologo{MiKTeX}} +\def\BibTeX{\hologo{BibTeX}} +\def\BibTeX{\hologo{BibTeX}} +\def\biber{\hologo{biber}} +\def\TikZ{Ti\emph{k}Z} +\renewcommand*\env[1]{\textbf{\texttt{#1}}} +\newcommand*\bashcmd[1]{\texttt{#1}} +\newcommand*\scite[1]{\textsuperscript{\cite{#1}}} +\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}} +\@empty\z@\@empty +\lstdefinestyle{style@base} + { + basewidth = 0.5 em, + gobble = 3, + lineskip = 2 pt, + frame = l, + framerule = 1 pt, + framesep = 0 pt, + escapeinside = {(*}{*)}, + basicstyle = \small\ttfamily\color{MaterialGrey900}, + keywordstyle = \bfseries\color{MaterialIndigo}, + commentstyle = \itshape\color{MaterialGrey600}, + stringstyle = \color{MaterialRed}, + backgroundcolor = \color{MaterialGrey50} + } +\lstdefinestyle{style@shell} + { + style = style@base, + rulecolor = \color{MaterialPink}, + language = bash, + alsoletter = {-}, + emphstyle = \color{MaterialGreen800} + } +\lstdefinestyle{style@latex} + { + style = style@base, + rulecolor = \color{MaterialIndigo}, + language = [LaTeX]TeX, + alsoletter = {*, -}, + texcsstyle = *\color{MaterialDeepOrange}, + emphstyle = [1]\color{MaterialGreen800}, + emphstyle = [2]\color{MaterialTeal} + } +\lstdefinestyle{style@syntax} + { + basewidth = 0.5 em, + gobble = 6, + escapeinside = {(*}{*)}, + language = [LaTeX]TeX, + alsoletter = {*, -}, + basicstyle = \footnotesize\ttfamily\color{MaterialGrey900}, + keywordstyle = \bfseries\color{MaterialIndigo}, + commentstyle = \itshape\color{MaterialGrey600}, + texcsstyle = *\color{MaterialDeepOrange}, + emphstyle = [1]\color{MaterialGreen800}, + emphstyle = [2]\color{MaterialTeal} + } +\lstnewenvironment{shellexample}[1][]{% + \lstset{style=style@shell, #1}}{} +\lstnewenvironment{latexexample}[1][]{% + \lstset{style=style@latex, #1}}{} +\lstnewenvironment{fdusyntax}[1][]{% + \lstset{style=style@syntax, #1}\vspace{-1.8ex}}{} +\endinput +%% +%% End of file `fdudoc.cls'. diff --git a/user-manual/gdutthesis.dtx b/user-manual/gdutthesis.dtx new file mode 100644 index 0000000..bf513ef --- /dev/null +++ b/user-manual/gdutthesis.dtx @@ -0,0 +1,6217 @@ +% \iffalse meta-comment +% !TeX program = XeLaTeX +% !TeX encoding = UTF-8 +% +% Copyright (C) 2017--2021 by Xiangdong Zeng +% +% 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: +% +% 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 Xiangdong Zeng. +% +% This work consists of the files fduthesis.dtx, +% fduthesis-doc.dtx, +% fduthesis-logo.dtx, +% fduthesis-template.tex, +% and the derived files fduthesis.ins, +% fduthesis.cls, +% fduthesis-en.cls, +% fduthesis.def, +% fdudoc.cls, +% fdulogo.sty, +% fdulogo-example.tex, +% fduthesis-cover.tex, +% fduthesis-en.tex, +% fudan-emblem.pdf, +% fudan-emblem-new.pdf, +% fudan-name.pdf, +% fduthesis.pdf, +% fduthesis-en.pdf, +% fduthesis-code.pdf, +% and README.md. +% +%<*internal> +\iffalse +% +% +%<*readme> +The `fduthesis` Class +===================== + +*LaTeX thesis template for Fudan University, v0.7e* + +Overview +-------- + +This template supports doctoral or master dissertion and undergraduate +thesis, both in Chinese or English. With the help of modern LaTeX +technology, `fduthesis` aims to create a simple interface, a normative +format, as well as a hackable class for the users. + +At present, `fduthesis` only supports XeTeX and LuaTeX engines. +Support for pdfTeX and [ApTeX](https://github.com/clerkma/ptex-ng) is +still under development. `fduthesis` only allows UTF-8 encoding. + +The documentation can be found in +[fduthesis.pdf](http://mirrors.ctan.org/macros/latex/contrib/fduthesis/fduthesis.pdf) +(in Chinese) or +[fduthesis-en.pdf](http://mirrors.ctan.org/macros/latex/contrib/fduthesis/fduthesis-en.pdf) +(in English). + +GitHub re­pos­i­tory: . + +Installation +------------ + +To install `fduthesis`, you can use one of the following methods: + +- If you are running TeX Live, the simplest way is to run + + tlmgr install fduthesis + +- Download + [fduthesis.tds.zip](http://mirror.ctan.org/install/macros/latex/contrib/fduthesis.tds.zip) + from CTAN, extract it in the root of one of your TDS trees, and + update the filename database. + +- Get the source from GitHub: + + git clone https://github.com/stone-zeng/fduthesis.git + + Run `install-win.bat` (on Windows) or `install-linux.sh` (on Linux) + to generate the templates and configuration files. These files would + be found in a new-created `thesis` folder. You can enjoy `fduthesis` + here at once. + + For permanent installation, you may move the following files into a + directory where LaTeX will find them (e.g. + `TEXMF/tex/latex/fduthesis/`): + + - `fduthesis.cls` + - `fduthesis-en.cls` + - `fduthesis.def` + - `fdudoc.cls` + - `fdulogo.sty` + - `fudan-emblem.pdf` + - `fudan-emblem-new.pdf` + - `fudan-name.pdf` + + Do not forget to update the filename database afterwards. + +Contributing +------------ + +[Issues](https://github.com/stone-zeng/fduthesis/issues) and +[pull requests](https://github.com/stone-zeng/fduthesis/pulls) +are always welcome. + +License +------- + +This work may be distributed and/or modified under the conditions of +the [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), +either version 1.3c of this license or (at your option) any later +version. + +----- + +Copyright (C) 2017–2021 by Xiangdong Zeng . +% +% +%<*internal> +\fi +\begingroup + \def\NameOfLaTeXe{LaTeX2e} +\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else +\csname fi\endcsname +% +% +%<*install> +\input l3docstrip.tex +\keepsilent +\askforoverwritefalse + +\preamble + + Copyright (C) 2017--2021 by Xiangdong Zeng + + 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: + + 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 Xiangdong Zeng. + + This work consists of the files fduthesis.dtx, + fduthesis-doc.dtx, + fduthesis-logo.dtx, + fduthesis-template.tex, + and the derived files fduthesis.ins, + fduthesis.cls, + fduthesis-en.cls, + fduthesis.def, + fdudoc.cls, + fdulogo.sty, + fdulogo-example.tex, + fduthesis-cover.tex, + fduthesis-en.tex, + fudan-emblem.pdf, + fudan-emblem-new.pdf, + fudan-name.pdf, + fduthesis.pdf, + fduthesis-en.pdf, + fduthesis-code.pdf, + and README.md. + +\endpreamble + +\generate{ + \usedir{tex/latex/fduthesis} + \file{\jobname.cls} {\from{\jobname.dtx}{class}} + \file{\jobname-en.cls} {\from{\jobname.dtx}{class-en}} + \file{\jobname.def} {\from{\jobname.dtx}{definition}} + \file{fdudoc.cls} {\from{\jobname.dtx}{doc} + \from{\jobname-doc.dtx}{doc}} + \file{fdulogo.sty} {\from{\jobname.dtx}{logo} + \from{\jobname-logo.dtx}{logo}} + \file{fdulogo-example.tex} {\from{\jobname.dtx}{ex-logo} + \from{\jobname-logo.dtx}{ex-logo}} + \file{\jobname-cover.tex} {\from{\jobname.dtx}{cover} + \from{\jobname-logo.dtx}{cover}} +% +%<*internal> + \usedir{source/latex/fduthesis} + \file{\jobname.ins} {\from{\jobname.dtx}{install}} +% +%<*install> + \usedir{doc/latex/fduthesis} + \nopreamble\nopostamble + \file{README.md} {\from{\jobname.dtx}{readme}} +} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* files into a directory searched by TeX: *} +\Msg{* *} +\Msg{* The recommended directory is TDS:tex/latex/fduthesis *} +\Msg{* *} +\Msg{* fduthesis.cls *} +\Msg{* fduthesis-en.cls *} +\Msg{* fduthesis.def *} +\Msg{* fdudoc.cls *} +\Msg{* fdulogo.sty *} +\Msg{* *} +\Msg{* To produce the documentation, run the file fduthesis.dtx *} +\Msg{* through XeLaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile +% +% +%<*internal> +\fi +% +% +%\NeedsTeXFormat{LaTeX2e} +%\RequirePackage{expl3} +%<*!(driver|install|ex-logo|cover)> +%\GetIdInfo $Id: fduthesis.dtx 0.7e 2020-08-30 12:00:00Z Xiangdong Zeng $ +% {Thesis template for Fudan University} +%\ProvidesExplClass{\ExplFileName} +% {Thesis template for Fudan University (English version)} +%\ProvidesExplClass{\ExplFileName-en} +% {Definition file for fduthesis} +%\ProvidesExplFile{\ExplFileName.def} +% {Documentation class for fduthesis} +%\ProvidesExplClass{fdudoc} +% {Fudan University's Visual Identity} +%\ProvidesExplPackage{fdulogo} +% {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +% +%<*driver> +% \PassOptionsToPackage{showframe}{geometry} +\documentclass{fdudoc} +\usepackage{multirow,xeCJKfntef,xpinyin} +\hypersetup{ + pdftitle = {gdutthesis: 广东工业大学论文模板}, + pdfauthor = {何骏炜}} +% 全角标点放在引号中,需要改成半角式,否则间距过大,不好看 +\def\FSID{“{\xeCJKsetup{PunctStyle=banjiao}。}”} % U+3002 +\def\FSFW{“{\xeCJKsetup{PunctStyle=banjiao}.}”} % U+FF0E +\def\COFW{“{\xeCJKsetup{PunctStyle=banjiao}:}”} % U+FF1A +\def\SCFW{“{\xeCJKsetup{PunctStyle=banjiao};}”} % U+FF1B +%^^A! \PassOptionsToPackage{scheme=plain, linespread=1.1}{ctex} +%^^A! \documentclass{fdudoc} +%^^A! \hypersetup{ +%^^A! pdftitle = {fduthesis: LaTeX Thesis Template for Fudan University}, +%^^A! pdfauthor = {Xiangdong Zeng}} +%^^A! \ctexset{ +%^^A! section = {name = {}, format+ = \raggedright}, +%^^A! subsubsection/tocline = {\CTEXnumberline{#1}#2}} +%^^A! \pagestyle{headings} +%^^A! \def\FSID{{\xeCJKsetup{PunctStyle=banjiao}。}} +%^^A! \def\FSFW{{\xeCJKsetup{PunctStyle=banjiao}.}} +%^^A! + +\title{\textcolor{MaterialIndigo800}{% + \textbf{gdutthesis: 广东工业大学论文\xpinyin[font=\sffamily,format=\color{MaterialIndigo800}]{模}{mu2}板}}} +\author{何骏炜} +\date{2021/06/07\quad v0.1a% + \thanks{\url{https://github.com/sikouhjw/gdutthesis}.}} +%^^A! \title{\textcolor{MaterialIndigo800}{% +%^^A! \textbf{The \textsf{fduthesis} Class \\ +%^^A! \LaTeX{} Thesis Template for Fudan University}}} +%^^A! \author{Xiangdong Zeng} +%^^A! \date{2020/08/30\quad v0.7e% +%^^A! \thanks{\url{https://github.com/stone-zeng/fduthesis}.}} +%^^A! + +\begin{document} +%^^A! \begin{document} +%^^A! + \DisableImplementation +% \EnableImplementation +% \def\FDUCODEDOC{} + \DocInput{gdutthesis.dtx} +% \DocInput{fduthesis-doc.dtx,fduthesis-logo.dtx} +% \IndexLayout +% \PrintChanges +% \PrintIndex +\end{document} +% +% \fi +% +% \changes{v0.1}{2021/06/07}{开始编写模板。} +% +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +%^^A 禁止使用 " 符号作为抄录文本缩略符 +% \DeleteShortVerb\" +%^^A! \DeleteShortVerb\" +%^^A! +% +%^^A 封面与目录的页边距 +%^^A+ +% \newgeometry{ +% left = 1.25 in, +% right = 1.25 in, +% top = 1.25 in, +% bottom = 1.00 in +% } +% +% \maketitle +^^A % \vfill +^^A % \begin{center} +^^A % \includegraphics[width=8cm]{../logo/fduthesis-cover.pdf} +^^A % \end{center} +^^A % \vfill +% \thispagestyle{plain} +% \clearpage +% +% \tableofcontents +% +%^^A- +% +% \EnableDocumentation +%^^A \DisableDocumentation +% +% \begin{documentation} +% +%^^A 用户手册的页边距 +%^^A+ +% \newgeometry{ +% left = 1.65 in, +% right = 0.80 in, +% top = 1.25 in, +% bottom = 1.00 in +% } +% +%^^A- +% +% \section{介绍} +%^^A! \section{Introduction} +%^^A! +% +% 目前,在网上可以找到的广东工业大学 \LaTeX{} 论文模板主要有以下这些: +% \begin{itemize} +% \item jokerdawn 编写的 \cls{GDUTThesis} +% \scite{jokerdawn2019GDUTThesis}; +% \item Nick-Hopps 编写的 \cls{gdutart} +% \scite{Nick-Hopps2020gdutart}; +% \item ElunDai 编写的 \cls{gdutthesis} +% \scite{ElunDai2019gdutthesis}; +% \item Gnomeek 编写的 \cls{GDUT-UndergraduateThesis} +% \scite{Gnomeek2020UndergraduateThesis}。 +% \end{itemize} +% 以上这些模板大都没有经过系统的设计,也鲜有后续维护。相比之下, +% 清华大学 \scite{thuthesis}、重庆大学 \scite{cquthesis}、 +% 中国科学技术大学 \scite{ustcthesis}、中国科学院大学 \scite{ucasthesis}、 +% 上海交通大学 \scite{sjtuthesis}以及复旦大学 \scite{fduthesis}等,都有成熟、 +% 稳定的解决方案,值得参考。 +% +% 本模板将借鉴 \cls{fduthesis},使用 \LaTeX3 +% \scite{source3} 编写,以适应 \TeX{} 技术发展潮流; +% 同时还将使用一套简洁的接口,方便用户使用。 +%^^A! \cls{fduthesis} is a thesis template for Fudan University. +%^^A! This template is mostly written in \LaTeX3 syntax, and +%^^A! provides a simple interface for users. +%^^A! +% +% \subsection*{\LaTeX{} 入门} +%^^A! \subsection*{Getting started with \LaTeX{}} +%^^A! +% +% 本文档并非是一份 \LaTeX{} 零基础教程。如果您是完完全全的新手, +% 建议先阅读相关入门文档,如刘海洋编著的《\LaTeX{} 入门》 +% \scite{刘海洋2013latex入门} 第一章,或大名鼎鼎的“\pkg{lshort}” +% \scite{lshort} 及其中文翻译版 \scite{lshort-zh-cn}。当然, +% 网络上的入门教程多如牛毛,您可以自行选取。 +%^^A! This documentation is \emph{not} a \LaTeX{} tutorial at +%^^A! starter's level. If you are totally a newbie, please read some +%^^A! introductions like the famous \pkg{lshort}. Of course, there +%^^A! are countless \LaTeX{} tutorials on the Internet. You can +%^^A! choose whatever you like. +%^^A! +% +% \subsection*{关于本文档} +%^^A! \subsection*{About this documentation} +%^^A! +% +% 本文采用不同字体表示不同内容。无衬线字体表示宏包名称,如 +% \pkg{xeCJK} 宏包、\cls{gdutthesis} 文档类等;等宽字体表示代码或 +% 文件名,如 \cs{gdutsetup} 命令、\env{abstract} 环境、\TeX{} 文档 +% \file{main.tex} 等;带有尖括号的楷体(或西文斜体)表示命令参数, +% 如 \meta{模板选项}、\meta{English title} 等。在使用时,参数两侧 +% 的尖括号不必输入。示例代码进行了语法高亮处理,以方便阅读。 +%^^A! In this documentation, different typefaces are used to +%^^A! represent different contents. Packages and classes are shown +%^^A! in sans-serif font, e.g.\ \pkg{xeCJK} package and +%^^A! \cls{fduthesis} class. Commands and file names are shown in +%^^A! monospaced font, e.g.\ command \cs{fdusetup}, environment +%^^A! \env{abstract} and \TeX{} document \file{thesis.tex}. +%^^A! Italic-shaped font with angle brackets outside means arguments, +%^^A! e.g.\ \meta{English title}. However, you do not need to type +%^^A! the brackets when using these commands. The example code has +%^^A! proper syntax highlighting so it will be much easier to read. +%^^A! +% +% 在用户手册中,带有蓝色侧边线的为 \LaTeX{} 代码,而带有粉色侧边线 +% 的则为命令行代码,请注意区分。模板提供的选项、命令、环境等, +% 均用横线框起,同时给出使用语法和相关说明。 +%^^A! \LaTeX{} code lines will have a blue line on their left, while +%^^A! for command lines there will be a pink line. The options, +%^^A! commands and environments in \cls{fduthesis} will be surrounded +%^^A! by two horizontal lines. Their usages and descriptions are +%^^A! provided at the same time. +%^^A! +% +^^A % 本模板中的选项、命令或环境可以分为以下三类: +^^A % \begin{itemize} +^^A % \item 名字后面带有 \rexptarget\rexpstar{} 的,表示只能在^^A +^^A % \emph{中文模板}中使用; +^^A % \item 名字后面带有 \exptarget\expstar{} 的,表示只能在^^A +^^A % \emph{英文模板}中使用; +^^A % \item 名字后面不带有特殊符号的,表示既可以在中文模板中使用, +^^A % 也可以在英文模板中使用。 +^^A % \end{itemize} +%^^A! The options, commands and environments in \cls{fduthesis} can be +%^^A! divided into the following three types: +%^^A! \begin{itemize} +%^^A! \item Those can be only used in \emph{Chinese templates} are +%^^A! indicated by \rexptarget\rexpstar{}. +%^^A! \item Those can be only used in \emph{English templates} are +%^^A! indicated by \rexptarget\expstar{}. +%^^A! \item If they do not have special characters afterwards, then +%^^A! you can use them in both Chinese and English templates. +%^^A! \end{itemize} +%^^A! +% +% 代码实现请去参考 \cls{fduthesis} 的说明文档。如果您有任何改进 +% 意见或者功能需求,欢迎前往 GitHub 仓库 +% \href{https://github.com/sikouhjw/gdutthesis/issues}{提交 issue}。 +%^^A! If you want to read the implementation part, please turn to the +%^^A! Chinese version. Any issues or feature requests can be submitted +%^^A! in the \href{https://github.com/stone-zeng/fduthesis/issues}% +%^^A! {GitHub repository}. +%^^A! +% +^^A % 文档的最后还提供了版本历史和代码索引,以供查阅。 +% +% \section{安装} +%^^A! \section{Installation} +%^^A! +% +% \subsection{获取 \cls{gdutthesis}} +%^^A! \subsection{Obtaining \cls{fduthesis}} +%^^A! +% +^^A % \subsubsection{标准安装} +%^^A! \subsubsection{Standard installation} +%^^A! +% +^^A % 如果没有特殊理由,始终建议您使用宏包管理器安装 \cls{fduthesis}。 +^^A % 例如在 \TeXLive{} 中,执行(可能需要管理员权限) +^^A % \begin{shellexample}[morekeywords={tlmgr,install}] +^^A % tlmgr install fduthesis +^^A % \end{shellexample} +^^A % 即可完成安装。 +%^^A! If there are no special reasons, it is always recommended to +%^^A! install \cls{fduthesis} with a package manager. For example, +%^^A! the following command will install the package in \TeXLive{} +%^^A! (administrator permission may be required): +%^^A! \begin{shellexample}[morekeywords={tlmgr,install}] +%^^A! tlmgr install fduthesis +%^^A! \end{shellexample} +%^^A! +% +^^A % 在 \TeXLive{} 和 \MiKTeX{} 中,您还可以通过图形界面进行安装, +^^A % 此处不再赘述。 +%^^A! In \TeXLive{} and \MiKTeX{}, you can also install \cls{fduthesis} +%^^A! through a graphical interface. It's rather simple and will not be +%^^A! described here. +%^^A! +% +% \subsubsection{手动安装} +%^^A! \subsubsection{Install manually} +%^^A! +% +^^A % 如果您需要从 CTAN 上自行下载并手动安装,较好的方法是使用 TDS +^^A % 安装包: +^^A % \begin{itemize} +^^A % \item 从 CTAN 上下载 \cls{fduthesis} 的 +^^A % \href{http://mirror.ctan.org/install/macros/latex/contrib/fduthesis.tds.zip}{TDS 安装包}; +^^A % \item 按目录结构将 \file{fduthesis.tds.zip} 中的文件复制到 \TeX{} +^^A % 发行版的本地 TDS 根目录; +^^A % \item 执行 \bashcmd{mktexlsr} 刷新文件名数据库以完成安装。 +^^A % \end{itemize} +%^^A! If you want to download the template from CTAN and install it +%^^A! manually, the recommended way is to use the TDS ZIP file: +%^^A! \begin{itemize} +%^^A! \item Download the \href{http://mirror.ctan.org/install/macros/latex/contrib/fduthesis.tds.zip}% +%^^A! {TDS ZIP file} for \cls{fduthesis}; +%^^A! \item Copy all the files in \file{fduthesis.tds.zip} into the +%^^A! local TDS directory of \TeX{} distribution. +%^^A! \item Run \bashcmd{mktexlsr} to update the ls-R database. +%^^A! \end{itemize} +%^^A +% 您可以从源代码直接获得模板: +% \begin{itemize} +% \item 打开 \href{https://github.com/sikouhjw/gdutthesis}^^A +% {项目主页},点击“Clone or download”,并选择“Download ZIP”, +% 下载 \file{gdutthesis-master.zip};如果您的电脑中安装有 git +% 程序,也可通过以下命令直接克隆代码仓库: +% \begin{shellexample}[gobble=7,alsoletter={.},^^A +% morekeywords={git,clone}] +% git clone https://github.com/sikouhjw/gdutthesis.git +% \end{shellexample} +% \item 解压并将文档类(\file{.cls})复制到 \TeX{} 发行版本地 TDS 树 +% 的 \path{texmf-local/tex/latex/gdutthesis/} 目录下,并执行 +% \bashcmd{mktexlsr} 刷新文件名数据库,方可完成安装。 +% \end{itemize} +%^^A! Although not recommended, you may generate the whole template +%^^A! from source code as well: +%^^A! \begin{itemize} +%^^A! \item Open the project's \href{https://github.com/stone-zeng/fduthesis}% +%^^A! {homepage}, click ``Clone or download'' and choose +%^^A! ``Download ZIP'' to download \file{fduthesis-master.zip}. +%^^A! If you have git program on your computer, you can also +%^^A! clone the repository directly: +%^^A! \begin{shellexample}[gobble=5,alsoletter={.},% +%^^A! morekeywords={git,clone}] +%^^A! git clone https://github.com/stone-zeng/fduthesis.git +%^^A! \end{shellexample} +%^^A! \item Extract files, and get into the \file{source} directory. +%^^A! Run the following command to generate all the components: +%^^A! \begin{shellexample}[gobble=5,morekeywords={xetex}] +%^^A! xetex fduthesis.dtx +%^^A! \end{shellexample} +%^^A! \item Copy the generated document classes (\file{.cls}), +%^^A! packages (\file{.sty}) and configuration files (\file{.def}) +%^^A! into \path{texmf-local/tex/latex/fduthesis/} under the local +%^^A! TDS tree of \TeX{} distribution. Then run \bashcmd{mktexlsr} +%^^A! to update the ls-R database. +%^^A! \item When writing your thesis with \cls{fduthesis}, you need +%^^A! to copy the file \file{fudan-name.pdf} (can be found in the +%^^A! \file{testfiles/support} directory of the Git repository) to +%^^A! your working directory, to make sure that the logo in the +%^^A! cover can be displayed correctly. +%^^A! \end{itemize} +%^^A! +% +% \subsubsection{扁平化安装} +%^^A! \subsubsection{\cls{fduthesis} on the fly} +%^^A! +% +% 如果您不希望安装本模板,但需要立刻使用,则可以进行扁平化安装。 +% 从 GitHub 上获取代码仓库后,解压即可。 +%^^A! If you don't want to install \cls{fduthesis} but need to use it +%^^A! at once, you can try the installation scripts. Download the +%^^A! repository from GitHub, run \file{install-win.bat} (on Windows) +%^^A! or \file{install-linux.sh} (on Linux), then all the necessary +%^^A! files will be found in the \file{thesis} folder. +%^^A! +% +% \subsection{模板组成} +%^^A! \subsection{Composition of the template} +%^^A! +% +% 本模板主要包含核心文档类、用户文档、参考文献数据库等几个 +% 部分,其具体组成见表~\ref{tab:fduthesis-components}。 +%^^A! There are several parts in \cls{fduthesis}, including kernel +%^^A! template classes, configuration files, affiliated packages and +%^^A! user's guides. More details are listed in table~% +%^^A! \ref{tab:fduthesis-components}. +%^^A! +% +% \begin{table}[ht] +% \caption{\cls{gdutthesis} 的主要组成部分} +% \label{tab:fduthesis-components} +% \centering +% \begin{tabular}{lp{20em}} +% \toprule +% \textbf{文件} & \textbf{功能说明} \\ +% \midrule +% \file{gdutthesis.cls} & 模板文档类 \\ +% \file{README.md} & 简要自述 \\ +^^A % \ifdefined\FDUCODEDOC +^^A % \file{fduthesis.pdf} & 中文用户手册 \\ +^^A % \file{fduthesis-en.pdf} & 英文用户手册 \\ +^^A % \file{fduthesis-code.pdf} & 模板实现代码(本文档) \\ +^^A % \else +% \file{gdutthesis.pdf} & 用户手册(本文档) \\ +^^A % \file{fduthesis-en.pdf} & 英文用户手册 \\ +^^A % \file{fduthesis-code.pdf} & 模板实现代码 \\ +^^A % \fi +% \file{main.tex} & 空白模板,可据此为基础完成论文 +% 撰写 \\ +% \file{gdutthesis-template.bib} & 参考文献数据库\\ +% \bottomrule +% \end{tabular} +% \end{table} +%^^A! \begin{table}[ht] +%^^A! \caption{The main components of \cls{fduthesis}} +%^^A! \label{tab:fduthesis-components} +%^^A! \centering +%^^A! \begin{tabular}{lp{24em}} +%^^A! \toprule +%^^A! \textbf{Files} & \textbf{Descriptions} \\ +%^^A! \midrule +%^^A! \file{fduthesis.cls} & Document class for Chinese thesis. \\ +%^^A! \file{fduthesis-en.cls} & Document class for English thesis.\\ +%^^A! \file{fduthesis.def} & Configuration parameters file +%^^A! for \cls{fduthesis}. Please do \emph{not} modify it. \\ +%^^A! \file{fdudoc.cls} & Document class for user guides. \\ +%^^A! \file{fdulogo.sty} & Fudan University's visual identity. \\ +%^^A! \file{fudan-emblem.pdf} & University emblem. \\ +%^^A! \file{fudan-emblem-new.pdf} & University emblem (revised version). \\ +%^^A! \file{fudan-name.pdf} & Figure of university name. \\ +%^^A! \file{README.md} & The brief introduction. \\ +%^^A! \file{fduthesis.pdf} & User's guide in Chinese. \\ +%^^A! \file{fduthesis-en.pdf} & User's guide in English (this +%^^A! document). \\ +%^^A! \file{fduthesis-code.pdf} & Code implementation. \\ +%^^A! \file{fduthesis-template.tex} & An empty thesis template, and you can +%^^A! write your thesis based on it. \\ +%^^A! \bottomrule +%^^A! \end{tabular} +%^^A! \end{table} +%^^A! +% +% \section{使用说明} +%^^A! \section{User's guide} +%^^A! +% +% \subsection{基本用法} +%^^A! \subsection{Getting started} +%^^A! +% +% 以下是一份简单的 \TeX{} 文档,它演示了 \cls{gdutthesis} +% 的最基本用法: +%^^A! Here is a minimal \TeX{} file for \cls{fduthesis}: +%^^A+ +% \begin{latexexample}[deletetexcs={\documentclass},% +% moretexcs={\gdutchapter,\gdutsection},morekeywords={\documentclass},% +% emph={[2]document}] +% \documentclass{gdutthesis} +% \begin{document} +% \gdutchapter{欢迎}{Welcome} +% \gdutsection{欢迎使用 gdutthesis!}{Welcome to the gdutthesis!} +% 你好,\LaTeX{}! +% \end{document} +% \end{latexexample} +%^^A- +%^^A! +% +% 按照 \ref{subsec:编译方式}~小节中的方式编译该文档,您应当得到 +% 一篇 5 页的文章。当然,这篇文章的绝大部分都是空白的。 +%^^A! Compile this file under the instructions in subsection~% +%^^A! \ref{subsec:compilation}, you will get a 5-page article. +%^^A! Of course, most of it will be blank, as you may predicate. +%^^A! +% +^^A % 英文模板可以用类似的方式使用: +%^^A! The English version can be used in the same way: +%^^A+ +^^A % \begin{latexexample}[deletetexcs={\documentclass},% +^^A % moretexcs={\chapter},morekeywords={\documentclass},% +^^A % emph={[2]document}] +^^A % % thesis-en.tex +^^A % \documentclass{fduthesis-en} +^^A % \begin{document} +^^A % \chapter{Welcome} +^^A % \section{Welcome to fduthesis!} +^^A % Hello, \LaTeX{}! +^^A % \end{document} +^^A % \end{latexexample} +%^^A- +^^A % 英文模板只对正文部分进行了改动,封面、指导小组成员以及声明页仍将 +^^A % 显示为中文。 +%^^A! The differences between English and Chinese version only +%^^A! live in the main body. Thesis cover, instructors list and +%^^A! declaration page are still printed in Chinese. +%^^A! +% +% \subsection{编译方式} \label{subsec:编译方式} +%^^A! \subsection{Compilation} \label{subsec:compilation} +%^^A! +% +% 本模板不支持 \pdfTeX{} 引擎,请使用 \XeLaTeX{} 或 \LuaLaTeX{} +% 编译。推荐使用 \XeLaTeX{}。为了生成正确的目录、脚注以及交叉引用, +% 您至少需要连续编译两次。 +%^^A! \cls{fduthesis} does NOT support \pdfTeX{}. Please use +%^^A! \XeLaTeX{} or \LuaLaTeX{} to compile, and \XeLaTeX{} is +%^^A! recommended. To get the correct table of contents, footnotes +%^^A! and cross-references, you need to compile the source file at +%^^A! least twice. +%^^A! +% +% 以下代码中,假设您的 \TeX{} 源文件名为 \file{main.tex}。 +% 使用 \XeLaTeX{} 编译论文,请在命令行中执行 +% \begin{shellexample}[morekeywords={xelatex}] +% xelatex main +% xelatex main +% \end{shellexample} +% 或使用 \pkg{latexmk}: +% \begin{shellexample}[morekeywords={latexmk},emph={-xelatex}] +% latexmk -xelatex main +% \end{shellexample} +%^^A! In the following example, suppose your \TeX{} source file is +%^^A! \file{thesis.tex}. Please execute the following commands if +%^^A! you want to use \XeLaTeX{}: +%^^A! \begin{shellexample}[morekeywords={xelatex}] +%^^A! xelatex thesis +%^^A! xelatex thesis +%^^A! \end{shellexample} +%^^A! You can use \pkg{latexmk} as well: +%^^A! \begin{shellexample}[morekeywords={latexmk},emph={-xelatex}] +%^^A! latexmk -xelatex thesis +%^^A! \end{shellexample} +%^^A! +% +% 使用 \LuaLaTeX{} 编译论文,请在命令行中执行 +% \begin{shellexample}[morekeywords={lualatex}] +% lualatex main +% lualatex main +% \end{shellexample} +% 或者 +% \begin{shellexample}[morekeywords={latexmk},emph={-lualatex}] +% latexmk -lualatex main +% \end{shellexample} +%^^A! \LuaLaTeX{} can be used in a similar way: +%^^A! \begin{shellexample}[morekeywords={lualatex}] +%^^A! lualatex thesis +%^^A! lualatex thesis +%^^A! \end{shellexample} +%^^A! or +%^^A! \begin{shellexample}[morekeywords={latexmk},emph={-lualatex}] +%^^A! latexmk -lualatex thesis +%^^A! \end{shellexample} +%^^A! +% +% \subsection{模板选项} +%^^A! \subsection{Options of the template} +%^^A! +% +% 所谓“模板选项”,指需要在引入文档类的时候指定的选项: +% \begin{latexexample}[deletetexcs={\documentclass},% +% morekeywords={\documentclass}] +% \documentclass(*\oarg{模板选项}*){gdutthesis} +% \end{latexexample} +%^^A! You can specify some \emph{template options} when loading +%^^A! \cls{fduthesis}: +%^^A! \begin{latexexample}[deletetexcs={\documentclass},% +%^^A! morekeywords={\documentclass}] +%^^A! \documentclass(*\oarg{options}*){fduthesis} +%^^A! \documentclass(*\oarg{options}*){fduthesis-en} +%^^A! \end{latexexample} +%^^A! +% +% 有些模板选项为布尔型,它们只能在 \opt{true} 和 \opt{false} +% 中取值。对于这些选项,\kvopt{\meta{选项}}{true} 中的“|= true|” +% 可以省略。 +%^^A! Some options are \emph{boolean} --- they only take the value +%^^A! \opt{true} or \opt{false}. For these options, you can +%^^A! abbreviate ``\kvopt{\meta{option}}{true}'' simply to +%^^A! ``\opt{\meta{option}}''. +%^^A! +% +%^^A+ +% \begin{function}{type} +% \begin{fdusyntax}[emph={[1]type}] +% type = (**) +% \end{fdusyntax} +%^^A- +% 选择论文类型。三种选项分别代表博士学位论文、硕士学位论文和专业硕士学位论文。 +% \end{function} +%^^A! Choose the type of your thesis. The three options represent +%^^A! doctoral dissertation, master degree thesis and undergraduate +%^^A! thesis, respectively. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{oneside,twoside} +^^A % 指明论文的单双面模式,默认为 \opt{twoside}。该选项会影响每章 +^^A % 的开始位置,还会影响页眉样式。 +^^A % \end{function} +%^^A! \begin{function}{oneside,twoside} +%^^A! Specify whether single or double sided output should be +%^^A! generated. \opt{twoside} will be chosen by default. These +%^^A! option will determine where the new chapters begin and how +%^^A! the headers display. The option \opt{twoside} does +%^^A! \emph{not} tell the printer to actually make a two-sided +%^^A! printout. +%^^A! \end{function} +%^^A! +% +^^A % 在双面模式(\opt{twoside})下,按照通常的排版惯例,每章应只从 +^^A % 奇数页(在右)开始;而在单页模式(\opt{oneside})下,则可以从 +^^A % 任意页面开始。本模板中,目录、摘要、符号表等均视作章,也按相同 +^^A % 方式排版。 +%^^A! If choosing \opt{twoside}, chapters will begin at the odd pages +%^^A! (right hand). However, they will begin at arbitrary pages +%^^A! available when choosing \opt{oneside}. Table of contents, +%^^A! abstract and the list of symbols are considered as chapters and +%^^A! processed in the same way. +%^^A! +% +^^A % 双面模式下,正文部分偶数页(在左)的左页眉显示章标题,奇数页 +^^A % (在右)的右页眉显示节标题;前置部分的页眉按同样格式显示,但文字 +^^A % 均为对应标题(如“目录”、“摘要”等)。 +^^A % 而在单面模式下,正文部分则页面不分奇偶,均同时显示左、右页眉, +^^A % 文字分别为章标题和节标题;前置部分只有中间页眉,显示对应标题。 +%^^A! At two-sided mode, left headers on the even pages (left hand) +%^^A! in \emph{main body} will show the title of chapters, while the +%^^A! right headers on the odd pages (right hand) will show the +%^^A! title of sections. Headers in \emph{front matter} have the +%^^A! same style, but they will only show the title as ``Contents'', +%^^A! ``Abstract'', etc. +%^^A! +%^^A! At one-sided mode, both left and right headers on \emph{all} +%^^A! pages in main body will be shown. The text is the title of +%^^A! chapters and sections, respectively. In front matter, there +%^^A! are only middle headers, which show the corresponding titles. +%^^A! +% +% \begin{function}{draft} +% \begin{fdusyntax}[emph={[1]draft}] +% draft = (*<\TFF>*) +% \end{fdusyntax} +% 选择是否开启草稿模式,默认关闭。 +% \end{function} +%^^A! \begin{function}{draft} +%^^A! \begin{fdusyntax}[emph={[1]draft}] +%^^A! draft = (*<\TFF>*) +%^^A! \end{fdusyntax} +%^^A! Enable draft mode. Default off. +%^^A! \end{function} +%^^A! +% +% 草稿模式为全局选项,会影响到很多宏包的工作方式。 +% 开启之后,主要的变化有: +% \begin{itemize} +% \item 把行溢出的盒子显示为黑色方块; +% \item 不实际插入图片,只输出一个占位方框; +% \item 关闭超链接渲染,也不再生成 PDF 书签; +% \item 显示页面边框。 +% \end{itemize} +%^^A! \opt{draft} is a global option and will affect many packages. +%^^A! You may notice the following changes when using \opt{draft}: +%^^A! \begin{itemize} +%^^A! \item Lines with overfull \tn{hbox}'s will be marked with +%^^A! a thick black square on the right margin. +%^^A! \item Will not include graphics files actually, but instead +%^^A! print a box of the size the graphic would take up, as well +%^^A! as the file name. +%^^A! \item Will not make hyperlinks and PDF bookmarks. +%^^A! \item Show the page frames. +%^^A! \end{itemize} +%^^A! +% +^^A % \begin{function}[added=2018-01-31]{config} +^^A % \begin{fdusyntax}[emph={[1]config}] +^^A % config = (*\marg{文件}*) +^^A % \end{fdusyntax} +^^A % 用户配置文件的文件名。默认为空,即不载入用户配置文件。 +^^A % \end{function} +%^^A! \begin{function}[added=2018-01-31]{config} +%^^A! \begin{fdusyntax}[emph={[1]config}] +%^^A! config = (*\marg{file}*) +%^^A! \end{fdusyntax} +%^^A! File name of user profile. Default value is empty, so no +%^^A! profile is loaded automatically. +%^^A! \end{function} +%^^A! +% +% \subsection{参数设置} +%^^A! \subsection{More options} +%^^A! +% +% \begin{function}{\gdutsetup} +% \begin{fdusyntax}[morekeywords={\gdutsetup}] +% \gdutsetup(*\marg{键值列表}*) +% \end{fdusyntax} +% 本模板提供了一系列选项,可由您自行配置。载入文档类之后,以下 +% 所有选项均可通过统一的命令 \cs{gdutsetup} 来设置。 +% \end{function} +%^^A! \begin{function}{\fdusetup} +%^^A! \begin{fdusyntax}[morekeywords={\fdusetup}] +%^^A! \fdusetup(*\marg{key-value list}*) +%^^A! \end{fdusyntax} +%^^A! \cls{fduthesis} has provided a number of options, which +%^^A! can be given via the general command \cs{fdusetup}. +%^^A! \end{function} +%^^A! +% +% \cs{gdutsetup} 的参数是一组由(英文)逗号隔开的选项列表,列表中的 +% 选项通常是 \kvopt{\meta{key}}{\meta{value}} 的形式。部分选项的 +% \meta{value} 可以省略。对于同一项,后面的设置将会覆盖前面的设置。 +% 在下文的说明中,将用\textbf{粗体}表示默认值。 +%^^A! The argument of \cs{fdusetup} is a set of comma-separated option +%^^A! list. The options usually have the form of \kvopt{\meta{key}}% +%^^A! {\meta{value}} and in some cases \meta{value} can be omitted. +%^^A! For the same option, the values given later will override the +%^^A! the previous ones. Default values are indicated in +%^^A! \textbf{boldface} in the following descriptions. +%^^A! +% +% \cs{gdutsetup} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种 +% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意, +% 参数列表中不可以出现空行。 +%^^A! \cs{fdusetup} follows \LaTeX3 key-value style, and different +%^^A! types as well as various levels options are supported. In the +%^^A! key-value list, spaces around ``|=|'' will be trimmed; however, +%^^A! blank lines should never appear in the argument. +%^^A! +% +% 与模板选项相同,布尔型的参数可以省略 \kvopt{\meta{选项}}{true} +% 中的“|= true|”。 +%^^A! Similar with template options, ``\kvopt{\meta{option}}{true}'' +%^^A! can be abbreviated to \opt{\meta{option}} for boolean type. +%^^A! +% +% 另有一些选项包含子选项,如 \opt{style} 和 \opt{info} 等。它们可以 +% 按如下两种等价方式来设定: +%^^A! Some options, such as \opt{style} and \opt{info}, may have +%^^A! sub-options. They can be set by the following two equivalent +%^^A! methods: +%^^A+ +% \begin{latexexample}[morekeywords={\gdutsetup},% +% emph={[1]style,cjk-font,font,info,title,title*,author,author*,department}] +% \gdutsetup{ +% style = {cjk-font = fandol, font = times}, +% info = { +% title = {模板射流电解加工微沟槽关键技术研究}, +% title* = {Investigation on masked jet electrochemical machining of micro grooves}, +% author = {张三}, +% author* = {Zhang San}, +% department = {自动化学院} +% } +% } +% \end{latexexample} +%^^A- +% 或者 +%^^A! or +%^^A+ +% \begin{latexexample}[morekeywords={\gdutsetup},% +% emph={[1]style,cjk-font,font,info,title,title*,author,author*,department}] +% \gdutsetup{ +% style/cjk-font = fandol, +% style/font = times, +% info/title = {模板射流电解加工微沟槽关键技术研究}, +% info/title* = {Investigation on masked jet electrochemical machining of micro grooves}, +% info/author = {张三}, +% info/author* = {Zhang San}, +% info/department = {自动化学院} +% } +% \end{latexexample} +%^^A- +%^^A! +% +% 注意 “|/|” 的前后均不可以出现空白字符。 +%^^A! Note that you may \emph{not} put spaces around ``|/|''. +%^^A! +% +% \subsubsection{论文格式} \label{subsubsec:论文格式} +%^^A! \subsubsection{Style and format} \label{subsubsec:style-and-format} +%^^A! +% +% \begin{function}{style} +% \begin{fdusyntax}[emph={[1]style}] +% style = (*\marg{键值列表}*) +% style/(*\meta{key}*) = (*\meta{value}*) +% \end{fdusyntax} +% 该选项包含许多子项目,用于设置论文格式。具体内容见下。 +% \end{function} +%^^A! \begin{function}{style} +%^^A! \begin{fdusyntax}[emph={[1]style}] +%^^A! style = (*\marg{key-value list}*) +%^^A! style/(*\meta{key}*) = (*\meta{value}*) +%^^A! \end{fdusyntax} +%^^A! This general option is for setting the thesis style and format. +%^^A! See the following details. +%^^A! \end{function} +%^^A! +% +%^^A+ +% \begin{function}{style/font} +% \begin{fdusyntax}[emph={[1]font}] +% font = (*<(times)|times*|none>*) +% \end{fdusyntax} +%^^A- +% 设置西文字体(包括数学字体)。具体配置见表~\ref{tab:font}。 +% \end{function} +%^^A! Set fonts (including math fonts). The details can be found in table~\ref{tab:font}. +%^^A! \end{function} +%^^A! +% +% \begin{table}[ht] +% \begin{threeparttable} +% \caption{西文字体配置} +% \label{tab:font} +% \centering +% \begin{tabular}{ccccc} +% \toprule +% & \strong{正文字体} & \strong{无衬线字体} & \strong{等宽字体} & \strong{数学字体} \\ +% \midrule +% |times| & XITS & TG Heros\tnote{a} & TG Cursor & XITS Math \\ +% |times*|\tnote{b} & Times New Roman & Arial & Courier New & XITS Math \\ +% \bottomrule +% \end{tabular} +% \begin{tablenotes} +% \item[a] “TG”是 TeX Gyre 的缩写。 +% \item[b] 本行中,Times New Roman、Arial 和 Courier New 是商业字体, +% 在 Windows 和 macOS 系统上均默认安装。 +% \end{tablenotes} +% \end{threeparttable} +% \end{table} +%^^A! \begin{table}[ht] +%^^A! \begin{threeparttable} +%^^A! \caption{Font configuration} +%^^A! \label{tab:font} +%^^A! \centering +%^^A! \begin{tabular}{ccccc} +%^^A! \toprule +%^^A! & \strong{Roman} & \strong{Sans-serif} & \strong{Monospaced} & \strong{Math} \\ +%^^A! \midrule +%^^A! |garamond| & EB Garamond & Libertinus Sans & LM Mono\tnote{a} & Garamond Math \\ +%^^A! |libertinus| & Libertinus Serif & Libertinus Sans & LM Mono & Libertinus Math \\ +%^^A! |lm| & LM Roman & LM Sans & LM Mono & LM Math \\ +%^^A! |palatino| & TG Pagella\tnote{b} & Libertinus Sans & LM Mono & TG Pagella Math \\ +%^^A! |times| & XITS & TG Heros & TG Cursor & XITS Math \\ +%^^A! |times*|\tnote{c} & Times New Roman & Arial & Courier New & XITS Math \\ +%^^A! \bottomrule +%^^A! \end{tabular} +%^^A! \begin{tablenotes} +%^^A! \item[a] ``LM'' is the abbreviation of Latin Modern. +%^^A! \item[b] ``TG'' is the abbreviation of TeX Gyre. +%^^A! \item[c] Here, Times New Roman, Arial and Courier New are commercial fonts. They are +%^^A! installed on Windows and macOS by default. +%^^A! \end{tablenotes} +%^^A! \end{threeparttable} +%^^A! \end{table} +% +%^^A+ +% \begin{function}{style/cjk-font} +% \begin{fdusyntax}[emph={[1]cjk-font}] +% cjk-font = (*<(fandol)|founder|mac|sourcehan|noto|windows|none>*) +% \end{fdusyntax} +%^^A- +% 设置中文字体。具体配置见表~\ref{tab:cjk-font}。 +% \end{function} +%^^A! Set CJK (Chinese, Japanese and Korean) fonts. The details can be found in +%^^A! table~\ref{tab:cjk-font}. +%^^A! \end{function} +%^^A! +% +% \begin{table}[ht] +% \caption{中文字体配置} +% \label{tab:cjk-font} +% \centering +% \begin{tabular}{cccc} +% \toprule +% & \strong{正文字体(宋体)} & \strong{无衬线字体(黑体)} & \strong{等宽字体(仿宋)} \\ +% \midrule +% \multirow{2}*{|fandol|} & Fandol 宋体 & Fandol 黑体 & Fandol 仿宋 \\ +% & FandolSong & FandolHei & FandolFang \\ +% \multirow{2}*{|founder|} & 方正书宋 & 方正黑体 & 方正仿宋 \\ +% & FZShuSong-Z01 & FZHei-B01 & FZFangSong-Z02 \\ +% \multirow{2}*{|mac|} & (华文)宋体-简 & (华文)黑体-简 & 华文仿宋 \\ +% & Songti SC & Heiti SC & STFangsong \\ +% \multirow{2}*{|sourcehan|} & 思源宋体 & 思源黑体 & Fandol 仿宋 \\ +% & Source Han Serif SC & Source Han Sans SC & FandolFang \\ +% \multirow{2}*{|noto|} & 思源宋体 & 思源黑体 & 思源等宽 \\ +% & Noto Serif CJK SC & Noto Sans CJK SC & Noto Sans Mono CJK SC \\ +% \multirow{2}*{|windows|} & (中易)宋体 & (中易)黑体 & (中易)仿宋 \\ +% & SimSun & SimHei & FangSong \\ +% \bottomrule +% \end{tabular} +% \end{table} +%^^A! \begin{table}[ht] +%^^A! \caption{CJK font configuration} +%^^A! \label{tab:cjk-font} +%^^A! \centering +%^^A! \begin{tabular}{cccc} +%^^A! \toprule +%^^A! & \strong{Roman (song)} & \strong{Sans-serif (hei)} & \strong{Monospaced (fang)} \\ +%^^A! \midrule +%^^A! |adobe| & Adobe Song Std & Adobe Heiti Std & Adobe Fangsong Std \\ +%^^A! |fandol| & FandolSong & FandolHei & FandolFang \\ +%^^A! |founder| & FZShuSong-Z01 & FZHei-B01 & FZFangSong-Z02 \\ +%^^A! |mac| & Songti SC & Heiti SC & STFangsong \\ +%^^A! |sinotype| & STSong & STHeiti & STFangsong \\ +%^^A! |sourcehan| & Source Han Serif SC & Source Han Sans SC & --- \\ +%^^A! |windows| & SimSun & SimHei & FangSong \\ +%^^A! \bottomrule +%^^A! \end{tabular} +%^^A! \end{table} +%^^A! +% +% 启用 \kvopt{font}{none} 或 \kvopt{cjk-font}{none} 之后,模板将关闭 +% 默认西文 / 中文字体设置。此时,您需要自行使用 \cs{setmainfont}、 +% \cs{setCJKmainfont}、\cs{setmathfont} 等命令来配置字体。 +%^^A! When you choose \kvopt{font}{none} or \kvopt{cjk-font}{none}, +%^^A! \cls{fduthesis} will disable the default western/CJK font +%^^A! settings. You may use \cs{setmainfont}, \cs{setCJKmainfont} +%^^A! and \cs{set\-math\-font}, etc.\ to configure the fonts manually. +%^^A! +% +%^^A+ +^^A % \begin{function}{style/font-size} +^^A % \begin{fdusyntax}[emph={[1]font-size}] +^^A % font-size = (*<(-4)|5>*) +^^A % \end{fdusyntax} +^^A %^^A- +^^A % 设置论文的基础字号。 +^^A % \end{function} +%^^A! Specify the basic font size in your thesis. +%^^A! \end{function} +%^^A! +% +%^^A+ +% \begin{function}{style/fullwidth-stop} +% \begin{fdusyntax}[emph={[1]fullwidth-stop}] +% fullwidth-stop = (**) +% \end{fdusyntax} +%^^A- +% 选择是否把全角实心句点\FSFW 作为默认的句号形状。 +% 这种句号一般用于科技类文章,以避免与下标“$_o$”或“$_0$”混淆。 +% \end{function} +%^^A! Let full-width full stop ``\FSFW'' as the default full stop. +%^^A! Generally, this punctuation is used for scientific articles, +%^^A! where ``\FSID'' is easily to be confused with subscript +%^^A! ``$_o$'' or ``$_0$''. +%^^A! \end{function} +%^^A! +% +% 选择 \kvopt{fullwidth-stop}{catcode} 或 \opt{mapping} 后,都会实现 +% 上述效果。有所不同的是,在选择 \opt{catcode} 后,只有^^A +% \emph{显式的}\FSID 会被替换为\FSFW;但在选择 \opt{mapping} 后, +% \emph{所有的}\FSID 都会被替换。例如,如果您用宏保存了一些含有^^A +% \FSID 的文字,那么在选择 \opt{catcode} 时,其中的\FSID 不会被 +% 替换为\FSFW。 +%^^A! If you choose \kvopt{fullwidth-stop}{catcode}, only +%^^A! \emph{explicit} ``\FSID'' will be replaced by ``\FSFW''; when +%^^A! choosing \kvopt{fullwidth-stop}{mapping}, however, \emph{all} +%^^A! the ``\FSID'' will be replaced. +%^^A! +% +% 选项 \kvopt{fullwidth-stop}{mapping} 只在 \XeTeX{} 下有效。使用 +% \LuaTeX{} 编译时,该选项相当于 \kvopt{fullwidth-stop}{catcode}。 +%^^A! \opt{mapping} is valid only under \XeTeX{}. When compiling +%^^A! with \LuaTeX{}, it is equivalent to \opt{catcode}. +%^^A! +% +% 如果您在选择 \kvopt{fullwidth-stop}{mapping} 后仍需要临时显示^^A +% \FSID,可以按如下方法操作: +% \begin{latexexample}[moretexcs={\CJKfontspec},emph={[1]Mapping}] +% % 请使用 XeTeX 编译 +% % 外侧的花括号表示分组 +% 这是一个句号{\CJKfontspec{(*\meta{字体名}*)}[Mapping=full-stop]。} +% \end{latexexample} +%^^A! If you want to display ``\FSID'' temporarily after setting +%^^A! \kvopt{fullwidth-stop}{mapping}, the following code snippet +%^^A! will be helpful: +%^^A! \begin{latexexample}[moretexcs={\CJKfontspec},emph={[1]Mapping}] +%^^A! % Compiled with XeTeX +%^^A! % The outside braces is used for group +%^^A! 这是一个句号{\CJKfontspec{(*\meta{font name}*)}[Mapping=full-stop]。} +%^^A! \end{latexexample} +%^^A! +% +^^A % \begin{function}{style/footnote-style} +%^^A 这里奇怪的东西是用来控制对齐的。fdusyntax 会吃掉开头的几个 +%^^A 空格,因此这里用 X 来占位。 +^^A % \begin{fdusyntax}[emph={[1]footnote-style}] +^^A % footnote-style = (**) +^^A % \end{fdusyntax} +^^A % 设置脚注编号样式。西文字体设置会影响其默认取值(见 +^^A % 表~\ref{tab:footnote-font})。因此,要使得该选项生效,需将其 +^^A % 放置在 \opt{font} 选项之后。带有 |sans| 的为相应的无衬线字体 +^^A % 版本;带有 |*| 的为阴文样式(即黑底白字)。 +^^A % \end{function} +%^^A! \begin{function}{style/footnote-style} +%^^A! \begin{fdusyntax}[emph={[1]footnote-style}] +%^^A! footnote-style = (**) +%^^A! \end{fdusyntax} +%^^A! Set the style of footnote numbers. Note that western fonts +%^^A! will affect its default value (see table~\ref{tab:footnote-font}), +%^^A! so you may put it after |font| option. The one with |sans| +%^^A! is for the corresponding sans-serif version, while |*| +%^^A! for white on black version. +%^^A! \end{function} +%^^A! +% +^^A % \begin{table}[ht] +^^A % \caption{西文字体与脚注编号样式默认值的对应关系} +^^A % \label{tab:footnote-font} +^^A % \centering +^^A % \begin{tabular}{ccccc} +^^A % \toprule +^^A % \textbf{西文字体设置} & +^^A % |libertinus| & |lm| & |palatino| & |times| \\ +^^A % \midrule +^^A % \textbf{脚注编号样式默认值} & +^^A % |libertinus| & |pifont| & |pifont| & |xits| \\ +^^A % \bottomrule +^^A % \end{tabular} +^^A % \end{table} +%^^A! \begin{table}[ht] +%^^A! \caption{Relationship between option \opt{font} and the +%^^A! default value of \opt{footnote-style}} +%^^A! \label{tab:footnote-font} +%^^A! \centering +%^^A! \begin{tabular}{ccccc} +%^^A! \toprule +%^^A! \textbf{Western fonts settings} & +%^^A! |libertinus| & |lm| & |palatino| & |times| \\ +%^^A! \midrule +%^^A! \textbf{Default value of footnote number style} & +%^^A! |libertinus| & |pifont| & |pifont| & |xits| \\ +%^^A! \bottomrule +%^^A! \end{tabular} +%^^A! \end{table} +%^^A! +% +%^^A+ +% \begin{function}{style/hyperlink} +% \begin{fdusyntax}[emph={[1]hyperlink}] +% hyperlink = (**) +% \end{fdusyntax} +%^^A- +% 设置超链接样式。\opt{border} 表示在超链接四周绘制方框; +% \opt{color} 表示用彩色显示超链接;\opt{none} 表示没有特殊装饰, +% 可用于生成最终的打印版文稿。 +% \end{function} +%^^A! Set the style of hyperlinks. \opt{border} draws borders around +%^^A! hyperlinks; \opt{color} displays hyperlinks in colorful text; +%^^A! \opt{none} leads to plain text, which is useful when printing +%^^A! the final document. +%^^A! \end{function} +%^^A! +% +% \begin{function}{style/hyperlink-color} +% \begin{fdusyntax}[emph={[1]hyperlink-color}] +% hyperlink-color = (*<(default)|classic|elegant|fantasy|material|\\ +% XXXXXX\mbox{}~~~~~~~~~~~~~~~~~~business|science|summer|autumn|graylevel|prl>*) +% \end{fdusyntax} +% 设置超链接颜色。该选项在 \kvopt{hyperlink}{none} 时无效。 +% 各选项所代表的颜色见表~\ref{tab:hyperlink-color}。 +% \end{function} +%^^A! \begin{function}[added=2017-08-13,updated=2017-12-08]{style/hyperlink-color} +%^^A! \begin{fdusyntax}[emph={[1]hyperlink-color}] +%^^A! hyperlink-color = (*<(default)|classic|elegant|fantasy|material|\\ +%^^A! XXXX\mbox{}~~~~~~~~~~~~~~~~~~business|science|summer|autumn|graylevel|prl>*) +%^^A! \end{fdusyntax} +%^^A! Set the color of hyperlinks. It is invalid if +%^^A! \kvopt{hyperlink}{none}. The related colors can be found +%^^A! in table~\ref{tab:hyperlink-color}. +%^^A! \end{function} +%^^A! +% +%^^A+ +% \begin{table}[ht] +% \centering +%^^A- +% \newcommand\linkcolorexam[3]{^^A +% {\small 图~\textcolor[HTML]{#1}{1-2}, +% (\textcolor[HTML]{#1}{3.4})~式} & +% {\small \textcolor[HTML]{#2}{\texttt{https://www.gdut.edu.cn/}}} & +% {\small 文献~[\textcolor[HTML]{#3}{1}], +% (\textcolor[HTML]{#3}{Knuth~1986})}} +%^^A! \newcommand\linkcolorexam[3]{% +%^^A! {\small Fig.~\textcolor[HTML]{#1}{1-2}, +%^^A! Eq.~(\textcolor[HTML]{#1}{3.4})} & +%^^A! {\small \textcolor[HTML]{#2}{\texttt{http://g.cn}}} & +%^^A! {\small Ref.~[\textcolor[HTML]{#3}{1}], +%^^A! (\textcolor[HTML]{#3}{Knuth~1986})}} +% \begin{threeparttable} +% \caption{预定义的超链接颜色方案} +% \label{tab:hyperlink-color} +%^^A! \begin{threeparttable} +%^^A! \caption{Pre-defined hyperlink color schemes} +%^^A! \label{tab:hyperlink-color} +% \begin{tabular}{c*{3}{>{\hspace{0.2cm}}c<{\hspace{0.2cm}}}} +% \toprule +% \textsf{选项} & \textsf{链接} & \textsf{URL} & \textsf{引用} \\ +%^^A! \begin{tabular}{c*{3}{>{\hspace{0.2cm}}c<{\hspace{0.2cm}}}} +%^^A! \toprule +%^^A! \textsf{Options} & \textsf{Cross references} & \textsf{URL} & \textsf{Citation} \\ +%^^A+ +% \midrule +% \opt{default} & \linkcolorexam{990000}{0000B2}{007F00} \\ +% \opt{classic} & \linkcolorexam{FF0000}{0000FF}{00FF00} \\ +% \opt{elegant}\tnote{a} & \linkcolorexam{961212}{C31818}{9B764F} \\ +% \opt{fantasy}\tnote{b} & \linkcolorexam{FF4A19}{FF3F94}{934BA1} \\ +% \opt{material}\tnote{c} & \linkcolorexam{E91E63}{009688}{4CAF50} \\ +% \opt{business}\tnote{d} & \linkcolorexam{D14542}{295497}{1F6E43} \\ +% \opt{science}\tnote{e} & \linkcolorexam{CA0619}{389F9D}{FF8920} \\ +% \opt{summer}\tnote{f} & \linkcolorexam{00AFAF}{5F5FAF}{5F8700} \\ +% \opt{autumn}\tnote{f} & \linkcolorexam{D70000}{D75F00}{AF8700} \\ +% \opt{graylevel}\tnote{c} & \linkcolorexam{616161}{616161}{616161} \\ +% \opt{prl}\tnote{g} & \linkcolorexam{2D3092}{2D3092}{2D3092} \\ +% \bottomrule +% \end{tabular} +% \begin{tablenotes} +%^^A- +% \item[a] 来自 \href{https://tex.stackexchange.com/}^^A +% {\TeX{} - \LaTeX{} Stack Exchange 网站}。 +% \item[b] Adobe CC 产品配色。 +% \item[c] 取自 Material 色彩方案 +% (见 \url{https://material.io/guidelines/style/color.html})。 +% \item[d] Microsoft Office 2016 产品配色。 +% \item[e] 来自 \href{https://www.wolfram.com/}{Wolfram Research 网站}。 +% \item[f] 均取自 Solarized 色彩方案 +% (见 \url{http://ethanschoonover.com/solarized})。 +% \item[g] \textit{Physical Review Letter} 杂志配色。 +%^^A! \item[a] From \href{https://tex.stackexchange.com/}% +%^^A! {\TeX{} - \LaTeX{} Stack Exchange}. +%^^A! \item[b] Adobe CC. +%^^A! \item[c] Material Design color palette +%^^A! (See \url{https://material.io/guidelines/style/color.html}). +%^^A! \item[d] Microsoft Office 2016. +%^^A! \item[e] From \href{https://www.wolfram.com/}{Wolfram Research website}. +%^^A! \item[f] Solarized color palette +%^^A! (See \url{http://ethanschoonover.com/solarized}). +%^^A! \item[g] \textit{Physical Review Letter} magazine. +%^^A+ +% \end{tablenotes} +% \end{threeparttable} +% \end{table} +%^^A- +%^^A! +% +%^^A+ +% \begin{function}{style/bib-backend} +% \begin{fdusyntax}[emph={[1]bib-backend}] +% bib-backend = (**) +% \end{fdusyntax} +%^^A- +% 选择参考文献的支持方式。选择 \opt{bibtex} 后,将使用 \BibTeX{} +% 处理文献,样式由 \pkg{natbib} 宏包负责;选择 \opt{biblatex} 后, +% 将使用 \biber{} 处理文献,样式则由 \pkg{biblatex} 宏包负责。 +% \end{function} +%^^A! Specify the backend or driver of bibliography processing. +%^^A! \BibTeX{} and \pkg{natbib} package will be used if you choose +%^^A! \opt{bibtex}, while \biber{} and \pkg{biblatex} will be used +%^^A! if you choose \opt{biblatex}. +%^^A! \end{function} +%^^A! +% +% \begin{function}^^A +% {style/bib-style} +% \begin{fdusyntax}[emph={[1]bib-style}] +% bib-style = (**) +% \end{fdusyntax} +% 设置参考文献样式。\opt{author-year} 和 \opt{numerical} 分别对应 +% 国家标准 GB/T 7714--2015 \scite{gb-t-7714-2015} 中的著者—出版年制 +% 和顺序编码制。选择 \meta{其他样式} 时,如果 \kvopt{bib-backend}^^A +% {bibtex},需保证相应的 \file{.bst} 格式文件能被调用;而如果 +% \kvopt{bib-backend}{biblatex},则需保证相应的 \file{.bbx} 格式文件 +% 能被调用。 +% \end{function} +%^^A! \begin{function}[added=2017-10-28,updated=2018-01-25]% +%^^A! {style/bib-style} +%^^A! \begin{fdusyntax}[emph={[1]bib-style}] +%^^A! bib-style = (**) +%^^A! \end{fdusyntax} +%^^A! Set the style of bibliography. \opt{author-year} and +%^^A! \opt{numerical} will follow the standard GB/T 7714--2015. +%^^A! By setting \kvopt{bib-style}{\meta{other style}}, you can use +%^^A! other bibliography style (\file{.bst} file for +%^^A! \kvopt{bib-backend}{bibtex} and \file{.bbx} file for +%^^A! \kvopt{bib-backend}{biblatex}). Suffix is not needed. +%^^A! \end{function} +%^^A! +% +% \begin{function}{style/cite-style} +% \begin{fdusyntax}[emph={[1]cite-style}] +% cite-style = (*\marg{引用样式}*) +% \end{fdusyntax} +% 选择引用格式。默认为空,即与参考文献样式(著者—出版年制或顺序 +% 编码制)保持一致。如果手动填写,需保证相应的 \file{.cbx} 格式文件 +% 能被调用。该选项在 \kvopt{bib-backend}{bibtex} 时无效。 +% \end{function} +%^^A! \begin{function}[added=2018-01-25]{style/cite-style} +%^^A! \begin{fdusyntax}[emph={[1]cite-style}] +%^^A! cite-style = (*\marg{style}*) +%^^A! \end{fdusyntax} +%^^A! Select citation style. Default value is empty, which means +%^^A! the citation style will follow your bibliography style +%^^A! (author-year or numeric). If you want change the citation +%^^A! style, the corresponding \file{.cbx} file must be available. +%^^A! This option is invalid when \kvopt{bib-backend}{bibtex}. +%^^A! \end{function} +%^^A! +% +% \begin{function}{style/bib-resource} +% \begin{fdusyntax}[emph={[1]bib-resource}] +% bib-resource = (*\marg{文件}*) +% \end{fdusyntax} +% 参考文献数据源。可以是单个文件,也可以是用英文逗号隔开的一组文件。 +% 如果 \kvopt{bib-backend}{biblatex},则必须明确给出 \file{.bib} +% 后缀名。 +% \end{function} +%^^A! \begin{function}[added=2018-01-25]{style/bib-resource} +%^^A! \begin{fdusyntax}[emph={[1]bib-resource}] +%^^A! bib-resource = (*\marg{bib file\symbol{"28}s\symbol{"29}}*) +%^^A! \end{fdusyntax} +%^^A! Specify the bibliography database (usually in \file{.bib} +%^^A! format). If using more than one files, the file names should +%^^A! be separated with comma. When \kvopt{bib-backend}{biblatex}, +%^^A! you must type in the ``\file{.bib}'' suffix. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}[added=2017-08-10]{style/logo} +^^A % \begin{fdusyntax}[emph={[1]logo}] +^^A % logo = (*\marg{文件}*) +^^A % \end{fdusyntax} +^^A % 封面中校名图片的文件名。默认值为 \file{fudan-name.pdf}。 +^^A % \end{function} +%^^A! \begin{function}[added=2017-08-10]{style/logo} +%^^A! \begin{fdusyntax}[emph={[1]logo}] +%^^A! logo = (*\marg{file}*) +%^^A! \end{fdusyntax} +%^^A! File name of the logo in thesis cover. Default value is +%^^A! \file{fudan-name.pdf}. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}[added=2017-08-10]{style/logo-size} +^^A % \begin{fdusyntax}[emph={[1]logo-size}] +^^A % logo-size = (*\marg{宽度}*) +^^A % logo-size = {(*\meta{宽度}*), (*\meta{高度}*)} +^^A % \end{fdusyntax} +^^A % 校名图片的大小。默认仅指定了宽度,为 |0.5\textwidth|\/。 +^^A % 如果仅需指定高度,可在 \meta{宽度} 处填入一个空的分组 |{}|。 +^^A % \end{function} +%^^A! \begin{function}[added=2017-08-10]{style/logo-size} +%^^A! \begin{fdusyntax}[emph={[1]logo-size}] +%^^A! logo-size = (*\marg{width}*) +%^^A! logo-size = {(*\meta{width}*), (*\meta{height}*)} +%^^A! \end{fdusyntax} +%^^A! Size of the logo. By default, only width is set to +%^^A! |0.5\textwidth|. To set height only, you can put an +%^^A! empty group ``|{}|'' at \meta{width}. +%^^A! \end{function} +%^^A! +% +%^^A+ +^^A % \begin{function}[added=2017-07-06]{style/auto-make-cover} +^^A % \begin{fdusyntax}[emph={[1]auto-make-cover}] +^^A % auto-make-cover = (*<\TTF>*) +^^A % \end{fdusyntax} +^^A %^^A- +^^A % 是否自动生成论文封面(封一)、指导小组成员名单(封二)和 +^^A % 声明页(封三)。封面中的各项信息,可通过 \cs{fdusetup} 录入, +^^A % 具体请参阅 \ref{subsubsec:信息录入}~节。 +^^A % \end{function} +%^^A! Whether generate thesis cover, list of instructors (inside +%^^A! front cover) and declaration page (inside back cover) +%^^A! automatically. Entries in the cover can be specified also +%^^A! via \cs{fdusetup}, and you can find more details in +%^^A! subsubsection~\ref{subsubsec:information}. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{\makecoveri,\makecoverii,\makecoveriii} +^^A % 用于手动生成论文封面、指导小组成员名单和声明页。这几个命令不能 +^^A % 确保页码的正确编排,因此除非必要,您应当始终使用自动生成的封面。 +^^A % \end{function} +%^^A! \begin{function}{\makecoveri,\makecoverii,\makecoveriii} +%^^A! For generating thesis cover, list of instructors and +%^^A! declaration page manually. These commands cannot ensure +%^^A! the correct page numbers, hence you should always use the +%^^A! auto-generated thesis cover unless necessary. +%^^A! \end{function} +%^^A! +% +% \subsubsection{信息录入} \label{subsubsec:信息录入} +%^^A! \subsubsection{Personal information} \label{subsubsec:information} +%^^A! +% +% \begin{function}{info} +% \begin{fdusyntax}[emph={[1]info}] +% info = (*\marg{键值列表}*) +% info/(*\meta{key}*) = (*\meta{value}*) +% \end{fdusyntax} +% 该选项包含许多子项目,用于录入论文信息。具体内容见下。以下带“|*|” +% 的项目表示对应的英文字段。 +% \end{function} +%^^A! \begin{function}{info} +%^^A! \begin{fdusyntax}[emph={[1]info}] +%^^A! info = (*\marg{key-value list}*) +%^^A! info/(*\meta{key}*) = (*\meta{value}*) +%^^A! \end{fdusyntax} +%^^A! This general option is for entering your personal information. +%^^A! See the following details. Note that options with ``|*|'' are +%^^A! the corresponding English items. +%^^A! \end{function} +%^^A! +% +%^^A+ +% \begin{function}{info/degree} +% \begin{fdusyntax}[emph={[1]degree}] +% degree = (**) +% \end{fdusyntax} +%^^A- +% 学位类型。依次表示工学硕士、管理学硕士、理学硕士、艺术学硕士、工程硕士、工商管理硕士、工程管理硕士、会计硕士、翻译硕士。 +% \end{function} +%^^A! Degree type. This option can only be used in master degree +%^^A! thesis. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/title,info/title*} +% \begin{fdusyntax}[emph={[1]title,title*}] +% title = (*\marg{中文标题}*) +% title* = (*\marg{英文标题}*) +% \end{fdusyntax} +% 论文标题。默认会在约 20 个汉字字宽处强制断行,但为了语义的 +% 连贯以及排版的美观,如果您的标题长于一行,建议使用“|\\|” +% 手动断行。 +% \end{function} +%^^A! \begin{function}{info/title,info/title*} +%^^A! \begin{fdusyntax}[emph={[1]title,title*}] +%^^A! title = (*\marg{title in Chinese}*) +%^^A! title* = (*\marg{title in English}*) +%^^A! \end{fdusyntax} +%^^A! Title of your thesis. The line width is about \SI{30}{em} by +%^^A! default, but you may break it with |\\| manually. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/author,info/author*} +% \begin{fdusyntax}[emph={[1]author,author*}] +% author = (*\marg{姓名}*) +% author* = (*\marg{英文姓名(或拼音)}*) +% \end{fdusyntax} +% 作者姓名。 +% \end{function} +%^^A! \begin{function}{info/author,info/author*} +%^^A! \begin{fdusyntax}[emph={[1]author,author*}] +%^^A! author = (*\marg{name in Chinese}*) +%^^A! author* = (*\marg{name in English \lparen or Pinyin\rparen}*) +%^^A! \end{fdusyntax} +%^^A! Author's name. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/supervisor,info/supervisor*} +% \begin{fdusyntax}[emph={[1]supervisor,supervisor*}] +% supervisor = (*\marg{姓名及职称}*) +% supervisor* = (*\marg{英文姓名(或拼音)及职称}*) +% \end{fdusyntax} +% 导师姓名及职称。 +% \end{function} +%^^A! \begin{function}{info/supervisor} +%^^A! \begin{fdusyntax}[emph={[1]supervisor}] +%^^A! supervisor = (*\marg{name}*) +%^^A! \end{fdusyntax} +%^^A! Supervisor's name. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/department,info/department*} +% \begin{fdusyntax}[emph={[1]department,department*}] +% department = (*\marg{名称}*) +% department* = (*\marg{英文名称}*) +% \end{fdusyntax} +% 院系名称。 +% \end{function} +%^^A! \begin{function}{info/department} +%^^A! \begin{fdusyntax}[emph={[1]department}] +%^^A! department = (*\marg{name}*) +%^^A! \end{fdusyntax} +%^^A! Name of the department. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/major} +% \begin{fdusyntax}[emph={[1]major}] +% major = (*\marg{名称}*) +% \end{fdusyntax} +% 专业名称。 +% \end{function} +%^^A! \begin{function}{info/major} +%^^A! \begin{fdusyntax}[emph={[1]major}] +%^^A! major = (*\marg{name}*) +%^^A! \end{fdusyntax} +%^^A! Name of the major. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/student-id} +% \begin{fdusyntax}[emph={[1]student-id}] +% student-id = (*\marg{数字}*) +% \end{fdusyntax} +% 作者学号。 +% \end{function} +%^^A! \begin{function}{info/student-id} +%^^A! \begin{fdusyntax}[emph={[1]student-id}] +%^^A! student-id = (*\marg{number}*) +%^^A! \end{fdusyntax} +%^^A! Author's student ID. +%^^A! \end{function} +%^^A! +% +% 广东工业大学学号共 10 位。 +%^^A! In Fudan University, student ID has 11 digits. The first two +%^^A! are the year of attendance; next one represents the student's +%^^A! type (1 for doctor, 2 for master and 3 for bachelor); the +%^^A! following five digits are major ID while the last three are +%^^A! serial number. +%^^A! +% +^^A % \begin{function}{info/school-id} +^^A % \begin{fdusyntax}[emph={[1]school-id}] +^^A % school-id = (*\marg{数字}*) +^^A % \end{fdusyntax} +^^A % 学校代码。默认值为 10246(这是复旦大学的学校代码)。 +^^A % \end{function} +%^^A! \begin{function}{info/school-id} +%^^A! \begin{fdusyntax}[emph={[1]school-id}] +%^^A! school-id = (*\marg{number}*) +%^^A! \end{fdusyntax} +%^^A! School ID. Default value is 10246 (school ID of Fudan University). +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/date} +% \begin{fdusyntax}[emph={[1]date}] +% date = (*\marg{日期}*) +% \end{fdusyntax} +% 论文完成日期。默认值为文档编译日期(\tn{today})。 +% \end{function} +%^^A! \begin{function}{info/date} +%^^A! \begin{fdusyntax}[emph={[1]date}] +%^^A! date = (*\marg{date}*) +%^^A! \end{fdusyntax} +%^^A! Finish date of your thesis. Default value is the compilation +%^^A! date (\tn{today}). +%^^A! \end{function} +%^^A! +% +%^^A+ +% \begin{function}{info/secret-level} +% \begin{fdusyntax}[emph={[1]secret-level}] +% secret-level = (*<(none)|i|ii|iii>*) +% \end{fdusyntax} +%^^A- +% 密级。\opt{i}、\opt{ii}、\opt{iii} 分别表示秘密、机密、绝密; +% \opt{none} 表示论文不涉密,即不显示密级。 +% \end{function} +%^^A! Secret level. \opt{i}, \opt{ii} and \opt{iii} means +%^^A! ``秘密'' (secret), ``机密'' (confidential) and ``绝密'' +%^^A! (top secret) respectively. \opt{none} means your thesis is +%^^A! not secret-related and secret level and year will not be +%^^A! shown. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}[added=2017-07-04]{info/secret-year} +^^A % \begin{fdusyntax}[emph={[1]secret-year}] +^^A % secret-year = (*\marg{年限}*) +^^A % \end{fdusyntax} +^^A % 保密年限。建议您使用中文,如“五年”。该选项在设置 +^^A % \kvopt{secret-level}{none} 时无效。 +^^A % \end{function} +%^^A! \begin{function}[added=2017-07-04]{info/secret-year} +%^^A! \begin{fdusyntax}[emph={[1]secret-year}] +%^^A! secret-year = (*\marg{year}*) +%^^A! \end{fdusyntax} +%^^A! Secret year. It's recommended to use Chinese word as ``五年'' +%^^A! (5 years) here. This option is invalid if you have set +%^^A! \kvopt{secret-level}{none}. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{info/instructors} +^^A % \begin{fdusyntax}[emph={[1]instructors}] +^^A % instructors = (*\marg{成员 1, 成员 2, ...}*) +^^A % \end{fdusyntax} +^^A % 指导小组成员。各成员之间需使用英文逗号隔开。为防止歧义, +^^A % 可以用分组括号“|{...}|”把各成员字段括起来。 +^^A % \end{function} +%^^A! \begin{function}{info/instructors} +%^^A! \begin{fdusyntax}[emph={[1]instructors}] +%^^A! instructors = (*\marg{member 1, member 2, ...}*) +%^^A! \end{fdusyntax} +%^^A! Instructors' name. Each name should be separated with +%^^A! comma. To disambiguate, you may put text containing comma +%^^A! into a group ``|{...}|''. +%^^A! \end{function} +%^^A! +% +% \begin{function}{info/keywords,info/keywords*} +% \begin{fdusyntax}[emph={[1]keywords,keywords*}] +% keywords = (*\marg{中文关键字}*) +% keywords* = (*\marg{英文关键字}*) +% \end{fdusyntax} +% 关键字列表。各关键字之间需使用英文逗号隔开。为防止歧义, +% 可以用分组括号“|{...}|”把各字段括起来。 +% \end{function} +%^^A! \begin{function}{info/keywords,info/keywords*} +%^^A! \begin{fdusyntax}[emph={[1]keywords,keywords*}] +%^^A! keywords = (*\marg{keywords in Chinese}*) +%^^A! keywords* = (*\marg{keywords in English}*) +%^^A! \end{fdusyntax} +%^^A! Keywords list. Each keyword should be separated with comma. +%^^A! To disambiguate, you may put text containing comma into a +%^^A! group ``|{...}|''. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{info/clc} +^^A % \begin{fdusyntax}[emph={[1]clc}] +^^A % clc = (*\marg{分类号}*) +^^A % \end{fdusyntax} +^^A % 中图分类号(CLC)。 +^^A % \end{function} +%^^A! \begin{function}{info/clc} +%^^A! \begin{fdusyntax}[emph={[1]clc}] +%^^A! clc = (*\marg{classification codes}*) +%^^A! \end{fdusyntax} +%^^A! Chinese Library Classification (CLC). +%^^A! \end{function} +%^^A! +% +% \subsection{正文编写} +%^^A! \subsection{Writing your thesis} +%^^A! +% +% \begin{quotation} +% 喬孟符(吉)博學多能,以樂府稱。嘗云:「作樂府亦有法,曰^^A +% \CJKunderdot{鳳頭、豬肚、豹尾}六字是也。」大概起要美麗,中要浩蕩, +% 結要響亮。尤貴在首尾貫穿,意思清新。苟能若是,斯可以言樂府矣。 +% \end{quotation} +% \hfill ——陶宗儀《南村輟耕錄·作今樂府法》 +% +% \subsubsection{凤头} +%^^A! \subsubsection{Front matter} +%^^A! +% +^^A % \begin{function}{\frontmatter} +^^A % 声明前置部分开始。 +^^A % \end{function} +%^^A! \begin{function}{\frontmatter} +%^^A! Declare the beginning of front matter. +%^^A! \end{function} +%^^A! +% +% 在本模板中,前置部分包含封面、中英文摘要、符号表以及目录等。 +% 前置部分的页码采用大写字母和大写罗马字母,并且与正文分开计数。 +%^^A! Front matter contains table of contents, abstracts and notation +%^^A! list. The page numbers in front matter will be shown in +%^^A! lowercase Roman numerals, and will be counted separately with +%^^A! main matter. +%^^A! +% +% \begin{function}{\gduttableofcontents} +% 生成中英文目录。为了生成完整、正确的目录,您至少需要编译\emph{两次}。 +% \end{function} +%^^A! \begin{function}{\tableofcontents} +%^^A! Generate the table of contents (TOC). You need to compile +%^^A! the source file at least \emph{twice} to get the correct TOC. +%^^A! If your thesis contains many figures or tables, you may also +%^^A! use \cs{listoffigures} or \cs{listoftables} to generate a list +%^^A! of them. +%^^A! \end{function} +%^^A! +% +%^^A TODO: \DescribeEnv{abstract} +%^^A TODO: \DescribeEnv{abstract*} +% \begin{function}{abstract} +% \begin{fdusyntax}[emph={[2]abstract}] +% \begin{abstract} +% (*\meta{中文摘要}*) +% \end{abstract} +% \end{fdusyntax} +% \end{function} +% \begin{function}{abstract*} +% \begin{fdusyntax}[emph={[2]abstract*}] +% \begin{abstract*} +% (*\meta{英文摘要}*) +% \end{abstract*} +% \end{fdusyntax} +% 摘要。不带星号和带星号的版本分别用来输入中文摘要 +% 和英文摘要。 +% \end{function} +%^^A! \begin{function}{abstract} +%^^A! \begin{fdusyntax}[emph={[2]abstract}] +%^^A! % fduthesis (Chinese thesis) % fduthesis-en (English thesis) +%^^A! \begin{abstract} \begin{abstract} +%^^A! (*\meta{Chinese abstract} \hspace{3cm} \meta{English abstract}*) +%^^A! \end{abstract} \end{abstract} +%^^A! \end{fdusyntax} +%^^A! \end{function} +%^^A! \begin{function}[rEXP]{abstract*} +%^^A! \begin{fdusyntax}[emph={[2]abstract*}] +%^^A! % Only for fduthesis +%^^A! \begin{abstract*} +%^^A! (*\meta{English abstract}*) +%^^A! \end{abstract*} +%^^A! \end{fdusyntax} +%^^A! Abstract environment. In \cls{fduthesis}, \env{abstract} and +%^^A! \env{abstract*} are used for Chinese and English abstract, +%^^A! respectively; while in \cls{fduthesis-en}, there is no +%^^A! \env{abstract*} environment and you need to write the English +%^^A! abstract merely. +%^^A! \end{function} +%^^A! +% +% 摘要的最后,会显示关键字列表。 +% 可通过 \cs{gdutsetup} 录入,具体 +% 请参阅 \ref{subsubsec:信息录入}~节。 +%^^A! At the end of abstract (both Chinese and English, if available), +%^^A! keywords list and CLC number will be shown. They can be +%^^A! specified via command \cs{fdusetup} and you may refer to +%^^A! subsubsection~\ref{subsubsec:information} for more details. +%^^A! +% +%^^A TODO: \DescribeEnv{notation} +% \begin{function}{notation} +% \begin{fdusyntax}[emph={[2]notation}] +% \begin{notation}(*\oarg{列格式说明}*) +% (*\meta{符号 1}*) & (*\meta{说明}*) \\ +% (*\meta{符号 2}*) & (*\meta{说明}*) \\ +% (*\phantom{\meta{符号 $n$}}*) (*$\vdots$*) +% (*\meta{符号\ \kern-0.1em$n$}*) & (*\meta{说明}*) +% \end{notation} +% \end{fdusyntax} +% 符号表。可选参数 \meta{列格式说明}与 \LaTeX{} 中标准表格的列格 +% 式说明语法一致,默认值为“|lp{7.5cm}|”,即第一列宽度自动调整, +% 第二列限宽 \SI{7.5}{cm},两列均为左对齐。 +% \end{function} +%^^A! \begin{function}{notation} +%^^A! \begin{fdusyntax}[emph={[2]notation}] +%^^A! \begin{notation}(*\oarg{column format}*) +%^^A! (*\meta{symbol 1}*) & (*\meta{description}*) \\ +%^^A! (*\meta{symbol 2}*) & (*\meta{description}*) \\ +%^^A! (*\phantom{\meta{symbol $n$}}*) (*$\vdots$*) +%^^A! (*\meta{symbol \kern-0.1em$n$}*) & (*\meta{description}*) +%^^A! \end{notation} +%^^A! \end{fdusyntax} +%^^A! Notation list (or symbol list, nomenclature) environment. +%^^A! The optional argument \meta{column format} is the same as +%^^A! in a standard \LaTeX{} table. The default value is +%^^A! ``|lp{7.5cm}|'', which means auto-width for the first column +%^^A! and fix-width (\SI{7.5}{cm}) for the second; both columns will +%^^A! be left-aligned. +%^^A! \end{function} +%^^A! +% +% \subsubsection{猪肚} +%^^A! \subsubsection{Main matter} +%^^A! +% +% \begin{function}{\mainmatter} +% 声明主体部分开始。 +% \end{function} +%^^A! \begin{function}{\mainmatter} +%^^A! Declare the beginning of main matter. +%^^A! \end{function} +%^^A! +% +% 主体部分是论文的核心,您可以分章节撰写。如有需求,也可以采用 +% 多文件编译的方式。主体部分的页码采用阿拉伯数字。 +%^^A! As the name suggests, ``main matter'' is the main body of your +%^^A! thesis. When working on a big projects, it's usually a good +%^^A! idea to split the source file into several parts. The page +%^^A! numbers in main matter are shown in arabic numerals. +%^^A! +% \begin{function}{\gdutchapter,\gdutsection,\gdutsubsection,\subsubsection,\paragraph,\subparagraph} +% \begin{fdusyntax}[deletetexcs={\gdutchapter,\gdutsection,\gdutsubsection,\subsubsection,\paragraph,\subparagraph},% +% morekeywords={\gdutchapter,\gdutsection,\gdutsubsection,\subsubsection,\paragraph,\subparagraph}] +% \gdutchapter(*\marg{中文标题}*)(*\marg{英文标题}*) +% \gdutsection(*\marg{中文标题}*)(*\marg{英文标题}*) +% \gdutsubsection(*\marg{中文标题}*)(*\marg{英文标题}*) +% \subsubsection(*\marg{中文标题}*) +% \paragraph(*\marg{款的引导句}*) +% \subparagraph(*\marg{项的引导句}*) +% \end{fdusyntax} +% 生成章节标题。|\gdut...| 的章节命令是为了生成中英文目录。 +% \end{function} +% +% \begin{function}{gdutenum,gdutenenum} +% \begin{fdusyntax}[emph={[2]gdutenum,gdutenenum}] +% \begin{gdutenum} +% \item (*\meta{中文列表}*) +% \end{gdutenum} +% \begin{gdutenenum} +% \item (*\meta{英文列表}*) +% \end{gdutenenum} +% \end{fdusyntax} +% 中文列表指括号为中文括号的列表,如:“(1)(2)”; +% 英文列表指括号为英文括号的列表,如:“(1)(2)”。 +% 中英文列表的风格符合中文列表常见风格。 +% \end{function} +^^A % \begin{function}{\footnote} +^^A % \begin{fdusyntax}[deletetexcs={\footnote},% +^^A % morekeywords={\footnote}] +^^A % \footnote(*\marg{脚注文字}*) +^^A % \end{fdusyntax} +^^A % 插入脚注。 +^^A % \end{function} +%^^A! \begin{function}[updated=2018-01-15]{\footnote} +%^^A! \begin{fdusyntax}[deletetexcs={\footnote},% +%^^A! morekeywords={\footnote}] +%^^A! \footnote(*\marg{text}*) +%^^A! \end{fdusyntax} +%^^A! Insert a footnote. The style of footnote numbers can be set +%^^A! with option \opt{style/foot\-note\-style}. See subsubsection~% +%^^A! \ref{subsubsec:style-and-format} for more details. +%^^A! \end{function} +%^^A! +% +%^^A TODO: \DescribeEnv{proof} +^^A % \begin{function}{axiom,corollary,definition,example,lemma, +^^A % proof,theorem} +^^A % \begin{fdusyntax}[emph={[2]proof}] +^^A % \begin{proof}(*\oarg{小标题}*) +^^A % (*\meta{证明过程}*) +^^A % \end{proof} +^^A % \end{fdusyntax} +^^A % 一系列预定义的数学环境。具体含义见表~\ref{tab:theorem}。 +^^A % \end{function} +%^^A! \begin{function}{axiom,corollary,definition,example,lemma, +%^^A! proof,theorem} +%^^A! \begin{fdusyntax}[emph={[2]proof}] +%^^A! \begin{proof}(*\oarg{subheading}*) +%^^A! (*\meta{procedure of proof}*) +%^^A! \end{proof} +%^^A! \end{fdusyntax} +%^^A! A series of pre-defined math environments. +%^^A! \end{function} +%^^A! +% +^^A % \begin{table}[ht] +^^A % \caption{预定义的数学环境} \label{tab:theorem} +^^A % \centering +^^A % \begin{tabular}{cccccccc} +^^A % \toprule +^^A % \textbf{名称} & +^^A % \env{axiom} & \env{corollary} & \env{definition} & +^^A % \env{example} & \env{lemma} & \env{proof} & +^^A % \env{theorem} \\ +^^A % \midrule +^^A % \textbf{含义} & +^^A % 公理 & 推论 & 定义 & 例 & 引理 & 证明 & 定理 \\ +^^A % \bottomrule +^^A % \end{tabular} +^^A % \end{table} +^^A % +^^A % 证明环境(\env{proof})的最后会添加证毕符号“$\QED$”。要确保 +^^A % 该符号在正确的位置显示,您需要按照 \ref{subsec:编译方式}~节 +^^A % 中的有关说明编译\emph{两次}。 +%^^A! A QED\footnote{Abbreviation of Latin phrase \emph{quod erat +%^^A! demonstrandum}, means ``what was to be demonstrated''.} +%^^A! symbol ``$\QED$'' will be added at the end of \env{proof} +%^^A! environment. You need to compile the source file \emph{twice} +%^^A! as in subsection~\ref{subsec:compilation} in order to make +%^^A! the position of QED symbol correct. +%^^A! +% +^^A % \begin{function}[updated=2017-12-12]{\newtheorem} +^^A % \begin{fdusyntax}[deletetexcs={\newtheorem}, +^^A % morekeywords={\newtheorem,\newtheorem*}] +^^A % \newtheorem(*\oarg{选项}\marg{环境名}\marg{标题}*) +^^A % \newtheorem*(*\oarg{选项}\marg{环境名}\marg{标题}*) +^^A % \begin(*\marg{环境名}\oarg{小标题}*) +^^A % (*\meta{内容}*) +^^A % \end(*\marg{环境名}*) +^^A % \end{fdusyntax} +^^A % 声明新的定理类环境(数学环境)。带星号的版本表示不进行编号, +^^A % 并且会默认添加证毕符号“$\QED$”。声明后,即可同预定义的数学环境 +^^A % 一样使用。 +^^A % \end{function} +%^^A! \begin{function}[updated=2017-12-12]{\newtheorem} +%^^A! \begin{fdusyntax}[deletetexcs={\newtheorem}, +%^^A! morekeywords={\newtheorem,\newtheorem*}] +%^^A! \newtheorem(*\oarg{options}\marg{environment}\marg{title}*) +%^^A! \newtheorem*(*\oarg{options}\marg{environment}\marg{title}*) +%^^A! \begin(*\marg{environment}\oarg{subheading}*) +%^^A! (*\meta{contents}*) +%^^A! \end(*\marg{environment}*) +%^^A! \end{fdusyntax} +%^^A! Declare new math environments (theorems). If you use +%^^A! \cs{newtheorem*}, then the theorem will not be numbered, and +%^^A! a QED symbol ``$\QED$'' will be added at the end of the +%^^A! environment. All the theorem environments defined by yourself +%^^A! can be used as the pre-defined ones. +%^^A! \end{function} +%^^A! +% +^^A % 事实上,表~\ref{tab:theorem} 中预定义的环境正是通过以下方式定义的: +^^A % \begin{latexexample}[deletetexcs={\newtheorem}, +^^A % morekeywords={\newtheorem,\newtheorem*}] +^^A % \newtheorem*{proof}{证明} +^^A % \newtheorem{axiom}{公理} +^^A % \newtheorem{corollary}{定理} +^^A % ... +^^A % \end{latexexample} +%^^A! Actually, the pre-defined math environments are just defined +%^^A! with \cs{new\-the\-o\-rem} and \cs{new\-the\-o\-rem*}: +%^^A! \begin{latexexample}[deletetexcs={\newtheorem}, +%^^A! morekeywords={\newtheorem,\newtheorem*}] +%^^A! \newtheorem*{proof}{proof} +%^^A! \newtheorem{axiom}{axiom} +%^^A! \newtheorem{corollary}{corollary} +%^^A! ... +%^^A! \end{latexexample} +%^^A! +% +^^A % 与 \cs{fdusetup} 相同,\cs{newtheorem} 的可选参数 \meta{选项} +^^A % 也为一组键值列表。可用的选项见下。注意您无需输入“|theorem/|”。 +%^^A! Similar with \cs{fdusetup}, the optional argument \meta{options} +%^^A! of \cs{newtheorem} is a key-value list as well. The available +%^^A! are described below. Note that you don't need to type in the +%^^A! ``|theorem/|'' prefix. +%^^A! +% +^^A % \begin{function}{theorem/style} +^^A % \begin{fdusyntax}[emph={[1]style}] +^^A % style = (*<(plain)|margin|change|\\ +^^A % XXXXXX\mbox{}~~~~~~~~break|marginbreak|changebreak>*) +^^A % \end{fdusyntax} +^^A % 定理类环境的总体样式。 +^^A % \end{function} +%^^A! \begin{function}{theorem/style} +%^^A! \begin{fdusyntax}[emph={[1]style}] +%^^A! style = (*<(plain)|margin|change|\\ +%^^A! XXXX\mbox{}~~~~~~~~break|marginbreak|changebreak>*) +%^^A! \end{fdusyntax} +%^^A! The overall style of the theorem environment. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{theorem/header-font} +^^A % \begin{fdusyntax}[emph={[1]header-font}] +^^A % header-font = (*\marg{字体}*) +^^A % \end{fdusyntax} +^^A % 定理头(即标题)的字体。中文模板默认为 \tn{sffamily},即无衬线体 +^^A % (黑体);英文模板默认为 |\bfseries\upshape|,即加粗直立体。 +^^A % \end{function} +%^^A! \begin{function}{theorem/header-font} +%^^A! \begin{fdusyntax}[emph={[1]header-font}] +%^^A! header-font = (*\marg{font}*) +%^^A! \end{fdusyntax} +%^^A! Font of the theorem header. Default value is \tn{sffamily} +%^^A! and |\bfseries\upshape| for Chinese and English template, +%^^A! respectively. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{theorem/body-font} +^^A % \begin{fdusyntax}[emph={[1]body-font}] +^^A % body-font = (*\marg{字体}*) +^^A % \end{fdusyntax} +^^A % 定理内容的字体。中文模板默认为 \tn{fdu@kai},即楷体;英文模板 +^^A % 默认为 \tn{itshape},即斜体。 +^^A % \end{function} +%^^A! \begin{function}{theorem/body-font} +%^^A! \begin{fdusyntax}[emph={[1]body-font}] +%^^A! body-font = (*\marg{font}*) +%^^A! \end{fdusyntax} +%^^A! Font of the theorem body. Default value is \tn{fdu@kai} +%^^A! (\textit{楷体}) and \tn{itshape} for Chinese and English +%^^A! template, respectively. +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{theorem/qed} +^^A % \begin{fdusyntax}[emph={[1]qed}] +^^A % qed = (*\marg{符号}*) +^^A % \end{fdusyntax} +^^A % 定理结束标记(即证毕符号)。如果用 \cs{newtheorem} 声明定理, +^^A % 则默认为空;用 \cs{newtheorem*} 声明,则默认为 +^^A % |\ensuremath{\QED}|,即“$\QED$”。 +^^A % \end{function} +%^^A! \begin{function}{theorem/qed} +%^^A! \begin{fdusyntax}[emph={[1]qed}] +%^^A! qed = (*\marg{symbol}*) +%^^A! \end{fdusyntax} +%^^A! Theorem end mark. For \cs{newtheorem}, default value is +%^^A! empty; for \cs{newtheorem*}, default value is +%^^A! |\ensuremath{\QED}| (i.e.\ ``$\QED$''). +%^^A! \end{function} +%^^A! +% +^^A % \begin{function}{theorem/counter} +^^A % \begin{fdusyntax}[emph={[1]counter}] +^^A % counter = (*\marg{计数器}*) +^^A % \end{fdusyntax} +^^A % 定理计数器,表示定理编号在 \meta{计数器} 的下一级,并会随 +^^A % \meta{计数器} 的变化而清零。\scite{刘海洋2013latex入门} +^^A % 默认为 |chapter|,表示按章编号。使用 \cs{newtheorem*} 时, +^^A % 该选项无效。 +^^A % \end{function} +%^^A! \begin{function}{theorem/counter} +%^^A! \begin{fdusyntax}[emph={[1]counter}] +%^^A! counter = (*\marg{counter}*) +%^^A! \end{fdusyntax} +%^^A! The theorem will be enumerated within \meta{counter}. For +%^^A! example, the default value is |chapter|, which means with +%^^A! each new \tn{chapter}, the enumeration begins again with 1. +%^^A! This option is invalid for \cs{newtheorem*}. +%^^A! \end{function} +%^^A! +% +% \begin{function}{\bicaption} +% \begin{fdusyntax}[deletetexcs={\bicaption},morekeywords={\bicaption}] +% \bicaption(*\marg{中文标题}*)(*\marg{英文标题}*) +% \end{fdusyntax} +% 插入图表标题。 +% \end{function} +%^^A! \begin{function}{\caption} +%^^A! \begin{fdusyntax}[deletetexcs={\caption},morekeywords={\caption}] +%^^A! \caption(*\marg{caption}*) +%^^A! \caption(*\oarg{short caption}\marg{long caption}*) +%^^A! \end{fdusyntax} +%^^A! Insert the caption of figure or table. The optional argument +%^^A! \meta{short caption} will be shown in the list of figures/tables. +%^^A! In \meta{long caption}, you can write descriptions for several +%^^A! paragraphs, but \meta{short caption} and the single +%^^A! \meta{caption} will not allow multi-paragraph text (i.e.\ +%^^A! text containing \tn{par}) inside. +%^^A! \end{function} +%^^A! +% +% 按照排版惯例,建议您将表格的标题放置在绘制表格的命令之前, +% 而将图片的标题放置在绘图或插图的命令之后。另需注意, +% \tn{bicaption} 命令必须放置在浮动体环境(如 \env{table} 和 +% \env{figure})中。 +%^^A! By convention, caption of a table is usually put \emph{before} +%^^A! the table itself, while for figure it's the opposite. +%^^A! In addition, command \tn{caption} must be put inside float +%^^A! environments (e.g.\ \env{table} and \env{figure}). +%^^A! +% +% \begin{function}{figure,\subfloat} +% \begin{fdusyntax}[deletetexcs={\subfloat},morekeywords={\subfloat}] +% \begin{figure}[htbp] +% \subfloat(*\oarg{子图标题}*){\label(*\marg{子图标签}*) +% \includegraphics(*\oarg{插图选项}*)(*\marg{图名}*) +% } +% \qquad +% \subfloat(*\oarg{子图标题}*){\label(*\marg{子图标签}*) +% \includegraphics(*\oarg{插图选项}*)(*\marg{图名}*) +% } +% \bicaption(*\marg{中文标题}*)(*\marg{英文标题}*) +% \label(*\marg{图片标签}*) +% \end{figure} +% \end{fdusyntax} +% \env{figure} 环境与 |\subfloat| 命令的用法。 +% \end{function} +% +% \begin{function}{\toprule,\midrule,\bottomrule} +% \begin{fdusyntax}[deletetexcs={\toprule,\midrule,\bottomrule},morekeywords={\toprule,\midrule,\bottomrule}] +% \begin{tabular}(*\marg{列格式说明}*) +% \toprule +% (*\meta{内容}*) \\ +% \midrule +% (*\meta{内容}*) \\ +% \bottomrule +% \end{tabular} +% \end{fdusyntax} +% 三线表的用法。 +% \end{function} +% +% \begin{function}{\autoref} +% \begin{fdusyntax}[deletetexcs={\autoref},morekeywords={\autoref}] +% \autoref(*\marg{标签}*) +% \end{fdusyntax} +% 自动引用标签。普通的 |\ref| 只能引用数字,不方便使用。用 |\autoref| 命令可以自动给所引用的标签加上文字,具体设置见表~\ref{tab:autoref}。 +% \end{function} +% +% \begin{table}[htbp] +% \centering +% \caption{\texttt{\textbackslash autoref} 命令预设置}\label{tab:autoref} +% \begin{tabular}{cccccccc} +% \toprule +% \textbf{环境} & \textbf{预设置格式} \\ +% \midrule +% \env{figure} & 图1-1 \\ +% \env{\textbackslash subfloat} & 图1-1(a) \\ +% \env{table} & 表1-1 \\ +% \env{equation} & 公式(1.1) \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \subsubsection{豹尾} +%^^A! \subsubsection{Back matter} +%^^A! +% +% \begin{function}{\gdutbackmatter} +% 声明后置部分开始。 +% \end{function} +%^^A! \begin{function}{\backmatter} +%^^A! Declare the beginning of back matter. +%^^A! \end{function} +%^^A! +% +% 后置部分包含结论与展望、参考文献、攻读学位期间取得与学位论文相关的成果、学位论文独创性声明及学位论文版权使用授权声明、致谢等。 +%^^A! Back matter contains bibliography, declaration page, etc. +%^^A! +% +% \begin{function}{\gdutbacksection} +% \begin{fdusyntax}[morekeywords={\gdutbacksection}] +% \gdutbacksection(*\marg{中文标题}*) +% \end{fdusyntax} +% 生成无序号的一级标题。常用于结论与展望、攻读学位期间取得与学位论文相关的成果。 +% \end{function} +% +% +% \begin{function}{\printbibliography} +% \begin{fdusyntax}[morekeywords={\printbibliography}] +% \printbibliography(*\oarg{选项}*) +% \end{fdusyntax} +% 打印参考文献列表。如果 \kvopt{bib-backend}{bibtex},则 \meta{选项} +% 无效,相当于 \tn{bibliography} \texttt{\marg{文献数据库}},其中的 +% \meta{文献数据库} 可利用 \opt{style/bib-resource} 选项指定,具体见 +% \ref{subsubsec:论文格式}~小节;而如果 \kvopt{bib-backend}^^A +% {biblatex},则该命令由 \pkg{biblatex} 宏包直接提供,可用选项请 +% 参阅其文档 \cite{biblatex}。 +% \end{function} +%^^A! \begin{function}[updated=2018-01-25]{\printbibliography} +%^^A! \begin{fdusyntax}[morekeywords={\printbibliography}] +%^^A! \printbibliography(*\oarg{options}*) +%^^A! \end{fdusyntax} +%^^A! Print the bibliography. When \kvopt{bib-backend}{bibtex}, then +%^^A! \meta{options} is invalid and this command is equivalent to +%^^A! \tn{bibliography} \texttt{\marg{bib files}}, where +%^^A! \meta{bib files} should be specified with option +%^^A! \opt{style/bib-resource} (see subsubsection~% +%^^A! \ref{subsubsec:style-and-format}). When \kvopt{bib-backend}% +%^^A! {bibtex}, then \tn{printbibliography} is provided by +%^^A! \pkg{biblatex} and the available options can be found in its +%^^A! documentation. +%^^A! \end{function} +%^^A! +% +% +% \begin{function}{results} +% \begin{fdusyntax}[emph={[2]results}] +% \begin{results} +% \item (*\meta{相关成果}*) +% \item (*\meta{相关成果}*) +% \end{results} +% \end{fdusyntax} +% 用于生成攻读学位期间取得与学位论文相关的成果列表。 +% \end{function} +% +% +% \begin{function}{\gdutstatement} +% 生成学位论文独创性声明及学位论文版权使用授权声明。 +% \end{function} +% +% +% \begin{function}{\gdutappendix} +% 声明附录部分开始。 +% \end{function} +% +% +% \section{宏包依赖情况} +%^^A! \section{Packages dependencies} +%^^A! +% +% 使用不同编译方式、指定不同选项,会导致宏包依赖情况有所不同。 +% 具体如下: +% \begin{itemize} +% \item 在任何情况下,本模板都会\emph{显式}调用以下宏包 +% (或文档类): +% \begin{itemize} +% \item \pkg{expl3}、\pkg{xparse}、\pkg{xtemplate} 和 +% \pkg{l3keys2e},用于构建 \LaTeX3 编程环境 +% \scite{source3}。它们分属 \pkg{l3kernel} 和 +% \pkg{l3packages} 宏集。 +% \item \cls{ctexbook},提供中文排版的通用框架。属于 \CTeX{} +% 宏集 \scite{CTeX}。 +% \item \pkg{amsmath},对 \LaTeX{} 的数学排版功能进行了 +% 全面扩展。属于 \AmSLaTeX{} 套件。 +% \item \pkg{unicode-math},负责处理 Unicode 编码的 +% OpenType 数学字体。 +% \item \pkg{geometry},用于调整页面尺寸。 +% \item \pkg{fancyhdr},处理页眉页脚。 +% \item \pkg{graphicx},提供图形插入的接口。 +% \item \pkg{longtable}、\pkg{array}、\pkg{multirow}、\pkg{booktabs},提供表格支持。 +% \item \pkg{enumitem},提供列表定制支持。 +% \item \pkg{caption}、\pkg{bicaption}、\pkg{subfig},提供子图和题注定制支持。 +% \item \pkg{tocloft},提供目录定制支持。 +% \item \pkg{zhlineskip},提供行距定制支持。 +% \item \pkg{xcolor},提供彩色支持。 +% \item \pkg{xeCJKfntef},提供分散对齐环境支持。 +% \item \pkg{hyperref},提供交叉引用、超链接、电子书签等功能。 +% \end{itemize} +% \item 开启 \kvopt{style/bib-backend}{bibtex} 后,会调用 +% \pkg{natbib} 宏包,并依赖 \BibTeX{} 程序。参考文献样式由 +% \pkg{gbt7714} 宏包提供 \scite{natbib,gbt7714}。 +% \item 开启 \kvopt{style/bib-backend}{biblatex} 后,会调用 +% \pkg{biblatex} 宏包,并依赖 \biber{} 程序。参考文献样式由 +% \pkg{biblatex-gb7714-2015} 宏包提供 +% \scite{biblatex,biblatex-gb7714-2015}。 +% \end{itemize} +%^^A! Different compilation methods and options will result in a +%^^A! different packages dependency. Details are as follows: +%^^A! \begin{itemize} +%^^A! \item In any case, \cls{fduthesis} will load the following +%^^A! packages \emph{explicitly}: +%^^A! \begin{itemize} +%^^A! \item \pkg{expl3}, \pkg{xparse}, \pkg{xtemplate} and +%^^A! \pkg{l3keys2e}, belong to \pkg{l3kernel} and +%^^A! \pkg{l3packages} bundles +%^^A! \item \cls{ctexbook}, belongs to \CTeX{} bundle +%^^A! \item \pkg{amsmath}, belongs to \AmSLaTeX{} bundle +%^^A! \item \pkg{unicode-math} +%^^A! \item \pkg{geometry} +%^^A! \item \pkg{fancyhdr} +%^^A! \item \pkg{footmisc} +%^^A! \item \pkg{ntheorem} +%^^A! \item \pkg{graphicx} +%^^A! \item \pkg{longtable} +%^^A! \item \pkg{caption} +%^^A! \item \pkg{xcolor} +%^^A! \item \pkg{hyperref} +%^^A! \end{itemize} +%^^A! \item When chosen \kvopt{style/footnote-style}{pifont}, +%^^A! package \pkg{pifont} will be loaded. It belongs to +%^^A! \pkg{psnfss} bundle. +%^^A! \item When chosen \kvopt{style/bib-backend}{bibtex}, +%^^A! package \pkg{natbib} will be loaded. Meanwhile, program +%^^A! \BibTeX{} will be required for compilation. The +%^^A! bibliography style is provided by \pkg{gbt7714}. +%^^A! \item When chosen \kvopt{style/bib-backend}{biblatex}, +%^^A! package \pkg{biblatex} will be loaded. Program \biber{} +%^^A! will be required then. The bibliography style is provided +%^^A! by \pkg{biblatex-gb7714-2015}. +%^^A! \end{itemize} +%^^A! +% +% 这里只列出了本模板直接调用的宏包。这些宏包自身的调用情况, +% 此处不再具体展开。如有需要,请参阅相关文档。 +%^^A! Only the packages loaded directly by \cls{fduthesis} are listed +%^^A! here. If you need to know the dependencies of the packages +%^^A! themselves, please refer to the corresponding manuals. +%^^A! +% +% \begin{thebibliography}{99} +% +% \newcommand\urlprefix{\newline\hspace*{\fill}} +% \let\OldUrl=\url +% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}} +% \newcommand\CTANurl[2][]{{\small\textit{#1}~\href{http://mirror.ctan.org/#2}^^A +% {\ttfamily CTAN://#2}}} +% +% \subsection{图书} +% +% \bibitem{knuth1986texbook} +% \textsc{Knuth D E}. +% \newblock \textit{The \TeX book: Computers \& Typesetting, volume A} [M]. +% \newblock Boston: Addison--Wesley Publishing Company, 1986 +% \urlprefix \CTANurl[源代码^^A +% \footnote{此代码只可作为学习之用。未经 Knuth 本人同意,您不应当编译此文档。}:]^^A +% {systems/knuth/dist/tex/texbook.tex} +% +% \bibitem{mittelbach2004latexcompanion} +% \textsc{Mittelbach F} and \textsc{Goossens M}. +% \newblock \textit{The \LaTeX{} Companion} [M]. +% \newblock 2nd ed. +% \newblock Boston: Addison--Wesley Publishing Company, 2004 +% +% \bibitem{胡伟2017latex2e} +% 胡伟. +% \newblock \textit{\LaTeXe{} 文类和宏包学习手册} [M]. +% \newblock 北京: 清华大学出版社, 2017 +% +% \bibitem{刘海洋2013latex入门} +% 刘海洋. +% \newblock \textit{\LaTeX{} 入门} [M]. +% \newblock 北京: 电子工业出版社, 2013 +% +% \subsection{标准、规范} +% +% \bibitem{gb-t-7713.1-2006} +% 国务院学位委员会办公室, 全国信息与文献标准化技术委员会. +% \newblock \textit{学位论文编写规则: GB/T 7713.1--2006} [S]. +% \newblock 北京: 中国标准出版社, 2007 +% +% \bibitem{gb-t-7714-2015} +% 全国信息与文献标准化技术委员会. +% \newblock \textit{信息与文献\quad 参考文献著录规则: GB/T 7714--2015} [S]. +% \newblock 北京: 中国标准出版社, 2015 +% +% \bibitem{gb-t-15834-2011} +% 教育部语言文字信息管理司. +% \newblock \textit{标点符号用法: GB/T 15834--2011} [S/OL]. +% \newblock 北京: 中国标准出版社, 2012 +% \urlprefix\url{http://www.moe.gov.cn/ewebeditor/uploadfile/2015/01/13/20150113091548267.pdf} +% +% \bibitem{clreq} +% W3C. +% \newblock \textit{中文排版需求(Requirements for Chinese Text Layout)} [EB/OL]. +% \newblock (2020-08-17) +% \urlprefix\url{https://w3c.github.io/clreq/} +% +% \bibitem{广东工业大学论文规范} +% 广东工业大学研究生院. +% \newblock \textit{广东工业大学研究生学位文撰写规范} [EB/OL]. +% \newblock 2014修订. +% \newblock (2019-09-05) +% \urlprefix\url{https://yjs.gdut.edu.cn/system/_content/download.jsp?urltype=news.DownloadAttachUrl&owner=1533825352&wbfileid=3799073} +% +% \bibitem{广东工业大学研究生手册} +% 广东工业大学研究生院. +% \newblock \textit{广东工业大学研究生手册} [EB/OL]. +% \newblock 2021年修订版. +% \newblock (2021-04-14) +% \urlprefix\url{https://yjs.gdut.edu.cn/system/_content/download.jsp?urltype=news.DownloadAttachUrl&owner=1533825352&wbfileid=5305942} +% +% \subsection{宏包、模版} +% +% \bibitem{source2e} +% \textsc{Braams J}, \textsc{Carlisle D}, \textsc{Jeffrey A}, et al. +% \newblock \textit{The \LaTeXe{} Sources} [CP/OL]. +% \newblock (2020-02-02) +% \urlprefix\url{https://ctan.org/pkg/latex} +% \urlprefix\CTANurl[源代码:]{macros/latex/base/source2e.pdf} +% +% \bibitem{CTeX} +% \textsc{CTEX.ORG}. +% \newblock \textit{\CTeX{} 宏集手册} [EB/OL]. +% \newblock version 2.5.4, +% \newblock (2020-08-23) +% \urlprefix\url{https://ctan.org/pkg/ctex} +% \urlprefix\CTANurl[文档及源代码:]{language/chinese/ctex/ctex.pdf} +% +% \bibitem{xeCJK} +% \textsc{CTEX.ORG}. +% \newblock \textit{\pkg{xeCJK} 宏包} [EB/OL]. +% \newblock version 3.8.5, +% \newblock (2020-08-23) +% \urlprefix\url{https://ctan.org/pkg/xecjk} +% \urlprefix\CTANurl[文档及源代码:]{macros/xetex/latex/xecjk/xeCJK.pdf} +% +% \bibitem{natbib} +% \textsc{Daly P W}. +% \newblock \textit{Natural Sciences Citations and References} [EB/OL]. +% \newblock version 8.31b, +% \newblock (2010-09-13) +% \urlprefix\url{https://ctan.org/pkg/natbib} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/natbib/natbib.pdf} +% +% \bibitem{source3} +% \textsc{The \LaTeX3 Project}. +% \newblock \textit{The \LaTeX3 Sources} [CP/OL]. +% \newblock (2020-08-07) +% \urlprefix\url{https://ctan.org/pkg/l3kernel} +% \urlprefix\CTANurl[源代码:]{macros/latex/contrib/l3kernel/source3.pdf} +% +% \bibitem{biblatex} +% \textsc{Lehman P}, \textsc{Kime P}, \textsc{Boruvka A}, et al. +% \newblock \textit{The \pkg{biblatex} Package} [EB/OL]. +% \newblock version 3.15a, +% \newblock (2020-08-23) +% \urlprefix\url{https://ctan.org/pkg/biblatex} +% \urlprefix\CTANurl[文档:]{macros/latex/contrib/biblatex/doc/biblatex.pdf} +% +% \bibitem{lshort} +% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. +% \newblock \textit{The Not So Short Introduction to \LaTeXe{}: Or \LaTeXe{} in 139 minutes} [EB/OL]. +% \newblock version 6.2, +% \newblock (2018-02-28) +% \urlprefix\url{https://ctan.org/pkg/lshort-english} +% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf} +% +% \bibitem{lshort-zh-cn} +% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. +% \newblock \textit{一份(不太)简短的 \LaTeXe{} 介绍: 或 112 分钟了解 \LaTeXe{}} [EB/OL]. +% \newblock \CTeX{} 开发小组, 译. +% \newblock 原版版本 version 6.2, 中文版本 version 6.02, +% \newblock (2020-08-03) +% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn} +% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf} +% +% \bibitem{biblatex-gb7714-2015} +% 胡振震. +% \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL]. +% \newblock version 1.0v, +% \newblock (2020-07-21) +% \urlprefix\url{https://ctan.org/pkg/biblatex-gb7714-2015} +% \urlprefix\CTANurl[文档:]{biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf} +% +% \bibitem{gbt7714} +% 李泽平(\textsc{Zeping L}). +% \newblock \textit{GB/T 7714-2015 \BibTeX{} Style} [EB/OL]. +% \newblock version 2.0.2, +% \newblock (2020-06-08) +% \urlprefix\url{https://ctan.org/pkg/gbt7714} +% \urlprefix\CTANurl[文档:]{biblio/bibtex/contrib/gbt7714/gbt7714.pdf} +% +% \bibitem{cquthesis} +% 李振楠. +% \newblock \textit{\textsc{CquThesis}:重庆大学毕业论文 \LaTeX{} 模板} [EB/OL]. +% \newblock version 1.50, +% \newblock (2020-06-23) +% \urlprefix\url{https://ctan.org/pkg/cquthesis} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/cquthesis/cquthesis.pdf} +% +% \bibitem{thuthesis} +% 清华大学 TUNA 协会. +% \newblock \textit{\textsc{ThuThesis}:清华大学学位论文模板} [EB/OL]. +% \newblock version 6.1.3, +% \newblock (2020-07-09) +% \urlprefix\url{https://ctan.org/pkg/thuthesis} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/thuthesis/thuthesis.pdf} +% +% \bibitem{fduthesis} +% 曾祥东. +% \newblock \textit{\pkg{fduthesis}:复旦大学论文模板} [EB/OL]. +% \newblock version 0.7e, +% \newblock (2021-05-20) +% \urlprefix\url{https://ctan.org/pkg/fduthesis} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/fduthesis/fduthesis-code.pdf} +% +% \emph{以下模版未收录至 CTAN,但仍然保持活跃更新。} +% +% \bibitem{sjtuthesis} +% \textsc{SJTUG}. +% \newblock \textit{上海交通大学学位论文模板} [EB/OL]. +% \newblock version 1.0.0rc7, +% \newblock (2020-07-31) +% \urlprefix\url{https://github.com/sjtug/SJTUThesis} +% \urlprefix\url[源代码仓库:]{https://github.com/sjtug/SJTUTeX} +% +% \bibitem{ustcthesis} +% \textsc{USTC \TeX{} User Group}. +% \newblock \textit{中国科学技术大学学位论文 \LaTeX{} 模板} [EB/OL]. +% \newblock version 3.2.1, +% \newblock (2020-04-03) +% \urlprefix\url{https://github.com/ustctug/ustcthesis} +% +% \bibitem{ucasthesis} +% \textsc{mohuangrui}. +% \newblock \textit{\pkg{ucasthesis} 国科大学位论文 \LaTeX{} 模板} [EB/OL]. +% \newblock (2020-07-28) +% \urlprefix\url{https://github.com/mohuangrui/ucasthesis} +% +% \emph{以下模版现已停止更新。} +% +% \bibitem{jokerdawn2019GDUTThesis} +% \textsc{jokerdawn}. +% \newblock \textit{GDUTThesis} [EB/OL]. +% \newblock (2019-02-19) +% \urlprefix\url{https://github.com/jokerdawn/GDUTThesis} +% +% \bibitem{Nick-Hopps2020gdutart} +% \textsc{Nick-Hopps}. +% \newblock \textit{广东工业大学毕业设计/论文LaTeX模板} [EB/OL]. +% \newblock (2020-03-10) +% \urlprefix\url{https://github.com/Nick-Hopps/gdutart} +% +% \bibitem{ElunDai2019gdutthesis} +% \textsc{ElunDai}. +% \newblock \textit{广东工业大学LaTeX论文模板项目(非官方)} [EB/OL]. +% \newblock (2019-06-27) +% \urlprefix\url{https://github.com/ElunDai/gdutthesis} +% +% \bibitem{Gnomeek2020UndergraduateThesis} +% Gnomeek. +% \newblock \textit{Latex/Word Template for GDUT Undergraduate Students' Thesis(广东工业大学本科毕业论文LaTex/Word模板)} [EB/OL]. +% \newblock (2020-06-15) +% \urlprefix\url{https://github.com/Gnomeek/GDUT-UndergraduateThesis} +% +% \subsection{其他} +% +% \bibitem{wright2009dtxfile} +% \textsc{Wright J}. +% \newblock \textit{A model dtx file} [EB/OL]. +% \newblock (2009-10-06) +% \urlprefix\url{https://www.texdev.net/2009/10/06/a-model-dtx-file/} +% +% \bibitem{孔雀计划} +% 刘庆(\textsc{Eric Q L}). +% \newblock \textit{孔雀计划:中文字体排印的思路} [EB/OL]. +% \urlprefix\url{https://thetype.com/kongque/} +% +% \end{thebibliography} +% +% \clearpage +% +%^^A! \end{document} +% +% \end{documentation} +% +% \begin{implementation} +% +%^^A 代码部分的页边距 +% \newgeometry{ +% left = 2.25 in, +% right = 1.00 in, +% top = 1.25 in, +% bottom = 1.00 in, +% marginpar = 2.25 in +% } +% +% \section{实现细节} +% +% 本模板使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境, +% 并需调用 \pkg{l3packages} 中的相关宏包。 +% +% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符完全忽略, +% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。 +% 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”, +% 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。 +% +% 以下代码中有一些形如 \textcolor[HTML]{2E3191}{\textsf{<*class>}} +% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。 +% “\textsf{*}”和“\textsf{/}”分别表示该部分的开始和结束。不含 +% “\textsf{*}”和“\textsf{/}”的 guard 出现在行号右侧,它们用来确定 +% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。 +% +% 另有若干形如 \textcolor{MaterialPink}{\textsf{<@@=fdu>}} 的 guard, +% 它们由 \pkg{l3docstrip} 定义,用来指示名字空间(模块)。 +% +% \subsection{准备} +% +% \begin{macrocode} +%<@@=fdu> +%<*class|class-en> +% \end{macrocode} +% +% 检查 \LaTeX3 编程环境。 +% \begin{macrocode} +\RequirePackage { xparse, xtemplate, l3keys2e } +\clist_map_inline:nn { expl3, xparse, xtemplate, l3keys2e } + { + \@ifpackagelater {#1} { 2018/05/12 } + { } { \msg_error:nnn { fduthesis } { l3-too-old } {#1} } + } +\msg_new:nnn { fduthesis } { l3-too-old } + { + Package~ "#1"~ is~ too~ old. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ the~ bundles \\ + "l3kernel"~ and~ "l3packages"~ using~ your~ TeX~ package \\ + manager~ or~ from~ CTAN. + } +% \end{macrocode} +% +% 目前 \cls{fduthesis} 仅支持 \XeTeX{} 和 \LuaTeX{}。 +% \begin{macrocode} +\sys_if_engine_xetex:F + { + \sys_if_engine_luatex:F + { + \msg_fatal:nnx { fduthesis } { unsupported-engine } + { \c_sys_engine_str } + } + } +\msg_new:nnn { fduthesis } { unsupported-engine } + { + The~ fduthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\\\ + "#1"~ is~ not~ supported~ at~ present.~ You~ must~ change \\ + your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". + } +% \end{macrocode} +% +% \subsubsection{内部变量声明} +% +% \begin{variable}{\l_@@_tmpa_box, +% \l_@@_tmpa_clist,\l_@@_tmpb_clist, +% \l_@@_tmpa_dim,\l_@@_tmpb_dim, +% \l_@@_tmpa_skip, +% \l_@@_tmpa_tl,\l_@@_tmpb_tl} +% 临时变量。 +% \begin{macrocode} +\box_new:N \l_@@_tmpa_box +\clist_new:N \l_@@_tmpa_clist +\clist_new:N \l_@@_tmpb_clist +\dim_new:N \l_@@_tmpa_dim +\dim_new:N \l_@@_tmpb_dim +\skip_new:N \l_@@_tmpa_skip +\tl_new:N \l_@@_tmpa_tl +\tl_new:N \l_@@_tmpb_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_thesis_type_int} +% 论文类型。取值 1、2、3 分别对应博士、硕士、本科(学士),这与学号 +% 第三位是一致的。 +% \begin{macrocode} +\int_new:N \g_@@_thesis_type_int +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_to_ctexbook_clist,\g_@@_to_hyperref_clist} +% 分别保存由 \cls{fduthesis} 传入 \cls{ctexbook} 文档类和 +% \pkg{hyperref} 宏包的选项列表。 +% \begin{macrocode} +\clist_new:N \g_@@_to_ctexbook_clist +\clist_new:N \g_@@_to_hyperref_clist +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_twoside_bool} +% 是否开启双页模式(默认打开)。 +% \begin{macrocode} +\bool_new:N \g_@@_twoside_bool +\bool_set_true:N \g_@@_twoside_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_draft_bool} +% 是否开启草稿模式。 +% \begin{macrocode} +\bool_new:N \g_@@_draft_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_config_tl} +% 保存配置文件名称。默认为空。 +% \begin{macrocode} +\tl_new:N \g_@@_config_tl +% \end{macrocode} +% \end{variable} +% +% \subsubsection{内部函数} +% +% \begin{macro}{\cs_generate_variant:cn, +% \file_input:V, +% \int_to_arabic:v, +% \keys_define:nx, +% \tl_map_inline:xn} +% \begin{macro}[TF]{\tl_if_eq:Vn} +% \LaTeX3{} 函数变体。 +% \begin{macrocode} +\cs_generate_variant:Nn \cs_generate_variant:Nn { cn } +\cs_generate_variant:Nn \file_input:n { V } +\cs_generate_variant:Nn \int_to_arabic:n { v } +\cs_generate_variant:Nn \keys_define:nn { nx } +\cs_generate_variant:Nn \tl_map_inline:nn { xn } +\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { Vn } { T, TF } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_quad:,\@@_qquad:} +% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。 +% \begin{macrocode} +\cs_new:Npn \@@_quad: { \skip_horizontal:n { 1 em } } +\cs_new:Npn \@@_qquad: { \skip_horizontal:n { 2 em } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_vspace:N,\@@_vspace:n,\@@_vspace:c} +% 类似 \LaTeXe{} 中的 \tn{vspace*}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_vspace:N #1 + { + \dim_set_eq:NN \l_@@_tmpa_dim \prevdepth + \hrule height \c_zero_dim + \nobreak + \skip_vertical:N #1 + \skip_vertical:N \c_zero_skip + \dim_set_eq:NN \prevdepth \l_@@_tmpa_dim + } +\cs_new_protected:Npn \@@_vspace:n #1 + { + \skip_set:Nn \l_@@_tmpa_skip {#1} + \@@_vspace:N \l_@@_tmpa_skip + } +\cs_generate_variant:Nn \@@_vspace:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_symbol:n} +% 等价于 \LaTeXe{} 中的 \tn{symbol}。 +% \begin{macrocode} +\cs_new:Npn \@@_symbol:n #1 { \tex_char:D #1 \scan_stop: } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_arabic:n} +% 等价于 \LaTeXe{} 中的 \tn{arabic}。 +% \begin{macrocode} +\cs_new:Npn \@@_arabic:n #1 + { \int_to_arabic:v { c@ #1 } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_patch_cmd:Nnn,\@@_appto_cmd:Nn} +% 补丁工具,来自 \pkg{ctexpatch} 宏包。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_patch_cmd:Nnn #1#2#3 + { + \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \@@_appto_cmd:Nn #1#2 + { + \ctex_appto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_define_fn_style:nn, +% \@@_define_punct:nn, +% \@@_define_sep:nn, +% \@@_define_format:nn, +% \@@_define_name:nn, +% \@@_define_name:nnn} +% 用来定义脚注样式、标点、默认名称的辅助函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_define_fn_style:nn #1#2 + { \tl_const:cn { c_@@_fn_style_ #1 _tl } {#2} } +\cs_new_protected:Npn \@@_define_punct:nn #1#2 + { \tl_const:cn { c_@@_ #1 _tl } { \@@_symbol:n {#2} } } +% \cs_new_protected:Npn \@@_define_sep:nn #1#2 +% { \tl_const:cn { c_@@_ #1 _sep_tl } {#2} } +% \cs_new_protected:Npn \@@_define_format:nn #1#2 +% { \tl_const:cn { c_@@_ #1 _format_tl } {#2} } +\cs_new_protected:Npn \@@_define_name:nn #1#2 + { \tl_const:cn { c_@@_name_ #1 _tl } {#2} } +\cs_new_protected:Npn \@@_define_name:nnn #1#2#3 + { + \tl_const:cn { c_@@_name_ #1 _tl } {#2} + \tl_const:cn { c_@@_name_ #1 _en_tl } {#3} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_msg_new:nn, +% \@@_error:n,\@@_error:nn,\@@_error:nx,\@@_error:nnn, +% \@@_warning:n,\@@_warning:nn,\@@_warning:nxx, +% \@@_info:nx} +% 各种信息函数的缩略形式。 +% \begin{macrocode} +\cs_new:Npn \@@_msg_new:nn { \msg_new:nnn { fduthesis } } +\cs_new:Npn \@@_error:n { \msg_error:nn { fduthesis } } +\cs_new:Npn \@@_error:nn { \msg_error:nnn { fduthesis } } +\cs_new:Npn \@@_error:nx { \msg_error:nnx { fduthesis } } +\cs_new:Npn \@@_error:nnn { \msg_error:nnnn { fduthesis } } +\cs_new:Npn \@@_warning:n { \msg_warning:nn { fduthesis } } +\cs_new:Npn \@@_warning:nn { \msg_warning:nnn { fduthesis } } +\cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx { fduthesis } } +\cs_new:Npn \@@_info:nx { \msg_info:nnx { fduthesis } } +% \end{macrocode} +% \end{macro} +% +% \subsection{选项处理} +% +% 定义 |fdu/option| 键值类。 +% \begin{macrocode} +\keys_define:nn { fdu / option } + { +% \end{macrocode} +% +% \changes{v0.7}{2018/02/01}{新增 \opt{type} 选项。} +% +% \begin{macro}{type} +% 设置论文类型。设为模板选项主要是为了以后的兼容性。论文类型可能会 +% 影响很多设置,只是暂时还不考虑。默认为本科毕业论文。 +% \begin{macrocode} + type .choice:, + type .value_required:n = true, + type .choices:nn = + { doctor, master, bachelor } + { \int_set_eq:NN \g_@@_thesis_type_int \l_keys_choice_int }, + type .initial:n = bachelor, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{oneside,twoside} +% 设置页面类型为单面或双面。 +% \begin{macrocode} + oneside .value_forbidden:n = true, + twoside .value_forbidden:n = true, + oneside .code:n = + { + \clist_gput_right:Nn \g_@@_to_ctexbook_clist { oneside } + \bool_set_false:N \g_@@_twoside_bool + }, + twoside .code:n = + { + \clist_gput_right:Nn \g_@@_to_ctexbook_clist { twoside } + \bool_set_true:N \g_@@_twoside_bool + }, +% \end{macrocode} +% \end{macro} +% +% \changes{v0.5}{2017/09/23}{移除 \opt{nofonts} 选项。} +% +% \begin{macro}{draft} +% 是否开启草稿模式(默认关闭)。 +% \begin{macrocode} + draft .choice:, + draft / true .code:n = + { + \bool_set_true:N \g_@@_draft_bool + \clist_gput_right:Nn \g_@@_to_ctexbook_clist { draft } + }, + draft / false .code:n = + { \bool_set_false:N \g_@@_draft_bool }, + draft .default:n = true, + draft .initial:n = false, +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7}{2018/01/31}{新增 \opt{config} 选项。} +% +% \begin{macro}{config} +% 配置文件名。 +% \begin{macrocode} + config .tl_set:N = \g_@@_config_tl, +% \end{macrocode} +% \end{macro} +% +% 处理未知选项。 +% \begin{macrocode} + unknown .code:n = { \@@_error:n { unknown-option } } + } +\@@_msg_new:nn { unknown-option } + { Class~ option~ "\l_keys_key_tl"~ is~ unknown. } +% \end{macrocode} +% +% 将文档类选项传给 |fdu/option|。 +% \begin{macrocode} +\ProcessKeysOptions { fdu / option } +% \end{macrocode} +% +% 载入参数配置文件。 +% \begin{macrocode} +\file_input:n { fduthesis.def } +\tl_if_empty:NF \g_@@_config_tl + { + \file_input:V \g_@@_config_tl + \@@_info:nx { load-config-file } { \g_@@_config_tl } + } +\@@_msg_new:nn { load-config-file } + { You~ are~ loading~ config~ file~ '#1'. } +% \end{macrocode} +% +% \subsection{载入宏包、文档类} +% +% \changes{v0.7}{2018/01/19}{使用 \cls{ctexbook} 文档类,而非直接使用 +% 标准文档类 \cls{book}。} +% +% 将选项传入 \cls{ctexbook} 文档类。 +% \begin{macrocode} +% TODO: (2017-07-22) Chinese fonts in fduthesis-en +\PassOptionsToClass + { + UTF8, +% scheme = plain, + heading = true, +% fontset = none, +% fontset = fandol, + zihao = -4, +% linespread = \c_@@_line_spread_fp, + \g_@@_to_ctexbook_clist + } + { ctexbook } +% \end{macrocode} +% +% 传入各宏包选项。 +% \begin{macrocode} +\clist_map_inline:nn + { + { no-math } { fontspec }, + { perpage } { footmisc }, + { amsmath, thmmarks } { ntheorem } + } + { \PassOptionsToPackage #1 } +% \end{macrocode} +% +% 本模板会在 \pkg{ctexhook} 提供的钩子 \cs{ctex_at_end_preamble:n} +% 中调用 \pkg{biblatex},而 \pkg{biblatex} 自身又会使用 \pkg{etoolbox} +% 的钩子 \tn{AtEndPreamble},因此需要在载入 \cls{ctexbook} 之前调用 +% \pkg{etoolbox}。钩子的顺序为: +% \[ \text{\tn{CTEX@document@left@hook}} +% \prec \text{\tn{@endpreamblehook}} +% \prec \text{\texttt{\textbackslash begin\{document\}}}. \] +% \begin{macrocode} +\RequirePackage { etoolbox } +% \end{macrocode} +% +% 载入 \cls{ctexbook} 文档类。 +% 在使用 \XeLaTeX{} 编译时,\cls{ctexbook} 的底层将调用 \pkg{xeCJK} +% 宏包;而在使用 \LuaLaTeX{} 编译时,则将调用 \pkg{LuaTeX-ja} 宏包。 +% 两种情况下 \cls{ctexbook} 均会调用 \pkg{fontspec} 宏包。 +% \begin{macrocode} +\LoadClass { ctexbook } +% \end{macrocode} +% +% \changes{v0.4}{2017/08/13}{提供彩色支持。} +% +% 载入各宏包。其中,\pkg{amsmath} 必须在 \pkg{unicode-math} 之前引入。 +% \begin{macrocode} +\RequirePackage + { + amsmath, + unicode-math, + geometry, + fancyhdr, + footmisc, + ntheorem, + graphicx, + longtable, + caption, + xcolor + } +% \end{macrocode} +% +% \begin{macro}{\@@_check_package:nnn} +% 检查过时宏包。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_check_package:nnn #1#2#3 + { + \@ifpackagelater {#1} {#2} + { } { \@@_error:nnn { package-too-old } {#1} {#3} } + } +\@@_msg_new:nn { package-too-old } + { + Package~ "#1"~ is~ too~ old. \\ + The~ fduthesis~ class~ only~ supports~ "#1"~ with~ a~ version \\ + higher~ than~ v#2. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your \\ + TeX~ package~ manager~ or~ from~ CTAN. + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\@@_check_package:nnn { ctex } { 2017/08/07 } { 2.4.10 } +\@@_check_package:nnn { fontspec } { 2017/09/22 } { 2.6e } +\@@_check_package:nnn { unicode-math } { 2017/11/18 } { 0.8i } +\sys_if_engine_xetex:T + { \@@_check_package:nnn { xeCJK } { 2017/08/07 } { 3.5.0 } } +\sys_if_engine_luatex:T + { \@@_check_package:nnn { xunicode-addon } { 2018/04/30 } { 3.7.1 } } +% \end{macrocode} +% +% \subsection{页面布局} +% +% 利用 \pkg{geometry} 宏包设置纸张大小、页面边距以及页眉高度。这里, +% $\SI{2.54}{\centi\meter}=\SI{1}{in}$, +% $\SI{3.18}{\centi\meter}=\SI{1.25}{in}$。 +% \begin{macrocode} +\geometry + { + paper = a4paper, + vmargin = 2.54 cm, + hmargin = 3.18 cm, + headheight = 15 pt + } +% \end{macrocode} +% +% 草稿模式下显示页面边框及页眉、页脚线 。 +% \begin{macrocode} +\bool_if:NT \g_@@_draft_bool { \geometry { showframe } } +% \end{macrocode} +% +% \subsection{字体} +% +% \subsubsection{预定义字体配置} +% +% \changes{v0.7c}{2019/03/05}{重构字体配置,并兼容 macOS。} +% +% \begin{variable}{\g_@@_fontset_tl, \g_@@_cjk_fontset_tl} +% 存放字体选项值。 +% \begin{macrocode} +\tl_new:N \g_@@_fontset_tl +%\tl_new:N \g_@@_cjk_fontset_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{style/font} +% \changes{v0.7c}{2019/03/05}{新增 \opt{garamond} 和 \opt{times*} 样式。} +% 预定义西文字体。 +% \begin{macrocode} +\keys_define:nn { fdu / style } + { + font .choices:nn = + { garamond, libertinus, lm, palatino, times, times*, none } + { \tl_set_eq:NN \g_@@_fontset_tl \l_keys_choice_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{style/cjk-font} +% \changes{v0.7c}{2019/03/05}{新增 \opt{sinotype} 和 \opt{sourcehan} 样式。} +% 预定义中文字体。 +% \begin{macrocode} +%<*class> +\keys_define:nn { fdu / style } + { + cjk-font .choices:nn = + { adobe, fandol, founder, mac, sinotype, sourcehan, windows, none } + { \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl } + } +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{ +% \@@_setmainfont:nn, +% \@@_setsansfont:nn, +% \@@_setmonofont:nn, +% \@@_setmathfont:nn} +% 用于设置西文字体的辅助函数,来源于 \pkg{fontspec} 和 \pkg{unicode-math}。 +% \begin{arguments} +% \item 字体名 +% \item 选项 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_setmainfont:nn #1#2 + { \__fontspec_main_setmainfont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setsansfont:nn #1#2 + { \__fontspec_main_setsansfont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setmonofont:nn #1#2 + { \__fontspec_main_setmonofont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setmathfont:nn #1#2 + { \__um_setmathfont:nn {#2} {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \@@_setCJKmainfont:nn, +% \@@_setCJKsansfont:nn, +% \@@_setCJKmonofont:nn} +% 用于设置中文字体的辅助函数,来源于 \pkg{xeCJK} 和 \pkg{ctex} 宏包。 +% \begin{macrocode} +%<*class> +\cs_new_protected:Npn \@@_setCJKmainfont:nn #1#2 + { \@@_set_family:nnn { \CJKrmdefault } {#2} {#1} } +\cs_new_protected:Npn \@@_setCJKsansfont:nn #1#2 + { \@@_set_family:nnn { \CJKsfdefault } {#2} {#1} } +\cs_new_protected:Npn \@@_setCJKmonofont:nn #1#2 + { \@@_set_family:nnn { \CJKttdefault } {#2} {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_cjk_font_kai:nn,\fdu@kai} +% 楷体需要单独设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_cjk_font_kai:nn #1#2 + { \@@_set_family:nnn { fdu@kai } {#2} {#1} } +\cs_new_protected:Npn \fdu@kai + { \@@_switch_family:n { fdu@kai } } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7d}{2019/03/29}{在字体未提供对应粗体的情况下,允许使用伪粗。} +% +% \begin{macro}{ +% \@@_cjk_font_options:, +% \@@_setCJKmainfont:n, +% \@@_setCJKsansfont:n, +% \@@_setCJKmonofont:n, +% \@@_set_cjk_font_kai:n} +% 将 bold、italic 和 bold italic 统一按照 roman 设置。 +% \begin{macrocode} +\tl_const:Nn \@@_cjk_font_options: + { UprightFont = *, ItalicFont = *, AutoFakeBold = true } +\cs_new_protected:Npx \@@_setCJKmainfont:n #1 + { \@@_setCJKmainfont:nn {#1} { \@@_cjk_font_options: } } +\cs_new_protected:Npx \@@_setCJKsansfont:n #1 + { \@@_setCJKsansfont:nn {#1} { \@@_cjk_font_options: } } +\cs_new_protected:Npx \@@_setCJKmonofont:n #1 + { \@@_setCJKmonofont:nn {#1} { \@@_cjk_font_options: } } +\cs_new_protected:Npx \@@_set_cjk_font_kai:n #1 + { \@@_set_cjk_font_kai:nn {#1} { \@@_cjk_font_options: } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_family:nnn,\@@_switch_family:n} +% 封装 CJK 字体族的设定和切换命令。 +% \begin{macrocode} +\sys_if_engine_xetex:TF + { + \cs_new_eq:NN \@@_set_family:nnn \xeCJK_set_family:nnn + \cs_new_eq:NN \@@_switch_family:n \xeCJK_switch_family:n + } + { + \cs_new_eq:NN \@@_set_family:nnn \ctex_ltj_set_family:nnn + \cs_new_eq:NN \@@_switch_family:n \ctex_ltj_switch_family:n + } +% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \setmainfont, +% \setsansfont, +% \setmonofont, +% \setmathfont, +% \setCJKmainfont, +% \setCJKsansfont, +% \setCJKmonofont, +% \@@_set_font:n} +% 重新定义以上宏包提供的字体选择命令。我们把它放在导言区末尾,使得用户配置不被 +% 模板配置覆盖。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_font_helper:n #1 + { + \exp_args:Nc \RenewDocumentCommand { set #1 font } { O { } m O { } } + { + \ctex_at_end_preamble:n + { \use:c { @@_set #1 font:nn } {##2} { ##1, ##3 } } + } + } +\clist_map_inline:nn { main, sans, mono, math } { \@@_set_font_helper:n {#1} } +%\clist_map_inline:nn { CJKmain, CJKsans, CJKmono } { \@@_set_font_helper:n {#1} } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7e}{2019/04/10}{兼容 Libertinus 和 XITS 字体的文件名变动。} +% \begin{macro}{ +% \g_@@_font_family_libertinus_serif_tl, +% \g_@@_font_family_libertinus_sans_tl, +% \g_@@_font_style_libertinus_rm_tl, +% \g_@@_font_style_libertinus_bf_tl, +% \g_@@_font_style_libertinus_it_tl, +% \g_@@_font_style_libertinus_bfit_tl, +% \g_@@_font_style_libertinus_bfsl_tl, +% \g_@@_font_family_xits_tl, +% \g_@@_font_style_xits_rm_tl, +% \g_@@_font_style_xits_bf_tl, +% \g_@@_font_style_xits_it_tl, +% \g_@@_font_style_xits_bfit_tl, +% \g_@@_font_name_libertinus_serif_tl, +% \g_@@_font_name_libertinus_sans_tl, +% \g_@@_font_name_libertinus_math_tl, +% \g_@@_font_name_xits_tl, +% \g_@@_font_name_xits_math_rm_tl, +% \g_@@_font_name_xits_math_bf_tl} +% Libertinus 和 XITS 字体的文件名做过变动,需要特殊处理。 +% \begin{macrocode} +\tl_new:N \g_@@_font_family_libertinus_serif_tl +\tl_new:N \g_@@_font_family_libertinus_sans_tl +\tl_new:N \g_@@_font_style_libertinus_rm_tl +\tl_new:N \g_@@_font_style_libertinus_bf_tl +\tl_new:N \g_@@_font_style_libertinus_it_tl +\tl_new:N \g_@@_font_style_libertinus_bfit_tl +\tl_new:N \g_@@_font_style_libertinus_bfsl_tl +\tl_new:N \g_@@_font_family_xits_tl +\tl_new:N \g_@@_font_style_xits_rm_tl +\tl_new:N \g_@@_font_style_xits_bf_tl +\tl_new:N \g_@@_font_style_xits_it_tl +\tl_new:N \g_@@_font_style_xits_bfit_tl +\tl_new:N \g_@@_font_name_libertinus_serif_tl +\tl_new:N \g_@@_font_name_libertinus_sans_tl +\tl_new:N \g_@@_font_name_libertinus_math_tl +\tl_new:N \g_@@_font_name_xits_tl +\tl_new:N \g_@@_font_name_xits_math_rm_tl +\tl_new:N \g_@@_font_name_xits_math_bf_tl +\fontspec_font_if_exist:nTF { LibertinusSerif-Regular.otf } + { + \tl_set:Nn \g_@@_font_family_libertinus_serif_tl { LibertinusSerif } + \tl_set:Nn \g_@@_font_family_libertinus_sans_tl { LibertinusSans } + \tl_set:Nn \g_@@_font_family_libertinus_math_tl { LibertinusMath } + \tl_set:Nn \g_@@_font_style_libertinus_rm_tl { Regular } + \tl_set:Nn \g_@@_font_style_libertinus_bf_tl { Bold } + \tl_set:Nn \g_@@_font_style_libertinus_it_tl { Italic } + \tl_set:Nn \g_@@_font_style_libertinus_bfit_tl { BoldItalic } + \tl_set:Nn \g_@@_font_style_libertinus_bfsl_tl { BoldOblique } + } + { + \tl_set:Nn \g_@@_font_family_libertinus_serif_tl { libertinusserif } + \tl_set:Nn \g_@@_font_family_libertinus_sans_tl { libertinussans } + \tl_set:Nn \g_@@_font_family_libertinus_math_tl { libertinusmath } + \tl_set:Nn \g_@@_font_style_libertinus_rm_tl { regular } + \tl_set:Nn \g_@@_font_style_libertinus_bf_tl { bold } + \tl_set:Nn \g_@@_font_style_libertinus_it_tl { italic } + \tl_set:Nn \g_@@_font_style_libertinus_bfit_tl { bolditalic } + \tl_set:Nn \g_@@_font_style_libertinus_bfsl_tl { bolditalic } + } +\fontspec_font_if_exist:nTF { XITS-Regular.otf } + { + \tl_set:Nn \g_@@_font_family_xits_tl { XITS } + \tl_set:Nn \g_@@_font_style_xits_rm_tl { Regular } + \tl_set:Nn \g_@@_font_style_xits_bf_tl { Bold } + \tl_set:Nn \g_@@_font_style_xits_it_tl { Italic } + \tl_set:Nn \g_@@_font_style_xits_bfit_tl { BoldItalic } + \tl_set:Nn \g_@@_font_name_xits_math_rm_tl { XITSMath-Regular } + \tl_set:Nn \g_@@_font_name_xits_math_bf_tl { XITSMath-Bold } + } + { + \tl_set:Nn \g_@@_font_family_xits_tl { xits } + \tl_set:Nn \g_@@_font_style_xits_rm_tl { regular } + \tl_set:Nn \g_@@_font_style_xits_bf_tl { bold } + \tl_set:Nn \g_@@_font_style_xits_it_tl { italic } + \tl_set:Nn \g_@@_font_style_xits_bfit_tl { bolditalic } + \tl_set:Nn \g_@@_font_name_xits_math_rm_tl { xits-math } + \tl_set:Nn \g_@@_font_name_xits_math_bf_tl { xits-mathbold } + } +\tl_set:Nx \g_@@_font_name_libertinus_serif_tl + { \g_@@_font_family_libertinus_serif_tl - \g_@@_font_style_libertinus_rm_tl } +\tl_set:Nx \g_@@_font_name_libertinus_sans_tl + { \g_@@_font_family_libertinus_sans_tl - \g_@@_font_style_libertinus_rm_tl } +\tl_set:Nx \g_@@_font_name_libertinus_math_tl + { \g_@@_font_family_libertinus_math_tl - \g_@@_font_style_libertinus_rm_tl } +\tl_set:Nx \g_@@_font_name_xits_tl + { \g_@@_font_family_xits_tl - \g_@@_font_style_xits_rm_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_garamond:} +% EB Garamond 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_garamond: + { + \@@_setmainfont:nn { EBGaramond } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic + } + \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { Garamond-Math.otf } { } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_libertinus:} +% Libertinus 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_libertinus: + { + \@@_setmainfont:nn { \g_@@_font_family_libertinus_serif_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfit_tl + } + \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { \g_@@_font_name_libertinus_math_tl .otf } { } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_lm:} +% Latin Modern 系列。在 \XeLaTeX{} 和 \LuaLaTeX{} 中已作为默认字体,所以仅需 +% 额外处理数学部分。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_lm: + { \@@_setmathfont:nn { latinmodern-math.otf } { } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_palatino:} +% Palatino 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_palatino: + { + \@@_setmainfont:nn { texgyrepagella } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl, + Scale = MatchUppercase + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { texgyrepagella-math.otf } { } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_times:} +% Times 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_times: + { + \@@_setmainfont:nn { \g_@@_font_family_xits_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_xits_rm_tl, + BoldFont = *-\g_@@_font_style_xits_bf_tl, + ItalicFont = *-\g_@@_font_style_xits_it_tl, + BoldItalicFont = *-\g_@@_font_style_xits_bfit_tl + } + \@@_setsansfont:nn { texgyreheros } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \@@_setmonofont:nn { texgyrecursor } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Ligatures = CommonOff + } + \@@_setmathfont:nn { \g_@@_font_name_xits_math_rm_tl .otf } + { BoldFont = \g_@@_font_name_xits_math_bf_tl .otf } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_times*:} +% Times* 系列,除数学部分外采用系统字体。 +% \begin{macrocode} +\cs_new_protected:cpn { @@_load_font_ times* : } + { + \@@_setmainfont:nn { Times~ New~ Roman } { } + \@@_setsansfont:nn { Arial } { } + \@@_setmonofont:nn { Courier~ New } { } + \@@_setmathfont:nn { \g_@@_font_name_xits_math_rm_tl .otf } + { BoldFont = \g_@@_font_name_xits_math_bf_tl .otf } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_adobe:} +% Adobe 字库。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_adobe: + { + \@@_setCJKmainfont:n { AdobeSongStd-Light } + \@@_setCJKsansfont:n { AdobeHeitiStd-Regular } + \@@_setCJKmonofont:n { AdobeFangsongStd-Regular } + \@@_set_cjk_font_kai:n { AdobeKaitiStd-Regular } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_fandol:} +% Fandol 字库。注意它是安装在 TeX 发行版中的,所以使用文件名调用。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_fandol: + { + \@@_setCJKmainfont:nn { FandolSong } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { FandolHei } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKmonofont:nn { FandolFang } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + \@@_set_cjk_font_kai:nn { FandolKai } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_founder:} +% 方正字库。虽然有粗体(方正小标宋)等,但并非免费,故这里不做处理。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_founder: + { + \@@_setCJKmainfont:n { FZShuSong-Z01 } + \@@_setCJKsansfont:n { FZHei-B01 } + \@@_setCJKmonofont:n { FZFangSong-Z02 } + \@@_set_cjk_font_kai:n { FZKai-Z03 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_mac:} +% macOS 自带中文字体。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_mac: + { + \@@_setCJKmainfont:nn { STSongti-SC } + { + UprightFont = *-Light, + BoldFont = *-Bold, + ItalicFont = *-Light, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { STHeitiSC } + { + UprightFont = *-Medium, + BoldFont = *-Medium, + ItalicFont = *-Medium, + BoldItalicFont = *-Medium + } + \@@_setCJKmonofont:n { STFangsong } + \@@_set_cjk_font_kai:nn { STKaitiSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_sinotype:} +% 华文字库。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_sinotype: + { + \@@_setCJKmainfont:n { STSong } + \@@_setCJKsansfont:n { STHeiti } + \@@_setCJKmonofont:n { STFangsong } + \@@_set_cjk_font_kai:n { STKaiti } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_sourcehan:} +% 思源宋体、思源黑体。由于没有对应的楷体和仿宋,这里直接给出警告。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_sourcehan: + { + \@@_setCJKmainfont:nn { SourceHanSerifSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { SourceHanSansSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_warning:n { source-han } + } +\@@_msg_new:nn { source-han } + { Font~ set~ `sourcehan'~ does~ not~ contain~ kaiti~ and~ fangsong. } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_windows:} +% Windows 自带中文字体。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_windows: + { + \@@_setCJKmainfont:n { SimSun } + \@@_setCJKsansfont:n { SimHei } + \@@_setCJKmonofont:n { FangSong } + \@@_set_cjk_font_kai:n { KaiTi } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font:} +% 字体加载命令。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font: + { + \use:c { @@_load_font_ \g_@@_fontset_tl : } +% \use:c { @@_load_cjk_font_ \g_@@_cjk_fontset_tl : } + } +\ctex_at_end_preamble:n { \@@_load_font: } +% \end{macrocode} +% \end{macro} +% +%^^A 以下相关代码已在 v0.7c 中移除。 +% \changes{v0.5}{2017/09/09}{重新实现字体调用。核心内容是分离字体的声明与设定, +% 并按照宋、黑、仿、楷划分中文字体。} +% \changes{v0.6}{2017/11/11}{额外处理 XITS 字体的小型大写字母。} +% \changes{v0.5}{2017/09/23}{新增 \kvopt{font}{none} 选项。} +% \changes{v0.5}{2017/09/23}{新增 \kvopt{cjk-font}{none} 选项。} +% \changes{v0.5}{2017/09/23}{同步 \pkg{fontspec} v2.6e。} +% \changes{v0.6}{2017/10/11}{同步 \pkg{unicode-math} v0.8h。} +% +% \subsubsection{数学字体设置} +% +% 根据 GB 3102.11--93 以及 ISO 80000-2:2009 的规定,数学表达式中 +% 表示变量的拉丁字母和希腊字母均应当使用斜体。 +% 这里的 |\keys_set:nn{unicode-math}| 实际相当于 \cs{unimathsetup}。 +% \begin{macrocode} +% TODO: (2018-01-19) Do we need `mathrm=sym`? +\keys_set:nn { unicode-math } + { + math-style = ISO, + bold-style = ISO, +% mathrm = sym + } +% \end{macrocode} +% +% \subsubsection{字号} +% +% \begin{macrocode} +\keys_define:nn { fdu / style } + { +% \end{macrocode} +% +% \begin{macro}{style/font-size} +% |font-size| 不是文档类选项,不能传给 \cls{ctexbook} 文档类,因此 +% 只能手动重定义字号命令。 +% \begin{macrocode} + font-size .choice:, + font-size .value_required:n = true, + font-size / -4 .code:n = { }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tiny,\scriptsize,\footnotesize,\small, +% \normalsize,\large,\Large,\LARGE,\huge,\Huge} +% 默认使用小四号字,所以只有五号字需要重新设置。 +% \begin{macrocode} + font-size / 5 .code:n = + { + \RenewDocumentCommand \tiny { } { \zihao { 7 } } + \RenewDocumentCommand \scriptsize { } { \zihao { -6 } } + \RenewDocumentCommand \footnotesize { } { \zihao { 6 } } + \RenewDocumentCommand \small { } { \zihao { -5 } } + \RenewDocumentCommand \normalsize { } { \zihao { 5 } } + \RenewDocumentCommand \large { } { \zihao { -4 } } + \RenewDocumentCommand \Large { } { \zihao { -3 } } + \RenewDocumentCommand \LARGE { } { \zihao { -2 } } + \RenewDocumentCommand \huge { } { \zihao { 2 } } + \RenewDocumentCommand \Huge { } { \zihao { 1 } } +% } +% } +%<*class> + }, +% \end{macrocode} +% \end{macro} +% +% \subsubsection{句号} +% +% \begin{macro}{style/fullwidth-stop} +% \changes{v0.6}{2017/10/14}{支持类别码和 TECKit 映射两种机制。} +% 设置句号形状(圆圈或是圆点)。 +% \begin{macrocode} + fullwidth-stop .choice:, + fullwidth-stop .value_required:n = true, +% \end{macrocode} +% 利用类别码机制切换,只有显式的\FSID 会被替换。 +% \begin{macrocode} + fullwidth-stop / catcode .code:n = + { \@@_set_fullwidth_stop_catcode: }, +% \end{macrocode} +% 利用 TECKit 映射机制切换,相当于设置了 \tn{defaultCJKfontfeatures} +% |{|\kvopt{Map\-ping}{fullwidth-stop}|}|。这种手段会替换所有出现的\FSID, +% 并且将影响所有字体。只在 \XeTeX{} 下可用。 +% \begin{macrocode} + fullwidth-stop / mapping .code:n = + { + \sys_if_engine_xetex:TF + { + \clist_gset:Nn \g__xeCJK_default_features_clist + { Mapping = fullwidth-stop } + } + { +% \end{macrocode} +% \LuaTeX{} 下改用类别码机制代替,并给出警告。 +% \begin{macrocode} + \sys_if_engine_luatex:T + { + \@@_warning:n { mapping-not-available } + \@@_set_fullwidth_stop_catcode: + } + } + }, + fullwidth-stop / false .code:n = { } + } +% \end{macrocode} +% \end{macro} +% +% 提示信息。 +% \begin{macrocode} +\@@_msg_new:nn { mapping-not-available } + { + Option~ "fullwidth-stop = mapping"~ is~ not~ available~ in~ LuaTeX. \\ + "fullwidth-stop = catcode"~ will~ be~ set~ instead. + } +% \end{macrocode} +% +% \begin{macro}{\@@_set_fullwidth_stop_catcode:} +% 将\FSID 设置为活动符,并定义为句点\FSFW。 +% \begin{macrocode} +\cs_new:Npn \@@_set_fullwidth_stop_catcode: + { + \char_set_active_eq:nN { "3002 } \c_@@_fwid_full_stop_tl + \char_set_catcode_active:n { "3002 } + } +% +% \end{macrocode} +% \end{macro} +% +% \changes{v0.6}{2017/10/28}{优化 \LuaTeX{} 下希腊字母、西里尔字母和带圈数字的 +% 显示(\pkg{ctex} v2.4.11 已默认进行处理)。} +% +% \subsection{页眉页脚} +% +% 清除默认页眉页脚格式。 +% \begin{macrocode} +\fancyhf { } +% \end{macrocode} +% +% \begin{variable}{\l_@@_header_center_mark_tl} +% 保存中间页眉的文字。正文中设置为空,目录、摘要、符号表等设置为相应标题。 +% \begin{macrocode} +\tl_new:N \l_@@_header_center_mark_tl +% \end{macrocode} +% \end{variable} +% +% 构建页眉,要在单面或双面下分别设置。 +% +% \cs{fancyhead} 的选项中,\opt{E} 和 \opt{O} 分别表示偶数(even) +% 和奇数(odd), 而 \opt{L}、\opt{R} 和 \opt{C} 则分别表示左 +% (left)、右(right)和中间(center)。按照通常的排版规则, +% 在双面模式下,偶数页的中间页眉文字在左,奇数页则在右。单面模式下, +% 左右页眉都要显示。 +% \begin{macrocode} +\bool_if:NTF \g_@@_twoside_bool +%<*class> + { + \fancyhead [ EL ] { \small \nouppercase { \fdu@kai \leftmark } } + \fancyhead [ OR ] { \small \nouppercase { \fdu@kai \rightmark } } + } + { + \fancyhead [ L ] { \small \nouppercase { \fdu@kai \leftmark } } + \fancyhead [ R ] { \small \nouppercase { \fdu@kai \rightmark } } + \fancyhead [ C ] + { + \small \nouppercase + { \fdu@kai \l_@@_header_center_mark_tl } + } + } +% +%<*class-en> + { + \fancyhead [ EL ] { \small \nouppercase { \itshape \leftmark } } + \fancyhead [ OR ] { \small \nouppercase { \itshape \rightmark } } + } + { + \fancyhead [ L ] { \small \nouppercase { \itshape \leftmark } } + \fancyhead [ R ] { \small \nouppercase { \itshape \rightmark } } + \fancyhead [ C ] + { + \small \nouppercase + { \itshape \l_@@_header_center_mark_tl } + } + } +% +% \end{macrocode} +% +% 构建页脚,用来显示页码。选项 \opt{C} 表示居中(center)。 +% \begin{macrocode} +\fancyfoot [ C ] { \small \thepage } +% \end{macrocode} +% +% 关闭横线显示(未启用)。 +% \begin{macrocode} +% \RenewDocumentCommand \headrulewidth { } { 0 pt } +% \end{macrocode} +% +% \begin{macro}{\cleardoublepage} +% 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示页眉页脚,见 +% \url{https://tex.stackexchange.com/a/1683}。最后清空中间页眉,确保正文部分 +% 页眉显示正确。 +% \begin{macrocode} +\RenewDocumentCommand \cleardoublepage { } + { + \clearpage + \bool_if:NT \g_@@_twoside_bool + { + \int_if_odd:nF \c@page + { \hbox:n { } \thispagestyle { empty } \newpage } + } + \tl_gset:Nn \l_@@_header_center_mark_tl { } + } +% \end{macrocode} +% \end{macro} +% +% \pkg{ctex} 宏包使用 \opt{heading} 选项后,会把页面格式设置为 |headings|。 +% 因此必须在 \pkg{ctex} 调用之后重新设置 \cs{pagestyle} 为 |fancy|。 +% \begin{macrocode} +\pagestyle { fancy } +% \end{macrocode} +% +% \subsection{章节标题结构} +% +% |\keys_set:nn{ctex}| 实际相当于 \cs{ctexset}。 +% \begin{macrocode} +\keys_set:nn { ctex } + { +% \end{macrocode} +% 设置章(chapter)、节(section)与小节(sub-section)标题样式。 +% 此处使用 \kvopt{fixskip}{true} 选项来抑制前后的多余间距。 +% \begin{macrocode} + chapter = + { +% format = \huge \normalfont \sffamily \centering, +%<*class-en> + format = \centering, + nameformat = \LARGE \bfseries, + titleformat = \huge \bfseries, + aftername = \par \nobreak \vskip 10 pt, +% + beforeskip = 50 pt, + afterskip = 40 pt, + number = \@@_arabic:n { chapter }, + fixskip = true + }, + section = + { +% format = \Large \normalfont \sffamily \raggedright, +% format = \Large \bfseries \raggedright, + beforeskip = 3.5 ex plus 1.0 ex minus 0.2 ex, + afterskip = 2.7 ex plus 0.5 ex, + fixskip = true + }, + subsection = + { +% format = \large \normalfont \sffamily \raggedright, +% format = \large \bfseries \raggedright, + beforeskip = 3.25 ex plus 1.0 ex minus 0.2 ex, + afterskip = 2.5 ex plus 0.3 ex, + fixskip = true + } + } +% \end{macrocode} +% +% \changes{v0.7d}{2019/03/24}{优化目录、摘要、参考文献等的标题实现。} +% +% \begin{macro}{\@@_chapter:n,\@@_chapter:V} +% 手动生成章的标题,用于摘要、参考文献等。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter:n #1 + { + \group_begin: + \ctexset { chapter / numbering = false } + \chapter {#1} + \@@_chapter_header:n {#1} + \group_end: + } +\cs_generate_variant:Nn \@@_chapter:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter_no_toc:n,\@@_chapter_no_toc:V} +% 目录自身不出现在目录中,需特别处理。参考 +% \url{https://tex.stackexchange.com/a/1821}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter_no_toc:n #1 + { + \chapter * {#1} + \@@_chapter_header:n {#1} + \pdfbookmark [0] {#1} { toc } + } +\cs_generate_variant:Nn \@@_chapter_no_toc:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter_header:n} +% 单页模式下,目录、摘要、符号表等的页眉中间为相应标题,左右为空。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter_header:n #1 + { + \bool_if:NTF \g_@@_twoside_bool + { \markboth {#1} {#1} } + { + \markboth { } { } + \tl_gset:Nn \l_@@_header_center_mark_tl {#1} + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{脚注} +% +% \changes{v0.3}{2017/02/21}{支持脚注。} +% +% \subsubsection{编号样式} +% +% 各种脚注编号样式的名称。 +% \begin{macrocode} +\clist_map_inline:nn + { + { plain } { plain }, + { libertinus } { libertinus }, + { libertinus_neg } { libertinus* }, + { libertinus_sans } { libertinus-sans }, + { pifont } { pifont }, + { pifont_neg } { pifont* }, + { pifont_sans } { pifont-sans }, + { pifont_sans_neg } { pifont-sans* }, + { xits } { xits }, + { xits_sans } { xits-sans }, + { xits_sans_neg } { xits-sans* } + } + { \@@_define_fn_style:nn #1 } +% \end{macrocode} +% +% \begin{variable}{\l_@@_fn_style_tl} +% 保存当前使用的脚注编号样式。 +% \begin{macrocode} +\tl_new:N \l_@@_fn_style_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\keys_define:nn { fdu / style } + { +% \end{macrocode} +% +% \begin{macro}{style/footnote-style} +% 脚注类型共分四大类: +% \begin{itemize} +% \item \opt{plain}:使用当前字体; +% \item \opt{libertinus}:取自 Libertinus Serif 和 Libertinus Sans +% 字体; +% \item \opt{pifont}:使用 \pkg{pifont} 宏包; +% \item \opt{xits}:取自 XITS 字体。 +% \end{itemize} +% 不带任何修饰的为衬线阳文符号,带“|sans|”的为无衬线符号,带“|*|”的 +% 为阴文版本。 +% \begin{macrocode} + footnote-style .choices:nn = + { + plain, + libertinus, libertinus*, libertinus-sans, + pifont, pifont*, pifont-sans, pifont-sans*, + xits, xits-sans, xits-sans* + } +% \end{macrocode} +% \changes{v0.6}{2017/11/12}{不再依赖 XITS-Math 字体。} +% 若使用 \opt{pifont} 类型,则需引入 \pkg{pifont} 宏包。 +% \begin{macrocode} + { + \tl_gset_eq:NN \l_@@_fn_style_tl \l_keys_choice_tl + \int_compare:nT { 5 <= \l_keys_choice_int <= 8 } + { \RequirePackage { pifont } } + }, + footnote-style .value_required:n = true + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_libertinus:n} +% \opt{libertinus} 普通版。\numrange{1}{20} 为数字,\numrange{21}{46} +% 为小写英文字母,\numrange{47}{72} 为大写英文字母。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_libertinus:n #1 + { + \int_compare:nTF { #1 >= 21 } + { + \int_compare:nTF { #1 >= 47 } + { \@@_symbol:n { \int_eval:n { "24B6 - 47 + #1 } } } + { \@@_symbol:n { \int_eval:n { "24D0 - 21 + #1 } } } + } + { \@@_symbol:n { \int_eval:n { "2460 - 1 + #1 } } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_libertinus_neg:n} +% \opt{libertinus} 阴文衬线版。只含 \numrange{1}{20}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_libertinus_neg:n #1 + { + \int_compare:nTF { #1 >= 11 } + { \@@_symbol:n { \int_eval:n { "24EB - 11 + #1 } } } + { \@@_symbol:n { \int_eval:n { "2776 - 1 + #1 } } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_libertinus_sans:n} +% \opt{libertinus} 阳文无衬线版。符号排列与普通版相同。 +% \begin{macrocode} +\cs_new_eq:NN \@@_fn_symbol_libertinus_sans:n \@@_fn_symbol_libertinus:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont:n} +% \opt{pifont} 普通版。以下四种都只包含 \numrange{1}{10}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont:n #1 + { \ding { \int_eval:n { 171 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont_neg:n} +% \opt{pifont} 阴文衬线版。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont_neg:n #1 + { \ding { \int_eval:n { 181 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont_sans:n} +% \opt{pifont} 阳文无衬线版。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont_sans:n #1 + { \ding { \int_eval:n { 191 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont_sans_neg:n} +% \opt{pifont} 阴文无衬线版。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont_sans_neg:n #1 + { \ding { \int_eval:n { 201 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_xits:n} +% \opt{xits} 普通版。\numrange{1}{9} 为数字,\numrange{10}{35} +% 为小写英文字母,\numrange{36}{61} 为大写英文字母。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_xits:n #1 + { + \int_compare:nTF { #1 >= 10 } + { + \int_compare:nTF { #1 >= 36 } + { \@@_symbol:n { \int_eval:n { "24B6 - 36 + #1 } } } + { \@@_symbol:n { \int_eval:n { "24D0 - 10 + #1 } } } + } + { \@@_symbol:n { \int_eval:n { "2460 - 1 + #1 } } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_xits_sans:n} +% \opt{xits} 阳文无衬线版。只包含 \numrange{1}{10}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_xits_sans:n #1 + { \@@_symbol:n { \int_eval:n { "2780 - 1 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_xits_sans_neg:n} +% \opt{xits} 阴文无衬线版。也只包含 \numrange{1}{10}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_xits_sans_neg:n #1 + { \@@_symbol:n { \int_eval:n { "278A - 1 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\thefootnote} +% \changes{v0.7}{2018/01/17}{改为可完全展开的命令。} +% 重定义脚注编号。 +% \begin{macrocode} +\cs_set:Npn \thefootnote { \fdu_footnote_number:N \c@footnote } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fdu_footnote_number:N} +% 脚注编号样式。 +% \begin{macrocode} +\cs_new:Npn \fdu_footnote_number:N #1 + { + \tl_case:NnF \l_@@_fn_style_tl + { +% \end{macrocode} +% \opt{plain} 类型直接使用计数器 |footnote| 的值。 +% \begin{macrocode} + \c_@@_fn_style_plain_tl + { \int_use:N #1 } +% \end{macrocode} +% \opt{libertinus} 类型需要使用 Libertinus Serif 或 +% Libertinus Sans 字体。 +% \begin{macrocode} + \c_@@_fn_style_libertinus_tl + { + \fontspec { \g_@@_font_name_libertinus_serif_tl .otf } + \@@_fn_symbol_libertinus:n {#1} + } + \c_@@_fn_style_libertinus_neg_tl + { + \fontspec { \g_@@_font_name_libertinus_serif_tl .otf } + \@@_fn_symbol_libertinus_neg:n {#1} + } + \c_@@_fn_style_libertinus_sans_tl + { + \fontspec { \g_@@_font_name_libertinus_sans_tl .otf } + \@@_fn_symbol_libertinus_sans:n {#1} + } +% \end{macrocode} +% \opt{pifont} 类型无需进行额外的操作。 +% \begin{macrocode} + \c_@@_fn_style_pifont_tl + { \@@_fn_symbol_pifont:n {#1} } + \c_@@_fn_style_pifont_neg_tl + { \@@_fn_symbol_pifont_neg:n {#1} } + \c_@@_fn_style_pifont_sans_tl + { \@@_fn_symbol_pifont_sans:n {#1} } + \c_@@_fn_style_pifont_sans_neg_tl + { \@@_fn_symbol_pifont_sans_neg:n {#1} } +% \end{macrocode} +% \opt{xits} 类型需要临时切换数学字体。 +% \begin{macrocode} + \c_@@_fn_style_xits_tl + { + \fontspec { \g_@@_font_name_xits_tl .otf } + \@@_fn_symbol_xits:n {#1} + } + \c_@@_fn_style_xits_sans_tl + { + \fontspec { \g_@@_font_name_xits_tl .otf } + \@@_fn_symbol_xits_sans:n {#1} + } + \c_@@_fn_style_xits_sans_neg_tl + { + \fontspec { \g_@@_font_name_xits_tl .otf } + \@@_fn_symbol_xits_sans_neg:n {#1} + } + } +% \end{macrocode} +% 变量 \cs{l_@@_fn_style_tl} 保存的类型未知时,默认使用 \opt{plain} +% 类型。 +% \begin{macrocode} + { \int_use:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{整体样式} +% +% \begin{macro}[int]{\@makefntext} +% \changes{v0.7}{2018/01/18}{简化实现,兼容 \pkg{fancyvrb} 宏包。 +% 不再使用悬挂缩进。} +% 重定义内部脚注文字命令,使脚注编号不使用上标,宽度为 \SI{1.5}{em}。 +% 见 \url{http://tex.stackexchange.com/q/19844} 和 +% \url{https://www.zhihu.com/question/53030087}。 +% \begin{macrocode} +\cs_set:Npn \@makefntext #1 + { + \mode_leave_vertical: + \hbox_to_wd:nn { 1.5 em } { \@thefnmark \hfil } + #1 + } +% \end{macrocode} +% \end{macro} +% +% \subsection{定理环境} +% +% \changes{v0.3}{2017/05/07}{新增定理环境。} +% +% \begin{variable}{\c_@@_thm_style_plain_clist, +% \c_@@_thm_style_break_clist} +% 保存 \opt{plain}、\opt{break} 两种类型的定理样式名称。 +% \begin{macrocode} +\clist_const:Nn \c_@@_thm_style_plain_clist + { plain, margin, change } +\clist_const:Nn \c_@@_thm_style_break_clist + { break, marginbreak, changebreak } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_thm_style_tl, +% \l_@@_thm_header_font_tl, +% \l_@@_thm_body_font_tl, +% \l_@@_thm_qed_tl, +% \l_@@_thm_counter_tl} +% 定理所需的一些字段。 +% \begin{macrocode} +\tl_new:N \l_@@_thm_style_tl +\tl_new:N \l_@@_thm_header_font_tl +\tl_new:N \l_@@_thm_body_font_tl +\tl_new:N \l_@@_thm_qed_tl +\tl_new:N \l_@@_thm_counter_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{theorem/style, +% theorem/header-font, +% theorem/body-font, +% theorem/qed, +% theorem/counter} +% 定义 |fdu/theorem| 键值类。 +% \begin{macrocode} +\keys_define:nn { fdu / theorem } + { + style .tl_set:N = \l_@@_thm_style_tl, + header-font .tl_set:N = \l_@@_thm_header_font_tl, + body-font .tl_set:N = \l_@@_thm_body_font_tl, + qed .tl_set:N = \l_@@_thm_qed_tl, + counter .tl_set:N = \l_@@_thm_counter_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_thm_ntheorem_style:n,\@@_thm_ntheorem_new:w} +% 拷贝 \pkg{ntheorem} 命令。 +% \begin{macrocode} +\cs_new_eq:NN \@@_thm_ntheorem_style:n \theoremstyle +\cs_new_eq:NN \@@_thm_ntheorem_new:w \newtheorem +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7}{2017/12/12}{原 \cs{fdunewtheorem} 命令更名为 +% \cs{new\-the\-orem}。} +% +% \begin{macro}{\newtheorem} +% 定义新的定理环境。 +% \begin{macrocode} +\RenewDocumentCommand \newtheorem { s o m m } + { +% \end{macrocode} +% 默认情况下,由 \cs{newtheorem*} 创建的定理其证毕符号为 \cs{QED}, +% 而由 \cs{new\-the\-orem} 创建的则不带证毕符号。符号 \cs{QED} 由 +% \pkg{unicode-math} 宏包提供。 +% \begin{macrocode} + \IfBooleanTF {#1} + { \tl_set:Nn \l_@@_thm_qed_tl { \ensuremath { \QED } } } + { \tl_set:Nn \l_@@_thm_qed_tl { } } +% \end{macrocode} +% 设置默认样式为 \opt{plain}。 +% \begin{macrocode} +% TODO: (2017-12-07) Move to interface + \tl_set:Nn \l_@@_thm_style_tl { plain } +% \end{macrocode} +% 处理可选参数。利用 |fdu/theorem| 键值对设置,并按此修改证毕符号、 +% 定理头字体和定理正文字体。 +% \begin{macrocode} + \IfValueT {#2} { \keys_set:nn { fdu / theorem } {#2} } + \fdu_thm_set_header_font:V \l_@@_thm_header_font_tl + \fdu_thm_set_body_font:V \l_@@_thm_body_font_tl + \fdu_thm_set_qed:V \l_@@_thm_qed_tl +% \end{macrocode} +% \cs{newtheorem} 负责创建编号定理,而 \cs{newtheorem*} +% 则负责创建无编号定理。以下分这两种情况处理。 +% \begin{macrocode} + \IfBooleanTF {#1} + { +% \end{macrocode} +% 带 |*| 的版本原则上只接受 \opt{plain} 和 \opt{break} 两种样式, +% 其余样式将被转换成这两者其中之一。 +% \begin{macrocode} + \clist_if_in:nVF { plain, break } \l_@@_thm_style_tl + { + \clist_if_in:NVTF + \c_@@_thm_style_plain_clist \l_@@_thm_style_tl + { \@@_thm_redefine_style:n { plain } } + { + \clist_if_in:NVTF + \c_@@_thm_style_break_clist \l_@@_thm_style_tl + { \@@_thm_redefine_style:n { break } } + { + \@@_error:nx { unknown-theorem-style } + { \l_@@_thm_style_tl } + } + } + } +% \end{macrocode} +% \pkg{ntheorem} 宏包提供的无编号定理带有 |nonumber| 前缀, +% 这里将其加上。 +% \begin{macrocode} + \tl_put_left:Nn \l_@@_thm_style_tl { nonumber } + \fdu_thm_new_no_number:Vxx \l_@@_thm_style_tl {#3} {#4} + } + { +% \end{macrocode} +% 不带 |*| 的版本支持不含“|nonumber|”的所有定理样式。 +% \begin{macrocode} + \clist_clear:N \l_@@_tmpa_clist + \clist_concat:NNN \l_@@_tmpa_clist + \c_@@_thm_style_plain_clist \c_@@_thm_style_break_clist + \clist_if_in:NVF \l_@@_tmpa_clist \l_@@_thm_style_tl + { + \@@_error:nx { unknown-theorem-style } + { \l_@@_thm_style_tl } + } + \fdu_thm_new:VVxx \l_@@_thm_style_tl \l_@@_thm_counter_tl + {#3} {#4} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_thm_redefine_style:n} +% 重定义定理样式,并给出警告。 +% \begin{macrocode} +\cs_new:Npn \@@_thm_redefine_style:n #1 + { + \@@_warning:nxx { redefine-theorem-style } + {#1} { \l_@@_thm_style_tl } + \tl_set:Nn \l_@@_thm_style_tl {#1} + } +% \end{macrocode} +% \end{macro} +% +% 提示信息。 +% \begin{macrocode} +\@@_msg_new:nn { redefine-theorem-style } + { Theorem~ style~ "#2"~ will~ be~ redefined~ as~ "#1". } +\@@_msg_new:nn { unknown-theorem-style } + { Theorem~ style~ "#1"~ is~ unknown. } +% \end{macrocode} +% +% \begin{macro}{\fdu_thm_new:nnnn,\fdu_thm_new:VVxx} +% 带编号的定理环境。 +% \begin{arguments} +% \item 样式 +% \item 计数器 +% \item 定理环境名称 +% \item 定理头文字 +% \end{arguments} +% \begin{macrocode} +\cs_new:Npn \fdu_thm_new:nnnn #1#2#3#4 + { + \@@_thm_ntheorem_style:n {#1} + \@@_thm_ntheorem_new:w {#3} {#4} [#2] + } +\cs_generate_variant:Nn \fdu_thm_new:nnnn { VVxx } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fdu_thm_new_no_number:nnn, +% \fdu_thm_new_no_number:Vxx} +% 不带编号的定理环境。 +% \begin{arguments} +% \item 样式 +% \item 定理环境名称 +% \item 定理头文字 +% \end{arguments} +% \begin{macrocode} +\cs_new:Npn \fdu_thm_new_no_number:nnn #1#2#3 + { + \@@_thm_ntheorem_style:n {#1} + \@@_thm_ntheorem_new:w {#2} {#3} + } +\cs_generate_variant:Nn \fdu_thm_new_no_number:nnn { Vxx } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fdu_thm_set_qed:n, +% \fdu_thm_set_header_font:n, +% \fdu_thm_set_body_font:n, +% \fdu_thm_set_qed:V, +% \fdu_thm_set_header_font:V, +% \fdu_thm_set_body_font:V} +% 封装 \pkg{ntheorem} 宏包提供的若干命令,分别用以设置证毕符号、 +% 定理头字体和定理正文字体。 +% \begin{macrocode} +\cs_new:Npn \fdu_thm_set_qed:n #1 { \theoremsymbol {#1} } +\cs_new:Npn \fdu_thm_set_header_font:n #1 { \theoremheaderfont {#1} } +\cs_new:Npn \fdu_thm_set_body_font:n #1 { \theorembodyfont {#1} } +\cs_generate_variant:Nn \fdu_thm_set_qed:n { V } +\cs_generate_variant:Nn \fdu_thm_set_header_font:n { V } +\cs_generate_variant:Nn \fdu_thm_set_body_font:n { V } +% \end{macrocode} +% \end{macro} +% +% \subsection{图表绘制;浮动体} +% +% \changes{v0.3}{2017/07/09}{支持浮动体。} +% +% 分别设置浮动体 \env{figure} 和 \env{table} 的标题样式。 +% \begin{macrocode} +\captionsetup [ figure ] + { + font = small, + labelsep = quad + } +\captionsetup [ table ] + { + font = { small, sf }, + labelsep = quad + } +% \end{macrocode} +% +% \begin{macro}{\thefigure,\thetable} +% \changes{v0.7}{2018/01/17}{改为可完全展开的命令。} +% \changes{v0.7f}{2021/03/10}{直接调用 \tn{thechapter} 使得附录中的图表编号正确显示。} +% 重定义图表编号。 +% \begin{macrocode} +\cs_set:Npn \thefigure + { \thechapter - \@@_arabic:n { figure } } +\cs_set:Npn \thetable + { \thechapter - \@@_arabic:n { table } } +% \end{macrocode} +% \end{macro} +% +% \subsection{封面} +% +% \subsubsection{信息录入} +% +% \begin{variable}{\l_@@_info_title_tl, +% \l_@@_info_date_tl, +% \l_@@_info_author_tl, +% \l_@@_info_supervisor_tl, +% \l_@@_info_department_tl, +% \l_@@_info_major_tl, +% \l_@@_info_student_id_tl, +% \l_@@_info_school_id_tl, +% \l_@@_info_clc_tl, +% \l_@@_info_instructors_clist, +% \l_@@_info_keywords_clist} +% 封面所需的一些字段。 +% \begin{macrocode} +\clist_map_inline:nn + { + title, date, author, supervisor, department, major, student_id, + school_id, clc + } + { \tl_new:c { l_@@_info_ #1 _tl } } +\clist_new:N \l_@@_info_instructors_clist +\clist_new:N \l_@@_info_keywords_clist +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_title_en_tl, +% \l_@@_info_author_en_tl, +% \l_@@_info_supervisor_en_tl, +% \l_@@_info_department_en_tl, +% \l_@@_info_major_en_tl, +% \l_@@_info_keywords_en_clist} +% 对应的英文字段。 +% \begin{macrocode} +\clist_map_inline:nn + { title, author, supervisor, department, major } + { \tl_new:c { l_@@_info_ #1 _en_tl } } +\clist_new:N \l_@@_info_keywords_en_clist +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_degree_type_int} +% 学位类型。1 为学术学位,2 为专业学位。 +% \begin{macrocode} +\int_new:N \l_@@_info_degree_type_int +% \end{macrocode} +% \end{variable} +% +% 定义 |fdu/info| 键值类。 +% \begin{macrocode} +\keys_define:nn { fdu / info } + { +% \end{macrocode} +% +% \changes{v0.7}{2018/02/01}{新增 \opt{info/degree} 选项。} +% +% \begin{macro}{info/degree} +% 学位类型。只对硕士论文有效。 +% \begin{macrocode} + degree .choices:nn = + { academic, professional } + { \int_set_eq:NN \l_@@_info_degree_type_int \l_keys_choice_int }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/title,info/title*} +% 论文题目。以下带星号的项目均表示相应的英文字段。 +% \begin{macrocode} + title .tl_set:N = \l_@@_info_title_tl, + title* .tl_set:N = \l_@@_info_title_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/date} +% 论文完成日期。 +% \begin{macrocode} + date .tl_set:N = \l_@@_info_date_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/author,info/author*} +% 作者姓名。 +% \begin{macrocode} + author .tl_set:N = \l_@@_info_author_tl, + author* .tl_set:N = \l_@@_info_author_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/supervisor,info/supervisor*} +% 导师姓名。 +% \begin{macrocode} + supervisor .tl_set:N = \l_@@_info_supervisor_tl, +% supervisor* .tl_set:N = \l_@@_info_supervisor_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/instructors} +% 指导小组成员。 +% \begin{macrocode} + instructors .clist_set:N = \l_@@_info_instructors_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/department,info/department*} +% 院系。 +% \begin{macrocode} + department .tl_set:N = \l_@@_info_department_tl, +% department* .tl_set:N = \l_@@_info_department_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/major,info/major*} +% 专业。 +% \begin{macrocode} + major .tl_set:N = \l_@@_info_major_tl, +% major* .tl_set:N = \l_@@_info_major_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/student-id} +% 学号。 +% \begin{macrocode} + student-id .tl_set:N = \l_@@_info_student_id_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/school-id} +% 学校代码。 +% \begin{macrocode} + school-id .tl_set:N = \l_@@_info_school_id_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/keywords,info/keywords*} +% 论文关键字。 +% \begin{macrocode} + keywords .clist_set:N = \l_@@_info_keywords_clist, + keywords* .clist_set:N = \l_@@_info_keywords_en_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/clc} +% 中图分类号。 +% \begin{macrocode} + clc .tl_set:N = \l_@@_info_clc_tl + } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.4}{2017/08/10}{新增 \opt{style/logo} 与 +% \opt{style/logo-size} 选项。} +% +% \begin{variable}{\l_@@_cover_logo_tl,\l_@@_cover_logo_size_clist} +% \begin{macrocode} +\tl_new:N \l_@@_cover_logo_tl +\clist_new:N \l_@@_cover_logo_size_clist +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{style/logo,style/logo-size} +% 校名图片的文件名和尺寸。 +% \begin{macrocode} +\keys_define:nn { fdu / style } + { + logo .tl_set:N = \l_@@_cover_logo_tl, + logo-size .clist_set:N = \l_@@_cover_logo_size_clist + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{密级} +% +% \changes{v0.3}{2017/07/04}{新增 \opt{info/secret-level} 与 +% \opt{info/secret-year} 选项。} +% +% \begin{variable}{\l_@@_secret_bool} +% 是否显示密级。 +% \begin{macrocode} +\bool_new:N \l_@@_secret_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_secret_level_tl} +% 保存当前的密级。 +% \begin{macrocode} +\tl_new:N \l_@@_info_secret_level_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\keys_define:nn { fdu / info } + { +% \end{macrocode} +% +% \begin{macro}{info/secret-level} +% \changes{v0.6}{2017/11/11}{不再依赖 XITS-Math 字体。} +% 密级。\opt{none} 表示不涉密,\opt{i}、\opt{ii}、\opt{iii} 分别为 +% 秘密、机密、绝密。 +% \begin{macrocode} + secret-level .choices:nn = + { none, i, ii, iii } + { + \int_compare:nTF { \l_keys_choice_int >= 2 } + { + \bool_set_true:N \l_@@_secret_bool + \tl_set:Nn \l_@@_info_secret_level_tl + { + \clist_item:Nn \c_@@_secret_clist + { \l_keys_choice_int - 1 } + } + } + { \bool_set_false:N \l_@@_secret_bool } + }, + secret-level .value_required:n = true, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/secret-year} +% 保密年限。 +% \begin{macrocode} + secret-year .tl_set:N = \l_@@_info_secret_year_tl + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{定义内部函数} +% +% \begin{macro}{\@@_spread_box:nn} +% 分散对齐的水平盒子。 +% \begin{arguments} +% \item 宽度 +% \item 内容 +% \end{arguments} +% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip} +% 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。 +% |#2| 需要完全展开以避免 underfull 警告。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_spread_box:nn #1#2 + { + \mode_leave_vertical: + \hbox_to_wd:nn {#1} + { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_center_box:nn,\@@_center_box:Vn} +% 居中对齐的水平盒子。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_center_box:nn #1#2 + { + \mode_leave_vertical: + \hbox_to_wd:nn {#1} { \hfil #2 \hfil } + } +\cs_generate_variant:Nn \@@_center_box:nn { Vn } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fixed_width_box:nn} +% 限宽盒子(允许换行)。 +% \begin{macrocode} +\cs_new:Npn \@@_fixed_width_box:nn #1#2 + { \parbox {#1} {#2} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fixed_width_center_box:nn} +% 居中对齐的限宽盒子(允许换行)。 +% \begin{macrocode} +\cs_new:Npn \@@_fixed_width_center_box:nn #1#2 + { \parbox {#1} { \centering #2 } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_text_width:Nn,\@@_get_text_width:NV} +% 获取文本宽度,并存入 |dim| 型变量。 +% \begin{arguments} +% \item |dim| 型变量 +% \item 内容 +% \end{arguments} +% \begin{macrocode} +\cs_new:Npn \@@_get_text_width:Nn #1#2 + { + \hbox_set:Nn \l_@@_tmpa_box {#2} + \dim_set:Nn #1 { \box_wd:N \l_@@_tmpa_box } + } +\cs_generate_variant:Nn \@@_get_text_width:Nn { NV } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_max_text_width:NN} +% \changes{v0.6}{2017/11/24}{移除不必要的字号设置。} +% 获取多个文本中的最大宽度,并存入 |dim| 型变量。 +% \begin{arguments} +% \item |dim| 型变量 +% \item 文本 |clist| +% \end{arguments} +% 当 \cs{l_@@_tmpa_clist} 非空时,弹出最后一个元素 +% 赋给 \cs{l_@@_tmpa_tl},获取其长度后与 |#1| 进行比较, +% 二者中较大的那一个将成为 |#1| 的新值。 +% 不断循环,直至 \cs{l_@@_tmpa_clist} 为空。 +% \begin{macrocode} +\cs_new:Npn \@@_get_max_text_width:NN #1#2 + { +% \end{macrocode} +% 这里用 |group| 确保局部变量不会被污染。 +% \begin{macrocode} + \group_begin: + \clist_set_eq:NN \l_@@_tmpa_clist #2 + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \@@_get_text_width:NV \l_@@_tmpa_dim \l_@@_tmpa_tl + \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } } + } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_blank_underline:n} +% \changes{v0.4}{2017/08/14}{改用 \tn{rule} 绘制下划线,不再依赖 +% \pkg{ulem} 宏包。} +% 下划线占位符。|#1|: 长度。 +% \begin{macrocode} +\cs_new:Npn \@@_blank_underline:n #1 + { \rule [ -0.5 ex ] {#1} { 0.4 pt } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_line_spread:N,\@@_line_spread:n} +% 设置行距。|#1|: 行距倍数 |fp| 变量。 +% \begin{macrocode} +\cs_new:Npn \@@_line_spread:N #1 + { \linespread { \fp_use:N #1 } \selectfont } +\cs_new:Npn \@@_line_spread:n #1 + { \linespread {#1} \selectfont } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{封面各部件} +% +% \changes{v0.5}{2017/09/19}{使用 \pkg{expl3} 以及内部函数改写 +% 封面,减少对 \LaTeXe{} 的依赖。} +% +% \begin{macro}{\@@_cover_id:,\@@_cover_id_aux:n} +% 右上角的学校代码和学号。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_id: + { + \@@_fixed_width_box:nn { 120 pt } + { + \bool_if:NT \l_@@_secret_bool + { + \group_begin: + \sffamily + \@@_cover_id_aux:n { secret_level } + \c_@@_name_secret_star_tl + \l_@@_info_secret_year_tl + \group_end: + \par + } + \@@_cover_id_aux:n { school_id } \par + \@@_cover_id_aux:n { student_id } + } +% \end{macrocode} +% 插入一个宽度为负的水平盒子以减少右侧边距。 +% \begin{macrocode} + \hbox_to_wd:nn { -24 pt } { } + } +\cs_new:Npn \@@_cover_id_aux:n #1 + { + \tl_use:c { c_@@_name_ #1 _tl } + \c_@@_fwid_colon_tl + \tl_use:c { l_@@_info_ #1 _tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_logo:} +% 插入校名图片。根据参数 \opt{width} 和 \opt{height} 是否为空依次 +% 判断。\cs{l_@@_cover_logo_size_clist} 中超过两个的参数将被忽略。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_logo: + { + \clist_pop:NN \l_@@_cover_logo_size_clist \l_@@_tmpa_tl + \clist_pop:NNTF \l_@@_cover_logo_size_clist \l_@@_tmpb_tl + { + \tl_if_empty:NTF \l_@@_tmpa_tl + { \includegraphics [ height = \l_@@_tmpb_tl ] } + { + \includegraphics + [ width = \l_@@_tmpa_tl, height = \l_@@_tmpb_tl ] + } + } + { \includegraphics [ width = \l_@@_tmpa_tl ] } + { \l_@@_cover_logo_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_type:} +% 论文类型。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_type: + { + \tl_set:Nx \l_@@_tmpa_tl + { + \clist_item:Nn \c_@@_thesis_type_clist + { \g_@@_thesis_type_int } + } + \@@_spread_box:nn { 0.45 \textwidth } { \l_@@_tmpa_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_degree:} +% \changes{v0.7c}{2019/03/12}{允许博士学位论文使用学位类型。} +% 学位类型。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_degree: + { + \int_compare:nT { \g_@@_thesis_type_int != 3 } + { + \c_@@_fwid_left_paren_tl + \clist_item:Nn \c_@@_degree_type_clist + { \l_@@_info_degree_type_int } + \c_@@_fwid_right_paren_tl + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_info:} +% 信息栏。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_info: + { + \begin{minipage} [ c ] { \textwidth } + \centering \zihao { 4 } +% \end{macrocode} +% 读取左侧名称字段。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_department_tl, + \c_@@_name_major_tl, + \c_@@_name_author_tl, + \c_@@_name_supervisor_tl, + \c_@@_name_date_tl, + } +% \end{macrocode} +% 设置信息栏右侧宽度。读取各字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_department_tl }, + { \l_@@_info_major_tl }, + { \l_@@_info_author_tl }, + { \l_@@_info_supervisor_tl }, + { \l_@@_info_date_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \@@_spread_box:nn { 6 em } { \l_@@_tmpa_tl } + \c_@@_fwid_colon_tl + \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } + \skip_vertical:n { 1 ex } + } + \end{minipage} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_signature:N} +% 签名行。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_signature:N #1 + { + \clist_map_inline:Nn #1 + { + ##1 \c_@@_fwid_colon_tl + \@@_blank_underline:n { 6 em } + \@@_quad: + } + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{封面模板} +% +% \changes{v0.7}{2018/02/27}{使用 \pkg{xtemplate} 重构封面布局。} +% +% 声明封面对象。不需要带参数。 +% \begin{macrocode} +%<@@=fdu_cover> +\DeclareObjectType { fdu / cover } { \c_zero_int } +% \end{macrocode} +% +% \begin{macro}{\DeclareCoverTemplate,\fdu_cover_declare_template:nn} +% 声明封面模板。 +% \begin{arguments} +% \item 模板名称 +% \item 封面部件列表,以逗号分隔 +% \end{arguments} +% \begin{macrocode} +\NewDocumentCommand \DeclareCoverTemplate { m m } + { \fdu_cover_declare_template:nn {#1} {#2} } +\cs_new_protected:Npn \fdu_cover_declare_template:nn #1#2 + { + \tl_set:Nn \l_@@_template_tl {#1} +% \end{macrocode} +% 构建模板接口。 +% \begin{macrocode} + \@@_declare_template_interface:nx {#1} + { + format : tokenlist, + top-skip : skip, + bottom-skip : skip, + \clist_map_function:nN {#2} \@@_key_type:n + } +% \end{macrocode} +% 声明所用变量。 +% \begin{macrocode} + \tl_new:c { l_@@ / #1 / format_tl } + \skip_new:c { l_@@ / #1 / top_skip } + \skip_new:c { l_@@ / #1 / bottom_skip } + \clist_map_inline:nn {#2} + { + \tl_new:c { l_@@ / #1 / ##1 / content_tl } + \tl_new:c { l_@@ / #1 / ##1 / format_tl } + \skip_new:c { l_@@ / #1 / ##1 / bottom_skip } + } +% \end{macrocode} +% 声明模板代码。^^A 以下名字空间为 `fdu_cover' 而非 `fdu' +% \begin{macrocode} + \@@_declare_template_code:nxn {#1} + { + format = \exp_not:c { l_@@ / #1 / format_tl }, + top-skip = \use:c { l_@@ / #1 / top_skip }, + bottom-skip = \use:c { l_@@ / #1 / bottom_skip }, + \clist_map_function:nN {#2} \@@_key_binding:n + } + { + \AssignTemplateKeys + \tl_use:c { l_@@ / #1 / format_tl } + \__fdu_vspace:c { l_@@ / #1 / top_skip } + \clist_map_inline:nn {#2} + { + \use:c { @@ / #1 / ####1 / align:n } + { + \tl_use:c { l_@@ / #1 / ####1 / format_tl } + \tl_use:c { l_@@ / #1 / ####1 / content_tl } + \par + } + \__fdu_vspace:c { l_@@ / #1 / ####1 / bottom_skip } + } + \__fdu_vspace:c { l_@@ / #1 / bottom_skip } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_@@_template_tl} +% 保存模板名称。 +% \begin{macrocode} +\tl_new:N \l_@@_template_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_declare_template_interface:nn, +% \@@_declare_template_code:nnn, +% \@@_declare_template_interface:nx, +% \@@_declare_template_code:nxn} +% 为了展开的方便,这里需要封装 \pkg{xtemplate} 的一些函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_template_interface:nn #1#2 + { \DeclareTemplateInterface { fdu / cover } {#1} { \c_zero_int } {#2} } +\cs_new_protected:Npn \@@_declare_template_code:nnn #1#2#3 + { \DeclareTemplateCode { fdu / cover } {#1} { \c_zero_int } {#2} {#3} } +\cs_generate_variant:Nn \@@_declare_template_interface:nn { nx } +\cs_generate_variant:Nn \@@_declare_template_code:nnn { nxn } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_key_type:n} +% \begin{macrocode} +\cs_new:Npn \@@_key_type:n #1 + { + #1 / content : tokenlist, + #1 / format : tokenlist, + #1 / bottom-skip : skip, + #1 / align : choice { left, right, center, normal } = normal, + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_key_binding:n} +% \begin{macrocode} +\cs_new:Npn \@@_key_binding:n #1 + { + #1 / content = + \exp_not:c + { l_@@ / \l_@@_template_tl / #1 / content_tl }, + #1 / format = + \exp_not:c + { l_@@ / \l_@@_template_tl / #1 / format_tl }, + #1 / bottom-skip = + \exp_not:c + { l_@@ / \l_@@_template_tl / #1 / bottom_skip }, + #1 / align = + { + left = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { + \exp_not:n + { + \group_begin: + \flushleft ##1 \endflushleft + \group_end: + } + }, + right = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { + \exp_not:n + { + \group_begin: + \flushright ##1 \endflushright + \group_end: + } + }, + center = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { + \exp_not:n + { + \group_begin: + \center ##1 \endcenter + \group_end: + } + }, + normal = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { \exp_not:n { \group_begin: ##1 \group_end: } } + }, + } +%<@@=fdu> +% \end{macrocode} +% \end{macro} +% +% \subsubsection{绘制封面} +% +% \begin{macro}{\makecoveri,\makecoverii,\makecoveriii} +% 使用实例(instance)构建封一、封二、封三。 +% \begin{macrocode} +\NewDocumentCommand \makecoveri { } + { + \thispagestyle { empty } + \UseInstance { fdu / cover } { cover-i-default } + } +\NewDocumentCommand \makecoverii { } + { + \thispagestyle { empty } + \UseInstance { fdu / cover } { cover-ii-default } + } +\NewDocumentCommand \makecoveriii { } + { + \cleardoublepage + \thispagestyle { empty } + \UseInstance { fdu / cover } { cover-iii-default } + } +% \end{macrocode} +% \end{macro} +% +% 声明各封面模板组成部分。 +% \begin{macrocode} +\DeclareCoverTemplate { cover-i } + { id, logo, type, degree, title, title-en, info } +\DeclareCoverTemplate { cover-ii } { title, name-list } +\DeclareCoverTemplate { cover-iii } + { + originality-decl-name, + originality-decl-text, + originality-decl-sig, + authorization-decl-name, + authorization-decl-text, + authorization-decl-sig + } +% \end{macrocode} +% +% \changes{v0.7d}{2019/03/29}{封面中文标题改为加粗宋体(可能使用伪粗)。} +% +% 定义封面的具体配置参数。 +% \begin{macrocode} +\DeclareInstance { fdu / cover } { cover-i-default } { cover-i } + { +% format = \@@_line_spread:N \c_@@_line_spread_fp, + bottom-skip = 0 pt plus 1.5 fill, + id / content = \@@_cover_id:, + logo / content = \@@_cover_logo:, + type / content = \@@_cover_type:, + degree / content = \@@_cover_degree:, + title / content = + \@@_fixed_width_center_box:nn + { 0.9 \textwidth } { \l_@@_info_title_tl }, + title-en / content = + \@@_fixed_width_center_box:nn + { 0.9 \textwidth } { \l_@@_info_title_en_tl }, + info / content = \@@_cover_info:, + id / format = \zihao { -5 }, + type / format = \zihao { 2 }, + degree / format = \zihao { 4 }, + title / format = \zihao { -2 } \bfseries, + title-en / format = \@@_line_spread:n { 1.2 } \zihao { 4 } \bfseries, + id / bottom-skip = 0 pt plus 1.6 fill, + logo / bottom-skip = 0 pt plus 0.3 fill, + type / bottom-skip = -18 pt, + degree / bottom-skip = 0 pt plus 0.8 fill, + title-en / bottom-skip = 0 pt plus 2.5 fill, + id / align = right, + logo / align = center, + type / align = center, + degree / align = center, + title / align = center, + title-en / align = center, + info / align = center, + } +\DeclareInstance { fdu / cover } { cover-ii-default } { cover-ii } + { +% format = \@@_line_spread:N \c_@@_line_spread_fp, + title / content = + \@@_spread_box:nn { 7 em } { \c_@@_name_instructors_tl }, + name-list / content = + \clist_use:Nn \l_@@_info_instructors_clist { \par }, + title / format = \zihao { 2 } \sffamily, + name-list / format = \large, + title / align = center, + name-list / align = center, + } +\DeclareInstance { fdu / cover } { cover-iii-default } { cover-iii } + { + format = +% \@@_line_spread:n { 1.8 }, +% \@@_line_spread:n { 1.8 } \dim_set:Nn \parindent { 2 \ccwd }, + top-skip = 0 pt plus 0.2 fill, + bottom-skip = 0 pt plus 2.5 fill, + originality-decl-name / content = \c_@@_name_orig_decl_tl, + originality-decl-text / content = \c_@@_orig_decl_text_tl, + originality-decl-sig / content = + \@@_cover_signature:N \c_@@_orig_decl_sign_clist, + authorization-decl-name / content = \c_@@_name_auth_decl_tl, + authorization-decl-text / content = \c_@@_auth_decl_text_tl, + authorization-decl-sig / content = + \@@_cover_signature:N \c_@@_auth_decl_sign_clist, + originality-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { -2 } \bfseries, + authorization-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { -2 } \bfseries, + originality-decl-name / bottom-skip = 0.4 cm, + originality-decl-text / bottom-skip = 0.4 cm, + originality-decl-sig / bottom-skip = 0 pt plus 2.5 fill, + authorization-decl-name / bottom-skip = 0.4 cm, + authorization-decl-text / bottom-skip = 0.4 cm, + originality-decl-name / align = center, + originality-decl-sig / align = right, + authorization-decl-name / align = center, + authorization-decl-sig / align = right, + } +% \end{macrocode} +% +% \begin{macro}{style/auto-make-cover} +% \begin{variable}{\l_@@_auto_make_cover_bool} +% 是否自动生成封面。 +% \begin{macrocode} +\bool_new:N \l_@@_auto_make_cover_bool +\keys_define:nn { fdu / style } + { + auto-make-cover .bool_set:N = \l_@@_auto_make_cover_bool, + auto-make-cover .default:n = true + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% 在 \env{document} 开始位置添加封面以及指导小组成员名单。 +% \begin{macrocode} +\AtBeginDocument + { + \bool_if:NT \l_@@_auto_make_cover_bool + { + \begin{titlepage} + \makecoveri \newpage \makecoverii + \end{titlepage} + } + } +% \end{macrocode} +% +% 在 \env{document} 结束位置添加声明页。 +% \begin{macrocode} +\AtEndDocument + { \bool_if:NT \l_@@_auto_make_cover_bool { \makecoveriii } } +% \end{macrocode} +% +% \subsection{目录} +% +% 设置目录标题。 +% \begin{macrocode} +\keys_set:nn { ctex } + { +% contentsname = \c_@@_name_toc_tl, +% listfigurename = \c_@@_name_lof_tl, +% listtablename = \c_@@_name_lot_tl, +% \end{macrocode} +% +% 设置目录中章节标题的样式。 +% \begin{macrocode} + chapter / tocline = + { +% \normalfont \sffamily +% \bfseries + \CTEXnumberline {#1} #2 + }, + section / tocline = + { +% \bfseries + \CTEXnumberline {#1} #2 + }, + subsection / tocline = + { +% \fdu@kai + \CTEXnumberline {#1} #2 + } + } +% \end{macrocode} +% +% \changes{v0.7e}{2019/05/12}{增加对插图、表格目录的处理。} +% +% \begin{macro}{\tableofcontents,\listoffigures,\listoftables} +% 修改 \cs{tableofcontents}、\cs{listoffigures} 和 \cs{listoftables} 的定义, +% 使得页眉正确显示,并出现在目录及 PDF 书签中。来自于 \LaTeXe{} 标准文档类 +% \file{book.cls} +% \footnote{原代码中只有 \cs{tableofcontents} 的 \cs{@mkboth} 出现在 +% \cs{chapter*} 内部,这是出于兼容性的考虑而非 typo。}。 +% \begin{macrocode} +\@@_patch_cmd:Nnn \tableofcontents + { + \chapter*{\contentsname + \@mkboth{\MakeUppercase\contentsname} + {\MakeUppercase\contentsname}} + } + { \@@_chapter_no_toc:V \contentsname } +\@@_patch_cmd:Nnn \listoffigures + { + \chapter*{\listfigurename} + \@mkboth{\MakeUppercase\listfigurename} + {\MakeUppercase\listfigurename} + } + { \@@_chapter:V \listfigurename } +\@@_patch_cmd:Nnn \listoftables + { + \chapter*{\listtablename} + \@mkboth{\MakeUppercase\listtablename} + {\MakeUppercase\listtablename} + } + { \@@_chapter:V \listtablename } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@starttoc} +% 修改 \tn{@starttoc} 的定义以调整英文模板中的目录行距。 +% \begin{macrocode} +%<*class-en> +\@@_patch_cmd:Nnn \@starttoc + { \begingroup } + { + \begingroup + \@@_line_spread:N \c_@@_line_spread_fp + } +% +% \end{macrocode} +% \end{macro} +% +% \subsection{摘要} +% +% \begin{environment}{abstract} +% \begin{environment}{abstract*} +% \changes{v0.7}{2018/03/05}{整理代码。} +% 摘要环境。在中文模板定义了中英文双语摘要,但在英文模板中则没有 +% 定义中文摘要。 +% \begin{macrocode} +\NewDocumentEnvironment { abstract } { } +% { \@@_abstract_begin: } { \@@_abstract_end: } +% { \@@_abstract_en_begin: } { \@@_abstract_en_end: } +%<*class> +\NewDocumentEnvironment { abstract* } { } + { \@@_abstract_en_begin: } { \@@_abstract_en_end: } +% +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\@@_abstract_begin:,\@@_abstract_en_begin:} +% 摘要页标题。 +% \begin{macrocode} +%<*class> +\cs_new_protected:Npn \@@_abstract_begin: + { \@@_chapter:V \c_@@_name_abstract_tl } +% +\cs_new_protected:Npn \@@_abstract_en_begin: + { \@@_chapter:V \c_@@_name_abstract_en_tl } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7d}{2019/03/28}{优化关键字列表的显示。} +% +% \begin{macro}{\@@_abstract_end:,\@@_abstract_en_end:} +% 摘要正文完成后,输出关键字列表和中图分类号(CLC)。 +% \begin{macrocode} +%<*class> +\cs_new_protected:Npn \@@_abstract_end: + { + \@@_keywords:nNn + { \sffamily \c_@@_name_keywords_tl \c_@@_fwid_colon_tl } + \l_@@_info_keywords_clist { \c_@@_fwid_semicolon_tl } + \@@_clc:nn + { \sffamily \c_@@_name_clc_tl \c_@@_fwid_colon_tl } + { \l_@@_info_clc_tl } + } +% +\cs_new_protected:Npn \@@_abstract_en_end: + { + \@@_keywords:nNn + { \bfseries \c_@@_name_keywords_en_tl \@@_quad: } + \l_@@_info_keywords_en_clist { ; ~ } + \@@_clc:nn + { \bfseries \c_@@_name_clc_en_tl \@@_quad: } + { \l_@@_info_clc_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_keywords:nNn,\@@_keywords_prevdepth:,\@@_clc:nn} +% 关键字列表前要空一行,使用悬挂缩进;中图分类号不缩进。|\parbox| 之后的间距 +% 需要调整,见 \url{https://tex.stackexchange.com/a/34982}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_keywords:nNn #1#2#3 + { + \par \mode_leave_vertical: \par \noindent + \@@_get_text_width:Nn \l_@@_tmpa_dim {#1} + \group_begin: #1 \group_end: + \parbox [t] { \dim_eval:n { \textwidth - \l_@@_tmpa_dim } } + { + \clist_use:Nn #2 {#3} \par + \cs_gset:Npx \@@_keywords_prevdepth: { \dim_use:N \tex_prevdepth:D } + } + } +\cs_new_protected:Npn \@@_clc:nn #1#2 + { + \par \tex_prevdepth:D \@@_keywords_prevdepth: \noindent + \group_begin: #1 \group_end: + #2 + } +% \end{macrocode} +% \end{macro} +% +% \subsection{符号表} +% +% \begin{environment}{notation} +% \changes{v0.7}{2018/03/05}{整理代码。} +% 符号表环境,利用 \env{longtable} 封装。可选参数为表格列格式说明符。 +% \begin{macrocode} +\NewDocumentEnvironment { notation } { O { l p { 7.5 cm } } } + { + \@@_notation_begin: + \group_begin: + \@@_notation_long_table_setup: + \longtable {#1} + } + { + \endlongtable + \group_end: + } +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\@@_notation_begin:} +% 符号表页标题。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_notation_begin: + { +% \@@_chapter:V \c_@@_name_notation_tl +% \@@_chapter:V \c_@@_name_notation_en_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_notation_long_table_setup:} +% 调整 \cs{LTpre} 和 \cs{LTpost},以删去 \env{longtable} 前后的空白。 +% 英文模板中还需要调整表格的行距。注意 \tn{arraystretch} 只是一个简单 +% 宏,不能使用 \cs{fp_set:Nn}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_notation_long_table_setup: + { +% \tl_set:Nn \arraystretch { 1.3 } + \dim_set_eq:NN \LTpre \c_zero_dim + \dim_set_eq:NN \LTpost \c_zero_dim + } +% \end{macrocode} +% \end{macro} +% +% \subsection{参考文献著录与引用} +% +% \changes{v0.6}{2017/10/27}{支持 \BibTeX{},以实现参考文献的著录 +% 与引用。} +% \changes{v0.7}{2018/01/25}{支持 \biber{} 与 \pkg{biblatex}。} +% +% \begin{variable}{\l_@@_bibtex_bool} +% 是否使用 \BibTeX{} 作为参考文献处理程序。若为否,则使用 +% \pkg{biblatex}/\biber{}。 +% \begin{macrocode} +\bool_new:N \l_@@_bibtex_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_bib_style_tl,\l_@@_bib_gb_style_tl, +% \l_@@_cite_style_tl} +% 保存参考文献及引用样式。 +% \begin{macrocode} +\tl_new:N \l_@@_bib_style_tl +\tl_new:N \l_@@_bib_gb_style_tl +\tl_new:N \l_@@_cite_style_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_bib_resource_clist} +% \changes{v0.7f}{2021/03/07}{改用 \texttt{clist} 型变量,允许在 \pkg{biblatex} 下 +% 使用多个数据源。} +% 保存参考文献数据库列表。 +% \begin{macrocode} +\clist_new:N \l_@@_bib_resource_clist +% \end{macrocode} +% \end{variable} +% +% \changes{v0.6}{2017/10/28}{新增 \opt{style/bib-style} 选项。} +% \changes{v0.7}{2018/01/25}{新增 \opt{style/bib-backend}、\opt{style/cite-style} +% 和 \opt{style/bib-resource} 选项。} +% +% \begin{macrocode} +\keys_define:nn { fdu / style } + { +% \end{macrocode} +% \begin{macro}{style/bib-backend} +% 参考文献后端。 +% \begin{macrocode} + bib-backend .choice:, + bib-backend .value_required:n = true, + bib-backend / bibtex .code:n = + { \bool_set_true:N \l_@@_bibtex_bool }, + bib-backend / biblatex .code:n = + { \bool_set_false:N \l_@@_bibtex_bool }, +% \end{macrocode} +% \end{macro} +% \begin{macro}{style/bib-style} +% 参考文献样式。 +% \begin{macrocode} + bib-style .choice:, + bib-style .value_required:n = true, + bib-style / numerical .code:n = + { + \tl_set:Nn \l_@@_bib_gb_style_tl { numerical } + \tl_clear:N \l_@@_bib_style_tl + }, + bib-style / author-year .code:n = + { + \tl_set:Nn \l_@@_bib_gb_style_tl { author-year } + \tl_clear:N \l_@@_bib_style_tl + }, + bib-style / unknown .code:n = + { \tl_set_eq:NN \l_@@_bib_style_tl \l_keys_value_tl }, +% \end{macrocode} +% \end{macro} +% \begin{macro}{style/cite-style} +% 引用样式。 +% \begin{macrocode} + cite-style .code:n = + { + \bool_if:NTF \l_@@_bibtex_bool + { \@@_warning:n { cite-style-not-available } } + { \tl_set:Nn \l_@@_cite_style_tl {#1} } + }, +% \end{macrocode} +% \end{macro} +% \begin{macro}{style/bib-resource} +% 参考文献数据源。 +% \begin{macrocode} + bib-resource .clist_set:N = \l_@@_bib_resource_clist + } +\@@_msg_new:nn { cite-style-not-available } + { Option~ "cite-style"~ is~ not~ available~ in~ BibTeX. } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7f}{2021/03/28}{正确使用导言区末尾钩子。} +% +% 为了保证导言区中的设置能起作用,\pkg{natbib} 或 \pkg{biblatex} 宏包均需要在 +% 导言区末尾载入(仍在 \pkg{hyperref} 之前),并做相关设置。 +% \begin{macrocode} +\ctex_at_end_preamble:n + { + \bool_if:NT \l_@@_bibtex_bool + { + \RequirePackage [ sort & compress ] { natbib } + \@@_bibtex_setup: + } + } +\AddToHook + { env/document/begin } + { + \bool_if:NF \l_@@_bibtex_bool + { + \@@_biblatex_pre_setup: + \RequirePackage { biblatex } + \@@_biblatex_post_setup: + } + } +% \end{macrocode} +% +% \changes{v0.7}{2018/01/25}{统一使用 \cs{printbibliography} 命令 +% 生成参考文献列表。} +% \changes{v0.7d}{2019/03/23}{使参考文献在目录中正常显示。} +% \changes{v0.7e}{2020/08/30}{同步 \pkg{gbt7714} v2.0。} +% +% \begin{macro}{\@@_bibtex_setup:,\bibsection,\printbibliography} +% \BibTeX{} 相关设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_bibtex_setup: + { + \tl_if_empty:NTF \l_@@_bib_style_tl + { + \tl_if_eq:VnTF \l_@@_bib_gb_style_tl { numerical } + { + \bibliographystyle { gbt7714-numerical } + \@@_set_cite_style_numerical: + } + { + \tl_if_eq:VnT \l_@@_bib_gb_style_tl { author-year } + { + \bibliographystyle { gbt7714-author-year } + \@@_set_cite_style_author_year: + \cs_set_eq:NN \cite \citep + } + } + } + { \exp_args:NV \bibliographystyle \l_@@_bib_style_tl } +% \end{macrocode} +% 修改参考文献标题。 +% \begin{macrocode} + \cs_set:Npn \bibsection { \@@_chapter:V \bibname } +% \end{macrocode} +% \BibTeX{} 下接口与 \pkg{biblatex} 保持统一。 +% \begin{macrocode} + \NewDocumentCommand \printbibliography { o } + { + \exp_args:NV \bibliography \l_@@_bib_resource_clist + \IfValueT {##1} + { \@@_warning:nn { invalid-option-in-bibtex } {##1} } + } + } +\@@_msg_new:nn { invalid-option-in-bibtex } + { Option(s)~ "#1"~ are~ invalid~ in~ BibTeX. } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \@@_biblatex_pre_setup:, +% \@@_biblatex_post_setup:, +% \@@_pass_options_to_biblatex:n} +% \pkg{biblatex} 相关设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_biblatex_pre_setup: + { +% \end{macrocode} +% 参考文献样式。 +% \begin{macrocode} + \tl_if_empty:NTF \l_@@_bib_style_tl + { + \tl_if_eq:VnTF \l_@@_bib_gb_style_tl { numerical } + { \@@_pass_options_to_biblatex:n { style = gb7714-2015 } } + { + \tl_if_eq:VnT \l_@@_bib_gb_style_tl { author-year } + { \@@_pass_options_to_biblatex:n { style = gb7714-2015ay } } + } + } + { \@@_pass_options_to_biblatex:n { style = \l_@@_bib_style_tl } } +% \end{macrocode} +% 引用样式。 +% \changes{v0.7f}{2021/03/09}{正确调用引用样式。} +% \begin{macrocode} + \tl_if_empty:NF \l_@@_cite_style_tl + { \@@_pass_options_to_biblatex:n { citestyle = \l_@@_cite_style_tl } } + \@@_pass_options_to_biblatex:n { backend = biber, hyperref = manual, natbib } + } +\cs_new_protected:Npn \@@_biblatex_post_setup: + { + \clist_map_function:NN \l_@@_bib_resource_clist \addbibresource + \@@_biblatex_allow_url_break: +% \end{macrocode} +% 修改参考文献标题。 +% \begin{macrocode} + \defbibheading { bibliography } [ \bibname ] { \@@_chapter:n {##1} } +%<*class-en> + \exp_args:Nnx \DefineBibliographyStrings { english } + { bibliography = { \c_@@_name_bib_en_tl } } +% + } +\cs_new_protected:Npn \@@_pass_options_to_biblatex:n #1 + { \PassOptionsToPackage {#1} { biblatex } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_biblatex_allow_url_break:} +% \pkg{biblatex} 下允许 URL 在字母、数字和一些特殊符号处断行。 +% \begin{macrocode} +\cs_new:Npn \@@_biblatex_allow_url_break: + { + \int_set_eq:NN \c@biburlucpenalty \c_one_int + \int_set_eq:NN \c@biburlnumpenalty \c_one_int + \int_set_eq:NN \c@biburllcpenalty \c_one_int + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_cite_style_numerical:} +% 顺序编码制下的引用样式。 +% \begin{macrocode} +\cs_new:Npn \@@_set_cite_style_numerical: + { + \NAT@numberstrue \NAT@supertrue + \cs_set:Npn \NAT@open { [ } + \cs_set:Npn \NAT@close { ] } + \cs_set:Npn \NAT@sep { ,~ } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_cite_style_author_year:} +% 著者—出版年制下的引用样式。 +% \begin{macrocode} +\cs_new:Npn \@@_set_cite_style_author_year: + { + \NAT@numbersfalse +%<*class> + \cs_set_eq:NN \NAT@open \c_@@_fwid_left_paren_tl + \cs_set_eq:NN \NAT@close \c_@@_fwid_right_paren_tl + \cs_set_eq:NN \NAT@sep \c_@@_fwid_semicolon_tl + \cs_set_eq:NN \NAT@aysep \c_@@_fwid_comma_tl + \cs_set_eq:NN \NAT@yrsep \c_@@_ideo_comma_tl +% + } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.7}{2018/01/25}{同步 \pkg{gbt7714} v1.0,移除有关超链接 +% 的额外设置。} +% +% \subsection{\pkg{hyperref} 相关配置} +% +% \changes{v0.4}{2017/08/13}{新增 \pkg{hyperref} 相关配置,包括超链接 +% 样式(\opt{style/hyperlink} 与 \opt{style/hyperlink-color} 选项) +% 及 PDF 元信息等。} +% \changes{v0.7}{2018/01/23}{将 \pkg{hyperref} 相关配置移至模板末尾, +% 以减少冲突。} +% +% \begin{macro}{\hypersetup,\fdu_hyperref_setup:n} +% \pkg{hyperref} 宏包是在导言区之后才引入的。若要在导言区中使用 +% \tn{hypersetup} 命令,必须另行定义。 +% \begin{macrocode} +\NewDocumentCommand \hypersetup { m } + { \fdu_hyperref_setup:n {#1} } +\cs_new_protected:Npn \fdu_hyperref_setup:n #1 + { \clist_gput_right:Nn \g_@@_to_hyperref_clist {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_hyperlink_color_key:n} +% 设置超链接颜色选项。最后的逗号用于确保 \pkg{l3keys} 可以正确解析,不能省去。 +% \begin{macrocode} +\cs_new:Npn \@@_set_hyperlink_color_key:n #1 + { + hyperlink-color / \clist_item:nn {#1} {1} .code:n = + { + \@@_define_hyperlink_color:nnn + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } + \fdu_hyperref_setup:n + { + linkcolor = fdu@link, linkbordercolor = fdu@link, + urlcolor = fdu@url, urlbordercolor = fdu@url, + citecolor = fdu@cite, citebordercolor = fdu@cite + } + }, + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_define_hyperlink_color:nnn} +% 定义超链接颜色。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_define_hyperlink_color:nnn #1#2#3 + { + \definecolorset { HTML } { fdu@ } { } + { link, #1; url, #2; cite, #3 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\keys_define:nx { fdu / style } + { +% \end{macrocode} +% +% \begin{macro}{style/hyperlink} +% 超链接样式。 +% \begin{macrocode} + hyperlink .choice:, + hyperlink .value_required:n = true, + hyperlink / border .code:n = { }, + hyperlink / color .code:n = + { \fdu_hyperref_setup:n { colorlinks = true } }, + hyperlink / none .code:n = + { \fdu_hyperref_setup:n { hidelinks = true } }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{style/hyperlink-color} +% 超链接颜色。 +% \begin{macrocode} + hyperlink-color .choice:, + hyperlink-color .value_required:n = true, + \clist_map_function:nN + { + { autumn, D70000, D75F00, AF8700 }, + { business, D14542, 295497, 1F6E43 }, + { classic, FF0000, 0000FF, 00FF00 }, + { default, 990000, 0000B2, 007F00 }, + { elegant, 961212, C31818, 9B764F }, + { fantasy, FF4A19, FF3F94, 934BA1 }, + { material, E91E63, 009688, 4CAF50 }, + { science, CA0619, 389F9D, FF8920 }, + { summer, 00AFAF, 5F5FAF, 5F8700 }, + { graylevel, 616161, 616161, 616161 }, + { prl, 2D3092, 2D3092, 2D3092 } + } + \@@_set_hyperlink_color_key:n + } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.6}{2017/10/29}{优化 URL 断行设置。} +% +% \begin{macro}{\fdu_allow_url_break:,\@@_add_url_break_points:} +% 允许 URL 在字母、数字和一些特殊符号处断行。见 +% \url{https://bit.ly/2hhIjLW}。 +% \begin{macrocode} +\cs_new:Npn \fdu_allow_url_break: + { + \cs_new:Npn \@@_add_url_break_points: + { \tl_map_function:NN \c_@@_url_break_points_tl \do } + \@@_appto_cmd:Nn \UrlBreaks + { \UrlOrds \@@_add_url_break_points: } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\c_@@_url_break_points_tl} +% 额外的断行位置是 26 个英文字母(大小写)以及 10 个阿拉伯数字。 +% \pkg{url} 提供的宏 \tn{UrlBreaks} 还包含了特殊符号 |*|、|-|、 +% |~|、|'|、|"|、|-|,也被设置为允许断行。 +% \begin{macrocode} +\tl_const:Nn \c_@@_url_break_points_tl + { + abcdefghijklmnopqrstuvwxyz + ABCDEFGHIJKLMNOPQRSTUVWXYZ + 0123456789 + } +% \end{macrocode} +% \end{variable} +% +% \changes{v0.7e}{2019/04/23}{处理 \pkg{hyperref} 与 \pkg{unicode-math} 的兼容性问题。} +% +% 在导言区末尾引入 \pkg{hyperref} 宏包。 +% \begin{macrocode} +\ctex_at_end_preamble:n + { + \RequirePackage { hyperref } +% \end{macrocode} +% 此后 \tn{hypersetup} 命令由 \pkg{hyperref} 宏包接管。 +% \begin{macrocode} + \hypersetup + { + bookmarksnumbered = true, + psdextra = true, + unicode = true, +% \end{macrocode} +% 填写 PDF 元信息。 +% \begin{macrocode} +%<*class> + pdftitle = \l_@@_info_title_tl, + pdfauthor = \l_@@_info_author_tl, + pdfkeywords = \l_@@_info_keywords_clist, +% +%<*class-en> + pdftitle = \l_@@_info_title_en_tl, + pdfauthor = \l_@@_info_author_en_tl, + pdfkeywords = \l_@@_info_keywords_en_clist, +% +% pdfsubject = , + pdfcreator = \c_@@_name_pdf_creator_tl + } +% \end{macrocode} +% 将导言区中通过 \cs{fdu_hyperref_setup:n} 进行的设置传入 +% \tn{hypersetup}。 +% \begin{macrocode} + \exp_args:NV \hypersetup \g_@@_to_hyperref_clist +% \end{macrocode} +% URL 断行处理。 +% \begin{macrocode} + \fdu_allow_url_break: +% \end{macrocode} +% 手动开启 \pkg{biblatex} 的 \pkg{hyperref} 支持。 +% \begin{macrocode} + \bool_if:NF \l_@@_bibtex_bool { \BiblatexManualHyperrefOn } + } +% \end{macrocode} +% +% 在 PDF 字符串中设置 \tn{fdu@kai} 命令为空,以抑制 \pkg{hyperref} +% 的警告信息。 +% \begin{macrocode} +\ctex_at_end_package:nn { hyperref } + { + \pdfstringdefDisableCommands + { + \cs_set_eq:NN \fdu@kai \prg_do_nothing: + \cs_set_eq:NN \quad \c_space_tl + \cs_set_eq:NN \qquad \c_space_tl + } + } +% \end{macrocode} +% +% \subsection{用户接口} +% +% \begin{macro}{info,style} +% 定义元(meta)键值对。 +% \begin{macrocode} +\keys_define:nn { fdu } + { + info .meta:nn = { fdu / info } {#1}, + style .meta:nn = { fdu / style } {#1} + } +% \end{macrocode} +% \end{macro} +% +% 文档类初始设置。 +% \begin{macrocode} +\keys_set:nn { fdu } + { + style / font = times, +% style / cjk-font = fandol, + style / font-size = -4, +% style / fullwidth-stop = false, + style / auto-make-cover = true, + style / logo = { fudan-name.pdf }, + style / logo-size = { 0.5 \textwidth }, + style / hyperlink = color, + style / hyperlink-color = default, + style / bib-style = numerical, + info / degree = academic, + info / secret-level = none, + info / school-id = { 10246 }, + info / date = { \zhtoday }, +% theorem / header-font = { \sffamily }, +% theorem / header-font = { \bfseries \upshape }, +% theorem / body-font = { \fdu@kai }, +% theorem / body-font = { \itshape }, + theorem / counter = { chapter } + } +% \end{macrocode} +% +% \begin{macro}{\fdusetup} +% 用户设置接口。 +% \begin{macrocode} +\NewDocumentCommand \fdusetup { m } + { \keys_set:nn { fdu } {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{proof} +% \begin{environment}{axiom} +% \begin{environment}{corollary} +% \begin{environment}{definition} +% \begin{environment}{example} +% \begin{environment}{lemma} +% \begin{environment}{theorem} +% 模板预定义的常用数学环境。 +% 其中的“证明”比较特殊,它不编号,但会添加证毕符号。 +% \begin{macrocode} +%<*class> +\newtheorem* { proof } { \c_@@_name_proof_tl } +\newtheorem { axiom } { \c_@@_name_axiom_tl } +\newtheorem { corollary } { \c_@@_name_corollary_tl } +\newtheorem { definition } { \c_@@_name_definition_tl } +\newtheorem { example } { \c_@@_name_example_tl } +\newtheorem { lemma } { \c_@@_name_lemma_tl } +\newtheorem { theorem } { \c_@@_name_theorem_tl } +% +%<*class-en> +\newtheorem* { proof } { \c_@@_name_proof_en_tl } +\newtheorem { axiom } { \c_@@_name_axiom_en_tl } +\newtheorem { corollary } { \c_@@_name_corollary_en_tl } +\newtheorem { definition } { \c_@@_name_definition_en_tl } +\newtheorem { example } { \c_@@_name_example_en_tl } +\newtheorem { lemma } { \c_@@_name_lemma_en_tl } +\newtheorem { theorem } { \c_@@_name_theorem_en_tl } +% +% +% \end{macrocode} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% +% \subsection{模板参数配置文件} +% +% \changes{v0.3}{2017/06/27}{分离文档类与参数配置文件。} +% +% \begin{macrocode} +%<*definition> +% \end{macrocode} +% +% \subsubsection{通用配置} +% +% \begin{variable}{\c_@@_name_simp_tl,\c_@@_name_trad_tl, +% \c_@@_name_en_tl} +% 学校名称。 +% \begin{macrocode} +\tl_const:Nn \c_@@_name_simp_tl { 复旦大学 } +\tl_const:Nn \c_@@_name_trad_tl { 復旦大學 } +\tl_const:Nn \c_@@_name_en_tl { Fudan~ University } +% \end{macrocode} +% \end{variable} +% +% 常用标点符号,见表~\ref{tab:punctuations}。 +% \begin{macrocode} +\clist_map_inline:nn + { + { ideo_comma } { "3001 }, + { ideo_full_stop } { "3002 }, + { fwid_comma } { "FF0C }, + { fwid_full_stop } { "FF0E }, + { fwid_colon } { "FF1A }, + { fwid_semicolon } { "FF1B }, + { fwid_left_paren } { "FF08 }, + { fwid_right_paren } { "FF09 } + } + { \@@_define_punct:nn #1 } +% \end{macrocode} +% +% \begin{table}[ht] +% \caption{常用标点符号} +% \label{tab:punctuations} +% \centering +% \begin{tabular}{cccc} +% \toprule +% \textbf{中文名称} & \textbf{英文名称} & \textbf{符号} & \textbf{Unicode} \\ +% \midrule +% 中文顿号 & Ideographic comma & \symbol{"3001} & U+3001 \\ +% 中文句号 & Ideographic full stop & \symbol{"3002} & U+3002 \\ +% 中文逗号 & Fullwidth comma & \symbol{"FF0C} & U+FF0C \\ +% 全角西文句点 & Fullwidth full stop & \symbol{"FF0E} & U+FF0E \\ +% 中文冒号 & Fullwidth colon & \symbol{"FF1A} & U+FF1A \\ +% 中文分号 & Fullwidth semicolon & \symbol{"FF1B} & U+FF1B \\ +% 中文左圆括号 & Fullwidth left parenthesis & \symbol{"FF08} & U+FF08 \\ +% 中文右圆括号 & Fullwidth right parenthesis & \symbol{"FF09} & U+FF09 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \begin{variable}{\c_@@_line_spread_fp} +% 行距倍数。行距倍数 $k$ 由下式确定: +% \begin{equation*} +% \num{1.2} \times k \times \SI{12}{bp} = \SI{20}{pt}. +% \end{equation*} +% 式中,\num{1.2} 是基本行距与文字大小之比,\SI{12}{bp} 是小四号字 +% 的大小,\SI{20}{pt} 是行距固定值。 +% \begin{macrocode} +\fp_const:Nn \c_@@_line_spread_fp + { \dim_ratio:nn { 20 pt } { 12 bp } / 1.2 } +% \end{macrocode} +% \end{variable} +% +% \subsubsection{声明页} +% +% \begin{variable}{\c_@@_orig_decl_text_tl} +% 论文独创性声明。 +% \begin{macrocode} +\tl_const:Nn \c_@@_orig_decl_text_tl + { + 本人郑重声明:所呈交的学位论文,是本人在导师的指导下,独立进行研究 + 工作所取得的成果。论文中除特别标注的内容外,不包含任何其他个人或机 + 构已经发表或撰写过的研究成果。对本研究做出重要贡献的个人和集体,均 + 已在论文中作了明确的声明并表示了谢意。本声明的法律结果由本人承担。 + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_auth_decl_text_tl} +% 论文使用授权声明。 +% \begin{macrocode} +\tl_const:Nn \c_@@_auth_decl_text_tl + { + 本人完全了解复旦大学有关收藏和利用博士、硕士学位论文的规定,即:学 + 校有权收藏、使用并向国家有关部门或机构送交论文的印刷本和电子版本; + 允许论文被查阅和借阅;学校可以公布论文的全部或部分内容,可以采用影 + 印、缩印或其它复制手段保存论文。涉密学位论文在解密后遵守此规定。 + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_orig_decl_sign_clist, +% \c_@@_auth_decl_sign_clist} +% 声明页签名项目。 +% \begin{macrocode} +\clist_const:Nn \c_@@_orig_decl_sign_clist + { 作者签名, 日期 } +\clist_const:Nn \c_@@_auth_decl_sign_clist + { 作者签名, 导师签名, 日期 } +% \end{macrocode} +% \end{variable} +% +% \subsubsection{杂项} +% +% \begin{variable}{\c_@@_thesis_type_clist, +% \c_@@_degree_type_clist} +% 论文类型与学位类型。 +% \begin{macrocode} +\clist_const:Nn \c_@@_thesis_type_clist + { 博士学位论文, 硕士学位论文, 本科毕业论文 } +\clist_const:Nn \c_@@_degree_type_clist + { 学术学位, 专业学位 } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_secret_clist} +% 三种密级。 +% \begin{macrocode} +\clist_const:Nn \c_@@_secret_clist { 秘密, 机密, 绝密 } +% \end{macrocode} +% \end{variable} +% +% 默认名称。注意空格是忽略掉的。 +% \begin{macrocode} +\clist_map_inline:nn + { + { secret_level } { 密 \qquad 级 }, + { secret_star } { \textrm { \bigstar } }, + { school_id } { 学校代码 }, + { student_id } { 学 \qquad 号 }, + { department } { 院系 }, + { major } { 专业 }, + { author } { 姓名 }, + { supervisor } { 指导教师 }, + { date } { 完成日期 }, + { instructors } { 指导小组成员 }, + { author_sign } { 作者签名 }, + { supervisor_sign } { 导师签名 }, + { sign_date } { 日期 }, + { toc } { 目 \quad 录 }, + { lof } { 插图目录 }, + { lot } { 表格目录 }, + { bib_en } { Bibliography }, + { pdf_creator } { LaTeX~ with~ fduthesis~ class }, + { orig_decl } { \c_@@_name_simp_tl \\ 学位论文独创性声明 }, + { auth_decl } { \c_@@_name_simp_tl \\ 学位论文使用授权声明 } + } + { \@@_define_name:nn #1 } +\clist_map_inline:nn + { + { abstract } { 摘 \quad 要 } { Abstract }, + { keywords } { 关键字 } { Keywords: }, + { clc } { 中图分类号 } { CLC~ number: }, + { notation } { 符号表 } { List~ of~ Symbols } + } + { \@@_define_name:nnn #1 } +% \end{macrocode} +% +% 默认定理头名称。 +% \begin{macrocode} +\clist_map_inline:nn + { + { proof } { 证明 } { Proof }, + { axiom } { 公理 } { Axiom }, + { corollary } { 推论 } { Corollary }, + { definition } { 定义 } { Definition }, + { example } { 例 } { Example }, + { lemma } { 引理 } { Lemma }, + { theorem } { 定理 } { Theorem } + } + { \@@_define_name:nnn #1 } +% +%<@@=> +% \end{macrocode} +% +% \clearpage +% +% \end{implementation} +%