2021-10-26

%
% Copyright 2016-2019 Wen Wang wwzvd@mst.edu
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained’.
%
% The Current Maintainer of this work is Wen Wang wwzvd@mst.edu.
%
% This work consists of the files thesis-uestc.cls, thesis-uestc.bst.
%
% Version revision instructions Hui Wang cswh147@sina.com Revision 1.0 2022/1/8
% 主要是给原来的模板加上注释

%Latex命令
%LaTeX命令都是以反斜杠符号\开头,其构成形式分为以下两种:
%1、反斜杠\后紧跟由若干个英文字母组成的命令,命令区分大小写,命令以空格、数字或非字母符号作为结束标志。例如: \newline、 \Large等。
%2、反斜杠\后紧跟一个非字母符号组成的命令。例如: !、 ^等。

%命令中的参数
%命令可以含有若干个参数。参数是影响命令作用的数据,例如高度、对齐方式或文本等。参数的内容或选项是由作者设置或选定的。参数可分为以下两种类型:
%l、必要参数,命令必须要求附带的参数,不能省略。必要参数被置于命令名后的一对花括号中,即{参数}。一条命令中可以有多个必要参数。
%2、可选参数,命令可以选择附带的参数,可以省略。可选参数被置于命令名后的一对方括号中,即[参数]。一条命令中可以有多个可选参数,每个可选参数可以是由多个
%可选子参数组成,可选子参数之间须用半角逗号分隔(英文下逗号),例如: [参数1,参数2,…]。每个可选参数或可选子参数还可以有多个选项, 例如对齐方式参数有l、c、r,即左、中、右三个选项,
%作者可根据需要选取其中之一。如果省略可选参数,就意味着使用系统对该可选参数预先设定的值,即默认值。

%\LaTeX定义了大量的具有各种排版功能的命令,根据这些命令的使用情况,可以将它们分为两大类,即用户命令和内部命令。
%1、用户命令,LaTeX提供给用户使用的命令。用户命令根据用途可分为以下两种。a、文稿命令,供作者在论文写作时使用的命令, 例如节标题命令\section、字体尺寸命令\small等。
%b、宏包命令,用于编写宏包或文类的命令,例如\RequirePackage等。
%用户命令按照其功能又可分为以下三种。
%1、常规命令,可以在源文件中单独使用的、具有某种排版功能的命令,例如字体尺寸命令\small等。
%2、数据命令,代表某一数值, 例如: 表示缩进宽度的长度数据命令\parindent,表示节序号值的计数器数据命令\value{section}等。数据命令不能单独使用,它们只能被作为参数应用于常规命令之中。
%3、环境命令,是由两个以上的命令组成的命令组,具有某一专项排版功能,例如表格环境、公式环境和列表环境等。组成环境命令的各种命令不能各自单独使用。只能共同配合使用"
%用户命令按照其具体用途还可细分为字体命令、长度命令、引用命令、表格命令、数学命令和绘图命令等许多种。

%内部命令
%LaTeX内部使用的命令,其中很多是属于TeX的基础命令。内部命令也可以用在源文件中, 但不推荐使用; 内部命令中有一部分在命令名中含有@符号, 它们又被称为核心命令,都不能直接用于源文件中。在命令名中加入@符号的主要目的是为
%了避免与同名的用户命令或自定义命令冲突, 例如@date是内部命令, 而\date是用户命令; LaTeX不会把源文件中的@当成字母, 而是符号,
%所以在源文件中使用含有@符号的命令违反了LaTeX命令构成规则, 系统将提示出错, 而在LaTeX本身和文类或宏包中的@符号, LaTeX视其为字母。

%命令的作用范围
%在LaTeX命令中, 有些只能用在导言, 有些只能用于正文, 有些既可在导言也可在正文中使用。导言中的命令将对整个正文的内容产生作用。在正文中,
%有些命令只能在左右模式或段落模式或数学模式中使用,有些则可以跨模式使用。还可根据不同的作用范围, 把在正文中使用的命令分为以下四种形式:
%1、声明形式, 将作用于命令之后的所有相关内容, 例如粗体命令\bfseries, 可将其后所有文本和表格中的字体改为粗体。
%2、参数形式, 只作用于命令所带的参数, 例如倾斜体命令: \texts1{Asia}, 得到Asia, 该命令仅将其所带参数Asia这个单词改为倾斜体, 花括号以外的文本不受影响。
%3、组合形式, 就是把声明形式的命令和所需作用的内容置于一对花括号中, 这样可将声明形式的命令作用范围限制在花括号之内。例如: {\bfseriese Asia},只将Asia这个单词改为粗体
%4、环境形式, 在各种环境中使用的声明形式命令, 其作用范围只限于该环境之内。对于嵌套的环境, 在外层使用的声明形式命令,将对其中各层都有效; 而在内层使用的声明形式命令不会影响到外层。

%自定义命令
%LaTeX系统提供了一整套用于常规排版的用户命令, 各种用途的宏包也提供有很多针对各种专项排版需求的用户命令。因此, 只要能够正确地使用这些命令, 就可以顺利地完成常规格式的论文排版。
%但是论文的内容丰富多彩, 包罗万象,对排版的要求也是层出不穷, 再多的命令! 再强的功能也不可能面面俱到, 无所不能, 所以有时会感到命令不够用, 命令的效果不够理想。好在系统提供了一条新定义命令:
%\newcommand{新命令} [参数数量] [默认值]{定义内容}
%它允许作者自行定义一条新命令来解决所遇到的排版问题。该命令中的各种必要参数和可选参数说明如下:
%新命令 自定义新命令的名称,它必须符合命令的构成规则, 并且不能与系统和已调用宏包提供的命令重名, 也不能以\end开头, 否则都将提示出错。
%参数数量 可选参数, 用于指定该新命令所具有参数的个数, 它可以是0~9之中的一个整数,其默认值是0,即该命令没有参数。
%默认值 可选参数, 用于设定第一个参数的默认值; 如果在新定义命令中给出默认值, 则表示该新命令的第一个参数是可选参数,新命令中最多只能有一个可选参数, 并且必须是第一个参数。
%定义内容 对新命令所要执行的排版任务进行设定, 其中涉及某个参数时用符号#n表示, 例如涉及第一个参数时用#1代表, 第二个参数用#2,…。
%新定义命令\newcommand是个声明形式的命令, 通常放在导言里, 这样在全文中都可以使用其定义的新命令; 它也可以置于正文中, 而作用范围仅限于其后的内容, 或是所在环境或组合之内。
%在新定义命令的各种参数中不得含有抄录命令\verb和抄录环境\verbatim以及相关的命令和环境。

%自定义一条新命令
%\newcommand{\mycmd} {Hellow!}
%例子:In 1971, \mycmd I am wang hui.
%效果:In 1971, Hellow! I am wang hui.
%在本例中,将新命令\mycmd 定义为Hellow! 每当使用这条命令, 就会在当前位置排出Hellow!在论文中频繁使用的词汇或符号等都可以将其定义为命令, 以简化文本, 防止出错,提高输入速度。

