summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/bibtex/gost/gost.dtx
blob: a46a132108623c53b4204a49520f6d7c573e9b45 (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
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
% \iffalse
% !Mode:: "DTX:UNIX:UTF-8"
%
% This is the source file for the GOST package
% to be used with BibTeX8.
% It contains set of bibliographic style that
% attempt to format the bibliography according to
% GOST R 7.0.5-2008 with some conventional modifications.
%
% Copyright 2012 Igor A. Kotelnikov.
% Version 1.2a
%
% Copyright 1996-2005 Maksym Polyakov.
% Version 2005.08.12
%
% For a bibliographic entry in Russian you need
% to add the field
%     language = {russian}.
% Ukrainian, German, French, Italian languages are
% also supported. Default language is English.
%
% Book entry should have the numpages field
% showing total number of pages. Optional field
% url will format URL (using hyperref, if loaded).
%
% See examples in gost*.pdf.
%
% Requires 8-bit bibtex with switch -B and csf file supporting cyrillic.
% bibtex8 -B -c <encoding>.csf <your_document>
%
%
% Download from
%  CTAN:macros/latex/contrib/gost/gost.dtx
%
% To unpack run
%   latex gost.ins
%
% To produce documentation run
%    pdflatex gost.dtx
%    makeindex -r -s gind.ist gost
%    makeindex -r -s gglo.ist -o gost.gls gost.glo
%    pdflatex gost.dtx
%
% TeX Directory Structure
%
% Move all *.bst files       to TDS:bibtex/bst/gost
% Move all *.csf files       to TDS:bibtex/csf/gost
% Move all *.pdf files       to TDS:doc/bibtex/gost
% Move gost.dtx and gost.ins to TDS:source/bibtex/gost/
%
% $Id: gost.dtx, v.2012/08/31 kia999 $
%
%<*driver>
\ProvidesFile{gost.dtx}%
  [2012/08/31 v.1.2a Bibliography styles for GOST R 7.0.5-2008.]

\documentclass{ltxdoc}

\usepackage{geometry}
\usepackage{makeidx}
\ifpdf
  \usepackage[pdftex,hyperindex,unicode]{hyperref}
  \usepackage{cmap}
\else
  \usepackage[hypertex]{hyperref}
\fi
\usepackage{color}
\definecolor{darkblue}{rgb}{0,0,.6}
\hypersetup{
  pdftitle           = {The GOST package},
  pdfauthor          = {Igor A. Kotelnikov},
  pdfsubject         = {BibTeX, GOST},
  pdfstartview       = {FitH},
%  pdfborder          = {0 0 0},
%  bookmarksopen      = true,
  bookmarksnumbered  = true,
%  bookmarksopenlevel = 2,
  colorlinks = true,     linkcolor  = darkblue,
  citecolor  = darkblue, filecolor  = darkblue,
  menucolor  = darkblue, urlcolor   = darkblue
}


\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[russian,english]{babel}

\MakeShortVerb{\|}

\def\file#1{\texttt{#1}}
\def\pkg#1{\textsf{#1}}
\def\cmd#1{\texttt{#1}}

\newcommand\DescribeEntry[1]{%
  \DescribeMacro{#1}\index{Entry!\texttt{#1}}%
}
\newcommand\DescribeFunction[1]{%
  \DescribeMacro{#1}\index{\texttt{#1}}%
}
\newcommand\DescribeField[1]{%
  \DescribeMacro{#1}\index{Field!\texttt{#1}}%
}


\GetFileInfo{gost.dtx}
\EnableCrossrefs
%\DisableCrossrefs   % Say \DisableCrossrefs if index is ready
\RecordChanges       % Gather update information
\CodelineIndex       % Index code by line number
%\PageIndex           % Index code by page number

\title{The GOST package}

\author{
    Igor A. Kotelnikov\thanks{\texttt{kia999@mail.ru}}
}

\date{\filedate, \fileversion}

\makeindex

\begin{document}
  \maketitle
  \DocInput{gost.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{440}
%
% \changes{v1.2a}{31 Aug 2012}{Default for \cs{cyrdash} added}
% \changes{v1.2}{20 Feb 2012}{Support for natbib package}
% \changes{v1.2}{13 Feb 2012}{Fix bbl.urldate for ukrainian (Andrey Shvajkoy)}
% \changes{v1.2}{02 Feb 2012}{Thesis entry, report entry}
% \changes{v1.2}{01 Feb 2012}{Medium field}
% \changes{v1.2}{30 Jan 2012}{Strict option}
% \changes{v1.2}{29 Jan 2012}{Refactoring, Documentation}
% \changes{v1.2}{26 Jan 2012}{Entries eprint, eprintclass, eprinttype}
% \changes{v1.2}{26 Jan 2012}{Options modern, long, eprint}
% \changes{v1.1}{25 Jan 2012}{Gost705.dtx borrowed from Disser pkg}
% \changes{v1.1}{21 Jan 2012}{Upload to CTAN}
% \changes{v1.1}{15 Jan 2012}{Added German, French, Italian languages}
% \changes{v1.1}{15 Jan 2012}{Entry ONLINE}
% \changes{v1.0}{12 Aug 2005}{Bug fix (long annote)}
% \changes{v0.9}{07 Oct 2003}{Bug fix in names and date formatting}
% \changes{v0.9}{07 Oct 2003}{Bug fix in INPROCEEDINGS}
% \changes{v0.8}{10 Aug 2003}{\cs{BibEmph} added}
% \changes{v0.8}{06 Jun 2003}{Entry ANNOTE added}
% \changes{v0.8}{06 Jun 2003}{\cs{BibUrl} added}
% \changes{v0.8}{06 Jun 2003}{\cs{BibAnnote} added}
%
% \DoNotIndex{\cyra,\cyrb,\cyrv,\cyrg,\cyrd,\cyre}
% \DoNotIndex{\CYRP,\cyrii,\cyrr,\cyre,\cyro,\CYRU,\cyrk,\cyrl,\CYRS,\cyrs|}
% \DoNotIndex{\cyrt,\cyri,\cyrz,\CYRT,\cyrm}
% \DoNotIndex{\cyr,\cyrc,\CYRD,\cyrery,\cyrh,\CYRK,\CYRM,\CYRN,\cyrn}
% \DoNotIndex{\cyrp,\cyrs,\cyrshch,\cyru,\CYRV,\cyrya}
% \DoNotIndex{\z@skip,\z@}
%
% \begin{abstract}
%
% GOST is a bundle of BibTeX styles designed to meet State Standards (GOST)
% on information, librarianship and publishing issued by The Russian Federation
% and Interstate Committee of former USSR States.
%
% It comprises 16 BibTeX styles to format bibliography in English, Russian
% and Ukrainian according to GOST 7.0.5-2008 and GOST 7.1-2003. Both 8-bit
% and Unicode (UTF-8) versions of each BibTeX style, in each case offering
% a choice of sorted and unsorted. Further, 2 more styles, |gost780| and
% |gost780s| styles (not conforming to effective standards) are retained
% for backwards compatibility.
%
% \end{abstract}
%
% \section{Introduction}
%   The package was initially developed by Maksym Polyakov. It was later
%   updated by Igor Kotelnikov to the present status and some code was borrowed
%   from \pkg{disser} package developed by Stanislav Kruchinin and unpublished
%   work by Artem Petrenkov.
%
%   Nowdays, GOST is a bundle of BibTeX styles designed to meet State Standards
%   (GOST) on information, librarianship and publishing issued by
%   Russian Federation and interstate committee of former USSR States.
%
%   The System of Standards includes:
%   \begin{description}
%   \item[GOST 7.0.5-2008]
%                Bibliographic reference.
%                General requirements and rules of making.
%   \item[GOST 7.1  -2003]
%                Bibliographic record.
%                Bibliographic description.
%                General requirements and rules.
%   \item[GOST 7.80 -2000]
%                Bibliographic record.
%                Heading. General requirements and rules.
%   \item[GOST 7.11 -2004]
%                Bibliographic description and references.
%                Rules for the abbreviation of words and word combinations
%                in foreign European languages.
%   \item[GOST 7.83 -2001]
%                Electronic editions. Basic types and imprint.
%   \end{description}
%   ect.
%
%   Currently, GOST contains 16 BibTeX styles to format bibliography in English,
%   Russian and Ukrainian according to GOST 7.0.5-2008 and GOST 7.1-2003. Both
%   8-bit and Unicode (UTF-8) versions of each BibTeX style, in each case
%   offering a choice of sorted and unsorted. Further, 2 styles, |gost780| and
%   |gost780s| styles (which do not conform to effective standards) are retained
%   for backwards compatibility.
%
%   All styles in the GOST bundle are derived from single master file
%   \file{gost.dtx} by applying different set of options as shown in the table
%   below.
%
%   \begin{verbatim}
%------------------------------------------------------------------------
% Style         | utf8 | strict | modern | eprint | long | sort | natbib
%------------------------------------------------------------------------
% gost780       |      |        |        |        |      |      |
% gost780s      |      |        |        |        |      |   +  |
%------------------------------------------------------------------------
% gost2003      |      |   +    |        |    +   |      |      |
% gost2003s     |      |   +    |        |    +   |      |   +  |
% gost2008      |      |        |   +    |    +   |      |      |
% gost2008n     |      |        |   +    |    +   |      |      |   +
% gost2008l     |      |        |   +    |    +   |   +  |      |
% gost2008s     |      |        |   +    |    +   |      |   +  |
% gost2008ns    |      |        |   +    |    +   |      |   +  |   +
% gost2008ls    |      |        |   +    |    +   |   +  |   +  |
%------------------------------------------------------------------------
% ugost2003     |  +   |   +    |        |    +   |      |      |
% ugost2003s    |  +   |   +    |        |    +   |      |   +  |
% ugost2008     |  +   |        |   +    |    +   |      |      |
% ugost2008n    |  +   |        |   +    |    +   |      |      |   +
% ugost2008l    |  +   |        |   +    |    +   |   +  |      |
% ugost2008s    |  +   |        |   +    |    +   |      |   +  |
% ugost2008ns   |  +   |        |   +    |    +   |      |   +  |   +
% ugost2008ls   |  +   |        |   +    |    +   |   +  |   +  |
%------------------------------------------------------------------------
% Style         | utf8 | strict | modern | eprint | long | sort | natbib
%------------------------------------------------------------------------
%   \end{verbatim}
%
% |Gost2008| style is recommended for most applications. It corresponds to the
% currently effective Standard 7.0.5-2008. Librarians should use the style
% |gost2003| instead of |gost2008| to compile a library catalog to meet the
% Standard 7.1-2003. Use of other styles is best explained through
% the meaning of options used to compile those styles from the master source.
%
% Two styles, |gost780| and |gost780s|, compiled without |modern| and |strict|
% options, are retained for backward compatibility. They do not conform
% the Standards 7.0.5-2008 and 7.1-2003 cited above.
%
% The |strict| option provides conformance to the Standard 7.1-2003. The
% styles compiled with that option bear the name |gost2003| with possible
% suffixes |s|, |l|, |n| as explained below. These styles are intended
% primarily for the librarians who compose a library catalog.
%
% The |modern| option meets the Standard 7.0.5-2008 which can be thought
% off as a relaxed version of the Standards 7.1-2003. The styles compiled with
% that option bear the name |gost2008| with possible suffixes |s|, |l|, |n|.
% The |strict| option  has precedence over |modern| so that a style compiled
% with both options will resemble mainly the |gost2003| style rather than
% |gost2008|.
%
% If the number of authors exceeds 4, modern styles cut the list of authors
% to at most 4 persons as prescibed by the Standards. The option
% |long| overrides this rule to provide backward compatibility with the
% package disser by Stanislab Kruchinin. Two styles, |gost2008l| and
% |gost2008ls|, compiled with the option |long| mimic behavior of the styles
% |gost705| and |gost705s| from the disser package. Major
% effect of the |long| option is that the list of authors always
% precedes book or article title no matter how long is it.
% Modern styles compiled without |long| place long list of authors behind
% the title. The names of styles compiled with the option |long| has the
% suffix |l|. Recall that those styles do not conform effective Standards and
% their use is discouraged.
%
% The |eprint| option enables formatting electronic publications. In particular,
% it enables |eprint|, |eprinttype|, |eprintclass|, and |doi| fields for a
% bibliographic entry. The styles generated without the |eprint| option,
% ignore the these fields. Starting from the
% version 1.2 of the GOST package, all modern styles are compiled with this
% option included, and the suffix |e| which designated
% this option in earlier  versions is not appended to the name of style
% any more.
%
% The |natbib| option provides compatibility with the |natbib| package. The names
% of styles compiled with the option |natbib| bear the suffix |n|. Currently
% 4 styles with that option are available for beta testing.
%
% The |sort| option enables sorting bibliographic references by author names
% and references titles. The names of styles compiled with the option |sort|
% bear the suffix |s|.
%
% Finally, the |utf8| option produces bibliographic styles in unicode rather
% that in 8-bit encoding. Names of those styles bear the prefix |u|.
%
%
% Beyond bibliographic style, GOST bundle contains CS files (codepage and
% sorting order).
%   \begin{verbatim}
%  ----------------------------------------------------------------
%  Encoding        |   CSF                 Sorting order
%  ----------------------------------------------------------------
%  cp866           |   ruscii.csf          Cyrillic first, Latin
%  cp1251          |   cp1251.csf          Cyrillic first, Latin
%  koi8-u          |   koi8u.csf           Cyrillic first, Latin
%  utf8            |   utf8cyrillic.csf    Cyrillic first, Latin
%  ----------------------------------------------------------------
%   \end{verbatim}
%
%  In addition, BibTeX8 distribution comes with few more CSFs.
%   \begin{verbatim}
%  ----------------------------------------------------------------
%  Encoding        |   CSF                 Sorting order
%  ----------------------------------------------------------------
%  cp866           |   cp866rus.csf        Latin first, Cyrillic
%  ----------------------------------------------------------------
%   \end{verbatim}
%
%   \subsection{How to use}
%
%   \begin{enumerate}
%   \item
%   Select bibliography style by adding appropriate |\bibliographystyle|
%   declaration to your source file \file{<filename>.tex}, e.g.
%   \begin{verbatim}
%   \bibliographystyle{gost2008}
%   \bibliography{database}
%   \end{verbatim}
%
%   \item
%   Add the field |language="ukrainian"| or |language="russian"| to the
%   bibliographic entries in Ukrainian or Russian languages in your
%   database; English is the default language. German, Italian and
%   French are partially supported.
%
%   \item
%   To compile list of references from your database use \file{bibtex8.exe}
%   rather than \file{bibtex.exe}. Depending on the codepage of your
%   bibliographic database, indicate one of the CS files
%   listed above as option to \file{bibtex8.exe}.  Run LaTeX, then run
%   \file{bibTeX8} and LaTeX again:
%   \begin{verbatim}
%   latex <filename>.tex
%   bibtex8 -B -c <csf_file>.csf <filename>.aux
%   latex <filename>.tex
%   \end{verbatim}

%   \item
%   For details on preparing bibliographic database see examples in
%   \file{gost*.pdf}.

%   \item
%   \file{ugost*} styles are primarily intended for use
%   with unicode compilers (\file{xelatex} and \file{lualatex}). They
%   should be preferred as well when using 8bit compilers
%   (\file{latex} and \file{pdflatex}) if source file is in utf8 encoding.
%
%   \item
%   Neither \file{bitex.exe} nor \file{bitex8.exe} provides
%   correct sorting order of unicode text. It means that using
%   \file{ugost2008s} or \file{ugost2008ns} may produce unexpected result
%   for documents in \texttt{utf8} encoding.
%
%   \item
%   \file{Bibtex8} fails to change case of a string if it contains Cyrillic
%   letter in unicode. Therefore \file{ugost2008*} styles do not change case of
%   titles and other parts of bibliographic record while 8-bit styles
%   do the case change where appropriate.
%
%   \item
%   Either \file{bibtex8} or \file{Bibtex8} fail to cut Cyrillic names to
%   initials. Therefore \file{ugost2008*} styles do not modify name of
%   authors.
%
%   \item
%   Package |natbib| is required when choosing styles with
%   suffix |n| int their names.
%
%   \end{enumerate}
%
%
%   \subsection{Customization}
%
%   Every GOST style defines few commands to format some parts of a
%   reference. You can redefine these commands prior to
%   the |\bibliography{<bibtex_style>}| command. Initial
%   definitions are listed below.
%   \begin{verbatim}
%   \providecommand*{\url}[1]{{\small #1}}
%   \providecommand*{\BibUrl}[1]{\url{#1}}
%   \providecommand{\BibAnnote}[1]{}
%   \providecommand*{\BibEmph}[1]{#1}
%   \end{verbatim}
%
%   By default, gost styles separate logical parts of a bibliography
%   record by a period and cyrdash (|. "---|). It is legitimate to drop
%   that dash by overriding the command |\BibDash| as follows
%
%   \begin{verbatim}
%   \providecommand*{\BibDash}{}
%   \end{verbatim}
%
%   By default, |\BibDash| is equivalent to the shorthand |"---|
%   defined by the babel package with the option |russian|.
%   It prints a so called Cyrillic dash (|\cyrdash|),
%   which is 20% shorter then ordinary LaTeX dash (|---|), and puts
%   unbreakable space before |\cyrdash| so that dash never appears
%   in the beginning of a line.
%
%   \subsection{Where to get}
%
%   \begin{enumerate}
%   \item
%   \href{http://ctan.org/tex-archive/biblio/bibtex/contrib/gost}
%       {CTAN:biblio/bibtex/contrib/gost}.
%   \item
%   \href{http://ctan.org/pkg/gost}
%       {CTAN:pkg/gost}.
%   \end{enumerate}
%
%   \subsection{What's new in version 1.2 (2012.02.22)}
%
%   \begin{enumerate}
%   \item
%   Code refactoring. All styles are now generated from single source file.
%
%   \item
%   Support for GOST-7.1-2003. The field |medium| is added to reflect type
%   of material. For most entry types |medium| defaults to |text|.
%
%   \item
%   Support for |natbib| package.
%
%   \item
%   All modern styles are now compiled with the |eprint| option.
%
%   \end{enumerate}
%
%
%   \subsection{What's new in version 1.1 (2012.01.21)}
%
%   \begin{enumerate}
%   \item
%   Support for GOST 7.0.5-2008 and GOST 7.1-2003 is provided.
%
%   \item
%   |@Online| entry is added to format a reference to electronic
%      resource on Internet.
%
%   \item
%   |@MastersThesis| entry is added to format a reference to master's thesis.
%
%   \item
%   |@DSciThesis| entry is added to format a reference to doctor of
%   sciences thesis.

%   \item
%   |Urldate|, |eprint|, |eprintclass|, |eprinttype| fields are added.
%
%   \end{enumerate}
%
%   \subsection{Version history}
%
%   \begin{enumerate}
%   \item[2012.02.22] Support for |natbib| package.
%   \item[2012.02.02] Adaptation to GOST 7.0.5, electronic publishing.
%   \item[2005.08.12] First version uploaded to CTAN.
%   \item[2003.06.06] First public version.
%   \end{enumerate}
%
% \StopEventually{
%   \IndexPrologue{\section{Index}
%       Numbers written in dark blue refer to the page where the corresponding
%       entry is described; numbers in black roman refer to the code lines where
%       the entry is used.
%   }
%   \PrintChanges
%   \PrintIndex
% }
%
% \section{Implementation}
%
%   We need Russian fonts to produce documentation of the code below.
%   Therefore we switch current language to Russian by issuing the command
%   |\selectlanguage{russian}|.
%
% \selectlanguage{russian}
%
%    \begin{macrocode}
%<*bst>
%%
%% This bibstyle attempts to format bibliography according to
%<!modern>%% GOST 7.80-2000 for bibliographic records.
%<modern>%% GOST 7.0.5-2008 for bibliographic reference.
%<*natbib>%%
%%-------------------------------------------------------------------
%% This is an author-year citation style bibliography.
%% It requires a special package file to function properly
%% such as natbib.sty by Patrick W. Daly.
%% The form of the \bibitem entries is
%%   \bibitem[Jones et al.(1990)]{key}...
%%   \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}...
%% where the label part (in brackets) consists of the author names,
%% as they should appear in the citation, with the year in parentheses following.
%% There must be no space before the opening parenthesis!
%% A full list of authors may also follow the year.
%% In natbib.sty, it is possible to define the type of enclosures that is
%% really wanted (brackets or parentheses), but in either case, there must
%% be parentheses in the label.
%% The \cite command functions as follows:
%%   \citet{key}              => Jones et al. (1990)
%%   \citet*{key}             => Jones, Baker, and Smith (1990)
%%   \citep{key}              => (Jones et al., 1990)
%%   \citep*{key}             => (Jones, Baker, and Smith, 1990)
%%   \citep[chap. 2]{key}     => (Jones et al., 1990, chap. 2)
%%   \citep[e.g.][]{key}      => (e.g. Jones et al., 1990)
%%   \citep[e.g.][p. 32]{key} => (e.g. Jones et al., p. 32)
%%   \citeauthor{key}         => Jones et al.
%%   \citeauthor*{key}        => Jones, Baker, and Smith
%%   \citeyear{key}           => 1990
%%---------------------------------------------------------------------
%</natbib>

%    \end{macrocode}
% \subsection{Fields}
%
% Enlist all entry types allowed in a bibliographic database.
% Most entries are common for many standard bst styles.
%    \begin{macrocode}
ENTRY
  { address
    annote
    author
    booktitle
    bookauthor
    chapter
    edition
    editor
    compiler
    howpublished
    institution
    journal
    key
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    medium % new in v.2.
    type
    volume
    year
    language
    booklanguage
%    \end{macrocode}
%   Remaining entries are borrowed from biblatex.
%    \begin{macrocode}
    numpages
    url
    urldate
    isbn
    doi
%    archive
    eprinttype   % = archivePrefix
    eprintclass  % = primaryClass
    eprint
  }
  {}
%<!natbib>  { label }
%<natbib>  { label extra.label sort.label short.list }

%    \end{macrocode}
% Declare internal variables and constants used in to format references.
%    \begin{macrocode}
INTEGERS { output.state before.all mid.sentence after.sentence after.block
after.dblslash after.slash after.column after.semicolumn }

%    \end{macrocode}
% \DescribeFunction{init.state.consts}%
%    \begin{macrocode}
FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #4 'after.dblslash :=
  #5 'after.slash :=
  #6 'after.column :=
  #7 'after.semicolumn :=
}

STRINGS { s t }

STRINGS { curlanguage }

%    \end{macrocode}
%
% \subsection{Formatting functions}
%
% \DescribeFunction{change.language}
% Declare function to switch language.
%    \begin{macrocode}
FUNCTION {change.language}
{ booklanguage empty$
    { "" }
    { booklanguage  'curlanguage :=
      "\selectlanguageifdefined{"
      curlanguage *
      "}" *
    }
  if$
}

%    \end{macrocode}
%
% Declare functions to output various parts of bibliographic record.
% \DescribeFunction{output.nonnull}
%    \begin{macrocode}
FUNCTION {output.nonnull}
{
  swap$
  output.state mid.sentence =
    { ", " * write$ }
    { output.state after.block =
        { add.period$ write$
%<!modern>          " " quote$ "--- " * *  write$
%<modern>          " \BibDash " write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            { output.state after.dblslash =
                { "~//" * change.language * " " * write$ }
                { output.state after.slash =
                    { "~/ " * write$ }
                    { output.state after.column =
%<!(strict|modern)>                        { ": " * write$ }
%<strict|modern>                        { "~: " * write$ }
                        { output.state after.semicolumn =
%<!(strict|modern)>                            { "; " * write$ }
%<strict|modern>                            { "~; " * write$ }
	                        { add.period$ " " * write$ }
    	                  if$
                        }
                      if$
                    }
                  if$
                }
              if$
            }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
}

%    \end{macrocode}
%
% \DescribeFunction{output}
% \DescribeFunction{output.check}
%    \begin{macrocode}
FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

%    \end{macrocode}
%
% \DescribeFunction{fin.entry}
%   |fin.entry| finalizes current entry. It writes dot, if no dot is found in
%   stack, and starts new line.
%    \begin{macrocode}
FUNCTION {fin.entry}
{ add.period$
  write$
  newline$
}

%    \end{macrocode}
%
% \DescribeFunction{new.block}%
%   Declare family of functions to put punctuation marks  depending of current
%   status of output stack. The just check output state and revert it another
%   state if required. Checking output state prevents occasional doubling of
%   punctuation marks.
%    \begin{macrocode}
FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.dblslash}%
%    \begin{macrocode}
FUNCTION {new.dblslash}
{ output.state before.all =
    'skip$
    { after.dblslash 'output.state := }
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.slash}%
%    \begin{macrocode}
FUNCTION {new.slash}
{ output.state before.all =
    'skip$
    { after.slash 'output.state := }
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.column}%
%    \begin{macrocode}
FUNCTION {new.column}
{ output.state before.all =
    'skip$
    { after.column 'output.state := }
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.semicolumn}%
%    \begin{macrocode}
FUNCTION {new.semicolumn}
{ output.state before.all =
    'skip$
    { after.semicolumn 'output.state := }
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.sentence}%
%    \begin{macrocode}
FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state := }
      if$
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{add.blank}%
%    \begin{macrocode}
FUNCTION {add.blank}
{ " " * before.all 'output.state :=
}

%    \end{macrocode}
%
% \DescribeFunction{not}
%   Declare few logical functions.
%    \begin{macrocode}
FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

%    \end{macrocode}
% \DescribeFunction{and}
%    \begin{macrocode}
FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

%    \end{macrocode}
% \DescribeFunction{or}
%    \begin{macrocode}
FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

%    \end{macrocode}
% \DescribeFunction{chop.word}
% The function |chop.word| in |substr len str chop.word| removes given substring
% |substr| of length |len| from the beginning of the string |str|.
%    \begin{macrocode}
%<*sort|natbib>
INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}
%</sort|natbib>

%    \end{macrocode}
% \DescribeFunction{non.stop}
%    \begin{macrocode}
FUNCTION {non.stop}
{ duplicate$
   "}" * add.period$
   #-1 #1 substring$ "." =
}

%    \end{macrocode}
% \DescribeFunction{new.block.checka}
%    \begin{macrocode}
FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.block.checkb}
%    \begin{macrocode}
FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.sentence.checka}
%    \begin{macrocode}
FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.sentence.checkb}
%    \begin{macrocode}
FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

%    \end{macrocode}
% \DescribeFunction{new.dblslash.checka}
% For |online| entry.
%    \begin{macrocode}
FUNCTION {new.dblslash.checka}
{ empty$
    'skip$
    'new.dblslash
  if$
}

%    \end{macrocode}
% \DescribeFunction{field.or.null}
%    \begin{macrocode}
FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

%    \end{macrocode}
%
% \DescribeFunction{emphasize}
% Declare function to emphasize last string in stack.
%    \begin{macrocode}
FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "\BibEmph{" swap$ * "}" * }
  if$
}

%    \end{macrocode}
%
% \DescribeFunction{enclose.square.brackets}
% New in v.1.2.
% Declare function to enclose last word in square brackets. It do so only
% for the |string| option.
%    \begin{macrocode}
%<*!strict>
FUNCTION {enclose.square.brackets} { }
%</!strict>
%<*strict>
FUNCTION {enclose.square.brackets}
{ duplicate$ empty$
    { pop$ "" }
    { "[" swap$ * "]" * }
  if$
}
%</strict>


% \DescribeFunction{bracify}
% \DescribeFunction{bracketise}
% \DescribeFunction{parenthesify}
% New in v.1.2. An idea borrowed from apsrev4-1.bst.
% Declare function to enclose last word in braces, square brackets and
% parenthesis.
%    \begin{macrocode}
FUNCTION {bracify}
{ duplicate$ empty$
    { pop$ "{}" }
    { "{" swap$ * "}" * }
  if$
}
FUNCTION {bracketise}
{ duplicate$ empty$
    { pop$ "[]" }
    { "[" swap$ * "]" * }
  if$
}
FUNCTION {parenthesify}
{ duplicate$ empty$
    { pop$ "()" }
    { "(" swap$ * ")" * }
  if$
}


%    \end{macrocode}
%
% \DescribeFunction{space.word}
% |space.word| inserts space before last string in stack.
%    \begin{macrocode}
FUNCTION {space.word}
{ " " swap$ * " " * }

%    \end{macrocode}
%
% \subsection{Standard abbreviations}
%
% Declare language-sensitive abbreviations.
% \DescribeFunction{bbl.edby}
%    \begin{macrocode}
FUNCTION {bbl.edby}    %  { "\bbledby{}" }
{ curlanguage "english" =
   {"Ed.\ by"}
   { curlanguage "ukrainian" =
%<!utf8>      {"{\cyr\CYRP\cyrii\cyrd\ \cyrr\cyre\cyrd.}"}
%<utf8>      {"Під ред."}
      { curlanguage "russian" =
%<!utf8>         {"{\cyr\CYRP\cyro\cyrd\ \cyrr\cyre\cyrd.}"}
%<utf8>         {"Под ред."}
         { curlanguage "german" =
            { "ed." }
            {"language is not defined: " language "edby" * * warning$ "Ed.\ by"}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.cmplr}
%    \begin{macrocode}
FUNCTION {bbl.cmplr}
{ curlanguage "english" =
   { "Compiler"}
   { curlanguage "german" =
      { "Hrsg." }
      { curlanguage "ukrainian" =
%<!utf8>         {"{\cyr\CYRU\cyrk\cyrl.}"}
%<utf8>         {"{Укл.}"}
         { curlanguage "russian" =
%<!utf8>            {"{\cyr\CYRS\cyro\cyrs\cyrt.}"}
%<utf8>            {"{Сост.}"}
            {"language is not defined: " language  "cmplr" * * warning$ "Compiler"}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.edition}
%    \begin{macrocode}
FUNCTION {bbl.edition} %  { "\bbledition{}" }
{ curlanguage "english" =
   {"edition"}
   { curlanguage "ukrainian" =
%<!utf8>      {"{\cyr\cyrv\cyri\cyrd.}"}
%<utf8>      {"{вид.}"}
      { curlanguage "russian" =
%<!utf8>         {"{\cyr\cyri\cyrz\cyrd.}"}
%<utf8>         {"{изд.}"}
         { curlanguage "german" =
            {" {aus.}" } %%%% { "Aufl." } ??
            { curlanguage "italian" =
               {"edizione"}
               { curlanguage "french" =
                  {"\'{e}dition"}
                  {"language is not defined: " language  "edition" * * warning$ "edition"}
               if$}
            if$}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.vvolume}
%    \begin{macrocode}
FUNCTION {bbl.vvolume} %  { "\bblVolume{}" }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"Volume"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      { "\CYRT\cyro\cyrm" }
%<utf8>      { "Том" }
      { curlanguage "german" =
         {"{Band}"} %%%% { "Volumen" }
         {"language is not defined: " language  "vvolume" * * warning$ "Volume"}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.vvol}
%    \begin{macrocode}
FUNCTION {bbl.vvol}    %  { "\bblVol{}" }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"Vol."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      {"\CYRT."}
%<utf8>      {"Т."}
      { curlanguage "german" =
         {"{Bd.}"} %%%% { "Vol." }
         {"language is not defined: " language  "vvol" * * warning$ "Vol."}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.iissue}
%    \begin{macrocode}
FUNCTION {bbl.iissue}  %  { "\bblIssue{}" }
{ curlanguage "english" =
   {"Issue"}
   { curlanguage "ukrainian" =
%<!utf8>      {"\CYRV\cyri\cyrp\cyru\cyrs\cyrk"}
%<utf8>      {"Випуск"}
      { curlanguage "russian" =
%<!utf8>         {"\CYRV\cyrery\cyrp\cyru\cyrs\cyrk"}
%<utf8>         {"Выпуск"}
         { curlanguage "german" =
            {"{Heft}"} %%%% { "Ausgabe" }
            {"language is not defined: " language "iissue" * * warning$ "Issue"}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.iiss}
%    \begin{macrocode}
FUNCTION {bbl.iiss}  %  { "\bblIss{}" }
{ curlanguage "english" =
   {"Iss."}
   { curlanguage "ukrainian" =
%<!utf8>      {"\CYRV\cyri\cyrp."}
%<utf8>      {"Вип."}
      { curlanguage "russian" =
%<!utf8>         {"\CYRV\cyrery\cyrp."}
%<utf8>         {"Вып."}
         { curlanguage "german" =
            {"{H.}"}
            {"language is not defined: " language "iiss" * * warning$ "Iss."}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.of}
%    \begin{macrocode}
FUNCTION {bbl.of}      %  { "\bblof{}" }
{ curlanguage "english" =
   {"of"}
   { curlanguage "german" =
      { "von" }
      { curlanguage "ukrainian" =
%<!utf8>         { "{\cyr\cyrii\cyrz}" }
%<utf8>         { "{із}" }
         { curlanguage "russian" =
%<!utf8>            { "{\cyr\cyri\cyrz}" }
%<utf8>            { "{из}" }
            {"language is not defined: " language "of" * * warning$ "of"}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.etal}
%    \begin{macrocode}
FUNCTION {bbl.etal}      %  { "\bblof{}" }
{ curlanguage "english" =
   {"et~al."}
   { curlanguage "german" =
      { "u.~a." }
      { curlanguage "ukrainian" =
%<!utf8>         {"{\cyr\cyrt\cyra~\cyrii\cyrn.}"}
%<utf8>         {"{та~ін.}"}
         { curlanguage "russian" =
%<!utf8>            {"{\cyr\cyri~\cyrd\cyrr.}"}
%<utf8>            {"и~др."}
            {"language is not defined: " language  "et~al" * * warning$ "et~al."}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.and}
%    \begin{macrocode}
%<*natbib>
FUNCTION {bbl.and}      %  { "\bbland{}" }
{ curlanguage "english" =
   {"and"}
   { curlanguage "german" =
      { "und" }
      { curlanguage "ukrainian" =
%<!utf8>         {"{\cyrii}"}
%<utf8>         {"і"}
         { curlanguage "russian" =
%<!utf8>            {"{\cyri}"}
%<utf8>            {"и"}
            {"language is not defined: " language  "and" * * warning$ "and"}
         if$}
      if$}
   if$}
if$}
%</natbib>

%    \end{macrocode}
% \DescribeFunction{bbl.nnumber}
%    \begin{macrocode}
FUNCTION {bbl.nnumber} %  { "\bblNumber{}" }
{ curlanguage "english" =
   {"Number"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      { "\CYRN\cyro\cyrm\cyre\cyrr" }
%<utf8>      { "{Номер}" }
      { curlanguage "german" =
         {"{Heft}"} %%% { "Anzahl" }
         {"language is not defined: " language  "nnumber" * * warning$ "Number"}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.number}
%    \begin{macrocode}
FUNCTION {bbl.number}  %  { "\bblnumber{}" }
{ curlanguage "english" =
   {"number"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      {"{\cyr\cyrn\cyro\cyrm\cyre\cyrr}"}
%<utf8>      {"{номер}"}
      { curlanguage "german" =
         {"{Heft}"} %%% { "anzahl" }???
         {"language is not defined: " language  "number" * * warning$ "number"}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.nr}
%    \begin{macrocode}
FUNCTION {bbl.nr}     %   { "\bblno{}" }
{ curlanguage "english" =
   {"no."}
   { curlanguage "italian" =
      { "no" }
      { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>         { "{\cyr\textnumero}" }
%<utf8>         { "{№}" }
         { curlanguage "german" =
            {"{H.}"} %%% { "an." }
            {"language is not defined: " language "nr" * * warning$ "no."}
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.nnr}
%    \begin{macrocode}
FUNCTION {bbl.nnr}     %   { "\bblno{}" }
{ curlanguage "english" =
   {"No."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      { "{\cyr\textnumero}" }
%<utf8>      { "{№}" }
      { curlanguage "german" =
         {"{H.}"} %%% { "an." }
         {"language is not defined: " language  "nnr" * * warning$ "No."}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.in}
%    \begin{macrocode}
FUNCTION {bbl.in}    %    { "\bblin{}" }
{ curlanguage "english" = curlanguage "german" = or
   {"in"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      { "{\cyr\cyrv}" }
%<utf8>      { "{в}" }
      {"language is not defined: " language  "in" * * warning$ "in"}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.iin}
%    \begin{macrocode}
FUNCTION {bbl.iin}  %     { "\bblIn{}" }
{ curlanguage "english" = curlanguage "german" = or
   {"In"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      { "\CYRV" }
%<utf8>      { "{В}" }
      {"language is not defined: " language  "iin" * * warning$ "In"}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.pages}
%    \begin{macrocode}
FUNCTION {bbl.pages}    % { "\bblpp." }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"p."} %%% {"pp."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      {"{\cyr\cyrs.}"}
%<utf8>      {"{с.}"}
      { curlanguage "german" =
         {"S."} %%%% { "s." }
         {"language is not defined: " language  "pages" * * warning$ "p."}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.page}
%    \begin{macrocode}
FUNCTION {bbl.page}   %   { "\bblp."
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"p."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      {"{\cyr\cyrs.}"}
%<utf8>      {"{с.}"}
      { curlanguage "german" =
         {"S."} %%%% { "s." }
         {"language is not defined: " language  "page" * * warning$ "p."}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.ppages}
%    \begin{macrocode}
FUNCTION {bbl.ppages}%    { "\bblPp." }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"P."} %%%% { "Pp." }
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      {"{\cyr\CYRS.}"}
%<utf8>      {"{С.}"}
      { curlanguage "german" =
         {"S."}
         {"language is not defined: " language "ppages" * * warning$ "P."}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.ppage}
%    \begin{macrocode}
FUNCTION {bbl.ppage}  %   { "\bblP." }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"P."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
%<!utf8>      {"{\cyr\CYRS.}"}
%<utf8>      {"{С.}"}
      { curlanguage "german" =
         {"S."}
         {"language is not defined: " language  "ppage" * * warning$ "P."}
      if$}
   if$}
if$}

%    \end{macrocode}
% Next function was added in version 2012.01.15.
% \DescribeFunction{bbl.urldate}
%    \begin{macrocode}
FUNCTION {bbl.urldate}
{ curlanguage "english" =
   {"online; accessed"}
   { curlanguage "ukrainian" =
%<!utf8>      { "{\cyrd\cyra\cyrt\cyra\ \cyrz\cyrv\cyre\cyrr\cyrn\cyre\cyrn\cyrn\cyrya}" }
%<utf8>      { "{дата звернення}" }
      { curlanguage "russian" =
%<!utf8>         { "{\cyrd\cyra\cyrt\cyra\ \cyro\cyrb\cyrr\cyra\cyrshch\cyre\cyrn\cyri\cyrya}" }
%<utf8>         { "{дата обращения}" }
         { curlanguage "german" =
            { "{online; abgerufen}" }
            { "language is not defined: " language "urldate" * * warning$ "online; accessed" }
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.techreport}
%    \begin{macrocode}
FUNCTION {bbl.techreport} % rename to bbl.techreport
{ curlanguage "english" =
   { "Rep." }
   { curlanguage "german" =
      { "Bericht" }
      { curlanguage "russian" =
%<!utf8>         { "{\cyr\CYRO\cyrt\cyrch\cyre\cyrt}" }
%<utf8>         { "{Отчет}" }
         { "language is not defined: " language "techrep" * * warning$ "Rep." }
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.mthesis}
%    \begin{macrocode}
FUNCTION {bbl.mthesis}
{ curlanguage "english" =
   { "Master's thesis" }
   { curlanguage "german" =
      { "Diss.~Mag." }
      { curlanguage "russian" =
%<!utf8>        { "{\cyr\CYRK\cyrv\cyra\cyrl\cyri\cyrf\cyri\cyrk\cyra\cyrc\cyri"
%<!utf8>          "\cyro\cyrn\cyrn\cyra\cyrya\ \cyrr\cyra\cyrb\cyro\cyrt\cyra\ " *
%<!utf8>          "\cyrm\cyra\cyrg\cyri\cyrs\cyrt\cyrr\cyra}" * }
%<utf8>         { "{Квалификационная работа магистра}" }
         { "language is not defined: " language "mthesis" * * warning$ "Master's thesis" }
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.phdthesis}
%    \begin{macrocode}
FUNCTION {bbl.phdthesis}
{ curlanguage "english" =
   { "Ph.\,D. thesis" }
   { curlanguage "german" =
      { "Diss.~Ph.\,D." }
      { curlanguage "russian" =
%<!utf8>         { "{\cyr\CYRD\cyri\cyrs\cyrs\ldots\ \cyrk\cyra\cyrn\cyrd\cyri"
%<!utf8>           "\cyrd\cyra\cyrt\cyra\ \cyrn\cyra\cyru\cyrk}" * }
%<utf8>         { "{Дисс\ldots\ кандидата наук}" }
         { curlanguage "french" =
           { "Th\`{e}se de doctorat" }
           { "language is not defined: " language "phdthesis" * * warning$ "Ph.\,D. thesis" }
         if$}
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.dscithesis}
%    \begin{macrocode}
FUNCTION {bbl.dscithesis}
{ curlanguage "english" =
   { "Dr.\,Sci. dissertation" }
   { curlanguage "german" =
      { "Diss.~Dr." }
      { curlanguage "russian" =
%<!utf8>         { "{\cyr\CYRD\cyri\cyrs\cyrs\ldots\ \cyrd\cyro\cyrk\cyrt\cyro"
%<!utf8>           "\cyrr\cyra\ \cyrn\cyra\cyru\cyrk}" * }
%<utf8>         { "{Дисс\ldots\ доктора наук}" }
         { "language is not defined: " language "dscithesis" * * warning$ "Dr.\,Sci. dissertation" }
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.nnoaddress}
%    \begin{macrocode}
FUNCTION {bbl.nnoaddress}
{ curlanguage "english" =
   { "S.\ l." }
   { curlanguage "russian" =
%<!utf8>      { "{\cyr\CYRB.\ \cyrm.}" }
%<utf8>      { "{Б.\ м.}" }
      { "language is not defined: " language "nnoaddress" * * warning$ "S.\ l." }
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.nopublisher}
%    \begin{macrocode}
FUNCTION {bbl.nopublisher}
{ curlanguage "english" =
   { "s.\ n." }
   { curlanguage "russian" =
%<!utf8>      { "{\cyr\cyrb.\ \cyri.}" }
%<utf8>      { "{б.\ и.}" }
      { "language is not defined: " language "nnopublisher" * * warning$ "s.\ n." }
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.nnopublisher}
%    \begin{macrocode}
FUNCTION {bbl.nnopublisher}
{ curlanguage "english" =
   { "S.\ n." }
   { curlanguage "russian" =
%<!utf8>      { "{\cyr\CYRB.\ \cyri.}" }
%<utf8>      { "{Б.\ и.}" }
      { "language is not defined: " language "nnopublisher" * * warning$ "S.\ n." }
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.medium.text}
%    \begin{macrocode}
FUNCTION {bbl.medium.text}
{ curlanguage "english" =
   { "Text" }
   { curlanguage "russian" = curlanguage "ukrainian" = or
%<!utf8>      { "{\cyr\CYRT\cyre\cyrk\cyrs\cyrt}" }
%<utf8>      { "{Текст}" }
      { "language is not defined: " language "medium" * * warning$ "Text" }
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.medium.elres}
%    \begin{macrocode}
FUNCTION {bbl.medium.elres}
{ curlanguage "english" =
   { "Electronic resource" }
   { curlanguage "russian" =
%<!utf8>      { "{\cyr\CYREREV\cyrl\cyre\cyrk\cyrt\cyrr\cyro\cyrn\cyrn\cyrery\cyrishrt\ \cyrr\cyre\cyrs\cyru\cyrr\cyrs}" }
%<utf8>      { "{Электронный ресурс}" }
      { curlanguage "ukrainian" =
%<!utf8>        { "{\cyr\CYRE\cyrl\cyre\cyrk\cyrt\cyrr\cyro\cyrn\cyrn\cyri\cyrishrt\ \cyrr\cyre\cyrs\cyru\cyrr\cyrs}" }
%<utf8>        { "{Електронний ресурс}" }
        { "language is not defined: " language "medium" * * warning$ "Electronic resource" }
      if$}
   if$}
if$}


%    \end{macrocode}
% \DescribeFunction{bbl.chief}
%    \begin{macrocode}
FUNCTION {bbl.chief}
{ curlanguage "english" =
   { "chief" }
   { curlanguage "russian" =
%<!utf8>      { "\cyrr\cyru\cyrk." }
%<utf8>      { "{рук.}" }
      { curlanguage "ukrainian" =
%<!utf8>        { "\cyrr\cyru\cyrk." }
%<utf8>        { "{рук.}" }
        { "language is not defined: " language "chief" * * warning$ "chief" }
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.executor}
%    \begin{macrocode}
FUNCTION {bbl.executor}
{ curlanguage "english" =
   { "Executor" }
   { curlanguage "russian" =
%<!utf8>      { "{\cyr\cyri\cyrs\cyrp\cyro\cyrl\cyrn.}" }
%<utf8>      { "{исполн.}" }
      { curlanguage "ukrainian" =
%<!utf8>        { "{\cyr\cyrv\cyri\cyrk\cyro\cyrn\cyra\cyrv\cyre\cyrc\cyrsftsn}" }
%<utf8>        { "{виконавець}" }
        { "language is not defined: " language "medium" * * warning$ "Executor" }
      if$}
   if$}
if$}

%    \end{macrocode}
% \DescribeFunction{bbl.medium}
%    \begin{macrocode}
FUNCTION {bbl.medium}
{ type$ "online" =
   { bbl.medium.elres }
   { bbl.medium.text  }
if$}

%    \end{macrocode}
%
% \subsection{Formatting functions}
%
% Declare functions to format separate elements of bibliographic reference.
%    \begin{macrocode}
INTEGERS { nameptr namesleft numnames }


%    \end{macrocode}
%
% \DescribeFunction{format.names}
% Function |format.names| has 2 version.
% First is for bibliographic records rather then for bibliographic references.
% It is used for \file{.bst} styles compiled without the |modern| option.
% It format every name as `LastName, F. S.'.
% Historically, this version was used first for earlier styles included into
% GOST bundle.
%
% \textbf{Important note}
%
% Neither \file{bibtex} nor \file{bibtex8} can handle unicoded text without
% troubles. In particular, they fail to reduce a Cyrillic name to initials.
% Therefore we avoid using |f.| primitive when option |utf8| is in effect.

%    \begin{macrocode}
%<*!modern>
FUNCTION {format.names}
{
%<!utf8>  #1 "{vv~}{ll}{~jj}{,~f.}" format.name$
%<utf8>  #1 "{vv~}{ll}{~jj}{,~ff}" format.name$
}
%</!modern>
%    \end{macrocode}
% Second version drops comma from output so that every name is formatted
% as `LastName F. S.'. It also substitutes 4th and following names by
% localized term `et al'.
%    \begin{macrocode}
%<*modern>
FUNCTION {format.names}
{
  's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
%<!utf8>      "{vv~}{ll}{~jj}{~f.}" format.name$ 't :=
%<utf8>      "{vv~}{ll}{~jj}{~ff}" format.name$ 't :=
      nameptr #1 >
        { nameptr #4 =
          numnames #4 > and
            { "others" 't :=
              #1 'namesleft := }
            'skip$
          if$
          namesleft #1 >
            { ", " * t * }
            { t "others" =
	          t "~others" =
	          or
%<!strict>                { " " * bbl.etal * }
%<strict>                { " " * bbl.etal enclose.square.brackets *}
                { ", " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}
%</modern>

%    \end{macrocode}
% \DescribeFunction{format.lab.names}
% Declare function to go to optional argument of |\bibitem| in
% the styles generated with the option |natbib|.
%    \begin{macrocode}
%<*natbib>
FUNCTION {format.lab.names}
{ 's :=
  language empty$
    { "english" 'curlanguage := }
    { language  'curlanguage := }
  if$
  s #1 "{vv~}{ll}" format.name$
  s num.names$ duplicate$
  #2 >
    %{ pop$ " et~al." * }
    { pop$ " " bbl.etal * * }
    { #2 <
        'skip$
        { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            %{ " et~al." * }
            { " " bbl.etal * * }
            %{ " and " * s #2 "{vv~}{ll}" format.name$ * }
            { " " bbl.and " " * * * s #2 "{vv~}{ll}" format.name$ * }
          if$
        }
      if$
    }
  if$
}
%</natbib>

%    \end{macrocode}
% \DescribeFunction{format.names.rev}
% Declare function to format names for authors/bookauthors list after title and etc.
% Note that |format.names.rev| cuts list of names to at most 4 persons.
% We do not cut names to initials in this list.
%    \begin{macrocode}
FUNCTION {format.names.rev}
{
  's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
%<!utf8>      %"{f.}{~vv}{~ll}{, jj}" format.name$ 't :=
%<!utf8>      "{ff}{~vv}{~ll}{, jj}" format.name$ 't :=
%<utf8>      "{ff}{~vv}{~ll}{, jj}" format.name$ 't :=
      nameptr #1 >
        { nameptr #4 =
          numnames #4 > and
            { "others" 't :=
              #1 'namesleft := }
            'skip$
          if$
          namesleft #1 >
            { ", " * t * }
            { t "others" =
	          t "~others" =
	          or
%<!strict>                { " " * bbl.etal * }
%<strict>                { " " * bbl.etal enclose.square.brackets * }
                { ", " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

%    \end{macrocode}
% \DescribeFunction{format.key}
% Function to substitute empty field (usually, author name) with the |key| field.
%    \begin{macrocode}
%<*natbib>
FUNCTION {format.key}
{ empty$
    { key field.or.null }
    { "" }
  if$
}
%</natbib>

%    \end{macrocode}
% \DescribeFunction{format.authors}
%    \begin{macrocode}
FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names emphasize}
  if$
}

%    \end{macrocode}
% \DescribeFunction{author.key.label}
%    \begin{macrocode}
%<*natbib>
FUNCTION {author.key.label}
{ author empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
        { key empty$
            { cite$ #1 #3 substring$ }
            %'key          %% causes lost of year
            { "{}" key * } %% Bug in bibtex8 ??
          if$
        }
        { editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.key.organization.label}
{ author empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.organization.label
        { type$ "manual" =
            'author.key.organization.label
            'author.key.label
          if$
        }
      if$
    }
  if$
  'short.list :=
}

FUNCTION {calc.label}
{ calc.short.authors
  short.list
  "("
  *
  year duplicate$ empty$
  short.list key field.or.null = or
     { pop$ "" }
     'skip$
  if$
  *
  'label :=
}

%</natbib>

%    \end{macrocode}
% \DescribeFunction{format.bookauthors}
% This function is used only once, in |bookauthor.before|, and the latter is
% used only in |inbook| entry.
%    \begin{macrocode}
FUNCTION {format.bookauthors}
{ bookauthor empty$
    { "" }
    { bookauthor format.names}
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.authors.after}
%    \begin{macrocode}
FUNCTION {format.authors.after}
{ author empty$
    { "" }
    { author format.names.rev}
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.bookauthors.after}
%    \begin{macrocode}
FUNCTION {format.bookauthors.after}
{ bookauthor empty$
    { "" }
    { bookauthor format.names.rev}% always cuts to 4 persons
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.editors.after}
%    \begin{macrocode}
FUNCTION {format.editors.after}
{ editor empty$
    { "" }
    { bbl.edby "\ " * editor format.names.rev * }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.chief.after}
%    \begin{macrocode}
FUNCTION {format.chief.after}
{ editor empty$
    { "" }
    { bbl.chief "\ " * editor format.names.rev * }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.executor.after}
%    \begin{macrocode}
FUNCTION {format.executor.after}
{ author empty$
    { "" }
    { bbl.executor ": " * author format.names.rev * }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.compiler.after}
%    \begin{macrocode}
FUNCTION {format.compiler.after}
{ compiler empty$
    { "" }
    { bbl.cmplr "\ " * compiler format.names.rev * }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.title}
% \textbf{Important note}
% \
% Neither \file{bibtex} nor \file{bibtex8} can handle unicoded text without
% troubles. In particular, \file{bibtex8} fails to change case of a string if it
% contains Cyrillic letter. Therefore we avoid using |change.case$| when
% option |utf8| is in effect.
%    \begin{macrocode}
FUNCTION {format.title}
{ title empty$
    { "" }
%<!utf8>    { title "t" change.case$ }
%<utf8>    { title }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.date}
%    \begin{macrocode}
FUNCTION {format.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$
          month
        }
      if$
    }
    { month empty$
        'year
%<!modern>        { year ". " quote$ "--- " month * * * * }
%<modern>        { year ". \BibDash " month * * }
      if$
    }
  if$
%<natbib>  extra.label * % new in v.1.2
}

%    \end{macrocode}
% \DescribeFunction{format.address.publisher}
% \DescribeFunction{format.address.publisher.date}
%    \begin{macrocode}
%<*!strict>
FUNCTION {output.address.publisher}
{
  address empty$
    'skip$
    { address output
      publisher empty$
        'skip$
        { new.column }
      if$
    }
  if$
  publisher output
}
%</!strict>
%<*strict>
%FUNCTION {output.address.publisher}
%{
%  address empty$
%    {
%      bbl.nnoaddress
%      publisher empty$
%        { "~: " * bbl.nopublisher *  }
%        { }
%      if$
%      enclose.square.brackets
%    }
%    {
%      address output
%      new.column
%      publisher empty$
%        { bbl.nopublisher enclose.square.brackets }
%        { publisher }
%      if$
%    }
%  if$
%  output
%}
FUNCTION {output.address.publisher}
{
  address empty$
    {
      bbl.nnoaddress
      publisher empty$
        { "~: " * bbl.nopublisher * enclose.square.brackets }
        { enclose.square.brackets "~: " * publisher * }
      if$
    }
    {
      address output
      new.column
      publisher empty$
        { bbl.nopublisher enclose.square.brackets }
        { publisher }
      if$
    }
  if$
  output
}

%</strict>

%    \end{macrocode}
% \DescribeFunction{output.address.publisher.date}
% |Otput.address.publisher.date| is used in old styles.
% New styles use |output.address.publisher|.
%    \begin{macrocode}
%<*!(modern|strict)>
FUNCTION {output.address.publisher.date}
{
  output.address.publisher
  format.date output
}
%</!(modern|strict)>

%    \end{macrocode}
% \DescribeFunction{output.bibitem}
%    \begin{macrocode}
%<*!natbib>
FUNCTION {output.bibitem}
{ newline$
  "\bibitem" write$
  cite$ bracify write$
  newline$
  language empty$
    { "english" 'curlanguage := }
    { language  'curlanguage := }
  if$
  "\selectlanguageifdefined" curlanguage bracify * write$
  newline$
  ""
  before.all 'output.state :=
}
%</!natbib>
%    \end{macrocode}
% \DescribeFunction{format.full.names}
% \DescribeFunction{author.full}
% \DescribeFunction{editor.full}
% \DescribeFunction{author.editor.full}
% \DescribeFunction{make.full.names}
% \DescribeFunction{output.bibitem}
% In case of |natbib| option, we need |make.full.names| to compose
% |output.bibitem|, and the latter in its turn requires some more functions.
%    \begin{macrocode}
%<*natbib>
FUNCTION {format.full.names}
{'s :=
  language empty$
    { "english" 'curlanguage := }
    { language  'curlanguage := }
  if$
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      "{vv~}{ll}" format.name$ 't :=
      nameptr #1 >
        {
          namesleft #1 >
            { ", " * t * }
            {
              numnames #2 >
              curlanguage "english" =
              and
                { "," * }
                'skip$
              if$
              t "others" =
	          %t "~others" =
	          %or
                %{ " et~al." * }
                { " " bbl.etal * * }
                %{ " and " * t * }
                { " " bbl.and " " * * * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {author.full}
{ author empty$
    { "" }
    { author format.full.names }
  if$
}

FUNCTION {editor.full}
{ editor empty$
    { "" }
    { editor format.full.names }
  if$
}

FUNCTION {author.editor.full}
{ author empty$
    { editor empty$
        { "" }
        { editor format.full.names }
      if$
    }
    { author format.full.names }
  if$
}

FUNCTION {make.full.names}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.full
    { type$ "proceedings" =
        'editor.full
        'author.full
      if$
    }
  if$
}

% =======================================
FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  label write$
  ")" make.full.names duplicate$ short.list =
     { pop$ }
     { * }
   if$
  "]{" * write$
  cite$ write$
  "}" write$
  language empty$
    { "english" 'curlanguage := }
    {language  'curlanguage := }
  if$
  "\selectlanguageifdefined" curlanguage bracify * write$
  newline$
  ""
  before.all 'output.state :=
}
% =======================================
%FUNCTION {output.bibitem}
%{ newline$
%  "\bibitem" write$
%%  author.key.label
%%  year parenthesify *
%%  "; lbl:" label * *
%%  "; mfn:"  make.full.names * *
%  label
%  make.full.names *
%  bracketise write$
%  cite$ bracify write$
%  newline$
%  language empty$
%    { "english" 'curlanguage := }
%    {language  'curlanguage := }
%  if$
%  "\selectlanguageifdefined" curlanguage bracify * write$
%  newline$
%  ""
%  before.all 'output.state :=
%}
% =======================================
%</natbib>

%    \end{macrocode}
% \DescribeFunction{n.dashify}
%    \begin{macrocode}
FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
        { t #1 #2 substring$ "--" = not
            { "--" *
              t #2 global.max$ substring$ 't :=
            }
            {   { t #1 #1 substring$ "-" = }
                { "-" *
                  t #2 global.max$ substring$ 't :=
                }
              while$
            }
          if$
        }
        { t #1 #1 substring$ *
          t #2 global.max$ substring$ 't :=
        }
      if$
    }
  while$
}

%    \end{macrocode}
% \DescribeFunction{word.in}
%    \begin{macrocode}
FUNCTION {word.in}
{ bbl.iin
  " " * }

%    \end{macrocode}
% \DescribeFunction{format.btitle}
%    \begin{macrocode}
FUNCTION {format.btitle}
{ title
}

%    \end{macrocode}
% \DescribeFunction{tie.or.space.connect}
%    \begin{macrocode}
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}

%    \end{macrocode}
% \DescribeFunction{tie.connect}
% Declare function to insert unbreakable space before last word in stack.
%    \begin{macrocode}
FUNCTION {tie.connect}
 {"~"
  swap$ * *
 }


%    \end{macrocode}
% \DescribeFunction{either.or.chec}
%    \begin{macrocode}
FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.bvolume}
%    \begin{macrocode}
FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { bbl.vvol volume tie.connect
      series empty$
        'skip$
        { bbl.of space.word * series emphasize * }
      if$
      "volume and number" number either.or.check
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.number.series}
%    \begin{macrocode}
FUNCTION {format.number.series}
{ volume empty$
    { number empty$
        { series field.or.null }
        { series empty$
            { "there's a number but no series in " cite$ * warning$
              bbl.nnr }
            {
              %new.dblslash
              new.sentence
              series
              bbl.nr
              tie.or.space.connect}
          if$
          number tie.or.space.connect
        }
      if$
    }
    { "" }
  if$
}

%    \end{macrocode}
% \DescribeFunction{is.num}
%    \begin{macrocode}
FUNCTION {is.num}
{ chr.to.int$
  duplicate$ "0" chr.to.int$ < not
  swap$ "9" chr.to.int$ > not and
}

%    \end{macrocode}
% \DescribeFunction{extract.num}
%    \begin{macrocode}
FUNCTION {extract.num}
{ duplicate$ 't :=
  "" 's :=
  { t empty$ not }
  { t #1 #1 substring$
    t #2 global.max$ substring$ 't :=
    duplicate$ is.num
      { s swap$ * 's := }
      { pop$ "" 't := }
    if$
  }
  while$
  s empty$
    'skip$
    { pop$ s }
  if$
}

%<*debug>
%    \end{macrocode}
% \DescribeFunction{eng.ord}
%    \begin{macrocode}
FUNCTION {eng.ord}
{ duplicate$ "1" swap$ *
  #-2 #1 substring$ "1" =
     { bbl.th * }
     { duplicate$ #-1 #1 substring$
       duplicate$ "1" =
         { pop$ bbl.st * }
         { duplicate$ "2" =
             { pop$ bbl.nd * }
             { "3" =
                 { bbl.rd * }
                 { bbl.th * }
               if$
             }
           if$
          }
       if$
     }
   if$
}
%</debug>

%    \end{macrocode}
% \DescribeFunction{convert.edition}
%    \begin{macrocode}
FUNCTION {convert.edition}
{ edition
% edition extract.num "l" change.case$ 's :=
%  s "first" = s "1" = or
%    { bbl.first 't := }
%    { s "second" = s "2" = or
%        { bbl.second 't := }
%        { s "third" = s "3" = or
%            { bbl.third 't := }
%            { s "fourth" = s "4" = or
%                { bbl.fourth 't := }
%                { s "fifth" = s "5" = or
%                    { bbl.fifth 't := }
%                    { s #1 #1 substring$ is.num
%                        { s eng.ord 't := }
%                        { edition 't := }
%                      if$
%                    }
%                  if$
%                }
%              if$
%            }
%          if$
%        }
%      if$
%    }
%  if$
%  t
}

%    \end{macrocode}
% \DescribeFunction{format.edition}
%    \begin{macrocode}
FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
%<!utf8>        { convert.edition "l" change.case$ " " * bbl.edition * }
%<!utf8>        { convert.edition "t" change.case$ " " * bbl.edition * }
%<utf8>        { convert.edition " " * bbl.edition * }
%<utf8>        { convert.edition " " * bbl.edition * }
      if$
    }
  if$
}

INTEGERS { multiresult }

%    \end{macrocode}
% \DescribeFunction{multi.page.check}
%    \begin{macrocode}
FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

%    \end{macrocode}
% \DescribeFunction{format.pages}
%    \begin{macrocode}
FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
        { bbl.ppages pages n.dashify tie.connect }
        { bbl.ppage pages tie.connect }
      if$
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.pages.page}
%    \begin{macrocode}
FUNCTION {format.pages.page}
{ pages empty$
    { numpages empty$
      { "" }
      { numpages bbl.pages tie.connect }
    if$}
    { format.pages}
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.vol.num.pages}
%    \begin{macrocode}
FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    {
      ", no." number tie.or.space.connect *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { ": " * pages n.dashify * }
      if$
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.volume}
%    \begin{macrocode}
FUNCTION {format.volume}
{ volume empty$
    { "" }
    { bbl.vvol volume tie.or.space.connect }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.number}
%    \begin{macrocode}
FUNCTION {format.number}
{ number empty$
    { "" }
    { bbl.nr number tie.or.space.connect }
  if$
}

%<*debug>
%    \end{macrocode}
% \DescribeFunction{format.chapter.pages}
%    \begin{macrocode}
FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.pages
    { type empty$
        { bbl.chapter }
        { type "l" change.case$ }
      if$
      chapter tie.or.space.connect
      pages empty$
        'skip$
        { ", " * format.pages * }
      if$
    }
  if$
}
%</debug>

%    \end{macrocode}
% \DescribeFunction{empty.misc.check}
%    \begin{macrocode}
FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
  key empty$ not and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.thesis.type}
%    \begin{macrocode}
FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
%<!utf8>      type "t" change.case$
%<utf8>      type
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.techrep.type.number}
% Function to format report type and number.
%    \begin{macrocode}
%FUNCTION {format.techrep.type.number}
%{ type empty$
%    { bbl.techreport }
%    'type
%  if$
%  number empty$
%%<!utf8>    { "t" change.case$ }
%%<utf8>    { "" }
%    { number tie.or.space.connect }
%  if$
%}

FUNCTION {format.techreport.type}
{ type empty$
   { bbl.techreport }
   'type
  if$
}

%    \end{macrocode}
%
% \DescribeFunction{author.before}
% Declare the function |author.before| to format list
% of authors in heading of a bibliographic record.
% If the number of authors is 4 or larger, some styles skip
% the list of authors in the beginning of the bibliographic
% record, while other styles always print that list.
% So, we need two version of |author.before|.
%
% First version is used if \file{.bst} style is compiled without option
% |long|. It skips authors if their number is greater than or equal to 4
% or if the author field is empty. Note that GOST requires for a long list of
% authors to be reduced. Hence this first version is preferable.
% Note also that |format.names|  cuts list of names
% to 4 person at most in case if |modern| option is used. and |format.authors|
% just emphasizes |format.names|.
%    \begin{macrocode}
%<*!long>
FUNCTION {author.before}
{
  author empty$
    'skip$
    {author num.names$ #4 <
      {format.authors output
       new.sentence}
      'skip$
    if$}
  if$
}
%</!long>
%    \end{macrocode}
% Second version is used if \file{.bst} style is compiled with the option
% |long|. It skips only if the author field is empty.
%    \begin{macrocode}
%<*long>
FUNCTION {author.before}
{
  author empty$
    'skip$
    { format.authors output
      new.sentence
    }
  if$
}
%</long>

%    \end{macrocode}
% \DescribeFunction{bookauthor.before}
% There are also 2 version of the function |bookauthor.before|.
% Not used anymore!
%    \begin{macrocode}
%%<*!long>
%%FUNCTION {bookauthor.before}
%%{
%%  bookauthor empty$
%%    'skip$
%%    {bookauthor num.names$ #4 <
%%      {format.bookauthors output
%%       new.sentence}
%%      'skip$
%%    if$}
%%  if$
%%}
%%</!long>
%%<*long>
%%FUNCTION {bookauthor.before}
%%{
%%  bookauthor empty$
%%    'skip$
%%    { format.bookauthors output
%%      new.sentence
%%    }
%%  if$
%%}
%%</long>

%    \end{macrocode}
%
% \DescribeFunction{author.after}
% Functions |author.after| and |bookauthor.after| also have by 2 versions.
% They are used to write authors list after the title followed by a slash.
% In modern styles, compiled with option |modern|, the list of authors is
% always cut to at most 4 persons. The cut is performed first by
% |format.names.rev|, which is called by |format.authors.after|. For old styles,
% |author.after| just outputs formatted string whereas for new style it
% skips the string if the number of authors exceeds 3 (and author list is not
% printed before the title).
%    \begin{macrocode}
%<*!modern>
FUNCTION {author.after}
{
  author empty$
    'skip$
    {format.authors.after output
       new.semicolumn }
  if$
}
%</!modern>
%<*modern>
%<*!long>
FUNCTION {author.after}
{
  author empty$
    'skip$
    {author num.names$ #3 >
      {format.authors.after output
       new.semicolumn }
      'skip$
    if$}
  if$
}
%</!long>
%<*long>
FUNCTION {author.after} { }
%</long>
%</modern>

%    \end{macrocode}
% \DescribeFunction{bookauthor.after}
% This function is used only in |inbook| entry. It always cuts list to 4 persons
% since |format.bookauthors.after| does that.
%    \begin{macrocode}
FUNCTION {bookauthor.after}
{
  bookauthor empty$
    'skip$
    {format.bookauthors.after output
       new.semicolumn }
  if$
}

%    \end{macrocode}
% \DescribeFunction{editor.organization.after}
%    \begin{macrocode}
FUNCTION {editor.organization.after}
{
  compiler empty$
    {}
    { format.compiler.after  output
    new.semicolumn
    }
  if$
  editor empty$
    {}
    { format.editors.after  output
    new.semicolumn
    }
  if$
  organization empty$
    {}
    {organization output
    new.semicolumn
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.url}
%    \begin{macrocode}
FUNCTION {format.url}
{ url empty$
    { "" }
    {
%<!(modern|strict)>      "\BibUrl{ " url * "}" *
%<modern|strict>      "URL: \BibUrl{" url * "}" *
      urldate empty$
        { "" }
        { " (" bbl.urldate * ": " * urldate * ")" * }
      if$ *
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.annote}
%    \begin{macrocode}
FUNCTION {format.annote}
{ annote empty$
    { "" }
	{ after.sentence 'output.state :=
	  "\BibAnnote{" annote add.period$ * "}" *
	}
  if$
}

%    \end{macrocode}
% \DescribeFunction{format.isbn}
% Do we really need to provide electronic search for ISNB?
%    \begin{macrocode}
FUNCTION {format.isbn}
{
  isbn empty$
    { "" }
    { "ISBN:~\href{http://isbndb.com/search-all.html?kw=" isbn *
      "}{" * isbn * "}" *
    }
  if$
}

%    \end{macrocode}
% \DescribeFunction{add.doi}
% The Digital Object Identifier (DOI) System is for identifying content
% objects in the digital environment. DOI names are assigned to any entity
% for use on digital networks. They are used to provide current information,
% including where they (or information about them) can be found on the
% Internet. Information about a digital object may change over time,
% including where to find it, but its DOI name will not change.
%
% Function |add.doi| embraces last string in stack into hyperlink
% that links it to specified |doi| identificator at http://dx.doi.org/ web-site.
%    \begin{macrocode}
%<*eprint>
FUNCTION {add.doi}
{ duplicate$ empty$
    'skip$
    { doi empty$
        'skip$
        { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * }
      if$
    }
  if$
}
%</eprint>
%    \end{macrocode}
% If \file{.bst} style is compiled without |eprint| option, we just ignore
% |doi| field.
%    \begin{macrocode}
%<*!eprint>
FUNCTION {add.doi} { }
%</!eprint>

%    \end{macrocode}
% \DescribeFunction{add.medium}
% New in version 2.
%    \begin{macrocode}
%<*!strict>
FUNCTION {add.medium} { }
%</!strict>
%<*strict>
FUNCTION {add.medium}
{ duplicate$ empty$
    'skip$
    { medium empty$
        { " " * bbl.medium enclose.square.brackets * }
        { " " * medium enclose.square.brackets * }
%%        { bbl.medium enclose.square.brackets * }
%%        { medium enclose.square.brackets * }
      if$
    }
  if$
}
%</strict>

%    \end{macrocode}
%
% \subsection{Electronic Publishing Information}
%
% The biblatex package provides three fields for electronic publishing
% information: |eprint|, |eprinttype|, and |eprintclass|. The |eprint| field
% is a verbatim field similar to |doi| which holds the identifier of the item.
% The |eprinttype| field holds the resource name, i. e., the name of the
% site or electronic archive. The optional |eprintclass| field is intended
% for additional information specific to the resource indicated by the
% |eprinttype| field. This could be a section, a path, classification
% information, etc. If the |eprinttype| field is available, the standard styles
% will use it as a literal label. In the following example, they would print
% ``Resource: identifier'' rather than the generic ``eprint: identifier'':
% \begin{verbatim}
% eprint = {identifier},
% eprinttype = {Resource},
% \end{verbatim}
%
% \DescribeFunction{format.eprint}
% The electronic identifier of an online publication.
% This is roughly comparable to a |doi| but specific to a certain archive,
% repository, service, or system.
% Also see eprinttype and eprintclass.
%
% This function should use url. TO BE DONE YET.
%    \begin{macrocode}
%<*eprint>
%FUNCTION {format.eprint}
%{ eprint empty$
%   { "" }
%   { eprintclass empty$
%      { " \href{http://arxiv.org/abs/" eprint * "}" * "{" * eprint * "}" * }
%      { eprinttype empty$
%         { " \href{http://arxiv.org/abs/" eprint * "}" *
%      	   "{" * eprintclass * "/" * eprint * "}" *
%         }
%         { " \href{http://arxiv.org/abs/" eprint * "}" *
%      	   "{" * eprinttype * ":" * eprintclass * "/" * eprint * "}" *
%         }
%      if$}
%   if$}
%if$}

%FUNCTION {format.eprint}
%{ eprint empty$
%   { "" }
%   { eprinttype empty$
%       { "" }
%       { eprinttype "~: " *}
%     if$
%     eprintclass empty$
%       { }
%       { eprintclass * "/" *}
%    if$
%    eprint *
%   }
%  if$
%  url empty$
%    { }
%    { "\href{" url * "}{" * swap$ * "}" *}
%  if$
%}

FUNCTION {format.eprint}
{ eprint empty$
   { "" }
   { eprinttype empty$
       { "" }
       { eprinttype "~: " *}
     if$
     eprintclass empty$
       { }
       { eprintclass * "/" *}
     if$
     url empty$
      { eprint * }
      { "\href{" * url * "}{" * eprint * "}" *}
    if$
   }
  if$
}

FUNCTION {output.eprint.url}
{
  eprint empty$
    { format.url output }
    { format.eprint output }
  if$
}

%</eprint>

%<*!eprint>
FUNCTION {output.eprint.url}
{
    format.url output
}
%</!eprint>

%    \end{macrocode}
%
% \subsection{Entry types}
%
% Text below in this section is borrowed from biblatex manual. Not every
% field listed below is actually supported by GOST styles. So description
% below should be considered as a goal or a feature request.
%
% The lists below indicate the fields supported by each entry type.
% Note that the mapping of fields to an entry type is ultimately at the
% discretion of the bibliography style. The lists below therefore serve
% two purposes. They indicate the fields supported by the standard styles
% which ship with this package and they also serve as a model for custom
% styles. Note that the required fields are not strictly required
% in all cases. The fields marked as optional
% are optional in a technical sense. Bibliographical formatting rules
% usually require more than just the required fields. The standard
% styles will generally not perform any formal validity checks, but
% custom styles may do so. Generic fields like abstract and annotation
% or label and shorthand are not included in the lists below because they
% are independent of the entry type.
%
% \subsubsection{Regular Types}
%
% \DescribeFunction{article}
%  An article in a journal, magazine, newspaper, or other periodical which forms a
%  self-contained unit with its own title. The title of the periodical is given in the
%  journaltitle field. If the issue has its own title in addition to the main title of
%  the periodical, it goes in the issuetitle field. Note that editor and related fields
%  refer to the journal while translator and related fields refer to the article.
%
%  Required fields: author, title, journaltitle, year/date.
%
%  Optional fields: translator, annotator, commentator, subtitle, titleaddon,
%  editor, editora, editorb, editorc, journalsubtitle, issuetitle,
%  issuesubtitle, language, origlanguage, series, volume, number, eid, issue,
%  month, pages, version, note, issn, addendum, pubstate, doi, eprint,
%  eprintclass, eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {article}
{
  output.bibitem
  author.before
%<natbib>  author format.key output
  format.title add.medium "title" output.check
  new.slash
  author.after
  new.dblslash
  journal emphasize add.doi "journal" output.check % new in v.2
  new.block
  format.date "year" output.check
  new.block
  format.volume output
  format.number output
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{book}
% A single-volume book with one or more authors where the authors share credit for
% the work as a whole. In biblatex, this entry type also covers the function
% of the |@inbook| type of traditional BibTeX.
%
% Required fields: author, title, year/date.
%
% Optional fields: editor, editora, editorb, editorc, translator, annotator,
% commentator, introduction, foreword, afterword, subtitle, titleaddon,
% maintitle, mainsubtitle, maintitleaddon, language, origlanguage, volume,
% part, edition, volumes, series, number, note, publisher, location, isbn,
% chapter, pages, pagetotal, addendum, pubstate, doi, eprint, eprintclass,
% eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {book}
{
  output.bibitem
  author.before
%<natbib>  author format.key output
  format.btitle add.doi add.medium "title" output.check
  new.slash
  author.after
  editor.organization.after
  new.sentence
  format.number.series output
  new.block
  format.edition output
  new.block
  output.address.publisher
  format.date "year" output.check
  new.block
  format.bvolume output
  new.block
  format.pages.page output
  new.block
%<eprint>  format.isbn output
%<eprint>  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{booklet}
% A book-like work without a formal publisher or sponsoring institution. Use the
% field howpublished to supply publishing information in free format, if applicable.
% The field type may be useful as well.
%
% Required fields: author/editor, title, year/date.
%
% Optional fields: subtitle, titleaddon, language, howpublished, type, note,
% location, chapter, pages, pagetotal, addendum, pubstate, doi, eprint,
% eprintclass, eprinttype, url, urldate.
%
%    \begin{macrocode}
FUNCTION {booklet}
{
  output.bibitem
  author.before
%<natbib>  author format.key output
  format.title add.doi add.medium "title" output.check
  new.slash
  author.after
  editor.organization.after
  new.block
  howpublished output
  address output
  format.date "year" output.check
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{inbook}
% A part of a book which forms a self-contained unit with its own title.
% Note that the profile of this entry type is different from standard BibTeX.
%
% Required fields: author, title, booktitle, year/date.
%
% Optional fields: bookauthor, editor, editora, editorb, editorc, translator,
% annotator, commentator, introduction, foreword, afterword, subtitle,
% titleaddon, maintitle, mainsubtitle, maintitleaddon, booksubtitle,
% booktitleaddon, language, origlanguage, volume, part, edition, volumes,
% series, number, note, publisher, location, isbn, chapter, pages, addendum,
% pubstate, doi, eprint, eprintclass, eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {inbook}
{
  output.bibitem
  author.before
%<natbib>  author format.key output
  format.btitle add.doi add.medium "title" output.check
  new.slash
  author.after
  new.dblslash
%  bookauthor.before
  booktitle "booktitle" output.check
  new.slash
  bookauthor.after
  editor.organization.after
  new.block
  format.edition output
  new.block
  format.number.series output
  new.sentence
  output.address.publisher
  format.date "year" output.check
  new.block
  format.bvolume output
  new.block
  format.pages.page output
  new.block
%<eprint>  format.isbn output
%<eprint>  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{incollection}
% A contribution to a collection which forms a self-contained unit with a distinct
% author and title. The author refers to the title, the editor to the booktitle,
% i. e., the title of the collection.
%
% Required fields: author, editor, title, booktitle, year/date.
%
% Optional fields: editora, editorb, editorc, translator, annotator,
% commentator, introduction, foreword, afterword, subtitle, titleaddon,
% maintitle, mainsubtitle, maintitleaddon, booksubtitle, booktitleaddon,
% language, origlanguage, volume, part, edition, volumes, series, number,
% note, publisher, location, isbn, chapter, pages, addendum, pubstate, doi,
% eprint, eprintclass, eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {incollection}
{
  output.bibitem
  author.before
%<natbib>  author format.key output
  new.sentence
  format.title add.doi add.medium "title" output.check
  new.slash
  author.after
  new.dblslash
  booktitle "booktitle" output.check
  new.slash
  editor.organization.after
  new.block
  output.address.publisher
  format.date "year" output.check
  new.block
  format.bvolume output
  format.number.series output
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
%
% \DescribeFunction{proceedings}
% A single-volume conference proceedings. This type is very similar to @collection.
% It supports an optional organization field which holds the sponsoring institution.
% The editor is omissible.
%
% Required fields: editor, title, year/date.
%
% Optional fields: subtitle, titleaddon, maintitle, mainsubtitle,
% maintitleaddon, eventtitle, eventdate, venue, language, volume, part,
% volumes, series, number, note, organization, publisher, location, month,
% isbn, chapter, pages, pagetotal, addendum, pubstate, doi, eprint,
% eprintclass, eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {proceedings}
{
  output.bibitem
%<natbib>  editor format.key output
  format.btitle add.doi add.medium "title" output.check
  new.slash
  editor.organization.after
  new.block
  format.bvolume output
  format.number.series output
%  address empty$
%    { publisher output
%      format.date "year" output.check
%    }
%    { address output.nonnull
%      format.date "year" output.check
%      new.sentence
%      publisher output
%    }
%  if$
  output.address.publisher
  format.date "year" output.check
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{inproceedings}
% An article in a conference proceedings. This type is similar to @incollection. It
% supports an optional organization field.
%
% Required fields: author, editor, title, booktitle, year/date.
%
% Optional fields: subtitle, titleaddon, maintitle, mainsubtitle,
% maintitleaddon, booksubtitle, booktitleaddon, eventtitle, eventdate,
% venue, language, volume, part, volumes, series, number, note, organization,
% publisher, location, month, isbn, chapter, pages, addendum, pubstate, doi,
% eprint, eprintclass, eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {inproceedings}
{ output.bibitem
  author.before
%<natbib>  author format.key output
  new.sentence
  format.title add.doi add.medium "title" output.check
  new.slash
  author.after
  new.dblslash
  booktitle "booktitle" output.check
  new.slash
  editor.organization.after
  new.block
  format.bvolume output
  format.number.series output
  new.block
%  address empty$
%    { publisher output
%      format.date "year" output.check
%    }
%    { address output.nonnull
%      new.column
%      publisher output
%      format.date "year" output.check
%    }
%  if$
  output.address.publisher
  format.date "year" output.check
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{manual}
% Technical or other documentation, not necessarily in printed form. The author or
% editor is omissible.
%
% Required fields: author/editor, title, year/date.
%
% Optional fields: subtitle, titleaddon, language, edition, type, series,
% number, version, note, organization, publisher, location, isbn, chapter,
% pages, pagetotal, addendum, pubstate, doi, eprint, eprintclass,
% eprinttype, url, urldate.
%    \begin{macrocode}
FUNCTION {manual}
{ output.bibitem
  author empty$
    { organization empty$
        'skip$
        { organization output.nonnull
          address output
        }
      if$
    }
    { format.authors output.nonnull }
  if$
%<natbib>  author format.key output
  new.block
  format.btitle add.doi add.medium "title" output.check
  author empty$
    { organization empty$
    {
          address new.block.checka
          address output
        }
        'skip$
      if$
    }
    {
      organization address new.block.checkb
      organization output
      address output
    }
  if$
  format.edition output
  format.date "year" output.check
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{misc}
% A fallback type for entries which do not fit into any other category. Use the field
% howpublished to supply publishing information in free format, if applicable. The
% field type may be useful as well. author, editor, and year are omissible.
%
% Required fields: author/editor, title, year/date.
%    \begin{macrocode}
FUNCTION {misc}
{ output.bibitem
  format.authors output
%<natbib>  author format.key output
  title howpublished new.sentence.checkb
  format.title add.medium output
  howpublished new.block.checka
  howpublished output
  new.block
  format.date "year" output.check
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{unpublished}
% A work with an author and a title which has not been formally published, such
% as a manuscript or the script of a talk. Use the fields howpublished and note to
% supply additional information in free format, if applicable.
%
% Required fields: author, title, year/date.
%
% Optional fields: subtitle, titleaddon, language, howpublished, note,
% location, isbn, date, month, year, addendum, pubstate, url, urldate
%    \begin{macrocode}
FUNCTION {unpublished}
{ output.bibitem
  author.before
%<natbib>  author format.key output
  format.btitle "title" output.check
  new.slash
  author.after
  editor.organization.after
  new.block
  format.date "year" output.check
  new.block
  note "note" output.check
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}

%    \end{macrocode}
% \DescribeFunction{online}
% An online resource. Author, editor, and year are omissible.
% This entry type is intended for sources such as web sites which are intrinsically
% online resources. Note that all entry types support the url field. For example,
% when adding an article from an online journal, it may be preferable to use the
% |@article| type and its url field.
%
% Required fields: author/editor, title, year/date, url.
%
% Optional fields: subtitle, titleaddon, language, version, note,
% organization, date, month, year, addendum, pubstate, urldate.
%    \begin{macrocode}
FUNCTION {online}
{ output.bibitem
  format.authors output
%<natbib>  author format.key output
  title howpublished new.sentence.checkb
  format.title add.doi add.medium "title" output.check
%  howpublished new.block.checka
  howpublished new.dblslash.checka
  howpublished enclose.square.brackets output
  editor.organization.after
  new.sentence
  new.block
  output.address.publisher
  format.date output
  new.block
%  format.url output
  output.eprint.url
  new.sentence
  note output
  format.annote output
  fin.entry
}

%    \end{macrocode}
%
% \DescribeFunction{internet}
% \DescribeFunction{www}
% \DescribeFunction{webpage}
% \DescribeFunction{ielectronic}
% New in version 2012.02.15.
%    \begin{macrocode}
FUNCTION {internet}   {online}
FUNCTION {www}        {online}
FUNCTION {webpage}    {online}
FUNCTION {electronic} {online}
%    \end{macrocode}
%
% \DescribeFunction{thesis}
% New in version 2012.02.02.
%
% A thesis written for an educational institution to satisfy the requirements for a
% degree. Use the type field to specify the type of thesis.
%
% Required fields: author, title, type, institution, year/date.
%
% Optional fields: subtitle, titleaddon, language, note, location, month, isbn,
% chapter, pages, pagetotal, addendum, pubstate, doi, eprint, eprintclass,
% eprinttype, url, urldate
%
%    \begin{macrocode}
%<*!(modern|strict)>
FUNCTION {thesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle "title" output.check
  new.column
  bbl.phdthesis format.thesis.type output.nonnull
  new.slash
  school "school" output.check
  new.block
  output.address.publisher.date
  new.block
  format.pages.page output
  note output
  new.sentence
  format.url output
  format.annote output
  fin.entry
}
%</!(modern|strict)>
%<*modern|strict>
FUNCTION {thesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle add.doi add.medium "title" output.check
  new.column
%  bbl.phdthesis format.thesis.type output.nonnull
  type "type" output.check
  new.column
  number output
  new.slash
  format.authors.after output
  new.semicolumn
  school "school" output.check
  new.block
  output.address.publisher
  format.date "year" output.check
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}
%</modern|strict>

%    \end{macrocode}
%
% \DescribeFunction{report}
% New in version 2012.02.02.
%
% A technical report, research report, or white paper published by a university or
% some other institution. Use the type field to specify the type of report. The sponsoring
% institution goes in the institution field.
%
% Required fields: author, title, type, institution, year/date.
%
% Optional fields: subtitle, titleaddon, language, number, version, note,
% location, month, isrn, chapter, pages, pagetotal, addendum, pubstate, doi,
% eprint, eprintclass, eprinttype, url, urldate.
%    \begin{macrocode}
%FUNCTION {report}
%{
%  output.bibitem
%  author.before
%  new.sentence
%  format.title add.doi add.medium "title" output.check
%  new.column
%%  format.techrep.type.number output.nonnull
%  type "type" output.check
%  new.slash
%  author.after
%  editor.organization.after
%  new.block
%  address output
%  new.column
%  institution "institution" output.check
%  format.date "year" output.check
%  new.block
%  note output
%  new.block                % v.2
%  format.pages.page output % v.2
%  new.sentence
%%  format.url output
%  output.eprint.url
%  format.annote output
%  fin.entry
%}
FUNCTION {report}
{
  output.bibitem
%  author.before
%  new.sentence
  format.title add.doi add.medium "title" output.check
%<natbib>  title format.key output
  new.column
%  format.techrep.type.number output.nonnull
%  type "type" output.check
%  format.report.type.number "type" output.check
  type "type" output.check
  new.column
  number output
  new.slash
  institution "institution" output.check
  new.semicolumn
  format.chief.after output % from editor field
  new.semicolumn
  format.executor.after output % from author field
  new.block
  address output
  new.column
  organization output
  format.date "year" output.check
  new.block                % v.2
  format.pages.page output % v.2
  new.sentence % или new.block ?
  output.eprint.url
  new.block
  note output
  format.annote output
  fin.entry
}

%    \end{macrocode}
%
% \subsubsection{Type Aliases}
%
% The entry types listed in this section are provided for backwards compatibility
% with traditional BibTeX styles. These aliases are resolved by BibTeX as the data is
% exported. Bibliography styles will see the entry type the alias points to, not the
% alias name. All unknown entry types are generally exported as @misc.
%
% \DescribeFunction{phdthesis}
% Similar to @thesis except that the type field is optional and defaults to the localized
% term `PhD thesis'. You may still use the type field to override that.
%    \begin{macrocode}
%<*!(modern|strict)>
FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  new.sentence
  format.btitle "title" output.check
  new.column
  bbl.phdthesis format.thesis.type output.nonnull
  new.slash
  school "school" output.check
  new.block
  output.address.publisher.date
  new.block
  format.pages.page output
  note output
  new.sentence
  format.url output
  format.annote output
  fin.entry
}
%</!(modern|strict)>
%<*modern|strict>
FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle add.doi add.medium "title" output.check
  new.column
  bbl.phdthesis format.thesis.type output.nonnull
  new.column
  number output
  new.slash
  format.authors.after output
  new.semicolumn
  school "school" output.check
  new.block
  output.address.publisher
  format.date "year" output.check
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}
%</modern|strict>

%    \end{macrocode}
% \DescribeFunction{mastersthesis}
% Similar to |@thesis| except that the type field is optional and defaults to the localized
% term `Master's thesis'. You may still use the type field to override that.
%    \begin{macrocode}
%<*!(modern|strict)>
FUNCTION {masterthesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle "title" output.check
  new.column
  bbl.mthesis format.thesis.type output.nonnull
  new.slash
  school "school" output.check
  new.block
  output.address.publisher.date
  new.block
  format.pages.page output
  note output
  new.sentence
  format.url output
  format.annote output
  fin.entry
}
%</!(modern|strict)>
%<*modern|strict>
FUNCTION {masterthesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle add.doi add.medium "title" output.check
  new.column
  bbl.mthesis format.thesis.type output.nonnull
  new.column
  number output
  new.slash
  format.authors.after output
  new.semicolumn
  school "school" output.check
  new.block
  output.address.publisher
  format.date "year" output.check
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}
%</modern|strict>

%    \end{macrocode}
% \DescribeFunction{dscithesis}
% Similar to |@thesis| except that the type field is optional and defaults to the localized
% term `Doctor's of sciences thesis'. You may still use the type field to override that.
%    \begin{macrocode}
%<*!(modern|strict)>
FUNCTION {dscithesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle "title" output.check
  new.column
  bbl.dscithesis format.thesis.type output.nonnull
  new.slash
  school "school" output.check
  new.block
  output.address.publisher.date
  new.block
  format.pages.page output
  note output
  new.sentence
  format.url output
  format.annote output
  fin.entry
}
%</!(modern|strict)>
%<*modern|strict>
FUNCTION {dscithesis}
{ output.bibitem
  format.authors "author" output.check
%<natbib>  author format.key output
  new.sentence
  format.btitle add.doi add.medium "title" output.check
  new.column
  bbl.dscithesis format.thesis.type output.nonnull
  new.column
  number output
  new.slash
  format.authors.after output
  new.semicolumn
  school "school" output.check
  new.block
  output.address.publisher
  format.date "year" output.check
  new.block
  format.pages.page output
  new.block
  note output
  new.sentence
%  format.url output
  output.eprint.url
  format.annote output
  fin.entry
}
%</modern|strict>

%    \end{macrocode}
% \DescribeFunction{conference}
%    \begin{macrocode}
FUNCTION {conference} { inproceedings }

%    \end{macrocode}
%
% \DescribeFunction{techreport}
% TechReport is similar to |@report| except that the |type| field is optional
% and defaults to the localized term `technical report'.
% You may still use the type field to override that.
%    \begin{macrocode}
%FUNCTION {techreport}
%{
%  output.bibitem
%  author.before
%  new.sentence
%  format.title add.doi add.medium "title" output.check
%  new.column
%  format.techrep.type.number output.nonnull
%  new.slash
%  author.after
%  editor.organization.after
%  new.block
%  address output
%  new.column
%  institution "institution" output.check
%  format.date "year" output.check
%  new.block
%  note output
%  new.block                % v.2
%  format.pages.page output % v.2
%  new.sentence
%%  format.url output
%  output.eprint.url
%  format.annote output
%  fin.entry
%}

FUNCTION {techreport}
{
  output.bibitem
%  author.before
%  new.sentence
  format.title add.doi add.medium "title" output.check
%<natbib>  title format.key output
  new.column
%  format.techrep.type.number output.nonnull
%  type "type" output.check
%  format.report.type.number "type" output.check
%  type output
  format.techreport.type output
  new.column
  number output
  new.slash
  institution "institution" output.check
  new.semicolumn
  format.chief.after output % from editor field
  new.semicolumn
  format.executor.after output % from author field
  new.block
  address output
  new.column
  organization output
  format.date "year" output.check
  new.block                % v.2
  format.pages.page output % v.2
  new.sentence % или new.block ?
  output.eprint.url
  new.block
  note output
  format.annote output
  fin.entry
}


%    \end{macrocode}
% \DescribeFunction{default.type}
%    \begin{macrocode}
FUNCTION {default.type} { misc }

%    \end{macrocode}
%
% \subsection{Month Abbreviations}
%
%    \begin{macrocode}
MACRO {jan} {"\bbljan{}"}
MACRO {feb} {"\bblfeb{}"}
MACRO {mar} {"\bblmar{}"}
MACRO {apr} {"\bblapr{}"}
MACRO {may} {"\bblmay{}"}
MACRO {jun} {"\bbljun{}"}
MACRO {jul} {"\bbljul{}"}
MACRO {aug} {"\bblaug{}"}
MACRO {sep} {"\bblsep{}"}
MACRO {oct} {"\bbloct{}"}
MACRO {nov} {"\bblnov{}"}
MACRO {dec} {"\bbldec{}"}

%    \end{macrocode}
%
% \subsection{Journal Abbreviations}
%
%    \begin{macrocode}

%    \end{macrocode}
% \subsection{Journal abbreviations}
% \subsubsection{Physics and astronomy}
% Borrowed from \file{physjour.mbs} of package \pkg{custom-bib}.
%    \begin{macrocode}
MACRO {aa}{"Astron. \& Astrophys."}
MACRO {aasup}{"Astron. \& Astrophys. Suppl. Ser."}
MACRO {aj} {"Astron. J."}
MACRO {aph} {"Acta Phys."}
MACRO {advp} {"Adv. Phys."}
MACRO {ajp} {"Amer. J. Phys."}
MACRO {ajm} {"Amer. J. Math."}
MACRO {amsci} {"Amer. Sci."}
MACRO {anofd} {"Ann. Fluid Dyn."}
MACRO {am} {"Ann. Math."}
MACRO {ap} {"Ann. Phys. (NY)"}
MACRO {adp} {"Ann. Phys. (Leipzig)"}
MACRO {ao} {"Appl. Opt."}
MACRO {apl} {"Appl. Phys. Lett."}
MACRO {app} {"Astroparticle Phys."}
MACRO {apj} {"Astrophys. J."}
MACRO {apjsup} {"Astrophys. J. Suppl."}
MACRO {apss} {"Astrophys. Space Sci."}
MACRO {araa} {"Ann. Rev. Astron. Astrophys."}
MACRO {baas} {"Bull. Amer. Astron. Soc."}
MACRO {baps} {"Bull. Amer. Phys. Soc."}
MACRO {cmp} {"Comm. Math. Phys."}
MACRO {cpam} {"Commun. Pure Appl. Math."}
MACRO {cppcf} {"Comm. Plasma Phys. \& Controlled Fusion"}
MACRO {cpc} {"Comp. Phys. Comm."}
MACRO {cqg} {"Class. Quant. Grav."}
MACRO {cra} {"C. R. Acad. Sci. A"}
MACRO {fed} {"Fusion Eng. \& Design"}
MACRO {ft} {"Fusion Tech."}
MACRO {grg} {"Gen. Relativ. Gravit."}
MACRO {ieeens} {"IEEE Trans. Nucl. Sci."}
MACRO {ieeeps} {"IEEE Trans. Plasma Sci."}
MACRO {ijimw} {"Interntl. J. Infrared \& Millimeter Waves"}
MACRO {ip} {"Infrared Phys."}
MACRO {irp} {"Infrared Phys."}
MACRO {jap} {"J. Appl. Phys."}
MACRO {jasa} {"J. Acoust. Soc. America"}
MACRO {jcp} {"J. Comp. Phys."}
MACRO {jchp} {"J. Chem. Phys."}
MACRO {jetp} {"Sov. Phys.--JETP"}
MACRO {jfe} {"J. Fusion Energy"}
MACRO {jfm} {"J. Fluid Mech."}
MACRO {jmp} {"J. Math. Phys."}
MACRO {jne} {"J. Nucl. Energy"}
MACRO {jnec} {"J. Nucl. Energy, C: Plasma Phys., Accelerators, Thermonucl. Res."}
MACRO {jnm} {"J. Nucl. Mat."}
MACRO {jpc} {"J. Phys. Chem."}
MACRO {jpp} {"J. Plasma Phys."}
MACRO {jpsj} {"J. Phys. Soc. Japan"}
MACRO {jsi} {"J. Sci. Instrum."}
MACRO {jvst} {"J. Vac. Sci. \& Tech."}
MACRO {nat} {"Nature"}
MACRO {nature} {"Nature"}
MACRO {nedf} {"Nucl. Eng. \& Design/Fusion"}
MACRO {nf} {"Nucl. Fusion"}
MACRO {nim} {"Nucl. Inst. \& Meth."}
MACRO {nimpr} {"Nucl. Inst. \& Meth. in Phys. Res."}
MACRO {np} {"Nucl. Phys."}
MACRO {npb} {"Nucl. Phys. B"}
MACRO {nt/f} {"Nucl. Tech./Fusion"}
MACRO {npbpc} {"Nucl. Phys. B (Proc. Suppl.)"}
MACRO {inc} {"Nuovo Cimento"}
MACRO {nc} {"Nuovo Cimento"}
MACRO {pf} {"Phys. Fluids"}
MACRO {pfa} {"Phys. Fluids A: Fluid Dyn."}
MACRO {pfb} {"Phys. Fluids B: Plasma Phys."}
MACRO {pl} {"Phys. Lett."}
MACRO {pla} {"Phys. Lett. A"}
MACRO {plb} {"Phys. Lett. B"}
MACRO {prep} {"Phys. Rep."}
MACRO {pnas} {"Proc. Nat. Acad. Sci. USA"}
MACRO {pp} {"Phys. Plasmas"}
MACRO {ppcf} {"Plasma Phys. \& Controlled Fusion"}
MACRO {phitrsl} {"Philos. Trans. Roy. Soc. London"}
MACRO {prl} {"Phys. Rev. Lett."}
MACRO {pr} {"Phys. Rev."}
MACRO {physrev} {"Phys. Rev."}
MACRO {pra} {"Phys. Rev. A"}
MACRO {prb} {"Phys. Rev. B"}
MACRO {prc} {"Phys. Rev. C"}
MACRO {prd} {"Phys. Rev. D"}
MACRO {pre} {"Phys. Rev. E"}
MACRO {ps} {"Phys. Scripta"}
MACRO {procrsl} {"Proc. Roy. Soc. London"}
MACRO {rmp} {"Rev. Mod. Phys."}
MACRO {rsi} {"Rev. Sci. Inst."}
MACRO {science} {"Science"}
MACRO {sciam} {"Sci. Am."}
MACRO {sam} {"Stud. Appl. Math."}
MACRO {sjpp} {"Sov. J. Plasma Phys."}
MACRO {spd} {"Sov. Phys.--Doklady"}
MACRO {sptp} {"Sov. Phys.--Tech. Phys."}
MACRO {spu} {"Sov. Phys.--Uspekhi"}
MACRO {st} {"Sky and Telesc."}

%    \end{macrocode}
%
% \subsubsection{Optics}
%
% Borrowed from \file{photjour.mbs}.
%    \begin{macrocode}
MACRO {appopt} {"Appl. Opt."}
MACRO {bell}   {"Bell Syst. Tech. J."}
MACRO {ell}    {"Electron. Lett."}
MACRO {jasp}   {"J. Appl. Spectr."}
MACRO {jqe}    {"IEEE J. Quantum Electron."}
MACRO {jlwt}   {"J. Lightwave Technol."}
MACRO {jmo}    {"J. Mod. Opt."}
MACRO {josa}   {"J. Opt. Soc. America"}
MACRO {josaa}  {"J. Opt. Soc. Amer.~A"}
MACRO {josab}  {"J. Opt. Soc. Amer.~B"}
MACRO {jdp}    {"J. Phys. (Paris)"}
MACRO {oc}     {"Opt. Commun."}
MACRO {ol}     {"Opt. Lett."}
MACRO {os}     {"Opt. Spectrosc."}
MACRO {phtl}   {"IEEE Photon. Technol. Lett."}
MACRO {pspie}  {"Proc. Soc. Photo-Opt. Instrum. Eng."}
MACRO {sjot}   {"Sov. J. Opt. Technol."}
MACRO {sjqe}   {"Sov. J. Quantum Electron."}
MACRO {sleb}   {"Sov. Phys.--Leb. Inst. Rep."}
MACRO {stph}   {"Sov. Phys.--Techn. Phys."}
MACRO {stphl}  {"Sov. Techn. Phys. Lett."}
MACRO {vr}     {"Vision Res."}
MACRO {zph}    {"Z. f. Physik"}
MACRO {zphb}   {"Z. f. Physik~B"}
MACRO {zphd}   {"Z. f. Physik~D"}
%    \end{macrocode}
%
% \subsubsection{Physics of condensed Matter}
%
%    \begin{macrocode}
MACRO {sse} {"Solid-State Electron."}
MACRO {pss} {"Phys. Sol. State"}
MACRO {sst} {"Semicond. Sci. Tech."}
MACRO {nl}  {"Nano Lett."}

READ

%    \end{macrocode}
%
% \subsection{Sorting}
%
% Next chunk of code governs sorting reference list by authors' names and
% titles.
%    \begin{macrocode}
%<*sort|natbib>

%    \end{macrocode}
% \DescribeFunction{sortify}
%    \begin{macrocode}
FUNCTION {sortify}
{ purify$
%<!utf8>  "l" change.case$
}
%</sort|natbib>

%    \end{macrocode}
% \DescribeFunction{sort.format.names}
%    \begin{macrocode}
%<*sort>
%% =====================================
%% This version from old Gost package
%%<*!natbib>
FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
        { "   " * }
        'skip$
      if$
      s nameptr
      "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}"
      format.name$ 't :=
      nameptr numnames = t "others" = and
        { "et al" * }
        %{ bbl.etal * }
        { t sortify * }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}
%%</!natbib>
%% This version from plainnat.bst
%% It ignores second and subsequent authors but include year.
%%<*natbib>
%FUNCTION {sort.format.names}
%{ 's :=
%  #1 'nameptr :=
%  ""
%  s num.names$ 'numnames :=
%  numnames 'namesleft :=
%    { namesleft #0 > }
%    {
%      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
%      nameptr #1 >
%        {
%          "   "  *
%          namesleft #1 = t "others" = and
%            { "zzzzz" * }
%            { numnames #2 > nameptr #2 = and
%                { "zz" * year field.or.null * "   " * }
%                'skip$
%              if$
%              t sortify *
%            }
%          if$
%        }
%        { t sortify * }
%      if$
%      nameptr #1 + 'nameptr :=
%      namesleft #1 - 'namesleft :=
%    }
%  while$
%}
%%</natbib>
%% =====================================

%    \end{macrocode}
% \DescribeFunction{sort.format.title}
%    \begin{macrocode}
FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word % Removes "The " if any
    chop.word               % Removes "An " if any
  chop.word                 % Removes "A " if any
  sortify
  #1 global.max$ substring$
}

%    \end{macrocode}
% \DescribeFunction{author.sort}
%    \begin{macrocode}
%% =====================================
%% This version from old gost package.
%%
%<*!natbib>
FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    {
      author num.names$ #4 <
        {author sort.format.names }
        {title sort.format.title}
      if$
    }
  if$
}
%</!natbib>
%% This version from plainnat.bst
%<*natbib>
FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    { author sort.format.names }
  if$
}
%</natbib>
%% =====================================

%    \end{macrocode}
% \DescribeFunction{author.title.sort}
%    \begin{macrocode}
%<*!natbib|natbib>
FUNCTION {author.title.sort}
{ author empty$
    { title empty$
        { key empty$
            { "to sort, need author, title, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { title sort.format.title }
      if$
    }
    {
      author num.names$ #4 <
        {author sort.format.names }
        {title sort.format.title}
      if$
     }  	
  if$
}
%</!natbib|natbib>
%<*natbib|natbib>
FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
        { key empty$
            { "to sort, need author, editor, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
        { key empty$
            { "to sort, need author, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
        { key empty$
            { "to sort, need editor, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}
%</natbib|natbib>


%    \end{macrocode}
% \DescribeFunction{presort}
% Function to compute |sort.key$|.
% What is the space string \verb*|"   "| for?
%    \begin{macrocode}
%<*!natbib>
FUNCTION {presort}%#1
{
  author.title.sort
  "   "
  *
  year field.or.null sortify
  *
  "   "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}
%</!natbib>
%<*natbib>
FUNCTION {presort}%#2
{ calc.label
  label sortify
  %author.title.sort
  "    "
  *
  % ========= plainnat.bst =========
%  type$ "book" =
%  type$ "inbook" =
%  or
%    'author.editor.sort
%    { type$ "proceedings" =
%        'editor.organization.sort
%        { type$ "manual" =
%            'author.organization.sort
%            'author.sort
%          if$
%        }
%      if$
%    }
%  if$
  author.title.sort
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  %cite$
  title field.or.null sort.format.title
  *
  #1 entry.max$ substring$
  'sort.label :=
  sort.label *
  % ================================
  #1 entry.max$ substring$
  'sort.key$ :=
}
%</natbib>
%</sort>

%<*!sort>
%<*natbib>
INTEGERS { seq.num }

FUNCTION {init.seq}
{ #0 'seq.num :=}

EXECUTE {init.seq}

FUNCTION {int.to.fix}
{ "000000000" swap$ int.to.str$ *
  #-1 #10 substring$
}

FUNCTION {presort}%#3
{
  calc.label               % computes label
  label sortify            % initiates sort.label
  "    "
  *
  seq.num #1 + 'seq.num := % advance seq.num
  seq.num  int.to.fix      % prepend seq.num with 0s
  'sort.label :=           % set sort.label to seq.num
  sort.label *             % append seq.num to label
  #1 entry.max$ substring$ % cut if too long
  'sort.key$ :=            % set sort.key$
}
%</natbib>
%</!sort>

%<*sort|natbib>
ITERATE {presort}

SORT

%</sort|natbib>

%    \end{macrocode}
%
% \subsection{Bibliography list}
%
% We need to find longest label to put in into the argument of
% the |thebibliography| environment. In case of |natbib| options
% we also need to compute extra suffix for the |year| field if there two or
% more entries for given label (=author/editor/organization) in that year.
%
% Declare global (external) strings used in calculation of the longest label.
%    \begin{macrocode}
%<!natbib>STRINGS { longest.label }
%<natbib>STRINGS { longest.label last.label next.extra }

%<!natbib>INTEGERS { number.label longest.label.width }
%<natbib>INTEGERS { number.label longest.label.width last.extra.num  }

%    \end{macrocode}
%
% \DescribeFunction{initialize.longest.label}
% Initialize those string.
%    \begin{macrocode}
%<*!natbib>
FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
}
%</!natbib>
%<*natbib>
FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.label :=
  "" 'next.extra :=
  #0 'longest.label.width :=
  #0 'last.extra.num :=
  #0 'number.label :=
}
%</natbib>

EXECUTE {initialize.longest.label}

%    \end{macrocode}
%
% \DescribeFunction{initialize.longest.label}
% Iterate though the list of entries to compute |label|.
%    \begin{macrocode}
%<*!natbib>
FUNCTION {forward.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
}
%</!natbib>
%<*natbib>
FUNCTION {forward.pass}
{ last.label label =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      label 'last.label :=
    }
  if$
  number.label #1 + 'number.label :=
}
%</natbib>

ITERATE {forward.pass}

%    \end{macrocode}
%
% \DescribeFunction{reverse.pass}
% |Natbib| styles require reverse iteration over all entries.
%    \begin{macrocode}
%<*natbib>
FUNCTION {reverse.pass}
{ next.extra "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  extra.label 'next.extra :=
  extra.label
  duplicate$ empty$
    'skip$
    { "{\natexlab{" swap$ * "}}" * }
  if$
  'extra.label :=
  label extra.label * 'label :=
}

REVERSE {reverse.pass}

FUNCTION {bib.sort.order}
{ sort.label  'sort.key$ :=
}

ITERATE {bib.sort.order}

SORT
%</natbib>

%    \end{macrocode}
% \DescribeFunction{begin.bib}
% Within |thebibliography| environment we define few formatting macros
% for user to customize how the reference list is formatted.
%    \begin{macrocode}
FUNCTION {begin.bib}
{ "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  "\def\selectlanguageifdefined#1{"                  write$ newline$
  "\expandafter\ifx\csname date#1\endcsname\relax"   write$ newline$
%  "\else\language\csname l@#1\endcsname\fi}"         write$ newline$
  "\else\selectlanguage{#1}\fi}"                     write$ newline$
  "\providecommand*{\href}[2]{{\small #2}}"          write$ newline$
  "\providecommand*{\url}[1]{{\small #1}}"           write$ newline$
  "\providecommand*{\BibUrl}[1]{\url{#1}}"           write$ newline$
  "\providecommand{\BibAnnote}[1]{}"                 write$ newline$
  "\providecommand*{\BibEmph}[1]{#1}"                write$ newline$
%<*modern>
  "\ProvideTextCommandDefault{\cyrdash}{\hbox to.8em{--\hss--}}" write$ newline$
  "\providecommand*{\BibDash}{\ifdim\lastskip>0pt\unskip\nobreak\hskip.2em\fi" write$ newline$
  "\cyrdash\hskip.2em\ignorespaces}" write$ newline$
%</modern>
%<natbib>  "\providecommand{\natexlab}[1]{#1}" write$ newline$
  preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
}


EXECUTE {begin.bib}

EXECUTE {init.state.consts}

ITERATE {call.type$}

%    \end{macrocode}
% \DescribeFunction{end.bib}
%    \begin{macrocode}
FUNCTION {end.bib}
{ newline$
%  "\catcode`\/=11"        write$ newline$
  "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}

%</bst>
%    \end{macrocode}
%
% That's all, Folks!
%
% \PrintChanges
% \Finale
%
% \endinput