summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls
blob: ff26bf84b1406976ff9682ca66a6b30b7841a87b (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
%%
%% This is file `njuthesis.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% njuthesis.dtx  (with options: `class')
%% 
%% Copyright (C) 2021
%% by Nanjing University Linux User Group <nju.lug@yaoge123.cn>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
%% To produce the documentation run the original source files ending with `.dtx'
%% through XeTeX.
%% 
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
 \GetIdInfo  $Id: njuthesis.dtx 0.9.2 2021-09-17 22:00:00 +0800  NJU LUG <nju.lug@yaoge123.cn> $
  {Thesis template for Nanjing University}
\ProvidesExplClass{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\LoadClass[
  a4paper,
  twoside,
  UTF8,
  scheme=chinese,
  linespread=1.625,
  fontset=none,
  zihao=-4
  ]{ctexbook}[2018/04/01]
\RequirePackage{l3keys2e}
\tl_new:N \l__nju_info_degree_tl
\tl_new:N \l__nju_info_type_tl
\keys_define:nn { nju }
{
  nlcover           .bool_set:N   =   \g__nju_nlcover_bool,
  nlcover           .initial:n    =   false,
}
\keys_define:nn { nju }
{
  degree            .choices:nn   =
  { ug, mg, mg, phd }
  { \tl_set_eq:NN \l__nju_info_degree_tl \l_keys_choice_tl },
  degree            .initial:n    =   ug,
  type              .choices:nn   =
  { thesis, design }
  { \tl_set_eq:NN \l__nju_info_type_tl   \l_keys_choice_tl },
  type              .initial:n    =   thesis,
}
\keys_define:nn { nju }
{
  info.meta:nn = { nju / info } { #1 }
}
\keys_define:nn { nju / info }
{
  TitleA            .tl_set:N     =   \l__nju_info_title_a_tl,
  TitleB            .tl_set:N     =   \l__nju_info_title_b_tl,
  TitleC            .tl_set:N     =   \l__nju_info_title_c_tl,
  Title*            .tl_set:N     =   \l__nju_info_title_en_tl,
}
\keys_define:nn { nju / info }
{
  Grade             .tl_set:N     =   \l__nju_info_grade_tl,
  StudentID         .tl_set:N     =   \l__nju_info_id_tl,
  StudentName       .tl_set:N     =   \l__nju_info_author_tl,
  StudentName*      .tl_set:N     =   \l__nju_info_author_en_tl,
}
\keys_define:nn { nju / info }
{
  Department        .tl_set:N     =   \l__nju_info_dept_tl,
  Department*       .tl_set:N     =   \l__nju_info_dept_en_tl,
  Major             .tl_set:N     =   \l__nju_major_tl,
  Major*            .tl_set:N     =   \l__nju_major_en_tl,
  Field             .tl_set:N     =   \l__nju_field_tl,
  Field*            .tl_set:N     =   \l__nju_field_en_tl,
}
\keys_define:nn { nju / info }
{
  SupervisorA       .tl_set:N     =   \l__nju_info_supv_a_tl,
  SupervisorA*      .tl_set:N     =   \l__nju_info_supv_a_en_tl,
  SupervisorATitle  .tl_set:N     =   \l__nju_info_supv_a_title_tl,
  SupervisorATitle* .tl_set:N     =   \l__nju_info_supv_a_title_en_tl,
}
\keys_define:nn { nju / info }
{
  SupervisorB       .tl_set:N     =   \l__nju_info_supv_b_tl,
  SupervisorB*      .tl_set:N     =   \l__nju_info_supv_b_en_tl,
  SupervisorBTitle  .tl_set:N     =   \l__nju_info_supv_b_title_tl,
  SupervisorBTitle* .tl_set:N     =   \l__nju_info_supv_b_title_en_tl,
}
\keys_define:nn { nju / info }
{
  SubmitDate        .tl_set:N     =   \l__nju_submit_date_tl,
  SubmitDate*       .tl_set:N     =   \l__nju_submit_date_en_tl,
}
\keys_define:nn { nju / info }
{
  DefendDate        .tl_set:N     =   \l__nju_defend_date_tl,
  ReviewerChairman  .tl_set:N     =   \l__nju_info_chairman_tl,
  ReviewerA         .tl_set:N     =   \l__nju_info_reviewer_a_tl,
  ReviewerB         .tl_set:N     =   \l__nju_info_reviewer_b_tl,
  ReviewerC         .tl_set:N     =   \l__nju_info_reviewer_c_tl,
  ReviewerD         .tl_set:N     =   \l__nju_info_reviewer_d_tl,
}
\keys_define:nn { nju / info }
{
  Classification    .tl_set:N     =   \l__nju_info_classif_tl,
  SecurityLevel     .tl_set:N     =   \l__nju_info_seclv_tl,
  UDC               .tl_set:N     =   \l__nju_info_udc_tl,
  SupervisorContact .tl_set:N     =   \l__nju_info_supv_cont_tl,
}
\NewDocumentCommand \njusetup { m }
{ \keys_set:nn { nju } { #1 } }
\RequirePackage[
    top=2.5cm,
    bottom=2.5cm,
    left=3.2cm,
    right=3.2cm
]{geometry}
\RequirePackage{xparse}
\RequirePackage{titletoc} % 修改目录内标题格式
\RequirePackage[hyphens]{url} % generate better linebreaks in the url
\RequirePackage{dashundergaps}
\RequirePackage{setspace}
\RequirePackage{lastpage}
\RequirePackage{emptypage} % 清除空白页的页码
\RequirePackage{listings} % 代码环境
\RequirePackage{enumitem} % 用于修改列表环境
\RequirePackage{caption}
\RequirePackage{floatrow} % 用于图表等页面元素的定位
\RequirePackage{booktabs} % 用于绘制三线表
\RequirePackage{multirow} % Cells occupying multiple rows in tables
\RequirePackage{multicol} % Multiple columns in dictionary
\RequirePackage{siunitx} % 用于书写单位符号
\RequirePackage[version=4]{mhchem} % 用于绘制分子式
\RequirePackage{hologo}

\sys_if_engine_xetex:T
{
    \RequirePackage{microtype}

    % 加中文下划线,不能用于lualatex
    \RequirePackage{xeCJKfntef}
    \cs_new:Npn \nju_underline:n #1 {\CJKunderline{#1}}
}
\sys_if_engine_luatex:T{
    % 加中文下划线
    \RequirePackage{lua-ul}
    \cs_new:Npn \nju_underline:n #1 {\underLine{#1}}

    % emoji支持
    % \RequirePackage{emoji}
    % \setemojifont{Segoe~UI~Emoji} % windows
    % \setemojifont{Apple~Color~Emoji} % macos
    % \setemojifont{Noto~Color~Emoji}
    % For windows.
    % Shipped with the best `grinning-face-with-sweat' support.
}
\RequirePackage{blindtext}
\RequirePackage{zhlipsum}
\RequirePackage{amsmath} % Must be loaded before unicode-math
\RequirePackage{amsthm} % Mathematical environments
\RequirePackage{mathtools} % Mathematical tools to use with amsmath
\RequirePackage{thmtools} % Theorem styles
\RequirePackage[
    warnings-off={% 消除与mathtools合用产生的警告
        mathtools-colon,
        mathtools-overbracket}
        ]{unicode-math} % Math fonts in xetex or luatex
\RequirePackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png}
\graphicspath{{figure/}} % 图片路径
\RequirePackage{wrapfig} % Wrap text around figures
\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref}
\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref}
\RequirePackage{fontspec}
\tl_new:N \g__nju_latin_fontset_tl
\tl_new:N \g__nju_cjk_fontset_tl
\keys_define:nn { nju }
{
  customlatinfont   .choices:nn   =
  { gyre, macos, windows, null }
  { \tl_set_eq:NN \g__nju_latin_fontset_tl \l_keys_choice_tl },
  customchinesefont .choices:nn   =
  { fandol, founder, macos, noto, windows, null }
  { \tl_set_eq:NN \g__nju_cjk_fontset_tl   \l_keys_choice_tl },
}
\ProcessKeysOptions { nju }
\bool_new:N \g__nju_load_system_fontset_bool
\tl_if_empty:NTF \g__nju_latin_fontset_tl
  { \bool_gset_true:N \g__nju_load_system_fontset_bool }
{
  \tl_if_empty:NT \g__nju_cjk_fontset_tl
    { \bool_gset_true:N \g__nju_load_system_fontset_bool }
}
\bool_if:NT \g__nju_load_system_fontset_bool
{
  % 检测是否是 Windows
  \sys_if_platform_windows:TF
  {
    \tl_set:Nn \g__nju_latin_fontset_tl { windows }
    \tl_set:Nn \g__nju_cjk_fontset_tl   { windows }
  }
  {
    % 检测是否是 macOS
    \ctex_if_platform_macos:TF
    {
      \tl_set:Nn \g__nju_latin_fontset_tl { macos }
      \tl_set:Nn \g__nju_cjk_fontset_tl   { macos }
    }
    % 其余系统一律使用自由字体
    {
      \tl_set:Nn \g__nju_latin_fontset_tl { gyre }
      \tl_set:Nn \g__nju_cjk_fontset_tl { fandol }
    }
  }
}
\cs_new_protected:Npn \__nju_load_latin_font_windows:
{
  \setmainfont{Times~New~Roman}
  \setsansfont{Arial}
  \setmonofont{Courier~New}[Scale=MatchLowercase]
}
\cs_new_protected:Npn \__nju_load_latin_font_macos:
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
}
\cs_new_protected:Npn \__nju_load_latin_font_gyre:
{
\setmainfont{texgyretermes}[
  Extension=.otf,
  UprightFont=*-regular,
  BoldFont=*-bold,
  ItalicFont=*-italic,
  BoldItalicFont=*-bolditalic]
\setsansfont{texgyreheros}[
  Extension=.otf,
  UprightFont=*-regular,
  BoldFont=*-bold,
  ItalicFont=*-italic,
  BoldItalicFont=*-bolditalic]
\setmonofont{texgyrecursor}[
  Extension=.otf,
  UprightFont=*-regular,
  BoldFont=*-bold,
  ItalicFont=*-italic,
  BoldItalicFont=*-bolditalic,
  Scale=MatchLowercase,
  Ligatures=CommonOff]
}
\cs_new_protected:Npn \__nju_load_cjk_font_windows:
{
  \setCJKmainfont{SimSun}[
    AutoFakeBold=2.17,
    ItalicFont=KaiTi]
  \setCJKsansfont{SimHei}
  \setCJKmonofont{FangSong}
  \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17]
  \setCJKfamilyfont{zhhei}{SimHei}
  \setCJKfamilyfont{zhfs}{FangSong}
  \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17]
  \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[
    BoldFont=Microsoft~YaHei~Bold]
}
\cs_new_protected:Npn \__nju_load_cjk_font_macos:
{
  % 移除 does not contain script "CJK" 警告
  \msg_redirect_name:nnn {fontspec} {no-script} {info}
  \setCJKmainfont{Songti~SC~Light}[
    BoldFont=Songti~SC~Bold,
    ItalicFont=Kaiti~SC,
    BoldItalicFont=Kaiti~SC~Bold]
  \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
  \setCJKmonofont{STFangsong}
  \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold]
  \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
  \setCJKfamilyfont{zhfs}{STFangsong}
  \setCJKfamilyfont{zhkai}{Kaiti~SC}
    [
      BoldFont=Kaiti~SC~Bold,
      % AlternateFont =
      %   {
      %   {character range1} {alternate font name1}
      %   {alternate font features2} ,
      %   ......
      %   }
    ]
  \setCJKfamilyfont{zhnewhei}{PingFang~SC}
}
\cs_new_protected:Npn \__nju_load_cjk_font_fandol:
{
  % 移除 does not contain script "CJK" 警告
  \msg_redirect_name:nnn {fontspec} {no-script} {info}
  \setCJKmainfont{FandolSong-Regular}[
    Extension=.otf,
    BoldFont=FandolSong-Bold,
    ItalicFont=FandolKai-Regular]
  \setCJKsansfont{FandolHei-Regular}[
    Extension=.otf,
    BoldFont=FandolHei-Bold]
  \setCJKmonofont{FandolFang-Regular}[Extension=.otf]
  \setCJKfamilyfont{zhsong}{FandolSong-Regular}[
    Extension=.otf,
    BoldFont=FandolSong-Bold]
  \setCJKfamilyfont{zhhei}{FandolHei-Regular}[
    Extension=.otf,
    BoldFont=FandolHei-Bold]
  \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf]
  \setCJKfamilyfont{zhkai}{FandolKai-Regular}[
    Extension=.otf,
    AutoFakeBold=2.17]
}
\cs_new_protected:Npn \__nju_load_cjk_font_founder:
{
  \setCJKmainfont{FZSSK}[% 方正书宋
    Extension=.ttf,
    BoldFont=FZXBSK,% 方正小标宋
    ItalicFont=FZKTK]% 方正楷体
  \setCJKsansfont{FZXH1K}[% 方正细黑一
    Extension=.ttf,
    BoldFont=FZHTK]% FZHTK 方正黑体
  \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋
  \setCJKfamilyfont{zhsong}
    {FZSSK}[
      Extension=.ttf,
      BoldFont=FZXBSK]
  \setCJKfamilyfont{zhhei}
    {FZHTK}[
      Extension=.ttf,
      AutoFakeBold=2.17]
  \setCJKfamilyfont{zhfs}
    {FZFSK}[Extension=.ttf]
  \setCJKfamilyfont{zhkai}
    {FZKTK}[Extension=.ttf]
  \setCJKfamilyfont{zhnewhei}
    {FZYouHK_508R}[% 方正悠黑508R
      Extension=.ttf,
      BoldFont=FZYouHK_511M]% 方正悠黑511M
}
\cs_new_protected:Npn \__nju_load_cjk_font_noto:
{
  % 思源宋体
  \setCJKmainfont[
    UprightFont=NotoSerifCJKsc-Regular,
    BoldFont=NotoSerifCJKsc-Bold,
    ItalicFont=NotoSerifCJKsc-Regular,
    BoldItalicFont=NotoSerifCJKsc-Bold,
    ItalicFeatures=FakeSlant,
    BoldItalicFeatures=FakeSlant]{Noto~Serif~CJK~SC}

  % 思源黑体
  \setCJKsansfont[
    UprightFont=NotoSansCJKsc-Regular,
    BoldFont=NotoSansCJKsc-Bold,
    ItalicFont=NotoSansCJKsc-Regular,
    BoldItalicFont=NotoSansCJKsc-Bold,
    ItalicFeatures=FakeSlant,
    BoldItalicFeatures=FakeSlant]{Noto~Sans~CJK~SC}

  % 包含于思源黑体
  \setCJKmonofont[
    UprightFont=NotoSansMonoCJKsc-Regular,
    BoldFont=NotoSansMonoCJKsc-Bold,
    ItalicFont=NotoSansMonoCJKsc-Regular,
    BoldItalicFont=NotoSansMonoCJKsc-Bold,
    ItalicFeatures=FakeSlant,
    BoldItalicFeatures=FakeSlant]{Noto~Sans~Mono~SC}

  \setCJKfamilyfont{zhsong}{Noto~Serif~CJK~SC}
  \setCJKfamilyfont{zhhei}{Noto~Sans~CJK~SC}
  \setCJKfamilyfont{zhfs}{方正仿宋简体}[AutoFakeBold=2.17]
  \setCJKfamilyfont{zhkai}{方正楷体简体}[AutoFakeBold=2.17]
}
\cs_new_protected:Npn \__nju_load_font:
{
  \use:c { __nju_load_latin_font_ \g__nju_latin_fontset_tl : }
  \use:c { __nju_load_cjk_font_   \g__nju_cjk_fontset_tl   : }

  \NewDocumentCommand\songti{}{\CJKfamily{zhsong}}
  \NewDocumentCommand\heiti{}{\CJKfamily{zhhei}}
  \NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}}
  \NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}}
}
\__nju_load_font:
\setmathfont{XITSMath-Regular}[
  BoldFont = XITSMath-Bold,
  Extension = .otf]
