Skip to content
Snippets Groups Projects
njuthesis.dtx 104 KiB
Newer Older
    section/format       = \@@_sec_title_style:,
    subsection/format    = \@@_sec_title_style:,
    subsubsection/format = \@@_sec_title_style:
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{目录格式}
Yu Xiong's avatar
Yu Xiong committed
% 设定目录标题名称。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\ctexset
  {
    contentsname   = {目录},
    listfigurename = {插图清单}, 
    listtablename  = {表格清单},
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% 使用\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}{\@@_toc_title_style:}
% 目录页单独设置三号粗宋体标题。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_toc_title_style:
  { \centering \songti \bf \zihao{3} \selectfont }
%    \end{macrocode}
% \end{macro}
%
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\tableofcontents}
% 重定义目录命令,修改标题格式并插入书签。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\RenewDocumentCommand \tableofcontents { }
  {
    \raggedbottom
    \group_begin:
      \ctexset
        { contentsname   = {目\hspace{2em}录},
          chapter/format = \@@_toc_title_style: }
      \chapter*{\contentsname}
    \group_end:
    \addcontentsline{toc}{chapter}{\contentsname}
    \vskip 20pt 
    \@starttoc{toc}
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\listoffigures}
Yu Xiong's avatar
Yu Xiong committed
% 重定义插图目录命令,修改标题格式并插入书签。
%    \begin{macrocode}
\RenewDocumentCommand \listoffigures { }
  {
    \group_begin:
      \ctexset { chapter/format = \@@_toc_title_style: }
      \chapter*{\listfigurename}
    \group_end:
    \addcontentsline{toc}{chapter}{\listfigurename}
    \vskip 20pt 
    \@starttoc{lof}
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\listoftables}
Yu Xiong's avatar
Yu Xiong committed
% 重定义表格目录命令,修改标题格式并插入书签。
%    \begin{macrocode}
\RenewDocumentCommand \listoftables { }
  {
    \group_begin:
      \ctexset { chapter/format = \@@_toc_title_style: }
      \chapter*{\listtablename}
    \group_end:
    \addcontentsline{toc}{chapter}{\listtablename}
    \vskip 20pt 
    \@starttoc{lot}
    \vfill
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{前言致谢}
% 
% \begin{environment}{preface}
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\NewDocumentEnvironment{preface} { +b }
  { \chapter*{前言}
    \addcontentsline{toc}{chapter}{前言} #1 }
  { \cleardoublepage }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{environment}{acknowledgement}
Yu Xiong's avatar
Yu Xiong committed
% 单独制作的致谢页。
%    \begin{macrocode}
\NewDocumentEnvironment{acknowledgement} { +b }
  { \chapter*{致谢}
    \addcontentsline{toc}{chapter}{致谢} #1 }
  { \cleardoublepage }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\njupaperlist}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.10}{2021/09/29}{新增了成果列表页面。}
% 发表文章目录与合作文章目录。
%    \begin{macrocode}
\NewDocumentCommand\njupaperlist { t* m }
      \bool_if:NTF { #1 }
      { \printbibliography[heading=subbibliography,title=合作文章目录] }
      { \printbibliography[heading=subbibliography,title=发表文章目录] }
    \end{refsection}
  }
%    \end{macrocode}
% \end{macro}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{参考文献}
% biblatex设置
\RequirePackage[
    style=gb7714-2015,
    %style=numeric-comp,
    %citestyle=authortitle-icomp,
    % citestyle=numeric-comp,
    %bibstyle=authoryear,
    % bibstyle=numeric,
    sorting=none,
    %sorting=nyt,
    %sortcites=true,
    %autocite=footnote,
    backend=biber, % Compile the bibliography with biber
    hyperref=true,
    backref=false,
    citecounter=true,
    pagetracker=true,
    citetracker=true,
    ibidtracker=context,
    autopunct=true,
    autocite=plain,
    % gbpub=false,         % Uncomment if you do NOT want '[S.l. : s.n.]' 
                           % in reference entries, GitHub Issue (#47)
    % gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author 
                           % names in reference entries, GitHub Issue (#23)
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% \changes{v0.12}{2021/12/06}{设置输出参考文献的默认选项。}
% 设置参考文献名称
%    \begin{macrocode}
\ctexset{ bibname = {参考文献} }
%    \end{macrocode}
% 将参考文献插入目录
%    \begin{macrocode}
\DeclarePrintbibliographyDefaults{ heading = bibintoc }
%    \end{macrocode}
%
Yu Xiong's avatar
Yu Xiong committed
% 忽略不需要的文献信息。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\AtEveryBibitem{
	\clearfield{abstract}
	\clearfield{issn}
	\clearfield{isbn}
	\clearfield{archivePrefix}
	\clearfield{arxivId}
	\clearfield{pmid}
	\clearfield{eprint}
	\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{引用}
Yu Xiong's avatar
Yu Xiong committed
%
% \pkg{hyperref} 设置。
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.11}{2021/10/01}{写入PDF元数据。}
%    \begin{macrocode}
\ctex_at_end_preamble:n
Yu Xiong's avatar
Yu Xiong committed
  {
    \hypersetup
      {
        bookmarksnumbered = true,
        psdextra          = true,
        unicode           = true,
        hidelinks,
%    \end{macrocode}
% 填写 PDF 元信息。
%    \begin{macrocode}
Yu Xiong's avatar
Yu Xiong committed
        pdftitle    = \l_@@_info_title_tl,
        pdfauthor   = \l_@@_info_author_tl,
        pdfkeywords = \l_@@_info_keywords_clist,
        pdfcreator  = \c_@@_name_pdf_creator_tl
      }
  }
%    \end{macrocode}
% 修改 \pkg{cleverref} 的标签名称。默认在名称后面添加空格,删除公式编号的括号
%    \begin{macrocode}
\crefdefaultlabelformat{#2#1#3\,}
\crefname { figure   } { 图   } { 图 }
\crefname { table    } { 表   } { 表 }
\crefname { appendix } { 附录 } { 附录 }
\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{assumption}{假设}{假设}
% \crefname{axiom}{公理}{公理}
% \crefname{conclusion}{结论}{结论}
% \crefname{condition}{条件}{条件}
% \crefname{corollary}{推论}{推论}
% \crefname{definition}{定义}{定义}
% \crefname{lemma}{引理}{引理}
% \crefname{property}{性质}{性质}
% \crefname{proposition}{命题}{命题}
% \crefname{remark}{注解}{注解}
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \subsection{图表浮动体}
% 
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{图片表格}
%
% 设置默认图片扩展名,允许在不键入扩展名时自动进行补全。
%    \begin{macrocode}
\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png}
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% 
% \changes{v0.12}{2021/12/06}{删除了可能导致冲突的 \pkg{floatrow}。}
% 图表标题样式。文字设置为五号宋体,标签设置为粗体,间隔一个全角空格。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\DeclareCaptionStyle{njucap}
  {
    font          = small,
    labelfont     = bf,
    labelsep      = quad,
    justification = centering
  }
\captionsetup [ figure ] { style = njucap }
\captionsetup [ table  ] { style = njucap }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsubsection{代码环境}
Yu Xiong's avatar
Yu Xiong committed
% 
% 使用 \pkg{listings} 提供的 \tn{lstset} 设置代码环境基本样式。
%    \begin{macrocode}
\lstset
  {
    basewidth    = 0.5 em,
    lineskip     = 3 pt,
    basicstyle   = \small\ttfamily,
    keywordstyle = \bfseries,
    commentstyle = \itshape,
    numbers      = left,
    captionpos   = t,
    breaklines   = true,
    xleftmargin  = 2 em,
    xrightmargin = 2 em,
    flexiblecolumns
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
%
% \subsubsection{列表环境}
% \changes{v0.12}{2021/12/07}{删除了 \pkg{enumitem} 的部分列表环境设置。}
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\setlist { noitemsep }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{定理环境}
%
% \begin{macro}{\mathbi}
% Math bold italic letters
%    \begin{macrocode}
\NewDocumentCommand\mathbi{m}{\textbf{\em #1}}
%    \end{macrocode}
% \end{macro}
%
Yu Xiong's avatar
Yu Xiong committed
%    \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}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
Yu Xiong's avatar
Yu Xiong committed
% 修改证明环境标题 
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\let\oldproofname=\proofname
Yu Xiong's avatar
Yu Xiong committed
\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} 
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
%    \begin{macrocode}
% TODO: 简化数学环境的定义方法
\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}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsection{封面}
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{内部命令}
%
% \begin{variable}{\l_@@_info_title_tl }
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\tl_new:N \l_@@_info_title_tl
%    \end{macrocode}
% \end{variable}
% 将多行标题合并为完整标题。
%    \begin{macrocode}
\tl_set:Nn \l_@@_info_title_tl 
  { \l_@@_info_title_a_tl \l_@@_info_title_b_tl \l_@@_info_title_c_tl }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{variable}{\l_@@_info_supv_full_tl,\l_@@_info_supv_full_en_tl}
% 用于存储导师姓名加职称的变量,旧版编译器不支持字符串中含有|\hspace{.5em}|这样的空白空间命令
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\tl_new:N \l_@@_info_supv_full_tl
\tl_new:N \l_@@_info_supv_full_en_tl
%    \end{macrocode}
% \end{variable}
Yu Xiong's avatar
Yu Xiong committed
% 拼合双导师的姓名和职称。
%    \begin{macrocode}
\tl_set:Nn \l_@@_info_supv_full_tl
  {
    \l_@@_info_supv_a_tl\quad\l_@@_info_supv_a_title_tl\qquad
    \l_@@_info_supv_b_tl\quad\l_@@_info_supv_b_title_tl
  }
\tl_set:Nn \l_@@_info_supv_full_en_tl
  {
    \l_@@_info_supv_a_title_en_tl\quad\l_@@_info_supv_a_en_tl\qquad
    \l_@@_info_supv_b_title_en_tl\quad\l_@@_info_supv_b_en_tl
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% 判断学位进行命令定义
%    \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 }
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\@@_spread_box:nn}
Yu Xiong's avatar
Yu Xiong committed
% 来自\cls{fduthesis}:分散对齐的水平盒子。
Yu Xiong's avatar
Yu Xiong committed
% \begin{arguments}
%   \item   宽度
%   \item   内容
% \end{arguments}
% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip}
% 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。
% |#2| 需要完全展开以避免 underfull 警告。
%    \begin{macrocode}
Yu Xiong's avatar
Yu Xiong committed
\cs_generate_variant:Nn \tl_map_inline:nn       { xn }
Yu Xiong's avatar
Yu Xiong committed
\cs_new_protected:Npn \@@_spread_box:nn #1#2
  {
    \mode_leave_vertical:
    \hbox_to_wd:nn {#1}
      { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip }
  }
%    \end{macrocode}
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_cover_uline_a:n}
% 在封面绘制下划线
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cover_uline_a:n #1
  {
    \uline{\makebox[\c_@@_cover_uline_len_a_tl]
      {\rm\c_@@_cover_uline_font_tl #1 }}
  }
\cs_new_protected:Npn \@@_cover_uline_b:n #1
  {
    \uline{\makebox[\c_@@_cover_uline_len_b_tl]
      {\rm\c_@@_cover_uline_font_tl #1 }}
  }
\cs_new_protected:Npn \@@_cover_uline_nl:nn #1 #2
  {
    \uline{\makebox[#1]
      {\rm\c_@@_cover_uline_font_tl #2 }}
  }
% \begin{macro}{\@@_cover_box:n}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cover_box:n #1 
  {
    \makebox[\c_@@_cover_box_len_tl][s]{
      #1\c_@@_cover_uline_bskip_tl}
  }
% \begin{macro}{\@@_cover_degree:}
% 学位类型。
\cs_new_protected:Npn \@@_cover_degree:
  {
    { (申请 }
    \clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int }
    { 学位) }
  }
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{封面组件}
%
% \begin{macro}{\@@_cover_title_breakline:}
Yu Xiong's avatar
Yu Xiong committed
% 对标题进行自动判断,如果某行标题空则不输出接下来的若干行,得到多行标题。
%    \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
    {
      \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 } \\
        }
    }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \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 名}
Yu Xiong's avatar
Yu Xiong committed
      & \@@_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}
  } 
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{绘制封面}
% \begin{macro}{\@@_print_cover_nl:}
% \changes{v0.12}{2021/12/02}{选择|nlcover|时不生成普通封面。}
% 按需绘制国家图书馆封面,修改自胡海星模板
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_cover_nl:
  \pdfbookmark[0]{国家图书馆封面}{nl}
Yu Xiong's avatar
Yu Xiong committed
    \noindent\null\vskip -20mm \hskip -15mm
    \songti\zihao{-4}
    \makebox[40pt][l]{分类号}
Yu Xiong's avatar
Yu Xiong committed
    \@@_cover_uline_b:n {\l_@@_info_clc_tl}
    \hfill
    \makebox[40pt][l]{密级}
    \@@_cover_uline_b:n {\l_@@_info_seclv_tl}
    \vskip 10pt \hskip -15mm
    \@@_cover_uline_b:n {\l_@@_info_udc_tl}
  }

  % 中部
  \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}

  % 底部
Yu Xiong's avatar
Yu Xiong committed
  \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}{\clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int }}%
