-
Notifications
You must be signed in to change notification settings - Fork 291
/
buaathesis.cls
1482 lines (1385 loc) · 51.3 KB
/
buaathesis.cls
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
% !Mode:: "TeX:UTF-8"
%%%%% 'buaathesis.cls' BEGIN
%%%%%%%%%% class clarification %%%%%%%%%%
% 模板声明
\NeedsTeXFormat{LaTeX2e}[2007/10/19]
\ProvidesClass{buaathesis}
[2020/03/05 v0.9
The LaTeX template for thesis of BUAA]
\typeout{Document Class `buaathesis' v0.9 by BHOSC (2020/03)}
%%%%%%%%%% class options %%%%%%%%%%
% 模板选项
% 本模板自身包含五个选项
% 前四个为对应学位类型,决定不同样式
% 第五个为颜色选项,用于电子版的情况
\newif\ifbuaa@bachelor\buaa@bachelorfalse
\newif\ifbuaa@master\buaa@masterfalse
\newif\ifbuaa@doctor\buaa@doctorfalse
\newif\ifbuaa@professional\buaa@professionalfalse
\newif\ifbuaa@classfied\buaa@classfiedfalse
\newif\ifbuaa@color\buaa@colorfalse
\newif\ifbuaa@twoteacher\buaa@twoteacherfalse
\newif\ifbuaa@ktreport\buaa@ktreportfalse
\DeclareOption{bachelor}{\buaa@bachelortrue}
\DeclareOption{master}{\buaa@mastertrue}
\DeclareOption{doctor}{\buaa@doctortrue}
\DeclareOption{professional}{\buaa@professionaltrue}
\DeclareOption{classfied}{\buaa@classfiedtrue}
\DeclareOption{color}{\buaa@colortrue}
\DeclareOption{twoteacher}{\buaa@twoteachertrue}
\DeclareOption{ktreport}{\buaa@ktreporttrue}
% 其余选项传递给ctexbook
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions\relax
% 引用ctexbook及基本设置
\LoadClass[zihao=-4,a4paper]{ctexbook}[2007/10/19]
%%%%%%%%%% global package %%%%%%%%%%
% 全局通用宏包
\RequirePackage{ifthen}
%%%%%%%%%% font %%%%%%%%%%
% 数学相关和字体设置
\RequirePackage{amsmath,amssymb,amsfonts,mathrsfs,bm}
\RequirePackage[amsmath,thmmarks,hyperref]{ntheorem}
\RequirePackage{txfonts}
%%%%%%%%%% hyphen %%%%%%%%%%
% For the `\hyp{}` command. Allow the user to insert `hyp{}` manually to
% adjust the line break when necessary.
\RequirePackage{hyphenat}
% 主要字体为Times New Roman和宋体
% 模板某些标题需要华文行楷和32号字
\setmainfont{Times New Roman}
% 不需要设置CJKmainfont,ctex 宏包已经很好的处理了
% 不仅设置了粗体为黑体,斜体为楷体,还兼容了winfonts和adobefonts
% 直接设置反而会在只有adobefonts的情况下报错
% \setCJKmainfont{宋体}
% 重新定义了一下宋体和黑体,让其能支持textbf
% 华文行楷、华文楷体同上
\let\songti\relax
\let\heiti\relax
\setCJKfamilyfont{songti}[AutoFakeBold = {2.17}]{SimSun}
\setCJKfamilyfont{heiti}[AutoFakeBold = {2.17}]{SimHei}
\setCJKfamilyfont{hwxingkai}[AutoFakeBold = {2.17}]{STXingkai}
\setCJKfamilyfont{hwkaiti}[AutoFakeBold = {2.17}]{STKaiti}
\newcommand{\songti}{\CJKfamily{songti}}
\newcommand{\heiti}{\CJKfamily{heiti}}
\newcommand{\hwxingkai}{\CJKfamily{hwxingkai}}
\newcommand{\hwkaiti}{\CJKfamily{hwkaiti}}
% 预定义的字体大小,以后用得着
\newcommand{\xiaochuhao}{\fontsize{32pt}{\baselineskip}\selectfont}
\newcommand{\yihao}{\fontsize{26pt}{39pt}\selectfont}
\newcommand{\xiaoyi}{\fontsize{24pt}{36pt}\selectfont}
\newcommand{\erhao}{\fontsize{22pt}{33pt}\selectfont}
\newcommand{\xiaoer}{\fontsize{18pt}{27pt}\selectfont}
\newcommand{\sanhao}{\fontsize{16pt}{24pt}\selectfont}
\newcommand{\xiaosan}{\fontsize{15pt}{22.5pt}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{21pt}\selectfont}
\newcommand{\xiaosi}{\fontsize{12pt}{18pt}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{15.75pt}\selectfont}
\newcommand{\xiaowu}{\fontsize{9pt}{13.5pt}\selectfont}
\newcommand{\liuhao}{\fontsize{7.5pt}{11.25pt}\selectfont}
%%%%%%%%%% color %%%%%%%%%%
% 颜色设置
% 只用于电子版
\RequirePackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
%%%%%%%%%% page margin %%%%%%%%%%
% 页面边距
\RequirePackage{geometry}
\newgeometry{
top=30mm, bottom=25mm, left=30mm, right=20mm,
headsep=5mm, includefoot
}
\savegeometry{bachelorgeometry}
% geometry for tasks pages for bachelor thesis, see also #270
\newgeometry{
top=30mm, bottom=25mm, left=30mm, right=20mm,
headsep=5mm
}
\savegeometry{bachelortaskgeometry}
\newgeometry{
top=25mm, bottom=25mm, left=30mm, right=20mm,
headsep=5mm, headheight=10mm, footskip=10mm,
}
\savegeometry{mastergeometry}
\ifbuaa@bachelor
\loadgeometry{bachelorgeometry}
\else
\loadgeometry{mastergeometry}
\fi
%%%%%%%%%% space %%%%%%%%%%
% 其他间距
\renewcommand{\baselinestretch}{1.5}
\setlength{\parindent}{2em}
\setlength{\floatsep}{3pt plus 3pt minus 2pt} % 图形之间或图形与正文之间的距离
\setlength{\abovecaptionskip}{10pt plus 1pt minus 1pt} % 图形中的图与标题之间的距离
\setlength{\belowcaptionskip}{3pt plus 1pt minus 2pt} % 表格中的表与标题之间的距离
%%%%%%%%%% header & footer %%%%%%%%%%
% 页眉页脚
% Force enter compat v3 mode when requires fancyhdr.
%
% There's chances after v3 that breaks BUAAThesis, see issue report:
%
% https://github.com/BHOSC/BUAAthesis/issues/265
%
% and commit from fancyhdr
%
% https://github.com/pietvo/fancyhdr/commit/00a7445aec70d3246de8faf108900d06e9caea1b
%
% The fix is tricky, but I think it is the best option we currently have...
%
\RequirePackage{fancyhdr}
\newif\iff@nch@compatViii
\let\f@nch@gbl\relax
\let\f@nch@gbl\global
\f@nch@compatViiitrue
\fancypagestyle{frontmatter}{
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhf{}
\fancyfoot[C]{\thepage}
}
\fancypagestyle{mainmatter}{
\fancyhead{}
\fancyfoot{}
\ifbuaa@bachelor
\ifbuaa@ktreport
\fancyhead[C]{\zihao{-5}\hwkaiti
\buaa@degreehead 学位论文\buaa@ktclass\vspace{1.5mm}
}
\fancyfoot[C]{
\hspace{1.5mm}
\hwkaiti\zihao{-5}\buaa@university\buaa@school 学院
\hfill\hfill
\songti\zihao{-5}$\cdot$\quad\thepage\quad$\cdot$
\hspace{1.5mm}
}
% 本科开题报告有页脚线
\renewcommand{\footrulewidth}{0.4bp}
\else
\fancyhead[C]{
\includegraphics[width=37bp]{figure/buaamark.pdf}\hfill
\raisebox{2ex}{\heiti\zihao{4}\buaa@university 毕业设计(论文)}\hfill
\raisebox{2ex}{\songti\zihao{5}第\quad\thepage\quad 页}
}
\fi
\else
\ifbuaa@ktreport
% 研究生开题报告/文献综述,与本科生格式基本一致
\fancyhead[C]{\zihao{-5}\hwkaiti
\buaa@degreehead 学位论文\buaa@ktclass\vspace{1.5mm}
}
\fancyfoot[C]{
\hspace{1.5mm}
\hwkaiti\zihao{-5}\buaa@university\buaa@school 学院
\hfill\hfill
\songti\zihao{-5}$\cdot$\quad\thepage\quad$\cdot$
\hspace{1.5mm}
}
% 研究生开题报告有页脚线
\renewcommand{\footrulewidth}{0.4bp}
\else
\if@twoside
\fancyhead[CO]{\zihao{-5}\songti
\buaa@university\buaa@degreehead 学位论文\vspace{1.5mm}
}
\fancyhead[CE]{\zihao{-5}\songti\leftmark\vspace{1.5mm}}
\else
\fancyhead[C]{\zihao{-5}\songti
\ifthenelse{\isodd{\value{page}}}
{\buaa@university\buaa@degreehead 学位论文}
{\leftmark}
\vspace{1.5mm}
}
\fi
\fancyfoot[C]{\zihao{5}\thepage}
\fi
\fi
\renewcommand{\headrulewidth}{0.5bp} % 页眉线宽度
}
\fancypagestyle{plain}{
\pagestyle{fancy}
}
%%%%%%%%%% title %%%%%%%%%%
% 标题
% 汉化
\renewcommand{\contentsname}{\heiti\zihao{-2}\bfseries 目\qquad 录}
\renewcommand\listfigurename{\heiti\zihao{-2}\bfseries 插\ 图\ 目\ 录}
\renewcommand\listtablename{\heiti\zihao{-2}\bfseries 表\ 格\ 目\ 录}
\renewcommand\bibname{参\ 考\ 文\ 献}
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
% 格式
\ctexset{
chapter={
format={\centering\zihao{3}\heiti},
nameformat={},
aftername={\quad},
titleformat={},
beforeskip={-.5\baselineskip},
afterskip={\baselineskip},
},
section={
aftername={\quad},
beforeskip={.5\baselineskip},
afterskip={.5\baselineskip},
},
subsection={
format={\zihao{-4}\heiti},
aftername={\quad},
beforeskip={.5\baselineskip},
afterskip={.5\baselineskip},
},
}
\ifbuaa@bachelor
\ctexset{
chapter={
name={,},
number={\arabic{chapter}},
},
section={
format={\zihao{-4}\heiti},
},
}
\else
\ctexset{
chapter={
name={第,章},
number={\chinese{chapter}},
},
section={
format={\zihao{4}\heiti},
},
}
\fi
%%%%%%%%%% contents %%%%%%%%%%
% 目录
\RequirePackage{titletoc}
\ifbuaa@bachelor
\titlecontents{chapter}[0pt]{\heiti\zihao{-4}}{\thecontentslabel\ }{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}\contentspage}
\titlecontents{section}[2em]{\vspace{0.1\baselineskip}\songti\zihao{-4}}{\thecontentslabel\ }{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}\contentspage}
\titlecontents{subsection}[4em]{\vspace{0.1\baselineskip}\songti\zihao{-4}}{\thecontentslabel\ }{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}\contentspage}
\else
\titlecontents{chapter}[0pt]{\vspace{-0.25\baselineskip}\heiti\zihao{4}}{\thecontentslabel\ }{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}{\zihao{-4}\contentspage}}[\vspace{0.07\baselineskip}]
\titlecontents{section}[2em]{\songti\zihao{-4}}{\thecontentslabel\ }{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}{\zihao{-4}\contentspage}}[\vspace{0.1\baselineskip}]
\titlecontents{subsection}[4em]{\vspace{-0.2\baselineskip}\songti\zihao{5}}{\thecontentslabel\ }{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}{\zihao{-4}\contentspage}}[\vspace{0.1\baselineskip}]
\fi
% 取消图片、表格目录中的章节空格
\newcommand*{\noaddvspace}{\renewcommand*{\addvspace}[1]{}}
\addtocontents{lof}{\protect\noaddvspace}
\addtocontents{lot}{\protect\noaddvspace}
%表目录图目录的格式设置
%表目录与图目录数字前增加“表”与“图”字,并且使目录行间距与section行间距一致
\titlecontents{figure}[0pt]{\vspace{0.15\baselineskip}\songti\zihao{-4}}{\makebox[3em][l]{图~\thecontentslabel\quad}}{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}\contentspage}[\vspace{0.15\baselineskip}]
\titlecontents{table}[0pt]{\vspace{0.15\baselineskip}\songti\zihao{-4}}{\makebox[3em][l]{表~\thecontentslabel\quad}}{}
{\hspace{.5em}\titlerule*[4pt]{$\cdot$}\contentspage}[\vspace{0.15\baselineskip}]
%%%%%%%%%% cross reference %%%%%%%%%%
% 交叉引用
\RequirePackage[xetex,unicode]{hyperref}
\ifbuaa@color
\hypersetup{colorlinks}
\else
\hypersetup{hidelinks}
\fi
\ifbuaa@ktreport
\hypersetup{
bookmarksnumbered,
bookmarksopen,
pdftitle={BUAA thesis},
pdfauthor={BHOSC},
pdfsubject={北航毕业设计开题报告/文献综述},
pdfcreator={LaTeXed~By~BHOSC}
}
\else
\hypersetup{
bookmarksnumbered,
bookmarksopen,
pdftitle={BUAA thesis},
pdfauthor={BHOSC},
pdfsubject={北航毕业设计论文},
pdfcreator={LaTeXed~By~BHOSC}
}
\fi
%%%%%%%%%% reference %%%%%%%%%%
% 参考文献
\RequirePackage[sort&compress]{natbib}
\bibpunct{[}{]}{,}{n}{}{}
\setlength{\bibsep}{0pt}
\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}}
%%%%%%%%%% table %%%%%%%%%%
% 表格
% 设置三线表格的上下边为粗实线
\RequirePackage{booktabs}
% 长表格
\RequirePackage{longtable}
% 表格中的行合并
\RequirePackage{multirow}
% 重定义table/tabular/tabularx环境,使表格内为5号字
% TODO(huxuan): 支持 longtable
\let\oldtable\table
\let\endoldtable\endtable
\renewenvironment{table}[1][h!]
{\renewcommand{\arraystretch}{1.5}
\oldtable[#1]\zihao{5}}
{\renewcommand{\arraystretch}{1}
\endoldtable}
\let\oldtabular\tabular
\let\endoldtabular\endtabular
\renewenvironment{tabular}[1][h!]
{\renewcommand{\arraystretch}{1.5}
\oldtabular[#1]\zihao{5}}
{\renewcommand{\arraystretch}{1}
\endoldtabular}
\RequirePackage{tabularx}
\let\oldtabularx\tabularx
\let\endoldtabularx\endtabularx
\renewenvironment{tabularx}[2]
{\renewcommand{\arraystretch}{1.5}
\zihao{5}\oldtabularx{#1}{#2}}
{\renewcommand{\arraystretch}{1}
\endoldtabularx}
\RequirePackage{array}
%%%%%%%%%% picture %%%%%%%%%%
% 图片
\RequirePackage{graphicx}
\graphicspath{{figure/}}
\RequirePackage{pifont} % “秘级”后的五角星
\RequirePackage{subfigure}
%%%%%%%%%% list %%%%%%%%%%
% 列表
\RequirePackage{enumitem}
\setlist{noitemsep}
\setlist[1,2]{labelindent=\parindent}
\setlist[enumerate,1]{label=\arabic*、}
\setlist[enumerate,2]{label=(\arabic*)}
\setlist{
topsep=0pt,
itemsep=0pt,
partopsep=0pt,
parsep=\parskip,
}
%%%%%%%%%% code %%%%%%%%%%
% 代码
% Listing 的设置请参考 http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
\RequirePackage{listings}
\lstset{
backgroundcolor=\color{white},
basicstyle=\zihao{5}\ttfamily,
columns=flexible,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
frame=single,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
rulecolor=\color{black},
tabsize=2,
texcl=true,
title=\lstname,
escapeinside={\%*}{*)},
extendedchars=false,
mathescape=true,
xleftmargin=3em,
xrightmargin=3em,
}
\ifbuaa@color
\lstset{
numberstyle=\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
}
\else
\lstset{
numberstyle=\color{black},
keywordstyle=\color{black},
commentstyle=\color{black},
stringstyle=\color{black},
}
\fi
% 重命名Listings标题头
\renewcommand{\lstlistingname}{代码}
%%%%%%%%%% theorem %%%%%%%%%%
% 定理
\theoremsymbol{\ensuremath{\square}}
\newtheorem*{proof}{证明}
\theoremstyle{plain}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{assumption}{假设}[chapter]
\newtheorem{definition}{定义}[chapter]
\newtheorem{proposition}{命题}[chapter]
\newtheorem{lemma}{引理}[chapter]
\newtheorem{theorem}{定理}[chapter]
\newtheorem{axiom}{公理}[chapter]
\newtheorem{corollary}{推论}[chapter]
\newtheorem{exercise}{练习}[chapter]
\newtheorem{example}{例}[chapter]
\newtheorem{remark}{注释}[chapter]
\newtheorem{problem}{问题}[chapter]
\newtheorem{conjecture}{猜想}[chapter]
%%%%%%%%%% file directory %%%%%%%%%%
% 文件目录
\RequirePackage{dirtree}
\ifbuaa@color
\renewcommand*\DTstylecomment{\ttfamily\color{dkgreen}}
\renewcommand*\DTstyle{\ttfamily\color{red}}
\fi
%%%%%%%%%% caption %%%%%%%%%%
% 图表标题
\RequirePackage{caption}
\DeclareCaptionFormat{bachelorfigure}{\songti\zihao{5}{#1\textrm{#2}#3}}
\DeclareCaptionFormat{bachelortable}{\heiti\bf\zihao{5}{#1\textrm{#2}#3}}
\DeclareCaptionFormat{bachelorlstlisting}{\songti\bf\zihao{5}{#1\textrm{#2}#3}}
\DeclareCaptionFormat{masterfigure}{\bf\songti\zihao{5}{#1\textrm{#2}#3}}
\DeclareCaptionFormat{mastertable}{\bf\songti\zihao{5}{#1\textrm{#2}#3}}
\DeclareCaptionFormat{masterlstlisting}{\bf\songti\zihao{5}{#1\textrm{#2}#3}}
\ifbuaa@bachelor
% 本科无论是否是开题报告,图表序号都和章节有关
\captionsetup[figure]{format=bachelorfigure,labelsep=quad}
\captionsetup[table]{format=bachelortable,labelsep=quad}
\captionsetup[lstlisting]{format=bachelorlstlisting,labelsep=quad}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\else
% ktreport 中图标序号跟章节相关
\ifbuaa@ktreport
\captionsetup[figure]{format=masterfigure,labelsep=quad}
\captionsetup[table]{format=mastertable,labelsep=quad}
\captionsetup[lstlisting]{format=masterlstlisting,labelsep=quad}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\else
\RequirePackage{remreset}
\@removefromreset{table}{chapter}
\@removefromreset{figure}{chapter}
%使图表的标号与章节无关
\captionsetup[figure]{format=masterfigure,labelsep=quad}
\captionsetup[table]{format=mastertable,labelsep=quad}
\captionsetup[lstlisting]{format=masterlstlisting,labelsep=quad}
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\thetable}{\arabic{table}}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\fi
\fi
% Fix subfigure reference bug
\let\p@subfigure=\thefigure
% 图片表格标题命令,主要用于混排
\newcommand\figcaption{\def\@captype{figure}\caption}
\newcommand\tabcaption{\def\@captype{table}\caption}
%%%%%%%%%% other settings %%%%%%%%%%
% 杂项
% 设置<附录>的图表编号与当前附录章号关联
\newcommand{\rmrelation}{
% 图、表、公式编号随 chapter 清零
\@addtoreset{figure}{chapter}
\@addtoreset{table}{chapter}
\@addtoreset{equation}{chapter}
%图、表、公式编号章节关联
\renewcommand{\thefigure}{\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@figure}
\renewcommand{\thetable}{\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@table}
\renewcommand{\theequation}{\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@equation}
}
\let\oldappendix\appendix
\renewcommand{\appendix}{
\oldappendix\rmrelation
}
% 下划线
\RequirePackage{ulem}
% 设置行距
\RequirePackage{setspace}
% 正文前的页码设置位大写罗马数字
\renewcommand{\frontmatter}{
\cleardoublepage
\@mainmatterfalse
\ifbuaa@bachelor
\pagenumbering{Roman}
\else
\pagenumbering{roman}
\fi
}
% 保证偶数页结束章节
\newcommand{\clearemptydoublepage}{%
\clearpage
\if@twoside
\ifodd
\c@page
\else
\hbox{}\thispagestyle{empty}\newpage
\if@twocolumn
\hbox{}\newpage
\fi
\fi
\fi
}
%%%%%%%%%% index %%%%%%%%%%
% 首页
% 本科生首页的右上角和底部的填写内容居中
% cvrtc : CoVer - Right - Top - Center
% cvcbc : CoVer - Center - Bottom - Center
\newcommand{\ulinecvrtc}[1]{\uline{\makebox[9em][c]{\bf #1}}}
\newcommand{\ulinecvcbc}[1]{\uline{\makebox[14em][c]{#1}}}
% 中文首页
\newcommand{\titlech}{
\ifbuaa@bachelor
\ifbuaa@ktreport
\begin{titlepage}
% 第二个()里的参数表示左移35pt,下移55pt
\hfill
\vskip 45bp
\begin{center}
\includegraphics[width=310bp]{figure/buaaname.pdf}
~~\\
\vskip 60bp
~~\\
\centerline{\yihao\heiti \textbf{\buaa@degree 论文\buaa@ktclass}}
~~\\
\vskip 60bp
~~\\
{
\zihao{-3}\heiti
\ifbuaa@twoteacher
\begin{tabular}{c p{0.55\textwidth}<{\raggedright}}
\hwkaiti \textbf{论文题目} : &\hwkaiti\buaa@thesistitle\\[.4ex]
\hwkaiti \textbf{专~~~~~~~~业} : &\hwkaiti\buaa@major\\[.4ex]
\hwkaiti \textbf{姓~~~~~~~~名} : &\hwkaiti\buaa@thesisauthor\\[.4ex]
\hwkaiti \textbf{学~~~~~~~~号} : &\hwkaiti\buaa@studentID\\[.4ex]
\hwkaiti \textbf{指导教师} : &\hwkaiti\buaa@teacher \quad \buaa@subteacher\\
\end{tabular}
\else
\begin{tabular}{c p{0.55\textwidth}<{\raggedright}}
\hwkaiti \textbf{论文题目} : &\hwkaiti\buaa@thesistitle\\[.4ex]
\hwkaiti \textbf{专~~~~~~~~业} : &\hwkaiti\buaa@major\\[.4ex]
\hwkaiti \textbf{姓~~~~~~~~名} : &\hwkaiti\buaa@thesisauthor\\[.4ex]
\hwkaiti \textbf{学~~~~~~~~号} : &\hwkaiti\buaa@studentID\\[.4ex]
\hwkaiti \textbf{指导教师} : &\hwkaiti\buaa@teacher\\
\end{tabular}
\fi
}
~~\\
\vskip 75bp
~~\\
\centerline{\heiti\sanhao\textbf{\buaa@university\buaa@school 学院}}
\vskip 20bp
\centerline{\heiti\zihao{-3}\buaa@thesisdateyear ~~年~~\buaa@thesisdatemonth ~~月}
\end{center}
\end{titlepage}
\else
\begin{titlepage}
% 第二个()里的参数表示左移35pt,下移55pt
\begin{picture}(0,0)(35,55)
\includegraphics[width=90pt]{figure/buaamark.pdf}
\end{picture}
\hfill
\raisebox{-.2cm}[0pt][0pt]{
\zihao{5}\heiti
\begin{tabular}{c}
单位代码~\ulinecvrtc{\bf\buaa@unicode}\\[.1ex]
学\qquad 号~\ulinecvrtc{\bf\buaa@studentID}\\[.1ex]
分~~类~~号~\ulinecvrtc{\bf\buaa@category}\\
\end{tabular}
}
\vskip 95bp
\begin{center}
\includegraphics[width=360bp]{figure/buaaname.pdf}
\vskip 45bp
\centerline{\zihao{-0}\heiti 毕业设计(论文)}
~~\\
\vspace*{\stretch{4}}
\begin{minipage}[h]{.8\textwidth}
\centering{\heiti\zihao{2}\buaa@thesistitle}
\end{minipage}
\vskip 20bp
\begin{minipage}[h]{.75\textwidth}
\centering{\heiti\zihao{3}\buaa@thesissubtitle}
\end{minipage}
\vspace*{\stretch{3}}
~~\\
{
\zihao{-3}\heiti
\ifbuaa@twoteacher
\begin{tabular}{cc}
学~~~院~~~名~~~称~~&\ulinecvcbc{\buaa@school 学院}\\[.4ex]
专~~~业~~~名~~~称~~&\ulinecvcbc{\buaa@major 专业}\\[.4ex]
学~~~生~~~姓~~~名~~&\ulinecvcbc{\buaa@thesisauthor}\\[.4ex]
指~~~导~~~教~~~师~~&\ulinecvcbc{\buaa@teacher \quad \buaa@subteacher}\\
\end{tabular}
\else
\begin{tabular}{cc}
学~~~院~~~名~~~称~~&\ulinecvcbc{\buaa@school 学院}\\[.4ex]
专~~~业~~~名~~~称~~&\ulinecvcbc{\buaa@major 专业}\\[.4ex]
学~~~生~~~姓~~~名~~&\ulinecvcbc{\buaa@thesisauthor}\\[.4ex]
指~~~导~~~教~~~师~~&\ulinecvcbc{\buaa@teacher}\\
\end{tabular}
\fi
}
\vskip 60bp
\centerline{\heiti\zihao{-3}\buaa@thesisdateyear ~~年~~\buaa@thesisdatemonth ~~月}
\end{center}
\end{titlepage}
\fi
\else
\ifbuaa@ktreport
\begin{titlepage}
% 第二个()里的参数表示左移35pt,下移55pt
\hfill
\vskip 45bp
\begin{center}
\includegraphics[width=310bp]{figure/buaaname.pdf}
~~\\
\vskip 60bp
~~\\
\centerline{\yihao\heiti \textbf{\buaa@degree 论文\buaa@ktclass}}
~~\\
\vskip 60bp
~~\\
{
\zihao{-3}\heiti
\ifbuaa@master
\ifbuaa@twoteacher
\begin{tabular}{c p{0.55\textwidth}<{\raggedright}}
\hwkaiti \textbf{题~~~~~~~~目} : &\hwkaiti\buaa@thesistitle\\[.4ex]
\hwkaiti \textbf{专~~~~~~~~业} : &\hwkaiti\buaa@major\\[.4ex]
\hwkaiti \textbf{研究方向} : &\hwkaiti\buaa@direction\\[.4ex]
\hwkaiti \textbf{研~~究~~生} : &\hwkaiti\buaa@thesisauthor\\[.4ex]
\hwkaiti \textbf{学~~~~~~~~号} : &\hwkaiti\buaa@studentID\\[.4ex]
\hwkaiti \textbf{指导教师} : &\hwkaiti\buaa@teacher \quad \buaa@subteacher\\
\end{tabular}
\else
\begin{tabular}{c p{0.55\textwidth}<{\raggedright}}
\hwkaiti \textbf{题~~~~~~~~目} : &\hwkaiti\buaa@thesistitle\\[.4ex]
\hwkaiti \textbf{专~~~~~~~~业} : &\hwkaiti\buaa@major\\[.4ex]
\hwkaiti \textbf{研究方向} : &\hwkaiti\buaa@direction\\[.4ex]
\hwkaiti \textbf{研~~究~~生} : &\hwkaiti\buaa@thesisauthor\\[.4ex]
\hwkaiti \textbf{学~~~~~~~~号} : &\hwkaiti\buaa@studentID\\[.4ex]
\hwkaiti \textbf{指导教师} : &\hwkaiti\buaa@teacher\\
\end{tabular}
\fi
\else
\ifbuaa@twoteacher
\begin{tabular}{c p{0.55\textwidth}<{\raggedright}}
\hwkaiti \textbf{题~~~~~~~~目} : &\hwkaiti\buaa@thesistitle\\[.4ex]
\hwkaiti \textbf{专~~~~~~~~业} : &\hwkaiti\buaa@major\\[.4ex]
\hwkaiti \textbf{研究方向} : &\hwkaiti\buaa@direction\\[.4ex]
\hwkaiti \textbf{博~~士~~生} : &\hwkaiti\buaa@thesisauthor\\[.4ex]
\hwkaiti \textbf{学~~~~~~~~号} : &\hwkaiti\buaa@studentID\\[.4ex]
\hwkaiti \textbf{指导教师} : &\hwkaiti\buaa@teacher \quad \buaa@subteacher\\
\end{tabular}
\else
\begin{tabular}{c p{0.55\textwidth}<{\raggedright}}
\hwkaiti \textbf{题~~~~~~~~目} : &\hwkaiti\buaa@thesistitle\\[.4ex]
\hwkaiti \textbf{专~~~~~~~~业} : &\hwkaiti\buaa@major\\[.4ex]
\hwkaiti \textbf{研究方向} : &\hwkaiti\buaa@direction\\[.4ex]
\hwkaiti \textbf{博~~士~~生} : &\hwkaiti\buaa@thesisauthor\\[.4ex]
\hwkaiti \textbf{学~~~~~~~~号} : &\hwkaiti\buaa@studentID\\[.4ex]
\hwkaiti \textbf{指导教师} : &\hwkaiti\buaa@teacher\\
\end{tabular}
\fi
\fi
}
~~\\
\vskip 75bp
~~\\
\centerline{\heiti\sanhao\textbf{\buaa@university\buaa@school 学院}}
\vskip 20bp
\centerline{\heiti\zihao{-3}\buaa@thesisdateyear ~~年~~\buaa@thesisdatemonth ~~月}
\end{center}
\end{titlepage}
\else
\begin{titlepage}
\begin{center}
\begin{spacing}{1.5}
{
\zihao{5}\heiti\bfseries
\begin{flushleft}
中图分类号:\buaa@category \\
论\,\,文\,\,编\,\,号:\buaa@thesisID\\
\ifbuaa@classfied
\buaa@clevel\ding{73}~~\buaa@climit \\
\else
\vskip 20bp
\fi
\end{flushleft}
}
\vskip 60bp
\includegraphics[width=.5\textwidth]{figure/buaaname_ch.pdf}
\vskip 30bp
\centerline{\zihao{0}\ziju{0.2}\hwxingkai\buaa@degree 论文}
~~\\
%\vskip 100bp
\vspace*{\stretch{5}}
\begin{minipage}[h]{.85\textwidth}
\begin{spacing}{3}
% actually, it should be 1.5, but I think 3 will be prefect.
\centering{\xiaochuhao\songti\bfseries\buaa@thesistitle}
\end{spacing}
\end{minipage}
%\vspace{5bp}
% the space between title and subtitle, however, it seems doesn't work.
\begin{minipage}[h]{.75\textwidth}
\begin{spacing}{1.5}
\centering{\heiti\zihao{3}\buaa@thesissubtitle}
\end{spacing}
\end{minipage}
\vspace*{\stretch{4}}
~~\\
%\vskip 80bp
{
\heiti\zihao{4}\ziju{0.2}
\ifbuaa@twoteacher
\begin{tabular}[b]{ll}
作~~者~~姓~~名~~ & \buaa@thesisauthor\\[.3ex]
\ifbuaa@professional
专~~业~~名~~称~~ & \buaa@major\\[.3ex]
\else
学~~科~~专~~业~~ & \buaa@major\\[.3ex]
\fi
指~~导~~教~~师~~ & \buaa@teacher\quad\buaa@teacherdegree\\[.3ex]
~~ & \buaa@subteacher\quad\buaa@subteacherdegree\\[.3ex]
培~~养~~学~~院~~ & \buaa@school 学院\\
\end{tabular}
\else
\begin{tabular}[b]{ll}
作~~者~~姓~~名~~ & \buaa@thesisauthor\\[.4ex]
\ifbuaa@professional
专~~业~~名~~称~~ & \buaa@major\\[.4ex]
\else
学~~科~~专~~业~~ & \buaa@major\\[.4ex]
\fi
指~~导~~教~~师~~ & \buaa@teacher \quad\buaa@teacherdegree\\[.4ex]
培~~养~~学~~院~~ & \buaa@school 学院\\
\end{tabular}
\fi
}
\end{spacing}
\end{center}
\end{titlepage}
\fi
\fi
}
% 英文首页
\newcommand{\titleeng}{
\clearemptydoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{center}
\begin{minipage}[h]{.8\textwidth}
\begin{spacing}{2}
\centering{\zihao{-2}\textbf{\buaa@thesistitleeng}}
\end{spacing}
\end{minipage}
\vskip 20bp
\begin{minipage}[h]{.75\textwidth}
\centering{\zihao{-3}\buaa@thesissubtitleeng}
\end{minipage}
\vspace*{\stretch{1}}
~~\\
{\zihao{4}A Dissertation Submitted for the Degree of \buaa@degreeeng}\\
\vskip 110bp
\begin{center}
\zihao{-3}
\ifbuaa@twoteacher
\begin{tabular}{ll}
\textbf{Candidate:\ }&\textbf{\buaa@thesisauthoreng}\\[0.5ex]
\textbf{Supervisor:\ }&\textbf{\buaa@teacherdegreeeng ~~\buaa@teachereng}\\
~~ & \textbf{\buaa@subteacherdegreeeng ~~\buaa@subteachereng}\\
\end{tabular}
\else
\begin{tabular}{ll}
\textbf{Candidate:\ }&\textbf{\buaa@thesisauthoreng}\\[0.5ex]
\textbf{Supervisor:\ }&\textbf{\buaa@teacherdegreeeng ~~\buaa@teachereng}\\
\end{tabular}
\fi
\end{center}
\vskip 125bp
\zihao{3}{
\buaa@schooleng \\[1.8ex]
\buaa@universityeng , Beijing, China}
\end{center}
}
%%%%%%%%%% abstract %%%%%%%%%%
% 摘要
% 中文摘要
\newenvironment{cabstract}{%
\newpage
\vspace*{2bp}
\ifbuaa@bachelor
\begin{center}
\begin{minipage}[h]{.75\textwidth}
\centering{\zihao{3}\heiti\buaa@thesistitle}
\end{minipage}
\begin{minipage}[h]{.8\textwidth}
\begin{flushright}
{\zihao{3}\heiti\buaa@thesissubtitle}
\end{flushright}
% subtitle should be flush right?
\end{minipage}
\end{center}
%\vskip 10bp
\begin{flushright}
\ifbuaa@twoteacher
{\begin{tabular}{cl}
学\qquad 生:&\buaa@thesisauthor\\
指导教师:&\buaa@teacher\\
~~ & \buaa@subteacher\\
% I don't know is this corrent and properly.
\end{tabular}}
\else
{\begin{tabular}{cl}
学\qquad 生:&\buaa@thesisauthor\\
指导教师:&\buaa@teacher\\
\end{tabular}}
\fi
\end{flushright}
\fi
\centerline{\heiti\zihao{3} 摘~~~~要}
\ifbuaa@bachelor
\vskip 10bp
\par
\else
\vspace{5ex}
\fi
\setlength{\parindent}{24bp}
}{%
\vskip 21bp
\ifbuaa@bachelor
\noindent
\fi
{\heiti\zihao{-4} 关键词:}\heiti\buaa@ckeyword
}
% 英文摘要
\newenvironment{eabstract}{%
\newpage
\vspace*{2bp}
\ifbuaa@bachelor
\begin{center}
\begin{minipage}[h]{.75\textwidth}
\centering{\bf\zihao{3}\buaa@thesistitleeng}
\end{minipage}
\begin{minipage}[h]{.8\textwidth}
\begin{flushright}
{\zihao{3}\heiti\buaa@thesissubtitleeng}
\end{flushright}
% subtitle should be flushright?
\end{minipage}
\end{center}
\vskip 10bp
\begin{flushright}
\ifbuaa@twoteacher
{\begin{tabular}{rl}
Author:\ &\buaa@thesisauthoreng\\
Tutor:\ &\buaa@teachereng\\
~~ & \buaa@subteachereng\\
\end{tabular}}
\else
{\begin{tabular}{rl}
Author:\ &\buaa@thesisauthoreng\\
Tutor:\ &\buaa@teachereng\\
\end{tabular}}
\fi
\end{flushright}
\fi
\centerline{\bf\zihao{3} Abstract}
\ifbuaa@bachelor
\vskip 10bp
\par
\else
\vspace{5ex}
\fi
\setlength{\parindent}{24bp}
}{%
\vskip 21bp
\ifbuaa@bachelor
\noindent
\fi
{\bf\zihao{-4} Key words: }\buaa@ekeyword
}
%%%%%%%%%% announce %%%%%%%%%%
% 本科生声明页
\newcommand{\announce}{%
\clearemptydoublepage
\thispagestyle{empty}
\vspace*{54bp}
\centerline{\bf\zihao{-2}\songti 本人声明}
\vskip 27bp
\zihao{4}我声明,本论文及其研究工作是由本人在导师指导下独立完成的,在完成论文时所利用的一
切资料均已在参考文献中列出。\par
\vskip 63bp
\zihao{-4}
\hfill