\RequirePackage{fancyhdr} % 调整页眉页脚
\fancypagestyle{njuplain}{%
   \fancyhead{}
   \fancyfoot[C]{\zihao{5}\thepage} % 页脚居中 五号新罗马体数字
}
\fancypagestyle{njuheadings}{%
   \fancyhead{}
   \fancyfoot[C]{\zihao{5}\thepage}
}
\str_if_eq:NNTF {\l__nju_info_degree_tl} { ug }
{
  % the header line
  \tl_set:Nn \headrulewidth {0pt}
  % the footer line
  \tl_set:Nn \footrulewidth {0pt}

  \AtBeginDocument{\pagestyle{njuplain}} % 本科无页眉页脚
}
{
  % the header line
  \tl_set:Nn \headrulewidth {1pt}
  % the footer line
  \tl_set:Nn \footrulewidth {0pt}

  % \AtBeginDocument{\pagestyle{njuplain}} % 无页眉页脚
  \AtBeginDocument{\pagestyle{headings}} % 研究生有页眉页脚
}
\ctexset{
    contentsname = 目录,
    listfigurename = 插图清单,
    listtablename = 表格清单,
    chapter/format = \zihao{4}\heiti\centering,
    chapter/beforeskip = 10pt,
    chapter/afterskip = 60pt,
    section/format = \zihao{4}\heiti\raggedright,
    subsection/format = \zihao{4}\heiti\raggedright,
    subsubsection/format = \zihao{4}\heiti\raggedright
}

