Skip to content
Snippets Groups Projects
njuthesis.dtx 287 KiB
Newer Older
% \iffalse meta-comment
% !TeX program  = XeLaTeX
% !TeX encoding = UTF-8
Yu Xiong's avatar
Yu Xiong committed
% Copyright (C) 2021 - 2022
% by Nanjing University Linux User Group
% <git+nju-lug-email-3104-issue-@yaoge123.cn>
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
Yu Xiong's avatar
Yu Xiong committed
% license or (at your option) any later version. The latest version
% of this license is in the file
%    https://www.latex-project.org/lppl.txt
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Yu Xiong.
%
% This work consists of the files njuthesis.dtx,
%           and the derived files njuthesis.ins,
%                                 njuthesis.cls,
%                                 njuthesis-undergraduate.def,
%                                 njuthesis-graduate.def,
%                                 njuthesis.pdf,
%                             and README.md.
%
% -----------------------------------------------------------------------
% The development version of the template can be found at
%    https://github.com/nju-lug/NJUThesis
%
% for those people who are interested.
%
%<*internal>
\iffalse
%</internal>
%
%<*internal>
\fi
\begingroup
  \def\NameOfLaTeXe{LaTeX2e}
\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else
\csname fi\endcsname
%</internal>
%
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse

\preamble

Yu Xiong's avatar
Yu Xiong committed
Copyright (C) 2021 - 2022
by Nanjing University Linux User Group
<git+nju-lug-email-3104-issue-@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.

Yu Xiong's avatar
Yu Xiong committed
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}}
Yu Xiong's avatar
Yu Xiong committed
    \file{\jobname-undergraduate.def} {\from{\jobname.dtx}{def-u}}
    \file{\jobname-graduate.def}      {\from{\jobname.dtx}{def-g}}
    \file{\jobname-postdoctoral.def}  {\from{\jobname.dtx}{def-p}}
%<*internal>
  \usedir{source/latex/njuthesis}
    \file{\jobname.ins}               {\from{\jobname.dtx}{install}}
%</internal>
}

\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-graduate.def                                *}
\Msg{*     njuthesis-postdoctoral.def                            *}
\Msg{*     njuthesis-undergraduate.def                           *}
\Msg{*     njuthesis.ins                                         *}
\Msg{*                                                           *}
\Msg{* To produce the documentation, run the file njuthesis.dtx  *}
\Msg{* through XeLaTeX.                                          *}
\Msg{*                                                           *}
\Msg{* Happy TeXing!                                             *}
\Msg{*                                                           *}
\Msg{*************************************************************}

