diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/bithesis/README.md | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bithesis/bithesis.pdf | bin | 339348 -> 818866 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/bithesis/contributing-zh.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bithesis/dtx-style.sty | 82 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bithesis/bithesis.dtx | 3249 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bithesis/bithesis.ins | 22 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bithesis/bitart.cls | 10 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls | 75 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bithesis/bitbook.cls | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bithesis/bitgrad.cls | 9 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bithesis/bithesis.cls | 1632 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bithesis/bitreport.cls | 328 |
12 files changed, 5331 insertions, 90 deletions
diff --git a/Master/texmf-dist/doc/latex/bithesis/README.md b/Master/texmf-dist/doc/latex/bithesis/README.md index 9407b05b5a8..c76d91bfdca 100644 --- a/Master/texmf-dist/doc/latex/bithesis/README.md +++ b/Master/texmf-dist/doc/latex/bithesis/README.md @@ -10,11 +10,12 @@ The current maintainer of this project is [Feng Kaiyu](https://github.com/fky201 [![Latexmk](https://badgen.net/badge/compiler/latexmk/blue)](https://mg.readthedocs.io/latexmk.html) [![License](https://badgen.net/github/license/BITNP/BIThesis?color=008080&labelColor=2b2b2b)](./LICENSE) -BIThesis is an unofficial LaTeX template set for your **undergraduate, master or doctoral thesis** as well as other academic writing here at BIT. +BIThesis is an unofficial LaTeX template set for your +**undergraduate, master or doctoral thesis** as well as other academic writing here at BIT. This project is supported by the _[Dept. of Undergraduate Academic Affairs, BIT](https://jwc.bit.edu.cn/)_ and the _[School of Computer Science and Technology, BIT](https://cs.bit.edu.cn/)_. See [Acknowledgements - Official Sponsors](https://bithesis.bitnp.net/Guide/5-Acknowledgements/Acknowledgements.html#%E5%AE%98%E6%96%B9%E8%B5%9E%E5%8A%A9-official-sponsors). -At present, `bithesis` only supports XETEX and LuaTEX engines. `bithesis` only allows `UTF-8` encoding. +At present, `bithesis` only supports XeTeX and LuaTeX engines. `bithesis` only allows `UTF-8` encoding. ## How Do I Use `bithesis`? diff --git a/Master/texmf-dist/doc/latex/bithesis/bithesis.pdf b/Master/texmf-dist/doc/latex/bithesis/bithesis.pdf Binary files differindex cdb875f3a52..83d3151ff5b 100644 --- a/Master/texmf-dist/doc/latex/bithesis/bithesis.pdf +++ b/Master/texmf-dist/doc/latex/bithesis/bithesis.pdf diff --git a/Master/texmf-dist/doc/latex/bithesis/contributing-zh.md b/Master/texmf-dist/doc/latex/bithesis/contributing-zh.md index bbc6163d824..52a09bae99f 100644 --- a/Master/texmf-dist/doc/latex/bithesis/contributing-zh.md +++ b/Master/texmf-dist/doc/latex/bithesis/contributing-zh.md @@ -47,7 +47,7 @@ 5. 创建一个 PR,并添加相应的说明。 6. 在 PR 被合并之前请保持关注,以便进行修改。 -寻找更细致的流程请参考 +更细致的流程请参考 _[Github Help](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests)_。 [QQ chat group invitation]: https://jq.qq.com/?_wv=1027&k=KYDrmS5z diff --git a/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty b/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty index 381724b1f9f..9d2e403ad2a 100644 --- a/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty +++ b/Master/texmf-dist/doc/latex/bithesis/dtx-style.sty @@ -26,20 +26,21 @@ %% ------------------------------------------------------------------------------ %% + + \ProvidesPackage{dtx-style} \RequirePackage{hypdoc} \RequirePackage{ifthen} -\RequirePackage{fontspec}[2017/01/20] +\RequirePackage{fontspec} \RequirePackage{amsmath} \RequirePackage{unicode-math} -\RequirePackage[UTF8,scheme=chinese,heading]{ctex} +\RequirePackage[UTF8,scheme=chinese,heading,sub3section]{ctex} \RequirePackage[ top=2.5cm, bottom=2.5cm, - left=4cm, right=2cm, + left=5cm, right=2cm, headsep=3mm]{geometry} \RequirePackage{graphicx} \RequirePackage{multirow} -\RequirePackage[ruled,vlined]{algorithm2e} \RequirePackage{wrapfig} \RequirePackage{hologo} \RequirePackage{array,longtable,booktabs} @@ -47,7 +48,6 @@ \RequirePackage{fancyhdr} \RequirePackage[dvipsnames]{xcolor} \RequirePackage{awesomebox} -\RequirePackage{etoolbox} \RequirePackage{dirtree} \RequirePackage{metalogo} \RequirePackage[tightLists=false]{markdown} @@ -56,12 +56,10 @@ \usetikzlibrary{positioning} \RequirePackage{framed} \RequirePackage{menukeys} +\RequirePackage{float} +\RequirePackage{subfig} - % 设置代码高亮 -\RequirePackage{minted} -\usemintedstyle{tango} - - % 设置列表无间隔 + % 设置列表无间隔 \usepackage{enumitem} \setlist{nosep} @@ -84,12 +82,46 @@ \newcommand{\BIThesisMacroPackage}{{\BIThesis}宏集} \newcommand{\BIThesisWiki}{{\BIThesis}在线文档} \newcommand{\BIThesisScaffold}{{\BIThesis}模板} +\newcommand{\BIThesisRelease}{{\BIThesis}模板} \newcommand{\LPPL}{{\href{https://www.latex-project.org/lppl/lppl-1-3c.txt}{\LaTeX{} Project Public License (1.3.c)}}} -\newcommand{\version}{v2.0 BirthdayCake} +\newcommand{\versionold}{v2.0 BirthdayCake} +\newcommand{\version}{v3 Summer Time} + +\ExplSyntaxOn + +\AtBeginEnvironment { bitsyntax } { + \cs_set:Npn \lparen { \textup { ( } } + \cs_set:Npn \rparen { \textup { ) } } + \char_set_catcode_active:N | + \char_set_catcode_active:N < + \char_set_catcode_active:N ( + \char_set_active_eq:NN | \orbar + \char_set_active_eq:NN < \syntaxopt@aux + \char_set_active_eq:NN ( \defaultval@aux +} + +\NewDocumentCommand \BIThesisTemplates {m} { + \str_case:nn {#1} { + {UT}{本科生毕业论文模板(undergraduate-thesis)} + {UTE}{本科生全英文专业毕业论文模板(undergraduate-thesis-en)} + {GT}{研究生学位论文模板(graduate-thesis)} + {LR}{简易使用报告模板(lab-report)} + {PT}{本科生毕业设计外文翻译模板(paper-translation)} + {PS}{北理工主题的 Beamer 模板(presentation-slide)} + {UP}{本科生毕业设计开题报告(undergraduate-proposal)} + } +} + +\def\breakablethinspace{\hskip 0.16667em\relax} + +\DeclareDocumentCommand\kvopt{mm} + {\texttt{#1\breakablethinspace=\breakablethinspace#2}} + +\ExplSyntaxOff \ctexset{ today=big, - abstractname=简介 + abstractname=简介, } \ctexset{section={ @@ -190,6 +222,7 @@ boxpos=c, showlines=false, extendedchars=true, + escapeinside = {(*}{*)}, upquote=true, tabsize=2, showtabs=false, @@ -219,16 +252,34 @@ style=lstStyleBase, frame=l, rulecolor=\color{purple}, - language=bash} + language=bash, +} \lstdefinestyle{lstStyleLaTeX}{% style=lstStyleBase, frame=l, rulecolor=\color{violet}, - language=[LaTeX]TeX} + language=[LaTeX]TeX, + emphstyle=[1]\color{teal}, +} + +\lstdefinestyle{lstStyleSyntax}{% + style=lstStyleBase, + frame=l, + rulecolor=\color{violet}, + language=[LaTeX]TeX, + emphstyle=[1]\color{teal}, +} -\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{} +\lstnewenvironment{latex}[1][]{\lstset{style=lstStyleLaTeX, #1}}{} \lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{} +\lstnewenvironment{bitsyntax}[1][]{\lstset{style=lstStyleSyntax, #1}}{} + +\def\orbar{\textup{\textbar}} +\def\syntaxopt#1{\textit{#1}} +\def\defaultval#1{\textbf{\textup{#1}}} +\def\syntaxopt@aux#1>{\syntaxopt{#1}} +\def\defaultval@aux#1){\defaultval{#1}} \setlist{nosep} @@ -273,6 +324,7 @@ \kern 1ex } } + \makeatother \endinput diff --git a/Master/texmf-dist/source/latex/bithesis/bithesis.dtx b/Master/texmf-dist/source/latex/bithesis/bithesis.dtx index 1d2314ddcad..4d8499b64dc 100644 --- a/Master/texmf-dist/source/latex/bithesis/bithesis.dtx +++ b/Master/texmf-dist/source/latex/bithesis/bithesis.dtx @@ -17,15 +17,21 @@ % \fi % % \iffalse -%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<cls>\RequirePackage{expl3,l3keys2e} +%<thesis>\ProvidesExplClass{bithesis} +%<report>\ProvidesExplClass{bitreport} +%<beamer>\ProvidesExplClass{bitbeamer} +%<cls>{2022-09-03}{3.0.0}{BIT Thesis Templates} +% +%<oldcls>\NeedsTeXFormat{LaTeX2e}[2020/10/01] %<book>\ProvidesClass{bitbook} %<article>\ProvidesClass{bitart} %<graduate>\ProvidesClass{bitgrad} -%<cls> [2022/05/09 v2.1.1 BIT Thesis Templates] +%<oldcls> [2022/05/09 v2.1.1 BIT Thesis Templates] % %<*driver> -\ProvidesFile{bithesis.dtx}[2022/05/09 2.1.1 BIT Thesis Templates] -\documentclass{ltxdoc} +\ProvidesFile{bithesis.dtx}[2022/09/03 3.0.0 BIT Thesis Templates] +\documentclass[letterpaper]{l3doc} \usepackage{dtx-style} \EnableCrossrefs @@ -34,6 +40,9 @@ \RecordChanges \begin{document} \DocInput{\jobname.dtx} + \PrintChanges + \def\indexname{代码索引} + \PrintIndex \end{document} %</driver> % \fi @@ -57,7 +66,7 @@ % \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize} % \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne} % \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass} -% \DoNotIndex{\AtBeginDocument,\AtEndDocument} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\AtBeginEnvironment} % % \GetFileInfo{\jobname.dtx} % % @@ -66,15 +75,14 @@ % % \title{\includegraphics[width=0.3\textwidth]{images/icon.png} % \\[1cm] -% \bfseries 北京理工大学本科生{\LaTeX}学位论文及报告模板 } +% \bfseries 北京理工大学{\LaTeX}学位论文及报告模板 } % \author{北京理工大学网络开拓者协会 \\ \texttt{webmaster@bitnp.net}} % % \date{\zihao{-4} \today\quad \color{RubineRed}{\kaishu {\BIThesis}版本\version}} % \maketitle\thispagestyle{empty} % % \def\abstractname{} % \begin{abstract}\noindent -% 此宏包旨在建立一个简单易用的北京理工大学学位论文模板,包括本科综合论文训练、硕士 -% 论文、博士论文以及博士后出站报告。 +% 此宏包旨在建立一个简单易用的北京理工大学学位论文模板(以及其他模板),包括本科毕业设计与研究生论文。 % \end{abstract} % % \vspace{5mm} @@ -88,6 +96,7 @@ % \noindent % \begin{enumerate} % \item 本模板的发布遵守 \LPPL ,使用前请认真阅读协议内容。 +% \item 与\BIThesis 相关的文档内容采用 \href{https://github.com/BITNP/BIThesis-wiki/blob/main/LICENSE}{CC0-1.0 协议} 发布。 % \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵 % 守 \LaTeX{} Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与 % 本模板作者无关。 @@ -98,7 +107,7 @@ % % \def\abstractname{简介} % \begin{abstract} -% \BIThesisLaTeX 是北京理工大学本科生毕业设计开题报告、总论文,以及其他课程报告、实验报告等重要论文、报告的 {\LaTeX} 模板集合。 +% \BIThesisLaTeX 是北京理工大学本科生毕业设计与研究生学位论文,以及其他课程报告、实验报告的 {\LaTeX} 模板集合。 % 如果你厌烦了 Word 格式的不人性化、参考文献的难以管理、公式输入的差劲体验……那么欢迎来尝试用专业的学术稿件排版利器 —— {\LaTeX},来排版你的论文。 % 专业高端、学界认可、开源免费,{\LaTeX} 是你论文排版的最佳搭档。 % @@ -117,6 +126,7 @@ % \section{项目简介} % \subsection{历史与贡献者们} % \begin{itemize} +% \item 2017 - 2018 年,杨雅婷等人受研究生院委托,制作了\href{https://github.com/BIT-thesis/LaTeX-template}{BIT-Thesis} 研究生学位论文模板。 % \item 2019 - 2020 年,\BIThesis 最早由 2016 级的武上博、王赞、唐誉铭、牟思睿和詹熠莎等人维护。 % \begin{itemize} % \item 在此期间,\BIThesis 从无到有诞生了,包括使用手册、在线文档和开箱即用的模板。 @@ -127,10 +137,12 @@ % \item 在此期间,冯开宇将原来的 .tex 文件制作成了宏包,并发布到 CTAN 上。 % \item 项目代码也随之被拆分成了 \BIThesisMacroPackage,\BIThesisWiki 和 \BIThesisScaffold。 % \end{itemize} -% \item 2021 - 2022 年,2021 级(硕士研究生)的冯开宇针对 2021、2022 毕业季收到的反馈对该项目进行维护升级(前向兼容)。 +% \item 2021 - 2022 年,2021 级(硕士研究生)的冯开宇针对 2021、2022 毕业季收到的反馈对该项目进行维护升级。 % \begin{itemize} % \item 在此期间,冯开宇合入了杨雅婷等人在 2017 年开发的研究生学位论文模板。 % \item 在项目架构上,BIThesis-scaffold 合入 BIThesis 以便于进一步维护。 +% \item 次年暑假期间,冯开宇用 \pkg{expl3} 重构了\LaTeX 样式代码,向用户提供了简易易用的接口。 +% \item 同时,也增加了本科全英文专业的毕设论文模板样式。 % \end{itemize} % \end{itemize} % \subsection{\BIThesis 是什么?} @@ -138,21 +150,21 @@ % % \BIThesisLaTeX 是由北京理工大学众多学子发起并维护的开源项目。该项目旨在建立一套简单易用的北京理工大学 \LaTeX 学位论文模板,包括本科综合论文训练。 % \subsubsection{\BIThesisLaTeX 的组成} -% 我们将 \BIThesisLaTeX 划分为了三个主要仓库: +% 我们将 \BIThesisLaTeX 划分为了两个主要仓库: % \begin{table}[H] % \centering % \begin{tabular}{@{}l l p{6cm} @{}} % \toprule % 项目 & 项目地址 & 主要目的 \\ \midrule -% BIThesis & \href{https://github.com/BITNP/BIThesis}{BITNP/BIThesis} & 主要存储 \BIThesis 宏包 \\ -% BIThesis-wiki & \href{https://github.com/BITNP/BIThesis-wiki}{BITNP/BIThesis-wiki} & 存储 \BIThesisLaTeX 项目在线文档 \\ -% BIThesis-scaffold & \href{https://github.com/BITNP/BIThesis-scaffold}{BITNP/BIThesis-scaffold} & 存储开箱即用的论文模板样式,便于使用者快速开始写作 \\ \bottomrule +% BIThesis & \href{https://github.com/BITNP/BIThesis}{BITNP/BIThesis} & 主要存储 \BIThesis 宏包以及开箱即用的模板样式 \\ +% BIThesis-wiki & \href{https://github.com/BITNP/BIThesis-wiki}{BITNP/BIThesis-wiki} & 存储 \BIThesisLaTeX 项目在线文档 \\ \bottomrule % \end{tabular} % \end{table} % % 如果你仅想解决「我如何使用 \BIThesisLaTeX 来帮助我完成实验论文?」这个问题,那么欢迎你访问我们的\href{https://bithesis.bitnp.net}{在线文档}以获得更多信息。 +% +% 如果你想深入了解 \BIThesisLaTeX 提供的接口的各种选项,那么请继续阅读。 % -% \section{使用说明} % \subsection{\BIThesis 宏包的组成} % 为了适应用户的不同需求,并符合 CTeX 宏集的设计习惯,我们将 \BIThesisMacroPackage 的主要功能设计安排在两个中文文档类当中,具体的组成见 \ref{tab:classes}。 % \begin{table}[H] @@ -162,24 +174,1032 @@ % \begin{tabular}{@{}lll@{}} % \toprule % 类别 & 文件 & 说明 \\ \midrule -% \multirow{2}{*}{文档类} & bitart.cls & 对应 ctxart.cls,提供实验报告模板、开题报告模板。 \\ -% & bitbook.cls & 对应 ctexbook.cls ,提供本科生毕业设计模板。 \\ \cmidrule(l){2-3} -% & bitgrad.cls & 对应 ctexbook.cls ,提供研究生毕业设计模板。(全体硕士及2020级以前博士适用) \\ \cmidrule(l){2-3} +% \multirow{2}{*}{文档类} & \cls{bithesis.cls} & 封装本科生与研究生的毕业论文样式。 \\ +% & \cls{bitreport.cls} & 封装了本科生开题报告与实验报告样式。 \\ \cmidrule(l){2-3} +% & \cls{bitbeamer.cls} & 对应 ctexbeamer.cls ,提供了北理工的 Beamer 模板样式。 \\ \cmidrule(l){2-3} % \end{tabular} % \end{table} +% +% \section{安装} % \subsection{\BIThesis 宏包的安装和更新} % 最常见的 \TeX 发行版(\hologo{TeX} Live 和 \hologo{MiKTeX})已收录\BIThesisMacroPackage 及其依赖的宏包和宏集。 % % 如果安装以上发行版的时间较早,可能你本地的环境中不存在 \BIThesisMacroPackage 或者不是最新版本的。那么你需要通过包管理器来安装/更新 \BIThesisMacroPackage: -% \mint{bash}|tlmgr update --self --all| -% \subsection{使用 \BIThesis 文档类} -% 推荐使用 \BIThesisScaffold 来进行具体的项目编写。\BIThesisScaffold 提供了多种最常用的模板,你可以在 \href{https://github.com/BITNP/BIThesis}{主项目的 Releases}中找到它们。 +% \begin{shell}[morekeywords={tlmgr,install}] +% tlmgr install fduthesis +% \end{shell} +% +% 更新可以通过图形界面进行,或者通过命令行: +% \begin{shell}[morekeywords={tlmgr,install}] +% tlmgr update fduthesis +% \end{shell} +% +% \section{\cls{bithesis} 使用与配置} +% +% 推荐使用\BIThesisRelease (开箱即用)。 +% +% \BIThesisRelease 提供了多种最常用的模板,你可以在 +% \href{https://github.com/BITNP/BIThesis/releases}{主项目的 Releases}中找到它们。 +% +% 使用此文档类的模板有: +% \begin{itemize} +% \item \BIThesisTemplates{UT} +% \item \BIThesisTemplates{UTE} +% \item \BIThesisTemplates{PT} +% \item \BIThesisTemplates{GT} +% \end{itemize} +% +% \subsection{最小用例} +% +% \begin{latex} +% \documentclass[type=bachelor]{bithesis} +% \BITSetup{ +% info = { +% author = FKY, +% ...... +% } +% } +% \begin{document} +% \end{document} +% \end{latex} +% +% 如您所见,在 \LaTeX 中,用户使用的命令通常以「\\」作为开头,后面依次跟随 +% 命令名称、若干可选参数和若干必需参数。如: +% +% \begin{latex} +% \MakeCover +% \BITSetup{} +% \FooBar[]{} +% \end{latex} +% +% 同理,用户使用的环境通常以 begin 和 end 进行包裹,同样可以传入可选参数和必需参数: +% +% \begin{latex} +% \begin{abstract} +% \end{abstract} +% +% \begin{abstract}[addTOC=false] +% \end{abstract} +% +% \begin{foo}{param1} +% \end{foo} +% \end{latex} +% +% 需要强调的是:以方框号表示的可选参数,在没有参数传入的时候,是可以忽略的。 +% 比如以下两个命令等价: +% \begin{latex} +% \FooBar +% \FooBar[] +% \end{latex} +% +% 环境同理。 +% +% \subsection{模板选项} \label{sec:template-options} +% +% 所谓“模板选项”,指需要在引入文档类的时候指定的选项: +% +% \begin{latex}[deletetexcs={\documentclass},morekeywords={\documentclass}] +% \documentclass(*\oarg{模板选项}*){bithesis} +% \end{latex} +% +% \begin{function}{type} +% \begin{bitsyntax}[emph={[1]type}] +% type = (*<(bachelor)|\mbox{bachelor_translation}|\mbox{bachelor_english}|master|docter>*) +% \end{bitsyntax} +% 选择论文类型,它们分别对应: +% \begin{itemize} +% \item \BIThesisTemplates{UT} +% \item \BIThesisTemplates{PT} +% \item \BIThesisTemplates{UTE} +% \item \BIThesisTemplates{GT} 研究生 +% \item \BIThesisTemplates{GT} 博士生 +% \end{itemize} +% \end{function} +% +% \begin{function}{blindPeerReview} +% \begin{bitsyntax}[emph={[1]blindPeerReview}] +% blindPeerReview = (*<(false)|true>*) +% \end{bitsyntax} +% +% 此选项用于输出符合盲审要求的论文。所有可能暴露个人信息的页面都将隐藏, +% 比如封面、信息页、原创性声明、个人简介、致谢等等。 +% \end{function} +% +% \begin{function}{twoside} +% \begin{bitsyntax}[emph={[1]twoside}] +% twoside = (*<(false)|true>*) +% \end{bitsyntax} +% \end{function} +% +% \begin{function}{ctex} +% \begin{bitsyntax}[emph={[1]ctex}] +% ctex = (*传给 ctexbook 的模板选项*) +% \end{bitsyntax} +% +% 该选项用于传入模板选项至 ctexbook。 +% \end{function} +% +% \subsection{参数设置} +% +% \begin{function}{\BITSetup} +% \begin{bitsyntax}[emph={[1]BITSetup}] +% \BITSetup = {(*\oarg{键值对}*)} +% \end{bitsyntax} +% \end{function} +% +% 本模板提供了一系列选项,可由您自行配置。载入文档类之后,以下所有选项均可通过统一的 +% 命令 \cs{BITSetup} 来设置。 +% +% \cs{BITSetup} 的参数是一组由(英文)逗号隔开的选项列表,列表中的选项通常是 \meta{key} = +% \meta{value} 的形式。部分选项的 \meta{value} 可以省略。对于同一项,后面的设置将会覆盖前面的设 +% 置。在下文的说明中,将用粗体表示默认值。 +% +% \cs{BITSetup} 采用 LATEX3 风格的键值设置,支持不同类型以及多种层次的选项设定。键值列 +% 表中,“=”左右的空格不影响设置;但需注意,参数列表中不可以出现空行。 +% 与模板选项相同,布尔型的参数可以省略 \meta{选项} = true 中的“= true”。 +% 另有一些选项包含子选项,如 cover 和 info 等。它们可以按如下两种等价方式来设定: +% +% \begin{latex}[morekeywords={\BITSetup},emph={[1]BITSetup,cover,date,info,title,author}] +% \BITSetup{ +% cover = { +% date = xxxx年x月, +% }, +% info = { +% author = Feng Kaiyu, +% title = A Thesis Title for Your Paper, +% } +% } +% \end{latex} +% +% 或者 +% +% \begin{latex}[morekeywords={\BITSetup},emph={[1]BITSetup,cover,date,info,title,author}] +% \BITSetup{ +% cover / date = xxxx年x月, +% info / author = Feng Kaiyu, +% info / title = A Thesis Title for Your Paper, +% } +% \end{latex} +% +% \textbf{请注意:以下选项根据模板的不同,可能会有不同的默认值。 +% 有些模板可能不会使用某些选项。使用与否以及使用方式是根据学校的论文撰写要求实现的。} +% +% \subsubsection{封面选项} \label{sec:cover} +% +% \begin{function}{cover} +% \begin{bitsyntax}[emph={[1]cover}] +% cover = (*\marg{键值列表}*) +% cover/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于设置论文格式。具体内容见下。 +% \end{function} +% +% \begin{function}{cover/date} +% \begin{bitsyntax}[emph={[1]date}] +% date = (*\marg{任意字符串}*) +% \end{bitsyntax} +% +% 覆盖封面的日期。 +% \end{function} +% +% \begin{function}{cover/headerImage} +% \begin{bitsyntax}[emph={[1]headerImage}] +% headerImage = (*\marg{图片路径}*) +% \end{bitsyntax} +% +% 设置封面顶部的“北京理工大学”字样图片。 +% \end{function} +% +% \begin{function}{cover/xiheiFont} +% \begin{bitsyntax}[emph={[1]xiheiFont}] +% xiheiFont = (*\marg{字体路径}*) +% \end{bitsyntax} +% +% 配置此选项以在部分模板封面中使用“华文细黑”,保证与 Word 模板中的字体一致。 +% +% 在 Windows 和 MacOS 中,该字体已经安装;在 Linux 中一般需要用户自行安装。 +% \end{function} +% +% \begin{function}{cover/dilimiter} +% \begin{bitsyntax}[emph={[1]dilimiter}] +% dilimiter = (*\marg{任意字符串}*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 设置封面信息中标签和值的分隔符。一般为全角或者半角的冒号。 +% \end{function} +% +% \begin{function}{cover/autoWidth} +% \begin{bitsyntax}[emph={[1]autoWidth}] +% autoWidth = (*<(true)|false>*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 自动计算封面中下划线的长度。 +% +% 如果关闭了该选项,则建议配合\kvopt{cover/labelMaxWidth}{\meta{长度}}\\ +% 和\kvopt{cover/valueMaxWidth}{\meta{长度}}使用,以控制下划线的长度。 +% \end{function} +% +% \begin{function}{cover/labelMaxWidth} +% \begin{bitsyntax}[emph={[1]labelMaxWidth}] +% labelMaxWidth = (*\marg{任意长度}*) +% \end{bitsyntax} +% +% 此选项仅当\kvopt{cover/autoWidth}{false}时生效。 +% +% 设置封面信息中标签的占位长度。 +% \end{function} +% +% \begin{function}{cover/valueMaxWidth} +% \begin{bitsyntax}[emph={[1]valueMaxWidth}] +% valueMaxWidth = (*\marg{任意长度}*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 设置封面信息中值的占位长度。\textbf{同时也会影响下划线的长度。} +% \end{function} +% +% \begin{function}{cover/labelAlign} +% \begin{bitsyntax}[emph={[1]labelAlign}] +% labelAlign = (*<c|l|r>*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 设置封面信息中值的对其方式(居中,左对齐、右对齐)。 +% \end{function} +% +% \begin{function}{cover/valueAlign} +% \begin{bitsyntax}[emph={[1]valueAlign}] +% valueAlign = (*<c|l|r>*) +% \end{bitsyntax} +% +% 此选项仅当\kvopt{cover/autoWidth}{false}时生效。 +% +% 设置封面信息中标签的对其方式(居中,左对齐、右对齐)。 +% \end{function} +% +% \begin{function}{cover/underlineThickness} +% \begin{bitsyntax}[emph={[1]underlineThickness}] +% underlineThickness = (*\marg{任意长度}*) +% \end{bitsyntax} +% +% 设置封面信息中下划线的厚度。 +% \end{function} +% +% \begin{function}{cover/underlineOffset} +% \begin{bitsyntax}[emph={[1]underlineOffset}] +% underlineOffset = (*(-10pt)|\marg{任意长度}*) +% \end{bitsyntax} +% +% 设置封面信息中下划线的偏移量。 +% \end{function} +% +% \subsubsection{论文基本信息} +% +% \begin{function}{info} +% \begin{bitsyntax}[emph={[1]info}] +% info = (*\marg{键值列表}*) +% info/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于录入论文信息。具体内容见下。 +% 一般以「En」结尾的项目表示对应的英文字段。 +% \end{function} +% +% \begin{function}{info/title,info/titleEn} +% \begin{bitsyntax}[emph={[1]title,titleEn}] +% title = (*\marg{字符串}*) +% titleEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 论文标题。 +% \end{function} +% +% \begin{function}{info/school,info/schoolEn} +% \begin{bitsyntax}[emph={[1]school,schoolEn}] +% school = (*\marg{字符串}*) +% schoolEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 学院名称。 +% \end{function} +% +% \begin{function}{info/major,info/majorEn} +% \begin{bitsyntax}[emph={[1]major,majorEn}] +% major = (*\marg{字符串}*) +% majorEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 专业名称。 +% \end{function} +% +% \begin{function}{info/author,info/authorEn} +% \begin{bitsyntax}[emph={[1]author,authorEn}] +% author = (*\marg{字符串}*) +% authorEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 作者姓名。 +% \end{function} +% +% \begin{function}{info/studentId} +% \begin{bitsyntax}[emph={[1]studentId}] +% studentId = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 学号。 +% \end{function} +% +% \begin{function}{info/supervisor,info/supervisorEn} +% \begin{bitsyntax}[emph={[1]supervisor,supervisorEn}] +% supervisor = (*\marg{字符串}*) +% supervisorEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 指导教师。 +% \end{function} +% +% \begin{function}{info/externalSupervisor} +% \begin{bitsyntax}[emph={[1]externalSupervisor}] +% externalSupervisor = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 校外指导教师。 +% \end{function} +% +% \begin{function}{info/keywords,info/keywordsEn} +% \begin{bitsyntax}[emph={[1]keywords,keywordsEn}] +% keywords = (*\marg{字符串;以全角分号分割}*) +% keywordsEn = (*\marg{字符串;以分号分割}*) +% \end{bitsyntax} +% +% 摘要关键词。 +% \end{function} +% +% \begin{function}{info/translationTitle} +% \begin{bitsyntax}[emph={[1]translationTitle}] +% translationTitle = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 文献翻译中,翻译后的论文名称。 +% \end{function} +% +% \begin{function}{info/translationOriginTitleEn} +% \begin{bitsyntax}[emph={[1]translationOriginTitleEn}] +% translationOriginTitleEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 文献翻译中,翻译前的论文名称。 +% \end{function} +% +% \begin{function}{info/classification} +% \begin{bitsyntax}[emph={[1]classification}] +% classification = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 中国分类号。 +% \end{function} +% +% \begin{function}{info/UDC} +% \begin{bitsyntax}[emph={[1]UDC}] +% UDC = (*\marg{字符串}*) +% \end{bitsyntax} +% +% UDC分类号。 +% \end{function} +% +% \begin{function}{info/chairman,info/chairmanEn} +% \begin{bitsyntax}[emph={[1]chairman,chairmanEn}] +% chairman = (*\marg{字符串}*) +% chairmanEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 答辩委员会主席。 +% \end{function} +% +% \begin{function}{info/degree,info/degreeEn} +% \begin{bitsyntax}[emph={[1]degree,degreeEn}] +% degree = (*\marg{字符串}*) +% degreeEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 申请学位。 +% \end{function} +% +% \begin{function}{info/institute,info/instituteEn} +% \begin{bitsyntax}[emph={[1]institute,instituteEn}] +% institute = (*(北京理工大学)|\marg{字符串}*) +% instituteEn = (*(Beijing~Institute~of~Technology)|\marg{字符串}*) +% \end{bitsyntax} +% +% 学位授予单位。 +% \end{function} +% +% \begin{function}{info/defenseDate,info/defenseDateEn} +% \begin{bitsyntax}[emph={[1]defenseDate,defenseDateEn}] +% defenseDate = (*\marg{字符串}*) +% defenseDateEn = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 答辩日期。 +% \end{function} +% +% \begin{function}{info/classifiedLevel} +% \begin{bitsyntax}[emph={[1]classifiedLevel}] +% classifiedLevel = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 密级。 +% \end{function} +% +% \subsubsection{样式信息} +% +% \begin{function}{style} +% \begin{bitsyntax}[emph={[1]style}] +% style = (*\marg{键值列表}*) +% style/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于调整样式。具体内容见下。 +% \end{function} +% +% \begin{function}{style/head} +% \begin{bitsyntax}[emph={[1]head}] +% head = (*\marg{字符串}*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 页眉文字。 +% \end{function} +% +% \subsubsection{目录选项} +% +% \begin{function}{TOC} +% \begin{bitsyntax}[emph={[1]TOC}] +% TOC = (*\marg{键值列表}*) +% TOC/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于调整其他选项。具体内容见下。 +% \end{function} +% +% \begin{function}{TOC/abstract,TOC/abstractEn} +% \begin{bitsyntax}[emph={[1]abstract,abstractEn}] +% abstract = (*(true)|false*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 是否在目录中索引摘要。 +% \end{function} +% +% \begin{function}{TOC/symbols} +% \begin{bitsyntax}[emph={[1]symbols}] +% abstract = (*(true)|false*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 是否在目录中索引主要符号对照表。 +% \end{function} +% +% \subsubsection{附录选项} +% +% \begin{function}{appendices} +% \begin{bitsyntax}[emph={[1]appendices}] +% appendices = (*\marg{键值列表}*) +% appendices/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于调整其他选项。具体内容见下。 +% \end{function} +% +% \begin{function}{appendices/chapterLevel} +% \begin{bitsyntax}[emph={[1]chapterLevel}] +% chapterLevel = (*<(false)|true>*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 开启后,可以使用以「chapter」为顶层的附录格式。 +% +% \begin{latex}[emph={[1]appendices,chapter}] +% \begin{appendices} +% \chapter{附录A 题目} +% (*\meta{附录A 内容}*) +% \chapter{附录B 题目} +% (*\meta{附录B 内容}*) +% \end{appendices} +% \end{latex} +% \end{function} +% +% \begin{function}{appendices/title} +% \begin{bitsyntax}[emph={[1]title}] +% title = (*\meta{字符串}*) +% \end{bitsyntax} +% +% 可以覆盖附录的标题名称,默认为「附录」。 +% \end{function} +% +% \begin{function}{appendices/TOCTitle} +% \begin{bitsyntax}[emph={[1]TOCTitle}] +% TOCTitle = (*\meta{字符串}*) +% \end{bitsyntax} +% +% 可以覆盖附录在目录中的名称,默认为「附录」。 +% \end{function} +% +% \subsubsection{其他配置} +% +% \begin{function}{misc} +% \begin{bitsyntax}[emph={[1]misc}] +% misc = (*\marg{键值列表}*) +% misc/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于调整其他选项。具体内容见下。 +% \end{function} +% +% \begin{function}{misc/arialFont} +% \begin{bitsyntax}[emph={[1]arialFont}] +% arialFont = (*\marg{字符串}*) +% \end{bitsyntax} +% +% \textit{此选项一般不需要用户自行修改。} +% +% 本科生毕业设计模板(全英文专业)需要设置 Arial 字体。 +% (Windows 和 MacOS 自带,Linux 需要用户自行安装) +% \end{function} +% +% \section{正文编写} +% +% 请注意,请在\env{document} 之内使用以下命令 。 +% +% \subsection{封面及基本信息} +% +% \begin{function}{\MakeCover} +% +% \textit{封面内容会根据模板选项(具体参见节\ref{sec:template-options})中\meta{type=xxx}的值而变化。} +% \textit{封面的下划线效果会受到参数设置中封面选项(具体见节\ref{sec:cover})的影响。} +% +% 绘制封面。 +% +% 在默认配置下,封面中的下划线会自动计算最大宽度。此时,如果用户需要换行,可以通过「//」控制换行。 +% +% 当关闭自动计算下划线宽度后,可以通过\meta{labelMaxWidth=xxx} 与 \meta{valueMaxWidth=xxx}来指定下划线的宽度。一般情况下,我们不建议您这样做。 +% \end{function} +% +% \begin{function}{\MakePaperBack} +% +% 绘制书脊。 +% \end{function} +% +% \begin{function}{\MakeTitle} +% +% 绘制中英文信息页。 +% \end{function} +% +% \begin{function}{\MakeOriginality} +% +% 绘制中英文信息页。 +% \end{function} +% +% \subsection{前置部分} +% +% \begin{function}{\frontmatter} +% +% 声明前置部分开始。 +% +% 此时页码会使用罗马数字进行计数。 +% \end{function} +% +% \begin{function}{abstract} +% \begin{bitsyntax}[emph={[1]abstract}] +% \begin{abstract} +% (*\meta{中文摘要}*) +% \end{abstract} +% \end{bitsyntax} +% \end{function} +% +% \begin{function}{abstractEn} +% \begin{bitsyntax}[emph={[1]abstractEn}] +% \begin{abstractEn} +% (*\meta{英文摘要}*) +% \end{abstractEn} +% \end{bitsyntax} +% +% 摘要。 +% +% 摘要的最后会显示关键词,关键词通过 \cs{BITSetup} 录入。 +% +% \end{function} +% +% \begin{function}{\MakeTOC,\listoffigures,\listoftables} +% +% 绘制目录、插图目录与表格目录。 +% \end{function} +% +% \begin{function}{symbols} +% \begin{bitsyntax}[emph={[1]symbols}] +% \begin{symbols} +% \item[BIT] 北京理工大学的英文缩写 +% \item[\LaTeX] 一个很棒的排版系统 +% \end{symbols} +% \end{bitsyntax} +% +% 主要符号对照表。 +% +% 主要符号对照表类似于一个列表环境,用以添加文章中使用的关键符号与缩略词。 +% +% \end{function} +% +% \begin{function}{addTOC} +% \begin{bitsyntax}[emph={[1]addTOC}] +% addTOC = (*<(true)|false>*) +% \end{bitsyntax} +% +% 主要符号对照表的可选参数。 +% +% 添加主要符号对照表到目录,默认开启。 +% \end{function} +% +% \subsection{正文部分} +% +% \begin{function}{\mainmatter} +% +% 声明正文部分开始。 +% +% 此时页码会使用阿拉伯数字进行计数。 +% \end{function} +% +% \subsubsection{定理类环境} +% \paragraph{默认格式} +% +% \begin{function}{algorithm,theorem,lemma,proposition,corollary,axiom,definition,conjecture,example,case,remark} +% \begin{bitsyntax}[emph={[2]proof}] +% \begin{theorem}[留数定理] +% (*\meta{定理内容}*) +% \end{theorem} +% +% \begin{proof}(*\oarg{小标题}*) +% (*\meta{证明过程}*) +% \end{proof} +% \end{bitsyntax} +% 一系列预定义的数学环境。具体含义见表~\ref{tab:theorem}。 +% \end{function} +% +% \begin{table}[] +% \caption{预定义的数学环境} +% \centering +% \subfloat[][plain样式]{ +% \begin{tabular}{@{}ccccccc@{}} +% \toprule +% \textbf{名称} & algorithm & theorem & lemma & proposition & corollary & axiom \\ \midrule +% \textbf{含义} & 算法 & 定理 & 引理 & 命题 & 推论 & 公理 \\ +% \textbf{样式} & \multicolumn{6}{c}{\textbf{定理2.1.} \textit{定理内容……}} \\ \bottomrule +% \end{tabular} +% } +% +% \subfloat[][definition样式]{ +% \begin{tabular}{@{}ccccc@{}} +% \toprule +% \textbf{名称} & definition & conjecture & example & case \\ \midrule +% \textbf{含义} & 定义 & 猜想 & 例 & 情形 \\ +% \textbf{样式} & \multicolumn{4}{c}{\textbf{定义2.1.} 定义内容……} \\ \bottomrule +% \end{tabular} +% } +% +% \subfloat[][remark样式]{ +% \begin{tabular}{@{}cc@{}} +% \toprule +% \textbf{名称} & remark \\ \midrule +% \textbf{含义} & 注 \\ +% \textbf{样式} & \multicolumn{1}{c}{\textit{注1.} 内容……} \\ \bottomrule +% \end{tabular} +% } +% +% \subfloat[][proof样式]{ +% \begin{tabular}{@{}cc@{}} +% \toprule +% \textbf{名称} & proof \\ \midrule +% \textbf{含义} & 证明 \\ +% \textbf{样式} & \multicolumn{1}{c}{\textit{证明. } 内容…… 「证毕符号」} \\ \bottomrule +% \end{tabular} +% } +% \label{tab:theorem} +% \end{table} +% +% \subsection{后置部分} +% +% \begin{function}{\backmatter} +% +% 声明后置部分开始。 +% +% 会取消章节标题的的编号。 +% +% \end{function} +% +% \begin{function}{conclusion} +% \begin{bitsyntax}[emph={[1]conclusion}] +% \begin{conclusion} +% (*\meta{结论}*) +% \end{conclusion} +% \end{bitsyntax} +% \end{function} +% +% \begin{function}{bibprint} +% \begin{bitsyntax}[emph={[1]bibprint}] +% \begin{bibprint} +% \printbibliography[heading=none] +% \end{bibprint} +% \end{bitsyntax} +% +% 打印参考文献。 +% +% 在使用\BIThesisTemplates{GT}时需要注意,由于研究生学位论文也要求使用国标形式输出「攻读学位期间发表论文与研究成果清单」,因此 bithesis 同样使用 bibtex 管理其文献。而由于 biblatex 的排序是全局的,因此需要使用 \meta{category} 功能来分割出两个不同的类别。 +% +% 因此,请使用下列语句输出参考文献: +% \begin{latex}[emph={[1]bibprint}] +% \begin{bibprint} +% \printbibliography[heading=none,notcategory=mypub,resetnumbers=true] +% \end{bibprint} +% \end{latex} +% \end{function} +% +% \begin{function}{appendices} +% \begin{bitsyntax}[emph={[1]appendices}] +% \begin{appendices} +% \section{附录A题目} +% (*\meta{附录A内容}*) +% \section{附录B题目} +% (*\meta{附录B内容}*) +% \end{appendices} +% \end{bitsyntax} +% +% 附录。 +% \end{function} +% +% \begin{function}{publications} +% \begin{bitsyntax}[emph={[1]publications,addtocategory,printbibliography}] +% \begin{publications} +% \nocite{\meta{引用内容的key}} +% \addtocategory{mypub}{\meta{引用内容的key}} +% \printbibliography[heading=none,category=mypub,resetnumbers=true] +% \end{publications} +% \end{bitsyntax} +% +% 攻读学位期间发表论文与研究成果清单。 +% \end{function} +% +% \begin{function}{acknowledgements} +% \begin{bitsyntax}[emph={[1]acknowledgements}] +% \begin{acknowledgements} +% (*\meta{致谢内容}*) +% \end{acknowledgements} +% \end{bitsyntax} +% +% 致谢。 +% \end{function} +% +% \begin{function}{resume} +% \begin{bitsyntax}[emph={[1]resume}] +% \begin{resume} +% (*\meta{个人简介内容}*) +% \end{resume} +% \end{bitsyntax} +% +% 个人简介。 +% \end{function} +% +% \section{\cls{bitreport} 使用与配置} +% +% 推荐使用\BIThesisRelease (开箱即用)。 +% +% \BIThesisRelease 提供了多种最常用的模板,你可以在 +% \href{https://github.com/BITNP/BIThesis/releases}{主项目的 Releases}中找到它们。 +% +% 使用此文档类的模板有: +% \begin{itemize} +% \item \BIThesisTemplates{UP} +% \item \BIThesisTemplates{LR} +% \end{itemize} +% +% \subsection{最小用例} +% +% \begin{latex} +% \documentclass[]{bitreport} +% \BITSetup{ +% info = { +% author = FKY, +% ...... +% } +% } +% \begin{document} +% \end{document} +% \end{latex} +% +% \subsection{模板选项} +% +% 所谓“模板选项”,指需要在引入文档类的时候指定的选项: +% +% \begin{latex}[deletetexcs={\documentclass},morekeywords={\documentclass}] +% \documentclass(*\oarg{模板选项}*){bithesis} +% \end{latex} +% +% \begin{function}{type} +% \begin{bitsyntax}[emph={[1]type}] +% type = (*<(common)|\mbox{undergraduate_proposal}>*) +% \end{bitsyntax} +% 选择论文类型,它们分别对应: +% \begin{itemize} +% \item \BIThesisTemplates{LR} +% \item \BIThesisTemplates{UP} +% \end{itemize} +% \end{function} +% +% \begin{function}{ctex} +% \begin{bitsyntax}[emph={[1]ctex}] +% ctex = (*传给 ctexbook 的模板选项*) +% \end{bitsyntax} +% +% 该选项用于传入模板选项至 ctexbook。 +% \end{function} +% +% \subsection{参数设置} +% +% \begin{function}{\BITSetup} +% \begin{bitsyntax}[emph={[1]BITSetup}] +% \BITSetup = {(*\oarg{键值对}*)} +% \end{bitsyntax} +% \end{function} +% +% 本模板提供了一系列选项,可由您自行配置。载入文档类之后,以下所有选项均可通过统一的 +% 命令 \cs{BITSetup} 来设置。 +% +% \cs{BITSetup} 的参数是一组由(英文)逗号隔开的选项列表,列表中的选项通常是 \meta{key} = +% \meta{value} 的形式。部分选项的 \meta{value} 可以省略。对于同一项,后面的设置将会覆盖前面的设 +% 置。在下文的说明中,将用粗体表示默认值。 +% +% \cs{BITSetup} 采用 LATEX3 风格的键值设置,支持不同类型以及多种层次的选项设定。键值列 +% 表中,“=”左右的空格不影响设置;但需注意,参数列表中不可以出现空行。 +% 与模板选项相同,布尔型的参数可以省略 \meta{选项} = true 中的“= true”。 +% 另有一些选项包含子选项,如 cover 和 info 等。它们可以按如下两种等价方式来设定: +% +% \begin{latex}[morekeywords={\BITSetup},emph={[1]BITSetup,cover,date,info,title,author}] +% \BITSetup{ +% cover = { +% date = xxxx年x月, +% }, +% info = { +% author = Feng Kaiyu, +% title = A Report Title for Your Experiment, +% } +% } +% \end{latex} +% +% 或者 +% +% \begin{latex}[morekeywords={\BITSetup},emph={[1]BITSetup,cover,date,info,title,author}] +% \BITSetup{ +% cover / date = xxxx年x月, +% info / author = Feng Kaiyu, +% info / title = A Thesis Title for Your Paper, +% } +% \end{latex} +% +% \subsubsection{封面选项} +% +% \begin{function}{cover} +% \begin{bitsyntax}[emph={[1]cover}] +% cover = (*\marg{键值列表}*) +% cover/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于设置论文格式。具体内容见下。 +% \end{function} +% +% \begin{function}{cover/date} +% \begin{bitsyntax}[emph={[1]date}] +% date = (*\marg{任意字符串}*) +% \end{bitsyntax} +% +% 覆盖封面的日期。 +% \end{function} +% +% \subsubsection{文档基本信息} +% +% \begin{function}{info} +% \begin{bitsyntax}[emph={[1]info}] +% info = (*\marg{键值列表}*) +% info/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于录入论文信息。具体内容见下。 +% \end{function} +% +% \begin{function}{info/title} +% \begin{bitsyntax}[emph={[1]title}] +% title = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 论文或报告标题。 +% \end{function} +% +% \begin{function}{info/school} +% \begin{bitsyntax}[emph={[1]school}] +% school = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 学院名称。 +% \end{function} +% +% \begin{function}{info/major} +% \begin{bitsyntax}[emph={[1]major}] +% major = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 专业名称。 +% \end{function} +% +% \begin{function}{info/author} +% \begin{bitsyntax}[emph={[1]author}] +% author = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 作者姓名。 +% \end{function} +% +% \begin{function}{info/studentId} +% \begin{bitsyntax}[emph={[1]studentId}] +% studentId = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 学号。 +% \end{function} +% +% \begin{function}{info/supervisor} +% \begin{bitsyntax}[emph={[1]supervisor}] +% supervisor = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 指导教师。 +% \end{function} +% +% \begin{function}{info/externalSupervisor} +% \begin{bitsyntax}[emph={[1]externalSupervisor}] +% externalSupervisor = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 校外指导教师。 +% \end{function} +% +% \begin{function}{info/class} +% \begin{bitsyntax}[emph={[1]class}] +% class = (*\marg{字符串}*) +% \end{bitsyntax} +% +% 班级。 +% \end{function} +% +% \subsubsection{其他选项} +% +% \begin{function}{misc} +% \begin{bitsyntax}[emph={[1]misc}] +% misc = (*\marg{键值列表}*) +% misc/(*\meta{key}*) = (*\meta{value}*) +% \end{bitsyntax} +% +% 该选项包含许多子项目,用于额外的控制。具体内容见下。 +% \end{function} +% +% \begin{function}{misc/reviewTable} +% \begin{bitsyntax}[emph={[1]reviewTable}] +% reviewTable = (*\marg{指向评审表的路径}*) +% \end{bitsyntax} +% +% 用于指定已经填写好的评审表 PDF 文件。 +% \end{function} +% % \section{致谢} +% \begin{itemize} +% \item 感谢贡献者对 BIThesis 的无私奉献。 +% \item 感谢学校及相关老师对 BIThesis 的支持。 +% \item 感谢清华大学和复旦大学的学位论文模板项目,他们为后来者提供了前进的方向。 +% \end{itemize} +% % \section{软件许可证} +% % \begin{itemize} % \item 北京理工大学校徽校名图片的版权归北京理工大学所有。 % \item \BIThesisLaTeX 宏包以及相关文档类使用 \LPPL 授权。 -% \item \BIThesisLaTeX 文档及其他附属文件通过 \LPPL 授权。 +% \item \BIThesisLaTeX 文档及其他附属文件通过 CC0-1.0 授权。 % \end{itemize} % \section{实现细节} % @@ -187,22 +1207,2094 @@ %<*package> % \end{macrocode} % -% \begin{macro}{\YOURMACRO} -% Put explanation of |\YOURMACRO|’s implementation here. +% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention). % \begin{macrocode} -\newcommand{\YOURMACRO}{} +%<@@=bithesis> % \end{macrocode} -% \end{macro} % -% \begin{environment}{YOURENV} -% Put explanation of |YOURENV|’s implementation here. % \begin{macrocode} -\newenvironment{YOURENV}{}{} +%</package> +% \end{macrocode} + +% \begin{macrocode} +%<*thesis> % \end{macrocode} -% \end{environment} + +% Define Global Variables +% \begin{macrocode} +\int_new:N \g_@@_thesis_type_int +\int_new:N \g_@@_head_zihao_int +\bool_new:N \g_@@_twoside_bool +\bool_new:N \g_@@_thesis_type_english_bool +\bool_new:N \g_@@_blind_mode_bool +\tl_new:N \g_@@_label_divide_char_tl + +% \bool_new:N \l_@@_cover_auto_width_bool +% \bool_set_true:N \l_@@_cover_auto_width_bool % +% Define tmp Variables +\seq_new:N \l_@@_right_seq +\seq_new:N \l_@@_left_seq + +% helper functions + +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx} + +\cs_new:Npn \@@_same_page: { + \let\clearpage\relax + \let\cleardoublepage\relax +} + +% 是否为研究生学位论文 +\cs_new:Npn \@@_if_graduate:TF #1#2 { + \int_compare:nNnTF {3} < {\g_@@_thesis_type_int} + {#1} + {#2} + } + +% 是否某一特定模板 +\cs_new:Npn \@@_if_thesis_int_type:nTF #1#2#3 {\int_compare:nNnTF {\g_@@_thesis_type_int} = {#1} {#2} {#3}} +\cs_new:Npn \@@_if_thesis_int_type:nT #1#2 {\@@_if_thesis_int_type:nTF {#1} {#2} {}} + +% 是否为英文模板,这里包括全英文专业和研究生模板的英文模式。 +\cs_new:Npn \@@_if_thesis_english:TF #1#2 {\bool_if:nTF {\g_@@_thesis_type_english_bool} {#1} {#2}} +\cs_new:Npn \@@_if_thesis_english:T #1 {\@@_if_thesis_english:TF {#1}{}} + +\cs_new:Npn \@@_if_bachelor_thesis:TF #1#2 {\int_compare:nNnTF {\g_@@_thesis_type_int} < {4} {#1} {#2}} +\cs_new:Npn \@@_if_bachelor_thesis:T #1 {\@@_if_bachelor_thesis:TF {#1} {}} +\cs_new:Npn \@@_if_master_thesis:TF #1#2 {\int_compare:nNnTF {\g_@@_thesis_type_int} = {4} {#1} {#2}} +\cs_new:Npn \@@_if_doctor_thesis:TF #1#2 {\int_compare:nNnTF {\g_@@_thesis_type_int} = {5} {#1} {#2}} + +% Define Consts. +\clist_const:Nn \c_@@_thesis_type_clist + { bachelor, bachelor_translation, bachelor_english, master, docter} + +\cs_new_protected:Npn \@@_define_label:nn #1#2 + { \tl_const:cn { c_@@_label_ #1 _tl } {#2} } + +\cs_new_protected:Npn \@@_define_label_by_thesis_type:nnn #1#2#3 + { + \tl_const:cn { c_@@_ #1 _label_ #2 _tl } {#3} + } + +\cs_new_protected:Npn \@@_define_label:nnn #1#2#3 + { + \tl_const:cn { c_@@_label_ #1 _tl } {#2} + \tl_const:cn { c_@@_label_ #1 _en_tl } {#3} + } + +\cs_new_protected:Npn \@@_define_label_by_thesis_type:nnnn #1#2#3#4 + { + \tl_const:cn { c_@@_ #1 _label_ #2 _tl } {#3} + \tl_const:cn { c_@@_ #1 _label_ #2 _en_tl } {#4} + } + +\clist_map_inline:nn + { + {code} {代码}, + {udc} {UDC分类号:}, + {classification} {中国分类号:}, + {classified_level} {密级}, + {type} {种类}, + } + {\@@_define_label:nn #1} + +% bachelor +\clist_map_inline:nn + { + {title} {本科生毕业设计(论文)}, + {originality} {原创性声明}, + {originality_clause} {本人郑重声明:所呈交的毕业设计(论文),是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,本文不包含任何其他个人或集体已经发表或撰写过的研究成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。\par~特此申明。}, + {authorization} {关于使用授权的声明}, + {authorization_clause} {本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,其中包括:\circled{1}~学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);\circled{3}~学校可允许本毕业设计(论文)被查阅或借阅;\circled{4}~学校可以学术交流为目的,复制赠送和交换本毕业设计(论文);\circled{5}~学校可以公布本毕业设计(论文)的全部或部分内容。}, + {originality_author_signature} {本人签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日}, + {originality_supervisor_signature} {指导老师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日}, + } {\@@_define_label_by_thesis_type:nnn {bachelor} #1} + +% % bachelor english +\clist_map_inline:nn + { + {title} {}, + {originality} {原创性声明~Statement~of~Originality}, + {originality_clause} { + 本人郑重声明:所呈交的毕业设计(论文),是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,本文不包含任何其他个人或集体已经发表或撰写过的研究成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。特此申明。\par + \arialfamily I,\dunderline[-1pt]{1pt}{\makebox[18mm]{}},~solemnly~ + declare:~the~submitted~graduation~design~(thesis),~is~the~research~achievement~completed~independently~by~myself~ + under~the~guidance~of~the~supervisor.~This~article~does~not~contain~ + any~research~published~or~written~by~any~other~individual~or~group,~ + except~as~already~referenced~in~this~paper.~Individuals~and~groups~ + that~have~made~important~contributions~to~the~study~of~this~paper~ + are~clearly~indicated~and~cited~in~the~paper.\par + }, + {authorization} {关于使用授权的声明~State~of~Use~Authorization}, + {authorization_clause} { + 本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,其中包括:\circled{1}学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;\circled{2}学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);\circled{3}学校可允许本毕业设计(论文)被查阅或借阅;\circled{4}学校可以学术交流为目的,复制赠送和交换本毕业设计(论文);\circled{5}学校可以公布本毕业设计(论文)的全部或部分内容。\par + I~fully~understand~the~regulations~on~the~storage,~use~of~graduation~design~(thesis)~in~Beijing~Institute~of~Technology.~Beijing~Institute~of~Technology~has~the~right~to~(1)~keep,~and~to~the~relevant~departments~to~send~the~original~or~copy~of~this~graduation~design~(thesis);~(2)~copy~and~preserve~this~graduation~design~(thesis)~by~photocopying,~miniature~or~other~means~of~reproduction;~(3)~allow~this~graduation~design~(thesis)~to~be~read~or~borrowed;~(4)~for~the~purpose~of~academic~exchange,~copy,~give~and~exchange~this~graduation~design~(thesis);~(5)~publish~all~or~part~of~the~contents~of~this~graduation~design~(thesis).~ + }, + } {\@@_define_label_by_thesis_type:nnn {bachelor_english} #1} + +\cs_new:Npn \smallgap: { + \hspace{0.45ex} +} + +\cs_new:Npn \label_space: { + \@@_if_bachelor_thesis:T { + \quad + } +} + +% graduate +\clist_map_inline:nn + { + {originality} {研究成果声明}, + {originality_clause} {本人郑重声明:所提交的学位论文是我本人在指导教师的指导下进行的研究工作获得的研究成果。尽我所知,文中除特别标注和致谢的地方外,学位论文中不包含其他人已经发表或撰写过的研究成果,也不包含为获得北京理工大学或其它教育机构的学位或证书所使用过的材料。与我一同工作的合作者对此研究工作所做的任何贡献均已在学位论文中作了明确的说明并表示了谢意。\par~特此申明。}, + {authorization} {关于学位论文使用权的说明}, + {authorization_clause} {本人完全了解北京理工大学有关保管、使用学位论文的规定,其中包括:\circled{1}~学校有权保管、并向有关部门送交学位论文的原件与复印件;\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存学位论文;\circled{3}~学校可允许学位论文被查阅或借阅;\circled{4}~学校可以学术交流为目的,复制赠送和交换学位论文;\circled{5}~学校可以公布学位论文的全部或部分内容(保密学位论文在解密后遵守此规定)。}, + {originality_author_signature} {签\qquad 名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad}, + {originality_supervisor_signature} {指导老师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad}, + } {\@@_define_label_by_thesis_type:nnn {graduate} #1} + +\clist_map_inline:nn + { + {author} {作\quad 者\quad 姓\quad 名} {Candidate~Name}, + {school} {学\quad 院\quad 名\quad 称} {School~or~Department}, + {supervisor} {指\quad 导\quad 教\quad 师} {Faculty~Mentor}, + {chairman} {答辩委员会主席} {Chair,~Thesis~Committee}, + {degree} {申\smallgap: 请\smallgap: 学\smallgap: 位\smallgap: 级\smallgap: 别} {Degree~Applied}, + {major} {学\quad 科\quad 专\quad 业} {Major}, + {institute} {学\smallgap: 位\smallgap: 授\smallgap: 予\smallgap: 单\smallgap: 位} {Degree~by}, + {defense_date} {论\smallgap: 文\smallgap: 答\smallgap: 辩\smallgap: 日\smallgap: 期} {The~Date~of~Defence}, + } {\@@_define_label_by_thesis_type:nnnn {graduate} #1} + +\clist_map_inline:nn + { + {school} {学\qquad 院} {School}, + {major} {专\qquad 业} {Degree}, + {author} {学生姓名} {Author}, + {student_id} {学\qquad 号} {Student~ID}, + {supervisor} {指导教师} {Supervisor}, + {co_supervisor} {校外指导教师} {Co-Supervisor}, + {keywords} {关键词:} {Key~Words:~}, + {toc} {目\label_space: 录} {Table~of~Contents}, + {abstract} {摘\label_space: 要} {Abstract}, + {conclusion} {结\label_space: 论} {Conclusions}, + {appendix} {附\label_space: 录} {Appendices}, + {ack} {致\label_space: 谢} {Acknowledgement}, + {figure} {插\quad 图} {Illustrations}, + {table} {表\quad 格} {Tables}, + {appendix_prefix} {附录} {Appendix}, + {reference} {参考文献} {References}, + {university} {北京理工大学} {Beijing~Institute~of~Technology}, + {publications} {攻读学位期间发表论文与研究成果清单} {Publications~During~Studies}, + % TODO: Not so sure about the translation. + {resume} {作者简介} {}, + {symbols} {主要符号对照表} {}, + } + {\@@_define_label:nnn #1} + +% TODO: \clist_item:Nn +\clist_const:Nn \c_@@_bachelor_thesis_header_clist + {北京理工大学本科生毕业设计(论文), 北京理工大学本科生毕业设计(论文)外文翻译, Beijing~Institute~of~Technology~Bachelor's~Thesis } +\clist_const:Nn \c_@@_bachelor_thesis_cover_title_clist + { + 本科生毕业设计(论文), + 本科生毕业设计(论文)外文翻译, + Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis, + } + + +% key-value interface definition. +\keys_define:nn { bithesis } +{ + info .meta:nn = { bithesis / info } {#1}, + misc .meta:nn = { bithesis / misc } {#1}, + cover .meta:nn = { bithesis / cover } {#1}, + style .meta:nn = { bithesis / style } {#1}, + option .meta:nn = { bithesis / option } {#1}, + TOC .meta:nn = { bithesis / TOC } {#1}, + appendices .meta:nn = { bithesis / appendices } {#1}, +} + +\keys_define:nn { bithesis / option } +{ + type .choice:, + type .value_required:n = true, + type .choices:Vn = + \c_@@_thesis_type_clist + { + \int_set_eq:NN \g_@@_thesis_type_int \l_keys_choice_int + \int_case:nn {\l_keys_choice_int} { + % 本科全英文也是英文模板。 + {3} {\bool_set_true:N \g_@@_thesis_type_english_bool} + } + }, + type .initial:n = bachelor, + twoside .bool_gset:N = \g_@@_twoside_bool, + blindPeerReview .bool_gset:N = \g_@@_blind_mode_bool, + ctex .tl_set:N = \l_@@_options_to_ctex_tl, +} + +\keys_define:nn { bithesis / cover } + { + date .tl_set:N = \l_@@_cover_date_tl, + headerImage .tl_set:N = \l_bit_coverheaderimage_tl, + xiheiFont .tl_set:N = \l_@@_cover_xihei_font_path_tl, + xiheiFont .default:n = {STXihei}, + %% cover entry + dilimiter .tl_set:N = \l_@@_cover_dilimiter_tl, + labelAlign .tl_set:N = \l_@@_cover_label_align_tl, + labelAlign .initial:n = {r}, + valueAlign .tl_set:N = \l_@@_cover_value_align_tl, + valueAlign .initial:n = {c}, + labelMaxWidth .dim_set:N = \l_@@_cover_label_max_width_dim, + valueMaxWidth .dim_set:N = \l_@@_cover_value_max_width_dim, + autoWidth .bool_set:N = \l_@@_cover_auto_width_bool, + autoWidth .initial:n = {true}, + underlineThickness .dim_set:N = \l_@@_cover_underline_thickness_dim, + underlineThickness .initial:n = {1pt}, + underlineOffset .dim_set:N = \l_@@_cover_underline_offset_dim, + underlineOffset .initial:n = { -10pt }, + } + +\keys_define:nn { bithesis / info } + { + title .tl_set:N = \l_@@_value_title_tl, + titleEn .tl_set:N = \l_@@_value_title_en_tl, + school .tl_set:N = \l_@@_value_school_tl, + major .tl_set:N = \l_@@_value_major_tl, + author .tl_set:N = \l_@@_value_author_tl, + studentId .tl_set:N = \l_@@_value_student_id_tl, + supervisor .tl_set:N = \l_@@_value_supervisor_tl, + externalSupervisor .tl_set:N = \l_@@_value_external_supervisor_tl, + keywords .tl_set:N = \l_@@_value_keywords_tl, + keywordsEn .tl_set:N = \l_@@_value_keywords_en_tl, + translationTitle .tl_set:N = \l_@@_value_trans_title_tl, + translationOriginTitle .tl_set:N = \l_@@_value_trans_origin_title_tl, + % 中国分类号,研究生学位论文使用 + classification .tl_set:N = \l_@@_value_classification_tl, + % UDC 分类号,研究生学位论文使用 + UDC .tl_set:N = \l_@@_value_udc_tl, + chairman .tl_set:N = \l_@@_value_chairman_tl, + degree .tl_set:N = \l_@@_value_degree_tl, + degreeEn .tl_set:N = \l_@@_value_degree_en_tl, + institute .tl_set:N = \l_@@_value_institute_tl, + institute .initial:n = {\c_@@_label_university_tl}, + defenseDate .tl_set:N = \l_@@_value_defense_date_tl, + authorEn .tl_set:N = \l_@@_value_author_en_tl, + schoolEn .tl_set:N = \l_@@_value_school_en_tl, + supervisorEn .tl_set:N = \l_@@_value_supervisor_en_tl, + chairmanEn .tl_set:N = \l_@@_value_chairman_en_tl, + majorEn .tl_set:N = \l_@@_value_major_en_tl, + instituteEn .tl_set:N = \l_@@_value_institute_en_tl, + instituteEn .initial:n = {\c_@@_label_university_en_tl}, + defenseDateEn .tl_set:N = \l_@@_value_defense_date_en_tl, + classifiedLevel .tl_set:N = \l_@@_value_classified_level_tl, + } + +\keys_define:nn { bithesis / misc } + { + arialFont .tl_set:N = \l_@@_misc_arial_font_path_tl, + } + +\keys_define:nn { bithesis / style } +{ + head .tl_set:N = \l_@@_style_head_tl, + head .initial:n = { + \int_case:nn {\g_@@_thesis_type_int} + { + {1} {北京理工大学本科生毕业设计(论文)} + {2} {北京理工大学本科生毕业设计(论文)外文翻译} + {3} {Beijing~Institute~of~Technology~Bachelor's~Thesis} + {4} {北京理工大学硕士学位论文} + {5} {北京理工大学博士学位论文} + } + }, +} + +\keys_define:nn { bithesis / TOC } +{ + abstract .bool_set:N = \l_@@_add_abstract_to_toc_bool, + abstract .initial:n = {true}, + abstractEn .bool_set:N = \l_@@_add_abstract_en_to_toc_bool, + abstractEn .initial:n = {true}, + symbols .bool_set:N = \l_@@_add_symbols_to_toc_bool, + symbols .initial:n = {true}, +} + +\keys_define:nn { bithesis / appendices } +{ + chapterLevel .bool_set:N = \l_@@_appendices_chapter_level_bool, + title .tl_set:N = \l_@@_appendices_title_tl, + TOCTitle .tl_set:N = \l_@@_appendix_toc_title_tl, +} + +\ProcessKeysOptions { bithesis / option } + +\@@_if_thesis_english:T { + \PassOptionsToClass{scheme=plain}{ctexbook} +} + +\bool_if:NTF \g_@@_twoside_bool {} { + \PassOptionsToClass{oneside,openany}{ctexbook} +} + + +% Any extra option passed by user will be passed to ctexbook. +\DeclareOption*{ + \PassOptionsToClass{\l_@@_options_to_ctex_tl}{ctexbook} +} +% Executes the code for each option. +\ProcessOptions\relax +% Load +\LoadClass[zihao=-4,]{ctexbook} + +\RequirePackage{geometry} +\RequirePackage{xeCJK} +\RequirePackage{titletoc} +\RequirePackage{setspace} +\RequirePackage{graphicx} +\RequirePackage{fancyhdr} +\RequirePackage{pdfpages} +\RequirePackage{setspace} +\RequirePackage{booktabs} +\RequirePackage{multirow} +\RequirePackage{tikz} +\RequirePackage{etoolbox} +\RequirePackage{hyperref} +\RequirePackage{xcolor} +\RequirePackage{caption} +\RequirePackage{array} +\RequirePackage{amsmath} +\RequirePackage{amssymb} +\RequirePackage{amsthm} +\RequirePackage{unicode-math} +\RequirePackage{pdfpages} +\RequirePackage{listings} +\RequirePackage{enumitem} +\RequirePackage{environ} + +% Suppress warning for \hskip by hyperref. +\pdfstringdefDisableCommands{% + \let\quad\empty +} + +\@@_if_graduate:TF { + \int_set:Nn \g_@@_head_zihao_int {5} + \geometry{ + a4paper, + left=2.7cm, + bottom=2.5cm + 7bp, + top=3.5cm + 7bp, + right=2.7cm, + headsep = 3.5cm + 7bp - 2.5cm - 15bp, + headheight = 15 bp, + footskip = 2.5cm + 7bp - 1.8cm, + } +} { + \int_set:Nn \g_@@_head_zihao_int {4} + \geometry{ + a4paper, + left=3cm, + bottom=2.6cm + 7bp, + top=3.5cm + 7bp, + right=2.6cm, + headsep = 3.5cm + 7bp - 2.4cm - 20bp, + headheight = 20 bp, + footskip = 2.6cm + 7bp - 2cm, + } +} + +% One blank line before the figure and after the caption. +\setlength{\intextsep}{2\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip} + +\setromanfont{Times~New~Roman} + +\ctex_at_end_preamble:n { + \@@_if_thesis_english:TF { + \@@_if_thesis_int_type:nT {3} { + % font Arial needed + \newfontfamily\arialfamily{Arial} + } + + } { + \tl_if_blank:VTF \l_@@_cover_xihei_font_path_tl {} + { + \setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]{\l_@@_cover_xihei_font_path_tl} + } + } + + \@@_if_thesis_int_type:nT {3} { + \RequirePackage[en-US]{datetime2} + \RequirePackage{indentfirst} + \DTMlangsetup[en-US]{dayyearsep={\space}} + } + + % Define biblatex category if it was imported. + \cs_if_exist:NT \DeclareBibliographyCategory { + \DeclareBibliographyCategory{mypub} + } +} + +\cs_new:Npn \xihei:n #1 { + \xeCJK_family_if_exist:nTF {xihei} { + \CJKfamily{xihei} #1 + }{ + \heiti #1 + } +} + +\cs_new:Npn \l_@@_title_font_cs:n #1 { + \int_compare:nNnTF {\g_@@_thesis_type_int} = {3} + { + \arialfamily #1 + } { + \heiti #1 + } +} + +\cs_new:Npn \l_@@_unnumchapter_style_cs:n #1 { + % 本科全英文、研究生学位论文需要加粗 + \int_compare:nNnTF {\g_@@_thesis_type_int} > {2} + { + \bfseries #1 + } { + \mdseries #1 + } +} + +\cs_set:Npn \arabicHeiti #1 {#1} + +% TODO: custom title +\fancypagestyle{BIThesis}{ + \fancyhf{} + % 定义页眉、页码 + \fancyhead[C]{\zihao{\int_use:N \g_@@_head_zihao_int}\ziju{0.08}\songti{\tl_use:N \l_@@_style_head_tl}} + \fancyfoot[C]{\songti\zihao{5} \thepage} + % 页眉分割线稍微粗一些 + \RenewDocumentCommand \headrulewidth {} {0.6pt} +} + +\ctexset{chapter={ + number = {\arabicHeiti{ \arabic{chapter} }}, + format = { \l_@@_title_font_cs:n \bfseries \centering \zihao{3}}, + nameformat = {}, + titleformat = {}, + aftername = \hspace{9bp}, + pagestyle = BIThesis, + beforeskip = 8bp, + afterskip = 32bp, + fixskip = true, + } +} + +\ctexset{section={ + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}}}, + format = {\l_@@_title_font_cs:n \raggedright \bfseries \zihao{4}}, + nameformat = {}, + titleformat = {}, + aftername = \hspace{8bp}, + beforeskip = 20bp plus 1ex minus .2ex, + afterskip = 18bp plus .2ex, + fixskip = true, + } +} + +\ctexset{subsection={ + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}}}, + format = {\l_@@_title_font_cs:n \bfseries \raggedright \zihao{-4}}, + nameformat = {}, + titleformat = {}, + aftername = \hspace{7bp}, + beforeskip = 17bp plus 1ex minus .2ex, + afterskip = 14bp plus .2ex, + fixskip = true, + } +} + +\ctexset{ + secnumdepth = 3, + subsubsection={ + numbering = true, + number = {\arabicHeiti{\arabic{chapter}.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}.\hspace{1bp}\arabic{subsubsection}}}, + format={\l_@@_title_font_cs:n \bfseries \raggedright \zihao{-4}}, + nameformat = {}, + titleformat = {}, + beforeskip=28bp plus 1ex minus .2ex, + afterskip=24bp plus .2ex, + fixskip=true, + } +} + +% TOC +\addtocontents{toc}{\protect\hypersetup{hidelinks}} + +\@@_if_graduate:TF { + % 各章标题,宋体四号 + \titlecontents{chapter}[0pt]{\songti \zihao{4}} + {\thecontentslabel\hspace{\ccwd}}{} + {\hspace{.5em}\titlerule*{.}\contentspage} +} { + \titlecontents{chapter}[0pt]{\songti \zihao{-4}} + {\thecontentslabel\hspace{\ccwd}}{} + {\hspace{.5em}\titlerule*{.}\contentspage} +} +\titlecontents{section}[1\ccwd]{\songti \zihao{-4}} +{\thecontentslabel\hspace{\ccwd}}{} +{\hspace{.5em}\titlerule*{.}\contentspage} +\titlecontents{subsection}[2\ccwd]{\songti \zihao{-4}} +{\thecontentslabel\hspace{\ccwd}}{} +{\hspace{.5em}\titlerule*{.}\contentspage} + +% \bool_new:N \l_@@_add_to_toc_bool +% \bool_set_true:N \l_@@_add_to_toc_bool +% +% \keys_define:nn { bit } +% { +% abstract .meta:nn = { bit / abstract } {#1}, +% abstract_en .meta:nn = { bit / abstract_en } {#1}, +% symbols .meta:nn = { bit / symbols } {#1}, +% appendices .meta:nn = { bit / appendices } {#1}, +% } +% +% \keys_define:nn { bit / abstract } +% { +% addTOC .bool_set:N = \l_@@_add_to_toc_bool, +% } +% +% \keys_define:nn { bit / abstract_en } +% { +% addTOC .bool_set:N = \l_@@_add_to_toc_bool, +% } +% +% \keys_define:nn { bit / symbols } +% { +% addTOC .bool_set:N = \l_@@_add_to_toc_bool, +% } +% +% \keys_define:nn { bit / appendices } +% { +% chapterLevel .bool_set:N = \l_@@_appendices_chapter_level_bool, +% title .tl_set:N = \l_@@_appendices_title_tl, +% TOCTitle .tl_set:N = \l_@@_appendix_toc_title_tl, +% } + +\RenewDocumentCommand \frontmatter {} { + + \int_compare:nNnTF {\g_@@_thesis_type_int} = {3} + { + \pagenumbering{roman} + } { + \pagenumbering{Roman} + } + \ctexset{ + chapter = { + numbering = false, + } + } + \pagestyle{BIThesis} +} + +\RenewDocumentCommand \mainmatter {} { + \cleardoublepage + + \ctexset{ + chapter = { + numbering = true, + } + } + \pagenumbering{arabic} + \pagestyle{BIThesis} + % 正文 22 磅的行距 + \setlength{\parskip}{0em} + \setstretch{1.53} + % 修复脚注出现跨页的问题 + \interfootnotelinepenalty=10000 +} + +\RenewDocumentCommand \backmatter {} { + \setcounter{section}{0} + \setcounter{subsection}{0} + \setcounter{subsubsection}{0} + \ctexset{ + chapter = { + numbering = false, + beforeskip = 18bp, + format = {\l_@@_title_font_cs:n \l_@@_unnumchapter_style_cs:n \centering \zihao{3}}, + afterskip = 26bp, + } + } +} + +\setlength{\abovecaptionskip}{11pt} +\setlength{\belowcaptionskip}{9pt} + +\@@_if_graduate:TF { + \tl_set:Nn \g_@@_label_divide_char_tl {.} +} { + \tl_set:Nn \g_@@_label_divide_char_tl {-} +} + +% figure +\cs_set:Npn \thefigure {\thechapter\g_@@_label_divide_char_tl\arabic{figure}} +\captionsetup[figure]{font=small,labelsep=space} + +% table +\cs_set:Npn \thetable {\thechapter\g_@@_label_divide_char_tl\arabic{table}} +\captionsetup[table]{font=small,labelsep=space,skip=2pt} + +% equation +\cs_set:Npn \theequation {\thechapter\g_@@_label_divide_char_tl\arabic{equation}} + +% code snippet +\cs_set:Npn \thelstlisting {\thechapter\g_@@_label_divide_char_tl\arabic{lstlisting}} +\cs_set:Npn \lstlistingname {\c_@@_label_code_tl} + + +% 调整底层 TeX 排版引擎参数以保证所有段落能够很好地以两端对齐的方式呈现 +\tolerance=1 +\emergencystretch=\maxdimen +\hyphenpenalty=10000 +\hbadness=10000 + +\definecolor{codegreen}{rgb}{0,0.6,0} +\definecolor{codegray}{rgb}{0.5,0.5,0.5} +\definecolor{codepurple}{rgb}{0.58,0,0.82} +\definecolor{backcolour}{rgb}{0.95,0.95,0.92} +\lstdefinestyle{examplestyle}{ + backgroundcolor=\color{backcolour}, + commentstyle=\color{codegreen}, + keywordstyle=\color{magenta}, + numberstyle=\tiny\color{codegray}, + stringstyle=\color{codepurple}, + basicstyle=\ttfamily\footnotesize, + breakatwhitespace=false, + breaklines=true, + captionpos=b, + keepspaces=true, + numbers=left, + numbersep=5pt, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=2 +} +% TODO: optional +\lstset{style=examplestyle} + +% 调整插图目录与表格目录的标题 +\cs_set:Npn \listfigurename {\c_@@_label_figure_tl} +\cs_set:Npn \listtablename {\c_@@_label_table_tl} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 根据 GB 3102.11--93 以及 ISO 80000-2:2009 的规定,数学表达式中 +% 表示变量的拉丁字母和希腊字母均应当使用斜体。 +\unimathsetup{ + math-style = ISO, + bold-style = ISO, +} + +% 预定义用户常用的证明环境 +\theoremstyle{plain} + \newtheorem{algorithm}{算法}[chapter] + \newtheorem{theorem}{定理}[chapter] + \newtheorem{lemma}[theorem]{引理} + \newtheorem{proposition}[theorem]{命题} + \newtheorem{corollary}[theorem]{推论} + \newtheorem{axiom}[theorem]{公理} +\theoremstyle{definition} + \newtheorem{definition}{定义}[chapter] + \newtheorem{conjecture}{猜想}[chapter] + \newtheorem{example}{例}[chapter] + \newtheorem{case}{情形} +\theoremstyle{remark} + \newtheorem{remark}{注} + \renewcommand{\qedsymbol}{\ensuremath{\QED}} + + +% user interface. +\DeclareDocumentCommand \BITSetup { m } + { \keys_set:nn { bithesis } { #1 }} + +\cs_new:Npn \@@_render_cover_entry:nn #1#2 { + \makebox[\l_@@_cover_label_max_width_dim][\l_@@_cover_label_align_tl]{ + \tl_if_blank:VTF #1 {} {#1\l_@@_cover_dilimiter_tl} + } + \hspace{1ex} + \@@_dunderline:nnn{\l_@@_cover_underline_offset_dim}{\l_@@_cover_underline_thickness_dim}{ + \makebox[\l_@@_cover_value_max_width_dim][\l_@@_cover_value_align_tl]{#2} + }\par +} + +% Get text with from #2, then set to #1. +\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 } + +% Get max text width from seq #2, then set to #1. +\cs_new:Npn \@@_get_max_text_width:NN #1#2 + { +% 这里用 |group| 确保局部变量不会被污染。 + \group_begin: + \seq_set_eq:NN \l_@@_tmpa_seq #2 + \dim_zero_new:N \l_@@_tmpa_dim + \bool_until_do:nn { \seq_if_empty_p:N \l_@@_tmpa_seq } + { + \seq_pop_left:NN \l_@@_tmpa_seq \l_@@_tmpa_tl + \@@_get_text_width:NV \l_@@_tmpa_dim \l_@@_tmpa_tl + \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } } + } + \group_end: + } + +% process label (#1) and value #2 separately +\cs_new:Npn \@@_parse_entry #1 #2 { + \seq_set_split:Nnx \l_@@_tmp_right_seq {//} {#2} + \seq_clear:N \l_@@_tmp_left_seq + \seq_map_inline:Nn \l_@@_tmp_right_seq { + \seq_put_right:Nn \l_@@_tmp_left_seq {} + } + \seq_put_left:Nn \l_@@_tmp_left_seq {#1} + \seq_pop_right:NN \l_@@_tmp_left_seq \g_@@_trashcan_tl +} + +\cs_new:Npn \@@_render_cover_entry:n #1 { + \seq_set_from_clist:NN \l_@@_input_seq #1 + % parse newline // + \seq_map_inline:Nn \l_@@_input_seq { + \@@_parse_entry ##1 + \seq_concat:NNN \l_@@_right_seq \l_@@_right_seq \l_@@_tmp_right_seq + \seq_concat:NNN \l_@@_left_seq \l_@@_left_seq \l_@@_tmp_left_seq + } + + \bool_if:NT \l_@@_cover_auto_width_bool { + \@@_get_max_text_width:NN \l_@@_cover_label_max_width_dim \l_@@_left_seq + \@@_get_max_text_width:NN \l_@@_cover_value_max_width_dim \l_@@_right_seq + } + + + \group_begin: + \bool_until_do:nn { \seq_if_empty_p:N \l_@@_left_seq } + { + \seq_pop_left:NN \l_@@_left_seq \l_@@_tmpa_tl + \seq_pop_left:NN \l_@@_right_seq \l_@@_tmpb_tl + \tl_if_empty:xTF \l_@@_tmpb_tl {} { + \@@_render_cover_entry:nn {\l_@@_tmpa_tl} {\l_@@_tmpb_tl} + } + } + \group_end: +} + +% #1: position +% #2: line_thickness +% #3: token list +\cs_new:Npn \@@_dunderline:nnn #1#2#3 { + {\setbox0=\hbox{#3}\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}} +} + +\cs_new:Npn \@@_dunderline:nn #1#2 { + \@@_dunderline:nnn {#1} {1pt} {#2} +} + +\cs_new:Npn \@@_dunderline:n #1 { + \@@_dunderline:nnn {-10pt} {1pt} {#1} +} + +\newcommand\dunderline[3][-1pt]{{% + \setbox0=\hbox{#3} + \ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}}} + +\NewEnviron{blindPeerReview}{ + \bool_if:NTF \g_@@_blind_mode_bool {} { + \BODY + } +} + +% 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示页眉页脚,见 +% \url{https://tex.stackexchange.com/a/1683}。 +\RenewDocumentCommand \cleardoublepage { } + { + \clearpage + \bool_if:NT \g_@@_twoside_bool + { + \int_if_odd:nF \c@page + { \hbox:n { } \thispagestyle { empty } \newpage } + } + } + +\cs_new:Npn \make_graduate_cover: { + \cleardoublepage + \begin{titlepage} + { + \heiti\zihao{5} + \tl_if_blank:VTF \l_@@_value_classified_level_tl {} { + \flushright + \c_@@_label_classified_level_tl:~ + \l_@@_value_classified_level_tl \par + } + } + \centering + \vspace*{65mm} + {\heiti\zihao{-2} \l_@@_value_title_tl} + \vskip 60mm + {\heiti \zihao{-3} \l_@@_value_author_tl} % 黑体 小三 + \vskip 10mm + {\heiti \zihao{-3} \l_@@_cover_date_tl} % 黑体 小三 + \end{titlepage} +} + +\cs_new:Npn \make_paper_back: { + \cleardoublepage + \begin{titlepage} + \vskip 5cm + \begin{center} + \setstretch{1.1} + \begin{minipage}[t][19.7cm]{2em} + \begin{center} + {\heiti\zihao{3}\l_@@_value_title_tl} + \vfill + {\heiti\zihao{3}\l_@@_value_author_tl} + \vfill + {\heiti\zihao{3}\c_@@_label_university_tl} + \end{center} + \end{minipage} + \end{center} + % \vskip 5cm + \end{titlepage} +} + +\cs_new:Npn \@@_make_chinese_title_page: { + \cleardoublepage + \begin{titlepage} + { % + {\heiti \zihao{5} \noindent \c_@@_label_classification_tl} \l_@@_value_classification_tl\\ + {\heiti \zihao{5} \c_@@_label_udc_tl} \l_@@_value_udc_tl + } + \begin{center} + + \vskip \stretch{1} + {\heiti\zihao{-2} \l_@@_value_title_tl} + \vskip \stretch{1} + + % TODO: delete this? + {\fangsong\zihao{4}} + \def\tabcolsep{1pt} + \def\arraystretch{1.5} + + { + \renewcommand{\baselinestretch}{2} + + \tl_if_empty:NT \l_@@_cover_dilimiter_tl { + \tl_set:Nn \l_@@_cover_dilimiter_tl {\qquad} + } + \tl_set:Nn \l_@@_cover_underline_offset_dim {-5pt} + % if not auto width, try override width + \bool_if:NF \l_@@_cover_auto_width_bool { + \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_label_max_width_dim {45mm} + } + \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_value_max_width_dim {60mm} + } + } + + \clist_set:Nn \l_@@_input_clist { + {\c_@@_graduate_label_author_tl} {\l_@@_value_author_tl}, + {\c_@@_graduate_label_school_tl} {\l_@@_value_school_tl}, + {\c_@@_graduate_label_supervisor_tl} {\l_@@_value_supervisor_tl}, + {\c_@@_graduate_label_chairman_tl} {\l_@@_value_chairman_tl}, + {\c_@@_graduate_label_degree_tl} {\l_@@_value_degree_tl}, + {\c_@@_graduate_label_major_tl} {\l_@@_value_major_tl}, + {\c_@@_graduate_label_institute_tl} {\l_@@_value_institute_tl}, + {\c_@@_graduate_label_defense_date_tl} {\l_@@_value_defense_date_tl}, + } + + \heiti\zihao{-3} + \@@_render_cover_entry:n \l_@@_input_clist + } + \end{center} + \vskip \stretch{0.5} + \end{titlepage} +} + +\cs_new:Npn \@@_make_english_title_page: { + \begin{titlepage} + \begin{center} + + \vspace*{10em} + {\zihao{-2}\textbf{\l_@@_value_title_en_tl}} + % \bfseries + \vskip \stretch{1} + + { + \tl_if_empty:NT \l_@@_cover_dilimiter_tl { + \tl_set:Nn \l_@@_cover_dilimiter_tl {:~} + } + + \tl_set:Nn \l_@@_cover_label_align_tl {l} + \tl_set:Nn \l_@@_cover_underline_offset_dim {-5pt} + + % if not auto width, try override width + \bool_if:NF \l_@@_cover_auto_width_bool { + \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_label_max_width_dim {55mm} + } + \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_value_max_width_dim {85mm} + } + } + + \clist_set:Nn \l_@@_input_clist { + {\c_@@_graduate_label_author_en_tl} {\l_@@_value_author_en_tl}, + {\c_@@_graduate_label_school_en_tl} {\l_@@_value_school_en_tl}, + {\c_@@_graduate_label_supervisor_en_tl} {\l_@@_value_supervisor_en_tl}, + {\c_@@_graduate_label_chairman_en_tl} {\l_@@_value_chairman_en_tl}, + {\c_@@_graduate_label_degree_en_tl} {\l_@@_value_degree_en_tl}, + {\c_@@_graduate_label_major_en_tl} {\l_@@_value_major_en_tl}, + {\c_@@_graduate_label_institute_en_tl} {\l_@@_value_institute_en_tl}, + {\c_@@_graduate_label_defense_date_en_tl} {\l_@@_value_defense_date_en_tl}, + } + + \zihao{-3} + \@@_render_cover_entry:n \l_@@_input_clist + } + + \end{center} + + \vskip \stretch{0.5} + \end{titlepage} +} + +\DeclareDocumentCommand \MakeCover {} + { + \begin{blindPeerReview} + \group_begin: + + \int_case:nn {\g_@@_thesis_type_int} + { + {1} + { + \begin{titlepage} + \vspace*{16mm} + + \centering + + \tl_if_blank:VTF \l_bit_coverheaderimage_tl {} { + \includegraphics[width=9.87cm]{\l_bit_coverheaderimage_tl}\\ + } + + \vspace*{-3mm} + + \zihao{-0}\textbf{\ziju{0.12}\songti{\c_@@_bachelor_label_title_tl}}\par + + \vspace{16mm} + + \zihao{2}\textbf{\xihei:n \l_@@_value_title_tl}\par + + \vspace{3mm} + + \begin{spacing}{1.2} + \zihao{3}\selectfont{\textbf{\l_@@_value_title_en_tl}}\par + \end{spacing} + + \vspace{15mm} + + + \begin{spacing}{1.8} + \begin{center} + \tl_if_empty:NT \l_@@_cover_dilimiter_tl { + \tl_set:Nn \l_@@_cover_dilimiter_tl {:} + } + % if not auto width, try override width + \bool_if:NF \l_@@_cover_auto_width_bool { + \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_label_max_width_dim {35mm} + } + \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_value_max_width_dim {78mm} + } + } + + \clist_set:Nn \l_@@_input_clist { + {\c_@@_label_school_tl} {\l_@@_value_school_tl}, + {\c_@@_label_major_tl} {\l_@@_value_major_tl}, + {\c_@@_label_author_tl} {\l_@@_value_author_tl}, + {\c_@@_label_student_id_tl} {\l_@@_value_student_id_tl}, + {\c_@@_label_supervisor_tl} {\l_@@_value_supervisor_tl}, + {\c_@@_label_co_supervisor_tl} {\l_@@_value_external_supervisor_tl}, + } + + \zihao{3} + + \@@_render_cover_entry:n \l_@@_input_clist + + \end{center} + \end{spacing} + + \vspace*{\fill} + \centering + \zihao{3}\ziju{0.5}\songti{ + \tl_if_empty:NTF \l_@@_cover_date_tl { + \today + } { + \l_@@_cover_date_tl + } + } + \end{titlepage} + } + {2} + { + \begin{titlepage} + \centering + + \tl_if_blank:VTF \l_bit_coverheaderimage_tl {} { + \includegraphics[width=6.87cm]{\l_bit_coverheaderimage_tl}\\ + } + + \vspace{1mm} + + \zihao{2}\textbf{\songti{本科生毕业设计(论文)外文翻译}} + + \vspace{8mm} + + { + + \begin{spacing}{1.8} + + \tl_set:Nn \l_@@_cover_dilimiter_tl {\textbf{:}} + \bool_set_false:N \l_@@_cover_auto_width_bool + \dim_set:Nn \l_@@_cover_label_max_width_dim {35mm} + \dim_set:Nn \l_@@_cover_value_max_width_dim {115mm} + + \clist_set:Nn \l_@@_input_clist { + {\zihao{4}\textbf{外文原文题目}} {\l_@@_value_trans_origin_title_tl}, + {\zihao{4}\textbf{中文翻译题目}} {\l_@@_value_trans_title_tl}, + } + + \zihao{-3} + \centering + + \@@_render_cover_entry:n \l_@@_input_clist + + \end{spacing} + + } + + \vspace{14mm} + + \zihao{2}\textbf{\xihei:n \l_@@_value_title_tl}\par + + \vspace{3mm} + + \begin{spacing}{1.2} + \zihao{3}\selectfont{\textbf{\l_@@_value_title_en_tl}}\par + \end{spacing} + + \vspace{19mm} + + \begin{spacing}{1.8} + \tl_if_empty:NT \l_@@_cover_dilimiter_tl { + \tl_set:Nn \l_@@_cover_dilimiter_tl {:} + } + + % if not auto width, try override width + \bool_if:NF \l_@@_cover_auto_width_bool { + \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_label_max_width_dim {35mm} + } + \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_value_max_width_dim {78mm} + } + } + + \zihao{3} + + \clist_set:Nn \l_@@_input_clist { + {\c_@@_label_school_tl} {\l_@@_value_school_tl}, + {\c_@@_label_major_tl} {\l_@@_value_major_tl}, + {\c_@@_label_author_tl} {\l_@@_value_author_tl}, + {\c_@@_label_student_id_tl} {\l_@@_value_student_id_tl}, + {\c_@@_label_supervisor_tl} {\l_@@_value_supervisor_tl}, + {\c_@@_label_co_supervisor_tl} {\l_@@_value_external_supervisor_tl}, + } + + \@@_render_cover_entry:n \l_@@_input_clist + + \end{spacing} + + \vspace*{\fill} + \end{titlepage} + } + {3} { + \begin{titlepage} + \vspace*{16mm} + + \centering + + \tl_if_blank:VTF \l_bit_coverheaderimage_tl {} { + \includegraphics[width=9.87cm]{\l_bit_coverheaderimage_tl}\\ + } + + \vspace*{-3mm} + + \zihao{1}\textbf{\ziju{0.12}Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis}\par + + \vspace{18mm} + + \zihao{2}\textbf{\xihei:n \l_@@_value_title_en_tl}\par + + \vspace{10mm} + + + \begin{spacing}{1.8} + \begin{center} + \tl_if_empty:NT \l_@@_cover_dilimiter_tl { + \tl_set:Nn \l_@@_cover_dilimiter_tl {:} + } + + % if not auto width, try override width + \bool_if:NF \l_@@_cover_auto_width_bool { + \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_label_max_width_dim {20mm} + } + \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l_@@_cover_value_max_width_dim {105mm} + } + } + + \zihao{4} + + \clist_set:Nn \l_@@_input_clist { + {\c_@@_label_school_en_tl} {\l_@@_value_school_tl}, + {\c_@@_label_major_en_tl} {\l_@@_value_major_tl}, + {\c_@@_label_author_en_tl} {\l_@@_value_author_tl}, + {\c_@@_label_student_id_en_tl} {\l_@@_value_student_id_tl}, + {\c_@@_label_supervisor_en_tl} {\l_@@_value_supervisor_tl}, + {\c_@@_label_co_supervisor_en_tl} {\l_@@_value_external_supervisor_tl}, + } + + \@@_render_cover_entry:n \l_@@_input_clist + + \end{center} + \end{spacing} + + \vspace*{\fill} + \centering + \zihao{3}\ziju{0.5}\songti{ + \tl_if_empty:NTF \l_@@_cover_date_tl { + \today + } { + \l_@@_cover_date_tl + } + } + \end{titlepage} + } + {4} { + \make_graduate_cover: + } + {5} { + \make_graduate_cover: + } + } + \group_end: + \end{blindPeerReview} + } + +% 圆形数字编号定义 +\newcommand{\circled}[2][]{\tikz[baseline=(char.base)] + {\node[shape = circle, draw, inner~sep = 1pt] + (char) {\phantom{\ifblank{#1}{#2}{#1}}}; + \node at (char.center) {\makebox[0pt][c]{#2}};}} +\robustify{\circled} + +\cs_new:Npn \@@_graduate_originality: { + \ctexset { + chapter / pagestyle = plain, + } + + \begin{titlepage} + \pagenumbering{gobble} + + % 原创性声明部分 + \begin{center} + \@@_same_page: + \chapter*{\heiti\zihao{3}\c_@@_graduate_label_originality_tl} + \end{center}~\par + + % 本部分字号为小三 + \zihao{4} + \c_@@_graduate_label_originality_clause_tl + + \vspace{17mm} + + \begin{flushright} + \c_@@_graduate_label_originality_author_signature_tl\par + \end{flushright} + + \vspace{16mm} + + % 使用授权声明部分 + \begin{center} + \@@_same_page: + \chapter*{\heiti\zihao{3}\c_@@_graduate_label_authorization_tl} + \end{center}~\par + + \c_@@_graduate_label_authorization_clause_tl + + \vspace*{15mm} + + \begin{flushright} + \begin{spacing}{1.65} + \zihao{4} + % \hspace{5mm}\raisebox{-2ex}{\includegraphics[width=30mm]{example-image}}\hspace{5mm} + \c_@@_graduate_label_originality_author_signature_tl\par + \c_@@_graduate_label_originality_supervisor_signature_tl\par + \end{spacing} + \end{flushright} + \end{titlepage} + \cleardoublepage +} + +\NewDocumentCommand \MakeOriginality {} +{ + \group_begin: + \begin{blindPeerReview} + \int_case:nn {\g_@@_thesis_type_int} + { + {1} + { + \pagestyle{BIThesis} + \pagenumbering{gobble} + + % 原创性声明部分 + \begin{center} + \vspace*{-2bp} + \@@_same_page: + \chapter*{\heiti\zihao{2}\c_@@_bachelor_label_originality_tl} + \end{center}~\par + + % 本部分字号为小三 + \zihao{-3} + \c_@@_bachelor_label_originality_clause_tl + + \vspace{17mm} + + \begin{flushright} + \c_@@_bachelor_label_originality_author_signature_tl\par + \end{flushright} + + \vspace{16mm} + + % 使用授权声明部分 + \begin{center} + \@@_same_page: + \chapter*{\heiti\zihao{2}\c_@@_bachelor_label_authorization_tl} + \end{center}~\par + + \c_@@_bachelor_label_authorization_clause_tl + + \vspace*{3mm} + + \begin{flushright} + \begin{spacing}{1.65} + \zihao{-3} + % \hspace{5mm}\raisebox{-2ex}{\includegraphics[width=30mm]{example-image}}\hspace{5mm} + \c_@@_bachelor_label_originality_author_signature_tl\par + \c_@@_bachelor_label_originality_supervisor_signature_tl\par + \end{spacing} + \end{flushright} + + \newpage + } + {3} { + \setstretch{1.26} + % 原创性声明部分 + \begin{center} + \vspace*{-2bp} + \@@_same_page: + \chapter*{\heiti\zihao{-2}\c_@@_bachelor_english_label_originality_tl} + \end{center}~\par + + % 本部分字号为小三 + \zihao{-4} + \c_@@_bachelor_english_label_originality_clause_tl + + \bigbreak + + Student~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm]{}}~Date:\par + + \vspace{6mm} + + % 使用授权声明部分 + \begin{center} + \@@_same_page: + \chapter*{\heiti\zihao{-2}\c_@@_bachelor_english_label_authorization_tl} + \end{center}~\par + + \c_@@_bachelor_english_label_authorization_clause_tl + + \bigbreak + Student~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm + 16bp]{}}~\hspace{2mm}Date:\par + Supervisor~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm]{}}~\hspace{2mm}Date:\par + } + {4} {\@@_graduate_originality:} + {5} {\@@_graduate_originality:} + } + \end{blindPeerReview} + \group_end: +} + +\NewDocumentCommand \MakePaperBack {} + { + \begin{blindPeerReview} + \make_paper_back: + \end{blindPeerReview} + } + +\NewDocumentCommand \MakeTitle {} + { + \begin{blindPeerReview} + \@@_make_chinese_title_page: + \@@_make_english_title_page: + \end{blindPeerReview} + } + +\DeclareDocumentCommand \MakeTOC {} + { + { + \@@_if_bachelor_thesis:TF { + \renewcommand{\baselinestretch}{1.35} + } { + \renewcommand{\baselinestretch}{1.56} + } + + \@@_if_thesis_english:TF { + \tl_set:Nn \l_@@_toc_title_tl {\c_@@_label_toc_en_tl} + } { + \tl_set:Nn \l_@@_toc_title_tl {\c_@@_label_toc_tl} + } + + % 自定义目录样式 + \cs_set:Npn \contentsname { + \fontsize{16pt}{\baselineskip} + \l_@@_unnumchapter_style_cs:n\l_@@_title_font_cs:n{\l_@@_toc_title_tl} + \vspace{-8pt} + } + + % 制作目录 + \tableofcontents + + % 在本科生全英文模板中,添加「目录」本身到目录中。 + \@@_if_thesis_int_type:nT {3} { + \addcontentsline{toc}{chapter}{\c_@@_label_toc_en_tl} + } + } + } + + % TODO: + \NewDocumentEnvironment {abstract} {} + { + + \cleardoublepage + \setstretch{1.53} + + \@@_if_bachelor_thesis:T { + \begin{center} + \vspace*{-17bp} + \heiti\zihao{-2}\textbf{ + \int_case:nn {\g_@@_thesis_type_int} + { + {1} {\l_@@_value_title_tl} + {2} {\l_@@_value_trans_title_tl} + {3} {\l_@@_value_title_tl} + } + } + \end{center} + + \vspace*{2mm} + } + + \ctexset{ + chapter/numbering = false, + } + + \@@_if_bachelor_thesis:T { + \ctexset{ + chapter/titleformat = {\textmd} + } + } + + { + \@@_same_page: + \bool_if:NTF \l_@@_add_abstract_to_toc_bool { + \chapter{\c_@@_label_abstract_tl} + } { + \chapter*{\c_@@_label_abstract_tl} + } + } + \vspace*{1mm} + \par + } + { + \par + \vspace{4ex}\noindent\textbf{\heiti \c_@@_label_keywords_tl \l_@@_value_keywords_tl}\par + \newpage + } + + \NewDocumentEnvironment {abstractEn} {} + { + \cleardoublepage + \setstretch{1.53} + + \@@_if_bachelor_thesis:T { + \begin{spacing}{0.95} + \centering + \vspace*{-2bp} + + \@@_if_thesis_int_type:nTF {3} { + \arialfamily\zihao{-2}\textbf\l_@@_value_title_en_tl\\ + } { + \heiti\zihao{3}\textbf\l_@@_value_title_en_tl\\ + } + \end{spacing} + \vspace*{10mm} + } + + \ctexset{ + chapter/numbering = false, + } + + \@@_if_bachelor_thesis:TF { + \int_compare:nNnTF {\g_@@_thesis_type_int} = {3} + { + \ctexset{ + chapter = { + titleformat = {\heiti\zihao{3}\centering\textbf}, + } + } + } { + \ctexset{ + chapter = { + titleformat = {\heiti\zihao{-3}\centering\textmd}, + } + } + } + } { + \ctexset { + chapter/titleformat = {\heiti\zihao{3}\centering\textbf} + } + } + + { + \@@_same_page: + \bool_if:nTF {\l_@@_add_abstract_en_to_toc_bool} { + \chapter{\c_@@_label_abstract_en_tl} + } { + \chapter*{\c_@@_label_abstract_en_tl} + } + } + } + { + \par\vspace{3ex}\noindent\textbf{\c_@@_label_keywords_en_tl \l_@@_value_keywords_en_tl} + \newpage + } + +% after \backmatter + \NewDocumentEnvironment {conclusion} {} + { + \ctexset{ + section/number = \arabic{section} + } + + \@@_if_thesis_english:TF { + \chapter{\c_@@_label_conclusion_en_tl} + } { + \chapter{\c_@@_label_conclusion_tl} + } + } + {} + +% after backmatter + \NewDocumentEnvironment {bibprint} {} + { + % 设置参考文献字号为 5 号 + \renewcommand*{\bibfont}{\zihao{5}} + % 设置参考文献各个项目之间的垂直距离为 0 + \setlength{\bibitemsep}{0ex} + \setlength{\bibnamesep}{0ex} + \setlength{\bibinitsep}{0ex} + \@@_if_graduate:TF { + } { + % 「本科生」设置单倍行距 + \renewcommand{\baselinestretch}{1.2} + } + % 设置参考文献顺序标签 `[1]` 与文献内容 `作者. 文献标题...` 的间距 + \setlength{\biblabelsep}{1.7mm} + % 设置参考文献后文缩进为 0(与 Word 模板保持一致) + % See: https://github.com/hushidong/biblatex-gb7714-2015 + % 如何修参考文献表的缩进? + \cs_set:Npn \itemcmd { + \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} + %%这里是所做的调整,以下两句通过调整\lengthid来调整缩进 + \setlength{\lengthid}{0pt} + \addtolength{\lengthid}{-\biblabelsep} + \setlength{\lengthlw}{\textwidth} + \addtolength{\lengthlw}{-\lengthid} + \addvspace{\bibitemsep}%恢复\bibitemsep的作用 + \hangindent\lengthid + \leavevmode\mkgbnumlabel{\printfield{labelnumber}}% + \hspace{\biblabelsep} + } + \@@_if_thesis_english:TF { + \chapter{\c_@@_label_reference_en_tl} + } { + \chapter{\c_@@_label_reference_tl} + } + } + {} + + % #1: The name that used as chapter title + % #2: The name that used in ToC. + \NewDocumentEnvironment {appendices} {} + { + % Used in chapter, ToC. + \tl_new:N \l_@@_appendix_plain_label_tl + % Used before reference label. + \tl_new:N \l_@@_appendix_default_title_tl + + \@@_if_thesis_english:TF { + \tl_set:Nn \l_@@_appendix_plain_label_tl {\c_@@_label_appendix_prefix_en_tl} + \tl_set:Nn \l_@@_appendix_default_title_tl {\c_@@_label_appendix_en_tl} + } { + \tl_set:Nn \l_@@_appendix_plain_label_tl {\c_@@_label_appendix_prefix_tl} + \tl_set:Nn \l_@@_appendix_default_title_tl {\c_@@_label_appendix_tl} + } + + \bool_if:NTF \l_@@_appendices_chapter_level_bool { + \setcounter{chapter}{0} + \ctexset{ + chapter/numbering = true, + chapter/name = {}, + chapter/number = \l_@@_appendix_plain_label_tl\hspace{1ex}\Alph{chapter}, + section/number = \Alph{chapter}. \arabic{section}, + subsection/number = \Alph{chapter}. \arabic{section}. \arabic{subsection}, + } + + \cs_set:Npn \thechapter { + \Alph{chapter} + } + } { + \ctexset{ + section/number = \l_@@_appendix_plain_label_tl\hspace{1ex}\Alph{section}, + subsection/number = \Alph{section}. \arabic{subsection}, + } + + \cs_set:Npn \thechapter { + \Alph{section} + } + + \tl_if_blank:VTF \l_@@_appendices_title_tl { + \chapter{\l_@@_appendix_default_title_tl} + } { + \chapter*{\l_@@_appendices_title_tl} + \stepcounter{chapter} + \tl_if_blank:VTF \l_@@_appendix_toc_title_tl { + \addcontentsline{toc}{chapter}{\l_@@_appendix_default_title_tl} + } { + \addcontentsline{toc}{chapter}{\l_@@_appendix_toc_title_tl} + } + } + } + } + { + } + + \NewDocumentEnvironment {acknowledgements} {+b} + { + \begin{blindPeerReview} + \ctexset{ + section/number = \arabic{section}, + subsection/number = \arabic{section}. \arabic{subsection}, + } + + \@@_if_thesis_english:TF { + \chapter{\c_@@_label_ack_en_tl} + } { + \chapter{\c_@@_label_ack_tl} + } + #1 + \end{blindPeerReview} + } {} + + \NewDocumentEnvironment {publications} {+b} + { + \begin{blindPeerReview} + % 设置参考文献字号为 5 号 + \renewcommand*{\bibfont}{\zihao{5}} + % 设置参考文献各个项目之间的垂直距离为 0 + \setlength{\bibitemsep}{0ex} + \setlength{\bibnamesep}{0ex} + \setlength{\bibinitsep}{0ex} + % 设置单倍行距 + \renewcommand{\baselinestretch}{1.2} + % 设置参考文献顺序标签 `[1]` 与文献内容 `作者. 文献标题...` 的间距 + \setlength{\biblabelsep}{1.7mm} + % 设置参考文献后文缩进为 0(与 Word 模板保持一致) + % See: https://github.com/hushidong/biblatex-gb7714-2015 + % 如何修参考文献表的缩进? + \cs_set:Npn \itemcmd { + \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} + %%这里是所做的调整,以下两句通过调整\lengthid来调整缩进 + \setlength{\lengthid}{0pt} + \addtolength{\lengthid}{-\biblabelsep} + \setlength{\lengthlw}{\textwidth} + \addtolength{\lengthlw}{-\lengthid} + \addvspace{\bibitemsep}%恢复\bibitemsep的作用 + \hangindent\lengthid + \leavevmode\mkgbnumlabel{\printfield{labelnumber}}% + \hspace{\biblabelsep} + } + + % ===== 上方定义与「参考文献」部分相同 + \cs_set:Npn \mkbibnamegiven ##1 { + \ifitemannotation{myself}{\textbf{##1}}{##1} + } + + \cs_set:Npn \mkbibnamefamily ##1 { + \ifitemannotation{myself}{\textbf{##1}}{##1} + } + + % Sorting by year, name, type. + \newrefcontext[sorting=ynt] + \chapter{\c_@@_label_publications_tl} + #1 + \end{blindPeerReview} + } + {} + + \NewDocumentEnvironment {resume} {+b} + { + \begin{blindPeerReview} + \chapter{\c_@@_label_resume_tl} + #1 + \end{blindPeerReview} + } + { + } + + \NewDocumentEnvironment {symbols} {} + { + \bool_if:NTF \l_@@_add_symbols_to_toc_bool { + \chapter{\c_@@_label_symbols_tl} + } { + \chapter*{\c_@@_label_symbols_tl} + } + \zihao{-4} + \begin{itemize}[labelwidth=2.5cm,labelsep=0.5cm,leftmargin=3cm,itemindent=0cm,itemsep=0cm] + \cs_set:Npn \makelabel ##1 {##1\hfil} + } + { + \end{itemize} + } +% \end{macrocode} % \begin{macrocode} -%</package> +%</thesis> +% \end{macrocode} + +% \begin{macrocode} +%<*report> +% \end{macrocode} +% +% \begin{macrocode} +% Define global +\int_new:N \g_@@_report_type_int + +% Define Consts. +\clist_const:Nn \c_@@_report_type_clist + { common, undergraduate_proposal} + +% Define tmp Variables +\seq_new:N \l_@@_right_seq +\seq_new:N \l_@@_left_seq + +\PassOptionsToPackage{AutoFakeBold,AutoFakeSlant}{xeCJK} + +\keys_define:nn { bitreport } + { + option .meta:nn = {bitreport / option } {#1}, + cover .meta:nn = { bitreport / cover } {#1}, + info .meta:nn = { bitreport / info } {#1}, + misc .meta:nn = { bitreport / misc } {#1} + } + +\keys_define:nn { bitreport / option } + { + type .choice:, + type .value_required:n = true, + type .choices:Vn = + \c_@@_report_type_clist + { + \int_set_eq:NN \g_@@_report_type_int \l_keys_choice_int + }, + type .initial:n = common, + ctex .tl_set:N = \l_@@_options_to_ctex_tl, + } + + +% Pass every option not explicitly defined to `ctexbeamer`. +\DeclareOption*{ + \PassOptionsToClass{\l_@@_options_to_ctex_tl}{ctexart} +} +% Executes the code for each option. +\ProcessOptions\relax +% Load +\LoadClass[zihao=-4]{ctexart} + +\RequirePackage[a4paper,left=3cm,right=2.4cm,top=2.6cm,bottom=2.38cm,includeheadfoot]{geometry} +\RequirePackage{fancyhdr} +\RequirePackage{setspace} +\RequirePackage{caption} +\RequirePackage{booktabs} +\RequirePackage{pdfpages} + + +\keys_define:nn { bitreport / cover } + { + imagePath .tl_set:N = \l_bit_coverimagepath_tl, + date .tl_set:N = \l_@@_cover_date_tl, + %% cover entry + dilimiter .tl_set:N = \l_@@_cover_dilimiter_tl, + labelAlign .tl_set:N = \l_@@_cover_label_align_tl, + labelAlign .initial:n = {r}, + valueAlign .tl_set:N = \l_@@_cover_value_align_tl, + valueAlign .initial:n = {c}, + labelMaxWidth .dim_set:N = \l_@@_cover_label_max_width_dim, + valueMaxWidth .dim_set:N = \l_@@_cover_value_max_width_dim, + autoWidth .bool_set:N = \l_@@_cover_auto_width_bool, + autoWidth .initial:n = {true}, + underlineThickness .dim_set:N = \l_@@_cover_underline_thickness_dim, + underlineThickness .initial:n = {1pt}, + underlineOffset .dim_set:N = \l_@@_cover_underline_offset_dim, + underlineOffset .initial:n = { -10pt }, + } + +\keys_define:nn { bitreport / info } + { + title .tl_set:N = \l_@@_value_title_tl, + school .tl_set:N = \l_@@_value_school_tl, + major .tl_set:N = \l_@@_value_major_tl, + class .tl_set:N = \l_@@_value_class_tl, + author .tl_set:N = \l_@@_value_author_tl, + supervisor .tl_set:N = \l_@@_value_supervisor_tl, + externalSupervisor .tl_set:N = \l_@@_value_external_supervisor_tl, + studentId .tl_set:N = \l_@@_value_student_id_tl, + } + +\keys_define:nn { bitreport / misc } + { + reviewTable .tl_set:N = \l_bit_reviewtable_tl, + } + +\ProcessKeysOptions { bitreport / option } + +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx} + +% #1: position +% #2: line_thickness +% #3: token list +\cs_new:Npn \@@_dunderline:nnn #1#2#3 { + {\setbox0=\hbox{#3}\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}} +} + +\cs_new:Npn \@@_render_cover_entry:nn #1#2 { + \makebox[\l_@@_cover_label_max_width_dim][\l_@@_cover_label_align_tl]{ + \tl_if_blank:VTF #1 {} {#1\l_@@_cover_dilimiter_tl} + } + \hspace{1ex} + \@@_dunderline:nnn{\l_@@_cover_underline_offset_dim}{\l_@@_cover_underline_thickness_dim}{ + \makebox[\l_@@_cover_value_max_width_dim][\l_@@_cover_value_align_tl]{#2} + }\par +} + +% Get text with from #2, then set to #1. +\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 } + +% Get max text width from seq #2, then set to #1. +\cs_new:Npn \@@_get_max_text_width:NN #1#2 + { +% 这里用 |group| 确保局部变量不会被污染。 + \group_begin: + \seq_set_eq:NN \l_@@_tmpa_seq #2 + \dim_zero_new:N \l_@@_tmpa_dim + \bool_until_do:nn { \seq_if_empty_p:N \l_@@_tmpa_seq } + { + \seq_pop_left:NN \l_@@_tmpa_seq \l_@@_tmpa_tl + \@@_get_text_width:NV \l_@@_tmpa_dim \l_@@_tmpa_tl + \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } } + } + \group_end: + } + +% process label (#1) and value #2 separately +\cs_new:Npn \@@_parse_entry #1 #2 { + \seq_set_split:Nnx \l_@@_tmp_right_seq {//} {#2} + \seq_clear:N \l_@@_tmp_left_seq + \seq_map_inline:Nn \l_@@_tmp_right_seq { + \seq_put_right:Nn \l_@@_tmp_left_seq {} + } + \seq_put_left:Nn \l_@@_tmp_left_seq {#1} + \seq_pop_right:NN \l_@@_tmp_left_seq \g_@@_trashcan_tl +} + +\cs_new:Npn \@@_render_cover_entry:n #1 { + \seq_set_from_clist:NN \l_@@_input_seq #1 + % parse newline // + \seq_map_inline:Nn \l_@@_input_seq { + \@@_parse_entry ##1 + \seq_concat:NNN \l_@@_right_seq \l_@@_right_seq \l_@@_tmp_right_seq + \seq_concat:NNN \l_@@_left_seq \l_@@_left_seq \l_@@_tmp_left_seq + } + + \bool_if:NT \l_@@_cover_auto_width_bool { + \@@_get_max_text_width:NN \l_@@_cover_label_max_width_dim \l_@@_left_seq + \@@_get_max_text_width:NN \l_@@_cover_value_max_width_dim \l_@@_right_seq + } + + + \group_begin: + \bool_until_do:nn { \seq_if_empty_p:N \l_@@_left_seq } + { + \seq_pop_left:NN \l_@@_left_seq \l_@@_tmpa_tl + \seq_pop_left:NN \l_@@_right_seq \l_@@_tmpb_tl + \tl_if_empty:xTF \l_@@_tmpb_tl {} { + \@@_render_cover_entry:nn {\l_@@_tmpa_tl} {\l_@@_tmpb_tl} + } + } + \group_end: +} + +\DeclareDocumentCommand \BITSetup { m } + { \keys_set:nn { bitreport } { #1 }} +\DeclareDocumentCommand \MakeCover {} + { + \group_begin: + \int_case:nn {\g_@@_report_type_int} { + {1} { + \begin{titlepage} + \centering + \vspace{23mm} + \tl_if_empty:NF \l_bit_coverimagepath_tl { + \includegraphics[width=.5\textwidth]{\l_bit_coverimagepath_tl}\\ + } + \vspace{10mm} + \heiti\fontsize{24pt}{24pt}\selectfont{\l_@@_value_title_tl}\\ + \vspace{67mm} + \begin{spacing}{2.2} + \songti\zihao{3} + \clist_set:Nn \l_@@_input_clist { + {\textbf{学\qquad 院:}} {\l_@@_value_school_tl}, + {\textbf{专\qquad 业:}} {\l_@@_value_major_tl}, + {\textbf{班\qquad 级:}} {\l_@@_value_class_tl}, + {\textbf{学\qquad 号:}} {\l_@@_value_student_id_tl}, + {\textbf{姓\qquad 名:}} {\l_@@_value_author_tl}, + {\textbf{任课教师:}} {\l_@@_value_supervisor_tl}, + } + + \@@_render_cover_entry:n \l_@@_input_clist + + \end{spacing} + \vspace*{\fill} + \centering + \songti\fontsize{12pt}{12pt}\selectfont{ + \tl_if_empty:NTF \l_@@_cover_date_tl { + \today + } { + \l_@@_cover_date_tl + } + } + \end{titlepage} + } + {2} { + % Main code for \MakeCover + \begin{titlepage} + \topskip=0pt + \vspace*{-16mm} + \centering + \hspace{-6mm}\songti\fontsize{22pt}{22pt}\selectfont{北京理工大学}\par + + \vspace{13mm} + + \hspace{-6mm}\heiti\fontsize{24pt}{24pt}\selectfont{本科生毕业设计(论文)开题报告}\par + + \vspace{53mm} + + \begin{spacing}{2.2} + \songti\zihao{3} + \clist_set:Nn \l_@@_input_clist { + {\textbf{学\qquad 院:}} {\l_@@_value_school_tl}, + {\textbf{专\qquad 业:}} {\l_@@_value_major_tl}, + {\textbf{班\qquad 级:}} {\l_@@_value_class_tl}, + {\textbf{姓\qquad 名:}} {\l_@@_value_author_tl}, + {\textbf{指导教师:}} {\l_@@_value_supervisor_tl}, + {\textbf{校外指导教师:}} {\l_@@_value_external_supervisor_tl}, + } + + \@@_render_cover_entry:n \l_@@_input_clist + + \end{spacing} + + \vspace*{\fill} + + \centering + \hspace{-6mm}\songti\fontsize{12pt}{12pt}\selectfont{\today} + \end{titlepage} + } + } + \group_end: + } + +\DeclareDocumentCommand \MakeReviewTable {} + { + \group_begin: + \begin{titlepage} + \includepdf[pages=-]{\l_bit_reviewtable_tl} + \end{titlepage} + \group_end: + } + +% 定义 caption 字体为楷体 +\DeclareCaptionFont{kaiticaption}{\kaishu \normalsize} + +% 设置图片的 caption 格式 +\renewcommand{\thefigure}{\thesection-\arabic{figure}} +\captionsetup[figure]{font=small,labelsep=space,skip=10bp,labelfont=bf,font=kaiticaption} + +% 设置表格的 caption 格式 +\renewcommand{\thetable}{\thesection-\arabic{table}} +\captionsetup[table]{font=small,labelsep=space,skip=10bp,labelfont=bf,font=kaiticaption} + +% 输出大写数字日期 +\ctexset{today=big} + +% 将西文字体设置为 Times New Roman +\setromanfont{Times~New~Roman} + +%% 将中文楷体设置为 SIMKAI.TTF(如果需要) +% \setCJKfamilyfont{zhkai}{[SIMKAI.TTF]} +% \newcommand*{\kaiti}{\CJKfamily{zhkai}} + +% 设置文档标题深度 +\setcounter{tocdepth}{3} +\setcounter{secnumdepth}{3} + +%% +% 设置一级标题、二级标题格式 +% 一级标题:小三,宋体,加粗,段前段后各半行 +\ctexset{section={ + format={\raggedright \bfseries \songti \zihao{-3}}, + beforeskip = 24bp plus 1ex minus .2ex, + afterskip = 24bp plus .2ex, + fixskip = true, + name = {,.\quad} + } +} +% 二级标题:小四,宋体,加粗,段前段后各半行 +\ctexset{subsection={ + format = {\bfseries \songti \raggedright \zihao{4}}, + beforeskip = 24bp plus 1ex minus .2ex, + afterskip = 24bp plus .2ex, + fixskip = true, + } +} +% 页眉和页脚(页码)的格式设定 +\fancyhf{} +\int_case:nn {\g_@@_report_type_int} { + {1} {\fancyhead[R]{\fontsize{10.5pt}{10.5pt}\selectfont{\l_@@_value_title_tl}}} + {2} {\fancyhead[R]{\fontsize{10.5pt}{10.5pt}\selectfont{北京理工大学本科生毕业设计(论文)开题报告}}} +} +\fancyfoot[R]{\fontsize{9pt}{9pt}\selectfont{\thepage}} +\renewcommand{\headrulewidth}{1pt} +\renewcommand{\footrulewidth}{0pt} + +% 正文开始 +\pagestyle{fancy} +\setcounter{page}{1} + +% 正文 22 磅的行距,段前段后间距为 0 +% \setlength{\parskip}{0em} +\cs_set:Npn \baselinestretch {1.53} +% 正文首行悬挂 1.02cm +% \setlength{\parindent}{1.02cm} +% \end{macrocode} +% +% \begin{macrocode} +%</report> +% \end{macrocode} +% \begin{macrocode} +%<*beamer> +% \end{macrocode} +% +% \begin{macrocode} +% Define our keyvalues +\keys_define:nn { bitbeamer } + { + titlegraphic .tl_set:N = \l_bit_titlegraphic_tl, + framelogo .tl_set:N = \l_bit_framelogo_tl, + } +\ProcessKeysOptions { bitbeamer } + +% Pass every option not explicitly defined to `ctexbeamer`. +\DeclareOption*{ + \PassOptionsToClass{\CurrentOption}{ctexbeamer} +} +% Executes the code for each option. +\ProcessOptions\relax + +% Load +\LoadClass{ctexbeamer} + +\RequirePackage{xeCJKfntef} +\RequirePackage{tikz} + +\usetheme{Madrid} +% 设置主题色 +\colorlet{beamer@blendedblue}{green!40!black} + +\cs_new:Npn \CJKhl:nn #1 #2 + { \CJKsout*[thickness=2.5ex, format=\color{#1}]{#2} } + +% Set header if logo path is provided. +\tl_if_empty:NF \l_bit_titlegraphic_tl { + % BIT Logo + \titlegraphic{ + \includegraphics[width=2cm]{\l_bit_titlegraphic_tl} + } +} + +% Set title logo if logo path is provided. +\tl_if_empty:NF \l_bit_framelogo_tl { + \addtobeamertemplate{frametitle}{}{% + \begin{tikzpicture}[remember~picture,overlay] + \node[anchor=north~east,yshift=2pt] at (current~page.north~east) {\includegraphics[height=0.8cm]{\tl_use:N \l_bit_framelogo_tl}}; + \end{tikzpicture} + } +} + +% Expose command to user. +\cs_new_eq:NN \CJKhl \CJKhl:nn +% \end{macrocode} +% \begin{macrocode} +%</beamer> % \end{macrocode} % \begin{macrocode} @@ -239,7 +3331,7 @@ \PassOptionsToPackage{AutoFakeBold,AutoFakeSlant}{xeCJK} \LoadClass[UTF8,zihao=-4,oneside,openany]{ctexbook} -\RequirePackage[a4paper,left=3cm,right=2.6cm,top=3.5cm,bottom=2.9cm]{geometry} +% \RequirePackage[a4paper,left=3cm,right=2.6cm,top=3.5cm,bottom=2.9cm]{geometry} % 目前 29mm 最接近 Word 排版 \RequirePackage{xeCJK} \RequirePackage{titletoc} @@ -502,7 +3594,7 @@ % 设置参考文献编译后端为 biber,引用格式为 GB/T7714-2015 格式 % 参考文献使用宏包见 https://github.com/hushidong/biblatex-gb7714-2015 -\usepackage[style=gb7714-2015,backend=biber]{biblatex} +\RequirePackage[style=gb7714-2015,backend=biber]{biblatex} \if@bit@labreport % 将西文字体设置为 Times New Roman @@ -549,7 +3641,7 @@ \captionsetup[table]{font=small,labelsep=space,skip=10bp,labelfont=bf,font=kaiticaption} % 输出大写数字日期 - \CTEXoptions[today=big] + \ctexset{today=big} % 将西文字体设置为 Times New Roman \setromanfont{Times New Roman} @@ -1015,8 +4107,7 @@ footskip=0.7cm% 页脚 1.8cm % showspaces=false, % flexiblecolumns=true, % breaklines=true, % 对过长的代码自动换行 - breakautoindent=true,% - breakindent=4em, % + postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space}, aboveskip=1em, % 代码块边框 %% added by http://bbs.ctex.org/viewthread.php?tid=53451 fontadjust, @@ -1491,17 +4582,16 @@ footskip=0.7cm% 页脚 1.8cm % \ProvidesPackage{dtx-style} \RequirePackage{hypdoc} \RequirePackage{ifthen} -\RequirePackage{fontspec}[2017/01/20] +\RequirePackage{fontspec} \RequirePackage{amsmath} \RequirePackage{unicode-math} -\RequirePackage[UTF8,scheme=chinese,heading]{ctex} +\RequirePackage[UTF8,scheme=chinese,heading,sub3section]{ctex} \RequirePackage[ top=2.5cm, bottom=2.5cm, - left=4cm, right=2cm, + left=5cm, right=2cm, headsep=3mm]{geometry} \RequirePackage{graphicx} \RequirePackage{multirow} -\RequirePackage[ruled,vlined]{algorithm2e} \RequirePackage{wrapfig} \RequirePackage{hologo} \RequirePackage{array,longtable,booktabs} @@ -1509,7 +4599,7 @@ footskip=0.7cm% 页脚 1.8cm % \RequirePackage{fancyhdr} \RequirePackage[dvipsnames]{xcolor} \RequirePackage{awesomebox} -\RequirePackage{etoolbox} +% \RequirePackage{etoolbox} \RequirePackage{dirtree} \RequirePackage{metalogo} \RequirePackage[tightLists=false]{markdown} @@ -1518,12 +4608,10 @@ footskip=0.7cm% 页脚 1.8cm % \usetikzlibrary{positioning} \RequirePackage{framed} \RequirePackage{menukeys} +\RequirePackage{float} +\RequirePackage{subfig} - % 设置代码高亮 -\RequirePackage{minted} -\usemintedstyle{tango} - - % 设置列表无间隔 + % 设置列表无间隔 \usepackage{enumitem} \setlist{nosep} @@ -1546,12 +4634,48 @@ footskip=0.7cm% 页脚 1.8cm % \newcommand{\BIThesisMacroPackage}{{\BIThesis}宏集} \newcommand{\BIThesisWiki}{{\BIThesis}在线文档} \newcommand{\BIThesisScaffold}{{\BIThesis}模板} +\newcommand{\BIThesisRelease}{{\BIThesis}模板} \newcommand{\LPPL}{{\href{https://www.latex-project.org/lppl/lppl-1-3c.txt}{\LaTeX{} Project Public License (1.3.c)}}} -\newcommand{\version}{v2.0 BirthdayCake} +\newcommand{\versionold}{v2.0 BirthdayCake} +\newcommand{\version}{v3 Summer Time} + +\ExplSyntaxOn + +\AtBeginEnvironment { bitsyntax } { + \cs_set:Npn \lparen { \textup { ( } } + \cs_set:Npn \rparen { \textup { ) } } + \char_set_catcode_active:N | + \char_set_catcode_active:N < + \char_set_catcode_active:N ( + \char_set_active_eq:NN | \orbar + \char_set_active_eq:NN < \syntaxopt@aux + \char_set_active_eq:NN ( \defaultval@aux +} + +\NewDocumentCommand \BIThesisTemplates {m} { + \str_case:nn {#1} { + {UT}{本科生毕业论文模板(undergraduate-thesis)} + {UTE}{本科生全英文专业毕业论文模板(undergraduate-thesis-en)} + {GT}{研究生学位论文模板(graduate-thesis)} + {LR}{简易使用报告模板(lab-report)} + {PT}{本科生毕业设计外文翻译模板(paper-translation)} + {PS}{北理工主题的 Beamer 模板(presentation-slide)} + {UP}{本科生毕业设计开题报告(undergraduate-proposal)} + } +} + +% 允许换行的细间距。 +\def\breakablethinspace{\hskip 0.16667em\relax} + + +\DeclareDocumentCommand\kvopt{mm} + {\texttt{#1\breakablethinspace=\breakablethinspace#2}} + +\ExplSyntaxOff \ctexset{ today=big, - abstractname=简介 + abstractname=简介, } \ctexset{section={ @@ -1654,6 +4778,7 @@ footskip=0.7cm% 页脚 1.8cm % boxpos=c, showlines=false, extendedchars=true, + escapeinside = {(*}{*)}, upquote=true, tabsize=2, showtabs=false, @@ -1683,16 +4808,35 @@ footskip=0.7cm% 页脚 1.8cm % style=lstStyleBase, frame=l, rulecolor=\color{purple}, - language=bash} + language=bash, +} \lstdefinestyle{lstStyleLaTeX}{% style=lstStyleBase, frame=l, rulecolor=\color{violet}, - language=[LaTeX]TeX} + language=[LaTeX]TeX, + emphstyle=[1]\color{teal}, +} + +\lstdefinestyle{lstStyleSyntax}{% + style=lstStyleBase, + frame=l, + rulecolor=\color{violet}, + language=[LaTeX]TeX, + emphstyle=[1]\color{teal}, +} -\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{} +\lstnewenvironment{latex}[1][]{\lstset{style=lstStyleLaTeX, #1}}{} \lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{} +\lstnewenvironment{bitsyntax}[1][]{\lstset{style=lstStyleSyntax, #1}}{} + +\def\orbar{\textup{\textbar}} +\def\syntaxopt#1{\textit{#1}} +\def\defaultval#1{\textbf{\textup{#1}}} +\def\syntaxopt@aux#1>{\syntaxopt{#1}} +\def\defaultval@aux#1){\defaultval{#1}} + \setlist{nosep} @@ -1738,9 +4882,8 @@ footskip=0.7cm% 页脚 1.8cm % \kern 1ex } } -\makeatother - +\makeatother %</dtx-style> % \fi diff --git a/Master/texmf-dist/source/latex/bithesis/bithesis.ins b/Master/texmf-dist/source/latex/bithesis/bithesis.ins index eb76bab0108..27ae5ee939c 100644 --- a/Master/texmf-dist/source/latex/bithesis/bithesis.ins +++ b/Master/texmf-dist/source/latex/bithesis/bithesis.ins @@ -46,10 +46,13 @@ \generate { \usedir{tex/latex/bithesis} - \file{bitart.cls} {\from{\jobname.dtx}{cls,article}} - \file{bitbook.cls} {\from{\jobname.dtx}{cls,book}} - \file{bitgrad.cls} {\from{\jobname.dtx}{cls,graduate}} - \file{dtx-style.sty} {\from{\jobname.dtx}{dtx-style}} + \file{bitart.cls} {\from{\jobname.dtx}{oldcls,article}} + \file{bitbook.cls} {\from{\jobname.dtx}{oldcls,book}} + \file{bitgrad.cls} {\from{\jobname.dtx}{oldcls,graduate}} + \file{bithesis.cls} {\from{\jobname.dtx}{cls,thesis}} + \file{bitbeamer.cls} {\from{\jobname.dtx}{cls,beamer}} + \file{bitreport.cls} {\from{\jobname.dtx}{cls,report}} + \file{dtx-style.sty} {\from{\jobname.dtx}{dtx-style}} } \obeyspaces @@ -60,11 +63,14 @@ \Msg{* *} \Msg{* The recommended directory is TDS:tex/latex/bithesis *} \Msg{* *} -\Msg{* bitart.cls *} -\Msg{* bitbook.cls *} -\Msg{* bitgrad.cls *} +\Msg{* bithesis.cls *} +\Msg{* bitreport.cls *} +\Msg{* bitbeamer.cls *} +\Msg{* bitart.cls (deprecated) *} +\Msg{* bitbook.cls (deprecated) *} +\Msg{* bitgrad.cls (deprecated) *} \Msg{* *} -\Msg{* To produce the documentation run the file ctex.dtx *} +\Msg{* To produce the documentation run the file bithesis.dtx *} \Msg{* through XeLaTeX. *} \Msg{* *} \Msg{* Happy BIThesis! *} diff --git a/Master/texmf-dist/tex/latex/bithesis/bitart.cls b/Master/texmf-dist/tex/latex/bithesis/bitart.cls index b0151f88333..af2c354d27e 100644 --- a/Master/texmf-dist/tex/latex/bithesis/bitart.cls +++ b/Master/texmf-dist/tex/latex/bithesis/bitart.cls @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% bithesis.dtx (with options: `cls,article') +%% bithesis.dtx (with options: `oldcls,article') %% %% Copyright (C) 2022 %% Association of Bit Network Pioneer and any individual authors listed in the documentation. @@ -25,11 +25,13 @@ %% The Current Maintainer of this work is Feng Kaiyu. %% ------------------------------------------------------------------------------ %% -\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\NeedsTeXFormat{LaTeX2e}[2020/10/01] \ProvidesClass{bitart} [2022/05/09 v2.1.1 BIT Thesis Templates] + + \newif\if@bit@labreport \newif\if@bit@proposalreport @@ -64,7 +66,7 @@ \RequirePackage{etoolbox} \fi -\usepackage[style=gb7714-2015,backend=biber]{biblatex} +\RequirePackage[style=gb7714-2015,backend=biber]{biblatex} \if@bit@labreport % 将西文字体设置为 Times New Roman @@ -111,7 +113,7 @@ \captionsetup[table]{font=small,labelsep=space,skip=10bp,labelfont=bf,font=kaiticaption} % 输出大写数字日期 - \CTEXoptions[today=big] + \ctexset{today=big} % 将西文字体设置为 Times New Roman \setromanfont{Times New Roman} diff --git a/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls b/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls new file mode 100644 index 00000000000..c07f0779be9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bithesis/bitbeamer.cls @@ -0,0 +1,75 @@ +%% +%% This is file `bitbeamer.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% bithesis.dtx (with options: `cls,beamer') +%% +%% Copyright (C) 2022 +%% Association of Bit Network Pioneer and any individual authors listed in the documentation. +%% ------------------------------------------------------------------------------ +%% +%% 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 +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2020/11/27 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Feng Kaiyu. +%% ------------------------------------------------------------------------------ +%% +\RequirePackage{expl3,l3keys2e} +\ProvidesExplClass{bitbeamer} +{2022-09-03}{3.0.0}{BIT Thesis Templates} + + +\keys_define:nn { bitbeamer } + { + titlegraphic .tl_set:N = \l_bit_titlegraphic_tl, + framelogo .tl_set:N = \l_bit_framelogo_tl, + } +\ProcessKeysOptions { bitbeamer } + +\DeclareOption*{ + \PassOptionsToClass{\CurrentOption}{ctexbeamer} +} +\ProcessOptions\relax + +\LoadClass{ctexbeamer} + +\RequirePackage{xeCJKfntef} +\RequirePackage{tikz} + +\usetheme{Madrid} +\colorlet{beamer@blendedblue}{green!40!black} + +\cs_new:Npn \CJKhl:nn #1 #2 + { \CJKsout*[thickness=2.5ex, format=\color{#1}]{#2} } + +\tl_if_empty:NF \l_bit_titlegraphic_tl { + % BIT Logo + \titlegraphic{ + \includegraphics[width=2cm]{\l_bit_titlegraphic_tl} + } +} + +\tl_if_empty:NF \l_bit_framelogo_tl { + \addtobeamertemplate{frametitle}{}{% + \begin{tikzpicture}[remember~picture,overlay] + \node[anchor=north~east,yshift=2pt] at (current~page.north~east) {\includegraphics[height=0.8cm]{\tl_use:N \l_bit_framelogo_tl}}; + \end{tikzpicture} + } +} + +\cs_new_eq:NN \CJKhl \CJKhl:nn + +\endinput +%% +%% End of file `bitbeamer.cls'. diff --git a/Master/texmf-dist/tex/latex/bithesis/bitbook.cls b/Master/texmf-dist/tex/latex/bithesis/bitbook.cls index 25ad1a4b11f..11a378876b3 100644 --- a/Master/texmf-dist/tex/latex/bithesis/bitbook.cls +++ b/Master/texmf-dist/tex/latex/bithesis/bitbook.cls @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% bithesis.dtx (with options: `cls,book') +%% bithesis.dtx (with options: `oldcls,book') %% %% Copyright (C) 2022 %% Association of Bit Network Pioneer and any individual authors listed in the documentation. @@ -25,11 +25,13 @@ %% The Current Maintainer of this work is Feng Kaiyu. %% ------------------------------------------------------------------------------ %% -\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\NeedsTeXFormat{LaTeX2e}[2020/10/01] \ProvidesClass{bitbook} [2022/05/09 v2.1.1 BIT Thesis Templates] + + \newif\if@bit@bachelor \newif\if@bit@docTranslation \newif\if@bit@master @@ -57,7 +59,6 @@ \PassOptionsToPackage{AutoFakeBold,AutoFakeSlant}{xeCJK} \LoadClass[UTF8,zihao=-4,oneside,openany]{ctexbook} -\RequirePackage[a4paper,left=3cm,right=2.6cm,top=3.5cm,bottom=2.9cm]{geometry} \RequirePackage{xeCJK} \RequirePackage{titletoc} % \RequirePackage{fontspec} diff --git a/Master/texmf-dist/tex/latex/bithesis/bitgrad.cls b/Master/texmf-dist/tex/latex/bithesis/bitgrad.cls index 993f8f37aaa..813982e4aee 100644 --- a/Master/texmf-dist/tex/latex/bithesis/bitgrad.cls +++ b/Master/texmf-dist/tex/latex/bithesis/bitgrad.cls @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% bithesis.dtx (with options: `cls,graduate') +%% bithesis.dtx (with options: `oldcls,graduate') %% %% Copyright (C) 2022 %% Association of Bit Network Pioneer and any individual authors listed in the documentation. @@ -25,11 +25,13 @@ %% The Current Maintainer of this work is Feng Kaiyu. %% ------------------------------------------------------------------------------ %% -\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\NeedsTeXFormat{LaTeX2e}[2020/10/01] \ProvidesClass{bitgrad} [2022/05/09 v2.1.1 BIT Thesis Templates] + + %% ================================================== %% BIT-thesis-grd.cls for BIT Thesis %% modified by yang yating @@ -399,8 +401,7 @@ footskip=0.7cm% 页脚 1.8cm % showspaces=false, % flexiblecolumns=true, % breaklines=true, % 对过长的代码自动换行 - breakautoindent=true,% - breakindent=4em, % + postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space}, aboveskip=1em, % 代码块边框 %% added by http://bbs.ctex.org/viewthread.php?tid=53451 fontadjust, diff --git a/Master/texmf-dist/tex/latex/bithesis/bithesis.cls b/Master/texmf-dist/tex/latex/bithesis/bithesis.cls new file mode 100644 index 00000000000..d63d15bda6b --- /dev/null +++ b/Master/texmf-dist/tex/latex/bithesis/bithesis.cls @@ -0,0 +1,1632 @@ +%% +%% This is file `bithesis.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% bithesis.dtx (with options: `cls,thesis') +%% +%% Copyright (C) 2022 +%% Association of Bit Network Pioneer and any individual authors listed in the documentation. +%% ------------------------------------------------------------------------------ +%% +%% 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 +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2020/11/27 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Feng Kaiyu. +%% ------------------------------------------------------------------------------ +%% +\RequirePackage{expl3,l3keys2e} +\ProvidesExplClass{bithesis} +{2022-09-03}{3.0.0}{BIT Thesis Templates} + + +\int_new:N \g__bithesis_thesis_type_int +\int_new:N \g__bithesis_head_zihao_int +\bool_new:N \g__bithesis_twoside_bool +\bool_new:N \g__bithesis_thesis_type_english_bool +\bool_new:N \g__bithesis_blind_mode_bool +\tl_new:N \g__bithesis_label_divide_char_tl + +\seq_new:N \l__bithesis_right_seq +\seq_new:N \l__bithesis_left_seq + + +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx} + +\cs_new:Npn \__bithesis_same_page: { + \let\clearpage\relax + \let\cleardoublepage\relax +} + +\cs_new:Npn \__bithesis_if_graduate:TF #1#2 { + \int_compare:nNnTF {3} < {\g__bithesis_thesis_type_int} + {#1} + {#2} + } + +\cs_new:Npn \__bithesis_if_thesis_int_type:nTF #1#2#3 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {#1} {#2} {#3}} +\cs_new:Npn \__bithesis_if_thesis_int_type:nT #1#2 {\__bithesis_if_thesis_int_type:nTF {#1} {#2} {}} + +\cs_new:Npn \__bithesis_if_thesis_english:TF #1#2 {\bool_if:nTF {\g__bithesis_thesis_type_english_bool} {#1} {#2}} +\cs_new:Npn \__bithesis_if_thesis_english:T #1 {\__bithesis_if_thesis_english:TF {#1}{}} + +\cs_new:Npn \__bithesis_if_bachelor_thesis:TF #1#2 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} < {4} {#1} {#2}} +\cs_new:Npn \__bithesis_if_bachelor_thesis:T #1 {\__bithesis_if_bachelor_thesis:TF {#1} {}} +\cs_new:Npn \__bithesis_if_master_thesis:TF #1#2 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {4} {#1} {#2}} +\cs_new:Npn \__bithesis_if_doctor_thesis:TF #1#2 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {5} {#1} {#2}} + +\clist_const:Nn \c__bithesis_thesis_type_clist + { bachelor, bachelor_translation, bachelor_english, master, docter} + +\cs_new_protected:Npn \__bithesis_define_label:nn #1#2 + { \tl_const:cn { c__bithesis_label_ #1 _tl } {#2} } + +\cs_new_protected:Npn \__bithesis_define_label_by_thesis_type:nnn #1#2#3 + { + \tl_const:cn { c__bithesis_ #1 _label_ #2 _tl } {#3} + } + +\cs_new_protected:Npn \__bithesis_define_label:nnn #1#2#3 + { + \tl_const:cn { c__bithesis_label_ #1 _tl } {#2} + \tl_const:cn { c__bithesis_label_ #1 _en_tl } {#3} + } + +\cs_new_protected:Npn \__bithesis_define_label_by_thesis_type:nnnn #1#2#3#4 + { + \tl_const:cn { c__bithesis_ #1 _label_ #2 _tl } {#3} + \tl_const:cn { c__bithesis_ #1 _label_ #2 _en_tl } {#4} + } + +\clist_map_inline:nn + { + {code} {代码}, + {udc} {UDC分类号:}, + {classification} {中国分类号:}, + {classified_level} {密级}, + {type} {种类}, + } + {\__bithesis_define_label:nn #1} + +\clist_map_inline:nn + { + {title} {本科生毕业设计(论文)}, + {originality} {原创性声明}, + {originality_clause} {本人郑重声明:所呈交的毕业设计(论文),是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,本文不包含任何其他个人或集体已经发表或撰写过的研究成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。\par~特此申明。}, + {authorization} {关于使用授权的声明}, + {authorization_clause} {本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,其中包括:\circled{1}~学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);\circled{3}~学校可允许本毕业设计(论文)被查阅或借阅;\circled{4}~学校可以学术交流为目的,复制赠送和交换本毕业设计(论文);\circled{5}~学校可以公布本毕业设计(论文)的全部或部分内容。}, + {originality_author_signature} {本人签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日}, + {originality_supervisor_signature} {指导老师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日}, + } {\__bithesis_define_label_by_thesis_type:nnn {bachelor} #1} + +\clist_map_inline:nn + { + {title} {}, + {originality} {原创性声明~Statement~of~Originality}, + {originality_clause} { + 本人郑重声明:所呈交的毕业设计(论文),是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,本文不包含任何其他个人或集体已经发表或撰写过的研究成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。特此申明。\par + \arialfamily I,\dunderline[-1pt]{1pt}{\makebox[18mm]{}},~solemnly~ + declare:~the~submitted~graduation~design~(thesis),~is~the~research~achievement~completed~independently~by~myself~ + under~the~guidance~of~the~supervisor.~This~article~does~not~contain~ + any~research~published~or~written~by~any~other~individual~or~group,~ + except~as~already~referenced~in~this~paper.~Individuals~and~groups~ + that~have~made~important~contributions~to~the~study~of~this~paper~ + are~clearly~indicated~and~cited~in~the~paper.\par + }, + {authorization} {关于使用授权的声明~State~of~Use~Authorization}, + {authorization_clause} { + 本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,其中包括:\circled{1}学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;\circled{2}学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);\circled{3}学校可允许本毕业设计(论文)被查阅或借阅;\circled{4}学校可以学术交流为目的,复制赠送和交换本毕业设计(论文);\circled{5}学校可以公布本毕业设计(论文)的全部或部分内容。\par + I~fully~understand~the~regulations~on~the~storage,~use~of~graduation~design~(thesis)~in~Beijing~Institute~of~Technology.~Beijing~Institute~of~Technology~has~the~right~to~(1)~keep,~and~to~the~relevant~departments~to~send~the~original~or~copy~of~this~graduation~design~(thesis);~(2)~copy~and~preserve~this~graduation~design~(thesis)~by~photocopying,~miniature~or~other~means~of~reproduction;~(3)~allow~this~graduation~design~(thesis)~to~be~read~or~borrowed;~(4)~for~the~purpose~of~academic~exchange,~copy,~give~and~exchange~this~graduation~design~(thesis);~(5)~publish~all~or~part~of~the~contents~of~this~graduation~design~(thesis).~ + }, + } {\__bithesis_define_label_by_thesis_type:nnn {bachelor_english} #1} + +\cs_new:Npn \smallgap: { + \hspace{0.45ex} +} + +\cs_new:Npn \label_space: { + \__bithesis_if_bachelor_thesis:T { + \quad + } +} + +\clist_map_inline:nn + { + {originality} {研究成果声明}, + {originality_clause} {本人郑重声明:所提交的学位论文是我本人在指导教师的指导下进行的研究工作获得的研究成果。尽我所知,文中除特别标注和致谢的地方外,学位论文中不包含其他人已经发表或撰写过的研究成果,也不包含为获得北京理工大学或其它教育机构的学位或证书所使用过的材料。与我一同工作的合作者对此研究工作所做的任何贡献均已在学位论文中作了明确的说明并表示了谢意。\par~特此申明。}, + {authorization} {关于学位论文使用权的说明}, + {authorization_clause} {本人完全了解北京理工大学有关保管、使用学位论文的规定,其中包括:\circled{1}~学校有权保管、并向有关部门送交学位论文的原件与复印件;\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存学位论文;\circled{3}~学校可允许学位论文被查阅或借阅;\circled{4}~学校可以学术交流为目的,复制赠送和交换学位论文;\circled{5}~学校可以公布学位论文的全部或部分内容(保密学位论文在解密后遵守此规定)。}, + {originality_author_signature} {签\qquad 名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad}, + {originality_supervisor_signature} {指导老师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad}, + } {\__bithesis_define_label_by_thesis_type:nnn {graduate} #1} + +\clist_map_inline:nn + { + {author} {作\quad 者\quad 姓\quad 名} {Candidate~Name}, + {school} {学\quad 院\quad 名\quad 称} {School~or~Department}, + {supervisor} {指\quad 导\quad 教\quad 师} {Faculty~Mentor}, + {chairman} {答辩委员会主席} {Chair,~Thesis~Committee}, + {degree} {申\smallgap: 请\smallgap: 学\smallgap: 位\smallgap: 级\smallgap: 别} {Degree~Applied}, + {major} {学\quad 科\quad 专\quad 业} {Major}, + {institute} {学\smallgap: 位\smallgap: 授\smallgap: 予\smallgap: 单\smallgap: 位} {Degree~by}, + {defense_date} {论\smallgap: 文\smallgap: 答\smallgap: 辩\smallgap: 日\smallgap: 期} {The~Date~of~Defence}, + } {\__bithesis_define_label_by_thesis_type:nnnn {graduate} #1} + +\clist_map_inline:nn + { + {school} {学\qquad 院} {School}, + {major} {专\qquad 业} {Degree}, + {author} {学生姓名} {Author}, + {student_id} {学\qquad 号} {Student~ID}, + {supervisor} {指导教师} {Supervisor}, + {co_supervisor} {校外指导教师} {Co-Supervisor}, + {keywords} {关键词:} {Key~Words:~}, + {toc} {目\label_space: 录} {Table~of~Contents}, + {abstract} {摘\label_space: 要} {Abstract}, + {conclusion} {结\label_space: 论} {Conclusions}, + {appendix} {附\label_space: 录} {Appendices}, + {ack} {致\label_space: 谢} {Acknowledgement}, + {figure} {插\quad 图} {Illustrations}, + {table} {表\quad 格} {Tables}, + {appendix_prefix} {附录} {Appendix}, + {reference} {参考文献} {References}, + {university} {北京理工大学} {Beijing~Institute~of~Technology}, + {publications} {攻读学位期间发表论文与研究成果清单} {Publications~During~Studies}, + % TODO: Not so sure about the translation. + {resume} {作者简介} {}, + {symbols} {主要符号对照表} {}, + } + {\__bithesis_define_label:nnn #1} + +\clist_const:Nn \c__bithesis_bachelor_thesis_header_clist + {北京理工大学本科生毕业设计(论文), 北京理工大学本科生毕业设计(论文)外文翻译, Beijing~Institute~of~Technology~Bachelor's~Thesis } +\clist_const:Nn \c__bithesis_bachelor_thesis_cover_title_clist + { + 本科生毕业设计(论文), + 本科生毕业设计(论文)外文翻译, + Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis, + } + +\keys_define:nn { bithesis } +{ + info .meta:nn = { bithesis / info } {#1}, + misc .meta:nn = { bithesis / misc } {#1}, + cover .meta:nn = { bithesis / cover } {#1}, + style .meta:nn = { bithesis / style } {#1}, + option .meta:nn = { bithesis / option } {#1}, + TOC .meta:nn = { bithesis / TOC } {#1}, + appendices .meta:nn = { bithesis / appendices } {#1}, +} + +\keys_define:nn { bithesis / option } +{ + type .choice:, + type .value_required:n = true, + type .choices:Vn = + \c__bithesis_thesis_type_clist + { + \int_set_eq:NN \g__bithesis_thesis_type_int \l_keys_choice_int + \int_case:nn {\l_keys_choice_int} { + % 本科全英文也是英文模板。 + {3} {\bool_set_true:N \g__bithesis_thesis_type_english_bool} + } + }, + type .initial:n = bachelor, + twoside .bool_gset:N = \g__bithesis_twoside_bool, + blindPeerReview .bool_gset:N = \g__bithesis_blind_mode_bool, + ctex .tl_set:N = \l__bithesis_options_to_ctex_tl, +} + +\keys_define:nn { bithesis / cover } + { + date .tl_set:N = \l__bithesis_cover_date_tl, + headerImage .tl_set:N = \l_bit_coverheaderimage_tl, + xiheiFont .tl_set:N = \l__bithesis_cover_xihei_font_path_tl, + xiheiFont .default:n = {STXihei}, + %% cover entry + dilimiter .tl_set:N = \l__bithesis_cover_dilimiter_tl, + labelAlign .tl_set:N = \l__bithesis_cover_label_align_tl, + labelAlign .initial:n = {r}, + valueAlign .tl_set:N = \l__bithesis_cover_value_align_tl, + valueAlign .initial:n = {c}, + labelMaxWidth .dim_set:N = \l__bithesis_cover_label_max_width_dim, + valueMaxWidth .dim_set:N = \l__bithesis_cover_value_max_width_dim, + autoWidth .bool_set:N = \l__bithesis_cover_auto_width_bool, + autoWidth .initial:n = {true}, + underlineThickness .dim_set:N = \l__bithesis_cover_underline_thickness_dim, + underlineThickness .initial:n = {1pt}, + underlineOffset .dim_set:N = \l__bithesis_cover_underline_offset_dim, + underlineOffset .initial:n = { -10pt }, + } + +\keys_define:nn { bithesis / info } + { + title .tl_set:N = \l__bithesis_value_title_tl, + titleEn .tl_set:N = \l__bithesis_value_title_en_tl, + school .tl_set:N = \l__bithesis_value_school_tl, + major .tl_set:N = \l__bithesis_value_major_tl, + author .tl_set:N = \l__bithesis_value_author_tl, + studentId .tl_set:N = \l__bithesis_value_student_id_tl, + supervisor .tl_set:N = \l__bithesis_value_supervisor_tl, + externalSupervisor .tl_set:N = \l__bithesis_value_external_supervisor_tl, + keywords .tl_set:N = \l__bithesis_value_keywords_tl, + keywordsEn .tl_set:N = \l__bithesis_value_keywords_en_tl, + translationTitle .tl_set:N = \l__bithesis_value_trans_title_tl, + translationOriginTitle .tl_set:N = \l__bithesis_value_trans_origin_title_tl, + % 中国分类号,研究生学位论文使用 + classification .tl_set:N = \l__bithesis_value_classification_tl, + % UDC 分类号,研究生学位论文使用 + UDC .tl_set:N = \l__bithesis_value_udc_tl, + chairman .tl_set:N = \l__bithesis_value_chairman_tl, + degree .tl_set:N = \l__bithesis_value_degree_tl, + degreeEn .tl_set:N = \l__bithesis_value_degree_en_tl, + institute .tl_set:N = \l__bithesis_value_institute_tl, + institute .initial:n = {\c__bithesis_label_university_tl}, + defenseDate .tl_set:N = \l__bithesis_value_defense_date_tl, + authorEn .tl_set:N = \l__bithesis_value_author_en_tl, + schoolEn .tl_set:N = \l__bithesis_value_school_en_tl, + supervisorEn .tl_set:N = \l__bithesis_value_supervisor_en_tl, + chairmanEn .tl_set:N = \l__bithesis_value_chairman_en_tl, + majorEn .tl_set:N = \l__bithesis_value_major_en_tl, + instituteEn .tl_set:N = \l__bithesis_value_institute_en_tl, + instituteEn .initial:n = {\c__bithesis_label_university_en_tl}, + defenseDateEn .tl_set:N = \l__bithesis_value_defense_date_en_tl, + classifiedLevel .tl_set:N = \l__bithesis_value_classified_level_tl, + } + +\keys_define:nn { bithesis / misc } + { + arialFont .tl_set:N = \l__bithesis_misc_arial_font_path_tl, + } + +\keys_define:nn { bithesis / style } +{ + head .tl_set:N = \l__bithesis_style_head_tl, + head .initial:n = { + \int_case:nn {\g__bithesis_thesis_type_int} + { + {1} {北京理工大学本科生毕业设计(论文)} + {2} {北京理工大学本科生毕业设计(论文)外文翻译} + {3} {Beijing~Institute~of~Technology~Bachelor's~Thesis} + {4} {北京理工大学硕士学位论文} + {5} {北京理工大学博士学位论文} + } + }, +} + +\keys_define:nn { bithesis / TOC } +{ + abstract .bool_set:N = \l__bithesis_add_abstract_to_toc_bool, + abstract .initial:n = {true}, + abstractEn .bool_set:N = \l__bithesis_add_abstract_en_to_toc_bool, + abstractEn .initial:n = {true}, + symbols .bool_set:N = \l__bithesis_add_symbols_to_toc_bool, + symbols .initial:n = {true}, +} + +\keys_define:nn { bithesis / appendices } +{ + chapterLevel .bool_set:N = \l__bithesis_appendices_chapter_level_bool, + title .tl_set:N = \l__bithesis_appendices_title_tl, + TOCTitle .tl_set:N = \l__bithesis_appendix_toc_title_tl, +} + +\ProcessKeysOptions { bithesis / option } + +\__bithesis_if_thesis_english:T { + \PassOptionsToClass{scheme=plain}{ctexbook} +} + +\bool_if:NTF \g__bithesis_twoside_bool {} { + \PassOptionsToClass{oneside,openany}{ctexbook} +} + +\DeclareOption*{ + \PassOptionsToClass{\l__bithesis_options_to_ctex_tl}{ctexbook} +} +\ProcessOptions\relax +\LoadClass[zihao=-4,]{ctexbook} + +\RequirePackage{geometry} +\RequirePackage{xeCJK} +\RequirePackage{titletoc} +\RequirePackage{setspace} +\RequirePackage{graphicx} +\RequirePackage{fancyhdr} +\RequirePackage{pdfpages} +\RequirePackage{setspace} +\RequirePackage{booktabs} +\RequirePackage{multirow} +\RequirePackage{tikz} +\RequirePackage{etoolbox} +\RequirePackage{hyperref} +\RequirePackage{xcolor} +\RequirePackage{caption} +\RequirePackage{array} +\RequirePackage{amsmath} +\RequirePackage{amssymb} +\RequirePackage{amsthm} +\RequirePackage{unicode-math} +\RequirePackage{pdfpages} +\RequirePackage{listings} +\RequirePackage{enumitem} +\RequirePackage{environ} + +\pdfstringdefDisableCommands{% + \let\quad\empty +} + +\__bithesis_if_graduate:TF { + \int_set:Nn \g__bithesis_head_zihao_int {5} + \geometry{ + a4paper, + left=2.7cm, + bottom=2.5cm + 7bp, + top=3.5cm + 7bp, + right=2.7cm, + headsep = 3.5cm + 7bp - 2.5cm - 15bp, + headheight = 15 bp, + footskip = 2.5cm + 7bp - 1.8cm, + } +} { + \int_set:Nn \g__bithesis_head_zihao_int {4} + \geometry{ + a4paper, + left=3cm, + bottom=2.6cm + 7bp, + top=3.5cm + 7bp, + right=2.6cm, + headsep = 3.5cm + 7bp - 2.4cm - 20bp, + headheight = 20 bp, + footskip = 2.6cm + 7bp - 2cm, + } +} + +\setlength{\intextsep}{2\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip} + +\setromanfont{Times~New~Roman} + +\ctex_at_end_preamble:n { + \__bithesis_if_thesis_english:TF { + \__bithesis_if_thesis_int_type:nT {3} { + % font Arial needed + \newfontfamily\arialfamily{Arial} + } + + } { + \tl_if_blank:VTF \l__bithesis_cover_xihei_font_path_tl {} + { + \setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]{\l__bithesis_cover_xihei_font_path_tl} + } + } + + \__bithesis_if_thesis_int_type:nT {3} { + \RequirePackage[en-US]{datetime2} + \RequirePackage{indentfirst} + \DTMlangsetup[en-US]{dayyearsep={\space}} + } + + % Define biblatex category if it was imported. + \cs_if_exist:NT \DeclareBibliographyCategory { + \DeclareBibliographyCategory{mypub} + } +} + +\cs_new:Npn \xihei:n #1 { + \xeCJK_family_if_exist:nTF {xihei} { + \CJKfamily{xihei} #1 + }{ + \heiti #1 + } +} + +\cs_new:Npn \l__bithesis_title_font_cs:n #1 { + \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3} + { + \arialfamily #1 + } { + \heiti #1 + } +} + +\cs_new:Npn \l__bithesis_unnumchapter_style_cs:n #1 { + % 本科全英文、研究生学位论文需要加粗 + \int_compare:nNnTF {\g__bithesis_thesis_type_int} > {2} + { + \bfseries #1 + } { + \mdseries #1 + } +} + +\cs_set:Npn \arabicHeiti #1 {#1} + +\fancypagestyle{BIThesis}{ + \fancyhf{} + % 定义页眉、页码 + \fancyhead[C]{\zihao{\int_use:N \g__bithesis_head_zihao_int}\ziju{0.08}\songti{\tl_use:N \l__bithesis_style_head_tl}} + \fancyfoot[C]{\songti\zihao{5} \thepage} + % 页眉分割线稍微粗一些 + \RenewDocumentCommand \headrulewidth {} {0.6pt} +} + +\ctexset{chapter={ + number = {\arabicHeiti{ \arabic{chapter} }}, + format = { \l__bithesis_title_font_cs:n \bfseries \centering \zihao{3}}, + nameformat = {}, + titleformat = {}, + aftername = \hspace{9bp}, + pagestyle = BIThesis, + beforeskip = 8bp, + afterskip = 32bp, + fixskip = true, + } +} + +\ctexset{section={ + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}}}, + format = {\l__bithesis_title_font_cs:n \raggedright \bfseries \zihao{4}}, + nameformat = {}, + titleformat = {}, + aftername = \hspace{8bp}, + beforeskip = 20bp plus 1ex minus .2ex, + afterskip = 18bp plus .2ex, + fixskip = true, + } +} + +\ctexset{subsection={ + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}}}, + format = {\l__bithesis_title_font_cs:n \bfseries \raggedright \zihao{-4}}, + nameformat = {}, + titleformat = {}, + aftername = \hspace{7bp}, + beforeskip = 17bp plus 1ex minus .2ex, + afterskip = 14bp plus .2ex, + fixskip = true, + } +} + +\ctexset{ + secnumdepth = 3, + subsubsection={ + numbering = true, + number = {\arabicHeiti{\arabic{chapter}.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}.\hspace{1bp}\arabic{subsubsection}}}, + format={\l__bithesis_title_font_cs:n \bfseries \raggedright \zihao{-4}}, + nameformat = {}, + titleformat = {}, + beforeskip=28bp plus 1ex minus .2ex, + afterskip=24bp plus .2ex, + fixskip=true, + } +} + +\addtocontents{toc}{\protect\hypersetup{hidelinks}} + +\__bithesis_if_graduate:TF { + % 各章标题,宋体四号 + \titlecontents{chapter}[0pt]{\songti \zihao{4}} + {\thecontentslabel\hspace{\ccwd}}{} + {\hspace{.5em}\titlerule*{.}\contentspage} +} { + \titlecontents{chapter}[0pt]{\songti \zihao{-4}} + {\thecontentslabel\hspace{\ccwd}}{} + {\hspace{.5em}\titlerule*{.}\contentspage} +} +\titlecontents{section}[1\ccwd]{\songti \zihao{-4}} +{\thecontentslabel\hspace{\ccwd}}{} +{\hspace{.5em}\titlerule*{.}\contentspage} +\titlecontents{subsection}[2\ccwd]{\songti \zihao{-4}} +{\thecontentslabel\hspace{\ccwd}}{} +{\hspace{.5em}\titlerule*{.}\contentspage} + + +\RenewDocumentCommand \frontmatter {} { + + \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3} + { + \pagenumbering{roman} + } { + \pagenumbering{Roman} + } + \ctexset{ + chapter = { + numbering = false, + } + } + \pagestyle{BIThesis} +} + +\RenewDocumentCommand \mainmatter {} { + \cleardoublepage + + \ctexset{ + chapter = { + numbering = true, + } + } + \pagenumbering{arabic} + \pagestyle{BIThesis} + % 正文 22 磅的行距 + \setlength{\parskip}{0em} + \setstretch{1.53} + % 修复脚注出现跨页的问题 + \interfootnotelinepenalty=10000 +} + +\RenewDocumentCommand \backmatter {} { + \setcounter{section}{0} + \setcounter{subsection}{0} + \setcounter{subsubsection}{0} + \ctexset{ + chapter = { + numbering = false, + beforeskip = 18bp, + format = {\l__bithesis_title_font_cs:n \l__bithesis_unnumchapter_style_cs:n \centering \zihao{3}}, + afterskip = 26bp, + } + } +} + +\setlength{\abovecaptionskip}{11pt} +\setlength{\belowcaptionskip}{9pt} + +\__bithesis_if_graduate:TF { + \tl_set:Nn \g__bithesis_label_divide_char_tl {.} +} { + \tl_set:Nn \g__bithesis_label_divide_char_tl {-} +} + +\cs_set:Npn \thefigure {\thechapter\g__bithesis_label_divide_char_tl\arabic{figure}} +\captionsetup[figure]{font=small,labelsep=space} + +\cs_set:Npn \thetable {\thechapter\g__bithesis_label_divide_char_tl\arabic{table}} +\captionsetup[table]{font=small,labelsep=space,skip=2pt} + +\cs_set:Npn \theequation {\thechapter\g__bithesis_label_divide_char_tl\arabic{equation}} + +\cs_set:Npn \thelstlisting {\thechapter\g__bithesis_label_divide_char_tl\arabic{lstlisting}} +\cs_set:Npn \lstlistingname {\c__bithesis_label_code_tl} + +\tolerance=1 +\emergencystretch=\maxdimen +\hyphenpenalty=10000 +\hbadness=10000 + +\definecolor{codegreen}{rgb}{0,0.6,0} +\definecolor{codegray}{rgb}{0.5,0.5,0.5} +\definecolor{codepurple}{rgb}{0.58,0,0.82} +\definecolor{backcolour}{rgb}{0.95,0.95,0.92} +\lstdefinestyle{examplestyle}{ + backgroundcolor=\color{backcolour}, + commentstyle=\color{codegreen}, + keywordstyle=\color{magenta}, + numberstyle=\tiny\color{codegray}, + stringstyle=\color{codepurple}, + basicstyle=\ttfamily\footnotesize, + breakatwhitespace=false, + breaklines=true, + captionpos=b, + keepspaces=true, + numbers=left, + numbersep=5pt, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=2 +} +\lstset{style=examplestyle} + +\cs_set:Npn \listfigurename {\c__bithesis_label_figure_tl} +\cs_set:Npn \listtablename {\c__bithesis_label_table_tl} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\unimathsetup{ + math-style = ISO, + bold-style = ISO, +} + +\theoremstyle{plain} + \newtheorem{algorithm}{算法}[chapter] + \newtheorem{theorem}{定理}[chapter] + \newtheorem{lemma}[theorem]{引理} + \newtheorem{proposition}[theorem]{命题} + \newtheorem{corollary}[theorem]{推论} + \newtheorem{axiom}[theorem]{公理} +\theoremstyle{definition} + \newtheorem{definition}{定义}[chapter] + \newtheorem{conjecture}{猜想}[chapter] + \newtheorem{example}{例}[chapter] + \newtheorem{case}{情形} +\theoremstyle{remark} + \newtheorem{remark}{注} + \renewcommand{\qedsymbol}{\ensuremath{\QED}} + +\DeclareDocumentCommand \BITSetup { m } + { \keys_set:nn { bithesis } { #1 }} + +\cs_new:Npn \__bithesis_render_cover_entry:nn #1#2 { + \makebox[\l__bithesis_cover_label_max_width_dim][\l__bithesis_cover_label_align_tl]{ + \tl_if_blank:VTF #1 {} {#1\l__bithesis_cover_dilimiter_tl} + } + \hspace{1ex} + \__bithesis_dunderline:nnn{\l__bithesis_cover_underline_offset_dim}{\l__bithesis_cover_underline_thickness_dim}{ + \makebox[\l__bithesis_cover_value_max_width_dim][\l__bithesis_cover_value_align_tl]{#2} + }\par +} + +\cs_new:Npn \__bithesis_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 \__bithesis_get_text_width:Nn { NV } + +\cs_new:Npn \__bithesis_get_max_text_width:NN #1#2 + { + \group_begin: + \seq_set_eq:NN \l__bithesis_tmpa_seq #2 + \dim_zero_new:N \l__bithesis_tmpa_dim + \bool_until_do:nn { \seq_if_empty_p:N \l__bithesis_tmpa_seq } + { + \seq_pop_left:NN \l__bithesis_tmpa_seq \l__bithesis_tmpa_tl + \__bithesis_get_text_width:NV \l__bithesis_tmpa_dim \l__bithesis_tmpa_tl + \dim_gset:Nn #1 { \dim_max:nn {#1} { \l__bithesis_tmpa_dim } } + } + \group_end: + } + +\cs_new:Npn \__bithesis_parse_entry #1 #2 { + \seq_set_split:Nnx \l__bithesis_tmp_right_seq {//} {#2} + \seq_clear:N \l__bithesis_tmp_left_seq + \seq_map_inline:Nn \l__bithesis_tmp_right_seq { + \seq_put_right:Nn \l__bithesis_tmp_left_seq {} + } + \seq_put_left:Nn \l__bithesis_tmp_left_seq {#1} + \seq_pop_right:NN \l__bithesis_tmp_left_seq \g__bithesis_trashcan_tl +} + +\cs_new:Npn \__bithesis_render_cover_entry:n #1 { + \seq_set_from_clist:NN \l__bithesis_input_seq #1 + % parse newline // + \seq_map_inline:Nn \l__bithesis_input_seq { + \__bithesis_parse_entry ##1 + \seq_concat:NNN \l__bithesis_right_seq \l__bithesis_right_seq \l__bithesis_tmp_right_seq + \seq_concat:NNN \l__bithesis_left_seq \l__bithesis_left_seq \l__bithesis_tmp_left_seq + } + + \bool_if:NT \l__bithesis_cover_auto_width_bool { + \__bithesis_get_max_text_width:NN \l__bithesis_cover_label_max_width_dim \l__bithesis_left_seq + \__bithesis_get_max_text_width:NN \l__bithesis_cover_value_max_width_dim \l__bithesis_right_seq + } + + \group_begin: + \bool_until_do:nn { \seq_if_empty_p:N \l__bithesis_left_seq } + { + \seq_pop_left:NN \l__bithesis_left_seq \l__bithesis_tmpa_tl + \seq_pop_left:NN \l__bithesis_right_seq \l__bithesis_tmpb_tl + \tl_if_empty:xTF \l__bithesis_tmpb_tl {} { + \__bithesis_render_cover_entry:nn {\l__bithesis_tmpa_tl} {\l__bithesis_tmpb_tl} + } + } + \group_end: +} + +\cs_new:Npn \__bithesis_dunderline:nnn #1#2#3 { + {\setbox0=\hbox{#3}\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}} +} + +\cs_new:Npn \__bithesis_dunderline:nn #1#2 { + \__bithesis_dunderline:nnn {#1} {1pt} {#2} +} + +\cs_new:Npn \__bithesis_dunderline:n #1 { + \__bithesis_dunderline:nnn {-10pt} {1pt} {#1} +} + +\newcommand\dunderline[3][-1pt]{{% + \setbox0=\hbox{#3} + \ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}}} + +\NewEnviron{blindPeerReview}{ + \bool_if:NTF \g__bithesis_blind_mode_bool {} { + \BODY + } +} + +\RenewDocumentCommand \cleardoublepage { } + { + \clearpage + \bool_if:NT \g__bithesis_twoside_bool + { + \int_if_odd:nF \c@page + { \hbox:n { } \thispagestyle { empty } \newpage } + } + } + +\cs_new:Npn \make_graduate_cover: { + \cleardoublepage + \begin{titlepage} + { + \heiti\zihao{5} + \tl_if_blank:VTF \l__bithesis_value_classified_level_tl {} { + \flushright + \c__bithesis_label_classified_level_tl:~ + \l__bithesis_value_classified_level_tl \par + } + } + \centering + \vspace*{65mm} + {\heiti\zihao{-2} \l__bithesis_value_title_tl} + \vskip 60mm + {\heiti \zihao{-3} \l__bithesis_value_author_tl} % 黑体 小三 + \vskip 10mm + {\heiti \zihao{-3} \l__bithesis_cover_date_tl} % 黑体 小三 + \end{titlepage} +} + +\cs_new:Npn \make_paper_back: { + \cleardoublepage + \begin{titlepage} + \vskip 5cm + \begin{center} + \setstretch{1.1} + \begin{minipage}[t][19.7cm]{2em} + \begin{center} + {\heiti\zihao{3}\l__bithesis_value_title_tl} + \vfill + {\heiti\zihao{3}\l__bithesis_value_author_tl} + \vfill + {\heiti\zihao{3}\c__bithesis_label_university_tl} + \end{center} + \end{minipage} + \end{center} + % \vskip 5cm + \end{titlepage} +} + +\cs_new:Npn \__bithesis_make_chinese_title_page: { + \cleardoublepage + \begin{titlepage} + { % + {\heiti \zihao{5} \noindent \c__bithesis_label_classification_tl} \l__bithesis_value_classification_tl\\ + {\heiti \zihao{5} \c__bithesis_label_udc_tl} \l__bithesis_value_udc_tl + } + \begin{center} + + \vskip \stretch{1} + {\heiti\zihao{-2} \l__bithesis_value_title_tl} + \vskip \stretch{1} + + % TODO: delete this? + {\fangsong\zihao{4}} + \def\tabcolsep{1pt} + \def\arraystretch{1.5} + + { + \renewcommand{\baselinestretch}{2} + + \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl { + \tl_set:Nn \l__bithesis_cover_dilimiter_tl {\qquad} + } + \tl_set:Nn \l__bithesis_cover_underline_offset_dim {-5pt} + % if not auto width, try override width + \bool_if:NF \l__bithesis_cover_auto_width_bool { + \dim_compare:nNnT {\l__bithesis_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_label_max_width_dim {45mm} + } + \dim_compare:nNnT {\l__bithesis_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_value_max_width_dim {60mm} + } + } + + \clist_set:Nn \l__bithesis_input_clist { + {\c__bithesis_graduate_label_author_tl} {\l__bithesis_value_author_tl}, + {\c__bithesis_graduate_label_school_tl} {\l__bithesis_value_school_tl}, + {\c__bithesis_graduate_label_supervisor_tl} {\l__bithesis_value_supervisor_tl}, + {\c__bithesis_graduate_label_chairman_tl} {\l__bithesis_value_chairman_tl}, + {\c__bithesis_graduate_label_degree_tl} {\l__bithesis_value_degree_tl}, + {\c__bithesis_graduate_label_major_tl} {\l__bithesis_value_major_tl}, + {\c__bithesis_graduate_label_institute_tl} {\l__bithesis_value_institute_tl}, + {\c__bithesis_graduate_label_defense_date_tl} {\l__bithesis_value_defense_date_tl}, + } + + \heiti\zihao{-3} + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + } + \end{center} + \vskip \stretch{0.5} + \end{titlepage} +} + +\cs_new:Npn \__bithesis_make_english_title_page: { + \begin{titlepage} + \begin{center} + + \vspace*{10em} + {\zihao{-2}\textbf{\l__bithesis_value_title_en_tl}} + % \bfseries + \vskip \stretch{1} + + { + \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl { + \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:~} + } + + \tl_set:Nn \l__bithesis_cover_label_align_tl {l} + \tl_set:Nn \l__bithesis_cover_underline_offset_dim {-5pt} + + % if not auto width, try override width + \bool_if:NF \l__bithesis_cover_auto_width_bool { + \dim_compare:nNnT {\l__bithesis_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_label_max_width_dim {55mm} + } + \dim_compare:nNnT {\l__bithesis_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_value_max_width_dim {85mm} + } + } + + \clist_set:Nn \l__bithesis_input_clist { + {\c__bithesis_graduate_label_author_en_tl} {\l__bithesis_value_author_en_tl}, + {\c__bithesis_graduate_label_school_en_tl} {\l__bithesis_value_school_en_tl}, + {\c__bithesis_graduate_label_supervisor_en_tl} {\l__bithesis_value_supervisor_en_tl}, + {\c__bithesis_graduate_label_chairman_en_tl} {\l__bithesis_value_chairman_en_tl}, + {\c__bithesis_graduate_label_degree_en_tl} {\l__bithesis_value_degree_en_tl}, + {\c__bithesis_graduate_label_major_en_tl} {\l__bithesis_value_major_en_tl}, + {\c__bithesis_graduate_label_institute_en_tl} {\l__bithesis_value_institute_en_tl}, + {\c__bithesis_graduate_label_defense_date_en_tl} {\l__bithesis_value_defense_date_en_tl}, + } + + \zihao{-3} + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + } + + \end{center} + + \vskip \stretch{0.5} + \end{titlepage} +} + +\DeclareDocumentCommand \MakeCover {} + { + \begin{blindPeerReview} + \group_begin: + + \int_case:nn {\g__bithesis_thesis_type_int} + { + {1} + { + \begin{titlepage} + \vspace*{16mm} + + \centering + + \tl_if_blank:VTF \l_bit_coverheaderimage_tl {} { + \includegraphics[width=9.87cm]{\l_bit_coverheaderimage_tl}\\ + } + + \vspace*{-3mm} + + \zihao{-0}\textbf{\ziju{0.12}\songti{\c__bithesis_bachelor_label_title_tl}}\par + + \vspace{16mm} + + \zihao{2}\textbf{\xihei:n \l__bithesis_value_title_tl}\par + + \vspace{3mm} + + \begin{spacing}{1.2} + \zihao{3}\selectfont{\textbf{\l__bithesis_value_title_en_tl}}\par + \end{spacing} + + \vspace{15mm} + + \begin{spacing}{1.8} + \begin{center} + \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl { + \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:} + } + % if not auto width, try override width + \bool_if:NF \l__bithesis_cover_auto_width_bool { + \dim_compare:nNnT {\l__bithesis_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_label_max_width_dim {35mm} + } + \dim_compare:nNnT {\l__bithesis_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_value_max_width_dim {78mm} + } + } + + \clist_set:Nn \l__bithesis_input_clist { + {\c__bithesis_label_school_tl} {\l__bithesis_value_school_tl}, + {\c__bithesis_label_major_tl} {\l__bithesis_value_major_tl}, + {\c__bithesis_label_author_tl} {\l__bithesis_value_author_tl}, + {\c__bithesis_label_student_id_tl} {\l__bithesis_value_student_id_tl}, + {\c__bithesis_label_supervisor_tl} {\l__bithesis_value_supervisor_tl}, + {\c__bithesis_label_co_supervisor_tl} {\l__bithesis_value_external_supervisor_tl}, + } + + \zihao{3} + + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + + \end{center} + \end{spacing} + + \vspace*{\fill} + \centering + \zihao{3}\ziju{0.5}\songti{ + \tl_if_empty:NTF \l__bithesis_cover_date_tl { + \today + } { + \l__bithesis_cover_date_tl + } + } + \end{titlepage} + } + {2} + { + \begin{titlepage} + \centering + + \tl_if_blank:VTF \l_bit_coverheaderimage_tl {} { + \includegraphics[width=6.87cm]{\l_bit_coverheaderimage_tl}\\ + } + + \vspace{1mm} + + \zihao{2}\textbf{\songti{本科生毕业设计(论文)外文翻译}} + + \vspace{8mm} + + { + + \begin{spacing}{1.8} + + \tl_set:Nn \l__bithesis_cover_dilimiter_tl {\textbf{:}} + \bool_set_false:N \l__bithesis_cover_auto_width_bool + \dim_set:Nn \l__bithesis_cover_label_max_width_dim {35mm} + \dim_set:Nn \l__bithesis_cover_value_max_width_dim {115mm} + + \clist_set:Nn \l__bithesis_input_clist { + {\zihao{4}\textbf{外文原文题目}} {\l__bithesis_value_trans_origin_title_tl}, + {\zihao{4}\textbf{中文翻译题目}} {\l__bithesis_value_trans_title_tl}, + } + + \zihao{-3} + \centering + + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + + \end{spacing} + + } + + \vspace{14mm} + + \zihao{2}\textbf{\xihei:n \l__bithesis_value_title_tl}\par + + \vspace{3mm} + + \begin{spacing}{1.2} + \zihao{3}\selectfont{\textbf{\l__bithesis_value_title_en_tl}}\par + \end{spacing} + + \vspace{19mm} + + \begin{spacing}{1.8} + \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl { + \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:} + } + + % if not auto width, try override width + \bool_if:NF \l__bithesis_cover_auto_width_bool { + \dim_compare:nNnT {\l__bithesis_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_label_max_width_dim {35mm} + } + \dim_compare:nNnT {\l__bithesis_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_value_max_width_dim {78mm} + } + } + + \zihao{3} + + \clist_set:Nn \l__bithesis_input_clist { + {\c__bithesis_label_school_tl} {\l__bithesis_value_school_tl}, + {\c__bithesis_label_major_tl} {\l__bithesis_value_major_tl}, + {\c__bithesis_label_author_tl} {\l__bithesis_value_author_tl}, + {\c__bithesis_label_student_id_tl} {\l__bithesis_value_student_id_tl}, + {\c__bithesis_label_supervisor_tl} {\l__bithesis_value_supervisor_tl}, + {\c__bithesis_label_co_supervisor_tl} {\l__bithesis_value_external_supervisor_tl}, + } + + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + + \end{spacing} + + \vspace*{\fill} + \end{titlepage} + } + {3} { + \begin{titlepage} + \vspace*{16mm} + + \centering + + \tl_if_blank:VTF \l_bit_coverheaderimage_tl {} { + \includegraphics[width=9.87cm]{\l_bit_coverheaderimage_tl}\\ + } + + \vspace*{-3mm} + + \zihao{1}\textbf{\ziju{0.12}Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis}\par + + \vspace{18mm} + + \zihao{2}\textbf{\xihei:n \l__bithesis_value_title_en_tl}\par + + \vspace{10mm} + + \begin{spacing}{1.8} + \begin{center} + \tl_if_empty:NT \l__bithesis_cover_dilimiter_tl { + \tl_set:Nn \l__bithesis_cover_dilimiter_tl {:} + } + + % if not auto width, try override width + \bool_if:NF \l__bithesis_cover_auto_width_bool { + \dim_compare:nNnT {\l__bithesis_cover_label_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_label_max_width_dim {20mm} + } + \dim_compare:nNnT {\l__bithesis_cover_value_max_width_dim} = {0pt} { + \dim_set:Nn \l__bithesis_cover_value_max_width_dim {105mm} + } + } + + \zihao{4} + + \clist_set:Nn \l__bithesis_input_clist { + {\c__bithesis_label_school_en_tl} {\l__bithesis_value_school_tl}, + {\c__bithesis_label_major_en_tl} {\l__bithesis_value_major_tl}, + {\c__bithesis_label_author_en_tl} {\l__bithesis_value_author_tl}, + {\c__bithesis_label_student_id_en_tl} {\l__bithesis_value_student_id_tl}, + {\c__bithesis_label_supervisor_en_tl} {\l__bithesis_value_supervisor_tl}, + {\c__bithesis_label_co_supervisor_en_tl} {\l__bithesis_value_external_supervisor_tl}, + } + + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + + \end{center} + \end{spacing} + + \vspace*{\fill} + \centering + \zihao{3}\ziju{0.5}\songti{ + \tl_if_empty:NTF \l__bithesis_cover_date_tl { + \today + } { + \l__bithesis_cover_date_tl + } + } + \end{titlepage} + } + {4} { + \make_graduate_cover: + } + {5} { + \make_graduate_cover: + } + } + \group_end: + \end{blindPeerReview} + } + +\newcommand{\circled}[2][]{\tikz[baseline=(char.base)] + {\node[shape = circle, draw, inner~sep = 1pt] + (char) {\phantom{\ifblank{#1}{#2}{#1}}}; + \node at (char.center) {\makebox[0pt][c]{#2}};}} +\robustify{\circled} + +\cs_new:Npn \__bithesis_graduate_originality: { + \ctexset { + chapter / pagestyle = plain, + } + + \begin{titlepage} + \pagenumbering{gobble} + + % 原创性声明部分 + \begin{center} + \__bithesis_same_page: + \chapter*{\heiti\zihao{3}\c__bithesis_graduate_label_originality_tl} + \end{center}~\par + + % 本部分字号为小三 + \zihao{4} + \c__bithesis_graduate_label_originality_clause_tl + + \vspace{17mm} + + \begin{flushright} + \c__bithesis_graduate_label_originality_author_signature_tl\par + \end{flushright} + + \vspace{16mm} + + % 使用授权声明部分 + \begin{center} + \__bithesis_same_page: + \chapter*{\heiti\zihao{3}\c__bithesis_graduate_label_authorization_tl} + \end{center}~\par + + \c__bithesis_graduate_label_authorization_clause_tl + + \vspace*{15mm} + + \begin{flushright} + \begin{spacing}{1.65} + \zihao{4} + % \hspace{5mm}\raisebox{-2ex}{\includegraphics[width=30mm]{example-image}}\hspace{5mm} + \c__bithesis_graduate_label_originality_author_signature_tl\par + \c__bithesis_graduate_label_originality_supervisor_signature_tl\par + \end{spacing} + \end{flushright} + \end{titlepage} + \cleardoublepage +} + +\NewDocumentCommand \MakeOriginality {} +{ + \group_begin: + \begin{blindPeerReview} + \int_case:nn {\g__bithesis_thesis_type_int} + { + {1} + { + \pagestyle{BIThesis} + \pagenumbering{gobble} + + % 原创性声明部分 + \begin{center} + \vspace*{-2bp} + \__bithesis_same_page: + \chapter*{\heiti\zihao{2}\c__bithesis_bachelor_label_originality_tl} + \end{center}~\par + + % 本部分字号为小三 + \zihao{-3} + \c__bithesis_bachelor_label_originality_clause_tl + + \vspace{17mm} + + \begin{flushright} + \c__bithesis_bachelor_label_originality_author_signature_tl\par + \end{flushright} + + \vspace{16mm} + + % 使用授权声明部分 + \begin{center} + \__bithesis_same_page: + \chapter*{\heiti\zihao{2}\c__bithesis_bachelor_label_authorization_tl} + \end{center}~\par + + \c__bithesis_bachelor_label_authorization_clause_tl + + \vspace*{3mm} + + \begin{flushright} + \begin{spacing}{1.65} + \zihao{-3} + % \hspace{5mm}\raisebox{-2ex}{\includegraphics[width=30mm]{example-image}}\hspace{5mm} + \c__bithesis_bachelor_label_originality_author_signature_tl\par + \c__bithesis_bachelor_label_originality_supervisor_signature_tl\par + \end{spacing} + \end{flushright} + + \newpage + } + {3} { + \setstretch{1.26} + % 原创性声明部分 + \begin{center} + \vspace*{-2bp} + \__bithesis_same_page: + \chapter*{\heiti\zihao{-2}\c__bithesis_bachelor_english_label_originality_tl} + \end{center}~\par + + % 本部分字号为小三 + \zihao{-4} + \c__bithesis_bachelor_english_label_originality_clause_tl + + \bigbreak + + Student~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm]{}}~Date:\par + + \vspace{6mm} + + % 使用授权声明部分 + \begin{center} + \__bithesis_same_page: + \chapter*{\heiti\zihao{-2}\c__bithesis_bachelor_english_label_authorization_tl} + \end{center}~\par + + \c__bithesis_bachelor_english_label_authorization_clause_tl + + \bigbreak + Student~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm + 16bp]{}}~\hspace{2mm}Date:\par + Supervisor~(Signature):~\dunderline[-1pt]{1pt}{\makebox[18mm]{}}~\hspace{2mm}Date:\par + } + {4} {\__bithesis_graduate_originality:} + {5} {\__bithesis_graduate_originality:} + } + \end{blindPeerReview} + \group_end: +} + +\NewDocumentCommand \MakePaperBack {} + { + \begin{blindPeerReview} + \make_paper_back: + \end{blindPeerReview} + } + +\NewDocumentCommand \MakeTitle {} + { + \begin{blindPeerReview} + \__bithesis_make_chinese_title_page: + \__bithesis_make_english_title_page: + \end{blindPeerReview} + } + +\DeclareDocumentCommand \MakeTOC {} + { + { + \__bithesis_if_bachelor_thesis:TF { + \renewcommand{\baselinestretch}{1.35} + } { + \renewcommand{\baselinestretch}{1.56} + } + + \__bithesis_if_thesis_english:TF { + \tl_set:Nn \l__bithesis_toc_title_tl {\c__bithesis_label_toc_en_tl} + } { + \tl_set:Nn \l__bithesis_toc_title_tl {\c__bithesis_label_toc_tl} + } + + % 自定义目录样式 + \cs_set:Npn \contentsname { + \fontsize{16pt}{\baselineskip} + \l__bithesis_unnumchapter_style_cs:n\l__bithesis_title_font_cs:n{\l__bithesis_toc_title_tl} + \vspace{-8pt} + } + + % 制作目录 + \tableofcontents + + % 在本科生全英文模板中,添加「目录」本身到目录中。 + \__bithesis_if_thesis_int_type:nT {3} { + \addcontentsline{toc}{chapter}{\c__bithesis_label_toc_en_tl} + } + } + } + + % TODO: + \NewDocumentEnvironment {abstract} {} + { + + \cleardoublepage + \setstretch{1.53} + + \__bithesis_if_bachelor_thesis:T { + \begin{center} + \vspace*{-17bp} + \heiti\zihao{-2}\textbf{ + \int_case:nn {\g__bithesis_thesis_type_int} + { + {1} {\l__bithesis_value_title_tl} + {2} {\l__bithesis_value_trans_title_tl} + {3} {\l__bithesis_value_title_tl} + } + } + \end{center} + + \vspace*{2mm} + } + + \ctexset{ + chapter/numbering = false, + } + + \__bithesis_if_bachelor_thesis:T { + \ctexset{ + chapter/titleformat = {\textmd} + } + } + + { + \__bithesis_same_page: + \bool_if:NTF \l__bithesis_add_abstract_to_toc_bool { + \chapter{\c__bithesis_label_abstract_tl} + } { + \chapter*{\c__bithesis_label_abstract_tl} + } + } + \vspace*{1mm} + \par + } + { + \par + \vspace{4ex}\noindent\textbf{\heiti \c__bithesis_label_keywords_tl \l__bithesis_value_keywords_tl}\par + \newpage + } + + \NewDocumentEnvironment {abstractEn} {} + { + \cleardoublepage + \setstretch{1.53} + + \__bithesis_if_bachelor_thesis:T { + \begin{spacing}{0.95} + \centering + \vspace*{-2bp} + + \__bithesis_if_thesis_int_type:nTF {3} { + \arialfamily\zihao{-2}\textbf\l__bithesis_value_title_en_tl\\ + } { + \heiti\zihao{3}\textbf\l__bithesis_value_title_en_tl\\ + } + \end{spacing} + \vspace*{10mm} + } + + \ctexset{ + chapter/numbering = false, + } + + \__bithesis_if_bachelor_thesis:TF { + \int_compare:nNnTF {\g__bithesis_thesis_type_int} = {3} + { + \ctexset{ + chapter = { + titleformat = {\heiti\zihao{3}\centering\textbf}, + } + } + } { + \ctexset{ + chapter = { + titleformat = {\heiti\zihao{-3}\centering\textmd}, + } + } + } + } { + \ctexset { + chapter/titleformat = {\heiti\zihao{3}\centering\textbf} + } + } + + { + \__bithesis_same_page: + \bool_if:nTF {\l__bithesis_add_abstract_en_to_toc_bool} { + \chapter{\c__bithesis_label_abstract_en_tl} + } { + \chapter*{\c__bithesis_label_abstract_en_tl} + } + } + } + { + \par\vspace{3ex}\noindent\textbf{\c__bithesis_label_keywords_en_tl \l__bithesis_value_keywords_en_tl} + \newpage + } + + \NewDocumentEnvironment {conclusion} {} + { + \ctexset{ + section/number = \arabic{section} + } + + \__bithesis_if_thesis_english:TF { + \chapter{\c__bithesis_label_conclusion_en_tl} + } { + \chapter{\c__bithesis_label_conclusion_tl} + } + } + {} + + \NewDocumentEnvironment {bibprint} {} + { + % 设置参考文献字号为 5 号 + \renewcommand*{\bibfont}{\zihao{5}} + % 设置参考文献各个项目之间的垂直距离为 0 + \setlength{\bibitemsep}{0ex} + \setlength{\bibnamesep}{0ex} + \setlength{\bibinitsep}{0ex} + \__bithesis_if_graduate:TF { + } { + % 「本科生」设置单倍行距 + \renewcommand{\baselinestretch}{1.2} + } + % 设置参考文献顺序标签 `[1]` 与文献内容 `作者. 文献标题...` 的间距 + \setlength{\biblabelsep}{1.7mm} + % 设置参考文献后文缩进为 0(与 Word 模板保持一致) + % See: https://github.com/hushidong/biblatex-gb7714-2015 + % 如何修参考文献表的缩进? + \cs_set:Npn \itemcmd { + \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} + %%这里是所做的调整,以下两句通过调整\lengthid来调整缩进 + \setlength{\lengthid}{0pt} + \addtolength{\lengthid}{-\biblabelsep} + \setlength{\lengthlw}{\textwidth} + \addtolength{\lengthlw}{-\lengthid} + \addvspace{\bibitemsep}%恢复\bibitemsep的作用 + \hangindent\lengthid + \leavevmode\mkgbnumlabel{\printfield{labelnumber}}% + \hspace{\biblabelsep} + } + \__bithesis_if_thesis_english:TF { + \chapter{\c__bithesis_label_reference_en_tl} + } { + \chapter{\c__bithesis_label_reference_tl} + } + } + {} + + % #1: The name that used as chapter title + % #2: The name that used in ToC. + \NewDocumentEnvironment {appendices} {} + { + % Used in chapter, ToC. + \tl_new:N \l__bithesis_appendix_plain_label_tl + % Used before reference label. + \tl_new:N \l__bithesis_appendix_default_title_tl + + \__bithesis_if_thesis_english:TF { + \tl_set:Nn \l__bithesis_appendix_plain_label_tl {\c__bithesis_label_appendix_prefix_en_tl} + \tl_set:Nn \l__bithesis_appendix_default_title_tl {\c__bithesis_label_appendix_en_tl} + } { + \tl_set:Nn \l__bithesis_appendix_plain_label_tl {\c__bithesis_label_appendix_prefix_tl} + \tl_set:Nn \l__bithesis_appendix_default_title_tl {\c__bithesis_label_appendix_tl} + } + + \bool_if:NTF \l__bithesis_appendices_chapter_level_bool { + \setcounter{chapter}{0} + \ctexset{ + chapter/numbering = true, + chapter/name = {}, + chapter/number = \l__bithesis_appendix_plain_label_tl\hspace{1ex}\Alph{chapter}, + section/number = \Alph{chapter}. \arabic{section}, + subsection/number = \Alph{chapter}. \arabic{section}. \arabic{subsection}, + } + + \cs_set:Npn \thechapter { + \Alph{chapter} + } + } { + \ctexset{ + section/number = \l__bithesis_appendix_plain_label_tl\hspace{1ex}\Alph{section}, + subsection/number = \Alph{section}. \arabic{subsection}, + } + + \cs_set:Npn \thechapter { + \Alph{section} + } + + \tl_if_blank:VTF \l__bithesis_appendices_title_tl { + \chapter{\l__bithesis_appendix_default_title_tl} + } { + \chapter*{\l__bithesis_appendices_title_tl} + \stepcounter{chapter} + \tl_if_blank:VTF \l__bithesis_appendix_toc_title_tl { + \addcontentsline{toc}{chapter}{\l__bithesis_appendix_default_title_tl} + } { + \addcontentsline{toc}{chapter}{\l__bithesis_appendix_toc_title_tl} + } + } + } + } + { + } + + \NewDocumentEnvironment {acknowledgements} {+b} + { + \begin{blindPeerReview} + \ctexset{ + section/number = \arabic{section}, + subsection/number = \arabic{section}. \arabic{subsection}, + } + + \__bithesis_if_thesis_english:TF { + \chapter{\c__bithesis_label_ack_en_tl} + } { + \chapter{\c__bithesis_label_ack_tl} + } + #1 + \end{blindPeerReview} + } {} + + \NewDocumentEnvironment {publications} {+b} + { + \begin{blindPeerReview} + % 设置参考文献字号为 5 号 + \renewcommand*{\bibfont}{\zihao{5}} + % 设置参考文献各个项目之间的垂直距离为 0 + \setlength{\bibitemsep}{0ex} + \setlength{\bibnamesep}{0ex} + \setlength{\bibinitsep}{0ex} + % 设置单倍行距 + \renewcommand{\baselinestretch}{1.2} + % 设置参考文献顺序标签 `[1]` 与文献内容 `作者. 文献标题...` 的间距 + \setlength{\biblabelsep}{1.7mm} + % 设置参考文献后文缩进为 0(与 Word 模板保持一致) + % See: https://github.com/hushidong/biblatex-gb7714-2015 + % 如何修参考文献表的缩进? + \cs_set:Npn \itemcmd { + \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} + %%这里是所做的调整,以下两句通过调整\lengthid来调整缩进 + \setlength{\lengthid}{0pt} + \addtolength{\lengthid}{-\biblabelsep} + \setlength{\lengthlw}{\textwidth} + \addtolength{\lengthlw}{-\lengthid} + \addvspace{\bibitemsep}%恢复\bibitemsep的作用 + \hangindent\lengthid + \leavevmode\mkgbnumlabel{\printfield{labelnumber}}% + \hspace{\biblabelsep} + } + + % ===== 上方定义与「参考文献」部分相同 + \cs_set:Npn \mkbibnamegiven ##1 { + \ifitemannotation{myself}{\textbf{##1}}{##1} + } + + \cs_set:Npn \mkbibnamefamily ##1 { + \ifitemannotation{myself}{\textbf{##1}}{##1} + } + + % Sorting by year, name, type. + \newrefcontext[sorting=ynt] + \chapter{\c__bithesis_label_publications_tl} + #1 + \end{blindPeerReview} + } + {} + + \NewDocumentEnvironment {resume} {+b} + { + \begin{blindPeerReview} + \chapter{\c__bithesis_label_resume_tl} + #1 + \end{blindPeerReview} + } + { + } + + \NewDocumentEnvironment {symbols} {} + { + \bool_if:NTF \l__bithesis_add_symbols_to_toc_bool { + \chapter{\c__bithesis_label_symbols_tl} + } { + \chapter*{\c__bithesis_label_symbols_tl} + } + \zihao{-4} + \begin{itemize}[labelwidth=2.5cm,labelsep=0.5cm,leftmargin=3cm,itemindent=0cm,itemsep=0cm] + \cs_set:Npn \makelabel ##1 {##1\hfil} + } + { + \end{itemize} + } + + +\endinput +%% +%% End of file `bithesis.cls'. diff --git a/Master/texmf-dist/tex/latex/bithesis/bitreport.cls b/Master/texmf-dist/tex/latex/bithesis/bitreport.cls new file mode 100644 index 00000000000..e75fd27ab9f --- /dev/null +++ b/Master/texmf-dist/tex/latex/bithesis/bitreport.cls @@ -0,0 +1,328 @@ +%% +%% This is file `bitreport.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% bithesis.dtx (with options: `cls,report') +%% +%% Copyright (C) 2022 +%% Association of Bit Network Pioneer and any individual authors listed in the documentation. +%% ------------------------------------------------------------------------------ +%% +%% 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 +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2020/11/27 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Feng Kaiyu. +%% ------------------------------------------------------------------------------ +%% +\RequirePackage{expl3,l3keys2e} +\ProvidesExplClass{bitreport} +{2022-09-03}{3.0.0}{BIT Thesis Templates} + + +\int_new:N \g__bithesis_report_type_int + +\clist_const:Nn \c__bithesis_report_type_clist + { common, undergraduate_proposal} + +\seq_new:N \l__bithesis_right_seq +\seq_new:N \l__bithesis_left_seq + +\PassOptionsToPackage{AutoFakeBold,AutoFakeSlant}{xeCJK} + +\keys_define:nn { bitreport } + { + option .meta:nn = {bitreport / option } {#1}, + cover .meta:nn = { bitreport / cover } {#1}, + info .meta:nn = { bitreport / info } {#1}, + misc .meta:nn = { bitreport / misc } {#1} + } + +\keys_define:nn { bitreport / option } + { + type .choice:, + type .value_required:n = true, + type .choices:Vn = + \c__bithesis_report_type_clist + { + \int_set_eq:NN \g__bithesis_report_type_int \l_keys_choice_int + }, + type .initial:n = common, + ctex .tl_set:N = \l__bithesis_options_to_ctex_tl, + } + +\DeclareOption*{ + \PassOptionsToClass{\l__bithesis_options_to_ctex_tl}{ctexart} +} +\ProcessOptions\relax +\LoadClass[zihao=-4]{ctexart} + +\RequirePackage[a4paper,left=3cm,right=2.4cm,top=2.6cm,bottom=2.38cm,includeheadfoot]{geometry} +\RequirePackage{fancyhdr} +\RequirePackage{setspace} +\RequirePackage{caption} +\RequirePackage{booktabs} +\RequirePackage{pdfpages} + +\keys_define:nn { bitreport / cover } + { + imagePath .tl_set:N = \l_bit_coverimagepath_tl, + date .tl_set:N = \l__bithesis_cover_date_tl, + %% cover entry + dilimiter .tl_set:N = \l__bithesis_cover_dilimiter_tl, + labelAlign .tl_set:N = \l__bithesis_cover_label_align_tl, + labelAlign .initial:n = {r}, + valueAlign .tl_set:N = \l__bithesis_cover_value_align_tl, + valueAlign .initial:n = {c}, + labelMaxWidth .dim_set:N = \l__bithesis_cover_label_max_width_dim, + valueMaxWidth .dim_set:N = \l__bithesis_cover_value_max_width_dim, + autoWidth .bool_set:N = \l__bithesis_cover_auto_width_bool, + autoWidth .initial:n = {true}, + underlineThickness .dim_set:N = \l__bithesis_cover_underline_thickness_dim, + underlineThickness .initial:n = {1pt}, + underlineOffset .dim_set:N = \l__bithesis_cover_underline_offset_dim, + underlineOffset .initial:n = { -10pt }, + } + +\keys_define:nn { bitreport / info } + { + title .tl_set:N = \l__bithesis_value_title_tl, + school .tl_set:N = \l__bithesis_value_school_tl, + major .tl_set:N = \l__bithesis_value_major_tl, + class .tl_set:N = \l__bithesis_value_class_tl, + author .tl_set:N = \l__bithesis_value_author_tl, + supervisor .tl_set:N = \l__bithesis_value_supervisor_tl, + externalSupervisor .tl_set:N = \l__bithesis_value_external_supervisor_tl, + studentId .tl_set:N = \l__bithesis_value_student_id_tl, + } + +\keys_define:nn { bitreport / misc } + { + reviewTable .tl_set:N = \l_bit_reviewtable_tl, + } + +\ProcessKeysOptions { bitreport / option } + +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx} + +\cs_new:Npn \__bithesis_dunderline:nnn #1#2#3 { + {\setbox0=\hbox{#3}\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}} +} + +\cs_new:Npn \__bithesis_render_cover_entry:nn #1#2 { + \makebox[\l__bithesis_cover_label_max_width_dim][\l__bithesis_cover_label_align_tl]{ + \tl_if_blank:VTF #1 {} {#1\l__bithesis_cover_dilimiter_tl} + } + \hspace{1ex} + \__bithesis_dunderline:nnn{\l__bithesis_cover_underline_offset_dim}{\l__bithesis_cover_underline_thickness_dim}{ + \makebox[\l__bithesis_cover_value_max_width_dim][\l__bithesis_cover_value_align_tl]{#2} + }\par +} + +\cs_new:Npn \__bithesis_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 \__bithesis_get_text_width:Nn { NV } + +\cs_new:Npn \__bithesis_get_max_text_width:NN #1#2 + { + \group_begin: + \seq_set_eq:NN \l__bithesis_tmpa_seq #2 + \dim_zero_new:N \l__bithesis_tmpa_dim + \bool_until_do:nn { \seq_if_empty_p:N \l__bithesis_tmpa_seq } + { + \seq_pop_left:NN \l__bithesis_tmpa_seq \l__bithesis_tmpa_tl + \__bithesis_get_text_width:NV \l__bithesis_tmpa_dim \l__bithesis_tmpa_tl + \dim_gset:Nn #1 { \dim_max:nn {#1} { \l__bithesis_tmpa_dim } } + } + \group_end: + } + +\cs_new:Npn \__bithesis_parse_entry #1 #2 { + \seq_set_split:Nnx \l__bithesis_tmp_right_seq {//} {#2} + \seq_clear:N \l__bithesis_tmp_left_seq + \seq_map_inline:Nn \l__bithesis_tmp_right_seq { + \seq_put_right:Nn \l__bithesis_tmp_left_seq {} + } + \seq_put_left:Nn \l__bithesis_tmp_left_seq {#1} + \seq_pop_right:NN \l__bithesis_tmp_left_seq \g__bithesis_trashcan_tl +} + +\cs_new:Npn \__bithesis_render_cover_entry:n #1 { + \seq_set_from_clist:NN \l__bithesis_input_seq #1 + % parse newline // + \seq_map_inline:Nn \l__bithesis_input_seq { + \__bithesis_parse_entry ##1 + \seq_concat:NNN \l__bithesis_right_seq \l__bithesis_right_seq \l__bithesis_tmp_right_seq + \seq_concat:NNN \l__bithesis_left_seq \l__bithesis_left_seq \l__bithesis_tmp_left_seq + } + + \bool_if:NT \l__bithesis_cover_auto_width_bool { + \__bithesis_get_max_text_width:NN \l__bithesis_cover_label_max_width_dim \l__bithesis_left_seq + \__bithesis_get_max_text_width:NN \l__bithesis_cover_value_max_width_dim \l__bithesis_right_seq + } + + \group_begin: + \bool_until_do:nn { \seq_if_empty_p:N \l__bithesis_left_seq } + { + \seq_pop_left:NN \l__bithesis_left_seq \l__bithesis_tmpa_tl + \seq_pop_left:NN \l__bithesis_right_seq \l__bithesis_tmpb_tl + \tl_if_empty:xTF \l__bithesis_tmpb_tl {} { + \__bithesis_render_cover_entry:nn {\l__bithesis_tmpa_tl} {\l__bithesis_tmpb_tl} + } + } + \group_end: +} + +\DeclareDocumentCommand \BITSetup { m } + { \keys_set:nn { bitreport } { #1 }} +\DeclareDocumentCommand \MakeCover {} + { + \group_begin: + \int_case:nn {\g__bithesis_report_type_int} { + {1} { + \begin{titlepage} + \centering + \vspace{23mm} + \tl_if_empty:NF \l_bit_coverimagepath_tl { + \includegraphics[width=.5\textwidth]{\l_bit_coverimagepath_tl}\\ + } + \vspace{10mm} + \heiti\fontsize{24pt}{24pt}\selectfont{\l__bithesis_value_title_tl}\\ + \vspace{67mm} + \begin{spacing}{2.2} + \songti\zihao{3} + \clist_set:Nn \l__bithesis_input_clist { + {\textbf{学\qquad 院:}} {\l__bithesis_value_school_tl}, + {\textbf{专\qquad 业:}} {\l__bithesis_value_major_tl}, + {\textbf{班\qquad 级:}} {\l__bithesis_value_class_tl}, + {\textbf{学\qquad 号:}} {\l__bithesis_value_student_id_tl}, + {\textbf{姓\qquad 名:}} {\l__bithesis_value_author_tl}, + {\textbf{任课教师:}} {\l__bithesis_value_supervisor_tl}, + } + + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + + \end{spacing} + \vspace*{\fill} + \centering + \songti\fontsize{12pt}{12pt}\selectfont{ + \tl_if_empty:NTF \l__bithesis_cover_date_tl { + \today + } { + \l__bithesis_cover_date_tl + } + } + \end{titlepage} + } + {2} { + % Main code for \MakeCover + \begin{titlepage} + \topskip=0pt + \vspace*{-16mm} + \centering + \hspace{-6mm}\songti\fontsize{22pt}{22pt}\selectfont{北京理工大学}\par + + \vspace{13mm} + + \hspace{-6mm}\heiti\fontsize{24pt}{24pt}\selectfont{本科生毕业设计(论文)开题报告}\par + + \vspace{53mm} + + \begin{spacing}{2.2} + \songti\zihao{3} + \clist_set:Nn \l__bithesis_input_clist { + {\textbf{学\qquad 院:}} {\l__bithesis_value_school_tl}, + {\textbf{专\qquad 业:}} {\l__bithesis_value_major_tl}, + {\textbf{班\qquad 级:}} {\l__bithesis_value_class_tl}, + {\textbf{姓\qquad 名:}} {\l__bithesis_value_author_tl}, + {\textbf{指导教师:}} {\l__bithesis_value_supervisor_tl}, + {\textbf{校外指导教师:}} {\l__bithesis_value_external_supervisor_tl}, + } + + \__bithesis_render_cover_entry:n \l__bithesis_input_clist + + \end{spacing} + + \vspace*{\fill} + + \centering + \hspace{-6mm}\songti\fontsize{12pt}{12pt}\selectfont{\today} + \end{titlepage} + } + } + \group_end: + } + +\DeclareDocumentCommand \MakeReviewTable {} + { + \group_begin: + \begin{titlepage} + \includepdf[pages=-]{\l_bit_reviewtable_tl} + \end{titlepage} + \group_end: + } + +\DeclareCaptionFont{kaiticaption}{\kaishu \normalsize} + +\renewcommand{\thefigure}{\thesection-\arabic{figure}} +\captionsetup[figure]{font=small,labelsep=space,skip=10bp,labelfont=bf,font=kaiticaption} + +\renewcommand{\thetable}{\thesection-\arabic{table}} +\captionsetup[table]{font=small,labelsep=space,skip=10bp,labelfont=bf,font=kaiticaption} + +\ctexset{today=big} + +\setromanfont{Times~New~Roman} + +%% 将中文楷体设置为 SIMKAI.TTF(如果需要) + +\setcounter{tocdepth}{3} +\setcounter{secnumdepth}{3} + +%% +\ctexset{section={ + format={\raggedright \bfseries \songti \zihao{-3}}, + beforeskip = 24bp plus 1ex minus .2ex, + afterskip = 24bp plus .2ex, + fixskip = true, + name = {,.\quad} + } +} +\ctexset{subsection={ + format = {\bfseries \songti \raggedright \zihao{4}}, + beforeskip = 24bp plus 1ex minus .2ex, + afterskip = 24bp plus .2ex, + fixskip = true, + } +} +\fancyhf{} +\int_case:nn {\g__bithesis_report_type_int} { + {1} {\fancyhead[R]{\fontsize{10.5pt}{10.5pt}\selectfont{\l__bithesis_value_title_tl}}} + {2} {\fancyhead[R]{\fontsize{10.5pt}{10.5pt}\selectfont{北京理工大学本科生毕业设计(论文)开题报告}}} +} +\fancyfoot[R]{\fontsize{9pt}{9pt}\selectfont{\thepage}} +\renewcommand{\headrulewidth}{1pt} +\renewcommand{\footrulewidth}{0pt} + +\pagestyle{fancy} +\setcounter{page}{1} + +\cs_set:Npn \baselinestretch {1.53} + +\endinput +%% +%% End of file `bitreport.cls'. |