Skip to content
Snippets Groups Projects
njuthesis.dtx 179 KiB
Newer Older
      \@@_cover_entry:nnn { dept     } { #1 } { #2 }
      \@@_cover_entry:nnn { major    } { #1 } { #2 }
      \@@_multiline_title:nnn  { \bf } { #1 } { #2 }
Yu Xiong's avatar
Yu Xiong committed
      \@@_cover_bientry:nnnn { grade } { id } { #1 } { #3 }
      \@@_cover_entry:nnn { author   } { #1 } { #2 }
      \@@_cover_supv_entry:nnn { supv } { #1 } { #3 }
      \bool_if:NT \l_@@_second_supv_bool
        { \@@_cover_supv_entry:nnn { supv_ii } { #1 } { #3 } }
      \@@_cover_entry:nnn { sm_date  } { #1 } { #2 }
  }
%    \end{macrocode}
% \end{macro}
%
% \paragraph{研究生}
%
% \subparagraph{正面} 包括校名、校徽、标题、信息栏。
%
% \begin{macro}{cover/g/emblem-img}
% 研究生封面校徽图片实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / emblem-img }
  {
    content     = \njuemblem [ black ] { ! } { 1.9 cm },
    bottom-skip = 1 cm
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/name-img}
% 研究生封面校名图片实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / name-img }
    content = \njuname [ black ] { 4.4 cm } { ! },
    bottom-skip = 2 cm
Yu Xiong's avatar
Yu Xiong committed
  }
%    \end{macrocode}
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{cover/g/type}
% 研究生封面标题实例。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / type }
    content     =
      \@@_spread_box:nnn { 9 em } { } { \l_@@_info_type_tl },
    format      = \zihao { -1 } \bfseries,
    bottom-skip = 1 cm
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/degree}
% 研究生封面标题实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / degree }
  {
    content     = \c_@@_name_apply_tl,
    format      = \zihao { -1 } \bfseries,
    bottom-skip = 1 cm plus 1.5 fil
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/info}
% 研究封面信息栏实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / info }
    content     = \@@_cover_info_g:nn { 6.2 em } { 18 em },
    bottom-skip = 0 pt plus 1.5 fil
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/date}
% 研究封面日期实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / date }
  { content = \l_@@_info_sm_date_tl }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_cover_info_g:nn}
