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
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
|
%%
%% ---------------------------------------------------------------
%% biblatex-gb7714-2015 --- A biblatex implementation of the
%% GBT7714-2015 bibliography style,author year sequence
%% Maintained by huzhenzhen
%% history:
%% 2016/05/20 v1.0
%% 2016/10/23 v1.0a
%% 2016/11/11 v1.0b
%% 2016/11/14 v1.0c
%% 2016/11/24 v1.0d
%% 2016/12/07 v1.0e
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
\ProvidesFile{gb7714-2015ay.bbx}[2016/12/07 v1.0e biblatex bibliography style]
%=====================================================================
%加载标准样式
\RequireBibliographyStyle{authoryear} % Load the standard style to avoid copy-pasting unnecessary material
%=====================================================================
%增加一些功能函数
\providetoggle{iftexlivesix}
%版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制
%所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix}
\def\numparserta#1.#2\relax{#1}%注意relax的重要性
\def\numparsertb#1.#2\relax{#2}
\def\numinteger{\expandafter\numparserta\abx@version\relax}
\def\numdigital{\expandafter\numparsertb\abx@version\relax}
\ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftexlivesix}}{\togglefalse{iftexlivesix}}
%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成
\providetoggle{ifCJKforgbt}
\def\testCJKfirstchar#1#2&{%
\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}%
}%
\def\testCJKfirst#1{%
%\edef\tempa{#1}%
\exploregroups%
\StrChar{#1}{1}[\tempa]%
\expandafter\testCJKfirstchar\tempa&}
%判断是否是标准
\providetoggle{ifnoteeqstandard}
\def\testifnoteeqstd{%
\iffieldundef{note}{\togglefalse{ifnoteeqstandard}}%判断一下,是否是报纸和标准
{\def\comparetmp{standard}\edef\comparetmpb{\thefield{note}}%
\ifx\comparetmp\comparetmpb%
\toggletrue{ifnoteeqstandard}%
\else%
\togglefalse{ifnoteeqstandard}%
\fi}}
%用于解析连续出版物,2个卷期的情况
\def\multivolumeparsetoparts#1/#2{\def\multivolumefirst{#1}\def\multivolumesecond{#2}}
%\def\multinumberparsetoparts#1/#2{\def\multinumberfirst{#1}\def\multinumbersecond{#2}}
%这里利用李志奇的范围数据解析函数,修改后用来处理卷volume的范围。
%他的这个函数是通用的,只能在使用数据前使用,如果多次使用前一次得到的数据就会被冲掉
%这里的范围起止判断符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
\def\gbt@parse@range#1{%
\edef\gbt@tmpa{#1}%
\expandafter\gbt@parse@rangei\gbt@tmpa-\@empty}
\def\gbt@parse@rangei#1-#2\@empty{%
\global\def\gbt@range@first{#1}%
\def\gbt@tmpa{#2}%
\ifx\gbt@tmpa\@empty%
\global\def\gbt@range@second{}%
\else%
\gbt@parse@rangeii#2\@empty%
\fi}
\def\gbt@parse@rangeii#1-#2\@empty{%
\def\gbt@tmpa{#2}%
\ifx\gbt@tmpa\@empty%
\global\def\gbt@range@second{#1}%
\else%
\gbt@parse@rangeii#2\@empty%
\fi}
%这里写的number的解析函数,与上面的是类似的。
\def\multinumberparser#1{%
\edef\gbnumbertmp{#1}%
\expandafter\multinumberparsetoparts\gbnumbertmp-\@empty}
\def\multinumberparsetoparts#1-#2\@empty{%
\def\multinumberfirst{#1}%
\def\gbnumbertmp{#2}%
\ifx\gbnumbertmp\@empty%
\def\multinumbersecond{}%
\else%
\multinumberparsetopartsb#2\@empty%
\fi}
\def\multinumberparsetopartsb#1-#2\@empty{%
\def\gbnumbertmp{#2}%
\ifx\gbnumbertmp\@empty%
\def\multinumbersecond{#1}%
\else%
\multinumberparsetopartsb#2\@empty%
\fi}
%=====================================================================
%设置宏包选项
%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
%因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
\DeclareBibliographyOption[string]{align}[right]{}%
\iftoggle{iftexlivesix}{% Alter settings that carry through from biblatex
%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式
\ExecuteBibliographyOptions{
useprefix = true, %名字的信息包括前缀
%firstinits = true, %名字有缩写,参考3.1.2.3 Internal
giveninits = true,
date = year, %日期仅写到年
%maxnames = 3 , %设置名字最大数量
%minnames = 3, %设置缩减后的名字最小数量
maxbibnames=3, %将文献列表和引用中最大名字数量区分开
minbibnames=3,
}}
{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式
\ExecuteBibliographyOptions{
useprefix = true, %名字的信息包括前缀
firstinits = true, %名字有缩写,参考3.1.2.3 Internal
date = year, %日期仅写到年
%maxnames = 3 , %设置名字最大数量
%minnames = 3, %设置缩减后的名字最小数量
maxbibnames=3, %将文献列表和引用中最大名字数量区分开
minbibnames=3,
%uniquename=init,
}}
%=====================================================================
%设置本地化字符串
%新建一个当地化字符串,用来记录“等”字符
\NewBibliographyString{andotherscn}
\NewBibliographyString{noaddress}
\NewBibliographyString{nopublisher}
%直接利用当地化格式english进行修改一些中文的格式,
%具体可以修改哪些需要的参考english.lbx文件
%当然也可以增加比如上面定义的andotherscn
\DefineBibliographyStrings{english}{
bibliography = {参考文献},
references = {参考文献},
bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译
and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
%andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等
andotherscn = {等}, %将超过3个人名的省略,et al.改成为 等
noaddress = {[S.l.]},
nopublisher = {[s.n.]},
backrefpage = {引用页:},
backrefpages = {引用页:},
}
%=====================================================================
%动态数据修改,修改输入的源文件数据,用于中文判断等
%首先把作者和译者信息准确的记录到userf,usere中,用于判断是否是cjk字符。
%注意\DeclareSourcemap命令只能出现一次
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{%因为要做佚名处理,所以这里先对有些只有编者而没有作者的情况进行处理
\step[fieldsource=editor]
\step[fieldset=author,origfieldval]
}
\map{%默认情况下将空缺作者设置为佚名
\step[fieldset=author, fieldvalue={佚名}]
}
\map[overwrite]{%当标题带有英文字符,且作者为佚名的情况,设置作者为noauthor,
%也有一些特殊情况可能处理不到,比如标题中英混合,作者又却是
\step[fieldsource=title,match=\regexp{[a-zA-Z]},final]
\step[fieldsource=author,match=\regexp{佚名}, replace={NOAUTHOR}]
}
\map{ %增加文献标识符如[M],[J]等,下面首先生成这一信息
%\perdatasource{examples.bib}
\pertype{article}
\pertype{periodical}
\step[fieldset=usera, fieldvalue={J}]
}
\map{
\pertype{book}
\pertype{inbook}
\step[fieldset=usera, fieldvalue={M}]
}
\map{
\pertype{patent}
\step[fieldset=usera, fieldvalue={P}]
}
\map{
\pertype{inproceedings}
\pertype{conference}
\step[fieldset=usera, fieldvalue={C}]
\step[fieldsource=institution] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
\step[fieldset=publisher, origfieldval]
\step[fieldsource=editor] %
\step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{proceedings}
\step[fieldset=usera, fieldvalue={C}]
\step[fieldsource=institution] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
\step[fieldset=publisher, origfieldval]
\step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下
\step[fieldset=author, origfieldval]
}
\map{
\pertype{report}
\step[fieldset=usera, fieldvalue={R}]
}
\map{
\pertype{thesis}
\step[fieldset=usera, fieldvalue={D}]
}
\map{
\pertype{online}
\step[fieldset=usera, fieldvalue={EB}]
}
\map{
\pertype{manual}
\step[fieldset=usera, fieldvalue={A}]
\step[fieldsource=edition] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
\step[fieldset=version, origfieldval]
\step[fieldsource=organization]%因为用的report的驱动,所以需要institution域,也把organization转成它,这样增大兼容性
\step[fieldset=institution, origfieldval]
}
\map{
\pertype{incollection}
\step[fieldset=usera, fieldvalue={G}]
}
\map{
\pertype{collection}
\step[fieldset=usera, fieldvalue={G}]
\step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下
\step[fieldset=author, origfieldval]
}
\map{
\pertype{unpublished}
\step[fieldset=usera, fieldvalue={Z}]
}
\map{
\step[fieldsource=author]
\step[fieldset=userf, origfieldval]
\step[fieldsource=translator]
\step[fieldset=usere, origfieldval]
\step[fieldsource=year]%处理一些用year表示date的情况
\step[fieldset=date, origfieldval]
}
\map{%将entrykey放入keywords中用于后期的使用
\step[fieldsource=entrykey]
\step[fieldset=keywords, origfieldval]
}
\map[overwrite]{%这里还必须有overwrite,怎么之前会觉得没有问题呢,可能是之前版本拷错了,还是之前是texlive2015变16后biber有了变化(2016-1207修改正确)
\step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
\step[fieldset=keywords, fieldvalue={,}, append]
\step[fieldset=keywords, origfieldval, append]
}
\map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下
%认为是中文的,将文献userb设置成cn,用于排序
\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\-]},final]
\step[fieldset=userb,fieldvalue={cn}]
}
\map{%将没有设置的userb设置成en,即认为不是中文的就是英文的。
\step[fieldset=userb,fieldvalue={en}]
}
}
}
%=====================================================================
%设置排序格式
%排序用降序或userb域
\DeclareSortingScheme{nyt}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\field{userb}
}
\sort{%[direction=descending]
\field{sortname}
\field{author}
\field{editor}
\field{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\field[padside=left,padwidth=4,padchar=0]{volume}
\literal{0000}
}
}
%=====================================================================
%参考文献列表环境
\defbibenvironment{bibliography}%修改参考文献列表环境,不要缩进
{\list
{}
{%\setlength{\leftmargin}{\bibhang}%
%\setlength{\itemindent}{-\leftmargin}%
\setlength{\leftmargin}{0pt}%
\setlength{\itemindent}{0pt}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item}
%=====================================================================
%设置单元或块等的标点
%将名字简写后的点去掉
%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY
\renewrobustcmd*{\bibinitperiod}{}
%\newcommand*{\revsdnamepunct}{\addcomma} %来源biblatex.def
\renewcommand*{\revsdnamepunct}{}
%\newcommand*{\subtitlepunct}{\newunitpunct} %修改标题和其它标题信息间的标点
\renewcommand*{\subtitlepunct}{\addcolon\space} %来源biblatex.def
%关于双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
%这里调整一下两种语言参考文献的间隔
%\renewcommand*{\entrysetpunct}{\addsemicolon\space}%源来自biblatex.def
\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}
%页码引用格式的修改
%\newcommand*{\bibpagespunct}{\addcomma\space}
\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号
%=====================================================================
%修改域的格式
%新增文献类型标识符的格式
%\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak}
\DeclareFieldFormat{gbtypeflag}{%
\iffieldundef{url}%当存在url时,增加一个OL标识符
{\nobreak\printtext{[}\nobreak#1\printtext{]}\nobreak}%
{\nobreak\printtext{[}\nobreak#1\printtext{\texttt{/}OL]}\nobreak}%
}
\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
\iffieldundef{url}%当存在url时,增加一个OL标识符
{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
{\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
}
\DeclareFieldFormat{gbtypeflags}{%用于报纸newspaper
\iffieldundef{url}%当存在url时,增加一个OL标识符
{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
{\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
}
%重设title的输出格式,不加emph,原格式来自biblatex.def文件
%\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}}
%\DeclareFieldFormat{issuetitle}{\mkbibemph{#1}}
%\DeclareFieldFormat{maintitle}{\mkbibemph{#1}}
%\DeclareFieldFormat{title}{\mkbibemph{#1}}
%\DeclareFieldFormat{booktitle}{\mkbibemph{#1}}
\DeclareFieldFormat{title}{#1\adddot\addthinspace}
\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
\DeclareFieldFormat{issuetitle}{#1}
\DeclareFieldFormat{maintitle}{#1}
\DeclareFieldFormat{booktitle}{#1}
%\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
% {title}{\mkbibquote{#1\isdot}}
\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
[article,patent,thesis,unpublished]
{title}{#1\adddot\addthinspace}
\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
[inbook,incollection,inproceedings]
{title}{#1\nopunct\unspace}
%重设标题格式,将其修改为首字母大写
%\DeclareFieldFormat{titlecase}{#1}
\DeclareFieldFormat{titlecase}{\MakeCapital#1}
\iftoggle{iftexlivesix}{
%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式
\renewbibmacro*{name:given-family}[4]{%利用family-given定义given-family
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifdefvoid{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}\isdot}%
\ifprefchar{}{\bibnamedelimc}}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot
\ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital{#2}
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot
%
\ifboolexpe{%
test {\ifdefvoid{#2}}
and
test {\ifdefvoid{#3}}}
{}
{\revsdnamepunct}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital{#2}
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}}
\renewbibmacro*{name:family-given}[4]{%利用family-given定义given-family
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifdefvoid{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}\isdot}%
\ifprefchar{}{\bibnamedelimc}}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot
\ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital{#2}
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot
%
\ifboolexpe{%
test {\ifdefvoid{#2}}
and
test {\ifdefvoid{#3}}}
{}
{\revsdnamepunct}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%%\MakeCapital{#2}
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}}
}
{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式
%作者名字的处理,参考文档4.2.3节,3.12.4 Name Parts and Name Spacing
\renewbibmacro*{name:last-first}[4]{%
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifblank{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}\isdot}%
\ifpunctmark{'}{}{\bibnamedelimc}}%
%\mkbibnamelast{#1}\isdot
\ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
%注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开
%因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{}
%\mkbibnamelast{\MakeUppercase{#1}}\isdot
%\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
\ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
\ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
%\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}}
\ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
%\mkbibnamelast{\MakeUppercase{#1}}\isdot
%\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
\ifblank{#2#3}{}{\revsdnamepunct}%
\ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
\ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
\addcomma\addspace%
\ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
}}
\renewbibmacro*{name:first-last}[4]{%
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifblank{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}\isdot}%
\ifpunctmark{'}{}{\bibnamedelimc}}%
%\mkbibnamelast{#1}\isdot
\ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
%注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开
%因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{}
%\mkbibnamelast{\MakeUppercase{#1}}\isdot
%\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
\ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
\ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
%\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}}
\ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
%\mkbibnamelast{\MakeUppercase{#1}}\isdot
%\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
\ifblank{#2#3}{}{\revsdnamepunct}%
\ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
\ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
\addcomma\addspace%
\ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
}}
}
%重设title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件
\renewbibmacro*{title}{%
\ifboolexpr{%
test{\iffieldundef{title}}%
and%
test{\iffieldundef{subtitle}}%
}%
{}%
{\printtext[title]{%
\printfield[titlecase]{title}%
\ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
{}{\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
{\setunit{\subtitlepunct}\printfield{titleaddon}}%
\iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
{\def\comparetmp{news}\def\comparetmpa{standard}\edef\comparetmpb{\thefield{note}}%
\ifx\comparetmp\comparetmpb%判断是否为报纸
\printfield[gbtypeflagn]{usera}%
\else%
\ifx\comparetmpa\comparetmpb%判断是否为标准
\printfield[gbtypeflags]{usera}%
\else%
\printfield[gbtypeflag]{usera}%
\fi%
\fi%
}%
\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
%\newunit
}%
}%
}
%url相关输出,源来自biblatex.def
%\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{#1}}
\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行
%\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}}
\renewbibmacro*{url+urldate}{%
%\usebibmacro{url}%%更换url的位置,放到下面
\iffieldundef{urlyear}%
{}{%\setunit*{\addspace}%
\usebibmacro{urldate}}%
\setunit{\addperiod\addspace}%
\usebibmacro{url}}
\renewbibmacro*{url}{\printfield{url}}
%\newbibmacro*{urldate}{\printurldate} %引用时间修改如下一行
\renewbibmacro*{urldate}{%
\addspace\printtext{[}\printfield{urlyear}%
\iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
\iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
\newbibmacro*{newsdate}{%%新增加一个新闻日期
\iffieldundef{year}{}{\printfield{year}%
\iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}
}%
\newbibmacro*{modifydate}{%新增加一个带括号的日期
\printtext{%
\iffieldundef{year}{}{\mkbibparens{\printtext{\printfield{year}}%
\iffieldundef{month}{}{\bibrangedash\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
}}%
%\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}}%页码引用格式的修改
\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符
%调整doi+eprint+url格式,源来自standard.bbx
%因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
\renewbibmacro*{doi+eprint+url}{%
% \iftoggle{bbx:doi}%把doi的位置放到url后面
% {\printfield{doi}}
% {}%
%\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
%\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}
\newunit\newblock
\iftoggle{bbx:doi}
{\printfield{doi}}
{}}
\renewbibmacro*{chapter+pages}{%
\printfield{chapter}%
\iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
\setunit{\bibpagespunct}%
\printfield{pages}}%
%\newunit %这里的标点去掉
}
%对版本信息做出修改,源来自biblatex.DEF
\DeclareFieldFormat{edition}{%
%\testCJKfirst{\thefield{title}}%
\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}%
%直接用title不行?可能是需要在该句后面在加一个{},在展开的时候需要。
%\testCJKfirst{\thefield{title}} %直接用这句不行,原因不明
\ifinteger{#1}%
{\iftoggle{ifCJKforgbt}{\printtext{#1版}}%
{\mkbibordedition{#1}~\bibstring{edition}}}%
{#1\isdot}}
%对version的版本信息做出修改,源来自biblatex.DEF
\DeclareFieldFormat{version}{%
\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}%
\ifinteger{#1}%
{\iftoggle{ifCJKforgbt}{\printtext{#1版}}%
{\mkbibordedition{#1}~\bibstring{version}}}%
{#1\isdot}}
\renewbibmacro*{author}{%
\ifboolexpr{
test \ifuseauthor
and
not test {\ifnameundef{author}}
}
{\usebibmacro{bbx:dashcheck}
{%\bibnamedash
\printnames{author}%
}%
{\usebibmacro{bbx:savehash}%
\printnames{author}%
\iffieldundef{authortype}
{\setunit{\addspace}}
{\setunit{\addcomma\space}}}%
\iffieldundef{authortype}
{}
{\usebibmacro{authorstrg}%
\setunit{\addspace}}}%
{\global\undef\bbx@lasthash
\usebibmacro{labeltitle}%
\setunit*{\addspace}}%
\setunit{\addcomma\space}%增加一个逗号
\usebibmacro{date+extrayear}
}
%重设date+extrayear格式,源来自authoryear.BBX
\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}
{}
{\printtext{%[parens]%这里把括号去掉
\iffieldsequal{year}{\thefield{datelabelsource}year}
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}}%
%修改译者位置格式,bytranslator+others原格式来自biblatex.def文件
\renewbibmacro*{bytranslator+others}{%
\ifnameundef{translator}
{}
{%\usebibmacro{bytranslator+othersstrg}
%\setunit{\addspace}%
\printnames[bytranslator]{translator}%
\clearname{translator}%
\usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
\setunit{\addspace}%
\newunit}%
\usebibmacro{withothers}}
%判断作者或译者是否中文,若中文用字符等,否则用etal。
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{%这里做一个判断是在处理author还是translator用于两者是不同语言的情况
\ifcurrentname{translator}{\testCJKfirst{\thefield{usere}}}{\testCJKfirst{\thefield{userf}}}%
%这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面
\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{\finalandcomma}%
\andothersdelim\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}
%\andothersdelim\bibstring{andotherscn}
}
{}}
%出版社和地址的处理,当没有出版社地址时
%直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
%事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
\renewbibmacro*{publisher+location+date}{%
\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}%
\testifnoteeqstd%
\iflistundef{location}{%\adddot
\iftoggle{ifnoteeqstandard}{}{%
\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}\setunit*{\addcolon\addspace}}{\printtext{[S.l.\adddot]}\setunit*{\addcolon\addspace}}}}% \bibstring{noaddress}
{\printlist{location}\setunit*{\addcolon\addspace}}%
%\addcolon\addspace%
\iflistundef{publisher}{%
\iftoggle{ifnoteeqstandard}{}{%
\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}\setunit{\adddot\addspace}\setunit*{\addcolon\addspace}}
%\mkbibbrackets
%{\printtext{[s.n.\adddot]}\setunit{\adddot\addspace}\setunit*{\addcolon\addspace}}}}%\bibstring{nopublisher}
{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcolon\addspace}}}}
{\printlist{publisher}\setunit*{\addcolon\addspace}}%
%\addcomma\addspace%
%\usebibmacro{date}%
%\newunit %去掉这个标点
}
%修改析出文献的文集的标题与附加标题间的符号
\renewbibmacro*{booktitle}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}
{}
{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}%
\newunit%标点换成下一句
\setunit{\subtitlepunct}}%
\printfield{booktitleaddon}}
%调整期刊名的格式,源来自standard.bbx
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
%\setunit*{\addspace}%
\setunit*{\addcomma\addspace}%修改为增加一个逗号
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
%\usebibmacro{volume+number+eid}%
%\setunit{\addspace}%
\usebibmacro{issue+date}%
%\setunit{\addcolon\space}%
\iffieldundef{volume}{}{\setunit{\addcomma\space}}%
%换成逗号和空格
\usebibmacro{issue}%
\usebibmacro{volume+number+eid}%把卷期放到年份后面
%\newunit
}
%调整期刊年份的格式,去掉括号
\renewbibmacro*{issue+date}{%
\printtext{%去掉了[parens]
\iffieldundef{issue}
{%\usebibmacro{date}
\iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准
{\def\comparetmp{news}\edef\comparetmpb{\thefield{note}}%
\ifx\comparetmp\comparetmpb%
\usebibmacro{newsdate}%
\else%
\usebibmacro{date}%
\fi}%
}
{\printfield{issue}%
\setunit*{\addspace}%
%\usebibmacro{date}
\iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准
{\def\comparetmp{news}\edef\comparetmpb{\thefield{note}}%
\ifx\comparetmp\comparetmpb%
\usebibmacro{newsdate}%
\else%
\usebibmacro{date}%
\fi}%
}%
}%
%\newunit
}
%调整期刊卷和期的格式,源来自standard.bbx
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
%\setunit*{\adddot}%去掉点号
%\printfield{number}%
\iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
\iffieldundef{eid}{}{%
\setunit{\addcomma\space}%
\printfield{eid}}}
%调整页码前的标点和去掉期刊文章等页码后面的标点,源来自standard.bbx
\renewbibmacro*{note+pages}{%
%\printfield{note}%不要note,note用来判断是否是报纸newspaper
\iffieldundef{pages}{}{
\setunit{\bibpagespunct}%
\printfield{pages}}%
%\newunit
}
%编者类型做一修改,源来自biblatex.DEF
\renewbibmacro*{editorstrg}{%
\printtext[editortype]{%
\iffieldundef{editortype}
{
% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
% test {\ifnumgreater{\value{editor}}{1}}
% or
% test {\ifandothers{editor}}
% }
% {\bibstring{editors}}
% {\bibstring{editor}}
}
{\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
{\ifboolexpr{
test {\ifnumgreater{\value{editor}}{1}}
or
test {\ifandothers{editor}}
}
{\bibstring{\thefield{editortype}s}}
{\bibstring{\thefield{editortype}}}}
{\thefield{editortype}}}
}}
%修改期刊的标题,源来自biblatex.DEF
\renewbibmacro*{periodical}{%
\iffieldundef{title}
{}
{\printtext[title]{%
\printfield[titlecase]{title}%
%\setunit{\subtitlepunct}%
\ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
{}{\setunit{\subtitlepunct}
\printfield[titlecase]{subtitle}}%
%}%把编组结束移到后面去
\iffieldundef{usera}{}{%在标题后直接给出文献标识字母
\printfield[gbtypeflag]{usera}}
}}
}
%期刊的标题做修改,源来自standard.BBX
\renewbibmacro*{title+issuetitle}{%
\usebibmacro{periodical}%
%\setunit*{\addspace}%
\setunit*{\adddot\addspace}%标点修改为句点
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{periodical+issue}%将issue调整到上面来,并修改
\iffieldundef{number}{}{%%进一步处理有范围的数字
\multinumberparser{\thefield{number}}}%
\iffieldundef{volume}%
{\printfield{year}%
\printtext{\mkbibparens{\multinumberfirst}}%
\bibrangedash%
\iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
}%
{\gbt@parse@range{\thefield{volume}}%
\printfield{year}%
\setunit{\addcomma\space}%将冒号修改为逗号
\printtext{\gbt@range@first}%
\printtext{\mkbibparens{\multinumberfirst}}%
\bibrangedash%
\iffieldundef{endyear}{}{%
\printfield{endyear}%
\setunit{\addcomma\space}%将冒号修改为逗号
\printtext{\gbt@range@second}%
\printtext{\mkbibparens{\multinumbersecond}}}%
}%
\setunit{\addcomma\space}%
\printfield{eid}%
\setunit{\addspace}%
%\usebibmacro{issue+date}%
%\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
%新增一个样式用于调整期刊年份的格式,只打印年份
\newbibmacro*{periodical+issue}{%
\printtext{%去掉了[parens]
\iffieldundef{issue}
{%\usebibmacro{date}%修改为下一句
}%
{\printfield{issue}%
\setunit*{\addspace}%
%\usebibmacro{date}%修改为下一句
}%
}%
%\newunit
}
%新增一个样式用于输出连续出版物的地址,单位,时间
%类似与上面的\newbibmacro*{publisher+location+date}
\newbibmacro*{location+institution+date}{%
\testCJKfirst{\thefield{title}}
\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}%
{\printlist{location}}%
% \iflistundef{institution}
% {\setunit*{\addcomma\space}}
% {\setunit*{\addcolon\space}}%
% \printlist{institution}%
% \setunit*{\addcomma\space}%
\addcolon\addspace%
\iflistundef{institution}{%
%注意这里\printtext{\mkbibbrackets{s.n.}}和\printtext{[s.n.\adddot]}是不同的,这里的]不影响标点追踪,
%这里要理解的是newunit插入的是period,看def中的命令:\newcommand*{\newunitpunct}{\addperiod\space},\newcommand*{\finentrypunct}{\addperiod}
\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}}}% \bibstring{nopublisher}
{\printlist{institution}}%
\setunit{\addcomma\addspace}%
%\usebibmacro{date}%
% \printfield{year}%
% \bibrangedash%
% \iffieldundef{endyear}{}{\printfield{endyear}}%
\newunit%
}
%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件
\newbibmacro*{patenttitle}{%
\ifboolexpr{%
test{\iffieldundef{title}}%
and%
test{\iffieldundef{subtitle}}%
}%
{}%
{\printtext[title]{%
\printfield[titlecase]{title}%
\ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
{}{\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
{\setunit{\subtitlepunct}\printfield{titleaddon}}%
\setunit{\subtitlepunct}\printfield{number}%写专利号
\printfield[gbtypeflag]{usera}%
\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
%\newunit
}%
}%
}
%修改了一个institution+location+date用于report等的,当没有institution时不处理。
\renewbibmacro*{institution+location+date}{%
\printlist{location}%
\iflistundef{institution}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{institution}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
%\usebibmacro{modifydate}%
%\newunit
}
%=====================================================================
%设置驱动格式
%修改book的驱动,源来自standard.BBX
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
%\printfield{note}%
%\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
%\newunit
\usebibmacro{doi+eprint+url}%从下面提上来
\newunit\newblock
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
%修改inbook的驱动,源来自standard.BBX
\DeclareBibliographyDriver{inbook}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock%
\usebibmacro{title}%
% \newunit
% \printlist{language}%
% \newunit\newblock
% \usebibmacro{byauthor}%
% \newunit\newblock
% \usebibmacro{in:}%
\printtext{\texttt{//}}%
\usebibmacro{bybookauthor}%
\ifnameundef{bookauthor}{}{\newunit\newblock}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock%
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
%\printfield{note}%
%\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
%\newunit\newblock
\usebibmacro{doi+eprint+url}%移到上面来
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
%collection直接用book的驱动
\DeclareBibliographyDriver{collection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
%\printfield{note}%
%\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
%\newunit
\usebibmacro{doi+eprint+url}%从下面提上来
\newunit\newblock
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
%incollection直接用inbook的驱动
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
% \newunit
% \printlist{language}%
% \newunit\newblock
% \usebibmacro{byauthor}%
% \newunit\newblock
% \usebibmacro{in:}%
\printtext{\texttt{//}}%
\usebibmacro{bybookauthor}%
\ifnameundef{bookauthor}{}{\newunit\newblock}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
%\printfield{note}%
%\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
%\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
%期刊文章,连续出版物中的析出文献的格式
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
%\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
\usebibmacro{journal+issuetitle}%
% \newunit
% \usebibmacro{byeditor+others}%
% \newunit
\usebibmacro{note+pages}%
\usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\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{finentry}}
%修改连续出版物的驱动,源来自standard.BBX
\DeclareBibliographyDriver{periodical}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{editor}%
%\setunit{\labelnamepunct}\newblock
\newunit\newblock %删除上面一行,添加这一行
\usebibmacro{title+issuetitle}%
\newunit
\usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
\newunit\newblock%添加这一行
\printlist{language}%
\newunit\newblock
\usebibmacro{byeditor}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\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{finentry}}
%处理专利文献,源来自standard.BBX
\DeclareBibliographyDriver{patent}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
%\usebibmacro{title}%
\usebibmacro{patenttitle}%给出专利专用的标题输出
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
%\printfield{number}%
\iflistundef{location}
{}
{\setunit*{\addspace}%
\printtext[parens]{%
\printlist[][-\value{listtotal}]{location}}}%
\newunit\newblock
\usebibmacro{byholder}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{newsdate}%
%\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{finentry}}
%处理在线文献,源来自standard.BBX
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit\newblock
%\usebibmacro{date}%
\usebibmacro{modifydate}%修改为带括号的时间
\usebibmacro{url+urldate}%从下面移上来
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
%\usebibmacro{url+urldate}%
%\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
%学位论文修改,源来自standard.BBX
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printfield{type}%
\newunit
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
%2016-11-11增加了译者信息
\DeclareBibliographyDriver{report}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%增加的译者信息
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\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{finentry}}
%直接利用report做manual,2016-11-11增加了译者信息
%\DeclareBibliographyDriver{report}{%
\DeclareBibliographyDriver{manual}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\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{finentry}}
%直接利用report做unpublished
%\DeclareBibliographyDriver{report}{%
\DeclareBibliographyDriver{unpublished}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\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{finentry}}
%会议论文格式修改,源来自standard.BBX
\DeclareBibliographyDriver{inproceedings}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
% \newunit
% \printlist{language}%
% \newunit\newblock
% \usebibmacro{byauthor}%
% \newunit\newblock
%\usebibmacro{in:}%
\printtext{\texttt{//}}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后
\usebibmacro{bybookauthor}%用类似inbook的方式处理
\ifnameundef{bookauthor}{}{\newunit\newblock}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
%会议论文集格式修改,源来自standard.BBX
\DeclareBibliographyDriver{proceedings}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
%\usebibmacro{editor+others}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
% \usebibmacro{byeditor+others}%
% \newunit\newblock
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
\usebibmacro{publisher+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{finentry}}
|