%!TEX program = xelatex
\documentclass[12pt,a4paper,openany]{ctexbook}

% ==================== 页面设置 ====================
\usepackage[top=2.5cm,bottom=2.5cm,left=3cm,right=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing

% ==================== 字体（河南理工规范） ====================
\setCJKmainfont{STSong}[AutoFakeBold=2]
\setCJKsansfont{Noto Sans SC}
\setCJKmonofont{FangSong}
\setmainfont{Times New Roman}

% ==================== 页眉页脚 ====================
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CO]{\zihao{-5}\songti 银发群体高温多时间尺度预警和服务优化可视化研究}
\fancyhead[CE]{\zihao{-5}\songti 河南理工大学本科毕业设计（论文）}
\fancyfoot[C]{\zihao{-5}\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[C]{\zihao{-5}\thepage}
  \renewcommand{\headrulewidth}{0pt}
}
\fancypagestyle{abstract}{
  \fancyhf{}
  \fancyhead[C]{\zihao{-5}\songti 摘要}
  \fancyfoot[C]{\zihao{-5}\thepage}
  \renewcommand{\headrulewidth}{0.4pt}
}
\fancypagestyle{abstract-en}{
  \fancyhf{}
  \fancyhead[C]{\zihao{-5}\songti ABSTRACT}
  \fancyfoot[C]{\zihao{-5}\thepage}
  \renewcommand{\headrulewidth}{0.4pt}
}

% ==================== 图表 ====================
\usepackage{graphicx}
\usepackage{float}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{caption}
\captionsetup[table]{font={bf,small}, labelsep=quad, position=above, skip=2pt}
\captionsetup[figure]{font=small, labelsep=quad, position=below, skip=2pt}

% ==================== 超链接 ====================
\usepackage[hidelinks]{hyperref}

% ==================== 数学 ====================
\usepackage{amsmath,amssymb}
\numberwithin{equation}{chapter}

% ==================== 代码 ====================
\usepackage{listings}
\lstset{
    basicstyle=\small\ttfamily,
    breaklines=true,
    frame=single,
    numbers=left,
    numberstyle=\tiny,
}

% ==================== 其他 ====================
\usepackage{tikz}

% ==================== 标题格式 ====================
\ctexset{
    chapter={
        format={\centering\zihao{-2}\heiti\bfseries},
        name={第,章}, number=\arabic{chapter},
        beforeskip=20pt, afterskip=20pt,
    },
    section={
        format={\zihao{4}\heiti\bfseries},
        beforeskip=12pt, afterskip=6pt,
    },
    subsection={
        format={\zihao{-4}\heiti\bfseries},
        beforeskip=8pt, afterskip=4pt,
    },
    subsubsection={
        format={\zihao{-4}\heiti},
        beforeskip=6pt, afterskip=4pt,
    },
}

\title{银发群体高温多时间尺度预警和服务优化可视化研究}
\author{刘航宇}
\date{\today}

\begin{document}

% ==================== 封面 ====================
\begin{titlepage}
\thispagestyle{empty}
\begin{center}
    \vspace*{2cm}
    {\zihao{1}\heiti\bfseries 本科毕业设计（论文）}\\[1.5cm]
    {\zihao{2}\heiti\bfseries 银发群体高温多时间尺度预警\\[0.2cm]和服务优化可视化研究}\\[3cm]
    {\zihao{4}\fangsong
    \begin{tabular}{rl}
        \textbf{学\hspace{2em}院：} & 计算机科学与技术学院 \\[0.3cm]
        \textbf{专\hspace{2em}业：} & 计算机科学与技术 \\[0.3cm]
        \textbf{姓\hspace{2em}名：} & 刘航宇 \\[0.3cm]
        \textbf{学\hspace{2em}号：} & 312409090120\\[0.3cm]
        \textbf{指导教师：} & 郑艳梅\\[1.5cm]
    \end{tabular}
    }
    \vfill
    {\zihao{4}\fangsong \today}
\end{center}
\end{titlepage}

% ==================== 摘要 ====================
\input{chapters/abstract}

% ==================== 目录 ====================
\pagestyle{fancy}
{\zihao{5}\tableofcontents}
\newpage

% ==================== 正文 ====================
\input{chapters/ch1-intro}
\input{chapters/ch2-theory}
\input{chapters/ch3-data}
\input{chapters/ch4-model}
\input{chapters/ch5-system}
\input{chapters/ch6-results}
\input{chapters/ch7-conclusion}

% ==================== 参考文献 ====================
\input{chapters/references}

% ==================== 致谢 ====================
\input{chapters/acknowledgments}

% ==================== 附录 ====================
\appendix
\ctexset{
    chapter={
        format={\centering\zihao{-2}\heiti\bfseries},
        name={附录}, number=\Alph{chapter},
    },
}
\input{chapters/appendix-a-code}
\input{chapters/appendix-b-run}
\input{chapters/appendix-c-config}

\end{document}
