Skip to content
Snippets Groups Projects
njuthesis.dtx 160 KiB
Newer Older
% \subsection{摘要页}
Yu Xiong's avatar
Yu Xiong committed
%
% \subsubsection{内部命令}
%
% \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}
%
% \begin{macro}{\@@_abs_bookmark:,\@@_abs_bookmark_en:}
% \changes{v0.14}{2021/12/21}{将摘要插入目录。}
% 生成摘要的目录条目。
%    \begin{macrocode}
\cs_new_protected:Npn \@@_abs_bookmark:
  {
    \phantomsection
    \addcontentsline { toc } { chapter }
      { \c_@@_sec_format_tl \c_@@_name_lang_tl \c_@@_name_abstract_tl }
  }
\cs_new_protected:Npn \@@_abs_bookmark_en:
    \phantomsection
    \addcontentsline { toc } { chapter }
      { \c_@@_sec_format_tl \c_@@_name_abstract_en_tl }
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}
%
%
% \subsubsection{绘制部件}
%
% \begin{macro}{\@@_abs_title_ug:n}
% 绘制本科生摘要标题。
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
% \end{arguments}
%    \begin{macrocode}
\cs_generate_variant:Nn \clist_map_inline:nn { Vn }
\cs_new_protected:Npn \@@_abs_title_ug:n #1
    \@@_name:n { nju     } \@@_name:n { type     }
    \@@_name:n { lang #1 } \@@_name:n { abstract }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_abs_info_ug:nn}
% 绘制本科生摘要信息栏。
% \begin{arguments}
%   \item 语言,空置为中文,|_en| 为英文
%   \item 分隔符
% \end{arguments}
% 本科生摘要页面不含下划线,因而不用确定文本宽度,绘制命令较为简单。
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}
%
% \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_clist { 1 } { 20 } } \\
        \@@_uline:n { \textwidth } \@@_qquad:
        \tl_range:Nnn \l_@@_info_title_clist { 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}
%
% \begin{macro}{\@@_print_keywords:nn}
% 生成中英文关键词列表。
% \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
  {
    \skip_vertical:n { 2 ex }
    \group_begin:
%    \end{macrocode}
% “关键词”字样使用加粗黑体。
%    \begin{macrocode}
      \noindent \bf \heiti
      \use:c { c_@@_name_keywords #1 _tl }
    \group_end:
    \clist_use:cn { l_@@_info_keywords #1 _clist } { #2 }
%    \end{macrocode}
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}
Yu Xiong's avatar
Yu Xiong committed
\NewDocumentEnvironment{abstract} { +b }
Yu Xiong's avatar
Yu Xiong committed
  {
    \cleardoublepage
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
    \@@_abs_bookmark_en:
Yu Xiong's avatar
Yu Xiong committed
    \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { _en } { :~ }
Yu Xiong's avatar
Yu Xiong committed
    \group_begin: \kaishu \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 }
  { \njuchapter { \c_@@_name_preface_tl         } #1 } { }
\NewDocumentEnvironment { acknowledgement } { +b }
  { \njuchapter { \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
%
% \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}
    \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}
Yu Xiong's avatar
Yu Xiong committed
%</class>
%    \end{macrocode}
Yu Xiong's avatar
Yu Xiong committed
% \end{macro}