Skip to content
Snippets Groups Projects
njuthesis.dtx 56.1 KiB
Newer Older
Yu Xiong's avatar
Yu Xiong committed
%
% Put text here.
%    \begin{macrocode}
\tl_set:Nn \tableofcontents 
{
  \nju_tocpagestyle:nnn {目\hspace{2em}录}{\contentsname}{toc}
}
\tl_set:Nn \listoffigures
{
  \nju_tocpagestyle:nnn {\listfigurename}{\listfigurename}{lof}
}
\tl_set:Nn \listoftables 
{
  \nju_tocpagestyle:nnn {\listtablename}{\listtablename}{lot}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 定制前言、致谢环境
\newenvironment{preface}
{%
  \chapter*{前言}
  \addcontentsline{toc}{chapter}{前言}
}{}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% \DescribeEnv{acknowledgements}
% 单独制作的致谢页。
%    \begin{macrocode}
\newenvironment{acknowledgement}
{%
  \chapter*{致谢}
  \addcontentsline{toc}{chapter}{致谢}
}{}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 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)
]{biblatex}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% Remove some unwanted entries from the bibliography
\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}}{}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \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{chapter}{§}{§}
% \crefname{section}{§}{§}
% \crefname{subsection}{§}{§}
% \crefname{subsubsection}{§}{§}
\crefname{appendix}{附录}{附录}

