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

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

调用 \pkg{circuitikz}, \pkg{pgfplots}, \pkg{listings}, \pkg{hologo}, \pkg{lipsum}, \pkg{zhlipsum}, \pkg{booktabs}, \pkg{multicol} 宏包
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \RequirePackage { circuitikz, pgfplots, listings, hologo,
                    lipsum, zhlipsum, booktabs, multicol }
\end{minted}

设置 \pkg{pgfplots} 宏包的兼容性为最新版本，设置 \pkg{hologo} 宏包的全局字体为无衬线字体
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \pgfplotsset { compat = newest }
  \hologoFontSetup { general = \sffamily }
\end{minted}

设置图片文件夹的常用相对路径
\begin{minted} [ linenos, firstnumber = last, bgcolor = bg, breaklines ] {tex}
  \graphicspath
    {
      {./figure/}{./figures/}{./image/}{./images/}
      {./graphics/}{./graphic/}{./pictures/}{./picture/}
    }
\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, 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}