% 研究生封面信息栏。
% \begin{arguments}
%   \item 名称盒子宽度,|dim| 型变量
%   \item 内容盒子宽度,|dim| 型变量
% \end{arguments}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cover_info_g:nn #1#2
    \begin{minipage} { #1 + #2 + 0.3 em }
      \@@_multiline_title:nnn { } { #1 } { #2 }
Yu Xiong's avatar
Yu Xiong committed
      \clist_map_inline:nn { author, major, field, supv_full }
Yu Xiong's avatar
Yu Xiong committed
        { \@@_cover_entry:nnn { ##1 } { #1 } { #2 } }
  }
%    \end{macrocode}
% \end{macro}
%
% \subparagraph{背面}
%
% \begin{macro}{cover/g/back}
% 研究生封面背面信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / back }
  {
    content = \@@_cover_back_g:,
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_cover_back_g:}
Yu Xiong's avatar
Yu Xiong committed
% 研究生封面背面信息。格式存在变化,没有使用循环来简化。
%    \begin{macrocode}
\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
% \subparagraph{英文封面} 包括标题、顶部、中部、校徽、底部。
%
% \begin{macro}{cover/g/en/title}
% 研究生英文封面标题实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / en / title }
    content     = \l_@@_info_title_en_tl,
    format      = \bf \sffamily \zihao { 2 },
    bottom-skip = 2 cm
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/en/top}
% 研究生英文封面顶部信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / en / top }
      { by }
      \skip_vertical:N \c_zero_skip
      \textbf { \sffamily \l_@@_info_author_en_tl }
      \skip_vertical:n { .5 cm }
      { Supervised~ by }
      \skip_vertical:N \c_zero_skip
      \textsf { \l_@@_info_supv_full_en_tl },
    format      = \zihao { 4 },
    bottom-skip = 0 pt plus 1.2 fil
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/en/middle}
% 研究生英文封面中部信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / en / middle }
      \c_@@_cover_en_text_tl \@@_vskip:
      \textsc { \clist_item:Nn \c_@@_name_degree_en_clist
Yu Xiong's avatar
Yu Xiong committed
                  { \l_@@_info_degree_int } }
      \@@_vskip: { in } \@@_vskip:
      \l_@@_info_major_en_tl,
    bottom-skip = 2 cm
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/en/emblem-img}
% 研究生英文封面校徽图片实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / en / emblem-img }
    content     = \njuemblem [ black ] { ! } { 2.5 cm },
    bottom-skip = 1.5 cm
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/g/en/bottom}
% 研究生英文封面底部信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / g / en / bottom }
  {
    content =
      \l_@@_info_dept_en_tl \skip_vertical:N \c_zero_skip
      \c_@@_name_nju_en_tl  \skip_vertical:n { 1 cm }
      \l_@@_info_sm_date_en_tl
% \subparagraph{国家图书馆封面} 包括顶部、题名、标题、中部、底部、日期。
%
% \begin{macro}{cover/nl/top}
% 国家图书馆封面顶部信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / nl / top }
    content     = \@@_cover_top_nl:,
    bottom-skip = 2 cm
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/nl/name}
% 国家图书馆封面标题名称实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / nl / name }
      \@@_spread_box:nnn { 6 em } { } { \c_@@_name_title_tl },
    format      = \zihao { -0 },
    bottom-skip = 0 pt plus 1.2 fil
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/nl/title}
% 国家图书馆封面标题实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / nl / title }
    content     = \@@_cover_title_nl:,
    format      = \zihao { 1 },
    bottom-skip = 1 cm
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/nl/middle}
% 国家图书馆封面中部信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / nl / middle }
    content     = \@@_cover_info_nl:,
    format      = \zihao { 4 },
    bottom-skip = 0 pt plus 1.2 fil
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/nl/bottom}
% 国家图书馆封面底部信息实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / nl / bottom }
    content     = \@@_cover_bottom_nl:,
    bottom-skip = 1 cm,
    align       = r
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover/nl/date}
% 国家图书馆封面底部日期实例。
%    \begin{macrocode}
\@@_declare_element:nn { cover / nl / date }
  {
    content = \@@_qquad: 年 \@@_quad: 月 \@@_quad: 日,
    format  = \kaishu \zihao { 3 }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_cover_top_nl:}
% 国家图书馆封面顶部信息。
\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
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
% \begin{macro}{\@@_cover_title_nl:}
% 国家图书馆封面标题。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cover_title_nl:
  {
    \@@_split_title:n { \l_@@_info_title_tl }
    \@@_multiline_box:nnnn { \l_@@_tmp_int } \l_@@_tmp_clist { 3 } { 15 em }
    \skip_vertical:n { - 0.5 cm }
    { \zihao { 4 } \c_@@_name_title_nl_tl }
    \skip_vertical:N \c_zero_skip
    \@@_ulined_center_box:nn { 4.5 em } { \l__nju_info_author_tl }
    \skip_vertical:n { - 0.5 cm }
    { \zihao { 4 } { ( } \c_@@_name_author_tl { ) } }
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_cover_info_nl:}
% 国家图书馆封面信息栏。
\cs_new_protected:Npn \@@_cover_info_nl:
    \tl_set:Nn \l_@@_info_supv_tl
      { \clist_item:Nn \l_@@_info_supv_clist { 1 } }
    \tl_set:Nn \l_@@_info_supv_ttl_tl
      { \clist_item:Nn \l_@@_info_supv_clist { 2 } }
    \@@_uline_entry:Nnnn   \l_@@_tmp_dim { supv_info } { supv   } { } \\
Yu Xiong's avatar
Yu Xiong committed
    \@@_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 }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_cover_bottom_nl:}
% 国家图书馆封面底部信息。
\cs_new_protected:Npn \@@_cover_bottom_nl:
    \@@_name:n { chairman } \@@_hskip:
    \@@_ulined_center_box:nn { 9 em } { \@@_info:n { chairman } } \\
    \@@_name:n { reviewer } \@@_hskip:
