diff --git a/.gitignore b/.gitignore index 1955723..cf27a00 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,6 @@ **/dist **/log **/logs -**/*.log \ No newline at end of file +**/*.log +.DS_Store +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 7cca2e6..a617b4f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # 华南师范大学本科毕业论文 latex 模板 - -SEO: 华师毕业论文模板, 华师本科毕业论文模板, 华师论文模板, latex 模板, 毕业论文模板, SCNU, SCNU 论文模板, SCNU 本科论文模板 - -## 使用 +> 本文基于 [claviering/latex-scnu](https://github.com/claviering/latex-scnu),结合2017级论文实际写作要求修改而成。 ## 目录结构 @@ -17,22 +14,40 @@ SEO: 华师毕业论文模板, 华师本科毕业论文模板, 华师论文模 ├── reference 参考文献 ├── state-auth 授权页面 ├── thanks 致谢 + ├── requirements 论文要求 ├── main.cls 引入各种包 └── main.tex input 各个章节, 入口文件 -## 使用 Usage +## 使用指南 -`make` +1. 阅读论文要求 +2. 阅读本文档 +3. 通读本项目内容,关注 + 1. 图片插入 includegraphics + 2. 表格插入 table + 3. 代码插入 lstlistings + 4. 所有注释 +4. 修改页眉 +5. 写作论文 +6. 加上引用,推荐使用谷歌学术导出BibTex,修改 `reference/ref.bib` +7. 参照论文要求当中的Checklist进行自查 -不需要编译生成参考文献 +### 编译文档 +> 推荐使用命令行,因为vscode的workshop recipes可能会导致引用无效 -`make pdf` +生成完整文档:`make` -## 字体 +不生成参考文献:`make pdf` -默认就是宋体 +### 页眉设置 -## 字号大小 +main.cls 78行 + +`\newcommand{\thesistitlefancyhead}{论文题目设置为页眉} % 定义论文题目为页眉` + +### 字号设置 +根据要求,部分中文为黑体。 +中文默认就是宋体,英文默认是Times New Roman。 ```tex {\zihao{-6}小六} @@ -45,11 +60,22 @@ SEO: 华师毕业论文模板, 华师本科毕业论文模板, 华师论文模 {\zihao{2}二号} {\zihao{-1}小一} {\zihao{1}一号} +{\heiti 黑体} ``` -## 论文写作要求 -- 严格的学术规范,论文规范, +### 封面 + +正式论文装订最后统一使用学校发的封面,打印的封面仅仅给答辩老师看的,那种封面好看就用那种,无所谓。 + +```tex +\input{cover/image} % 图片封面 +\input{cover/index} % 文字封面 +``` + +## 论文写作建议 + +- **严格的学术规范,论文规范** - 标题。 - 图表需要自己做自己做。 - 内容思考过。 @@ -67,42 +93,7 @@ SEO: 华师毕业论文模板, 华师本科毕业论文模板, 华师论文模 - 有什么难度?有什么工作量?。 - 论文里面图要有意义。 - -## 论文答辩 - -- 论文答辩5页ppt。 -- 12个人,一个上午。 -- 为什么这么做。 -- 有思想。 -- 答辩的时候主要体现:工作量、工作态度、学术规范等。 -- 不需要原创性!是自己的工作即可。比如,多写代码。 -- 毕业论文一大忌就是:没有突出自己的工作!你们一定要明确表明自己想做什么,怎么分析、设计,最终做了什么。 - -## 命令说明 - -```tex -% 设置 1.5 倍行距 -\usepackage{setspace} -\begin{spacing}{1.5} -\end{spacing} -``` - -## 添加空白页 - -正文前的空白页不加底部页面 `\afterpage{\blankpage} ` - -正文中的空白页,添加底部页面 `\afterpage{\null\newpage}` - -## 封面 - -正式论文装订最后统一使用学校发的封面,打印的封面仅仅给答辩老师看的,那种封面好看就用那种,无所谓。 - -```tex -\input{cover/image} % 图片封面 -\input{cover/index} % 文字封面 -``` - -## 排版细节 +### 论文排版 - 一个章节文字要多,显得有话可说 - 章节里注意分段,一个段落不能太长,注意行数 @@ -110,17 +101,13 @@ SEO: 华师毕业论文模板, 华师本科毕业论文模板, 华师论文模 - 表格要有表头 - 图片要有说明 -## 文献 - -文章中引用到的文献才写到参考文献中 - -## 页眉设置 - -main.cls 78行 - -`\newcommand{\thesistitlefancyhead}{论文题目设置为页眉} % 定义论文题目为页眉` +### 论文答辩 - +- 为什么这么做。 +- 有思想。 +- 答辩的时候主要体现:工作量、工作态度、学术规范等。 +- 不需要原创性!是自己的工作即可。比如,多写代码。 +- 毕业论文一大忌就是:没有突出自己的工作!你们一定要明确表明自己想做什么,怎么分析、设计,最终做了什么。 ## 参考 diff --git a/abstract/abstract-en.tex b/abstract/abstract-en.tex index d0999f9..53bc818 100644 --- a/abstract/abstract-en.tex +++ b/abstract/abstract-en.tex @@ -1,11 +1,15 @@ \begin{center} + {\zihao{-2}\bfseries THESIS NAME} + \\ \hspace*{\fill} \\ \addcontentsline{toc}{section}{Abstract} - \zihao{-2} - Abstract + \zihao{4} Abstract \end{center} - \zihao{-4} + \ \\ + \zihao{5} A replay attack is a form of network attack in which a valid data transmission is maliciously or fraudulently repeated or delayed. It is mainly used in the identity authentication process and destroys the correctness of authentication. In this paper, I analyze the replay attacks that exist in the zero round-trip time protocol used in the transport layer protocol. Programming to implement a simple transport layer protocol, then I reproduce the relevant replay attacks by programming and implement four methods to resist the replay attack protocol. The methods are as follows. First, examine whether the Ticker sent by the client to the zero round trip expires. Second, examine whether the Ticker sent by the client to the zero round trip is used. Third, make the server only accept zero rounds of idempotent requests. Fourth, add an Early-Data request header to inform the server that this request is an early data request, allowing the server to determine whether to accept early data based on actual conditions. After testing and analysis, I conclude that the combination of the first, the second and the fourth method can achieve the best effect, ensuring that the server can process the early data normally without being affected by the zero round-trip time replay attack. \ \\ - \textbf{Keywords: }0-RTT, TLS 1.3, Early Data,\ Replay Attacks + \ \\ + \zihao{-4} + \textbf{Keywords:}\ \ 0-RTT, TLS 1.3, Early Data,\ Replay Attacks \newpage \ No newline at end of file diff --git a/abstract/abstract-zh-CN.tex b/abstract/abstract-zh-CN.tex index c2ab666..7fc60db 100644 --- a/abstract/abstract-zh-CN.tex +++ b/abstract/abstract-zh-CN.tex @@ -1,13 +1,18 @@ \setcounter{page}{1} \pagenumbering{Roman} \begin{center} + {\zihao{-2}\heiti\bfseries 论文标题} + \\ \hspace*{\fill} \\ \addcontentsline{toc}{section}{摘要} - \zihao{-2} \bfseries 摘\quad 要 + \zihao{4} \bfseries 摘\quad 要 \end{center} - \zihao{-4} + \ \\ + \zihao{5} 分析传输层协议中使用的零轮往返时长协议存在的重放攻击,编程实现简单传输层协议,重现相关重放攻击,并分别实现四种方法抵抗重放攻击。方法一:检查客户端发送零轮往返的 Ticker 是否过期。方法二:检查客户端发送零轮往返的 Ticker 是否被使用。方法三:服务器只接受零轮往返幂等性的请求。方法四:添加 Early-Data 请求头,告知服务器此请求是早期数据请求,服务器根据实际情况判断是否接受早期数据。进过测试分析得出,方法一、方法二和方法四组合能达到最优效果,保证服务器能正常处理早期数据的同时不受零轮往返时长重放攻击的影响。 \ \\ - \textbf{关键词: }传输层协议;零轮往返时长;早期数据;重放攻击 + \ \\ + \zihao{-4} + {\heiti \bfseries 关键词:}\ \ 传输层协议;零轮往返时长;早期数据;重放攻击 \newpage \ No newline at end of file diff --git a/body/AEAD.tex b/body/AEAD.tex index 9cdd760..9309671 100644 --- a/body/AEAD.tex +++ b/body/AEAD.tex @@ -25,5 +25,4 @@ \subsection{对称加密算法} ChaCha20-Poly1305 避开了现有发现的所有安全漏洞和攻击; ChaCha20-Poly1305 针对移动端设备大量使用的ARM芯片做了优化,能够充分利用 ARM 向量指令,在移动设备上加解密速度更快、更省电;Poly1305 输出只有 16字节,更加节省带宽 -\afterpage{\null\newpage} \newpage \ No newline at end of file diff --git a/body/TLS1.3.tex b/body/TLS1.3.tex index 5b79961..3134aea 100644 --- a/body/TLS1.3.tex +++ b/body/TLS1.3.tex @@ -29,8 +29,6 @@ \section{实现简单传输层协议} 本次开发讲使用 HTML5、CSS3、JavaScript 等基本编程语言。HTML5 为我提供不少的浏览器接口,localStorage,Cookie 等存储方式,WebSocket 协议能使服务器主动推送消息到客户端,完成 TLS 1.3 握手功能。HTML5 为网页提供最基本骨架,页面的元素,让浏览器应用开发更加多样化,功能更强大的技术。各大浏览器支持情况良好。CSS3 作为 HTML5 的化妆师,提供页面美化和页面布局,样式化和排版前端网页,例如控制页面字体大小、颜色、间距等。CSS3选择器需要结合 HTML5 使用,在 HTML5 元素中使用对应的 CSS 选择器。JavaScript 是一种面向对象的动态语言,提供浏览器和用户进行页面交互的操作,是开发中的核心技术,在编程语言中排行前10。比较轻量级,插入到 HTML5 页面中,可以通过大多数浏览器解析执行。 - 服务器开发使用 Node.js,实际上它是对 Google Chrome V8 引擎进行了封装,它主要用于创建快速的、可扩展的网络应用。 Node.js 采用事件驱动和非阻塞I/O模型,使其变得轻量和高效。对比解析运行在 Chrome 浏览器上的 JavaScript 代码,Chrome 浏览器就是 JavaScript 代码的解析器,当 JavaScript 代码运行在服务器上时,Node.js 就是 JavaScript 代码的解析器,存在于服务器端的 JavaScript 代码由 Node.js 来解析和运行。JavaScript 解析器用于提供 JavaScript 代码运行的一种环境,浏览器是 JavaScript 运行的一种环境,不同的浏览器有不同的解析引擎,浏览器为 JavaScript 提供了操作文档对象模型和浏览器窗口对象等的接口。Node.js 是一个基于 Chrome V8引擎的 JavaScript 运行环境,提供了操作系统文件、创建 HTTP 服务、 创建 TCP/UDP 服务等的接口,Node.js 的包管理器 npm,是全球最大的开源库生态系统。 - \subsection{功能介绍} 实现握手协议,记录层协议。使用 WebSocket 交换客户端和服务器端的密钥参数,主要实现 AEAD 算法: AES-256-GCM, ChaCha20-Poly1305。HKDF\cite{RFC5869} 密钥导出算法。编程实现 FRC8446 中客户端和服务器端的状态机。完整的一轮往返握手和零轮往返,一轮往返握手为之后建立零轮往返建立基础,用于实现重放攻击。 @@ -57,4 +55,7 @@ \section{实现简单传输层协议} \item extensions: 拓展。TLS 1.3 版本中必须包含 supported\_versions 扩展 \end{enumerate} - 服务器参数和认证消息这里不展开详细说明。Certificate: 将证书链发送给对方,当约定的密钥交换方法是用证书进行认证的时候,服务器就必须发送 Certificate 消息,当且仅当客户端通过发送 CertificateRequest 消息请求认证客户端时,客户端必须发送 Certificate 消息,当客户端没有合适的证书时,必须发送不含证书的 Certificate 消息。Certificate Verify: 此消息用于证明发送方拥有其证书对应的私钥,必须在 Certificate 消息之后立即发送,并且紧接着在 Finished 消息之前。Finished: 提供握手和密钥的身份验证,Finished 消息的接受者必须验证内容是否正确,如果不正确,必须使用 decrypt\_error alert 消息终止连接。End of Early Data: 如果服务器在 EncryptedExtensions 中发送了 early\_data 扩展,则客户端必须在收到服务器的 Finished 消息后发送 EndOfEarlyData 消息。 \ No newline at end of file + 服务器参数和认证消息这里不展开详细说明。Certificate: 将证书链发送给对方,当约定的密钥交换方法是用证书进行认证的时候,服务器就必须发送 Certificate 消息,当且仅当客户端通过发送 CertificateRequest 消息请求认证客户端时,客户端必须发送 Certificate 消息,当客户端没有合适的证书时,必须发送不含证书的 Certificate 消息。Certificate Verify: 此消息用于证明发送方拥有其证书对应的私钥,必须在 Certificate 消息之后立即发送,并且紧接着在 Finished 消息之前。Finished: 提供握手和密钥的身份验证,Finished 消息的接受者必须验证内容是否正确,如果不正确,必须使用 decrypt\_error alert 消息终止连接。End of Early Data: 如果服务器在 EncryptedExtensions 中发送了 early\_data 扩展,则客户端必须在收到服务器的 Finished 消息后发送 EndOfEarlyData 消息。 + +\input{body/key/index} +\input{body/AEAD} \ No newline at end of file diff --git a/body/anti-replay.tex b/body/anti-replay.tex index 1ea5fa7..a9ff8eb 100644 --- a/body/anti-replay.tex +++ b/body/anti-replay.tex @@ -40,7 +40,6 @@ \subsection{防御零轮往返时长协议重放攻击} 通过共享数据库可以防止第二种攻击,以保证集群中的系统最多接受一次 0-RTT 数据,最多响应一次。使用 Ticker 共享,多个服务器使用同一个 Redis 数据库保存 Ticker,维护 Ticker 在分布式系统的的唯一性,群集中的服务器都将生成的 Ticker 保存到公共 Redis 数据库,统一维护 Ticker 唯一性和有效期。当集群中某一台服务器接收到 0-RTT 的时候,首先去查询数据库对应的 Ticker,如果是第一次发送并非重放攻击,并且此 Ticker 没有过期,下一步检查 Binder 的正确性。当攻击者重放 0-RTT 的时候,负载均衡会将请求分发都没个后台服务,当其中一个请求查询 Ticker 时候,可以设置锁定数据库,防止重复读取合法的 Ticker。 -\afterpage{\null\newpage} % 设置 max\_early\_data\_size 大小,以允许客户端发送指定大小的 early data % max\_early\_data\_size:使用此票证时允许客户端发送的最大0-RTT数据量(以字节为单位)。 仅计算应用数据有效载荷(即,明文但不填充或内部内容类型字节)。 接收超过max\_early\_data\_size字节的0-RTT数据的服务器应该使用“unexpected\_message”警报终止连接。 \ No newline at end of file diff --git a/body/index.tex b/body/index.tex index 25fde22..c912d25 100644 --- a/body/index.tex +++ b/body/index.tex @@ -1,7 +1,20 @@ -\input{body/introduction} -\input{body/TLS1.3} -\input{body/key/index} -\input{body/AEAD} -\input{body/analyze-0-RTT} -\input{body/test-result} -\input{body/conclusion} \ No newline at end of file +% 每一章都要重置图标计数 +\setcounter{figure}{0} +\setcounter{table}{0} +\include{body/introduction} + +\setcounter{figure}{0} +\setcounter{table}{0} +\include{body/TLS1.3} + +\setcounter{figure}{0} +\setcounter{table}{0} +\include{body/analyze-0-RTT} + +\setcounter{figure}{0} +\setcounter{table}{0} +\include{body/test-result} + +\setcounter{figure}{0} +\setcounter{table}{0} +\include{body/conclusion} \ No newline at end of file diff --git a/body/introduction.tex b/body/introduction.tex index 710cb03..c1543f3 100644 --- a/body/introduction.tex +++ b/body/introduction.tex @@ -4,23 +4,12 @@ \subsection{选题背景与意义} \label{sec:background} 安全传输层协议 (Transport Layer Security,下面简称 TLS ) 每天被全球数百万用户使用,作为互联网安全的核心构建块,不仅应用到浏览器的 HTTPS 协议中,还有其他应用层协议也使用了 TLS,比如 SSH、WSS 协议等。由于 TLS 1.2 及以下版本中的各种安全缺陷和设计缺陷\cite{7877537},\cite{8632026},会受到降级攻击、中间人攻击、BEAST 攻击、POODLE攻击等,最为严重的openssl心脏出血漏洞\cite{8001980},属于实现上的漏洞而不是协议上的漏洞,还有 TLS 1.2 的完整握手需要两轮往返时间,耗时长,即使使用会话恢复也需要一轮往返时间。 - 无论是基于实现还是基于规范,都促使 TLS 工作组在起草下一版协议时采用“部署前分析”设计范例\cite{7546518}。TLS 协议主要目标是在两个通信应用程序之间提供数据保密性和数据完整性。IETF( 国际互联网工程任务组)用了超过四年时间,起草了28份草案后,于2018年8月发布 TLS 1.3\cite{RFC8446} 最终版本(RCF 8446)。相比较于 TLS 1.2,TLS 1.3 删除未使用或者不安全的功能,并且加密了更多的握手信息,减少了握手延迟。TLS协议的主要目标是在通信双方提供安全信道,包括对服务器和客户端的身份验证,信道上传输数据的机密性,保证通信双方传输内容的完整性。非对称加密算法中:在 TLS 1.3 中密钥交换默认使用椭圆曲线加密法,删除静态 RSA 密钥交换。对称加密算法上:删除 CBC 模式密码、RC4 流密码,保证信息机密性和完整性使用 AEAD 算法\cite{RFC5166},是 TLS 1.3 中唯一保留的对称加密方式,只有 AES-GCM 和 ChaCha20-Poly1305 两种,更安全和难以破解。删除 SHA-1 哈希函数,哈希算法使用具有更长密钥的 SHA-2 哈希函数,其中包括 SHA-256 和 SHA-384。 - - 此外,TLS 1.3 使用新的 PSK 密钥协商。TLS 1.3 不仅在安全性上有提升,速度上也提升不少。TLS 1.3 相比较于 TLS 1.2 的两次往返才能建立连接的完整握手,针对 TLS 1.2 中两次往返耗时长,速度较慢比较慢,为了有更快是网络访问速度,TlS 1.3 完整握手使用了也减少到一次往返和会话恢复的零轮往返时长协议握手,大大提升连接速度,比 TLS 1.2 减少了一个握手往返,仅在传输层上速度将提升一倍。 - - 虽然 TLS 1.3 和零轮往返时长协议不能减少传输的往返延迟,但可以减少建立 HTTPS 连接所需的往返次数,从而减少握手花费的时间。有更快的握手速度固然是好,但同时不能忽略一些安全问题。利用 WebSocket 编程简单实现 TLS 协议,分析和重现 TLS 1.3 协议中 0—RTT 的重放攻击,并在后台服务器中实现抵抗重放攻击方法,测试抵抗重放攻击的实用性。 - \subsection{国内外研究现状和相关工作} \label{sec:related_work} 有关 TLS 1.3 的讨论,多数停留在非正式发布前\cite{7883842}\cite{ARTICLE_typical1}\cite{ARTICLE_typical}的草案,基于 DH 密钥交换的零轮往返时长协议,但在正式发布前已经删除,最终使用的是基于 PSK 的握手恢复。在国内,只能在期刊上阅读到少量关于 TLS 1.3 的文章,而且文章内容讲述过于简单,不够全面,关于 TLS 1.3 协议最重要的部分零轮往返时长协议没有更多讲解,国内知名通信软件微信,参考 TLS 1.3 实现的安全通信协议 MMTLS\cite{MMTLS},其中实现零轮往返时长协议,比较于 TLS 协议,MMTLS 协议由于微信客户端每个人可用,于是删除了客户端认证相关的功能,同时在微信客户端程序中内置服务器的签名公钥,握手中不在需要进行服务器认证,减少发送的流量,关于 MMTLS 抗重放攻击,根据微信特有的后台架构,提出了基于客户端和服务器端时间序列的防重放策略,保证超过时间的重放包能被服务器拒绝,通过由 Proxy 层和 Logic 框架协同控制。 支持 TLS 1.3的代码库,最广泛的当然有Openssl,Google 的 boringssl、guntls 等。国外相关工作,谷歌在基于 UDP 协议上实现的 QUIC Crypto 协议\cite{8280429}中首次实现了零轮往返时长协议,由于 QUIC 更早的使用零轮往返时长协议,实现的标准也提供给 TLS 1.3作为参考,但到了 TLS 1.3 正式版本发布,QUIC 反而会基于 TLS 1.3,并在以后的 HTTP/3.0 中使用,促进网络协议的发展。Facebook 使用 C++14 标准实现强大,高性能的 TLS 库,代码库命名为 Fizz,在 QUIC 基础改做出改动,在手机 APP 上实现零轮往返,实现更快的连接速度,并且有效地处理安全性问题,实现部署零轮往返时长协议,发现建立连接所需的时间降低了 41\%。 - 在密钥交换的同时减少延迟开销已成为学术界和工业界的密钥交换)(key exchange, KE)协议的主要设计目标。在这方面特别感兴趣的是零轮往返时长协议,其允许客户端在零往返时间中发送加密数据,从而最小化等待时间。比如 Google 的 QUIC 协议和 TLS 1.3。零轮往返密钥交换的主要挑战是为协议中发送的第一个加密数据,称为早期数据,实现前向保密和防止重放攻击的安全性。有不少说法称不可能为此消息实现前向保密,因为用于加密早期数据的密钥必须依赖于接收者的非短暂密钥。如果接收者的非密钥在以后泄露给攻击者,攻击者应该可以执行与实际会话中的接收者相同的计算来计算会话密钥。 - - 在相关研究中,表明不能为早期数据提供前向保密性是错误的想法。研究人员构建了第一个零轮往返时长协议,利用一种可穿透的密钥封装方案,它为所有传输的有效负载消息提供完全的前向保密,并自动适应重放攻击。 - 由于在没有先前连接的信息的情况下,是不可能在 0-RTT 中进行身份验证和建立加密密钥,因此 0-RTT 密钥交换协议必须利用在某些先前通信中获得的密钥材料来建立0-RTT密钥。在早期版本的 QUIC 中使用的一种非常常见的方法是基于 DH 密钥交换,但在正式发布的 TLS 1.3 中采用的是从预共享对称密钥(PSK)中导出 0-RTT 密钥。 - \subsection{研究内容及主要贡献} 分析 TLS 1.3 协议,利用 WebSocket 简单实现握手协议和记录层协议,重现 TLS 1.3 中 0-RTT 的重放攻击。实现对抗 0-RTT 重放的方法并测试效果。得到以下结果: @@ -44,5 +33,7 @@ \subsection{论文章节安排} 第五章总结与展望 -\afterpage{\null\newpage} +这是一个与本文无关的table,只是为了方便后来人参考: +\input{body/table} + \newpage \ No newline at end of file diff --git a/body/table.tex b/body/table.tex new file mode 100644 index 0000000..100cea5 --- /dev/null +++ b/body/table.tex @@ -0,0 +1,36 @@ +\begin{table}[H] + \caption{\label{analysis:user_privilege:table}模块中用户的权限设置} + \centering + \begin{tabular}{*{5}{|l}|} + \toprule + 模块&操作&管理员&课程教师&课程学生 \\ \hline + \midrule + \multirow{5}{*}{用户模块}&登入\/退出&是&是&是 \\ + &创建用户&是&否&否 \\ + &删除用户&是&否&否 \\ + &更新用户信息&是&是&是 \\ + &登陆后台&是&是&否 \\ + \midrule + + \multirow{4}{*}{课程模块}&创建课程&是&是&是 \\ + &删除课程&是&是&否 \\ + &修改课程信息&是&是&否 \\ + &查看、修改学生列表&是&是&否 \\ + \midrule + + \multirow{4}{*}{任务模块}&查看任务信息&是&是&是 \\ + &修改任务信息&是&是&否 \\ + &查看、修改提交&是&是&是 \\ + &提交评价&是&是&否 \\ + \midrule + + 文件模块&上传、下载提交的文件&是&是&是 \\ + \midrule + + \multirow{3}{*}{镜像模块}&查看、修改镜像&是&是&否 \\ + &审核镜像&是&否&否 \\ + &启动镜像实例&是&是&是 \\ + \bottomrule + \end{tabular} + +\end{table} \ No newline at end of file diff --git a/cover/image.tex b/cover/image.tex index 3b9ddf4..af5d987 100644 --- a/cover/image.tex +++ b/cover/image.tex @@ -22,14 +22,14 @@ \setlength\extrarowheight{10pt} \centering \begin{tabular}{lc} - \multicolumn{1}{c}{\textbf{论文题目:\ }} & \textbf{短的论文题目一行} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{}} & \textbf{长的论文题目两行} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{指导老师:\ }} & \textbf{指导老师} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{学生姓名:}} & \textbf{你的名字} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{学\hspace{\fill}号:}} & \textbf{20152100001} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{学\hspace{\fill}院:}} & \textbf{计算机学院} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{专\hspace{\fill}业:}} & \textbf{网络工程} \\ \cline{2-2} - \multicolumn{1}{c}{\textbf{班\hspace{\fill}级:}} & \textbf{网络工程7班} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{论文题目:\ }} & \textbf{ABC} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{}} & \textbf{长的论文题目两行} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{指导老师:\ }} & \textbf{Prof} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{学生姓名:\ }} & \textbf{Name} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{学\hspace{\fill}号:}} & \textbf{20172121001} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{学\hspace{\fill}院:}} & \textbf{计算机学院} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{专\hspace{\fill}业:}} & \textbf{网络工程} \\ \cline{2-2} + \multicolumn{1}{c}{\textbf{毕业时间:\ }} & \textbf{2021.7} \\ \cline{2-2} \end{tabular} \end{table} diff --git a/main.cls b/main.cls index 31fa848..86f385e 100644 --- a/main.cls +++ b/main.cls @@ -1,9 +1,9 @@ % 定义包名 \ProvidesClass{main} \LoadClass[a4paper]{article} + \RequirePackage[heading]{ctex} % Required for the Chinese and the corresponding section setting \RequirePackage[includeheadfoot]{geometry} % Required for the Word-like page -\geometry{top=1.5cm,bottom=1.75cm,left=30mm,right=30mm} % 上下左右的留白 \RequirePackage{fancyhdr} % Required for custom headers \RequirePackage{setspace} % Required for the space setting \RequirePackage{titlesec} % Required for the Chapter & Section fonts adjustment @@ -20,7 +20,6 @@ \RequirePackage{listings} % Required for insertion of code \RequirePackage{indentfirst} % Required for the indent before each paragraph \RequirePackage{fontspec} -\setmainfont{Times New Roman} \RequirePackage{hyperref} \RequirePackage{url} \RequirePackage{cite} % Required for the ref and cite @@ -29,29 +28,38 @@ \RequirePackage[font=footnotesize,tableposition=top]{caption} % Required for the footnote size captions of figures and tables \RequirePackage{xcolor} \RequirePackage[nottoc]{tocbibind} +\RequirePackage{afterpage} +\RequirePackage{enumitem} +\RequirePackage{stmaryrd} % 数学符号的包 +\RequirePackage{bm} % Required for the bold in math display +\RequirePackage{amsmath} % Required for the math display +\RequirePackage{amssymb} % Required for the math display +\RequirePackage{amsbsy} % Required for the math display +\RequirePackage{cancel} % Required for the cancel symbol in math display +\RequirePackage{amsthm} % Required for the theorem edition +\RequirePackage{array} % Required for the array in math display +\RequirePackage{ifthen} % Required for the conditional commands + +% 上下左右的留白 +\geometry{ + top=2.5cm, + bottom=2.5cm, + left=2cm, + right=2cm +} + \lstset{ columns=flexible,lineskip=-3pt, basicstyle=\small\ttfamily, } % 正文前的空白页 % 使用 \afterpage{\blankpage} 正文中的空白页 \afterpage{\null\newpage} -\RequirePackage{afterpage} \newcommand\blankpage{ \null \thispagestyle{empty} \addtocounter{page}{-1} \newpage } -\RequirePackage{enumitem} -\RequirePackage{stmaryrd} % 数学符号的包 -\RequirePackage{bm} % Required for the bold in math display -\RequirePackage{amsmath} % Required for the math display -\RequirePackage{amssymb} % Required for the math display -\RequirePackage{amsbsy} % Required for the math display -\RequirePackage{cancel} % Required for the cancel symbol in math display -\RequirePackage{amsthm} % Required for the theorem edition -\RequirePackage{array} % Required for the array in math display -\RequirePackage{ifthen} % Required for the conditional commands \newcommand{\ud}{\mathrm{d}} \makeatletter \@addtoreset{equation}{section} @@ -59,20 +67,21 @@ \renewcommand{\theequation}{\arabic{section}.\arabic{equation}} -\ctexset { section = { name={第,章},number={\chinese {section}},format={\centering \zihao {-2}\bfseries } } } -\titleformat{\subsection}{\zihao{-3}\bfseries}{\thesubsection}{1em}{} -\titleformat{\subsubsection}{\zihao{4}\bfseries}{\thesubsubsection}{1em}{} -\ctexset { paragraph = { ,format={\raggedright \bfseries \zihao {-4}} } } +\ctexset { + section = { + format={\centering \zihao {-2}\bfseries \heiti}, + }, + paragraph = { + format={\raggedright \bfseries \zihao{-4}} + } +} +\titlespacing{\section}{0em}{3em}{3em} -\renewcommand\contentsname{目\quad\quad 录} % Setup contents -\titlecontents{section}[0em]{\zihao{4}\bfseries}{\contentspush{\thecontentslabel \hspace{0.7em}}} - {}{\titlerule*[5pt]{.}\contentspage} -\titlecontents{subsection}[2.2em]{\zihao{-4}\songti}{\contentspush{\thecontentslabel\hspace{0.7em}}} - {}{\titlerule*[5pt]{.}\contentspage} -\titlecontents{subsubsection}[3.9em]{\zihao{-4}\songti}{\contentspush{\thecontentslabel\hspace{0.7em}}} - {}{\titlerule*[5pt]{.}\contentspage} -\titlespacing*{\subsection} {0pt}{1ex}{1ex} % Adjust the space between title and context -\titlespacing*{\subsubsection} {0pt}{1ex}{1ex} +% Equivalent to above +\titleformat{\subsection}{\zihao{4}\bfseries \heiti}{\thesubsection}{1em}{}[] +\titlespacing{\subsection}{0em}{3em}{0em} +\titleformat{\subsubsection}{\zihao{-4}\bfseries \heiti}{\thesubsubsection}{1em}{}[] +\titlespacing{\subsubsection}{0em}{3em}{0em} % 页头页尾设置 \newcommand{\thesistitlefancyhead}{论文题目设置为页眉} % 定义论文题目为页眉 @@ -80,4 +89,8 @@ \fancyhf{} \fancyhead{} \fancyhead[C]{\thesistitlefancyhead{}} % 页眉设置为论文标题 -\fancyfoot[C]{\thepage} \ No newline at end of file +\fancyfoot[C]{\thepage} + +% 图标显示格式:图/表 -: +\renewcommand{\thefigure}{\thesection-\arabic{figure}} +\renewcommand{\thetable}{\thesection-\arabic{table}} \ No newline at end of file diff --git a/main.pdf b/main.pdf index bd6cb20..f4bc3af 100644 Binary files a/main.pdf and b/main.pdf differ diff --git a/main.tex b/main.tex index 81b176d..1d509bc 100644 --- a/main.tex +++ b/main.tex @@ -2,6 +2,8 @@ % XeTeX 3.14159265-2.6-0.99999 (TeX Live 2018) \documentclass{main} +\setmainfont{Times New Roman} + \begin{document} \input{cover/image} % 封面 diff --git a/requirements/requirements_checklist.md b/requirements/requirements_checklist.md new file mode 100644 index 0000000..e6653e2 --- /dev/null +++ b/requirements/requirements_checklist.md @@ -0,0 +1,36 @@ +Checklist +- [ ] 摘要 + - [ ] 字数:200-400 + - [ ] 摘要与关键词隔开一行 + - [ ] `关键词:`(小四黑体) + - [ ] 关键词要求 + - [ ] 左对齐 + - [ ] 空两个字符后再是关键词 + - [ ] 关键词之间分号,最后一个没有 + - [ ] 英文使用Times New Roman,中文主体用宋体,五号 +- [ ] 目录 + - [ ] 英文TNR,中文宋体,五号 + - [ ] 1.5倍行距 +- [ ] 正文 + - [ ] 正文 + - [ ] 英文TNR,中文宋体,小四 + - [ ] 1.5倍行距 + - [ ] 一级标题 + - [ ] 小二号黑体居中 + - [ ] 段前段后空 1 行 + - [ ] 标号后空 1 格 + - [ ] 二级标题 + - [ ] 四号黑体左起顶格 + - [ ] 段前空 1 行 + - [ ] 标号后空 2 格 + - [ ] 三级标题 + - [ ] 小四号黑体左起顶格 + - [ ] 段前空 1 行 + - [ ] 标号后空 2 格 +- [ ] 参考目录 & 附录 + - [ ] 英文TNR,中文宋体,五号 + - [ ] 1.5倍行距 + - [ ] 空行为25磅 +- [ ] 致谢 + - [ ] 英文TNR,中文宋体,小四 + - [ ] 1.5倍行距 \ No newline at end of file diff --git "a/requirements/\345\215\216\345\270\2102015\350\256\272\346\226\207\350\246\201\346\261\202.docx" "b/requirements/\345\215\216\345\270\2102015\350\256\272\346\226\207\350\246\201\346\261\202.docx" new file mode 100644 index 0000000..fdb5d3f Binary files /dev/null and "b/requirements/\345\215\216\345\270\2102015\350\256\272\346\226\207\350\246\201\346\261\202.docx" differ diff --git "a/requirements/\350\256\241\347\256\227\346\234\272\345\255\246\351\231\242\346\257\225\344\270\232\350\256\272\346\226\207\350\257\204\345\256\232\347\273\206\345\210\231\344\270\216\350\247\204\345\256\232.pdf" "b/requirements/\350\256\241\347\256\227\346\234\272\345\255\246\351\231\242\346\257\225\344\270\232\350\256\272\346\226\207\350\257\204\345\256\232\347\273\206\345\210\231\344\270\216\350\247\204\345\256\232.pdf" new file mode 100755 index 0000000..b08e334 Binary files /dev/null and "b/requirements/\350\256\241\347\256\227\346\234\272\345\255\246\351\231\242\346\257\225\344\270\232\350\256\272\346\226\207\350\257\204\345\256\232\347\273\206\345\210\231\344\270\216\350\247\204\345\256\232.pdf" differ