HDU-Bachelor-Thesis.cls 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. % !TEX encoding = UTF-8 Unicode
  2. % !TEX TS-program = xelatex
  3. % !BIB program = biber
  4. % MIT License
  5. %
  6. % Copyright (c) 2019 Star Brilliant
  7. %
  8. % Permission is hereby granted, free of charge, to any person obtaining a copy
  9. % of this software and associated documentation files (the "Software"), to deal
  10. % in the Software without restriction, including without limitation the rights
  11. % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. % copies of the Software, and to permit persons to whom the Software is
  13. % furnished to do so, subject to the following conditions:
  14. %
  15. % The above copyright notice and this permission notice shall be included in
  16. % all copies or substantial portions of the Software.
  17. %
  18. % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  24. % SOFTWARE.
  25. \NeedsTeXFormat{LaTeX2e}
  26. \ProvidesClass{HDU-Bachelor-Thesis}[2019/05/17 Bachelor thesis template for Hangzhou Dianzi University]
  27. % 防止 fontspec 与 mathspec 冲突
  28. \PassOptionsToPackage{no-math}{fontspec}
  29. % 启用 GB/T 7714-2015 参考文献格式
  30. % 需要安装 biblatex-gb7714-2015
  31. \PassOptionsToPackage{backend=biber,style=gb7714-2015}{biblatex}
  32. % 调用基类 CTeX Article
  33. \LoadClass[fontset=none,zihao=-4]{ctexart}
  34. % 尺寸运算功能
  35. \RequirePackage{calc}
  36. % 设置题注格式
  37. \RequirePackage{caption}
  38. % 使用 T1 字体编码
  39. \RequirePackage[T1]{fontenc}
  40. % 设置字体
  41. \RequirePackage[no-math]{fontspec}
  42. % 设置带圈角标
  43. \RequirePackage[stable,perpage,symbol*]{footmisc}
  44. % 页边距设置
  45. \RequirePackage{geometry}
  46. % 启用 PDF 超链接
  47. \RequirePackage{hyperref}
  48. % 小标题排版
  49. \RequirePackage[pagestyles]{titlesec}
  50. % 目录排版
  51. \RequirePackage{titletoc}
  52. % xeCJK 中文支持包
  53. \RequirePackage{xeCJK}
  54. % 超链接格式设置
  55. \hypersetup{unicode=true,hidelinks,linktoc=all}
  56. % 页边距设置
  57. \geometry{a4paper,top=3cm,bottom=2cm,left=4cm,right=2cm,headheight=10.5bp,headsep=1cm-10.5bp,footskip=1cm-2.953125bp}
  58. % 设置英文字体为 TeX Gyre 系列字体为 TeX Gyre Termes / Heros / Cursor,它们兼容 Times / Helvetica / Courier
  59. \setromanfont{texgyretermes-regular.otf}[BoldFont=texgyretermes-bold.otf,BoldItalicFont=texgyretermes-bolditalic.otf,ItalicFont=texgyretermes-italic.otf]
  60. \setsansfont{texgyreheros-regular.otf}[BoldFont=texgyreheros-bold.otf,BoldItalicFont=texgyreheros-bolditalic.otf,ItalicFont=texgyreheros-italic.otf]
  61. \setmonofont{texgyrecursor-regular.otf}[BoldFont=texgyrecursor-bold.otf,BoldItalicFont=texgyrecursor-bolditalic.otf,ItalicFont=texgyrecursor-italic.otf,Ligatures=NoCommon]
  62. % 设置中文字体为中易系列字体,如果在非 Microsoft Windows 环境下使用,可能需要安装这些字体
  63. \newfontfamily{\HDU@SimSun}{SimSun}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  64. \newfontfamily{\HDU@SimHei}{SimHei}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  65. \newfontfamily{\HDU@SimKai}{KaiTi}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  66. \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  67. \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  68. \setCJKfamilyfont{zhfang}{FangSong}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  69. \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=1.5,AutoFakeSlant=0.25]
  70. \setCJKromanfont{SimSun}[AutoFakeBold=1.5,ItalicFont={FangSong}]
  71. \setCJKsansfont{SimHei}[AutoFakeBold=1.5,ItalicFont={KaiTi}]
  72. \setCJKmonofont{FangSong}[AutoFakeBold=1.5,ItalicFont={FangSong}]
  73. % 关掉 CTeX 的 1.3 倍行距
  74. \linespread{1}
  75. % 关掉 0pt-1pt 的弹性段间距
  76. \setlength{\parskip}{0pt}
  77. % 设置各种字号
  78. \renewcommand{\tiny}{\fontsize{6.5bp}{8.328125bp}\selectfont}
  79. \renewcommand{\scriptsize}{\fontsize{7.5bp}{9.609375bp}\selectfont}
  80. \renewcommand{\footnotesize}{\fontsize{9bp}{11.53125bp}\selectfont}
  81. \renewcommand{\small}{\fontsize{10.5bp}{13.453125bp}\selectfont}
  82. \renewcommand{\normalsize}{\fontsize{12bp}{20bp}\selectfont}
  83. \renewcommand{\large}{\fontsize{15bp}{20bp}\selectfont}
  84. \renewcommand{\Large}{\fontsize{18bp}{23.0625bp}\selectfont}
  85. \renewcommand{\LARGE}{\fontsize{22bp}{28.1875bp}\selectfont}
  86. \renewcommand{\huge}{\fontsize{24bp}{30.75bp}\selectfont}
  87. \renewcommand{\Huge}{\fontsize{26bp}{33.3125bp}\selectfont}
  88. % 设置题注格式
  89. \captionsetup{font=small}
  90. % 设置页眉页脚
  91. % 可以 \HDUheader{文字} 来改变页眉内容
  92. \newcommand{\HDU@header}{杭州电子科技大学本科毕业设计}
  93. \newcommand{\HDUheader}[1]{\renewcommand{\HDU@header}{#1}}
  94. % 使用 \pagestyle{HDU-Bachelor} 来调用这个格式
  95. \newpagestyle{HDU-bachelor}[\fontsize{10.5bp}{13.453125bp}\selectfont]{%
  96. \sethead{}{\HDU@header{}}{}%
  97. \renewcommand{\makeheadrule}{\rule[-4.75bp]{\linewidth}{.75bp}}%
  98. \setfoot{}{\thepage}{}%
  99. }
  100. % 使用 \pagestyle{HDU-bachelor-empty} 来关闭页码
  101. \newpagestyle{HDU-bachelor-empty}[\fontsize{10.5bp}{13.453125bp}\selectfont]{%
  102. \sethead{}{\HDU@header{}}{}%
  103. \renewcommand{\makeheadrule}{\rule[-4.75bp]{\linewidth}{.75bp}}%
  104. \setfoot{}{}{}%
  105. }
  106. % 定义 \unnumberedsection 命令,用以方便地加入一个无标号的小标题
  107. \newcommand{\unnumberedsection}[1]{\phantomsection\addcontentsline{toc}{section}{#1}\section*}
  108. % 设置一、二、三级小标题格式
  109. \titleformat{\section}{\filcenter\rmfamily\CJKfamily{zhhei}\fontsize{16bp}{20.5bp}\selectfont\vspace{\topskip}\vspace*{-\topskip}\vspace*{25bp}}{\thesection}{1em}{}
  110. \titlespacing{\section}{0bp}{0bp}{25bp}
  111. \titleformat{\subsection}{\sffamily\fontsize{14bp}{20bp}\selectfont}{\thesubsection}{1em}{}
  112. \titlespacing{\subsection}{0bp}{0bp}{0bp}
  113. \titleformat{\subsubsection}{\sffamily\fontsize{12bp}{20bp}\selectfont}{\thesubsubsection}{1em}{}
  114. \titlespacing{\subsubsection}{0bp}{0bp}{0bp}
  115. % 设置目录格式
  116. \renewcommand{\contentsname}{目\hspace{2em}录}
  117. \contentsmargin{0bp}
  118. \titlecontents{section}[0em]{}{\thecontentslabel\hspace{1em}}{}{\titlerule*[0.25em]{.}\thecontentspage}
  119. \titlecontents{subsection}[2em]{}{\thecontentslabel\hspace{1em}}{}{\titlerule*[0.25em]{.}\thecontentspage}
  120. \titlecontents{subsubsection}[4em]{}{\thecontentslabel\hspace{1em}}{}{\titlerule*[0.25em]{.}\thecontentspage}
  121. % 设置参考文献格式
  122. \newlength{\bibitemsep}
  123. \AtBeginDocument{\setlength{\bibitemsep}{0pt}}
  124. % 设置 \autoref 格式
  125. \def\figureautorefname{图}%
  126. \def\tableautorefname{表}%
  127. \def\partautorefname{篇}%
  128. \def\appendixautorefname{附录}%
  129. \def\equationautorefname{公式}%
  130. \def\Itemautorefname{项目}%
  131. \def\chapterautorefname{章}%
  132. \def\sectionautorefname{节}%
  133. \def\subsectionautorefname{小节}%
  134. \def\subsubsectionautorefname{子小节}%
  135. \def\paragraphautorefname{段落}%
  136. \def\subparagraphautorefname{子段落}%
  137. \def\Hfootnoteautorefname{脚注}%
  138. \def\AMSautorefname{公式}%
  139. \def\theoremautorefname{定理}%
  140. \def\pageautorefname{页面}%
  141. % 设置带圈角标
  142. % 感谢南京大学计算机科学与技术系胡海星编写的《NJU-Thesis:南京大学学位论文 XeLaTeX 模板》
  143. \DefineFNsymbols*{circlednumber}[text]{{①}{②}{③}{④}{⑤}{⑥}{⑦}{⑧}{⑨}{⑩}{⑪}{⑫}{⑬}{⑭}{⑮}{⑯}{⑰}{⑱}{⑲}{⑳}{㉑}{㉒}{㉓}{㉔}{㉕}{㉖}{㉗}{㉘}{㉙}{㉚}{㉛}{㉜}{㉝}{㉞}{㉟}{㊱}{㊲}{㊳}{㊴}{㊵}{㊶}{㊷}{㊸}{㊹}{㊺}{㊻}{㊼}{㊽}{㊾}{㊿}}
  144. \setfnsymbol{circlednumber}
  145. % 修复带圈数字可能无法正确显示的问题
  146. \xeCJKDeclareCharClass{CJK}{`⓪,`①->`⑳,`㉑->`㉟,`㊱->`㊿,`⓿,`❶->`❿,`⓫->`⓴}
  147. % PDF 元数据设置
  148. \AtBeginDocument{\hypersetup{pdfinfo={
  149. Author={\@author},
  150. Title={\@title},
  151. CreationDate={D:20000101000000} % 随手抹除文件创建时间
  152. }}}
  153. % 生成封面,可以配置的参数包括:
  154. % \title{题目}
  155. % \author{学生姓名}
  156. % \HDUyear{届次(年)}
  157. % \HDUschool{学院}
  158. % \HDUmajor{专业}
  159. % \HDUclassid{班级号码}
  160. % \HDUstudentid{学号}
  161. % \HDUadviser{指导教师}
  162. % \HDUfinishdate{完成日期(年月)}
  163. % \HDUsigndate{诚信承诺签署日期(年月日)}
  164. \newcommand{\HDU@year}{\the\year{}}
  165. \newcommand{\HDU@school}{}
  166. \newcommand{\HDU@major}{}
  167. \newcommand{\HDU@classid}{}
  168. \newcommand{\HDU@studentid}{}
  169. \newcommand{\HDU@adviser}{}
  170. \newcommand{\HDU@finishdate}{\the\year{} 年 \the\month{} 月}
  171. \newcommand{\HDU@signdate}{\the\year{} 年 \the\month{} 月 \the\day{} 日}
  172. \newcommand{\HDUyear}[1]{\renewcommand{\HDU@year}{#1}}
  173. \newcommand{\HDUschool}[1]{\renewcommand{\HDU@school}{#1}}
  174. \newcommand{\HDUmajor}[1]{\renewcommand{\HDU@major}{#1}}
  175. \newcommand{\HDUclassid}[1]{\renewcommand{\HDU@classid}{#1}}
  176. \newcommand{\HDUstudentid}[1]{\renewcommand{\HDU@studentid}{#1}}
  177. \newcommand{\HDUadviser}[1]{\renewcommand{\HDU@adviser}{#1}}
  178. \newcommand{\HDUfinishdate}[1]{\renewcommand{\HDU@finishdate}{#1}}
  179. \newcommand{\HDUsigndate}[1]{\renewcommand{\HDU@signdate}{#1}}
  180. \renewcommand{\maketitle}{%
  181. \clearpage\thispagestyle{empty}%
  182. \par\noindent\parbox[t]{15cm}{%
  183. \vspace{\topskip}\vspace*{-\topskip}%
  184. \HDU@SimSun\CJKfamily{zhsong}\fontsize{12bp}{0bp}\selectfont%
  185. \vspace*{23.5bp}\parbox[t][39.75bp][t]{13cm}{\centering\includegraphics[width=278.25bp,height=39.75bp]{HDU-Logo/transparent.png}}%
  186. \vspace{27.875bp}\hspace*{1.75bp}\parbox[t][40bp][t]{360.5bp}{\fontsize{40bp}{51.25bp}\selectfont\bfseries 本\hspace{\fill}科\hspace{\fill}毕\hspace{\fill}业\hspace{\fill}设\hspace{\fill}计}%
  187. \vspace{25.25bp}\parbox[t][22bp][t]{13cm}{\centering\fontsize{22bp}{28.1875bp}\bfseries ({\HDU@year}\hspace{0.25em}届)}%
  188. \vspace{60.625bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 题\hspace{\fill}目}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\sffamily\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\@title}}%
  189. \vspace{5.25bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  190. \vspace{25.75bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 学\hspace{\fill}院}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\sffamily\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\HDU@school}}%
  191. \vspace{5.5bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  192. \vspace{25.75bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 专\hspace{\fill}业}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\sffamily\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\HDU@major}}%
  193. \vspace{5.625bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  194. \vspace{25.75bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 班\hspace{\fill}级}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\HDU@SimKai\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\HDU@classid}}%
  195. \vspace{5.5bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  196. \vspace{25.625bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 学\hspace{\fill}号}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\HDU@SimKai\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\HDU@studentid}}%
  197. \vspace{5.5bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  198. \vspace{25.75bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 学\hspace{\fill}生\hspace{\fill}姓\hspace{\fill}名}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\sffamily\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\@author}}%
  199. \vspace{5.75bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  200. \vspace{25.75bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 指\hspace{\fill}导\hspace{\fill}教\hspace{\fill}师}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\sffamily\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\HDU@adviser}}%
  201. \vspace{5.5bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  202. \vspace{25.75bp}\hspace*{23bp}\parbox[t][15bp][t]{60bp}{\fontsize{15bp}{19.21875bp}\selectfont\bfseries 完\hspace{\fill}成\hspace{\fill}日\hspace{\fill}期}\hspace{12bp}\parbox[b][15bp][b]{262.5bp}{\centering\HDU@SimKai\CJKfamily{zhkai}\fontsize{15bp}{19.21875bp}\selectfont{\HDU@finishdate}}%
  203. \vspace{5.5bp}\hspace*{95bp}\rule[0pt]{262.5bp}{0.5bp}%
  204. \vspace{\fill}%
  205. }%
  206. \clearpage\thispagestyle{empty}%
  207. \par\noindent\parbox[t]{15cm}{
  208. \vspace{\topskip}\vspace*{-\topskip}%
  209. \HDU@SimSun\CJKfamily{zhsong}\fontsize{12bp}{0bp}\selectfont%
  210. \vspace*{85.25bp}\parbox[t][18bp][t]{13cm}{\centering\sffamily\CJKfamily{zhhei}\fontsize{18bp}{23.0625bp}\selectfont\bfseries 诚\hspace{0.5em}信\hspace{0.5em}承\hspace{0.5em}诺}%
  211. \vspace{40.625bp}\hspace{-1cm}\parbox[t]{15cm}{\rmfamily\fontsize{14bp}{35bp}\selectfont\leavevmode{\parindent=2em\indent}我谨在此承诺:本人所写的毕业论文《{\@title}》均系本人独立完成,没有抄袭行为,凡涉及其他作者的观点和材料,均作了注释,若有不实,后果由本人承担。}%
  212. \vspace{55.375bp}
  213. \parbox[t][15bp][t]{\textwidth}{\sffamily\CJKfamily{zhhei}\fontsize{15bp}{35bp}\selectfont\hspace*{182.5bp}\bfseries 承诺人(签名):}%
  214. \vspace{18.875bp}
  215. \parbox[t][15bp][t]{\textwidth}{\HDU@SimHei\CJKfamily{zhhei}\fontsize{15bp}{35bp}\selectfont\hspace*{194.75bp}\bfseries{\HDU@signdate}}%
  216. \vspace{\fill}%
  217. }%
  218. \clearpage%
  219. }
  220. % 启用页眉页脚
  221. \AtBeginDocument{\pagestyle{HDU-bachelor}}