%%
%% This is file `hdu-layout.code.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hduthesis.dtx  (with options: `layout')
%% -----------------------------------------------------------------------
%%   Copyright (C) 2023-2025 by Mingyu Xia <myhsia@outlook.com>          *
%%                                                                       *
%%   It 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 the file                                      *
%%                                                                       *
%%       http://www.latex-project.org/lppl.txt                           *
%%                                                                       *
%%   This work has the LPPL maintenance status `maintained'.             *
%%                                                                       *
%%   The Current Maintainer of this work is Mingyu Xia.                  *
%% -----------------------------------------------------------------------
\__hdu_provide_module:n {layout}
\RequirePackage { geometry, array, setspace,
                  fancyhdr, enumitem, cleveref }
\RequirePackage
  [ skip = 1.75ex, labelsep = quad, font = small ]{caption}
\fancyhf{}
\pagestyle{fancy}
\renewcommand*\headrulewidth {.8pt}
\renewcommand*\thefigure {\arabic{chapter}-\arabic{figure}}
\renewcommand*\thetable {\arabic{chapter}-\arabic{table}}
\renewcommand*\theequation {\arabic{chapter}-\arabic{equation}}
\AddToHook{env/figure/after}{\vspace*{-2.3ex}}
\AddToHook{env/table/after}{\vskip-1.9ex}
\setlist[enumerate,1]
  {
    label = (\,\arabic*\,), itemindent = 4em, leftmargin = 0em,
    labelsep = 1ex, topsep = 0pt, itemsep = 0pt, partopsep = 0pt,
    parsep = 0em, listparindent = 2\ccwd
  }
\crefformat{figure}{图#2#1#3}
\crefformat{table}{表#2#1#3}
\cs_new_protected:Npn \__hdu_cover_spread_box:nn #1#2
  {
    \mode_leave_vertical:
    \hbox_to_wd:nn {#1}
      { \exp_args:Nee \tl_map_inline:nn {#2} { ##1 \hfil } \unskip }
  }
\cs_new_protected:Npn \__hdu_cover_center_box:nn #1#2
  {
    \mode_leave_vertical:
    \dim_set:Nn \l_tmpa_dim {#1}
    \global\setbox1 = \box\voidb@x
    \group_begin:
    \setbox0 = \vbox
      {
        \dim_set:Nn \hsize {#1}\relax
        \dim_set:Nn \parindent {0pt}
        \skip_set:Nn \leftskip {0pt plus 1fil}
        \skip_set:Nn \rightskip {0pt plus -1fil}
        \skip_set:Nn \parfillskip {0pt plus 2fil}
        #2 \par
        \loop
        \setbox2 = \lastbox
        \unless\ifvoid2
          \global\setbox1 = \vtop
            { \hbox to\hsize{\strut\unhbox2}
              \vskip-4pt \hrule height .5pt
              \vskip9.6pt \unvbox1
            }
          \unskip\unpenalty
        \repeat
      }
    \group_end:
    \box1
  }
\cs_new_protected_nopar:Npn \__hdu_process_array:NnnN #1#2#3#4
  {
    \seq_set_split:Nee \l__hdu_process_array_seq { / } {#1}
    \seq_set_split:Nee \l__hdu_process_array_row_seq { \c_colon_str }
      { \seq_item:Nn \l__hdu_process_array_seq {#2} }
    \tl_if_eq:nnTF {#3} {:}
      {
        \tl_gset:Ne #4
          { \seq_use:Nn \l__hdu_process_array_row_seq {} }
      }
      {
        \tl_gset:Ne #4
          { \seq_item:Nn \l__hdu_process_array_row_seq {#3} }
      }
    \seq_clear:N \l__hdu_process_array_seq
    \seq_clear:N \l__hdu_process_array_row_seq
  }
\clist_set:Nn \g__hdu_month_clist
  {
    January, February,  March,     April,   May,      June,
    July,    August,    September, October, November, December
  }
\keys_define:nn { thesis / hduset }
  {
    title      .clist_set:N = \l__hdu_set_title_tl,
    department .tl_set:N    = \l__hdu_set_department_tl,
    major      .tl_set:N    = \l__hdu_set_major_tl,
    class      .tl_set:N    = \l__hdu_set_class_tl,
    stdntid    .tl_set:N    = \l__hdu_set_stdntid_tl,
    author     .clist_set:N = \l__hdu_set_author_tl,
    supervisor .tl_set:N    = \l__hdu_set_supervisor_tl,
    bibsource  .tl_set:N    = \l__hdu_set_bibsource_tl,
  }
\NewDocumentCommand \hduset { m }
  {
    \keys_set:nn { thesis / hduset } {#1}
    \__hdu_docinfo_process_aux:
    \__hdu_docinfo_degree_if_aux:
  }
\cs_set_protected_nopar:Nn \__hdu_docinfo_process_aux:
  {
    \__hdu_process_array:NnnN \l__hdu_set_title_tl {1} {:} \@title
    \__hdu_process_array:NnnN \l__hdu_set_title_tl {2} {:}
      \l__hdu_set_entitle_tl
    \__hdu_process_array:NnnN \l__hdu_set_author_tl {1} {:} \@author
    \__hdu_process_array:NnnN \l__hdu_set_author_tl {2} {:}
      \l__hdu_set_enauthor_tl
    \__hdu_process_array:NnnN \l__hdu_set_supervisor_tl {1} {1}
      \l__hdu_set_cnrole_tl
    \__hdu_process_array:NnnN \l__hdu_set_supervisor_tl {1} {2}
      \l__hdu_set_cnsupervisor_tl
    \__hdu_process_array:NnnN \l__hdu_set_supervisor_tl {2} {1}
      \l__hdu_set_enrole_tl
    \__hdu_process_array:NnnN \l__hdu_set_supervisor_tl {2} {2}
      \l__hdu_set_ensupervisor_tl
    \bool_if:NF \g__hdu_agreement_bool
      { \tl_clear:N \l__hdu_set_bibsource_tl }
    \tl_if_empty:NTF \l__hdu_set_bibsource_tl
      {
        \newcommand*\printbibliography{\chapter*{参考文献}}
        \newcounter {citecount}
        \renewcommand*\cite[1]
          {
            \refstepcounter{citecount}
            \textsuperscript{[\thecitecount]}
          }
      }
      {
        \RequirePackage[sort&compress]{gbt7714}
        \bibliographystyle{gbt7714-numerical}
        \dim_set:Nn \bibsep {.35ex}
        \newcommand*\printbibliography
          {
            \bibliography { \l__hdu_set_bibsource_tl }
            \addcontentsline{toc}{chapter}{参考文献}
          }
      }
  }
\cs_new_protected:Npn \__hdu_commitment_sign:N #1
  {
    \leavevmode@ifvmode
    \lower \dimexpr \f@size\p@ * 9/16
    \hbox
      {
        \includegraphics
          [ height = { \fp_eval:n { 2*\f@size }\p@ } ] {#1}
      }
  }
\cs_new_protected_nopar:Npn \__hdu_sign_process_aux:nnn #1#2#3
  {
    \clist_set:Nn \l__hdu_sign_process_clist {#1}
    \seq_set_split:Nne \l__hdu_sign_figure_seq {/}
      { \clist_item:Nn \l__hdu_sign_process_clist {#2} }
    \int_compare:nNnTF {#3} = {0}
      {
        \tl_set:Ne \l__hdu_sign_figure_tl
          { \seq_item:Nn \l__hdu_sign_figure_seq { #3 + 1 } }
        \seq_clear:N \l__hdu_sign_figure_seq
      }
      {
        \seq_set_split:Nne \l__hdu_sign_date_seq {-}
          { \seq_item:Nn \l__hdu_sign_figure_seq {2} }
        \seq_item:Nn \l__hdu_sign_date_seq {#3}
        \seq_clear:N \l__hdu_sign_date_seq
      }
    \clist_clear:N \l__hdu_sign_process_clist
  }
%% -----------------------------------------------------------------------
%%   This work consists of the files hduthesis.dtx,                      *
%%                                   hdu-graphics.dtx,                   *
%%                               and hduthesis.ins,                      *
%%             and the derived files hduthesis.cls,                      *
%%                                   hdu-<module>.code.tex,              *
%%                                   beamerthemehdu.sty,                 *
%%                                   hdulogo.pdf,                        *
%%                                   hdutitle.pdf,                       *
%%                                   hdubadge.pdf,                       *
%%                                   hdumotto.pdf,                       *
%%                                   hduthesis.pdf,                      *
%%                               and README.md.                          *
%% -----------------------------------------------------------------------
%%
%% End of file `hdu-layout.code.tex'.
