forked from hellckt/SHMTUThesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shmtuthesis.cls
1035 lines (982 loc) · 30.6 KB
/
shmtuthesis.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
%
% Email: hellckt@126.com
% Maintainer: hellckt
%
% Copyright (C) 2009-2017 by weijianwen <weijianwen@gmail.com>
% (C) 2018-2019 by SJTUG
% (C) 2020-2020 by hellckt <hellckt@126.com>
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% TODO: 明确 LaTeX2e 版本日期
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{shmtuthesis}[2020/01/22 0.0.1 Shanghai Maritime University Thesis Template]
\def\shmtuthesis{SHMTU\textsc{thesis}}
\def\version{0.0.1}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=shmtu,
prefix=shmtu@,
setkeys=\kvsetkeys
}
% 学位论文类型,目前仅支持硕士论文
\DeclareStringOption[master]{degree}[master]
% 语言类型
\DeclareStringOption[chinese]{language}[chinese]
% 字号
\DeclareStringOption[-4]{zihao}[-4]
% 拉丁文设置
\DeclareStringOption[all]{setlatinfont}[all]
% 数学样式
\DeclareStringOption[GB]{mathstyle}[GB]
% 参考文献样式
\DeclareStringOption[gb7714-2015]{bibstyle}[gb7714-2015]
% 是否盲审,默认为:False
\DeclareBoolOption{review}
\DeclareDefaultOption{
\PassOptionsToClass{\CurrentOption}{ctexbook}
}
\ProcessKeyvalOptions*
\newcommand{\shmtu@validate@key}[1]{%
\@ifundefined{shmtu@#1@\csname shmtu@#1\endcsname true}{%
\ClassError{shmtuthesis}{Invalid value '\csname shmtu@#1\endcsname'}{}%
}{%
\csname shmtu@#1@\csname shmtu@#1\endcsname true\endcsname
}%
}
\newif\ifshmtu@degree@master
\shmtu@validate@key{degree}
\newif\ifshmtu@language@chinese
\newif\ifshmtu@language@english
\shmtu@validate@key{language}
\newif\ifshmtu@setlatinfont@none
\newif\ifshmtu@setlatinfont@main
\newif\ifshmtu@setlatinfont@math
\newif\ifshmtu@setlatinfont@all
\shmtu@validate@key{setlatinfont}
\ifshmtu@setlatinfont@all
\shmtu@setlatinfont@maintrue
\shmtu@setlatinfont@mathtrue
\fi
\newif\ifshmtu@mathstyle@GB
\@ifundefined{shmtu@mathstyle@\csname shmtu@mathstyle\endcsname true}{}{%
\shmtu@mathstyle@GBtrue
\def\shmtu@mathstyle{ISO}
}%
\ifshmtu@language@english
\PassOptionsToClass{scheme=plain}{ctexbook}
\fi
\PassOptionsToPackage{no-math}{fontspec}
\PassOptionsToPackage{math-style=\shmtu@mathstyle}{unicode-math}
\LoadClass[a4paper, zihao=\shmtu@zihao, linespread=1.3, UTF8]{ctexbook}
\ifshmtu@degree@master
\AtEndOfClass{\input{shmtuthesis-graduate.ltx}}
\fi
% 依赖库
\RequirePackage{etoolbox}
\RequirePackage{xparse} % 提供\NewDocumentCommand命令
\RequirePackage{environ}
\RequirePackage{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{pageslts}
\RequirePackage{amsmath}
\ifshmtu@setlatinfont@math
\RequirePackage{unicode-math}
\fi
\RequirePackage{anyfontsize}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{array}
\RequirePackage{booktabs}
\RequirePackage{longtable}
\RequirePackage{caption}
\RequirePackage[list=off]{bicaption}
\RequirePackage{subcaption}
\RequirePackage[backend=biber, style=\shmtu@bibstyle]{biblatex}
\RequirePackage{titletoc}
\RequirePackage[titles]{tocloft}
\RequirePackage[inline]{enumitem}
\RequirePackage[perpage, bottom]{footmisc}
\RequirePackage{pdfpages}
\includepdfset{fitpaper=true}
\RequirePackage{hyperref}
\newcommand{\shmtu@def@term}[1]{%
\expandafter\gdef\csname #1\endcsname##1{%
\expandafter\gdef\csname shmtu@value@#1\endcsname{##1}}
\csname #1\endcsname{}
\define@key{shmtuvalue}{#1}{\csname #1\endcsname{##1}}}
\shmtu@def@term{degreecategory}
\shmtu@def@term{title}
\shmtu@def@term{entitle}
\shmtu@def@term{author}
\shmtu@def@term{enauthor}
\shmtu@def@term{supervisor}
\shmtu@def@term{ensupervisor}
\shmtu@def@term{studentid}
\shmtu@def@term{finisheddate}
\shmtu@def@term{major}
\shmtu@def@term{enmajor}
\shmtu@def@term{keywords}
\shmtu@def@term{enkeywords}
\NewDocumentCommand\shmtuSetInfo{}{\setkeys{shmtuvalue}}
\newcommand{\shmtu@def@label}[2]{%
\expandafter\gdef\csname shmtu@label@#1\endcsname{#2}
\define@key{shmtulabel}{#1}{%
\expandafter\gdef\csname shmtu@label@#1\endcsname{##1}}}
\shmtu@def@label{schoolChi}{上海海事大学}
\shmtu@def@label{schoolEng}{Shanghai Maritime University}
\shmtu@def@label{originalityChi}{论文独创性声明}
\shmtu@def@label{originalityEng}{Declaration of Originality}
\shmtu@def@label{authorizationChi}{论文使用授权声明}
\shmtu@def@label{authorizationEng}{Declaration of Authorization}
\shmtu@def@label{origtitle}{\shmtu@label@originalityChi}
\shmtu@def@label{authtitle}{\shmtu@label@authorizationChi}
\shmtu@def@label{origbody}{%
本论文是我个人在导师指导下进行的研究工作及取得的研究成果。
论文中除了特别加以标注和致谢的地方外,不包含其他人或者其他机构
已经发表或撰写过的研究成果。其他同志对本研究的启发和所做的贡献
均已在论文中作了明确的声明并表示了感谢。}
\shmtu@def@label{authbody}{%
本人同意上海海事大学有关保留、使用学位论文的规定,即:学校
有权保留送交论文复印件,允许论文被查阅和借阅;学校可以上网公布
论文的全部和部分内容,可以采用影印、缩印或者其他复制手段保存论
文。保密的论文在解密后遵守此规定。}
\shmtu@def@label{abstractChi}{摘\quad 要}
\shmtu@def@label{abstractEng}{Abstract}
\shmtu@def@label{keywordsChi}{关键词:}
\shmtu@def@label{keywordsEng}{Key words:~}
\ifshmtu@language@english
\shmtu@def@label{titlepage}{Title Page}
\def\shmtu@label@originality{\shmtu@label@originalityEng}
\def\shmtu@label@authorization{\shmtu@label@authorizationEng}
\def\shmtu@label@abstract{\shmtu@label@abstractEng}
\shmtu@def@label{contents}{Contents}
\shmtu@def@label{figure}{Figure}
\shmtu@def@label{listfigure}{List of Figures}
\shmtu@def@label{table}{Table}
\shmtu@def@label{listtable}{List of Tables}
\shmtu@def@label{algorithm}{Algorithm}
\shmtu@def@label{listalgorithm}{List of Algorithms}
\shmtu@def@label{nomenclature}{Nomenclature}
\shmtu@def@label{acknowledgements}{Acknowledgements}
\shmtu@def@label{publications}{Publications}
\shmtu@def@label{patents}{Patents}
\shmtu@def@label{projects}{Projects}
\shmtu@def@label{awards}{Awards}
\else
\shmtu@def@label{titlepage}{扉页}
\def\shmtu@label@originality{\shmtu@label@originalityChi}
\def\shmtu@label@authorization{\shmtu@label@authorizationChi}
\def\shmtu@label@abstract{\shmtu@label@abstractChi}
\shmtu@def@label{contents}{目\quad 录}
\shmtu@def@label{figure}{图}
\shmtu@def@label{listfigure}{图目录}
\shmtu@def@label{table}{表}
\shmtu@def@label{listtable}{表目录}
\shmtu@def@label{algorithm}{算法}
\shmtu@def@label{listalgorithm}{算法目录}
\shmtu@def@label{nomenclature}{主要符号对照表}
\shmtu@def@label{acknowledgements}{致\quad 谢}
\shmtu@def@label{publications}%
{攻读\shmtu@label@degreetypeChi 学位期间已发表或录用的论文}
\shmtu@def@label{patents}%
{攻读\shmtu@label@degreetypeChi 学位期间申请的专利}
\shmtu@def@label{projects}%
{攻读\shmtu@label@degreetypeChi 学位期间参与的项目}
\shmtu@def@label{awards}%
{攻读\shmtu@label@degreetypeChi 学位期间获奖情况}
\fi
\NewDocumentCommand\shmtuSetLabel{}{\setkeys{shmtulabel}}
\newif\ifshmtu@xitsnew
\@ifpackagelater{fontspec}{2017/01/20}{
\IfFontExistsTF{XITSMath-Regular.otf}{
\shmtu@xitsnewtrue
}{}
}{}
\ifshmtu@setlatinfont@main
\ifshmtu@xitsnew
\setmainfont{XITS}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
UprightFeatures = { SmallCapsFont = texgyretermes-regular },
BoldFeatures = { SmallCapsFont = texgyretermes-bold },
ItalicFeatures = { SmallCapsFont = texgyretermes-italic },
BoldItalicFeatures = { SmallCapsFont = texgyretermes-bolditalic },
SmallCapsFeatures = { Letters = SmallCaps }
]
\else
\setmainfont{xits}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
UprightFeatures = { SmallCapsFont = texgyretermes-regular },
BoldFeatures = { SmallCapsFont = texgyretermes-bold },
ItalicFeatures = { SmallCapsFont = texgyretermes-italic },
BoldItalicFeatures = { SmallCapsFont = texgyretermes-bolditalic },
SmallCapsFeatures = { Letters = SmallCaps }
]
\fi
\RequirePackage[opentype, scaled=.9]{sourcesanspro}
\RequirePackage[opentype, scaled=.9]{sourcecodepro}
\fi
\ifshmtu@setlatinfont@math
\ifshmtu@xitsnew
\setmathfont{XITSMath-Regular}[
Extension = .otf,
BoldFont = XITSMath-Bold,
StylisticSet = 8
]
\setmathfont{XITSMath-Regular.otf}[range={cal,bfcal},StylisticSet=1]
\else
\setmathfont{xits-math}[
Extension = .otf,
BoldFont = *bold,
StylisticSet = 8
]
\setmathfont{xits-math.otf}[range={cal, bfcal}, StylisticSet=1]
\fi
\fi
\patchcmd\cleardoublepage%
{\newpage}{\thispagestyle{empty}\newpage}
{}{}
\patchcmd\chapter%
{\thispagestyle{\CTEX@chapter@pagestyle}}{}
{}{}
\AtBeginDocument{%
\pagenumbering{Alph}
\pagestyle{empty}}
% CTEX设置
\ctexset{%
contentsname = \shmtu@label@contents,
listfigurename = \shmtu@label@listfigure,
listtablename = \shmtu@label@listtable}
\ctexset{%
chapter={%
format = \zihao{3}\heiti\centering,
nameformat = {},
titleformat = {},
aftername = \quad,
afterindent = true,
beforeskip = 1ex,
afterskip = 2ex
},
section={%
format = \zihao{4}\heiti,
afterindent = true,
afterskip = 1ex \@plus .2ex
},
subsection={%
format = \zihao{-4}\heiti,
afterindent = true,
afterskip = 1ex \@plus .2ex
},
subsubsection={%
format = \zihao{-4}\normalfont,
afterindent = true,
afterskip = 1ex \@plus .2ex
},
paragraph/afterindent = true,
subparagraph/afterindent = true}
\ctexset{%
punct = quanjiao,
space = auto,
autoindent = true}
% 解决 MAC OS 中没有隶书、幼园的问题,需要先下载字体。
\ifdef{\lishu}{}{%
\setCJKfamilyfont{zhli}{LiSu}
\newcommand*{\lishu}{\CJKfamily{zhli}}
}
\ifdef{\youyuan}{}{%
\setCJKfamilyfont{youyuan}{YouYuan}
\newcommand*{\youyuan}{\CJKfamily{youyuan}}
}
\AtEndOfClass{\sloppy}
% 有序和无序列表设置
\setlist{nosep}
\setlist*{leftmargin=*}
\setlist[1]{labelindent=\parindent}
\setcounter{secnumdepth}{3}
% 目录样式设置
\setcounter{tocdepth}{2}
\renewcommand{\cftdotsep}{1} % 目录中间点的间隔因子,越小越密
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{}% <above-code>
{\thecontentslabel}% <numbered-entry-format>
{}% <numberless-entry-format>
{~\cftdotfill{\cftdot}\contentspage}% <filler-page-format>
\titlecontents{section}% <section-type>
[2em{}]% <left>
{}% <above-code>
{\thecontentslabel\hspace{.5em}}% <numbered-entry-format>
{}% <numberless-entry-format>
{~\cftdotfill{\cftdot}\contentspage}% <filler-page-format>
\titlecontents{subsection}% <section-type>
[4em{}]% <left>
{}% <above-code>
{\thecontentslabel\hspace{.5em}}% <numbered-entry-format>
{}% <numberless-entry-format>
{~\cftdotfill{\cftdot}\contentspage}% <filler-page-format>
\titlecontents{subsubsection}% <section-type>
[2em{}]% <left>
{}% <above-code>
{\thecontentslabel\hspace{.5em}}% <numbered-entry-format>
{}% <numberless-entry-format>
{~\cftdotfill{\cftdot}\contentspage}% <filler-page-format>
% 目录
\renewcommand{\tableofcontents}{%
\cleardoublepage%
\pdfbookmark[0]{\contentsname}{toc}%
\addcontentsline{toc}{chapter}{\contentsname}
\chapter*{\contentsname}%
\@mkboth{\contentsname}{\contentsname}%
\@starttoc{toc}
}
% 图片索引目录
\renewcommand{\listoffigures}{%
\cleardoublepage%
\pdfbookmark[0]{\listfigurename}{lof}%
\addcontentsline{toc}{chapter}{\listfigurename}
\chapter*{\listfigurename}%
\@mkboth{\listfigurename}{\listfigurename}%
\@starttoc{lof}
}
% 表格索引
\renewcommand{\listoftables}{%
\cleardoublepage%
\pdfbookmark[0]{\listtablename}{lot}%
\addcontentsline{toc}{chapter}{\listtablename}
\chapter*{\listtablename}%
\@mkboth{\listtablename}{\listtablename}%
\@starttoc{lot}
}
% 图片、表格题注设置
\renewcommand{\cftfigpresnum}{\shmtu@label@figure~}
\renewcommand{\cfttabpresnum}{\shmtu@label@table~}
\AtEndPreamble{%
\newlength{\shmtu@cftfignumwidth@tmp}
\settowidth{\shmtu@cftfignumwidth@tmp}{\cftfigpresnum}
\addtolength{\cftfignumwidth}{\shmtu@cftfignumwidth@tmp}
\newlength{\shmtu@cfttabnumwidth@tmp}
\settowidth{\shmtu@cfttabnumwidth@tmp}{\cfttabpresnum}
\addtolength{\cfttabnumwidth}{\shmtu@cfttabnumwidth@tmp}
}
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
\AtBeginDocument{%
\renewcommand{\theequation}{\thechapter--\arabic{equation}}
\renewcommand{\thefigure}{\thechapter--\arabic{figure}}
\renewcommand{\p@subfigure}{\thefigure}
\renewcommand{\thetable}{\thechapter--\arabic{table}}
}
% 图表双题注
\newif\ifshmtu@setfloatfont
\renewcommand{\@floatboxreset}{%
\reset@font
\ifshmtu@setfloatfont
\zihao{5}
\else
\normalsize
\fi
\@setminipage
}
\BeforeBeginEnvironment{longtable}
{\begingroup\ifshmtu@setfloatfont\zihao{5}\fi}
\AfterEndEnvironment{longtable}
{\endgroup}
\NewDocumentCommand{\shmtuSetFloatFontOn}{}{\shmtu@setfloatfonttrue}
\NewDocumentCommand{\shmtuSetFloatFontOff}{}{\shmtu@setfloatfontfalse}
\DeclareCaptionFont{shmtucaptionfont}{\zihao{5}\kaishu}
\DeclareCaptionFont{shmtusubcaptionfont}{\zihao{5}\normalfont}
\captionsetup{%
format = plain,
labelformat = simple,
labelsep = space,
justification = centering,
font = shmtucaptionfont
}
\captionsetup[sub]{%
format = hang,
labelformat = parens,
labelsep = space,
justification = justified,
font = shmtusubcaptionfont
}
\DeclareCaptionOption{bi-first}[]{%
\def\tablename{\shmtu@label@table}
\def\figurename{\shmtu@label@figure}}
\DeclareCaptionOption{bi-second}[]{%
\def\tablename{Table}
\def\figurename{Figure}}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
% 数学符号样式设置
\ifshmtu@mathstyle@GB
\let\mathellipsis\cdots
\AtBeginDocument{%
\renewcommand{\Re}{\operatorname{Re}}%
\renewcommand{\Im}{\operatorname{Im}}%
}
\fi
\newcommand\upe{\mathrm{e}}
\newcommand\upi{\mathrm{i}}
\newcommand\upj{\mathrm{j}}
\newcommand\dif{\mathop{}\!\mathrm{d}}
% 保密选项
\newcommand{\shmtu@square}{%
\begingroup\CJKfamily+{zhsong}\symbol{"25A1}\endgroup
}
\newcommand{\shmtu@authconf}{%
\par\hspace{7em}%
{\heiti 保\quad 密}~\shmtu@square,在 \uline{\hspace{3em}}
年解密后适用本授权书。\par
本论文属于
\par\hspace{7em}%
{\heiti 不保密}~\shmtu@square。
\vskip 1ex
(请在以上方框内打“$\checkmark$”)
}
% 签名框
\newcommand{\shmtu@signbox}[2][作者]{%
\makebox[\textwidth][r]{%
#1 签名:\underline{\hbox to 4em{}}%
\ifthenelse{\equal{#2}{作者}}%
{}{#2 签名:\underline{\hbox to 4em{}}}%
日期:\underline{\hbox to 4em{}}%
}
}
% 原创性声明
\NewDocumentCommand{\makeDeclareOriginality}{o}{%
\ifshmtu@review
\relax
\else
\pdfbookmark[0]{\shmtu@label@originality}{origtitle}
\IfNoValueTF{#1}{%
\thispagestyle{empty}
\chapter*{\normalfont\zihao{3}\songti\shmtu@label@origtitle}
\begingroup
\zihao{4}
\shmtu@label@origbody
\vskip 10ex
\noindent
\shmtu@signbox{作者}
\endgroup
}
{\includepdf[pagecommand={\thispagestyle{empty}}]{#1}}
\fi
}
% 使用授权书
\NewDocumentCommand{\makeDeclareAuthorization}{o}{%
\ifshmtu@review
\relax
\else
\pdfbookmark[0]{\shmtu@label@authorization}{authtitle}
\IfNoValueTF{#1}{%
\thispagestyle{empty}
\vskip 16ex
{\let\clearpage\relax\par\chapter*{\normalfont\zihao{3}\songti\shmtu@label@authtitle}}
\begingroup
\zihao{4}
\shmtu@label@authbody
%\vskip 1ex
%\shmtu@authconf
\vskip 10ex
\noindent
\shmtu@signbox{导师}
\endgroup
}
{\includepdf[pagecommand={\thispagestyle{empty}}]{#1}}
\fi
}
% 主要符号对照表
\NewDocumentEnvironment{nomenclature}{m}{%
\cleardoublepage
\pdfbookmark[0]{\shmtu@label@nomenclature}{nomenclature}
\chapter*{\shmtu@label@nomenclature}
\@mkboth{\shmtu@label@nomenclature}%
{\shmtu@label@nomenclature}%
\begin{longtable}{#1}
}{\end{longtable}}
% 致谢
\newcommand{\shmtu@acknowledgements}[1]{\long\gdef\shmtu@acknowledgements@body{#1}}
\NewDocumentEnvironment{acknowledgements}{}{%
\Collect@Body\shmtu@acknowledgements
}{%
\ifshmtu@review
\relax
\else
\cleardoublepage
\chapter*{\shmtu@label@acknowledgements}
\@mkboth{\shmtu@label@acknowledgements}%
{\shmtu@label@acknowledgements}%
\addcontentsline{toc}{chapter}{\shmtu@label@acknowledgements}%
\shmtu@acknowledgements@body
\fi
}
% 清单样式
\newenvironment{shmtu@bibliolist}[2]{%
\cleardoublepage
\chapter{#2}
\@mkboth{#2}{#2}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m
}{%
\def\@noitemerr
{\@latex@warning{Empty `bibliolist' environment}}%
\endlist
}
% 攻读**学位期间已发表或录用的论文
\newcommand{\shmtu@publications}[1]{\long\gdef\shmtu@publications@body{#1}}
\NewDocumentEnvironment{publications}{O{99}}{%
\Collect@Body\shmtu@publications
}{%
\ifshmtu@review
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@publications}
\shmtu@publications@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间已发表或录用的论文【盲审】
\newcommand{\shmtu@@publications}[1]{\long\gdef\shmtu@@publications@body{#1}}
\NewDocumentEnvironment{publications*}{O{99}}{%
\Collect@Body\shmtu@@publications
}{%
\ifshmtu@review
\begin{shmtu@bibliolist}{#1}{\shmtu@label@publications}
\shmtu@@publications@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间参与的项目
\newcommand{\shmtu@projects}[1]{\long\gdef\shmtu@projects@body{#1}}
\NewDocumentEnvironment{projects}{O{99}}{%
\Collect@Body\shmtu@projects
}{%
\ifshmtu@review
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@projects}
\shmtu@projects@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间参与的项目【盲审】
\newcommand{\shmtu@@projects}[1]{\long\gdef\shmtu@@projects@body{#1}}
\NewDocumentEnvironment{projects*}{O{99}}{%
\Collect@Body\shmtu@@projects
}{%
\ifshmtu@review
\begin{shmtu@bibliolist}{#1}{\shmtu@label@projects}
\shmtu@@projects@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间申请的专利
\newcommand{\shmtu@patents}[1]{\long\gdef\shmtu@patents@body{#1}}
\NewDocumentEnvironment{patents}{O{99}}{%
\Collect@Body\shmtu@patents
}{%
\ifshmtu@review
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@patents}
\shmtu@patents@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间申请的专利【盲审】
\newcommand{\shmtu@@patents}[1]{\long\gdef\shmtu@@patents@body{#1}}
\NewDocumentEnvironment{patents*}{O{99}}{%
\Collect@Body\shmtu@@patents
}{%
\ifshmtu@review
\begin{shmtu@bibliolist}{#1}{\shmtu@label@patents}
\shmtu@@patents@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间申请的获奖情况
\newcommand{\shmtu@awards}[1]{\long\gdef\shmtu@awards@body{#1}}
\NewDocumentEnvironment{awards}{O{99}}{%
\Collect@Body\shmtu@awards
}{%
\ifshmtu@review
\relax
\else
\begin{shmtu@bibliolist}{#1}{\shmtu@label@awards}
\shmtu@awards@body
\end{shmtu@bibliolist}
\fi
}
% 攻读**学位期间申请的获奖情况【盲审】
\newcommand{\shmtu@@awards}[1]{\long\gdef\shmtu@@awards@body{#1}}
\NewDocumentEnvironment{awards*}{O{99}}{%
\Collect@Body\shmtu@@awards
}{%
\ifshmtu@review
\begin{shmtu@bibliolist}{#1}{\shmtu@label@awards}
\shmtu@@awards@body
\end{shmtu@bibliolist}
\fi
}
\AtBeginDocument{
\ifshmtu@review%
\shmtuSetInfo{%
author={***},
supervisor={***},
enauthor={***},
ensupervisor={***},
studentid={************},
finisheddate={****年**月},
}
\fi
\hypersetup{%
pdftitle = \shmtu@value@title,
pdfauthor = \shmtu@value@author,
pdfsubject = \shmtu@label@subject,
pdfkeywords = \shmtu@value@keywords,
pdfcreator = {LaTeX with SHMTUThesis \version}
}%
}
% 加密
\NewDocumentCommand{\encrypt}{m O{***}}{%
\ifshmtu@review
{#2}
\else
{#1}
\fi
}
% 自定义下划线
\newcommand{\shmtu@uline}[1]{%
\begingroup
\setbox0=\vbox{\strut #1\strut}%
\dimen0=0pt
\loop\ifdim\ht0>0pt
\dimen1=\dimexpr\ht0 - \baselineskip\relax
\setbox1=\vsplit0 to \ht\strutbox
\advance\dimen1 by -\ht0
\noindent\raisebox{-\dimen0}[\ht\strutbox][\dp\strutbox]{\box1}%
\advance\dimen0 by \dimen1
\vspace{-0.2ex}\hrule\vskip 0.2ex
\repeat
\endgroup
}
% 超链接设置
\hypersetup{
linktoc = all,
bookmarksnumbered = true,
bookmarksopen = true,
bookmarksopenlevel = 1,
unicode = true,
psdextra = true,
breaklinks = true,
plainpages = false,
hidelinks,
}
\pdfstringdefDisableCommands{%
\let\\\@empty
\let\quad\@empty
\let\hspace\@gobble
}
\urlstyle{same}
\def\UrlBreaks{%
\do\/%
\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l%
\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L%
\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
\do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:%
\do\*\do\-\do\~\do\'\do\"\do\-}
\Urlmuskip=0mu plus 0.1mu
\newcommand{\shmtu@atendpackage}{\csname ctex_at_end_package:nn\endcsname}
\shmtu@atendpackage{unicode-math}{
\newcommand{\bm}{\symbf}
\renewcommand{\boldsymbol}{\symbf}
\newcommand{\square}{\mdlgwhtsquare}
\@ifpackagelater{hyperref}{2019/04/27}{}{%
\g@addto@macro\psdmapshortnames{\let\mu\textmugreek}%
}
}
\shmtu@atendpackage{threeparttable}{
\appto\TPTnoteSettings{\footnotesize}
}
\shmtu@atendpackage{siunitx}{
\sisetup{
detect-all,
group-minimum-digits = 4,
separate-uncertainty = true,
inter-unit-product = \ensuremath{{}\cdot{}},
}
\ifshmtu@language@chinese
\sisetup{
list-final-separator = { 和 },
list-pair-separator = { 和 },
range-phrase = {~},
}
\fi
}
% 数学定理设置
\PassOptionsToPackage{amsmath, thmmarks, hyperref}{ntheorem}
\shmtu@atendpackage{ntheorem}{
\ifshmtu@language@chinese
\def\shmtu@label@assertion{断言}
\def\shmtu@label@assumption{假设}
\def\shmtu@label@axiom{公理}
\def\shmtu@label@corollary{推论}
\def\shmtu@label@definition{定义}
\def\shmtu@label@example{例}
\def\shmtu@label@lemma{引理}
\def\shmtu@label@proof{证明}
\def\shmtu@label@proposition{命题}
\def\shmtu@label@remark{注}
\def\shmtu@label@theorem{定理}
\else
\def\shmtu@label@assertion{Assertion}
\def\shmtu@label@assumption{Assumption}
\def\shmtu@label@axiom{Axiom}
\def\shmtu@label@corollary{Corollary}
\def\shmtu@label@definition{Definition}
\def\shmtu@label@example{Example}
\def\shmtu@label@lemma{Lemma}
\def\shmtu@label@proof{Proof}
\def\shmtu@label@proposition{Proposition}
\def\shmtu@label@remark{Remark}
\def\shmtu@label@theorem{Theorem}
\fi
\theoremheaderfont{\bfseries\heiti}
\theorembodyfont{\normalfont}
\theoremseparator{\enskip}
\theoremsymbol{\ensuremath{\square}}
\newtheorem*{proof}{\shmtu@label@proof}
\theoremstyle{plain}
\theoremsymbol{}
\newtheorem{theorem} {\shmtu@label@theorem} [chapter]
\newtheorem{assertion} [theorem]{\shmtu@label@assertion}
\newtheorem{axiom} [theorem]{\shmtu@label@axiom}
\newtheorem{corollary} [theorem]{\shmtu@label@corollary}
\newtheorem{lemma} [theorem]{\shmtu@label@lemma}
\newtheorem{proposition}[theorem]{\shmtu@label@proposition}
\newtheorem{assumption} {\shmtu@label@assumption} [chapter]
\newtheorem{definition} {\shmtu@label@definition} [chapter]
\newtheorem{example} {\shmtu@label@example} [chapter]
\newtheorem*{remark} {\shmtu@label@remark}
}
\shmtu@atendpackage{amsthm}{
\ifshmtu@language@chinese
\def\shmtu@label@assertion{断言}
\def\shmtu@label@assumption{假设}
\def\shmtu@label@axiom{公理}
\def\shmtu@label@corollary{推论}
\def\shmtu@label@definition{定义}
\def\shmtu@label@example{例}
\def\shmtu@label@lemma{引理}
\def\shmtu@label@proof{证明}
\def\shmtu@label@proposition{命题}
\def\shmtu@label@remark{注}
\def\shmtu@label@theorem{定理}
\else
\def\shmtu@label@assertion{Assertion}
\def\shmtu@label@assumption{Assumption}
\def\shmtu@label@axiom{Axiom}
\def\shmtu@label@corollary{Corollary}
\def\shmtu@label@definition{Definition}
\def\shmtu@label@example{Example}
\def\shmtu@label@lemma{Lemma}
\def\shmtu@label@proof{Proof}
\def\shmtu@label@proposition{Proposition}
\def\shmtu@label@remark{Remark}
\def\shmtu@label@theorem{Theorem}
\fi
\newtheoremstyle{shmtuplain}
{}{}
{\normalfont}{}
{\bfseries\heiti}{}
{\ccwd}{}
\theoremstyle{shmtuplain}
\newtheorem{theorem} {\shmtu@label@theorem} [chapter]
\newtheorem{assertion} [theorem]{\shmtu@label@assertion}
\newtheorem{axiom} [theorem]{\shmtu@label@axiom}
\newtheorem{corollary} [theorem]{\shmtu@label@corollary}
\newtheorem{lemma} [theorem]{\shmtu@label@lemma}
\newtheorem{proposition}[theorem]{\shmtu@label@proposition}
\newtheorem{assumption} {\shmtu@label@assumption} [chapter]
\newtheorem{definition} {\shmtu@label@definition} [chapter]
\newtheorem{example} {\shmtu@label@example} [chapter]
\newtheorem*{remark} {\shmtu@label@remark}
\renewcommand\proofname\shmtu@label@proof
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item\relax
{\bfseries\heiti #1~}
\hspace\labelsep\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
}
% 算法设置
\PassOptionsToPackage{algochapter}{algorithm2e}
\shmtu@atendpackage{algorithm2e}{
\SetAlgorithmName{\shmtu@label@algorithm}%
{\shmtu@label@algorithm}%
{\shmtu@label@listalgorithm}
\SetAlgoCaptionSeparator{~}
\newcommand{\cftalgpresnum}{\shmtu@label@algorithm~}
\AtEndPreamble{%
\newlength{\cftalgindent}
\setlength{\cftalgindent}{1.5em}
\newlength{\cftalgnumwidth}
\setlength{\cftalgnumwidth}{2.3em}
\newlength{\shmtu@cftalgnumwidth@tmp}
\settowidth{\shmtu@cftalgnumwidth@tmp}{\cftalgpresnum}
\addtolength{\cftalgnumwidth}{\shmtu@cftalgnumwidth@tmp}
}
\renewcommand*{\l@algocf}{%
\let\@cftbsnum \cftalgpresnum
\@dottedtocline{1}{\cftalgindent}{\cftalgnumwidth}
}
\renewcommand{\listofalgorithms}{%
\cleardoublepage%
\makeatletter
\renewcommand{\@dotsep}{\cftdotsep}
\makeatother
\pdfbookmark[0]{\listalgorithmcfname}{loa}%
\addcontentsline{toc}{chapter}{\listalgorithmcfname}
\chapter*{\listalgorithmcfname}%
\@mkboth{\listalgorithmcfname}{\listalgorithmcfname}%
\@starttoc{loa}
}
\AtBeginDocument{%
\renewcommand{\thealgocf}{\thechapter--\@arabic\c@algocf}
}
}
\shmtu@atendpackage{algorithm}{
\RequirePackage{algorithmicx, algpseudocode}
\floatname{algorithm}{\shmtu@label@algorithm}
\@addtoreset{algorithm}{chapter}
\patchcmd\@chapter%
{\if@twocolumn}
{\addtocontents{loa}{\protect\addvspace{10\p@}}%
\if@twocolumn}
{}{}
\renewcommand{\listalgorithmname}{\shmtu@label@listalgorithm}
\newcommand{\cftalgpresnum}{\shmtu@label@algorithm~}
\AtEndPreamble{%
\newlength{\cftalgindent}
\setlength{\cftalgindent}{1.5em}
\newlength{\cftalgnumwidth}
\setlength{\cftalgnumwidth}{2.3em}
\newlength{\shmtu@cftalgnumwidth@tmp}
\settowidth{\shmtu@cftalgnumwidth@tmp}{\cftalgpresnum}
\addtolength{\cftalgnumwidth}{\shmtu@cftalgnumwidth@tmp}
}
\newcommand*{\l@algorithm}{%
\let\@cftbsnum \cftalgpresnum
\@dottedtocline{1}{\cftalgindent}{\cftalgnumwidth}
}
\renewcommand{\listofalgorithms}{%
\cleardoublepage%
\makeatletter
\renewcommand{\@dotsep}{\cftdotsep}
\makeatother
\pdfbookmark[0]{\listalgorithmname}{loa}%
\addcontentsline{toc}{chapter}{\listalgorithmname}
\chapter*{\listalgorithmname}%
\@mkboth{\listalgorithmname}{\listalgorithmname}%
\@starttoc{loa}
}
\AtBeginDocument{%
\renewcommand{\thealgorithm}{\thechapter--\arabic{algorithm}}
}
}
% 代码样式设置
\shmtu@atendpackage{listings}{
\lstdefinestyle{lstStyleCode}{
aboveskip=\medskipamount,
belowskip=\medskipamount,
basicstyle=\linespread{1.25}\footnotesize\ttfamily,
commentstyle=\slshape\color{black!60},
stringstyle=\color{green!40!black!100},
keywordstyle=\bfseries\color{orange!80!black},
identifierstyle=,
extendedchars=false,
upquote=true,
tabsize=2,
showstringspaces=false,
xleftmargin=1em,
xrightmargin=1em,
breaklines=true,
breakindent=2em,
framexleftmargin=1em,
framexrightmargin=1em,
backgroundcolor=\color{gray!10},
columns=flexible,
keepspaces=true,
texcl=true,
mathescape=true
}
\lstnewenvironment{codeblock}[1][]
{\lstset{style=lstStyleCode, #1}}{}
}