From 7ebb9e79dc86ac4a98779b738f459b52b734792c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 10 Apr 2022 20:03:48 +0000 Subject: xduts (10apr22) git-svn-id: svn://tug.org/texlive/trunk@62994 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/xelatex/xduts/README.md | 17 +- Master/texmf-dist/doc/xelatex/xduts/xduts.pdf | Bin 306881 -> 316944 bytes Master/texmf-dist/source/xelatex/xduts/xduts.dtx | 2089 +++++++++++--------- Master/texmf-dist/source/xelatex/xduts/xduts.ins | 6 +- Master/texmf-dist/tex/xelatex/xduts/xdufont.sty | 378 ++++ .../texmf-dist/tex/xelatex/xduts/xduugthesis.cls | 409 ++-- 6 files changed, 1710 insertions(+), 1189 deletions(-) create mode 100644 Master/texmf-dist/tex/xelatex/xduts/xdufont.sty diff --git a/Master/texmf-dist/doc/xelatex/xduts/README.md b/Master/texmf-dist/doc/xelatex/xduts/README.md index 120464e3bf7..29153333712 100644 --- a/Master/texmf-dist/doc/xelatex/xduts/README.md +++ b/Master/texmf-dist/doc/xelatex/xduts/README.md @@ -1,16 +1,19 @@ # XDUTS -XDUTS(Xidian University TeX Suite)是面向西安电子科技大学本科生/研究生的LaTeX3模板套装,支持XeLaTeX,支持TeX Live、MacTeX、MiKTeX,支持Windows、macOS、GNU/Linux、Overleaf和TeXPage。旨在帮助西安电子科技大学本科生/研究生撰写开题报告/学位论文,目前有: +[![](https://img.shields.io/ctan/v/xduts)](https://www.ctan.org/pkg/xduts) [![](https://img.shields.io/github/license/note286/xduts)](https://github.com/note286/xduts/blob/main/LICENSE) [![](https://img.shields.io/github/stars/note286/xduts)](https://github.com/note286/xduts) [![](https://img.shields.io/github/issues/note286/xduts)](https://github.com/note286/xduts/issues?q=is%3Aopen+is%3Aissue) [![](https://img.shields.io/github/issues-closed/note286/xduts)](https://github.com/note286/xduts/issues?q=is%3Aissue+is%3Aclosed) [![](https://img.shields.io/github/commit-activity/m/note286/xduts)](https://github.com/note286/xduts/commits/main) [![](https://img.shields.io/github/v/tag/note286/xduts)](https://github.com/note286/xduts/tags) -- xduugthesis,本科毕业设计论文 +XDUTS(Xidian University TeX Suite)是面向西安电子科技大学本科生/研究生的LaTeX3文档类和宏包套装,支持XeLaTeX,支持TeX Live、MacTeX、MiKTeX,支持Windows、macOS、GNU/Linux、Overleaf和TeXPage。旨在帮助西安电子科技大学本科生/研究生撰写开题报告/学位论文及其他文档,目前有: + +- xduugthesis,本科毕业设计论文文档类 +- xdufont,中/英/数学字体配置宏包 即将支持: -- xduugtp,本科生开题报告 -- xdupgthesis,研究生学位论文 -- xdupgtp,研究生开题报告 +- xduugtp,本科生开题报告文档类 +- xdupgthesis,研究生学位论文文档类 +- xdupgtp,研究生开题报告文档类 -# 获取 +## 获取 ```shell xetex xduts.ins @@ -21,6 +24,6 @@ xelatex xduts.dtx xelatex xduts.dtx ``` -# 许可 +## 许可 This material is subject to [the LaTeX Project Public License 1.3c](https://ctan.org/license/lppl1.3). diff --git a/Master/texmf-dist/doc/xelatex/xduts/xduts.pdf b/Master/texmf-dist/doc/xelatex/xduts/xduts.pdf index e59fc17ef2a..6145412d940 100644 Binary files a/Master/texmf-dist/doc/xelatex/xduts/xduts.pdf and b/Master/texmf-dist/doc/xelatex/xduts/xduts.pdf differ diff --git a/Master/texmf-dist/source/xelatex/xduts/xduts.dtx b/Master/texmf-dist/source/xelatex/xduts/xduts.dtx index 81d798f991a..691a2a6e209 100644 --- a/Master/texmf-dist/source/xelatex/xduts/xduts.dtx +++ b/Master/texmf-dist/source/xelatex/xduts/xduts.dtx @@ -1,14 +1,18 @@ % \iffalse %<*driver> \ProvidesFile{xduts.dtx} -[2022/04/09 v0.5.2.1 Xidian University TeX Suite] +[2022/04/10 v0.6.0.0 Xidian University TeX Suite] % -%\NeedsTeXFormat{LaTeX2e} -%\RequirePackage{expl3} +%\NeedsTeXFormat{LaTeX2e} +%\RequirePackage{expl3} %\ProvidesExplClass{xduugthesis} -% {2022/04/09}{0.5.2.1}{Xidian University Undergraduate Thesis class} +%\ProvidesExplPackage{xdufont} +% {2022/04/10}{0.6.0.0} +% {Xidian University Font package} +% {Xidian University Undergraduate Thesis class} %<*driver> \documentclass{ctxdoc} +\changes{v0.6.0.0}{2022/04/10}{新增xdufont宏包} \changes{v0.5.2.1}{2022/04/09}{修改项目名称} \changes{v0.4.2.1}{2022/04/05}{调整文档目录缩进} \usepackage{tocloft} @@ -64,6 +68,8 @@ \newcommand{\valuex}[1]{\xspace\texttt{#1}\xspace} % 命令 \newcommand{\cmdx}[1]{\xspace\texttt{#1}\xspace} +% 引用 +\newcommand{\secrefx}[1]{第\xspace\ref{#1}\xspace 节} % 链接 \newcommand{\footurl}[1]{\footnote{\url{#1}}} \newcommand{\ctanurl}[1]{\href{https://mirrors.ustc.edu.cn/CTAN/#1}{\ttfamily CTAN://#1}} @@ -77,6 +83,10 @@ \newcommand{\biber}{\xspace\hologo{biber}\xspace\xspace} % arguments list \setlist[arguments]{label=\texttt{\#\arabic*}\,:} +% 浮动体默认设置 +\makeatletter +\renewcommand{\fps@table}{htbp} +\makeatother % listings \definecolor{xdu-ai-orange}{cmyk}{0,0.75,1,0} \definecolor{xdu-blue}{cmyk}{0.80,0.50,0,0} @@ -93,7 +103,7 @@ frame = l, framerule = 1 pt, framesep = 0 pt, - xleftmargin = 2 em, + xleftmargin = 0 em, xrightmargin = 3 em, escapeinside = {(*}{*)}, breaklines = true, @@ -133,7 +143,7 @@ \end{document} % % \fi -% \CheckSum{822} +% \CheckSum{823} % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -156,21 +166,22 @@ % \maketitle % \thispagestyle{empty} % \begin{abstract} -% \xduts{}是面向西安电子科技大学本科生/研究生的\LaTeXiii{}模板套装, +% \xduts{}是面向西安电子科技大学本科生/研究生的\LaTeXiii{}文档类和宏包套装, % 支持\XeLaTeX{}, % 支持\texlive{}、\mactex{}、\miktex{}, % 支持Windows、macOS、GNU/Linux、Overleaf和TeXPage。 % \end{abstract} -% \renewcommand\abstractname{免责声明} +% \renewcommand{\abstractname}{免责声明} % \begin{abstract} -% \noindent +% 在使用\xduts{}时,默认您同意以下内容: % \begin{enumerate} -% \item 本模板的发布遵守 +% \item \xduts{}作者不对使用\xduts{}产生的格式审查问题负责。 +% \item \xduts{}的发布遵守 % \LaTeX{} Project Public License\footurl{https://www.latex-project.org/lppl.txt}, % 使用前请认真阅读协议内容。 -% \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板, +% \item 任何个人或组织以\xduts{}为基础进行修改、扩展而生成的新的\LaTeX{}文档类/宏包, % 请严格遵守\LaTeX{} Project Public License, -% 由于违犯协议而引起的任何纠纷争端均与本模板作者无关。 +% 由于违犯协议而引起的任何纠纷争端均与\xduts{}作者无关。 % \end{enumerate} % \end{abstract} % \clearpage @@ -178,41 +189,55 @@ % \clearpage % \section{介绍} % \xduts{} (Xidian University \TeX{} Suite) -% 是为了帮助西安电子科技大学本科生/研究生撰写开题报告/学位论文而编写的\LaTeX{}模板套装,目前有: +% 是为了帮助西安电子科技大学本科生/研究生撰写开题报告/学位论文及其他文档 +% 而编写的\LaTeX{}文档类和宏包套装,目前有: % \begin{itemize} % \item \clsx{xduugthesis},本科毕业设计论文。 +% \item \pkgx{xdufont},中/英/数学字体配置宏包。 +% \end{itemize} +% 即将支持: +% \begin{itemize} +% \item \clsx{xduugtp},本科毕业设计论文开题报告表。 +% \item \clsx{xdupgthesis},研究生学位论文。 +% \item \clsx{xdupgtp},研究生学位论文开题报告表。 % \end{itemize} % \par -% 本文档将尽量完整的介绍模板的使用方法, +% 本文档将尽量完整的介绍\xduts{}的使用方法, % 如有不清楚之处,或者想提出改进建议, % 可以在GitHub Issues\footurl{https://github.com/note286/xduts/issues/} -% 参与讨论或提问。另外,不接受任何Pull Requests。 -% \par -% 请在最新版\LaTeX{}环境中使用最新版\xduts{}, -% 《一份(不太)简短的\LaTeXe{}介绍》\footctan{info/lshort/chinese/lshort-zh-cn.pdf} -% 中提及的内容本文档将不再提及。 -% \section{贡献者} -% \xduts{}的开发过程中,维护者为 -% \href{https://github.com/note286/}{\ttfamily @note286}。 -% 同时,也要感谢所有在GitHub和睿思上提出问题的同学、老师们。 -% \xduts{}的持续发展,离不开你们的帮助与支持。 -% \section{致谢} -% 在学习文学编程的过程中, -% 《在\LaTeX{}中进行文学编程》\footurl{https://liam.page/2015/01/23/literate-programming-in-latex/} -% 和《Good things come in little packages: An introduction to writing .ins and .dtx files》\footurl{https://www.tug.org/TUGboat/tb29-2/tb92pakin.pdf} -% 提供了很大帮助。 -% 在文档的编写过程中,参考了 -% \filex{ctex.dtx}\footctan{language/chinese/ctex/ctex.dtx}、 -% \filex{fduthesis.dtx}\footctan{macros/latex/contrib/fduthesis/fduthesis.dtx}、 -% \filex{njuthesis.dtx}\footctan{macros/unicodetex/latex/njuthesis/njuthesis.dtx}、 -% \filex{thuthesis.dtx}\footctan{macros/latex/contrib/thuthesis/thuthesis.dtx}。 +% 参与讨论或提问。另外,\textbf{不接受任何Pull Requests}。 % \StopEventually{} % \section{使用说明} -% \subsection{基本用法} -% \changes{v0.5.1.2}{2022/04/07}{增加编译说明} -% \LaTeX{}本身是命令行程序,通过不同的命令调用所需的编译引擎,编辑器提供的快捷按钮实际只是做了包装。\xduts{}仅支持\XeLaTeX{},参考文献默认使用\biber{},也可以切换为\bibtex{},如何编译\LaTeX{}请学习《一份(不太)简短的\LaTeXe{}介绍》中相关内容。 -% \subsubsection{xduugthesis} -% \paragraph{标准结构} +% \label{使用说明} +% 《一份(不太)简短的\LaTeXe{}介绍》\footctan{info/lshort/chinese/lshort-zh-cn.pdf} +% 中提及的内容本文档将不再提及。 +% \xduts{}中的所有文档类和宏包仅内置了实现功能所必要的宏包, +% 对于常用的宏包如\pkgx{subfig}、\pkgx{algpseudocodex}、 +% \pkgx{amsmath}、\pkgx{amsthm}和\pkgx{siunitx}等均未内置, +% 用户视需求自行加载。 +% 请在最新版\LaTeX{}环境中使用最新版\xduts{}, +% 认真阅读相应文档类/宏包使用说明章节即可使用\xduts{}。 +% \par +% 相应格式规范均已实现,用户仅需要撰写文章内容即可,请勿随意添加格式修改命令。 +% \subsection{xdufont} +% \pkgx{xdufont}宏包基于\pkgx{xeCJK},相较于\pkgx{ctex}宏包的主要优势为默认支持宋体粗体、斜体,内置多种字体配置,可任意搭配中/英/数学字体,更加符合校内各种文档的撰写要求。 +% \par +% \secrefx{编译}介绍了如何编译,\secrefx{参数设置}介绍了如何自定义配置,具体的配置选项见\secrefx{字体选项}。\pkgx{xdufont}可以搭配任意文档类进行使用,例如: +% \begin{latexexample}[moretexcs={\xdusetup},emph={[1]document}] +% \documentclass{article} +% \usepackage{xdufont} +% \xdusetup{} +% \begin{document} +% 宋体\textbf{加粗}\textsl{加斜} +% \textsf{黑体}\textbf{\textsf{加粗}}\textsl{\textsf{加斜}} +% \end{document} +% \end{latexexample} +% \par +% 学会以上用法后即可立即使用\pkgx{xdufont}宏包了。 +% \subsection{xduugthesis} +% \pkgx{xduugthesis}基于\clsx{ctexbook}文档类, +% 提供多种字体配置,部分样式可自定义,信息录入便捷。 +% \par % 典型的\clsx{xduugthesis}主文件结构应该如下所示: % \begin{latexexample}[moretexcs={\xdusetup,\frontmatter,\mainmatter,\chapter,\backmatter},emph={[1]document}] % \documentclass{xduugthesis} @@ -225,25 +250,63 @@ % \backmatter % \end{document} % \end{latexexample} -% \paragraph{命令与环境} -% \subparagraph{附录环境} -% 附录位于参考文献后,即在\tnx{backmatter}后。 -% \begin{latexexample}[emph={[1]appendixes}] -% \begin{appendixes} -% \chapter{这是一个附录} -% \chapter{这是另一个附录} -% \end{appendixes} +% \par +% \secrefx{编译}介绍了如何编译,\secrefx{参数设置}介绍了如何自定义配置。 +% 其中,字体选项见\secrefx{字体选项}, +% 部分英文字体切换见\secrefx{英文字体}, +% 论文语言切换见\secrefx{语言配置}, +% 参考文献配置见\secrefx{参考文献配置}, +% 图片配置见\secrefx{图片配置}, +% 章节配置见\secrefx{章节配置}。 +% 如需附录,请使用附录环境,具体见\secrefx{附录环境}。 +% 仅支持如下信息录入,具体每个选项的含义见\secrefx{信息录入},如没有部分选项,则删除该行即可。 +% \begin{latexexample}[moretexcs={\xdusetup},emph={[2]info}] +% \xdusetup { +% info = { +% title = {第一行标题\\第二行标题}, +% department = {电子工程学院}, +% major = {电子信息工程}, +% author = {张三}, +% supervisor = {李四}, +% supervisor-department = {王五}, +% supervisor-enterprise = {赵六}, +% supervisor-school = {刘七}, +% class-id = {123456}, +% student-id = {12345678910}, +% abstract = {abstract-zh.tex}, +% abstract* = {abstract-en.tex}, +% keywords = {我,就是,充数的,关键词}, +% keywords* = {Dummy,Keywords,Here,it is}, +% acknowledgements = {acknowledgements.tex} +% } +% } % \end{latexexample} +% \par +% 学会以上用法后即可立即使用\clsx{xduugthesis}文档类了。 +% \section{功能说明} +% 请根据\secrefx{使用说明}中相应文档类/宏包的说明来选择性地阅读本节内容。 +% \subsection{编译} +% \label{编译} +% \changes{v0.5.1.2}{2022/04/07}{增加编译说明} +% \LaTeX{}本身是命令行程序,通过不同的命令调用所需的编译引擎,编辑器提供的快捷按钮实际只是做了包装。\xduts{}仅支持\XeLaTeX{},参考文献默认使用\biber{},也可以切换为\bibtex{}。 % \subsection{参数设置} +% \label{参数设置} +% \changes{v0.5.1.1}{2022/04/06}{增加xdusetup配置文档} % \begin{function}[added=2022-03-07]{\xdusetup} % \begin{syntax} % \tnx{xdusetup}=\argx{键值列表} % \end{syntax} -% 本模板提供了一系列选项,可自行配置。载入文档类之后,以下所有选项均可通过统一的命令\tnx{xdusetup}来设置。下文中尖括号内列出了若干个允许的选项,其中加粗的为默认选项。 -% \changes{v0.5.1.1}{2022/04/06}{增加xdusetup配置文档} -% \csx{xdusetup}的参数是一组由(英文)逗号隔开的选项列表,列表中的选项通常是\kvoptx{\metax{key}}{\metax{value}}的形式。 -% \csx{xdusetup}采用\LaTeXiii{}风格的键值设置,支持不同类型以及多种层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意,参数列表中不可以出现空行。 -% 一些选项包含子选项,如\optx{style}和\optx{info}等,它们可以按如下两种等价方式来设定: +% \xduts{}提供了一系列选项,可自行配置。 +% 载入文档类/宏包之后,以下所有选项均可通过统一的命令\tnx{xdusetup}来设置。 +% \csx{xdusetup}的参数是一组由(英文)逗号隔开的选项列表, +% 下文中尖括号内列出了若干个允许的选项,其中加粗的为默认选项。 +% 列表中的选项通常是\kvoptx{\metax{key}}{\metax{value}}的形式。 +% \csx{xdusetup}采用\LaTeXiii{}风格的键值设置, +% 支持不同类型以及多种层次的选项设定。 +% 键值列表中,“|=|”左右的空格不影响设置; +% 但需注意,参数列表中不可以出现空行。 +% 一些选项包含子选项,如\optx{style}和\optx{info}等, +% 它们可以按如下两种等价方式来设定: % \begin{latexexample}[morekeywords={\xdusetup},emph={[1]style,cjk-font,latin-font,info,title,author,department}] % \xdusetup{ % style = {cjk-font = adobe, latin-font = tacn}, @@ -265,9 +328,8 @@ % } % \end{latexexample} % \end{function} -% \subsubsection{通用} -% \paragraph{字体配置} -% 设置字体配置后或不手动配置而使用默认值,请确保相应字体文件已安装。 +% \subsection{字体选项} +% \label{字体选项} % \begin{function}[added=2022-03-06]{style/cjk-font} % \begin{syntax} % \optx{style/cjk-font}=\metax{adobe|fandol|founder|sinotype|(win)|none} @@ -413,6 +475,8 @@ % \end{syntax} % 设置字体文件路径,即\metax{路径}目录内存储全部所需中文、英文和数学字体文件,仅在\optx{font-type}等于|file|时有效,默认值为\valuex{fonts}。 % \end{function} +% \subsection{英文字体} +% \label{英文字体} % \begin{function}[added=2022-04-01]{style/en-cjk-font} % \begin{syntax} % \optx{style/en-cjk-font}=\metax{true|(false)} @@ -423,7 +487,8 @@ % \item[true] 英文使用相对应字体族的中文字体。 % \item[false] 英文使用相对应字体族的英文字体。 % \end{optdesc} -% \paragraph{语言配置} +% \subsection{语言配置} +% \label{语言配置} % \begin{function}[added=2022-03-29]{style/language} % \begin{syntax} % \optx{style/language}=\metax{(zh)|en} @@ -434,7 +499,8 @@ % \item[zh] 中文。 % \item[en] 英文。 % \end{optdesc} -% \paragraph{参考文献配置} +% \subsection{参考文献配置} +% \label{参考文献配置} % \begin{function}[added=2022-04-02,updated=2022-04-03]{style/bib-backend} % \begin{syntax} % \optx{style/bib-backend}=\metax{bibtex|(biblatex)} @@ -451,14 +517,16 @@ % \end{syntax} % 设置参考文献\filex{.bib}文件,多个文件之间需要使用英文半角逗号隔开。 % \end{function} -% \paragraph{图片配置} +% \subsection{图片配置} +% \label{图片配置} % \begin{function}[added=2022-04-03]{style/fig-label-sep} % \begin{syntax} % \optx{style/fig-label-sep}=\argx{间距} % \end{syntax} % 设置图片标签与后面标题之间的间距,默认值为\valuex{0.75em}。 % \end{function} -% \paragraph{章节配置} +% \subsection{章节配置} +% \label{章节配置} % \begin{function}[added=2022-04-05]{style/before-skip} % \begin{syntax} % \optx{style/before-skip}=\argx{间距列表} @@ -471,8 +539,19 @@ % \end{syntax} % 设置章节标题后的垂直间距,默认值为\valuex{\{18pt, 12pt, 6pt, 6pt, 6pt, 6pt\}},分别对应\tnx{chapter}、\tnx{section}、\tnx{subsection}、\tnx{subsubsection}、\tnx{paragraph}和\tnx{subparagraph}。 % \end{function} -% \subsubsection{xduugthesis} -% \paragraph{信息配置} +% \subsection{附录环境} +% \label{附录环境} +% \begin{function}[added=2022-04-04]{appendixes} +% 附录位于参考文献后,即在\tnx{backmatter}后。 +% \begin{latexexample}[emph={[1]appendixes}] +% \begin{appendixes} +% \chapter{这是一个附录} +% \chapter{这是另一个附录} +% \end{appendixes} +% \end{latexexample} +% \end{function} +% \subsection{信息录入} +% \label{信息录入} % \begin{function}[added=2022-04-01]{info/title} % \begin{syntax} % \optx{info/title}=\argx{论文标题} @@ -538,7 +617,7 @@ % \optx{info/abstract}=\argx{中文摘要文件路径} % \optx{info/abstract*}=\argx{英文摘要文件路径} % \end{syntax} -% 设置摘要文件路径。 +% 设置摘要文件路径,相应文件内仅撰写摘要内容,无需任何环境。 % \end{function} % \begin{function}[added=2022-04-02]{info/keywords,info/keywords*} % \begin{syntax} @@ -551,44 +630,90 @@ % \begin{syntax} % \optx{info/acknowledgements}=\argx{致谢文件路径} % \end{syntax} -% 设置致谢文件路径。 +% 设置致谢文件路径,相应文件内仅撰写致谢内容,无需任何环境。 % \end{function} -% \paragraph{输入示范} -% 可以参考如下范例输入个人信息。注意不能有空行。 -% \begin{latexexample}[moretexcs={\xdusetup},emph={[2]info}] -% \xdusetup { -% info = { -% title = {第一行标题\\第二行标题}, -% department = {电子工程学院}, -% major = {电子信息工程}, -% author = {张三}, -% supervisor = {李四}, -% supervisor-department = {王五}, -% class-id = {123456}, -% student-id = {12345678910}, -% abstract = {abstract-zh.tex}, -% abstract* = {abstract-en.tex}, -% keywords = {我,就是,充数的,关键词}, -% keywords* = {Dummy,Keywords,Here,it is}, -% acknowledgements = {acknowledgements.tex} -% } -% } -% \end{latexexample} +% \section{贡献者} +% \xduts{}的开发过程中,维护者为 +% \href{https://github.com/note286/}{\ttfamily @note286}。 +% 同时,也要感谢所有在GitHub和睿思上提出问题的同学、老师们。 +% \xduts{}的持续发展,离不开你们的帮助与支持。 +% \section{致谢} +% 在学习文学编程的过程中, +% 《在\LaTeX{}中进行文学编程》\footurl{https://liam.page/2015/01/23/literate-programming-in-latex/} +% 和《Good things come in little packages: An introduction to writing .ins and .dtx files》\footurl{https://www.tug.org/TUGboat/tb29-2/tb92pakin.pdf} +% 提供了很大帮助。 +% 在文档的编写过程中,参考了 +% \filex{ctex.dtx}\footctan{language/chinese/ctex/ctex.dtx}、 +% \filex{fduthesis.dtx}\footctan{macros/latex/contrib/fduthesis/fduthesis.dtx}、 +% \filex{njuthesis.dtx}\footctan{macros/unicodetex/latex/njuthesis/njuthesis.dtx} +% 和\filex{thuthesis.dtx}\footctan{macros/latex/contrib/thuthesis/thuthesis.dtx}。 % \clearpage % \section{代码实现} % \changes{v0.1.0.0}{2022/04/03}{基本完成本科毕业设计论文模板} % \setlength\parindent{0pt} -% \subsection{通用} % \begin{macrocode} %<@@=xdu> % \end{macrocode} +% \subsection{文档类和宏包} % \begin{macrocode} -%<*class> +%<*class|sty> % \end{macrocode} % \begin{macrocode} \RequirePackage { xparse, l3keys2e } % \end{macrocode} -% \subsubsection{键值选项定义} +% \begin{macro}{\PassOptionsToPackage} +% 忽略字体警告。 +% \begin{macrocode} +\PassOptionsToPackage { quiet } { xeCJK } +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +% +%<*class> +% \end{macrocode} +% \begin{macro}{\PassOptionsToClass,\LoadClass} +% 加载\clsx{ctexbook}文档类。 +% \changes{v0.3.2.0}{2022/04/04}{修正行间距为1.5倍} +% \begin{macrocode} +\PassOptionsToClass + { + zihao=-4, + sub4section, + linespread = 1.5, + fontset = none + } + { ctexbook } +\LoadClass { ctexbook } +% \end{macrocode} +% \end{macro} +% 设置纸张尺寸为A4。 +% \begin{macrocode} +\RequirePackage { geometry } +\geometry { paper = a4paper } +% \end{macrocode} +% \begin{macrocode} +% +%<*xduugthesis> +% \end{macrocode} +% \begin{macrocode} +\RequirePackage { fancyhdr } +\RequirePackage { xeCJKfntef } +\RequirePackage { graphicx } +% \end{macrocode} +% \begin{macrocode} +% +%<*xdufont> +% \end{macrocode} +% \begin{macrocode} +\RequirePackage { xeCJK } +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} +% \subsection{字体配置} +% \begin{macrocode} +%<*class|xdufont> +% \end{macrocode} % \begin{variable} % { % \l_@@_cjk_font_tl, @@ -598,14 +723,7 @@ % \l_@@_math_font_tl, % \l_@@_unicode_math_tl, % \l_@@_font_type_tl, -% \l_@@_font_path_tl, -% \l_@@_en_cjk_font_bool, -% \l_@@_lang_tl, -% \l_@@_bib_tool_tl, -% \l_@@_bib_file_clist, -% \l_@@_fig_label_sep_tl, -% \l_@@_before_skip_clist, -% \l_@@_after_skip_clist +% \l_@@_font_path_tl % } % 中文字体配置名称。 % \begin{macrocode} @@ -639,31 +757,6 @@ % \begin{macrocode} \tl_new:N \l_@@_font_path_tl % \end{macrocode} -% 英文是否使用中文字体。 -% \begin{macrocode} -\bool_new:N \l_@@_en_cjk_font_bool -% \end{macrocode} -% 语言。 -% \begin{macrocode} -\tl_new:N \l_@@_lang_tl -% \end{macrocode} -% 参考文献支持方式。 -% \begin{macrocode} -\tl_new:N \l_@@_bib_tool_tl -% \end{macrocode} -% 参考文献文件。 -% \begin{macrocode} -\clist_new:N \l_@@_bib_file_clist -% \end{macrocode} -% 图片标签与后面标题之间的间距。 -% \begin{macrocode} -\tl_new:N \l_@@_fig_label_sep_tl -% \end{macrocode} -% 设置章节标题前后的垂直间距。 -% \begin{macrocode} -\clist_new:N \l_@@_before_skip_clist -\clist_new:N \l_@@_after_skip_clist -% \end{macrocode} % \end{variable} % \begin{macro}{\keys_define:nn} % 定义样式键值。 @@ -707,857 +800,893 @@ % \end{macrocode} % 字体文件路径配置。 % \begin{macrocode} - font-path .tl_set:N = \l_@@_font_path_tl, + font-path .tl_set:N = \l_@@_font_path_tl + } % \end{macrocode} -% 英文是否使用中文字体。 +% \end{macro} +% \begin{macro}{\keys_set:nn} +% 初始设置。 % \begin{macrocode} - en-cjk-font .bool_set:N = \l_@@_en_cjk_font_bool, +\keys_set:nn { xdu } + { + style / cjk-font = win, + style / cjk-fake-bold = 3, + style / cjk-fake-slant = 0.2, + style / latin-font = tacn, + style / math-font = cm, + style / unicode-math = { }, + style / font-type = font, + style / font-path = fonts + } % \end{macrocode} -% 论文语言配置。 +% \end{macro} +% \begin{macro}{\@@_if_platform_macos:FT} +% \changes{v0.5.1.0}{2022/04/06}{判断操作系统是否是macOS} +% 判断操作系统是否是macOS。 +% \begin{arguments} +% \item 非macOS。 +% \item macOS。 +% \end{arguments} % \begin{macrocode} - language .choices:nn = { zh, en } - { \tl_set_eq:NN \l_@@_lang_tl \l_keys_choice_tl }, +\cs_new:Npn \@@_if_platform_macos:FT #1#2 + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } } % \end{macrocode} -% 参考文献支持方式配置。 +% \end{macro} +% \begin{macro}{\@@_texmf_font:nn} +% \changes{v0.5.1.0}{2022/04/06}{加载字体时自动判断是否为macOS平台} +% 调用TEXMF中的字体时根据操作系统是否是macOS自动选择调用字体名或文件名。 +% \begin{arguments} +% \item 字体名。 +% \item 文件名。 +% \end{arguments} % \begin{macrocode} - bib-backend .choices:nn = { bibtex, biblatex } - { \tl_set_eq:NN \l_@@_bib_tool_tl \l_keys_choice_tl }, +\cs_new:Npn \@@_texmf_font:nn #1#2 + { \@@_if_platform_macos:FT { #1 } { #2 } } % \end{macrocode} -% 参考文献文件。 +% \end{macro} +% \begin{macro}{\@@_select_font:nn} +% 自动选择字体文件名称或字体名称。 +% \begin{arguments} +% \item 字体名称。 +% \item 字体文件名称。 +% \end{arguments} % \begin{macrocode} - bib-resource .clist_set:N = \l_@@_bib_file_clist, +\cs_new:Npn \@@_select_font:nn #1#2 + { + \str_if_eq:NNTF { \l_@@_font_type_tl } { font } + { #1 } + { #2 } + } % \end{macrocode} -% 图片标签与后面标题之间的间距。 +% \end{macro} +% \begin{macro}{\@@_font_path:} +% 当选择使用字体文件配置字体时,设置字体文件路径。 % \begin{macrocode} - fig-label-sep .tl_set:N = \l_@@_fig_label_sep_tl, +\cs_new:Npn \@@_font_path: + { + \str_if_eq:NNTF { \l_@@_font_type_tl } { font } + { } + { Path = \l_@@_font_path_tl / , } + } % \end{macrocode} -% 设置章节标题前的垂直间距。 +% \end{macro} +% \subsubsection{中文字体} +% \begin{macro}{\@@_cfg_cjk_font_sub_b:} +% 中文粗体。 % \begin{macrocode} - before-skip .clist_set:N = \l_@@_before_skip_clist, +\cs_new:Npn \@@_cfg_cjk_font_sub_b:n #1 + { + BoldFont = { #1 } + } % \end{macrocode} -% 设置章节标题后的垂直间距。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_fb:n} +% 中文伪粗体。 % \begin{macrocode} - after-skip .clist_set:N = \l_@@_after_skip_clist +\cs_new:Npn \@@_cfg_cjk_font_sub_fb:n #1 + { + BoldFont = { #1 }, + BoldFeatures = { FakeBold = \l_@@_fake_bold_str } } % \end{macrocode} % \end{macro} -% \begin{variable} -% { -% \l_@@_title_str, -% \l_@@_title_i_str, -% \l_@@_title_ii_str, -% \l_@@_dept_str, -% \l_@@_major_str, -% \l_@@_author_str, -% \l_@@_supv_str, -% \l_@@_supv_dept_str, -% \l_@@_supv_ent_str, -% \l_@@_supv_sch_str, -% \l_@@_class_id_str, -% \l_@@_student_id_str, -% \l_@@_abstract_zh_tl, -% \l_@@_abstract_en_tl, -% \l_@@_keywords_zh_clist, -% \l_@@_keywords_en_clist, -% \l_@@_ack_tl -% } -% 论文标题。 +% \begin{macro}{\@@_cfg_cjk_font_sub_fs:n} +% 中文伪斜体。 % \begin{macrocode} -\str_new:N \l_@@_title_str -\str_new:N \l_@@_title_i_str -\str_new:N \l_@@_title_ii_str +\cs_new:Npn \@@_cfg_cjk_font_sub_fs:n #1 + { + SlantedFont = { #1 }, + SlantedFeatures = { FakeSlant = \l_@@_fake_slant_str } + } % \end{macrocode} -% 院系名称。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_fbfs:n} +% 中文伪粗斜体。 % \begin{macrocode} -\str_new:N \l_@@_dept_str +\cs_new:Npn \@@_cfg_cjk_font_sub_fbfs:n #1 + { + BoldSlantedFont = { #1 }, + BoldSlantedFeatures = + { + FakeBold = \l_@@_fake_bold_str, + FakeSlant = \l_@@_fake_slant_str + } + } % \end{macrocode} -% 专业名称。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_bfs:n} +% 中文粗伪斜体。 % \begin{macrocode} -\str_new:N \l_@@_major_str +\cs_new:Npn \@@_cfg_cjk_font_sub_bfs:n #1 + { + BoldSlantedFont = { #1 }, + BoldSlantedFeatures = { FakeSlant = \l_@@_fake_slant_str } + } % \end{macrocode} -% 作者姓名。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_i:n} +% 中文意大利体。 % \begin{macrocode} -\str_new:N \l_@@_author_str +\cs_new:Npn \@@_cfg_cjk_font_sub_i:n #1 + { + ItalicFont = { #1 } + } % \end{macrocode} -% 导师姓名。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_fi:n} +% 中文伪意大利体,即伪斜体。 % \begin{macrocode} -\str_new:N \l_@@_supv_str +\cs_new:Npn \@@_cfg_cjk_font_sub_fi:n #1 + { + ItalicFont = { #1 }, + ItalicFeatures = { FakeSlant = \l_@@_fake_slant_str } + } % \end{macrocode} -% 院内导师姓名。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_ifb:n} +% 中文意大利体伪粗体。 % \begin{macrocode} -\str_new:N \l_@@_supv_dept_str +\cs_new:Npn \@@_cfg_cjk_font_sub_ifb:n #1 + { + BoldItalicFont = { #1 }, + BoldItalicFeatures = { FakeBold = \l_@@_fake_bold_str } + } % \end{macrocode} -% 校外导师姓名。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_sub_fifb:n} +% 中文伪意大利体伪粗体。 % \begin{macrocode} -\str_new:N \l_@@_supv_ent_str +\cs_new:Npn \@@_cfg_cjk_font_sub_fifb:n #1 + { + BoldItalicFont = { #1 }, + BoldItalicFeatures = + { + FakeBold = \l_@@_fake_bold_str, + FakeSlant = \l_@@_fake_slant_str + } + } % \end{macrocode} -% 校内导师姓名。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_r:n} +% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体。 % \begin{macrocode} -\str_new:N \l_@@_supv_sch_str +\cs_new:Npn \@@_cfg_cjk_font_r:n #1 + { + \@@_cfg_cjk_font_sub_fb:n { #1 }, + \@@_cfg_cjk_font_sub_fs:n { #1 }, + \@@_cfg_cjk_font_sub_fbfs:n { #1 }, + \@@_cfg_cjk_font_sub_fi:n { #1 }, + \@@_cfg_cjk_font_sub_fifb:n { #1 } + } % \end{macrocode} -% 作者班级号。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_rb:nn} +% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体,其中粗体和斜粗体为其他字体。 +% \begin{arguments} +% \item 常规字体。 +% \item 粗体字体。 +% \end{arguments} % \begin{macrocode} -\str_new:N \l_@@_class_id_str +\cs_new:Npn \@@_cfg_cjk_font_rb:nn #1#2 + { + \@@_cfg_cjk_font_sub_b:n { #2 }, + \@@_cfg_cjk_font_sub_fs:n { #1 }, + \@@_cfg_cjk_font_sub_bfs:n { #2 }, + \@@_cfg_cjk_font_sub_fi:n { #1 }, + \@@_cfg_cjk_font_sub_fifb:n { #1 } + } % \end{macrocode} -% 作者学号。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_ri:nn} +% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体,其中意大利体和粗意大利体为其他字体。 +% \begin{arguments} +% \item 常规字体。 +% \item 意大利体字体。 +% \end{arguments} % \begin{macrocode} -\str_new:N \l_@@_student_id_str +\cs_new:Npn \@@_cfg_cjk_font_ri:nn #1#2 + { + \@@_cfg_cjk_font_sub_fb:n { #1 }, + \@@_cfg_cjk_font_sub_fs:n { #1 }, + \@@_cfg_cjk_font_sub_fbfs:n { #1 }, + \@@_cfg_cjk_font_sub_i:n { #2 }, + \@@_cfg_cjk_font_sub_ifb:n { #2 } + } % \end{macrocode} -% 中文摘要。 +% \end{macro} +% \begin{macro}{\@@_cfg_cjk_font_rbi:nnn} +% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体,其中粗体、斜粗体、意大利体和粗意大利体为其他字体。 +% \begin{arguments} +% \item 常规字体。 +% \item 粗体字体。 +% \item 意大利体字体。 +% \end{arguments} % \begin{macrocode} -\tl_new:N \l_@@_abstract_zh_tl +\cs_new:Npn \@@_cfg_cjk_font_rbi:nnn #1#2#3 + { + \@@_cfg_cjk_font_sub_b:n { #2 }, + \@@_cfg_cjk_font_sub_fs:n { #1 }, + \@@_cfg_cjk_font_sub_bfs:n { #2 }, + \@@_cfg_cjk_font_sub_i:n { #3 }, + \@@_cfg_cjk_font_sub_ifb:n { #3 } + } % \end{macrocode} -% 英文摘要。 +% \end{macro} +% \begin{macro}{\@@_set_cjk_main_font:nn,\@@_set_cjk_main_font:nnn} +% 配置中文罗马族字体。 +% \begin{arguments} +% \item 宋体字体。 +% \item 楷体字体。 +% \end{arguments} % \begin{macrocode} -\tl_new:N \l_@@_abstract_en_tl +\cs_new:Npn \@@_set_cjk_main_font:nn #1#2 + { + \setCJKmainfont { #1 } + [ \@@_font_path: \@@_cfg_cjk_font_ri:nn { #1 } { #2 } ] + } +\cs_new:Npn \@@_set_cjk_main_font:nnn #1#2#3 + { + \setCJKmainfont { #1 } + [ \@@_font_path: \@@_cfg_cjk_font_rbi:nnn { #1 } { #2 } { #3 } ] + } % \end{macrocode} -% 中文关键词。 +% \end{macro} +% \begin{macro}{\@@_set_cjk_sans_font:n,\@@_set_cjk_sans_font:nn} +% 配置中文无衬线族字体。 % \begin{macrocode} -\clist_new:N \l_@@_keywords_zh_clist +\cs_new:Npn \@@_set_cjk_sans_font:n #1 + { + \setCJKsansfont { #1 } + [ \@@_font_path: \@@_cfg_cjk_font_r:n { #1 } ] + } +\cs_new:Npn \@@_set_cjk_sans_font:nn #1#2 + { + \setCJKsansfont { #1 } + [ \@@_font_path: \@@_cfg_cjk_font_rb:nn { #1 } { #2 } ] + } % \end{macrocode} -% 英文关键词。 +% \end{macro} +% \begin{macro}{\@@_set_cjk_mono_font:n} +% 配置中文等宽族字体。 % \begin{macrocode} -\clist_new:N \l_@@_keywords_en_clist +\cs_new:Npn \@@_set_cjk_mono_font:n #1 + { + \setCJKmonofont { #1 } + [ \@@_font_path: \@@_cfg_cjk_font_r:n { #1 } ] + } % \end{macrocode} -% 致谢。 +% \end{macro} +% \begin{macro}{\@@_load_cjk_font_win:} +% 中文字体配置\valuex{win}。 % \begin{macrocode} -\tl_new:N \l_@@_ack_tl +\cs_new:Npn \@@_load_cjk_font_win: + { + \@@_set_cjk_main_font:nn + { \@@_select_font:nn { SimSun } { simsun.ttc } } + { \@@_select_font:nn { KaiTi } { simkai.ttf } } + \@@_set_cjk_sans_font:n + { \@@_select_font:nn { SimHei } { simhei.ttf } } + \@@_set_cjk_mono_font:n + { \@@_select_font:nn { FangSong } { simfang.ttf } } + } % \end{macrocode} -% \end{variable} -% \begin{macro}{\keys_define:nn} -% 定义信息键值。 +% \end{macro} +% \begin{macro}{\@@_load_cjk_font_adobe:} +% 中文字体配置\valuex{adobe}。 % \begin{macrocode} -\keys_define:nn { xdu / info } +\cs_new:Npn \@@_load_cjk_font_adobe: { + \@@_set_cjk_main_font:nn + { \@@_select_font:nn { Adobe~Song~Std } { adobesongstd-light.otf } } + { \@@_select_font:nn { Adobe~Kaiti~Std } { adobekaitistd-regular.otf } } + \@@_set_cjk_sans_font:n + { \@@_select_font:nn { Adobe~Heiti~Std } { adobeheitistd-regular.otf } } + \@@_set_cjk_mono_font:n + { \@@_select_font:nn { Adobe~Fangsong~Std } { Adobe-Fangsong-Std-R-Font.otf } } + } % \end{macrocode} -% 论文标题。 +% \end{macro} +% \begin{macro}{\@@_load_cjk_font_founder:} +% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台方正字体} +% 中文字体配置\valuex{founder}。 % \begin{macrocode} - title .tl_set:N = \l_@@_title_str, +\cs_new:Npn \@@_load_cjk_font_founder: + { + \@@_set_cjk_main_font:nn + { \@@_select_font:nn { FZShuSong-Z01 } { FZShuSong-Z01.ttf } } + { \@@_select_font:nn { FZKai-Z03 } { FZKai-Z03.ttf } } + \@@_set_cjk_sans_font:n + { \@@_select_font:nn { FZHei-B01 } { FZHei-B01.ttf } } + \@@_set_cjk_mono_font:n + { \@@_select_font:nn { FZFangSong-Z02 } { FZFSK.TTF } } + } % \end{macrocode} -% 院系名称。 +% \end{macro} +% \begin{macro}{\@@_load_cjk_font_sinotype:} +% 中文字体配置\valuex{sinotype}。 % \begin{macrocode} - department .tl_set:N = \l_@@_dept_str, -% \end{macrocode} -% 专业名称。 -% \begin{macrocode} - major .tl_set:N = \l_@@_major_str, -% \end{macrocode} -% 作者姓名。 -% \begin{macrocode} - author .tl_set:N = \l_@@_author_str, -% \end{macrocode} -% 导师姓名。 -% \begin{macrocode} - supervisor .tl_set:N = \l_@@_supv_str, -% \end{macrocode} -% 院内导师姓名。 -% \begin{macrocode} - supervisor-department .tl_set:N = \l_@@_supv_dept_str, -% \end{macrocode} -% 校外导师姓名。 -% \begin{macrocode} - supervisor-enterprise .tl_set:N = \l_@@_supv_ent_str, -% \end{macrocode} -% 校内导师姓名。 -% \begin{macrocode} - supervisor-school .tl_set:N = \l_@@_supv_sch_str, -% \end{macrocode} -% 作者班级号。 -% \begin{macrocode} - class-id .tl_set:N = \l_@@_class_id_str, -% \end{macrocode} -% 作者学号。 -% \begin{macrocode} - student-id .tl_set:N = \l_@@_student_id_str, -% \end{macrocode} -% 中文摘要。 -% \begin{macrocode} - abstract .tl_set:N = \l_@@_abstract_zh_tl, -% \end{macrocode} -% 英文摘要。 -% \begin{macrocode} - abstract* .tl_set:N = \l_@@_abstract_en_tl, -% \end{macrocode} -% 中文关键词。 -% \begin{macrocode} - keywords .clist_set:N = \l_@@_keywords_zh_clist, -% \end{macrocode} -% 英文关键词。 -% \begin{macrocode} - keywords* .clist_set:N = \l_@@_keywords_en_clist, -% \end{macrocode} -% 致谢。 -% \begin{macrocode} - acknowledgements .tl_set:N = \l_@@_ack_tl - } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\keys_define:nn} -% 定义元(meta)键值对。 -% \begin{macrocode} -\keys_define:nn { xdu } - { - style .meta:nn = { xdu / style } { #1 }, - info .meta:nn = { xdu / info } { #1 } - } +\cs_new:Npn \@@_load_cjk_font_sinotype: + { + \@@_set_cjk_main_font:nn + { \@@_select_font:nn { STSong } { STSONG.TTF } } + { \@@_select_font:nn { STKaiti } { STKAITI.TTF } } + \@@_set_cjk_sans_font:nn + { \@@_select_font:nn { STXihei } { STXIHEI.TTF } } + { \@@_select_font:nn { STHeiti } { STHeiti.ttf } } + \@@_set_cjk_mono_font:n + { \@@_select_font:nn { STFangsong } { STFANGSO.TTF } } + } % \end{macrocode} % \end{macro} -% \begin{macro}{\keys_set:nn} -% 初始设置。 +% \begin{macro}{\@@_load_cjk_font_fandol:} +% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台Fandol字体} +% 中文字体配置\valuex{fandol}。 % \begin{macrocode} -\keys_set:nn { xdu } +\cs_new:Npn \@@_load_cjk_font_fandol: { - style / cjk-font = win, - style / cjk-fake-bold = 3, - style / cjk-fake-slant = 0.2, - style / latin-font = tacn, - style / math-font = cm, - style / unicode-math = { }, - style / font-type = font, - style / font-path = fonts, - style / en-cjk-font = false, - style / language = zh, - style / bib-backend = biblatex, - style / bib-resource = { }, - style / fig-label-sep = { 0.75em }, - style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt }, - style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt }, - info / title = { }, - info / department = { }, - info / major = { }, - info / author = { }, - info / supervisor = { }, - info / supervisor-department = { }, - info / supervisor-enterprise = { }, - info / supervisor-school = { }, - info / class-id = { }, - info / student-id = { }, - info / abstract = { }, - info / abstract* = { }, - info / keywords = { }, - info / keywords* = { }, - info / acknowledgements = { } + \@@_set_cjk_main_font:nnn + { FandolSong-Regular.otf } + { FandolSong-Bold.otf } + { FandolKai-Regular.otf } + \@@_set_cjk_sans_font:nn + { FandolHei-Regular.otf } + { FandolHei-Bold.otf } + \@@_set_cjk_mono_font:n + { FandolFang-Regular.otf } } % \end{macrocode} % \end{macro} -% \begin{macro}{\xdusetup} -% 用户设置接口。 -% \begin{macrocode} -\NewDocumentCommand \xdusetup { m } - { \keys_set:nn { xdu } { #1 } } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\ProcessKeysOptions} -% 处理选项。 +% \begin{macro}{\@@_load_cjk_font_none:} +% 中文字体配置\valuex{none}。 % \begin{macrocode} -\ProcessKeysOptions { xdu } +\cs_new:Npn \@@_load_cjk_font_none: { } % \end{macrocode} % \end{macro} -% \subsubsection{配置字体} -% 忽略字体警告。 -% \begin{macrocode} -\str_if_eq:NNTF { \l_@@_cjk_font_tl } { fandol } - { \PassOptionsToPackage { quiet } { fontspec } } - { } -\PassOptionsToPackage { quiet } { xeCJK } -% \end{macrocode} -% \begin{macro}{\PassOptionsToClass,\LoadClass} -% 加载\clsx{ctexbook}文档类。 -% \changes{v0.3.2.0}{2022/04/04}{修正行间距为1.5倍} +% \subsubsection{英文字体} +% \begin{macro}{\@@_set_latin_font:nnn} +% 配置英文字体。 % \begin{macrocode} -\PassOptionsToClass +\cs_new:Npn \@@_set_latin_font:nnn #1#2#3 { - zihao=-4, - sub4section, -% linespread = 1.5, - fontset = none + \@@_font_path: + BoldFont = { #1 }, + SlantedFont = { #2 }, + BoldSlantedFont = { #3 }, + ItalicFont = { #2 }, + BoldItalicFont = { #3 } } - { ctexbook } -\LoadClass { ctexbook } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_font_path:} -% 当选择使用字体文件配置字体时,设置字体文件路径。 +% \begin{macro}{\@@_set_latin_main_font:nnnnn} +% 配置英文罗马族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。 +% \begin{arguments} +% \item 字体名称。 +% \item 常规字体名称。 +% \item 粗体字体名称。 +% \item 意大利体字体名称。 +% \item 粗意大利体字体名称。 +% \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_font_path: +\cs_new:Npn \@@_set_latin_main_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l_@@_font_type_tl } { font } - { } - { Path = \l_@@_font_path_tl / , } + { \setmainfont { #1 } } + { \setmainfont { #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_if_platform_macos:FT} -% \changes{v0.5.1.0}{2022/04/06}{判断操作系统是否是macOS} -% 判断操作系统是否是macOS。 +% \begin{macro}{\@@_set_latin_sans_font:nnnnn} +% 配置英文无衬线族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。 % \begin{arguments} -% \item 非macOS。 -% \item macOS。 +% \item 字体名称。 +% \item 常规字体名称。 +% \item 粗体字体名称。 +% \item 意大利体字体名称。 +% \item 粗意大利体字体名称。 % \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_if_platform_macos:FT #1#2 - { \ctex_if_platform_macos:TF { #2 } { #1 } } +\cs_new:Npn \@@_set_latin_sans_font:nnnnn #1#2#3#4#5 + { + \str_if_eq:NNTF { \l_@@_font_type_tl } { font } + { \setsansfont { #1 } } + { \setsansfont { #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_texmf_font:nn} -% \changes{v0.5.1.0}{2022/04/06}{加载字体时自动判断是否为macOS平台} -% 调用TEXMF中的字体时根据操作系统是否是macOS自动选择调用字体名或文件名。 +% \begin{macro}{\@@_set_latin_mono_font:nnnnn} +% 配置英文等宽族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。 % \begin{arguments} -% \item 字体名。 -% \item 文件名。 +% \item 字体名称。 +% \item 常规字体名称。 +% \item 粗体字体名称。 +% \item 意大利体字体名称。 +% \item 粗意大利体字体名称。 % \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_texmf_font:nn #1#2 - { \@@_if_platform_macos:FT { #1 } { #2 } } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_rm_family:,\@@_sf_family:,\@@_tt_family:} -% 切换字体族时,英文根据配置选择是否使用中文字体。 -% \begin{macrocode} -\cs_new:Npn \@@_rm_family: - { \bool_if:NTF \l_@@_en_cjk_font_bool { \CJKfamily+ { rm } } { \rmfamily } } -\cs_new:Npn \@@_sf_family: - { \bool_if:NTF \l_@@_en_cjk_font_bool { \CJKfamily+ { sf } } { \sffamily } } -\cs_new:Npn \@@_tt_family: - { \bool_if:NTF \l_@@_en_cjk_font_bool { \CJKfamily+ { tt } } { \ttfamily } } -% \end{macrocode} -% \end{macro} -% \paragraph{中文字体} -% \begin{macro}{\@@_cfg_cjk_font_sub_b:} -% 中文粗体。 -% \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_b:n #1 +\cs_new:Npn \@@_set_latin_mono_font:nnnnn #1#2#3#4#5 { - BoldFont = { #1 } + \str_if_eq:NNTF { \l_@@_font_type_tl } { font } + { \setmonofont{ #1 } } + { \setmonofont{ #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_fb:n} -% 中文伪粗体。 +% \begin{macro}{\@@_load_latin_font_tacn:} +% 英文字体配置\valuex{tacn}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_fb:n #1 +\cs_new:Npn \@@_load_latin_font_tacn: { - BoldFont = { #1 }, - BoldFeatures = { FakeBold = \l_@@_fake_bold_str } + \@@_set_latin_main_font:nnnnn + { Times~New~Roman } { times.ttf } { timesbd.ttf } { timesi.ttf } { timesbi.ttf } + \@@_set_latin_sans_font:nnnnn + { Arial } { arial.ttf } { arialbd.ttf } { ariali.ttf } { arialbi.ttf } + \@@_set_latin_mono_font:nnnnn + { Courier~New } { cour.ttf } { courbd.ttf } { couri.ttf } { courbi.ttf } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_fs:n} -% 中文伪斜体。 +% \begin{macro}{\@@_load_latin_font_thcs:} +% 英文字体配置\valuex{thcs}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_fs:n #1 +\cs_new:Npn \@@_load_latin_font_thcs: { - SlantedFont = { #1 }, - SlantedFeatures = { FakeSlant = \l_@@_fake_slant_str } + \@@_set_latin_main_font:nnnnn + { Times~New~Roman } + { times.ttf } + { timesbd.ttf } + { timesi.ttf } + { timesbi.ttf } + \@@_set_latin_sans_font:nnnnn + { Helvetica } + { Helvetica.ttf } + { Helvetica~Bold.ttf } + { Helvetica~Oblique.ttf } + { Helvetica~Bold~Oblique.ttf } + \@@_set_latin_mono_font:nnnnn + { Courier~Std } + { CourierStd.otf } + { CourierStd-Bold.otf } + { CourierStd-Oblique.otf } + { CourierStd-BoldOblique.otf } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_fbfs:n} -% 中文伪粗斜体。 +% \begin{macro}{\@@_load_latin_font_none:} +% 英文字体配置\valuex{none}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_fbfs:n #1 - { - BoldSlantedFont = { #1 }, - BoldSlantedFeatures = - { - FakeBold = \l_@@_fake_bold_str, - FakeSlant = \l_@@_fake_slant_str - } - } +\cs_new:Npn \@@_load_latin_font_none: { } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_bfs:n} -% 中文粗伪斜体。 +% \subsubsection{数学字体} +% \begin{macro}{\@@_load_unicode_math_pkg:} +% 加载\pkgx{unicode-math}宏包。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_bfs:n #1 +\cs_new:Npn \@@_load_unicode_math_pkg: { - BoldSlantedFont = { #1 }, - BoldSlantedFeatures = { FakeSlant = \l_@@_fake_slant_str } + \RequirePackage + [ \l_@@_unicode_math_tl ] + { unicode-math } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_i:n} -% 中文意大利体。 +% \begin{macro}{\@@_load_math_font_cambria:} +% 数学字体配置\valuex{cambria}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_i:n #1 +\cs_new:Npn \@@_load_math_font_cambria: { - ItalicFont = { #1 } + \@@_load_unicode_math_pkg: + \str_if_eq:NNTF { \l_@@_font_type_tl} { font} + { \setmathfont { Cambria~Math} } + { \setmathfont { cambria.ttc} [ Path = \l_@@_font_path_tl/, FontIndex = 1 ] } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_fi:n} -% 中文伪意大利体,即伪斜体。 +% \begin{macro}{\@@_define_math_font:nn} +% 批量定义数学字体配置。 +% \changes{v0.2.0.0}{2022/04/04}{增加Garamond Math数学字体} +% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台MacTeX内置数学字体} +% \begin{arguments} +% \item 配置名称。 +% \item 字体名称。 +% \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_fi:n #1 +\cs_new:Npn \@@_define_math_font:nn #1#2 { - ItalicFont = { #1 }, - ItalicFeatures = { FakeSlant = \l_@@_fake_slant_str } + \cs_new:cpn { @@_load_math_font_ #1 : } + { + \@@_load_unicode_math_pkg: + \setmathfont { #2 } + } } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_ifb:n} -% 中文意大利体伪粗体。 -% \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_ifb:n #1 +\clist_map_inline:nn { - BoldItalicFont = { #1 }, - BoldItalicFeatures = { FakeBold = \l_@@_fake_bold_str } + { asana } { Asana-Math.otf }, + { fira } { FiraMath-Regular.otf }, + { garamond } { Garamond-Math.otf }, + { lm } { latinmodern-math.otf }, + { libertinus } { LibertinusMath-Regular.otf }, + { stix } { STIXMath-Regular.otf }, + { bonum } { texgyrebonum-math.otf }, + { dejavu } { texgyredejavu-math.otf }, + { pagella } { texgyrepagella-math.otf }, + { schola } { texgyreschola-math.otf }, + { termes } { texgyretermes-math.otf } } + { \@@_define_math_font:nn #1 } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_sub_fifb:n} -% 中文伪意大利体伪粗体。 +% \begin{macro}{\@@_load_math_font_xits:} +% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台MacTeX内置XITSMath数学字体} +% 数学字体配置\valuex{xits}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_sub_fifb:n #1 +\cs_new:Npn \@@_load_math_font_xits: { - BoldItalicFont = { #1 }, - BoldItalicFeatures = + \@@_load_unicode_math_pkg: + \@@_if_platform_macos:FT { - FakeBold = \l_@@_fake_bold_str, - FakeSlant = \l_@@_fake_slant_str + \setmathfont { XITS~Math } + } + { + \@@_load_unicode_math_pkg: + \setmathfont { XITSMath-Regular.otf } + \setmathfont { XITSMath-Bold.otf } + [range= { bfup -> up, bfit -> it } ] } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_r:n} -% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体。 +% \begin{macro}{\@@_load_math_font_cm:} +% 数学字体配置\valuex{cm}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_r:n #1 - { - \@@_cfg_cjk_font_sub_fb:n { #1 }, - \@@_cfg_cjk_font_sub_fs:n { #1 }, - \@@_cfg_cjk_font_sub_fbfs:n { #1 }, - \@@_cfg_cjk_font_sub_fi:n { #1 }, - \@@_cfg_cjk_font_sub_fifb:n { #1 } - } +\cs_new:Npn \@@_load_math_font_cm: { } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_rb:nn} -% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体,其中粗体和斜粗体为其他字体。 -% \begin{arguments} -% \item 常规字体。 -% \item 粗体字体。 -% \end{arguments} +% \begin{macro}{\@@_load_math_font_none:} +% 数学字体配置\valuex{none}。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_rb:nn #1#2 - { - \@@_cfg_cjk_font_sub_b:n { #2 }, - \@@_cfg_cjk_font_sub_fs:n { #1 }, - \@@_cfg_cjk_font_sub_bfs:n { #2 }, - \@@_cfg_cjk_font_sub_fi:n { #1 }, - \@@_cfg_cjk_font_sub_fifb:n { #1 } - } +\cs_new:Npn \@@_load_math_font_none: { } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_ri:nn} -% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体,其中意大利体和粗意大利体为其他字体。 -% \begin{arguments} -% \item 常规字体。 -% \item 意大利体字体。 -% \end{arguments} +% \subsubsection{加载字体} +% \begin{macro}{\@@_load_font:} +% 加载中文字体、英文字体和数学字体。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_ri:nn #1#2 +\cs_new:Npn \@@_load_font: { - \@@_cfg_cjk_font_sub_fb:n { #1 }, - \@@_cfg_cjk_font_sub_fs:n { #1 }, - \@@_cfg_cjk_font_sub_fbfs:n { #1 }, - \@@_cfg_cjk_font_sub_i:n { #2 }, - \@@_cfg_cjk_font_sub_ifb:n { #2 } + \use:c { @@_load_cjk_font_ \l_@@_cjk_font_tl : } + \use:c { @@_load_latin_font_ \l_@@_latin_font_tl : } + \use:c { @@_load_math_font_ \l_@@_math_font_tl : } } % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_cfg_cjk_font_rbi:nnn} -% 配置中文字体,包括粗体、斜体、斜粗体、意大利体、粗意大利体,其中粗体、斜粗体、意大利体和粗意大利体为其他字体。 -% \begin{arguments} -% \item 常规字体。 -% \item 粗体字体。 -% \item 意大利体字体。 -% \end{arguments} +% 在导言区末尾加载中文字体、英文字体和数学字体。 % \begin{macrocode} -\cs_new:Npn \@@_cfg_cjk_font_rbi:nnn #1#2#3 - { - \@@_cfg_cjk_font_sub_b:n { #2 }, - \@@_cfg_cjk_font_sub_fs:n { #1 }, - \@@_cfg_cjk_font_sub_bfs:n { #2 }, - \@@_cfg_cjk_font_sub_i:n { #3 }, - \@@_cfg_cjk_font_sub_ifb:n { #3 } - } +\ctex_at_end_preamble:n { \@@_load_font: } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_select_font:nn} -% 自动选择字体文件名称或字体名称。 -% \begin{arguments} -% \item 字体名称。 -% \item 字体文件名称。 -% \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_select_font:nn #1#2 - { - \str_if_eq:NNTF { \l_@@_font_type_tl } { font } - { #1 } - { #2 } - } +% +%<*xduugthesis> % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_set_cjk_main_font:nn,\@@_set_cjk_main_font:nnn} -% 配置中文罗马族字体。 -% \begin{arguments} -% \item 宋体字体。 -% \item 楷体字体。 -% \end{arguments} +% \subsection{信息录入} +% \begin{variable} +% { +% \l_@@_title_str, +% \l_@@_title_i_str, +% \l_@@_title_ii_str, +% \l_@@_dept_str, +% \l_@@_major_str, +% \l_@@_author_str, +% \l_@@_supv_str, +% \l_@@_supv_dept_str, +% \l_@@_supv_ent_str, +% \l_@@_supv_sch_str, +% \l_@@_class_id_str, +% \l_@@_student_id_str, +% \l_@@_abstract_zh_tl, +% \l_@@_abstract_en_tl, +% \l_@@_keywords_zh_clist, +% \l_@@_keywords_en_clist, +% \l_@@_ack_tl +% } +% 论文标题。 % \begin{macrocode} -\cs_new:Npn \@@_set_cjk_main_font:nn #1#2 - { - \setCJKmainfont { #1 } - [ \@@_font_path: \@@_cfg_cjk_font_ri:nn { #1 } { #2 } ] - } -\cs_new:Npn \@@_set_cjk_main_font:nnn #1#2#3 - { - \setCJKmainfont { #1 } - [ \@@_font_path: \@@_cfg_cjk_font_rbi:nnn { #1 } { #2 } { #3 } ] - } +\str_new:N \l_@@_title_str +\str_new:N \l_@@_title_i_str +\str_new:N \l_@@_title_ii_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_set_cjk_sans_font:n,\@@_set_cjk_sans_font:nn} -% 配置中文无衬线族字体。 +% 院系名称。 % \begin{macrocode} -\cs_new:Npn \@@_set_cjk_sans_font:n #1 - { - \setCJKsansfont { #1 } - [ \@@_font_path: \@@_cfg_cjk_font_r:n { #1 } ] - } -\cs_new:Npn \@@_set_cjk_sans_font:nn #1#2 - { - \setCJKsansfont { #1 } - [ \@@_font_path: \@@_cfg_cjk_font_rb:nn { #1 } { #2 } ] - } +\str_new:N \l_@@_dept_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_set_cjk_mono_font:n} -% 配置中文等宽族字体。 +% 专业名称。 % \begin{macrocode} -\cs_new:Npn \@@_set_cjk_mono_font:n #1 - { - \setCJKmonofont { #1 } - [ \@@_font_path: \@@_cfg_cjk_font_r:n { #1 } ] - } +\str_new:N \l_@@_major_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_cjk_font_win:} -% 中文字体配置\valuex{win}。 +% 作者姓名。 % \begin{macrocode} -\cs_new:Npn \@@_load_cjk_font_win: - { - \@@_set_cjk_main_font:nn - { \@@_select_font:nn { SimSun } { simsun.ttc } } - { \@@_select_font:nn { KaiTi } { simkai.ttf } } - \@@_set_cjk_sans_font:n - { \@@_select_font:nn { SimHei } { simhei.ttf } } - \@@_set_cjk_mono_font:n - { \@@_select_font:nn { FangSong } { simfang.ttf } } - } +\str_new:N \l_@@_author_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_cjk_font_adobe:} -% 中文字体配置\valuex{adobe}。 +% 导师姓名。 % \begin{macrocode} -\cs_new:Npn \@@_load_cjk_font_adobe: - { - \@@_set_cjk_main_font:nn - { \@@_select_font:nn { Adobe~Song~Std } { adobesongstd-light.otf } } - { \@@_select_font:nn { Adobe~Kaiti~Std } { adobekaitistd-regular.otf } } - \@@_set_cjk_sans_font:n - { \@@_select_font:nn { Adobe~Heiti~Std } { adobeheitistd-regular.otf } } - \@@_set_cjk_mono_font:n - { \@@_select_font:nn { Adobe~Fangsong~Std } { Adobe-Fangsong-Std-R-Font.otf } } - } +\str_new:N \l_@@_supv_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_cjk_font_founder:} -% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台方正字体} -% 中文字体配置\valuex{founder}。 +% 院内导师姓名。 % \begin{macrocode} -\cs_new:Npn \@@_load_cjk_font_founder: - { - \@@_set_cjk_main_font:nn - { \@@_select_font:nn { FZShuSong-Z01 } { FZShuSong-Z01.ttf } } - { \@@_select_font:nn { FZKai-Z03 } { FZKai-Z03.ttf } } - \@@_set_cjk_sans_font:n - { \@@_select_font:nn { FZHei-B01 } { FZHei-B01.ttf } } - \@@_set_cjk_mono_font:n - { \@@_select_font:nn { FZFangSong-Z02 } { FZFSK.TTF } } - } +\str_new:N \l_@@_supv_dept_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_cjk_font_sinotype:} -% 中文字体配置\valuex{sinotype}。 +% 校外导师姓名。 % \begin{macrocode} -\cs_new:Npn \@@_load_cjk_font_sinotype: - { - \@@_set_cjk_main_font:nn - { \@@_select_font:nn { STSong } { STSONG.TTF } } - { \@@_select_font:nn { STKaiti } { STKAITI.TTF } } - \@@_set_cjk_sans_font:nn - { \@@_select_font:nn { STXihei } { STXIHEI.TTF } } - { \@@_select_font:nn { STHeiti } { STHeiti.ttf } } - \@@_set_cjk_mono_font:n - { \@@_select_font:nn { STFangsong } { STFANGSO.TTF } } - } +\str_new:N \l_@@_supv_ent_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_cjk_font_fandol:} -% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台Fandol字体} -% 中文字体配置\valuex{fandol}。 +% 校内导师姓名。 % \begin{macrocode} -\cs_new:Npn \@@_load_cjk_font_fandol: - { - \@@_set_cjk_main_font:nnn - { FandolSong-Regular.otf } - { FandolSong-Bold.otf } - { FandolKai-Regular.otf } - \@@_set_cjk_sans_font:nn - { FandolHei-Regular.otf } - { FandolHei-Bold.otf } - \@@_set_cjk_mono_font:n - { FandolFang-Regular.otf } - } +\str_new:N \l_@@_supv_sch_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_cjk_font_none:} -% 中文字体配置\valuex{none}。 +% 作者班级号。 % \begin{macrocode} -\cs_new:Npn \@@_load_cjk_font_none: { } +\str_new:N \l_@@_class_id_str % \end{macrocode} -% \end{macro} -% \paragraph{英文字体} -% \begin{macro}{\@@_set_latin_font:nnn} -% 配置英文字体。 +% 作者学号。 % \begin{macrocode} -\cs_new:Npn \@@_set_latin_font:nnn #1#2#3 - { - \@@_font_path: - BoldFont = { #1 }, - SlantedFont = { #2 }, - BoldSlantedFont = { #3 }, - ItalicFont = { #2 }, - BoldItalicFont = { #3 } - } +\str_new:N \l_@@_student_id_str % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_set_latin_main_font:nnnnn} -% 配置英文罗马族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。 -% \begin{arguments} -% \item 字体名称。 -% \item 常规字体名称。 -% \item 粗体字体名称。 -% \item 意大利体字体名称。 -% \item 粗意大利体字体名称。 -% \end{arguments} +% 中文摘要。 % \begin{macrocode} -\cs_new:Npn \@@_set_latin_main_font:nnnnn #1#2#3#4#5 - { - \str_if_eq:NNTF { \l_@@_font_type_tl } { font } - { \setmainfont { #1 } } - { \setmainfont { #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] } - } +\tl_new:N \l_@@_abstract_zh_tl % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_set_latin_sans_font:nnnnn} -% 配置英文无衬线族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。 -% \begin{arguments} -% \item 字体名称。 -% \item 常规字体名称。 -% \item 粗体字体名称。 -% \item 意大利体字体名称。 -% \item 粗意大利体字体名称。 -% \end{arguments} +% 英文摘要。 % \begin{macrocode} -\cs_new:Npn \@@_set_latin_sans_font:nnnnn #1#2#3#4#5 - { - \str_if_eq:NNTF { \l_@@_font_type_tl } { font } - { \setsansfont { #1 } } - { \setsansfont { #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] } - } +\tl_new:N \l_@@_abstract_en_tl % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_set_latin_mono_font:nnnnn} -% 配置英文等宽族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。 -% \begin{arguments} -% \item 字体名称。 -% \item 常规字体名称。 -% \item 粗体字体名称。 -% \item 意大利体字体名称。 -% \item 粗意大利体字体名称。 -% \end{arguments} +% 中文关键词。 % \begin{macrocode} -\cs_new:Npn \@@_set_latin_mono_font:nnnnn #1#2#3#4#5 +\clist_new:N \l_@@_keywords_zh_clist +% \end{macrocode} +% 英文关键词。 +% \begin{macrocode} +\clist_new:N \l_@@_keywords_en_clist +% \end{macrocode} +% 致谢。 +% \begin{macrocode} +\tl_new:N \l_@@_ack_tl +% \end{macrocode} +% \end{variable} +% \begin{macro}{\keys_define:nn} +% 定义信息键值。 +% \begin{macrocode} +\keys_define:nn { xdu / info } { - \str_if_eq:NNTF { \l_@@_font_type_tl } { font } - { \setmonofont{ #1 } } - { \setmonofont{ #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] } +% \end{macrocode} +% 论文标题。 +% \begin{macrocode} + title .tl_set:N = \l_@@_title_str, +% \end{macrocode} +% 院系名称。 +% \begin{macrocode} + department .tl_set:N = \l_@@_dept_str, +% \end{macrocode} +% 专业名称。 +% \begin{macrocode} + major .tl_set:N = \l_@@_major_str, +% \end{macrocode} +% 作者姓名。 +% \begin{macrocode} + author .tl_set:N = \l_@@_author_str, +% \end{macrocode} +% 导师姓名。 +% \begin{macrocode} + supervisor .tl_set:N = \l_@@_supv_str, +% \end{macrocode} +% 院内导师姓名。 +% \begin{macrocode} + supervisor-department .tl_set:N = \l_@@_supv_dept_str, +% \end{macrocode} +% 校外导师姓名。 +% \begin{macrocode} + supervisor-enterprise .tl_set:N = \l_@@_supv_ent_str, +% \end{macrocode} +% 校内导师姓名。 +% \begin{macrocode} + supervisor-school .tl_set:N = \l_@@_supv_sch_str, +% \end{macrocode} +% 作者班级号。 +% \begin{macrocode} + class-id .tl_set:N = \l_@@_class_id_str, +% \end{macrocode} +% 作者学号。 +% \begin{macrocode} + student-id .tl_set:N = \l_@@_student_id_str, +% \end{macrocode} +% 中文摘要。 +% \begin{macrocode} + abstract .tl_set:N = \l_@@_abstract_zh_tl, +% \end{macrocode} +% 英文摘要。 +% \begin{macrocode} + abstract* .tl_set:N = \l_@@_abstract_en_tl, +% \end{macrocode} +% 中文关键词。 +% \begin{macrocode} + keywords .clist_set:N = \l_@@_keywords_zh_clist, +% \end{macrocode} +% 英文关键词。 +% \begin{macrocode} + keywords* .clist_set:N = \l_@@_keywords_en_clist, +% \end{macrocode} +% 致谢。 +% \begin{macrocode} + acknowledgements .tl_set:N = \l_@@_ack_tl } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_load_latin_font_tacn:} -% 英文字体配置\valuex{tacn}。 +% \begin{macro}{\keys_set:nn} +% 初始设置。 % \begin{macrocode} -\cs_new:Npn \@@_load_latin_font_tacn: +\keys_set:nn { xdu } { - \@@_set_latin_main_font:nnnnn - { Times~New~Roman } { times.ttf } { timesbd.ttf } { timesi.ttf } { timesbi.ttf } - \@@_set_latin_sans_font:nnnnn - { Arial } { arial.ttf } { arialbd.ttf } { ariali.ttf } { arialbi.ttf } - \@@_set_latin_mono_font:nnnnn - { Courier~New } { cour.ttf } { courbd.ttf } { couri.ttf } { courbi.ttf } + info / title = { }, + info / department = { }, + info / major = { }, + info / author = { }, + info / supervisor = { }, + info / supervisor-department = { }, + info / supervisor-enterprise = { }, + info / supervisor-school = { }, + info / class-id = { }, + info / student-id = { }, + info / abstract = { }, + info / abstract* = { }, + info / keywords = { }, + info / keywords* = { }, + info / acknowledgements = { } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_load_latin_font_thcs:} -% 英文字体配置\valuex{thcs}。 +% \subsection{样式配置} +% \begin{variable} +% { +% \l_@@_en_cjk_font_bool, +% \l_@@_lang_tl, +% \l_@@_bib_tool_tl, +% \l_@@_bib_file_clist, +% \l_@@_fig_label_sep_tl, +% \l_@@_before_skip_clist, +% \l_@@_after_skip_clist +% } +% 英文是否使用中文字体。 % \begin{macrocode} -\cs_new:Npn \@@_load_latin_font_thcs: +\bool_new:N \l_@@_en_cjk_font_bool +% \end{macrocode} +% 语言。 +% \begin{macrocode} +\tl_new:N \l_@@_lang_tl +% \end{macrocode} +% 参考文献支持方式。 +% \begin{macrocode} +\tl_new:N \l_@@_bib_tool_tl +% \end{macrocode} +% 参考文献文件。 +% \begin{macrocode} +\clist_new:N \l_@@_bib_file_clist +% \end{macrocode} +% 图片标签与后面标题之间的间距。 +% \begin{macrocode} +\tl_new:N \l_@@_fig_label_sep_tl +% \end{macrocode} +% 设置章节标题前后的垂直间距。 +% \begin{macrocode} +\clist_new:N \l_@@_before_skip_clist +\clist_new:N \l_@@_after_skip_clist +% \end{macrocode} +% \end{variable} +% \begin{macro}{\keys_define:nn} +% 定义样式键值。 +% \begin{macrocode} +\keys_define:nn { xdu / style } { - \@@_set_latin_main_font:nnnnn - { Times~New~Roman } - { times.ttf } - { timesbd.ttf } - { timesi.ttf } - { timesbi.ttf } - \@@_set_latin_sans_font:nnnnn - { Helvetica } - { Helvetica.ttf } - { Helvetica~Bold.ttf } - { Helvetica~Oblique.ttf } - { Helvetica~Bold~Oblique.ttf } - \@@_set_latin_mono_font:nnnnn - { Courier~Std } - { CourierStd.otf } - { CourierStd-Bold.otf } - { CourierStd-Oblique.otf } - { CourierStd-BoldOblique.otf } - } % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_latin_font_none:} -% 英文字体配置\valuex{none}。 +% 英文是否使用中文字体。 +% \begin{macrocode} + en-cjk-font .bool_set:N = \l_@@_en_cjk_font_bool, +% \end{macrocode} +% 论文语言配置。 +% \begin{macrocode} + language .choices:nn = { zh, en } + { \tl_set_eq:NN \l_@@_lang_tl \l_keys_choice_tl }, +% \end{macrocode} +% 参考文献支持方式配置。 +% \begin{macrocode} + bib-backend .choices:nn = { bibtex, biblatex } + { \tl_set_eq:NN \l_@@_bib_tool_tl \l_keys_choice_tl }, +% \end{macrocode} +% 参考文献文件。 % \begin{macrocode} -\cs_new:Npn \@@_load_latin_font_none: { } + bib-resource .clist_set:N = \l_@@_bib_file_clist, % \end{macrocode} -% \end{macro} -% \paragraph{数学字体} -% \begin{macro}{\@@_load_unicode_math_pkg:} -% 加载\pkgx{unicode-math}宏包。 +% 图片标签与后面标题之间的间距。 % \begin{macrocode} -\cs_new:Npn \@@_load_unicode_math_pkg: - { - \RequirePackage - [ \l_@@_unicode_math_tl ] - { unicode-math } - } + fig-label-sep .tl_set:N = \l_@@_fig_label_sep_tl, % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_math_font_cambria:} -% 数学字体配置\valuex{cambria}。 +% 设置章节标题前的垂直间距。 % \begin{macrocode} -\cs_new:Npn \@@_load_math_font_cambria: - { - \@@_load_unicode_math_pkg: - \str_if_eq:NNTF { \l_@@_font_type_tl} { font} - { \setmathfont { Cambria~Math} } - { \setmathfont { cambria.ttc} [ Path = \l_@@_font_path_tl/, FontIndex = 1 ] } - } + before-skip .clist_set:N = \l_@@_before_skip_clist, % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_define_math_font:nn} -% 批量定义数学字体配置。 -% \changes{v0.2.0.0}{2022/04/04}{增加Garamond Math数学字体} -% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台MacTeX内置数学字体} -% \begin{arguments} -% \item 配置名称。 -% \item 字体名称。 -% \end{arguments} +% 设置章节标题后的垂直间距。 % \begin{macrocode} -\cs_new:Npn \@@_define_math_font:nn #1#2 - { - \cs_new:cpn { @@_load_math_font_ #1 : } - { - \@@_load_unicode_math_pkg: - \setmathfont { #2 } - } - } -\clist_map_inline:nn - { - { asana } { Asana-Math.otf }, - { fira } { FiraMath-Regular.otf }, - { garamond } { Garamond-Math.otf }, - { lm } { latinmodern-math.otf }, - { libertinus } { LibertinusMath-Regular.otf }, - { stix } { STIXMath-Regular.otf }, - { bonum } { texgyrebonum-math.otf }, - { dejavu } { texgyredejavu-math.otf }, - { pagella } { texgyrepagella-math.otf }, - { schola } { texgyreschola-math.otf }, - { termes } { texgyretermes-math.otf } + after-skip .clist_set:N = \l_@@_after_skip_clist } - { \@@_define_math_font:nn #1 } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_load_math_font_xits:} -% \changes{v0.5.1.0}{2022/04/06}{适配macOS平台MacTeX内置XITSMath数学字体} -% 数学字体配置\valuex{xits}。 +% \begin{macro}{\keys_set:nn} +% 初始设置。 % \begin{macrocode} -\cs_new:Npn \@@_load_math_font_xits: +\keys_set:nn { xdu } { - \@@_load_unicode_math_pkg: - \@@_if_platform_macos:FT - { - \setmathfont { XITS~Math } - } - { - \@@_load_unicode_math_pkg: - \setmathfont { XITSMath-Regular.otf } - \setmathfont { XITSMath-Bold.otf } - [range= { bfup -> up, bfit -> it } ] - } + style / en-cjk-font = false, + style / language = zh, + style / bib-backend = biblatex, + style / bib-resource = { }, + style / fig-label-sep = { 0.75em }, + style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt }, + style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_load_math_font_cm:} -% 数学字体配置\valuex{cm}。 % \begin{macrocode} -\cs_new:Npn \@@_load_math_font_cm: { } +% % \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_load_math_font_none:} -% 数学字体配置\valuex{none}。 % \begin{macrocode} -\cs_new:Npn \@@_load_math_font_none: { } +%<*class|xdufont> +% \end{macrocode} +% \subsection{键值选项} +% \begin{macro}{\xdusetup} +% 用户设置接口。 +% \begin{macrocode} +\NewDocumentCommand \xdusetup { m } + { \keys_set:nn { xdu } { #1 } } % \end{macrocode} % \end{macro} -% \paragraph{加载字体} -% \begin{macro}{\@@_load_font:} -% 加载中文字体、英文字体和数学字体。 +% \begin{macro}{\keys_define:nn} +% 定义元(meta)键值对。 % \begin{macrocode} -\cs_new:Npn \@@_load_font: +\keys_define:nn { xdu } { - \use:c { @@_load_cjk_font_ \l_@@_cjk_font_tl : } - \use:c { @@_load_latin_font_ \l_@@_latin_font_tl : } - \use:c { @@_load_math_font_ \l_@@_math_font_tl : } + style .meta:nn = { xdu / style } { #1 }, + info .meta:nn = { xdu / info } { #1 } } % \end{macrocode} -% 在导言区末尾加载中文字体、英文字体和数学字体。 +% \end{macro} +% \begin{macro}{\ProcessKeysOptions} +% 处理选项。 % \begin{macrocode} -\ctex_at_end_preamble:n { \@@_load_font: } +\ProcessKeysOptions { xdu / style } % \end{macrocode} % \end{macro} -% \subsubsection{内部函数} -% \begin{macro}{\@@_begin_document:n} -% 钩子。 % \begin{macrocode} -\cs_new_protected:Npn \@@_begin_document:n #1 - { \ctex_gadd_ltxhook:nn { env/document/begin } { #1 } } +% +%<*xduugthesis> % \end{macrocode} -% \end{macro} +% \subsection{内部函数} % \begin{macro}{\@@_lang_switch:nn} % 根据论文语言自动选择中文对应内容或英文对应内容。 % \begin{arguments} @@ -1573,6 +1702,17 @@ } % \end{macrocode} % \end{macro} +% \begin{macro}{\@@_rm_family:,\@@_sf_family:,\@@_tt_family:} +% 切换字体族时,英文根据配置选择是否使用中文字体。 +% \begin{macrocode} +\cs_new:Npn \@@_rm_family: + { \bool_if:NTF \l_@@_en_cjk_font_bool { \CJKfamily+ { rm } } { \rmfamily } } +\cs_new:Npn \@@_sf_family: + { \bool_if:NTF \l_@@_en_cjk_font_bool { \CJKfamily+ { sf } } { \sffamily } } +\cs_new:Npn \@@_tt_family: + { \bool_if:NTF \l_@@_en_cjk_font_bool { \CJKfamily+ { tt } } { \ttfamily } } +% \end{macrocode} +% \end{macro} % \begin{variable}{\l_@@_pure_title_str} % 移除标题中换行符。 % \begin{macrocode} @@ -1598,227 +1738,67 @@ % \item 文本。 % \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_get_text_width:Nn #1#2 - { - \box_clear_new:N \l_@@_tmp_box - \hbox_set:Nn \l_@@_tmp_box { #2 } - \dim_set:Nn #1 { \box_wd:N \l_@@_tmp_box } - } -\cs_generate_variant:Nn \@@_get_text_width:Nn { NV } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_add_bookmark:n} -% 为当前位置添加书签。 -% \begin{macrocode} -\cs_new:Npn \@@_add_bookmark:n #1 - { \currentpdfbookmark { #1 } { #1 } } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_add_toc:n} -% 章节添加目录。 -% \begin{macrocode} -\cs_new:Npn \@@_add_toc:n #1 - { - \cleardoublepage - \phantomsection - \addcontentsline { toc } { chapter } { #1 } - } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_n_chapter_head:n} -% 新建无编号章节并添加页眉和书签。 -% \begin{macrocode} -\cs_new:Npn \@@_n_chapter_head:n #1 - { - \@@_add_bookmark:n { #1 } - \chapter* { #1 } - \markboth { #1 } { } - } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_n_chapter_head:nn} -% 新建无编号章节并添加页眉和书签并单独设置标题样式。 -% \begin{macrocode} -\cs_new:Npn \@@_n_chapter_head:nn #1#2 - { - { - \ctexset { chapter / format = { #2 } } - \@@_n_chapter_head:n { #1 } - } - } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@_n_chapter_head_toc:n} -% 新建无编号章节并添加目录及页眉。 -% \begin{macrocode} -\cs_new:Npn \@@_n_chapter_head_toc:n #1 - { - \@@_add_toc:n { #1 } - \chapter* { #1 } - \markboth { #1 } { } - } -% \end{macrocode} -% \end{macro} -% \subsubsection{目录} -% \begin{variable} -% { -% \cftchapleader, -% \cftbeforechapskip, -% \cftbeforesecskip, -% \cftbeforesubsecskip, -% \cftbeforesubsubsecskip, -% \cftbeforeparaskip, -% \cftbeforesubparaskip, -% \cftchapfont, -% \cftchappagefont, -% \cftsecfont, -% \cftsubsecfont, -% \cftsubsubsecfont, -% \cftparafont, -% \cftsubparafont, -% \cftsecpagefont, -% \cftsubsecpagefont, -% \cftsubsubsecpagefont, -% \cftparapagefont, -% \cftsubparapagefont -% } -% 设置目录样式。 -% \changes{v0.4.1.0}{2022/04/05}{设置目录样式} -% \begin{macrocode} -\RequirePackage [ titles ] { tocloft } -\renewcommand { \cftchapleader } { \bfseries \cftdotfill { \cftdotsep } } -\clist_map_inline:nn - { - \cftbeforechapskip, - \cftbeforesecskip, - \cftbeforesubsecskip, - \cftbeforesubsubsecskip, - \cftbeforeparaskip, - \cftbeforesubparaskip - } - { \dim_set:Nn { #1 } { 5pt } } - \clist_map_inline:nn - { - \cftchapfont, - \cftchappagefont - } - { \renewcommand { #1 } { \@@_rm_family: \zihao { -4 } \bfseries } } -\clist_map_inline:nn - { - \cftsecfont, - \cftsubsecfont, - \cftsubsubsecfont, - \cftparafont, - \cftsubparafont, - \cftsecpagefont, - \cftsubsecpagefont, - \cftsubsubsecpagefont, - \cftparapagefont, - \cftsubparapagefont - } - { \renewcommand { #1 } { \@@_rm_family: \zihao { -4 } } } -% \end{macrocode} -% \end{variable} -% \subsubsection{图片} -% \begin{macro}{\DeclareCaptionLabelSeparator,\DeclareCaptionFont,\captionsetup} -% \changes{v0.1.2.0}{2022/04/03}{设置图片标签与后面标题之间的间距} -% \changes{v0.1.3.0}{2022/04/03}{设置图片标签与标题字体字号} -% 设置图片标签与后面标题之间的间距。 -% \begin{macrocode} -\RequirePackage { caption } -\DeclareCaptionLabelSeparator { customskip } { \hskip \l_@@_fig_label_sep_tl } -\DeclareCaptionFont { customfont } { \@@_rm_family: \zihao { 5 } } -\captionsetup +\cs_new:Npn \@@_get_text_width:Nn #1#2 { - labelsep = customskip, - font = customfont + \box_clear_new:N \l_@@_tmp_box + \hbox_set:Nn \l_@@_tmp_box { #2 } + \dim_set:Nn #1 { \box_wd:N \l_@@_tmp_box } } +\cs_generate_variant:Nn \@@_get_text_width:Nn { NV } % \end{macrocode} % \end{macro} -% \begin{macro}{\PassOptionsToPackage,\captionsetup} -% \changes{v0.4.2.0}{2022/04/05}{设置子图标签与标题字体字号} -% 设置子图标签与标题字体字号,支持\pkgx{subfig}和\pkgx{subcaption}宏包。 +% \begin{macro}{\@@_add_bookmark:n} +% 为当前位置添加书签。 % \begin{macrocode} -\PassOptionsToPackage { font = small } { subfig } -\captionsetup [ sub ] { font = customfont } +\cs_new:Npn \@@_add_bookmark:n #1 + { \currentpdfbookmark { #1 } { #1 } } % \end{macrocode} % \end{macro} -% \subsubsection{超链接和PDF元数据} -% \begin{macro}{\hyperref} -% 配置超链接和PDF元数据。 -% \changes{v0.5.0.0}{2022/04/05}{添加PDF主题元数据} +% \begin{macro}{\@@_add_toc:n} +% 章节添加目录。 % \begin{macrocode} -\RequirePackage{hyperref} -\hypersetup - { - bookmarksnumbered, - hidelinks - } -\ctex_at_end_preamble:n +\cs_new:Npn \@@_add_toc:n #1 { - \hypersetup - { - pdftitle = \l_@@_pure_title_str, -% pdfsubject = {西安电子科技大学本科毕业设计论文}, - pdfauthor = \l_@@_author_str - } + \cleardoublepage + \phantomsection + \addcontentsline { toc } { chapter } { #1 } } % \end{macrocode} % \end{macro} -% \subsubsection{参考文献} -% \begin{macro}{\addbibresource} -% 参考文献。 +% \begin{macro}{\@@_n_chapter_head:n} +% 新建无编号章节并添加页眉和书签。 % \begin{macrocode} -\@@_begin_document:n +\cs_new:Npn \@@_n_chapter_head:n #1 { - \tl_if_eq:NnTF \l_@@_bib_tool_tl { bibtex } - { - \RequirePackage [ sort&compress,square,super,comma,numbers ] { natbib } - \RequirePackage { gbt7714 } - \bibliographystyle { gbt7714-numerical } - } - { - \RequirePackage [ style = gb7714-2015 ] { biblatex } - \clist_map_inline:Nn \l_@@_bib_file_clist { \addbibresource { #1 } } - } + \@@_add_bookmark:n { #1 } + \chapter* { #1 } + \markboth { #1 } { } } % \end{macrocode} % \end{macro} -% \subsubsection{附录} -% \begin{macro}{appendixes} -% 附录环境。 -% \changes{v0.3.0.0}{2022/04/04}{新增附录环境} -% \changes{v0.3.1.0}{2022/04/04}{修正附录中图表编号样式} +% \begin{macro}{\@@_n_chapter_head:nn} +% 新建无编号章节并添加页眉和书签并单独设置标题样式。 % \begin{macrocode} -\RequirePackage { environ } -\NewEnviron { appendixes } +\cs_new:Npn \@@_n_chapter_head:nn #1#2 { - \appendix - \renewcommand { \thefigure } { \thechapter \arabic { figure } } - \renewcommand { \thetable } { \thechapter \arabic { table } } - \BODY + { + \ctexset { chapter / format = { #2 } } + \@@_n_chapter_head:n { #1 } + } } % \end{macrocode} % \end{macro} -% \subsubsection{通用宏包} -% 设置纸张尺寸为A4。 -% \begin{macrocode} -\RequirePackage { geometry } -\geometry { paper = a4paper } -% \end{macrocode} -% \begin{macrocode} -\RequirePackage { fancyhdr } -\RequirePackage { xeCJKfntef } -\RequirePackage { graphicx } -% \end{macrocode} -% \begin{macrocode} -% -% \end{macrocode} -% \subsection{xduugthesis.cls} +% \begin{macro}{\@@_n_chapter_head_toc:n} +% 新建无编号章节并添加目录及页眉。 % \begin{macrocode} -%<*xduugthesis> +\cs_new:Npn \@@_n_chapter_head_toc:n #1 + { + \@@_add_toc:n { #1 } + \chapter* { #1 } + \markboth { #1 } { } + } % \end{macrocode} -% \subsubsection{内部函数} +% \end{macro} % \begin{macro}{\@@_typeout_keywords:nNn} % 排版关键词。 % \begin{arguments} @@ -1845,8 +1825,8 @@ } % \end{macrocode} % \end{macro} -% \subsubsection{页面设置} -% \paragraph{页面尺寸} +% \subsection{页面设置} +% \subsubsection{页面尺寸} % \begin{macro}{\geometry,\newgeometry,\savegeometry} % 正文页面:上3厘米、下2厘米、内侧3厘米、外侧2厘米;装订线1厘米;页眉2厘米;页脚1厘米。 % \begin{macrocode} @@ -1874,7 +1854,7 @@ \savegeometry { cover } % \end{macrocode} % \end{macro} -% \paragraph{页眉页脚} +% \subsubsection{页眉页脚} % \begin{macro}{\chaptermark} % 设置奇数页页眉为章标题。 % \begin{macrocode} @@ -1907,16 +1887,16 @@ } % \end{macrocode} % \end{macro} -% \subsubsection{标题设置} +% \subsection{标题设置} % 中文章标题黑体,三号,居中排列。节标题宋体,四号,居中排列。英文一级标题字体为Times New Roman,四号,正体,左对齐,以大写罗马数字(I、II 等)标出序号。其余各级标题的字体均为Times New Roman,小四号,正体。二级及以下级别的标题依次缩进4个英文字符,以1.1,1.2,1.1.1,1.1.2形式标出序号。 -% \paragraph{章节层次} +% \subsubsection{章节层次} % \begin{macro}{\ctexset} % 设置章节层次为subparagraph。 % \begin{macrocode} \ctexset { secnumdepth=5 } % \end{macrocode} % \end{macro} -% \paragraph{章节名字} +% \subsubsection{章节名字} % \begin{macro}{\ctexset} % 设置章节的名字。 % \begin{macrocode} @@ -1935,7 +1915,7 @@ } % \end{macrocode} % \end{macro} -% \paragraph{章节编号} +% \subsubsection{章节编号} % \begin{macro}{\ctexset} % 设置章节编号的数字输出格式。 % \begin{macrocode} @@ -1955,7 +1935,7 @@ } % \end{macrocode} % \end{macro} -% \paragraph{章节和标题} +% \subsubsection{章节和标题} % \begin{macro}{\@@_zh_title:nnn} % 设置中文章节名字和随后的标题内容格式。 % \begin{arguments} @@ -2043,7 +2023,162 @@ } % \end{macrocode} % \end{macro} -% \paragraph{封面} +% \subsection{目录} +% \begin{variable} +% { +% \cftchapleader, +% \cftbeforechapskip, +% \cftbeforesecskip, +% \cftbeforesubsecskip, +% \cftbeforesubsubsecskip, +% \cftbeforeparaskip, +% \cftbeforesubparaskip, +% \cftchapfont, +% \cftchappagefont, +% \cftsecfont, +% \cftsubsecfont, +% \cftsubsubsecfont, +% \cftparafont, +% \cftsubparafont, +% \cftsecpagefont, +% \cftsubsecpagefont, +% \cftsubsubsecpagefont, +% \cftparapagefont, +% \cftsubparapagefont +% } +% 设置目录样式。 +% \changes{v0.4.1.0}{2022/04/05}{设置目录样式} +% \begin{macrocode} +\RequirePackage [ titles ] { tocloft } +\renewcommand { \cftchapleader } { \bfseries \cftdotfill { \cftdotsep } } +\clist_map_inline:nn + { + \cftbeforechapskip, + \cftbeforesecskip, + \cftbeforesubsecskip, + \cftbeforesubsubsecskip, + \cftbeforeparaskip, + \cftbeforesubparaskip + } + { \dim_set:Nn { #1 } { 5pt } } + \clist_map_inline:nn + { + \cftchapfont, + \cftchappagefont + } + { \renewcommand { #1 } { \@@_rm_family: \zihao { -4 } \bfseries } } +\clist_map_inline:nn + { + \cftsecfont, + \cftsubsecfont, + \cftsubsubsecfont, + \cftparafont, + \cftsubparafont, + \cftsecpagefont, + \cftsubsecpagefont, + \cftsubsubsecpagefont, + \cftparapagefont, + \cftsubparapagefont + } + { \renewcommand { #1 } { \@@_rm_family: \zihao { -4 } } } +% \end{macrocode} +% \end{variable} +% \subsection{公式} +% \begin{macro}{\theequation} +% 重定义公式编号样式。 +% \begin{macrocode} +\renewcommand { \theequation } { \thechapter - \arabic { equation } } +% \end{macrocode} +% \end{macro} +% \subsection{图片} +% \begin{macro}{\DeclareCaptionLabelSeparator,\DeclareCaptionFont,\captionsetup} +% \changes{v0.1.2.0}{2022/04/03}{设置图片标签与后面标题之间的间距} +% \changes{v0.1.3.0}{2022/04/03}{设置图片标签与标题字体字号} +% 设置图片标签与后面标题之间的间距。 +% \begin{macrocode} +\RequirePackage { caption } +\DeclareCaptionLabelSeparator { customskip } { \hskip \l_@@_fig_label_sep_tl } +\DeclareCaptionFont { customfont } { \@@_rm_family: \zihao { 5 } } +\captionsetup + { + labelsep = customskip, + font = customfont + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\PassOptionsToPackage,\captionsetup} +% \changes{v0.4.2.0}{2022/04/05}{设置子图标签与标题字体字号} +% 设置子图标签与标题字体字号,支持\pkgx{subfig}和\pkgx{subcaption}宏包。 +% \begin{macrocode} +\PassOptionsToPackage { font = small } { subfig } +\captionsetup [ sub ] { font = customfont } +% \end{macrocode} +% \end{macro} +% \subsection{超链接和PDF元数据} +% \begin{macro}{\hyperref} +% 配置超链接和PDF元数据。 +% \changes{v0.5.0.0}{2022/04/05}{添加PDF主题元数据} +% \begin{macrocode} +\RequirePackage{hyperref} +\hypersetup + { + bookmarksnumbered, + hidelinks + } +\ctex_at_end_preamble:n + { + \hypersetup + { + pdftitle = \l_@@_pure_title_str, +% pdfsubject = {西安电子科技大学本科毕业设计论文}, + pdfauthor = \l_@@_author_str + } + } +% \end{macrocode} +% \end{macro} +% \subsection{参考文献} +% \begin{macro}{\@@_begin_document:n} +% 钩子。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_begin_document:n #1 + { \ctex_gadd_ltxhook:nn { env/document/begin } { #1 } } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\addbibresource} +% 参考文献。 +% \begin{macrocode} +\@@_begin_document:n + { + \tl_if_eq:NnTF \l_@@_bib_tool_tl { bibtex } + { + \RequirePackage [ sort&compress,square,super,comma,numbers ] { natbib } + \RequirePackage { gbt7714 } + \bibliographystyle { gbt7714-numerical } + } + { + \RequirePackage [ style = gb7714-2015 ] { biblatex } + \clist_map_inline:Nn \l_@@_bib_file_clist { \addbibresource { #1 } } + } + } +% \end{macrocode} +% \end{macro} +% \subsection{附录} +% \begin{macro}{appendixes} +% 附录环境。 +% \changes{v0.3.0.0}{2022/04/04}{新增附录环境} +% \changes{v0.3.1.0}{2022/04/04}{修正附录中图表编号样式} +% \begin{macrocode} +\RequirePackage { environ } +\NewEnviron { appendixes } + { + \appendix + \renewcommand { \thefigure } { \thechapter \arabic { figure } } + \renewcommand { \thetable } { \thechapter \arabic { table } } + \BODY + } +% \end{macrocode} +% \end{macro} +% \subsection{封面} % \begin{macro}{\@@_cover_i:nn} % 绘制班级和学号。 % \begin{arguments} @@ -2287,14 +2422,8 @@ } % \end{macrocode} % \end{macro} +% \subsection{正文} % \begin{macro}{\mainmatter} -% \paragraph{正文} -% \begin{macro}{\theequation} -% 重定义公式编号样式。 -% \begin{macrocode} -\renewcommand { \theequation } { \thechapter - \arabic { equation } } -% \end{macrocode} -% \end{macro} % 排版正文部分。 % \begin{macrocode} \renewcommand{\mainmatter} diff --git a/Master/texmf-dist/source/xelatex/xduts/xduts.ins b/Master/texmf-dist/source/xelatex/xduts/xduts.ins index f47fc5e39ca..e5bbb7fdd8b 100644 --- a/Master/texmf-dist/source/xelatex/xduts/xduts.ins +++ b/Master/texmf-dist/source/xelatex/xduts/xduts.ins @@ -23,7 +23,11 @@ \postamble \endpostamble \keepsilent -\generate{\file{xduugthesis.cls}{\from{\jobname.dtx}{class,xduugthesis}}} +\generate + { + \file{xduugthesis.cls}{\from{\jobname.dtx}{class,xduugthesis}} + \file{xdufont.sty}{\from{\jobname.dtx}{sty,xdufont}} + } \nopreamble \nopostamble \endbatchfile diff --git a/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty b/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty new file mode 100644 index 00000000000..b705cb85ec0 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xduts/xdufont.sty @@ -0,0 +1,378 @@ +%% +%% This is file `xdufont.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xduts.dtx (with options: `sty,xdufont') +%% +%% Copyright (C) 2022--2022 by @note286 in GitHub +%% --------------------------------------------------------------------- +%% +%% 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 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% --------------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{xdufont} + {2022/04/10}{0.6.0.0} + {Xidian University Font package} +\RequirePackage { xparse, l3keys2e } +\PassOptionsToPackage { quiet } { xeCJK } +\RequirePackage { xeCJK } +\tl_new:N \l__xdu_cjk_font_tl +\str_new:N \l__xdu_fake_bold_str +\str_new:N \l__xdu_fake_slant_str +\tl_new:N \l__xdu_latin_font_tl +\tl_new:N \l__xdu_math_font_tl +\tl_new:N \l__xdu_unicode_math_tl +\tl_new:N \l__xdu_font_type_tl +\tl_new:N \l__xdu_font_path_tl +\keys_define:nn { xdu / style } + { + cjk-font .choices:nn = + { win, adobe, founder, sinotype, fandol, none } + { \tl_set_eq:NN \l__xdu_cjk_font_tl \l_keys_choice_tl }, + cjk-fake-bold .str_set:N = \l__xdu_fake_bold_str, + cjk-fake-slant .str_set:N = \l__xdu_fake_slant_str, + latin-font .choices:nn = { tacn, thcs, none } + { \tl_set_eq:NN \l__xdu_latin_font_tl \l_keys_choice_tl }, + math-font .choices:nn = + { + asana, cambria, cm, fira, garamond, lm, libertinus, stix, + bonum, dejavu, pagella, schola, termes, xits, none + } + { \tl_set_eq:NN \l__xdu_math_font_tl \l_keys_choice_tl }, + unicode-math .tl_set:N = \l__xdu_unicode_math_tl, + font-type .choices:nn = { font, file } + { \tl_set_eq:NN \l__xdu_font_type_tl \l_keys_choice_tl }, + font-path .tl_set:N = \l__xdu_font_path_tl + } +\keys_set:nn { xdu } + { + style / cjk-font = win, + style / cjk-fake-bold = 3, + style / cjk-fake-slant = 0.2, + style / latin-font = tacn, + style / math-font = cm, + style / unicode-math = { }, + style / font-type = font, + style / font-path = fonts + } +\cs_new:Npn \__xdu_if_platform_macos:FT #1#2 + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } } +\cs_new:Npn \__xdu_texmf_font:nn #1#2 + { \__xdu_if_platform_macos:FT { #1 } { #2 } } +\cs_new:Npn \__xdu_select_font:nn #1#2 + { + \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } + { #1 } + { #2 } + } +\cs_new:Npn \__xdu_font_path: + { + \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } + { } + { Path = \l__xdu_font_path_tl / , } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_b:n #1 + { + BoldFont = { #1 } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_fb:n #1 + { + BoldFont = { #1 }, + BoldFeatures = { FakeBold = \l__xdu_fake_bold_str } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_fs:n #1 + { + SlantedFont = { #1 }, + SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_fbfs:n #1 + { + BoldSlantedFont = { #1 }, + BoldSlantedFeatures = + { + FakeBold = \l__xdu_fake_bold_str, + FakeSlant = \l__xdu_fake_slant_str + } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_bfs:n #1 + { + BoldSlantedFont = { #1 }, + BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_str } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_i:n #1 + { + ItalicFont = { #1 } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_fi:n #1 + { + ItalicFont = { #1 }, + ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_str } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_ifb:n #1 + { + BoldItalicFont = { #1 }, + BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_str } + } +\cs_new:Npn \__xdu_cfg_cjk_font_sub_fifb:n #1 + { + BoldItalicFont = { #1 }, + BoldItalicFeatures = + { + FakeBold = \l__xdu_fake_bold_str, + FakeSlant = \l__xdu_fake_slant_str + } + } +\cs_new:Npn \__xdu_cfg_cjk_font_r:n #1 + { + \__xdu_cfg_cjk_font_sub_fb:n { #1 }, + \__xdu_cfg_cjk_font_sub_fs:n { #1 }, + \__xdu_cfg_cjk_font_sub_fbfs:n { #1 }, + \__xdu_cfg_cjk_font_sub_fi:n { #1 }, + \__xdu_cfg_cjk_font_sub_fifb:n { #1 } + } +\cs_new:Npn \__xdu_cfg_cjk_font_rb:nn #1#2 + { + \__xdu_cfg_cjk_font_sub_b:n { #2 }, + \__xdu_cfg_cjk_font_sub_fs:n { #1 }, + \__xdu_cfg_cjk_font_sub_bfs:n { #2 }, + \__xdu_cfg_cjk_font_sub_fi:n { #1 }, + \__xdu_cfg_cjk_font_sub_fifb:n { #1 } + } +\cs_new:Npn \__xdu_cfg_cjk_font_ri:nn #1#2 + { + \__xdu_cfg_cjk_font_sub_fb:n { #1 }, + \__xdu_cfg_cjk_font_sub_fs:n { #1 }, + \__xdu_cfg_cjk_font_sub_fbfs:n { #1 }, + \__xdu_cfg_cjk_font_sub_i:n { #2 }, + \__xdu_cfg_cjk_font_sub_ifb:n { #2 } + } +\cs_new:Npn \__xdu_cfg_cjk_font_rbi:nnn #1#2#3 + { + \__xdu_cfg_cjk_font_sub_b:n { #2 }, + \__xdu_cfg_cjk_font_sub_fs:n { #1 }, + \__xdu_cfg_cjk_font_sub_bfs:n { #2 }, + \__xdu_cfg_cjk_font_sub_i:n { #3 }, + \__xdu_cfg_cjk_font_sub_ifb:n { #3 } + } +\cs_new:Npn \__xdu_set_cjk_main_font:nn #1#2 + { + \setCJKmainfont { #1 } + [ \__xdu_font_path: \__xdu_cfg_cjk_font_ri:nn { #1 } { #2 } ] + } +\cs_new:Npn \__xdu_set_cjk_main_font:nnn #1#2#3 + { + \setCJKmainfont { #1 } + [ \__xdu_font_path: \__xdu_cfg_cjk_font_rbi:nnn { #1 } { #2 } { #3 } ] + } +\cs_new:Npn \__xdu_set_cjk_sans_font:n #1 + { + \setCJKsansfont { #1 } + [ \__xdu_font_path: \__xdu_cfg_cjk_font_r:n { #1 } ] + } +\cs_new:Npn \__xdu_set_cjk_sans_font:nn #1#2 + { + \setCJKsansfont { #1 } + [ \__xdu_font_path: \__xdu_cfg_cjk_font_rb:nn { #1 } { #2 } ] + } +\cs_new:Npn \__xdu_set_cjk_mono_font:n #1 + { + \setCJKmonofont { #1 } + [ \__xdu_font_path: \__xdu_cfg_cjk_font_r:n { #1 } ] + } +\cs_new:Npn \__xdu_load_cjk_font_win: + { + \__xdu_set_cjk_main_font:nn + { \__xdu_select_font:nn { SimSun } { simsun.ttc } } + { \__xdu_select_font:nn { KaiTi } { simkai.ttf } } + \__xdu_set_cjk_sans_font:n + { \__xdu_select_font:nn { SimHei } { simhei.ttf } } + \__xdu_set_cjk_mono_font:n + { \__xdu_select_font:nn { FangSong } { simfang.ttf } } + } +\cs_new:Npn \__xdu_load_cjk_font_adobe: + { + \__xdu_set_cjk_main_font:nn + { \__xdu_select_font:nn { Adobe~Song~Std } { adobesongstd-light.otf } } + { \__xdu_select_font:nn { Adobe~Kaiti~Std } { adobekaitistd-regular.otf } } + \__xdu_set_cjk_sans_font:n + { \__xdu_select_font:nn { Adobe~Heiti~Std } { adobeheitistd-regular.otf } } + \__xdu_set_cjk_mono_font:n + { \__xdu_select_font:nn { Adobe~Fangsong~Std } { Adobe-Fangsong-Std-R-Font.otf } } + } +\cs_new:Npn \__xdu_load_cjk_font_founder: + { + \__xdu_set_cjk_main_font:nn + { \__xdu_select_font:nn { FZShuSong-Z01 } { FZShuSong-Z01.ttf } } + { \__xdu_select_font:nn { FZKai-Z03 } { FZKai-Z03.ttf } } + \__xdu_set_cjk_sans_font:n + { \__xdu_select_font:nn { FZHei-B01 } { FZHei-B01.ttf } } + \__xdu_set_cjk_mono_font:n + { \__xdu_select_font:nn { FZFangSong-Z02 } { FZFSK.TTF } } + } +\cs_new:Npn \__xdu_load_cjk_font_sinotype: + { + \__xdu_set_cjk_main_font:nn + { \__xdu_select_font:nn { STSong } { STSONG.TTF } } + { \__xdu_select_font:nn { STKaiti } { STKAITI.TTF } } + \__xdu_set_cjk_sans_font:nn + { \__xdu_select_font:nn { STXihei } { STXIHEI.TTF } } + { \__xdu_select_font:nn { STHeiti } { STHeiti.ttf } } + \__xdu_set_cjk_mono_font:n + { \__xdu_select_font:nn { STFangsong } { STFANGSO.TTF } } + } +\cs_new:Npn \__xdu_load_cjk_font_fandol: + { + \__xdu_set_cjk_main_font:nnn + { FandolSong-Regular.otf } + { FandolSong-Bold.otf } + { FandolKai-Regular.otf } + \__xdu_set_cjk_sans_font:nn + { FandolHei-Regular.otf } + { FandolHei-Bold.otf } + \__xdu_set_cjk_mono_font:n + { FandolFang-Regular.otf } + } +\cs_new:Npn \__xdu_load_cjk_font_none: { } +\cs_new:Npn \__xdu_set_latin_font:nnn #1#2#3 + { + \__xdu_font_path: + BoldFont = { #1 }, + SlantedFont = { #2 }, + BoldSlantedFont = { #3 }, + ItalicFont = { #2 }, + BoldItalicFont = { #3 } + } +\cs_new:Npn \__xdu_set_latin_main_font:nnnnn #1#2#3#4#5 + { + \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } + { \setmainfont { #1 } } + { \setmainfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + } +\cs_new:Npn \__xdu_set_latin_sans_font:nnnnn #1#2#3#4#5 + { + \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } + { \setsansfont { #1 } } + { \setsansfont { #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + } +\cs_new:Npn \__xdu_set_latin_mono_font:nnnnn #1#2#3#4#5 + { + \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } + { \setmonofont{ #1 } } + { \setmonofont{ #2 } [ \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } + } +\cs_new:Npn \__xdu_load_latin_font_tacn: + { + \__xdu_set_latin_main_font:nnnnn + { Times~New~Roman } { times.ttf } { timesbd.ttf } { timesi.ttf } { timesbi.ttf } + \__xdu_set_latin_sans_font:nnnnn + { Arial } { arial.ttf } { arialbd.ttf } { ariali.ttf } { arialbi.ttf } + \__xdu_set_latin_mono_font:nnnnn + { Courier~New } { cour.ttf } { courbd.ttf } { couri.ttf } { courbi.ttf } + } +\cs_new:Npn \__xdu_load_latin_font_thcs: + { + \__xdu_set_latin_main_font:nnnnn + { Times~New~Roman } + { times.ttf } + { timesbd.ttf } + { timesi.ttf } + { timesbi.ttf } + \__xdu_set_latin_sans_font:nnnnn + { Helvetica } + { Helvetica.ttf } + { Helvetica~Bold.ttf } + { Helvetica~Oblique.ttf } + { Helvetica~Bold~Oblique.ttf } + \__xdu_set_latin_mono_font:nnnnn + { Courier~Std } + { CourierStd.otf } + { CourierStd-Bold.otf } + { CourierStd-Oblique.otf } + { CourierStd-BoldOblique.otf } + } +\cs_new:Npn \__xdu_load_latin_font_none: { } +\cs_new:Npn \__xdu_load_unicode_math_pkg: + { + \RequirePackage + [ \l__xdu_unicode_math_tl ] + { unicode-math } + } +\cs_new:Npn \__xdu_load_math_font_cambria: + { + \__xdu_load_unicode_math_pkg: + \str_if_eq:NNTF { \l__xdu_font_type_tl} { font} + { \setmathfont { Cambria~Math} } + { \setmathfont { cambria.ttc} [ Path = \l__xdu_font_path_tl/, FontIndex = 1 ] } + } +\cs_new:Npn \__xdu_define_math_font:nn #1#2 + { + \cs_new:cpn { __xdu_load_math_font_ #1 : } + { + \__xdu_load_unicode_math_pkg: + \setmathfont { #2 } + } + } +\clist_map_inline:nn + { + { asana } { Asana-Math.otf }, + { fira } { FiraMath-Regular.otf }, + { garamond } { Garamond-Math.otf }, + { lm } { latinmodern-math.otf }, + { libertinus } { LibertinusMath-Regular.otf }, + { stix } { STIXMath-Regular.otf }, + { bonum } { texgyrebonum-math.otf }, + { dejavu } { texgyredejavu-math.otf }, + { pagella } { texgyrepagella-math.otf }, + { schola } { texgyreschola-math.otf }, + { termes } { texgyretermes-math.otf } + } + { \__xdu_define_math_font:nn #1 } +\cs_new:Npn \__xdu_load_math_font_xits: + { + \__xdu_load_unicode_math_pkg: + \__xdu_if_platform_macos:FT + { + \setmathfont { XITS~Math } + } + { + \__xdu_load_unicode_math_pkg: + \setmathfont { XITSMath-Regular.otf } + \setmathfont { XITSMath-Bold.otf } + [range= { bfup -> up, bfit -> it } ] + } + } +\cs_new:Npn \__xdu_load_math_font_cm: { } +\cs_new:Npn \__xdu_load_math_font_none: { } +\cs_new:Npn \__xdu_load_font: + { + \use:c { __xdu_load_cjk_font_ \l__xdu_cjk_font_tl : } + \use:c { __xdu_load_latin_font_ \l__xdu_latin_font_tl : } + \use:c { __xdu_load_math_font_ \l__xdu_math_font_tl : } + } +\ctex_at_end_preamble:n { \__xdu_load_font: } +\NewDocumentCommand \xdusetup { m } + { \keys_set:nn { xdu } { #1 } } +\keys_define:nn { xdu } + { + style .meta:nn = { xdu / style } { #1 }, + info .meta:nn = { xdu / info } { #1 } + } +\ProcessKeysOptions { xdu / style } +%% +%% +%% End of file `xdufont.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls b/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls index 6e5b896a0fa..b268e393224 100644 --- a/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls +++ b/Master/texmf-dist/tex/xelatex/xduts/xduugthesis.cls @@ -26,8 +26,24 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplClass{xduugthesis} - {2022/04/09}{0.5.2.1}{Xidian University Undergraduate Thesis class} + {2022/04/10}{0.6.0.0} + {Xidian University Undergraduate Thesis class} \RequirePackage { xparse, l3keys2e } +\PassOptionsToPackage { quiet } { xeCJK } +\PassOptionsToClass + { + zihao=-4, + sub4section, + linespread = 1.5, + fontset = none + } + { ctexbook } +\LoadClass { ctexbook } +\RequirePackage { geometry } +\geometry { paper = a4paper } +\RequirePackage { fancyhdr } +\RequirePackage { xeCJKfntef } +\RequirePackage { graphicx } \tl_new:N \l__xdu_cjk_font_tl \str_new:N \l__xdu_fake_bold_str \str_new:N \l__xdu_fake_slant_str @@ -36,13 +52,6 @@ \tl_new:N \l__xdu_unicode_math_tl \tl_new:N \l__xdu_font_type_tl \tl_new:N \l__xdu_font_path_tl -\bool_new:N \l__xdu_en_cjk_font_bool -\tl_new:N \l__xdu_lang_tl -\tl_new:N \l__xdu_bib_tool_tl -\clist_new:N \l__xdu_bib_file_clist -\tl_new:N \l__xdu_fig_label_sep_tl -\clist_new:N \l__xdu_before_skip_clist -\clist_new:N \l__xdu_after_skip_clist \keys_define:nn { xdu / style } { cjk-font .choices:nn = @@ -61,56 +70,7 @@ unicode-math .tl_set:N = \l__xdu_unicode_math_tl, font-type .choices:nn = { font, file } { \tl_set_eq:NN \l__xdu_font_type_tl \l_keys_choice_tl }, - font-path .tl_set:N = \l__xdu_font_path_tl, - en-cjk-font .bool_set:N = \l__xdu_en_cjk_font_bool, - language .choices:nn = { zh, en } - { \tl_set_eq:NN \l__xdu_lang_tl \l_keys_choice_tl }, - bib-backend .choices:nn = { bibtex, biblatex } - { \tl_set_eq:NN \l__xdu_bib_tool_tl \l_keys_choice_tl }, - bib-resource .clist_set:N = \l__xdu_bib_file_clist, - fig-label-sep .tl_set:N = \l__xdu_fig_label_sep_tl, - before-skip .clist_set:N = \l__xdu_before_skip_clist, - after-skip .clist_set:N = \l__xdu_after_skip_clist - } -\str_new:N \l__xdu_title_str -\str_new:N \l__xdu_title_i_str -\str_new:N \l__xdu_title_ii_str -\str_new:N \l__xdu_dept_str -\str_new:N \l__xdu_major_str -\str_new:N \l__xdu_author_str -\str_new:N \l__xdu_supv_str -\str_new:N \l__xdu_supv_dept_str -\str_new:N \l__xdu_supv_ent_str -\str_new:N \l__xdu_supv_sch_str -\str_new:N \l__xdu_class_id_str -\str_new:N \l__xdu_student_id_str -\tl_new:N \l__xdu_abstract_zh_tl -\tl_new:N \l__xdu_abstract_en_tl -\clist_new:N \l__xdu_keywords_zh_clist -\clist_new:N \l__xdu_keywords_en_clist -\tl_new:N \l__xdu_ack_tl -\keys_define:nn { xdu / info } - { - title .tl_set:N = \l__xdu_title_str, - department .tl_set:N = \l__xdu_dept_str, - major .tl_set:N = \l__xdu_major_str, - author .tl_set:N = \l__xdu_author_str, - supervisor .tl_set:N = \l__xdu_supv_str, - supervisor-department .tl_set:N = \l__xdu_supv_dept_str, - supervisor-enterprise .tl_set:N = \l__xdu_supv_ent_str, - supervisor-school .tl_set:N = \l__xdu_supv_sch_str, - class-id .tl_set:N = \l__xdu_class_id_str, - student-id .tl_set:N = \l__xdu_student_id_str, - abstract .tl_set:N = \l__xdu_abstract_zh_tl, - abstract* .tl_set:N = \l__xdu_abstract_en_tl, - keywords .clist_set:N = \l__xdu_keywords_zh_clist, - keywords* .clist_set:N = \l__xdu_keywords_en_clist, - acknowledgements .tl_set:N = \l__xdu_ack_tl - } -\keys_define:nn { xdu } - { - style .meta:nn = { xdu / style } { #1 }, - info .meta:nn = { xdu / info } { #1 } + font-path .tl_set:N = \l__xdu_font_path_tl } \keys_set:nn { xdu } { @@ -121,62 +81,24 @@ style / math-font = cm, style / unicode-math = { }, style / font-type = font, - style / font-path = fonts, - style / en-cjk-font = false, - style / language = zh, - style / bib-backend = biblatex, - style / bib-resource = { }, - style / fig-label-sep = { 0.75em }, - style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt }, - style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt }, - info / title = { }, - info / department = { }, - info / major = { }, - info / author = { }, - info / supervisor = { }, - info / supervisor-department = { }, - info / supervisor-enterprise = { }, - info / supervisor-school = { }, - info / class-id = { }, - info / student-id = { }, - info / abstract = { }, - info / abstract* = { }, - info / keywords = { }, - info / keywords* = { }, - info / acknowledgements = { } + style / font-path = fonts } -\NewDocumentCommand \xdusetup { m } - { \keys_set:nn { xdu } { #1 } } -\ProcessKeysOptions { xdu } -\str_if_eq:NNTF { \l__xdu_cjk_font_tl } { fandol } - { \PassOptionsToPackage { quiet } { fontspec } } - { } -\PassOptionsToPackage { quiet } { xeCJK } -\PassOptionsToClass +\cs_new:Npn \__xdu_if_platform_macos:FT #1#2 + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } } +\cs_new:Npn \__xdu_texmf_font:nn #1#2 + { \__xdu_if_platform_macos:FT { #1 } { #2 } } +\cs_new:Npn \__xdu_select_font:nn #1#2 { - zihao=-4, - sub4section, - linespread = 1.5, - fontset = none + \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } + { #1 } + { #2 } } - { ctexbook } -\LoadClass { ctexbook } \cs_new:Npn \__xdu_font_path: { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { } { Path = \l__xdu_font_path_tl / , } } -\cs_new:Npn \__xdu_if_platform_macos:FT #1#2 - { \ctex_if_platform_macos:TF { #2 } { #1 } } -\cs_new:Npn \__xdu_texmf_font:nn #1#2 - { \__xdu_if_platform_macos:FT { #1 } { #2 } } -\cs_new:Npn \__xdu_rm_family: - { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { rm } } { \rmfamily } } -\cs_new:Npn \__xdu_sf_family: - { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { sf } } { \sffamily } } -\cs_new:Npn \__xdu_tt_family: - { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { tt } } { \ttfamily } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_b:n #1 { BoldFont = { #1 } @@ -260,12 +182,6 @@ \__xdu_cfg_cjk_font_sub_i:n { #3 }, \__xdu_cfg_cjk_font_sub_ifb:n { #3 } } -\cs_new:Npn \__xdu_select_font:nn #1#2 - { - \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } - { #1 } - { #2 } - } \cs_new:Npn \__xdu_set_cjk_main_font:nn #1#2 { \setCJKmainfont { #1 } @@ -419,10 +335,10 @@ \cs_new:Npn \__xdu_define_math_font:nn #1#2 { \cs_new:cpn { __xdu_load_math_font_ #1 : } - { - \__xdu_load_unicode_math_pkg: - \setmathfont { #2 } - } + { + \__xdu_load_unicode_math_pkg: + \setmathfont { #2 } + } } \clist_map_inline:nn { @@ -462,14 +378,108 @@ \use:c { __xdu_load_math_font_ \l__xdu_math_font_tl : } } \ctex_at_end_preamble:n { \__xdu_load_font: } -\cs_new_protected:Npn \__xdu_begin_document:n #1 - { \ctex_gadd_ltxhook:nn { env/document/begin } { #1 } } +\str_new:N \l__xdu_title_str +\str_new:N \l__xdu_title_i_str +\str_new:N \l__xdu_title_ii_str +\str_new:N \l__xdu_dept_str +\str_new:N \l__xdu_major_str +\str_new:N \l__xdu_author_str +\str_new:N \l__xdu_supv_str +\str_new:N \l__xdu_supv_dept_str +\str_new:N \l__xdu_supv_ent_str +\str_new:N \l__xdu_supv_sch_str +\str_new:N \l__xdu_class_id_str +\str_new:N \l__xdu_student_id_str +\tl_new:N \l__xdu_abstract_zh_tl +\tl_new:N \l__xdu_abstract_en_tl +\clist_new:N \l__xdu_keywords_zh_clist +\clist_new:N \l__xdu_keywords_en_clist +\tl_new:N \l__xdu_ack_tl +\keys_define:nn { xdu / info } + { + title .tl_set:N = \l__xdu_title_str, + department .tl_set:N = \l__xdu_dept_str, + major .tl_set:N = \l__xdu_major_str, + author .tl_set:N = \l__xdu_author_str, + supervisor .tl_set:N = \l__xdu_supv_str, + supervisor-department .tl_set:N = \l__xdu_supv_dept_str, + supervisor-enterprise .tl_set:N = \l__xdu_supv_ent_str, + supervisor-school .tl_set:N = \l__xdu_supv_sch_str, + class-id .tl_set:N = \l__xdu_class_id_str, + student-id .tl_set:N = \l__xdu_student_id_str, + abstract .tl_set:N = \l__xdu_abstract_zh_tl, + abstract* .tl_set:N = \l__xdu_abstract_en_tl, + keywords .clist_set:N = \l__xdu_keywords_zh_clist, + keywords* .clist_set:N = \l__xdu_keywords_en_clist, + acknowledgements .tl_set:N = \l__xdu_ack_tl + } +\keys_set:nn { xdu } + { + info / title = { }, + info / department = { }, + info / major = { }, + info / author = { }, + info / supervisor = { }, + info / supervisor-department = { }, + info / supervisor-enterprise = { }, + info / supervisor-school = { }, + info / class-id = { }, + info / student-id = { }, + info / abstract = { }, + info / abstract* = { }, + info / keywords = { }, + info / keywords* = { }, + info / acknowledgements = { } + } +\bool_new:N \l__xdu_en_cjk_font_bool +\tl_new:N \l__xdu_lang_tl +\tl_new:N \l__xdu_bib_tool_tl +\clist_new:N \l__xdu_bib_file_clist +\tl_new:N \l__xdu_fig_label_sep_tl +\clist_new:N \l__xdu_before_skip_clist +\clist_new:N \l__xdu_after_skip_clist +\keys_define:nn { xdu / style } + { + en-cjk-font .bool_set:N = \l__xdu_en_cjk_font_bool, + language .choices:nn = { zh, en } + { \tl_set_eq:NN \l__xdu_lang_tl \l_keys_choice_tl }, + bib-backend .choices:nn = { bibtex, biblatex } + { \tl_set_eq:NN \l__xdu_bib_tool_tl \l_keys_choice_tl }, + bib-resource .clist_set:N = \l__xdu_bib_file_clist, + fig-label-sep .tl_set:N = \l__xdu_fig_label_sep_tl, + before-skip .clist_set:N = \l__xdu_before_skip_clist, + after-skip .clist_set:N = \l__xdu_after_skip_clist + } +\keys_set:nn { xdu } + { + style / en-cjk-font = false, + style / language = zh, + style / bib-backend = biblatex, + style / bib-resource = { }, + style / fig-label-sep = { 0.75em }, + style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt }, + style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt } + } +\NewDocumentCommand \xdusetup { m } + { \keys_set:nn { xdu } { #1 } } +\keys_define:nn { xdu } + { + style .meta:nn = { xdu / style } { #1 }, + info .meta:nn = { xdu / info } { #1 } + } +\ProcessKeysOptions { xdu / style } \cs_new:Npn \__xdu_lang_switch:nn #1#2 { \str_if_eq:NNTF { \l__xdu_lang_tl } { zh } { #1 } { #2 } } +\cs_new:Npn \__xdu_rm_family: + { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { rm } } { \rmfamily } } +\cs_new:Npn \__xdu_sf_family: + { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { sf } } { \sffamily } } +\cs_new:Npn \__xdu_tt_family: + { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { tt } } { \ttfamily } } \ctex_at_end_preamble:n { \str_new:N \l__xdu_pure_title_str @@ -512,89 +522,6 @@ \chapter* { #1 } \markboth { #1 } { } } -\RequirePackage [ titles ] { tocloft } -\renewcommand { \cftchapleader } { \bfseries \cftdotfill { \cftdotsep } } -\clist_map_inline:nn - { - \cftbeforechapskip, - \cftbeforesecskip, - \cftbeforesubsecskip, - \cftbeforesubsubsecskip, - \cftbeforeparaskip, - \cftbeforesubparaskip - } - { \dim_set:Nn { #1 } { 5pt } } - \clist_map_inline:nn - { - \cftchapfont, - \cftchappagefont - } - { \renewcommand { #1 } { \__xdu_rm_family: \zihao { -4 } \bfseries } } -\clist_map_inline:nn - { - \cftsecfont, - \cftsubsecfont, - \cftsubsubsecfont, - \cftparafont, - \cftsubparafont, - \cftsecpagefont, - \cftsubsecpagefont, - \cftsubsubsecpagefont, - \cftparapagefont, - \cftsubparapagefont - } - { \renewcommand { #1 } { \__xdu_rm_family: \zihao { -4 } } } -\RequirePackage { caption } -\DeclareCaptionLabelSeparator { customskip } { \hskip \l__xdu_fig_label_sep_tl } -\DeclareCaptionFont { customfont } { \__xdu_rm_family: \zihao { 5 } } -\captionsetup - { - labelsep = customskip, - font = customfont - } -\PassOptionsToPackage { font = small } { subfig } -\captionsetup [ sub ] { font = customfont } -\RequirePackage{hyperref} -\hypersetup - { - bookmarksnumbered, - hidelinks - } -\ctex_at_end_preamble:n - { - \hypersetup - { - pdftitle = \l__xdu_pure_title_str, - pdfsubject = {西安电子科技大学本科毕业设计论文}, - pdfauthor = \l__xdu_author_str - } - } -\__xdu_begin_document:n - { - \tl_if_eq:NnTF \l__xdu_bib_tool_tl { bibtex } - { - \RequirePackage [ sort&compress,square,super,comma,numbers ] { natbib } - \RequirePackage { gbt7714 } - \bibliographystyle { gbt7714-numerical } - } - { - \RequirePackage [ style = gb7714-2015 ] { biblatex } - \clist_map_inline:Nn \l__xdu_bib_file_clist { \addbibresource { #1 } } - } - } -\RequirePackage { environ } -\NewEnviron { appendixes } - { - \appendix - \renewcommand { \thefigure } { \thechapter \arabic { figure } } - \renewcommand { \thetable } { \thechapter \arabic { table } } - \BODY - } -\RequirePackage { geometry } -\geometry { paper = a4paper } -\RequirePackage { fancyhdr } -\RequirePackage { xeCJKfntef } -\RequirePackage { graphicx } \cs_new:Npn \__xdu_typeout_keywords:nNn #1#2#3 { \str_clear_new:N \l__xdu_keywords_label_str @@ -736,6 +663,87 @@ paragraph / afterskip = { \clist_item:Nn \l__xdu_after_skip_clist { 5 } }, subparagraph / afterskip = { \clist_item:Nn \l__xdu_after_skip_clist { 6 } } } +\RequirePackage [ titles ] { tocloft } +\renewcommand { \cftchapleader } { \bfseries \cftdotfill { \cftdotsep } } +\clist_map_inline:nn + { + \cftbeforechapskip, + \cftbeforesecskip, + \cftbeforesubsecskip, + \cftbeforesubsubsecskip, + \cftbeforeparaskip, + \cftbeforesubparaskip + } + { \dim_set:Nn { #1 } { 5pt } } + \clist_map_inline:nn + { + \cftchapfont, + \cftchappagefont + } + { \renewcommand { #1 } { \__xdu_rm_family: \zihao { -4 } \bfseries } } +\clist_map_inline:nn + { + \cftsecfont, + \cftsubsecfont, + \cftsubsubsecfont, + \cftparafont, + \cftsubparafont, + \cftsecpagefont, + \cftsubsecpagefont, + \cftsubsubsecpagefont, + \cftparapagefont, + \cftsubparapagefont + } + { \renewcommand { #1 } { \__xdu_rm_family: \zihao { -4 } } } +\renewcommand { \theequation } { \thechapter - \arabic { equation } } +\RequirePackage { caption } +\DeclareCaptionLabelSeparator { customskip } { \hskip \l__xdu_fig_label_sep_tl } +\DeclareCaptionFont { customfont } { \__xdu_rm_family: \zihao { 5 } } +\captionsetup + { + labelsep = customskip, + font = customfont + } +\PassOptionsToPackage { font = small } { subfig } +\captionsetup [ sub ] { font = customfont } +\RequirePackage{hyperref} +\hypersetup + { + bookmarksnumbered, + hidelinks + } +\ctex_at_end_preamble:n + { + \hypersetup + { + pdftitle = \l__xdu_pure_title_str, + pdfsubject = {西安电子科技大学本科毕业设计论文}, + pdfauthor = \l__xdu_author_str + } + } +\cs_new_protected:Npn \__xdu_begin_document:n #1 + { \ctex_gadd_ltxhook:nn { env/document/begin } { #1 } } +\__xdu_begin_document:n + { + \tl_if_eq:NnTF \l__xdu_bib_tool_tl { bibtex } + { + \RequirePackage [ sort&compress,square,super,comma,numbers ] { natbib } + \RequirePackage { gbt7714 } + \bibliographystyle { gbt7714-numerical } + } + { + \RequirePackage [ style = gb7714-2015 ] { biblatex } + \clist_map_inline:Nn \l__xdu_bib_file_clist { \addbibresource { #1 } } + } + } +\RequirePackage { environ } +\NewEnviron { appendixes } + { + \appendix + \renewcommand { \thefigure } { \thechapter \arabic { figure } } + \renewcommand { \thetable } { \thechapter \arabic { table } } + \BODY + } \cs_new:Npn \__xdu_cover_i:nn #1#2 { \vbox_to_ht:nn {12pt} @@ -879,7 +887,6 @@ \tableofcontents \cleardoublepage } -\renewcommand { \theequation } { \thechapter - \arabic { equation } } \renewcommand{\mainmatter} { \loadgeometry { main } -- cgit v1.2.3