%自定义一条带有一个参数的新命令。
%\newcommand{\mycmdB}[1]{ {\heiti #1} }
%例子:方程有: \mycmdB{恒等式}
%效果:方程有: 恒等式。
%可以用已有的命令来定义新命令。本例中,给新命令\mycmdB 设置了一个必要参数, 并定义该命令要对这个参数执行黑体字命令。

%自定义一条带有两个参数的新命令"
%\newcommand{\mycmdC} [2] {KaTeX parse error: Expected 'EOF', got '#' at position 1: #̲1_1, #1_2, \dot…}
%例子:我们常把数列写作: \mycmdC{x}{n}, 或者写作\mycmdC{a}{m}。
%效果:我们常把数列写作: x1,x2,…,xn, 或者写作 a1, a2,…,am。
%在本例源文件中,新命令\mycmdC设置两个参数来表示数列, 定义里的$是行间数学模式符号。

%自定义一个具有两个参数的新命令, 其中一个是可选参数
%\newcommand{\mycmdD} [2] [n] {KaTeX parse error: Expected 'EOF', got '#' at position 1: #̲2_1, #2_2, \dot…}
%例子:我们常把数列写作: \mycmdD{x},或者写作: \mycmdD[m]{a}
%效果:我们常把数列写作: xl,x2,…,xn,或者写作:a1,a2,…,am
%本例与例.2 4 的作用相同, 只是给出了第一个参数的默认值, 使之成为可选参数。

%带星号的新定义命令
%新定义命令还有一种带星号的形式,其不同之处在于使用它定义新命令时,命令中的各种参数不能含有换段命令\par或空行,即每个参数的内容不能超过一个段落, 否则在编译时系统将提示出错。
%例如:\newcommand{\A }{\bfseries #1 } \newcommand* { \B } { \bfseries #1 }
%\A{Cosmic Mystery \Par Harmony of the World }
%\B{Cosmic Mystery \Par Harmony of the world }
%同样定义内容的两条新命令, 因为命令B\的参数中含有\Par, 故将会提示出错。

%防止同名命令冲突
%有时无法预知某个命令是否存在于当前源文件中。当需要定义一个新命令,但又不希望因重名而引起冲突,造成编译中断, 可使用下面这条预防命令:
%\Providecommand{新命令} [参数数量][默认值] {定义内容}
%来自定义新命令, 其中各参数的用途与新定义命令\newcommand的相同; 所不同的是若新命令与当前源文件中某个已有命令重名,
%系统并不提示出错, 而是将定义内容保存起来, 如果当前源文件中不存在同名命令, 或提供同名命令的宏包被取消, 则该新命令随即生效。
%使用\Providecommand命令来自定义新命令, 可以防止与某个宏包中的同名命令发生冲突; 同一条命令, 当有宏包时以其定义为准, 若没有宏包则以\Providecommand的定义为准。
%例如在源文件中调入某个子源文件或文献数据库文件, 其中使用了\MF 命令来生成标志METRFONT,但该命令是由宏包mflogo提供的,如果在导言中没有调用这个宏包,系统将提示出错; 若在子源文件或数据库文件中用预防命令
%\Providecommand{ \MF } { \textsf{METAFONT} }
%事先将\MF 作为新命令进行定义, 这样, 如果未调用mflogo宏包, 也可以正确显示, 如果已经调用了mflogo宏包, 那就以该宏包对\MF 命令的定义为准, 而不会因命令重名提示出错,中断编译
%命令\Providecommand也有带星号的形式: \Providecommand*, 它的作用与带星号的新定义命令\newcommand*相同。

%修改已有命令
%LaTeX、所选文类和所调用宏包提供的所有用户命令和系统自身使用的内部命令以及已经自定义的新命令都属于已有命令。如果对某个已有命令的排版效果不满意, 希望加以修改,
%可采用Latex提供的重新定义命令:
%\renewcommand{已有命令} [参数数量] [默认值] {定义内容}对该已有命令进行重新定义。重新定义命令中的后三个参数的作用与新定义命令中的相同。重新定义命令只适用于对已有命令的修改, 而不能用于未定义的命令, 否则系统将提示出错。

%对己有命令建议不要轻易将其重新定义, 如确属需要,应先搞清楚已有命令的原定义, 然后再使用重新定义命令来修改。例如希望将目录标题名Contents改为Catalogo, 可先查看book文类对目录标题名命令\contentsname的定义为:
%\newcommand{\contentsname} {Contents}
%于是可在导言中使用重新定义命令对这个已有命令重新定义:
%\renewcommand{\contentsname} {Catalog}
%重新定义命令也有带星号的形式:\renewcommand*, 它的作用与带星号的新定义命令\newcommand*相同。

%核心命令的修改
%含有@符号的命令是系统内部的核心命令, 虽然它们不能在源文件中使用, 但可在源文件中对其定义进行修改; 不同于对其他己有用户命令的修改,在对核心命令进行重
%新定义时, 应将\renewcommand命令插在下面两条命令之间:
%\makeatletter
%
%\makeatother
%其中, 第一条命令通知LaTeX将@与其他英文字母一样看待, 第二条命令告诉LaTeX仍将@当作符号来处理。

%定义命令中的命令
%在新定义命令\newcommand和重新定义命令\renewcommand的定义内容中可以使用已有命令和自定义命令,还可以使用未经自定义的命令,以及定义命令, 即定义命令可以相互嵌套。
%定义的次序
%如果新命令\A的定义内容中有需要新定义的命令\B和重新定义的命令\C, 这两条命令可以是在此之前己被定义, 也可以是尚未定义或重新定义, 即:
%\newcommand{\B } {…} \newcommand{\A } {\B \C }
%\renewcommand{ \C } {…} \newcommand{\A }{ … }
%\newcommand{\A } {\B \C } \renewcommand{ \C } { … }
%这两种不同的定义次序, LaTeX都是认可的。\B和\C这两条命令只要在使用\A命令之前被定义和重新定义就可以了, 这是因为
%LaTeX在读取新定义命令时仅检查新命令是否重名, 并不过问定义内容; 在读取重新定义命令时也只关心已有命令是否曾经定义,
%并不在意定义内容; 只有当用到命令\A时,系统才去查找\B 和\C 这两条命令的定义内容。
%在定义命令中, 被定义命令的参数可作为定义内容中的命令参数, 如果\B是带有一个参数的命令,新定义命令:
%\newcommand{ \A } [2] {#1 \B{#2} }系统是认可的。在实际使用中,命令\A 会将它的第二个参数传递给命令\B。
%自定义一个具有两个参数的新命令,对其第二个参数使用倾斜体字体
%\newcommand{ \mycmdE } [2] {#1: \textsl {#2} }
%例子:\mycmdE {System} {GSM}
%效果:System: GSM
%如果被定义的命令中含有多个参数, 那么这种传递参数也可以有多个。

%数学命令的处理
%在新定义命令\newcommand或重新定义命令用到数学命令, 如数学符号命令等。
%自定义一条复合数学符号命令
%\newcommand{ \CC } {$ \Gamma_{i}$ }
%例子:Let \CC \ be the ν ( s ) \nu(s) ν(s) .
%在新命令\CC定义内容中含有数学符号命令\Gamma和下标符号_{i}, 它们只能在数学模式中使用, 故将全部定义内容都置于行内数学模式中。用上例方法定义的命令\CC只能用于文本模式, 不能用在数学模式中, 因为该命令
%遇到第一个 符 号 后 , 就 会 退 出 数 学 模 式 , 转 入 段 落 模 式 , 而 命 令 Γ 和 下 标 符 号 都 只 能 在 数 学 模 式 中 使 用 , 所 以 系 统 将 提 示 出 错 。 符号后, 就会退出数学模式,转入段落模式, 而命令\Gamma和下标符号都只能在数学模式中使用, 所以系统将提示出错。 %为了解决这个问题, LaTeX给出了一条确保数学模式命令: %\ensuremath {文本} %其特点是: 在数学模式中, 文本只是它自身; 在文本模式中, 它相当于 ,退,,Γ使,文本$。

%具体详细内容可以看《LaTeX2e完全学习手册》

\ProvidesClass{thesis-uestc} %此句告诉你自定义了一个名字是thesis-uestc的类,属于自己编写的具体特定格式的模板类。这个名字必须要和你保存的此文件的名字一致。当latex处理源文件时,首先需要知道的就是作者所要的文档类型。
\NeedsTeXFormat{LaTeX2e}[1995/12/01] %在文latex处理文类文件的开始必须设定该文件可运行于Tex系统的版本,并设定该文件的名称以及发布日期和版本序号内容。
\LoadClass[12pt, openany, twoside]{book}%自己定义的类是在book类基础上修改的,所以先加载一个book类,可以对不满足需求的部分进行修改。12pt=小四字体,openany:新一章从左页或右页都可开始。
%决定新的一章仅在奇数页开始还是在下一页开始。在文档类型为article时该选项不起作用,因为该类中没有定义“章”(chapter)。report类默认在下一页开始新一章,而book类的新一章总是在奇数页开始。twoside双页排版,奇数页页码在右边,偶数页页码在左边。
%latex公认的类如下所示:
%article 排版科学期刊、 演示文档、 短报告、 程序文档、 邀请函……
%proc 一个基于 article 的会议文集类
%minimal 非常小的文档类。 只设置了页面尺寸和基本字体。 主要用来查错。
%report 排版多章节长报告、 短篇书籍、 博士论文……
%book 排版书籍。
%slides 排版幻灯片。 该文档类使用大号 sans serif 字体。 也可以选用 FoilTEXa 来得到相同的效果。

%10pt, 11pt, 12pt 设置文档中所使用的字体的大小。 如果该项没有指定, 默认使用10pt 字体。
%a4paper, letterpaper, . . . 定义纸张的尺寸。 缺省设置为letterpaper。 此外, 还可以使用a5paper, b5paper, executivepaper 以及legalpaper。
%fleqn 设置行间公式为左对齐, 而不是居中对齐。
%leqno 设置行间公式的编号为左对齐, 而不是右对齐。
%titlepage, notitlepage 指定是否在文档标题(document title) 后另起一页。 article 文档类缺省设置为不开始新页, report 和book 类则相反。
%onecolumn, twocolumn latex 以单栏(one column) 或双栏(two column) 的方式来排版文档。
%twoside, oneside 指定文档为双面或单面打印格式。 article 和report 类为单面(single sided) 格式, book 类缺省为双面(double sided) 格式。 注意该选项只是作用于文档样式, 而不会通知打印机以双面格式打印文档。
%landscape 将文档的打印输出布局设置为 landscape 模式。
%openright, openany 决定新的一章仅在奇数页开始还是在下一页开始。 在文档类型为article 时该选项不起作用, 因为该类中没有定义“章” (chapter)。 report 类默认在下一页开始新一章而book 类的新一章总是在奇数页开始。

%XeLaTeX是新的Unicode版本,内建支持Unicode(UTF-8),自然也包括汉字在内,而且可以调用操作系统的truetype字体。如果你的文档有汉字,那么推
%荐用XeLaTeX。缺点是不支持某一些宏包。下面的宏包可以点击相应的宏包名,然后点击鼠标右键,打开相应的宏包文件。
%\def\命令#1#2…{定义},等价于\newcommand,只是不会检查是否有名称冲突,而且参数的指定也不同。比如说定义科学计数法\Exp
%\def\Exp#1#2{\ensuremath{#1\times10^{#2}}}或者
%\newcommand{\Exp}[2]{\ensuremath{#1\times10^{#2}}}当然\def能做的事情更多。

\RequirePackage{ifxetex}%需要ifxetex,在LaTeX类和包文件中使用另一个包文件:ifxetex
\RequireXeTeX %需要使用XeLatex编译tex文件,不然会报错。

\RequirePackage[usenames,dvipsnames,svgnames,table]{xcolor}
\RequirePackage{graphicx}
\RequirePackage[font={doublespacing, small}, labelsep=space, skip=6pt]{caption}

\RequirePackage{array}
\RequirePackage{setspace}
\RequirePackage{multirow}
\RequirePackage[tbtags]{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{lmodern}
\RequirePackage{mathptmx}
\RequirePackage{bm}
\RequirePackage{fontspec}

\RequirePackage{xeCJK}
\RequirePackage{ifplatform}

%由于使用的操作系统不同,所提供的字体有点区别,下面是根据操作系统选择相应的字体。
\ifwindows
\setmainfont{Times New Roman}%设置英文字体
\setCJKmainfont[AutoFakeBold=true]{SimSun}%设置xeCJK 中文主字体
\newCJKfontfamily{\heiti}{SimHei}
\else
\ifmacosx
\setmainfont{Times New Roman}
\setCJKmainfont[AutoFakeBold=true]{Songti SC}
\newCJKfontfamily{\heiti}{STHeiti}
\else
\setCJKmainfont[AutoFakeBold=true]{simsun.ttc}
\newCJKfontfamily{\heiti}{simhei.ttf}
\setmainfont[
BoldFont=timesbd.ttf,
ItalicFont=timesi.ttf,
BoldItalicFont=timesbi.ttf,
]{times.ttf}
\fi
\fi

\newcommand{\mb}[1]{\pmb{#1}} %\pmb 伪粗体,详情请看https://www.zhihu.com/question/25290041/answer/30422583。\mb字体加粗
\RequirePackage{zhnumber}
\RequirePackage{pifont}

\RequirePackage[hyphens]{url}
\RequirePackage[hyperfootnotes=false,
bookmarksnumbered,
bookmarksdepth=4
]{hyperref}
\hypersetup{
colorlinks=true,
citecolor=black,% 链接颜色设置
linkcolor=black,% 引用颜色设置
urlcolor=black % 网址颜色
}

\RequirePackage[nopostdot]{glossaries}%不显示description后的英文标点符号 . %详情请看https://blog.csdn.net/xovee/article/details/118548271
%https://blog.csdn.net/chinaloong1949/article/details/103043463
\renewcommand*{\glossarypreamble}{\vspace{-9pt}} % 词汇表
%设置词汇表排版规则
\newacronymstyle{acronym-uestc}{ %定义术语表样式
\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}
}{
\renewcommand*{\GenericAcronymFields}{
first={\the\glslongtok\space\protect\paren{\the\glsshorttok}},
description={\the\glslongtok}}
\renewcommand*{\genacrfullformat}[2]{%
\glsentrydesc{##1}~(\glsentrylong{##1},\space%
\glsentryshort{##1})%
}
\renewcommand*{\acronymentry}[1]{%
\acronymfont{\glsentryshort{##1}}%
}
}
\setacronymstyle{acronym-uestc}

\newglossarystyle{long-uestc}{
\renewenvironment{theglossary}%重新定义theglossary环境变量
{\begin{longtable}{lp{.7\textwidth}}}%
{\end{longtable}}%

\renewcommand*{\glossaryheader}{}
\renewcommand*{\glsgroupheading}[1]{}
\renewcommand{\glossentry}[2]{
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\ifglshaslong{##1}{\glsentrylong{##1}\ifglshasdesc{##1}{, \glsentrydesc{##1}}{}}
{\glsentrydesc{##1}} \
}
\renewcommand*{\subglossentry}[3]{
\glossentry{##2}{##3}}
}

\defglsentryfmt{%
\ifglshaslong{\glslabel}{%
\glsgenacfmt%
}{%
\ifglsused{\glslabel}{%
\glsgenentryfmt%
}{%
\glsgenentryfmt%
}%
}%
}

\newcommand{\thesisglossarylist}{
\newpage %另起一页,有可能换页失败,建议用\clearpage.
\fancyhf{}% 清空当前设置,相当于初始化。设定文章的页眉页脚
\fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont 缩略词表}% 设置页眉 (head),其显示的内容(缩略词表)居中
\fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\Roman{pseudopage}}% 设置页脚: 在每页的中间以罗马字母显示页码
\setlength\glsdescwidth{.7\textwidth} % 缩列表的列宽等于正文宽度的0.7倍
\pdfbookmark{缩略词表}{glossary}
\printglossary[style=long-uestc, title={\protect\centering 缩略词表}, nonumberlist, nogroupskip]%输出缩略表的内容,命令\printglossaries会在文档使用该处的位置打印出我们所创建的术语表,title=Special Terms,术语表的标题
%toctitle=List of term,在目录中术语表的标题
}
\makeglossaries %必须位于第一个术语条目之前。
%每一个术语条目由命令\newglossaryentry创建,它拥有两个参数。每个条目可以在之后的内容中使用命令\gls进行引用。
\RequirePackage{standalone}
\RequirePackage{indentfirst}
\RequirePackage{calc}
\RequirePackage{float}
\RequirePackage{fancyvrb}
\RequirePackage{fancyhdr}
\RequirePackage{titlesec}
\RequirePackage{setspace}
\RequirePackage{cite}
\RequirePackage[normalem]{ulem}
\RequirePackage{enumitem}
\RequirePackage{algorithm2e}
\RequirePackage{etoolbox}
\RequirePackage{newfloat}
\RequirePackage[resetlabels]{multibib}
\RequirePackage[nottoc]{tocbibind}
\RequirePackage{everypage}
\RequirePackage{ifoddpage}

\let\algorithm\relax %什么也不做,占用一个语法上的位置,一般用于分隔判断语句的条件与后面的数字
\let\endalgorithm\relax
\expandafter\let\csname algorithm*\endcsname\relax
\expandafter\let\csname endalgorithm*\endcsname\relax
\let\listofalgorithms\relax
%\DeclareOption{选项}{代码}其中的选项就是选项的名称,而代码就是选项要执行的指令集。
%/DeclareOption{option}{code}注:在装入类或包文件中,有时用户提供的可选项在类或包文件中并没有定义,这时如使用的是类,系统将产生警告;如使用的是包,系统将出错。
%/DeclareOption*{code} 表示用户使用了未定义的可选项时要执行的code。所有的可选项声明过之后,未执行相应代码,使用命令:/ProcessOptions/relax
%例:
%/DeclareOption{foo}{/typeout{saw foo.}}
%/DeclareOption{baz}{/typeout{saw baz.}}
%/DeclareOption*{/typeout{What’s /CurrentOption ?}}
%/ProcessOptions/relax
%用户在文档中书写了/usepackage[foo,bar]{jame}命令,将看到如下信息:
%saw foo. What’s bar ?
% Define the new algorithm environment
\DeclareFloatingEnvironment{algorithm}

\makeatletter
\renewcommand{@endalgoln}{@endalgocfline\hfill\strut\par}
\renewcommand{;}{\ifmmode
@mathsemicolon
\else
@endalgoln
\fi
}
% Definition for the style ruled
% First add the rules enclosing the caption
\DeclareCaptionFormat{algrule}{%
{@hangfrom{#1#2}%
\doublespacing
\small
\advance\caption@parindent\hangindent
\advance\caption@hangindent\hangindent
\caption@@par#3\par}%
}

% Apply the new format to the algorithm environment
\captionsetup[algorithm]{format=algrule} %设置算法标题格式

\makeatletter

\renewcommand{\algorithmname}{算法}%把\algorithmname默认的内容改为算法显示
\renewcommand{\thealgorithm}{\arabic{chapter}-\arabic{algorithm}}%显示算法计数器值
\captionsetup[algorithm]{aboveskip=6pt}%与代码环境上一行的垂直间距为6pt
\AtBeginEnvironment{algorithm}{\vspace{6pt}}%与正文的上一行垂直间隔6pt

\graphicspath{{./pic/}}%图片路径放在pic文件夹下

\RequirePackage[titles, subfigure]{tocloft}
\RequirePackage{subfigure}

\urlstyle{rm}
\raggedbottom

\renewcommand{\contentsname}{目\hspace{6pt}录} %使默认的Contents改为目 录显示
\renewcommand{\bibname}{参考文献}%使默认的参考文献名字改为参考文献显示
\renewcommand{\figurename}{图}%使默认的图名字改为图显示
\renewcommand{\tablename}{表}%使默认的表名字改为表显示
\renewcommand{\listfigurename}{图目录}
\renewcommand{\listtablename}{表目录}

% \newcommand*{\noaddvspace}{\renewcommand*{\addvspace}[1]{}}
% \addtocontents{lof}{\protect\noaddvspace}
% \addtocontents{lot}{\protect\noaddvspace}
%\addtocontents{扩展名} {文本}它可以将任意文本和相关格式命令写入目录或在创建目录时(如果是命令)则被执行,但它不会将命令写入目录。 文本可以是任意字符或\vspace、\newpage等调整某一条目格式的命令,一般在命令前加\protect。
\pretocmd{\listoffigures}{ % 图目录是存放在.lof目录的文件下
\newpage %新建一页
\fancyhf{} %初始化页码页脚布局
\fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont 图目录}
\fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\Roman{pseudopage}} % 罗马页码居中显示
\renewcommand{\cftfigpresnum}{图} %条目编号前内容
\addtolength{\cftfignumwidth}{12pt} %设置长度命令,使命令\cftfignumwidth的长度设置为12pt,条目编号与条目内容之间占用的宽度, 例如:图 1-2 [\cftfignumwidth] 电子战飞机
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}} %将目录深度设置为-1
}{}{}

\newcommand{\thesisfigurelist}{
\listoffigures
}

\pretocmd{\listoftables}{% 表目录是存放在.lot目录的文件下
\newpage
\fancyhf{}
\fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont 表目录}
\fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\Roman{pseudopage}}
\renewcommand{\cfttabpresnum}{表}%条目编号前内容
\addtolength{\cfttabnumwidth}{12pt}%条目编号占用宽度,条目编号与条目内容之间占用的宽度, 例如:表1-1 [\cftfignumwidth] 参数设置
\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}%将目录深度设置为-1,目录中只显示一级标题
}{}{}

\newcommand{\thesistablelist}{ %定义该模板的表目录
\listoftables
}

\RequirePackage[a4paper,
inner=3cm, outer=3cm, top=3cm, bottom=3cm,
bindingoffset=0cm]{geometry} %页面布局

\setlength{\headheight}{15pt}

\pagestyle{fancy} %为标题在每页页眉上用户自定义的奇页眉使用电子科技大学xxx,偶数使用标题,页脚页眉居中
\linespread{1.391}%设置行距
\setlength\parindent{24pt} % 设置缩进长度
\titlespacing{\chapter}{0pt}{0pt}{18pt}%标题周距设置,\titlespacing*{标题命令}{左间距}{上间距}{下间距} [右间距],用它可以设置每种层次标题与四周之间的距离。
\titlespacing{\section}{0pt}{18pt}{6pt}
\titlespacing{\subsection}{0pt}{12pt}{6pt}
\titlespacing{\subsubsection}{0pt}{12pt}{6pt}
%chapter章序号计数器,section节序号计数器,subsection小节序号计数器,subsubsection小小节序号计数器,paragraph段序号计数器,figure插图序号计数器,table表格序号计数器,page页码序号计数器,equation公式序号计数器
\renewcommand\thechapter{第\zhnumber{\arabic{chapter}}章}%\zhnumber{计数器},使计数器值输出为汉字格式。
\renewcommand\thesection{\arabic{chapter}.\arabic{section}}%\the计数器,显示计数器的值,该命令只使用于序号计数器,例如\thepage显示当前页码。\value{计数器}调用计数器的值,无论计数器的计数形式如何都被转换成对应的阿拉伯数字。

\renewcommand{\theequation}{\arabic{chapter}-\arabic{equation}}%显示公式编号,其格式x-x
\renewcommand{\thetable}{\arabic{chapter}-\arabic{table}}%显示表格编号,其格式x-x
\renewcommand{\thefigure}{\arabic{chapter}-\arabic{figure}}%显示插图编号,其格式x-x

\captionsetup{format=hang}%caption工具包在加载时可以修改标题的很多方面,也可以通过 captionsetup命令也可以在工具包选项中修改。\captionsetup[浮动体类型]{参数1=选项, 参数2=选项,…}其中可选参数浮动体类型的选项可以是figure或table,如果省略该参数, 则表示这两种浮动体都适用。format:plain默认值,将标题作为普通段落排版。hang将标题从第二行起悬挂缩进排版,缩进宽度等于标题标志加分隔符的宽度。indention设置从标题第二行起的附加缩进宽度, 例如indention=5mm,其默认值是0pt。
\captionsetup{width=\textwidth - 42pt}%设置标题的宽度
\captionsetup[figure]{aboveskip=6pt,belowskip=0pt}%设置标题与插图或表格之间的垂直距离,设置标题与下文之间的附加垂直距离, 如果标题在插图或表格之下;或标题与上文之间的附加垂直距离, 如果标题在插图或表格之上。该参数的默认值是0pt。
\captionsetup[table]{belowskip=6pt}

\setlength{\extrarowheight}{5pt}
\setlength{\subfigcapskip}{0pt}
\setlength{\intextsep}{9pt}

\makeatletter
\AtBeginEnvironment{figure}{%让图环境的内容居中
\def@floatboxreset{\centering}
}
\makeatother

\makeatletter
\AtBeginEnvironment{table}{%让表格环境的内容居中
\def@floatboxreset{\centering}
}
\makeatother
\AtBeginEnvironment{tabular}{\small}

\makeatletter
\renewcommand{\p@subfigure}{\arabic{chapter}-\arabic{figure}}
\makeatother

\newcommand{\chinesecolon}{\char"FF1A}
\newcommand{\chinesespace}{\char"3000}
\newcommand{\chineseperiod}{\char"3002}
\newcommand{\chinesequestion}{\char"FF1F}
\newcommand{\chineseexclamation}{\char"FF01}
\newcommand{\chinesecomma}{\char"FF0C}
\newcommand{\chinesesemicolon}{\char"FF1B}
\newcommand{\chineseleftparenthesis}{\char"FF08}
\newcommand{\chineserightparenthesis}{\char"FF09}

\setcounter{secnumdepth}{3}%设置章节深度
\setcounter{tocdepth}{2}%设置目录深度

\titleformat{\chapter}[block]
{\centering\fontsize{15pt}{15pt}\selectfont\heiti\thispagestyle{fancy}}{\thechapter}{7.5pt}{}

\titleformat{\section}[block]
{\fontsize{14pt}{14pt}\selectfont\heiti}
{\thesection}{7pt}{}

\titleformat{\subsection}[block]
{\fontsize{14pt}{14pt}\selectfont\heiti}
{\thesubsection}{7pt}{}

\titleformat{\subsubsection}[block]
{\fontsize{12pt}{12pt}\selectfont\heiti}
{\thesubsubsection}{6pt}{}

\RequirePackage[hang, perpage]{footmisc}
\addtolength{\footnotesep}{0pt}
\setlength{\footnotemargin}{13.5pt}

\renewcommand{\footnotesize}{\fontsize{9pt}{10.8pt}\selectfont}
\renewcommand{\small}{\fontsize{10.5pt}{12.6pt}\selectfont}
\renewcommand\footnotelayout{\fontsize{9}{11.7}\selectfont}

\renewcommand{\thefootnote}{\ifcase\value{footnote}\or\ding{172}\or
\ding{173}\or\ding{174}\or\ding{175}\or\ding{176}\or\ding{177}\or
\ding{178}\or\ding{179}\or\ding{180\or\ding{181}}\fi}

\renewcommand{\footnoterule}{\vfill\noindent\vspace{0.9mm}\hspace{27pt}\rule{5.05cm}{0.02cm}\vspace*{2.6pt}}

\makeatletter
\def@makefntext #1{
\ifFN@hangfoot
\bgroup \setbox @tempboxa \hbox {
\ifdim
\footnotemargin >0pt \hb@xt@
\footnotemargin {\hbox { \normalfont @thefnmark}\hss }
\else
\hbox { \normalfont @thefnmark}
\fi
}
\leftmargin \wd @tempboxa
\rightmargin \z@ \linewidth \columnwidth
\advance \linewidth -\leftmargin\parshape @ne
\leftmargin \linewidth \footnotesize @setpar {{@@par }}
\leavevmode \llap {\box @tempboxa }\parskip
\hangfootparskip \relax \parindent
\hangfootparindent \relax
\else
\parindent 1em \noindent
\ifdim
\footnotemargin >\z@ \hb@xt@
\footnotemargin {\hss \hbox { \normalfont @thefnmark} }
\else
\ifdim \footnotemargin =\z@
\llap {\hbox { \normalfont @thefnmark} }
\else
\llap {\hb@xt@ -\footnotemargin {\hbox { \normalfont @thefnmark} \hss }}
\fi
\fi
\fi
\footnotelayout #1\ifFN@hangfoot \par \egroup
\fi
}
\makeatother

\newcounter{pseudopage}%自定义一个名字pseudopage新计数器
\setcounter{pseudopage}{0}%pseudopage新计数器清零
\AddEverypageHook{\stepcounter{pseudopage}}%\stepcounter{计数器},将计数器的值加1,如果计数器是层次标题的序号计数器,还将比其低一层计数器清零。例如\stepcounter{chapter},将chapter序号计数器加1,同时将section以及低于section的序号计数器归零。

\newcommand\blankpage{%添加空白页
\newpage %另起一页
\null
\thispagestyle{empty}%没有页眉页脚,空白页
\addtocounter{pseudopage}{-1}%\addtocounter{计数器}{数值}将数值与该计数器原有值相加,数值可以是正整数,也可以是负整数。
\newpage
}

\newenvironment{thesisstatement}{%定义陈述环境
\thispagestyle{empty}%没有页眉页脚,空白页
}{
\newpage
\null
\thispagestyle{empty}%没有页眉页脚,空白页

\newpage
\setcounter{page}{0}
\setcounter{pseudopage}{0}
\setlength{\extrarowheight}{5pt}

}

\newenvironment{chineseabstract}{
\fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\Roman{pseudopage}}
\pagenumbering{Roman}
\pdfbookmark{中文摘要}{chineseabstract}
\chapter*{摘\chinesespace 要}
\thispagestyle{fancy}
\fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont 摘要}
}{
\checkoddpage
\ifoddpage
\blankpage
\else
\newpage
\fi
}

\newcommand{\chinesekeyword}[1]{
\vspace{\baselineskip}
\noindent
\begin{minipage}[t]{48pt}
\noindent\textbf{关键词\chinesecolon}
\end{minipage}
\begin{minipage}[t]{\linewidth - 48pt}
#1
\end{minipage}
}

\newenvironment{englishabstract}{
\pdfbookmark{英文摘要}{englishabstract}
\chapter*{\bfseries ABSTRACT}
\thispagestyle{fancy}
\fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont ABSTRACT}
}{
\checkoddpage
\ifoddpage
\blankpage
\else
\newpage
\fi
}

\newcommand{\englishkeyword}[1]{
\vspace{\baselineskip}
\noindent\begin{minipage}[t]{2.1cm}
\noindent\textbf{Keywords:}
\end{minipage}
\begin{minipage}[t]{
\linewidth - 2.1cm}
#1
\end{minipage}
}

\AddEverypageHook{\addtocontents{toc}{
\protect\cftsetpnumwidth{\widthof{\thepage}-1pt}
}}

\AddEverypageHook{\addtocontents{lof}{
\protect\cftsetpnumwidth{\widthof{\thepage}-1pt}
}}

\AddEverypageHook{\addtocontents{lot}{
\protect\cftsetpnumwidth{\widthof{\thepage}-1pt}
}}

\tocloftpagestyle{fancy}%用户自定义的奇页眉使用电子科技大学xxx,偶数使用标题,页脚页眉居中
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand\cftchapleader{\cftdotfill{\cftdotsep}}

\renewcommand{\cftdotsep}{0.4}

\setlength{\cftbeforetoctitleskip}{0pt}
\setlength{\cftaftertoctitleskip}{18pt}
\setlength{\cftbeforechapskip}{0pt}

\addtolength{\cftchapnumwidth}{25pt}

\cftsetindents{section}{21pt}{22pt}
\cftsetindents{subsection}{44pt}{31pt}
\cftsetindents{subsubsection}{76pt}{41pt}

\renewcommand{\cfttoctitlefont}{\fontsize{15pt}{15pt}\selectfont\heiti}
\renewcommand\cftchapfont{\heiti}

\newcommand{\chinesedegreename}{硕士}
\newcommand{\chinesebooktitle}{硕士学位论文}
\newcommand{\englishbooktitle}{Master Thesis}
\newcommand{\thetitle}{}
\newcommand{\theauthor}{}
\newcommand{\thedate}{}
\newcommand{\theschool}{}
\newcommand{\themajor}{}
\newcommand{\theadvisor}{}
\newcommand{\thestudentid}{}
\newcommand{\theenglishtitle}{}
\newcommand{\theenglishadvisor}{}
\newcommand{\theenglishauthor}{}
\newcommand{\theprofession}{}
\newcommand{\refeqch}[1]{(\ref{#1})}
\newcommand{\reffig}[1]{ \ref{#1} }

\renewcommand{\title}[1]{
\renewcommand{\thetitle}{#1}
}

\renewcommand{\author}[1]{
\renewcommand{\theauthor}{#1}
}

\renewcommand{\date}[1]{
\renewcommand{\thedate}{#1}
}

\newcommand{\major}[1]{
\renewcommand{\themajor}{#1}
}

\newcommand{\school}[1]{
\renewcommand{\theschool}{#1}
}

\newcommand{\advisor}[1]{
\renewcommand{\theadvisor}{#1}
}

\newcommand{\studentid}[1]{
\renewcommand{\thestudentid}{#1}
}

\newcommand{\englishtitle}[1]{
\renewcommand{\theenglishtitle}{#1}
}

\newcommand{\englishadvisor}[1]{
\renewcommand{\theenglishadvisor}{#1}
}

\newcommand{\englishauthor}[1]{
\renewcommand{\theenglishauthor}{#1}
}

\newcommand{\profession}[1]{
\renewcommand{\theprofession}{#1}
}

%\newcommand{\englishtitle}{Research and Implementation of Radar Jamming Technology Based on Frequency Diverse Array}

\DeclareOption{bachelor}{
\renewcommand{\chinesedegreename}{本科}
\renewcommand{\chinesebooktitle}{本科学位论文}
\renewcommand{\englishbooktitle}{Bachelor Thesis}
}

\DeclareOption{master}{
\renewcommand{\chinesedegreename}{硕士}
\renewcommand{\chinesebooktitle}{硕士学位论文}
\renewcommand{\englishbooktitle}{Master Thesis}
}

\DeclareOption{promaster}{
\renewcommand{\chinesedegreename}{硕士}
\renewcommand{\chinesebooktitle}{专业学位硕士学位论文}
\renewcommand{\englishbooktitle}{Master Thesis for Professional Degree}
}

\DeclareOption{doctor}{
\renewcommand{\chinesedegreename}{博士}
\renewcommand{\chinesebooktitle}{博士学位论文}
\renewcommand{\englishbooktitle}{Doctoral Dissertation}
}

%封面
\newcommand{\makecover}{
\thispagestyle{empty}%没有页眉页脚,空白页
\setlength{\extrarowheight}{9pt}
\begin{center}
\fontsize{22pt}{22pt}\selectfont 电\hspace{0.5em}子\hspace{0.5em}科\hspace{0.5em}技\hspace{0.5em}大\hspace{0.5em}学 \[7bp] %\fontsize{字体尺寸}{行间距}\selectfont
\fontsize{12pt}{12pt}\selectfont UNIVERSITY OF ELECTRONIC SCIENCE
AND TECHNOLOGY OF CHINA \[36bp]
\fontsize{42pt}{42pt}\selectfont\chinesebooktitle \[24bp]
\fontsize{16pt}{16pt}\selectfont
\textbf{\MakeUppercase{\englishbooktitle}} \[36bp]%[48bp]
\includegraphics[width=221bp]{logo.pdf} \[36bp]%[48bp]插入图标
\begin{tabular}{lp{4.6in}}
\fontsize{18pt}{16pt}\selectfont 论文题目 & \multirow[t]{1}{4.6in}{
\centering
\fontsize{16pt}{19pt}\selectfont
\thetitle
} \ %\fontsize{16pt}{16pt}
\cline{2-2}
\end{tabular} \[\baselineskip]
\begin{tabular}{>{\fontsize{16pt}{16pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{3.77in}}
专业学位类别 & \themajor \
\cline{2-2}
学\chinesespace\chinesespace\chinesespace\chinesespace 号 & \thestudentid \
\cline{2-2}
作\hspace{0.666em}者\hspace{0.666em}姓\hspace{0.666em}名 & \theauthor \
\cline{2-2}
指\hspace{0.666em}导\hspace{0.666em}老\hspace{0.666em}师 & \theadvisor\chinesespace\theprofession \
\cline{2-2}
\end{tabular}
\end{center}

\newpage%另起一页满足打印需求
\null
\thispagestyle{empty}

\newpage%另起一页
\thispagestyle{empty}

\noindent%无缩进
分类号 \uline{\hspace{2.5in}} 密级 \uline{\hspace{2.5in}} \[12bp]
UDC\textsuperscript{注1} \uline{\hspace{2.4in}} \[0bp] %[12bp]

\begin{center}
\fontsize{36pt}{36pt}\selectfont{\heiti
学\chinesespace 位\chinesespace 论\chinesespace 文
} \[30bp] %[48bp]

\fontsize{16pt}{16pt}\selectfont \textbf{ \thetitle } \
\vspace{-15pt}
\rule{5.9in}{.4pt} \
\fontsize{12pt}{12pt}\selectfont( 题名和副题名)\[30bp] %[48bp]
\fontsize{16pt}{16pt}\selectfont \textbf{ \theauthor } \
\vspace{-15pt}
\rule{1.63in}{.4pt} \
\fontsize{12pt}{12pt}\selectfont( 作者姓名) \[30bp] %[48bp]
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{2.45in} @{}
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{2.45in}}
指导老师 & \textbf{ \theadvisor } & \textbf{ \theprofession } \
\cline{2-3}
& \textbf{ \theschool } & \textbf{ 成都 }\
\cline{2-3}
\end{tabular} %\[30bp] %[48bp]
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{4.68in}}
& \fontsize{12pt}{12pt}\selectfont {\hspace{3em}(姓名、职称、单位名称)}
\end{tabular} \[30bp] %[48bp]
\end{center}

\noindent
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{1.0in}
>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{2.25in}}
申请学位级别 & \textbf{ \chinesedegreename{} } &
专业学位类别 & \textbf{\themajor} \
\cline{2-2}
\cline{4-4}
\end{tabular} \
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{4.58in}}
工程领域名称 & \textbf{电子与通信工程} \
\cline{2-2}
\end{tabular} \
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{1.0in}
>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{2.25in}}
提交论文日期 & 2019.4.26 & 论文答辩日期 & 2019.5.28 \
\cline{2-2}
\cline{4-4}
\end{tabular} \
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{4.08in}}
学位授予单位和日期 &\textbf{\theschool \chinesespace} 2019 年 6 月 \
\cline{2-2}
\end{tabular} \
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{2.26in}}
答辩委员会主席 & \textbf{张晓玲} \
\cline{2-2}
% 评阅人 & \textbf{张晓玲 \chinesespace 江朝抒}\
% \cline{2-2}
\end{tabular} \
\begin{tabular}{>{\fontsize{12pt}{12pt}\selectfont}l
>{\centering\arraybackslash\fontsize{16pt}{16pt}\selectfont}
p{5.08in}}
评阅人 & \%\textbf{张晓玲 \chinesespace \chinesespace 江朝抒} \
\cline{2-2}
\end{tabular}

\vspace{0.54in}
\noindent
注1:注明《国际十进分类法UDC》的类号。

\newpage
\null
\thispagestyle{empty}

\newpage
\thispagestyle{empty}

\begin{center}
\fontsize{18pt}{18pt}\selectfont \textbf{\theenglishtitle} \[180bp]
\fontsize{15pt}{15pt}\selectfont A Master Thesis Submitted to \
University of Electronic Science and Technology of China \[150bp]
%\fontsize{42pt}{42pt}\selectfont\chinesebooktitle \[24bp]
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{>{\fontsize{16pt}{32pt}\selectfont}r
>{\centering\arraybackslash\fontsize{16pt}{32pt}\selectfont}
p{4.5in}}
Discipline: & \textbf{ Master of Engineering }\
\cline{2-2}
Author: & \textbf{ \theenglishauthor }\
\cline{2-2}
Supervisor: & \textbf{ \theenglishadvisor } \
\cline{2-2}
School: & \textbf{ Research Institute of Electronic Science and } \
\cline{2-2}
& \textbf{ Technology of UESTC} \
\cline{2-2}
\end{tabular}
\end{center}

\newpage
\null
\thispagestyle{empty}

\newpage
\setcounter{page}{0}
\setcounter{pseudopage}{0}
\setlength{\extrarowheight}{5pt}
}

\ProcessOptions\relax%所有的可选项声明过之后,未执行相应代码,使用命令:/ProcessOptions/relax

\newcommand{\standardhead}{
\fancyhf{}
\fancyhead[CO]{\fontsize{10.5pt}{12.6pt}\selectfont\leftmark}%奇数页页眉使用标题
\fancyhead[CE]{\fontsize{10.5pt}{12.6pt}\selectfont 电子科技大学\chinesedegreename{}学位论文}%偶数页页眉使用这个
\fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\thepage}%页脚页码居中显示
}

\pretocmd{\tableofcontents}{
\fancyhf{}
\fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont 目录}
\fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\Roman{pseudopage}}
\pdfbookmark{目录}{toc}
}{}{}

\newcommand{\thesistableofcontents}{%定义该模板表格目录
\tableofcontents
}

\renewcommand{\chaptermark}[1]{\markboth{第\zhnumber{\arabic{chapter}}章 \hspace{5.25pt}#1}{}} %修改页眉章节显示内容

\newcommand{\thesisacknowledgement}{
\renewcommand\thesection{\arabic{section}}
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}%只显示一级标题
\setcounter{section}{0}
\chapter*{致\hspace{12pt}谢}
\addcontentsline{toc}{chapter}{致\hspace{12pt}谢}
\markboth{致谢}{致谢}
\thispagestyle{fancy}
\hypersetup{bookmarksdepth=0}
}

\newcommand{\thesischapterexordium}{%绪论格式设置
% \checkoddpage
% \ifoddpage
% {\blankpage odd}
% \else
% {\newpage even}
% \fi
\newpage
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
\standardhead
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{绪\hspace{6pt}论}
\chaptermark{绪论}
}

\newcommand{\thesisappendix}{%附录格式设置
\chapter*{附\hspace{12pt}录}
\setcounter{section}{0}
\addcontentsline{toc}{chapter}{附录}
\markboth{附录}{附录}
\thispagestyle{fancy}
\hypersetup{bookmarksdepth=0}
\renewcommand{\theequation}{a-\arabic{equation}}
\renewcommand{\thetable}{a-\arabic{table}}
\renewcommand{\thefigure}{a-\arabic{figure}}
}

\newcommand{\thesistranslationoriginal}{
\chapter*{外文资料原文}
\setcounter{section}{0}
\addcontentsline{toc}{chapter}{外文资料原文}
\markboth{外文资料原文}{外文资料原文}
\thispagestyle{fancy}
\hypersetup{bookmarksdepth=0}
\renewcommand{\theequation}{\arabic{equation}}
\renewcommand{\thetable}{\arabic{table}}
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}
}
%章节目录中的条目是由\chapter和\section等章节命令生成的,插图或表格目录中的条目是由在浮动环境figure或table中的图表标题命令\caption生成的; 而带星号的章节命令和图表标题命令以及摘要! 参考文献等环境创建的无序号标题, 则不能进入目录。如果希望某个无序号标题也能被排入目录, 可在该标题或环境命令之后使用附加条目命令:
%\addcontentsline{扩展名} {条目类型} {条目文本}
%扩展名 标题记录文件的扩展名, 如果所附加条目的是章节目录,扩展名为toc;如果是插图目录, 则为lof; 如果是表格目录则为lot。
%条目类型 所附加条目的格式类型,如果扩展名为toc, 那条目类型可以是chapter、section等不带反斜杠的章节命令名; 如果为lof, 则是figure; 如果为lot, 则是table。
%条目文本可以是带星号命令或摘要等环境生成的无序号标题, 也可以是其他需要向目录添加的文字符号
\newcommand{\thesistranslationchinese}{
\chapter*{外文资料译文}
\setcounter{section}{0}%section计数器清零
\addcontentsline{toc}{chapter}{外文资料译文}%把外文资料译文加入到目录
\markboth{外文资料译文}{外文资料译文}%\markboth{<左面页眉>}{<右面页眉>}
\thispagestyle{fancy}%需要使用fancyhdr包,并提供了奇偶页不同的风格
\hypersetup{bookmarksdepth=0}
\renewcommand{\theequation}{\arabic{equation}}%显示公式计数器的值
\renewcommand{\thetable}{\arabic{table}}%显示表格计数器的值
\renewcommand{\thefigure}{\arabic{figure}}%显示插图计数器的值
\renewcommand{\figurename}{图}%\figurename换成汉字图显示
\renewcommand{\tablename}{表}%\tablename换成汉字表显示
}

\makeatletter
\renewcommand{@biblabel}[1]{[#1]\hfill}
\makeatother

\patchcmd\thebibliography
{\labelsep}
{\labelsep\itemsep=0pt\parsep=0pt\relax}
{}
{\typeout{Couldn’t patch the command}}

\newenvironment{thesisbibliography}{
\begin{thebibliography}{lo}
\interlinepenalty=10000
\begin{spacing}{1.667}
\thispagestyle{fancy}
\small
}{
\end{spacing}
\end{thebibliography}
}

\pretocmd{\bibliography}{
\thispagestyle{fancy}
\interlinepenalty=10000
\begin{spacing}{1.667}
}{}{}

\apptocmd{\bibliography}{
\end{spacing}
}{}{}
%其次,在正文中引用参考文献。BIBTEX程序在生成参考文献列表的时候,通常只列出用了\cite 命令引用的那些。如果需要列出未被引用的文献,则需要 \nocite{ ⟨ citation ⟩ } 命令; 而 \nocite{} 则让所有未被引用的文献都列出。
\newcommand{\thesisloadbibliography}[2][]{
\ifthenelse{ %\ifthenelse{判断条件}{肯定结构}{否定结构}
\equal{#1}{nocite} %判断#1是否等于notice
}{
\nocite{
}%所有未被引用的文献都列出
}{}
\bibliographystyle{thesis-uestc}%插入参考文献的样式.bst文件
\bibliography{#2}%参考文献格式,用于指定排版参考文献所使用的文献格式文件名.bib
}

\newcites{accomplish}{攻读\chinesedegreename{}学位期间取得的成果}

\newenvironment{thesisaccomplish}{%设置thesisaccomplish环境格式
\renewcommand{\bibname}{攻读\chinesedegreename{}学位期间取得的成果}
\begin{thebibliography}{lo}
\interlinepenalty=10000
\begin{spacing}{1.667}
\thispagestyle{fancy}
\small
}{
\end{spacing}\end{thebibliography}
\renewcommand{\bibname}{参考文献}
}

\newcommand{\thesisloadaccomplish}[1]{%攻读硕士
\nociteaccomplish{*}
\renewcommand{\bibname}{攻读\chinesedegreename{}学位期间取得的成果}
\thispagestyle{fancy}%该页含有页眉和页脚
\begin{spacing}{1.667}
\bibliographystyleaccomplish{thesis-uestc}%插入参考文献的样式.bst文件
\bibliographyaccomplish{#1}%参考文献格式,用于指定排版参考文献所使用的文献格式文件名.bib
\end{spacing}
\renewcommand{\bibname}{参考文献}
}

%\newtheorem{环境名} [计数器名] {标题} [排序单位]
%环境名 给所定义的定理类环境起的名称, 它不得与现有环境重名, 否则系统将提示出错。每定义一个环境名, 系统就会自动创建一个同名的计数器, 用于为所定义的定理类环境排序。
%计数器名 可选参数, 如果希望所定义的定理类环境与已定义的某个定理类环境混合排序,就可在其中填写该环境的计数器名, 也就是该定理类环境的环境名;如果省略这个可选参数, 则表示本定理类环境单独排序。
%标题 用于设置定理类表达式的标题, 如theorem定理, 证明和引理等。
%排序单位 可选参数, 用于设定排序单位, 如果是chapter, 则每一新章开始时所定义定理类环境的计数器清零; 该可选参数的默认值是以全文为排序单位
\newtheoremstyle{dotless}{0pt}{0pt}{\normalfont}{24pt}{\heiti}{}{ }{}
\theoremstyle{dotless}%plain(默认样式):定理名称是正体,定理内容是斜体。definition:定理名称和定理内容都是正体。remark: 定理名称是斜体,定理内容是正体

\newtheorem{theorem}{定理}[chapter]
\newtheorem{axiom}[theorem]{公理}
\newtheorem{corollary}[theorem]{推论}
\newtheorem{lemma}[theorem]{引理}
\newtheorem{definition}[theorem]{定义}
\newtheorem{example}[theorem]{例子}
\newtheorem{proposition}[theorem]{命题}

\renewcommand{\thetheorem}{\arabic{chapter}.\arabic{theorem}}
\renewcommand{\theaxiom}{\arabic{chapter}.\arabic{axiom}}
\renewcommand{\thecorollary}{\arabic{chapter}.\arabic{corollary}}
\renewcommand{\thelemma}{\arabic{chapter}.\arabic{lemma}}
\renewcommand{\thedefinition}{\arabic{chapter}.\arabic{definition}}
\renewcommand{\theexample}{\arabic{chapter}.\arabic{example}}
\renewcommand{\qedsymbol}{ ■ \blacksquare }%结束符,\blacksquare实心方框,\square空心方框
\renewcommand{\proofname}{证明}
%定义该模板的证明环境格式
\makeatletter
%\renewenvironment{新环境名称}[参数个数][参数默认值]{开始部分定义}{结束部分定义}
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%这里 \pushQED{\qed} 把 \qed 压入了 QED 这个堆栈,然后在环境结束的地方,通过 \popQED把压入堆栈的最后一个元素弹出来。
\normalfont %正体
\topsep0pt \partopsep0pt
\trivlist
\item[\hskip5\labelsep
\heiti %黑体
#1@addpunct{:}]\ignorespaces%\proofname后面:
}%开始部分定义
{
\popQED\endtrivlist@endpefalse
}%结束部分定义
\makeatother
%\newenvironment{proof}{{\noindent\it \proofname}\quad}{\hfill □ \square \par}
%\noindent表示proof没有缩进,\it表示proof斜体
%\quad表示\proofname后面空四个空格,\hfill表示右对齐,\square表示方框,\par表示结尾空一段.
\newcommand{\citing}[1]{\textsuperscript{\cite{#1}}}%\textsuperscript{}文字上标
\setlist{noitemsep}%条目之间无附加的垂直距离
\setlist{nolistsep}

\AtBeginDocument{
\setlength{\abovedisplayskip}{8pt}
\setlength{\belowdisplayskip}{8pt}
\setlength{\belowdisplayshortskip}{8pt}
\setlength{\abovedisplayshortskip}{8pt}
}

\endinput

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值