|
20 | 20 | %<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
21 | 21 | %<book>\ProvidesClass{bitbook} |
22 | 22 | %<article>\ProvidesClass{bitart} |
23 | | -%<cls> [2021/01/06 v1.0.1 BIT Thesis Templates] |
| 23 | +%<cls> [2021/09/07 v1.1.0 BIT Thesis Templates] |
24 | 24 | % |
25 | 25 | %<*driver> |
26 | | -\ProvidesFile{bithesis.dtx}[2021/01/06 1.0.1 BIT Thesis Templates] |
| 26 | +\ProvidesFile{bithesis.dtx}[2021/09/07 1.1.0 BIT Thesis Templates] |
27 | 27 | \documentclass{ltxdoc} |
28 | 28 | \usepackage{dtx-style} |
29 | 29 |
|
|
126 | 126 | % \item 在此期间,冯开宇将原来的 .tex 文件制作成了宏包,并发布到 CTAN 上。 |
127 | 127 | % \item 项目代码也随之被拆分成了 \BIThesisMacroPackage,\BIThesisWiki 和 \BIThesisScaffold。 |
128 | 128 | % \end{itemize} |
| 129 | +% \item 2021 - 2022 年,2021 级(硕士研究生)的冯开宇针对 2021 年毕业季收到的反馈对该项目进行维护升级(前向兼容)。 |
129 | 130 | % \end{itemize} |
130 | 131 | % \subsection{\BIThesis 是什么?} |
131 | 132 | % \BIThesis 之名是英文单词 Beijing Institution of Technology(北京理工大学)的首字母缩写“BIT” 与“Thesis”结合而成。在纯文本环境下,该名字应写作“BIThesis”。 |
|
203 | 204 | % \end{macrocode} |
204 | 205 | % \begin{macrocode} |
205 | 206 |
|
| 207 | +% 目前只有本科的模板,但仍旧要为可能预留空间。 |
206 | 208 | \newif\if@bit@bachelor |
| 209 | +\newif\if@bit@docTranslation |
207 | 210 | \newif\if@bit@master |
208 | 211 | \newif\if@bit@docter |
209 | 212 |
|
| 213 | +\RequirePackage{kvoptions} |
| 214 | + |
| 215 | +\SetupKeyvalOptions{ |
| 216 | + family=BIThesis, |
| 217 | + prefix=BIThesis@ |
| 218 | +} |
| 219 | + |
| 220 | +\DeclareStringOption[14pt]{footskip} |
| 221 | +\DeclareBoolOption{titleNumberHeiti} |
| 222 | +\ProcessKeyvalOptions* |
| 223 | + |
| 224 | + |
210 | 225 | \DeclareOption{bachelor}{\@bit@bachelortrue} |
| 226 | +\DeclareOption{translation}{\@bit@docTranslationtrue} |
211 | 227 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}} |
| 228 | + |
212 | 229 | \ExecuteOptions{bachelor} |
213 | 230 |
|
214 | 231 | \ProcessOptions\relax |
215 | 232 |
|
| 233 | + |
216 | 234 | \LoadClass[UTF8,AutoFakeBold,AutoFakeSlant,zihao=-4,oneside,openany]{ctexbook} |
217 | 235 |
|
218 | 236 | \RequirePackage[a4paper,left=3cm,right=2.6cm,top=3.5cm,bottom=2.9cm]{geometry} |
|
236 | 254 | \RequirePackage{amsmath} |
237 | 255 | \RequirePackage{amssymb} |
238 | 256 | \RequirePackage{pdfpages} |
| 257 | +\RequirePackage{listings} |
| 258 | + |
| 259 | +%\PackageError{zzzz}{Main \BIThesis@footskip hellp}{test} |
239 | 260 |
|
240 | 261 | % 设置参考文献编译后端为 biber,引用格式为 GB/T7714-2015 格式 |
241 | 262 | % 参考文献使用宏包见 https://github.com/hushidong/biblatex-gb7714-2015 |
|
260 | 281 | \setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]{[STXIHEI.TTF]} % 若希望使用本机字体,也可以用 {STXihei} 来调用 |
261 | 282 | \newcommand{\xihei}{\CJKfamily{xihei}} |
262 | 283 |
|
| 284 | +\ifBIThesis@titleNumberHeiti |
| 285 | + \newcommand{\arabicHeiti}[1]{\xeCJKsetup{CJKspace=true}\xeCJKDeclareCharClass{CJK}{`0 -> `9}{\heiti\raisebox{-0.1ex}{#1}}\normalspacedchars{0,1,2,3,4,5,6,7,8,9}\xeCJKsetup{CJKspace=false}} |
| 286 | +\else |
| 287 | + \newcommand{\arabicHeiti}[1]{#1} |
| 288 | +\fi |
| 289 | + |
263 | 290 |
|
264 | 291 |
|
265 | 292 | % 主题页面格式:BIThesis |
266 | 293 | \fancypagestyle{BIThesis}{ |
267 | 294 | % 页眉高度 |
268 | 295 | \setlength{\headheight}{20pt} |
269 | 296 | % 页码高度(不完美,比规定稍微靠下 2mm) |
270 | | - \setlength{\footskip}{14pt} |
| 297 | + \setlength{\footskip}{\BIThesis@footskip} |
271 | 298 |
|
272 | 299 | \fancyhf{} |
273 | 300 | % 定义页眉、页码 |
|
277 | 304 | \renewcommand{\headrulewidth}{0.6pt} |
278 | 305 | } |
279 | 306 |
|
| 307 | +\if@bit@docTranslation |
| 308 | +% 主题页面格式:BIThesis |
| 309 | +\fancypagestyle{BIThesis}{ |
| 310 | + % 页眉高度 |
| 311 | + \setlength{\headheight}{20pt} |
| 312 | + % 页码高度(不完美,比规定稍微靠下 2mm) |
| 313 | + \setlength{\footskip}{\BIThesis@footskip} |
| 314 | + |
| 315 | + \fancyhf{} |
| 316 | + % 定义页码 |
| 317 | + \fancyfoot[C]{\songti\zihao{5} \thepage} |
| 318 | + % 页眉分割线稍微粗一些 |
| 319 | + \renewcommand{\headrulewidth}{0.6pt} |
| 320 | + |
| 321 | + % 定义页眉 |
| 322 | + \fancyhead[C]{\zihao{4}\ziju{0.08}\songti{北京理工大学本科生毕业设计(论文)外文翻译}} |
| 323 | +} |
| 324 | +\fi |
280 | 325 | % 设置章节格式 |
281 | 326 | % 一级标题:黑体,三号,加粗;间距:段前 0.5 行,段后 1 行; |
282 | 327 | \ctexset{chapter={ |
283 | 328 | name = {第,章}, |
284 | | - number = {\arabic{chapter}}, |
| 329 | + number = {\arabicHeiti{ \arabic{chapter} }}, |
285 | 330 | format = {\heiti \bfseries \centering \zihao{3}}, |
286 | 331 | aftername = \hspace{9bp}, |
287 | 332 | pagestyle = BIThesis, |
|
293 | 338 |
|
294 | 339 | % 二级标题:黑体,四号,加粗;间距:段前 0.5 行,段后 0 行; |
295 | 340 | \ctexset{section={ |
296 | | - number = {\thechapter.\hspace{4bp}\arabic{section}}, |
| 341 | + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}}}, |
297 | 342 | format = {\heiti \raggedright \bfseries \zihao{4}}, |
298 | 343 | aftername = \hspace{8bp}, |
299 | 344 | beforeskip = 20bp plus 1ex minus .2ex, |
|
304 | 349 |
|
305 | 350 | % 三级标题:黑体、小四、加粗;间距:段前 0.5 行,段后 0 行; |
306 | 351 | \ctexset{subsection={ |
307 | | - number = {\thechapter.\hspace{3bp}\arabic{section}.\hspace{3bp}\arabic{subsection}}, |
| 352 | + number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}}}, |
308 | 353 | format = {\heiti \bfseries \raggedright \zihao{-4}}, |
309 | 354 | aftername = \hspace{7bp}, |
310 | 355 | beforeskip = 17bp plus 1ex minus .2ex, |
|
354 | 399 | \renewcommand{\thefigure}{\thechapter-\arabic{figure}} |
355 | 400 | \captionsetup[figure]{font=small,labelsep=space} |
356 | 401 |
|
| 402 | +% 设置 listings 源代码高亮的格式 |
| 403 | +\AtBeginDocument{ |
| 404 | + \renewcommand{\lstlistingname}{代码} |
| 405 | + \renewcommand{\thelstlisting}{\arabic{chapter}-\arabic{lstlisting}} |
| 406 | +} |
| 407 | + |
| 408 | +\definecolor{codegreen}{rgb}{0,0.6,0} |
| 409 | +\definecolor{codegray}{rgb}{0.5,0.5,0.5} |
| 410 | +\definecolor{codepurple}{rgb}{0.58,0,0.82} |
| 411 | +\definecolor{backcolour}{rgb}{0.95,0.95,0.92} |
| 412 | +\lstdefinestyle{examplestyle}{ |
| 413 | + backgroundcolor=\color{backcolour}, |
| 414 | + commentstyle=\color{codegreen}, |
| 415 | + keywordstyle=\color{magenta}, |
| 416 | + numberstyle=\tiny\color{codegray}, |
| 417 | + stringstyle=\color{codepurple}, |
| 418 | + basicstyle=\ttfamily\footnotesize, |
| 419 | + breakatwhitespace=false, |
| 420 | + breaklines=true, |
| 421 | + captionpos=b, |
| 422 | + keepspaces=true, |
| 423 | + numbers=left, |
| 424 | + numbersep=5pt, |
| 425 | + showspaces=false, |
| 426 | + showstringspaces=false, |
| 427 | + showtabs=false, |
| 428 | + tabsize=2 |
| 429 | +} |
| 430 | +\lstset{style=examplestyle} |
| 431 | + |
| 432 | + |
357 | 433 | % 设置表格的 caption 格式和 caption 与 table 之间的垂直距离 |
358 | 434 | \renewcommand{\thetable}{\thechapter-\arabic{table}} |
359 | 435 | \captionsetup[table]{font=small,labelsep=space,skip=2pt} |
|
0 commit comments