-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbithesis.cls
More file actions
2778 lines (2580 loc) · 103 KB
/
bithesis.cls
File metadata and controls
2778 lines (2580 loc) · 103 KB
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
%%
%% This is file `bithesis.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bithesis.dtx (with options: `cls,thesis')
%%
%% Copyright (C) 2025
%% Association of Bit Network Pioneer and any individual authors listed in the documentation.
%% ------------------------------------------------------------------------------
%%
%% This work 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. This version of this license is in
%% https://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%% https://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2020/11/27 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Feng Kaiyu.
%% ------------------------------------------------------------------------------
%%
\RequirePackage{expl3,l3keys2e}
\ProvidesExplClass{bithesis}
{2025-04-18} {3.8.4} {BIT Thesis Templates}
\int_new:N \g__bithesis_thesis_type_int
\int_new:N \g__bithesis_head_zihao_int
\bool_new:N \g__bithesis_twoside_bool
\bool_new:N \g__bithesis_thesis_type_english_bool
\bool_new:N \g__bithesis_blind_mode_bool
\bool_new:N \g__bithesis_quirks_mode_bool
\tl_new:N \g__bithesis_label_divide_char_tl
\seq_new:N \l__bithesis_right_seq
\seq_new:N \l__bithesis_left_seq
\cs_new:Npn \__bithesis_hide:n #1 {
\g__bithesis_const_substitute_symbol_tl
}
\cs_new:Npn \__bithesis_secret_info:nn #1 #2 {
\bool_if:nTF \g__bithesis_blind_mode_bool {
#2
} {
#1
}
}
\cs_new:Npn \__bithesis_secret_info:N #1 {
\__bithesis_secret_info:nn {#1} {\tl_map_function:NN #1 \__bithesis_hide:n }
}
\cs_new:Npn \__bithesis_secret_info:n #1 {
\__bithesis_secret_info:nn {#1} {\tl_map_function:NN {#1} \__bithesis_hide:n }
}
\cs_new:Npn \__bithesis_get_const:n #1 {
\__bithesis_if_thesis_english:TF {
\use:c {c__bithesis_label_ #1 _en_tl}
} {
\use:c {c__bithesis_label_ #1 _tl}
}
}
\cs_new:Npn \__bithesis_set_english_mode: {
\bool_gset_true:N \g__bithesis_thesis_type_english_bool
}
\cs_generate_variant:Nn \tl_if_empty:nTF {x}
\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx}
\cs_new:Npn \__bithesis_same_page: {
\let\clearpage\relax
\let\cleardoublepage\relax
}
\cs_new:Npn \__bithesis_if_graduate:TF #1#2 {
\int_compare:nNnTF {3} < {\g__bithesis_thesis_type_int}
{#1}
{#2}
}
\cs_new:Npn \__bithesis_if_graduate:T #1 {\__bithesis_if_graduate:TF {#1} {}}
\cs_new:Npn \__bithesis_if_thesis_int_type:nTF #1#2#3 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {#1} {#2} {#3}}
\cs_new:Npn \__bithesis_if_thesis_int_type:nT #1#2 {\__bithesis_if_thesis_int_type:nTF {#1} {#2} {}}
\cs_new:Npn \__bithesis_if_thesis_int_type:nF #1#2 {\__bithesis_if_thesis_int_type:nTF {#1} {} {#2}}
\cs_new:Npn \__bithesis_if_thesis_english:TF #1#2 {\bool_if:nTF {\g__bithesis_thesis_type_english_bool} {#1} {#2}}
\cs_new:Npn \__bithesis_if_thesis_english:T #1 {\__bithesis_if_thesis_english:TF {#1}{}}
\cs_new:Npn \__bithesis_if_bachelor_thesis:TF #1#2 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} < {4} {#1} {#2}}
\cs_new:Npn \__bithesis_if_bachelor_thesis:T #1 {\__bithesis_if_bachelor_thesis:TF {#1} {}}
\cs_new:Npn \__bithesis_if_master_thesis:TF #1#2 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {4} {#1} {#2}}
\cs_new:Npn \__bithesis_if_doctor_thesis:TF #1#2 {\int_compare:nNnTF {\g__bithesis_thesis_type_int} = {5} {#1} {#2}}
\clist_const:Nn \c__bithesis_thesis_type_clist
{ bachelor, bachelor_translation, bachelor_english, master, doctor}
\clist_const:Nn \c__bithesis_publication_modes_clist
{ biblatex, custom }
\cs_new_protected:Npn \__bithesis_define_label:nn #1#2
{ \tl_const:cn { c__bithesis_label_ #1 _tl } {#2} }
\cs_new_protected:Npn \__bithesis_define_label_by_thesis_type:nnn #1#2#3
{
\tl_const:cn { c__bithesis_ #1 _label_ #2 _tl } {#3}
}
\cs_new_protected:Npn \__bithesis_define_label:nnn #1#2#3
{
\tl_const:cn { c__bithesis_label_ #1 _tl } {#2}
\tl_const:cn { c__bithesis_label_ #1 _en_tl } {#3}
}
\cs_new_protected:Npn \__bithesis_define_label_by_thesis_type:nnnn #1#2#3#4
{
\tl_const:cn { c__bithesis_ #1 _label_ #2 _tl } {#3}
\tl_const:cn { c__bithesis_ #1 _label_ #2 _en_tl } {#4}
}
\cs_new:Npn \__bithesis_smallgap: {
\hspace{0.45ex}
}
\cs_new:Npn \__bithesis_boxempty:
{
\makebox[1em][l]
{
% 为保证与打了勾的一致,也需套盒子
\makebox[0pt][l]
{
% 默认比基线略高,向下降降
\raisebox{-1pt}{$\square$}
}
}
}
\cs_new:Npn \__bithesis_boxcheck:
{
\makebox[1em][l]
{
\makebox[0pt][l]
{
% 默认比基线略高,向下降降
\raisebox{-1pt}{$\square$}
}
$\checkmark$
}
}
\cs_new:Npn \__bithesis_label_space: {
\__bithesis_if_bachelor_thesis:T {
\quad
}
}
\clist_map_inline:nn
{
{code} {代码},
{udc} {UDC分类号:},
{classification} {中图分类号:},
{classified_level} {密级},
{type} {种类},
{special_type} {学生类型},
{engineering_special_plan} {工程硕博士专项},
{cross_research} {交叉研究方向},
{international_student_ugp} {政府项目留学生},
}
{\__bithesis_define_label:nn #1}
\clist_map_inline:nn
{
{originality} {原创性声明},
{originality_clause} {本人郑重声明:所呈交的毕业设计(论文),
是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,
本文不包含任何其他个人或集体已经发表或撰写过的研究成果。
对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。\par~特此申明。},
{authorization} {关于使用授权的声明},
{authorization_clause} {本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,
其中包括:\circled{1}~学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;
\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);
\circled{3}~学校可允许本毕业设计(论文)被查阅或借阅;\circled{4}~学校可以学术交流为目的,
复制赠送和交换本毕业设计(论文);\circled{5}~学校可以公布本毕业设计(论文)的全部或部分内容。},
{originality_author_signature}
{本人签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日},
{originality_supervisor_signature}
{指导老师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日},
} {\__bithesis_define_label_by_thesis_type:nnn {bachelor} #1}
\clist_map_inline:nn
{
{originality} {原创性声明~Statement~of~Originality},
{originality_clause} {
本人郑重声明:所呈交的毕业设计(论文),
是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,
本文不包含任何其他个人或集体已经发表或撰写过的研究成果。
对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。特此申明。\par
\arialfamily I,\dunderline[-1pt]{1pt}{\makebox[18mm]{}},~solemnly~
declare:~the~submitted~graduation~design~(thesis),~
is~the~research~achievement~completed~independently~by~myself~
under~the~guidance~of~the~supervisor.~This~article~does~not~contain~
any~research~published~or~written~by~any~other~individual~or~group,~
except~as~already~referenced~in~this~paper.~Individuals~and~groups~
that~have~made~important~contributions~to~the~study~of~this~paper~
are~clearly~indicated~and~cited~in~the~paper.\par
},
{authorization} {关于使用授权的声明~State~of~Use~Authorization},
{authorization_clause} {
本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,
其中包括:\circled{1}学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;
\circled{2}学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);
\circled{3}学校可允许本毕业设计(论文)被查阅或借阅;
\circled{4}学校可以学术交流为目的,复制赠送和交换本毕业设计(论文);
\circled{5}学校可以公布本毕业设计(论文)的全部或部分内容。\par
I~fully~understand~the~regulations~on~the~storage,~
use~of~graduation~design~(thesis)~in~Beijing~Institute~of~Technology.~
Beijing~Institute~of~Technology~has~the~right~to~(1)~keep,~
and~to~the~relevant~departments~to~send~the~original~or~copy~
of~this~graduation~design~(thesis);~(2)~copy~and~preserve~this~
graduation~design~(thesis)~by~photocopying,~miniature~or~other~
means~of~reproduction;~(3)~allow~this~graduation~design~(thesis)~
to~be~read~or~borrowed;~(4)~for~the~purpose~of~academic~exchange,~
copy,~give~and~exchange~this~graduation~design~(thesis);~(5)~
publish~all~or~part~of~the~contents~of~this~graduation~design~(thesis).~
},
} {\__bithesis_define_label_by_thesis_type:nnn {bachelor_english} #1}
\clist_map_inline:nn
{
{originality} {研究成果声明},
{originality_clause} {本人郑重声明:所提交的学位论文是我本人在指导教师的指导下独立完成的研究成果。文中所撰写内容符合以下学术规范(请勾选):
\par \__bithesis_boxcheck:\hspace{0.5em} 论文综述遵循“适当引用”的规范,全部引用的内容不超过50\%。
\par \__bithesis_boxcheck:\hspace{0.5em} 论文中的研究数据及结果不存在篡改、剽窃、抄袭、伪造等学术不端行为,并愿意承担因学术不端行为所带来的一切后果和法律责任。
\par \__bithesis_boxcheck:\hspace{0.5em} 文中依法引用他人的成果,均已做出明确标注或得到许可。
\par \__bithesis_boxcheck:\hspace{0.5em} 论文内容未包含法律意义上已属于他人的任何形式的研究成果,也不包含本人已用于其他学位申请的论文或成果。
\par \__bithesis_boxcheck:\hspace{0.5em} 与本人一同工作的合作者对此研究工作所做的任何贡献均已在学位论文中作了明确的说明并表示了谢意。
\par~特此声明。},
{authorization} {关于学位论文使用权的说明},
{authorization_clause} {本人完全了解北京理工大学有关保管、使用学位论文的规定,其中包括:
\par~\circled{1}~学校有权保管、并向有关部门送交学位论文的原件与复印件;
\par~\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存学位论文;
\par~\circled{3}~学校可允许学位论文被查阅或借阅;
\par~\circled{4}~学校可以学术交流为目的,复制赠送和交换学位论文;
\par~\circled{5}~学校可以公布学位论文的全部或部分内容(保密学位论文在解密后遵守此规定)。},
{originality_author_signature}
{签\qquad 名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad},
{originality_supervisor_signature}
{导师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad},
} {\__bithesis_define_label_by_thesis_type:nnn {graduate} #1}
\clist_map_inline:nn
{
% TODO: 自动实现汉字均排
{author} {作\quad 者\quad 姓\quad 名} {Candidate~Name},
{school} {学\quad 院\quad 名\quad 称} {School~or~Department},
{supervisor} {指\quad 导\quad 教\quad 师} {Faculty~Mentor},
{industrial_mentor} {行\__bithesis_smallgap: 业\__bithesis_smallgap: 合\__bithesis_smallgap: 作\__bithesis_smallgap: 导\__bithesis_smallgap: 师} {Industry~Collaboration~Mentor},
{chairman} {答辩委员会主席} {Chair,~Thesis~Committee},
% degree、major 的中文与 degreeType 有关,此处以 academic 为准,其余情况通过 \c__bithesis_auto_tl 处理
% 英文倒是无关。
{degree} {申\quad 请\quad 学\quad 位} {Degree~Applied},
{major} {一\quad 级\quad 学\quad 科} {Major},
{institute}
{学\__bithesis_smallgap: 位\__bithesis_smallgap: 授\__bithesis_smallgap: 予\__bithesis_smallgap: 单\__bithesis_smallgap: 位}
{Degree~by},
{defense_date}
{论\__bithesis_smallgap: 文\__bithesis_smallgap: 答\__bithesis_smallgap: 辩\__bithesis_smallgap: 日\__bithesis_smallgap: 期}
{The~Date~of~Defence},
} {\__bithesis_define_label_by_thesis_type:nnnn {graduate} #1}
\clist_map_inline:nn
{
{school} {学\qquad 院} {School},
{major} {专\qquad 业} {Degree},
{course} {课程名称} {Course},
{class} {班\qquad{}级} {Class},
{author} {学生姓名} {Author},
{student_id} {学\qquad 号} {Student~ID},
{supervisor} {指导教师} {Supervisor},
{co_supervisor} {校外指导教师} {Co-Supervisor},
{teacher} {任课教师} {Teacher},
{semester} {上课学期} {Semester},
{keywords} {关键词:} {Key~Words:~},
{toc} {目\__bithesis_label_space: 录} {Table~of~Contents},
{abstract} {摘\__bithesis_label_space: 要} {Abstract},
{conclusion} {结\__bithesis_label_space: 论} {Conclusions},
% 附录部分的总标题
{appendix} {附\__bithesis_label_space: 录} {Appendices},
{ack} {致\__bithesis_label_space: 谢} {Acknowledgements},
{figure} {插\__bithesis_label_space: 图} {Illustrations},
{table} {表\__bithesis_label_space: 格} {Tables},
% 附录下各部分编号的前缀
{appendix_prefix} {附录} {Appendix},
{reference} {参考文献} {References},
{university} {北京理工大学} {Beijing~Institute~of~Technology},
{publications} {攻读学位期间发表论文与研究成果清单}
{Publications~During~Studies},
% TODO: Not so sure about the translation.
{resume} {作者简介} {Author~Biography},
{symbols} {主要符号对照表} {Nomenclature},
{algo} {算法} {Algorithm},
{them} {定理} {Theorem},
{lem} {引理} {Lemma},
{prop} {命题} {Proposition},
{cor} {推论} {Corollary},
{axi} {公理} {Axiom},
{defn} {定义} {Definition},
{conj} {猜想} {Conjecture},
{exmp} {例} {Example},
{case} {情形} {Case},
{rem} {注} {Remark},
{fig} {图} {Figure},
{tab} {表} {Table},
{equ} {式} {Equation},
}
{\__bithesis_define_label:nnn #1}
\clist_const:Nn \c__bithesis_bachelor_thesis_header_clist
{
北京理工大学本科生毕业设计(论文),
北京理工大学本科生毕业设计(论文)外文翻译,
Beijing~Institute~of~Technology~Bachelor's~Thesis,
北京理工大学硕士学位论文,
北京理工大学博士学位论文,
}
\clist_const:Nn \c__bithesis_bachelor_thesis_headline_clist
{
本科生毕业设计(论文),
本科生毕业设计(论文)外文翻译,
Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis,
}
\tl_const:Nn \c__bithesis_auto_tl { BIThesis-auto-magic }
\keys_define:nn { bithesis }
{
info .meta:nn = { bithesis / info } {#1},
misc .meta:nn = { bithesis / misc } {#1},
cover .meta:nn = { bithesis / cover } {#1},
style .meta:nn = { bithesis / style } {#1},
option .meta:nn = { bithesis / option } {#1},
TOC .meta:nn = { bithesis / TOC } {#1},
appendices .meta:nn = { bithesis / appendices } {#1},
publications .meta:nn = { bithesis / publications } {#1},
const .meta:nn = { bithesis / const } {#1},
}
\keys_define:nn { bithesis / option }
{
type .choice:,
type .value_required:n = true,
type .choices:Vn =
\c__bithesis_thesis_type_clist
{
\int_set_eq:NN \g__bithesis_thesis_type_int \l_keys_choice_int
\int_case:nn {\l_keys_choice_int} {
% 本科全英文也是英文模板。
{3} {\__bithesis_set_english_mode:}
}
},
type .initial:n = bachelor,
twoside .bool_gset:N = \g__bithesis_twoside_bool,
blindPeerReview .bool_gset:N = \g__bithesis_blind_mode_bool,
ctex .tl_set:N = \l__bithesis_options_to_ctex_tl,
quirks .bool_gset:N = \g__bithesis_quirks_mode_bool,
% xeCJK
autoFakeBold .tl_set:N = \g__bithesis_auto_fake_bold_tl,
autoFakeBold .initial:n = {3},
% 是否开启英文模式。目前在设计上,这个选项仅对研究生模板生效。
% 本科生模板的英文模式是根据 |type| 选项自动判断的。
english .code:n = { \__bithesis_set_english_mode: } ,
}
\keys_define:nn { bithesis / cover }
{
date .tl_set:N = \l__bithesis_cover_date_tl,
headerImage .tl_set:N = \l_bit_coverheaderimage_tl,
xiheiFont .tl_set:N = \l__bithesis_cover_xihei_font_path_tl,
xiheiFont .default:n = {STXihei},
%% cover entry
delimiter .tl_set:N = \l__bithesis_cover_delimiter_tl,
labelAlign .tl_set:N = \l__bithesis_cover_label_align_tl,
labelAlign .initial:n = {r},
valueAlign .tl_set:N = \l__bithesis_cover_value_align_tl,
valueAlign .initial:n = {c},
labelMaxWidth .dim_set:N = \l__bithesis_cover_label_max_width_dim,
valueMaxWidth .dim_set:N = \l__bithesis_cover_value_max_width_dim,
autoWidthPadding .dim_set:N = \l__bithesis_cover_auto_width_padding_dim,
autoWidthPadding .initial:n = {0.25em},
autoWidth .bool_set:N = \l__bithesis_cover_auto_width_bool,
autoWidth .initial:n = {true},
underlineThickness .dim_set:N = \l__bithesis_cover_underline_thickness_dim,
underlineThickness .initial:n = {1pt},
underlineOffset .dim_set:N = \l__bithesis_cover_underline_offset_dim,
underlineOffset .initial:n = { -10pt },
hideCoverInPeerReview .bool_set:N = \l__bithesis_cover_hide_cover_in_peer_review_bool,
% 此处暂且填充默认值为`false`,待确定`\g__bithesis_thesis_type_int`后再根据论文类型覆盖默认值
hideCoverInPeerReview .initial:n = {false},
% 研究生的「特殊类型」
showSpecialTypeBox .bool_set:N = \l__bithesis_cover_show_special_type_box_bool,
showSpecialTypeBox .initial:n = {false},
% 本科英文模板也可以使用中文封面
prefer-zh .bool_set:N = \l__bithesis_cover_prefer_zh_bool,
prefer-zh .initial:n = {false},
% 本科英文模板使用中文封面时可能需要调换中英文标题顺序
reverse-titles .bool_set:N = \l__bithesis_cover_reverse_titles_bool,
reverse-titles .initial:n = {false},
% 本科英文模板可加入中文标题
addTitleZh .bool_set:N = \l__bithesis_cover_add_titlezh_bool,
addTitleZh .initial:n = {true},
}
\keys_define:nn { bithesis / info }
{
title .tl_set:N = \l__bithesis_value_title_tl,
title .initial:n = {形状记忆聚氨酯的合成及其在织物中的应用(示例)},
titleEn .tl_set:N = \l__bithesis_value_title_en_tl,
titleEn .initial:n = {Synthesis~and~Application~on~Texttiles~of~the~Shape~Memory~Polyurethane~(example)},
% 因为是覆盖选项,所以不需要设置初始值。
verticalTitle .tl_set:N = \l__bithesis_value_vertical_title_tl,
school .tl_set:N = \l__bithesis_value_school_tl,
major .tl_set:N = \l__bithesis_value_major_tl,
class .tl_set:N = \l__bithesis_value_class_tl,
% 课程名称,读书报告使用
course .tl_set:N = \l__bithesis_value_course_tl,
author .tl_set:N = \l__bithesis_value_author_tl,
studentId .tl_set:N = \l__bithesis_value_student_id_tl,
% 指导教师
supervisor .tl_set:N = \l__bithesis_value_supervisor_tl,
% 因为默认不显示,所以不需要设置初始值。
externalSupervisor .tl_set:N = \l__bithesis_value_external_supervisor_tl,
% 任课教师,读书报告使用
teacher .tl_set:N = \l__bithesis_value_teacher_tl,
% 上课学期,读书报告使用
semester .tl_set:N = \l__bithesis_value_semester_tl,
keywords .tl_set:N = \l__bithesis_value_keywords_tl,
keywords .initial:n = {聚氨酯,形状记忆,织物(示例)},
keywordsEn .tl_set:N = \l__bithesis_value_keywords_en_tl,
keywordsEn .initial:n = {Polyurethane,Shape Memory,Textiles (example)},
translationTitle .tl_set:N = \l__bithesis_value_trans_title_tl,
translationOriginTitle .tl_set:N = \l__bithesis_value_trans_origin_title_tl,
% 中图分类号,研究生学位论文使用
classification .tl_set:N = \l__bithesis_value_classification_tl,
classification .initial:n = {TQ~028.1(示例)},
% UDC 分类号,研究生学位论文使用
UDC .tl_set:N = \l__bithesis_value_udc_tl,
UDC .initial:n = {540(示例)},
% 学术型/专业型,研究生学位论文使用
degreeType .choice:,
degreeType .choices:nn = {professional, academic} {
\tl_set:Nn \l__bithesis_value_degree_type_tl {#1}
},
degreeType .initial:n = academic,
chairman .tl_set:N = \l__bithesis_value_chairman_tl,
industrialMentor .tl_set:N = \l__bithesis_value_industrial_mentor_tl,
industrialMentorEn .tl_set:N = \l__bithesis_value_industrial_mentor_en_tl,
degree .tl_set:N = \l__bithesis_value_degree_tl,
degreeEn .tl_set:N = \l__bithesis_value_degree_en_tl,
institute .tl_set:N = \l__bithesis_value_institute_tl,
institute .initial:n = {\tl_use:N \c__bithesis_label_university_tl},
defenseDate .tl_set:N = \l__bithesis_value_defense_date_tl,
authorEn .tl_set:N = \l__bithesis_value_author_en_tl,
schoolEn .tl_set:N = \l__bithesis_value_school_en_tl,
supervisorEn .tl_set:N = \l__bithesis_value_supervisor_en_tl,
chairmanEn .tl_set:N = \l__bithesis_value_chairman_en_tl,
majorEn .tl_set:N = \l__bithesis_value_major_en_tl,
instituteEn .tl_set:N = \l__bithesis_value_institute_en_tl,
instituteEn .initial:n = {\c__bithesis_label_university_en_tl},
defenseDateEn .tl_set:N = \l__bithesis_value_defense_date_en_tl,
defenseDateEn .initial:n = {June,~2019~(example)},
% 因为默认不显示,所以不需要设置初始值。
classifiedLevel .tl_set:N = \l__bithesis_value_classified_level_tl,
% 学生类型-工程硕博士专项
工程硕博士专项 .bool_set:N = \l__bithesis_value_engineering_special_plan_bool,
工程硕博士专项 .initial:n = {false},
% 学生类型-交叉研究方向
crossResearch .bool_set:N = \l__bithesis_value_cross_research_bool,
crossResearch .initial:n = {false},
% 学生类型-政府项目留学生
internationalStudentUGP .bool_set:N = \l__bithesis_value_international_student_ugp_bool,
internationalStudentUGP .initial:n = {false},
}
\keys_define:nn { bithesis / misc }
{
% 表格字体大小,默认为 5 号字体。
tabularFontSize .tl_set:N = \l__bithesis_misc_tabular_font_size_tl,
tabularFontSize .initial:n = {5},
arialFont .tl_set:N = \l__bithesis_misc_arial_font_path_tl,
autoref / algo .tl_set:N = \l__bithesis_misc_autoref_algo_tl,
autoref / algo .initial:n = {\g__bithesis_const_autoref_algo_tl},
autoref / them .tl_set:N = \themautorefname,
autoref / them .initial:n = {\g__bithesis_const_autoref_them_tl},
autoref / lem .tl_set:N = \lemautorefname,
autoref / lem .initial:n = {\g__bithesis_const_autoref_lem_tl},
autoref / prop .tl_set:N = \propautorefname,
autoref / prop .initial:n = {\g__bithesis_const_autoref_prop_tl},
autoref / cor .tl_set:N = \corautorefname,
autoref / cor .initial:n = {\g__bithesis_const_autoref_cor_tl},
autoref / axi .tl_set:N = \axiautorefname,
autoref / axi .initial:n = {\g__bithesis_const_autoref_axi_tl},
autoref / defn .tl_set:N = \defnautorefname,
autoref / defn .initial:n = {\g__bithesis_const_autoref_defn_tl},
autoref / conj .tl_set:N = \conjautorefname,
autoref / conj .initial:n = {\g__bithesis_const_autoref_conj_tl},
autoref / exmp .tl_set:N = \exmpautorefname,
autoref / exmp .initial:n = {\g__bithesis_const_autoref_exmp_tl},
autoref / case .tl_set:N = \caseautorefname,
autoref / case .initial:n = {\g__bithesis_const_autoref_case_tl},
autoref / rem .tl_set:N = \remautorefname,
autoref / rem .initial:n = {\g__bithesis_const_autoref_rem_tl},
hideLinks .bool_set:N = \l__bithesis_misc_hide_links_bool,
hideLinks .initial:n = {true},
autoref / figure .tl_set:N = \figureautorefname,
autoref / figure .initial:n = {\g__bithesis_const_autoref_fig_tl},
autoref / table .tl_set:N = \tableautorefname,
autoref / table .initial:n = {\g__bithesis_const_autoref_tab_tl},
autoref / equ .tl_set:N = \equationautorefname,
autoref / equ .initial:n = {\g__bithesis_const_autoref_equ_tl},
% 浮动体相关的各种间距
floatSeparation .tl_set:N = \l__bithesis_misc_float_separation_tl,
floatSeparation .initial:n = {0},
algorithmSeparation .tl_set:N = \l__bithesis_misc_algorithm_separation_tl,
algorithmSeparation .initial:n = {12pt plus 4pt minus 4pt},
tabularRowSeparation .tl_set:N = \l__bithesis_misc_tabular_row_separation_tl,
tabularRowSeparation .initial:n = {1},
}
\keys_define:nn { bithesis / const }
{
autoref .meta:nn = { bithesis / const / autoref } { #1 },
style .meta:nn = { bithesis / const / style } { #1 },
info .meta:nn = { bithesis / const / info } { #1 },
heading .meta:nn = { bithesis / const / heading } { #1 },
}
\keys_define:nn { bithesis / const / autoref }
{
algo .tl_set:N = \g__bithesis_const_autoref_algo_tl,
algo .initial:n = {\__bithesis_get_const:n {algo}},
them .tl_set:N = \g__bithesis_const_autoref_them_tl,
them .initial:n = {\__bithesis_get_const:n {them}},
lem .tl_set:N = \g__bithesis_const_autoref_lem_tl,
lem .initial:n = {\__bithesis_get_const:n {lem}},
prop .tl_set:N = \g__bithesis_const_autoref_prop_tl,
prop .initial:n = {\__bithesis_get_const:n {prop}},
cor .tl_set:N = \g__bithesis_const_autoref_cor_tl,
cor .initial:n = {\__bithesis_get_const:n {cor}},
axi .tl_set:N = \g__bithesis_const_autoref_axi_tl,
axi .initial:n = {\__bithesis_get_const:n {axi}},
defn .tl_set:N = \g__bithesis_const_autoref_defn_tl,
defn .initial:n = {\__bithesis_get_const:n {defn}},
conj .tl_set:N = \g__bithesis_const_autoref_conj_tl,
conj .initial:n = {\__bithesis_get_const:n {conj}},
exmp .tl_set:N = \g__bithesis_const_autoref_exmp_tl,
exmp .initial:n = {\__bithesis_get_const:n {exmp}},
case .tl_set:N = \g__bithesis_const_autoref_case_tl,
case .initial:n = {\__bithesis_get_const:n {case}},
rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
rem .initial:n = {\__bithesis_get_const:n {rem}},
figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
figure .initial:n = {\__bithesis_get_const:n {fig}},
table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
table .initial:n = {\__bithesis_get_const:n {tab}},
equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
equ .initial:n = {\__bithesis_get_const:n {equ}},
}
\keys_define:nn { bithesis / const / style }
{
substituteSymbol .tl_set:N = \g__bithesis_const_substitute_symbol_tl,
substituteSymbol .initial:n = {*},
}
\keys_define:nn { bithesis / const / info }
{
degree .tl_set:N = \g__bithesis_const_info_degree_tl,
degree .initial:n = {\c__bithesis_auto_tl},
major .tl_set:N = \g__bithesis_const_info_major_tl,
major .initial:n = {\c__bithesis_auto_tl},
}
\keys_define:nn { bithesis / const / heading }
{
acknowledgements .tl_set:N = \g__bithesis_const_heading_acknowledgements_tl,
acknowledgements .initial:n = {
\__bithesis_get_const:n {ack}
},
}
\keys_define:nn { bithesis / style }
{
head .tl_set:N = \l__bithesis_style_head_tl,
head .initial:n = {
\clist_item:Nn \c__bithesis_bachelor_thesis_header_clist \g__bithesis_thesis_type_int
},
headline .tl_set:N = \l__bithesis_style_headline_tl,
headline .initial:n = {
\clist_item:Nn \c__bithesis_bachelor_thesis_headline_clist \g__bithesis_thesis_type_int
},
bibliographyIndent .bool_set:N = \l__bithesis_style_bibliography_indent_bool,
bibliographyIndent .initial:n = {true},
pageVerticalAlign .choices:nn = {top, scattered} {
\tl_if_eq:NnTF \l_keys_choice_tl {top}
{ \raggedbottom }
{ \flushbottom }
},
pageVerticalAlign .initial:n = {top},
non-CJK-font-in-headings .choice:,
non-CJK-font-in-headings / serif .code:n = { \bool_set_false:N \l__bithesis_arial_as_title_font_bool },
non-CJK-font-in-headings / sans .code:n = { \bool_set_true:N \l__bithesis_arial_as_title_font_bool },
non-CJK-font-in-headings .initial:n = {serif},
% 数学字体配置
mathFont .choices:nn = {
asana, bonum, cm, concrete, dejavu, erewhon, euler,
fira, garamond, gfsneohellenic, kp, libertinus, lm, newcm,
pagella, schola, stix, stix2, termes, xcharter, xits, none,
} { \tl_set_eq:NN \l__bithesis_style_math_font_tl \l_keys_choice_tl },
mathFont .initial:n = {cm},
% Options that will be pass to `unicode-math` pkgs.
unicodeMathOptions .tl_set:N = \l__bithesis_unicode_math_options_tl,
% Windows 平台开启宋体伪粗体。
windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold,
windowsSimSunFakeBold .initial:n = {false},
% 控制英文是否使用 hyphen 进行换行
hyphen .bool_set:N = \l__bithesis_style_hyphen_bool,
hyphen .initial:n = {true},
% 控制公式和上下文的距离
mathAboveDisplaySkip .dim_set:N = \l__bithesis_style_math_above_display_skip_dim,
mathAboveDisplaySkip .initial:n = {10pt},
mathBelowDisplaySkip .dim_set:N = \l__bithesis_style_math_below_display_skip_dim,
mathBelowDisplaySkip .initial:n = {10pt},
betterTimesNewRoman .bool_set:N = \l__bithesis_style_better_new_roman_bool,
betterTimesNewRoman .initial:n = {false},
}
\keys_define:nn { bithesis / TOC }
{
title .tl_set:N = \l__bithesis_toc_title_tl,
title .initial:n = {
\__bithesis_get_const:n {toc}
},
abstract .bool_set:N = \l__bithesis_add_abstract_to_toc_bool,
abstract .initial:n = {true},
abstractEn .bool_set:N = \l__bithesis_add_abstract_en_to_toc_bool,
abstractEn .initial:n = {true},
TOC .bool_set:N = \l__bithesis_add_toc_to_toc_bool,
TOC .initial:n = {false},
symbols .bool_set:N = \l__bithesis_add_symbols_to_toc_bool,
symbols .initial:n = {true},
}
\keys_define:nn { bithesis / appendices }
{
chapterLevel .bool_set:N = \l__bithesis_appendices_chapter_level_bool,
title .tl_set:N = \l__bithesis_appendices_title_tl,
TOCTitle .tl_set:N = \l__bithesis_appendix_toc_title_tl,
}
\keys_define:nn { bithesis / publications }
{
% mode .choice:,
% mode .value_required:n = true,
% mode .choices:Vn =
% \c__bithesis_publication_modes_clist
% {
% \int_new:N \l__bithesis_publication_mode_int
% \int_set:Nn \l__bithesis_publication_mode_int \l_keys_choice_int
% },
% mode .initial:n = biblatex,
sorting .bool_set:N = \l__bithesis_publications_sorting_bool,
sorting .initial:n = {true},
omit .bool_set:N = \l__bithesis_publications_omit_bool,
omit .initial:n = {false},
maxbibnames .int_set:N = \l__bithesis_publications_maxbibnames_int,
maxbibnames .initial:n = {10},
minbibnames .int_set:N = \l__bithesis_publications_minbibnames_int,
minbibnames .initial:n = {10},
}
\keys_define:nn { bithesis-internal / pre-frontmatter }
{
% 是否将标题加入PDF书签
bookmarked .bool_set:N = \l__bithesis_internal__pre_frontmatter__bookmarked_bool,
}
\keys_define:nn { bithesis-internal / conclusion }
{
title .tl_set:N = \l__bithesis_internal__conclusion__title_tl,
}
\ProcessKeysOptions { bithesis / option }
\__bithesis_if_graduate:TF {
\keys_set:nn {bithesis} {cover/hideCoverInPeerReview = false}
} {
\keys_set:nn {bithesis} {cover/hideCoverInPeerReview = true}
}
\cs_new:Npn \__bithesis_resolve_auto_values: {
\tl_if_eq:NnT \g__bithesis_const_info_degree_tl {\c__bithesis_auto_tl} {
\tl_if_eq:NnTF \l__bithesis_value_degree_type_tl {academic} {
\keys_set:nn {bithesis} {const/info/degree = \c__bithesis_graduate_label_degree_tl}
} {
\keys_set:nn {bithesis} {const/info/degree = 申\quad 请\quad 类\quad 别}
}
}
\tl_if_eq:NnT \g__bithesis_const_info_major_tl {\c__bithesis_auto_tl} {
\__bithesis_if_graduate:TF {
\tl_if_eq:NnTF \l__bithesis_value_degree_type_tl {academic} {
\keys_set:nn {bithesis} {const/info/major = \c__bithesis_graduate_label_major_tl}
} {
\keys_set:nn {bithesis} {const/info/major = 学\quad 位\quad 领\quad 域}
}
} {
\keys_set:nn {bithesis} {const/info/major = \__bithesis_get_const:n {major}}
}
}
}
\__bithesis_if_thesis_english:T {
\PassOptionsToClass{scheme=plain}{ctexbook}
}
\bool_if:NT \g__bithesis_blind_mode_bool {
\bool_set_false:N \g__bithesis_twoside_bool
}
\bool_if:NTF \g__bithesis_twoside_bool {} {
\PassOptionsToClass{oneside}{ctexbook}
}
\PassOptionsToClass{openany}{ctexbook}
\DeclareOption*{
\PassOptionsToClass{\l__bithesis_options_to_ctex_tl}{ctexbook}
}
\PassOptionsToPackage{quiet,AutoFakeBold=\g__bithesis_auto_fake_bold_tl,AutoFakeSlant}{xeCJK}
\ProcessOptions\relax
\LoadClass[zihao=-4,]{ctexbook}
\RequirePackage{geometry}
\RequirePackage[table,xcdraw]{xcolor}
\RequirePackage{xeCJK}
\RequirePackage[bodytextleadingratio=1.56]{zhlineskip}
\RequirePackage{titletoc}
\RequirePackage{graphicx}
\RequirePackage{fancyhdr}
\RequirePackage{pdfpages}
\RequirePackage[nodisplayskipstretch]{setspace}
\RequirePackage{booktabs}
\RequirePackage{multirow}
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\RequirePackage[bookmarksnumbered]{hyperref}
\RequirePackage[strut=off]{caption}
\RequirePackage{array}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{pifont}
\RequirePackage{amsthm}
\RequirePackage{pdfpages}
\RequirePackage{listings}
\RequirePackage{enumitem}
\RequirePackage{fmtcount}
\pdfstringdefDisableCommands{%
\let\quad\empty
}
\__bithesis_if_graduate:TF {
\int_set:Nn \g__bithesis_head_zihao_int {5}
\geometry{
a4paper,
left=2.7cm,
bottom=2.5cm + 7bp,
top=3.5cm + 7bp,
right=2.7cm,
% `headsep' is affected by `top' option.
headsep = 3.5cm + 7bp - 2.5cm - 15bp,
headheight = 15 bp,
% `footskip' is affected by `bottom' option.
footskip = 2.5cm + 7bp - 1.8cm,
}
} {
\int_set:Nn \g__bithesis_head_zihao_int {4}
\geometry{
a4paper,
left=3cm,
bottom=2.6cm + 7bp,
top=3.5cm + 7bp,
right=2.6cm,
% `headsep' is affected by `top' option.
headsep = 3.5cm + 7bp - 2.4cm - 20bp,
headheight = 20 bp,
% `footskip' is affected by `bottom' option.
footskip = 2.6cm + 7bp - 2cm,
}
}
\ctex_at_end_preamble:n {
\bool_if:NTF \l__bithesis_style_better_new_roman_bool {
\defaultfontfeatures[TeX~Gyre~Termes]
{
Extension = .otf ,
UprightFont = texgyretermes-regular,
BoldFont = texgyretermes-bold,
ItalicFont = texgyretermes-italic,
BoldItalicFont = texgyretermes-bolditalic,
}
\setmainfont{TeX~Gyre~Termes}
}{
\setmainfont{Times~New~Roman}
\setromanfont{Times~New~Roman}
}
}
\cs_new:Npn \__bithesis_font_path:
{
\str_if_eq:NNTF { \l__bithesis_font_type_tl } { font }
{ }
{ Path = \l__bithesis_font_path_tl / , }
}
\cs_new:Npn \__bithesis_load_unicode_math_pkg:
{
\PassOptionsToPackage { \l__bithesis_unicode_math_options_tl } { unicode-math }
\RequirePackage { unicode-math }
}
\cs_new:Npn \__bithesis_define_math_font:nn #1#2
{
\cs_new:cpn { __bithesis_load_math_font_ #1 : }
{
\__bithesis_load_unicode_math_pkg:
\setmathfont { #2 }
}
}
\clist_map_inline:nn
{
{ asana } { Asana-Math.otf },
{ concrete } { Concrete-Math.otf },
{ erewhon } { Erewhon-Math.otf },
{ euler } { Euler-Math.otf },
{ fira } { FiraMath-Regular.otf },
{ garamond } { Garamond-Math.otf },
{ gfsneohellenic } { GFSNeohellenicMath.otf },
{ kp } { KpMath-Regular.otf },
{ libertinus } { LibertinusMath-Regular.otf },
{ lm } { latinmodern-math.otf },
{ newcm } { NewCMMath-Regular.otf },
{ stix } { STIXMath-Regular.otf },
{ stix2 } { STIXTwoMath-Regular.otf },
{ xcharter } { XCharter-Math.otf },
{ xits } { XITSMath-Regular.otf },
{ bonum } { texgyrebonum-math.otf },
{ dejavu } { texgyredejavu-math.otf },
{ pagella } { texgyrepagella-math.otf },
{ schola } { texgyreschola-math.otf },
{ termes } { texgyretermes-math.otf }
}
{ \__bithesis_define_math_font:nn #1 }
\cs_new:Npn \__bithesis_load_math_font_cm: { }
\cs_new:Npn \__bithesis_load_math_font_none: { }
\cs_new:Npn \__bithesis_load_font:
{
\use:c { __bithesis_load_math_font_ \l__bithesis_style_math_font_tl : }
}
\ctex_at_end_preamble:n {
% 针对 Windows 字体采用 Fake Bold 宋体
\bool_if:NT \l__bithesis_style_windows_simsum_fake_bold
{
\RequirePackage{ifplatform}
\ifwindows
\setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant]
\fi
}
% 在导言区末尾加载数学字体。
\__bithesis_load_font:
% misc / hideLinks 选项
\bool_if:NTF \l__bithesis_misc_hide_links_bool
{
\hypersetup { hidelinks }
} {
\definecolor{blue}{RGB}{10,10,110}
\hypersetup{
colorlinks=true,
}
}
\bool_if:NTF \l__bithesis_arial_as_title_font_bool {
% 手动指定时要加载 Arial
\newfontfamily\arialfamily{Arial}
} {
% 即使未指定,本科全英文专业模板的声明也需要 Arial
\__bithesis_if_thesis_int_type:nT {3} {
\newfontfamily\arialfamily{Arial}
}
}
% 无论中英文,封面都可能需要细黑体。
\tl_if_blank:VTF \l__bithesis_cover_xihei_font_path_tl {}
{
\setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]
{\l__bithesis_cover_xihei_font_path_tl}
}
% 对于本科全英文专业模板,需要自定义日期格式。
\__bithesis_if_thesis_int_type:nT {3} {
\RequirePackage[en-US]{datetime2}
\RequirePackage{indentfirst}
\DTMlangsetup[en-US]{dayyearsep={\space}}
}
% Define biblatex category if it was imported.
% 这部分是给研究生模板中的
% 「攻读学位期间发表论文与研究成果清单」使用的。
\cs_if_exist:NT \DeclareBibliographyCategory {
\DeclareBibliographyCategory{mypub}
}
% Define biblatex strings if it was imported.
% 这部分是给研究生模板中的
% gbpunctin = false 时使用的。
\cs_if_exist:NT \DefineBibliographyStrings {
\DefineBibliographyStrings{english}{in={}}
\DefineBibliographyStrings{english}{incn={}}
}
% 修改 biblatex 中「专利」(patent)部分的著录格式。
% 主要根据北理工自定义的规范,参考 biblatex 和
% biblatex-gb7714-2015 的实现修改而成。
%
% 默认不开启,因为此修改可能会产生其他边界问题。
\bool_if:NT \g__bithesis_quirks_mode_bool {
\cs_if_exist:NT \DeclareBibliographyDriver {
%
% 重设专利title的输出,将文献类型标识符输出出去
%
\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
\ifboolexpr{%
test{\iffieldundef{title}}%
and%
test{\iffieldundef{subtitle}}%
}%
{}%
{\printtext[title]{\bibtitlefont%
\printfield[titlecase]{title}%
\ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
{}{\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
\iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
{\setunit{\subtitlepunct}\printfield{titleaddon}}%
% :地区
\setunit{\subtitlepunct}\iflistundef{location}
{}
{\setunit*{\subtitlepunct}%
\printtext{%[parens]
\printlist[][-\value{listtotal}]{location}}}%
% ,专利号
\setunit{\addcomma\addspace}\printfield{number}%写专利号
\setunit{\addcomma\addspace}
\usebibmacro{newsdate}%
}%
}%
}
%
% 重定义专利文献驱动
%
\DeclareBibliographyDriver{patent}{%源来自standard.BBX
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{patenttitle}%给出专利专用的标题输出
\iftoggle{bbx:gbstrict}{}{%
\newunit%
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}
}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\newunit\newblock
\usebibmacro{byholder}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{annotation}\usebibmacro{finentry}}
}
}
}
\cs_new:Npn \__bithesis_xihei:n #1 {
\xeCJK_family_if_exist:nTF {xihei} {
\CJKfamily{xihei} #1
}{
\heiti #1
}
}
\cs_new:Npn \__bithesis_title_font: {
\bool_if:NTF \l__bithesis_arial_as_title_font_bool {
% 即使是英文模板,仍可能出现中文,也需设置中文字体。
\heiti\arialfamily
} {
% 西文保持原本的 Times New Roman。黑体一般不搭配衬线体,但学校要求如此。
\heiti
}
}
\cs_new:Npn \__bithesis_unnumchapter_style: {
% 本科全英文、研究生学位论文需要加粗
\int_compare:nNnTF {\g__bithesis_thesis_type_int} > {2} {
\bfseries
} {
\mdseries
}
}
\cs_set:Npn \arabicHeiti #1 {#1}
\fancypagestyle{BIThesis}{
\fancyhf{}
% 定义页眉、页码
\fancyhead[C]{
\zihao{\int_use:N \g__bithesis_head_zihao_int}
\ziju{0.08}
\songti{\tl_use:N \l__bithesis_style_head_tl}
}
\fancyfoot[C]{\songti\zihao{5} \thepage}
% 页眉分割线稍微粗一些
\RenewDocumentCommand \headrulewidth {} {0.6pt}
}
\ctexset{chapter={
number = {\arabicHeiti{ \arabic{chapter} }},
format = { \__bithesis_title_font: \bfseries \centering \zihao{3}},
nameformat = {},
titleformat = {},
aftername = \hspace{9bp},