% \crefname{definition}{定义}{定义}
% \crefname{axiom}{公理}{公理}
% \crefname{property}{性质}{性质}
% \crefname{proposition}{命题}{命题}
% \crefname{lemma}{引理}{引理}
% \crefname{corollary}{推论}{推论}
% \crefname{remark}{注解}{注解}
% \crefname{condition}{条件}{条件}
% \crefname{conclusion}{结论}{结论}
% \crefname{assumption}{假设}{假设}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% soifjsojfosjfos
%    \begin{macrocode}
% 图表位置调整
\floatsetup[lstlisting]{ % Captions for lstlistings
	capposition=above,%
	margins=centering,%
	floatwidth=\textwidth%
}
\floatsetup[figure]{ % Captions for figures
	capposition=bottom,%
	margins=centering,%
	floatwidth=\textwidth%
}
\floatsetup[table]{ % Captions for tables
	capposition=above,%
	margins=centering,%
	floatwidth=\textwidth%
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 代码样式
\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
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
\lstdefinestyle{LaTeX}{
  language=TeX,
  morekeywords={begin, caption, label, mathrm, frac, toprule, midrule, bottomrule, includegraphics}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \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
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% list configuration
\renewcommand{\labelitemi}{\tiny$\blacktriangleright$}
\renewcommand{\labelitemii}{\textbullet}

\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
\setlist[description]{noitemsep}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \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}
%
% Put text here.
%    \begin{macrocode}
\let\oldproofname=\proofname
\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} % 修改证明环境标题
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \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}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% \section{封面设计}
%    \begin{macrocode}
% 拼合标题
\tl_const:Nn \nju_title {\nju_title_a \nju_title_b \nju_title_c}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 拼合导师
\bool_if:NTF \nju_second_mentor
{ 
  \tl_const:Nn \nju_mentor_full
  {
    \nju_mentor_a\ \nju_mentor_a_title
    \ \ \nju_mentor_b\ \nju_mentor_b_title
  }
  \tl_const:Nn \nju_mentor_full_en
  {
    \nju_mentor_a_en\ \nju_mentor_a_title_en
    \ \ \nju_mentor_b_en\ \nju_mentor_b_title_en
  }
}
{
  \tl_const:Nn \nju_mentor_full
  {
    \nju_mentor_a\ \nju_mentor_a_title
  }
  \tl_const:Nn \nju_mentor_full_en
  {
    \nju_mentor_a_en\ \nju_mentor_a_title_en
  }
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 判断学位进行命令定义
\str_if_eq:NNTF {\nju_degree} { ug } 
{
  % 本科
  \tl_const:Nn \nju_degree_name {本\hfill 科\hfill }

  % 本科强制不打印国家图书馆封面
  \bool_set_false:N \nju_nl_cover
  
  % 封面下划线
  \cs_new:Npn \nju_cover_underline_ug:nn #1 #2 
  {
    \uline{\makebox[#1]{\rm\songti#2}}
  }
 
  % 封面表格边框
  \cs_new:Npn \nju_coverbox_ug:n #1 
  {
    \makebox[4.2em][s]{#1}
  }
} 
{ 
  % 本科以外都是研究生 
  \tl_const:Nn \nju_degree_name {研\hfill 究\hfill 生\hfill }

  % 封面下划线
  \cs_new:Npn \nju_cover_underline_g:n #1 
  {
    \uline{\makebox[250pt]{\rm\kaishu#1}}
  }

  % 国家图书馆封面下划线
  \cs_new:Npn \nju_cover_underline_nl:nn #1 #2 
  {
    \uline{\makebox[#1]{#2}}
  }

  % 封面表格边框
  \cs_new:Npn \nju_coverbox_g:n #1 
  {
    \makebox[6em][s]{#1\hspace{1em}}
  }
  
  % 研究生学位分类
  \str_case:Nn { \nju_degree }
  {
    { mg } { \tl_const:Nn \nju_degree_title {硕士} }
    { mf } { \tl_const:Nn \nju_degree_title {硕士专业} }
    { phd } { \tl_const:Nn \nju_degree_title {博士} }
  }
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 判断类型
\str_if_eq:NNTF {\nju_type} {thesis} 
{
  \tl_const:Nn \nju_type_name 
    { \nju_degree_name 毕\hfill 业\hfill 论\hfill 文 }
}
{
  \tl_const:Nn \nju_type_name 
    { \nju_degree_name 毕\hfill 业\hfill 设\hfill 计 }
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 封面信息栏 本科
\tl_new:N \nju_printcoverinfo_ug
\tl_set:Nn \nju_printcoverinfo_ug 
{
  \begin{tabular}{p{4.2em}c}
    \nju_coverbox_ug:n {院\hfill 系}
    & \nju_cover_underline_ug:nn {250pt}{\nju_department}\\
    \nju_coverbox_ug:n {专\hfill 业}
    & \nju_cover_underline_ug:nn {250pt}{\nju_major}\\

    % 标题换行
    \int_case:nn { \nju_titlelength }
      {
        { 1 } { 
          \nju_coverbox_ug:n {题\hfill 目}
          & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\ }
        { 2 } {
          \nju_coverbox_ug:n {题\hfill 目}
          & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\
          & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_b}} \\ }
        { 3 } { 
          \nju_coverbox_ug:n {题\hfill 目}
          & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\
          & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_b}} \\
          & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_c}} \\}
      }
  \end{tabular}\\

  \begin{tabular}{p{4.2em}cp{4.2em}c}
    \nju_coverbox_ug:n {年\hfill 级}
    & \nju_cover_underline_ug:nn {90pt}{\nju_grade}
    & \nju_coverbox_ug:n {学\hfill 号}
    & \nju_cover_underline_ug:nn {90pt}{\nju_student_id}\\
  \end{tabular}\\
  
  \begin{tabular}{p{4.2em}c}
    \nju_coverbox_ug:n {学\hfill 生\hfill 姓\hfill 名}
    & \nju_cover_underline_ug:nn {250pt}{\nju_student_name}
  \end{tabular}\\
  \begin{tabular}{p{4.2em}cp{4.2em}c}
    \nju_coverbox_ug:n {导\hfill 师}
    & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_a}
    & \nju_coverbox_ug:n {职\hfill 称}
    & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_a_title}\\

    % 第二导师
    \bool_if:NT \nju_second_mentor
    {
      \nju_coverbox_ug:n {第\hfill 二\hfill 导\hfill 师}
      & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_b}
      & \nju_coverbox_ug:n {职\hfill 称}
      & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_b_title}\\
    }
  \end{tabular}\\

  \begin{tabular}{p{4.2em}c}
    \nju_coverbox_ug:n {提\hfill 交\hfill 日\hfill 期}
    & \nju_cover_underline_ug:nn {250pt}{\nju_submit_date}\\
  \end{tabular}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 封面信息栏 研究生
\tl_new:N \nju_printcoverinfo_g
\tl_set:Nn \nju_printcoverinfo_g 
{
  \begin{tabular}{p{6em}c}
    % 标题换行
    \int_case:nn {\nju_titlelength}
      {
        { 1 } { 
          \nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目}
          & \nju_cover_underline_g:n {\nju_title_a} \\ }
        { 2 } {
          \nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目}
          & \nju_cover_underline_g:n {\nju_title_a} \\
          & \nju_cover_underline_g:n {\nju_title_b} \\ }
        { 3 } { 
          \nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目}
          & \nju_cover_underline_g:n {\nju_title_a} \\
          & \nju_cover_underline_g:n {\nju_title_b} \\
          & \nju_cover_underline_g:n {\nju_title_c} \\}
      }

    \nju_coverbox_g:n {作\hfill 者\hfill 姓\hfill 名}
    & \nju_cover_underline_g:n {\nju_student_name}\\
    \nju_coverbox_g:n {专\hfill 业\hfill 名\hfill 称}
    & \nju_cover_underline_g:n {\nju_major}\\
    \nju_coverbox_g:n {研\hfill 究\hfill 方\hfill 向}
    & \nju_cover_underline_g:n {\nju_field}\\
    \nju_coverbox_g:n {指\hfill 导\hfill 教\hfill 师}
    & \nju_cover_underline_g:n {\nju_mentor_full}\\
  \end{tabular}
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 绘制封面命令
\tl_new:N \nju_printcover_nl % 国家图书馆封面
\tl_new:N \nju_printcover_ug % 本科封面
\tl_new:N \nju_printcover_g % 研究生封面
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 按需绘制国家图书馆封面,修改自旧模板
\bool_if:NT \nju_nl_cover
{
  \tl_set:Nn \nju_printcover_nl 
  {
    \thispagestyle{empty}
    \pdfbookmark[0]{国家图书馆封面}{nl}
    {
      % 顶端
      \hspace{0mm}
      \vskip -20mm \hskip -15mm
      \songti\zihao{-4}
      \makebox[40pt][l]{分类号}
      \nju_cover_underline_nl:nn {150pt}{\nju_classification}
      \hfill
      \makebox[40pt][l]{密级}
      \nju_cover_underline_nl:nn {150pt}{\nju_securitylevel}
      \vskip 10pt \hskip -15mm
      \makebox[40pt][l]{UDC}
      \nju_cover_underline_nl:nn {150pt}{\nju_udc}
    }
  
    % 中部
    \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_underline_nl:nn {14em}{\nju_title_a}\\
        \nju_cover_underline_nl:nn {14em}{\nju_title_b}\\
        \nju_cover_underline_nl:nn {14em}{\nju_title_c}\\
      }
      \vskip \stretch{1}
      {\kaishu\zihao{4}(题名和副题名)}
      \vskip \stretch{1} \vskip 5mm
      {\kaishu\zihao{1}\uline{\makebox{\nju_student_name}}}
      \vskip \stretch{1}
      {\kaishu\zihao{4}(作者姓名)}
    \end{center}
  
    % 底部
    \vskip\stretch{1}
    {
      \kaishu\zihao{4}
      \noindent 指导教师姓名、职务、职称、学位、单位名称及地址%
      \nju_cover_underline_nl:nn {94pt}{\nju_mentor_a}\par
      \noindent\nju_cover_underline_nl:nn {\textwidth}{%
      \nju_mentor_info}\par
      \noindent 申请学位级别%
      \nju_cover_underline_nl:nn {9em}{\nju_degree_title}%
      \noindent 专业名称%
      \uline{\hfill\nju_major\hfill}\par% 需要调整下划线长度
      \noindent 论文提交日期%
      \nju_cover_underline_nl:nn {9em}{\nju_submit_date}%
      论文答辩日期%
      \uline{\hfill\nju_defend_date\hfill}\par% 需要调整下划线长度
      \noindent 学位授予单位和日期\uline{\hfill}\par
      \noindent\hfill 答辩委员会主席:%
      \nju_cover_underline_nl:nn {9em}{\nju_reviewer_chairman}\par
      \noindent\hfill 评阅人:%
      \nju_cover_underline_nl:nn {9em}{\nju_reviewer_a}\par
      \noindent\hfill\nju_cover_underline_nl:nn {9em}{\nju_reviewer_b}\par
      \noindent\hfill\nju_cover_underline_nl:nn {9em}{\nju_reviewer_c}\par
      \noindent\hfill\nju_cover_underline_nl:nn {9em}{\nju_reviewer_d}\par
      
      \begin{center}
        \kaishu\zihao{3}\hspace{2em} 年\hspace{1em} 月\hspace{1em} 日
      \end{center}
      \vskip -10mm
      }
    \cleardoublepage
  }
}

