forked from ustctug/ustcthesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathustcthesis.dtx
1628 lines (1615 loc) · 56.5 KB
/
ustcthesis.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
%
% Copyright (C) 2015-2017 by Zeping Lee <zepinglee AT gmail.com>
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.2 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.2 or later is part of all distributions of
% LaTeX version 1999/12/01 or later.
%
%<*internal>
\iffalse
\fi
\begingroup
\def\nameoflatex{LaTeX2e}
\expandafter\endgroup\ifx\nameoflatex\fmtname\else
\csname fi\endcsname
%</internal>
%<*install>
\input docstrip.tex
\preamble
Copyright (C) 2015-\the\year by Zeping Lee <zepinglee AT gmail.com>
This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.2 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.2 or later is part of all distributions of
LaTeX version 1999/12/01 or later.
\endpreamble
\keepsilent
\askforoverwritefalse
\generate{
\file{\jobname.cls}{\from{\jobname.dtx}{class}}
}
\Msg{* Happy TeXing!}
\endbatchfile
%</install>
%<*internal>
\fi
%</internal>
%<*driver>
\ProvidesFile{ustcthesis.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{ustcthesis}
%<*class>
[2017/05/03 v2.2.2 USTC thesis template]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[paper=a4paper,hmargin={1.5in,1in},vmargin=1.5in]{geometry}
\usepackage{hypdoc}
\hypersetup{
bookmarksopen=true,
bookmarksopenlevel=2,
bookmarksnumbered=true,
CJKbookmarks=true,
unicode=true,
allcolors=blue,
}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\usepackage[UTF8, heading, sub3section]{ctex}
\ctexset{
section = {
format = \Large\sffamily\bfseries\raggedright,
name = {第,节},
},
}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{listings}
\lstdefinestyle{lstshell}{
basicstyle=\small\ttfamily,
backgroundcolor=\color{lightgray},
gobble=2,% 重要!否则会生成注释符号"%"
language=bash}
\lstdefinestyle{lstlatex}{
basicstyle=\small\ttfamily,
frame=single,
gobble=2,
language=[LaTeX]TeX}
\lstnewenvironment{shell}{\lstset{style=lstshell}}{}
\lstnewenvironment{latex}{\lstset{style=lstlatex}}{}
\newcommand\shellcmd[1]{\colorbox{lightgray}{\lstset{style=lstshell}\lstinline |#1| }}
% 模仿 l3doc 的定义
\DeclareRobustCommand\file{\nolinkurl}
\DeclareRobustCommand\env{\texttt}
\DeclareRobustCommand\pkg{\textsf}
\DeclareRobustCommand\cls{\textsf}
\DeclareRobustCommand\opt{\texttt}
\renewcommand\glossaryname{版本历史}
\GlossaryPrologue{\section*{\glossaryname}}
\renewcommand\indexname{命令索引}
\IndexPrologue{%
\section*{\indexname}
\textit{意大利体的数字表示描述对应索引项的页码;
带下划线的数字表示定义对应索引项的代码行号;
罗马字体的数字表示使用对应索引项的代码行号。}}
\newcommand\TeXLive{\TeX\ Live}
\setcounter{secnumdepth}{3}
\begin{document}
\DocInput{ustcthesis.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \changes{v2.0}{2016/02/21}{Initial release.}
% \changes{v2.0.1}{2016/03/10}{Add code and algorithm environments.}
%
% \GetFileInfo{ustcthesis.dtx}
%
% \DoNotIndex{\newenvironment,\@bsphack,\@empty,\@esphack,\sfcode}
% \DoNotIndex{\addtocounter,\label,\let,\linewidth,\newcounter}
% \DoNotIndex{\noindent,\normalfont,\par,\parskip,\phantomsection}
% \DoNotIndex{\providecommand,\ProvidesPackage,\refstepcounter}
% \DoNotIndex{\RequirePackage,\setcounter,\setlength,\string,\strut}
% \DoNotIndex{\textbackslash,\texttt,\ttfamily,\usepackage}
% \DoNotIndex{\begin,\end,\begingroup,\endgroup,\par,\\}
% \DoNotIndex{\if,\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi}
% \DoNotIndex{\let,\def,\xdef,\edef,\newcommand,\renewcommand}
% \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect}
% \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize}
% \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny}
% \DoNotIndex{\normalfont,\bfseries,\slshape,\sffamily,\interlinepenalty}
% \DoNotIndex{\textbf,\textit,\textsf,\textsc}
% \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad}
% \DoNotIndex{\centering,\raggedright,\ref}
% \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize}
% \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne}
% \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\.,\DeclareCaptionLabelSeparator,\DeclareComplementaryOption}
%
% \title{\cls{ustcthesis} 使用说明}
% \author{Zeping Lee\thanks{zepinglee AT gmail.com} \and
% seisman\thanks{seisman.info AT gmail.com} }
% \date{\filedate\qquad\fileversion}
% \maketitle
%
%
%
% \section{简介}
%
% \cls{ustcthesis} 是用于排版中国科学技术大学本科和研究生学位论文的 \LaTeX{} 模板,
% 按照《中国科学技术大学研究生学位论文撰写规范》
% \footnote{\url{{http://gradschool.ustc.edu.cn/ylb/material/xw/wdxz/1.doc}}}
% 和《关于本科毕业论文(设计)格式和统一封面的通知》
% \footnote{\url{http://www.teach.ustc.edu.cn/document/doc-administration/4032.html}}
% 的要求编写。
%
% 其前身是中国科学技术大学本科论文模板(作者 XPS,最后维护 ywg)和中国科学技术大学研究生论文
% 模板(作者 Liuqs,主要维护 Liuqs、Guolicai)。
% 后来两模板进行了整合梳理,由 ywg 维护。
% 2015 年,seisman 和 zepinglee 基于 \pkg{ctex} 2.0 重新编写了模板。
%
% \cls{ustcthesis} 的下载地址:
% \begin{itemize}
% \item 主要地址:\url{https://github.com/ustctug/ustcthesis}
% \item 镜像地址:\url{https://git.ustclug.org/ustctug/ustcthesis}
% \end{itemize}
%
% 我们假定用户已经能够熟练使用 \LaTeX{},如果从来没有接触过 \LaTeX{},
% 建议阅读附录 \ref{sec:new};
% 若对本模板有问题或者建议,可以在 GitHub 提出(推荐),或者发电子邮件给维护者,
% 注意提问之前需阅读附录 \ref{sec:faq};
% 对于想自已修改代码的用户,以及愿意有兴趣参与模板的开发、维护的 \TeX{} 爱好者,
% 附录 \ref{sec:dev_guide} 和附录 \ref{sec:code} 分别提供了指南和带代码的注释。
%
%
%
% \section{编译方法}
%
% \subsection{文件组成}
% 本模板的主要文件如下:
% \begin{center}
% \begin{tabularx}{\linewidth}{llX}
% \toprule
% 类别 & 文件 & 说明 \\
% \midrule
% 模板文件 & \file{ustcthesis.dtx} & 模板原始代码文件,一般用户无需使用 \\
% & \file{ustcthesis.cls} & 文档类文件 \\
% & \file{ustcextra.sty} & 模板的附加宏包 \\
% & \file{ustcauthoryear.bst} & author-year 风格的 \BibTeX{} 格式文件 \\
% & \file{ustcnumerical.bst} & numerical 风格的 \BibTeX{} 格式文件 \\
% & \file{figures/ustc_*.eps} & 校名和校徽图片 \\
% \midrule
% 生成文件 & \file{ustcthesis.pdf} & (你正在阅读的)模板使用说明 \\
% \midrule
% 示例文档 & \file{main.tex} & 主文档 \\
% & \file{chapters/*.tex} & 示例文档的各个章节 \\
% & \file{figures/} & 放置图片的目录 \\
% & \file{bib/tex.bib} & \BibTeX{} 示例数据库 \\
% \midrule
% 其他 & \file{README.md} & 基本说明 \\
% & \file{.latexmkrc} & latexmk 的配置文件 \\
% & \file{Makefile} & GNU make 的配置文件 \\
% \bottomrule
% \end{tabularx}
% \end{center}
%
% 示例文档包括了常用的 \LaTeX{} 命令,建议新手从此入手,用自己的内容进行替换。
%
% 文件 \file{ustcthesis.dtx} 是模板的原始代码文件,其可以自动生成文档类文件
% \file{ustcthesis.cls} 和模板使用说明文件 \file{ustcthesis.pdf} 。
% 原始模板文件仅供模板开发者使用,一般用户无需使用。
%
% \subsection{依赖宏包}
%
% \cls{ustcthesis} 直接依赖的宏包有:
% \pkg{amsmath},
% \pkg{amsmthm},
% \pkg{caption},
% \pkg{ctex},
% \pkg{geometry},
% \pkg{hyperref},
% \pkg{kvoptions},
% \pkg{titlesec},
% \pkg{titletoc},
% \pkg{xparse}
%
% 注意 \pkg{ctex} 必须为 2.0 以上版本。关于更新宏包,参见 \ref{sec:update}。
%
% \subsection{开始编译}
%
% \begin{enumerate}
%
% \item GNU make \\
% Linux/Mac用户,可以直接使用 GNU make 工具,这是最简单的方法。
% 编译论文 \file{main.pdf}:
% \begin{shell}
% make
% \end{shell}
% 编译说明文档 \file{ustcthesis.pdf}:
% \begin{shell}
% make doc
% \end{shell}
% 另外还可以用 \shellcmd{make clean} 清理辅助文件。
%
% \item |latexmk| \\
% Windows 用户可能无法使用GNU make,使用 |latexmk| 也是一个比较简单的方法,
% 配置文件由 \file{.latexmkrc} 给出,其参数设置为 |-xelatex|,用户编译论文
% 只需使用命令:
% \begin{shell}
% latexmk main
% \end{shell}
% 编译说明文档:
% \begin{shell}
% latexmk ustcthesis.dtx
% \end{shell}
% 清理辅助文件可以用 \shellcmd{latexmk -c}。图形界面用户应参考编辑器的使用说明。
%
% \item 手动编译 \\
% 手动编译是最繁琐的方法,用户可能需要运行多遍,以确保论文的交叉引用等信息全部正确。
%
% 编译论文 \file{main.pdf}:
% \begin{shell}
% xelatex main
% bibtex main # 如果不使用 BibTeX 可以略过此步
% xelatex main
% xelatex main
% \end{shell}
% 编译说明文档 \file{ustcthesis.pdf}:
% \begin{shell}
% xelatex ustcthesis.dtx
% makeindex -s gind.ist ustcthesis.idx
% makeindex -s gglo.ist -o ustcthesis.gls ustcthesis.glo
% xelatex ustcthesis.dtx
% xelatex ustcthesis.dtx
% \end{shell}
% \end{enumerate}
%
%
%
% \section{论文参数设置}
%
% \subsection{文档类参数}
% \cls{ustcthesis} 提供了若干选项,应在论文开始时设置,如:
% \begin{latex}
% \documentclass[doctor,english,pdf]{ustcthesis}
% \end{latex}
%
% 其中论文类型是\emph{必需参数}:
% \begin{center}
% \begin{tabular}{p{.15\textwidth}p{.7\textwidth}}
% \toprule
% \opt{bachelor} & 本科论文 \\
% \opt{master} & 硕士论文 \\
% \opt{doctor} & 博士论文 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% 以下是可选参数,可以选择语言:
% \begin{center}
% \begin{tabular}{p{.15\textwidth}p{.7\textwidth}}
% \toprule
% \opt{chinese} & 中文,默认 \\
% \opt{english} & English \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% 还可以设置论文的页面格式:
% \begin{center}
% \begin{tabular}{p{.15\textwidth}p{.7\textwidth}}
% \toprule
% \opt{print} & 用于打印纸质论文,默认 \\
% \opt{pdf} & 适于屏幕阅读,会开启 \opt{onside}、\opt{pagecenter} 选项,
% 并且保留超链接颜色 \\
% \midrule
% \opt{onside} & 单面打印,\opt{bachelor} 默认 \\
% \opt{twoside} & 双面打印,\opt{doctor}、\opt{master} 默认 \\
% \midrule
% \opt{openany} & 新的一章仅在下一页开始 \\
% \opt{openright} & 新的一章仅在奇数页(右侧)开始,这时可能会产生空白页以填充左侧,
% 仅在双面打印时有效,\opt{doctor}、\opt{master} 默认 \\
% \midrule
% \opt{pagecenter} & 页码居中,\opt{bachelor} 默认 \\
% \opt{pageouter} & 页码置于外侧,\opt{doctor}、\opt{master} 默认 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% \subsection{中文字体}
% \cls{ustcthesis} 只以 \pkg{xeCJK} 的方式提供中文支持,不支持 CJK 方式,
% 所以用户必须使用UTF-8 编码保存源文件,并且用 |xelatex| 命令进行编译。
%
% 默认情况下,本模板可以利用 \pkg{ctex} 宏包的功能自动检测用户的操作系统类型,
% 并选择合适的中文字库。自动配置的策略如下:
% \begin{center}
% \begin{tabular}{cl}
% \toprule
% 操作系统 & 中文字库 \\
% \midrule
% macOS & 华文字库 \\
% Windows Vista 及以后版本 & 中易字库 + 微软雅黑 \\
% Windows XP 及以前版本 & 中易字库 \\
% 其他 & Fandol 字库 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% 用户也可以在调用文档类时加入选项 \opt{fontset=\meta{font}} 来显式地指定加载的字库,参见 \pkg{ctex}、\pkg{fontspec} 宏包。
%
% \subsection{英文字体}
% 模板中使用了三种英文,包括衬线字体 Times New Roman、无衬线字体 Arial 和等宽字体
% Courier New 。Windows和Mac下自带这三种英文字体,Linux下则需要从其他地方复制字体到
% 本机。
%
%
%
% \section{《规范》中的若干问题}
% 在模板的开发中,我们发现了《规范》中的一些问题,比如附录中的格式示例与
% 其正文的要求矛盾,甚至本身的要求也自相矛盾。
% 在这些情况下,我们尽可能地按照《规范》正文中的要求处理,在特殊情况下按照
% 排版的惯例执行。
% 这些矛盾之处罗列如下,以免引起误解。
% \begin{center}
% \begin{tabular}{|l|l|l|}
% \toprule
% 章节 & 《规范》正文的描述 & 《格式示例》 \\
% \midrule
% 2.4 & “目录应包括论文的全部内容,包括中英文摘要和附录等” & 没有摘要 \\
% \midrule
% 2.6.2.1 & “各层次标题一律用 阿拉伯数字连续编号” & \\
% 3.6 & 示例:“第一章” & “第 1 章” \\
% \midrule
% 2.6.2.3 & “页码位置居于页脚居中” & \\
% 3.1 & “宋体 10.5 磅页面下脚右端” & 居中 \\
% \midrule
% 3.5 & 目录示例:“第 1 章” & “第一章” \\
% \bottomrule
% \end{tabular}
% \end{center}
%
%
%
% \section{论文内容}
%
% 本科论文的内容按如下顺序排列:
% \begin{enumerate}
% \item 中文扉页、英文扉页
% \item 致谢、目录、中文摘要、英文摘要
% \item 正文章节、参考文献
% \item 附录
% \end{enumerate}
%
% 硕博论文的内容按如下顺序排列:
% \begin{enumerate}
% \item 中文扉页、英文扉页、原创性声明及授权使用说明
% \item 中文摘要、英文摘要、目录、图表及代码目录(可选)、符号说明(可选)
% \item 正文章节、参考文献
% \item 附录
% \item 致谢、已发表论文列表
% \end{enumerate}
%
% 示例文档 \file{main.tex} 中的致谢、目录等章节的顺序,是按照研究生论文的格式组织内容的,
% \emph{本科生需要手动调整顺序}。
%
% 如果使用文档累选项 \opt{print} (默认),“原创性声明” 页则会加在扉页后;若为 \opt{pdf},则没有声明页。
%
%
% \subsection{扉页}
% 封面的内容由印刷厂统一制作,\cls{ustcthesis} 的内容从扉页开始。
% 扉页由 \cs{maketitle} 命令生成,其中的各项信息使用 \cs{\meta{item}\marg{info}} 的方式填写,
% 本模板提供以下命令,其中带 |en| 前缀的命令是设置英文扉页的命令:
% \begin{center}
% \begin{tabular}{lll}
% \toprule
% 命令 & 命令(英文) & 说明 \\
% \midrule
% \cs{title} & \cs{entitle} & 论文标题 \\
% \cs{author} & \cs{enauthor} & 作者姓名 \\
% \cs{major} & \cs{enmajor} & 学科专业 \\
% \cs{advisor} & \cs{enadvisor} & 导师姓名 \\
% \cs{submitdate} & \cs{ensubmitdate} & 完成时间 \\
% \cs{secrettext} & \cs{ensecrettext} & 密级信息(如果不设置则不保密) \\
% \cs{depart} & & 系别,可能用于书脊 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% \subsection{摘要等环境}
% \DescribeEnv{abstract}
% \DescribeEnv{enabstract}
% \DescribeEnv{notation}
% \DescribeEnv{acknowledgements}
% \DescribeEnv{publications}
% \cls{ustcthesis} 还提供了以下环境,用于填写相应的信息。
% \begin{center}
% \begin{tabular}{ll}
% \toprule
% 环境 & 说明 \\
% \midrule
% \env{abstract} & 中文摘要 \\
% \env{enabstract} & 英文摘要 \\
% \env{notation} & 符号 \\
% \env{acknowledgements} & 致谢 \\
% \env{publications} & 发表成果 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% \DescribeMacro{\keywords}
% \DescribeMacro{\enkeywords}
% 其中,摘要的关键词应使用 \cs{keywords} 和 \cs{enkeywords} 命令,并包含在摘要环境中;
% 中文摘要的相邻关键词之间应使用 \cs{zhspace} 命令隔开,举个例子:
% \begin{latex}
% \begin{abstract}
% 这里是摘要。
% \keywords{论文 \zhspace 摘要 \zhspace 关键词}
% \end{abstract}
% \end{latex}
%
% \subsection{目录和图表}
% 生成目录、插图和表格的索引命令分别如下:
% \DescribeMacro{\tableofcontents}
% \DescribeMacro{\listoffigures}
% \DescribeMacro{\listoftables}
% \begin{center}
% \begin{tabular}{ll}
% \toprule
% 命令 & 说明 \\
% \midrule
% \cs{tableofcontents} & 目录 \\
% \cs{listoffigures} & 图目录 \\
% \cs{listoftables} & 表目录 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% \LaTeX{} 的图表索引,是通过 \cs{caption} 命令完成的,因此它们必须出现在浮动环境中,
% 否则不被计数。
% 如果不想让某个表格或者图片出现在索引里面,那么应使用命令 \cs{caption*},
% 这个命令不会给表格编号,也就是出来的只有标题文字而没有“表~xx”,“图~xx”。
%
% \DescribeMacro{\note}
% 本模板还提供了 \cs{note\marg{text}} 命令,用于在图表中添加注释。
%
% \subsection{数学}
% \file{ustcextra.sty} 定义了数学定理格式 |ustcplain|(默认使用)以及一些常用的环境:
% \begin{center}
% \begin{tabular}{*{5}{l}}
% \toprule
% theorem & assertion & axiom & corollary & lemma \\
% 定理 & 断言 & 公理 & 推论 & 引理 \\
% \midrule
% proposition & definition & example & remark & proof \\
% 命题 & 定义 & 例 & 注 & 证明 \\
% \bottomrule
% \end{tabular}
% \end{center}
% 使用方法如下:
% \begin{latex}
% \begin{theorem}[Fundamental theorem of calculus]
% Let $f$ be a continuous real-valued function defined on
% a closee interval $[a, b]$. Let
% \begin{equation}
% F(x) = \int_a^x f(t) \, \mathrm{d}t \qquad x \in [a, b].
% \end{equation}
% Then $F$ is differentiable on $(a, b)$, and $F'(x) = f(x)$.
% \end{theorem}
% \end{latex}
%
% 注意\env{proof} 环境与其它不同的是,其第二个参数会完全取代“证明”标题,
% 并且会在末尾加一个 \cs{qed}。
%
% \DescribeMacro{\newtheorem}
% 用户可以使用 \cs{newtheorem} 命令来分别定义新的数学环境,比如定义并使用“传说”环境:
% \begin{latex}
% \newtheorem{legend}{传说}
% \begin{legend}
% 龙生龙,凤生凤,华罗庚的弟子会打洞。
% \end{legend}
% \end{latex}
%
% \DescribeMacro{\newtheoremstyle}
% 用户还可以用 \cs{newtheoremstyle} 定义环境的格式,具体参见 \pkg{amsthm} 宏包。
%
% \subsection{参考文献}
% 参考文献支持 author-year 风格和 numerical 风格。在 \file{main.tex} 中指定
% \begin{latex}
% \bibliographystyle{ustcauthoryear}
% \end{latex}
% 则使用 author-year 风格,指定
% \begin{latex}
% \bibliographystyle{ustcnumerical}
% \end{latex}
% 则使用 numerical 风格。
%
% 有一小撮同学坚持使用在文中的 numerical 风格,如“见文献[2]”,
% 模板还提供了 ustcinline 风格。
%
%
% \clearpage
% \appendix
%
% \section{\LaTeX{} 新手指南}
% \label{sec:new}
%
% 首先要弄清 \textbf{编译器}、\textbf{宏包}、 \textbf{编辑器}、\textbf{发行版}
% 的概念和区别。编译器是读入源文件并输出 PDF(大部分情况下)的程序,如 |tex| 、 |latex| 、 |xelatex| ;
% 宏包是实现拓展功能的 \LaTeX 代码,并且已经被良好地封装起来,如 |fontspec| 和 |geometry| ;
% 编辑器是用来编辑 \LaTeX 源文件的工具,理论上用记事本等低级工具也可以,但更常用的有
% TeXShop、 TeXworks 等等;发行版就是一套编译器、编辑器、宏包和其他工具的集合。
%
% 国际上主流的发行版及支持的操作系统如下:
%
% \begin{center}
% \begin{tabular}{c|ccc}
% & Linux & Mac & Windows \\
% \hline
% \href{https://www.tug.org/texlive/}{TeX Live} & yes & yes & yes \\
% \href{https://tug.org/mactex/}{MacTeX} & & yes & \\
% \href{http://miktex.org}{MikTeX} & & & yes \\
% \end{tabular}
% \end{center}
%
% TeX Live 是跨平台的,且支持在线安装功能,但其图形化安装界面却比较难用,
% 给很多 Mac 和 Windows 用户造成了不便,所以便有了 MacTeX 和 MikTeX。
%
% 事实上,MacTeX 其实就是 TeX Live 加上一些 Mac 专有的 GUI 软件,
% MaC 高级用户可以直接安装 TeX Live 并自行配制工具。
%
% 很多中国用户使用的 CTeX 套装(\url{http://www.ctex.org/})发行版是基于 MikTeX 开发的,
% 然而 CTeX v2.9.2.164 于 2012 年发布,已经过时,\textbf{不推荐使用}!
% 新版 CTeX 套装截至2016年4月仍在开发中。
%
% \subsection{安装 \LaTeX{}}
%
% 如果你选择好了发行版,现在就可以开始安装了。使用校园网时从镜像服务器下载会大大加快速度。
%
% \begin{center}
% \begin{tabular}{r|l}
% 发行版 & 校内镜像地址 \\
% \hline
% \href{https://www.tug.org/texlive/}{TeX Live} &
% \url{http://mirrors.ustc.edu.cn/CTAN/systems/texlive/} \\
% \href{https://tug.org/mactex/}{MacTeX} &
% \url{http://mirrors.ustc.edu.cn/CTAN/systems/mac/mactex/} \\
% \href{http://miktex.org}{MikTeX} &
% \url{http://mirrors.ustc.edu.cn/CTAN/systems/win32/miktex/} \\
% \end{tabular}
% \end{center}
%
% 尽管安装包可能有 5GB 之大,但是建议新手用户安装完整版,以避免缺失宏包引起的恐慌。
%
% USTCTUG 提供了一个轻量级的安装脚本
% \href{https://github.com/ustctug/mini-texlive}{mini-texlive},
% 以帮助Linux和Mac用户安装模板所需的最小 \LaTeX。
%
% \subsection{更新宏包}
% \label{sec:update}
% 由于本模板只保证对最新版的支持,可能会不兼容旧版本,所以安装完 TeX Live 后,
% 建议将所有宏包更新至最新版本。
% Mac 和 Linux 用户下可以使用如下命令更新所有已安装的宏包:
% \begin{enumerate}
% \item 先设置 repository 为校园的镜像,这样用校园网时就很快(需要输入密码)
% \begin{shell}
% sudo tlmgr option repository http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet
% \end{shell}
% \item 然后更新,
% \begin{shell}
% sudo tlmgr update --self --all
% \end{shell}
% \end{enumerate}
%
% MacTeX 还自带了 TeX Live Ultility.app 图形化界面工具,用来更新宏包。
%
% \subsection{入门资料}
% \label{sec:newdoc}
%
% 对于新手推荐以下资料:
%
% \begin{itemize}
% \item
% \href{http://mirrors.ustc.edu.cn/CTAN/info/lshort/chinese/lshort-zh-cn.pdf}{一份不太简短的 \LaTeXe{} 介绍}:经典的入门资料的新翻译版。
% \item
% \href{http://dralpha.altervista.org/zh/tech/lnotes2.pdf}{\LaTeX{} Notes}:
% 一份诙谐幽默的中文入门资料
% \item
% 刘海洋《\LaTeX{} 入门》: 较为详细的关于 \LaTeX{}
% 的中文书籍,其他中文书已经过时。
% \end{itemize}
%
% \subsection{排版注意事项}
% \label{sec:caution}
% \begin{itemize}
% \item 英文逗号、句号、问号和叹号后面要加空格。
% \item 中、西文字符之间要加空格。
% \item “|表 \ref{tab:xxx}|” 应插入显式的空格:“|表~\ref{tab:xxx}|”。
% \item \CTeX{} 虽然提供一些显式地设置中文字体的命令如 \cs{heiti},但是不建议使用,
% 因为西文需要必须与之匹配。故推荐使用 \cs{textsf} 或者 \cs{bfseries}。
% \end{itemize}
%
%
%
% \section{常见问题 FAQ}
% \label{sec:faq}
%
% \subsection{为何我打开文件时显示中文为乱码?}
% 因为你的编辑器不是使用 UTF-8 编码。\cls{ustcthesis} 中文只支持 \pkg{xeCJK} 方式,
% 必须使用 UTF-8 编码。中文版 Windows 的默认编码是 GBK 。
%
% \subsection{为何生成的PDF有空白页?}
% 这是为了双面打印设置的,如果要生成用于电子阅读的 PDF,可以在文档类选项中加入
% |pdf|,比如 |\documentclass[doctor,pdf]{ustcthesis}|。
%
% \subsection{为何没有生成封面和书脊?}
% 封面和书脊由印刷厂统一制作,本模板的内容从扉页开始。
%
% \subsection{MacTeX 2015 生成的 PDF 超链接为什么始终为红色?}
% 这是 MacTeX 2015 中 hyperref 宏包的一个 bug,升级宏包后可以生成正常颜色,
% 方法见 \ref{sec:update} 。
%
%
% \section{模板开发维护指南}
% \label{sec:dev_guide}
%
% 本节的 pdf 文件均可在完整的发行版中找到,或者使用 texdoc 命令打开。
%
% 要参与 \LaTeX{} 的开发,首先要熟悉面向用户的命令和工具,除了 \ref{sec:newdoc}
% 中的文档,还应熟悉:
%
% \begin{itemize}
% \item
% latex2e.pdf: 系统地介绍了 \LaTeX{}
% 使用的方方面面的文档,有平时很多用不到但是 \LaTeX{} 提供了的命令
% \item
% 所用宏包的文档(可能还有源码):
% \item
% 常用的工具 latexmk, texdoc
% \item
% 一些调试技巧如 \cs{show} 和 \cs{meaning} 命令
% \end{itemize}
%
% 下面是面向开发的文档:
%
% \begin{itemize}
% \item
% clsguide.pdf: \LaTeXe{} 宏包和文档类的命令和编写规范
% \item
% classes.pdf: 这是 \LaTeXe{} 三个标准文档类的实现,用于参考
% \item
% macros2e.pdf: 集中介绍了 \LaTeXe{} 里使用的一些内部宏,用于参考
% \item
% dtxtut.pdf: \LaTeX{}
% 的宏包与说明文档的封装方式,即所谓``文学编程'',更详细的有
% docstrip.pdf 和 doc.pdf,
% \href{http://www.texdev.net/2009/10/06/a-model-dtx-file/}{Joseph
% Wright 的文章} 介绍了更好封装的技巧
% \end{itemize}
%
% 关于 BibTeX,应阅读以下文档:
%
% \begin{itemize}
% \item
% btxdoc.pdf, btxhak.pdf: BibTeX 的说明文档
% \item
% btxbst.doc: BibTeX 的三个标准 bst 的源文件(带注释)
% \item
% ttb.pdf: 一份详细的介绍
% \item
% natbib.pdf: natbib 宏包的文档
% \end{itemize}
%
% 至此可以解决大部分的问题了,如果想要更深入地研究,有下高级资料:
%
% \begin{itemize}
% \item
% TeXbook\footnote{可以在 CTAN 找到源码并自行编译}: Knuth 的 TeX 圣经,了解底层 TeX
% 的原理必读。还有更简略一点的介绍文档
% TeXbyTopic.pdf 和 impatient.pdf。
% \item
% source2e.pdf: 这是 \LaTeXe{} 的实现
% \end{itemize}
%
% \LaTeX3 的开发正在进行中,其底层接口已经相对成熟和稳定。\pkg{xecjk} 和 \pkg{ctex}
% 均是建立在 \LaTeX3 基础上的。关于 \LaTeX3 的语法的文档有:
%
% \begin{itemize}
% \item
% l3styleguide.pdf,这是 \LaTeX3 项目组写给开发者的指南
% \item
% expl3.pdf,这是 \LaTeX3 编程接口宏包的文档
% \item
% interface3.pdf,这是 \LaTeX3 的开发者接口文档
% \item
% source3.pdf,这是 \LaTeX3 的实现
% \end{itemize}
%
%
%
% \StopEventually{}
%
% \section{代码实现}
% \label{sec:code}
%
% \subsection{声明选项}
% \begin{macrocode}
%<*class>
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=ustc@opt, prefix=ustc@opt@, setkeys=\kvsetkeys}
\DeclareBoolOption[false]{doctor}
\DeclareBoolOption[false]{master}
\DeclareBoolOption[false]{bachelor}
\DeclareBoolOption[false]{pdf}
\DeclareComplementaryOption{print}{pdf}
\DeclareBoolOption[false]{english}
\DeclareComplementaryOption{chinese}{english}
% \end{macrocode}
% |ustc@page| 这一 family 用来设置分页方式
% \begin{macrocode}
\SetupKeyvalOptions{family=ustc@page, prefix=ustc@page@, setkeys=\kvsetkeys}
\DeclareBoolOption[false]{oneside}
\DeclareComplementaryOption{twoside}{oneside}
\DeclareBoolOption[false]{openany}
\DeclareComplementaryOption{openright}{openany}
\DeclareBoolOption[true]{pageouter}
\DeclareComplementaryOption{pagecenter}{pageouter}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
% \end{macrocode}
% 先处理 |ustc@opt| 这一 family,然后设置本科和 |pdf| 的默认分页方式为 |oneside|,
% |pagecenter|
% \begin{macrocode}
\ProcessKeyvalOptions{ustc@opt}
\ifustc@opt@bachelor
\ustc@page@onesidetrue
\ustc@page@pageouterfalse
\fi
\ifustc@opt@pdf
\ustc@page@onesidetrue
\ustc@page@pageouterfalse
\fi
\ifustc@opt@english
\PassOptionsToClass{scheme=plain}{ctexbook}
\fi
% \end{macrocode}
% 处理其他的选项
% \begin{macrocode}
\ProcessKeyvalOptions*\relax
\ifustc@page@oneside
\PassOptionsToClass{oneside}{ctexbook}
\fi
\ifustc@page@openany
\PassOptionsToClass{openany}{ctexbook}
\fi
% \end{macrocode}
% 默认情况下 \pkg{fontspec} 会将 \cs{mathrm} 的字体更改为 Times New Roman,
% 而 \cs{mathnormal} 依然为 Computer Modern,比 Times New Roman 要细,
% 所以设置 \pkg{fontspec} 不处理数学字体
% \begin{macrocode}
\PassOptionsToPackage{no-math}{fontspec}
% \end{macrocode}
% 载入 \cls{ctexbook} 文档类,注意要求 \pkg{ctex} 为 2.0 以及更高的版本。
% \begin{macrocode}
\LoadClass[a4paper, UTF8, zihao=-4]{ctexbook}[2015/05/14]
% \end{macrocode}
% 检测 ctexbook 版本,如果版本过低会报错
% \begin{macrocode}
\@ifclasslater{ctexbook}{2015/05/14}{}{%
\ClassError{ustcthesis}{%
Requiring ctex 2.0 or later version!\MessageBreak
Please update the package using your\MessageBreak
TeX package manager or from CTAN
}{%
See ustcthesis.pdf for more detailed update guide.
}
}
% \end{macrocode}
%
% \subsection{设置西文字体}
% 设置西文字体,中文字体已经由 \pkg{ctex} 自动设置,
% \begin{macrocode}
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier New}
% \end{macrocode}
%
% \subsection{超链接与书签}
% \begin{macrocode}
\RequirePackage{hyperref}
\hypersetup{
bookmarksopen=true,
bookmarksnumbered=true,
bookmarksopenlevel=1,
CJKbookmarks=true,
pdfborder=0 0 0,
unicode=true,
linktoc=all,
}
\urlstyle{rm}
% \end{macrocode}
% 如果为 |pdf| 样式,设置 hyperlink 颜色
% \begin{macrocode}
\ifustc@opt@pdf
\hypersetup{
colorlinks=true,
allcolors=blue,
}
\fi
% \end{macrocode}
% 设置 pdf 的信息
% \begin{macrocode}
\AtBeginDocument{
\hypersetup{
pdftitle={\ustc@title},
pdfauthor={\ustc@author}
}
}
% \end{macrocode}
%
% \subsection{定义命令}
% \begin{macro}{\setfontsize}
% 直接设置字体大小的命令,可选设置行距,默认单倍行距。
% 注意:该命令的定义中的空格会影响最终效果,因而需要在一行内写完命令,见
% \href{https://github.com/ustctug/ustcthesis/issues/42}{Issue 42}
% \begin{macrocode}
\RequirePackage{xparse}
\DeclareDocumentCommand\setfontsize{mo}{\IfValueTF{#2}{\fontsize{#1}{#2}}{\fontsize{#1}{2\dimexpr#1}}\linespread{1}\selectfont\relax}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\zhspace}
% 生成整数倍汉字宽度的空格,默认为 1
% \begin{macrocode}
\newcommand\zhspace[1][1]{\hspace{#1\ccwd}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ustc@underline}
% 生成空的下划线
% \begin{macrocode}
\newcommand\ustc@underline[2][6em]{%
\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt\relax
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ustc@define@term}
% 声明“作者姓名”等项目的命令
% \begin{macrocode}
\def\ustc@define@term#1{
\expandafter\gdef\csname #1\endcsname##1{
\expandafter\gdef\csname ustc@#1\endcsname{##1}
}
\csname #1\endcsname{}
}
\ustc@define@term{title}
\ustc@define@term{secrettext}
\ustc@define@term{author}
\ustc@define@term{depart}
\ustc@define@term{major}
\ustc@define@term{advisor}
\ustc@define@term{coadvisor}
\ustc@define@term{submitdate}
\ustc@define@term{entitle}
\ustc@define@term{ensecrettext}
\ustc@define@term{enauthor}
\ustc@define@term{enmajor}
\ustc@define@term{enadvisor}
\ustc@define@term{encoadvisor}
\ustc@define@term{ensubmitdate}
% \end{macrocode}
% \end{macro}
%
% \subsection{设置语言}
% 这里设置了中英文的各种名字。
% \changes{v2.1.5}{2017/04/15}{Add English version.}
% \changes{v2.2.2}{2017/04/26}{Enhance autoref names.}
% \begin{macrocode}
\ifustc@opt@english
\newcommand\ustc@contentsname{\contentsname}
\newcommand\ustc@pdf@contentsname{\contentsname}
\renewcommand\figurename{Fig.}
\newcommand\ustc@notesname{\textbf{Notes}: }
\newcommand\ustc@acknowledgementsname{Acknowledgements}
\newcommand\ustc@pdf@acknowledgementsname{Acknowledgements}
\newcommand\ustc@publicationsname{Publications}
\newcommand\ustc@notationname{Notation}
\else
\renewcommand\contentsname{目\zhspace 录}
\newcommand\ustc@pdf@contentsname{目录}
\renewcommand\listfigurename{图目录}
\renewcommand\listtablename{表目录}
\newcommand\ustc@notesname{\textbf{注}:}
\newcommand\ustc@acknowledgementsname{致\hspace{\ccwd}谢}
\newcommand\ustc@pdf@acknowledgementsname{致谢}
\newcommand\ustc@publicationsname{在读期间发表的学术论文与取得的研究成果}
\newcommand\ustc@notationname{符号说明}
\def\equationautorefname~#1\null{公式~(#1)\null}%
\def\footnoteautorefname{脚注}%
\def\itemautorefname~#1\null{第~#1~项\null}%
\def\figureautorefname{图}%
\def\tableautorefname{表}%
\def\partautorefname~#1\null{第~#1~部分\null}%
\def\appendixautorefname{附录}%
\def\chapterautorefname~#1\null{第~#1~章\null}%
\def\sectionautorefname~#1\null{第~#1~节\null}%
\def\subsectionautorefname~#1\null{第~#1~小节\null}%
\def\subsubsectionautorefname~#1\null{第~#1~小小节\null}%
\def\paragraphautorefname~#1\null{第~#1~段\null}%
\def\subparagraphautorefname~#1\null{第~#1~小段\null}%
\def\theoremautorefname{定理}%
\def\pageautorefname~#1\null{第~#1~页\null}%
\fi
% \end{macrocode}
%
% \subsection{页面设置}
% 首先用 \pkg{geometry} 宏包设置纸张和页面。
% \changes{v2.2}{2017/04/17}{Fix page layout bug.}
% \begin{macrocode}
\RequirePackage{geometry}
\geometry{
paper=a4paper,
top=2.54cm, bottom=2.54cm,
left=3.17cm, right=3.17cm,
headsep=0.74cm, headheight=0.34cm,
footskip=0.79cm}
% \end{macrocode}
% 再用 \pkg{titleps} 宏包设置页眉页码,\cs{if@mainmatter} 控制前言或是正文的页眉,
% \cs{ifustc@page@pageouter} 控制是否将正文及附录部分的页码置于外侧。
% \begin{macrocode}
\RequirePackage[pagestyles]{titlesec}
\ifustc@opt@bachelor
\newcommand\ustc@header@size{\zihao{-5}}
\newcommand\ustc@main@header{中国科学技术大学本科毕业论文}
\else