Yu Xiong's avatar
Yu Xiong committed
  \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
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_print_declaration:}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.12}{2021/12/02}{添加原创性声明页面。}
% 原创性声明。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_declaration:
  {
    \normalfont\normalsize
    \chapter*{南京大学学位论文原创性声明}
    \thispagestyle{empty}
    \c_@@_orig_decl_text_tl
    \vfil
    \begin{flushright}
      {研究生签名:} \uline{\makebox[5em]{}}
      {日期:} \uline{\makebox[5em]{}}
    \end{flushright}
    \vfil
  }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_print_cover_ug:}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_cover_ug:
  {
    \pdfbookmark{封面}{cover} % 将封面插入pdf书签
    \begin{spacing}{1.25}
    \noindent\null\hspace{-10mm}
    \njuemblem[black]{!}{3cm}\smallskip 
    \begin{center}
      \njuname[black]{!}{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}
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_print_cover_g:}
% 研究生封面
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_cover_g:
  \pdfbookmark{封面}{cover} % 将封面插入pdf书签
  \begin{spacing}{1.25}
  \begin{center}
Yu Xiong's avatar
Yu Xiong committed
    \noindent\null\vskip 5mm
    \njuemblem[black]{!}{1.9cm}
    \njuname[black]{4.4cm}{!}
