summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx
blob: 65241928dadaa0e5e662ab7d7c07a24bb2d98b2f (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
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
% \iffalse meta-comment
% !TEX program  = XeLaTeX
%<*internal>
\iffalse
%</internal>
%<*readme>

xeCJK is a package written for XeLaTeX which allows users to typeset
CJK scripts easily.


 - different default fonts for CJK and other characters;
 - spaces automatically ignored between CJK characters;
 - special effects on full-width CJK punctuation; and
 - automatic adjustment of the space between CJK and other characters.


This package is licensed in LPPL.

This package consists of the file  xeCJK.dtx
             and the derived files xeCJK.pdf,
                                   xeCJK.sty,
                                   xeCJK.ins,
                                   xeCJK-example-autofake.tex,
                                   xeCJK-example-fallback.tex,
                                   xeCJK-example-subCJKblock.tex,
                                   xeCJK-example-CJKecglue.tex,
                                   xeCJK-example-checksingle.tex and
                                   README.txt (this file).

If you are interested in the process of development you may observe

    http://code.google.com/p/ctex-kit/updates/list

    Author:
            Wenchang Sun    <sunwch@nankai.edu.cn>
    Current Maintainers:
            Leo Liu         <leoliu.pku@gmail.com>
            Qing Lee        <sobenlee@gmail.com>


Installation
------------
The package is supplied in dtx format and as a pre-extracted zip file,
xecjk.tds.zip. The later is most convenient for most users: simply
unzip this in your local texmf directory and run texhash to update the
database of file locations. If you want to unpack the dtx yourself,
running "xetex xeCJK.dtx" will extract the package whereas
"xelatex xeCJK.dtx" will extract it and also typeset the documentation.

The package requires LaTeX3 support as provided in the l3kernel and
l3packages bundles and the fontspec package. All of these are available
on CTAN as ready-to-install zip files. Suitable versions are available
in the latest version of MiKTeX and TeX Live (updating the relevant
packages online may be necessary).

To compile the documentation without error, you will need some specific
CJK scripts fonts (TrueType or OpenType).
%</readme>
%<*internal>
\fi
\ifnum\strcmp{\fmtname}{plain}=0 \else
  \expandafter\begingroup
\fi
%</internal>
%<*batchfile>

\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble

$Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
$URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $
-----------------------------------------------------------------
   Author:
            Wenchang Sun    <sunwch@nankai.edu.cn>
   Current Maintainers:
            Leo Liu         <leoliu.pku@gmail.com>
            Qing Lee        <sobenlee@gmail.com>

   Copyright (C) 2007--2012 Wenchang Sun

   This file may be distributed and/or modified under the
   conditions of the LaTeX Project Public License, either version 1.3
   of this license or (at your option) any later version.
   The latest version of this license is in
      http://www.latex-project.org/lppl.txt
   and version 1.3 or later is part of all distributions of LaTeX
   version 2005/12/01 or later.

   This work has the LPPL maintenance status "maintained".
   The Current Maintainer of this work are Leo Liu and Qing Lee.
-----------------------------------------------------------------

\endpreamble
\postamble

   This package consists of the file  xeCJK.dtx
                and the derived files xeCJK.pdf,
                                      xeCJK.sty,
                                      xeCJK.ins,
                                      xeCJK-example-autofake.tex,
                                      xeCJK-example-fallback.tex,
                                      xeCJK-example-subCJKblock.tex,
                                      xeCJK-example-CJKecglue.tex,
                                      xeCJK-example-checksingle.tex and
                                      README.txt.
\endpostamble
\usedir{tex/xelatex/xecjk}
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\usedir{doc/xelatex/xecjk/example}
\generate{
  \file{\jobname-example-autofake.tex}{\from{\jobname.dtx}{ex-autofake}}
  \file{\jobname-example-fallback.tex}{\from{\jobname.dtx}{ex-fallback}}
  \file{\jobname-example-subCJKblock.tex}{\from{\jobname.dtx}{ex-block}}
  \file{\jobname-example-CJKecglue.tex}{\from{\jobname.dtx}{ex-ecglue}}
  \file{\jobname-example-checksingle.tex}{\from{\jobname.dtx}{ex-single}}}
%</batchfile>
%<batchfile>\endbatchfile
%<*internal>
\usedir{source/xelatex/xecjk}
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\nopreamble\nopostamble
\usedir{doc/xelatex/xecjk}
\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
\ifnum\strcmp{\fmtname}{plain}=0
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%
%<*driver|package>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\GetIdInfo$Id: xeCJK.dtx 356 2012-09-03 02:18:08Z sobenlee $
          {package for typesetting CJK scripts with XeLaTeX}
%<*driver>
\ProvidesExplFile
  {\ExplFileName.\ExplFileExtension}
%</driver>
%<package>\ProvidesExplPackage
%<package>  {\ExplFileName}
  {\ExplFileDate}{3.0.8}{\ExplFileDescription}
%<*driver>
\ExplSyntaxOff
%</driver>
%</driver|package>
%
%<*driver>
\documentclass[full]{l3doc}
\hypersetup{pdfstartview=FitH}
\usepackage{xeCJK}
\fvset{formatcom=\CJKfixedspacing}
\linespread{1.1}
\setlist{nosep}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\setmonofont{Inconsolata}
\setCJKmainfont[BoldFont=Adobe Heiti Std,ItalicFont=Adobe Kaiti Std]{Adobe Song Std}
\setCJKmonofont{Adobe Kaiti Std}
\xeCJKDeclareSubCJKBlock{HKMD}  { "FF65 }
\xeCJKDeclareSubCJKBlock{Ext-B} { "20000 -> "2A6DF }
\xeCJKDeclareSubCJKBlock{Hangul}{ "1100 -> "11FF, "3130 -> "318F, "A960 -> "A97F, "AC00 -> "D7AF }
\setCJKmainfont[HKMD]{Microsoft YaHei}
\setCJKmainfont[Ext-B]{SimSun-ExtB}
\setCJKmainfont[Hangul]{Adobe Myungjo Std}
\xeCJKsetup{PunctStyle=kaiming,KaiMingPunct+={:;}}
\def\MacroFont{\small\normalfont\ttfamily\punctstyle{plain}}
\def\XeTeX{\hologo{XeTeX}}
\def\XeLaTeX{\hologo{XeLaTeX}}
\def\LaTeX{\hologo{LaTeX}}
\parindent=2em
\AtBeginDocument{\DeleteShortVerb{\"}\MakeShortVerb{\|}}
\def\contentsname{目录}
\DeclareUrlCommand\email{\def\UrlLeft##1\UrlRight{\href{mailto:##1}{##1}}}
\addtolength{\voffset}{-5\baselineskip}
\addtolength\textheight{8\baselineskip}
\makeatletter
\let\orig@meta\meta
\def\meta#1{\orig@meta{\mbox{\normalfont\itshape\CJKfixedspacing#1}}}
\def\TF{true\orvar{}false}
\def\TTF{\defaultvar{true}\orvar{}false}
\def\TFF{true\orvar\defaultvar{false}}
\def\orvar{\char`\|}
\let\defaultvar\textbf
\def\argbrace#1{\char`\{#1\char`\}}
\@addtoreset{CodelineNo}{section}
\def\tokslink#1{\hyperlink{#1}{\ding{51}}}
\makeatother
\def\indexname{代码索引}
\IndexPrologue{%
  \section*{\indexname}
  \markboth{\indexname}{\indexname}
  斜体的数字表示对应项说明所在的页码,下划线的数字表示定义所在的代码行号,而直立体的
  数字表示对应项使用时所在的行号。}
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{3061}
% \DoNotIndex{\T,\F,\C,\J,\K,\O,\U,\Z,\E,\R,\M,\A,\Y,\R,\;,\t,\c,\:,\\,\@}
% \GetFileInfo{\jobname.dtx}
%
% \title{\bfseries\pkg{xeCJK} 宏包}
% \author{\href{http://www.ctex.org}{ctex.org}}
% \date{\filedate\qquad\fileversion}
% \maketitle
%
% \tableofcontents
%
% \begin{documentation}
%
% \section{简介}
%
% \pkg{xeCJK} 是一个 \XeLaTeX 宏包,用于排版中日韩(CJK)文字。主要功能:
% \begin{enumerate}
% \item 分别设置 CJK 和英文字体;
% \item 自动忽略 CJK 文字间的空格而保留其它空格,允许在非标点汉字和英文
% 字母 (a--z, A--Z) 间断行;
% \item 提供多种标点处理方式: 全角式、半角式、开明式、行末半角式和 CCT 式;
% \item 自动调整中英文间空白。
% \end{enumerate}
%
% \pkg{xeCJK} 使用了 \XeTeX 的一些最新特性,需要 \XeTeX{} |0.9995.0 [2009/06/29]| 以
% 后的版本。\pkg{xeCJK} 的依赖 \LaTeX~3 项目的 \pkg{expl3},\pkg{xparse} 和
%  \pkg{l3keys2e} 宏包,并依赖 \pkg{fontspec}^^A
% \footnote{\url{http://mirrors.ctan.org/macros/latex/contrib/fontspec/}}
% 宏包来调用系统字体。个别兼容性功能需要 \pkg{CJK} 宏包的支持。
%
% \pkg{xeCJK} 的原始作者是孙文昌,2009 年 5 月起宏包被收入
% \texttt{ctex-kit}\footnote{\url{http://code.google.com/p/ctex-kit/}} 项目进行
% 维护,目前主要维护者是刘海洋\footnote{\email{leoliu.pku@gmail.com}} 和
% 李清\footnote{\email{sobenlee@gmail.com}}。
%
% \section{基本用法}
%
% 与其他 \LaTeX{} 宏包一样,引入 \pkg{xeCJK} 宏包只要在导言区使用
% \begin{verbatim}
%     \usepackage{xeCJK}
% \end{verbatim}
% 在引入 \pkg{xeCJK} 宏包之后,只要设置 CJK 文字的字体,就可以在文档中使用中日
% 韩文字了。
%
% 可以在各种文档类中使用 \pkg{xeCJK} 宏包,最简单的示例是:
% \begin{verbatim}
% \documentclass{article}
% \usepackage{xeCJK}
% \setCJKmainfont{SimSun}
%
% \begin{document}
% 中文 \LaTeX 示例。
% \end{document}
% \end{verbatim}
% 上述示例设置了中文字体 SimSun(宋体)。运行此示例要求系统安装了设置的字体,
% 源文件用 UTF-8 编码保存,使用 \XeLaTeX{} 编译。
%
% \pkg{xeCJK} 只提供了字体和标点控制等基本 CJK 语言支持。对于中文文档,可以使
% 用更为高层的 \pkg{ctex} 宏包或文档类,它将自动调用 \pkg{xeCJK} 并设置好中文
% 字体,同时提供了进一步的本地化支持。详细内容参看 \pkg{ctex} 宏包^^A
% \footnote{\url{http://mirrors.ctan.org/language/chinese/ctex/}}的说明。
%
% \pkg{xeCJK} 提供了大量选项,可以在宏包调用时作为宏包选项或用 |\xeCJKsetup|
% 命令进行设置,详见 \ref{subsec:opts}~节。除了 |\setCJKmainfont| 命令,
% \pkg{xeCJK} 还提供了许多其他命令设置和选择中文字体,详见
% \ref{subsec:fontset}~节。其他更详细的功能也都将在下面详细说明。
%
% \section{用户手册}
%
% \subsection{宏包选项}
% \label{subsec:opts}
%
% \pkg{xeCJK} 以 \meta{key}|=|\meta{var} 的形式提供宏包选项,你可以在调用宏包
% 的时候直接设置这些选项,也可以在调用宏包之后使用 |\xeCJKsetup| 来设置这些选
% 项。
%
% \begin{function}{\xeCJKsetup}
%   \begin{syntax}
%     \cs{xeCJKsetup} \argbrace{\meta{key1}=\meta{var1}, \meta{key2}=\meta{var2}, ...}
%   \end{syntax}
%   其中 \meta{key1}, \meta{key2} 是设置选项,而 \meta{val1}, \meta{val2} 则是对应选项的
%   设置内容。多个选项可以在一个语句中完成设置。例如
%   \begin{verbatim}
%     \usepackage[PunctStyle=kaiming]{xeCJK}
%   \end{verbatim}
%   等价于
%   \begin{verbatim}
%     \usepackage{xeCJK}
%     ......
%     \xeCJKsetup{PunctStyle=kaiming}
%   \end{verbatim}
% \end{function}
%
% 有些选项或命令后面带有 \hypertarget{expstar}{\hyperlink{expstar}{$\star$}} 号,这表示这
% 个选项或命令只能在导言区中使用,而 \hypertarget{rexpstar}{\hyperlink{rexpstar}{\ding{73}}}
% 号则表示这个选项或命令只能在导言区使用,并且只影响随后定义的 CJK 字体。其余不带特殊标记的
% 选项或命令,如果没有特别说明,可以在导言区或正文中使用。
%
% 下列选项使用加粗的形式来表示 \pkg{xeCJK} 的默认设置。
%
% \begin{function}{xeCJKactive}
%   \begin{syntax}
%     xeCJKactive = \meta{\TTF}
%   \end{syntax}
%   打开/关闭对中文的特殊处理。
% \end{function}
%
% \begin{function}[EXP]{CJKnumber}
%   \begin{syntax}
%     CJKnumber = \meta{\TFF}
%   \end{syntax}
%   是否使用 \pkg{CJKnumb} 宏包。请注意,为了与 \pkg{CJKnumb} 兼容,\pkg{xeCJK} 修改了
%   它的一些内部命令,所以这个选项需要在调用 \pkg{xeCJK} 时设置,而不能通过 |\xeCJKsetup|
%   来设置它。
% \end{function}
%
% \begin{function}[EXP]{indentfirst}
%   \begin{syntax}
%     indentfirst = \meta{\TTF}
%   \end{syntax}
%   跟在章节标题后面的第一段首行是否缩进。这个选项需要在调用 \pkg{xeCJK} 时设置,不能
%   通过 |\xeCJKsetup| 来设置它。\pkg{xeCJK} 宏包中只有 |indentfirst| 和 |CJKnumber|
%   这两个选项,不能通过 |\xeCJKsetup| 来设置。
% \end{function}
%
% \begin{function}{CJKspace}
%   \begin{syntax}
%     CJKspace = \meta{\TFF}
%   \end{syntax}
%   缺省状态下,\pkg{xeCJK} 会忽略 CJK 文字之间的空格,使用这一选项来保留它们之间的空格。
% \end{function}
%
% \begin{function}[EXP]{CJKmath}
%   \begin{syntax}
%     CJKmath = \meta{\TFF}
%   \end{syntax}
%   是否支持在数学环境中直接输入 CJK 字符。使用这个选项后,可以直接在数学环境中
%   输出 CJK 字符。
% \end{function}
%
% \begin{function}{CJKglue}
%   \begin{syntax}
%     CJKglue = \argbrace{\cs{hspace}\argbrace{0pt plus .08\cs{baselineskip}}}
%   \end{syntax}
%   设置 CJK 文字之间插入的 |glue|,上边是 \pkg{xeCJK} 的默认值。一般来说,除非有
%   特殊需要(例如,改变文字间距等),否则不需要设置这个选项,使用默认值即可。如果要设置
%   这个选项,为了行末的对齐,设置的 |glue| 最好有一定的弹性。
% \end{function}
%
% \begin{function}{CJKecglue}
%   \begin{syntax}
%     CJKecglue = \Arg{glue}
%   \end{syntax}
%   设置 CJK 文字与西文、CJK 文字与行内数学公式之间的间距,默认值是一个空格。使用这个
%   选项设置的 |glue| 最好也要用一定的弹性。请注意,这里设置的 |glue| 只影响
%   \pkg{xeCJK} 根据需要自动添加的空白,源文件中直接输入的 CJK 文字与西文之间的空格不
%   受影响(直接输出)。有时候 \pkg{xeCJK} 可能不能正确地调整间距,需要手动加空格。
% \end{function}
%
% \begin{function}{xCJKecglue}
%   \begin{syntax}
%     xCJKecglue = \marg{\TFF\orvar{}glue}
%   \end{syntax}
%   缺省状态下,\pkg{xeCJK} 不对源文件中直接输入的 CJK 文字与西文之间的空格进行调整,如
%   果需要调整,请使用这个选项。如果使用这个选项,将使用 |CJKecglue| 替换源文件中直接输
%   入的 CJK 文字与西文之间的空格。
% \end{function}
%
% \begin{function}{CheckSingle}
%   \begin{syntax}
%     CheckSingle = \meta{\TFF}
%   \end{syntax}
%   是否避免单个 CJK 文字单独占一个段落的最后一行。
% \end{function}
%
% \begin{function}{InlineEnv,InlineEnv+,InlineEnv-}
%   \begin{syntax}
%     InlineEnv = \argbrace{env1, env2, env3, ...}
%   \end{syntax}
%   在使用 |CheckSingle| 选项的时候,\pkg{xeCJK} 会将 CJK 文字后接着的 \LaTeX 环境的
%   开始 |\begin{...}| 和结束 |\end{...}| 视为断行的地方,如果有某些特殊
%   的 \LaTeX 环境没有造成断行,可以使用这个选项来声明它,以便 |CheckSingle| 能正确识别。
% \end{function}
%
% \begin{function}{AutoFallBack}
%   \begin{syntax}
%     AutoFallBack = \meta{\TFF}
%   \end{syntax}
%   当文档中有个别生僻字时,可以使用这个选项,自动使用预先设置好的后备字体来输出这些生僻
%   字。后备字体的设置方法将在 \ref{subsec:fontset} 节中介绍。
% \end{function}
%
% \begin{function}[rEXP]{AutoFakeBold}
%   \begin{syntax}
%     AutoFakeBold = \marg{\TFF\orvar{}数字}
%   \end{syntax}
%   全局设定当没有声明对应的粗体时,是否使用\textbf{\CJKfontspec[AutoFakeBold]{Adobe Song Std}伪粗体};
%   当输入的是数字时,将使用伪粗体,并将使用输入的数字作为伪粗体的默认粗细程度。
% \end{function}
%
% \begin{function}[rEXP]{AutoFakeSlant}
%   \begin{syntax}
%     AutoFakeSlant = \marg{\TFF\orvar{}数字}
%   \end{syntax}
%   全局设定当没有声明对应的斜体时,是否使用\textit{\CJKfontspec[AutoFakeSlant]{Adobe Song Std}伪斜体};
%   当输入的是数字时,将使用伪斜体,并将使用输入的数字作为伪斜体的默认倾斜程度。
% \end{function}
%
% \begin{function}[rEXP]{EmboldenFactor}
%   \begin{syntax}
%     EmboldenFactor = \marg{数字\orvar\defaultvar{4}}
%   \end{syntax}
%   设置伪粗体的默认粗细程度。
% \end{function}
%
% \begin{function}[rEXP]{SlantFactor}
%   \begin{syntax}
%     SlantFactor = \marg{数字\orvar\defaultvar{0.167}}
%   \end{syntax}
%   设置伪斜体的粗细程度,范围是 $-0.999 \sim 0.999$。
% \end{function}
%
% \begin{function}{PunctStyle}
%   \begin{syntax}
%     PunctStyle = \marg{\defaultvar{quanjiao}\orvar{}banjiao\orvar{}kaiming\orvar{}hangmobanjiao\orvar{}CCT\orvar{}plain}
%   \end{syntax}
%   设置标点处理格式,有效值分别为
%   \begin{itemize}[font=\ttfamily,labelsep=1em]
%     \item[quanjiao] 全角式:所有标点占一个汉字宽度,相邻两个标点占 1.5 汉字宽度;
%     \item[banjiao]  半角式:所有标点占半个汉字宽度;
%     \item[kaiming]  开明式:句末点号用全角,其他半角;
%     \item[hangmobanjiao] 行末半角式:所有标点占一个汉字宽度,行首行末对齐;
%     \item[CCT]   CCT 格式;
%     \item[plain] 原样(不调整标点间距)。
%   \end{itemize}
% \end{function}
%
% \begin{function}[EXP]{KaiMingPunct,KaiMingPunct+,KaiMingPunct-}
%   \begin{syntax}
%     KaiMingPunct = \marg{\defaultvar{ . 。? !}}
%   \end{syntax}
%   设置开明(|kaiming|)标点处理格式时的句末点号,|KaiMingPunct| 后带的 |+| 与 |-|
%   分别表示从已有的开明句末点号中增加或减少标点。
% \end{function}
%
% \begin{function}[EXP]{LongPunct,LongPunct+,LongPunct-}
%   \begin{syntax}
%     LongPunct = \marg{\defaultvar{ — ‥ … ─ }}
%   \end{syntax}
%   设置长标点,例如破折号“——”与省略号“……”,允许在长标点前后
%   断行,但是禁止在它们之间断行。
% \end{function}
%
% \begin{function}[EXP]{MiddlePunct,MiddlePunct+,MiddlePunct-}
%   \begin{syntax}
%     MiddlePunct = \marg{\defaultvar{ · · ・ }}
%   \end{syntax}
%   设置居中显示的标点,例如间隔号“\textbf{·}”。对于在 CJK 文字之间的居中标点,
%   \pkg{xeCJK} 会根据不同的标点处理格式,调整居中标点与前后文字之间的空白,保证
%   其确实居中。对于行末出现的居中标点,允许在其后面断行,但禁止在它前面断行。
% \end{function}
%
% \begin{function}[EXP]{PunctWidth}
%   \begin{syntax}
%     PunctWidth = \Arg{dimen}
%   \end{syntax}
%   缺省状态下,\pkg{xeCJK} 会根据所选择的标点处理格式自动计算标点所占的宽度,如果对缺
%   省设置不满意,可以通过这一选项来改变它。为了使得标点所占的宽度能够适应字体大小的变化,
%   这里设置的 |dimen| 的单位最好用 |em| 等相对距离单位,而不建议使用诸如 |pt| 之类的
%   绝对距离单位。这里的设置对除了 |plain| 以外的所有标点处理格式都有效。同时,这里的
%   设置对所有的 CJK 标点都生效,如果只要设置部分标点,请使用 \ref{subsec:punct} 节的
%   |\xeCJKsetwidth|。
% \end{function}
%
% \begin{function}{AllowBreakBetweenPuncts}
%   \begin{syntax}
%     AllowBreakBetweenPuncts = \meta{\TFF}
%   \end{syntax}
%   缺省状态下,\pkg{xeCJK} 禁止在相邻 CJK 右标点和 CJK 左标点之间换行,可以使用
%   这一选项改变这一设置。
% \end{function}
%
% \subsection{字体设置与选择}
% \label{subsec:fontset}
%
% \begin{function}[EXP]{\setCJKmainfont}
%   \begin{syntax}
%     \cs{setCJKmainfont} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   设置正文罗马族的 CJK 字体,影响 |\rmfamily| 和 |\textrm| 的字体。后面两个
%   参数继承自 \pkg{fontspec} 宏包, \meta{font features} 表示字体属性选项,
%   \meta{font name} 是字体名。字体名可以是字体族名,也可以是字体的文件名,查
%   找字体名见 \ref{subsubsec:fontsearch}~节;可用的字体属性选项参见
%   \pkg{fontspec} 宏包的文档。需要说明的是 \pkg{xeCJK} 修改了 |AutoFakeBold|
%   和 |AutoFakeSlant| 选项,以便配合全局伪粗体和伪斜体的设定。
% \end{function}
%
% \begin{function}{AutoFakeBold,AutoFakeSlant}
%   \begin{syntax}
%     AutoFakeBold  = \marg{\TF\orvar{}数字}
%     AutoFakeSlant = \marg{\TF\orvar{}数字}
%   \end{syntax}
%   局部设置当前字体族的伪粗和伪斜属性。如果没有在局部给出这些选项,将使用全局设定。
% \end{function}
%
% \begin{function}[EXP]{\setCJKsansfont}
%   \begin{syntax}
%     \cs{setCJKsansfont} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   设置正文无衬线族的 CJK 字体,影响 |\sffamily| 和 |\textsf| 的字体。
% \end{function}
%
% \begin{function}[EXP]{\setCJKmonofont}
%   \begin{syntax}
%     \cs{setCJKmonofont}  \oarg{font features} \Arg{font name}
%   \end{syntax}
%   设置正文等宽族的 CJK 字体,影响 |\ttfamily| 和 |\texttt| 的字体。为了有利于等宽
%   字体的代码对齐等情形,\pkg{xeCJK} 在 \meta{font features} 里增加了 |Mono| 这个选项。
% \end{function}
%
% \begin{function}{Mono}
%   \begin{syntax}
%     Mono = \meta{Scale\orvar{}Exspace}
%   \end{syntax}
%   有效值仅为 |Scale| 或 |Exspace|。分别表示使用放缩的方式或改变间距的方式,让 CJK
%   字符的宽度等于西文字体中两个空格的宽度。
% \end{function}
%
% \begin{function}{\CJKfixedspacing,\CJKflexiblespacing}
%   \begin{syntax}
%     \cs{CJKfixedspacing}
%     \cs{CJKflexiblespacing}
%   \end{syntax}
%   |\CJKfixedspacing| 命令设置固定字距和不压缩标点格式,符合上面 |Mono=Exspace| 选
%   项的意义。|\CJKflexiblespacing| 命令恢复可伸缩的字距和标点压缩。抄录 |(verbatim)|
%   环境将自动使用 |\CJKfixedspacing| 的效果。
% \end{function}
%
% \begin{function}{\setCJKmonoscale,\setCJKmonoexspace}
%   \begin{syntax}
%     \cs{setCJKmonoscale}
%     \cs{setCJKmonoexspace}
%   \end{syntax}
%   |\setCJKmonoscale| 和 |\setCJKmonoexspace| 命令分别计算并设置当前字号下西文等宽
%   字体与 CJK 字体的放缩比例和字距,以符合上面所说的 |Mono=Scale| 与 |Mono=Exspace|
%   选项的意义。在字号改变时,应该使用两个命令之一,重新计算相关参数;但注意两个命令不
%   能同时使用。
% \end{function}
%
% \begin{function}[EXP]{\setCJKfamilyfont}
%   \begin{syntax}
%     \cs{setCJKfamilyfont} \Arg{family} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   声明新的 CJK 字体族 \meta{family} 并指定字体。
% \end{function}
%
% \begin{function}{\CJKfamily}
%   \begin{syntax}
%     \cs{CJKfamily} \Arg{family}
%   \end{syntax}
%   用于在文档中切换 |CJK| 字体族,\meta{family} 必须预先声明。
% \end{function}
%
% \begin{function}[EXP]{\newCJKfontfamily}
%   \begin{syntax}
%     \cs{newCJKfontfamily} \oarg{family} \cs{\meta{font-switch}} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   声明新的 CJK 字体族 \meta{family} 并指定字体,并定义 \cs{\meta{font-switch}},在
%   文档中可以使用它来切换 CJK 字体族。可以不必指定 \meta{family},这时候 \meta{family}
%   将等于 \meta{font-switch}。事实上,|\newCJKfontfamily| 是 |\setCJKfamilyfont| 和
%   |\CJKfamily| 的合并。例如
%   \begin{verbatim}
%     \newCJKfontfamily[song]\songti{SimSun}
%   \end{verbatim}
%   等价于
%   \begin{verbatim}
%     \setCJKfamilyfont{song}{SimSun}
%     \newcommand\songti{\CJKfamily{song}}
%   \end{verbatim}
% \end{function}
%
% \begin{function}{\CJKfontspec}
%   \begin{syntax}
%     \cs{CJKfontspec} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   在文档中随机定义新的 CJK 字体族,并马上使用它。
% \end{function}
%
% \begin{function}[rEXP]{\defaultCJKfontfeatures}
%   \begin{syntax}
%     \cs{defaultCJKfontfeatures} \Arg{font features}
%   \end{syntax}
%   全局设置 CJK 字体族的默认选项。例如,使用
%   \begin{verbatim}
%     \defaultCJKfontfeatures{Scale=0.962216}
%   \end{verbatim}
%   可以将全部 CJK 字体缩小为 |0.962216|。\pkg{xeCJK} 宏包的初始化设置是
%   \begin{verbatim}
%     \defaultCJKfontfeatures{Script=CJK}
%   \end{verbatim}
% \end{function}
%
% \begin{function}{\addCJKfontfeatures}
%   \begin{syntax}
%     \cs{addCJKfontfeatures} \Arg{font features}
%   \end{syntax}
%   临时增加当前使用的 CJK 字体的选项。例如,使用
%   \begin{verbatim}
%     \addCJKfontfeatures{Scale=1.1}
%   \end{verbatim}
%   可以将文档中当前使用的 CJK 字体放大为 |1.1|。
% \end{function}
%
% \begin{function}{\CJKrmdefault}
%   保存 |\rmfamily| 所使用的 CJK 字体族,默认值是 |rm|。类似西文字体的 |\rmdefault|。
% \end{function}
%
% \begin{function}{\CJKsfdefault}
%   保存 |\sffamily| 所使用的 CJK 字体族,默认值是 |sf|。类似西文字体的 |\sfdefault|。
% \end{function}
%
% \begin{function}{\CJKttdefault}
%   保存 |\ttfamily| 所使用的 CJK 字体族,默认值是 |tt|。类似西文字体的 |\ttdefault|。
% \end{function}
%
% \begin{function}{\CJKfamilydefault}
%   保存 |\normalfont| 所使用的 CJK 字体族,默认值是 |\CJKrmdefault|。类似西文字
%   体的 |\familydefault|。可以通过更改它来改变文档的默认 CJK 字体族。例如,使用
%   \begin{verbatim}
%     \renewcommand\familydefault{\sfdefault}
%     \renewcommand\CJKfamilydefault{\CJKsfdefault}
%   \end{verbatim}
%   可以将全文的 CJK 和西文默认字体改为无衬线字体族。
% \end{function}
%
% \begin{function}[EXP]{\setCJKmathfont}
%   \begin{syntax}
%     \cs{setCJKmathfont} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   设置数学公式中的 CJK 字体族。如果使用了 |CJKmath| 选项,但是没有使用
%   |\setCJKmathfont| 设置数学公式中的 CJK 字体,那么将使用 |\CJKfamilydefault|
%   作为数学公式中的 CJK 字体。
% \end{function}
%
% \begin{function}[EXP]{\setCJKfallbackfamilyfont}
%   \begin{syntax}
%     \cs{setCJKfallbackfamilyfont} \Arg{family} \oarg{font features} \Arg{font name}
%   \end{syntax}
%   设置 CJK 字体族 \meta{family} 的备用字体。例如,使用
%   \begin{verbatim}
%     \setCJKmainfont{SimSun}
%     \setCJKfallbackfamilyfont{\CJKrmdefault}{SimSun-ExtB}
%   \end{verbatim}
%   可以将 |SimSun-ExtB| 作为 |SimSun| 的备用字体。
% \end{function}
%
% \begin{function}{FallBack}
%   \begin{syntax}
%     FallBack = \argbrace{\oarg{font features}\Arg{font name}}
%   \end{syntax}
%   \pkg{xeCJK} 在 \meta{font features} 里增加了 |FallBack| 这个选项。用来在声明主
%   字体的时候,同时设置备用字体。例如,上面的例子等价于:
%   \begin{verbatim}
%     \setCJKmainfont[FallBack=SimSun-ExtB]{SimSun}
%   \end{verbatim}
%   如果 |FallBack| 的值为空,将设置的是备用字体。例如,
%   \begin{verbatim}
%     \setCJKmainfont[FallBack,AutoFakeBold,Scale=.97]{SimSun-ExtB}
%   \end{verbatim}
%   等价于
%   \begin{verbatim}
%     \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeBold,Scale=.97]{SimSun-ExtB}
%   \end{verbatim}
% \end{function}
%
% \begin{function}[EXP]{\setCJKfallbackfamilyfont}
%   \begin{syntax}
%     \cs{setCJKfallbackfamilyfont} \Arg{family} \oarg{common font features}
%        \  \char`\{
%        \    \argbrace{\oarg{font features 1} \Arg{font name 1}} ,
%        \    \argbrace{\oarg{font features 2} \Arg{font name 2}} ,
%        \     ......
%        \  \char`\}
%   \end{syntax}
%   |\setCJKfallbackfamilyfont| 还可以用于设置多层的备用字体。例如,使用
%   \begin{verbatim}
%     \setCJKmainfont[AutoFakeBold,AutoFakeSlant]{KaiTi_GB2312}
%     \setCJKfallbackfamilyfont{\CJKrmdefault}[AutoFakeSlant]
%       { [BoldFont=SimHei]{SimSun} ,
%         [AutoFakeBold]   {SimSun-ExtB} }
%   \end{verbatim}
%   之后,就设置了 |SimSun| 是 |KaiTi_GB2312| 的备用字体,而 |SimSun-ExtB| 是
%   |SimSun| 的备用字体。
% \end{function}
%
% \subsubsection{\XeTeX 的字体名查找}
% \label{subsubsec:fontsearch}
%
% 由于在 \pkg{fontspec} 宏包文档中缺少关于如何查看 \XeTeX{} 可用字体名的说明,
% 这里略作说明。
%
% \XeTeX{} 通常使用 fontconfig 库查找和调用字体,因此,可以用 |fc-list| 命令显
% 示可用的字体。在命令行(Windows 的“命令提示符”,Linux 的 Console)下运行以
% 下命令:
% \begin{verbatim}
%     fc-list > fontlist.txt
% \end{verbatim}
% 可以将系统中所有安装的字体列表存入 \file{fontlist.txt} 文件中(可能很长)。
%
% |fc-list| 命令列出的信息很多,而且在安装字体较多的 Windows 系统上的输出将非
% 常庞大,如其中可能包含:
% \begin{verbatim}[formatcom=\fontspec{CMU Typewriter Text}\CJKfixedspacing]
% Times New Roman:style=cursiva,kurzíva,kursiv,Πλάγια,Italic,
%   Kursivoitu,Italique,Dőlt,Corsivo,Cursief,kursywa,Itálico,Курсив,
%   İtalik,Poševno,nghiêng,Etzana
% Times New Roman:style=Negreta cursiva,tučné kurzíva,fed kursiv,
%   Fett Kursiv,Έντονα Πλάγια,Bold Italic,Negrita Cursiva,
%   Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,
%   Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,
%   Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,
%   Krepko poševno,nghiêng đậm,Lodi etzana
% Times New Roman:style=Negreta,tučné,fed,Fett,Έντονα,Bold,Negrita,
%   Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiona,Negrito,
%   Полужирный,Fet,Kalın,Krepko,đậm,Lodia
% Times New Roman:style=Normal,obyčejné,Standard,Κανονικά,Regular,
%   Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,
%   thường,Arrunta
% 宋体,SimSun:style=Regular
% 黑体,SimHei:style=Normal,obyčejné,Standard,Κανονικά,Regular,Normaali,
%   Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
% \end{verbatim}
% 在 \pkg{fontspec} 或 \pkg{xeCJK} 中使用的字体族名是上面列表中冒号前的部分。
% 例如可以使用
% \begin{verbatim}
%     \setmainfont{Times New Roman}
%     \setCJKmainfont{SimSun} % 或者 \setCJKmainfont{宋体}
% \end{verbatim}
% 来设置字体。
%
% 为了方便起见,|fc-list| 命令也可以加上各种选项控制输出格式,例如如果只要列出
% 所有的中文字体的字体族名,可以用命令:
% \begin{verbatim}
%     fc-list -f "%{family}\n" :lang=zh  > zhfont.txt
% \end{verbatim}
% 这样就把字体列表保存在文件 \file{zhfont.txt} 中\footnote{由于汉字编码原因,
% Windows 下总需要把字体列表输出的文件中防止乱码。}。这样列出的字体列表就比较
% 简明易用,如 Windows 下预装的中文字体:
% \begin{verbatim}
% Arial Unicode MS
% FangSong,仿宋
% KaiTi,楷体
% Microsoft YaHei,微软雅黑
% MingLiU,細明體
% NSimSun,新宋体
% PMingLiU,新細明體
% SimHei,黑体
% SimSun,宋体
% \end{verbatim}
% 要列出日文和韩文的字体,可以把 |:lang=zh| 选项中的 |zh| 改成 |ja| 或 |ko|。
%
% \pkg{fontspec} 和 \pkg{xeCJK} 也可以使用字体的文件名访问字体。例如 Windows
% 下的宋体也可以使用命令:
% \begin{verbatim}
%     \setCJKmainfont{simsun.ttc}
% \end{verbatim}
% 来设置。设置字体文件名的相关选项和语法在 \pkg{fontspec} 宏包手册中叙述甚详,
% 这里不再赘述。有个别字体名不规范的中文字体,\pkg{xeCJK} 宏包可能无法正确地通
% 过字体名访问,那么也可以使用这种方式设置。
%
% \subsection{CJK 分区字体设置}
% \label{subsec:block}
%
% 众所周知,CJK 文字数量极其庞大,单一的字体不可能涵盖所有的 CJK 文字。\pkg{xeCJK} 可
% 以在同一 CJK 字体族下,自动使用不同的字体输出 CJK 字符范围内不同区块里的文字。首先要
% 声明 CJK 子分区。
%
% \begin{function}[EXP]{\xeCJKDeclareSubCJKBlock}
%   \begin{syntax}
%     \cs{xeCJKDeclareSubCJKBlock}  \Arg{block} \Arg{block range}
%     \cs{xeCJKDeclareSubCJKBlock*} \Arg{block} \Arg{block range}
%   \end{syntax}
%   其中 \meta{block range} 是逗号列表,可以是 CJK 字符的 |Unicode| 范围,也可以是单个字符
%   的 |Unicode|。例如
%   \begin{verbatim}
%     { `中 -> `文 , "3400 -> "4DBF , "5000 -> "7000 , `汉 , `字 , "3500 }
%   \end{verbatim}
%   的形式。需要注意的是,这里设置的 \meta{block range} 除非确实需要(例如某些特殊字体使用
%   了 |Unicode| 中的私人使用区的情况),否则不要超出源代码中预设的
%   \hyperlink{CJKcharclass}{CJK 文字范围}。使用
%   \begin{verbatim}
%     \xeCJKDeclareSubCJKBlock{SPUA}{ "E400 -> "E4DA , "E500 -> "E5E8 , "E600 -> "E6CE }
%     \xeCJKDeclareSubCJKBlock{Ext-B}{ "20000 -> "2A6DF }
%   \end{verbatim}
%   就声明了 |SPUA| 和 |Ext-B| 这两个个子分区。同时在 \ref{subsec:fontset} 节介绍的
%   CJK 字体设置命令的 \meta{font features} 里新建了 |SPUA| 和 |Ext-B| 这两个选项。
%   新建的这两个选项的使用方法跟 \ref{subsec:fontset} 介绍的 |FallBack| 类似。可以
%   通过它们来设置字体。\strut
% \end{function}
%
%   例如,可以使用
%   \begin{verbatim}
%     \setCJKmainfont[SPUA=SunmanPUA,Ext-B=SimSun-ExtB]{SimSun}
%   \end{verbatim}
%   设置文档的主字体是 |SimSun|,|SPUA| 分区的字体是 |SunmanPUA|,而 |Ext-B| 分区
%   的字体是 |SimSun-ExtB|。
%
%   |\xeCJKDeclareSubCJKBlock| 应该在声明所有的 CJK 字体族之前使用。如果有某个 CJK 字
%   体族没有设置 \meta{block} 选项,将使用 |\CJKfamilydefault| 的 \meta{block} 选项
%   作为该 CJK 字体族的 \meta{block} 选项。如果希望在使用某 CJK 字体族时,不在 CJK 主
%   分区与 \meta{block} 之间切换字体,可以使用 \meta{block}|=*| 选项。带星号的命令除了
%   设置 CJK 子分区以外,还重置标点符号所属的字符类。
%
% \begin{function}{\xeCJKCancelSubCJKBlock}
%   \begin{syntax}
%     \cs{xeCJKCancelSubCJKBlock}  \Arg{block1,block2,...}
%     \cs{xeCJKCancelSubCJKBlock*} \Arg{block1,block2,...}
%   \end{syntax}
%   在文档中取消对 |CJK| 分区的声明。带星号的命令还重置标点符号所属的字符类。
% \end{function}
%
% \begin{function}{\xeCJKRestoreSubCJKBlock}
%   \begin{syntax}
%     \cs{xeCJKRestoreSubCJKBlock}  \Arg{block1,block2,...}
%     \cs{xeCJKRestoreSubCJKBlock*} \Arg{block1,block2,...}
%   \end{syntax}
%   在文档中恢复对 |CJK| 分区的声明。带星号的命令还重置标点符号所属的字符类。
% \end{function}
%
% \subsection{设置 CJK 字符范围}
%
% \begin{function}[EXP]{\xeCJKDeclareCharClass}
%   \begin{syntax}
%     \cs{xeCJKDeclareCharClass}  \Arg{class} \Arg{class range}
%     \cs{xeCJKDeclareCharClass*} \Arg{class} \Arg{class range}
%   \end{syntax}
%   \meta{class range} 的格式和 \ref{subsec:block} 节的 \meta{block range} 相同。
%   \meta{class} 的有效值见源代码(第 \ref{sec:xeCJK-class-set} 节)。\pkg{xeCJK} 已
%   经支持 |Unicode| 中所有 CJK 文字和标点。一般来说,不要轻易改变字符类别。带星号的
%   命令除了设置字符类别以外,为了确保标点处理的正确性,还重置标点符号所属的字符类。
% \end{function}
%
% \begin{function}[EXP]{\xeCJKResetPunctClass}
%   \begin{syntax}
%     \cs{xeCJKResetPunctClass}
%   \end{syntax}
%   用于重置标点符号所属的字符类。
% \end{function}
%
% \begin{function}{\normalspacedchars}
%   \begin{syntax}
%     \cs{normalspacedchars} \Arg{char list}
%   \end{syntax}
%   在 \meta{char list} 中出现的字符两端不自动添加空格,默认设置是 |/|。
% \end{function}
%
% \subsection{设置标点宽度和间距}
% \label{subsec:punct}
%
% 这里的设置对除了 |plain| 以外的所有标点处理格式都有效。
%
% \begin{function}[EXP]{\xeCJKsetwidth}
%   \begin{syntax}
%     \cs{xeCJKsetwidth} \Arg{标点列表} \Arg{dimen}
%   \end{syntax}
%   \meta{标点列表}可以是单个标点,也可以是多个标点。例如,
%   \begin{verbatim}
%     \xeCJKsetwidth{。?}{0.7em}
%   \end{verbatim}
%   将设置句号和问号所占的宽度为 |0.7em|。
% \end{function}
%
% \begin{function}[EXP]{\xeCJKsetkern}
%   \begin{syntax}
%     \cs{xeCJKsetkern} \Arg{标点1} \Arg{标点2} \Arg{dimen}
%   \end{syntax}
%   \pkg{xeCJK} 会根据选定的标点处理格式自动调整相邻两个 |CJK| 标点的距离。如果对缺省
%   配置不满意,可以使用此命令设置两个标点之间的距离。例如,
%   \begin{verbatim}
%     \xeCJKsetkern{:}{“}{0.3em}
%   \end{verbatim}
% \end{function}
%
% \section{已知问题和兼容性}
%
% 为了与 \pkg{CJKnumb} 和 \pkg{CJKulem} 宏包兼容,\pkg{xeCJK} 使用并重新定义了
% \pkg{CJK} 宏包的部分宏命令,如 |\CJKfamily|、|\CJKsymbol| 和 |\CJKpunctsymbol| 等。
% 需要指出,\pkg{xeCJK} 不需要 \pkg{CJK} 的支持,并且 \pkg{xeCJK} 自动禁止在它之后载入
% \pkg{CJK} 宏包。
%
% 可以在 \pkg{xeCJK} 之后载入 \pkg{CJKfntef} 宏包,以实现汉字加点等。
%
% \pkg{xeCJK} 依赖 \XeTeX 的 |\XeTeXinterchartoks| 机制,与使用相同机制的宏包(例如
% \pkg{polyglossia})会存在大小不一的冲突。\pkg{xeCJK} 虽然为此作了一些处理,但与它们
% 共同使用时应该小心。
%
%\end{documentation}
%
%
% \StopEventually{}
%
%
%\begin{implementation}
%
% \section{\pkg{xeCJK} 代码实现}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% \subsection{运行环境检查}
%
% \pkg{xeCJK} 必须使用 \XeTeX 引擎的支持。
%    \begin{macrocode}
\msg_new:nnn { xeCJK } { Require-XeTeX }
  {
    The~xeCJK~package~requires~XeTeX~to~function.\\\\
    You~must~change~your~typesetting~engine~to~"xelatex" \\
    instead~of~plain~"latex"~or~"pdflatex"~or~"lualatex".\\
    Loading~xeCJK~will~abort!
  }
\xetex_if_engine:F { \msg_critical:nn { xeCJK } { Require-XeTeX } }
%    \end{macrocode}
%
% 应该使用较新版本的 \pkg{expl3} 宏包。
%    \begin{macrocode}
\msg_new:nnn { xeCJK } { l3-too-old }
  {
    Support~package~'expl3'~too~old. \\\\
    Please~update~an~up~to~date~version~of~the~bundles\\\\
    'l3kernel'~and~'l3packages'\\\\
    using~your~TeX~package~manager~or~from~CTAN.\\
    Loading~xeCJK~will~abort!
  }
\@ifpackagelater { expl3 } { 2012/07/16 } { }
  { \msg_critical:nn { xeCJK } { l3-too-old } }
%    \end{macrocode}
%
%    \begin{macrocode}
\RequirePackage{xparse}
\RequirePackage{l3keys2e}
%    \end{macrocode}
%
% |\XeTeXglyphbouds| 可以得到一个字符的左右边距,用于标点压缩。
%    \begin{macrocode}
\msg_new:nnn { xeCJK } { XeTeX-too-old }
  {
    \token_to_str:N \XeTeXglyphbounds\c_space_tl is~not~defined.\\\\
    You~have~to~update~XeTeX~to~the~version~0.9995.0~or~later.
  }
\cs_if_free:NT \XeTeXglyphbounds
  {
    \msg_error:nn { xeCJK } { XeTeX-too-old }
    \AtEndOfPackage { \xeCJK_AfterPreamble:n { \punctstyle { plain } } }
  }
%    \end{macrocode}
%
% \subsection{内部工具}
%
% 分配临时变量。
% \begin{macro}[internal,var]{\l_xeCJK_tmpa_int,\l_xeCJK_tmpb_int,\l_xeCJK_tmpc_int}
%    \begin{macrocode}
\int_new:N \l_xeCJK_tmpa_int
\int_new:N \l_xeCJK_tmpb_int
\int_new:N \l_xeCJK_tmpc_int
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]{\l_xeCJK_tmpa_dim,\l_xeCJK_tmpb_dim,\l_xeCJK_tmpc_dim}
%    \begin{macrocode}
\dim_new:N \l_xeCJK_tmpa_dim
\dim_new:N \l_xeCJK_tmpb_dim
\dim_new:N \l_xeCJK_tmpc_dim
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]{\l_xeCJK_tmpa_tl,\l_xeCJK_tmpb_tl}
%    \begin{macrocode}
\tl_new:N \l_xeCJK_tmpa_tl
\tl_new:N \l_xeCJK_tmpb_tl
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]{\l_xeCJK_tmpa_clist,\l_xeCJK_tmpb_clist,\l_xeCJK_tmpc_clist}
%    \begin{macrocode}
\clist_new:N \l_xeCJK_tmpa_clist
\clist_new:N \l_xeCJK_tmpb_clist
\clist_new:N \l_xeCJK_tmpc_clist
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_no_break:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%  {\xeCJK_AtEndPreamble:n,\xeCJK_AfterPreamble:n,\xeCJK_AfterEndPreamble:n}
%  在 |\document| 前后加上各种钩子。
%    \begin{macrocode}
\tl_new:N \g_xeCJK_at_end_preamble_hook
\tl_new:N \g_xeCJK_after_preamble_hook
\tl_new:N \g_xeCJK_after_end_preamble_hook
\cs_new_protected:Npn \xeCJK_AtEndPreamble:n #1
  { \tl_gput_right:Nn \g_xeCJK_at_end_preamble_hook {#1} }
\cs_new_protected:Npn \xeCJK_AfterPreamble:n #1
  { \tl_gput_right:Nn \g_xeCJK_after_preamble_hook {#1} }
\cs_new_protected:Npn \xeCJK_AfterEndPreamble:n #1
  { \tl_gput_right:Nn \g_xeCJK_after_end_preamble_hook {#1} }
\AtBeginDocument { \g_xeCJK_after_preamble_hook }
\tl_put_left:Nn  \document { \group_end: \g_xeCJK_at_end_preamble_hook \group_begin: }
\tl_put_right:Nn \document { \g_xeCJK_after_end_preamble_hook \tex_ignorespaces:D }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_outer_macro:c}
% 判断是否是 |\outer| 宏,输入的是控制序列的名字。
%    \begin{macrocode}
\group_begin:
\char_set_lccode:nn { `\Z } { `\t }
\char_set_lccode:nn { `\Y } { `\c }
\char_set_lccode:nn { `\; } { `\: }
\char_set_lccode:nn { `\/ } { `\\ }
\tl_map_inline:nn { \T \F \C \J \K } { \char_set_lccode:nn { `#1 } { `#1 } }
\tl_map_function:nN { \O \U \Z \E \R \M \A \Y \R \; \/ } \char_set_catcode_other:N
\tl_to_lowercase:n
  {
    \group_end:
    \prg_new_conditional:Npnn \xeCJK_if_outer_macro:c #1 { p , T , F , TF }
      {
        \exp_last_unbraced:Nf \xeCJK_if_outer_macro_aux:w
          { \cs_meaning:c {#1} } OUZER ~ MAYRO ; \q_stop
      }
    \cs_new_nopar:Npn \xeCJK_if_outer_macro_aux:w #1 OUZER ~ MAYRO ; #2 \q_stop
      {
        \if_cs_exist:w c_xeCJK_prefix_ #1 _aux_tl \cs_end:
          \prg_return_true: \else: \prg_return_false: \fi:
      }
    \tl_new:c { c_xeCJK_prefix_/_aux_tl }
    \tl_new:c { c_xeCJK_prefix_/long/_aux_tl }
    \tl_new:c { c_xeCJK_prefix_/protected/_aux_tl }
    \tl_new:c { c_xeCJK_prefix_/protected/long/_aux_tl }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[TF,internal]{\xeCJK_peek_catcode_ignore_spaces:N}
% 对 \pkg{l3token} 打的补丁,使 \cs{xeCJK_peek_catcode_ignore_spaces:NTF} 可
% 用于 \cs{outer} 宏。
%    \begin{macrocode}
\token_new:Nn \l_xeCJK_peek_search_token { ? }
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NTF #1#2#3
  {
    \cs_set_eq:NN \l_xeCJK_peek_search_token #1
    \tl_set:Nn \xeCJK_peek_true:w  { \group_align_safe_end: #2 }
    \tl_set:Nn \xeCJK_peek_false:w { \group_align_safe_end: #3 }
    \group_align_safe_begin:
    \peek_after:Nw \xeCJK_peek_ignore_spaces_execute_branches:
  }
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NT #1#2
  { \xeCJK_peek_catcode_ignore_spaces:NTF #1 {#2} { } }
\cs_new_protected:Npn \xeCJK_peek_catcode_ignore_spaces:NF #1#2
  { \xeCJK_peek_catcode_ignore_spaces:NTF #1 { } {#2} }
\cs_new_nopar:Npn \xeCJK_peek_ignore_spaces_execute_branches:
  {
    \if_meaning:w \l_peek_token \c_space_token
      \tex_afterassignment:D \xeCJK_peek_ignore_spaces_execute_branches_aux:
      \exp_after:wN \cs_set_eq:NN \exp_after:wN \xeCJK_peek_tmp:w
    \else:
      \exp_after:wN \xeCJK_peek_execute_branches_catcode:
    \fi:
  }
\cs_new_protected_nopar:Npn \xeCJK_peek_ignore_spaces_execute_branches_aux:
  { \peek_after:Nw \xeCJK_peek_ignore_spaces_execute_branches: }
\cs_new_nopar:Npn \xeCJK_peek_execute_branches_catcode:
  {
    \if_catcode:w \exp_not:N \l_peek_token \exp_not:N \l_xeCJK_peek_search_token
      \exp_after:wN \xeCJK_peek_true:w
    \else:
      \exp_after:wN \xeCJK_peek_false:w
    \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_blank_x:n}
% 判断是否为空或者仅含一个空格。
%    \begin{macrocode}
\prg_new_conditional:Npnn \xeCJK_if_blank_x:n #1 { p , T , F , TF }
  {
    \if_int_compare:w \pdftex_strcmp:D { \c_empty_tl } {#1} = \c_zero
      \prg_return_true:
    \else:
      \if_int_compare:w \pdftex_strcmp:D { \c_space_tl } {#1} = \c_zero
        \prg_return_true: \else: \prg_return_false: \fi:
    \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_package_loaded:n}
% 判断宏包是否载入,可用于文档中。
%    \begin{macrocode}
\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF }
  {
    \tl_if_exist:cTF { ver@ #1 . \c_xeCJK_pkg_extension_tl }
      { \prg_return_true: } { \prg_return_false: }
  }
\tl_const:Nx \c_xeCJK_pkg_extension_tl { \@pkgextension }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%  {\xeCJK_msg_new:nn ,\xeCJK_error:n,\xeCJK_error:nx,
%   \xeCJK_warning:nx,\xeCJK_info:nx,\xeCJK_info:nxx}
% 各种信息函数的缩略形式。
%    \begin{macrocode}
\cs_new_nopar:Npn \xeCJK_msg_new:nn  { \msg_new:nnn      { xeCJK } }
\cs_new_nopar:Npn \xeCJK_error:n     { \msg_error:nn     { xeCJK } }
\cs_new_nopar:Npn \xeCJK_error:nx    { \msg_error:nnx    { xeCJK } }
\cs_new_nopar:Npn \xeCJK_warning:n   { \msg_warning:nn   { xeCJK } }
\cs_new_nopar:Npn \xeCJK_warning:nx  { \msg_warning:nnx  { xeCJK } }
\cs_new_nopar:Npn \xeCJK_warning:nxx { \msg_warning:nnxx { xeCJK } }
\cs_new_nopar:Npn \xeCJK_info:nx     { \msg_info:nnx     { xeCJK } }
\cs_new_nopar:Npn \xeCJK_info:nxx    { \msg_info:nnxx    { xeCJK } }
%    \end{macrocode}
% \end{macro}
%
% \subsection{功能开关}
%
% \begin{macro}{xeCJKactive}
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    xeCJKactive .choice:,
    xeCJKactive / true  .code:n = { \makexeCJKactive   } ,
    xeCJKactive / false .code:n = { \makexeCJKinactive } ,
    xeCJKactive      .default:n = { true },
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\makexeCJKactive, \makexeCJKinactive}
%    \begin{macrocode}
\NewDocumentCommand \makexeCJKactive   { } { \XeTeXinterchartokenstate = \c_one  }
\NewDocumentCommand \makexeCJKinactive { } { \XeTeXinterchartokenstate = \c_zero }
%    \end{macrocode}
% \end{macro}
%
% 抑制 |BOM|。
%    \begin{macrocode}
\char_set_catcode_ignore:n { "FEFF }
%    \end{macrocode}
%
% \subsection{字符类别设定}\label{sec:xeCJK-class-set}
%
% \pkg{xeCJK} 需要以下字符类别用于字符输出。其中 |Default|、|CJK|、|FullLeft|、
% |FullRight|、|Boundary| 为 \XeTeX\ 中预定义的类别,\pkg{xeCJK} 新增加了\
% |HalfLeft|、|HalfRight|、|NormalSpace|。
% \begin{center}\punctstyle{plain}
% \begin{tabular}{cll}
% \toprule
%   类别        & 说明                & 例子 \\ \midrule
% |Default|     & 西文一般符号       & abc123 \\
% |CJK|         & CJK 表意符号       & 汉字ぁぃぅ \\
% |FullLeft|    & 全角左标点         & (《:“ \\
% |FullRight|   & 全角右标点         & ,。)》” \\
% |HalfLeft|    & 半角左标点         & ( [ \{ \\
% |HalfRight|   & 半角右标点         & , . ? ) ] \} \\
% |NormalSpace| & 前后原始间距的符号 & / \\
% |Boundary|    & 边界              & 空格 \\
% \bottomrule
% \end{tabular}
% \end{center}
%
% \begin{macro}[internal,var]
%   { \xeCJK_Default_class, \xeCJK_CJK_class, \xeCJK_FullLeft_class,
%     \xeCJK_FullRight_class, \xeCJK_Boundary_class }
% 这五类是 \XeTeX\ 预定义的类别。
%    \begin{macrocode}
\int_const:Nn \xeCJK_Default_class   {   0 }
\int_const:Nn \xeCJK_CJK_class       {   1 }
\int_const:Nn \xeCJK_FullLeft_class  {   2 }
\int_const:Nn \xeCJK_FullRight_class {   3 }
\int_const:Nn \xeCJK_Boundary_class  { 255 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_new_class:n,\g_xeCJK_class_seq}
% 新建一个字符类别。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_new_class:n #1
  {
    \exp_args:Nc \newXeTeXintercharclass { xeCJK_#1_class }
    \clist_gclear_new:c { g_xeCJK_#1_range_clist }
    \seq_gput_right:Nv \g_xeCJK_class_seq { xeCJK_#1_class }
  }
\seq_new:N \g_xeCJK_class_seq
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]
%   { \xeCJK_HalfLeft_class, \xeCJK_HalfRight_class, \xeCJK_NormalSpace_class }
% 新增西文半角左/右标点和前后原始间距的符号类。
%    \begin{macrocode}
\xeCJK_new_class:n { HalfLeft }
\xeCJK_new_class:n { HalfRight }
\xeCJK_new_class:n { NormalSpace }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]
%  {\g_xeCJK_base_class_clist,\g_xeCJK_CJK_class_clist,\g_xeCJK_CJK_class_prop}
%    \begin{macrocode}
\clist_set:Nn \g_xeCJK_base_class_clist
  {
    Default, CJK, FullLeft, FullRight, Boundary,
    HalfLeft, HalfRight, NormalSpace
  }
\clist_map_inline:Nn \g_xeCJK_base_class_clist
  { \clist_gclear_new:c { g_xeCJK_#1_range_clist } }
\clist_new:N \g_xeCJK_CJK_class_clist
\prop_new:N \g_xeCJK_CJK_class_prop
\cs_new_protected_nopar:Npn \xeCJK_save_CJK_class:n #1
  {
    \clist_gput_right:Nx \g_xeCJK_CJK_class_clist {#1}
    \prop_gput:Nvx \g_xeCJK_CJK_class_prop { xeCJK_#1_class } {#1}
  }
\cs_generate_variant:Nn \prop_gput:Nnn { Nvx }
\clist_map_function:nN { CJK, FullLeft, FullRight } \xeCJK_save_CJK_class:n
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_class_num:n}
% |#1| 为字符类别名称,用于取得字符类别对应的编号。
%    \begin{macrocode}
\cs_new_nopar:Npn \xeCJK_class_num:n #1 { \tl_use:c { xeCJK_#1_class } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKDeclareCharClass}
% \begin{macro}[aux]{\xeCJK_set_char_class_aux:Nn}
% 用于设置字符所属的类别,|#1| 为类别名称,|#2| 为字符的 |Unicode|,相邻字符用
% 半角逗号隔开,支持类似 |"1100 -> "11FF| 起止范围的使用方式。
%    \begin{macrocode}
\NewDocumentCommand \xeCJKDeclareCharClass { s > { \TrimSpaces } m m }
  {
    \xeCJK_declare_char_class:nn {#2} {#3}
    \IfBooleanT {#1} { \xeCJKResetPunctClass }
  }
\cs_new_protected_nopar:Npn \xeCJK_declare_char_class:nn #1#2
  {
    \clist_gput_right:cx { g_xeCJK_#1_range_clist } {#2}
    \clist_map_inline:xn {#2}
      {
        \str_if_eq_x:nnF {##1} { -> }
          {
            \xeCJK_set_char_class_aux:Nn \xeCJK_set_char_class:nnn {##1}
            { \xeCJK_class_num:n {#1} }
          }
      }
  }
\NewDocumentCommand \xeCJK_set_char_class_aux:Nn
  { m > { \SplitArgument { 1 } { -> } } m } { #1 #2 }
\cs_generate_variant:Nn \clist_map_inline:nn { x }
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKsetcharclass}
% |#1| 和 |#2| 为字符类别起止的 |Unicode|,|#3| 为类别名称对应编号。
%    \begin{macrocode}
\NewDocumentCommand \xeCJKsetcharclass { s m m m }
  {
    \xeCJK_set_char_class:nnn {#2} {#3} {#4}
    \IfBooleanF {#1} { \xeCJKResetPunctClass }
  }
\cs_new_protected_nopar:Npn \xeCJK_set_char_class:nnn #1#2#3
  {
    \xeCJK_check_num_range:nnNN {#1} {#2} \l_xeCJK_tmpa_int \l_xeCJK_tmpb_int
    \int_set:Nn \l_xeCJK_tmpc_int {#3}
    \prop_if_in:NVTF \g_xeCJK_CJK_class_prop \l_xeCJK_tmpc_int
      { \loop \char_set_catcode_other:n \l_xeCJK_tmpa_int }
      { \loop }
      \XeTeXcharclass \l_xeCJK_tmpa_int = \l_xeCJK_tmpc_int
      \if_int_compare:w \l_xeCJK_tmpa_int < \l_xeCJK_tmpb_int
        \int_incr:N \l_xeCJK_tmpa_int
    \repeat
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_check_num_range:nnNN}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_check_num_range:nnNN #1#2#3#4
  {
    \bool_if:nTF { \xeCJK_if_blank_x_p:n {#1} || \xeCJK_if_blank_x_p:n {#2} }
      {
        \int_set:Nn #3 { \xeCJK_if_blank_x:nTF {#1} {#2} {#1} }
        \int_set_eq:NN #3 #4
      }
      {
        \int_set:Nn #3 { \int_min:nn {#1} { \IfNoValueTF {#2} {#1} {#2} } }
        \int_set:Nn #4 { \int_max:nn {#1} { \IfNoValueTF {#2} {#1} {#2} } }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKResetPunctClass}
% 用于重置标点符号所属的字符类。
%    \begin{macrocode}
\NewDocumentCommand \xeCJKResetPunctClass { }
  {
    \xeCJK_declare_char_class:nn { HalfLeft }
      { "28 , "2D , "5B , "60 , "7B }
    \xeCJK_declare_char_class:nn { HalfRight }
      { "21 , "22 , "25 , "27 , "29 , "2C , "2E , "3A , "3B , "3F , "5D , "7D , }
    \xeCJK_declare_char_class:nn { FullLeft }
      {
        "2018 , "201C , "2116 , "3008 , "300A , "300C , "300E , "3010 , "3012 ,
        "3014 , "3016 , "3018 , "301A , "301D , "3036 , "E76C , "FE59 , "FE5B ,
        "FE5D , "FE5F , "FE60 , "FE69 , "FE6B , "FF03 , "FF04 , "FF08 , "FF20 ,
        "FF3B , "FF5B , "FFE0 , "FFE1 , "FFE5 , "FFE6 ,
      }
    \xeCJK_declare_char_class:nn { FullRight }
      {
        "00B7 , "2019 , "201D , "2014 , "2025 , "2026 , "2030 , "2500 , "3001 ,
        "3002 , "3005 , "3006 , "3009 , "300B , "300D , "300F , "3011 , "3015 ,
        "3017 , "3019 , "301B , "301E , "301F , "3041 , "3043 , "3045 , "3047 ,
        "3049 , "3063 , "3083 , "3085 , "3087 , "308E , "309B , "309C , "309D ,
        "309E , "30A1 , "30A3 , "30A5 , "30A7 , "30A9 , "30C3 , "30E3 , "30E5 ,
        "30E7 , "30EE , "30F5 , "30F6 , "30FB , "30FC , "30FD , "30FE , "FE50 ,
        "FE51 , "FE52 , "FE54 , "FE55 , "FE56 , "FE57 , "FE5A , "FE5C , "FE5E ,
        "FE6A , "FF01 , "FF05 , "FF09 , "FF0C , "FF0E , "FF1A , "FF1B , "FF1F ,
        "FF3D , "FF5D , "FF61 , "FF63 , "FF64 , "FF65 , "FF67 , "FF68 , "FF69 ,
        "FF6A , "FF6B , "FF6C , "FF6D , "FF6E , "FF6F , "FF70 , "FF9E , "FF9F ,
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \hypertarget{CJKcharclass}{设置 CJK 文字的范围}。
%    \begin{macrocode}
\xeCJK_declare_char_class:nn { CJK }
  {
%    \end{macrocode}
% \begin{itemize}
% \item Hangul Jamo (谚文字母)
%    \begin{macrocode}
    "1100 -> "11FF ,
%    \end{macrocode}
% \item CJK Radicals Supplement (中日韩部首补充)
%    \begin{macrocode}
    "2E80 -> "2EFF ,
%    \end{macrocode}
% \item Kangxi Radicals (康熙部首)
%    \begin{macrocode}
    "2F00 -> "2FDF ,
%    \end{macrocode}
% \item Ideographic Description Characters (表意文字描述符)
%    \begin{macrocode}
    "2FF0 -> "2FFF ,
%    \end{macrocode}
% \item CJK Symbols and Punctuation (中日韩符号和标点)
%    \begin{macrocode}
    "3000 -> "303F ,
%    \end{macrocode}
% \item Hiragana (日文平假名)
%    \begin{macrocode}
    "3040 -> "309F ,
%    \end{macrocode}
% \item Katakana (日文片假名)
%    \begin{macrocode}
    "30A0 -> "30FF ,
%    \end{macrocode}
% \item Bopomofo (注音字母)
%    \begin{macrocode}
    "3100 -> "312F ,
%    \end{macrocode}
% \item Hangul Compatibility Jamo (谚文兼容字母)
%    \begin{macrocode}
    "3130 -> "318F ,
%    \end{macrocode}
% \item Kanbun (象形字注释标志)
%    \begin{macrocode}
    "3190 -> "319F ,
%    \end{macrocode}
% \item Bopomofo Extended (注音字母扩展)
%    \begin{macrocode}
    "31A0 -> "31BF ,
%    \end{macrocode}
% \item CJK Strokes (中日韩笔画)
%    \begin{macrocode}
    "31C0 -> "31EF ,
%    \end{macrocode}
% \item Katakana Phonetic Extensions (日文片假名语音扩展)
%    \begin{macrocode}
    "31F0 -> "31FF ,
%    \end{macrocode}
% \item Enclosed CJK Letters and Months (带圈中日韩字母和月份)
%    \begin{macrocode}
    "3200 -> "32FF ,
%    \end{macrocode}
% \item CJK Compatibility (中日韩兼容)
%    \begin{macrocode}
    "3300 -> "33FF ,
%    \end{macrocode}
% \item CJK Unified Ideographs Extension-A (中日韩统一表意文字扩展 A)
%    \begin{macrocode}
    "3400 -> "4DBF ,
%    \end{macrocode}
% \item Yijing Hexagrams Symbols (易经六十四卦符号)
%    \begin{macrocode}
    "4DC0 -> "4DFF ,
%    \end{macrocode}
% \item CJK Unified Ideographs (中日韩统一表意文字)
%    \begin{macrocode}
    "4E00 -> "9FFF ,
%    \end{macrocode}
% \item Yi Syllables (彝文音节)
%    \begin{macrocode}
    "A000 -> "A48F ,
%    \end{macrocode}
% \item Yi Radicals (彝文字根)
%    \begin{macrocode}
    "A490 -> "A4CF ,
%    \end{macrocode}
% \item Hangul Jamo Extended-A (谚文扩展 A)
%    \begin{macrocode}
    "A960 -> "A97F ,
%    \end{macrocode}
% \item Hangul Syllables (谚文音节)
%    \begin{macrocode}
    "AC00 -> "D7AF ,
%    \end{macrocode}
% \item Kana Supplement (日文假名增补)
%    \begin{macrocode}
    "B000 -> "B0FF ,
%    \end{macrocode}
% \item Hangul Jamo Extended-B (谚文扩展 B)
%    \begin{macrocode}
    "D7B0 -> "D7FF ,
%    \end{macrocode}
% \item CJK Compatibility Ideographs (中日韩兼容表意文字)
%    \begin{macrocode}
    "F900 -> "FAFF ,
%    \end{macrocode}
% \item CJK Compatibility Forms (中日韩兼容形式)
%    \begin{macrocode}
    "FE30 -> "FE4F ,
%    \end{macrocode}
% \item Halfwidth and Fullwidth Forms (半角及全角形式)
%    \begin{macrocode}
    "FF00 -> "FFEF ,
%    \end{macrocode}
% \item CJK Unified Ideographs Extension-B (中日韩统一表意文字扩展 B)
%    \begin{macrocode}
    "20000 -> "2A6DF ,
%    \end{macrocode}
% \item CJK Unified Ideographs Extension-C (中日韩统一表意文字扩展 C)
%    \begin{macrocode}
    "2A700 -> "2B73F ,
%    \end{macrocode}
% \item CJK Unified Ideographs Extension-D (中日韩统一表意文字扩展 D)
%    \begin{macrocode}
    "2B740 -> "2B81F ,
%    \end{macrocode}
% \item CJK Compatibility Ideographs Supplement (中日韩兼容表意文字增补)
%    \begin{macrocode}
    "2F800 -> "2FA1F ,
%    \end{macrocode}
% \end{itemize}
%    \begin{macrocode}
  }
%    \end{macrocode}
%
% 重置标点符号的字符类。
%    \begin{macrocode}
\xeCJKResetPunctClass
%    \end{macrocode}
%
% \begin{macro}{\normalspacedchars}
% 声明前后不加间距的字符。
%    \begin{macrocode}
\NewDocumentCommand \normalspacedchars { m }
  {
    \tl_map_inline:nn {#1}
      { \XeTeXcharclass `##1 = \xeCJK_class_num:n { NormalSpace } }
  }
\normalspacedchars{/}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%  {\xeCJK_inter_class_toks:nnn,\xeCJK_inter_class_toks:nnc,\xeCJK_inter_class_toks:nnx}
% 在相邻类别之间插入内容。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_inter_class_toks:nnn #1#2#3
  { \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} = {#3} }
\cs_generate_variant:Nn \xeCJK_inter_class_toks:nnn { nnc , nnx }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_get_inter_class_toks:nn}
% 取出相邻类别之间的内容。
%    \begin{macrocode}
\cs_new_nopar:Npn \xeCJK_get_inter_class_toks:nn #1#2
  { \tex_the:D \XeTeXinterchartoks \xeCJK_class_num:n {#1} \xeCJK_class_num:n {#2} }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_clear_inter_class_toks:nn}
% 清除相邻类别之间的内容。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_clear_inter_class_toks:nn #1#2
  { \xeCJK_inter_class_toks:nnn {#1} {#2} { \c_empty_tl } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_pre_inter_class_toks:nnn}
% 在相邻类别之间已有的内容前增加内容。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_pre_inter_class_toks:nnn #1#2#3
  {
    \xeCJK_inter_class_toks:nnx {#1} {#2}
      { \exp_not:n {#3} \xeCJK_get_inter_class_toks:nn {#1} {#2} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_app_inter_class_toks:nnn,\xeCJK_app_inter_class_toks:nnc}
% 在相邻类别之间已有的内容后追加内容。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_app_inter_class_toks:nnn #1#2#3
  {
    \xeCJK_inter_class_toks:nnx {#1} {#2}
      { \xeCJK_get_inter_class_toks:nn {#1} {#2} \exp_not:n {#3} }
  }
\cs_generate_variant:Nn \xeCJK_app_inter_class_toks:nnn { nnc }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_copy_inter_class_toks:nnnn}
% 将 |#3| 和 |#4| 之间的内容复制到 |#1| 和 |#2| 之间。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_copy_inter_class_toks:nnnn #1#2#3#4
  {
    \xeCJK_inter_class_toks:nnx {#1} {#2}
      { \xeCJK_get_inter_class_toks:nn {#3} {#4} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_clear_CJK_toks:}
% 清除边界与 CJK 文字、全角左右标点之间的内容。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_clear_CJK_toks:
  {
    \clist_map_inline:Nn \g_xeCJK_CJK_class_clist
      { \xeCJK_clear_inter_class_toks:nn { Boundary } {##1} }
  }
%    \end{macrocode}
% \end{macro}
%
% \subsection{字符输出规则}
%
% \hspace*{-.8\marginparwidth}
% \begin{tabular}{l*8c}
% \toprule
%   & |Default| & |CJK| & |FullLeft| & |FullRight| & |HalfLeft|
%   & |HalfRight| & |NormalSpace| & |Boundary| \\ \midrule
% |Default|
%   &
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   &
%   &
%   &
%   & \tokslink{def-bound}\\
% |CJK|
%   & \tokslink{def-cjk}
%   & \tokslink{cjk-cjk}
%   & \tokslink{cjk-fl-fr}
%   & \tokslink{cjk-fl-fr}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{cjk-bound}\\
% |FullLeft|
%   & \tokslink{def-cjk}
%   & \tokslink{fl-fr-bound-cjk}
%   & \tokslink{cjk-fl-fr}
%   & \tokslink{cjk-fl-fr}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{fl-fr-bound-cjk}\\
% |FullRight|
%   & \tokslink{def-cjk}
%   & \tokslink{fl-fr-bound-cjk}
%   & \tokslink{cjk-fl-fr}
%   & \tokslink{cjk-fl-fr}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{fl-fr-bound-cjk}\\
% |HalfLeft|
%   &
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk} \\
% |HalfRight|
%   &
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   &
%   &
%   &
%   & \tokslink{def-bound} \\
% |NormalSpace|
%   &
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   & \tokslink{def-cjk}
%   &
%   &
%   &
%   & \tokslink{def-bound}\\
% |Boundary|
%   & \tokslink{bound-def}
%   & \tokslink{bound-cjk}
%   & \tokslink{fl-fr-bound-cjk}
%   & \tokslink{fl-fr-bound-cjk}
%   & \tokslink{bound-def}
%   &
%   & \tokslink{bound-def}\\
% \bottomrule
% \end{tabular}
%
% \hypertarget{def-cjk}{}
%    \begin{macrocode}
\clist_map_inline:nn { Default, HalfLeft, HalfRight, NormalSpace }
  {
    \clist_map_inline:nn { CJK, FullLeft, FullRight }
      {
        \xeCJK_inter_class_toks:nnn {#1} {##1}
          {
            \c_group_begin_token
            \xeCJK_select_font:
            \xeCJK_clear_inter_class_toks:nn {#1} {##1}
            \xeCJK_clear_CJK_toks:
          }
        \xeCJK_inter_class_toks:nnn {##1} {#1} { \c_group_end_token }
      }
    \xeCJK_app_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol }
    \clist_map_inline:nn { FullLeft, FullRight }
      { \xeCJK_app_inter_class_toks:nnc {#1} {##1} { xeCJK_CJK_and_##1:N } }
  }
%    \end{macrocode}
%
% \hypertarget{bound-def}{}
%    \begin{macrocode}
\clist_map_inline:nn { Default, HalfLeft, NormalSpace }
  {
    \xeCJK_inter_class_toks:nnn { Boundary } {#1}
      {
        \bool_if:nTF
          {
            \l_xeCJK_xecglue_bool &&
            \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven &&
            \skip_if_eq_p:nn \tex_lastskip:D \l_xeCJK_space_glue_tl
          }
          {
            \tex_unskip:D
            \bool_if:nTF
              { \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } }
              { \CJKecglue } { \c_space_token }
          }
          {
            \xeCJK_if_last_node:nTF { CJK } { \CJKecglue }
              { \xeCJK_if_last_node:nT { CJK_space } { \xeCJK_space_or_xecglue: } }
          }
      }
    \str_if_eq_x:nnF {#1} { NormalSpace }
      { \xeCJK_app_inter_class_toks:nnn { CJK } {#1} { \CJKecglue } }
  }
%    \end{macrocode}
%
% \hypertarget{def-bound}{}
%    \begin{macrocode}
\clist_map_inline:nn { Default, HalfRight, NormalSpace }
  {
    \xeCJK_inter_class_toks:nnn {#1} { Boundary }
      {
        \peek_catcode:NTF \c_space_token
          { { \xeCJK_make_node:n { default_space } } }
          { { \xeCJK_make_node:n { default } } }
      }
    \str_if_eq_x:nnF {#1} { NormalSpace }
      { \xeCJK_pre_inter_class_toks:nnn {#1} { CJK } { \CJKecglue } }
  }
%    \end{macrocode}
%
% \hypertarget{bound-cjk}{}
%    \begin{macrocode}
\xeCJK_inter_class_toks:nnn { Boundary } { CJK } { \xeCJK_Boundary_and_CJK: }
%    \end{macrocode}
%
% \begin{macro}[internal]{\xeCJK_Boundary_and_CJK:,\xeCJK_check_for_glue:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_CJK:
  {
    { \xeCJK_check_for_glue: }
    \c_group_begin_token
    \xeCJK_clear_CJK_toks:
    \xeCJK_select_font:
    \CJKsymbol
  }
\cs_new_protected_nopar:Npn \xeCJK_check_for_glue:
  {
    \bool_if:nTF
      { \xeCJK_if_last_node_p:n { CJK } || \xeCJK_if_last_node_p:n { CJK_space } }
      { \CJKglue }
      {
        \bool_if:nTF
          {
            \xeCJK_if_last_node_p:n { default }              ||
            \int_compare_p:nNn \etex_lastnodetype:D = \c_ten ||
            \xeCJK_if_last_node_p:n { default_itcorr }
          }
          { \CJKecglue }
          {
            \bool_if:nT
              {
                \l_xeCJK_xecglue_bool &&
                \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven &&
                ( \skip_if_eq_p:nn \tex_lastskip:D \l_xeCJK_space_glue_tl ||
                  \dim_compare_p:nNn \tex_lastskip:D = \l_xeCJK_ecglue_dim )
              }
              {
                \tex_unskip:D
                \bool_if:nTF
                  {
                    \xeCJK_if_last_node_p:n { default_space }        ||
                    \int_compare_p:nNn \etex_lastnodetype:D = \c_ten ||
                    \xeCJK_if_last_node_p:n { default }              ||
                    \xeCJK_if_last_node_p:n { default_itcorr }
                  }
                  { \CJKecglue }
                  {
                    \bool_if:nTF
                      {
                        \xeCJK_if_last_node_p:n { CJK }       ||
                        \xeCJK_if_last_node_p:n { CJK_space }
                      }
                      { \bool_if:NTF \l_xeCJK_space_bool \c_space_token \CJKglue }
                      { \c_space_token }
                  }
              }
          }
      }
  }
\tl_set:Nn \l_xeCJK_space_glue_tl
  {
    \tex_fontdimen:D \c_two \tex_font:D
    \@plus  \tex_fontdimen:D \c_three \tex_font:D
    \@minus \tex_fontdimen:D \c_four  \tex_font:D
  }
%    \end{macrocode}
% \end{macro}
%
% \hypertarget{cjk-bound}{}
%    \begin{macrocode}
\xeCJK_inter_class_toks:nnn { CJK } { Boundary }
  {
    \c_group_end_token
    { \xeCJK_make_node:n { CJK } }
    \xeCJK_ignorespaces:
  }
%    \end{macrocode}
%
% \hypertarget{cjk-cjk}{}
%    \begin{macrocode}
\xeCJK_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N }
%    \end{macrocode}
%
% \begin{macro}[internal]{\xeCJK_CJK_and_CJK:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} }
%    \end{macrocode}
% \end{macro}
%
% \hypertarget{fl-fr-bound-cjk}{}
%    \begin{macrocode}
\clist_map_inline:nn { FullLeft, FullRight }
  {
    \xeCJK_inter_class_toks:nnn { Boundary } {#1}
      {
        \c_group_begin_token
        \xeCJK_clear_CJK_toks:
        \xeCJK_select_font:
        \use:c { xeCJK_CJK_and_#1:N }
      }
    \xeCJK_inter_class_toks:nnn {#1} { CJK } { \CJKsymbol }
    \xeCJK_inter_class_toks:nnn {#1} { Boundary } { \c_group_end_token \tex_ignorespaces:D }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\clist_map_inline:Nn \g_xeCJK_base_class_clist
  {
    \bool_if:nF
      { \str_if_eq_x_p:nn {#1} { FullLeft } || \str_if_eq_x_p:nn {#1} { FullRight } }
      {
        \xeCJK_pre_inter_class_toks:nnn { FullLeft }  {#1} { \xeCJK_no_break: }
        \xeCJK_pre_inter_class_toks:nnn { FullRight } {#1} { \xeCJK_after_FullRight: }
      }
  }
%    \end{macrocode}
%
% \hypertarget{cjk-fl-fr}{}
%    \begin{macrocode}
\clist_map_inline:nn { CJK, FullLeft, FullRight }
  {
    \clist_map_inline:nn { FullLeft, FullRight }
      { \xeCJK_inter_class_toks:nnc {#1} {##1} { xeCJK_#1_and_##1:N } }
  }
%    \end{macrocode}
%
% \begin{macro}[internal]{\xeCJK_punct_rule:n}
% 用于抹去标点符号的左/右空白。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_punct_rule:n #1
  {
    \tex_vrule:D
      \@width  \dim_eval:c { \l_xeCJK_punct_coor_tl/rule/#1 }
      \@depth  \c_zero_dim
      \@height \c_zero_dim \scan_stop:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_punct_glue:n}
% 根据所选的标点处理方式在标点符号左/右增加的空白。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_punct_glue:n #1
  {
    \skip_horizontal:n
      {
        \dim_eval:c { \l_xeCJK_punct_coor_tl/glue/#1 }
        \@plus  \dim_eval:n { ( \tl_use:c { \l_xeCJK_punct_coor_tl/glue/#1 } ) /4 }
        \@minus \dim_eval:n { ( \tl_use:c { \l_xeCJK_punct_coor_tl/glue/#1 } ) /2 }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_punct_kern:n}
% 相邻两个标点之间的间距。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_punct_kern:n #1
  { \tex_kern:D \dim_eval:c { \l_xeCJK_punct_coor_tl/kern/#1 } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\dim_eval:c}
%    \begin{macrocode}
\cs_generate_variant:Nn \dim_eval:n { c }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_before_FullLeft:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_before_FullLeft:N #1
  {
    \tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
    \xeCJK_punct_rule:n { l/#1 }
    \CJKpunctsymbol {#1}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_after_FullRight:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_after_FullRight:
  {
    \xeCJK_get_punct_bounds:nV { r } \l_xeCJK_lastpunct_tl
    \xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
    \xeCJK_punct_glue:n { r/\l_xeCJK_lastpunct_tl }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_CJK_and_FullLeft:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullLeft:N #1
  {
    \xeCJK_get_punct_bounds:nN { l } {#1}
    \int_compare:nNnF \etex_lastnodetype:D = \c_one
      { \xeCJK_punct_glue:n { l/#1 } }
    \xeCJK_before_FullLeft:N {#1}
    \xeCJK_punct_if_middle:NT {#1}
      {
        \xeCJK_punct_rule:n { m/#1 }
        \xeCJK_punct_glue:n { l/#1 }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_CJK_and_FullRight:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_CJK_and_FullRight:N #1
  {
    \xeCJK_get_punct_bounds:nN { r } {#1}
    \xeCJK_punct_if_long:NTF {#1} \CJKglue
      {
        \xeCJK_no_break:
        \xeCJK_punct_if_middle:NT {#1}
          {
            \xeCJK_punct_glue:n { r/#1 }
            \xeCJK_punct_rule:n { m/#1 }
          }
      }
    \tl_gset:Nx \l_xeCJK_lastpunct_tl {#1}
    \CJKpunctsymbol {#1}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_FullLeft_and_FullLeft:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullLeft:N #1
  {
    \xeCJK_no_break:
    \xeCJK_get_punct_bounds:nN { l } {#1}
    \xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
    \xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
    \xeCJK_before_FullLeft:N {#1}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_FullLeft_and_FullRight:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_FullLeft_and_FullRight:N #1
  {
    \xeCJK_no_break:
    \xeCJK_get_punct_bounds:nN { r } {#1}
    \xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
    \xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
    \xeCJK_no_break:
    \tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
    \CJKpunctsymbol {#1}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_FullRight_and_FullLeft:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullLeft:N #1
  {
    \xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
    \xeCJK_get_punct_bounds:nN { l } {#1}
    \xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
    \xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
    \xeCJK_punct_nobreak:
    \xeCJK_before_FullLeft:N {#1}
 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_FullRight_and_FullRight:N}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_FullRight_and_FullRight:N #1
  {
    \xeCJK_punct_rule:n { r/\l_xeCJK_lastpunct_tl }
    \xeCJK_get_punct_bounds:nN { r } {#1}
    \xeCJK_get_kern:VN \l_xeCJK_lastpunct_tl {#1}
    \xeCJK_punct_kern:n { \l_xeCJK_lastpunct_tl - #1 }
    \xeCJK_no_break:
    \tl_set:Nx \l_xeCJK_lastpunct_tl {#1}
    \CJKpunctsymbol {#1}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_last_node:n}
%    \begin{macrocode}
 \prg_new_conditional:Npnn \xeCJK_if_last_node:n #1 { p , T , F , TF }
  {
    \if_dim:w \dim_use:c { c_xeCJK_#1_node_dim } = \tex_lastkern:D
      \prg_return_true: \else: \prg_return_false: \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_def_node:nn,\xeCJK_make_node:n}
% 用于判断插入的各种 |kern|。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_def_node:nn #1#2
  {
    \dim_if_exist:cTF { c_xeCJK_#1_node_dim }
      { \dim_gset:cn } { \dim_const:cn }
    { c_xeCJK_#1_node_dim } {#2}
  }
\cs_new_protected_nopar:Npn \xeCJK_make_node:n #1
  {
    \tex_kern:D - \dim_use:c { c_xeCJK_#1_node_dim }
    \tex_kern:D   \dim_use:c { c_xeCJK_#1_node_dim }
  }
\xeCJK_def_node:nn { CJK }            { 11 sp }
\xeCJK_def_node:nn { CJK_space }      { 12 sp }
\xeCJK_def_node:nn { default }        { 13 sp }
\xeCJK_def_node:nn { default_space }  { 14 sp }
\xeCJK_def_node:nn { default_itcorr } { 15 sp }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CJKglue}
% CJK 文字之间插入的 |glue|。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options } { CJKglue .tl_set:N = \CJKglue }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CJKecglue,xCJKecglue}
% CJK 与西文和数学行内数学公式之间自动添加的空白。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    CJKecglue .code:n =
      {
        \cs_set:Npn \CJKecglue {#1}
        \settowidth \l_xeCJK_ecglue_dim \CJKecglue
      },
    xCJKecglue .choice:,
    xCJKecglue / true    .code:n =
      {
        \bool_set_true:N  \l_xeCJK_xecglue_bool
        \cs_set_eq:NN \xeCJK_space_or_xecglue: \CJKecglue
      },
    xCJKecglue / false   .code:n =
      {
        \bool_set_false:N \l_xeCJK_xecglue_bool
        \cs_set_eq:NN \xeCJK_space_or_xecglue: \c_space_token
      },
    xCJKecglue / unknown .code:n =
      {
        \bool_set_true:N  \l_xeCJK_xecglue_bool
        \cs_set:Npn \CJKecglue {#1}
        \settowidth \l_xeCJK_ecglue_dim \CJKecglue
        \cs_set_eq:NN \xeCJK_space_or_xecglue: \CJKecglue
      },
    xCJKecglue .default:n = { true } ,
  }
\dim_new:N \l_xeCJK_ecglue_dim
\bool_new:N \l_xeCJK_xecglue_bool
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CJKspace}
% 是否保留 CJK 文字间的空白,默认不保留。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    CJKspace .choice:,
    CJKspace / true  .code:n = { \CJKspace   },
    CJKspace / false .code:n = { \CJKnospace },
    CJKspace      .default:n = { true },
    space         .meta:n = { CJKspace = true  },
    nospace       .meta:n = { CJKspace = false },
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\CJKspace,\CJKnospace}
% 是否保留 CJK 文字间的空白,默认不保留。
%    \begin{macrocode}
\NewDocumentCommand \CJKspace { }
  {
    \bool_set_true:N \l_xeCJK_space_bool
    \cs_set_eq:NN \xeCJK_ignorespaces: \xeCJK_peek_math:
  }
\NewDocumentCommand \CJKnospace { }
  {
    \bool_set_false:N \l_xeCJK_space_bool
    \cs_set_eq:NN \xeCJK_ignorespaces: \xeCJK_ignore_spaces:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_ignore_spaces:,\xeCJK_peek_math:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_ignore_spaces:
  {
    \peek_catcode:NTF \c_space_token
      {
        \xeCJK_if_last_node:nT { CJK }
          { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK_space } } }
        \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token
          { \xeCJK_space_or_xecglue: }
          {
            \bool_if:nT
              {
                \xeCJK_if_outer_macro_p:c { l_peek_token } ||
                \token_if_cs_p:c { l_peek_token }
              }
              { \xeCJK_space_or_xecglue: }
          }
      }
      {
        \xeCJK_if_outer_macro:cF { l_peek_token }
          {
            \token_if_math_toggle:cTF { l_peek_token } \CJKecglue
              { \cs_if_exist:cF { l_peek_token } \exp_not:N }
          }
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_peek_math:
  {
    \peek_catcode:NTF \c_space_token
      {
        \xeCJK_if_last_node:nT { CJK }
          { \tex_unkern:D \tex_unkern:D { \xeCJK_make_node:n { CJK_space } } }
        \xeCJK_peek_catcode_ignore_spaces:NF \c_space_token
          { \xeCJK_space_or_xecglue: }
      }
      {
        \xeCJK_if_outer_macro:cF { l_peek_token }
          {
            \token_if_math_toggle:cTF { l_peek_token } \CJKecglue
              { \cs_if_exist:cF { l_peek_token } \exp_not:N }
          }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \subsection{段末孤字处理}
%
% \begin{macro}{CheckSingle}
% 孤字处理功能选项。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    CheckSingle .choice:,
    CheckSingle / true  .code:n = { \xeCJKenablechecksingle  },
    CheckSingle / false .code:n = { \xeCJKdisablechecksingle },
    CheckSingle      .default:n = { true },
    CJKchecksingle      .meta:n = { CheckSingle = true } ,
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKenablechecksingle,\xeCJKdisablechecksingle}
% 孤字处理功能开关。
%    \begin{macrocode}
\bool_new:N \l_xeCJK_checksingle_bool
\NewDocumentCommand \xeCJKenablechecksingle { }
  {
    \bool_if:NF \l_xeCJK_checksingle_bool
      {
        \bool_set_true:N \l_xeCJK_checksingle_bool
        \cs_set_eq:NN \xeCJK_checksingle_save_CJKsymbol:N \xeCJK_CJK_and_CJK:N
        \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_checksingle:N
      }
  }
\NewDocumentCommand \xeCJKdisablechecksingle { }
  {
    \bool_if:NT \l_xeCJK_checksingle_bool
      {
        \bool_set_false:N \l_xeCJK_checksingle_bool
        \cs_set_eq:NN \xeCJK_CJK_and_CJK:N \xeCJK_checksingle_save_CJKsymbol:N
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_checksingle:N,\xeCJK_checksingle:NN,\xeCJK_checksingle:NNN}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_checksingle:N #1
  {
    \peek_catcode:NTF \c_catcode_other_token
      { \xeCJK_checksingle:NN {#1} }
      {
        \bool_if:nTF
          {
            ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } )                    &&
            \xeCJK_if_blank_x_p:n { \token_get_arg_spec:c { l_peek_token } }    &&
            \exp_args:NNc \exp_args:No \tl_if_single_token_p:n { l_peek_token } &&
            \exp_args:NNc \exp_after:wN \token_if_other_p:N { l_peek_token }
          }
          { \xeCJK_checksingle:NN {#1} }
          { \xeCJK_checksingle_save_CJKsymbol:N {#1} }
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_checksingle:NN #1#2
  {
    \peek_catcode:NTF \c_catcode_other_token
      { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 }
      {
        \bool_if:nTF
          {
            ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } )  &&
              ( \token_if_space_p:c       { l_peek_token } ||
                \token_if_math_toggle_p:c { l_peek_token } ||
                \token_if_cs_p:c          { l_peek_token } )
          }
          {
            \bool_if:nTF { \token_if_space_p:c { l_peek_token } }
              {
                \xeCJK_peek_catcode_ignore_spaces:NTF \c_catcode_other_token
                  { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token }
                  {
                    \bool_if:nTF
                      {
                        ! ( \xeCJK_if_outer_macro_p:c { l_peek_token } )  &&
                          ( \token_if_math_toggle_p:c { l_peek_token } ||
                            \token_if_cs_p:c          { l_peek_token } )
                      }
                      { \xeCJK_checksingle:NNN {#1} {#2} \c_space_token }
                      { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 \c_space_token }
                  }
              }
              { \xeCJK_checksingle:NNN {#1} {#2} { } }
          }
          { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2 }
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_checksingle:NNN #1#2#3
  {
    \bool_if:nTF
      {
        \token_if_eq_meaning_p:NN \l_peek_token \par ||
        \token_if_eq_meaning_p:NN \l_peek_token \[ % \]
      }
      { \CJKsymbol {#1} \xeCJK_no_break: #2 }
      { \xeCJK_checksingle_env:NNN {#1} {#2} {#3} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_checksingle_env:NNN,\xeCJK_checksingle_env:NNNNn}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNN #1#2#3
  {
    \peek_catcode_remove:NTF \c_math_toggle_token
      {
        \peek_catcode:NTF \c_math_toggle_token
          { \CJKsymbol {#1} \xeCJK_no_break: #2 \c_math_toggle_token }
          { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 \c_math_toggle_token }
      }
      {
        \peek_meaning_remove:NTF \begin
          { \xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \begin }
          {
            \peek_meaning_remove:NTF \end
              { \xeCJK_checksingle_env:NNNNn {#1} {#2} {#3} \end }
              { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 }
          }
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_checksingle_env:NNNNn #1#2#3#4#5
  {
    \clist_if_in:NnTF \g_xeCJK_inline_env_clist {#5}
      { \xeCJK_checksingle_save_CJKsymbol:N {#1} #2#3 }
      { \CJKsymbol {#1} \xeCJK_no_break: #2 }
    \scan_stop: #4 {#5}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{InlineEnv,InlineEnv+,InlineEnv-}
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    InlineEnv .clist_gset:N = \g_xeCJK_inline_env_clist ,
    InlineEnv+      .code:n =
      {
        \clist_gput_right:Nx \g_xeCJK_inline_env_clist {#1}
        \clist_gremove_duplicates:N \g_xeCJK_inline_env_clist
      },
    InlineEnv-      .code:n =
      {
        \clist_map_inline:xn {#1}
          { \clist_gremove_all:Nn \g_xeCJK_inline_env_clist {##1} }
      },
  }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\cs_generate_variant:Nn \token_if_cs_p:N          { c }
\cs_generate_variant:Nn \token_if_space_p:N       { c }
\cs_generate_variant:Nn \token_get_arg_spec:N     { c }
\cs_generate_variant:Nn \token_if_math_toggle_p:N { c }
\cs_generate_variant:Nn \token_if_math_toggle:NTF { c }
%    \end{macrocode}
%
% \subsection{增加 CJK 子分区}
%
% \begin{macro}[internal]{\xeCJK_UL_subclass_patch_tl,\g_xeCJK_CJK_subclass_clist}
%    \begin{macrocode}
\tl_new:N \xeCJK_UL_subclass_patch_tl
\clist_new:N \g_xeCJK_CJK_subclass_clist
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_erase_CJKsymbol:, \xeCJK_restore_CJKsymbol:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_erase_CJKsymbol:
  {
    \cs_gset_eq:NN \CJKsymbol_Block \CJKsymbol
    \cs_gset_eq:NN \CJKsymbol \prg_do_nothing:
  }
\cs_new_protected_nopar:Npn \xeCJK_restore_CJKsymbol:
  {
    \cs_gset_eq:NN \CJKsymbol \CJKsymbol_Block
    \CJKsymbol
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKDeclareSubCJKBlock}
% 声明 CJK 子区范围,|#1| 为自定义名称,|#2| 为子区的 |Unicode| 范围。
%    \begin{macrocode}
\NewDocumentCommand \xeCJKDeclareSubCJKBlock { s m m }
  {
    \xeCJKDeclareSubCharClass { CJK } {#2} {#3}
    \IfBooleanT {#1} { \xeCJKResetPunctClass }
  }
\@onlypreamble \xeCJKDeclareSubCJKBlock
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKCancelSubCJKBlock,\xeCJKRestoreSubCJKBlock}
% 取消和恢复对 CJK 子区的声明。
%    \begin{macrocode}
\bool_new:N \l_xeCJK_sub_cancel_bool
\NewDocumentCommand \xeCJKCancelSubCJKBlock { s m }
  {
    \bool_if:NF \l_xeCJK_sub_cancel_bool
      {
        \bool_set_true:N \l_xeCJK_sub_cancel_bool
        \xeCJK_sub_restore_or_cancel:n {#2}
        \IfBooleanT {#1} { \xeCJKResetPunctClass }
      }
  }
\NewDocumentCommand \xeCJKRestoreSubCJKBlock { s m }
  {
    \bool_if:NT \l_xeCJK_sub_cancel_bool
      {
        \bool_set_false:N \l_xeCJK_sub_cancel_bool
        \xeCJK_sub_restore_or_cancel:n {#2}
        \IfBooleanT {#1} { \xeCJKResetPunctClass }
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_sub_restore_or_cancel:n #1
  {
    \clist_map_inline:xn {#1}
      {
        \cs_if_free:cTF { xeCJK_ CJK/##1 _class }
          { \xeCJK_error:nx { SubBlock-undefined } {##1} }
          {
            \xeCJK_declare_char_class:nn
              { CJK \bool_if:NF \l_xeCJK_sub_cancel_bool { /##1 } }
              { \tl_use:c { g_xeCJK_CJK/##1_range_clist } }
          }
      }
  }
\xeCJK_msg_new:nn { SubBlock-undefined }
  {
    The~CJK~sub~block~'#1'~is~undefined.\\\\
    Try~to~use~\token_to_str:N \xeCJKDeclareSubCJKBlock \c_space_tl
    to~declare~it.
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKDeclareSubCharClass}
%    \begin{macrocode}
\NewDocumentCommand \xeCJKDeclareSubCharClass
  { > { \TrimSpaces } m > { \TrimSpaces } m m }
  {
    \cs_if_free:cT { xeCJK_ #1/#2 _class }
      {
        \xeCJK_new_class:n { #1/#2 }
        \xeCJK_set_sub_class_toks:nn {#1} {#2}
        \xeCJK_new_sub_key:n {#2}
        \xeCJK_UL_subclass_patch:nn {#1} {#2}
      }
    \xeCJK_declare_char_class:nn { #1/#2 } {#3}
  }
\@onlypreamble \xeCJKDeclareSubCharClass
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_sub_class_toks:nn}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_sub_class_toks:nn #1#2
  {
    \clist_map_inline:Nn \g_xeCJK_base_class_clist
      {
        \xeCJK_copy_inter_class_toks:nnnn { #1/#2 } {##1} {#1}  {##1}
        \xeCJK_copy_inter_class_toks:nnnn {##1} { #1/#2 } {##1} {#1}
        \str_if_eq_x:nnTF {##1} { CJK }
          {
            \xeCJK_pre_inter_class_toks:nnn {##1} { #1/#2 }
              { \xeCJK_switch_font:nn {#1} {#2} }
          }
          {
            \xeCJK_pre_inter_class_toks:nnn {##1} { #1/#2 }
              { \xeCJK_erase_CJKsymbol: }
            \xeCJK_app_inter_class_toks:nnn {##1} { #1/#2 }
              { \xeCJK_switch_font:nn {#1} {#2} \xeCJK_restore_CJKsymbol: }
          }
      }
    \xeCJK_copy_inter_class_toks:nnnn { #1/#2 } { #1/#2 } {#1} {#1}
    \clist_if_empty:NF \g_xeCJK_CJK_subclass_clist
      {
        \clist_map_inline:Nn \g_xeCJK_CJK_subclass_clist
          {
            \xeCJK_copy_inter_class_toks:nnnn { #1/#2  } { #1/##1 } {#1} {#1}
            \xeCJK_copy_inter_class_toks:nnnn { #1/##1 } { #1/#2  } {#1} {#1}
            \xeCJK_pre_inter_class_toks:nnn { #1/#2 } { #1/##1 }
              { \xeCJK_switch_font:nn {#2} {##1} }
            \xeCJK_pre_inter_class_toks:nnn { #1/##1 } { #1/#2 }
              { \xeCJK_switch_font:nn {##1} {#2} }
          }
      }
    \clist_gput_right:Nn \g_xeCJK_CJK_subclass_clist {#2}
    \xeCJK_save_CJK_class:n { #1/#2 }
    \clist_map_inline:nn { CJK, FullLeft, FullRight }
      {
        \xeCJK_pre_inter_class_toks:nnn { #1/#2 } {##1}
          { \xeCJK_switch_font:nn {#2} {#1} }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_UL_subclass_patch:nn}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_UL_subclass_patch:nn #1#2
  {
    \tl_put_right:Nn \xeCJK_UL_subclass_patch_tl
      {
        \clist_map_inline:nn { Default, HalfLeft, HalfRight }
          {
            \str_if_eq_x:nnTF {##1} { HalfLeft }
              { \xeCJK_inter_class_toks:nnn {#1} { #1/#2 } { \CJKecglue \CJKsymbol } }
              { \xeCJK_inter_class_toks:nnn {#1} { #1/#2 } { \CJKsymbol } }
            \xeCJK_inter_class_toks:nnn { Boundary } { #1/#2 }
              {
                \xeCJK_erase_CJKsymbol:
                \xeCJK_Boundary_and_CJK:
                \xeCJK_switch_font:nn {#1} {#2}
                \xeCJK_restore_CJKsymbol:
              }
          }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \subsection{标点处理}
%
% \begin{macro}[internal,var]{\g_xeCJK_punctstyle_clist}
% 标点处理方式。
%    \begin{macrocode}
\clist_new:N \g_xeCJK_punctstyle_clist
\clist_set:Nn \g_xeCJK_punctstyle_clist
  { CCT , halfwidth , fullwidth , marginkerning , mixedwidth , plain }
\clist_map_inline:Nn \g_xeCJK_punctstyle_clist
  { \tl_const:cn { c_xeCJK_ps_#1_tl } {#1} }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\keys_define:nx}
%    \begin{macrocode}
\cs_generate_variant:Nn \keys_define:nn { nx }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{PunctStyle}
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    PunctStyle .choice_code:n =
      {
        \tl_set:Nx \l_xeCJK_punctstyle_tl { \l_keys_choice_tl }
        \tl_if_eq:NNT \l_xeCJK_punctstyle_tl \c_xeCJK_ps_plain_tl
          { \xeCJKallowbreakbetweenpuncts }
      },
  }
\keys_define:nx { xeCJK / options }
  { PunctStyle .generate_choices:n = { \exp_not:V \g_xeCJK_punctstyle_clist } }
\keys_define:nn { xeCJK / options }
  {
    PunctStyle / banjiao       .meta:n = { PunctStyle = halfwidth },
    PunctStyle / quanjiao      .meta:n = { PunctStyle = fullwidth },
    PunctStyle / kaiming       .meta:n = { PunctStyle = mixedwidth },
    PunctStyle / hangmobanjiao .meta:n = { PunctStyle = marginkerning },
    PunctStyle / unknown .code:n =
      { \xeCJK_error:nx { PunctStyle-undefined } \l_keys_value_tl },
  }
\xeCJK_msg_new:nn { PunctStyle-undefined }
  {
    Punctstyle~"#1"~is~not~available. \\\\
    You~can~only~use~one~of\\\\
    "\g_xeCJK_punctstyle_clist".\\
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}
%  {AllowBreakBetweenPuncts, KaiMingPunct, LongPunct, MiddlePunct,PunctWidth}
% 相关选项声明。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    AllowBreakBetweenPuncts .choice:,
    AllowBreakBetweenPuncts / true  .code:n = { \xeCJKallowbreakbetweenpuncts },
    AllowBreakBetweenPuncts / false .code:n = { \xeCJKnobreakbetweenpuncts },
    AllowBreakBetweenPuncts      .default:n = { true },
    KaiMingPunct  .code:n = { \xeCJK_set_special_punct:nn { mixedwidth } {#1} },
    KaiMingPunct+ .code:n = { \xeCJK_add_special_punct:nn { mixedwidth } {#1} },
    KaiMingPunct- .code:n = { \xeCJK_sub_special_punct:nn { mixedwidth } {#1} },
    LongPunct     .code:n = { \xeCJK_set_special_punct:nn { long } {#1} },
    LongPunct+    .code:n = { \xeCJK_add_special_punct:nn { long } {#1} },
    LongPunct-    .code:n = { \xeCJK_sub_special_punct:nn { long } {#1} },
    MiddlePunct+  .code:n = { \xeCJK_add_special_punct:nn { middle } {#1} },
    MiddlePunct   .code:n = { \xeCJK_set_special_punct:nn { middle } {#1} },
    MiddlePunct-  .code:n = { \xeCJK_sub_special_punct:nn { middle } {#1} },
    PunctWidth .tl_gset:N = \g_xeCJK_punct_width_tl ,
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKallowbreakbetweenpuncts, \xeCJKnobreakbetweenpuncts}
%    \begin{macrocode}
\NewDocumentCommand \xeCJKallowbreakbetweenpuncts { }
  { \cs_set_eq:NN \xeCJK_punct_nobreak: \xeCJK_zero_glue: }
\NewDocumentCommand \xeCJKnobreakbetweenpuncts { }
  { \cs_set_eq:NN \xeCJK_punct_nobreak: \xeCJK_no_break: }
\cs_new_protected_nopar:Npn \xeCJK_zero_glue: { \skip_horizontal:N \c_zero_skip }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
% {\g_xeCJK_special_ps_clist,   \xeCJK_set_special_punct:nn,
%  \xeCJK_add_special_punct:nn, \xeCJK_sub_special_punct:nn}
%    \begin{macrocode}
\clist_set:Nn \g_xeCJK_special_ps_clist { mixedwidth , long , middle }
\clist_map_inline:Nn \g_xeCJK_special_ps_clist
  {
    \tl_new:c    { l_xeCJK_#1_punct_tl   }
    \prop_new:c  { l_xeCJK_#1_punct_prop }
  }
\cs_new_protected_nopar:Npn \xeCJK_set_special_punct:nn #1#2
  {
    \tl_set:cx { l_xeCJK_#1_punct_tl } {#2}
    \prop_clear:c { l_xeCJK_#1_punct_prop }
    \tl_map_inline:cn { l_xeCJK_#1_punct_tl }
      { \prop_put:cnn  { l_xeCJK_#1_punct_prop } {##1} { } }
  }
\cs_new_protected_nopar:Npn \xeCJK_add_special_punct:nn #1#2
  {
    \tl_put_right:cx { l_xeCJK_#1_punct_tl } {#2}
    \tl_map_inline:cn { l_xeCJK_#1_punct_tl }
      { \prop_put:cnn  { l_xeCJK_#1_punct_prop } {##1} { } }
  }
\cs_new_protected_nopar:Npn \xeCJK_sub_special_punct:nn #1#2
  {
    \tl_map_inline:xn {#2}
      {
        \tl_remove_all:cn { l_xeCJK_#1_punct_tl } {##1}
        \prop_remove:cn { l_xeCJK_#1_punct_prop } {##1}
      }
  }
\cs_generate_variant:Nn \tl_map_inline:nn { x }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\dim_set:Nc,\dim_add:Nc,\dim_set_min:Nc}
%    \begin{macrocode}
\cs_generate_variant:Nn \dim_set:Nn { Nc }
\cs_generate_variant:Nn \dim_add:Nn { Nc }
\cs_generate_variant:Nn \dim_set_min:Nn { Nc }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]{\l_xeCJK_punct_coor_tl}
% 记录当前字体状态下的标点处理方式。
%    \begin{macrocode}
\tl_set:Nn \l_xeCJK_punct_coor_tl { \l_xeCJK_font_coor_tl/\l_xeCJK_punctstyle_tl }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_get_punct_bounds:nN}
% |#1| 为 |l/r|,|#2| 为标点字符,返回标点的实际左/右空白的负值和根据标点处理方式
% 决定添加的左/右空白。全角方式直接添加标点的实际左/右空白;半角方式添加标点左右空白
% 中的最小值;开明方式与半角相同,只在开明标点再增加实际左/右空白的一半。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_get_punct_bounds:nN #1#2
  {
    \tl_if_exist:cF { \l_xeCJK_punct_coor_tl/rule/#1/#2 }
      {
        \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_plain_tl
          {
            \clist_map_inline:nn { glue , rule , bound }
              { \tl_gset:cV { \l_xeCJK_punct_coor_tl/##1/#1/#2 } \c_zero_dim }
            \tl_gset:cV { \l_xeCJK_punct_coor_tl/rule/m/#2 } \c_zero_dim
          }
          {
            \tl_if_exist:cF { \l_xeCJK_punct_coor_tl/bound/#1/#2 }
              { { \xeCJK_select_font: \xeCJK_get_punct_dimen:N {#2} } }
            \xeCJK_punct_if_long:NTF {#2}
              {
                \dim_zero:N \l_xeCJK_tmpa_dim
                \dim_zero:N \l_xeCJK_tmpb_dim
                \dim_zero:N \l_xeCJK_tmpc_dim
              }
              {
                \dim_set:Nc \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/bound/#1/#2 }
                \dim_set:Nc \l_xeCJK_tmpb_dim
                  { \l_xeCJK_punct_coor_tl/bound/\str_if_eq_x:nnTF {#1} lrl/#2 }
                \dim_set:Nn \l_xeCJK_tmpc_dim
                  {
                    \cs_if_exist_use:cF { g_xeCJK_punct_width/#2 }
                      {
                        \xeCJK_if_blank_x:nTF \g_xeCJK_punct_width_tl
                          { \c_zero_dim }
                          { \g_xeCJK_punct_width_tl }
                      }
                  }
                \xeCJK_punct_if_middle:NTF {#2}
                  {
                    \dim_set:Nn \l_xeCJK_tmpc_dim
                      {
                        \dim_compare:nNnTF \l_xeCJK_tmpc_dim > \c_zero_dim
                          { \l_xeCJK_tmpc_dim }
                          {
                            \tl_case:Nnn \l_xeCJK_punctstyle_tl
                              {
                                \c_xeCJK_ps_halfwidth_tl  { .5 em }
                                \c_xeCJK_ps_mixedwidth_tl { .5 em }
                                \c_xeCJK_ps_CCT_tl        { .7 em }
                                \c_xeCJK_ps_fullwidth_tl  {  1 em }
                              }
                              { 1 em }
                          }
                        - \tl_use:c { \l_xeCJK_punct_coor_tl/dimen/#2 }
                      }
                    \dim_set:Nn \l_xeCJK_tmpc_dim { .5 \l_xeCJK_tmpc_dim }
                  }
                  {
                    \dim_compare:nNnTF \l_xeCJK_tmpc_dim > \c_zero_dim
                      {
                        \dim_set:Nn \l_xeCJK_tmpc_dim
                          {
                            \l_xeCJK_tmpc_dim - \l_xeCJK_tmpb_dim
                            - \tl_use:c { \l_xeCJK_punct_coor_tl/dimen/#2 }
                          }
                      }
                      {
                        \dim_set_eq:NN  \l_xeCJK_tmpc_dim \l_xeCJK_tmpa_dim
                        \dim_set_min:Nn \l_xeCJK_tmpc_dim \l_xeCJK_tmpb_dim
                        \tl_case:Nnn \l_xeCJK_punctstyle_tl
                          {
                            \c_xeCJK_ps_halfwidth_tl { \prg_do_nothing: }
                            \c_xeCJK_ps_mixedwidth_tl
                              {
                                \xeCJK_punct_if_mixedwidth:NT {#2}
                                  {
                                    \dim_add:Nn \l_xeCJK_tmpc_dim { .5 \l_xeCJK_tmpa_dim }
                                    \dim_set_min:Nn \l_xeCJK_tmpc_dim \l_xeCJK_tmpa_dim
                                  }
                              }
                            \c_xeCJK_ps_CCT_tl
                              {
                                \xeCJK_punct_if_mixedwidth:NTF {#2}
                                  { \dim_add:Nn \l_xeCJK_tmpc_dim { .5 \l_xeCJK_tmpa_dim } }
                                  { \dim_add:Nn \l_xeCJK_tmpc_dim { .3 \l_xeCJK_tmpa_dim } }
                                \dim_set_min:Nn \l_xeCJK_tmpc_dim \l_xeCJK_tmpa_dim
                              }
                          }
                          { \dim_set_eq:NN \l_xeCJK_tmpc_dim \l_xeCJK_tmpa_dim }
                      }
                  }
                \dim_set_max:Nn \l_xeCJK_tmpc_dim \c_zero_dim
              }
            \tl_gset:cx { \l_xeCJK_punct_coor_tl/rule/#1/#2 }
                        { - \dim_use:N \l_xeCJK_tmpa_dim }
            \tl_gset:cx { \l_xeCJK_punct_coor_tl/rule/m/#2  }
                        { - \dim_use:N \l_xeCJK_tmpb_dim }
            \tl_gset:cV { \l_xeCJK_punct_coor_tl/glue/#1/#2 } \l_xeCJK_tmpc_dim
          }
      }
  }
\cs_generate_variant:Nn \xeCJK_get_punct_bounds:nN { nV }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKsetwidth}
%    \begin{macrocode}
\NewDocumentCommand \xeCJKsetwidth { m m }
  { \tl_map_inline:xn {#1} { \tl_gset:cn { g_xeCJK_punct_width/##1 } {#2} } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]
% {\xeCJK_punct_if_right:N,\xeCJK_punct_if_both_left_right:NN,
%  \xeCJK_punct_if_long:N,\xeCJK_punct_if_middle:N,
%  \xeCJK_punct_if_mixedwidth:N}
%    \begin{macrocode}
\prg_new_conditional:Npnn \xeCJK_punct_if_right:N #1 { p , T , F , TF }
  {
    \tl_if_exist:cTF { \l_xeCJK_punct_coor_tl/glue/r/#1 }
      \prg_return_true: \prg_return_false:
  }
\prg_new_conditional:Npnn \xeCJK_punct_if_both_left_right:NN #1#2 { p , T , F , TF }
  {
    \bool_if:nTF
      {
        ( \tl_if_exist_p:c { \l_xeCJK_punct_coor_tl/glue/r/#1 } &&
          \tl_if_exist_p:c { \l_xeCJK_punct_coor_tl/glue/r/#2 } )  ||
        ( \tl_if_exist_p:c { \l_xeCJK_punct_coor_tl/glue/l/#1 } &&
          \tl_if_exist_p:c { \l_xeCJK_punct_coor_tl/glue/l/#2 } )
      }
      \prg_return_true: \prg_return_false:
  }
\cs_generate_variant:Nn \prg_new_conditional:Npnn { c }
\clist_map_inline:Nn \g_xeCJK_special_ps_clist
  {
    \prg_new_conditional:cpnn { xeCJK_punct_if_#1:N } ##1 { p , T , F , TF }
      {
        \prop_if_in:cnTF { l_xeCJK_#1_punct_prop } {##1}
          \prg_return_true: \prg_return_false:
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_get_kern:NN,\xeCJK_calc_kern:NN}
% 标点挤压。行末半角方式,相邻标点不挤压;全角方式,相邻两个标点占 1.5 汉字宽度,
% 半角、开明和 CCT 方式相邻标点占一个汉字宽度。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_get_kern:NN #1#2
  {
    \tl_if_exist:cF { \l_xeCJK_punct_coor_tl/kern/#1-#2 }
      {
        \dim_zero:N \l_xeCJK_tmpa_dim
        \tl_if_eq:NNF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_plain_tl
          {
            \tl_if_exist:cTF { g_xeCJK_punct/kern/#1-#2 }
              { \dim_set:Nc \l_xeCJK_tmpa_dim { g_xeCJK_punct/kern/#1-#2 } }
              { \xeCJK_calc_kern:NN {#1} {#2} }
          }
        \tl_gset:cV { \l_xeCJK_punct_coor_tl/kern/#1-#2 } \l_xeCJK_tmpa_dim
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NN #1#2
  {
    \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_marginkerning_tl
      {
        \xeCJK_punct_if_right:NT {#1}
          { \dim_add:Nc \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/bound/r/#1 } }
        \xeCJK_punct_if_right:NF {#2}
          { \dim_add:Nc \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/bound/l/#2 } }
      }
      {
        \tl_if_eq:NNTF \l_xeCJK_punctstyle_tl \c_xeCJK_ps_fullwidth_tl
          { \xeCJK_calc_kern:NnNN \l_xeCJK_tmpa_dim { 1.5 em } {#1} {#2} }
          {
            \xeCJK_punct_if_both_left_right:NNTF {#1} {#2}
              {
                \xeCJK_punct_if_mixedwidth:NT {#1}
                  {
                    \xeCJK_calc_kern:NnNN \l_xeCJK_tmpa_dim { 1 em } {#1} {#2}
                    \dim_compare:nNnT \l_xeCJK_tmpa_dim < { .1 em }
                      { \dim_set:Nc \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/bound/l/#1 } }
                  }
              }
              {
                \bool_if:nTF
                  {
                    \xeCJK_punct_if_mixedwidth_p:N {#1} &&
                    ! ( \tl_if_eq_p:NN \l_xeCJK_punctstyle_tl \c_xeCJK_ps_halfwidth_tl )
                  }
                  {
                    \dim_set:Nc \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/glue/r/#1 }
                    \dim_set:Nn \l_xeCJK_tmpa_dim { .7 \l_xeCJK_tmpa_dim }
                  }
                  {
                    \xeCJK_calc_kern:NnNN \l_xeCJK_tmpa_dim { 1 em } {#1} {#2}
                    \dim_compare:nNnT \l_xeCJK_tmpa_dim < { .1 em }
                      {
                        \dim_set:Nc     \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/bound/l/#1 }
                        \dim_set_min:Nc \l_xeCJK_tmpa_dim { \l_xeCJK_punct_coor_tl/bound/r/#1 }
                        \dim_set:Nc     \l_xeCJK_tmpb_dim { \l_xeCJK_punct_coor_tl/bound/l/#2 }
                        \dim_set_min:Nc \l_xeCJK_tmpb_dim { \l_xeCJK_punct_coor_tl/bound/r/#2 }
                        \dim_set_max:Nn \l_xeCJK_tmpa_dim \l_xeCJK_tmpb_dim
                      }
                  }
              }
          }
        \bool_if:nT
          { \xeCJK_punct_if_long_p:N {#1} || \xeCJK_punct_if_long_p:N {#2} }
          { \dim_set_max:Nn \l_xeCJK_tmpa_dim { .1 em } }
      }
    \dim_set_max:Nn \l_xeCJK_tmpa_dim \c_zero_dim
  }
\cs_generate_variant:Nn \xeCJK_get_kern:NN { V }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_calc_kern:NnNN}
% |#3| 和 |#4| 为相邻的两个标点,|#2| 为要确定的相邻两个标点总共占的宽度,|#1| 是
% 尺寸寄存器,用于记录根据所占宽度计算得出的相邻两个标点间距。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_calc_kern:NnNN #1#2#3#4
  {
    \dim_set:Nn #1
      {
        #2
        - \tl_use:c { \l_xeCJK_punct_coor_tl/
                      \xeCJK_punct_if_right:NTF {#3} { bound } { glue } /l/#3 }
        - \tl_use:c { \l_xeCJK_punct_coor_tl/
                      \xeCJK_punct_if_right:NTF {#4} { glue } { bound } /r/#4 }
        - \tl_use:c { \l_xeCJK_punct_coor_tl/dimen/#3 }
        - \tl_use:c { \l_xeCJK_punct_coor_tl/dimen/#4 }
        \xeCJK_punct_if_both_left_right:NNT {#3} {#4}
          { + \tl_use:c { \l_xeCJK_punct_coor_tl/rule/m/#4 } }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_get_punct_dimen:N}
% 返回标点的左右空白和实际尺寸。对于破折号,计算两标点之间的空白,保证它中间不被断开。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_get_punct_dimen:N #1
  {
    \xeCJK_get_glyph_bounds:nNN { left } {#1} \l_xeCJK_tmpa_dim
    \tl_gset:cV { \l_xeCJK_punct_coor_tl/bound/l/#1 } \l_xeCJK_tmpa_dim
    \dim_set_eq:NN \l_xeCJK_tmpb_dim \l_xeCJK_tmpa_dim
    \xeCJK_get_glyph_bounds:nNN { right } {#1} \l_xeCJK_tmpa_dim
    \tl_gset:cV { \l_xeCJK_punct_coor_tl/bound/r/#1 } \l_xeCJK_tmpa_dim
    \dim_add:Nn \l_xeCJK_tmpb_dim \l_xeCJK_tmpa_dim
    \tl_gset:cx { \l_xeCJK_punct_coor_tl/dimen/#1 }
      { \dim_eval:n { \etex_fontcharwd:D \tex_font:D `#1 - \l_xeCJK_tmpb_dim } }
    \bool_if:nT
      {
        \xeCJK_punct_if_long_p:N {#1} &&
        ! ( \str_if_eq_x_p:nn {#1} { … } || \str_if_eq_x_p:nn {#1} { ‥ } )
      }
      {
        \clist_map_inline:Nn \g_xeCJK_punctstyle_clist
          {
            \str_if_eq_x:nnF \c_xeCJK_ps_plain_tl {##1}
              {
                \tl_gset:cx { \l_xeCJK_font_coor_tl/##1/kern/#1-#1 }
                  { - \dim_use:N \l_xeCJK_tmpb_dim }
              }
          }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_get_glyph_bounds:nNN}
% 用 |\XeTeXglyphbounds| 计算标点的上下左右空白。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_get_glyph_bounds:nNN #1#2#3
  {
    \dim_set:Nn #3
      {
        \XeTeXglyphbounds
          \str_case_x:nnn {#1}
            {
              { left   } { \c_one   }     { top    } { \c_two  }
              { right  } { \c_three }     { bottom } { \c_four }
            }
            { \c_three }
          \int_eval:n { \XeTeXcharglyph `#2 }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xeCJKsetkern}
% 手动设置相邻标点的距离,仅在当前字体状态下有效。
%    \begin{macrocode}
\NewDocumentCommand \xeCJKsetkern { m m m }
  { \tl_gset:cn { g_xeCJK_punct/kern/#1-#2 } {#3} }
%    \end{macrocode}
% \end{macro}
%
% \subsection{后备字体}
%
% \begin{macro}{AutoFallBack}
% 后备字体的宏包选项声明。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    AutoFallBack .choice:,
    AutoFallBack / true  .code:n = { \xeCJKenablefallback },
    AutoFallBack / false .code:n = { \xeCJKdisablefallback },
    AutoFallBack      .default:n = { true },
    fallback             .meta:n = { AutoFallBack = true },
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKenablefallback, \xeCJKdisablefallback}
% 后备字体的启用开关,默认关闭。
%    \begin{macrocode}
\bool_new:N \l_xeCJK_fallback_bool
\NewDocumentCommand \xeCJKenablefallback { }
  {
    \bool_if:NF \l_xeCJK_fallback_bool
      {
        \bool_set_true:N \l_xeCJK_fallback_bool
        \cs_set_eq:NN \xeCJK_fallback_save_CJKsymbol:N \CJKsymbol
        \cs_set_eq:NN \CJKsymbol \xeCJK_fallback_testsymbol:N
      }
  }
\NewDocumentCommand \xeCJKdisablefallback { }
  {
    \bool_if:NT \l_xeCJK_fallback_bool
      {
        \bool_set_false:N \l_xeCJK_fallback_bool
        \cs_set_eq:NN \CJKsymbol \xeCJK_fallback_save_CJKsymbol:N
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_fallback_testsymbol:N}
% 测试当前字体中是否存在当前字符,如存在则直接输出,否则启用后备字体。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_fallback_testsymbol:N #1
  {
    \font_glyph_if_exist:NnTF \tex_font:D {`#1}
      { \xeCJK_fallback_save_CJKsymbol:N {#1} }
      {
        \xeCJK_family_if_exist:xTF { \xeCJK@family/FallBack }
          { {
              \tl_put_right:Nn \xeCJK@family { /FallBack }
              \xeCJK_select_font:
              \xeCJK_fallback_testsymbol:N {#1}
          } }
          {
            \xeCJK_warning:nx { fallback } {#1}
            \xeCJK_fallback_save_CJKsymbol:N {#1}
          }
      }
  }
\xeCJK_msg_new:nn { fallback }
  {
    CJKfamily~'\xeCJK@family'~
    ( \prop_get:NV \g_xeCJK_family_prop \xeCJK@family )~
    does~not~contain~glyph~'#1'~(U+\int_to_hexadecimal:n {`#1}).\\
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setCJKfallbackfamilyfont}
% \begin{macro}[aux]{\xeCJK_set_family_fallback:nnn}
%    \begin{macrocode}
\NewDocumentCommand \setCJKfallbackfamilyfont { m O{} m }
  {
    \exp_args:Nx \tl_if_in:nnTF {#3} { , }
      { \xeCJK_set_family_fallback:nnn {#1} {#2} {#3} }
      { \xeCJK_set_family:nnn { #1/FallBack } {#2} {#3} }
  }
\cs_new_protected_nopar:Npn \xeCJK_set_family_fallback:nnn #1#2#3
  {
    \group_begin:
    \tl_set:Nx \l_xeCJK_family_fb_tl {#1}
    \prop_get:NVNF \g_xeCJK_family_prop \l_xeCJK_family_fb_tl \l_xeCJK_fontname_tl
      { \tl_clear:N \l_xeCJK_fontname_tl }
    \clist_map_inline:xn {#3}
      {
        \tl_put_right:Nn \l_xeCJK_family_fb_tl { /FallBack }
        \xeCJK_get_sub_features:nn \l_xeCJK_family_fb_tl {##1}
        \clist_put_left:cx { l_xeCJK_ \l_xeCJK_family_fb_tl _fontfeat_clist } {#2}
        \xeCJK_set_family:ncc \l_xeCJK_family_fb_tl
          { l_xeCJK_ \l_xeCJK_family_fb_tl _fontfeat_clist }
          { l_xeCJK_ \l_xeCJK_family_fb_tl _fontname_tl }
      }
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{CJK 字体族声明方式}
%
%    \begin{macrocode}
\bool_new:N \g_xeCJK_AutoFakeBold_bool
\bool_new:N \g_xeCJK_AutoFakeSlant_bool
\fp_new:N \g_xeCJK_EmboldenFactor_fp
\fp_new:N \g_xeCJK_SlantFactor_fp
%    \end{macrocode}
%
% \begin{macro}{AutoFakeBold, AutoFakeSlant,EmboldenFactor,SlantFactor}
% 伪粗体和伪斜体的宏包选项声明。
%    \begin{macrocode}
\keys_define:nn { xeCJK / options }
  {
    AutoFakeBold .choice:,
    AutoFakeBold / true    .code:n =
      { \bool_set_true:N  \g_xeCJK_AutoFakeBold_bool },
    AutoFakeBold / false   .code:n =
      { \bool_set_false:N \g_xeCJK_AutoFakeBold_bool },
    AutoFakeBold / unknown .code:n =
      {
        \bool_set_true:N  \g_xeCJK_AutoFakeBold_bool
        \fp_set:Nn \g_xeCJK_EmboldenFactor_fp { \l_keys_value_tl }
      },
    AutoFakeBold .default:n  = { true },
    AutoFakeSlant .choice:,
    AutoFakeSlant / true     .code:n =
      { \bool_set_true:N  \g_xeCJK_AutoFakeSlant_bool },
    AutoFakeSlant / false    .code:n =
      { \bool_set_false:N \g_xeCJK_AutoFakeSlant_bool },
    AutoFakeSlant / unknown  .code:n =
      {
        \bool_set_true:N  \g_xeCJK_AutoFakeSlant_bool
        \fp_set:Nn \g_xeCJK_SlantFactor_fp { \l_keys_value_tl }
      },
    AutoFakeSlant .default:n = { true },
    EmboldenFactor .fp_set:N = \g_xeCJK_EmboldenFactor_fp,
    SlantFactor    .fp_set:N = \g_xeCJK_SlantFactor_fp,
    BoldFont  .meta:n = { AutoFakeBold  = true },
    boldfont  .meta:n = { AutoFakeBold  = true },
    SlantFont .meta:n = { AutoFakeSlant = true },
    slantfont .meta:n = { AutoFakeSlant = true },
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\keys_set_known:nxN}
%    \begin{macrocode}
\cs_generate_variant:Nn \keys_set_known:nnN { nx }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_new_sub_key:n,\g_xeCJK_sub_key_clist}
% 用于定义 CJK 子区字体和备用字体的选项。
%    \begin{macrocode}
\clist_new:N \g_xeCJK_sub_key_clist
\cs_new_protected_nopar:Npn \xeCJK_new_sub_key:n #1
  {
    \clist_gput_right:Nx \g_xeCJK_sub_key_clist {#1}
    \keys_define:nn { xeCJK / features }
      {
        #1 .code:n =
          {
            \xeCJK_if_blank_x:nTF {##1}
              {
                \bool_set_false:c { l_xeCJK_copy_#1_bool }
                \bool_set_false:c { l_xeCJK_add_#1_bool }
                \tl_put_right:Nx \l_xeCJK_family_tl { /#1 }
              }
              {
                \clist_put_right:Nx \l_xeCJK_sub_key_clist {#1}
                \str_if_eq_x:nnTF {##1} *
                  {
                    \bool_set_true:c  { l_xeCJK_copy_#1_bool }
                    \bool_set_false:c { l_xeCJK_add_#1_bool }
                  }
                  {
                    \bool_set_false:c { l_xeCJK_copy_#1_bool }
                    \bool_set_true:c  { l_xeCJK_add_#1_bool }
                    \xeCJK_get_sub_features:nn {#1} {##1}
                  }
              }
          },
        #1 .default:n = \c_empty_tl,
      }
  }
\cs_generate_variant:Nn \xeCJK_new_sub_key:n { x }
\cs_new_protected_nopar:Npn \xeCJK_get_sub_features:nn #1#2
  {
    \tl_set:Nx \l_xeCJK_tmpa_tl {#2}
    \clist_clear:N \l_xeCJK_sub_fontfeat_clist
    \xeCJK_gobble_brace:N \l_xeCJK_tmpa_tl
    \exp_args:No \tl_if_head_eq_charcode:nNTF \l_xeCJK_tmpa_tl [ % ]
      {
        \exp_after:wN \xeCJK_get_sub_features_aux:n \l_xeCJK_tmpa_tl \c_empty_tl
        \xeCJK_if_blank_x:nT \l_xeCJK_sub_fontname_tl
          {
            \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_tmpa_tl
            \clist_clear:N \l_xeCJK_sub_fontfeat_clist
          }
      }
      { \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_tmpa_tl }
    \xeCJK_if_blank_x:nTF \l_xeCJK_sub_fontname_tl
      { \tl_set:Nx \l_xeCJK_sub_fontname_tl \l_xeCJK_fontname_tl }
      { \tl_replace_all:Nnx \l_xeCJK_sub_fontname_tl * \l_xeCJK_fontname_tl }
    \clist_set:cx { l_xeCJK_#1_fontfeat_clist } \l_xeCJK_sub_fontfeat_clist
    \tl_set:cx { l_xeCJK_#1_fontname_tl } \l_xeCJK_sub_fontname_tl
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]
% {\xeCJK_gobble_brace:N,\xeCJK_get_sub_features:nn,\xeCJK_get_sub_features_aux:n}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_gobble_brace:N #1
  {
    \exp_args:No \tl_if_head_is_group:nT #1
      {
        \exp_last_unbraced:NNo \tl_set:Nn #1 #1
        \xeCJK_gobble_brace:N #1
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_get_sub_features_aux:n [#1] #2
  {
    \clist_set:Nx \l_xeCJK_sub_fontfeat_clist {#1}
    \tl_set:Nx \l_xeCJK_sub_fontname_tl {#2}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{FallBack}
%    \begin{macrocode}
\xeCJK_new_sub_key:n { FallBack }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\g_xeCJK_features_id_prop, BoldFont, ItalicFont, BoldItalicFont,
% SlantedFont, BoldSlantedFont,BoldFeatures, ItalicFeatures, BoldItalicFeatures,
% SlantedFeatures, BoldSlantedFeatures}
% 调用字体的属性声明,同 \pkg{fontspec} 宏包。
%    \begin{macrocode}
\cs_new_nopar:Npn \xeCJK_map_features_id:n #1
  { \prop_get:Nn \g_xeCJK_features_id_prop {#1} }
\prop_new:N \g_xeCJK_features_id_prop
\prop_put:Nnn \g_xeCJK_features_id_prop { bf   } { Bold        }
\prop_put:Nnn \g_xeCJK_features_id_prop { it   } { Italic      }
\prop_put:Nnn \g_xeCJK_features_id_prop { bfit } { BoldItalic  }
\prop_put:Nnn \g_xeCJK_features_id_prop { sl   } { Slanted     }
\prop_put:Nnn \g_xeCJK_features_id_prop { bfsl } { BoldSlanted }
\prop_map_inline:Nn \g_xeCJK_features_id_prop
  {
    \keys_define:nn { xeCJK / features }
      {
        #2Font     .tl_set_x:c = { l_xeCJK_fontname_#1_tl },
        #2Features .tl_set_x:c = { l_xeCJK_fontfeat_#1_clist } ,
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{AutoFakeBold, AutoFakeSlant, Mono}
%    \begin{macrocode}
\keys_define:nn { xeCJK / features }
  {
    AutoFakeBold  .choice:,
    AutoFakeBold / false   .code:n =
      { \bool_set_false:N \l_xeCJK_AutoFakeBold_bool },
    AutoFakeBold / unknown .code:n =
      {
        \bool_set_true:N \l_xeCJK_AutoFakeBold_bool
        \fp_set:Nn \l_xeCJK_EmboldenFactor_fp { \l_keys_value_tl }
      },
    AutoFakeBold .default:n  = { \g_xeCJK_EmboldenFactor_fp },
    AutoFakeSlant  .choice:,
    AutoFakeSlant / false   .code:n =
      { \bool_set_false:N \l_xeCJK_AutoFakeSlant_bool },
    AutoFakeSlant / unknown .code:n =
      {
        \bool_set_true:N \l_xeCJK_AutoFakeSlant_bool
        \fp_set:Nn \l_xeCJK_SlantFactor_fp { \l_keys_value_tl }
      },
    AutoFakeSlant .default:n  = { \g_xeCJK_SlantFactor_fp },
    Mono .choice:,
    Mono / Exspace .code:n =
      {
        \xeCJK_set_monoexspace:
        \tl_clear:N \l_xeCJK_monoscale_tl
      },
    Mono / Scale   .code:n =
      {
        \xeCJK_set_monoscale:
        \tl_set:Nx \l_xeCJK_monoscale_tl { Scale = { \fp_use:N \g_xeCJK_monoscale_fp } }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_init:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_init:
  {
    \tl_clear:N \l_xeCJK_monoscale_tl
    \int_gincr:N \g_xeCJK_fontspec_int
    \prop_clear:N \l_xeCJK_add_font_prop
    \prop_map_inline:Nn \g_xeCJK_features_id_prop
      {
        \tl_clear:c    { l_xeCJK_fontname_##1_tl    }
        \clist_clear:c { l_xeCJK_fontfeat_##1_clist }
      }
    \clist_clear:N \l_xeCJK_pass_features_clist
    \clist_clear:N \l_xeCJK_sub_key_clist
    \clist_map_inline:Nn \g_xeCJK_sub_key_clist
      {
        \bool_set_false:c { l_xeCJK_copy_##1_bool }
        \bool_set_false:c { l_xeCJK_add_##1_bool  }
      }
    \bool_set_eq:NN \l_xeCJK_AutoFakeBold_bool   \g_xeCJK_AutoFakeBold_bool
    \bool_set_eq:NN \l_xeCJK_AutoFakeSlant_bool  \g_xeCJK_AutoFakeSlant_bool
    \fp_set_eq:NN \l_xeCJK_EmboldenFactor_fp \g_xeCJK_EmboldenFactor_fp
    \fp_set_eq:NN \l_xeCJK_SlantFactor_fp    \g_xeCJK_SlantFactor_fp
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_family:nnn}
% 设置一个 CJK 新字体族,与 |\newfontfamily| 类似,增加 |FallBack| 选项。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_family:nnn #1#2#3
  {
    \group_begin:
    \xeCJK_set_init:
    \tl_set:Nx \l_xeCJK_family_tl {#1}
    \clist_set:Nx \l_xeCJK_fontoptions_clist {#2}
    \tl_set:Nx \l_xeCJK_fontname_tl {#3}
    \keys_set_known:nxN { xeCJK / features }
      { \g_xeCJK_default_features_clist, #2 } \l_xeCJK_pass_features_clist
    \xeCJK_parse_features:
    \xeCJK_pass_features:
    \xeCJK_check_family:V \l_xeCJK_family_tl
    \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_family_tl }
      {
        \exp_not:n { \fontspec_set_family:Nnn \l_xeCJK_fontspec_family_tl }
          { \l_xeCJK_pass_features_clist } { \l_xeCJK_fontname_tl }
        \prop_gput:NnV \exp_not:N \g_xeCJK_family_name_prop
          { \l_xeCJK_family_tl } \exp_not:N \l_xeCJK_fontspec_family_tl
        \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_family_tl }
        \exp_not:n
          { {
            \exp_not:N \fontencoding { \g_fontspec_encoding_tl }
            \exp_not:N \fontfamily   { \l_xeCJK_fontspec_family_tl }
            \exp_not:N \selectfont
          } }
      }
    \xeCJK_save_family_info:
    \xeCJK_add_sub_block:
    \group_end:
  }
\cs_generate_variant:Nn \xeCJK_set_family:nnn { ncc }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_check_family:n}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_check_family:n #1
  {
    \prop_get:NnNT \g_xeCJK_family_prop {#1} \l_xeCJK_tmpa_tl
      {
        \prop_gpop:NnNT \g_xeCJK_family_name_prop {#1} \l_xeCJK_tmpa_tl { }
        \xeCJK_warning:nxx { CJKfamily-redef } {#1} \l_xeCJK_tmpa_tl
      }
  }
\cs_generate_variant:Nn \xeCJK_check_family:n { V }
\xeCJK_msg_new:nn { CJKfamily-redef } { Redefining~CJKfamily~`#1'~(#2). }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_add_font:nn,\xeCJK_add_font_if_new:nn}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_add_font:nn #1#2
  {
    \prop_put:Nxx \l_xeCJK_add_font_prop
      { \xeCJK_map_features_id:n {#1} Font } {#2}
  }
\cs_new_protected_nopar:Npn \xeCJK_add_font_if_new:nn #1#2
  {
    \prop_put_if_new:Nxx \l_xeCJK_add_font_prop
      { \xeCJK_map_features_id:n {#1} Font } {#2}
  }
\cs_generate_variant:Nn \xeCJK_add_font:nn        { nx, nc, nV, nv }
\cs_generate_variant:Nn \xeCJK_add_font_if_new:nn { nx, nc, nV, nv }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\cs_generate_variant:Nn \prop_put:Nnn        { Nxx }
\cs_generate_variant:Nn \prop_get:Nn         { NV  }
\cs_generate_variant:Nn \prop_get:NnNF       { Nx  }
\cs_generate_variant:Nn \prop_if_in:NnF      { Nx  }
\cs_generate_variant:Nn \prop_put_if_new:Nnn { Nxx }
%    \end{macrocode}
%
% \begin{macro}[internal]{\xeCJK_add_fake_bold:n,\xeCJK_add_fake_slant:n}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_add_fake_bold:n #1
  {
    \clist_put_left:cx { l_xeCJK_fontfeat_#1_clist }
      { FakeBold = { \fp_use:N \l_xeCJK_EmboldenFactor_fp } }
  }
\cs_new_protected_nopar:Npn \xeCJK_add_fake_slant:n #1
  {
    \clist_put_left:cx { l_xeCJK_fontfeat_#1_clist }
      { FakeSlant = { \fp_use:N \l_xeCJK_SlantFactor_fp } }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_parse_features:,\xeCJK_parse_features:n}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_parse_features:
  { \prop_map_inline:Nn \g_xeCJK_features_id_prop { \xeCJK_parse_features:n {##1} } }
\cs_new_protected_nopar:Npn \xeCJK_parse_features:n #1
  {
    \xeCJK_if_font_select:nTF {#1}
      {
        \xeCJK_add_font:nv {#1} { l_xeCJK_fontname_#1_tl }
        \xeCJK_if_it_or_sl:nTF {#1}
          {
            \xeCJK_if_font_select:nF {bf#1}
              { \xeCJK_add_font_if_new:nv {bf#1} { l_xeCJK_fontname_#1_tl }  }
          }
          {
            \str_if_eq_x:nnT {#1} {bf}
              {
                \clist_map_inline:nn { it , sl }
                  {
                    \xeCJK_if_font_select:nF {bf##1}
                      { \xeCJK_add_font:nV {bf##1} \l_xeCJK_fontname_bf_tl }
                  }
              }
          }
      }
      { \xeCJK_set_fake:n {#1} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_font_select:n,\xeCJK_if_it_or_sl:n}
%    \begin{macrocode}
\prg_new_conditional:Npnn \xeCJK_if_font_select:n #1 { p, T, F, TF }
  {
    \exp_args:Nc \xeCJK_if_blank_x:nTF { l_xeCJK_fontname_#1_tl }
      \prg_return_false: \prg_return_true:
  }
\prg_new_conditional:Npnn \xeCJK_if_it_or_sl:n #1 { p, T, F, TF }
  {
    \bool_if:nTF { \str_if_eq_x_p:nn { it } {#1} || \str_if_eq_x_p:nn { sl } {#1} }
      \prg_return_true: \prg_return_false:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_fake:n}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_fake:n #1
  {
    \str_if_eq_x:nnTF {#1} { bf }
      { \bool_if:NT \l_xeCJK_AutoFakeBold_bool { \xeCJK_add_fake_bold:n {#1} } }
      {
        \bool_if:NTF \l_xeCJK_AutoFakeSlant_bool
          {
            \bool_if:nT
              {   \xeCJK_if_it_or_sl_p:n {#1} ||
                ( \str_if_eq_x_p:nn {#1} {bfit} && ! ( \xeCJK_if_font_select_p:n {it} ) ) ||
                ( \str_if_eq_x_p:nn {#1} {bfsl} && ! ( \xeCJK_if_font_select_p:n {sl} ) )
              }
              { \xeCJK_add_fake_slant:n {#1} }
          }
          { \xeCJK_if_it_or_sl:nT {#1} { \xeCJK_map_it_sl:n {#1} } }
        \bool_if:nT
          {      \l_xeCJK_AutoFakeBold_bool
            && ! ( \xeCJK_if_it_or_sl_p:n {#1} )
            && ! ( \xeCJK_if_font_select_p:n {bf} )
          }
          { \xeCJK_add_fake_bold:n {#1} }
      }
    \xeCJK_add_font_if_new:nn {#1} *
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_map_it_sl:n}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_map_it_sl:n #1
  {
    \xeCJK_if_map_font_select:nT {#1}
      {
        \xeCJK_add_font:nx {#1} { \xeCJK_get_map_font:n {#1} }
        \xeCJK_if_font_select:nF {bf#1}
          { \xeCJK_add_font_if_new:nx {bf#1} { \xeCJK_get_map_font:n {#1} } }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_get_map_font:n}
%    \begin{macrocode}
\cs_new_nopar:Npn \xeCJK_get_map_font:n #1
  { \tl_use:c { l_xeCJK_fontname_\str_if_eq_x:nnTF {#1} {it} {sl} {it} _tl } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[pTF,internal]{\xeCJK_if_map_font_select:n}
%    \begin{macrocode}
\prg_new_conditional:Npnn \xeCJK_if_map_font_select:n #1 { p, T, F, TF }
  {
    \xeCJK_if_blank_x:nTF { \xeCJK_get_map_font:n {#1} }
      \prg_return_false: \prg_return_true:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_pass_features:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_pass_features:
  {
    \prop_map_inline:Nn \g_xeCJK_features_id_prop
      {
        \clist_if_empty:cF { l_xeCJK_fontfeat_##1_clist }
          {
            \clist_put_right:Nx \l_xeCJK_pass_features_clist
              { ##2Features = { \tl_use:c { l_xeCJK_fontfeat_##1_clist } } }
          }
      }
    \prop_map_inline:Nn \l_xeCJK_add_font_prop
      { \clist_put_right:Nx \l_xeCJK_pass_features_clist { ##1 = { ##2 } } }
    \xeCJK_if_blank_x:nF \l_xeCJK_monoscale_tl
      { \clist_put_right:Nx \l_xeCJK_pass_features_clist \l_xeCJK_monoscale_tl }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,var]
%  {\g_xeCJK_family_prop,\g_xeCJK_family_name_prop,\g_xeCJK_family_options_prop}
%    \begin{macrocode}
\prop_new:N \g_xeCJK_family_prop
\prop_new:N \g_xeCJK_family_name_prop
\prop_new:N \g_xeCJK_family_options_prop
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_save_family_info:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_save_family_info:
  {
    \group_begin:
    \clist_map_inline:Nn \g_xeCJK_CJK_subclass_clist
      {
        \clist_remove_all:Nn \l_xeCJK_fontoptions_clist {##1}
        \clist_remove_all:Nn \l_xeCJK_fontoptions_clist { ##1 = }
      }
    \prop_gput:NVV \g_xeCJK_family_prop \l_xeCJK_family_tl \l_xeCJK_fontname_tl
    \prop_gput:NVV \g_xeCJK_family_options_prop \l_xeCJK_family_tl \l_xeCJK_fontoptions_clist
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_add_sub_block:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_add_sub_block:
  {
    \clist_remove_duplicates:N \l_xeCJK_sub_key_clist
    \clist_map_inline:Nn \l_xeCJK_sub_key_clist
      {
        \tl_set:Nx \l_xeCJK_sub_family_tl { \l_xeCJK_family_tl/##1 }
        \bool_if:cT { l_xeCJK_copy_##1_bool }
          {
            \xeCJK_check_family:V \l_xeCJK_sub_family_tl
            \prop_get:NVNT \g_xeCJK_family_prop \l_xeCJK_family_tl \l_xeCJK_tmpa_tl
              { \prop_gput:NVV \g_xeCJK_family_prop \l_xeCJK_sub_family_tl \l_xeCJK_tmpa_tl }
            \prop_get:NVNT \g_xeCJK_family_options_prop \l_xeCJK_family_tl \l_xeCJK_tmpa_clist
              {
                \clist_remove_all:Nn \l_xeCJK_tmpa_clist { ##1 = * }
                \prop_gput:NVV \g_xeCJK_family_options_prop \l_xeCJK_sub_family_tl \l_xeCJK_tmpa_clist
              }
            \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_sub_family_tl }
              {
                \xeCJK_family_if_exist:xT { \l_xeCJK_family_tl }
                  {
                    \prop_get:NnNT \exp_not:N \g_xeCJK_family_name_prop
                      { \l_xeCJK_family_tl } \exp_not:N \l_xeCJK_tmpa_tl
                      {
                        \prop_gput:NnV \exp_not:N \g_xeCJK_family_name_prop
                          { \l_xeCJK_sub_family_tl } \exp_not:N \l_xeCJK_tmpa_tl
                        \cs_gset_protected_nopar:cpx { xeCJK/family/\l_xeCJK_sub_family_tl }
                        \exp_not:n
                          { {
                              \exp_not:N \fontencoding { \g_fontspec_encoding_tl }
                              \exp_not:N \fontfamily   { \l_xeCJK_tmpa_tl }
                              \exp_not:N \selectfont
                          } }
                      }
                  }
              }
          }
        \bool_if:cT { l_xeCJK_add_##1_bool }
          {
            \xeCJK_set_family:ncc \l_xeCJK_sub_family_tl
              { l_xeCJK_##1_fontfeat_clist } { l_xeCJK_##1_fontname_tl }
          }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_copy_family:nn}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_copy_family:nn #1#2
  {
    \xeCJK_family_if_exist:xT {#2}
      {
        \tl_map_inline:nn
          { \g_xeCJK_family_prop \g_xeCJK_family_options_prop \g_xeCJK_family_name_prop }
          { \prop_get:NnNT ##1 {#2} \l_xeCJK_tmpa_tl { \prop_gput:NnV ##1 {#1} \l_xeCJK_tmpa_tl } }
        \cs_gset_eq:cc { xeCJK/family/#1 } { xeCJK/family/#2 }
      }
  }
\cs_generate_variant:Nn \xeCJK_copy_family:nn { xx }
%    \end{macrocode}
% \end{macro}
%
% \subsection{字体切换}
%
% \begin{macro}[internal]{\l_xeCJK_font_coor_tl,\xeCJK_select_font:,\xeCJK_switch_font:nn}
% 缓存当前字体的原始格式,以加速编译。
%    \begin{macrocode}
\tl_set:Nn \l_xeCJK_font_coor_tl { xeCJK/\xeCJK@family/\f@series/\f@shape/\f@size }
\cs_new_protected_nopar:Npn \xeCJK_select_font:
  {
    \cs_if_exist_use:cF { \l_xeCJK_font_coor_tl }
      {
        \tl_set:Nx \l_xeCJK_current_coor_tl \l_xeCJK_font_coor_tl
        \xeCJK_family_if_exist:xTF { \xeCJK@family }
          { \use:c { xeCJK/family/\xeCJK@family } }
          { \use_none:nnnn }
        \exp_last_unbraced:NNV \cs_gset_eq:cN \l_xeCJK_current_coor_tl \tex_font:D
      }
  }
\cs_new_eq:NN \xeCJK@setfont \xeCJK_select_font:
\cs_new_protected_nopar:Npn \xeCJK_switch_font:nn #1#2
  {
    \str_if_eq_x:nnF {#1} {#2}
      {
        \xeCJK_info:nxx { CJK-block } {#1} {#2}
        \tl_remove_all:Nn \xeCJK@family { /#1 }
        \str_if_eq_x:nnF {#2} { CJK }
          {
            \tl_set:Nx \l_xeCJK_tmpa_tl \xeCJK@family
            \tl_put_right:Nx \xeCJK@family { /#2 }
            \xeCJK_family_if_exist:xF \xeCJK@family
              {
                \xeCJK_family_if_exist:xTF { \CJKfamilydefault/#2 }
                  { \xeCJK_copy_family:xx \xeCJK@family { \CJKfamilydefault/#2 } }
                  { \xeCJK_copy_family:xx \xeCJK@family \l_xeCJK_tmpa_tl }
              }
          }
      }
    \xeCJK_select_font:
  }
\xeCJK_msg_new:nn { CJK-block } { Switch~from~block~'#1'~to~'#2'. }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[TF,internal]{\xeCJK_family_if_exist:x}
%    \begin{macrocode}
\prg_new_protected_conditional:Npnn \xeCJK_family_if_exist:x #1 { T, F, TF }
  {
    \cs_if_free:cTF { xeCJK/family/#1 }
      { \prg_return_false: }
      {
        \prop_get:NxNF \g_xeCJK_family_name_prop {#1} \l_xeCJK_family_name_tl
          { \use:c { xeCJK/family/#1 } }
        \prg_return_true:
      }
  }
\cs_generate_variant:Nn \prop_get:NnNTF { Nx }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\CJKfamily}
% 用于切换 CJK 字体族。
%    \begin{macrocode}
\NewDocumentCommand \CJKfamily { m }
  {
    \cs_if_exist:cTF { xeCJK/family/#1 }
      { \tl_set:Nx \xeCJK@family {#1} }
      {
        \seq_if_in:NxF \g_xeCJK_unknown_family_seq {#1}
          {
            \seq_gput_right:Nx \g_xeCJK_unknown_family_seq {#1}
            \xeCJK_warning:nx { CJKfamily-Unknown } {#1}
          }
      }
    \tex_ignorespaces:D
  }
\seq_new:N \g_xeCJK_unknown_family_seq
\xeCJK_msg_new:nn { CJKfamily-Unknown }
  {
    Unknown~CJK~family~'#1'~is~ignored.\\\\
    Try~to~use~
    \str_case_x:nnn {#1}
      {
        \CJKrmdefault { \token_to_str:N \setCJKmainfont }
        \CJKsfdefault { \token_to_str:N \setCJKsansfont }
        \CJKttdefault { \token_to_str:N \setCJKmonofont }
      }
      { \token_to_str:N \setCJKfamilyfont {#1} }
    [...]{...}~to~define~it.
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setCJKfamilyfont, \newCJKfontfamily, \CJKfontspec}
% 分别用于预声明 CJK 字体和随机调用 CJK 字体。
%    \begin{macrocode}
\NewDocumentCommand \setCJKfamilyfont { m O{} m }
  { \xeCJK_set_family:nnn {#1} {#2} {#3} }
\NewDocumentCommand \newCJKfontfamily { o m O{} m }
  {
    \IfNoValueTF {#1}
      { \tl_set:Nx \l_xeCJK_family_tl { \cs_to_str:N #2 } }
      { \tl_set:Nx \l_xeCJK_family_tl {#1} }
    \xeCJK_set_family:nnn \l_xeCJK_family_tl {#3} {#4}
    \cs_new_protected_nopar:Npx #2 { \exp_not:N \CJKfamily { \l_xeCJK_family_tl } }
  }
\int_new:N   \g_xeCJK_fontspec_int
\int_gdecr:N \g_xeCJK_fontspec_int
\NewDocumentCommand \CJKfontspec { O{} m }
  {
    \tl_set:Nx \l_xeCJK_CJKfontspec_id_tl { CJKfontspec/#1/#2/id }
    \cs_if_free:cT \l_xeCJK_CJKfontspec_id_tl
      {
        \int_gincr:N \g_xeCJK_fontspec_int
        \tl_gset:Nx \g_xeCJK_family_spec_tl
          { CJKfontspec ( \int_use:N \g_xeCJK_fontspec_int ) }
        \xeCJK_set_family:nnn \g_xeCJK_family_spec_tl {#1} {#2}
        \tl_gset:cx \l_xeCJK_CJKfontspec_id_tl \g_xeCJK_family_spec_tl
      }
    \exp_args:Nv \CJKfamily \l_xeCJK_CJKfontspec_id_tl
    \tex_ignorespaces:D
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\defaultCJKfontfeatures, \addCJKfontfeatures}
% 分别用于设置 CJK 字体的默认属性和增加当前 CJK 字体的属性。
%    \begin{macrocode}
\clist_new:N \g_xeCJK_default_features_clist
\NewDocumentCommand \defaultCJKfontfeatures { m }
  { \clist_gset:Nn \g_xeCJK_default_features_clist {#1} }
\defaultCJKfontfeatures { Script = CJK }
\@onlypreamble \defaultCJKfontfeatures
\NewDocumentCommand \addCJKfontfeatures { m }
  {
    \prop_if_in:NVTF \g_xeCJK_family_prop \xeCJK@family
      {
        \group_begin:
        \clist_set:Nx \l_xeCJK_tmpa_clist {#1}
        \prop_get:NVN \g_xeCJK_family_prop \xeCJK@family \l_xeCJK_tmpa_tl
        \clist_map_inline:Nn \g_xeCJK_CJK_subclass_clist
          {
            \clist_if_in:NnT \l_xeCJK_tmpa_clist {##1}
              {
                \clist_remove_all:Nn \l_xeCJK_tmpa_clist {##1}
                \prop_get:NxNF \g_xeCJK_family_prop { \xeCJK@family/##1 } \l_xeCJK_tmpb_tl
                  {
                    \prop_get:NxNF \g_xeCJK_family_prop
                      { \CJKfamilydefault/##1 } \l_xeCJK_tmpb_tl
                      { \tl_set:Nx \l_xeCJK_tmpb_tl \l_xeCJK_tmpa_tl }
                  }
                \clist_set:Nx \l_xeCJK_tmpa_clist
                  { ##1 = { [ \l_xeCJK_tmpa_clist ] { \l_xeCJK_tmpb_tl } } }
                \clist_map_break:
              }
          }
        \prop_get:NVNF \g_xeCJK_family_options_prop \xeCJK@family \l_xeCJK_tmpb_clist
          { \clist_clear:N \l_xeCJK_tmpb_clist }
        \clist_clear:N \l_xeCJK_tmpc_clist
        \clist_map_inline:Nn \l_xeCJK_tmpb_clist
          {
            \clist_if_in:NnF \l_xeCJK_tmpa_clist {##1}
              { \clist_put_right:Nn \l_xeCJK_tmpc_clist {##1} }
          }
        \clist_put_left:NV \l_xeCJK_tmpa_clist \l_xeCJK_tmpc_clist
        \use:x
          { \group_end: \exp_not:N \CJKfontspec [ \l_xeCJK_tmpa_clist ] { \l_xeCJK_tmpa_tl } }
      }
      { \xeCJK_warning:n { addCJKfontfeature-ignored } }
    \tex_ignorespaces:D
  }
\cs_new_eq:NN \addCJKfontfeature \addCJKfontfeatures
\xeCJK_msg_new:nn { addCJKfontfeature-ignored }
  {
    \tl_to_str:N \addCJKfontfeature (s)~ignored.\\\\
    It~cannot~be~used~with~a~font~that~wasn't~selected~by~xeCJK.
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setCJKmainfont,\setCJKsansfont}
% 设置文档的 CJK 普通字体、无衬线字体。
%    \begin{macrocode}
\NewDocumentCommand \setCJKmainfont { O{} m }
  { \xeCJK_set_family:nnn \CJKrmdefault {#1} {#2} }
\cs_new_eq:NN \setCJKromanfont \setCJKmainfont
\NewDocumentCommand \setCJKsansfont { O{} m }
  { \xeCJK_set_family:nnn \CJKsfdefault {#1} {#2} }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\CJKrmdefault,\CJKsfdefault,\CJKttdefault,\CJKfamilydefault}
%    \begin{macrocode}
\cs_if_free:NT \CJKrmdefault     { \tl_set:Nn \CJKrmdefault { rm } }
\cs_if_free:NT \CJKsfdefault     { \tl_set:Nn \CJKsfdefault { sf } }
\cs_if_free:NT \CJKttdefault     { \tl_set:Nn \CJKttdefault { tt } }
\cs_if_free:NT \CJKfamilydefault { \tl_set:Nn \CJKfamilydefault { \CJKrmdefault } }
\tl_new:c { xeCJK/family/\CJKfamilydefault }
%    \end{macrocode}
% \end{macro}
%
% 补丁 |\normalfont|,|\rmfamily|,|\sffamily| 和 |\ttfamily|,使其同时对
% CJK 字体族有效。
% \begin{macrocode}
\AtEndOfPackage
  {
    \etex_protected:D \tl_put_right:Nn \normalfont { \CJKfamily \CJKfamilydefault }
    \etex_protected:D \tl_put_right:Nn \rmfamily   { \CJKfamily \CJKrmdefault }
    \etex_protected:D \tl_put_right:Nn \sffamily   { \CJKfamily \CJKsfdefault }
    \etex_protected:D \tl_put_right:Nn \ttfamily   { \CJKfamily \CJKttdefault }
    \cs_set_eq:NN \reset@font \normalfont
  }
%    \end{macrocode}
%
% 为了保证 CJK 数学字体的正确设置,应在导言区内设置 CJK 字体。
%    \begin{macrocode}
\@onlypreamble \setCJKmainfont
\@onlypreamble \setCJKmathfont
\@onlypreamble \setCJKsansfont
\@onlypreamble \setCJKmonofont
\@onlypreamble \setCJKromanfont
%    \end{macrocode}
%
% \subsection{数学字体设置}
%
% \begin{macro}{\setCJKmathfont}
% 设置 CJK 数学字体。
%    \begin{macrocode}
\NewDocumentCommand \setCJKmathfont { O{} m }
  { \xeCJK_set_family:nnn \c_xeCJK_math_tl {#1} {#2} }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CJKmath}
% 数学公式内的 CJK 字体。
%    \begin{macrocode}
\tl_const:Nn \c_xeCJK_math_tl { CJKmath }
\keys_define:nn { xeCJK / options } { CJKmath .bool_gset:N = \g_xeCJK_math_bool }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKsetmathcode}
%    \begin{macrocode}
\NewDocumentCommand \xeCJKsetmathcode { m m m m }
  {
    \xeCJK_check_num_range:nnNN {#1} {#2} \l_xeCJK_tmpa_int \l_xeCJK_tmpb_int
    \int_set:Nn \l_xeCJK_tmpc_int { \xeCJK_math_type:n {#3} }
    \loop
      \XeTeXmathcode
        \l_xeCJK_tmpa_int = \l_xeCJK_tmpc_int \use:c { sym #4 } \l_xeCJK_tmpa_int
      \if_int_compare:w \l_xeCJK_tmpa_int < \l_xeCJK_tmpb_int
        \int_incr:N \l_xeCJK_tmpa_int
    \repeat
  }
\cs_new_eq:NN \xeCJK_math_type:n \mathchar@type
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_mathfont:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_set_mathfont:
  {
    \xeCJK_family_if_exist:xTF \c_xeCJK_math_tl
      { \tl_set:Nx \l_xeCJK_tmpa_tl \c_xeCJK_math_tl }
      {
        \xeCJK_family_if_exist:xTF \CJKfamilydefault
          { \tl_set:Nx \l_xeCJK_tmpa_tl \CJKfamilydefault }
          { \tl_set_eq:NN \l_xeCJK_tmpa_tl \q_no_value }
      }
    \prop_get:NVNT \g_xeCJK_family_name_prop \l_xeCJK_tmpa_tl \l_xeCJK_math_family_tl
      {
        \DeclareSymbolFont \c_xeCJK_math_tl       \g_fontspec_encoding_tl
          \l_xeCJK_math_family_tl \mddefault \shapedefault
        \SetSymbolFont  \c_xeCJK_math_tl { bold } \g_fontspec_encoding_tl
          \l_xeCJK_math_family_tl \bfdefault \shapedefault
        \clist_map_inline:nn { CJK, FullLeft, FullRight  }
          {
            \clist_map_inline:cn { g_xeCJK_##1_range_clist }
              {
                \xeCJK_set_char_class_aux:Nn \xeCJKsetmathcode {####1}
                  \mathalpha \c_xeCJK_math_tl
              }
          }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% 当没有设置 CJK 数学字体时,使用 |\CJKfamilydefault| 作为数学字体。
%    \begin{macrocode}
\xeCJK_AtEndPreamble:n
  {
    \normalfont
    \prop_if_empty:NTF \g_xeCJK_family_prop
      { \xeCJK_warning:n { no-CJKfamily } }
      { \bool_if:NT \g_xeCJK_math_bool { \xeCJK_set_mathfont: } }
  }
\xeCJK_msg_new:nn { no-CJKfamily }
  {
    It~seems~that~you~have~not~declare~a~CJKfamily.\\
    If~you~want~to~use~xeCJK~in~the~right~way,~you~should~use\\\\
    \token_to_str:N \xeCJKmainfont[...]{...}\\\\
    in~the~preamble~to~declare~the~main~CJKfamily.\\
  }
%    \end{macrocode}
%
% \subsection{处理等宽字体和抄录环境}
%
% \begin{macro}[internal,var]{\g_xeCJK_monoscale_fp,\g_xeCJK_exspace_dim}
%    \begin{macrocode}
\fp_new:N \g_xeCJK_monoscale_fp
\dim_new:N \g_xeCJK_exspace_dim
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setCJKmonoscale}
%    \begin{macrocode}
\NewDocumentCommand \setCJKmonoscale { }
  {
    \CJKflexiblespacing
    \xeCJK_set_monoscale:
    \addCJKfontfeatures { Scale = \fp_use:N \g_xeCJK_monoscale_fp }
  }
\cs_new_protected_nopar:Npn \xeCJK_set_monoscale:
  {
    \group_begin:
      \fontfamily \ttdefault \selectfont
      \fp_gset:Nn \g_xeCJK_monoscale_fp
        { \dim_to_fp:n { \c_two \tex_fontdimen:D \c_two \tex_font:D } / ( \f@size ) }
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setCJKmonoexspace}
%    \begin{macrocode}
\NewDocumentCommand \setCJKmonoexspace { } { \xeCJK_set_monoexspace: }
\cs_new_protected_nopar:Npn \xeCJK_set_monoexspace:
  {
    \group_begin:
      \fontfamily \ttdefault \selectfont
      \dim_gset:Nn \g_xeCJK_exspace_dim
        { \c_two \tex_fontdimen:D \c_two \tex_font:D - \f@size \p@ }
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\CJKfixedspacing,\CJKflexiblespacing}
%    \begin{macrocode}
\NewDocumentCommand \CJKfixedspacing { }
  {
    \bool_if:NF \l_xeCJK_fixed_spacing_bool
      {
        \bool_set_true:N \l_xeCJK_fixed_spacing_bool
        \tl_set_eq:NN \l_xeCJK_flexible_punctstyle_tl \l_xeCJK_punctstyle_tl
        \bool_set_eq:NN \l_xeCJK_fixed_xecglue_bool \l_xeCJK_xecglue_bool
        \cs_set_eq:NN \xeCJK_flexible_ecglue:  \CJKecglue
        \cs_set_eq:NN \xeCJK_flexible_cjkglue: \CJKglue
        \xeCJK_set_monoexspace:
        \xeCJKsetup
          {
            PunctStyle = plain ,
            CJKglue    = { \skip_horizontal:N \g_xeCJK_exspace_dim } ,
            CJKecglue  = { \skip_horizontal:n { .5\g_xeCJK_exspace_dim } } ,
            xCJKecglue = false ,
          }
      }
  }
\NewDocumentCommand \CJKflexiblespacing { }
  {
    \bool_if:NT \l_xeCJK_fixed_spacing_bool
      {
        \bool_set_false:N \l_xeCJK_fixed_spacing_bool
        \exp_args:Nx \xeCJKsetup
          {
            PunctStyle = { \l_xeCJK_flexible_punctstyle_tl } ,
            CJKglue    = { \xeCJK_flexible_cjkglue: } ,
            CJKecglue  = { \xeCJK_flexible_ecglue: } ,
            xCJKecglue = { \bool_if:NTF \l_xeCJK_fixed_xecglue_bool { true } { false } } ,
          }
      }
  }
\bool_new:N \l_xeCJK_fixed_spacing_bool
\xeCJK_AfterPreamble:n { \tl_put_right:Nn \verbatim@font \CJKfixedspacing }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setCJKmonofont}
% 设置文档的 CJK 等宽字体族。
%    \begin{macrocode}
\NewDocumentCommand \setCJKmonofont { s t+ O{} m }
  {
    \IfBooleanTF {#1}
      { \xeCJK_set_family:nnn \CJKttdefault { Mono = Scale, #3 } {#4} }
      {
        \IfBooleanTF {#2}
          { \xeCJK_set_family:nnn \CJKttdefault { Mono = Exspace, #3 } {#4} }
          { \xeCJK_set_family:nnn \CJKttdefault {#3} {#4} }
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \subsection{\pkg{xeCJK} 其它选项}
%
% \begin{macro}{CJKnumber,indentfirst}
% 是否启用 \pkg{CJKnumber} 宏包和首行是否缩进,其中 |CJKnumber| 选项仅
% 在 \pkg{xeCJK} 宏包调用的时候有效。并将 \pkg{xeCJK} 中未知的选项传递给
% \pkg{fontspec} 宏包。
%    \begin{macrocode}
\bool_new:N \g_xeCJK_indent_bool
\keys_define:nn { xeCJK / options }
  {
    CJKnumber     .bool_set:N = \g_xeCJK_number_bool ,
    indentfirst   .bool_set:N = \g_xeCJK_indent_bool ,
    normalindentfirst .meta:n = { indentfirst = false } ,
    quiet .code:n =
      {
        \msg_redirect_module:nnn { xeCJK } { warning } { info }
        \msg_redirect_module:nnn { xeCJK } { info }    { none }
        \xeCJK_if_package_loaded:nF { fontspec }
          { \PassOptionsToPackage { quiet } { fontspec } }
      },
    silent .code:n =
      {
        \msg_redirect_module:nnn { xeCJK } { warning } { none }
        \msg_redirect_module:nnn { xeCJK } { info }    { none }
        \xeCJK_if_package_loaded:nF { fontspec }
          { \PassOptionsToPackage { silent } { fontspec } }
      },
    unknown .code:n =
      {
        \xeCJK_if_package_loaded:nTF { fontspec }
          { \xeCJK_error:nx { key-unknown } { \l_keys_key_tl } }
          { \PassOptionsToPackage { \l_keys_key_tl } { fontspec } }
      },
  }
\xeCJK_msg_new:nn { key-unknown }
  {
    Sorry,~but~\l__keys_module_tl\c_space_tl does~not~have~a~key~called~'#1'.\\\\
    The~key~'#1'~is~being~ignored.
  }
%    \end{macrocode}
% \end{macro}
%
% \subsection{\pkg{xeCJK} 初始化设置}
%
% \pkg{xeCJK} 宏包的初始化设置。
%    \begin{macrocode}
\keys_set:nn { xeCJK / options }
  {
    CJKglue = { \skip_horizontal:n { \c_zero_skip \@plus .08\baselineskip } } ,
    CJKecglue       = \c_space_token ,
    xCJKecglue      = false ,
    CheckSingle     = false ,
    CJKspace        = false ,
    CJKmath         = false ,
    xeCJKactive     = true  ,
    indentfirst     = true  ,
    EmboldenFactor  = 4 ,
    SlantFactor     = .167 ,
    PunctStyle      = quanjiao ,
    KaiMingPunct    = { . 。? ! } ,
    LongPunct       = { — ‥ … ─ } ,
    MiddlePunct     = { · ・ ・ } ,
    AllowBreakBetweenPuncts = false ,
  }
%    \end{macrocode}
%
% \begin{macro}[internal]{\CJKsymbol, \CJKpunctsymbol}
%    \begin{macrocode}
\cs_new_nopar:Npn \CJKsymbol      #1 {#1}
\cs_new_nopar:Npn \CJKpunctsymbol #1 {#1}
%    \end{macrocode}
% \end{macro}
%
% 执行宏包选项,并载入 \pkg{fontspec} 宏包。
%    \begin{macrocode}
\ProcessKeysOptions { xeCJK / options }
\RequirePackage { fontspec } [ 2011/09/13 ]
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_if:NT \g_xeCJK_indent_bool
  {
    \cs_set_eq:NN \@afterindentfalse \@afterindenttrue
    \@afterindenttrue
  }
%    \end{macrocode}
%
% \begin{macro}{\xeCJKsetup}
% 在导言区或文档中设置 \pkg{xeCJK} 的接口。
%    \begin{macrocode}
\NewDocumentCommand \xeCJKsetup { m }
  {
    \keys_set:nn { xeCJK / options } {#1}
    \tex_ignorespaces:D
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJKsetemboldenfactor, \xeCJKsetslantfactor}
%    \begin{macrocode}
\NewDocumentCommand \xeCJKsetemboldenfactor { m }
  { \xeCJKsetup { EmboldenFactor = {#1} } }
\NewDocumentCommand \xeCJKsetslantfactor { m }
  { \xeCJKsetup { SlantFactor = {#1} } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\punctstyle, \xeCJKplainchr}
%    \begin{macrocode}
\NewDocumentCommand \punctstyle { m } { \xeCJKsetup { PunctStyle = {#1} } }
\NewDocumentCommand \xeCJKplainchr { } { \punctstyle { plain } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\CJKsetecglue}
%    \begin{macrocode}
\NewDocumentCommand \CJKsetecglue { m } { \xeCJKsetup { CJKecglue = {#1} } }
\cs_new_eq:NN \xeCJKsetecglue \CJKsetecglue
%    \end{macrocode}
% \end{macro}
%
% \subsection{兼容性修补}
%
% \begin{macro}[internal]{\xeCJK_fix_itcorr:}
% 修复倾斜校正。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_fix_itcorr:
  {
    \scan_stop:
    \xeCJK_if_last_node:nTF { default }
      {
        \tex_unkern:D \tex_unkern:D
        \xeCJK_itcorr_aux
        { \xeCJK_make_node:n { default_itcorr } }
      }
      { \xeCJK_itcorr_aux }
  }
\cs_new_eq:NN \xeCJK_itcorr_aux \/
\cs_set_protected_nopar:Npn \/
  {
    \int_compare:nNnTF \XeTeXinterchartokenstate > \c_zero
      { \xeCJK_fix_itcorr: } { \xeCJK_itcorr_aux }
  }
\cs_set_eq:NN \@@italiccorr \/
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_set_others_toks:n,\xeCJK_Others_class}
% 简单处理与同样使用 |\XeTeXinterchartoks| 机制的宏包的兼容问题。
% \begin{macrocode}
\xeCJK_AfterEndPreamble:n
  {
    \int_compare:nNnF
      { \c_three + ( \seq_count:N \g_xeCJK_class_seq ) } = \xe@alloc@intercharclass
      {
        \int_step_inline:nnnn \c_four \c_one \xe@alloc@intercharclass
          {
            \seq_if_in:NnF \g_xeCJK_class_seq {#1}
              { \xeCJK_set_others_toks:n {#1} }
          }
      }
  }
\cs_new_protected_nopar:Npn \xeCJK_set_others_toks:n #1
  {
    \int_set:Nn \xeCJK_Others_class {#1}
    \clist_map_inline:Nn \g_xeCJK_CJK_class_clist
      {
        \xeCJK_copy_inter_class_toks:nnnn {##1} { Others } {##1} { NormalSpace }
        \xeCJK_copy_inter_class_toks:nnnn { Others } {##1} { NormalSpace } {##1}
        \exp_args:Nnnx \xeCJK_app_inter_class_toks:nnn {##1} { Others }
          { \xeCJK_get_inter_class_toks:nn { Default } { Others } }
        \exp_args:Nnnx \xeCJK_pre_inter_class_toks:nnn { Others } {##1}
          { \xeCJK_get_inter_class_toks:nn { Others } { Default } }
        \xeCJK_if_blank_x:nT { \xeCJK_get_inter_class_toks:nn { Others } { Boundary } }
          {
            \xeCJK_copy_inter_class_toks:nnnn
              { Others } { Boundary } { Default } { Boundary }
          }
        \xeCJK_if_blank_x:nT { \xeCJK_get_inter_class_toks:nn { Boundary } { Others } }
          {
            \xeCJK_copy_inter_class_toks:nnnn
              { Boundary } { Others } { Boundary } { Default }
          }
      }
  }
\int_new:N \xeCJK_Others_class
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\xeCJK_patch:Nnn}
% 给已有宏内容前后附加补丁。
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_patch:Nnn #1#2#3
  { \tl_put_left:Nn  #1 {#2} \tl_put_right:Nn #1 {#3} }
%    \end{macrocode}
% \end{macro}
%
% 单独处理宽度有分歧的几个标点:包括省略号、破折号、间隔号、引号等中西文混用的
% 符号, 保证其命令形式输出的是西文字体。并对一些编码的符号宏包做特殊处理。
% \begin{macrocode}
\xeCJK_AfterPreamble:n
  {
    \tl_map_inline:nn
      {
        \textellipsis  \textemdash     \textperiodcentered \textcentereddot
        \textquoteleft \textquoteright \textquotedblleft   \textquotedblright
      }
      {
        \xeCJK_patch:Nnn #1
          { \xeCJK_group_begin: \makexeCJKinactive }
          { \xeCJK_group_end: }
      }
    \xeCJK_patch:Nnn \tipaencoding { \makexeCJKinactive } { }
    \cs_set_eq:NN \xeCJK_aux_r \r
    \cs_set_protected_nopar:Npn \r #1 { { \makexeCJKinactive \xeCJK_aux_r {#1} } }
    \xeCJK_if_package_loaded:nT { pifont }
      {
        \RenewDocumentCommand \Pifont { m }
          {
            \fontencoding {U} \fontfamily {#1} \fontseries {m} \fontshape {n}
            \selectfont \makexeCJKinactive
          }
      }
  }
\cs_new_eq:NN \xeCJK_group_begin: \group_begin:
\cs_new_eq:NN \xeCJK_group_end: \group_end:
%    \end{macrocode}
%
% 简单处理与 \pkg{hyperref} 宏包的兼容问题。
%    \begin{macrocode}
\xeCJK_AfterEndPreamble:n
  {
    \bool_if:nT
      {
        \xeCJK_if_package_loaded_p:n { hyperref } &&
        \tl_if_exist_p:N \pdfstringdefPreHook
      }
      {
        \tl_put_right:Nn \pdfstringdefPreHook
          {
            \cs_set_eq:NN \makexeCJKinactive \prg_do_nothing:
            \cs_set_eq:NN \xeCJK_group_begin: \prg_do_nothing:
            \cs_set_eq:NN \xeCJK_group_end: \prg_do_nothing:
            \cs_set_eq:NN \CJKfamily \use_none:n
          }
      }
  }
%    \end{macrocode}
%
% 禁止在 \pkg{xeCJK} 宏包后再载入 \pkg{CJK} 宏包。
%    \begin{macrocode}
\tl_set:cn { ver@CJK.sty } { 2050/01/01 }
%    \end{macrocode}
%
% \begin{macro}[internal]{\xeCJKcaption}
% 可以使用 \pkg{CJK} 宏包中的 |.cpx| 文件。
%    \begin{macrocode}
\cs_if_free:NT \CJK@ifundefined
  { \cs_set_eq:NN \CJK@ifundefined \cs_if_free:NTF }
\NewDocumentCommand \xeCJKcaption { o m }
  {
    \IfValueT {#1} { \XeTeXdefaultencoding "#1" }
    \cs_set_nopar:Npx \xeCJK_reset_at_catcode:
      {
        \exp_not:n { \char_set_catcode:nn  { `\@ } }
                   { \char_value_catcode:n { `\@ } }
      }
    \char_set_catcode_letter:N \@
    \file_input:n { #2.cpx }
    \xeCJK_reset_at_catcode:
    \XeTeXdefaultencoding "UTF-8"
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%   {\xeCJK_ULprepunctchar:n, \xeCJK_ULpostpunctchar:n, \xeCJK_ULroutines:}
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \xeCJK_ULprepunctchar:n #1
  {
    { \makexeCJKinactive \CJKpunctsymbol {#1} \xeCJK_no_break: }
    \tex_ignorespaces:D
  }
\cs_new_protected_nopar:Npn \xeCJK_ULpostpunctchar:n #1
  {
    { \makexeCJKinactive \CJKpunctsymbol {#1} }
    \xeCJK_ignorespaces:
  }
\cs_new_protected_nopar:Npn \xeCJK_ULroutines:
  {
    \xeCJK_inter_class_toks:nnn { Default   } { CJK } { \CJKecglue \CJKsymbol }
    \xeCJK_inter_class_toks:nnn { HalfLeft  } { CJK } { \CJKsymbol }
    \xeCJK_inter_class_toks:nnn { HalfRight } { CJK } { \CJKecglue \CJKsymbol }
    \xeCJK_inter_class_toks:nnn { Boundary  } { CJK } { \xeCJK_Boundary_and_CJK: }
    \clist_map_inline:nn { Default, HalfLeft, HalfRight, Boundary }
      {
        \xeCJK_inter_class_toks:nnn {##1} { FullLeft }  { \xeCJK_ULprepunctchar:n }
        \xeCJK_inter_class_toks:nnn {##1} { FullRight } { \xeCJK_ULpostpunctchar:n }
      }
    \xeCJK_UL_subclass_patch_tl
  }
%    \end{macrocode}
% \end{macro}
%
% 对 \pkg{ulem} 宏包打补丁,以支持 \pkg{CJKfntef} 宏包。
% \begin{macrocode}
\xeCJK_AfterPreamble:n
  {
    \cs_if_exist:NT \UL@hook
      {
        \addto@hook \UL@hook
          {
            \cs_set_eq:NN \xeCJK_UL_CJKsymbol \CJKsymbol
            \cs_set_eq:NN \xeCJK_UL_CJKpunctsymbol \CJKpunctsymbol
            \cs_set_protected_nopar:Npn \CJKsymbol #1
              {
                { \xeCJK_select_font: \xeCJK_UL_CJKsymbol {#1} }
                { \xeCJK_make_node:n { CJK } } \xeCJK_ignorespaces:
              }
            \cs_set_protected_nopar:Npn \CJKpunctsymbol #1
              { { \xeCJK_select_font: \xeCJK_UL_CJKpunctsymbol {#1} } }
            \xeCJK_ULroutines:
          }
      }
    \cs_if_exist:NT \XeTeX@CJKfntef@hook
      {
        \cs_set_nopar:Npn \XeTeX@CJKfntef@hook
          { \xeCJK_select_font: \makexeCJKinactive }
      }
  }
%    \end{macrocode}
%
% 使用 \pkg{CJKnumb} 宏包。
%    \begin{macrocode}
\bool_if:NT \g_xeCJK_number_bool
  {
    \tl_set:Nn \CJK@UnicodeEnc { UTF8 }
    \cs_set_protected_nopar:Npn \CJKaddEncHook #1#2
      { \cs_set_nopar:cpn { xeCJK_enc_#1 } {#2} }
    \cs_set_protected_nopar:Npn \Unicode #1#2
      { \tex_char:D \int_eval:n { (#1) * \c_two_hundred_fifty_six + (#2) } }
    \RequirePackage { CJKnumb }
    \use:c { xeCJK_enc_\CJK@UnicodeEnc }
    \tl_set:Nn \CJK@tenthousand    { 万 }
    \tl_set:Nn \CJK@hundredmillion { 亿 }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \makeatletter
% \let\special@index\@gobble
% \makeatother
%
% \section{例子}
%
% \subsection{\pkg{xeCJK-example-autofake.tex}}
%
%    \begin{macrocode}
%<*ex-autofake>
%    \end{macrocode}
%
% \begin{macrocode}
\documentclass{article}
\usepackage[AutoFakeBold,AutoFakeSlant]{xeCJK}
\setCJKmainfont[BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc}
\setCJKsansfont[AutoFakeSlant=false,
  BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc}
\setCJKmonofont[ItalicFont=simkai.ttf]{simsun.ttc}
\begin{document}
\centering
\begin{tabular}{lllll}
\hline
 {\bf rm} & md & up & \verb|\rmfamily\mdseries\upshape| &
                      {\rmfamily\mdseries\upshape English 中文字体} \\
          & md & it & \verb|\rmfamily\mdseries\itshape| &
                      {\rmfamily\mdseries\itshape English 中文字体} \\
          & md & sl & \verb|\rmfamily\mdseries\slshape| &
                      {\rmfamily\mdseries\slshape English 中文字体} \\ \cline{2-5}
          & bf & up & \verb|\rmfamily\bfseries\upshape| &
                      {\rmfamily\bfseries\upshape English 中文字体} \\
          & bf & it & \verb|\rmfamily\bfseries\itshape| &
                      {\rmfamily\bfseries\itshape English 中文字体} \\
          & bf & sl & \verb|\rmfamily\bfseries\slshape| &
                      {\rmfamily\bfseries\slshape English 中文字体} \\ \hline
 {\bf sf} & md & up & \verb|\sffamily\mdseries\upshape| &
                      {\sffamily\mdseries\upshape English 中文字体} \\
          & md & it & \verb|\sffamily\mdseries\itshape| &
                      {\sffamily\mdseries\itshape English 中文字体} \\
          & md & sl & \verb|\sffamily\mdseries\slshape| &
                      {\sffamily\mdseries\slshape English 中文字体} \\ \cline{2-5}
          & bf & up & \verb|\sffamily\bfseries\upshape| &
                      {\sffamily\bfseries\upshape English 中文字体} \\
          & bf & it & \verb|\sffamily\bfseries\itshape| &
                      {\sffamily\bfseries\itshape English 中文字体} \\
          & bf & sl & \verb|\sffamily\bfseries\slshape| &
                      {\sffamily\bfseries\slshape English 中文字体} \\ \hline
 {\bf tt} & md & up & \verb|\ttfamily\mdseries\upshape| &
                      {\ttfamily\mdseries\upshape English 中文字体} \\
          & md & it & \verb|\ttfamily\mdseries\itshape| &
                      {\ttfamily\mdseries\itshape English 中文字体} \\
          & md & sl & \verb|\ttfamily\mdseries\slshape| &
                      {\ttfamily\mdseries\slshape English 中文字体} \\ \cline{2-5}
          & bf & up & \verb|\ttfamily\bfseries\upshape| &
                      {\ttfamily\bfseries\upshape English 中文字体} \\
          & bf & it & \verb|\ttfamily\bfseries\itshape| &
                      {\ttfamily\bfseries\itshape English 中文字体} \\
          & bf & sl & \verb|\ttfamily\bfseries\slshape| &
                      {\ttfamily\bfseries\slshape English 中文字体} \\ \hline
\end{tabular}
\end{document}
%    \end{macrocode}
%
%    \begin{macrocode}
%</ex-autofake>
%    \end{macrocode}
%
% \subsection{\pkg{xeCJK-example-fallback.tex}}
%
%    \begin{macrocode}
%<*ex-fallback>
%    \end{macrocode}
%
% \begin{macrocode}
\documentclass{article}
\usepackage[AutoFallBack]{xeCJK}
\usepackage{CJKfntef}
\usepackage{array}
\setCJKmainfont[AutoFakeBold,AutoFakeSlant]{KaiTi_GB2312}
\setCJKfallbackfamilyfont{\CJKrmdefault}[BoldFont=SimHei]
  { [SlantedFont=FangSong]{SimSun} ,
    [BoldFont=*]          {SimSun-ExtB} }
\begin{document}
漢字源𣴑考

\textbf{漢字源𣴑考}

\textsl{漢字源𣴑考}

\CJKunderwave{漢字源𣴑考}
\begin{table}[ht]
\caption{生僻字测试}
\medskip\centering
\begin{tabular}{*4{|c>{\ttfamily U+}l}|}
㐀 & 3400  & 㐁 & 3401  & 㐂 & 3402  & 㐃 & 3403  \\
㐄 & 3404  & 㐅 & 3405  & 㐆 & 3406  & 㐇 & 3407  \\
㐈 & 3408  & 㐉 & 3409  & 㐊 & 340A  & 㐋 & 340B  \\
㐌 & 340C  & 㐍 & 340D  & 㐎 & 340E  & 㐏 & 341F  \\
㐐 & 3410  & 㐑 & 3411  & 㐒 & 3412  & 㐓 & 3413  \\
㐔 & 3414  & 㐕 & 3415  & 㐖 & 3416  & 㐗 & 3417  \\
㐘 & 3418  & 㐙 & 3419  & 㐚 & 341A  & 㐛 & 341B  \\
㐜 & 341C  & 㐝 & 341D  & 㐞 & 341E  & 㐟 & 341F  \\[1ex]
𠀀 & 20000 & 𠀁 & 20001 & 𠀂 & 20002 & 𠀃 & 20003 \\
𠀄 & 20004 & 𠀅 & 20005 & 𠀆 & 20006 & 𠀇 & 20007 \\
𠀈 & 20008 & 𠀉 & 20009 & 𠀊 & 2000A & 𠀋 & 2000B \\
𠀌 & 2000C & 𠀍 & 2000D & 𠀎 & 2000E & 𠀏 & 2000F \\
𠀐 & 20010 & 𠀑 & 20011 & 𠀒 & 20012 & 𠀓 & 20013 \\
𠀔 & 20014 & 𠀕 & 20015 & 𠀖 & 20016 & 𠀗 & 20017 \\
𠀘 & 20018 & 𠀙 & 20019 & 𠀚 & 2001A & 𠀛 & 2001B \\
𠀜 & 2001C & 𠀝 & 2001D & 𠀞 & 2001E & 𠀟 & 2001F \\
\end{tabular}
\end{table}
\end{document}
%    \end{macrocode}
%
%    \begin{macrocode}
%</ex-fallback>
%    \end{macrocode}
%
% \subsection{\pkg{xeCJK-example-subCJKblock.tex}}
%
%    \begin{macrocode}
%<*ex-block>
%    \end{macrocode}
%
% \begin{macrocode}
\documentclass{article}
\usepackage{xeCJK}
\usepackage{array}
\xeCJKDeclareSubCJKBlock{Ext-A} { "3400 -> "4DBF }
\xeCJKDeclareSubCJKBlock{Ext-B} { "20000 -> "2A6DF }
\xeCJKDeclareSubCJKBlock{Kana}  { "3040 -> "309F, "30A0 -> "30FF, "31F0 -> "31FF, }
\xeCJKDeclareSubCJKBlock{Hangul}{ "1100 -> "11FF, "3130 -> "318F, "A960 -> "A97F, "AC00 -> "D7AF }
\setCJKmainfont[Ext-A=SimHei,Ext-B=SimSun-ExtB]{SimSun}
\setCJKmainfont[Kana]{Meiryo}
\setCJKmainfont[Hangul]{Malgun Gothic}
\parindent=2em
\begin{document}
\long\def\showtext{%
中日韩越统一表意文字(英语:CJKV Unified Ideographs),旧称中日韩统一表意文字(英语:CJK Unified Ideographs),也称统一汉字(英语:Unihan),目的是要把分别来自中文、日文、韩文、越文、壮文中,对于相同起源、本义相同、形状一样或稍异的表意文字(主要为汉字,但也有仿汉字如:方块壮字、日文汉字(かんじ / kanji)、韩文汉字(한자 / hanja)、越南的喃字(Chữ Nôm)与越文汉字(Chữ Nho,在越南也称作儒字),应赋予其在ISO 10646及统一码标准中有相同编码。此计划原本只包含中文、日文及韩文中所使用的汉字,是以旧称中日韩统一表意文字(CJK)。后来,此计划加入了越文的喃字,所以合称中日韩越统一表意文字(CJKV)。

CJK統合漢字(シージェーケーとうごうかんじ、CJK Unified Ideographs)は、ISO/IEC 10646 (Universal Multiple-Octet Coded Character Set, 略称 UCS) および Unicodeにて採用されている符号化用漢字集合およびその符号表である。CJK統合漢字の名称は、中国語(Chinese)、日本語(Japanese)、韓国語(Korean)で使われている漢字をひとまとめにしたことからきている。CJK統合漢字の初版である Unified Repertoire and Ordering (URO) 第二版は1992年に制定されたが、1994年にベトナムで使われていた漢字も含めることにしたため、CJKVと呼ばれる事もある。CJKVは、中国語・日本語・韓国語・ベトナム語 (英語: Chinese-Japanese-Korean-Vietnamese) の略。特に、その4言語で共通して使われる、または使われていた文字体系である漢字(チュノムを含む)のこと。ソフトウェアの国際化、中でも文字コードに関する分野で用いられる。

\CJKspace
한중일월 통합 한자(또는 한중일 통합 한자)는 유니코드에 담겨 있는 한자들의 집합으로, 한국, 중국, 일본에서 쓰이는 한자를 묶은 것이기 때문에 머리 글자를 따서 한중일(CJK) 통합 한자라고 불렀는데, 최근에는 베트남에서 쓰이는 한자도 추가되었기에 한중일월(CJKV) 통합 한자로 부르게 되었다.

처음에 유니코드에는 65,536($=2^{16}$)자만 들어갈 수 있었기 때문에, 가장 많은 문자가 배당되는 한자를 위해서 한국, 중국, 일본에서 사용하는 한자 중에 모양이 유사하며 그 뜻이 같은 글자를 같은 코드로 통합했다. 따라서 문자 코드만으로 그 한자가 사용되는 언어를 알아 낼 수 없는데, 다만 중국의 간체자나 번체자, 일본의 구자체나 신자체 등 분명하게 모양이 다른 글자는 별도의 부호를 할당하고 있다. 이런 문자 할당 정책에 반발하여 TRON과 같은 인코딩이 만들어지기도 했으나, 실제로 통합된 한자의 차이가 별로 크지 않기 때문에 문제가 되지 않는다는 의견도 있다.
\CJKnospace}
\showtext

\bigskip
\xeCJKCancelSubCJKBlock{Kana,Hangul}
\showtext

\bigskip
\xeCJKRestoreSubCJKBlock{Hangul}
\showtext

\begin{table}[ht]
\caption{生僻字测试}
\medskip\centering
\begin{tabular}{*4{|c>{\ttfamily U+}l}|}
㐀 & 3400  & 㐁 & 3401  & 㐂 & 3402  & 㐃 & 3403  \\
㐄 & 3404  & 㐅 & 3405  & 㐆 & 3406  & 㐇 & 3407  \\
㐈 & 3408  & 㐉 & 3409  & 㐊 & 340A  & 㐋 & 340B  \\
㐌 & 340C  & 㐍 & 340D  & 㐎 & 340E  & 㐏 & 341F  \\
㐐 & 3410  & 㐑 & 3411  & 㐒 & 3412  & 㐓 & 3413  \\
㐔 & 3414  & 㐕 & 3415  & 㐖 & 3416  & 㐗 & 3417  \\
㐘 & 3418  & 㐙 & 3419  & 㐚 & 341A  & 㐛 & 341B  \\
㐜 & 341C  & 㐝 & 341D  & 㐞 & 341E  & 㐟 & 341F  \\[1ex]
𠀀 & 20000 & 𠀁 & 20001 & 𠀂 & 20002 & 𠀃 & 20003 \\
𠀄 & 20004 & 𠀅 & 20005 & 𠀆 & 20006 & 𠀇 & 20007 \\
𠀈 & 20008 & 𠀉 & 20009 & 𠀊 & 2000A & 𠀋 & 2000B \\
𠀌 & 2000C & 𠀍 & 2000D & 𠀎 & 2000E & 𠀏 & 2000F \\
𠀐 & 20010 & 𠀑 & 20011 & 𠀒 & 20012 & 𠀓 & 20013 \\
𠀔 & 20014 & 𠀕 & 20015 & 𠀖 & 20016 & 𠀗 & 20017 \\
𠀘 & 20018 & 𠀙 & 20019 & 𠀚 & 2001A & 𠀛 & 2001B \\
𠀜 & 2001C & 𠀝 & 2001D & 𠀞 & 2001E & 𠀟 & 2001F \\
\end{tabular}
\end{table}
\end{document}
%    \end{macrocode}
%
%    \begin{macrocode}
%</ex-block>
%    \end{macrocode}
%
% \CJKfixedspacing
%
% \subsection{\pkg{xeCJK-example-CJKecglue.tex}}
%
%    \begin{macrocode}
%<*ex-ecglue>
%    \end{macrocode}
%
%    \begin{macrocode}
\documentclass{minimal}
\usepackage{xeCJK}
\setCJKmainfont[BoldFont=SimHei]{SimSun}
\long\def\showtext{%
 这是 English 中文 {\itshape Chinese} 中文    \TeX\
  间隔 \textit{Italic} 中文\textbf{字体} a 数学 $b$ 数学 $c$ $d$\par
 这是English中文{\itshape Chinese}中文\TeX\
 间隔\textit{Italic}中文\textbf{字体}a数学$b$数学$c$ $d$\par
This is an example. 这是一个例子}
\begin{document}
\showtext

\hrulefill\bigskip

\xeCJKsetup{xCJKecglue=\quad}
\showtext
\end{document}
%    \end{macrocode}
%
%    \begin{macrocode}
%</ex-ecglue>
%    \end{macrocode}
%
% \subsection{\pkg{xeCJK-example-checksingle.tex}}
%
%    \begin{macrocode}
%<*ex-single>
%    \end{macrocode}
%
%    \begin{macrocode}
\documentclass{minimal}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\catcode`\。=\active
\def。{.}
\def\foo{一}
\long\def\showtext{一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十。
$$x^2+y^2$$
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十\foo
\begin{equation}
x^2+y^2
\end{equation}
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十。}
\begin{document}
\hsize=30em
\parindent=0pt
\showtext

\hrulefill\bigskip

\xeCJKsetup{CheckSingle}
\showtext
\end{document}
%    \end{macrocode}
%
%    \begin{macrocode}
%</ex-single>
%    \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex
% \Finale
%
\endinput