232 lines
7.1 KiB
TeX
232 lines
7.1 KiB
TeX
\usepackage{graphicx} %绘图
|
||
\usepackage{pifont} %圆圈1,如①
|
||
\usepackage{booktabs} %绘制三线表
|
||
\usepackage{multirow} %使用https://www.tablesgenerator.com/网站绘制表格所需包
|
||
\usepackage{threeparttable} %表格脚注
|
||
\usepackage[noend]{algpseudocode} %绘制伪代码
|
||
\usepackage{algorithmicx,algorithm}
|
||
\usepackage{pythonhighlight} %python代码高亮
|
||
\usepackage[colorlinks=true,linkcolor=black,anchorcolor=black,citecolor=green]{hyperref}%引用参考文献、章节、图表,并跳转
|
||
\usepackage{caption}
|
||
\captionsetup[figure]{font=small,labelsep=space}
|
||
\captionsetup[table]{font=small,labelsep=space} %图片和表格修改caption
|
||
\usepackage{enumitem} % 列表行间距
|
||
|
||
|
||
\usepackage[final]{pdfpages}
|
||
% 设置页边距
|
||
\usepackage{geometry}
|
||
\usepackage{makecell}
|
||
\usepackage{caption}
|
||
\usepackage{multirow}
|
||
\usepackage{booktabs}
|
||
\makeatletter
|
||
\let\c@lofdepth\relax
|
||
\let\c@lotdepth\relax
|
||
\makeatother
|
||
\usepackage{subfigure}
|
||
\usepackage{float}
|
||
\usepackage[titles,subfigure]{tocloft}
|
||
\usepackage{soul}
|
||
\usepackage{color,xcolor}
|
||
|
||
|
||
|
||
\geometry{a4paper,top=3cm,bottom=2.5cm,left=2.5cm,right=2.5cm}
|
||
|
||
% 设置行间距 1.5倍
|
||
\linespread{1.5}\selectfont
|
||
% 设置列表间距
|
||
\setlist{itemsep=-0.3\baselineskip}
|
||
% 设置段与段之间的垂直距离 \parskip默认橡皮长度是0pt plus 1pt
|
||
\setlength{\parskip}{0pt}
|
||
\setlength{\headheight}{15pt} %设置页眉高度
|
||
% \setlength{\parindent}{0pt}
|
||
|
||
%设置字体
|
||
% 设置英文字体
|
||
\setmainfont{Times New Roman}[
|
||
BoldFont = Times New Roman Bold,
|
||
ItalicFont = Times New Roman Italic,
|
||
BoldItalicFont = Times New Roman Bold Italic
|
||
]
|
||
|
||
\setsansfont{Times New Roman}[
|
||
BoldFont = Times New Roman Bold,
|
||
ItalicFont = Times New Roman Italic,
|
||
BoldItalicFont = Times New Roman Bold Italic
|
||
]
|
||
|
||
\setmonofont{Times New Roman}[
|
||
BoldFont = Times New Roman Bold,
|
||
ItalicFont = Times New Roman Italic,
|
||
BoldItalicFont = Times New Roman Bold Italic
|
||
]
|
||
|
||
\usepackage{xeCJK}
|
||
\setCJKmainfont[AutoFakeBold=true,AutoFakeSlant=true]{SimSun} % 使用宋体作为主要中文字体
|
||
\setCJKsansfont[AutoFakeBold=true,AutoFakeSlant=true]{Noto Sans CJK SC} % 无衬线字体
|
||
\setCJKmonofont[AutoFakeBold=true,AutoFakeSlant=true]{WenQuanYi Micro Hei Mono} % 等宽字体
|
||
|
||
%设置字号
|
||
% \usepackage{ctexsize,type1cm}
|
||
\usepackage{type1cm}
|
||
\newcommand{\yihao}{\fontsize{26pt}{39pt}\selectfont}
|
||
\newcommand{\xiaoyi}{\fontsize{24pt}{36pt}\selectfont}
|
||
\newcommand{\erhao}{\fontsize{22pt}{33pt}\selectfont}
|
||
\newcommand{\xiaoer}{\fontsize{18pt}{27pt}\selectfont}
|
||
\newcommand{\sanhao}{\fontsize{16pt}{24pt}\selectfont}
|
||
\newcommand{\xiaosan}{\fontsize{15pt}{22.5pt}\selectfont}
|
||
\newcommand{\sihao}{\fontsize{14pt}{21pt}\selectfont}
|
||
\newcommand{\xiaosi}{\fontsize{12pt}{18pt}\selectfont}
|
||
\newcommand{\wuhao}{\fontsize{10.5pt}{15.75pt}\selectfont}
|
||
\newcommand{\xiaowu}{\fontsize{9pt}{13.5pt}\selectfont}
|
||
\newcommand{\liuhao}{\fontsize{7.5pt}{11.25pt}\selectfont}
|
||
|
||
%使用公式,表格,图片
|
||
\usepackage{mathtools,amsmath,amssymb,graphicx,array,float}
|
||
|
||
% 设置页眉面脚
|
||
%% 设置章节前的页码格式
|
||
\usepackage{fancyhdr}
|
||
\fancypagestyle{content}{
|
||
\fancyhf{}
|
||
\renewcommand{\headrulewidth}{0pt}
|
||
\fancyfoot[C]{\songti\xiaowu \Roman{page}}
|
||
}
|
||
|
||
%重新设置headings
|
||
\fancypagestyle{headings}{
|
||
\fancyhf{}
|
||
\fancyfoot[C]{\songti\xiaowu \Roman{page} }
|
||
\renewcommand{\headrulewidth}{0.5pt}
|
||
\fancyhead[CO]{\songti\xiaowu 目录 }
|
||
\fancyhead[CE]{\songti\xiaowu 重庆邮电大学本科毕业设计(论文)}
|
||
}
|
||
|
||
%重新设置plain
|
||
%正文页眉设置
|
||
\fancypagestyle{plain}{
|
||
\fancyhf{}
|
||
\fancyfoot[C]{\songti\xiaowu \thepage }
|
||
\fancyhead[CO]{\songti\xiaowu \leftmark }
|
||
\fancyhead[CE]{\songti\xiaowu 重庆邮电大学本科毕业设计(论文)}
|
||
}
|
||
|
||
%设置双线页脚
|
||
\makeatletter
|
||
\def\footrule{
|
||
{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi%
|
||
\hrule\@height 0pt \@width\headwidth %上面0.5pt粗
|
||
\vskip 1pt
|
||
\hrule\@height 0pt \@width\headwidth %下面线为1pt粗
|
||
\vskip-2\headrulewidth\vskip-1.2pt} %两条线的距离1pt
|
||
\vspace{8mm}} %双线与下面正文之间的垂直间距
|
||
\makeatother
|
||
|
||
%设置文章格式
|
||
\ctexset {
|
||
autoindent = true,
|
||
punct = quanjiao,
|
||
contentsname={目录},
|
||
listfigurename={插图},
|
||
listtablename={表格},
|
||
figurename={图},
|
||
tablename={表},
|
||
bibname={参考文献},
|
||
appendixname={附录},
|
||
chapter={
|
||
beforeskip={0pt},
|
||
nameformat={\heiti\sanhao\centering},
|
||
number={\arabic{chapter}},
|
||
titleformat={\heiti\sanhao\centering},
|
||
},
|
||
section={
|
||
format={\heiti\sihao},
|
||
},
|
||
subsection={
|
||
format={\heiti\xiaosi},
|
||
},
|
||
subsubsection={
|
||
format={\heiti\xiaosi},
|
||
}
|
||
}
|
||
|
||
% 目录中的章加点
|
||
\usepackage[titles]{tocloft}
|
||
\renewcommand{\cftdot}{$\cdot$}
|
||
\renewcommand{\cftdotsep}{1.5}
|
||
\setlength{\cftbeforechapskip}{10pt}
|
||
|
||
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
|
||
\renewcommand{\cftchapdotsep}{\cftdotsep}
|
||
\makeatletter
|
||
\renewcommand{\numberline}[1]{%
|
||
\settowidth\@tempdimb{#1\hspace{0.5em}}%
|
||
\ifdim\@tempdima<\@tempdimb%
|
||
\@tempdima=\@tempdimb%
|
||
\fi%
|
||
\hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
|
||
\makeatother
|
||
|
||
% 设置目录字体尺寸
|
||
\renewcommand{\cftchapfont}{\songti\xiaosi}
|
||
\renewcommand{\cftsecfont}{\songti\wuhao}
|
||
\renewcommand{\cftsubsecfont}{\songti\wuhao}
|
||
|
||
%使用代码排版包
|
||
\usepackage{listings}
|
||
\usepackage{color}
|
||
\lstset{%
|
||
frame=shadowbox,
|
||
extendedchars=false, % 不使用xelatex而使用CJK方式处理汉字
|
||
language=python,
|
||
basicstyle=\sffamily, % 设置整体格式
|
||
keywordstyle=\bfseries, % 关键字格式
|
||
commentstyle=\rmfamily\itshape, % 注释格式
|
||
stringstyle=\ttfamily, % 字符串格式
|
||
columns=flexible,
|
||
escapechar=', % 注释中显示汉字,eg //'一个整数'
|
||
tabsize=4,
|
||
numbers=left,
|
||
numberstyle=\small, % 行号字体设置
|
||
stepnumber=1, % 行号距离设置,1代表每行加行号
|
||
numbersep=8pt, % 行号和代码距离设置
|
||
backgroundcolor=\color{white},
|
||
showspaces=false, % show spaces adding particular underscores
|
||
showstringspaces=false, % 使用下划线连接字符串
|
||
showtabs=false,
|
||
frame=single, % 给代码加边框
|
||
captionpos=b, % sets the caption-position to bottom
|
||
breaklines=true, % 自动换行设置
|
||
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
|
||
escapeinside={\%*}{*)}, % if you want to add a comment within your code
|
||
xleftmargin=2em, % 设置左边距,宽度默认是与页芯等宽的
|
||
xrightmargin=2em, % 设置右边距,宽度默认是与页芯等宽的
|
||
aboveskip=1em % 设置上边距
|
||
}
|
||
|
||
%设置自定义变量
|
||
\newcommand\degree{^\cire}
|
||
|
||
% 定义文献引用格式,\cite正常引用 \supercite右上角引用
|
||
\usepackage{cite}
|
||
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}
|
||
\newcommand\supercite[2][]{%
|
||
\textsuperscript{\cite[#1]{#2}}
|
||
}
|
||
|
||
\usepackage{enumitem}
|
||
\setlist[description]{
|
||
itemsep=-5pt,
|
||
font=\songti,
|
||
}
|
||
|
||
% 定义中文封面环境
|
||
\newenvironment{titletabbing}
|
||
{\par\bfseries\songti\sihao\tabbing}
|
||
{\endtabbing\par}
|
||
|
||
\usepackage[nottoc]{tocbibind}
|
||
\endinput
|