% \iffalse meta-comment % !TEX program = XeLaTeX % % DO NOT REMOVE THE MARK MANUALLY (used in l3build) -> % % %<*internal> \iffalse % %<*internal> \fi \begingroup \def\nameofLaTeXe{LaTeX2e} \expandafter\endgroup\ifx\fmtname\nameofLaTeXe\else \csname fi\endcsname % %<*install> \input docstrip \keepsilent \askforoverwritefalse \preamble Copyright (C) 2013-2014 by Xu Cheng 2014- by hust-latex 2024- by HUANG Yuxi 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. This version of this license is in https://www.latex-project.org/lppl/lppl-1-3c.txt and the latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX version 2008 or later. This work has the LPPL maintenance status "maintained". The Current Maintainer of this work is HUANG Yuxi . \endpreamble \postamble This work consists of the files \jobname.dtx and the derived files \jobname.ins, \jobname.cls, \jobname-doc.sty, \jobname-m.def, \jobname-d.def, \jobname.cbx, \jobname.bbx. \endpostamble \generate { % %<*internal> \usedir{source/latex/\jobname} \file{\jobname.ins}{\from{\jobname.dtx}{install}} % %<*install> \usedir{tex/latex/\jobname} \file{\jobname.cls}{\from{\jobname.dtx}{class}} \file{\jobname-doc.sty}{\from{\jobname.dtx}{doc-sty}} \file{\jobname-m.def}{\from{\jobname.dtx}{def-m}} \file{\jobname-d.def}{\from{\jobname.dtx}{def-d}} \file{\jobname.cbx}{\from{\jobname.dtx}{cbx}} \file{\jobname.bbx}{\from{\jobname.dtx}{bbx}} } \Msg{*********************************************************} \Msg{*} \Msg{* To finish the installation you have to move the} \Msg{* following file into a directory searched by TeX:} \Msg{*} \Msg{* \space\space \jobname.cls} \Msg{* \space\space \jobname.cbx} \Msg{* \space\space \jobname.bbx} \Msg{* \space\space \jobname-m.def} \Msg{* \space\space \jobname-d.def} \Msg{* \space\space hust-title.pdf} \Msg{*} \Msg{* To produce the documentation run the file \jobname.dtx} \Msg{* through LuaLaTeX.} \Msg{*} \Msg{* Happy TeXing!} \Msg{*} \Msg{*********************************************************} \endbatchfile % %<*internal> \fi % %\NeedsTeXFormat{LaTeX2e}[2024-11-01] %\ProvidesExplClass{hustthesis} %\ProvidesExplClass{hustthesis-doc} %\ProvidesExplFile{hustthesis-m.def} %\ProvidesExplFile{hustthesis-d.def} %\ProvidesFile{hustthesis.cbx}[Citation style for the hustthesis class] %\ProvidesFile{hustthesis.bbx}[Bibliography style for the hustthesis class] % {2025-02-27}{2.0.0} % % {Thesis Template for Huazhong University of Science and Technology} % {Documentation for the hustthesis class} % {Definition file for the hustthesis class in master thesis} % {Definition file for the hustthesis class in doctoral thesis} %<*driver> \documentclass[]{\jobname} \usepackage{useclass} % Protect \maketitile from the redefinition in \cls{article} in \cls{l3doc}. \let\maketitleold=\maketitle \useclass*[full]{l3doc} \let\maketitle=\maketitleold \usepackage{\jobname-doc} \usepackage{mdframed} \begin{filecontents}[overwrite]{\jobname.bib} @online{huang2024useclass, title = {The useclass.sty Package: Load Classes as Packages}, author = {Huang, Yuxi}, year = {2024}, month = {mar}, day = {06}, url = {https://github.com/huangyxi/useclass}, } @online{zeng2023fduthesis, title = {\cls{fduthesis}: 复旦大学论文模板}, author = {曾, 祥东}, year = {2023}, month = {may}, day = {27}, url = {https://github.com/stone-zeng/fduthesis}, } @online{sjtug2024SJTUTeX, title = {\cls{SJTU\TeX}: 上海交通大学文档类集}, author = {SJTUG}, year = {2024}, month = {feb}, day = {18}, url = {https://github.com/sjtug/SJTUTeX}, } @online{njulug2023njuthesis, title = {南京大学学位论文模板}, author = {南京大学~Linux~用户组}, year = {2023}, month = {dec}, day = {05}, url = {https://github.com/nju-lug/NJUThesis}, } @online{hu2024bib, title = {符合 GB/T 7714-2015 标准的 biblatex 参考文献样式}, author = {胡振震}, year = {2024}, month = {nov}, day = {15}, url = {https://github.com/hushidong/biblatex-gb7714-2015}, } \end{filecontents} \begin{filecontents}[overwrite]{\jobname-fmt.bib} @book{YanMingLi2006CFGZhuang, title = {CFG桩复合地基技术及工程实践}, author = {{闫明礼} and {张东刚}}, date = {2006}, edition = {2}, publisher = {中国水利水电出版社}, location = {北京} } @book{chalfi1998GreenFluo, title = {Green fluorescent protein: properties, applications, and protocols}, editor = {Chalfie, Martin and {Steven R. Kain}}, date = {1998}, publisher = {Wiley-interscience}, location = {Hoboken, New Jersey}, pagetotal = {385} } @article{ZhanXiangHong2004ZhongYiY, title = {中医药防治阿尔茨海默病实验研究述要}, author = {{詹向红} and {李德新}}, date = {2004}, journaltitle = {中医药学刊}, volume = {22}, number = {11}, pages = {2094--2096} } @article{lein2007Genomewide, title = {Genome-wide atlas of gene expression in the adult mouse brain}, author = {Lein, Ed S. and Hawrylycz, Michael J. and Ao, Nancy and Ayres, Mikael and Bensinger, Amy and Bernard, Amy and Boe, Andrew F., et al.}, date = {2007-01}, journaltitle = {Nature}, volume = {445}, number = {7124}, pages = {168--176}, publisher = {Nature Publishing Group} } @article{bouxse2010Guidelines, title = {Guidelines for Assessment of bone microstructure in rodents using micro--computed tomography}, author = {Bouxsein, Mary L and Boyd, Stephen K and Christiansen, Blaine A and Guldberg, Robert E and Jepsen, Karl J and M\"uller, Ralph}, date = {2010}, journaltitle = {Journal of Bone and Mineral Research}, volume = {25}, number = {7}, pages = {1468--1486} } @inproceedings{yamaki2018Performanc, title = {Performance evaluation of phase-only correlation functions from the viewpoint of correlation {{Filters}}}, booktitle = {2018 {{Asia-Pacific Signal}} and {{Information Processing Association Annual Summit}} and {{Conference}} ({{APSIPA ASC}})}, author = {Yamaki, Shunsuke and Abet, Masahide and Kawamata, Masayuki and Yoshizawa, Makoto}, date = {2019}, pages = {1361--1364}, publisher = {Proceedings of the IEEE}, location = {Honolulu, HI, USA, 12-15 Nov. 2018} } @article{yao2017BuildingE, title = {Building efficient key-value stores via a lightweight compaction tree}, author = {Yao, Ting and Wan, Jiguang and Huang, Ping and He, Xubin and Wu, Fei and Xie, Changsheng}, date = {2017-11-24}, journaltitle = {ACM Trans. Storage}, volume = {13}, number = {4}, pages = {1--28} } @patent{LiuJiaLin1993DuoGongN, type = {patent}, title = {多功能一次性压舌板}, author = {刘加林}, holder = {{Individual}}, date = {1993-04-14}, number = {ZL92214985. 2}, location = {中国} } @thesis{LiQingQuan1998JiYuHun, type = {博士学位论文}, title = {基于混合结构的三维GIS数据模型与空间分析研究}, author = {{李清泉}}, namea = {{李德仁}}, nameatype = {collaborator}, date = {1998}, location = {武汉}, institution = {武汉大学武汉测绘科技大学} } \end{filecontents} \addbibresource{\jobname-fmt.bib} \addbibresource{\jobname.bib} \providecommand{\name}{\jobname} \providecommand{\clsname}{\cls{\name}} \begin{document} \DocInput{\jobname.dtx} \PrintChanges \PrintIndex \end{document} % % \fi % % \changes{v2.0.0}{2024-10-01}{使用 \LaTeX3 语法重构} % \changes{v2.0.0}{2024-10-01}{使用 \cls{useclass} 实现文档类“自举”} % % \hustsetup { % info = % { % title = { \clsname{} v2.0.0:华中科技大学研究生学位论文\LaTeX{}文档类使用说明 }, % % title* = { \clsname{} v2.0.0: \LaTeX{} Thesis Template for Huazhong University of Science and Technology }, % % degree = { academic }, % degree* = { Engineering }, % author = { 黄宇希 }, % author* = { HUANG Yuxi }, % major = { \LaTeX{} 文档类设计 }, % major* = { \LaTeX{} Template Design }, % supervisor = { \TeX{}Book\quad{} 教授 }, % supervisor* = { Prof.~ \TeX{}Book }, %date={2025-02-27}, % }, % } % % \maketitle % \frontmatter % \begin{abstract} % \clsname{} 是华中科技大学研究生学位论文\LaTeX{}\emph{非官方}文档类。 % 2.0.0 起版使用 \LaTeX3 语法重构,并且不再兼容之前的版本。 % 目前仅支持\emph{中文硕士和博士}学位论文。 % % 本文档类遵循 \LaTeX{} 项目公共许可证 1.3c(\LaTeX Project Public License 1.3c 版)的相关规定进行分发和修改。 % 使用本文档类即表示您已知悉并同意该许可证的条款。 % 本文档类按“原样”提供,不附带任何明示或暗示的保证,包括但不限于适销性或特定用途的适用性。 % 作者不对因使用本文档类导致的任何直接或间接损失承担责任。 % 请在修改和分发本文档类时遵循许可证的相关要求,以确保其完整性和可维护性。 % % 本项目代码托管在 GitHub \url{https://github.com/hust-latex/hustthesis}, % 最新版的 \clsname{} 文档类手册请访问 % \url{https://github.com/hust-latex/hustthesis/releases/latest/download/hustthesis.pdf}。 % % \keywords 华中科技大学;学位论文文档类;\LaTeX;\LaTeX3 % \end{abstract} % % \begin{abstract*} % \clsname{} is an Unofficial \LaTeX{} thesis template for Huazhong University of Science and Technology. % Version 2.0.0 and later are written in \LaTeX3 and are not compatible with previous versions. % Currently, it only supports Science and Engineering master's and doctoral theses in Chinese. % % This template is distributed and modified under the terms of the \LaTeX Project Public License 1.3c. % By using this template, you acknowledge and agree to the terms of this license. % This template is provided ``as is'' without any express or implied warranty, including but not limited to % merchantability or fitness for a particular purpose. % The author is not responsible for any direct or indirect losses arising from the use of this template. % Please follow the relevant requirements of the license when modifying and distributing this template % to ensure its integrity and maintainability. % % This project is hosted on GitHub % \url{github.com/hust-latex/hustthesis}, % and the latest version of the \clsname{} documentation can be found at % \url{github.com/hust-latex/hustthesis/releases/latest/download/hustthesis.pdf}. % % \keywords* Huazhong University of Science and Technology, Dissertation Template, \LaTeX, \LaTeX3 % \end{abstract*} % % \tableofcontents % \mainmatter % % \begin{documentation} % % \chapter{\clsname{} 介绍} % % \clsname{} 是华中科技大学研究生学位论文\LaTeX{}文档类, % 旨在为华科学生提供一个简单上手,易于使用的学位论文文档类。 % % \section{\clsname{} 历史} % % 本文档类 |v1.x| 版本由华中科技大学电子信息学院2014届本科生许铖博士 % \footnote{\url{https://github.com/xu-cheng}}开发并维护, % 支持中英文的本科、硕士和博士学位论文撰写。 % 作为一个设计精良的 \LaTeXe{} 文档类,自2013年6月1日 |v1.0| 初版 % 以 \LaTeX 项目公共许可证 1.3c(\LaTeX{} Project Public License 1.3c 版)发布以来, % 该文档类已为无数华科学子提供了优质的服务。 % % 然而,随着学校学位论文格式要求的不断更新, % 原有的文档类逐渐难以满足新的格式要求。 % 加之原作者移居海外,难以及时响应日益增多的用户需求。 % 同时,随着 \LaTeX3 技术和 C\TeX{} 宏集的逐渐成熟与普及, % 与之相比的 \LaTeXe{} 语法显得难以维护。 % 因此,自2024年文档类 |v2.x.x| 版本开始交由华中科技大学博士生黄宇希 % \footnote{\url{https://github.com/huangyxi}}接手维护, % 并基于 \LaTeX3 技术和 C\TeX{} 宏集进行了全面重构。 % % 此外,|v2.0.0|起,文档类说明手册使用 \pkg{useclass}\cite{huang2024useclass} % 以宏包的方式载入 \pkg{l3doc} 文档类中的众多命令和环境, % 使得 \pkg{l3doc} 文档类能够与 \clsname{} 文档类共存, % 实现 \clsname{} 文档类的“自举”。 % % 当前\clsname{} 代码在 GitHub % \url{https://github.com/hust-latex/hustthesis} 上托管, % 欢迎各位同学提出意见和建议。 % % \section{学位论文格式规范} % % 目前华中科技大学对于硕士和博士的学位论文格式主要由以下文件规范: % \begin{itemize} % \item \href{http://gs.hust.edu.cn/content.jsp?urltype=news.NewsContentUrl&wbtreeid=1022&wbnewsid=1027}{华中科技大学博士、硕士学位论文撰写规定, 校研〔2009〕39号} % \item \href{http://gs.hust.edu.cn/info/1041/5462.htm}{学位申请相关文档下载}, % 发布时间2023-02-10 % \end{itemize} % % 由于其中如“参考文献著录作者最多数量”等部分规范尚未统一, % 文档类作者在此仅根据过往已通过的学位论文的格式择取其一实现, % 供同学们参考。 % 具体的格式要求请以学校最新的通知为准。 % % \section{\clsname{} 发行版本号\label{sec:version}} % % 更新版本往往会带来新功能和修复问题, % 但有时也会不可避免地带来不向后兼容的修改。 % 为了清晰地传达版本之间的变化, % 本文档类发行的版本号使用类似但不完全同于语义化版本控制(Semantic Versioning)规范 % \footnote{\url{https://semver.org/}}用以标识。 % 在本文档类中,对于版本号 |MAJOR.MINOR.PATCH|,递增相应的部分所表示的含义如下: % \begin{itemize} % \item |MAJOR|:递增大版本号, % 表示已在正文文档化的公开接口上存在不向后兼容(backward compatibility)的修改, % 一般对文档代码不经修改无法正常编译; % \item |MINOR|:递增小版本号, % 表示已在正文文档化的非实验性公开接口上\emph{不}存在不向后兼容编译的修改, % 但在实验性公开接口上存在不向后兼容的修改; % 或者文档样式发生比较明显的变化。 % 一般对文档代码不作修改或者只需小幅修改就可以正常编译; % \item |PATCH|:递增补丁版本号, % 表示新版本含有向后兼容的 bug 修复,新功能,或者文档样式的细微变化, % 其中未文档化的私有接口可能会发生变化。 % \end{itemize} % 用户在更新文档类时,可以根据版本号的变化以及更新日志来判断是否需要修改自己的文档。 % % % \chapter{获取途径} % % 获取最新版本的 \clsname{} 文档类主要有两种途径: % 从 CTAN 上下载,或者从 GitHub Releases 页面下载。 % % \section{CTAN} % % CTAN \url{https://ctan.org/pkg/hustthesis} % 上的 \clsname{} 文档类是经过打包的版本, % 其中包含了文档类、和文档类手册。 % % \section{GitHub Release} % % \cls{hustthesis} 的源码托管在 GitHub % \url{https://github.com/hust-latex/hustthesis} 上, % 其中包含了最新的开发版本。 % 由于源码是以 Doc\TeX{} 格式编写, % 对于初学者来说,安装和使用都比较麻烦。 % 因此,建议初学者可以直接从 Releases 页面下载打包好的版本,解压后直接使用。 % \url{https://github.com/hust-latex/hustthesis/releases/latest/download/hustthesis-user.zip} % % \chapter{使用说明} % % \section{太长不读(TL;DR)} % % 本节将展示两段简化程度不一的代码示例, % 可用于快速了解本文档类的使用方法, % 或者在编译失败的调试阶段作为参考。 % % \subsection{最小可用示例} % % 以下代码包含了本文档类的最小可用示例(Minimal Working Example), % 用于展现文档类使用的主体结构。 % \begin{latexcode} % \documentclass{hustthesis} % % \hustsetup{} % 设置 % \begin{document} % \maketitle % \frontmatter % 摘要部分 % \tableofcontents % \mainmatter % 正文部分 % \backmatter % 致谢以及参考文献 % \appendix % 附录部分 % \end{document} % \end{latexcode} % % \subsection{核心示例} % % 本示例包含了较长的一段文档类核心命令和环境, % 更多进阶用法请参考后续小节。 % \begin{latexcode}[emph={[1]hustsetup}] % \documentclass[type=doctor]{hustthesis} % 博士学位论文: doctor, 硕士学位论文: master % \hustsetup { % 设置之间一定不能有空行 % info = % { % title = { 中文标题 }, % title* = { English Title }, % degree = { academic }, % 学术型: academic, 专业型: professional % degree* = { Engineering }, % 英文学科 % author = { 姓名 }, % author* = { Author }, % student-id = { D201234567 }, % major = { 专业 }, % major* = { Major }, % supervisor = { 指导老师\quad{} 教授 }, % supervisor* = { Prof.~ Supervisor }, % date = { 2025-02-26 }, % 不写这行的话会自动生成,写的话一定要按照这个格式 % }, % } % \addbibresource{references.bib} % % biblatex 参考文献文件名 % \begin{document} % \maketitle % \frontmatter % \begin{abstract} % 中文摘要 % \keywords 关键词1;关键词2;关键词3 % \end{abstract} % \begin{abstract*} % English Abstract % \keywords* keyword1, keyword2, keyword3 % \end{abstract*} % \tableofcontents % \mainmatter % \chapter{第一章} % \section{第一节} % ... % \backmatter % \begin{acknowledgements} % 致谢 % 感谢 hustthesis 文档类。 % \end{acknowledgements} % \printbibliography % \appendix % \chapter{附录} % \end{document} % \end{latexcode} % % \section{编译说明} % % 本文档类仅可使用 \XeLaTeX{} 或者 \LuaLaTeX{} 编译。 % % \section{如何阅读本章使用说明} % % 是的,说明文档本身也需要说明文档来说明如何阅读说明文档。 % % \subsection{实验性内容} % % 本文档类说明部分的名字含有 “\rexpstar{}” 的键值对选项,设置,命令或环境, % 表示该内容为实验性内容。 % 关于实验性内容的更新带来潜在不向后兼容修改的说明, % 请参考 \ref{sec:version} 节。 % % \subsection{单选键值对设置} % % \key{key} = <\opt{option},\opt*{default}>, % % 其等号右边的选项 \opt{option},和 \opt*{default} 均表示可选的单选项, % 其中加粗选项 \opt*{default} 表示默认选项。 % % 最后的逗号是为了提醒读者, % 如果存在多个键值对,其之间需由半角(英文)逗号分隔。(以下如未特殊说明,逗号均指半角逗号) % % \subsection{自定义键值对设置} % % \key{key} = \marg{value}, % % 其等号右边的值 \marg{value} 表示可以自定义的值。 % % \section{文档类选项\label{sec:option}} % % 本节介绍的选项仅可在如下文档类选项(中括号中|type=doctor|)中使用。 % 多个选项之间也是由逗号分隔。 % \begin{latexcode} % \documentclass[type=doctor]{hustthesis} % \end{latexcode} % % \begin{function}[module=option/]{type} % \begin{syntax} % \key{type} = <\opt*{doctor},\opt{master}>, % \end{syntax} % \begin{arguments} % \item[\opt*{doctor}] 博士学位论文 % \item[\opt{master}] 硕士学位论文 % \end{arguments} % \key{type} 选项用于设置学位论文类型。 % \end{function} % % \begin{function}[rEXP, module=option/]{anonymous} % \begin{syntax} % \key{anonymous} = <\opt*{false},\opt{true}>, % \end{syntax} % \begin{arguments} % \item[\opt*{false}] 关闭盲审模式 % \item[\opt{true}] 开启盲审模式 % \end{arguments} % \key{anonymous} 选项用于设置是否开启盲审模式。 % 盲审模式下,\key{anonymous-list} 中的所有信息均会被隐藏。 % \end{function} % % \begin{function}[rEXP, module=option/]{anonymous-list} % \begin{syntax} % \key{anonymous-list} = \marg{盲审模式隐藏条目列表}, % \end{syntax} % \key{anonymous-list} 选项用于设置在开启盲审模式下需要隐藏的条目。 % \marg{匿名条目列表} 是一组由半角(英文)逗号隔开的选项列表。 % |info/| 下键值对键名的连接符(|-|)需手动替换为下划线(|_|), % 星号(|*|)需手动替换为|_en|。 % 默认值为 \texttt{\{author, student_id, supervisor, author_en, supervisor_en\}}。 % \end{function} % % \section{文档信息设置} % % 本节介绍的文档信息设置选项只可在 \tn{hustsetup} 命令的\marg{键值列表}中使用, % 主要用于封面和扉页的标题、作者等信息的输出。 % % \begin{function}{\hustsetup} % \begin{syntax} % \tn{hustsetup}\marg{键值列表} % \end{syntax} % \tn{hustsetup} 的参数是一组由半角(英文)逗号隔开的选项列表, % 列表中的选项通常是 % \meta{key}|=|\meta{value}的形式。 % 对于相同键,后面的值会覆盖前面的值。 % “|=|”左右的空格不影响实际设置, % 但需注意,参数列表中不能有空行。 % \end{function} % % \begin{function}[module=info/]{info/degree} % \begin{syntax} % \key[info]{degree} = <\opt*{academic},\opt{professional}>, % \end{syntax} % 设置中文学位类型,仅可选学术型或专业型。 % \begin{arguments} % \item[\opt*{academic}] 学术型 % \item[\opt{professional}] 专业型 % \end{arguments} % \end{function} % % \begin{function}[module=info/]{info/degree*} % \begin{syntax} % \key[info]{degree*} = <\opt{Arts},\opt{Science},\opt{Education},\opt*{Engineering},\opt{Law},\opt{Medicine},...>, % \end{syntax} % 设置英文学科门类, % 可选项有: % \begin{arguments} % \item[\opt{Arts}] 文学学位 % \item[\opt{Science}] 理学学位 % \item[\opt{Education}] 教育学学位 % \item[\opt*{Engineering}] 工学学位 % \item[\opt{Law}] 法学学位 % \item[\opt{Medicine}] 医学学位 % \item[...] 其他学科可自行设置 % \end{arguments} % \end{function} % % \begin{function}[module=info/]{info/title, info/title*} % \begin{syntax} % \key[info]{title} = \marg{中文标题}, % \key[info]{title*} = \marg{英文标题}, % \end{syntax} % 设置论文标题。 % \end{function} % % \begin{function}[module=info/]{info/author, info/author*} % \begin{syntax} % \key[info]{author} = \marg{姓名中文}, % \key[info]{author*} = \marg{姓名英文}, % \end{syntax} % 设置学位申请人姓名。 % 根据学校要求,英文姓名应该按照中文习惯, % 为姓在前名在后,且姓全部大写。 % \end{function} % % \begin{function}[module=info/]{info/major, info/major*} % \begin{syntax} % \key[info]{major} = \marg{专业名称中文}, % \key[info]{major*} = \marg{专业名称英文}, % \end{syntax} % 设置专业名称。 % \end{function} % % \begin{function}[module=info/]{info/supervisor, info/supervisor*} % \begin{syntax} % \key[info]{supervisor} = \marg{指导老师中文姓名}, % \key[info]{supervisor*} = \marg{指导老师英文姓名}, % \end{syntax} % 设置指导老师姓名。 % \end{function} % % \begin{function}[module=info/]{info/date} % \begin{syntax} % \key[info]{date} = \marg{日期}, % \end{syntax} % 设置论文提交日期。 % 日期格式为 |YYYY-MM-DD|。 % 如果不设置该选项,文档类会自动生成日期。 % \end{function} % % \begin{function}[module=info/]{info/clc} % \begin{syntax} % \key[info]{clc} = \marg{中图分类号}, % \end{syntax} % 设置中图分类号。 % \end{function} % \begin{function}[module=info/]{info/student-id} % \begin{syntax} % \key[info]{student-id} = \marg{学号}, % \end{syntax} % 设置学号。 % \end{function} % % \begin{function}[rEXP, module=info/]{info/secret} % \begin{syntax} % \key[info]{secret} = \marg{密级}, % \end{syntax} % 实验性内容,设置密级。当前仅影响中文封面的显示,默认为空。 % \end{function} % % \begin{function}[module=info/]{info/committee} % \begin{syntax} % \key[info]{committee} = \marg{答辩委员会成员}, % \end{syntax} % 设置答辩委员会成员。 % 该选项的值是一个逗号分隔委员会成员的列表, % 其中每个成员的姓名,职称和单位之间用 |&| 分割。 % 第一个成员为主席,其余成员为委员。 % 由于文档类内部实现原因,如果设置该选项,请至少设置3名成员。 % 例如: % \begin{latexcode} % \hustsetup { % info/committee = % { 张三 & 教授 & 华中科技大学 , 李四 & 教授 & 武汉大学 , 王五 & 教授 & 武汉理工大学 }, % } % \end{latexcode} % 如果不设置该选项,文档类会自动生成7行空白的答辩委员会成员。 % % 另外,该选项所对应的页面仅在博士学位论文中会自动生成。 % 如果需要手动生成页面,可以使用命令 \tn{makecommittee}。 % \end{function} % % \section{内容编写} % % 以下内容须在 |\begin{document}| 和 |\end{document}| 之间编写。 % % \subsection{封面扉页} % % \begin{function}{\maketitle} % \begin{syntax} % \tn{maketitle} % \end{syntax} % \tn{maketitle} 命令用于生成中英文封面。 % 仅当文档类类型为博士学位论文时, % 在中文和英文封面之间会自动插入答辩委员会成员。 % \end{function} % % \begin{function}[rEXP]{\makezhtitle, \makeentitle} % \begin{syntax} % \tn{makezhtitle} % \tn{makeentitle} % \end{syntax} % \tn{makezhtitle} 和 \tn{makeentitle} 命令分别用于生成中文和英文封面。 % 一般不需要手动调用这两个命令。 % \end{function} % % \begin{function}[rEXP]{\makecommittee} % \begin{syntax} % \tn{makecommittee} % \end{syntax} % \tn{makecommittee} 命令用于生成答辩委员会成员。 % 一般也不需要手动调用该命令。 % \end{function} % % \subsection{前文} % % \begin{function}{\frontmatter} % \begin{syntax} % \tn{frontmatter} % \end{syntax} % \tn{frontmatter} 命令用于修改页码格式为罗马数字, % 增加页眉和页脚, % 以及设置目录中虚线样式。 % 该命令一般需要在 \tn{maketitle} 命令之后,摘要之前调用。 % \end{function} % % \begin{environment}{abstract, abstract*} % \begin{latexcode} % \begin{abstract} % 中文摘要 % \keywords 关键词1;关键词2;关键词3 % \end{abstract} % % \begin{abstract*} % English abstract % \keywords* keyword1, keyword2, keyword3 % \end{abstract*} % \end{latexcode} % |abstract| 和 |abstract*| 环境分别用于生成中文和英文摘要。 % \end{environment} % % \begin{function}{keywords, keywords*} % \begin{syntax} % \tn{keywords} 关键词1;关键词2;关键词3 % \tn{keywords*} Keyword1, Keyword2, Keyword3 % \end{syntax} % \tn{keywords} 和 \tn{keywords*} 命令分别用于生成中文和英文关键词。 % 一般需要在相应的 |abstract| 和 |abstract*| 环境中的最后一行调用。 % \end{function} % % \begin{function}{\tableofcontents} % \begin{syntax} % \tn{tableofcontents} % \end{syntax} % \tn{tableofcontents} 命令用于生成目录。 % \end{function} % % \subsection{正文} % % \begin{function}{\mainmatter} % \begin{syntax} % \tn{mainmatter} % \end{syntax} % \tn{mainmatter} 命令用于修改页码格式为阿拉伯数字, % 以及设置目录中虚线样式。 % 该命令一般需要在目录之后,正文之前调用。 % \end{function} % % \begin{function}{\chapter, \chapter*, \chapter**} % \begin{syntax} % \tn{chapter}\marg{标题名} % \tn{chapter*}\marg{标题名} % \tn{chapter**}\marg{标题名} % \end{syntax} % \tn{chapter} 和 \tn{chapter*} 命令与标准 \LaTeXe-\pkg{book} 文档类中的命令功能相同, % 用于生成章标题。 % 前者为有编号的章标题,会在目录中生成对应的条目; % 后者为无编号的章标题,不会在目录中生成对应的条目。 % % \tn{chapter**} 命令是本文档类新增的章节标题生成的命令, % 用于生成无编号章节标题,但会在目录中生成对应的条目。 % 一般可用于在附录中生成无编号的章节标题。 % \end{function} % % \subsection{后文} % % \begin{function}{\backmatter} % \begin{syntax} % \tn{backmatter} % \end{syntax} % \tn{backmatter} 命令用于修改目录中虚线样式。 % 该命令一般需要在正文之后,致谢之前调用。 % \end{function} % % \begin{environment}{acknowledgements} % \begin{syntax} % |\begin{acknowledgements}| % 致谢 % |\end{acknowledgements}| % \end{syntax} % |acknowledgements| 环境用于生成致谢。 % \end{environment} % % \begin{function}{\printbibliography} % \begin{syntax} % \tn{printbibliography} % \end{syntax} % \tn{printbibliography} 命令用于生成 \pkg{biblatex} 宏包的参考文献。 % \end{function} % % \subsection{附录} % % \begin{function}{\appendix} % \begin{syntax} % \tn{appendix} % \end{syntax} % \tn{appendix} 命令用于修改章节标题格式, % 该命令一般需要在参考文献之后调用。 % \end{function} % % 附录的章节如答辩委员会决议等,可以根据需要使用 \tn{chapter} 命令生成有编号的标题, % 也可以使用 \tn{chapter**} 命令生成无编号的标题。 % % \section{参考文献说明} % % 这里列举了在学位论文规范文档中的参考文献。 % 可以在正文后参考文献列表中查看生成的样式。 % \citeauthor{YanMingLi2006CFGZhuang} % \cite{chalfi1998GreenFluo, ZhanXiangHong2004ZhongYiY} % \parencite{lein2007Genomewide,bouxse2010Guidelines,yamaki2018Performanc,yao2017BuildingE,LiuJiaLin1993DuoGongN,LiQingQuan1998JiYuHun} % % \backmatter % \begin{acknowledgements} % 感谢 \cls{fduthesis} 文档类\cite{zeng2023fduthesis}, % \cls{SJTU\TeX} 文档类集\cite{sjtug2024SJTUTeX}, % 和 \cls{njuthesis} 文档类\cite{njulug2023njuthesis}, % 本文档类的许多设计和实现都是参考了上述代码。 % 并且特别感谢 \pkg{biblatex-gb7714-2015} 宏包\cite{hu2024bib}及其作者胡振震, % 本人在之前的文档类设计中得到了其很多热情的帮助, % 收获的经验也为本文档类的设计奠定了基础。 % % 此外本人开发的宏包 \pkg{useclass}\cite{huang2024useclass} % 也让本文档类手册的文档类“自举”实现可能。 % \end{acknowledgements} % % \printbibliography % % \end{documentation} % % \begin{implementation} % % \appendix % \newgeometry{ % marginpar = 2.8 cm, % } % % \chapter{\clsname{} 代码实现} % 本文档类使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境。 % % \begin{macrocode} %<@@=hust> %<*class> % \end{macrocode} % % \section{文档类预处理} % % 本文档类隐式依赖已整合进 \LaTeX--\pkg{base} 的 \pkg{ltkeys} (原 \pkg{l3keys2e}) 和 \pkg{lttemplates}(原 \pkg{xtemplate})。 % % \begin{macrocode} \RequirePackage { } % \end{macrocode} % % \subsection{变量声明} % % \begin{variable}{ % \l_@@_tmpa_box, % \l_@@_tmpa_clist, % \l_@@_tmpa_dim, % \l_@@_tmpa_skip, % \l_@@_tmpa_tl, \l_@@_tmpb_tl, % } % 临时变量。 % \begin{macrocode} \box_new:N \l_@@_tmpa_box \clist_new:N \l_@@_tmpa_clist \dim_new:N \l_@@_tmpa_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_@@_degree_type_tl} % 论文类型。 % \begin{macrocode} \tl_new:N \g_@@_degree_type_tl % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_to_ctex_class_clist, \g_@@_to_hyperref_clist} % 分别保存由 \clsname{} 传入 \cls{ctexbook} 文档类和 \pkg{hyperref} 宏包的选项列表。 % \begin{macrocode} \clist_new:N \g_@@_to_ctex_class_clist \clist_new:N \g_@@_to_hyperref_clist % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_draft_bool} % 草稿模式。 % \begin{macrocode} \bool_new:N \g_@@_draft_bool % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_anonymous_bool} % 盲审模式。 % \begin{macrocode} \bool_new:N \g_@@_anonymous_bool % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_anonymous_clist} % 盲审模式需要隐藏的内容。 % \begin{macrocode} \clist_new:N \g_@@_anonymous_clist % \end{macrocode} % \end{variable} % % \begin{variable}{ % \g_@@_font_set_tl, % \g_@@_font_latin_tl, % \g_@@_font_cjk_tl, % \g_@@_font_math_tl} % 存储所使用字体名称的全局变量。 % \begin{macrocode} \tl_new:N \g_@@_font_set_tl \tl_new:N \g_@@_font_latin_tl \tl_new:N \g_@@_font_cjk_tl \tl_new:N \g_@@_font_math_tl % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_font_dir_tl} % 存储字体路径的全局变量。 % \begin{macrocode} \tl_new:N \g_@@_font_dir_tl % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_font_dir_bool} % 是否使用独立的字体文件。 % \begin{macrocode} \bool_new:N \g_@@_font_dir_bool % \end{macrocode} % \end{variable} % % \begin{variable}{\g_@@_config_tl} % 保存配置文件名称。默认为空。 % \begin{macrocode} \tl_new:N \g_@@_config_tl % \end{macrocode} % \end{variable} % % \subsection{内部函数} % % % \subsubsection{辅助函数} % \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_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 } {#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 _en_tl } {#2} \tl_const:cn { c_@@_name_ #1 _zh_tl } {#3} } % \end{macrocode} % \end{macro} % % % \begin{macro}{\@@_msg_new:nn, % \@@_error:n, \@@_error:nn, \@@_error:nx, \@@_error:nnn, \@@_error:nnnn, % \@@_warning:n, \@@_warning:nn, \@@_warning:nxx, % \@@_info:nx %} % 各种信息函数的缩略形式。 % \begin{macrocode} \cs_new:Npn \@@_msg_new:nn { \msg_new:nnn { hustthesis } } \cs_new:Npn \@@_error:n { \msg_error:nn { hustthesis } } \cs_new:Npn \@@_error:nn { \msg_error:nnn { hustthesis } } \cs_new:Npn \@@_error:nx { \msg_error:nnx { hustthesis } } \cs_new:Npn \@@_error:nnn { \msg_error:nnnn { hustthesis } } \cs_new:Npn \@@_error:nnnn { \msg_error:nnnnn { hustthesis } } \cs_new:Npn \@@_warning:n { \msg_warning:nn { hustthesis } } \cs_new:Npn \@@_warning:nn { \msg_warning:nnn { hustthesis } } \cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx { hustthesis } } \cs_new:Npn \@@_info:nx { \msg_info:nnx { hustthesis } } % \end{macrocode} % \end{macro} % % \subsubsection{\LaTeXe{} 封装} % % \begin{macro}[deprecated]{\@@_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 \tex_prevdepth:D \tex_hrule:D height \c_zero_dim \nobreak \skip_vertical:N #1 \skip_vertical:N \c_zero_skip \dim_set_eq:NN \tex_prevdepth:D \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}[deprecated]{\@@_hrule:nn} % 不改变位置的 \tn{hrule}。 % \begin{arguments} % \item 线段粗细(高度) % \item 线段长度(宽度) % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_hrule:nn #1#2 { \rule [ -0.5 ex ] { #2 } { #1 } \skip_horizontal:n { -#2 } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_ul_to_wd:nnn} % \begin{arguments} % \item 下划线粗细 % \item 下划线长度 % \item 内容 % \end{arguments} % \begin{macrocode} \dim_new:N \l_@@_ul_dim \cs_new_protected:Npn \@@_ul_to_wd:nnn #1#2#3 { \hbox_overlap_right:n { \rule [ - 0.5 ex ] { #2 } { #1 } } \hbox_to_wd:nn { #2 } { \tex_hfil:D #3 \tex_hfil:D } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_line_spread:N, \@@_line_spread:n} % 设置行距。 % \begin{arguments} % \item 行距倍数, |fp| 变量 % \end{arguments} % \begin{macrocode} \cs_new:Npn \@@_line_spread:N #1 { \tl_set:Nn \baselinestretch { \fp_use:N #1 } \selectfont } \cs_new:Npn \@@_line_spread:n #1 { \tl_set:Nn \baselinestretch { #1 } \selectfont } % \end{macrocode} % \end{macro} % % \begin{macro}[deprecated]{\@@_arabic:n} % 等价于 \LaTeXe{} 中的 \tn{arabic}。 % \begin{macrocode} \cs_new:Npn \@@_arabic:n #1 { \int_to_arabic:v { c@ #1 } } % \end{macrocode} % \end{macro} % % \subsection{选项处理} % % 定义 | hust / option | 键值类,该键值类仅可在文档类选项中使用。 % \begin{macrocode} \keys_define:nn { hust / option } { % \end{macrocode} % % \begin{macro}[module=option/]{type} % 论文类型。目前分为硕士学位论文~\opt{master} 和博士学位论文~\opt{doctor},默认为博士学位论文。 % \begin{macrocode} type .choices:nn = { master, doctor } { \tl_gset_eq:NN \g_@@_degree_type_tl \l_keys_choice_tl }, type .value_required:n = true, type .initial:n = { doctor }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{draft} % 是否启用草稿模式。默认为 \opt{false}。 % \begin{macrocode} draft .choice:, draft / true .code:n = { \bool_gset_true:N \g_@@_draft_bool \clist_gput_right:Nn \g_@@_to_ctex_class_clist { draft } }, draft / false .code:n = { \bool_gset_false:N \g_@@_draft_bool }, draft .default:n = { true }, draft .initial:n = { false }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{anonymous} % \changes{v2.0.0}{2025-02-18}{支持盲审模式} % 是否启用盲审模式。默认为 \opt{false},即显示作者信息。\key[option]{anonymous} % \begin{macrocode} anonymous .choice:, anonymous / true .code:n = { \bool_gset_true:N \g_@@_anonymous_bool }, anonymous / false .code:n = { \bool_gset_false:N \g_@@_anonymous_bool }, anonymous .default:n = { true }, anonymous .initial:n = { false }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{anonymous-list} % 在开启盲审模式下需要隐藏的内容。其中连接符(|-|)需替换为下划线(|_|),星号(|*|)需替换为|_en|。 % \begin{macrocode} anonymous-list .clist_gset:N = \g_@@_anonymous_clist, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{latin-font, cjk-font} % 中英文字体选项。\opt{fandol} 和 \opt{gyre} 是等价的。 % \begin{macrocode} latin-font .choices:nn = { fandol, gyre, mac, macoffice, win, none, } { \tl_gset:Nn \g_@@_font_latin_tl {#1} }, cjk-font .choices:nn = { fandol, founder, mac, macoffice, noto, source, win, none, } { \tl_gset:Nn \g_@@_font_cjk_tl {#1} }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{fontset} % 中英文字体选项。\opt{fontset} 这个名称和 \pkg{ctex} 中的是一致的。 % \begin{macrocode} fontset .choices:nn = { fandol, mac, macoffice, win, none, } { \keys_set:nn { hust / option } { latin-font = #1, cjk-font = #1 } }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{math-font} % 数学字体选项。 % 由 \pkg{unicode-math} 指定 \XeTeX 和 \LuaTeX 下使用的数学字体。 % \begin{macrocode} math-font .choices:nn = { asana, cambria, fira, garamond, lm, libertinus, newcm, stix, bonum, dejavu, pagella, schola, termes, xits, none, } { \tl_gset_eq:NN \g_@@_font_math_tl \l_keys_choice_tl }, math-font .initial:n = xits, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{font-dir} % 独立字体文件的路径。 % \begin{macrocode} font-dir .code:n = { \bool_gset_true:N \g_@@_font_dir_bool \tl_gset_eq:NN \g_@@_font_dir_tl \l_keys_value_tl }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=option/]{config} % 自定义配置文件名。 % \begin{macrocode} config .tl_gset:N = \g_@@_config_tl, % \end{macrocode} % \end{macro} % % 将未知选项传给 \cls{ctexbook} 文档类。 % \begin{macrocode} unknown .code:n = { \clist_gput_right:No \g_@@_to_ctex_class_clist { \CurrentOption } } } % \end{macrocode} % % \begin{macro}[module=option/, int]{option/} % 将文档类选项传给 |hust / option|。 % \begin{macrocode} \ProcessKeyOptions [ hust / option ] % \end{macrocode} % \end{macro} % % \subsection{常量载入} % % 载入常量定义文件。 % \begin{macrocode} \tl_if_empty:NTF \g_@@_config_tl { \tl_if_eq:NnT \g_@@_degree_type_tl { master } { \file_input:n { hustthesis-m.def } } \tl_if_eq:NnT \g_@@_degree_type_tl { doctor } { \file_input:n { hustthesis-d.def } } } { \@@_msg_new:nn { load-config-file } { You~ are~ loading~ config~ file~ "#1". } \@@_info:n { load-config-file } \file_input:V { \g_@@_config_tl } } % \end{macrocode} % % \subsection{宏包载入} % % \sout{对不支持粗体斜体的字体进行兼容处理,仅限于 \XeTeX{} 引擎。}\\ % \sout{参考自 \url{https://ask.latexstudio.net/ask/question/17464.html}。} % \begin{macrocode} %\sys_if_engine_xetex:T % { % \PassOptionsToPackage { AutoFakeBold=4.0 } { xeCJK } % \AddToHook { package / ctex / before } % { % \AddToHook { package / xeCJK / after } % { % \keys_define:nn { xeCJK / features } % { % BoldFont .code:n = , % ItalicFont .code:n =, % } % } % } % \AddToHook { package / ctex / after } % { % \keys_define:nn { xeCJK / features } % { % BoldFont .tl_set:N = \l__xeCJK_font_name_bf_tl , % ItalicFont .tl_set:N = \l__xeCJK_font_name_it_tl, % } % } % } % \end{macrocode} % % 将选项传入 \cls{ctexbook} 文档类。 % \begin{macrocode} \PassOptionsToClass { a4paper, UTF8, scheme = chinese, fontset = none, oneside, heading = true, zihao = -4, linespread = \c_@@_line_spread_fp, \g_@@_to_ctex_class_clist, } { ctexbook } \LoadClass { ctexbook } % \end{macrocode} % % 其中 \pkg{utfsym} 宏包不依赖外部字体,使用 \TikZ{} 宏包绘制 |U+2610|:~☐,|U+2611|:~☑,|U+1F5F9|:~\usym{1F5F9} 等符号。 % \begin{macrocode} \RequirePackage { amsmath, geometry, fancyhdr, titletoc, graphicx, multirow, longtable, caption, utfsym, } % \end{macrocode} % % 载入基于 \clsname{} 样式的 \pkg{biblatex} 宏包。 % \begin{macrocode} \RequirePackage[style=hustthesis]{biblatex} % \end{macrocode} % % % \section{全局样式} % % 隐藏盲审模式下需要隐藏的内容。 % \begin{macrocode} \clist_map_inline:Nn \g_@@_anonymous_clist { \tl_gset_eq:cN { g_@@_name_ #1 _tl } \c_empty_tl } % \end{macrocode} % % \subsection{页面布局} % 利用 \pkg{geometry} 宏包设置纸张大小、页面边距以及页眉高度。 % \begin{macrocode} \geometry { top = 4.5 cm, bottom = 2.8 cm, left = 2.8 cm, right = 2.8 cm, headheight = 30 pt, } % \end{macrocode} % % \subsection{字体设置} % % ^^A 本小节初版实现主要来自 \pkg{njuthesis} 文档类。 % % \pkg{fontspec} 包含于 \pkg{ctex} 宏集,无需另行载入。 % % \subsubsection{操作系统检测} % % \begin{variable}{\c_@@_path_macoffice_tl} % mac Office 字体路径。 % \begin{macrocode} \tl_const:Nn \c_@@_path_macoffice_tl { /Applications/Microsoft~ Word.app/Contents/Resources/DFonts/ } % \end{macrocode} % \end{variable} % % 操作系统检测。相较于 \pkg{ctex} 提供的 \cs{ctex_detect_platform:}, % 额外增加了对 macOS 上 MS Office 的检测。 % \begin{macrocode} \sys_if_platform_windows:TF { \tl_gset:Nn \g_@@_font_set_tl { win } } { \ctex_if_platform_macos:TF { \file_if_exist:nTF { \c_@@_path_macoffice_tl times.ttf } { \tl_gset:Nn \g_@@_font_set_tl { macoffice } } { \tl_gset:Nn \g_@@_font_set_tl { mac } } } { \tl_gset:Nn \g_@@_font_set_tl { fandol } } } % \end{macrocode} % 判断用户是否自定义了中英文字体。如果其中任意一种未被定义, % 则使用系统预装字体覆盖字体选项。 % Windows 或 macOS 外的系统被判断为 Linux,一律使用自由字体。 % \begin{macrocode} \tl_if_empty:NT \g_@@_font_latin_tl { \tl_gset_eq:NN \g_@@_font_latin_tl \g_@@_font_set_tl } \tl_if_empty:NT \g_@@_font_cjk_tl { \tl_gset_eq:NN \g_@@_font_cjk_tl \g_@@_font_set_tl } % \end{macrocode} % % % \subsubsection{定义英文字库} % % 接下来逐个定义所需要使用的字库。 % % \begin{macro}{ % \@@_loadfont_latin:n, % \@@_loadfont_latin_win:, % \@@_loadfont_latin_mac:, % } % Windows 与 macOS 西文字体的区别主要在于默认等宽字体。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_latin:n #1 { \__fontspec_main_setmainfont:nn { } { Times~New~Roman } \__fontspec_main_setsansfont:nn { } { Arial } \__fontspec_main_setmonofont:nn { Scale = MatchLowercase } {#1} } \cs_new_protected:Npn \@@_loadfont_latin_win: { \@@_loadfont_latin:n { Courier~New } } \cs_new_protected:Npn \@@_loadfont_latin_mac: { \@@_loadfont_latin:n { Menlo } % \end{macrocode} % 检测 Times New Roman 是否具有小型大写字母(small caps)字型。 % 这是 macOS 预装的字体版本较旧导致的。 % \begin{macrocode} \fontspec_if_small_caps:F { \@@_warning:n { no-small-caps } \__fontspec_main_setmainfont:nn { \c_@@_name_gyrefeature_clist } { texgyretermes } } } \@@_msg_new:nn { no-small-caps } { I~ am~ using~ TeX~ Gyre~ Termes~ as~ default~ Roman~ font.\\ This~ is~ because~ the~ "Times~ New~ Roman"~ font~ in~ your~ system~ does~ not~ embed~ glyphs~ for~ small~ capitals.~ You~ can~ ignore~ this~ warning~ if~ you~ do~ not~ need~ \string\textsc.~ For~ more~ information,~ please~ refer~ to~ section~ 3.2.6~ of~ the~ documentation. } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_latin_macoffice:} % mac Office 西文字体。 % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_latin_macoffice: { \__fontspec_main_setmainfont:nn { \c_@@_name_macofficefeature_clist } { times } \__fontspec_main_setsansfont:nn { \c_@@_name_macofficefeature_clist } { arial } \__fontspec_main_setmonofont:nn { Scale = MatchLowercase } { Menlo } } % \end{macrocode} % \end{macro} % % \begin{variable}{\c_@@_name_macofficefeature_clist} % 用于 \pkg{fontspec} 的 mac Office 字体特性列表。 % \begin{macrocode} \clist_const:Nn \c_@@_name_macofficefeature_clist { Path = \c_@@_path_macoffice_tl, Extension = .ttf, UprightFont = *, BoldFont = *bd, ItalicFont = *i, BoldItalicFont = *bi, } % \end{macrocode} % \end{variable} % % \begin{macro}{\@@_loadfont_latin_gyre:} % 开源的 \TeX Gyre 西文字体。 % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_latin_gyre: { \__fontspec_main_setmainfont:nn { \c_@@_name_gyrefeature_clist } { texgyretermes } \__fontspec_main_setsansfont:nn { \c_@@_name_gyrefeature_clist } { texgyreheros } \__fontspec_main_setmonofont:nn { \c_@@_name_gyrefeature_clist, Scale = MatchLowercase, Ligatures = CommonOff, } { texgyrecursor } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_latin_fandol:} % 为兼容 \pkg{ctex} 做出的名称改变。 % \begin{macrocode} \cs_new_eq:NN \@@_loadfont_latin_fandol: \@@_loadfont_latin_gyre: % \end{macrocode} % \end{macro} % % \begin{variable}{\c_@@_name_gyrefeature_clist} % 用于 \pkg{fontspec} 的 \TeX Gyre 字体特性列表。 % \begin{macrocode} \clist_const:Nn \c_@@_name_gyrefeature_clist { Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-italic, BoldItalicFont = *-bolditalic, } % \end{macrocode} % \end{variable} % % % \subsubsection{定义中文字库} % % \begin{macro}{\@@_hide_no_script_msg:} % 隐藏 |does not contain script "CJK"| 警告。 % \begin{macrocode} \cs_new:Npn \@@_hide_no_script_msg: { \msg_redirect_name:nnn { fontspec } { no-script } { info } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_win:N, \@@_loadfont_cjk_win:} % Windows 中文字体。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_cjk_win:N #1 { \setCJKmainfont { SimSun } [ #1, ItalicFont = KaiTi ] \setCJKsansfont { SimHei } [#1] \setCJKmonofont { FangSong } [#1] \setCJKfamilyfont { zhsong } { SimSun } [#1] \setCJKfamilyfont { zhhei } { SimHei } [#1] \setCJKfamilyfont { zhfs } { FangSong } [#1] \setCJKfamilyfont { zhkai } { KaiTi } [#1] \@@_define_stzhongs:nn { STZhongsong } {#1} } \cs_new:Npn \@@_loadfont_cjk_win: { \@@_loadfont_cjk_win:N \c_@@_name_fakebold_tl } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_mac:} % macOS 字体。 % ^^A TODO: 修复 macOS 字体支持,实现开箱即用。 % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_cjk_mac: { \@@_hide_no_script_msg: \setCJKmainfont { Songti~SC~Light } [ BoldFont = Songti~SC~Bold, ItalicFont = Kaiti~SC, BoldItalicFont = Kaiti~SC~Bold, ] \setCJKsansfont { Heiti~SC~Light } [ BoldFont = Heiti~SC~Medium ] \setCJKmonofont { STFangsong } \setCJKfamilyfont { zhsong } { Songti~SC~Light } [ BoldFont = Songti~SC~Bold ] \setCJKfamilyfont { zhhei } { Heiti~SC~Light } [ BoldFont = Heiti~SC~Medium ] \setCJKfamilyfont { zhfs } { STFangsong } \setCJKfamilyfont { zhkai } { Kaiti~SC } [ BoldFont = Kaiti~SC~Bold ] } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_macoffice:n, \@@_loadfont_cjk_macoffice:} % mac Office 中文字体。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_cjk_macoffice:n #1 { \setCJKmainfont { Simsun.ttc } [ ItalicFont = Kaiti.ttf, #1 ] \setCJKsansfont { SimHei.ttf } [#1] \setCJKmonofont { Fangsong.ttf } [#1] \setCJKfamilyfont { zhsong } { Simsun.ttc } [#1] \setCJKfamilyfont { zhhei } { SimHei.ttf } [#1] \setCJKfamilyfont { zhfs } { Fangsong.ttf } [#1] \setCJKfamilyfont { zhkai } { Kaiti.ttf } [#1] \@@_define_stzhongs:nn { \c__hust_path_macoffice_tl STZHONGS.ttf } {#1} } \cs_new:Npn \@@_loadfont_cjk_macoffice: { \@@_loadfont_cjk_macoffice:n { Path = \c_@@_path_macoffice_tl, \c_@@_name_fakebold_tl } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_fandol:} % Fandol 字体。 % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_cjk_fandol: { \@@_hide_no_script_msg: \setCJKmainfont { FandolSong-Regular } [ Extension = .otf, BoldFont = FandolSong-Bold, ItalicFont = FandolKai-Regular, ] \setCJKsansfont { FandolHei-Regular } [ Extension = .otf, BoldFont = FandolHei-Bold, ] \setCJKmonofont { FandolFang-Regular } [ Extension = .otf ] \setCJKfamilyfont { zhsong } { FandolSong-Regular } [ Extension = .otf, BoldFont = FandolSong-Bold ] \setCJKfamilyfont { zhhei } { FandolHei-Regular } [ Extension = .otf, BoldFont = FandolHei-Bold, ] \setCJKfamilyfont { zhfs } { FandolFang-Regular } [ Extension = .otf ] \setCJKfamilyfont { zhkai } { FandolKai-Regular } [ Extension = .otf, \c_@@_name_fakebold_tl ] } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_founder:} % 方正字库(简繁扩展) % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_cjk_founder: { % \end{macrocode} % 调整方正字体括号位置。 % \footnote{\XeTeX 的调整方法来自 \url{https://www.zhihu.com/question/46241367/answer/101660183}。} % \begin{macrocode} \sys_if_engine_xetex:T { \xeCJKEditPunctStyle { quanjiao } { optimize-kerning = true } } \sys_if_engine_luatex:T { \defaultCJKfontfeatures { JFM = { zh_CN / { quanjiao, fzpr } } } } \setCJKmainfont { FZShuSong-Z01 } [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] \setCJKmonofont { FZFangSong-Z02 } \setCJKfamilyfont { zhsong } { FZShuSong-Z01 } [ BoldFont = FZXiaoBiaoSong-B05 ] \setCJKfamilyfont { zhhei } { FZHei-B01 } [ \c_@@_name_fakebold_tl ] \setCJKfamilyfont { zhkai } { FZKai-Z03 } [ \c_@@_name_fakebold_tl ] \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } \defaultCJKfontfeatures { } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_noto:} % Noto 思源字体。 % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_cjk_noto: { \setCJKmainfont [ \c_@@_name_notofeature_clist ] { NotoSerifCJKsc } \setCJKsansfont [ \c_@@_name_notofeature_clist ] { NotoSansCJKsc } \setCJKmonofont { Noto~Sans~Mono~CJK~SC } \setCJKfamilyfont { zhsong } { Noto~Serif~CJK~SC } \setCJKfamilyfont { zhhei } { Noto~Sans~CJK~SC } \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } \setCJKfamilyfont { zhkai } { FZKai-Z03 } [ \c_@@_name_fakebold_tl ] } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_cjk_source:} % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont_cjk_source: { \setCJKmainfont [ \c_@@_name_notofeature_clist ] { SourceHanSerifSC } \setCJKsansfont [ \c_@@_name_notofeature_clist ] { SourceHanSansSC } \setCJKmonofont { FZFangSong-Z02 } \setCJKfamilyfont { zhsong } { Source~Han~Serif~SC } \setCJKfamilyfont { zhhei } { Source~Han~Sans~SC } \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } \setCJKfamilyfont { zhkai } { FZKai-Z03 } [ \c_@@_name_fakebold_tl ] } % \end{macrocode} % \end{macro} % % \begin{variable}{\c_@@_name_fakebold_tl} % \begin{macrocode} \tl_const:Nn \c_@@_name_fakebold_tl { AutoFakeBold = 2.17 } % \end{macrocode} % \end{variable} % % \begin{variable}{\c_@@_name_notofeature_clist} % 用于 \pkg{fontspec} 的思源字体特性列表。 % \begin{macrocode} \clist_const:Nn \c_@@_name_notofeature_clist { Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ItalicFeatures = FakeSlant, BoldItalicFeatures = FakeSlant, } % \end{macrocode} % \end{variable} % % \begin{variable}{\l_@@_name_stzhongsopts_tl} % 华文中宋的字体特性列表,默认为仅使用伪粗体。 % \begin{macrocode} \tl_new:N \l_@@_name_stzhongsopts_tl \tl_set_eq:NN \l_@@_name_stzhongsopts_tl \c_@@_name_fakebold_tl % \end{macrocode} % \end{variable} % % \begin{macro}{\@@_define_stzhongs:nn} % 中文封面额外需要的华文中宋。 % \begin{macrocode} \tl_new:N \l_@@_name_stzhongsfile_tl \cs_new:Npn \@@_define_stzhongs:nn #1#2 { \tl_set:Nn \l_@@_name_stzhongsfile_tl {#1} \tl_set:Nn \l_@@_name_stzhongsopts_tl {#2} } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_stzhongs:n} % \begin{macro}{\@@_loadfont_stzhongs:V, \@@_loadfont_stzhongs:, \@@_stzhongs:} % 研究生封面额外需要的华文中宋。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_stzhongs: { \@@_loadfont_stzhongs:V \l_@@_name_stzhongsfile_tl } \cs_new_protected:Npn \@@_loadfont_stzhongs:n #1 { \fontspec_font_if_exist:nTF { #1 } { \newCJKfontfamily \@@_stzhongs: { #1 } [ \l_@@_name_stzhongsopts_tl ] } { \bool_if:NTF \g_@@_font_dir_bool { \newCJKfontfamily \@@_stzhongs: { #1 } [ Path = \g_@@_font_dir_tl, \c_@@_name_fakebold_tl ] } { \cs_set_eq:NN \@@_stzhongs: \rmfamily \@@_warning:n { missing-stzhongs } } } } \@@_msg_new:nn { missing-stzhongs } { "STZHONGS.TTF"~ is~ not~ found~ in~ your~ system.\\ The~ font~ is~ normally~ distributed~ with~ MS~ Windows.~ I~ have~ used~ songti~ for~ substitution. } \cs_generate_variant:Nn \@@_loadfont_stzhongs:n { V } % \end{macrocode} % \end{macro} % \end{macro} % % % \subsubsection{定义数学字库} % % \begin{macro}{\@@_define_math_font:nn} % 批量定义数学字体配置。 % \begin{macrocode} \cs_new:Npn \@@_define_math_font:nn #1#2 { \cs_new:cpn { @@_loadfont_math_ #1 : } { \__um_setmathfont:nn { } {#2} } } % \end{macrocode} % \end{macro} % % \begin{macro} % { % \@@_loadfont_math_asana:, % \@@_loadfont_math_fira:, % \@@_loadfont_math_garamond:, % \@@_loadfont_math_lm:, % \@@_loadfont_math_libertinus:, % \@@_loadfont_math_stix:, % \@@_loadfont_math_bonum:, % \@@_loadfont_math_dejavu:, % \@@_loadfont_math_pagella:, % \@@_loadfont_math_schola:, % \@@_loadfont_math_termes:, % } % 批量定义若干数学字体的载入命令。 % \begin{macrocode} \clist_map_inline:nn { { asana } { Asana-Math.otf }, { fira } { FiraMath-Regular.otf }, { garamond } { Garamond-Math.otf }, { lm } { latinmodern-math.otf }, { libertinus } { LibertinusMath-Regular.otf }, { stix } { STIXMath-Regular.otf }, { bonum } { texgyrebonum-math.otf }, { dejavu } { texgyredejavu-math.otf }, { pagella } { texgyrepagella-math.otf }, { schola } { texgyreschola-math.otf }, { termes } { texgyretermes-math.otf }, } { \@@_define_math_font:nn #1 } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_math_cambria:} % Cambria Math 字体配置。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_math_cambria: { \bool_if:NTF \g_@@_font_dir_bool { \__um_setmathfont:nn { Path = \g_@@_font_dir_tl/, FontIndex = 1 } { cambria.ttc } } { \__um_setmathfont:nn { } { Cambria~Math } } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_math_xits:} % XITS Math 字体。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_math_xits: { \bool_if:NTF \g_@@_opt_math_int_bool { \tl_set:Nn \l_@@_tmpa_tl { 8 } } { \tl_clear:N \l_@@_tmpa_tl } \__um_setmathfont:nn { Extension = .otf, StylisticSet = \l_@@_tmpa_tl, BoldFont = XITSMath-Bold, } { XITSMath-Regular } \__um_setmathfont:nn { Extension = .otf, StylisticSet = 1, range = {cal, bfcal}, } { XITSMath-Regular } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_math_newcm:} % New Computer Modern Math 字体。 % \begin{macrocode} \cs_new:Npn \@@_loadfont_math_newcm: { \bool_if:NTF \g_@@_opt_math_int_bool { \tl_set:Nn \l_@@_tmpa_tl { 2 } } { \tl_clear:N \l_@@_tmpa_tl } \__um_setmathfont:nn { Extension = .otf, StylisticSet = \l_@@_tmpa_tl, } { NewCMMath-Book } \__um_setmathfont:nn { Extension = .otf, StylisticSet = 1, range = {scr,bfscr}, } { NewCMMath-Book } \__fontspec_main_setmathrm:nn { Extension = .otf, UprightFont = *-Book, BoldFont = *-Bold, ItalicFont = *-BookItalic, BoldItalicFont = *-BoldItalic, } { NewCM10 } \__fontspec_main_setmathsf:nn { Extension = .otf, UprightFont = *-Book, BoldFont = *-Bold, ItalicFont = *-BookOblique, BoldItalicFont = *-BoldOblique, } { NewCMSans10 } \__fontspec_main_setmathtt:nn { Extension = .otf, UprightFont = *-Book, ItalicFont = *-BookItalic, BoldFont = *-Bold, BoldItalicFont = *-BoldOblique, } { NewCMMono10 } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_loadfont_math_none:} % 不进行数学字体配置。 % \begin{macrocode} \cs_set_eq:NN \@@_loadfont_math_none: \tex_relax:D % \end{macrocode} % \end{macro} % % % \subsubsection{载入指定字库} % % \begin{macro}{\@@_loadfont:} % 载入字体命令。 % \begin{macrocode} \cs_new_protected:Npn \@@_loadfont: { \use:c { @@_loadfont_latin_ \g_@@_font_latin_tl : } \use:c { @@_loadfont_cjk_ \g_@@_font_cjk_tl : } % \end{macrocode} % 自行定义 \pkg{ctex} 中的四类字体命令。 % \begin{macrocode} \NewDocumentCommand \songti { } { \CJKfamily { zhsong } } \NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } \NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } \NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } } % \end{macrocode} % \end{macro} % % 载入设置的字体。^^A 为了吸收导言区的设置,放在其后载入。 % \begin{macrocode} % \BeforeBeginEnvironment { document } { \@@_loadfont: } \@@_loadfont: % \end{macrocode} % % 将华文中宋放在文档类最后载入。 % \begin{macrocode} \ctex_at_end_preamble:n { \@@_loadfont_stzhongs: } % \end{macrocode} % % \subsection{页眉页脚} % % 清除默认页眉页脚格式。 % \begin{macrocode} \fancyhf {} % \end{macrocode} % % 设置页眉页脚颜色。 % \changes{v2.0.0}{2025-02-21}{使用 \pkg{l3color},不再依赖 \pkg{xcolor}} % \begin{macrocode} \color_set:nn { headfoot } { red } % \providecolor { headfoot } { rgb } { 1, 0, 0 } % \end{macrocode} % % \begin{macro}{\@@_draw_hf_hline:n} % 绘制页眉页脚横线。 % \begin{arguments} % \item 页眉页脚线的高度(粗细) % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_draw_hf_hline:n #1 { { \color_select:n { headfoot } \tex_hrule:D height #1 } } % \end{macrocode} % \end{macro} % % \sout{设置页眉格式。仅在非盲审模式~\key{anonymous} 下显示学校名称。} % \begin{macrocode} %\bool_if:NF \g_@@_anonymous_bool % { \chead { \zihao{3} \ziju{0.75} \bfseries \kaishu \color_group_begin: \color_select:n { headfoot } \c_@@_header_tl \color_group_end: } % } \tl_set:Nn { \headrulewidth } { 1 pt } \tl_set:Nn { \headrule } { \skip_vertical:n { 3 pt } \@@_draw_hf_hline:n \headrulewidth \skip_vertical:n \headrulewidth \@@_draw_hf_hline:n \headrulewidth } % \end{macrocode} % % 设置页脚格式。 % \begin{macrocode} \cfoot { \zihao{-5} \thepage } \tl_set:Nn { \footrulewidth } { 0.5 pt } \tl_set:Nn { \footrule } { \@@_draw_hf_hline:n \footrulewidth \skip_vertical:n { 3 pt } } % \end{macrocode} % % \pkg{ctex} 宏包使用 |heading| 选项后,会把页面格式设置为 |headings|。 % 因此必须在 \pkg{ctex} 调用之后重新设置 \tn{pagestyle} 为 |fancy|。 % \begin{macrocode} \pagestyle { fancy } % \end{macrocode} % % % \section{封面扉页样式} % % 定义中英文封面,答辩委员会页,声明页样式,即在正文前不含有页眉页脚的特殊页面样式。 % % \subsection{信息录入} % % \begin{variable}{ % \g_@@_info_title_tl, % \g_@@_info_degree_tl, % \g_@@_info_author_tl, % \g_@@_info_major_tl, % \g_@@_info_supervisor_tl, % \g_@@_info_date_tl, % \g_@@_info_clc_tl, % \g_@@_info_student_id_tl, % \g_@@_info_school_id_tl, % \g_@@_info_secret_tl, % } % 声明中文封面信息。 % \begin{macrocode} \tl_new:N \g_@@_info_title_tl \tl_new:N \g_@@_info_degree_type_tl \tl_new:N \g_@@_info_author_tl \tl_new:N \g_@@_info_major_tl \tl_new:N \g_@@_info_supervisor_tl \tl_new:N \g_@@_info_date_tl \tl_new:N \g_@@_info_clc_tl \tl_new:N \g_@@_info_student_id_tl \tl_new:N \g_@@_info_school_id_tl \tl_new:N \g_@@_info_secret_tl % \end{macrocode} % \end{variable} % % \begin{variable}{ % \g_@@_info_title_en_tl, % \g_@@_info_author_en_tl, % \g_@@_info_major_en_tl, % \g_@@_info_supervisor_en_tl, % \g_@@_info_date_en_tl, % \g_@@_info_degree_en_tl, % } % 声明英文封面信息。 % \begin{macrocode} \tl_new:N \g_@@_info_title_en_tl \tl_new:N \g_@@_info_author_en_tl \tl_new:N \g_@@_info_major_en_tl \tl_new:N \g_@@_info_supervisor_en_tl \tl_new:N \g_@@_info_date_en_tl \tl_new:N \g_@@_info_degree_en_tl % \end{macrocode} % \end{variable} % % \begin{macro}{\g_@@_info_committee_seq} % 声明答辩委员会成员列表。 % \begin{macrocode} \seq_new:N \g_@@_info_committee_seq % \end{macrocode} % \end{macro} % % \begin{variable}{\l_@@_info_title_sanitized_tl,\l_@@_info_title_en_sanitized_tl} % 处理后的论文标题。 % \begin{macrocode} \tl_new:N \l_@@_info_title_sanitized_tl \tl_new:N \l_@@_info_title_en_sanitized_tl % \end{macrocode} % \end{variable} % % \begin{macro}[do-not-index={\1, \2}]{\@@_set_title:nn} % 设置论文标题,并删除其中的 |\\| 和汉字间的空格。 % \begin{macrocode} \cs_new_protected:Npn \@@_set_title:nn #1#2 { \tl_gset:cn { g_@@_info_ #1 _tl } { #2 } \tl_set:cn { l_@@_info_ #1 _sanitized_tl } { #2 } \tl_replace_all:cnn { l_@@_info_ #1 _sanitized_tl } { \\ } { ~ } \regex_replace_all:nnc { \s+ } { \ } { l_@@_info_ #1 _sanitized_tl } \regex_replace_all:nnc { ([\x{4e00}-\x{9fff}]) \s+ ([\x{4e00}-\x{9fff}]) } { \1 \2 } { l_@@_info_ #1 _sanitized_tl } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_set_date:n} % 设置论文提交日期。 % \begin{macrocode} \cs_new:Npn \@@_set_date:n #1 { \@@_set_date_aux:w #1 \q_stop } \cs_new_protected:Npn \@@_set_date_aux:w #1 - #2 - #3 \q_stop { \tl_gset:Nn \g_@@_info_date_tl { {#1} 年 {#2} 月 {#3} 日 } \tl_gset:Nn \g_@@_info_date_en_tl { \clist_item:Nn \c_@@_month_clist {#2},~ {#1} } } \clist_const:Nn \c_@@_month_clist { January, February, March, April, May, June, July, August, September, October, November, December, } % \end{macrocode} % \end{macro} % % 定义 |hust/info| 键值类。 % \begin{macrocode} \keys_define:nn { hust / info } { % \end{macrocode} % % \begin{macro}[module=info/]{info/title, info/title*} % 论文题目。以下带星号的项目均表示相应的英文字段。 % \begin{macrocode} title .tl_gset:N = \g_@@_info_title_tl, title* .tl_gset:N = \g_@@_info_title_en_tl, % title .code:n = { \@@_set_title:nn { title } { #1 } }, % title* .code:n = { \@@_set_title:nn { title_en } { #1 } }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/degree, info/degree*} % 学位类型(中文)或学科(英文)。 % 中文类型~\key[info]{degree} 分为学术型~\opt{academic},和专业型~\opt{professional}; % 英文学科~\key[info]{degree*}\footnote{为保持命名一致性,学科 degree discipline 在此处仍使用键名 |degree*|} 包括文学~\opt{Arts},理学~\opt{Science},教育学~\opt{Education},工学~\opt{Engineering},法学~\opt{Laws},医学~\opt{Medicine},以及其他~\opt{XXX}。 % \begin{macrocode} degree .choices:nn = { academic, professional } { \tl_gset_eq:NN \g_@@_info_degree_tl \l_keys_choice_tl }, degree .default:n = { academic }, degree* .tl_gset:N = \g_@@_info_degree_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/author, info/author*} % 学位申请人姓名。 % \begin{macrocode} author .tl_gset:N = \g_@@_info_author_tl, author* .tl_gset:N = \g_@@_info_author_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/major, info/major*} % 专业名称。 % \begin{macrocode} major .tl_gset:N = \g_@@_info_major_tl, major* .tl_gset:N = \g_@@_info_major_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/supervisor, info/supervisor*} % 指导老师。 % \begin{macrocode} supervisor .tl_gset:N = \g_@@_info_supervisor_tl, supervisor* .tl_gset:N = \g_@@_info_supervisor_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/date} % 论文提交日期。 % \begin{macrocode} date .code:n = { \@@_set_date:n { #1 } }, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/clc} % 中图分类号。 % \begin{macrocode} clc .tl_gset:N = \g_@@_info_clc_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/student-id, info/school-id} % 学号和学校代码。 % \begin{macrocode} student-id .tl_gset:N = \g_@@_info_student_id_tl, school-id .tl_gset:N = \g_@@_info_school_id_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/secret} % 密级。 % \begin{macrocode} secret .tl_gset:N = \g_@@_info_secret_tl, % \end{macrocode} % \end{macro} % % \begin{macro}[module=info/]{info/committee} % 答辩委员会成员列表。 % \begin{macrocode} committee .code:n = { \seq_gset_from_clist:Nn \g_@@_info_committee_seq { #1 } }, % \end{macrocode} % \end{macro} % % \begin{macrocode} } % \end{macrocode} % % \subsubsection{定义内部函数} % % \begin{macro}{\@@_spread_box:nn, \@@_spread_box:no} % 分散对齐的水平盒子。 % \begin{arguments} % \item 宽度 % \item 内容 % \end{arguments} % 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip} % 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。 % \begin{macrocode} \cs_new_protected:Npn \@@_spread_box:nn #1#2 { \mode_leave_vertical: \hbox_to_wd:nn {#1} { \tl_map_inline:nn {#2} { ##1 \hfil } \unskip } } \cs_generate_variant:Nn \@@_spread_box:nn { no } % \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} { \tex_hfil:D #2 \tex_hfil:D } } \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}[deprecated]{\@@_blank_underline:n} % 下划线占位符。|#1|: 长度。 % \begin{macrocode} \cs_new:Npn \@@_blank_underline:n #1 { \rule [ -0.5 ex ] {#1} { 0.4 pt } } % \end{macrocode} % \end{macro} % % \subsection{封面模板} % % \begin{macro}[int, module=component/]{component/} % 封面组件。 % \begin{arguments} % \item[\opt{content}] 组件主体内容 % \item[\opt{format}] 组件字体/段落格式 % \item[\opt{height}] 组件固定高度,不设置则自动计算。主要用于行数不确定,需要固定高度的情况 % \item[\opt{top-lines}] 顶部空出的行数,按照设定的段落格式计算 % \item[\opt{top-skip}] 顶部间距(建议优先配置底部间距,顶部间距仅在特殊情况使用) % \item[\opt{bottom-skip}] 底部间距 % \item[\opt{bottom-lines}] 底部空出的行数,按照设定的段落格式计算 % \item[\opt{align}] 对齐方式,可选值为靠左对齐~\opt{left},靠右对齐~\opt{right},居中对齐~\opt{center},以及两端对齐~\opt{justify}。默认为居中对齐 % \end{arguments} % \begin{macrocode} \NewTemplateType { hust / component } { 0 } \DeclareTemplateInterface { hust / component } { plain } { 0 } { content : tokenlist = \c_empty_tl, format : tokenlist = \c_empty_tl, width: skip = \c_zero_skip, height: skip = \c_zero_skip, top-lines : integer = \c_zero_int, top-skip : skip = \c_zero_skip, bottom-skip : skip = \c_zero_skip, bottom-lines : integer = \c_zero_int, align : choice { left, right, center, justify } = center, } \DeclareTemplateCode { hust / component } { plain } { 0 } { content = \l_@@_component_content_tl, format = \l_@@_component_format_tl, width = \l_@@_component_width_skip, height = \l_@@_component_height_skip, top-lines = \l_@@_component_top_lines_int, top-skip = \l_@@_component_top_skip, bottom-skip = \l_@@_component_bottom_skip, bottom-lines = \l_@@_component_bottom_lines_int, align = { left = \cs_set_eq:NN \l_@@_component_align: \raggedright, right = \cs_set_eq:NN \l_@@_component_align: \raggedleft, center = \cs_set_eq:NN \l_@@_component_align: \centering, justify = \cs_set_eq:NN \l_@@_component_align: \prg_do_nothing:, } } { \AssignTemplateKeys \l_@@_component_format_tl \int_step_inline:nn { \l_@@_component_top_lines_int } { \mode_leave_vertical: \tex_par:D } \dim_compare:nNnTF { \l_@@_component_height_skip } > { \c_zero_skip } { \box_clear_new:N \l_@@_component_box \vbox_set_to_ht:Nnn \l_@@_component_box { \l_@@_component_height_skip } { \skip_vertical:N \l_@@_component_top_skip \l_@@_component_align: \l_@@_component_content_tl \tex_vfill:D } \box_use:N \l_@@_component_box } { \skip_vertical:N \l_@@_component_top_skip \l_@@_component_align: \l_@@_component_content_tl \tex_par:D } \int_step_inline:nn { \l_@@_component_bottom_lines_int } { \mode_leave_vertical: \tex_par:D } \skip_vertical:N \l_@@_component_bottom_skip \skip_vertical:N \c_zero_skip } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/page]{page/} % 页面模板。 % \begin{arguments} % \item[\opt{prefix}] 组件共用前缀 % \item[\opt{components}] 组件列表 % \item[\opt{style}] 页面样式 (可使用 \tn{thispagestyle} 配置) % \item[\opt{format}] 页面字体/段落格式 % \item[\opt{top-skip}] 顶部间距 % \end{arguments} % \begin{macrocode} \NewTemplateType { hust / page } { 0 } \DeclareTemplateInterface { hust / page } { title } { 0 } { prefix : tokenlist, components : commalist, style : tokenlist = empty, format : tokenlist = \linespread { } \selectfont, top-skip : skip = \c_zero_skip, } \DeclareTemplateCode { hust / page } { title } { 0 } { prefix = \l_@@_page_prefix_tl, components = \l_@@_page_components_clist, style = \l_@@_page_style_tl, format = \l_@@_page_format_tl, top-skip = \l_@@_page_top_skip, } { \AssignTemplateKeys \skip_vertical:N \l_@@_page_top_skip \group_begin: \exp_args:No \thispagestyle { \l_@@_page_style_tl } \l_@@_page_format_tl \clist_map_inline:Nn \l_@@_page_components_clist { \group_begin: \UseInstance { hust / component } { \l_@@_page_prefix_tl / ##1 } \group_end: } \group_end: \clearpage } % \end{macrocode} % \end{macro} % % \begin{macro}{ % \@@_declare_component_instance:nnn, % \@@_declare_page_instance:nn, % } % 声明模板实例的辅助函数。 % \begin{macrocode} \cs_new_protected:Npn \@@_declare_component_instance:nnn #1#2#3 { \DeclareInstance { hust / component } { #1/#2 } { plain } {#3} } \cs_new_protected:Npn \@@_declare_page_instance:nn #1#2 { \DeclareInstance { hust / page } {#1} { title } { prefix = #1, #2, } } % \end{macrocode} % \end{macro} % % \subsection{封面组件} % % \subsubsection{中文封面} % % \begin{macro}[int, module=component/]{title zh/identifiers} % 分类号,学号,学校代码,密级。 % \begin{macrocode} \@@_declare_component_instance:nnn { title zh } { identifiers } { content = { \@@_title_zh_ids_aux:nn { 6em } { clc } % 3 em \skip_horizontal:n { \linewidth - 19em } \@@_title_zh_ids_aux:nn { 8em } { student_id } % 4 em \tex_par:D \@@_title_zh_ids_aux:nn { 5em } { school_id } % 4 em \skip_horizontal:n { \linewidth - 19em } \@@_title_zh_ids_aux:nn { 8em } { secret } % 4 em }, format = { \zihao{-4} \bfseries \rmfamily \songti \@@_line_spread:n { 1.5 } }, bottom-skip = 2 cm, } \cs_new:Npn \@@_title_zh_ids_aux:nn #1#2 { \tl_use:c { c_@@_name_ #2 _tl } \@@_ul_to_wd:nnn { 1 pt } { #1 } { \tl_use:c { g_@@_info_ #2 _tl } } } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title zh/logo} % 校名图片。 % \begin{macrocode} \@@_declare_component_instance:nnn { title zh } { logo } { content = { \includegraphics [ height = 1.4 cm ] { hust-title.pdf } }, bottom-skip = 0.5 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title zh/type} % 学位级别。 % \begin{macrocode} \__ctex_save_font_size:nn { a } { 45 bp } % 大初号 \@@_declare_component_instance:nnn { title zh } { type } { content = { \c_@@_name_type_zh_tl }, format = { \zihao { a } \bfseries \songti \ziju { 0.1 } }, bottom-skip = 0.5 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title zh/degree} % 学位类型。 % \begin{macrocode} \@@_declare_component_instance:nnn { title zh } { degree } { content = { ( \c_@@_name_academic_zh_tl \tl_if_eq:NnTF \g_@@_info_degree_tl { academic } { \c_@@_checkbox_tl } { \c_@@_emptybox_tl } \skip_horizontal:n { 2.5 em } \c_@@_name_professional_zh_tl \tl_if_eq:NnTF \g_@@_info_degree_tl { professional } { \c_@@_checkbox_tl } { \c_@@_emptybox_tl } ) }, format = { \zihao { -3 } \c_@@_name_degree_font_tl }, bottom-skip = 1.5 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title zh/title} % 论文题目。 % \begin{macrocode} \@@_declare_component_instance:nnn { title zh } { title } { content = { \g_@@_info_title_tl }, format = { \zihao { 1 } \bfseries \songti \@@_line_spread:n { 1.5 } }, height = 4.8 cm, bottom-skip = 1 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title zh/info} % 信息表格。 % \begin{macrocode} \@@_declare_component_instance:nnn { title zh } { info } { content = { \tl_set:Nn \arraystretch { 2 } \begin{tabular}{p{5em}@{:\hspace{1em}}l} \c_@@_name_author_zh_tl & \g_@@_info_author_tl \\ \c_@@_name_major_zh_tl & \g_@@_info_major_tl \\ \c_@@_name_supervisor_zh_tl & \g_@@_info_supervisor_tl \\ \c_@@_name_date_tl & \g_@@_info_date_tl \\ \end{tabular} }, format = { \zihao { -3 } \bfseries \rmfamily \songti }, bottom-skip = 30 pt, } % \end{macrocode} % \end{macro} % % \subsubsection{英文封面} % % \begin{macro}[int, module=hust/component/]{title en/degree} % 学位级别和学科。 % \begin{macrocode} \@@_declare_component_instance:nnn { title en } { degree } { content = { \c_@@_name_type_en_tl \tl_if_eq:NnTF \g_@@_info_degree_tl { academic } { \c_@@_name_academic_en_tl } { \c_@@_name_professional_en_tl } \g_@@_info_degree_en_tl }, format = { \zihao { -3 } \bfseries \rmfamily \@@_line_spread:n { 1.5 } }, bottom-skip = 5.5 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title en/title} % 论文题目。 % \begin{macrocode} \@@_declare_component_instance:nnn { title en } { title } { content = { \g_@@_info_title_en_tl }, format = { \zihao { -2 } \bfseries \rmfamily \@@_line_spread:n { 1.5 } }, height = 3 cm, bottom-skip = 3 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title en/info} % 信息表格。 % \begin{macrocode} \@@_declare_component_instance:nnn { title en } { info } { content = { \begin{tabular}{l@{\hspace{0.5em}:\hspace{0.5em}}l} \c_@@_name_author_en_tl & \g_@@_info_author_en_tl \\ \c_@@_name_major_en_tl & \g_@@_info_major_en_tl \\ \c_@@_name_supervisor_en_tl & \g_@@_info_supervisor_en_tl \\ \end{tabular} }, format = { \zihao { -3 } \bfseries \rmfamily \@@_line_spread:n { 1.5 } }, bottom-skip = 4 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title en/address} % 学校名称和地址。 % \begin{macrocode} \@@_declare_component_instance:nnn { title en } { address } { content = { \c_@@_address_tl }, format = { \zihao { -3 } \bfseries \rmfamily \@@_line_spread:n { 1.5 } }, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{title en/date} % \begin{macrocode} \@@_declare_component_instance:nnn { title en } { date } { content = { \tl_use:N \g_@@_info_date_en_tl }, format = { \zihao { -3 } \bfseries \rmfamily \@@_line_spread:n { 1.5 } }, } % \end{macrocode} % \end{macro} % % \subsubsection{答辩委员会页} % % \begin{macro}[int, module=hust/component/]{committee/title} % 答辩委员会标题。 % \begin{macrocode} \@@_declare_component_instance:nnn { committee } { title } { content = { \c_@@_name_committee_tl }, format = { \zihao { 3 } \bfseries \sffamily \@@_line_spread:n { 1.5 } }, bottom-lines = 1, } \tl_const:Nn \c_@@_name_committee_tl { 答辩委员会 } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{committee/members} % 答辩委员会成员列表。 % \begin{macrocode} \@@_declare_component_instance:nnn { committee } { members } { content = { \tl_set:Nn \arraystretch { 1.5 } \begin{tabular} { |c|c|c|c| } \hline \c_@@_committee_header_tl \\ \hline \int_const:Nn \l_@@_info_committee_count_int { \seq_count:N \g_@@_info_committee_seq } \seq_map_indexed_inline:Nn \g_@@_info_committee_seq { \int_case:nnF { #1 } { { 1 } { \clist_item:Nn \c_@@_committee_role_clist { 1 } & #2 \\ \hline } { 2 } { \multirow { \int_eval:n { \l_@@_info_committee_count_int - 1 } } { * } { \clist_item:Nn \c_@@_committee_role_clist { 2 } } & #2 \\ \cline{2-4} } { \l_@@_info_committee_count_int } { & #2 } } { & #2 \\ \cline{2-4} } } \\ \hline \end{tabular} }, format = { \zihao { 4 } \sffamily \@@_line_spread:n { 1.5 } }, top-lines = 1, } \tl_const:Nn \c_@@_committee_header_tl { \makebox[3em]{} & \makebox[4em][c]{姓名} & \makebox[4em][c]{职称} & \makebox[12em][c]{单位} } \clist_const:Nn \c_@@_committee_role_clist { 主席, 委员, } \tl_new:N \l_@@_committee_member_tl % \end{macrocode} % \end{macro} % % \subsubsection{声明页} % % \begin{macro}[int, module=hust/component/]{decl/orig title} % 独创性声明标题。 % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { orig title } { content = { \c_@@_orig_decl_title_tl }, format = { \zihao { 3 } \bfseries \heiti }, bottom-lines = 1, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{decl/orig text} % 独创性声明正文。 % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { orig text } { content = { \c_@@_orig_decl_text_tl }, align = justify, bottom-lines = 1, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{decl/orig sign} % 独创性声明签名。 % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { orig sign } { content = { \clist_map_inline:Nn \c_@@_orig_decl_sign_clist { #1 \\ } }, align = right, bottom-lines = 3, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{decl/auth title} % 学位论文版权使用授权书标题。 % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { auth title } { content = { \c_@@_auth_decl_title_tl }, format = { \zihao { 3 } \bfseries \heiti }, top-lines = 1, bottom-lines = 1, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{decl/auth text} % 学位论文版权使用授权书正文。 % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { auth text } { content = { \c_@@_auth_decl_text_tl }, align = justify, bottom-skip = 0.5 cm, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{decl/auth secr} % 学位论文保密使用保密选项。 % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { auth secr } { content = { \mode_leave_vertical: \hbox_overlap_right:n { \clist_item:Nn \c_@@_auth_decl_secr_clist { 1 } } \skip_vertical:n { -1.2 cm } \skip_horizontal:n { 6 em } \clist_item:Nn \c_@@_auth_decl_secr_clist { 2 } \tex_par:D \skip_horizontal:n { 6 em } \clist_item:Nn \c_@@_auth_decl_secr_clist { 3 } \tex_par:D \clist_item:Nn \c_@@_auth_decl_secr_clist { 4 } }, align = justify, bottom-lines = 1, } % \end{macrocode} % \end{macro} % % \begin{macro}[int, module=hust/component/]{decl/auth sign} % \begin{macrocode} \@@_declare_component_instance:nnn { decl } { auth sign } { content = { \clist_map_inline:Nn \c_@@_auth_decl_sign_clist { #1 \tex_par:D } }, align = justify, } % \end{macrocode} % \end{macro} % % \subsection{绘制封面} % % \begin{macro}{\makezhtitle} % 中文标题页。 % \begin{macrocode} \@@_declare_page_instance:nn { title zh } { components = { identifiers, logo, type, degree, title, info, }, } \DeclareDocumentCommand \makezhtitle { } { \UseInstance { hust / page } { title zh } } % \end{macrocode} % \end{macro} % % \begin{macro}{\makeentitle} % 英文标题页。 % \begin{macrocode} \@@_declare_page_instance:nn { title en } { components = { degree, title, info, address, date, }, } \DeclareDocumentCommand \makeentitle { } { \UseInstance { hust / page } { title en } } % \end{macrocode} % \end{macro} % % \begin{macro}{\makecommittee} % 答辩委员会页。 % \begin{macrocode} \@@_declare_page_instance:nn { committee } { components = { title, members, }, } \DeclareDocumentCommand \makecommittee { } { \UseInstance { hust / page } { committee } } % \end{macrocode} % \end{macro} % % \begin{macro}{\makedecl} % 声明页。 % \begin{macrocode} \@@_declare_page_instance:nn { decl } { components = { orig title, orig text, orig sign, auth title, auth text, auth secr, auth sign, }, format = { \zihao { -4 } \rmfamily \@@_line_spread:n { 1.5 } } } \DeclareDocumentCommand \makedecl { } { \UseInstance { hust / page } { decl } } % \end{macrocode} % \end{macro} % % \begin{macro}{\maketitle} % 封面。 % \begin{macrocode} \DeclareDocumentCommand \maketitle { } { \makezhtitle \tl_if_eq:NnT \g_@@_degree_type_tl { doctor } { \makecommittee } \makeentitle \makedecl } % \end{macrocode} % \end{macro} % % % \section{前文样式} % % 定义从摘要到目录的样式,即有页眉页脚,含有大写罗马数字页码页的样式。 % % \begin{macro}{\frontmatter} % \begin{macrocode} \@@_appto_cmd:Nn \frontmatter { \pagestyle { fancy } \pagenumbering { Roman } \@@_toc_chapter_frontmatter: } % \end{macrocode} % \end{macro} % % \subsection{摘要样式} % % \begin{environment}{abstract, abstract*} % 摘要环境。 % \begin{macrocode} \NewDocumentEnvironment { abstract } { } { \chapter**{\c_@@_name_abstract_zh_tl} } { } \NewDocumentEnvironment { abstract* } { } { \chapter**{\c_@@_name_abstract_en_tl} } { } % \end{macrocode} % \end{environment} % % \begin{macro}{\keywords, \keywords*} % 关键词命令。 % \begin{macrocode} \NewDocumentCommand \keywords { s } { \IfBooleanTF { #1 } { \@@_keywords:nw { en } } { \@@_keywords:nw { zh } } } \cs_new_nopar:Npn \@@_keywords:nw #1 #2 { \zihao{-4} \rmfamily \tex_par:D \skip_horizontal:n \c_zero_skip \tex_par:D \tex_noindent:D \group_begin: \bfseries \heiti \tl_use:c { c_@@_name_keywords_ #1 _tl } \group_end: \c_space_tl #2 } % \end{macrocode} % \end{macro} % % \subsection{目录样式} % % \begin{macrocode} \tl_set:Nn \contentsname { 目\hspace{1em}录 } % \end{macrocode} % % 设置目录章节显示深度。 % \begin{macrocode} \keys_set:nn { ctex } { tocdepth = section, } % \end{macrocode} % % 设置目录项右边距。 % \begin{macrocode} \contentsmargin { 0 pt } % \end{macrocode} % % \begin{macro}{\@@_toc_format:nnnn} % 设置目录项格式。 % \begin{arguments} % \item 章节类型 % \item 编号与章节名称间距 % \item 章节名称样式 % \item 章节页码格式(|\thecontentspage|表示页码) % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_toc_format:nnnn #1#2#3#4 { \titlecontents { #1 } [ 0 pt ] { #3 } { \thecontentslabel \hspace{#2} #3 } { #3 } { #4 } } % \end{macrocode} % \end{macro} % % \begin{macro}{\ddotfill} % 实现更密的虚线。该命令仅可使用 \LaTeXe 命令实现。 % \begin{macrocode} \cs_new:Npn \ddotfill { \leavevmode \leaders \hbox to .22em {\hss .\hss } \hfill \kern 0pt } % \end{macrocode} % \end{macro} % % \begin{macro}{ % \@@_toc_chapter_frontmatter: % \@@_toc_chapter_mainmatter: % \@@_toc_chapter_backmatter: % } % 设置章的三种样式,分别是在前文部分有虚线,不带括号页码的格式; % 正文无虚线,带括号页码的格式; % 以及附录部分有虚线,带括号页码的格式。 % \begin{macrocode} \cs_new_protected:Npn \@@_toc_chapter_frontmatter: { \@@_toc_format:nnnn { chapter } { 1 em} { \zihao{4} \bfseries \rmfamily \heiti } { \mdseries \ddotfill \thecontentspage } } \cs_new_protected:Npn \@@_toc_chapter_mainmatter: { \@@_toc_format:nnnn { chapter } { 1 em } { \zihao{4} \bfseries \rmfamily \heiti } { \mdseries \hfill (\thecontentspage) } } \cs_new_protected:Npn \@@_toc_chapter_backmatter: { \@@_toc_format:nnnn { chapter } { 1 em } { \zihao{4} \bfseries \rmfamily \heiti } { \mdseries \ddotfill (\thecontentspage) } } % \end{macrocode} % \end{macro} % % 设置节的样式。 % \begin{macrocode} \@@_toc_format:nnnn { section } { 2 em } { \zihao{4} \rmfamily } { \ddotfill (\thecontentspage) } % \end{macrocode} % % \section{正文样式} % % \begin{macrocode} \@@_appto_cmd:Nn \mainmatter { \pagestyle { fancy } \pagenumbering { arabic } \@@_toc_chapter_mainmatter: } % \end{macrocode} % % \subsection{章节样式} % % \begin{macrocode} \keys_set:nn { ctex } { % \end{macrocode} % 设置章(chapter)、节(section)与小节(sub-section)标题样式。 % \begin{macrocode} chapter = { format = \zihao{3} \bfseries \rmfamily \heiti \centering \linespread{1.5}, name = {}, beforeskip = 15.5 bp, afterskip = 14 bp + \CTEX@chapter@lofskip, number = \arabic{ chapter }, pagestyle = fancy, fixskip = true, }, section = { format = \zihao{4} \bfseries \rmfamily \heiti \raggedright, numberformat = \rmfamily, beforeskip = 10 bp, afterskip = 7 bp, }, subsection = { format = \zihao{-4} \bfseries \rmfamily \heiti \raggedright, numberformat = \rmfamily, beforeskip = 7 bp, afterskip = 4 bp, } } % \end{macrocode} % % \begin{macro}{\chapter, \chapter*, \chapter**} % 对带有星号的章节指令补丁,使得其能够在目录中显示。 % \begin{macrocode} \cs_set_eq:NN \@@_chapter:D \chapter \RenewDocumentCommand \chapter { s s o m } { \IfNoValueTF{#3} { \IfBooleanTF{#1} { \@@_chapter:D*{#4} \IfBooleanT{#2} { \CTEX@addtocline{chapter}{#4} } } { \@@_chapter:D{#4} } } { \IfBooleanTF{#1} { \@@_chapter:D*{#4} \IfBooleanT{#2} { \CTEX@addtocline{chapter}{#3} } } { \@@_chapter:D[#3]{#4} } } } % \end{macrocode} % \end{macro} % % \section{后文样式} % % \begin{macro}{\backmatter} % \begin{macrocode} \@@_appto_cmd:Nn \backmatter { \@@_toc_chapter_backmatter: } % \end{macrocode} % \end{macro} % % % \subsection{致谢页} % % \begin{environment}{acknowledgements} % \begin{macrocode} \NewDocumentEnvironment { acknowledgements } { } { \chapter**{致\hspace{1em}谢} } { } % \end{macrocode} % \end{environment} % % \subsection{参考文献} % % \begin{macro}{\printbibliography} % 在使用 \tn{printbibliography} 的同时添加目录项。 % \begin{macrocode} \cs_if_exist:NT \printbibliography { \defbibheading{bibliography}[\refname]{% \chapter**{#1}% } } % \end{macrocode} % \end{macro} % % \section{附录样式} % % \begin{macrocode} \@@_appto_cmd:Nn \appendix { } % \end{macrocode} % % \begin{macrocode} \keys_set:nn { ctex / appendix } { number = \arabic{chapter}, } % \end{macrocode} % % \subsection{答辩委员会决议} % % \subsection{成果论文对应关系} % % \subsection{中英文缩写对照表} % % \subsection{程序代码样式} % % \section{文档类后处理} % % \section{用户接口} % % \begin{macro}[module=info/]{info/} % \begin{macro}[module=style/]{style/} % 定义元(meta)键值对。 % \begin{macrocode} \keys_define:nn { hust } { info .meta:nn = { hust / info } {#1}, style .meta:nn = { hust / style } {#1} } % \end{macrocode} % \end{macro} % \end{macro} % % 文档类初始设置。学校代码默认为 \opt{10487}。 % \begin{macrocode} \keys_set_known:nn { hust } { info = { degree = { academic }, secret = , school-id = { 10487 }, date = { \int_use:N \c_sys_year_int - \int_use:N \c_sys_month_int - \int_use:N \c_sys_day_int }, anonymous-list = { author, student_id, supervisor, author_en, supervisor_en, }, committee = { { &~&~ }, { &~&~ }, { &~&~ }, { &~&~ }, { &~&~ }, { &~&~ }, { &~&~ }, } } } % \end{macrocode} % % \begin{macro}{\hustsetup} % 用户设置接口。 % \changes{v2.0.0}{2025-02-11}{实现统一用户接口配置选项} % \begin{macrocode} \NewDocumentCommand \hustsetup { m } { \keys_set:nn { hust } {#1} } % \end{macrocode} % \end{macro} % % \begin{macrocode} % % \end{macrocode} % % \section{常量定义} % % \begin{macrocode} %<*def-m|def-d> % \end{macrocode} % % \subsection{全局常量} % % \begin{variable}{\c_@@_name_school_zh_tl, \c_@@_name_school_en_tl} % 学校名称。 % \begin{macrocode} \tl_const:Nn \c_@@_name_school_zh_tl { 华中科技大学 } \tl_const:Nn \c_@@_name_school_en_tl { Huazhong~ University~ of~ Science~ and~ Technology } % \end{macrocode} % \end{variable} % % 常用标点符号,见表~\ref{tab:punctuations},定义为 |\c_@@_ #1 _tl|。 % \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 & ^^^^3001 & U+3001 \\ % 中文句号 & Ideographic full stop & ^^^^3002 & U+3002 \\ % 中文逗号 & Fullwidth comma & ^^^^ff0c & U+FF0C \\ % 全角西文句点 & Fullwidth full stop & ^^^^ff0e & U+FF0E \\ % 中文冒号 & Fullwidth colon & ^^^^ff1a & U+FF1A \\ % 中文分号 & Fullwidth semicolon & ^^^^ff1b & U+FF1B \\ % 中文左圆括号 & Fullwidth left parenthesis & ^^^^ff08 & U+FF08 \\ % 中文右圆括号 & Fullwidth right parenthesis & ^^^^ff09 & U+FF09 \\ % \bottomrule % \end{tabular} % \end{table} % % \begin{variable}{\c_@@_line_spread_fp} % 设置行距倍数1.5倍。 % \begin{macrocode} \fp_const:Nn \c_@@_line_spread_fp { 1.5 } % \end{macrocode} % \end{variable} % % \begin{variable}{\c_@@_emptybox_tl, \c_@@_checkbox_tl} % \begin{macrocode} \tl_const:Nn \c_@@_emptybox_tl { \usym{2610} } \tl_const:Nn \c_@@_checkbox_tl { \usym{2611} } % \end{macrocode} % \end{variable} % % \subsection{封面页常量} % \begin{variable}{ % \c_@@_name_degree_font_tl, % \c_@@_name_professional_tl, % \c_@@_name_date_tl, % \c_@@_name_clc_tl, % \c_@@_name_student_id_tl, % \c_@@_name_school_id_tl, % \c_@@_name_secret_tl, % \c_@@_school_id_tl, % } % 中文封面页常量。 % \begin{macrocode} \clist_map_inline:nn { % { degree_font } { \bfseries \songti }, % { degree_font } { \heiti }, { date } { 答\hfill 辩\hfill 日\hfill 期 }, { clc } { 分类号 }, { student_id } { 学号 }, { school_id } { 学校代码 }, { secret } { 密级 }, } { \@@_define_name:nn #1 } \tl_const:Nn \c_@@_school_id_tl { 10487 } % \end{macrocode} % \end{variable} % % \begin{variable}{ % \c_@@_address_tl % } % 英文封面页常量。 % \begin{macrocode} \tl_const:Nn \c_@@_address_tl { Huazhong~ University~ of~ Science~ and~ Technology\\ Wuhan~ 430074,~ P.~ R.~ China } % \end{macrocode} % \end{variable} % % \begin{variable}{ % \c_@@_name_type_en_tl, % \c_@@_name_type_zh_tl, % \c_@@_name_academic_en_tl, % \c_@@_name_academic_zh_tl, % \c_@@_name_professional_en_tl, % \c_@@_name_professional_zh_tl, % \c_@@_name_author_en_tl, % \c_@@_name_author_zh_tl, % \c_@@_name_major_en_tl, % \c_@@_name_major_zh_tl, % \c_@@_name_supervisor_en_tl, % \c_@@_name_supervisor_zh_tl, % } % 中英文页共用常量。 % \begin{macrocode} \clist_map_inline:nn { { type } { A~ Dissertation~ Submitted~ in~ Partial~ Fulfillment~ of~ % the~ % The~ Requirements~ for~ } % { 硕士学位论文 }, % { 博士学位论文 }, %<*def-m> { academic } { the~ Master~ Degree~ in } { 学术型 }, { professional } { the~ Professional~ Master~ Degree~ in } { 专业型 }, { author } { Candidate } { 学\hfill 位\hfill 申\hfill 请\hfill 人 }, % %<*def-d> { academic } { The~ Degree~ of~ Doctor~ of } { 学术型 }, { professional } { The~ Degree~ of~ Doctor~ of } { 专业型 }, % no diff in English { author } { Ph.D.~ Candidate } { 学\hfill 位\hfill 申\hfill 请\hfill 人 }, % { major } { Major } { 学\hfill 科\hfill 专\hfill 业 }, { supervisor } { Supervisor } { 指\hfill 导\hfill 老\hfill 师 }, } { \@@_define_name:nnn #1 } % \end{macrocode} % \end{variable} % % \subsection{声明页常量} % % \begin{variable}{\c_@@_orig_decl_title_tl, \c_@@_orig_decl_text_tl} % 独创性声明。 % \begin{macrocode} \tl_const:Nn \c_@@_orig_decl_title_tl { 独创性声明 } \tl_const:Nn \c_@@_orig_decl_text_tl { 本人声明所呈交的学位论文是我个人在导师指导下进行的研究工作及取得的研 究成果。尽我所知,除文中已经标明引用的内容外,本论文不包含任何其他个人或 集体已经发表或撰写过的研究成果。对本文的研究做出贡献的个人和集体,均已在 文中以明确方式标明。本人完全意识到本声明的法律结果由本人承担。 } % \end{macrocode} % \end{variable} % % \begin{variable}{\c_@@_orig_decl_sign_clist} % 独创性声明签名项目。 % \begin{macrocode} \clist_const:Nn \c_@@_orig_decl_sign_clist { 学位论文作者签名:\hspace{2em}\mbox{}, 日期:\hspace{2em}年\hspace{1.5em}月\hspace{1.5em}日 } % \end{macrocode} % \end{variable} % % \begin{variable}{\c_@@_auth_decl_title_tl, \c_@@_auth_decl_text_tl} % 学位论文版权使用授权书。 % \begin{macrocode} \tl_const:Nn \c_@@_auth_decl_title_tl { 学位论文版权使用授权书 } \tl_const:Nn \c_@@_auth_decl_text_tl { 本学位论文作者完全了解学校有关保留、使用学位论文的规定,即:学校有权 保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。 本人授权华中科技大学可以将本学位论文的全部或部分内容编入有关数据库进行检 索,可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。 } % \end{macrocode} % \end{variable} % % \begin{variable}{\c_@@_auth_decl_secr_clist, \c_@@_auth_decl_sign_clist} % 学位论文版权使用授权书填写项目:保密与签名。 % \begin{macrocode} \clist_const:Nn \c_@@_auth_decl_secr_clist { 本论文属于, 保\hspace{1em}密□,在\underline{\hspace{3em}}年解密后适用本授权书。, 不保密□。, (请在以上方框内打“√”) } \clist_const:Nn \c_@@_auth_decl_sign_clist { 学位论文作者签名:\hfill{} 指导教师签名:\hspace*{5em} \mbox{}, 日期:\hspace*{2em}年\hspace*{1.5em}月\hspace*{1.5em}日 \hfill{} 日期:\hspace*{2em}年\hspace*{1.5em}月\hspace*{1.5em}日\hspace*{1em} \mbox{} } % \end{macrocode} % \end{variable} % % \subsection{摘要页常量} % \begin{variable}{ % \c_@@_name_abstract_zh_tl, % \c_@@_name_abstract_en_tl, % \c_@@_name_keywords_zh_tl, % \c_@@_name_keywords_en_tl, % \c_@@_sep_keywords_zh_tl, % \c_@@_sep_keywords_en_tl, % } % \begin{macrocode} \clist_map_inline:nn { { abstract } { Abstract } { 摘\hspace{1em}要 }, { keywords } { Key~ words: } { 关键词: }, } { \@@_define_name:nnn #1 } \tl_const:Nn \c_@@_sep_keywords_zh_tl { ; } \tl_const:Nn \c_@@_sep_keywords_en_tl { , } % \end{macrocode} % \end{variable} % % \subsection{正文常量} % \begin{variable}{\c_@@_header_tl} % 页眉。 % \begin{macrocode} %\tl_const:Nn \c_@@_header_tl { 华中科技大学硕士学位论文 } %\tl_const:Nn \c_@@_header_tl { 华中科技大学博士学位论文 } % \end{macrocode} % \end{variable} % % \begin{macrocode} % % \end{macrocode} % \section{文献样式} % % \changes{v2.0.0}{2025-02-26}{实现基于\pkg{biblatex}的文献样式} % % \subsection{标注样式} % % \begin{macrocode} %<*cbx> % \end{macrocode} % % 无须修改标注样式。 % \begin{macrocode} \RequireCitationStyle{gb7714-2015} % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \subsection{著录样式} % % \begin{macrocode} %<*bbx> % \end{macrocode} % % 基于 \pkg{biblatex-gb7714-2015} 的著录样式。 % \begin{macrocode} \RequireBibliographyStyle{gb7714-2015} % \end{macrocode} % % 设置 \pkg{biblatex-gb7714-2015} 通用著录样式选项。 % \begin{macrocode} \ExecuteBibliographyOptions { isbn = false, url = false, doi = false, gbnamefmt = givenahead, gbtype = false, gbpunctin = false, maxbibnames = 6, minbibnames = 6, } % \end{macrocode} % % 删除著录项末尾的标点符号。 % \begin{macrocode} \renewcommand{\finentrypunct}{} % \end{macrocode} % % \subsubsection{专著} % % 设置专著版本样式,并使用 \pkg{zhnumber} 将中文专著的阿拉伯数字版本号自动转换为中文数字。 % \begin{macrocode} \newcommand\HUST@bib@zhedition[1]{(#1)} \newcommand\HUST@bib@enedition[1]{(#1)} \DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF \testCJKfirst{userd}% \iftoggle{ifCJKforgbt}% {\ifinteger{#1} {% \ifnumgreater{#1}{1}{\printtext{ %#1\str@edition \HUST@bib@zhedition{第\zhnumber{#1}版} }}{} }% %{#1\isdot}}% {\HUST@bib@zhedition{#1}} \addspace }% {\ifinteger{#1}% {\ifnumgreater{#1}{1}{ %\mkbibordedition{#1}~\bibstring{edition} \HUST@bib@enedition{\mkbibordedition{#1}~\bibstring{edition}} }{} }% %{#1\isdot}}% {\HUST@bib@enedition{#1}\isdot} } } \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 % \end{macrocode} % 删除版本前的标点符号。 % \begin{macrocode} \if false \usebibmacro{maintitle+title}% \iftoggle{bbx:gbstrict}{}{% \newunit \printlist{language}% \newunit\newblock% \usebibmacro{byauthor}% \newunit\newblock }% \usebibmacro{byeditor+others}% \newunit \fi \printfield[titlecase]{title}% \printfield{edition}% \newunit\newblock%% \iftoggle{bbx:gbstrict}{}{% \iffieldundef{maintitle}% {%\printfield{volume}% \printfield{part}}% {}% \newunit% \printfield{volumes}% \newunit\newblock% \usebibmacro{series+number}}% \newunit\newblock% %\printfield{note}% %\newunit\newblock% \usebibmacro{publisher+location+date}% %\newunit\newblock %这里标点去掉 \usebibmacro{chapter+pages}% \iffieldundef{url}{}{%当没有网址时也不输出 \usebibmacro{modifydate}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 % \end{macrocode} % 删除专著的页码。 % \begin{macrocode} \if false \newunit\newblock% \printfield{pagetotal}% \fi \newunit\newblock% \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock %\usebibmacro{doi+eprint+url}% %\newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{annotation}\usebibmacro{finentry} } % \end{macrocode} % % \subsubsection{析出文献} % % 设置包括会议论文在内的析出文献著录样式。 % 修改 Driver: inbook $\rightarrow$ macro: |inbook:parent| % $\rightarrow$ |publisher+location+date|。 % 将会议论文析出文献中的会议地址(含会议日期)后面的冒号改为逗号。 % \begin{macrocode} \newbibmacro*{HUSTinbook_publisher+location+date}{\bibpubfont% \iftoggle{bbx:gbpub}% {\testCJKfirst{userd}% \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% {\iffieldequalstr{entrysubtype}{standard}{} {\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@noaddress}\space :\space\str@nopublisher\gbrightbracket} {\printtext{\gbleftbracket S.l.\space :\space s.n.\adddot\gbrightbracket}}} }% { \iflistundef{location}{%\adddot \iffieldequalstr{entrysubtype}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 {\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@noaddress\gbrightbracket}\addcolon\addspace}% {\printtext{\gbleftbracket S.l.\adddot\gbrightbracket}\publocpunct}} }% \bibstring{noaddress} {\printlist{location}\publocpunct}%%\addcolon\addspace% \iflistundef{publisher}{% \iffieldequalstr{entrysubtype}{standard}{}% {\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@nopublisher\gbrightbracket}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% {\printlist{publisher}} }% \pubdatadelim%\addcomma\addspace% \usebibmacro{date}%%\newunit %去掉这个标点 }% {\printlist{location}% \iflistundef{publisher} {\locnopubdelim} % \end{macrocode} % 始终使用逗号。 % \begin{macrocode} %{\setunit*{\publocpunct}}% {\locnopubdelim} \printlist{publisher}% \pubdatadelim% \usebibmacro{date}%%\newunit }% } \renewbibmacro*{inbook:parent}{% \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{% \ifnameundef{editor}{}{\newunit}% }{\newunit}%替换下一句 %\newunit\newblock \iffieldundef{series}{} {\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 \usebibmacro{maintitle+booktitle}% \iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% \iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 \newunit\newblock% % \usebibmacro{byeditor+others}% % \newunit\newblock \printfield{edition}% \newunit \iftoggle{bbx:gbstrict}{}{% % \iffieldundef{maintitle} % {\printfield{volume}% % \printfield{part}} % {}% % \newunit % \printfield{volumes}% % \newunit\newblock % \usebibmacro{series+number} }% \newunit\newblock %\printfield{note}% %\newunit\newblock % \end{macrocode} % 由于 |publisher+location+date| 在不只这里使用, % 因此将其移植到宏 |HUSTinbook_publisher+location+date| 中。 % \begin{macrocode} %\usebibmacro{publisher+location+date} \usebibmacro{HUSTinbook_publisher+location+date}% } % \end{macrocode} % % \subsubsection{期刊} % % 暂时没发现需要修改的。 % % \subsubsection{专利} % % 设置专利著录样式。 % \begin{macrocode} \DeclareFieldFormat[book]{title}{#1} \renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件 \ifboolexpr{% test{\iffieldundef{title}}% and% test{\iffieldundef{subtitle}}% }% {}% { \printtext[title]{\bibtitlefont% \printfield[titlecase]{title}% \newunit \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 {}% {\setunit{\subtitlepunct}\printfield[titlecase]{subtitle}}% \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 {\setunit{\subtitlepunct}\printfield{titleaddon}}% % \end{macrocode} % 修改标题后面标点;将地点,专利号移植到标题中;并强制显示 GB/T 7714-2015 中的文献类型(|[P]|)。 % \begin{macrocode} \if false \setunit{\subtitlepunct}\printfield{number}%写专利号 \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 %\newunit \fi \iflistundef{location} {} %{\setunit*{\addspace}% {\setunit*{\subtitlepunct} \printtext{%[parens] \printlist[][-\value{listtotal}]{location}}}% \setunit{\addcomma\space}\printfield{number}%写专利号 \setunit{\addspace}\printfield[gbtypeflag]{usera} }% }% \setunit{\subtitlepunct}% } \DeclareBibliographyDriver{patent}{%源来自standard.BBX \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 %\usebibmacro{title}% \usebibmacro{patenttitle}%给出专利专用的标题输出 \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor} }% \newunit\newblock % \end{macrocode} % 以下部分,抑或移除,抑或移至标题块 |patenttitle| 中。 % \begin{macrocode} \if false \printfield{type}% \setunit*{\addspace}% %\printfield{number}%已放到patenttitle中处理 \iflistundef{location} {} {\setunit*{\addspace}% \printtext{%[parens] \printlist[][-\value{listtotal}]{location}}}% \newunit\newblock \usebibmacro{byholder}% \newunit\newblock \fi \printfield{note}% \newunit\newblock % \end{macrocode} % 日期只显示到年。 % \begin{macrocode} %\usebibmacro{newsdate}% \usebibmacro{date}% %\newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{annotation}\usebibmacro{finentry} } % \end{macrocode} % % \subsubsection{学位论文} % % 覆盖原 |manual| 的别名。 % \begin{macrocode} \DeclareBibliographyDriver{thesis}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 % \end{macrocode} % 增加学位论文类型的显示。 % \begin{macrocode} %\usebibmacro{title}% \printfield[titlecase]{title}% \printfield[gbtypeflag]{type} \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}}% \newunit\newblock \usebibmacro{byeditor+others}%增加的译者信息 \newunit\newblock \iftoggle{bbx:gbfieldtype}{% \printfield{type}% \setunit*{\addspace}}{}% \printfield{number}% \newunit\newblock \printfield{version}% \newunit \printfield{note}% \newunit\newblock \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isrn}} {}% \newunit\newblock % \usebibmacro{doi+eprint+url}% % \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{annotation}\usebibmacro{finentry} } % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \section{文档样式} % % ^^A 本小节初版实现主要来自 \pkg{fduthesis} 文档类。 % % \begin{macrocode} %<*doc-sty> %<@@=hustdoc> \RequirePackage { ulem, xcolor-material, zref-base, listings, } % \end{macrocode} % % \subsection{内部函数} % % \begin{macro}{\@@_patch_cmd:Nnn, \@@_preto_cmd:Nn, \@@_appto_cmd:Nn} % 补丁工具。 % \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 \@@_preto_cmd:Nn #1#2 { \ctex_preto_cmd:NnnTF #1 { } {#2} { } { \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} % % \subsection{\cls{l3doc} 补丁} % % \begin{macrocode} %<@@=codedoc> % \end{macrocode} % % \begin{macro}{\@@_typeset_functions:} % 减少展开标记(用来表明中英文模板中的不同用法)前的空格。 % \begin{macrocode} \__hustdoc_patch_cmd:Nnn \@@_typeset_expandability: { & } { & \skip_horizontal:n { -0.5em } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_typeset_functions:, \@@_macro_init:, % \@@_macro_dump:} % 左侧边注的函数列表采用单倍行距。 % \begin{macrocode} \__hustdoc_preto_cmd:Nn \@@_typeset_functions: { \MacroFont } \__hustdoc_patch_cmd:Nnn \@@_macro_init: { \hbox:n } { \MacroFont \hbox:n } \__hustdoc_patch_cmd:Nnn \@@_macro_dump: { \hbox_unpack_drop:N } { \MacroFont \hbox_unpack_drop:N } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_macro_typeset_one:nN} % 在 \env{macro} 环境的侧边栏中,\cls{l3doc} 根据命令的长短,分别用 % 普通字体和紧缩字体输出。然而很长的命令还是会超出页边。这里用缩放 % 盒子的手段使得长命令也可正常显示。 % \begin{macrocode} \cs_set_protected:Npn \@@_macro_typeset_one:nN #1#2 { \vbox_set:Nn \l_@@_macro_box { \MacroFont \vbox_unpack_drop:N \l_@@_macro_box \hbox_set:Nn \l_tmpa_box { \@@_print_macroname:nN {#1} #2 } % \end{macrocode} % \tn{marginparwidth} 和 \tn{marginparsep} 分别是边注的宽度及其到版心的距离, % \tn{labelsep} 则是编号盒子右端与条目首行文本之间的距离。 % \begin{macrocode} \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_@@_macro_int } % \end{macrocode} % \end{macro} % % \subsection{文档层命令} %<@@=hustdoc> % % \begin{macro}[no-user-doc]{\key} % 用于在文档中输出自定义索引的命令,主要用于键值对的键的索引。仅当索引项的父分类为 |option| 时,即用于文档类选项时,隐藏父分类。 % \begin{arguments} % \item 在索引中显示项的父分类,默认为 \opt{option}。 % \item 命令本体。 % \end{arguments} % \begin{macrocode} \DeclareDocumentCommand \key { O{option} m } { \tl_if_eq:nnTF { #1 } { option } { \cmd[module=#1/]{#2} } { \cmd[module=#1/]{#1/#2} } } % \end{macrocode} % \end{macro} % % \begin{macro}[no-user-doc]{\opt} % 输出键值对的值。 % \begin{macrocode} \DeclareDocumentCommand \opt { s m } { \IfBooleanTF {#1} { \texttt{\bfseries \upshape #2} } { \texttt{\upshape #2} } } % \end{macrocode} % \end{macro} % % \begin{macro}[no-user-doc]{\expstar, \rexpstar} % \begin{macrocode} \newcommand\expstar{$\star$} \newcommand\rexpstar{\ding{73}} % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\TeX, \LaTeX, \LaTeXe, % \pdfTeX, \pdfLaTeX, \XeTeX, \XeLaTeX, \LuaTeX, \LuaLaTeX, % \AmSLaTeX, \TeXLive, \MiKTeX, \BibTeX, \biber, \TikZ % } % \TeX{} 相关标志。 % \begin{macrocode} \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\biber{\hologo{biber}} % \end{macrocode} % 该定义来自 \file{pgfmanual-en-macros.tex}。 % \begin{macrocode} \def\TikZ{Ti\emph{k}Z} % \end{macrocode} % \end{macro} % % \subsection{文档样式} % % \begin{environment}{bashecode, latexcode} % \begin{macrocode} \lstdefinestyle{style@base} { basewidth = 0.5 em, gobble = 3, lineskip = 3 pt, frame = l, framerule = 1 pt, framesep = 0 pt, xleftmargin = 2 em, xrightmargin = 3 em, escapeinside = {(*}{*)}, breaklines = true, basicstyle = \small\ttfamily, keywordstyle = \bfseries\color{purple}, commentstyle = \itshape\color{white!50!gray}, stringstyle = \color{red}, backgroundcolor = \color{white!95!gray} } \lstdefinestyle{style@bash} { style = style@base, rulecolor = \color{pink}, language = bash, alsoletter = {-}, emphstyle = \color{green} } \lstdefinestyle{style@latex} { style = style@base, rulecolor = \color{blue}, language = [LaTeX]TeX, alsoletter = {*, -, .}, texcsstyle = *\color{purple}, emphstyle = [1]\color{orange}, emphstyle = [2]\color{green}, emphstyle = [3]\bfseries\color{yellow} } \lstnewenvironment{bashecode}[1][]{% \lstset{style=style@bash, #1}}{} \lstnewenvironment{latexcode}[1][]{% \lstset{style=style@latex, #1}}{} % \end{macrocode} % \end{environment} % % \subsection{\env{macrocode}环境} % % \subsubsection{代码行处理} % % \begin{macro}[int]{\xmacro@code,\sxmacro@code} % 重新实现 \env{macrocode} 与 \env{macrocode*} 环境的核心功能,将对代码逐行 % 处理。后者会将空格显示为“\verb*| |”。 % \begin{macrocode} \cs_set_protected_nopar:Npn \xmacro@code { \@@_marco_code:w } \cs_set_protected_nopar:Npn \sxmacro@code { \fontspec_print_visible_spaces: \xmacro@code } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_marco_code:w} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_marco_code:w { % \end{macrocode} % 根据 \tn{codeline@index} 是否为 |true| 选择是否显示行号。 % \begin{macrocode} \ifcodeline@index \@@_marco_code_every_par:n { \@@_code_line_no: } \else: \@@_marco_code_every_par:n { } \fi: % \end{macrocode} % 设置代码段结束标记为“\verb*|% \end{macrocode}^^M|”。 % \begin{macrocode} \@@_make_finish_tag:x { \@currenvir } % \end{macrocode} % 开始 \env{macrocode}。 % \begin{macrocode} \@@_macro_code_start:w } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_marco_code_every_par:n} % 在每段之前插入内容。这里每段即相当于每行。 % \begin{macrocode} \cs_new_protected:Npn \@@_marco_code_every_par:n #1 { \everypar { \everypar {#1} \if@inlabel \global \@inlabelfalse \@noparlistfalse \llap { \box \@labels \hskip \leftskip } \fi #1 } } % \end{macrocode} % \end{macro} % % 设置 \tn{endlinechar} 为 $-1$,表示行末不插入任何字符(实际上相当于在行尾 % 插入注释符 |%|)。 % \begin{macrocode} \group_begin: \int_set:Nn \tex_endlinechar:D { -1 } % \end{macrocode} % % \begin{variable}{\c_@@_active_space_tl} % 活动字符类的空格(ASCII 码为 32)。 % \begin{macrocode} \use:n { \char_set_catcode_active:n { 32 } \tl_const:Nn \c_@@_active_space_tl } { } \group_end: % \end{macrocode} % \end{variable} % % ASCII 码 13 是回车符 |^^M|。将其设置为活动字符。 % \begin{macrocode} \group_begin: \char_set_catcode_active:n { 13 } % \end{macrocode} % % \begin{macro}{\@@_make_finish_tag:n,\@@_make_finish_tag:x} % \env{macrocode} 结尾标记。展开后变成“\verb*|% \end{#1}^^M|”。 % \begin{macrocode} \cs_new_protected:Npx \@@_make_finish_tag:n #1 { \tl_set:Nn \exp_not:N \l_@@_macro_code_finish_tl { \c_percent_str \prg_replicate:nn { 4 } { \exp_not:o { \c_@@_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 \@@_make_finish_tag:n { x } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_macro_code_start:w} % 开始代码环境。此命令主要是为了防止 |\begin{macrocode}| 后出现多余的空行。 % \begin{macrocode} \cs_new_protected:Npn \@@_macro_code_start:w #1 { \str_if_eq:nnTF {#1} { ^^M } { \@@_macro_code_read_line:w } { \@@_macro_code_read_line:w #1 } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_macro_code_read_line:w} % 逐行读取代码,并连同行尾回车符一并存入 \cs{l_@@_macro_code_line_tl}。如果该行 % 与结束标记“\verb*|% \end{macrocode}^^M|”相同,则结束此 \env{macrocode}; % 否则继续处理该行代码。 % \begin{macrocode} \cs_new_protected:Npn \@@_macro_code_read_line:w #1 ^^M { \tl_set:Nn \l_@@_macro_code_line_tl { #1 ^^M } \tl_if_eq:NNTF \l_@@_macro_code_line_tl \l_@@_macro_code_finish_tl { \exp_args:Nx \end { \@currenvir } } { \@@_macro_code_process_line: \@@_macro_code_read_line:w } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_swap_cr:,\@@_swap_cr_aux:w} % 把 \cs{l_@@_macro_code_line_tl} 中的回车符 |^^M| 挪到外面。 % \begin{macrocode} \cs_new_protected:Npn \@@_swap_cr: { \exp_after:wN \@@_swap_cr_aux:w \l_@@_macro_code_line_tl } \cs_new_protected:Npn \@@_swap_cr_aux:w #1 ^^M { \group_insert_after:N ^^M \tl_set:Nn \l_@@_macro_code_line_tl {#1} } % \end{macrocode} % \end{macro} % % \begin{variable}{\c_@@_active_cr_tl} % 活动字符类的回车符。 % \begin{macrocode} \tl_const:Nn \c_@@_active_cr_tl { ^^M } \group_end: % \end{macrocode} % \end{variable} % % \begin{variable}{\l_@@_macro_code_line_tl, % \l_@@_macro_code_finish_tl, % \g_@@_macro_code_verbatim_stop_tl} % 分别用来存储代码行、\env{macrocode} 结束标记以及抄录停止标记。 % \begin{macrocode} \tl_new:N \l_@@_macro_code_line_tl \tl_new:N \l_@@_macro_code_finish_tl \tl_new:N \g_@@_macro_code_verbatim_stop_tl % \end{macrocode} % \end{variable} % % \begin{macro}{\@@_process_normal_line:} % 普通代码行根据开头字符分别处理。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_process_normal_line: { \str_case_e:nnF { \str_head:N \l_@@_macro_code_line_tl } { % \end{macrocode} % 以 |%| 开头的行先由 \cs{tl_tail:N} 去掉 |%|,之后再检查 |<|。 % \begin{macrocode} { \c_percent_str } { \@@_check_angle:x { \tl_tail:N \l_@@_macro_code_line_tl } } % \end{macrocode} % 以 |#| 开头的行按注释的格式输出。 % \begin{macrocode} { \c_hash_str } { \@@_output_comment_line: } } % \end{macrocode} % 其余正常输出。 % \begin{macrocode} { \@@_output_line: } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_process_verbatim_line:} % 处理抄录代码行(不检查 |%| 与 |<|)。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_process_verbatim_line: { % \end{macrocode} % 将该行与抄录停止标记进行比较。 % \begin{macrocode} \tl_if_eq:NNTF \l_@@_macro_code_line_tl \g_@@_macro_code_verbatim_stop_tl % \end{macrocode} % 若相同,则结束抄录环境,清空抄录停止标记,并输出该标记; % \begin{macrocode} { \tl_gclear:N \g_@@_macro_code_verbatim_stop_tl \cs_gset_eq:NN \@@_macro_code_process_line: \@@_process_normal_line: \@@_output_module:nn { \color { verb@guard } } { \@@_swap_cr: \@@_module_pop:n { \l_@@_macro_code_line_tl } } } % \end{macrocode} % 否则直接输出抄录代码。 % \begin{macrocode} { \tl_use:N \l_@@_macro_code_line_tl } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_macro_code_process_line:} % 处理代码行。该命令的作用如下: % \begin{itemize} % \item 正常情况下,等同于 \cs{@@_process_normal_line:}; % \item 在 \cs{DontCheckModules} 之后,等价于 \cs{@@_output_line:}, % 即不检查模块标记,直接输出; % \item 在抄录环境中,等价于 \cs{@@_process_verbatim_line:}, % 此时将不再特殊处理以 |%| 开头的代码行。 % \end{itemize} % \begin{macrocode} \cs_new_eq:NN \@@_macro_code_process_line: \@@_process_normal_line: % \end{macrocode} % \end{macro} % % \subsubsection{模块标记处理} % % \begin{macro}[int]{\CheckModules, \DontCheckModules} % 选择是否检查模块标记。这两个命令在 \pkg{doc} 宏包中已有定义,此处重新声明。 % \begin{macrocode} \DeclareDocumentCommand \CheckModules { } { \cs_set_eq:NN \@@_macro_code_process_line: \@@_process_normal_line: } \DeclareDocumentCommand \DontCheckModules { } { \cs_set_eq:NN \@@_macro_code_process_line: \@@_output_line: } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_check_angle:n,\@@_check_angle:x} % 检查第一个字符是否是 |<|。若是,则检查模块;否则立刻输出改行。 % 该函数的参数不带 |%|。 % \begin{macrocode} \cs_new_protected:Npn \@@_check_angle:n #1 { \str_if_eq:eeTF { \str_head:n {#1} } { < } { \@@_check_module:x { \tl_tail:n {#1} } } { \@@_output_comment_line: } } \cs_generate_variant:Nn \@@_check_angle:n { x } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_check_module:n,\@@_check_module:x} % 检查紧跟 |<| 之后的字符。共有四种情况: % \begin{itemize} % \item |*|:模块开始(|%<*|\meta{module}|>|); % \item |/|:模块结束(|%|); % \item |@|:名字空间(|%<@@=|\meta{namespace}|>|); % \item |<|:抄录环境开始(|%<<|\meta{end-tag})。 % \end{itemize} % 若不是这几种情况,则为单独一行的独立模块(|%<|\meta{module}|>|)。 % \begin{macrocode} \cs_new_protected:Npn \@@_check_module:n #1 { \str_case_e:nnF { \str_head:n {#1} } { { * } { \@@_module_star:w } { / } { \@@_module_slash:w } { @ } { \@@_module_at:w } { < } { \@@_module_verb:w } } { \@@_module_pm:w } % \end{macrocode} % 参数 |#1| 将被上面几个 |:w| 型函数吃掉。 % \begin{macrocode} #1 \q_stop } \cs_generate_variant:Nn \@@_check_module:n { x } % \end{macrocode} % \end{macro} % % 设置 |>| 为活动字符。 % \begin{macrocode} \group_begin: \char_set_catcode_active:N \> % \end{macrocode} % % \begin{macro}{\@@_module_star:w} % 模块开始标记。 % \begin{arguments} % \item |*|\meta{module} % \item 之后的代码 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_module_star:w #1 > #2 \q_stop { % \end{macrocode} % 临时变量 \cs{l_@@_tmpa_tl} 保存 |<*|\meta{module}|>| 之后的部分,即真实代码。 % \begin{macrocode} \tl_set:Nn \l_@@_tmpa_tl {#2} % \end{macrocode} % 判断该行是否为空(只含一个回车符 |^^M|)。 % \begin{macrocode} \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_active_cr_tl % \end{macrocode} % 若是,则将 |<|\meta{module}|>| 放在行号的右侧; % \begin{macrocode} { \@@_output_module:nn { \@@_star_color: } { \@@_module_push:n { \@@_module_angle:n {#1} } } } % \end{macrocode} % 否则放在左侧,并输出相应代码。 % \begin{macrocode} { \@@_output_module_left:nn { \@@_star_color: } { \@@_module_push:n { \@@_module_angle:n {#1} } } } \@@_output_line:n {#2} } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_slash:w} % 模块结束标记。结构与 \cs{@@_module_star:w} 相同。 % \begin{arguments} % \item |/|\meta{module} % \item 之后的代码 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_module_slash:w #1 > #2 \q_stop { \tl_set:Nn \l_@@_tmpa_tl {#2} \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_active_cr_tl { \@@_output_module:nn { \@@_slash_color: } { \@@_module_pop:n { \@@_module_angle:n {#1} } } } { \@@_output_module_left:nn { \@@_slash_color: } { \@@_module_pop:n { \@@_module_angle:n {#1} } } } \@@_output_line:n {#2} } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_at:w} % 名字空间。 % \begin{arguments} % \item 名字空间的名称(不含 |@@=|) % \item 之后的代码 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_module_at:w @ @ = #1 > #2 \q_stop { \@@_output_module:nn { \color { at@guard } } { \@@_module_angle:n { @ @ = #1 } } % \end{macrocode} % 设置名字空间为 |#1|。\cls{l3doc} 中将名字空间称为“模块”(module), % 注意不要混淆。 % \begin{macrocode} \tl_gset:Nn \g__codedoc_module_name_tl {#1} \@@_output_line:n {#2} } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_verb:w} % 抄录开始。|#1|: |<|\meta{end-tag},只有一个 |<|。\meta{end-tag} 的最后会 % 带有一个回车符 |^^M|。 % \begin{macrocode} \cs_new_protected:Npn \@@_module_verb:w #1 \q_stop { % \end{macrocode} % 重定义 \cs{@@_macro_code_process_line:},用以输出抄录行。 % \begin{macrocode} \cs_gset_eq:NN \@@_macro_code_process_line: \@@_process_verbatim_line: % \end{macrocode} % 设置抄录停止标记。用 \cs{tl_tail:n} 去掉开头的 |<|。 % \begin{macrocode} \tl_gset:Nx \g_@@_macro_code_verbatim_stop_tl { \c_percent_str \tl_tail:n {#1} } % \end{macrocode} % 输出 |%<<|\meta{end-tag}。 % \begin{macrocode} \@@_output_module:nn { \color { verb@guard } } { \@@_swap_cr: \@@_module_push:n { \l_@@_macro_code_line_tl } } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_pm:w} % 处理单独一行的模块。|<|\meta{module}|>| 放在行号的左侧。 % \begin{arguments} % \item \meta{module} % \item 之后的代码 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_module_pm:w #1 > #2 \q_stop { \@@_output_module_left:nn { \@@_pm_color: } { \@@_module_angle:n {#1} } \@@_output_line:n {#2} } \group_end: % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_output_line:n,\@@_output_line:} % 输出代码行。参数将被存入 \cs{l_@@_macro_code_line_tl}, % 再由不带参数的版本调用。 % \begin{macrocode} \cs_new_protected:Npn \@@_output_line:n #1 { \tl_set:Nn \l_@@_macro_code_line_tl {#1} % \end{macrocode} % 若为空行(只含一个 |^^M|),则直接输出(换行)。 % \begin{macrocode} \tl_if_eq:NNTF \l_@@_macro_code_line_tl \c_@@_active_cr_tl { \tl_use:N \l_@@_macro_code_line_tl } { % \end{macrocode} % 检查开头是否为 |%|,据此分别处理。 % \begin{macrocode} \str_if_eq:eeTF { \str_head:N \l_@@_macro_code_line_tl } { \c_percent_str } { \@@_output_comment_line: } { \@@_output_line: } } } \cs_new_protected_nopar:Npn \@@_output_line: { \tex_noindent:D % \end{macrocode} % 此处将把 |@@| 替换为相应的名字空间。 % \begin{macrocode} \@@_replace_at_at:N \l_@@_macro_code_line_tl \tl_use:N \l_@@_macro_code_line_tl } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_output_comment_line:} % 输出注释代码行。用灰色、斜体显示。 % \begin{macrocode} \cs_new_protected:Npn \@@_output_comment_line: { \tex_noindent:D \group_begin: \__hustdoc_swap_cr: \color { code@gray } \slshape \@@_output_line: \group_end: } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_replace_at_at:N, % \@@_replace_at_at_aux:Nn,\@@_replace_at_at_aux:No} % 把 |@@| 替换为相应的名字空间。其名称存放在全局变量 % \cs{g__codedoc_module_name_tl} 中。它为空时(|%<@@=>|),不做替换。 % \begin{macrocode} \cs_new_protected:Npn \@@_replace_at_at:N #1 { \tl_if_empty:NF \g__codedoc_module_name_tl { \@@_replace_at_at_aux:No #1 \g__codedoc_module_name_tl } } \cs_new_protected:Npn \@@_replace_at_at_aux:Nn #1#2 { % \end{macrocode} % 以下代码分别对应两种名字空间的替换: % \begin{itemize} % \item 内部变量:|\|\meta{type}|_@@_|\meta{name} $\to$ % |\|\meta{type}|__|\meta{namespace}|_|\meta{name}; % \item 内部函数:|\@@_|\meta{name}” $\to$ % |\__|\meta{namespace}|_|\meta{name}”)。 % \end{itemize} % \begin{macrocode} \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } } \cs_generate_variant:Nn \@@_replace_at_at_aux:Nn { No } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_push:n, % \@@_module_push_aux:nn,\@@_module_push_aux:on} % 将模块名压入栈中。此处的栈主要用来处理模块名(包括抄录标记)之间的超链接。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_module_push:n { \@@_module_push_aux:on { \int_use:N \c@HD@hypercount } } \cs_new_protected:Npn \@@_module_push_aux:nn #1 { \seq_gpush:Nn \g_@@_module_dest_seq {#1} \hypersetup { hidelinks } \exp_args:Nx \hdclindex { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { } } \cs_generate_variant:Nn \@@_module_push_aux:nn { on } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_pop:n, % \@@_module_pop_aux:nn,\@@_module_pop_aux:on} % 将模块名释放出栈。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_module_pop:n { \seq_gpop:NNTF \g_@@_module_dest_seq \l_@@_tmpa_tl { \@@_module_pop_aux:on { \l_@@_tmpa_tl } } { \BOOM \use:n } } \cs_new_protected:Npn \@@_module_pop_aux:nn #1 { \zref@labelbylist { HD.#1 } { hustdoc } \hypersetup { hidelinks } \hdclindex {#1} { } } \cs_generate_variant:Nn \@@_module_pop_aux:nn { on } % \end{macrocode} % \end{macro} % % \begin{variable}{\g_@@_module_dest_seq} % 存放模块名的序列(栈)。 % \begin{macrocode} \seq_new:N \g_@@_module_dest_seq % \end{macrocode} % \end{variable} % % 处理行号超链接。使用 \pkg{zref} 宏包。 % \begin{macrocode} \zref@newlist { hustdoc } \zref@newprop { guard@end } [ 1 ] { \int_eval:n { \c@HD@hypercount - 1 } } \zref@addprop { hustdoc } { guard@end } % \end{macrocode} % % \subsubsection{格式处理} % % \begin{macro}[int]{\MacroFont} % 代码部分的字体。 % \begin{macrocode} \cs_set_protected:Npn \MacroFont { \linespread { 1.05 } \small \ttfamily \mdseries \upshape } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_output_module:nn,\@@_output_module_left:nn} % 输出模块名(分行内和行号左侧两种)。 % \begin{arguments} % \item 颜色等样式 % \item 模块名 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_output_module:nn #1#2 { \tex_noindent:D \group_begin: #1 \footnotesize \normalfont \sffamily #2 \group_end: } \cs_new_protected:Npn \@@_output_module_left:nn #1#2 { \tex_noindent:D \hbox_overlap_left:n { \@@_output_module:nn {#1} {#2} \skip_horizontal:n { \leftskip + \smallskipamount } } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_star_color:,\@@_slash_color:,\@@_pm_color:} % 选择模块标记的颜色。模块标记的颜色会根据嵌套层次而改变。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_star_color: { \seq_gpop:NNTF \g_@@_star_color_seq \current@color { \set@color } { \@@_select_color: } \seq_gpush:No \g_@@_slash_color_seq { \current@color } } \cs_new_protected_nopar:Npn \@@_slash_color: { \seq_gpop:NNTF \g_@@_slash_color_seq \current@color { \set@color \seq_gpush:No \g_@@_star_color_seq { \current@color } } % TODO: 需要报错:star 与 slash 没有匹配 { \BOOM } } \cs_new_protected_nopar:Npn \@@_pm_color: { \seq_get:NNTF \g_@@_star_color_seq \current@color { \set@color } { \@@_select_color: \seq_gpush:No \g_@@_star_color_seq { \current@color } } } % \end{macrocode} % \end{macro} % % \begin{variable}{\g_@@_star_color_seq,\g_@@_slash_color_seq} % 存放模块标记颜色的序列。 % \begin{macrocode} \seq_new:N \g_@@_star_color_seq \seq_new:N \g_@@_slash_color_seq % \end{macrocode} % \end{variable} % % \begin{macro}{\@@_select_color:} % \begin{macro}[int]{guard@series} % 设置模块标记的色系。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_select_color: { \color { guard@series!!+ } } \definecolorseries { guard@series } { cmyk } { last } { blue } { purple } % \end{macrocode} % \end{macro} % \end{macro} % % 设置色系的增量大小。可选参数 |3| 意味着基色(blue)与末色(purple)之间将被 % 等分为三份。该数字比嵌套最大深度小 1。 % \begin{macrocode} \resetcolorseries [ 3 ] { guard@series } % \end{macrocode} % % \begin{macro}[int]{verb@guard,at@guard,code@gray} % 设置颜色。 % \begin{macrocode} \definecolor { verb@guard } { named } { MaterialLime600 } \definecolor { at@guard } { named } { MaterialPink } \definecolor { code@gray } { named } { MaterialGrey } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_module_angle:n} % 输出“$\langle\cdots\rangle$”。 % \begin{macrocode} \cs_new_protected:Npn \@@_module_angle:n #1 { < #1 > } % { \textlangle #1 \textrangle } % { \ensuremath \langle #1 \ensuremath \rangle } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_code_line_no:} % 行号。设置为阿拉伯数字。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_code_line_no: { \int_gincr:N \c@CodelineNo \hbox_overlap_left:n { \hbox_to_wd:nn { \MacroIndent } { \HD@target \tex_hss:D \@@_code_line_no_style: \theCodelineNo \enspace } \tex_kern:D \@totalleftmargin } } \tl_set:Nn \theCodelineNo { \arabic { CodelineNo } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_code_line_no_style:} % 行号格式。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_code_line_no_style: { \color { code@gray } \normalfont \sffamily \tiny } % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\HD@SetMacroIndent} % 设置代码缩进(行号一栏的宽度)。该命令会写进 |.aux| 辅助文件, % 以便在二次编译时确定最大行号宽度。 % \begin{macrocode} \cs_set_protected:Npn \HD@SetMacroIndent #1 { \group_begin: \settowidth \MacroIndent { \@@_code_line_no_style: \prg_replicate:nn { \tl_count:n {#1} } { 0 } \enspace } \dim_gset_eq:NN \MacroIndent \MacroIndent \group_end: } % \end{macrocode} % \end{macro} % % \subsection{修订记录} % % \begin{macro}{\@@_ltx_changes:nnn} % 保存 \pkg{doc} 中 \tn{changes@} 的定义。 % \begin{macrocode} \cs_new_eq:NN \@@_ltx_changes:nnn \changes@ % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\changes@} % 重定义 \tn{changes@},在版本号一行显示修改日期。 % \begin{macrocode} \cs_set_protected:Npn \changes@ #1#2 { \@@_save_version_date:nn {#1} {#2} \@@_ltx_changes:nnn {#1} {#2} } % \end{macrocode} % \end{macro} % % \begin{variable}{\g_@@_version_date_prop} % 存放版本号与对应的修改日期。其中键为版本号,值为 |{开始日期,结束日期}|。 % 开始日期与结束日期可以相同。 % \begin{macrocode} \prop_new:N \g_@@_version_date_prop % \end{macrocode} % \end{variable} % % \begin{macro}{\@@_save_version_date:nn} % |nn| 版本最终将被 \tn{changes@} 调用。 % \begin{arguments} % \item 版本号 % \item 日期 % \end{arguments} % 它们分别对应 \tn{change} 的前两个参数(第三个是说明文字)。 % \begin{macrocode} \cs_new_protected:Npn \@@_save_version_date:nn #1#2 { \prop_get:NnNTF \g_@@_version_date_prop {#1} \l_@@_tmpa_tl { % \end{macrocode} % \cs{l_@@_tmpa_tl} 相当于两个参数(开始日期、结束日期),因此需要提前展开。 % \begin{macrocode} \exp_after:wN \@@_save_version_date_aux:nnnn \l_@@_tmpa_tl {#2} {#1} } { \@@_save_version_date_aux:nnn {#1} {#2} {#2} } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_save_version_date_aux:nnnn} % \begin{arguments} % \item 原开始日期 % \item 原结束日期(显然应有 |#1| < |#2|) % \item 新读入的日期 % \item 版本号 % \end{arguments} % 如果 |#3| < |#1|,则读入日期 |#3|、|#2|; % 如果 |#3| > |#2|,则读入日期 |#1|、|#3|。 % \begin{macrocode} \cs_new_protected:Npn \@@_save_version_date_aux:nnnn #1#2#3#4 { \@@_if_date_later:nnTF {#1} {#3} { \@@_save_version_date_aux:nnn {#4} {#3} {#2} } { \@@_if_date_later:nnT {#3} {#2} { \@@_save_version_date_aux:nnn {#4} {#1} {#3} } } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_save_version_date_aux:nnn} % 将版本号和日期存入 \cs{g_@@_version_date_prop}。 % \begin{arguments} % \item 版本号 % \item 开始日期 % \item 结束日期 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_save_version_date_aux:nnn #1#2#3 { \prop_gput:Nnn \g_@@_version_date_prop {#1} { {#2} {#3} } } % \end{macrocode} % \end{macro} % % \begin{macro}[TF]{\@@_if_date_later:nn} % \begin{macro}{\@@_parse_date:w} % 比较两个日期。如果 |#1| 在 |#2| 之后,则为 |true|;反之为 |false|。 % 日期的格式为 |YYYY-MM-DD|。比较方法是直接将日期化成 8 位数字, % 所以月、日前的 0 不可以省略。 % \begin{macrocode} \prg_new_conditional:Npnn \@@_if_date_later:nn #1#2 { TF, T } { \if_int_compare:w \@@_parse_date:w #1 / / / 0 \q_stop > \@@_parse_date:w #2 / / / 0 \q_stop \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:Npn \@@_parse_date:w #1-#2-#3/ #4 \q_stop { #1#2#3 } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}[int]{\CTEX@versionitem} % 版本条目标签。如果版本号不在 \cs{g_@@_version_date_prop} 里面, % 则利用未定义的 \cs{BOOM} 报错。 % \begin{macrocode} \cs_new_protected:Npn \CTEX@versionitem #1 \efill { \@idxitem \prop_get:NnNTF \g_@@_version_date_prop {#1} \l_@@_tmpa_tl { \exp_after:wN \@@_print_version_date:nnn \l_@@_tmpa_tl {#1} } { \BOOM } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_print_version_date:nnn} % 输出版本号和日期。如果开始日期和结束日期相同,则只输出一项。 % \begin{arguments} % \item 开始日期 % \item 结束日期 % \item 版本号 % \end{arguments} % \begin{macrocode} \cs_new_protected:Npn \@@_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 \c_space_tl \c_tilde_str \c_space_tl #2 ) } } \par \nopagebreak } % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\HDorg@theglossary} % 该命令由 \pkg{hypdoc} 宏包定义,用于存放标准文档类 \cls{book} 中定义的 % \tn{theindex} 命令。此处的补丁将在版本号一行最后加上修改日期。 % \begin{macrocode} \ctex_patch_cmd:Nnn \HDorg@theglossary { \let \item \@idxitem } { \let \item \CTEX@versionitem } % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\@wrglossary} % 该命令由 \LaTeXe{} 内核定义,又由 \pkg{hypdoc} 宏包作了修改。 % 此处的补丁使得修订记录条目的页码能够指向对应行。 % \begin{macrocode} \ctex_patch_cmd:Nnn \@wrglossary { hdpindex } { \ifnum \c@HD@hypercount = \z@ hdpindex \else hdclindex { \the \c@HD@hypercount } \fi } % \end{macrocode} % \end{macro} % % \begin{macrocode} % % \end{macrocode} % % \end{implementation}