summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
blob: b9ba24c564f57914d211e232c815ed75c82c6cae (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
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
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
%%
%% ---------------------------------------------------------------
%% biblatex-gb7714-2015 --- A biblatex implementation of the
%% GBT7714-2015  bibliography style,author year sequence
%% Maintained by huzhenzhen
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
%
%   版本和时间信息
%
\ProvidesFile{gb7714-2015ay.bbx}[2018/06/01 v1.0l biblatex bibliography style]
\def\versionofgbtstyle{2018/06/01 v1.0l}
\def\versionofbiblatex{\abx@version}
\RequireBiber[3]%显式指定用biber后端

%=====================================================================
%加载标准样式
%=====================================================================
\RequireBibliographyStyle{authoryear}
\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题


%=====================================================================
%   功能函数
%=====================================================================
    %
    %   biblatex版本判断
    %   20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen
    %
    %   原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest
    \providetoggle{iftlfive}%用于处理biblatex3.2之前的版本
    \providetoggle{iftlsix}%用于处理biblatex3.3开始改变的新的姓名机制后版本
    \providetoggle{iftlseven}%用于处理biblatex3.7的兼容性
    \providetoggle{iftleight}%用于处理biblatex3.8到3.9的兼容性
    \providetoggle{iftlnine}%用于处理biblatex10的兼容性
    \providetoggle{iftlatest}%用于最新版biblatex,目前是biblatex3.11,20180402
    \StrBefore{\abx@version}{.}[\numinteger]%以点区分整数和小数
    \StrBehind{\abx@version}{.}[\numdigital]%小数部分可能带字母所以需将其去掉,见下一行代码
    \IfInteger{\numdigital}{}{\StrGobbleRight{\numdigital}{1}[\numdigital]}
    \togglefalse{iftlfive}
    \togglefalse{iftlsix}
    \togglefalse{iftlseven}
    \togglefalse{iftleight}
    \togglefalse{iftlnine}
    \toggletrue{iftlatest}
    \ifnumcomp{\numinteger}{=}{3}{
        \ifnumcomp{\numdigital}{=}{10}{\toggletrue{iftlnine}\togglefalse{iftlatest}}{}%3.10版本
        \ifnumcomp{\numdigital}{<}{10}{\ifnumcomp{\numdigital}{>}{7}{\toggletrue{iftleight}\togglefalse{iftlatest}}{}}{}%>3.8版本用iftleight=true表示
        \ifnumcomp{\numdigital}{=}{7}{\toggletrue{iftlseven}\togglefalse{iftlatest}}{}%3.7版本用iftlseven=true表示
        \ifnumcomp{\numdigital}{<}{7}{\ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftlsix}\togglefalse{iftlatest}}{}}{}%3.3-3.6版本用iftlsix=true表示
        \ifnumcomp{\numdigital}{<}{3}{\toggletrue{iftlfive}\togglefalse{iftlatest}}{}%3.0-3.2版本用iftlfive=true表示
    }{\ifnumcomp{\numinteger}{>}{3}{
       \blx@warning@noline{%
       biblatex version is >= 4.x.\MessageBreak
       if errors raised,Please contact biblatex-gb7714-2015 pkg author.}%
    }{ \toggletrue{iftlfive}\togglefalse{iftlatest}%2.x版本统一用iftlfive=true表示
       \blx@warning@noline{%
       biblatex version is <= 2.x.\MessageBreak
       if errors raised,Please contact biblatex-gb7714-2015 pkg author.}%
    }}
    \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令
    \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令

    %
    %   判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
    %   v1.0k,20180509,hzz
    %
    %   原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
    %   中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
    %   编码用xelatex编译的问题。
    %
    %   原理是:利用perl正则将中文标识记录到域中,
    %           然后利用\iffieldundef和\iffieldequalstr进行判断
    \providetoggle{ifCJKforgbt}
    \def\testCJKfirst#1{%
        \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
        \iffieldequalstr{#1}{cn}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}

    %
    %   2个卷的解析函数,用于连续出版物
    %
    %   原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
    \newcommand{\multivolparser}[1]{%
        \IfSubStr{#1}{-}%
            {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
            {\def\multivolfirst{#1}\def\multivolsecond{}}%
    }

    %
    %   2个期的解析函数,用于连续出版物
    %
    \newcommand{\multinumberparser}[1]{%
        \IfSubStr{#1}{-}%
            {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
            {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
    }

    %    对没有分隔符环境命令的低版本biblatex做增补,避免报错
    %
    \iftoggle{iftlfive}{

    \def\blx@inf@delimdeclare#1#2{%
    \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}}

    \def\blx@warn@delimuse#1#2{%
    \blx@warning{Delimiter '#1' in context '#2' undefined}}
    % Delimiter interface

    % [<contextname, ...>]{<name, ...>}{<code>}
    \newrobustcmd*{\DeclareDelimFormat}{%
      \@ifstar
        {\blx@declaredelimclear}
        {\blx@declaredelim}}

    \newrobustcmd*{\blx@declaredelimclear}[3][]{%
      \ifcsvoid{blx@declaredelimcontexts@#2}
        {}
        {\def\do##1{\csundef{blx@printdelim@##1@#2}}%
         \dolistcsloop{blx@declaredelimcontexts@#2}}%
      \cslet{blx@declaredelimcontexts@#2}\@empty
      \ifblank{#1}
        {\blx@declaredelim{#2}{#3}}
        {\blx@declaredelim[#1]{#2}{#3}}}

    \newrobustcmd*{\blx@declaredelim}[3][]{%
      \ifblank{#1}
        {\blx@declaredelim@i{}{}{#2}{#3}}
        {\def\do##1{%
           \listcsadd{blx@declaredelimcontexts@#2}{##1}%
           \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}%
         \docsvlist{#1}}}%

    \def\blx@declaredelim@i#1#2#3#4{%
      \def\do@i##1{%
        \ifcsdef{#1##1}
          {\blx@inf@delimdeclare{##1}{#2}}
          {}%
        \csdef{#1##1}{#4}}%
      \forcsvlist{\do@i}{#3}}

    % *[<contextname, ...>]{<alias>}{<delim>}
    \newrobustcmd*{\DeclareDelimAlias}{%
      \@ifstar
        {\blx@declaredelimalias}
        {\blx@declaredelimaliasauto}}

    \newrobustcmd*{\blx@declaredelimalias}[3][]{%
      \ifblank{#1}
        {\blx@declaredelimalias@i{}{#2}{#3}}
        {\def\do##1{%
           \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}%
         \docsvlist{#1}}}

    \newrobustcmd*{\blx@declaredelimaliasauto}[2]{%
      \blx@declaredelimalias@i{}{#1}{#2}%
      \ifcsvoid{blx@declaredelimcontexts@#2}
        {}
        {\def\do##1{%
           \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}%
         \dolistcsloop{blx@declaredelimcontexts@#2}}}

    \def\blx@declaredelimalias@i#1#2#3{%
      \ifcsdef{#1#2}
        {\blx@inf@delimdeclare{#2}{#1}}
        {}%
      \csdef{#1#2}{\csuse{#1#3}}}

    \def\blx@delimcontext{none}
    \newcommand*{\printdelim}[2][]{%
      \ifblank{#1}
        {\ifcsdef{blx@printdelim@\blx@delimcontext @#2}
          {\csuse{blx@printdelim@\blx@delimcontext @#2}}
          {\ifcsdef{#2}% fall back on legacy macros
            {\csuse{#2}}
            {\blx@warn@delimuse{#2}{*}}}}
        {\ifcsdef{blx@printdelim@#1@#2}
          {\csuse{blx@printdelim@#1@#2}}
          {\blx@warn@delimuse{#2}{#1}}}}

    \newcommand*{\delimcontext}[1]{%
      \edef\blx@delimcontext{\blx@delimcontextalias{#1}}}

    \def\blx@delimcontextalias#1{%
      \ifcsdef{blx@delimcontextalias@#1}
        {\csuse{blx@delimcontextalias@#1}}
        {#1}}

    \newcommand*{\DeclareDelimcontextAlias}[2]{%
      \csgdef{blx@delimcontextalias@#1}{#2}}
    }{}


%=====================================================================
%   数据模型定义
%=====================================================================
    %定义类型和载体标识,从gb内容看载体基本属于介质。
    %为与lee zeping的bst的样式统一,使用mark和medium这两域名
    %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
    \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
    \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}



%=====================================================================
%   设置宏包选项
%=====================================================================
    %
    %   增加一个控制是否输出文献类型和载体标识的选项
    %
    %   原理方法:
    %   对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
    %   所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
    \newtoggle{bbx:gbtype}
    %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
    \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
      \settoggle{bbx:gbtype}{#1}}
    \ExecuteBibliographyOptions{gbtype}

    %
    %   增加一个源文件编码选择选项,当true时可以使用GBK编码。
    %   v1.0k, 2018.05.08, by hzz
    %
    % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
    % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
    % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
    % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
    % 另外注意:
    % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
    % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
    % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
    \newtoggle{bbx:codegbk}
    \DeclareBibliographyOption{gbcodegbk}[false]{%
        \settoggle{bbx:codegbk}{#1}}
    \ExecuteBibliographyOptions{gbcodegbk}

    \def\str@bibliography{参考文献}
    \def\str@references{参考文献}
    \def\str@bytranslator{译}
    \def\str@andotherscn{等}
    \def\str@backrefpage{引用页}
    \def\str@backrefpages{引用页}
    \def\str@noaddress{出版地不详}
    \def\str@nopublisher{出版者不详}
    \def\str@edition{版}

    \AtEndOfPackage{%
	\iftoggle{bbx:codegbk}{%
		\ExecuteBibliographyOptions{texencoding = GBK}
        \input{gb7714-2015-gbk.def}
	}{}}

    %
    %   增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
    %   v1.0k, 2018.05.08, by hzz
    %
    %   原理方法:
    %   默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
    %   这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
    %   可能需要用于中英文判断的language域的信息。
    \newtoggle{bbx:gbstrict}
    \DeclareBibliographyOption{gbstrict}[true]{%
      \settoggle{bbx:gbstrict}{#1}}
    \ExecuteBibliographyOptions{gbstrict}

    %
    %   增加一个控制标题域超链接设置的选项
    %   v1.0k, 2018.05.24, by hzz
    %
    %   原理方法:
    %   利用标题域格式来实现,默认设置该选项为false,不做超链接。
    %   设置为true,则标题设置超链接
    \newtoggle{bbx:titlelink}
    \DeclareBibliographyOption{gbtitlelink}[false]{%
      \settoggle{bbx:titlelink}{#1}}
    \ExecuteBibliographyOptions{gbtitlelink}

    %
    %   增加一个控制参考文献标题是否能够被ctex宏包设置的选项
    %   v1.0l, 2018.07.02, by hzz
    %
    %   原理方法:
    %   重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
    \newtoggle{bbx:ctexset}
    \DeclareBibliographyOption{gbctexset}[true]{%
      \settoggle{bbx:ctexset}{#1}}
    \ExecuteBibliographyOptions{gbctexset}

    \AtEndOfPackage{%
	\iftoggle{bbx:ctexset}{%
        \def\blx@defbibstrings#1#2{%
          \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}%
          \abx@dostrings
          \csuse{abx@strings@#1}%
          \setkeys{blx@lbx}{#2}%
          \let\do\blx@defbibstrings@i
          \csxdef{abx@strings@#1}{\abx@dostrings}%
        }
	}{}}


    %
    %   增加一个恢复域格式为标准样式的控制选项
    %   v1.0k, 2018.05.15, by hzz
    %
    %   原理方法:
    %   默认设置该选项为false,采用国标要求的域格式输出相关域
    %   当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
    \newtoggle{bbx:gbfieldstd}
    \DeclareBibliographyOption{gbfieldstd}[false]{%
      \settoggle{bbx:gbfieldstd}{#1}%
      \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
      }
    \ExecuteBibliographyOptions{gbfieldstd}

    %
    %   增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
    %
    \newtoggle{bbx:gbpub}
    \DeclareBibliographyOption{gbpub}[true]{%
    %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
      \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
    \ExecuteBibliographyOptions{gbpub}

    %
    %   增加控制析出文献来源前的标点符号//输出的选项
    %   v1.0k, 2018.04.20,added in  by hzz
    \newtoggle{bbx:gbpunctin}
    \DeclareBibliographyOption{gbpunctin}[true]{%
        \settoggle{bbx:gbpunctin}{#1}}
    \ExecuteBibliographyOptions{gbpunctin}

    %
    %   选项设置
    %
    \ExecuteBibliographyOptions{
      useprefix = true,  %名字的信息包括前缀
      date   = year,  %日期仅写到年
      maxbibnames=3, %将文献列表和引用中最大名字数量区分开
      minbibnames=3,
      isbn=false,
      sorting=gb7714-2015,
      sortlocale=zh__pinyin,
    }

    %
    %为日期相关选项增加选项值gb7714-2015
    %
    \csdef{mkdaterangegb7714-2015}#1{%
      \begingroup
        \blx@metadateinfo{#1}%
        \iffieldundef{#1year}
          {}
          {\printtext[#1date]{%
             \blx@gbdate{#1}{}}}%
      \endgroup}

    \newrobustcmd*{\blx@gbdate}[3][]{%
      \dateeraprintpre{#2#3year}%
      \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
        \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}%
         \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}}

    %为姓名格式选择增加的计数器
    \newcounter{namefmtcase}
    \def\thenamefmtcase{\the\c@namefmtcase}


\@ifpackagelater{biblatex}{2016/03/27}
  {
    %
    %   增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
    %   v1.0l,20180623,hzz
    %
    \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{}

    %
    %   增加姓名大小写格式处理选项
    %
    \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
        \ifstrequal{#1}{uppercase}{\setcounter{namefmtcase}{0}}{}%
        \ifstrequal{#1}{lowercase}{\setcounter{namefmtcase}{1}}{}%
        \ifstrequal{#1}{givenahead}{\setcounter{namefmtcase}{2}}{}%given-family
        \ifstrequal{#1}{familyahead}{\setcounter{namefmtcase}{3}}{}
        \ifstrequal{#1}{pinyin}{\setcounter{namefmtcase}{4}}{}%family-given
    }
    \ExecuteBibliographyOptions{gbnamefmt}

    %
    %   增加标签对齐选项
    %

    %因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。
    \DeclareBibliographyOption[string]{gbalign}[right]{}%

    %增加一个处理佚名或noauthor的控制选项
    \DeclareBibliographyOption{gbnoauthor}[true]{%
      \ifstrequal{#1}{false}{}{\dealnoathor}}
    %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
  }
  {
    %
    %   增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
    %   v1.0l,20180623,hzz
    %
    \DeclareBibliographyOption{gbbiblabel}[bracket]{}

    %
    %   增加姓名大小写格式处理选项
    %
    \DeclareBibliographyOption{gbnamefmt}[uppercase]{%
        \ifstrequal{#1}{uppercase}{\setcounter{namefmtcase}{0}}{}%
        \ifstrequal{#1}{lowercase}{\setcounter{namefmtcase}{1}}{}%
        \ifstrequal{#1}{givenahead}{\setcounter{namefmtcase}{2}}{}%given-family
        \ifstrequal{#1}{familyahead}{\setcounter{namefmtcase}{3}}{}
        \ifstrequal{#1}{pinyin}{\setcounter{namefmtcase}{4}}{}%family-given
    }
    \ExecuteBibliographyOptions{gbnamefmt}

    %
    %   增加标签对齐选项
    %
    %因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
    \DeclareBibliographyOption{gbalign}[right]{}%

    %增加一个处理佚名或noauthor的控制选项
    \DeclareBibliographyOption{gbnoauthor}[true]{%
      \ifstrequal{#1}{false}{}{\dealnoathor}}
    %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
  }


%
%   针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
%
\defversion{3.0}{opt}{
    \ExecuteBibliographyOptions{
      firstinits = true,    %名字有缩写,参考3.1.2.3 Internal
    }
}
%
%   针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版
%
\defversion{3.4}{opt}{
    \ExecuteBibliographyOptions{
      giveninits = true,
    }
}
%
%   针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
%
\defversion{3.7}{opt}{
    \ExecuteBibliographyOptions{
      giveninits = true,
      urldate =edtf,
      eventdate =edtf,
    }
}
%
%   针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
%
\defversion{3.10}{opt}{
    \ExecuteBibliographyOptions{
      giveninits = true,
      urldate =gb7714-2015,%iso
      eventdate =gb7714-2015,%iso
    }
}

%
%   根据biblatex版本信息,选择选项设置
%
%   原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本
%   必须要把情况列全。
\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2
\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6
\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7
\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9
\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10
\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11


%=====================================================================
%设置本地化字符串
%=====================================================================
    %
    %   新建当地化字符串,用来记录“等”字符
    %
    \NewBibliographyString{andotherscn}

    %
    %   修改一些当地化字符串
    %
    %   原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
    %   当然也可以增加比如上面定义的andotherscn
    %   注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
    \DefineBibliographyStrings{english}{
        bibliography     = {\str@bibliography},
        references       = {\str@references},
        bytranslator= {\addcomma\ \str@bytranslator\adddot}, %将trans. by 改成 译
        and         = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
        %andothers   = {et al.},        %将超过3个人名的省略,et al.改成为 等
        andotherscn   = {\str@andotherscn},     %将超过3个人名的省略,et al.改成为 等
        backrefpage = {\str@backrefpage:},
        backrefpages = {\str@backrefpages:},
        in={in\intitlepunct},
}


%=====================================================================
%动态数据修改,修改输入的源文件数据,用于中文判断等操作
%=====================================================================
%
%   修改输入的参考文献数据,源文件层的操作
%
%   原理方法:增加文献标识符如[M],[J]等
%   把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
%   注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
%   如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
%   注意\DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
\DeclareSourcemap{
\maps[datatype=bibtex]{
        \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
                \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
                }
        \map{%
            \step[fieldsource=mark,final]
            \step[fieldset=usera, origfieldval]
            }
        \map{%
            \step[fieldsource=nameformat,match=lowercase,final]
            \step[fieldset=namefmtid,fieldvalue={1}]
            }
        \map{%
            \step[fieldsource=nameformat,match=givenahead,final]
            \step[fieldset=namefmtid,fieldvalue={2}]
            }
        \map{%
            \step[fieldsource=nameformat,match=familyahead,final]
            \step[fieldset=namefmtid,fieldvalue={3}]
            }
        \map{%
            \step[fieldsource=nameformat,match=pinyin,final]
            \step[fieldset=namefmtid,fieldvalue={4}]
            }
        \map{%
            %\perdatasource{examples.bib}
            \pertype{article}
            \step[fieldset=usera, fieldvalue={J}]
            }
        \map{
            \pertype{periodical}
            \step[fieldset=usera, fieldvalue={J}]
            \step[fieldsource=author] %有时会把author和editor混淆,处理后避免该问题
            \step[fieldset=editor, origfieldval]
            \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后避免该问题
            \step[fieldset=institution, origfieldval]
            }
        \map{
            \pertype{newspaper}%增加一个新闻报纸的类型newspaper
            \step[fieldset=usera, fieldvalue={N}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为article后判断
            \step[fieldset=note, fieldvalue=news]
            }
        \map{
            \pertype{database}%对应增加的一个数据库类型database
            \step[fieldset=usera, fieldvalue={DB}]%没有专门的驱动,定义一个usera域,方便映射后使用
            }
        \map{
            \pertype{dataset}%对应增加的一个数据集类型dataset
            \step[fieldset=usera, fieldvalue={DS}]%没有专门的驱动,定义一个usera域,方便映射后使用
            }
        \map{
            \pertype{software}%对应增加的一个软件类型software
            \step[fieldset=usera, fieldvalue={CP}]%没有专门的驱动,定义一个usera域,方便映射后使用
            }
        \map{
            \pertype{map}%对应增加的一个舆图类型map
            \step[fieldset=usera, fieldvalue={CM}]%没有专门的驱动,定义一个usera域,方便映射后使用
            }
        \map{
            \pertype{archive}%对应增加的一个档案类型archive
            \step[fieldset=usera, fieldvalue={A}]%没有专门的驱动,定义一个usera域,方便映射后使用
            }
        \map{
            \pertype{misc}%对应增加的一个备选类型misc
            \step[fieldset=usera, fieldvalue={Z}]%没有专门的驱动,定义一个usera域,方便映射后使用
            }
        \map{
            \pertype{book}
            \pertype{inbook}
            \step[fieldset=usera, fieldvalue={M}]
            \step[fieldsource=version] %有时会把version和edition混淆,处理后避免该问题,可以直接用version
            \step[fieldset=edition, origfieldval]
            }
        \map{
            \pertype{standard}%兼容老的standard类型
            \step[fieldset=usera, fieldvalue={S}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为book和inbook后判断
            \step[fieldset=note, fieldvalue=standard]
            }
        \map{
            \pertype{patent}
            \step[fieldset=usera, fieldvalue={P}]
            }
        \map{
            \pertype{inproceedings}
            \pertype{conference}%兼容老的conference类型
            \step[fieldset=usera, fieldvalue={C}]
            \step[fieldsource=institution] %有时会把publisher和institution混淆,处理后避免该问题
            \step[fieldset=publisher, origfieldval]
            \step[fieldsource=editor] %
            \step[fieldset=bookauthor, origfieldval]
            }
        \map{
            \pertype{proceedings}
            \step[fieldset=usera, fieldvalue={C}]
            \step[fieldsource=institution] %有时会把publisher和institution混淆,这里处理后就没有这个问题
            \step[fieldset=publisher, origfieldval]
            \step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下
            \step[fieldset=author, origfieldval]
            }
        \map{
            \pertype{report}
            \pertype{techreport}%兼容老的techreport类型
            \step[fieldset=usera, fieldvalue={R}]
            \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后避免该问题
            \step[fieldset=institution, origfieldval]
            }
        \map{
            \pertype{thesis}
            \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
            \pertype{phdthesis}
            \step[fieldset=usera, fieldvalue={D}]
            }
        \map{
            \pertype{online}
            \pertype{electronic}%兼容老的electronic类型
            \pertype{www}%兼容老的www类型
            \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, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
            \step[fieldset=userf, fieldvalue={cn}]
            }
	    \map{
            \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
            \step[fieldset=usere, fieldvalue={cn}]
            }
        \map{%处理一些用year表示date的情况
             %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
             %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
            \step[fieldsource=year]
            \step[fieldset=date, origfieldval]
            }
        \map{%将title信息保存到userd中避免因为标签生成原因导致title域被清除
            \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%}
            \step[fieldset=userd, fieldvalue={cn}]
            }
        \map{%将entrykey放入keywords中用于后期的使用
            \step[fieldsource=entrykey]
            \step[fieldset=keywords, origfieldval]
            }
        \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
            \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
            \step[fieldset=keywords, fieldvalue={,}, append]
            \step[fieldset=keywords, origfieldval, append]
            }
        \map{%因为要对author进行判断,所以这里先对有些只有编者而没有作者的情况进行处理
            \step[fieldsource=editor]
            \step[fieldset=author,origfieldval]
            }
        \map{%
            \step[fieldsource=language,match=english,final]
            \step[fieldset=langid,fieldvalue={english}]
            }
        \map{
            \step[fieldsource=language,match=russian,final]
            \step[fieldset=langid,fieldvalue={russian}]
            }
        \map{%
            \step[fieldsource=language,match=french,final]
            \step[fieldset=langid,fieldvalue={french}]
            }
        \map{%
            \step[fieldsource=language,match=chinese,final]
            \step[fieldset=langid,fieldvalue={english}]
            }
        \map{%
            \step[fieldsource=language,match=japnese,final]
            \step[fieldset=langid,fieldvalue={english}]
            }
        \map{%
            \step[fieldsource=language,match=korean,final]
            \step[fieldset=langid,fieldvalue={english}]
            }
        \map{%把语言信息设置language域内,而不再用userb域(20180525)
             %接着根据信息域字符的unicode码判断
            \step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
            \step[fieldset=language,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
            \step[fieldset=langid,fieldvalue={french}]
            }
        \map{%
            \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
            \step[fieldset=language,fieldvalue={russian}]%俄语
            \step[fieldset=langid,fieldvalue={russian}]
            }
        \map{%
            \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
            \step[fieldset=language,fieldvalue={japanese}]%日语
            \step[fieldset=langid,fieldvalue={english}]%中日韩语目前都用english,
            }               %确定形式后可增加类似andotherscn这样的本地化字符串处理
        \map{%
            \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
            \step[fieldset=language,fieldvalue={korean}]%韩语
            \step[fieldset=langid,fieldvalue={english}]
            }
        \map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下
             %认为是中文的,将文献language设置成chinese,用于排序
             %参考4.5.8 姓名首字母生成控制
            %\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\\\/\-\x22\x26\:0-9\p{IsP}\p{PosixPunct}\x{2bf}\x{2018}\xE9\p{IsASCII}]},final]
            %对于带重音符号的字符似乎无法匹配。比如\'e
            %最后选择直接匹配cjk字符,unicode编码位置从2FF0到9FA5
            \step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
            \step[fieldset=language,fieldvalue={chinese}]
            }
        \map{\step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
            \step[fieldset=language,fieldvalue={chinese}]
            }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
        \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
            \step[fieldset=language,fieldvalue={english}]
            \step[fieldset=langid,fieldvalue={english}]
            }
        %本来后面这些是放到DeclareStyleSourcemap中处理的,但是因为texlive2016的biblatex3.4不支持多个DeclareStyleSourcemap,
        %但又有处理特殊字符和处理gbnoauthor选项两个需求,但gbnoauthor需要用DeclareStyleSourcemap所以把这些提到这来,
	    %以后将这两个功能结合到一个DeclareStyleSourcemap时,不用复制如下段代码了。
        \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义
                 %但从实践看,并没有什么影响,映射过来就可以了。
            \step[typesource=newspaper, typetarget=article, final]
            }
        \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
            \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
            \step[typesource=standard, typetarget=inbook, final]
            }
        \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
            \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book
            }
        \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
            \step[typesource=mastersthesis, typetarget=thesis, final]
            %\step[fieldset=type, fieldvalue=mathesis]
            }
        \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
            \step[typesource=phdthesis, typetarget=thesis, final]
            %\step[fieldset=type, fieldvalue=phdthesis]
            }
        \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
            \step[typesource=techreport, typetarget=report, final]
            %\step[fieldset=type, fieldvalue=techreport]
            }
        \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
                \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
            }
        \map[overwrite]{
            \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
            }
        \map[overwrite]{
            \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
            }
        %对于高版本(3.4以上)可以用下面这一段取代前面那一段,为了兼容gbnoauthor选项,这些代码只能在sourcemap中使用,所以只能选择前面那一段
        %\map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
%                \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
%            }
%        \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
%                \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
%            }
%        \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
%            address,location,institution,organization}]{
%                \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
%            }
    }
}

%
%   佚名/noauthor的处理
%
%   原理方法:利用样式层的动态数据修改实现
\def\dealnoathor{
        \DeclareStyleSourcemap{
            \maps[datatype=bibtex]{
                \map{%默认情况下将空缺作者设置为佚名
                    \step[fieldsource=userb,match={cn},final]
                    \step[fieldset=author, fieldvalue={佚名}]
                }
                \map{%默认情况下将空缺作者设置为佚名
                    \step[fieldsource=userb,match={en},final]
                    \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{}
                }
            }
        }
}


%=====================================================================
%   设置排序格式
%=====================================================================
%
%   排序格式,用降序,及userb域,针对biblatex3.7及以下版本
%
\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释
    \DeclareSortingScheme{gb7714-2015}{
      \sort{
        \field{presort}
      }
      \sort[final]{
        \field{sortkey}
      }
      \sort{
    	\field{language}
    	}
      \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}%3.7版是\field{volume}
        \literal{0000}%3.7版是\literal{0}
      }
    }
}
\DeclareBibliographyAlias{unpublished}{misc}
\DeclareBibliographyAlias{database}{misc}
\DeclareBibliographyAlias{dataset}{misc}
\DeclareBibliographyAlias{software}{misc}
\DeclareBibliographyAlias{map}{misc}
\DeclareBibliographyAlias{archive}{manual}

%
%   排序格式,用降序,及userb域,针对biblatex3.8及以上版本
%
\defversion{3.8}{sort}{
    \DeclareSortingTemplate{gb7714-2015}{
      \sort{
        \field{presort}
      }
      \sort[final]{
        \field{sortkey}
      }
      \sort{
    	\field{language}
    	}
      \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{volume}
        \literal{0}
      }
    }

    %
    %   定义命令\defdoublelangentry,用于biblatex>v3.8版利用related实现双语文献的处理
    %
    %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
    %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
    %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
    \newcommand{\defdoublelangentry}[2]{%
    \edef\entrykeya{##1}
    \edef\entrykeyb{##2}
        \DeclareStyleSourcemap{
          \maps[datatype=bibtex]{
            \map{
              \step[fieldsource=entrykey, match=\entrykeya, final]
              \step[fieldset=related, fieldvalue=\entrykeyb]
            }
          }
       }
    }
}


\ifboolexpr{
test {\iftoggle{iftlfive}}
or
test {\iftoggle{iftlsix}}
or
test {\iftoggle{iftlseven}}%biblatex<=3.7
}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex


%=====================================================================
%参考文献列表环境
%=====================================================================

%
%   列表格式
%
%   增加一个\bibitemindent尺寸用于控制list环境的itemindent
%   v1.0l,20180615,hzz
\setlength{\bibhang}{1em}
\newlength{\bibitemindent}
\setlength{\bibitemindent}{-\bibhang}
  \defbibenvironment{bibliography}
  {\list
     {}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{\bibitemindent}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item}


%=====================================================================
%   设置单元或块等的标点
%=====================================================================
\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点%来源biblatex.def
%
%   利用set实现的多语言文献不同语言间的分隔符
%   20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
%
%   原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
%   这里调整一下两种语言参考文献的间隔,源来自biblatex.def
\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}
\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%页码引用格式的修改%修改为用冒号
%\renewcommand{\relateddelim}{}%\par

%=====================================================================
%   修改域的格式,重定义域的输出宏
%=====================================================================
%
%   新增文献类型标识符的格式
%
\DeclareFieldFormat{gbtypeflag}{%
\iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符
{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
}{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}}

%
%   新增用于报纸的文献类型标识符的格式
%
\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
\iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符
{\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
{\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
}{\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}}

%
%   新增用于标准的文献类型标识符的格式
%
\DeclareFieldFormat{gbtypeflags}{%用于标准standard
\iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符
{\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
{\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
}{\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}}

%
%   重设title等参考文献信息的输出格式
%
%   原理方法:修改来自biblatex.def文件的原格式
\newcommand{\bibtitlefont}{}
\newcommand{\bibauthorfont}{}
\newcommand{\bibpubfont}{}
\DeclareFieldFormat{title}{#1\adddot\addthinspace}
\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
\DeclareFieldFormat{issuetitle}{#1}
\DeclareFieldFormat{maintitle}{#1}
\DeclareFieldFormat{booktitle}{#1}
\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
  [article,patent,thesis,unpublished]
  {title}{#1\adddot\addthinspace}
\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
  [inbook,incollection,inproceedings]
  {title}{#1}%\nopunct\unspace
\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行%url相关输出,源来自biblatex.def
\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
%
%   标题的字母大小写格式修改
%
%   注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
%   因为titlecase is applied to the contents of the field directly,title is not
%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
\iffieldundef{url}{\MakeCapital#1}{%
\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
\DeclareFieldFormat{pages}{#1}%页码引用格式的修改%去掉前面引导页码的pp.等字符
\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}

\def\execgbfdfmtstd{%恢复到标准样式的设置
\DeclareFieldFormat{title}{\mkbibemph{##1}}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\mkbibquote{##1\isdot}}
\DeclareFieldFormat
  [suppbook,suppcollection,suppperiodical]
  {title}{##1}
\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
\DeclareFieldFormat{titlecase}{##1}
\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
}

%
%   文献标题后的标点问题
%   v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
%
%   原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
%   texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
%   之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
%   析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
\ifboolexpr{%
    test{\iftoggle{iftlfive}}
    or
    test{\iftoggle{iftlsix}}
  }{}%
  {%texlive 2017对应iftlseven以上版本
  \@ifclassloaded{beamer}{
  \DeclareFieldFormat{title}{#1}%
  \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
  \AtBeginDocument{%
    \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{}
  }


%
%   修改译者位置格式
%
%   原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
\renewbibmacro*{bytranslator+others}{%
  \ifnameundef{translator}
    {}
    {%\usebibmacro{bytranslator+othersstrg}
     %\setunit{\addspace}%
     \printnames[bytranslator]{translator}%
     \clearname{translator}%
     \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
     \setunit{\addspace}%
     \newunit}%
  \usebibmacro{withothers}}

%
%   下面一段没有用,但从中可以看到当地化字符串格式的引用前的代码处理
%   比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
%   \renewbibmacro*{bytranslator+othersstrg}{%


%
%   修改作者数量超过限定值,做省略时的处理格式
%
%   原理方法:判断作者或译者是否中文,若中文用字符等,否则用etcl。
\renewbibmacro*{name:andothers}{%
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }{%这里做一个判断是在处理author还是translator用于两者是不同语言的情况
   \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}%
    %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面
    \ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}%
       {}%\finalandcomma
\printdelim{andothersdelim}\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}
%\andothersdelim\bibstring{andotherscn}
}{}}


%   重设title的输出
%
%   20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
%   原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
%   利用toggle做标识符是否输出的判断
\renewbibmacro*{title}{%
  \ifboolexpr{%
    test{\iffieldundef{title}}%
    and
    test{\iffieldundef{subtitle}}%
  }%
    {}%
    {\printtext[title]{\bibtitlefont%增加字体控制命令
       \printfield[titlecase]{title}%
       \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
       {}{\setunit{\subtitlepunct}%
       \printfield[titlecase]{subtitle}}%
       \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
        {\setunit{\subtitlepunct}\printfield{titleaddon}}%
        \iftoggle{bbx:gbtype}{%
         \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
        {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
                                         {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
                                                                      {\printfield[gbtypeflag]{usera}}}%其它
        }}{}%
     \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
     %\newunit
     }%
}}


%
%   作者信息的输出格式
%
%   20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
%   20180603,v1.0l,增加使用nameformat域来选择姓名格式
\DeclareNameFormat{namefmtselected}{%
\iffieldundef{namefmtid}{}%
{\defcounter{namefmtcase}{\thefield{namefmtid}}}%
\ifcase\value{namefmtcase}%
  \ifgiveninits
    {\usebibmacro{name:gbuppercase}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:gbuppercase}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
\or
  \ifgiveninits
    {\usebibmacro{name:gblowercase}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:gblowercase}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
\or
  \ifgiveninits
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
\or
    \ifgiveninits
       {\usebibmacro{name:family-given}
         {\namepartfamily}
         {\namepartgiveni}
         {\namepartprefix}
         {\namepartsuffix}}
       {\usebibmacro{name:family-given}
         {\namepartfamily}
         {\namepartgiven}
         {\namepartprefix}
         {\namepartsuffix}}%
\or
\usebibmacro{name:gbpinyin}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}%
\fi
  \usebibmacro{name:andothers}}

\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
\DeclareNameAlias{citename}{default}% Default used by \citename

\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%

%GB/T 7714-2015 风格,全部大写
\renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
\renewcommand*{\revsdnamepunct}{}%
  \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
     \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
     \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
     \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
}

%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
\renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
    \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
    \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
  \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{{#1}}}\isdot%
     \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
     \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#3}}}
       {}{\revsdnamepunct}%
     \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
     \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
     \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
}

%中文常见风格,汉语拼音全拼模式
\renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
  \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\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
     \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{\MakeCapital{#2}}\isdot}%\MakeCapital
     \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
     \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
}


\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况
  {}{
    %GB/T 7714-2015 风格,全部大写
    \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
    \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
    \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
      \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}%
         }%
     }

    %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
    \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
    \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
    \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
      \ifuseprefix
        {\usebibmacro{name:delim}{#3#1}%
         \usebibmacro{name:hook}{#3#1}%
         \ifblank{#3}{}{%
           \ifcapital
             {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
             {\mkbibnameprefix{#3}\isdot}%
           \ifpunctmark{'}{}{\bibnamedelimc}}%
         \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
         \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
         \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
        {\usebibmacro{name:delim}{#1}%
         \usebibmacro{name:hook}{#1}%
         \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot  %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
         \ifblank{#2#3}{}{\revsdnamepunct}%
         \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
         \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
         \addcomma\addspace%
         \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
         }%
     }

    %中文常见风格,汉语拼音全拼模式
    \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
    \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
    \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
    \renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
      \ifuseprefix
        {\usebibmacro{name:delim}{#3#1}%
         \usebibmacro{name:hook}{#3#1}%
         \ifblank{#3}{}{%
           \ifcapital
             {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
             {\mkbibnameprefix{#3}\isdot}%
           \ifpunctmark{'}{}{\bibnamedelimc}}%
         \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
         \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}%
         \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
        {\usebibmacro{name:delim}{#1}%
         \usebibmacro{name:hook}{#1}%
         \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot  %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
         \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}%
         }%
     }

  %%biblatex<3.2版的情况,姓名的处理格式带参数
  \DeclareNameFormat{namefmtselected}{%
    \iffieldundef{namefmtid}{}%
    {\defcounter{namefmtcase}{\thefield{namefmtid}}}%
    \ifcase\value{namefmtcase}%
       \iffirstinits
       {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}}
       {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}%
    \or
       \iffirstinits
       {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}}
       {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}%
    \or
        \iffirstinits
       {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
       {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
        \ifblank{#3#5}
       {}
       {\usebibmacro{name:revsdelim}}%
    \or
        \iffirstinits
       {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
       {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
    \or
    \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}}
}

%
%   url和url日期格式
%
\renewbibmacro*{url+urldate}{%
  %\usebibmacro{url}%%更换url的位置,放到下面
  \iffieldundef{urlyear}%
    {}{%\setunit*{\addspace}%
    \usebibmacro{urldate}}%
     \setunit{\addperiod\addspace}%
     \usebibmacro{url}}
\renewbibmacro*{url}{\printfield{url}}

%
%   日期信息的输出格式,针对biblatex<3.7版本
%
\defversion{3.4}{date}{
    \renewbibmacro*{urldate}{%
    \addthinspace\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}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
        \iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
            \iffieldundef{endyear}{%
                \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
                \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
                \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
                }%
            }{%
                \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
                \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
                \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
                }%
            }%
        }%
        {%
            \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
            \iffieldundef{month}{}{\bibrangedash\thefield{month}}%
            \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
            }%
        }%
    }%
}

%
%   日期信息的输出格式,针对3.9>=biblatex>=3.7版本
%
\defversion{3.7}{date}{
    \DeclareFieldFormat{urldate}{##1}
    \renewbibmacro*{urldate}{%
    \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令

    %
    %   专利的公告日期、或报纸的日期的输出宏
    %   20160701,v1.0,新增加
    %   20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen
    %
    %   原理方法:加上printtext避免破坏异步标点机制
    %
    \newbibmacro*{newsdate}{%
    \printtext{\blx@edtfdate{}{}}%
    }

    \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
        \iffieldundef{year}{%
                \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
                {\printtext{(}\printenddate\printtext{)}}%
        }{\iffieldequalstr{year}{}{%因为year存在,但为空
            }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}%
         }%
    }%
}

%
%   日期信息的输出格式,针对biblatex>=3.10版本
%
\defversion{3.10}{date}{
    \DeclareFieldFormat{urldate}{##1}
    \renewbibmacro*{urldate}{%
    \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令

    %
    %   专利的公告日期、或报纸的日期的输出宏
    %   20160701,v1.0,新增加
    %   20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
    %
    %   原理方法:加上printtext避免破坏异步标点机制
    %
    \newbibmacro*{newsdate}{%%
    \printtext{\blx@gbdate{}{}}%%
    }

    \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
        \iffieldundef{year}{%
                \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
                {\printtext{(}\printenddate\printtext{)}}%
        }{\iffieldequalstr{year}{}{%因为year存在,但为空
            }{\printtext{(}\blx@gbdate{}{}\printtext{)}}%
         }%
    }%
}

%
%   关联文献的输出格式,针对3.9>=biblatex>=3.7版本
%
%   原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断
%   下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。
\ifboolexpr{
test{\iftoggle{iftleight}}
or
test{\iftoggle{iftlnine}}
}{\renewbibmacro*{related}{%standard.bbx
  \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} }
    {}
    {\usebibmacro{begrelated}%
     \def\bbx@tempa{}%
     \setcounter{bbx:relatedtotal}{0}%
     \def\do##1{%
       \entrydata{##1}{%
         \ifrelatedloop
           {}
           {\stepcounter{bbx:relatedtotal}%
            \gappto{\bbx@tempa}{##1,}}}}%
     \docsvfield{related}%
     \restorefield{related}{\bbx@tempa}%
     \ifnumgreater{\value{bbx:relatedtotal}}{0}
       {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}%
        \iffieldundef{clonesourcekey}
          {}
          {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}%
        \setcounter{bbx:relatedcount}{0}%
        \def\do{%
          \stepcounter{bbx:relatedcount}%
          \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0
            {\ifcsundef{relateddelim\strfield{relatedtype}}
              {\printtext{\relateddelim}}
              {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}}
            {}}%
        \ifbibmacroundef{related:\strfield{relatedtype}}
          {\appto{\do}{\usebibmacro{related:default}}}
          {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}%
        \iffieldformatundef{related:\strfield{relatedtype}}
          {\def\bbx@tempa{related}}
          {\def\bbx@tempa{related:\strfield{relatedtype}}}%
        \iffieldformatundef{relatedstring:\strfield{relatedtype}}
          {\def\bbx@tempb{relatedstring:default}}
          {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}%
        \printtext[\bbx@tempa]{%
          \usebibmacro{begrelatedloop}%
          \iffieldundef{relatedstring}
            {\ifboolexpr{
               test {\ifnumgreater{\value{bbx:relatedtotal}}{1}}
               and
               test {\ifbibxstring{\thefield{relatedtype}s}}
             }
               {\printtext[\bbx@tempb]{%
                  \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}}
               {\iffieldbibstring{relatedtype}
                  {\printtext[\bbx@tempb]{%
                     \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}}
                  {}}}
            {\iffieldbibstring{relatedstring}
               {\printtext[\bbx@tempb]{%
                  \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}}
               {\printfield[\bbx@tempb]{relatedstring}}}%
          \docsvfield{related}%
          \usebibmacro{endrelatedloop}}}%
       {}%
     \usebibmacro{endrelated}}}
}{}

%
%   关联文献块前的分隔符,针对biblatex3.11
%
%   原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
\defversion{3.11}{related}{
\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
}

\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2
\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6
\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7
\iftoggle{iftleight}{\switchversion{3.7}{date}}{}%3.8<=biblatex<=3.9
\iftoggle{iftlnine}{\switchversion{3.10}{date}}{}%biblatex3.10
\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.11}{related}}{}%biblatex最新

%
%   调整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}}
    {}}

%
%   调整页码的格式,即chapter+pages格式
%
\renewbibmacro*{chapter+pages}{%
  \printfield{chapter}%
  \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
  \setunit{\bibpagespunct}%
  \printfield{pages}}%
  %\newunit %这里的标点去掉
  }

%
%   出版社和地址的处理
%
%   v1.0k,20180425,为出版信息增加字体控制命令,hzz
%   原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
%   事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
%   新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date}
\newbibmacro*{location+institution+date}{\bibpubfont%
\iftoggle{bbx:gbpub}%
{\testCJKfirst{userd}
\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}%
  {\printlist{location}}%
%  \iflistundef{institution}
%    {\setunit*{\addcomma\space}}
%    {\setunit*{\addcolon\space}}%
%  \printlist{institution}%
%  \setunit*{\addcomma\space}%
\addcolon\addspace%
\iflistundef{institution}{%
\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
{\printlist{institution}}%
\setunit{\addcomma\addspace}%
  %\usebibmacro{date}%
  \printfield{year}%
  \bibrangedash%
  \iffieldundef{endyear}{}{\printfield{endyear}}%
  \newunit}%
{  \printlist{location}%
  \iflistundef{institution}%
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcolon\space}}%
  \printlist{institution}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  \newunit}%
}
%
%
\renewbibmacro*{publisher+location+date}{\bibpubfont%
\iftoggle{bbx:gbpub}%
{\testCJKfirst{userd}%
\iflistundef{location}{%\adddot
\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}%
}}%  \bibstring{noaddress}
{\printlist{location}\addcolon\addspace}%
%\addcolon\addspace%
\iflistundef{publisher}{%
\iffieldequalstr{note}{standard}{}{%
\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
}}%
{\printlist{publisher}\setunit*{\addcomma\addspace}}%
%\addcomma\addspace%
\usebibmacro{date}%
%\newunit %去掉这个标点
}%
{\printlist{location}%
  \iflistundef{publisher}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcolon\space}}%
  \printlist{publisher}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  %\newunit
  }%
}


%
%   对edition版本信息格式做出修改
%
\DeclareFieldFormat{edition}{%源来自biblatex.DEF
\testCJKfirst{userd}%
  \ifinteger{#1}%
    {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}%
    {\mkbibordedition{#1}~\bibstring{edition}}}%
    {#1\isdot}}

%
%   对version的版本信息做出修改
%
\DeclareFieldFormat{version}{%源来自biblatex.DEF
\testCJKfirst{userd}%
  \ifinteger{#1}%
    {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}%
    {\mkbibordedition{#1}~\bibstring{version}}}%
    {#1\isdot}}

%
%   作者域的输出控制宏
%
%   当两篇文献作者相同且连续时,标准样式是用-代替后面的文献的作者,这里取消这一设置
\renewbibmacro*{author}{%author for biblatex version <=3.7
  \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}
  }

%
%   设置标注和文献表中作者和年份之间的分隔符
%
%   原理方法:注意3.4版已经有\nameyeardelim,上述修改的author宏虽然定义了著录表中的标点,但标注中的未定义
%   设置因为mergedate默认为true时的情况,来自\bbx@opt@mergedate@compact
%   去掉作者后面包围年份的圆括号
%   这里因为biblatex版本的不同,做不同的处理,texlive2017版/2016等低版本分开处理
\defversion{3.0}{dateextra}{
\renewcommand*{\nameyeardelim}{\addcomma\space}
    \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX
        \iffieldundef{\thefield{datelabelsource}year}
          {}
          {\printtext{%[parens]%这里把括号去掉
             \iffieldsequal{year}{\thefield{datelabelsource}year}
               {\printdateextralabel}%
               {\printfield{labelyear}%
                \printfield{extrayear}}}}}%
}

\defversion{3.4}{dateextra}{
    \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
    \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
    \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX
        \iffieldundef{\thefield{datelabelsource}year}
          {}
          {\printtext{%[parens]%这里把括号去掉
             \iffieldsequal{year}{\thefield{datelabelsource}year}
               {\printdateextralabel}%
               {\printfield{labelyear}%
                \printfield{extrayear}}}}}%
}
\defversion{3.7}{dateextra}{
    \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
    \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
  \renewbibmacro*{date+extrayear}{%以前的\printdateextralabel宏变为了\printlabeldateextra
    \iffieldundef{labelyear}
      {}
      {\printtext{%[parens]
         \iffieldsequal{year}{labelyear}
           {\printlabeldateextra}%
           {\printfield{labelyear}%
            \printfield{extrayear}}}}}%
}
\defversion{3.8}{dateextra}{
    \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
    \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
%注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。
\renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\usebibmacro{bbx:dashcheck}
       {%\bibnamedash %去掉相同作者用横线代替的处理
       \printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上
       }
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{authortype}
          {\setunit{\printdelim{nameyeardelim}}}
          {\setunit{\printdelim{authortypedelim}}}}%
     \iffieldundef{authortype}
       {}
       {\usebibmacro{authorstrg}%
        \setunit{\printdelim{nameyeardelim}}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extradate}}
  \renewbibmacro*{date+extradate}{%
    \iffieldundef{labelyear}
      {}
      {\printtext{%[parens]%这里去掉括号
         \iflabeldateisdate
           {\printdateextra}
           {\printlabeldateextra}}}}%
}

\iftoggle{iftlfive}{\switchversion{3.0}{dateextra}}{}%biblatex<=3.2
\iftoggle{iftlsix}{\switchversion{3.4}{dateextra}}{}%3.3<=biblatex<=3.6
\iftoggle{iftlseven}{\switchversion{3.7}{dateextra}}{}%biblatex=3.7
\iftoggle{iftleight}{\switchversion{3.8}{dateextra}}{}%<=3.8biblatex<=3.9
\iftoggle{iftlnine}{\switchversion{3.8}{dateextra}}{}%biblatex3.10
\iftoggle{iftlatest}{\switchversion{3.8}{dateextra}}{}%biblatex最新3.11

%
%   修改析出文献的文集的标题与附加标题间的符号
%
\renewbibmacro*{booktitle}{%
  \ifboolexpr{
    test {\iffieldundef{booktitle}}
    and
    test {\iffieldundef{booksubtitle}}
  }
    {}
    {\printtext[booktitle]{\bibtitlefont%
       \printfield[titlecase]{booktitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{booksubtitle}}%
     \newunit%标点换成下一句
     \setunit{\subtitlepunct}}%
  \printfield{booktitleaddon}}

%
%   调整期刊名的格式
%
%   原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。
%   v1.0k,20180425,增加了字体控制命令,hzz
\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
  \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
  }

%
%   增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格
%
\DeclareFieldFormat{addnumflag}{%
\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}}

%
%   调整journal输出
%
%   原理方法:首先判断子标题,然后再设置标点。
%   避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格
\renewbibmacro*{journal}{%
  \iffieldundef{journaltitle}%
    {}%
    {\printtext[journaltitle]{%
       \printfield[titlecase]{journaltitle}%
       \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}%
       \printfield[titlecase]{journalsubtitle}}}}}



%
%   调整期刊卷和期的格式
%
\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
\iftoggle{bbx:gbfieldstd}{%
  \printfield{volume}%
  \setunit*{\adddot}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}{%
  \printfield{volume}%
  %\setunit*{\adddot}%去掉点号
  %\printfield{number}%
  \iffieldundef{number}{}{\printfield[addnumflag]{number}}%
  %\iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
  \iffieldundef{eid}{}{%
  \setunit{\addcomma\space}%
  \printfield{eid}}}}

%
%   调整期刊年份的格式
%
%   原理方法:原在authoryear.BBX中\bbx@opt@mergedate@compact中定义
%   当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
  \renewbibmacro*{issue+date}{%
    \iffieldundef{issue}%
      {}%
      {\printtext[parens]{\printfield{issue}}\newunit}}



%
%   调整页码前的标点和去掉期刊文章等页码后面的标点
%
\renewbibmacro*{note+pages}{%源来自standard.bbx
  %\printfield{note}%不要note,note用来判断是否是报纸newspaper
  \iffieldundef{pages}{}{
  \setunit{\bibpagespunct}%
  \printfield{pages}}%
  %\newunit
  }

%
%   编者类型做一修改
%
\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
  \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}}}
         }}

%
%   修改期刊的标题
%
\renewbibmacro*{periodical}{%源来自biblatex.DEF
  \iffieldundef{title}
    {}
    {\printtext[title]{\bibtitlefont%
       \printfield[titlecase]{title}%
       %\setunit{\subtitlepunct}%
       \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
       {}{\setunit{\subtitlepunct}
       \printfield[titlecase]{subtitle}}%
       %}%把编组结束移到后面去
       \iftoggle{bbx:gbtype}{%
       \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
        \printfield[gbtypeflag]{usera}}}{}
       }}
       }

%
%   期刊的标题做修改
%
\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
  \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}}}%
  }%
  {\multivolparser{\thefield{volume}}%
  \printfield{year}%
  \setunit{\addcomma\space}%将冒号修改为逗号
  \printtext{\multivolfirst}%
  \printtext{\mkbibparens{\multinumberfirst}}%
  \bibrangedash%
  \iffieldundef{endyear}{}{%
  \printfield{endyear}%
  \setunit{\addcomma\space}%将冒号修改为逗号
  \printtext{\multivolsecond}%
  \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
}

%
%   重设专利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}}%
       \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
        {\setunit{\subtitlepunct}\printfield{titleaddon}}%
        \setunit{\subtitlepunct}\printfield{number}%写专利号
        \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
     \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
     %\newunit
     }%
}%
}

%
%   修改了一个institution+location+date用于report等类型
%
%   20180425,v1.0k,增加了字体控制命令,hzz
\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
  \printlist{location}%
  \iflistundef{institution}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcolon\space}}%
  \printlist{institution}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  %\usebibmacro{modifydate}%
  %\newunit
  }

%
%   修改in:用于inbook、incollection、inproceedings等类型
%   2018.04.20,v1.0k,renewed marco,by hzz
%
%   原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
\renewbibmacro*{in:}{%
 \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\addthinspace}}%
                         {\setunit{\adddot\addspace}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct


%=====================================================================
%设置驱动格式
%=====================================================================
%
%   book条目类的驱动
%
  \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock}%
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\iftoggle{bbx:gbstrict}{}{%
\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做incollection
\DeclareBibliographyDriver{incollection}{%直接用inbook的驱动
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \usebibmacro{in:}%
  %\printtext{\texttt{//}\addthinspace}%
  \usebibmacro{bybookauthor}%
  \ifnameundef{bookauthor}{}{\newunit}%替换下一句
  %\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}%
  \iftoggle{bbx:gbstrict}{}{%
  \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}}


%
%   连续出版物的驱动
%
  \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{editor}%
  %\setunit{\labelnamepunct}\newblock
  \newunit\newblock %删除上面一行,添加这一行
  \usebibmacro{title+issuetitle}%
  \newunit\newblock
  \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
  \newunit\newblock%添加这一行
  \iftoggle{bbx:gbstrict}{}{%
  \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}}

%
%   专利文献驱动
%
  \DeclareBibliographyDriver{patent}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\labelnamepunct}\newblock
  %\usebibmacro{title}%
  \usebibmacro{patenttitle}%给出专利专用的标题输出
  \iftoggle{bbx:gbstrict}{}{%
  \newunit%
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}}%
  \newunit\newblock
  \printfield{type}%
  \setunit*{\addspace}%
  %\printfield{number}%%已放到patenttitle中处理
  \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}}


%
%   在线文献驱动
%
\DeclareBibliographyDriver{online}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \iftoggle{bbx:gbstrict}{}{%
  \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}}



%
%   学位论文修改
%
  \DeclareBibliographyDriver{thesis}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \iftoggle{bbx:gbstrict}{}{%
  \newunit%
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \printfield{type}}%
  \newunit\newblock
  \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}%
  \iftoggle{bbx:gbstrict}{}{%
  \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}}

%
%   手册类型驱动
%   2016-11-11,增加了译者信息
%
%   直接利用report做manual
\DeclareBibliographyDriver{manual}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \iftoggle{bbx:gbstrict}{}{%
  \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做misc
\DeclareBibliographyDriver{misc}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \iftoggle{bbx:gbstrict}{}{%
  \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}}


%
%   会议论文文献类型驱动
%
  \DeclareBibliographyDriver{inproceedings}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \usebibmacro{in:}%
  %\printtext{\texttt{//}\addthinspace}%
  \usebibmacro{bybookauthor}%用类似inbook的方式处理
  \ifnameundef{bookauthor}{}{\newunit}%替换下一句
  %\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
  \iftoggle{bbx:gbstrict}{}{%
  \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}}

%
%   会议论文集文献类型驱动
%
\DeclareBibliographyDriver{proceedings}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  %\usebibmacro{editor+others}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \iftoggle{bbx:gbstrict}{}{%
  \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
  \iftoggle{bbx:gbstrict}{}{%
  \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}}


%
%   专著中的析出文献的格式修改
%
\DeclareBibliographyDriver{inbook}{%源来自standard.BBX
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock%
  \usebibmacro{title}%
\usebibmacro{in:}%
%\printtext{\texttt{//}\addthinspace}%
  \usebibmacro{bybookauthor}%
  \ifnameundef{bookauthor}{}{\newunit}%替换下一句
  %\newunit\newblock
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock%
%  \usebibmacro{byeditor+others}%
%  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \iftoggle{bbx:gbstrict}{}{%
  \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}}


%
%   文集类型驱动
%
%   直接利用book做collection
\DeclareBibliographyDriver{collection}{%直接用book的驱动
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
\iftoggle{bbx:gbstrict}{}{%
  \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}%
  \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的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}}