%%
%% This is file `wu-thesis.code.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% westlakethesis.dtx  (with options: `thesis')
%% -----------------------------------------------------------------------
%%   Copyright (C) 2026 by Mingyu Xia <myhsia@outlook.com>               *
%% -----------------------------------------------------------------------
%%   This work may be distributed and/or modified under the conditions   *
%%   of the LaTeX Project Public License (LPPL), 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.3c or later is part of all distributions of LaTeX     *
%%   version 2008 or later.                                              *
%%                                                                       *
%%   This work has the LPPL maintenance status `maintained'.             *
%%                                                                       *
%%   The Current Maintainer of this work is Mingyu Xia.                  *
%% -----------------------------------------------------------------------
\GetIdInfo $Id: westlakethesis.dtx v0.0.2 2026-06-18 myhsia<myhsia@outlook.com>$
  {Formats of Westlake University dissertations (WESTLAKE)}
\ProvidesExplFile {wu-thesis.code.tex}
  {\ExplFileDate} {\ExplFileVersion} {\ExplFileDescription}
\keys_define:nn { thesis / set }
  {
    title     .tl_set:N   = \l__wu_set_title_tl,
    author    .tl_set:N   = \l__wu_set_author_tl,
    date      .tl_set:N   = \l__wu_set_date_tl,
    bibsource .str_set:N  = \l__wu_set_bib_str,
    subject   .tl_set:N   = \l__wu_set_subject_tl,
    school    .tl_set:N   = \l__wu_set_school_tl,
    PI        .tl_set:N   = \l__wu_set_PI_tl,
    id        .tl_set:N   = \l__wu_set_id_tl,
    master    .bool_set:N = \l__wu_set_master_bool,
      master  .initial:n  = false,
      master  .default:n  = true,
  }
\cs_new_protected:Npn \__wu_westlakeset_aux:
  {
    \clist_map_inline:nn { title, author, subject, school, PI }
      { \__wu_parse_slash_ab:c { l__wu_set_##1_tl } }
    \str_if_empty:NF \l__wu_set_bib_str
      { \bool_gset_true:N \l__wu_load_bib_bool }
  }
\hypersetup
  {
    hidelinks,
  }
\tl_if_eq:nVF { windows } \g__ctex_fontset_tl
  {
    \exp_args:Nno \__wu_msg_warning:nn
      { not ~ recommended ~ fontset } { \g__ctex_fontset_tl }
  }
\geometry { a4paper, hmargin = 1.25in, vmargin = 1in }
\RenewDocumentCommand \maketitle {}
  {
    \__wu_maketitle_cn:
    \__wu_maketitle_en:
  }
\cs_new_protected:Nn \__wu_maketitle_cn:
  {
    \begin{titlepage}
      \group_begin:
        \raggedleft \noindent
        \fangsong
        \linespread{1.0}\selectfont
        \begin{tabular}
          {
            p { 4\ccwd } @{：}
            p \l__wu_cover_id_dim
          }
          \__wu_spread_box:nn  { 4\ccwd } { 单位代码 } &
          \__wu_center_box:nnn { \l__wu_cover_id_dim } { -1.5pt }
            { \l__wu_cover_affilid_tl  } \\
          \__wu_spread_box:nn  { 4\ccwd } { 学号     } &
          \__wu_center_box:nnn { \l__wu_cover_id_dim } { -1.5pt }
            { \l__wu_set_id_tl         } \\
        \end{tabular}
        \par \vspace{1.2\baselineskip}
      \group_end:
      \begin{center}
        \includegraphics[height = 1.63cm]{westlake-badge-cn.pdf}
        \par \vspace{.65\baselineskip}
        \LARGE
        \bool_if:NTF \l__wu_set_master_bool { 硕士 } { 博士 }
        学位论文
        \par \vspace{1.15\baselineskip}
        \group_begin:
          \linespread{1.5}\selectfont \Huge \sffamily
          \parbox { 10\ccwd } { \centering \l__wu_set_title_tl_a }
        \group_end:
      \end{center}
      \vfill
      \begin{center}
        \linespread{1.35} \__wu_fontsize:nn { cn } { 3 }
        \begin{tabular} { p { 4\ccwd } @{：} p { 15ex } }
          \__wu_spread_box:nn  { 4\ccwd } { 培养单位 } &
          \__wu_center_box:nnn {  15ex  } { -4.5pt   }
            {
              \prop_item:No \l__wu_school_cn_prop
                { \l__wu_set_school_tl }
            } \\
          \__wu_spread_box:nn  { 4\ccwd } { 学科     } &
          \__wu_center_box:nnn {  15ex  } { -4.5pt   }
            { \l__wu_set_subject_tl_a  } \\
          \__wu_spread_box:nn  { 4\ccwd } { 研究生   } &
          \__wu_center_box:nnn {  15ex  } { -4.5pt   }
            { \l__wu_set_author_tl_a   } \\
          \__wu_spread_box:nn  { 4\ccwd } { 指导教师 } &
          \__wu_center_box:nnn {  15ex  } { -4.5pt   }
            { \l__wu_set_PI_tl_a       } \\
        \end{tabular}
        \par \vspace{3.5\baselineskip}
        \__wu_fontsize:nn { cn } { 3 }
        \__wu_kernel_year:n { cn } \__wu_kernel_month:n { cn }
      \end{center}
      \vspace*{1.25\baselineskip}
    \end{titlepage}
  }
\cs_new_protected:Nn \__wu_maketitle_en:
  {
    \begin{titlepage}
      \group_begin:
        \raggedleft \noindent
        \fangsong
        \linespread{1.0}\selectfont
        \begin{tabular}
          {
            p \l__wu_cover_code_dim @{~}
            p \l__wu_cover_id_dim
          }
          School ~ Code: &
          \__wu_center_box:nnn { \l__wu_cover_id_dim } { -1.5pt }
            { \l__wu_cover_affilid_tl    } \\
          Student ~ ID:  &
          \__wu_center_box:nnn { \l__wu_cover_id_dim } { -1.5pt }
            { \l__wu_set_id_tl           } \\
        \end{tabular}
        \par \vspace{1.2\baselineskip}
      \group_end:
      \begin{center}
        \includegraphics[height = 1.63cm]{westlake-badge-cn.pdf}
        \par \vspace{2.5\baselineskip}
        \group_begin:
          \linespread{1.3}\selectfont \Huge \sffamily
          \parbox { .9\linewidth }
            {
              \centering
              \__wu_fontsize:nn { en } { 20 } \selectfont \bfseries \sffamily
              \l__wu_set_title_tl_b
            }
            \par \vspace{1.1\baselineskip}
        \group_end:
        \group_begin:
          \__wu_fontsize:nn { cn } { 4 } \sffamily \bfseries
            (
              Degree ~ of ~
              \bool_if:NTF \l__wu_set_master_bool { Master } { Doctor }
            )
        \group_end:
      \end{center}
      \vfill
      \begin{center}
        \linespread{1.35} \__wu_fontsize:nn { cn } { 3 } \sffamily \selectfont
        \begin{tabular}
          {
            p \l__wu_cover_en_table_dim @{~}
            p { 15ex }
          }
          School:     &
          \__wu_center_box:nnn {  15ex  } { -4.8pt   }
            {
              \prop_item:No \l__wu_school_en_prop
                { \l__wu_set_school_tl }
            } \\
          Discipline: &
          \__wu_center_box:nnn {  15ex  } { -4.8pt   }
            { \l__wu_set_subject_tl_b   } \\
          Candidate:  &
          \__wu_center_box:nnn {  15ex  } { -4.8pt   }
            { \l__wu_set_author_tl_b    } \\
          Supervisor: &
          \__wu_center_box:nnn {  15ex  } { -4.8pt   }
            { \l__wu_set_PI_tl_b        } \\
        \end{tabular}
        \par \vspace{3.5\baselineskip}
        \__wu_fontsize:nn { cn } { 3 }
        \__wu_kernel_month:n { en }, \space \__wu_kernel_year:n  { en }
      \end{center}
      \vspace*{1.25\baselineskip}
    \end{titlepage}
  }
\RenewDocumentEnvironment {abstract} { O { en } }
  {
    \cleardoublepage
    \tl_set:Nn \l__wu_abstract_language_tl {#1}
    \null \vspace{1.8\baselineskip}
    \@beginparpenalty\@lowpenalty
    \noindent
    \__wu_kernel_bilingual:nnn {#1}
      {
        \textbf { Abstract:~ }
        \addcontentsline { toc } { chapter } { Abstract }
      }
      {
        \textbf { 摘要： }
        \addcontentsline { toc } { chapter } { 摘要     }
      }
    \ignorespaces
  } { \@endparpenalty\@M }
\hook_gput_code:nnn { env / abstract / before } { . }
  { \linespread{1.63}\selectfont }
\NewDocumentCommand \keywords { m }
  {
    \par \noindent
    \__wu_kernel_bilingual:nnn { \l__wu_abstract_language_tl }
      { \textbf { Keywords: ~ } \clist_use:nn {#1} { ;~ } }
      { \textbf { 关键词：    } \clist_use:nn {#1} { ； } }
  }
\newif \if@mainmatter \@mainmattertrue
\newcommand \frontmatter
  { \cleardoublepage \@mainmatterfalse \pagenumbering {roman} }
\newcommand \mainmatter
  { \cleardoublepage \@mainmattertrue \pagenumbering {arabic} }
\NewDocumentCommand \commitment { O{} }
  {
    \begin{titlepage}
      \null \vspace{1.2\baselineskip}
      \begin{center}
        \__wu_fontsize:nn { cn } { 3 } \sffamily
        \l__wu_commitment_a_title_tl
      \end{center}
      \par \vspace{.5\baselineskip}
      \l__wu_commitment_a_body_tl
      \par \vspace{2\baselineskip} \smallskip
      \begin{minipage} { \dim_eval:n { .5\linewidth - 3\ccwd } }
        学位论文作者签名：
        \__wu_signature_inline:n { \clist_item:nn {#1} { 1 } }
      \end{minipage} \hfill
      \begin{minipage} { \dim_eval:n { .5\linewidth - 3\ccwd } }
        签字日期：
        \exp_args:Ne \tl_map_inline:nn { \clist_item:nn {#1} { 2 } } { ##1 }
      \end{minipage}
      \hspace*{2\ccwd}
      \par \vspace{3.25\baselineskip}
      \begin{center}
        \__wu_fontsize:nn { cn } { 3 } \sffamily
        \l__wu_commitment_b_title_tl
      \end{center}
      \par \vspace{.5\baselineskip}
      \l__wu_commitment_b_body_tl
      \par \vspace{2\baselineskip} \smallskip
      \begin{minipage} { \dim_eval:n { .5\linewidth - 3\ccwd } }
        学位论文作者签名：
        \__wu_signature_inline:n { \clist_item:nn {#1} { 3 } }
        \par \vspace{\baselineskip}
        签字日期：
        \exp_args:Ne \tl_map_inline:nn { \clist_item:nn {#1} { 4 } } { ##1 }
      \end{minipage}\hfill
      \begin{minipage} { \dim_eval:n { .5\linewidth - 3\ccwd }}
        导师签名：
        \__wu_signature_inline:n { \clist_item:nn {#1} { 5 } }
        \par \vspace{\baselineskip}
        签字日期：
        \exp_args:Ne \tl_map_inline:nn { \clist_item:nn {#1} { 6 } } { ##1 }
      \end{minipage}
      \hspace*{2\ccwd}
    \end{titlepage}
  }
\ctex_set:nn { chapter }
  {
    format+    = \__wu_fontsize:nn { cn } { 3 } \sffamily \mdseries,
    number     = \arabic{chapter},
    beforeskip = 40pt,     afterskip = 30pt,
    aftername  = \enspace, fixskip,
    tocline    = \CTEXnumberline{#1}#2
  }
\ctex_set:nn { section }
  {
    format+    = \__wu_fontsize:nn { cn } { 4 } \sffamily \mdseries \raggedright,
    beforeskip = 18pt,     afterskip = 15pt,
    aftername  = \enspace, fixskip
  }
\ctex_set:nn { subsection }
  {
    format+    = \__wu_fontsize:nn { en } { 13 } \sffamily \mdseries \raggedright,
    beforeskip = 15.5pt,   afterskip = 13.5pt,
    aftername  = \quad,    fixskip
  }
\ctex_set:nn { subsubsection }
  {
    format+    = \__wu_fontsize:nn { cn } { -4 } \sffamily \mdseries \raggedright,
    beforeskip = 13pt,     afterskip = 12pt,
    aftername  = \quad,    fixskip
  }
\ctex_heading_depth:nn         { secnumdepth          } { 3 }
\tl_set:Nn  \contentsname      { 目\quad 录                 }
\tl_set:Nn  \cftdotsep         { .5                         }
\tl_set:Nn  \@pnumwidth        { 2ex                        }
\tl_set:Nn  \cftchapfont       { \sffamily                  }
\tl_set:Nn  \cftchappagefont   { \mdseries                  }
\tl_set:Nn  \cftchapleader     { \cftdotfill { \cftdotsep } }
\dim_set:Nn \cftbeforechapskip { \c_zero_dim                }
\dim_set:Nn \cftbeforesecskip  { \c_zero_dim                }
\dim_set:Nn \cftsecindent      { \ccwd                      }
\dim_set:Nn \cftsubsecindent   { 2\ccwd                     }
\dim_set:Nn \cftsecnumwidth    { \ccwd                      }
\dim_set:Nn \cftsubsecnumwidth { 2\ccwd                     }
\file_input_stop:
%% -----------------------------------------------------------------------
%%   This work consists of the files westlakethesis.dtx,                 *
%%                                   westlakethesis.ins,                 *
%%                 the derived files westlakethesis.cls,                 *
%%                                   wu-depend.code.tex,                 *
%%                                   wu-kernel.code.tex,                 *
%%                                   wu-params.code.tex,                 *
%%                                   wu-thesis.code.tex,                 *
%%                                   wu-beamer.code.tex,                 *
%%                                   wu-poster.code.tex,                 *
%%                                   wu-usrdoc.code.tex,                 *
%%                                   westlake-logo.pdf,                  *
%%                                   westlake-badge-en.pdf,              *
%%                                   westlake-badge-cn.pdf,              *
%%                                   westlake-paint-a.png,               *
%%                                   westlake-paint-b.png,               *
%%           the documentation files westlakethesis.pdf,                 *
%%                               and README.md.                          *
%% -----------------------------------------------------------------------
%%
%% End of file `wu-thesis.code.tex'.