\titlecontents{chapter}% 标题级别
                [5em]% 标题左间距
                {\heiti\zihao{4}\vspace{10pt}}% 标题格式
                {\contentslabel{4em}}% 标题标志
                {\hspace*{-4em}}% 无序号标题
                {~\titlerule*[0.6pc]{$.$}~\contentspage}% 指引线与页码

                \titlecontents{section}
                [5em]
                {\zihao{-4}\vspace{0pt}}
                {\contentslabel{2.5em}}
                {\hspace*{-4em}}
                {~\titlerule*[0.6pc]{$.$}~\contentspage}

\titlecontents{subsection}
                [8em]
                {\zihao{-4}\vspace{0pt}}
                {\contentslabel{3em}}
                {\hspace*{-4em}}
                {~\titlerule*[0.6pc]{$.$}~\contentspage}
\cs_set:Npn \CTEX@addtocline #1#2
{
  \addcontentsline { toc } {#1}
  { \use:c { CTEX@#1@tocline } {#1} {#2} }
}
\cs_new:Npn \nju_tocpagestyle:nnn #1 #2 #3
{
  \newpage
  \hspace{0pt}
  \vskip 10pt
  \begin{center}
    \mbox{\songti\bf\zihao{3}{#1}} % 目录页面标题
    \phantomsection
    \addcontentsline{toc}{chapter}{#2} % 插入目录
  \end{center}
  \vskip 40pt
  \@starttoc{#3}%
  \cleardoublepage
}
\tl_set:Nn \tableofcontents
{
  \nju_tocpagestyle:nnn {目\hspace{2em}录}{\contentsname}{toc}
}
\tl_set:Nn \listoffigures
{
  \nju_tocpagestyle:nnn {\listfigurename}{\listfigurename}{lof}
}
\tl_set:Nn \listoftables
{
  \nju_tocpagestyle:nnn {\listtablename}{\listtablename}{lot}
}
\NewDocumentEnvironment{preface}{}
{%
  \chapter*{前言}
  \addcontentsline{toc}{chapter}{前言}
}{}
\NewDocumentEnvironment{acknowledgement}{}
{%
  \chapter*{致谢}
  \addcontentsline{toc}{chapter}{致谢}
}{}
\RequirePackage[
    style=gb7714-2015,
    %style=numeric-comp,
    %citestyle=authortitle-icomp,
    % citestyle=numeric-comp,
    %bibstyle=authoryear,
    % bibstyle=numeric,
    sorting=none,
    %sorting=nyt,
    %sortcites=true,
    %autocite=footnote,
    backend=biber, % Compile the bibliography with biber
    hyperref=true,
    backref=false,
    citecounter=true,
    pagetracker=true,
    citetracker=true,
    ibidtracker=context,
    autopunct=true,
    autocite=plain,
    % gbpub=false,         % Uncomment if you do NOT want '[S.l. : s.n.]'
                           % in reference entries, GitHub Issue (#47)
    % gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author
                           % names in reference entries, GitHub Issue (#23)
]{biblatex}
\AtEveryBibitem{
\clearfield{abstract}
\clearfield{issn}
\clearfield{isbn}
\clearfield{archivePrefix}
\clearfield{arxivId}
\clearfield{pmid}
\clearfield{eprint}
\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}}
}
\crefdefaultlabelformat{#2#1#3\,} % 默认在名称后面添加空格

\crefname{figure}{图}{图}
\crefname{table}{表}{表}
\crefformat{equation}{公式~#2#1#3~} % 删除公式编号的括号

\crefformat{chapter}{第#2#1#3章}
\crefformat{section}{第~#2#1#3~节}
\crefformat{subsection}{第~#2#1#3~小节}
\crefformat{subsubsection}{第~#2#1#3~小节}
\crefname{appendix}{附录}{附录}

\floatsetup[lstlisting]{ % Captions for lstlistings
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[figure]{ % Captions for figures
capposition=bottom,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[table]{ % Captions for tables
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
\lstset{
basicstyle=\ttfamily\linespread{1}\small\selectfont,
    keywordstyle=\bfseries,% use bold style for keywords
    commentstyle=\rmfamily\itshape,% use italic style for comments
    stringstyle=\ttfamily,% 字符串风格
    flexiblecolumns,% ?
    numbers=left,% left-aligned numbering
    showspaces=false,% hide markers for spaces
    showstringspaces=false,
    captionpos=t,% place the caption at the top
breaklines=true,
xleftmargin=2em,xrightmargin=2em,% set the width of the code environment
}
\lstdefinestyle{LaTeX}{
  language=TeX,
  morekeywords={
    begin, caption, label, mathrm, frac,
    toprule, midrule, bottomrule, includegraphics}
}
\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti}
\captionsetup{
    font=small,%
    labelfont=songticap,
textfont=songticap,
strut=no,%
hypcap=true, % Links point to the top of the figure
aboveskip=6pt, % Increase the space between the figure and the caption
belowskip=6pt, % Increase the space between the caption and the table
}
\renewcommand{\labelitemi}{\tiny$\blacktriangleright$}
\renewcommand{\labelitemii}{\textbullet}

\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
\setlist[description]{noitemsep}
\declaretheoremstyle[
     %spaceabove=.5\thm@preskip,
     %spacebelow=.5\thm@postskip,
     headfont=\bf\songti,%\scshape,
     notefont=\songti,% notebraces={ (}{)},
     bodyfont=\songti,
     %headformat={\NAME\space\NUMBER\space\NOTE},
     headpunct={},
     %postheadspace={.5em plus .1em minus .1em},
     %prefoothook={\hfill\qedsymbol}
    ]{njuthm}

\theoremstyle{njuthm}
\let\oldproofname=\proofname
\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} % 修改证明环境标题
\declaretheorem[
name=算法,
style=njuthm,
refname={算法,算法},
Refname={算法,算法},
]{algorithm}
\declaretheorem[
name=假设,
style=njuthm,
refname={假设,假设},
Refname={假设,假设},
]{assumption}
\declaretheorem[
name=公理,
style=njuthm,
refname={公理,公理},
Refname={公理,公理},
]{axiom}
\declaretheorem[
name=结论,
style=njuthm,
refname={结论,结论},
Refname={结论,结论},
]{conclusion}
\declaretheorem[
name=条件,
style=njuthm,
refname={条件,条件},
Refname={条件,条件},
]{condition}
\declaretheorem[
name=推论,
style=njuthm,
refname={推论,推论},
Refname={推论,推论},
]{corollary}
\declaretheorem[
name=定义,
style=njuthm,
refname={定义,定义},
Refname={定义,定义},
]{definition}
\declaretheorem[
     name=例,
     style=njuthm,
     refname={例,例},
     Refname={例,例},
     % numberwithin=section,
]{example}
\declaretheorem[
name=引理,
style=njuthm,
refname={引理,引理},
Refname={引理,引理},
]{lemma}
\declaretheorem[
name=性质,
style=njuthm,
refname={性质,性质},
Refname={性质,性质},
]{property}
\declaretheorem[
name=命题,
style=njuthm,
refname={命题,命题},
Refname={命题,命题},
]{proposition}
\declaretheorem[
name=注解,
style=njuthm,
refname={注解,注解},
Refname={注解,注解},
]{remark}
\declaretheorem[
name=定理,
style=njuthm,
refname={定理,定理},
Refname={定理,定理},
numberwithin=section,
]{theorem}
\tl_const:Nn \l__nju_info_title_tl
{
  \l__nju_info_title_a_tl
  \l__nju_info_title_b_tl
  \l__nju_info_title_c_tl
}
%% \begin{variable}{\l_@@_info_supv_full_tl,\l_@@_info_supv_full_en_tl}
\tl_new:N \l__nju_info_supv_full_tl
\tl_new:N \l__nju_info_supv_full_en_tl
\tl_set:Nn \l__nju_info_supv_full_tl
{
  \l__nju_info_supv_a_tl\
  \l__nju_info_supv_a_title_tl\ \
  \l__nju_info_supv_b_tl\
  \l__nju_info_supv_b_title_tl
}
\tl_set:Nn \l__nju_info_supv_full_en_tl
{
  \l__nju_info_supv_a_en_tl\
  \l__nju_info_supv_a_title_en_tl\ \
  \l__nju_info_supv_b_en_tl\
  \l__nju_info_supv_b_title_en_tl
}
\tl_new:N \c__nju_name_degree_tl
\tl_new:N \c__nju_name_degree_en_tl
\str_if_eq:NNTF {\l__nju_info_degree_tl} { ug }
{
  % 本科
  \tl_const:Nn \l__nju_name_diploma_tl { 本\hfill 科\hfill }
  \tl_const:Nn \c__nju_name_title_tl { 题\hfill 目 }

  \tl_const:Nn \c__nju_cover_uline_len_a_tl { 250pt }
  \tl_const:Nn \c__nju_cover_uline_len_b_tl { 90pt }
  \tl_const:Nn \c__nju_cover_uline_font_tl { \songti }
  \tl_const:Nn \c__nju_cover_uline_style_tl { \bf }
  \tl_const:Nn \c__nju_cover_uline_bskip_tl {}

  \tl_const:Nn \c__nju_cover_box_len_tl { 4.2em }

  % 本科强制不打印国家图书馆封面
  \bool_set_false:N \g__nju_nlcover_bool
}
{
  % 本科以外都是研究生
  \tl_const:Nn \l__nju_name_diploma_tl { 研\hfill 究\hfill 生\hfill }
  \tl_const:Nn \c__nju_name_title_tl { 论\hfill 文\hfill 题\hfill 目 }

  \tl_const:Nn \c__nju_cover_uline_len_a_tl { 250pt }
  \tl_const:Nn \c__nju_cover_uline_len_b_tl { 14em }
  \tl_const:Nn \c__nju_cover_uline_font_tl { \kaishu }
  \tl_const:Nn \c__nju_cover_uline_style_tl {}
  \tl_const:Nn \c__nju_cover_uline_bskip_tl { \hspace{1em} }

  \tl_const:Nn \c__nju_cover_box_len_tl { 6em }

  % 研究生学位名称
  \str_if_eq:NNTF { \l__nju_info_degree_tl } { phd }
  {
    \tl_set:Nn \c__nju_name_degree_tl { 博士 }
    \tl_set:Nn \c__nju_name_degree_en_tl { Doctor~of~Philosophy }
  }
  {
    \tl_set:Nn \c__nju_name_degree_en_tl { Master }
    \str_if_eq:NNTF { \l__nju_info_degree_tl } { mg }
    { \tl_set:Nn \c__nju_name_degree_tl { 硕士 } }
    { \tl_set:Nn \c__nju_name_degree_tl { 硕士专业 } }
  }
}
\cs_new:Npn \__nju_cover_uline_a:n #1
{
  \uline{\makebox[\c__nju_cover_uline_len_a_tl]
    {\rm\c__nju_cover_uline_font_tl #1 }}
}
\cs_new:Npn \__nju_cover_uline_b:n #1
{
  \uline{\makebox[\c__nju_cover_uline_len_b_tl]
    {\rm\c__nju_cover_uline_font_tl #1 }}
}
\cs_new:Npn \__nju_cover_uline_nl:nn #1 #2
{
  \uline{\makebox[#1]
    {\rm\c__nju_cover_uline_font_tl #2 }}
}
\cs_new:Npn \__nju_cover_box:n #1
{
  \makebox[\c__nju_cover_box_len_tl][s]{
    #1\c__nju_cover_uline_bskip_tl}
}
\str_if_eq:NNTF { \l__nju_info_type_tl } { thesis }
{
  \tl_const:Nn \l__nju_info_type_tl_name
    { \l__nju_name_diploma_tl 毕\hfill 业\hfill 论\hfill 文 }
}
{
  \tl_const:Nn \l__nju_info_type_tl_name
    { \l__nju_name_diploma_tl 毕\hfill 业\hfill 设\hfill 计 }
}
\cs_new_protected:Npn \__nju_cover_title_breakline:
{
  \__nju_cover_box:n {\c__nju_name_title_tl}
  & \__nju_cover_uline_a:n
  { \c__nju_cover_uline_style_tl \l__nju_info_title_a_tl } \\
  % 如果某行标题空则不输出接下来的若干行
  \tl_if_empty:NF \l__nju_info_title_b_tl
  {
    \tl_if_empty:NTF \l__nju_info_title_c_tl
      {
        & \__nju_cover_uline_a:n
        {\c__nju_cover_uline_style_tl \l__nju_info_title_b_tl } \\
      }
      {
        & \__nju_cover_uline_a:n
        { \c__nju_cover_uline_style_tl \l__nju_info_title_b_tl } \\
        & \__nju_cover_uline_a:n
        { \c__nju_cover_uline_style_tl \l__nju_info_title_c_tl } \\
      }
  }
}
\cs_new_protected:Npn \__nju_print_covertab:
{%
  \str_if_eq:NNTF { \l__nju_info_degree_tl } { ug }
  {
    \begin{tabular}{p{4.2em}c}
      \__nju_cover_box:n {院\hfill 系}
      & \__nju_cover_uline_a:n  {\l__nju_info_dept_tl} \\
      \__nju_cover_box:n {专\hfill 业}
      & \__nju_cover_uline_a:n  {\l__nju_major_tl} \\
      \__nju_cover_title_breakline:
    \end{tabular}\\

    \begin{tabular}{p{4.2em}cp{4.2em}c}
      \__nju_cover_box:n {年\hfill 级}
      & \__nju_cover_uline_b:n {\l__nju_info_grade_tl}
      & \__nju_cover_box:n {学\hfill 号}
      & \__nju_cover_uline_b:n {\l__nju_info_id_tl}\\
    \end{tabular}\\

    \begin{tabular}{p{4.2em}c}
      \__nju_cover_box:n {学\hfill 生\hfill 姓\hfill 名}
      & \__nju_cover_uline_a:n  {\l__nju_info_author_tl}
    \end{tabular}\\
    \begin{tabular}{p{4.2em}cp{4.2em}c}
      \__nju_cover_box:n {导\hfill 师}
      & \__nju_cover_uline_b:n {\l__nju_info_supv_a_tl}
      & \__nju_cover_box:n {职\hfill 称}
      & \__nju_cover_uline_b:n {\l__nju_info_supv_a_title_tl}\\

      % 第二导师
      \tl_if_empty:NF \l__nju_info_supv_b_tl
      {
        \__nju_cover_box:n {第\hfill 二\hfill 导\hfill 师}
        & \__nju_cover_uline_b:n {\l__nju_info_supv_b_tl}
        & \__nju_cover_box:n {职\hfill 称}
        & \__nju_cover_uline_b:n {\l__nju_info_supv_b_title_tl}\\
      }
    \end{tabular}\\

    \begin{tabular}{p{4.2em}c}
      \__nju_cover_box:n {提\hfill 交\hfill 日\hfill 期}
      & \__nju_cover_uline_a:n  {\l__nju_submit_date_tl}\\
    \end{tabular}
  }
  {
    \begin{tabular}{p{6em}c}
      \__nju_cover_title_breakline:
      \__nju_cover_box:n {作\hfill 者\hfill 姓\hfill 名}
      & \__nju_cover_uline_a:n  {\l__nju_info_author_tl}\\
      \__nju_cover_box:n {专\hfill 业\hfill 名\hfill 称}
      & \__nju_cover_uline_a:n  {\l__nju_major_tl}\\
      \__nju_cover_box:n {研\hfill 究\hfill 方\hfill 向}
      & \__nju_cover_uline_a:n  {\l__nju_field_tl}\\
      \__nju_cover_box:n {指\hfill 导\hfill 教\hfill 师}
      & \__nju_cover_uline_a:n  {\l__nju_info_supv_full_tl}\\
    \end{tabular}
  }
}
\cs_new_protected:Npn \__nju_print_cover_nl:
{
  \thispagestyle{empty}
  \pdfbookmark[0]{国家图书馆封面}{nl}
  {
    % 顶端
    \hspace{0mm}
    \vskip -20mm \hskip -15mm
    \songti\zihao{-4}
    \makebox[40pt][l]{分类号}
    \__nju_cover_uline_b:n {\l__nju_info_classif_tl}
    \hfill
    \makebox[40pt][l]{密级}
    \__nju_cover_uline_b:n {\l__nju_info_seclv_tl}
    \vskip 10pt \hskip -15mm
    \makebox[40pt][l]{UDC}
    \__nju_cover_uline_b:n {\l__nju_info_udc_tl}
  }

  % 中部
  \vskip\stretch{2}
  \begin{center}
    \def\ULthickness{1pt}
    {\kaishu\zihao{-0} 学\hspace{0.5em}位\hspace{0.5em}论\hspace{0.5em}文}
    {
      \kaishu\zihao{1}
      \vskip \stretch{1}
      \__nju_cover_uline_b:n {\l__nju_info_title_a_tl}\\
      \__nju_cover_uline_b:n {\l__nju_info_title_b_tl}\\
      \__nju_cover_uline_b:n {\l__nju_info_title_c_tl}\\
    }
    \vskip \stretch{1}
    {\kaishu\zihao{4}(题名和副题名)}
    \vskip \stretch{1} \vskip 5mm
    {\kaishu\zihao{1}\uline{\makebox{\l__nju_info_author_tl}}}
    \vskip \stretch{1}
    {\kaishu\zihao{4}(作者姓名)}
  \end{center}

  % 底部
  \vskip\stretch{1}
  {
    \kaishu\zihao{4}
    \noindent 指导教师姓名、职务、职称、学位、单位名称及地址%
    \__nju_cover_uline_nl:nn {94pt}{\l__nju_info_supv_a_tl}\par
    \noindent\__nju_cover_uline_nl:nn {\textwidth}{%
    \l__nju_info_supv_cont_tl}\par
    \noindent 申请学位级别%
    \__nju_cover_uline_nl:nn {9em}{\c__nju_name_degree_tl}%
    \noindent 专业名称%
    \uline{\hfill\l__nju_major_tl\hfill}\par% 需要调整下划线长度
    \noindent 论文提交日期%
    \__nju_cover_uline_nl:nn {9em}{\l__nju_submit_date_tl}%
    论文答辩日期%
    \uline{\hfill\l__nju_defend_date_tl\hfill}\par% 需要调整下划线长度
    \noindent 学位授予单位和日期\uline{\hfill}\par
    \noindent\hfill 答辩委员会主席:%
    \__nju_cover_uline_nl:nn {9em}{\l__nju_info_chairman_tl}\par
    \noindent\hfill 评阅人:%
    \__nju_cover_uline_nl:nn {9em}{\l__nju_info_reviewer_a_tl}\par
    \noindent\hfill\__nju_cover_uline_nl:nn {9em}{\l__nju_info_reviewer_b_tl}\par
    \noindent\hfill\__nju_cover_uline_nl:nn {9em}{\l__nju_info_reviewer_c_tl}\par
    \noindent\hfill\__nju_cover_uline_nl:nn {9em}{\l__nju_info_reviewer_d_tl}\par

    \begin{center}
      \kaishu\zihao{3}\hspace{2em} 年\hspace{1em} 月\hspace{1em} 日
    \end{center}
    \vskip -10mm
    }
  \cleardoublepage
}
\cs_new_protected:Npn \__nju_print_cover_ug:
{
  \thispagestyle{empty}
  \pagenumbering{Roman}
  % Start
  \pdfbookmark{封面}{封面} % 将封面插入pdf书签
  \begin{spacing}{1.25}
  \vskip 0mm
  \hspace{-10mm}
  \includegraphics[height=3cm]{njulogo}\smallskip
  \begin{center}
    \includegraphics[height=3.35cm]{njuname}
    \vskip 10mm
    {\zihao{1}\makebox[9em][s]{\bf{\songti\l__nju_info_type_tl_name}}}
    \vfill
    \vskip\stretch{0}
    {\bgroup
    \kaishu\zihao{3}
    \def\tabcolsep{1pt}
    \def\arraystretch{1.5}
    % 绘制信息框
    \__nju_print_covertab:
    \egroup}
    \vfill
  \end{center}
  \end{spacing}
  \cleardoublepage
  % \vfill
  % \newpage
}
\cs_new_protected:Npn \__nju_print_cover_g:
{
  \thispagestyle{empty}
  \pagenumbering{Roman}
  % Start
  \pdfbookmark{封面}{封面} % 将封面插入pdf书签
  \begin{spacing}{1.25}
  \begin{center}
    \hspace{0pt} \vskip 5mm
    \includegraphics[height=1.9cm]{njulogo}
    \vskip 10mm
    \includegraphics[height=2cm]{njuname-large}
    \vskip 15mm
    {\zihao{1}\makebox[10em][s]{\bf{\kaishu\l__nju_info_type_tl_name}}}
    \vskip 5mm
    {\zihao{1}\bf{\kaishu{(申请\c__nju_name_degree_tl 学位)}}}
    \par\vfill
    \vskip\stretch{0}
    {\bgroup
    \bf\kaishu\zihao{3}
    \def\tabcolsep{1pt}
    \def\arraystretch{1.5}
    \vskip 10mm
    % 绘制信息框
    \__nju_print_covertab:
    \egroup}
    \vfill
    \vskip 10mm
    \bf\kaishu\zihao{4}\l__nju_submit_date_tl
    \vskip 15mm
  \end{center}
  \end{spacing}

  \newpage % 封面背面
  \thispagestyle{empty}
  \begin{spacing}{1.625}
    % TODO: 等待调整格式
    \hspace{0pt} \vfill
    {\bgroup
    \kaishu\zihao{3}
    \makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\l__nju_info_id_tl}
    \par
    \makebox[6em][s]{\bf\kaishu 论文答辩日期}:\l__nju_defend_date_tl
    \par
    \makebox[6em][s]{\bf\kaishu 指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字)
    \par
    \egroup}
    \vskip 15mm
  \end{spacing}
  \cleardoublepage
}
\cs_new_protected:Npn \__nju_print_cover_en:
{
  \thispagestyle{empty}
  \pdfbookmark{英文封面}{English~cover} % 将封面插入pdf书签
  \begin{center}
    \vspace*{20pt}
    \bf\sffamily\zihao{2}\l__nju_info_title_en_tl
    \vskip \stretch{1}
    \normalfont\rmfamily\zihao{4}{by}
    \vskip 3pt
    \bf\sffamily\zihao{4}\l__nju_info_author_en_tl
    \vskip\stretch{1}
    \normalfont\rmfamily\zihao{4}{Supervised~by}
    \vskip 3pt
    \normalfont\sffamily\zihao{4}\l__nju_info_supv_a_title_en_tl
    \hspace{.5em}\l__nju_info_supv_a_en_tl
    \vskip\stretch{1}
    \normalsize\rmfamily{%
      A~dissertation~submitted~to\\
      the~graduate~school~of~Nanjing~University\\
      in~partial~fulfilment~of~the~requirements~for~the~degree~of\\
      {\textsc{\c__nju_name_degree_en_tl}}\\
      in\\
      {\l__nju_major_en_tl}
    }
    \vskip\stretch{2}
    \includegraphics[width=2.5cm]{njulogo} \\
    \vskip 3mm
    \normalfont\l__nju_info_dept_en_tl\\
    {Nanjing~University}
    \vskip 30pt
    \normalfont\normalsize\l__nju_submit_date_en_tl
  \end{center}
  \normalfont
  \cleardoublepage
}
\tl_set:Nn \maketitle
{%
  \str_if_eq:NNTF { \l__nju_info_degree_tl } { ug }
  {
    \__nju_print_cover_ug: % 本科封面
  }
  {
    \bool_if:NT \g__nju_nlcover_bool { \__nju_print_cover_nl: } % 国家图书馆封面
    \__nju_print_cover_g: % 研究生封面
    \__nju_print_cover_en: % 英文封面
  }
}
\NewDocumentCommand \keywords {m} {%
  \par\vspace{2ex}\noindent%
  {\kaishu\zihao{-4}\makebox[4em][s]{关键词{:}}}~{#1}%
}
\NewDocumentCommand \englishkeywords {m} {%
  \par\vspace{2ex}\noindent%
  {KEYWORDS{:}}~~{#1}%
}
\str_if_eq:NNTF {\l__nju_info_degree_tl} { ug }
{
  % 本科摘要环境
  \NewDocumentEnvironment{abstract} {}
  {%
    % \pagestyle{plain}
    % \pagenumbering{Roman}
    % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
      \kaishu\zihao{-2}{\textbf{
        \uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}}
    \end{center}
    {\bgroup
      \kaishu\zihao{-4}
      \tl_set:Nn \tabcolsep {0pt}
      \tl_set:Nn \arraystretch {0.8}
      \noindent
      题目: \l__nju_info_title_tl \\
      院系: \l__nju_info_dept_tl \\
      专业: \l__nju_major_tl \\
      本科生姓名: \l__nju_info_author_tl \\
      指导教师(姓名、职称):\l__nju_info_supv_full_tl \\
      摘要:
      \egroup
    }
    \kaishu\zihao{-4}\par%
  }{%
  \newpage
  }

  % 英文摘要
  \NewDocumentEnvironment{englishabstract} {}
  {%
    \pagestyle{plain}
    % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
        \kaishu\zihao{-2}{\textbf{\uuline{
          南京大学本科生毕业论文(设计、作品)英文摘要}}}
    \end{center}
    {
      \bgroup
      THESIS: ~~\l__nju_info_title_en_tl \\
      DEPARTMENT: ~~\l__nju_info_dept_en_tl \\
      SPECIALIZATION: ~~\l__nju_major_en_tl \\
      UNDERGRADUATE:~~\l__nju_info_author_en_tl \\
      MENTOR:~~\l__nju_info_supv_full_en_tl \\
      ABSTRACT:
      \egroup
    }
    \zihao{-4}\par%
  }{%
  \cleardoublepage
  \newpage
  }
}
{
  % 研究生摘要环境
  \NewDocumentEnvironment{abstract} {}
  {%
    \pagestyle{plain}
    \pagenumbering{Roman}
    % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
      \kaishu\zihao{-2}{\textbf{\uuline{
        南京大学研究生毕业论文中文摘要首页用纸}}}
    \end{center}

    \bgroup
    \kaishu\zihao{4}
    \tl_set:Nn \tabcolsep {0pt}
    \tl_set:Nn \arraystretch {0.8}
    \noindent
    毕业论文题目:\hspace{0.5em}\nju_underline:n {\l__nju_info_title_tl\hfill}\\
    \uline{\makebox[9em]{\l__nju_major_tl}}专业
    \uline{\makebox[4em]{\l__nju_info_grade_tl}}级
    \str_if_eq:NNTF {\l__nju_info_degree_tl} { phd } {博}{硕}
    士生姓名:\uline{\hfill\l__nju_info_author_tl\hfill} \\
    指导教师(姓名、职称):\uline{\hfill\l__nju_info_supv_full_tl\hfill}\par
    \egroup

    \kaishu\zihao{4}\par%
  }{%
  \newpage
  }

  % 英文摘要
  \NewDocumentEnvironment{englishabstract} {}
  {%
    \pagestyle{plain}
    % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
    \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
    \begin{center}
        \kaishu\zihao{-2}{\textbf{\uuline{
          南京大学研究生毕业论文英文摘要首页用纸}}}
    \end{center}
    {
      \bgroup
      \zihao{4}
      THESIS: ~~\l__nju_info_title_en_tl \\
      SPECIALIZATION: ~~\l__nju_major_en_tl \\
      POSTGRADUATE:~~\l__nju_info_author_en_tl \\
      MENTOR:~~\l__nju_info_supv_full_en_tl\par
      \egroup
    }
    \zihao{4}\par%
  }{%
  \cleardoublepage
  \newpage
  }
}
\endinput
%%
%% End of file `njuthesis.cls'.