% 本科封面
\tl_set:Nn \nju_printcover_ug 
{
  \thispagestyle{empty}
  \pagenumbering{Roman}
  % Start
  \pdfbookmark{封面}{封面} % 将封面插入pdf书签
  \begin{spacing}{1.25}
  \vskip 0mm
  \hspace{-10mm}
  \includegraphics[height=3cm]{njulogo}\smallskip 
  \begin{center}
    \includegraphics[height=3.35cm]{njuname}
    \vskip 10mm 
    {\zihao{1}\makebox[9em][s]{\bf{\songti\nju_type_name}}}
    \vfill
    \vskip\stretch{0}
    {\bgroup
    \kaishu\zihao{3}
    \def\tabcolsep{1pt}
    \def\arraystretch{1.5}
    \nju_printcoverinfo_ug % 绘制信息框
    \egroup}
    \vfill
  \end{center}
  \end{spacing}
  \cleardoublepage
  % \vfill
  % \newpage
}

% 研究生封面
\tl_set:Nn \nju_printcover_g 
{
  \thispagestyle{empty}
  \pagenumbering{Roman}
  % Start
  \pdfbookmark{封面}{封面} % 将封面插入pdf书签
  \begin{spacing}{1.25}
  \begin{center}
    \hspace{0pt} \vskip 5mm
    \includegraphics[height=1.9cm]{njulogo}
    \vskip 10mm 
    \includegraphics[height=2cm]{njuname-large}
    \vskip 15mm 
    {\zihao{1}\makebox[10em][s]{\bf{\kaishu\nju_type_name}}}
    \vskip 5mm
    {\zihao{1}\bf{\kaishu{(申请\nju_degree_title 学位)}}}
    \par\vfill
    \vskip\stretch{0}
    {\bgroup
    \bf\kaishu\zihao{3}
    \def\tabcolsep{1pt}
    \def\arraystretch{1.5}
    \vskip 10mm
    \nju_printcoverinfo_g % 绘制信息框
    \egroup}
    \vfill
    \vskip 10mm
    \bf\kaishu\zihao{4}\nju_submit_date
    \vskip 15mm
  \end{center}
  \end{spacing}

  \newpage % 封面背面
  \thispagestyle{empty}
  \begin{spacing}{1.625}
    % TODO: 等待调整格式
    \hspace{0pt} \vfill
    {\bgroup
    \kaishu\zihao{3}
    \makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\nju_student_id}
    \par
    \makebox[6em][s]{\bf\kaishu 论文答辩日期}:\nju_defend_date
    \par
    \makebox[6em][s]{\bf\kaishu 指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字)
    \par
    \egroup}
    \vskip 15mm
  \end{spacing}
  \cleardoublepage
}