\endbatchfile
%</install>
%
%<*internal>
\fi
%</internal>
%
% ^^A 故意留白
% ^^A 故意留白
%
%<class>\NeedsTeXFormat{LaTeX2e}
%<*!(driver|install)>
% ^^A 诚耀百廿,雄创一流
% ^^A 南京大学一百二十周年华诞邀您共襄盛举!
%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.0.1 2022-08-20 00:00:00
%<+!driver>  +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$
%<class>  {Thesis template for Nanjing University}
%<class>\ProvidesExplClass{njuthesis}
Yu Xiong's avatar
Yu Xiong committed
%<def-u>  {Undergraduate definition file for njuthesis}
%<def-u>\ProvidesExplFile{njuthesis-undergraduate.def}
%<def-g>  {Graduate definition file for njuthesis}
%<def-g>\ProvidesExplFile{njuthesis-graduate.def}
%<def-p>  {Postdoctoral definition file for njuthesis}
%<def-p>\ProvidesExplFile{njuthesis-postdoctoral.def}
%<!driver>  {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
%</!(driver|install)>
\ProvidesFile{njuthesis.dtx}
\documentclass[fontset=fandol]{ctxdoc}
\usepackage{listings,njuvisual,tabularray,unicode-math,xeCJKfntef,zhlineskip}
\usepackage[firstpage=true]{background}
Yu Xiong's avatar
Yu Xiong committed
\backgroundsetup{
  contents={\njuemblem[white!85!gray]{22cm}{!}},
  scale=1, angle=0, hshift=-4cm
}
Yu Xiong's avatar
Yu Xiong committed
\definecolor{olgreen}{HTML}{138a07}
\renewcommand\emph[1]{\CJKunderdot[textformat=\itshape]{#1}}
Yu Xiong's avatar
Yu Xiong committed
\newcommand\olbutton[1]{\textcolor{olgreen}{\bfseries #1}}
\newcommand\tikzlogo{Ti\emph{k}Z}
\newcommand\OPT[1]{\textcolor{njuyellow}{\bfseries#1}}
atxy's avatar
atxy committed
\hypersetup{
  pdftitle  = {
    The njuthesis class -
    LaTeX thesis template for Nanjing University},
  citecolor = njublue,
  linkcolor = njuviolet,
  urlcolor  = njumagenta}
\UseTblrLibrary{booktabs,diagbox,siunitx}
\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable}
\SetTblrStyle{caption-tag}{font=\bfseries}
Yu Xiong's avatar
Yu Xiong committed
\SetTblrInner{row{1}={font=\bfseries}}
\SetTblrInner[talltblr]{row{1}={font=\bfseries}}
\DefTblrTemplate{caption-sep}{default}{\quad}
Yu Xiong's avatar
Yu Xiong committed
\def\TA{\TblrNote{a}}
\def\TB{\TblrNote{b}}
\def\TC{\TblrNote{c}}
\def\TD{\TblrNote{d}}
\def\TE{\TblrNote{e}}
\def\TL{\TeX~Live}
\def\MacTeX{Mac\TeX}
\def\biber{\hologo{biber}}
\def\LaTeXe{\hologo{LaTeX2e}}
atxy's avatar
atxy committed
\SetTextEnvironmentSinglespace{1.112}
\SetMathEnvironmentSinglespace{1.112}
\setsansfont{LexendDeca}
\setmonofont{Iosevka}[
  UprightFont = Iosevka Light,
  ItalicFont  = Iosevka Light Italic,
  BoldFont    = Iosevka Semibold
]
\setCJKmainfont{Source Han Serif SC}[
  UprightFont = Source Han Serif SC SemiBold,
  ItalicFont  = Source Han Serif SC Bold,
  BoldFont    = Source Han Serif SC Heavy,
  Language    = Chinese Simplified
]
\setmathfont{XITSMath-Regular}[
  BoldFont = XITSMath-Bold,
  Extension = .otf]
\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    = {(*}{*)},
    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{nju-cs-green}
  }
\lstdefinestyle{style@latex}
  {
    style      = style@base,
    rulecolor  = \color{njublue},
    language   = [LaTeX]TeX,
Yu Xiong's avatar
Yu Xiong committed
    alsoletter = {*, -, .},
    texcsstyle = *\color{njuviolet},
    emphstyle  = [1]\color{nju-ai-orange},
    emphstyle  = [2]\color{nju-cs-green},
    emphstyle  = [3]\bfseries\color{njuyellow}
  }
\lstnewenvironment{shellexample}[1][]{%
  \lstset{style=style@shell, #1}}{}
\lstnewenvironment{latexexample}[1][]{%
  \lstset{style=style@latex, #1}}{}
\makeatletter
\ExplSyntaxOn
Yu Xiong's avatar
Yu Xiong committed
\colorlet    {    at@guard } { njuviolet }
\definecolor { angle@guard } { gray } { 0.7 }
Yu Xiong's avatar
Yu Xiong committed
\definecolor {  star@guard } { rgb  } { 0.8 , 0 , 0 }
\definecolor { u@guard } { HTML } { 5463FF }
Yu Xiong's avatar
Yu Xiong committed
\definecolor { g@guard } { HTML } { 2B7A0B }
\definecolor { p@guard } { HTML } { FF1818 }
Yu Xiong's avatar
Yu Xiong committed
\definecolor { c@guard } { HTML } { FFC300 }
\clist_const:Nn \c__njudoc_module_color_clist
  {
    { def-u } { u@guard },
    { def-g } { g@guard },
    { def-p } { p@guard },
    { class } { c@guard }
  }
\cs_new_protected:Npn \__njudoc_compare_module:nnn #1#2#3
  { \str_if_eq:nnT {#1} {#2} { \color {#3} #1 } }
\cs_new_protected:Npn \__njudoc_set_module_color:n #1
  {
    \clist_map_inline:Nn \c__njudoc_module_color_clist
      { \__njudoc_compare_module:nnn {#1} ##1 }
  }
atxy's avatar
atxy committed
\cs_new_protected:Npn \__njudoc_module_angle:Nn #1#2
  {
    \group_begin: \color { angle@guard }    \ttfamily \textlangle \group_end:
    \group_begin: \sffamily #2 \group_end:
    \group_begin: \color { angle@guard } #1 \ttfamily \textrangle \group_end:
  }
\cs_set_protected:Npn \__ctxdoc_module_angle:n #1
  { \__njudoc_module_angle:Nn \c_empty_tl {#1} }
\cs_new_protected:Npn \__njudoc_colored_module_angle:NN #1#2
  {
    \seq_clear:N #2
    \seq_map_inline:Nn #1
      {
        \seq_gput_right:Nn #2
          { \__njudoc_set_module_color:n {##1} }
      }
  }
\cs_new_protected:Npn \__njudoc_print_module:n #1
  {
    \__njudoc_colored_module_angle:NN \l_tmpa_seq \l_tmpb_seq
    \bool_lazy_or:nnTF
      { \str_if_empty_p:n { #1 } }
      { \int_compare_p:n { \seq_count:N \l_tmpb_seq = 1 } }
      {
        \str_clear:N \l_tmpa_str
        \str_clear:N \l_tmpb_str
      }
      {
        \str_set:Nn  \l_tmpa_str { ( }
        \str_set:Nn  \l_tmpb_str { ) }
      }
atxy's avatar
atxy committed
    \__njudoc_module_angle:Nn \l_tmpb_str
      {
        \color { star@guard  } #1
        \color { angle@guard } \l_tmpa_str
        \seq_use:Nn \l_tmpb_seq
          { \color { angle@guard } \orbar }
      }
  }
\cs_new_protected_nopar:Npn \__njudoc_split_pm:n #1
  { \seq_set_split:Nnn \l_tmpa_seq { | } {#1} }
\cs_new_protected_nopar:Npn \__njudoc_split_m:n #1
  {
    \tl_set:Nn \l_tmpa_str {#1}
    \clist_map_inline:nn { *, /, (, ) }
      { \str_remove_all:Nn \l_tmpa_str {##1} }
    \seq_set_split:NnV \l_tmpa_seq { | } \l_tmpa_str
  }
\group_begin:
  \char_set_catcode_active:N \>
  \cs_gset_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop
    {
      \__ctxdoc_output_module:nn
        { \__njudoc_split_m:n {#1} }
        { \__ctxdoc_module_push:n { \__njudoc_print_module:n { * } } }
      \__ctxdoc_output_line:n {#2}
      \__ctxdoc_star_format:
    }
  \cs_gset_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop
    {
      \__ctxdoc_output_module:nn
        { \__njudoc_split_m:n {#1} }
        { \__ctxdoc_module_pop:n { \__njudoc_print_module:n { / } } }
      \__ctxdoc_output_line:n {#2}
      \__ctxdoc_slash_format:
    }
  \cs_gset_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop
    {
      \tex_noindent:D
      \hbox_overlap_left:n
        {
          \__ctxdoc_output_module:nn
            { \__njudoc_split_pm:n {#1} }
            { \__njudoc_print_module:n { } }
          \skip_horizontal:n { \leftskip + \smallskipamount }
        }
      \group_begin:
        \__ctxdoc_pm_format:
        \__ctxdoc_output_line:n {#2}
      \group_end:
    }
\group_end:
atxy's avatar
atxy committed
\NewDocumentCommand \grd { m }
  { \__ctxdoc_module_angle:n { \color { njuviolet } #1 } }
\NewDocumentCommand \sgrd { m }
  { \__ctxdoc_module_angle:n { \color { star@guard } * \color{ c@guard } #1 } }
\NewDocumentCommand \pgrd { m }
  { \__ctxdoc_module_angle:n { \color { #1 @guard } def- #1 } }
\ExplSyntaxOff
\makeatother
\begin{document}
  \DocInput{njuthesis.dtx}
Yu Xiong's avatar
Yu Xiong committed
  \PrintChanges
\end{document}
%</driver>
% \fi
%
Yu Xiong's avatar
Yu Xiong committed
% \title{\color{njuviolet}{The \cls{njuthesis} class\\
%   \textbf{南京大学学位论文模板}}}
Yu Xiong's avatar
Yu Xiong committed
% \author{^^A
Yu Xiong's avatar
Yu Xiong committed
% 南京大学 Linux 用户组
Yu Xiong's avatar
Yu Xiong committed
% \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn}
%   {git+nju-lug-email-3104-issue-@yaoge123.cn}}}
% \date{v1.0.1 \quad 2022-08-10}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.1}{2021/09/04}{开始开发。}
% \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。}
% \changes{v0.3}{2021/09/09}{使用自动构建工具进行测试。}
% \changes{v0.4}{2021/09/09}{将个人信息使用内置命令输入。}
% \changes{v0.5}{2021/09/10}{新增了对第二导师的支持。}
% \changes{v0.6}{2021/09/10}{封装个人信息}
% \changes{v0.6}{2021/09/10}{实现自动打包发布。}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.7}{2021/09/11}{增加对研究生模板的支持}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.7}{2021/09/12}{将 \cls{njuthesis} 发布在 CTAN。}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.8}{2021/09/12}{修复已知问题,进行公开宣传。}
% \changes{v0.9}{2021/09/15}{使用 DocStrip 合并模板文件。}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.9}{2021/09/15}{大幅度修改宏名称以符合 \LaTeX3 规范。}
% \changes{v0.9}{2021/09/15}{进一步完善文档。}
Yu Xiong's avatar
Yu Xiong committed
% \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}{优化了编译速度。}
% \changes{v0.13}{2021/12/15}{适配2022届本科生毕业毕业论文(设计)规范。}
% \changes{v0.13}{2021/12/16}{默认不加载 \pkg{listings} 宏包。}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.14}{2022/01/13}{将本模板内嵌入南大 \TeX{} 网站。}
% \changes{v0.16}{2022/03/01}{分离本科生和研究生模板配置。}
% \changes{v0.19}{2022/05/23}{对研究生普通封面进行若干细节修改。}
% \changes{v0.19}{2022/05/23}{对国家图书馆封面进行若干细节修改。}
% \changes{v0.20}{2022/06/08}{更正本科生模板部分字样。}
% \changes{v1.0}{2022/06/29}{移除毕业设计封面。}
% \changes{v1.0}{2022/07/05}{按类型重命名变量。}
% \changes{v1.0}{2022/07/23}{新增博士后出站报告模板。}
% \changes{v1.0}{2022/07/28}{在手册中以不同颜色指示不同模块。}
% \changes{v1.0}{2022/08/02}{删除 \LaTeX 基础用法的说明。}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{abstract}
% \cls{njuthesis} 是制作南京大学本科生毕业论文、研究生学位论文、博士后出站报告的
% \LaTeX 文档类。本模板基于本科生院的论文撰写规范制作,同时参考研究生院提供的硕士、
% 博士学位材料包,用于生成符合南京大学排版要求和相应的国家规范、行业标准的学位论
% 文,力求通过 \LaTeX3 语法实现清晰的实现逻辑、较高的可定制性以及友好的用户接口。
Yu Xiong's avatar
Yu Xiong committed
% \end{abstract}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \def\abstractname{Abstract}
% \begin{abstract}
Yu Xiong's avatar
Yu Xiong committed
% The \cls{njuthesis} class is intended for typesetting Nanjing University
Yu Xiong's avatar
Yu Xiong committed
% dissertations with \LaTeX, providing support for bachelor, master,
% doctoral theses as well as postdoctoral reports.
Yu Xiong's avatar
Yu Xiong committed
% \end{abstract}
%
Yu Xiong's avatar
Yu Xiong committed
% \vspace{2cm}
Yu Xiong's avatar
Yu Xiong committed
% \def\abstractname{特别声明}
% \begin{abstract}
% 在使用本模板时,我们默认您同意以下内容:
% \begin{enumerate}
%   \item 本模板通过 LPPL 1.3c 协议开放源代码,您可以随意使用编译出的 PDF 文件。
Yu Xiong's avatar
Yu Xiong committed
%   \item 本模板与学校官方部门并不存在合作关系,
%         作者不对使用本模板产生的格式审查问题负责。
%   \item 遇到本文档没有覆盖的问题属于正常情况,欢迎提交反馈意见。
% \end{enumerate}
Yu Xiong's avatar
Yu Xiong committed
% 我们的 \href{https://git.nju.edu.cn/nju-lug/lug-introduction}
%   {Linux 用户组}始终欢迎您的加入!
Yu Xiong's avatar
Yu Xiong committed
% \end{abstract}
%
Yu Xiong's avatar
Yu Xiong committed
% \clearpage
Yu Xiong's avatar
Yu Xiong committed
%
% \setcounter{tocdepth}{4}
Yu Xiong's avatar
Yu Xiong committed
% \tableofcontents
% \begin{documentation}
Yu Xiong's avatar
Yu Xiong committed
% \section{模板介绍}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \cls{njuthesis},即南京大学学位论文模板,是一个由南京大学 Linux
Yu Xiong's avatar
Yu Xiong committed
% 用户组维护的,用于处理本校学生毕业论文排版需求的 \LaTeX 模板。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% 本模板使用的本科生毕业论文模板格式依据
% 《关于启动南京大学2022届本科毕业论文(设计)工作的通知》\cite{nju-bachelor-2022},
% 研究生学位论文格式依据研究生院提供的材料包\cite{nju-master-2022,nju-doctor-2022}。
% 博士后出站报告格式要求与博士学位论文一致\cite{nju-postdoc-2022},
% 封面、摘要的设计参考了部分既有报告。
Yu Xiong's avatar
Yu Xiong committed
%
% \subsection{开始之前}
% \label{subsec:first-things-first}
Yu Xiong's avatar
Yu Xiong committed
% 在本文正式介绍 \cls{njuthesis} 论文模板前,您也许并不熟悉 \TeX{}
% 排版系统。话不多说,请先按部就班体验一遍下述的工作流程:
% \fcolorbox{olgreen}{gray!5}{\parbox{\textwidth-5em}{%
% \hspace{2em}\begin{minipage}[c]{10cm}
% \begin{enumerate}
Yu Xiong's avatar
Yu Xiong committed
%   \item 访问 \url{https://tex.nju.edu.cn}
%   \item 点击右上角~\olbutton{注册}~按钮,
%        用\href{https://itsc.nju.edu.cn/1b/ce/c21586a334798/page.htm}
%        {南大邮箱}注册账号
%   \item 登录您的账号
%   \item 点击左上角~\olbutton{创建新项目}~按钮,选择~\olbutton{论文模板}
%   \item 随意取名,点击~\olbutton{创建}~按钮
% \end{enumerate}
% \end{minipage}}}
Yu Xiong's avatar
Yu Xiong committed
% 稍等片刻,您会在浏览器右侧发现一份新生成的空白论文。
% 如果它的效果令您满意,不妨以本模板为基础开始写作。
%
% \subparagraph{我一定要体验上述流程吗?}
Yu Xiong's avatar
Yu Xiong committed
% 是,但也不一定。有人坚持认为应该做一些\emph{直观、清晰、有手就行、一
% 条路走到底}的教程,而不是\emph{长篇累牍的精细介绍},其核心论据在于:
% 现代人类总体上需要快速取得成就感,而且大部分可能用到本模板的同学不
% 会具备必要的基础知识。反驳的观点在于过分简单的实验总是浪费时间的,
% 尤其是在您可能早已掌握基本用法的情况下。但,不论如何,这番操作总会
% 使您预览到 \cls{njuthesis} 论文模板的实际样式。
%
% \subparagraph{我并没有见到理想的结果。}
Yu Xiong's avatar
Yu Xiong committed
% 具体是哪里不满意?如果是\emph{样式存在偏差},请联系模板的作者;如果
% \emph{不能访问前文提到的在线编译网站},请考虑检查网络连接,依次咨询
% 本校\href{https://itsc.nju.edu.cn}{信息化管理建设服务中心}和该网站
% 的维护者\href{mailto:my@yaoge123.cn}{姚舸老师};如果\emph{报错},请
% 点击左上角的菜单按钮,查看编译器是否显示为 |XeLaTeX|;
% 再如果\emph{还有其他原因},通过这几分钟的实验我们也可以得到一个极其
Yu Xiong's avatar
Yu Xiong committed
% 有益的结论:\emph{也许 Word 模板更加适合您}。这可以节省下熟悉
Yu Xiong's avatar
Yu Xiong committed
% \TeX{} 排版软件使用方法所需的可观时间。
Yu Xiong's avatar
Yu Xiong committed
% \subparagraph{但我依然对 \LaTeX 一无所知!}
% 这意味着您真的得花些时间在\emph{长篇累牍的精细介绍}上。
% 如果您已经下定决心,请接着向后阅读,有需要时善用搜索引擎。
% \subsection{历史沿革}
% 十几年来,多位热心校友发布过自己编写的模板,在 GitHub 网站上可考的包括:
% \begin{enumerate}
Yu Xiong's avatar
Yu Xiong committed
%   \item 杨文博(\href{http://yangwenbo.com/}{@solrex})的
%        njuthesis(2010 - 2018) \cite{wenboyang2013}
%   \item \href{https://github.com/fireblue}{@fireblue} 基于杨文博模板的
%        NJUThesis(2013)\cite{fireblue2013}
%   \item \href{https://github.com/wenhai-zheng}{@wenhai-zheng} 的
%        NJUThesis(2013)\cite{wenhai-zheng2013}
%   \item 曹增乐(\href{https://github.com/ZLCao}{@ZLCao})的
%        NJUBachelor(2013 - 2016)\cite{zenglecao2013}
%   \item 胡海星(\href{http://haixing-hu.github.io/}{@Haixing-Hu})的
%        NJU-Thesis(2013 - 2018)\cite{haixinghu2013}
%   \item 张楚珩(\href{https://github.com/zhangchuheng123}{@zhangchuheng123})
%        基于胡海星模板的 NJUThesis(2016)\cite{chuhengzhang2016}
%   \item 蒋炎岩(\href{http://ics.nju.edu.cn/~jyy/}{@jiangyy})的
%        njuthesis(2017 - 2019)\cite{yanyanjiang2017}
%   \item \href{https://github.com/njuHan}{@njuHan} 基于胡海星模板的
%        NJU-Thesis(2018 - 2021)
%   \item 饶安逸(\href{https://anyirao.com/}{@AnyiRao})基于张楚珩模板的
%        NJU Thesis 2018(2018)\cite{anyirao2018}
%   \item 赵懿晨(\href{https://fengchendian.github.io/about.html}
%        {@FengChendian})基于饶安逸模板的
%        NJU Thesis 2021(2021)\cite{yichenzhao2021}
% \end{enumerate}
% 至于不幸而未进行代码版本管理的,甚至于说以压缩包形式流传于各人硬盘中的,就更不可计数了。
%
Yu Xiong's avatar
Yu Xiong committed
% 与其让一千个学生做一千种不同的模板,不如有人牵起头来,集中力量办大事。因此,南
% 京大学 Linux User Group 的有志之士在2021年暑期联合起来,参考以上的现成模板,兼
% 顾友校 \cls{fduthesis}\cite{fduthesis}、\textsc{THuThesis}\cite{thuthesis} 等
Yu Xiong's avatar
Yu Xiong committed
% 优秀项目,构建了这一全新模板,力求通过 \LaTeX3 语法和清晰的接口实现良
% 好的易用性和可维护性。
% 目前,本模板的主要维护者包括:
% \begin{itemize}
Yu Xiong's avatar
Yu Xiong committed
%   \item 赵懿晨
%   \item 熊煜
%   \item 马畅
Yu Xiong's avatar
Yu Xiong committed
%
% \subsection{快速上手}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \LaTeX 并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听
Yu Xiong's avatar
Yu Xiong committed
% 到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须
Yu Xiong's avatar
Yu Xiong committed
% 要面对的情况。目前,中文互联网上的 \LaTeX 写作教程可谓汗牛充栋,然而
% 如何快速准确找到所需要的用法,尤其是 \LaTeX3 的新接口,需要一定的时间
Yu Xiong's avatar
Yu Xiong committed
% 或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您
% 的相关知识体系,只能\emph{尽力做到有求必应},在需要的地方顺带提一嘴,以期使您
% 少走点弯路。
Yu Xiong's avatar
Yu Xiong committed
%
% 如果您希望在使用本模板前了解一些关于这个排版软件的基础知识,在此尝试列举一些有
% 所帮助的资料:
Yu Xiong's avatar
Yu Xiong committed
% \begin{description}
%   \item[\textit{lshort}] 著名的介绍文档,已被译为多种语言,可以参考英文版
%                          \cite{lshort}及其中文翻译版\cite{lshort-zh-cn}。
Yu Xiong's avatar
Yu Xiong committed
%   \item[《\LaTeX 入门》] 刘海洋著\cite{刘海洋2013latex入门}。
Yu Xiong's avatar
Yu Xiong committed
% \end{description}
%
%
% \subsection{关于本说明手册}
%
Yu Xiong's avatar
Yu Xiong committed
% 本模板通过 \textsc{DocStrip} 进行维护,实际上是一种\emph{文学编程}。文学编程的
% 本体是那些用来说明的文字,按写书写文章的方式组织。\file{njuthesis.dtx} 包含
% \cls{njuthesis} 文档类的所有信息。前半部分为模板说明,即各种常用命令与必要的使
Yu Xiong's avatar
Yu Xiong committed
% 用方法;后半部分为代码实现,为带有详细注释的 \TeX{} 源代码。后者配合附
Yu Xiong's avatar
Yu Xiong committed
% 录,为有意了解本模板实现细节的同学提供必要指引。
Yu Xiong's avatar
Yu Xiong committed
% 下文中将出现若干特殊格式,用来指示代码组件。譬如,无衬线字体的
% \pkg{pkg-example} 为宏包名,等宽字体的 \file{file-example.xxx} 为文件名,等宽
Yu Xiong's avatar
Yu Xiong committed
% 字体的 \opt{opt-example} 为选项名,等宽字体的 \env{env-example} 为需要
Yu Xiong's avatar
Yu Xiong committed
%  |\begin{}|和|\end{}|的环境名,等。本手册提供的代码示例中,左侧边线呈现南大标
% 准洋红色 {\color{njumagenta}$\blacksquare$} 的属于终端命令,呈南大标准蓝色
Yu Xiong's avatar
Yu Xiong committed
% {\color{njublue}$\blacksquare$} 的属于 \LaTeX 源代码。
Yu Xiong's avatar
Yu Xiong committed
%
%
% \subsection{许可说明}
%
% \file{njuthesis.dtx} 文件以及由其直接产生的所有文件被称为
% \cls{njuthesis} 文档类,或者在本文中简称为本模板。
%
% \subparagraph{版权信息}
Yu Xiong's avatar
Yu Xiong committed
%   本模板之版权隶属于 © 2021 - 2022 南京大学 Linux 用户组。
%
% \subparagraph{发布和修改}
%   本模板的发布和(或)修改遵守 LaTeX Project Public License(版本 1.3c 或更高)
% 的条款。该许可证的最新版本位于 \url{http://www.latex-project.org/lppl.txt},
% 1.3c 及更新的版本随附于 2003/12/01 版本以后的所有 \LaTeX 发行版。
%
% \subparagraph{联系作者}
%   如果您在使用最新版模板时发现了任何问题,抑或有意向参与本模板的维护,
% 请通过 \href{https://github.com/nju-lug/NJUThesis/issues}{GitHub Issue}
% 或者 QQ 群聊\footnote{群号是 991559926。}联系 NJU LUG。
% \section{安装}
Yu Xiong's avatar
Yu Xiong committed
% \label{sec:setup}
Yu Xiong's avatar
Yu Xiong committed
% 本节主要介绍本宏包的获取、安装以及编译方式。
Yu Xiong's avatar
Yu Xiong committed
% \subsection{获取模板}
% \cls{njuthesis} 目前处于积极的维护中,主要可通过以下三种途径获取模板文件:
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subparagraph{CTAN}
Yu Xiong's avatar
Yu Xiong committed
% \href{https://ctan.org/}{CTAN}\footnote{The Comprehensive \TeX{}
% Archive Network} 是所有 \TeX{} 相关材料的中枢。
Yu Xiong's avatar
Yu Xiong committed
% 本模板的 CTAN 页面
% \footnote{\href{https://ctan.org/pkg/njuthesis}{\cls{njuthesis}} 已经于2021年9
% 月12日发布在 CTAN,用于绘制南大图标的
% \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发
% 布,两者已被 \TeX{} Live 和 \MiKTeX 收录。}上提供基本的介绍信息,可以下载
% 说明文档(本文档)和宏包源代码。当然,使用这一来源时并不需要接触后者,请参考
Yu Xiong's avatar
Yu Xiong committed
% \ref{subsubsec:standard-installation} 的标准安装方法。
%
% \subparagraph{GitHub 仓库}
% 最新开发进度会提交在本项目的
% \href{https://github.com/nju-lug/NJUThesis}{Github仓库}。仓库内仅包含源代码、
% 空白模板及测试文件,不可直接用于写作。这些文件对应的使用方法请参考
% \ref{subsubsec:on-the-fly-installation}。如果由于网络原因不便访问主仓库,也可
Yu Xiong's avatar
Yu Xiong committed
% 以从 \href{https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis}
% {NJU Git 同步镜像}获取项目工程文件。
Yu Xiong's avatar
Yu Xiong committed
%
% \subparagraph{GitHub Releases}
Yu Xiong's avatar
Yu Xiong committed
% 本模板不定期将已有的新功能和问题修复打包为新的正式发行版,赋以更改后的版本号,
% 发布在 \href{https://github.com/nju-lug/NJUThesis/releases/latest}{Github
% Releases 页面}。如果由于网络原因不便访问主仓库,也可以从\ignorespaces
% \href{https://mirror.nju.edu.cn/github-release/nju-lug/NJUThesis/LatestRelease/}
% {南京大学镜像站下载页面}获取。可供下载的文件包括下列三种:
Yu Xiong's avatar
Yu Xiong committed
%   \begin{description}
%     \item[\file{njuthesis-v*.pdf}] 模板说明文档(本文档)。
Yu Xiong's avatar
Yu Xiong committed
%     \item[\file{njuthesis-user-v*.zip}] 交付给用户的完整模板包,
%          包括格式文件和范本文档,可在解压后用于本地编译,
%          也可直接上传至在线编译网站。
%     \item[\file{njuthesis-ctan-v*.zip}] 交付给 CTAN 的源代码包,
%          普通用户请忽略。
Yu Xiong's avatar
Yu Xiong committed
%   \end{description}
%
%
% \subsubsection{文件构成}
%
Yu Xiong's avatar
Yu Xiong committed
% 本模板由数量众多的文件组成,\emph{所有可能遇到的}文件如表
% \ref{tab:njuthesis-files} 所示。
%
% \begin{table}[ht]
%   \centering
%   \begin{talltblr}[
Yu Xiong's avatar
Yu Xiong committed
%       caption = {\cls{njuthesis}文件构成},
%       label = {tab:njuthesis-files},
%       note{a} = {仅供开发使用,并不会在发布版本中出现。}
%     ] { row{1} = {font=\bfseries}, colspec = {ll} }
%     名称                               & 说明                             \\
%     \file{.vscode}                     & Visual Studio Code 配置文件      \\
%     \file{CHANGELOG.md}                & 修订记录                         \\
%     \file{latexmkrc}                   & \pkg{latexmk} 配置文件           \\
%     \file{LICENSE}                     & 许可证                           \\
%     \file{njuthesis.cls}               & 模板文档类                       \\
%     \file{njuthesis.dtx}\TblrNote{a}   & 文档类源代码                     \\
%     \file{njuthesis.ins}\TblrNote{a}   & 文档类安装脚本                   \\
%     \file{njuthesis.pdf}               & 用户手册(本文档)               \\
%     \file{njuthesis-sample.bib}        & 示例参考文献列表                 \\
%     \file{njuthesis-sample.tex}        & 示例文档,不妨以此为基础撰写论文 \\
%     \file{njuthesis-graduate.def}      & 研究生参数配置文件               \\
%     \file{njuthesis-undergraduate.def} & 本科生参数配置文件               \\
%     \file{README.md}                   & 自述文件                         \\
%   \end{talltblr}
Yu Xiong's avatar
Yu Xiong committed
% \subsection{本地安装}
%
% \subsubsection{标准安装}
% \label{subsubsec:standard-installation}
%
Yu Xiong's avatar
Yu Xiong committed
% 我们\emph{始终建议}使用宏包管理器将 \cls{njuthesis} 安装到您的 \TeX 系
% 统。您可以通过 \TL~Manager 或者 \MiKTeX~Console 等图形化包管理器直接搜
% 索并安装 \cls{njuthesis} (及其依赖的 \pkg{njuvisual})最新的
% 稳定版。同时,您也可以使用终端命令。例如,假设您使用的是 \TL,
Yu Xiong's avatar
Yu Xiong committed
% 键入下述 \pkg{tlmgr} 的命令(很可能需要管理员权限):
% \begin{shellexample}[morekeywords={tlmgr},emph={install}]
Yu Xiong's avatar
Yu Xiong committed
%   tlmgr install njuthesis njuvisual
% \end{shellexample}
Yu Xiong's avatar
Yu Xiong committed
% 即可完成安装,无需额外准备 \file{.cls} 文件。
Yu Xiong's avatar
Yu Xiong committed
% 另一方面,CTAN 依赖开发者手动上传更新,版本更新具有滞后性。如果使用时遇到了问
% 题,不妨使用下一小节的\emph{即时安装方法}优先载入较新的格式文件。
% {\color{red}|[!]|} 如果您具备相关经验\footnote{譬如熟悉命令行操作、使用的是 \TL
% 发行版等},可以在下载仓库内全部文件后,于该目录下运行
% \begin{shellexample}[morekeywords={l3build},emph={install}]
Yu Xiong's avatar
Yu Xiong committed
%   l3build install
% \end{shellexample}
% 来安装本模板的最新版。
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{即时安装}
% \label{subsubsec:on-the-fly-installation}
Yu Xiong's avatar
Yu Xiong committed
% 在某些情况下(例如需要上传至在线编译平台、新版本提供了急需的错误修复),您可能
% 需要独立的 \file{.cls} 格式文件。此时请前往前述的 Releases 页面下载
% \emph{完整模板包}。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% 对于希望使用主仓库中版本的用户,本模板也提供了扁平化安装脚本,用于释放供编译的
% 空白模板和格式文件。Windows 用户请直接双击打开 \file{install-win.bat};其他平
% 台(包括 macOS 和 Linux)用户请在此目录下运行
Yu Xiong's avatar
Yu Xiong committed
% \begin{shellexample}[morekeywords={bash}]
%   bash install-unix.sh
% \end{shellexample}
Yu Xiong's avatar
Yu Xiong committed
% 该脚本会生成一个 \file{mythesis/} 目录以便从头写作,仓库内除此文件夹以外的内容
% 都可以尽情删除。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% {\color{red}|[!]|} 请注意,如果仅仅是希望使用这个模板撰写论文,请无论如何都不
% 要从手动编译 \file{source} 文件夹下的源代码开始,这样做只会浪费生命中宝贵的数
Yu Xiong's avatar
Yu Xiong committed
% 分钟时间。如果遇到了问题,请前往 GitHub 仓库提出 issue。我们只推荐希望参与开发
% 的同学接触 \file{.dtx} 文件。
% \subsection{本地编译}
Yu Xiong's avatar
Yu Xiong committed
% \label{subsec:localcompile}
Yu Xiong's avatar
Yu Xiong committed
% 本地编译的安装过程分为两个阶段:安装 \TeX 发行版以及配置
% 编辑器。前者提供了可以被命令行终端调用的编译程序,
% 后者则提供了语法高亮、自动编译等人性化功能。
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{安装 \TeX{} 发行版}
Yu Xiong's avatar
Yu Xiong committed
% 首先需要下载并安装 \TeX{} 软件发行版,其中包括引擎、宏包、字体、文档等。
% 各操作系统适用情况请参考表~\ref {tab:texdistribution}。第一次
% 编译前请务必通过 \MiKTeX~Console、\TL~Manager 等图形化程序或
Yu Xiong's avatar
Yu Xiong committed
% \pkg{tlmgr} \emph{手动更新全部宏包}以避免潜在的兼容性问题。
% \begin{table}[ht]
Yu Xiong's avatar
Yu Xiong committed
%   \caption{\TeX 软件发行版一览}
%   \label{tab:texdistribution}
%   \begin{tabular}{cccc}
%     \toprule
Yu Xiong's avatar
Yu Xiong committed
%     \TeX        & Windows   & macOS     & Linux     \\
Yu Xiong's avatar
Yu Xiong committed
%     \TL      & $\bullet$ &           & $\bullet$ \\
%     \MacTeX     &           & $\bullet$ &           \\
%     \MiKTeX     & $\bullet$ & $\bullet$ & $\bullet$ \\
%     \bottomrule
%   \end{tabular}
% \end{table}
% 以下是一些值得注意的要点:
% \begin{itemize}
Yu Xiong's avatar
Yu Xiong committed
%   \item 可以参照这份\emph{手把手的教程}\cite{install-latex-guide-zh-cn}。
Yu Xiong's avatar
Yu Xiong committed
%   \item 校园网环境中访问\ignorespaces
%         \href{https://mirror.nju.edu.cn/download/TeX%20排版系统}
%         {南京大学开源软件镜像站}可以获得最佳的下载体验。
Yu Xiong's avatar
Yu Xiong committed
%   \item 使用最新的发行版,即版本号为2022或者22。
Yu Xiong's avatar
Yu Xiong committed
%   \item 对于 Windows 和 macOS 用户,更推荐轻量化的 \MiKTeX 套件。
Yu Xiong's avatar
Yu Xiong committed
% ^^A   \item Linux 用户请尽可能下载 full 版本,如 |texlive-full|。
% ^^A         换言之,下载最大的软件包。
%   \item 对于一部分用到新版本特性的宏包,\cls{njuthesis} 内置了版本检查
%         \footnote{譬如遇到 l3 过时问题请运行 |tlmgr update l3packages|。}
%         ,请确认各宏包已升级至最新版。
% \end{itemize}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsubsection{配置编辑器}
% \changes{v0.11}{2021/11/23}{提供 TeXstudio 配置文件。}
Yu Xiong's avatar
Yu Xiong committed
%
% 配置完编译器后,还需要一个\emph{文本编辑器}来完成 \file{.tex} 文件内容的写作。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% 关于具体使用哪一种,至今仍有相当一部分人认为Windows自带的\emph{记事本}是
% 最好的文本编辑器。但对于本项目而言,在此诚心诚意地推荐您使用\emph{更现代
Yu Xiong's avatar
Yu Xiong committed
% 更美观更多功能}的编辑器,譬如\emph{安装了 \LaTeX Workshop 插件的
Yu Xiong's avatar
Yu Xiong committed
% \href{https://code.visualstudio.com/}{Visual Studio Code}}。您也可以根据
% 个人的喜好随意使用 TeXworks、TeXstudio 等编辑器,顺手就行。
Yu Xiong's avatar
Yu Xiong committed
%
% \cls{njuthesis} 为一些常见编辑器提供了配置文件,如
% \begin{description}
Yu Xiong's avatar
Yu Xiong committed
%   \item[Visual Studio Code] 本模板在 \file{.vscode/} 中提供一份
Yu Xiong's avatar
Yu Xiong committed
%        \LaTeX Workshop 插件的简易配置,在打开文件夹后将自动导入,
Yu Xiong's avatar
Yu Xiong committed
%        可以省略初始配置步骤直接使用。
%   \item[TeXstudio] 本模板提供 \file{conf.txsprofile},可以使用快捷键
%        |alt+O+P| 导入配置文件。为了简化流程\footnote{当然,也可以设置
Yu Xiong's avatar
Yu Xiong committed
%        为使用 \XeLaTeX 编译,然后按照 \ref{subsubsec:compileseq}
Yu Xiong's avatar
Yu Xiong committed
%        内容使用快捷键 |F8| 手动编译参考文献。},该配置文件使用
%        \pkg{latexmk},第一次编译前请参考下一节内容安装 Perl。
% \end{description}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{编译顺序}
% \label{subsubsec:compileseq}
Yu Xiong's avatar
Yu Xiong committed
% \TeX 本身是命令行程序,通过不同的命令调用所需的编译引擎,
Yu Xiong's avatar
Yu Xiong committed
% 编辑器提供的快捷按钮实际只是做了包装。为了便于排查运行错误,
% 以下通过具体终端命令简要描述编译过程。
% 编译本模板的过程可以概括为下述步骤:
% \begin{enumerate}
%   \item 生成初始文档
%   \item 生成参考文献信息
%   \item 生成页码、编号、目录
%   \item 将参考文献列表页插入目录
% \end{enumerate}
Yu Xiong's avatar
Yu Xiong committed
% 总计需要编译四次。\emph{假设即将使用的主文件名为
% \file{njuthesis-sample.tex}},应采用以下命令顺序进行编译,
% 以生成内容正确的 \file{njuthesis-sample.pdf}。输出的 PDF
Yu Xiong's avatar
Yu Xiong committed
% 文档位于同一目录下。该目录下同时会生成若干中间文件。
% 编译命令具体为引擎名称加主文件名,在编译 \file{.tex} 文件时,
Yu Xiong's avatar
Yu Xiong committed
% 文件扩展名可以省略不写。现阶段 \cls{njuthesis} 仅支持 \XeTeX
% 与 \LuaTeX 引擎,以及 \biber 文献工具。请注意,几种命令的输出文件
% 基本相同,可以任取一种;但如果您不清楚这两种编译引擎的区别,
% 或者对多步编译感到困惑,我们建议优先使用 |latexmk -xelatex|。
Yu Xiong's avatar
Yu Xiong committed
% \subparagraph{使用 \XeLaTeX}
% 标准的 \XeTeX 引擎四步编译方法。
% \begin{shellexample}[morekeywords={xelatex,biber}]
Yu Xiong's avatar
Yu Xiong committed
%   xelatex njuthesis-sample
%   biber njuthesis-sample
%   xelatex njuthesis-sample
%   xelatex njuthesis-sample
% \end{shellexample}
Yu Xiong's avatar
Yu Xiong committed
% \subparagraph{使用 \LuaLaTeX}
% 标准的 \LuaTeX 引擎四步编译方法。
%
% \begin{shellexample}[morekeywords={lualatex,biber}]
Yu Xiong's avatar
Yu Xiong committed
%   lualatex njuthesis-sample
%   biber njuthesis-sample
%   lualatex njuthesis-sample
%   lualatex njuthesis-sample
% \end{shellexample}
% \subparagraph{使用 \pkg{latexmk}}
Yu Xiong's avatar
Yu Xiong committed
% \pkg{latexmk}\cite{latexmk} 是一个基于 Perl 脚本的自动编译工具,
% 宗旨是通过单一命令简化上述的多次编译流程。
% 在使用该命令前,请确保安装了以下软件:
% \begin{description}
Yu Xiong's avatar
Yu Xiong committed
%   \item[Perl] 一般预装于 macOS 和 Linux,而 Windows 用户需要单独安装
%        \href{https://strawberryperl.com/}{Strawberry Perl}。
%   \item[\normalfont\pkg{latexmk}] 如果终端找不到 |latexmk| 命令,需使用包管理器单独安装。
% \end{description}
%
% 该命令的使用方法为
% \begin{shellexample}[morekeywords={latexmk}]
Yu Xiong's avatar
Yu Xiong committed
%   latexmk njuthesis-sample
% \end{shellexample}
Yu Xiong's avatar
Yu Xiong committed
% 直接运行会调用 \pdfLaTeX 引擎导致报错。
% 如需指定编译引擎,可以加入 |-xelatex| 或 |-lualatex| 参数。
Yu Xiong's avatar
Yu Xiong committed
% 例如,指定 \XeLaTeX 的命令为
% \begin{shellexample}[morekeywords={latexmk},emph={-xelatex}]
Yu Xiong's avatar
Yu Xiong committed
%   latexmk -xelatex njuthesis-sample
% \end{shellexample}
% 此外,可以选择使用以下命令清理编译生成的临时文件。
% \begin{shellexample}[morekeywords={latexmk},emph={-c}]
%   latexmk -c
% \end{shellexample}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{在线编译}
Yu Xiong's avatar
Yu Xiong committed
% \label{subsec:onlinecompile}
Yu Xiong's avatar
Yu Xiong committed
%
atxy's avatar
atxy committed
% 相信您在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如 \TeX 编译器
% 安装过程较为漫长\footnote{因此对于 Windows 推荐 \MiKTeX。},占用空间过大
% \footnote{事实上,可以通过 |scheme-infraonly| 模式安装 \TL,随后利用 \pkg{tlmgr}
% 安装依赖宏包,这份宏包列表可以在 Git 仓库的 \file{.github/workflows/build.yml}
% 找到。},而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{出于文件 IO
% 速度的差异,同一个模板在 Linux 编译可以相对 Windows 节省约一半耗时。}。
% 拒绝接受这些麻烦的同学可以尝试本节介绍的在线编译方法。
%
% {\color{red}|[!]|} 请注意,在线编辑器不一定提供良好的文件恢复和版本管理机制。
% 请谨慎备份您的心血结晶。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{南大 \TeX 平台简介}
% \changes{v0.2}{2021/09/07}{添加对南大 \TeX 的支持。}
Yu Xiong's avatar
Yu Xiong committed
%
atxy's avatar
atxy committed
% \href{https://tex.nju.edu.cn}{南大 \TeX} 基于开源的 Overleaf 社区版平台构建
% \footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到
% 一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正
% 式上线,是 \href{https://sci.nju.edu.cn/}{eScience 中心}为南大在校师生提供的
% \LaTeX 在线编辑器,首次使用需凭学校邮箱自助注册账号。
Yu Xiong's avatar
Yu Xiong committed
%
atxy's avatar
atxy committed
% {\color{red}|[!]|} 在 2022 年 5 月的运行中,该网站出现了多次崩溃事件,
% 初步判断原因是由社区版并没有为高并发数做优化引发的。
% 高峰时期,仍然建议在本地部署 \TeX 发行版。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{操作步骤}
%
atxy's avatar
atxy committed
% 本说明手册开头的 \ref{subsec:first-things-first} 即呈现了网站内嵌的
% \cls{njuthesis} 模板的使用方法。由于南大 \TeX 网站已预装 \cls{njuthesis},
% 可以直接编写正文,无需 \file{.cls} 等格式文件。
% 如果有其他要求,也可以按如下步骤手动上传包含模板的压缩包。
Yu Xiong's avatar
Yu Xiong committed
% \begin{enumerate}
atxy's avatar
atxy committed
%   \item 访问\href{https://tex.nju.edu.cn}{南大 \TeX 网站},
%         点击界面右上方“注册”按钮,使用\emph{南京大学邮箱}注册账号并登录
Yu Xiong's avatar
Yu Xiong committed
%   \item 新建空白项目,或者上传 \ref{subsubsec:on-the-fly-installation} 节得到的压缩文件。
%   \item 在项目页面左上角的“菜单”中,确认编译器为 |XeLaTeX| 或者 |LuaLaTeX|
%   \item 仿照 \file{njuthesis-sample.tex} 编写论文
%   \item 点击“重新编译”按钮进行编译和预览
Yu Xiong's avatar
Yu Xiong committed
% \end{enumerate}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{其他平台}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subparagraph{Overleaf}
% \changes{v0.12}{2021/12/07}{更新了对 Overleaf 的支持情况。}
% \pkg{njuthesis} 现已支持 \href{https://www.overleaf.com/}{Overleaf} 平台。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subparagraph{TeXPage}
Yu Xiong's avatar
Yu Xiong committed
% \href{https://www.texpage.com/}{TeXPage} 是国人研发的 \LaTeX 在线编辑器,
% 当前版本已具备较为完善的编辑编译功能,而且免费版相对 Overleaf 增加了公式识别、
% 编辑历史等实用工具,也可以作为一个备选项。
%
%
% \subsection{版本升级}
%
Yu Xiong's avatar
Yu Xiong committed
% 本模板仍在开发中,将不断发布新版本,您可能需要不定期进行更新以得到
% 对于已知问题的修复补丁。每个版本的更新内容记录于 Git 仓库中的
% \file{CHANGELOG.md}。除非特别提到选项变化,升级时一般无需更改 \file{.tex}
% 文件内容\footnote{在确实发生了接口变动,例如选项名称发生了更改,
% 一种稳妥做法是将论文内容迁移至新版的 \file{njuthesis-sample.tex}}。
% 基于安装和编译方式的差异,可以按照当前工作文件夹内是否有 \file{.cls}
% 文件分别进行更新操作。
Yu Xiong's avatar
Yu Xiong committed
% 下载 \file{njuthesis-user-v*.zip},使用其中新版的 \file{.cls}、\file{.def}
% 文件覆盖旧版本。
%
% \subparagraph{没有}
Yu Xiong's avatar
Yu Xiong committed
% 如果使用的是南大 \TeX,更新内置模板时会进行公告,一般为上传 CTAN
Yu Xiong's avatar
Yu Xiong committed
% 后一周内。如果是本地安装,请直接使用包管理器进行更新:
% \begin{shellexample}[morekeywords={tlmgr},emph={update}]
Yu Xiong's avatar
Yu Xiong committed
%   tlmgr update --all
% \end{shellexample}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
%
% \section{使用方法}
Yu Xiong's avatar
Yu Xiong committed
% \subsection{标准结构}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% 典型的 \cls{njuthesis} 主文件结构应该如下所示:
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{latexexample}[moretexcs={\njusetup,\tableofcontents,
%   \maketitle,\mainmatter,\chapter,\printbibliography},emph={[1]document}]
%   \documentclass{njuthesis}
%   \njusetup{}
Yu Xiong's avatar
Yu Xiong committed
%   \begin{document}
%   \maketitle
%   \tableofcontents
%   \mainmatter
%   \chapter{欢迎}
%   使用 \LaTeX{}!
%   \printbibliography
Yu Xiong's avatar
Yu Xiong committed
%   \end{document}
% \end{latexexample}
Yu Xiong's avatar
Yu Xiong committed
%
% 如果您尝试编译上面的代码,会发现自己得到了一个5页的 PDF 文档,
% 是一份空白的本科生论文。当然,这个文档实际上没有任何内容,
% 接下来的部分会介绍具体填写内容的方法。
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{模板选项}
Yu Xiong's avatar
Yu Xiong committed
%
% 模板选项位于 \tn{documentclass} 后的方括号内,用于指定模板的行为。
% 下文中尖括号内列出了若干个允许的选项,其中加粗的为默认选项(缺省值)。
% \subsubsection{学位信息}
% \begin{function}[added=2021-09-07,updated=2022-07-23]{type}
%   \begin{syntax}
%     \OPT{type} = <(bachelor)|master|doctor|postdoc>
%   \end{syntax}
% 选择毕业论文模板类型,这将决定模板整体的外观。可选值分别为
% 学士(本科生)、硕士研究生、博士研究生和博士后,默认为学士。
Yu Xiong's avatar
Yu Xiong committed
% \end{function}
%
% \begin{function}[added=2021-09-07,updated=2022-07-01]{degree}
Yu Xiong's avatar
Yu Xiong committed
%   \begin{syntax}
%     \OPT{degree} = <(academic)|professional>
Yu Xiong's avatar
Yu Xiong committed
%   \end{syntax}
% 选择研究生的学位类型。可选值分别学术型和专业型,默认为学术型。
% \end{function}
%
% \subsubsection{特殊页面}
%
% \begin{function}[added=2021-09-07,updated=2022-07-05]{nl-cover}
Yu Xiong's avatar
Yu Xiong committed
%   \begin{syntax}
%     \OPT{nl-cover} = <\TFF>
Yu Xiong's avatar
Yu Xiong committed
%   \end{syntax}
% 是否使用国家图书馆封面,默认关闭。
% 通过此项可用国家图书馆封面\emph{替换}普通封面。
Yu Xiong's avatar
Yu Xiong committed
% 由于本科生院文件中并未提及相关规定,故本选项仅对于研究生有效。
%
% \begin{function}[updated=2022-01-06]{decl-page}
%   \begin{syntax}
%     \OPT{decl-page} = <\TFF>
%   \end{syntax}
% 是否需要自动生成声明页面,默认关闭。
% 通过此项,对于本科生模板可在封面后添加的诚信承诺书,对于研究生模板可在
% 封面后添加原创性声明\footnote{其中的打勾符号依赖 \pkg{unicode-math}。},