summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nicematrix/nicematrix.dtx
blob: 2bd6e5ed4343b769e1233bb6222f86dc1762891a (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
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
% \iffalse meta-comment
%
% Copyright (C) 2018-2019 by F. Pantigny
% -----------------------------------
%
% 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.
%
% \fi
% \iffalse
\def\myfileversion{3.15}
\def\myfiledate{2020/04/06}
%
%
%<*batchfile>
\begingroup
\input l3docstrip.tex
\keepsilent
\usedir{tex/latex/nicematrix}
\preamble

Copyright (C) 2018-2020 by F. Pantigny
-----------------------------------

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.

\endpreamble
\askforoverwritefalse
\endgroup
%</batchfile>
%
%<*driver>
\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz)
\VerbatimFootnotes
\usepackage{xltxtra}
\usepackage[xetex]{geometry}
\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}

\usepackage{colortbl}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage{nicematrix}
\usepackage{siunitx}


\NewDocumentEnvironment {scope} {} {} {}
\def\interitem{\vspace{7mm plus 2 mm minus 3mm}}          
\def\emphase{\bgroup\color{RoyalPurple}\let\next=}
\fvset{commandchars=\~\#\@,formatcom=\color{gray}}
\usepackage{titlesec}
\titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
\titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex}
\usepackage{multicol}
\usepackage{arydshln}
\setlength{\columnseprule}{0.4pt}
\usepackage{footnotehyper}
\usepackage{varwidth}
\parindent 0pt

\EnableCrossrefs
\begin{document}
\DocInput{nicematrix.dtx}
\end{document}
%</driver>
% \fi 
% \title{The package \pkg{nicematrix}\thanks{This document corresponds to the version~\myfileversion\space of \pkg{nicematrix},
% at the date of~\myfiledate.}} \author{F. Pantigny \\ \texttt{fpantigny@wanadoo.fr}}
%
% \hypersetup
%   {
%     pdfinfo = 
%      {
%        Title = The package 'nicematrix' ,
%        Subject = A LaTeX package ,
%        Author = F. Pantigny 
%      }
%   }
%
%
% \maketitle
%
% \begin{abstract}
% The LaTeX package \pkg{nicematrix} provides new environments similar to the
% classical environments |{array}| and |{matrix}| but with some additional
% features. Among these features are the possibilities to fix the width of the
% columns and to draw continuous ellipsis dots between the cells of the array.
% \end{abstract}
%
% \vspace{1cm}
% \section{Presentation}
%
%
% This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by
% the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two or
% three compilations may be necessary. This package requires and \textbf{loads}
% the packages \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{amsmath},
% \pkg{pgfcore} and the module \pkg{shapes} of \textsc{pgf} (\pkg{tikz} is
% \emph{not} loaded). The final user only has to load the package with
% |\usepackage{nicematrix}|.
%
%
% \medskip
% \begin{savenotes}
% \begin{minipage}{0.6\linewidth}
% This package provides some new tools to draw mathematical matrices. The main
% features are the following:
% \begin{itemize}\setlength{\itemsep}{0pt}
% \item continuous dotted lines\footnote{If the class option |draft| is
% used, these dotted lines will not be drawn for a faster compilation.};
% \item exterior rows and columns for labels;
% \item a control of the width of the columns.
% \end{itemize}
% \end{minipage}
% \end{savenotes}
% \hspace{1.4cm}
% $\begin{bNiceArray}{CCCC}[first-row,first-col,
%                           code-for-first-col=\color{blue}\scriptstyle,
%                           code-for-first-row=\color{blue}\scriptstyle,
%                           columns-width = auto]
%        & C_1     & C_2     & \Cdots  & C_n  \\
% L_1    & a_{11}  & a_{12}  & \Cdots & a_{1n} \\
% L_2    & a_{21}  & a_{22}  & \Cdots & a_{2n} \\
% \Vdots & \Vdots & \Vdots & \Ddots & \Vdots\\
% L_n    & a_{n1}  & a_{n2}  & \Cdots & a_{nn} 
% \end{bNiceArray}$
% 
% \medskip 
% A command |\NiceMatrixOptions| is provided to fix the options (the
% scope of the options fixed by this command is the current TeX group).
%
% 
% \bigskip
% \textbf{An example for the continuous dotted lines}
%
% \medskip
% \begin{minipage}{10cm}
% For example, consider the following code which uses an environment |{pmatrix}|
% of \pkg{amsmath}.
%
% \smallskip
% \begin{BVerbatim}
% $A = \begin{pmatrix}
% 1      & \cdots & \cdots & 1      \\
% 0      & \ddots &        & \vdots \\
% \vdots & \ddots & \ddots & \vdots \\
% 0      & \cdots & 0      & 1
% \end{pmatrix}$
% \end{BVerbatim}
%
% \smallskip
% This code composes the matrix $A$ on the right.
% \end{minipage}\hspace{1cm}
% $A = \begin{pmatrix}
% 1      &\cdots &\cdots &1      \\
% 0      &\ddots &       &\vdots \\
% \vdots &\ddots &\ddots &\vdots \\
% 0      &\cdots &0      &1
% \end{pmatrix}$
%
% 
% \bigskip
% \begin{scope}
% \NiceMatrixOptions{transparent}
% \begin{minipage}{10cm}
% Now, if we use the package \pkg{nicematrix} with the option \\ 
% |transparent|, the same code will give the result on the right.
% \end{minipage}\hspace{1cm}
% $A = \begin{pmatrix}
% 1      & \cdots & \cdots & 1      \\
% 0      & \ddots &        & \vdots \\
% \vdots & \ddots & \ddots & \vdots \\
% 0      & \cdots & 0      & 1
% \end{pmatrix}$
% \end{scope}
%
%
% \section{The environments of this package} 
%
% The package \pkg{nicematrix} defines the following new environments.
% 
% \medskip
% \begin{ttfamily}
% \setlength{\tabcolsep}{3mm}
% \begin{tabular}{llll}
% \{NiceMatrix\}  & \{NiceArray\} & \{pNiceArray\}          \\
% \{pNiceMatrix\} &               & \{bNiceArray\}          \\
% \{bNiceMatrix\} &               & \{BNiceArray\}          \\
% \{BNiceMatrix\} &               & \{vNiceArray\}          \\
% \{vNiceMatrix\} &               & \{VNiceArray\}          \\
% \{VNiceMatrix\} &               & \{NiceArrayWithDelims\} \\
% \end{tabular}
% \end{ttfamily}
%
%
% \medskip
% By default, the environments |{NiceMatrix}|, |{pNiceMatrix}|, |{bNiceMatrix}|,
% |{BNiceMatrix}|, |{vNiceMatrix}| and |{VNiceMatrix}| behave almost exactly as
% the corresponding environments of \pkg{amsmath}: |{matrix}|, |{pmatrix}|,
% |{bmatrix}|, |{Bmatrix}|, |{vmatrix}| and |{Vmatrix}|.
% 
%
% \medskip
% The environment |{NiceArray}| is similar to the environment |{array}| of the
% package |{array}|. However, for technical reasons, in the preamble of the
% environment |{NiceArray}|, the user must use the letters |L|, |C| and~|R|
% instead of |l|, |c| and |r|. It's possible to use the constructions
% |w{...}{...}|, |W{...}{...}|\footnote{However, for the columns of type |w| and
% |W|, the cells are composed in math mode (in the environments of
% \pkg{nicematrix}) whereas in |{array}| of \pkg{array}, they are composed in
% text mode.}, "|", |>{...}|, |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but
% the letters |p|, |m| and |b| should not be used. See p.~\pageref{NiceArray}
% the section relating to |{NiceArray}|.
% 
% 
% \section{The continuous dotted lines}
%
% Inside the environments of the package \pkg{nicematrix}, new commands are
% defined: |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, and |\Iddots|. These commands
% are intended to be used in place of |\dots|, |\cdots|, |\vdots|, |\ddots| and
% |\iddots|.\footnote{The command |\iddots|, defined in \pkg{nicematrix}, is a
% variant of |\ddots| with dots going forward. If |mathdots| is loaded, the
% version of |mathdots| is used. It corresponds to the command |\adots| of
% \pkg{unicode-math}.} 
% \newcounter{fniddots} 
% \setcounter{fniddots}{\thefootnote}
%
% \smallskip
% Each of them must be used alone in the cell of the array and it draws a dotted
% line between the first non-empty cells\footnote{The precise definition of a
% ``non-empty cell'' is given below (cf. p.~\pageref{empty-cells}).} on both
% sides of the current cell. Of course, for |\Ldots| and |\Cdots|, it's an
% horizontal line; for |\Vdots|, it's a vertical line and for |\Ddots| and
% |\Iddots| diagonal ones. It's possible to change the color of these lines
% with the option |color|.\footnote{It's also possible to change the color of
% all theses dotted lines with the option |xdots/color| (\textsl{xdots} to
% remind that it works for |\Cdots|, |\Ldots|, |\Vdots|, etc.): cf. p. \pageref{customization}.}\par\nobreak 
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% a_1      & \Cdots &        & & a_1    \\
% \Vdots   & a_2    & \Cdots & & a_2    \\
%          & \Vdots & \Ddots[color=red] \\
% \\
% a_1      & a_2    &        & & a_n 
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% a_1      & \Cdots &        & & a_1    \\
% \Vdots   & a_2    & \Cdots & & a_2    \\
%          & \Vdots & \Ddots[color=red] \\
% \\
% a_1      & a_2    &        & & a_n 
% \end{bNiceMatrix}$
% 
% \interitem 
% In order to represent the null matrix, one can use the following
% codage:\par\nobreak
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% 0      & \Cdots & 0      \\
% \Vdots &        & \Vdots \\
% 0      & \Cdots & 0 
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 0      & \Cdots & 0      \\
% \Vdots &        & \Vdots \\
% 0      & \Cdots & 0 
% \end{bNiceMatrix}$
%
% \bigskip
% However, one may want a larger matrix. Usually, in such a case, the users of
% LaTeX add a new row and a new column. It's possible to use the same method
% with \pkg{nicematrix}:\par\nobreak 
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% 0      & \Cdots & \Cdots & 0      \\
% \Vdots &        &        & \Vdots \\
% \Vdots &        &        & \Vdots \\
% 0      & \Cdots & \Cdots & 0 
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 0      & \Cdots & \Cdots & 0      \\
% \Vdots &        &        & \Vdots \\
% \Vdots &        &        & \Vdots \\
% 0      & \Cdots & \Cdots & 0 
% \end{bNiceMatrix}$
% 
% \bigskip
% In the first column of this exemple, there are two instructions |\Vdots| but
% only one dotted line is drawn (there is no overlapping graphic objects in the
% resulting \textsc{pdf}\footnote{And it's not possible to draw a |\Ldots| and a
% |\Cdots| line between the same cells.}).
%
% \bigskip
% In fact, in this example, it would be possible to draw the same matrix more
% easily with the following code:\par\nobreak
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% 0       & \Cdots &        & 0      \\
% \Vdots  &        &        &        \\
%         &        &        & \Vdots \\
% 0       &        & \Cdots & 0 
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 0       & \Cdots &        & 0      \\
% \Vdots  &        &        &        \\
%         &        &        & \Vdots \\
% 0       &        & \Cdots & 0 
% \end{bNiceMatrix}$
%
% \bigskip 
% There are also other means to change the size of the matrix. Someone might
% want to use the optional argument of the command~|\\| for the vertical
% dimension and a command~|\hspace*| in a cell for the horizontal
% dimension.\footnote{In \pkg{nicematrix}, one should use |\hspace*| and not
% |\hspace| for such an usage because \pkg{nicematrix} loads \pkg{array}. One
% may also remark that it's possible to fix the width of a column by using the
% environment |{NiceArray}| (or one of its variants) with a column of type~|w|
% or~|W|: see p.~\pageref{width}} 
% 
% However, a command~|\hspace*| might interfer with the construction of the
% dotted lines. That's why the package \pkg{nicematrix} provides a
% command~|\Hspace| which is a variant of |\hspace| transparent for the dotted
% lines of \pkg{nicematrix}.\par\nobreak
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% 0      & \Cdots & ~emphase#\Hspace*{1cm}@ & 0      \\
% \Vdots &        &               & \Vdots \\~emphase#[1cm]@
% 0      & \Cdots &               & 0    
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 0      & \Cdots & \Hspace*{1cm} & 0      \\
% \Vdots &        &               & \Vdots \\[1cm]
% 0      & \Cdots &               & 0    
% \end{bNiceMatrix}$
% 
% \subsection{The option nullify-dots}
% 
%
% Consider the following matrix composed classicaly with the environment
% \verb|{pmatrix}| of \pkg{amsmath}.\par\nobreak 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $A = \begin{pmatrix}
% h & i & j & k & l & m \\
% x &   &   &   &   & x \\
% \end{pmatrix}$
% \end{BVerbatim}
% $A = \begin{pmatrix}
% h & i & j & k & l & m \\
% x   &     &     &    &     & x \\
% \end{pmatrix}$
%
%
% \bigskip
% If we add \verb|\ldots| instructions in the second row, the geometry of the
% matrix is modified.\par\nobreak
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $B = \begin{pmatrix}
% h & i & j & k & l & m \\
% x & \ldots & \ldots  & \ldots & \ldots & x \\
% \end{pmatrix}$
% \end{BVerbatim}
% $B = \begin{pmatrix}
% h & i & j & k & l & m \\
% x   & \ldots   & \ldots  & \ldots & \ldots & x \\
% \end{pmatrix}$
%
% \bigskip
% By default, with \pkg{nicematrix}, if we replace \verb|{pmatrix}| by
% \verb|{pNiceMatrix}| and \verb|\ldots| by \verb|\Ldots|, the geometry of the matrix is not
% changed.\par\nobreak 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $C = \begin{pNiceMatrix}
% h & i & j & k & l & m \\
% x & \Ldots & \Ldots & \Ldots & \Ldots & x \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $C = \begin{pNiceMatrix}
% h & i & j & k & l & m \\
% x & \Ldots & \Ldots  & \Ldots & \Ldots & x \\
% \end{pNiceMatrix}$
%
% \bigskip
% However, one may prefer the geometry of the first matrix $A$ and would like to
% have such a geometry with a dotted line in the second row. It's possible by
% using the option \verb|nullify-dots| (and only one instruction \verb|\Ldots| is
% necessary).\par\nobreak 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $D = \begin{pNiceMatrix}[~emphase#nullify-dots@]
% h & i & j & k & l & m \\
% x & \Ldots & & & & x \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $D = \begin{pNiceMatrix}[nullify-dots]
% h & i & j & k & l & m \\
% x & \Ldots & &  &  & x \\
% \end{pNiceMatrix}$
%
% \medskip
% The option |nullify-dots| smashes the instructions |\Ldots| (and the variants)
% horizontally but also vertically.
%
% \medskip
% \textbf{There must be no space before the opening bracket (|[|) of the options
% of the environment.}
%
%
% \subsection{The command \textbackslash Hdotsfor}
%
% Some people commonly use the command |\hdotsfor| of \pkg{amsmath} in order to
% draw horizontal dotted lines in a matrix. In the environments of
% \pkg{nicematrix}, one should use instead |\Hdotsfor| in order to draw dotted
% lines similar to the other dotted lines drawn by the package \pkg{nicematrix}.
%
% As with the other commands of \pkg{nicematrix} (like |\Cdots|, |\Ldots|,
% |\Vdots|, etc.), the dotted line drawn with |\Hdotsfor| extends until the
% contents of the cells on both sides.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=7cm]
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 & 5 \\
% 1 & ~emphase#\Hdotsfor{3}@ & 5 \\
% 1 & 2 & 3 & 4 & 5 \\
% 1 & 2 & 3 & 4 & 5 
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 & 5 \\
% 1 & \Hdotsfor{3} & 5 \\
% 1 & 2 & 3 & 4 & 5 \\
% 1 & 2 & 3 & 4 & 5 
% \end{pNiceMatrix}$
%
% \bigskip
% However, if these cells are empty, the dotted line extends only in the cells
% specified by the argument of |\Hdotsfor| (by design).
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=7cm]
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 & 5 \\
%   & ~emphase#\Hdotsfor{3}@ \\
% 1 & 2 & 3 & 4 & 5 \\
% 1 & 2 & 3 & 4 & 5 
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 & 5 \\
%   & \Hdotsfor{3} \\
% 1 & 2 & 3 & 4 & 5 \\
% 1 & 2 & 3 & 4 & 5 
% \end{pNiceMatrix}$
%
%
% Remark: Unlike the command |\hdotsfor| of \pkg{amsmath}, the command
% |\Hdotsfor| may be used when the package \pkg{colortbl} is loaded (but you
% might have problem if you use |\rowcolor| on the same row as |\Hdotsfor|).
% 
% \subsection{How to generate the continuous dotted lines transparently}
%
% The package \pkg{nicematrix} provides an option called |transparent| for using
% existing code transparently in the environments of the \pkg{amsmath} :
% |{matrix}|, |{pmatrix}|, |{bmatrix}|, etc. In fact, this
% option is an alias for the conjonction of two options: 
% |renew-dots| and |renew-matrix|.\footnote{The options |renew-dots|,
% |renew-matrix| and |transparent| can be fixed with the command
% |\NiceMatrixOptions| like the other options. However, they can also be fixed
% as options of the command |\usepackage| (it's an exception for these three
% specific options.)}
%
% \smallskip
%
% \begin{itemize}
% \item The option |renew-dots|\par\nobreak
%
% With this option, the commands |\ldots|, |\cdots|, |\vdots|, |\ddots|,
% |\iddots|\footnotemark[\thefniddots] and |\hdotsfor| are redefined within the
% environments provided by \pkg{nicematrix} and behave like |\Ldots|, |\Cdots|,
% |\Vdots|, |\Ddots|, |\Iddots| and |\Hdotsfor|; the command |\dots|
% (``automatic dots'' of |amsmath|) is also redefined to behave like |\Ldots|. 
%
% \item The option |renew-matrix|\par\nobreak 
%
% With this option, the environment |{matrix}| is redefined and behave like
% |{NiceMatrix}|, and so on for the five variants.
% \end{itemize}
%
% \bigskip 
% Therefore, with the option |transparent|, a classical code gives directly the
% ouput of \pkg{nicematrix}.\par\nobreak
%
% \bigskip
% \begin{scope}
% \NiceMatrixOptions{transparent}
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% ~emphase#\NiceMatrixOptions{transparent}@
% \begin{pmatrix}
% 1      & \cdots & \cdots & 1      \\
% 0      & \ddots &        & \vdots \\
% \vdots & \ddots & \ddots & \vdots \\
% 0      & \cdots & 0      & 1
% \end{pmatrix}
% \end{BVerbatim}
% $\begin{pmatrix}
% 1      & \cdots & \cdots & 1      \\
% 0      & \ddots &        & \vdots \\
% \vdots & \ddots & \ddots & \vdots \\
% 0      & \cdots & 0      & 1
% \end{pmatrix}$
% \end{scope}
% 
% \subsection{The labels of the dotted lines}
% 
% The commands |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, |\Iddots| and |\Hdotsfor|
% (and the command |\line| in the |code-after| which is described
% p.~\pageref{line-in-code-after}) accept two optional arguments specified
% by the tokens |_| and |^| for labels positionned below and above the line. The
% arguments are composed in math mode with |\scriptstyle|.
% 
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\begin{bNiceMatrix}
% 1 & \hspace*{1cm}            & 0 \\[8mm]
%   & ~emphase#\Ddots^{n \text{ times}}@ &   \\
% 0 &                          & 1 \\
% \end{bNiceMatrix}$
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 1 & \hspace*{1cm}            & 0 \\[8mm]
%   & \Ddots^{n \text{ times}} &   \\
% 0 &                          & 1 \\
% \end{bNiceMatrix}$
%
% \subsection{Customization of the dotted lines}
% 
% \label{customization} 
% The dotted lines drawn by |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, |\Iddots|
% and |\Hdotsfor| (and by the command |\line| in the |code-after| which is described
% p.~\pageref{line-in-code-after}) may be customized by three options (specified
% between square brackets after the command):
% \begin{itemize}
% \item |color|;
% \item |shorten|;
% \item |line-style|.
% \end{itemize}
%
% These options may also be fixed with |\NiceMatrixOptions| or at the level of a
% given environment but, in those cases, they must be prefixed by |xdots|, and,
% thus have for names:
% \begin{itemize}
% \item |xdots/color|;
% \item |xdots/shorten|;
% \item |xdots/line-style|.
% \end{itemize}
%
% For the clarity of the explanations, we will use those names.
%
% \bigskip
% \textbf{The option xdots/color}\par\nobreak
%
% \smallskip 
% The option |xdots/color| fixes the color or the dotted line. However, one should
% remark that the dotted lines drawn in the exterior rows and columns have a
% special treatment: cf. p.~\pageref{exterior}.
% 
% \bigskip
% \textbf{The option xdots/shorten}\par\nobreak
%
% \smallskip
% The option |xdots/shorten| fixes the margin of both extremities of the line.
% The name is derived from the options ``|shorten >|'' and ``|shorten <|'' of
% Tikz but one should notice that \pkg{nicematrix} only provides
% |xdots/shorten|. The initial value of this parameter is 0.3~em (it is
% recommanded to use a unit of length dependent of the current font).
% 
% \bigskip
% \textbf{The option xdots/line-style}\par\nobreak
% 
% \smallskip
% It should be pointed that, by default, the lines drawn by Tikz with the
% parameter |dotted| are composed of square dots (and not rounded
% ones).\footnote{The first reason of this behaviour is that the \textsc{pdf}
% format includes a description for dashed lines. The lines specified with this
% descriptor are displayed very efficiently by the \textsc{pdf} readers. It's
% easy, starting from these dashed lines,
% to create a line composed by square dots whereas a line of rounded dots needs
% a specification of each dot in the \textsc{pdf} file.}
% 
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% \tikz \draw [dotted] (0,0) -- (5,0) ;
% \end{BVerbatim}
% \tikz \draw [dotted] (0,0) -- (5,0) ;
%
% \medskip
% In order to provide lines with rounded dots in the style of those provided by
% |\ldots| (at least with the \emph{Computer Modern} fonts), the package
% \pkg{nicematrix} embeds its own system to draw a dotted line (and this system
% uses \textsc{pgf} and not Tikz). This style is called |standard| and that's
% the initial value of the parameter |xdots/line-style|.
%
% However (when Tikz is loaded) it's possible to use for |xdots/line-style| any style
% provided by Tikz, that is to say any sequence of options provided by Tikz for
% the Tizk pathes (with the exception of ``|color|'', ``|shorten >|'' and
% ``|shorten <|'').
%
% \medskip
% Here is for example a tridiagonal matrix with the style |loosely dotted|:\par\nobreak
%
% \medskip
% \begin{BVerbatim}[baseline=c]
% $\begin{pNiceMatrix}[nullify-dots,~emphase#xdots/line-style=loosely dotted@]
% a      & b      & 0      &        & \Cdots & 0      \\ 
% b      & a      & b      & \Ddots &        & \Vdots \\
% 0      & b      & a      & \Ddots &        &        \\
%        & \Ddots & \Ddots & \Ddots &        & 0      \\
% \Vdots &        &        &        &        & b      \\
% 0      & \Cdots &        & 0      & b      & a
% \end{pNiceMatrix}$
% \end{BVerbatim}
%
%
% \[\begin{pNiceMatrix}[nullify-dots,xdots/line-style=loosely dotted]
% a      & b      & 0      &        & \Cdots & 0      \\ 
% b      & a      & b      & \Ddots &        & \Vdots \\
% 0      & b      & a      & \Ddots &        &        \\
%        & \Ddots & \Ddots & \Ddots &        & 0      \\
% \Vdots &        &        &        &        & b      \\
% 0      & \Cdots &        & 0      & b      & a
% \end{pNiceMatrix}\]
%
%
% 
% \section{The PGF/Tikz nodes created by nicematrix}
% 
% \label{name}
%
% The package \pkg{nicematrix} creates a PGF/Tikz node for each (non-empty) cell
% of the considered array. These nodes are used to draw the dotted lines between
% the cells of the matrix. However, the user may wish to use directly these
% nodes. It's possible (if Tikz has been loaded\footnote{We remind that, since
% the version 3.13, \pkg{nicematrix} doesn't load Tikz by default by only
% \textsc{pgf} (Tikz is a layer over \textsc{pfg}).}). First, the user have to
% give a name to the array (with the key called |name|). Then, the nodes are
% accessible through the names ``\textsl{name}-$i$-$j$'' where \textsl{name} is
% the name given to the array and $i$ and $j$ the numbers of the row and the
% column of the considered cell.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{pNiceMatrix}[name=~emphase#mymatrix@]
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9 
% \end{pNiceMatrix}$
% \tikz[remember picture,overlay] 
%      \draw ~emphase#(mymatrix-2-2)@ circle (2mm) ; 
% \end{BVerbatim}
% $\begin{pNiceMatrix}[name=mymatrix]
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9 
% \end{pNiceMatrix}$
% \tikz[remember picture,overlay] 
%      \draw (mymatrix-2-2) circle (2mm) ; 
%
% \medskip
% Don't forget the options |remember picture| and |overlay|.
%
% \bigskip
% In the following example, we have underlined all the nodes of the matrix.
% \[\begin{pNiceMatrix}[
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         fill = red!15,
%                                         inner sep = 0 pt }]
%                \node [fit = (1-1)] {} ;
%                \node [fit = (1-3)] {} ;
%                \node [fit = (2-2)] {} ;
%                \node [fit = (3-1)] {} ;
%                \node [fit = (3-3)] {} ;
%                \node [fit = (1-2)] {} ;
%                \node [fit = (2-1)] {} ;
%                \node [fit = (2-3)] {} ;
%                \node [fit = (3-2)] {} ;
%                \end{tikzpicture}}]
% a & a + b & a + b + c \\
% a & a     & a + b  \\
% a & a     & a 
% \end{pNiceMatrix}\]
% 
%
% \bigskip
% In fact, the package \pkg{nicematrix} can create ``extra nodes'': the ``medium
% nodes'' and the ``large nodes''. The first ones 
% are created with the option |create-medium-nodes| and the second ones with the
% option |create-large-nodes|.\footnote{There is also an option
% |create-extra-nodes| which is an alias for the conjonction of
% |create-medium-nodes| and |create-large-nodes|.}
%
% \medskip
% The names of the ``medium nodes'' are constructed by adding the suffix
% ``|-medium|'' to the names of the ``normal nodes''. In the following example,
% we have underlined the ``medium nodes''. We consider that this example is
% self-explanatory.
% \[\begin{pNiceMatrix}[
%  create-medium-nodes,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {fill = red!15,
%                                         blend mode = multiply,
%                                         inner sep = 0pt},
%                    name suffix = -medium]
%                \node [fit = (1-1)] {} ;
%                \node [fit = (1-2)] {} ;
%                \node [fit = (1-3)] {} ;
%                \node [fit = (2-1)] {} ;
%                \node [fit = (2-2)] {} ;
%                \node [fit = (2-3)] {} ;
%                \node [fit = (3-1)] {} ;
%                \node [fit = (3-2)] {} ;
%                \node [fit = (3-3)] {} ;
%                \end{tikzpicture}}]
% a & a + b & a + b + c \\
% a & a     & a + b  \\
% a & a     & a 
% \end{pNiceMatrix}\]
%
%
% \medskip
% The names of the ``large nodes'' are constructed by adding the suffix
% ``|-large|'' to the names of the ``normal nodes''. In the following example,
% we have underlined the ``large nodes''. We consider that this example is
% self-explanatory.\footnote{There is no ``large nodes'' created in the exterior
% rows and columns (for these rows and columns, cf. p.~\pageref{exterior}).}
%
% \[\begin{pNiceMatrix}[
%  create-large-nodes,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         inner sep = 0pt},
%                    name suffix = -large]
%                \node [fit = (1-1),fill = red!15] {} ;
%                \node [fit = (1-3),fill = red!15] {} ;
%                \node [fit = (2-2),fill = red!15] {} ;
%                \node [fit = (3-1),fill = red!15] {} ;
%                \node [fit = (3-3),fill = red!15] {} ;
%                \node [fit = (1-2),fill = blue!15] {} ;
%                \node [fit = (2-1),fill = blue!15] {} ;
%                \node [fit = (2-3),fill = blue!15] {} ;
%                \node [fit = (3-2),fill = blue!15] {} ;
%                \end{tikzpicture}}]
% a & a + b & a + b + c \\
% a & a     & a + b  \\
% a & a     & a 
% \end{pNiceMatrix}\]
% 
%
% \medskip
% The ``large nodes'' of the first column and last column may appear too small
% for some usage. That's why it's possible to use the options |left-margin| and
% |right-margin| to add space on both sides of the array and also space in the
% ``large nodes'' of the first column and last column. In the following example,
% we have used the options |left-margin| and |right-margin|.\footnote{The
% options |left-margin| and |right-margin| take dimensions as values but, if no
% value is given, the default value is used, which is |\arraycolsep| (by
% default: 5~pt). There is also an option |margin| to fix both |left-margin| and
% |right-margin| to the same value.}
% \[\begin{pNiceMatrix}[
%  create-large-nodes,left-margin,right-margin,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         inner sep = 0pt},
%                    name suffix = -large]
%                \node [fit = (1-1),fill = red!15] {} ;
%                \node [fit = (1-3),fill = red!15] {} ;
%                \node [fit = (2-2),fill = red!15] {} ;
%                \node [fit = (3-1),fill = red!15] {} ;
%                \node [fit = (3-3),fill = red!15] {} ;
%                \node [fit = (1-2),fill = blue!15] {} ;
%                \node [fit = (2-1),fill = blue!15] {} ;
%                \node [fit = (2-3),fill = blue!15] {} ;
%                \node [fit = (3-2),fill = blue!15] {} ;
%                \end{tikzpicture}}]
% a & a + b & a + b + c \\
% a & a     & a + b  \\
% a & a     & a 
% \end{pNiceMatrix}\]
% 
% \medskip
% It's also possible to add more space on both side of the array with the
% options |extra-left-margin| and |extra-right-margin|. These margins are not
% incorporated in the ``large nodes''. It's possible to fix both values with the
% option |extra-margin| and, in the following example, we use |extra-margin|
% with the value $3$~pt.
% \[\begin{pNiceMatrix}[
%  create-large-nodes,margin,extra-margin=3pt,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         inner sep = 0 pt},
%                    name suffix = -large]
%                \node [fit = (1-1),fill = red!15] {} ;
%                \node [fit = (1-3),fill = red!15] {} ;
%                \node [fit = (2-2),fill = red!15] {} ;
%                \node [fit = (3-1),fill = red!15] {} ;
%                \node [fit = (3-3),fill = red!15] {} ;
%                \node [fit = (1-2),fill = blue!15] {} ;
%                \node [fit = (2-1),fill = blue!15] {} ;
%                \node [fit = (2-3),fill = blue!15] {} ;
%                \node [fit = (3-2),fill = blue!15] {} ;
%                \end{tikzpicture}}]
% a & a + b & a + b + c \\
% a & a     & a + b  \\
% a & a     & a 
% \end{pNiceMatrix}\]
%
% \medskip
% In this case, if we want a control over the height of the rows, we can add a
% |\strut| in each row of the array.
% \[\begin{pNiceMatrix}[
%  create-large-nodes,left-margin,right-margin,extra-right-margin=3pt,
%  extra-left-margin=3pt,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         inner sep = 0 pt},
%                    name suffix = -large]
%                \node [fit = (1-1),fill = red!15] {} ;
%                \node [fit = (1-3),fill = red!15] {} ;
%                \node [fit = (2-2),fill = red!15] {} ;
%                \node [fit = (3-1),fill = red!15] {} ;
%                \node [fit = (3-3),fill = red!15] {} ;
%                \node [fit = (1-2),fill = blue!15] {} ;
%                \node [fit = (2-1),fill = blue!15] {} ;
%                \node [fit = (2-3),fill = blue!15] {} ;
%                \node [fit = (3-2),fill = blue!15] {} ;
%                \end{tikzpicture}}]
% \strut a & a + b & a + b + c \\
% \strut a & a     & a + b  \\
% \strut a & a     & a 
% \end{pNiceMatrix}\]
%
% \bigskip
% We explain below how to fill the nodes created by \pkg{nicematrix} (cf. p.
% \pageref{highlight}). 
%
% \section{The code-after}
%
% \label{code-after}
% The option |code-after| may be used to give some code that will be excuted
% after the construction of the matrix (and thus after the construction of
% all the nodes).
%
% \smallskip
% \textbf{If Tikz is loaded}\footnote{We remind that, since the version 3.13,
% \pkg{nicematrix} doesn't load Tikz by default but only \textsc{pgf} (Tikz is a
% layer over \textsc{pfg}).}, one may access to that nodes with classical Tikz
% instructions. The nodes should be designed as $i$-$j$ (without the prefix
% corresponding to the name of the environment).
%
% Moreover, a special command, called |\line|, is available to draw directly
% dotted lines between nodes. It may be used, for example, to draw a dotted line
% between two adjacents cells. \label{line-in-code-after}
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% \NiceMatrixOptions{xdots/shorten = 0.6 em}
% \begin{pNiceMatrix}[~emphase#code-after=\line{2-2}{3-3}@]
% I       & 0      & \Cdots  &0     \\
% 0       & I      & \Ddots  &\Vdots\\
% \Vdots  &\Ddots  & I       &0     \\
% 0       &\Cdots  & 0       &I
% \end{pNiceMatrix}
% \end{BVerbatim}
% \begin{scope}
% \NiceMatrixOptions{xdots/shorten = 0.6 em}
% $\begin{pNiceMatrix}[code-after=\line{2-2}{3-3}]
% I       & 0      & \Cdots  &0     \\
% 0       & I      & \Ddots  &\Vdots\\
% \Vdots  &\Ddots  & I       &0     \\
% 0       &\Cdots  & 0       &I
% \end{pNiceMatrix}$
% \end{scope}
%
% \medskip
% For the readability of the code, an alternative syntax is provided: it's
% possible to give the instructions of the |\code-after| at the end of the
% environment, after the keyword |\CodeAfter|.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% \NiceMatrixOptions{xdots/shorten = 0.6 em}
% \begin{pNiceMatrix}
% I       & 0      & \Cdots  &0     \\
% 0       & I      & \Ddots  &\Vdots\\
% \Vdots  &\Ddots  & I       &0     \\
% 0       &\Cdots  & 0       &I
% ~emphase#\CodeAfter@
% ~emphase#\line{2-2}{3-3}@
% \end{pNiceMatrix}
% \end{BVerbatim}
% \begin{scope}
% \NiceMatrixOptions{xdots/shorten = 0.6 em}
% $\begin{pNiceMatrix}
% I       & 0      & \Cdots  &0     \\
% 0       & I      & \Ddots  &\Vdots\\
% \Vdots  &\Ddots  & I       &0     \\
% 0       &\Cdots  & 0       &I
% \CodeAfter
% \line{2-2}{3-3}
% \end{pNiceMatrix}$
% \end{scope}
% 
% \section{The environment \{NiceArray\} and its variants}
% \label{NiceArray}
%
% The environment |{NiceArray}| is similar to the environment |{array}|. As for
% |{array}|, the mandatory argument is the preamble of the array. However, for
% technical reasons, in this preamble, the user must use the letters |L|, |C|
% and~|R|\footnote{The column types |L|, |C| and |R| are defined locally inside
% |{NiceArray}| with |\newcolumntype| of \pkg{array}. This definition overrides
% an eventual previous definition. In fact, the column types |w| and |W| are
% also redefined.} instead of |l|, |c| and |r|. It's possible
% to use the constructions |w{...}{...}|, |W{...}{...}|, "|", |>{...}|,
% |<{...}|, |@{...}|, |!{...}| and |*{n}{...}| but the letters |p|, |m| and |b|
% should not be used.\footnote{In a command |\multicolumn|, one should also use
% the letters |L|, |C|, |R|.} 
%
% \bigskip
% The package \pkg{nicematrix} provides also the variants |{pNiceArray}|, 
%|{vNiceArray}|, |{VNiceArray}|, |{bNiceArray}| and |{BNiceArray}|.
% 
% \bigskip
% Of course, one of the benefits of |{pNiceArray}| over |{pNiceMatrix}| is the
% possibility of drawing vertical rules:
%
%\bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\left[\begin{NiceArray}{CCCC|C}
% a_1    & ?      & \Cdots & ?       & ?     \\
% 0      &        & \Ddots & \Vdots  & \Vdots\\
% \Vdots & \Ddots & \Ddots & ? \\ 
% 0      & \Cdots & 0      & a_n     & ?     
% \end{NiceArray}\right]$
% \end{BVerbatim} 
% $\left[\begin{NiceArray}{CCCC|C}
% a_1    & ?      & \Cdots & ?       & ?     \\
% 0      &        & \Ddots & \Vdots  & \Vdots\\
% \Vdots & \Ddots & \Ddots & ? \\ 
% 0      & \Cdots & 0      & a_n     & ?     
% \end{NiceArray}\right]$
%
% \bigskip
% Another benefit is the possibility of using different alignments of columns. 
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\begin{pNiceArray}{LCR}
% a_{11}    & \Cdots & a_{1n} \\
% a_{21}    &        & a_{2n} \\
% \Vdots    &        & \Vdots \\
% a_{n-1,1} & \Cdots & a_{n-1,n} 
% \end{pNiceArray}$
% \end{BVerbatim}
% $\begin{pNiceArray}{LCR}
% a_{11}    & \Cdots & a_{1n} \\
% a_{21}    &        & a_{2n} \\
% \Vdots    &        & \Vdots \\
% a_{n-1,1} & \Cdots & a_{n-1,n} 
% \end{pNiceArray}$
%
%
% \bigskip
% In fact, the environment |{pNiceArray}| and its variants are based upon a
% more general environment, called |{NiceArrayWithDelims}|. The first two
% mandatory arguments of this environment are the left and right delimiters used
% in the construction of the matrix. It's possible to use
% |{NiceArrayWithDelims}| if we want to use atypical or asymetrical delimiters.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{~emphase#NiceArrayWithDelims@}
%    {\downarrow}{\uparrow}{CCC}[margin]
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9 \\
% \end{~emphase#NiceArrayWithDelims@}$
% \end{BVerbatim}
% $\begin{NiceArrayWithDelims}
%    {\downarrow}{\uparrow}{CCC}[margin]
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9 \\
% \end{NiceArrayWithDelims}$
%
%
% \bigskip
% \section{The vertical position of the arrays}
%
% The package \pkg{nicematrix} provides a option |baseline| for the vertical
% position of the arrays. This option takes as value an integer which is the
% number of the row on which the array will be aligned.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% $A = \begin{pNiceMatrix}[baseline=2]
% \frac{1}{\sqrt{1+p^2}} & p & 1-p \\
% 1 & 1 & 1 \\
% 1 & p & 1+p
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $A = \begin{pNiceMatrix}[baseline=2]
% \frac{1}{\sqrt{1+p^2}} & p & 1-p \\
% 1 & 1 & 1 \\
% 1 & p & 1+p
% \end{pNiceMatrix}$
% 
% 
% \medskip
% It's also possible to use the option |baseline| with one of the special values
% |t|, |c| or |b|. These letters may also be used absolutely like the option of
% the environment |{array}| of \pkg{array}. The initial value of |baseline| is~|c|.
%
%
% \medskip
% In the following example, we use the option |t| (equivalent to |baseline=t|)
% immediately after an |\item| of list. One should remark that the presence of
% a |\hline| at the beginning of the array doesn't prevent the alignment of the
% baseline with the baseline of the first row (with |{array}| of \pkg{array},
% one must use |\firsthline|\footnote{It's also possible to use |\firsthline|
% with |{NiceArray}|.}).
%
% \smallskip
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% \begin{enumerate}
% \item an item
% \smallskip
% \item \renewcommand{\arraystretch}{1.2}
% $\begin{NiceArray}~emphase#[t]@{LCCCCCC}
% \hline
% n   & 0 & 1 & 2 & 3 & 4  & 5 \\
% u_n & 1 & 2 & 4 & 8 & 16 & 32 
% \hline
% \end{NiceArray}$
% \end{enumerate}
% \end{BVerbatim}
% \begin{minipage}{5cm}
% \begin{enumerate}
% \item an item
% \smallskip
% \item \renewcommand{\arraystretch}{1.2}
% $\begin{NiceArray}[t]{LCCCCCC}
% \hline
% n   & 0 & 1 & 2 & 3 & 4  & 5  \\
% u_n & 1 & 2 & 4 & 8 & 16 & 32 \\
% \hline
% \end{NiceArray}$
% \end{enumerate}
% \end{minipage}
% 
% \medskip
% However, it's also possible to use the tools of \pkg{booktabs}: |\toprule|,
% |\bottomrule| and |\midrule|.\par\nobreak
%
% \smallskip
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
% \begin{enumerate}
% \item an item
% \smallskip
% \item 
% $\begin{NiceArray}[t]{LCCCCCC}
% ~emphase#\toprule@
% n   & 0 & 1 & 2 & 3 & 4  & 5 \\
% ~emphase#\midrule@
% u_n & 1 & 2 & 4 & 8 & 16 & 32 
% ~emphase#\bottomrule@
% \end{NiceArray}$
% \end{enumerate}
% \end{BVerbatim}
% \begin{minipage}{5cm}
% \begin{enumerate}
% \item an item
% \smallskip
% \item 
% $\begin{NiceArray}[t]{LCCCCCC}
% \toprule
% n   & 0 & 1 & 2 & 3 & 4  & 5  \\
% \midrule
% u_n & 1 & 2 & 4 & 8 & 16 & 32 \\
% \bottomrule
% \end{NiceArray}$
% \end{enumerate}
% \end{minipage}
% 
% 
% \bigskip
% \section{The exterior rows and columns}
% The options |first-row|, |last-row|, |first-col| and |last-col| allow the
% composition of exterior rows and columns in the environments of
% \pkg{nicematrix}. 
% \label{exterior}
%
% A potential ``first row'' (exterior) has the number $0$ (and not $1$). Idem
% for the potential ``first column''. 
% 
% \begin{Verbatim}
% $\begin{pNiceMatrix}[~emphase#first-row,last-row,first-col,last-col@]
% $\begin{pNiceMatrix}[~emphase#first-row,last-row,first-col,last-col@,nullify-dots]
%        & C_1    & \Cdots &        & C_4    &        \\
% L_1    & a_{11} & a_{12} & a_{13} & a_{14} & L_1    \\
% \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\
%        & a_{31} & a_{32} & a_{33} & a_{34} &        \\
% L_4    & a_{41} & a_{42} & a_{43} & a_{44} & L_4    \\
%        & C_1    & \Cdots &        & C_4    &     
% \end{pNiceMatrix}$
% \end{pNiceMatrix}$
% \end{Verbatim}
%
% \[\begin{pNiceMatrix}[first-row,last-row,first-col,last-col,nullify-dots]
%        & C_1    & \Cdots &        & C_4    &        \\
% L_1    & a_{11} & a_{12} & a_{13} & a_{14} & L_1    \\
% \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\
%        & a_{31} & a_{32} & a_{33} & a_{34} &        \\
% L_4    & a_{41} & a_{42} & a_{43} & a_{44} & L_4    \\
%        & C_1    & \Cdots &        & C_4    &     
% \end{pNiceMatrix}\]
%
%
% \bigskip
% We have several remarks to do.
% \begin{itemize}
% \item For the environments with an explicit preamble (i.e. |{NiceArray}| and
% its variants), no letter must be given in that preamble for the potential
% first column and the potential last column: they will automatically (and
% necessarily) be of type |R| for the first column and |L| for the last one.
% \item One may wonder how \pkg{nicematrix} determines the number of rows and
% columns which are needed for the composition of the ``last row'' and ``last
% column''.
% \begin{itemize}
% \item For the environments with explicit preamble, like |{NiceArray}| and
% |{pNiceArray}|, the number of columns can obviously be computed from the
% preamble.
%
% \item When the option |light-syntax| (cf. p. \pageref{light-syntax}) is used,
% \pkg{nicematrix} has, in any case, to load the whole body of the environment
% (and that's why it's not possible to put verbatim material in the array with
% the option |light-syntax|). The analysis of this whole body gives the number
% of rows (but not the number of columns).
%
% \item In the other cases, \pkg{nicematrix} compute the number of rows and
% columns during the first compilation and write the result in the |aux| file
% for the next run.
% 
% \textsl{However, it's possible to provide the number of the last row and the number of
% the last column as values of the options |last-row| and |last-col|, tending to
% an acceleration of the whole compilation of the document.} That's what we will
% do throughout the rest of the document.
% \end{itemize}
% \end{itemize}
% 
% \bigskip
% It's possible to control the appearance of these rows and columns with options
% |code-for-first-row|, |code-for-last-row|, |code-for-first-col| and
% |code-for-last-col|. These options
% specify tokens that will be inserted before each cell of the corresponding row
% or column. 
% 
%
% \begin{Verbatim}
% \NiceMatrixOptions{~emphase#code-for-first-row@ = \color{red},
%                    ~emphase#code-for-first-col@ = \color{blue},
%                    ~emphase#code-for-last-row@ = \color{green},
%                    ~emphase#code-for-last-col@ = \color{magenta}}
% $\begin{pNiceArray}{CC|CC}[first-row,last-row=5,first-col,last-col,nullify-dots]
%        & C_1    & \Cdots &        & C_4    &        \\
% L_1    & a_{11} & a_{12} & a_{13} & a_{14} & L_1    \\
% \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\
% \hline
%        & a_{31} & a_{32} & a_{33} & a_{34} &        \\
% L_4    & a_{41} & a_{42} & a_{43} & a_{44} & L_4    \\
%        & C_1    & \Cdots &        & C_4    &     
% \end{pNiceArray}$
% \end{Verbatim}
%
% \begin{scope}
% \NiceMatrixOptions{code-for-first-row = \color{red},
%                    code-for-first-col = \color{blue},
%                    code-for-last-row = \color{green},
%                    code-for-last-col = \color{magenta}}
% \begin{displaymath}
% \begin{pNiceArray}{CC|CC}[first-row,last-row=5,first-col,last-col,nullify-dots]
%        & C_1    & \multicolumn1C{\Cdots} &        & C_4    &        \\
% L_1    & a_{11} & a_{12} & a_{13} & a_{14} & L_1    \\
% \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\
% \hline
%        & a_{31} & a_{32} & a_{33} & a_{34} &        \\
% L_4    & a_{41} & a_{42} & a_{43} & a_{44} & L_4    \\
%        & C_1    & \multicolumn1C{\Cdots} &        & C_4    &     
% \end{pNiceArray}
% \end{displaymath}
% \end{scope}
%
%
% \emph{Remarks}
% \begin{itemize}[beginpenalty=10000]
% \item As shown in the previous example, an horizontal rule (drawn by |\hline|)
% doesn't extend in the exterior columns and a vertical rule (specified by a
% ``\verb+|+'' in the preamble of the array) doesn't extend in the exterior
% rows.\footnote{The latter is not true when the package \pkg{arydshln} is
% loaded besides \pkg{nicematrix}. In fact, \pkg{nicematrix} and \pkg{arydhsln}
% are not totally compatible because \pkg{arydshln} redefines many internals of
% \pkg{array}. On another hand, if one really wants a vertical rule running in
% the first and in the last row, he should use |!{\vline}| instead of \verb+|+
% in the preamble of the array.} 
% 
% If one wishes to define new specifiers for columns in order to draw vertical
% rules (for example thicker than the standard rules), he should consider the
% command |\OnlyMainNiceMatrix| described on page~\pageref{OnlyMainNiceMatrix}.
%
% \item A specification of color present in |code-for-first-row| also applies to
% a dotted line draw in this exterior ``first row'' (excepted if a value has
% been given to |xdots/color|). Idem for the other exterior rows and columns.
%
% \item Logically, the potential option |columns-width| (described
% p.~\pageref{width}) doesn't apply to the ``first column'' and ``last column''.
% \item For technical reasons, it's not possible to use the option of the
% command |\\| after the ``first row'' or before the ``last row'' (the placement
% of the delimiters would be wrong). 
% \end{itemize}
% 
% 
% 
%
%
% \section{The dotted lines to separate rows or columns}
%
%
% In the environments of the package \pkg{nicematrix}, it's possible to use
% the command |\hdottedline| (provided by \pkg{nicematrix}) which is a
% counterpart of the classical commands |\hline| and |\hdashline| (the latter is
% a command of \pkg{arydshln}).
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
% \begin{pNiceMatrix}
% 1 & 2 & 3 & 4 & 5 \\
% ~emphase#\hdottedline@
% 6 & 7 & 8 & 9 & 10 \\
% 11 & 12 & 13 & 14 & 15 
% \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 & 5 \\
% \hdottedline
% 6 & 7 & 8 & 9 & 10 \\
% 11 & 12 & 13 & 14 & 15 
% \end{pNiceMatrix}$
%
%
% \bigskip
% In the environments with an explicit preamble (like |{NiceArray}|, etc.), it's
% possible to draw a vertical dotted line with the specifier ``|:|''.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
% \left(\begin{NiceArray}{CCCC~emphase#:@C}
% 1 & 2 & 3 & 4 & 5 \\
% 6 & 7 & 8 & 9 & 10 \\
% 11 & 12 & 13 & 14 & 15 
% \end{NiceArray}\right)
% \end{BVerbatim}
% $\left(\begin{NiceArray}{CCCC:C}
% 1 & 2 & 3 & 4 & 5 \\
% 6 & 7 & 8 & 9 & 10 \\
% 11 & 12 & 13 & 14 & 15 
% \end{NiceArray}\right)$
%
%
% \bigskip 
% These dotted lines do \emph{not} extend in the potential exterior rows and
% columns.
%
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
% $\begin{pNiceArray}{CCC:C}[
%     first-row,last-col, 
%     code-for-first-row = \color{blue}\scriptstyle,
%     code-for-last-col = \color{blue}\scriptstyle ]
% C_1 & C_2 & C_3 & C_4 \\
% 1 & 2 & 3 & 4 & L_1 \\
% 5 & 6 & 7 & 8 & L_2 \\
% 9 & 10 & 11 & 12 & L_3 \\
% \hdottedline
% 13 & 14 & 15 & 16 & L_4 
% \end{pNiceArray}$
% \end{BVerbatim}
% $\begin{pNiceArray}{CCC:C}[
%     first-row,last-col, 
%     code-for-first-row = \color{blue}\scriptstyle,
%     code-for-last-col = \color{blue}\scriptstyle ]
% C_1 & C_2 & C_3 & C_4 \\
% 1 & 2 & 3 & 4 & L_1 \\
% 5 & 6 & 7 & 8 & L_2 \\
% 9 & 10 & 11 & 12 & L_3 \\
% \hdottedline
% 13 & 14 & 15 & 16 & L_4 
% \end{pNiceArray}$
% 
% \bigskip
% It's possible to change in \pkg{nicematrix} the letter used to specify a
% vertical dotted line with the option |letter-for-dotted-lines| available in
% |\NiceMatrixOptions|. For example, in this document, we have loaded the
% package \pkg{arydshln} which uses the letter ``|:|'' to specify a vertical
% dashed line. Thus, by using |letter-for-dotted-lines|, we can use the
% vertical lines of both \pkg{arydshln} and \pkg{nicematrix}.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
% \NiceMatrixOptions{letter-for-dotted-lines = I}
% \arrayrulecolor{blue}
% \left(\begin{NiceArray}{~emphase#C|C:CIC@}
% 1 & 2 & 3 & 4 \\
% 5 & 6 & 7 & 8 \\
% 9 & 10 & 11 & 12
% \end{NiceArray}\right)
% \arrayrulecolor{black}
% \end{BVerbatim}
% \begin{scope}
% \NiceMatrixOptions{letter-for-dotted-lines = I}
% \arrayrulecolor{blue}
% $\left(\begin{NiceArray}{C|C:CIC}
% 1 & 2 & 3 & 4 \\
% 5 & 6 & 7 & 8 \\
% 9 & 10 & 11 & 12
% \end{NiceArray}\right)$
% \arrayrulecolor{black}
% \end{scope}
% 
% \smallskip
% We have used the command |\arrayrulecolor| (de \pkg{colortbl}) to draw in blue
% the three rules.
%
% \bigskip
% \emph{Remark} : In the package \pkg{array} (on which the package
% \pkg{nicematrix} relies), horizontal and vertical rules make the array larger
% or wider by a quantity equal to the width of the rule\footnote{In fact, this
% is true only for |\hline| and ``"|"'' but not for |\cline|.}. In
% \pkg{nicematrix}, the dotted lines drawn by |\hdottedline| and ``|:|'' do
% likewise. 
%
% 
% 
% \section{The width of the columns}
% \label{width}
%
% In the environments with an explicit preamble (like |{NiceArray}|,
% |{pNiceArray}|, etc.), it's possible to fix the  width of a given column with
% the standard letters |w| and |W| of the package \pkg{array}. In the
% environments of \pkg{nicematrix}, the cells of such columns are composed in
% mathematical mode, whereas, in |{array}| of \pkg{array}, they are composed in
% text mode.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\left(\begin{NiceArray}{~emphase#wc{1cm}@CC}
% 1  & 12 & -123 \\
% 12 & 0  & 0    \\
% 4  & 1  & 2 
% \end{NiceArray}\right)$
% \end{BVerbatim}
% $\left(\begin{NiceArray}{wc{1cm}CC}
% 1  & 12 & -123 \\
% 12 & 0  & 0    \\
% 4  & 1  & 2 
% \end{NiceArray}\right)$
%
%
% \bigskip
% In the environments of \pkg{nicematrix}, it's also possible to fix the \emph{minimal}
% width of all the columns of a matrix directly with the option |columns-width|.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\begin{pNiceMatrix}[~emphase#columns-width = 1cm@]
% 1  & 12 & -123 \\
% 12 & 0  & 0    \\
% 4  & 1  & 2 
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}[columns-width = 1cm]
% 1  & 12 & -123 \\
% 12 & 0  & 0    \\
% 4  & 1  & 2 
% \end{pNiceMatrix}$
%
% \medskip
% Note that the space inserted between two columns (equal to 2 |\arraycolsep|)
% is not suppressed (of course, it's possible to suppress this space by setting
% |\arraycolsep| equal to $0$~pt).
%
% \bigskip
% It's possible to give the special value |auto| to the option |columns-width|:
% all the columns of the array will have a width equal to the widest cell of 
% the array.\footnote{The result is achieved with only one compilation (but Tikz
% will have written informations in the |.aux| file and a message requiring a
% second compilation will appear).}\par\nobreak 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\begin{pNiceMatrix}[~emphase#columns-width = auto@]
% 1  & 12 & -123 \\
% 12 & 0  & 0    \\
% 4  & 1  & 2 
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}[columns-width = auto]
% 1  & 12 & -123 \\
% 12 & 0  & 0    \\
% 4  & 1  & 2 
% \end{pNiceMatrix}$
% 
% \bigskip
% Without surprise, it's possible to fix the minimal width of the columns of all
% the matrices of a current scope with the command
% |\NiceMatrixOptions|.\par\nobreak
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
% ~emphase#\NiceMatrixOptions{columns-width=10mm}@
% $\begin{pNiceMatrix}
% a & b \\ c & d \\
% \end{pNiceMatrix}
% = 
% \begin{pNiceMatrix}
% 1   & 1245 \\ 345 & 2 \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \begin{scope}
% \NiceMatrixOptions{columns-width=10mm}
% $\begin{pNiceMatrix}
% a & b \\
% c & d \\
% \end{pNiceMatrix}
% = 
% \begin{pNiceMatrix}
% 1   & 1245 \\
% 345 & 2 \\
% \end{pNiceMatrix}$
% \end{scope}
% 
% 
% \bigskip
% But it's also possible to fix a zone where all the matrices will have their
% columns of the same width, equal to the widest cell of all the matrices. This
% construction uses the environment |{NiceMatrixBlock}| with the option
% |auto-columns-width|\footnote{At this time, this is the only usage of the
% environment |{NiceMatrixBlock}| but it may have other usages in the future.}.
% The environment |{NiceMatrixBlock}| has no direct link with the command
% |\Block| presented just below (cf.~p.~\pageref{Block}).
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
% ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
% $\begin{pNiceMatrix}
% a & b \\ c & d \\
% \end{pNiceMatrix}
% = 
% \begin{pNiceMatrix}
% 1   & 1245 \\ 345 & 2 \\
% \end{pNiceMatrix}$
% ~emphase#\end{NiceMatrixBlock}@
% \end{BVerbatim}
% \begin{NiceMatrixBlock}[auto-columns-width]
% $\begin{pNiceMatrix}
% a & b \\ c & d \\
% \end{pNiceMatrix}
% = 
% \begin{pNiceMatrix}
% 1   & 1245 \\  345 & 2 \\
% \end{pNiceMatrix}$
% \end{NiceMatrixBlock}
%
% \medskip
% \textbf{Several compilations may be necessary to achieve the job.}
%
%
% \section{Block matrices}
% \label{Block}
%
% This section has no direct link with the previous one where an environment
% |{NiceMatrixBlock}| was introduced.
% 
% In the environments of \pkg{nicematrix}, it's possible to use the command
% |\Block| in order to place an element in the center of a rectangle of merged
% cells of the array.
%
% The command |\Block| must be used in the upper leftmost cell of the array with
% two arguments. The first argument is the size of the block with the syntax
% $i$\verb|-|$j$ where $i$ is the number of rows of the block and $j$ its number
% of columns. The second argument is the content of the block (composed in math
% mode). A Tikz node corresponding to the merged cells is created with the name
% ``$i$-$j$-block''. If the user has required the creation of the ``medium
% nodes'', a node of this type is also created with a name suffixed by
% |-medium|.
%
% \medskip
% In the following examples, we use the command |\arrayrulecolor| of
% \pkg{colortbl}. 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
% \arrayrulecolor{blue}
% $\begin{bNiceArray}{CCC|C}[margin]
% ~emphase#\Block{3-3}{A}@ & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
% \hline
% 0 & \Cdots& 0 & 0
% \end{bNiceArray}$
% \arrayrulecolor{black}
% \end{BVerbatim}
% \begin{scope}
% \arrayrulecolor{blue}
% $\begin{bNiceArray}{CCC|C}[margin]
% \Block{3-3}{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
% \hline
% 0 & \Cdots& 0 & 0
% \end{bNiceArray}$
% \arrayrulecolor{black}
% \end{scope}
%
% \bigskip
% One may wish to raise the size of the ``$A$'' placed in the block of the
% previous  example. Since this element is composed in math mode, it's not
% possible to use directly a command like |\large|, |\Large| and |\LARGE|.
% That's why the command |\Block| provides an option between angle brackets to
% specify some TeX code which will be inserted before the beginning of the
% math mode. 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
% \arrayrulecolor{blue}
% $\begin{bNiceArray}{CCC|C}[margin]
% \Block{3-3}~emphase#<\Large>@{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
% \hline
% 0 & \Cdots& 0 & 0
% \end{bNiceArray}$
% \arrayrulecolor{black}
% \end{BVerbatim}
% \begin{scope}
% \arrayrulecolor{blue}
% $\begin{bNiceArray}{CCC|C}[margin]
% \Block{3-3}<\Large>{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
% \hline
% 0 & \Cdots& 0 & 0
% \end{bNiceArray}$
% \arrayrulecolor{black}
% \end{scope}
%
% \medskip
% For technical reasons, you can't write |\Block{|$i$|-|$j$|}{<}|. But you can
% write |\Block{|$i$|-|$j$|}<>{<}| with the expected result.
% 
% 
% \section{Advanced features}
%
%
% \subsection{Alignement option in NiceMatrix}
%
% The environments without preamble (|{NiceMatrix}|, |{pNiceMatrix}|,
% |{bNiceMatrix}|, etc.) provide two options |l| and |r| (equivalent at |L| and
% |R|) which generate all the columns aligned leftwards (or
% rightwards).\footnote{This is a part of the functionality provided by the
% environments |{pmatrix*}|, |{bmatrix*}|, etc. of \pkg{mathtools}.}
% 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\begin{bNiceMatrix}[R]
% \cos x & - \sin x \\
% \sin x & \cos x 
% \end{bNiceMatrix}$
% \end{BVerbatim}
% $\begin{bNiceMatrix}[R]
% \cos x & - \sin x \\
% \sin x & \cos x 
% \end{bNiceMatrix}$
%
%
% \subsection{The command \textbackslash rotate}
%
% The package \pkg{nicematrix} provides a command |\rotate|. When used in the
% beginning of a cell, this command composes the contents of the cell after a
% rotation of 90° in the direct sens.
%
% In the following command, we use that command in the |code-for-first-row|.
%
%\bigskip
%
%\begin{BVerbatim}[baseline=c,boxwidth=12cm]
% \NiceMatrixOptions%
%  {code-for-first-row = \scriptstyle ~emphase#\rotate@ \text{image of },
%   code-for-last-col = \scriptstyle }
% $A = \begin{pNiceMatrix}[first-row,last-col=4]
% e_1 & e_2 & e_3       \\
% 1   & 2   & 3   & e_1 \\
% 4   & 5   & 6   & e_2 \\
% 7   & 8   & 9   & e_3 \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \begin{varwidth}{10cm}
% \NiceMatrixOptions%
%  {code-for-first-row = \scriptstyle\rotate \text{image of },
%   code-for-last-col = \scriptstyle }
% $ A = \begin{pNiceMatrix}[first-row,last-col=4]
% e_1 & e_2 & e_3 \\
% 1   & 2   & 3  & e_1 \\
% 4   & 5   & 6  & e_2 \\
% 7   & 8   & 9  & e_3 \\
% \end{pNiceMatrix}$
% \end{varwidth}
%
% \bigskip
% If the command |\rotate| is used in the ``last row'' (exterior to the matrix),
% the corresponding elements are aligned upwards as shown below.
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=12cm]
% \NiceMatrixOptions%
%  {code-for-last-row = \scriptstyle ~emphase#\rotate@ ,
%   code-for-last-col = \scriptstyle }
% $A = \begin{pNiceMatrix}[last-row=4,last-col=4]
% 1   & 2   & 3   & e_1 \\
% 4   & 5   & 6   & e_2 \\
% 7   & 8   & 9   & e_3 \\
% \text{image of } e_1 & e_2 & e_3 \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \begin{varwidth}{10cm}
% \NiceMatrixOptions%
%  {code-for-last-row = \scriptstyle\rotate ,
%   code-for-last-col = \scriptstyle }%
% $A = \begin{pNiceMatrix}[last-row=4,last-col=4]
% 1   & 2   & 3  & e_1 \\
% 4   & 5   & 6  & e_2 \\
% 7   & 8   & 9  & e_3 \\
% \text{image of } e_1 & e_2 & e_3 \\
% \end{pNiceMatrix}$
% \end{varwidth}
%
%
%
% \subsection{The option small}
%
% \label{small}
% 
% With the option |small|, the environments of the package \pkg{nicematrix}
% are composed in a way similar to the environment |{smallmatrix}| of the
% package \pkg{amsmath} (and the environments |{psmallmatrix}|,
% |{bsmallmatrix}|, etc. of the package \pkg{mathtools}).
%
% \bigskip
% \begin{Verbatim}
% $\begin{bNiceArray}{CCCC|C}[~emphase#small@, 
%                             last-col, 
%                             code-for-last-col = \scriptscriptstyle, 
%                             columns-width = 3mm ] 
% 1 & -2 & 3 & 4 & 5 \\
% 0 & 3  & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\
% 0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\
% \end{bNiceArray}$
% \end{Verbatim}
% %
% \[\begin{bNiceArray}{CCCC|C}[small, last-col, 
%                      code-for-last-col = \scriptscriptstyle, 
%                      columns-width=3mm]
% 1 & -2 & 3 & 4 & 5 \\
% 0 & 3  & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\
% 0 & 1  & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \\
% \end{bNiceArray}\]
%
%
%
% \bigskip
% One should note that the environment |{NiceMatrix}| with the option |small| is
% not composed \emph{exactly} as the environment |{smallmatrix}|. Indeed, all
% the environments of \pkg{nicematrix} are constructed upon |{array}| (of the
% package \pkg{array}) whereas the environment |{smallmatrix}| is constructed
% directly with an |\halign| of TeX.
%
% \medskip
% In fact, the option |small| corresponds to the following tuning:
% \begin{itemize}
% \item the cells of the array are composed with \verb|\scriptstyle|; 
% \item \verb|\arraystretch| is set to $0.47$; 
% \item \verb|\arraycolsep| is set to $1.45$~pt; 
% \item the characteristics of the dotted lines are also modified.
% \end{itemize}
%
% \subsection{The counters iRow and jCol}
%
% In the cells of the array, it's possible to use the LaTeX counters |iRow| and
% |jCol| which represent the number of the current row and the number of the
% current column\footnote{We recall that the exterior ``first row'' (if it
% exists) has the number~$0$ and that the exterior ``first column'' (if it
% exists) has also the number~$0$.}. Of course, the user must not change the
% value of these counters which are used internally by \pkg{nicematrix}.
%
% In the |code-after| (cf. p. \pageref{code-after}), |iRow| represents the total
% number of rows (excepted the potential exterior rows) and |jCol| represents
% the total number of columns (excepted the potential exterior columns).
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
% $\begin{pNiceMatrix}% don't forget the %
%     [first-row,
%      first-col,
%      code-for-first-row = \mathbf{~emphase#\alph{jCol}@} ,
%      code-for-first-col = \mathbf{~emphase#\arabic{iRow}@} ]
% &   &    &    &   \\
% & 1 & 2  & 3  & 4 \\
% & 5 & 6  & 7  & 8 \\
% & 9 & 10 & 11 & 12
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}[first-row,
%                    first-col,
%                    code-for-first-row = \mathbf{\alph{jCol}} ,
%                    code-for-first-col = \mathbf{\arabic{iRow}} ]
% &   &    &    &   \\
% & 1 & 2  & 3  & 4 \\
% & 5 & 6  & 7  & 8 \\
% & 9 & 10 & 11 & 12
% \end{pNiceMatrix}$
% 
% \medskip
% If LaTeX counters called |iRow| and |jCol| are defined in the document by
% packages other than \pkg{nicematrix} (or by the user), they are shadowed in
% the environments of \pkg{nicematrix}.
%
% \bigskip
% The package \pkg{nicematrix} also provides commands in order to compose
% automatically matrices from a general pattern. These commands are
% |\pAutoNiceMatrix|, |\bAutoNiceMatrix|, |\vAutoNiceMatrix|,
% |\VAutoNiceMatrix| and |\BAutoNiceMatrix|.
%
% These commands take two mandatory arguments. The first is the format of the
% matrix, with the syntax $n$-$p$ where $n$ is the number of rows and $p$ the
% number of columns. The second argument is the pattern (it's a list of tokens
% which are inserted in each cell of the constructed matrix, excepted in the
% cells of the eventual exterior rows and columns).
%
% \medskip
% \begin{Verbatim}
% $C = ~emphase#\pAutoNiceMatrix@{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$
% \end{Verbatim}
%
%
% $C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$
%
% \subsection{The options hlines, vlines and hvlines}
% 
% \label{hvlines}
% You can add horizontal rules between rows in the environments of
% \pkg{nicematrix} with the usual command |\hline| and you can use the specifier
% ``"|"'' to add vertical rules. However, by convenience, the package
% \pkg{nicematrix} also provides the option |hlines| (resp. |vlines|) which will
% draw all the horizontal (resp. vertical) rules (excepted, of course, the
% exterior rules corresponding to the exterior rows and columns). The key
% |hvlines| is an alias for the conjonction for the keys |hlines| et |vlines|.
% 
% % \medskip
% In the following example, we use the command |\arrayrulecolor| of
% \pkg{colortbl}.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% \arrayrulecolor{blue}
% $\begin{NiceArray}{CCCC}%
%  [~emphase#hvlines@,first-row,first-col]
% %   & e & a & b & c \\
% e & e & a & b & c \\
% a & a & e & c & b \\
% b & b & c & e & a \\
% c & c & b & a & e 
% \end{NiceArray}$
% \arrayrulecolor{black}
% \end{BVerbatim}
% \arrayrulecolor{blue}
% $\begin{NiceArray}{CCCC}[hvlines,first-row,first-col]
%   & e & a & b & c \\
% e & e & a & b & c \\
% a & a & e & c & b \\
% b & b & c & e & a \\
% c & c & b & a & e 
% \end{NiceArray}$
% \arrayrulecolor{black}
%
% \bigskip
% However, there is a difference between the key |vlines| and the use of
% the specifier ``"|"'' in the preamble of the environment: the rules drawn by
% |vlines| completely cross the double-rules drawn by |\hline\hline|.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11.5cm]
% $\begin{NiceArray}{CCCC}[vlines] \hline
% a & b & c & d \\ \hline \hline
% 1 & 2 & 3 & 4 \\
% 1 & 2 & 3 & 4 \\ \hline
% \end{NiceArray}$
% \end{BVerbatim}
% $\begin{NiceArray}{CCCC}[vlines]
% \hline
% a & b & c & d \\
% \hline \hline
% 1 & 2 & 3 & 4 \\
% 1 & 2 & 3 & 4 \\
% \hline
% \end{NiceArray}$
%
% \bigskip
% For the environments with delimiters (for example |{pNiceArray}| or
% |{pNiceMatrix}|), the option |vlines| don't draw vertical rules on both sides,
% where are the delimiters (fortunately).
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
% \setlength{\arrayrulewidth}{0.2pt}
% $\begin{pNiceMatrix}[vlines]
% 1 & 2 & 3 & 4 & 5 & 6 \\
% 1 & 2 & 3 & 4 & 5 & 6 \\
% 1 & 2 & 3 & 4 & 5 & 6 \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \begin{scope}
% \setlength{\arrayrulewidth}{0.2pt}
% $\begin{pNiceMatrix}[vlines]
% 1 & 2 & 3 & 4 & 5 & 6 \\
% 1 & 2 & 3 & 4 & 5 & 6 \\
% 1 & 2 & 3 & 4 & 5 & 6 \\
% \end{pNiceMatrix}$
% \end{scope}
%
%
% \subsection{The option light-syntax}
%
% \label{light-syntax}
% The option |light-syntax|\footnote{This option is inspired by the package
% \pkg{spalign} of Joseph Rabinoff.} allows the user to compose the arrays with a
% lighter syntax, which gives a more readable TeX source.
%
% When this option is used, one should use the semicolon for the end of a row
% and spaces or tabulations to separate the columns. However, as usual in the
% TeX world, the spaces after a control sequence are discarded and the elements
% between curly braces are considered as a whole.
%
% \bigskip
% The following example has been composed with XeLaTeX with \pkg{unicode-math},
% which allows the use of greek letters directly in the TeX source.
%
% \medskip
% \begin{scope}
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\begin{bNiceMatrix}[~emphase#light-syntax@,first-row,first-col]
% {} a             b                 ;
% a  2\cos a       {\cos a + \cos b} ;
% b \cos a+\cos b  { 2 \cos b }
% \end{bNiceMatrix}$
% \end{BVerbatim}
% \end{scope}
% $\begin{bNiceMatrix}[light-syntax,first-row,first-col]
% {} a             b                 ;
% a  2\cos a       {\cos a + \cos b} ;
% b \cos a+\cos b  { 2 \cos b }
% \end{bNiceMatrix}$
%
% \medskip
% It's possible to change the character used to mark the end of rows with the
% option |end-of-row|. As said before, the initial value is a semicolon.
%
% \medskip
% When the option |light-syntax| is used, it is not possible to put verbatim
% material (for example with the command |\verb|) in the cells of the
% array.\footnote{The reason is that, when the option |light-syntax| is used,
% the whole content of the environment is loaded as a TeX argument to be
% analyzed. The environment doesn't behave in that case as a standard
% environment of LaTeX which only put TeX commands before and after the content.}
% 
% \subsection{Use of the column type S of siunitx}
%
% If the package \pkg{siunitx} is loaded (before or after \pkg{nicematrix}),
% it's possible to use the |S| column type of \pkg{siunitx} in the environments
% of \pkg{nicematrix}. The implementation doesn't use explicitly any private
% macro of \pkg{siunitx}. 
% 
% 
% \medskip
% \begin{BVerbatim}[baseline = c, boxwidth = 10.5cm]
% $\begin{pNiceArray}{~emphase#S@CWc{1cm}C}[nullify-dots,first-row]
% {C_1} & \Cdots &  & C_n \\
% 2.3  & 0 & \Cdots & 0 \\
% 12.4 & \Vdots & & \Vdots \\
% 1.45 \\
% 7.2  & 0 & \Cdots & 0 
% \end{pNiceArray}$
% \end{BVerbatim}
% $\begin{pNiceArray}{SCWc{1cm}C}[nullify-dots,first-row]
% {C_1} & \Cdots &  & C_n \\
% 2.3  & 0 & \Cdots & 0 \\
% 12.4 & \Vdots & & \Vdots \\
% 1.45 \\
% 7.2  & 0 & \Cdots & 0 
% \end{pNiceArray}$
% 
% \medskip
% On the other hand, the |d| columns of the package \pkg{dcolumn} are not
% supported by \pkg{nicematrix}.
%
%
%
% \section{Technical remarks}
% 
% \subsection{Definition of new column types}
%
% \label{OnlyMainNiceMatrix}
% 
% The package \pkg{nicematrix} provides the command |\OnlyMainNiceMatrix|
% which is meant to be used in definitions of new column types. Its argument is
% evaluated if and only if we are in the main part of the array, that is to say
% not in an eventual exterior row. 
%
% For example, one may wish to define a new column type |?| in order to draw a
% (black) heavy rule of width 1~pt. The following definition will do the
% job\footnote{The command |\vrule| is a TeX (and not LaTeX) command.}:
%
% \begin{Verbatim}
% \newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}}
% \end{Verbatim}
%
% The heavy vertical rule won't extend in the exterior rows:
% \medskip
% \begin{scope}
% \newcolumntype{?}{!{\OnlyMainNiceMatrix{\vrule width 1 pt}}}
%
% \begin{BVerbatim}[baseline = c, boxwidth = 10.5cm]
% $\begin{pNiceArray}{CC?CC}[first-row,last-row=3]
% C_1 & C_2 & C_3 & C_4 \\
% a & b & c & d \\
% e & f & g & h \\
% C_1 & C_2 & C_3 & C_4
% \end{pNiceArray}$
% \end{BVerbatim}
% $\begin{pNiceArray}{CC?CC}[first-row,last-row=3]
% C_1 & C_2 & C_3 & C_4 \\
% a & b & c & d \\
% e & f & g & h \\
% C_1 & C_2 & C_3 & C_4
% \end{pNiceArray}$
% \end{scope}
%
% \medskip
% The specifier |?| may be used in a standard environment |{array}| (of the
% package \pkg{array}) and, in this case, the command |\OnlyMainNiceMatrix| is
% no-op.
%
% 
% \subsection{The names of the PGF nodes created by nicematrix}
% 
% We have said that, when a name is given to an environment of \pkg{nicematrix},
% it's possible to access the PGF/Tikz nodes through this name (cf.
% p.~\pageref{name}).
%
% That's the recommended way to access these nodes. However, we describe now the
% internal names of these nodes.
%
% The environments created by \pkg{nicematrix} are numbered by an internal
% global counter. The command |\NiceMatrixLastEnv| provides the number of the
% last environment of \pkg{nicematrix} (for LaTeX, it's a ``fully expandable''
% command and not a counter).
% 
% For the environment of number~$n$, the node in row~$i$ and column~$j$ has the
% name |nm-|$n$|-|$i$|-|$j$. The |medium| and |large| nodes have the same name,
% suffixed by |-medium| and |-large|.
% 
% 
% \subsection{Diagonal lines} 
%
% By default, all the diagonal lines\footnote{We speak of the lines created by
% |\Ddots| and not the lines created by a command |\line| in |code-after|.} of a
% same array are ``parallelized''. That means that the first diagonal line is
% drawn and, then, the other lines are drawn parallel to the first one (by
% rotation around the left-most extremity of the line). That's why the position
% of the instructions |\Ddots| in the array can have a marked effect on the
% final result.
%
% \medskip
% In the following examples, the first |\Ddots| instruction is written in color:
% 
% % \medskip
% \begin{scope}
% \begin{minipage}{9.5cm}
% Example with parallelization (default):
% \begin{Verbatim}
% $A = \begin{pNiceMatrix}
% 1      & \Cdots &        & 1      \\
% a+b    & ~emphase#\Ddots@~ &        & \Vdots \\
% \Vdots & \Ddots &        &        \\
% a+b    & \Cdots & a+b    & 1
% \end{pNiceMatrix}$
% \end{Verbatim}
% \end{minipage}
% $A = \begin{pNiceMatrix}
% 1      & \Cdots &     & 1      \\
% a+b    & \Ddots &     & \Vdots \\
% \Vdots & \Ddots &     &        \\
% a+b    & \Cdots & a+b & 1
% \end{pNiceMatrix}$
% 
% \bigskip
% \NiceMatrixOptions{parallelize-diags=true}%
% \begin{minipage}{9.5cm}
% % \begin{Verbatim}
% $A = \begin{pNiceMatrix}
% 1      & \Cdots &        & 1      \\
% a+b    &        &        & \Vdots \\
% \Vdots & ~emphase#\Ddots@~ & \Ddots &        \\
% a+b    & \Cdots & a+b    & 1
% \end{pNiceMatrix}$
% \end{Verbatim}
% \end{minipage}
% $A = \begin{pNiceMatrix}
% 1      & \Cdots &        & 1      \\
% a+b    &        &        & \Vdots \\
% \Vdots & \Ddots & \Ddots &        \\
% a+b    & \Cdots & a+b    & 1
% \end{pNiceMatrix}$
%
% \bigskip
% It's possible to turn off the parallelization with the option
% |parallelize-diags| set to |false|: \par\nobreak
%
% \medskip
% \NiceMatrixOptions{parallelize-diags=false}%
% \begin{minipage}{9.5cm}
% The same example without parallelization:
% \end{minipage}
% $A = \begin{pNiceMatrix}
% 1      & \Cdots  &     & 1      \\
% a+b    & \Ddots  &     & \Vdots \\
% \Vdots & \Ddots  &     &        \\
% a+b    & \Cdots  & a+b & 1
% \end{pNiceMatrix}$
%
%
% \end{scope}
%
% \subsection{The ``empty'' cells}
% 
% \label{empty-cells}
% An instruction like |\Ldots|, |\Cdots|, etc. tries to determine the first
% non-empty cells on both sides. However, an empty cell is not necessarily a
% cell with no TeX content (that is to say a cell with no token between the two 
% ampersands~|&|). Indeed, a cell which only contains |\hspace*{1cm}| may be
% considered as empty.
%
% \interitem
% For \pkg{nicematrix}, the precise rules are as follow.
%
% \begin{itemize}
% \item An implicit cell is empty. For example, in the following matrix:
%
% \begin{Verbatim}
% \begin{pmatrix}
% a & b \\
% c \\
% \end{pmatrix}
% \end{Verbatim}
% 
% the last cell (second row and second column) is empty.
%
% \medskip
% \item Each cell whose TeX ouput has a width equal to zero is empty.
%
%
% \medskip
% \item A cell with a command |\Hspace| (or |\Hspace*|) is empty. This command
% |\Hspace| is a command defined by the package \pkg{nicematrix} with the same
% meaning as |\hspace| except that the cell where it is used is considered as
% empty. This command can be used to fix the width of some columns of the matrix
% without interfering with \pkg{nicematrix}.
% % \end{itemize}
%
%
% \subsection{The option exterior-arraycolsep}
% 
% The environment |{array}| inserts an horizontal space equal to |\arraycolsep|
% before and after each column. In particular, there is a space equal to
% |\arraycolsep| before and after the array. This feature of the environment
% |{array}| was probably not a good idea\footnote{In the documentation of
% |{amsmath}|, we can read: {\itshape The extra space of |\arraycolsep| that
% \pkg{array} adds on each side is a waste so we remove it [in |{matrix}|]
% (perhaps we should instead remove it from array in general, but that's a
% harder task).}}. The environment |{matrix}| of
% \pkg{amsmath} and its variants (|{pmatrix}|, |{vmatrix}|, etc.) of
% \pkg{amsmath} prefer to delete these spaces with explicit instructions 
% |\hskip -\arraycolsep|\footnote{And not by inserting |@{}| on both sides of the
% preamble of the array. As a consequence, the length of the |\hline| is not
% modified and may appear too long, in particular when using square brackets}.
% The package \pkg{nicematrix} does the same in all its environments,
% |{NiceArray}| included. However, if the user wants the environment
% |{NiceArray}| behaving by default like the environment |{array}| of
% \pkg{array} (for example, when adapting an existing document) it's possible to
% control this behaviour with the option |exterior-arraycolsep|, set by the
% command |\NiceMatrixOptions|. With this option, exterior spaces of length
% |\arraycolsep| will be inserted in the environments |{NiceArray}| (the other
% environments of \pkg{nicematrix} are not affected).
%
%
% \subsection{The class option draft}
%
% When the class option |draft| is used, the dotted lines are not drawn, for a
% faster compilation.
% 
% \subsection{A technical problem with the argument of
% \textbackslash\textbackslash}
% 
%
% For technical, reasons, if you use the optional argument of the command |\\|,
% the vertical space added will also be added to the ``normal'' node
% corresponding at the previous node. 
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
%      \begin{pNiceMatrix}
%      a & \frac AB \\~emphase#[2mm]@
%      b & c
%      \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}[
%    code-after = {\tikz \node [inner sep = 0pt,
%                               fill = red!15,
%                               blend mode = multiply,
%                               fit = (1-2) ] {} ; } ]
% a & \frac AB \\[2mm]
% b & c
% \end{pNiceMatrix}$
%
% \bigskip
% There are two solutions to solve this problem. The first solution is to use a
% TeX command to insert space between the rows.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
%      \begin{pNiceMatrix}
%      a & \frac AB \\
%      ~emphase#\noalign{\kern2mm}@
%      b & c
%      \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}[
%    code-after = {\tikz \node [inner sep = 0pt,
%                               fill = red!15,
%                               blend mode = multiply,
%                               fit = (1-2) ] {} ; } ]
% a & \frac AB \\
% \noalign{\kern2mm}
% b & c
% \end{pNiceMatrix}$
%
%
% \bigskip
% The other solution is to use the command |\multicolumn| in the previous cell.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
%      \begin{pNiceMatrix}
%      a & ~emphase#\multicolumn1C{\frac AB}@ \\[2mm]
%      b & c
%      \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}[
%    code-after = {\tikz \node [inner sep = 0pt,
%                               fill = red!15,
%                               blend mode = multiply,
%                               fit = (1-2) ] {} ; } ]
% a & \multicolumn1C{\frac AB} \\[2mm]
% b & c
% \end{pNiceMatrix}$
%
%
% \subsection{Obsolete environments}      
% 
% The version 3.0 of \pkg{nicematrix} has introduced the environment
% |{pNiceArray}| (and its variants) with the options |first-row|, |last-row|,
% |first-col| and |last-col|. 
%
% Consequently the following environments present in previous versions of
% \pkg{nicematrix} are deprecated:
% %
% \begin{itemize}
% \item |{NiceArrayCwithDelims}| ;
% \item |{pNiceArrayC}|, |{bNiceArrayC}|, |{BNiceArrayC}|, |{vNiceArrayC}|,
% |{VNiceArrayC}| ;
% \item |{NiceArrayRCwithDelims}| ;
% \item |{pNiceArrayRC}|, |{bNiceArrayRC}|, |{BNiceArrayRC}|, |{vNiceArrayRC}|,
% |{VNiceArrayRC}|.
% \end{itemize}
%       
% Since the version 3.12, the only way to use these environments is loading
% \pkg{nicematrix} with the option |obsolete-environments|.
%
% However, these environments will certainly be completely deleted in a future
% version of \pkg{nicematrix}.
%
% \section{Examples}
%
% \subsection{Dotted lines}
%
%
% A permutation matrix (as an example, we have raised the value of
% |xdots/shorten|). 
%
% \label{permutation}
% \bigskip
% \begin{BVerbatim}[baseline=c]
% $\begin{pNiceMatrix}[~emphase#xdots/shorten=0.6em@]
% 0       & 1 & 0 &        & \Cdots &   0    \\
% \Vdots  &   &   & \Ddots &        & \Vdots \\
%         &   &   & \Ddots &        &        \\
%         &   &   & \Ddots &        &   0    \\
% 0       & 0 &   &        &        &   1    \\
% 1       & 0 &   & \Cdots &        &   0    
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \hspace{2.5cm}
% $\begin{pNiceMatrix}[xdots/shorten=0.6em]
% 0       & 1 & 0 &        & \Cdots &   0    \\
% \Vdots  &   &   & \Ddots &        & \Vdots \\
%         &   &   & \Ddots &        &        \\
%         &   &   & \Ddots &        &   0    \\
% 0       & 0 &   &        &        &   1    \\
% 1       & 0 &   & \Cdots &        &   0    
% \end{pNiceMatrix}$
%
% \vspace{2cm}
%
% An example with |\Iddots| (we have raised again the value of
% |xdots/shorten|).\par\nobreak  
%
% \bigskip
% \begin{BVerbatim}[baseline=c]
% $\begin{pNiceMatrix}[xdots/shorten=0.9em]
% 1       & \Cdots  &         & 1      \\
% \Vdots  &         &         & 0      \\
%         & ~emphase#\Iddots@ & ~emphase#\Iddots@ & \Vdots \\
% 1       & 0       & \Cdots  & 0 
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \hspace{4cm}
% $\begin{pNiceMatrix}[xdots/shorten=0.9em]
% 1       & \Cdots  &         & 1      \\
% \Vdots  &         &         & 0      \\
%         & \Iddots & \Iddots & \Vdots \\
% 1       & 0       & \Cdots  & 0 
% \end{pNiceMatrix}$
%
%
% \vspace{2cm}
% An example with |\multicolumn|:\par\nobreak
%
% \bigskip
% \begin{BVerbatim}
% \begin{BNiceMatrix}[nullify-dots]
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
% \Cdots &  & ~emphase#\multicolumn{6}{C}{10 \text{ other rows}}@ & \Cdots \\
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10
% \end{BNiceMatrix}
% \end{BVerbatim}
% 
% \bigskip
% \[\begin{BNiceMatrix}[nullify-dots]
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
% \Cdots &  & \multicolumn{6}{C}{10 \text{ other rows}} & \Cdots \\
% 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10
% \end{BNiceMatrix}\]
% 
% \vspace{2cm}
% An example with |\Hdotsfor|:\par\nobreak
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% \begin{pNiceMatrix}[nullify-dots]
% 0 & 1 & 1 & 1 & 1 & 0 \\
% 0 & 1 & 1 & 1 & 1 & 0 \\
% \Vdots  & ~emphase#\Hdotsfor{4}@ & \Vdots \\
%  & ~emphase#\Hdotsfor{4}@ & \\
%  & ~emphase#\Hdotsfor{4}@ & \\
%  & ~emphase#\Hdotsfor{4}@ & \\
% 0 & 1 & 1 & 1 & 1 & 0 
% \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}[nullify-dots]
% 0 & 1 & 1 & 1 & 1 & 0 \\
% 0 & 1 & 1 & 1 & 1 & 0 \\
% \Vdots  & \Hdotsfor{4} & \Vdots \\
%  & \Hdotsfor{4} & \\
%  & \Hdotsfor{4} & \\
%  & \Hdotsfor{4} & \\
% 0 & 1 & 1 & 1 & 1 & 0 
% \end{pNiceMatrix}$
%
% \vspace{2cm}
% An example for the resultant of two polynoms:\par\nobreak
%
% \bigskip
% \begin{BVerbatim}
% \setlength{\extrarowheight}{1mm}
% \[\begin{vNiceArray}{CCCC:CCC}[columns-width=6mm]
% a_0   &      &&       &b_0    &      &     \\
% a_1   &\Ddots&&       &b_1    &\Ddots&     \\
% \Vdots&\Ddots&&       &\Vdots &\Ddots&b_0  \\
% a_p   &      &&a_0    &       &      &b_1   \\
%       &\Ddots&&a_1    &b_q    &      &\Vdots\\
%       &      &&\Vdots &       &\Ddots&      \\
%       &      &&a_p     &       &      &b_q    
% \end{vNiceArray}\]
% \end{BVerbatim}
% 
% \bigskip
%
% \begin{scope}
% \setlength{\extrarowheight}{1mm}
% \[\begin{vNiceArray}{CCCC:CCC}[columns-width=6mm]
% a_0   &      &&       &b_0    &      &     \\
% a_1   &\Ddots&&       &b_1    &\Ddots&     \\
% \Vdots&\Ddots&&       &\Vdots &\Ddots&b_0  \\
% a_p   &      &&a_0    &       &      &b_1   \\
%       &\Ddots&&a_1    &b_q    &      &\Vdots\\
%       &      &&\Vdots &       &\Ddots&      \\
%       &      &&a_p     &       &      &b_q    
% \end{vNiceArray}\]
% \end{scope}   
%
% \vspace{2cm}
% An example for a linear system (the vertical rule has been drawn in blue with
% the tools of \pkg{colortbl}):\par\nobreak
%
% \begin{Verbatim}
% \arrayrulecolor{blue}
% $\begin{pNiceArray}{*6C|C}[nullify-dots,last-col,code-for-last-col=\scriptstyle]
% 1      & 1 & 1 &\Cdots &   & 1      & 0      & \\
% 0      & 1 & 0 &\Cdots &   & 0      &        & L_2 \gets L_2-L_1 \\
% 0      & 0 & 1 &\Ddots &   & \Vdots &        & L_3 \gets L_3-L_1 \\
%        &   &   &\Ddots &   &        & \Vdots & \Vdots \\
% \Vdots &   &   &\Ddots &   & 0      & \\
% 0      &   &   &\Cdots & 0 & 1      & 0      & L_n \gets L_n-L_1 
% \end{pNiceArray}$
% \arrayrulecolor{black}
% \end{Verbatim}
% 
% \arrayrulecolor{blue}
% \[\begin{pNiceArray}{*6C|C}[nullify-dots,last-col,code-for-last-col=\scriptstyle]
% 1      & 1 & 1 &\Cdots &   & 1      & 0      & \\
% 0      & 1 & 0 &\Cdots &   & 0      &        & L_2 \gets L_2-L_1 \\
% 0      & 0 & 1 &\Ddots &   & \Vdots &        & L_3 \gets L_3-L_1 \\
%        &   &   &\Ddots &   &        & \Vdots & \Vdots \\
% \Vdots &   &   &\Ddots &   & 0      & \\
% 0      &   &   &\Cdots & 0 & 1      & 0      & L_n \gets L_n-L_1 
% \end{pNiceArray}\]
% \arrayrulecolor{black}
%
%
%
% \subsection{Dotted lines which are no longer dotted}
%
% The option |line-style| controls the style of the lines drawn by |\Ldots|,
% |\Cdots|, etc. Thus, it's possible with these commands to draw lines which are
% not longer dotted.
% 
% \begin{Verbatim}
% \NiceMatrixOptions
%   {nullify-dots,code-for-first-col = \color{blue},code-for-first-col=\color{blue}}
% $\begin{pNiceMatrix}[first-row,first-col]
%        &   & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ columns}} \\
%        & 1 & 1 & 1 & \Ldots & 1 \\
%        & 1 & 1 & 1 &  & 1 \\
% \Vdots[line-style={solid,<->}]_{n \text{ rows}} & 1 & 1 & 1 &  & 1 \\
%        & 1 & 1 & 1 &  & 1 \\
%        & 1 & 1 & 1 & \Ldots & 1 \\
% \end{pNiceMatrix}$
% \end{Verbatim}
%
%
% \begin{scope}
% \NiceMatrixOptions
%   {nullify-dots,code-for-first-col = \color{blue},code-for-first-row=\color{blue}}
% \[\begin{pNiceMatrix}[first-row,first-col]
%        &   & \Ldots[line-style={solid,<->},shorten=0pt]^{n \text{ columns}} \\
%        & 1 & 1 & 1 & \Ldots & 1 \\
%        & 1 & 1 & 1 &  & 1 \\
% \Vdots[line-style={solid,<->}]_{n \text{ rows}} & 1 & 1 & 1 &  & 1 \\
%        & 1 & 1 & 1 &  & 1 \\
%        & 1 & 1 & 1 & \Ldots & 1 \\
% \end{pNiceMatrix}\]
% \end{scope}
%
% \subsection{Width of the columns}
% 
%
% \medskip
% In the following example, we use |{NiceMatrixBlock}| with the option
% |auto-columns-width| because we want the same automatic width for all the
% columns of the matrices. 
%
% \bigskip
% \begin{BVerbatim}
% ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
% \NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle,light-syntax}
% \setlength{\extrarowheight}{1mm}
% $\begin{pNiceArray}{CCCC:C}[last-col]
%   1  1  1   1   1 ;
%   2  4  8  16   9 ;
%   3  9 27  81  36 ;
%   4 16 64 256 100 
% \end{pNiceArray}$
% \medskip
% $\begin{pNiceArray}{CCCC:C}[last-col]
%   1  1  1   1  1 ;
%   0  2  6  14  7        { L_2 \gets -2 L_1 + L_2 } ;
%   0  6 24  78 33        { L_3 \gets -3 L_1 + L_3 } ;
%   0 12 60 252 96        { L_4 \gets -4 L_1 + L_4 } 
% \end{pNiceArray}$
% ...
% ~emphase#\end{NiceMatrixBlock}@
% \end{BVerbatim}
% 
% \bigskip
% 
% % \begin{multicols}{2}
% \begin{NiceMatrixBlock}[auto-columns-width]
% \NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle,light-syntax}
% \setlength{\extrarowheight}{1mm}
%
% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
% 1  1  1   1   1 ;
% 2  4  8  16   9 ;
% 3  9 27  81  36 ;
% 4 16 64 256 100 
% \end{pNiceArray}$
%
% \medskip
%
% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
% 1  1  1   1  1 ;
% 0  2  6  14  7 { L_2 \gets -2 L_1 + L_2 } ;
% 0  6 24  78 33 { L_3 \gets -3 L_1 + L_3 } ;
% 0 12 60 252 96 { L_4 \gets -4 L_1 + L_4 } 
% \end{pNiceArray}$
%
% \medskip
%
% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
% 1 1  1  1 1 ;
% 0 1  3  7 \frac72    { L_2 \gets \frac12 L_2 } ;
% 0 3 12 39 \frac{33}2 { L_3 \gets \frac12 L_3 } ;
% 0 1  5 21 8          { L_4 \gets \frac1{12} L_4 }
% \end{pNiceArray}$
%
% \medskip
%
% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
% 1 1  1   1 1       ;
% 0 1  3   7 \frac72 ;
% 0 0  3  18 6        { L_3 \gets -3 L_2 + L_3 } ;
% 0 0 -2 -14 -\frac92 { L_4 \gets L_2 - L_4 }
% \end{pNiceArray}$
%
% \medskip
%
% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
% 1 1  1   1 1       ;
% 0 1  3   7 \frac72 ;
% 0 0  1   6 2        { L_3 \gets \frac13 L_3 } ;
% 0 0 -2 -14 -\frac92 
% \end{pNiceArray}$
%
% \medskip
%
% \enskip $\begin{pNiceArray}{CCCC:C}[last-col]
% 1 1 1  1 1       ;
% 0 1 3  7 \frac72 ;
% 0 0 1  6 2       ;
% 0 0 0 -2 -\frac12   { L_4 \gets L_3 + L_4 }
% \end{pNiceArray}$
% \end{NiceMatrixBlock}
% \end{multicols}
%
% 
% \subsection{How to highlight cells of the matrix}
%
%
% \label{highlight}
% The following examples require Tikz (by default, \pkg{nicematrix} only loads
% \textsc{pgf}) and the Tikz library |fit|. The following lines in the preamble
% of your document may do the job:
% \begin{verbatim}
% \usepackage{tikz}
% \usetikzlibrary{fit}
% \end{verbatim}
% 
% \medskip
% In order to highlight a cell of a matrix, it's possible to ``draw'' one of the
% correspondant nodes (the ``normal node'', the ``medium node'' or the ``large
% node''). In the following example, we use the ``large nodes'' of the diagonal
% of the matrix (with the Tikz key ``|name suffix|'', it's easy to use the
% ``large nodes''). 
%
% We redraw the nodes with other nodes by using the Tikz library |fit|. Since we
% want to redraw the nodes exactly, we have to set |inner sep = 0 pt| (if we
% don't do that, the new nodes will be larger that the nodes created by
% \pkg{nicematrix}). 
%
% \begin{Verbatim}
% $\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin = 2pt]
%   a_{11} & a_{12} & a_{13} & a_{14} \\
%   a_{21} & a_{22} & a_{23} & a_{24} \\
%   a_{31} & a_{32} & a_{33} & a_{34} \\
%   a_{41} & a_{42} & a_{43} & a_{44} 
% \CodeAfter
%   \begin{tikzpicture}[~emphase#name suffix = -large@,
%                       every node/.style = {draw,~emphase#inner sep = 0 pt@}]
%      \node [fit = (1-1)] {} ; 
%      \node [fit = (2-2)] {} ; 
%      \node [fit = (3-3)] {} ; 
%      \node [fit = (4-4)] {} ; 
%   \end{tikzpicture}
% \end{pNiceArray}$
% \end{Verbatim}
%
% \[\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin = 2pt]
%   a_{11} & a_{12} & a_{13} & a_{14} \\
%   a_{21} & a_{22} & a_{23} & a_{24} \\
%   a_{31} & a_{32} & a_{33} & a_{34} \\
%   a_{41} & a_{42} & a_{43} & a_{44} 
% \CodeAfter
%   \begin{tikzpicture}[name suffix = -large,
%                       every node/.style = {draw,inner sep = 0 pt}]
%      \node [fit = (1-1)] {} ; 
%      \node [fit = (2-2)] {} ; 
%      \node [fit = (3-3)] {} ; 
%      \node [fit = (4-4)] {} ; 
%   \end{tikzpicture}
% \end{pNiceArray}\]
%
% 
% We should remark that the rules we have drawn are drawn \emph{after} the
% construction of the array and thus, they don't spread the cells of the
% array. We recall that, on the other side, the command |\hline|, the specifier
% ``"|"'' and the options |hlines| and |vlines| spread the cells (when the
% package \pkg{array} is loaded but, when the package \pkg{nicematrix} is
% loaded, \pkg{array} is always loaded).\footnote{On the other side, the command
% |\cline| doesn't spread the rows of the array.}
% 
%
% \vspace{1cm}
% The package \pkg{nicematrix} is constructed upon the environment |{array}|
% and, therefore, it's possible to use the package \pkg{colortbl} in the
% environments of \pkg{nicematrix}. However, it's not always easy to do a fine
% tuning of \pkg{colortbl}. That's why we propose another method to highlight a
% row of the matrix. We create a rectangular Tikz node which encompasses the
% nodes of the second row with the Tikz library \pkg{fit}. This Tikz node is
% filled after the construction of the matrix. In order to see the text
% \emph{under} this node, we have to use transparency with the |blend mode|
% equal to |multiply|. 
%
% \tikzset{highlight/.style={rectangle,
%                            fill=red!15,
%                            blend mode = multiply, 
%                            rounded corners = 0.5 mm, 
%                            inner sep=1pt,
%                            fit = #1}}
%
% \medskip
% \begin{Verbatim}
% \tikzset{highlight/.style={rectangle,
%                            fill=red!15,
%                            ~emphase#blend mode = multiply@,
%                            rounded corners = 0.5 mm, 
%                            inner sep=1pt,
%                            fit = ~#1}}
%
% $\begin{bNiceMatrix}[~emphase#code-after = {\tikz \node [highlight = (2-1) (2-3)] {} ;}@]
% 0 & \Cdots & 0 \\
% 1 & \Cdots & 1 \\
% 0 & \Cdots & 0 
% \end{bNiceMatrix}$
% \end{Verbatim}
% 
% \[\begin{bNiceMatrix}[code-after = {\tikz \node [highlight = (2-1) (2-3)] {} ;}]
% 0 & \Cdots & 0 \\
% 1 & \Cdots & 1 \\
% 0 & \Cdots & 0 
% \end{bNiceMatrix}\]
% 
%
% \bigskip
% This code fails with |latex|-|dvips|-|ps2pdf| because Tikz for |dvips|, as for
% now, doesn't support blend modes. However, the following code, in the
% preamble, should activate blend modes in this way of compilation. 
%
%
% \begin{scope} \small
% |\ExplSyntaxOn|
%
% |\makeatletter|
%
% |\tl_set:Nn \l_tmpa_tl {pgfsys-dvips.def}|
%
% |\tl_if_eq:NNT \l_tmpa_tl \pgfsysdriver|
%
% |  {\cs_set:Npn\pgfsys@blend@mode#1{\special{ps:~/\tl_upper_case:n #1~.setblendmode}}}|
%
% |\makeatother|
%
% |\ExplSyntaxOff|
% \end{scope}
%
% \vspace{1cm} 
% We recall that, for a rectangle of merged cells (with the command |\Block|), a
% Tikz node is created for the set of merged cells with the name
% $i$|-|$j$-|block| where $i$ and $j$ are the number of the row and the number
% of the column of the upper left cell (where the command |\Block| has been
% issued). If the user has required the creation of the |medium| nodes, a node
% of this type is also created with a name suffixed by |-medium|.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11.6cm]
% $\begin{pNiceMatrix}[margin,create-medium-nodes]
%   \Block{3-3}<\Large>{A} & & & 0 \\
%   & \hspace*{1cm} & & \Vdots \\
%   & & & 0 \\
%   0 & \Cdots& 0 & 0
% \CodeAfter
%   \tikz \node [~emphase#highlight = (1-1-block-medium)@] {} ;
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}[margin,create-medium-nodes]
% \Block{3-3}<\Large>{A} & & & 0 \\
% & \hspace*{1cm} & & \Vdots \\
% & & & 0 \\
% 0 & \Cdots& 0 & 0
% \CodeAfter
% \tikz \node [highlight = (1-1-block-medium)] {} ;
% \end{pNiceMatrix}$
%
% 
% \vspace{1cm}
% Consider now the following matrix which we have named |example|.
%
% \medskip
% \begin{Verbatim}
% $\begin{pNiceArray}{CCC}[~emphase#name=example@,last-col,create-medium-nodes]
% a & a + b & a + b + c & L_1 \\
% a & a     & a + b     & L_2 \\
% a & a     & a         & L_3
% \end{pNiceArray}$
% \end{Verbatim}
%                           
% \[\begin{pNiceArray}{CCC}[last-col]
% a & a + b & a + b + c & L_1 \\
% a & a     & a + b     & L_2 \\
% a & a     & a         & L_3
% \end{pNiceArray}\]
% 
% \bigskip
% If we want to highlight each row of this matrix, we can use the previous
% technique three times. 
%
% \begin{Verbatim}
% \tikzset{mes-options/.style={remember picture, 
%                              overlay,
%                              name prefix = exemple-,
%                              highlight/.style = {fill = red!15,
%                                                  blend mode = multiply,
%                                                  inner sep = 0pt,
%                                                  fit = ~#1}}}
% \end{Verbatim}
% 
%
% \tikzset{mes-options/.style={remember picture, 
%                              overlay,
%                              name prefix = exemple-,
%                              highlight/.style = {fill = red!15,
%                                                  blend mode = multiply,
%                                                  inner sep = 0pt,
%                                                  fit = #1}}}
%
% \begin{Verbatim}
% \begin{tikzpicture}[mes-options]
% \node [highlight = (1-1) (1-3)] {} ;
% \node [highlight = (2-1) (2-3)] {} ;
% \node [highlight = (3-1) (3-3)] {} ;
% \end{tikzpicture}
% \end{Verbatim}
%
%
% \medskip
% We obtain the following matrix.
% 
% \[\begin{pNiceArray}{CCC}[
%      last-col,
%      code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15,
%                                                             blend mode = multiply,
%                                                             inner sep = 0pt}]
%                    \node [fit = (1-1) (1-3)] {} ;
%                    \node [fit = (2-1) (2-3)] {} ;
%                    \node [fit = (3-1) (3-3)] {} ;
%                    \end{tikzpicture}}]
% a & a + b & a + b + c & L_1\\
% a & a     & a + b     & L_2 \\
% a & a     & a         & L_3
% \end{pNiceArray}\]
%
% \medskip
% The result may seem disappointing. We can improve it by using the ``medium
% nodes'' instead of the ``normal nodes''. 
%
% \begin{Verbatim}
% \begin{tikzpicture}[mes-options, ~emphase#name suffix = -medium@]
% \node [highlight = (1-1) (1-3)] {} ;
% \node [highlight = (2-1) (2-3)] {} ;
% \node [highlight = (3-1) (3-3)] {} ;
% \end{tikzpicture}
% \end{Verbatim}
%
% \medskip
% We obtain the following matrix.
% 
% \[\begin{pNiceArray}{CCC}[
%      last-col,
%      create-medium-nodes,
%      code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15,
%                                                            blend mode = multiply,
%                                                            inner sep = 0pt,
%                                                            fit = #1},
%                                        name suffix = -medium]
%                    \node [highlight = (1-1) (1-3)] {} ;
%                    \node [highlight = (2-1) (2-3)] {} ;
%                    \node [highlight = (3-1) (3-3)] {} ;
%                    \end{tikzpicture}}]
% a & a + b & a + b + c & L_1 \\
% a & a     & a + b     & L_2 \\
% a & a     & a         & L_3
% \end{pNiceArray}\]
%
%
%                           
% \vspace{1cm}
% 
% In the following example, we use the ``large nodes'' to highlight a zone of
% the matrix.\par\nobreak 
% \begin{Verbatim}
% \begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin=2pt]
%   A_{11} & A_{12} & A_{13} & A_{14} \\
%   A_{21} & A_{22} & A_{23} & A_{24} \\
%   A_{31} & A_{32} & A_{33} & A_{34} \\
%   A_{41} & A_{42} & A_{43} & A_{44}  
% \CodeAfter
%   \tikz \path [~emphase#name suffix = -large@,fill = red!15, blend mode = multiply]
%       (1-1.north west)
%    |- (2-2.north west)
%    |- (3-3.north west)
%    |- (4-4.north west)
%    |- (4-4.south east)
%    |- (1-1.north west) ; 
% \end{pNiceArray}
% \end{Verbatim}
%                              
%
% \[\begin{pNiceArray}{>{\strut}CCCC}[create-large-nodes,margin,extra-margin=2pt]
%   A_{11} & A_{12} & A_{13} & A_{14} \\
%   A_{21} & A_{22} & A_{23} & A_{24} \\
%   A_{31} & A_{32} & A_{33} & A_{34} \\
%   A_{41} & A_{42} & A_{43} & A_{44}  
% \CodeAfter
%   \tikz \path [name suffix = -large,fill = red!15, blend mode = multiply]
%       (1-1.north west)
%    |- (2-2.north west)
%    |- (3-3.north west)
%    |- (4-4.north west)
%    |- (4-4.south east)
%    |- (1-1.north west) ; 
% \end{pNiceArray}\]
% 
% \subsection{Direct use of the Tikz nodes}
%
% In the following example, we illustrate the mathematical product of two
% matrices. 
%
% \medskip
% The use of |{NiceMatrixBlock}| with the option |auto-columns-width|
% gives the same width for all the columns and, therefore, a perfect alignment
% of the two superposed matrices.
% \begin{Verbatim}
% \begin{NiceMatrixBlock}[auto-columns-width]
% \end{Verbatim}
%
% \begin{Verbatim}
% \NiceMatrixOptions{nullify-dots}
% \end{Verbatim}
%
% The three matrices will be displayed using an environment |{array}| (an
% environment |{tabular}| may also be possible).
% \begin{Verbatim}
% $\begin{array}{cc}
% & 
% \end{Verbatim}
%
% The matrix $B$ has a ``first row'' (for $C_j$) and that's why we use the key
% |first-row|. 
% \begin{Verbatim}
% \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row]
%         &        & C_j                      \\
% b_{11}  & \Cdots & b_{1j} & \Cdots & b_{1n} \\
% \Vdots  &        & \Vdots &        & \Vdots \\
%         &        & b_{kj}                   \\
%         &        & \Vdots                   \\
%  b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} 
% \end{bNiceArray} \\ \\
% \end{Verbatim}
%
% The matrix $A$ has a ``first column'' (for $L_i$) and that's why we use the
% key |first-col|.
% \begin{Verbatim}
% \begin{bNiceArray}{CC>{\strut}CCC}[name=A,first-col]
%     & a_{11} & \Cdots &        &        & a_{1n} \\
%     & \Vdots &        &        &        & \Vdots \\
% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
%     & \Vdots &        &        &        & \Vdots \\
%     & a_{n1} & \Cdots &        &        & a_{nn} \\
% \end{bNiceArray}
% & 
% \end{Verbatim}
%
% In the matrix product, the two dotted lines have an open extremity.
% \begin{Verbatim}
% \begin{bNiceArray}{CC>{\strut}CCC}
%        & &        & & \\
%        & & \Vdots     \\
% \Cdots & & c_{ij}     \\
% \\
% \\
% \end{bNiceArray} 
% \end{array}$
%
% \end{NiceMatrixBlock}
% \end{Verbatim}
%
% \begin{Verbatim}                             
% \begin{tikzpicture}[remember picture, overlay]
%  \node [highlight = (A-3-1) (A-3-5) ] {} ; 
%  \node [highlight = (B-1-3) (B-5-3) ] {} ; 
%  \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ; 
% \end{tikzpicture}
% \end{Verbatim}
% 
%
% \begin{NiceMatrixBlock}[auto-columns-width]
% \NiceMatrixOptions{nullify-dots}
% $\begin{array}{cc}
% & 
% \begin{bNiceArray}{C>{\strut}CCCC}[name=B,first-row]
%        &        & C_j    \\
% b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
% \Vdots &        & \Vdots &        & \Vdots \\
%        &        & b_{kj} \\
%        &        & \Vdots \\
% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} 
% \end{bNiceArray} \\ \\
% \begin{bNiceArray}{CC>{\strut}CCC}[name=A,first-col]
%     & a_{11} & \Cdots &        &        & a_{1n} \\
%     & \Vdots &        &        &        & \Vdots \\
% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
%     & \Vdots &        &        &        & \Vdots \\
%     & a_{n1} & \Cdots &        &        & a_{nn} \\
% \end{bNiceArray}
% & 
% \begin{bNiceArray}{CC>{\strut}CCC}
%        &         &        & & \\
%        &         & \Vdots \\
% \Cdots &         & c_{ij} \\
% \\
% \\
% \end{bNiceArray} 
% \end{array}$
%
% \end{NiceMatrixBlock}
%
% \begin{tikzpicture}[remember picture, overlay]
%  \node [highlight = (A-3-1) (A-3-5) ] {} ; 
%  \node [highlight = (B-1-3) (B-5-3) ] {} ; 
%  \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ; 
% \end{tikzpicture}
%
% 
% 
% \section{Implementation}
%
% By default, the package \pkg{nicematrix} doesn't patch any existing code.
%
% \smallskip
% However, when the option |renew-dots| is used, the commands |\cdots|,
% |\ldots|, |\dots|, |\vdots|, |\ddots| and |\iddots| are redefined in the
% environments provided by \pkg{nicematrix} as explained previously. In the same
% way, if the option |renew-matrix| is used, the environment |{matrix}| of
% \pkg{amsmath} is redefined. 
%
% \smallskip
% On the other hand, the environment |{array}| is never redefined.
%
% \smallskip
% Of course, the package \pkg{nicematrix} uses the features of the package
% \pkg{array}. It tries to be independent of its implementation. Unfortunately,
% it was not possible to be strictly independent: the package \pkg{nicematrix}
% relies upon the fact that the package |{array}| uses |\ialign| to begin the
% |\halign|. 
% 
%
% \bigskip
% \subsection*{Declaration of the package and packages loaded}
%
%
% The prefix |nicematrix| has been registred for this package.
%
% See: |http://mirrors.ctan.org/macros/latex/contrib/l3kernel/l3prefixes.pdf|
% 
%<@@=nicematrix>
% 
% \bigskip
% First, we load \pkg{pgfcore} and the module \pkg{shapes}. We do so because
% it's not possible to use |\usepgfmodule| in |\ExplSyntaxOn|.
%    \begin{macrocode}
\RequirePackage{pgfcore}
\usepgfmodule{shapes}
%    \end{macrocode}
%
% 
% We give the traditional declaration of a package written with |expl3|:
%    \begin{macrocode}
\RequirePackage{l3keys2e}
\ProvidesExplPackage
  {nicematrix}
  {\myfiledate}
  {\myfileversion}
  {Mathematical matrices with PGF/TikZ}
%    \end{macrocode}
% 
%
% \medskip
% The version of 2020/02/08 of \pkg{expl3} has replaced |\l_keys_key_tl| by
% |\l_keys_key_str|. We have immediately changed in this file. Now, you test the
% existence of |\l_keys_key_str| in order to detect whether the version of LaTeX
% used by the final user is up to date.
%    \begin{macrocode}
\msg_new:nnn { nicematrix } { expl3~too~old }
  {
    Your~version~of~LaTeX~(especially~expl3)~is~too~old.~
    You~can~go~on~but~you~will~probably~have~other~errors~
    if~you~use~the~functionalities~of~nicematrix.
  }
\cs_if_exist:NF \l_keys_key_str
  { \msg_error:nn { nicematrix } { expl3~too~old } }
%    \end{macrocode}
%
%
% \bigskip
% We test the class option |draft|. In this case, we raise the flag
% |\c_@@_draft_bool| because we won't draw the dotted lines if the option
% |draft| is used.
%    \begin{macrocode}
\bool_new:N \c_@@_draft_bool
\DeclareOption { draft } { \bool_set_true:N \c_@@_draft_bool }
\DeclareOption* { }
\ProcessOptions \relax
%    \end{macrocode}
%
%
% 
% The command for the treatment of the options of |\usepackage| is at the end of
% this package for technical reasons. 
% 
% \bigskip
% We load some packages.
%    \begin{macrocode}
\RequirePackage { array }
\RequirePackage { amsmath }
\RequirePackage { xparse }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_error:n { \msg_error:nn { nicematrix } }
\cs_new_protected:Npn \@@_error:nn { \msg_error:nnn { nicematrix } }
\cs_new_protected:Npn \@@_error:nnn { \msg_error:nnnn { nicematrix } }
\cs_new_protected:Npn \@@_fatal:n { \msg_fatal:nn { nicematrix } }
\cs_new_protected:Npn \@@_fatal:nn { \msg_fatal:nnn { nicematrix } }
\cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { nicematrix } }
\cs_new_protected:Npn \@@_msg_new:nnn { \msg_new:nnnn { nicematrix } }
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_msg_redirect_name:nn 
  { \msg_redirect_name:nnn { nicematrix } }
%    \end{macrocode}
%
%
% \bigskip
% \subsection*{Technical  definitions}
%
%    \begin{macrocode}
\bool_new:N \c_@@_tikz_loaded_bool
\AtBeginDocument
  {
    \@ifpackageloaded { tikz }
      { 
%    \end{macrocode}
% In some constructions, we will have to use a |{pgfpicture}| which \emph{must}
% be replaced by a |{tikzpicture}| if Tikz is loaded. However, this switch
% between |{pgfpicture}| and |{tikzpicture}| can't be done dynamically with a
% conditional because, when the Tikz library |external| is loaded by the user,
% the pair |\tikzpicture|-|\endtikpicture| (or
% |\begin{tikzpicture}-\end{tikzpicture}| must be statically ``visible'' (even
% when extenalization is not activated).
%
% That's why we create |\c_@@_pgfortikzpicture_tl| and
% |\c_@@_endpgfortikzpicture_tl| which will be used to construct in a
% |\AtBeginDocument| the correct version of some commands.
%    \begin{macrocode}
        \bool_set_true:N \c_@@_tikz_loaded_bool 
        \tl_const:Nn \c_@@_pgfortikzpicture_tl { \exp_not:N \tikzpicture }
        \tl_const:Nn \c_@@_endpgfortikzpicture_tl { \exp_not:N \endtikzpicture }
      }
      { 
        \tl_const:Nn \c_@@_pgfortikzpicture_tl { \exp_not:N \pgfpicture }
        \tl_const:Nn \c_@@_endpgfortikzpicture_tl { \exp_not:N \endpgfpicture }
      }
  }
%    \end{macrocode}
% 
% We test whether the current class is \cls{revtex4-1} or \cls{revtex4-2}
% because these classes redefines |\array| (of \pkg{array}) in a way
% incompatible with our programmation.
%    \begin{macrocode}
\bool_new:N \c_@@_revtex_bool
\@ifclassloaded { revtex4-1 }
  { \bool_set_true:N \c_@@_revtex_bool }
  { }
\@ifclassloaded { revtex4-2 }
  { \bool_set_true:N \c_@@_revtex_bool }
  { }
%    \end{macrocode}
%
% 
% The following message must be defined right now because it may be used during
% the loading of the package.
%    \begin{macrocode}
\@@_msg_new:nn { Draft~mode }
  { The~compilation~is~in~draft~mode:~the~dotted~lines~won't~be~drawn. }
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_if:NT \c_@@_draft_bool { \msg_warning:nn { nicematrix }  { Draft~mode } }
%    \end{macrocode}
% 
%
% \bigskip
% We define a command |\iddots| similar to |\ddots| ($\ddots$) but with dots
% going forward ($\iddots$). We use |\ProvideDocumentCommand| of \pkg{xparse},
% and so, if the command |\iddots| has already been defined (for example by the
% package \pkg{mathdots}), we don't define it again. 
% 
%    \begin{macrocode}
\ProvideDocumentCommand \iddots { }
  { 
    \mathinner
      { 
        \tex_mkern:D 1 mu 
        \box_move_up:nn { 1 pt } { \hbox:n { . } }
        \tex_mkern:D 2 mu
        \box_move_up:nn { 4 pt } { \hbox:n { . } }
        \tex_mkern:D 2 mu
        \box_move_up:nn { 7 pt } 
          { \vbox:n { \kern 7 pt \hbox:n { . } } } 
        \tex_mkern:D 1 mu 
      } 
  }
%    \end{macrocode}
%
% This definition is a variant of the standard definition of |\ddots|.
%
%
% \bigskip 
% The following counter will count the environments |{NiceArray}|. The value of
% this counter will be used to prefix the names of the Tikz nodes created in the
% array. 
%    \begin{macrocode}
\int_new:N \g_@@_env_int
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_new:Npn \@@_env: { nm - \int_use:N \g_@@_env_int } 
\cs_new_protected:Npn \@@_qpoint: #1 
  { \pgfpointanchor { \@@_env: - #1 } { center } } 
%    \end{macrocode}
% 
% \bigskip
% We also define a counter to count the environments |{NiceMatrixBlock}|.
%    \begin{macrocode}
\int_new:N \g_@@_NiceMatrixBlock_int
%    \end{macrocode}
%
% \bigskip
% The dimension |\l_@@_columns_width_dim| will be used when the options specify
% that all the columns must have the same width (but, if the key |columns-width|
% is used with the special value |auto|, the boolean
% |l_@@_auto_columns_width_bool| also will be raised).
%    \begin{macrocode}
\dim_new:N \l_@@_columns_width_dim
%    \end{macrocode}
%
% \bigskip
% The sequence |\g_@@_names_seq| will be the list of all the names of
% environments used (via the option |name|) in the document: two environments
% must not have the same name. However, it's possible to use the option
% |allow-duplicate-names|.
%    \begin{macrocode}
\seq_new:N \g_@@_names_seq
%    \end{macrocode}
%

% \bigskip
% We want to know if we are in an environment of \pkg{nicematrix} because we
% will raise an error if the user tries to use nested environments.
%    \begin{macrocode}
\bool_new:N \l_@@_in_env_bool
%    \end{macrocode}
% 
%
% \bigskip
% If the user uses |{NiceArray}| (and not another environment relying upon
% |{NiceArrayWithDelims}| like |{pNiceArray}|), we will raise the flag
% |\l_@@_NiceArray_bool|. We have to know that, because, in |{NiceArray}|, we
% won't use a structure with |\left| and |\right| and we will use the option of
% position (|t|, |b| or |c|). 
%    \begin{macrocode}
\bool_new:N \l_@@_NiceArray_bool
%    \end{macrocode}
% 
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_math_mode:
  { 
    \if_mode_math: \else:
      \@@_fatal:n { Outside~math~mode } 
    \fi:
  }
%    \end{macrocode}
%
% 
% 
% \bigskip
% We have to know whether \pkg{colortbl} is loaded for the redefinition of
% |\everycr| and |\vline| and for the options |hlines| and |vlines|.
%    \begin{macrocode}
\bool_new:N \c_@@_colortbl_loaded_bool 
\AtBeginDocument 
  { 
    \@ifpackageloaded { colortbl }
      { 
        \bool_set_true:N \c_@@_colortbl_loaded_bool 
        \cs_set_protected:Npn \@@_vline_i: { { \CT@arc@ \vline } }
      }
      { } 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\colorlet { nicematrix-last-col } { . }
\colorlet { nicematrix-last-row } { . }
%    \end{macrocode}
% 
% \bigskip
% The length |\l_@@_inter_dots_dim| is the distance between two dots for the
% dotted lines. The default value is 0.45~em but it will be changed if the
% option |small| is used.
%    \begin{macrocode}
\dim_new:N \l_@@_inter_dots_dim
\dim_set:Nn \l_@@_inter_dots_dim { 0.45 em }
%    \end{macrocode}
%
% \bigskip
% The length |\l_@@_xdots_shorten_dim| is the minimal distance between a
% node (in fact an anchor of that node) and a dotted line (we say ``minimal''
% because, by definition, a dotted line is not a continuous line and, therefore,
% this distance may vary a little).
%    \begin{macrocode}
\dim_new:N \l_@@_xdots_shorten_dim
\dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em }
%    \end{macrocode}
% 
% \bigskip
% The length |\l_@@_radius_dim| is the radius of the dots for the dotted lines
% (for |\hdottedline| and |\dottedline| and for all the other dotted lines when
% |line-style| is equal to |standard|, which is the initial value). The initial
% value is 0.53~pt but it will be changed if the option |small| is used (to
% 0.37~pt).
%    \begin{macrocode}
\dim_new:N \l_@@_radius_dim
\dim_set:Nn \l_@@_radius_dim { 0.53 pt }
%    \end{macrocode}
%
% \bigskip
% The name of the current environment or the current command (despite the name
% which contains \textsl{env}).
%    \begin{macrocode}
\str_new:N \g_@@_name_env_str
%    \end{macrocode}
% 
% The string |\g_@@_com_or_env_str| will contain the word \emph{command} or
% \emph{environment} whether we are in a command of \pkg{nicematrix} or a an
% environment of \pkg{nicematrix}. The default value is \emph{environment}.
%    \begin{macrocode}
\str_new:N \g_@@_com_or_env_str
\str_set:Nn \g_@@_com_or_env_str { environment }
%    \end{macrocode}
% 
% The following control sequence will be able to reconstruct the full name of
% the current command or environment (despite the name which contains
% \textsl{env}). This command must \emph{not} be protected since it's used in
% error messages.
%    \begin{macrocode}
\cs_new:Npn \@@_full_name_env:
  { 
    \str_if_eq:VnTF \g_@@_com_or_env_str { command }
      { command \space \c_backslash_str \g_@@_name_env_str }
      { environment \space \{ \g_@@_name_env_str \} }
  }
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\tl_new:N \g_@@_internal_code_after_tl
\tl_new:N \g_@@_code_after_tl
%    \end{macrocode}
% 
%
% \bigskip
% The counters |\l_@@_save_iRow_int| and |\l_@@_save_jCol_int| will be used to
% save the values of the eventual LaTeX counters |iRow| and |jCol|. These LaTeX
% counters will be restored at the end of the environment.
%    \begin{macrocode}
\int_new:N \l_@@_save_iRow_int
\int_new:N \l_@@_save_jCol_int
%    \end{macrocode}
%
% The TeX counters |\c@iRow| and |\c@jCol| will be created in the beginning of
% |{NiceArrayWithDelims}| (if they don't exist previously).
% 
%    \begin{macrocode}
\bool_new:N \g_@@_row_of_col_done_bool
%    \end{macrocode}
% 
%    \begin{macrocode}
\tl_new:N \l_@@_initial_suffix_tl 
\tl_new:N \l_@@_initial_anchor_tl 
\tl_new:N \l_@@_final_suffix_tl 
\tl_new:N \l_@@_final_anchor_tl 
%    \end{macrocode}
% 
%    \begin{macrocode}
\dim_new:N \l_@@_x_initial_dim
\dim_new:N \l_@@_y_initial_dim
\dim_new:N \l_@@_x_final_dim
\dim_new:N \l_@@_y_final_dim
%    \end{macrocode}
% 
%    \begin{macrocode}
\dim_new:N \l_tmpc_dim
\dim_new:N \l_tmpd_dim
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_new:N \g_@@_empty_cell_bool
%    \end{macrocode}
% 
% \medskip
% The token list |\l_@@_xdots_line_style_tl| corresponds to the option |tikz| of the
% commands |\Cdots|, |\Ldots|, etc. and of the options |line-style| for the
% environments and |\NiceMatrixOptions|. The constant |\c_@@_standard_tl| will
% be used in some tests.
%    \begin{macrocode}
\tl_new:N \l_@@_xdots_line_style_tl
\tl_const:Nn \c_@@_standard_tl { standard }
\tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl
%    \end{macrocode}
% 
% \bigskip
% \textbf{Variables for the exterior rows and columns}\par\nobreak
%
% \medskip
% The keys for the exterior rows and columns are |first-row|, |first-col|,
% |last-row| and |last-col|. However, internally, these keys are not coded in a
% similar way. 
%
% \bigskip
% \begin{itemize} 
% \item \textbf{First row}\par\nobreak
% The integer |\l_@@_first_row_int| is the number of the first row of the
% array. The default value is $1$, but, if the option |first-row| is used,
% the value will be~$0$. As usual, the global version is for the passage in the
% |\group_insert_after:N|. 
%    \begin{macrocode}
\int_new:N \l_@@_first_row_int
\int_set:Nn \l_@@_first_row_int 1
%    \end{macrocode}
%
% \medskip
% \item \textbf{First column}\par\nobreak
% The integer |\l_@@_first_col_int| is the number of the first column of the
% array. The default value is $1$, but, if the option |first-col| is used, 
% the value will be~$0$. 
%    \begin{macrocode}
\int_new:N \l_@@_first_col_int
\int_set:Nn \l_@@_first_col_int 1
%    \end{macrocode}
% 
% \medskip
% \item \textbf{Last row}\par\nobreak
% The counter |\l_@@_last_row_int| is the number of the eventual ``last row'',
% as specified by the key |last-row|. A value of $-2$ means that there is no
% ``last row''. A value of $-1$ means that there is a ``last row'' but we don't
% know the number of that row (the key |last-row| has been used without value
% and the actual value has not still been read in the |aux| file).
%    \begin{macrocode}
\int_new:N \l_@@_last_row_int 
\int_set:Nn \l_@@_last_row_int { -2 }
%    \end{macrocode}
%
% \smallskip
% If, in an environment like |{pNiceArray}|, the option |last-row| is used
% without value, we will globally raise the following flag. It will be used to
% know if we have, after the construction of the array, to write in the |aux|
% file the number of the ``last row''.\footnote{We can't use
% |\l_@@_last_row_int| for this usage because, if \pkg{nicematrix} has read its
% value from the |aux| file, the value of the counter won't be $-1$ any longer.}
%    \begin{macrocode}
\bool_new:N \l_@@_last_row_without_value_bool
%    \end{macrocode}
%
% \smallskip
% Idem for |\l_@@_last_col_without_value_bool|
%    \begin{macrocode}
\bool_new:N \l_@@_last_col_without_value_bool
%    \end{macrocode}
% 
% \medskip
% \item \textbf{Last column}\par\nobreak
%
% For the eventual ``last column'', we use an integer. A value of $-2$ means
% that there is no last column. A value of $-1$ means that there is a last
% column but we don't know its value because the user has used the option
% |last-col| without value (it's possible in an environment without preamble
% like |{pNiceMatrix}|). A value of $0$ means that the option |last-col| has
% been used in an environment with preamble (like |{pNiceArray}|).
%    \begin{macrocode}
\int_new:N \l_@@_last_col_int
\int_set:Nn \l_@@_last_col_int { -2 }
%    \end{macrocode}
%
% However, we have also a boolean. Consider the following code: 
% \begin{center}
% \begin{BVerbatim}
% \begin{pNiceArray}{CC}[last-col]
% 1 & 2 \\
% 3 & 4
% \end{pNiceArray}
% \end{BVerbatim}
% \end{center}
% In such a code, the ``last column'' specified by the key |last-col| is not
% used. We want to be able to detect such a situation and we create a boolean
% for that job.
%    \begin{macrocode}
\bool_new:N \g_@@_last_col_found_bool
%    \end{macrocode}
% This boolean is set to |false| at the end of |\@@_pre_array:|.
% \end{itemize}
%       
% \bigskip
% \textbf{The column S of siunitx}\par\nobreak
%
% \medskip
% We want to know whether the package \pkg{siunitx} is loaded and, if it is
% loaded, we redefine the |S| columns of \pkg{siunitx}.
%    \begin{macrocode}
\bool_new:N \c_@@_siunitx_loaded_bool 
\AtBeginDocument 
  { 
    \@ifpackageloaded { siunitx }
      { \bool_set_true:N \c_@@_siunitx_loaded_bool }
      { } 
  }
%    \end{macrocode}
% 
% \medskip
% The command |\NC@rewrite@S| is a LaTeX command created by \pkg{siunitx} in
% connection with the |S| column. In the code of \pkg{siunitx}, this command is
% defined by:
% \begin{Verbatim}[commandchars=\~\!\+, formatcom = \small]
% \renewcommand*{\NC@rewrite@S}[1][]
%   {
%     \@temptokena \exp_after:wN
%       {
%         \tex_the:D \@temptokena
%         > { \__siunitx_table_collect_begin: S {#1} }
%         c
%         < { \__siunitx_table_print: }
%       }
%     \NC@find
%   } 
% \end{Verbatim}
% We want to patch this command (in the environments of \pkg{nicematrix}) in
% order to have:
% \begin{Verbatim}[commandchars=\~\!\+, formatcom = \small]
% \renewcommand*{\NC@rewrite@S}[1][]
%   {
%     \@temptokena \exp_after:wN
%       {
%         \tex_the:D \@temptokena
%         > { ~emphase!\@@_Cell:+ \__siunitx_table_collect_begin: S {#1} }
%         c
%         < { \__siunitx_table_print: ~emphase!\@@_end_Cell:+ }
%       }
%     \NC@find
%   } 
% \end{Verbatim}
% However, we don't want do use explicitly any private command of \pkg{siunitx}.
% That's why we will extract the name of the two |\__siunitx...| commands by
% their position in the code of |\NC@rewrite@S|. 
%
% Since the command |\NC@rewrite@S| appends some tokens to the \emph{toks} list
% |\@temptokena|, we use the LaTeX command |\NC@rewrite@S| in a group
% (|\group_begin:|--|\group_end:|) and we extract the two command names which
% are in the toks |\@temptokena|. However, this extraction can be done only
% when \pkg{siunitx} is loaded (and it may be loaded after \pkg{nicematrix})
% and, in fact, after the beginning of the document --- because some
% instructions of \pkg{siunitx} are executed in a |\AtBeginDocument|). That's
% why this extraction will be done only at the first use of an
% environment of \pkg{nicematrix} with the command |\@@_adapt_S_column:|. 
%    \begin{macrocode}
\cs_set_protected:Npn \@@_adapt_S_column:
  {
    \bool_if:NT \c_@@_siunitx_loaded_bool
      { 
        \group_begin:
        \@temptokena = { }
%    \end{macrocode}
% We protect |\NC@find| which is at the end of |\NC@rewrite@S|.
%    \begin{macrocode}
        \cs_set_eq:NN \NC@find \prg_do_nothing:
        \NC@rewrite@S { }
%    \end{macrocode}
% Conversion of the \emph{toks} |\@temptokena| in a token list of \pkg{expl3}
% (the toks are not supported by \pkg{expl3} but we can, nevertheless, use the
% option |V| for |\tl_gset:NV|).
%    \begin{macrocode}
        \tl_gset:NV \g_tmpa_tl \@temptokena 
        \group_end:
        \tl_new:N \c_@@_table_collect_begin_tl
        \tl_set:Nx \l_tmpa_tl { \tl_item:Nn \g_tmpa_tl 2 }
        \tl_gset:Nx \c_@@_table_collect_begin_tl { \tl_item:Nn \l_tmpa_tl 1 }
        \tl_new:N \c_@@_table_print_tl
        \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } }
%    \end{macrocode}
% The token lists |\c_@@_table_collect_begin_tl| and |\c_@@_table_print_tl|
% contain now the two commands of \pkg{siunitx}.
% 
% \smallskip
% If the adaptation has been done, the command |\@@_adapt_S_column:| becomes
% no-op (globally). 
%    \begin{macrocode}
        \cs_gset_eq:NN \@@_adapt_S_column: \prg_do_nothing:
      }
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_renew_NC@rewrite@S:| will be used in each environment of
% \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment
% (only if the boolean |\c_@@_siunitx_loaded_bool| is raised, of course).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_renew_NC@rewrite@S:
  {
    \renewcommand*{\NC@rewrite@S}[1][]
      {
        \@temptokena \exp_after:wN
          {
            \tex_the:D \@temptokena
            > { \@@_Cell: \c_@@_table_collect_begin_tl S {##1} }
            c
            < { \c_@@_table_print_tl \@@_end_Cell: }
          }
        \NC@find
      }
  }
%    \end{macrocode}
% 
% \bigskip
% The following command is only for efficiency. It must \emph{not} be protected
% because it will be used (for instance) in names of \textsc{pgf} nodes.
%    \begin{macrocode}
\cs_new:Npn \@@_succ:n #1 { \the \numexpr #1 + 1 \relax }
\cs_new:Npn \@@_pred:n #1 { \the \numexpr #1 - 1 \relax }
%    \end{macrocode}
% 
% \subsection*{Command for creation of rectangle nodes}
%
% 
% The following command should be used in a |{pgfpicture}|. It creates an
% rectangular (empty but with a name) when the four corners are given.
% 
% |#1| is the name of the node which will be created;
% |#2| and |#3| are the coordinates of one of the corner of the rectangle;
% |#4| and |#5| are the coordinates of the opposite corner.
%   \begin{macrocode}
\cs_new_protected:Npn \@@_pgf_rect_node:nnnnn #1 #2 #3 #4 #5
  {
    \begin { pgfscope }
    \pgfset
      {
        outer~sep = \c_zero_dim ,
        inner~sep = \c_zero_dim ,
        minimum~size = \c_zero_dim 
      }
    \pgftransformshift { \pgfpoint { 0.5 * ( #2 + #4 ) } { 0.5 * ( #3 + #5 ) } } 
    \pgfnode
      { rectangle }
      { center }
      { 
        \vbox_to_ht:nn 
          { \dim_abs:n { #5 - #3 } }
          { 
            \vfill
            \hbox_to_wd:nn { \dim_abs:n { #4 - #2 } } { }
          }   
      }
      { #1 }
      { }
    \end { pgfscope }
  } 
%    \end{macrocode}
%
% \medskip
% The command |\@@_pgf_rect_node:nnn| is a variant of |\@@_pgr_rect_node:nnnn|:
% it takes two \textsc{pgf} points as arguments instead of the four dimensions
% which are the coordinates.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_pgf_rect_node:nnn #1 #2 #3
  {
    \begin { pgfscope }
    \pgfset
      {
        outer~sep = \c_zero_dim ,
        inner~sep = \c_zero_dim ,
        minimum~size = \c_zero_dim 
      }
    \pgftransformshift { \pgfpointscale { 0.5 } { \pgfpointadd { #2 } { #3 } } } 
    \pgfpointdiff { #3 } { #2 }
    \pgfgetlastxy \l_tmpa_dim \l_tmpb_dim 
    \pgfnode
      { rectangle }
      { center }
      { 
        \vbox_to_ht:nn 
          { \dim_abs:n \l_tmpb_dim }
          { \vfill \hbox_to_wd:nn { \dim_abs:n \l_tmpa_dim } { } } 
      }
      { #1 }
      { }
    \end { pgfscope }
  }
%    \end{macrocode}
%
%
% \bigskip 
% \subsection*{The options}
% 
% The boolean |\l_@@_light_syntax_bool| corresponds to the option |light-syntax|.
%    \begin{macrocode}
\bool_new:N \l_@@_light_syntax_bool
%    \end{macrocode}
% 
% \bigskip
% The token list |\l_@@_baseline_str| may contain one of the three values |t|,
% |c| or |b| as in the option of the environment |{array}|. However, it may also
% contain an integer (which represents the number of the row to which align the
% array). 
%    \begin{macrocode}
\str_new:N \l_@@_baseline_str 
\str_set:Nn \l_@@_baseline_str c
%    \end{macrocode}
% 
% \bigskip
% The flag |\l_@@_exterior_arraycolsep_bool| corresponds to the option
% |exterior-arraycolsep|. If this option is set, a space equal to |\arraycolsep|
% will be put on both sides of an environment |{NiceArray}| (as it is done in
% |{array}| of \pkg{array}).
%    \begin{macrocode}
\bool_new:N \l_@@_exterior_arraycolsep_bool
%    \end{macrocode}
%
% \bigskip
% The flag |\l_@@_parallelize_diags_bool| controls whether the diagonals are
% parallelized. The initial value is~|true|.
%    \begin{macrocode}
\bool_new:N \l_@@_parallelize_diags_bool
\bool_set_true:N \l_@@_parallelize_diags_bool
%    \end{macrocode}
%
% \bigskip
% The flag |\l_@@_hlines_bool| corresponds to the option |\hlines| and the flag
% |\l_@@_vlines_bool| to the option |\vlines|.
%    \begin{macrocode}
\bool_new:N \l_@@_hlines_bool
\bool_new:N \l_@@_vlines_bool
%    \end{macrocode}
% 
% \bigskip
% The flag |\l_@@_nullify_dots_bool| corresponds to the option |nullify-dots|.
% When the flag is down, the instructions like |\vdots| are inserted within a
% |\hphantom| (and so the constructed matrix has exactly the same size as a
% matrix constructed with the classical |{matrix}| and |\ldots|, |\vdots|,
% etc.). 
%    \begin{macrocode}
\bool_new:N \l_@@_nullify_dots_bool
%    \end{macrocode}
%
%
% \bigskip
% The following flag will be used when the current options specify that all the
% columns of the array must have the same width equal to the largest width of a
% cell of the array (except the cells of the potential exterior columns).
%    \begin{macrocode}
\bool_new:N \l_@@_auto_columns_width_bool
%    \end{macrocode}
% 
% 
% \bigskip
% The token list |\l_@@_name_str| will contain the optional name of the
% environment: this name can be used to access to the Tikz nodes created in the
% array from outside the environment.  
%    \begin{macrocode}
\str_new:N \l_@@_name_str
%    \end{macrocode}
%
% \bigskip
% The boolean |\l_@@_medium_nodes_bool| will be used to indicate whether the
% ``medium nodes'' are created in the array. Idem for the ``large nodes''.
%    \begin{macrocode}
\bool_new:N \l_@@_medium_nodes_bool
\bool_new:N \l_@@_large_nodes_bool
%    \end{macrocode}
%
% \bigskip
% The dimension |\l_@@_left_margin_dim| correspond to the option |left-margin|.
% Idem for the right margin. These parameters are involved in the creation of
% the ``medium nodes'' but also in the placement of the delimiters and the
% drawing of the horizontal dotted lines (|\hdottedline|).
%    \begin{macrocode}
\dim_new:N \l_@@_left_margin_dim
\dim_new:N \l_@@_right_margin_dim
%    \end{macrocode}
%
% \bigskip
% The following dimensions will be used internally to compute the width of the
% potential ``first column'' and ``last column''.
%    \begin{macrocode}
\dim_new:N \g_@@_width_last_col_dim
\dim_new:N \g_@@_width_first_col_dim
%    \end{macrocode}
%                              
% \bigskip
% The dimensions |\l_@@_extra_left_margin_dim| and
% |\l_@@_extra_right_margin_dim| correspond to the options |extra-left-margin|
% and |extra-right-margin|.  
%    \begin{macrocode}
\dim_new:N \l_@@_extra_left_margin_dim
\dim_new:N \l_@@_extra_right_margin_dim
%    \end{macrocode}
% 
% \medskip
% The token list |\l_@@_end_of_row_tl| corresponds to the option |end-of-row|.
% It specifies the symbol used to mark the ends of rows when the light syntax is
% used. 
%    \begin{macrocode}
\tl_new:N \l_@@_end_of_row_tl
\tl_set:Nn \l_@@_end_of_row_tl { ; }
%    \end{macrocode}
%
% \medskip
% The following parameter is for the color the dotted lines drawn by |\Cdots|,
% |\Ldots|, |\Vdots|, |\Ddots|, |\Iddots| and |\Hdotsfor| but \emph{not} the
% dotted lines drawn by |\hdottedline| and ``|:|''.
%    \begin{macrocode} 
\tl_new:N \l_@@_xdots_color_tl
%    \end{macrocode}
% 
% \medskip
% Sometimes, we want to have several arrays vertically juxtaposed in order to
% have an alignment of the columns of these arrays. To acheive this goal, one
% may wish to use the same width for all the columns (for example with the
% option |columns-width| or the option |auto-columns-width| of the environment
% |{NiceMatrixBlock}|). However, even if we use the same type of delimiters, the
% width of the delimiters may be different from an array to another because the
% width of the delimiter is fonction of its size. That's why we create an option
% called |max-delimiter-width| which will give to the delimiters the width of
% a delimiter (of the same type) of big size. The following boolean corresponds
% to this option.
%    \begin{macrocode}
\bool_new:N \l_@@_max_delimiter_width_bool
%    \end{macrocode}
% 
% \bigskip
% First, we define a set of keys ``|NiceMatrix / Global|'' which will be used
% (with the mechanism of |.inherit:n|) by other sets of keys.
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / xdots }
  {
    line-style .code:n = 
     { 
       \bool_lazy_or:nnTF 
%    \end{macrocode}
% We can't use |\c_@@_tikz_loaded_bool| to test whether \pkg{tikz} is loaded
% because |\NiceMatrixOptions| may be used in the preamble of the document.
%    \begin{macrocode}
        { \cs_if_exist_p:N \tikzpicture }
        { \str_if_eq_p:nn { #1 } { standard } }
        { \tl_set:Nn \l_@@_xdots_line_style_tl { #1 } } 
        { \@@_error:n { bad~option~for~line-style } } 
     } ,
    line-style .value_required:n = true ,
    color .tl_set:N = \l_@@_xdots_color_tl ,
    color .value_required:n = true ,
    shorten .dim_set:N = \l_@@_xdots_shorten_dim ,
    shorten .value_required:n = true ,
%    \end{macrocode}
% The options |down| and |up| are not documented for the final user because he
% should use the syntax with |^| and |_|.
%    \begin{macrocode}
    down .tl_set:N = \l_@@_xdots_down_tl ,
    up .tl_set:N = \l_@@_xdots_up_tl ,
    unknown .code:n = \@@_error:n { Unknown~option~for~xdots } 
  }
%    \end{macrocode}
%
% 
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / Global }
  {
    xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , 
    max-delimiter-width .bool_set:N = \l_@@_max_delimiter_width_bool ,
    light-syntax .bool_set:N = \l_@@_light_syntax_bool ,
    light-syntax .default:n = true , 
    end-of-row .tl_set:N = \l_@@_end_of_row_tl ,
    end-of-row .value_required:n = true ,
    code-for-first-col .tl_set:N = \l_@@_code_for_first_col_tl ,
    code-for-first-col .value_required:n = true ,
    code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl ,
    code-for-last-col .value_required:n = true ,
    code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl ,
    code-for-first-row .value_required:n = true ,
    code-for-last-row .tl_set:N = \l_@@_code_for_last_row_tl ,
    code-for-last-row .value_required:n = true ,
    small .bool_set:N = \l_@@_small_bool ,
    hlines .bool_set:N = \l_@@_hlines_bool ,
    vlines .bool_set:N = \l_@@_vlines_bool ,
    hvlines .meta:n = { hlines , vlines } , 
    parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
%    \end{macrocode}
%
% \bigskip
% With the option |renew-dots|, the command |\cdots|, |\ldots|, |\vdots| and
% |\ddots| are redefined and behave like the commands |\Cdots|, |\Ldots|,
% |\Vdots| and |\Ddots|. 
%    \begin{macrocode}
    renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
    renew-dots .value_forbidden:n = true ,
    nullify-dots .bool_set:N = \l_@@_nullify_dots_bool ,
%    \end{macrocode}
%
% \bigskip
% In some circonstancies, the ``medium nodes'' are created automatically, for
% example when a dotted line has an ``open'' extremity (idem for the ``large nodes'').
%    \begin{macrocode}
    create-medium-nodes .bool_set:N = \l_@@_medium_nodes_bool ,
    create-large-nodes .bool_set:N = \l_@@_large_nodes_bool ,
    create-extra-nodes .meta:n = 
      { create-medium-nodes , create-large-nodes } ,
    left-margin .dim_set:N = \l_@@_left_margin_dim ,
    left-margin .default:n = \arraycolsep ,
    right-margin .dim_set:N = \l_@@_right_margin_dim ,
    right-margin .default:n = \arraycolsep ,
    margin .meta:n = { left-margin = #1 , right-margin = #1 } ,
    margin .default:n = \arraycolsep ,
    extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim ,
    extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim ,
    extra-margin .meta:n = 
      { extra-left-margin = #1 , extra-right-margin = #1 } ,
    extra-margin .value_required:n = true 
  }
%    \end{macrocode}
%
% \bigskip
% We define a set of keys used by the environments of \pkg{nicematrix} (but not
% by the command |\NiceMatrixOptions|). 
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / Env }
  {
%    \end{macrocode}
% \bigskip
% The options |c|, |t| and |b| of the environment |{NiceArray}| have the same
% meaning as the option of the classical environment |{array}|.
%    \begin{macrocode}
    c .code:n = \str_set:Nn \l_@@_baseline_str c ,
    t .code:n = \str_set:Nn \l_@@_baseline_str t ,
    b .code:n = \str_set:Nn \l_@@_baseline_str b ,
    baseline .tl_set:N = \l_@@_baseline_str ,
    baseline .value_required:n = true ,
    columns-width .code:n = 
      \str_if_eq:nnTF { #1 } { auto }
        { \bool_set_true:N \l_@@_auto_columns_width_bool }
        { \dim_set:Nn \l_@@_columns_width_dim { #1 } } , 
    columns-width .value_required:n = true ,
    name .code:n = 
%    \end{macrocode}
% We test whether we are in the measuring phase of an environment of
% \pkg{amsmath} (always loaded by \pkg{nicematrix}) because we want to avoid a
% fallacious message of duplicate name in this case.
%    \begin{macrocode}
      \legacy_if:nF { measuring@ }
        {
          \str_set:Nn \l_tmpa_str { #1 }
          \seq_if_in:NVTF \g_@@_names_seq \l_tmpa_str
            { \@@_error:nn { Duplicate~name } { #1 } }
            { \seq_gput_left:NV \g_@@_names_seq \l_tmpa_str }
          \str_set_eq:NN \l_@@_name_str \l_tmpa_str 
        } ,
    name .value_required:n = true ,
    code-after .tl_gset:N = \g_@@_code_after_tl ,
    code-after .value_required:n = true ,
    first-col .code:n = \int_zero:N \l_@@_first_col_int , 
    first-row .code:n = \int_zero:N \l_@@_first_row_int ,
    last-row .int_set:N = \l_@@_last_row_int ,
    last-row .default:n = -1 ,
  }
%    \end{macrocode}
%
%
% \bigskip
% We begin the construction of the major sets of keys (used by the different
% user commands and environments). 
%    \begin{macrocode}
\keys_define:nn { NiceMatrix }
  { 
    NiceMatrixOptions .inherit:n = 
      { 
        NiceMatrix / Global ,
      } ,
    NiceMatrixOptions / xdots .inherit:n = NiceMatrix / xdots ,
    NiceMatrix .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env ,
      } ,
    NiceMatrix / xdots .inherit:n = NiceMatrix / xdots ,
    NiceArray .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env ,
      } ,
    NiceArray / xdots .inherit:n = NiceMatrix / xdots ,
    pNiceArray .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env ,
      } ,
    pNiceArray / xdots .inherit:n = NiceMatrix / xdots 
  }
%    \end{macrocode}
% 
%
% \bigskip
% We finalise the definition of the set of keys 
% ``|NiceMatrix / NiceMatrixOptions|'' with the options specific to
% |\NiceMatrixOptions|.    
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrixOptions }
  { 
%    \end{macrocode}
%                              
% With the option |renew-matrix|, the environment |{matrix}| of \pkg{amsmath}
% and its variants are redefined to behave like the environment |{NiceMatrix}|
% and its variants. 
%    \begin{macrocode}
    renew-matrix .code:n = \@@_renew_matrix: ,
    renew-matrix .value_forbidden:n = true ,
    transparent .meta:n = { renew-dots , renew-matrix } ,
    transparent .value_forbidden:n = true,
%    \end{macrocode}
%                              
%
% \bigskip
% The option |exterior-arraycolsep| will have effect only in |{NiceArray}| for
% those who want to have for |{NiceArray}| the same behaviour as |{array}|.
%    \begin{macrocode}
    exterior-arraycolsep .bool_set:N = \l_@@_exterior_arraycolsep_bool ,
%    \end{macrocode}
%
% \bigskip
% If the option |columns-width| is used, all the columns will have the same
% width.  
%
% In |\NiceMatrixOptions|, the special value |auto| is not available.
%    \begin{macrocode}
    columns-width .code:n = 
      \str_if_eq:nnTF { #1 } { auto }
        { \@@_error:n { Option~auto~for~columns-width } }
        { \dim_set:Nn \l_@@_columns_width_dim { #1 } } ,
%    \end{macrocode}
%
% \bigskip
% Usually, an error is raised when the user tries to give the same to name two
% distincts environments of \pkg{nicematrix} (theses names are global and not
% local to the current TeX scope). However, the option |allow-duplicate-names|
% disables this feature. 
%    \begin{macrocode}
    allow-duplicate-names .code:n = 
      \@@_msg_redirect_name:nn { Duplicate~name } { none } ,
    allow-duplicate-names .value_forbidden:n = true ,
%    \end{macrocode}
%
% \bigskip
% By default, the specifier used in the preamble of the array (for example in
% |{pNiceArray}|) to draw a vertical dotted line between two columns is the
% colon ``|:|''. However, it's possible to change this letter with
% |letter-for-dotted-lines| and, by the way, the letter ``|:|'' will remain free
% for other packages (for example \pkg{arydshln}).
%    \begin{macrocode}
    letter-for-dotted-lines .code:n = 
      {
        \int_compare:nTF { \tl_count:n { #1 } = 1 }
          { \str_set:Nx \l_@@_letter_for_dotted_lines_str { #1 } }
          { \@@_error:n { Bad~value~for~letter~for~dotted~lines } } 
      } ,
    letter-for-dotted-lines .value_required:n = true ,
    unknown .code:n  = \@@_error:n { Unknown~key~for~NiceMatrixOptions } 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\str_new:N \l_@@_letter_for_dotted_lines_str
\str_set_eq:NN \l_@@_letter_for_dotted_lines_str \c_colon_str
%    \end{macrocode}
%       
% \bigskip
% |\NiceMatrixOptions| is the command of the \pkg{nicematrix} package to fix
% options at the document level. The scope of these specifications is the
% current TeX group. 
%    \begin{macrocode}
\NewDocumentCommand \NiceMatrixOptions { m }
  { \keys_set:nn { NiceMatrix / NiceMatrixOptions } { #1 } }
%    \end{macrocode}
%
%
% \bigskip
% We finalise the definition of the set of keys 
% ``|NiceMatrix / NiceMatrix|'' with the options specific to |{NiceMatrix}|.
%
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrix }
  { 
    last-col .code:n = \tl_if_empty:nTF {#1}
                         {  
                           \bool_set_true:N \l_@@_last_col_without_value_bool
                           \int_set:Nn \l_@@_last_col_int { -1 }
                         }
                         { \int_set:Nn \l_@@_last_col_int { #1 } } ,
    l .code:n = \tl_set:Nn \l_@@_type_of_col_tl L ,
    r .code:n = \tl_set:Nn \l_@@_type_of_col_tl R ,
    L .code:n = \tl_set:Nn \l_@@_type_of_col_tl L ,
    R .code:n = \tl_set:Nn \l_@@_type_of_col_tl R ,
    unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } 
  }
%    \end{macrocode}
%
%
% 
% \bigskip
% We finalise the definition of the set of keys ``|NiceMatrix / NiceArray|''
% with the options specific to |{NiceArray}|. 
%
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceArray }
  {
%    \end{macrocode}
% 
% In the environments |{NiceArray}| and its variants, the option |last-col| must
% be used without value because the number of columns of the array is read
% from the preamble of the array.
%    \begin{macrocode}
    last-col .code:n = \tl_if_empty:nF { #1 }
                         { \@@_error:n { last-col~non~empty~for~NiceArray } } 
                       \int_zero:N \l_@@_last_col_int ,
    unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray } 
  }
%    \end{macrocode}
%
%
%    
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / pNiceArray }
  { 
    first-col .code:n = \int_zero:N \l_@@_first_col_int , 
    last-col .code:n = \tl_if_empty:nF {#1}
                         { \@@_error:n { last-col~non~empty~for~NiceArray } } 
                       \int_zero:N \l_@@_last_col_int ,
    first-row .code:n = \int_zero:N \l_@@_first_row_int ,
    last-row .int_set:N = \l_@@_last_row_int ,
    last-row .default:n = -1 ,
    unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } 
  }
%    \end{macrocode}
%
%
% \bigskip
% \subsection*{Important code used by \{NiceArrayWithDelims\} }
%
% The pseudo-environment |\@@_Cell:|--|\@@_end_Cell:| will be used to format the
% cells of the array. In the code, the affectations are global because this
% pseudo-environment will be used in the cells of a |\halign| (via an
% environment |{array}|). 
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_Cell:
  { 
%    \end{macrocode}
% We increment |\c@jCol|, which is the counter of the columns. 
%    \begin{macrocode}
    \int_gincr:N \c@jCol
%    \end{macrocode}
% Now, we increment the counter of the rows. We don't do this incrementation in
% the |\everycr| because some packages, like \pkg{arydshln}, create special rows
% in the |\halign| that we don't want to take into account. 
%    \begin{macrocode}
    \int_compare:nNnT \c@jCol = 1
      { \int_compare:nNnT \l_@@_first_col_int = 1 \@@_begin_of_row: }
    \int_gset:Nn \g_@@_col_total_int { \int_max:nn \g_@@_col_total_int \c@jCol }
%    \end{macrocode}
% The content of the cell is composed in the box |\l_@@_cell_box| because we want
% to compute some dimensions of the box. The |\hbox_set_end:| corresponding to
% this |\hbox_set:Nw| will be in the |\@@_end_Cell:| (and the
% |\c_math_toggle_token| also).
%    \begin{macrocode}
    \hbox_set:Nw \l_@@_cell_box 
    \c_math_toggle_token
    \bool_if:NT \l_@@_small_bool \scriptstyle 
%    \end{macrocode}
% 
% We will call \emph{corners} of the matrix the cases which are at the
% intersection of the exterior rows and exterior columns (of course, the four
% corners doesn't always exist simultaneously). 
%
% The codes |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the
% corners of the matrix.
%    \begin{macrocode}
    \int_compare:nNnTF \c@iRow = 0 
      { 
        \int_compare:nNnT \c@jCol > 0 
          { 
            \l_@@_code_for_first_row_tl 
            \xglobal \colorlet { nicematrix-first-row } { . }
          }
      }
      {
        \int_compare:nNnT \c@iRow = \l_@@_last_row_int
          {
            \l_@@_code_for_last_row_tl 
            \xglobal \colorlet { nicematrix-last-row } { . }
          }
      }
  }
%    \end{macrocode}
%
% \interitem
% The following macro |\@@_begin_of_row| is usually used in the cell
% number~$1$ of the row. However, when the key |first-col| is used,
% |\@@_begin_of_row| is executed in the cell number~$0$ of the row.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_begin_of_row:
  {
    \int_gincr:N \c@iRow 
    \dim_gset_eq:NN \g_@@_dp_ante_last_row_dim \g_@@_dp_last_row_dim 
    \dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \@arstrutbox }
    \dim_gset:Nn \g_@@_ht_last_row_dim { \box_ht:N \@arstrutbox }
    \pgfpicture 
    \pgfrememberpicturepositiononpagetrue
    \pgfcoordinate 
      { \@@_env: - row - \int_use:N \c@iRow - base } 
      \pgfpointorigin 
    \str_if_empty:NF \l_@@_name_str
      {
        \pgfnodealias 
          { \@@_env: - row - \int_use:N \c@iRow - base } 
          { \l_@@_name_str - row - \int_use:N \c@iRow - base } 
      }
    \endpgfpicture
  }
%    \end{macrocode}
% 
%
% \interitem
% The following code is used in each cell of the array. It actualises quantities
% that, at the end of the array, will give informations about the vertical
% dimension of the two first rows and the two last rows. If the user uses the
% |last-row|, some lines will be dynamically added to this command.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_update_for_first_and_last_row:
  {
    \int_compare:nNnTF \c@iRow = 0
      { 
        \dim_gset:Nn \g_@@_dp_row_zero_dim
          { \dim_max:nn \g_@@_dp_row_zero_dim { \box_dp:N \l_@@_cell_box } }
        \dim_gset:Nn \g_@@_ht_row_zero_dim
          { \dim_max:nn \g_@@_ht_row_zero_dim { \box_ht:N \l_@@_cell_box } } 
      }
      {
        \int_compare:nNnT \c@iRow = 1
          { 
            \dim_gset:Nn \g_@@_ht_row_one_dim
              { \dim_max:nn \g_@@_ht_row_one_dim { \box_ht:N \l_@@_cell_box } }  
          } 
      }
  }
%    \end{macrocode}
% 
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_end_Cell:
  { 
    \c_math_toggle_token 
    \hbox_set_end:
%    \end{macrocode}
%
% We want to compute in |\g_@@_max_cell_width_dim| the width of the widest cell
% of the array (except the cells of the ``first column'' and the ``last
% column''). 
% 
%    \begin{macrocode}
    \dim_gset:Nn \g_@@_max_cell_width_dim
      { \dim_max:nn \g_@@_max_cell_width_dim { \box_wd:N \l_@@_cell_box } }
%    \end{macrocode}
%
% The following computations are for the ``first row'' and the ``last row''.
%    \begin{macrocode}
    \@@_update_for_first_and_last_row:
%    \end{macrocode}
% 
% \medskip
% If the cell is empty, or may be considered as if, we must not create the
% \textsc{pgf} node, for two reasons:
% \begin{itemize}
% \item it's a waste of time since such a node would be rather pointless;
% \item we test the existence of these nodes in order to determine whether a
% cell is empty when we search the extremities of a dotted line.
% \end{itemize}
% However, it's very difficult to determine whether a cell is empty. As of now,
% we use the following technic:
% \begin{itemize}
% \item if the width of the box |\l_@@_cell_box| (created with the content of
% the cell) is equal to zero, we consider the cell as empty (however,
% this is not perfect since the user may have use a |\rlap|, a |\llap| or a
% |\mathclap| of \pkg{mathtools}.
% \item the cells with a command |\Ldots| or |\Cdots|, |\Vdots|, etc.,
% should also be considered as empty; if |nullify-dots| is in force, there would
% be nothing to do (in this case the previous commands only write an instruction
% in a kind of |code-after|); however, if |nullify-dots| is not in force, a
% phantom of |\ldots|, |\cdots|, |\vdots| is inserted and its width is not equal
% to zero; that's why these commands raise a boolean |\g_@@_empty_cell_bool| and
% we begin by testing this boolean.
% \end{itemize}
%    \begin{macrocode}
    \bool_if:NTF \g_@@_empty_cell_bool
      { 
        \box_use_drop:N \l_@@_cell_box 
        \bool_gset_false:N \g_@@_empty_cell_bool
      }
      {
        \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim
          \@@_node_for_the_cell:
          { \box_use_drop:N \l_@@_cell_box }
      }
    \bool_gset_false:N \g_@@_empty_cell_bool
  } 
%    \end{macrocode}
% 
% \medskip
% The following command creates the \textsc{pgf} name of the node with, of
% course, |\l_@@_cell_box| as the content.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_node_for_the_cell:
  {
    \pgfpicture 
    \pgfsetbaseline \c_zero_dim
    \pgfrememberpicturepositiononpagetrue
    \pgfset
      {
        inner~sep = \c_zero_dim , 
        minimum~width = \c_zero_dim 
      }
    \pgfnode 
      { rectangle } 
      { base } 
      { \box_use_drop:N \l_@@_cell_box }
      { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol }
      { }
    \str_if_empty:NF \l_@@_name_str
      {
        \pgfnodealias
          { \l_@@_name_str - \int_use:N \c@iRow - \int_use:N \c@jCol }
          { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol } 
      }
    \endpgfpicture
  }
%    \end{macrocode}
% 
% \interitem
% The first argument of the following command |\@@_instruction_of_type:nn|
% defined below is the type of the instruction (|Cdots|, |Vdots|, |Ddots|,
% etc.). The second argument is the list of options. This command writes in the
% corresponding |\g_@@_|\textsl{type}|_lines_tl| the instruction which will
% actually draw the line after the construction of the matrix.
%
% \medskip
% For example, for the following matrix,
% 
% \smallskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% \begin{pNiceMatrix}
% 1 & 2 & 3 & 4 \\
% 5 & \Cdots & & 6 \\
% 7 & \Cdots[color=red] \\
% \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 \\
% 5 & \Cdots & & 6 \\
% 7 & \Cdots[color=red] \\
% \end{pNiceMatrix}$
%
% \smallskip
% the content of |\g_@@_Cdots_lines_tl| will be:
% 
% \smallskip
% \begin{scope}
% \color{gray}
% \verb|\@@_draw_Cdots:nnn {2}{2}{}|
%
% \verb|\@@_draw_Cdots:nnn {3}{2}{color=red}|
% \end{scope} 
% 
% 
% \bigskip
% We begin with a test of the flag |\c_@@_draft_bool| because, if the key
% |draft| is used, the dotted lines are not drawn.
%    \begin{macrocode}
\bool_if:NTF \c_@@_draft_bool
  { \cs_set_protected:Npn \@@_instruction_of_type:nn #1 #2 { } }
  {
    \cs_new_protected:Npn \@@_instruction_of_type:nn #1 #2
      { 
%    \end{macrocode}
% It's important to use a |\tl_gput_right:cx| and not a |\tl_gput_left:cx|
% because we want the |\Ddots| lines to be drawn in the order of appearance
% in the array (for parallelisation).
%    \begin{macrocode}
        \tl_gput_right:cx 
          { g_@@_ #1 _ lines _ tl }
          { 
            \use:c { @@ _ draw _ #1 : nnn }
              { \int_use:N \c@iRow } 
              { \int_use:N \c@jCol }
              { \exp_not:n { #2 } } 
          }
      }  
  }
%    \end{macrocode}
%
%  
% \bigskip
% We want to use |\array| of \pkg{array}. However, if the class used is
% \cls{revtex4-1} or \cls{revtex4-2}, we have to do some tuning and use the
% command |\@array@array| instead of |\array| because these classes do a
% redefinition of |\array| incompatible with our use of |\array|. 
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_array:
  {
    \bool_if:NTF \c_@@_revtex_bool
      { 
        \cs_set_eq:NN \@acoll \@arrayacol 
        \cs_set_eq:NN \@acolr \@arrayacol 
        \cs_set_eq:NN \@acol \@arrayacol 
        \cs_set:Npn \@halignto { }
        \@array@array
      }
      \array
%    \end{macrocode}
% |\l_@@_baseline_str| may have the value |t|, |c| or |b|. However, if the value
% is |b|, we compose the |\array| (of \pkg{array}) with the option |t| and the
% right translation will be done further. 
%    \begin{macrocode}
    [ \str_if_eq:VnTF \l_@@_baseline_str c c t ]
  }
%    \end{macrocode}
%
% \medskip
% We keep in memory the standard version of |\ialign| because we will redefine
% |\ialign| in the environment |{NiceArrayWithDelims}| but restore the standard
% version for use in the cells of the array.
%    \begin{macrocode}
\cs_set_eq:NN \@@_standard_ialign: \ialign
%    \end{macrocode}
% 
% \bigskip
% The following must \emph{not} be protected because it begins with |\noalign|. 
%    \begin{macrocode}
\cs_new:Npn \@@_everycr: { \noalign { \@@_everycr_i: } }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_everycr_i:
  { 
    \int_gzero:N \c@jCol 
%    \end{macrocode}
% The |\hbox:n| (or |\hbox|) is mandatory.
%    \begin{macrocode}
    \hbox
      {
        \pgfpicture 
        \pgfrememberpicturepositiononpagetrue
        \pgfcoordinate { \@@_env: - row - \@@_succ:n \c@iRow }  
          \pgfpointorigin 
        \str_if_empty:NF \l_@@_name_str
          {
            \pgfnodealias 
              { \@@_env: - row - \int_use:N \c@iRow - row } 
              { \l_@@_name_str - row - \int_use:N \c@iRow - row } 
          }   
        \endpgfpicture  
      }
%    \end{macrocode}
% We add the potential horizontal lines specified by the option |hlines|.
%    \begin{macrocode}
    \bool_if:NT \l_@@_hlines_bool
      {
%    \end{macrocode}
% The counter |\c@iRow| has the value $-1$ only if there is a ``first
% row'' and that we are before that ``first row'', i.e. just before the
% beginning of the array. 
%    \begin{macrocode}
        \int_compare:nNnT \c@iRow > { -1 }
          {
            \bool_if:NF \g_@@_row_of_col_done_bool
              {
                \int_compare:nNnF \c@iRow = \l_@@_last_row_int 
                  {
                    \bool_if:NTF \c_@@_colortbl_loaded_bool
                      { { \CT@arc@ \hrule height \arrayrulewidth } } 
                      { \hrule height \arrayrulewidth } 
                  }
              }
          } 
      }
  }
%    \end{macrocode}
% 
% \bigskip
% The following code |\@@_pre_array:| is used in |{NiceArrayWithDelims}|. It
% exists as a standalone macro only for lisibility.
% \label{prearray}
%
%   \begin{macrocode}
\cs_new_protected:Npn \@@_pre_array:
  {
    \box_clear_new:N \l_@@_cell_box
    \cs_if_exist:NT \theiRow
      { \int_set_eq:NN \l_@@_save_iRow_int \c@iRow }
    \int_gzero_new:N \c@iRow
    \cs_if_exist:NT \thejCol
      { \int_set_eq:NN \l_@@_save_jCol_int \c@jCol }
    \int_gzero_new:N \c@jCol
    \normalbaselines
%    \end{macrocode}
% If the option |small| is used, we have to do some tuning. In particular, we
% change the value of |\arraystretch| (this parameter is used in the
% construction of |\@arstrutbox| in the beginning of |{array}|).
%    \begin{macrocode}
    \bool_if:NT \l_@@_small_bool
      {
%    \end{macrocode}
%    \begin{macrocode}
        \cs_set:Npn \arraystretch { 0.47 }
        \dim_set:Nn \arraycolsep { 1.45 pt }
      }
%    \end{macrocode}
%
% 
% \bigskip
% The environment |{array}| uses internally the command |\ialign|. We change the
% definition of |\ialign| for several reasons. In particular, |\ialign| sets
% |\everycr| to |{ }| and we \emph{need} to have to change the value of
% |\everycr|. 
%    \begin{macrocode}
    \cs_set:Npn \ialign 
      { 
        \bool_if:NTF \c_@@_colortbl_loaded_bool
          {
            \CT@everycr 
              { 
                \noalign { \cs_gset_eq:NN \CT@row@color \prg_do_nothing: }
                \@@_everycr:
              }
          }
          { \everycr { \@@_everycr: } }
        \tabskip = \c_zero_skip
%    \end{macrocode}
%
% The box |\@arstrutbox| is a box constructed in the beginning of the
% environment |{array}|. The construction of that box takes into account the
% current values of |\arraystretch|\footnote{The option |small| of
% \pkg{nicematrix} changes (among other) the value of |\arraystretch|. This is
% done, of course, before the call of |{array}|.} and |\extrarowheight| (of
% \pkg{array}). That box is inserted (via |\@arstrut|) in the beginning of each
% row of the array. That's why we use the dimensions of that box to initialize
% the variables which will be the dimensions of the potential first and last row
% of the environment. This initialization must be done after the creation of
% |\@arstrutbox| and that's why we do it in the |\ialign|.
%    \begin{macrocode}
        \dim_gzero_new:N \g_@@_dp_row_zero_dim
        \dim_gset:Nn \g_@@_dp_row_zero_dim { \box_dp:N \@arstrutbox }
        \dim_gzero_new:N \g_@@_ht_row_zero_dim
        \dim_gset:Nn \g_@@_ht_row_zero_dim { \box_ht:N \@arstrutbox }
        \dim_gzero_new:N \g_@@_ht_row_one_dim
        \dim_gset:Nn \g_@@_ht_row_one_dim { \box_ht:N \@arstrutbox }
        \dim_gzero_new:N \g_@@_dp_ante_last_row_dim
        \dim_gzero_new:N \g_@@_ht_last_row_dim
        \dim_gset:Nn \g_@@_ht_last_row_dim { \box_ht:N \@arstrutbox }
        \dim_gzero_new:N \g_@@_dp_last_row_dim
        \dim_gset:Nn \g_@@_dp_last_row_dim { \box_dp:N \@arstrutbox }
%    \end{macrocode}
% After its first use, the definition of |\ialign| will revert
% automatically to its default definition. With this programmation, we will
% have, in the cells of the array, a clean version of |\ialign|.\footnote{The
% user will probably not employ directly |\ialign| in the array...  but more
% likely environments that utilize |\ialign| internally (e.g.: |{substack}|).}
%    \begin{macrocode}
        \cs_set_eq:NN \ialign \@@_standard_ialign:
        \halign 
      }
%    \end{macrocode}
%                                                   
% We define the new column types |L|, |C| and |R| that must be used instead of
% |l|, |c| and |r| in the preamble of |{NiceArray}|.
%    \begin{macrocode}
    \newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
    \newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
    \newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
%    \end{macrocode}    
% We keep in memory the old versions or |\ldots|, |\cdots|, etc. only because we
% use them inside |\phantom| commands in order that the new commands |\Ldots|,
% |\Cdots|, etc. give the same spacing (except when the option |nullify-dots| is
% used). 
%    \begin{macrocode}
    \cs_set_eq:NN \@@_ldots \ldots
    \cs_set_eq:NN \@@_cdots \cdots
    \cs_set_eq:NN \@@_vdots \vdots
    \cs_set_eq:NN \@@_ddots \ddots
    \cs_set_eq:NN \@@_iddots \iddots
    \cs_set_eq:NN \firsthline \hline
    \cs_set_eq:NN \lasthline \hline
    \cs_set_eq:NN \Ldots \@@_Ldots
    \cs_set_eq:NN \Cdots \@@_Cdots
    \cs_set_eq:NN \Vdots \@@_Vdots
    \cs_set_eq:NN \Ddots \@@_Ddots
    \cs_set_eq:NN \Iddots \@@_Iddots
    \cs_set_eq:NN \hdottedline \@@_hdottedline:
    \cs_set_eq:NN \Hspace \@@_Hspace:
    \cs_set_eq:NN \Hdotsfor \@@_Hdotsfor:
    \cs_set_eq:NN \multicolumn \@@_multicolumn:nnn
    \cs_set_eq:NN \Block \@@_Block:
    \cs_set_eq:NN \rotate \@@_rotate:
    \cs_set_eq:NN \OnlyMainNiceMatrix \@@_OnlyMainNiceMatrix:n
    \cs_set_eq:NN \CodeAfter \@@_CodeAfter:n
    \bool_if:NT \l_@@_renew_dots_bool
      { 
        \cs_set_eq:NN \ldots \@@_Ldots
        \cs_set_eq:NN \cdots \@@_Cdots
        \cs_set_eq:NN \vdots \@@_Vdots
        \cs_set_eq:NN \ddots \@@_Ddots
        \cs_set_eq:NN \iddots \@@_Iddots
        \cs_set_eq:NN \dots \@@_Ldots
        \cs_set_eq:NN \hdotsfor \@@_Hdotsfor:
      }
%    \end{macrocode}
% 
%
% The sequence |\g_@@_multicolumn_cells_seq| will contain the list of the cells
% of the array where a command |\multicolumn{|$n$|}{...}{...}| with $n>1$ is
% issued. In |\g_@@_multicolumn_sizes_seq|, the ``sizes'' (that is to say the
% values of $n$) correspondant will be stored. These lists will be used for the
% creation of the ``medium nodes'' (if they are created). 
%    \begin{macrocode}
    \seq_gclear_new:N \g_@@_multicolumn_cells_seq
    \seq_gclear_new:N \g_@@_multicolumn_sizes_seq
%    \end{macrocode}
% 
%
% The counter |\c@iRow| will be used to count the rows of the array (its
% incrementation will be in the first cell of the row). 
%    \begin{macrocode}
    \int_gset:Nn \c@iRow { \l_@@_first_row_int - 1 }
%    \end{macrocode}
%
% At the end of the environment |{array}|, |\c@iRow| will be the total
% number de rows.
%
% |\g_@@_row_total_int| will be the number or rows excepted the last row (if
% |\l_@@_last_row_bool| has been raised with the option |last-row|).
%    \begin{macrocode}
    \int_gzero_new:N \g_@@_row_total_int
%    \end{macrocode}
%
% The counter |\c@jCol| will be used to count the columns of the array.
% Since we want to know the total number of columns of the matrix, we also
% create a counter |\g_@@_col_total_int|. These counters are updated in the
% command |\@@_Cell:| executed at the beginning of each cell.  
%    \begin{macrocode}
    \int_gzero_new:N \g_@@_col_total_int
%    \end{macrocode}
%
%    \begin{macrocode}
    \cs_set_eq:NN \@ifnextchar \new@ifnextchar
%    \end{macrocode}
%
% We nullify the definitions of the column types |w| and |W| before their
% redefinition because we want to avoid a warning in the log file for a
% redefinition of a column type. We must put |\relax| and not
% |\prg_do_nothing:|.
%    \begin{macrocode}
    \cs_set_eq:NN \NC@find@w \relax
    \cs_set_eq:NN \NC@find@W \relax
    \newcolumntype w [ 2 ]
      {
        > {
            \hbox_set:Nw \l_@@_cell_box
            \@@_Cell:
          }
        c
        < {
            \@@_end_Cell:
            \hbox_set_end:
%    \end{macrocode}
% The |\str_lowercase:n| is only for giving the user the ability to write
% |wC{1cm}| instead of |wc{1cm}| for homogeneity with the letters |L|, |C| and
% |R| used elsewhere in the preamble instead of |l|, |c| and |r|.
%    \begin{macrocode}
            \makebox [ ##2 ] [ \str_lowercase:n { ##1 } ] 
               { \box_use_drop:N \l_@@_cell_box }  
          }
      }
    \newcolumntype W [ 2 ]
      {
        > {
            \hbox_set:Nw \l_@@_cell_box
            \@@_Cell:
          }
        c
        < {
            \@@_end_Cell:
            \hbox_set_end:
            \cs_set_eq:NN \hss \hfil
            \makebox [ ##2 ] [ \str_lowercase:n { ##1 } ] 
              { \box_use_drop:N \l_@@_cell_box } 
          }
      }
%    \end{macrocode}
%                               
% \bigskip
% By default, the letter used to specify a dotted line in the preamble of an
% environment of \pkg{nicematrix} (for example in |{pNiceArray}|) is the letter
% |:|. However, this letter is used by some packages, for example
% \pkg{arydshln}. That's why it's possible to change the letter used by
% \pkg{nicematrix} with the option |letter-for-dotted-lines| which changes the
% value of |\l_@@_letter_for_dotted_lines_str|. We rescan this string (which is
% always of length~1) in particular for the case where |pdflatex| is used with
% \pkg{french-babel} (the colon is activated by \pkg{french-babel} at the
% beginning of the document).
%    \begin{macrocode}
    \tl_set_rescan:Nno  
      \l_@@_letter_for_dotted_lines_str { } \l_@@_letter_for_dotted_lines_str  
    \exp_args:NV \newcolumntype \l_@@_letter_for_dotted_lines_str
      {
        !
          {
%    \end{macrocode}
% 
% \medskip
% The following code because we want the dotted line to have exactly the same
% position as a vertical rule drawn by ``"|"'' (considering the rule having a
% width equal to the diameter of the dots).
%    \begin{macrocode}
            \int_compare:nNnF \c@iRow = 0 
              { 
                \int_compare:nNnF \c@iRow = \l_@@_last_row_int
                  { \skip_horizontal:N 2\l_@@_radius_dim }
              }
%    \end{macrocode}
%
% \medskip
% Consider the following code:
% \begin{center}
% \begin{BVerbatim}
% \begin{NiceArray}{C:CC:C}
% a & b
% c & d \\
% e & f & g & h \\
% i & j & k & l 
% \end{NiceArray}
% \end{BVerbatim}
% \end{center}
% The first ``|:|'' in the preamble will be encountered during the first row of
% the environment |{NiceArray}| but the second one will be encountered only in
% the third row. We have to issue a command |\vdottedline:n| in the |code-after|
% only one time for each ``|:|'' in the preamble. That's why we keep a counter
% |\g_@@_last_vdotted_col_int| and with this counter, we know whether a letter
% ``|:|'' encountered during the parsing has already been taken into account in
% the |code-after|.
%    \begin{macrocode}
            \int_compare:nNnT \c@jCol > \g_@@_last_vdotted_col_int
              {
                \int_gset_eq:NN \g_@@_last_vdotted_col_int \c@jCol
                \tl_gput_right:Nx \g_@@_internal_code_after_tl
%    \end{macrocode}
% The command |\@@_vdottedline:n| is protected, and, therefore, won't be
% expanded before writing on |\g_@@_internal_code_after_tl|.
%    \begin{macrocode}
                  { \@@_vdottedline:n { \int_use:N \c@jCol } }
              }
          }
      }
    \int_gzero_new:N \g_@@_last_vdotted_col_int
    \bool_if:NT \c_@@_siunitx_loaded_bool \@@_renew_NC@rewrite@S:
    \int_gset:Nn \g_@@_last_vdotted_col_int { -1 }
    \bool_gset_false:N \g_@@_last_col_found_bool 
%    \end{macrocode}
%
% \medskip
% During the construction of the array, the instructions |\Cdots|, |\Ldots|,
% etc. will be written in token lists |\g_@@_Cdots_lines_tl|, etc. which will be
% executed after the construction of the array. 
%    \begin{macrocode}
    \tl_gclear_new:N \g_@@_Cdots_lines_tl
    \tl_gclear_new:N \g_@@_Ldots_lines_tl
    \tl_gclear_new:N \g_@@_Vdots_lines_tl
    \tl_gclear_new:N \g_@@_Ddots_lines_tl
    \tl_gclear_new:N \g_@@_Iddots_lines_tl
    \tl_gclear_new:N \g_@@_Hdotsfor_lines_tl
 }
%    \end{macrocode}
% 
% \bigskip
% \subsection*{The environment \{NiceArrayWithDelims\}}
%
%    \begin{macrocode}
\NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } }
  { 
    \tl_set:Nn \l_@@_left_delim_tl { #1 }
    \tl_set:Nn \l_@@_right_delim_tl { #2 }
    \bool_gset_false:N \g_@@_row_of_col_done_bool
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } } 
    \@@_adapt_S_column:
    \@@_test_if_math_mode:
    \bool_if:NT \l_@@_in_env_bool { \@@_fatal:n { Yet~in~env } } 
    \bool_set_true:N \l_@@_in_env_bool
%    \end{macrocode}
%
% We deactivate Tikz externalization because we will use \textsc{pgf} pictures with the
% options |overlay| and |remember picture| (or equivalent forms).
%    \begin{macrocode}
    \cs_if_exist:NT \tikz@library@external@loaded
      {
        \tikzset { external / export = false }
        \cs_if_exist:NT \ifstandalone
          { \tikzset { external / optimize = false } }
      }
%    \end{macrocode}
%
% We increment the counter |\g_@@_env_int| which counts the environments
% of the package.
%    \begin{macrocode}
    \int_gincr:N \g_@@_env_int
    \bool_if:NF \l_@@_block_auto_columns_width_bool
      { \dim_gzero_new:N \g_@@_max_cell_width_dim }
%    \end{macrocode}
%
% 
% We do a redefinition of |\@arrayrule| because we want that the vertical rules
% drawn by "|" in the preamble of the array don't extend in the potential
% exterior rows.
%    \begin{macrocode}
    \cs_set_protected:Npn \@arrayrule { \@addtopreamble \@@_vline: }
%    \end{macrocode}
% 
%
% The set of keys is not exactly the same for |{NiceArray}| and for the variants
% of |{NiceArray}| (|{pNiceArray}|, |{bNiceArray}|, etc.) because, for
% |{NiceArray}|, we have the options |t|, |c|, |b| and |baseline|.
%    \begin{macrocode}
    \bool_if:NTF \l_@@_NiceArray_bool 
      { \keys_set:nn { NiceMatrix / NiceArray } }
      { \keys_set:nn { NiceMatrix / pNiceArray } }
    { #3 , #5 } 
%    \end{macrocode}
% 
% 
% A value of $-1$ for the counter |\l_@@_last_row_int| means that the user has
% used the option |last-row| without value, that is to say without specifying
% the number of that last row. In this case, we try to read that value from the
% |aux| file (if it has been written on a previous run). 
%
%    \begin{macrocode}
    \int_compare:nNnT \l_@@_last_row_int > { -2 }
      {
        \tl_put_right:Nn \@@_update_for_first_and_last_row:
          {
            \dim_gset:Nn \g_@@_ht_last_row_dim
              { \dim_max:nn \g_@@_ht_last_row_dim { \box_ht:N \l_@@_cell_box } }  
            \dim_gset:Nn \g_@@_dp_last_row_dim
              { \dim_max:nn \g_@@_dp_last_row_dim { \box_dp:N \l_@@_cell_box } }  
          }
      }
    \int_compare:nNnT \l_@@_last_row_int = { -1 }
      {
        \bool_set_true:N \l_@@_last_row_without_value_bool
%    \end{macrocode}
% A value based on the name is more reliable than a value based on the number of
% the environment.
%    \begin{macrocode}
        \str_if_empty:NTF \l_@@_name_str
          {
            \cs_if_exist:cT { @@_last_row_ \int_use:N \g_@@_env_int } 
              { 
                \int_set:Nn \l_@@_last_row_int 
                  { \use:c { @@_last_row_ \int_use:N \g_@@_env_int } }
              }  
          }
          {
            \cs_if_exist:cT { @@_last_row_ \l_@@_name_str } 
              { 
                \int_set:Nn \l_@@_last_row_int 
                  { \use:c { @@_last_row_ \l_@@_name_str } }
              }  
          }
      }
%    \end{macrocode}
%
%
% A value of $-1$ for the counter |\l_@@_last_col_int| means that the user has
% used the option |last-col| without value, that is to say without specifying
% the number of that last column. In this case, we try to read that value from
% the |aux| file (if it has been written on a previous run).
%    \begin{macrocode}
    \int_compare:nNnT \l_@@_last_col_int = { -1 }
      {
        \str_if_empty:NTF \l_@@_name_str
          {
            \cs_if_exist:cT { @@_last_col_ \int_use:N \g_@@_env_int } 
              { 
                \int_set:Nn \l_@@_last_col_int 
                  { \use:c { @@_last_col_ \int_use:N \g_@@_env_int } }
              }  
          }
          {
            \cs_if_exist:cT { @@_last_col_ \l_@@_name_str } 
              { 
                \int_set:Nn \l_@@_last_col_int 
                  { \use:c { @@_last_col_ \l_@@_name_str } }
              }  
          }
      }
%    \end{macrocode}
% 
% \interitem
% The code in |\@@_pre_array:| is used only by |{NiceArrayWithDelims}|. 
%    \begin{macrocode}
    \@@_pre_array:
%    \end{macrocode}
%
% \medskip
% We compute the width of the two delimiters.
%    \begin{macrocode}
    \dim_zero_new:N \l_@@_left_delim_dim
    \dim_zero_new:N \l_@@_right_delim_dim
    \bool_if:NTF \l_@@_NiceArray_bool
      { 
        \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep }
        \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep }
      }
      { 
%    \end{macrocode}
% The command |\bBigg@| is a command of \pkg{amsmath}.
%    \begin{macrocode}
        \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 #1 $ }
        \dim_set:Nn \l_@@_left_delim_dim { \box_wd:N \l_tmpa_box }
        \hbox_set:Nn \l_tmpa_box { $\bBigg@ 5 #2 $ }
        \dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box }
      }
%    \end{macrocode}
% 
% \medskip
% The array will be composed in a box (named |\l_@@_the_array_box|) because we
% have to do manipulations concerning the potential exterior rows.
%    \begin{macrocode}
    \box_clear_new:N \l_@@_the_array_box
%    \end{macrocode}
%
% \medskip
% We construct the preamble of the array in |\l_tmpa_tl|.
%    \begin{macrocode}
    \tl_set:Nn \l_tmpa_tl { #4 }
    \int_compare:nNnTF \l_@@_first_col_int = 0
      { \tl_put_left:NV \l_tmpa_tl \c_@@_preamble_first_col_tl }
      {
        \bool_lazy_all:nT 
          { 
            \l_@@_NiceArray_bool 
            { \bool_not_p:n \l_@@_vlines_bool } 
            { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
          }
          { \tl_put_left:Nn \l_tmpa_tl { @ { } } }
      }
    \int_compare:nNnTF \l_@@_last_col_int > { -1 }
      { \tl_put_right:NV \l_tmpa_tl \c_@@_preamble_last_col_tl }
      { 
        \bool_lazy_all:nT
          { 
            \l_@@_NiceArray_bool 
            { \bool_not_p:n \l_@@_vlines_bool }
            { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
          }
          { \tl_put_right:Nn \l_tmpa_tl { @ { } } }
      }
    \tl_put_right:Nn \l_tmpa_tl { > { \@@_error_too_much_cols: } L } 
%    \end{macrocode}
% Here is the beginning of the box which will contain the array. The
% |\hbox_set_end:| corresponding to this |\hbox_set:Nw| will be in the second
% part of the environment (and the closing |\c_math_toggle_token| also).
%    \begin{macrocode}
    \hbox_set:Nw \l_@@_the_array_box
%    \end{macrocode}
% If the key |\vlines| is used, we increase |\arraycolsep| by
% |0.5\arrayrulewidth| in order to reserve space for the width of the vertical
% rules drawn with Tikz after the end of the array. However, the first
% |\arraycolsep| is used once (between columns, |\arraycolsep| is used twice).
% That's why we add a |0.5\arrayrulewidth| more.
%    \begin{macrocode}
    \bool_if:NT \l_@@_vlines_bool
      { 
        \dim_add:Nn \arraycolsep { 0.5 \arrayrulewidth } 
        \skip_horizontal:N  0.5\arrayrulewidth  
      }
    \skip_horizontal:N \l_@@_left_margin_dim 
    \skip_horizontal:N \l_@@_extra_left_margin_dim 
    \c_math_toggle_token
    \bool_if:NTF \l_@@_light_syntax_bool
      { \begin { @@-light-syntax } }
      { \begin { @@-normal-syntax } } 
  }
%    \end{macrocode}
%
% 
%    \begin{macrocode}
  {  
    \bool_if:NTF \l_@@_light_syntax_bool
      { \end { @@-light-syntax } }
      { \end { @@-normal-syntax } }
    \c_math_toggle_token
    \skip_horizontal:N \l_@@_right_margin_dim 
    \skip_horizontal:N \l_@@_extra_right_margin_dim 
%    \end{macrocode}
% If the key |\vlines| is used, we have increased |\arraycolsep| by
% |0.5\arrayrulewidth| in order to reserve space for the width of the vertical
% rules drawn with Tikz after the end of the array. However, the last
% |\arraycolsep| is used once (between columns, |\arraycolsep| is used twice).
% That's we add a |0.5 \arrayrulewidth| more.
%    \begin{macrocode}
    \bool_if:NT \l_@@_vlines_bool { \skip_horizontal:N 0.5\arrayrulewidth } 
    \hbox_set_end:
%    \end{macrocode}
% End of the construction of the array (in the box |\l_@@_the_array_box|).
%
% \bigskip
% It the user has used the key |last-row| with a value, we control that the
% given value is correct (since we have just contructed the array, we know the
% real number of rows of the array).
%    \begin{macrocode}
    \int_compare:nNnT \l_@@_last_row_int > { -2 }
      {
        \bool_if:NF \l_@@_last_row_without_value_bool
          {
            \int_compare:nNnF \l_@@_last_row_int = \c@iRow
              { 
                \@@_error:n { Wrong~last~row } 
                \int_gset_eq:NN \l_@@_last_row_int \c@iRow
              }
          } 
      } 
%    \end{macrocode}
%
% Now, the definition of |\c@jCol| and
% |\g_@@_col_total_int| change: |\c@jCol| will be the number of
% columns without the ``last column''; |\g_@@_col_total_int| will be the
% number of columns with this ``last column''.\footnote{We remind that the
% potential ``first column'' (exterior) has the number~$0$.}
%    \begin{macrocode}
    \int_gset_eq:NN \c@jCol \g_@@_col_total_int
    \bool_if:nT \g_@@_last_col_found_bool { \int_gdecr:N \c@jCol } 
%    \end{macrocode}
%
% We fix also the value of |\c@iRow| and |\g_@@_row_total_int| with the
% same principle.
%    \begin{macrocode}
    \int_gset_eq:NN \g_@@_row_total_int \c@iRow
    \int_compare:nNnT \l_@@_last_row_int > { -1 } { \int_gdecr:N \c@iRow } 
%    \end{macrocode}
%
% 
% 
% \bigskip
% \textbf{Now, we begin the real construction in the output flow of TeX}. First, we take
% into account a potential ``first column'' (we remind that this ``first
% column'' has been constructed in an overlapping position and that we have
% computed its width in |\g_@@_width_first_col_dim|: see
% p.~\pageref{overlap-left}). 
%    \begin{macrocode}
    \int_compare:nNnT \l_@@_first_col_int = 0
      { 
        \skip_horizontal:N \arraycolsep
        \skip_horizontal:N \g_@@_width_first_col_dim 
      }
%    \end{macrocode}
%
% The construction of the real box is different in |{NiceArray}| and in the
% other environments because, in |{NiceArray}|, we have to take into account the
% value of |baseline| and we have no delimiter to put. We begin with |{NiceArray}|.
%    \begin{macrocode}
    \bool_if:NTF \l_@@_NiceArray_bool
      { 
%    \end{macrocode}
% Remember that, when the key |b| is used, the |\array| (of \pkg{array}) is
% constructed with the option |t| (and not |b|). Now, we do the translation to
% take into account the option |b|.
%    \begin{macrocode}
        \str_if_eq:VnTF \l_@@_baseline_str { b }
          { 
           \pgfpicture
             \@@_qpoint: { row - 1 } 
             \dim_gset_eq:NN \g_tmpa_dim \pgf@y
             \@@_qpoint: { row - \int_use:N \c@iRow - base }
             \dim_gsub:Nn \g_tmpa_dim \pgf@y
           \endpgfpicture
           \int_compare:nNnT \l_@@_first_row_int = 0 
             {
               \dim_gadd:Nn \g_tmpa_dim 
                 { \g_@@_ht_row_zero_dim + \g_@@_dp_row_zero_dim }
             }
           \box_move_up:nn \g_tmpa_dim { \box_use_drop:N \l_@@_the_array_box } 
          }
          { 
            \str_if_eq:VnTF \l_@@_baseline_str { c }
              { \box_use_drop:N \l_@@_the_array_box } 
              {
%    \end{macrocode}
% We convert a value of |t| to a value of |1|.
%    \begin{macrocode}
                \str_if_eq:VnT \l_@@_baseline_str { t } 
                  { \str_set:Nn \l_@@_baseline_str { 1 } } 
%    \end{macrocode}
% Now, we convert the value of |\l_@@_baseline_str| (which should represent an
% integer) to an integer stored in |\l_tmpa_int|.
%    \begin{macrocode}
                \int_set:Nn \l_tmpa_int \l_@@_baseline_str
                \bool_if:nT
                  { 
                       \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int
                    || \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int 
                  }
                  { 
                    \@@_error:n { bad~value~for~baseline }
                    \int_set:Nn \l_tmpa_int 1
                  }
                \pgfpicture
                \@@_qpoint: { row - 1 } 
                \dim_gset_eq:NN \g_tmpa_dim \pgf@y
                \@@_qpoint: { row - \int_use:N \l_tmpa_int - base }
                \dim_gsub:Nn \g_tmpa_dim \pgf@y
                \endpgfpicture
                \int_compare:nNnT \l_@@_first_row_int = 0 
                  {
                    \dim_gadd:Nn \g_tmpa_dim 
                      { \g_@@_ht_row_zero_dim + \g_@@_dp_row_zero_dim }
                  }
                \box_move_up:nn \g_tmpa_dim 
                  { \box_use_drop:N \l_@@_the_array_box } 
              }
          }
      } 
%    \end{macrocode}
%
% Now, in the case of an environment |{pNiceArray}|, |{bNiceArray}|, etc. We
% compute |\l_tmpa_dim| which is the total height of the ``first row'' above the
% array (when the key |first-row| is used).
%    \begin{macrocode}
      {
        \int_compare:nNnTF \l_@@_first_row_int = 0
          { 
            \dim_set_eq:NN \l_tmpa_dim \g_@@_dp_row_zero_dim 
            \dim_add:Nn \l_tmpa_dim \g_@@_ht_row_zero_dim 
          } 
          { \dim_zero:N \l_tmpa_dim }
%    \end{macrocode}
%
% We compute |\l_tmpb_dim| which is the total height of the ``last row''
% below the array (when the key |last-row| is used). A value of $-2$ for
% |\l_@@_last_row_int| means that there is no ``last row''.\footnote{A value of
% $-1$ for |\l_@@_last_row_int| means that there is a ``last row'' but the
% the user have not set the value with the option |last row| (and we are in the
% first compilation).} 
%    \begin{macrocode}
        \int_compare:nNnTF \l_@@_last_row_int > { -2 }
          {
            \dim_set_eq:NN \l_tmpb_dim \g_@@_ht_last_row_dim 
            \dim_add:Nn \l_tmpb_dim \g_@@_dp_last_row_dim 
          }
          { \dim_zero:N \l_tmpb_dim }
%    \end{macrocode}
% 
%    \begin{macrocode}        
        \hbox_set:Nn \l_tmpa_box
          {
            \c_math_toggle_token
            \left #1
            \vcenter 
              { 
%    \end{macrocode}
% We take into account the ``first row'' (we have previously computed its total
% height in |\l_tmpa_dim|). The |\hbox:n| (or |\hbox|) is necessary here.
%    \begin{macrocode}
                \skip_vertical:N -\l_tmpa_dim 
                \hbox
                  {
                    \skip_horizontal:N -\arraycolsep 
                    \box_use_drop:N \l_@@_the_array_box
                    \skip_horizontal:N -\arraycolsep 
                  }
%    \end{macrocode}
% We take into account the ``last row'' (we have previously computed its total
% height in |\l_tmpb_dim|).
%    \begin{macrocode}
                \skip_vertical:N -\l_tmpb_dim 
              }
            \right #2 
            \c_math_toggle_token
          }
%    \end{macrocode}
% Now, the box |\l_tmpa_box| is created with the correct delimiters.
%
% \smallskip
% We will put the box in the TeX flow. However, we have a small work to do 
% when the option |max-delimiter-width| is used.
%    \begin{macrocode}
        \bool_if:NTF \l_@@_max_delimiter_width_bool 
          { \@@_put_box_in_flow_bis:nn { #1 } { #2 } }
          \@@_put_box_in_flow:
      } 
%    \end{macrocode}
%
% We take into account a potential ``last column'' (this ``last column'' has
% been constructed in an overlapping position and we have computed its width in
% |\g_@@_width_last_col_dim|: see p.~\pageref{overlap-right}).
%    \begin{macrocode}           
    \bool_if:NT \g_@@_last_col_found_bool 
      { 
        \skip_horizontal:N \g_@@_width_last_col_dim 
        \skip_horizontal:N \arraycolsep 
      }
    \@@_after_array:
  }
%    \end{macrocode}
% This is the end of the environment |{NiceArrayWithDelims}|.
%
% \bigskip
% The command |\@@_put_box_in_flow:| puts the box |\l_tmpa_box| (which contains
% the array) in the flow. It is used for the environments with delimiters.
% First, we have to modify the height and the depth to take back into account
% the potential exterior rows (the total height of the first row has been
% computed in |\l_tmpa_dim| and the total height of the potential last row in
% |\l_tmpb_dim|).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_put_box_in_flow:
  { 
    \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim } 
    \box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim } 
    \str_if_eq:VnTF \l_@@_baseline_str { c }
      { \box_use_drop:N \l_tmpa_box }
      \@@_put_box_in_flow_i:
  }
%    \end{macrocode}
%
% \medskip
% The command |\@@_put_box_in_flow_i:| is used when the value of
% |\l_@@_baseline_str| is different of |c| (which is the initial value and the
% most used).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_put_box_in_flow_i:
  {
    \str_case:VnF \l_@@_baseline_str
      {
        { t } { \int_set:Nn \l_tmpa_int 1 }
        { b } { \int_set_eq:NN \l_tmpa_int \c@iRow }
      }
      { \int_set:Nn \l_tmpa_int \l_@@_baseline_str }
    \bool_if:nT
      { 
           \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int
        || \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int 
      }
      { 
        \@@_error:n { bad~value~for~baseline }
        \int_set:Nn \l_tmpa_int 1
      }
    \pgfpicture
      \@@_qpoint: { row - 1 } 
      \dim_gset_eq:NN \g_tmpa_dim \pgf@y
      \@@_qpoint: { row - \@@_succ:n \c@iRow }
      \dim_gadd:Nn \g_tmpa_dim \pgf@y
      \dim_gset:Nn \g_tmpa_dim { 0.5 \g_tmpa_dim }
%    \end{macrocode}
% Now, |\g_tmpa_dim| contains the $y$-value of the center of the array (the
% delimiters are centered in relation with this value).
%    \begin{macrocode}
      \@@_qpoint: { row - \int_use:N \l_tmpa_int - base }
      \dim_gsub:Nn \g_tmpa_dim \pgf@y
%    \end{macrocode}
% We take into account the position of the mathematical axis.
%    \begin{macrocode}
      \dim_gsub:Nn \g_tmpa_dim { \fontdimen22 \textfont2 }
%    \end{macrocode}
% Now, |\g_tmpa_dim| contains the value of the $y$ translation we have to to.
%    \begin{macrocode}
    \endpgfpicture
    \box_move_up:nn \g_tmpa_dim { \box_use_drop:N \l_tmpa_box } 
    \box_use_drop:N \l_tmpa_box 
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_put_box_in_flow_bis:| is used when the option
% |max-delimiter-width| is used because, in this case, we have to adjust the
% widths of the delimiters. The arguments |#1| and |#2| are the delimiters
% specified by the user.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_put_box_in_flow_bis:nn #1 #2 
  { 
%    \end{macrocode}
% We will compute the real width of both delimiters used.
%    \begin{macrocode}
    \dim_zero_new:N \l_@@_real_left_delim_dim
    \dim_zero_new:N \l_@@_real_right_delim_dim
    \hbox_set:Nn \l_tmpb_box
      {
        \c_math_toggle_token
        \left #1 
        \vcenter 
          { 
            \vbox_to_ht:nn 
              { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
              { }
          }
         \right .
        \c_math_toggle_token
      } 
    \dim_set:Nn \l_@@_real_left_delim_dim 
      { \box_wd:N \l_tmpb_box - \nulldelimiterspace }  
    \hbox_set:Nn \l_tmpb_box
      {
        \c_math_toggle_token
        \left .
        \vbox_to_ht:nn 
          { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
          { }
        \right #2
        \c_math_toggle_token
      } 
    \dim_set:Nn \l_@@_real_right_delim_dim 
      { \box_wd:N \l_tmpb_box - \nulldelimiterspace } 
%    \end{macrocode}
% 
% Now, we can put the box in the TeX flow with the horizontal adjustments on
% both sides.
%    \begin{macrocode}
    \skip_horizontal:N  \l_@@_left_delim_dim 
    \skip_horizontal:N -\l_@@_real_left_delim_dim 
    \@@_put_box_in_flow:
    \skip_horizontal:N \l_@@_right_delim_dim 
    \skip_horizontal:N -\l_@@_real_right_delim_dim 
  }
%    \end{macrocode}
% 
% \interitem
% The construction of the array in the environment |{NiceArrayWithDelims}| is,
% in fact, done by the environment |{@@-light-syntax}| or by the environment
% |{@@-normal-syntax}| (whether the option |light-syntax| is used or not). When
% the key |light-syntax| is not used, the construction is a standard
% environment (and, thus, it's possible to use verbatim in the arrray).
%    \begin{macrocode} 
\NewDocumentEnvironment { @@-normal-syntax } { }
%    \end{macrocode}
% First, we test whether the environment is empty. If it is empty, we raise a
% fatal error (it's only a security). In order to detect whether it is empty, we
% test whether the next token is |\end| and, if it's the case, we test if this
% is the end of the environment (if it is not, an standard error will be raised
% by LaTeX for incorrect nested environments).
%    \begin{macrocode}
  { 
    \peek_meaning_ignore_spaces:NTF \end 
      { \@@_analyze_end:Nn }
%    \end{macrocode}
% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
%    \begin{macrocode}
      { \exp_args:NV \@@_array: \l_tmpa_tl }
  }
  { 
    \@@_create_col_nodes:
    \endarray 
  }
%    \end{macrocode}
%
% 
% \bigskip
% When the key |light-syntax| is used, we use an environment which takes its whole
% body as an argument (with the specifier |b| of \pkg{xparse}). 
%    \begin{macrocode}
\NewDocumentEnvironment { @@-light-syntax } { b }
  { 
%    \end{macrocode}
% First, we test whether the environment is empty. It's only a security. Of
% course, this test is more easy than the similar test for the ``normal syntax''
% because we have the whole body of the environment in |#1|.
%    \begin{macrocode}
    \tl_if_empty:nT { #1 } { \@@_fatal:n { empty~environment } }
    \tl_map_inline:nn { #1 } 
      {
        \tl_if_eq:nnT { ##1 } { & }
          { \@@_fatal:n { ampersand~in~light-syntax } }
        \tl_if_eq:nnT { ##1 } { \\ }
          { \@@_fatal:n { double-backslash~in~light-syntax } }
      }
%    \end{macrocode}
% The body of the environment, which is stored in the argument |#1|, is now
% splitted into items (and \emph{not} tokens) 
%    \begin{macrocode}
    \seq_gclear_new:N \g_@@_rows_seq
    \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl
    \exp_args:NNV \seq_gset_split:Nnn \g_@@_rows_seq \l_@@_end_of_row_tl { #1 }
%    \end{macrocode}
% If the environment uses the option |last-row| without value (i.e. without
% saying the number of the rows), we have now the opportunity to know that
% value. We do it, and so, if the token list |\l_@@_code_for_last_row_tl| is not
% empty, we will use directly where it should be.
%    \begin{macrocode}
    \int_compare:nNnT \l_@@_last_row_int = { -1 }
      { \int_set:Nn \l_@@_last_row_int { \seq_count:N \g_@@_rows_seq } }
%    \end{macrocode}
% Here is the call to |\array| (we have a dedicated macro |\@@_array:| because
% of compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}).
%    \begin{macrocode}
    \exp_args:NV \@@_array: \l_tmpa_tl 
%    \end{macrocode}
% We need a global affectation because, when executing |\l_tmpa_tl|, we will
% exit the first cell of the array.
%    \begin{macrocode}
    \seq_gpop_left:NN \g_@@_rows_seq \l_tmpa_tl 
    \exp_args:NV \@@_line_with_light_syntax_i:n \l_tmpa_tl
    \seq_map_function:NN \g_@@_rows_seq \@@_line_with_light_syntax:n
    \@@_create_col_nodes:
    \endarray
  }
%    \end{macrocode}
% Now, the second part of the environment. It is empty. That's not surprising
% because we have caught the whole body of the environment with the specifier
% |b| provided by \pkg{xparse}.
%    \begin{macrocode}
  { }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_line_with_light_syntax_i:n #1
  {
    \seq_gclear_new:N \g_@@_cells_seq
    \seq_gset_split:Nnn \g_@@_cells_seq { ~ } { #1 }
    \seq_gpop_left:NN \g_@@_cells_seq \l_tmpa_tl
    \l_tmpa_tl
    \seq_map_function:NN \g_@@_cells_seq \@@_cell_with_light_syntax:n
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_line_with_light_syntax:n #1
  { 
    \tl_if_empty:nF { #1 }
      { \\ \@@_line_with_light_syntax_i:n { #1 } }
  } 
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cell_with_light_syntax:n #1 { & #1 }
%    \end{macrocode}
% 
% \bigskip
% The following command is used by the code which detects whether the
% environment is empty (we raise a fatal error in this case: it's only a
% security). 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_analyze_end:Nn #1 #2
  {
    \str_if_eq:VnT \g_@@_name_env_str { #2 }
      { \@@_fatal:n { empty~environment } }
%    \end{macrocode}
% We reput in the stream the |\end{...}| we have extracted and the user will
% have an error for incorrect nested environments.
%    \begin{macrocode}
    \end { #2 }
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_create_col_nodes:| will construct a special last row.
% That last row is a false row used to create the |col|-nodes and to fix the
% width of the columns (when the array is constructed with an option which
% specify the width of the columns).
%    \begin{macrocode}
\cs_new:Npn \@@_create_col_nodes:
  {
    \crcr 
    \int_compare:nNnT \c@iRow = 0 { \@@_fatal:n { Zero~row } }
    \int_compare:nNnT \l_@@_first_col_int = 0 
      { 
        \omit 
        \skip_horizontal:N -2\arraycolsep
        \pgfpicture 
        \pgfrememberpicturepositiononpagetrue
        \pgfcoordinate { \@@_env: - col - 0 } \pgfpointorigin 
        \str_if_empty:NF \l_@@_name_str
          { \pgfnodealias { \@@_env: - col - 0 } { \l_@@_name_str - col - 0 } }  
        \endpgfpicture
        & 
      }
    \omit
%    \end{macrocode}
% The following instruction must be put after the instruction |\omit|.
%    \begin{macrocode}
    \bool_gset_true:N \g_@@_row_of_col_done_bool
%    \end{macrocode}
% First, we put a ``|col|'' node on the left of the first column (of course, we
% have to do that \emph{after} the |\omit|).
%    \begin{macrocode}
    \pgfpicture 
    \pgfrememberpicturepositiononpagetrue
    \pgfcoordinate { \@@_env: - col - 1 } \pgfpointorigin 
    \str_if_empty:NF \l_@@_name_str
      { \pgfnodealias { \@@_env: - col - 1 } { \l_@@_name_str - col - 1 } }  
    \endpgfpicture
%    \end{macrocode}
% We compute in |\g_tmpa_skip| the common width of the columns (it's a skip and
% not a dimension). We use a global variable because we are in a cell of an
% |\halign| and because we have to use this variable in other cells (of the same
% row). The affectation of |\g_tmpa_skip|, like all the affectations, must be
% done after the |\omit| of the cell.
%
% \smallskip
% We give a default value for |\g_tmpa_skip| (|0 pt plus 1 fill|) but it will
% just after erased by a fixed value in the concerned cases.
%    \begin{macrocode}
    \skip_gset:Nn \g_tmpa_skip { 0 pt~plus 1 fill } 
    \bool_if:NF \l_@@_auto_columns_width_bool
      { \dim_compare:nNnT \l_@@_columns_width_dim > \c_zero_dim }
      {
        \bool_lazy_and:nnTF 
          \l_@@_auto_columns_width_bool 
          { \bool_not_p:n \l_@@_block_auto_columns_width_bool }
          { \skip_gset_eq:NN \g_tmpa_skip \g_@@_max_cell_width_dim } 
          { \skip_gset_eq:NN \g_tmpa_skip \l_@@_columns_width_dim } 
        \skip_gadd:Nn \g_tmpa_skip { 2 \arraycolsep } 
      }
    \skip_horizontal:N \g_tmpa_skip
    \hbox
      { 
        \pgfpicture 
        \pgfrememberpicturepositiononpagetrue
        \pgfcoordinate { \@@_env: - col - 2 } \pgfpointorigin 
        \str_if_empty:NF \l_@@_name_str
          { \pgfnodealias { \@@_env: - col - 2 } { \l_@@_name_str - col - 2 } } 
        \endpgfpicture
      }
%    \end{macrocode}
% We begin a loop over the columns. The integer |\g_tmpa_int| will be the
% number of the current column. This integer is used for the Tikz nodes.
%    \begin{macrocode}
    \int_gset:Nn \g_tmpa_int 1            
    \bool_if:NTF \g_@@_last_col_found_bool
      { \prg_replicate:nn { \g_@@_col_total_int - 2 } }
      { \prg_replicate:nn { \g_@@_col_total_int - 1 } }
      { 
         & 
         \omit
%    \end{macrocode}
% The incrementation of the counter |\g_tmpa_int| must be done after the |\omit|
% of the cell.
%    \begin{macrocode}
         \int_gincr:N \g_tmpa_int 
         \skip_horizontal:N \g_tmpa_skip
%    \end{macrocode}
% We create the ``|col|'' node on the right of the current column.
%    \begin{macrocode}
         \pgfpicture
           \pgfrememberpicturepositiononpagetrue
           \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
             \pgfpointorigin 
           \str_if_empty:NF \l_@@_name_str
             {
               \pgfnodealias 
                 { \@@_env: - col - \@@_succ:n \g_tmpa_int } 
                 { \l_@@_name_str - col - \@@_succ:n \g_tmpa_int }
             }   
         \endpgfpicture  
      }
    \bool_if:NT \g_@@_last_col_found_bool
      {
        \skip_horizontal:N 2\arraycolsep
        \pgfpicture 
        \pgfrememberpicturepositiononpagetrue
        \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } 
          \pgfpointorigin 
        \str_if_empty:NF \l_@@_name_str
          { 
            \pgfnodealias 
              { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } 
              { \l_@@_name_str - col - \@@_succ:n \g_@@_col_total_int } 
          }  
        \endpgfpicture
        \skip_horizontal:N -2\arraycolsep
      }
    \cr
  }
%    \end{macrocode}
%
%
% \interitem
% Here is the preamble for the ``first column'' (if the user uses the key
% |first-col|) 
%    \begin{macrocode}
\tl_const:Nn \c_@@_preamble_first_col_tl
  {
    > 
      { 
        \@@_begin_of_row:
%    \end{macrocode}
% The contents of the cell is constructed in the box |\l_@@_cell_box| because we
% have to compute some dimensions of this box.
%    \begin{macrocode}
        \hbox_set:Nw \l_@@_cell_box 
        \c_math_toggle_token
        \bool_if:NT \l_@@_small_bool \scriptstyle
%    \end{macrocode}
% We insert |\l_@@_code_for_first_col_tl|... but we don't insert it in the
% potential ``first row'' and in the potential ``last row''.
%    \begin{macrocode}
        \bool_lazy_and:nnT
          { \int_compare_p:nNn \c@iRow > 0 }
          {
            \bool_lazy_or_p:nn
              { \int_compare_p:nNn \l_@@_last_row_int < 0 }
              { \int_compare_p:nNn \c@iRow < \l_@@_last_row_int }
          }
          { 
            \l_@@_code_for_first_col_tl 
            \xglobal \colorlet { nicematrix-first-col } { . }
          }
      }
%    \end{macrocode}
% Be careful: despite this letter |l| the cells of the ``first column'' are
% composed in a |R| manner since they are composed in a |\hbox_overlap_left:n|.
%    \begin{macrocode}
    l
    < 
      { 
        \c_math_toggle_token
        \hbox_set_end:
        \@@_update_for_first_and_last_row:
%    \end{macrocode}
% We actualise the width of the ``first column'' because we will use this width
% after the construction of the array.
%    \begin{macrocode}
        \dim_gset:Nn \g_@@_width_first_col_dim
          { \dim_max:nn \g_@@_width_first_col_dim { \box_wd:N \l_@@_cell_box } }
%    \end{macrocode}
% The content of the cell is inserted in an overlapping position.
% \label{overlap-left}
%    \begin{macrocode}
        \hbox_overlap_left:n
          { 
            \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim
              \@@_node_for_the_cell:
              { \box_use_drop:N \l_@@_cell_box }
            \skip_horizontal:N \l_@@_left_delim_dim
            \skip_horizontal:N \l_@@_left_margin_dim 
            \skip_horizontal:N \l_@@_extra_left_margin_dim
          }
        \skip_horizontal:N -2\arraycolsep 
      }
  }
%    \end{macrocode}
%
%
% Here is the preamble for the ``last column'' (if the user uses the key
% |last-col|).
%    \begin{macrocode}
\tl_const:Nn \c_@@_preamble_last_col_tl
  {
    > 
      { 
%    \end{macrocode}
% With the flag |\g_@@_last_col_found_bool|, we will know that the ``last
% column'' is really used.
%    \begin{macrocode}           
        \bool_gset_true:N \g_@@_last_col_found_bool
        \int_gincr:N \c@jCol
        \int_gset_eq:NN \g_@@_col_total_int \c@jCol
%    \end{macrocode}
% The contents of the cell is constructed in the box |\l_tmpa_box| because we
% have to compute some dimensions of this box.
%    \begin{macrocode}
        \hbox_set:Nw \l_@@_cell_box 
          \c_math_toggle_token
          \bool_if:NT \l_@@_small_bool \scriptstyle 
%    \end{macrocode}
% We insert |\l_@@_code_for_last_col_tl|... but we don't insert it in the
% potential ``first row'' and in the potential ``last row''.
%    \begin{macrocode}
        \int_compare:nNnT \c@iRow > 0 
          {
            \bool_lazy_or:nnT
              { \int_compare_p:nNn \l_@@_last_row_int < 0 }
              { \int_compare_p:nNn \c@iRow < \l_@@_last_row_int }
              { 
                \l_@@_code_for_last_col_tl 
                \xglobal \colorlet { nicematrix-last-col } { . }
              }  
          }
      }
    l
    < 
      { 
        \c_math_toggle_token
        \hbox_set_end:
        \@@_update_for_first_and_last_row:
%    \end{macrocode}
% We actualise the width of the ``last column'' because we will use this width
% after the construction of the array.
%    \begin{macrocode}
        \dim_gset:Nn \g_@@_width_last_col_dim
          { \dim_max:nn \g_@@_width_last_col_dim { \box_wd:N \l_@@_cell_box } }
        \skip_horizontal:N -2\arraycolsep 
%    \end{macrocode}
% The content of the cell is inserted in an overlapping position.
% \label{overlap-right}
%    \begin{macrocode}
        \hbox_overlap_right:n
          { 
            \dim_compare:nNnT { \box_wd:N \l_@@_cell_box } > \c_zero_dim
              {
                \skip_horizontal:N \l_@@_right_delim_dim 
                \skip_horizontal:N \l_@@_right_margin_dim 
                \skip_horizontal:N \l_@@_extra_right_margin_dim
                \@@_node_for_the_cell:
              }
          } 
      }
  }
%    \end{macrocode}
%
%
% \interitem
% The environment |{NiceArray}| is constructed upon the environment
% |{NiceArrayWithDelims}| but, in fact, there is a flag |\l_@@_NiceArray_bool|.
% In |{NiceArrayWithDelims}|, some special code will be executed if this flag is
% raised. 
%    \begin{macrocode}
\NewDocumentEnvironment { NiceArray } { }
  { 
    \bool_set_true:N \l_@@_NiceArray_bool
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { NiceArray } }  
%    \end{macrocode}
% We put . and . for the delimiters but, in fact, that doesn't matter because
% these arguments won't be used in |{NiceArrayWithDelims}| (because the flag
% |\l_@@_NiceArray_bool| is raised).
%    \begin{macrocode} 
    \NiceArrayWithDelims . . 
  }
  { \endNiceArrayWithDelims }
%    \end{macrocode}
%               
% 
% \interitem
% We create the variants of the environment |{NiceArrayWithDelims}|. 
%
%   \begin{macrocode}
\NewDocumentEnvironment { pNiceArray } { }
  {
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { pNiceArray } } 
    \@@_test_if_math_mode:
    \NiceArrayWithDelims ( )
  }
  { \endNiceArrayWithDelims }
%    \end{macrocode}
%               
%   \begin{macrocode}
\NewDocumentEnvironment { bNiceArray } { }
  {
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { bNiceArray } } 
    \@@_test_if_math_mode:
    \NiceArrayWithDelims [ ]
  }
  { \endNiceArrayWithDelims }
%    \end{macrocode}
%               
%   \begin{macrocode}
\NewDocumentEnvironment { BNiceArray } { }
  {
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { BNiceArray } } 
    \@@_test_if_math_mode:
    \NiceArrayWithDelims \{ \}
  }
  { \endNiceArrayWithDelims }
%    \end{macrocode} 
%               
%   \begin{macrocode}
\NewDocumentEnvironment { vNiceArray } { }
  {
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { vNiceArray } } 
    \@@_test_if_math_mode:
    \NiceArrayWithDelims | |
  }
  { \endNiceArrayWithDelims }
%    \end{macrocode}
%               
%   \begin{macrocode}
\NewDocumentEnvironment { VNiceArray } { }
  {
    \str_if_empty:NT \g_@@_name_env_str 
      { \str_gset:Nn \g_@@_name_env_str { VNiceArray } } 
    \@@_test_if_math_mode:
    \NiceArrayWithDelims \| \|
  }
  { \endNiceArrayWithDelims }
%    \end{macrocode}
%
% \bigskip
% \subsection*{The environment \{NiceMatrix\} and its variants}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_define_env:n #1
  {
    \NewDocumentEnvironment { #1 NiceMatrix } { ! O { } }
      {
        \str_gset:Nn \g_@@_name_env_str { #1 NiceMatrix } 
        \tl_set:Nn \l_@@_type_of_col_tl C
        \keys_set:nn { NiceMatrix / NiceMatrix } { ##1 }
        \exp_args:Nnx \@@_begin_of_NiceMatrix:nn { #1 } \l_@@_type_of_col_tl 
      }
      { \end { #1 NiceArray } }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_begin_of_NiceMatrix:nn #1 #2
  {
    \begin { #1 NiceArray } 
      { 
        * 
          { 
            \int_compare:nNnTF \l_@@_last_col_int < 0
              \c@MaxMatrixCols
              { \@@_pred:n \l_@@_last_col_int }
          } 
          #2
      } 
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_define_env:n { }
\@@_define_env:n p 
\@@_define_env:n b 
\@@_define_env:n B
\@@_define_env:n v
\@@_define_env:n V
%    \end{macrocode}
%
% 
%
% 
% \bigskip
% \subsection*{After the construction of the array}
%
% \medskip 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_after_array:
  { 
    \group_begin:
%    \end{macrocode}
% When the option |last-col| is used in the environments with explicit preambles
% (like |{NiceArray}|, |{pNiceArray}|, etc.) a special type of column is used at
% the end of the preamble in order to compose the cells in an overlapping
% position (with |\hbox_overlap_right:n|) but (if |last-col| has been used), we
% don't have the number of that last column. However, we have to know that
% number for the color of the potential |\Vdots| drawn in that last column.
% That's why we fix the correct value of |\l_@@_last_col_int| in that case.
%    \begin{macrocode}
    \bool_if:NT \g_@@_last_col_found_bool
      { \int_set_eq:NN \l_@@_last_col_int \g_@@_col_total_int } 
%    \end{macrocode}
%
% If we are in an environment without preamble (like |{NiceMatrix}| or
% |{pNiceMatrix}|) and if the option |last-col| has been used without value
% we fix the real value of |\l_@@_last_col_int|.
%    \begin{macrocode}
    \bool_if:NT \l_@@_last_col_without_value_bool
      {
        \dim_set_eq:NN \l_@@_last_col_int \g_@@_col_total_int 
        \iow_shipout:Nn \@mainaux \ExplSyntaxOn 
        \iow_shipout:Nx \@mainaux 
          { 
            \cs_gset:cpn { @@_last_col_ \int_use:N \g_@@_env_int } 
              { \int_use:N \g_@@_col_total_int }
          }   
        \str_if_empty:NF \l_@@_name_str
          { 
            \iow_shipout:Nx \@mainaux 
              { 
                \cs_gset:cpn { @@_last_col_ \l_@@_name_str } 
                  { \int_use:N \g_@@_col_total_int }
              }  
          }
        \iow_shipout:Nn \@mainaux \ExplSyntaxOff 
      }
%    \end{macrocode}
% 
% It's also time to give to |\l_@@_last_row_int| its real value. But, if the
% user had used the option |last-row| without value, we write in the |aux| file
% the number of that last row for the next run.
%    \begin{macrocode}
    \bool_if:NT \l_@@_last_row_without_value_bool
      {
        \dim_set_eq:NN \l_@@_last_row_int \g_@@_row_total_int
%    \end{macrocode}
% If the option |light-syntax| is used, we have nothing to write since, in this
% case, the number of rows is directly determined.
%    \begin{macrocode}
        \bool_if:NF \l_@@_light_syntax_bool
          {
            \iow_shipout:Nn \@mainaux \ExplSyntaxOn 
            \iow_shipout:Nx \@mainaux 
              { 
                \cs_gset:cpn { @@_last_row_ \int_use:N \g_@@_env_int } 
                  { \int_use:N \g_@@_row_total_int }
              }   
%    \end{macrocode}
% If the environment has a name, we also write a value based on the name
% because it's more reliable than a value based on the number of the
% environment. 
%    \begin{macrocode}
            \str_if_empty:NF \l_@@_name_str
              { 
                \iow_shipout:Nx \@mainaux 
                  { 
                    \cs_gset:cpn { @@_last_row_ \l_@@_name_str } 
                      { \int_use:N \g_@@_row_total_int }
                  }  
              }
            \iow_shipout:Nn \@mainaux \ExplSyntaxOff 
          }
      }
%    \end{macrocode}
% 
%
% By default, the diagonal lines will be parallelized\footnote{It's possible to
% use the option |parallelize-diags| to disable this parallelization.}. There
% are two types of diagonals lines: the $|\Ddots|$ diagonals and the |\Iddots|
% diagonals. We have to count both types in order to know whether a diagonal is
% the first of its type in the current |{NiceArray}| environment.
%    \begin{macrocode}
    \bool_if:NT \l_@@_parallelize_diags_bool
      { 
        \int_gzero_new:N \g_@@_ddots_int
        \int_gzero_new:N \g_@@_iddots_int
%    \end{macrocode}
%
% The dimensions |\g_@@_delta_x_one_dim| and |\g_@@_delta_y_one_dim| will
% contain the $\Delta_x$ and $\Delta_y$ of the first |\Ddots| diagonal. We have
% to store these values in order to draw the others |\Ddots| diagonals parallel
% to the first one. Similarly |\g_@@_delta_x_two_dim| and
% |\g_@@_delta_y_two_dim| are the $\Delta_x$ and $\Delta_y$ of the first
% |\Iddots| diagonal. 
%    \begin{macrocode}
        \dim_gzero_new:N \g_@@_delta_x_one_dim
        \dim_gzero_new:N \g_@@_delta_y_one_dim
        \dim_gzero_new:N \g_@@_delta_x_two_dim
        \dim_gzero_new:N \g_@@_delta_y_two_dim
      }
%    \end{macrocode}
%
%    \begin{macrocode}
    \bool_if:nTF \l_@@_medium_nodes_bool
      { 
        \bool_if:NTF \l_@@_large_nodes_bool
          \@@_create_medium_and_large_nodes:
          \@@_create_medium_nodes:
      }
      { \bool_if:NT \l_@@_large_nodes_bool \@@_create_large_nodes: }
    \int_zero_new:N \l_@@_initial_i_int
    \int_zero_new:N \l_@@_initial_j_int
    \int_zero_new:N \l_@@_final_i_int
    \int_zero_new:N \l_@@_final_j_int
    \bool_set_false:N \l_@@_initial_open_bool
    \bool_set_false:N \l_@@_final_open_bool
%    \end{macrocode}
%
% If the option |small| is used, the values |\l_@@_radius_dim| and
% |\l_@@_inter_dots_dim| (used to draw the dotted lines created by
% |\hdottedline| and |\vdotteline| and also for all the other dotted lines when
% |line-style| is equal to |standard|, which is the initial value) are changed.
%    \begin{macrocode}     
    \bool_if:NT \l_@@_small_bool 
      { 
        \dim_set:Nn \l_@@_radius_dim { 0.37 pt }
        \dim_set:Nn \l_@@_inter_dots_dim { 0.25 em } 
%    \end{macrocode}
% The dimension |\l_@@_xdots_shorten_dim| corresponds to the option
% |xdots/shorten| available to the user. That's why we give a new value
% according to the current value, and not an absolute value.
%    \begin{macrocode}
        \dim_set:Nn \l_@@_xdots_shorten_dim { 0.6 \l_@@_xdots_shorten_dim }
      }
%    \end{macrocode}
%
%
% \bigskip
% Now, we really draw the lines. 
%    \begin{macrocode}
    \@@_draw_dotted_lines:
%    \end{macrocode}
% 
% We draw the vertical rules of the option |vlines| before the
% |internal-code-after| because the option |white| of a |\Block| may have to
% erase these vertical rules.
%    \begin{macrocode}
    \bool_if:NT \l_@@_vlines_bool \@@_draw_vlines:
    \g_@@_internal_code_after_tl
    \tl_gclear:N \g_@@_internal_code_after_tl
    \bool_if:NT \c_@@_tikz_loaded_bool
      {  
        \tikzset 
          { 
            every~picture / .style = 
              { 
                overlay ,
                remember~picture ,
                name~prefix = \@@_env: - 
              }
          }  
      }
    \cs_set_eq:NN \line \@@_line
    \g_@@_code_after_tl 
    \tl_gclear:N \g_@@_code_after_tl
    \group_end:
    \str_gclear:N \g_@@_name_env_str
    \@@_restore_iRow_jCol:
  }
%    \end{macrocode}
%
% \bigskip
% We recall that, when externalization is used, |\tikzpicture| and
% |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly
% ``visible''. That's why we have to define the adequate version of
% |\@@_draw_dotted_lines:| whether Tikz is loaded or not (in that case, only
% \textsc{pgf} is loaded).
%    \begin{macrocode}
\AtBeginDocument
  {
    \cs_new_protected:Npx \@@_draw_dotted_lines:
      {
        \c_@@_pgfortikzpicture_tl
        \@@_draw_dotted_lines_i:
        \c_@@_endpgfortikzpicture_tl
      }
  }
%    \end{macrocode}
%
% The following command \emph{must} be protected because it will appear in the
% construction of the command |\@@_draw_dotted_lines:|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_dotted_lines_i:
  {
    \pgfrememberpicturepositiononpagetrue
    \pgf@relevantforpicturesizefalse
    \g_@@_Hdotsfor_lines_tl
    \g_@@_Vdots_lines_tl
    \g_@@_Ddots_lines_tl
    \g_@@_Iddots_lines_tl
    \g_@@_Cdots_lines_tl
    \g_@@_Ldots_lines_tl
  }
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_restore_iRow_jCol:
  {
    \cs_if_exist:NT \theiRow { \int_gset_eq:NN \c@iRow \l_@@_save_iRow_int } 
    \cs_if_exist:NT \thejCol { \int_gset_eq:NN \c@jCol \l_@@_save_jCol_int } 
  }
%    \end{macrocode}
%
% \bigskip
% A dotted line will be said \emph{open} in one of its extremities when it stops
% on the edge of the matrix and \emph{closed} otherwise. In the following
% matrix, the dotted line is closed on its left extremity and open on its right.
% \[ \begin{pNiceMatrix}
% a+b+c & a+b & a\\
% a & \Cdots \\
% a & a+b & a+b+c
% \end{pNiceMatrix}\]
%
% 
% \bigskip
% The command |\@@_find_extremities_of_line:nnnn| takes four arguments:
%
% \begin{itemize}
% \item the first argument is the row of the cell where the command was issued;
% \item the second argument is the column of the cell where the command was
% issued; 
% \item the third argument is the $x$-value of the orientation vector of the
% line; 
% \item the fourth argument is the $y$-value of the orientation vector of the
% line.
% \end{itemize}
%
% This command computes:
%
% \begin{itemize}
% \item |\l_@@_initial_i_int| and |\l_@@_initial_j_int| which are the
% coordinates of one extremity of the line; 
% \item |\l_@@_final_i_int| and |\l_@@_final_j_int| which are the coordinates of
% the other extremity of the line; 
% \item |\l_@@_initial_open_bool| and |\l_@@_final_open_bool| to indicate
% whether the extremities are open or not. 
% \end{itemize}
%
%    \begin{macrocode}       
\cs_new_protected:Npn \@@_find_extremities_of_line:nnnn #1 #2 #3 #4
  { 
%    \end{macrocode}
% First, we declare the current cell as ``dotted'' because we forbide
% intersections of dotted lines.
%    \begin{macrocode}         
    \cs_set:cpn { @@ _ dotted _ #1 - #2 } { }
%    \end{macrocode}
% Initialization of variables.
%    \begin{macrocode}
    \int_set:Nn \l_@@_initial_i_int { #1 }
    \int_set:Nn \l_@@_initial_j_int { #2 }
    \int_set:Nn \l_@@_final_i_int { #1 }
    \int_set:Nn \l_@@_final_j_int { #2 }
%    \end{macrocode}
% We will do two loops: one when determinating the initial cell and the other
% when determinating the final cell. The boolean |\l_@@_stop_loop_bool| will be
% used to control these loops. In the first loop, we search the ``final''
% extremity of the line.
%    \begin{macrocode}
    \bool_set_false:N \l_@@_stop_loop_bool
    \bool_do_until:Nn \l_@@_stop_loop_bool 
      { 
        \int_add:Nn \l_@@_final_i_int { #3 }
        \int_add:Nn \l_@@_final_j_int { #4 }
%    \end{macrocode}
% We test if we are still in the matrix. 
%    \begin{macrocode}
        \bool_set_false:N \l_@@_final_open_bool
        \int_compare:nNnTF \l_@@_final_i_int > \c@iRow
          {
            \int_compare:nNnTF { #3 } = 1
              { \bool_set_true:N \l_@@_final_open_bool }
              {
                \int_compare:nNnT \l_@@_final_j_int > \c@jCol
                  { \bool_set_true:N \l_@@_final_open_bool }
              }
          }
          {
            \int_compare:nNnTF \l_@@_final_j_int < 1
              { 
                \int_compare:nNnT { #4 } = { -1 }
                  { \bool_set_true:N \l_@@_final_open_bool }
              }
              {
                \int_compare:nNnT \l_@@_final_j_int > \c@jCol
                  { 
                    \int_compare:nNnT { #4 } = 1
                      { \bool_set_true:N \l_@@_final_open_bool }
                  }
              }
          }
        \bool_if:NTF \l_@@_final_open_bool 
%    \end{macrocode}
% If we are outside the matrix, we have found the extremity of the dotted line
% and it's an \emph{open} extremity. 
%    \begin{macrocode}
          { 
%    \end{macrocode}
% We do a step backwards.
%    \begin{macrocode}  
            \int_sub:Nn \l_@@_final_i_int { #3 }
            \int_sub:Nn \l_@@_final_j_int { #4 }
            \bool_set_true:N \l_@@_stop_loop_bool
          }
%    \end{macrocode}
% If we are in the matrix, we test whether the cell is empty. If it's not the
% case, we stop the loop because we have found the correct values for
% |\l_@@_final_i_int| and |\l_@@_final_j_int|. 
%    \begin{macrocode}
          { 
            \cs_if_exist:cTF
              { 
                @@ _ dotted _ 
                \int_use:N \l_@@_final_i_int - 
                \int_use:N \l_@@_final_j_int 
              }
              {
                \int_sub:Nn \l_@@_final_i_int { #3 }
                \int_sub:Nn \l_@@_final_j_int { #4 }
                \bool_set_true:N \l_@@_final_open_bool
                \bool_set_true:N \l_@@_stop_loop_bool
              }
              { 
                \cs_if_exist:cTF 
                  { 
                    pgf @ sh @ ns @ \@@_env: 
                    - \int_use:N \l_@@_final_i_int 
                    - \int_use:N \l_@@_final_j_int 
                  }
                  { \bool_set_true:N \l_@@_stop_loop_bool }
%    \end{macrocode}
% If the case is empty, we declare that the cell as non-empty. Indeed, we will
% draw a dotted line and the cell will be on that dotted line. All the cells of
% a dotted line have to be mark as ``dotted'' because we don't want
% intersections between dotted lines. We recall that the research of the
% extremities of the lines are all done in the same TeX group (the group of the
% environnement), even though, when the extremities are found, each line is
% drawn in a TeX group that we will open for the options of the line.
%    \begin{macrocode} 
                  { 
                    \cs_set:cpn 
                      { 
                        @@ _ dotted _
                        \int_use:N \l_@@_final_i_int - 
                        \int_use:N \l_@@_final_j_int 
                      } 
                      { }
                  }   
              }
          }
      }
%    \end{macrocode}
%
% \interitem
% For |\l_@@_initial_i_int| and |\l_@@_initial_j_int| the programmation is
% similar to the previous one.
%    \begin{macrocode}
    \bool_set_false:N \l_@@_stop_loop_bool
    \bool_do_until:Nn \l_@@_stop_loop_bool 
      { 
        \int_sub:Nn \l_@@_initial_i_int { #3 }
        \int_sub:Nn \l_@@_initial_j_int { #4 }
        \bool_set_false:N \l_@@_initial_open_bool
        \int_compare:nNnTF \l_@@_initial_i_int < 1
          {
            \int_compare:nNnTF { #3 } = 1
              { \bool_set_true:N \l_@@_initial_open_bool }
              {
                \int_compare:nNnT \l_@@_initial_j_int = 0 
                  { \bool_set_true:N \l_@@_initial_open_bool }
              }
          }
          { 
            \int_compare:nNnTF \l_@@_initial_j_int < 1
              { 
                \int_compare:nNnT { #4 } = 1
                  { \bool_set_true:N \l_@@_initial_open_bool }
              }
              { 
                \int_compare:nNnT \l_@@_initial_j_int > \c@jCol
                  { 
                    \int_compare:nNnT { #4 } = { -1 }
                      { \bool_set_true:N \l_@@_initial_open_bool }
                  }
              }
          }
        \bool_if:NTF \l_@@_initial_open_bool
          { 
            \int_add:Nn \l_@@_initial_i_int { #3 }
            \int_add:Nn \l_@@_initial_j_int { #4 }
            \bool_set_true:N \l_@@_stop_loop_bool
          }
          { 
            \cs_if_exist:cTF
              { 
                @@ _ dotted _ 
                \int_use:N \l_@@_initial_i_int - 
                \int_use:N \l_@@_initial_j_int 
              }
              {
                \int_add:Nn \l_@@_initial_i_int { #3 }
                \int_add:Nn \l_@@_initial_j_int { #4 }
                \bool_set_true:N \l_@@_initial_open_bool
                \bool_set_true:N \l_@@_stop_loop_bool
              }
              {
                \cs_if_exist:cTF 
                  { 
                    pgf @ sh @ ns @ \@@_env: 
                    - \int_use:N \l_@@_initial_i_int 
                    - \int_use:N \l_@@_initial_j_int 
                  }
                  { \bool_set_true:N \l_@@_stop_loop_bool }
                  {
                    \cs_set:cpn 
                      { 
                        @@ _ dotted _ 
                        \int_use:N \l_@@_initial_i_int - 
                        \int_use:N \l_@@_initial_j_int 
                      } 
                      { }
                  } 
              } 
          }
      }
  } 
%    \end{macrocode}
% 
% \medskip
%    \begin{macrocode}
\cs_new:Nn \@@_initial_cell: 
  { \@@_env: - \int_use:N \l_@@_initial_i_int - \int_use:N \l_@@_initial_j_int }  
\cs_new:Nn \@@_final_cell: 
  { \@@_env: - \int_use:N \l_@@_final_i_int - \int_use:N \l_@@_final_j_int }  
\cs_new_protected:Npn \@@_set_initial_coords:
  { 
    \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
    \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
  }
\cs_new_protected:Npn \@@_set_final_coords:
  { 
    \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
    \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
  }
\cs_new_protected:Npn \@@_set_initial_coords_from_anchor:n #1
  {
    \pgfpointanchor \@@_initial_cell: { #1 } 
    \@@_set_initial_coords:
  }
\cs_new_protected:Npn \@@_set_final_coords_from_anchor:n #1
  {
    \pgfpointanchor \@@_final_cell: { #1 } 
    \@@_set_final_coords:
  }
%    \end{macrocode}
%
% \interitem
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Ldots:nnn #1 #2 #3
  { 
    \cs_if_free:cT { @@ _ dotted _ #1 - #2 }
      {
        \@@_find_extremities_of_line:nnnn { #1 } { #2 } 0 1
%    \end{macrocode}
% The previous command may have changed the current environment by marking some
% cells as ``dotted'', but, fortunately, it is outside the group for the options
% of the line.
%    \begin{macrocode}
        \group_begin:
          \int_compare:nNnTF { #1 } = 0
            { \color { nicematrix-first-row } }
            { 
%    \end{macrocode}
% We remind that, when there is a ``last row'' |\l_@@_last_row_int| will always
% be (after the construction of the array) the number of that ``last row'' even
% if the option |last-row| has been used without value.
%    \begin{macrocode}
              \int_compare:nNnT { #1 } = \l_@@_last_row_int
                { \color { nicematrix-last-row } }
            }
          \keys_set:nn { NiceMatrix / xdots } { #3 }
          \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
          \@@_actually_draw_Ldots:
        \group_end:
      }
  }
%    \end{macrocode}
% 
% 
% \medskip
% The command |\@@_actually_draw_Ldots:| has the following implicit arguments: 
% \begin{itemize}
% \item |\l_@@_initial_i_int|
% \item |\l_@@_initial_j_int|
% \item |\l_@@_initial_open_bool|
% \item |\l_@@_final_i_int|
% \item |\l_@@_final_j_int| 
% \item |\l_@@_final_open_bool|. 
% \end{itemize}
%
% The following function is also used by |\Hdotsfor|. 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_actually_draw_Ldots:
  { 
    \bool_if:NTF \l_@@_initial_open_bool
      {
        \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int }
        \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x 
        \dim_add:Nn \l_@@_x_initial_dim \arraycolsep 
        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int - base }
        \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
      }
      { \@@_set_initial_coords_from_anchor:n { base~east } }
    \bool_if:NTF \l_@@_final_open_bool
      {
        \@@_qpoint: { col - \@@_succ:n \l_@@_final_j_int }
        \dim_set_eq:NN \l_@@_x_final_dim \pgf@x 
        \dim_sub:Nn \l_@@_x_final_dim \arraycolsep 
        \@@_qpoint: { row - \int_use:N \l_@@_final_i_int - base }
        \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
      }
      { \@@_set_final_coords_from_anchor:n { base~west } } 
%    \end{macrocode}
% We raise the line of a quantity equal to the radius of the dots because we
% want the dots really ``on'' the line of texte.
%    \begin{macrocode}
    \dim_add:Nn \l_@@_y_initial_dim \l_@@_radius_dim
    \dim_add:Nn \l_@@_y_final_dim \l_@@_radius_dim
    \@@_draw_line:
  }
%    \end{macrocode}
%
% \interitem
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Cdots:nnn #1 #2 #3
  { 
    \cs_if_free:cT { @@ _ dotted _ #1 - #2 }
      {
        \@@_find_extremities_of_line:nnnn { #1 } { #2 } 0 1
%    \end{macrocode}
% The previous command may have changed the current environment by marking some
% cells as ``dotted'', but, fortunately, it is outside the group for the options
% of the line.
%    \begin{macrocode}
        \group_begin:
          \int_compare:nNnTF { #1 } = 0
            { \color { nicematrix-first-row } }
            { 
%    \end{macrocode}
% We remind that, when there is a ``last row'' |\l_@@_last_row_int| will always
% be (after the construction of the array) the number of that ``last row'' even
% if the option |last-row| has been used without value.
%    \begin{macrocode}
              \int_compare:nNnT { #1 } = \l_@@_last_row_int
                { \color { nicematrix-last-row } }
            }
          \keys_set:nn { NiceMatrix / xdots } { #3 }
          \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
          \@@_actually_draw_Cdots: 
        \group_end:
      }
  }
%    \end{macrocode}
%
% \medskip
% The command |\@@_actually_draw_Cdots:| has the following implicit arguments: 
% \begin{itemize}
% \item |\l_@@_initial_i_int|
% \item |\l_@@_initial_j_int|
% \item |\l_@@_initial_open_bool|
% \item |\l_@@_final_i_int|
% \item |\l_@@_final_j_int| 
% \item |\l_@@_final_open_bool|. 
% \end{itemize}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_actually_draw_Cdots:
  {
    \bool_if:NTF \l_@@_initial_open_bool
      { 
        \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int } 
        \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x 
        \dim_add:Nn \l_@@_x_initial_dim \arraycolsep 
      }
      { \@@_set_initial_coords_from_anchor:n { mid~east } }
    \bool_if:NTF \l_@@_final_open_bool
      { 
        \@@_qpoint: { col - \@@_succ:n \l_@@_final_j_int }
        \dim_set_eq:NN \l_@@_x_final_dim \pgf@x 
        \dim_sub:Nn \l_@@_x_final_dim \arraycolsep 
      }
      { \@@_set_final_coords_from_anchor:n { mid~west } }
    \bool_lazy_and:nnTF
      \l_@@_initial_open_bool 
      \l_@@_final_open_bool 
      {
        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int }
        \dim_set_eq:NN \l_tmpa_dim \pgf@y
        \@@_qpoint: { row - \@@_succ:n \l_@@_initial_i_int }
        \dim_set:Nn \l_@@_y_initial_dim { ( \l_tmpa_dim + \pgf@y ) / 2 } 
        \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim
      }     
      {
        \bool_if:NT \l_@@_initial_open_bool
          { \dim_set_eq:NN \l_@@_y_initial_dim \l_@@_y_final_dim }
        \bool_if:NT \l_@@_final_open_bool
          { \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim }
      }
    \@@_draw_line:
  } 
%    \end{macrocode}
%
%
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
%    \begin{macrocode}      
\cs_new_protected:Npn \@@_draw_Vdots:nnn #1 #2 #3
  { 
    \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
    \cs_if_free:cT { @@ _ dotted _ #1 - #2 }
      {
        \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 0
%    \end{macrocode}
% The previous command may have changed the current environment by marking some
% cells as ``dotted'', but, fortunately, it is outside the group for the options
% of the line.
%    \begin{macrocode}
        \group_begin:
          \int_compare:nNnTF { #2 } = 0 
            { \color { nicematrix-first-col } }
            {
              \int_compare:nNnT { #2 } = \l_@@_last_col_int
                { \color { nicematrix-last-col } }
            }
          \keys_set:nn { NiceMatrix / xdots } { #3 }
          \@@_actually_draw_Vdots:
        \group_end:
      }
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_actually_draw_Vdots:| has the following implicit arguments: 
% \begin{itemize}
% \item |\l_@@_initial_i_int|
% \item |\l_@@_initial_j_int|
% \item |\l_@@_initial_open_bool|
% \item |\l_@@_final_i_int|
% \item |\l_@@_final_j_int| 
% \item |\l_@@_final_open_bool|. 
% \end{itemize}
%    \begin{macrocode}
\cs_new_protected:Npn \@@_actually_draw_Vdots:
  {
%    \end{macrocode}
% The boolean |\l_tmpa_bool| indicates whether the column is of type |l| (|L| of
% |{NiceArray}|) or may be considered as if.
%    \begin{macrocode}      
    \bool_set_false:N \l_tmpa_bool 
    \bool_lazy_or:nnF \l_@@_initial_open_bool \l_@@_final_open_bool 
      {
        \@@_set_initial_coords_from_anchor:n { south~west } 
        \@@_set_final_coords_from_anchor:n { north~west } 
        \bool_set:Nn \l_tmpa_bool 
          { \dim_compare_p:nNn \l_@@_x_initial_dim = \l_@@_x_final_dim }
      }
%    \end{macrocode}
% Now, we try to determine whether the column is of type |c| (|C| of
% |{NiceArray}|) or may be considered as if.
%    \begin{macrocode}
    \bool_if:NTF \l_@@_initial_open_bool
      { 
        \@@_qpoint: { row - 1 }
        \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
      }
      { \@@_set_initial_coords_from_anchor:n { south } }
    \bool_if:NTF \l_@@_final_open_bool
      { 
        \@@_qpoint: { row - \@@_succ:n \c@iRow }
        \dim_set_eq:NN \l_@@_y_final_dim \pgf@y 
      }
      { \@@_set_final_coords_from_anchor:n { north } }     
    \bool_if:NTF \l_@@_initial_open_bool
      {
        \bool_if:NTF \l_@@_final_open_bool
          {
            \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int }
            \dim_set_eq:NN \l_tmpa_dim \pgf@x
            \@@_qpoint: { col - \@@_succ:n \l_@@_initial_j_int }
            \dim_set:Nn \l_@@_x_initial_dim { ( \pgf@x + \l_tmpa_dim ) / 2 } 
            \dim_set_eq:NN \l_@@_x_final_dim \l_@@_x_initial_dim
          }
          { \dim_set_eq:NN \l_@@_x_initial_dim \l_@@_x_final_dim }
      }
      {
        \bool_if:NTF \l_@@_final_open_bool
          { \dim_set_eq:NN \l_@@_x_final_dim \l_@@_x_initial_dim }
          {
%    \end{macrocode}
% Now the case where both extremities are closed. The first conditional tests
% whether the column is of type |c| (|C| of |{NiceArray}|) or may be considered
% as if.
%    \begin{macrocode}      
            \dim_compare:nNnF \l_@@_x_initial_dim = \l_@@_x_final_dim 
              { 
                \dim_set:Nn \l_@@_x_initial_dim
                  { 
                    \bool_if:NTF \l_tmpa_bool \dim_min:nn \dim_max:nn
                      \l_@@_x_initial_dim \l_@@_x_final_dim
                  }
                \dim_set_eq:NN \l_@@_x_final_dim \l_@@_x_initial_dim
              }
          }   
      }
    \@@_draw_line:
  }
%    \end{macrocode}
%
% \interitem
% For the diagonal lines, the situation is a bit more complicated because, by
% default, we parallelize the diagonals lines. The first diagonal line is drawn
% and then, all the other diagonal lines are drawn parallel to the first one.
%
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Ddots:nnn #1 #2 #3
  { 
    \cs_if_free:cT { @@ _ dotted _ #1 - #2 }
      { 
        \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 1 
%    \end{macrocode}
% The previous command may have changed the current environment by marking some
% cells as ``dotted'', but, fortunately, it is outside the group for the options
% of the line.
%    \begin{macrocode}
        \group_begin:
          \keys_set:nn { NiceMatrix / xdots } { #3 }
          \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
          \@@_actually_draw_Ddots:
        \group_end:
      }
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_actually_draw_Ddots:| has the following implicit arguments: 
% \begin{itemize}
% \item |\l_@@_initial_i_int|
% \item |\l_@@_initial_j_int|
% \item |\l_@@_initial_open_bool|
% \item |\l_@@_final_i_int|
% \item |\l_@@_final_j_int| 
% \item |\l_@@_final_open_bool|. 
% \end{itemize}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_actually_draw_Ddots:
  {
    \bool_if:NTF \l_@@_initial_open_bool
      {
        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int }
        \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
        \@@_qpoint: { col - \int_use:N \l_@@_initial_j_int }
        \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
      }
      { \@@_set_initial_coords_from_anchor:n { south~east } }
    \bool_if:NTF \l_@@_final_open_bool
      {
        \@@_qpoint: { row - \@@_succ:n \l_@@_final_i_int }
        \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
        \@@_qpoint: { col - \@@_succ:n \l_@@_final_j_int }
        \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
      }
      { \@@_set_final_coords_from_anchor:n { north~west } }     
%    \end{macrocode}
% We have retrieved the coordinates in the usual way (they are stored in
% |\l_@@_x_initial_dim|, etc.). If the parallelization of the diagonals is set,
% we will have (maybe) to adjust the fourth coordinate. 
%    \begin{macrocode}
    \bool_if:NT \l_@@_parallelize_diags_bool
      { 
        \int_gincr:N \g_@@_ddots_int
%    \end{macrocode}
% We test if the diagonal line is the first one (the counter |\g_@@_ddots_int|
% is created for this usage). 
%    \begin{macrocode}
        \int_compare:nNnTF \g_@@_ddots_int = 1
%    \end{macrocode}
% If the diagonal line is the first one, we have no adjustment of the line to do
% but we store the $\Delta_x$ and the $\Delta_y$ of the line because these
% values will be used to draw the others diagonal lines parallels to the first
% one. 
%    \begin{macrocode}
          { 
            \dim_gset:Nn \g_@@_delta_x_one_dim 
              { \l_@@_x_final_dim - \l_@@_x_initial_dim }
            \dim_gset:Nn \g_@@_delta_y_one_dim 
              { \l_@@_y_final_dim - \l_@@_y_initial_dim }
          }
%    \end{macrocode}
% If the diagonal line is not the first one, we have to adjust the second
% extremity of the line by modifying the coordinate |\l_@@_x_initial_dim|.
%    \begin{macrocode}
          { 
            \dim_set:Nn \l_@@_y_final_dim          
              { 
                \l_@@_y_initial_dim +
                ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) * 
                \dim_ratio:nn \g_@@_delta_y_one_dim \g_@@_delta_x_one_dim 
              }
          }
      }
    \@@_draw_line:
  }
%    \end{macrocode}
%
% \bigskip
% We draw the |\Iddots| diagonals in the same way.
%
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Iddots:nnn #1 #2 #3 
  {
    \cs_if_free:cT { @@ _ dotted _ #1 - #2 }
      { 
        \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 { -1 }
%    \end{macrocode}
% The previous command may have changed the current environment by marking some
% cells as ``dotted'', but, fortunately, it is outside the group for the options
% of the line.
%    \begin{macrocode}
        \group_begin:
          \keys_set:nn { NiceMatrix / xdots } { #3 }
          \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
          \@@_actually_draw_Iddots:
        \group_end:
      }
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_actually_draw_Iddots:| has the following implicit arguments: 
% \begin{itemize}
% \item |\l_@@_initial_i_int|
% \item |\l_@@_initial_j_int|
% \item |\l_@@_initial_open_bool|
% \item |\l_@@_final_i_int|
% \item |\l_@@_final_j_int| 
% \item |\l_@@_final_open_bool|. 
% \end{itemize}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_actually_draw_Iddots:
  {
    \bool_if:NTF \l_@@_initial_open_bool
      {
        \@@_qpoint: { row - \int_use:N \l_@@_initial_i_int }
        \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
        \@@_qpoint: { col - \@@_succ:n \l_@@_initial_j_int }
        \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
      }
      { \@@_set_initial_coords_from_anchor:n { south~west } }
    \bool_if:NTF \l_@@_final_open_bool
      {
        \@@_qpoint: { row - \@@_succ:n \l_@@_final_i_int }
        \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
        \@@_qpoint: { col - \int_use:N \l_@@_final_j_int }
        \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
      }
      { \@@_set_final_coords_from_anchor:n { north~east } } 
    \bool_if:NT \l_@@_parallelize_diags_bool
      { 
        \int_gincr:N \g_@@_iddots_int
        \int_compare:nNnTF \g_@@_iddots_int = 1
          { 
            \dim_gset:Nn \g_@@_delta_x_two_dim 
              { \l_@@_x_final_dim - \l_@@_x_initial_dim }
            \dim_gset:Nn \g_@@_delta_y_two_dim 
              { \l_@@_y_final_dim - \l_@@_y_initial_dim }
          }
          { 
            \dim_set:Nn \l_@@_y_final_dim
              { 
                \l_@@_y_initial_dim +
                ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) *
                \dim_ratio:nn \g_@@_delta_y_two_dim \g_@@_delta_x_two_dim 
              }
          }
      }
    \@@_draw_line:
  }
%    \end{macrocode}
%
% 
% \bigskip
% The command |\NiceMatrixLastEnv| is not used by the package \pkg{nicematrix}.
% It's only a facility given to the final user. It gives the number of the last
% environment (in fact the number of the current environment but it's meant to
% be used after the environment in order to refer to that environment --- and
% its nodes --- without having to give it a name).
%    \begin{macrocode}
\NewExpandableDocumentCommand \NiceMatrixLastEnv { } 
  { \int_use:N \g_@@_env_int } 
%    \end{macrocode}
%
% \bigskip
% \subsection*{The actual instructions for drawing the dotted line with Tikz}
%
% The command |\@@_draw_line:| should be used in a |{pgfpicture}|. It has six
% implicit arguments:
%
% \begin{itemize}
% \item |\l_@@_x_initial_dim| 
% \item |\l_@@_y_initial_dim| 
% \item |\l_@@_x_final_dim|
% \item |\l_@@_y_final_dim|
% \item |\l_@@_initial_open_bool|
% \item |\l_@@_final_open_bool|
% \end{itemize}
%
%
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_line:
  {
    \pgfrememberpicturepositiononpagetrue
    \pgf@relevantforpicturesizefalse
    \tl_if_eq:NNTF \l_@@_xdots_line_style_tl \c_@@_standard_tl
      \@@_draw_standard_dotted_line:
      \@@_draw_non_standard_dotted_line:
  }
%    \end{macrocode}
% 
% \medskip
% We have to do a special construction with |\exp_args:NV| to be able to put in
% the list of options in the correct place in the Tikz instruction.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:
  { 
     \begin { scope }
     \exp_args:No \@@_draw_non_standard_dotted_line:n 
       { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl } 
  }
%    \end{macrocode}
% We have used the fact that, in \textsc{pgf}, un color name can be put directly
% in a list of options (that's why we have put diredtly |\l_@@_xdots_color_tl|).
%
% \smallskip
% The argument of |\@@_draw_non_standard_dotted_line:n| is, in fact, the list of options.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:n #1
  {
    \draw 
      [ 
        #1 , 
        shorten~> = \l_@@_xdots_shorten_dim , 
        shorten~< = \l_@@_xdots_shorten_dim , 
      ]
          ( \l_@@_x_initial_dim , \l_@@_y_initial_dim )
       -- node [ sloped , above ] 
            { \c_math_toggle_token \scriptstyle \l_@@_xdots_up_tl \c_math_toggle_token } 
          node [ sloped , below ] 
            { 
              \c_math_toggle_token 
              \scriptstyle \l_@@_xdots_down_tl
              \c_math_toggle_token 
            } 
          ( \l_@@_x_final_dim , \l_@@_y_final_dim ) ;
    \end { scope }
  }
%    \end{macrocode}
% 
% \bigskip
% The command |\@@_draw_standard_dotted_line:| draws the line with our system of points
% (which give a dotted line with real round points).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_standard_dotted_line: 
  { 
%    \end{macrocode}
%  First, we put the labels.
%    \begin{macrocode}
    \bool_lazy_and:nnF
      { \tl_if_empty_p:N \l_@@_xdots_up_tl }
      { \tl_if_empty_p:N \l_@@_xdots_down_tl }
      {
        \pgfscope
        \pgftransformshift 
          { 
            \pgfpointlineattime { 0.5 }
              { \pgfpoint \l_@@_x_initial_dim  \l_@@_y_initial_dim }
              { \pgfpoint \l_@@_x_final_dim \l_@@_y_final_dim }
          } 
        \pgftransformrotate
          {
            \fp_eval:n 
              { 
                atand 
                 ( 
                  \l_@@_y_final_dim - \l_@@_y_initial_dim ,
                   \l_@@_x_final_dim - \l_@@_x_initial_dim 
                  ) 
              }        
          }
        \pgfnode 
          { rectangle } 
          { south } 
          { 
            \c_math_toggle_token 
            \scriptstyle \l_@@_xdots_up_tl 
            \c_math_toggle_token
          }
          { } 
          { \pgfusepath { } }
        \pgfnode 
          { rectangle } 
          { north } 
          {
            \c_math_toggle_token 
            \scriptstyle \l_@@_xdots_down_tl
            \c_math_toggle_token 
          }
          { } 
          { \pgfusepath { } }
        \endpgfscope
      }
    \pgfrememberpicturepositiononpagetrue
    \pgf@relevantforpicturesizefalse
    \group_begin:
%    \end{macrocode}
% The dimension |\l_@@_l_dim| is the length $\ell$ of the line to draw. We use
% the floating point reals of \pkg{expl3} to compute this length.
%    \begin{macrocode}
      \dim_zero_new:N \l_@@_l_dim
      \dim_set:Nn \l_@@_l_dim
        { 
          \fp_to_dim:n 
            { 
              sqrt 
               ( 
                 ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) ^ 2
                    +
                 ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) ^ 2 
               )
            }
        }
%    \end{macrocode}
% It seems that, during the first compilations, the value of |\l_@@_l_dim| may
% be erroneous (equal to zero or very large). We must detect these cases
% because they would cause errors during the drawing of the dotted line. Maybe
% we should also write something in the |aux| file to say that one more
% compilation should be done.
%    \begin{macrocode}
      \bool_lazy_or:nnF 
        { \dim_compare_p:nNn { \dim_abs:n \l_@@_l_dim } > \c_@@_max_l_dim }
        { \dim_compare_p:nNn \l_@@_l_dim = \c_zero_dim }
        \@@_draw_standard_dotted_line_i:
    \group_end:
  } 
%    \end{macrocode}
%
%    \begin{macrocode}
\dim_const:Nn \c_@@_max_l_dim { 50 cm }
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_standard_dotted_line_i:
  { 
%    \end{macrocode}
% The integer |\l_tmpa_int| is the number of dots of the dotted line.
%    \begin{macrocode}
    \bool_if:NTF \l_@@_initial_open_bool
      { 
        \bool_if:NTF \l_@@_final_open_bool
          { 
            \int_set:Nn \l_tmpa_int 
              { \dim_ratio:nn \l_@@_l_dim \l_@@_inter_dots_dim }
          }
          { 
            \int_set:Nn \l_tmpa_int 
              { 
                \dim_ratio:nn 
                  { \l_@@_l_dim - \l_@@_xdots_shorten_dim } 
                  \l_@@_inter_dots_dim 
              }
          }
      }
      { 
        \bool_if:NTF \l_@@_final_open_bool
          { 
            \int_set:Nn \l_tmpa_int 
              { 
                \dim_ratio:nn 
                  { \l_@@_l_dim - \l_@@_xdots_shorten_dim } 
                  \l_@@_inter_dots_dim 
              }
          }
          { 
            \int_set:Nn \l_tmpa_int 
              { 
                \dim_ratio:nn 
                  { \l_@@_l_dim - 2 \l_@@_xdots_shorten_dim  } 
                  \l_@@_inter_dots_dim
              }
          }
      }
%    \end{macrocode}
% The dimensions |\l_tmpa_dim| and |\l_tmpb_dim| are the coordinates of the
% vector between two dots in the dotted line.
%    \begin{macrocode}
    \dim_set:Nn \l_tmpa_dim 
      { 
        ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) *
        \dim_ratio:nn \l_@@_inter_dots_dim \l_@@_l_dim 
      }
    \dim_set:Nn \l_tmpb_dim 
      { 
        ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) *
        \dim_ratio:nn \l_@@_inter_dots_dim \l_@@_l_dim
      }
%    \end{macrocode}
%
% The length $\ell$ is the length of the dotted line. We note $\Delta$ the
% length between two dots and $n$ the number of intervals between dots. We note
% $\delta = \frac12(\ell - n \Delta)$. The distance between the initial
% extremity of the line and the first dot will be equal to $k\cdot\delta$ where 
% $k=0$, $1$ or $2$. We first compute this number $k$ in |\l_tmpb_int|.
%    \begin{macrocode}
    \int_set:Nn \l_tmpb_int
      { 
        \bool_if:NTF \l_@@_initial_open_bool
          { \bool_if:NTF \l_@@_final_open_bool 1 0 }
          { \bool_if:NTF \l_@@_final_open_bool 2 1 }
      }
%    \end{macrocode}
% In the loop over the dots, the dimensions |\l_@@_x_initial_dim| and
% |\l_@@_y_initial_dim| will be used for the coordinates of the dots. But,
% before the loop, we must move until the first dot.
%
%    \begin{macrocode}
    \dim_gadd:Nn \l_@@_x_initial_dim
      {  
        ( \l_@@_x_final_dim - \l_@@_x_initial_dim ) *
        \dim_ratio:nn 
          { \l_@@_l_dim - \l_@@_inter_dots_dim * \l_tmpa_int }
          { 2 \l_@@_l_dim }
        * \l_tmpb_int
      }
    \dim_gadd:Nn \l_@@_y_initial_dim 
      {   
        ( \l_@@_y_final_dim - \l_@@_y_initial_dim ) * 
        \dim_ratio:nn 
          { \l_@@_l_dim - \l_@@_inter_dots_dim * \l_tmpa_int } 
          { 2 \l_@@_l_dim } 
        * \l_tmpb_int
      }
    \pgf@relevantforpicturesizefalse
    \int_step_inline:nnn 0 \l_tmpa_int
      { 
        \pgfpathcircle 
          { \pgfpoint \l_@@_x_initial_dim \l_@@_y_initial_dim } 
          { \l_@@_radius_dim }
        \dim_add:Nn \l_@@_x_initial_dim \l_tmpa_dim
        \dim_add:Nn \l_@@_y_initial_dim \l_tmpb_dim
      }
    \pgfusepathqfill
  }
%    \end{macrocode}
%
% \bigskip
% \subsection*{User commands available in the new environments}
%
%
% \interitem 
% The commands |\@@_Ldots|, |\@@_Cdots|, |\@@_Vdots|, |\@@_Ddots| and
% |\@@_Iddots| will be linked to |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots| and
% |\Iddots| in the environments |{NiceArray}| (the other environments of
% \pkg{nicematrix} rely upon |{NiceArray}|). 
%
% The starred versions of these commands are deprecated since version~3.1 but,
% as for now, they are still available with an error.
%
% 
% \medskip
% The syntax of these commands uses the character |_| as embellishment and
% thats' why we have to insert a character |_| in the \emph{arg spec} of these
% commands. However, we don't know the future catcode of |_| in the main
% document (maybe the user will use \pkg{underscore}, and, in that case, the
% catcode is $13$ because \pkg{underscore} activates |_|). That's why these
% commands will be defined in a |\AtBeginDocument| and the \emph{arg spec} will
% be rescanned. 
%
%    \begin{macrocode}
\AtBeginDocument 
  {
    \tl_set:Nn \l_@@_argspec_tl { s O { } E { _ ^ } { { } { } } }
    \tl_set_rescan:Nno  \l_@@_argspec_tl { } \l_@@_argspec_tl
    \exp_args:NNV \NewDocumentCommand \@@_Ldots \l_@@_argspec_tl 
      { 
        \bool_if:nTF { #1 } 
          { \@@_error:n { starred~commands } }
          { \@@_instruction_of_type:nn { Ldots } { #2 , down = #3 , up = #4 } }  
        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_ldots }
        \bool_gset_true:N \g_@@_empty_cell_bool
      } 
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
    \exp_args:NNV \NewDocumentCommand \@@_Cdots \l_@@_argspec_tl
      { 
        \bool_if:nTF { #1 } 
          { \@@_error:n { starred~commands } }
          { \@@_instruction_of_type:nn { Cdots } { #2 , down = #3 , up = #4 } }
        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_cdots }
        \bool_gset_true:N \g_@@_empty_cell_bool
      } 
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
    \exp_args:NNV \NewDocumentCommand \@@_Vdots \l_@@_argspec_tl
      {
        \bool_if:nTF { #1 } 
          { \@@_error:n { starred~commands } }
          { \@@_instruction_of_type:nn { Vdots } { #2 , down = #3 , up = #4 } }
        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_vdots }
        \bool_gset_true:N \g_@@_empty_cell_bool
      } 
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
    \exp_args:NNV \NewDocumentCommand \@@_Ddots \l_@@_argspec_tl
      { 
        \bool_if:nTF { #1 } 
          { \@@_error:n { starred~commands } }
          { \@@_instruction_of_type:nn { Ddots } { #2 , down = #3 , up = #4 } }
        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_ddots }
        \bool_gset_true:N \g_@@_empty_cell_bool
      } 
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
    \exp_args:NNV \NewDocumentCommand \@@_Iddots \l_@@_argspec_tl
      { 
        \bool_if:nTF { #1 } 
          { \@@_error:n { starred~commands } }
          { \@@_instruction_of_type:nn { Iddots } { #2 , down = #3 , up = #4 } }
        \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_iddots }
        \bool_gset_true:N \g_@@_empty_cell_bool
      } 
  }
%    \end{macrocode}
% End of the |\AtBeginDocument|.
%
%
%
% \bigskip
% The command |\@@_Hspace:| will be linked to |\hspace| in |{NiceArray}|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_Hspace:
  { 
   \bool_gset_true:N \g_@@_empty_cell_bool
   \hspace
  }
%    \end{macrocode}
%
%
% \bigskip
% In the environment |{NiceArray}|, the command |\multicolumn| will be linked to
% the following command |\@@_multicolumn:nnn|.
%    \begin{macrocode}
\cs_set_eq:NN \@@_old_multicolumn \multicolumn
\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
  { 
    \@@_old_multicolumn { #1 } { #2 } { #3 }
    \int_compare:nNnT #1 > 1
      {
        \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
          { \int_eval:n \c@iRow - \int_use:N \c@jCol }
        \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } 
      }
    \int_gadd:Nn \c@jCol { #1 - 1 }
  }
%    \end{macrocode}
%
%
% \bigskip
% The command |\@@_Hdotsfor| will be linked to |\Hdotsfor| in
% |{NiceArrayWithDelims}|. This command uses an optional argument (as does
% |\hdotsfor|) but this argument is discarded (in |\hdotsfor|, this argument is 
% used for fine tuning of the space between two consecutive dots). Tikz nodes
% are created also the implicit cells of the |\Hdotsfor| (maybe we should modify
% that point).
%
% \medskip
% This command must \emph{not} be protected since it begins with |\multicolumn|. 
%    \begin{macrocode}
\cs_new:Npn \@@_Hdotsfor:
  {
    \multicolumn { 1 } { C } { }
    \@@_Hdotsfor_i
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\ExplSyntaxOff
\def \@tempa  { O { } m O { } E { _ ^ } { { } { } } }
\ExplSyntaxOn
\tl_set_eq:NN \l_@@_a_signature_tl \@tempa
%    \end{macrocode}
%
% The command |\@@_Hdotsfor_i| is defined with the tools of \pkg{xparse} because
% it has an optional argument. Note that such a command defined by
% |\NewDocumentCommand| is protected and that's why we have put the
% |\multicolumn| before (in the definition of |\@@_Hdotsfor:|).
%    \begin{macrocode}
\AtBeginDocument
  {
    \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } }
    \tl_set_rescan:Nno  \l_@@_argspec_tl { } \l_@@_argspec_tl
    \bool_if:NTF \c_@@_draft_bool
      {  
%    \end{macrocode}
% We don't put |!| before the last optionnal argument for homogeneity with
% |\Cdots|, etc. which have only one optional argument.
%    \begin{macrocode}
        \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_i \l_@@_argspec_tl 
          { \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } } } 
      }
      {
        \exp_args:NNV \NewDocumentCommand \@@_Hdotsfor_i \l_@@_argspec_tl
          {
            \tl_gput_right:Nx \g_@@_Hdotsfor_lines_tl
              {
                \@@_Hdotsfor:nnnn 
                  { \int_use:N \c@iRow } 
                  { \int_use:N \c@jCol } 
                  { #2 }  
                  { #1 , #3 , down = #4 , up = #5 }
              }
            \prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { C } { } }
          } 
      } 
  }
%    \end{macrocode}
% Enf of |\AtBeginDocument|.
% 
% \medskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_Hdotsfor:nnnn #1 #2 #3 #4
  { 
    \bool_set_false:N \l_@@_initial_open_bool
    \bool_set_false:N \l_@@_final_open_bool
%    \end{macrocode}
% For the row, it's easy.
%    \begin{macrocode}
    \int_set:Nn \l_@@_initial_i_int { #1 }
    \int_set_eq:NN \l_@@_final_i_int \l_@@_initial_i_int
%    \end{macrocode}
% For the column, it's a bit more complicated.
%    \begin{macrocode}
    \int_compare:nNnTF #2 = 1
      { 
        \int_set:Nn \l_@@_initial_j_int 1
        \bool_set_true:N \l_@@_initial_open_bool
      }
      {
        \cs_if_exist:cTF 
          { 
            pgf @ sh @ ns @ \@@_env: 
            - \int_use:N \l_@@_initial_i_int
            - \int_eval:n { #2 - 1 }
          }
          { \int_set:Nn \l_@@_initial_j_int { #2 - 1 } }
          { 
            \int_set:Nn \l_@@_initial_j_int { #2 }
            \bool_set_true:N \l_@@_initial_open_bool
          }
      }
    \int_compare:nNnTF { #2 + #3 -1 } = \c@jCol
      { 
        \int_set:Nn \l_@@_final_j_int { #2 + #3 - 1 }
        \bool_set_true:N \l_@@_final_open_bool
      }
      {
        \cs_if_exist:cTF 
          { 
            pgf @ sh @ ns @ \@@_env: 
            - \int_use:N \l_@@_final_i_int
            - \int_eval:n { #2 + #3 }
          }
          { \int_set:Nn \l_@@_final_j_int { #2 + #3 } }
          { 
            \int_set:Nn \l_@@_final_j_int { #2 + #3 - 1 }
            \bool_set_true:N \l_@@_final_open_bool
          }
      }
%    \end{macrocode}
%
%    \begin{macrocode}
    \group_begin:
    \int_compare:nNnTF { #1 } = 0
      { \color { nicematrix-first-row } }
      { 
        \int_compare:nNnT { #1 } = \g_@@_row_total_int
          { \color { nicematrix-last-row } }
      }
    \keys_set:nn { NiceMatrix / xdots } { #4 }
    \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } }
    \@@_actually_draw_Ldots:
    \group_end:
%    \end{macrocode}
%
% \medskip
% We declare all the cells concerned by the |\Hdotsfor| as ``dotted'' (for the
% dotted lines created by |\Cdots|, |\Ldots|, etc., this job is done by
% |\@@_find_extremities_of_line:nnnn|). This declaration is done by defining a
% special control sequence (to nil).
%    \begin{macrocode}
    \int_step_inline:nnn { #2 } { #2 + #3 - 1 }
      { \cs_set:cpn { @@ _ dotted _ #1 - ##1 } { } }
  }
%    \end{macrocode}
% 
%
% \bigskip
% The control sequence |\@@_rotate:| will be linked to |\rotate| in
% |{NiceArrayWithDelims}|. 
% 
% The command will exit three levels of groups in order
% to execute the command 
%
% \qquad ``|\box_rotate:Nn \l_@@_cell_box { 90 }|'' 
%
% just after the construction of the box |\l_@@_cell_box|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_rotate: { \group_insert_after:N \@@_rotate_i: }
\cs_new_protected:Npn \@@_rotate_i: { \group_insert_after:N \@@_rotate_ii: }
\cs_new_protected:Npn \@@_rotate_ii: { \group_insert_after:N \@@_rotate_iii: } 
\cs_new_protected:Npn \@@_rotate_iii: 
  { 
    \box_rotate:Nn \l_@@_cell_box { 90 } 
%    \end{macrocode}
% If we are in the last row, we want all the boxes composed with the command
% |\rotate| aligned upwards.
%    \begin{macrocode}
    \int_compare:nNnT \c@iRow = \l_@@_last_row_int 
      { 
        \vbox_set_top:Nn \l_@@_cell_box 
          { 
            \vbox_to_zero:n { }
%    \end{macrocode}
% |0.8 ex| will be the distance between the principal part of the array and our
% element (which is composed with |\rotate|.
%    \begin{macrocode}
            \skip_vertical:n { - \box_ht:N \@arstrutbox + 0.8 ex } 
            \box_use:N \l_@@_cell_box 
          } 
      }
  }
%    \end{macrocode}
%
% \bigskip
% \subsection*{The command \textbackslash line accessible in code-after}
%
% In the |code-after|, the command |\@@_line:nn| will be linked to |\line|. This
% command takes two arguments which are the specifications of two cells in the
% array (in the format $i$-$j$) and draws a dotted line between these cells. 
% 
% \medskip
% First, we write a command with an argument of the format $i$-$j$ and applies
% the command |\int_eval:n| to $i$ and~$j$ ; this must \emph{not} be protected
% (and is, of course fully expandable).\footnote{Indeed, we want that the user
% may use the command |\line| in |code-after| with LaTeX counters in the
% arguments --- with the command |\value|.}
%    \begin{macrocode}
\cs_new:Npn \@@_double_int_eval:n #1-#2 \q_stop
  { \int_eval:n { #1 } - \int_eval:n { #2 } }
%    \end{macrocode}
%
%    \begin{macrocode}
\ExplSyntaxOff
\def \@tempa  { O { } m m ! O { } E { _ ^ } { { } { } } }
\ExplSyntaxOn
\tl_set_eq:NN \l_@@_a_signature_tl \@tempa
%    \end{macrocode}
%
% \medskip
% With the following construction, the command |\@@_double_int_eval:n| is
% applied to both arguments before the application of |\@@_line_i:nn| (the
% construction uses the fact the |\@@_line_i:nn| is protected and that
% |\@@_double_int_eval:n| is fully expandable).
%    \begin{macrocode}
\AtBeginDocument
  {
    \tl_set:Nn \l_@@_argspec_tl { O { } m m ! O { } E { _ ^ } { { } { } } } 
    \tl_set_rescan:Nno  \l_@@_argspec_tl { } \l_@@_argspec_tl
    \exp_args:NNV \NewDocumentCommand \@@_line \l_@@_argspec_tl
      {
        \group_begin:
        \keys_set:nn { NiceMatrix / xdots } { #1 , #4 , down = #5 , up = #6 }
        \tl_if_empty:VF \l_@@_xdots_color_tl { \color { \l_@@_xdots_color_tl } } 
          \use:x
            {
              \@@_line_i:nn 
                { \@@_double_int_eval:n #2 \q_stop }
                { \@@_double_int_eval:n #3 \q_stop }
            }
        \group_end:
      } 
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\bool_if:NTF \c_@@_draft_bool
  { \cs_new_protected:Npn \@@_line_i:nn #1 #2  { } }
  {
    \cs_new_protected:Npn \@@_line_i:nn #1 #2
      {
        \bool_set_false:N \l_@@_initial_open_bool
        \bool_set_false:N \l_@@_final_open_bool
        \bool_if:nTF
          {
            \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #1 }  
              || 
            \cs_if_free_p:c { pgf @ sh @ ns @ \@@_env: - #2 } 
          }
          { 
            \@@_error:nnn { unknown~cell~for~line~in~code-after } { #1 } { #2 }
          } 
          { \@@_draw_line_ii:nn { #1 } { #2 } }
      }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\AtBeginDocument
  {
    \cs_new_protected:Npx \@@_draw_line_ii:nn #1 #2
      {
%    \end{macrocode}
% We recall that, when externalization is used, |\tikzpicture| and
% |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly
% ``visible'' and that why we do this static construction of the command
% |\@@_draw_line_ii:|. 
%    \begin{macrocode}
        \c_@@_pgfortikzpicture_tl
        \@@_draw_line_iii:nn { #1 } { #2 }
        \c_@@_endpgfortikzpicture_tl
      }
  }
%    \end{macrocode}
% 
% \bigskip
% The following command \emph{must} be protected (it's used in the
% construction of |\@@_draw_line_ii:nn|).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_line_iii:nn #1 #2 
  {
    \pgfrememberpicturepositiononpagetrue
    \pgfpointshapeborder { \@@_env: - #1 } { \@@_qpoint: { #2 } }
    \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
    \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
    \pgfpointshapeborder { \@@_env: - #2 } { \@@_qpoint: { #1 } }
    \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
    \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
    \@@_draw_line:
  }
%    \end{macrocode}
% 
% 
% The commands |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|, and |\Iddots| don't use
% this command because they have to do other settings (for example, the diagonal
% lines must be parallelized). 
%
% \bigskip
% \subsection*{The vertical rules}
%
% We give to the user the possibility to define new types of columns (with
% |\newcolumntype| of \pkg{array}) for special vertical rules (\emph{e.g.} rules
% thicker than the standard ones) which will not extend in the potential
% exterior rows of the array.
%
% We provide the command |\OnlyMainNiceMatrix| in that goal. However, that
% command must be no-op outside the environments of \pkg{nicematrix} (and so the
% user will be allowed to use the same new type of column in the environments
% of \pkg{nicematrix} and in the standard environments of \pkg{array}).
%
% That's why we provide first a global definition of |\OnlyMainNiceMatrix|.
%    \begin{macrocode}
\cs_set_eq:NN \OnlyMainNiceMatrix \use:n
%    \end{macrocode}
%
% \medskip
% Another definition of |\OnlyMainNiceMatrix| will be linked to the command in
% the environments of \pkg{nicematrix}. Here is that definition, called
% |\@@_OnlyMainNiceMatrix:n|. 
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_OnlyMainNiceMatrix:n #1
  { 
    \int_compare:nNnTF \l_@@_first_col_int = 0 
      { \@@_OnlyMainNiceMatrix_i:n { #1 } }
      { 
        \int_compare:nNnTF \c@jCol = 0
          {
            \int_compare:nNnF \c@iRow = { -1 }
              { \int_compare:nNnF \c@iRow = { \l_@@_last_row_int - 1 } { #1 } }  
          }
          { \@@_OnlyMainNiceMatrix_i:n { #1 } }    
      }   
  } 
%    \end{macrocode}
% This definition may seem complicated by we must remind that the number of row
% |\c@iRow| is incremented in the first cell of the row, \emph{after} an
% potential vertical rule on the left side of the first cell.
%
% \smallskip
% The command |\@@_OnlyMainNiceMatrix_i:n| is only a short-cut which is used
% twice in the above command. This command must \emph{not} be protected.
% %    \begin{macrocode}
\cs_new_protected:Npn \@@_OnlyMainNiceMatrix_i:n #1
  {
    \int_compare:nNnF \c@iRow = 0
      { \int_compare:nNnF \c@iRow = \l_@@_last_row_int { #1 } }
  }
%    \end{macrocode}
% Remember that |\c@iRow| is not always inferior to |\l_@@_last_row_int| because
% |\l_@@_last_row_int| may be equal to $-2$ or $-1$ (we can't write 
% |\int_compare:nNnT \c@iRow < \l_@@_last_row_int|).
% 
% 
% \medskip
% In fact, independently of |\OnlyMainNiceMatrix|, which is a convenience given
% to the user, we have to modify the behaviour of the standard specifier ``"|"''.
%
% 
% Remark first that the natural way to do that would be to redefine the
% specifier ``"|"'' with |\newcolumntype|:
% \begin{Verbatim}[commandchars=\~\#\+]
%    \newcolumntype { | } { ! { \OnlyMainNiceMatrix \vline } } 
% \end{Verbatim}
% 
% However, this code fails if the user uses "\DefineShortVerb{\|}" of
% \pkg{fancyvrb}. Moreover, it would not be able to deal correctly with two
% consecutive specifiers ``"|"'' (in a preambule like "ccc||ccc").
%
% That's why we have done a redefinition of the macro |\@arrayrule| of
% \pkg{array} and this redefinition will add |\@@_vline:| instead of |\vline| to
% the preamble (that definition is in the beginning of |{NiceArrayWithDelims}|).
%
% Here is the definition of |\@@_vline:|. This definition \emph{must} be
% protected because you don't want that macro expanded during the construction
% of the preamble (the tests in |\@@_OnlyMainNiceMatrix:n| must be effective in
% each row and not once for all when the preamble is constructed).
% 
% \medskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_vline: { \@@_OnlyMainNiceMatrix:n { \@@_vline_i: } } 
%    \end{macrocode}
%
% If \pkg{colortbl} is loaded, the following macro will be redefined (in a
% |\AtBeginDocument|) to take into account the color fixed by |\arrayrulecolor|
% of \pkg{colortbl}. 
%    \begin{macrocode}
\cs_set_eq:NN \@@_vline_i: \vline
%    \end{macrocode}
%
% \bigskip
% The command |\@@_draw_vlines| will be executed when the user uses the option
% |vlines| (which draws all the vlines of the array).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_vlines:
  {
    \group_begin:
%    \end{macrocode}
% The command |\CT@arc@| is a command of color from \pkg{colortbl}.
%    \begin{macrocode}
    \bool_if:NT \c_@@_colortbl_loaded_bool \CT@arc@
    \pgfpicture 
    \pgfrememberpicturepositiononpagetrue
    \pgf@relevantforpicturesizefalse
    \pgfsetlinewidth \arrayrulewidth 
%    \end{macrocode}
% First, we compute in |\l_tmpa_dim| the height of the rules we have to draw.
%    \begin{macrocode}
    \@@_qpoint: {row - 1 }
    \dim_set_eq:NN \l_tmpa_dim \pgf@y
    \pgfusepathqfill
    \@@_qpoint: { row - \@@_succ:n \c@iRow } 
    \dim_sub:Nn \l_tmpa_dim \pgf@y 
    \pgfusepathqfill
%    \end{macrocode}
% We translate vertically to take into account the potential ``last row''. 
%    \begin{macrocode}
    \dim_zero:N \l_tmpb_dim
    \int_compare:nNnT \l_@@_last_row_int > { -1 }
      {
        \dim_set_eq:NN \l_tmpb_dim \g_@@_dp_last_row_dim 
        \dim_add:Nn \l_tmpb_dim \g_@@_ht_last_row_dim 
%    \end{macrocode}
% We adjust the value of |\l_tmpa_dim| by the width of the horizontal rule just 
% before the ``last row''.
%    \begin{macrocode}
        \@@_qpoint: { row - \@@_succ:n\c@iRow } 
        \dim_add:Nn \l_tmpa_dim \pgf@y
        \@@_qpoint: { row - \@@_succ:n \g_@@_row_total_int } 
        \dim_sub:Nn \l_tmpa_dim \pgf@y
        \dim_sub:Nn \l_tmpa_dim \l_tmpb_dim
       }
%    \end{macrocode}
%
% Now, we can draw the lines with a loop. 
%    \begin{macrocode}
    \int_step_inline:nnn 
      { \bool_if:NTF \l_@@_NiceArray_bool 1 2 } 
      { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol } 
      {          
        \pgfpathmoveto
          {
            \pgfpointadd
              { \@@_qpoint: { col - ##1 } }
              { 
                \pgfpoint 
                  { 
                    -0.5 \arrayrulewidth 
                    \int_compare:nNnT { ##1 } = 1
                      { 
                        \int_compare:nNnT \l_@@_first_col_int = 1
                          { + \arrayrulewidth }
                      }
                  } 
                  { \l_tmpb_dim } 
              }
          }
        \pgfpathlineto
          {
            \pgfpointadd
              { \@@_qpoint: { col - ##1 } }
              { 
                \pgfpoint 
                  { 
                    -0.5 \arrayrulewidth 
                    \int_compare:nNnT { ##1 } = 1
                      { 
                        \int_compare:nNnT \l_@@_first_col_int = 1
                          { + \arrayrulewidth }
                      }
                  } 
                  { \l_tmpb_dim + \l_tmpa_dim } 
              }
          }
      }
    \pgfusepathqstroke
    \endpgfpicture
    \group_end:
  }
%    \end{macrocode}
%
%
% \bigskip
% \subsection*{The commands to draw dotted lines to separate columns and rows}
%
% These commands don't use the normal nodes, the medium nor the large nodes.
% They only use the |col|-nodes and the |row|-nodes.
%
% \textbf{Horizontal dotted lines}\par\nobreak
%
% \medskip
% The following command must \emph{not} be protected because it's meant to be
% expanded in a |\noalign|.
%    \begin{macrocode}
\bool_if:NTF \c_@@_draft_bool
  { \cs_new:Npn \@@_hdottedline: { } }
  {
    \cs_new:Npn \@@_hdottedline: 
      {
        \noalign { \skip_vertical:N 2\l_@@_radius_dim } 
        \@@_hdottedline_i:
      }
  }
%    \end{macrocode}
%
% \medskip
% On the other side, the following command should be protected.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_hdottedline_i:
  { 
%    \end{macrocode}
% We write in the code-after the instruction that will eventually draw the
% dotted line.  It's not possible to draw this dotted line now because we don't
% know the length of the line (we don't even know the number of columns).
%    \begin{macrocode}
    \tl_gput_right:Nx \g_@@_internal_code_after_tl
      { \@@_hdottedline:n { \int_use:N \c@iRow } } 
  }
%    \end{macrocode}
%
%
% \medskip
% The command |\@@_hdottedline:n| is the command written in the |code-after|
% that will actually draw the dotted line. Its argument is the number of the row
% \emph{before} which we will draw the row.
%    \begin{macrocode}
\AtBeginDocument
  {
%    \end{macrocode}
% We recall that, when externalization is used, |\tikzpicture| and
% |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly
% ``visible''. 
%    \begin{macrocode}
    \cs_new_protected:Npx \@@_hdottedline:n #1
      {
        \bool_set_true:N \exp_not:N \l_@@_initial_open_bool 
        \bool_set_true:N \exp_not:N \l_@@_final_open_bool 
        \c_@@_pgfortikzpicture_tl
        \@@_hdottedline_i:n { #1 }
        \c_@@_endpgfortikzpicture_tl
      }
  }
%    \end{macrocode}
% 
% The following command \emph{must} be protected since it is used in the
% construction of |\@@_hdottedline:n|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_hdottedline_i:n #1
  {
    \pgfrememberpicturepositiononpagetrue
    \@@_qpoint: { row - #1 } 
%    \end{macrocode}
% We do a translation par |-\l_@@_radius_dim| because we want the dotted line to
% have exactly the same position as a vertical rule drawn by ``"|"''
% (considering the rule having a width equal to the diameter of the dots).
%    \begin{macrocode}
    \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y 
    \dim_sub:Nn \l_@@_y_initial_dim \l_@@_radius_dim 
    \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim
%    \end{macrocode}
% 
% \medskip
% The dotted line will be extended if the user uses |margin| (or |left-margin|
% and |right-margin|).
%
% \smallskip
% The aim is that, by standard the dotted line fits between square brackets
% (|\hline| doesn't).
%
% \smallskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% 1 & 2 & 3 & 4 \\
% \hline 
% 1 & 2 & 3 & 4 \\
% \hdottedline 
% 1 & 2 & 3 & 4 \\
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 1 & 2 & 3 & 4 \\
% \hline 
% 1 & 2 & 3 & 4 \\
% \hdottedline 
% 1 & 2 & 3 & 4 \\
% \end{bNiceMatrix}$
%
% \smallskip
% But, if the user uses |margin|, the dotted line extends to have the same width
% as a |\hline|.
% 
% \smallskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}[margin]
% 1 & 2 & 3 & 4 \\
% \hline 
% 1 & 2 & 3 & 4 \\
% \hdottedline 
% 1 & 2 & 3 & 4 \\
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}[margin]
% 1 & 2 & 3 & 4 \\
% \hline 
% 1 & 2 & 3 & 4 \\
% \hdottedline 
% 1 & 2 & 3 & 4 \\
% \end{bNiceMatrix}$
%
% \medskip
%    \begin{macrocode}
    \@@_qpoint: { col - 1 } 
    \dim_set:Nn \l_@@_x_initial_dim 
      { \pgf@x + \arraycolsep - \l_@@_left_margin_dim } 
    \@@_qpoint: { col - \@@_succ:n \c@jCol } 
    \dim_set:Nn \l_@@_x_final_dim 
      { \pgf@x - \arraycolsep + \l_@@_right_margin_dim }
%    \end{macrocode}
% For reasons purely aesthetic, we do an adjustment in the case of a rounded
% bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a
% better result.
%    \begin{macrocode}
    \tl_set:Nn \l_tmpa_tl { ( }
    \tl_if_eq:NNF \l_@@_left_delim_tl \l_tmpa_tl
      { \dim_gadd:Nn \l_@@_x_initial_dim  { 0.5 \l_@@_inter_dots_dim } }
    \tl_set:Nn \l_tmpa_tl { ) }
    \tl_if_eq:NNF \l_@@_right_delim_tl \l_tmpa_tl
      { \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_inter_dots_dim } }
%    \end{macrocode}
%
% \medskip
% As for now, we have no option to control the style of the lines drawn by
% |\hdottedline| and the specifier ``|:|'' in the preamble. That's why we impose
% the style |standard|.
%    \begin{macrocode}
    \tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl
    \@@_draw_line:
  }
%    \end{macrocode}
%
%
%
% \bigskip
% \textbf{Vertical dotted lines}\par\nobreak
%
%
% \medskip
%    \begin{macrocode}
\bool_if:nTF \c_@@_draft_bool
  { \cs_new_protected:Npn \@@_vdottedline:n #1 { } }
  {
    \cs_new_protected:Npn \@@_vdottedline:n #1
      {
        \bool_set_true:N \l_@@_initial_open_bool 
        \bool_set_true:N \l_@@_final_open_bool 
%    \end{macrocode}
% We recall that, when externalization is used, |\tikzpicture| and
% |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly
% ``visible''. 
%    \begin{macrocode}
        \bool_if:NTF \c_@@_tikz_loaded_bool
          {
            \tikzpicture
            \@@_vdottedline_i:n { #1 }
            \endtikzpicture
          }
          {
            \pgfpicture
            \@@_vdottedline_i:n { #1 }
            \endpgfpicture
          }
      }
  }
%    \end{macrocode}
%
% \medskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_vdottedline_i:n #1
  {
%    \end{macrocode}
% The command |\CT@arc@| is a command of color from \pkg{colortbl}.
%    \begin{macrocode}
    \bool_if:NT \c_@@_colortbl_loaded_bool \CT@arc@
    \pgfrememberpicturepositiononpagetrue
    \@@_qpoint: { col - \int_eval:n { #1 + 1 } } 
%    \end{macrocode}
% We do a translation par |-\l_@@_radius_dim| because we want the dotted line to
% have exactly the same position as a vertical rule drawn by ``"|"''
% (considering the rule having a width equal to the diameter of the dots).
%    \begin{macrocode}
    \dim_set:Nn \l_@@_x_initial_dim { \pgf@x - \l_@@_radius_dim }
    \dim_set:Nn \l_@@_x_final_dim { \pgf@x - \l_@@_radius_dim }
    \@@_qpoint: { row - 1 } 
%    \end{macrocode}
% We arbitrary decrease the height of the dotted line by a quantity equal to
% |\l_@@_inter_dots_dim| in order to improve the visual impact.
%    \begin{macrocode}
    \dim_set:Nn \l_@@_y_initial_dim { \pgf@y - 0.5 \l_@@_inter_dots_dim }  
    \@@_qpoint: { row - \@@_succ:n \c@iRow } 
    \dim_set:Nn \l_@@_y_final_dim { \pgf@y + 0.5 \l_@@_inter_dots_dim } 
%    \end{macrocode}
% As for now, we have no option to control the style of the lines drawn by
% |\hdottedline| and the specifier ``|:|'' in the preamble. That's why we impose
% the style |standard|.
%    \begin{macrocode}
    \tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl
    \@@_draw_line:
  }
%    \end{macrocode}
% 
%
% 
% \bigskip 
% \subsection*{The environment \{NiceMatrixBlock\}}
%
% The following flag will be raised when all the columns of the environments of
% the block must have the same width in ``auto'' mode.
%    \begin{macrocode}
\bool_new:N \l_@@_block_auto_columns_width_bool
%    \end{macrocode}
%
% \bigskip
% As of now, there is only one option available for the environment
% |{NiceMatrixBlock}|. 
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrixBlock } 
  {
    auto-columns-width .code:n = 
      { 
        \bool_set_true:N \l_@@_block_auto_columns_width_bool
        \dim_gzero_new:N \g_@@_max_cell_width_dim
        \bool_set_true:N \l_@@_auto_columns_width_bool
      }
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\NewDocumentEnvironment { NiceMatrixBlock } { ! O { } }
  {
    \int_gincr:N \g_@@_NiceMatrixBlock_int
    \dim_zero:N \l_@@_columns_width_dim
    \keys_set:nn { NiceMatrix / NiceMatrixBlock } { #1 }
    \bool_if:NT \l_@@_block_auto_columns_width_bool
      {
        \cs_if_exist:cT { @@_max_cell_width_ \int_use:N \g_@@_NiceMatrixBlock_int }
          {
            \exp_args:NNc \dim_set:Nn \l_@@_columns_width_dim
              { @@_max_cell_width _ \int_use:N \g_@@_NiceMatrixBlock_int } 
          } 
      }
  }
%    \end{macrocode}
%
% \medskip
% At the end of the environment |{NiceMatrixBlock}|, we write in the main |.aux|
% file instructions for the column width of all the environments of the block
% (that's why we have stored the number of the first environment of the block in
% the counter |\l_@@_first_env_block_int|). 
%    \begin{macrocode}
  { 
    \bool_if:NT \l_@@_block_auto_columns_width_bool
      {
        \iow_shipout:Nn \@mainaux \ExplSyntaxOn
        \iow_shipout:Nx \@mainaux         
          { 
            \cs_gset:cpn 
              { @@ _ max _ cell _ width _ \int_use:N \g_@@_NiceMatrixBlock_int } 
%    \end{macrocode}
% For technical reasons, we have to include the width of an eventual rule on the
% right side of the cells.
%    \begin{macrocode}
              { \dim_eval:n { \g_@@_max_cell_width_dim + \arrayrulewidth } }
          }
        \iow_shipout:Nn \@mainaux \ExplSyntaxOff
      }
  }
%    \end{macrocode}
%
% \bigskip
% \subsection*{The extra nodes}
%
% First, two variants of the functions |\dim_min:nn| and |\dim_max:nn|.
%    \begin{macrocode}
\cs_generate_variant:Nn \dim_min:nn { v n }
\cs_generate_variant:Nn \dim_max:nn { v n }
%    \end{macrocode}
%
% \bigskip
% We have three macros of creation of nodes: |\@@_create_medium_nodes:|,
% |\@@_create_large_nodes:| and |\@@_create_medium_and_large_nodes:|. 
%
%
% \bigskip
% We have to compute the mathematical coordinates of the ``medium nodes''. These
% mathematical coordinates are also used to compute the mathematical coordinates
% of the ``large nodes''. That's why we write a command
% |\@@_computations_for_medium_nodes:| to do these computations.
% 
% \bigskip
% The command |\@@_computations_for_medium_nodes:| must be used in a
% |{pgfpicture}|.
%
% \medskip
% For each row $i$, we compute two dimensions
% \texttt{l_@@_row_\textsl{i}_min_dim} and \texttt{l_@@_row_\textsl{i}_max_dim}.
% The dimension \texttt{l_@@_row_\textsl{i}_min_dim} is the minimal 
% $y$-value of all the cells of the row~$i$. The dimension
% \texttt{l_@@_row_\textsl{i}_max_dim} is the maximal $y$-value of all the cells
% of the row~$i$. 
%
% Similarly, for each column $j$, we compute two dimensions
% \texttt{l_@@_column_\textsl{j}_min_dim} and
% \texttt{l_@@_column_\textsl{j}_max_dim}. The dimension
% \texttt{l_@@_column_\textsl{j}_min_dim} is the minimal $x$-value of all the
% cells of the column~$j$. The dimension \texttt{l_@@_column_\textsl{j}_max_dim}
% is the maximal $x$-value of all the cells of the column~$j$.
%
% Since these dimensions will be computed as maximum or minimum, we initialize
% them to |\c_max_dim| or |-\c_max_dim|. 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_computations_for_medium_nodes:
  {
    \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
      { 
        \dim_zero_new:c { l_@@_row_\@@_i: _min_dim } 
        \dim_set_eq:cN { l_@@_row_\@@_i: _min_dim } \c_max_dim
        \dim_zero_new:c { l_@@_row_\@@_i: _max_dim } 
        \dim_set:cn { l_@@_row_\@@_i: _max_dim } { - \c_max_dim }
      }
    \int_step_variable:nnNn \l_@@_first_col_int \g_@@_col_total_int \@@_j:
      {
        \dim_zero_new:c { l_@@_column_\@@_j: _min_dim } 
        \dim_set_eq:cN { l_@@_column_\@@_j: _min_dim } \c_max_dim
        \dim_zero_new:c { l_@@_column_\@@_j: _max_dim } 
        \dim_set:cn { l_@@_column_\@@_j: _max_dim } { - \c_max_dim }
      }
%    \end{macrocode}
% We begin the two nested loops over the rows and the columns of the array.
%    \begin{macrocode}
    \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
      { 
        \int_step_variable:nnNn 
          \l_@@_first_col_int \g_@@_col_total_int \@@_j: 
%    \end{macrocode}
% If the cell ($i$-$j$) is empty or an implicit cell (that is to say a cell
% after implicit ampersands |&|) we don't update the dimensions we want to
% compute.
%    \begin{macrocode}
          { 
            \cs_if_exist:cT 
              { pgf @ sh @ ns @ \@@_env: - \@@_i: - \@@_j: }
%    \end{macrocode}
% We retrieve the coordinates of the anchor |south west| of the (normal) node of
% the cell ($i$-$j$). They will be stored in |\pgf@x| and |\pgf@y|.
%    \begin{macrocode}
              {
                \pgfpointanchor { \@@_env: - \@@_i: - \@@_j: } { south~west }
                \dim_set:cn { l_@@_row_\@@_i: _min_dim}
                  { \dim_min:vn { l_@@_row _ \@@_i: _min_dim } \pgf@y }  
                \seq_if_in:NxF \g_@@_multicolumn_cells_seq { \@@_i: - \@@_j: }
                  { 
                    \dim_set:cn { l_@@_column _ \@@_j: _min_dim}
                      { \dim_min:vn { l_@@_column _ \@@_j: _min_dim } \pgf@x }
                  }
%    \end{macrocode}
% We retrieve the coordinates of the anchor |north east| of the (normal) node of
% the cell ($i$-$j$). They will be stored in |\pgf@x| and |\pgf@y|.
%    \begin{macrocode}
                \pgfpointanchor { \@@_env: - \@@_i: - \@@_j: } { north~east }
                \dim_set:cn { l_@@_row _ \@@_i: _ max_dim }
                  { \dim_max:vn { l_@@_row _ \@@_i: _ max_dim } \pgf@y }
                \seq_if_in:NxF \g_@@_multicolumn_cells_seq { \@@_i: - \@@_j: }
                  { 
                    \dim_set:cn { l_@@_column _ \@@_j: _ max_dim }
                      { \dim_max:vn { l_@@_column _ \@@_j: _max_dim } \pgf@x }
                  } 
              }
          }
      }
%    \end{macrocode}
% Now, we have to deal with empty rows or empty columns since we don't have
% created nodes in such rows and columns.
%    \begin{macrocode}
    \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
      { 
        \dim_compare:nNnT 
          { \dim_use:c { l_@@_row _ \@@_i: _ min _ dim } } = \c_max_dim
          { 
            \@@_qpoint: { row - \@@_i: - base }
            \dim_set:cn { l_@@_row _ \@@_i: _ max _ dim } \pgf@y 
            \dim_set:cn { l_@@_row _ \@@_i: _ min _ dim } \pgf@y 
          }
      }
    \int_step_variable:nnNn \l_@@_first_col_int \g_@@_col_total_int \@@_j:
      {
        \dim_compare:nNnT 
          { \dim_use:c { l_@@_column _ \@@_j: _ min _ dim } } = \c_max_dim 
          { 
            \@@_qpoint: { col - \@@_j: }
            \dim_set:cn { l_@@_column _ \@@_j: _ max _ dim } \pgf@y 
            \dim_set:cn { l_@@_column _ \@@_j: _ min _ dim } \pgf@y 
          }
      }
  }
%    \end{macrocode}
%
%
% \bigskip
% Here is the command |\@@_create_medium_nodes:|. When this command is used, the
% ``medium nodes'' are created. 
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_create_medium_nodes:
  {
    \pgfpicture
      \pgfrememberpicturepositiononpagetrue
      \pgf@relevantforpicturesizefalse
      \@@_computations_for_medium_nodes:
%    \end{macrocode}
% Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:|
% because this command will also be used for the creation of the ``large nodes''.
%    \begin{macrocode} 
      \tl_set:Nn \l_@@_suffix_tl { -medium }
      \@@_create_nodes:
      \endpgfpicture
  }
%    \end{macrocode}
% 
%
% \medskip
% The command |\@@_create_large_nodes:| must be used when we want to create only
% the ``large nodes'' and not the medium ones\footnote{If we want to create
% both, we have to use |\@@_create_medium_and_large_nodes:|}. However, the
% computation of the mathematical coordinates of the ``large nodes'' needs the
% computation of the mathematical coordinates of the ``medium nodes''. Hence, we
% use first |\@@_computations_for_medium_nodes:| and then the command
% |\@@_computations_for_large_nodes:|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_create_large_nodes:
  {
    \pgfpicture 
      \pgfrememberpicturepositiononpagetrue
      \pgf@relevantforpicturesizefalse
      \@@_computations_for_medium_nodes:
      \@@_computations_for_large_nodes:
      \tl_set:Nn \l_@@_suffix_tl { - large }
      \@@_create_nodes:
    \endpgfpicture
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_create_medium_and_large_nodes:
  {
    \pgfpicture 
      \pgfrememberpicturepositiononpagetrue
      \pgf@relevantforpicturesizefalse
      \@@_computations_for_medium_nodes:
%    \end{macrocode}
% Now, we can create the ``medium nodes''. We use a command |\@@_create_nodes:|
% because this command will also be used for the creation of the ``large nodes''.
%    \begin{macrocode} 
      \tl_set:Nn \l_@@_suffix_tl { - medium }
      \@@_create_nodes:
      \@@_computations_for_large_nodes:
      \tl_set:Nn \l_@@_suffix_tl { - large }
      \@@_create_nodes: 
    \endpgfpicture
  }
%    \end{macrocode}
%
%
% \bigskip
% For ``large nodes'', the exterior rows and columns don't interfer. That's why
% the loop over the columns will start at 1 and stop at $|\c@jCol|$ (and not
% |\g_@@_col_total_int|). Idem for the rows.
%     \begin{macrocode}
\cs_new_protected:Npn \@@_computations_for_large_nodes:
  {
    \int_set:Nn \l_@@_first_row_int 1
    \int_set:Nn \l_@@_first_col_int 1
%    \end{macrocode}
% We have to change the values of all the dimensions
% \texttt{l_@@_row_\textsl{i}_min_dim}, \texttt{l_@@_row_\textsl{i}_max_dim},
% \texttt{l_@@_column_\textsl{j}_min_dim} and
% \texttt{l_@@_column_\textsl{j}_max_dim}.  
%    \begin{macrocode} 
    \int_step_variable:nNn { \c@iRow - 1 } \@@_i:
      { 
        \dim_set:cn { l_@@_row _ \@@_i: _ min _ dim }  
          {
            (  
              \dim_use:c { l_@@_row _ \@@_i: _ min _ dim } + 
              \dim_use:c { l_@@_row _ \@@_succ:n \@@_i: _ max _ dim }
            ) 
            / 2
          }
        \dim_set_eq:cc { l_@@_row _ \@@_succ:n \@@_i: _ max _ dim } 
          { l_@@_row_\@@_i: _min_dim } 
      }
    \int_step_variable:nNn { \c@jCol - 1 } \@@_j:
      { 
        \dim_set:cn { l_@@_column _ \@@_j: _ max _ dim }  
          { 
            (  
              \dim_use:c { l_@@_column _ \@@_j: _ max _ dim } + 
              \dim_use:c 
                { l_@@_column _ \@@_succ:n \@@_j: _ min _ dim }
            ) 
            / 2
          }
        \dim_set_eq:cc { l_@@_column _ \@@_succ:n \@@_j: _ min _ dim }
          { l_@@_column _ \@@_j: _ max _ dim } 
      }
%     \end{macrocode}
% Here, we have to use |\dim_sub:cn| because of the number 1 in the name.
%     \begin{macrocode}
    \dim_sub:cn 
      { l_@@_column _ 1 _ min _ dim } 
      \l_@@_left_margin_dim
    \dim_add:cn 
      { l_@@_column _ \int_use:N \c@jCol _ max _ dim }
      \l_@@_right_margin_dim  
  }
%    \end{macrocode}
%
%
%
% \bigskip
% The control sequence |\@@_create_nodes:| is used twice: for the construction
% of the ``medium nodes'' and for the construction of the ``large nodes''. The
% nodes are constructed with the value of all the dimensions
% \texttt{l_@@_row_\textsl{i}_min_dim}, \texttt{l_@@_row_\textsl{i}_max_dim},
% \texttt{l_@@_column_\textsl{j}_min_dim} and
% \texttt{l_@@_column_\textsl{j}_max_dim}. Between the construction of the
% ``medium nodes'' and the ``large nodes'', the values of these dimensions are
% changed. 
%
% The function also uses |\l_@@_suffix_tl| (|-medium| or |-large|).
%     \begin{macrocode}
\cs_new_protected:Npn \@@_create_nodes:
  { 
    \int_step_variable:nnNn \l_@@_first_row_int \g_@@_row_total_int \@@_i:
      { 
        \int_step_variable:nnNn \l_@@_first_col_int \g_@@_col_total_int \@@_j:
          {
%    \end{macrocode}
% We draw the rectangular node for the cell (|\@@_i|-|\@@_j|).
%    \begin{macrocode}
            \@@_pgf_rect_node:nnnnn
              { \@@_env: - \@@_i: - \@@_j: \l_@@_suffix_tl } 
              { \dim_use:c { l_@@_column_ \@@_j: _min_dim } }
              { \dim_use:c { l_@@_row_ \@@_i: _min_dim } }
              { \dim_use:c { l_@@_column_ \@@_j: _max_dim } }
              { \dim_use:c { l_@@_row_ \@@_i: _max_dim } }
            \str_if_empty:NF \l_@@_name_str
              {
                \pgfnodealias
                  { \l_@@_name_str - \@@_i: - \@@_j: \l_@@_suffix_tl }
                  { \@@_env: - \@@_i: - \@@_j: \l_@@_suffix_tl }
              }
          }
      }
%    \end{macrocode}
% Now, we create the nodes for the cells of the |\multicolumn|. We recall that
% we have stored in |\g_@@_multicolumn_cells_seq| the list of the cells where a
% |\multicolumn{|$n$|}{...}{...}| with $n$>1 was issued and in
% |\g_@@_multicolumn_sizes_seq| the correspondant values of $n$. 
%    \begin{macrocode}
    \seq_mapthread_function:NNN 
      \g_@@_multicolumn_cells_seq 
      \g_@@_multicolumn_sizes_seq
      \@@_node_for_multicolumn:nn
  }
%    \end{macrocode}
%
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_extract_coords_values: #1 - #2 \q_stop
  { 
    \cs_set:Npn \@@_i: { #1 } 
    \cs_set:Npn \@@_j: { #2 }
  }
%    \end{macrocode}
%
% The command |\@@_node_for_multicolumn:nn| takes two arguments. The first is
% the position of the cell where the command |\multicolumn{|$n$|}{...}{...}| was
% issued in the format $i$|-|$j$ and the second is the value of~$n$ (the length
% of the ``multi-cell''). 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_node_for_multicolumn:nn #1 #2
  { 
    \@@_extract_coords_values: #1 \q_stop
    \@@_pgf_rect_node:nnnnn
      { \@@_env: - \@@_i: - \@@_j: \l_@@_suffix_tl }
      { \dim_use:c { l_@@_column _ \@@_j: _ min _ dim } }
      { \dim_use:c { l_@@_row _ \@@_i: _ min _ dim } }
      { \dim_use:c { l_@@_column _ \int_eval:n { \@@_j: +#2-1 } _ max _ dim } }  
      { \dim_use:c { l_@@_row _ \@@_i: _ max _ dim } }
    \str_if_empty:NF \l_@@_name_str
      {
        \pgfnodealias
          { \l_@@_name_str - \@@_i: - \@@_j: \l_@@_suffix_tl }
          { \int_use:N \g_@@_env_int - \@@_i: - \@@_j: \l_@@_suffix_tl}
      }
  }
%    \end{macrocode}
%
% \bigskip
% \subsection*{Block matrices}
%
% The code in this section if for the construction of \emph{block matrices}. It
% has no direct link with the environment |{NiceMatrixBlock}|.
%
% 
% The following command will be linked to |\Block| in the environments of
% \pkg{nicematrix}. We define it with |\NewDocumentCommand| of \pkg{xparse}
% because it has an optional argument between |<| and |>| (for TeX instructions
% put before the math mode of the label)
%
%    \begin{macrocode}
\NewDocumentCommand \@@_Block: { O { } m D < > { } m }
  { \@@_Block_i #2 \q_stop { #1 } { #3 } { #4 } }
%    \end{macrocode}
% 
% \medskip
% The first mandatory argument of |\@@_Block:| has a special syntax. It must be
% of the form $i$|-|$j$ where $i$ and $j$ are the size (in rows and columns) of
% the block.
%    \begin{macrocode}
\cs_new:Npn \@@_Block_i #1-#2 \q_stop { \@@_Block_ii:nnnnn { #1 } { #2 } }
%    \end{macrocode}
%
% \medskip
% Now, the arguments have been extracted: |#1| is $i$ (the number of rows of the
% block), |#2| is $j$ (the number of columns of the block), |#3| is the list of
% key-values, |#4| are the tokens to put before the math mode and |#5| is the
% label of the block.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_Block_ii:nnnnn #1 #2 #3 #4 #5
  {
%    \end{macrocode}
% We write an instruction in the |code-after|. We write the instruction in the
% beginning of the |code-after| (the |left| in |\tl_gput_left:Nx|) because we
% want the Tikz nodes corresponding of the block created \emph{before} potential
% instructions written by the user in the |code-after| (these instructions may
% use the Tikz node of the created block).
%    \begin{macrocode}
    \tl_gput_left:Nx \g_@@_internal_code_after_tl
      {
        \@@_Block_iii:nnnnnn
          { \int_use:N \c@iRow }
          { \int_use:N \c@jCol }
          { \int_eval:n { \c@iRow + #1 - 1 } }
          { \int_eval:n { \c@jCol + #2 - 1 } }
          { #3 }
          \exp_not:n { { #4 $ #5 $ } } 
      } 
%    \end{macrocode}
% It's not allowed to use the command |\Block| twice in the same cell of the
% array. That's why, at the first use, we link the command |\Block|
% to a special version. The scope of this link is the cell of the array.
%    \begin{macrocode}
    \cs_set_eq:NN \Block \@@_Block_error:nn
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new:Npn \@@_Block_error:nn #1 #2
  { 
    \@@_error:n { Second~Block }  
    \cs_set_eq:NN \Block \use:nn
  }
%    \end{macrocode}
% 
% \medskip 
%   \begin{macrocode}
\keys_define:nn { NiceMatrix / Block }
  {
    tikz .tl_set:N = \l_@@_tikz_tl ,
    tikz .value_required:n = true ,
    white .bool_set:N = \l_@@_white_bool ,
    white .default:n = true ,
    white .value_forbidden:n = true ,
  }
%    \end{macrocode}
%
%
% \medskip
% The following command |\@@_Block_iii:nnnnnn| will be used in the |code-after|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6
  { 
%    \end{macrocode}
% The group is for the keys.
%    \begin{macrocode}
    \group_begin:
    \keys_set:nn { NiceMatrix / Block } { #5 }
%    \end{macrocode}
%
%    \begin{macrocode}
    \bool_if:nTF
      { 
           \int_compare_p:nNn { #3 } > \c@iRow 
        || \int_compare_p:nNn { #4 } > \c@jCol 
      }
      { \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } }
      {
%    \end{macrocode}
% We put the contents of the cell in the box |\l_@@_cell_box| because we want
% the command |\rotate| used in the content to be able to rotate the box.
%    \begin{macrocode}
        \hbox_set:Nn \l_@@_cell_box { #6 } 
%    \end{macrocode}
%
% \medskip
% The construction of the node corresponding to the merged cells.
%    \begin{macrocode}
        \pgfpicture 
          \pgfrememberpicturepositiononpagetrue
          \pgf@relevantforpicturesizefalse
          \@@_qpoint: { row - #1 } 
          \dim_set_eq:NN \l_tmpa_dim \pgf@y
          \@@_qpoint: { col - #2 } 
          \dim_set_eq:NN \l_tmpb_dim \pgf@x
          \@@_qpoint: { row - \@@_succ:n { #3 } } 
          \dim_set_eq:NN \l_tmpc_dim \pgf@y
          \@@_qpoint: { col - \@@_succ:n { #4 } } 
          \dim_set_eq:NN \l_tmpd_dim \pgf@x
%    \end{macrocode}
% 
% \medskip
% The following code doesn't work for the first vertical rule. You should allow
% the option |white| if and only if the option |vlines| and |hlines| has been used.
%    \begin{macrocode}
          \bool_if:NT \l_@@_white_bool
            {
              \begin { pgfscope }
              \pgfsetfillcolor { white }
%    \end{macrocode}
% Usually, the vertical rules are \emph{before} the |col|-nodes. But there is an
% exception: if there is no ``first col'', the first vertical rule is after the
% col node.\footnote{That's true for the vertical rules drawn by ``"|"'' due to
% the conception of |{array}| (of \pkg{array}) and we have managed to have the
% same behaviour with |vlines|.}
% 
% Since we don't want the white rectangle to erase a part of this
% first rule, we have to do an adjustment in this case.
% \emph{after} the ``col node''. 
%    \begin{macrocode}
              \int_compare:nNnT { #2 } = 1
                { 
                  \int_compare:nNnT \l_@@_first_col_int = 1 
                    { \dim_add:Nn \l_tmpb_dim \arrayrulewidth }
                }
              \pgfpathrectanglecorners 
                { \pgfpoint \l_tmpb_dim { \l_tmpa_dim - \arrayrulewidth } } 
                { \pgfpoint { \l_tmpd_dim - \arrayrulewidth } \l_tmpc_dim }
              \pgfusepathqfill
              \end { pgfscope }
            }
%    \end{macrocode}
%
% We construct the node for the block with the name |(#1-#2-block)|.
%
% The function |\@@_pgf_rect_node:nnnnn| takes as arguments the name of the node
% and the four coordinates of two opposite corner points of the rectangle.
%    \begin{macrocode}
          \begin { pgfscope }
          \exp_args:Nx \pgfset { \l_@@_tikz_tl }
          \@@_pgf_rect_node:nnnnn
            { \@@_env: - #1 - #2 - block }
            \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim 
          \end { pgfscope }
%    \end{macrocode}
%
% 
% \medskip
% If the creation of the ``medium nodes'' is required, we create a ``medium
% node'' for the block. The function |\@@_pgf_rect_node:nnnnn| takes as
% arguments the name of the node and two \textsc{pgf} points.
%    \begin{macrocode}
        \bool_if:NT \l_@@_medium_nodes_bool
          {
            \@@_pgf_rect_node:nnn
              { \@@_env: - #1 - #2 - block - medium }
              { \pgfpointanchor { \@@_env: - #1 - #2 - medium } { north~west } }
              { \pgfpointanchor { \@@_env: - #3 - #4 - medium } { south~east } } 
          }
%    \end{macrocode}
% \medskip
% Now, we will put the label of the block.
%    \begin{macrocode}
        \int_compare:nNnTF { #1 } = { #3 }
          {
%    \end{macrocode}
% If the block has only one row, we want the label of the block perfectly
% aligned on the baseline of the row. That's why we have constructed a
% |\pgfcoordinate| on the baseline of the row, in the first column of the array.
% Now, we retrieve the $y$-value of that node and we store it in |\l_tmpa_dim|.
%    \begin{macrocode}
            \pgfextracty \l_tmpa_dim { \@@_qpoint: { row - #1 - base } }
%    \end{macrocode}
% We retrieve (in |\pgf@x|) the $x$-value of the center of the block.
%    \begin{macrocode}
            \@@_qpoint: { #1 - #2 - block } 
%    \end{macrocode}
% We put the label of the block which has been composed in |\l_@@_cell_box|.
%    \begin{macrocode}
            \pgftransformshift { \pgfpoint \pgf@x \l_tmpa_dim }
            \pgfnode { rectangle } { base } 
              { \box_use_drop:N \l_@@_cell_box } { } { }
          }
%    \end{macrocode}
%
% \medskip
% If the number of rows is different of $1$, we put the label of the block in
% the center of the node (the label of the block has been composed in
% |\l_@@_cell_box|). 
%    \begin{macrocode}
          { 
            \pgftransformshift { \@@_qpoint: { #1 - #2 - block } }
            \pgfnode { rectangle } { center } 
              { \box_use_drop:N \l_@@_cell_box } { } { }
          }   
        \endpgfpicture
      }
    \group_end:
  }
%    \end{macrocode}
%
% \bigskip
% \subsection*{How to draw the dotted lines transparently}
%    \begin{macrocode}
\cs_set_protected:Npn \@@_renew_matrix:
  { 
    \RenewDocumentEnvironment { pmatrix } { }
      { \pNiceMatrix } 
      { \endpNiceMatrix }
    \RenewDocumentEnvironment { vmatrix } { }
      { \vNiceMatrix }
      { \endvNiceMatrix }
    \RenewDocumentEnvironment { Vmatrix } { }
      { \VNiceMatrix }
      { \endVNiceMatrix }
    \RenewDocumentEnvironment { bmatrix } { }
      { \bNiceMatrix }
      { \endbNiceMatrix }
    \RenewDocumentEnvironment { Bmatrix } { }
      { \BNiceMatrix }
      { \endBNiceMatrix }
  }
%    \end{macrocode}
%
%
% \bigskip
% \subsection*{Automatic arrays}
%
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_set_size:n #1-#2 \q_stop
  {
    \int_set:Nn \l_@@_nb_rows_int { #1 }
    \int_set:Nn \l_@@_nb_cols_int { #2 }
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } } 
  {
    \int_zero_new:N \l_@@_nb_rows_int
    \int_zero_new:N \l_@@_nb_cols_int
    \@@_set_size:n #4 \q_stop
    \begin { NiceArrayWithDelims } { #1 } { #2 } 
      { * { \l_@@_nb_cols_int } { C } } [ #3 , #5 , #7 ] 
    \int_compare:nNnT \l_@@_first_row_int = 0
      { 
        \int_compare:nNnT \l_@@_first_col_int = 0 { & } 
        \prg_replicate:nn { \l_@@_nb_cols_int - 1 } { & } 
        \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\ 
      }
    \prg_replicate:nn \l_@@_nb_rows_int
      { 
        \int_compare:nNnT \l_@@_first_col_int = 0 { & }
%    \end{macrocode}
% You put |{ }| before |#6| to avoid a hasty expansion of an eventual
% |\arabic{iRow}| at the beginning of the row which would result in an incorrect
% value of that |iRow| (since |iRow| is incremented in the first cell of the row
% of the |\halign|).
%    \begin{macrocode}
        \prg_replicate:nn { \l_@@_nb_cols_int - 1 } { { } #6 & } #6
        \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\  
      }
    \int_compare:nNnT \l_@@_last_row_int > { -2 }
      { 
        \int_compare:nNnT \l_@@_first_col_int = 0 { & }
        \prg_replicate:nn { \l_@@_nb_cols_int - 1 } { & } 
        \int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\  
      }
    \end { NiceArrayWithDelims }
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_set_protected:Npn \@@_define_com:nnn #1 #2 #3
  { 
    \cs_set_protected:cpn { #1 AutoNiceMatrix }
      {
        \str_gset:Nx \g_@@_name_env_str { #1 AutoNiceMatrix } 
        \AutoNiceMatrixWithDelims { #2 } { #3 }
      }  
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_define_com:nnn p ( ) 
\@@_define_com:nnn b [ ]
\@@_define_com:nnn v | |
\@@_define_com:nnn V \| \|
\@@_define_com:nnn B \{ \}
%    \end{macrocode}
% 
% \subsection*{The command \textbackslash CodeAfter}
%
% The command |\CodeAfter| catches everything until the end of the current
% environment (of \pkg{nicematrix}).
%
% First, we go until the next command |\end|. 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_CodeAfter:n #1 \end
  {
    \tl_gput_right:Nn \g_@@_code_after_tl { #1 }
    \@@_CodeAfter_i:n
  }
%    \end{macrocode}
%
% We catch the argument of the command |\end| (in |#1|).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_CodeAfter_i:n #1
  {
%    \end{macrocode}
% If this is really the end of the current environment (of \pkg{nicematrix}), we
% put back the command |\end| and its argument in the TeX flow.
%    \begin{macrocode}
    \bool_if:NTF { \str_if_eq_p:Vn \g_@@_name_env_str { #1 } }
      { \end { #1 } }
%    \end{macrocode}
% It this is not the |\end| we are looking for, we put those tokens in
% |\g_@@_code_after_tl| and we go on searching for the next command |\end| with
% a recursive call to the command |\@@_CodeAfter:n|.
%    \begin{macrocode}
      { 
        \tl_gput_right:Nn \g_@@_code_after_tl { \end { #1 } } 
        \@@_CodeAfter:n
      } 
  }
%    \end{macrocode}
%
%
% \bigskip
% \subsection*{We process the options}
%
% We process the options when the package is loaded (with |\usepackage|) but we
% recommend to use |\NiceMatrixOptions| instead. 
%
% We must process these options after the definition of the environment
% |{NiceMatrix}| because the option |renew-matrix| executes the code
% |\cs_set_eq:NN \env@matrix \NiceMatrix|.  
%
% Of course, the command |\NiceMatrix| must be defined before such an
% instruction is executed. 
%    \begin{macrocode}
\bool_new:N \c_@@_obsolete_environments_bool
\keys_define:nn { NiceMatrix / Package }
  {
    renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
    renew-dots .value_forbidden:n = true ,
    renew-matrix .code:n = \@@_renew_matrix: ,
    renew-matrix .value_forbidden:n = true ,
    transparent .meta:n = { renew-dots , renew-matrix } ,
    transparent .value_forbidden:n = true,
    obsolete-environments .bool_set:N = \c_@@_obsolete_environments_bool ,
    obsolete-environments .value_forbidden:n = true ,
    obsolete-environments .default:n = true ,
    starred-commands .code:n = 
      \@@_msg_redirect_name:nn { starred~commands } { none } ,
    starred-commands .value_forbidden:n = true ,

  }
\ProcessKeysOptions { NiceMatrix / Package }
%    \end{macrocode}
%
% \bigskip
% \subsection*{Error messages of the package}
%
% The following command converts all the elements of a sequence (which are token
% lists) into strings. 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_convert_to_str_seq:N #1
  {
    \seq_clear:N \l_tmpa_seq
    \seq_map_inline:Nn #1 
      {
        \seq_put_left:Nx \l_tmpa_seq { \tl_to_str:n { ##1 } }
      }
    \seq_set_eq:NN #1 \l_tmpa_seq
  }
%    \end{macrocode}
% 
% The following command creates a sequence of strings (|str|) from a |clist|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_set_seq_of_str_from_clist:Nn #1 #2
  {
    \seq_set_from_clist:Nn #1 { #2 }
    \@@_convert_to_str_seq:N #1
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_set_seq_of_str_from_clist:Nn \c_@@_types_of_matrix_seq
  { 
    NiceMatrix ,
    pNiceMatrix , bNiceMatrix , vNiceMatrix, BNiceMatrix, VNiceMatrix 
  } 
%    \end{macrocode}
% 
% \bigskip
% If the user uses too much columns, the command |\@@_error_too_much_cols:| is
% executed. This command raises an error but try to give the best information to
% the user in the error message. The command |\seq_if_in:NVTF| is not expandable
% and that's why we can't put it in the error message itself. We have to do the
% test before the |\@@_fatal:n|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_error_too_much_cols:
  { 
    \seq_if_in:NVTF \c_@@_types_of_matrix_seq \g_@@_name_env_str
      { 
        \int_compare:nNnTF \l_@@_last_col_int = { -2 }
        { \@@_fatal:n { too~much~cols~for~matrix } }
        {
          \bool_if:NF \l_@@_last_col_without_value_bool
            { \@@_fatal:n { too~much~cols~for~matrix~with~last~col } }
        }
      }
      { \@@_fatal:n { too~much~cols~for~array } }
  }
%    \end{macrocode}
% 
% The following command must \emph{not} be protected since it's used in an error message.
%    \begin{macrocode}
\cs_new:Npn \@@_message_hdotsfor:
  {
    \tl_if_empty:VF \g_@@_Hdotsfor_lines_tl
      { ~Maybe~your~use~of~\token_to_str:N \Hdotsfor\ is~incorrect.}
  }
%    \end{macrocode}
% 
%
%    \begin{macrocode}
\@@_msg_new:nn { too~much~cols~for~matrix~with~last~col }
  { 
    You~try~to~use~more~columns~than~allowed~by~your~
    \@@_full_name_env:.\@@_message_hdotsfor:\ The~maximal~number~of~
    columns~is~\int_eval:n { \l_@@_last_col_int - 1 }~(plus~the~potential~
    exterior~ones).~This~error~is~fatal. 
  }
%    \end{macrocode}
% 
% 
%    \begin{macrocode}
\@@_msg_new:nn { too~much~cols~for~matrix }
  { 
    You~try~to~use~more~columns~than~allowed~by~your~
    \@@_full_name_env:.\@@_message_hdotsfor:\ Recall~that~the~maximal~
    number~of~columns~for~a~matrix~is~fixed~by~the~LaTeX~counter~
    'MaxMatrixCols'.~Its~actual~value~is~\int_use:N \c@MaxMatrixCols.~
    This~error~is~fatal.  
  }
%    \end{macrocode}
%
% \medskip
% For the following message, remind that the test is not done after the
% construction of the array but in each row. That's why we have to put
% |\c@jCol-1| and not |\c@jCol|.
%    \begin{macrocode}
\@@_msg_new:nn { too~much~cols~for~array }
  { 
    You~try~to~use~more~columns~than~allowed~by~your~
    \@@_full_name_env:.\@@_message_hdotsfor:\ The~maximal~number~of~columns~is~ 
    \int_eval:n { \c@jCol - 1 }~(plus~the~potential~exterior~ones).~
    This~error~is~fatal.
  }
%    \end{macrocode}
%
%  
%    \begin{macrocode}  
\@@_msg_new:nn { bad~option~for~line-style }
  {
    Since~you~haven't~loaded~Tikz,~the~only~value~you~can~give~to~'line-style'~
    is~'standard'.~If~you~go~on,~this~option~will~be~ignored.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Unknown~option~for~xdots } 
  {
    As~for~now~there~is~only~three~options~available~here:~'color',~'line-style'~
    and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~
    this~option~will~be~ignored.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { ampersand~in~light-syntax }
  {
    You~can't~use~an~ampersand~(\token_to_str &)~to~separate~columns~because
    ~you~have~used~the~option~'light-syntax'.~This~error~is~fatal.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { double-backslash~in~light-syntax }
  {
    You~can't~use~\token_to_str:N \\~to~separate~rows~because~you~have~used~ 
    the~option~'light-syntax'.~You~must~use~the~character~'\l_@@_end_of_row_tl'~
    (set~by~the~option~'end-of-row').~This~error~is~fatal.
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { starred~commands }
  {
    The~starred~versions~of~\token_to_str:N \Cdots,~\token_to_str:N \Ldots,~
    \token_to_str:N \Vdots,~\token_to_str:N\Ddots\ and~\token_to_str:N\Iddots\ 
    are~deprecated.~However,~you~can~go~on~for~this~time.~If~you~don't~want~to~
    see~this~error~we~should~load~'nicematrix'~with~the~option~
    'starred-commands'.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { bad~value~for~baseline }
  {
    The~value~given~to~'baseline'~(\int_use:N \l_tmpa_int)~is~not~
    valid.~The~value~must~be~between~\int_use:N \l_@@_first_row_int\ and~
    \int_use:N \g_@@_row_total_int\ or~equal~to~'t',~'c'~or~'b'.\\
    If~you~go~on,~a~value~of~1~will~be~used.
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\@@_msg_new:nn { Second~Block }
  {
    You~can't~use~\token_to_str:N \Block\ twice~in~the~same~cell~of~the~array.\\ 
    If~you~go~on,~this~command~(and~the~other)~will~be~ignored.
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { empty~environment }
  { Your~\@@_full_name_env:\ is~empty.~This~error~is~fatal. }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { unknown~cell~for~line~in~code-after }
  {
    Your~command~\token_to_str:N\line\{#1\}\{#2\}~in~the~'code-after'~
    can't~be~executed~because~a~cell~doesn't~exist.\\
    If~you~go~on~this~command~will~be~ignored.
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\@@_msg_new:nn { last-col~non~empty~for~NiceArray }
  {
    In~the~\@@_full_name_env:,~you~must~use~the~option~
    'last-col'~without~value.\\
    However,~you~can~go~on~for~this~time~
    (the~value~'\l_keys_value_tl'~will~be~ignored). 
  }
%    \end{macrocode}
%
% 
%    \begin{macrocode}
\@@_msg_new:nn { Block~too~large }
  {
    You~try~to~draw~a~block~in~the~cell~#1-#2~of~your~matrix~but~the~matrix~is~
    too~small~for~that~block. \\
    If~you~go~on,~this~command~will~be~ignored.
  }
%    \end{macrocode}
%
% 
%    \begin{macrocode}
\@@_msg_new:nn { Wrong~last~row }
  { 
    You~have~used~'last-row=\int_use:N \l_@@_last_row_int'~but~your~
    \@@_full_name_env:\ seems~to~have~\int_use:N \c@iRow \ rows.~
    If~you~go~on,~the~value~of~\int_use:N \c@iRow \ will~be~used~for~
    last~row.~You~can~avoid~this~problem~by~using~'last-row'~  
    without~value~(more~compilations~might~be~necessary).
  }
%    \end{macrocode}     
%
%
%    \begin{macrocode}
\@@_msg_new:nn { Yet~in~env }
  { 
    Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~nested.\\ 
    This~error~is~fatal.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Outside~math~mode }
  {
    The~\@@_full_name_env:\ can~be~used~only~in~math~mode~
    (and~not~in~\token_to_str:N \vcenter).\\
    This~error~is~fatal.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Bad~value~for~letter~for~dotted~lines }
  { 
    The~value~of~key~'\tl_use:N\l_keys_key_str'~must~be~of~length~1.\\
    If~you~go~on,~it~will~be~ignored. 
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~NiceMatrixOptions }
  {
    The~key~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~command~
    \token_to_str:N \NiceMatrixOptions. \\
    If~you~go~on,~it~will~be~ignored. \\
    For~a~list~of~the~available~keys,~type~H~<return>.
  }
  { 
    The~available~options~are~(in~alphabetic~order):~
    allow-duplicate-names,~
    code-for-first-col,~
    code-for-first-row,~
    code-for-last-col,~
    code-for-last-row,~
    create-extra-nodes,~
    create-medium-nodes,~
    create-large-nodes,~
    end-of-row,~
    exterior-arraycolsep,~
    hlines,~
    hvlines,~
    left-margin,~
    letter-for-dotted-lines,~
    light-syntax,~
    nullify-dots,~
    parallelize-diags,~
    renew-dots,~
    renew-matrix,~
    right-margin,~
    small,~
    transparent,~
    vlines,~
    xdots/color,~
    xdots/shorten~and~
    xdots/line-style.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceArray }
  { 
    The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~
    \{NiceArray\}. \\
    If~you~go~on,~it~will~be~ignored. \\
    For~a~list~of~the~available~options,~type~H~<return>.
  }
  {
    The~available~options~are~(in~alphabetic~order):~
    b,~
    baseline,~
    c,~
    code-after,~
    code-for-first-col,~
    code-for-first-row,~
    code-for-last-col,~
    code-for-last-row,~
    columns-width,~
    create-extra-nodes,~
    create-medium-nodes,~
    create-large-nodes,~
    end-of-row,~
    extra-left-margin,~
    extra-right-margin,~
    first-col,~
    first-row,~
    hlines,~
    hvlines,~
    last-col,~
    last-row,~
    left-margin,~
    light-syntax,~
    name,~
    nullify-dots,~
    parallelize-diags,~
    renew-dots,~
    right-margin,~
    small,~
    t,~
    vlines,~
    xdots/color,~
    xdots/shorten~and~
    xdots/line-style.
  }
%    \end{macrocode}
%
% \medskip
% This error message is used for the set of keys |NiceMatrix/NiceMatrix| and
% |NiceMatrix/pNiceArray| (but not by |NiceMatrix/NiceArray| because, for this
% set of keys, there is also the options |t|, |c| and~|b|).
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
  { 
    The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~
    \@@_full_name_env:. \\
    If~you~go~on,~it~will~be~ignored. \\
    For~a~list~of~the~available~options,~type~H~<return>.
  }
  {
    The~available~options~are~(in~alphabetic~order):~
    b,~
    baseline,~
    c,~
    code-after,~
    code-for-first-col,~
    code-for-first-row,~
    code-for-last-col,~
    code-for-last-row,~
    columns-width,~
    create-extra-nodes,~
    create-medium-nodes,~
    create-large-nodes,~
    end-of-row,~
    extra-left-margin,~
    extra-right-margin,~
    first-col,~
    first-row,~
    hlines,~
    hvlines,~
    l~(=L),~
    last-col,~
    last-row,~
    left-margin,~
    light-syntax,~
    name,~
    nullify-dots,~
    parallelize-diags,~
    r~(=R),~
    renew-dots,~
    right-margin,~
    small,~
    t,~
    vlines,~
    xdots/color,~
    xdots/shorten~and~
    xdots/line-style.
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\@@_msg_new:nnn { Duplicate~name }
  { 
    The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
    the~same~environment~name~twice.~You~can~go~on,~but,~
    maybe,~you~will~have~incorrect~results~especially~ 
    if~you~use~'columns-width=auto'.~If~you~don't~want~to~see~this~
    message~again,~use~the~option~'allow-duplicate-names'.\\
    For~a~list~of~the~names~already~used,~type~H~<return>. \\ 
  }
  {
    The~names~already~defined~in~this~document~are:~
    \seq_use:Nnnn \g_@@_names_seq { ,~ } { ,~ } { ~and~ }.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Option~auto~for~columns-width }
  { 
    You~can't~give~the~value~'auto'~to~the~option~'columns-width'~here.~
    If~you~go~on,~the~option~will~be~ignored.
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { Zero~row }
  { 
    There~is~a~problem.~Maybe~you~have~used~l,~c~and~r~instead~of~L,~C~
    and~R~in~the~preamble~of~your~environment. \\
    This~error~is~fatal.
  }
%    \end{macrocode}
%
%
% \bigskip
% \subsection*{Obsolete environments}
%
% The following environments are loaded only when the package \pkg{nicematrix}
% has been loaded with the option |obsolete-environments|. However, they will be
% completly deleted in a future version.
%
%    \begin{macrocode} 
\bool_if:NT \c_@@_obsolete_environments_bool
  {
    \NewDocumentEnvironment { pNiceArrayC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \pNiceArray
      }
      { \endpNiceArray }
     \NewDocumentEnvironment { bNiceArrayC } { }
       {
         \int_zero:N \l_@@_last_col_int 
         \bNiceArray
       }
       { \endbNiceArray }
    \NewDocumentEnvironment { BNiceArrayC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \BNiceArray
      }
      { \endBNiceArray }
    \NewDocumentEnvironment { vNiceArrayC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \vNiceArray
      }
      { \endvNiceArray }
    \NewDocumentEnvironment { VNiceArrayC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \VNiceArray
      }
      { \endVNiceArray }
    \NewDocumentEnvironment { pNiceArrayRC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \int_zero:N \l_@@_first_row_int 
        \pNiceArray
      }
      { \endpNiceArray }
    \NewDocumentEnvironment { bNiceArrayRC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \int_zero:N \l_@@_first_row_int 
        \bNiceArray
      }
      { \endbNiceArray }
    \NewDocumentEnvironment { BNiceArrayRC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \int_zero:N \l_@@_first_row_int 
        \BNiceArray
      }
      { \endBNiceArray }
    \NewDocumentEnvironment { vNiceArrayRC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \int_zero:N \l_@@_first_row_int 
        \vNiceArray
      }
      { \endvNiceArray }
    \NewDocumentEnvironment { VNiceArrayRC } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \int_zero:N \l_@@_first_row_int 
        \VNiceArray
      }
      { \endVNiceArray }
    \NewDocumentEnvironment { NiceArrayCwithDelims } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \NiceArrayWithDelims
      }
      { \endNiceArrayWithDelims }
    \NewDocumentEnvironment { NiceArrayRCwithDelims } { }
      {
        \int_zero:N \l_@@_last_col_int 
        \int_zero:N \l_@@_first_row_int 
        \NiceArrayWithDelims
      }
      { \endNiceArrayWithDelims }
  }
%    \end{macrocode}
%
%
% 
% \vspace{1cm}
% \section{History}
%
% \subsection*{Changes between versions 1.0 and 1.1}
% 
% The dotted lines are no longer drawn with Tikz nodes but with Tikz circles
% (for efficiency). 
% 
% Modification of the code which is now twice faster.
%
% \subsection*{Changes between versions 1.1 and 1.2}
%
% New environment |{NiceArray}| with column types |L|, |C| and |R|.
%
% \subsection*{Changes between version 1.2 and 1.3}
%
% New environment |{pNiceArrayC}| and its variants.
%
% Correction of a bug in the definition of |{BNiceMatrix}|, |{vNiceMatrix}| and
% |{VNiceMatrix}| (in fact, it was a typo).
%
% Options are now available locally in |{pNiceMatrix}| and its variants. 
% 
% The names of the options are changed. The old names were names in ``camel
% style''. 
%
% \subsection*{Changes between version 1.3 and 1.4}
% 
% The column types |w| and |W| can now be used in the environments
% |{NiceArray}|, |{pNiceArrayC}| and its variants with the same meaning as in
% the package \pkg{array}. 
% 
% New option |columns-width| to fix the same width for all the columns of the
% array. 
% 
%
% \subsection*{Changes between version 1.4 and 2.0}
% 
% The versions 1.0 to 1.4 of \pkg{nicematrix} were focused on the continuous
% dotted lines whereas the version 2.0 of \pkg{nicematrix} provides different
% features to improve the typesetting of mathematical matrices. 
%
% \subsection*{Changes between version 2.0 and 2.1}
%
% New implementation of the environment |{pNiceArrayRC}|. With this new
% implementation, there is no restriction on the width of the columns.
%
% The package \pkg{nicematrix} no longer loads \pkg{mathtools} but only
% \pkg{amsmath}. 
%
% Creation of ``medium nodes'' and ``large nodes''.
%
% \subsection*{Changes between version 2.1 and 2.1.1}
%
% Small corrections: for example, the option |code-for-first-row| is now
% available in the command |\NiceMatrixOptions|. 
%
% Following a discussion on
% TeX StackExchange\footnote{cf.
% |tex.stackexchange.com/questions/450841/tikz-externalize-and-nicematrix-package|},  
% Tikz externalization is now deactivated in the environments of the
% package \pkg{nicematrix}.\footnote{Before this version, there was an error
% when using \pkg{nicematrix} with Tikz externalization. In any case, it's not
% possible to externalize the Tikz elements constructed by \pkg{nicematrix}
% because they use the options |overlay| and |remember picture|.} 
% 
% \subsection*{Changes between version 2.1 and 2.1.2}
% Option |draft|: with this option, the dotted lines are not drawn (quicker).
%
% \subsection*{Changes between version 2.1.2 and 2.1.3}
%
% When searching the end of a dotted line from a command like |\Cdots| issued in
% the ``main matrix'' (not in the exterior column), the cells in the exterior
% column are considered as outside the matrix. That means that it's possible to
% do the following matrix with only a |\Cdots| command (and a single |\Vdots|).
% \[\begin{pNiceArray}{Wc{5mm}CWc{5mm}}[first-row,last-col]
% & C_j & \\
% \mbox{\Large $0$} & \Vdots & \mbox{\Large $0$} \\
% \strut            & a & \Cdots &  L_i \\
% \mbox{\Large $0$} &  & \mbox{\Large $0$} \\
% \end{pNiceArray}\]
%
% \subsection*{Changes between version 2.1.3 and 2.1.4}
%
% Replacement of some options |O { }| in commands and environments defined with
% \pkg{xparse} by |! O { }| (because a recent version of \pkg{xparse} introduced
% the specifier |!| and modified the default behaviour of the last optional
% arguments). 
%
% See |www.texdev.net/2018/04/21/xparse-optional-arguments-at-the-end|
%
% \subsection*{Changes between version 2.1.4 and 2.1.5}
%
% Compatibility with the classes \cls{revtex4-1} and \cls{revtex4-2}.
% 
% Option |allow-duplicate-names|.
%
% \subsection*{Changes between version 2.1.5 and 2.2}
%
% Possibility to draw horizontal dotted lines to separate rows with the command 
% |\hdottedline| (similar to the classical command |\hline| and the command
% |\hdashline| of \pkg{arydshln}). 
%
% Possibility to draw vertical dotted lines to separate columns with the
% specifier ``|:|'' in the preamble (similar to the classical specifier
% ``"|"'' and the specifier ``|:|'' of \pkg{arydshln}).
%
% \subsection*{Changes between version 2.2 and 2.2.1}
%
% Improvment of the vertical dotted lines drawn by the specifier ``:'' in the
% preamble. 
%
% Modification of the position of the dotted lines drawn by |\hdottedline|.
%
% \subsection*{Changes between version 2.2.1 and 2.3}
%
% Compatibility with the column type |S| of \pkg{siunitx}.
% 
% Option |hlines|.
% 
% A warning is issued when the |draft| mode is used. In this case, the dotted
% lines are not drawn.
%
%
% \subsection*{Changes between version 2.3 and 3.0}
%
% Modification of |\Hdotsfor|. Now |\Hdotsfor| erases the |\vlines| (of ``"|"'')
% as |\hdotsfor| does.
%
% Composition of exterior rows and columns on the four sides of the matrix (and
% not only on two sides) with the options |first-row|, |last-row|, |first-col|
% and |last-col|.
%
% \subsection*{Changes between version 3.0 and 3.1}
%
% Command |\Block| to draw block matrices.
% 
% Error message when the user gives an incorrect value for |last-row|.
%
% A dotted line can no longer cross another dotted line (excepted the dotted
% lines drawn by |\cdottedline|, the symbol ``|:|'' (in the preamble of the
% array) and |\line| in |code-after|).
%
% The starred versions of |\Cdots|, |\Ldots|, etc. are now deprecated because,
% with the new implementation, they become pointless. These starred versions
% are no longer documented.
% 
% The vertical rules in the matrices (drawn by ``"|"'') are now compatible with
% the color fixed by \pkg{colortbl}.
%
% Correction of a bug: it was not possible to use the colon ``|:|'' in the
% preamble of an array when |pdflatex| was used with \pkg{french-babel} (because
% \pkg{french-babel} activates the colon in the beginning of the document).
% 
%
% \subsection*{Changes between version 3.1 and 3.2 (and 3.2a)}
%
% Option |small|.
%
% \subsection*{Changes between version 3.2 and 3.3}
%
% The options |first-row|, |last-row|, |first-col| and |last-col| are now
% available in the environments |{NiceMatrix}|, |{pNiceMatrix}|,
% |{bNiceMatrix}|, etc.
%
% The option |columns-width=auto| doesn't need any more a second compilation.
% 
% The options |renew-dots|, |renew-matrix| and |transparent| are now available
% as package options (as said in the documentation).
%
% The previous version of \pkg{nicematrix} was incompatible with a recent
% version of \pkg{expl3} (released 2019/09/30). This version is compatible.
%
%
% \subsection*{Changes between version 3.3 and 3.4}
%
% Following a discussion on TeX StackExchange\footnote{cf.
% |tex.stackexchange.com/questions/510841/nicematrix-and-tikz-external-optimize|}, 
% optimization of Tikz externalization is disabled in the environments of
% \pkg{nicematrix} when the class \cls{standalone} or the package
% \pkg{standalone} is used. 
% 
% \subsection*{Changes between version 3.4 and 3.5} 
%
% Correction on a bug on the two previous versions where the |code-after| was
% not executed.
% 
% \subsection*{Changes between version 3.5 and 3.6} 
%
% LaTeX counters |iRow| and |jCol| available in the cells of the array.
% 
% Addition of |\normalbaselines| before the construction of the array: in
% environments like |{align}| of \pkg{amsmath} the value of |\baselineskip| is
% changed and if the options |first-row| and |last-row| were used in an
% environment of \pkg{nicematrix}, the position of the delimiters was wrong.
% 
% A warning is written in the |.log| file if an obsolete environment is used.
%
% There is no longer artificial errors |Duplicate~name| in the environments of
% \pkg{amsmath}. 
%
% \subsection*{Changes between version 3.6 and 3.7} 
% 
% The four ``corners'' of the matrix are correctly protected against the four
% codes: |code-for-first-col|, |code-for-last-col|, |code-for-first-row| and
% |code-for-last-row|. 
%
% New command |\pAutoNiceMatrix| and its variants (suggestion of Christophe
% Bal).
%
% \subsection*{Changes between version 3.7 and 3.8} 
%
% New programmation for the command |\Block| when the block has only one row. 
% With this programmation, the vertical rules drawn by the specifier
% ``\verb+|+'' at the end of the block is actually drawn. In previous versions,
% they were not because the block of one row was constructed with
% |\multicolumn|. 
%
% An error is raised when an obsolete environment is used.
% 
%
% \subsection*{Changes between version 3.8 and 3.9} 
% 
% New commands |\NiceMatrixLastEnv| and |\OnlyMainNiceMatrix|.
%
% New options |create-medium-nodes| and |create-large-nodes|.
%
% \subsection*{Changes between version 3.9 and 3.10} 
%
% New option |light-syntax| (and |end-of-row|).
%
% New option |dotted-lines-margin| for fine tuning of the dotted lines.
%
% \subsection*{Changes between versions 3.10 and 3.11}
% 
% Correction of a bug linked to |first-row| and |last-row|.
% 
% \subsection*{Changes between versions 3.11 and 3.12}
% 
% Command |\rotate| in the cells of the array.
%
% Options |vlines|, |hlines| and |hvlines|.
%
% Option |baseline| pour |{NiceArray}| (not for the other environments).
%
% The name of the Tikz nodes created by the command |\Block| has changed: when
% the command has been issued in the cell $i$|-|$j$, the name is
% $i$|-|$j$|-block| and, if the creation of the ``medium nodes'' is required, a
% node $i$|-|$j$|-block-medium| is created.
%
% If the user try to use more columns than allowed by its environment, an error
% is raised by nicematrix (instead of a low-level error).
%
% The package must be loaded with the option |obsolete-environments| if we want
% to use the deprecated environments.
%
% \subsection*{Changes between versions 3.12 and 3.13}
%
% The behaviour of the command |\rotate| is improved when used in the ``last
% row''.
%
% The option |dotted-lines-margin| has been renamed in |xdots/shorten| and the
% options |xdots/color| and |xdots/line-style| have been added for a complete
% customization of the dotted lines.
%
% In the environments without preamble (|{NiceMatrix}|, |{pNiceMatrix}|, etc.),
% it's possible to use the options |l| (=|L|) or |r| (=|R|) to specify the type
% of the columns.
%
% The starred versions of the commands |\Cdots|, |\Ldots|, |\Vdots|, |\Ddots|
% and |\Iddots| are deprecated since the version 3.1 of \pkg{nicematrix}. Now,
% one should load \pkg{nicematrix} with the option |starred-commands| to avoid
% an error at the compilation.
%
% The code of \pkg{nicematrix} no longer uses Tikz but only \textsc{pgf}. By
% default, Tikz is \emph{not} loaded by \pkg{nicematrix}.
%
% \subsection*{Changes between versions 3.13 and 3.14}
% 
% Correction of a bug (question 60761504 on |stackoverflow|).
%
% Better error messages when the user uses |&| or |\\| when |light-syntax| is in
% force. 
% 
% \subsection*{Changes between versions 3.14 and 3.15}
% 
% It's possible to put labels on the dotted lines drawn by |\Ldots|, |\Cdots|,
% |\Vdots|, |\Ddots|, |\Iddots|, |\Hdotsfor| and the command |\line| in the
% |code-after| with the tokens |_| and |^|.
%
% The option |baseline| is now available in all the environments of
% \pkg{nicematrix}. Before, it was available only in |{NiceArray}|.
% 
% New command |\CodeAfter| (in the environments of \pkg{nicematrix}).
%
% \PrintIndex
% 
% \tableofcontents
%
% \endinput
% Local Variables:
% TeX-fold-mode: t
% TeX-fold-preserve-comments: nil
% flyspell-mode: nil
% fill-column: 80
% End: