| 1 |
% \iffalse meta-comment |
| 2 |
% !TeX program = XeLaTeX |
| 3 |
% !TeX encoding = UTF-8 |
| 4 |
% |
| 5 |
% Copyright (C) 2021 - 2026 |
| 6 |
% by Nanjing University Linux User Group |
| 7 |
% <[email protected]> |
| 8 |
% |
| 9 |
% It may be distributed and/or modified under the conditions of the |
| 10 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 11 |
% license or (at your option) any later version. The latest version |
| 12 |
% of this license is in the file |
| 13 |
% |
| 14 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% |
| 16 |
% This work has the LPPL maintenance status `maintained'. |
| 17 |
% |
| 18 |
% The Current Maintainer of this work is Yu Xiong. |
| 19 |
% |
| 20 |
% This work consists of the files njuthesis.dtx, |
| 21 |
% and the derived files njuthesis.ins, |
| 22 |
% njuthesis.cls, |
| 23 |
% njuthesis-doc.cls, |
| 24 |
% njuthesis-graduate.def, |
| 25 |
% njuthesis-postdoctoral.def, |
| 26 |
% njuthesis-undergraduate.def, |
| 27 |
% njuthesis.pdf, |
| 28 |
% njuthesis-emblem-black.pdf, |
| 29 |
% njuthesis-emblem-purple.pdf, |
| 30 |
% njuthesis-name-black.pdf, |
| 31 |
% njuthesis-name-purple.pdf, |
| 32 |
% and README.md. |
| 33 |
% |
| 34 |
% ----------------------------------------------------------------------- |
| 35 |
% |
| 36 |
% The development version of the template can be found at |
| 37 |
% |
| 38 |
% https://github.com/nju-lug/NJUThesis |
| 39 |
% |
| 40 |
% for those people who are interested. |
| 41 |
% |
| 42 |
%<*internal> |
| 43 |
\begingroup |
| 44 |
\def\NameOfLaTeXe{LaTeX2e} |
| 45 |
\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else |
| 46 |
\csname fi\endcsname |
| 47 |
%</internal> |
| 48 |
% |
| 49 |
%<*install> |
| 50 |
\input docstrip.tex |
| 51 |
\keepsilent |
| 52 |
\askforoverwritefalse |
| 53 |
|
| 54 |
\preamble |
| 55 |
|
| 56 |
Copyright (C) 2021 - 2026 |
| 57 |
by Nanjing University Linux User Group |
| 58 |
<[email protected]> |
| 59 |
|
| 60 |
This file may be distributed and/or modified under the conditions of |
| 61 |
the LaTeX Project Public License, either version 1.3c of this license |
| 62 |
or (at your option) any later version. The latest version of this |
| 63 |
license is in: |
| 64 |
|
| 65 |
http://www.latex-project.org/lppl.txt |
| 66 |
|
| 67 |
and version 1.3 or later is part of all distributions of LaTeX version |
| 68 |
2005/12/01 or later. |
| 69 |
|
| 70 |
To produce the documentation run the original source files ending with |
| 71 |
`.dtx' through XeTeX. |
| 72 |
|
| 73 |
\endpreamble |
| 74 |
|
| 75 |
\generate{ |
| 76 |
\usedir{tex/latex/njuthesis} |
| 77 |
\file{\jobname.cls} {\from{\jobname.dtx}{class}} |
| 78 |
\file{\jobname-undergraduate.def} {\from{\jobname.dtx}{def-u}} |
| 79 |
\file{\jobname-graduate.def} {\from{\jobname.dtx}{def-g}} |
| 80 |
\file{\jobname-postdoctoral.def} {\from{\jobname.dtx}{def-p}} |
| 81 |
\file{\jobname-doc.cls} {\from{\jobname.dtx}{doc-cls}} |
| 82 |
%<*internal> |
| 83 |
\usedir{source/latex/njuthesis} |
| 84 |
\file{\jobname.ins} {\from{\jobname.dtx}{install}} |
| 85 |
%</internal> |
| 86 |
} |
| 87 |
|
| 88 |
\obeyspaces |
| 89 |
\Msg{*************************************************************} |
| 90 |
\Msg{* *} |
| 91 |
\Msg{* To finish the installation you have to move the following *} |
| 92 |
\Msg{* files into a directory searched by TeX: *} |
| 93 |
\Msg{* *} |
| 94 |
\Msg{* The recommended directory is TDS:tex/latex/njuthesis *} |
| 95 |
\Msg{* *} |
| 96 |
\Msg{* njuthesis.cls *} |
| 97 |
\Msg{* njuthesis-doc.cls *} |
| 98 |
\Msg{* njuthesis-graduate.def *} |
| 99 |
\Msg{* njuthesis-postdoctoral.def *} |
| 100 |
\Msg{* njuthesis-undergraduate.def *} |
| 101 |
\Msg{* njuthesis.ins *} |
| 102 |
\Msg{* njuthesis-emblem-black.pdf, *} |
| 103 |
\Msg{* njuthesis-emblem-purple.pdf, *} |
| 104 |
\Msg{* njuthesis-name-black.pdf, *} |
| 105 |
\Msg{* njuthesis-name-purple.pdf, *} |
| 106 |
\Msg{* *} |
| 107 |
\Msg{* To produce the documentation, run the file njuthesis.dtx *} |
| 108 |
\Msg{* through XeLaTeX. *} |
| 109 |
\Msg{* *} |
| 110 |
\Msg{* Happy TeXing! *} |
| 111 |
\Msg{* *} |
| 112 |
\Msg{*************************************************************} |
| 113 |
|
| 114 |
\endbatchfile |
| 115 |
%</install> |
| 116 |
% |
| 117 |
%<*internal> |
| 118 |
\fi |
| 119 |
%</internal> |
| 120 |
% |
| 121 |
%<class>\NeedsTeXFormat{LaTeX2e} |
| 122 |
%<*!(driver|install)> |
| 123 |
%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.5.0 2026-05-15 17:00:00 |
| 124 |
%<+!driver> +0800 NJU LUG <[email protected]>$ |
| 125 |
%<class> {Thesis template for Nanjing University} |
| 126 |
%<class>\ProvidesExplClass{njuthesis} |
| 127 |
%<def-u> {Undergraduate definition file for njuthesis} |
| 128 |
% ^^A 诚耀百廿,雄创一流 |
| 129 |
% ^^A 南京大学一百二十周年华诞邀您共襄盛举! |
| 130 |
%<def-u>\ProvidesExplFile{njuthesis-undergraduate.def} |
| 131 |
%<def-g> {Graduate definition file for njuthesis} |
| 132 |
%<def-g>\ProvidesExplFile{njuthesis-graduate.def} |
| 133 |
%<def-p> {Postdoctoral definition file for njuthesis} |
| 134 |
%<def-p>\ProvidesExplFile{njuthesis-postdoctoral.def} |
| 135 |
%<doc-cls> {Documentation style for njuthesis} |
| 136 |
%<doc-cls>\ProvidesExplFile{njuthesis-doc.cls} |
| 137 |
%<!driver> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} |
| 138 |
%</!(driver|install)> |
| 139 |
% |
| 140 |
%<*driver> |
| 141 |
\ProvidesFile{njuthesis.dtx} |
| 142 |
\PassOptionsToClass{codehigh}{njuthesis-doc} |
| 143 |
\documentclass{njuthesis-doc} |
| 144 |
\begin{document} |
| 145 |
\DocInput{njuthesis.dtx} |
| 146 |
\PrintChanges |
| 147 |
\PrintIndex |
| 148 |
\end{document} |
| 149 |
%</driver> |
| 150 |
% \fi |
| 151 |
% |
| 152 |
% \title{\color{njuviolet}{The \cls{njuthesis} class\\ |
| 153 |
% \textbf{南京大学学位论文模板}}} |
| 154 |
% |
| 155 |
% \author{南京大学 Linux 用户组 |
| 156 |
% \thanks{E-mail: \href{mailto:[email protected]} |
| 157 |
% {[email protected]}}} |
| 158 |
% |
| 159 |
% \date{v1.5.0 \quad 2026-05-15} |
| 160 |
% |
| 161 |
% \changes{v0.1}{2021/09/04}{开始开发。} |
| 162 |
% \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。} |
| 163 |
% \changes{v0.3}{2021/09/09}{使用自动构建工具进行测试。} |
| 164 |
% \changes{v0.4}{2021/09/09}{将个人信息使用内置命令输入。} |
| 165 |
% \changes{v0.5}{2021/09/10}{新增了对第二导师的支持。} |
| 166 |
% \changes{v0.6}{2021/09/10}{封装个人信息} |
| 167 |
% \changes{v0.6}{2021/09/10}{实现自动打包发布。} |
| 168 |
% \changes{v0.7}{2021/09/11}{增加对研究生模板的支持} |
| 169 |
% \changes{v0.7}{2021/09/12}{将 \cls{njuthesis} 发布在 CTAN。} |
| 170 |
% \changes{v0.8}{2021/09/12}{修复已知问题,进行公开宣传。} |
| 171 |
% \changes{v0.9}{2021/09/15}{使用 DocStrip 合并模板文件。} |
| 172 |
% \changes{v0.9}{2021/09/15}{大幅度修改宏名称以符合 \LaTeX3 规范。} |
| 173 |
% \changes{v0.9}{2021/09/15}{进一步完善文档。} |
| 174 |
% \changes{v0.10}{2021/09/24}{删除了生成自述文件的代码。} |
| 175 |
% \changes{v0.12}{2021/11/28}{删除内置的 \pkg{njuvisual} 代码。} |
| 176 |
% \changes{v0.12}{2021/11/29}{更新了说明文档封面设计。} |
| 177 |
% \changes{v0.12}{2021/11/30}{区分测试文件和空白模板。} |
| 178 |
% \changes{v0.12}{2021/12/06}{修改了说明文档的代码呈现样式。} |
| 179 |
% \changes{v0.13}{2021/12/12}{优化了编译速度。} |
| 180 |
% \changes{v0.13}{2021/12/15}{适配2022届本科生毕业毕业论文(设计)规范。} |
| 181 |
% \changes{v0.13}{2021/12/16}{默认不加载 \pkg{listings} 宏包。} |
| 182 |
% \changes{v0.14}{2022/01/13}{将本模板内嵌入南大 \TeX{} 网站。} |
| 183 |
% \changes{v0.16}{2022/03/01}{分离本科生和研究生模板配置。} |
| 184 |
% \changes{v0.19}{2022/05/23}{对研究生普通封面进行若干细节修改。} |
| 185 |
% \changes{v0.19}{2022/05/23}{对国家图书馆封面进行若干细节修改。} |
| 186 |
% \changes{v0.20}{2022/06/08}{更正本科生模板部分字样。} |
| 187 |
% \changes{v1.0}{2022/06/29}{移除毕业设计封面。} |
| 188 |
% \changes{v1.0}{2022/07/05}{按类型重命名变量。} |
| 189 |
% \changes{v1.0}{2022/07/23}{新增博士后出站报告模板。} |
| 190 |
% \changes{v1.0}{2022/07/28}{在手册中以不同颜色指示不同模块。} |
| 191 |
% \changes{v1.0}{2022/08/02}{删除 \LaTeX 基础用法的说明。} |
| 192 |
% \changes{v1.1}{2023/01/05}{适配2023届本科生毕业毕业论文(设计)规范。} |
| 193 |
% \changes{v1.1}{2023/01/05}{适配新版南大 \LaTeX 在线编辑器。} |
| 194 |
% \changes{v1.4}{2024/03/11}{总是全局修改全局变量。} |
| 195 |
% \changes{v1.4}{2024/03/18}{将变量统一为 |l| 类型。} |
| 196 |
% \changes{v1.5.0}{2025/04/13}{补全变量声明。} |
| 197 |
% \changes{v1.5.0}{2025/04/13}{为全局操作匹配全局变量。} |
| 198 |
% |
| 199 |
% \maketitle |
| 200 |
% |
| 201 |
% \let\abstractname\relax |
| 202 |
% \begin{abstract} |
| 203 |
% \cls{njuthesis} 是制作南京大学本科生毕业论文、研究生学位论文、博士后出站报告的 |
| 204 |
% \LaTeX 文档类。本模板基于本科生院的论文撰写规范制作,同时参考研究生院提供的硕士、 |
| 205 |
% 博士学位材料包,用于生成符合南京大学排版要求和相应的国家标准的学位论 |
| 206 |
% 文,力求通过 \LaTeX3 语法实现清晰的实现逻辑、较高的可定制性以及友好的用户接口。 |
| 207 |
% \end{abstract} |
| 208 |
% |
| 209 |
% \begin{abstract} |
| 210 |
% The \cls{njuthesis} class is intended for typesetting Nanjing University |
| 211 |
% dissertations with \LaTeX, providing support for bachelor, master, |
| 212 |
% doctoral theses as well as postdoctoral reports. |
| 213 |
% \end{abstract} |
| 214 |
% |
| 215 |
% \vspace{2cm} |
| 216 |
% \def\abstractname{特别声明} |
| 217 |
% \begin{abstract} |
| 218 |
% 在使用本模板时,我们默认您同意以下内容: |
| 219 |
% \begin{enumerate} |
| 220 |
% \item 本模板通过 LPPL 1.3c 协议开放源代码,您可以随意使用编译出的 PDF 文件。 |
| 221 |
% \item 本模板与学校官方部门并不存在合作关系, |
| 222 |
% 作者不对使用本模板产生的格式审查问题负责。 |
| 223 |
% \item 遇到本文档没有覆盖的问题属于正常情况,欢迎提交反馈意见。 |
| 224 |
% \end{enumerate} |
| 225 |
% |
| 226 |
% 我们的 \href{https://git.nju.edu.cn/nju-lug/lug-introduction} |
| 227 |
% {Linux 用户组}始终欢迎您的加入! |
| 228 |
% \end{abstract} |
| 229 |
% |
| 230 |
% \clearpage |
| 231 |
% |
| 232 |
% |
| 233 |
% \setcounter{tocdepth}{4} |
| 234 |
% \tableofcontents |
| 235 |
% |
| 236 |
% \clearpage |
| 237 |
% |
| 238 |
% |
| 239 |
% \begin{documentation} |
| 240 |
% |
| 241 |
% \section{模板介绍} |
| 242 |
% |
| 243 |
% \cls{njuthesis},即南京大学学位论文模板,是一个由南京大学 Linux |
| 244 |
% 用户组维护的,用于处理本校学生毕业论文排版需求的 \LaTeX 模板。 |
| 245 |
% |
| 246 |
% 本模板使用的本科生毕业论文模板格式依据 |
| 247 |
% 《关于启动南京大学2026届本科毕业论文(设计)工作的通知》\cite{nju-bachelor-2026}, |
| 248 |
% 研究生学位论文格式依据研究生院提供的材料包\cite{nju-graduate-2026}。 |
| 249 |
% 博士后出站报告格式要求与博士学位论文一致\cite{nju-postdoc-2022}, |
| 250 |
% 封面、摘要的设计参考了部分既有报告。 |
| 251 |
% |
| 252 |
% |
| 253 |
% \subsection{开始之前} |
| 254 |
% \label{subsec:first-things-first} |
| 255 |
% |
| 256 |
% 在本文正式介绍 \cls{njuthesis} 论文模板前,您也许并不熟悉 \LaTeX 模板的使用方法。 |
| 257 |
% 话不多说,请先按部就班体验一遍下述的工作流程: |
| 258 |
% |
| 259 |
% \bigskip |
| 260 |
% \fcolorbox{tpblue}{gray!5}{\parbox{\textwidth-5em}{% |
| 261 |
% \hspace{2em}\begin{minipage}[c]{10cm} |
| 262 |
% \begin{enumerate} |
| 263 |
% \item 访问 \url{https://tex.nju.edu.cn} |
| 264 |
% \item 点击\tpbutton{使用南大统一身份认证登录} |
| 265 |
% \item 点击右上角\tpbutton{LaTeX 模板},选择\tpbutton{南京大学学位论文} |
| 266 |
% \item 点击进入刚刚新建的项目 |
| 267 |
% \end{enumerate} |
| 268 |
% \end{minipage}}} |
| 269 |
% |
| 270 |
% \bigskip |
| 271 |
% 稍等片刻,您会在浏览器右侧发现一份新生成的空白论文。 |
| 272 |
% 如果它的效果令您满意,不妨以 \file{njuthesis-sample.tex} 为基础开始写作。 |
| 273 |
% |
| 274 |
% \subparagraph{我一定要体验上述流程吗?} |
| 275 |
% 是,但也不一定。有人坚持认为应该做一些\emph{直观、清晰、有手就行、一 |
| 276 |
% 条路走到底}的教程,而不是\emph{长篇累牍的精细介绍},其核心论据在于: |
| 277 |
% 现代人类总体上需要快速取得成就感,而且大部分可能用到本模板的同学不 |
| 278 |
% 会具备必要的基础知识。反驳的观点在于过分简单的实验总是浪费时间的, |
| 279 |
% 尤其是在您可能早已掌握基本用法的情况下。但,不论如何,这番操作总会 |
| 280 |
% 使您预览到 \cls{njuthesis} 论文模板的实际样式。 |
| 281 |
% |
| 282 |
% \subparagraph{我并没有见到理想的结果。} |
| 283 |
% 具体是哪里不满意?如果是\emph{样式存在偏差},请联系模板的作者;如果 |
| 284 |
% \emph{不能访问前文提到的在线编译网站},请考虑检查网络连接,依次咨询 |
| 285 |
% 本校\href{https://itsc.nju.edu.cn}{信息化管理建设服务中心}和该网站 |
| 286 |
% 的维护者\href{mailto:[email protected]}{姚舸老师};如果\emph{报错},请 |
| 287 |
% 点击左上角的菜单按钮,查看编译器是否显示为 |XeLaTeX|; |
| 288 |
% 再如果\emph{还有其他原因},通过这几分钟的实验我们也可以得到一个极其 |
| 289 |
% 有益的结论:\emph{也许 Word 模板更加适合您}。这可以节省下熟悉 |
| 290 |
% \TeX{} 排版软件使用方法所需的可观时间。 |
| 291 |
% |
| 292 |
% \subparagraph{但我依然对 \LaTeX 一无所知!} |
| 293 |
% 这意味着您真的得花些时间在\emph{长篇累牍的精细介绍}上。 |
| 294 |
% 如果您已经下定决心,请接着向后阅读,有需要时善用搜索引擎。 |
| 295 |
% |
| 296 |
% |
| 297 |
% \subsection{历史沿革} |
| 298 |
% |
| 299 |
% 十几年来,多位热心校友发布过自己编写的模板,在 GitHub 网站上可考的包括: |
| 300 |
% \begin{enumerate} |
| 301 |
% \item 杨文博(\href{http://yangwenbo.com/}{@solrex})的 |
| 302 |
% njuthesis(2010 - 2018) \cite{wenboyang2013} |
| 303 |
% \item \href{https://github.com/fireblue}{@fireblue} 基于杨文博模板的 |
| 304 |
% NJUThesis(2013)\cite{fireblue2013} |
| 305 |
% \item \href{https://github.com/wenhai-zheng}{@wenhai-zheng} 的 |
| 306 |
% NJUThesis(2013)\cite{wenhai-zheng2013} |
| 307 |
% \item 曹增乐(\href{https://github.com/ZLCao}{@ZLCao})的 |
| 308 |
% NJUBachelor(2013 - 2016)\cite{zenglecao2013} |
| 309 |
% \item 胡海星(\href{http://haixing-hu.github.io/}{@Haixing-Hu})的 |
| 310 |
% NJU-Thesis(2013 - 2018)\cite{haixinghu2013} |
| 311 |
% \item 张楚珩(\href{https://github.com/zhangchuheng123}{@zhangchuheng123}) |
| 312 |
% 基于胡海星模板的 NJUThesis(2016)\cite{chuhengzhang2016} |
| 313 |
% \item 蒋炎岩(\href{http://ics.nju.edu.cn/~jyy/}{@jiangyy})的 |
| 314 |
% njuthesis(2017 - 2019)\cite{yanyanjiang2017} |
| 315 |
% \item \href{https://github.com/njuHan}{@njuHan} 基于胡海星模板的 |
| 316 |
% NJU-Thesis(2018 - 2021) |
| 317 |
% \item 饶安逸(\href{https://anyirao.com/}{@AnyiRao})基于张楚珩模板的 |
| 318 |
% NJU Thesis 2018(2018)\cite{anyirao2018} |
| 319 |
% \item 赵懿晨(\href{https://fengchendian.github.io/about.html} |
| 320 |
% {@FengChendian})基于饶安逸模板的 |
| 321 |
% NJU Thesis 2021(2021)\cite{yichenzhao2021} |
| 322 |
% \end{enumerate} |
| 323 |
% 至于不幸而未进行代码版本管理的,甚至于说以压缩包形式流传于各人硬盘中的,就更不可计数了。 |
| 324 |
% |
| 325 |
% 与其让一千个学生做一千种不同的模板,不如有人牵起头来,集中力量办大事。因此,南 |
| 326 |
% 京大学 Linux User Group 的有志之士在2021年暑期联合起来,参考以上的现成模板,兼 |
| 327 |
% 顾友校 \cls{fduthesis}\cite{fduthesis}、\textsc{THuThesis}\cite{thuthesis} 等 |
| 328 |
% 优秀项目,构建了这一全新模板,力求通过 \LaTeX3 语法和清晰的接口实现良 |
| 329 |
% 好的易用性和可维护性。 |
| 330 |
% |
| 331 |
% 目前,本模板的主要维护者包括: |
| 332 |
% \begin{itemize} |
| 333 |
% ^^A \item 赵懿晨 |
| 334 |
% \item 熊煜 |
| 335 |
% ^^A \item 马畅 |
| 336 |
% \end{itemize} |
| 337 |
% |
| 338 |
% |
| 339 |
% \subsection{快速上手} |
| 340 |
% |
| 341 |
% \LaTeX 并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听 |
| 342 |
% 到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须 |
| 343 |
% 要面对的情况。目前,中文互联网上的 \LaTeX 写作教程可谓汗牛充栋,然而 |
| 344 |
% 如何快速准确找到所需要的用法,尤其是 \LaTeX3 的新接口,需要一定的时间 |
| 345 |
% 或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您 |
| 346 |
% 的相关知识体系,只能\emph{尽力做到有求必应},在需要的地方顺带提一嘴,以期使您 |
| 347 |
% 少走点弯路。 |
| 348 |
% |
| 349 |
% 如果您希望在使用本模板前了解一些关于这个排版软件的基础知识,在此尝试列举一些有 |
| 350 |
% 所帮助的资料: |
| 351 |
% \begin{description} |
| 352 |
% \item[\textit{lshort}] 著名的介绍文档,已被译为多种语言, |
| 353 |
% 推荐通读其中文版\cite{lshort-zh-cn}。 |
| 354 |
% \item[《\LaTeX 入门》] 刘海洋著\cite{刘海洋2013latex入门}。 |
| 355 |
% \end{description} |
| 356 |
% |
| 357 |
% |
| 358 |
% \subsection{关于本说明手册} |
| 359 |
% |
| 360 |
% 本模板通过 \textsc{DocStrip} 进行维护,实际上是一种\emph{文学编程}。文学编程的 |
| 361 |
% 本体是那些用来说明的文字,按写书写文章的方式组织。\file{njuthesis.dtx} 包含 |
| 362 |
% \cls{njuthesis} 文档类的所有信息。前半部分为模板说明,即各种常用命令与必要的使 |
| 363 |
% 用方法;后半部分为代码实现,为带有详细注释的 \TeX{} 源代码。后者配合附 |
| 364 |
% 录,为有意了解本模板实现细节的同学提供必要指引。 |
| 365 |
% |
| 366 |
% 下文中将出现若干特殊格式,用来指示代码组件。譬如,无衬线字体的 |
| 367 |
% \pkg{pkg-example} 为宏包名,等宽字体的 \file{file-example.xxx} 为文件名,等宽 |
| 368 |
% 字体的 \opt{opt-example} 为选项名,等宽字体的 \env{env-example} 为需要 |
| 369 |
% |\begin{}|和|\end{}|的环境名,等。本手册提供的代码示例中,左侧边线呈现南大标 |
| 370 |
% 准洋红色 {\color{njumagenta}$\blacksquare$} 的属于终端命令,呈南大标准蓝色 |
| 371 |
% {\color{njublue}$\blacksquare$} 的属于 \LaTeX 源代码。 |
| 372 |
% |
| 373 |
% |
| 374 |
% \subsection{许可说明} |
| 375 |
% |
| 376 |
% \file{njuthesis.dtx} 文件以及由其直接产生的所有文件被称为 |
| 377 |
% \cls{njuthesis} 文档类,或者在本文中简称为本模板。 |
| 378 |
% |
| 379 |
% \subparagraph{版权信息} |
| 380 |
% 本模板之版权隶属于 © 2021 - 2023 南京大学 Linux 用户组。 |
| 381 |
% |
| 382 |
% \subparagraph{发布和修改} |
| 383 |
% 本模板的发布和(或)修改遵守 LaTeX Project Public License(版本 1.3c 或更高) |
| 384 |
% 的条款。该许可证的最新版本位于 \url{http://www.latex-project.org/lppl.txt}, |
| 385 |
% 1.3c 及更新的版本随附于 2003/12/01 版本以后的所有 \LaTeX 发行版。 |
| 386 |
% |
| 387 |
% \subparagraph{联系作者} |
| 388 |
% 如果您在使用最新版模板时发现了任何问题,抑或有意向参与本模板的维护, |
| 389 |
% 请通过 \href{https://github.com/nju-lug/NJUThesis/issues}{GitHub Issue} |
| 390 |
% 或者 QQ 群聊\footnote{群号是 991559926。}联系 NJU LUG。 |
| 391 |
% |
| 392 |
% |
| 393 |
% \section{安装} |
| 394 |
% \label{sec:setup} |
| 395 |
% 本节主要介绍本宏包的获取、安装以及编译方式。 |
| 396 |
% |
| 397 |
% \subsection{获取模板} |
| 398 |
% |
| 399 |
% \cls{njuthesis} 目前处于积极的维护中,主要可通过以下三种途径获取模板文件: |
| 400 |
% |
| 401 |
% \subparagraph{CTAN} |
| 402 |
% \href{https://ctan.org/}{CTAN}\footnote{The Comprehensive \TeX{} |
| 403 |
% Archive Network} 是所有 \TeX{} 相关材料的中枢。 |
| 404 |
% 本模板的 CTAN 页面 |
| 405 |
% \footnote{\href{https://ctan.org/pkg/njuthesis}{\cls{njuthesis}} 已经于2021年9 |
| 406 |
% 月12日发布在 CTAN,用于绘制南大图标的 |
| 407 |
% \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发 |
| 408 |
% 布,两者已被 \TeX{} Live 和 \MiKTeX 收录。}上提供基本的介绍信息,可以下载 |
| 409 |
% 说明文档(本文档)和宏包源代码。当然,使用这一来源时并不需要接触后者,请参考 |
| 410 |
% \ref{subsubsec:standard-installation} 的标准安装方法。 |
| 411 |
% |
| 412 |
% \subparagraph{GitHub 仓库} |
| 413 |
% 最新开发进度会提交在本项目的 |
| 414 |
% \href{https://github.com/nju-lug/NJUThesis}{Github仓库}。仓库内仅包含源代码、 |
| 415 |
% 空白模板及测试文件,不可直接用于写作。这些文件对应的使用方法请参考 |
| 416 |
% \ref{subsubsec:on-the-fly-installation}。如果由于网络原因不便访问主仓库,也可 |
| 417 |
% 以从 \href{https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis} |
| 418 |
% {NJU Git 同步镜像}获取项目工程文件。 |
| 419 |
% |
| 420 |
% \subparagraph{GitHub Releases} |
| 421 |
% 本模板不定期将已有的新功能和问题修复打包为新的正式发行版,赋以更改后的版本号, |
| 422 |
% 发布在 \href{https://github.com/nju-lug/NJUThesis/releases/latest}{Github |
| 423 |
% Releases 页面}。如果由于网络原因不便访问主仓库,也可以从\ignorespaces |
| 424 |
% \href{https://mirror.nju.edu.cn/github-release/nju-lug/NJUThesis/LatestRelease/} |
| 425 |
% {南京大学镜像站下载页面}获取。可供下载的文件包括下列三种: |
| 426 |
% \begin{description} |
| 427 |
% \item[\file{njuthesis-v*.pdf}] 模板说明文档(本文档)。 |
| 428 |
% \item[\file{njuthesis-user-v*.zip}] 交付给用户的完整模板包, |
| 429 |
% 包括格式文件和范本文档,可在解压后用于本地编译, |
| 430 |
% 也可直接上传至在线编译网站。 |
| 431 |
% \item[\file{njuthesis-ctan-v*.zip}] 交付给 CTAN 的源代码包, |
| 432 |
% 普通用户请忽略。 |
| 433 |
% \end{description} |
| 434 |
% |
| 435 |
% |
| 436 |
% \subsubsection{文件构成} |
| 437 |
% |
| 438 |
% 本模板由数量众多的文件组成,\emph{所有可能遇到的}文件如表 |
| 439 |
% \ref{tab:njuthesis-files} 所示。 |
| 440 |
% |
| 441 |
% \begin{table}[ht] |
| 442 |
% \centering |
| 443 |
% \begin{talltblr}[ |
| 444 |
% caption = {\cls{njuthesis}文件构成}, |
| 445 |
% label = {tab:njuthesis-files}, |
| 446 |
% note{a} = {仅供开发使用,并不会在发布版本中出现。} |
| 447 |
% ] { row{1} = {font=\bfseries}, colspec = {ll} } |
| 448 |
% \toprule |
| 449 |
% 名称 & 说明 \\ |
| 450 |
% \midrule |
| 451 |
% \file{.vscode} & Visual Studio Code 配置文件 \\ |
| 452 |
% \file{CHANGELOG.md} & 修订记录 \\ |
| 453 |
% \file{latexmkrc} & \pkg{latexmk} 配置文件 \\ |
| 454 |
% \file{LICENSE} & 许可证 \\ |
| 455 |
% \file{njuthesis.cls} & 模板文档类 \\ |
| 456 |
% \file{njuthesis.dtx}\TblrNote{a} & 文档类源代码 \\ |
| 457 |
% \file{njuthesis.ins}\TblrNote{a} & 文档类安装脚本 \\ |
| 458 |
% \file{njuthesis.pdf} & 用户手册(本文档) \\ |
| 459 |
% \file{njuthesis-doc.cls} & 用户手册样式 \\ |
| 460 |
% \file{njuthesis-sample.bib} & 示例参考文献列表 \\ |
| 461 |
% \file{njuthesis-sample.tex} & 示例文档,不妨以此为基础撰写论文 \\ |
| 462 |
% \file{njuthesis-graduate.def} & 研究生参数配置文件 \\ |
| 463 |
% \file{njuthesis-postdoctoral.def} & 博士后参数配置文件 \\ |
| 464 |
% \file{njuthesis-undergraduate.def} & 本科生参数配置文件 \\ |
| 465 |
% \file{README.md} & 自述文件 \\ |
| 466 |
% \bottomrule |
| 467 |
% \end{talltblr} |
| 468 |
% \end{table} |
| 469 |
% |
| 470 |
% |
| 471 |
% \subsection{本地安装} |
| 472 |
% |
| 473 |
% \subsubsection{标准安装} |
| 474 |
% \label{subsubsec:standard-installation} |
| 475 |
% |
| 476 |
% 我们\emph{始终建议}使用宏包管理器将 \cls{njuthesis} 安装到您的 \TeX 系 |
| 477 |
% 统。您可以通过 \TL~Manager 或者 \MiKTeX~Console 等图形化包管理器直接搜 |
| 478 |
% 索并安装 \cls{njuthesis} (及其依赖的 \pkg{njuvisual})最新的 |
| 479 |
% 稳定版。同时,您也可以使用终端命令。例如,假设您使用的是 \TL, |
| 480 |
% 键入下述 \pkg{tlmgr} 的命令(很可能需要管理员权限): |
| 481 |
% \begin{shellexample}[morekeywords={tlmgr},emph={install}] |
| 482 |
% tlmgr install njuthesis njuvisual |
| 483 |
% \end{shellexample} |
| 484 |
% 即可完成安装,无需额外准备 \file{.cls} 文件。 |
| 485 |
% |
| 486 |
% 另一方面,CTAN 依赖开发者手动上传更新,版本更新具有滞后性。如果使用时遇到了问 |
| 487 |
% 题,不妨使用下一小节的\emph{即时安装方法}优先载入较新的格式文件。 |
| 488 |
% |
| 489 |
% {\color{red}|[!]|} 如果您具备相关经验\footnote{譬如熟悉命令行操作、使用的是 \TL |
| 490 |
% 发行版等。},可以在下载仓库内全部文件后,于该目录下运行 |
| 491 |
% \begin{shellexample}[morekeywords={l3build},emph={install}] |
| 492 |
% l3build install |
| 493 |
% \end{shellexample} |
| 494 |
% 来安装本模板的最新版。 |
| 495 |
% |
| 496 |
% |
| 497 |
% \subsubsection{即时安装} |
| 498 |
% \label{subsubsec:on-the-fly-installation} |
| 499 |
% |
| 500 |
% 在某些情况下(例如需要上传至在线编译平台、新版本提供了急需的错误修复),您可能 |
| 501 |
% 需要独立的 \file{.cls} 格式文件。此时请前往前述的 Releases 页面下载 |
| 502 |
% \emph{完整模板包}。 |
| 503 |
% |
| 504 |
% 对于希望使用主仓库中版本的用户,本模板也提供了扁平化安装脚本,用于释放供编译的 |
| 505 |
% 空白模板和格式文件。Windows 用户请直接双击打开 \file{install-win.bat};其他平 |
| 506 |
% 台(包括 macOS 和 Linux)用户请在此目录下运行 |
| 507 |
% \begin{shellexample}[morekeywords={bash}] |
| 508 |
% bash install-unix.sh |
| 509 |
% \end{shellexample} |
| 510 |
% 该脚本会生成一个 \file{mythesis/} 目录以便从头写作,仓库内除此文件夹以外的内容 |
| 511 |
% 都可以尽情删除。 |
| 512 |
% |
| 513 |
% {\color{red}|[!]|} 请注意,如果仅仅是希望使用这个模板撰写论文,请无论如何都不 |
| 514 |
% 要从手动编译 \file{source} 文件夹下的源代码开始,这样做只会浪费生命中宝贵的数 |
| 515 |
% 分钟时间。如果遇到了问题,请前往 GitHub 仓库提出 issue。我们只推荐希望参与开发 |
| 516 |
% 的同学接触 \file{.dtx} 文件。 |
| 517 |
% |
| 518 |
% |
| 519 |
% \subsection{本地编译} |
| 520 |
% \label{subsec:localcompile} |
| 521 |
% |
| 522 |
% 本地编译的安装过程分为两个阶段:安装 \TeX 发行版以及配置 |
| 523 |
% 编辑器。前者提供了可以被命令行终端调用的编译程序, |
| 524 |
% 后者则提供了语法高亮、自动编译等人性化功能。 |
| 525 |
% |
| 526 |
% \subsubsection{安装 \TeX{} 发行版} |
| 527 |
% |
| 528 |
% 首先需要下载并安装 \TeX{} 软件发行版,其中包括引擎、宏包、字体、文档等。 |
| 529 |
% 各操作系统适用情况请参考表~\ref {tab:texdistribution}。第一次 |
| 530 |
% 编译前请务必通过 \MiKTeX~Console、\TL~Manager 等图形化程序或 |
| 531 |
% \pkg{tlmgr} \emph{手动更新全部宏包}以避免潜在的兼容性问题。 |
| 532 |
% \begin{table}[ht] |
| 533 |
% \centering |
| 534 |
% \caption{\TeX 软件发行版一览} |
| 535 |
% \label{tab:texdistribution} |
| 536 |
% \begin{tabular}{cccc} |
| 537 |
% \toprule |
| 538 |
% \TeX & Windows & macOS & Linux \\ |
| 539 |
% \midrule |
| 540 |
% \TL & $\bullet$ & & $\bullet$ \\ |
| 541 |
% \MacTeX & & $\bullet$ & \\ |
| 542 |
% \MiKTeX & $\bullet$ & $\bullet$ & $\bullet$ \\ |
| 543 |
% \bottomrule |
| 544 |
% \end{tabular} |
| 545 |
% \end{table} |
| 546 |
% |
| 547 |
% 以下是一些值得注意的要点: |
| 548 |
% \begin{itemize} |
| 549 |
% \item 可以参照这份\emph{手把手的教程}\cite{install-latex-guide-zh-cn}。 |
| 550 |
% \item 校园网环境中访问\ignorespaces |
| 551 |
% \href{https://mirror.nju.edu.cn/download/TeX%20排版系统} |
| 552 |
% {南京大学开源软件镜像站}可以获得最佳的下载体验。 |
| 553 |
% \item 使用最新的发行版,即版本号为2022或者22。 |
| 554 |
% \item 对于 Windows 和 macOS 用户,更推荐轻量化的 \MiKTeX 套件。 |
| 555 |
% ^^A \item Linux 用户请尽可能下载 full 版本,如 |texlive-full|。 |
| 556 |
% ^^A 换言之,下载最大的软件包。 |
| 557 |
% \item 对于一部分用到新版本特性的宏包,\cls{njuthesis} 内置了版本检查 |
| 558 |
% \footnote{譬如遇到 l3 过时问题请运行 |tlmgr update l3packages|。} |
| 559 |
% ,请确认各宏包已升级至最新版。 |
| 560 |
% \end{itemize} |
| 561 |
% |
| 562 |
% |
| 563 |
% \subsubsection{配置编辑器} |
| 564 |
% \changes{v0.11}{2021/11/23}{提供 TeXstudio 配置文件。} |
| 565 |
% |
| 566 |
% 配置完编译器后,还需要一个\emph{文本编辑器}来完成 \file{.tex} 文件内容的写作。 |
| 567 |
% |
| 568 |
% 关于具体使用哪一种,至今仍有相当一部分人认为Windows自带的\emph{记事本}是 |
| 569 |
% 最好的文本编辑器。但对于本项目而言,在此诚心诚意地推荐您使用\emph{更现代 |
| 570 |
% 更美观更多功能}的编辑器,譬如\emph{安装了 \LaTeX Workshop 插件的 |
| 571 |
% \href{https://code.visualstudio.com/}{Visual Studio Code}}。您也可以根据 |
| 572 |
% 个人的喜好随意使用 TeXworks、TeXstudio 等编辑器,顺手就行。 |
| 573 |
% |
| 574 |
% \cls{njuthesis} 为一些常见编辑器提供了配置文件,如 |
| 575 |
% \begin{description} |
| 576 |
% \item[Visual Studio Code] 本模板在 \file{.vscode/} 中提供一份 |
| 577 |
% \LaTeX Workshop 插件的简易配置,在打开文件夹后将自动导入, |
| 578 |
% 可以省略初始配置步骤直接使用。 |
| 579 |
% \item[TeXstudio] 本模板提供 \file{conf.txsprofile},可以使用快捷键 |
| 580 |
% |alt+O+P| 导入配置文件。为了简化流程\footnote{当然,也可以设置 |
| 581 |
% 为使用 \XeLaTeX 编译,然后按照 \ref{subsubsec:compileseq} |
| 582 |
% 内容使用快捷键 |F8| 手动编译参考文献。},该配置文件使用 |
| 583 |
% \pkg{latexmk},第一次编译前请参考下一节内容安装 Perl。 |
| 584 |
% \end{description} |
| 585 |
% |
| 586 |
% |
| 587 |
% \subsubsection{编译顺序} |
| 588 |
% \label{subsubsec:compileseq} |
| 589 |
% \TeX 本身是命令行程序,通过不同的命令调用所需的编译引擎, |
| 590 |
% 编辑器提供的快捷按钮实际只是做了包装。为了便于排查运行错误, |
| 591 |
% 以下通过具体终端命令简要描述编译过程。 |
| 592 |
% |
| 593 |
% 编译本模板的过程可以概括为下述步骤: |
| 594 |
% \begin{enumerate} |
| 595 |
% \item 生成初始文档 |
| 596 |
% \item 生成参考文献信息 |
| 597 |
% \item 生成页码、编号、目录 |
| 598 |
% \item 将参考文献列表页插入目录 |
| 599 |
% \end{enumerate} |
| 600 |
% 总计需要编译四次。\emph{假设即将使用的主文件名为 |
| 601 |
% \file{njuthesis-sample.tex}},应采用以下命令顺序进行编译, |
| 602 |
% 以生成内容正确的 \file{njuthesis-sample.pdf}。输出的 PDF |
| 603 |
% 文档位于同一目录下。该目录下同时会生成若干中间文件。 |
| 604 |
% |
| 605 |
% 编译命令具体为引擎名称加主文件名,在编译 \file{.tex} 文件时, |
| 606 |
% 文件扩展名可以省略不写。现阶段 \cls{njuthesis} 仅支持 \XeTeX |
| 607 |
% 与 \LuaTeX 引擎,以及 \biber 文献工具。请注意,几种命令的输出文件 |
| 608 |
% 基本相同,可以任取一种;但如果您不清楚这两种编译引擎的区别, |
| 609 |
% 或者对多步编译感到困惑,我们建议优先使用 |latexmk -xelatex|。 |
| 610 |
% |
| 611 |
% |
| 612 |
% \subparagraph{使用 \XeLaTeX} |
| 613 |
% 标准的 \XeTeX 引擎四步编译方法。 |
| 614 |
% |
| 615 |
% \begin{shellexample}[morekeywords={xelatex,biber}] |
| 616 |
% xelatex njuthesis-sample |
| 617 |
% biber njuthesis-sample |
| 618 |
% xelatex njuthesis-sample |
| 619 |
% xelatex njuthesis-sample |
| 620 |
% \end{shellexample} |
| 621 |
% |
| 622 |
% |
| 623 |
% \subparagraph{使用 \LuaLaTeX} |
| 624 |
% 标准的 \LuaTeX 引擎四步编译方法。 |
| 625 |
% |
| 626 |
% \begin{shellexample}[morekeywords={lualatex,biber}] |
| 627 |
% lualatex njuthesis-sample |
| 628 |
% biber njuthesis-sample |
| 629 |
% lualatex njuthesis-sample |
| 630 |
% lualatex njuthesis-sample |
| 631 |
% \end{shellexample} |
| 632 |
% |
| 633 |
% |
| 634 |
% \subparagraph{使用 \pkg{latexmk}} |
| 635 |
% \pkg{latexmk}\cite{latexmk} 是一个基于 Perl 脚本的自动编译工具, |
| 636 |
% 宗旨是通过单一命令简化上述的多次编译流程。 |
| 637 |
% 在使用该命令前,请确保安装了以下软件: |
| 638 |
% \begin{description} |
| 639 |
% \item[Perl] 一般预装于 macOS 和 Linux,而 Windows 用户需要单独安装 |
| 640 |
% \href{https://strawberryperl.com/}{Strawberry Perl}。 |
| 641 |
% \item[\normalfont\pkg{latexmk}] 如果终端找不到 |latexmk| 命令,需使用包管理器单独安装。 |
| 642 |
% \end{description} |
| 643 |
% |
| 644 |
% 该命令的使用方法为 |
| 645 |
% \begin{shellexample}[morekeywords={latexmk}] |
| 646 |
% latexmk njuthesis-sample |
| 647 |
% \end{shellexample} |
| 648 |
% 直接运行会调用 \pdfLaTeX 引擎导致报错。 |
| 649 |
% 如需指定编译引擎,可以加入 |-xelatex| 或 |-lualatex| 参数。 |
| 650 |
% 例如,指定 \XeLaTeX 的命令为 |
| 651 |
% \begin{shellexample}[morekeywords={latexmk},emph={-xelatex}] |
| 652 |
% latexmk -xelatex njuthesis-sample |
| 653 |
% \end{shellexample} |
| 654 |
% |
| 655 |
% 此外,可以选择使用以下命令清理编译生成的临时文件。 |
| 656 |
% \begin{shellexample}[morekeywords={latexmk},emph={-c}] |
| 657 |
% latexmk -c |
| 658 |
% \end{shellexample} |
| 659 |
% |
| 660 |
% |
| 661 |
% \subsection{在线编译} |
| 662 |
% \label{subsec:onlinecompile} |
| 663 |
% |
| 664 |
% 相信您在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如 \TeX 编译器 |
| 665 |
% 安装过程较为漫长\footnote{因此对于 Windows 推荐 \MiKTeX。},占用空间过大 |
| 666 |
% \footnote{事实上,可以通过 |scheme-infraonly| 模式安装 \TL,随后利用 \pkg{tlmgr} |
| 667 |
% 安装依赖宏包,这份宏包列表可以在 Git 仓库的 \file{.github/workflows/build.yml} |
| 668 |
% 找到。},而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{出于文件 IO |
| 669 |
% 速度的差异,同一个模板在 Linux 编译可以相对 Windows 节省约一半耗时。}。 |
| 670 |
% 拒绝接受这些麻烦的同学可以尝试本节介绍的在线编译方法。 |
| 671 |
% |
| 672 |
% {\color{red}|[!]|} 使用在线编辑器时请谨慎备份您的心血结晶。 |
| 673 |
% |
| 674 |
% \subsubsection{南大 \TeX 平台简介} |
| 675 |
% \changes{v0.2}{2021/09/07}{添加对南大 \TeX 的支持。} |
| 676 |
% |
| 677 |
% 当前的\href{https://tex.nju.edu.cn}{南大 \TeX} 基于 |
| 678 |
% \href{https://www.texpage.com}{TeXPage} 提供的服务, |
| 679 |
% 是 \href{https://sci.nju.edu.cn/}{eScience 中心}为南大在校师生提供的 |
| 680 |
% 免费 \LaTeX 在线编辑器,首次使用时需凭统一身份认证激活账号。 |
| 681 |
% |
| 682 |
% |
| 683 |
% \subsubsection{操作步骤} |
| 684 |
% |
| 685 |
% 本说明手册开头的 \ref{subsec:first-things-first} 即呈现了网站内嵌的 |
| 686 |
% \cls{njuthesis} 模板的使用方法。 |
| 687 |
% 如果网站更新不及时,也可以按如下步骤手动上传包含模板的压缩包。 |
| 688 |
% |
| 689 |
% \begin{enumerate} |
| 690 |
% \item 登录\href{https://tex.nju.edu.cn}{南大 \TeX 网站} |
| 691 |
% \item 上传~\ref{subsubsec:on-the-fly-installation}~节得到的压缩文件。 |
| 692 |
% \item 在项目页面左上角的\tpbutton{设置}中,确认编译器为 |XeLaTeX| 或者 |LuaLaTeX| |
| 693 |
% \item 仿照 \file{njuthesis-sample.tex} 编写论文 |
| 694 |
% \item 点击右上角\tpbutton{编译}按钮进行编译和预览 |
| 695 |
% \end{enumerate} |
| 696 |
% |
| 697 |
% |
| 698 |
% \subsection{版本升级} |
| 699 |
% |
| 700 |
% 本模板仍在开发中,将不断发布新版本,您可能需要不定期进行更新以得到 |
| 701 |
% 对于已知问题的修复补丁。每个版本的更新内容记录于 Git 仓库中的 |
| 702 |
% \file{CHANGELOG.md}。除非特别提到选项变化,升级时一般无需更改 \file{.tex} |
| 703 |
% 文件内容\footnote{在确实发生了接口变动,例如选项名称发生了更改, |
| 704 |
% 一种稳妥做法是将论文内容迁移至新版的 \file{njuthesis-sample.tex}。}。 |
| 705 |
% 基于安装和编译方式的差异,可以按照当前工作文件夹内是否有 \file{.cls} |
| 706 |
% 文件分别进行更新操作。 |
| 707 |
% |
| 708 |
% \subparagraph{有} |
| 709 |
% 下载 \file{njuthesis-user-v*.zip},使用其中新版的 \file{.cls}、\file{.def} |
| 710 |
% 文件覆盖旧版本。 |
| 711 |
% |
| 712 |
% \subparagraph{没有} |
| 713 |
% 如果使用的是南大 \TeX,更新内置模板时会进行公告,一般为上传 CTAN |
| 714 |
% 后一周内。如果是本地安装,请直接使用包管理器进行更新: |
| 715 |
% \begin{shellexample}[morekeywords={tlmgr},emph={update}] |
| 716 |
% tlmgr update --all |
| 717 |
% \end{shellexample} |
| 718 |
% |
| 719 |
% |
| 720 |
% \section{使用方法} |
| 721 |
% |
| 722 |
% \subsection{标准结构} |
| 723 |
% |
| 724 |
% 典型的 \cls{njuthesis} 主文件结构应该如下所示: |
| 725 |
% |
| 726 |
% \begin{latexexample}[moretexcs={\njusetup,\tableofcontents, |
| 727 |
% \maketitle,\mainmatter,\chapter,\printbibliography},emph={[1]document}] |
| 728 |
% \documentclass{njuthesis} |
| 729 |
% \njusetup{} |
| 730 |
% \begin{document} |
| 731 |
% \maketitle |
| 732 |
% \tableofcontents |
| 733 |
% \mainmatter |
| 734 |
% \chapter{欢迎} |
| 735 |
% 使用 \LaTeX{}! |
| 736 |
% \printbibliography |
| 737 |
% \end{document} |
| 738 |
% \end{latexexample} |
| 739 |
% |
| 740 |
% 如果您尝试编译上面的代码,会发现自己得到了一个5页的 PDF 文档, |
| 741 |
% 是一份空白的本科生论文。当然,这个文档实际上没有任何内容, |
| 742 |
% 接下来的部分会介绍具体填写内容的方法。 |
| 743 |
% |
| 744 |
% |
| 745 |
% \subsection{模板选项} |
| 746 |
% |
| 747 |
% 模板选项位于 \tn{documentclass} 后的方括号内,用于指定模板的行为。 |
| 748 |
% 下文中尖括号内列出了若干个允许的选项,其中加粗的为默认选项(缺省值)。 |
| 749 |
% |
| 750 |
% \subsubsection{学位信息} |
| 751 |
% \begin{function}[added=2021-09-07,updated=2022-07-23]{type} |
| 752 |
% \begin{syntax} |
| 753 |
% \OPT{type} = <(bachelor)|master|doctor|postdoc> |
| 754 |
% \end{syntax} |
| 755 |
% 选择毕业论文模板类型,这将决定模板整体的外观。可选值分别为 |
| 756 |
% 学士(本科生)、硕士研究生、博士研究生和博士后,默认为学士。 |
| 757 |
% \end{function} |
| 758 |
% |
| 759 |
% \begin{function}[added=2021-09-07,updated=2022-07-01]{degree} |
| 760 |
% \begin{syntax} |
| 761 |
% \OPT{degree} = <(academic)|professional> |
| 762 |
% \end{syntax} |
| 763 |
% 选择研究生的学位类型。可选值分别学术型和专业型,默认为学术型。 |
| 764 |
% \end{function} |
| 765 |
% |
| 766 |
% |
| 767 |
% \subsubsection{特殊页面} |
| 768 |
% |
| 769 |
% \begin{function}[added=2021-09-07,updated=2022-07-05]{nl-cover} |
| 770 |
% \begin{syntax} |
| 771 |
% \OPT{nl-cover} = <\TFF> |
| 772 |
% \end{syntax} |
| 773 |
% 是否使用国家图书馆封面,默认关闭。 |
| 774 |
% \end{function} |
| 775 |
% |
| 776 |
% 通过此项可用国家图书馆封面\emph{替换}普通封面。 |
| 777 |
% 由于本科生院文件中并未提及相关规定,故本选项仅对于研究生有效。 |
| 778 |
% |
| 779 |
% \begin{function}[updated=2022-01-06]{decl-page} |
| 780 |
% \begin{syntax} |
| 781 |
% \OPT{decl-page} = <\TFF> |
| 782 |
% \end{syntax} |
| 783 |
% 是否需要自动生成声明页面,默认关闭。 |
| 784 |
% \end{function} |
| 785 |
% |
| 786 |
% 通过此项,对于本科生模板可在封面后添加的诚信承诺书,对于研究生模板可在 |
| 787 |
% 封面后添加原创性声明\footnote{其中的打勾符号依赖 \pkg{unicode-math}。}, |
| 788 |
% 并且在最后一页添加学位论文出版授权书。 |
| 789 |
% |
| 790 |
% 对于需要手动插入承诺书扫描页的情况,可以在导言区载入 \pkg{pdfpages} 宏包 |
| 791 |
% \cite{pdfpages},并在所需位置使用该宏包提供的 \tn{includepdf} 命令。 |
| 792 |
% 例如,可以用如下所示的命令插入扫描件的第一页,并插入紧随的一个空白页。 |
| 793 |
% \begin{latexexample}[moretexcs={\includepdf},emph={[2]pages}] |
| 794 |
% \includepdf[pages={1,{}}]{scanned.pdf} |
| 795 |
% % \setcounter{page}{1} % 使扫描页不占用页码 |
| 796 |
% \end{latexexample} |
| 797 |
% |
| 798 |
% |
| 799 |
% \subsubsection{页面模式} |
| 800 |
% |
| 801 |
% \begin{function}[added=2022-01-14]{oneside,twoside} |
| 802 |
% \begin{syntax} |
| 803 |
% <\OPT{oneside}|(\OPT{twoside})> |
| 804 |
% \end{syntax} |
| 805 |
% 开启单面或双面模式,默认为双面模式。 |
| 806 |
% \end{function} |
| 807 |
% |
| 808 |
% 本选项继承自 \LaTeXe \cls{book} 标准文档类。 |
| 809 |
% 单双面选项为全局选项,开启后会改变页码编号,以及部分宏包的行为。 |
| 810 |
% 在单面模式下,页面是连续的,不会产生空白页;在双面模式下, |
| 811 |
% 新的一章以及封面、摘要、参考文献表等特殊页面都会从奇数页开始, |
| 812 |
% 在奇数页结束的内容后会补上一页空页,更适合印刷输出。 |
| 813 |
% |
| 814 |
% \begin{function}[added=2021-12-15,updated=2024-03-19]{draft} |
| 815 |
% \begin{syntax} |
| 816 |
% <\OPT{draft}> |
| 817 |
% \end{syntax} |
| 818 |
% 是否开启草稿模式,默认关闭。 |
| 819 |
% \end{function} |
| 820 |
% |
| 821 |
% 本选项继承自 \LaTeXe \cls{book} 标准文档类。 |
| 822 |
% 草稿模式为全局选项,启用这一选项将产生以下整体影响: |
| 823 |
% \begin{itemize} |
| 824 |
% \item 禁用封面的绘制(包括承诺和声明) |
| 825 |
% \item 显示页面文字范围边框以及页眉页脚线 |
| 826 |
% \item 在超出宽度的内容右侧添加黑色方块标记 |
| 827 |
% \item 不再渲染图片,使用含有图片路径的空白盒子占位 |
| 828 |
% \item 不再渲染超链接及生成 PDF 书签 |
| 829 |
% \end{itemize} |
| 830 |
% 草稿模式有助于提升编译速度以及检查格式问题,建议在定稿前始终开启。 |
| 831 |
% |
| 832 |
% 启用这一选项也会改变特定宏包的行为,譬如在草稿模式下 \pkg{listings} |
| 833 |
% 宏包的代码环境不会显示内容,具体效果需要参照各个宏包的说明文档。 |
| 834 |
% 如需抵消草稿模式的影响,请使用 \opt{final} 选项载入相关宏包。 |
| 835 |
% |
| 836 |
% \begin{function}[added=2022-04-19,updated=2024-04-19]{anonymous} |
| 837 |
% \begin{syntax} |
| 838 |
% <\OPT{anonymous}> |
| 839 |
% \end{syntax} |
| 840 |
% 是否开启盲审模式。 |
| 841 |
% \end{function} |
| 842 |
% |
| 843 |
% 盲审模式会抹除论文中的学校和个人信息,效果包括: |
| 844 |
% \begin{itemize} |
| 845 |
% \item 作者、导师姓名用 $\times\times\times$ 代替 |
| 846 |
% \item 不显示学号,但保留年级 |
| 847 |
% \item 不显示声明页 |
| 848 |
% \item 致谢页仅显示书签 |
| 849 |
% \item 成果列表仅显示刊名和年份 |
| 850 |
% \end{itemize} |
| 851 |
% |
| 852 |
% 如果你想使用更严格的模式,可以参考 \ref{subsec:njusetup}~节的语法填写下面的选项。 |
| 853 |
% |
| 854 |
% \begin{function}[added=2024-04-19]{anonymous-mode/no-nju} |
| 855 |
% \begin{syntax} |
| 856 |
% \OPT{no-nju} = <\TFF> |
| 857 |
% \end{syntax} |
| 858 |
% 是否隐藏学校信息。默认关闭。开启后会隐藏校名、校徽和学校代码。 |
| 859 |
% \end{function} |
| 860 |
% |
| 861 |
% |
| 862 |
% \subsubsection{可选宏包} |
| 863 |
% \label{subsubsec:optional-pkg} |
| 864 |
% |
| 865 |
% \begin{function}[added=2022-08-03]{ |
| 866 |
% biblatex, |
| 867 |
% cleveref, |
| 868 |
% ntheorem, |
| 869 |
% enumitem, |
| 870 |
% footmisc, |
| 871 |
% unicode-math} |
| 872 |
% \begin{syntax} |
| 873 |
% \OPT{biblatex} = <\TTF> |
| 874 |
% \OPT{cleveref} = <\TTF> |
| 875 |
% \OPT{ntheorem} = <\TTF> |
| 876 |
% \OPT{enumitem} = <\TTF> |
| 877 |
% \OPT{footmisc} = <\TTF> |
| 878 |
% \OPT{unicode-math} = <\TTF> |
| 879 |
% \end{syntax} |
| 880 |
% 是否默认载入某些宏包,默认均是。选项名和宏包名是一致的。 |
| 881 |
% \end{function} |
| 882 |
% |
| 883 |
% \begin{function}[added=2022-08-03]{minimal} |
| 884 |
% \begin{syntax} |
| 885 |
% <\OPT{minimal}> |
| 886 |
% \end{syntax} |
| 887 |
% 最小化模式,禁用所有上述宏包。 |
| 888 |
% \end{function} |
| 889 |
% |
| 890 |
% 本模板内置了一系列宏包以进行功能扩展。这些宏包为: |
| 891 |
% \begin{description} |
| 892 |
% \item[\normalfont\pkg{biblatex}] 复杂参考文献数据的处理。 |
| 893 |
% \item[\normalfont\pkg{cleveref}] 按来源类型自动处理引用标签。 |
| 894 |
% \item[\normalfont\pkg{ntheorem}] 定理类环境定制。 |
| 895 |
% \item[\normalfont\pkg{enumitem}] 列表环境样式定制。 |
| 896 |
% \item[\normalfont\pkg{footmisc}] 脚注样式定制。 |
| 897 |
% \item[\normalfont\pkg{unicode-math}] 支持 Unicode 数学字体。 |
| 898 |
% \end{description} |
| 899 |
% |
| 900 |
% 在某些情况下,这些宏包会与旧有的经验方法冲突,可以使用上述选项在模板 |
| 901 |
% 中禁用这些宏包,从而手动配置相关功能。 |
| 902 |
% |
| 903 |
% \subsubsection{配置文件} |
| 904 |
% |
| 905 |
% \begin{function}[added=2022-02-23]{config} |
| 906 |
% \begin{syntax} |
| 907 |
% \OPT{config} = \Arg{文件} |
| 908 |
% \end{syntax} |
| 909 |
% 配置文件路径。 |
| 910 |
% \end{function} |
| 911 |
% |
| 912 |
% 本选项可用于载入额外的用户配置文件。该文件支持 \LaTeX3 语法。 |
| 913 |
% |
| 914 |
% |
| 915 |
% \subsubsection{指定字体} |
| 916 |
% |
| 917 |
% 学校论文格式要求使用的字体一般已经预装在各个操作系统, |
| 918 |
% 本模板针对不同平台进行了自动检测适配,可以开箱即用。 |
| 919 |
% 如果希望更改本模板使用的字体,请填写以下选项以覆盖默认设置。 |
| 920 |
% |
| 921 |
% \begin{function}[added=2023-12-15]{fontset} |
| 922 |
% \begin{syntax} |
| 923 |
% \OPT{fontset} = <win|macoffice|mac|fandol|none> |
| 924 |
% \end{syntax} |
| 925 |
% 手动指定字体库。 |
| 926 |
% \end{function} |
| 927 |
% |
| 928 |
% \opt{fontset} 这个选项名继承自 \pkg{ctex},相当于在本模板中分别填写以下两项。 |
| 929 |
% |
| 930 |
% \begin{function}[added=2021-09-07,updated=2021-12-18]{cjk-font,latin-font} |
| 931 |
% \begin{syntax} |
| 932 |
% \OPT{cjk-font} = <win|mac|fandol|founder|noto|source|none> |
| 933 |
% \OPT{latin-font} = <win|mac|gyre|none> |
| 934 |
% \end{syntax} |
| 935 |
% 更精细的字体库设定。 |
| 936 |
% \end{function} |
| 937 |
% |
| 938 |
% 根据学校论文格式的要求,本模板使用的中文字体主要有{\songti 宋体}、 |
| 939 |
% {\heiti 黑体}、{\kaishu 楷体}、{\fangsong 仿宋}四种; |
| 940 |
% 西文字体主要有衬线体(\textup{serif})、无衬线体(\textsf{sans-serif}) |
| 941 |
% 和等宽字体(\texttt{monospace})三种。 |
| 942 |
% 在生成论文时,需要将每一种字体(宋体、楷体)与一种字库(操作系统中的 |
| 943 |
% \file{.ttf} 文件)相对应。由于不同操作系统自带的字库不同, |
| 944 |
% 在不同的操作系统上使用同一套配置会导致缺字、编译出错等后果。 |
| 945 |
% 因此,本模板对于中文字体和西文字体都提供了多种字体配置。 |
| 946 |
% |
| 947 |
% 若要手动选择字体,则需将字体设置为 \opt{none},再通过 \pkg{fontspec} |
| 948 |
% 宏包或 \pkg{ctex} 宏包中给出的命令来实现。 |
| 949 |
% |
| 950 |
% \begin{function}[added=2022-07-02]{font-path} |
| 951 |
% \begin{syntax} |
| 952 |
% font-path = \Arg{文件夹} |
| 953 |
% \end{syntax} |
| 954 |
% 字体文件目录。 |
| 955 |
% \end{function} |
| 956 |
% |
| 957 |
% 模板用到的部分字体可能尚未安装在操作系统,可以使用此选项手动指定搜索路径。 |
| 958 |
% 例如,研究生模板封面上使用到了华文中宋,该字体默认只存在于 |
| 959 |
% \opt{win} 和 \opt{macoffice} 对应的系统配置, |
| 960 |
% 在其他平台编译需使用此选项手动指向 \file{STZHONGS.TTF}。 |
| 961 |
% |
| 962 |
% \paragraph{中文} |
| 963 |
% |
| 964 |
% 本模板提供的中文字体配置如表 \ref{tab:cjk-fontset} 所示。 |
| 965 |
% 在不指定字体配置的情况下,本模板默认使用与操作系统相对应的字体配置 |
| 966 |
% (见表中前四行,在装有 MS Office 的 macOS 上优先使用 Office 字体库。 |
| 967 |
% Windows 和 macOS 以外的系统采用 |
| 968 |
% \href{https://www.ctan.org/pkg/fandol}{Fandol} 配置)。 |
| 969 |
% 此外,我们也单独提供了\href{https://www.foundertype.com} |
| 970 |
% {方正}和\href{https://github.com/adobe-fonts}{思源}两套中文字体配置。 |
| 971 |
% |
| 972 |
% \begin{table}[!htbp] |
| 973 |
% \def\FD{http://www.foundertype.com/index.php/FontInfo/index/id/1} |
| 974 |
% \def\MN{https://mirrors.nju.edu.cn/adobe-fonts/source-han-} |
| 975 |
% \def\OT{/OTF/SimplifiedChinese/} |
| 976 |
% \def\FZ#1#2{\href{\FD #1}{方正 #2}} |
| 977 |
% \def\SC#1#2{\href{\MN #1\OT}{思源 #2 体}} |
| 978 |
% \centering |
| 979 |
% \begin{talltblr}[ |
| 980 |
% caption = {中文字体配置}, |
| 981 |
% label = {tab:cjk-fontset}, |
| 982 |
% note{a} = {请下载简繁扩展(即 GBK 编码)版本}, |
| 983 |
% note{b} = {使用\href{\FD164}{方正小标宋}作为方正书宋的粗体}, |
| 984 |
% note{c} = {使用\href{\FD131}{方正黑体}作为方正细黑一的粗体}, |
| 985 |
% note{d} = {在部分操作系统中可能已经预装 Google Noto 字体。 |
| 986 |
% 考虑到获取字体的难易程度,单独安装时建议采用 Adobe Source Han 字体 |
| 987 |
% 表示思源字体,请下载 Simplified Chinese(即后缀名为 SC)的版本}, |
| 988 |
% note{e} = {思源字体并不包含楷书和仿宋,而 Adobe |
| 989 |
% 楷体和仿宋难以直接下载,因此使用方正字体代替} ] |
| 990 |
% { cell{2}{2-5} = {white!70!njuyellow}, |
| 991 |
% cell{3}{2-5} = {white!70!njuyellow}, |
| 992 |
% cell{5-8}{4} = {white!70!njuyellow}, |
| 993 |
% colspec = {ccccc} } |
| 994 |
% \toprule |
| 995 |
% 配置名称 & 宋体 & 黑体 & 楷书 & 仿宋 \\ |
| 996 |
% \midrule |
| 997 |
% \opt{win} & 中易宋体 & 中易黑体 & 中易楷体 & 中易仿宋 \\ |
| 998 |
% \opt{macoffice} & 中易宋体 & 中易黑体 & 中易楷体 & 中易仿宋 \\ |
| 999 |
% \opt{mac} & 华文宋体 & 华文黑体 & 华文楷体 & 华文仿宋 \\ |
| 1000 |
% \opt{fandol} & Fandol 宋体 & Fandol 黑体 & Fandol 楷体 & Fandol 仿宋 \\ |
| 1001 |
% \opt{founder}\TA & \FZ{51}{书宋}\TB & \FZ{61}{细黑一}\TC & \FZ{37}{楷体} & \FZ{28}{仿宋} \\ |
| 1002 |
% \opt{noto} \TD & 思源宋体 & 思源黑体 & 方正楷体\TE & 方正仿宋\TE \\ |
| 1003 |
% \opt{source} \TD & \SC{serif}{宋} & \SC{sans}{黑} & 方正楷体\TE & 方正仿宋\TE \\ |
| 1004 |
% \bottomrule |
| 1005 |
% \end{talltblr} |
| 1006 |
% \end{table} |
| 1007 |
% |
| 1008 |
% 由于各操作系统对自带字体的支持程度不同,本模板对不同字体加粗的方式 |
| 1009 |
% 有所差别,表 \ref{tab:cjk-fontset} 中,黄色底色的字体采用算法加粗。 |
| 1010 |
% 除此以外,各种字体在设计上也存在差异,因此本模板在不同操作系统下编 |
| 1011 |
% 译的结果可能存在细微不同,使用时请注意。若想要获得与 Word 版本模板 |
| 1012 |
% 最为贴近的体验,可以通过手动安装 Windows 自带的中易宋体、中易黑体、 |
| 1013 |
% 中易楷体和中易仿宋,并设置使用 Windows 字体来实现。 |
| 1014 |
% |
| 1015 |
% \paragraph{西文} |
| 1016 |
% |
| 1017 |
% 本模板提供的西文字体配置如表 \ref{tab:latin-fontset} 所示。 |
| 1018 |
% 在不指定字体配置的情况下,本模板默认使用与操作系统相对应的 |
| 1019 |
% 字体配置。Windows 和 macOS 以外的系统采用 \opt{gyre} 配置。 |
| 1020 |
% |
| 1021 |
% \begin{table}[!htbp] |
| 1022 |
% \def\TG#1{TG~#1~\TA} |
| 1023 |
% \centering |
| 1024 |
% \begin{talltblr} [ |
| 1025 |
% caption = {西文字体配置}, |
| 1026 |
% label = {tab:latin-fontset}, |
| 1027 |
% note{a} = {TG 表示 \href{http://www.gust.org.pl/projects/e-foundry/tex-gyre}{\TeX~Gyre}。} ] |
| 1028 |
% { colspec = {cccc} } |
| 1029 |
% \toprule |
| 1030 |
% 配置名称 & 衬线体 & 无衬线体 & 等宽字体 \\ |
| 1031 |
% \midrule |
| 1032 |
% \opt{win} & Times~New~Roman & Arial & Courier~New \\ |
| 1033 |
% \opt{macoffice} & Times~New~Roman & Arial & Menlo \\ |
| 1034 |
% \opt{mac} & Times~New~Roman & Arial & Menlo \\ |
| 1035 |
% \opt{gyre} & \TG{Termes} & \TG{Heros} & \TG{Cursor} \\ |
| 1036 |
% \bottomrule |
| 1037 |
% \end{talltblr} |
| 1038 |
% \end{table} |
| 1039 |
% |
| 1040 |
% macOS 用户需要额外注意的是,系统内置的 Times New Roman 并没有 smcp |
| 1041 |
% 这一特性,所以 \tn{textsc} 命令无法产生正确的小型大写字母字型,导致 |
| 1042 |
% 研究生模板英文封面的部分内容不能正确显示。另外,macOS 中的 Times 字体 |
| 1043 |
% 也不包含 smcp 特性。 |
| 1044 |
% 相应的解决办法是拷贝一份 Windows 预装的 Times New Roman |
| 1045 |
% \footnote{Times New Roman(或 TimesNewRomanPSMT)在 Windows 和 macOS |
| 1046 |
% 下的区别在于版本。根据我们的测试,Windows 10 下该字体的版本为 7.00, |
| 1047 |
% 而 macOS Monterey 下该字体的版本为 5.01.3x。这显然是苹果的问题。}, |
| 1048 |
% 或者使用 \TeX{} Live 内置的 \TeX{} Gyre Termes 字体 |
| 1049 |
% \footnote{\TeX{} Gyre Termes 可以视作 Times New Roman 的重制版,两者的 |
| 1050 |
% 视觉感受是一致的。},这两个字体都具备 smcp 特性。 |
| 1051 |
% 本模板在检测到 Times New Roman 不包含 smcp 特性时,会抛出警告并使用 |
| 1052 |
% \TeX{} Gyre Termes 字体进行替换。 |
| 1053 |
% |
| 1054 |
% \paragraph{数学} |
| 1055 |
% |
| 1056 |
% \begin{function}[added=2022-07-02]{math-font} |
| 1057 |
% \begin{syntax} |
| 1058 |
% \OPT{math-font} = <asana|cambria|fira|garamond|lm|...|termes|(xits)|none> |
| 1059 |
% \end{syntax} |
| 1060 |
% 设置数学字体。完整列表见表 \ref{tab:math-fontset}。 |
| 1061 |
% \end{function} |
| 1062 |
% |
| 1063 |
% 本模板默认采用 \pkg{unicode-math} 宏包配置数学模式下使用的字体。 |
| 1064 |
% 与原生 \LaTeX{} 最接近的字体对应 \opt{lm},MS Word 预装的字体对应 \opt{cambria}。 |
| 1065 |
% |
| 1066 |
% \begin{table}[!htbp] |
| 1067 |
% \def\NCM{New Computer Modern} |
| 1068 |
% \centering |
| 1069 |
% \begin{talltblr} [ |
| 1070 |
% caption = {数学字体配置}, |
| 1071 |
% label = {tab:math-fontset}, |
| 1072 |
% note{a} = {TG 表示 \href{http://www.gust.org.pl/projects/e-foundry/tex-gyre}{\TeX~Gyre}。}, |
| 1073 |
% note{b} = {粗体使用 XITS Math Bold。} ] |
| 1074 |
% { colspec = {ccl} } |
| 1075 |
% \toprule |
| 1076 |
% 配置名称 & 字体名称 & 描述 \\ |
| 1077 |
% \midrule |
| 1078 |
% \opt{asana} & Asana Math & \\ |
| 1079 |
% \opt{cambria} & Cambria Math & 微软 Office 预装的数学字体 \\ |
| 1080 |
% \opt{fira} & Fira Math & 无衬线数学字体,Fira 风格 \\ |
| 1081 |
% \opt{garamond} & Garamond Math & Garamond 风格 \\ |
| 1082 |
% \opt{lm} & Latin Modern Math & Computer Modern 风格 \\ |
| 1083 |
% \opt{libertinus} & Libertinus Math & \\ |
| 1084 |
% \opt{newcm} & \NCM~Math & Computer Modern 风格 \\ |
| 1085 |
% \opt{stix} & STIX Math & Times 风格 \\ |
| 1086 |
% \opt{bonum} & TG Bonum Math \TA & \\ |
| 1087 |
% \opt{dejavu} & TG DejaVu Math \TA & DejaVu 风格 \\ |
| 1088 |
% \opt{pagella} & TG Pagella Math \TA & Palatino 风格 \\ |
| 1089 |
% \opt{schola} & TG Schola Math \TA & \\ |
| 1090 |
% \opt{termes} & TG Termes Math \TA & Times 风格 \\ |
| 1091 |
% \opt{xits} & XITS Math \TB & 基于 STIX,Times 风格 \\ |
| 1092 |
% \bottomrule |
| 1093 |
% \end{talltblr} |
| 1094 |
% \end{table} |
| 1095 |
% |
| 1096 |
% \paragraph{授权} |
| 1097 |
% |
| 1098 |
% 本节提及的字库中,中文字库只有方正书宋、方正黑体、方正楷体、方正仿宋、 |
| 1099 |
% 两种思源字体和四种Fandol字体能够\emph{免费商用}; |
| 1100 |
% 英文字库中只有 Times New Roman、XITS 和三种 \TeX~Gyre字体能够\emph{免费商用}。 |
| 1101 |
% 因此,若需要将本模板用于商业相关的活动,请咨询专业人士。 |
| 1102 |
% |
| 1103 |
% |
| 1104 |
% \subsection{设置接口} |
| 1105 |
% \label{subsec:njusetup} |
| 1106 |
% |
| 1107 |
% \begin{function}[added=2021-09-10,updated=2022-08-01]{\njusetup} |
| 1108 |
% \begin{syntax} |
| 1109 |
% \tn{njusetup}\oarg{键路径}\marg{设置项} |
| 1110 |
% \end{syntax} |
| 1111 |
% \cls{njuthesis} 文档类的通用设置命令,提供自定义接口。 |
| 1112 |
% \end{function} |
| 1113 |
% |
| 1114 |
% 根据可选参数填写方式不同,\tn{njusetup} 共有四种等效的使用方式, |
| 1115 |
% 可以根据实际情况进行灵活选择。 |
| 1116 |
% |
| 1117 |
% 在键路径留空时,为最基础的用法。此时设置项的参数是一个使用 |
| 1118 |
% \emph{英文半角逗号}分隔的键值列表,通常形如 \meta{key}|=|\meta{value}。 |
| 1119 |
% |
| 1120 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info,bib}, |
| 1121 |
% emph={[3]title,author,resource}] |
| 1122 |
% \njusetup{ |
| 1123 |
% info/title = {奇文}, |
| 1124 |
% info/author = {佚名}, |
| 1125 |
% bib/resource = {ref1.bib, ref2.bib} |
| 1126 |
% } |
| 1127 |
% \end{latexexample} |
| 1128 |
% |
| 1129 |
% 以上为最基础的填写方法,可以分组为: |
| 1130 |
% |
| 1131 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info,bib}, |
| 1132 |
% emph={[3]title,author,resource}] |
| 1133 |
% \njusetup{ |
| 1134 |
% info = { |
| 1135 |
% title = {奇文}, |
| 1136 |
% author = {佚名} |
| 1137 |
% }, |
| 1138 |
% bib = { |
| 1139 |
% resource = {ref1.bib, ref2.bib}, |
| 1140 |
% } |
| 1141 |
% } |
| 1142 |
% \end{latexexample} |
| 1143 |
% |
| 1144 |
% 在键路径填入模块(类)时,只能设定当前模块下的选项。此时参数是键值列表。 |
| 1145 |
% |
| 1146 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info,bib}, |
| 1147 |
% emph={[3]title,author,resource}] |
| 1148 |
% \njusetup[info]{ |
| 1149 |
% title = {奇文}, |
| 1150 |
% author = {佚名} |
| 1151 |
% } |
| 1152 |
% \njusetup[bib]{ |
| 1153 |
% resource = {ref1.bib, ref2.bib} |
| 1154 |
% } |
| 1155 |
% \end{latexexample} |
| 1156 |
% |
| 1157 |
% 在键路径填入具体选项名称时,只能设定该选项的值。 |
| 1158 |
% |
| 1159 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info,bib}, |
| 1160 |
% emph={[3]title,author,resource}] |
| 1161 |
% \njusetup[info/title]{奇文} |
| 1162 |
% \njusetup[info/author]{佚名} |
| 1163 |
% \njusetup[bib/resource]{ref1.bib, ref2.bib} |
| 1164 |
% \end{latexexample} |
| 1165 |
% |
| 1166 |
% |
| 1167 |
% \subsection{个人信息} |
| 1168 |
% |
| 1169 |
% |info| 类用于设置个人信息。 |
| 1170 |
% 以下为全部的个人信息参数,其中带有星号的为对应的英文字段。 |
| 1171 |
% |
| 1172 |
% \begin{function}[updated=2022-01-14]{info/title,info/title*} |
| 1173 |
% \begin{syntax} |
| 1174 |
% \OPT{title} = \Arg{标题} |
| 1175 |
% \OPT{title*} = \Arg{英文标题} |
| 1176 |
% \end{syntax} |
| 1177 |
% 题目。由于封面上提供给中文题目的横线长度有限\footnote{单行最长约为15 |
| 1178 |
% 个汉字,建议总长度不超过45字,当然你也可以对照 \ref{subsubsec:modify-length} |
| 1179 |
% 节修改横线长度。},本模板默认会自动对标题进行换行。 |
| 1180 |
% 如果需要手动指定换行位点,请使用换行控制符( |\\| )。 |
| 1181 |
% \end{function} |
| 1182 |
% |
| 1183 |
% 绘制封面及摘要中的标题涉及断行处理,无法对空字符串产生正确结果。 |
| 1184 |
% 因而在手动将标题设置为空时,本模板将抛出如下错误: |
| 1185 |
% \begin{shellexample}[deletekeywords={in}] |
| 1186 |
% ! Package njuthesis Error: The title should not be left blank. |
| 1187 |
% (njuthesis) Please check whether you have fill in both |
| 1188 |
% (njuthesis) Chinese and English titles. |
| 1189 |
% \end{shellexample} |
| 1190 |
% |
| 1191 |
% \begin{function}[updated=2021-10-01]{info/keywords,info/keywords*} |
| 1192 |
% \begin{syntax} |
| 1193 |
% \OPT{keywords} = \Arg{关键词} |
| 1194 |
% \OPT{keywords*} = \Arg{英文关键词} |
| 1195 |
% \end{syntax} |
| 1196 |
% 关键词列表。关键词之间需要使用英文半角逗号隔开, |
| 1197 |
% 含有空格的关键字需要使用花括号包裹以避免歧义。可以参照下方的填写示例。 |
| 1198 |
% \end{function} |
| 1199 |
% |
| 1200 |
% \begin{function}[updated=2021-10-01]{info/grade} |
| 1201 |
% \begin{syntax} |
| 1202 |
% \OPT{grade} = \Arg{20XX} |
| 1203 |
% \end{syntax} |
| 1204 |
% 年级,推荐格式为“20XX”。 |
| 1205 |
% \end{function} |
| 1206 |
% |
| 1207 |
% \begin{function}[updated=2021-10-01]{info/student-id} |
| 1208 |
% \begin{syntax} |
| 1209 |
% \OPT{student-id} = \Arg{学号或工号} |
| 1210 |
% \end{syntax} |
| 1211 |
% 学号或工号。南京大学本科生为9位数字学号, |
| 1212 |
% 研究生为两位大写字母标识加上数字组成的学号(2022级改为纯数字)。 |
| 1213 |
% \end{function} |
| 1214 |
% |
| 1215 |
% \begin{function}[updated=2021-10-01]{info/author,info/author*} |
| 1216 |
% \begin{syntax} |
| 1217 |
% \OPT{author} = \Arg{你的名字} |
| 1218 |
% \OPT{author*} = \Arg{姓名拼音} |
| 1219 |
% \end{syntax} |
| 1220 |
% 姓名。 |
| 1221 |
% \end{function} |
| 1222 |
% |
| 1223 |
% \begin{function}[updated=2021-10-01]{info/department,info/department*} |
| 1224 |
% \begin{syntax} |
| 1225 |
% \OPT{department} = \Arg{院系} |
| 1226 |
% \OPT{department*} = \Arg{院系} |
| 1227 |
% \end{syntax} |
| 1228 |
% 院系。 |
| 1229 |
% \end{function} |
| 1230 |
% |
| 1231 |
% \begin{function}[updated=2023-12-05]{info/major,info/major*} |
| 1232 |
% \begin{syntax} |
| 1233 |
% \OPT{major} = \Arg{专业} |
| 1234 |
% \OPT{major} = \Arg{封面专业, 摘要专业} |
| 1235 |
% \OPT{major*} = \Arg{专业} |
| 1236 |
% \end{syntax} |
| 1237 |
% 专业。研究生的专业型学位封面上,“专业学位类别(领域)”一栏的 |
| 1238 |
% 填写内容可能与摘要页不一致,可以使用半角逗号分隔两个值。 |
| 1239 |
% \end{function} |
| 1240 |
% |
| 1241 |
% \begin{function}[updated=2021-10-01]{info/field,info/field*} |
| 1242 |
% \begin{syntax} |
| 1243 |
% \OPT{field} = \Arg{方向} |
| 1244 |
% \OPT{field*} = \Arg{方向} |
| 1245 |
% \end{syntax} |
| 1246 |
% 研究领域。只有研究生存在研究领域的说法,本科生无需填写。 |
| 1247 |
% \end{function} |
| 1248 |
% |
| 1249 |
% \begin{function}[updated=2022-01-12]{info/supervisor,info/supervisor*} |
| 1250 |
% \begin{syntax} |
| 1251 |
% \OPT{supervisor} = \Arg{导师姓名,职称} |
| 1252 |
% \OPT{supervisor*} = \Arg{导师英文全称} |
| 1253 |
% \end{syntax} |
| 1254 |
% 导师全称。请使用逗号( |,| )分隔导师的中文姓名与职称,英文名则不需添加逗号。 |
| 1255 |
% \end{function} |
| 1256 |
% |
| 1257 |
% \begin{function}[updated=2021-01-12]{info/supervisor-ii,info/supervisor-ii*} |
| 1258 |
% \begin{syntax} |
| 1259 |
% \OPT{supervisor-ii} = \Arg{第二导师姓名,职称} |
| 1260 |
% \OPT{supervisor-ii*} = \Arg{第二导师英文全称} |
| 1261 |
% \end{syntax} |
| 1262 |
% 第二导师全称。无第二导师时不填即可。 |
| 1263 |
% \end{function} |
| 1264 |
% |
| 1265 |
% \begin{function}[updated=2022-01-14]{info/submit-date} |
| 1266 |
% \begin{syntax} |
| 1267 |
% \OPT{submit-date} = \Arg{yyyy-mm-dd} |
| 1268 |
% \end{syntax} |
| 1269 |
% 提交日期。中英文日期现在可以由 ISO 日期格式\cite{gb-t-7408-2005} |
| 1270 |
% 的字符串统一生成。如果在等号后留空,则原本中文日期处使用空白的年月日字样; |
| 1271 |
% 如果不添加此设置项,则自动使用编译当天日期。 |
| 1272 |
% \end{function} |
| 1273 |
% |
| 1274 |
% \begin{function}[updated=2022-01-14]{info/defend-date} |
| 1275 |
% \begin{syntax} |
| 1276 |
% \OPT{defend-date} = \Arg{yyyy-mm-dd} |
| 1277 |
% \end{syntax} |
| 1278 |
% 答辩日期,只对研究生有效,要求同提交日期。 |
| 1279 |
% \end{function} |
| 1280 |
% |
| 1281 |
% \begin{function}[updated=2022-05-23]{info/confer-date} |
| 1282 |
% \begin{syntax} |
| 1283 |
% \OPT{confer-date} = \Arg{yyyy-mm-dd} |
| 1284 |
% \end{syntax} |
| 1285 |
% 学位授予日期,只用于国家图书馆封面,要求同提交日期。 |
| 1286 |
% \end{function} |
| 1287 |
% |
| 1288 |
% \begin{function}[updated=2022-05-23]{info/bottom-date} |
| 1289 |
% \begin{syntax} |
| 1290 |
% \OPT{bottom-date} = \Arg{yyyy-mm-dd} |
| 1291 |
% \end{syntax} |
| 1292 |
% 底部日期,只用于国家图书馆封面,要求同提交日期。 |
| 1293 |
% \end{function} |
| 1294 |
% |
| 1295 |
% \begin{function}[updated=2022-05-27]{info/chairman,info/reviewer} |
| 1296 |
% \begin{syntax} |
| 1297 |
% \OPT{chairman} = \Arg{答辩主席姓名职称} |
| 1298 |
% \OPT{reviewer} = \Arg{答辩评委姓名职称} |
| 1299 |
% \end{syntax} |
| 1300 |
% 答辩委员会信息,分别为评审委员会主席及成员的姓名加职称,只对研究生有效。 |
| 1301 |
% 评审成员名单以逗号分隔的列表形式存储,填写方法同关键词。 |
| 1302 |
% 如果是盲审,填入“盲审”二字即可。 |
| 1303 |
% \end{function} |
| 1304 |
% |
| 1305 |
% \begin{function}[updated=2021-10-01]{info/clc,info/udc} |
| 1306 |
% \begin{syntax} |
| 1307 |
% \OPT{clc} = \Arg{中国图书分类号} |
| 1308 |
% \OPT{udc} = \Arg{国际图书分类号} |
| 1309 |
% \end{syntax} |
| 1310 |
% 研究生学位论文封面上的\href{http://www.ztflh.com/}{中国图书分类号}和\ignorespaces |
| 1311 |
% \href{http://www.udcsummary.info/php/index.php?lang=chi&pr=Y}{国际图书分类号}。 |
| 1312 |
% \end{function} |
| 1313 |
% |
| 1314 |
% \begin{function}[updated=2021-10-01]{info/secret-level} |
| 1315 |
% \begin{syntax} |
| 1316 |
% \OPT{secret-level} = \Arg{密级} |
| 1317 |
% \end{syntax} |
| 1318 |
% 研究生学位论文封面上的密级。 |
| 1319 |
% \end{function} |
| 1320 |
% |
| 1321 |
% \begin{function}[updated=2021-10-01]{info/supervisor-contact} |
| 1322 |
% \begin{syntax} |
| 1323 |
% \OPT{supervisor-contact} = \Arg{导师联系方式} |
| 1324 |
% \end{syntax} |
| 1325 |
% 国家图书馆封面上的导师联系方式。 |
| 1326 |
% \end{function} |
| 1327 |
% |
| 1328 |
% \begin{function}[added=2023-04-29]{info/school-code} |
| 1329 |
% \begin{syntax} |
| 1330 |
% \OPT{school-code} = \Arg{10284} |
| 1331 |
% \end{syntax} |
| 1332 |
% 研究生学位论文封面上的学校代码。\CJKsout{你不会真的想改这个吧?} |
| 1333 |
% \end{function} |
| 1334 |
% |
| 1335 |
% \begin{function}[added=2023-04-24]{info/degree,info/degree*} |
| 1336 |
% \begin{syntax} |
| 1337 |
% \OPT{degree} = \Arg{中文学位名} |
| 1338 |
% \OPT{degree*} = \Arg{英文学位名} |
| 1339 |
% \end{syntax} |
| 1340 |
% 研究生国家图书馆封面英文封面上的学位名称。默认会由模板通过 \opt{degree} |
| 1341 |
% 和 \opt{type} 文档类选项生成,也可以由本选项自定义名称。 |
| 1342 |
% \end{function} |
| 1343 |
% |
| 1344 |
% |
| 1345 |
% \subsubsection{输入示范} |
| 1346 |
% |
| 1347 |
% 本科生可以参考如下范例输入个人信息。注意不能有空行。 |
| 1348 |
% |
| 1349 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info},emph={[3]title,title*, |
| 1350 |
% keywords,keywords*,grade,student-id,author,author*,department,department*, |
| 1351 |
% major,major*,supervisor,supervisor*,submit-date}] |
| 1352 |
% \njusetup[info]{ |
| 1353 |
% title = {第一行标题\\第二行标题}, |
| 1354 |
% title* = {My Awesome Work}, |
| 1355 |
% keywords = {我,就是,充数的,关键词}, |
| 1356 |
% keywords* = {Dummy, Keywords, Here, {it is}}, |
| 1357 |
% grade = {2018}, |
| 1358 |
% student-id = {189114514}, |
| 1359 |
% author = {周煜华}, |
| 1360 |
% author* = {Zhou Yuhua}, |
| 1361 |
% department = {化学化工学院}, |
| 1362 |
% department* = {School of Chemistry and Chemical Engineering}, |
| 1363 |
% major = {化学}, |
| 1364 |
% major* = {Chemistry}, |
| 1365 |
% supervisor = {李成殿,教授}, |
| 1366 |
% supervisor* = {Professor Li Chengdian}, |
| 1367 |
% submit-date = {2021-09-12} |
| 1368 |
% } |
| 1369 |
% \end{latexexample} |
| 1370 |
% |
| 1371 |
% 研究生可以参考如下列表输入个人信息 |
| 1372 |
% |
| 1373 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info},emph={[3]title,title*, |
| 1374 |
% keywords,keywords*,grade,student-id,author,author*,department,department*, |
| 1375 |
% major,major*,field,field*,supervisor,supervisor*,submit-date,defend-date,email}] |
| 1376 |
% \njusetup[info]{ |
| 1377 |
% title = {第一行标题\\第二行标题\\第三行标题}, |
| 1378 |
% title* = {My Awesome Work}, |
| 1379 |
% keywords = {我,就是,充数的,关键词}, |
| 1380 |
% keywords* = {Dummy,Keywords,Here,{it is}}, |
| 1381 |
% grade = {2018}, |
| 1382 |
% student-id = {DZ18114514}, |
| 1383 |
% author = {周煜华}, |
| 1384 |
% author* = {Zhou Yuhua}, |
| 1385 |
% department = {化学化工学院}, |
| 1386 |
% department* = {School of Chemistry and Chemical Engineering}, |
| 1387 |
% major = {化学}, |
| 1388 |
% major* = {Chemistry}, |
| 1389 |
% field = {物理化学}, |
| 1390 |
% field* = {Physical Chemistry}, |
| 1391 |
% supervisor = {李成殿,教授}, |
| 1392 |
% supervisor* = {Professor Li Chengdian}, |
| 1393 |
% submit-date = {2021-09-12}, |
| 1394 |
% defend-date = {2022-01-15}, |
| 1395 |
% clc = {0175.2}, |
| 1396 |
% udc = {004.72}, |
| 1397 |
% secret-level = {公开}, |
| 1398 |
% chairman = {张~教授}, |
| 1399 |
% reviewer = {王~教授,赵~副教授,李~助理研究员}, |
| 1400 |
% email = {[email protected]} |
| 1401 |
% } |
| 1402 |
% \end{latexexample} |
| 1403 |
% |
| 1404 |
% 如果需要国家图书馆封面,还需要加入如下信息 |
| 1405 |
% |
| 1406 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info},emph={[3]confer-date, |
| 1407 |
% bottom-date,chairman,reviewer,clc,secret-level,udc,supervisor-contact}] |
| 1408 |
% \njusetup[info]{ |
| 1409 |
% confer-date = {2022-05-20}, |
| 1410 |
% bottom-date = {2022-05-21}, |
| 1411 |
% supervisor-contact = {化学化工学院 仙林大道 163 号 210046} |
| 1412 |
% } |
| 1413 |
% \end{latexexample} |
| 1414 |
% |
| 1415 |
% 博士后可以参考如下范例输入个人信息。 |
| 1416 |
% |
| 1417 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info},emph={[3]title,title*, |
| 1418 |
% keywords,keywords*,student-id,author,department,major,supervisor,submit-date}] |
| 1419 |
% \njusetup[info]{ |
| 1420 |
% title = {第一行标题\\第二行标题}, |
| 1421 |
% title* = {My Awesome Work}, |
| 1422 |
% keywords = {我,就是,充数的,关键词}, |
| 1423 |
% keywords* = {Dummy, Keywords, Here, {it is}}, |
| 1424 |
% student-id = {189114514}, |
| 1425 |
% author = {周煜华}, |
| 1426 |
% department = {化学化工学院}, |
| 1427 |
% major = {化学}, |
| 1428 |
% supervisor = {李成殿,教授}, |
| 1429 |
% submit-date = {2021-09-12} |
| 1430 |
% } |
| 1431 |
% \end{latexexample} |
| 1432 |
% |
| 1433 |
% |
| 1434 |
% \subsection{编写正文} |
| 1435 |
% |
| 1436 |
% 与导言区相对的是正文,位于 \env{document} 环境内。 |
| 1437 |
% |
| 1438 |
% \begin{function}{\mainmatter} |
| 1439 |
% \tn{mainmatter} 标志着正文的开始,使用阿拉伯数字重新进行页码编号, |
| 1440 |
% 并设置页眉页脚格式。 |
| 1441 |
% \end{function} |
| 1442 |
% |
| 1443 |
% \begin{function}{\chaptermark,\sectionmark} |
| 1444 |
% \begin{syntax} |
| 1445 |
% \tn{chapter}\oarg{用在目录的章标题}\marg{完整的章标题} |
| 1446 |
% \tn{chaptermark}\marg{用在页眉中的章标题} |
| 1447 |
% \tn{section}\oarg{用在目录的节标题}\marg{完整的节标题} |
| 1448 |
% \tn{sectionmark}\marg{用在页眉中的节标题} |
| 1449 |
% \end{syntax} |
| 1450 |
% 如果页眉内容发生了冲突,可使用这两个命令细化定制。 |
| 1451 |
% 修改效果以实际编译出的文档为准。 |
| 1452 |
% \end{function} |
| 1453 |
% |
| 1454 |
% |
| 1455 |
% \subsubsection{页面} |
| 1456 |
% |
| 1457 |
% 在本模板预定义的页面样式中:本科生使用 \opt{plain} 样式,无页眉, |
| 1458 |
% 页面编号使用五号罗马体,居中位于页脚;研究生使用 \opt{headings} 样式, |
| 1459 |
% 页眉使用五号楷体,包括章名(奇数页右侧)和节名(偶数页左侧), |
| 1460 |
% 页面编号使用五号罗马体,居中位于页脚。在单面模式下,页眉会同时显示章节名。 |
| 1461 |
% |
| 1462 |
% 考虑到各个院系对于页眉内容的规定并不一致,本模板提供了若干个自定义选项。 |
| 1463 |
% |
| 1464 |
% \begin{function}{header/content,header/content*,footer/content,footer/content*} |
| 1465 |
% \begin{syntax} |
| 1466 |
% \OPT{content} = \{\Arg{位置}\Arg{内容},\Arg{位置}\Arg{内容},...\} |
| 1467 |
% \OPT{content*} = \{\Arg{位置}\Arg{内容},\Arg{位置}\Arg{内容},...\} |
| 1468 |
% \end{syntax} |
| 1469 |
% 页眉页脚的格式与内容设置。带有星号的设置项供单面模式下使用。 |
| 1470 |
% \end{function} |
| 1471 |
% |
| 1472 |
% 页眉页脚的内容设置是一个逗号分隔的列表,实际上是 \tn{fancyhead} 和 |
| 1473 |
% \tn{fancyfoot} 命令的选项。前一个花括号内为大写字母指定的位置选项, |
| 1474 |
% 可使用左(\opt{L})、中(\opt{C})、右(\opt{R})。 |
| 1475 |
% 双面模式下可额外指定出现在奇数页(\opt{O})还是偶数页(\opt{E})。 |
| 1476 |
% 详细说明请参考 \pkg{fancyhdr} 的手册。 |
| 1477 |
% |
| 1478 |
% 接下来展示了一个手动设置页眉内容的例子。这里我们清空了页脚, |
| 1479 |
% 并将页眉格式设置成五号黑体,奇数页左侧为节名,右侧为页码, |
| 1480 |
% 偶数页左侧为页码,右侧为章名。 |
| 1481 |
% \begin{latexexample}[moretexcs={\njusetup,\sffamily,\njusetformat}, |
| 1482 |
% emph={[2]header,footer},emph={[3]content}] |
| 1483 |
% \njusetup[header/content]{ |
| 1484 |
% { OR } { \thepage }, { OL } { \rightmark }, |
| 1485 |
% { EL } { \thepage }, { ER } { \leftmark } |
| 1486 |
% }, |
| 1487 |
% \njusetup[footer/content]{} |
| 1488 |
% \njusetformat{header}{\small\sffamily} |
| 1489 |
% \end{latexexample} |
| 1490 |
% |
| 1491 |
% |
| 1492 |
% \subsubsection{字形} |
| 1493 |
% |
| 1494 |
% 本模板继承 \pkg{ctex} 宏集提供的字形字号设置,以备不时之需。换句话说, |
| 1495 |
% 除非你有十足的把握,认为某处字体产生了偏差\footnote{在此情况下也应当 |
| 1496 |
% 直接到模板的 GitHub 仓库反馈。},否则无需动用这些命令处理样式问题。 |
| 1497 |
% |
| 1498 |
% \begin{function}[added=2021-09-22]{\njuline} |
| 1499 |
% \begin{syntax} |
| 1500 |
% \tn{njuline}\Arg{文字} |
| 1501 |
% \end{syntax} |
| 1502 |
% 为了避免原生 \tn{uline} 命令在中文环境下不能正常换行的问题, |
| 1503 |
% 本模板使用 \tn{njuline} 作为替代方案,分别对 \XeLaTeX 的 |
| 1504 |
% \pkg{xeCJKfntef} 包和 \LuaLaTeX 的 \pkg{lua-ul} |
| 1505 |
% 包中的下划线命令进行了包装。 |
| 1506 |
% \end{function} |
| 1507 |
% |
| 1508 |
% \subsubsection{列表} |
| 1509 |
% |
| 1510 |
% 模板默认载入 \pkg{enumitem} 宏包,对三个常用列表环境内的条目间距进行压缩。 |
| 1511 |
% 可以通过第 \ref{subsubsec:optional-pkg} 节提供的选项禁用该宏包。 |
| 1512 |
% |
| 1513 |
% \subsubsection{图表} |
| 1514 |
% |
| 1515 |
% \begin{function}[added=2022-08-06]{image/path} |
| 1516 |
% \begin{syntax} |
| 1517 |
% \OPT{path} = \{\marg{路径1},\marg{路径2},...\} |
| 1518 |
% \end{syntax} |
| 1519 |
% 图片搜索路径,等效于 \tn{graphicspath}。这个选项仅能设置一次。 |
| 1520 |
% \end{function} |
| 1521 |
% |
| 1522 |
% 图表的标题依赖 \pkg{caption} 包进行定制。按照习惯,图片的标题在底部, |
| 1523 |
% 表格的标题在顶部,这是通过 \tn{caption} 命令和生成图表命令的相对位置决定的。 |
| 1524 |
% \footnote{当然了,我们可以用 \pkg{float} 或者 \pkg{floatrow} 包来强制标题位置, |
| 1525 |
% 但 \url{https://tex.stackexchange.com/q/130825} 表明如无必要勿增实体。} |
| 1526 |
% |
| 1527 |
% \begin{minipage}{.5\textwidth} |
| 1528 |
% \begin{latexexample}[moretexcs={\centering,\includegraphics,\caption,\label}, |
| 1529 |
% emph={[1]figure}] |
| 1530 |
% \begin{figure}[htbp] |
| 1531 |
% \centering |
| 1532 |
% \includegraphics[ |
| 1533 |
% width=.6\textwidth]{foo.pdf} |
| 1534 |
% \caption{Figure example} |
| 1535 |
% \label{fig:foo} |
| 1536 |
% \end{figure} |
| 1537 |
% \end{latexexample} |
| 1538 |
% \end{minipage} |
| 1539 |
% \begin{minipage}{.5\textwidth} |
| 1540 |
% \begin{latexexample}[moretexcs={\centering,\caption,\label}, |
| 1541 |
% emph={[1]table,tabular}] |
| 1542 |
% \begin{table}[htbp] |
| 1543 |
% \centering |
| 1544 |
% \caption{Table example} |
| 1545 |
% \label{tab:foo} |
| 1546 |
% \begin{tabular}{cc} |
| 1547 |
% a & b \\ |
| 1548 |
% \end{tabular} |
| 1549 |
% \end{table} |
| 1550 |
% \end{latexexample} |
| 1551 |
% \end{minipage} |
| 1552 |
% |
| 1553 |
% \subsubsection{脚注} |
| 1554 |
% |
| 1555 |
% \begin{function}[added=2022-05-01,updated=2022-10-16]{footnote/style} |
| 1556 |
% \begin{syntax} |
| 1557 |
% \OPT{style} = <(plain)|pifont|circled|circled*> |
| 1558 |
% \end{syntax} |
| 1559 |
% 设置脚注编号样式。默认为普通数字;使用 \opt{pifont} 可修改为带圈数字, |
| 1560 |
% 由于字体包含的字符数量有限,单页不建议超过10条脚注;使用 \opt{circled} 或 \opt{circled*} |
| 1561 |
% 选项同样可修改为带圈数字,且不受单页脚注数量的限制,带星号的选项为黑底白字(阴文)。 |
| 1562 |
% \footnote{此功能依赖的 \pkg{circledtext} 宏包于 2022 年 4 月发布,可能需要手动安装。} |
| 1563 |
% \end{function} |
| 1564 |
% |
| 1565 |
% \begin{function}[added=2022-10-16]{footnote/circledtext-option} |
| 1566 |
% \begin{syntax} |
| 1567 |
% \OPT{circledtext-option} = \meta{选项列表} |
| 1568 |
% \end{syntax} |
| 1569 |
% \opt{circled} 或 \opt{circled*} 选项的带圈数字编号使用 \pkg{circledtext} |
| 1570 |
% 宏包绘制,可使用本选项载入更多定制设置,详见其手册。 |
| 1571 |
% \end{function} |
| 1572 |
% |
| 1573 |
% \begin{function}[added=2022-10-16]{footnote/hang} |
| 1574 |
% \begin{syntax} |
| 1575 |
% \OPT{hang} = \TTF |
| 1576 |
% \end{syntax} |
| 1577 |
% 是否进行悬挂缩进。默认为是,缩进宽度为 \qty{1.5}{em}。 |
| 1578 |
% \end{function} |
| 1579 |
% |
| 1580 |
% 脚注样式的调整依赖 \pkg{footmisc}。如果希望使用 \LaTeX 的默认样式, |
| 1581 |
% 可以通过第 \ref{subsubsec:optional-pkg} 节提供的选项禁用该宏包。 |
| 1582 |
% |
| 1583 |
% \subsubsection{数学符号} |
| 1584 |
% |
| 1585 |
% ^^A \url{https://www.caam.rice.edu/~heinken/latex/symbols.pdf} |
| 1586 |
% ^^A http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unimath-symbols.pdf |
| 1587 |
% 模板使用 \pkg{unicode-math} 宏包配置数学字体,该方案目前不兼容 |
| 1588 |
% 传统的 \pkg{amsfonts}、\pkg{amssymb}、\pkg{bm} |
| 1589 |
% \footnote{\url{https://tex.stackexchange.com/q/528831/}} |
| 1590 |
% 、\pkg{upgreek} 等宏包。需要使用新方案提供的相应命令。 |
| 1591 |
% 例如,加粗数学符号的命令为 \tn{symbf}。 |
| 1592 |
% 更多细节请查阅 \pkg{unicode-math} 手册。 |
| 1593 |
% |
| 1594 |
% 如果您对此并不熟悉,也可以通过第 \ref{subsubsec:optional-pkg} |
| 1595 |
% 节提供的选项禁用该宏包。\footnote{禁用后本节提供的设置均不会生效。} |
| 1596 |
% |
| 1597 |
% 中文论文的数学符号默认遵循 GB/T 3102--93《物理科学和技术中 |
| 1598 |
% 使用的数学符号》\cite{gb-3102-93},该标准参照采纳 ISO 31-11:1992, |
| 1599 |
% \footnote{目前已更新为 ISO 80000-2:2019。}, |
| 1600 |
% 但是与 \TeX{} 默认的美国数学学会(AMS)的习惯有许多差异。 |
| 1601 |
% |
| 1602 |
% \begin{function}[added=2022-07-31]{math/style} |
| 1603 |
% \begin{syntax} |
| 1604 |
% \OPT{style} = <TeX|ISO|(GB)> |
| 1605 |
% \end{syntax} |
| 1606 |
% 数学符号风格。 |
| 1607 |
% \end{function} |
| 1608 |
% |
| 1609 |
% 默认的国标风格 \opt{GB} 相当于在导言区设置了 |
| 1610 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]math}, |
| 1611 |
% emph={[3]integral,integral-limits,less-than-or-equal, |
| 1612 |
% math-ellipsis,partial,real-part,vector,uppercase-greek}] |
| 1613 |
% \njusetup[math]{ |
| 1614 |
% integral = upright, |
| 1615 |
% integral-limits = false, |
| 1616 |
% less-than-or-equal = slanted, |
| 1617 |
% math-ellipsis = centered, |
| 1618 |
% partial = upright, |
| 1619 |
% real-part = roman, |
| 1620 |
% vector = boldfont, |
| 1621 |
% uppercase-greek = italic |
| 1622 |
% } |
| 1623 |
% \end{latexexample} |
| 1624 |
% |
| 1625 |
% 用户也可以逐项修改数学样式。 |
| 1626 |
% |
| 1627 |
% \begin{function}[added=2022-07-31]{math/integral} |
| 1628 |
% \begin{syntax} |
| 1629 |
% \OPT{integral} = <upright|slanted> |
| 1630 |
% \end{syntax} |
| 1631 |
% 积分号的正/斜体。 |
| 1632 |
% 该选项需要字体的支持,目前仅限 \opt{xits}、\opt{newcm}。 |
| 1633 |
% \end{function} |
| 1634 |
% |
| 1635 |
% \begin{function}[added=2022-07-31]{math/integral-limits} |
| 1636 |
% \begin{syntax} |
| 1637 |
% \OPT{integral-limits} = <\TF> |
| 1638 |
% \end{syntax} |
| 1639 |
% 积分号上下限的位置,可选:\opt{true}(在上下)、\opt{false}(在右侧)。 |
| 1640 |
% 这个设置只影响行间公式,行内公式统一居右侧,不受影响。 |
| 1641 |
% \end{function} |
| 1642 |
% |
| 1643 |
% \begin{function}[added=2022-07-31]{math/less-than-or-equal} |
| 1644 |
% \begin{syntax} |
| 1645 |
% \OPT{less-than-or-equal} = <slanted|horizontal> |
| 1646 |
% \end{syntax} |
| 1647 |
% 小于等于号和大于等于号的字形。 |
| 1648 |
% 这将控制 \tn{le}、\tn{ge}、\tn{leq} 和 \tn{geq} 的符号是 |
| 1649 |
% “$\leqslant$、$\geqslant$”还是“$\leq$、$\geq$”。 |
| 1650 |
% \end{function} |
| 1651 |
% |
| 1652 |
% \begin{function}[added=2022-07-31]{math/math-ellipsis} |
| 1653 |
% \begin{syntax} |
| 1654 |
% \OPT{math-ellipsis} = <centered|lower> |
| 1655 |
% \end{syntax} |
| 1656 |
% 省略号 \tn{dots} 的样式,可选:\opt{centered}(按照中文的习惯固定居中)、 |
| 1657 |
% \opt{lower}(取决于前后符号的位置)。 |
| 1658 |
% 其他的省略号命令如 \tn{lots}、\tn{cdots} 则不受影响。 |
| 1659 |
% \end{function} |
| 1660 |
% |
| 1661 |
% \begin{function}[added=2022-07-31]{math/partial} |
| 1662 |
% \begin{syntax} |
| 1663 |
% \OPT{partial} = <upright|italic> |
| 1664 |
% \end{syntax} |
| 1665 |
% 偏微分符号的正/斜体。 |
| 1666 |
% \end{function} |
| 1667 |
% |
| 1668 |
% \begin{function}[added=2022-07-31]{math/real-part} |
| 1669 |
% \begin{syntax} |
| 1670 |
% \OPT{real-part} = <roman|fraktur> |
| 1671 |
% \end{syntax} |
| 1672 |
% 实部 \tn{Re} 和虚部 \tn{Im} 的字体。 |
| 1673 |
% \end{function} |
| 1674 |
% |
| 1675 |
% \begin{function}[added=2022-07-31]{math/vector} |
| 1676 |
% \begin{syntax} |
| 1677 |
% \OPT{vector} = <boldfont|arrow> |
| 1678 |
% \end{syntax} |
| 1679 |
% 向量的表示方法,可选粗斜体或箭头。 |
| 1680 |
% \end{function} |
| 1681 |
% |
| 1682 |
% \begin{function}[added=2022-07-31]{math/uppercase-greek} |
| 1683 |
% \begin{syntax} |
| 1684 |
% \OPT{uppercase-greek} = <upright|italic> |
| 1685 |
% \end{syntax} |
| 1686 |
% 大写希腊字母的正/斜体。 |
| 1687 |
% 有限增量符号 $\increment x$ 固定使用正体,推荐使用 \tn{increment} 表示。 |
| 1688 |
% \end{function} |
| 1689 |
% |
| 1690 |
% 本模板的设置并不能覆盖所有符号,一些需要写作时手动处理的要点包括: |
| 1691 |
% \begin{itemize} |
| 1692 |
% \item 数学常数和特殊函数名用正体,如 |
| 1693 |
% \begin{itemize} |
| 1694 |
% \item $\uppi$ 使用 |$\uppi$| |
| 1695 |
% \item $\symup{i}$ 使用 |$\symup{i}$| |
| 1696 |
% \item $\symup{e}$ 使用 |$\symup{e}$| |
| 1697 |
% \end{itemize} |
| 1698 |
% \item 微分号使用正体,如 |
| 1699 |
% \begin{itemize} |
| 1700 |
% \item $\mathrm{d} \varphi / \mathrm{d} t$ |
| 1701 |
% 使用 |$\mathrm{d} \varphi / \mathrm{d} t$| |
| 1702 |
% \end{itemize} |
| 1703 |
% \end{itemize} |
| 1704 |
% |
| 1705 |
% \subsubsection{定理环境} |
| 1706 |
% |
| 1707 |
% 模板使用 \pkg{ntheorem} 宏包配置定理类环境,提供了一系列选项。 |
| 1708 |
% 您也可以通过第 \ref{subsubsec:optional-pkg} 节提供的选项禁用该宏包。 |
| 1709 |
% \footnote{禁用后本节提供的设置均不会生效。} |
| 1710 |
% |
| 1711 |
% 以下选项用于定义定理类环境的样式。 |
| 1712 |
% |
| 1713 |
% \begin{function}[added=2022-04-21]{theorem/style} |
| 1714 |
% \begin{syntax} |
| 1715 |
% \OPT{style} = <(plain)|break|change|margin|empty|...> |
| 1716 |
% \end{syntax} |
| 1717 |
% 定理基本样式。等效于 \tn{theoremstyle}\marg{样式名称}。 |
| 1718 |
% \end{function} |
| 1719 |
% |
| 1720 |
% \begin{function}[added=2022-04-21]{theorem/header-font} |
| 1721 |
% \begin{syntax} |
| 1722 |
% \OPT{header-font} = \meta{头部字体格式} |
| 1723 |
% \end{syntax} |
| 1724 |
% 定理头部字体格式。等效于 \tn{theoremheaderfont}\marg{格式}。 |
| 1725 |
% \end{function} |
| 1726 |
% |
| 1727 |
% \begin{function}[added=2022-04-21]{theorem/body-font} |
| 1728 |
% \begin{syntax} |
| 1729 |
% \OPT{body-font} = \meta{内部字体格式} |
| 1730 |
% \end{syntax} |
| 1731 |
% 定理内部字体格式。等效于 \tn{theorembodyfont}\marg{格式}。 |
| 1732 |
% \end{function} |
| 1733 |
% |
| 1734 |
% \begin{function}[added=2022-04-21]{theorem/qed-symbol} |
| 1735 |
% \begin{syntax} |
| 1736 |
% \OPT{qed-symbol} = \meta{证毕符号} |
| 1737 |
% \end{syntax} |
| 1738 |
% 证毕符号。等效于 \tn{theoremsymbol}\marg{符号}。默认为空心方块(\mdlgwhtsquare)。 |
| 1739 |
% 禁用 \pkg{unicode-math} 时为实心黑色方块(\rule{1ex}{1ex})。 |
| 1740 |
% \end{function} |
| 1741 |
% |
| 1742 |
% \begin{function}[added=2022-04-21]{theorem/counter} |
| 1743 |
% \begin{syntax} |
| 1744 |
% \OPT{counter} = <part|(chapter)|section|...> |
| 1745 |
% \end{syntax} |
| 1746 |
% 定理计数器范围。 |
| 1747 |
% \end{function} |
| 1748 |
% |
| 1749 |
% \begin{function}[added=2023-05-07]{theorem/share-counter} |
| 1750 |
% \begin{syntax} |
| 1751 |
% \OPT{share-counter} = <\TFF> |
| 1752 |
% \end{syntax} |
| 1753 |
% 是否共享计数器。 |
| 1754 |
% \end{function} |
| 1755 |
% |
| 1756 |
% 模板的默认设置等效于 |
| 1757 |
% |
| 1758 |
% \begin{latexexample}[moretexcs={\njusetup,\bfseries,\itshape,\mdlgwhtsquare}, |
| 1759 |
% emph={[2]theorem},emph={[3]style,header-font,body-font,qed-symbol,counter}] |
| 1760 |
% \njusetup[theorem]{ |
| 1761 |
% style = plain, |
| 1762 |
% header-font = \normalfont \bfseries , |
| 1763 |
% body-font = \itshape , |
| 1764 |
% qed-symbol = \ensuremath { \mdlgwhtsquare }, |
| 1765 |
% counter = chapter, |
| 1766 |
% share-counter = false |
| 1767 |
% } |
| 1768 |
% \end{latexexample} |
| 1769 |
% |
| 1770 |
% 以下选项用于创建定理类环境。 |
| 1771 |
% |
| 1772 |
% \begin{function}[added=2022-08-05]{theorem/type} |
| 1773 |
% \begin{syntax} |
| 1774 |
% \OPT{type} = \{\marg{环境名,类型标识} \marg{头名称},...\} |
| 1775 |
% \end{syntax} |
| 1776 |
% 需要定义的定理类型列表。在可选的 \meta{类型标识} 中,含有\emph{星号}表示 |
| 1777 |
% 需要编号,含有\emph{加号}需要证毕符号。该选项存储的是用来定义环境的参数, |
| 1778 |
% 而\emph{不会直接创建环境},且每次调用都会覆盖前面定义的环境列表。 |
| 1779 |
% \end{function} |
| 1780 |
% |
| 1781 |
% \opt{theorem/type} 初始定义的环境列表如表~\ref{tab:mathenv} 所示。 |
| 1782 |
% 这些环境并没有预先创建,使用方法见下面的例子。 |
| 1783 |
% |
| 1784 |
% \begin{table}[htbp] |
| 1785 |
% \centering |
| 1786 |
% \begin{talltblr} [ |
| 1787 |
% caption = {预置的数学定理环境}, |
| 1788 |
% label = {tab:mathenv}, |
| 1789 |
% note{a} = {证明环境较为特殊,不编号且会在结尾添加证毕符号。} ] |
| 1790 |
% { colspec = {cc|cc} } |
| 1791 |
% \toprule |
| 1792 |
% 标签 & 名称 & 标签 & 名称 \\ |
| 1793 |
% \midrule |
| 1794 |
% axiom & 公理 & lemma & 引理 \\ |
| 1795 |
% corollary & 推论 & proof \TA & 证明 \\ |
| 1796 |
% definition & 定义 & theorem & 定理 \\ |
| 1797 |
% example & 例 & & \\ |
| 1798 |
% \bottomrule |
| 1799 |
% \end{talltblr} |
| 1800 |
% \end{table} |
| 1801 |
% |
| 1802 |
% \begin{function}[added=2022-08-05]{theorem/define} |
| 1803 |
% \begin{syntax} |
| 1804 |
% <\OPT{define}> |
| 1805 |
% \end{syntax} |
| 1806 |
% 创建定理环境。 |
| 1807 |
% \end{function} |
| 1808 |
% |
| 1809 |
% \opt{theorem/define} 并没有参数。这个选项在调用后会读取 |
| 1810 |
% \opt{theorem/type} 保存的列表以及前方的样式设置并创建相应环境。 |
| 1811 |
% 这也就意味着该选项在 \opt{theorem/type} 为空时会报错。 |
| 1812 |
% |
| 1813 |
% 在下面这个例子中,我们先创建了预置的七种环境。除了无编号的 |
| 1814 |
% \env{proof},其余六种共用一个计数器。随后我们将定理内部文字字体改为 |
| 1815 |
% 宋体,定义了 \env{exercise} 和 \env{solution} 两种定理环境,后者没有编号。 |
| 1816 |
% |
| 1817 |
% \begin{latexexample}[moretexcs={\njusetup,\normalfont}, |
| 1818 |
% emph={[2]theorem},emph={[3]share-counter,define,body-font,type}] |
| 1819 |
% \njusetup[theorem]{ |
| 1820 |
% share-counter = true , |
| 1821 |
% define , |
| 1822 |
% body-font = \normalfont , |
| 1823 |
% type = { |
| 1824 |
% { {exercise} {习题} }, |
| 1825 |
% { {solution,*} {解} } |
| 1826 |
% }, |
| 1827 |
% define |
| 1828 |
% } |
| 1829 |
% \end{latexexample} |
| 1830 |
% |
| 1831 |
% |
| 1832 |
% \subsubsection{编号} |
| 1833 |
% |
| 1834 |
% \begin{function}[added=2022-07-31]{label-sep/figure,label-sep/table,label-sep/equation} |
| 1835 |
% \begin{syntax} |
| 1836 |
% \OPT{figure} = \meta{符号} |
| 1837 |
% \OPT{table} = \meta{符号} |
| 1838 |
% \OPT{equation} = \meta{符号} |
| 1839 |
% \end{syntax} |
| 1840 |
% 图片、表格、公式编号中的连接符样式,默认为短横线(en dash)。 |
| 1841 |
% \end{function} |
| 1842 |
% |
| 1843 |
% |
| 1844 |
% \subsection{参考文献} |
| 1845 |
% |
| 1846 |
% 本模板默认载入 \pkg{biblatex} 宏包,使用 \hologo{biber} 作为后端, |
| 1847 |
% 通过 \pkg{biblatex-gb7714-2015}\cite{biblatex-gb7714-2015} 实现 |
| 1848 |
% GB/T 7714--2015 \cite{gb-t-7714-2015} 规定的参考文献著录规则国家标准。 |
| 1849 |
% 需要使用 |biber| 命令编译才会显示正确的条目序号,详情请参照第 |
| 1850 |
% \ref{subsubsec:compileseq} 节。本节提供的所有选项均基于此方案。 |
| 1851 |
% |
| 1852 |
% 出于简化命令的考虑,本模板并不计划支持 \hologo{BibTeX},但您可以通过第 |
| 1853 |
% \ref{subsubsec:optional-pkg} 节提供的选项禁用默认的参考文献工具, |
| 1854 |
% 自行利用 \pkg{gbt7714} 等宏包完成参考文献样式的配置。 |
| 1855 |
% |
| 1856 |
% \subsubsection{选项} |
| 1857 |
% |
| 1858 |
% \begin{function}[added=2021-12-19]{bib/style} |
| 1859 |
% \begin{syntax} |
| 1860 |
% \OPT{style} = <(numeric)|author-year|\meta{自定义样式}> |
| 1861 |
% \end{syntax} |
| 1862 |
% 参考文献样式。可选顺序编码制 \opt{numeric} 和著者-出版年制 \opt{author-year}, |
| 1863 |
% 或自行填入任意其他 \pkg{biblatex} 样式。默认为顺序编码制。 |
| 1864 |
% \end{function} |
| 1865 |
% |
| 1866 |
% 参考文献样式是一个整体的设置,会对正文中引用的文献的标注方法和 |
| 1867 |
% 参考文献表的输出格式产生影响。根据国家规定\cite{gb-t-7714-2015}, |
| 1868 |
% 可以按照参考文献表的组织方式分为以下两种样式: |
| 1869 |
% \begin{description} |
| 1870 |
% \item[顺序编码制] 顺序编码制是按正文中引用的文献出现的先后顺序连续 |
| 1871 |
% 编码,将序号置于方括号中。参考文献表采用顺序编码 |
| 1872 |
% 制组织时,各篇文献应按正文部分标注的序号依次列出。 |
| 1873 |
% \item[著者-出版年制] 正文引用的文献采用著者-出版年制时,各篇文献的 |
| 1874 |
% 标注内容由著者姓氏与出版年构成,并置于"()"内。 |
| 1875 |
% 参考文献表采用著者-出版年制组织时,各篇文献首 |
| 1876 |
% 先按文种集中,然后按著者字顺和出版年排列。 |
| 1877 |
% \end{description} |
| 1878 |
% |
| 1879 |
% 对于本科生而言,学校规定文件表明参考文献表应当“用数字加方括号 |
| 1880 |
% 表示”\cite{nju-bachelor-2026},符合顺序编码制的格式,保持默认设置即可。 |
| 1881 |
% |
| 1882 |
% \begin{function}[added=2022-02-15]{bib/option} |
| 1883 |
% \begin{syntax} |
| 1884 |
% \OPT{option} = \meta{选项列表} |
| 1885 |
% \end{syntax} |
| 1886 |
% 待传入 \pkg{biblatex} 宏包的额外选项列表。 |
| 1887 |
% \end{function} |
| 1888 |
% |
| 1889 |
% 本模板中 \pkg{biblatex} 并不是显式载入的。 |
| 1890 |
% 如需在其基础上进行一些定制,可使用本设置项载入宏包选项\cite{biblatex}。 |
| 1891 |
% |
| 1892 |
% \begin{function}[added=2021-12-19]{bib/resource} |
| 1893 |
% \begin{syntax} |
| 1894 |
% \OPT{resource} = \Arg{文件} |
| 1895 |
% \end{syntax} |
| 1896 |
% 参考文献数据源。类似于 \tn{addbibresource} 命令,但可以使用逗号分隔的 |
| 1897 |
% 列表形式。必须使用带扩展名(\file{.bib})的完整文件名。 |
| 1898 |
% \end{function} |
| 1899 |
% |
| 1900 |
% \begin{function}{\addbibresource} |
| 1901 |
% \begin{syntax} |
| 1902 |
% \tn{addbibresource}\Arg{文件} |
| 1903 |
% \end{syntax} |
| 1904 |
% 添加参考文献源文件。为了与 \pkg{biblatex} 进行兼容,也可使用本命令 |
| 1905 |
% 添加数据源。本命令不支持逗号分隔多个文件的形式,如果希望额外添加参 |
| 1906 |
% 考文献列表,需要在导言区中多次调用。 |
| 1907 |
% \end{function} |
| 1908 |
% |
| 1909 |
% 可以参考如下范例进行参考文献设置。 |
| 1910 |
% 其中 \opt{bib/option} 的内容旨在关闭部分不需显示的文献信息, |
| 1911 |
% 并采取仅首字母大写的作者姓名格式,可根据需要使用。 |
| 1912 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]bib}, |
| 1913 |
% emph={[3]style,resource,option}] |
| 1914 |
% \njusetup[bib]{ |
| 1915 |
% style = author-year, |
| 1916 |
% resource = {njuthesis-sample.bib}, |
| 1917 |
% option = { |
| 1918 |
% doi = false, |
| 1919 |
% isbn = false, |
| 1920 |
% url = false, |
| 1921 |
% eprint = false, |
| 1922 |
% gbnamefmt = lowercase |
| 1923 |
% } |
| 1924 |
% } |
| 1925 |
% \end{latexexample} |
| 1926 |
% |
| 1927 |
% |
| 1928 |
% \subsubsection{参考文献表} |
| 1929 |
% |
| 1930 |
% \begin{function}{\printbibliography} |
| 1931 |
% 生成参考文献表。 |
| 1932 |
% \end{function} |
| 1933 |
% |
| 1934 |
% 显然只有被引用过的条目才会被输出至参考文献表。 |
| 1935 |
% |
| 1936 |
% 假如需要在每章末尾附上单独的参考文献表,导言区添加以下设置, |
| 1937 |
% 并在每章后使用 \tn{printbibliography} 即可。 |
| 1938 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[2]bib},emph={[3]option}] |
| 1939 |
% \njusetup[bib/option]{refsection = chapter} |
| 1940 |
% \end{latexexample} |
| 1941 |
% |
| 1942 |
% 如果开启了草稿模式,您可能会注意到部分条目存在超宽的问题。对此, |
| 1943 |
% 需要将 \pkg{biblatex-gb7714-2015} 宏包手动更新至 2022-04-16 以后的版本。 |
| 1944 |
% 此外,由于 \TeX{} 预置的断词位置是有限的,不能覆盖学术上使用的复杂词汇, |
| 1945 |
% 您也可以自行在 \file{.bib} 文件中设置断行点,例如可以将 graphene |
| 1946 |
% 一词修改为 graph|\-|ene。 |
| 1947 |
% |
| 1948 |
% \subsubsection{正文引用} |
| 1949 |
% |
| 1950 |
% \begin{function}{\cite} |
| 1951 |
% \begin{syntax} |
| 1952 |
% \tn{cite}\marg{文献} |
| 1953 |
% \tn{cite}\oarg{页码}\marg{文献} |
| 1954 |
% \end{syntax} |
| 1955 |
% 在正文中引用参考文献。 |
| 1956 |
% \end{function} |
| 1957 |
% |
| 1958 |
% 引用命令 \tn{cite} 含有多个变体,以便使用文献条目中不同的信息域。 |
| 1959 |
% 在两种参考文献样式下,这些命令的行为具体存在一些差异, |
| 1960 |
% 详见表 \ref{tab:numeric-style} 和表 \ref{tab:author-year-style}。 |
| 1961 |
% |
| 1962 |
% \begin{table}[ht] |
| 1963 |
% \centering |
| 1964 |
% \begin{talltblr} [ |
| 1965 |
% caption = {顺序编码制下的引用样式}, |
| 1966 |
% label = {tab:numeric-style} ] |
| 1967 |
% { colspec = {cll} } |
| 1968 |
% \toprule |
| 1969 |
% 引用方式 & 命令 & 排版效果 \\ |
| 1970 |
% \midrule |
| 1971 |
% 单篇文献 & \tn{cite} & 上标可设置页码 \\ |
| 1972 |
% 单篇文献 & \tn{parencite} & 非上标可设置页码 \\ |
| 1973 |
% 多篇文献 & \tn{cite} & 上标,逗号隔开或短横线连接 \\ |
| 1974 |
% 标注页码 & \tn{pagescite} & 上标加自动页码 \\ |
| 1975 |
% 标注作者 & \tn{textcite} & 作者为主语加非上标编号 \\ |
| 1976 |
% 标注作者 & \tn{authornumcite} & 作者为主语加上标编号 \\ |
| 1977 |
% 完整脚注 & \tn{footfullcite} & 脚注方式 \\ |
| 1978 |
% \bottomrule |
| 1979 |
% \end{talltblr} |
| 1980 |
% \end{table} |
| 1981 |
% |
| 1982 |
% \begin{table}[ht] |
| 1983 |
% \centering |
| 1984 |
% \begin{talltblr} [ |
| 1985 |
% caption = {著者-出版年制下的引用样式}, |
| 1986 |
% label = {tab:author-year-style}, |
| 1987 |
% note{a} = {在此样式下 \tn{parencite} 效果等同于 \tn{cite}。} ] |
| 1988 |
% { colspec = {cll} } |
| 1989 |
% \toprule |
| 1990 |
% 引用方式 & 命令 & 排版效果 \\ |
| 1991 |
% \midrule |
| 1992 |
% 单篇文献 & \tn{cite} \TA & 作者加年份用括号包围可设置页码 \\ |
| 1993 |
% 多篇文献 & \tn{cite} & 分号隔开 \\ |
| 1994 |
% 标注页码 & \tn{pagescite} & 作者加年份用括号包围自动页码 \\ |
| 1995 |
% 标注年份 & \tn{yearcite} & 用括号包围的年份 \\ |
| 1996 |
% 标注年份、页码 & \tn{yearpagescite} & 提供年份用括号包围自动页码 \\ |
| 1997 |
% 标注作者 & \tn{textcite} & 作者为主语加加括号包围年份 \\ |
| 1998 |
% 完整脚注 & \tn{footfullcite} & 脚注方式 \\ |
| 1999 |
% \bottomrule |
| 2000 |
% \end{talltblr} |
| 2001 |
% \end{table} |
| 2002 |
% |
| 2003 |
% |
| 2004 |
% \subsubsection{文献管理} |
| 2005 |
% |
| 2006 |
% 参考文献数据源理应是通过文献管理软件导出的,而不是逐条手动填写的。 |
| 2007 |
% |
| 2008 |
% \subparagraph{使用 EndNote} |
| 2009 |
% |
| 2010 |
% 南京大学信息化建设管理服务中心已购买 |
| 2011 |
% \href{https://itsc.nju.edu.cn/EndNote/list.htm}{EndNote} |
| 2012 |
% 供全校师生免费使用,最新版为 EndNote 20。 |
| 2013 |
% |
| 2014 |
% \subparagraph{使用 JabRef} |
| 2015 |
% |
| 2016 |
% \href{https://www.jabref.org/}{JabRef} 是一款开源、跨平台的文献管理软件。 |
| 2017 |
% JabRef 提供了对 \hologo{BibTeX} 和 \pkg{biblatex} 的原生支持, |
| 2018 |
% 能够直接管理 \file{.bib} 文件, 还可以向 TeXstudio 等外部软件推送引用命令。 |
| 2019 |
% |
| 2020 |
% \subparagraph{使用 Zotero} |
| 2021 |
% |
| 2022 |
% \href{https://www.zotero.org/}{Zotero} 也是一款开源、跨平台的文献管理软件。 |
| 2023 |
% Zotero 更为通用,其功能可以通过 \href{https://github.com/l0o0/jasminum}{Jasminum}、 |
| 2024 |
% \href{https://github.com/retorquere/zotero-better-bibtex}{Better BibTeX}、 |
| 2025 |
% \href{https://github.com/bwiernik/zotero-shortdoi}{DOI Manager} 等第三方插件, |
| 2026 |
% 以及 Zotero Connector 浏览器插件进行增强。 |
| 2027 |
% |
| 2028 |
% |
| 2029 |
% \subsection{特殊页面} |
| 2030 |
% |
| 2031 |
% 本模板也预定义了一系列用于生成所需的特殊页面的命令与环境。 |
| 2032 |
% |
| 2033 |
% |
| 2034 |
% \subsubsection{封面} |
| 2035 |
% |
| 2036 |
% \begin{function}{\maketitle} |
| 2037 |
% 生成封面。 |
| 2038 |
% \end{function} |
| 2039 |
% |
| 2040 |
% 本科生模板仅会生成中文封面;研究生模板会生成中文封面。 |
| 2041 |
% 如果选择了 \opt{nl-cover},\emph{仅仅}会生成研究生的国家图书馆封面。 |
| 2042 |
% 如果选择了 \opt{decl-page},会在封面后生成本科生的诚信承诺书或研究生的 |
| 2043 |
% 原创性声明。在启用草稿模式后封面绘制将被禁用。 |
| 2044 |
% |
| 2045 |
% 新版本研究生学位材料包中并不包含英文封面,我们这里默认也不生成英文封面, |
| 2046 |
% 但可以通过以下命令调出: |
| 2047 |
% |
| 2048 |
% \begin{latexexample}[moretexcs={\AddToHook,\UseInstance}] |
| 2049 |
% \AddToHook{njuthesis/cover/body}[main]{\UseInstance{nju}{cover-g-en}} |
| 2050 |
% \end{latexexample} |
| 2051 |
% |
| 2052 |
% |
| 2053 |
% \paragraph{封面图片} |
| 2054 |
% |
| 2055 |
% \begin{function}[added=2026-05-12]{image/nju-logo-color} |
| 2056 |
% \begin{syntax} |
| 2057 |
% \OPT{nju-logo-color} = <\OPT{black}|\OPT{purple}> |
| 2058 |
% \end{syntax} |
| 2059 |
% 校名、校徽图片的统一颜色设置。相当于同时设置下方的两个选项。 |
| 2060 |
% 本科生和博士后默认为黑色,研究生默认为紫色。 |
| 2061 |
% 新版本的模板默认附带有黑色和紫色两种图片文件。 |
| 2062 |
% 目前这个选项不会影响本科生诚信承诺书用到的紫色校徽。 |
| 2063 |
% \end{function} |
| 2064 |
% |
| 2065 |
% |
| 2066 |
% \begin{function}[added=2021-12-23,updated=2026-05-12]{ |
| 2067 |
% image/nju-emblem,image/nju-name} |
| 2068 |
% \begin{syntax} |
| 2069 |
% \OPT{nju-emblem} = <\OPT{black}|(\OPT{purple})|\Arg{文件}> |
| 2070 |
% \OPT{nju-name} = <\OPT{black}|(\OPT{purple})|\Arg{文件}> |
| 2071 |
% \end{syntax} |
| 2072 |
% 校名、校徽图片单独的颜色设置。在填入 \OPT{black} 或 (\OPT{purple} 以外的值时, |
| 2073 |
% 会将选项处理为外部图片的文件路径,可以任意使用外置的校徽和校名图片。 |
| 2074 |
% 新版本中移除了 \pkg{njuvisual} 宏包的相关依赖。 |
| 2075 |
% \end{function} |
| 2076 |
% |
| 2077 |
% |
| 2078 |
% \subsubsection{摘要页} |
| 2079 |
% \changes{v0.11}{2021/10/01}{简化了摘要的编写方式。} |
| 2080 |
% |
| 2081 |
% \DescribeEnv{abstract} |
| 2082 |
% \DescribeEnv{abstract*} |
| 2083 |
% 摘要。带星号的环境会生成英文摘要。 |
| 2084 |
% |
| 2085 |
% \begin{latexexample}[emph={[1]abstract,abstract*}] |
| 2086 |
% \begin{abstract} |
| 2087 |
% 我的中文摘要 |
| 2088 |
% \end{abstract} |
| 2089 |
% |
| 2090 |
% \begin{abstract*} |
| 2091 |
% Abstract in English |
| 2092 |
% \end{abstract*} |
| 2093 |
% \end{latexexample} |
| 2094 |
% |
| 2095 |
% \begin{function}[added=2022-02-04,updated=2022-07-31]{abstract/toc-entry} |
| 2096 |
% \begin{syntax} |
| 2097 |
% \OPT{toc-entry} = <\TTF> |
| 2098 |
% \end{syntax} |
| 2099 |
% 是否将摘要条目插入目录,默认开启。 |
| 2100 |
% 关闭此选项后摘要页将不会出现在目录中,仅保留其 PDF 书签。 |
| 2101 |
% \end{function} |
| 2102 |
% |
| 2103 |
% \begin{function}[added=2023-04-23]{abstract/underline} |
| 2104 |
% \begin{syntax} |
| 2105 |
% \OPT{underline} = <\TTF> |
| 2106 |
% \end{syntax} |
| 2107 |
% 选择研究生英文摘要条目内容是否需要下划线。默认添加。 |
| 2108 |
% \end{function} |
| 2109 |
% |
| 2110 |
% \begin{function}[added=2022-03-26,updated=2022-07-31]{abstract/title-style} |
| 2111 |
% \begin{syntax} |
| 2112 |
% \OPT{title-style} = <(strict)|centered|natural> |
| 2113 |
% \end{syntax} |
| 2114 |
% 选择研究生摘要标题样式。 |
| 2115 |
% 默认为严格模式(\opt{strict}),即完全模仿材料包要求。 |
| 2116 |
% \end{function} |
| 2117 |
% |
| 2118 |
% 材料包中的 Word 空白模板仅有两行空白下划线。 |
| 2119 |
% 根据填写习惯的不同,模板预置了三种样式: |
| 2120 |
% \begin{itemize} |
| 2121 |
% \item \opt{strict},在两行空白下划线上左对齐填写标题。 |
| 2122 |
% 如果该标题不足一行,则第二行下划线留空; |
| 2123 |
% 如果长度超出两行,则向后延伸并抛出一个警告信息。 |
| 2124 |
% \item \opt{centered},将严格模式的左对齐改为居中。 |
| 2125 |
% \item \opt{natural},仅居中标题,不做行数检查。 |
| 2126 |
% 本模式更适合较短的题目。 |
| 2127 |
% \end{itemize} |
| 2128 |
% |
| 2129 |
% \subsubsection{前言页} |
| 2130 |
% |
| 2131 |
% \DescribeEnv{preface} |
| 2132 |
% 使用 \env{preface} 环境定义。 |
| 2133 |
% |
| 2134 |
% \begin{latexexample}[emph={[1]preface,flushright}] |
| 2135 |
% \begin{preface} |
| 2136 |
% 我的前言 |
| 2137 |
% \vspace{1cm} |
| 2138 |
% \begin{flushright} |
| 2139 |
% 我的名字\\ |
| 2140 |
% 时间地点 |
| 2141 |
% \end{flushright} |
| 2142 |
% \end{preface} |
| 2143 |
% \end{latexexample} |
| 2144 |
% |
| 2145 |
% |
| 2146 |
% \subsubsection{目录页} |
| 2147 |
% |
| 2148 |
% \begin{function}{\tableofcontents,\listoffigures,\listoftables} |
| 2149 |
% 分别生成目录、图片目录和表格目录。 |
| 2150 |
% \end{function} |
| 2151 |
% |
| 2152 |
% \begin{function}[added=2022-08-08]{tableofcontents/dotline} |
| 2153 |
% \begin{syntax} |
| 2154 |
% \OPT{dotline} = <chapter|(section)> |
| 2155 |
% \end{syntax} |
| 2156 |
% 目录中的引导线设置。选择 \opt{chapter} 会为章标题后添加引导线。 |
| 2157 |
% \end{function} |
| 2158 |
% |
| 2159 |
% \begin{function}[added=2022-02-04,updated=2022-07-31]{ |
| 2160 |
% tableofcontents/toc-entry,listoffigures/toc-entry, |
| 2161 |
% listoftables/toc-entry} |
| 2162 |
% \begin{syntax} |
| 2163 |
% \OPT{toc-entry} = <\TTF> |
| 2164 |
% \end{syntax} |
| 2165 |
% 是否在目录中显示目录自身的条目,默认开启。关闭后目录、 |
| 2166 |
% 插图目录和表格目录将不会出现在目录中,仅保留其 PDF 书签。 |
| 2167 |
% 注意,虽然名称一样,但这其实是对应三种目录的三个选项。 |
| 2168 |
% \end{function} |
| 2169 |
% |
| 2170 |
% 如果仅需要禁用插图目录和表格目录的条目,可以这样设置 |
| 2171 |
% \begin{latexexample}[moretexcs={\njusetup},emph={[3]toc-entry}, |
| 2172 |
% emph={[2]tableofcontents,listoffigures,listoftables}] |
| 2173 |
% \njusetup{ |
| 2174 |
% tableofcontents/toc-entry = true, % 仅作展示,无需手动启用 |
| 2175 |
% listoffigures/toc-entry = false, |
| 2176 |
% listoftables/toc-entry = false |
| 2177 |
% } |
| 2178 |
% \end{latexexample} |
| 2179 |
% |
| 2180 |
% 目录页的标题名称一般无需修改\footnote{尽管根据《学位论文编写规则》国家标准 |
| 2181 |
% \cite{gb-t-7713.1-2006},学位论文中理应使用“目次”这一名称来指代篇目的列表, |
| 2182 |
% 我们仍然建议遵从学校给出的范例。}。如有需求,请参考 \ref{subsubsec:edit-text} 节。 |
| 2183 |
% |
| 2184 |
% \subsubsection{符号表} |
| 2185 |
% |
| 2186 |
% \DescribeEnv{notation} |
| 2187 |
% \DescribeEnv{notation*} |
| 2188 |
% 符号表,或者称为术语表、缩略词对照表。带有星号的符号表环境不会插入目录。 |
| 2189 |
% \begin{syntax} |
| 2190 |
% \tn{begin}\{notation\}\oarg{说明宽度}\oarg{符号宽度} |
| 2191 |
% \quad\tn{item}\oarg{符号} \meta{说明} |
| 2192 |
% \tn{end}\{notation\} |
| 2193 |
% \end{syntax} |
| 2194 |
% |
| 2195 |
% |
| 2196 |
% \subsubsection{致谢页} |
| 2197 |
% |
| 2198 |
% \DescribeEnv{acknowledgement} |
| 2199 |
% 使用 \env{acknowledgement} 环境生成致谢页,附带有相应目录条目。 |
| 2200 |
% 在开启盲审模式时,仅显示该目录条目。 |
| 2201 |
% |
| 2202 |
% \begin{latexexample}[emph={[1]acknowledgement}] |
| 2203 |
% \begin{acknowledgement} |
| 2204 |
% 感谢NJU LUG |
| 2205 |
% \end{acknowledgement} |
| 2206 |
% \end{latexexample} |
| 2207 |
% |
| 2208 |
% |
| 2209 |
% \subsubsection{附录页} |
| 2210 |
% |
| 2211 |
% \begin{function}{\appendix} |
| 2212 |
% 附录放在本命令后,以英文字母进行编号,编写方式同正文。 |
| 2213 |
% \end{function} |
| 2214 |
% |
| 2215 |
% |
| 2216 |
% \subsubsection{成果列表} |
| 2217 |
% |
| 2218 |
% \begin{function}[added=2021-09-29,updated=2021-12-20]{\njupaperlist} |
| 2219 |
% \begin{syntax} |
| 2220 |
% \tn{njupaperlist}\oarg{标题}\marg{文献} |
| 2221 |
% \end{syntax} |
| 2222 |
% 成果列表,生成一个列举文献条目的无编号节。可选参数为标题, |
| 2223 |
% 默认为“发表文章目录”。\Arg{文献} 的填写方式同 \tn{cite}, |
| 2224 |
% 多个文献需要使用英文半角逗号隔开。 |
| 2225 |
% \end{function} |
| 2226 |
% |
| 2227 |
% 一个简单的例子如下所示: |
| 2228 |
% \begin{latexexample}[moretexcs={\njuchapter,\njupaperlist}] |
| 2229 |
% \njuchapter{攻读博士学位期间研究成果} |
| 2230 |
% \njupaperlist[攻读博士学位期间发表的学术论文]{ |
| 2231 |
% Nemec1997-209-214,Chiani1998-2998-3008,Chiani1998a} |
| 2232 |
% \end{latexexample} |
| 2233 |
% |
| 2234 |
% 为了便于识别,成果列表中默认对发表年份进行加粗处理。而对作者姓名的处理较为复杂。 |
| 2235 |
% 利用 \pkg{biblatex} 的数据注解机制可以实现对特定文献信息的样式修改 |
| 2236 |
% \footnote{\url{https://blog.csdn.net/xenonhu/article/details/120853247}}, |
| 2237 |
% 在此可以用来实现指定作者姓名的突出。经过注解后的一则参考文献条目如下所示: |
| 2238 |
% \begin{latexexample}[emph={[1]@inproceedings},emph={[2]author}] |
| 2239 |
% @inproceedings{Nemec1997-209-214, |
| 2240 |
% title = {Force control of redundant robots}, |
| 2241 |
% author = {B Nemec and Zhao, Mou Mou}, |
| 2242 |
% author+an = {2=thesisauthor}, |
| 2243 |
% booktitle = {Processings of Symposium on Robot Control}, |
| 2244 |
% shortbooktitle = {(PSRC)}, |
| 2245 |
% pages = {209-214}, |
| 2246 |
% country = {Nantes France}, |
| 2247 |
% year = {1997} |
| 2248 |
% } |
| 2249 |
% \end{latexexample} |
| 2250 |
% 其中 |author+an| 提供了注解的标记,格式为 \meta{序号}|=|\meta{标签}, |
| 2251 |
% 以上条目中即是将第二名作者加入了指定论文作者的注解。\tn{njupaperlist} |
| 2252 |
% 会识别 |thesisauthor| 标签,为其指代的作者姓名进行加粗下划线处理。 |
| 2253 |
% |
| 2254 |
% 除手动进行标记以外,以下也提供一种自动化处理办法。 |
| 2255 |
% 下载 \href{https://github.com/hushidong/biblatex-map}{bibmap} |
| 2256 |
% 全部文件后,修改主目录下的 \file{bibmapaddauthoran.py} 中 |fieldsource| |
| 2257 |
% 为需要匹配的姓名,将需要进行标记的 \file{.bib} 文件拷贝至本目录 |
| 2258 |
% (此处使用 \file{test.bib} 进行示范),运行以下命令生成的参考文献数据源 |
| 2259 |
% 即可被成果列表识别加粗。 |
| 2260 |
% |
| 2261 |
% \begin{shellexample}[morekeywords={python},deletekeywords={test}] |
| 2262 |
% python bibmap.py test.bib -m bibmapaddauthoran.py |
| 2263 |
% \end{shellexample} |
| 2264 |
% |
| 2265 |
% |
| 2266 |
% \subsection{额外定制} |
| 2267 |
% |
| 2268 |
% 在研究生院松散的规定下,本模板仅能提供一个大体适用的框架, |
| 2269 |
% 势必需要为用户修改留出空间。这一节将提供一些定制方法。 |
| 2270 |
% |
| 2271 |
% \subsubsection{固定文本} |
| 2272 |
% \label{subsubsec:edit-text} |
| 2273 |
% |
| 2274 |
% \begin{function}{\njusetname,\njusetname*,\njusettext,\njusettext*} |
| 2275 |
% \begin{syntax} |
| 2276 |
% \tn{njusetname}\marg{名称}\oarg{变体}\marg{内容} |
| 2277 |
% \tn{njusetname*}\marg{名称}\oarg{变体}\marg{内容} |
| 2278 |
% \tn{njusettext}\marg{名称}\oarg{变体}\marg{内容} |
| 2279 |
% \tn{njusettext*}\marg{名称}\oarg{变体}\marg{内容} |
| 2280 |
% \end{syntax} |
| 2281 |
% 修改固定文本内容,带星号的命令表示修改对应的英文字段。 |
| 2282 |
% 名称对应的默认内容可以参见 \ref{subsubsec:constant-name} 与 |
| 2283 |
% \ref{subsubsec:constant-text} 节。 |
| 2284 |
% \end{function} |
| 2285 |
% |
| 2286 |
% 譬如,修改目录标题名称,示例如下: |
| 2287 |
|
| 2288 |
% \begin{latexexample}[moretexcs={\njusetname}] |
| 2289 |
% \njusetname{listoffigures}{插图清单} |
| 2290 |
% \njusetname{listoftables}{表格清单} |
| 2291 |
% \end{latexexample} |
| 2292 |
% |
| 2293 |
% 将英文摘要页的小标题修改为仅首字母大写的样式,示例如下: |
| 2294 |
% |
| 2295 |
% \begin{latexexample}[moretexcs={\njusetname*}] |
| 2296 |
% \njusetname*{abstract}[b]{Abstract} |
| 2297 |
% \end{latexexample} |
| 2298 |
% |
| 2299 |
% \subsubsection{长度值} |
| 2300 |
% \label{subsubsec:modify-length} |
| 2301 |
% |
| 2302 |
% \begin{function}{\njusetlength,\njusetlength*} |
| 2303 |
% \begin{syntax} |
| 2304 |
% \tn{njusetlength}\marg{名称}\marg{长度} |
| 2305 |
% \tn{njusetlength*}\marg{名称}\marg{长度} |
| 2306 |
% \end{syntax} |
| 2307 |
% 修改长度值,默认为修改固定长度(|dim| 类型), |
| 2308 |
% 带星号的命令表示修改弹性长度(|skip| 类型,目前未涉及)。 |
| 2309 |
% 默认长度值可以参见 \ref{subsubsec:constant-length} 节。 |
| 2310 |
% \end{function} |
| 2311 |
% |
| 2312 |
% 譬如,将封面页填写个人信息的横线加长,示例如下: |
| 2313 |
% |
| 2314 |
% \begin{latexexample}[moretexcs={\njusetlength}] |
| 2315 |
% \njusetlength{crulewd}{330pt} |
| 2316 |
% \end{latexexample} |
| 2317 |
% |
| 2318 |
% \subsubsection{样式} |
| 2319 |
% \label{subsubsec:modify-format} |
| 2320 |
% |
| 2321 |
% \begin{function}{\njusetformat} |
| 2322 |
% \begin{syntax} |
| 2323 |
% \tn{njusetformat}\marg{名称}\marg{样式} |
| 2324 |
% \end{syntax} |
| 2325 |
% 修改样式。所有可以修改的默认样式参见 \ref{subsubsec:constant-format} 节。 |
| 2326 |
% \end{function} |
| 2327 |
% |
| 2328 |
% 譬如,将章标题字号加大到小二号,示例如下: |
| 2329 |
% |
| 2330 |
% \begin{latexexample}[moretexcs={\njusetformat,\zihao}] |
| 2331 |
% \njusetformat{chapter}{\zihao{-2}\sffamily\centering} |
| 2332 |
% \end{latexexample} |
| 2333 |
% |
| 2334 |
% 修改表格内容的字体: |
| 2335 |
% |
| 2336 |
% \begin{latexexample}[moretexcs={\njusetformat,\zihao,\bfseries}] |
| 2337 |
% \njusetformat{tabular}{\zihao{-4}\bfseries} |
| 2338 |
% \end{latexexample} |
| 2339 |
% |
| 2340 |
% |
| 2341 |
% \subsection{视觉识别系统} |
| 2342 |
% |
| 2343 |
% 视觉识别系统 \pkg{njuvisual} 现已被分离为独立宏包\cite{njuvisual}, |
| 2344 |
% 本模板并不会默认载入该宏包。 |
| 2345 |
% |
| 2346 |
% 基本使用方法举例如下: |
| 2347 |
% \begin{latexexample}[moretexcs={\njuemblem,\njuname,\njuname*}] |
| 2348 |
% \njuemblem{!}{3cm} % 生成高 3cm 的紫色校徽 |
| 2349 |
% \njuname{4cm}{!} % 生成宽 4cm 的紫色中文校名 |
| 2350 |
% \njuname*{4cm}{!} % 生成宽 4cm 的紫色英文校名 |
| 2351 |
% \njuemblem[black]{!}{3cm} % 黑色的校徽 |
| 2352 |
% \njuemblem[department=dii]{!}{4cm} % 紫色匡院徽标 |
| 2353 |
% \njuemblem[department=cs,color=blue]{!}{3cm} % 纯蓝色计科徽标 |
| 2354 |
% \end{latexexample} |
| 2355 |
% |
| 2356 |
% 本宏包的详细使用方法请参考其使用手册。 |
| 2357 |
% |
| 2358 |
% |
| 2359 |
% \section{宏包依赖} |
| 2360 |
% |
| 2361 |
% 在任何情况下,本模板都会\emph{显式}调用以下宏包(或文档类): |
| 2362 |
% \begin{itemize} |
| 2363 |
% \item \pkg{xtemplate} 和 \pkg{l3keys2e},用于扩展 \LaTeX3 编程环境。 |
| 2364 |
% 它们属于 \pkg{l3packages} 宏集。 |
| 2365 |
% \item \cls{ctexbook},提供中文排版的通用框架。属于 C\TeX |
| 2366 |
% 宏集 \cite{CTeX}。 |
| 2367 |
% \item \pkg{amsmath},对 \LaTeX{} 的数学排版功能进行了全面扩展。 |
| 2368 |
% 属于 \hologo{AmSLaTeX} 套件。 |
| 2369 |
% \item \pkg{geometry},用于调整页面尺寸。 |
| 2370 |
% \item \pkg{setspace},调整行距。 |
| 2371 |
% \item \pkg{fancyhdr},处理页眉页脚。 |
| 2372 |
% \item \pkg{graphicx},提供图形插入的接口。 |
| 2373 |
% \item \pkg{booktabs},绘制三线表。 |
| 2374 |
% \item \pkg{caption},用于设置题注。 |
| 2375 |
% \item \pkg{hyperref},提供交叉引用、超链接、电子书签等功能。 |
| 2376 |
% \end{itemize} |
| 2377 |
% |
| 2378 |
% 以下宏包可以在文档类选项中禁用: |
| 2379 |
% \begin{itemize} |
| 2380 |
% \item \pkg{ntheorem},提供定理类环境支持。 |
| 2381 |
% \item \pkg{unicode-math},负责处理 Unicode 编码的 OpenType 数学字体。 |
| 2382 |
% \item \pkg{footmisc},处理脚注。 |
| 2383 |
% \item \pkg{enumitem},调整列表环境。 |
| 2384 |
% \item \pkg{cleveref},用于自动生成引用标签。 |
| 2385 |
% \item \pkg{biblatex} 和 \pkg{biblatex-gb7714-2015},用于生成国标下的参考文献样式。 |
| 2386 |
% \end{itemize} |
| 2387 |
% |
| 2388 |
% 在开启某些选项时,本模板也会调用以下宏包: |
| 2389 |
% \begin{itemize} |
| 2390 |
% \item \pkg{fandol}、\pkg{tex-gyre}、\pkg{tex-gyre-math}、\pkg{xits} 等, |
| 2391 |
% 提供自由字体。 |
| 2392 |
% \item \pkg{emptypage},在双面模式下清空空白页的页眉、页脚和页码。 |
| 2393 |
% \item \pkg{circledtext} 和 \pkg{l3experimental},用于在 \opt{footnote/circled} |
| 2394 |
% 和 \opt{footnote/circled*} 选项下生成脚注圈码。 |
| 2395 |
% \item \pkg{pifont},用于在 \opt{footnote/pifont} 选项下生成脚注圈码。 |
| 2396 |
% \item \pkg{tikz} 和 \pkg{njuvisual},用于绘制封面的校名校徽。 |
| 2397 |
% \item \pkg{tabularray},用于绘制研究生的出版授权书信息表格。 |
| 2398 |
% \item \pkg{xeCJKfntef} 或 \pkg{lua-ul},用于在对应引擎下绘制下划线。 |
| 2399 |
% \end{itemize} |
| 2400 |
% |
| 2401 |
% 下列宏包会与本模板的默认配置产生冲突,或者不能发挥预期作用: |
| 2402 |
% \begin{itemize} |
| 2403 |
% \item \pkg{natbib} 和 \pkg{gbt7714} 等 \hologo{BibTeX} 相关的参考文献宏包。 |
| 2404 |
% \item \pkg{bm} 等使用传统数学字体配置方案的宏包。 |
| 2405 |
% \item \pkg{babel} 在直接使用时会覆盖默认的中文名称设置。 |
| 2406 |
% \item \pkg{microtype} 在 \XeTeX 和 \LuaTeX 下支持有限。 |
| 2407 |
% \end{itemize} |
| 2408 |
% |
| 2409 |
% |
| 2410 |
% \begin{thebibliography}{99} |
| 2411 |
% |
| 2412 |
% \newcommand\urlprefix{\newline\hspace*{\fill}} |
| 2413 |
% \let\OldUrl=\url |
| 2414 |
% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}} |
| 2415 |
% \newcommand\CTANurl[2][]{{^^A |
| 2416 |
% \small\textit{#1}~\href{http://mirror.ctan.org/#2}{\texttt{CTAN://#2}}}} |
| 2417 |
% |
| 2418 |
% \subsection*{书籍} |
| 2419 |
% |
| 2420 |
% \bibitem{lshort} |
| 2421 |
% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. |
| 2422 |
% \newblock \textit{The Not So Short Introduction to \hologo{LaTeXe}: Or \hologo{LaTeXe} in 139 minutes} [EB/OL]. |
| 2423 |
% \newblock version 6.4, |
| 2424 |
% \newblock (2021-03-09) |
| 2425 |
% \urlprefix\url{https://ctan.org/pkg/lshort-english} |
| 2426 |
% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf} |
| 2427 |
% |
| 2428 |
% \bibitem{lshort-zh-cn} |
| 2429 |
% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. |
| 2430 |
% \newblock \textit{一份(不太)简短的 \hologo{LaTeXe} 介绍: 或 111 分钟了解 \hologo{LaTeXe}} [EB/OL]. |
| 2431 |
% \newblock \CTeX{} 开发小组, 译. |
| 2432 |
% \newblock 原版版本 version 6.4, 中文版本 version 6.03, |
| 2433 |
% \newblock (2021-11-21) |
| 2434 |
% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn} |
| 2435 |
% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf} |
| 2436 |
% |
| 2437 |
% \bibitem{install-latex-guide-zh-cn} |
| 2438 |
% 王然. |
| 2439 |
% \newblock \textit{一份简短的关于 \LaTeX 安装的介绍} [EB/OL]. |
| 2440 |
% \newblock version 2022.10.1, |
| 2441 |
% \newblock (2022-10-01) |
| 2442 |
% \urlprefix\url{https://ctan.org/pkg/install-latex-guide-zh-cn} |
| 2443 |
% \urlprefix\CTANurl[文档:]{info/install-latex-guide-zh-cn/install-latex-guide-zh-cn.pdf} |
| 2444 |
% |
| 2445 |
% \bibitem{刘海洋2013latex入门} |
| 2446 |
% 刘海洋. |
| 2447 |
% \newblock \textit{\LaTeX 入门} [M]. |
| 2448 |
% \newblock 北京: 电子工业出版社, 2013 |
| 2449 |
% |
| 2450 |
% |
| 2451 |
% \subsection*{标准、规范} |
| 2452 |
% |
| 2453 |
% \bibitem{gb-3100-93} |
| 2454 |
% 全国信息与文献标准化技术委员会. |
| 2455 |
% \newblock \textit{国际单位制及其应用: GB 3100--93} [S]. |
| 2456 |
% \newblock 北京: 中国标准出版社, 1993 |
| 2457 |
% |
| 2458 |
% \bibitem{gb-3101-93} |
| 2459 |
% 全国信息与文献标准化技术委员会. |
| 2460 |
% \newblock \textit{有关量、单位和符号的一般原则: GB 3101--93} [S]. |
| 2461 |
% \newblock 北京: 中国标准出版社, 1993 |
| 2462 |
% |
| 2463 |
% \bibitem{gb-3102-93} |
| 2464 |
% 全国信息与文献标准化技术委员会. |
| 2465 |
% \newblock \textit{物理科学和技术中使用的数学符号: GB/T 3102--93} [S]. |
| 2466 |
% \newblock 北京: 中国标准出版社, 1993 |
| 2467 |
% |
| 2468 |
% \bibitem{gb-t-7408-2005} |
| 2469 |
% 全国信息与文献标准化技术委员会. |
| 2470 |
% \newblock \textit{数据元和交换格式\quad 信息交换~ 日期和时间表示法: GB/T 7408--2005} [S]. |
| 2471 |
% \newblock 北京: 中国标准出版社, 2005 |
| 2472 |
% |
| 2473 |
% \bibitem{gb-t-7713.1-2006} |
| 2474 |
% 全国信息与文献标准化技术委员会. |
| 2475 |
% \newblock \textit{学位论文编写规则: GB/T 7713.1--2006} [S]. |
| 2476 |
% \newblock 北京: 中国标准出版社, 2006 |
| 2477 |
% |
| 2478 |
% \bibitem{gb-t-7714-2015} |
| 2479 |
% 全国信息与文献标准化技术委员会. |
| 2480 |
% \newblock \textit{信息与文献\quad 参考文献著录规则: GB/T 7714--2015} [S]. |
| 2481 |
% \newblock 北京: 中国标准出版社, 2015 |
| 2482 |
% |
| 2483 |
% \bibitem{nju-bachelor-2026} |
| 2484 |
% 南京大学本科生院. |
| 2485 |
% \newblock \textit{关于启动南京大学2024届本科毕业论文(设计)工作的通知} [EB/OL]. |
| 2486 |
% \newblock (2025-12-26) |
| 2487 |
% \urlprefix\url{https://jw.nju.edu.cn/3f/59/c26263a802649/page.htm} |
| 2488 |
% |
| 2489 |
% \bibitem{nju-graduate-2026} |
| 2490 |
% 南京大学研究生院. |
| 2491 |
% \newblock \textit{关于开展2026年6月学位申请与审核工作的通知} [EB/OL]. |
| 2492 |
% \newblock (2026-04-29) |
| 2493 |
% \urlprefix\url{https://grawww.nju.edu.cn/af/bb/c905a831419/page.htm} |
| 2494 |
% |
| 2495 |
% \bibitem{nju-postdoc-2022} |
| 2496 |
% 南京大学人力资源处. |
| 2497 |
% \newblock \textit{博士后出站申请} [EB/OL]. |
| 2498 |
% \newblock (2022-07-27) |
| 2499 |
% \urlprefix\url{https://hr.nju.edu.cn/6334/list.htm} |
| 2500 |
% |
| 2501 |
% |
| 2502 |
% \subsection*{宏包} |
| 2503 |
% |
| 2504 |
% \bibitem{biblatex} |
| 2505 |
% \textsc{Lehman P}, \textsc{Wright J}, \textsc{Boruvka A}, \textsc{Kime P}. |
| 2506 |
% \newblock \textit{Sophisticated Bibliographies in \LaTeX} [EB/OL]. |
| 2507 |
% \newblock version 3.17, |
| 2508 |
% \newblock (2022-02-02) |
| 2509 |
% \urlprefix\url{https://ctan.org/pkg/biblatex} |
| 2510 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/biblatex/doc/biblatex.pdf} |
| 2511 |
% |
| 2512 |
% \bibitem{biblatex-gb7714-2015} |
| 2513 |
% 胡振震. |
| 2514 |
% \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL]. |
| 2515 |
% \newblock version 1.1j, |
| 2516 |
% \newblock (2022-08-29) |
| 2517 |
% \urlprefix\url{https://ctan.org/pkg/biblatex-gb7714-2015} |
| 2518 |
% \urlprefix\CTANurl[文档:]{biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf} |
| 2519 |
% |
| 2520 |
% \bibitem{CTeX} |
| 2521 |
% \textsc{CTEX.ORG}. |
| 2522 |
% \newblock \textit{\CTeX{} 宏集手册} [EB/OL]. |
| 2523 |
% \newblock version 2.5.8, |
| 2524 |
% \newblock (2021-12-12) |
| 2525 |
% \urlprefix\url{https://ctan.org/pkg/ctex} |
| 2526 |
% \urlprefix\CTANurl[文档及源代码:]{language/chinese/ctex/ctex.pdf} |
| 2527 |
% |
| 2528 |
% \bibitem{circledtext} |
| 2529 |
% 耿楠. |
| 2530 |
% \newblock \textit{Create circled text} [EB/OL]. |
| 2531 |
% \newblock version 1.1.0, |
| 2532 |
% \newblock (2022-04-28) |
| 2533 |
% \urlprefix\url{https://ctan.org/pkg/circledtext} |
| 2534 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/circledtext/circledtext.pdf} |
| 2535 |
% |
| 2536 |
% \bibitem{latexmk} |
| 2537 |
% \textsc{Collins J}. |
| 2538 |
% \newblock \textit{Fully automated \LaTeX document generation} [EB/OL]. |
| 2539 |
% \newblock version 4.76, |
| 2540 |
% \newblock (2021-11-20) |
| 2541 |
% \urlprefix\url{https://www.ctan.org/pkg/latexmk} |
| 2542 |
% \urlprefix\CTANurl[文档:]{support/latexmk/latexmk.pdf} |
| 2543 |
% |
| 2544 |
% \bibitem{listings} |
| 2545 |
% \textsc{Heinz C}, \textsc{Moses B}, \textsc{Hoffmann J}. |
| 2546 |
% \newblock \textit{Typeset source code listings using \LaTeX} [EB/OL]. |
| 2547 |
% \newblock version 1.8d, |
| 2548 |
% \newblock (2020-03-24) |
| 2549 |
% \urlprefix\url{https://www.ctan.org/pkg/listings} |
| 2550 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/listings/listings.pdf} |
| 2551 |
% |
| 2552 |
% \bibitem{njuvisual} |
| 2553 |
% \textsc{Xiong Y}. |
| 2554 |
% \newblock \textit{Display logos related to Nanjing University} [EB/OL]. |
| 2555 |
% \newblock version 0.2.1, |
| 2556 |
% \newblock (2022-01-09) |
| 2557 |
% \urlprefix\url{https://ctan.org/pkg/njuvisual} |
| 2558 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/njuvisual/njuvisual.pdf} |
| 2559 |
% |
| 2560 |
% \bibitem{pdfpages} |
| 2561 |
% \textsc{Matthias A}. |
| 2562 |
% \newblock \textit{Include PDF documents in \LaTeX} [EB/OL]. |
| 2563 |
% \newblock version 0.5v, |
| 2564 |
% \newblock (2022-05-22) |
| 2565 |
% \urlprefix\url{https://www.ctan.org/pkg/pdfpages} |
| 2566 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/pdfpages/pdfpages.pdf} |
| 2567 |
% |
| 2568 |
% \bibitem{siunitx} |
| 2569 |
% \textsc{Wright J}. |
| 2570 |
% \newblock \textit{A comprehensive (SI) units package} [EB/OL]. |
| 2571 |
% \newblock version 3.1.0, |
| 2572 |
% \newblock (2022-04-25) |
| 2573 |
% \urlprefix\url{https://www.ctan.org/pkg/siunitx} |
| 2574 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/siunitx/siunitx.pdf} |
| 2575 |
% |
| 2576 |
% \bibitem{tabularray} |
| 2577 |
% \textsc{Jianrui Lyu}. |
| 2578 |
% \newblock \textit{Typeset tabulars and arrays with \LaTeX3} [EB/OL]. |
| 2579 |
% \newblock version 2021Q, |
| 2580 |
% \newblock (2021-12-01) |
| 2581 |
% \urlprefix\url{https://ctan.org/pkg/tabularray} |
| 2582 |
% \urlprefix\CTANurl[文档:]{macros/latex/contrib/tabularray/tabularray.pdf} |
| 2583 |
% |
| 2584 |
% |
| 2585 |
% \subsection*{模板} |
| 2586 |
% |
| 2587 |
% \bibitem{fduthesis} |
| 2588 |
% 曾祥东. |
| 2589 |
% \newblock \textit{fduthesis: 复旦大学论文模板} [EB/OL]. |
| 2590 |
% \newblock version 0.7e, |
| 2591 |
% \newblock (2020-08-30) |
| 2592 |
% \urlprefix\url{https://ctan.org/pkg/fduthesis} |
| 2593 |
% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/fduthesis/fduthesis.pdf} |
| 2594 |
% |
| 2595 |
% \bibitem{thuthesis} |
| 2596 |
% 清华大学 TUNA 协会. |
| 2597 |
% \newblock \textit{\textsc{ThuThesis}:清华大学学位论文模板} [EB/OL]. |
| 2598 |
% \newblock version 7.2.3, |
| 2599 |
% \newblock (2021-05-31) |
| 2600 |
% \urlprefix\url{https://ctan.org/pkg/thuthesis} |
| 2601 |
% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/thuthesis/thuthesis.pdf} |
| 2602 |
% |
| 2603 |
% |
| 2604 |
% \emph{以下模版现已停止更新。} |
| 2605 |
% |
| 2606 |
% \bibitem{wenboyang2013} |
| 2607 |
% 杨文博. |
| 2608 |
% \newblock \textit{南京大学学位论文 \LaTeX 模板} [EB/OL]. |
| 2609 |
% \newblock (2018-06-23) |
| 2610 |
% \urlprefix\url{https://github.com/solrex/njuthesis} |
| 2611 |
% |
| 2612 |
% \bibitem{fireblue2013} |
| 2613 |
% \textsc{fireblue}. |
| 2614 |
% \newblock \textit{南京大学学位论文 \LaTeX 模板} [EB/OL]. |
| 2615 |
% \newblock (2013-04-13) |
| 2616 |
% \urlprefix\url{https://github.com/fireblue/NJUThesis} |
| 2617 |
% |
| 2618 |
% \bibitem{wenhai-zheng2013} |
| 2619 |
% \textsc{wenhai-zheng}. |
| 2620 |
% \newblock \textit{南京大学本科毕业论文 \LaTeX 模板} [EB/OL]. |
| 2621 |
% \newblock (2013-08-12) |
| 2622 |
% \urlprefix\url{https://github.com/wenhai-zheng/NJUThesis} |
| 2623 |
% |
| 2624 |
% \bibitem{zenglecao2013} |
| 2625 |
% 曹增乐. |
| 2626 |
% \newblock \textit{南京大学本科毕业论文(设计) \LaTeX 模板} [EB/OL]. |
| 2627 |
% \newblock (2019-06-26) |
| 2628 |
% \urlprefix\url{https://github.com/ZLCao/NJUBachelor} |
| 2629 |
% |
| 2630 |
% \bibitem{haixinghu2013} |
| 2631 |
% 胡海星. |
| 2632 |
% \newblock \textit{南京大学学位论文 \XeLaTeX 模板} [EB/OL]. |
| 2633 |
% \newblock (2018-08-08) |
| 2634 |
% \urlprefix\url{https://github.com/Haixing-Hu/nju-thesis} |
| 2635 |
% |
| 2636 |
% \bibitem{chuhengzhang2016} |
| 2637 |
% 张楚珩. |
| 2638 |
% \newblock \textit{南京大学本科生毕业论文 \LaTeX 模板} [EB/OL]. |
| 2639 |
% \newblock (2016-06-01) |
| 2640 |
% \urlprefix\url{https://github.com/zhangchuheng123/NJUThesis} |
| 2641 |
% |
| 2642 |
% \bibitem{yanyanjiang2017} |
| 2643 |
% 蒋炎岩. |
| 2644 |
% \newblock \textit{南京大学山寨 \hologo{LyX} 研究生毕业论文模板} [EB/OL]. |
| 2645 |
% \newblock (2019-01-16) |
| 2646 |
% \urlprefix\url{https://github.com/jiangyy/njuthesis} |
| 2647 |
% |
| 2648 |
% \bibitem{njuHan2018} |
| 2649 |
% \textsc{njuHan}. |
| 2650 |
% \newblock \textit{南京大学学位论文(本科/硕士/博士),毕业论文 \LaTeX 模板} [EB/OL]. |
| 2651 |
% \newblock (2021-06-15) |
| 2652 |
% \urlprefix\url{https://github.com/njuHan/njuthesis-nju-thesis-template} |
| 2653 |
% |
| 2654 |
% \bibitem{anyirao2018} |
| 2655 |
% 饶安逸. |
| 2656 |
% \newblock \textit{南京大学本科生毕业论文 \LaTeX 模板 2018 新版} [EB/OL]. |
| 2657 |
% \newblock (2018-06-24) |
| 2658 |
% \urlprefix\url{https://github.com/AnyiRao/NJUThesis2018} |
| 2659 |
% |
| 2660 |
% \bibitem{yichenzhao2021} |
| 2661 |
% 赵懿晨. |
| 2662 |
% \newblock \textit{南京大学本科生毕业论文 \LaTeX 模板(2021版)} [EB/OL]. |
| 2663 |
% \newblock (2021-09-23) |
| 2664 |
% \urlprefix\url{https://github.com/FengChendian/NJUThesis2021} |
| 2665 |
% |
| 2666 |
% |
| 2667 |
% \end{thebibliography} |
| 2668 |
% |
| 2669 |
% |
| 2670 |
% \end{documentation} |
| 2671 |
% \clearpage |
| 2672 |
% |
| 2673 |
% \begin{implementation} |
| 2674 |
% |
| 2675 |
% \section{代码实现} |
| 2676 |
% \changes{v0.10}{2021/09/26}{对代码实现部分进行了整理。} |
| 2677 |
% |
| 2678 |
% 本模板使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境, |
| 2679 |
% 并需调用 \pkg{l3packages} 中的相关宏包。 |
| 2680 |
% |
| 2681 |
% 以下代码中有一些形如\sgrd{class}的标记, 这是 \pkg{DocStrip} 中的 |
| 2682 |
% “guard”,用来选择性地提取文件。“|*|”和“|/|”分别表示该部分的开始和结 |
| 2683 |
% 束。不含“|*|”和“|/|”的 guard 出现在行号左侧,它们用来确定单独一行代 |
| 2684 |
% 码的归属。这些 guard 的颜色不一,用以明确分类关系。 |
| 2685 |
% |
| 2686 |
% 下文中,本科生模板配置对应\pgrd{u},用于生成 |
| 2687 |
% \file{njuthesis-undergraduate.def};研究生模板配置对应\pgrd{g}, |
| 2688 |
% 用于生成 \file{njuthesis-graduate.def};博士后模板配置对应\pgrd{p}, |
| 2689 |
% 用于生成 \file{njuthesis-postdoctoral.def}。 |
| 2690 |
% |
| 2691 |
% 另有若干包含 \textsf{@@} 的 guard,用以表示名空间(模块)。 |
| 2692 |
% 在删除注释生成格式文件时,源代码变量名称中的 \textsf{@@} 会被等号后的字段替换, |
| 2693 |
% 譬如在本模板主体部分中\grd{@@=nju}。 |
| 2694 |
% |
| 2695 |
% \subsection{准备} |
| 2696 |
% |
| 2697 |
% \begin{macrocode} |
| 2698 |
%<*class> |
| 2699 |
%<@@=nju> |
| 2700 |
% \end{macrocode} |
| 2701 |
% |
| 2702 |
% \changes{v0.11}{2021/10/23}{添加了若干环境检查与警告信息。} |
| 2703 |
% \changes{v0.12}{2021/12/03}{放宽对于 \pkg{l3packages} 的版本要求。} |
| 2704 |
% 检查 \LaTeX3 编程环境。 |
| 2705 |
% \begin{macrocode} |
| 2706 |
\RequirePackage { xtemplate, l3keys2e } |
| 2707 |
\msg_new:nnn { njuthesis } { l3-too-old } |
| 2708 |
{ |
| 2709 |
Package~ "#1"~ is~ too~ old. \\ |
| 2710 |
Please~ update~ an~ up-to-date~ version~ of~ the~ |
| 2711 |
bundles~ "l3kernel"~ and~ "l3packages"~ using~ |
| 2712 |
your~ TeX~ package~ manager~ or~ from~ CTAN. |
| 2713 |
} |
| 2714 |
\clist_map_inline:nn { xtemplate, l3keys2e } |
| 2715 |
{ |
| 2716 |
\@ifpackagelater {#1} { 2020/10/01 } |
| 2717 |
{ } { \msg_error:nnn { njuthesis } { l3-too-old } {#1} } |
| 2718 |
} |
| 2719 |
% \end{macrocode} |
| 2720 |
% |
| 2721 |
% \changes{v1.3}{2023/11/14}{兼容新版 \LaTeX3 的 |e| 型展开变化。} |
| 2722 |
% 兼容新版 L3 特性。另见 \url{https://github.com/CTeX-org/ctex-kit/pull/678}。 |
| 2723 |
% \begin{macrocode} |
| 2724 |
\@ifpackagelater { expl3 } { 2023/10/10 } { } |
| 2725 |
{ |
| 2726 |
\cs_generate_variant:Nn \tl_set:Nn { Ne } |
| 2727 |
\cs_generate_variant:Nn \tl_gset:Nn { Ne } |
| 2728 |
\cs_generate_variant:Nn \tl_const:Nn { Ne } |
| 2729 |
\cs_generate_variant:Nn \tl_gput_right:Nn { Ne } |
| 2730 |
} |
| 2731 |
% \end{macrocode} |
| 2732 |
% |
| 2733 |
% 目前 \cls{njuthesis} 仅支持 \XeTeX 和 \LuaTeX。 |
| 2734 |
% \begin{macrocode} |
| 2735 |
\msg_new:nnn { njuthesis } { unsupported-engine } |
| 2736 |
{ |
| 2737 |
The~ njuthesis~ class~ requires~ either~ |
| 2738 |
XeTeX~ or~ LuaTeX. \\ |
| 2739 |
"#1"~ is~ not~ supported~ at~ present.~ |
| 2740 |
You~ must~ change~ your~ typesetting~ engine~ |
| 2741 |
to~ "xelatex"~ or~ "lualatex". |
| 2742 |
} |
| 2743 |
\bool_lazy_or:nnF |
| 2744 |
{ \sys_if_engine_xetex_p: } |
| 2745 |
{ \sys_if_engine_luatex_p: } |
| 2746 |
{ \msg_fatal:nne { njuthesis } { unsupported-engine } { \c_sys_engine_str } } |
| 2747 |
% \end{macrocode} |
| 2748 |
% |
| 2749 |
% |
| 2750 |
% \subsection{定义变量} |
| 2751 |
% |
| 2752 |
% 本模板的变量名称通式为 \cs[no-index]{\meta{作用域}_@@_\meta{族}_\meta{描述}_\meta{类型}} |
| 2753 |
% (出现在源代码中)或 \cs[no-index,replace=false]{\meta{作用域}_@@_\meta{族}_\meta{描述}_\meta{类型}} |
| 2754 |
% (出现在文档中)。作用域为单个字母,|l| 代表局部变量,|g| 代表全局变量,|c| 代表常 |
| 2755 |
% 量。最后一个下划线后的内容指示其类型,但引擎不会根据名称检查变量类型。 |
| 2756 |
% |
| 2757 |
% \begin{variable}{ |
| 2758 |
% \l_@@_tmpa_box,\l_@@_tmpb_box,\g_@@_tmpc_box,\l_@@_tmp_clist, |
| 2759 |
% \l_@@_tmpa_dim,\l_@@_tmpb_dim,\l_@@_tmpa_int,\l_@@_tmpb_int, |
| 2760 |
% \l_@@_tmp_skip,\l_@@_tmpa_tl,\l_@@_tmpb_tl} |
| 2761 |
% 临时变量。 |
| 2762 |
% \begin{macrocode} |
| 2763 |
\box_new:N \l_@@_tmpa_box |
| 2764 |
\box_new:N \l_@@_tmpb_box |
| 2765 |
\box_new:N \g_@@_tmpc_box |
| 2766 |
\clist_new:N \l_@@_tmp_clist |
| 2767 |
\dim_new:N \l_@@_tmpa_dim |
| 2768 |
\dim_new:N \l_@@_tmpb_dim |
| 2769 |
\int_new:N \l_@@_tmpa_int |
| 2770 |
\int_new:N \l_@@_tmpb_int |
| 2771 |
\skip_new:N \l_@@_tmp_skip |
| 2772 |
\tl_new:N \l_@@_tmpa_tl |
| 2773 |
\tl_new:N \l_@@_tmpb_tl |
| 2774 |
% \end{macrocode} |
| 2775 |
% \end{variable} |
| 2776 |
% |
| 2777 |
% \begin{variable}{\g_@@_info_type_int} |
| 2778 |
% 用于存储论文类型的变量。 |
| 2779 |
% \begin{macrocode} |
| 2780 |
\int_new:N \g_@@_info_type_int |
| 2781 |
% \end{macrocode} |
| 2782 |
% \end{variable} |
| 2783 |
% |
| 2784 |
% \begin{variable}{\g_@@_opt_academic_bool} |
| 2785 |
% 用于判断学术型或专业型学位的变量。 |
| 2786 |
% \begin{macrocode} |
| 2787 |
\bool_new:N \g_@@_opt_academic_bool |
| 2788 |
% \end{macrocode} |
| 2789 |
% \end{variable} |
| 2790 |
% |
| 2791 |
% \begin{variable}{\g_@@_opt_draft_bool} |
| 2792 |
% 用于判断草稿模式的变量。 |
| 2793 |
% \begin{macrocode} |
| 2794 |
\bool_new:N \g_@@_opt_draft_bool |
| 2795 |
\bool_gset_false:N \g_@@_opt_draft_bool |
| 2796 |
% \end{macrocode} |
| 2797 |
% \end{variable} |
| 2798 |
% |
| 2799 |
% \begin{variable}{\g_@@_opt_supvii_bool} |
| 2800 |
% 定义用于判断是否有第二导师的变量。 |
| 2801 |
% \begin{macrocode} |
| 2802 |
\bool_new:N \g_@@_opt_supvii_bool |
| 2803 |
% \end{macrocode} |
| 2804 |
% \end{variable} |
| 2805 |
% |
| 2806 |
% \begin{variable}{ |
| 2807 |
% \g_@@_info_supvfull_tl, |
| 2808 |
% \g_@@_info_supvfull_en_tl} |
| 2809 |
% 用于存储导师姓名加职称的变量。 |
| 2810 |
% \begin{macrocode} |
| 2811 |
\tl_new:N \g_@@_info_supvfull_tl |
| 2812 |
\tl_new:N \g_@@_info_supvfull_en_tl |
| 2813 |
% \end{macrocode} |
| 2814 |
% \end{variable} |
| 2815 |
% |
| 2816 |
% \begin{variable}{ |
| 2817 |
% \g_@@_info_major_tl, |
| 2818 |
% \g_@@_info_majorc_tl} |
| 2819 |
% 用于存储专业名称的变量。 |
| 2820 |
% \begin{macrocode} |
| 2821 |
\tl_new:N \g_@@_info_major_tl |
| 2822 |
\tl_new:N \g_@@_info_majorc_tl |
| 2823 |
% \end{macrocode} |
| 2824 |
% \end{variable} |
| 2825 |
% |
| 2826 |
% \begin{variable}{ |
| 2827 |
% \g_@@_font_set_tl, |
| 2828 |
% \g_@@_font_latin_tl, |
| 2829 |
% \g_@@_font_cjk_tl, |
| 2830 |
% \g_@@_font_math_tl} |
| 2831 |
% 存储所使用字体名称的全局变量。 |
| 2832 |
% \begin{macrocode} |
| 2833 |
\tl_new:N \g_@@_font_set_tl |
| 2834 |
\tl_new:N \g_@@_font_latin_tl |
| 2835 |
\tl_new:N \g_@@_font_cjk_tl |
| 2836 |
\tl_new:N \g_@@_font_math_tl |
| 2837 |
% \end{macrocode} |
| 2838 |
% \end{variable} |
| 2839 |
% |
| 2840 |
% \begin{variable}{\g_@@_font_path_tl} |
| 2841 |
% 存储字体路径的全局变量。 |
| 2842 |
% \begin{macrocode} |
| 2843 |
\tl_new:N \g_@@_font_path_tl |
| 2844 |
% \end{macrocode} |
| 2845 |
% \end{variable} |
| 2846 |
% |
| 2847 |
% \begin{variable}{\g_@@_font_path_bool} |
| 2848 |
% 是否使用独立的字体文件。 |
| 2849 |
% \begin{macrocode} |
| 2850 |
\bool_new:N \g_@@_font_path_bool |
| 2851 |
% \end{macrocode} |
| 2852 |
% \end{variable} |
| 2853 |
% |
| 2854 |
% \begin{variable}{\g_@@_config_tl} |
| 2855 |
% 保存配置文件名称。默认为空。 |
| 2856 |
% \begin{macrocode} |
| 2857 |
\tl_new:N \g_@@_config_tl |
| 2858 |
% \end{macrocode} |
| 2859 |
% \end{variable} |
| 2860 |
% |
| 2861 |
% \begin{variable}{\g_@@_keys_excl_clist} |
| 2862 |
% 保存需要屏蔽的键分组名称。 |
| 2863 |
% \begin{macrocode} |
| 2864 |
\clist_new:N \g_@@_keys_excl_clist |
| 2865 |
% \end{macrocode} |
| 2866 |
% \end{variable} |
| 2867 |
% |
| 2868 |
% \begin{variable}{\g_@@_uline_count_int} |
| 2869 |
% 保存下划线计数。 |
| 2870 |
% \begin{macrocode} |
| 2871 |
\int_new:N \g_@@_uline_count_int |
| 2872 |
% \end{macrocode} |
| 2873 |
% \end{variable} |
| 2874 |
% |
| 2875 |
% \begin{variable}{\c_@@_name_today_tl} |
| 2876 |
% 编译当天日期,格式为 |yyyy-mm-dd|。 |
| 2877 |
% \begin{macrocode} |
| 2878 |
\tl_const:Ne \c_@@_name_today_tl |
| 2879 |
{ |
| 2880 |
\int_to_arabic:n { \c_sys_year_int } - |
| 2881 |
\int_to_arabic:n { \c_sys_month_int } - |
| 2882 |
\int_to_arabic:n { \c_sys_day_int } |
| 2883 |
} |
| 2884 |
% \end{macrocode} |
| 2885 |
% \end{variable} |
| 2886 |
% |
| 2887 |
% \begin{variable}{\g_@@_prevdepth_dim} |
| 2888 |
% 用于存储临时的 \tn{prevdepth}。 |
| 2889 |
% \begin{macrocode} |
| 2890 |
\dim_new:N \g_@@_prevdepth_dim |
| 2891 |
% \end{macrocode} |
| 2892 |
% \end{variable} |
| 2893 |
% |
| 2894 |
% \begin{variable}{\c_@@_name_type_clist,\c_@@_name_type_en_clist} |
| 2895 |
% 论文类型与学位类型。 |
| 2896 |
% \begin{macrocode} |
| 2897 |
\clist_const:Nn \c_@@_name_type_clist |
| 2898 |
{ 学士, 硕士, 博士 } |
| 2899 |
\clist_const:Nn \c_@@_name_type_en_clist |
| 2900 |
{ Bachelor, Master, Doctor~of~Philosophy } |
| 2901 |
% \end{macrocode} |
| 2902 |
% \end{variable} |
| 2903 |
% |
| 2904 |
% \begin{variable}{\c_@@_name_month_en_clist} |
| 2905 |
% 英文月份名称。 |
| 2906 |
% \begin{macrocode} |
| 2907 |
\clist_const:Nn \c_@@_name_month_en_clist |
| 2908 |
{ |
| 2909 |
January, February, March, April, May, June, |
| 2910 |
July, August, September, October, November, December |
| 2911 |
} |
| 2912 |
% \end{macrocode} |
| 2913 |
% \end{variable} |
| 2914 |
% |
| 2915 |
% \changes{v1.1}{2023/03/07}{盲审模式下隐藏年级和学校名称。} |
| 2916 |
% \begin{variable}{\c_@@_name_anon_clist,\c_@@_name_anon_en_clist} |
| 2917 |
% 盲审模式下不显示的个人信息键名。 |
| 2918 |
% \begin{macrocode} |
| 2919 |
\clist_const:Nn \c_@@_name_anon_clist |
| 2920 |
{ |
| 2921 |
author, chairman, email, student-id, reviewer, |
| 2922 |
supervisor-contact, supervisor, supervisor-ii |
| 2923 |
} |
| 2924 |
\clist_const:Nn \c_@@_name_anon_en_clist |
| 2925 |
{ author, supervisor, supervisor-ii } |
| 2926 |
% \end{macrocode} |
| 2927 |
% \end{variable} |
| 2928 |
% |
| 2929 |
% |
| 2930 |
% \subsection{内部函数} |
| 2931 |
% |
| 2932 |
% \begin{macro}{\@@_null:} |
| 2933 |
% 等价于 \LaTeXe{} 中的 \tn{null}。 |
| 2934 |
% \begin{macrocode} |
| 2935 |
\cs_new:Nn \@@_null: { \hbox:n { } } |
| 2936 |
% \end{macrocode} |
| 2937 |
% \end{macro} |
| 2938 |
% |
| 2939 |
% \begin{macro}{\@@_space:,\@@_quad:,\@@_qquad:} |
| 2940 |
% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。 |
| 2941 |
% \begin{macrocode} |
| 2942 |
\cs_new:Nn \@@_space: { \skip_horizontal:n { .5 em } } |
| 2943 |
\cs_new:Nn \@@_quad: { \skip_horizontal:n { 1 em } } |
| 2944 |
% \cs_new:Nn \@@_qquad: { \skip_horizontal:n { 2 em } } |
| 2945 |
% \end{macrocode} |
| 2946 |
% \end{macro} |
| 2947 |
% |
| 2948 |
% \begin{macro}{\@@_vskip:,\@@_hskip:} |
| 2949 |
% 生成一个较小的 skip。 |
| 2950 |
% \begin{macrocode} |
| 2951 |
\cs_new:Nn \@@_vskip: { \skip_vertical:N \l_@@_vsep_dim } |
| 2952 |
\cs_new:Nn \@@_hskip: { \skip_horizontal:N \l_@@_hsep_dim } |
| 2953 |
% \end{macrocode} |
| 2954 |
% \end{macro} |
| 2955 |
% |
| 2956 |
% \begin{macro}{\@@_vskip:N} |
| 2957 |
% 类似于 \LaTeXe 中的 \tn{vspace*} |
| 2958 |
% \footnote{\url{https://tex.stackexchange.com/a/30065/251992}}, |
| 2959 |
% 从上一个页面元素底部开始生成 |skip|。 |
| 2960 |
% \begin{macrocode} |
| 2961 |
\cs_set_protected:Npn \@@_vskip:N #1 |
| 2962 |
{ |
| 2963 |
\tex_hrule:D \@height \c_zero_dim \scan_stop: |
| 2964 |
\tex_penalty:D \@M |
| 2965 |
\skip_vertical:N #1 |
| 2966 |
\skip_vertical:N \c_zero_dim |
| 2967 |
} |
| 2968 |
% \end{macrocode} |
| 2969 |
% \end{macro} |
| 2970 |
% |
| 2971 |
% \begin{macro}{\@@_define_name:nn,\@@_define_name:nnn} |
| 2972 |
% 用来定义默认名称的辅助函数。 |
| 2973 |
% \begin{macrocode} |
| 2974 |
\cs_new:Npn \@@_define_name:nn #1 |
| 2975 |
{ |
| 2976 |
\tl_new:c { l_@@_name_ #1 _tl } |
| 2977 |
\tl_set:cn { l_@@_name_ #1 _tl } |
| 2978 |
} |
| 2979 |
\cs_new:Npn \@@_define_name:nnn #1#2#3 |
| 2980 |
{ |
| 2981 |
\@@_define_name:nn { #1 } {#2} |
| 2982 |
\@@_define_name:nn { #1 _en } {#3} |
| 2983 |
} |
| 2984 |
% \end{macrocode} |
| 2985 |
% \end{macro} |
| 2986 |
% |
| 2987 |
% \begin{macro}{\@@_define_fmt:nn} |
| 2988 |
% 用来定义默认样式的辅助函数。 |
| 2989 |
% \begin{macrocode} |
| 2990 |
\cs_new:Npn \@@_define_fmt:nn #1 |
| 2991 |
{ |
| 2992 |
\tl_new:c { l_@@_fmt_ #1 _tl } |
| 2993 |
\tl_set:cn { l_@@_fmt_ #1 _tl } |
| 2994 |
} |
| 2995 |
% \end{macrocode} |
| 2996 |
% \end{macro} |
| 2997 |
% |
| 2998 |
% \begin{macro}{\@@_define_dim:nn,\@@_define_skip:nn} |
| 2999 |
% 用来定义默认间距的辅助函数。 |
| 3000 |
% \begin{macrocode} |
| 3001 |
\cs_new:Npn \@@_define_dim:nn #1 |
| 3002 |
{ |
| 3003 |
\dim_new:c { l_@@_ #1 _dim } |
| 3004 |
\dim_set:cn { l_@@_ #1 _dim } |
| 3005 |
} |
| 3006 |
\cs_new:Npn \@@_define_skip:nn #1 |
| 3007 |
{ |
| 3008 |
\skip_new:c { l_@@_ #1 _skip } |
| 3009 |
\skip_set:cn { l_@@_ #1 _skip } |
| 3010 |
} |
| 3011 |
% \end{macrocode} |
| 3012 |
% \end{macro} |
| 3013 |
% |
| 3014 |
% \begin{macro}{\@@_info:n,\@@_name:n,\@@_fmt:n} |
| 3015 |
% 根据变量名调用名称、内容或格式信息。 |
| 3016 |
% \begin{macrocode} |
| 3017 |
\cs_new:Npn \@@_info:n #1 { \tl_use:c { g_@@_info_ #1 _tl } } |
| 3018 |
\cs_new:Npn \@@_name:n #1 { \tl_use:c { l_@@_name_ #1 _tl } } |
| 3019 |
\cs_new:Npn \@@_fmt:n #1 { \tl_use:c { l_@@_fmt_ #1 _tl } } |
| 3020 |
% \end{macrocode} |
| 3021 |
% \end{macro} |
| 3022 |
% |
| 3023 |
% \begin{macro}{\@@_name:nn} |
| 3024 |
% 根据变量名调用名称信息,可调整字符格式 |
| 3025 |
% \begin{macrocode} |
| 3026 |
\cs_new:Npn \@@_name:nn #1#2 |
| 3027 |
{ \group_begin: \@@_fmt:n {#1} \@@_name:n {#2} \group_end: } |
| 3028 |
% \end{macrocode} |
| 3029 |
% \end{macro} |
| 3030 |
% |
| 3031 |
% \begin{macro}{\@@_fontsize:nn,\@@_fontsize:nnn} |
| 3032 |
% 用于设置字号的辅助函数。\pkg{ctex} 默认使用的行距倍数是 1.2,我们在这里重新计算 |
| 3033 |
% \tn{baselineskip},抛弃 \cs{l__ctex_font_size_tl} 中的第二个值。 |
| 3034 |
% \begin{macrocode} |
| 3035 |
\cs_new:Npn \@@_fontsize:nn #1#2 |
| 3036 |
{ \fontsize {#1} {#2} \selectfont } |
| 3037 |
\cs_new:Npn \@@_fontsize:nnn #1#2#3 |
| 3038 |
{ \@@_fontsize:nn {#1} { \fp_to_decimal:n { #3 * #1 } } } |
| 3039 |
% \end{macrocode} |
| 3040 |
% \end{macro} |
| 3041 |
% |
| 3042 |
% \begin{macro}{\@@_zihao:nn,\@@_zihao:n} |
| 3043 |
% 设置字号,类似于 \cs{ctex_zihao:n}。 |
| 3044 |
% \begin{arguments} |
| 3045 |
% \item 行距倍数 |
| 3046 |
% \item 字号值,同 \tn{zihao} |
| 3047 |
% \end{arguments} |
| 3048 |
% \begin{macrocode} |
| 3049 |
\cs_new:Npn \@@_zihao:nn #1#2 |
| 3050 |
{ |
| 3051 |
\prop_get:NnNTF \c__ctex_font_size_prop {#2} \l__ctex_font_size_tl |
| 3052 |
{ \exp_after:wN \@@_fontsize:nnn \l__ctex_font_size_tl {#1} } |
| 3053 |
{ \msg_error:nnn { ctex } { fontsize } {#2} } |
| 3054 |
} |
| 3055 |
% \end{macrocode} |
| 3056 |
% 默认行距倍数为 1.3。 |
| 3057 |
% \begin{macrocode} |
| 3058 |
\cs_new:Npn \@@_zihao:n { \@@_zihao:nn { 1.3 } } |
| 3059 |
% \end{macrocode} |
| 3060 |
% \end{macro} |
| 3061 |
% |
| 3062 |
% \begin{macro}{\cs_new:Npo} |
| 3063 |
% \begin{macro}{\@@_set_ccglue:n} |
| 3064 |
% 调整间距。由于涉及载入 \cls{ctexbook} 后才能生效的 \pkg{xeCJK} 或 \pkg{luatexja} |
| 3065 |
% 的内部命令,我们只展开一次完成引擎判断,而不用 |x| 型全部展开。 |
| 3066 |
% \begin{macrocode} |
| 3067 |
\cs_generate_variant:Nn \cs_new:Npn { Npo } |
| 3068 |
\cs_new:Npo \@@_set_ccglue:n #1 |
| 3069 |
{ |
| 3070 |
\sys_if_engine_xetex:TF |
| 3071 |
{ \skip_set:Nn \l__ctex_ccglue_skip {#1} } |
| 3072 |
{ \ltjsetparameter { kanjiskip = {#1} } } |
| 3073 |
} |
| 3074 |
% \end{macrocode} |
| 3075 |
% \end{macro} |
| 3076 |
% \end{macro} |
| 3077 |
% |
| 3078 |
% \begin{macro}{\@@_vbox_center:n} |
| 3079 |
% \changes{v1.5.0}{2026/05/15}{提供 \cs{vbox_center:n} 的向前兼容。} |
| 3080 |
% \pkg{l3box} 在 2026-02-17 提供了垂直居中盒子接口。为了兼容 |
| 3081 |
% \TeX Live 2026 之前的版本,这里提供一个内部封装。 |
| 3082 |
% \begin{arguments} |
| 3083 |
% \item 盒子内容 |
| 3084 |
% \end{arguments} |
| 3085 |
% \begin{macrocode} |
| 3086 |
\cs_if_exist:NTF \vbox_center:n |
| 3087 |
{ \cs_new_eq:NN \@@_vbox_center:n \vbox_center:n } |
| 3088 |
{ |
| 3089 |
\box_new:N \l_@@_vbox_center_box |
| 3090 |
\dim_new:N \l_@@_vbox_center_delta_dim |
| 3091 |
\cs_new_protected:Npn \@@_vbox_center:n #1 |
| 3092 |
{ |
| 3093 |
\vbox_set:Nn \l_@@_vbox_center_box {#1} |
| 3094 |
\dim_set:Nn \l_@@_vbox_center_delta_dim |
| 3095 |
{ |
| 3096 |
\box_ht:N \l_@@_vbox_center_box |
| 3097 |
+ \box_dp:N \l_@@_vbox_center_box |
| 3098 |
} |
| 3099 |
\box_set_ht:Nn \l_@@_vbox_center_box |
| 3100 |
{ |
| 3101 |
( |
| 3102 |
\tex_ifodd:D \l_@@_vbox_center_delta_dim |
| 3103 |
1 sp + |
| 3104 |
\tex_fi:D |
| 3105 |
\l_@@_vbox_center_delta_dim |
| 3106 |
) / 2 |
| 3107 |
} |
| 3108 |
\box_set_dp:Nn \l_@@_vbox_center_box |
| 3109 |
{ |
| 3110 |
\l_@@_vbox_center_delta_dim |
| 3111 |
- \box_ht:N \l_@@_vbox_center_box |
| 3112 |
} |
| 3113 |
\box_use_drop:N \l_@@_vbox_center_box |
| 3114 |
} |
| 3115 |
} |
| 3116 |
% \end{macrocode} |
| 3117 |
% \end{macro} |
| 3118 |
% |
| 3119 |
% \begin{macro}{\@@_box_underline:Nnn} |
| 3120 |
% \changes{v1.5.0}{2026/04/07}{提供 \cs{box_underline:Nnn} 的向前兼容。} |
| 3121 |
% \pkg{l3box} 在 2023-03-16 提供了新的下划线接口,这里做一个简单的向前兼容。 |
| 3122 |
% 官方接口的实现方法是:保留原始盒子的基线,将其包装为 \tn{hbox} 并仅向下方追加深度。 |
| 3123 |
% \begin{arguments} |
| 3124 |
% \item 存放内容的盒子变量 |
| 3125 |
% \item 下划线与盒子底边的距离,|dim| 型变量 |
| 3126 |
% \item 下划线的粗细,|dim| 型变量 |
| 3127 |
% \end{arguments} |
| 3128 |
% \begin{macrocode} |
| 3129 |
\cs_if_exist:NTF \box_underline:Nnn |
| 3130 |
{ \cs_new_eq:NN \@@_box_underline:Nnn \box_underline:Nnn } |
| 3131 |
{ |
| 3132 |
\cs_new_protected:Npn \@@_box_underline:Nnn #1#2#3 |
| 3133 |
{ |
| 3134 |
\hbox_set:Nn #1 |
| 3135 |
{ |
| 3136 |
\vbox_top:n |
| 3137 |
{ |
| 3138 |
\box_use_drop:N #1 |
| 3139 |
\tex_kern:D \dim_eval:n {#2} |
| 3140 |
\tex_hrule:D height \dim_eval:n {#3} depth \c_zero_dim \scan_stop: |
| 3141 |
} |
| 3142 |
} |
| 3143 |
} |
| 3144 |
} |
| 3145 |
% \end{macrocode} |
| 3146 |
% \end{macro} |
| 3147 |
% |
| 3148 |
% \begin{macro}{\@@_box_underline:N} |
| 3149 |
% 基于模板全局设定的下划线参数进行封装。 |
| 3150 |
% |
| 3151 |
% \pkg{l3box} 提供的 \cs{box_underline:Nnn} 接口默认以盒子底边 |
| 3152 |
% 为基准点计算分离距离。为了与旧版 \cs{@@_box_ulined:NN} 保持一致的视觉效果, |
| 3153 |
% 分离距离动态计算为:目标基线偏移量减去当前行的实际深度。 |
| 3154 |
% \begin{macrocode} |
| 3155 |
\cs_new_protected:Npn \@@_box_underline:N #1 |
| 3156 |
{ |
| 3157 |
\@@_box_underline:Nnn #1 |
| 3158 |
{ - \l_@@_ruledpi_dim - \l_@@_rulehti_dim - \box_dp:N #1 } |
| 3159 |
{ \l_@@_rulehti_dim } |
| 3160 |
} |
| 3161 |
% \end{macrocode} |
| 3162 |
% \end{macro} |
| 3163 |
% |
| 3164 |
% \begin{macro}{\@@_box_ulined:NN,\@@_box_ulined:Nc} |
| 3165 |
% 生成指定宽度、内容居中且带有下划线的水平盒子。 |
| 3166 |
% 这里统一使用模板提供的下划线盒子接口。 |
| 3167 |
% \begin{arguments} |
| 3168 |
% \item 宽度,|dim| 型变量 |
| 3169 |
% \item 内容,可带有格式 |
| 3170 |
% \end{arguments} |
| 3171 |
% \begin{macrocode} |
| 3172 |
\cs_new_protected:Npn \@@_box_ulined:NN #1#2 |
| 3173 |
{ |
| 3174 |
\mode_leave_vertical: |
| 3175 |
\hbox_set_to_wd:Nnn \l_@@_tmpa_box {#1} |
| 3176 |
{ \tex_hfil:D #2 \tex_hfil:D } |
| 3177 |
\@@_box_underline:N \l_@@_tmpa_box |
| 3178 |
\box_use_drop:N \l_@@_tmpa_box |
| 3179 |
} |
| 3180 |
\cs_generate_variant:Nn \@@_box_ulined:NN { Nc } |
| 3181 |
% \end{macrocode} |
| 3182 |
% \end{macro} |
| 3183 |
% |
| 3184 |
% \begin{macro}{\@@_box_ulined_info:Nn} |
| 3185 |
% 以上盒子只用来打印 \cs[no-index]{g_@@_info_\meta{描述}_tl} 变量。 |
| 3186 |
% \begin{macrocode} |
| 3187 |
\cs_new_protected:Npn \@@_box_ulined_info:Nn #1#2 |
| 3188 |
{ \@@_box_ulined:Nc #1 { g_@@_info_ #2 _tl } } |
| 3189 |
% \end{macrocode} |
| 3190 |
% \end{macro} |
| 3191 |
% |
| 3192 |
% \begin{macro}{\@@_box_spread:NNNn} |
| 3193 |
% \changes{v0.19}{2022/05/16}{对超出盒子宽度的文字进行水平压缩。} |
| 3194 |
% 分散对齐的水平盒子,拉伸算法来自 \cls{fduthesis}。 |
| 3195 |
% 在文字宽度小于给定宽度时,在字符中间填补 \tn{hfil} 以增大字距。 |
| 3196 |
% 在文字宽度超出限制时,进行整体水平压缩。 |
| 3197 |
% \begin{arguments} |
| 3198 |
% \item 临时 |dim| 型变量 |
| 3199 |
% \item 宽度,|dim| 型变量 |
| 3200 |
% \item 格式 |
| 3201 |
% \item 内容,不可带有格式 |
| 3202 |
% \end{arguments} |
| 3203 |
% \begin{macrocode} |
| 3204 |
\cs_new_protected:Npn \@@_box_spread:NNNn #1#2#3#4 |
| 3205 |
{ |
| 3206 |
\mode_leave_vertical: |
| 3207 |
\@@_get_width:Nn #1 { #3 #4 } |
| 3208 |
\hbox_to_wd:nn {#2} |
| 3209 |
{ |
| 3210 |
\dim_compare:nTF { #1 > #2 } |
| 3211 |
{ |
| 3212 |
\tex_hfil:D \scalebox |
| 3213 |
{ \dim_to_decimal_in_unit:nn {#2} {#1} } |
| 3214 |
[ 1.0 ] { #3 #4 } \tex_hfil:D |
| 3215 |
} |
| 3216 |
{ #3 \tl_map_inline:nn {#4} { ##1 \tex_hfil:D } \tex_unskip:D } |
| 3217 |
} |
| 3218 |
} |
| 3219 |
% \end{macrocode} |
| 3220 |
% \end{macro} |
| 3221 |
% |
| 3222 |
% \begin{macro}{\@@_box_spread:NNn,\@@_box_spread:NNv,\@@_box_spread:NNe} |
| 3223 |
% \begin{macrocode} |
| 3224 |
\cs_new:Npn \@@_box_spread:NNn { \@@_box_spread:NNNn \l_@@_tmp_skip } |
| 3225 |
\cs_generate_variant:Nn \@@_box_spread:NNn { NNv } |
| 3226 |
\cs_generate_variant:Nn \@@_box_spread:NNn { NNe } |
| 3227 |
% \end{macrocode} |
| 3228 |
% \end{macro} |
| 3229 |
% |
| 3230 |
% \begin{macro}{\@@_box_spread_name:Nn,\@@_box_spread_name:NNn} |
| 3231 |
% 以上盒子只用来打印 \cs[no-index]{l_@@_name_\meta{描述}_tl} 变量。 |
| 3232 |
% \begin{macrocode} |
| 3233 |
\cs_new_protected:Npn \@@_box_spread_name:Nn #1#2 |
| 3234 |
{ \@@_box_spread:NNv #1 \c_empty_tl { l_@@_name_ #2 _tl } } |
| 3235 |
\cs_new_protected:Npn \@@_box_spread_name:NNn #1#2#3 |
| 3236 |
{ \@@_box_spread:NNv #1 #2 { l_@@_name_ #3 _tl } } |
| 3237 |
% \end{macrocode} |
| 3238 |
% \end{macro} |
| 3239 |
% |
| 3240 |
% \begin{macro}{\@@_box_center:Nn} |
| 3241 |
% 居中对齐的水平盒子。 |
| 3242 |
% \begin{macrocode} |
| 3243 |
\cs_new_protected:Npn \@@_box_center:Nn #1#2 |
| 3244 |
{ |
| 3245 |
\mode_leave_vertical: |
| 3246 |
\hbox_to_wd:nn {#1} { \tex_hfil:D #2 \tex_hfil:D } |
| 3247 |
} |
| 3248 |
% \end{macrocode} |
| 3249 |
% \end{macro} |
| 3250 |
% |
| 3251 |
% \begin{macro}{\@@_box_multiline:NNNNn} |
| 3252 |
% 多行固定长度的下划线内容。 |
| 3253 |
% \begin{arguments} |
| 3254 |
% \item 用于存储条目数量的 |int| 型变量 |
| 3255 |
% \item 用于存储条目内容的 |tl| 型变量 |
| 3256 |
% \item 内容,|clist| 型变量 |
| 3257 |
% \item 宽度,|dim| 型变量 |
| 3258 |
% \item 条目数量 |
| 3259 |
% \end{arguments} |
| 3260 |
% 默认绘制 4 条下划线。在评阅者人数超过 4 人时添加额外的条目。 |
| 3261 |
% \begin{macrocode} |
| 3262 |
\cs_new_protected:Npn \@@_box_multiline:NNNNn #1#2#3#4#5 |
| 3263 |
{ |
| 3264 |
\int_set:Nn #1 { \int_max:nn { \clist_count:N #3 } {#5} } |
| 3265 |
\int_step_inline:nn {#1} |
| 3266 |
{ |
| 3267 |
% \end{macrocode} |
| 3268 |
% \changes{v1.1}{2022/11/29}{修复空返回值在国家图书馆封面引发的死循环。} |
| 3269 |
% 防止空的返回值引发死循环。 |
| 3270 |
% \begin{macrocode} |
| 3271 |
\clist_gpop:NNF #3 #2 { \tl_set_eq:NN #2 \c_empty_tl } |
| 3272 |
\@@_box_ulined:NN #4 #2 \tex_par:D |
| 3273 |
} |
| 3274 |
} |
| 3275 |
% \end{macrocode} |
| 3276 |
% \end{macro} |
| 3277 |
% |
| 3278 |
% \begin{macro}{\@@_box_paragraph:nn} |
| 3279 |
% \changes{v1.5.0}{2025/04/13}{提供 \tn{parbox} 的 \LaTeX3 替代方案。} |
| 3280 |
% 替代 \tn{parbox} 的功能,生成指定宽度的顶对齐垂直盒子。 |
| 3281 |
% \tn{@parboxrestore} 用于重置段落参数,保证 \tn{lastbox} 正确。 |
| 3282 |
% 这里还需要通过全局变量存储 \tn{prevdepth} 的值, |
| 3283 |
% 保存盒子内部最后一行的真实深度,维持上下方的行距一致。 |
| 3284 |
% \footnote{\url{https://tex.stackexchange.com/q/34971/}} |
| 3285 |
% \begin{arguments} |
| 3286 |
% \item 宽度,|dim| 型变量 |
| 3287 |
% \item 内容 |
| 3288 |
% \end{arguments} |
| 3289 |
% \begin{macrocode} |
| 3290 |
\cs_new_protected:Npn \@@_box_paragraph:nn #1#2 |
| 3291 |
{ |
| 3292 |
\vbox_top:n |
| 3293 |
{ |
| 3294 |
\@parboxrestore |
| 3295 |
\dim_set:Nn \tex_hsize:D {#1} |
| 3296 |
#2 |
| 3297 |
\dim_gset_eq:NN \g_@@_prevdepth_dim \tex_prevdepth:D |
| 3298 |
} |
| 3299 |
\tex_par:D |
| 3300 |
\dim_set_eq:NN \tex_prevdepth:D \g_@@_prevdepth_dim |
| 3301 |
} |
| 3302 |
% \end{macrocode} |
| 3303 |
% \end{macro} |
| 3304 |
% |
| 3305 |
% \begin{macro}{\@@_box_multiline:NNn} |
| 3306 |
% \begin{macrocode} |
| 3307 |
\cs_new:Npn \@@_box_multiline:NNn |
| 3308 |
{ \@@_box_multiline:NNNNn \l_@@_tmpa_int \l_@@_tmpa_tl } |
| 3309 |
% \end{macrocode} |
| 3310 |
% \end{macro} |
| 3311 |
% |
| 3312 |
% \begin{macro}{\@@_uline:n} |
| 3313 |
% 指定宽度的下划线。 |
| 3314 |
% \begin{arguments} |
| 3315 |
% \item 宽度,|dim| 型变量 |
| 3316 |
% \end{arguments} |
| 3317 |
% \begin{macrocode} |
| 3318 |
\cs_new_protected:Npn \@@_uline:n #1 |
| 3319 |
{ |
| 3320 |
\mode_leave_vertical: |
| 3321 |
\rule [ \l_@@_ruledpi_dim ] {#1} { \l_@@_rulehti_dim } |
| 3322 |
\skip_horizontal:n { -#1 } |
| 3323 |
} |
| 3324 |
% \end{macrocode} |
| 3325 |
% \end{macro} |
| 3326 |
% |
| 3327 |
% \begin{macro}{\@@_uuline:n} |
| 3328 |
% 指定宽度的双层下划线。 |
| 3329 |
% \begin{arguments} |
| 3330 |
% \item 宽度,|dim| 型变量 |
| 3331 |
% \end{arguments} |
| 3332 |
% \begin{macrocode} |
| 3333 |
\cs_new_protected:Npn \@@_uuline:n #1 |
| 3334 |
{ |
| 3335 |
\mode_leave_vertical: |
| 3336 |
\rule [ \l_@@_ruledpii_dim ] {#1} { \l_@@_rulehtii_dim } |
| 3337 |
\skip_horizontal:n { -#1 } |
| 3338 |
\rule [ \l_@@_ruledpiii_dim ] {#1} { \l_@@_rulehtii_dim } |
| 3339 |
\skip_horizontal:n { -#1 } |
| 3340 |
} |
| 3341 |
% \end{macrocode} |
| 3342 |
% \end{macro} |
| 3343 |
% |
| 3344 |
% \begin{macro}{\@@_get_width:Nn,\@@_get_width:NV,\@@_get_width:Nv} |
| 3345 |
% ^^A 来自 fduthesis |
| 3346 |
% 获取文本宽度。 |
| 3347 |
% \begin{arguments} |
| 3348 |
% \item 存储宽度的 |dim| 型变量 |
| 3349 |
% \item 文本 |
| 3350 |
% \end{arguments} |
| 3351 |
% 将内容放入 \tn{hbox} 后读取其宽度,存入 |dim| 型变量。 |
| 3352 |
% \begin{macrocode} |
| 3353 |
\cs_new:Npn \@@_get_width:Nn #1#2 |
| 3354 |
{ |
| 3355 |
\hbox_set:Nn \l_@@_tmpa_box {#2} |
| 3356 |
\dim_set:Nn #1 { \box_wd:N \l_@@_tmpa_box } |
| 3357 |
} |
| 3358 |
\cs_generate_variant:Nn \@@_get_width:Nn { NV } |
| 3359 |
\cs_generate_variant:Nn \@@_get_width:Nn { Nv } |
| 3360 |
% \end{macrocode} |
| 3361 |
% \end{macro} |
| 3362 |
% |
| 3363 |
% \begin{macro}{\@@_get_max_width:NN} |
| 3364 |
% ^^A 来自 fduthesis,调整了实现方法 |
| 3365 |
% 获取多个文本中的最大宽度,并存入 |dim| 型变量。 |
| 3366 |
% 本模板中此函数仅用于处理 |info| 类型文本变量, |
| 3367 |
% 出现在博士后模板封面信息表。 |
| 3368 |
% \begin{arguments} |
| 3369 |
% \item |dim| 型变量 |
| 3370 |
% \item 文本 |clist| |
| 3371 |
% \end{arguments} |
| 3372 |
% 当 \cs{l_@@_tmp_clist} 非空时,弹出最后一个元素赋给 \cs{l_@@_tmpa_tl}, |
| 3373 |
% 获取其长度后与 |#1| 进行比较,二者中较大的那一个将成为 |#1| 的新值。 |
| 3374 |
% 不断循环,直至 \cs{l_@@_tmp_clist} 为空。 |
| 3375 |
% \begin{macrocode} |
| 3376 |
\cs_new:Npn \@@_get_max_width:NN #1#2 |
| 3377 |
{ |
| 3378 |
\clist_map_inline:Nn #2 |
| 3379 |
{ |
| 3380 |
\@@_get_width:Nv \l_@@_tmpa_dim { g_@@_info_ ##1 _tl } |
| 3381 |
\dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } } |
| 3382 |
} |
| 3383 |
} |
| 3384 |
% \end{macrocode} |
| 3385 |
% \end{macro} |
| 3386 |
% |
| 3387 |
% \begin{macro}{\@@_get_width_print:Nn,\@@_get_width_print:Nv, |
| 3388 |
% \@@_get_width_print:Ne} |
| 3389 |
% 横跨整页的下划线。 |
| 3390 |
% \begin{arguments} |
| 3391 |
% \item 宽度,|dim| 型变量 |
| 3392 |
% \item 文本 |
| 3393 |
% \end{arguments} |
| 3394 |
% 先使用 \cs{@@_get_width:Nn} 获取文本内容到右边距的宽度, |
| 3395 |
% 该宽度存储在调用的 |dim| 型变量中。随后输出文本内容。 |
| 3396 |
% \begin{macrocode} |
| 3397 |
\cs_new_protected:Npn \@@_get_width_print:Nn #1#2 |
| 3398 |
{ |
| 3399 |
\@@_get_width:Nn #1 {#2} |
| 3400 |
\dim_set:Nn #1 { \textwidth - #1 } #2 |
| 3401 |
} |
| 3402 |
\cs_generate_variant:Nn \@@_get_width_print:Nn { Nv } |
| 3403 |
\cs_generate_variant:Nn \@@_get_width_print:Nn { Ne } |
| 3404 |
% \end{macrocode} |
| 3405 |
% \end{macro} |
| 3406 |
% |
| 3407 |
% \begin{macro}{\@@_uline_entry:Nn} |
| 3408 |
% 生成占整页宽度的下划线条目。 |
| 3409 |
% \begin{arguments} |
| 3410 |
% \item 宽度,|dim| 型变量 |
| 3411 |
% \item 文本 |
| 3412 |
% \end{arguments} |
| 3413 |
% \begin{macrocode} |
| 3414 |
\cs_new_protected:Npn \@@_uline_entry:Nn #1#2 |
| 3415 |
{ |
| 3416 |
\@@_get_width_print:Nv #1 { l_@@_name_ #2 _tl } |
| 3417 |
\@@_box_ulined_info:Nn #1 {#2} |
| 3418 |
} |
| 3419 |
% \end{macrocode} |
| 3420 |
% \end{macro} |
| 3421 |
% |
| 3422 |
% \begin{macro}{\@@_uline_bientry:Nn} |
| 3423 |
% 生成占半页宽度的下划线条目。 |
| 3424 |
% \begin{arguments} |
| 3425 |
% \item 宽度,|dim| 型变量 |
| 3426 |
% \item 文本 |
| 3427 |
% \end{arguments} |
| 3428 |
% \begin{macrocode} |
| 3429 |
\cs_new_protected:Npn \@@_uline_bientry:Nn #1#2 |
| 3430 |
{ |
| 3431 |
\@@_get_width_print:Nv #1 { l_@@_name_ #2 _tl } |
| 3432 |
\dim_sub:Nn #1 { \textwidth / 2 } |
| 3433 |
\@@_box_ulined_info:Nn #1 {#2} |
| 3434 |
} |
| 3435 |
% \end{macrocode} |
| 3436 |
% \end{macro} |
| 3437 |
% |
| 3438 |
% \begin{macro}{\@@_date:www,\@@_date_en:www} |
| 3439 |
% 将形如 |yyyy-mm-dd| 的 ISO 日期格式字符串转化为日期表示。 |
| 3440 |
% 该格式符合国际标准 ISO 8601 以及国内标准 GB/T 7408--2005 |
| 3441 |
% 《数据元和交换格式 信息交换 日期和时间表示法》。 |
| 3442 |
% \begin{arguments} |
| 3443 |
% \item 年份 |
| 3444 |
% \item 月份 |
| 3445 |
% \item 日期 |
| 3446 |
% \end{arguments} |
| 3447 |
% 中文日期字样通过封装 \pkg{zhnumber} 的内部函数实现,默认使用阿拉伯数字表示, |
| 3448 |
% 可以通过该宏包提供的 |\zhnumsetup{time=Chinese}| 来使用中文数字; |
| 3449 |
% 英文日期字样用于研究生英文封面,格式为 \meta{月份缩写}~\meta{日},~\meta{年}。 |
| 3450 |
% 其中,变量类型 |w| 表明参数符合特定语法格式,其参数必须经过完全展开。 |
| 3451 |
% \begin{macrocode} |
| 3452 |
\cs_new:Npn \@@_date:www #1-#2-#3 \q_stop |
| 3453 |
{ \__zhnum_date_aux:nnn {#1} {#2} {#3} } |
| 3454 |
\cs_new:Npn \@@_date_en:www #1-#2-#3 \q_stop |
| 3455 |
{ \clist_item:Nn \c_@@_name_month_en_clist {#2} ~#3 , ~#1 } |
| 3456 |
% \end{macrocode} |
| 3457 |
% \end{macro} |
| 3458 |
% |
| 3459 |
% \begin{macro}{\@@_date:nnn} |
| 3460 |
% \changes{v0.20}{2022/05/24}{可在日期项留空以使用空白的年月日字样。} |
| 3461 |
% 用于日期格式转化的辅助命令。在传入的字符串为空时生成空白字样。 |
| 3462 |
% \begin{macrocode} |
| 3463 |
\cs_new:Npn \@@_date:nnn #1#2#3 |
| 3464 |
{ |
| 3465 |
\tl_gset:cx { g_@@_info_ #2 date #1 _tl } |
| 3466 |
{ |
| 3467 |
\tl_if_empty:nTF {#3} |
| 3468 |
{ \@@_name:n { blankdate #1 } } |
| 3469 |
{ \use:c { @@_date #1 :www } #3 \q_stop } |
| 3470 |
} |
| 3471 |
} |
| 3472 |
% \end{macrocode} |
| 3473 |
% \end{macro} |
| 3474 |
% |
| 3475 |
% \begin{macro}{\@@_date:nn} |
| 3476 |
% 同时生成中英文日期字样。 |
| 3477 |
% \begin{macrocode} |
| 3478 |
\cs_new:Npn \@@_date:nn #1#2 |
| 3479 |
{ \@@_date:nnn { } {#1} {#2} \@@_date:nnn { _en } {#1} {#2} } |
| 3480 |
% \end{macrocode} |
| 3481 |
% \end{macro} |
| 3482 |
% |
| 3483 |
% \begin{macro}{\@@_at_begin_document:n} |
| 3484 |
% 封装 \LaTeX{} 的钩子管理机制,等效于 \tn{AtBeginDocument}。 |
| 3485 |
% \begin{macrocode} |
| 3486 |
\cs_new_protected:Npn \@@_at_begin_document:n #1 |
| 3487 |
{ \hook_gput_next_code:nn { begin document } {#1} } |
| 3488 |
% \end{macrocode} |
| 3489 |
% \end{macro} |
| 3490 |
% |
| 3491 |
% \begin{macro}{\@@_cs_clear:N} |
| 3492 |
% 清空命令。 |
| 3493 |
% \begin{macrocode} |
| 3494 |
\cs_new:Npn \@@_cs_clear:N #1 { \cs_set_eq:NN #1 \scan_stop: } |
| 3495 |
% \end{macrocode} |
| 3496 |
% \end{macro} |
| 3497 |
% |
| 3498 |
% \begin{macro}{\@@_msg:nn} |
| 3499 |
% 简化提示信息的创建。 |
| 3500 |
% \begin{macrocode} |
| 3501 |
\cs_new:Npn \@@_msg:nn { \msg_new:nnn { njuthesis } } |
| 3502 |
% \end{macrocode} |
| 3503 |
% \end{macro} |
| 3504 |
% |
| 3505 |
% \subsubsection{封面相关} |
| 3506 |
% \changes{v0.16}{2022/03/10}{将封面和摘要内部函数定义移动到前部。} |
| 3507 |
% |
| 3508 |
% \begin{macro}{\@@_loop_until:nnn} |
| 3509 |
% 等效于 plain \TeX 的 \tn{loop} 循环,原始结构为\\ |
| 3510 |
% \tn{loop}\meta{循环体1}\meta{终止条件}\meta{循环体2}\tn{repeat}。 |
| 3511 |
% \begin{arguments} |
| 3512 |
% \item |bool| 表达式 |
| 3513 |
% \item 循环体1 |
| 3514 |
% \item 循环体2 |
| 3515 |
% \end{arguments} |
| 3516 |
% 两个代码块交替执行,如果在\meta{循环体1}结束后满足条件,则退出循环。 |
| 3517 |
% \begin{macrocode} |
| 3518 |
\cs_new:Npn \@@_loop_until:nnn #1#2#3 |
| 3519 |
{ #2 \bool_if:nF {#1} { #3 \@@_loop_until:nnn {#1} {#2} {#3} } } |
| 3520 |
% \end{macrocode} |
| 3521 |
% \end{macro} |
| 3522 |
% |
| 3523 |
% \begin{macro}{\@@_underline_par_break:NNn} |
| 3524 |
% \changes{v1.0}{2022/08/01}{使用 \LaTeX3 语法重构下划线断行算法。} |
| 3525 |
% \changes{v1.5.0}{2026/04/07}{使用 \LaTeX3 原生接口重构下划线定位逻辑。} |
| 3526 |
% 带下划线的自然断行算法核心递归部分,基于 \TeX{} 底层断行机制。 |
| 3527 |
% 算法主要依赖两个暂存盒子,通过 1 号盒子将预先排版好的段落 |
| 3528 |
% 从下往上逐行剥离,为单行添加下划线后,再反向拼接重组。 |
| 3529 |
|
| 3530 |
% 在将当前处理完毕的行与 2 号盒子中累积的后续行进行拼接时, |
| 3531 |
% 插入的 \tn{penalty} 0 代表一个中立的断行点。 |
| 3532 |
% \footnote{\url{https://tex.stackexchange.com/a/637863/251992}, |
| 3533 |
% 原版算法基于 plain TeX{},对其语法的简要介绍可以参考 |
| 3534 |
% \href{http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf}{\file{tex-nutshell.pdf}}。 |
| 3535 |
% 我在接口成熟后做了一点点 \LaTeX3 改编。} |
| 3536 |
% \begin{arguments} |
| 3537 |
% \item 1 号盒子存放从原段落底部抽出的当前行。 |
| 3538 |
% \item 2 号盒子从后向前收集并拼接所有已处理好的行。 |
| 3539 |
% \item 循环体2的额外语句(钩子) |
| 3540 |
% \end{arguments} |
| 3541 |
% \begin{macrocode} |
| 3542 |
\cs_new_protected:Npn \@@_underline_par_break:NNn #1#2#3 |
| 3543 |
{ |
| 3544 |
\hbox_gset:Nn #2 { } |
| 3545 |
\@@_loop_until:nnn { \box_if_empty_p:N #1 } |
| 3546 |
{ |
| 3547 |
\box_set_to_last:N #1 |
| 3548 |
\tex_unskip:D \tex_unpenalty:D |
| 3549 |
} |
| 3550 |
{ |
| 3551 |
\@@_box_underline:N #1 |
| 3552 |
\hbox_gset:Nn #2 |
| 3553 |
{ |
| 3554 |
\box_use_drop:N #1 |
| 3555 |
\tex_penalty:D \c_zero_int |
| 3556 |
\hbox_unpack_drop:N #2 |
| 3557 |
} |
| 3558 |
#3 |
| 3559 |
} |
| 3560 |
} |
| 3561 |
% \end{macrocode} |
| 3562 |
% \end{macro} |
| 3563 |
% |
| 3564 |
% \begin{macro}{\@@_underline_par_print:Nnn} |
| 3565 |
% 打印带下划线的自然断行算法结果。 |
| 3566 |
% \begin{arguments} |
| 3567 |
% \item 内容本身 |
| 3568 |
% \item 前部 |
| 3569 |
% \item 后部 |
| 3570 |
% \end{arguments} |
| 3571 |
% \begin{macrocode} |
| 3572 |
\cs_new_protected:Npn \@@_underline_par_print:Nnn #1#2#3 |
| 3573 |
{ |
| 3574 |
\group_begin: |
| 3575 |
\tex_noindent:D #2 |
| 3576 |
\hbox_unpack_drop:N #1 #3 |
| 3577 |
\tex_par:D |
| 3578 |
\group_end: |
| 3579 |
} |
| 3580 |
% \end{macrocode} |
| 3581 |
% \end{macro} |
| 3582 |
% |
| 3583 |
% \begin{macro}{\@@_print_ulined_title:} |
| 3584 |
% \changes{v0.17}{2022/04/09}{优化封面标题的断行方式。} |
| 3585 |
% 多行带下划线标题。先正常排版,再逐行拆解成带下划线的形式。 |
| 3586 |
% 这里的 1 号盒子是个临时运行断行算法的沙箱,并不用于输出。 |
| 3587 |
% \begin{macrocode} |
| 3588 |
\cs_new_protected:Npn \@@_print_ulined_title: |
| 3589 |
{ |
| 3590 |
\vbox_set:Nn \l_@@_tmpa_box |
| 3591 |
{ |
| 3592 |
\skip_set:Nn \tex_leftskip:D { .5 em plus 1 fill } |
| 3593 |
\skip_set_eq:NN \tex_rightskip:D \tex_leftskip:D |
| 3594 |
\g_@@_info_title_tl \tex_par:D |
| 3595 |
\@@_underline_par_break:NNn \l_@@_tmpb_box \g_@@_tmpc_box { } |
| 3596 |
} |
| 3597 |
\@@_underline_par_print:Nnn \g_@@_tmpc_box { } { } |
| 3598 |
} |
| 3599 |
% \end{macrocode} |
| 3600 |
% \end{macro} |
| 3601 |
% |
| 3602 |
% \begin{macro}{\@@_cover_entry_title:NNNN,\@@_cover_entry_title:NNN} |
| 3603 |
% 生成普通封面页的标题条目,包括标签和标题本身。 |
| 3604 |
% \begin{arguments} |
| 3605 |
% \item 分隔符 |
| 3606 |
% \item 名称盒子宽度,|dim| 型变量 |
| 3607 |
% \item 内容盒子宽度,|dim| 型变量 |
| 3608 |
% \item 标签格式 |
| 3609 |
% \end{arguments} |
| 3610 |
% \begin{macrocode} |
| 3611 |
\cs_new_protected:Npn \@@_cover_entry_title:NNNN #1#2#3#4 |
| 3612 |
{ |
| 3613 |
\tl_if_empty:NT \g_@@_info_title_tl |
| 3614 |
{ \msg_error:nn { njuthesis } { missing-title } } |
| 3615 |
\@@_box_spread_name:NNn #2 #4 { title } |
| 3616 |
\mode_leave_vertical: #1 |
| 3617 |
\@@_box_paragraph:nn {#3} |
| 3618 |
{ \l_@@_fmt_covertitle_tl \@@_print_ulined_title: } |
| 3619 |
} |
| 3620 |
\cs_new:Npn \@@_cover_entry_title:NNN { \@@_cover_entry_title:NNNN \@@_hskip: } |
| 3621 |
% \end{macrocode} |
| 3622 |
% \end{macro} |
| 3623 |
% |
| 3624 |
% \begin{macro}{\@@_cover_entry:NNNNn,\@@_cover_entry:NNNn} |
| 3625 |
% 生成单项信息条目。 |
| 3626 |
% \begin{arguments} |
| 3627 |
% \item 分隔符 |
| 3628 |
% \item 名称盒子宽度,|dim| 型变量 |
| 3629 |
% \item 内容盒子宽度,|dim| 型变量 |
| 3630 |
% \item 标签格式 |
| 3631 |
% \item 条目名称 |
| 3632 |
% \end{arguments} |
| 3633 |
% \begin{macrocode} |
| 3634 |
\cs_new_protected:Npn \@@_cover_entry:NNNNn #1#2#3#4#5 |
| 3635 |
{ |
| 3636 |
\@@_box_spread_name:NNn #2 #4 {#5} #1 |
| 3637 |
\@@_box_ulined_info:Nn #3 {#5} \tex_par:D |
| 3638 |
} |
| 3639 |
\cs_new:Npn \@@_cover_entry:NNNn { \@@_cover_entry:NNNNn \@@_hskip: } |
| 3640 |
% \end{macrocode} |
| 3641 |
% \end{macro} |
| 3642 |
% |
| 3643 |
% \begin{macro}{\@@_cover_entry:NNNNnn} |
| 3644 |
% 生成两项信息条目,仅用于本科生封面。 |
| 3645 |
% \begin{arguments} |
| 3646 |
% \item 第一个名称盒子宽度,|dim| 型变量 |
| 3647 |
% \item 第二个名称盒子宽度,|dim| 型变量 |
| 3648 |
% \item 内容盒子宽度,|dim| 型变量 |
| 3649 |
% \item 标签格式 |
| 3650 |
% \item 左侧条目名称 |
| 3651 |
% \item 右侧条目名称 |
| 3652 |
% \end{arguments} |
| 3653 |
% \begin{macrocode} |
| 3654 |
\cs_new_protected:Npn \@@_cover_entry:NNNNnn #1#2#3#4#5#6 |
| 3655 |
{ |
| 3656 |
\@@_box_spread_name:NNn #1 #4 {#5} \@@_hskip: |
| 3657 |
\@@_box_ulined_info:Nn #3 {#5} \@@_hskip: |
| 3658 |
\@@_box_spread_name:NNn #2 #4 {#6} \@@_hskip: |
| 3659 |
\@@_box_ulined_info:Nn #3 {#6} \tex_par:D |
| 3660 |
} |
| 3661 |
% \end{macrocode} |
| 3662 |
% \end{macro} |
| 3663 |
% |
| 3664 |
% \begin{macro}{\@@_cover_entry_supv:NNNNn} |
| 3665 |
% 生成两项导师信息条目,仅用于本科生封面。 |
| 3666 |
% \begin{arguments} |
| 3667 |
% \item 第一个名称盒子宽度,|dim| 型变量 |
| 3668 |
% \item 第二个名称盒子宽度,|dim| 型变量 |
| 3669 |
% \item 内容盒子宽度,|dim| 型变量 |
| 3670 |
% \item 标签格式 |
| 3671 |
% \item 条目名称 |
| 3672 |
% \end{arguments} |
| 3673 |
% |clist| 最后一个元素为空时弹出的是无法展开的 \cs{q_novalue_tl}, |
| 3674 |
% 需要简单处理以使用分散对齐的盒子。 |
| 3675 |
% \begin{macrocode} |
| 3676 |
\cs_new_protected:Npn \@@_cover_entry_supv:NNNNn #1#2#3#4#5 |
| 3677 |
{ |
| 3678 |
\tl_set:Nn \l_@@_tmpa_tl |
| 3679 |
{ \clist_item:cn { g_@@_info_ #5 _clist } { 1 } } |
| 3680 |
\tl_set:Nn \l_@@_tmpb_tl |
| 3681 |
{ \clist_item:cn { g_@@_info_ #5 _clist } { 2 } } |
| 3682 |
\@@_box_spread_name:NNn #1 #4 {#5} \@@_hskip: |
| 3683 |
\@@_box_ulined:NN #3 \l_@@_tmpa_tl \@@_hskip: |
| 3684 |
\@@_box_spread_name:NNn #2 #4 { supvtitle } \@@_hskip: |
| 3685 |
\@@_box_ulined:NN #3 \l_@@_tmpb_tl \tex_par:D |
| 3686 |
} |
| 3687 |
% \end{macrocode} |
| 3688 |
% \end{macro} |
| 3689 |
% |
| 3690 |
% |
| 3691 |
% \subsubsection{摘要相关} |
| 3692 |
% |
| 3693 |
% \begin{macro}{\@@_abs_bookmark:nn,\@@_abs_bookmark:Vn} |
| 3694 |
% \changes{v0.14}{2021/12/21}{将摘要插入目录。} |
| 3695 |
% 生成摘要的目录条目。 |
| 3696 |
% \begin{macrocode} |
| 3697 |
\cs_new_protected:Npn \@@_abs_bookmark:nn #1#2 |
| 3698 |
{ |
| 3699 |
\phantomsection |
| 3700 |
\@@_bookmark:Nnn \g_@@_abs_showentry_bool {#1} {#2} |
| 3701 |
\@@_chapter_header:n {#1} |
| 3702 |
} |
| 3703 |
\cs_generate_variant:Nn \@@_abs_bookmark:nn { Vn } |
| 3704 |
% \end{macrocode} |
| 3705 |
% \end{macro} |
| 3706 |
% |
| 3707 |
% \begin{macro}{\@@_abs_headline:N} |
| 3708 |
% 摘要顶端标题双层下划线格式。 |
| 3709 |
% \begin{arguments} |
| 3710 |
% \item 宽度,|dim| 型变量 |
| 3711 |
% \end{arguments} |
| 3712 |
% \begin{macrocode} |
| 3713 |
\cs_new_protected:Npn \@@_abs_headline:N #1 |
| 3714 |
{ |
| 3715 |
\@@_get_width:NV \l_@@_tmpa_dim #1 |
| 3716 |
\@@_uuline:n { \l_@@_tmpa_dim } #1 |
| 3717 |
} |
| 3718 |
% \end{macrocode} |
| 3719 |
% \end{macro} |
| 3720 |
% |
| 3721 |
% \begin{macro}{\@@_print_labeled_title:NNn,\@@_print_labeled_title:NNe} |
| 3722 |
% \changes{v0.16}{2022/03/25}{使用原生断行算法处理摘要页标题。} |
| 3723 |
% 用于研究生摘要页面的多行论文标题。 |
| 3724 |
% 这里转化了使用 plain \TeX{} 语法实现的的断行算法。 |
| 3725 |
% \begin{arguments} |
| 3726 |
% \item 内容 |
| 3727 |
% \item 左边距 |
| 3728 |
% \item 标签 |
| 3729 |
% \end{arguments} |
| 3730 |
% \begin{macrocode} |
| 3731 |
\cs_new_protected:Npn \@@_print_labeled_title:NNn #1#2#3 |
| 3732 |
{ |
| 3733 |
\vbox_set:Nn \l_@@_tmpa_box |
| 3734 |
{ |
| 3735 |
\@@_get_width:Nn \tex_hangindent:D {#3} |
| 3736 |
\int_set:Nn \tex_hangafter:D { -1 } |
| 3737 |
\skip_set_eq:NN \tex_leftskip:D #2 |
| 3738 |
\skip_set_eq:NN \tex_rightskip:D \tex_leftskip:D |
| 3739 |
\tex_noindent:D #1 \tex_par:D |
| 3740 |
% \end{macrocode} |
| 3741 |
% 使用循环寻找断行点,存入已被清空的 3 号盒子,同时统计行数。 |
| 3742 |
% \begin{macrocode} |
| 3743 |
\int_gzero:N \g_@@_uline_count_int |
| 3744 |
\@@_underline_par_break:NNn \l_@@_tmpb_box \g_@@_tmpc_box |
| 3745 |
{ \int_gincr:N \g_@@_uline_count_int } |
| 3746 |
} |
| 3747 |
% \end{macrocode} |
| 3748 |
% 在使用自然断行算法后,研究生的摘要标题可选择 \opt{strict} |
| 3749 |
% 或者 \opt{natural} 模式。前者会为少于两行的标题补齐下划线, |
| 3750 |
% 并对多于三行的标题生成警告信息。这里通过行数处理边界条件, |
| 3751 |
% 包括标题未填写、标题只有一行,以及标题过长的情况。 |
| 3752 |
% \begin{macrocode} |
| 3753 |
\@@_underline_par_print:Nnn \g_@@_tmpc_box {#3} |
| 3754 |
{ |
| 3755 |
\bool_if:NT \g_@@_abs_title_strict_bool |
| 3756 |
{ |
| 3757 |
\int_case:nnF { \g_@@_uline_count_int } |
| 3758 |
{ |
| 3759 |
{ 0 } { \msg_error:nn { njuthesis } { missing-title } } |
| 3760 |
{ 1 } { \@@_uline:n { \textwidth } } |
| 3761 |
{ 2 } { } |
| 3762 |
} |
| 3763 |
{ \msg_warning:nn { njuthesis } { abs-title-too-long } } |
| 3764 |
\tex_par:D |
| 3765 |
} |
| 3766 |
} |
| 3767 |
} |
| 3768 |
\cs_generate_variant:Nn \@@_print_labeled_title:NNn { NNe } |
| 3769 |
% \end{macrocode} |
| 3770 |
% \end{macro} |
| 3771 |
% |
| 3772 |
% |
| 3773 |
% \subsection{页面对象} |
| 3774 |
% \changes{v0.15}{2022/01/24}{使用 \pkg{xtemplate} 重构封面。} |
| 3775 |
% |
| 3776 |
% 本模板使用 \pkg{xtemplate} 提供的面向对象方法简化封面和摘要的绘制过程。 |
| 3777 |
% |
| 3778 |
% 以下分别从页面元素(element)和页面整体(page)的层次进行了抽象。 |
| 3779 |
% 当我们把页面部件考虑为一个对象时,它天然地只具备有限数量的属性: |
| 3780 |
% 内容、格式、边距、对齐方式等。而具体的页面是这些对象的实例的集合, |
| 3781 |
% 附加边距、行距等属性,创建页面只需传入一个列表调用各个 Instance |
| 3782 |
% 即可。通过 \pkg{xtemplate} 提供的功能,我们可以根据这些属性创建模板 |
| 3783 |
% (template),进而能大量构建具有\emph{相似行为}的实例(instance)。 |
| 3784 |
% 这种做法能充分分离内容和样式,极大优化代码的可读性。 |
| 3785 |
% |
| 3786 |
% 声明对象类型。此类对象不需要参数。 |
| 3787 |
% \begin{macrocode} |
| 3788 |
\DeclareObjectType { nju } { \c_zero_int } |
| 3789 |
% \end{macrocode} |
| 3790 |
% |
| 3791 |
% \subsubsection{元素模板} |
| 3792 |
% \changes{v1.0}{2022/08/02}{修正元素对象的底部间距设置。} |
| 3793 |
% |
| 3794 |
% \begin{macrocode} |
| 3795 |
%<@@=njuelem> |
| 3796 |
% \end{macrocode} |
| 3797 |
% |
| 3798 |
% \begin{macro}{\@@_align:} |
| 3799 |
% 声明元素模板接口。 |
| 3800 |
% 元素是一个页面的基本组成单位,包括文段、图片等等。 |
| 3801 |
% 一个抽象的元素应当具备以下属性: |
| 3802 |
% \begin{description} |
| 3803 |
% \item[\opt{content}] 内容,即剥离样式的元素本身 |
| 3804 |
% \item[\opt{format}] 格式,例如字号、字体 |
| 3805 |
% \item[\opt{bottom-skip}] 下间距,即与下一个元素的距离 |
| 3806 |
% \item[\opt{align}] 对齐方式,包括左对齐、右对齐、居中、正常段落 |
| 3807 |
% \end{description} |
| 3808 |
% \begin{macrocode} |
| 3809 |
\DeclareTemplateInterface { nju } { element } { \c_zero_int } |
| 3810 |
{ |
| 3811 |
content : tokenlist = \c_empty_tl, |
| 3812 |
format : tokenlist = \c_empty_tl, |
| 3813 |
bottom-skip : skip = \c_zero_skip, |
| 3814 |
align : choice { l, r, c, n } = c |
| 3815 |
} |
| 3816 |
% \end{macrocode} |
| 3817 |
% |
| 3818 |
% 声明元素模板代码。涉及的变量将被自动创建。 |
| 3819 |
% \begin{macrocode} |
| 3820 |
\DeclareTemplateCode { nju } { element } { \c_zero_int } |
| 3821 |
{ |
| 3822 |
content = \l_@@_content_tl, |
| 3823 |
format = \l_@@_format_tl, |
| 3824 |
bottom-skip = \l_@@_bottom_skip, |
| 3825 |
align = |
| 3826 |
{ |
| 3827 |
l = { \cs_set_eq:NN \@@_align: \raggedright }, |
| 3828 |
r = { \cs_set_eq:NN \@@_align: \raggedleft }, |
| 3829 |
c = { \cs_set_eq:NN \@@_align: \centering }, |
| 3830 |
n = { \cs_set:Nn \@@_align: { } } |
| 3831 |
} |
| 3832 |
} |
| 3833 |
{ |
| 3834 |
\AssignTemplateKeys |
| 3835 |
\group_begin: |
| 3836 |
\@@_align: |
| 3837 |
\l_@@_format_tl \l_@@_content_tl \tex_par:D |
| 3838 |
\group_end: |
| 3839 |
\__nju_vskip:N \l_@@_bottom_skip |
| 3840 |
} |
| 3841 |
% \end{macrocode} |
| 3842 |
% \end{macro} |
| 3843 |
% |
| 3844 |
% \subsubsection{页面模板} |
| 3845 |
% \changes{v1.0}{2022/07/27}{为页面模板添加书签选项。} |
| 3846 |
% |
| 3847 |
% \begin{macrocode} |
| 3848 |
%<@@=njupage> |
| 3849 |
% \end{macrocode} |
| 3850 |
% |
| 3851 |
% \begin{macro}{\exp_args:NVV} |
| 3852 |
% \begin{macrocode} |
| 3853 |
\exp_args_generate:n { NVV } |
| 3854 |
% \end{macrocode} |
| 3855 |
% \end{macro} |
| 3856 |
% |
| 3857 |
% \begin{macro}{\@@_bookmark:nn} |
| 3858 |
% 声明页面模板接口。 |
| 3859 |
% 页面是元素的集合。一个抽象的页面应当具备以下属性: |
| 3860 |
% \begin{description} |
| 3861 |
% \item[\opt{element}] 包含的元素,这里使用的是名称列表 |
| 3862 |
% \item[\opt{prefix}] 元素名称前缀 |
| 3863 |
% \item[\opt{format}] 格式,例如行距 |
| 3864 |
% \item[\opt{top-skip}] 上间距,即与页面顶部的距离 |
| 3865 |
% \item[\opt{bottom-skip}] 下间距,即与页面底部的距离 |
| 3866 |
% \item[\opt{bm-text}] PDF 书签名称 |
| 3867 |
% \item[\opt{bm-name}] PDF 书签锚点名 |
| 3868 |
% \item[\opt{bookmark}] 添加书签的类型,分别为目录条目、仅 PDF 书签、不显示。 |
| 3869 |
% \end{description} |
| 3870 |
% \begin{macrocode} |
| 3871 |
\DeclareTemplateInterface { nju } { page } { \c_zero_int } |
| 3872 |
{ |
| 3873 |
element : commalist = \c_empty_clist, |
| 3874 |
prefix : tokenlist = \c_empty_tl, |
| 3875 |
format : tokenlist = \c_empty_tl, |
| 3876 |
top-skip : skip = \c_zero_skip, |
| 3877 |
bottom-skip : skip = \c_zero_skip, |
| 3878 |
bm-text : tokenlist = \c_empty_tl, |
| 3879 |
bm-name : tokenlist = \c_empty_tl, |
| 3880 |
bookmark : choice { toc, pdf, none } = none |
| 3881 |
} |
| 3882 |
% \end{macrocode} |
| 3883 |
% |
| 3884 |
% 声明页面模板代码。 |
| 3885 |
% \begin{macrocode} |
| 3886 |
\DeclareTemplateCode { nju } { page } { \c_zero_int } |
| 3887 |
{ |
| 3888 |
element = \l_@@_element_clist, |
| 3889 |
prefix = \l_@@_prefix_tl, |
| 3890 |
format = \l_@@_format_tl, |
| 3891 |
top-skip = \l_@@_top_skip, |
| 3892 |
bottom-skip = \l_@@_bottom_skip, |
| 3893 |
bm-text = \l_@@_bm_text_tl, |
| 3894 |
bm-name = \l_@@_bm_name_tl, |
| 3895 |
bookmark = |
| 3896 |
{ |
| 3897 |
toc = { \cs_set_eq:NN \@@_bookmark:nn \__nju_bookmark_toc:nn }, |
| 3898 |
pdf = { \cs_set_eq:NN \@@_bookmark:nn \__nju_bookmark_pdf:nn }, |
| 3899 |
none = { \cs_set:Nn \@@_bookmark:nn { } } |
| 3900 |
} |
| 3901 |
} |
| 3902 |
{ |
| 3903 |
\AssignTemplateKeys |
| 3904 |
\clearpage |
| 3905 |
\thispagestyle { empty } |
| 3906 |
% \end{macrocode} |
| 3907 |
% 由于起始位置没有内容,\tn{vspace*} 会使第一个元素的位置与上边距有一定距离。 |
| 3908 |
% \begin{macrocode} |
| 3909 |
\__nju_vskip:N \l_@@_top_skip |
| 3910 |
\exp_args:NVV \@@_bookmark:nn |
| 3911 |
\l_@@_bm_text_tl \l_@@_bm_name_tl |
| 3912 |
\group_begin: |
| 3913 |
\l_@@_format_tl |
| 3914 |
\clist_map_inline:Nn \l_@@_element_clist |
| 3915 |
{ \UseInstance { nju } { \l_@@_prefix_tl ##1 } } |
| 3916 |
\group_end: |
| 3917 |
\__nju_vskip:N \l_@@_bottom_skip |
| 3918 |
} |
| 3919 |
% \end{macrocode} |
| 3920 |
% \end{macro} |
| 3921 |
% |
| 3922 |
% \subsubsection{外部接口} |
| 3923 |
% |
| 3924 |
% \begin{macro}{\@@_declare_element:nn,\@@_declare_page:nn} |
| 3925 |
% 封装 \pkg{xtemplate} 提供的函数,简化创建实例的过程。 |
| 3926 |
% \begin{arguments} |
| 3927 |
% \item 实例名称 |
| 3928 |
% \item 参数列表 |
| 3929 |
% \end{arguments} |
| 3930 |
% \begin{macrocode} |
| 3931 |
%<@@=nju> |
| 3932 |
\cs_new:Npn \@@_declare_element:nn #1#2 |
| 3933 |
{ \DeclareInstance { nju } {#1} { element } {#2} } |
| 3934 |
\cs_new:Npn \@@_declare_page:nn #1#2 |
| 3935 |
{ \DeclareInstance { nju } {#1} { page } {#2} } |
| 3936 |
% \end{macrocode} |
| 3937 |
% \end{macro} |
| 3938 |
% |
| 3939 |
% |
| 3940 |
% \subsection{提示信息} |
| 3941 |
% \changes{v1.1}{2022/12/03}{整理提示信息。} |
| 3942 |
% |
| 3943 |
% 本节集中定义模板中的错误信息。 |
| 3944 |
% \begin{macrocode} |
| 3945 |
\@@_msg:nn { abs-title-too-long } |
| 3946 |
{ |
| 3947 |
Your~ title~ seems~ too~ long~ to~ fit~ in~ two~ lines.\\ |
| 3948 |
I~ have~ drawn~ additional~ lines~ to~ contain~ it,~ |
| 3949 |
which~ will~ probably~ make~ your~ abstract~ page~ |
| 3950 |
look~ slightly~ different~ from~ the~ standard.~ |
| 3951 |
You~ can~ use~ the~ "abstract/title-style"~ key~ |
| 3952 |
to~ disable~ this~ message. |
| 3953 |
} |
| 3954 |
\@@_msg:nn { empty-theorem-type } |
| 3955 |
{ |
| 3956 |
Empty~ theorem~ list~ to~ define.\\ |
| 3957 |
The~ key~ "theorem/type"~ should~ not~ be~ left~ empty. |
| 3958 |
} |
| 3959 |
\@@_msg:nn { load-config } |
| 3960 |
{ I~ am~ loading~ config~ file~ "#1". } |
| 3961 |
\@@_msg:nn { missing-ntheorem } |
| 3962 |
{ |
| 3963 |
"ntheorem"~ package~ not~ detected.\\ |
| 3964 |
The~ functionality~ of~ built-in~ theorem~ settings~ |
| 3965 |
requires~ loading~ the~ class~ with~ "ntheorem"~ option~ |
| 3966 |
set~ to~ "true". |
| 3967 |
} |
| 3968 |
\@@_msg:nn { missing-stzhongs } |
| 3969 |
{ |
| 3970 |
"STZHONGS.TTF"~ is~ not~ found~ in~ your~ system.\\ |
| 3971 |
The~ font~ is~ normally~ distributed~ with~ MS~ Windows.~ |
| 3972 |
I~ have~ used~ songti~ for~ substitution. |
| 3973 |
} |
| 3974 |
\@@_msg:nn { missing-symbol } |
| 3975 |
{ |
| 3976 |
\string\mdwhtsquare\ and~ \string\checkmark\ are~ not~ |
| 3977 |
contained~ in~ the~ standard~ amsmath~ package.~ You~ |
| 3978 |
should~ redefine~ them~ with~ other~ packages~ loaded~ |
| 3979 |
to~ properly~ generate~ the~ declaration~ page. |
| 3980 |
} |
| 3981 |
\@@_msg:nn { missing-title } |
| 3982 |
{ |
| 3983 |
Thesis~ title~ should~ not~ be~ left~ blank.\\ |
| 3984 |
Please~ check~ whether~ you~ have~ fill~ in~ |
| 3985 |
both Chinese~ and~ English~ titles. |
| 3986 |
} |
| 3987 |
\@@_msg:nn { no-small-caps } |
| 3988 |
{ |
| 3989 |
I~ am~ using~ TeX~ Gyre~ Termes~ as~ default~ Roman~ font.\\ |
| 3990 |
This~ is~ because~ the~ "Times~ New~ Roman"~ font~ in~ your~ |
| 3991 |
system~ does~ not~ embed~ glyphs~ for~ small~ capitals.~ |
| 3992 |
You~ can~ ignore~ this~ warning~ if~ you~ do~ not~ need~ |
| 3993 |
\string\textsc.~ For~ more~ information,~ |
| 3994 |
please~ refer~ to~ section~ 3.2.6~ of~ the~ documentation. |
| 3995 |
} |
| 3996 |
\@@_msg:nn { package-too-old } |
| 3997 |
{ |
| 3998 |
Package~ "#1"~ is~ too~ old.\\ |
| 3999 |
The~ "njuthesis"~ class only~ supports~ "#1"~ with~ |
| 4000 |
a~ version~ higher~ than~ v#2.~ |
| 4001 |
Please~ update~ an~ up-to-date~ version~ of~ it~ |
| 4002 |
using~ your~ TeX~ package~ manager~ or~ from~ CTAN. |
| 4003 |
} |
| 4004 |
\@@_msg:nn { package-conflict } |
| 4005 |
{ |
| 4006 |
The~ "#2"~ package~ is~ incompatible~ with~ "#1".\\ |
| 4007 |
I~ have~ loaded~ "#1"~ by~ default.~ Maybe~ You~ should~ |
| 4008 |
refer~ to~ section~ 4~ of~ the~ documentation. |
| 4009 |
} |
| 4010 |
% \end{macrocode} |
| 4011 |
% |
| 4012 |
% |
| 4013 |
% \subsection{模板选项} |
| 4014 |
% \changes{v0.11}{2021/11/15}{进行了效率优化。} |
| 4015 |
% |
| 4016 |
% \begin{macro}{\@@_pass_option_to_ctexbook:n,\@@_pass_option_to_ctexbook:V} |
| 4017 |
% 封装 \LaTeXe{} 传参函数。注意参数顺序有变化。 |
| 4018 |
% \begin{macrocode} |
| 4019 |
\cs_new_protected:Npn \@@_pass_option_to_ctexbook:n #1 |
| 4020 |
{ \PassOptionsToClass {#1} { ctexbook } } |
| 4021 |
\cs_generate_variant:Nn \@@_pass_option_to_ctexbook:n { V } |
| 4022 |
% \end{macrocode} |
| 4023 |
% \end{macro} |
| 4024 |
% |
| 4025 |
% \begin{macro}{\@@_pass_option_to_ctexbook:} |
| 4026 |
% \begin{macrocode} |
| 4027 |
\cs_new_protected:Npn \@@_pass_option_to_ctexbook: |
| 4028 |
{ \@@_pass_option_to_ctexbook:V \l_keys_key_str } |
| 4029 |
% \end{macrocode} |
| 4030 |
% \end{macro} |
| 4031 |
% |
| 4032 |
%% \changes{v1.5.0}{2026/05/12}{文档类选项的名空间重命名为 \opt{thu/option}。} |
| 4033 |
% \begin{macrocode} |
| 4034 |
\keys_define:nn { nju / option } |
| 4035 |
{ |
| 4036 |
% \end{macrocode} |
| 4037 |
% |
| 4038 |
% \begin{macro}{type} |
| 4039 |
% \changes{v1.0}{2022/06/30}{修改类型选项。} |
| 4040 |
% 学位,默认为学士。 |
| 4041 |
% \begin{macrocode} |
| 4042 |
type .choices:nn = { bachelor, master, doctor, postdoc } |
| 4043 |
{ \int_gset_eq:NN \g_@@_info_type_int \l_keys_choice_int }, |
| 4044 |
type .initial:n = bachelor, |
| 4045 |
% \end{macrocode} |
| 4046 |
% \end{macro} |
| 4047 |
% |
| 4048 |
% \begin{macro}{degree} |
| 4049 |
% \changes{v1.0}{2022/06/30}{修改学位选项。} |
| 4050 |
% 研究生的学位类型,默认为学术学位。 |
| 4051 |
% \begin{macrocode} |
| 4052 |
degree .choice:, |
| 4053 |
degree / academic .code:n = |
| 4054 |
{ \bool_gset_true:N \g_@@_opt_academic_bool }, |
| 4055 |
degree / professional .code:n = |
| 4056 |
{ \bool_gset_false:N \g_@@_opt_academic_bool }, |
| 4057 |
degree .initial:n = academic, |
| 4058 |
% \end{macrocode} |
| 4059 |
% \end{macro} |
| 4060 |
% |
| 4061 |
% \begin{macro}{nl-cover,\g_@@_opt_nlcover_bool} |
| 4062 |
% 是否需要国家图书馆封面。本选项仅用于研究生模板,默认关闭。 |
| 4063 |
% \footnote{nl 代表 National Library。} |
| 4064 |
% \begin{macrocode} |
| 4065 |
nl-cover .bool_gset:N = \g_@@_opt_nlcover_bool, |
| 4066 |
nl-cover .initial:n = false, |
| 4067 |
% \end{macrocode} |
| 4068 |
% \end{macro} |
| 4069 |
% |
| 4070 |
% \begin{macro}{decl-page,\g_@@_opt_decl_bool} |
| 4071 |
% \changes{v0.13}{2021/12/15}{新增诚信承诺书选项。} |
| 4072 |
% \changes{v0.14}{2022/01/06}{修改选项名称。} |
| 4073 |
% 是否需要诚信承诺书或原创性声明(默认关闭)。 |
| 4074 |
% \footnote{原创性声明的英文翻译为 Declaration of Originality, |
| 4075 |
% 为了使选项表义更清晰同时缩减名称长度,将其修改为“声明页”这一名称。} |
| 4076 |
% \begin{macrocode} |
| 4077 |
decl-page .bool_gset:N = \g_@@_opt_decl_bool, |
| 4078 |
decl-page .initial:n = false, |
| 4079 |
% \end{macrocode} |
| 4080 |
% \end{macro} |
| 4081 |
% |
| 4082 |
% \begin{macro}{draft} |
| 4083 |
% \changes{v0.13}{2021/12/15}{新增草稿模式选项。} |
| 4084 |
% \changes{v1.4}{2024/03/19}{草稿模式选项不接受传入值。} |
| 4085 |
% 是否开启草稿模式(默认关闭)。 |
| 4086 |
% \begin{macrocode} |
| 4087 |
draft .value_forbidden:n = true, |
| 4088 |
draft .code:n = |
| 4089 |
{ |
| 4090 |
\bool_gset_true:N \g_@@_opt_draft_bool |
| 4091 |
\@@_pass_option_to_ctexbook: |
| 4092 |
}, |
| 4093 |
% \end{macrocode} |
| 4094 |
% \end{macro} |
| 4095 |
% |
| 4096 |
% \begin{macro}{oneside,twoside} |
| 4097 |
% \changes{v0.14}{2022/01/14}{新增单双面模式选项。} |
| 4098 |
% \changes{v1.5.0}{2026/04/11}{单双面模式选项沿用 \LaTeXe 的实现。} |
| 4099 |
% \begin{macrocode} |
| 4100 |
oneside .value_forbidden:n = true, |
| 4101 |
twoside .value_forbidden:n = true, |
| 4102 |
oneside .code:n = { \@@_pass_option_to_ctexbook: }, |
| 4103 |
twoside .code:n = { \@@_pass_option_to_ctexbook: }, |
| 4104 |
% \end{macrocode} |
| 4105 |
% \end{macro} |
| 4106 |
% |
| 4107 |
% \begin{macro}{anonymous} |
| 4108 |
% \changes{v0.18}{2022/04/19}{新增盲审模式选项。} |
| 4109 |
% \changes{v1.0}{2022/07/05}{重命名盲审模式选项。} |
| 4110 |
% \changes{v1.4}{2024/04/19}{盲审模式选项不接受传入值。} |
| 4111 |
% \begin{macro}{\g_@@_opt_anon_bool} |
| 4112 |
% 盲审模式。 |
| 4113 |
% \begin{macrocode} |
| 4114 |
anonymous .value_forbidden:n = true, |
| 4115 |
anonymous .bool_gset:N = \g_@@_opt_anon_bool, |
| 4116 |
anonymous .initial:n = false, |
| 4117 |
% \end{macrocode} |
| 4118 |
% \end{macro} |
| 4119 |
% \end{macro} |
| 4120 |
% |
| 4121 |
% \begin{macro}{latin-font,cjk-font} |
| 4122 |
% \changes{v0.14}{2021/12/12}{简化字体选项名称。} |
| 4123 |
% 中英文字体选项。\opt{fandol} 和 \opt{gyre} 是等价的。 |
| 4124 |
% \begin{macrocode} |
| 4125 |
latin-font .choices:nn = |
| 4126 |
{ fandol, gyre, mac, macoffice, win, none } |
| 4127 |
{ \tl_gset:Nn \g_@@_font_latin_tl {#1} }, |
| 4128 |
cjk-font .choices:nn = |
| 4129 |
{ fandol, founder, mac, macoffice, noto, source, win, none } |
| 4130 |
{ \tl_gset:Nn \g_@@_font_cjk_tl {#1} }, |
| 4131 |
% \end{macrocode} |
| 4132 |
% \end{macro} |
| 4133 |
% |
| 4134 |
% \begin{macro}{latin-font,cjk-font} |
| 4135 |
% \changes{v1.4}{2023/12/15}{增加统一的字体选项名称。} |
| 4136 |
% 中英文字体选项。\opt{fontset} 这个名称和 \pkg{ctex} 是一致的。 |
| 4137 |
% \begin{macrocode} |
| 4138 |
fontset .choices:nn = |
| 4139 |
{ fandol, mac, macoffice, win, none } |
| 4140 |
{ \keys_set:nn { nju / option } { latin-font = #1, cjk-font = #1 } }, |
| 4141 |
% \end{macrocode} |
| 4142 |
% \end{macro} |
| 4143 |
% |
| 4144 |
% \begin{macro}{math-font} |
| 4145 |
% \changes{v1.0}{2022/07/02}{增加数学字库选择功能。} |
| 4146 |
% 数学字体选项。 |
| 4147 |
% 由 \pkg{unicode-math} 指定 \XeTeX 和 \LuaTeX 下使用的数学字体。 |
| 4148 |
% \begin{macrocode} |
| 4149 |
math-font .choices:nn = |
| 4150 |
{ |
| 4151 |
asana, cambria, fira, garamond, lm, libertinus, newcm, |
| 4152 |
stix, bonum, dejavu, pagella, schola, termes, xits, none |
| 4153 |
} |
| 4154 |
{ \tl_gset_eq:NN \g_@@_font_math_tl \l_keys_choice_tl }, |
| 4155 |
math-font .initial:n = xits, |
| 4156 |
% \end{macrocode} |
| 4157 |
% \end{macro} |
| 4158 |
% |
| 4159 |
% \begin{macro}{font-path} |
| 4160 |
% 独立字体文件的路径。 |
| 4161 |
% \begin{macrocode} |
| 4162 |
font-path .code:n = |
| 4163 |
{ |
| 4164 |
\bool_gset_true:N \g_@@_font_path_bool |
| 4165 |
\tl_gset_eq:NN \g_@@_font_path_tl \l_keys_value_tl |
| 4166 |
}, |
| 4167 |
% \end{macrocode} |
| 4168 |
% \end{macro} |
| 4169 |
% |
| 4170 |
% \begin{macro}{config,\g_@@_config_clist} |
| 4171 |
% \changes{v0.16}{2022/02/23}{新增 \opt{config} 选项。} |
| 4172 |
% 配置文件路径。 |
| 4173 |
% \begin{macrocode} |
| 4174 |
config .clist_gset:N = \g_@@_config_clist |
| 4175 |
} |
| 4176 |
% \end{macrocode} |
| 4177 |
% \end{macro} |
| 4178 |
% |
| 4179 |
% \begin{macro}{zihao} |
| 4180 |
% \changes{v1.0}{2022/07/04}{新增字号选项。} |
| 4181 |
% \changes{v1.5.0}{2026/04/12}{字号选项沿用 \cls{ctex} 的实现。} |
| 4182 |
% 字号。默认为小四号。 |
| 4183 |
% \begin{macrocode} |
| 4184 |
\@@_pass_option_to_ctexbook:n { zihao = -4 } |
| 4185 |
% \end{macrocode} |
| 4186 |
% \end{macro} |
| 4187 |
% |
| 4188 |
% \begin{macro}{linespread} |
| 4189 |
% \changes{v1.0}{2022/07/04}{新增行距选项。} |
| 4190 |
% \changes{v1.5.0}{2026/04/12}{行距选项沿用 \cls{ctex} 的实现。} |
| 4191 |
% 行距。\LaTeX 默认1.2行距,MS Word 默认行距是1.3,要求1.5倍 |
| 4192 |
% Word 行距,故默认值为 $1.5\times\frac{1.3}{1.2} = 1.625$。 |
| 4193 |
% 更详细的说明请参考 \pkg{zhlineskip} 宏包文档。 |
| 4194 |
% \begin{macrocode} |
| 4195 |
\@@_pass_option_to_ctexbook:n { linespread = 1.625 } |
| 4196 |
% \end{macrocode} |
| 4197 |
% \end{macro} |
| 4198 |
% |
| 4199 |
% \begin{macro}{\g_@@_name_optional_pkg_clist} |
| 4200 |
% \begin{macrocode} |
| 4201 |
\clist_new:N \g_@@_name_optional_pkg_clist |
| 4202 |
% \end{macrocode} |
| 4203 |
% \end{macro} |
| 4204 |
% |
| 4205 |
% \begin{macro}{\@@_define_pkg_keys:nnn} |
| 4206 |
% \begin{arguments} |
| 4207 |
% \item 宏包名 |
| 4208 |
% \item 简写名称,一般为宏包使用的名空间 |
| 4209 |
% \item 是否默认载入 |
| 4210 |
% \end{arguments} |
| 4211 |
% 定义是否载入宏包的的文档类选项,以及相应的载入命令。 |
| 4212 |
% \begin{macrocode} |
| 4213 |
\cs_new_protected:Npn \@@_define_pkg_keys:nnn #1#2#3 |
| 4214 |
{ |
| 4215 |
\keys_define:nn { nju / option } |
| 4216 |
{ |
| 4217 |
#1 .bool_gset:c = { g_@@_opt_load_ #2 _bool }, |
| 4218 |
#1 .initial:n = #3 |
| 4219 |
} |
| 4220 |
\cs_new_protected:cpn { @@_loadpkg_ #2 : } |
| 4221 |
{ |
| 4222 |
\bool_if:cT { g_@@_opt_load_ #2 _bool } |
| 4223 |
{ \RequirePackage {#1} } |
| 4224 |
} |
| 4225 |
\clist_gput_right:Nn \g_@@_name_optional_pkg_clist {#1} |
| 4226 |
} |
| 4227 |
% \end{macrocode} |
| 4228 |
% \end{macro} |
| 4229 |
% |
| 4230 |
% \begin{macro}{ |
| 4231 |
% biblatex, |
| 4232 |
% cleveref, |
| 4233 |
% enumitem, |
| 4234 |
% footmisc, |
| 4235 |
% ntheorem, |
| 4236 |
% unicode-math, |
| 4237 |
% \g_@@_opt_load_blx_bool, |
| 4238 |
% \g_@@_opt_load_cref_bool, |
| 4239 |
% \g_@@_opt_load_nthm_bool, |
| 4240 |
% \g_@@_opt_load_enit_bool, |
| 4241 |
% \g_@@_opt_load_fm_bool, |
| 4242 |
% \g_@@_opt_load_um_bool, |
| 4243 |
% \@@_loadpkg_blx:, |
| 4244 |
% \@@_loadpkg_cref:, |
| 4245 |
% \@@_loadpkg_enit:, |
| 4246 |
% \@@_loadpkg_fm:, |
| 4247 |
% \@@_loadpkg_nthm:, |
| 4248 |
% \@@_loadpkg_um:} |
| 4249 |
% \begin{macrocode} |
| 4250 |
\clist_map_inline:nn |
| 4251 |
{ |
| 4252 |
{ biblatex } { blx } { true }, |
| 4253 |
{ cleveref } { cref } { true }, |
| 4254 |
{ ntheorem } { nthm } { true }, |
| 4255 |
{ enumitem } { enit } { true }, |
| 4256 |
{ footmisc } { fm } { true }, |
| 4257 |
{ unicode-math } { um } { true } |
| 4258 |
} |
| 4259 |
{ \@@_define_pkg_keys:nnn #1 } |
| 4260 |
% \end{macrocode} |
| 4261 |
% \end{macro} |
| 4262 |
% |
| 4263 |
% \begin{macro}{minimal} |
| 4264 |
% \changes{v1.0}{2022/08/03}{新增最小化载入宏包选项。} |
| 4265 |
% 最小化模式,不载入进行功能拓展的额外宏包。 |
| 4266 |
% \begin{macrocode} |
| 4267 |
\keys_define:nn { nju / option } |
| 4268 |
{ |
| 4269 |
minimal .value_forbidden:n = true, |
| 4270 |
minimal .code:n = |
| 4271 |
{ |
| 4272 |
\clist_map_inline:Nn \g_@@_name_optional_pkg_clist |
| 4273 |
{ \keys_set:nn { nju / option } { ##1 = false } } |
| 4274 |
\keys_set:nn { nju / option } { math-font = none } |
| 4275 |
} |
| 4276 |
} |
| 4277 |
% \end{macrocode} |
| 4278 |
% \end{macro} |
| 4279 |
% |
| 4280 |
% 获取输入的文档类选项。 |
| 4281 |
% \begin{macrocode} |
| 4282 |
\ProcessKeysOptions { nju / option } |
| 4283 |
% \end{macrocode} |
| 4284 |
% |
| 4285 |
% \changes{v1.1}{2022/09/26}{盲审模式下不显示声明页。} |
| 4286 |
% \changes{v1.5.0}{2026/05/12}{在吸收文档类选项后立即处理盲审模式声明页选项。} |
| 4287 |
% 盲审模式下不显示声明页。 |
| 4288 |
% 需要在处理文档类选项后立即操作,使得传递给封面钩子的代码正确。 |
| 4289 |
% \begin{macrocode} |
| 4290 |
\bool_if:NT \g_@@_opt_anon_bool |
| 4291 |
{ \keys_set:nn { nju / option } { decl-page = false } } |
| 4292 |
% \end{macrocode} |
| 4293 |
% |
| 4294 |
% |
| 4295 |
% \subsection{用户接口} |
| 4296 |
% |
| 4297 |
% \begin{macro}{\@@_keys_set_exclude_groups:nnn} |
| 4298 |
% \changes{v1.5.0}{2026/05/01}{替换被弃用的 \cs{keys_set_filter:nnn}。} |
| 4299 |
% 兼容旧版 \pkg{l3kernel} 的键分组过滤接口。 |
| 4300 |
% \begin{macrocode} |
| 4301 |
\cs_if_exist:NTF \keys_set_exclude_groups:nnn |
| 4302 |
{ |
| 4303 |
\cs_new_eq:NN \@@_keys_set_exclude_groups:nnn |
| 4304 |
\keys_set_exclude_groups:nnn |
| 4305 |
} |
| 4306 |
{ |
| 4307 |
\cs_new_protected:Npn \@@_keys_set_exclude_groups:nnn #1#2#3 |
| 4308 |
{ \use:c { keys_set_filter:nnn } {#1} {#2} {#3} } |
| 4309 |
} |
| 4310 |
\cs_generate_variant:Nn \@@_keys_set_exclude_groups:nnn { nVn } |
| 4311 |
% \end{macrocode} |
| 4312 |
% \end{macro} |
| 4313 |
% |
| 4314 |
% \begin{macro}{\@@_keys_set:nn} |
| 4315 |
% \changes{v1.1}{2022/09/26}{使用键分组过滤重构盲审模式。} |
| 4316 |
% 根据文档类选项收集需要屏蔽的键分组,再定义设置命令。 |
| 4317 |
% \begin{macrocode} |
| 4318 |
\bool_if:NT \g_@@_opt_anon_bool |
| 4319 |
{ \clist_gput_right:Nn \g_@@_keys_excl_clist { anonymous } } |
| 4320 |
\bool_if:NF \g_@@_opt_load_um_bool |
| 4321 |
{ \clist_gput_right:Nn \g_@@_keys_excl_clist { unicode-math } } |
| 4322 |
\clist_if_empty:NTF \g_@@_keys_excl_clist |
| 4323 |
{ \cs_new_eq:NN \@@_keys_set:nn \keys_set:nn } |
| 4324 |
{ |
| 4325 |
\cs_new_protected:Npn \@@_keys_set:nn #1#2 |
| 4326 |
{ \@@_keys_set_exclude_groups:nVn {#1} \g_@@_keys_excl_clist {#2} } |
| 4327 |
} |
| 4328 |
% \end{macrocode} |
| 4329 |
% \end{macro} |
| 4330 |
% |
| 4331 |
% \begin{macro}{abstract, anonymous-mode, bib, image, footer, |
| 4332 |
% footnote, header, info, label-sep, listoffigures, listoftables, |
| 4333 |
% math, style, theorem, tableofcontents} |
| 4334 |
% 定义模块名的键值对。模块键调用 \cs{@@_keys_set:nn} 以保留盲审模式 |
| 4335 |
% 下的分组过滤。 |
| 4336 |
% \begin{macrocode} |
| 4337 |
\clist_map_inline:nn |
| 4338 |
{ |
| 4339 |
abstract, anonymous-mode, bib, image, footer, footnote, |
| 4340 |
header, info, label-sep, listoffigures, listoftables, |
| 4341 |
math, style, theorem, tableofcontents |
| 4342 |
} |
| 4343 |
{ |
| 4344 |
\keys_define:nn { nju } |
| 4345 |
{ #1 .code:n = { \@@_keys_set:nn { nju / #1 } {##1} } } |
| 4346 |
} |
| 4347 |
% \end{macrocode} |
| 4348 |
% \end{macro} |
| 4349 |
% |
| 4350 |
% \begin{macro}{\njusetup} |
| 4351 |
% \changes{v0.6}{2021/09/10}{改用键值对输入信息。} |
| 4352 |
% \changes{v1.0}{2022/08/01}{增加输入键路径的可选参数。} |
| 4353 |
% \changes{v1.5.0}{2026/05/01}{统一 \tn{njusetup} 可选参数的键路径处理。} |
| 4354 |
% 定义设置接口。 |
| 4355 |
% \begin{arguments} |
| 4356 |
% \item 可选的键路径 |
| 4357 |
% \item 设置项 |
| 4358 |
% \end{arguments} |
| 4359 |
% \cls{njuthesis} 的键值对设置一共三层:最外层为指示名空间的 |
| 4360 |
% \opt{nju},第二层为上方设定的模块名称,最内层为具体设置项。 |
| 4361 |
% 在路径留空时,本接口仅使用最外层名空间,向下兼容旧版设置; |
| 4362 |
% 在路径填入模块名时,第二个参数为键值对类型,可以减少一层缩进; |
| 4363 |
% 在路径填入完整设置项时,第二个参数为具体的值。 |
| 4364 |
% \begin{macrocode} |
| 4365 |
\NewDocumentCommand \njusetup { o m } |
| 4366 |
{ |
| 4367 |
\tl_if_novalue:nTF {#1} |
| 4368 |
{ \@@_keys_set:nn { nju } {#2} } |
| 4369 |
{ \@@_keys_set:nn { nju } { #1 = {#2} } } |
| 4370 |
} |
| 4371 |
% \end{macrocode} |
| 4372 |
% \end{macro} |
| 4373 |
% \tn{njusetup} 仅能在导言区使用。 |
| 4374 |
% \begin{macrocode} |
| 4375 |
\@onlypreamble \njusetup |
| 4376 |
% \end{macrocode} |
| 4377 |
% |
| 4378 |
% \begin{macro}{\njusetformat} |
| 4379 |
% \changes{v0.17}{2022/04/09}{提供修改默认样式的接口。} |
| 4380 |
% \changes{v0.19}{2022/05/11}{提供默认页面样式的修改方式。} |
| 4381 |
% \changes{v0.20}{2022/05/25}{提供页眉页脚样式的修改方式。} |
| 4382 |
% \changes{v0.20}{2022/05/25}{提供内置校名校徽颜色的修改方式。} |
| 4383 |
% 定义修改默认样式的接口。 |
| 4384 |
% \begin{macrocode} |
| 4385 |
\NewDocumentCommand \njusetformat { m m } |
| 4386 |
{ \tl_set:cn { l_@@_fmt_ #1 _tl } {#2} } |
| 4387 |
% \end{macrocode} |
| 4388 |
% \end{macro} |
| 4389 |
% |
| 4390 |
% \begin{macro}{\njusetlength,\njusetlength*} |
| 4391 |
% \changes{v0.17}{2022/04/09}{提供修改长度值的接口。} |
| 4392 |
% \changes{v0.18}{2022/04/20}{统一管理校名校徽尺寸。} |
| 4393 |
% 定义修改长度值的接口。可选星号表示修改弹性长度。 |
| 4394 |
% \begin{macrocode} |
| 4395 |
\NewDocumentCommand \njusetlength { s m m } |
| 4396 |
{ |
| 4397 |
\bool_if:nTF {#1} |
| 4398 |
{ \skip_set:cn { l_@@_ #2 _skip } {#3} } |
| 4399 |
{ \dim_set:cn { l_@@_ #2 _dim } {#3} } |
| 4400 |
} |
| 4401 |
% \end{macrocode} |
| 4402 |
% \end{macro} |
| 4403 |
% |
| 4404 |
% \begin{macro}{\njusetname,\njusetname*,\njusettext,\njusettext*} |
| 4405 |
% \changes{v0.17}{2022/04/01}{提供修改固定文本的接口。} |
| 4406 |
% \changes{v1.1}{2022/12/12}{修复 \tn{njusetname} 和 \tn{njusettext} 的可选参数问题。} |
| 4407 |
% 定义修改固定文本的接口。 |
| 4408 |
% \begin{macrocode} |
| 4409 |
\NewDocumentCommand \njusetname { s m O{} m } |
| 4410 |
{ \@@_set_tokenlist:nnnnn {#1} {#2} {#3} {#4} { name } } |
| 4411 |
\NewDocumentCommand \njusettext { s m O{} m } |
| 4412 |
{ \@@_set_tokenlist:nnnnn {#1} {#2} {#3} {#4} { text } } |
| 4413 |
% \end{macrocode} |
| 4414 |
% \end{macro} |
| 4415 |
% |
| 4416 |
% \begin{macro}{\@@_set_tokenlist:nnnnn} |
| 4417 |
% 用于修改名称、文字常量的辅助函数。 |
| 4418 |
% \begin{arguments} |
| 4419 |
% \item 是否含有可选星号,传入 |bool| 型变量 |
| 4420 |
% \item 被修改变量名称 |
| 4421 |
% \item 可选的变体,用字母标记 |
| 4422 |
% \item 修改后的内容 |
| 4423 |
% \item 类别,name 或者 text |
| 4424 |
% \end{arguments} |
| 4425 |
% \begin{macrocode} |
| 4426 |
\cs_new_protected:Npn \@@_set_tokenlist:nnnnn #1#2#3#4#5 |
| 4427 |
{ |
| 4428 |
\bool_if:nTF {#1} |
| 4429 |
{ \tl_set_eq:NN \l_@@_tmpb_tl \l_@@_name_suffix_en_tl } |
| 4430 |
{ \tl_clear:N \l_@@_tmpb_tl } |
| 4431 |
\tl_gset:cn { l_@@_ #5 _ #2 #3 \l_@@_tmpb_tl _tl } {#4} |
| 4432 |
} |
| 4433 |
% \end{macrocode} |
| 4434 |
% \end{macro} |
| 4435 |
% |
| 4436 |
% |
| 4437 |
% \subsection{外部宏包} |
| 4438 |
% |
| 4439 |
% \subsubsection{默认选项} |
| 4440 |
% |
| 4441 |
% \changes{v0.12}{2021/12/07}{重新组织宏包载入顺序。} |
| 4442 |
% 将选项传入 \cls{ctexbook} 文档类。 |
| 4443 |
% \begin{macrocode} |
| 4444 |
\@@_pass_option_to_ctexbook:n |
| 4445 |
{ |
| 4446 |
a4paper, |
| 4447 |
UTF8, |
| 4448 |
scheme = chinese, |
| 4449 |
% \end{macrocode} |
| 4450 |
% 默认不载入任何字体,供本模板自行设置。 |
| 4451 |
% \begin{macrocode} |
| 4452 |
fontset = none |
| 4453 |
} |
| 4454 |
% \end{macrocode} |
| 4455 |
% |
| 4456 |
% 传入各宏包选项。 |
| 4457 |
% \begin{macrocode} |
| 4458 |
\clist_map_inline:nn |
| 4459 |
{ |
| 4460 |
% \end{macrocode} |
| 4461 |
% 隐藏 |does not contain script "CJK"| 警告。 |
| 4462 |
% \begin{macrocode} |
| 4463 |
% { quiet } { xeCJK }, |
| 4464 |
{ no-math } { fontspec }, |
| 4465 |
{ perpage } { footmisc }, |
| 4466 |
{ capitalise, nameinlink, noabbrev } { cleveref }, |
| 4467 |
% \end{macrocode} |
| 4468 |
% \pkg{ntheorem} 依赖 \pkg{amsthm} 和 \pkg{thmmarks} 实现 QED 符号等功能。 |
| 4469 |
% \begin{macrocode} |
| 4470 |
{ amsmath, thmmarks, noconfig } { ntheorem } |
| 4471 |
} |
| 4472 |
{ \PassOptionsToPackage #1 } |
| 4473 |
% \end{macrocode} |
| 4474 |
% |
| 4475 |
% \subsubsection{载入文档类} |
| 4476 |
% |
| 4477 |
% 使用\pkg{ctexbook}作为基础文档类。 |
| 4478 |
% \begin{macrocode} |
| 4479 |
\LoadClass { ctexbook } [ 2018/04/01 ] |
| 4480 |
% \end{macrocode} |
| 4481 |
% |
| 4482 |
% \subsubsection{载入宏包} |
| 4483 |
% |
| 4484 |
% \changes{v0.14}{2021/12/21}{移除 \pkg{hologo}。} |
| 4485 |
% \changes{v0.15}{2022/01/17}{移除 \pkg{url}。} |
| 4486 |
% \changes{v0.13}{2021/12/13}{使用 \pkg{ntheorem} 创建定理环境, |
| 4487 |
% 移除 \pkg{amsthm} 和 \pkg{thmtools}。} |
| 4488 |
% \changes{v0.16}{2022/03/19}{不显式载入 \pkg{amsmath}。} |
| 4489 |
% \changes{v0.18}{2022/04/20}{不强制载入 \pkg{ntheorem}。} |
| 4490 |
% \changes{v1.0}{2022/07/03}{移除 \pkg{mathtools}。} |
| 4491 |
% \changes{v1.0}{2022/08/03}{选择性载入 \pkg{ntheorem}。} |
| 4492 |
% |
| 4493 |
% \begin{macrocode} |
| 4494 |
\@@_loadpkg_enit: |
| 4495 |
\@@_loadpkg_fm: |
| 4496 |
% \end{macrocode} |
| 4497 |
% 为保证 \pkg{cleveref} 在 \pkg{unicode-math} |
| 4498 |
% 缺失的情况下也能正常工作,载入了 \pkg{amsmath}。 |
| 4499 |
% \begin{macrocode} |
| 4500 |
\bool_if:NTF \g_@@_opt_load_um_bool |
| 4501 |
{ \RequirePackage { unicode-math } } |
| 4502 |
{ |
| 4503 |
\RequirePackage { amsmath } |
| 4504 |
\bool_if:NT \g_@@_opt_decl_bool |
| 4505 |
{ |
| 4506 |
\msg_warning:nn { njuthesis } { missing-symbol } |
| 4507 |
\cs_new:Npn \mdwhtsquare { } |
| 4508 |
\cs_new:Npn \checkmark { } |
| 4509 |
} |
| 4510 |
} |
| 4511 |
% \end{macrocode} |
| 4512 |
% |
| 4513 |
% 载入各种宏包。 |
| 4514 |
% \begin{macrocode} |
| 4515 |
\RequirePackage |
| 4516 |
{ |
| 4517 |
geometry, |
| 4518 |
fancyhdr, |
| 4519 |
setspace, |
| 4520 |
% \end{macrocode} |
| 4521 |
% \changes{v0.14}{2021/12/21}{移除内置的 \pkg{multirow}、\pkg{subcaption} |
| 4522 |
% 和 \pkg{wrapfig}。} |
| 4523 |
% 图片与表格。 |
| 4524 |
% \begin{macrocode} |
| 4525 |
booktabs, |
| 4526 |
caption, |
| 4527 |
graphicx, |
| 4528 |
} |
| 4529 |
\@@_loadpkg_nthm: |
| 4530 |
% \end{macrocode} |
| 4531 |
% \pkg{hyperref} 覆写了大量命令,因此需要在其他包最后载入。 |
| 4532 |
% \begin{macrocode} |
| 4533 |
\RequirePackage { hyperref } |
| 4534 |
% \end{macrocode} |
| 4535 |
% |
| 4536 |
% \changes{v1.3}{2024/01/16}{调整 \pkg{cleveref} 到 \pkg{ntheorem} 后载入。} |
| 4537 |
% \pkg{cleveref} 需要在 \pkg{ntheorem} 和 \pkg{hyperref} 后载入。 |
| 4538 |
% \begin{macrocode} |
| 4539 |
\@@_loadpkg_cref: |
| 4540 |
% \end{macrocode} |
| 4541 |
% |
| 4542 |
% 在双面模式下,使用 \pkg{emptypage} 清除空白页的页眉、页脚和页码。 |
| 4543 |
% \begin{macrocode} |
| 4544 |
\legacy_if:nT { @twoside } { \RequirePackage { emptypage } } |
| 4545 |
% \end{macrocode} |
| 4546 |
% |
| 4547 |
% \changes{v0.13}{2021/12/13}{移除会与 \pkg{ntheorem} 冲突的 \pkg{microtype}。} |
| 4548 |
% \begin{macro}{\njuline} |
| 4549 |
% 针对编译引擎,使用不同的宏包构建可以对中文正常换行的下划线命令。 |
| 4550 |
% \begin{macrocode} |
| 4551 |
\sys_if_engine_xetex:T |
| 4552 |
{ |
| 4553 |
\RequirePackage { xeCJKfntef } |
| 4554 |
\cs_new_eq:NN \njuline \CJKunderline |
| 4555 |
} |
| 4556 |
% \end{macrocode} |
| 4557 |
% \pkg{lua-ul} 中需要在结尾使用 \tn{null} 保护尾部空白。 |
| 4558 |
% \begin{macrocode} |
| 4559 |
\sys_if_engine_luatex:T |
| 4560 |
{ |
| 4561 |
\RequirePackage { lua-ul } |
| 4562 |
\NewDocumentCommand \njuline { m } { \underLine {#1} \@@_null: } |
| 4563 |
} |
| 4564 |
%</class> |
| 4565 |
% \end{macrocode} |
| 4566 |
% \end{macro} |
| 4567 |
% |
| 4568 |
% 使用 \pkg{tabularray} 绘制研究生的出版授权书。 |
| 4569 |
% \begin{macrocode} |
| 4570 |
%<def-g>\bool_if:NT \g_@@_opt_decl_bool { \RequirePackage { tabularray } } |
| 4571 |
% \end{macrocode} |
| 4572 |
% |
| 4573 |
% \subsubsection{检查宏包} |
| 4574 |
% |
| 4575 |
% \begin{macro}{\@@_check_pkg_version:nnn} |
| 4576 |
% 检查宏包版本是否过时。 |
| 4577 |
% \begin{macrocode} |
| 4578 |
%<*class> |
| 4579 |
\cs_new:Npn \@@_check_pkg_version:nnn #1#2#3 |
| 4580 |
{ |
| 4581 |
\@ifpackagelater {#1} {#2} |
| 4582 |
{ } { \msg_error:nnnn { njuthesis } { package-too-old } {#1} {#3} } |
| 4583 |
} |
| 4584 |
% \end{macrocode} |
| 4585 |
% \end{macro} |
| 4586 |
% |
| 4587 |
% 检查绘制下划线所需的 \pkg{luatexja} 包版本。该宏包在 2021-09-18 的更新 |
| 4588 |
% 解决了下划线中断问题,然而在 2021-10-24 的更新才提供了正确的内嵌日期。 |
| 4589 |
% \begin{macrocode} |
| 4590 |
\sys_if_engine_luatex:T |
| 4591 |
{ \@@_check_pkg_version:nnn { luatexja } { 2021/10/24 } { 20211024.0 } } |
| 4592 |
% \end{macrocode} |
| 4593 |
% |
| 4594 |
% \changes{v0.18}{2022/04/28}{增加宏包冲突检查。} |
| 4595 |
% \changes{v1.0}{2022/08/03}{移除 \pkg{filehook},改用 \pkg{ctex} 内置的宏包钩子。} |
| 4596 |
% |
| 4597 |
% \begin{macro}{\@@_check_pkg_conflict:nn} |
| 4598 |
% 检查用户载入的宏包是否会与预置宏包发生冲突。 |
| 4599 |
% \begin{arguments} |
| 4600 |
% \item 模板载入的宏包 |
| 4601 |
% \item 产生冲突的宏包 |
| 4602 |
% \end{arguments} |
| 4603 |
% \begin{macrocode} |
| 4604 |
\cs_new:Npn \@@_check_pkg_conflict:nn #1#2 |
| 4605 |
{ |
| 4606 |
\ctex_at_begin_package:nn {#2} |
| 4607 |
{ \msg_warning:nnnn { njuthesis } { package-conflict } {#1} {#2} } |
| 4608 |
} |
| 4609 |
% \end{macrocode} |
| 4610 |
% \end{macro} |
| 4611 |
% |
| 4612 |
% 检查数学宏包冲突。 |
| 4613 |
% \begin{macrocode} |
| 4614 |
\bool_if:NT \g_@@_opt_load_um_bool |
| 4615 |
{ |
| 4616 |
\clist_map_inline:nn |
| 4617 |
{ |
| 4618 |
amscd, amsfonts, amssymb, bbm, bm, eucal, |
| 4619 |
eufrak, mathrsfs, newtxmath, upgreek |
| 4620 |
} |
| 4621 |
{ \@@_check_pkg_conflict:nn { unicode-math } {#1} } |
| 4622 |
} |
| 4623 |
% \end{macrocode} |
| 4624 |
% |
| 4625 |
% \changes{v1.4}{2025/02/24}{提供新版 \LaTeXe{} 下兼容 \pkg{cleveref} 的补丁。} |
| 4626 |
% 新版 \LaTeXe{} 的补丁,详见 \url{https://github.com/CTeX-org/ctex-kit/issues/725}。 |
| 4627 |
% \begin{macrocode} |
| 4628 |
\bool_if:NT \g_@@_opt_load_cref_bool |
| 4629 |
{ |
| 4630 |
\@ifl@t@r \fmtversion { 2024/11/01 } |
| 4631 |
{ |
| 4632 |
\ctex_at_end_package:nn { cleveref } |
| 4633 |
{ |
| 4634 |
\__ctex_cleveref_hook_aux:N \refstepcounter@noarg |
| 4635 |
\hook_gput_code:nnn { begindocument/end } { ctex } |
| 4636 |
{ |
| 4637 |
\cs_if_exist:NT \firstaid@cref@updatelabeldata |
| 4638 |
{ \__ctex_cleveref_hook_aux:N \firstaid@cref@updatelabeldata } |
| 4639 |
} |
| 4640 |
} |
| 4641 |
} { } |
| 4642 |
} |
| 4643 |
% \end{macrocode} |
| 4644 |
% |
| 4645 |
% |
| 4646 |
% \subsection{钩子机制} |
| 4647 |
% \changes{v1.5.0}{2026/04/24}{将封面执行逻辑拆解为三个钩子。} |
| 4648 |
% \changes{v1.5.0}{2026/05/06}{新增封底钩子。} |
| 4649 |
% |
| 4650 |
% \begin{macro}{ |
| 4651 |
% njuthesis/cover/begin, |
| 4652 |
% njuthesis/cover/body, |
| 4653 |
% njuthesis/cover/end, |
| 4654 |
% njuthesis/cover/back} |
| 4655 |
% 封面流程钩子。由于默认配置文件会向这些钩子添加代码, |
| 4656 |
% 需要在载入配置文件前先行声明。 |
| 4657 |
% 名称中的 |.| 代表本模板名 \cls{njuthesis}。 |
| 4658 |
% 命名逻辑为,钩子名代表模块下的逻辑位置,而标签概括实际执行的功能。 |
| 4659 |
% \begin{macrocode} |
| 4660 |
\hook_new:n { . / cover / begin } |
| 4661 |
\hook_new:n { . / cover / body } |
| 4662 |
\hook_new:n { . / cover / end } |
| 4663 |
\hook_new:n { . / cover / back } |
| 4664 |
% \end{macrocode} |
| 4665 |
% |
| 4666 |
% 设置标签的默认规则,规定主封面代码始终在承诺书前执行。 |
| 4667 |
% \begin{macrocode} |
| 4668 |
\hook_gset_rule:nnnn { . / cover / body } { main } < { decl-i } |
| 4669 |
% \end{macrocode} |
| 4670 |
% \end{macro} |
| 4671 |
% |
| 4672 |
% |
| 4673 |
% \subsection{配置文件} |
| 4674 |
% |
| 4675 |
% \cls{njuthesis} 包含三套区别较大的模板配置,分别适用于\emph{本科生}、 |
| 4676 |
% \emph{研究生}和\emph{博士后}。出于定义的简洁起见,本模板将其不同之处 |
| 4677 |
% 拆分为单独的参数配置文件,编译过程中将会根据导言区设置的类型选项,载 |
| 4678 |
% 入对应默认配置。注意,尽管在手册中封面、摘要、常量等的代码实现位于靠 |
| 4679 |
% 后部分,拆分后实际上是在此处载入运行的,务必要注意处理的逻辑顺序。 |
| 4680 |
% \begin{macrocode} |
| 4681 |
\exp_args:Ne \file_input:n |
| 4682 |
{ |
| 4683 |
njuthesis- |
| 4684 |
\int_case:nn { \g_@@_info_type_int } |
| 4685 |
{ |
| 4686 |
{ 1 } { undergraduate } |
| 4687 |
{ 2 } { graduate } |
| 4688 |
{ 3 } { graduate } |
| 4689 |
{ 4 } { postdoctoral } |
| 4690 |
} |
| 4691 |
.def |
| 4692 |
} |
| 4693 |
% \end{macrocode} |
| 4694 |
% |
| 4695 |
% 载入用户设置,可用于对模板做额外修改。 |
| 4696 |
% \begin{macrocode} |
| 4697 |
\clist_map_inline:Nn \g_@@_config_clist |
| 4698 |
{ |
| 4699 |
\msg_info:nnn { njuthesis } { load-config } {#1} |
| 4700 |
\file_input:n {#1} |
| 4701 |
} |
| 4702 |
% \end{macrocode} |
| 4703 |
% |
| 4704 |
% |
| 4705 |
% \subsection{个人信息} |
| 4706 |
% \changes{v0.11}{2021/10/01}{将个人信息变量名改为小写字母加连字符的形式。} |
| 4707 |
% \changes{v0.15}{2022/01/22}{将个人信息设置移到载入宏包后。} |
| 4708 |
% |
| 4709 |
% \begin{macrocode} |
| 4710 |
\keys_define:nn { nju / info } |
| 4711 |
{ |
| 4712 |
% \end{macrocode} |
| 4713 |
% |
| 4714 |
% \begin{macro}{info/title,info/title*} |
| 4715 |
% \changes{v0.13}{2021/12/12}{简化多行标题的输入方式。} |
| 4716 |
% \changes{v0.14}{2022/01/14}{将标题断行控制符修改为 |\\|。} |
| 4717 |
% 题目。中文题目可使用 |\\| 手动断行。以下标注星号(|*|)的皆为对应的英文字段。 |
| 4718 |
% \begin{macrocode} |
| 4719 |
title .tl_gset:N = \g_@@_info_title_tl , |
| 4720 |
title .initial:n = { 空 } , |
| 4721 |
title* .tl_gset:N = \g_@@_info_title_en_tl , |
| 4722 |
title* .initial:n = { Empty } , |
| 4723 |
% \end{macrocode} |
| 4724 |
% \end{macro} |
| 4725 |
% |
| 4726 |
% \begin{macro}{info/keywords,info/keywords*} |
| 4727 |
% \changes{v0.11}{2021/10/01}{修改了添加关键词的方式。} |
| 4728 |
% 关键词列表。 |
| 4729 |
% \begin{macrocode} |
| 4730 |
keywords .clist_gset:N = \g_@@_info_keywords_clist , |
| 4731 |
keywords* .clist_gset:N = \g_@@_info_keywords_en_clist , |
| 4732 |
% \end{macrocode} |
| 4733 |
% \end{macro} |
| 4734 |
% |
| 4735 |
% \begin{macro}{info/grade,info/student-id,info/author,info/author*} |
| 4736 |
% 年级、学号、姓名。 |
| 4737 |
% \begin{macrocode} |
| 4738 |
grade .tl_gset:N = \g_@@_info_grade_tl , |
| 4739 |
student-id .tl_gset:N = \g_@@_info_id_tl , |
| 4740 |
author .tl_gset:N = \g_@@_info_author_tl , |
| 4741 |
author* .tl_gset:N = \g_@@_info_author_en_tl , |
| 4742 |
% \end{macrocode} |
| 4743 |
% \end{macro} |
| 4744 |
% |
| 4745 |
% \begin{macro}{info/department,info/department*, |
| 4746 |
% info/major*,info/field,info/field*} |
| 4747 |
% 院系、专业、方向。 |
| 4748 |
% \begin{macrocode} |
| 4749 |
department .tl_gset:N = \g_@@_info_dept_tl , |
| 4750 |
department* .tl_gset:N = \g_@@_info_dept_en_tl , |
| 4751 |
major* .tl_gset:N = \g_@@_info_major_en_tl , |
| 4752 |
field .tl_gset:N = \g_@@_info_field_tl , |
| 4753 |
field* .tl_gset:N = \g_@@_info_field_en_tl , |
| 4754 |
% \end{macrocode} |
| 4755 |
% \end{macro} |
| 4756 |
% |
| 4757 |
% \begin{macro}{info/major} |
| 4758 |
% \changes{v1.3}{2023/05/11}{专业型研究生封面可额外修改专业名称。} |
| 4759 |
% \changes{v1.3}{2023/12/05}{调整专业型学位的填写方式。} |
| 4760 |
% 专业。研究生专业型学位可以取封面和摘要的两个值,此外都取第一个值。 |
| 4761 |
% \begin{macrocode} |
| 4762 |
major .code:n = |
| 4763 |
{ |
| 4764 |
\bool_if:NTF \g_@@_opt_academic_bool |
| 4765 |
{ |
| 4766 |
\clist_pop:NN \l_keys_value_tl \l_@@_tmpa_tl |
| 4767 |
\tl_gset_eq:NN \g_@@_info_major_tl \l_@@_tmpa_tl |
| 4768 |
} |
| 4769 |
{ |
| 4770 |
\clist_pop:NN \l_keys_value_tl \l_@@_tmpa_tl |
| 4771 |
\tl_gset_eq:NN \g_@@_info_majorc_tl \l_@@_tmpa_tl |
| 4772 |
\clist_pop:NNTF \l_keys_value_tl \l_@@_tmpa_tl |
| 4773 |
{ \tl_gset_eq:NN \g_@@_info_major_tl \l_@@_tmpa_tl } |
| 4774 |
{ \tl_gset_eq:NN \g_@@_info_major_tl \g_@@_info_majorc_tl } |
| 4775 |
} |
| 4776 |
}, |
| 4777 |
% \end{macrocode} |
| 4778 |
% \end{macro} |
| 4779 |
% |
| 4780 |
% \begin{macro}{info/supervisor,info/supervisor*} |
| 4781 |
% \changes{v0.13}{2021/12/11}{修改了导师选项的变量名称。} |
| 4782 |
% \changes{v0.14}{2022/01/12}{精简导师信息选项。} |
| 4783 |
% 导师信息。中文导师全称使用 |clist| 存储,便于在本科生封面中进行分割。 |
| 4784 |
% \begin{macrocode} |
| 4785 |
supervisor .clist_gset:N = \g_@@_info_supv_clist , |
| 4786 |
supervisor* .tl_gset:N = \g_@@_info_supv_en_tl , |
| 4787 |
% \end{macrocode} |
| 4788 |
% \end{macro} |
| 4789 |
% |
| 4790 |
% \begin{macro}{info/supervisor-ii,info/supervisor-ii*} |
| 4791 |
% 第二导师信息。 |
| 4792 |
% \begin{macrocode} |
| 4793 |
supervisor-ii .clist_gset:N = \g_@@_info_supvii_clist , |
| 4794 |
supervisor-ii* .tl_gset:N = \g_@@_info_supvii_en_tl , |
| 4795 |
% \end{macrocode} |
| 4796 |
% \end{macro} |
| 4797 |
% |
| 4798 |
% \begin{macro}{info/chairman,info/reviewer} |
| 4799 |
% 答辩委员会信息。 |
| 4800 |
% \begin{macrocode} |
| 4801 |
chairman .tl_gset:N = \g_@@_info_chairman_tl , |
| 4802 |
reviewer .clist_gset:N = \g_@@_info_reviewer_clist , |
| 4803 |
% \end{macrocode} |
| 4804 |
% \end{macro} |
| 4805 |
% |
| 4806 |
% \begin{macro}{info/clc,info/udc} |
| 4807 |
% 分类号。 |
| 4808 |
% \begin{macrocode} |
| 4809 |
clc .tl_gset:N = \g_@@_info_clc_tl , |
| 4810 |
udc .tl_gset:N = \g_@@_info_udc_tl , |
| 4811 |
% \end{macrocode} |
| 4812 |
% \end{macro} |
| 4813 |
% |
| 4814 |
% \begin{macro}{info/secret-level} |
| 4815 |
% 密级。 |
| 4816 |
% \begin{macrocode} |
| 4817 |
secret-level .tl_gset:N = \g_@@_info_secretlv_tl , |
| 4818 |
% \end{macrocode} |
| 4819 |
% \end{macro} |
| 4820 |
% |
| 4821 |
% \begin{macro}{info/supervisor-contact} |
| 4822 |
% 导师联系方式。 |
| 4823 |
% \begin{macrocode} |
| 4824 |
supervisor-contact .tl_gset:N = \g_@@_info_supvcont_tl , |
| 4825 |
% \end{macrocode} |
| 4826 |
% \end{macro} |
| 4827 |
% |
| 4828 |
% \begin{macro}{info/email} |
| 4829 |
% \changes{v0.14}{2022/01/12}{新增电邮地址设置项。} |
| 4830 |
% 用于学位论文出版授权书的电子邮件地址。 |
| 4831 |
% \begin{macrocode} |
| 4832 |
email .tl_gset:N = \g_@@_info_email_tl , |
| 4833 |
% \end{macrocode} |
| 4834 |
% \end{macro} |
| 4835 |
% |
| 4836 |
% \begin{macro}{info/school-code} |
| 4837 |
% \changes{v1.2}{2023/04/27}{新增学校代码设置项。} |
| 4838 |
% 学校代码。 |
| 4839 |
% \begin{macrocode} |
| 4840 |
school-code .tl_gset:N = \g_@@_info_code_tl , |
| 4841 |
school-code .initial:n = { 10284 } , |
| 4842 |
% \end{macrocode} |
| 4843 |
% \end{macro} |
| 4844 |
% |
| 4845 |
% \begin{macro}{info/degree,info/degree*} |
| 4846 |
% \changes{v1.2}{2023/04/24}{新增学位名称设置项。} |
| 4847 |
% 覆盖预定义的学位字段。 |
| 4848 |
% \begin{macrocode} |
| 4849 |
degree .tl_gset:N = \g_@@_info_degree_tl , |
| 4850 |
degree* .tl_gset:N = \g_@@_info_degree_en_tl , |
| 4851 |
% \end{macrocode} |
| 4852 |
% \end{macro} |
| 4853 |
% |
| 4854 |
% 提交日期,初始值为编译当天日期。 |
| 4855 |
% \begin{macrocode} |
| 4856 |
} |
| 4857 |
% \end{macrocode} |
| 4858 |
% |
| 4859 |
% \changes{v1.3}{2023/05/18}{日期字段直接在输入键值时处理。} |
| 4860 |
% \changes{v1.5.0}{2025/04/15}{总是同时存储中英文日期字样。} |
| 4861 |
% |
| 4862 |
% \begin{macro}{info/submit-date} |
| 4863 |
% \changes{v0.14}{2022/01/14}{精简提交日期选项。} |
| 4864 |
% \begin{macro}{info/defend-date} |
| 4865 |
% \changes{v0.14}{2022/01/14}{精简答辩日期选项。} |
| 4866 |
% \begin{macro}{info/confer-date} |
| 4867 |
% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的学位授予日期设置项。} |
| 4868 |
% \begin{macro}{info/bottom-date} |
| 4869 |
% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的底部日期设置项。} |
| 4870 |
% \begin{variable}{\g_@@_info_submitdate_tl,\g_@@_info_submitdate_en_tl, |
| 4871 |
% \g_@@_info_defenddate_tl,\g_@@_info_defenddate_en_tl, |
| 4872 |
% \g_@@_info_bottomdate_tl,\g_@@_info_bottomdate_en_tl, |
| 4873 |
% \g_@@_info_conferdate_tl,\g_@@_info_conferdate_en_tl} |
| 4874 |
% 日期。为了代码简洁,总是同时生成中英文字样。 |
| 4875 |
% \begin{macrocode} |
| 4876 |
\clist_map_inline:nn { submit, defend, confer, bottom } |
| 4877 |
{ |
| 4878 |
\tl_new:c { g_@@_info_ #1 date _tl } |
| 4879 |
\tl_new:c { g_@@_info_ #1 date _en_tl } |
| 4880 |
\keys_define:nn { nju / info } |
| 4881 |
{ |
| 4882 |
#1-date .code:n = \@@_date:nn {#1} {##1}, |
| 4883 |
#1-date .initial:V = \c_@@_name_today_tl |
| 4884 |
} |
| 4885 |
} |
| 4886 |
% \end{macrocode} |
| 4887 |
% \end{variable} |
| 4888 |
% \end{macro} |
| 4889 |
% \end{macro} |
| 4890 |
% \end{macro} |
| 4891 |
% \end{macro} |
| 4892 |
% |
| 4893 |
% 将指定信息项归入 \opt{anonymous} 组,以在盲审模式下选择性屏蔽。 |
| 4894 |
% \begin{macrocode} |
| 4895 |
\clist_map_inline:Nn \c_@@_name_anon_clist |
| 4896 |
{ \keys_define:nn { nju / info } { #1 .groups:n = { anonymous } } } |
| 4897 |
\clist_map_inline:Nn \c_@@_name_anon_en_clist |
| 4898 |
{ \keys_define:nn { nju / info } { #1 * .groups:n = { anonymous } } } |
| 4899 |
% \end{macrocode} |
| 4900 |
% |
| 4901 |
% \changes{v0.15}{2022/01/22}{正确处理双导师信息。} |
| 4902 |
% \changes{v1.1}{2022/11/04}{修复研究生模板封面的导师信息居中问题。} |
| 4903 |
% 在导言区录入用户信息后进行变量设置。此处使用到了 \pkg{ctex} 提供的命令, |
| 4904 |
% 应当位于载入文档类之后。 |
| 4905 |
% \begin{macrocode} |
| 4906 |
\@@_at_begin_document:n |
| 4907 |
{ |
| 4908 |
% \end{macrocode} |
| 4909 |
% 拼合双导师的姓名和职称。 |
| 4910 |
% \begin{macrocode} |
| 4911 |
\tl_gset:Ne \g_@@_info_supvfull_tl |
| 4912 |
{ \clist_use:Nn \g_@@_info_supv_clist { \@@_quad: } } |
| 4913 |
\clist_if_empty:NF \g_@@_info_supvii_clist |
| 4914 |
{ |
| 4915 |
\bool_gset_true:N \g_@@_opt_supvii_bool |
| 4916 |
\tl_gput_right:Ne \g_@@_info_supvfull_tl |
| 4917 |
{ \@@_quad: \clist_use:Nn \g_@@_info_supvii_clist { \@@_quad: } } |
| 4918 |
} |
| 4919 |
\tl_gset_eq:NN \g_@@_info_supvfull_en_tl \g_@@_info_supv_en_tl |
| 4920 |
\tl_if_empty:NF \g_@@_info_supvii_en_tl |
| 4921 |
{ |
| 4922 |
\tl_gput_right:Ne \g_@@_info_supvfull_en_tl |
| 4923 |
{ \@@_quad: \g_@@_info_supvii_en_tl } |
| 4924 |
} |
| 4925 |
} |
| 4926 |
%</class> |
| 4927 |
% \end{macrocode} |
| 4928 |
% |
| 4929 |
% \begin{variable}{\g_@@_info_confer_tl} |
| 4930 |
% \begin{macrocode} |
| 4931 |
%<*def-g> |
| 4932 |
\tl_new:N \g_@@_info_confer_tl |
| 4933 |
\tl_gset:Nn \g_@@_info_confer_tl |
| 4934 |
{ |
| 4935 |
\textbf { \l_@@_name_nju_tl } \hfil |
| 4936 |
\g_@@_info_conferdate_tl |
| 4937 |
} |
| 4938 |
% \end{macrocode} |
| 4939 |
% \end{variable} |
| 4940 |
% |
| 4941 |
% \changes{v0.16}{2022/03/06}{正确处理学位和类型信息。} |
| 4942 |
% 设置学位信息。该设置需要放在 \tn{ProcessKeysOptions} 命令后进行。 |
| 4943 |
% |
| 4944 |
% \begin{variable}{\g_@@_info_type_tl} |
| 4945 |
% 文档类型字样。 |
| 4946 |
% \begin{macrocode} |
| 4947 |
\tl_new:N \g_@@_info_type_tl |
| 4948 |
\tl_gset:Ne \g_@@_info_type_tl |
| 4949 |
{ \clist_item:Nn \c_@@_name_type_clist { \g_@@_info_type_int } } |
| 4950 |
% \end{macrocode} |
| 4951 |
% \end{variable} |
| 4952 |
% |
| 4953 |
% \begin{variable}{\g_@@_info_degree_tl} |
| 4954 |
% 学位类型字样。 |
| 4955 |
% \begin{macrocode} |
| 4956 |
\tl_new:N \g_@@_info_degree_tl |
| 4957 |
\tl_gset_eq:NN \g_@@_info_degree_tl \g_@@_info_type_tl |
| 4958 |
\bool_if:NF \g_@@_opt_academic_bool |
| 4959 |
{ \tl_gput_right:Nn \g_@@_info_degree_tl { 专业 } } |
| 4960 |
% \end{macrocode} |
| 4961 |
% \end{variable} |
| 4962 |
% |
| 4963 |
% \begin{variable}{\g_@@_info_degree_en_tl} |
| 4964 |
% 英文的学位字样。 |
| 4965 |
% \begin{macrocode} |
| 4966 |
\tl_new:N \g_@@_info_degree_en_tl |
| 4967 |
\tl_gset:Ne \g_@@_info_degree_en_tl |
| 4968 |
{ \clist_item:Nn \c_@@_name_type_en_clist { \g_@@_info_type_int } } |
| 4969 |
%</def-g> |
| 4970 |
% \end{macrocode} |
| 4971 |
% \end{variable} |
| 4972 |
% |
| 4973 |
% |
| 4974 |
% \subsection{字体设置} |
| 4975 |
% |
| 4976 |
% \pkg{fontspec} 包含于 \pkg{ctex} 宏集,无需另行载入。 |
| 4977 |
% |
| 4978 |
% \subsubsection{操作系统检测} |
| 4979 |
% |
| 4980 |
% \begin{variable}{\c_@@_path_macoffice_tl} |
| 4981 |
% mac Office 字体路径。 |
| 4982 |
% \begin{macrocode} |
| 4983 |
%<*class> |
| 4984 |
\tl_const:Nn \c_@@_path_macoffice_tl |
| 4985 |
{ /Applications/Microsoft~ Word.app/Contents/Resources/DFonts/ } |
| 4986 |
% \end{macrocode} |
| 4987 |
% \end{variable} |
| 4988 |
% |
| 4989 |
% 操作系统检测。相较于 \pkg{ctex} 提供的 \cs{ctex_detect_platform:}, |
| 4990 |
% 额外增加了对 macOS 上 MS Office 的检测。 |
| 4991 |
% \begin{macrocode} |
| 4992 |
\sys_if_platform_windows:TF |
| 4993 |
{ \tl_gset:Nn \g_@@_font_set_tl { win } } |
| 4994 |
{ |
| 4995 |
\ctex_if_platform_macos:TF |
| 4996 |
{ |
| 4997 |
\file_if_exist:nTF { \c_@@_path_macoffice_tl times.ttf } |
| 4998 |
{ \tl_gset:Nn \g_@@_font_set_tl { macoffice } } |
| 4999 |
{ \tl_gset:Nn \g_@@_font_set_tl { mac } } |
| 5000 |
} |
| 5001 |
{ \tl_gset:Nn \g_@@_font_set_tl { fandol } } |
| 5002 |
} |
| 5003 |
% \end{macrocode} |
| 5004 |
% 判断用户是否自定义了中英文字体。如果其中任意一种未被定义, |
| 5005 |
% 则使用系统预装字体覆盖字体选项。 |
| 5006 |
% Windows 或 macOS 外的系统被判断为 Linux,一律使用自由字体。 |
| 5007 |
% \begin{macrocode} |
| 5008 |
\tl_if_empty:NT \g_@@_font_latin_tl |
| 5009 |
{ \tl_gset_eq:NN \g_@@_font_latin_tl \g_@@_font_set_tl } |
| 5010 |
\tl_if_empty:NT \g_@@_font_cjk_tl |
| 5011 |
{ \tl_gset_eq:NN \g_@@_font_cjk_tl \g_@@_font_set_tl } |
| 5012 |
% \end{macrocode} |
| 5013 |
% |
| 5014 |
% |
| 5015 |
% \subsubsection{定义英文字库} |
| 5016 |
% |
| 5017 |
% 接下来逐个定义所需要使用的字库。 |
| 5018 |
% |
| 5019 |
% \begin{macro}{\@@_loadfont_latin:n, |
| 5020 |
% \@@_loadfont_latin_win:,\@@_loadfont_latin_mac:} |
| 5021 |
% Windows 与 macOS 西文字体的区别主要在于默认等宽字体。 |
| 5022 |
% \begin{macrocode} |
| 5023 |
\cs_new:Npn \@@_loadfont_latin:n #1 |
| 5024 |
{ |
| 5025 |
\__fontspec_main_setmainfont:nn { } { Times~New~Roman } |
| 5026 |
\__fontspec_main_setsansfont:nn { } { Arial } |
| 5027 |
\__fontspec_main_setmonofont:nn { Scale = MatchLowercase } {#1} |
| 5028 |
} |
| 5029 |
\cs_new_protected:Npn \@@_loadfont_latin_win: |
| 5030 |
{ \@@_loadfont_latin:n { Courier~New } } |
| 5031 |
\cs_new_protected:Npn \@@_loadfont_latin_mac: |
| 5032 |
{ |
| 5033 |
\@@_loadfont_latin:n { Menlo } |
| 5034 |
% \end{macrocode} |
| 5035 |
% \changes{v1.1}{2022/12/03}{添加对 Times New Roman 的 smcp 特性的检测。} |
| 5036 |
% 检测 Times New Roman 是否具有小型大写字母(small caps)字型。 |
| 5037 |
% 这是 macOS 预装的字体版本较旧导致的。 |
| 5038 |
% \begin{macrocode} |
| 5039 |
\fontspec_if_small_caps:F |
| 5040 |
{ |
| 5041 |
\msg_warning:nn { njuthesis } { no-small-caps } |
| 5042 |
\__fontspec_main_setmainfont:nn |
| 5043 |
{ \c_@@_name_gyrefeature_clist } { texgyretermes } |
| 5044 |
} |
| 5045 |
} |
| 5046 |
% \end{macrocode} |
| 5047 |
% \end{macro} |
| 5048 |
% |
| 5049 |
% \begin{macro}{\@@_loadfont_latin_macoffice:} |
| 5050 |
% mac Office 西文字体。 |
| 5051 |
% \begin{macrocode} |
| 5052 |
\cs_new_protected:Npn \@@_loadfont_latin_macoffice: |
| 5053 |
{ |
| 5054 |
\__fontspec_main_setmainfont:nn |
| 5055 |
{ \c_@@_name_macofficefeature_clist } { times } |
| 5056 |
\__fontspec_main_setsansfont:nn |
| 5057 |
{ \c_@@_name_macofficefeature_clist } { arial } |
| 5058 |
\__fontspec_main_setmonofont:nn |
| 5059 |
{ Scale = MatchLowercase } { Menlo } |
| 5060 |
} |
| 5061 |
% \end{macrocode} |
| 5062 |
% \end{macro} |
| 5063 |
% |
| 5064 |
% \begin{variable}{\c_@@_name_macofficefeature_clist} |
| 5065 |
% 用于 \pkg{fontspec} 的 mac Office 字体特性列表。 |
| 5066 |
% \begin{macrocode} |
| 5067 |
\clist_const:Nn \c_@@_name_macofficefeature_clist |
| 5068 |
{ |
| 5069 |
Path = \c_@@_path_macoffice_tl, |
| 5070 |
Extension = .ttf, |
| 5071 |
UprightFont = *, |
| 5072 |
BoldFont = *bd, |
| 5073 |
ItalicFont = *i, |
| 5074 |
BoldItalicFont = *bi |
| 5075 |
} |
| 5076 |
% \end{macrocode} |
| 5077 |
% \end{variable} |
| 5078 |
% |
| 5079 |
% \begin{macro}{\@@_loadfont_latin_gyre:} |
| 5080 |
% 开源的 \TeX Gyre 西文字体。 |
| 5081 |
% \begin{macrocode} |
| 5082 |
\cs_new_protected:Npn \@@_loadfont_latin_gyre: |
| 5083 |
{ |
| 5084 |
\__fontspec_main_setmainfont:nn |
| 5085 |
{ \c_@@_name_gyrefeature_clist } { texgyretermes } |
| 5086 |
\__fontspec_main_setsansfont:nn |
| 5087 |
{ \c_@@_name_gyrefeature_clist } { texgyreheros } |
| 5088 |
\__fontspec_main_setmonofont:nn |
| 5089 |
{ |
| 5090 |
\c_@@_name_gyrefeature_clist, |
| 5091 |
Scale = MatchLowercase, |
| 5092 |
Ligatures = CommonOff |
| 5093 |
} |
| 5094 |
{ texgyrecursor } |
| 5095 |
} |
| 5096 |
% \end{macrocode} |
| 5097 |
% \end{macro} |
| 5098 |
% |
| 5099 |
% \begin{macro}{\@@_loadfont_latin_fandol:} |
| 5100 |
% 为兼容 \pkg{ctex} 做出的名称改变。 |
| 5101 |
% \begin{macrocode} |
| 5102 |
\cs_new_eq:NN \@@_loadfont_latin_fandol: \@@_loadfont_latin_gyre: |
| 5103 |
% \end{macrocode} |
| 5104 |
% \end{macro} |
| 5105 |
% |
| 5106 |
% \begin{variable}{\c_@@_name_gyrefeature_clist} |
| 5107 |
% 用于 \pkg{fontspec} 的 \TeX Gyre 字体特性列表。 |
| 5108 |
% \begin{macrocode} |
| 5109 |
\clist_const:Nn \c_@@_name_gyrefeature_clist |
| 5110 |
{ |
| 5111 |
Extension = .otf, |
| 5112 |
UprightFont = *-regular, |
| 5113 |
BoldFont = *-bold, |
| 5114 |
ItalicFont = *-italic, |
| 5115 |
BoldItalicFont = *-bolditalic |
| 5116 |
} |
| 5117 |
% \end{macrocode} |
| 5118 |
% \end{variable} |
| 5119 |
% |
| 5120 |
% |
| 5121 |
% \subsubsection{定义中文字库} |
| 5122 |
% |
| 5123 |
% \begin{macro}{\@@_hide_no_script_msg:} |
| 5124 |
% 隐藏 |does not contain script "CJK"| 警告。 |
| 5125 |
% \begin{macrocode} |
| 5126 |
\cs_new:Npn \@@_hide_no_script_msg: |
| 5127 |
{ \msg_redirect_name:nnn { fontspec } { no-script } { info } } |
| 5128 |
% \end{macrocode} |
| 5129 |
% \end{macro} |
| 5130 |
% |
| 5131 |
% \begin{macro}{\@@_loadfont_cjk_win:N,\@@_loadfont_cjk_win:} |
| 5132 |
% Windows 中文字体。 |
| 5133 |
% \begin{macrocode} |
| 5134 |
\cs_new:Npn \@@_loadfont_cjk_win:N #1 |
| 5135 |
{ |
| 5136 |
\setCJKmainfont { SimSun } [ #1, ItalicFont = KaiTi ] |
| 5137 |
\setCJKsansfont { SimHei } [#1] |
| 5138 |
\setCJKmonofont { FangSong } [#1] |
| 5139 |
\setCJKfamilyfont { zhsong } { SimSun } [#1] |
| 5140 |
\setCJKfamilyfont { zhhei } { SimHei } [#1] |
| 5141 |
\setCJKfamilyfont { zhfs } { FangSong } [#1] |
| 5142 |
\setCJKfamilyfont { zhkai } { KaiTi } [#1] |
| 5143 |
\@@_define_stzhongs:nn { STZhongsong } {#1} |
| 5144 |
} |
| 5145 |
\cs_new:Npn \@@_loadfont_cjk_win: |
| 5146 |
{ \@@_loadfont_cjk_win:N \c_@@_name_fakebold_tl } |
| 5147 |
% \end{macrocode} |
| 5148 |
% \end{macro} |
| 5149 |
% |
| 5150 |
% |
| 5151 |
% \begin{macro}{\@@_loadfont_cjk_mac:} |
| 5152 |
% macOS 字体。 |
| 5153 |
% ^^A TODO: 修复 macOS 字体支持,实现开箱即用。 |
| 5154 |
% \begin{macrocode} |
| 5155 |
\cs_new_protected:Npn \@@_loadfont_cjk_mac: |
| 5156 |
{ |
| 5157 |
\@@_hide_no_script_msg: |
| 5158 |
\setCJKmainfont { Songti~SC~Light } |
| 5159 |
[ |
| 5160 |
BoldFont = Songti~SC~Bold, |
| 5161 |
ItalicFont = Kaiti~SC, |
| 5162 |
BoldItalicFont = Kaiti~SC~Bold |
| 5163 |
] |
| 5164 |
\setCJKsansfont { Heiti~SC~Light } [ BoldFont = Heiti~SC~Medium ] |
| 5165 |
\setCJKmonofont { STFangsong } |
| 5166 |
\setCJKfamilyfont { zhsong } { Songti~SC~Light } [ BoldFont = Songti~SC~Bold ] |
| 5167 |
\setCJKfamilyfont { zhhei } { Heiti~SC~Light } [ BoldFont = Heiti~SC~Medium ] |
| 5168 |
\setCJKfamilyfont { zhfs } { STFangsong } |
| 5169 |
\setCJKfamilyfont { zhkai } { Kaiti~SC } [ BoldFont = Kaiti~SC~Bold ] |
| 5170 |
} |
| 5171 |
% \end{macrocode} |
| 5172 |
% \end{macro} |
| 5173 |
% |
| 5174 |
% \begin{macro}{\@@_loadfont_cjk_macoffice:n,\@@_loadfont_cjk_macoffice:} |
| 5175 |
% mac Office 中文字体。 |
| 5176 |
% \begin{macrocode} |
| 5177 |
\cs_new:Npn \@@_loadfont_cjk_macoffice:n #1 |
| 5178 |
{ |
| 5179 |
\setCJKmainfont { Simsun.ttc } [ ItalicFont = Kaiti.ttf, #1 ] |
| 5180 |
\setCJKsansfont { SimHei.ttf } [#1] |
| 5181 |
\setCJKmonofont { Fangsong.ttf } [#1] |
| 5182 |
\setCJKfamilyfont { zhsong } { Simsun.ttc } [#1] |
| 5183 |
\setCJKfamilyfont { zhhei } { SimHei.ttf } [#1] |
| 5184 |
\setCJKfamilyfont { zhfs } { Fangsong.ttf } [#1] |
| 5185 |
\setCJKfamilyfont { zhkai } { Kaiti.ttf } [#1] |
| 5186 |
\@@_define_stzhongs:nn { STZHONGS.ttf } {#1} |
| 5187 |
} |
| 5188 |
\cs_new:Npn \@@_loadfont_cjk_macoffice: |
| 5189 |
{ |
| 5190 |
\@@_loadfont_cjk_macoffice:n |
| 5191 |
{ Path = \c_@@_path_macoffice_tl, \c_@@_name_fakebold_tl } |
| 5192 |
} |
| 5193 |
% \end{macrocode} |
| 5194 |
% \end{macro} |
| 5195 |
% |
| 5196 |
% \begin{macro}{\@@_loadfont_cjk_fandol:} |
| 5197 |
% Fandol 字体。 |
| 5198 |
% \begin{macrocode} |
| 5199 |
\cs_new_protected:Npn \@@_loadfont_cjk_fandol: |
| 5200 |
{ |
| 5201 |
\@@_hide_no_script_msg: |
| 5202 |
\setCJKmainfont { FandolSong-Regular } |
| 5203 |
[ |
| 5204 |
Extension = .otf, |
| 5205 |
BoldFont = FandolSong-Bold, |
| 5206 |
ItalicFont = FandolKai-Regular |
| 5207 |
] |
| 5208 |
\setCJKsansfont { FandolHei-Regular } |
| 5209 |
[ |
| 5210 |
Extension = .otf, |
| 5211 |
BoldFont = FandolHei-Bold |
| 5212 |
] |
| 5213 |
\setCJKmonofont { FandolFang-Regular } |
| 5214 |
[ Extension = .otf ] |
| 5215 |
\setCJKfamilyfont { zhsong } { FandolSong-Regular } |
| 5216 |
[ |
| 5217 |
Extension = .otf, |
| 5218 |
BoldFont = FandolSong-Bold |
| 5219 |
] |
| 5220 |
\setCJKfamilyfont { zhhei } { FandolHei-Regular } |
| 5221 |
[ |
| 5222 |
Extension = .otf, |
| 5223 |
BoldFont = FandolHei-Bold |
| 5224 |
] |
| 5225 |
\setCJKfamilyfont { zhfs } { FandolFang-Regular } |
| 5226 |
[ Extension = .otf ] |
| 5227 |
\setCJKfamilyfont { zhkai } { FandolKai-Regular } |
| 5228 |
[ Extension = .otf, \c_@@_name_fakebold_tl ] |
| 5229 |
} |
| 5230 |
% \end{macrocode} |
| 5231 |
% \end{macro} |
| 5232 |
% |
| 5233 |
% |
| 5234 |
% \begin{macro}{\@@_loadfont_cjk_founder:} |
| 5235 |
% 方正字库(简繁扩展) |
| 5236 |
% \begin{macrocode} |
| 5237 |
\cs_new_protected:Npn \@@_loadfont_cjk_founder: |
| 5238 |
{ |
| 5239 |
% \end{macrocode} |
| 5240 |
% 调整方正字体括号位置。 |
| 5241 |
% \footnote{\XeTeX 的调整方法来自 \url{https://www.zhihu.com/question/46241367/answer/101660183}。} |
| 5242 |
% \begin{macrocode} |
| 5243 |
\sys_if_engine_xetex:T |
| 5244 |
{ \xeCJKEditPunctStyle { quanjiao } { optimize-kerning = true } } |
| 5245 |
\sys_if_engine_luatex:T |
| 5246 |
{ \defaultCJKfontfeatures { JFM = { zh_CN / { quanjiao, fzpr } } } } |
| 5247 |
\setCJKmainfont { FZShuSong-Z01 } |
| 5248 |
[ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] |
| 5249 |
\setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] |
| 5250 |
\setCJKmonofont { FZFangSong-Z02 } |
| 5251 |
\setCJKfamilyfont { zhsong } { FZShuSong-Z01 } |
| 5252 |
[ BoldFont = FZXiaoBiaoSong-B05 ] |
| 5253 |
\setCJKfamilyfont { zhhei } { FZHei-B01 } |
| 5254 |
[ \c_@@_name_fakebold_tl ] |
| 5255 |
\setCJKfamilyfont { zhkai } { FZKai-Z03 } |
| 5256 |
[ \c_@@_name_fakebold_tl ] |
| 5257 |
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 } |
| 5258 |
\defaultCJKfontfeatures { } |
| 5259 |
} |
| 5260 |
% \end{macrocode} |
| 5261 |
% \end{macro} |
| 5262 |
% |
| 5263 |
% \begin{macro}{\@@_loadfont_cjk_noto:} |
| 5264 |
% Noto 思源字体。 |
| 5265 |
% \begin{macrocode} |
| 5266 |
\cs_new_protected:Npn \@@_loadfont_cjk_noto: |
| 5267 |
{ |
| 5268 |
\setCJKmainfont [ \c_@@_name_notofeature_clist ] |
| 5269 |
{ NotoSerifCJKsc } |
| 5270 |
\setCJKsansfont [ \c_@@_name_notofeature_clist ] |
| 5271 |
{ NotoSansCJKsc } |
| 5272 |
\setCJKmonofont { Noto~Sans~Mono~CJK~SC } |
| 5273 |
\setCJKfamilyfont { zhsong } { Noto~Serif~CJK~SC } |
| 5274 |
\setCJKfamilyfont { zhhei } { Noto~Sans~CJK~SC } |
| 5275 |
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 } |
| 5276 |
\setCJKfamilyfont { zhkai } { FZKai-Z03 } |
| 5277 |
[ \c_@@_name_fakebold_tl ] |
| 5278 |
} |
| 5279 |
% \end{macrocode} |
| 5280 |
% \end{macro} |
| 5281 |
% |
| 5282 |
% \begin{macro}{\@@_loadfont_cjk_source:} |
| 5283 |
% \changes{v0.14}{2021/12/20}{增加 Adobe Source Han 作为思源字体。} |
| 5284 |
% Source Han 思源字体。 |
| 5285 |
% \begin{macrocode} |
| 5286 |
\cs_new_protected:Npn \@@_loadfont_cjk_source: |
| 5287 |
{ |
| 5288 |
\setCJKmainfont [ \c_@@_name_notofeature_clist ] |
| 5289 |
{ SourceHanSerifSC } |
| 5290 |
\setCJKsansfont [ \c_@@_name_notofeature_clist ] |
| 5291 |
{ SourceHanSansSC } |
| 5292 |
\setCJKmonofont { FZFangSong-Z02 } |
| 5293 |
\setCJKfamilyfont { zhsong } { Source~Han~Serif~SC } |
| 5294 |
\setCJKfamilyfont { zhhei } { Source~Han~Sans~SC } |
| 5295 |
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 } |
| 5296 |
\setCJKfamilyfont { zhkai } { FZKai-Z03 } |
| 5297 |
[ \c_@@_name_fakebold_tl ] |
| 5298 |
} |
| 5299 |
% \end{macrocode} |
| 5300 |
% \end{macro} |
| 5301 |
% |
| 5302 |
% \begin{variable}{\c_@@_name_fakebold_tl} |
| 5303 |
% \begin{macrocode} |
| 5304 |
\tl_const:Nn \c_@@_name_fakebold_tl { AutoFakeBold = 2.17 } |
| 5305 |
% \end{macrocode} |
| 5306 |
% \end{variable} |
| 5307 |
% |
| 5308 |
% \begin{variable}{\c_@@_name_notofeature_clist} |
| 5309 |
% 用于 \pkg{fontspec} 的思源字体特性列表。 |
| 5310 |
% \begin{macrocode} |
| 5311 |
\clist_const:Nn \c_@@_name_notofeature_clist |
| 5312 |
{ |
| 5313 |
Extension = .otf, |
| 5314 |
UprightFont = *-Regular, |
| 5315 |
BoldFont = *-Bold, |
| 5316 |
ItalicFont = *-Regular, |
| 5317 |
BoldItalicFont = *-Bold, |
| 5318 |
ItalicFeatures = FakeSlant, |
| 5319 |
BoldItalicFeatures = FakeSlant |
| 5320 |
} |
| 5321 |
% \end{macrocode} |
| 5322 |
% \end{variable} |
| 5323 |
% |
| 5324 |
% \begin{variable}{\l_@@_name_stzhongsopts_tl} |
| 5325 |
% 华文中宋的字体特性列表,默认为仅使用伪粗体。 |
| 5326 |
% \begin{macrocode} |
| 5327 |
\tl_new:N \l_@@_name_stzhongsopts_tl |
| 5328 |
\tl_set_eq:NN \l_@@_name_stzhongsopts_tl \c_@@_name_fakebold_tl |
| 5329 |
% \end{macrocode} |
| 5330 |
% \end{variable} |
| 5331 |
% |
| 5332 |
% \begin{macro}{\@@_define_stzhongs:nn} |
| 5333 |
% \changes{v1.2}{2023/04/30}{在研究生模板载入华文中宋。} |
| 5334 |
% \changes{v1.3}{2023/10/09}{可以手动指定华文中宋文件位置。} |
| 5335 |
% 研究生封面额外需要的华文中宋。 |
| 5336 |
% \begin{macrocode} |
| 5337 |
\cs_new:Npn \@@_define_stzhongs:nn #1#2 |
| 5338 |
{ |
| 5339 |
\tl_set:Nn \l_@@_name_stzhongsfile_tl {#1} |
| 5340 |
\tl_set:Nn \l_@@_name_stzhongsopts_tl {#2} |
| 5341 |
} |
| 5342 |
% \end{macrocode} |
| 5343 |
% \end{macro} |
| 5344 |
% |
| 5345 |
% \begin{macro}{\@@_loadfont_stzhongs:n} |
| 5346 |
% \changes{v1.2}{2023/04/30}{在研究生模板载入华文中宋。} |
| 5347 |
% \changes{v1.3}{2023/10/09}{可以手动指定华文中宋文件位置。} |
| 5348 |
% \changes{v1.4}{2024/04/03}{调整载入华文中宋文件的逻辑。} |
| 5349 |
% \begin{macro}{\@@_loadfont_stzhongs:V,\@@_loadfont_stzhongs:,\@@_stzhongs:} |
| 5350 |
% 研究生封面额外需要的华文中宋。 |
| 5351 |
% \begin{macrocode} |
| 5352 |
\cs_new:Npn \@@_loadfont_stzhongs: |
| 5353 |
{ \@@_loadfont_stzhongs:V \l_@@_name_stzhongsfile_tl } |
| 5354 |
\cs_new_protected:Npn \@@_loadfont_stzhongs:n #1 |
| 5355 |
{ |
| 5356 |
\fontspec_font_if_exist:nTF {#1} |
| 5357 |
{ |
| 5358 |
\newCJKfontfamily \@@_stzhongs: {#1} |
| 5359 |
[ \l_@@_name_stzhongsopts_tl ] |
| 5360 |
} |
| 5361 |
{ |
| 5362 |
\tl_if_eq:NnTF \g_@@_font_set_tl { macoffice } |
| 5363 |
{ |
| 5364 |
\newCJKfontfamily \@@_stzhongs: {#1} |
| 5365 |
[ Path = \c_@@_path_macoffice_tl, \c_@@_name_fakebold_tl ] |
| 5366 |
} |
| 5367 |
{ |
| 5368 |
\bool_if:NTF \g_@@_font_path_bool |
| 5369 |
{ |
| 5370 |
\newCJKfontfamily \@@_stzhongs: {#1} |
| 5371 |
[ Path = \g_@@_font_path_tl, \c_@@_name_fakebold_tl ] |
| 5372 |
} |
| 5373 |
{ |
| 5374 |
\cs_set_eq:NN \@@_stzhongs: \rmfamily |
| 5375 |
\msg_warning:nn { njuthesis } { missing-stzhongs } |
| 5376 |
} |
| 5377 |
} |
| 5378 |
} |
| 5379 |
} |
| 5380 |
\cs_generate_variant:Nn \@@_loadfont_stzhongs:n { V } |
| 5381 |
% \end{macrocode} |
| 5382 |
% \end{macro} |
| 5383 |
% \end{macro} |
| 5384 |
% |
| 5385 |
% |
| 5386 |
% \subsubsection{定义数学字库} |
| 5387 |
% |
| 5388 |
% \begin{macro}{\@@_define_math_font:nn} |
| 5389 |
% 批量定义数学字体配置。 |
| 5390 |
% \begin{macrocode} |
| 5391 |
\cs_new:Npn \@@_define_math_font:nn #1#2 |
| 5392 |
{ |
| 5393 |
\cs_new:cpn { @@_loadfont_math_ #1 : } |
| 5394 |
{ \__um_setmathfont:nn { } {#2} } |
| 5395 |
} |
| 5396 |
% \end{macrocode} |
| 5397 |
% \end{macro} |
| 5398 |
% |
| 5399 |
% \begin{macro}{ |
| 5400 |
% \@@_loadfont_math_asana:, |
| 5401 |
% \@@_loadfont_math_fira:, |
| 5402 |
% \@@_loadfont_math_garamond:, |
| 5403 |
% \@@_loadfont_math_lm:, |
| 5404 |
% \@@_loadfont_math_libertinus:, |
| 5405 |
% \@@_loadfont_math_stix:, |
| 5406 |
% \@@_loadfont_math_bonum:, |
| 5407 |
% \@@_loadfont_math_dejavu:, |
| 5408 |
% \@@_loadfont_math_pagella:, |
| 5409 |
% \@@_loadfont_math_schola:, |
| 5410 |
% \@@_loadfont_math_termes:} |
| 5411 |
% 批量定义若干数学字体的载入命令。 |
| 5412 |
% \begin{macrocode} |
| 5413 |
\clist_map_inline:nn |
| 5414 |
{ |
| 5415 |
{ asana } { Asana-Math.otf }, |
| 5416 |
{ fira } { FiraMath-Regular.otf }, |
| 5417 |
{ garamond } { Garamond-Math.otf }, |
| 5418 |
{ lm } { latinmodern-math.otf }, |
| 5419 |
{ libertinus } { LibertinusMath-Regular.otf }, |
| 5420 |
{ stix } { STIXMath-Regular.otf }, |
| 5421 |
{ bonum } { texgyrebonum-math.otf }, |
| 5422 |
{ dejavu } { texgyredejavu-math.otf }, |
| 5423 |
{ pagella } { texgyrepagella-math.otf }, |
| 5424 |
{ schola } { texgyreschola-math.otf }, |
| 5425 |
{ termes } { texgyretermes-math.otf } |
| 5426 |
} |
| 5427 |
{ \@@_define_math_font:nn #1 } |
| 5428 |
% \end{macrocode} |
| 5429 |
% \end{macro} |
| 5430 |
% |
| 5431 |
% \begin{macro}{\@@_loadfont_math_cambria:} |
| 5432 |
% Cambria Math 字体配置。 |
| 5433 |
% \begin{macrocode} |
| 5434 |
\cs_new:Npn \@@_loadfont_math_cambria: |
| 5435 |
{ |
| 5436 |
\bool_if:NTF \g_@@_font_path_bool |
| 5437 |
{ |
| 5438 |
\__um_setmathfont:nn |
| 5439 |
{ Path = \g_@@_font_path_tl/, FontIndex = 1 } |
| 5440 |
{ cambria.ttc } |
| 5441 |
} |
| 5442 |
{ \__um_setmathfont:nn { } { Cambria~Math } } |
| 5443 |
} |
| 5444 |
% \end{macrocode} |
| 5445 |
% \end{macro} |
| 5446 |
% |
| 5447 |
% \begin{macro}{\@@_loadfont_math_xits:} |
| 5448 |
% XITS Math 字体。 |
| 5449 |
% \begin{macrocode} |
| 5450 |
\cs_new:Npn \@@_loadfont_math_xits: |
| 5451 |
{ |
| 5452 |
\bool_if:NTF \g_@@_opt_math_int_bool |
| 5453 |
{ \tl_set:Nn \l_@@_tmpa_tl { 8 } } |
| 5454 |
{ \tl_clear:N \l_@@_tmpa_tl } |
| 5455 |
\__um_setmathfont:nn |
| 5456 |
{ |
| 5457 |
Extension = .otf, |
| 5458 |
StylisticSet = \l_@@_tmpa_tl, |
| 5459 |
BoldFont = XITSMath-Bold |
| 5460 |
} |
| 5461 |
{ XITSMath-Regular } |
| 5462 |
\__um_setmathfont:nn |
| 5463 |
{ |
| 5464 |
Extension = .otf, |
| 5465 |
StylisticSet = 1, |
| 5466 |
range = {cal,bfcal} |
| 5467 |
} |
| 5468 |
{ XITSMath-Regular } |
| 5469 |
} |
| 5470 |
% \end{macrocode} |
| 5471 |
% \end{macro} |
| 5472 |
% |
| 5473 |
% \begin{macro}{\@@_loadfont_math_newcm:} |
| 5474 |
% New Computer Modern Math 字体。 |
| 5475 |
% \begin{macrocode} |
| 5476 |
\cs_new:Npn \@@_loadfont_math_newcm: |
| 5477 |
{ |
| 5478 |
\bool_if:NTF \g_@@_opt_math_int_bool |
| 5479 |
{ \tl_set:Nn \l_@@_tmpa_tl { 2 } } |
| 5480 |
{ \tl_clear:N \l_@@_tmpa_tl } |
| 5481 |
\__um_setmathfont:nn |
| 5482 |
{ |
| 5483 |
Extension = .otf, |
| 5484 |
StylisticSet = \l_@@_tmpa_tl |
| 5485 |
} |
| 5486 |
{ NewCMMath-Book } |
| 5487 |
\__um_setmathfont:nn |
| 5488 |
{ |
| 5489 |
Extension = .otf, |
| 5490 |
StylisticSet = 1, |
| 5491 |
range = {scr,bfscr} |
| 5492 |
} |
| 5493 |
{ NewCMMath-Book } |
| 5494 |
\__fontspec_main_setmathrm:nn |
| 5495 |
{ |
| 5496 |
Extension = .otf, |
| 5497 |
UprightFont = *-Book, |
| 5498 |
BoldFont = *-Bold, |
| 5499 |
ItalicFont = *-BookItalic, |
| 5500 |
BoldItalicFont = *-BoldItalic |
| 5501 |
} |
| 5502 |
{ NewCM10 } |
| 5503 |
\__fontspec_main_setmathsf:nn |
| 5504 |
{ |
| 5505 |
Extension = .otf, |
| 5506 |
UprightFont = *-Book, |
| 5507 |
BoldFont = *-Bold, |
| 5508 |
ItalicFont = *-BookOblique, |
| 5509 |
BoldItalicFont = *-BoldOblique |
| 5510 |
} |
| 5511 |
{ NewCMSans10 } |
| 5512 |
\__fontspec_main_setmathtt:nn |
| 5513 |
{ |
| 5514 |
Extension = .otf, |
| 5515 |
UprightFont = *-Book, |
| 5516 |
ItalicFont = *-BookItalic, |
| 5517 |
BoldFont = *-Bold, |
| 5518 |
BoldItalicFont = *-BoldOblique |
| 5519 |
} |
| 5520 |
{ NewCMMono10 } |
| 5521 |
} |
| 5522 |
% \end{macrocode} |
| 5523 |
% \end{macro} |
| 5524 |
% |
| 5525 |
% \begin{macro}{\@@_loadfont_math_none:} |
| 5526 |
% 不进行数学字体配置。 |
| 5527 |
% \begin{macrocode} |
| 5528 |
\@@_cs_clear:N \@@_loadfont_math_none: |
| 5529 |
% \end{macrocode} |
| 5530 |
% \end{macro} |
| 5531 |
% |
| 5532 |
% |
| 5533 |
% \subsubsection{载入指定字库} |
| 5534 |
% \changes{v0.10}{2021/09/28}{修正了数学字体。} |
| 5535 |
% |
| 5536 |
% \begin{macro}{\@@_loadfont:} |
| 5537 |
% 载入字体命令。 |
| 5538 |
% \begin{macrocode} |
| 5539 |
\cs_new_protected:Npn \@@_loadfont: |
| 5540 |
{ |
| 5541 |
\use:c { @@_loadfont_latin_ \g_@@_font_latin_tl : } |
| 5542 |
\use:c { @@_loadfont_cjk_ \g_@@_font_cjk_tl : } |
| 5543 |
% \end{macrocode} |
| 5544 |
% 自行定义 \pkg{ctex} 中的四类字体命令。 |
| 5545 |
% \begin{macrocode} |
| 5546 |
\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } |
| 5547 |
\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } |
| 5548 |
\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } |
| 5549 |
\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } |
| 5550 |
% \end{macrocode} |
| 5551 |
% \begin{macro}{\bigger} |
| 5552 |
% 重定义字号命令。 |
| 5553 |
% \begin{macrocode} |
| 5554 |
\NewDocumentCommand \bigger { } { \ctex_zihao:n { 4 } } |
| 5555 |
} |
| 5556 |
% \end{macrocode} |
| 5557 |
% \end{macro} |
| 5558 |
% \end{macro} |
| 5559 |
% |
| 5560 |
% 载入设置的字体。^^A 为了吸收导言区的设置,放在其后载入。 |
| 5561 |
% \begin{macrocode} |
| 5562 |
% \BeforeBeginEnvironment { document } { \@@_loadfont: } |
| 5563 |
\@@_loadfont: |
| 5564 |
%</class> |
| 5565 |
% \end{macrocode} |
| 5566 |
% |
| 5567 |
% 只有研究生模板需要华文中宋。我们把它放在文档类最后载入。 |
| 5568 |
% \begin{macrocode} |
| 5569 |
%<def-g>\ctex_at_end_preamble:n { \@@_loadfont_stzhongs: } |
| 5570 |
% \end{macrocode} |
| 5571 |
% |
| 5572 |
% |
| 5573 |
% \subsection{页面布局} |
| 5574 |
% |
| 5575 |
% \subsubsection{页边距} |
| 5576 |
% |
| 5577 |
% 使用\pkg{geometry}设置页边距。 |
| 5578 |
% \begin{macrocode} |
| 5579 |
%<*class> |
| 5580 |
\geometry |
| 5581 |
{ |
| 5582 |
vmargin = 2.54 cm, |
| 5583 |
hmargin = 3.18 cm, |
| 5584 |
headheight = 15 pt |
| 5585 |
} |
| 5586 |
% \end{macrocode} |
| 5587 |
% |
| 5588 |
% 草稿模式下显示页面文字范围边界以及页眉、页脚线。 |
| 5589 |
% \begin{macrocode} |
| 5590 |
\bool_if:NT \g_@@_opt_draft_bool { \geometry { showframe } } |
| 5591 |
% \end{macrocode} |
| 5592 |
% |
| 5593 |
% |
| 5594 |
% \subsubsection{页眉页脚} |
| 5595 |
% \changes{v1.0}{2022/07/01}{删除 |header/format| 和 |footer/format|。} |
| 5596 |
% \changes{v1.0}{2022/08/01}{页眉接口更名为 \opt{header} 类。} |
| 5597 |
% \changes{v1.0}{2022/08/01}{页脚接口更名为 \opt{footer} 类。} |
| 5598 |
% |
| 5599 |
% 提供设置页眉页脚的用户接口。在 \tn{fancyhead} 的可选参数中, |
| 5600 |
% \opt{E} 和 \opt{O} 分别表示在偶数页(even)和奇数页(odd), |
| 5601 |
% 而 \opt{L}、\opt{R} 和 \opt{C} 则分别表示左(left)、右 |
| 5602 |
% (right)和中间(center)。按照通常的排版规则,在双面模式下, |
| 5603 |
% 偶数页的中间页眉文字在左,奇数页则在右。单面模式下,左右页眉都要显示。 |
| 5604 |
% \begin{macrocode} |
| 5605 |
\keys_define:nn { nju / header } |
| 5606 |
{ |
| 5607 |
% \end{macrocode} |
| 5608 |
% |
| 5609 |
% \begin{macro}{header/content,header/content*} |
| 5610 |
% \changes{v0.16}{2022/03/18}{可手动指定页眉内容。} |
| 5611 |
% 页眉内容,分别对应双面模式和单面模式。 |
| 5612 |
% 为了便于指定复杂的页眉样式,这里用 |clist| 存储位置和内容信息。 |
| 5613 |
% \begin{macrocode} |
| 5614 |
content .clist_gset:N = \g_@@_header_twoside_clist, |
| 5615 |
content* .clist_gset:N = \g_@@_header_oneside_clist, |
| 5616 |
content .initial:n = |
| 5617 |
{ { EL } { \leftmark }, { OR } { \rightmark } }, |
| 5618 |
content* .initial:n = |
| 5619 |
{ { L } { \leftmark }, { R } { \rightmark } } |
| 5620 |
% \end{macrocode} |
| 5621 |
% \end{macro} |
| 5622 |
% |
| 5623 |
% \begin{macrocode} |
| 5624 |
} |
| 5625 |
\keys_define:nn { nju / footer } |
| 5626 |
{ |
| 5627 |
% \end{macrocode} |
| 5628 |
% \begin{macro}{footer/content,footer/content*} |
| 5629 |
% \changes{v0.16}{2022/03/18}{可手动指定页脚内容。} |
| 5630 |
% 页脚内容,同页眉。 |
| 5631 |
% \begin{macrocode} |
| 5632 |
content .clist_gset:N = \g_@@_footer_twoside_clist, |
| 5633 |
content* .clist_gset:N = \g_@@_footer_oneside_clist, |
| 5634 |
content .initial:n = { { C } { \thepage } }, |
| 5635 |
content* .initial:n = { { C } { \thepage } } |
| 5636 |
} |
| 5637 |
% \end{macrocode} |
| 5638 |
% \end{macro} |
| 5639 |
% |
| 5640 |
% \begin{macro}{\g_@@_header_clist,\g_@@_footer_clist} |
| 5641 |
% 存储页眉页脚内容。 |
| 5642 |
% \begin{macrocode} |
| 5643 |
\clist_new:N \g_@@_header_clist |
| 5644 |
\clist_new:N \g_@@_footer_clist |
| 5645 |
% \end{macrocode} |
| 5646 |
% \end{macro} |
| 5647 |
% |
| 5648 |
% 在导言区末尾确定页眉页脚内容。 |
| 5649 |
% \begin{macrocode} |
| 5650 |
\ctex_at_end_preamble:n |
| 5651 |
{ |
| 5652 |
\tl_set:Ne \l_@@_tmpa_tl |
| 5653 |
{ \legacy_if:nTF { @twoside } { two } { one } } |
| 5654 |
\clist_map_inline:nn { header , footer } |
| 5655 |
{ |
| 5656 |
\clist_gset_eq:cc { g_@@_ #1 _clist } |
| 5657 |
{ g_@@_ #1 _ \l_@@_tmpa_tl side_clist } |
| 5658 |
} |
| 5659 |
} |
| 5660 |
% \end{macrocode} |
| 5661 |
% |
| 5662 |
% \begin{macro}{\@@_header:nn,\@@_footer:nn} |
| 5663 |
% 对 \pkg{fancyhdr} 的命令进行包装,便于设置页眉页脚。 |
| 5664 |
% \begin{macrocode} |
| 5665 |
\cs_new_protected:Npn \@@_header:nn #1#2 |
| 5666 |
{ \fancyhead [#1] { \l_@@_fmt_header_tl \nouppercase {#2} } } |
| 5667 |
\cs_new_protected:Npn \@@_footer:nn #1#2 |
| 5668 |
{ \fancyfoot [#1] { \l_@@_fmt_footer_tl \nouppercase {#2} } } |
| 5669 |
% \end{macrocode} |
| 5670 |
% \end{macro} |
| 5671 |
% |
| 5672 |
% 重定义 \pkg{fancyhdr} 的 \opt{plain} 样式,即本科生正文和部分特殊页面使用的 |
| 5673 |
% 页眉页脚样式。页眉无内容;页脚为居中的页码,使用五号新罗马体数字。 |
| 5674 |
% 标记页眉页脚横线宽度的变量并不属于 |dim| 类型,但是采取了该类型的格式。 |
| 5675 |
% \begin{macrocode} |
| 5676 |
\fancypagestyle { plain } |
| 5677 |
{ |
| 5678 |
\fancyhf { } |
| 5679 |
\clist_map_inline:Nn \g_@@_footer_clist { \@@_footer:nn ##1 } |
| 5680 |
\tl_set:Nn \headrulewidth { \c_zero_dim } |
| 5681 |
\tl_set:Nn \footrulewidth { \c_zero_dim } |
| 5682 |
} |
| 5683 |
% \end{macrocode} |
| 5684 |
% |
| 5685 |
% \changes{v0.15}{2022/01/17}{修复单页模式的页眉问题。} |
| 5686 |
% 以 \opt{plain} 样式为基础的 \opt{headings} 样式,用于研究生模板。 |
| 5687 |
% \begin{macrocode} |
| 5688 |
\fancypagestyle { headings } |
| 5689 |
{ |
| 5690 |
\fancyhf { } |
| 5691 |
\clist_if_empty:NTF \g_@@_header_clist |
| 5692 |
{ |
| 5693 |
\tl_set:Nn \headrulewidth { \c_zero_dim } |
| 5694 |
} |
| 5695 |
{ |
| 5696 |
\tl_set:Nn \headrulewidth { 0.4 pt } |
| 5697 |
\dim_set:Nn \headheight { 20 pt } |
| 5698 |
\clist_map_inline:Nn \g_@@_header_clist |
| 5699 |
{ \@@_header:nn ##1 } |
| 5700 |
} |
| 5701 |
\clist_map_inline:Nn \g_@@_footer_clist { \@@_footer:nn ##1 } |
| 5702 |
\tl_set:Nn \footrulewidth { \c_zero_dim } |
| 5703 |
} |
| 5704 |
% \end{macrocode} |
| 5705 |
% |
| 5706 |
% \begin{macro}{\frontmatter} |
| 5707 |
% 重定义 \tn{frontmatter},设置前言区默认的页眉页脚以及页码样式。 |
| 5708 |
% \begin{macrocode} |
| 5709 |
\RenewDocumentCommand \frontmatter { } |
| 5710 |
{ |
| 5711 |
\cleardoublepage |
| 5712 |
\exp_args:NV \pagestyle \l_@@_fmt_pagestyle_tl |
| 5713 |
\pagenumbering { Roman } |
| 5714 |
} |
| 5715 |
% \end{macrocode} |
| 5716 |
% \end{macro} |
| 5717 |
% |
| 5718 |
% \begin{macro}{\mainmatter} |
| 5719 |
% \changes{v0.12}{2021/12/03}{修复了摘要页字体格式泄漏到正文的问题。} |
| 5720 |
% \changes{v0.12}{2021/12/03}{修复了页眉上长标题重叠的问题。} |
| 5721 |
% 重定义 \tn{mainmatter},在论文主体部分载入页面样式设置, |
| 5722 |
% 使用阿拉伯数字重新进行页码编号。 |
| 5723 |
% \begin{macrocode} |
| 5724 |
\RenewDocumentCommand \mainmatter { } |
| 5725 |
{ |
| 5726 |
\cleardoublepage |
| 5727 |
\exp_args:NV \pagestyle \l_@@_fmt_pagestyle_tl |
| 5728 |
\pagenumbering { arabic } |
| 5729 |
\normalfont \normalsize |
| 5730 |
} |
| 5731 |
% \end{macrocode} |
| 5732 |
% \end{macro} |
| 5733 |
% |
| 5734 |
% \changes{v0.16}{2022/03/18}{研究生模板的目录、摘要等页面也显示页眉。} |
| 5735 |
% 在文档起始位置设置默认页面样式。 |
| 5736 |
% \begin{macrocode} |
| 5737 |
\AtBeginEnvironment { document } |
| 5738 |
{ |
| 5739 |
\exp_args:NV \pagestyle \l_@@_fmt_pagestyle_tl |
| 5740 |
\pagenumbering { Roman } |
| 5741 |
} |
| 5742 |
% \end{macrocode} |
| 5743 |
% |
| 5744 |
% |
| 5745 |
% \subsection{章节标题格式} |
| 5746 |
% |
| 5747 |
% \begin{macro}{\@@_bookmark_toc:n,\@@_bookmark_toc:V} |
| 5748 |
% 为无编号章添加目录条目,需手动指定格式为四号、不加粗、黑体。 |
| 5749 |
% \begin{macrocode} |
| 5750 |
\cs_new:Npn \@@_bookmark_toc:n #1 |
| 5751 |
{ \addcontentsline { toc } { chapter } { \l_@@_fmt_chapterintoc_tl #1 } } |
| 5752 |
\cs_generate_variant:Nn \@@_bookmark_toc:n { V } |
| 5753 |
% \end{macrocode} |
| 5754 |
% \end{macro} |
| 5755 |
% |
| 5756 |
% \begin{macro}{\@@_bookmark_toc:nn} |
| 5757 |
% 为了保持形式一致,进行封装。 |
| 5758 |
% \begin{macrocode} |
| 5759 |
\cs_new:Npn \@@_bookmark_toc:nn #1#2 |
| 5760 |
{ \phantomsection \@@_bookmark_toc:n {#1} } |
| 5761 |
% \end{macrocode} |
| 5762 |
% \end{macro} |
| 5763 |
% |
| 5764 |
% \begin{macro}{\@@_bookmark_pdf_nosec:nn,\@@_bookmark_pdf:nn} |
| 5765 |
% 封装 \pkg{hyperref} 的 PDF 书签命令。 |
| 5766 |
% \begin{macrocode} |
| 5767 |
\cs_new:Npn \@@_bookmark_pdf_nosec:nn { \pdfbookmark [0] } |
| 5768 |
\cs_new:Npn \@@_bookmark_pdf:nn |
| 5769 |
{ \phantomsection \@@_bookmark_pdf_nosec:nn } |
| 5770 |
% \end{macrocode} |
| 5771 |
% \end{macro} |
| 5772 |
% |
| 5773 |
% \begin{macro}{\@@_bookmark:Nnn} |
| 5774 |
% 书签。 |
| 5775 |
% \begin{macrocode} |
| 5776 |
\cs_new:Npn \@@_bookmark:Nnn #1#2#3 |
| 5777 |
{ |
| 5778 |
\bool_if:NTF #1 |
| 5779 |
{ \@@_bookmark_toc:n {#2} } |
| 5780 |
{ \@@_bookmark_pdf_nosec:nn {#2} {#3} } |
| 5781 |
} |
| 5782 |
% \end{macrocode} |
| 5783 |
% \end{macro} |
| 5784 |
% |
| 5785 |
% \begin{macro}{\@@_chapter:Nnn,\@@_chapter:cnn,\@@_chapter:n,\@@_chapter:V} |
| 5786 |
% 含有目录和 PDF 标签的无编号章。 |
| 5787 |
% \begin{macrocode} |
| 5788 |
\cs_new:Npn \@@_chapter:Nnn #1#2#3 |
| 5789 |
{ |
| 5790 |
\chapter * {#2} |
| 5791 |
\@@_bookmark:Nnn #1 {#2} {#3} |
| 5792 |
\@@_chapter_header:n {#2} |
| 5793 |
} |
| 5794 |
\cs_new:Npn \@@_chapter:n #1 |
| 5795 |
{ \@@_chapter:Nnn \c_true_bool {#1} { } } |
| 5796 |
\cs_generate_variant:Nn \@@_chapter:Nnn { cnn } |
| 5797 |
\cs_generate_variant:Nn \@@_chapter:n { V } |
| 5798 |
% \end{macrocode} |
| 5799 |
% \end{macro} |
| 5800 |
% |
| 5801 |
% \begin{macro}{\@@_chapter_header:n} |
| 5802 |
% 单页模式下,目录、摘要、符号表等特殊页面的页眉中间为相应标题,左右为空。这里通 |
| 5803 |
% 过居中的 \tn{leftmark} 实现。 |
| 5804 |
% \begin{macrocode} |
| 5805 |
\cs_new_protected:Npn \@@_chapter_header:n #1 |
| 5806 |
{ |
| 5807 |
\legacy_if:nTF { @twoside } |
| 5808 |
{ \markboth {#1} {#1} } |
| 5809 |
{ \markboth { \hfill #1 \hfill } { } } |
| 5810 |
} |
| 5811 |
% \end{macrocode} |
| 5812 |
% \end{macro} |
| 5813 |
% |
| 5814 |
% \begin{macro}{\njuchapter} |
| 5815 |
% 封装无编号章环境,供用户在正文中使用。 |
| 5816 |
% \begin{macrocode} |
| 5817 |
\NewDocumentCommand \njuchapter { m } { \@@_chapter:n {#1} } |
| 5818 |
% \end{macrocode} |
| 5819 |
% \end{macro} |
| 5820 |
% |
| 5821 |
% |\keys_set:nn{ctex}| 实际相当于 \tn{ctexset}。 |
| 5822 |
% \begin{macrocode} |
| 5823 |
\keys_set:nn { ctex } |
| 5824 |
{ |
| 5825 |
chapter / beforeskip = \l_@@_chapterbefore_dim, |
| 5826 |
chapter / afterskip = \l_@@_chapterafter_dim, |
| 5827 |
chapter / format = \l_@@_fmt_chapter_tl, |
| 5828 |
section / format = \l_@@_fmt_section_tl, |
| 5829 |
subsection / format = \l_@@_fmt_subsection_tl, |
| 5830 |
subsubsection / format = \l_@@_fmt_subsubsection_tl, |
| 5831 |
paragraph / format = \l_@@_fmt_paragraph_tl, |
| 5832 |
subparagraph / format = \l_@@_fmt_subparagraph_tl, |
| 5833 |
% \end{macrocode} |
| 5834 |
% |
| 5835 |
% |
| 5836 |
% \subsection{目录格式} |
| 5837 |
% \changes{v0.13}{2021/12/09}{移除 \pkg{tocloft},用 \pkg{ctex} 修改目录样式。} |
| 5838 |
% |
| 5839 |
% 设置目录标题默认名称。 |
| 5840 |
% \begin{macrocode} |
| 5841 |
contentsname = \l_@@_name_tableofcontents_tl, |
| 5842 |
listfigurename = \l_@@_name_listoffigures_tl, |
| 5843 |
listtablename = \l_@@_name_listoftables_tl, |
| 5844 |
% \end{macrocode} |
| 5845 |
% 设置目录中章标题的样式。 |
| 5846 |
% \begin{macrocode} |
| 5847 |
chapter / tocline = \l_@@_fmt_chapterintoc_tl \CTEXnumberline {#1} #2 |
| 5848 |
} |
| 5849 |
% \end{macrocode} |
| 5850 |
% |
| 5851 |
% \changes{v1.0}{2022/08/01}{整合目录设置项。} |
| 5852 |
% \begin{macro}{\@@_make_toc:nn,\@@_make_toc:Vn} |
| 5853 |
% 通过 group 内修改标题设置,将目录页标题格式单独设置为三号粗宋体。 |
| 5854 |
% 目录自身不出现在目录中时需特别处理。参考 |
| 5855 |
% \url{https://tex.stackexchange.com/a/1821}。 |
| 5856 |
% \begin{macrocode} |
| 5857 |
\cs_new_protected:Npn \@@_make_toc:nn #1#2 |
| 5858 |
{ |
| 5859 |
\group_begin: |
| 5860 |
\keys_set:nn { ctex } |
| 5861 |
{ chapter/format = \l_@@_fmt_toctitle_tl } |
| 5862 |
\@@_chapter:cnn { g_@@_ #2 _showentry_bool } {#1} {#2} |
| 5863 |
\group_end: |
| 5864 |
\@starttoc {#2} |
| 5865 |
} |
| 5866 |
\cs_generate_variant:Nn \@@_make_toc:nn { vn } |
| 5867 |
% \end{macrocode} |
| 5868 |
% \end{macro} |
| 5869 |
% |
| 5870 |
% \changes{v0.15}{2022/02/04}{可选择目录自身是否出现在目录中。} |
| 5871 |
% \begin{macro}{\@@_define_toc_cmd:nnn} |
| 5872 |
% 重定义目录命令,修改标题格式并插入书签。 |
| 5873 |
% \begin{macrocode} |
| 5874 |
\cs_new_protected:Npn \@@_define_toc_cmd:nnn #1#2#3 |
| 5875 |
{ |
| 5876 |
\keys_define:nn { nju / #1 } |
| 5877 |
{ |
| 5878 |
toc-entry .bool_gset:c = { g_@@_ #3 _showentry_bool }, |
| 5879 |
toc-entry .initial:n = true |
| 5880 |
} |
| 5881 |
\exp_args:Nc \RenewDocumentCommand {#1} { } |
| 5882 |
{ \@@_make_toc:vn { #2 name } {#3} } |
| 5883 |
} |
| 5884 |
% \end{macrocode} |
| 5885 |
% \end{macro} |
| 5886 |
% |
| 5887 |
% \changes{v1.4}{2024/11/08}{目录选项不再会影响插图清单和表格清单。} |
| 5888 |
% |
| 5889 |
% \begin{macro}{ |
| 5890 |
% \tableofcontents,\listoffigures,\listoftables, |
| 5891 |
% tableofcontents/toc-entry, |
| 5892 |
% listoffigures/toc-entry, |
| 5893 |
% listoftables/toc-entry, |
| 5894 |
% \g_@@_toc_showentry_bool, |
| 5895 |
% \g_@@_lof_showentry_bool, |
| 5896 |
% \g_@@_lot_showentry_bool} |
| 5897 |
% \begin{macrocode} |
| 5898 |
\clist_map_inline:nn |
| 5899 |
{ |
| 5900 |
{ tableofcontents } { contents } { toc }, |
| 5901 |
{ listoffigures } { listfigure } { lof }, |
| 5902 |
{ listoftables } { listtable } { lot } |
| 5903 |
} |
| 5904 |
{ \@@_define_toc_cmd:nnn #1 } |
| 5905 |
% \end{macrocode} |
| 5906 |
% \end{macro} |
| 5907 |
% |
| 5908 |
% \begin{macro}{tableofcontents/dotline} |
| 5909 |
% \changes{v1.0}{2022/08/08}{可选择是否为目录中的章名添加引导线。} |
| 5910 |
% 修改 \cls{book} 文档类中的命令以添加引导线。 |
| 5911 |
% \begin{macrocode} |
| 5912 |
\keys_define:nn { nju / tableofcontents } |
| 5913 |
{ |
| 5914 |
dotline .choice:, |
| 5915 |
dotline / chapter .code:n = |
| 5916 |
{ |
| 5917 |
\cs_set_protected_nopar:Npn \l@chapter |
| 5918 |
{ |
| 5919 |
\skip_vertical:N 1.0 em \@plus \p@ \scan_stop: |
| 5920 |
\@dottedtocline { \z@ } { \z@ } { 1.5 em } |
| 5921 |
} |
| 5922 |
}, |
| 5923 |
dotline / section .code:n = { } |
| 5924 |
} |
| 5925 |
% \end{macrocode} |
| 5926 |
% \end{macro} |
| 5927 |
% |
| 5928 |
% |
| 5929 |
% \subsection{参考文献} |
| 5930 |
% |
| 5931 |
% \begin{variable}{\g_@@_blx_option_clist} |
| 5932 |
% 存储传入 \pkg{biblatex} 的选项列表。 |
| 5933 |
% \begin{macrocode} |
| 5934 |
\clist_new:N \g_@@_blx_option_clist |
| 5935 |
% \end{macrocode} |
| 5936 |
% \end{variable} |
| 5937 |
% |
| 5938 |
% \begin{variable}{\g_@@_blx_resource_clist} |
| 5939 |
% 存储参考文献数据源列表。 |
| 5940 |
% \begin{macrocode} |
| 5941 |
\clist_new:N \g_@@_blx_resource_clist |
| 5942 |
% \end{macrocode} |
| 5943 |
% \end{variable} |
| 5944 |
% |
| 5945 |
% \begin{macrocode} |
| 5946 |
\keys_define:nn { nju / bib } |
| 5947 |
{ |
| 5948 |
% \end{macrocode} |
| 5949 |
% |
| 5950 |
% \begin{macro}{bib/style} |
| 5951 |
% \changes{v0.14}{2021/12/19}{提供选择参考文献样式的接口。} |
| 5952 |
% \changes{v0.15}{2022/02/11}{可使用国标以外的文献样式。} |
| 5953 |
% 参考文献样式。国家标准为顺序编码制 \opt{numeric} 和著者-出版年制 |
| 5954 |
% \opt{author-year},分别对应 \pkg{biblatex} 的 \opt{gb7714-2015} |
| 5955 |
% 和 \opt{gb7714-2015ay} 样式。其余样式一律视作 \opt{unknown}。用户 |
| 5956 |
% 选取的样式会被加入选项列表中,以待传进 \pkg{biblatex} 宏包。 |
| 5957 |
% \begin{macrocode} |
| 5958 |
style .choice:, |
| 5959 |
style / numeric .code:n = |
| 5960 |
{ |
| 5961 |
\clist_gput_right:Nn \g_@@_blx_option_clist |
| 5962 |
{ style = gb7714-2015 } |
| 5963 |
}, |
| 5964 |
style / author-year .code:n = |
| 5965 |
{ |
| 5966 |
\clist_gput_right:Nn \g_@@_blx_option_clist |
| 5967 |
{ style = gb7714-2015ay } |
| 5968 |
}, |
| 5969 |
style / unknown .code:n = |
| 5970 |
{ \clist_gput_right:Nn \g_@@_blx_option_clist { style = #1 } }, |
| 5971 |
style .initial:n = numeric, |
| 5972 |
% \end{macrocode} |
| 5973 |
% \end{macro} |
| 5974 |
% |
| 5975 |
% \begin{macro}{bib/option} |
| 5976 |
% \changes{v0.15}{2022/02/15}{提供传入 \pkg{biblatex} 宏包选项的接口。} |
| 5977 |
% 待传入 \pkg{biblatex} 的额外宏包选项,以列表形式储存。 |
| 5978 |
% 更为常见的参考文献样式设置已由 \opt{bib/style} 提供, |
| 5979 |
% 两者中后传入的设置会覆盖已有的设定。本设置项等效于在导言区使用 |
| 5980 |
% |\PassoptionsToPackage{|\meta{key}|=|\meta{value}|}{biblatex}| 命令。 |
| 5981 |
% \begin{macrocode} |
| 5982 |
option .code:n = |
| 5983 |
{ \clist_gput_right:NV \g_@@_blx_option_clist \l_keys_value_tl }, |
| 5984 |
% \end{macrocode} |
| 5985 |
% \end{macro} |
| 5986 |
% |
| 5987 |
% \begin{macro}{bib/resource} |
| 5988 |
% \changes{v0.14}{2021/12/19}{提供批量导入参考文献数据源的接口。} |
| 5989 |
% 参考文献数据源,以列表形式储存。 |
| 5990 |
% \begin{macrocode} |
| 5991 |
resource .code:n = |
| 5992 |
{ \clist_gput_right:NV \g_@@_blx_resource_clist \l_keys_value_tl }, |
| 5993 |
} |
| 5994 |
% \end{macrocode} |
| 5995 |
% \end{macro} |
| 5996 |
% |
| 5997 |
% \begin{macro}{\addbibresource} |
| 5998 |
% 为了吸收用户在导言区设置的选项,\pkg{biblatex} 宏包被设置在导言区末尾才会载 |
| 5999 |
% 入。此处单独定义了可以在导言区使用的 \tn{addbibresource} 命令,用于兼容传统的 |
| 6000 |
% 添加参考文献数据源的方法。 |
| 6001 |
% \begin{macrocode} |
| 6002 |
\bool_if:NT \g_@@_opt_load_blx_bool |
| 6003 |
{ |
| 6004 |
\NewDocumentCommand \addbibresource { m } |
| 6005 |
{ \clist_gput_right:Nn \g_@@_blx_resource_clist {#1} } |
| 6006 |
} |
| 6007 |
% \end{macrocode} |
| 6008 |
% \end{macro} |
| 6009 |
% |
| 6010 |
% \begin{macro}{\@@_blx_pre_setup:} |
| 6011 |
% 载入 \pkg{biblatex} 宏包前,必须禁用自行定义的 \tn{addbibresource} |
| 6012 |
% 命令,并传入用户设置的选项。 |
| 6013 |
% \begin{macrocode} |
| 6014 |
\cs_new_protected:Npn \@@_blx_pre_setup: |
| 6015 |
{ |
| 6016 |
\cs_undefine:N \addbibresource |
| 6017 |
\clist_gput_right:Nn \g_@@_blx_option_clist { backend = biber } |
| 6018 |
\exp_args:NV \PassOptionsToPackage \g_@@_blx_option_clist { biblatex } |
| 6019 |
} |
| 6020 |
% \end{macrocode} |
| 6021 |
% \end{macro} |
| 6022 |
% |
| 6023 |
% \begin{macro}{\@@_blx_post_setup:} |
| 6024 |
% \pkg{biblatex} 宏包载入后的设置。 |
| 6025 |
% \begin{macrocode} |
| 6026 |
\cs_new_protected:Npn \@@_blx_post_setup: |
| 6027 |
{ |
| 6028 |
% \end{macrocode} |
| 6029 |
% \changes{v0.12}{2021/12/06}{设置输出参考文献的默认选项。} |
| 6030 |
% \changes{v0.15}{2022/02/17}{可在每章后附上参考文献表。} |
| 6031 |
% 修改参考文献的头部样式,自动添加目录条目。默认为 |chapter| 级别。 |
| 6032 |
% 如果需要在每章后附上一个参考文献表,即对 \pkg{biblatex} 传入了 |
| 6033 |
% |refsection = chapter| 选项,则默认为 |section| 级别。 |
| 6034 |
% \begin{macrocode} |
| 6035 |
\defbibheading { njubibintoc } [ \bibname ] { \@@_chapter:n {##1} } |
| 6036 |
\tl_if_eq:NnTF \blx@refsecreset@level { 2 } |
| 6037 |
{ \DeclarePrintbibliographyDefaults { heading = subbibintoc } } |
| 6038 |
{ \DeclarePrintbibliographyDefaults { heading = njubibintoc } } |
| 6039 |
% \end{macrocode} |
| 6040 |
% 传入参考文献源文件,此时可正常使用 \tn{addbibresource} 命令。 |
| 6041 |
% \begin{macrocode} |
| 6042 |
\clist_map_inline:Nn \g_@@_blx_resource_clist { \addbibresource {##1} } |
| 6043 |
} |
| 6044 |
% \end{macrocode} |
| 6045 |
% \end{macro} |
| 6046 |
% |
| 6047 |
% 使用 \pkg{etoolbox} 提供的 \tn{BeforeBeginEnvironment},在 \env{document} 环境 |
| 6048 |
% 开始的钩子前载入 \pkg{biblatex} 并进行相关设置。 |
| 6049 |
% \begin{macrocode} |
| 6050 |
\bool_if:NT \g_@@_opt_load_blx_bool |
| 6051 |
{ |
| 6052 |
\BeforeBeginEnvironment { document } |
| 6053 |
{ |
| 6054 |
\@@_blx_pre_setup: |
| 6055 |
\RequirePackage { biblatex } |
| 6056 |
\@@_blx_post_setup: |
| 6057 |
} |
| 6058 |
} |
| 6059 |
% \end{macrocode} |
| 6060 |
% |
| 6061 |
% |
| 6062 |
% \subsection{引用} |
| 6063 |
% |
| 6064 |
% \changes{v1.4}{2024/03/06}{将可能需要覆盖的 \pkg{hyperref} 设置移动到导言区前。} |
| 6065 |
% \begin{macrocode} |
| 6066 |
\hypersetup |
| 6067 |
{ |
| 6068 |
bookmarksnumbered = true, |
| 6069 |
psdextra = true, |
| 6070 |
unicode = true, |
| 6071 |
hidelinks |
| 6072 |
} |
| 6073 |
% \end{macrocode} |
| 6074 |
% \changes{v0.17}{2022/04/09}{PDF 书签中不生成额外空格。} |
| 6075 |
% 忽略 PDF 字符串中的特定命令,从而抑制 \pkg{hyperref} 警告。 |
| 6076 |
% \begin{macrocode} |
| 6077 |
\pdfstringdefDisableCommands |
| 6078 |
{ |
| 6079 |
\clist_map_inline:nn |
| 6080 |
{ \\, \quad, \qquad, \bigger } |
| 6081 |
{ \@@_cs_clear:N #1 } |
| 6082 |
\cs_set_eq:NN \zihao \use_none:n |
| 6083 |
} |
| 6084 |
% \end{macrocode} |
| 6085 |
% 在导言区末尾进行 \pkg{hyperref} 设置。填写 PDF 元信息。 |
| 6086 |
% \changes{v0.11}{2021/10/01}{写入 PDF 元数据。} |
| 6087 |
% \begin{macrocode} |
| 6088 |
\ctex_at_end_preamble:n |
| 6089 |
{ |
| 6090 |
\hypersetup |
| 6091 |
{ |
| 6092 |
pdftitle = \g_@@_info_title_tl, |
| 6093 |
pdfkeywords = \g_@@_info_keywords_clist, |
| 6094 |
pdfauthor = \l_@@_name_pdfauthor_tl, |
| 6095 |
pdfcreator = \l_@@_name_pdfcreator_tl |
| 6096 |
} |
| 6097 |
} |
| 6098 |
% \end{macrocode} |
| 6099 |
% |
| 6100 |
% \begin{macro}{\@@_cref_name:n} |
| 6101 |
% 用于修改 \pkg{cleveref} 的标签名称的辅助函数。 |
| 6102 |
% \begin{arguments} |
| 6103 |
% \item 标签名 |
| 6104 |
% \end{arguments} |
| 6105 |
% \begin{macrocode} |
| 6106 |
\cs_new:Npn \@@_cref_name:n #1 |
| 6107 |
{ \crefname {#1} { \@@_name:n {#1} } { \@@_name:n {#1} } } |
| 6108 |
% \end{macrocode} |
| 6109 |
% \end{macro} |
| 6110 |
% |
| 6111 |
% 修改 \pkg{cleveref} 的标签格式。默认在名称后面添加空格,删除公式编号的括号。 |
| 6112 |
% 我们在这里用回 \LaTeXe{} 的语法来处理断行和空格。 |
| 6113 |
% \begin{macrocode} |
| 6114 |
\bool_if:NT \g_@@_opt_load_cref_bool |
| 6115 |
{ |
| 6116 |
% \end{macrocode} |
| 6117 |
% |
| 6118 |
% \changes{v1.4}{2025/02/25}{增加 \pkg{cleveref} 的复数引用名称。} |
| 6119 |
% \begin{macro}{\nju@allowbreak} |
| 6120 |
% 强行插入断行位点。 |
| 6121 |
% \begin{macrocode} |
| 6122 |
\cs_new:Npn \nju@allowbreak { \skip_horizontal:n { 0pt plus 0.02em } } |
| 6123 |
% \end{macrocode} |
| 6124 |
% \end{macro} |
| 6125 |
% \begin{macrocode} |
| 6126 |
\ExplSyntaxOff |
| 6127 |
\crefformat{equation}{公式~#2#1#3} |
| 6128 |
\crefformat{chapter}{第\nju@allowbreak{}#2#1#3\nju@allowbreak{}章} |
| 6129 |
\crefformat{section}{第~#2#1#3 节} |
| 6130 |
\crefformat{subsection}{第~#2#1#3 小节} |
| 6131 |
\crefformat{subsubsection}{第~#2#1#3 小节} |
| 6132 |
% \end{macrocode} |
| 6133 |
% 修改 \pkg{cleveref} 的复数引用标签名称。 |
| 6134 |
% \begin{macrocode} |
| 6135 |
\crefrangeformat{equation}{公式~#3#1#4 到 #5#2#6} |
| 6136 |
\crefmultiformat{equation}{公式~#2#1#3} |
| 6137 |
{ 和 #2#1#3}{、#2#1#3}{和 #2#1#3} |
| 6138 |
\crefrangeformat{chapter}{第\nju@allowbreak{}#3#1#4\nju@allowbreak |
| 6139 |
章到第\nju@allowbreak{}#5#2#6\nju@allowbreak{}章} |
| 6140 |
\crefmultiformat{chapter}{第\nju@allowbreak{}#2#1#3\nju@allowbreak{}章} |
| 6141 |
{和第\nju@allowbreak{}#2#1#3\nju@allowbreak{}章} |
| 6142 |
{、第\nju@allowbreak{}#2#1#3\nju@allowbreak{}章} |
| 6143 |
{和第\nju@allowbreak{}#2#1#3\nju@allowbreak{}章} |
| 6144 |
\crefrangeformat{section}{第~#3#1#4~节到第~#5#2#6~节} |
| 6145 |
\crefmultiformat{section}{第~#2#1#3~节 } |
| 6146 |
{和第~#2#1#3~节}{、第~#2#1#3~节}{和第~#2#1#3~节} |
| 6147 |
\crefrangeformat{subsection}{第~#3#1#4~小节到第~#5#2#6~小节} |
| 6148 |
\crefmultiformat{subsection}{第~#2#1#3~小节 } |
| 6149 |
{和第~#2#1#3~小节 }{、第~#2#1#3~小节 }{和第~#2#1#3~小节} |
| 6150 |
\crefrangeformat{subsubsection}{第~#3#1#4~小节到第~#5#2#6~小节} |
| 6151 |
\crefmultiformat{subsubsection}{第~#2#1#3~小节} |
| 6152 |
{和第~#2#1#3~小节 }{、第~#2#1#3~小节}{和第~#2#1#3~小节} |
| 6153 |
% \end{macrocode} |
| 6154 |
% 修改 \pkg{cleveref} 的其他标签名称。 |
| 6155 |
% \begin{macrocode} |
| 6156 |
\ExplSyntaxOn |
| 6157 |
\clist_map_inline:nn { figure, table, appendix } |
| 6158 |
{ \@@_cref_name:n {#1} } |
| 6159 |
} |
| 6160 |
% \end{macrocode} |
| 6161 |
% |
| 6162 |
% |
| 6163 |
% \subsection{脚注} |
| 6164 |
% \changes{v0.18}{2022/05/01}{提供脚注设置项。} |
| 6165 |
% ^^A 借鉴 fduthesis |
| 6166 |
% |
| 6167 |
% \begin{variable}{\g_@@_fn_ctext_option_clist} |
| 6168 |
% 存储传入 \pkg{circledtext} 宏包的选项列表。 |
| 6169 |
% 由于当前版本放在编号位置的带圈数字无法正确缩放,这里手动指定了字体大小。 |
| 6170 |
% \begin{macrocode} |
| 6171 |
\clist_gset:Nn \g_@@_fn_ctext_option_clist { charf = \scriptsize } |
| 6172 |
% \end{macrocode} |
| 6173 |
% \end{variable} |
| 6174 |
% |
| 6175 |
% \begin{macrocode} |
| 6176 |
\keys_define:nn { nju / footnote } |
| 6177 |
{ |
| 6178 |
% \end{macrocode} |
| 6179 |
% \begin{macro}{footnote/style} |
| 6180 |
% \changes{v1.1}{2022/10/16}{增加 \opt{circled} 和 \opt{circled*} 选项。} |
| 6181 |
% 脚注编号的样式。 |
| 6182 |
% \begin{macrocode} |
| 6183 |
style .choices:nn = { plain, pifont, circled, circled* } |
| 6184 |
{ |
| 6185 |
\int_case:nnF { \l_keys_choice_int } |
| 6186 |
{ |
| 6187 |
% \end{macrocode} |
| 6188 |
% \opt{pifont} 类型,用作对旧发行版的兼容选项。 |
| 6189 |
% \begin{macrocode} |
| 6190 |
{ 2 } |
| 6191 |
{ |
| 6192 |
\RequirePackage { pifont } |
| 6193 |
\cs_set_eq:NN \@@_fn_number:N \@@_fn_number_pifont:N |
| 6194 |
} |
| 6195 |
% \end{macrocode} |
| 6196 |
% \opt{circled} 类型,带星号的版本为阴文,需引入 \pkg{circledtext} 宏包。 |
| 6197 |
% \begin{macrocode} |
| 6198 |
{ 3 } |
| 6199 |
{ |
| 6200 |
\RequirePackage { circledtext } |
| 6201 |
\cs_set:Npn \@@_fn_number:N |
| 6202 |
{ \@@_fn_number_circled:NV \c_false_bool } |
| 6203 |
} |
| 6204 |
{ 4 } |
| 6205 |
{ |
| 6206 |
\RequirePackage { circledtext } |
| 6207 |
\cs_set:Npn \@@_fn_number:N |
| 6208 |
{ \@@_fn_number_circled:NV \c_true_bool } |
| 6209 |
} |
| 6210 |
} |
| 6211 |
% \end{macrocode} |
| 6212 |
% \opt{plain} 或未知类型直接使用计数器的值。 |
| 6213 |
% \begin{macrocode} |
| 6214 |
{ \cs_set_eq:NN \@@_fn_number:N \int_use:N } |
| 6215 |
}, |
| 6216 |
% \end{macrocode} |
| 6217 |
% \end{macro} |
| 6218 |
% |
| 6219 |
% \begin{macro}{footnote/circledtext-option} |
| 6220 |
% \changes{v1.1}{2022/10/16}{将生成脚注圈码的 \pkg{pifont} 替换为 \pkg{circledtext}。} |
| 6221 |
% \pkg{circledtext} 宏包选项。 |
| 6222 |
% \begin{macrocode} |
| 6223 |
circledtext-option .code:n = |
| 6224 |
{ \clist_gput_right:Nn \g_@@_fn_ctext_option_clist {#1} }, |
| 6225 |
% \end{macrocode} |
| 6226 |
% \end{macro} |
| 6227 |
% |
| 6228 |
% \begin{macro}{footnote/hang} |
| 6229 |
% \changes{v1.1}{2022/10/16}{新增悬挂缩进选项。} |
| 6230 |
% 是否悬挂缩进。 |
| 6231 |
% \begin{macrocode} |
| 6232 |
hang .choice:, |
| 6233 |
hang / true .code:n = |
| 6234 |
{ |
| 6235 |
\cs_set:Npn \@@_fn_hang: |
| 6236 |
{ |
| 6237 |
\int_set:Nn \tex_hangafter:D { 1 } |
| 6238 |
\dim_set_eq:NN \tex_hangindent:D \l_@@_fnhang_dim |
| 6239 |
} |
| 6240 |
}, |
| 6241 |
hang / false .code:n = { \@@_cs_clear:N \@@_fn_hang: }, |
| 6242 |
hang .initial:n = true |
| 6243 |
} |
| 6244 |
% \end{macrocode} |
| 6245 |
% \end{macro} |
| 6246 |
% |
| 6247 |
% \begin{macro}{\@@_fn_number_pifont:N} |
| 6248 |
% \opt{pifont} 选项提供的带圈数字。 |
| 6249 |
% \begin{macrocode} |
| 6250 |
\cs_new:Npn \@@_fn_number_pifont:N #1 { \ding { \int_eval:n { 171 + #1 } } } |
| 6251 |
% \end{macrocode} |
| 6252 |
% \end{macro} |
| 6253 |
% |
| 6254 |
% \begin{macro}{\@@_fn_number_circled:Nn,\@@_fn_number_circled:NV} |
| 6255 |
% \opt{circled} 选项提供的带圈数字。 |
| 6256 |
% \begin{macrocode} |
| 6257 |
\cs_generate_variant:Nn \__circledtext_handle:nn { Vn } |
| 6258 |
\cs_new_protected:Npn \@@_fn_number_circled:Nn #1#2 |
| 6259 |
{ |
| 6260 |
\group_begin: |
| 6261 |
\bool_set_eq:NN \l__circledtext_negative_bool #1 |
| 6262 |
\__circledtext_handle:Vn \g_@@_fn_ctext_option_clist {#2} |
| 6263 |
\group_end: |
| 6264 |
} |
| 6265 |
\cs_generate_variant:Nn \@@_fn_number_circled:Nn { NV } |
| 6266 |
% \end{macrocode} |
| 6267 |
% \end{macro} |
| 6268 |
% |
| 6269 |
% \begin{macro}{\@@_fn_number:N} |
| 6270 |
% 脚注编号。默认使用计数器 |footnote| 的值。 |
| 6271 |
% \begin{macrocode} |
| 6272 |
\cs_new_eq:NN \@@_fn_number:N \int_use:N |
| 6273 |
% \end{macrocode} |
| 6274 |
% \end{macro} |
| 6275 |
% |
| 6276 |
% \begin{macro}{\thefootnote} |
| 6277 |
% 重定义脚注编号。 |
| 6278 |
% \begin{macrocode} |
| 6279 |
\bool_if:NT \g_@@_opt_load_fm_bool |
| 6280 |
{ |
| 6281 |
\cs_set:Npn \thefootnote { \@@_fn_number:N \c@footnote } |
| 6282 |
% \end{macrocode} |
| 6283 |
% \end{macro} |
| 6284 |
% |
| 6285 |
% \subsubsection{整体样式} |
| 6286 |
% |
| 6287 |
% \begin{macro}[int]{\@makefntext} |
| 6288 |
% 重定义内部脚注文字命令,使脚注编号不使用上标,宽度为 \qty{1.5}{em} |
| 6289 |
% \footnote{\url{http://tex.stackexchange.com/q/19844}, |
| 6290 |
% \url{https://www.zhihu.com/question/53030087}}, |
| 6291 |
% 并自行实现悬挂缩进。注意这个操作会使 \pkg{footmisc} 宏包内建的 \opt{hang} 选项失效。 |
| 6292 |
% \begin{macrocode} |
| 6293 |
\cs_set:Npn \@makefntext #1 |
| 6294 |
{ |
| 6295 |
\mode_leave_vertical: |
| 6296 |
\hbox_to_wd:nn { \l_@@_fnhang_dim } { \@thefnmark \tex_hfil:D } |
| 6297 |
\tex_penalty:D \@M |
| 6298 |
\@@_fn_hang: |
| 6299 |
#1 |
| 6300 |
} |
| 6301 |
} |
| 6302 |
% \end{macrocode} |
| 6303 |
% \end{macro} |
| 6304 |
% |
| 6305 |
% |
| 6306 |
% \subsection{图片表格} |
| 6307 |
% |
| 6308 |
% \begin{macro}{image/path} |
| 6309 |
% \changes{v1.0}{2022/08/06}{提供图片路径设置。} |
| 6310 |
% 外置图片路径,等效于 \tn{graphicspath}。 |
| 6311 |
% \begin{macrocode} |
| 6312 |
\keys_define:nn { nju / image } { path .code:n = { \graphicspath {#1} } } |
| 6313 |
% \end{macrocode} |
| 6314 |
% \end{macro} |
| 6315 |
% |
| 6316 |
% 设置默认图片扩展名,允许在不键入扩展名时自动进行补全。 |
| 6317 |
% \begin{macrocode} |
| 6318 |
\DeclareGraphicsExtensions { .pdf, .eps, .jpg, .png } |
| 6319 |
% \end{macrocode} |
| 6320 |
% |
| 6321 |
% \changes{v0.16}{2022/03/11}{表格内字体设为五号。} |
| 6322 |
% \changes{v1.0}{2022/08/06}{兼容 \pkg{tabularray} 设置。} |
| 6323 |
% \changes{v1.4}{2024/03/06}{调整 \pkg{tabularray} 设置。} |
| 6324 |
% 表格默认居中,字号设置为五号。^^A https://www.zhihu.com/question/366803177/answer/977853129 |
| 6325 |
% \begin{macrocode} |
| 6326 |
\BeforeBeginEnvironment { tabular } { \centering \l_@@_fmt_tabular_tl } |
| 6327 |
\ctex_at_end_package:nn { tabularray } |
| 6328 |
{ |
| 6329 |
% \end{macrocode} |
| 6330 |
% 等效于 \tn{UseTblrLibrary}、\tn{SetTblrInner} 与 \tn{SetTblrOuter}。 |
| 6331 |
% \begin{macrocode} |
| 6332 |
\__tblr_use_lib_booktabs: |
| 6333 |
\tl_set:Nn \l_@@_tmpb_tl |
| 6334 |
{ , abovesep = 4 pt, stretch = 0.8, cells = { font = \l_@@_fmt_tabular_tl } } |
| 6335 |
\tl_put_right:NV \l__tblr_default_tblr_inner_tl \l_@@_tmpb_tl |
| 6336 |
\tl_put_right:NV \l__tblr_default_talltblr_inner_tl \l_@@_tmpb_tl |
| 6337 |
\tl_put_right:NV \l__tblr_default_longtblr_inner_tl \l_@@_tmpb_tl |
| 6338 |
% \end{macrocode} |
| 6339 |
% 为了和标准文档类中的间距一致,文档介绍的值为 \qty{10}{pt},实际是 \qty{12.63}{pt}。 |
| 6340 |
% \begin{macrocode} |
| 6341 |
\tl_put_right:Nn \l__tblr_default_talltblr_outer_tl { , headsep = 12.63 pt } |
| 6342 |
\tl_put_right:Nn \l__tblr_default_longtblr_outer_tl { , headsep = 12.63 pt } |
| 6343 |
% \end{macrocode} |
| 6344 |
% 处理 \env{talltblr} 表注的限宽问题。 |
| 6345 |
% \footnote{\url{https://github.com/lvjr/tabularray/issues/255}} |
| 6346 |
% \begin{macrocode} |
| 6347 |
\DefTblrTemplate { caption-tag } { default } |
| 6348 |
{ \l_@@_name_table_tl \hspace { 0.25em } \thetable } |
| 6349 |
\DefTblrTemplate { caption-sep } { default } { \quad } |
| 6350 |
\DefTblrTemplate { firsthead } { caption } |
| 6351 |
{ |
| 6352 |
\makebox [ \tablewidth ] |
| 6353 |
{ \parbox { \columnwidth } { \UseTblrTemplate {caption} {normal} } } |
| 6354 |
} |
| 6355 |
\SetTblrTemplate { firsthead } { caption } |
| 6356 |
\SetTblrStyle { caption } { font = \normalfont \bfseries \small } |
| 6357 |
\SetTblrStyle { note } { font = \normalfont \footnotesize } |
| 6358 |
\SetTblrStyle { remark } { font = \normalfont \footnotesize } |
| 6359 |
} |
| 6360 |
% \end{macrocode} |
| 6361 |
% |
| 6362 |
% \changes{v0.12}{2021/12/06}{删除了可能导致冲突的 \pkg{floatrow}。} |
| 6363 |
% \changes{v0.18}{2022/05/08}{图表标题使用粗体。} |
| 6364 |
% \changes{v1.4}{2024/05/07}{图表标题区分单行多行设置。} |
| 6365 |
% 图表标题样式。文字设置为五号宋体,标签设置为粗体,间隔一个全角空格。 |
| 6366 |
% 我们在这里指定了长度不满一行的标题使用居中对齐,超过一行的按正常段落 |
| 6367 |
% 方式延伸至文字区域宽度。 |
| 6368 |
% \begin{macrocode} |
| 6369 |
\DeclareCaptionStyle { njucap } |
| 6370 |
[ justification = centering ] |
| 6371 |
{ |
| 6372 |
justification = justified, |
| 6373 |
font = {small, bf}, |
| 6374 |
labelsep = quad |
| 6375 |
} |
| 6376 |
% \end{macrocode} |
| 6377 |
% \changes{v1.4}{2024/05/07}{软性规定标题和图表本身的位置关系。} |
| 6378 |
% \pkg{caption} 提供的接口软性规定了标题和图表本身的\emph{位置关系}, |
| 6379 |
% 而并不会强制改变标题位置。 |
| 6380 |
% \begin{macrocode} |
| 6381 |
\captionsetup [ figure ] { position = below, style = njucap } |
| 6382 |
\captionsetup [ table ] { position = above, style = njucap } |
| 6383 |
% \end{macrocode} |
| 6384 |
% |
| 6385 |
% \begin{macro}{\ctex_patch_cmd:cnv} |
| 6386 |
% \begin{macrocode} |
| 6387 |
\cs_generate_variant:Nn \ctex_patch_cmd:Nnn { cnv } |
| 6388 |
% \end{macrocode} |
| 6389 |
% \end{macro} |
| 6390 |
% |
| 6391 |
% \begin{macro}{label-sep/figure,label-sep/table,label-sep/equation} |
| 6392 |
% \changes{v1.0}{2022/07/31}{添加编号连接符设置项。} |
| 6393 |
% 修改图片、表格、公式编号中的连接符。 |
| 6394 |
% \footnote{\url{https://tex.stackexchange.com/q/61756/}} |
| 6395 |
% \begin{macrocode} |
| 6396 |
\clist_map_inline:nn { figure, table, equation } |
| 6397 |
{ |
| 6398 |
\keys_define:nn { nju / label-sep } |
| 6399 |
{ |
| 6400 |
#1 .tl_gset:c = { g_@@_sep_ #1 _tl }, |
| 6401 |
% \end{macrocode} |
| 6402 |
% 根据本科生撰写规范的建议,默认连接符为短横线(en dash)。 |
| 6403 |
% \begin{macrocode} |
| 6404 |
#1 .initial:n = { - } |
| 6405 |
} |
| 6406 |
\@@_at_begin_document:n |
| 6407 |
{ \ctex_patch_cmd:cnv { the #1 } {.} { g_@@_sep_ #1 _tl } } |
| 6408 |
} |
| 6409 |
% \end{macrocode} |
| 6410 |
% \end{macro} |
| 6411 |
% |
| 6412 |
% |
| 6413 |
% \subsection{列表环境} |
| 6414 |
% \changes{v0.12}{2021/12/07}{删除了 \pkg{enumitem} 的部分列表环境设置。} |
| 6415 |
% |
| 6416 |
% 缩减列表环境的条目间距。 |
| 6417 |
% \begin{macrocode} |
| 6418 |
\bool_if:NT \g_@@_opt_load_enit_bool { \setlist { noitemsep } } |
| 6419 |
% \end{macrocode} |
| 6420 |
% |
| 6421 |
% |
| 6422 |
% \subsection{定理环境} |
| 6423 |
% \changes{v0.18}{2022/04/21}{新增定理环境的若干定制项。} |
| 6424 |
% |
| 6425 |
% \begin{macro}{\c_@@_name_qed_tl} |
| 6426 |
% 证毕符号使用 \tn{mdlgwhtsquare} 绘制,对应于 |U+25A1| 字符。 |
| 6427 |
% \footnote{\url{https://tex.stackexchange.com/q/567135/}} |
| 6428 |
% 如果 \pkg{unicode-math} 未载入,则使用黑色方块代替。 |
| 6429 |
% \begin{macrocode} |
| 6430 |
\bool_if:NTF \g_@@_opt_load_um_bool |
| 6431 |
{ \tl_const:Nn \c_@@_name_qed_tl { \ensuremath { \mdlgwhtsquare } } } |
| 6432 |
{ \tl_const:Nn \c_@@_name_qed_tl { \ensuremath { \rule {1ex} {1ex} } } } |
| 6433 |
% \end{macrocode} |
| 6434 |
% \end{macro} |
| 6435 |
% |
| 6436 |
% \begin{macro}{\l_@@_thm_share_tl} |
| 6437 |
% 存储共享的计数器名称。 |
| 6438 |
% \begin{macrocode} |
| 6439 |
\tl_new:N \l_@@_thm_share_tl |
| 6440 |
% \end{macrocode} |
| 6441 |
% \end{macro} |
| 6442 |
% |
| 6443 |
% \begin{macrocode} |
| 6444 |
\keys_define:nn { nju / theorem } |
| 6445 |
{ |
| 6446 |
% \end{macrocode} |
| 6447 |
% \begin{macro}{theorem/style,theorem/header-font,theorem/body-font, |
| 6448 |
% theorem/qed-symbol,theorem/counter} |
| 6449 |
% 定义 |nju/theorem| 键值类。^^A 这是否也可以抽象到 xtemplate? |
| 6450 |
% 目前这套选项只适用于模板预定义的若干种定理环境。 |
| 6451 |
% \begin{macrocode} |
| 6452 |
style .tl_set:N = \l_@@_thm_style_tl, |
| 6453 |
header-font .tl_set:N = \l_@@_thm_header_font_tl, |
| 6454 |
body-font .tl_set:N = \l_@@_thm_body_font_tl, |
| 6455 |
qed-symbol .tl_set:N = \l_@@_thm_qed_symbol_tl, |
| 6456 |
counter .tl_set:N = \l_@@_thm_counter_tl, |
| 6457 |
% \end{macrocode} |
| 6458 |
% 定理环境的缺省值。 |
| 6459 |
% \begin{macrocode} |
| 6460 |
style .initial:n = plain, |
| 6461 |
header-font .initial:n = \normalfont \bfseries, |
| 6462 |
body-font .initial:n = \itshape, |
| 6463 |
qed-symbol .initial:V = \c_@@_name_qed_tl, |
| 6464 |
counter .initial:n = chapter, |
| 6465 |
% \end{macrocode} |
| 6466 |
% \end{macro} |
| 6467 |
% |
| 6468 |
% \begin{macro}{theorem/type} |
| 6469 |
% 定义定理类环境。 |
| 6470 |
% \begin{macrocode} |
| 6471 |
type .clist_gset:N = \g_@@_thm_type_clist, |
| 6472 |
type .initial:n = |
| 6473 |
{ |
| 6474 |
{ axiom } { 公理 }, |
| 6475 |
{ corollary } { 推论 }, |
| 6476 |
{ definition } { 定义 }, |
| 6477 |
{ example } { 例 }, |
| 6478 |
{ lemma } { 引理 }, |
| 6479 |
{ proof, *+ } { 证明 }, |
| 6480 |
{ theorem } { 定理 } |
| 6481 |
}, |
| 6482 |
% \end{macrocode} |
| 6483 |
% \end{macro} |
| 6484 |
% |
| 6485 |
% \begin{macro}{theorem/share-counter} |
| 6486 |
% \changes{v1.3}{2023/05/07}{批量创建定理类环境时可以共享计数器。} |
| 6487 |
% 是否在分组内使用同一计数器。 |
| 6488 |
% \begin{macrocode} |
| 6489 |
share-counter .bool_set:N = \l_@@_thm_share_bool, |
| 6490 |
share-counter .initial:n = false, |
| 6491 |
% \end{macrocode} |
| 6492 |
% \end{macro} |
| 6493 |
% |
| 6494 |
% \begin{macro}{theorem/define} |
| 6495 |
% 创建定理类环境。 |
| 6496 |
% \begin{macrocode} |
| 6497 |
define .value_forbidden:n = true, |
| 6498 |
define .code:n = |
| 6499 |
{ |
| 6500 |
\clist_if_empty:NT \g_@@_thm_type_clist |
| 6501 |
{ \msg_error:nn { njuthesis } { empty-theorem-type } } |
| 6502 |
\tl_clear:N \l_@@_thm_share_tl |
| 6503 |
\clist_map_inline:Nn \g_@@_thm_type_clist |
| 6504 |
{ \@@_thm_define:Nnn \l_@@_thm_share_tl ##1 } |
| 6505 |
} |
| 6506 |
} |
| 6507 |
% \end{macrocode} |
| 6508 |
% \end{macro} |
| 6509 |
% |
| 6510 |
% \begin{macro}{\@@_thm_define:Nnn} |
| 6511 |
% 配置定理环境。 |
| 6512 |
% \begin{arguments} |
| 6513 |
% \item 共享的计数器名称,|tl| 型变量 |
| 6514 |
% \item 环境名与类型标识,|clist| 型变量 |
| 6515 |
% \item 定理头名称 |
| 6516 |
% \end{arguments} |
| 6517 |
% \begin{macrocode} |
| 6518 |
\cs_new:Npn \@@_thm_define:Nnn |
| 6519 |
{ \@@_thm_define:NNNNnn \l_@@_tmp_clist \l_@@_tmpa_tl \l_@@_tmpb_tl } |
| 6520 |
% \end{macrocode} |
| 6521 |
% \end{macro} |
| 6522 |
% |
| 6523 |
% \begin{macro}{\@@_thm_define:NNNNnn} |
| 6524 |
% \begin{macrocode} |
| 6525 |
\cs_new:Npn \@@_thm_define:NNNNnn #1#2#3#4#5#6 |
| 6526 |
{ |
| 6527 |
\bool_if:NF \g_@@_opt_load_nthm_bool |
| 6528 |
{ \msg_error:nn { njuthesis } { missing-ntheorem } } |
| 6529 |
\exp_args:NV \theoremstyle \l_@@_thm_style_tl |
| 6530 |
\exp_args:NV \theoremheaderfont \l_@@_thm_header_font_tl |
| 6531 |
\exp_args:NV \theorembodyfont \l_@@_thm_body_font_tl |
| 6532 |
% \end{macrocode} |
| 6533 |
% 拆分环境名与类型标识。这里是考虑到标识符不一定出现在环境名中, |
| 6534 |
% 典型如 \env{proof} 环境默认无编号但也不含星号。 |
| 6535 |
% \begin{macrocode} |
| 6536 |
\clist_set:Nn #1 {#5} |
| 6537 |
\clist_pop:NN #1 #2 |
| 6538 |
\clist_pop:NN #1 #3 |
| 6539 |
% \end{macrocode} |
| 6540 |
% 判断是否需要证毕符号或编号。 |
| 6541 |
% \begin{macrocode} |
| 6542 |
\tl_if_in:NnT #3 { + } |
| 6543 |
{ \exp_args:NV \theoremsymbol \l_@@_thm_qed_symbol_tl } |
| 6544 |
\tl_if_in:NnTF #3 { * } |
| 6545 |
{ \@@_thm_new:VVVn #2 \c_novalue_tl #4 {#6} } |
| 6546 |
{ \@@_thm_new:VVVn #2 \l_@@_thm_counter_tl #4 {#6} } |
| 6547 |
% \end{macrocode} |
| 6548 |
% 存储共享的计数器。 |
| 6549 |
% \begin{macrocode} |
| 6550 |
\bool_if:NT \l_@@_thm_share_bool |
| 6551 |
{ |
| 6552 |
\tl_gset_eq:NN #4 #2 |
| 6553 |
\bool_gset_false:N \l_@@_thm_share_bool |
| 6554 |
} |
| 6555 |
% \end{macrocode} |
| 6556 |
% 设置 \pkg{cleveref} 引用名。 |
| 6557 |
% \begin{macrocode} |
| 6558 |
\bool_if:NT \g_@@_opt_load_cref_bool |
| 6559 |
{ \exp_args:NV \crefname #2 {#6} {#6} } |
| 6560 |
% \end{macrocode} |
| 6561 |
% 清除保存的证毕符号。 |
| 6562 |
% \begin{macrocode} |
| 6563 |
\theoremsymbol { } |
| 6564 |
} |
| 6565 |
% \end{macrocode} |
| 6566 |
% \end{macro} |
| 6567 |
% |
| 6568 |
% \begin{macro}{\@@_thm_new:nnnn,\@@_thm_new:VVVn} |
| 6569 |
% 包装 \tn{newtheorem} 以便展开输入的变量。根据 \file{interface3.pdf} |
| 6570 |
% 手册 5.3 节最后一段建议的展开顺序,这里将 |V| 型参数放在靠前的位置。 |
| 6571 |
% \begin{arguments} |
| 6572 |
% \item 环境名 |
| 6573 |
% \item 计数器名 |
| 6574 |
% \item 头名称 |
| 6575 |
% \end{arguments} |
| 6576 |
% 根据环境结束命令是否存在可以判断该环境是否有定义, |
| 6577 |
% 相应地可以利用局部定义切换定义和重定义环境的命令。 |
| 6578 |
% \begin{macrocode} |
| 6579 |
\cs_new_protected:Npn \@@_thm_new:nnnn #1#2#3#4 |
| 6580 |
{ |
| 6581 |
\group_begin: |
| 6582 |
\cs_if_exist:cT { end #1 } |
| 6583 |
{ \cs_set_eq:NN \newtheorem \renewtheorem } |
| 6584 |
\tl_if_novalue:nTF {#2} |
| 6585 |
{ \newtheorem * {#1} {#4} } |
| 6586 |
{ |
| 6587 |
\tl_if_empty:nTF {#3} |
| 6588 |
{ \newtheorem {#1} {#4} [#2] } |
| 6589 |
{ \newtheorem {#1} [#3] {#4} } |
| 6590 |
} |
| 6591 |
\group_end: |
| 6592 |
} |
| 6593 |
\cs_generate_variant:Nn \@@_thm_new:nnnn { VVVn } |
| 6594 |
% \end{macrocode} |
| 6595 |
% \end{macro} |
| 6596 |
% |
| 6597 |
% |
| 6598 |
% \subsection{公式样式} |
| 6599 |
% \changes{v1.0}{2022/07/31}{新增若干公式样式设置。} |
| 6600 |
% \changes{v1.5.0}{2026/05/02}{禁用 \pkg{unicode-math} 时忽略 \opt{nju/math} 设置。} |
| 6601 |
% |
| 6602 |
% \begin{variable}{ |
| 6603 |
% \g_@@_opt_math_re_bool, |
| 6604 |
% \g_@@_opt_math_int_bool, |
| 6605 |
% \g_@@_opt_math_leq_bool, |
| 6606 |
% \g_@@_opt_math_vec_bool} |
| 6607 |
% 用于以下若干选项的 |bool| 变量。 |
| 6608 |
% \begin{macrocode} |
| 6609 |
\bool_new:N \g_@@_opt_math_re_bool |
| 6610 |
\bool_new:N \g_@@_opt_math_int_bool |
| 6611 |
\bool_new:N \g_@@_opt_math_leq_bool |
| 6612 |
\bool_new:N \g_@@_opt_math_vec_bool |
| 6613 |
% \end{macrocode} |
| 6614 |
% \end{variable} |
| 6615 |
% |
| 6616 |
% \begin{variable}{\l_@@_name_integral_tl} |
| 6617 |
% 保存 \pkg{unicode-math} 内置的所有积分号命令。 |
| 6618 |
% \begin{macrocode} |
| 6619 |
\tl_new:N \l_@@_name_integral_tl |
| 6620 |
\bool_if:NT \g_@@_opt_load_um_bool |
| 6621 |
{ \tl_set_eq:NN \l_@@_name_integral_tl \l__um_nolimits_tl } |
| 6622 |
% \end{macrocode} |
| 6623 |
% \end{variable} |
| 6624 |
% |
| 6625 |
% \begin{macro}{\@@_um_setup:n} |
| 6626 |
% 封装 \tn{unimathsetup}。 |
| 6627 |
% \begin{macrocode} |
| 6628 |
\cs_new:Npn \@@_um_setup:n #1 { \keys_set:nn { unicode-math } {#1} } |
| 6629 |
% \end{macrocode} |
| 6630 |
% \end{macro} |
| 6631 |
% |
| 6632 |
% ^^A 选项名称来自 thuthesis |
| 6633 |
% \begin{macrocode} |
| 6634 |
\keys_define:nn { nju / math } |
| 6635 |
{ |
| 6636 |
% \end{macrocode} |
| 6637 |
% \begin{macro}{math/integral} |
| 6638 |
% 积分号样式,直立或倾斜。 |
| 6639 |
% \begin{macrocode} |
| 6640 |
integral .groups:n = { unicode-math }, |
| 6641 |
integral .choice:, |
| 6642 |
integral / upright .code:n = |
| 6643 |
{ \bool_gset_true:N \g_@@_opt_math_int_bool }, |
| 6644 |
integral / slanted .code:n = |
| 6645 |
{ \bool_gset_false:N \g_@@_opt_math_int_bool }, |
| 6646 |
% \end{macrocode} |
| 6647 |
% \end{macro} |
| 6648 |
% |
| 6649 |
% \begin{macro}{math/integral-limits} |
| 6650 |
% 积分号上下限的位置,在上下或在右侧。 |
| 6651 |
% 两个选项分别相当于 \tn{removenolimits} 和 \tn{addnolimits}。 |
| 6652 |
% \begin{macrocode} |
| 6653 |
integral-limits .groups:n = { unicode-math }, |
| 6654 |
integral-limits .choice:, |
| 6655 |
integral-limits / true .code:n = |
| 6656 |
{ \tl_clear:N \l__um_nolimits_tl }, |
| 6657 |
integral-limits / false .code:n = |
| 6658 |
{ \tl_set_eq:NN \l__um_nolimits_tl \l_@@_name_integral_tl }, |
| 6659 |
% \end{macrocode} |
| 6660 |
% \end{macro} |
| 6661 |
% |
| 6662 |
% \begin{macro}{math/less-than-or-equal} |
| 6663 |
% 小于等于号和大于等于号的横线样式,倾斜或水平。 |
| 6664 |
% \begin{macrocode} |
| 6665 |
less-than-or-equal .groups:n = { unicode-math }, |
| 6666 |
less-than-or-equal .choice:, |
| 6667 |
less-than-or-equal / slanted .code:n = |
| 6668 |
{ \bool_gset_true:N \g_@@_opt_math_leq_bool }, |
| 6669 |
less-than-or-equal / horizontal .code:n = |
| 6670 |
{ \bool_gset_false:N \g_@@_opt_math_leq_bool }, |
| 6671 |
% \end{macrocode} |
| 6672 |
% \end{macro} |
| 6673 |
% |
| 6674 |
% \begin{macro}{math/math-ellipsis} |
| 6675 |
% 省略号的样式,居中或底部。 |
| 6676 |
% \begin{macrocode} |
| 6677 |
math-ellipsis .groups:n = { unicode-math }, |
| 6678 |
math-ellipsis .choice:, |
| 6679 |
math-ellipsis / centered .code:n = |
| 6680 |
{ |
| 6681 |
\DeclareRobustCommand \mathellipsis |
| 6682 |
{ \mathinner { \unicodecdots } } |
| 6683 |
}, |
| 6684 |
math-ellipsis / lower .code:n = |
| 6685 |
{ |
| 6686 |
\DeclareRobustCommand \mathellipsis |
| 6687 |
{ \mathinner { \unicodeellipsis } } |
| 6688 |
}, |
| 6689 |
% \end{macrocode} |
| 6690 |
% \end{macro} |
| 6691 |
% |
| 6692 |
% \begin{macro}{math/partial} |
| 6693 |
% 偏微分号样式,正体或斜体。 |
| 6694 |
% \begin{macrocode} |
| 6695 |
partial .groups:n = { unicode-math }, |
| 6696 |
partial .choices:nn = |
| 6697 |
{ upright, italic } { \@@_um_setup:n { partial = #1 } }, |
| 6698 |
% \end{macrocode} |
| 6699 |
% \end{macro} |
| 6700 |
% |
| 6701 |
% \begin{macro}{math/real-part} |
| 6702 |
% 实部和虚部符号的样式,罗马体或花体。 |
| 6703 |
% \begin{macrocode} |
| 6704 |
real-part .groups:n = { unicode-math }, |
| 6705 |
real-part .choice:, |
| 6706 |
real-part / roman .code:n = |
| 6707 |
{ \bool_gset_true:N \g_@@_opt_math_re_bool }, |
| 6708 |
real-part / fraktur .code:n = |
| 6709 |
{ \bool_gset_false:N \g_@@_opt_math_re_bool }, |
| 6710 |
% \end{macrocode} |
| 6711 |
% \end{macro} |
| 6712 |
% |
| 6713 |
% \begin{macro}{math/vector} |
| 6714 |
% 向量符号样式,粗斜体或箭头。 |
| 6715 |
% \begin{macrocode} |
| 6716 |
vector .groups:n = { unicode-math }, |
| 6717 |
vector .choice:, |
| 6718 |
vector / boldfont .code:n = |
| 6719 |
{ \bool_gset_true:N \g_@@_opt_math_vec_bool }, |
| 6720 |
vector / arrow .code:n = |
| 6721 |
{ \bool_gset_false:N \g_@@_opt_math_vec_bool }, |
| 6722 |
% \end{macrocode} |
| 6723 |
% \end{macro} |
| 6724 |
% |
| 6725 |
% \begin{macro}{math/uppercase-greek} |
| 6726 |
% 大写希腊字母的样式,正体或斜体。 |
| 6727 |
% \begin{macrocode} |
| 6728 |
uppercase-greek .groups:n = { unicode-math }, |
| 6729 |
uppercase-greek .choice:, |
| 6730 |
uppercase-greek / upright .code:n = |
| 6731 |
{ \@@_um_setup:n { math-style = ISO } }, |
| 6732 |
uppercase-greek / italic .code:n = |
| 6733 |
{ \@@_um_setup:n { math-style = TeX } }, |
| 6734 |
% \end{macrocode} |
| 6735 |
% \end{macro} |
| 6736 |
% |
| 6737 |
% \begin{macro}{math/style} |
| 6738 |
% 整体样式。 |
| 6739 |
% \begin{macrocode} |
| 6740 |
style .groups:n = { unicode-math }, |
| 6741 |
style .choice:, |
| 6742 |
style / TeX .code:n = |
| 6743 |
{ |
| 6744 |
\keys_set:nn { nju / math } |
| 6745 |
{ |
| 6746 |
integral = slanted, |
| 6747 |
integral-limits = false, |
| 6748 |
less-than-or-equal = horizontal, |
| 6749 |
math-ellipsis = centered, |
| 6750 |
partial = italic, |
| 6751 |
real-part = fraktur, |
| 6752 |
vector = arrow, |
| 6753 |
uppercase-greek = upright |
| 6754 |
} |
| 6755 |
\@@_um_setup:n { bold-style = TeX } |
| 6756 |
}, |
| 6757 |
style / ISO .code:n = |
| 6758 |
{ |
| 6759 |
\keys_set:nn { nju / math } |
| 6760 |
{ |
| 6761 |
integral = upright, |
| 6762 |
integral-limits = true, |
| 6763 |
less-than-or-equal = horizontal, |
| 6764 |
math-ellipsis = lower, |
| 6765 |
partial = upright, |
| 6766 |
real-part = roman, |
| 6767 |
vector = arrow, |
| 6768 |
uppercase-greek = italic |
| 6769 |
} |
| 6770 |
\@@_um_setup:n { bold-style = ISO } |
| 6771 |
}, |
| 6772 |
style / GB .code:n = |
| 6773 |
{ |
| 6774 |
\keys_set:nn { nju / math } |
| 6775 |
{ |
| 6776 |
integral = upright, |
| 6777 |
integral-limits = false, |
| 6778 |
less-than-or-equal = slanted, |
| 6779 |
math-ellipsis = centered, |
| 6780 |
partial = upright, |
| 6781 |
real-part = roman, |
| 6782 |
vector = boldfont, |
| 6783 |
uppercase-greek = italic |
| 6784 |
} |
| 6785 |
\@@_um_setup:n { bold-style = ISO } |
| 6786 |
}, |
| 6787 |
} |
| 6788 |
|
| 6789 |
% \end{macrocode} |
| 6790 |
% \end{macro} |
| 6791 |
% |
| 6792 |
% \changes{v1.4}{2025/05/04}{禁用 \pkg{unicode-math} 时不配置数学整体样式。} |
| 6793 |
% \begin{macrocode} |
| 6794 |
\bool_if:NT \g_@@_opt_load_um_bool |
| 6795 |
{ |
| 6796 |
\keys_define:nn { nju / math } { style .initial:n = GB } |
| 6797 |
% \end{macrocode} |
| 6798 |
% \changes{v1.3}{2023/05/22}{禁用 \pkg{unicode-math} 时不配置数学字体。} |
| 6799 |
% 在 |\begin{document}| 处载入字体以兼容 \pkg{mathtools}, |
| 6800 |
% 并设置小于等于号和实部符号等的样式。 |
| 6801 |
% \begin{macrocode} |
| 6802 |
\@@_at_begin_document:n |
| 6803 |
{ |
| 6804 |
\use:c { @@_loadfont_math_ \g_@@_font_math_tl : } |
| 6805 |
\bool_if:NT \g_@@_opt_math_leq_bool |
| 6806 |
{ |
| 6807 |
\cs_set_eq:NN \le \leqslant |
| 6808 |
\cs_set_eq:NN \ge \geqslant |
| 6809 |
\cs_set_eq:NN \leq \leqslant |
| 6810 |
\cs_set_eq:NN \geq \geqslant |
| 6811 |
} |
| 6812 |
\bool_if:NT \g_@@_opt_math_re_bool |
| 6813 |
{ |
| 6814 |
\cs_set:Npn \Re { \operatorname { Re } } |
| 6815 |
\cs_set:Npn \Im { \operatorname { Im } } |
| 6816 |
} |
| 6817 |
\bool_if:NT \g_@@_opt_math_vec_bool |
| 6818 |
{ \cs_set_eq:NN \vec \symbf } |
| 6819 |
} |
| 6820 |
} |
| 6821 |
%</class> |
| 6822 |
% \end{macrocode} |
| 6823 |
% |
| 6824 |
% |
| 6825 |
% \subsection{封面} |
| 6826 |
% |
| 6827 |
% \subsubsection{绘制部件} |
| 6828 |
% \changes{v0.16}{2022/03/01}{将封面部件分离到 \file{.def} 文件。} |
| 6829 |
% |
| 6830 |
% \paragraph{本科生} |
| 6831 |
% |
| 6832 |
% \subparagraph{封面} |
| 6833 |
% |
| 6834 |
% \begin{macro}{u/cover/emblem-img} |
| 6835 |
% \changes{v1.1}{2023/01/15}{本科生模板封面校徽居中。} |
| 6836 |
% \changes{v1.2}{2023/05/02}{更正本科生模板封面字体和行距。} |
| 6837 |
% 本科生封面校徽图片实例。 |
| 6838 |
% \begin{macrocode} |
| 6839 |
%<*def-u> |
| 6840 |
\@@_declare_element:nn { u / cover / emblem-img } |
| 6841 |
{ |
| 6842 |
content = \@@_logo_emblem:, |
| 6843 |
bottom-skip = 1.2 cm |
| 6844 |
} |
| 6845 |
% \end{macrocode} |
| 6846 |
% \end{macro} |
| 6847 |
% |
| 6848 |
% \begin{macro}{u/cover/name-img} |
| 6849 |
% 本科生封面校名图片实例。 |
| 6850 |
% \begin{macrocode} |
| 6851 |
\@@_declare_element:nn { u / cover / name-img } |
| 6852 |
{ |
| 6853 |
content = \@@_logo_name:, |
| 6854 |
bottom-skip = 31.5 pt, |
| 6855 |
} |
| 6856 |
% \end{macrocode} |
| 6857 |
% \end{macro} |
| 6858 |
% |
| 6859 |
% \begin{macro}{u/cover/title} |
| 6860 |
% 本科生封面标题实例。 |
| 6861 |
% \begin{macrocode} |
| 6862 |
\@@_declare_element:nn { u / cover / title } |
| 6863 |
{ |
| 6864 |
content = \@@_name:n { type }, |
| 6865 |
format = \zihao { 1 } \bfseries \@@_set_ccglue:n { .5 em }, |
| 6866 |
bottom-skip = 4 pt plus 1 fill |
| 6867 |
} |
| 6868 |
% \end{macrocode} |
| 6869 |
% \end{macro} |
| 6870 |
% |
| 6871 |
% \begin{macro}{u/cover/info} |
| 6872 |
% \changes{v1.3}{2023/05/25}{将本科生封面信息恢复至 v1.1 的宋体格式。} |
| 6873 |
% \changes{v1.4}{2025/05/14}{本科生封面信息全部使用楷体格式。} |
| 6874 |
% \changes{v1.5.0}{2026/05/12}{匹配本科生 Word 模板第二栏间距。} |
| 6875 |
% 本科生封面信息栏实例。 |
| 6876 |
% \begin{macrocode} |
| 6877 |
\@@_declare_element:nn { u / cover / info } |
| 6878 |
{ |
| 6879 |
content = \@@_u_cover_info:, |
| 6880 |
format = \zihao { 3 } \kaishu |
| 6881 |
} |
| 6882 |
% \end{macrocode} |
| 6883 |
% \end{macro} |
| 6884 |
% |
| 6885 |
% \begin{macro}{\@@_u_cover_info:NNNNN} |
| 6886 |
% 本科生封面信息栏。 |
| 6887 |
% \begin{arguments} |
| 6888 |
% \item 第一个名称盒子宽度,|dim| 型变量 |
| 6889 |
% \item 第二个名称盒子宽度,|dim| 型变量 |
| 6890 |
% \item 长内容盒子宽度,|dim| 型变量 |
| 6891 |
% \item 间隔宽度,|dim| 型变量 |
| 6892 |
% \item 标签格式 |
| 6893 |
% \end{arguments} |
| 6894 |
% \begin{macrocode} |
| 6895 |
\cs_new_protected:Npn \@@_u_cover_info:NNNNN #1#2#3#4#5 |
| 6896 |
{ |
| 6897 |
\@@_cover_entry:NNNn #1 #3 #5 { dept } |
| 6898 |
\@@_cover_entry:NNNn #1 #3 #5 { major } |
| 6899 |
\@@_cover_entry_title:NNN #1 #3 #5 |
| 6900 |
% \end{macrocode} |
| 6901 |
% 短内容盒子的长度值是通过计算长下划线减去短标签 |
| 6902 |
% 减去分隔长度再除以二得到的。 |
| 6903 |
% |dim| 型变量的乘除需要采取 \cs{dim_ratio:nn} 提供的形式。 |
| 6904 |
% \begin{macrocode} |
| 6905 |
\dim_set:Nn \l_@@_tmpb_dim { #3 * 1/2 - #2 * 1/2 - #4 } |
| 6906 |
\@@_cover_entry:NNNNnn #1 #2 \l_@@_tmpb_dim #5 { grade } { id } |
| 6907 |
\@@_cover_entry:NNNn #1 #3 #5 { author } |
| 6908 |
\@@_cover_entry_supv:NNNNn #1 #2 \l_@@_tmpb_dim #5 { supv } |
| 6909 |
\bool_if:NT \g_@@_opt_supvii_bool |
| 6910 |
{ \@@_cover_entry_supv:NNNNn #1 #2 \l_@@_tmpb_dim #5 { supvii } } |
| 6911 |
\@@_cover_entry:NNNn #1 #3 #5 { submitdate } |
| 6912 |
} |
| 6913 |
% \end{macrocode} |
| 6914 |
% \end{macro} |
| 6915 |
% |
| 6916 |
% \begin{macro}{\@@_u_cover_info:} |
| 6917 |
% 为了和 Word 版本对齐,手动向左移动了 16 pt。 |
| 6918 |
% \begin{macrocode} |
| 6919 |
\cs_new:Npn \@@_u_cover_info: |
| 6920 |
{ |
| 6921 |
\mode_leave_vertical: |
| 6922 |
\skip_horizontal:n { -16 pt } |
| 6923 |
\@@_vbox_center:n |
| 6924 |
{ |
| 6925 |
\@@_u_cover_info:NNNNN \l_@@_clabelwd_dim \l_@@_clabelwdi_dim |
| 6926 |
\l_@@_crulewd_dim \l_@@_hsep_dim \l_@@_fmt_coverlabel_tl |
| 6927 |
} |
| 6928 |
} |
| 6929 |
% \end{macrocode} |
| 6930 |
% \end{macro} |
| 6931 |
% |
| 6932 |
% \subparagraph{诚信承诺书} |
| 6933 |
% \changes{v1.2}{2023/05/02}{更正本科生模板承诺书行距。} |
| 6934 |
% |
| 6935 |
% \begin{macro}{u/decl/orig/emblem} |
| 6936 |
% 本科生诚信承诺书校徽实例。 |
| 6937 |
% 这里固定使用紫色版本校徽。 |
| 6938 |
% \begin{macrocode} |
| 6939 |
\@@_declare_element:nn { u / decl / orig / emblem } |
| 6940 |
{ |
| 6941 |
content = |
| 6942 |
\@@_logo_emblem:Nn \l_@@_emblemwdi_dim { nju-emblem-purple.pdf }, |
| 6943 |
bottom-skip = 30 pt |
| 6944 |
} |
| 6945 |
% \end{macrocode} |
| 6946 |
% \end{macro} |
| 6947 |
% |
| 6948 |
% \begin{macro}{u/decl/orig/title} |
| 6949 |
% 本科生诚信承诺书标题实例。 |
| 6950 |
% Word 模板中的行距是固定值 \qty{36}{bp},这里需要除以 1.625 的 \tn{linespread}。 |
| 6951 |
% \begin{macrocode} |
| 6952 |
\@@_declare_element:nn { u / decl / orig / title } |
| 6953 |
{ |
| 6954 |
content = \l_@@_name_origdecl_tl, |
| 6955 |
format = \sffamily \@@_fontsize:nn { 24 bp } { 22.15 bp } \bfseries, |
| 6956 |
bottom-skip = 50 pt |
| 6957 |
} |
| 6958 |
% \end{macrocode} |
| 6959 |
% \end{macro} |
| 6960 |
% |
| 6961 |
% \begin{macro}{u/decl/orig/text} |
| 6962 |
% 本科生诚信承诺书文本实例。 |
| 6963 |
% \begin{macrocode} |
| 6964 |
\@@_declare_element:nn { u / decl / orig / text } |
| 6965 |
{ |
| 6966 |
content = \l_@@_text_origdecl_tl, |
| 6967 |
format = \@@_zihao:nn { 1.9 } { -3 }, |
| 6968 |
align = n, |
| 6969 |
bottom-skip = 2.7 cm |
| 6970 |
} |
| 6971 |
% \end{macrocode} |
| 6972 |
% \end{macro} |
| 6973 |
% |
| 6974 |
% \begin{macro}{u/decl/orig/sign} |
| 6975 |
% 本科生诚信承诺书签名区实例。 |
| 6976 |
% \begin{macrocode} |
| 6977 |
\@@_declare_element:nn { u / decl / orig / sign } |
| 6978 |
{ |
| 6979 |
content = \@@_decl_sign:, |
| 6980 |
format = \zihao { -3 } \sffamily, |
| 6981 |
align = r |
| 6982 |
} |
| 6983 |
%</def-u> |
| 6984 |
% \end{macrocode} |
| 6985 |
% \end{macro} |
| 6986 |
% |
| 6987 |
% \begin{macro}{\@@_decl_sign:} |
| 6988 |
% 通用的承诺书签名区。 |
| 6989 |
% \begin{macrocode} |
| 6990 |
%<*(def-u|def-g)> |
| 6991 |
\cs_new_protected:Npn \@@_decl_sign: |
| 6992 |
{ |
| 6993 |
%<def-u> \clist_map_inline:nn { origsign, id, date } |
| 6994 |
%<def-g> \clist_map_inline:nn { origsign, date } |
| 6995 |
{ \tex_par:D \@@_name:n {##1} : \hbox_to_wd:nn { 6 em } { } } |
| 6996 |
} |
| 6997 |
%</(def-u|def-g)> |
| 6998 |
% \end{macrocode} |
| 6999 |
% \end{macro} |
| 7000 |
% |
| 7001 |
% \paragraph{研究生} |
| 7002 |
% \changes{v1.0}{2022/06/30}{调整研究生封面布局。} |
| 7003 |
% \changes{v1.2}{2023/05/01}{更新2023年新版研究生学位论文封面布局。} |
| 7004 |
% |
| 7005 |
% \subparagraph{正面} 包括校名、校徽、标题、信息栏。 |
| 7006 |
% |
| 7007 |
% \begin{macro}{g/cover-front/top} |
| 7008 |
% \changes{v1.5.0}{2026/05/13}{调整研究生封面顶部信息字号和间距。} |
| 7009 |
% 研究生封面顶部信息实例。 |
| 7010 |
% 因为我们设置了全局的 |linespread=1.625|,此处单倍行距对应的倍数为 $1.2/1.3$。 |
| 7011 |
% \begin{macrocode} |
| 7012 |
%<*def-g> |
| 7013 |
\@@_declare_element:nn { g / cover-front / top } |
| 7014 |
{ |
| 7015 |
content = |
| 7016 |
\skip_vertical:n { -9 bp } \skip_horizontal:n { -18 pt } |
| 7017 |
\vbox:n { \@@_g_cover_top: }, |
| 7018 |
format = \normalfont \@@_zihao:nn { 0.923 } { -5 }, |
| 7019 |
bottom-skip = 20.5 pt, |
| 7020 |
align = l |
| 7021 |
} |
| 7022 |
% \end{macrocode} |
| 7023 |
% \end{macro} |
| 7024 |
% |
| 7025 |
% \begin{macro}{g/cover-front/emblem-img} |
| 7026 |
% 研究生封面校徽图片实例。 |
| 7027 |
% \begin{macrocode} |
| 7028 |
\@@_declare_element:nn { g / cover-front / emblem-img } |
| 7029 |
{ |
| 7030 |
content = \@@_logo_emblem:, |
| 7031 |
bottom-skip = 14.5 pt, |
| 7032 |
} |
| 7033 |
% \end{macrocode} |
| 7034 |
% \end{macro} |
| 7035 |
% |
| 7036 |
% \begin{macro}{g/cover-front/name-img} |
| 7037 |
% 研究生封面校名图片实例。 |
| 7038 |
% \begin{macrocode} |
| 7039 |
\@@_declare_element:nn { g / cover-front / name-img } |
| 7040 |
{ |
| 7041 |
content = \@@_logo_name:, |
| 7042 |
bottom-skip = 2.25 cm |
| 7043 |
} |
| 7044 |
% \end{macrocode} |
| 7045 |
% \end{macro} |
| 7046 |
% |
| 7047 |
% \begin{macro}{g/cover-front/type} |
| 7048 |
% 研究生封面标题实例。 |
| 7049 |
% \begin{macrocode} |
| 7050 |
\@@_declare_element:nn { g / cover-front / type } |
| 7051 |
{ |
| 7052 |
content = \@@_info:n { type } \@@_name:n { type }, |
| 7053 |
format = |
| 7054 |
\@@_fontsize:nn { 28 bp } { 28 bp } \@@_stzhongs: \bfseries |
| 7055 |
\@@_set_ccglue:n { .5 em }, |
| 7056 |
bottom-skip = 0 pt plus 1 fill |
| 7057 |
} |
| 7058 |
% \end{macrocode} |
| 7059 |
% \end{macro} |
| 7060 |
% |
| 7061 |
% \begin{macro}{g/cover-front/info} |
| 7062 |
% \changes{v1.5.0}{2026/05/13}{调整研究生封面信息表间距。} |
| 7063 |
% 研究封面信息栏实例。 |
| 7064 |
% \begin{macrocode} |
| 7065 |
\@@_declare_element:nn { g / cover-front / info } |
| 7066 |
{ |
| 7067 |
content = \@@_g_cover_info:, |
| 7068 |
format = \@@_zihao:nn { 1.02 } { 3 }, |
| 7069 |
bottom-skip = 23 pt plus 1 fill |
| 7070 |
} |
| 7071 |
% \end{macrocode} |
| 7072 |
% \end{macro} |
| 7073 |
% |
| 7074 |
% \begin{macro}{g/cover-front/date} |
| 7075 |
% 研究封面日期实例。 |
| 7076 |
% \begin{macrocode} |
| 7077 |
\@@_declare_element:nn { g / cover-front / date } |
| 7078 |
{ |
| 7079 |
content = \g_@@_info_submitdate_tl, |
| 7080 |
format = \zihao { 4 }, |
| 7081 |
bottom-skip = 102 pt |
| 7082 |
} |
| 7083 |
% \end{macrocode} |
| 7084 |
% \end{macro} |
| 7085 |
% |
| 7086 |
% \begin{macro}{\@@_g_cover_top:} |
| 7087 |
% \changes{v1.2}{2023/05/03}{根据学号长度确定研究生封面顶部的下划线长度。} |
| 7088 |
% 研究生封面顶部信息栏。 |
| 7089 |
% \begin{macrocode} |
| 7090 |
\cs_new_protected:Npn \@@_g_cover_top: |
| 7091 |
{ |
| 7092 |
\dim_set:Nn \l_@@_tmpa_dim { 4 em } |
| 7093 |
\dim_set:Nn \l_@@_tmpb_dim { 60 pt } |
| 7094 |
\tl_set:Nn \l_@@_tmpa_tl |
| 7095 |
{ \hbox_to_wd:nn { 14.4 pt } { \l_@@_name_colon_tl \tex_hfill:D } } |
| 7096 |
\clist_map_inline:nn { code, clc, secretlv, udc, id } |
| 7097 |
{ |
| 7098 |
\@@_cover_entry:NNNNn \l_@@_tmpa_tl \l_@@_tmpa_dim |
| 7099 |
\l_@@_tmpb_dim \scan_stop: {##1} |
| 7100 |
} |
| 7101 |
} |
| 7102 |
% \end{macrocode} |
| 7103 |
% \end{macro} |
| 7104 |
% |
| 7105 |
% \begin{macro}{\@@_g_cover_info:NNNNN} |
| 7106 |
% 研究生封面中部信息栏。 |
| 7107 |
% \begin{macrocode} |
| 7108 |
\cs_new_protected:Npn \@@_g_cover_info:NNNNN #1#2#3#4#5 |
| 7109 |
{ |
| 7110 |
\bool_if:NTF \g_@@_opt_academic_bool |
| 7111 |
{ \clist_set:Nn #1 { author, major, field, supvfull } } |
| 7112 |
{ \clist_set:Nn #1 { author, majorc, field, supvfull } } |
| 7113 |
\@@_cover_entry_title:NNNN #2 #3 #4 #5 |
| 7114 |
\clist_map_inline:Nn #1 |
| 7115 |
{ \@@_cover_entry:NNNNn #2 #3 #4 #5 {##1} } |
| 7116 |
} |
| 7117 |
% \end{macrocode} |
| 7118 |
% \end{macro} |
| 7119 |
% |
| 7120 |
% \begin{macro}{\@@_g_cover_info:} |
| 7121 |
% \begin{macrocode} |
| 7122 |
\cs_new:Npn \@@_g_cover_info: |
| 7123 |
{ |
| 7124 |
\tl_set:Nn \l_@@_tmpa_tl { \skip_horizontal:n { 25 pt } } |
| 7125 |
\@@_g_cover_info:NNNNN \l_@@_tmp_clist \l_@@_tmpa_tl |
| 7126 |
\l_@@_clabelwd_dim \l_@@_crulewd_dim \l_@@_fmt_coverlabel_tl |
| 7127 |
} |
| 7128 |
% \end{macrocode} |
| 7129 |
% \end{macro} |
| 7130 |
% |
| 7131 |
% \subparagraph{背面} |
| 7132 |
% |
| 7133 |
% \begin{macro}{g/cover-back/info} |
| 7134 |
% 研究生封面背面信息实例。 |
| 7135 |
% \begin{macrocode} |
| 7136 |
\@@_declare_element:nn { g / cover-back / info } |
| 7137 |
{ |
| 7138 |
content = \@@_g_cover_back:, |
| 7139 |
bottom-skip = 8.07 cm |
| 7140 |
} |
| 7141 |
% \end{macrocode} |
| 7142 |
% \end{macro} |
| 7143 |
% |
| 7144 |
% \begin{macro}{g/cover-back/sign} |
| 7145 |
% 研究生封面背面信息实例。 |
| 7146 |
% \begin{macrocode} |
| 7147 |
\@@_declare_element:nn { g / cover-back / sign } |
| 7148 |
{ |
| 7149 |
content = \@@_g_cover_sign:, |
| 7150 |
align = l |
| 7151 |
} |
| 7152 |
% \end{macrocode} |
| 7153 |
% \end{macro} |
| 7154 |
% |
| 7155 |
% \begin{macro}{\@@_g_cover_back:NNN,\@@_g_cover_back:} |
| 7156 |
% 研究生封面背面信息。 |
| 7157 |
% 微调了水平和垂直位置,以和 Word 版本重合。别问我这些数字怎么来的。 |
| 7158 |
% \begin{arguments} |
| 7159 |
% \item 名称盒子宽度,|dim| 型变量 |
| 7160 |
% \item 内容盒子宽度,|dim| 型变量 |
| 7161 |
% \item 标签格式 |
| 7162 |
% \end{arguments} |
| 7163 |
% \begin{macrocode} |
| 7164 |
\cs_new_protected:Npn \@@_g_cover_back:NNN #1#2#3 |
| 7165 |
{ |
| 7166 |
\tl_set:Nn \l_@@_tmpa_tl { \skip_horizontal:n { 11 pt } } |
| 7167 |
\@@_cover_entry:NNNNn \l_@@_tmpa_tl #1 #2 #3 { chairman } |
| 7168 |
\tex_par:D |
| 7169 |
\@@_box_spread_name:NNn #1 #3 { reviewer } |
| 7170 |
\skip_horizontal:n { 11 pt } |
| 7171 |
\@@_box_paragraph:nn {#2} |
| 7172 |
{ \@@_box_multiline:NNn \g_@@_info_reviewer_clist {#2} { 5 } } |
| 7173 |
\skip_vertical:n { -4 pt } |
| 7174 |
\@@_box_spread_name:NNn #1 #3 { defend date } |
| 7175 |
\skip_horizontal:n { 11 pt } |
| 7176 |
\@@_info:n { defend date } |
| 7177 |
} |
| 7178 |
\cs_new:Npn \@@_g_cover_back: |
| 7179 |
{ |
| 7180 |
\mode_leave_vertical: |
| 7181 |
\skip_horizontal:n { -22 pt } |
| 7182 |
\@@_vbox_center:n |
| 7183 |
{ |
| 7184 |
\@@_g_cover_back:NNN \l_@@_clabelwdi_dim |
| 7185 |
\l_@@_crulewdi_dim \l_@@_fmt_coverlabel_tl |
| 7186 |
} |
| 7187 |
} |
| 7188 |
% \end{macrocode} |
| 7189 |
% \end{macro} |
| 7190 |
% |
| 7191 |
% \begin{macro}{\@@_cover_sign_g:NNN,\@@_cover_sign_g:} |
| 7192 |
% 研究生封面背面信息。 |
| 7193 |
% \begin{arguments} |
| 7194 |
% \item 名称盒子宽度,|dim| 型变量 |
| 7195 |
% \item 标签格式 |
| 7196 |
% \item 分隔符 |
| 7197 |
% \end{arguments} |
| 7198 |
% \begin{macrocode} |
| 7199 |
\cs_new_protected:Npn \@@_g_cover_sign:NNN #1#2#3 |
| 7200 |
{ |
| 7201 |
\@@_box_spread_name:NNn #1 #2 { sign a } #3 \tex_par:D |
| 7202 |
\@@_box_spread_name:NNn #1 #2 { sign b } #3 |
| 7203 |
} |
| 7204 |
\cs_new:Npn \@@_g_cover_sign: |
| 7205 |
{ |
| 7206 |
\@@_g_cover_sign:NNN \l_@@_clabelwdii_dim |
| 7207 |
\l_@@_fmt_coverlabel_tl \l_@@_name_colon_tl |
| 7208 |
} |
| 7209 |
% \end{macrocode} |
| 7210 |
% \end{macro} |
| 7211 |
% |
| 7212 |
% |
| 7213 |
% \subparagraph{英文封面} 包括标题、顶部、中部、校徽、底部。 |
| 7214 |
% \changes{v1.3}{2023/08/21}{修复英文标题超长引发的页面元素混乱。} |
| 7215 |
% |
| 7216 |
% \begin{macro}{g/cover-en/title} |
| 7217 |
% 研究生英文封面标题实例。 |
| 7218 |
% \begin{macrocode} |
| 7219 |
\@@_declare_element:nn { g / cover-en / title } |
| 7220 |
{ |
| 7221 |
content = \g_@@_info_title_en_tl, |
| 7222 |
format = \bf \sffamily \zihao { 2 }, |
| 7223 |
bottom-skip = 1 cm plus 1 fil minus .5 cm |
| 7224 |
} |
| 7225 |
% \end{macrocode} |
| 7226 |
% \end{macro} |
| 7227 |
% |
| 7228 |
% \begin{macro}{g/cover-en/top} |
| 7229 |
% 研究生英文封面顶部信息实例。 |
| 7230 |
% \begin{macrocode} |
| 7231 |
\@@_declare_element:nn { g / cover-en / top } |
| 7232 |
{ |
| 7233 |
content = |
| 7234 |
{ by } |
| 7235 |
\skip_vertical:N \c_zero_skip |
| 7236 |
\textbf { \sffamily \g_@@_info_author_en_tl } |
| 7237 |
\skip_vertical:n { .5 cm minus .5 cm } |
| 7238 |
{ Supervised~ by } |
| 7239 |
\skip_vertical:N \c_zero_skip |
| 7240 |
\textsf { \g_@@_info_supv_en_tl |
| 7241 |
\tex_par:D \g_@@_info_supvii_en_tl }, |
| 7242 |
format = \zihao { 4 }, |
| 7243 |
bottom-skip = 1 cm plus 1 fil minus .5 cm |
| 7244 |
} |
| 7245 |
% \end{macrocode} |
| 7246 |
% \end{macro} |
| 7247 |
% |
| 7248 |
% \begin{macro}{g/cover-en/middle} |
| 7249 |
% 研究生英文封面中部信息实例。 |
| 7250 |
% \begin{macrocode} |
| 7251 |
\@@_declare_element:nn { g / cover-en / middle } |
| 7252 |
{ |
| 7253 |
content = |
| 7254 |
\l_@@_text_cover_en_tl \@@_vskip: |
| 7255 |
\group_begin: \scshape \g_@@_info_degree_en_tl \group_end: |
| 7256 |
\@@_vskip: { in } \@@_vskip: \g_@@_info_major_en_tl, |
| 7257 |
bottom-skip = .5 cm plus 1 fil |
| 7258 |
} |
| 7259 |
% \end{macrocode} |
| 7260 |
% \end{macro} |
| 7261 |
% |
| 7262 |
% \begin{macro}{g/cover-en/emblem-img} |
| 7263 |
% 研究生英文封面校徽图片实例。 |
| 7264 |
% \begin{macrocode} |
| 7265 |
\@@_declare_element:nn { g / cover-en / emblem-img } |
| 7266 |
{ |
| 7267 |
content = \@@_logo_emblem:n { ii }, |
| 7268 |
bottom-skip = 1 cm minus .5 cm |
| 7269 |
} |
| 7270 |
% \end{macrocode} |
| 7271 |
% \end{macro} |
| 7272 |
% |
| 7273 |
% \begin{macro}{g/cover-en/bottom} |
| 7274 |
% 研究生英文封面底部信息实例。 |
| 7275 |
% \begin{macrocode} |
| 7276 |
\@@_declare_element:nn { g / cover-en / bottom } |
| 7277 |
{ |
| 7278 |
content = |
| 7279 |
\g_@@_info_dept_en_tl \skip_vertical:N \c_zero_skip |
| 7280 |
\l_@@_name_nju_en_tl \skip_vertical:n { 1 cm } |
| 7281 |
\g_@@_info_submitdate_en_tl |
| 7282 |
} |
| 7283 |
% \end{macrocode} |
| 7284 |
% \end{macro} |
| 7285 |
% |
| 7286 |
% \subparagraph{国家图书馆封面} 包括顶部、题名、标题、中部、底部、日期。 |
| 7287 |
% |
| 7288 |
% \begin{macro}{cover-nl/top} |
| 7289 |
% 国家图书馆封面顶部信息实例。 |
| 7290 |
% \begin{macrocode} |
| 7291 |
\@@_declare_element:nn { cover-nl / top } |
| 7292 |
{ |
| 7293 |
content = \@@_cover_top_nl:, |
| 7294 |
bottom-skip = 2 cm |
| 7295 |
} |
| 7296 |
% \end{macrocode} |
| 7297 |
% \end{macro} |
| 7298 |
% |
| 7299 |
% \begin{macro}{cover-nl/name} |
| 7300 |
% 国家图书馆封面标题名称实例。 |
| 7301 |
% \begin{macrocode} |
| 7302 |
\@@_declare_element:nn { cover-nl / name } |
| 7303 |
{ |
| 7304 |
content = |
| 7305 |
\dim_set:Nn \l_@@_tmpa_dim { 6 em } |
| 7306 |
\@@_box_spread_name:Nn \l_@@_tmpa_dim { titleb }, |
| 7307 |
format = \zihao { -0 }, |
| 7308 |
bottom-skip = 0 pt plus 1 fil |
| 7309 |
} |
| 7310 |
% \end{macrocode} |
| 7311 |
% \end{macro} |
| 7312 |
% |
| 7313 |
% \begin{macro}{cover-nl/title} |
| 7314 |
% 国家图书馆封面标题实例。 |
| 7315 |
% \begin{macrocode} |
| 7316 |
\@@_declare_element:nn { cover-nl / title } |
| 7317 |
{ |
| 7318 |
content = \@@_cover_title_nl:, |
| 7319 |
format = \zihao { 1 }, |
| 7320 |
bottom-skip = 0 pt plus 1 fil |
| 7321 |
} |
| 7322 |
% \end{macrocode} |
| 7323 |
% \end{macro} |
| 7324 |
% |
| 7325 |
% \begin{macro}{cover-nl/middle} |
| 7326 |
% 国家图书馆封面中部信息实例。 |
| 7327 |
% \begin{macrocode} |
| 7328 |
\@@_declare_element:nn { cover-nl / middle } |
| 7329 |
{ |
| 7330 |
content = \@@_cover_info_nl:, |
| 7331 |
format = \zihao { 4 }, |
| 7332 |
bottom-skip = 0 pt plus 1.2 fil |
| 7333 |
} |
| 7334 |
% \end{macrocode} |
| 7335 |
% \end{macro} |
| 7336 |
% |
| 7337 |
% \begin{macro}{cover-nl/bottom} |
| 7338 |
% 国家图书馆封面底部信息实例。 |
| 7339 |
% \begin{macrocode} |
| 7340 |
\@@_declare_element:nn { cover-nl / bottom } |
| 7341 |
{ |
| 7342 |
content = \@@_cover_bottom_nl:, |
| 7343 |
bottom-skip = 1 cm, |
| 7344 |
align = r |
| 7345 |
} |
| 7346 |
% \end{macrocode} |
| 7347 |
% \end{macro} |
| 7348 |
% |
| 7349 |
% \begin{macro}{cover-nl/date} |
| 7350 |
% 国家图书馆封面底部日期实例。 |
| 7351 |
% \begin{macrocode} |
| 7352 |
\@@_declare_element:nn { cover-nl / date } |
| 7353 |
{ |
| 7354 |
content = \g_@@_info_bottomdate_tl, |
| 7355 |
format = \kaishu \zihao { 3 } |
| 7356 |
} |
| 7357 |
% \end{macrocode} |
| 7358 |
% \end{macro} |
| 7359 |
% |
| 7360 |
% \begin{macro}{\@@_cover_top_nl:,\@@_cover_top_nl:NN} |
| 7361 |
% 国家图书馆封面顶部信息。 |
| 7362 |
% \begin{macrocode} |
| 7363 |
\cs_new:Npn \@@_cover_top_nl: |
| 7364 |
{ \@@_cover_top_nl:NN \l_@@_tmpa_dim \l_@@_tmpb_dim } |
| 7365 |
\cs_new_protected:Npn \@@_cover_top_nl:NN #1#2 |
| 7366 |
{ |
| 7367 |
\dim_set:Nn #1 { 38.6 pt } |
| 7368 |
\dim_set:Nn #2 { 109 pt } |
| 7369 |
\@@_box_spread_name:Nn #1 { clc } \@@_hskip: |
| 7370 |
\@@_box_ulined_info:Nn #2 { clc } \tex_hfill:D |
| 7371 |
\@@_box_spread_name:Nn #1 { secretlv } \@@_hskip: |
| 7372 |
\@@_box_ulined_info:Nn #2 { secretlv } \tex_par:D |
| 7373 |
\@@_box_spread_name:Nn #1 { udc } \@@_hskip: |
| 7374 |
\@@_box_ulined_info:Nn #2 { udc } \tex_hfill:D |
| 7375 |
\@@_null: |
| 7376 |
} |
| 7377 |
% \end{macrocode} |
| 7378 |
% \end{macro} |
| 7379 |
% |
| 7380 |
% \begin{macro}{\@@_cover_title_nl:} |
| 7381 |
% 国家图书馆封面标题。 |
| 7382 |
% \begin{macrocode} |
| 7383 |
\cs_new_protected:Npn \@@_cover_title_nl: |
| 7384 |
{ |
| 7385 |
\mode_leave_vertical: |
| 7386 |
\vbox:n |
| 7387 |
{ |
| 7388 |
\dim_set:Nn \tex_hsize:D { 15 em } |
| 7389 |
\@@_print_ulined_title: |
| 7390 |
} |
| 7391 |
\tex_par:D |
| 7392 |
\skip_vertical:n { - 0.5 cm } |
| 7393 |
\group_begin: |
| 7394 |
\@@_zihao:n { 4 } \l_@@_name_subtitle_tl |
| 7395 |
\group_end: |
| 7396 |
\skip_vertical:N \c_zero_skip |
| 7397 |
\dim_set:Nn \l_@@_tmpa_dim { 4.5 em } |
| 7398 |
\@@_box_ulined_info:Nn \l_@@_tmpa_dim { author } |
| 7399 |
\skip_vertical:n { - 0.5 cm } |
| 7400 |
\group_begin: |
| 7401 |
\@@_zihao:n { 4 } ( \l_@@_name_author_tl ) |
| 7402 |
\group_end: |
| 7403 |
} |
| 7404 |
% \end{macrocode} |
| 7405 |
% \end{macro} |
| 7406 |
% |
| 7407 |
% \begin{macro}{\@@_cover_info_nl:} |
| 7408 |
% \changes{v0.17}{2022/04/09}{优化国家图书馆封面导师联系方式的输出格式。} |
| 7409 |
% \changes{v0.19}{2022/05/23}{补充国家图书馆封面的学位授予单位和日期。} |
| 7410 |
% 国家图书馆封面信息栏。 |
| 7411 |
% \begin{macrocode} |
| 7412 |
\cs_new_protected:Npn \@@_cover_info_nl: |
| 7413 |
{ |
| 7414 |
\tl_set:Ne \l_@@_tmpa_tl |
| 7415 |
{ |
| 7416 |
\clist_use:Nn \g_@@_info_supv_clist { ~ } |
| 7417 |
\clist_use:Nn \g_@@_info_supvii_clist { ~ } |
| 7418 |
\@@_hskip: \g_@@_info_supvcont_tl |
| 7419 |
} |
| 7420 |
\skip_set:Nn \l_@@_tmp_skip { .5 em plus 1 fill } |
| 7421 |
\@@_print_labeled_title:NNn \l_@@_tmpa_tl \l_@@_tmp_skip |
| 7422 |
{ \l_@@_name_supvinfo_tl } |
| 7423 |
% \end{macrocode} |
| 7424 |
% 临时替换显示的名称字样。 |
| 7425 |
% \begin{macrocode} |
| 7426 |
\group_begin: |
| 7427 |
\tl_set_eq:NN \l_@@_name_major_tl \l_@@_name_majorb_tl |
| 7428 |
\@@_uline_bientry:Nn \l_@@_tmpa_dim { degree } |
| 7429 |
\@@_uline_bientry:Nn \l_@@_tmpa_dim { major } |
| 7430 |
\tex_par:D |
| 7431 |
\group_end: |
| 7432 |
\@@_uline_bientry:Nn \l_@@_tmpa_dim { submitdate } |
| 7433 |
\@@_uline_bientry:Nn \l_@@_tmpa_dim { defenddate } |
| 7434 |
\tex_par:D |
| 7435 |
\@@_uline_entry:Nn \l_@@_tmpa_dim { confer } |
| 7436 |
} |
| 7437 |
% \end{macrocode} |
| 7438 |
% \end{macro} |
| 7439 |
% |
| 7440 |
% \begin{macro}{\@@_cover_bottom_nl:} |
| 7441 |
% \changes{v0.19}{2022/05/20}{将国家图书馆封面的评审委员会人数分离为单独参数。} |
| 7442 |
% \changes{v0.20}{2022/05/27}{自动识别评审委员会人数。} |
| 7443 |
% 国家图书馆封面底部信息。 |
| 7444 |
% \begin{macrocode} |
| 7445 |
\cs_new_protected:Npn \@@_cover_bottom_nl: |
| 7446 |
{ |
| 7447 |
\dim_set:Nn \l_@@_tmpa_dim { 9 em } |
| 7448 |
\@@_name:n { chairman } \@@_name:n { colon } \@@_hskip: |
| 7449 |
\@@_box_ulined_info:Nn \l_@@_tmpa_dim { chairman } \tex_par:D |
| 7450 |
\@@_name:n { reviewer } \@@_name:n { colon } \@@_hskip: |
| 7451 |
\@@_box_multiline:NNn \g_@@_info_reviewer_clist \l_@@_tmpa_dim { 4 } |
| 7452 |
} |
| 7453 |
% \end{macrocode} |
| 7454 |
% \end{macro} |
| 7455 |
% |
| 7456 |
% \subparagraph{原创性声明} |
| 7457 |
% |
| 7458 |
% \begin{macro}{g/decl/orig/title} |
| 7459 |
% 研究生原创性声明标题实例。 |
| 7460 |
% \begin{macrocode} |
| 7461 |
\@@_declare_element:nn { g / decl / orig / title } |
| 7462 |
{ |
| 7463 |
content = \l_@@_name_origdecl_tl, |
| 7464 |
format = \l_@@_fmt_chapter_tl, |
| 7465 |
bottom-skip = \l_@@_chapterafter_dim |
| 7466 |
} |
| 7467 |
% \end{macrocode} |
| 7468 |
% \end{macro} |
| 7469 |
% |
| 7470 |
% \begin{macro}{g/decl/orig/text} |
| 7471 |
% 研究生原创性声明文本实例。 |
| 7472 |
% \begin{macrocode} |
| 7473 |
\@@_declare_element:nn { g / decl / orig / text } |
| 7474 |
{ |
| 7475 |
content = \l_@@_text_origdecl_tl, |
| 7476 |
align = n, |
| 7477 |
bottom-skip = 0 pt plus 1 fil |
| 7478 |
} |
| 7479 |
% \end{macrocode} |
| 7480 |
% \end{macro} |
| 7481 |
% |
| 7482 |
% \begin{macro}{g/decl/orig/sign} |
| 7483 |
% 研究生原创性声明签名区实例。 |
| 7484 |
% \begin{macrocode} |
| 7485 |
\@@_declare_element:nn { g / decl / orig / sign } |
| 7486 |
{ |
| 7487 |
content = \@@_decl_sign:, |
| 7488 |
align = r |
| 7489 |
} |
| 7490 |
% \end{macrocode} |
| 7491 |
% \end{macro} |
| 7492 |
% |
| 7493 |
% \subparagraph{出版授权书} |
| 7494 |
% |
| 7495 |
% \begin{macro}{g/decl/auth/title} |
| 7496 |
% 研究生出版授权书标题实例。 |
| 7497 |
% \begin{macrocode} |
| 7498 |
\@@_declare_element:nn { g / decl / auth / title } |
| 7499 |
{ |
| 7500 |
content = \l_@@_name_authdecl_tl, |
| 7501 |
format = \l_@@_fmt_chapter_tl, |
| 7502 |
bottom-skip = \l_@@_chapterafter_dim |
| 7503 |
} |
| 7504 |
% \end{macrocode} |
| 7505 |
% \end{macro} |
| 7506 |
% |
| 7507 |
% \begin{macro}{g/decl/auth/text} |
| 7508 |
% 研究生出版授权书文本实例。 |
| 7509 |
% \begin{macrocode} |
| 7510 |
\@@_declare_element:nn { g / decl / auth / text } |
| 7511 |
{ |
| 7512 |
content = \l_@@_text_authdecl_tl, |
| 7513 |
align = n, |
| 7514 |
bottom-skip = 2 cm |
| 7515 |
} |
| 7516 |
% \end{macrocode} |
| 7517 |
% \end{macro} |
| 7518 |
% |
| 7519 |
% \begin{macro}{g/decl/auth/sign} |
| 7520 |
% 研究生出版授权书签名区实例。 |
| 7521 |
% \begin{macrocode} |
| 7522 |
\@@_declare_element:nn { g / decl / auth / sign } |
| 7523 |
{ |
| 7524 |
content = \@@_g_decl_auth_sign:, |
| 7525 |
align = r, |
| 7526 |
bottom-skip = 0 pt plus 1 fill |
| 7527 |
} |
| 7528 |
% \end{macrocode} |
| 7529 |
% \end{macro} |
| 7530 |
% |
| 7531 |
% \begin{macro}{g/decl/auth/info} |
| 7532 |
% 研究生出版授权书信息表格实例。 |
| 7533 |
% \begin{macrocode} |
| 7534 |
\@@_declare_element:nn { g / decl / auth / info } |
| 7535 |
{ |
| 7536 |
content = \@@_g_decl_auth_info:, |
| 7537 |
format = \zihao { 5 } , |
| 7538 |
align = l, |
| 7539 |
bottom-skip = 2 cm |
| 7540 |
} |
| 7541 |
% \end{macrocode} |
| 7542 |
% \end{macro} |
| 7543 |
% |
| 7544 |
% \begin{macro}{g/decl/auth/date} |
| 7545 |
% 研究生出版授权书保密信息实例。 |
| 7546 |
% \begin{macrocode} |
| 7547 |
\@@_declare_element:nn { g / decl / auth / date } |
| 7548 |
{ |
| 7549 |
content = \@@_g_decl_auth_secretlv:, |
| 7550 |
format = \zihao { 5 } , |
| 7551 |
align = l |
| 7552 |
} |
| 7553 |
% \end{macrocode} |
| 7554 |
% \end{macro} |
| 7555 |
% |
| 7556 |
% \begin{macro}{\@@_degree_checkbox:nn} |
| 7557 |
% \changes{v1.3}{2023/06/04}{修复研究生出版授权书的打勾机制。} |
| 7558 |
% 信息栏的学位复选框。打勾符号对应 |U+2713|。 |
| 7559 |
% \begin{macrocode} |
| 7560 |
\cs_new_protected:Npn \@@_degree_checkbox:nn #1#2 |
| 7561 |
{ |
| 7562 |
\bool_lazy_and:nnTF |
| 7563 |
{ #1 \g_@@_opt_academic_bool } |
| 7564 |
{ \int_compare_p:n { \g_@@_info_type_int = #2 } } |
| 7565 |
{ |
| 7566 |
\makebox [ 0 pt ] [l] { \ensuremath { \mdwhtsquare } } |
| 7567 |
\hspace { 0.1 em } \ensuremath { \checkmark } |
| 7568 |
} |
| 7569 |
{ \ensuremath { \mdwhtsquare } } |
| 7570 |
} |
| 7571 |
% \end{macrocode} |
| 7572 |
% \end{macro} |
| 7573 |
% |
| 7574 |
% \begin{macro}{\@@_g_decl_auth_info:} |
| 7575 |
% 信息栏内容。 |
| 7576 |
% \begin{macrocode} |
| 7577 |
\cs_new_protected:Npn \@@_g_decl_auth_info: |
| 7578 |
{ |
| 7579 |
\begin{tblr} |
| 7580 |
{ |
| 7581 |
hlines, vlines, hspan=minimal, |
| 7582 |
cells = { font = \normalsize }, |
| 7583 |
colspec = { c X[c] c X[c] c X[c] }, |
| 7584 |
cell{1}{2} = {c=5}{m}, cell{3}{2} = {c=5}{m}, |
| 7585 |
cell{4}{2} = {c=5}{m}, cell{5}{2} = {c=5}{m} |
| 7586 |
} |
| 7587 |
\l_@@_name_titlec_tl & \g_@@_info_title_tl \\ |
| 7588 |
\l_@@_name_ida_tl & \g_@@_info_id_tl & |
| 7589 |
\l_@@_name_depta_tl & \g_@@_info_dept_tl & |
| 7590 |
\l_@@_name_year_tl & |
| 7591 |
\tl_range:Nnn \g_@@_info_submitdate_tl {1} {4} \\ |
| 7592 |
\l_@@_name_degreea_tl & |
| 7593 |
{ |
| 7594 |
\@@_degree_checkbox:nn { } { 2 } 学术学位硕士 \qquad |
| 7595 |
\@@_degree_checkbox:nn { ! } { 2 } 专业学位硕士 \\ |
| 7596 |
\@@_degree_checkbox:nn { } { 3 } 学术学位博士 \qquad |
| 7597 |
\@@_degree_checkbox:nn { ! } { 3 } 专业学位博士 |
| 7598 |
} \\ |
| 7599 |
\l_@@_name_email_tl & \g_@@_info_email_tl \\ |
| 7600 |
\l_@@_name_supvb_tl & |
| 7601 |
\clist_item:Nn \g_@@_info_supv_clist { 1 } |
| 7602 |
\bool_if:NT \g_@@_opt_supvii_bool |
| 7603 |
{ \@@_quad: \clist_item:Nn \g_@@_info_supvii_clist { 1 } } \\ |
| 7604 |
\end{tblr} |
| 7605 |
} |
| 7606 |
% \end{macrocode} |
| 7607 |
% \end{macro} |
| 7608 |
% |
| 7609 |
% \begin{macro}{\@@_g_decl_auth_sign:} |
| 7610 |
% 签名区内容。 |
| 7611 |
% \begin{macrocode} |
| 7612 |
\cs_new_protected:Npn \@@_g_decl_auth_sign: |
| 7613 |
{ \l_@@_name_authsign_tl \tex_par:D \l_@@_name_blankdatea_tl } |
| 7614 |
% \end{macrocode} |
| 7615 |
% \end{macro} |
| 7616 |
% |
| 7617 |
% \begin{macro}{\@@_g_decl_auth_secretlv:} |
| 7618 |
% 保密信息内容。 |
| 7619 |
% \begin{macrocode} |
| 7620 |
\cs_new_protected:Npn \@@_g_decl_auth_secretlv: |
| 7621 |
{ |
| 7622 |
\l_@@_name_secretstatus_tl \tex_par:D |
| 7623 |
\ensuremath { \mdwhtsquare } \l_@@_name_secretfree_tl \tex_par:D |
| 7624 |
\ensuremath { \mdwhtsquare } \l_@@_name_secretdate_tl |
| 7625 |
} |
| 7626 |
%</def-g> |
| 7627 |
% \end{macrocode} |
| 7628 |
% \end{macro} |
| 7629 |
% |
| 7630 |
% \paragraph{博士后} |
| 7631 |
% |
| 7632 |
% \begin{macro}{p/cover/name-img} |
| 7633 |
% 博士后封面校名图片实例。 |
| 7634 |
% \begin{macrocode} |
| 7635 |
%<*def-p> |
| 7636 |
\@@_declare_element:nn { p / cover / name-img } |
| 7637 |
{ |
| 7638 |
content = \@@_name:N \l_@@_namewd_dim, |
| 7639 |
bottom-skip = 40 pt |
| 7640 |
} |
| 7641 |
% \end{macrocode} |
| 7642 |
% \end{macro} |
| 7643 |
% |
| 7644 |
% \begin{macro}{p/cover/report} |
| 7645 |
% 博士后封面报告字样实例。 |
| 7646 |
% \begin{macrocode} |
| 7647 |
\@@_declare_element:nn { p / cover / report } |
| 7648 |
{ |
| 7649 |
content = \l_@@_name_report_tl, |
| 7650 |
format = \zihao { 0 } \sffamily, |
| 7651 |
bottom-skip = 40 pt plus 1.5 fil |
| 7652 |
} |
| 7653 |
% \end{macrocode} |
| 7654 |
% \end{macro} |
| 7655 |
% |
| 7656 |
% \begin{macro}{p/cover/title} |
| 7657 |
% 博士后封面报告标题实例。 |
| 7658 |
% \begin{macrocode} |
| 7659 |
\@@_declare_element:nn { p / cover / title } |
| 7660 |
{ |
| 7661 |
content = |
| 7662 |
\l_@@_name_title_tl |
| 7663 |
\l_@@_name_colon_tl |
| 7664 |
\g_@@_info_title_tl, |
| 7665 |
format = \zihao { 4 }, |
| 7666 |
bottom-skip = 80 pt |
| 7667 |
} |
| 7668 |
% \end{macrocode} |
| 7669 |
% \end{macro} |
| 7670 |
% |
| 7671 |
% \begin{macro}{p/cover/info} |
| 7672 |
% 博士后封面信息栏实例。 |
| 7673 |
% \begin{macrocode} |
| 7674 |
\@@_declare_element:nn { p / cover / info } |
| 7675 |
{ |
| 7676 |
content = \@@_p_cover_info:, |
| 7677 |
format = \zihao { -4 }, |
| 7678 |
bottom-skip = 0 pt |
| 7679 |
} |
| 7680 |
% \end{macrocode} |
| 7681 |
% \end{macro} |
| 7682 |
% |
| 7683 |
% \begin{macro}{\@@_p_cover_info:,\@@_p_cover_info:NN} |
| 7684 |
% 博士后封面信息栏。 |
| 7685 |
% \begin{arguments} |
| 7686 |
% \item 名称盒子宽度,|dim| 型变量 |
| 7687 |
% \item 标签格式 |
| 7688 |
% \end{arguments} |
| 7689 |
% \begin{macrocode} |
| 7690 |
\cs_new:Npn \@@_p_cover_info: |
| 7691 |
{ \@@_p_cover_info:NN \l_@@_clabelwd_dim \l_@@_fmt_coverlabel_tl } |
| 7692 |
\cs_new_protected:Npn \@@_p_cover_info:NN #1#2 |
| 7693 |
{ |
| 7694 |
\clist_set:Nn \l_@@_tmp_clist |
| 7695 |
{ author, supvfull, dept, id, major, submitdate } |
| 7696 |
% \end{macrocode} |
| 7697 |
% 设置信息栏右侧宽度。读取各字段,并将最宽者的宽度赋给 |
| 7698 |
% \cs{l_@@_tmpb_dim}。 |
| 7699 |
% \begin{macrocode} |
| 7700 |
\@@_get_max_width:NN \l_@@_tmpb_dim \l_@@_tmp_clist |
| 7701 |
% \end{macrocode} |
| 7702 |
% 用循环输出各字段。 |
| 7703 |
% \begin{macrocode} |
| 7704 |
\clist_map_inline:Nn \l_@@_tmp_clist |
| 7705 |
{ |
| 7706 |
\@@_box_spread_name:NNn #1 #2 {##1} |
| 7707 |
\l_@@_name_colon_tl |
| 7708 |
\@@_box_center:Nn \l_@@_tmpb_dim { \@@_info:n {##1} } |
| 7709 |
\tex_par:D |
| 7710 |
} |
| 7711 |
} |
| 7712 |
% \end{macrocode} |
| 7713 |
% \end{macro} |
| 7714 |
% |
| 7715 |
% \subparagraph{原创性声明和出版授权书} |
| 7716 |
% |
| 7717 |
% \begin{macro}{p/decl/orig/title} |
| 7718 |
% 原创性声明标题实例。^^A 这个实例与研究生的完全一样 |
| 7719 |
% \begin{macrocode} |
| 7720 |
\@@_declare_element:nn { p / decl / orig / title } |
| 7721 |
{ |
| 7722 |
content = \l_@@_name_origdecl_tl, |
| 7723 |
format = \l_@@_fmt_chapter_tl, |
| 7724 |
bottom-skip = \l_@@_chapterafter_dim |
| 7725 |
} |
| 7726 |
% \end{macrocode} |
| 7727 |
% \end{macro} |
| 7728 |
% |
| 7729 |
% \begin{macro}{p/decl/orig/text} |
| 7730 |
% 原创性声明文本实例。 |
| 7731 |
% \begin{macrocode} |
| 7732 |
\@@_declare_element:nn { p / decl / orig / text } |
| 7733 |
{ |
| 7734 |
content = \l_@@_text_origdecl_tl, |
| 7735 |
align = n, |
| 7736 |
bottom-skip = 2 cm |
| 7737 |
} |
| 7738 |
% \end{macrocode} |
| 7739 |
% \end{macro} |
| 7740 |
% |
| 7741 |
% \begin{macro}{p/decl/orig/sign} |
| 7742 |
% 原创性声明签名区实例。 |
| 7743 |
% \begin{macrocode} |
| 7744 |
\@@_declare_element:nn { p / decl / orig / sign } |
| 7745 |
{ |
| 7746 |
content = \@@_p_decl_sign:nn { origsign } { date }, |
| 7747 |
bottom-skip = 0 pt plus 1 fill |
| 7748 |
} |
| 7749 |
% \end{macrocode} |
| 7750 |
% \end{macro} |
| 7751 |
% |
| 7752 |
% \begin{macro}{p/decl/auth/title} |
| 7753 |
% 出版授权书标题实例。^^A 这个实例与研究生的完全一样 |
| 7754 |
% \begin{macrocode} |
| 7755 |
\@@_declare_element:nn { p / decl / auth / title } |
| 7756 |
{ |
| 7757 |
content = \l_@@_name_authdecl_tl, |
| 7758 |
format = \l_@@_fmt_chapter_tl, |
| 7759 |
bottom-skip = \l_@@_chapterafter_dim |
| 7760 |
} |
| 7761 |
% \end{macrocode} |
| 7762 |
% \end{macro} |
| 7763 |
% |
| 7764 |
% \begin{macro}{p/decl/auth/text} |
| 7765 |
% 出版授权书文本实例。 |
| 7766 |
% \begin{macrocode} |
| 7767 |
\@@_declare_element:nn { p / decl / auth / text } |
| 7768 |
{ |
| 7769 |
content = \l_@@_text_authdecl_tl, |
| 7770 |
align = n, |
| 7771 |
bottom-skip = 2 cm |
| 7772 |
} |
| 7773 |
% \end{macrocode} |
| 7774 |
% \end{macro} |
| 7775 |
% |
| 7776 |
% \begin{macro}{p/decl/auth/sign} |
| 7777 |
% 出版授权书签名区实例。 |
| 7778 |
% \begin{macrocode} |
| 7779 |
\@@_declare_element:nn { p / decl / auth / sign } |
| 7780 |
{ |
| 7781 |
content = |
| 7782 |
\@@_p_decl_sign:nn { authsign } { date } |
| 7783 |
\@@_p_decl_sign:nn { authsigna } { date }, |
| 7784 |
bottom-skip = 0 pt plus 1 fill |
| 7785 |
} |
| 7786 |
% \end{macrocode} |
| 7787 |
% \end{macro} |
| 7788 |
% |
| 7789 |
% \begin{macro}{\@@_p_decl_sign:nn} |
| 7790 |
% 原创性声明签名区内容。 |
| 7791 |
% \begin{macrocode} |
| 7792 |
\cs_new_protected:Npn \@@_p_decl_sign:nn #1#2 |
| 7793 |
{ |
| 7794 |
\@@_name:n {#1} \l_@@_name_colon_tl \tex_hfill:D |
| 7795 |
\@@_name:n {#2} \l_@@_name_colon_tl |
| 7796 |
\skip_horizontal:n { 160 pt } \@@_null: \@@_vskip: |
| 7797 |
} |
| 7798 |
%</def-p> |
| 7799 |
% \end{macrocode} |
| 7800 |
% \end{macro} |
| 7801 |
% |
| 7802 |
% |
| 7803 |
% \subsubsection{绘制封面} |
| 7804 |
% \changes{v0.13}{2021/12/10}{使用 \LaTeX3 语法重构本科生封面。} |
| 7805 |
% \changes{v0.13}{2021/12/11}{使用 \LaTeX3 语法重构研究生封面。} |
| 7806 |
% \changes{v0.13}{2021/12/12}{使用 \LaTeX3 语法重构国家图书馆封面。} |
| 7807 |
% \changes{v0.15}{2022/01/25}{将封面页面封装为对象。} |
| 7808 |
% |
| 7809 |
% 定义封面页面的具体配置参数。 |
| 7810 |
% |
| 7811 |
% \begin{macro}{cover-u} |
| 7812 |
% 默认本科生封面实例。 |
| 7813 |
% \begin{macrocode} |
| 7814 |
%<*def-u> |
| 7815 |
\@@_declare_page:nn { cover-u } |
| 7816 |
{ |
| 7817 |
element = { emblem-img, name-img, title, info }, |
| 7818 |
prefix = u / cover /, |
| 7819 |
top-skip = -.3 cm, |
| 7820 |
bottom-skip = 0 pt plus 1 fill |
| 7821 |
} |
| 7822 |
% \end{macrocode} |
| 7823 |
% \end{macro} |
| 7824 |
% |
| 7825 |
% \begin{macro}{origdecl-u} |
| 7826 |
% 默认诚信承诺书实例。 |
| 7827 |
% \begin{macrocode} |
| 7828 |
\@@_declare_page:nn { origdecl-u } |
| 7829 |
{ |
| 7830 |
element = { emblem, title, text, sign }, |
| 7831 |
prefix = u / decl / orig /, |
| 7832 |
bottom-skip = 0 pt plus 1 fil |
| 7833 |
} |
| 7834 |
%</def-u> |
| 7835 |
% \end{macrocode} |
| 7836 |
% \end{macro} |
| 7837 |
% |
| 7838 |
% \begin{macro}{cover-g-front} |
| 7839 |
% 默认研究生普通封面正面实例。 |
| 7840 |
% \begin{macrocode} |
| 7841 |
%<*def-g> |
| 7842 |
\@@_declare_page:nn { cover-g-front } |
| 7843 |
{ |
| 7844 |
element = { top, emblem-img, name-img, type, info, date }, |
| 7845 |
prefix = g / cover-front /, |
| 7846 |
format = \kaishu, |
| 7847 |
top-skip = 0 pt |
| 7848 |
} |
| 7849 |
% \end{macrocode} |
| 7850 |
% \end{macro} |
| 7851 |
% |
| 7852 |
% \begin{macro}{cover-g-back} |
| 7853 |
% 默认研究生普通封面背面实例。 |
| 7854 |
% \begin{macrocode} |
| 7855 |
\@@_declare_page:nn { cover-g-back } |
| 7856 |
{ |
| 7857 |
element = { info, sign }, |
| 7858 |
prefix = g / cover-back /, |
| 7859 |
format = \zihao { 3 } \kaishu, |
| 7860 |
top-skip = 173 pt |
| 7861 |
} |
| 7862 |
% \end{macrocode} |
| 7863 |
% \end{macro} |
| 7864 |
% |
| 7865 |
% \begin{macro}{cover-g-en} |
| 7866 |
% 默认研究生英文封面实例。 |
| 7867 |
% \begin{macrocode} |
| 7868 |
\@@_declare_page:nn { cover-g-en } |
| 7869 |
{ |
| 7870 |
element = { title, top, middle, emblem-img, bottom }, |
| 7871 |
prefix = g / cover-en /, |
| 7872 |
format = \linespread { 1.3 }, |
| 7873 |
top-skip = 0 pt plus 1.2 fil |
| 7874 |
} |
| 7875 |
% \end{macrocode} |
| 7876 |
% \end{macro} |
| 7877 |
% |
| 7878 |
% \begin{macro}{cover-nl} |
| 7879 |
% 默认国家图书馆封面实例。 |
| 7880 |
% \begin{macrocode} |
| 7881 |
\@@_declare_page:nn { cover-nl } |
| 7882 |
{ |
| 7883 |
element = { top, name, title, middle, bottom, date }, |
| 7884 |
prefix = cover-nl /, |
| 7885 |
format = \kaishu |
| 7886 |
} |
| 7887 |
% \end{macrocode} |
| 7888 |
% \end{macro} |
| 7889 |
% |
| 7890 |
% \begin{macro}{origdecl-g} |
| 7891 |
% 默认原创性声明实例。 |
| 7892 |
% \begin{macrocode} |
| 7893 |
\@@_declare_page:nn { origdecl-g } |
| 7894 |
{ |
| 7895 |
element = { title, text, sign }, |
| 7896 |
prefix = g / decl / orig /, |
| 7897 |
top-skip = \l_@@_chapterbefore_dim, |
| 7898 |
bottom-skip = 0 pt plus 1 fil, |
| 7899 |
bm-text = \l_@@_name_origdecl_tl, |
| 7900 |
bm-name = origdecl |
| 7901 |
} |
| 7902 |
% \end{macrocode} |
| 7903 |
% \end{macro} |
| 7904 |
% |
| 7905 |
% \begin{macro}{authdecl-g} |
| 7906 |
% 默认出版授权书实例。 |
| 7907 |
% \begin{macrocode} |
| 7908 |
\@@_declare_page:nn { authdecl-g } |
| 7909 |
{ |
| 7910 |
element = { title, text, sign, info, date }, |
| 7911 |
prefix = g / decl / auth /, |
| 7912 |
top-skip = \l_@@_chapterbefore_dim, |
| 7913 |
bottom-skip = 0.5 cm plus 1.5 fill, |
| 7914 |
bm-text = \l_@@_name_authdecl_tl, |
| 7915 |
bm-name = authdecl, |
| 7916 |
bookmark = toc |
| 7917 |
} |
| 7918 |
%</def-g> |
| 7919 |
% \end{macrocode} |
| 7920 |
% \end{macro} |
| 7921 |
% |
| 7922 |
% \begin{macro}{cover-p} |
| 7923 |
% 默认博士后封面实例。 |
| 7924 |
% \begin{macrocode} |
| 7925 |
%<*def-p> |
| 7926 |
\@@_declare_page:nn { cover-p } |
| 7927 |
{ |
| 7928 |
element = { name-img, report, title, info }, |
| 7929 |
prefix = p / cover /, |
| 7930 |
format = \bfseries, |
| 7931 |
top-skip = 100 pt |
| 7932 |
} |
| 7933 |
% \end{macrocode} |
| 7934 |
% \end{macro} |
| 7935 |
% |
| 7936 |
% \begin{macro}{authdecl-p} |
| 7937 |
% 默认出版授权书实例。 |
| 7938 |
% \begin{macrocode} |
| 7939 |
\@@_declare_page:nn { authdecl-p } |
| 7940 |
{ |
| 7941 |
element = |
| 7942 |
{ |
| 7943 |
orig/title, orig/text, orig/sign, |
| 7944 |
auth/title, auth/text, auth/sign |
| 7945 |
}, |
| 7946 |
prefix = p / decl /, |
| 7947 |
bm-text = 声明页, |
| 7948 |
bm-name = decl, |
| 7949 |
top-skip = \l_@@_chapterbefore_dim, |
| 7950 |
bottom-skip = 0 pt |
| 7951 |
} |
| 7952 |
%</def-p> |
| 7953 |
% \end{macrocode} |
| 7954 |
% \end{macro} |
| 7955 |
% |
| 7956 |
% |
| 7957 |
% \subsubsection{钩子处理} |
| 7958 |
% |
| 7959 |
% \changes{v1.3}{2023/05/24}{修复非研究生类型时调用 \opt{nl-cover} 选项的错误。} |
| 7960 |
% 在草稿模式下,封面绘制将被禁用,有助于提升编译速度。 |
| 7961 |
% 通过不同选项进行分流,使得钩子内部最终不包含逻辑判断, |
| 7962 |
% 仅需调用恰当的实例生成封面。 |
| 7963 |
% \begin{macrocode} |
| 7964 |
%<*(def-u|def-g|def-p)> |
| 7965 |
\bool_if:NF \g_@@_opt_draft_bool |
| 7966 |
{ |
| 7967 |
%<def-u|def-p> \hook_gput_code:nnn { . / cover / body } { main } |
| 7968 |
%<def-u> { \UseInstance { nju } { cover-u } } |
| 7969 |
%<def-p> { \UseInstance { nju } { cover-p } } |
| 7970 |
% \end{macrocode} |
| 7971 |
% \changes{v1.5.0}{2026/05/13}{研究生类型默认不生成英文封面。} |
| 7972 |
% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面, |
| 7973 |
% 反之生成普通封面。 |
| 7974 |
% \begin{macrocode} |
| 7975 |
%<*def-g> |
| 7976 |
\bool_if:NTF \g_@@_opt_nlcover_bool |
| 7977 |
{ |
| 7978 |
\hook_gput_code:nnn { . / cover / body } { main } |
| 7979 |
{ \UseInstance { nju } { cover-nl } } |
| 7980 |
} |
| 7981 |
{ |
| 7982 |
\hook_gput_code:nnn { . / cover / body } { main } |
| 7983 |
{ |
| 7984 |
\UseInstance { nju } { cover-g-front } |
| 7985 |
\UseInstance { nju } { cover-g-back } |
| 7986 |
} |
| 7987 |
} |
| 7988 |
%</def-g> |
| 7989 |
% \end{macrocode} |
| 7990 |
% |
| 7991 |
% \changes{v0.13}{2021/12/15}{加入本科生的诚信承诺书。} |
| 7992 |
% \changes{v0.17}{2022/04/04}{加入研究生的学位论文出版授权书。} |
| 7993 |
% \changes{v0.19}{2022/05/22}{跟进新版本科生诚信承诺书样式。} |
| 7994 |
% 根据选项设置声明页钩子。 |
| 7995 |
% 位于封面后的承诺书页面, |
| 7996 |
% 用于生成本科生的诚信承诺书或研究生的学位论文原创性声明。 |
| 7997 |
% \begin{macrocode} |
| 7998 |
\bool_if:NT \g_@@_opt_decl_bool |
| 7999 |
{ |
| 8000 |
\hook_gput_code:nnn { . / cover / body } { decl-i } |
| 8001 |
{ |
| 8002 |
\cleardoublepage |
| 8003 |
%<def-u> \UseInstance { nju } { origdecl-u } |
| 8004 |
%<def-g> \UseInstance { nju } { origdecl-g } |
| 8005 |
%<def-p> \UseInstance { nju } { authdecl-p } |
| 8006 |
\cleardoublepage |
| 8007 |
} |
| 8008 |
% \end{macrocode} |
| 8009 |
% 位于封底的承诺书页面。生成研究生的学位论文出版授权书。 |
| 8010 |
% \begin{macrocode} |
| 8011 |
%<*def-g> |
| 8012 |
\hook_gput_code:nnn { . / cover / back } { decl-ii } |
| 8013 |
{ |
| 8014 |
\cleardoublepage |
| 8015 |
\UseInstance { nju } { authdecl-g } |
| 8016 |
\cleardoublepage |
| 8017 |
} |
| 8018 |
%</def-g> |
| 8019 |
} |
| 8020 |
} |
| 8021 |
%</(def-u|def-g|def-p)> |
| 8022 |
% \end{macrocode} |
| 8023 |
% |
| 8024 |
% \changes{v0.16}{2022/02/22}{不再默认载入 \pkg{njuvisual}。} |
| 8025 |
% \changes{v1.5.0}{2026/05/11}{默认提供 \file{pdf} 校名校徽图片,不再使用 \pkg{njuvisual}。} |
| 8026 |
% 封面前处理。封面本身不占用页码编号。 |
| 8027 |
% 新版本将绘制校名校徽的命令预处理移到了封面前钩子里。 |
| 8028 |
% \begin{macrocode} |
| 8029 |
%<*class> |
| 8030 |
\hook_gput_code:nnn { . / cover / begin } { presetup } |
| 8031 |
{ |
| 8032 |
\pagenumbering { gobble } |
| 8033 |
\prop_map_inline:Nn \l_@@_logo_file_prop |
| 8034 |
{ \tl_set:cn { l_@@_logo_file_ #1 _tl } {#2} } |
| 8035 |
} |
| 8036 |
% \end{macrocode} |
| 8037 |
% |
| 8038 |
% 封面后处理。在标题页后清空标题中的换行符, |
| 8039 |
% 使用大写罗马字母页码,恢复正常字体设置。 |
| 8040 |
% \begin{macrocode} |
| 8041 |
\hook_gput_code:nnn { . / cover / end } { postsetup } |
| 8042 |
{ |
| 8043 |
\tl_gremove_all:Nn \g_@@_info_title_tl { \\ } |
| 8044 |
\tl_gremove_all:Nn \g_@@_info_title_en_tl { \\ } |
| 8045 |
\cleardoublepage |
| 8046 |
\exp_args:NV \pagestyle \l_@@_fmt_pagestyle_tl |
| 8047 |
\pagenumbering { Roman } |
| 8048 |
} |
| 8049 |
% \end{macrocode} |
| 8050 |
% |
| 8051 |
% 保证文档在 \opt{twoside} 模式下总是在偶数页结束。 |
| 8052 |
% \begin{macrocode} |
| 8053 |
\hook_gput_next_code:nn { env / document / end } { \cleardoublepage } |
| 8054 |
% \end{macrocode} |
| 8055 |
% |
| 8056 |
% |
| 8057 |
% \subsubsection{校名校徽} |
| 8058 |
% |
| 8059 |
% \begin{variable}{\l_@@_logo_file_prop} |
| 8060 |
% 存储校名校徽图标文件名。 |
| 8061 |
% \begin{macrocode} |
| 8062 |
\prop_new:N \l_@@_logo_file_prop |
| 8063 |
% \end{macrocode} |
| 8064 |
% \end{variable} |
| 8065 |
% |
| 8066 |
% \begin{macro}{\@@_logo_file_update:nn} |
| 8067 |
% 更新图标文件名的辅助函数。 |
| 8068 |
% \begin{macrocode} |
| 8069 |
\cs_new:Npn \@@_logo_file_update:nn |
| 8070 |
{ \prop_put:Nnn \l_@@_logo_file_prop } |
| 8071 |
% \end{macrocode} |
| 8072 |
% \end{macro} |
| 8073 |
% |
| 8074 |
% \begin{variable}{\l_@@_logo_file_emblem_tl,\l_@@_logo_file_name_tl} |
| 8075 |
% 存储图标文件名。 |
| 8076 |
% \begin{macrocode} |
| 8077 |
\clist_map_inline:nn { emblem, name } |
| 8078 |
{ |
| 8079 |
\tl_new:c { l_@@_logo_file_ #1 _tl } |
| 8080 |
% \end{macrocode} |
| 8081 |
% \end{variable} |
| 8082 |
% |
| 8083 |
% \begin{macro}{ |
| 8084 |
% \@@_logo_emblem:Nn, |
| 8085 |
% \@@_logo_emblem:cv, |
| 8086 |
% \@@_logo_name:Nn, |
| 8087 |
% \@@_logo_name:cv} |
| 8088 |
% 包装载入图片命令。 |
| 8089 |
% \begin{macrocode} |
| 8090 |
\cs_new_protected:cpn { @@_logo_ #1 :Nn } ##1 |
| 8091 |
{ \includegraphics [ width = ##1 ] } |
| 8092 |
\cs_generate_variant:cn { @@_logo_ #1 :Nn } { cv } |
| 8093 |
% \end{macrocode} |
| 8094 |
% \end{macro} |
| 8095 |
% |
| 8096 |
% \begin{macro}{ |
| 8097 |
% \@@_logo_emblem:n, |
| 8098 |
% \@@_logo_emblem:, |
| 8099 |
% \@@_logo_name:n, |
| 8100 |
% \@@_logo_name:} |
| 8101 |
% 进一步包装载入图片命令。 |
| 8102 |
% \begin{macrocode} |
| 8103 |
\cs_new_protected:cpn { @@_logo_ #1 :n } ##1 |
| 8104 |
{ |
| 8105 |
\use:c { @@_logo_ #1 :cv } { l_@@_ #1 wd ##1 _dim } |
| 8106 |
{ l_@@_logo_file_ #1 _tl } |
| 8107 |
} |
| 8108 |
\cs_new:cpn { @@_logo_ #1 : } { \use:c { @@_logo_ #1 :n } { } } |
| 8109 |
} |
| 8110 |
% \end{macrocode} |
| 8111 |
% \end{macro} |
| 8112 |
% |
| 8113 |
% |
| 8114 |
% \subsubsection{用户接口} |
| 8115 |
% |
| 8116 |
% 我们顺势处理校名校徽相关的接口。 |
| 8117 |
% |
| 8118 |
% \changes{v1.0}{2022/08/01}{外置图片接口更名为 \opt{image} 类。} |
| 8119 |
% \begin{macro}{image/nju-emblem} |
| 8120 |
% \changes{v0.14}{2021/12/23}{提供选择外置校徽图片的接口。} |
| 8121 |
% \changes{v1.5.0}{2026/05/12}{校徽图片提供颜色选项。} |
| 8122 |
% \begin{macro}{image/nju-name} |
| 8123 |
% \changes{v0.14}{2021/12/23}{提供选择外置校名图片的接口。} |
| 8124 |
% \changes{v1.5.0}{2026/05/12}{校徽图片提供颜色选项。} |
| 8125 |
% \begin{macrocode} |
| 8126 |
\clist_map_inline:nn { emblem, name } |
| 8127 |
{ |
| 8128 |
\keys_define:nn { nju / image } |
| 8129 |
{ |
| 8130 |
nju-#1 .choice:, |
| 8131 |
nju-#1 / black .code:n = |
| 8132 |
{ \@@_logo_file_update:nn {#1} { nju- #1 -black .pdf } }, |
| 8133 |
nju-#1 / purple .code:n = |
| 8134 |
{ \@@_logo_file_update:nn {#1} { nju- #1 -purple.pdf } }, |
| 8135 |
nju-#1 / unknown .code:n = |
| 8136 |
{ \@@_logo_file_update:nn {#1} {##1} } |
| 8137 |
} |
| 8138 |
} |
| 8139 |
% \end{macrocode} |
| 8140 |
% \end{macro} |
| 8141 |
% \end{macro} |
| 8142 |
% |
| 8143 |
% \begin{macro}{image/nju-logo-color} |
| 8144 |
% \changes{v1.5.0}{2026/05/12}{提供统一设置校名校徽颜色的接口。} |
| 8145 |
% 研究生和本科生诚信承诺书用紫色校名校徽。 |
| 8146 |
% 其他都是黑色。 |
| 8147 |
% \begin{macrocode} |
| 8148 |
\keys_define:nn { nju / image } |
| 8149 |
{ |
| 8150 |
nju-logo-color .choices:nn = { black, purple } |
| 8151 |
{ \keys_set:nn { nju / image } { nju-emblem = #1, nju-name = #1 }}, |
| 8152 |
nju-logo-color .initial:V = \c_@@_logo_color_tl, |
| 8153 |
} |
| 8154 |
% \end{macrocode} |
| 8155 |
% \end{macro} |
| 8156 |
% |
| 8157 |
% \begin{macro}{\maketitle} |
| 8158 |
% \changes{v0.12}{2021/12/01}{仅会生成国家图书馆封面或者普通封面之一。} |
| 8159 |
% \changes{v0.13}{2021/12/12}{重新绘制封面。} |
| 8160 |
% \changes{v0.13}{2021/12/15}{草稿模式下不绘制封面。} |
| 8161 |
% \changes{v1.4}{2024/03/12}{在生成封面时删除标题换行符。} |
| 8162 |
% \changes{v1.5.0}{2026/04/24}{使用 \LaTeX 钩子机制处理封面绘制。} |
| 8163 |
% 重定义 \tn{maketitle} 以生成封面。 |
| 8164 |
% 在钩子机制下,这里只需要作为钩子的锚点, |
| 8165 |
% 具体需要执行的代码已被预先分发到钩子内。 |
| 8166 |
% 为避免未调用 \tn{maketitle} 时生成封底, |
| 8167 |
% 封底钩子只在标题页生成时挂接到文档结束钩子, |
| 8168 |
% 并作为一次性钩子执行,避免重复调用 \tn{maketitle} 时重复生成。 |
| 8169 |
% \cs{hook_use:n} 不能用 |.| 来简化钩子路径。 |
| 8170 |
% \begin{macrocode} |
| 8171 |
\RenewDocumentCommand \maketitle { } |
| 8172 |
{ |
| 8173 |
\hook_use:n { njuthesis / cover / begin } |
| 8174 |
\hook_use:n { njuthesis / cover / body } |
| 8175 |
\hook_use:n { njuthesis / cover / end } |
| 8176 |
\hook_gput_next_code:nn { enddocument } |
| 8177 |
{ \hook_use_once:n { njuthesis / cover / back } } |
| 8178 |
} |
| 8179 |
%</class> |
| 8180 |
% \end{macrocode} |
| 8181 |
% \end{macro} |
| 8182 |
% |
| 8183 |
% |
| 8184 |
% \subsection{摘要页} |
| 8185 |
% |
| 8186 |
% \subsubsection{绘制部件} |
| 8187 |
% \changes{v0.16}{2022/03/02}{将摘要部件分离到 \file{.def} 文件。} |
| 8188 |
% \changes{v0.16}{2022/03/02}{使用 \pkg{xtemplate} 重构摘要。} |
| 8189 |
% |
| 8190 |
% \begin{macro}{abstract/title} |
| 8191 |
% 中文摘要标题实例。 |
| 8192 |
% \begin{macrocode} |
| 8193 |
%<*(def-u|def-g|def-p)> |
| 8194 |
\@@_declare_element:nn { abstract / title } |
| 8195 |
{ |
| 8196 |
%<def-u|def-g> content = \@@_abs_headline:N \l_@@_name_abstracttitle_tl, |
| 8197 |
%<def-p> content = \g_@@_info_title_tl, |
| 8198 |
%<def-u|def-g> format = \bfseries \kaishu \zihao { -2 }, |
| 8199 |
%<def-p> format = \bfseries, |
| 8200 |
bottom-skip = 20 pt |
| 8201 |
} |
| 8202 |
% \end{macrocode} |
| 8203 |
% \end{macro} |
| 8204 |
% |
| 8205 |
% \begin{macro}{abstract/en/title} |
| 8206 |
% 英文摘要标题实例。 |
| 8207 |
% \begin{macrocode} |
| 8208 |
\@@_declare_element:nn { abstract / en / title } |
| 8209 |
{ |
| 8210 |
%<def-u|def-g> content = \@@_abs_headline:N \l_@@_name_abstracttitle_en_tl, |
| 8211 |
%<def-p> content = \g_@@_info_title_en_tl, |
| 8212 |
%<def-u|def-g> format = \bfseries \kaishu \zihao { -2 }, |
| 8213 |
%<def-p> format = \bfseries, |
| 8214 |
bottom-skip = 20 pt |
| 8215 |
} |
| 8216 |
%</(def-u|def-g|def-p)> |
| 8217 |
% \end{macrocode} |
| 8218 |
% \end{macro} |
| 8219 |
% |
| 8220 |
% \begin{macro}{abstract/info} |
| 8221 |
% 中文摘要信息栏实例。 |
| 8222 |
% \begin{macrocode} |
| 8223 |
%<*(def-u|def-g)> |
| 8224 |
\@@_declare_element:nn { abstract / info } |
| 8225 |
{ |
| 8226 |
%<def-u> content = \@@_abs_info_u:, |
| 8227 |
%<def-g> content = \@@_abs_info_g:, |
| 8228 |
%<def-u> format = \zihao { -4 } \kaishu, |
| 8229 |
%<def-g> format = \zihao { 4 } \kaishu, |
| 8230 |
%<def-u> bottom-skip = 15 pt, |
| 8231 |
%<def-g> bottom-skip = 30 pt, |
| 8232 |
align = l |
| 8233 |
} |
| 8234 |
% \end{macrocode} |
| 8235 |
% \end{macro} |
| 8236 |
% |
| 8237 |
% \begin{macro}{abstract/en/info} |
| 8238 |
% 英文摘要信息栏实例。 |
| 8239 |
% \begin{macrocode} |
| 8240 |
\@@_declare_element:nn { abstract / en / info } |
| 8241 |
{ |
| 8242 |
%<def-u> content = \@@_abs_info_en_u:, |
| 8243 |
%<def-g> content = \@@_abs_info_en_g:, |
| 8244 |
%<def-u> format = \zihao { -4 }, |
| 8245 |
%<def-g> format = \zihao { 4 }, |
| 8246 |
%<def-u> bottom-skip = 15 pt, |
| 8247 |
%<def-g> bottom-skip = 30 pt, |
| 8248 |
align = l |
| 8249 |
} |
| 8250 |
%</(def-u|def-g)> |
| 8251 |
% \end{macrocode} |
| 8252 |
% \end{macro} |
| 8253 |
% |
| 8254 |
% \begin{macro}{abstract/mark} |
| 8255 |
% 英文摘要标签实例。 |
| 8256 |
% \begin{macrocode} |
| 8257 |
%<*(def-g|def-p)> |
| 8258 |
\@@_declare_element:nn { abstract / mark } |
| 8259 |
{ |
| 8260 |
content = \l_@@_name_abstractb_tl, |
| 8261 |
format = \sffamily \zihao { -3 }, |
| 8262 |
bottom-skip = 15 pt |
| 8263 |
} |
| 8264 |
% \end{macrocode} |
| 8265 |
% \end{macro} |
| 8266 |
% |
| 8267 |
% \begin{macro}{abstract/en/mark} |
| 8268 |
% 英文摘要标签实例。 |
| 8269 |
% \begin{macrocode} |
| 8270 |
\@@_declare_element:nn { abstract / en / mark } |
| 8271 |
{ |
| 8272 |
content = \l_@@_name_abstractb_en_tl, |
| 8273 |
format = \sffamily \zihao { -3 }, |
| 8274 |
bottom-skip = 15 pt |
| 8275 |
} |
| 8276 |
%</(def-g|def-p)> |
| 8277 |
% \end{macrocode} |
| 8278 |
% \end{macro} |
| 8279 |
% |
| 8280 |
% \paragraph{本科生} |
| 8281 |
% \changes{v0.13}{2021/12/12}{使用 \LaTeX3 语法重构本科生摘要。} |
| 8282 |
% \changes{v1.0}{2022/06/16}{统一本科生摘要页的标签格式。} |
| 8283 |
% |
| 8284 |
% \begin{macro}{\@@_abs_info_u:,\@@_abs_info_en_u:} |
| 8285 |
% 封装好的本科生摘要信息栏。 |
| 8286 |
% \begin{macrocode} |
| 8287 |
%<*def-u> |
| 8288 |
\cs_new_protected:Npn \@@_abs_info_u: |
| 8289 |
{ \@@_abs_info_u:nn { } { \l_@@_name_colon_tl } } |
| 8290 |
\cs_new_protected:Npn \@@_abs_info_en_u: |
| 8291 |
{ \@@_abs_info_u:nn { _en } { \l_@@_name_colon_en_tl } } |
| 8292 |
% \end{macrocode} |
| 8293 |
% \end{macro} |
| 8294 |
% |
| 8295 |
% \begin{macro}{\@@_abs_info_u:nn} |
| 8296 |
% 绘制本科生摘要信息栏。 |
| 8297 |
% \begin{arguments} |
| 8298 |
% \item 语言,空置为中文,|_en| 为英文 |
| 8299 |
% \item 分隔符 |
| 8300 |
% \end{arguments} |
| 8301 |
% 本科生摘要页面不含下划线,因而不用确定文本宽度,绘制命令较为简单。 |
| 8302 |
% \begin{macrocode} |
| 8303 |
\cs_new_protected:Npn \@@_abs_info_u:nn #1#2 |
| 8304 |
{ |
| 8305 |
% \end{macrocode} |
| 8306 |
% 由于作者姓名使用的字样发生了变动,这里进行替换以便嵌入循环。 |
| 8307 |
% \begin{macrocode} |
| 8308 |
\tl_set_eq:NN \l_@@_name_author_tl \l_@@_name_authora_tl |
| 8309 |
% \end{macrocode} |
| 8310 |
% 使用循环输出院系、专业、作者、导师信息。 |
| 8311 |
% \begin{macrocode} |
| 8312 |
\clist_map_inline:nn { title, dept, major, author, supvfull } |
| 8313 |
{ |
| 8314 |
\@@_name:nn { abslabel #1 } { ##1 #1 } #2 |
| 8315 |
\@@_info:n { ##1 #1 } \\ |
| 8316 |
} |
| 8317 |
\@@_name:nn { abslabel #1 } { abstract #1 } #2 |
| 8318 |
} |
| 8319 |
%</def-u> |
| 8320 |
% \end{macrocode} |
| 8321 |
% \end{macro} |
| 8322 |
% |
| 8323 |
% \paragraph{研究生} |
| 8324 |
% \changes{v0.13}{2021/12/12}{使用 \LaTeX3 语法重构研究生摘要。} |
| 8325 |
% |
| 8326 |
% \begin{macro}{\@@_abs_info_g:,\@@_abs_info_en_g:} |
| 8327 |
% 封装好的研究生摘要信息栏。 |
| 8328 |
% \begin{macrocode} |
| 8329 |
%<*def-g> |
| 8330 |
\cs_new_protected:Npn \@@_abs_info_g: |
| 8331 |
{ \@@_abs_info_g:N \l_@@_name_colon_tl } |
| 8332 |
\cs_new_protected:Npn \@@_abs_info_en_g: |
| 8333 |
{ \@@_abs_info_en_g:N \l_@@_name_colon_en_tl } |
| 8334 |
% \end{macrocode} |
| 8335 |
% \end{macro} |
| 8336 |
% |
| 8337 |
% |
| 8338 |
% \begin{macro}{\@@_abs_info_g:N} |
| 8339 |
% 绘制研究生中文摘要信息栏。 |
| 8340 |
% \begin{arguments} |
| 8341 |
% \item 分隔符 |
| 8342 |
% \end{arguments} |
| 8343 |
% 研究生中文摘要页包括下划线以及若干特殊的对齐方式,实现方式较为繁琐。 |
| 8344 |
% 使用 \cs{@@_full_uline:NV} 确定内容宽度后,调用 \cs{@@_uline:n} 或 |
| 8345 |
% \cs{@@_ulined_center_box:nn} 命令以绘制横穿页面的下划线。前两行为标题。 |
| 8346 |
% \begin{macrocode} |
| 8347 |
\cs_new_protected:Npn \@@_abs_info_g:N #1 |
| 8348 |
{ |
| 8349 |
\@@_print_labeled_title:NNe \g_@@_info_title_tl \g_@@_abs_title_left_skip |
| 8350 |
{ \l_@@_name_titlea_tl #1 } |
| 8351 |
% \end{macrocode} |
| 8352 |
% 专业、年级、姓名。 |
| 8353 |
% \begin{macrocode} |
| 8354 |
\@@_get_width_print:Ne \l_@@_tmp_skip |
| 8355 |
{ |
| 8356 |
\dim_set:Nn \l_@@_tmpa_dim { 11 em } |
| 8357 |
\dim_set:Nn \l_@@_tmpb_dim { 4 em } |
| 8358 |
\@@_box_ulined_info:Nn \l_@@_tmpa_dim { major } |
| 8359 |
\l_@@_name_majora_tl |
| 8360 |
\@@_box_ulined_info:Nn \l_@@_tmpb_dim { grade } |
| 8361 |
\l_@@_name_grade_tl \l_@@_name_authora_tl #1 |
| 8362 |
} |
| 8363 |
\@@_box_ulined_info:Nn \l_@@_tmp_skip { author } \tex_par:D |
| 8364 |
% \end{macrocode} |
| 8365 |
% 导师姓名、职称。 |
| 8366 |
% \begin{macrocode} |
| 8367 |
\@@_get_width_print:Ne \l_@@_tmpa_dim { \l_@@_name_supva_tl #1 } |
| 8368 |
\@@_box_ulined_info:Nn \l_@@_tmpa_dim { supvfull } |
| 8369 |
} |
| 8370 |
% \end{macrocode} |
| 8371 |
% \end{macro} |
| 8372 |
% |
| 8373 |
% \begin{macro}{\@@_abs_info_en_g:N} |
| 8374 |
% \changes{v1.0}{2022/07/01}{移除研究生英文摘要的下划线。} |
| 8375 |
% \changes{v1.1}{2022/12/12}{恢复研究生英文摘要的下划线。} |
| 8376 |
% 绘制研究生英文摘要信息栏。因为到底要不要下划线这回事说不清楚, |
| 8377 |
% 所以不做选择了全都整上。 |
| 8378 |
% \begin{arguments} |
| 8379 |
% \item 分隔符 |
| 8380 |
% \end{arguments} |
| 8381 |
% \begin{macrocode} |
| 8382 |
\cs_new_protected:Npn \@@_abs_info_en_g:N #1 |
| 8383 |
{ |
| 8384 |
\bool_if:NTF \g_@@_abs_underline_bool |
| 8385 |
{ |
| 8386 |
\@@_print_labeled_title:NNe \g_@@_info_title_en_tl |
| 8387 |
\g_@@_abs_title_left_skip { \l_@@_name_title_en_tl #1 } |
| 8388 |
\clist_map_inline:nn { major, author, supvfull } |
| 8389 |
{ |
| 8390 |
\tex_par:D |
| 8391 |
\@@_get_width_print:Ne \l_@@_tmpa_dim |
| 8392 |
{ \@@_name:n { ##1 _en } #1 } |
| 8393 |
\@@_box_ulined_info:Nn \l_@@_tmpa_dim { ##1 _en } |
| 8394 |
} |
| 8395 |
} |
| 8396 |
{ |
| 8397 |
\clist_map_inline:nn { title, major, author, supvfull } |
| 8398 |
{ \@@_name:n { ##1 _en } #1 \@@_info:n { ##1 _en } \\ } |
| 8399 |
} |
| 8400 |
} |
| 8401 |
%</def-g> |
| 8402 |
% \end{macrocode} |
| 8403 |
% \end{macro} |
| 8404 |
% |
| 8405 |
% \paragraph{关键词列表} |
| 8406 |
% |
| 8407 |
% \begin{macro}{\@@_print_keywords:nn} |
| 8408 |
% 生成中英文关键词列表。 |
| 8409 |
% \begin{arguments} |
| 8410 |
% \item 语言,空置为中文,|_en| 为英文 |
| 8411 |
% \item 关键词分隔符 |
| 8412 |
% \end{arguments} |
| 8413 |
% \begin{macrocode} |
| 8414 |
%<*class> |
| 8415 |
\cs_new_protected:Npn \@@_print_keywords:nn |
| 8416 |
{ \@@_print_keywords:NNnn \l_@@_tmpa_tl \l_@@_tmpa_dim } |
| 8417 |
% \end{macrocode} |
| 8418 |
% \end{macro} |
| 8419 |
% |
| 8420 |
% \begin{macro}{\@@_print_keywords:NNnn} |
| 8421 |
% \begin{arguments} |
| 8422 |
% \item |tl| 临时变量 |
| 8423 |
% \item |dim| 临时变量 |
| 8424 |
% \end{arguments} |
| 8425 |
% \begin{macrocode} |
| 8426 |
\cs_new:Npn \@@_print_keywords:NNnn #1#2#3#4 |
| 8427 |
{ |
| 8428 |
\tl_set:Nv #1 { l_@@_name_keywords #3 _tl } |
| 8429 |
\exp_args:NNv \tl_put_left:Nn #1 { l_@@_fmt_abslabel #3 _tl } |
| 8430 |
\exp_args:NNv \tl_put_right:Nn #1 { l_@@_name_colon #3 _tl } |
| 8431 |
\@@_get_width:NV #2 #1 |
| 8432 |
% \end{macrocode} |
| 8433 |
% 关键词列表的悬挂缩进样式由 \tn{list} 环境产生。 |
| 8434 |
% \begin{macrocode} |
| 8435 |
\list {#1} |
| 8436 |
{ |
| 8437 |
\labelwidth #2 |
| 8438 |
\labelsep \c_zero_dim |
| 8439 |
\leftmargin \c_zero_dim |
| 8440 |
\rightmargin \c_zero_dim |
| 8441 |
\advance \leftmargin #2 |
| 8442 |
% \end{macrocode} |
| 8443 |
% 使用粗体作为标签样式。 |
| 8444 |
% \begin{macrocode} |
| 8445 |
\__nju_cs_clear:N \makelabel |
| 8446 |
} |
| 8447 |
\item \clist_use:cn { g_@@_info_keywords #3 _clist } {#4} |
| 8448 |
\endlist |
| 8449 |
} |
| 8450 |
%</class> |
| 8451 |
% \end{macrocode} |
| 8452 |
% \end{macro} |
| 8453 |
% |
| 8454 |
% |
| 8455 |
% \subsubsection{绘制摘要} |
| 8456 |
% \changes{v0.16}{2022/03/26}{补上研究生摘要页面的小标题。} |
| 8457 |
% |
| 8458 |
% \begin{macro}{\@@_make_abstract:,\@@_make_abstract_en:} |
| 8459 |
% 绘制摘要页面。 |
| 8460 |
% \begin{macrocode} |
| 8461 |
%<*(def-u|def-g|def-p)> |
| 8462 |
\cs_new_protected:Npn \@@_make_abstract: |
| 8463 |
{ |
| 8464 |
\UseInstance { nju } { abstract / title } |
| 8465 |
%<def-u|def-g> \UseInstance { nju } { abstract / info } |
| 8466 |
%<def-g|def-p> \UseInstance { nju } { abstract / mark } |
| 8467 |
} |
| 8468 |
\cs_new_protected:Npn \@@_make_abstract_en: |
| 8469 |
{ |
| 8470 |
\UseInstance { nju } { abstract / en / title } |
| 8471 |
%<def-u|def-g> \UseInstance { nju } { abstract / en / info } |
| 8472 |
%<def-g|def-p> \UseInstance { nju } { abstract / en / mark } |
| 8473 |
} |
| 8474 |
%</(def-u|def-g|def-p)> |
| 8475 |
% \end{macrocode} |
| 8476 |
% \end{macro} |
| 8477 |
% |
| 8478 |
% |
| 8479 |
% \subsubsection{用户接口} |
| 8480 |
% |
| 8481 |
% \begin{macro}{\g_@@_abs_title_left_skip} |
| 8482 |
% 研究生摘要标题左边距。 |
| 8483 |
% \begin{macrocode} |
| 8484 |
%<*class> |
| 8485 |
\skip_new:N \g_@@_abs_title_left_skip |
| 8486 |
% \end{macrocode} |
| 8487 |
% \end{macro} |
| 8488 |
% |
| 8489 |
% \changes{v1.0}{2022/08/01}{整合摘要设置项。} |
| 8490 |
% \begin{macrocode} |
| 8491 |
\keys_define:nn { nju / abstract } |
| 8492 |
{ |
| 8493 |
% \end{macrocode} |
| 8494 |
% \begin{macro}{abstract/toc-entry} |
| 8495 |
% \changes{v0.15}{2022/02/04}{可选择摘要是否出现在目录中。} |
| 8496 |
% 是否将摘要添加到目录。 |
| 8497 |
% \begin{macrocode} |
| 8498 |
toc-entry .bool_gset:N = \g_@@_abs_showentry_bool, |
| 8499 |
toc-entry .initial:n = true, |
| 8500 |
% \end{macrocode} |
| 8501 |
% \end{macro} |
| 8502 |
% |
| 8503 |
% \begin{macro}{abstract/underline} |
| 8504 |
% \changes{v1.2}{2023/04/23}{新增研究生英文摘要页下划线选项。} |
| 8505 |
% 是否为研究生英文摘要条目内容添加下划线。 |
| 8506 |
% \begin{macrocode} |
| 8507 |
underline .bool_gset:N = \g_@@_abs_underline_bool, |
| 8508 |
underline .initial:n = true, |
| 8509 |
% \end{macrocode} |
| 8510 |
% \end{macro} |
| 8511 |
% |
| 8512 |
% \begin{macro}{abstract/title-style} |
| 8513 |
% \changes{v0.16}{2022/03/26}{可选择研究生摘要标题样式。} |
| 8514 |
% \changes{v1.4}{2025/04/02}{减少研究生中文摘要的论文标题两侧间距。} |
| 8515 |
% 选择摘要样式,默认为 \opt{strict}。 |
| 8516 |
% \begin{macrocode} |
| 8517 |
title-style .choice:, |
| 8518 |
title-style / strict .code:n = |
| 8519 |
{ |
| 8520 |
\bool_gset_true:N \g_@@_abs_title_strict_bool |
| 8521 |
\skip_gset:Nn \g_@@_abs_title_left_skip { 0 pt } |
| 8522 |
}, |
| 8523 |
title-style / centered .code:n = |
| 8524 |
{ |
| 8525 |
\bool_gset_true:N \g_@@_abs_title_strict_bool |
| 8526 |
\skip_gset:Nn \g_@@_abs_title_left_skip { 0 pt plus 1 fill } |
| 8527 |
}, |
| 8528 |
title-style / natural .code:n = |
| 8529 |
{ |
| 8530 |
\bool_gset_false:N \g_@@_abs_title_strict_bool |
| 8531 |
\skip_gset:Nn \g_@@_abs_title_left_skip { 0 pt plus 1 fill } |
| 8532 |
}, |
| 8533 |
title-style .initial:n = strict |
| 8534 |
} |
| 8535 |
% \end{macrocode} |
| 8536 |
% \end{macro} |
| 8537 |
% |
| 8538 |
% \begin{environment}{abstract} |
| 8539 |
% \changes{v0.13}{2021/12/12}{重新绘制摘要。} |
| 8540 |
% \changes{v1.4}{2025/08/27}{摘要页使用 chapter 对应的页面样式。} |
| 8541 |
% 中文摘要环境。 |
| 8542 |
% \begin{macrocode} |
| 8543 |
\NewDocumentEnvironment { abstract } { +b } |
| 8544 |
{ |
| 8545 |
\cleardoublepage |
| 8546 |
% \end{macrocode} |
| 8547 |
% 这里和 \pkg{ctex} 的章样式保持一致。 |
| 8548 |
% \begin{macrocode} |
| 8549 |
\CTEX@setthispagestyle { chapter } |
| 8550 |
\@@_abs_bookmark:Vn \l_@@_name_abstracta_tl { abstract } |
| 8551 |
\tl_gremove_all:Nn \g_@@_info_title_tl { \\ } |
| 8552 |
\@@_make_abstract: |
| 8553 |
\group_begin: \kaishu \zihao { -4 } #1 |
| 8554 |
} |
| 8555 |
{ \@@_print_keywords:nn { } { ; } \group_end: } |
| 8556 |
% \end{macrocode} |
| 8557 |
% \end{environment} |
| 8558 |
% |
| 8559 |
% \begin{environment}{abstract*} |
| 8560 |
% 英文摘要环境。\pkg{xparse} 目前不支持合并带有星号的环境,因此需要单独定义。 |
| 8561 |
% \begin{macrocode} |
| 8562 |
\NewDocumentEnvironment { abstract* } { +b } |
| 8563 |
{ |
| 8564 |
\cleardoublepage |
| 8565 |
\CTEX@setthispagestyle { chapter } |
| 8566 |
\@@_abs_bookmark:Vn \l_@@_name_abstracta_en_tl { abstract-en } |
| 8567 |
% \end{macrocode} |
| 8568 |
% \changes{v1.3}{2023/08/21}{修复英文标题手动换行与摘要页的冲突。} |
| 8569 |
% 生成封面后清除标题中的换行控制符,便于在摘要中输出。 |
| 8570 |
% \begin{macrocode} |
| 8571 |
\tl_gremove_all:Nn \g_@@_info_title_en_tl { \\ } |
| 8572 |
\@@_make_abstract_en: |
| 8573 |
\group_begin: \zihao { -4 } #1 |
| 8574 |
} |
| 8575 |
{ \@@_print_keywords:nn { _en } { ;~ } \group_end: } |
| 8576 |
% \end{macrocode} |
| 8577 |
% \end{environment} |
| 8578 |
% |
| 8579 |
% |
| 8580 |
% \subsection{前言致谢} |
| 8581 |
% |
| 8582 |
% \begin{environment}{preface} |
| 8583 |
% \begin{environment}{acknowledgement} |
| 8584 |
% 单独制作的前言、致谢页。 |
| 8585 |
% \begin{macrocode} |
| 8586 |
\NewDocumentEnvironment { preface } { +b } |
| 8587 |
{ \@@_chapter:V \l_@@_name_preface_tl #1 } |
| 8588 |
{ \cleardoublepage } |
| 8589 |
\NewDocumentEnvironment { acknowledgement } { +b } |
| 8590 |
{ \@@_acknowledgement:n {#1} } |
| 8591 |
{ \cleardoublepage } |
| 8592 |
% \end{macrocode} |
| 8593 |
% \end{environment} |
| 8594 |
% \end{environment} |
| 8595 |
% |
| 8596 |
% \begin{macro}{\@@_acknowledgement:n} |
| 8597 |
% 正常模式的致谢标题。 |
| 8598 |
% \begin{macrocode} |
| 8599 |
\cs_new:Npn \@@_acknowledgement:n |
| 8600 |
{ \@@_chapter:V \l_@@_name_acknowledgement_tl \use:n } |
| 8601 |
% \end{macrocode} |
| 8602 |
% \end{macro} |
| 8603 |
% |
| 8604 |
% \begin{macro}{\@@_acknowledgement_anon:n} |
| 8605 |
% 盲审模式下仅显示致谢书签。 |
| 8606 |
% \begin{macrocode} |
| 8607 |
\cs_new:Npn \@@_acknowledgement_anon:n |
| 8608 |
{ \@@_bookmark_toc:V \l_@@_name_acknowledgementa_tl \use_none:n } |
| 8609 |
% \end{macrocode} |
| 8610 |
% \end{macro} |
| 8611 |
% |
| 8612 |
% |
| 8613 |
% \subsection{成果列表} |
| 8614 |
% |
| 8615 |
% \begin{macro}{\@@_anon_paperlist_setup:} |
| 8616 |
% 创建一个仅包含刊名和年份的文献列表格式。 |
| 8617 |
% \begin{macrocode} |
| 8618 |
\cs_new:Npn \@@_anon_paperlist_setup: |
| 8619 |
{ |
| 8620 |
\ctex_at_end_package:nn { biblatex } |
| 8621 |
{ |
| 8622 |
\DeclareBibliographyDriver { anonymous } |
| 8623 |
{ |
| 8624 |
\usebibmacro { begentry } |
| 8625 |
\usebibmacro { journal },~ |
| 8626 |
\usebibmacro { date } |
| 8627 |
\usebibmacro { finentry } |
| 8628 |
} |
| 8629 |
} |
| 8630 |
} |
| 8631 |
% \end{macrocode} |
| 8632 |
% \end{macro} |
| 8633 |
% |
| 8634 |
% \begin{macro}{\@@_paperlist_anon:nn} |
| 8635 |
% 生成盲审模式下的成果列表。 |
| 8636 |
% \begin{macrocode} |
| 8637 |
\cs_new:Npn \@@_paperlist_anon:nn #1#2 |
| 8638 |
{ |
| 8639 |
\group_begin: |
| 8640 |
\newrefsection |
| 8641 |
\nocite {#2} |
| 8642 |
\printbiblist |
| 8643 |
[ title = #1, driver = anonymous, env = bibliography, |
| 8644 |
heading = subbibliography ] { anonymous } |
| 8645 |
\endrefsection |
| 8646 |
\group_end: |
| 8647 |
} |
| 8648 |
% \end{macrocode} |
| 8649 |
% \end{macro} |
| 8650 |
|
| 8651 |
% \begin{macro}{\@@_paperlist:nn} |
| 8652 |
% \begin{macrocode} |
| 8653 |
\cs_new:Npn \@@_paperlist:nn #1#2 |
| 8654 |
{ |
| 8655 |
\group_begin: |
| 8656 |
% \end{macrocode} |
| 8657 |
% 修改姓名的显示方式,使被注解的姓名可被加粗下划线表示。 |
| 8658 |
% 由于 \pkg{biblatex} 提供的 \tn{MakeCapital} 是一个 robust 命令, |
| 8659 |
% 在绘制下划线过程中无法被完全展开,我们将其替换为 |
| 8660 |
% 可被展开的 \cs{str_uppercase:f} 以避免造成错误。 |
| 8661 |
% \begin{macrocode} |
| 8662 |
\cs_set_eq:NN \MakeCapital \str_uppercase:f |
| 8663 |
\RenewDocumentCommand \mkbibnamegiven { m } |
| 8664 |
{ \ifitemannotation { thesisauthor } |
| 8665 |
{ \bfseries \njuline {##1} } {##1} } |
| 8666 |
\RenewDocumentCommand \mkbibnamefamily { m } |
| 8667 |
{ \ifitemannotation { thesisauthor } |
| 8668 |
{ \bfseries \njuline {##1} } {##1} } |
| 8669 |
% \end{macrocode} |
| 8670 |
% 修改年份的显示方式,默认进行加粗。 |
| 8671 |
% \begin{macrocode} |
| 8672 |
\RenewDocumentCommand \mkbibdateshort { m m m } |
| 8673 |
{ \textbf { \thefield {##1} } } |
| 8674 |
% \end{macrocode} |
| 8675 |
% 相较于直接使用 \env{refsection} 环境,\tn{newrefsection} 命令可以 |
| 8676 |
% 自动结束上一个 \env{refsection},与章末参考文献表格式兼容更好。 |
| 8677 |
% 这里手动覆盖 \pkg{biblatex} 参数,显示全部作者名。 |
| 8678 |
% \begin{macrocode} |
| 8679 |
\newrefsection |
| 8680 |
\numdef \blx@maxbibnames { 99 } |
| 8681 |
\nocite {#2} |
| 8682 |
\printbibliography [ heading = subbibliography, title = #1 ] |
| 8683 |
\endrefsection |
| 8684 |
\group_end: |
| 8685 |
} |
| 8686 |
% \end{macrocode} |
| 8687 |
% \end{macro} |
| 8688 |
% |
| 8689 |
% \begin{macro}{\njupaperlist} |
| 8690 |
% \changes{v0.10}{2021/09/29}{新增了成果列表页面。} |
| 8691 |
% \changes{v0.14}{2021/12/20}{成果列表中可突出指定作者姓名及年份。} |
| 8692 |
% \changes{v1.2}{2023/04/07}{修复成果列表与章末参考文献表的冲突。} |
| 8693 |
% \changes{v1.4}{2024/03/21}{修复成果列表中文姓名加粗的问题。} |
| 8694 |
% \changes{v1.4}{2024/04/15}{盲审模式下成果列表只显示期刊和年份。} |
| 8695 |
% \changes{v1.5.0}{2026/04/23}{成果列列表默认显示全部作者名。} |
| 8696 |
% 成果列表。 |
| 8697 |
% \begin{macrocode} |
| 8698 |
\NewDocumentCommand \njupaperlist |
| 8699 |
{ O { \l_@@_name_paperlist_tl } m } { \@@_paperlist:nn {#1} {#2} } |
| 8700 |
% \end{macrocode} |
| 8701 |
% \end{macro} |
| 8702 |
% |
| 8703 |
% |
| 8704 |
% \subsection{盲审模式} |
| 8705 |
% \changes{v1.4}{2024/04/19}{合并盲审模式设置。} |
| 8706 |
% |
| 8707 |
% \begin{macro}{anonymous-mode/no-nju} |
| 8708 |
% \changes{v1.4}{2024/04/19}{盲审模式下可选择是否隐藏学校信息。} |
| 8709 |
% \begin{macrocode} |
| 8710 |
\keys_define:nn { nju / anonymous-mode } |
| 8711 |
{ |
| 8712 |
no-nju .bool_gset:N = \g_@@_opt_nonju_bool, |
| 8713 |
no-nju .initial:n = false |
| 8714 |
} |
| 8715 |
% \end{macrocode} |
| 8716 |
% \end{macro} |
| 8717 |
% |
| 8718 |
% \changes{v1.4}{2024/04/15}{盲审模式下姓名使用占位符。} |
| 8719 |
% 盲审模式下作者和导师姓名用 $\times\times\times$ 代替。 |
| 8720 |
% \begin{macrocode} |
| 8721 |
\bool_if:NT \g_@@_opt_anon_bool |
| 8722 |
{ |
| 8723 |
\keys_set:nn { nju / info } |
| 8724 |
{ |
| 8725 |
author = \@@_name:n { anonymous a }, |
| 8726 |
author* = \@@_name:n { anonymous a }, |
| 8727 |
supervisor = |
| 8728 |
{ \@@_name:n { anonymous a }, \@@_name:n { anonymous b } }, |
| 8729 |
supervisor* = |
| 8730 |
{ \@@_name:n { anonymous c } \@@_quad: \@@_name:n { anonymous a } }, |
| 8731 |
supervisor-ii = , |
| 8732 |
supervisor-ii* = |
| 8733 |
} |
| 8734 |
% \end{macrocode} |
| 8735 |
% 替换为匿名版本的命令。 |
| 8736 |
% \begin{macrocode} |
| 8737 |
\@@_anon_paperlist_setup: |
| 8738 |
\cs_gset_eq:NN \@@_paperlist:nn \@@_paperlist_anon:nn |
| 8739 |
\cs_gset_eq:NN \@@_acknowledgement:n \@@_acknowledgement_anon:n |
| 8740 |
\tl_clear:N \l_@@_name_pdfauthor_tl |
| 8741 |
} |
| 8742 |
% \end{macrocode} |
| 8743 |
% |
| 8744 |
% 开启 \opt{no-nju} 模式时,清除校名、校徽以及学校代码。 |
| 8745 |
% \begin{macrocode} |
| 8746 |
\ctex_at_end_preamble:n |
| 8747 |
{ |
| 8748 |
\bool_lazy_and:nnT |
| 8749 |
{ \g_@@_opt_anon_bool } { \g_@@_opt_nonju_bool } |
| 8750 |
{ |
| 8751 |
\tl_clear:N \l_@@_name_nju_tl |
| 8752 |
\tl_clear:N \l_@@_name_nju_en_tl |
| 8753 |
\tl_gclear:N \g_@@_info_code_tl |
| 8754 |
\cs_gset_eq:NN \@@_logo_emblem:n \use_none:n |
| 8755 |
\cs_gset_eq:NN \@@_logo_name:n \use_none:n |
| 8756 |
} |
| 8757 |
} |
| 8758 |
% \end{macrocode} |
| 8759 |
% |
| 8760 |
% |
| 8761 |
% \subsection{符号表} |
| 8762 |
% |
| 8763 |
% \begin{macro}{\@@_notation_label:n} |
| 8764 |
% 左对齐的标签格式,用于符号表。 |
| 8765 |
% \begin{macrocode} |
| 8766 |
\cs_new_protected:Npn \@@_notation_label:n #1 { #1 \tex_hfil:D } |
| 8767 |
% \end{macrocode} |
| 8768 |
% \end{macro} |
| 8769 |
% |
| 8770 |
% \begin{macro}{\@@_make_notation:nn} |
| 8771 |
% 生成符号表。由于符号表只有符号和说明两列,相比于 \env{longtable} 环境, |
| 8772 |
% \env{description} 环境的语法更为简洁直观,且说明文字可以换行,因而此处使用 |
| 8773 |
% \LaTeXe 的列表环境进行封装,定义和语法参见 \file{source2e.pdf} 中的 |
| 8774 |
% File I \quad ltlists.dtx 一章。 |
| 8775 |
% \begin{macrocode} |
| 8776 |
\cs_new_protected:Npn \@@_make_notation:nn #1#2 |
| 8777 |
{ |
| 8778 |
\dim_set:Nn \l_@@_tmpa_dim { \textwidth - #1 - #2 } |
| 8779 |
\list { } |
| 8780 |
{ |
| 8781 |
% \end{macrocode} |
| 8782 |
% \tn{list} 环境使用宽度固定的盒子制作标签,通过指定这个盒子的宽度 |
| 8783 |
% \tn{labelwidth} 即可确定左侧标签区域的宽度。 |
| 8784 |
% \begin{macrocode} |
| 8785 |
\labelwidth #2 |
| 8786 |
\labelsep \c_zero_dim |
| 8787 |
\itemsep \c_zero_dim |
| 8788 |
\parsep \c_zero_dim |
| 8789 |
% \end{macrocode} |
| 8790 |
% 右侧说明文字区域的宽度无法直接指定,而是靠计算左右边距 \tn{leftmargin} 和 |
| 8791 |
% \tn{rightmargin} 得到的。 |
| 8792 |
% \begin{macrocode} |
| 8793 |
\leftmargin .5\l_@@_tmpa_dim |
| 8794 |
\rightmargin \leftmargin |
| 8795 |
\advance \leftmargin #2 |
| 8796 |
\cs_set_eq:NN \makelabel \@@_notation_label:n |
| 8797 |
} |
| 8798 |
} |
| 8799 |
% \end{macrocode} |
| 8800 |
% \end{macro} |
| 8801 |
% |
| 8802 |
% \begin{environment}{notation} |
| 8803 |
% \changes{v0.15}{2022/01/17}{提供符号表环境。} |
| 8804 |
% 符号表环境。 |
| 8805 |
% \begin{arguments} |
| 8806 |
% \item 说明区域宽度,初始值为 10 em。说明宽度的调整更为常见,所以放在前面。 |
| 8807 |
% \item 符号区域宽度,初始值为 5 em |
| 8808 |
% \end{arguments} |
| 8809 |
% \begin{macrocode} |
| 8810 |
\NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } } |
| 8811 |
{ |
| 8812 |
\@@_chapter:V \l_@@_name_notation_tl |
| 8813 |
\@@_make_notation:nn {#1} {#2} |
| 8814 |
} |
| 8815 |
{ \endlist \cleardoublepage } |
| 8816 |
% \end{macrocode} |
| 8817 |
% \end{environment} |
| 8818 |
% |
| 8819 |
% \begin{environment}{notation*} |
| 8820 |
% 带有星号的符号表不会插入目录。 |
| 8821 |
% \begin{macrocode} |
| 8822 |
\NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } } |
| 8823 |
{ |
| 8824 |
\chapter * { \l_@@_name_notation_tl } |
| 8825 |
\@@_make_notation:nn {#1} {#2} |
| 8826 |
} |
| 8827 |
{ \endlist \cleardoublepage } |
| 8828 |
%</class> |
| 8829 |
% \end{macrocode} |
| 8830 |
% \end{environment} |
| 8831 |
% |
| 8832 |
% |
| 8833 |
% \subsection{配置常量} |
| 8834 |
% \label{subsec:constant-config} |
| 8835 |
% \changes{v0.16}{2022/02/23}{将名称常量分离到 \file{.def} 文件。} |
| 8836 |
% \changes{v0.18}{2022/04/20}{使用 |const| 类型统一定义常量。} |
| 8837 |
% |
| 8838 |
% 本节内容用于生成常量的默认定义,分为本科生和研究生模板两种。 |
| 8839 |
% |
| 8840 |
% \subsubsection{名称} |
| 8841 |
% \label{subsubsec:constant-name} |
| 8842 |
% |
| 8843 |
% \changes{v0.19}{2022/05/22}{更正研究生普通封面专业字样。} |
| 8844 |
% \changes{v0.19}{2022/05/22}{更正国家图书馆封面学位论文字样。} |
| 8845 |
% \changes{v1.0}{2022/06/19}{合并名称常量的定义位置。} |
| 8846 |
% \changes{v1.0}{2022/06/19}{更名:supv_ii -> supvii,supv_ttl -> supvtitle。} |
| 8847 |
% |
| 8848 |
% 由于同一名称在不同位置具有不同变体,本模板使用字母后缀名进行了区分, |
| 8849 |
% 并在易混淆处添加了注释。 |
| 8850 |
% |
| 8851 |
% 通用默认名称。注意空格是忽略掉的。 |
| 8852 |
% \begin{macrocode} |
| 8853 |
%<*(def-u|def-g|def-p)> |
| 8854 |
\clist_map_inline:nn |
| 8855 |
{ |
| 8856 |
{ acknowledgement } { 致 \qquad{} 谢 }, |
| 8857 |
{ acknowledgement a } { 致谢(盲审阶段,暂时隐去) }, |
| 8858 |
{ anonymous a } { \ensuremath { \times\times\times } }, |
| 8859 |
{ anonymous b } { \ensuremath { \times\times\times } }, |
| 8860 |
{ anonymous c } { \ensuremath { \times\times\times } }, |
| 8861 |
%<def-g> { auth decl } { 学位论文出版授权书 }, |
| 8862 |
%<def-p> { auth decl } { 研究报告使用授权书 }, |
| 8863 |
%<def-p> { author } { 作者 }, |
| 8864 |
% \end{macrocode} |
| 8865 |
% 用于摘要的作者名称字样 |
| 8866 |
% \begin{macrocode} |
| 8867 |
%<def-u> { author a } { 本科生姓名 }, |
| 8868 |
%<def-g> { author a } { \g_@@_info_type_tl 生姓名 }, |
| 8869 |
%<def-g> { auth sign } { 作者签名:\njuline{\hspace{6em}} }, |
| 8870 |
%<def-p> { auth sign } { 本人签名 }, |
| 8871 |
%<def-p> { auth sign a } { 导师签名 }, |
| 8872 |
%<def-g> { chairman } { 答辩委员会主席 }, |
| 8873 |
%<def-g> { clc } { 分类号 }, |
| 8874 |
%<def-g> { code } { 学校代码 }, |
| 8875 |
%<def-g> { confer } { 学位授予单位和日期 }, |
| 8876 |
{ date } { 日期 }, |
| 8877 |
%<def-g> { defend date } { 论文答辩日期 }, |
| 8878 |
%<def-g> { degree } { 申请学位级别 }, |
| 8879 |
% \end{macrocode} |
| 8880 |
% 用于出版授权书的学位名称字样 |
| 8881 |
% \begin{macrocode} |
| 8882 |
%<def-g> { degree a } { 论文级别 }, |
| 8883 |
%<def-p> { dept } { 系别 }, |
| 8884 |
% \end{macrocode} |
| 8885 |
% 用于出版授权书的院系名称字样 |
| 8886 |
% \begin{macrocode} |
| 8887 |
%<def-g> { dept a } { 所在院系 }, |
| 8888 |
%<def-g> { email } { 作者 Email }, |
| 8889 |
%<def-g> { field } { 研究方向 }, |
| 8890 |
%<def-u> { grade } { 年级 }, |
| 8891 |
%<def-g> { grade } { 级 }, |
| 8892 |
%<def-u|def-g> { id } { 学号 }, |
| 8893 |
%<def-p> { id } { 工号 }, |
| 8894 |
% \end{macrocode} |
| 8895 |
% 用于出版授权书的学号名称字样 |
| 8896 |
% \begin{macrocode} |
| 8897 |
%<def-g> { id a } { 研究生学号 }, |
| 8898 |
{ listoffigures } { 插图目录 }, |
| 8899 |
{ listoftables } { 表格目录 }, |
| 8900 |
%<def-p> { major } { 学科专业 }, |
| 8901 |
% \end{macrocode} |
| 8902 |
% 用于摘要的专业名称字样 |
| 8903 |
% \begin{macrocode} |
| 8904 |
%<def-g> { major a } { 专业 }, |
| 8905 |
% \end{macrocode} |
| 8906 |
% 用于国家图书馆封面的专业名称字样 |
| 8907 |
% \begin{macrocode} |
| 8908 |
%<def-g> { major b } { 专业名称 }, |
| 8909 |
% \end{macrocode} |
| 8910 |
% 用于专业学位封面的专业名称字样 |
| 8911 |
% \begin{macrocode} |
| 8912 |
%<def-g> { major c } { 专业学位类别(领域) }, |
| 8913 |
{ notation } { 符号表 }, |
| 8914 |
%<def-u> { orig decl } |
| 8915 |
%<def-u> { 南京大学本科毕业论文(设计) \\ 诚信承诺书 }, |
| 8916 |
%<def-g> { orig decl } { 南京大学学位论文原创性声明 }, |
| 8917 |
%<def-p> { orig decl } { 研究报告原创性声明 }, |
| 8918 |
%<def-u> { orig sign } { 作者签名 }, |
| 8919 |
%<def-g> { orig sign } { 研究生签名 }, |
| 8920 |
%<def-p> { orig sign } { 研究报告作者签名 }, |
| 8921 |
{ paper list } { 发表文章目录 }, |
| 8922 |
{ pdf author } { \g_@@_info_author_tl }, |
| 8923 |
{ pdf creator } { LaTeX~ with~ njuthesis~ class }, |
| 8924 |
{ preface } { 前 \qquad{} 言 }, |
| 8925 |
%<def-p> { report } { 博士后研究工作报告 }, |
| 8926 |
%<def-g> { reviewer } { 评阅人 }, |
| 8927 |
%<def-g> { secret lv } { 密级 }, |
| 8928 |
%<def-g> { secret status } { 论文涉密情况: }, |
| 8929 |
%<def-g> { secret free } { 不保密 }, |
| 8930 |
%<def-g> { secret date } |
| 8931 |
%<def-g> { 保密,保密期( \l_@@_name_blankdatea_tl 至 |
| 8932 |
%<def-g> \l_@@_name_blankdatea_tl ) }, |
| 8933 |
%<def-g> { sign } { (签字) }, |
| 8934 |
%<def-g> { sign a } { 研究生签名 }, |
| 8935 |
%<def-g> { sign b } { 导师签名 }, |
| 8936 |
%<def-g> { stzhongs file } { STZhongsong }, |
| 8937 |
%<def-u> { submit date } { 提交日期 }, |
| 8938 |
%<def-g> { submit date } { 论文提交日期 }, |
| 8939 |
%<def-p> { submit date } { 完成日期 }, |
| 8940 |
%<def-g> { subtitle } { (题名和副题名) }, |
| 8941 |
%<def-u> { supv } { 指导教师 }, |
| 8942 |
%<def-g> { supv } { 导师 }, |
| 8943 |
%<def-p> { supv full } { 合作导师 }, |
| 8944 |
% \end{macrocode} |
| 8945 |
% 用于摘要的导师名称字样 |
| 8946 |
% \begin{macrocode} |
| 8947 |
%<def-g> { supv a } { 指导教师(姓名、职称) }, |
| 8948 |
% \end{macrocode} |
| 8949 |
% 用于出版授权书的导师名称字样 |
| 8950 |
% \begin{macrocode} |
| 8951 |
%<def-g> { supv b } { 导师姓名 }, |
| 8952 |
%<def-g> { supv info } |
| 8953 |
%<def-g> { 指导教师姓名、职务、职称、学位、单位名称及地址 }, |
| 8954 |
{ supv ii } { 第二导师 }, |
| 8955 |
{ supv title } { 职称 }, |
| 8956 |
{ tableofcontents } { 目 \qquad{} 录 }, |
| 8957 |
%<def-p> { title } { 报告题目 }, |
| 8958 |
% \end{macrocode} |
| 8959 |
% 用于摘要的标题名称字样 |
| 8960 |
% \begin{macrocode} |
| 8961 |
%<def-g> { title a } { 毕业论文题目 }, |
| 8962 |
% \end{macrocode} |
| 8963 |
% 用于国家图书馆封面的标题名称字样 |
| 8964 |
% \begin{macrocode} |
| 8965 |
%<def-g> { title b } { 学位论文 }, |
| 8966 |
% \end{macrocode} |
| 8967 |
% 用于出版授权书的标题名称字样 |
| 8968 |
% \begin{macrocode} |
| 8969 |
%<def-g> { title c } { 论文题名 }, |
| 8970 |
%<def-g> { udc } { U D C }, |
| 8971 |
%<def-g> { year } { 学位年度 } |
| 8972 |
} |
| 8973 |
{ \@@_define_name:nn #1 } |
| 8974 |
% \end{macrocode} |
| 8975 |
% |
| 8976 |
% 定义同时使用到中英文名称的常量。 |
| 8977 |
% \begin{macrocode} |
| 8978 |
\clist_map_inline:nn |
| 8979 |
{ |
| 8980 |
{ abstract } { 摘要 } { ABSTRACT }, |
| 8981 |
% \end{macrocode} |
| 8982 |
% 用于书签的摘要名称字样 |
| 8983 |
% \begin{macrocode} |
| 8984 |
{ abstract a } { 中文摘要 } { ABSTRACT }, |
| 8985 |
% \end{macrocode} |
| 8986 |
% 用于小标题的摘要名称字样 |
| 8987 |
% \begin{macrocode} |
| 8988 |
{ abstract b } { 摘\qquad{}要 } { ABSTRACT }, |
| 8989 |
%<def-u|def-g> { abstracttitle } |
| 8990 |
%<def-u> { \l_@@_name_nju_tl 本科生毕业论文(设计、作品)中文摘要 } |
| 8991 |
%<def-u> { \l_@@_name_nju_tl 本科生毕业论文(设计、作品)英文摘要 }, |
| 8992 |
%<def-g> { \l_@@_name_nju_tl 研究生毕业论文中文摘要首页用纸 } |
| 8993 |
%<def-g> { \l_@@_name_nju_tl 研究生毕业论文英文摘要首页用纸 }, |
| 8994 |
{ appendix } { 附录 } { appendix }, |
| 8995 |
%<def-u> { author } { 学生姓名 } { UNDERGRADUATE }, |
| 8996 |
%<def-g> { author } { 作者姓名 } { POSTGRADUATE }, |
| 8997 |
{ blankdate } { \qquad{}年 \quad{}月 \quad{}日 } { }, |
| 8998 |
{ blankdate a } { \njuline{\qquad\qquad} 年 |
| 8999 |
\njuline{\qquad} 月 \njuline{\qquad} 日 } { }, |
| 9000 |
% \end{macrocode} |
| 9001 |
% \changes{v1.4}{2024/04/03}{修复 \hologo{LuaLaTeX} 下的摘要页多余换行。} |
| 9002 |
% 这里加入伸缩量,是因为 \hologo{LuaLaTeX} 下全角冒号的宽度并不能被正确识别。 |
| 9003 |
% \begin{macrocode} |
| 9004 |
{ colon } { :\hskip 0pt minus .4em } { : \c_space_tl }, |
| 9005 |
%<def-u|def-g> { dept } { 学院 } { DEPARTMENT }, |
| 9006 |
{ figure } { 图 } { figure }, |
| 9007 |
{ keywords } { 关键词 } { KEYWORDS }, |
| 9008 |
{ lang } { 中文 } { 英文 }, |
| 9009 |
%<def-u> { major } { 专业 } { SPECIALIZATION }, |
| 9010 |
%<def-g> { major } { 专业名称 } { SPECIALIZATION }, |
| 9011 |
{ nju } { 南京大学 } { Nanjing~ University }, |
| 9012 |
{ suffix } { } { _en }, |
| 9013 |
%<def-u> { supv full } { 指导教师(姓名、职称) } { MENTOR }, |
| 9014 |
%<def-g> { supv full } { 导师姓名 } { MENTOR }, |
| 9015 |
{ table } { 表 } { table }, |
| 9016 |
%<def-u> { title } { 题目 } { THESIS }, |
| 9017 |
%<def-g> { title } { 论文题目 } { THESIS }, |
| 9018 |
%<def-u> { type } { 本科毕业论文 } { u } |
| 9019 |
%<def-g> { type } { 学位论文 } { g } |
| 9020 |
} |
| 9021 |
{ \@@_define_name:nnn #1 } |
| 9022 |
% \end{macrocode} |
| 9023 |
% |
| 9024 |
% \subsubsection{文本} |
| 9025 |
% \label{subsubsec:constant-text} |
| 9026 |
% |
| 9027 |
% \begin{variable}{\l_@@_text_origdecl_tl} |
| 9028 |
% 本科生的学位论文诚信承诺书,或研究生的学位论文原创性声明。 |
| 9029 |
% \begin{macrocode} |
| 9030 |
\tl_new:N \l_@@_text_origdecl_tl |
| 9031 |
\tl_set:Nn \l_@@_text_origdecl_tl |
| 9032 |
{ |
| 9033 |
%<*def-u> |
| 9034 |
本人郑重承诺:所呈交的毕业论文(设计)(题目: \g_@@_info_title_tl ) |
| 9035 |
是在指导教师的指导下严格按照学校和学院有关规定由本人独立完成的。 |
| 9036 |
本毕业论文(设计)中引用他人观点及参考资源的内容均已标注引用, |
| 9037 |
如出现侵犯他人知识产权的行为,由本人承担相应法律责任。 |
| 9038 |
本人承诺不存在抄袭、伪造、篡改、代写、买卖毕业论文(设计)等违纪行为。 |
| 9039 |
%</def-u> |
| 9040 |
%<*def-g> |
| 9041 |
本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作所 |
| 9042 |
取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或集体 |
| 9043 |
已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构的学位 |
| 9044 |
证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已在论文的 |
| 9045 |
致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。 |
| 9046 |
%</def-g> |
| 9047 |
%<*def-p> |
| 9048 |
本人郑重声明:所呈交的研究报告,是本人独立进行研究工作所取得的成果。除 |
| 9049 |
文中已经注明引用的内容外,本报告不含任何其他个人或集体已经发表或撰写过 |
| 9050 |
的作品成果。对本报告的研究做出重要贡献的个人和集体,均已在报告中以明确 |
| 9051 |
方式标明。本人完全意识到本声明的法律结果由本人承担。 |
| 9052 |
%</def-p> |
| 9053 |
} |
| 9054 |
% \end{macrocode} |
| 9055 |
% \end{variable} |
| 9056 |
% |
| 9057 |
% \begin{variable}{\l_@@_text_authdecl_tl} |
| 9058 |
% 研究生的学位论文出版授权书。 |
| 9059 |
% \begin{macrocode} |
| 9060 |
%<*(def-g|def-p)> |
| 9061 |
\tl_new:N \l_@@_text_authdecl_tl |
| 9062 |
\tl_set:Nn \l_@@_text_authdecl_tl |
| 9063 |
{ |
| 9064 |
%<*def-g> |
| 9065 |
本人完全同意《中国优秀博硕士学位论文全文数据库出版章程》(以下简称“章 |
| 9066 |
程”),愿意将本人的学位论文提交“中国学术期刊(光盘版)电子杂志社”在《 |
| 9067 |
中国博士学位论文全文数据库》、《中国优秀硕士学位论文全文数据库》中全文 |
| 9068 |
发表。《中国博士学位论文全文数据库》、《中国优秀硕士学位论文全文数据库 |
| 9069 |
》可以以电子、网络及其他数字媒体形式公开出版,并同意编入《中国知识资源 |
| 9070 |
总库》,在《中国博硕士学位论文评价数据库》中使用和在互联网上传播,同意 |
| 9071 |
按“章程”规定享受相关权益。 |
| 9072 |
%</def-g> |
| 9073 |
%<*def-p> |
| 9074 |
本研究报告作者完全了解南京大学有关保留和使用该报告的规定,即:博士后在 |
| 9075 |
职期间的知识产权单位属南京大学。学校有权保留并向国家有关部门或机构送交 |
| 9076 |
研究报告的复印件和电子版,允许研究报告被查阅和借阅;学校可以公布研究报 |
| 9077 |
告的全部或部分内容,可以允许采用影印、缩印或其它复制手段保存、汇编研究 |
| 9078 |
报告。保密的研究报告在解密后适用于本授权书。 |
| 9079 |
%</def-p> |
| 9080 |
} |
| 9081 |
%</(def-g|def-p)> |
| 9082 |
% \end{macrocode} |
| 9083 |
% \end{variable} |
| 9084 |
% |
| 9085 |
% \begin{variable}{\l_@@_text_cover_en_tl} |
| 9086 |
% 研究生的英文封面字样。 |
| 9087 |
% \begin{macrocode} |
| 9088 |
%<*def-g> |
| 9089 |
\tl_new:N \l_@@_text_cover_en_tl |
| 9090 |
\tl_set:Nn \l_@@_text_cover_en_tl |
| 9091 |
{ |
| 9092 |
A~ dissertation~ submitted~ to \\ |
| 9093 |
the~ graduate~ school~ of~ \l_@@_name_nju_en_tl \\ |
| 9094 |
in~ partial~ fulfilment~ of~ the~ requirements~ for~ the~ degree~ of |
| 9095 |
} |
| 9096 |
%</def-g> |
| 9097 |
% \end{macrocode} |
| 9098 |
% \end{variable} |
| 9099 |
% |
| 9100 |
% \subsubsection{长度} |
| 9101 |
% \label{subsubsec:constant-length} |
| 9102 |
% |
| 9103 |
% \changes{v0.17}{2022/04/09}{将长度值分离到 \file{.def} 文件。} |
| 9104 |
% \changes{v1.0}{2022/06/11}{可以单独指定下划线的宽度和偏移。} |
| 9105 |
% 默认固定长度值。此处名称的空格仅用来提升可读性,在生成变量名时会被删去。 |
| 9106 |
% \begin{macrocode} |
| 9107 |
\clist_map_inline:nn |
| 9108 |
{ |
| 9109 |
% \end{macrocode} |
| 9110 |
% 封面信息栏标签的宽度。 |
| 9111 |
% \begin{macrocode} |
| 9112 |
%<def-u> { c label wd } { 64 bp }, |
| 9113 |
%<def-g> { c label wd } { 2.97 cm }, |
| 9114 |
%<def-u> { c label wd i } { 40 bp }, |
| 9115 |
%<def-g> { c label wd i } { 3.90 cm }, |
| 9116 |
%<def-g> { c label wd ii } { 2.62 cm }, |
| 9117 |
%<def-p> { c label wd } { 50 pt }, |
| 9118 |
% \end{macrocode} |
| 9119 |
% 封面信息栏横线的宽度。 |
| 9120 |
% \begin{macrocode} |
| 9121 |
%<def-u> { c rule wd } { 8 cm }, |
| 9122 |
%<def-g> { c rule wd } { 7 cm }, |
| 9123 |
%<def-g> { c rule wd i } { 246 pt }, |
| 9124 |
%<def-g> { c type wd } { 239 pt }, |
| 9125 |
% \end{macrocode} |
| 9126 |
% 校徽图片的宽度。 |
| 9127 |
% \begin{macrocode} |
| 9128 |
%<def-u> { emblem wd } { 68 pt }, |
| 9129 |
%<def-g> { emblem wd } { 39.8 pt }, |
| 9130 |
%<def-u> { emblem wd i } { 68 pt }, |
| 9131 |
%<def-g> { emblem wd ii } { 61 pt }, |
| 9132 |
% \end{macrocode} |
| 9133 |
% 校名图片的宽度。 |
| 9134 |
% \begin{macrocode} |
| 9135 |
%<def-u> { name wd } { 300 pt }, |
| 9136 |
%<def-g> { name wd } { 109 pt }, |
| 9137 |
%<def-p> { name wd } { 220 pt }, |
| 9138 |
% \end{macrocode} |
| 9139 |
% 下划线高度(厚度)。下划线绘制命令是通用的,因此没有作文件区分。 |
| 9140 |
% \begin{macrocode} |
| 9141 |
%<def-u> { rule ht i } { .7 pt }, |
| 9142 |
%<def-g> { rule ht i } { .4 pt }, |
| 9143 |
{ rule ht ii } { .8 pt }, |
| 9144 |
% \end{macrocode} |
| 9145 |
% 下划线深度(偏移量)。 |
| 9146 |
% \begin{macrocode} |
| 9147 |
%<def-u> { rule dp i } { -.6 ex }, |
| 9148 |
%<def-g> { rule dp i } { -.75 ex }, |
| 9149 |
{ rule dp ii } { -.9 ex }, |
| 9150 |
{ rule dp iii } { -1.2 ex }, |
| 9151 |
% \end{macrocode} |
| 9152 |
% 小幅空格。 |
| 9153 |
% \begin{macrocode} |
| 9154 |
%<def-u> { h sep } { 0 pt }, |
| 9155 |
%<def-g|def-p> { h sep } { 5 pt }, |
| 9156 |
{ v sep } { 1 ex }, |
| 9157 |
% \end{macrocode} |
| 9158 |
% 章节标题前后间距。 |
| 9159 |
% \begin{macrocode} |
| 9160 |
{ chapter before } { 10 pt }, |
| 9161 |
{ chapter after } { 60 pt }, |
| 9162 |
% \end{macrocode} |
| 9163 |
% 脚注编号宽度。 |
| 9164 |
% \begin{macrocode} |
| 9165 |
{ fn hang } { 13.5 pt } |
| 9166 |
} |
| 9167 |
{ \@@_define_dim:nn #1 } |
| 9168 |
% \end{macrocode} |
| 9169 |
% |
| 9170 |
% \subsubsection{样式} |
| 9171 |
% \label{subsubsec:constant-format} |
| 9172 |
% |
| 9173 |
% \changes{v0.17}{2022/04/09}{将样式定义分离到 \file{.def} 文件。} |
| 9174 |
% \changes{v0.20}{2022/05/28}{修复前一版本中错误的目录条目样式。} |
| 9175 |
% 默认样式。 |
| 9176 |
% \begin{macrocode} |
| 9177 |
\clist_map_inline:nn |
| 9178 |
{ |
| 9179 |
%<def-u> { pagestyle } { plain }, |
| 9180 |
%<def-g|def-p> { pagestyle } { headings }, |
| 9181 |
{ abslabel } { \bfseries }, |
| 9182 |
{ abslabel_en } { }, |
| 9183 |
%<def-u> { cover title } { }, |
| 9184 |
%<def-g> { cover title } { }, |
| 9185 |
%<def-u> { cover label } { }, |
| 9186 |
%<def-g> { cover label } { \bfseries }, |
| 9187 |
%<def-p> { cover label } { }, |
| 9188 |
% \end{macrocode} |
| 9189 |
% 各级标题样式。 |
| 9190 |
% \begin{macrocode} |
| 9191 |
{ section } { \bigger \normalfont \sffamily }, |
| 9192 |
{ chapter } { \l_@@_fmt_section_tl \centering }, |
| 9193 |
{ subsection } { \l_@@_fmt_section_tl }, |
| 9194 |
{ subsubsection } { \l_@@_fmt_section_tl }, |
| 9195 |
{ paragraph } { \l_@@_fmt_section_tl }, |
| 9196 |
{ subparagraph } { \l_@@_fmt_section_tl }, |
| 9197 |
% \end{macrocode} |
| 9198 |
% 目录中的章标题样式。 |
| 9199 |
% \begin{macrocode} |
| 9200 |
{ chapterintoc } { \l_@@_fmt_section_tl }, |
| 9201 |
% \end{macrocode} |
| 9202 |
% “目录”二字的样式。 |
| 9203 |
% \begin{macrocode} |
| 9204 |
{ toc title } { \centering \zihao { 3 } \bfseries }, |
| 9205 |
% \end{macrocode} |
| 9206 |
% \changes{v1.3}{2023/07/08}{整合表格环境字体设置。} |
| 9207 |
% \env{tabular} 环境内的字体样式。 |
| 9208 |
% \begin{macrocode} |
| 9209 |
{ tabular } { \zihao { 5 } }, |
| 9210 |
{ header } { \small \kaishu }, |
| 9211 |
{ footer } { \small \rmfamily } |
| 9212 |
} |
| 9213 |
{ \@@_define_fmt:nn #1 } |
| 9214 |
% \end{macrocode} |
| 9215 |
% |
| 9216 |
% \begin{variable}{\c_@@_logo_color_tl} |
| 9217 |
% 校名校徽图片默认颜色定义为常量。 |
| 9218 |
% \begin{macrocode} |
| 9219 |
%<def-u|def-p>\tl_const:Nn \c_@@_logo_color_tl { black } |
| 9220 |
%<def-g>\tl_const:Nn \c_@@_logo_color_tl { purple } |
| 9221 |
%</(def-u|def-g|def-p)> |
| 9222 |
% \end{macrocode} |
| 9223 |
% \end{variable} |
| 9224 |
% |
| 9225 |
% |
| 9226 |
% \subsection{手册文档类 \cls{njuthesis-doc}} |
| 9227 |
% \changes{v1.3}{2023/05/12}{将手册样式设置拆分为单独的 \cls{njuthesis-doc} 文档类。} |
| 9228 |
% |
| 9229 |
% \begin{macrocode} |
| 9230 |
%<*doc-cls> |
| 9231 |
%<@@=njudoc> |
| 9232 |
% \end{macrocode} |
| 9233 |
% |
| 9234 |
% |
| 9235 |
% \begin{macrocode} |
| 9236 |
\RequirePackage { l3keys2e } |
| 9237 |
% \end{macrocode} |
| 9238 |
% |
| 9239 |
% \subsubsection{选项} |
| 9240 |
% |
| 9241 |
% \begin{macrocode} |
| 9242 |
\keys_define:nn { njudoc } |
| 9243 |
{ |
| 9244 |
codehigh .bool_gset:N = \g_@@_codehigh_bool, |
| 9245 |
codehigh .initial:n = false |
| 9246 |
} |
| 9247 |
\ProcessKeysOptions { njudoc } |
| 9248 |
% \end{macrocode} |
| 9249 |
% |
| 9250 |
% \subsubsection{载入宏包} |
| 9251 |
% |
| 9252 |
% \begin{macrocode} |
| 9253 |
\PassOptionsToPackage { fontset = fandol } { ctex } |
| 9254 |
\PassOptionsToPackage { firstpage = true } { background } |
| 9255 |
% \end{macrocode} |
| 9256 |
% |
| 9257 |
% 载入基础文档类。 |
| 9258 |
% \begin{macrocode} |
| 9259 |
\LoadClass { ctxdoc } |
| 9260 |
% \end{macrocode} |
| 9261 |
% |
| 9262 |
% 载入宏包。 |
| 9263 |
% \begin{macrocode} |
| 9264 |
\RequirePackage |
| 9265 |
{ |
| 9266 |
background, |
| 9267 |
codehigh, |
| 9268 |
listings, |
| 9269 |
njuvisual, |
| 9270 |
tabularray, |
| 9271 |
unicode-math, |
| 9272 |
zhlineskip |
| 9273 |
} |
| 9274 |
% \end{macrocode} |
| 9275 |
% |
| 9276 |
% 下划线补丁。考虑到并不一定需要 LuaTeX 编译,也许以后会删掉。 |
| 9277 |
% \begin{macrocode} |
| 9278 |
\sys_if_engine_xetex:TF |
| 9279 |
{ |
| 9280 |
\RequirePackage { xeCJKfntef } |
| 9281 |
\renewcommand\emph[1]{\CJKunderdot[textformat=\itshape]{#1}} |
| 9282 |
} |
| 9283 |
{ |
| 9284 |
\RequirePackage { lua-ul } |
| 9285 |
\NewDocumentCommand \CJKunderline { o m } { \underLine {#1} } |
| 9286 |
\NewDocumentCommand \CJKunderdot { o m } { \underLine {#1} } |
| 9287 |
\NewDocumentCommand \CJKsout { o m } |
| 9288 |
{ \textcolor { black!50 } {#1} } |
| 9289 |
} |
| 9290 |
% \end{macrocode} |
| 9291 |
% |
| 9292 |
% 防止附录报错,见\href{https://tex.stackexchange.com/a/95893/251992}。 |
| 9293 |
% \begin{macrocode} |
| 9294 |
\setlength \IndexMin { 100pt } |
| 9295 |
% \end{macrocode} |
| 9296 |
% |
| 9297 |
% 在2023年11月,\cls{l3doc} 进行了一系列展开类型修改, |
| 9298 |
% 我们在这里仅仅检测上游是否已经更新。 |
| 9299 |
% 详见 \href{https://github.com/CTeX-org/ctex-kit/pull/678}{\texttt{CTeX-org/ctex-kit\#678}}、 |
| 9300 |
% \href{https://github.com/CTeX-org/ctex-kit/pull/700}{\texttt{CTeX-org/ctex-kit\#700}} |
| 9301 |
% 以及 \href{https://github.com/CTeX-org/ctex-kit/pull/703}{\texttt{CTeX-org/ctex-kit\#703}}。 |
| 9302 |
% \begin{macrocode} |
| 9303 |
\msg_new:nnn { njuthesis-doc } { ctxdoc-too-old } |
| 9304 |
{ |
| 9305 |
Your~ ctxdoc~ is~ too~ old. \\ |
| 9306 |
Please~ update~ to~ the~ latest~ deverlopment~ version~ |
| 9307 |
of~ the~ ctex-kit~ from~ its~ GitHub~ repository. |
| 9308 |
} |
| 9309 |
\cs_if_exist:NF \__codedoc_get_hyper_target:eN |
| 9310 |
{ \msg_fatal:nn { njuthesis-doc } { ctxdoc-too-old } } |
| 9311 |
% \end{macrocode} |
| 9312 |
% |
| 9313 |
% \begin{macrocode} |
| 9314 |
% \end{macrocode} |
| 9315 |
% |
| 9316 |
% \subsubsection{杂项} |
| 9317 |
% |
| 9318 |
% 封面背景图案。 |
| 9319 |
% \begin{macrocode} |
| 9320 |
\backgroundsetup{ |
| 9321 |
contents={\njuemblem[white!85!gray]{22cm}{!}}, |
| 9322 |
scale=1, angle=0, hshift=-4cm |
| 9323 |
} |
| 9324 |
% \end{macrocode} |
| 9325 |
% |
| 9326 |
% 文档命令。 |
| 9327 |
% \begin{macrocode} |
| 9328 |
\definecolor{tpblue}{HTML}{495A80} |
| 9329 |
\newcommand\tpbutton[1]{\textcolor{tpblue}{\bfseries #1}} |
| 9330 |
\newcommand\tikzlogo{Ti\emph{k}Z} |
| 9331 |
\newcommand\OPT[1]{\textcolor{njuyellow}{\bfseries#1}} |
| 9332 |
% \end{macrocode} |
| 9333 |
% |
| 9334 |
% \pkg{hyperref} 设置。 |
| 9335 |
% \begin{macrocode} |
| 9336 |
\hypersetup{ |
| 9337 |
pdftitle = { |
| 9338 |
The~ njuthesis~ class~ -~ |
| 9339 |
LaTeX~ thesis~ template~ for~ Nanjing~ University}, |
| 9340 |
citecolor = njublue, |
| 9341 |
linkcolor = njuviolet, |
| 9342 |
urlcolor = njumagenta} |
| 9343 |
% \end{macrocode} |
| 9344 |
% |
| 9345 |
% \pkg{tabularray} 设置。 |
| 9346 |
% \begin{macrocode} |
| 9347 |
\UseTblrLibrary{booktabs,siunitx} |
| 9348 |
\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable} |
| 9349 |
\SetTblrStyle{caption-tag}{font=\bfseries} |
| 9350 |
\SetTblrInner{row{1}={font=\bfseries}} |
| 9351 |
\SetTblrInner[talltblr]{row{1}={font=\bfseries}} |
| 9352 |
\DefTblrTemplate{caption-sep}{default}{\quad} |
| 9353 |
% \end{macrocode} |
| 9354 |
% |
| 9355 |
% \pkg{tabularray} 表格标签简写。 |
| 9356 |
% \begin{macrocode} |
| 9357 |
\def\TA{\TblrNote{a}} |
| 9358 |
\def\TB{\TblrNote{b}} |
| 9359 |
\def\TC{\TblrNote{c}} |
| 9360 |
\def\TD{\TblrNote{d}} |
| 9361 |
\def\TE{\TblrNote{e}} |
| 9362 |
% \end{macrocode} |
| 9363 |
% |
| 9364 |
% |
| 9365 |
% \TeX{} 相关的名称简写。 |
| 9366 |
% \begin{macrocode} |
| 9367 |
\def\TL{\TeX~Live} |
| 9368 |
\def\MacTeX{Mac\TeX} |
| 9369 |
\def\biber{\hologo{biber}} |
| 9370 |
\def\LaTeXe{\hologo{LaTeX2e}} |
| 9371 |
% \end{macrocode} |
| 9372 |
% |
| 9373 |
% \pkg{zhlineskip} 设置。 |
| 9374 |
% \begin{macrocode} |
| 9375 |
\SetTextEnvironmentSinglespace{1.112} |
| 9376 |
\SetMathEnvironmentSinglespace{1.112} |
| 9377 |
% \end{macrocode} |
| 9378 |
% |
| 9379 |
% \subsubsection{字体设置} |
| 9380 |
% |
| 9381 |
% \begin{macrocode} |
| 9382 |
\setmainfont { texgyretermes } |
| 9383 |
[ |
| 9384 |
Extension = .otf, |
| 9385 |
UprightFont = *-regular, |
| 9386 |
BoldFont = *-bold, |
| 9387 |
ItalicFont = *-italic, |
| 9388 |
BoldItalicFont = *-bolditalic |
| 9389 |
] |
| 9390 |
% \end{macrocode} |
| 9391 |
% |
| 9392 |
% 需要 \pkg{lexend}。 |
| 9393 |
% \begin{macrocode} |
| 9394 |
\setsansfont{LexendDeca} |
| 9395 |
% \end{macrocode} |
| 9396 |
% |
| 9397 |
% Iosevka。 |
| 9398 |
% \begin{macrocode} |
| 9399 |
\fontspec_font_if_exist:nT { Iosevka } |
| 9400 |
{ |
| 9401 |
\setmonofont { Iosevka } |
| 9402 |
[ |
| 9403 |
UprightFont = *~Light, |
| 9404 |
ItalicFont = *~Light~Italic, |
| 9405 |
BoldFont = *~Semibold |
| 9406 |
] |
| 9407 |
} |
| 9408 |
% \end{macrocode} |
| 9409 |
% |
| 9410 |
% 思源宋体。 |
| 9411 |
% \begin{macrocode} |
| 9412 |
\fontspec_font_if_exist:nT { Source~ Han~ Serif~ SC } |
| 9413 |
{ |
| 9414 |
\setCJKmainfont{ Source~ Han~ Serif~ SC } |
| 9415 |
[ |
| 9416 |
UprightFont = *~SemiBold, |
| 9417 |
ItalicFont = *~Bold, |
| 9418 |
BoldFont = *~Heavy, |
| 9419 |
Language = Chinese~Simplified |
| 9420 |
] |
| 9421 |
} |
| 9422 |
% \end{macrocode} |
| 9423 |
% |
| 9424 |
% \begin{macrocode} |
| 9425 |
\setCJKsansfont { FandolHei-Regular } |
| 9426 |
[ |
| 9427 |
Extension = .otf, |
| 9428 |
BoldFont = FandolHei-Bold |
| 9429 |
] |
| 9430 |
\setCJKmonofont { FandolFang-Regular } |
| 9431 |
[ Extension = .otf ] |
| 9432 |
% \end{macrocode} |
| 9433 |
% |
| 9434 |
% XITS。 |
| 9435 |
% \begin{macrocode} |
| 9436 |
\setmathfont{XITSMath-Regular}[ |
| 9437 |
BoldFont = XITSMath-Bold, |
| 9438 |
Extension = .otf] |
| 9439 |
% \end{macrocode} |
| 9440 |
% |
| 9441 |
% \pkg{listings} 设置。 |
| 9442 |
% \begin{macrocode} |
| 9443 |
\lstdefinestyle{style@base} |
| 9444 |
{ |
| 9445 |
basewidth = 0.5 em, |
| 9446 |
gobble = 3, |
| 9447 |
lineskip = 3 pt, |
| 9448 |
frame = l, |
| 9449 |
framerule = 1 pt, |
| 9450 |
framesep = 0 pt, |
| 9451 |
xleftmargin = 2 em, |
| 9452 |
xrightmargin = 3 em, |
| 9453 |
escapeinside = {(*}{*)}, |
| 9454 |
breaklines = true, |
| 9455 |
basicstyle = \small\ttfamily, |
| 9456 |
keywordstyle = \bfseries\color{njuviolet}, |
| 9457 |
commentstyle = \itshape\color{white!50!gray}, |
| 9458 |
stringstyle = \color{nju-chem-red}, |
| 9459 |
backgroundcolor = \color{white!95!gray} |
| 9460 |
} |
| 9461 |
\lstdefinestyle{style@shell} |
| 9462 |
{ |
| 9463 |
style = style@base, |
| 9464 |
rulecolor = \color{njumagenta}, |
| 9465 |
language = bash, |
| 9466 |
alsoletter = {-}, |
| 9467 |
emphstyle = \color{nju-cs-green} |
| 9468 |
} |
| 9469 |
\lstdefinestyle{style@latex} |
| 9470 |
{ |
| 9471 |
style = style@base, |
| 9472 |
rulecolor = \color{njublue}, |
| 9473 |
language = [LaTeX]TeX, |
| 9474 |
alsoletter = {*, -, .}, |
| 9475 |
texcsstyle = *\color{njuviolet}, |
| 9476 |
emphstyle = [1]\color{nju-ai-orange}, |
| 9477 |
emphstyle = [2]\color{nju-cs-green}, |
| 9478 |
emphstyle = [3]\bfseries\color{njuyellow} |
| 9479 |
} |
| 9480 |
% \end{macrocode} |
| 9481 |
% |
| 9482 |
% 代码框环境。 |
| 9483 |
% \begin{macrocode} |
| 9484 |
\lstnewenvironment{shellexample}[1][]{% |
| 9485 |
\lstset{style=style@shell, #1}}{} |
| 9486 |
\lstnewenvironment{latexexample}[1][]{% |
| 9487 |
\lstset{style=style@latex, #1}}{} |
| 9488 |
% \end{macrocode} |
| 9489 |
% |
| 9490 |
% |
| 9491 |
% \subsubsection{标签颜色设置} |
| 9492 |
% |
| 9493 |
% 我们对每个 guard 进行特定的颜色标记, |
| 9494 |
% 而不是 \cls{ctxdoc} 中使用深浅表明嵌套关系。 |
| 9495 |
% |
| 9496 |
% \begin{macrocode} |
| 9497 |
\colorlet { at@guard } { njuviolet } |
| 9498 |
\definecolor { angle@guard } { gray } { 0.7 } |
| 9499 |
\definecolor { star@guard } { rgb } { 0.8 , 0 , 0 } |
| 9500 |
\definecolor { u@guard } { HTML } { 5463FF } |
| 9501 |
\definecolor { g@guard } { HTML } { 2B7A0B } |
| 9502 |
\definecolor { p@guard } { HTML } { FF1818 } |
| 9503 |
\definecolor { c@guard } { HTML } { FFC300 } |
| 9504 |
% \end{macrocode} |
| 9505 |
% |
| 9506 |
% \begin{variable}{\c@@_module_color_prop} |
| 9507 |
% 存储 guard 名称和对应的颜色。 |
| 9508 |
% \begin{macrocode} |
| 9509 |
\prop_const_from_keyval:Nn \c@@_module_color_prop |
| 9510 |
{ |
| 9511 |
def-u = u@guard, |
| 9512 |
def-g = g@guard, |
| 9513 |
def-p = p@guard |
| 9514 |
} |
| 9515 |
% \end{macrocode} |
| 9516 |
% \end{variable} |
| 9517 |
% |
| 9518 |
% \begin{macro}{\@@_set_module_color:n} |
| 9519 |
% |
| 9520 |
% \begin{macrocode} |
| 9521 |
\cs_new:Npn \@@_set_module_color:Nn #1#2 |
| 9522 |
{ |
| 9523 |
\prop_get:NnNF \c@@_module_color_prop {#2} #1 |
| 9524 |
{ \tl_set:Nn #1 { c@guard } } |
| 9525 |
\exp_args:NV \color #1 #2 |
| 9526 |
} |
| 9527 |
\cs_new:Npn \@@_set_module_color:n |
| 9528 |
{ \@@_set_module_color:Nn \l_tmpa_tl } |
| 9529 |
% \end{macrocode} |
| 9530 |
% \end{macro} |
| 9531 |
% |
| 9532 |
% \begin{macro}{\@@_module_angle:Nn} |
| 9533 |
% 生成完整的带颜色的 guard 标签。 |
| 9534 |
% \begin{macrocode} |
| 9535 |
\cs_new_protected:Npn \@@_module_angle:Nn #1#2 |
| 9536 |
{ |
| 9537 |
\group_begin: \color { angle@guard } \ttfamily \textlangle \group_end: |
| 9538 |
\group_begin: \sffamily #2 \group_end: |
| 9539 |
\group_begin: \color { angle@guard } #1 \ttfamily \textrangle \group_end: |
| 9540 |
} |
| 9541 |
% \end{macrocode} |
| 9542 |
% \end{macro} |
| 9543 |
% |
| 9544 |
% \begin{macro}{\__ctxdoc_module_angle:n} |
| 9545 |
% 补丁。 |
| 9546 |
% \begin{macrocode} |
| 9547 |
\cs_set:Npn \__ctxdoc_module_angle:n |
| 9548 |
{ \@@_module_angle:Nn \c_empty_tl } |
| 9549 |
% \end{macrocode} |
| 9550 |
% \end{macro} |
| 9551 |
% |
| 9552 |
% \begin{macro}{\@@_colored_module_angle:NN} |
| 9553 |
% |
| 9554 |
% \begin{macrocode} |
| 9555 |
\cs_new_protected:Npn \@@_colored_module_angle:NN #1#2 |
| 9556 |
{ |
| 9557 |
\seq_clear:N #2 |
| 9558 |
\seq_map_inline:Nn #1 |
| 9559 |
{ |
| 9560 |
\seq_gput_right:Nn #2 |
| 9561 |
{ \@@_set_module_color:n {##1} } |
| 9562 |
} |
| 9563 |
} |
| 9564 |
% \end{macrocode} |
| 9565 |
% \end{macro} |
| 9566 |
% |
| 9567 |
% \begin{macro}{\@@_print_module:n} |
| 9568 |
% |
| 9569 |
% \begin{macrocode} |
| 9570 |
\cs_new_protected:Npn \@@_print_module:n #1 |
| 9571 |
{ |
| 9572 |
\@@_colored_module_angle:NN \l_tmpa_seq \l_tmpb_seq |
| 9573 |
\bool_lazy_or:nnTF |
| 9574 |
{ \str_if_empty_p:n {#1} } |
| 9575 |
{ \int_compare_p:n { \seq_count:N \l_tmpb_seq = 1 } } |
| 9576 |
{ |
| 9577 |
\str_clear:N \l_tmpa_str |
| 9578 |
\str_clear:N \l_tmpb_str |
| 9579 |
} |
| 9580 |
{ |
| 9581 |
\str_set:Nn \l_tmpa_str { ( } |
| 9582 |
\str_set:Nn \l_tmpb_str { ) } |
| 9583 |
} |
| 9584 |
\@@_module_angle:Nn \l_tmpb_str |
| 9585 |
{ |
| 9586 |
\color { star@guard } #1 |
| 9587 |
\color { angle@guard } \l_tmpa_str |
| 9588 |
\seq_use:Nn \l_tmpb_seq |
| 9589 |
{ \color { angle@guard } \orbar } |
| 9590 |
} |
| 9591 |
} |
| 9592 |
% \end{macrocode} |
| 9593 |
% \end{macro} |
| 9594 |
% |
| 9595 |
% |
| 9596 |
% \begin{macro}{\@@_split_pm:n,\@@_split_pm:V} |
| 9597 |
% 通过竖线分割 guard 标签。 |
| 9598 |
% \begin{macrocode} |
| 9599 |
\cs_new:Npn \@@_split_pm:n |
| 9600 |
{ \seq_set_split:Nnn \l_tmpa_seq { | } } |
| 9601 |
\cs_generate_variant:Nn \@@_split_pm:n { V } |
| 9602 |
% \end{macrocode} |
| 9603 |
% \end{macro} |
| 9604 |
% |
| 9605 |
% \begin{macro}{\@@_split_m:n} |
| 9606 |
% |
| 9607 |
% \begin{macrocode} |
| 9608 |
\cs_new_protected_nopar:Npn \@@_split_m:n #1 |
| 9609 |
{ |
| 9610 |
\tl_set:Nn \l_tmpa_str {#1} |
| 9611 |
\clist_map_inline:nn { *, /, (, ) } |
| 9612 |
{ \str_remove_all:Nn \l_tmpa_str {##1} } |
| 9613 |
\@@_split_pm:V \l_tmpa_str |
| 9614 |
} |
| 9615 |
% \end{macrocode} |
| 9616 |
% \end{macro} |
| 9617 |
% |
| 9618 |
% |
| 9619 |
% \begin{macrocode} |
| 9620 |
\group_begin: |
| 9621 |
\char_set_catcode_active:N \> |
| 9622 |
% \end{macrocode} |
| 9623 |
% |
| 9624 |
% \begin{macro}{\__ctxdoc_module_star:w} |
| 9625 |
% \begin{macrocode} |
| 9626 |
\cs_gset_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop |
| 9627 |
{ |
| 9628 |
\__ctxdoc_output_module:nn |
| 9629 |
{ \@@_split_m:n {#1} } |
| 9630 |
{ \__ctxdoc_module_push:n { \@@_print_module:n { * } } } |
| 9631 |
\__ctxdoc_output_line:n {#2} |
| 9632 |
\__ctxdoc_star_format: |
| 9633 |
} |
| 9634 |
% \end{macrocode} |
| 9635 |
% \end{macro} |
| 9636 |
% |
| 9637 |
% |
| 9638 |
% \begin{macro}{\__ctxdoc_module_slash:w} |
| 9639 |
% \begin{macrocode} |
| 9640 |
\cs_gset_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop |
| 9641 |
{ |
| 9642 |
\__ctxdoc_output_module:nn |
| 9643 |
{ \@@_split_m:n {#1} } |
| 9644 |
{ \__ctxdoc_module_pop:n { \@@_print_module:n { / } } } |
| 9645 |
\__ctxdoc_output_line:n {#2} |
| 9646 |
\__ctxdoc_slash_format: |
| 9647 |
} |
| 9648 |
% \end{macrocode} |
| 9649 |
% \end{macro} |
| 9650 |
% |
| 9651 |
% |
| 9652 |
% \begin{macro}{\__ctxdoc_module_pm:w} |
| 9653 |
% \begin{macrocode} |
| 9654 |
\cs_gset_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop |
| 9655 |
{ |
| 9656 |
\tex_noindent:D |
| 9657 |
\hbox_overlap_left:n |
| 9658 |
{ |
| 9659 |
\__ctxdoc_output_module:nn |
| 9660 |
{ \@@_split_pm:n {#1} } |
| 9661 |
{ \@@_print_module:n { } } |
| 9662 |
\skip_horizontal:n { \leftskip + \smallskipamount } |
| 9663 |
} |
| 9664 |
\group_begin: |
| 9665 |
\__ctxdoc_pm_format: |
| 9666 |
\__ctxdoc_output_line:n {#2} |
| 9667 |
\group_end: |
| 9668 |
} |
| 9669 |
\group_end: |
| 9670 |
% \end{macrocode} |
| 9671 |
% \end{macro} |
| 9672 |
% |
| 9673 |
% \begin{macro}{\grd,\sgrd,\pgrd} |
| 9674 |
% 在手册中生成带颜色的 guard 标记。 |
| 9675 |
% \begin{macrocode} |
| 9676 |
\NewDocumentCommand \grd { m } |
| 9677 |
{ \__ctxdoc_module_angle:n { \color { njuviolet } #1 } } |
| 9678 |
\NewDocumentCommand \sgrd { m } |
| 9679 |
{ \__ctxdoc_module_angle:n { \color { star@guard } * \color{ c@guard } #1 } } |
| 9680 |
\NewDocumentCommand \pgrd { m } |
| 9681 |
{ \__ctxdoc_module_angle:n { \color { #1 @guard } def- #1 } } |
| 9682 |
% \end{macrocode} |
| 9683 |
% \end{macro} |
| 9684 |
% |
| 9685 |
% \subsubsection{语法高亮} |
| 9686 |
% |
| 9687 |
% \begin{macro}{\@@_output_line:} |
| 9688 |
% \cls{ctxdoc} 将 \file{.dtx} 文件中读取的代码行存储在 |
| 9689 |
% \cs{l__ctxdoc_verbatim_line_tl},我们使用 \pkg{codehigh} 提供的内部函数 |
| 9690 |
% 将其转化为带有语法高亮的格式并输出。我们这里做了一个向后兼容,详见 |
| 9691 |
% \href{https://github.com/lvjr/codehigh/issues/12}{\texttt{lvjr/codehigh\#12}}。 |
| 9692 |
% \begin{macrocode} |
| 9693 |
\cs_if_exist:NT \__codehigh_parse_code:nN |
| 9694 |
{ \cs_set_eq:NN \__cdhh_parse_code:nN \__codehigh_parse_code:nN } |
| 9695 |
\cs_set_protected_nopar:Npn \@@_output_line:N #1 |
| 9696 |
{ |
| 9697 |
\tex_noindent:D |
| 9698 |
\__ctxdoc_replace_at_at:N #1 |
| 9699 |
\__cdhh_parse_code:nN { latex / latex3 } #1 |
| 9700 |
\tex_par:D |
| 9701 |
} |
| 9702 |
% \end{macrocode} |
| 9703 |
% \end{macro} |
| 9704 |
% |
| 9705 |
% \begin{macro}{\__ctxdoc_output_line:} |
| 9706 |
% 在 \XeTeX{} 引擎下,\pkg{codehigh} 调用的 \pkg{l3regex} 模块有严重的性能问题。 |
| 9707 |
% 我们仅仅在需要时启用高亮。 |
| 9708 |
% \begin{macrocode} |
| 9709 |
\bool_if:NT \g_@@_codehigh_bool |
| 9710 |
{ |
| 9711 |
\cs_set:Npn \__ctxdoc_output_line: |
| 9712 |
{ \@@_output_line:N \l__ctxdoc_verbatim_line_tl } |
| 9713 |
} |
| 9714 |
% \end{macrocode} |
| 9715 |
% \end{macro} |
| 9716 |
% |
| 9717 |
% |
| 9718 |
% \begin{macrocode} |
| 9719 |
%</doc-cls> |
| 9720 |
% \end{macrocode} |
| 9721 |
% |
| 9722 |
% \end{implementation} |
| 9723 |
% |