Yu Xiong's avatar
Yu Xiong committed
    \par\vskip -2mm 
    \njuname*[black]{4.4cm}{!}
Yu Xiong's avatar
Yu Xiong committed
    \bgroup
      \zihao{1}\bf\kaishu
      \@@_spread_box:nn {10em}{研究生毕业论文}
Yu Xiong's avatar
Yu Xiong committed
      \vskip 5mm
      \@@_cover_degree:
Yu Xiong's avatar
Yu Xiong committed
    \egroup
    \par\vfill\vskip\stretch{0}
    \bgroup
      \bf\kaishu\zihao{3}
      \def\tabcolsep{1pt}
      \def\arraystretch{1.5}
      \vskip 10mm
      \@@_print_covertab:
    \egroup
    \bgroup
      \bf\kaishu\zihao{4}\l_@@_submit_date_tl
    \egroup
    \vskip 15mm
  \end{center}
  \end{spacing}

  \newpage % 封面背面
  \begin{spacing}{1.625}
    {\bgroup
    \kaishu\zihao{3}
    \makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\l_@@_info_id_tl}
    \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}
% 研究生英文封面
  \newpage
  \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}
    \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}
      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[black]{2.5cm}{!}\par
    \vskip 3mm
    \normalfont\l_@@_info_dept_en_tl\\
    {Nanjing~University}
    \vskip 30pt
    \normalfont\normalsize\l_@@_submit_date_en_tl
  \end{center}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\maketitle}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.12}{2021/12/01}{仅会生成国家图书馆封面或者普通封面之一。}