Yu Xiong's avatar
Yu Xiong committed
    \@@_multiline_box:nnnn { \l_@@_tmp_int }
      { \l_@@_info_reviewer_clist } { 4 } { 9 em }
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
Yu Xiong's avatar
Yu Xiong committed
% \subsubsection{绘制封面}
% \changes{v0.13}{2021/12/10}{使用 \hologo{LaTeX3} 语法重构本科生封面。}
% \changes{v0.13}{2021/12/11}{使用 \hologo{LaTeX3} 语法重构研究生封面。}
% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构国家图书馆封面。}
% \changes{v0.15}{2022/01/25}{将封面页面封装为对象。}
% 定义封面页面的具体配置参数。
%
% \begin{macro}{cover-ug-default}
% 默认本科生封面实例。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\@@_declare_page:nn { cover-ug-default }
    element     = { emblem-img, name-img, title, info },
    prefix      = cover / ug /,
    bottom-skip = 0.5 cm plus 1.5 fill
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{cover-g-front-default}
% 默认研究生普通封面正面实例。
%    \begin{macrocode}
\@@_declare_page:nn { cover-g-front-default }
    element  = { emblem-img, name-img, type, degree, info, date },
    prefix   = cover / g /,
    format   = \zihao { 3 } \kaishu,
    top-skip = 1.5 cm
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover-g-back-default}
% 默认研究生普通封面背面实例。
%    \begin{macrocode}
\@@_declare_page:nn { cover-g-back-default }
  {
    element  = { back },
    prefix   = cover / g /,
    format   = \zihao { 3 } \kaishu,
    top-skip = 20 cm
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover-g-en-default}
% 默认研究生英文封面实例。
%    \begin{macrocode}
\@@_declare_page:nn { cover-g-en-default }
  {
    element = { title, top, middle, emblem-img, bottom },
    prefix  = cover / g / en /,
    top-skip = 0 pt plus 1.2 fil
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cover-nl-default}
% 默认国家图书馆封面实例。
%    \begin{macrocode}
\@@_declare_page:nn { cover-nl-default }
  {
    element     = { top, name, title, middle, bottom, date },
    prefix      = cover / nl /,
    format      = \kaishu
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_make_cover_ug:}
% 生成本科生封面。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_make_cover_ug:
  { \UseInstance { nju } { cover-ug-default } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_make_cover_g:}
