\subsection{\file{hduthesis-typeset-module.code} 的实现}

提供模块 \file{typeset} 文件
\begin{minted} [ linenos, bgcolor = bg, breaklines ] {tex}
  \hduthesis_provide_module:n {typeset}
\end{minted}

设置行间距
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \linespread{1.39}
\end{minted}

设置首行缩进
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \dim_set:Nn \parindent { 2\ccwd }
\end{minted}

新定义字体大小 \cs{semilarge} 和 \cs{semiLarge}
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \newcommand \semilarge { \@setfontsize \semilarge{14}{16.5} }
  \newcommand \semiLarge { \@setfontsize \semiLarge{16.5}{17.5} }
\end{minted}

设置英文字体
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \RequirePackage{fontspec}
  \setmainfont{texgyretermes}
    [
      Extension  = .otf,     UprightFont    = *-regular,   BoldFont = *-bold,
      ItalicFont = *-italic, BoldItalicFont = *-bolditalic
    ]
  \setsansfont{texgyreheros}
    [
      Extension   = .otf,      BoldItalicFont = *-bolditalic,
      UprightFont = *-regular, BoldFont       = *-bold,
      ItalicFont  = *-italic,  Scale          = .9,
    ]
\end{minted}

调用 \pkg{amssymb}, \pkg{mathtools}, \pkg{cancel}, \pkg{fixdif}, \pkg{derivative} 宏包
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \RequirePackage { amssymb, mathtools, cancel, fixdif, derivative }
\end{minted}

如果存在 \pkg{physics2} 宏包，则调用并配置 \pkg{physics2} 宏包
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \file_if_exist:nTF { physics2.sty }
    {
      \RequirePackage{physics2}
      \usephysicsmodule{ ab, braket, ab.legacy, op.legacy, bm-um.legacy }
    } { \RequirePackage{bm} }
\end{minted}

调用 \pkg{unicode-math} 宏包，并关闭警告 \texttt{mathtools-colon} 和 \texttt{mathtools-overbracket}
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \RequirePackage
    [ warnings-off = { mathtools-colon, mathtools-overbracket } ] {unicode-math}
\end{minted}

设置数学环境的间距
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \AtBeginDocument
    {
      \dim_set:Nn \abovedisplayskip {3pt}
      \dim_set:Nn \belowdisplayskip {3pt}
    }
\end{minted}

设置数学字体
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \tl_if_empty:NF \g__hduthesis_math_font
    { \setmathfont { \g__hduthesis_math_font } }
\end{minted}

设置中文字体，保留全局选项键值中的扩号以对应 \pkg{xeCJK} 宏包的接口.
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \tl_if_empty:NF \g__hduthesis_main_CJK_font
    { \exp_last_unbraced:No \setCJKmainfont \g__hduthesis_main_CJK_font }
  \tl_if_empty:NF \g__hduthesis_sans_CJK_font
    { \exp_last_unbraced:No \setCJKsansfont \g__hduthesis_sans_CJK_font }
  \tl_if_empty:NF \g__hduthesis_mono_CJK_font
    { \exp_last_unbraced:No \setCJKmonofont \g__hduthesis_mono_CJK_font }
\end{minted}

结束 \file{hduthesis-typeset-module.code} 文件
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \endinput
\end{minted}