% 重定义 \cs{maketitle}。
% 如果选择了 |nlcover|,就生成用于申请学位的国家图书馆封面和原创性声明,反之生成普通封面。
%    \begin{macrocode}
\RenewDocumentCommand \maketitle { }
  {
    \pagestyle{empty}
    \bool_if:NTF \g_@@_nlcover_bool 
      { \@@_print_cover_nl: \@@_print_declaration: }
      { \use:c { @@_print_cover_ \g_@@_info_diploma_tl : } }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% 在标题页后使用大写罗马字母页码。
%    \begin{macrocode}
    \cleardoublepage
    \pagestyle{plain}
    \pagenumbering{Roman}
    \normalfont\normalsize      
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsection{摘要页}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_print_keywords:,\@@_print_keywords_en:}
Yu Xiong's avatar
Yu Xiong committed
% 中英文关键词
%    \begin{macrocode}
  {
    \par\vspace{2ex}
    \group_begin: 
      \noindent \c_@@_name_keywords_tl
      \clist_use:Nn \l_@@_info_keywords_clist {;} 
    \group_end: 
  }
  {
    \par\vspace{2ex}
    \group_begin: 
      \noindent \c_@@_name_keywords_en_tl\hspace{0.5em}
      \clist_use:Nn \l_@@_info_keywords_en_clist {;}
    \group_end: 
  }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\@@_print_abstract_ug:,\@@_print_abstract_en_ug:}