% 生成研究生的普通封面。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_make_cover_g:
  {
    \clist_map_inline:nn { front, back, en }
      { \UseInstance { nju } { cover-g- ##1 -default } }
  }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_make_cover_nl:}
% 生成研究生的国家图书馆封面。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_make_cover_nl:
  { \UseInstance { nju } { cover-nl-default } }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
% \begin{macro}{\@@_make_orig_decl: }
% \changes{v0.13}{2021/12/15}{加入本科生的诚信承诺书。}
% 生成生成本科生的诚信承诺书或研究生的学位论文原创性声明。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_make_orig_decl:
    \chapter* { \c_@@_name_nju_tl \c_@@_name_orig_decl_tl }
    \thispagestyle { empty }
    \c_@@_orig_decl_text_tl
    \vfil
    \begin{flushright}
      \clist_set:Nn \l_@@_tmp_clist { orig_sign, id, orig_date }
      \int_compare:nF { \l_@@_info_degree_int == 1 }
        { \clist_remove_all:Nn \l_@@_tmp_clist { id } }
      \clist_map_inline:Nn \l_@@_tmp_clist
        { \@@_vskip: \@@_name:n { ##1 } : \@@_uline:n { 7 em } }
    \end{flushright}
    \vfil
  }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
%
%
% \subsubsection{用户接口}
%
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\maketitle}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.12}{2021/12/01}{仅会生成国家图书馆封面或者普通封面之一。}
% \changes{v0.13}{2021/12/12}{重新绘制封面。}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.13}{2021/12/15}{草稿模式下不绘制封面。}
% 重定义 \cs{maketitle} 以生成封面。
Yu Xiong's avatar
Yu Xiong committed
% 在草稿模式下,封面绘制将被禁用,有助于提升编译速度。
%    \begin{macrocode}
\RenewDocumentCommand \maketitle { }
  {
Yu Xiong's avatar
Yu Xiong committed
    \bool_if:NF \g_@@_draft_bool
      {
        \pagestyle { empty }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面,
% 反之生成普通封面。
%    \begin{macrocode}
        \bool_if:NTF \g_@@_nlcover_bool
          { \@@_make_cover_nl: }
Yu Xiong's avatar
Yu Xiong committed
          { \use:c { @@_make_cover_ \l_@@_info_diploma_tl : } }
%    \end{macrocode}
% 如果在选择了 \opt{decl-page},就生成本科生的诚信承诺书或研究生的原创性声明。
%    \begin{macrocode}
        \bool_if:NT \g_@@_orig_decl_bool { \@@_make_orig_decl: }
Yu Xiong's avatar
Yu Xiong committed
      }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% 生成封面后清除标题中的换行控制符,便于在摘要中输出。
%    \begin{macrocode}
    \tl_remove_all:Nn \l_@@_info_title_tl { \\ }
%    \end{macrocode}
% 在标题页后使用大写罗马字母页码,恢复正常字体设置。
%    \begin{macrocode}
    \cleardoublepage
Yu Xiong's avatar
Yu Xiong committed
    \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
%
% \subsubsection{内部命令}
%
%    \begin{macrocode}
\keys_define:nn { nju / style }
  {
%    \end{macrocode}
% \begin{macro}{style/abstract-in-toc}
% \changes{v0.15}{2022/02/04}{可选择摘要是否出现在目录中。}
% 是否将摘要添加到目录。
%    \begin{macrocode}
    abstract-in-toc .bool_gset:N = \g_@@_abs_in_toc_bool,
    abstract-in-toc   .initial:n = true
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_abs_bookmark:n}
% \changes{v0.14}{2021/12/21}{将摘要插入目录。}
% 生成摘要的目录条目。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_abs_bookmark:n #1
  {
    \phantomsection
    \bool_if:NTF \g_@@_abs_in_toc_bool
      { \@@_add_tocline:n {#1} }
      { \pdfbookmark [0] {#1} { abstract } }
  }
\cs_generate_variant:Nn \@@_abs_bookmark:n { V }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_abs_title_uuline:n}
% 摘要标题双层下划线格式。
% \begin{arguments}
%   \item 宽度,|dim| 型变量
% \end{arguments}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_abs_title_uuline:n #1
  { \bf \kaishu \zihao { -2 } \@@_uuline:n { #1 } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_abs_info_style:n,\@@_abs_info_style_en:n}
% 摘要信息栏通用格式,设置为无缩进、四号或者小四号、楷书。
% \begin{arguments}
%   \item 字号
% \end{arguments}
%    \begin{macrocode}
\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}
%
%
% \subsubsection{绘制部件}
% \paragraph{本科生}
%
% \begin{macro}{\@@_abs_title_ug:n}
% 绘制本科生摘要标题。
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
% \end{arguments}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_abs_title_ug:n #1
    \clist_map_inline:nn { nju, type, lang #1, abstract }
      { \@@_name:n { ##1 } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_abs_info_ug:nn}
% 绘制本科生摘要信息栏。
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
%   \item 分隔符
% \end{arguments}
% 本科生摘要页面不含下划线,因而不用确定文本宽度,绘制命令较为简单。
Yu Xiong's avatar
Yu Xiong committed
%    \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}
%
% \paragraph{研究生}
%
% \begin{macro}{\@@_abs_title_g:n}
% 绘制研究生摘要标题。
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
% \end{arguments}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_abs_title_g:n #1
Yu Xiong's avatar
Yu Xiong committed
    \@@_name:n { nju     } \@@_info:n { type       }
    \@@_name:n { lang #1 } \@@_name:n { abstract_r }
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}{\@@_abs_info_g:nn}
Yu Xiong's avatar
Yu Xiong committed
% 绘制研究生摘要信息栏。
% \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
Yu Xiong's avatar
Yu Xiong committed
            \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}
% \paragraph{关键词列表}
%
% \begin{macro}{\@@_print_keywords:nn}
% \changes{v0.15}{2022/01/26}{为关键词列表添加悬挂缩进。}
% 生成中英文关键词列表。
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
%   \item 关键词分隔符
% \end{arguments}
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\cs_new_protected:Npn \@@_print_keywords:nn #1#2
  {
    \exp_args:NNc
      \tl_set_eq:NN \l_@@_tmp_tl { c_@@_name_keywords #1 _tl }
    \@@_get_text_width:Nn \l_@@_tmp_dim { \l_@@_tmp_tl }
%    \end{macrocode}
% 关键词列表的悬挂缩进样式由 \tn{list} 环境产生。
%    \begin{macrocode}
    \list { }
      {
        \labelwidth  \l_@@_tmp_dim
        \labelsep    \c_zero_dim
        \leftmargin  \c_zero_dim
        \rightmargin \c_zero_dim
        \advance \leftmargin \l_@@_tmp_dim
%    \end{macrocode}
% 使用粗体作为标签样式。
%    \begin{macrocode}
        \cs_set_eq:NN \makelabel \textbf
      }
    \item [ \l_@@_tmp_tl ]
      \clist_use:cn { l_@@_info_keywords #1 _clist } { #2 }
    \endlist
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
% \subsubsection{绘制摘要}
%
% \begin{macro}{\@@_make_abs_ug:nn}
% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构本科生摘要。}
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
%   \item 关键词分隔符
% \end{arguments}
% 生成本科生摘要。
Yu Xiong's avatar
Yu Xiong committed
%    \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:
  }
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}{\@@_make_abs_g:nn}
% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构研究生摘要。}
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
%   \item 关键词分隔符
% \end{arguments}
% 生成研究生摘要。
Yu Xiong's avatar
Yu Xiong committed
%    \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}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
%
%
% \subsubsection{用户接口}
% \begin{environment}{abstract}
% \changes{v0.13}{2021/12/12}{重新绘制摘要。}
Yu Xiong's avatar
Yu Xiong committed
% 中文摘要环境。
%    \begin{macrocode}
\NewDocumentEnvironment { abstract } { +b }
Yu Xiong's avatar
Yu Xiong committed
  {
    \cleardoublepage
    \thispagestyle { plain }
    \@@_abs_bookmark:V { \c_@@_name_lang_tl \c_@@_name_abstract_tl }
Yu Xiong's avatar
Yu Xiong committed
    \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { } { : }
Yu Xiong's avatar
Yu Xiong committed
    \group_begin: \kaishu \zihao { -4 } #1
  { \@@_print_keywords:nn { } { ; } \group_end: }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
% \end{environment}
% \begin{environment}{abstract*}
Yu Xiong's avatar
Yu Xiong committed
% 英文摘要环境。\pkg{xparse} 目前不支持合并带有星号的环境,因此需要单独定义。
%    \begin{macrocode}
\NewDocumentEnvironment { abstract* } { +b }
Yu Xiong's avatar
Yu Xiong committed
  {
    \cleardoublepage
    \thispagestyle { plain }
    \@@_abs_bookmark:V { \c_@@_name_abstract_en_tl }
Yu Xiong's avatar
Yu Xiong committed
    \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { _en } { :~ }
    \group_begin: \zihao{ -4 } #1
  { \@@_print_keywords:nn { _en } { ;~ } \group_end: }
%    \end{macrocode}
% \end{environment}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsection{前言致谢}
% \begin{environment}{preface}
% \begin{environment}{acknowledgement}
% 单独制作的前言致谢页。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\NewDocumentEnvironment { preface         } { +b }
  { \@@_chapter:V { \c_@@_name_preface_tl         } #1 } { }
\NewDocumentEnvironment { acknowledgement } { +b }
  { \@@_chapter:V { \c_@@_name_acknowledgement_tl } #1 } { }
Yu Xiong's avatar
Yu Xiong committed
%    \end{macrocode}
% \end{environment}
% \end{environment}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsection{成果列表}
%
Yu Xiong's avatar
Yu Xiong committed
% \begin{macro}{\njupaperlist}
% \changes{v0.10}{2021/09/29}{新增了成果列表页面。}
% \changes{v0.14}{2021/12/20}{成果列表中可突出指定作者姓名及年份。}
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\NewDocumentCommand \njupaperlist
  { O { \c_@@_name_paperlist_tl } m }
    \group_begin:
%    \end{macrocode}
% 修改姓名的显示方式,使被注解的姓名可被加粗下划线表示。
%    \begin{macrocode}
    \RenewDocumentCommand \mkbibnamegiven  { m }
      { \ifitemannotation { thesisauthor }
          { \njuline { \bf ##1 } } { ##1 } }
    \RenewDocumentCommand \mkbibnamefamily { m }
      { \ifitemannotation { thesisauthor }
          { \njuline { \bf ##1 } } { ##1 } }
%    \end{macrocode}
% 修改年份的显示方式,默认进行加粗。
%    \begin{macrocode}
Yu Xiong's avatar
Yu Xiong committed
    \RenewDocumentCommand \mkbibdateshort { m m m }
      { \textbf { \thefield { ##1 } } }
Yu Xiong's avatar
Yu Xiong committed
      \nocite { #2 }
      \printbibliography [ heading = subbibliography, title = #1 ]
Yu Xiong's avatar
Yu Xiong committed
    \end{refsection}
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsection{符号表}
%
% \begin{macro}{\@@_notation_label:n}
% 左对齐的标签格式,用于符号表。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_notation_label:n #1 { #1 \hfil }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_make_notation:nn}
Yu Xiong's avatar
Yu Xiong committed
% 生成符号表。由于符号表只有符号和说明两列,相比于 \env{longtable} 环境,
% \env{description} 环境的语法更为简洁直观,且说明文字可以换行,因而此处使用
% \hologo{LaTeX2e} 的列表环境进行封装,定义和语法参见 \file{source2e.pdf} 中的
% File I \quad ltlists.dtx 一章。
Yu Xiong's avatar
Yu Xiong committed
%    \begin{macrocode}
\cs_new_protected:Npn \@@_make_notation:nn #1#2
  {
    \dim_set:Nn \l_@@_tmp_dim { \textwidth - #1 - #2 }
    \list { }
      {
%    \end{macrocode}
% \tn{list} 环境使用宽度固定的盒子制作标签,通过指定这个盒子的宽度
% \tn{labelwidth} 即可确定左侧标签区域的宽度。
%    \begin{macrocode}
Yu Xiong's avatar
Yu Xiong committed
        \labelwidth #2
        \labelsep   \c_zero_dim
        \itemsep    \c_zero_dim
        \parsep     \c_zero_dim
%    \end{macrocode}
% 右侧说明文字区域的宽度无法直接指定,而是靠计算左右边距 \tn{leftmargin} 和
% \tn{rightmargin} 得到的。
%    \begin{macrocode}
        \leftmargin  .5\l_@@_tmp_dim
Yu Xiong's avatar
Yu Xiong committed
        \rightmargin \leftmargin
        \advance \leftmargin #2
        \cs_set_eq:NN \makelabel \@@_notation_label:n
Yu Xiong's avatar
Yu Xiong committed
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{notation}
Yu Xiong's avatar
Yu Xiong committed
% \changes{v0.15}{2022/01/17}{提供符号表环境。}
Yu Xiong's avatar
Yu Xiong committed
% 符号表环境。
% \begin{arguments}
%   \item 说明区域宽度,初始值为 10 em。说明宽度的调整更为常见,所以放在前面。
%   \item 符号区域宽度,初始值为 5 em
% \end{arguments}
%    \begin{macrocode}
\NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } }
    \@@_chapter:V { \c_@@_name_notation_tl }
Yu Xiong's avatar
Yu Xiong committed
    \@@_make_notation:nn { #1 } { #2 }
  }
  { \endlist }
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{notation*}
% 带有星号的符号表不会插入目录。
%    \begin{macrocode}
\NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } }
  {
    \chapter * { \c_@@_name_notation_tl }
Yu Xiong's avatar
Yu Xiong committed
    \@@_make_notation:nn { #1 } { #2 }
  }
  { \endlist }
%</class>
%    \end{macrocode}
% \end{environment}
%