% 重定义maketitle生成封面
\tl_set:Nn \maketitle 
{%
  \str_if_eq:NNTF { \nju_degree } { ug } 
  {
    \nju_printcover_nl % 国家图书馆封面
    \nju_printcover_ug % 本科封面
  } 
  { 
    \nju_printcover_nl % 国家图书馆封面
    \nju_printcover_g % 研究生封面 
  } 
}
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
%
% Put text here.
%    \begin{macrocode}
% 判断学位
\str_if_eq:NNTF {\nju_degree} { ug } 
{   
  % 本科摘要环境
  \NewDocumentEnvironment{abstract} {}
  {%
    % \pagestyle{plain}
    % \pagenumbering{Roman}
    % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
      \kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}}
    \end{center}
    {\bgroup
      \kaishu\zihao{-4}
      \tl_set:Nn \tabcolsep {0pt}
      \tl_set:Nn \arraystretch {0.8}
      \noindent
      题目: \nju_title \\
      院系: \nju_department \\
      专业: \nju_major \\
      本科生姓名: \nju_student_name \\
      指导教师(姓名、职称):\nju_mentor_full \\
      摘要:
      \egroup
    }
    \kaishu\zihao{-4}\par%
  }{%
  \newpage
  }

  % 中文关键词
  \NewDocumentCommand \keywords {m} {%
    \par\vspace{2ex}\noindent%
    {\kaishu\zihao{-4}\makebox[4em][s]{关键词{:}}}~{#1}%
  }

  % 英文摘要
  \NewDocumentEnvironment{englishabstract} {}
  {%
    \pagestyle{plain}
    % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
        \kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)英文摘要}}}
    \end{center}
    {
      \bgroup
      THESIS: ~~\nju_title_en \\
      DEPARTMENT: ~~\nju_department_en \\
      SPECIALIZATION: ~~\nju_major_en \\
      UNDERGRADUATE:~~\nju_student_name_en \\
      MENTOR:~~\nju_mentor_full_en \\
      ABSTRACT:
      \egroup
    }
    \zihao{-4}\par%
  }{%
  \cleardoublepage
  \newpage
  }

  % 英文关键词
  \NewDocumentCommand \englishkeywords {m} {%
    \par\vspace{2ex}\noindent%
    {KEYWORDS{:}}~~{#1}%
  }
}
{ 
  % 研究生摘要环境
  \NewDocumentEnvironment{abstract} {}
  {%
    \pagestyle{plain}
    \pagenumbering{Roman}
    % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
      \kaishu\zihao{-2}{\textbf{\uuline{南京大学研究生毕业论文中文摘要首页用纸}}}
    \end{center}
    
    \bgroup
    \kaishu\zihao{4}
    \tl_set:Nn \tabcolsep {0pt}
    \tl_set:Nn \arraystretch {0.8}
    \noindent
    毕业论文题目:\hspace{0.5em}\nju_underline:n {\nju_title\hfill}\\    
    \uline{\makebox[9em]{\nju_major}}专业\uline{\makebox[4em]{\nju_grade}}级
    \str_if_eq:NNTF {\nju_degree} { phd } {博}{硕}
    士生姓名:\uline{\hfill\nju_student_name\hfill} \\
    指导教师(姓名、职称):\uline{\hfill\nju_mentor_full\hfill}\par
    \egroup
  
    \kaishu\zihao{4}\par%
  }{%
  \newpage
  }
  
  % 中文关键词
  \NewDocumentCommand \keywords {m} {%
    \par\vspace{2ex}\noindent%
    {\kaishu\zihao{4}\makebox[4em][s]{关键词{:}}}~{#1}%
  }
  
  % 英文摘要
  \NewDocumentEnvironment{englishabstract} {}
  {%
    \pagestyle{plain}
    % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
        \kaishu\zihao{-2}{\textbf{\uuline{南京大学研究生毕业论文英文摘要首页用纸}}}
    \end{center}
    {
      \bgroup
      \zihao{4}
      THESIS: ~~\nju_title_en \\
      SPECIALIZATION: ~~\nju_major_en \\
      POSTGRADUATE:~~\nju_student_name_en \\
      MENTOR:~~\nju_mentor_full_en\par
      \egroup
    }
    \zihao{4}\par%
  }{%
  \cleardoublepage
  \newpage
  }
  
  % 英文关键词
  \NewDocumentCommand \englishkeywords {m} {%
    \par\vspace{2ex}\noindent%
    {KEYWORDS{:}}~~{#1}%
  }
}
%    \end{macrocode}
%