% 输出本科摘要格式。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_abstract_ug:
{
  \begin{center}
    \kaishu\zihao{-2}{\textbf{
      \uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}}
  \end{center}
Yu Xiong's avatar
Yu Xiong committed
  \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\par
}
\cs_new_protected:Npn \@@_print_abstract_en_ug:
{
  \begin{center}
      \kaishu\zihao{-2}{\textbf{\uuline{
        南京大学本科生毕业论文(设计、作品)英文摘要}}}
  \end{center}
    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\par
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\@@_print_abstract_g:,\@@_print_abstract_en_g:}
% 输出研究生摘要格式。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_abstract_g:
  \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}
  \egroup\par
}
\cs_new_protected:Npn \@@_print_abstract_en_g:
{
  \begin{center}
Yu Xiong's avatar
Yu Xiong committed
      \kaishu\zihao{-2}{\textbf{\uuline{
        南京大学研究生毕业论文英文摘要首页用纸}}}
  \end{center}
    \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
  \egroup\par
}
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{abstract}
% 中文摘要环境。
%    \begin{macrocode}
Yu Xiong's avatar
Yu Xiong committed
\NewDocumentEnvironment{abstract} { +b }
  { \newpage \use:c { @@_print_abstract_ \g_@@_info_diploma_tl : } 
    \group_begin: \kaishu \zihao{-4} #1 }
  { \@@_print_keywords: \group_end: }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{abstract*}
% 英文摘要环境。\pkg{xparse} 目前不支持合并带有星号的环境,因此需要单独定义。
%    \begin{macrocode}
\NewDocumentEnvironment{abstract*} { +b }
  { \newpage \use:c { @@_print_abstract_en_ \g_@@_info_diploma_tl : } 
    \group_begin: \zihao{-4} #1 }
  { \@@_print_keywords_en: \group_end: }
Yu Xiong's avatar
Yu Xiong committed
%</class>
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}