diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/njuthesis/LICENSE | 415 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/njuthesis/README.md | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf | bin | 796172 -> 861637 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx | 3760 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/njuthesis/njuthesis.ins | 75 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls | 2053 |
6 files changed, 3221 insertions, 3086 deletions
diff --git a/Master/texmf-dist/doc/latex/njuthesis/LICENSE b/Master/texmf-dist/doc/latex/njuthesis/LICENSE deleted file mode 100644 index 4db9b5af292..00000000000 --- a/Master/texmf-dist/doc/latex/njuthesis/LICENSE +++ /dev/null @@ -1,415 +0,0 @@ -The LaTeX Project Public License -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -LPPL Version 1.3c 2008-05-04 - -Copyright 1999 2002-2008 LaTeX3 Project - Everyone is allowed to distribute verbatim copies of this - license document, but modification of it is not allowed. - - -PREAMBLE -======== - -The LaTeX Project Public License (LPPL) is the primary license under -which the LaTeX kernel and the base LaTeX packages are distributed. - -You may use this license for any work of which you hold the copyright -and which you wish to distribute. This license may be particularly -suitable if your work is TeX-related (such as a LaTeX package), but -it is written in such a way that you can use it even if your work is -unrelated to TeX. - -The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', -below, gives instructions, examples, and recommendations for authors -who are considering distributing their works under this license. - -This license gives conditions under which a work may be distributed -and modified, as well as conditions under which modified versions of -that work may be distributed. - -We, the LaTeX3 Project, believe that the conditions below give you -the freedom to make and distribute modified versions of your work -that conform with whatever technical specifications you wish while -maintaining the availability, integrity, and reliability of -that work. If you do not see how to achieve your goal while -meeting these conditions, then read the document `cfgguide.tex' -and `modguide.tex' in the base LaTeX distribution for suggestions. - - -DEFINITIONS -=========== - -In this license document the following terms are used: - - `Work' - Any work being distributed under this License. - - `Derived Work' - Any work that under any applicable law is derived from the Work. - - `Modification' - Any procedure that produces a Derived Work under any applicable - law -- for example, the production of a file containing an - original file associated with the Work or a significant portion of - such a file, either verbatim or with modifications and/or - translated into another language. - - `Modify' - To apply any procedure that produces a Derived Work under any - applicable law. - - `Distribution' - Making copies of the Work available from one person to another, in - whole or in part. Distribution includes (but is not limited to) - making any electronic components of the Work accessible by - file transfer protocols such as FTP or HTTP or by shared file - systems such as Sun's Network File System (NFS). - - `Compiled Work' - A version of the Work that has been processed into a form where it - is directly usable on a computer system. This processing may - include using installation facilities provided by the Work, - transformations of the Work, copying of components of the Work, or - other activities. Note that modification of any installation - facilities provided by the Work constitutes modification of the Work. - - `Current Maintainer' - A person or persons nominated as such within the Work. If there is - no such explicit nomination then it is the `Copyright Holder' under - any applicable law. - - `Base Interpreter' - A program or process that is normally needed for running or - interpreting a part or the whole of the Work. - - A Base Interpreter may depend on external components but these - are not considered part of the Base Interpreter provided that each - external component clearly identifies itself whenever it is used - interactively. Unless explicitly specified when applying the - license to the Work, the only applicable Base Interpreter is a - `LaTeX-Format' or in the case of files belonging to the - `LaTeX-format' a program implementing the `TeX language'. - - - -CONDITIONS ON DISTRIBUTION AND MODIFICATION -=========================================== - -1. Activities other than distribution and/or modification of the Work -are not covered by this license; they are outside its scope. In -particular, the act of running the Work is not restricted and no -requirements are made concerning any offers of support for the Work. - -2. You may distribute a complete, unmodified copy of the Work as you -received it. Distribution of only part of the Work is considered -modification of the Work, and no right to distribute such a Derived -Work may be assumed under the terms of this clause. - -3. You may distribute a Compiled Work that has been generated from a -complete, unmodified copy of the Work as distributed under Clause 2 -above, as long as that Compiled Work is distributed in such a way that -the recipients may install the Compiled Work on their system exactly -as it would have been installed if they generated a Compiled Work -directly from the Work. - -4. If you are the Current Maintainer of the Work, you may, without -restriction, modify the Work, thus creating a Derived Work. You may -also distribute the Derived Work without restriction, including -Compiled Works generated from the Derived Work. Derived Works -distributed in this manner by the Current Maintainer are considered to -be updated versions of the Work. - -5. If you are not the Current Maintainer of the Work, you may modify -your copy of the Work, thus creating a Derived Work based on the Work, -and compile this Derived Work, thus creating a Compiled Work based on -the Derived Work. - -6. If you are not the Current Maintainer of the Work, you may -distribute a Derived Work provided the following conditions are met -for every component of the Work unless that component clearly states -in the copyright notice that it is exempt from that condition. Only -the Current Maintainer is allowed to add such statements of exemption -to a component of the Work. - - a. If a component of this Derived Work can be a direct replacement - for a component of the Work when that component is used with the - Base Interpreter, then, wherever this component of the Work - identifies itself to the user when used interactively with that - Base Interpreter, the replacement component of this Derived Work - clearly and unambiguously identifies itself as a modified version - of this component to the user when used interactively with that - Base Interpreter. - - b. Every component of the Derived Work contains prominent notices - detailing the nature of the changes to that component, or a - prominent reference to another file that is distributed as part - of the Derived Work and that contains a complete and accurate log - of the changes. - - c. No information in the Derived Work implies that any persons, - including (but not limited to) the authors of the original version - of the Work, provide any support, including (but not limited to) - the reporting and handling of errors, to recipients of the - Derived Work unless those persons have stated explicitly that - they do provide such support for the Derived Work. - - d. You distribute at least one of the following with the Derived Work: - - 1. A complete, unmodified copy of the Work; - if your distribution of a modified component is made by - offering access to copy the modified component from a - designated place, then offering equivalent access to copy - the Work from the same or some similar place meets this - condition, even though third parties are not compelled to - copy the Work along with the modified component; - - 2. Information that is sufficient to obtain a complete, - unmodified copy of the Work. - -7. If you are not the Current Maintainer of the Work, you may -distribute a Compiled Work generated from a Derived Work, as long as -the Derived Work is distributed to all recipients of the Compiled -Work, and as long as the conditions of Clause 6, above, are met with -regard to the Derived Work. - -8. The conditions above are not intended to prohibit, and hence do not -apply to, the modification, by any method, of any component so that it -becomes identical to an updated version of that component of the Work as -it is distributed by the Current Maintainer under Clause 4, above. - -9. Distribution of the Work or any Derived Work in an alternative -format, where the Work or that Derived Work (in whole or in part) is -then produced by applying some process to that format, does not relax or -nullify any sections of this license as they pertain to the results of -applying that process. - -10. a. A Derived Work may be distributed under a different license - provided that license itself honors the conditions listed in - Clause 6 above, in regard to the Work, though it does not have - to honor the rest of the conditions in this license. - - b. If a Derived Work is distributed under a different license, that - Derived Work must provide sufficient documentation as part of - itself to allow each recipient of that Derived Work to honor the - restrictions in Clause 6 above, concerning changes from the Work. - -11. This license places no restrictions on works that are unrelated to -the Work, nor does this license place any restrictions on aggregating -such works with the Work by any means. - -12. Nothing in this license is intended to, or may be used to, prevent -complete compliance by all parties with all applicable laws. - - -NO WARRANTY -=========== - -There is no warranty for the Work. Except when otherwise stated in -writing, the Copyright Holder provides the Work `as is', without -warranty of any kind, either expressed or implied, including, but not -limited to, the implied warranties of merchantability and fitness for a -particular purpose. The entire risk as to the quality and performance -of the Work is with you. Should the Work prove defective, you assume -the cost of all necessary servicing, repair, or correction. - -In no event unless required by applicable law or agreed to in writing -will The Copyright Holder, or any author named in the components of the -Work, or any other party who may distribute and/or modify the Work as -permitted above, be liable to you for damages, including any general, -special, incidental or consequential damages arising out of any use of -the Work or out of inability to use the Work (including, but not limited -to, loss of data, data being rendered inaccurate, or losses sustained by -anyone as a result of any failure of the Work to operate with any other -programs), even if the Copyright Holder or said author or said other -party has been advised of the possibility of such damages. - - -MAINTENANCE OF THE WORK -======================= - -The Work has the status `author-maintained' if the Copyright Holder -explicitly and prominently states near the primary copyright notice in -the Work that the Work can only be maintained by the Copyright Holder -or simply that it is `author-maintained'. - -The Work has the status `maintained' if there is a Current Maintainer -who has indicated in the Work that they are willing to receive error -reports for the Work (for example, by supplying a valid e-mail -address). It is not required for the Current Maintainer to acknowledge -or act upon these error reports. - -The Work changes from status `maintained' to `unmaintained' if there -is no Current Maintainer, or the person stated to be Current -Maintainer of the work cannot be reached through the indicated means -of communication for a period of six months, and there are no other -significant signs of active maintenance. - -You can become the Current Maintainer of the Work by agreement with -any existing Current Maintainer to take over this role. - -If the Work is unmaintained, you can become the Current Maintainer of -the Work through the following steps: - - 1. Make a reasonable attempt to trace the Current Maintainer (and - the Copyright Holder, if the two differ) through the means of - an Internet or similar search. - - 2. If this search is successful, then enquire whether the Work - is still maintained. - - a. If it is being maintained, then ask the Current Maintainer - to update their communication data within one month. - - b. If the search is unsuccessful or no action to resume active - maintenance is taken by the Current Maintainer, then announce - within the pertinent community your intention to take over - maintenance. (If the Work is a LaTeX work, this could be - done, for example, by posting to comp.text.tex.) - - 3a. If the Current Maintainer is reachable and agrees to pass - maintenance of the Work to you, then this takes effect - immediately upon announcement. - - b. If the Current Maintainer is not reachable and the Copyright - Holder agrees that maintenance of the Work be passed to you, - then this takes effect immediately upon announcement. - - 4. If you make an `intention announcement' as described in 2b. above - and after three months your intention is challenged neither by - the Current Maintainer nor by the Copyright Holder nor by other - people, then you may arrange for the Work to be changed so as - to name you as the (new) Current Maintainer. - - 5. If the previously unreachable Current Maintainer becomes - reachable once more within three months of a change completed - under the terms of 3b) or 4), then that Current Maintainer must - become or remain the Current Maintainer upon request provided - they then update their communication data within one month. - -A change in the Current Maintainer does not, of itself, alter the fact -that the Work is distributed under the LPPL license. - -If you become the Current Maintainer of the Work, you should -immediately provide, within the Work, a prominent and unambiguous -statement of your status as Current Maintainer. You should also -announce your new status to the same pertinent community as -in 2b) above. - - -WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE -====================================================== - -This section contains important instructions, examples, and -recommendations for authors who are considering distributing their -works under this license. These authors are addressed as `you' in -this section. - -Choosing This License or Another License ----------------------------------------- - -If for any part of your work you want or need to use *distribution* -conditions that differ significantly from those in this license, then -do not refer to this license anywhere in your work but, instead, -distribute your work under a different license. You may use the text -of this license as a model for your own license, but your license -should not refer to the LPPL or otherwise give the impression that -your work is distributed under the LPPL. - -The document `modguide.tex' in the base LaTeX distribution explains -the motivation behind the conditions of this license. It explains, -for example, why distributing LaTeX under the GNU General Public -License (GPL) was considered inappropriate. Even if your work is -unrelated to LaTeX, the discussion in `modguide.tex' may still be -relevant, and authors intending to distribute their works under any -license are encouraged to read it. - -A Recommendation on Modification Without Distribution ------------------------------------------------------ - -It is wise never to modify a component of the Work, even for your own -personal use, without also meeting the above conditions for -distributing the modified component. While you might intend that such -modifications will never be distributed, often this will happen by -accident -- you may forget that you have modified that component; or -it may not occur to you when allowing others to access the modified -version that you are thus distributing it and violating the conditions -of this license in ways that could have legal implications and, worse, -cause problems for the community. It is therefore usually in your -best interest to keep your copy of the Work identical with the public -one. Many works provide ways to control the behavior of that work -without altering any of its licensed components. - -How to Use This License ------------------------ - -To use this license, place in each of the components of your work both -an explicit copyright notice including your name and the year the work -was authored and/or last substantially modified. Include also a -statement that the distribution and/or modification of that -component is constrained by the conditions in this license. - -Here is an example of such a notice and statement: - - %% pig.dtx - %% Copyright 2005 M. Y. Name - % - % This work may be distributed and/or modified under the - % conditions of the LaTeX Project Public License, either version 1.3 - % of this license or (at your option) any later version. - % The latest version of this license is in - % http://www.latex-project.org/lppl.txt - % and version 1.3 or later is part of all distributions of LaTeX - % version 2005/12/01 or later. - % - % This work has the LPPL maintenance status `maintained'. - % - % The Current Maintainer of this work is M. Y. Name. - % - % This work consists of the files pig.dtx and pig.ins - % and the derived file pig.sty. - -Given such a notice and statement in a file, the conditions -given in this license document would apply, with the `Work' referring -to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being -generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' -referring to any `LaTeX-Format', and both `Copyright Holder' and -`Current Maintainer' referring to the person `M. Y. Name'. - -If you do not want the Maintenance section of LPPL to apply to your -Work, change `maintained' above into `author-maintained'. -However, we recommend that you use `maintained', as the Maintenance -section was added in order to ensure that your Work remains useful to -the community even when you can no longer maintain and support it -yourself. - -Derived Works That Are Not Replacements ---------------------------------------- - -Several clauses of the LPPL specify means to provide reliability and -stability for the user community. They therefore concern themselves -with the case that a Derived Work is intended to be used as a -(compatible or incompatible) replacement of the original Work. If -this is not the case (e.g., if a few lines of code are reused for a -completely different task), then clauses 6b and 6d shall not apply. - - -Important Recommendations -------------------------- - - Defining What Constitutes the Work - - The LPPL requires that distributions of the Work contain all the - files of the Work. It is therefore important that you provide a - way for the licensee to determine which files constitute the Work. - This could, for example, be achieved by explicitly listing all the - files of the Work near the copyright notice of each file or by - using a line such as: - - % This work consists of all files listed in manifest.txt. - - in that place. In the absence of an unequivocal list it might be - impossible for the licensee to determine what is considered by you - to comprise the Work and, in such a case, the licensee would be - entitled to make reasonable conjectures as to which files comprise - the Work. diff --git a/Master/texmf-dist/doc/latex/njuthesis/README.md b/Master/texmf-dist/doc/latex/njuthesis/README.md index c80ddf04694..77c522a2be5 100644 --- a/Master/texmf-dist/doc/latex/njuthesis/README.md +++ b/Master/texmf-dist/doc/latex/njuthesis/README.md @@ -6,8 +6,8 @@ The `njuthesis` class is intended for typesetting Nanjing University dissertatio Contributing ------------ -[Issues](https://github.com/nju-lug/NJUVisual/issues) and -[pull requests](https://github.com/nju-lug/NJUVisual/pulls) +[Issues](https://github.com/nju-lug/NJUThesis/issues) and +[pull requests](https://github.com/nju-lug/NJUThesis/pulls) are always welcome. Wiki diff --git a/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf b/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf Binary files differindex ee8354e6f70..f679febe8ba 100644 --- a/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf +++ b/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf diff --git a/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx b/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx index 926b68a51c5..d08e3c987f8 100644 --- a/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx +++ b/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx @@ -105,7 +105,7 @@ through XeTeX. % %<class>\NeedsTeXFormat{LaTeX2e} %<class>\RequirePackage{expl3} -%<class>\GetIdInfo $Id: njuthesis.dtx 0.12.0 2021-11-30 11:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ +%<class>\GetIdInfo $Id: njuthesis.dtx 0.13.0 2021-12-13 16:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ %<class> { Thesis template for Nanjing University } %<class>\ProvidesExplClass{njuthesis} %<class>{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -113,14 +113,56 @@ through XeTeX. %<*driver> \ProvidesFile{njuthesis.dtx} \documentclass{ctxdoc} -\usepackage{floatrow,tabularray,njuvisual} +\usepackage{listings,njuvisual,tabularray} \usepackage[firstpage=true]{background} \backgroundsetup{contents={\njuemblem[white!85!gray]{22cm}{!}},scale=1,angle=0,hshift=-4cm} +\newcommand*\scite[1]{\textsuperscript{\cite{#1}}} \setlist[1]{labelindent=0.5em} +\hypersetup{pdftitle={The njuthesis class – LaTeX thesis template for Nanjing University}} \UseTblrLibrary{booktabs,siunitx,diagbox} \DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable} \SetTblrStyle{caption-tag}{font=\bfseries} \DefTblrTemplate{caption-sep}{default}{\quad} +\lstdefinestyle{style@base} + { + basewidth = 0.5 em, + gobble = 3, + lineskip = 3 pt, + frame = l, + framerule = 1 pt, + framesep = 0 pt, + xleftmargin = 2 em, + xrightmargin = 3 em, + escapeinside = {(*}{*)}, + breaklines = true, + basicstyle = \small\ttfamily, + keywordstyle = \bfseries\color{njuviolet}, + commentstyle = \itshape\color{white!50!gray}, + stringstyle = \color{nju-chem-red}, + backgroundcolor = \color{white!95!gray} + } +\lstdefinestyle{style@shell} + { + style = style@base, + rulecolor = \color{njumagenta}, + language = bash, + alsoletter = {-}, + emphstyle = \color{green} + } +\lstdefinestyle{style@latex} + { + style = style@base, + rulecolor = \color{njublue}, + language = [LaTeX]TeX, + alsoletter = {*, -}, + texcsstyle = *\color{njuviolet}, + emphstyle = [1]\color{nju-ai-orange}, + emphstyle = [2]\color{nju-cs-green} + } +\lstnewenvironment{shellexample}[1][]{% + \lstset{style=style@shell, #1}}{} +\lstnewenvironment{latexexample}[1][]{% + \lstset{style=style@latex, #1}}{} \begin{document} \DocInput{njuthesis.dtx} \PrintChanges @@ -135,7 +177,7 @@ through XeTeX. % Nanjing University Linux User Group % \thanks{E-mail: \href{mailto:nju.lug@yaoge123.cn}{nju.lug@yaoge123.cn}}} % -% \date{v0.12.0 \\ Released 2021-11-30} +% \date{v0.13.0 \\ Released 2021-12-13} % % \changes{v0.1}{2021/09/04}{开始开发。} % \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。} @@ -147,12 +189,15 @@ through XeTeX. % \changes{v0.7}{2021/09/11}{增加对研究生模板的支持} % \changes{v0.7}{2021/09/12}{将njuthesis发布在CTAN。} % \changes{v0.8}{2021/09/12}{修复已知问题,进行公开宣传。} -% \changes{v0.9}{2021/09/15}{使用DocStrip合并模板文件。} -% \changes{v0.9}{2021/09/15}{大幅度修改宏名称以符合\hologo{LaTeX3}规范。} +% \changes{v0.9}{2021/09/15}{使用 DocStrip 合并模板文件。} +% \changes{v0.9}{2021/09/15}{大幅度修改宏名称以符合 \hologo{LaTeX3} 规范。} % \changes{v0.9}{2021/09/15}{进一步完善文档。} % \changes{v0.10}{2021/09/24}{删除了生成自述文件的代码。} % \changes{v0.12}{2021/11/28}{删除内置的 \pkg{njuvisual} 代码。} % \changes{v0.12}{2021/11/29}{更新了说明文档封面设计。} +% \changes{v0.12}{2021/11/30}{区分测试文件和空白模板。} +% \changes{v0.12}{2021/12/06}{修改了说明文档的代码呈现样式。} +% \changes{v0.13}{2021/12/12}{优化了编译速度。} % % \maketitle % @@ -189,14 +234,14 @@ through XeTeX. % % \clearpage % -% \EnableDocumentation % % \begin{documentation} % -% % \section{模板介绍} +% % \cls{njuthesis},即南京大学学位论文模板,是一个由南京大学 LUG 组织维护的,用于处理本校学生毕业论文排版需求的 \hologo{LaTeX} 模板。 % +% % \subsection{历史沿革} % % 十几年来,多位热心校友发布过自己编写的模板,在GitHub上可考的包括 @@ -214,27 +259,55 @@ through XeTeX. % \end{enumerate} % 至于不幸而未进行代码版本管理的,甚至于说以压缩包形式流传于各人硬盘中的,就更不可计数了。 % -% 与其让一千个学生做一千种不同的模板,不如有人牵起头来,集中力量办大事。因此,南京大学 Linux User Group 的有志之士在2021年暑期联合起来,参考以上的现成模板,兼顾友校\href{https://ctan.org/pkg/thuthesis}{thuthesis}、\href{https://ctan.org/pkg/fduthesis}{fduthesis}等优秀项目,构建了这一全新模板,力求通过\hologo{LaTeX3}语法和清晰的接口实现良好的易用性和可维护性。 +% 与其让一千个学生做一千种不同的模板,不如有人牵起头来,集中力量办大事。因此,南 +% 京大学 Linux User Group 的有志之士在2021年暑期联合起来,参考以上的现成模板,兼 +% 顾友校\href{https://ctan.org/pkg/thuthesis}{\textsc{THuThesis}}、 +% \href{https://ctan.org/pkg/fduthesis}{\pkg{fduthesis}}等优秀项目,构建了这一全 +% 新模板,力求通过 \hologo{LaTeX3} 语法和清晰的接口实现良好的易用性和可维护性。 % % 目前,本模板的主要维护者包括: -% % \begin{itemize} % \item 赵懿晨 % \item 熊煜 % \item 马畅 % \end{itemize} % +% % \subsection{君\hologo{LaTeX}本当上手} -% \hologo{LaTeX}并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须要面对的情况。目前,中文互联网上的 \hologo{LaTeX} 写作教程不能说屈指可数,起码也是汗牛充栋,比较著名的包括刘海洋的《\hologo{LaTeX}入门》等等都是不错的参考资料。然而如何快速准确找到所需要的用法,尤其是 \hologo{LaTeX3} 的新接口,需要一定的时间或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您的相关知识体系,只能\emph{尽力做到有求必应},在需要的地方顺带提一嘴,保证您少走点弯路。 +% +% \hologo{LaTeX} 并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听 +% 到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须 +% 要面对的情况。目前,中文互联网上的 \hologo{LaTeX} 写作教程可谓汗牛充栋,然而 +% 如何快速准确找到所需要的用法,尤其是 \hologo{LaTeX3} 的新接口,需要一定的时间 +% 或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您 +% 的相关知识体系,只能\emph{尽力做到有求必应},在需要的地方顺带提一嘴,以期使您 +% 少走点弯路。 +% +% 如果您希望在使用本模板前了解一些关于这个排版软件的基础知识,在此尝试列举一些有所帮助的资料: +% \begin{description} +% \item[《\hologo{LaTeX} 入门》] 刘海洋著。 +% \item[\textit{lshort}] 著名的介绍文档,已被译为多种语言,可以参考英文版\scite{lshort}及其中文翻译版\scite{lshort-zh-cn}。 +% \end{description} +% % % \subsection{关于本说明手册} % -% 本模板通过\textsc{DocStrip}进行维护,实际上是一种\emph{文学编程}。文学编程的本体是那些用来说明的文字,按写书写文章的方式组织。 -% \file{njuthesis.dtx}包含njuthesis模板的所有信息。前半部分为模板说明,即各种常用命令与必要的使用方法;后半部分为代码实现,为带有详细注释的\hologo{TeX}源代码。后者配合附录,为有意了解本模板细节的同学提供简明的指引。 +% 本模板通过 \textsc{DocStrip} 进行维护,实际上是一种\emph{文学编程}。文学编程的 +% 本体是那些用来说明的文字,按写书写文章的方式组织。\file{njuthesis.dtx} 包含 +% \cls{njuthesis} 文档类的所有信息。前半部分为模板说明,即各种常用命令与必要的使 +% 用方法;后半部分为代码实现,为带有详细注释的 \hologo{TeX} 源代码。后者配合附 +% 录,为有意了解本模板实现细节的同学提供必要指引。 +% +% 下文中将出现若干特殊格式,用来指示代码组件。譬如,无衬线字体的 +% \pkg{pkg-example} 为宏包名,等宽字体的 \file{file-example.xxx} 为文件名,等宽 +% 字体的 \opt{opt-example}为选项名,等宽字体的 \env{env-example}为需要 +% |\begin{}|和|\end{}|的环境名,等。本手册提供的代码示例中,左侧边线呈现南大标 +% 准洋红色 {\color{njumagenta}$\blacksquare$} 的属于终端命令,呈南大标准蓝色 +% {\color{njublue}$\blacksquare$} 的属于 \hologo{LaTeX} 源代码。 % -% 下文中将出现若干特殊格式,用来指示代码组件。譬如,\file{file-example.xxx}为文件名,\pkg{pkg-example}为宏包名,\opt{opt-example}为选项名,\env{env-example}为需要|\begin{}|和|\end{}|的环境名,等。 +% 如果您在使用最新版模板时发现了任何问题,抑或有意向参与本模板的维护,请通过 +% GitHub issue 或者 QQ 群聊联系 NJU LUG。 % -% 如果您在使用最新版模板时发现了任何问题,抑或有意向参与本模板的维护,请通过GitHub issue或者QQ群聊联系LUG。 % % \section{安装} % \label{sec:setup} @@ -242,41 +315,64 @@ through XeTeX. % % \subsection{获取模板} % -% \subsubsection{自动安装} -% -% \href{https://ctan.org/pkg/njuthesis}{\cls{njuthesis}} 已经于2021年9月12日发布在CTAN(Comprehensive \hologo{TeX} Archive Network),将在明年进入\hologo{TeX}\,Live 2022。 -% \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发布。 -% 目前,南大\hologo{TeX}已预置本模板,详见\ref{subsec:onlinecompile}。 -% 您可以通过 \hologo{TeX}\,Live Manager 或者 \hologo{MiKTeX} Console 等 -% 图形化包管理器直接安装并使用以上两个宏包最新的稳定版,也可以使用 \pkg{tlmgr} -% \begin{ctexexam} -% tlmgr install njuthesis -% tlmgr install njuvisual -% \end{ctexexam} -% -% 我们强烈建议使用这一类安装方式。 +% \cls{njuthesis} 目前处于积极的维护中,其文件主要可通过以下途径获取: +% +% \subparagraph{CTAN} \href{https://ctan.org/}{CTAN}\footnote{The Comprehensive \hologo{TeX} Archive Network} 是所有 \hologo{TeX} 相关材料的中枢。\href{https://ctan.org/pkg/njuthesis}{本模板的 CTAN 页面}\footnote{\cls{njuthesis} 已经于2021年9月12日发布在 CTAN,用于绘制南大图标的 \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发布,两者将进入\hologo{TeX}\,Live 2022。}上提供基本的介绍信息,可以下载说明文档(本文档)和宏包源代码。当然,使用这一来源时并不需要接触后者,请参考 \ref{subsubsec:standard-installation} 的标准安装方法。 +% +% \subparagraph{GitHub 仓库} 最新开发进度会提交在本项目的 \href{https://github.com/nju-lug/NJUThesis}{Github仓库}。仓库内仅包含源代码、空白模板及测试文件,不可直接用于写作。这些文件对应的使用方法请参考 \ref{subsubsec:on-the-fly-installation}。如果由于网络原因不便访问主仓库,也可以从\href{https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis}{NJU Git 同步镜像} 获取项目工程文件。 +% +% \subparagraph{GitHub Releases} 本模板不定期将已有的新功能和问题修复打包为新的正式发行版,赋以更改后的版本号,发布在 \href{https://github.com/nju-lug/NJUThesis/releases/latest}{Github Releases 页面}。可供下载的文件包括下列三种: +% \begin{description} +% \item[\file{njuthesis-v*.pdf}] 模板说明文档(本文档)。 +% \item[\file{njuthesis-v*.zip}] 完整模板包,包括格式文件、范本以及编辑器配置文件。可以解压后用于本地编译或直接上传用于在线编译。 +% \item[\file{njuthesis-ctan-v*.zip}] 用于上传 CTAN 的源码包,普通用户请忽略。 +% \end{description} +% % -% 另一方面,CTAN版需要开发者手动上传,版本更新具有滞后性。如果使用时遇到了问题,推荐使用以下方式获取最新正式版。 +% \subsection{本地安装} +% +% \subsubsection{标准安装} +% \label{subsubsec:standard-installation} +% +% 我们\emph{始终建议}使用宏包管理器将 \cls{njuthesis} 安装到您的 \hologo{TeX} 系 +% 统。您可以通过 \hologo{TeX}\,Live Manager 或者 \hologo{MiKTeX} Console 等图形 +% 化包管理器直接搜索并安装 \cls{njuthesis} (及其依赖的 \pkg{njuvisual})最新的 +% 稳定版。同时,您也可以使用终端命令。例如,假设您使用的是 \hologo{TeX}\,Live, +% 键入下述 \pkg{tlmgr} 的命令(很可能需要管理员权限): +% \begin{shellexample}[morekeywords={tlmgr,install}] +% tlmgr install njuthesis njuvisual +% \end{shellexample} +% 即可完成安装,无需额外准备 \file{.cls} 文件。 % -% \subsubsection{下载正式版} -% \label{subsubsec:downloadrtm} +% 另一方面,CTAN 依赖开发者手动上传更新,版本更新具有滞后性。如果使用时遇到了问 +% 题,不妨使用下一小节的\emph{即时安装方法}优先载入较新的格式文件。 % -% 本模板不定期将已有的新功能和问题修复打包为新的正式发行版,下载方式包括: -% \begin{itemize} -% \item \href{https://github.com/nju-lug/NJUThesis/releases/latest}{Github Releases页面} -% \item \href{https://mirror.nju.edu.cn/download/app/NJUThesis%20%E8%AE%BA%E6%96%87%E6%A8%A1%E6%9D%BF}{南大镜像下载页} -%\end{itemize} -% 在国内使用时,后者具有显著更快的速度。 +% {\color{red}|[!]|} 如果您使用的是 Linux 系统而且具备相关经验,可以在下载仓库内全部文件后,于该目录下运行 +% \begin{shellexample}[morekeywords={l3build,install}] +% l3build install +% \end{shellexample} +% 来安装本模板的最新版。 % -% \subsubsection{下载源代码} +% \subsubsection{即时安装} +% \label{subsubsec:on-the-fly-installation} % -% 最新开发进度会提交在位于Github仓库的源代码。 -% 请注意,如果仅仅是希望使用这个模板写论文,请无论如何都不要从编译源代码开始,这样做只会浪费生命中宝贵的数分钟时间。 -% 我们只推荐希望参与开发的同学下载\file{dtx}文件。 -% \begin{itemize} -% \item \href{https://github.com/nju-lug/NJUThesis/}{Github 仓库} -% \item \href{https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis}{NJU Git 同步镜像} -%\end{itemize} +% 在某些情况下(例如需要上传至在线编译平台、新版本提供了急需的错误修复),您可能 +% 需要独立的 \file{.cls} 格式文件。此时请前往前述的 Releases 页面下载 +% \emph{完整模板包}。 +% +% 对于希望使用主仓库中版本的用户,本模板也提供了扁平化安装脚本,用于释放供编译的 +% 空白模板和格式文件。Windows 用户请直接双击打开 \file{install-win.bat};其他平 +% 台(包括 macOS 和 Linux)用户请在此目录下运行 +% \begin{shellexample}[morekeywords={bash}] +% bash install-unix.sh +% \end{shellexample} +% 该脚本会生成一个 \file{mythesis/} 目录以便从头写作,仓库内除此文件夹以外的内容 +% 都可以尽情删除。 +% +% {\color{red}|[!]|} 请注意,如果仅仅是希望使用这个模板撰写论文,请无论如何都不 +% 要从手动编译 \file{source/} 文件夹下的源代码开始,这样做只会浪费生命中宝贵的数 +% 分钟时间。如果遇到了问题,请前往 GitHub 仓库提出 issue。我们只推荐希望参与开发 +% 的同学接触 \file{.dtx} 文件。 % % \subsection{文件构成} % @@ -289,18 +385,18 @@ through XeTeX. % \centering % \begin{tabular}{lp{18em}} % \toprule -% 名称 & 说明 \\ +% 名称 & 说明 \\ % \midrule -% \file{.vscode} & Visual Studio Code 配置文件 \\ -% \file{latexmkrc} & latexmk 配置文件 \\ -% \file{LICENSE} & 许可证 \\ -% \file{njuthesis.bib} & 示例参考文献列表 \\ -% \file{njuthesis.cls} & 模板文档类 \\ -% \color{njuyellow}\file{njuthesis.dtx} & 文档类源代码 \\ -% \color{njuyellow}\file{njuthesis.ins} & 文档类安装脚本 \\ -% \file{njuthesis.pdf} & 用户手册(本文档) \\ +% \file{.vscode} & Visual Studio Code 配置文件 \\ +% \file{latexmkrc} & latexmk 配置文件 \\ +% \file{LICENSE} & 许可证 \\ +% \file{njuthesis.cls} & 模板文档类 \\ +% \color{njuyellow}\file{njuthesis.dtx} & 文档类源代码 \\ +% \color{njuyellow}\file{njuthesis.ins} & 文档类安装脚本 \\ +% \file{njuthesis.pdf} & 用户手册(本文档) \\ +% \file{njuthesis-sample.bib} & 示例参考文献列表 \\ % \file{njuthesis-sample.tex} & 示例文档,不妨以此为基础撰写论文 \\ -% \file{README.md} & 自述文件 \\ +% \file{README.md} & 自述文件 \\ % \bottomrule % \end{tabular} % \end{table} @@ -308,13 +404,14 @@ through XeTeX. % \subsection{本地编译} % \label{subsec:localcompile} % -% 本地编译的安装过程分为两个阶段:安装 \hologo{TeX} 发行版以及配置编辑器。前者提供了可以被命令行终端调用的编译程序,后者则提供了语法高亮、自动编译等人性化功能。 +% 本地编译的安装过程分为两个阶段:安装 \hologo{TeX} 发行版以及配置编辑器。前者提供了可以被命 +% 令行终端调用的编译程序,后者则提供了语法高亮、自动编译等人性化功能。 % % \subsubsection{安装\hologo{TeX}发行版} % -% 首先需要下载并安装 \hologo{TeX} 软件发行版,各操作系统适用情况请参考表\ref {tab:texdistribution}。第一次编译前请务必通过 MiKTeX Console、TeX Live Manager 等图形化程序或 \pkg{tlmgr}\emph{手动更新全部宏包}以避免潜在的兼容性问题。 -% -% \begin{table}[H] +% 首先需要下载并安装 \hologo{TeX} 软件发行版,其中包括引擎、宏包、字体、文档等。各操作系统适用情况请参考表~\ref {tab:texdistribution}。第一次编译前请务必通过 MiKTeX Console、TeX Live +% Manager 等图形化程序或 \pkg{tlmgr} \emph{手动更新全部宏包}以避免潜在的兼容性问题。 +% \begin{table}[ht] % \centering % \caption{\hologo{TeX} 软件发行版一览} % \label{tab:texdistribution} @@ -322,20 +419,21 @@ through XeTeX. % \toprule % \hologo{TeX} & Windows & macOS & Linux \\ % \midrule -% \hologo{TeX}\,Live & $\bullet$ & $\bullet$ & $\bullet$ \\ +% \hologo{TeX}\,Live & $\bullet$ & & $\bullet$ \\ % mac\hologo{TeX} & & $\bullet$ & \\ -% \hologo{MiKTeX} & $\bullet$ & $\bullet$ & \\ +% \hologo{MiKTeX} & $\bullet$ & $\bullet$ & $\bullet$ \\ % \bottomrule % \end{tabular} % \end{table} % % 以下是一些值得注意的要点: % \begin{itemize} -% \item 校园网环境中访问\href{https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F}{南大镜像站}可以获得最佳的下载体验。 +% \item 可以参照这份\href{https://ctan.org/pkg/install-latex-guide-zh-cn}{手把手的教程}。 +% \item 校园网环境中访问\href{https://mirror.nju.edu.cn/download/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F}{南京大学开源软件镜像站}可以获得最佳的下载体验。 % \item 使用最新的发行版,即版本号为2021或者21。 % \item 对于 Windows 和 macOS 用户,更推荐轻量化的 \hologo{MiKTeX} 套件。 -% \item Linux用户请尽可能下载 full 版本,如 |texlive-full|。换言之,下载最大的软件包。 -% \item 对于一部分用到新版本特性的宏包,\cls{njuthesis}内置了版本检查,请确认各宏包已升级至最新版。 +% \item Linux 用户请尽可能下载 full 版本,如 |texlive-full|。换言之,下载最大的软件包。 +% \item 对于一部分用到新版本特性的宏包,\cls{njuthesis} 内置了版本检查\footnote{譬如遇到 l3 过时问题请运行 |tlmgr update l3packages|。},请确认各宏包已升级至最新版。 % \end{itemize} % % \subsubsection{配置编辑器} @@ -343,7 +441,9 @@ through XeTeX. % % 配置完编译器后,还需要一个\emph{文本编辑器}来完成\file{.tex}文件内容的写作。 % -% 关于具体使用哪一种,至今仍有相当一部分人认为Windows自带的\emph{记事本}是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\emph{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 \href{https://code.visualstudio.com/}{Visual Studio Code}}。你也可以根据个人的喜好随意使用 TeXworks、TeXstudio 等编辑器,顺手就行。 +% 关于具体使用哪一种,至今仍有相当一部分人认为Windows自带的\emph{记事本}是最好的 +% 文本编辑器。但对于本项目而言,在此诚心诚意地推荐您使用\emph{更现代更美观更多功 +% 能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件的 \href{https://code.visualstudio.com/}{Visual Studio Code}}。您也可以根据个人的喜好随意使用 TeXworks、TeXstudio 等编辑器,顺手就行。 % % \cls{njuthesis} 为一些常见编辑器提供了配置文件,如 % \begin{description} @@ -353,64 +453,73 @@ through XeTeX. % % \subsubsection{编译顺序} % \label{subsubsec:compileseq} -% \hologo{TeX} 本身是命令行程序,通过不同的命令调用所需的编译引擎。 -% 尽管上述的文本编辑器已经提供了自动化编译的方法,为了便于排查运行错误,以下通过具体终端命令简要描述编译过程。 -% -% 编译本模板概括为如下步骤:生成初始文档,编译参考文献,生成页码、编号、目录,需要编译4次。 -% \emph{假设即将使用的文件名为 \file{mynjuthesis.tex}}, -% 应采用以下命令顺序进行编译,以生成内容正确的 \file{mynjuthesis.pdf}。输出的 PDF 文档位于同一目录下。 -% -% 编译命令具体为引擎名称加文件名,在编译\file{.tex}文件时,文件扩展名可以省略不写。现阶段 \cls{njuthesis} 仅支持 \hologo{XeLaTeX} 与 \hologo{LuaLaTeX}。请注意,几种命令的输出文件基本相同,可以任取一种;但如果你不清楚这两种编译引擎的区别,我们建议优先使用|latexmk -xelatex|。 -% -% \subparagraph{使用 \hologo{XeLaTeX}} -% -% \begin{ctexexam} -% xelatex mynjuthesis -% biber mynjuthesis -% xelatex mynjuthesis -% xelatex mynjuthesis -% \end{ctexexam} +% \hologo{TeX} 本身是命令行程序,通过不同的命令调用所需的编译引擎,编辑器提供的 +% 快捷按钮实际只是做了包装。为了便于排查运行错误,以下通过具体终端命令简要描述编 +% 译过程。 +% +% 编译本模板概括为如下步骤:生成初始文档,编译参考文献,生成页码、编号、目录,需 +% 要编译4次。\emph{假设即将使用的文件名为 \file{njuthesis-sample.tex}},应采用以 +% 下命令顺序进行编译,以生成内容正确的 \file{njuthesis-sample.pdf}。输出的 PDF +% 文档位于同一目录下。该目录下同时会生成若干中间文件。 +% +% 编译命令具体为引擎名称加文件名,在编译 \file{.tex} 文件时,文件扩展名可以省略 +% 不写。现阶段 \cls{njuthesis} 仅支持 \hologo{XeLaTeX} 与 \hologo{LuaLaTeX}。请 +% 注意,几种命令的输出文件基本相同,可以任取一种;但如果您不清楚这两种编译引擎的 +% 区别,或者对多步编译感到困惑,我们建议优先使用 |latexmk -xelatex|。 +% +% \subparagraph{使用 \hologo{XeLaTeX}} +% 标准的 \hologo{XeLaTeX} 引擎编译方法。 +% +% \begin{shellexample}[morekeywords={xelatex,biber}] +% xelatex njuthesis-sample +% biber njuthesis-sample +% xelatex njuthesis-sample +% xelatex njuthesis-sample +% \end{shellexample} % % \subparagraph{使用 \hologo{LuaLaTeX}} -% \begin{ctexexam} -% lualatex mynjuthesis -% biber mynjuthesis -% lualatex mynjuthesis -% lualatex mynjuthesis -% \end{ctexexam} +% 标准的 \hologo{LuaLaTeX} 引擎编译方法。 +% +% \begin{shellexample}[morekeywords={lualatex,biber}] +% lualatex njuthesis-sample +% biber njuthesis-sample +% lualatex njuthesis-sample +% lualatex njuthesis-sample +% \end{shellexample} % % \subparagraph{使用 \pkg{latexmk}} -% \href{https://mg.readthedocs.io/latexmk.html}{\pkg{latexmk}} 是一个基于 Perl 脚本的自动编译工具,宗旨是通过单一命令简化上述的多次编译流程。在使用该命令前,请确保安装了以下软件: +% \pkg{latexmk}\scite{latexmk} 是一个基于 Perl 脚本的自动编译工具,宗旨是通过单一命令简化上述的多次编译流程。在使用该命令前,请确保安装了以下软件: % \begin{description} % \item[Perl] 一般预装于 macOS 和 Linux,而 Windows 用户需要单独安装 \href{https://strawberryperl.com/}{Strawberry Perl}。 % \item[\pkg{latexmk}] \hologo{MiKTeX}已预装;如果终端找不到|latexmk|命令,\hologo{TeX}\,Live 用户需使用 \pkg{tlmgr} 单独安装。 % \end{description} % % 该命令的使用方法为 -% \begin{ctexexam} -% latexmk mynjuthesis -% \end{ctexexam} +% \begin{shellexample}[morekeywords={latexmk}] +% latexmk njuthesis-sample +% \end{shellexample} % -% 如需指定编译器,可以加入|-xelatex|或|-lualatex|参数,例如指定 \hologo{XeLaTeX} 的命令为 -% \begin{ctexexam} -% latexmk -xelatex mynjuthesis -% \end{ctexexam} +% 如需指定编译器,可以加入 |-xelatex| 或 |-lualatex| 参数,例如指定 \hologo{XeLaTeX} 的命令为 +% \begin{shellexample}[morekeywords={latexmk,xelatex}] +% latexmk -xelatex njuthesis-sample +% \end{shellexample} % % 此外可以选择使用以下命令清理编译生成的临时文件。 -% \begin{ctexexam} +% \begin{shellexample}[morekeywords={latexmk}] % latexmk -c -% \end{ctexexam} +% \end{shellexample} % % \subsection{在线编译} % \label{subsec:onlinecompile} % -% 相信你在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长\footnote{因此对于 Windows 推荐 \hologo{MiKTeX}。},占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{同一个模板在 Linux 编译可以相对 Windows 节省一半耗时。}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。 +% 相信您在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长\footnote{因此对于 Windows 推荐 \hologo{MiKTeX}。},占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{同一个模板在 Linux 编译可以相对 Windows 节省一半耗时。}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。 % % \subsubsection{南大\hologo{TeX}平台简介} % \changes{v0.2}{2021/09/07}{添加对南大\hologo{TeX}的支持。} % % \href{https://tex.nju.edu.cn}{南大\hologo{TeX}}基于开源的 ShareLaTeX 平台\footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正式上线,是 \href{https://sci.nju.edu.cn/}{eScience 中心}为南大在校师生提供的 \hologo{LaTeX} 在线编译平台,首次使用需凭学校邮箱自助注册账号。 % +% % \subsubsection{操作步骤} % % \begin{enumerate} @@ -420,76 +529,69 @@ through XeTeX. % \item 点击Compile按钮进行编译和预览 % \end{enumerate} % -% 注意,由于南大\hologo{TeX}已预装\cls{njuthesis},可以直接编写正文,无需\file{.cls}等格式文件。如果需要使用新版模板,也可以点击New Project -> Upload Project上传 \ref{subsubsec:downloadrtm} 得到的压缩文件。 +% 注意,由于南大 \hologo{TeX} 已预装 \cls{njuthesis},可以直接编写正文,无需 \file{.cls} 等格式文件。如果需要使用新版模板,也可以点击New Project -> Upload Project上传 \ref{subsubsec:on-the-fly-installation} 得到的压缩文件。 % -% \subsubsection{关于Overleaf} % -% 由于\href{https://www.overleaf.com/}{Overleaf} 平台的\hologo{TeX}\,Live版本停留在2020,\texttt{cleveref}包在引用章节时会生成错误的标签,引发格式错误;而南大\hologo{TeX}通过及时更新规避了若干问题。因此\emph{请务必不要使用Overleaf官网进行编译}。 +% \subsubsection{其他平台} % -% \subsubsection{关于TeXPage} +% \subparagraph{Overleaf} +% \changes{v0.12}{2021/12/07}{更新了对 Overleaf 的支持情况。} +% \pkg{njuthesis} 现已支持 \href{https://www.overleaf.com/}{Overleaf} 平台。 +% +% \subparagraph{TeXPage} +% \href{https://www.texpage.com/}{TeXPage} 是国人研发的\hologo{LaTeX}在线编辑器,当前版本已具备较为完善的编辑编译功能,而且免费版相对 Overleaf 增加了公式识别、编辑历史等实用工具,也可以作为一个备选项。 % -% \href{https://www.texpage.com/}{TeXPage} 是国人研发的\hologo{LaTeX}在线编辑器,当前版本已具备较为完善的编辑编译功能,而且免费版相对 Overleaf 增加了公式识别、编辑历史等实用工具,也可以作为一个备选项。目前的缺憾是对于 \cls{njuthesis} 的编译速度较慢。 % % \section{使用方法} % % \subsection{标准结构} % -% 典型的\cls{njuthesis}主文件结构应该如下所示: +% 典型的 \cls{njuthesis} 主文件结构应该如下所示: % -% \begin{ctexexam} -% \documentclass[<options>]{njuthesis} -% \njusetup { info = {<info>} } -% \graphicspath{{figure/}} -% \addbibresource{njuthesis.bib} +% \begin{latexexample}[moretexcs={\njusetup,\graphicspath,\addbibresource,\maketitle,\tableofcontents,\listoffigures,\listoftables,\mainmatter,\chapter,\printbibliography,\appendix},emph={[1]document}] +% \documentclass{njuthesis} +% \njusetup{} % \begin{document} % \maketitle -% <abstract> -% <preface> % \tableofcontents -% \listoffigures -% \listoftables % \mainmatter -% <text> -% \printbibliography[heading=bibintoc,title=参考文献] -% <acknowledgement> -% \appendix -% <appendix> +% \chapter{欢迎} +% 使用 \hologo{LaTeX} +% \printbibliography % \end{document} -% \end{ctexexam} +% \end{latexexample} +% +% 如果您尝试编译上面的代码,会发现自己得到了一个5页的 PDF 文档,是一份空白的本科生论文。 +% 当然,这个文档实际上没有任何内容,接下来将会介绍具体填写内容的方法。 +% % % \subsection{模板选项} % -% 模板选项位于\tn{documentclass}后的方括号内,用于指定模板的行为。 +% 模板选项位于 \tn{documentclass} 后的方括号内,用于指定模板的行为。 % 下文中尖括号内列出了若干个允许的选项,其中加粗的为默认选项。 -% -% % % \subsubsection{学位信息} % \begin{function}[added=2021-09-07]{degree} % \begin{syntax} % degree = <(ug)|mg|mf|phd> % \end{syntax} -% % 选择学位,分别为学士、学术型硕士、专业硕士、博士。 % \end{function} -% +% % \begin{function}[added=2021-09-07]{nlcover} % \begin{syntax} % nlcover = <\TTF> % \end{syntax} -% -% 通过此项可选择是否添加国家图书馆封面。由于本科生院文件中并未提及相关规定,故本选项仅对于研究生有效。 +% 通过此项可选择是否用国家图书馆封面替换普通封面。 +% 由于本科生院文件中并未提及相关规定,故本选项仅对于研究生有效。 % \end{function} % % \begin{function}[added=2021-09-07]{type} % \begin{syntax} % type = <(thesis)|design> % \end{syntax} -% % 用于选择文档类型并将相关字段输出在封面和摘要页,可选值分别为毕业论文和毕业设计。 -% % \end{function} -% % % % \subsubsection{指定字体} @@ -498,12 +600,11 @@ through XeTeX. % % 如果希望更改本模板使用的字体,请填写以下两个选项以覆盖操作系统检测得到的设置。 % -% \begin{function}[added=2021-09-07]{customchinesefont,customlatinfont} +% \begin{function}[added=2021-09-07,updated=2021-12-12]{cjk-font,latin-font} % \begin{syntax} -% customchinesefont = <(windows)|macos|fandol|founder|noto|none> -% customlatinfont = <(windows)|macos|gyre|none> +% cjk-font = <(win)|mac|fandol|founder|noto|none> +% latin-font = <(win)|mac|gyre|none> % \end{syntax} -% % 手动指定字体。 % \end{function} % @@ -584,211 +685,220 @@ through XeTeX. % 最后,出于统一格式的需要,本模板还选取了与正文字体相似度最高的数学字体(\href{https://github.com/aliftype/xits}{XITS 字体})用于公式排版。 % % 本节提及的字库中,中文字库只有方正书宋、方正黑体、方正楷体、方正仿宋、两种思源字体和四种Fandol字体能够\emph{免费商用}; -% 英文字库中只有 Times New Roman、XITS 和三种\Hologo{TeX} Gyre字体能够\emph{免费商用}。 +% 英文字库中只有 Times New Roman、XITS 和三种 \Hologo{TeX} Gyre字体能够\emph{免费商用}。 % 因此,若需要将本模板用于商业相关的活动,请咨询专业人士。 % +% % \subsection{个人信息} % -% \begin{function}[updated=2021-10-01]{\njusetup} +% \begin{function}[added=2021-09-10]{\njusetup} % \begin{syntax} -% \tn{njusetup}\Arg{键值列表} -% \end{syntax} -% -% -% 以下为各项个人信息,其中带星号的为对应的英文名称。 -% 有空格的内容需要将空格替换为波浪线或者两端加上大括号,不需要的项目不填即可。 -% +% \tn{njusetup} \Arg{键值列表} +% \end{syntax} +% 是 \cls{njuthesis} 文档类的通用设置命令,用来设置各项功能。\tn{njusetup} 的参数是一个使用英文半角逗号分隔的键值列表,通常形如 \meta{key}|=|\meta{value}。 % \end{function} % -% \begin{function}{info/titlea,info/titleb,info/titlec,info/title*} +% 目前,\tn{njusetup} 仅包含用于设置个人信息的 |info| 类。以下为全部的个人信息参数,其中带有星号的为对应的英文字段。请注意,部分参数已被弃置,列于后方。 +% +% \begin{function}[updated=2021-12-12]{info/title,info/title*} % \begin{syntax} -% titlea = \Arg{第一行标题} -% titleb = \Arg{第二行标题} -% titlec = \Arg{第三行标题} +% title = \Arg{标题} % title* = \Arg{英文标题} % \end{syntax} -% 题目。由于封面上提供给中文题目的横线长度有限(单行最长为15个汉字),这里将中文题目进行手动拆分,请自行选择合适的断行处。如果题目较短不需要二三行,留空即可。 +% 题目。由于封面上提供给中文题目的横线长度有限(单行最长为15个汉字),默认会自动对标题进行换行。如果需要手动制定换行位点,请使用英文半角感叹号 |!|,最多两处。 % \end{function} % -% \begin{function}{info/keywords,info/keywords*} +% \begin{function}[updated=2021-10-01]{info/keywords,info/keywords*} % \begin{syntax} -% keywords = \Arg{关键词} +% keywords = \Arg{关键词} % keywords* = \Arg{英文关键词} % \end{syntax} % 关键词列表。关键词之间需要使用英文半角逗号隔开,含有空格的关键字需要使用花括号包裹以避免歧义。可以参照示例模板中的填写方式。 % \end{function} % -% \begin{function}{info/grade} +% \begin{function}[updated=2021-10-01]{info/grade} % \begin{syntax} % grade = \Arg{20XX} % \end{syntax} % 年级,推荐格式为“20XX”。 % \end{function} % -% \begin{function}{info/student-id} +% \begin{function}[updated=2021-10-01]{info/student-id} % \begin{syntax} % student-id = \Arg{学号} % \end{syntax} % 学号。南京大学本科生为9位数字学号,研究生为两位大写字母标识加上八位数字组成的学号。 % \end{function} % -% \begin{function}{info/author,info/author*} +% \begin{function}[updated=2021-10-01]{info/author,info/author*} % \begin{syntax} -% author = \Arg{你的名字} +% author = \Arg{你的名字} % author* = \Arg{姓名拼音} % \end{syntax} % 姓名。 % \end{function} % -% \begin{function}{info/department,info/department*} +% \begin{function}[updated=2021-10-01]{info/department,info/department*} % \begin{syntax} -% department = \Arg{院系} +% department = \Arg{院系} % department* = \Arg{院系} % \end{syntax} % 院系。 % \end{function} % -% \begin{function}{info/major,info/major*} +% \begin{function}[updated=2021-10-01]{info/major,info/major*} % \begin{syntax} -% major = \Arg{专业} +% major = \Arg{专业} % major* = \Arg{专业} % \end{syntax} % 专业。 % \end{function} % -% \begin{function}{info/field,info/field*} +% \begin{function}[updated=2021-10-01]{info/field,info/field*} % \begin{syntax} % field = \Arg{方向} % field* = \Arg{方向} % \end{syntax} % 研究领域。只有研究生有研究领域的说法。 % \end{function} -% -% \begin{function}{info/supervisora,info/supervisora*,info/supervisora-title,info/supervisora-title*} +% +% \begin{function}[updated=2021-12-12]{info/supervisor,info/supervisor*,info/supervisor-title,info/supervisor-title*} % \begin{syntax} -% supervisora = \Arg{导师} -% supervisora* = \Arg{导师} -% supervisora-title = \Arg{导师职称} -% supervisora-title* = \Arg{导师职称} +% supervisor = \Arg{导师} +% supervisor* = \Arg{导师} +% supervisor-title = \Arg{导师职称} +% supervisor-title* = \Arg{导师职称} % \end{syntax} -% 导师,如果有第二导师,填写第二导师时将A替换为B即可。 +% 导师。 % \end{function} % +% \begin{function}[updated=2021-12-12]{info/supervisor-ii,info/supervisor-ii*,info/supervisor-ii-title,info/supervisor-ii-title*} +% \begin{syntax} +% supervisor-ii = \Arg{第二导师} +% supervisor-ii* = \Arg{第二导师} +% supervisor-ii-title = \Arg{第二导师职称} +% supervisor-ii-title* = \Arg{第二导师职称} +% \end{syntax} +% 第二导师。 +% \end{function} % -% \begin{function}{info/submit-date,info/submit-date*} +% \begin{function}[updated=2021-10-01]{info/submit-date,info/submit-date*} % \begin{syntax} -% submit-date = \Arg{提交日期} +% submit-date = \Arg{提交日期} % submit-date* = \Arg{提交日期} % \end{syntax} % 提交日期。 % \end{function} % -% \begin{function}{info/defend-date,info/chairman,info/reviewer} +% \begin{function}[updated=2021-10-01]{info/defend-date,info/chairman,info/reviewer} % \begin{syntax} % defend-date = \Arg{答辩日期} % chairman = \Arg{答辩主席} % reviewer = \Arg{评委姓名职称} % \end{syntax} -% 答辩相关的内容,只对研究生有效,包括答辩日期,评审委员会主席及四位成员的姓名加职称。其中,四位评审成员是以列表的形式存储的,填写方法同关键词。 +% 答辩相关的内容,只对研究生有效,包括答辩日期,评审委员会主席及四位成员的姓名加职称。其中,四位评审成员是以列表的形式存储的,填写方法同关键词。如果是盲审,填入“盲审”二字即可。 % \end{function} % -% \begin{function}{info/clc,info/secret-level,info/udc,info/supervisor-contact} +% \begin{function}[updated=2021-10-01]{info/clc,info/secret-level,info/udc,info/supervisor-contact} % \begin{syntax} % clc = \Arg{中图分类号} % secret-level = <不涉密|秘密|机密|绝密> % udc = \Arg{udc} % supervisor-contact = \Arg{导师联系方式} % \end{syntax} -% 国家图书馆封面相关,包括中图分类号、密级、udc和导师联系方式。 +% 国家图书馆封面相关,包括中图分类号、密级、UDC 分类号和导师联系方式。 +% \end{function} +% +% \begin{function}{info/titlea,info/titleb,info/titlec,info/supervisora,info/supervisora*,info/supervisora-title,info/supervisora-title*,info/supervisorb,info/supervisorb*,info/supervisorb-title,info/supervisorb-title*} +% 这些选项已在 v0.13 弃置,请不要使用。 % \end{function} % +% % \subsubsection{输入示范} % -% 本科生可以参考如下列表输入个人信息。注意不能有空行。 +% 本科生可以参考如下范例输入个人信息。注意不能有空行。 % -% \begin{ctexexam} +% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info}] % \njusetup { % info = { -% titlea = 第一行标题, -% titleb = 第二行标题, +% title = {第一行标题!第二行标题}, % title* = {My title in English}, % keywords = {我,就是,充数的,关键词}, % keywords* = {Dummy,Keywords,Here,{it is}}, -% grade = 2018, -% student-id = 189114514, -% author = 周煜华, -% author* = Zhou~Yuhua, -% department = 拉太赫科学与技术学院, -% department* = School~of~\hologo{LaTeX}, -% major = 拉太赫语言学, -% major* = \hologo{LaTeX}~Linguistics, -% supervisora = 李成殿, -% supervisora*= Li~Chengdian, -% supervisora-title = 教授, -% supervisora-title* = Professor, -% supervisorb = 孙赫弥, -% supervisorb* = Sun~Hemi, -% supervisorb-title = 副教授, -% supervisorb-title* = Associate professor, -% submit-date = 2021年8月10日, +% grade = {2018}, +% student-id = {189114514}, +% author = {周煜华}, +% author* = {Zhou Yuhua}, +% department = {拉太赫科学与技术学院}, +% department* = {School of \hologo{LaTeX}}, +% major = {拉太赫语言学}, +% major* = {\hologo{LaTeX} Linguistics}, +% supervisor = {李成殿}, +% supervisor*= {Li Chengdian}, +% supervisor-title = {教授}, +% supervisor-title* = {Professor}, +% submit-date = {2021年8月10日}, % } % } -% \end{ctexexam} +% \end{latexexample} % % 研究生可以参考如下列表输入个人信息 % -% \begin{ctexexam} +% \begin{latexexample}[moretexcs={\njusetup},emph={[2]info}] % \njusetup { % info = { -% titlea = 第一行标题, -% titleb = 第二行标题, -% titlec = 第三行标题, +% title = {第一行标题!第二行标题!第三行标题}, % title* = {My title in English}, % keywords = {我,就是,充数的,关键词}, % keywords* = {Dummy,Keywords,Here,{it is}}, -% grade = 2018, -% student-id = dz18114514, -% author = 周煜华, -% author* = Zhou~Yuhua, -% department = 拉太赫科学与技术学院, -% department* = School~of~\hologo{LaTeX}, -% major = 拉太赫语言学, -% major* = \hologo{LaTeX}~Linguistics, -% field = 拉太赫语言在现当代的使用, -% field* = Contemporary~Usage~of~the~\hologo{LaTeX}~Language, -% supervisora = 李成殿, -% supervisora*= Li~Chengdian, -% supervisora-title = 教授, -% supervisora-title* = Professor, -% submit-date = 2021年8月10日, +% grade = {2018}, +% student-id = {dz18114514}, +% author = {周煜华}, +% author* = {Zhou Yuhua}, +% department = {拉太赫科学与技术学院}, +% department* = {School of \hologo{LaTeX}}, +% major = {拉太赫语言学}, +% major* = {\hologo{LaTeX} Linguistics}, +% field = {拉太赫语言在现当代的使用}, +% field* = {Contemporary Usage of the \hologo{LaTeX}~Language}, +% supervisor = {李成殿}, +% supervisor*= {Li Chengdian}, +% supervisor-title = {教授}, +% supervisor-title* = {Professor}, +% submit-date = {2021年8月10日}, % submit-date* = {Aug 10, 2021}, -% defend-date = 2021年9月19日, -% chairman = 张晓山~教授, +% defend-date = {2021年9月19日}, +% chairman = {张晓山~教授}, % reviewer = {王瑞希~教授,郭德纲~副教授,华芈库~教授,戴菲菲~教授}, -% clc = 0175.2, -% secret-level = 限制, -% udc = 004.72, +% clc = {0175.2}, +% secret-level = {限制}, +% udc = {004.72}, % supervisor-contact = {拉太赫科学与技术学院 枝江市结丘路 19 号 114514}, % } % } -% \end{ctexexam} -% +% \end{latexexample} % % % \subsection{编写正文} % % 与导言区相对的是正文,位于\env{document}环境内。 % -% \begin{ctexexam} -% \begin{document} -% text -% \end{document} -% \end{ctexexam} +% \begin{function}{\mainmatter} +% \cs{mainmatter} 标志着正文的开始,重新开始字号计数并设置页眉。 +% \end{function} % -% 加上空行就可以另起一段。 +% 在页面布局方面,页面编号居中位于页脚,本科生无页眉,研究生页眉包括章名(奇数页)和节名(偶数页)。 % +% \begin{function}{\chapter,\section,\subsection,\subsubsection} +% \begin{syntax} +% \tn{chapter}\oarg{短描述}\marg{完整的章标题} +% \tn{section}\oarg{短描述}\marg{完整的节标题} +% \tn{subsection}\oarg{短描述}\marg{完整的节标题} +% \tn{subsection}\oarg{短描述}\marg{完整的节标题} +% \end{syntax} +% \pkg{ctex} 宏集提供了其中用于处理长标题的可选参数。对于过长的标题,目录中会使用其短描述。 +% \end{function} % -% 在页面布局方面,本科生无页眉,页面编号居中位于页脚;研究生无页脚,页眉包括章节名和页面编号(尚未确定)。 % % \subsubsection{文字} % @@ -804,7 +914,6 @@ through XeTeX. % \begin{syntax} % \tn{footnote}\Arg{脚注} % \end{syntax} -% % 添加脚注 % \end{function} % @@ -821,29 +930,30 @@ through XeTeX. % % 下面这个例子展示了如何插入一张名称为\file{myfig.jpg},宽度占页面文字宽度一半的图片。注意标签命令\tn{label}必须放在图注命令\tn{caption}之后。 % -% \begin{ctexexam} +% \begin{latexexample}[moretexcs={\includegraphics},emph={[1]figure}] % \begin{figure}[h] +% \centering % \includegraphics[width=0.5\textwidth]{myfig} % \caption{我的图} % \label{fig:myfig} % \end{figure} -% \end{ctexexam} +% \end{latexexample} % -% % 对于较为瘦长,或者仅起到辅助作用的图像,可以使用\env{wrapfigure}实现文字环绕效果。注意这个环境后紧跟的一行不能为空。 % -% \begin{ctexexam} +% \begin{latexexample}[moretexcs={\includegraphics},emph={[1]wrapfigure}] % \begin{wrapfigure}{r}{0cm} +% \centering % \includegraphics[width=0.15\textwidth]{myfig} % \caption{我的图} % \label{fig:myfig} % \end{wrapfigure} % <text> -% \end{ctexexam} +% \end{latexexample} % -% TODO:使用\pkg{subcaption}的\env{subfigure}实现多张图片并排的效果。较为老旧的\pkg{subfigure}并不在此受到支持。 +% 使用 \pkg{caption} 内置的 \pkg{subcaption} 提供 \env{subfigure} 环境,实现多张图片并排的效果。较为老旧的 \pkg{subfigure} 并不在此受到支持。 % -% \begin{ctexexam} +% \begin{latexexample}[moretexcs={\includegraphics},emph={[1]figure,subfigure}] % \begin{figure} % \begin{subfigure}{.32\textwidth} % \centering @@ -862,13 +972,15 @@ through XeTeX. % \end{subfigure} % \caption{subfigures} % \end{figure} -% \end{ctexexam} +% \end{latexexample} +% % % \subsubsection{表格} % % 下面这个例子展示了如何插入一张表格。通过 \pkg{booktabs} 提供的 \tn{toprule}、\tn{midrule} 和 \tn{bottomrule},我们可以很轻松地绘制出一张漂亮规范的三线表。 -% \begin{ctexexam} +% \begin{latexexample}[moretexcs={\toprule,\midrule,\bottomrule},emph={[1]table,tabular}] % \begin{table}[htbp] +% \centering % \caption{我的表} % \label{tab:testtab} % \begin{tabular}{ccc} @@ -879,7 +991,7 @@ through XeTeX. % \bottomrule % \end{tabular} % \end{table} -% \end{ctexexam} +% \end{latexexample} % % \begin{function}{\multirow,\multicolumn} % \begin{syntax} @@ -892,16 +1004,23 @@ through XeTeX. % % \end{function} % +% % \subsubsection{代码} % -% 由\pkg{listings}提供代码排版。代码块\env{lstlisting},注意这个环境中的缩进空格会如实输出 -% \begin{ctexexam} -% \begin{lstlisting} +% 由 \pkg{listings} 提供代码排版。代码块 \env{lstlisting},注意这个环境中的缩进空格会如实输出。 +% 如需指定语言,可以使用 |language| 选项。如需自定义关键字,可以使用 |morekeywords| 选项 +% \begin{latexexample}[emph={[1]lstlisting},emph={[2]language}] +% \begin{lstlisting}[language=python] % <code> % \end{lstlisting} -% \end{ctexexam} +% \end{latexexample} % -% 行间代码|\lstinline!<code>!|,其中包裹代码的两个感叹号并不是绝对的,可以替换成任何两个相同的没有在这段代码中出现过的符号。 +% 行间代码可以使用抄录环境 \tn{verb} , +% 格式如 |\verb!<code>!|。其中包裹代码的两个感叹号并不是绝对的,可以替换成任何两个相同的没有在这段代码中出现过的符号。 +% 同时,也可以使用简写的行内代码环境,使用两条竖线包裹代码即可。请注意,\pkg{listings} 提供的 \tn{lstinline} 会被全局的字号设置污染。如果需要在行内代码指定语言,请参考如下设置: +% \begin{latexexample}[moretexcs={\lstinline,\tt},deletetexcs={\usepackage},emph={[2]language,basicstyle}] +% \lstinline[language=[LaTeX]TeX, basicstyle=\tt]!\usepackage{njuvisual}! +% \end{latexexample} % % % \subsubsection{数学} @@ -911,27 +1030,45 @@ through XeTeX. % 行内公式形如|$\mathrm{e}^{(a+2b)x}$| % % 带有编号的行间公式\env{equation} -% \begin{ctexexam} +% \begin{latexexample}[emph={[1]equation}] % \begin{equation}\label{eq:myeqlabel} % \pi % \end{equation} -% \end{ctexexam} +% \end{latexexample} % -% 如不需要编号,可以用\env{equation*}或者 |\[<eq>\]| +% 如不需要编号,可以用 \env{equation*} 或者 |\[|\meta{公式}|\]|,请不要使用可能引发问题的 |$$|\meta{公式}|$$|\footnote{\url{https://tex.stackexchange.com/questions/503/why-is-preferable-to}}。 +% +% 本模板也提供了一系列的数学环境。 +% 全部预定义的数学环境如表~\ref{tab:mathenv} 所示。其中证明环境较为特殊,会在结尾添加证毕符号(\mdwhtsquare)。 +% +% \begin{table}[htbp] +% \centering +% \caption{数学环境} +% \label{tab:mathenv} +% \begin{tabular}{cc|cc} +% \toprule +% 标签 & 名称 & 标签 & 名称 \\ +% \midrule +% axiom & 公理 & lemma & 引理 \\ +% corollary & 推论 & proof & 证明 \\ +% definition & 定义 & theorem & 定理 \\ +% example & 例 & & \\ +% \bottomrule +% \end{tabular} +% \end{table} % -% 本模板也提供了一系列的数学环境。证明环境会在结尾添加证毕符号 -% \begin{ctexexam} +% 使用示例如下。 +% \begin{latexexample} % \begin{proof} % 证明我是我 % \end{proof} -% \end{ctexexam} -% -% 普通环境 -% \begin{ctexexam} +% \end{latexexample} +% 普通环境。 +% \begin{latexexample} % \begin{definition}[他人] % 定义他人即地狱 % \end{definition} -% \end{ctexexam} +% \end{latexexample} % % % \subsubsection{引用} @@ -940,9 +1077,7 @@ through XeTeX. % \begin{syntax} % \tn{cref}\Arg{标签} % \end{syntax} -% -% 使用\pkg{cleveref}宏包实现了带图、表等项目名称的智能引用。 -% +% 使用 \pkg{cleveref} 宏包实现了带图、表等项目名称的智能引用。 % \end{function} % % \begin{function}{\href,\url} @@ -950,49 +1085,48 @@ through XeTeX. % \tn{href}\Arg{链接}\Arg{名称} % \tn{url}\Arg{链接} % \end{syntax} -% -% 超链接。\tn{href}会将特定字符显示为可点击的超链接,\tn{url}会输出可点击的链接原文。 -% +% 超链接。\tn{href} 会将特定字符显示为可点击的超链接,\tn{url} 会输出可点击的链接原文。 % \end{function} % % % \subsection{特殊页面} % -% 本模板还提供一系列环境用于生成所需的特殊页面 +% 本模板还提供一系列命令与环境用于生成所需的特殊页面。 % % \subsubsection{封面} % % \begin{function}{\maketitle} -% % 用于生成封面。 % 本科生仅会生成中文封面;研究生会生成中英文封面。 -% 如果选择了\opt{nlcover},也会生成研究生的国家图书馆封面。 -% +% 如果选择了 \opt{nlcover},仅会生成研究生的国家图书馆封面和原创性声明页。 % \end{function} % % % \subsubsection{摘要页} % \changes{v0.11}{2021/10/01}{简化了摘要的编写方式。} -% % -% \begin{ctexexam} +% \begin{function}{abstract,abstract*} +% 摘要。带星号的会生成英文摘要。 +% \end{function} +% +% \begin{latexexample}[emph={[1]abstract,abstract*}] % \begin{abstract} % 我的中文摘要 % \end{abstract} % % \begin{abstract*} -% My abstract in English +% Abstract in English % \end{abstract*} -% \end{ctexexam} +% \end{latexexample} % % % \subsubsection{前言页} % -% \begin{function}{preface} -% 使用\env{preface}环境定义 +% \begin{function}{preface} +% 使用 \env{preface} 环境定义。 % \end{function} % -% \begin{ctexexam} +% \begin{latexexample}[emph={[1]preface,flushright}] % \begin{preface} % 我的前言 % \vspace{1cm} @@ -1001,45 +1135,34 @@ through XeTeX. % 时间地点 % \end{flushright} % \end{preface} -% \end{ctexexam} +% \end{latexexample} +% % % \subsubsection{目录页} % % \begin{function}{\tableofcontents,\listoffigures,\listoftables} -% % 分别生成目录、图片清单和表格清单。 -% % \end{function} % % % \subsubsection{致谢页} % % \begin{function}{acknowledgement} -% 同前言,使用\env{acknowledgement}环境 +% 同前言,使用 \env{acknowledgement} 环境。 % \end{function} % -% \begin{ctexexam} +% \begin{latexexample}[emph={[1]acknowledgement}] % \begin{acknowledgement} % 感谢NJU LUG % \end{acknowledgement} -% \end{ctexexam} +% \end{latexexample} % -% \subsubsection{参考文献页} % -% 使用以下命令,\opt{bibintoc}可以将参考文献页插入目录 -% -% \begin{ctexexam} -% \printbibliography[heading=bibintoc,title=参考文献] -% \end{ctexexam} -% % \subsubsection{附录页} % % \begin{function}{\appendix} -% % 附录放在本命令后,以英文字母进行编号,编写方式同正文 % \end{function} -% -% 是否需要索引? % % % \subsubsection{成果列表} @@ -1048,32 +1171,26 @@ through XeTeX. % \begin{syntax} % \tn{njupaperlist}\Arg{文献} % \end{syntax} -% 成果列表,分别为发表文章目录与合作文章目录。\Arg{文献}的填写方式同\tn{cite},多个文献需要使用英文半角逗号隔开。 +% 成果列表,分别为发表文章目录与合作文章目录。\Arg{文献} 的填写方式同 \tn{cite},多个文献需要使用英文半角逗号隔开。 % \end{function} % % \subsection{参考文献} % -% 符合GB7714-2015规范。使用\hologo{biber}作为\hologo{BibTeX}后端。需要使用|biber|命令手动编译才会显示 +% 符合GB7714-2015规范。使用\hologo{biber}作为后端。需要使用 |biber| 命令手动编译才会显示 % % \begin{function}{\addbibresource} % \begin{syntax} % \tn{addbibresource}\Arg{文件} % \end{syntax} -% -% 默认参考文献存储于主目录下的\file{njuthesis.bib},直接向其中粘贴新的参考文献即可。如果希望额外添加参考文献列表,可以在导言区中多次调用\tn{addbibresource}命令。注意本命令与|\bibliography{bibfile1,bibfile2}|不同,不可以用逗号分隔多个输入文件,且必须使用带扩展名的完整文件名。 +% 添加参考文献源文件。 % \end{function} % -% -% \subsubsection{使用EndNote} -% -% 南京大学信息化建设管理服务中心已购买\href{https://itsc.nju.edu.cn/EndNote/list.htm}{EndNote}供全校师生免费试用,最新版为EndNote 20。 +% 示例参考文献存储于 \file{njuthesis-sample.bib},直接向其中粘贴新的参考文献即可。如果希望额外添加参考文献列表,可以在导言区中多次调用 \tn{addbibresource} 命令。注意本命令与 |\bibliography{bibfile1,bibfile2}| 不同,不可以用逗号分隔多个输入文件,且必须使用带扩展名的完整文件名。 % +% \begin{function}{\printbibliography} +% 生成参考文献列表页面。 +% \end{function} % -% \subsubsection{使用Zotero} -% -% \href{https://www.zotero.org/}{Zotero}是一款免费的文献管理软件,支持所有桌面平台。 -% -% 在保持Zotero程序运行的情况下,点击浏览器工具栏的Zotero Connector插件即可自动从网页抓取参考文件信息。Zotero可以通过\href{https://github.com/l0o0/jasminum}{jasminum插件}支持中文参考文献的识别。在选中希望使用的文献后右键导出文献条目即可生成\file{.bib}文件。 % % \subsubsection{文段内引用} % @@ -1085,23 +1202,81 @@ through XeTeX. % \end{syntax} % 引用文献 % \end{function} +% +% +% \subsubsection{文献管理} +% +% \subparagraph{使用EndNote} +% +% 南京大学信息化建设管理服务中心已购买\href{https://itsc.nju.edu.cn/EndNote/list.htm}{EndNote}供全校师生免费试用,最新版为EndNote 20。 +% +% +% \subparagraph{使用Zotero} +% +% \href{https://www.zotero.org/}{Zotero}是一款免费的文献管理软件,支持所有桌面平台。 +% +% 在保持Zotero程序运行的情况下,点击浏览器工具栏的Zotero Connector插件即可自动从网页抓取参考文件信息。Zotero可以通过\href{https://github.com/l0o0/jasminum}{jasminum插件}支持中文参考文献的识别。在选中希望使用的文献后右键导出文献条目即可生成\file{.bib}文件。 +% % % \subsection{视觉识别系统} % % 视觉识别系统 \pkg{njuvisual} 现已被分离为独立宏包,基本使用方法举例如下: -% \begin{ctexexam} -% \njuemblem{!}{3cm} % 默认生成指定大小的紫色南大校徽 -% \njuname{4cm}{!} % 默认生成指定大小的紫色南大中文校名 -% \njuname*{4cm}{!} % 默认生成指定大小的紫色南大英文校名 +% \begin{latexexample}[moretexcs={\njuemblem,\njuname}] +% \njuemblem{!}{3cm} % 生成指定大小的紫色南大校徽 +% \njuname{4cm}{!} % 生成指定大小的紫色南大中文校名 +% \njuname*{4cm}{!} % 生成指定大小的紫色南大英文校名 % \njuemblem[black]{!}{3cm} % 黑色的南大校徽 % \njuemblem[department=dii]{!}{4cm} % 紫色匡院徽标 % \njuemblem[department=cs,color=blue]{!}{3cm} % 纯蓝色计科徽标 -% \end{ctexexam} +% \end{latexexample} % % 本宏包的详细使用方法请参考其\href{http://mirrors.ctan.org/macros/latex/contrib/njuvisual/njuvisual.pdf}{说明文档}。 % +% +% \begin{thebibliography}{99} +% +% \newcommand\urlprefix{\newline\hspace*{\fill}} +% \let\OldUrl=\url +% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}} +% \newcommand\CTANurl[2][]{{^^A +% \small\textit{#1}~\href{http://mirror.ctan.org/#2}{\texttt{CTAN://#2}}}} +% +% \subsubsection{书籍} +% +% \bibitem{lshort} +% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. +% \newblock \textit{The Not So Short Introduction to \hologo{LaTeXe}: Or \hologo{LaTeXe} in 139 minutes} [EB/OL]. +% \newblock version 6.4, +% \newblock (2021-03-09) +% \urlprefix\url{https://ctan.org/pkg/lshort-english} +% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf} +% +% \bibitem{lshort-zh-cn} +% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. +% \newblock \textit{一份(不太)简短的 \hologo{LaTeXe} 介绍: 或 111 分钟了解 \hologo{LaTeXe}} [EB/OL]. +% \newblock \CTeX{} 开发小组, 译. +% \newblock 原版版本 version 6.4, 中文版本 version 6.03, +% \newblock (2021-11-21) +% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn} +% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf} +% +% +% \subsubsection{宏包、模版} +% +% \bibitem{latexmk} +% \textsc{Collins J}. +% \newblock \textit{Fully automated \hologo{LaTeX} document generation} [EB/OL]. +% \newblock version 4.76, +% \newblock (2021-11-20) +% \urlprefix\url{https://www.ctan.org/pkg/latexmk} +% \urlprefix\CTANurl[文档:]{support/latexmk/latexmk.pdf} +% +% \end{thebibliography} +% +% % \end{documentation} % +% % \begin{implementation} % % \section{代码实现} @@ -1116,9 +1291,10 @@ through XeTeX. % “|*|”和“|/|”的 guard 出现在行号右侧,它们用来确定 % 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。 % -% 另有若干包含|@@|的guard,在 \pkg{l3docstrip} 中表示名空间(模块)。 -% 在删除注释生成格式文件时,变量名称中的|@@|会被等号后的字段替换, -% 譬如在本模板\cls{njuthesis}中 |@@=nju|。 +% 另有若干包含 |@@| 的guard,用以表示名空间(模块)。 +% 在删除注释生成格式文件时,变量名称中的 |@@| 会被等号后的字段替换, +% 譬如在本模板 \cls{njuthesis} 中 |@@=nju|。 +% % % \subsection{准备} % @@ -1128,20 +1304,21 @@ through XeTeX. % \end{macrocode} % % \changes{v0.11}{2021/10/23}{添加了若干环境检查与警告信息。} +% \changes{v0.12}{2021/12/03}{放宽对于 \pkg{l3packages} 的版本要求。} % 检查 \hologo{LaTeX3} 编程环境。 % \begin{macrocode} \RequirePackage { xtemplate, l3keys2e } \msg_new:nnn { njuthesis } { l3-too-old } { - Package~ "#1"~ is~ too~ old. \\\\ - Please~ update~ an~ up-to-date~ version~ of~ \\ - the~ bundles "l3kernel"~ and~ "l3packages"~ \\ - using~ your~ TeX~ package manager~ or~ from~ \\ + Package~ "#1"~ is~ too~ old. \\ + Please~ update~ an~ up-to-date~ version~ of~ + the~ bundles "l3kernel"~ and~ "l3packages"~ + using~ your~ TeX~ package~ manager~ or~ from~ \\ CTAN. } \clist_map_inline:nn { xtemplate, l3keys2e } { - \@ifpackagelater {#1} { 2021/08/27 } + \@ifpackagelater {#1} { 2020/10/01 } { } { \msg_error:nnn { njuthesis } { l3-too-old } {#1} } } @@ -1151,10 +1328,10 @@ through XeTeX. % \begin{macrocode} \msg_new:nnn { njuthesis } { unsupported-engine } { - The~ njuthesis~ class~ requires~ either~ \\ - XeTeX~ or~ LuaTeX. \\\\ - "#1"~ is~ not~ supported~ at~ present.~ \\ - You~ must~ change your~ typesetting~ engine~ \\ + The~ njuthesis~ class~ requires~ either~ + XeTeX~ or~ LuaTeX. \\ + "#1"~ is~ not~ supported~ at~ present.~ + You~ must~ change your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". } \sys_if_engine_xetex:F @@ -1167,14 +1344,32 @@ through XeTeX. } % \end{macrocode} % -% \subsection{定义常量} % -% \begin{variable}{\c_@@_name_type_clist, +% \subsection{定义变量} +% +% l代表局部变量,g代表全局变量。 +% +% \begin{variable}{\l_@@_tmp_box,\l_@@_tmp_clist,\l_@@_tmp_dim, +% \l_@@_tmp_int,\l_@@_tmp_seq,\l_@@_tmp_tl} +% 临时变量。 +% \begin{macrocode} +\box_new:N \l_@@_tmp_box +\clist_new:N \l_@@_tmp_clist +\dim_new:N \l_@@_tmp_dim +\int_new:N \l_@@_tmp_int +\seq_new:N \l_@@_tmp_seq +\tl_new:N \l_@@_tmp_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_name_type_clist,\c_@@_name_type_en_clist, % \c_@@_name_degree_clist,\c_@@_name_degree_en_clist} % 论文类型与学位类型。 % \begin{macrocode} \clist_const:Nn \c_@@_name_type_clist { 毕业论文, 毕业设计 } +\clist_const:Nn \c_@@_name_type_en_clist + { THESIS, DESIGN } \clist_const:Nn \c_@@_name_degree_clist { 学士, 硕士, 硕士专业, 博士 } \clist_const:Nn \c_@@_name_degree_en_clist @@ -1182,11 +1377,74 @@ through XeTeX. % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_info_degree_int,\l_@@_info_degree_tl, +% \l_@@_info_diploma_int,\l_@@_info_diploma_tl, +% \l_@@_info_type_int,\l_@@_info_type_tl} +% 用于存储学位名称的变量。 +% \begin{macrocode} +\int_new:N \l_@@_info_degree_int +\tl_new:N \l_@@_info_degree_tl +\int_new:N \l_@@_info_diploma_int +\tl_new:N \l_@@_info_diploma_tl +\int_new:N \l_@@_info_type_int +\tl_new:N \l_@@_info_type_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_second_supv_bool} +% 定义用于判断是否有第二导师的变量。 +% \begin{macrocode} +\bool_new:N \l_@@_second_supv_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_supv_full_tl,\l_@@_info_supv_full_en_tl} +% 用于存储导师姓名加职称的变量。 +% \begin{macrocode} +\tl_new:N \l_@@_info_supv_full_tl +\tl_new:N \l_@@_info_supv_full_en_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_load_sys_font_bool} +% 定义用于判断是否需要载入系统预装字体的变量。 +% \begin{macrocode} +\bool_new:N \g_@@_load_sys_font_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_latin_font_tl,\g_@@_cjk_font_tl} +% 用于存储所使用字体名称的全局变量 +% \begin{macrocode} +\tl_new:N \g_@@_latin_font_tl +\tl_new:N \g_@@_cjk_font_tl +% \end{macrocode} +% \end{variable} +% +% +% \subsection{内部函数} +% +% \begin{macro}{\@@_quad:,\@@_qquad:} +% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。 +% \begin{macrocode} +\cs_new:Nn \@@_quad: { \skip_horizontal:n { 1 em } } +\cs_new:Nn \@@_qquad: { \skip_horizontal:n { 2 em } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_vskip:,\@@_hskip:} +% 生成一个较小的 skip。 +% \begin{macrocode} +\cs_new:Nn \@@_vskip: { \skip_vertical:n { 1 ex } } +\cs_new:Nn \@@_hskip: { \skip_horizontal:n { 0.3 em } } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_define_name:nn,\@@_define_name:nnn} % 用来定义默认名称的辅助函数。 % \begin{macrocode} \cs_new_protected:Npn \@@_define_name:nn #1#2 - { \tl_const:cn { c_@@_name_ #1 _tl } {#2} } + { \tl_const:cn { c_@@_name_ #1 _tl } {#2} } \cs_new_protected:Npn \@@_define_name:nnn #1#2#3 { \tl_const:cn { c_@@_name_ #1 _tl } {#2} @@ -1195,125 +1453,424 @@ through XeTeX. % \end{macrocode} % \end{macro} % -% 默认名称。注意空格是忽略掉的。 +% \begin{macro}{\@@_name:n,\@@_info:n} +% 根据变量名调用名称和内容信息。 % \begin{macrocode} -\clist_map_inline:nn +\cs_new:Npn \@@_name:n #1 { \tl_use:c { c_@@_name_ #1 _tl } } +\cs_new:Npn \@@_info:n #1 { \tl_use:c { l_@@_info_ #1 _tl } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_ulined_center_box:nn} +% 带有下划线的水平盒子。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \item 内容,可带有格式 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_ulined_center_box:nn #1#2 { - { pdf_creator } { LaTeX~ with~ njuthesis~ class }, + \mode_leave_vertical: + \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + \hbox_to_wd:nn {#1} { \hfil #2 \hfil } } - { \@@_define_name:nn #1 } -\clist_map_inline:nn +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_spread_box:nnn} +% 分散对齐的水平盒子。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \item 格式 +% \item 内容,不可带有格式 +% \end{arguments} +% \begin{macrocode} +\cs_generate_variant:Nn \tl_map_inline:nn { xn } +\cs_new_protected:Npn \@@_spread_box:nnn #1#2#3 { - { keywords } { 关键词: } { Keywords: }, + \mode_leave_vertical: + \hbox_to_wd:nn {#1} + { #2 \tl_map_inline:xn {#3} { ##1 \hfil } \unskip } } - { \@@_define_name:nnn #1 } % \end{macrocode} +% \end{macro} % -% \subsection{模板选项} -% \changes{v0.11}{2021/11/15}{进行了效率优化。} +% \begin{macro}{\@@_multiline_box:nnnn} +% 多行固定长度的下划线内容。 +% \begin{arguments} +% \item 用于循环的 |int| 型变量 +% \item 内容,|clist| 型变量 +% \item 行数 +% \item 宽度,|dim| 型变量 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_multiline_box:nnnn #1#2#3#4 + { + \int_set:Nn #1 { 1 } + \int_do_until:nn { #1 > #3 } + { + \@@_ulined_center_box:nn { #4 } + { \clist_item:Nn #2 { #1 } } \\ + \int_incr:N #1 + } + } +% \end{macrocode} +% \end{macro} % -% \begin{variable}{\g_@@_info_degree_int,\g_@@_info_type_int, -% \g_@@_info_diploma_tl} -% 用于存储学位名称的变量,注意宏的命名,l代表局部变量,g代表全局变量 +% \begin{macro}{\@@_put_inempty_seg:nnn} +% 将固定长度的非空字符串插入 |clist|。 +% \begin{arguments} +% \item 原始字符串 +% \item 起始位置 +% \item 长度 +% \end{arguments} % \begin{macrocode} -\int_new:N \g_@@_info_degree_int -\int_new:N \g_@@_info_type_int -\tl_new:N \g_@@_info_diploma_tl +\cs_new_protected:Npn \@@_put_inempty_seg:nnn #1#2#3 + { + \tl_set:Nx \l_@@_tmp_tl { \tl_range:Nnn { #1 } { #2 } { #2 + #3 - 1 } } + \tl_if_empty:NF \l_@@_tmp_tl { \clist_put_right:NV \l_@@_tmp_clist { \l_@@_tmp_tl } } + } % \end{macrocode} -% \end{variable} +% \end{macro} % -% \begin{variable}{\g_@@_latin_fontset_tl,\g_@@_cjk_fontset_tl} -% 用于存储所使用字体名称的全局变量 +% \begin{macro}{\@@_uline:n} +% 指定宽度的下划线。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \end{arguments} % \begin{macrocode} -\tl_new:N \g_@@_latin_fontset_tl -\tl_new:N \g_@@_cjk_fontset_tl +\cs_new_protected:Npn \@@_uline:n #1 + { + \mode_leave_vertical: + \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + } % \end{macrocode} -% \end{variable} +% \end{macro} +% +% \begin{macro}{\@@_uuline:n} +% 指定宽度的双层下划线。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_uuline:n #1 + { + \mode_leave_vertical: + \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + \rule [ -0.6 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_text_width:Nn,\@@_get_text_width:NV} +% 获取文本宽度。 +% \begin{arguments} +% \item 存储宽度的 |dim| 型变量 +% \item 文本 +% \end{arguments} +% 将内容放入 \tn{hbox} 后读取其宽度,存入 |dim| 型变量。 +% \begin{macrocode} +\cs_new:Npn \@@_get_text_width:Nn #1#2 + { + \hbox_set:Nn \l_@@_tmp_box {#2} + \dim_set:Nn #1 { \box_wd:N \l_@@_tmp_box } + } +\cs_generate_variant:Nn \@@_get_text_width:Nn { NV } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_full_uline:Nn,\@@_full_uline:NV} +% 横跨整页的下划线。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \item 文本 +% \end{arguments} +% 先使用 \cs{@@_get_text_width:Nn} 获取文本内容宽度,该宽度存储在调用的 |dim| 型变量中。随后输出文本内容。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_full_uline:Nn #1#2 + { + \@@_get_text_width:Nn #1 { #2 } + \dim_set:Nn #1 { \textwidth - #1 } #2 + } +\cs_generate_variant:Nn \@@_full_uline:Nn { NV } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_uline_entry:nnnn} +% 生成占整页宽度的下划线条目。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \item 文本 +% \item 文本 +% \item 分隔符 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_uline_entry:nnnn #1#2#3#4 + { + \@@_full_uline:NV #1 { \@@_name:n { #2 } #4 } + \@@_ulined_center_box:nn { #1 } { \@@_info:n { #3 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_uline_bientry:nnnn} +% 生成占半页宽度的下划线条目。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \item 文本 +% \item 文本 +% \item 分隔符 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_uline_bientry:nnnn #1#2#3#4 + { + \@@_full_uline:NV #1 { \@@_name:n { #2 } #4 } + \dim_sub:Nn #1 { \textwidth / 2 } + \@@_ulined_center_box:nn { #1 } { \@@_info:n { #3 } } + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{模板选项} +% \changes{v0.11}{2021/11/15}{进行了效率优化。} % % 学位信息的设置 % \begin{macrocode} \keys_define:nn { nju } -{ + { % \end{macrocode} % % \begin{macro}{degree} % 学位类型。 % \begin{macrocode} - degree .choices:nn = - { ug, mg, mf, phd } - { \int_set_eq:NN \g_@@_info_degree_int \l_keys_choice_int }, - degree .initial:n = ug, + degree .choices:nn = { ug, mg, mf, phd } + { \int_set_eq:NN \l_@@_info_degree_int \l_keys_choice_int + \tl_set:Nn \l_@@_info_degree_tl + { \clist_item:Nn \c_@@_name_degree_clist { \l_@@_info_degree_int } } +% \end{macrocode} +% 进行学位的判断。 +% \begin{macrocode} + \int_compare:nTF { \l_@@_info_degree_int == 1 } + { \tl_set:Nn \l_@@_info_diploma_tl { ug } } + { \tl_set:Nn \l_@@_info_diploma_tl { g } } }, + degree .initial:n = ug, % \end{macrocode} % \end{macro} % % \begin{macro}{type} -% 论文类型。 +% 论文类型。\cs{l_keys_choice_int} 需要被展开以获取正确的序号。 % \begin{macrocode} - type .choices:nn = - { thesis, design } - { \int_set_eq:NN \g_@@_info_type_int \l_keys_choice_int }, - type .initial:n = thesis, + type .choices:nn = { thesis, design } + { \int_set_eq:NN \l_@@_info_type_int \l_keys_choice_int + \tl_set:Nn \l_@@_info_type_tl + { \clist_item:Nn \c_@@_name_type_clist { \l_@@_info_type_int } } + \tl_put_left:Nn \l_@@_info_type_tl + { \tl_use:c { c_@@_name_ \l_@@_info_diploma_tl _tl } } }, + type .initial:n = thesis, % \end{macrocode} % \end{macro} % % \begin{macro}{nlcover} % 是否需要国家图书馆封面的设置。 % \begin{macrocode} - nlcover .bool_set:N = \g_@@_nlcover_bool, - nlcover .initial:n = false, + nlcover .bool_set:N = \g_@@_nlcover_bool, + nlcover .initial:n = false, % \end{macrocode} % \end{macro} % -% \begin{macro}{customlatinfont,customchinesefont} +% \begin{macro}{latin-font,cjk-font} +% \changes{v0.13}{2021/12/12}{简化字体选项名称。} % 定义字体选项 % \begin{macrocode} - customlatinfont .choices:nn = - { gyre, macos, windows, none } - { \tl_set_eq:NN \g_@@_latin_fontset_tl \l_keys_choice_tl }, - customchinesefont .choices:nn = - { fandol, founder, macos, noto, windows, none } - { \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl }, -} + latin-font .choices:nn = + { gyre, mac, win, none } + { \tl_set_eq:NN \g_@@_latin_font_tl \l_keys_choice_tl }, + cjk-font .choices:nn = + { fandol, founder, mac, noto, win, none } + { \tl_set_eq:NN \g_@@_cjk_font_tl \l_keys_choice_tl }, + } % \end{macrocode} % \end{macro} % -% \begin{macro}{\ProcessKeysOptions} -% 在定义完全部设置以后从tex文件导言区输入参数。 +% 在定义完全部设置以后从导言区输入参数。 % \begin{macrocode} \ProcessKeysOptions { nju } % \end{macrocode} -% \end{macro} % -% 进行学位的判断。 +% +% \subsection{配置常量} +% TODO: 分离为单独文件 +% 通用默认名称。注意空格是忽略掉的。 % \begin{macrocode} -\int_compare:nTF { \g_@@_info_degree_int == 1 } - { \tl_set:Nn \g_@@_info_diploma_tl { ug } } - { \tl_set:Nn \g_@@_info_diploma_tl { g } } +\clist_map_inline:nn + { + { id } { 学号 }, + { orig_decl } { 学位论文原创性声明 }, + { pdf_creator } { LaTeX~ with~ njuthesis~ class }, + { supv_ii } { 第二导师 }, + { supv_ttl } { 职称 } + } + { \@@_define_name:nn #1 } % \end{macrocode} -% % +% 定义同时使用到中英文名称的常量。 +% \begin{macrocode} +\clist_map_inline:nn + { + { abstract } { 摘要 } { ABSTRACT }, + { appendix } { 附录 } { appendix }, + { dept } { 院系 } { DEPARTMENT }, + { figure } { 图 } { figure }, + { keywords } { 关键词: } { Keywords:~ }, + { lang } { 中文 } { 英文 }, + { nju } { 南京大学 } { Nanjing~ University }, + { table } { 表 } { table } + } + { \@@_define_name:nnn #1 } +% \end{macrocode} +% +% 针对学位的特定名称。需要放在 \cs{ProcessKeysOptions} 导入设置选项后,以使用学位信息。 +% \begin{macrocode} +\int_compare:nTF { \l_@@_info_degree_int == 1 } + { +% \end{macrocode} +% 本科默认名称。 +% \begin{macrocode} + \clist_map_inline:nn + { + { author_full } { 本科生姓名 }, + { grade } { 年级 }, + { sm_date } { 提交日期 }, + { supv } { 导师 }, + { title } { 题目 }, + { type } { 本科生毕业论文(设计、作品)}, + { ug } { 本科 } + } + { \@@_define_name:nn #1 } + \clist_map_inline:nn + { + { author } { 学生姓名 } { UNDERGRADUATE }, + { major } { 专业 } { SPECIALIZATION }, + { supv_full } { 指导教师(姓名、职称) } { MENTOR } + } + { \@@_define_name:nnn #1 } + } +% \end{macrocode} +% 研究生默认名称。 +% \begin{macrocode} + { + \clist_map_inline:nn + { + { abstract_r } { 摘要首页用纸 }, + { author_r } { 生姓名 }, + { chairman } { 答辩委员会主席: }, + { clc } { 分类号 }, + { confer } { 学位授予单位和日期 }, + { df_date } { 论文答辩日期 }, + { degree } { 申请学位级别 }, + { degree_l } { (申请 }, + { degree_r } { 学位) }, + { field } { 研究方向 }, + { g } { 研究生 }, + { grade } { 级 }, + { major_s } { 专业 }, + { major_nl } { 专业名称 }, + { orig_sign } { 研究生签名: }, + { orig_date } { 日期: }, + { reviewer } { 评阅人: }, + { seclv } { 密级 }, + { sign } { (签字) }, + { sm_date } { 论文提交日期 }, + { supv } { 导师 }, + { supv_r } { (姓名、职称) }, + { supv_info } { 指导教师姓名、职务、 + 职称、学位、单位名称及地址 }, + { title } { 论文题目 }, + { title_nl } { (题名和副题名) }, + { title_s } { 题目 }, + { udc } { U D C } + } + { \@@_define_name:nn #1 } + \clist_map_inline:nn + { + { author } { 作者姓名 } { POSTGRADUATE }, + { major } { 专业方向 } { SPECIALIZATION }, + { supv_full } { 指导教师 } { MENTOR } + } + { \@@_define_name:nnn #1 } +% \end{macrocode} +% \begin{variable}{\c_@@_cover_en_text_tl} +% 英文封面字样。 +% \begin{macrocode} + \tl_const:Nn \c_@@_cover_en_text_tl + { + A~ dissertation~ submitted~ to \\ + the~ graduate~ school~ of~ Nanjing~ University \\ + in~ partial~ fulfilment~ of~ the~ requirements~ for~ the~ degree~ of + } + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_orig_decl_text_tl} +% 学位论文原创性声明。 +% \begin{macrocode} +\tl_const:Nn \c_@@_orig_decl_text_tl + { + 本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作 + 所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或 + 集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构 + 的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已 + 在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。 + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_theorem_type_clist} +% 默认定理类型。 +% \begin{macrocode} +\clist_const:Nn \c_@@_theorem_type_clist + { axiom, corollary, definition, example, lemma, theorem } +% \end{macrocode} +% \end{variable} +% +% 默认定理头名称。 +% \begin{macrocode} +\clist_map_inline:nn + { + { axiom } { 公理 } { Axiom }, + { corollary } { 推论 } { Corollary }, + { definition } { 定义 } { Definition }, + { example } { 例 } { Example }, + { lemma } { 引理 } { Lemma }, + { proof } { 证明 } { Proof }, + { theorem } { 定理 } { Theorem } + } + { \@@_define_name:nnn #1 } +% \end{macrocode} % % \subsection{个人信息} % 输入个人信息的区域。 % \begin{macrocode} -\keys_define:nn { nju } -{ - info.meta:nn = { nju / info } { #1 } -} +\keys_define:nn { nju } { info.meta:nn = { nju / info } { #1 } } % \end{macrocode} % % \begin{macrocode} \keys_define:nn { nju / info } -{ + { % \end{macrocode} % -% \begin{macro}{info/titlea,info/titleb,info/titlec,info/title*} +% \begin{macro}{info/title,info/title*} % 题目。以下标注星号(*)的为对应的英文字段。 % \begin{macrocode} - titlea .tl_set:N = \l_@@_info_title_a_tl, - titleb .tl_set:N = \l_@@_info_title_b_tl, - titlec .tl_set:N = \l_@@_info_title_c_tl, - title* .tl_set:N = \l_@@_info_title_en_tl, + title .tl_set:N = \l_@@_info_title_tl, + title .initial:n = { 空 }, + title* .tl_set:N = \l_@@_info_title_en_tl, % \end{macrocode} % \end{macro} % @@ -1321,78 +1878,79 @@ through XeTeX. % \changes{v0.11}{2021/10/01}{修改了添加关键词的方式。} % 关键词列表。 % \begin{macrocode} -keywords .clist_set:N = \l_@@_info_keywords_clist, -keywords* .clist_set:N = \l_@@_info_keywords_en_clist, + keywords .clist_set:N = \l_@@_info_keywords_clist, + keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % \end{macrocode} % \end{macro} % % \begin{macro}{info/grade,info/student-id,info/author,info/author*} % 年级、学号、姓名。 % \begin{macrocode} - grade .tl_set:N = \l_@@_info_grade_tl, - student-id .tl_set:N = \l_@@_info_id_tl, - author .tl_set:N = \l_@@_info_author_tl, - author* .tl_set:N = \l_@@_info_author_en_tl, + grade .tl_set:N = \l_@@_info_grade_tl, + student-id .tl_set:N = \l_@@_info_id_tl, + author .tl_set:N = \l_@@_info_author_tl, + author* .tl_set:N = \l_@@_info_author_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}{info/department,info/department*,info/major,info/major*,info/field,info/field*} % 院系、专业、方向。 % \begin{macrocode} - department .tl_set:N = \l_@@_info_dept_tl, - department* .tl_set:N = \l_@@_info_dept_en_tl, - major .tl_set:N = \l_@@_major_tl, - major* .tl_set:N = \l_@@_major_en_tl, - field .tl_set:N = \l_@@_field_tl, - field* .tl_set:N = \l_@@_field_en_tl, + department .tl_set:N = \l_@@_info_dept_tl, + department* .tl_set:N = \l_@@_info_dept_en_tl, + major .tl_set:N = \l_@@_info_major_tl, + major* .tl_set:N = \l_@@_info_major_en_tl, + field .tl_set:N = \l_@@_info_field_tl, + field* .tl_set:N = \l_@@_info_field_en_tl, % \end{macrocode} % \end{macro} % -% \begin{macro}{info/supervisora,info/supervisora*,info/supervisora-title,info/supervisora-title*} +% \begin{macro}{info/supervisor,info/supervisor*,info/supervisor-title,info/supervisor-title*} +% \changes{v0.13}{2021/12/11}{修改了导师键值对的变量名称。} % 导师 % \begin{macrocode} - supervisora .tl_set:N = \l_@@_info_supv_a_tl, - supervisora* .tl_set:N = \l_@@_info_supv_a_en_tl, - supervisora-title .tl_set:N = \l_@@_info_supv_a_title_tl, - supervisora-title*.tl_set:N = \l_@@_info_supv_a_title_en_tl, + supervisor .tl_set:N = \l_@@_info_supv_tl, + supervisor* .tl_set:N = \l_@@_info_supv_en_tl, + supervisor-title .tl_set:N = \l_@@_info_supv_ttl_tl, + supervisor-title* .tl_set:N = \l_@@_info_supv_ttl_en_tl, % \end{macrocode} % \end{macro} % -% \begin{macro}{info/supervisorb,info/supervisorb*,info/supervisorb-title,info/supervisorb-title*} +% \begin{macro}{info/supervisor-ii,info/supervisor-ii*,info/supervisor-ii-title,info/supervisor-ii-title*} % 第二导师 % \begin{macrocode} - supervisorb .tl_set:N = \l_@@_info_supv_b_tl, - supervisorb* .tl_set:N = \l_@@_info_supv_b_en_tl, - supervisorb-title .tl_set:N = \l_@@_info_supv_b_title_tl, - supervisorb-title*.tl_set:N = \l_@@_info_supv_b_title_en_tl, + supervisor-ii .tl_set:N = \l_@@_info_supv_ii_tl, + supervisor-ii* .tl_set:N = \l_@@_info_supv_ii_en_tl, + supervisor-ii-title .tl_set:N = \l_@@_info_supv_ii_ttl_tl, + supervisor-ii-title*.tl_set:N = \l_@@_info_supv_ii_ttl_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}{info/submit-date,info/submit-date*} % 提交日期 % \begin{macrocode} - submit-date .tl_set:N = \l_@@_submit_date_tl, - submit-date* .tl_set:N = \l_@@_submit_date_en_tl, + submit-date .tl_set:N = \l_@@_info_sm_date_tl, + submit-date* .tl_set:N = \l_@@_info_sm_date_en_tl, % \end{macrocode} % \end{macro} % % \begin{macro}{info/defend-date,info/chairman,info/reviewer} % 答辩信息。 % \begin{macrocode} - defend-date .tl_set:N = \l_@@_defend_date_tl, - chairman .tl_set:N = \l_@@_info_chairman_tl, - reviewer .clist_set:N = \l_@@_info_reviewer_clist, + defend-date .tl_set:N = \l_@@_info_df_date_tl, + chairman .tl_set:N = \l_@@_info_chairman_tl, + reviewer .clist_set:N = \l_@@_info_reviewer_clist, % \end{macrocode} % \end{macro} % % \begin{macro}{info/clc,info/secret-level,info/udc,info/supervisor-contact} % 国家图书馆封面相关信息。 % \begin{macrocode} - clc .tl_set:N = \l_@@_info_clc_tl, - secret-level .tl_set:N = \l_@@_info_seclv_tl, - udc .tl_set:N = \l_@@_info_udc_tl, - supervisor-contact.tl_set:N = \l_@@_info_supv_cont_tl, -} + clc .tl_set:N = \l_@@_info_clc_tl, + secret-level .tl_set:N = \l_@@_info_seclv_tl, + udc .tl_set:N = \l_@@_info_udc_tl, + supervisor-contact .tl_set:N = \l_@@_info_supv_cont_tl, + } % \end{macrocode} % \end{macro} % @@ -1401,119 +1959,158 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % \changes{v0.11}{2021/10/01}{将个人信息变量名改为小写字母加连字符的形式。} % 定义用于设置个人信息的命令 % \begin{macrocode} -\NewDocumentCommand \njusetup { m } -{ \keys_set:nn { nju } { #1 } } +\NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } } % \end{macrocode} % \end{macro} % +% 拼合双导师的姓名和职称。 +% \begin{macrocode} +\bool_set:Nn \l_@@_second_supv_bool + { ! \tl_if_empty_p:N \l_@@_info_supv_ii_tl } +\tl_set:Nn \l_@@_info_supv_full_tl + { + \l_@@_info_supv_tl \@@_hskip: + \l_@@_info_supv_ttl_tl + \bool_if:NT \l_@@_second_supv_bool + { + \@@_quad: \l_@@_info_supv_ii_tl + \@@_hskip: \l_@@_info_supv_ii_ttl_tl + } + } +\tl_set:Nn \l_@@_info_supv_full_en_tl + { + \l_@@_info_supv_ttl_en_tl \@@_hskip: + \l_@@_info_supv_en_tl + \bool_if:NT \l_@@_second_supv_bool + { + \@@_quad: \l_@@_info_supv_ii_ttl_en_tl + \@@_hskip: \l_@@_info_supv_ii_en_tl + } + } +% \end{macrocode} +% % % \subsection{载入宏包} -% -% 使用\pkg{ctexbook}作为基础文档类。 +% +% \changes{v0.12}{2021/12/07}{重新组织宏包载入顺序。} +% 将选项传入 \cls{ctexbook} 文档类。 % \begin{macrocode} -\LoadClass[ - a4paper, - twoside, - UTF8, - scheme=chinese, +\PassOptionsToClass + { + a4paper, + twoside, + UTF8, + scheme=chinese, % \end{macrocode} -% 关于行距,\hologo{LaTeX}默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故 +% 关于行距,\hologo{LaTeX} 默认1.2行距,word 默认行距是1.3,要求1.5倍 word 行距,故 % $1.5\times\frac{1.3}{1.2} = 1.625$ % \begin{macrocode} - linespread=1.625, + linespread=1.625, % \end{macrocode} -% 默认不载入任何字体,供模板自行设置 +% 默认不载入任何字体,供本模板自行设置。 % \begin{macrocode} - fontset=none, - zihao=-4 - ]{ctexbook}[2018/04/01] + fontset=none, % \end{macrocode} -% -% 载入各种宏包。 -% \pkg{emptypage}用于清除空白页的页码。 +% 正文字体设置为小四号。 % \begin{macrocode} -\RequirePackage -{ - geometry, - caption, - floatrow, - setspace, - lastpage, - emptypage, - fancyhdr, -} -\RequirePackage[titles]{tocloft} -\RequirePackage[hyphens]{url} % generate better linebreaks in the url + zihao=-4 + } + { ctexbook } % \end{macrocode} % -% -% 用于特定学科的包。 +% 传入各宏包选项。 % \begin{macrocode} -\RequirePackage{siunitx} % 用于书写单位符号 -\RequirePackage[version=4]{mhchem} % 用于绘制分子式 +\clist_map_inline:nn + { + { no-math } { fontspec }, + { perpage } { footmisc }, + { amsmath, thmmarks } { ntheorem }, + { hyphens } { url }, + { warnings-off={ mathtools-colon, mathtools-overbracket } } + { unicode-math }, + { capitalise, nameinlink, noabbrev } + { cleveref } + } + { \PassOptionsToPackage #1 } % \end{macrocode} % -% 用于生成可以被插入书签的LaTeX logo,TODO: 使用hologo创建|latex{}|命令 +% 使用\pkg{ctexbook}作为基础文档类。 % \begin{macrocode} -\RequirePackage{hologo} +\LoadClass { ctexbook } [ 2018/04/01 ] % \end{macrocode} % +% 载入各种宏包。 % \begin{macrocode} -% Required to prevent page break right after a sectioning command -% \RequirePackage{needspace} -% \RequirePackage{xspace} % Better print trailing whitespace +\RequirePackage + { + geometry, + caption, + setspace, + fancyhdr, + hologo, % \end{macrocode} -% -% \begin{macro}{\njuline} -% 针对编译引擎,使用不同的宏包构建可以对中文正常换行的下划线命令。\pkg{lua-ul}中需要在结尾使用\tn{null}保护尾部空白。 +% \pkg{url} 用于生成链接文本。 % \begin{macrocode} -\sys_if_engine_xetex:T -{ - \RequirePackage{xeCJKfntef,microtype} - \newcommand{\njuline}[1]{\CJKunderline{#1}} -} -\sys_if_engine_luatex:T -{ - \RequirePackage{lua-ul,dashundergaps} - \newcommand{\njuline}[1]{\underLine{#1}\null} -} + url, % \end{macrocode} -% \end{macro} -% -% 数学,\pkg{amsmath}必须在\pkg{unicode-math}前加载。 -% \pkg{unicode-math}指定了\hologo{XeTeX}和\hologo{LuaTeX}下所使用的数学字体。 -% 用于配置数学环境的\pkg{mathtools}会与\pkg{unicode-math}发生冲突,此处手动消除其警告。 +% \pkg{emptypage} 用于清除空白页的页码。 % \begin{macrocode} -\RequirePackage{amsmath,amsthm,mathtools,thmtools} -\RequirePackage[ - warnings-off={ - mathtools-colon, - mathtools-overbracket} - ]{unicode-math} + emptypage, % \end{macrocode} -% -% 配置图片、表格、代码、列表环境 +% 南京大学视觉形象化标准宏包 \pkg{njuvisual} 用于绘制学校 logo。 % \begin{macrocode} -\RequirePackage{graphicx,subcaption,wrapfig,tikz} -\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} -\RequirePackage{booktabs,multirow,multicol,listings,enumitem} + njuvisual, % \end{macrocode} -% -% 必须以该顺序加载以下两个关于引用的包。 +% \changes{v0.13}{2021/12/13}{使用 \pkg{ntheorem} 创建定理环境,删除 \pkg{amsthm} 和 \pkg{thmtools}。} +% 数学,\pkg{amsmath} 必须在 \pkg{unicode-math} 前加载。 +% \pkg{unicode-math} 指定了 \hologo{XeTeX} 和 \hologo{LuaTeX} 下所使用的数学字体。 +% 用于配置数学环境的 \pkg{mathtools} 会与 \pkg{unicode-math} 发生冲突,此处手动消除其警告。 +% \begin{macrocode} + amsmath, + mathtools, + unicode-math, + ntheorem, +% \end{macrocode} +% 图片与表格。 +% \begin{macrocode} + graphicx, + wrapfig, + booktabs, + multirow, +% \end{macrocode} +% 列表环境 % \begin{macrocode} -\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref} -\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref} + listings, + enumitem, +% \end{macrocode} +% 按以下顺序加载两个关于引用的包。 +% \pkg{hyperref} 覆写了大量命令,因此需要在其他包最后载入。 +% 仅有 \pkg{cleveref} 需要在 \pkg{hyperref} 后载入,否则会报错。 +% \begin{macrocode} + hyperref, + cleveref + } % \end{macrocode} % -% 载入南京大学识别视觉系统。 +% \changes{v0.13}{2021/12/13}{删除会与 \pkg{ntheorem} 冲突的 \pkg{microtype}。} +% \begin{macro}{\njuline} +% 针对编译引擎,使用不同的宏包构建可以对中文正常换行的下划线命令。 % \begin{macrocode} -\RequirePackage{njuvisual} +\sys_if_engine_xetex:T + { + \RequirePackage{xeCJKfntef} + \NewDocumentCommand \njuline { m } { \CJKunderline{#1} } + } % \end{macrocode} -% -% 生成用于测试的大段填充文字。 +% \pkg{lua-ul} 中需要在结尾使用 \tn{null} 保护尾部空白。 % \begin{macrocode} -\RequirePackage{blindtext,zhlipsum} +\sys_if_engine_luatex:T + { + \RequirePackage{lua-ul} + \NewDocumentCommand \njuline { m } { \underLine{#1} \null } + } % \end{macrocode} +% \end{macro} % % \begin{macro}{\@@_check_package:nnn} % 检查过时宏包。 @@ -1521,9 +2118,9 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, \msg_new:nnn { njuthesis } { package-too-old } { Package~ "#1"~ is~ too~ old. \\ - The~ njuthesis~ class~ only~ supports~ "#1"~ with~ \\ - a~ version higher~ than~ v#2. \\\\ - Please~ update~ an~ up-to-date~ version~ of~ it~ \\ + The~ njuthesis~ class~ only~ supports~ "#1"~ with~ + a~ version higher~ than~ v#2.\\ + Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your TeX~ package~ manager~ or~ from~ CTAN. } \cs_new_protected:Npn \@@_check_package:nnn #1#2#3 @@ -1534,33 +2131,28 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % \end{macrocode} % \end{macro} % -% 检查绘制下划线所需的 \pkg{luatexja} 包版本。该宏包在2021-09-18的解决了下划线中断问题,然而在2021-10-24的更新才提供了正确的内嵌日期。 +% 检查绘制下划线所需的 \pkg{luatexja} 包版本。该宏包在2021-09-18的更新解决了下划线中断问题,然而在2021-10-24的更新才提供了正确的内嵌日期。 % \begin{macrocode} \sys_if_engine_luatex:T { \@@_check_package:nnn { luatexja } { 2021/10/24 } { 20211024.0 } } % \end{macrocode} % +% % \subsection{字体设置} % -% \pkg{fontspec}已在C\hologo{TeX}套件中包含,无需另外载入。 +% \pkg{fontspec} 已在 C\hologo{TeX} 套件中包含,无需另外载入。 % % \subsubsection{操作系统检测} % -% \begin{variable}{\g_@@_load_system_fontset_bool} -% 定义用于判断是否需要载入系统预装字体的变量。 -% \begin{macrocode} -\bool_new:N \g_@@_load_system_fontset_bool -% \end{macrocode} -% \end{variable} % 判断用户是否自定义了中英文字体。如果其中任意一种未被定义, % 则使用系统预装字体覆盖字体选项。 % \begin{macrocode} -\tl_if_empty:NTF \g_@@_latin_fontset_tl - { \bool_gset_true:N \g_@@_load_system_fontset_bool } -{ - \tl_if_empty:NT \g_@@_cjk_fontset_tl - { \bool_gset_true:N \g_@@_load_system_fontset_bool } -} +\tl_if_empty:NTF \g_@@_latin_font_tl + { \bool_gset_true:N \g_@@_load_sys_font_bool } + { + \tl_if_empty:NT \g_@@_cjk_font_tl + { \bool_gset_true:N \g_@@_load_sys_font_bool } + } % \end{macrocode} % % 进行系统检测。 @@ -1568,202 +2160,186 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % 检测 macOS 的命令由\pkg{ctex}提供, % 这两种情况外的系统被判断为 Linux,一律使用自由字体。 % \begin{macrocode} -\bool_if:NT \g_@@_load_system_fontset_bool -{ - \sys_if_platform_windows:TF - { - \tl_set:Nn \g_@@_latin_fontset_tl { windows } - \tl_set:Nn \g_@@_cjk_fontset_tl { windows } - } - { - \ctex_if_platform_macos:TF - { - \tl_set:Nn \g_@@_latin_fontset_tl { macos } - \tl_set:Nn \g_@@_cjk_fontset_tl { macos } - } - { - \tl_set:Nn \g_@@_latin_fontset_tl { gyre } - \tl_set:Nn \g_@@_cjk_fontset_tl { fandol } - } +\bool_if:NT \g_@@_load_sys_font_bool + { + \sys_if_platform_windows:TF + { \tl_set:Nn \g_@@_latin_font_tl { win } + \tl_set:Nn \g_@@_cjk_font_tl { win } } + { \ctex_if_platform_macos:TF + { \tl_set:Nn \g_@@_latin_font_tl { mac } + \tl_set:Nn \g_@@_cjk_font_tl { mac } } + { \tl_set:Nn \g_@@_latin_font_tl { gyre } + \tl_set:Nn \g_@@_cjk_font_tl { fandol } } } } -} % \end{macrocode} % +% % \subsubsection{定义英文字库} % % 接下来逐个定义所需要使用的字库。 % -% \begin{macro}{\@@_load_latin_font_windows:} +% \begin{macro}{\@@_load_latin_font_win:} % Windows 西文字体 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_latin_font_windows: -{ - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Courier~New}[Scale=MatchLowercase] -} +\cs_new_protected:Npn \@@_load_latin_font_win: + { + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Courier~New}[Scale=MatchLowercase] + } % \end{macrocode} % \end{macro} % -% -% \begin{macro}{\@@_load_latin_font_macos:} +% \begin{macro}{\@@_load_latin_font_mac:} % macOS 西文字体。 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_latin_font_macos: -{ - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Menlo}[Scale=MatchLowercase] -} +\cs_new_protected:Npn \@@_load_latin_font_mac: + { + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Menlo}[Scale=MatchLowercase] + } % \end{macrocode} % \end{macro} % -% % \begin{macro}{\@@_load_latin_font_gyre:} % 开源的 gyre 西文字体。 % \begin{macrocode} \cs_new_protected:Npn \@@_load_latin_font_gyre: -{ - \setmainfont{texgyretermes}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setsansfont{texgyreheros}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setmonofont{texgyrecursor}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic, - Scale=MatchLowercase, - Ligatures=CommonOff] -} + { + \setmainfont{texgyretermes}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setsansfont{texgyreheros}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setmonofont{texgyrecursor}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic, + Scale=MatchLowercase, + Ligatures=CommonOff] + } % \end{macrocode} % \end{macro} % % \subsubsection{定义中文字库} % -% \begin{macro}{\@@_load_cjk_font_windows:} +% \begin{macro}{\@@_load_cjk_font_win:} % Windows 中文字体。 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_cjk_font_windows: -{ - \setCJKmainfont{SimSun}[ - AutoFakeBold=2.17, - ItalicFont=KaiTi] - \setCJKsansfont{SimHei} - \setCJKmonofont{FangSong} - \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] - \setCJKfamilyfont{zhhei}{SimHei} - \setCJKfamilyfont{zhfs}{FangSong} - \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] - % \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[ - % BoldFont=Microsoft~YaHei~Bold] -} +\cs_new_protected:Npn \@@_load_cjk_font_win: + { + \setCJKmainfont{SimSun}[ + AutoFakeBold=2.17, + ItalicFont=KaiTi] + \setCJKsansfont{SimHei} + \setCJKmonofont{FangSong} + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhhei}{SimHei} + \setCJKfamilyfont{zhfs}{FangSong} + \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] + } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\@@_load_cjk_font_macos:} +% \begin{macro}{\@@_load_cjk_font_mac:} % macOS 字体。 -% TODO: 参考CTeX手册第9节 LuaLATEX 下的中文支持方式解决 issue \#5 问题。 +% TODO: 修复 macOS 字体支持,实现开箱即用。 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_cjk_font_macos: -{ - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} - \setCJKmainfont{Songti~SC~Light}[ - BoldFont=Songti~SC~Bold, - ItalicFont=Kaiti~SC, - BoldItalicFont=Kaiti~SC~Bold] - \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] - \setCJKmonofont{STFangsong} - \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] - \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] - \setCJKfamilyfont{zhfs}{STFangsong} - \setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold] - \setCJKfamilyfont{zhnewhei}{PingFang~SC} -} +\cs_new_protected:Npn \@@_load_cjk_font_mac: + { + % 移除 does not contain script "CJK" 警告 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + \setCJKmainfont{Songti~SC~Light}[ + BoldFont=Songti~SC~Bold, + ItalicFont=Kaiti~SC, + BoldItalicFont=Kaiti~SC~Bold] + \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] + \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKfamilyfont{zhfs}{STFangsong} + \setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold] + \setCJKfamilyfont{zhnewhei}{PingFang~SC} + } % \end{macrocode} % \end{macro} % -% % \begin{macro}{\@@_load_cjk_font_fandol:} % Fandol 字体 % \begin{macrocode} \cs_new_protected:Npn \@@_load_cjk_font_fandol: -{ - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} - \setCJKmainfont{FandolSong-Regular}[ - Extension=.otf, - BoldFont=FandolSong-Bold, - ItalicFont=FandolKai-Regular] - \setCJKsansfont{FandolHei-Regular}[ - Extension=.otf, - BoldFont=FandolHei-Bold] - \setCJKmonofont{FandolFang-Regular}[Extension=.otf] - \setCJKfamilyfont{zhsong}{FandolSong-Regular}[ - Extension=.otf, - BoldFont=FandolSong-Bold] - \setCJKfamilyfont{zhhei}{FandolHei-Regular}[ - Extension=.otf, - BoldFont=FandolHei-Bold] - \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] - \setCJKfamilyfont{zhkai}{FandolKai-Regular}[ - Extension=.otf, - AutoFakeBold=2.17] -} + { + % 移除 does not contain script "CJK" 警告 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + \setCJKmainfont{FandolSong-Regular}[ + Extension=.otf, + BoldFont=FandolSong-Bold, + ItalicFont=FandolKai-Regular] + \setCJKsansfont{FandolHei-Regular}[ + Extension=.otf, + BoldFont=FandolHei-Bold] + \setCJKmonofont{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhsong}{FandolSong-Regular}[ + Extension=.otf, + BoldFont=FandolSong-Bold] + \setCJKfamilyfont{zhhei}{FandolHei-Regular}[ + Extension=.otf, + BoldFont=FandolHei-Bold] + \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhkai}{FandolKai-Regular}[ + Extension=.otf, + AutoFakeBold=2.17] + } % \end{macrocode} % \end{macro} % % % \begin{macro}{\@@_load_cjk_font_founder:} % 方正字库(简繁扩展) -% FZYouHK_508R \href{http://www.foundertype.com/index.php/FontInfo/index/id/244}{方正悠黑508R} 设计师非商免费, -% FZYouHK_511M \href{http://www.foundertype.com/index.php/FontInfo/index/id/244}{方正悠黑511M} 设计师非商免费 % \begin{macrocode} \cs_new_protected:Npn \@@_load_cjk_font_founder: -{ - \sys_if_engine_luatex:T - { - % 在 LuaTeX 中调整方正字体括号位置 - % XeTeX 暂无好的解决方法 - \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} - } - \setCJKmainfont{FZSSK}[% 方正书宋 - Extension=.ttf, - BoldFont=FZXBSK,% 方正小标宋 - ItalicFont=FZKTK]% 方正楷体 - \setCJKsansfont{FZXH1K}[% 方正细黑一 - Extension=.ttf, - BoldFont=FZHTK]% FZHTK 方正黑体 - \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 - \setCJKfamilyfont{zhsong} - {FZSSK}[ + { + \sys_if_engine_luatex:T + { +% \end{macrocode} +% 在 LuaTeX 中调整方正字体括号位置 +% XeTeX 暂无好的解决方法 +% \begin{macrocode} + \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} + } + \setCJKmainfont{FZSSK}[% 方正书宋 Extension=.ttf, - BoldFont=FZXBSK] - \setCJKfamilyfont{zhhei} - {FZHTK}[ + BoldFont=FZXBSK,% 方正小标宋 + ItalicFont=FZKTK]% 方正楷体 + \setCJKsansfont{FZXH1K}[% 方正细黑一 Extension=.ttf, - AutoFakeBold=2.17] - \setCJKfamilyfont{zhfs} - {FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai} - {FZKTK}[Extension=.ttf] - % \setCJKfamilyfont{zhnewhei} - % {FZYouHK_508R}[% 方正悠黑508R - % Extension=.ttf, - % BoldFont=FZYouHK_511M]% 方正悠黑511M - \defaultCJKfontfeatures{} -} + BoldFont=FZHTK]% FZHTK 方正黑体 + \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 + \setCJKfamilyfont{zhsong} + {FZSSK}[ + Extension=.ttf, + BoldFont=FZXBSK] + \setCJKfamilyfont{zhhei} + {FZHTK}[ + Extension=.ttf, + AutoFakeBold=2.17] + \setCJKfamilyfont{zhfs} + {FZFSK}[Extension=.ttf] + \setCJKfamilyfont{zhkai} + {FZKTK}[Extension=.ttf] + \defaultCJKfontfeatures{} + } % \end{macrocode} % \end{macro} % @@ -1772,34 +2348,32 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % 思源字体。 % \begin{macrocode} \cs_new_protected:Npn \@@_load_cjk_font_noto: -{ - % 思源宋体 - \setCJKmainfont[ - UprightFont=NotoSerifSC-Regular, - BoldFont=NotoSerifSC-Bold, - ItalicFont=NotoSerifSC-Regular, - BoldItalicFont=NotoSerifSC-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Serif~SC} + { + % 思源宋体 + \setCJKmainfont[ + UprightFont=NotoSerifSC-Regular, + BoldFont=NotoSerifSC-Bold, + ItalicFont=NotoSerifSC-Regular, + BoldItalicFont=NotoSerifSC-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Serif~SC} - % 思源黑体 - \setCJKsansfont[ - UprightFont=NotoSansSC-Regular, - BoldFont=NotoSansSC-Bold, - ItalicFont=NotoSansSC-Regular, - BoldItalicFont=NotoSansSC-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Sans~SC} + % 思源黑体 + \setCJKsansfont[ + UprightFont=NotoSansSC-Regular, + BoldFont=NotoSansSC-Bold, + ItalicFont=NotoSansSC-Regular, + BoldItalicFont=NotoSansSC-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Sans~SC} - \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 + \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 - \setCJKfamilyfont{zhsong}{Noto~Serif~SC} - \setCJKfamilyfont{zhhei}{Noto~Sans~SC} - \setCJKfamilyfont{zhfs} - {FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai} - {FZKTK}[Extension=.ttf] -} + \setCJKfamilyfont{zhsong}{Noto~Serif~SC} + \setCJKfamilyfont{zhhei}{Noto~Sans~SC} + \setCJKfamilyfont{zhfs}{FZFSK}[Extension=.ttf] + \setCJKfamilyfont{zhkai}{FZKTK}[Extension=.ttf] + } % \end{macrocode} % \end{macro} % @@ -1808,17 +2382,18 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % 载入字体命令。 % \begin{macrocode} \cs_new_protected:Npn \@@_load_font: -{ - \use:c { @@_load_latin_font_ \g_@@_latin_fontset_tl : } - \use:c { @@_load_cjk_font_ \g_@@_cjk_fontset_tl : } + { + \use:c { @@_load_latin_font_ \g_@@_latin_font_tl : } + \use:c { @@_load_cjk_font_ \g_@@_cjk_font_tl : } % \end{macrocode} -% 自行定义C\hologo{TeX}中的四类字体命令。 +% 自行定义 C\hologo{TeX} 中的四类字体命令。 % \begin{macrocode} - \NewDocumentCommand\songti{}{\CJKfamily{zhsong}} - \NewDocumentCommand\heiti{}{\CJKfamily{zhhei}} - \NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}} - \NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}} -} + \NewDocumentCommand \songti { } { \CJKfamily{zhsong} } + \NewDocumentCommand \heiti { } { \CJKfamily{zhhei} } + \NewDocumentCommand \fangsong { } { \CJKfamily{zhfs} } + \NewDocumentCommand \kaishu { } { \CJKfamily{zhkai} } + \RenewDocumentCommand \large { } { \zihao{4} } + } % \end{macrocode} % % 载入设置的字体。 @@ -1834,7 +2409,8 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, \setmathfont{XITSMath-Regular}[ BoldFont = XITSMath-Bold, Extension = .otf] -\setmathfont{latinmodern-math.otf}[range={cal,bb,frak}] +\setmathfont{NewCMMath-Regular.otf}[range={cal,bb,frak}] +\setmathfont{NewCMMath-Regular.otf}[version=bold,range={bfcal}] % \end{macrocode} % % @@ -1844,185 +2420,167 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % % 使用\pkg{geometry}设置页边距。 % \begin{macrocode} -\geometry{ - vmargin = 2.5 cm, - hmargin = 3.2 cm, - headheight = 15 pt -} +\geometry + { + vmargin = 2.5 cm, + hmargin = 3.2 cm, + headheight = 15 pt + } % \end{macrocode} % % \subsubsection{页眉页脚} % -% % 本科生页眉页脚。要求无页眉,页脚居中,页码使用五号新罗马体数字。 % \begin{macrocode} -\fancypagestyle{njuplain}{ - \fancyhead{} - \fancyfoot[C]{\zihao{5}\thepage} -} +\fancypagestyle { plain } + { + \fancyhf { } + \fancyfoot [ C ] { \zihao{5} \thepage } + \RenewDocumentCommand \headrulewidth { } { 0 pt } + \RenewDocumentCommand \footrulewidth { } { 0 pt } + } % \end{macrocode} % -% -% TODO: 研究生页眉页脚 +% 研究生页眉页脚。页眉为横线,奇数页显示章名,偶数页显示节名;页脚为页码。 % \begin{macrocode} -\fancypagestyle{njuheadings}{% - \fancyhead{} - \fancyfoot[C]{\zihao{5}\thepage} -} +\fancypagestyle{headings} + { + \fancyhf { } + \fancyhead [ CO ] { \leftmark } + \fancyhead [ CE ] { \rightmark } + \fancyfoot [ C ] { \zihao{5} \thepage } + \RenewDocumentCommand \headrulewidth { } { 0.4 pt } + \RenewDocumentCommand \footrulewidth { } { 0 pt } + \setlength { \headheight } { 20 pt } + } % \end{macrocode} % -% 载入页眉页脚设置。此处\tn{flushbottom}是为了防止目录页出现underfull \tn{vbox}信息。 +% \begin{macro}{\frontmatter} +% 重定义 \cs{frontmatter},清空页眉页脚以及页码设置。 +% 此命令仅为解决原 \cls{book} 类中使用小写罗马字母序号的冲突,并不建议使用。 % \begin{macrocode} -\int_compare:nTF { \g_@@_info_degree_int == 1 } -{ - % the header line - \tl_set:Nn \headrulewidth {0pt} - % the footer line - \tl_set:Nn \footrulewidth {0pt} - \AtBeginDocument{\pagestyle{njuplain}\flushbottom} % 本科无页眉页脚 -} -{ - % the header line - \tl_set:Nn \headrulewidth {1pt} - % the footer line - \tl_set:Nn \footrulewidth {0pt} - \AtBeginDocument{\pagestyle{fancy}\flushbottom} % 研究生有页眉页脚 -} +\RenewDocumentCommand \frontmatter { } + { + \cleardoublepage + \pagestyle{empty} + \pagenumbering{Roman} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mainmatter} +% \changes{v0.12}{2021/12/03}{修复了摘要页字体格式泄漏到正文的问题。} +% \changes{v0.12}{2021/12/03}{修复了页眉上长标题重叠的问题。} +% 重定义 \cs{mainmatter},在论文主体部分载入页眉页脚设置,并重新进行数字编号。 +% \begin{macrocode} +\RenewDocumentCommand \mainmatter { } + { + \cleardoublepage + \int_compare:nTF { \l_@@_info_degree_int == 1 } + { \pagestyle{plain} } { \pagestyle{headings} } + \pagenumbering{arabic} + \normalfont\normalsize + } % \end{macrocode} +% \end{macro} % % \subsection{章节标题格式} % +% \begin{macro}{\c_@@_sec_format_tl} +% 各部分章节以及目录中章标题的格式。设置为四号、不加粗、黑体。 % \begin{macrocode} -\ctexset{ - chapter/format = \zihao{4}\heiti\centering\selectfont, - chapter/beforeskip = 10pt, - chapter/afterskip = 60pt, - section/format = \zihao{4}\heiti\raggedright\selectfont, - subsection/format = \zihao{4}\heiti\raggedright\selectfont, - subsubsection/format = \zihao{4}\heiti\raggedright\selectfont, -} +\tl_const:Nn \c_@@_sec_format_tl { \large \normalfont \sffamily } % \end{macrocode} +% \end{macro} % -% \subsection{目录格式} -% 设定目录标题名称。 % \begin{macrocode} -\ctexset{ - contentsname = 目录, - listfigurename = 插图清单, - listtablename = 表格清单, -} +\ctexset + { + chapter/beforeskip = 10 pt, + chapter/afterskip = 60 pt, + chapter/format = \centering \c_@@_sec_format_tl, + section/format = \c_@@_sec_format_tl, + subsection/format = \c_@@_sec_format_tl, + subsubsection/format = \c_@@_sec_format_tl + } % \end{macrocode} % -% 使用\pkg{tocloft}定制目录文字格式。 -% \begin{macrocode} -\cftsetpnumwidth{2em} -\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}} -\renewcommand{\cftchapdotsep}{\cftdotsep} -\renewcommand{\cftchapfont}{\heiti\zihao{4}} -\setlength{\cftsecindent}{2em} -\setlength{\cftsubsecindent}{52pt} -\setlength{\cftsubsecnumwidth}{2em} -% \end{macrocode} -% -% \begin{macro}{\tableofcontents} - % 重定义目录命令,修改标题格式并插入书签。 -% \begin{macrocode} -\renewcommand\tableofcontents{% - \cleardoublepage - \raggedbottom - \begingroup - \ctexset{ - contentsname = {目\hspace{2em}录}, - chapter/format = {\centering\songti\bf\zihao{3}\selectfont}, - }% - \chapter*{\contentsname}% - \endgroup - \addcontentsline{toc}{chapter}{\contentsname} - \vskip 20pt - \@starttoc{toc}% -} -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\listoffigures} -% 重定义插图目录命令,修改标题格式并插入书签。 +% \subsection{目录格式} +% \changes{v0.13}{2021/12/09}{删除 \pkg{tocloft},改用 \pkg{ctex} 内置的目录设置。} +% +% \begin{macro}{\@@_chapter_in_toc:n} +% 将无编号章插入目录。 % \begin{macrocode} -\renewcommand\listoffigures{% - \cleardoublepage - \begingroup - \ctexset{ - chapter/format = {\centering\songti\bf\zihao{3}\selectfont}, - }% - \chapter*{\listfigurename}% - \endgroup - \addcontentsline{toc}{chapter}{\listfigurename} - \vskip 20pt - \@starttoc{lof}% -} +\cs_new_protected:Npn \@@_chapter_in_toc:n #1 + { \addcontentsline { toc } { chapter } { \c_@@_sec_format_tl #1 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\listoftables} -% 重定义表格目录命令,修改标题格式并插入书签。 +% \begin{macro}{\njuchapter} +% 含有目录和 PDF 标签的无编号章。 % \begin{macrocode} -\renewcommand\listoftables{% - \cleardoublepage - \begingroup - \ctexset{ - chapter/format = {\centering\songti\bf\zihao{3}\selectfont}, - }% - \chapter*{\listtablename}% - \endgroup - \addcontentsline{toc}{chapter}{\listtablename} - \vskip 20pt - \@starttoc{lot}% -} +\NewDocumentCommand \njuchapter { m } + { + \chapter*{#1} + \addcontentsline { toc } { chapter } { \c_@@_sec_format_tl #1} + \@mkboth{#1}{#1} + } % \end{macrocode} % \end{macro} % -% \subsection{前言致谢} -% -% \begin{environment}{preface} -% 单独制作的前言页。 % \begin{macrocode} -\NewDocumentEnvironment{preface}{} -{% - \chapter*{前言} - \addcontentsline{toc}{chapter}{前言} -}{\cleardoublepage} +\ctexset + { % \end{macrocode} -% \end{environment} -% -% \begin{environment}{acknowledgement} -% 单独制作的致谢页。 +% 设置目录标题名称。 % \begin{macrocode} -\NewDocumentEnvironment{acknowledgement}{} -{% - \chapter*{致谢} - \addcontentsline{toc}{chapter}{致谢} -}{\cleardoublepage} + contentsname = {目\hspace{2em}录}, + listfigurename = {插图清单}, + listtablename = {表格清单}, +% \end{macrocode} +% 设置目录中章标题的样式。 +% \begin{macrocode} + chapter / tocline = \c_@@_sec_format_tl \CTEXnumberline {#1} #2 + } % \end{macrocode} -% \end{environment} % +% \begin{macro}{\c_@@_toc_title_tl} +% 目录页标题格式,单独设置为三号粗宋体。 +% \begin{macrocode} +\tl_const:Nn \c_@@_toc_title_tl { \centering \zihao{3} \bf } +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\njupaperlist} -% \changes{v0.10}{2021/09/29}{新增了成果列表页面。} -% 发表文章目录与合作文章目录。 +% \begin{macro}{\@@_modify_toc_title:nn} +% 通过 group 内修改标题设置,改变标题页字体。 % \begin{macrocode} -\NewDocumentCommand\njupaperlist { t* m } -{ - \begin{refsection} - \nocite{#2} - \IfBooleanTF {#1} - { \printbibliography[heading=subbibliography,title=合作文章目录] } - { \printbibliography[heading=subbibliography,title=发表文章目录] } - \end{refsection} +\cs_new_protected:Npn \@@_modify_toc_title:nn #1#2 +{ + \group_begin: + \ctexset { chapter/format = \c_@@_toc_title_tl } + \njuchapter { #1 } + \group_end: + \@starttoc{#2} } % \end{macrocode} % \end{macro} % +% \begin{macro}{\tableofcontents,\listoffigures,\listoftables} +% 重定义目录命令,修改标题格式并插入书签。 +% \begin{macrocode} +\RenewDocumentCommand \tableofcontents { } + { \@@_modify_toc_title:nn { \contentsname } { toc } } +\RenewDocumentCommand \listoffigures { } + { \@@_modify_toc_title:nn { \listfigurename } { lof } } +\RenewDocumentCommand \listoftables { } + { \@@_modify_toc_title:nn { \listtablename } { lot } } +% \end{macrocode} +% \end{macro} +% +% % \subsection{参考文献} -% +% % biblatex设置 % \begin{macrocode} \RequirePackage[ @@ -2052,154 +2610,161 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, ]{biblatex} % \end{macrocode} % +% \changes{v0.12}{2021/12/06}{设置输出参考文献的默认选项。} +% 设置参考文献名称 +% \begin{macrocode} +\ctexset{ bibname = {参考文献} } +% \end{macrocode} +% 修改参考文献的头部样式并插入目录。 +% \begin{macrocode} +\defbibheading { njubib } [ \bibname ] { \njuchapter { #1 } } +\DeclarePrintbibliographyDefaults { heading = njubib } +% \end{macrocode} +% % 忽略不需要的文献信息。 % \begin{macrocode} -\AtEveryBibitem{ - \clearfield{abstract} - \clearfield{issn} - \clearfield{isbn} - \clearfield{archivePrefix} - \clearfield{arxivId} - \clearfield{pmid} - \clearfield{eprint} - \ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} - % \ifentrytype{book}{\clearfield{doi}}{} -} +\AtEveryBibitem + { + \clist_map_inline:nn + { abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint } + { \clearfield { #1 } } + \ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} + } % \end{macrocode} % +% % \subsection{引用} -% -% 修改标签名称。默认在名称后面添加空格,删除公式编号的括号 -% \begin{macrocode} -\crefdefaultlabelformat{#2#1#3\,} - -\crefname{figure}{图}{图} -\crefname{table}{表}{表} -% \crefname{equation}{公式}{公式} -\crefformat{equation}{公式~#2#1#3~} - -\crefformat{chapter}{第#2#1#3章} -\crefformat{section}{第~#2#1#3~节} -\crefformat{subsection}{第~#2#1#3~小节} -\crefformat{subsubsection}{第~#2#1#3~小节} -\crefname{appendix}{附录}{附录} - -% \crefname{definition}{定义}{定义} -% \crefname{axiom}{公理}{公理} -% \crefname{property}{性质}{性质} -% \crefname{proposition}{命题}{命题} -% \crefname{lemma}{引理}{引理} -% \crefname{corollary}{推论}{推论} -% \crefname{remark}{注解}{注解} -% \crefname{condition}{条件}{条件} -% \crefname{conclusion}{结论}{结论} -% \crefname{assumption}{假设}{假设} -% \end{macrocode} -% -% \pkg{hyperref} +% +% \pkg{hyperref} 设置。 % \changes{v0.11}{2021/10/01}{写入PDF元数据。} % \begin{macrocode} \ctex_at_end_preamble:n -{ - \hypersetup - { - bookmarksnumbered = true, - psdextra = true, - unicode = true, + { +% \end{macrocode} +% 清除标题中用于手动换行的 |!| 控制符。 +% \begin{macrocode} + \tl_set_eq:NN \l_@@_tmp_tl \l_@@_info_title_tl + \tl_remove_all:Nn \l_@@_tmp_tl { ! } + \hypersetup + { + bookmarksnumbered = true, + psdextra = true, + unicode = true, + hidelinks, % \end{macrocode} % 填写 PDF 元信息。 % \begin{macrocode} - pdftitle = \l_@@_info_title_tl, - pdfauthor = \l_@@_info_author_tl, - pdfkeywords = \l_@@_info_keywords_clist, - pdfcreator = \c_@@_name_pdf_creator_tl - } -} + pdftitle = \l_@@_tmp_tl, + pdfauthor = \l_@@_info_author_tl, + pdfkeywords = \l_@@_info_keywords_clist, + pdfcreator = \c_@@_name_pdf_creator_tl + } + } +% \end{macrocode} +% +% \begin{macro}{\@@_cref_name:n,\@@_cref_name:N } +% 用于修改 \pkg{cleverref} 的标签名称的辅助函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cref_name:n #1 + { + \clist_map_inline:nn { #1 } + { \crefname { ##1 } { \@@_name:n { ##1 } } { \@@_name:n { ##1 _en } } } + } +\cs_new_protected:Npn \@@_cref_name:N #1 + { + \clist_map_inline:Nn #1 + { \crefname { ##1 } { \@@_name:n { ##1 } } { \@@_name:n { ##1 _en } } } + } +% \end{macrocode} +% \end{macro} +% +% 修改 \pkg{cleverref} 的标签格式。 +% 默认在名称后面添加空格,删除公式编号的括号。 +% \begin{macrocode} +\crefdefaultlabelformat{#2#1#3\,} +\crefformat { equation } { 公式~#2#1#3~ } +\crefformat { chapter } { 第#2#1#3章 } +\crefformat { section } { 第~#2#1#3~节 } +\crefformat { subsection } { 第~#2#1#3~小节 } +\crefformat { subsubsection } { 第~#2#1#3~小节 } +% \end{macrocode} +% +% 修改 \pkg{cleverref} 的标签名称。 +% \begin{macrocode} +\@@_cref_name:n { figure, table, appendix, proof } +\@@_cref_name:N \c_@@_theorem_type_clist % \end{macrocode} % +% % \subsection{图表浮动体} % % \subsubsection{图片表格} -% -% 图表位置调整 +% +% 设置默认图片扩展名,允许在不键入扩展名时自动进行补全。 % \begin{macrocode} -\floatsetup[figure]{ % Captions for figures - capposition=bottom,% - margins=centering,% - floatwidth=\textwidth% -} -\floatsetup[table]{ % Captions for tables - capposition=above,% - margins=centering,% - floatwidth=\textwidth% -} +\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} % \end{macrocode} % -% 图表标题样式 -% \begin{macrocode} -\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti} -\captionsetup{ - font=small,% - labelfont=songticap, - textfont=songticap, - strut=no,% - hypcap=true, % Links point to the top of the figure - % indention=0pt, % Suppress indentation - % % parindent=0pt, % Suppress space between paragraphs - aboveskip=6pt, % Increase the space between the figure and the caption - belowskip=6pt, % Increase the space between the caption and the table -} +% \changes{v0.12}{2021/12/06}{删除了可能导致冲突的 \pkg{floatrow}。} +% 图表标题样式。文字设置为五号宋体,标签设置为粗体,间隔一个全角空格。 +% \begin{macrocode} +\DeclareCaptionStyle{njucap} + { + font = small, + labelfont = bf, + labelsep = quad, + justification = centering + } +\captionsetup [ figure ] { style = njucap } +\captionsetup [ table ] { style = njucap } % \end{macrocode} % % -% \subsubsection{代码} +% \subsubsection{代码环境} % -% 代码样式 +% 使用 \pkg{listings} 设置代码环境基本样式。 % \begin{macrocode} -\floatsetup[lstlisting]{ % Captions for lstlistings - capposition=above,% - margins=centering,% - floatwidth=\textwidth% -} -\lstset{ - basicstyle=\ttfamily\linespread{1}\small\selectfont, - keywordstyle=\bfseries,% use bold style for keywords - commentstyle=\rmfamily\itshape,% use italic style for comments - stringstyle=\ttfamily,% 字符串风格 - flexiblecolumns,% ? - numbers=left,% left-aligned numbering - showspaces=false,% hide markers for spaces - showstringspaces=false, - captionpos=t,% place the caption at the top - % frame=lrtb,% show all four sides of the frame - % linewidth=.8\textwidth, - % breakatwhitespace=true, - breaklines=true, - xleftmargin=2em,xrightmargin=2em,% set the width of the code environment -} +\lstdefinestyle { njulisting } + { + basewidth = 0.5 em, + lineskip = 3 pt, + basicstyle = \tiny\tt, + keywordstyle = \bf, + commentstyle = \it\color{gray}, + numbers = left, + captionpos = t, + breaklines = true, + xleftmargin = 2 em, + xrightmargin = 2 em + } % \end{macrocode} % -% +% 设置代码环境通用样式。 % \begin{macrocode} -\lstdefinestyle{LaTeX}{ - language=TeX, - morekeywords={ - begin, caption, label, mathrm, frac, - toprule, midrule, bottomrule, includegraphics} -} +\lstset + { + style = njulisting, + flexiblecolumns + } % \end{macrocode} % -% -% \subsubsection{列表} -% -% 列表环境 +% \changes{v0.13}{2021/12/13}{提供简化的行内代码环境。} +% 上述调整会污染 \tn{lstinline} 的字体大小,因此单独设置用于生成行内代码的简略抄录环境。 +% 此处由于使用到了单独的字符,需要暂时关闭 \hologo{LaTeX3} 语法。 % \begin{macrocode} -\renewcommand{\labelitemi}{\tiny$\blacktriangleright$} -\renewcommand{\labelitemii}{\textbullet} - -\setlist[itemize]{noitemsep} -\setlist[enumerate]{noitemsep} -\setlist[description]{noitemsep} +\ExplSyntaxOff +\lstMakeShortInline[ + style=njulisting, + basicstyle=\normalsize\tt, + columns=fixed]| +\ExplSyntaxOn +% \end{macrocode} +% +% +% \subsubsection{列表环境} +% \changes{v0.12}{2021/12/07}{删除了 \pkg{enumitem} 的部分列表环境设置。} +% \begin{macrocode} +\setlist { noitemsep } % \end{macrocode} % % @@ -2212,724 +2777,799 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_new_theorem:N} +% 用于定义普通定理环境的辅助函数。 +% \begin{arguments} +% \item 定理名称列表,|clist| 型变量 +% \end{arguments} +% 除证明以外的环境都不需要证毕符号,在此清空其设置。 % \begin{macrocode} -\declaretheoremstyle[ - %spaceabove=.5\thm@preskip, - %spacebelow=.5\thm@postskip, - headfont=\bf\songti,%\scshape, - notefont=\songti,% notebraces={ (}{)}, - bodyfont=\songti, - %headformat={\NAME\space\NUMBER\space\NOTE}, - headpunct={}, - %postheadspace={.5em plus .1em minus .1em}, - %prefoothook={\hfill\qedsymbol} - ]{njuthm} - -\theoremstyle{njuthm} -% \end{macrocode} -% -% 修改证明环境标题 -% \begin{macrocode} -\let\oldproofname=\proofname -\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} -% \end{macrocode} -% -% TODO: 简化数学环境的定义方法 -% \begin{macrocode} -\declaretheorem[ - name=算法, - style=njuthm, - refname={算法,算法}, - Refname={算法,算法}, - % numberwithin=section, -]{algorithm} -\declaretheorem[ - name=假设, - style=njuthm, - refname={假设,假设}, - Refname={假设,假设}, - % numberwithin=section, -]{assumption} -\declaretheorem[ - name=公理, - style=njuthm, - refname={公理,公理}, - Refname={公理,公理}, - % numberwithin=section, -]{axiom} -\declaretheorem[ - name=结论, - style=njuthm, - refname={结论,结论}, - Refname={结论,结论}, - % numberwithin=section, -]{conclusion} -\declaretheorem[ - name=条件, - style=njuthm, - refname={条件,条件}, - Refname={条件,条件}, - % numberwithin=section, -]{condition} -\declaretheorem[ - name=推论, - style=njuthm, - refname={推论,推论}, - Refname={推论,推论}, - % numberwithin=section, -]{corollary} -\declaretheorem[ - name=定义, - style=njuthm, - refname={定义,定义}, - Refname={定义,定义}, - % numberwithin=section, -]{definition} -\declaretheorem[ - name=例, - style=njuthm, - refname={例,例}, - Refname={例,例}, - % numberwithin=section, -]{example} -\declaretheorem[ - name=引理, - style=njuthm, - refname={引理,引理}, - Refname={引理,引理}, - % numberwithin=section, -]{lemma} -\declaretheorem[ - name=性质, - style=njuthm, - refname={性质,性质}, - Refname={性质,性质}, - % numberwithin=section, -]{property} -\declaretheorem[ - name=命题, - style=njuthm, - refname={命题,命题}, - Refname={命题,命题}, - % numberwithin=section, -]{proposition} -\declaretheorem[ - name=注解, - style=njuthm, - refname={注解,注解}, - Refname={注解,注解}, - % numberwithin=section, -]{remark} -\declaretheorem[ - name=定理, - style=njuthm, - refname={定理,定理}, - Refname={定理,定理}, - numberwithin=section, -]{theorem} +\cs_new_protected:Npn \@@_new_theorem:N #1 + { + \theoremsymbol { } + \clist_map_inline:Nn #1 + { \newtheorem { ##1 } { \@@_name:n { ##1 } } } + } % \end{macrocode} +% \end{macro} +% +% 定义证明环境。证毕符号使用 \tn{mdlgwhtsquare}绘制,对应于 |U+25A1| 字符\footnote{\url{https://tex.stackexchange.com/questions/567135/how-get-box-like-symbol-with-xelatex}}。 +% \begin{macrocode} +\theoremsymbol { \ensuremath { \mdwhtsquare } } +\newtheorem* { proof } { \c_@@_name_proof_tl } +% \end{macrocode} +% +% 定义普通定理环境。 +% \begin{macrocode} +\@@_new_theorem:N \c_@@_theorem_type_clist +% \end{macrocode} +% % % \subsection{封面} % % \subsubsection{内部命令} -% 拼合标题 +% +% \begin{macro}{\@@_split_title:n} +% 分割标题。 % \begin{macrocode} -\tl_const:Nn \l_@@_info_title_tl -{ - \l_@@_info_title_a_tl - \l_@@_info_title_b_tl - \l_@@_info_title_c_tl -} +\cs_new_protected:Npn \@@_split_title:n #1 + { + \tl_if_in:VnTF { #1 } { ! } + { +% \end{macrocode} +% 从英文感叹号进行分割,存入 |clist|。 +% \begin{macrocode} + \seq_set_split:NnV \l_@@_tmp_seq { ! } { #1 } + \clist_set_from_seq:NN \l_@@_tmp_clist \l_@@_tmp_seq + } + { % \end{macrocode} +% 如果没找到感叹号,则手动进行分割固定宽度的字符。 +% \begin{macrocode} + \@@_put_inempty_seg:nnn { #1 } { 1 } { 15 } + \@@_put_inempty_seg:nnn { #1 } { 16 } { 15 } + \@@_put_inempty_seg:nnn { #1 } { 31 } { 15 } + } + } +% \end{macrocode} +% \end{macro} % -% \begin{variable}{\l_@@_info_supv_full_tl,\l_@@_info_supv_full_en_tl} -% 用于存储导师姓名加职称的变量,旧版编译器不支持字符串中含有|\hspace{.5em}|这样的空白空间命令 +% \begin{macro}{\@@_multiline_title:nnn} +% 生成多行标题。 +% \begin{arguments} +% \item 内容格式 +% \item 名称盒子宽度,|dim| 型变量 +% \item 内容盒子宽度,|dim| 型变量 +% \end{arguments} % \begin{macrocode} -\tl_new:N \l_@@_info_supv_full_tl -\tl_new:N \l_@@_info_supv_full_en_tl +\cs_new_protected:Npn \@@_multiline_title:nnn #1#2#3 + { + \@@_split_title:n { \l_@@_info_title_tl } + \@@_spread_box:nnn { #2 } { \kaishu } { \c_@@_name_title_tl } + \@@_hskip: + \clist_map_inline:Nn \l_@@_tmp_clist + { \@@_ulined_center_box:nn { #3 } { #1 ##1 } \@@_vskip: } + } % \end{macrocode} -% \end{variable} +% \end{macro} % -% 拼合双导师的姓名和职称。 +% \begin{macro}{\@@_cover_entry:nnn} +% 生成单项信息条目。 +% \begin{arguments} +% \item 条目 +% \item 名称盒子宽度,|dim| 型变量 +% \item 内容盒子宽度,|dim| 型变量 +% \end{arguments} % \begin{macrocode} -\tl_set:Nn \l_@@_info_supv_full_tl -{ - \l_@@_info_supv_a_tl\ - \l_@@_info_supv_a_title_tl\ \ - \l_@@_info_supv_b_tl\ - \l_@@_info_supv_b_title_tl -} -\tl_set:Nn \l_@@_info_supv_full_en_tl -{ - \l_@@_info_supv_a_title_en_tl\ - \l_@@_info_supv_a_en_tl\ \ - \l_@@_info_supv_b_title_en_tl\ - \l_@@_info_supv_b_en_tl -} +\cs_new_protected:Npn \@@_cover_entry:nnn #1#2#3 + { + \@@_spread_box:nnn { #2 } { \kaishu } { \@@_name:n { #1 } } + \@@_hskip: + \@@_ulined_center_box:nn { #3 } { \@@_info:n { #1 } } + \@@_vskip: + } % \end{macrocode} +% \end{macro} % -% \begin{variable}{\l_@@_name_degree_tl,\l_@@_name_degree_en_tl} -% 用于存储学位名称的变量 +% \begin{macro}{\@@_cover_bientry:nnnn} +% 生成两项信息条目,仅用于本科生封面。 +% \begin{arguments} +% \item 左侧条目 +% \item 右侧条目 +% \item 名称盒子宽度,|dim| 型变量 +% \item 内容盒子宽度,|dim| 型变量 +% \end{arguments} % \begin{macrocode} -\tl_new:N \l_@@_name_degree_tl -\tl_new:N \l_@@_name_degree_en_tl +\cs_new_protected:Npn \@@_cover_bientry:nnnn #1#2#3#4 + { + \@@_spread_box:nnn { #3 } { \kaishu } { \@@_name:n { #1 } } + \@@_hskip: + \@@_ulined_center_box:nn { #4 } { \@@_info:n { #1 } } + \skip_horizontal:n { 0.5 em } + \@@_spread_box:nnn { #3 } { \kaishu } { \@@_name:n { #2 } } + \@@_hskip: + \@@_ulined_center_box:nn { #4 } { \@@_info:n { #2 } } + \@@_vskip: + } % \end{macrocode} -% \end{variable} +% \end{macro} +% +% +% \subsubsection{绘制部件} % -% 判断学位进行命令定义 +% \begin{macro}{\@@_cover_title_ug:} +% 本科生封面标题。 % \begin{macrocode} -\int_compare:nTF { \g_@@_info_degree_int == 1 } -{ - % 本科 - \tl_const:Nn \c_@@_name_title_tl { 题\hfill 目 } - - \tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt } - \tl_const:Nn \c_@@_cover_uline_len_b_tl { 90pt } - \tl_const:Nn \c_@@_cover_uline_font_tl { \songti } - \tl_const:Nn \c_@@_cover_uline_style_tl { \bf } - \tl_const:Nn \c_@@_cover_uline_bskip_tl {} - - \tl_const:Nn \c_@@_cover_box_len_tl { 4.2em } - - % 本科强制不打印国家图书馆封面 - \bool_set_false:N \g_@@_nlcover_bool -} -{ - % 本科以外都是研究生 - \tl_const:Nn \c_@@_name_title_tl { 论\hfill 文\hfill 题\hfill 目 } - - \tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt } - \tl_const:Nn \c_@@_cover_uline_len_b_tl { 14em } - \tl_const:Nn \c_@@_cover_uline_font_tl { \kaishu } - \tl_const:Nn \c_@@_cover_uline_style_tl {} - \tl_const:Nn \c_@@_cover_uline_bskip_tl { \hspace{1em} } - - \tl_const:Nn \c_@@_cover_box_len_tl { 6em } -} +\cs_new_protected:Npn \@@_cover_title_ug: + { \@@_spread_box:nnn { 9em } { \bf } { \l_@@_info_type_tl } } % \end{macrocode} -% \begin{macro}{\@@_spread_box:nn} -% 来自\cls{fduthesis}:分散对齐的水平盒子。 +% \end{macro} +% +% \begin{macro}{\@@_cover_info_ug:nnn} +% 本科生封面信息栏。 % \begin{arguments} -% \item 宽度 -% \item 内容 +% \item 名称盒子宽度,|dim| 型变量 +% \item 长内容盒子宽度,|dim| 型变量 +% \item 短内容盒子宽度,|dim| 型变量 % \end{arguments} -% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip} -% 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。 -% |#2| 需要完全展开以避免 underfull 警告。 % \begin{macrocode} -\cs_generate_variant:Nn \tl_map_inline:nn { xn } -\cs_new_protected:Npn \@@_spread_box:nn #1#2 +\cs_new_protected:Npn \@@_cover_info_ug:nnn #1#2#3 { - \mode_leave_vertical: - \hbox_to_wd:nn {#1} - { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip } + \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \raggedleft + \@@_cover_entry:nnn { dept } { #1 } { #2 } + \@@_cover_entry:nnn { major } { #1 } { #2 } + \@@_multiline_title:nnn { \bf } { #1 } { #2 } + \@@_cover_bientry:nnnn { grade } { id } { #1 } { #3 } + \@@_cover_entry:nnn { author } { #1 } { #2 } + \@@_cover_bientry:nnnn { supv } { supv_ttl } { #1 } { #3 } + \tl_if_blank:VF { \l_@@_info_supv_ii_tl } + { \@@_cover_bientry:nnnn { supv_ii } { supv_ttl } { #1 } { #3 } } + \@@_cover_entry:nnn { sm_date } { #1 } { #2 } + \end{minipage} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_cover_uline_a:n} -% 在封面绘制下划线 +% \begin{macro}{\@@_cover_title_g:} +% 研究生封面标题。 % \begin{macrocode} -\cs_new:Npn \@@_cover_uline_a:n #1 -{ - \uline{\makebox[\c_@@_cover_uline_len_a_tl] - {\rm\c_@@_cover_uline_font_tl #1 }} -} -\cs_new:Npn \@@_cover_uline_b:n #1 -{ - \uline{\makebox[\c_@@_cover_uline_len_b_tl] - {\rm\c_@@_cover_uline_font_tl #1 }} -} -\cs_new:Npn \@@_cover_uline_nl:nn #1 #2 -{ - \uline{\makebox[#1] - {\rm\c_@@_cover_uline_font_tl #2 }} -} +\cs_new_protected:Npn \@@_cover_title_g: + { + \@@_spread_box:nnn { 9em } { } { \l_@@_info_type_tl } \@@_vskip: + \c_@@_name_degree_l_tl \l_@@_info_degree_tl \c_@@_name_degree_r_tl + } % \end{macrocode} % \end{macro} % -% -% \begin{macro}{\@@_cover_box:n} -% 封面表格边框 +% \begin{macro}{\@@_cover_info_g:nn} +% 研究生封面信息栏。 +% \begin{arguments} +% \item 名称盒子宽度,|dim| 型变量 +% \item 内容盒子宽度,|dim| 型变量 +% \end{arguments} % \begin{macrocode} -\cs_new:Npn \@@_cover_box:n #1 -{ - \makebox[\c_@@_cover_box_len_tl][s]{ - #1\c_@@_cover_uline_bskip_tl} -} +\cs_new_protected:Npn \@@_cover_info_g:nn #1#2 + { + \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \raggedleft + \@@_multiline_title:nnn { } { #1 } { #2 } + \clist_map_inline:nn { author, major, field, supv_full } + { \@@_cover_entry:nnn { ##1 } { #1 } { #2 } } + \end{minipage} + } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_cover_degree:} -% 学位类型。 +% \begin{macro}{\@@_cover_back_g:} +% 研究生封面背面信息。 % \begin{macrocode} -\cs_new_protected:Npn \@@_cover_degree: -{ - { (申请 } - \clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int } - { 学位) } -} +\cs_new_protected:Npn \@@_cover_back_g: + { + \@@_spread_box:nnn { 6.2 em } { \kaishu } { \c_@@_name_id_tl } + { : \@@_quad: } \l_@@_info_id_tl + \@@_vskip: + \@@_spread_box:nnn { 6.2 em } { \kaishu } { \c_@@_name_df_date_tl } + { : \@@_quad: } \l_@@_info_df_date_tl + \@@_vskip: + \@@_spread_box:nnn { 6.2 em } { \kaishu } { \c_@@_name_supv_full_tl } + { : \@@_quad: } \skip_horizontal:n { 8 em } \c_@@_name_sign_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_en_g:} +% 研究生英文封面。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_en_g: + { +% \end{macrocode} +% 标题。 +% \begin{macrocode} + \parbox { \textwidth } + { \centering \bf \sffamily \zihao { 2 } \l_@@_info_title_en_tl } + \skip_vertical:n { 1 cm } +% \end{macrocode} +% 作者。 +% \begin{macrocode} + \group_begin: \zihao { 4 } { by } \group_end: \@@_vskip: + \group_begin: + \bf \sffamily \zihao { 4 } \l_@@_info_author_en_tl + \group_end: \skip_vertical:n { 1 cm } +% \end{macrocode} +% 导师。 +% \begin{macrocode} + \group_begin: \zihao { 4 } { Supervised~ by } \group_end: \@@_vskip: + \group_begin: + \sffamily \zihao { 4 } \l_@@_info_supv_full_en_tl + \group_end: \vfill +% \end{macrocode} +% 学位信息。 +% \begin{macrocode} + \c_@@_cover_en_text_tl \@@_vskip: + \textsc { \clist_item:Nn \c_@@_name_degree_en_clist + { \l_@@_info_degree_int } } + \@@_vskip: { in } \@@_vskip: + \l_@@_info_major_en_tl \skip_vertical:n { 1 cm } +% \end{macrocode} +% 校徽。 +% \begin{macrocode} + \njuemblem [ black ] { ! } { 2.5 cm } \@@_vskip: + \l_@@_info_dept_en_tl \\ \c_@@_name_nju_en_tl + \skip_vertical:n { 1 cm } +% \end{macrocode} +% 提交日期。 +% \begin{macrocode} + \l_@@_info_sm_date_en_tl + } % \end{macrocode} % \end{macro} % -% \subsubsection{封面组件} +% \begin{macro}{\@@_cover_top_nl:} +% 国家图书馆封面顶部信息。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_top_nl: + { + \@@_spread_box:nnn { 3.2 em } { } { \c_@@_name_clc_tl } \@@_hskip: + \@@_ulined_center_box:nn { 9 em } { \l_@@_info_clc_tl } \hfill + \@@_spread_box:nnn { 3.2 em } { } { \c_@@_name_seclv_tl } \@@_hskip: + \@@_ulined_center_box:nn { 9 em } { \l_@@_info_seclv_tl } \\ + \@@_spread_box:nnn { 3.2 em } { } { \c_@@_name_udc_tl } \@@_hskip: + \@@_ulined_center_box:nn { 9 em } { \l_@@_info_udc_tl } \hfill \null + } +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\@@_cover_title_breakline:} -% 对标题进行自动判断,如果某行标题空则不输出接下来的若干行,得到多行标题。 +% \begin{macro}{\@@_cover_title_nl:} +% 国家图书馆封面标题。 % \begin{macrocode} -\cs_new_protected:Npn \@@_cover_title_breakline: -{ - \@@_cover_box:n {\c_@@_name_title_tl} - & \@@_cover_uline_a:n - { \c_@@_cover_uline_style_tl \l_@@_info_title_a_tl } \\ - \tl_if_empty:NF \l_@@_info_title_b_tl +\cs_new_protected:Npn \@@_cover_title_nl: { - \tl_if_empty:NTF \l_@@_info_title_c_tl - { - & \@@_cover_uline_a:n - {\c_@@_cover_uline_style_tl \l_@@_info_title_b_tl } \\ - } - { - & \@@_cover_uline_a:n - { \c_@@_cover_uline_style_tl \l_@@_info_title_b_tl } \\ - & \@@_cover_uline_a:n - { \c_@@_cover_uline_style_tl \l_@@_info_title_c_tl } \\ - } + \noindent \kaishu \zihao { -0 } \skip_vertical:n { -1 cm } + \@@_spread_box:nnn { 6 em } { } { \c_@@_name_title_tl } + \@@_vskip: \zihao { 1 } + \@@_split_title:n { \l_@@_info_title_tl } + \@@_multiline_box:nnnn { \l_@@_tmp_int } \l_@@_tmp_clist { 3 } { 15 em } + \@@_vskip: \zihao{4} \c_@@_name_title_nl_tl + \@@_vskip: \zihao{1} + \@@_ulined_center_box:nn { 4.5 em } { \l__nju_info_author_tl } + \@@_vskip: \zihao{4} { ( } \c_@@_name_author_tl { ) } } -} % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_print_covertab:} -% 封面信息栏 -% \begin{macrocode} -\cs_new_protected:Npn \@@_print_covertab: -{% -\int_compare:nTF { \g_@@_info_degree_int == 1 } - { - \begin{tabular}{p{4.2em}c} - \@@_cover_box:n {院\hfill 系} - & \@@_cover_uline_a:n {\l_@@_info_dept_tl} \\ - \@@_cover_box:n {专\hfill 业} - & \@@_cover_uline_a:n {\l_@@_major_tl} \\ - \@@_cover_title_breakline: - \end{tabular}\\ - - \begin{tabular}{p{4.2em}cp{4.2em}c} - \@@_cover_box:n {年\hfill 级} - & \@@_cover_uline_b:n {\l_@@_info_grade_tl} - & \@@_cover_box:n {学\hfill 号} - & \@@_cover_uline_b:n {\l_@@_info_id_tl}\\ - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \@@_cover_box:n {学\hfill 生\hfill 姓\hfill 名} - & \@@_cover_uline_a:n {\l_@@_info_author_tl} - \end{tabular}\\ - \begin{tabular}{p{4.2em}cp{4.2em}c} - \@@_cover_box:n {导\hfill 师} - & \@@_cover_uline_b:n {\l_@@_info_supv_a_tl} - & \@@_cover_box:n {职\hfill 称} - & \@@_cover_uline_b:n {\l_@@_info_supv_a_title_tl}\\ - - % 第二导师 - \tl_if_empty:NF \l_@@_info_supv_b_tl - { - \@@_cover_box:n {第\hfill 二\hfill 导\hfill 师} - & \@@_cover_uline_b:n {\l_@@_info_supv_b_tl} - & \@@_cover_box:n {职\hfill 称} - & \@@_cover_uline_b:n {\l_@@_info_supv_b_title_tl}\\ - } - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \@@_cover_box:n {提\hfill 交\hfill 日\hfill 期} - & \@@_cover_uline_a:n {\l_@@_submit_date_tl}\\ - \end{tabular} - } - { - \begin{tabular}{p{6em}c} - \@@_cover_title_breakline: - \@@_cover_box:n {作\hfill 者\hfill 姓\hfill 名} - & \@@_cover_uline_a:n {\@@_spread_box:nn {4em}{\l_@@_info_author_tl}}\\ - \@@_cover_box:n {专\hfill 业\hfill 名\hfill 称} - & \@@_cover_uline_a:n {\l_@@_major_tl}\\ - \@@_cover_box:n {研\hfill 究\hfill 方\hfill 向} - & \@@_cover_uline_a:n {\l_@@_field_tl}\\ - \@@_cover_box:n {指\hfill 导\hfill 教\hfill 师} - & \@@_cover_uline_a:n {\l_@@_info_supv_full_tl}\\ - \end{tabular} - } -} +% \begin{macro}{\@@_cover_info_nl:} +% 国家图书馆封面信息栏。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_info_nl: + { + \@@_uline_entry:nnnn \l_@@_tmp_dim { supv_info } { supv } { } \\ + \@@_ulined_center_box:nn { \textwidth } { \@@_info:n { supv_ttl } + \@@_quad: \@@_info:n { supv_cont } } \\ + \@@_uline_bientry:nnnn \l_@@_tmp_dim { degree } { degree } { } + \@@_uline_bientry:nnnn \l_@@_tmp_dim { major_nl } { major } { } \\ + \@@_uline_bientry:nnnn \l_@@_tmp_dim { sm_date } { sm_date } { } + \@@_uline_bientry:nnnn \l_@@_tmp_dim { df_date } { df_date } { } \\ + \@@_full_uline:Nn \l_@@_tmp_dim { \c_@@_name_confer_tl } + \@@_uline:n { \l_@@_tmp_dim } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_bottom_nl:} +% 国家图书馆封面底部信息。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_bottom_nl: + { + \@@_name:n { chairman } \@@_hskip: + \@@_ulined_center_box:nn { 9 em } { \@@_info:n { chairman } } \\ + \@@_name:n { reviewer } \@@_hskip: + \@@_multiline_box:nnnn { \l_@@_tmp_int } + { \l_@@_info_reviewer_clist } { 4 } { 9 em } + } % \end{macrocode} % \end{macro} % -% % % \subsubsection{绘制封面} % -% -% \begin{macro}{\@@_print_cover_nl:} -% 按需绘制国家图书馆封面,修改自胡海星模板 +% \begin{macro}{\@@_make_cover_ug:} +% \changes{v0.13}{2021/12/10}{使用 \hologo{LaTeX3} 语法重构本科生封面。} +% 生成本科生封面。 % \begin{macrocode} -\cs_new_protected:Npn \@@_print_cover_nl: -{ - \thispagestyle{empty} - \pdfbookmark[0]{国家图书馆封面}{nl} - { - % 顶端 - \noindent\null\vskip -20mm \hskip -15mm - \songti\zihao{-4} - \makebox[40pt][l]{分类号} - \@@_cover_uline_b:n {\l_@@_info_clc_tl} - \hfill - \makebox[40pt][l]{密级} - \@@_cover_uline_b:n {\l_@@_info_seclv_tl} - \vskip 10pt \hskip -15mm - \makebox[40pt][l]{udc} - \@@_cover_uline_b:n {\l_@@_info_udc_tl} +\cs_new_protected:Npn \@@_make_cover_ug: + { + \newpage +% \end{macrocode} +% 校徽、校名。 +% \begin{macrocode} + \null \skip_horizontal:n { -1 cm } + \njuemblem [ black] { ! } { 3.35 cm } + \begin{center} + \njuname[black]{!}{3cm} \@@_vskip: +% \end{macrocode} +% 学位信息。 +% \begin{macrocode} + \group_begin: \zihao { -1 } \@@_cover_title_ug: \group_end: + \skip_vertical:n { 1.5 cm } \vfil +% \end{macrocode} +% 信息栏。 +% \begin{macrocode} + \zihao{3} \@@_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em } \vfil + \end{center} } - - % 中部 - \vskip\stretch{2} - \begin{center} - \def\ULthickness{1pt} - {\kaishu\zihao{-0} 学\hspace{0.5em}位\hspace{0.5em}论\hspace{0.5em}文} - { - \kaishu\zihao{1} - \vskip \stretch{1} - \@@_cover_uline_b:n {\l_@@_info_title_a_tl}\\ - \@@_cover_uline_b:n {\l_@@_info_title_b_tl}\\ - \@@_cover_uline_b:n {\l_@@_info_title_c_tl}\\ - } - \vskip \stretch{1} - {\kaishu\zihao{4}(题名和副题名)} - \vskip \stretch{1} \vskip 5mm - {\kaishu\zihao{1}\uline{\makebox{\l_@@_info_author_tl}}} - \vskip \stretch{1} - {\kaishu\zihao{4}(作者姓名)} - \end{center} - - % 底部 - \vskip\stretch{1}\kaishu\zihao{4} - \noindent 指导教师姓名、职务、职称、学位、单位名称及地址% - \@@_cover_uline_nl:nn {94pt}{\l_@@_info_supv_a_tl}\par - \noindent \@@_cover_uline_nl:nn {\textwidth}{% - \l_@@_info_supv_cont_tl}\par - \noindent 申请学位级别% - \@@_cover_uline_nl:nn {9em}{\l_@@_name_degree_tl}% - \noindent 专业名称% - \uline{\hfill\l_@@_major_tl\hfill}\par - \noindent 论文提交日期% - \@@_cover_uline_nl:nn {9em}{\l_@@_submit_date_tl}% - \noindent 论文答辩日期% - \uline{\hfill\l_@@_defend_date_tl\hfill}\par - \noindent 学位授予单位和日期\uline{\hfill}\par - \begin{flushright} - 答辩委员会主席: - \@@_cover_uline_nl:nn {9em}{ \l_@@_info_chairman_tl }\par - 评阅人: - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {1} }\par - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {2} }\par - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {3} }\par - \@@_cover_uline_nl:nn {9em} - { \clist_item:Nn \l_@@_info_reviewer_clist {4} }\par - \end{flushright} - \begin{center} - \kaishu\zihao{3}\hspace{2em} 年\hspace{1em} 月\hspace{1em} 日 - \end{center} - \vskip -10mm - \cleardoublepage -} % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_print_cover_ug:} -% 本科封面 +% \begin{macro}{\@@_make_cover_g:} +% \changes{v0.13}{2021/12/11}{使用 \hologo{LaTeX3} 语法重构研究生封面。} +% 生成研究生封面。 % \begin{macrocode} -\cs_new_protected:Npn \@@_print_cover_ug: -{ - \thispagestyle{empty} - \pagenumbering{Roman} - % Start - \pdfbookmark{封面}{cover} % 将封面插入pdf书签 - \begin{spacing}{1.25} - \noindent\null\hspace{-10mm} - \njuemblem{!}{3cm}\smallskip - \begin{center} - \njuname{!}{3.35cm} - \vskip 10mm - {\zihao{1}\bf\songti\@@_spread_box:nn {9em}{本科毕业论文}} - \vfill - \vskip\stretch{0} - {\bgroup - \kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - % 绘制信息框 - \@@_print_covertab: - \egroup} - \vfill - \end{center} - \end{spacing} - \cleardoublepage -} +\cs_new_protected:Npn \@@_make_cover_g: + { + \newpage + \begin{center} +% \end{macrocode} +% 校徽、校名。 +% \begin{macrocode} + \null \skip_vertical:n { 1 cm } + \njuemblem [ black ] { ! } { 1.9 cm } \skip_vertical:n { 0.5 cm } + \njuname [ black ] { 4.4 cm } { ! } \@@_vskip: +% \end{macrocode} +% 学位信息。 +% \begin{macrocode} + \group_begin: + \zihao { -1 } \bf \kaishu \@@_cover_title_g: + \group_end: + \skip_vertical:n { 3 cm } \vfil +% \end{macrocode} +% 信息栏。 +% \begin{macrocode} + \group_begin: + \zihao { 3 } \kaishu + \@@_cover_info_g:nn { 6.2 em } { 18 em } \vfil + \skip_vertical:n { 2 cm } \l_@@_info_sm_date_tl + \group_end: + \end{center} +% \end{macrocode} +% 背面。格式存在变化,没有使用循环来简化。 +% \begin{macrocode} + \newpage + \noindent \null \skip_vertical:n { 18 cm } + \group_begin: + \zihao { 3 } \kaishu \@@_cover_back_g: + \group_end: +% \end{macrocode} +% 英文封面。 +% \begin{macrocode} + \newpage + \noindent \null \skip_vertical:n { 2 cm } + \begin{center} + \@@_cover_en_g: + \end{center} + } % \end{macrocode} % \end{macro} % -% -% \begin{macro}{\@@_print_cover_g:} -% 研究生封面 +% \begin{macro}{\@@_make_cover_nl:} +% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构国家图书馆封面。} +% 生成研究生的国家图书馆封面。 % \begin{macrocode} -\cs_new_protected:Npn \@@_print_cover_g: -{ - \thispagestyle{empty} - \pagenumbering{Roman} - % Start - \pdfbookmark{封面}{cover} % 将封面插入pdf书签 - \begin{spacing}{1.25} - \begin{center} - \noindent\null\vskip 5mm - \njuemblem{!}{1.9cm} - \vskip 10mm - \njuname{4.4cm}{!} - \par\vskip -2mm - \njuname*{4.4cm}{!} - \vskip 15mm - \bgroup - \zihao{1}\bf\kaishu - \@@_spread_box:nn {10em}{研究生毕业论文} - \vskip 5mm - \@@_cover_degree: - \egroup - \par\vfill\vskip\stretch{0} - \bgroup - \bf\kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - \vskip 10mm - \@@_print_covertab: - \egroup - \vfill - \vskip 10mm - \bf\kaishu\zihao{4}\l_@@_submit_date_tl - \vskip 15mm - \end{center} - \end{spacing} - - \newpage % 封面背面 - \thispagestyle{empty} - \begin{spacing}{1.625} - % TODO: 等待调整格式 - \null\vfill - {\bgroup - \kaishu\zihao{3} - \makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\l_@@_info_id_tl} - \par - \makebox[6em][s]{\bf\kaishu 论文答辩日期}:\l_@@_defend_date_tl - \par - \makebox[6em][s]{\bf\kaishu 指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字) - \par - \egroup} - \vskip 15mm - \end{spacing} - \cleardoublepage - -% 研究生英文封面 - \thispagestyle{empty} - \pdfbookmark{英文封面}{cover-en} % 将封面插入pdf书签 - \begin{center} - \noindent\vspace*{20pt} - \bf\sffamily\zihao{2}\l_@@_info_title_en_tl - \vskip \stretch{1} - \normalfont\rmfamily\zihao{4}{by} - \vskip 3pt - \bf\sffamily\zihao{4}\l_@@_info_author_en_tl - \vskip\stretch{1} - \normalfont\rmfamily\zihao{4}{Supervised~by} - \vskip 3pt - \normalfont\sffamily\zihao{4} - \l_@@_info_supv_a_title_en_tl - \hspace{.5em}\l_@@_info_supv_a_en_tl\\ - \l_@@_info_supv_b_title_en_tl - \hspace{.5em}\l_@@_info_supv_b_en_tl - \vskip\stretch{1} - \normalsize\rmfamily{ - A~dissertation~submitted~to\\ - the~graduate~school~of~Nanjing~University\\ - in~partial~fulfilment~of~the~requirements~for~the~degree~of\\ - \textsc{ - \clist_item:Nn \c_@@_name_degree_en_clist { \g_@@_info_degree_int } - }\\ - in\\ - {\l_@@_major_en_tl} - } - \vskip\stretch{2} - \njuemblem{2.5cm}{!}\par - \vskip 3mm - \normalfont\l_@@_info_dept_en_tl\\ - {Nanjing~University} - \vskip 30pt - \normalfont\normalsize\l_@@_submit_date_en_tl - \end{center} - \normalfont - \cleardoublepage -} +\cs_new_protected:Npn \@@_make_cover_nl: + { + \pdfbookmark [ 0 ] { 国家图书馆封面 } { nlcover } + \noindent \null +% \end{macrocode} +% 顶部,包括密级、分类号、UDC。 +% \begin{macrocode} + \begin{center} + \zihao{ -4 } \skip_vertical:n { -2 cm } + \@@_cover_top_nl: + \end{center} +% \end{macrocode} +% 标题。 +% \begin{macrocode} + \begin{center} + \skip_vertical:n { -2 cm } + \@@_cover_title_nl: + \end{center} +% \end{macrocode} +% 中部信息栏。 +% \begin{macrocode} + \group_begin: + \kaishu \zihao { 4 } \noindent \@@_cover_info_nl: + \group_end: +% \end{macrocode} +% 底部答辩信息。 +% \begin{macrocode} + \begin{flushright} + \@@_cover_bottom_nl: + \end{flushright} + \begin{center} + \kaishu \zihao{3} \@@_qquad: 年 \@@_quad: 月 \@@_quad: 日 + \end{center} + \skip_vertical:n { -1 cm } + } % \end{macrocode} % \end{macro} % -% +% \begin{macro}{\@@_make_orig_decl: } +% 生成学位论文原创性声明。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_make_orig_decl: + { + \normalfont \normalsize + \chapter* { \c_@@_name_nju_tl \c_@@_name_orig_decl_tl } + \thispagestyle { empty } + \c_@@_orig_decl_text_tl + \vfil + \begin{flushright} + \@@_name:n { orig_sign } \@@_uline:n { 7 em } \@@_vskip: + \@@_name:n { orig_date } \@@_uline:n { 7 em } + \end{flushright} + \vfil + } +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{用户接口} +% % \begin{macro}{\maketitle} -% 重定义maketitle生成封面 +% \changes{v0.12}{2021/12/01}{仅会生成国家图书馆封面或者普通封面之一。} +% \changes{v0.13}{2021/12/12}{重新绘制封面。} +% 重定义 \cs{maketitle} 以生成封面。 +% 如果选择了 |nlcover|,就生成用于申请学位的国家图书馆封面和原创性声明,反之生成普通封面。 % \begin{macrocode} -\tl_set:Nn \maketitle -{ - \bool_if:NT \g_@@_nlcover_bool { \@@_print_cover_nl: } % 国家图书馆封面 - \use:c { @@_print_cover_ \g_@@_info_diploma_tl : } -} +\RenewDocumentCommand \maketitle { } + { + \pagestyle{empty} + \bool_if:NTF \g_@@_nlcover_bool + { \@@_make_cover_nl: \@@_make_orig_decl: } + { \use:c { @@_make_cover_ \l_@@_info_diploma_tl : } } +% \end{macrocode} +% 生成封面后清除标题中的换行控制符。 +% \begin{macrocode} + \tl_remove_all:Nn \l_@@_info_title_tl { ! } +% \end{macrocode} +% 在标题页后使用大写罗马字母页码,恢复正常字体设置。 +% \begin{macrocode} + \cleardoublepage + \pagestyle{plain} + \pagenumbering{Roman} + \normalfont \normalsize + } % \end{macrocode} % \end{macro} % -% \subsection{摘要绘制} % -% \begin{macro}{\@@_print_keywords:,\@@_print_keywords_en:} -% 中英文关键词 +% \subsection{摘要页} +% +% \subsubsection{内部命令} +% +% \begin{macro}{\@@_abs_title_uuline:n} +% 摘要标题双层下划线格式。 +% \begin{arguments} +% \item 宽度,|dim| 型变量 +% \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_print_keywords: -{ - \par\vspace{2ex} - \bgroup - \noindent - \c_@@_name_keywords_tl - \clist_use:Nn \l_@@_info_keywords_clist {;} - \par - \egroup -} -\cs_new_protected:Npn \@@_print_keywords_en: -{ - \par\vspace{2ex} - \bgroup - \noindent - \c_@@_name_keywords_en_tl\hspace{0.5em} - \clist_use:Nn \l_@@_info_keywords_en_clist {;} - \par - \egroup -} +\cs_new_protected:Npn \@@_abs_title_uuline:n #1 + { \bf \kaishu \zihao { -2 } \@@_uuline:n { #1 } } % \end{macrocode} % \end{macro} % -% -% \begin{macro}{\@@_print_abstract_ug:,\@@_print_abstract_en_ug:} -% 输出本科摘要格式。 +% \begin{macro}{\@@_abs_info_style:n,\@@_abs_info_style_en:n} +% 摘要信息栏通用格式,设置为无缩进、四号或者小四号、楷书。 +% \begin{arguments} +% \item 字号 +% \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_print_abstract_ug: -{ - \thispagestyle{plain} - \pdfbookmark[0]{中文摘要}{abstract-zh} - \begin{center} - \kaishu\zihao{-2}{\textbf{ - \uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}} - \end{center} - \bgroup - \noindent\kaishu\zihao{-4} - 题目: \l_@@_info_title_tl \\ - 院系: \l_@@_info_dept_tl \\ - 专业: \l_@@_major_tl \\ - 本科生姓名: \l_@@_info_author_tl \\ - 指导教师(姓名、职称):\l_@@_info_supv_full_tl \\ - 摘要: - \egroup - \kaishu\zihao{-4}\par% -} -\cs_new_protected:Npn \@@_print_abstract_en_ug: -{ - \thispagestyle{plain} - \pdfbookmark[0]{英文摘要}{abstract-en} - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{ - 南京大学本科生毕业论文(设计、作品)英文摘要}}} - \end{center} - { - \bgroup - THESIS: ~~\l_@@_info_title_en_tl \\ - DEPARTMENT: ~~\l_@@_info_dept_en_tl \\ - SPECIALIZATION: ~~\l_@@_major_en_tl \\ - UNDERGRADUATE:~~\l_@@_info_author_en_tl \\ - MENTOR:~~\l_@@_info_supv_full_en_tl \\ - ABSTRACT: - \egroup - } - \zihao{-4}\par% -} +\cs_new_protected:Npn \@@_abs_info_style:n #1 + { \noindent \zihao{ #1 } \kaishu } +\cs_new_protected:Npn \@@_abs_info_style_en: #1 { \zihao{ #1 } } % \end{macrocode} % \end{macro} % -% -% \begin{macro}{\@@_print_abstract_g:,\@@_print_abstract_en_g:} -% 输出研究生摘要格式。 +% \begin{macro}{\@@_abs_bookmark:n} +% 生成摘要的 PDF 书签。 +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \item 关键词分隔符 +% \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_print_abstract_g: -{ - \thispagestyle{plain} - \pdfbookmark[0]{中文摘要}{abstract-zh} - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{ - 南京大学研究生毕业论文中文摘要首页用纸}}} - \end{center} - \bgroup - \noindent\kaishu\zihao{4} - 毕业论文题目:\hspace{0.5em}\njuline{\l_@@_info_title_tl\hfill}\\ - \njuline{\makebox[11em]{\l_@@_major_tl}}专业 - \njuline{\makebox[4em]{\l_@@_info_grade_tl}}级 - \int_compare:nTF { \g_@@_info_degree_int == 4} { 博 } { 硕 } - 士生姓名:\njuline{\hfill\l_@@_info_author_tl\hfill}\\ - 指导教师(姓名、职称):\njuline{\hfill\l_@@_info_supv_full_tl\hfill}\par - \egroup - \kaishu\zihao{4}\par% -} -\cs_new_protected:Npn \@@_print_abstract_en_g: -{ - \thispagestyle{plain} - \pdfbookmark[0]{英文摘要}{abstract-en} - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{ - 南京大学研究生毕业论文英文摘要首页用纸}}} - \end{center} - { - \bgroup - \zihao{4} - THESIS: ~~\l_@@_info_title_en_tl \\ - SPECIALIZATION: ~~\l_@@_major_en_tl \\ - POSTGRADUATE:~~\l_@@_info_author_en_tl \\ - MENTOR:~~\l_@@_info_supv_full_en_tl\par - \egroup - } - \zihao{4}\par% -} +\cs_new_protected:Npn \@@_abs_bookmark:n #1 + { + \pdfbookmark [ 0 ] + { \@@_name:n { abstract #1 } } { abstract #1 } + } +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{绘制部件} +% +% \begin{macro}{\@@_abs_title_ug:n} +% 绘制本科生摘要标题。 +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \end{arguments} +% \begin{macrocode} +\cs_generate_variant:Nn \clist_map_inline:nn { Vn } +\cs_new_protected:Npn \@@_abs_title_ug:n #1 + { + \@@_name:n { nju } \@@_name:n { type } + \@@_name:n { lang #1 } \@@_name:n { abstract } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_abs_info_ug:nn} +% 绘制本科生摘要信息栏。 +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \item 分隔符 +% \end{arguments} +% 本科生摘要页面不含下划线,因而不用确定文本宽度,绘制命令较为简单。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_abs_info_ug:nn #1#2 + { +% \end{macrocode} +% 确定标题类型。 +% \begin{macrocode} + \tl_if_blank:eTF { #1 } + { \c_@@_name_title_tl } + { \clist_item:Nn \c_@@_name_type_en_clist { \l_@@_info_type_int } } + #2 \tl_use:c { l_@@_info_title #1 _tl } \\ +% \end{macrocode} +% 由于作者姓名使用的字样发生了变动,这里进行替换以便嵌入循环。 +% \begin{macrocode} + \tl_set_eq:NN \c_@@_name_author_tl \c_@@_name_author_full_tl +% \end{macrocode} +% 使用循环输出院系、专业、作者、导师信息。 +% \begin{macrocode} + \clist_map_inline:nn { dept, major, author, supv_full } + { \@@_name:n { ##1 #1 } #2 \@@_info:n { ##1 #1 } \\ } + \@@_name:n { abstract #1 } #2 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_abs_title_g:n} +% 绘制研究生摘要标题。 +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_abs_title_g:n #1 + { + \@@_name:n { nju } \@@_info:n { type } + \@@_name:n { lang #1 } \@@_name:n { abstract_r } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_abs_info_g:nn} +% 绘制研究生摘要信息栏。 +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \item 分隔符 +% 研究生摘要页包括下划线以及若干特殊的对齐方式,实现方式较为繁琐。 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_abs_info_g:nn #1#2 + { + \tl_if_blank:eTF { #1 } + { +% \end{macrocode} +% 中文摘要环境,使用 \cs{@@_full_uline:NV} 确定内容宽度后,调用 \cs{@@_uline:n} 或 \cs{@@_ulined_center_box:nn} 命令以绘制横穿页面的下划线。前两行为标题。 +% \begin{macrocode} + \@@_full_uline:NV \l_@@_tmp_dim + { + \clist_item:Nn \c_@@_name_type_clist { \l_@@_info_type_int } + \c_@@_name_title_s_tl #2 + } + \@@_ulined_center_box:nn { \l_@@_tmp_dim } + { \tl_range:Nnn \l_@@_info_title_tl { 1 } { 20 } } \\ + \@@_uline:n { \textwidth } \@@_qquad: + \tl_range:Nnn \l_@@_info_title_tl { 21 } { -1 } \\ +% \end{macrocode} +% 专业、年级、姓名。 +% \begin{macrocode} + \@@_full_uline:NV \l_@@_tmp_dim + { + \@@_ulined_center_box:nn { 11 em } { \l_@@_info_major_tl } + \c_@@_name_major_s_tl + \@@_ulined_center_box:nn { 4 em } { \l_@@_info_grade_tl } + \c_@@_name_grade_tl + \tl_item:nn { \l_@@_info_degree_tl } { 1 } + \c_@@_name_author_r_tl #2 + } + \@@_ulined_center_box:nn { \l_@@_tmp_dim } + { \l_@@_info_author_tl } \\ +% \end{macrocode} +% 导师姓名、职称。 +% \begin{macrocode} + \@@_full_uline:NV \l_@@_tmp_dim + { \c_@@_name_supv_full_tl \c_@@_name_supv_r_tl #2 } + \@@_ulined_center_box:nn { \l_@@_tmp_dim } + { \l_@@_info_supv_full_tl } + } +% \end{macrocode} +% 英文摘要环境。前两行为标题。 +% \begin{macrocode} + { + \@@_full_uline:NV \l_@@_tmp_dim + { \clist_item:cn { c_@@_name_type #1 _clist } + { \l_@@_info_type_int } # 2 } + \@@_ulined_center_box:nn { \l_@@_tmp_dim } + { \tl_range:Nnn \l_@@_info_title_en_tl { 1 } { 40 } } \\ + \@@_uline:n { \textwidth } \@@_qquad: + \tl_range:Nnn \l_@@_info_title_en_tl { 41 } { -1 } +% \end{macrocode} +% 使用循环输出专业、姓名、导师。注意这里将 |\\| 放置在前部,以避免末尾生成多余的换行符产生 |Underfull \vbox| 信息。 +% \begin{macrocode} + \clist_map_inline:nn { major, author, supv_full } + { \\ + \@@_uline_entry:nnnn \l_@@_tmp_dim { ##1 _en } { ##1 _en } { #2 } + } + } + } % \end{macrocode} % \end{macro} +% +% \begin{macro}{\@@_print_keywords:nn} +% 生成中英文关键词列表。 +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \item 关键词分隔符 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_keywords:nn #1#2 + { + \skip_vertical:n { 2 ex } + \group_begin: +% \end{macrocode} +% “关键词”字样使用加粗黑体。 +% \begin{macrocode} + \noindent \bf \heiti + \use:c { c_@@_name_keywords #1 _tl } + \group_end: + \clist_use:cn { l_@@_info_keywords #1 _clist } { #2 } + } +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{绘制摘要} +% +% \begin{macro}{\@@_make_abs_ug:nn} +% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构本科生摘要。} +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \item 关键词分隔符 +% \end{arguments} +% 生成本科生摘要。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_make_abs_ug:nn #1#2 + { + \begin{center} + \@@_abs_title_uuline:n { 22 em } + \@@_abs_title_ug:n { #1 } + \end{center} + \group_begin: + \@@_abs_info_style:n { -4 } + \@@_abs_info_ug:nn { #1 } { #2 } + \group_end: \@@_vskip: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_make_abs_g:nn} +% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构研究生摘要。} +% \begin{arguments} +% \item 语言,空置为中文,|_en| 为英文 +% \item 关键词分隔符 +% \end{arguments} +% 生成研究生摘要。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_make_abs_g:nn #1#2 + { + \begin{center} + \@@_abs_title_uuline:n { 19 em } + \@@_abs_title_g:n { #1 } + \end{center} + \group_begin: + \@@_abs_info_style:n { 4 } + \@@_abs_info_g:nn { #1 } { #2 } + \group_end: \@@_vskip: + } +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{用户接口} % -% \begin{macro}{abstract} +% \begin{environment}{abstract} +% \changes{v0.13}{2021/12/12}{重新绘制摘要。} % 中文摘要环境。 % \begin{macrocode} \NewDocumentEnvironment{abstract} { +b } - { \use:c { @@_print_abstract_ \g_@@_info_diploma_tl : } #1 } - { \@@_print_keywords: \newpage } + { + \newpage + \@@_abs_bookmark:n { } + \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { } { : } + \group_begin: \normalfont \zihao { -4 } #1 + } + { \@@_print_keywords:nn { } { ; } \group_end: } % \end{macrocode} -% \end{macro} +% \end{environment} % -% \begin{macro}{abstract*} +% \begin{environment}{abstract*} % 英文摘要环境。\pkg{xparse} 目前不支持合并带有星号的环境,因此需要单独定义。 % \begin{macrocode} \NewDocumentEnvironment{abstract*} { +b } - { \use:c { @@_print_abstract_en_ \g_@@_info_diploma_tl : } #1 } - { \@@_print_keywords_en: \cleardoublepage } + { + \newpage + \@@_abs_bookmark:n { _en } + \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { _en } { :~ } + \group_begin: \normalfont \zihao{ -4 } #1 + } + { \@@_print_keywords:nn { _en } { ;~ } \group_end: } +% \end{macrocode} +% \end{environment} +% +% +% \subsection{前言致谢} +% +% \begin{environment}{preface} +% \begin{environment}{acknowledgement} +% 单独制作的前言致谢页。 +% \begin{macrocode} +\NewDocumentEnvironment{preface} { +b } + { \njuchapter { 前\hspace{2em}言 } #1 } { } +\NewDocumentEnvironment{acknowledgement} { +b } + { \njuchapter { 致\hspace{2em}谢 } #1 } { } +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\njupaperlist} +% \changes{v0.10}{2021/09/29}{新增了成果列表页面。} +% 发表文章目录与合作文章目录。 +% \begin{macrocode} +\NewDocumentCommand\njupaperlist { t* m } + { + \begin{refsection} + \nocite{#2} + \bool_if:NTF { #1 } + { \printbibliography[heading=subbibliography,title=合作文章目录] } + { \printbibliography[heading=subbibliography,title=发表文章目录] } + \end{refsection} + } %</class> % \end{macrocode} % \end{macro} % +% % \end{implementation} % diff --git a/Master/texmf-dist/source/latex/njuthesis/njuthesis.ins b/Master/texmf-dist/source/latex/njuthesis/njuthesis.ins deleted file mode 100644 index bb465a1532f..00000000000 --- a/Master/texmf-dist/source/latex/njuthesis/njuthesis.ins +++ /dev/null @@ -1,75 +0,0 @@ -%% -%% This is file `njuthesis.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% njuthesis.dtx (with options: `install') -%% -%% Copyright (C) 2021 -%% by Nanjing University Linux User Group <nju.lug@yaoge123.cn> -%% -%% This file may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License, either version 1.3c of this license -%% or (at your option) any later version. The latest version of this -%% license is in: -%% -%% http://www.latex-project.org/lppl.txt -%% -%% and version 1.3 or later is part of all distributions of LaTeX version -%% 2005/12/01 or later. -%% -%% To produce the documentation run the original source files ending with `.dtx' -%% through XeTeX. -%% -\input docstrip.tex -\keepsilent -\askforoverwritefalse - -\preamble - -Copyright (C) 2021 -by Nanjing University Linux User Group <nju.lug@yaoge123.cn> - -This file may be distributed and/or modified under the conditions of -the LaTeX Project Public License, either version 1.3c of this license -or (at your option) any later version. The latest version of this -license is in: - - http://www.latex-project.org/lppl.txt - -and version 1.3 or later is part of all distributions of LaTeX version -2005/12/01 or later. - -To produce the documentation run the original source files ending with `.dtx' -through XeTeX. - -\endpreamble - -\generate{ - \usedir{tex/latex/njuthesis} - \file{\jobname.cls} {\from{\jobname.dtx}{class}} -} - -\obeyspaces -\Msg{*************************************************************} -\Msg{* *} -\Msg{* To finish the installation you have to move the following *} -\Msg{* files into a directory searched by TeX: *} -\Msg{* *} -\Msg{* The recommended directory is TDS:tex/latex/njuthesis *} -\Msg{* *} -\Msg{* njuthesis.cls *} -\Msg{* njuthesis.ins *} -\Msg{* *} -\Msg{* To produce the documentation, run the file njuthesis.dtx *} -\Msg{* through XeLaTeX. *} -\Msg{* *} -\Msg{* Happy TeXing! *} -\Msg{* *} -\Msg{*************************************************************} - -\endbatchfile -\endinput -%% -%% End of file `njuthesis.ins'. diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls index 0a62158a22a..ec1568b5bcc 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls @@ -24,31 +24,31 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo $Id: njuthesis.dtx 0.12.0 2021-11-30 11:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ +\GetIdInfo $Id: njuthesis.dtx 0.13.0 2021-12-13 16:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ { Thesis template for Nanjing University } \ProvidesExplClass{njuthesis} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \RequirePackage { xtemplate, l3keys2e } \msg_new:nnn { njuthesis } { l3-too-old } { - Package~ "#1"~ is~ too~ old. \\\\ - Please~ update~ an~ up-to-date~ version~ of~ \\ - the~ bundles "l3kernel"~ and~ "l3packages"~ \\ - using~ your~ TeX~ package manager~ or~ from~ \\ + Package~ "#1"~ is~ too~ old. \\ + Please~ update~ an~ up-to-date~ version~ of~ + the~ bundles "l3kernel"~ and~ "l3packages"~ + using~ your~ TeX~ package~ manager~ or~ from~ \\ CTAN. } \clist_map_inline:nn { xtemplate, l3keys2e } { - \@ifpackagelater {#1} { 2021/08/27 } + \@ifpackagelater {#1} { 2020/10/01 } { } { \msg_error:nnn { njuthesis } { l3-too-old } {#1} } } \msg_new:nnn { njuthesis } { unsupported-engine } { - The~ njuthesis~ class~ requires~ either~ \\ - XeTeX~ or~ LuaTeX. \\\\ - "#1"~ is~ not~ supported~ at~ present.~ \\ - You~ must~ change your~ typesetting~ engine~ \\ + The~ njuthesis~ class~ requires~ either~ + XeTeX~ or~ LuaTeX. \\ + "#1"~ is~ not~ supported~ at~ present.~ + You~ must~ change your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". } \sys_if_engine_xetex:F @@ -59,152 +59,370 @@ { \c_sys_engine_str } } } +\box_new:N \l__nju_tmp_box +\clist_new:N \l__nju_tmp_clist +\dim_new:N \l__nju_tmp_dim +\int_new:N \l__nju_tmp_int +\seq_new:N \l__nju_tmp_seq +\tl_new:N \l__nju_tmp_tl \clist_const:Nn \c__nju_name_type_clist { 毕业论文, 毕业设计 } +\clist_const:Nn \c__nju_name_type_en_clist + { THESIS, DESIGN } \clist_const:Nn \c__nju_name_degree_clist { 学士, 硕士, 硕士专业, 博士 } \clist_const:Nn \c__nju_name_degree_en_clist { Bachelor, Master, Master, Doctor~of~Philosophy } +\int_new:N \l__nju_info_degree_int +\tl_new:N \l__nju_info_degree_tl +\int_new:N \l__nju_info_diploma_int +\tl_new:N \l__nju_info_diploma_tl +\int_new:N \l__nju_info_type_int +\tl_new:N \l__nju_info_type_tl +\bool_new:N \l__nju_second_supv_bool +\tl_new:N \l__nju_info_supv_full_tl +\tl_new:N \l__nju_info_supv_full_en_tl +\bool_new:N \g__nju_load_sys_font_bool +\tl_new:N \g__nju_latin_font_tl +\tl_new:N \g__nju_cjk_font_tl +\cs_new:Nn \__nju_quad: { \skip_horizontal:n { 1 em } } +\cs_new:Nn \__nju_qquad: { \skip_horizontal:n { 2 em } } +\cs_new:Nn \__nju_vskip: { \skip_vertical:n { 1 ex } } +\cs_new:Nn \__nju_hskip: { \skip_horizontal:n { 0.3 em } } \cs_new_protected:Npn \__nju_define_name:nn #1#2 - { \tl_const:cn { c__nju_name_ #1 _tl } {#2} } + { \tl_const:cn { c__nju_name_ #1 _tl } {#2} } \cs_new_protected:Npn \__nju_define_name:nnn #1#2#3 { \tl_const:cn { c__nju_name_ #1 _tl } {#2} \tl_const:cn { c__nju_name_ #1 _en_tl } {#3} } +\cs_new:Npn \__nju_name:n #1 { \tl_use:c { c__nju_name_ #1 _tl } } +\cs_new:Npn \__nju_info:n #1 { \tl_use:c { l__nju_info_ #1 _tl } } +\cs_new_protected:Npn \__nju_ulined_center_box:nn #1#2 + { + \mode_leave_vertical: + \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + \hbox_to_wd:nn {#1} { \hfil #2 \hfil } + } +\cs_generate_variant:Nn \tl_map_inline:nn { xn } +\cs_new_protected:Npn \__nju_spread_box:nnn #1#2#3 + { + \mode_leave_vertical: + \hbox_to_wd:nn {#1} + { #2 \tl_map_inline:xn {#3} { ##1 \hfil } \unskip } + } +\cs_new_protected:Npn \__nju_multiline_box:nnnn #1#2#3#4 + { + \int_set:Nn #1 { 1 } + \int_do_until:nn { #1 > #3 } + { + \__nju_ulined_center_box:nn { #4 } + { \clist_item:Nn #2 { #1 } } \\ + \int_incr:N #1 + } + } +\cs_new_protected:Npn \__nju_put_inempty_seg:nnn #1#2#3 + { + \tl_set:Nx \l__nju_tmp_tl { \tl_range:Nnn { #1 } { #2 } { #2 + #3 - 1 } } + \tl_if_empty:NF \l__nju_tmp_tl { \clist_put_right:NV \l__nju_tmp_clist { \l__nju_tmp_tl } } + } +\cs_new_protected:Npn \__nju_uline:n #1 + { + \mode_leave_vertical: + \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + } +\cs_new_protected:Npn \__nju_uuline:n #1 + { + \mode_leave_vertical: + \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + \rule [ -0.6 ex ] { #1 } { 0.4 pt } + \skip_horizontal:n { -#1 } + } +\cs_new:Npn \__nju_get_text_width:Nn #1#2 + { + \hbox_set:Nn \l__nju_tmp_box {#2} + \dim_set:Nn #1 { \box_wd:N \l__nju_tmp_box } + } +\cs_generate_variant:Nn \__nju_get_text_width:Nn { NV } +\cs_new_protected:Npn \__nju_full_uline:Nn #1#2 + { + \__nju_get_text_width:Nn #1 { #2 } + \dim_set:Nn #1 { \textwidth - #1 } #2 + } +\cs_generate_variant:Nn \__nju_full_uline:Nn { NV } +\cs_new_protected:Npn \__nju_uline_entry:nnnn #1#2#3#4 + { + \__nju_full_uline:NV #1 { \__nju_name:n { #2 } #4 } + \__nju_ulined_center_box:nn { #1 } { \__nju_info:n { #3 } } + } +\cs_new_protected:Npn \__nju_uline_bientry:nnnn #1#2#3#4 + { + \__nju_full_uline:NV #1 { \__nju_name:n { #2 } #4 } + \dim_sub:Nn #1 { \textwidth / 2 } + \__nju_ulined_center_box:nn { #1 } { \__nju_info:n { #3 } } + } +\keys_define:nn { nju } + { + degree .choices:nn = { ug, mg, mf, phd } + { \int_set_eq:NN \l__nju_info_degree_int \l_keys_choice_int + \tl_set:Nn \l__nju_info_degree_tl + { \clist_item:Nn \c__nju_name_degree_clist { \l__nju_info_degree_int } } + \int_compare:nTF { \l__nju_info_degree_int == 1 } + { \tl_set:Nn \l__nju_info_diploma_tl { ug } } + { \tl_set:Nn \l__nju_info_diploma_tl { g } } }, + degree .initial:n = ug, + type .choices:nn = { thesis, design } + { \int_set_eq:NN \l__nju_info_type_int \l_keys_choice_int + \tl_set:Nn \l__nju_info_type_tl + { \clist_item:Nn \c__nju_name_type_clist { \l__nju_info_type_int } } + \tl_put_left:Nn \l__nju_info_type_tl + { \tl_use:c { c__nju_name_ \l__nju_info_diploma_tl _tl } } }, + type .initial:n = thesis, + nlcover .bool_set:N = \g__nju_nlcover_bool, + nlcover .initial:n = false, + latin-font .choices:nn = + { gyre, mac, win, none } + { \tl_set_eq:NN \g__nju_latin_font_tl \l_keys_choice_tl }, + cjk-font .choices:nn = + { fandol, founder, mac, noto, win, none } + { \tl_set_eq:NN \g__nju_cjk_font_tl \l_keys_choice_tl }, + } +\ProcessKeysOptions { nju } \clist_map_inline:nn { - { pdf_creator } { LaTeX~ with~ njuthesis~ class }, + { id } { 学号 }, + { orig_decl } { 学位论文原创性声明 }, + { pdf_creator } { LaTeX~ with~ njuthesis~ class }, + { supv_ii } { 第二导师 }, + { supv_ttl } { 职称 } } { \__nju_define_name:nn #1 } \clist_map_inline:nn { - { keywords } { 关键词: } { Keywords: }, + { abstract } { 摘要 } { ABSTRACT }, + { appendix } { 附录 } { appendix }, + { dept } { 院系 } { DEPARTMENT }, + { figure } { 图 } { figure }, + { keywords } { 关键词: } { Keywords:~ }, + { lang } { 中文 } { 英文 }, + { nju } { 南京大学 } { Nanjing~ University }, + { table } { 表 } { table } } { \__nju_define_name:nnn #1 } -\int_new:N \g__nju_info_degree_int -\int_new:N \g__nju_info_type_int -\tl_new:N \g__nju_info_diploma_tl -\tl_new:N \g__nju_latin_fontset_tl -\tl_new:N \g__nju_cjk_fontset_tl -\keys_define:nn { nju } -{ - degree .choices:nn = - { ug, mg, mf, phd } - { \int_set_eq:NN \g__nju_info_degree_int \l_keys_choice_int }, - degree .initial:n = ug, - type .choices:nn = - { thesis, design } - { \int_set_eq:NN \g__nju_info_type_int \l_keys_choice_int }, - type .initial:n = thesis, - nlcover .bool_set:N = \g__nju_nlcover_bool, - nlcover .initial:n = false, - customlatinfont .choices:nn = - { gyre, macos, windows, none } - { \tl_set_eq:NN \g__nju_latin_fontset_tl \l_keys_choice_tl }, - customchinesefont .choices:nn = - { fandol, founder, macos, noto, windows, none } - { \tl_set_eq:NN \g__nju_cjk_fontset_tl \l_keys_choice_tl }, -} -\ProcessKeysOptions { nju } -\int_compare:nTF { \g__nju_info_degree_int == 1 } - { \tl_set:Nn \g__nju_info_diploma_tl { ug } } - { \tl_set:Nn \g__nju_info_diploma_tl { g } } -\keys_define:nn { nju } -{ - info.meta:nn = { nju / info } { #1 } -} +\int_compare:nTF { \l__nju_info_degree_int == 1 } + { + \clist_map_inline:nn + { + { author_full } { 本科生姓名 }, + { grade } { 年级 }, + { sm_date } { 提交日期 }, + { supv } { 导师 }, + { title } { 题目 }, + { type } { 本科生毕业论文(设计、作品)}, + { ug } { 本科 } + } + { \__nju_define_name:nn #1 } + \clist_map_inline:nn + { + { author } { 学生姓名 } { UNDERGRADUATE }, + { major } { 专业 } { SPECIALIZATION }, + { supv_full } { 指导教师(姓名、职称) } { MENTOR } + } + { \__nju_define_name:nnn #1 } + } + { + \clist_map_inline:nn + { + { abstract_r } { 摘要首页用纸 }, + { author_r } { 生姓名 }, + { chairman } { 答辩委员会主席: }, + { clc } { 分类号 }, + { confer } { 学位授予单位和日期 }, + { df_date } { 论文答辩日期 }, + { degree } { 申请学位级别 }, + { degree_l } { (申请 }, + { degree_r } { 学位) }, + { field } { 研究方向 }, + { g } { 研究生 }, + { grade } { 级 }, + { major_s } { 专业 }, + { major_nl } { 专业名称 }, + { orig_sign } { 研究生签名: }, + { orig_date } { 日期: }, + { reviewer } { 评阅人: }, + { seclv } { 密级 }, + { sign } { (签字) }, + { sm_date } { 论文提交日期 }, + { supv } { 导师 }, + { supv_r } { (姓名、职称) }, + { supv_info } { 指导教师姓名、职务、 + 职称、学位、单位名称及地址 }, + { title } { 论文题目 }, + { title_nl } { (题名和副题名) }, + { title_s } { 题目 }, + { udc } { U D C } + } + { \__nju_define_name:nn #1 } + \clist_map_inline:nn + { + { author } { 作者姓名 } { POSTGRADUATE }, + { major } { 专业方向 } { SPECIALIZATION }, + { supv_full } { 指导教师 } { MENTOR } + } + { \__nju_define_name:nnn #1 } + \tl_const:Nn \c__nju_cover_en_text_tl + { + A~ dissertation~ submitted~ to \\ + the~ graduate~ school~ of~ Nanjing~ University \\ + in~ partial~ fulfilment~ of~ the~ requirements~ for~ the~ degree~ of + } + } +\tl_const:Nn \c__nju_orig_decl_text_tl + { + 本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作 + 所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或 + 集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构 + 的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已 + 在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。 + } +\clist_const:Nn \c__nju_theorem_type_clist + { axiom, corollary, definition, example, lemma, theorem } +\clist_map_inline:nn + { + { axiom } { 公理 } { Axiom }, + { corollary } { 推论 } { Corollary }, + { definition } { 定义 } { Definition }, + { example } { 例 } { Example }, + { lemma } { 引理 } { Lemma }, + { proof } { 证明 } { Proof }, + { theorem } { 定理 } { Theorem } + } + { \__nju_define_name:nnn #1 } +\keys_define:nn { nju } { info.meta:nn = { nju / info } { #1 } } \keys_define:nn { nju / info } -{ - titlea .tl_set:N = \l__nju_info_title_a_tl, - titleb .tl_set:N = \l__nju_info_title_b_tl, - titlec .tl_set:N = \l__nju_info_title_c_tl, - title* .tl_set:N = \l__nju_info_title_en_tl, -keywords .clist_set:N = \l__nju_info_keywords_clist, -keywords* .clist_set:N = \l__nju_info_keywords_en_clist, - grade .tl_set:N = \l__nju_info_grade_tl, - student-id .tl_set:N = \l__nju_info_id_tl, - author .tl_set:N = \l__nju_info_author_tl, - author* .tl_set:N = \l__nju_info_author_en_tl, - department .tl_set:N = \l__nju_info_dept_tl, - department* .tl_set:N = \l__nju_info_dept_en_tl, - major .tl_set:N = \l__nju_major_tl, - major* .tl_set:N = \l__nju_major_en_tl, - field .tl_set:N = \l__nju_field_tl, - field* .tl_set:N = \l__nju_field_en_tl, - supervisora .tl_set:N = \l__nju_info_supv_a_tl, - supervisora* .tl_set:N = \l__nju_info_supv_a_en_tl, - supervisora-title .tl_set:N = \l__nju_info_supv_a_title_tl, - supervisora-title*.tl_set:N = \l__nju_info_supv_a_title_en_tl, - supervisorb .tl_set:N = \l__nju_info_supv_b_tl, - supervisorb* .tl_set:N = \l__nju_info_supv_b_en_tl, - supervisorb-title .tl_set:N = \l__nju_info_supv_b_title_tl, - supervisorb-title*.tl_set:N = \l__nju_info_supv_b_title_en_tl, - submit-date .tl_set:N = \l__nju_submit_date_tl, - submit-date* .tl_set:N = \l__nju_submit_date_en_tl, - defend-date .tl_set:N = \l__nju_defend_date_tl, - chairman .tl_set:N = \l__nju_info_chairman_tl, - reviewer .clist_set:N = \l__nju_info_reviewer_clist, - clc .tl_set:N = \l__nju_info_clc_tl, - secret-level .tl_set:N = \l__nju_info_seclv_tl, - udc .tl_set:N = \l__nju_info_udc_tl, - supervisor-contact.tl_set:N = \l__nju_info_supv_cont_tl, -} -\NewDocumentCommand \njusetup { m } -{ \keys_set:nn { nju } { #1 } } -\LoadClass[ - a4paper, - twoside, - UTF8, - scheme=chinese, - linespread=1.625, - fontset=none, - zihao=-4 - ]{ctexbook}[2018/04/01] + { + title .tl_set:N = \l__nju_info_title_tl, + title .initial:n = { 空 }, + title* .tl_set:N = \l__nju_info_title_en_tl, + keywords .clist_set:N = \l__nju_info_keywords_clist, + keywords* .clist_set:N = \l__nju_info_keywords_en_clist, + grade .tl_set:N = \l__nju_info_grade_tl, + student-id .tl_set:N = \l__nju_info_id_tl, + author .tl_set:N = \l__nju_info_author_tl, + author* .tl_set:N = \l__nju_info_author_en_tl, + department .tl_set:N = \l__nju_info_dept_tl, + department* .tl_set:N = \l__nju_info_dept_en_tl, + major .tl_set:N = \l__nju_info_major_tl, + major* .tl_set:N = \l__nju_info_major_en_tl, + field .tl_set:N = \l__nju_info_field_tl, + field* .tl_set:N = \l__nju_info_field_en_tl, + supervisor .tl_set:N = \l__nju_info_supv_tl, + supervisor* .tl_set:N = \l__nju_info_supv_en_tl, + supervisor-title .tl_set:N = \l__nju_info_supv_ttl_tl, + supervisor-title* .tl_set:N = \l__nju_info_supv_ttl_en_tl, + supervisor-ii .tl_set:N = \l__nju_info_supv_ii_tl, + supervisor-ii* .tl_set:N = \l__nju_info_supv_ii_en_tl, + supervisor-ii-title .tl_set:N = \l__nju_info_supv_ii_ttl_tl, + supervisor-ii-title*.tl_set:N = \l__nju_info_supv_ii_ttl_en_tl, + submit-date .tl_set:N = \l__nju_info_sm_date_tl, + submit-date* .tl_set:N = \l__nju_info_sm_date_en_tl, + defend-date .tl_set:N = \l__nju_info_df_date_tl, + chairman .tl_set:N = \l__nju_info_chairman_tl, + reviewer .clist_set:N = \l__nju_info_reviewer_clist, + clc .tl_set:N = \l__nju_info_clc_tl, + secret-level .tl_set:N = \l__nju_info_seclv_tl, + udc .tl_set:N = \l__nju_info_udc_tl, + supervisor-contact .tl_set:N = \l__nju_info_supv_cont_tl, + } +\NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } } +\bool_set:Nn \l__nju_second_supv_bool + { ! \tl_if_empty_p:N \l__nju_info_supv_ii_tl } +\tl_set:Nn \l__nju_info_supv_full_tl + { + \l__nju_info_supv_tl \__nju_hskip: + \l__nju_info_supv_ttl_tl + \bool_if:NT \l__nju_second_supv_bool + { + \__nju_quad: \l__nju_info_supv_ii_tl + \__nju_hskip: \l__nju_info_supv_ii_ttl_tl + } + } +\tl_set:Nn \l__nju_info_supv_full_en_tl + { + \l__nju_info_supv_ttl_en_tl \__nju_hskip: + \l__nju_info_supv_en_tl + \bool_if:NT \l__nju_second_supv_bool + { + \__nju_quad: \l__nju_info_supv_ii_ttl_en_tl + \__nju_hskip: \l__nju_info_supv_ii_en_tl + } + } +\PassOptionsToClass + { + a4paper, + twoside, + UTF8, + scheme=chinese, + linespread=1.625, + fontset=none, + zihao=-4 + } + { ctexbook } +\clist_map_inline:nn + { + { no-math } { fontspec }, + { perpage } { footmisc }, + { amsmath, thmmarks } { ntheorem }, + { hyphens } { url }, + { warnings-off={ mathtools-colon, mathtools-overbracket } } + { unicode-math }, + { capitalise, nameinlink, noabbrev } + { cleveref } + } + { \PassOptionsToPackage #1 } +\LoadClass { ctexbook } [ 2018/04/01 ] \RequirePackage -{ - geometry, - caption, - floatrow, - setspace, - lastpage, - emptypage, - fancyhdr, -} -\RequirePackage[titles]{tocloft} -\RequirePackage[hyphens]{url} % generate better linebreaks in the url -\RequirePackage{siunitx} % 用于书写单位符号 -\RequirePackage[version=4]{mhchem} % 用于绘制分子式 -\RequirePackage{hologo} + { + geometry, + caption, + setspace, + fancyhdr, + hologo, + url, + emptypage, + njuvisual, + amsmath, + mathtools, + unicode-math, + ntheorem, + graphicx, + wrapfig, + booktabs, + multirow, + listings, + enumitem, + hyperref, + cleveref + } \sys_if_engine_xetex:T -{ - \RequirePackage{xeCJKfntef,microtype} - \newcommand{\njuline}[1]{\CJKunderline{#1}} -} + { + \RequirePackage{xeCJKfntef} + \NewDocumentCommand \njuline { m } { \CJKunderline{#1} } + } \sys_if_engine_luatex:T -{ - \RequirePackage{lua-ul,dashundergaps} - \newcommand{\njuline}[1]{\underLine{#1}\null} -} -\RequirePackage{amsmath,amsthm,mathtools,thmtools} -\RequirePackage[ - warnings-off={ - mathtools-colon, - mathtools-overbracket} - ]{unicode-math} -\RequirePackage{graphicx,subcaption,wrapfig,tikz} -\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} -\RequirePackage{booktabs,multirow,multicol,listings,enumitem} -\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref} -\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref} -\RequirePackage{njuvisual} -\RequirePackage{blindtext,zhlipsum} + { + \RequirePackage{lua-ul} + \NewDocumentCommand \njuline { m } { \underLine{#1} \null } + } \msg_new:nnn { njuthesis } { package-too-old } { Package~ "#1"~ is~ too~ old. \\ - The~ njuthesis~ class~ only~ supports~ "#1"~ with~ \\ - a~ version higher~ than~ v#2. \\\\ - Please~ update~ an~ up-to-date~ version~ of~ it~ \\ + The~ njuthesis~ class~ only~ supports~ "#1"~ with~ + a~ version higher~ than~ v#2.\\ + Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your TeX~ package~ manager~ or~ from~ CTAN. } \cs_new_protected:Npn \__nju_check_package:nnn #1#2#3 @@ -214,303 +432,257 @@ keywords* .clist_set:N = \l__nju_info_keywords_en_clist, } \sys_if_engine_luatex:T { \__nju_check_package:nnn { luatexja } { 2021/10/24 } { 20211024.0 } } -\bool_new:N \g__nju_load_system_fontset_bool -\tl_if_empty:NTF \g__nju_latin_fontset_tl - { \bool_gset_true:N \g__nju_load_system_fontset_bool } -{ - \tl_if_empty:NT \g__nju_cjk_fontset_tl - { \bool_gset_true:N \g__nju_load_system_fontset_bool } -} -\bool_if:NT \g__nju_load_system_fontset_bool -{ - \sys_if_platform_windows:TF +\tl_if_empty:NTF \g__nju_latin_font_tl + { \bool_gset_true:N \g__nju_load_sys_font_bool } { - \tl_set:Nn \g__nju_latin_fontset_tl { windows } - \tl_set:Nn \g__nju_cjk_fontset_tl { windows } + \tl_if_empty:NT \g__nju_cjk_font_tl + { \bool_gset_true:N \g__nju_load_sys_font_bool } } +\bool_if:NT \g__nju_load_sys_font_bool { - \ctex_if_platform_macos:TF - { - \tl_set:Nn \g__nju_latin_fontset_tl { macos } - \tl_set:Nn \g__nju_cjk_fontset_tl { macos } - } - { - \tl_set:Nn \g__nju_latin_fontset_tl { gyre } - \tl_set:Nn \g__nju_cjk_fontset_tl { fandol } - } + \sys_if_platform_windows:TF + { \tl_set:Nn \g__nju_latin_font_tl { win } + \tl_set:Nn \g__nju_cjk_font_tl { win } } + { \ctex_if_platform_macos:TF + { \tl_set:Nn \g__nju_latin_font_tl { mac } + \tl_set:Nn \g__nju_cjk_font_tl { mac } } + { \tl_set:Nn \g__nju_latin_font_tl { gyre } + \tl_set:Nn \g__nju_cjk_font_tl { fandol } } } + } +\cs_new_protected:Npn \__nju_load_latin_font_win: + { + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Courier~New}[Scale=MatchLowercase] + } +\cs_new_protected:Npn \__nju_load_latin_font_mac: + { + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Menlo}[Scale=MatchLowercase] } -} -\cs_new_protected:Npn \__nju_load_latin_font_windows: -{ - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Courier~New}[Scale=MatchLowercase] -} -\cs_new_protected:Npn \__nju_load_latin_font_macos: -{ - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Menlo}[Scale=MatchLowercase] -} \cs_new_protected:Npn \__nju_load_latin_font_gyre: -{ - \setmainfont{texgyretermes}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setsansfont{texgyreheros}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setmonofont{texgyrecursor}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic, - Scale=MatchLowercase, - Ligatures=CommonOff] -} -\cs_new_protected:Npn \__nju_load_cjk_font_windows: -{ - \setCJKmainfont{SimSun}[ - AutoFakeBold=2.17, - ItalicFont=KaiTi] - \setCJKsansfont{SimHei} - \setCJKmonofont{FangSong} - \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] - \setCJKfamilyfont{zhhei}{SimHei} - \setCJKfamilyfont{zhfs}{FangSong} - \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] - % \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[ - % BoldFont=Microsoft~YaHei~Bold] -} -\cs_new_protected:Npn \__nju_load_cjk_font_macos: -{ - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} - \setCJKmainfont{Songti~SC~Light}[ - BoldFont=Songti~SC~Bold, - ItalicFont=Kaiti~SC, - BoldItalicFont=Kaiti~SC~Bold] - \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] - \setCJKmonofont{STFangsong} - \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] - \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] - \setCJKfamilyfont{zhfs}{STFangsong} - \setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold] - \setCJKfamilyfont{zhnewhei}{PingFang~SC} -} + { + \setmainfont{texgyretermes}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setsansfont{texgyreheros}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setmonofont{texgyrecursor}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic, + Scale=MatchLowercase, + Ligatures=CommonOff] + } +\cs_new_protected:Npn \__nju_load_cjk_font_win: + { + \setCJKmainfont{SimSun}[ + AutoFakeBold=2.17, + ItalicFont=KaiTi] + \setCJKsansfont{SimHei} + \setCJKmonofont{FangSong} + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhhei}{SimHei} + \setCJKfamilyfont{zhfs}{FangSong} + \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] + } +\cs_new_protected:Npn \__nju_load_cjk_font_mac: + { + % 移除 does not contain script "CJK" 警告 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + \setCJKmainfont{Songti~SC~Light}[ + BoldFont=Songti~SC~Bold, + ItalicFont=Kaiti~SC, + BoldItalicFont=Kaiti~SC~Bold] + \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] + \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKfamilyfont{zhfs}{STFangsong} + \setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold] + \setCJKfamilyfont{zhnewhei}{PingFang~SC} + } \cs_new_protected:Npn \__nju_load_cjk_font_fandol: -{ - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} - \setCJKmainfont{FandolSong-Regular}[ - Extension=.otf, - BoldFont=FandolSong-Bold, - ItalicFont=FandolKai-Regular] - \setCJKsansfont{FandolHei-Regular}[ - Extension=.otf, - BoldFont=FandolHei-Bold] - \setCJKmonofont{FandolFang-Regular}[Extension=.otf] - \setCJKfamilyfont{zhsong}{FandolSong-Regular}[ - Extension=.otf, - BoldFont=FandolSong-Bold] - \setCJKfamilyfont{zhhei}{FandolHei-Regular}[ - Extension=.otf, - BoldFont=FandolHei-Bold] - \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] - \setCJKfamilyfont{zhkai}{FandolKai-Regular}[ - Extension=.otf, - AutoFakeBold=2.17] -} + { + % 移除 does not contain script "CJK" 警告 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + \setCJKmainfont{FandolSong-Regular}[ + Extension=.otf, + BoldFont=FandolSong-Bold, + ItalicFont=FandolKai-Regular] + \setCJKsansfont{FandolHei-Regular}[ + Extension=.otf, + BoldFont=FandolHei-Bold] + \setCJKmonofont{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhsong}{FandolSong-Regular}[ + Extension=.otf, + BoldFont=FandolSong-Bold] + \setCJKfamilyfont{zhhei}{FandolHei-Regular}[ + Extension=.otf, + BoldFont=FandolHei-Bold] + \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhkai}{FandolKai-Regular}[ + Extension=.otf, + AutoFakeBold=2.17] + } \cs_new_protected:Npn \__nju_load_cjk_font_founder: -{ - \sys_if_engine_luatex:T - { - % 在 LuaTeX 中调整方正字体括号位置 - % XeTeX 暂无好的解决方法 - \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} - } - \setCJKmainfont{FZSSK}[% 方正书宋 - Extension=.ttf, - BoldFont=FZXBSK,% 方正小标宋 - ItalicFont=FZKTK]% 方正楷体 - \setCJKsansfont{FZXH1K}[% 方正细黑一 - Extension=.ttf, - BoldFont=FZHTK]% FZHTK 方正黑体 - \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 - \setCJKfamilyfont{zhsong} - {FZSSK}[ + { + \sys_if_engine_luatex:T + { + \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} + } + \setCJKmainfont{FZSSK}[% 方正书宋 Extension=.ttf, - BoldFont=FZXBSK] - \setCJKfamilyfont{zhhei} - {FZHTK}[ + BoldFont=FZXBSK,% 方正小标宋 + ItalicFont=FZKTK]% 方正楷体 + \setCJKsansfont{FZXH1K}[% 方正细黑一 Extension=.ttf, - AutoFakeBold=2.17] - \setCJKfamilyfont{zhfs} - {FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai} - {FZKTK}[Extension=.ttf] - % \setCJKfamilyfont{zhnewhei} - % {FZYouHK_508R}[% 方正悠黑508R - % Extension=.ttf, - % BoldFont=FZYouHK_511M]% 方正悠黑511M - \defaultCJKfontfeatures{} -} + BoldFont=FZHTK]% FZHTK 方正黑体 + \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 + \setCJKfamilyfont{zhsong} + {FZSSK}[ + Extension=.ttf, + BoldFont=FZXBSK] + \setCJKfamilyfont{zhhei} + {FZHTK}[ + Extension=.ttf, + AutoFakeBold=2.17] + \setCJKfamilyfont{zhfs} + {FZFSK}[Extension=.ttf] + \setCJKfamilyfont{zhkai} + {FZKTK}[Extension=.ttf] + \defaultCJKfontfeatures{} + } \cs_new_protected:Npn \__nju_load_cjk_font_noto: -{ - % 思源宋体 - \setCJKmainfont[ - UprightFont=NotoSerifSC-Regular, - BoldFont=NotoSerifSC-Bold, - ItalicFont=NotoSerifSC-Regular, - BoldItalicFont=NotoSerifSC-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Serif~SC} + { + % 思源宋体 + \setCJKmainfont[ + UprightFont=NotoSerifSC-Regular, + BoldFont=NotoSerifSC-Bold, + ItalicFont=NotoSerifSC-Regular, + BoldItalicFont=NotoSerifSC-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Serif~SC} - % 思源黑体 - \setCJKsansfont[ - UprightFont=NotoSansSC-Regular, - BoldFont=NotoSansSC-Bold, - ItalicFont=NotoSansSC-Regular, - BoldItalicFont=NotoSansSC-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Sans~SC} + % 思源黑体 + \setCJKsansfont[ + UprightFont=NotoSansSC-Regular, + BoldFont=NotoSansSC-Bold, + ItalicFont=NotoSansSC-Regular, + BoldItalicFont=NotoSansSC-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Sans~SC} - \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 + \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 - \setCJKfamilyfont{zhsong}{Noto~Serif~SC} - \setCJKfamilyfont{zhhei}{Noto~Sans~SC} - \setCJKfamilyfont{zhfs} - {FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai} - {FZKTK}[Extension=.ttf] -} + \setCJKfamilyfont{zhsong}{Noto~Serif~SC} + \setCJKfamilyfont{zhhei}{Noto~Sans~SC} + \setCJKfamilyfont{zhfs}{FZFSK}[Extension=.ttf] + \setCJKfamilyfont{zhkai}{FZKTK}[Extension=.ttf] + } \cs_new_protected:Npn \__nju_load_font: -{ - \use:c { __nju_load_latin_font_ \g__nju_latin_fontset_tl : } - \use:c { __nju_load_cjk_font_ \g__nju_cjk_fontset_tl : } - \NewDocumentCommand\songti{}{\CJKfamily{zhsong}} - \NewDocumentCommand\heiti{}{\CJKfamily{zhhei}} - \NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}} - \NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}} -} + { + \use:c { __nju_load_latin_font_ \g__nju_latin_font_tl : } + \use:c { __nju_load_cjk_font_ \g__nju_cjk_font_tl : } + \NewDocumentCommand \songti { } { \CJKfamily{zhsong} } + \NewDocumentCommand \heiti { } { \CJKfamily{zhhei} } + \NewDocumentCommand \fangsong { } { \CJKfamily{zhfs} } + \NewDocumentCommand \kaishu { } { \CJKfamily{zhkai} } + \RenewDocumentCommand \large { } { \zihao{4} } + } \__nju_load_font: \setmathfont{XITSMath-Regular}[ BoldFont = XITSMath-Bold, Extension = .otf] -\setmathfont{latinmodern-math.otf}[range={cal,bb,frak}] -\geometry{ - vmargin = 2.5 cm, - hmargin = 3.2 cm, - headheight = 15 pt -} -\fancypagestyle{njuplain}{ - \fancyhead{} - \fancyfoot[C]{\zihao{5}\thepage} -} -\fancypagestyle{njuheadings}{% - \fancyhead{} - \fancyfoot[C]{\zihao{5}\thepage} -} -\int_compare:nTF { \g__nju_info_degree_int == 1 } -{ - % the header line - \tl_set:Nn \headrulewidth {0pt} - % the footer line - \tl_set:Nn \footrulewidth {0pt} - \AtBeginDocument{\pagestyle{njuplain}\flushbottom} % 本科无页眉页脚 -} -{ - % the header line - \tl_set:Nn \headrulewidth {1pt} - % the footer line - \tl_set:Nn \footrulewidth {0pt} - \AtBeginDocument{\pagestyle{fancy}\flushbottom} % 研究生有页眉页脚 -} -\ctexset{ - chapter/format = \zihao{4}\heiti\centering\selectfont, - chapter/beforeskip = 10pt, - chapter/afterskip = 60pt, - section/format = \zihao{4}\heiti\raggedright\selectfont, - subsection/format = \zihao{4}\heiti\raggedright\selectfont, - subsubsection/format = \zihao{4}\heiti\raggedright\selectfont, -} -\ctexset{ - contentsname = 目录, - listfigurename = 插图清单, - listtablename = 表格清单, -} -\cftsetpnumwidth{2em} -\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}} -\renewcommand{\cftchapdotsep}{\cftdotsep} -\renewcommand{\cftchapfont}{\heiti\zihao{4}} -\setlength{\cftsecindent}{2em} -\setlength{\cftsubsecindent}{52pt} -\setlength{\cftsubsecnumwidth}{2em} - % 重定义目录命令,修改标题格式并插入书签。 -\renewcommand\tableofcontents{% - \cleardoublepage - \raggedbottom - \begingroup - \ctexset{ - contentsname = {目\hspace{2em}录}, - chapter/format = {\centering\songti\bf\zihao{3}\selectfont}, - }% - \chapter*{\contentsname}% - \endgroup - \addcontentsline{toc}{chapter}{\contentsname} - \vskip 20pt - \@starttoc{toc}% -} -\renewcommand\listoffigures{% - \cleardoublepage - \begingroup - \ctexset{ - chapter/format = {\centering\songti\bf\zihao{3}\selectfont}, - }% - \chapter*{\listfigurename}% - \endgroup - \addcontentsline{toc}{chapter}{\listfigurename} - \vskip 20pt - \@starttoc{lof}% -} -\renewcommand\listoftables{% - \cleardoublepage - \begingroup - \ctexset{ - chapter/format = {\centering\songti\bf\zihao{3}\selectfont}, - }% - \chapter*{\listtablename}% - \endgroup - \addcontentsline{toc}{chapter}{\listtablename} - \vskip 20pt - \@starttoc{lot}% -} -\NewDocumentEnvironment{preface}{} -{% - \chapter*{前言} - \addcontentsline{toc}{chapter}{前言} -}{\cleardoublepage} -\NewDocumentEnvironment{acknowledgement}{} -{% - \chapter*{致谢} - \addcontentsline{toc}{chapter}{致谢} -}{\cleardoublepage} -\NewDocumentCommand\njupaperlist { t* m } +\setmathfont{NewCMMath-Regular.otf}[range={cal,bb,frak}] +\setmathfont{NewCMMath-Regular.otf}[version=bold,range={bfcal}] +\geometry + { + vmargin = 2.5 cm, + hmargin = 3.2 cm, + headheight = 15 pt + } +\fancypagestyle { plain } + { + \fancyhf { } + \fancyfoot [ C ] { \zihao{5} \thepage } + \RenewDocumentCommand \headrulewidth { } { 0 pt } + \RenewDocumentCommand \footrulewidth { } { 0 pt } + } +\fancypagestyle{headings} + { + \fancyhf { } + \fancyhead [ CO ] { \leftmark } + \fancyhead [ CE ] { \rightmark } + \fancyfoot [ C ] { \zihao{5} \thepage } + \RenewDocumentCommand \headrulewidth { } { 0.4 pt } + \RenewDocumentCommand \footrulewidth { } { 0 pt } + \setlength { \headheight } { 20 pt } + } +\RenewDocumentCommand \frontmatter { } + { + \cleardoublepage + \pagestyle{empty} + \pagenumbering{Roman} + } +\RenewDocumentCommand \mainmatter { } + { + \cleardoublepage + \int_compare:nTF { \l__nju_info_degree_int == 1 } + { \pagestyle{plain} } { \pagestyle{headings} } + \pagenumbering{arabic} + \normalfont\normalsize + } +\tl_const:Nn \c__nju_sec_format_tl { \large \normalfont \sffamily } +\ctexset + { + chapter/beforeskip = 10 pt, + chapter/afterskip = 60 pt, + chapter/format = \centering \c__nju_sec_format_tl, + section/format = \c__nju_sec_format_tl, + subsection/format = \c__nju_sec_format_tl, + subsubsection/format = \c__nju_sec_format_tl + } +\cs_new_protected:Npn \__nju_chapter_in_toc:n #1 + { \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1 } } +\NewDocumentCommand \njuchapter { m } + { + \chapter*{#1} + \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1} + \@mkboth{#1}{#1} + } +\ctexset + { + contentsname = {目\hspace{2em}录}, + listfigurename = {插图清单}, + listtablename = {表格清单}, + chapter / tocline = \c__nju_sec_format_tl \CTEXnumberline {#1} #2 + } +\tl_const:Nn \c__nju_toc_title_tl { \centering \zihao{3} \bf } +\cs_new_protected:Npn \__nju_modify_toc_title:nn #1#2 { - \begin{refsection} - \nocite{#2} - \IfBooleanTF {#1} - { \printbibliography[heading=subbibliography,title=合作文章目录] } - { \printbibliography[heading=subbibliography,title=发表文章目录] } - \end{refsection} + \group_begin: + \ctexset { chapter/format = \c__nju_toc_title_tl } + \njuchapter { #1 } + \group_end: + \@starttoc{#2} } +\RenewDocumentCommand \tableofcontents { } + { \__nju_modify_toc_title:nn { \contentsname } { toc } } +\RenewDocumentCommand \listoffigures { } + { \__nju_modify_toc_title:nn { \listfigurename } { lof } } +\RenewDocumentCommand \listoftables { } + { \__nju_modify_toc_title:nn { \listtablename } { lot } } \RequirePackage[ style=gb7714-2015, %style=numeric-comp, @@ -536,650 +708,463 @@ keywords* .clist_set:N = \l__nju_info_keywords_en_clist, % gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author % names in reference entries, GitHub Issue (#23) ]{biblatex} -\AtEveryBibitem{ -\clearfield{abstract} -\clearfield{issn} -\clearfield{isbn} -\clearfield{archivePrefix} -\clearfield{arxivId} -\clearfield{pmid} -\clearfield{eprint} -\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} -} -\crefdefaultlabelformat{#2#1#3\,} - -\crefname{figure}{图}{图} -\crefname{table}{表}{表} -\crefformat{equation}{公式~#2#1#3~} - -\crefformat{chapter}{第#2#1#3章} -\crefformat{section}{第~#2#1#3~节} -\crefformat{subsection}{第~#2#1#3~小节} -\crefformat{subsubsection}{第~#2#1#3~小节} -\crefname{appendix}{附录}{附录} - +\ctexset{ bibname = {参考文献} } +\defbibheading { njubib } [ \bibname ] { \njuchapter { #1 } } +\DeclarePrintbibliographyDefaults { heading = njubib } +\AtEveryBibitem + { + \clist_map_inline:nn + { abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint } + { \clearfield { #1 } } + \ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} + } \ctex_at_end_preamble:n -{ - \hypersetup - { - bookmarksnumbered = true, - psdextra = true, - unicode = true, - pdftitle = \l__nju_info_title_tl, - pdfauthor = \l__nju_info_author_tl, - pdfkeywords = \l__nju_info_keywords_clist, - pdfcreator = \c__nju_name_pdf_creator_tl - } -} -\floatsetup[figure]{ % Captions for figures -capposition=bottom,% -margins=centering,% -floatwidth=\textwidth% -} -\floatsetup[table]{ % Captions for tables -capposition=above,% -margins=centering,% -floatwidth=\textwidth% -} -\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti} -\captionsetup{ - font=small,% - labelfont=songticap, -textfont=songticap, -strut=no,% -hypcap=true, % Links point to the top of the figure -aboveskip=6pt, % Increase the space between the figure and the caption -belowskip=6pt, % Increase the space between the caption and the table -} -\floatsetup[lstlisting]{ % Captions for lstlistings -capposition=above,% -margins=centering,% -floatwidth=\textwidth% -} -\lstset{ -basicstyle=\ttfamily\linespread{1}\small\selectfont, - keywordstyle=\bfseries,% use bold style for keywords - commentstyle=\rmfamily\itshape,% use italic style for comments - stringstyle=\ttfamily,% 字符串风格 - flexiblecolumns,% ? - numbers=left,% left-aligned numbering - showspaces=false,% hide markers for spaces - showstringspaces=false, - captionpos=t,% place the caption at the top -breaklines=true, -xleftmargin=2em,xrightmargin=2em,% set the width of the code environment -} -\lstdefinestyle{LaTeX}{ - language=TeX, - morekeywords={ - begin, caption, label, mathrm, frac, - toprule, midrule, bottomrule, includegraphics} -} -\renewcommand{\labelitemi}{\tiny$\blacktriangleright$} -\renewcommand{\labelitemii}{\textbullet} - -\setlist[itemize]{noitemsep} -\setlist[enumerate]{noitemsep} -\setlist[description]{noitemsep} + { + \tl_set_eq:NN \l__nju_tmp_tl \l__nju_info_title_tl + \tl_remove_all:Nn \l__nju_tmp_tl { ! } + \hypersetup + { + bookmarksnumbered = true, + psdextra = true, + unicode = true, + hidelinks, + pdftitle = \l__nju_tmp_tl, + pdfauthor = \l__nju_info_author_tl, + pdfkeywords = \l__nju_info_keywords_clist, + pdfcreator = \c__nju_name_pdf_creator_tl + } + } +\cs_new_protected:Npn \__nju_cref_name:n #1 + { + \clist_map_inline:nn { #1 } + { \crefname { ##1 } { \__nju_name:n { ##1 } } { \__nju_name:n { ##1 _en } } } + } +\cs_new_protected:Npn \__nju_cref_name:N #1 + { + \clist_map_inline:Nn #1 + { \crefname { ##1 } { \__nju_name:n { ##1 } } { \__nju_name:n { ##1 _en } } } + } +\crefdefaultlabelformat{#2#1#3\,} +\crefformat { equation } { 公式~#2#1#3~ } +\crefformat { chapter } { 第#2#1#3章 } +\crefformat { section } { 第~#2#1#3~节 } +\crefformat { subsection } { 第~#2#1#3~小节 } +\crefformat { subsubsection } { 第~#2#1#3~小节 } +\__nju_cref_name:n { figure, table, appendix, proof } +\__nju_cref_name:N \c__nju_theorem_type_clist +\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} +\DeclareCaptionStyle{njucap} + { + font = small, + labelfont = bf, + labelsep = quad, + justification = centering + } +\captionsetup [ figure ] { style = njucap } +\captionsetup [ table ] { style = njucap } +\lstdefinestyle { njulisting } + { + basewidth = 0.5 em, + lineskip = 3 pt, + basicstyle = \tiny\tt, + keywordstyle = \bf, + commentstyle = \it\color{gray}, + numbers = left, + captionpos = t, + breaklines = true, + xleftmargin = 2 em, + xrightmargin = 2 em + } +\lstset + { + style = njulisting, + flexiblecolumns + } +\ExplSyntaxOff +\lstMakeShortInline[ + style=njulisting, + basicstyle=\normalsize\tt, + columns=fixed]| +\ExplSyntaxOn +\setlist { noitemsep } \NewDocumentCommand\mathbi{m}{\textbf{\em #1}} -\declaretheoremstyle[ - %spaceabove=.5\thm@preskip, - %spacebelow=.5\thm@postskip, - headfont=\bf\songti,%\scshape, - notefont=\songti,% notebraces={ (}{)}, - bodyfont=\songti, - %headformat={\NAME\space\NUMBER\space\NOTE}, - headpunct={}, - %postheadspace={.5em plus .1em minus .1em}, - %prefoothook={\hfill\qedsymbol} - ]{njuthm} - -\theoremstyle{njuthm} -\let\oldproofname=\proofname -\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} -\declaretheorem[ -name=算法, -style=njuthm, -refname={算法,算法}, -Refname={算法,算法}, -]{algorithm} -\declaretheorem[ -name=假设, -style=njuthm, -refname={假设,假设}, -Refname={假设,假设}, -]{assumption} -\declaretheorem[ -name=公理, -style=njuthm, -refname={公理,公理}, -Refname={公理,公理}, -]{axiom} -\declaretheorem[ -name=结论, -style=njuthm, -refname={结论,结论}, -Refname={结论,结论}, -]{conclusion} -\declaretheorem[ -name=条件, -style=njuthm, -refname={条件,条件}, -Refname={条件,条件}, -]{condition} -\declaretheorem[ -name=推论, -style=njuthm, -refname={推论,推论}, -Refname={推论,推论}, -]{corollary} -\declaretheorem[ -name=定义, -style=njuthm, -refname={定义,定义}, -Refname={定义,定义}, -]{definition} -\declaretheorem[ - name=例, - style=njuthm, - refname={例,例}, - Refname={例,例}, - % numberwithin=section, -]{example} -\declaretheorem[ -name=引理, -style=njuthm, -refname={引理,引理}, -Refname={引理,引理}, -]{lemma} -\declaretheorem[ -name=性质, -style=njuthm, -refname={性质,性质}, -Refname={性质,性质}, -]{property} -\declaretheorem[ -name=命题, -style=njuthm, -refname={命题,命题}, -Refname={命题,命题}, -]{proposition} -\declaretheorem[ -name=注解, -style=njuthm, -refname={注解,注解}, -Refname={注解,注解}, -]{remark} -\declaretheorem[ -name=定理, -style=njuthm, -refname={定理,定理}, -Refname={定理,定理}, -numberwithin=section, -]{theorem} -\tl_const:Nn \l__nju_info_title_tl -{ - \l__nju_info_title_a_tl - \l__nju_info_title_b_tl - \l__nju_info_title_c_tl -} -\tl_new:N \l__nju_info_supv_full_tl -\tl_new:N \l__nju_info_supv_full_en_tl -\tl_set:Nn \l__nju_info_supv_full_tl -{ - \l__nju_info_supv_a_tl\ - \l__nju_info_supv_a_title_tl\ \ - \l__nju_info_supv_b_tl\ - \l__nju_info_supv_b_title_tl -} -\tl_set:Nn \l__nju_info_supv_full_en_tl -{ - \l__nju_info_supv_a_title_en_tl\ - \l__nju_info_supv_a_en_tl\ \ - \l__nju_info_supv_b_title_en_tl\ - \l__nju_info_supv_b_en_tl -} -\tl_new:N \l__nju_name_degree_tl -\tl_new:N \l__nju_name_degree_en_tl -\int_compare:nTF { \g__nju_info_degree_int == 1 } -{ - % 本科 - \tl_const:Nn \c__nju_name_title_tl { 题\hfill 目 } - - \tl_const:Nn \c__nju_cover_uline_len_a_tl { 250pt } - \tl_const:Nn \c__nju_cover_uline_len_b_tl { 90pt } - \tl_const:Nn \c__nju_cover_uline_font_tl { \songti } - \tl_const:Nn \c__nju_cover_uline_style_tl { \bf } - \tl_const:Nn \c__nju_cover_uline_bskip_tl {} - - \tl_const:Nn \c__nju_cover_box_len_tl { 4.2em } - - % 本科强制不打印国家图书馆封面 - \bool_set_false:N \g__nju_nlcover_bool -} -{ - % 本科以外都是研究生 - \tl_const:Nn \c__nju_name_title_tl { 论\hfill 文\hfill 题\hfill 目 } - - \tl_const:Nn \c__nju_cover_uline_len_a_tl { 250pt } - \tl_const:Nn \c__nju_cover_uline_len_b_tl { 14em } - \tl_const:Nn \c__nju_cover_uline_font_tl { \kaishu } - \tl_const:Nn \c__nju_cover_uline_style_tl {} - \tl_const:Nn \c__nju_cover_uline_bskip_tl { \hspace{1em} } - - \tl_const:Nn \c__nju_cover_box_len_tl { 6em } -} -\cs_generate_variant:Nn \tl_map_inline:nn { xn } -\cs_new_protected:Npn \__nju_spread_box:nn #1#2 +\cs_new_protected:Npn \__nju_new_theorem:N #1 { - \mode_leave_vertical: - \hbox_to_wd:nn {#1} - { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip } + \theoremsymbol { } + \clist_map_inline:Nn #1 + { \newtheorem { ##1 } { \__nju_name:n { ##1 } } } } -\cs_new:Npn \__nju_cover_uline_a:n #1 -{ - \uline{\makebox[\c__nju_cover_uline_len_a_tl] - {\rm\c__nju_cover_uline_font_tl #1 }} -} -\cs_new:Npn \__nju_cover_uline_b:n #1 -{ - \uline{\makebox[\c__nju_cover_uline_len_b_tl] - {\rm\c__nju_cover_uline_font_tl #1 }} -} -\cs_new:Npn \__nju_cover_uline_nl:nn #1 #2 -{ - \uline{\makebox[#1] - {\rm\c__nju_cover_uline_font_tl #2 }} -} -\cs_new:Npn \__nju_cover_box:n #1 -{ - \makebox[\c__nju_cover_box_len_tl][s]{ - #1\c__nju_cover_uline_bskip_tl} -} -\cs_new_protected:Npn \__nju_cover_degree: -{ - { (申请 } - \clist_item:Nn \c__nju_name_degree_clist { \g__nju_info_degree_int } - { 学位) } -} -\cs_new_protected:Npn \__nju_cover_title_breakline: -{ - \__nju_cover_box:n {\c__nju_name_title_tl} - & \__nju_cover_uline_a:n - { \c__nju_cover_uline_style_tl \l__nju_info_title_a_tl } \\ - \tl_if_empty:NF \l__nju_info_title_b_tl +\theoremsymbol { \ensuremath { \mdwhtsquare } } +\newtheorem* { proof } { \c__nju_name_proof_tl } +\__nju_new_theorem:N \c__nju_theorem_type_clist +\cs_new_protected:Npn \__nju_split_title:n #1 { - \tl_if_empty:NTF \l__nju_info_title_c_tl + \tl_if_in:VnTF { #1 } { ! } { - & \__nju_cover_uline_a:n - {\c__nju_cover_uline_style_tl \l__nju_info_title_b_tl } \\ + \seq_set_split:NnV \l__nju_tmp_seq { ! } { #1 } + \clist_set_from_seq:NN \l__nju_tmp_clist \l__nju_tmp_seq } { - & \__nju_cover_uline_a:n - { \c__nju_cover_uline_style_tl \l__nju_info_title_b_tl } \\ - & \__nju_cover_uline_a:n - { \c__nju_cover_uline_style_tl \l__nju_info_title_c_tl } \\ + \__nju_put_inempty_seg:nnn { #1 } { 1 } { 15 } + \__nju_put_inempty_seg:nnn { #1 } { 16 } { 15 } + \__nju_put_inempty_seg:nnn { #1 } { 31 } { 15 } } } -} -\cs_new_protected:Npn \__nju_print_covertab: -{% -\int_compare:nTF { \g__nju_info_degree_int == 1 } - { - \begin{tabular}{p{4.2em}c} - \__nju_cover_box:n {院\hfill 系} - & \__nju_cover_uline_a:n {\l__nju_info_dept_tl} \\ - \__nju_cover_box:n {专\hfill 业} - & \__nju_cover_uline_a:n {\l__nju_major_tl} \\ - \__nju_cover_title_breakline: - \end{tabular}\\ - - \begin{tabular}{p{4.2em}cp{4.2em}c} - \__nju_cover_box:n {年\hfill 级} - & \__nju_cover_uline_b:n {\l__nju_info_grade_tl} - & \__nju_cover_box:n {学\hfill 号} - & \__nju_cover_uline_b:n {\l__nju_info_id_tl}\\ - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \__nju_cover_box:n {学\hfill 生\hfill 姓\hfill 名} - & \__nju_cover_uline_a:n {\l__nju_info_author_tl} - \end{tabular}\\ - \begin{tabular}{p{4.2em}cp{4.2em}c} - \__nju_cover_box:n {导\hfill 师} - & \__nju_cover_uline_b:n {\l__nju_info_supv_a_tl} - & \__nju_cover_box:n {职\hfill 称} - & \__nju_cover_uline_b:n {\l__nju_info_supv_a_title_tl}\\ - - % 第二导师 - \tl_if_empty:NF \l__nju_info_supv_b_tl +\cs_new_protected:Npn \__nju_multiline_title:nnn #1#2#3 + { + \__nju_split_title:n { \l__nju_info_title_tl } + \__nju_spread_box:nnn { #2 } { \kaishu } { \c__nju_name_title_tl } + \__nju_hskip: + \clist_map_inline:Nn \l__nju_tmp_clist + { \__nju_ulined_center_box:nn { #3 } { #1 ##1 } \__nju_vskip: } + } +\cs_new_protected:Npn \__nju_cover_entry:nnn #1#2#3 + { + \__nju_spread_box:nnn { #2 } { \kaishu } { \__nju_name:n { #1 } } + \__nju_hskip: + \__nju_ulined_center_box:nn { #3 } { \__nju_info:n { #1 } } + \__nju_vskip: + } +\cs_new_protected:Npn \__nju_cover_bientry:nnnn #1#2#3#4 + { + \__nju_spread_box:nnn { #3 } { \kaishu } { \__nju_name:n { #1 } } + \__nju_hskip: + \__nju_ulined_center_box:nn { #4 } { \__nju_info:n { #1 } } + \skip_horizontal:n { 0.5 em } + \__nju_spread_box:nnn { #3 } { \kaishu } { \__nju_name:n { #2 } } + \__nju_hskip: + \__nju_ulined_center_box:nn { #4 } { \__nju_info:n { #2 } } + \__nju_vskip: + } +\cs_new_protected:Npn \__nju_cover_title_ug: + { \__nju_spread_box:nnn { 9em } { \bf } { \l__nju_info_type_tl } } +\cs_new_protected:Npn \__nju_cover_info_ug:nnn #1#2#3 + { + \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \raggedleft + \__nju_cover_entry:nnn { dept } { #1 } { #2 } + \__nju_cover_entry:nnn { major } { #1 } { #2 } + \__nju_multiline_title:nnn { \bf } { #1 } { #2 } + \__nju_cover_bientry:nnnn { grade } { id } { #1 } { #3 } + \__nju_cover_entry:nnn { author } { #1 } { #2 } + \__nju_cover_bientry:nnnn { supv } { supv_ttl } { #1 } { #3 } + \tl_if_blank:VF { \l__nju_info_supv_ii_tl } + { \__nju_cover_bientry:nnnn { supv_ii } { supv_ttl } { #1 } { #3 } } + \__nju_cover_entry:nnn { sm_date } { #1 } { #2 } + \end{minipage} + } +\cs_new_protected:Npn \__nju_cover_title_g: + { + \__nju_spread_box:nnn { 9em } { } { \l__nju_info_type_tl } \__nju_vskip: + \c__nju_name_degree_l_tl \l__nju_info_degree_tl \c__nju_name_degree_r_tl + } +\cs_new_protected:Npn \__nju_cover_info_g:nn #1#2 + { + \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \raggedleft + \__nju_multiline_title:nnn { } { #1 } { #2 } + \clist_map_inline:nn { author, major, field, supv_full } + { \__nju_cover_entry:nnn { ##1 } { #1 } { #2 } } + \end{minipage} + } +\cs_new_protected:Npn \__nju_cover_back_g: + { + \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_id_tl } + { : \__nju_quad: } \l__nju_info_id_tl + \__nju_vskip: + \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_df_date_tl } + { : \__nju_quad: } \l__nju_info_df_date_tl + \__nju_vskip: + \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_supv_full_tl } + { : \__nju_quad: } \skip_horizontal:n { 8 em } \c__nju_name_sign_tl + } +\cs_new_protected:Npn \__nju_cover_en_g: + { + \parbox { \textwidth } + { \centering \bf \sffamily \zihao { 2 } \l__nju_info_title_en_tl } + \skip_vertical:n { 1 cm } + \group_begin: \zihao { 4 } { by } \group_end: \__nju_vskip: + \group_begin: + \bf \sffamily \zihao { 4 } \l__nju_info_author_en_tl + \group_end: \skip_vertical:n { 1 cm } + \group_begin: \zihao { 4 } { Supervised~ by } \group_end: \__nju_vskip: + \group_begin: + \sffamily \zihao { 4 } \l__nju_info_supv_full_en_tl + \group_end: \vfill + \c__nju_cover_en_text_tl \__nju_vskip: + \textsc { \clist_item:Nn \c__nju_name_degree_en_clist + { \l__nju_info_degree_int } } + \__nju_vskip: { in } \__nju_vskip: + \l__nju_info_major_en_tl \skip_vertical:n { 1 cm } + \njuemblem [ black ] { ! } { 2.5 cm } \__nju_vskip: + \l__nju_info_dept_en_tl \\ \c__nju_name_nju_en_tl + \skip_vertical:n { 1 cm } + \l__nju_info_sm_date_en_tl + } +\cs_new_protected:Npn \__nju_cover_top_nl: + { + \__nju_spread_box:nnn { 3.2 em } { } { \c__nju_name_clc_tl } \__nju_hskip: + \__nju_ulined_center_box:nn { 9 em } { \l__nju_info_clc_tl } \hfill + \__nju_spread_box:nnn { 3.2 em } { } { \c__nju_name_seclv_tl } \__nju_hskip: + \__nju_ulined_center_box:nn { 9 em } { \l__nju_info_seclv_tl } \\ + \__nju_spread_box:nnn { 3.2 em } { } { \c__nju_name_udc_tl } \__nju_hskip: + \__nju_ulined_center_box:nn { 9 em } { \l__nju_info_udc_tl } \hfill \null + } +\cs_new_protected:Npn \__nju_cover_title_nl: + { + \noindent \kaishu \zihao { -0 } \skip_vertical:n { -1 cm } + \__nju_spread_box:nnn { 6 em } { } { \c__nju_name_title_tl } + \__nju_vskip: \zihao { 1 } + \__nju_split_title:n { \l__nju_info_title_tl } + \__nju_multiline_box:nnnn { \l__nju_tmp_int } \l__nju_tmp_clist { 3 } { 15 em } + \__nju_vskip: \zihao{4} \c__nju_name_title_nl_tl + \__nju_vskip: \zihao{1} + \__nju_ulined_center_box:nn { 4.5 em } { \l__nju_info_author_tl } + \__nju_vskip: \zihao{4} { ( } \c__nju_name_author_tl { ) } + } +\cs_new_protected:Npn \__nju_cover_info_nl: + { + \__nju_uline_entry:nnnn \l__nju_tmp_dim { supv_info } { supv } { } \\ + \__nju_ulined_center_box:nn { \textwidth } { \__nju_info:n { supv_ttl } + \__nju_quad: \__nju_info:n { supv_cont } } \\ + \__nju_uline_bientry:nnnn \l__nju_tmp_dim { degree } { degree } { } + \__nju_uline_bientry:nnnn \l__nju_tmp_dim { major_nl } { major } { } \\ + \__nju_uline_bientry:nnnn \l__nju_tmp_dim { sm_date } { sm_date } { } + \__nju_uline_bientry:nnnn \l__nju_tmp_dim { df_date } { df_date } { } \\ + \__nju_full_uline:Nn \l__nju_tmp_dim { \c__nju_name_confer_tl } + \__nju_uline:n { \l__nju_tmp_dim } + } +\cs_new_protected:Npn \__nju_cover_bottom_nl: + { + \__nju_name:n { chairman } \__nju_hskip: + \__nju_ulined_center_box:nn { 9 em } { \__nju_info:n { chairman } } \\ + \__nju_name:n { reviewer } \__nju_hskip: + \__nju_multiline_box:nnnn { \l__nju_tmp_int } + { \l__nju_info_reviewer_clist } { 4 } { 9 em } + } +\cs_new_protected:Npn \__nju_make_cover_ug: + { + \newpage + \null \skip_horizontal:n { -1 cm } + \njuemblem [ black] { ! } { 3.35 cm } + \begin{center} + \njuname[black]{!}{3cm} \__nju_vskip: + \group_begin: \zihao { -1 } \__nju_cover_title_ug: \group_end: + \skip_vertical:n { 1.5 cm } \vfil + \zihao{3} \__nju_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em } \vfil + \end{center} + } +\cs_new_protected:Npn \__nju_make_cover_g: + { + \newpage + \begin{center} + \null \skip_vertical:n { 1 cm } + \njuemblem [ black ] { ! } { 1.9 cm } \skip_vertical:n { 0.5 cm } + \njuname [ black ] { 4.4 cm } { ! } \__nju_vskip: + \group_begin: + \zihao { -1 } \bf \kaishu \__nju_cover_title_g: + \group_end: + \skip_vertical:n { 3 cm } \vfil + \group_begin: + \zihao { 3 } \kaishu + \__nju_cover_info_g:nn { 6.2 em } { 18 em } \vfil + \skip_vertical:n { 2 cm } \l__nju_info_sm_date_tl + \group_end: + \end{center} + \newpage + \noindent \null \skip_vertical:n { 18 cm } + \group_begin: + \zihao { 3 } \kaishu \__nju_cover_back_g: + \group_end: + \newpage + \noindent \null \skip_vertical:n { 2 cm } + \begin{center} + \__nju_cover_en_g: + \end{center} + } +\cs_new_protected:Npn \__nju_make_cover_nl: + { + \pdfbookmark [ 0 ] { 国家图书馆封面 } { nlcover } + \noindent \null + \begin{center} + \zihao{ -4 } \skip_vertical:n { -2 cm } + \__nju_cover_top_nl: + \end{center} + \begin{center} + \skip_vertical:n { -2 cm } + \__nju_cover_title_nl: + \end{center} + \group_begin: + \kaishu \zihao { 4 } \noindent \__nju_cover_info_nl: + \group_end: + \begin{flushright} + \__nju_cover_bottom_nl: + \end{flushright} + \begin{center} + \kaishu \zihao{3} \__nju_qquad: 年 \__nju_quad: 月 \__nju_quad: 日 + \end{center} + \skip_vertical:n { -1 cm } + } +\cs_new_protected:Npn \__nju_make_orig_decl: + { + \normalfont \normalsize + \chapter* { \c__nju_name_nju_tl \c__nju_name_orig_decl_tl } + \thispagestyle { empty } + \c__nju_orig_decl_text_tl + \vfil + \begin{flushright} + \__nju_name:n { orig_sign } \__nju_uline:n { 7 em } \__nju_vskip: + \__nju_name:n { orig_date } \__nju_uline:n { 7 em } + \end{flushright} + \vfil + } +\RenewDocumentCommand \maketitle { } + { + \pagestyle{empty} + \bool_if:NTF \g__nju_nlcover_bool + { \__nju_make_cover_nl: \__nju_make_orig_decl: } + { \use:c { __nju_make_cover_ \l__nju_info_diploma_tl : } } + \tl_remove_all:Nn \l__nju_info_title_tl { ! } + \cleardoublepage + \pagestyle{plain} + \pagenumbering{Roman} + \normalfont \normalsize + } +\cs_new_protected:Npn \__nju_abs_title_uuline:n #1 + { \bf \kaishu \zihao { -2 } \__nju_uuline:n { #1 } } +\cs_new_protected:Npn \__nju_abs_info_style:n #1 + { \noindent \zihao{ #1 } \kaishu } +\cs_new_protected:Npn \__nju_abs_info_style_en: #1 { \zihao{ #1 } } +\cs_new_protected:Npn \__nju_abs_bookmark:n #1 + { + \pdfbookmark [ 0 ] + { \__nju_name:n { abstract #1 } } { abstract #1 } + } +\cs_generate_variant:Nn \clist_map_inline:nn { Vn } +\cs_new_protected:Npn \__nju_abs_title_ug:n #1 + { + \__nju_name:n { nju } \__nju_name:n { type } + \__nju_name:n { lang #1 } \__nju_name:n { abstract } + } +\cs_new_protected:Npn \__nju_abs_info_ug:nn #1#2 + { + \tl_if_blank:eTF { #1 } + { \c__nju_name_title_tl } + { \clist_item:Nn \c__nju_name_type_en_clist { \l__nju_info_type_int } } + #2 \tl_use:c { l__nju_info_title #1 _tl } \\ + \tl_set_eq:NN \c__nju_name_author_tl \c__nju_name_author_full_tl + \clist_map_inline:nn { dept, major, author, supv_full } + { \__nju_name:n { ##1 #1 } #2 \__nju_info:n { ##1 #1 } \\ } + \__nju_name:n { abstract #1 } #2 + } +\cs_new_protected:Npn \__nju_abs_title_g:n #1 + { + \__nju_name:n { nju } \__nju_info:n { type } + \__nju_name:n { lang #1 } \__nju_name:n { abstract_r } + } +\cs_new_protected:Npn \__nju_abs_info_g:nn #1#2 + { + \tl_if_blank:eTF { #1 } { - \__nju_cover_box:n {第\hfill 二\hfill 导\hfill 师} - & \__nju_cover_uline_b:n {\l__nju_info_supv_b_tl} - & \__nju_cover_box:n {职\hfill 称} - & \__nju_cover_uline_b:n {\l__nju_info_supv_b_title_tl}\\ + \__nju_full_uline:NV \l__nju_tmp_dim + { + \clist_item:Nn \c__nju_name_type_clist { \l__nju_info_type_int } + \c__nju_name_title_s_tl #2 + } + \__nju_ulined_center_box:nn { \l__nju_tmp_dim } + { \tl_range:Nnn \l__nju_info_title_tl { 1 } { 20 } } \\ + \__nju_uline:n { \textwidth } \__nju_qquad: + \tl_range:Nnn \l__nju_info_title_tl { 21 } { -1 } \\ + \__nju_full_uline:NV \l__nju_tmp_dim + { + \__nju_ulined_center_box:nn { 11 em } { \l__nju_info_major_tl } + \c__nju_name_major_s_tl + \__nju_ulined_center_box:nn { 4 em } { \l__nju_info_grade_tl } + \c__nju_name_grade_tl + \tl_item:nn { \l__nju_info_degree_tl } { 1 } + \c__nju_name_author_r_tl #2 + } + \__nju_ulined_center_box:nn { \l__nju_tmp_dim } + { \l__nju_info_author_tl } \\ + \__nju_full_uline:NV \l__nju_tmp_dim + { \c__nju_name_supv_full_tl \c__nju_name_supv_r_tl #2 } + \__nju_ulined_center_box:nn { \l__nju_tmp_dim } + { \l__nju_info_supv_full_tl } + } + { + \__nju_full_uline:NV \l__nju_tmp_dim + { \clist_item:cn { c__nju_name_type #1 _clist } + { \l__nju_info_type_int } # 2 } + \__nju_ulined_center_box:nn { \l__nju_tmp_dim } + { \tl_range:Nnn \l__nju_info_title_en_tl { 1 } { 40 } } \\ + \__nju_uline:n { \textwidth } \__nju_qquad: + \tl_range:Nnn \l__nju_info_title_en_tl { 41 } { -1 } + \clist_map_inline:nn { major, author, supv_full } + { \\ + \__nju_uline_entry:nnnn \l__nju_tmp_dim { ##1 _en } { ##1 _en } { #2 } + } } - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \__nju_cover_box:n {提\hfill 交\hfill 日\hfill 期} - & \__nju_cover_uline_a:n {\l__nju_submit_date_tl}\\ - \end{tabular} - } - { - \begin{tabular}{p{6em}c} - \__nju_cover_title_breakline: - \__nju_cover_box:n {作\hfill 者\hfill 姓\hfill 名} - & \__nju_cover_uline_a:n {\__nju_spread_box:nn {4em}{\l__nju_info_author_tl}}\\ - \__nju_cover_box:n {专\hfill 业\hfill 名\hfill 称} - & \__nju_cover_uline_a:n {\l__nju_major_tl}\\ - \__nju_cover_box:n {研\hfill 究\hfill 方\hfill 向} - & \__nju_cover_uline_a:n {\l__nju_field_tl}\\ - \__nju_cover_box:n {指\hfill 导\hfill 教\hfill 师} - & \__nju_cover_uline_a:n {\l__nju_info_supv_full_tl}\\ - \end{tabular} } -} -\cs_new_protected:Npn \__nju_print_cover_nl: -{ - \thispagestyle{empty} - \pdfbookmark[0]{国家图书馆封面}{nl} - { - % 顶端 - \noindent\null\vskip -20mm \hskip -15mm - \songti\zihao{-4} - \makebox[40pt][l]{分类号} - \__nju_cover_uline_b:n {\l__nju_info_clc_tl} - \hfill - \makebox[40pt][l]{密级} - \__nju_cover_uline_b:n {\l__nju_info_seclv_tl} - \vskip 10pt \hskip -15mm - \makebox[40pt][l]{udc} - \__nju_cover_uline_b:n {\l__nju_info_udc_tl} +\cs_new_protected:Npn \__nju_print_keywords:nn #1#2 + { + \skip_vertical:n { 2 ex } + \group_begin: + \noindent \bf \heiti + \use:c { c__nju_name_keywords #1 _tl } + \group_end: + \clist_use:cn { l__nju_info_keywords #1 _clist } { #2 } + } +\cs_new_protected:Npn \__nju_make_abs_ug:nn #1#2 + { + \begin{center} + \__nju_abs_title_uuline:n { 22 em } + \__nju_abs_title_ug:n { #1 } + \end{center} + \group_begin: + \__nju_abs_info_style:n { -4 } + \__nju_abs_info_ug:nn { #1 } { #2 } + \group_end: \__nju_vskip: + } +\cs_new_protected:Npn \__nju_make_abs_g:nn #1#2 + { + \begin{center} + \__nju_abs_title_uuline:n { 19 em } + \__nju_abs_title_g:n { #1 } + \end{center} + \group_begin: + \__nju_abs_info_style:n { 4 } + \__nju_abs_info_g:nn { #1 } { #2 } + \group_end: \__nju_vskip: } - - % 中部 - \vskip\stretch{2} - \begin{center} - \def\ULthickness{1pt} - {\kaishu\zihao{-0} 学\hspace{0.5em}位\hspace{0.5em}论\hspace{0.5em}文} - { - \kaishu\zihao{1} - \vskip \stretch{1} - \__nju_cover_uline_b:n {\l__nju_info_title_a_tl}\\ - \__nju_cover_uline_b:n {\l__nju_info_title_b_tl}\\ - \__nju_cover_uline_b:n {\l__nju_info_title_c_tl}\\ - } - \vskip \stretch{1} - {\kaishu\zihao{4}(题名和副题名)} - \vskip \stretch{1} \vskip 5mm - {\kaishu\zihao{1}\uline{\makebox{\l__nju_info_author_tl}}} - \vskip \stretch{1} - {\kaishu\zihao{4}(作者姓名)} - \end{center} - - % 底部 - \vskip\stretch{1}\kaishu\zihao{4} - \noindent 指导教师姓名、职务、职称、学位、单位名称及地址% - \__nju_cover_uline_nl:nn {94pt}{\l__nju_info_supv_a_tl}\par - \noindent \__nju_cover_uline_nl:nn {\textwidth}{% - \l__nju_info_supv_cont_tl}\par - \noindent 申请学位级别% - \__nju_cover_uline_nl:nn {9em}{\l__nju_name_degree_tl}% - \noindent 专业名称% - \uline{\hfill\l__nju_major_tl\hfill}\par - \noindent 论文提交日期% - \__nju_cover_uline_nl:nn {9em}{\l__nju_submit_date_tl}% - \noindent 论文答辩日期% - \uline{\hfill\l__nju_defend_date_tl\hfill}\par - \noindent 学位授予单位和日期\uline{\hfill}\par - \begin{flushright} - 答辩委员会主席: - \__nju_cover_uline_nl:nn {9em}{ \l__nju_info_chairman_tl }\par - 评阅人: - \__nju_cover_uline_nl:nn {9em} - { \clist_item:Nn \l__nju_info_reviewer_clist {1} }\par - \__nju_cover_uline_nl:nn {9em} - { \clist_item:Nn \l__nju_info_reviewer_clist {2} }\par - \__nju_cover_uline_nl:nn {9em} - { \clist_item:Nn \l__nju_info_reviewer_clist {3} }\par - \__nju_cover_uline_nl:nn {9em} - { \clist_item:Nn \l__nju_info_reviewer_clist {4} }\par - \end{flushright} - \begin{center} - \kaishu\zihao{3}\hspace{2em} 年\hspace{1em} 月\hspace{1em} 日 - \end{center} - \vskip -10mm - \cleardoublepage -} -\cs_new_protected:Npn \__nju_print_cover_ug: -{ - \thispagestyle{empty} - \pagenumbering{Roman} - % Start - \pdfbookmark{封面}{cover} % 将封面插入pdf书签 - \begin{spacing}{1.25} - \noindent\null\hspace{-10mm} - \njuemblem{!}{3cm}\smallskip - \begin{center} - \njuname{!}{3.35cm} - \vskip 10mm - {\zihao{1}\bf\songti\__nju_spread_box:nn {9em}{本科毕业论文}} - \vfill - \vskip\stretch{0} - {\bgroup - \kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - % 绘制信息框 - \__nju_print_covertab: - \egroup} - \vfill - \end{center} - \end{spacing} - \cleardoublepage -} -\cs_new_protected:Npn \__nju_print_cover_g: -{ - \thispagestyle{empty} - \pagenumbering{Roman} - % Start - \pdfbookmark{封面}{cover} % 将封面插入pdf书签 - \begin{spacing}{1.25} - \begin{center} - \noindent\null\vskip 5mm - \njuemblem{!}{1.9cm} - \vskip 10mm - \njuname{4.4cm}{!} - \par\vskip -2mm - \njuname*{4.4cm}{!} - \vskip 15mm - \bgroup - \zihao{1}\bf\kaishu - \__nju_spread_box:nn {10em}{研究生毕业论文} - \vskip 5mm - \__nju_cover_degree: - \egroup - \par\vfill\vskip\stretch{0} - \bgroup - \bf\kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - \vskip 10mm - \__nju_print_covertab: - \egroup - \vfill - \vskip 10mm - \bf\kaishu\zihao{4}\l__nju_submit_date_tl - \vskip 15mm - \end{center} - \end{spacing} - - \newpage % 封面背面 - \thispagestyle{empty} - \begin{spacing}{1.625} - % TODO: 等待调整格式 - \null\vfill - {\bgroup - \kaishu\zihao{3} - \makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\l__nju_info_id_tl} - \par - \makebox[6em][s]{\bf\kaishu 论文答辩日期}:\l__nju_defend_date_tl - \par - \makebox[6em][s]{\bf\kaishu 指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字) - \par - \egroup} - \vskip 15mm - \end{spacing} - \cleardoublepage - - \thispagestyle{empty} - \pdfbookmark{英文封面}{cover-en} % 将封面插入pdf书签 - \begin{center} - \noindent\vspace*{20pt} - \bf\sffamily\zihao{2}\l__nju_info_title_en_tl - \vskip \stretch{1} - \normalfont\rmfamily\zihao{4}{by} - \vskip 3pt - \bf\sffamily\zihao{4}\l__nju_info_author_en_tl - \vskip\stretch{1} - \normalfont\rmfamily\zihao{4}{Supervised~by} - \vskip 3pt - \normalfont\sffamily\zihao{4} - \l__nju_info_supv_a_title_en_tl - \hspace{.5em}\l__nju_info_supv_a_en_tl\\ - \l__nju_info_supv_b_title_en_tl - \hspace{.5em}\l__nju_info_supv_b_en_tl - \vskip\stretch{1} - \normalsize\rmfamily{ - A~dissertation~submitted~to\\ - the~graduate~school~of~Nanjing~University\\ - in~partial~fulfilment~of~the~requirements~for~the~degree~of\\ - \textsc{ - \clist_item:Nn \c__nju_name_degree_en_clist { \g__nju_info_degree_int } - }\\ - in\\ - {\l__nju_major_en_tl} - } - \vskip\stretch{2} - \njuemblem{2.5cm}{!}\par - \vskip 3mm - \normalfont\l__nju_info_dept_en_tl\\ - {Nanjing~University} - \vskip 30pt - \normalfont\normalsize\l__nju_submit_date_en_tl - \end{center} - \normalfont - \cleardoublepage -} -\tl_set:Nn \maketitle -{ - \bool_if:NT \g__nju_nlcover_bool { \__nju_print_cover_nl: } % 国家图书馆封面 - \use:c { __nju_print_cover_ \g__nju_info_diploma_tl : } -} -\cs_new_protected:Npn \__nju_print_keywords: -{ - \par\vspace{2ex} - \bgroup - \noindent - \c__nju_name_keywords_tl - \clist_use:Nn \l__nju_info_keywords_clist {;} - \par - \egroup -} -\cs_new_protected:Npn \__nju_print_keywords_en: -{ - \par\vspace{2ex} - \bgroup - \noindent - \c__nju_name_keywords_en_tl\hspace{0.5em} - \clist_use:Nn \l__nju_info_keywords_en_clist {;} - \par - \egroup -} -\cs_new_protected:Npn \__nju_print_abstract_ug: -{ - \thispagestyle{plain} - \pdfbookmark[0]{中文摘要}{abstract-zh} - \begin{center} - \kaishu\zihao{-2}{\textbf{ - \uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}} - \end{center} - \bgroup - \noindent\kaishu\zihao{-4} - 题目: \l__nju_info_title_tl \\ - 院系: \l__nju_info_dept_tl \\ - 专业: \l__nju_major_tl \\ - 本科生姓名: \l__nju_info_author_tl \\ - 指导教师(姓名、职称):\l__nju_info_supv_full_tl \\ - 摘要: - \egroup - \kaishu\zihao{-4}\par% -} -\cs_new_protected:Npn \__nju_print_abstract_en_ug: -{ - \thispagestyle{plain} - \pdfbookmark[0]{英文摘要}{abstract-en} - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{ - 南京大学本科生毕业论文(设计、作品)英文摘要}}} - \end{center} - { - \bgroup - THESIS: ~~\l__nju_info_title_en_tl \\ - DEPARTMENT: ~~\l__nju_info_dept_en_tl \\ - SPECIALIZATION: ~~\l__nju_major_en_tl \\ - UNDERGRADUATE:~~\l__nju_info_author_en_tl \\ - MENTOR:~~\l__nju_info_supv_full_en_tl \\ - ABSTRACT: - \egroup - } - \zihao{-4}\par% -} -\cs_new_protected:Npn \__nju_print_abstract_g: -{ - \thispagestyle{plain} - \pdfbookmark[0]{中文摘要}{abstract-zh} - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{ - 南京大学研究生毕业论文中文摘要首页用纸}}} - \end{center} - \bgroup - \noindent\kaishu\zihao{4} - 毕业论文题目:\hspace{0.5em}\njuline{\l__nju_info_title_tl\hfill}\\ - \njuline{\makebox[11em]{\l__nju_major_tl}}专业 - \njuline{\makebox[4em]{\l__nju_info_grade_tl}}级 - \int_compare:nTF { \g__nju_info_degree_int == 4} { 博 } { 硕 } - 士生姓名:\njuline{\hfill\l__nju_info_author_tl\hfill}\\ - 指导教师(姓名、职称):\njuline{\hfill\l__nju_info_supv_full_tl\hfill}\par - \egroup - \kaishu\zihao{4}\par% -} -\cs_new_protected:Npn \__nju_print_abstract_en_g: -{ - \thispagestyle{plain} - \pdfbookmark[0]{英文摘要}{abstract-en} - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{ - 南京大学研究生毕业论文英文摘要首页用纸}}} - \end{center} - { - \bgroup - \zihao{4} - THESIS: ~~\l__nju_info_title_en_tl \\ - SPECIALIZATION: ~~\l__nju_major_en_tl \\ - POSTGRADUATE:~~\l__nju_info_author_en_tl \\ - MENTOR:~~\l__nju_info_supv_full_en_tl\par - \egroup - } - \zihao{4}\par% -} \NewDocumentEnvironment{abstract} { +b } - { \use:c { __nju_print_abstract_ \g__nju_info_diploma_tl : } #1 } - { \__nju_print_keywords: \newpage } + { + \newpage + \__nju_abs_bookmark:n { } + \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { } { : } + \group_begin: \normalfont \zihao { -4 } #1 + } + { \__nju_print_keywords:nn { } { ; } \group_end: } \NewDocumentEnvironment{abstract*} { +b } - { \use:c { __nju_print_abstract_en_ \g__nju_info_diploma_tl : } #1 } - { \__nju_print_keywords_en: \cleardoublepage } + { + \newpage + \__nju_abs_bookmark:n { _en } + \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { _en } { :~ } + \group_begin: \normalfont \zihao{ -4 } #1 + } + { \__nju_print_keywords:nn { _en } { ;~ } \group_end: } +\NewDocumentEnvironment{preface} { +b } + { \njuchapter { 前\hspace{2em}言 } #1 } { } +\NewDocumentEnvironment{acknowledgement} { +b } + { \njuchapter { 致\hspace{2em}谢 } #1 } { } +\NewDocumentCommand\njupaperlist { t* m } + { + \begin{refsection} + \nocite{#2} + \bool_if:NTF { #1 } + { \printbibliography[heading=subbibliography,title=合作文章目录] } + { \printbibliography[heading=subbibliography,title=发表文章目录] } + \end{refsection} + } \endinput %% %% End of file `njuthesis.cls'. |