summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx
blob: c3aaadec488844e25d5b1fb44ad80618f041b852 (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
% \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{2.2}
\def\myfiledate{2019/06/23}
%
%
%<*batchfile>
\begingroup
\input l3docstrip.tex
\keepsilent
\usedir{tex/latex/nicematrix}
\preamble

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.

\endpreamble
\askforoverwritefalse
\endgroup
%</batchfile>
%
%<@@=nm>
%<*driver>
\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by nicematrix)
\VerbatimFootnotes
\usepackage{xltxtra}
\usepackage{geometry}
\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
\usepackage{nicematrix}
\usetikzlibrary{fit}
\NewDocumentEnvironment {scope} {} {} {}
\def\interitem{\vskip 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{colortbl}
\usepackage{footnotehyper}
\parindent 0pt

\DisableCrossrefs
\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}}
%
%
% \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 loads the
% packages \pkg{expl3}, \pkg{l3keys2e}, \pkg{xparse}, \pkg{array}, \pkg{amsmath}
% and \pkg{tikz}. It also loads the Tikz library \pkg{fit}.
%
%
%
% \medskip
% \begin{savenotes}
% \begin{minipage}{0.6\linewidth}
% This package provides some new tools to draw mathematical matrices. The main
% features are the following:
% 
% \textbullet\ continuous dotted lines\footnote{If the class option |draft| is
% used, these dotted lines will not be drawn for a faster compilation.};
%
% \textbullet\ a first row and a last column for labels;
%
% \textbullet\ a control of the width of the columns.
% \end{minipage}
% \end{savenotes}
% \hspace{1.4cm}
% $\vcenter{
%  \begin{bNiceArrayRC}{CCCC}[code-for-last-col=\color{blue}\scriptstyle,
%                             code-for-first-row=\color{blue}\scriptstyle,
%                             columns-width = auto]
% C_1     & C_2     & \Cdots  & C_n  \\
% a_{11}  & a_{12}  & \Cdots & a_{1n}  & L_1 \\
% a_{21}  & a_{22}  & \Cdots & a_{2n}  & L_2 \\
% \Vdots & \Vdots & \Ddots & \Vdots & \Vdots \\
% a_{n1}  & a_{n2}  & \Cdots & a_{nn}  & L_n 
% \end{bNiceArrayRC}
% }$
% 
% \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 extension} 
%
% The extension \pkg{nicematrix} defines the following new environments.
% 
% \medskip
% \begin{ttfamily}
% \setlength{\tabcolsep}{3mm}
% \begin{tabular}{llll}
% \{NiceMatrix\}  & \{NiceArray\} & \{pNiceArrayC\}          & \{pNiceArrayRC\} \\
% \{pNiceMatrix\} &               & \{bNiceArrayC\}          & \{bNiceArrayRC\} \\
% \{bNiceMatrix\} &               & \{BNiceArrayC\}          & \{BNiceArrayRC\} \\
% \{BNiceMatrix\} &               & \{vNiceArrayC\}          & \{vNiceArrayRC\} \\
% \{vNiceMatrix\} &               & \{VNiceArrayC\}          & \{VNiceArrayRC\} \\
% \{VNiceMatrix\} &               & \{NiceArrayCwithDelims\} & \{NiceArrayRCwithDelims\} \\
% \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
% \verb|w{...}{...}|, \verb|W{...}{...}|, \verb+|+, |>{...}|, |<{...}|,
% |@{...}|, |!{...}| and |*{n}{...}| but the letters |p|, |m| and |b| should not
% be used. See p.~\pageref{NiceArray} the section relating to |{NiceArray}|.
%
% \medskip
% The environments with |C| at the end of their name, |{pNiceArrayC}|,
% |{bNiceArrayC}|, |{BNiceArrayC}|, |{vNiceArrayC}| and |{VNiceArrayC}| are
% similar to the environment |{NiceArray}| (especially the special letters |L|,
% |C| and |R|) but create an exterior column (on the right of the closing
% delimiter). See p.~\pageref{pNiceArrayC} the section relating to
% |{pNiceArrayC}|.
%
% \medskip 
% The environments with |RC|, |{pNiceArrayRC}|, |{bNiceArrayRC}|,
% |{BNiceArrayRC}|, |{vNiceArrayRC}|, |{VNiceArrayRC}| are similar to the
% environment |{NiceArray}| but create an exterior row (above the main matrix)
% and an exterior column. See p.~\pageref{pNiceArrayRC} the section relating to
% |{pNiceArrayRC}|.
%
% 
% 
% \section{The continuous dotted lines}
%
% Inside the environments of the extension \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: \smash{$\iddots$}. If |mathdots|
% is loaded, the version of |mathdots| is used. It corresponds to the command
% |\adots| of \pkg{unicode-math}.}
%
% \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.\par\nobreak \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% a_1      & \Cdots &        & & a_1 \\
% \Vdots   & a_2    & \Cdots & & a_2 \\
%          & \Vdots & \Ddots \\
% \\
% 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 \\
% \\
% 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.}).
%
% However, useless computations are performed by TeX before detecting that both
% instructions would eventually yield the same dotted line. That's why the
% package \pkg{nicematrix} provides starred versions of |\Ldots|, |\Cdots|,
% etc.: |\Ldots*|, |\Cdots*|, etc. These versions are simply equivalent to
% |\hphantom{\ldots}|, |\hphantom{\cdots}|, etc. The user should use these
% starred versions whenever a classical version has already been used for the
% same dotted line.\par\nobreak 
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% \begin{bNiceMatrix}
% 0       & \Cdots & ~emphase#\Cdots*@ & 0       \\
% \Vdots  &        &         & \Vdots  \\
% ~emphase#\Vdots*@ &        &         & ~emphase#\Vdots*@ \\
% 0       & \Cdots & ~emphase#\Cdots*@ & 0 
% \end{bNiceMatrix}
% \end{BVerbatim}
% $\begin{bNiceMatrix}
% 0       & \Cdots &        & 0      \\
% \Vdots  &        &        &        \\
%         &        &        & \Vdots \\
% 0       &        & \Cdots & 0 
% \end{bNiceMatrix}$
%
% \bigskip
% In fact, in this example, it would be possible to draw the same matrix without
% starred commands 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{Nevertheless, the best way to fix the width of a column is
% to use the environment |{NiceArray}| with a column of type~|w| (or |W|).}
% 
% 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
% |{pmatrix}|.\par\nobreak 
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=8cm]
% $A = \begin{pmatrix}
% a_0 & b \\
% a_1 &   \\
% a_2 &   \\
% a_3 &   \\
% a_4 &   \\
% a_5 & b
% \end{pmatrix}$
% \end{BVerbatim}
% $A = \begin{pmatrix}
% a_0 & b \\
% a_1 &   \\
% a_2 &   \\
% a_3 &   \\
% a_4 &   \\
% a_5 & b
% \end{pmatrix}$
%
%
% \bigskip
% If we add |\vdots| instructions in the second column, the geometry of the
% matrix is modified.\par\nobreak
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=8cm]
% $B = \begin{pmatrix}
% a_0 & b      \\
% a_1 & \vdots \\
% a_2 & \vdots \\
% a_3 & \vdots \\
% a_4 & \vdots \\
% a_5 & b
% \end{pmatrix}$
% \end{BVerbatim}
% $B = \begin{pmatrix}
% a_0 & b      \\
% a_1 & \vdots \\
% a_2 & \vdots \\
% a_3 & \vdots \\
% a_4 & \vdots \\
% a_5 & b
% \end{pmatrix}$
%
% \bigskip
% By default, with \pkg{nicematrix}, if we replace |{pmatrix}| by
% |{pNiceMatrix}| and |\vdots| by |\Vdots| (or |\Vdots*| for efficiency), the
% geometry of the matrix is not changed.\par\nobreak
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=8cm]
% $C = \begin{pNiceMatrix}
% a_0 & b       \\
% a_1 & \Vdots  \\
% a_2 & \Vdots* \\
% a_3 & \Vdots* \\
% a_4 & \Vdots* \\
% a_5 & b
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $C = \begin{pNiceMatrix}
% a_0 & b       \\
% a_1 & \Vdots  \\
% a_2 & \Vdots* \\
% a_3 & \Vdots* \\
% a_4 & \Vdots* \\
% a_5 & b
% \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 column. It's possible by
% using the option |nullify-dots| (and only one instruction |\Vdots| is
% necessary).\par\nobreak 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=8cm]
% $D = \begin{pNiceMatrix}[~emphase#nullify-dots@]
% a_0 & b      \\
% a_1 & \Vdots \\
% a_2 &        \\
% a_3 &        \\
% a_4 &        \\
% a_5 & b
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $D = \begin{pNiceMatrix}[nullify-dots]
% a_0 & b      \\
% a_1 & \Vdots \\
% a_2 &        \\
% a_3 &        \\
% a_4 &        \\
% a_5 & b
% \end{pNiceMatrix}$
%
% \medskip
% The option |nullify-dots| smashes the instructions |\Ldots| (and the variants)
% vertically but also horizontally.
%
% \medskip
% \textbf{There must be no space before the opening bracket (|[|) of the options
% of the environment.}
%
% \subsection{The command 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}$
%
% \bigskip
% The command |\hdotsfor| of \pkg{amsmath} takes an optional argument (between
% square brackets) which is used for fine tuning of the space beetween two
% consecutive dots. For homogeneity, |\Hdotsfor| has also an optional argument
% but this argument is discarded silently.
%
% Remark: Unlike the command |\hdotsfor| of \pkg{amsmath}, the command
% |\Hdotsfor| is compatible with the extension \pkg{colortbl}.
% 
% \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 |{matrix}|. This option can be
% set as option of |\usepackage| or with the command |\NiceMatrixOptions|.
% 
%
% In fact, this option is an alias for the conjonction of two options:
% |renew-dots| and |renew-matrix|.
%
% \smallskip
%
% \begin{itemize}
% \item The option |renew-dots|\par\nobreak
% With this option, the commands |\ldots|, |\cdots|, |\vdots|, |\ddots|,
% |\iddots|\footnote{The command |\iddots| is not a command of LaTeX but is
% defined by the package \pkg{nicematrix}. If |mathdots| is loaded, the version
% of |mathdots| is used.} 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}
% 
%
% 
% 
% \section{The Tikz nodes created by nicematrix}
% 
% The package \pkg{nicematrix} creates a Tikz node for each 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. 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{scope}
% \tikzset{every node/.style = {fill = red!15, inner sep = 0pt}}
% \[\begin{pNiceMatrix}
% a & a + b & a + b + c \\
% a & a     & a + b  \\
% a & a     & a 
% \end{pNiceMatrix}\]
% \end{scope}
% 
%
% \bigskip
% In fact, the package \pkg{nicematrix} can create ``extra nodes''. These new
% nodes are created if the option |create-extra-nodes| is used. There are two
% series of extra nodes: the ``medium nodes'' and the ``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-extra-nodes,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {fill = red!15,
%                                         blend mode = multiply,
%                                         inner sep = -\pgflinewidth/2},
%                    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{In the environments like |{pNiceArrayC}| and
% |{pNiceArrayRC}|, there is not ``large nodes'' created in the exterior row and
% column.}
%
% \[\begin{pNiceMatrix}[
%  create-extra-nodes,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         inner sep = -\pgflinewidth/2},
%                    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|.}
% \[\begin{pNiceMatrix}[
%  create-extra-nodes,left-margin,right-margin,
%  code-after = {\begin{tikzpicture}
%                   [every node/.style = {blend mode = multiply,
%                                         inner sep = -\pgflinewidth/2},
%                    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''. In the following example, we have used
% |extra-left-margin| and |extra-right-margin| with the value $3$~pt.
% \[\begin{pNiceMatrix}[
%  create-extra-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 = -\pgflinewidth/2},
%                    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-extra-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 = -\pgflinewidth/2},
%                    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}.
%
% \section{The code-after}
%
% The option |code-after| may be used to give some code that will be excuted
% after the construction of the matrix (and, hence, after the construction of
% all the Tikz nodes).
%
% In the |code-after|, the Tikz nodes should be accessed by a name of the form
% $i$-$j$ (without the prefix of the name of the environment).
%
% Moreover, a special command, called |\line| is available to draw directly
% dotted lines between nodes.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=12cm]
% $\begin{pNiceMatrix}[~emphase#code-after = {\line {1-1} {3-3}}@]
% 0 & 0 & 0 \\
% 0 &   & 0 \\
% 0 & 0 & 0 \\
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}[code-after = {\line {1-1} {3-3}}]
% 0 & 0 & 0 \\
% 0 &   & 0 \\
% 0 & 0 & 0 \\
% \end{pNiceMatrix}$
%
% 
% \section{The environment \{NiceArray\}}
% \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.} instead of |l|, |c| and |r|. It's possible
% to use the constructions \verb|w{...}{...}|, \verb|W{...}{...}|, \verb+|+,
% |>{...}|, |<{...}|, |@{...}|, |!{...}| 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|.}
%
% \medskip
% The environment |{NiceArray}| accepts the classical options |t|, |c| and |b|
% of |{array}| but also other options defined by \pkg{nicematrix} (|renew-dots|,
% |columns-width|, etc.).
%
% 
% \vspace{1cm}
% An example with a linear system (we need |{NiceArray}| for the vertical rule):
%
% \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]$
%
% \vspace{1cm}
% An example where we use |{NiceArray}| because we want to use the types |L| and
% |R| for the columns:
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
% $\left(\begin{NiceArray}{LCR}
% a_{11}    & \Cdots & a_{1n} \\
% a_{21}    &        & a_{2n} \\
% \Vdots    &        & \Vdots \\
% a_{n-1,1} & \Cdots & a_{n-1,n} \\
% \end{NiceArray}\right)$
% \end{BVerbatim}
% $\left(\begin{NiceArray}{LCR}
% a_{11}    & \Cdots & a_{1n} \\
% a_{21}    &        & a_{2n} \\
% \Vdots    &        & \Vdots \\
% a_{n-1,1} & \Cdots & a_{n-1,n} \\
% \end{NiceArray}\right)$
%
%
%
%
% \section{The environment \{pNiceArrayC\} and its variants}
% \label{pNiceArrayC}
%
% The environment |{pNiceArrayC}| composes a matrix with an exterior column.
%
% The environment |{pNiceArrayC}| takes a mandatory argument which is the
% preamble of the array. The types of columns available are the same as for the
% environment |{NiceArray}|. \textbf{However, no specification must be given for
% the last column.} It will automatically (and necessarily) be a |L|~column.
% 
% A special option, called |code-for-last-col|, specifies tokens that will be
% inserted before each cell of the last column. The option |columns-width|
% doesn't apply to this external column.
% 
% \bigskip
%
% \begin{Verbatim}
% $\begin{pNiceArrayC}{*6C|C}[nullify-dots,~emphase#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{pNiceArrayC}$
% \end{Verbatim}
% 
% \[\begin{pNiceArrayC}{*6C|C}[nullify-dots,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{pNiceArrayC}\]
% 
%
% \bigskip
% In fact, the environment |{pNiceArrayC}| and its variants are based upon a
% more general environment, called |{NiceArrayCwithDelims}|. 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
% |{NiceArrayCwithDelims}| if we want to use atypical delimiters.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{NiceArrayCwithDelims}
%    {\downarrow}{\downarrow}{CCC}
% 1 & 2 & 3 & L_1 \\
% 4 & 5 & 6 & L_2 \\
% 7 & 8 & 9 & L_3
% \end{NiceArrayCwithDelims}$
% \end{BVerbatim}
% $\begin{NiceArrayCwithDelims}
%    {\downarrow}{\downarrow}{CCC}
% 1 & 2 & 3 & L_1 \\
% 4 & 5 & 6 & L_2 \\
% 7 & 8 & 9 & L_3
% \end{NiceArrayCwithDelims}$
%
%
% \section{The environment \{pNiceArrayRC\} and its variants} 
% \label{pNiceArrayRC}
%
% The environment |{pNiceArrayRC}| composes a matrix with an exterior row and an
% exterior column.
%
% This environment |{pNiceArrayRC}| takes a mandatory argument which is the
% preamble of the array. As for the environment |{pNiceArrayC}|, no
% specification must be given for the last column (it will automatically be a
% |L| column).
%
% A special option, called |code-for-first-row|, specifies tokens that will be
% inserted before each cell of the first row.
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{pNiceArrayRC}{CCC}% (here, % is mandatory)
%   [columns-width = auto,
%    code-for-first-row = \color{blue},
%    code-for-last-col  = \color{blue}]
% C_1 & C_2 & C_3 \\
% 1 & 2 & 3 & L_1\\
% 4 & 5 & 6 & L_2\\
% 7 & 8 & 9 & L_3\\
% \end{pNiceArrayRC}$
% \end{BVerbatim}
% $\begin{pNiceArrayRC}{CCC}[columns-width=auto,
%                            code-for-first-row = \color{blue},
%                            code-for-last-col  = \color{blue}]
% C_1 & C_2 & C_3 \\
% 1 & 2 & 3 & L_1 \\
% 4 & 5 & 6 & L_2 \\
% 7 & 8 & 9 & L_3 \\
% \end{pNiceArrayRC}$
%
%
% \bigskip
% The first row of an environment |{pNiceArrayRC}| has the number $0$, and not
% $1$. This number is used for the names of the Tikz nodes (the names of these
% nodes are used, for example, by the command |\line| in |code-after|).
%
% For technical reasons, it's not possible to use the option of the command |\\|
% after the first row (the placement of the delimiters would be wrong).
%
% \bigskip
% In fact, the environment |{pNiceArrayRC}| and its variants are based upon an
% more general environment, called |{NiceArrayRCwithDelims}|. 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
% |{NiceArrayRCwithDelims}| if we want to use atypical delimiters.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{NiceArrayRCwithDelims}
%    {\downarrow}{\downarrow}{CCC}[columns-width=auto]
% C_1 & C_2 & C_3 \\
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9 
% \end{NiceArrayRCwithDelims}$
% \end{BVerbatim}
% $\begin{NiceArrayRCwithDelims}
%    {\downarrow}{\downarrow}{CCC}[columns-width=auto]
% C_1 & C_2 & C_3 \\
% 1 & 2 & 3 \\
% 4 & 5 & 6 \\
% 7 & 8 & 9 
% \end{NiceArrayRCwithDelims}$
%
%
% \bigskip
% If we want to write a linear system, we can use the following code, with a
% preamble \verb+CCC|C+:
%
% \medskip 
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{pNiceArrayRC}{~emphase#CCC|C@}
% C_1 & \Cdots & C_n \\
% a_{11} & \Cdots & a_{1n} & b_1 \\
% \Vdots &      & \Vdots & \Vdots \\
% a_{n1} & \Cdots & a_{nn} & b_n \\
% \end{pNiceArrayRC}$
% \end{BVerbatim}
% $\begin{pNiceArrayRC}{CCC|C}
% C_1 & \Cdots & C_n \\
% a_{11} & \Cdots & a_{1n} & b_1 \\
% \Vdots &      & \Vdots & \Vdots \\
% a_{n1} & \Cdots & a_{nn} & b_n \\
% \end{pNiceArrayRC}$
% 
% \medskip
% The resultat may seem disappointing. It's possible to suppress the vertical
% rule in the first row with the command |\multicolumn| in order to
% ``reconstruct'' the cell.
% 
%
% \bigskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{pNiceArrayRC}{CCC|C}
% C_1 & \Cdots & ~emphase#\multicolumn{1}{C}{C_n}@ \\
% a_{11} & \Cdots & a_{1n} & b_1 \\
% \Vdots &      & \Vdots & \Vdots \\
% a_{n1} & \Cdots & a_{nn} & b_n \\
% \end{pNiceArrayRC}$
% \end{BVerbatim}
% $\begin{pNiceArrayRC}{CCC|C}
% C_1 & \Cdots & \multicolumn{1}{C}{C_n} \\
% a_{11} & \Cdots & a_{1n} & b_1 \\
% \Vdots &      & \Vdots & \Vdots \\
% a_{n1} & \Cdots & a_{nn} & b_n 
% \end{pNiceArrayRC}$
%
% \bigskip
% On the other side, we may remark that an horizontal line (with |\hline| or
% |\hdashline| of \pkg{arydshln}) doesn't extend in the ``exterior column'' of
% an environment like |{pNiceArrayC}| or |{pNiceArrayRC}|.
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=11cm]
% $\begin{pNiceArrayC}{CCC}
% a_{11} & \Cdots & a_{1n} & L_1 \\
% \Vdots &        & \Vdots & \Vdots \\
% a_{n1} & \Cdots & a_{nn} & L_n \\
% ~emphase#\hdashline@
% S_1    & \Cdots  & S_n \\
% \end{pNiceArrayC}$
% \end{BVerbatim}
% $\begin{pNiceArrayC}{CCC}
% a_{11} & \Cdots & a_{1n} & L_1 \\
% \Vdots &        & \Vdots & \Vdots \\
% a_{n1} & \Cdots & a_{nn} & L_n \\
% \hdashline
% S_1    & \Cdots  & S_n \\
% \end{pNiceArrayC}$
% 
%
%
% \section{The dotted lines to separate rows or columns}
%
%
% In the environments of the extension \pkg{nicematrix}, it's possible to use
% the command |\hdottedline| which is a counterpart of the classical commands
% |\hline| and |\hdashline| (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 ``first row'' and the ``last column''
% of the environments with such features.
% 
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=9.5cm]
% $\begin{pNiceArrayRC}{CCC:C}%
%  [ 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{pNiceArrayRC}$
% \end{BVerbatim}
% $\begin{pNiceArrayRC}{CCC:C}[ 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{pNiceArrayRC}$
% 
% \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
% extension \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 = V}
% \left(\begin{NiceArray}{~emphase#C|C:CVC@}
% 1 & 2 & 3 & 4 \\
% 5 & 6 & 7 & 8 \\
% 9 & 10 & 11 & 12
% \end{NiceArray}\right)
% \end{BVerbatim}
% \begin{scope}
% \NiceMatrixOptions{letter-for-dotted-lines = V}
% $\left(\begin{NiceArray}{C|C:CVC}
% 1 & 2 & 3 & 4 \\
% 5 & 6 & 7 & 8 \\
% 9 & 10 & 11 & 12
% \end{NiceArray}\right)$
% \end{scope}
%
% \section{The width of the columns}
% \label{width}
%
% In the environments with an explicit preamble (like |{NiceArray}|, |{pNiceArrayC}|, |{pNiceArrayRC}|, etc.), it's
% possible to fix the  width of a given column with the standard letters |w| and |W| of the package \pkg{array}.
% 
% \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
% It's also possible to fix the width of all the columns of a matrix directly
% with the option |columns-width| (in all the environments of \pkg{nicematrix}).
% 
% \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.
%
% \bigskip
% It's possible to give the 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.
% \textbf{Two or three compilations may be necessary.}\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
% It's possible to fix the 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.}
%
% \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}
%
% 
%
% 
% \section{Technical remarks}
%
% \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, a 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 with contents |\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 less than 0.5~pt is empty.
%
% \medskip
% \item A cell which contains a command |\Ldots|, |\Cdots|, |\Vdots|, |\Ddots|
% or |\Iddots| and their starred versions is empty. We recall that these
% commands should be used alone in a cell.
%
% \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).} It's possible to suppress these spaces for a given environment
% |{array}| with a construction like |\begin{array}{@{}ccccc@{}}|.}
%
% The environment |{matrix}| and its variants (|{pmatrix}|, |{vmatrix}|, etc.)
% of \pkg{amsmath} prefer to delete these spaces with explicit instructions
% |\hskip -\arraycolsep| and |{NiceArray}| does likewise. 
%
% However, the user can change this behaviour with the boolean option
% |exterior-arraycolsep| of the command |\NiceMatrixOptions|. With this option,
% |{NiceArray}| will insert the same horizontal spaces as the environment
% |{array}|.  
%
% This option is only for ``compatibility'' since the package \pkg{nicematrix}
% provides a more precise control with the options |left-margin|,
% |right-margin|, |extra-left-margin| and |extra-right-margin|. 
%
%
% \subsection{The class option draft}
%
% The package \pkg{nicematrix} is rather slow when drawing the dotted lines
% (generated by |\Cdots|, |\Ldots|, |\Ddots|, etc. but also by |\hdottedline| or
% the specifier |:|).\footnote{The main reason is that we want dotted lines with
% round dots (and not square dots) with the same space on both extremities of
% the lines. To achieve this goal, we have to construct our own system of dotted
% lines.} 
%
% That's why, 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{Compatibility with the extension dcolumn}
%
% \label{dcolumn}
% If we want to make \pkg{nicematrix} compatible with \pkg{dcolumn}, it's
% necessary to patch the commands |\DC@endcentre| and |\DC@endright| as follow.
%
% \bigskip
%
% \begin{scope}
% \fvset{commandchars=\~\#\+}
% \begin{Verbatim}
% \def\DC@endcentre{$\egroup
% \ifdim \wd\z@>\wd\tw@
% \setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}%
% \else
% \setbox\z@=\hbox to\wd\tw@{\hfill\unhbox\z@}\fi
% ~emphase#\@@_Cell:+\box\z@\box\tw@ ~emphase#\@@_end_Cell:+}
% \end{Verbatim}
% 
% \begin{Verbatim}
% \def\DC@endright{$\hfil\egroup ~emphase#\@@_Cell:+\box\z@\box\tw@ ~emphase#\@@_end_Cell:+}
% \end{Verbatim}
% \end{scope}
%       
%
%
% \section{Examples}
%
% \subsection{Dotted lines}
%
% \medskip
% A tridiagonal matrix:
% 
% \bigskip
% \begin{BVerbatim}[baseline=c]
% $\begin{pNiceMatrix}[nullify-dots]
% 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}
% \hspace{1.5cm}
% $\begin{pNiceMatrix}[nullify-dots]
% 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}$
%
% \vspace{2cm}
%
% A permutation matrix:
%
% \bigskip
% \begin{BVerbatim}[baseline=c]
% $\begin{pNiceMatrix}
% 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}
% 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|: \par\nobreak
% \bigskip
% \begin{BVerbatim}[baseline=c]
% $\begin{pNiceMatrix}
% 1       & \Cdots  &         & 1      \\
% \Vdots  &         &         & 0      \\
%         & ~emphase#\Iddots@ & ~emphase#\Iddots@ & \Vdots \\
% 1       & 0       & \Cdots  & 0 
% \end{pNiceMatrix}$
% \end{BVerbatim}
% \hspace{4cm}
% $\begin{pNiceMatrix}
% 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{pNiceMatrix}[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{pNiceMatrix}
% \end{BVerbatim}
% 
% \bigskip
% \[\begin{pNiceMatrix}[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{pNiceMatrix}\]
% 
% \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{NiceArray}{|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{NiceArray}\]
% \end{BVerbatim}
% 
% \bigskip
%
% \begin{scope}
% \setlength{\extrarowheight}{1mm}
% \[\begin{NiceArray}{|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{NiceArray}\]
% \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}
% \setlength{\extrarowheight}{1mm}
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 2&4&8&16&9&\\
% 3&9&27&81&36&\\
% 4&16&64&256&100&\\
% \end{pNiceArrayC}$
% ...
% ~emphase#\end{NiceMatrixBlock}@
% \end{BVerbatim}
% 
% \bigskip
% 
% \begin{multicols}{2}
% \begin{NiceMatrixBlock}[auto-columns-width]
% \NiceMatrixOptions{code-for-last-col = \color{blue}\scriptstyle}
% \setlength{\extrarowheight}{1mm}
%
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 2&4&8&16&9&\\
% 3&9&27&81&36&\\
% 4&16&64&256&100&\\
% \end{pNiceArrayC}$
%
% \medskip
%
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 0&2&6&14&7&L_2\gets-2L_1+L_2 \\
% 0&6&24&78&33&L_3\gets-3L_1+L_3 \\
% 0&12&60&252&96&L_4\gets-4L_1+L_4 \\
% \end{pNiceArrayC}$
%
% \medskip
%
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 0&1&3&7&\frac72&L_2\gets\frac12L_2\\
% 0&3&12&39&\frac{33}2&L_3\gets\frac12L_3 \\
% 0&1&5&21&8&L_4\gets\frac1{12}L_4 \\
% \end{pNiceArrayC}$
%
% \medskip
%
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 0&1&3&7&\frac72&\\
% 0&0&3&18&6&L_3 \gets -3L_2+L_3 \\
% 0&0&-2&-14&-\frac92&L_4 \gets L_2-L_4 \\
% \end{pNiceArrayC}$
%
% \medskip
%
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 0&1&3&7&\frac72&\\
% 0&0&1&6&2&L_3 \gets \frac13L_3\\
% 0&0&-2&-14&-\frac92&\\
% \end{pNiceArrayC}$
%
% \medskip
%
% \quad $\begin{pNiceArrayC}{CCCC:C}
% 1&1&1&1&1&\\
% 0&1&3&7&\frac72&\\
% 0&0&1&6&2& \\
% 0&0&0&-2&-\frac12 & L_4 \gets 2L_3+L_4 \\
% \end{pNiceArrayC}$
% \end{NiceMatrixBlock}
% \end{multicols}
% 
% 
% \subsection{How to highlight cells of the matrix}
%
% \medskip
% In order to highlight a cell of a matrix, it's possible to ``draw'' one of the correspond 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''). In order to
% have the continuity of the lines, we have to set |inner sep = -\pgflinewidth/2|.
%
% \begin{Verbatim}
% $\left(\,\begin{NiceArray}{>{\strut}CCCC}%
%    [create-extra-nodes,left-margin,right-margin,
%     code-after = {\begin{tikzpicture}
%                      [~emphase#name suffix = -large@,
%                       every node/.style = {draw,
%                                            ~emphase#inner sep = -\pgflinewidth/2@}]
%                      \node [fit = (1-1)] {} ; 
%                      \node [fit = (2-2)] {} ; 
%                      \node [fit = (3-3)] {} ; 
%                      \node [fit = (4-4)] {} ; 
%                   \end{tikzpicture}}]
% 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} 
% \end{NiceArray}\,\right)$
% \end{Verbatim}
%
%
% \[\left(\,\begin{NiceArray}{>{\strut}CCCC}[
%     create-extra-nodes,left-margin,right-margin,
%     code-after = {\begin{tikzpicture}[name suffix = -large,
%                                       every node/.style = {draw,
%                                                            inner sep = -\pgflinewidth/2}]
%                      \node [fit = (1-1)] {} ; 
%                      \node [fit = (2-2)] {} ; 
%                      \node [fit = (3-3)] {} ; 
%                      \node [fit = (4-4)] {} ; 
%                   \end{tikzpicture}}]
% 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} 
% \end{NiceArray}\,\right)\]
% 
%
% \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}.
%
% \medskip
% \begin{BVerbatim}[baseline=c]
% $\begin{bNiceMatrix}
% 0 & \Cdots & 0 \\
% ~emphase#\rowcolor{red!15}@ 1 & \Cdots & 1 \\
% 0 & \Cdots & 0 \\
% \end{bNiceMatrix}$
% \end{BVerbatim}
% \hspace{2cm}
% $\begin{bNiceMatrix}
% 0 & \Cdots & 0 \\
% \rowcolor{red!15} 1 & \Cdots & 1 \\
% 0 & \Cdots & 0 \\
% \end{bNiceMatrix}$
%
% \medskip
% The result may be disappointing. We therefore 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|. Warning: some \textsc{pdf} readers are not
% able to render transparency correctly.
%
% \tikzset{highlight/.style={rectangle,
%                            fill=red!15,
%                            blend mode = multiply, 
%                            rounded corners = 0.5 mm, 
%                            inner sep=1pt}}
%
% \medskip
% \begin{Verbatim}
% \tikzset{highlight/.style={rectangle,
%                            fill=red!15,
%                            ~emphase#blend mode = multiply@,
%                            rounded corners = 0.5 mm, 
%                            inner sep=1pt}}
%
% $\begin{bNiceMatrix}[~emphase#code-after = {\tikz \node[highlight, fit = (2-1) (2-3)] {} ;}@]
% 0 & \Cdots & 0 \\
% 1 & \Cdots & 1 \\
% 0 & \Cdots & 0 \\
% \end{bNiceMatrix}$
% \end{Verbatim}
% 
% \[\begin{bNiceMatrix}[code-after = {\tikz \node[highlight, fit = (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}
% Considerer now the following matrix which we have named |example|.
%
% \medskip
% \begin{Verbatim}
% $\begin{pNiceArrayC}{CCC}[~emphase#name=example@,create-extra-nodes]
% a & a + b & a + b + c & L_1\\
% a & a     & a + b     & L_2 \\
% a & a     & a         & L_3
% \end{pNiceArrayC}$
% \end{Verbatim}
%                           
% \[\begin{pNiceArrayC}{CCC}
% a & a + b & a + b + c & L_1\\
% a & a     & a + b     & L_2 \\
% a & a     & a         & L_3
% \end{pNiceArrayC}\]
% 
% \bigskip
% If we want to highlight each row of this matrix, we can use the previous technique three times.
%
% \begin{Verbatim}
% \tikzset{myoptions/.style={remember picture, 
%                            overlay,
%                            name prefix = example-,
%                            every node/.style = {fill = red!15,
%                                                 blend mode = multiply,
%                                                 inner sep = 0pt}}}
% \end{Verbatim}
% 
%
% \tikzset{myoptions/.style={remember picture, 
%                            overlay,
%                            name prefix = example-,
%                            every node/.style = {fill = red!15,
%                                                 blend mode = multiply,
%                                                 inner sep = 0pt}}}
%
% \begin{Verbatim}
% \begin{tikzpicture}[myoptions]
% \node [fit = (1-1) (1-3)] {} ;
% \node [fit = (2-1) (2-3)] {} ;
% \node [fit = (3-1) (3-3)] {} ;
% \end{tikzpicture}
% \end{Verbatim}
%
% \medskip
% We obtain the following matrix.
% 
% \[\begin{pNiceArrayC}{CCC}[
%      create-extra-nodes,
%      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{pNiceArrayC}\]
%
% \medskip
% The result may seem disappointing. We can improve it by using the ``medium nodes'' instead of the ``normal nodes''.
%
% \begin{Verbatim}
% \begin{tikzpicture}[myoptions, ~emphase#name suffix = -medium@]
% \node [fit = (1-1) (1-3)] {} ;
% \node [fit = (2-1) (2-3)] {} ;
% \node [fit = (3-1) (3-3)] {} ;
% \end{tikzpicture}
% \end{Verbatim}
%
% \medskip
% We obtain the following matrix.
% 
% \[\begin{pNiceArrayC}{CCC}[
%      create-extra-nodes,
%      code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15,
%                                                             blend mode = multiply,
%                                                             inner sep = 0pt},
%                                        name suffix = -medium]
%                    \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{pNiceArrayC}\]
%
%                           
% \vspace{1cm}
% 
% In the following example, we use the ``large nodes'' to highlight a zone of the matrix.\par\nobreak
% \begin{Verbatim}
% \left(\,\begin{NiceArray}{>{\strut}CCCC}%
%    [create-extra-nodes,left-margin,right-margin,
%     code-after = {\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) ; } ]
% 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}  
% \end{NiceArray}\,\right)
% \end{Verbatim}
%                              
% \[\left(\,\begin{NiceArray}{>{\strut}CCCC}[
%     create-extra-nodes,left-margin,right-margin,
%     code-after = {\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) ; } ]
% 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}  
% \end{NiceArray}\,\right)\]
%
% 
% \subsection{Block matrices}
%
% \medskip
% In the following example, we use the ``large nodes'' to construct a block matrix (the dashed lines have been
% drawn with \pkg{arydshln}).
% \begin{Verbatim}
% \NiceMatrixOptions{letter-for-dotted-lines = V}
% \left(\begin{NiceArray}{CC:CC}%
%    [create-extra-nodes,
%     ~emphase#code-after = { \tikz \node [fit = (1-1-large) (2-2-large), inner sep = 0 pt]@
%     ~emphase#                           {$0_{22}$} ; }@ ]
%        &        & a_{13} & a_{14} \\
%        &        & a_{23} & a_{24} \\
% \hdashline
% a_{31} & a_{32} & a_{33} & a_{34} \\
% a_{41} & a_{42} & a_{34} & a_{44} 
% \end{NiceArray}\right)
% \end{Verbatim}
% 
%                          
% \begin{scope}    
% \NiceMatrixOptions{letter-for-dotted-lines = V}
% \[D = \left(\begin{NiceArray}{CC:CC}[
%     create-extra-nodes,
%     code-after = { \tikz \node [fit = (1-1-large) (2-2-large), inner sep = 0 pt] 
%                                {$0_{22}$} ; } ]
%        &        & a_{13} & a_{14} \\
%        &        & a_{23} & a_{24} \\
% \hdashline
% a_{31} & a_{32} & a_{33} & a_{34} \\
% a_{41} & a_{42} & a_{34} & a_{44} 
% \end{NiceArray}\right)\]
% \end{scope}
% 
% 
% 
% \section{Implementation}
%
% By default, the package \pkg{nicematrix} doesn't patch any existing code.\footnote{If we want \pkg{nicematrix}
% compatible with \pkg{dcolumn}, we have to patch \pkg{dcolumn}: cf. p.~\pageref{dcolumn}.}
%
% \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 independant of its
% implementation. Unfortunately, it was not possible to be strictly independant: the package \pkg{nicematrix} relies upon the
% fact that the package |{array}| uses |\ialign| to begin the |\halign|.
% 
% \smallskip
% The desire to do no modification to existing code leads to complications in the code of this extension. 
%
% \subsection{Declaration of the package and extensions loaded}
%
% First, \pkg{tikz} and the Tikz library |fit| are loaded before the |\ProvidesExplPackage|.
% They are loaded this way because |\usetikzlibrary| in |expl3| code fails.\footnote{cf.
% |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|} 
% 
%
%    \begin{macrocode}
\RequirePackage{tikz}
\usetikzlibrary{fit}
\RequirePackage{expl3}[2019/02/15]
%    \end{macrocode}
% 
% We give the traditionnal declaration of a package written with |expl3|:
%    \begin{macrocode}
\RequirePackage{l3keys2e}
\ProvidesExplPackage
  {nicematrix}
  {\myfiledate}
  {\myfileversion}
  {Several features to improve the typesetting of mathematical matrices with TikZ}
%    \end{macrocode}
% 
% \bigskip
% We test if the class option |draft| has been used. 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 \pkg{array} and \pkg{amsmath}.
%    \begin{macrocode}
\RequirePackage { array }
\RequirePackage { amsmath }
\RequirePackage { xparse } [ 2018-10-17 ]
%    \end{macrocode}
%
% \subsection{Technical  definitions}
%
% We test wether the current class is \cls{revtex4-1} or \cls{revtex4-2}.
%    \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}
% 
%                                       
%    \begin{macrocode}
\cs_new_protected:Nn \@@_error:n { \msg_error:nn { nicematrix } { #1 } }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Nn \@@_error:nn { \msg_error:nn { nicematrix } { #1 } { #2 } }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { nicematrix } }
%    \end{macrocode}
%
%    \begin{macrocode}
\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
% First, 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
      { \mkern 1 mu 
        \raise \p@ \hbox { . }
        \mkern 2 mu
        \raise 4 \p@ \hbox { . }
        \mkern 2 mu
        \raise 7 \p@ \vbox { \kern 7 pt \hbox { . } } \mkern 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}
% 
% \bigskip
% The dimension |\l_@@_columns_width_dim| will be used when the options specify that all the columns must have the
% same width.
%    \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
% The integer |\l_@@_nb_first_row_int| is the number of the first row of the
% array. The default value is $1$, but, in the environments like
% |{pNiceArrayRC}|, the value will be~$0$. 
%    \begin{macrocode}
\int_new:N \l_@@_nb_first_row_int
\int_set:Nn \l_@@_nb_first_row_int 1
%    \end{macrocode}
% 
% \bigskip
% The flag |\l_@@_exterior_column_bool| will indicate if we are in an
% environment of the type of |{pNiceArrayC}| or |{pNiceArrayRC}|. It will be
% used for the creation of the ``large nodes''. 
%    \begin{macrocode}
\bool_new:N \l_@@_exterior_column_bool
%    \end{macrocode}
% 
%
% \bigskip
% We want to known if we are in a environment |{NiceArray}| because we want to
% raise an error if the user tries to use nested environments |{NiceArray}|.
%    \begin{macrocode}
\bool_new:N \l_@@_in_NiceArray_bool
%    \end{macrocode}
% 
% \bigskip 
% \subsection{The options}
%
% The token list |\l_@@_pos_env_str| will contain one of the three values |t|,
% |c| or |b| and will indicate the position of the environment as in the option
% of the environment |{array}|. For the environment |{pNiceMatrix}|,
% |{pNiceArrayC}|, |{pNiceArrayRC}| and their variants, the value will
% programmatically be fixed to |c|. For the environment |{NiceArray}|, however,
% the three values |t|, |c| and |b| are possible. 
%    \begin{macrocode}
\str_new:N \l_@@_pos_env_str 
\str_set:Nn \l_@@_pos_env_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}| (but neither for
% |{NiceMatrix}|, |{pNiceArrayC}|, |{pNiceArrayRC}| and their variants even if
% these environments rely upon |{NiceArray}|). 
%    \begin{macrocode}
\bool_new:N \l_@@_exterior_arraycolsep_bool
%    \end{macrocode}
%
% \bigskip
% The flag |\l_@@_parallelize_diags_bool| controls wether 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_@@_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 cell of the ``exterior column'' of an
% environment of the kind of |{pNiceArrayC}|).  
%    \begin{macrocode}
\bool_new:N \l_@@_auto_columns_width_bool
%    \end{macrocode}
% 
% \bigskip
% The token list |\l_@@_code_for_last_col_tl| will contain code inserted at the
% beginning of each cell of the last column in the environment |{pNiceArrayC}|
% (and its variants). It corresponds to the option |code-for-last-col|. 
%    \begin{macrocode}
\tl_new:N \l_@@_code_for_last_col_tl
%    \end{macrocode}
% 
% \bigskip
% We don't want to patch any existing code. That's why some code must be
% executed in a |\group_insert_after:N|. That's why the parameters used in that
% code must be transfered outside the current group. To do this, we copy those
% quantities in global variables just before the |\group_insert_after:N|.
% Therefore, for those quantities, we have two parameters, one local and one
% global. For example, we have |\l_@@_name_str| and |\g_@@_name_str|. 
%
% \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 \g_@@_name_str
\str_new:N \l_@@_name_str
%    \end{macrocode}
%
% \bigskip
% The boolean |\l_@@_extra_nodes_bool| will be used to indicate wether the
% ``medium nodes'' and ``large nodes'' are created in the array. 
%    \begin{macrocode}
\bool_new:N \l_@@_extra_nodes_bool
\bool_new:N \g_@@_extra_nodes_bool
%    \end{macrocode}
%
% \bigskip
% The dimensions |\l_@@_left_margin_dim| and |\l_@@_right_margin_dim| correspond
% to the options |left-margin| and |right-margin|. 
%    \begin{macrocode}
\dim_new:N \l_@@_left_margin_dim
\dim_new:N \l_@@_right_margin_dim
\dim_new:N \g_@@_left_margin_dim
\dim_new:N \g_@@_right_margin_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
\dim_new:N \g_@@_extra_right_margin_dim
%    \end{macrocode}
% 
% 
% \bigskip
% First, we define a set of keys ``|NiceMatrix / Global|'' which will be used
% (with the mechanism of |.inherit:n| by other keys of set).
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / Global }
  {
    parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
    parallelize-diags .default:n = true ,
%    \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 .default:n = true ,
    nullify-dots .bool_set:N = \l_@@_nullify_dots_bool ,
    nullify-dots .default:n = true ,
%    \end{macrocode}
%
% \bigskip
% An option to test wether the extra nodes will be created (these nodes are the
% ``medium nodes'' and ``large nodes''). In some circonstancies, the extra nodes
% are created automatically, for example when a dotted line has an ``open''
% extremity. 
%    \begin{macrocode}
    create-extra-nodes .bool_set:N = \l_@@_extra_nodes_bool ,
    create-extra-nodes .default:n = true,
    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 ,
    extra-left-margin .dim_set:N = \l_@@_extra_left_margin_dim ,
    extra-right-margin .dim_set:N = \l_@@_extra_right_margin_dim 
  }
%    \end{macrocode}
%
% \bigskip
% We define a set of keys used by the environments (and not by the command
% |\NiceMatrixOptions|). 
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / Env }
  {
    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 = 
      \seq_if_in:NnTF \g_@@_names_seq { #1 }
         { \@@_error:nn { Duplicate~name } { #1 } }
         { \seq_gput_left:Nn \g_@@_names_seq { #1 } }
      \str_set:Nn \l_@@_name_str { #1 } ,
    name .value_required:n = true ,
    code-after .tl_gset:N = \g_@@_code_after_tl ,
    code-after .initial:n = \c_empty_tl ,
    code-after .value_required:n = true ,
  }
%    \end{macrocode}
% 
% \bigskip
% We begin the construction of the major sets of keys (used by the differents
% user commands and environments). 
%    \begin{macrocode}
\keys_define:nn { NiceMatrix }
  { 
    NiceMatrixOptions .inherit:n = NiceMatrix / Global ,
    NiceMatrix .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env 
      } ,
    NiceArray .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env 
      } ,
    NiceArrayC .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env 
       } ,
    NiceArrayRC .inherit:n = 
      { 
        NiceMatrix / Global ,
        NiceMatrix / Env 
      } 
  }
%    \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 ,
    RenewMatrix .meta:n = renew-matrix ,
    transparent .meta:n = { renew-dots , renew-matrix } ,
    transparent .value_forbidden:n = true,
    Transparent .meta:n = transparent,
%    \end{macrocode}
%                              
% \bigskip
% The following option is only for the environment |{pNiceArrayC}| and its
% variants. It will contain code inserted at the beginning of each cell of the
% last column.\footnote{In an environment |{pNiceArrayC}|, the last column is 
% composed outside the parentheses of the array.}
%    \begin{macrocode}
    code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl ,
    code-for-last-col .value_required:n = true ,
%    \end{macrocode}   
%
% \bigskip
% Idem for the first row in environments like |{pNiceArrayRC}|.
%    \begin{macrocode}
    code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl ,
    code-for-first-row .value_required: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 ,
    exterior-arraycolsep .default:n  = true ,
%    \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
%    \begin{macrocode}
    allow-duplicate-names .code:n = 
      \@@_msg_redirect_name:nn { Duplicate~name } {none} ,
    allow-duplicate-names .value_forbidden:n = true ,
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
    letter-for-dotted-lines .tl_set:N = \l_@@_letter_for_dotted_lines_str ,
    letter-for-dotted-lines .value_required:n = true ,
    letter-for-dotted-lines .initial:n = \c_colon_str ,
%    \end{macrocode}
% \bigskip
%    \begin{macrocode}
    unknown .code:n  = \@@_error:n { Unknown~key~for~NiceMatrixOptions } }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~key~for~NiceMatrixOptions }
  {
    The~key~'\tl_use:N\l_keys_key_tl'~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~keys~are~(in~alphabetic~order):~
    allow-duplicate-names,~
    code-for-last-col,~
    exterior-arraycolsep,~
    left-margin,~
    letter-for-dotted-lines,~
    nullify-dots,~
    parallelize-diags,~
    renew-dots,~
    renew-matrix,~
    right-margin,~
    and~transparent
  }
%    \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}
% 
% \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 }
  { unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceMatrix }
  { 
    The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
    \{NiceMatrix\}~and~its~variants. \\
    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):~
    code-after,~
    columns-width,~
    create-extra-nodes,~
    extra-left-margin,~
    extra-right-margin,~
    left-margin,~
    name,~
    nullify-dots,~
    parallelize-diags,~
    renew-dots~
    and~right-margin.
  }
%    \end{macrocode}
% 
% \bigskip
%    \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'. \\
    For~a~list~of~the~names~already~used,~type~H~<return>. \\ 
    If~you~don't~want~to~see~this~message~again,~use~the~option~
    'allow-duplicate-names'. 
  }
  {
    The~names~already~defined~in~this~document~are:~
    \seq_use:Nnnn \g_@@_names_seq { ,~ } { ,~ } { ~and~ }.
  }
%    \end{macrocode}
%
% \bigskip
% 
% \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}
% 
% \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_@@_pos_env_str c ,
    t .code:n = \str_set:Nn \l_@@_pos_env_str t ,
    b .code:n = \str_set:Nn \l_@@_pos_env_str b ,
    unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray } 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceArray }
  { 
    The~option~'\tl_use:N\l_keys_key_tl'~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,~
    c,~
    code-after,~
    create-extra-nodes,~
    columns-width,~
    extra-left-margin,~
    extra-right-margin,~
    left-margin,~
    name,~
    nullify-dots,~
    parallelize-diags,~
    renew-dots,~
    right-margin,~
    and~t.
  }
%    \end{macrocode}
% 
% \subsection{The environments \{NiceArray\} and \{NiceMatrix\}}
%
% 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:Nn \@@_Cell:
  { 
%    \end{macrocode}
% We increment |\g_@@_column_int|, which is the counter of the columns. 
%    \begin{macrocode}
    \int_gincr:N \g_@@_column_int
%    \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 \g_@@_column_int = \c_one_int
       { \int_gincr:N \g_@@_row_int }                
    \int_gset:Nn \g_@@_column_total_int 
       { \int_max:nn \g_@@_column_total_int \g_@@_column_int }
    \hbox_set:Nw \l_tmpa_box $ % $ 
    \int_compare:nNnT \g_@@_row_int = \c_zero_int
      \l_@@_code_for_first_row_tl
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_end_Cell:
  { $ % $ 
    \hbox_set_end:
%    \end{macrocode}
%
% We want to compute in |\l_@@_max_cell_width_dim| the width of the widest cell
% of the array (except the cells of the last column of an environment of the
% kind of |{pNiceArrayC}|). 
%    \begin{macrocode}
    \dim_gset:Nn \g_@@_max_cell_width_dim
      { \dim_max:nn \g_@@_max_cell_width_dim { \box_wd:N \l_tmpa_box } }
%    \end{macrocode}
%
%
%    \begin{macrocode}
    \int_compare:nNnT \g_@@_row_int = \c_zero_int
      { 
        \dim_gset:Nn \g_@@_max_dp_row_zero_dim
          { \dim_max:nn \g_@@_max_dp_row_zero_dim { \box_dp:N \l_tmpa_box } }
        \dim_gset:Nn \g_@@_max_ht_row_zero_dim
          { \dim_max:nn \g_@@_max_ht_row_zero_dim { \box_ht:N \l_tmpa_box } } 
      }
    \int_compare:nNnT \g_@@_row_int = \c_one_int
      { 
        \dim_gset:Nn \g_@@_max_ht_row_one_dim
          { \dim_max:nn \g_@@_max_ht_row_one_dim { \box_ht:N \l_tmpa_box } } 
      }
%    \end{macrocode}
% 
% Now, we can create the Tikz node of the cell.
%    \begin{macrocode}
    \tikz 
      [ 
        remember~picture , 
        inner~sep = \c_zero_dim , 
        minimum~width = \c_zero_dim , 
        baseline 
      ]
    \node 
      [
        anchor = base ,
        name = nm - \int_use:N \g_@@_env_int -
                    \int_use:N \g_@@_row_int -
                    \int_use:N \g_@@_column_int ,
        alias = 
          \str_if_empty:NF \l_@@_name_str
            { 
              \l_@@_name_str -
              \int_use:N \g_@@_row_int -
              \int_use:N \g_@@_column_int
            } 
      ] 
    \bgroup 
    \box_use:N \l_tmpa_box
    \egroup ;
  } 
%    \end{macrocode}
%
% 
% \interitem
% The environment |{NiceArray}| is the main environment of the extension
% \pkg{nicematrix}. In order to clarify the explanations, we will first give the
% definition of the environment |{NiceMatrix}|.  
%
% Our environment |{NiceMatrix}| must have the same second part as the
% environment |{matrix}| of \pkg{amsmath} (because of the programmation of the
% option |renew-matrix|). Hence, this second part is the following: 
% 
% \begin{Verbatim}
%          \endarray
%          \skip_horizontal:n {-\arraycolsep}
% \end{Verbatim}
% 
% That's why, in the definition of |{NiceMatrix}|, we must use |\NiceArray| and
% not |\begin{NiceArray}| (and, in the definition of |{NiceArray}|, we will have
% to use |\array|, and not |\begin{array}|: see below). 
% 
% \medskip
% Here's the definition of |{NiceMatrix}|:
%    \begin{macrocode}
\NewDocumentEnvironment { NiceMatrix } { ! O { } }
  { 
    \keys_set:nn { NiceMatrix / NiceMatrix } { #1 }
    \str_set:Nn \l_@@_pos_env_str c
    \bool_set_false:N \l_@@_exterior_arraycolsep_bool
    \NiceArray { * \c@MaxMatrixCols C }
  }
  { 
    \endarray
    \skip_horizontal:n 
      { \g_@@_right_margin_dim + \g_@@_extra_right_margin_dim - \arraycolsep }  
  }
%    \end{macrocode}
%
% \interitem
% For the definition of |{NiceArray}| (just below), we have the following
% constraints: 
% \begin{itemize}
% \item we must use |\array| in the first part of |{NiceArray}| and, therefore,
% |\endarray| in the second part; 
% \item we have to put a |\group_insert_after:N \@@_after_array:| in the first
% part of |{NiceArray}| so that |\@@_draw_lines| will be executed at the end of
% the current environment (either |{NiceArray}| or |{NiceMatrix}|). 
% \end{itemize}
%               
%    \begin{macrocode}
\cs_generate_variant:Nn \dim_set:Nn { N x }
%    \end{macrocode}
% 
%
% \bigskip
%    \begin{macrocode}
\@@_msg_new:nn { Yet~in~NiceArray }
  { 
    Environments~\{NiceArray\}~(or~\{NiceMatrix\},~etc.)~can't~be~
    nested.~You~can~go~on,~but,~maybe,~you~will~have~errors~or~an~incorrect~
    result.
  }
%    \end{macrocode}
%
%
% \bigskip
% The command |\@@_define_dots:| will be used in the environment |{NiceArray}|
% to define the commands |\Ldots|, |\Cdots|, etc.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_define_dots:
  { 
    \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
    \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}
%
% \bigskip
% With |\@@_define_dots_to_nil:|, the commands like |\Ldots|, |\Cdots|, are
% defined, but with no effect. This command will be used if the class option
% |draft| is used. 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_define_dots_to_nil:
  { 
    \cs_set_eq:NN \Ldots \prg_do_nothing:
    \cs_set_eq:NN \Cdots \prg_do_nothing:
    \cs_set_eq:NN \Vdots \prg_do_nothing:
    \cs_set_eq:NN \Ddots \prg_do_nothing:
    \cs_set_eq:NN \Iddots \prg_do_nothing:
    \bool_if:NT \l_@@_renew_dots_bool
      { 
        \cs_set_eq:NN \ldots \prg_do_nothing:
        \cs_set_eq:NN \cdots \prg_do_nothing:
        \cs_set_eq:NN \vdots \prg_do_nothing:
        \cs_set_eq:NN \ddots \prg_do_nothing:
        \cs_set_eq:NN \iddots \prg_do_nothing:
        \cs_set_eq:NN \dots \prg_do_nothing:
        \cs_set_eq:NN \hdotsfor \@@_Hdotsfor
      }
  }
%    \end{macrocode}
%                     
% \bigskip
% In the environment |{NiceArray}|, we will have to redefine the column types
% |w| and |W|. These definitions are rather long because we have to construct
% the |w|-nodes in these columns. The redefinition of these two column types are
% very close and that's why we use a macro |\@@_renewcolumntype:nn|. The first
% argument is the type of the column (|w| or |W|) and the second argument is a
% code inserted at a special place and which is the only difference between the
% two definitions.
%    \begin{macrocode}
\cs_new_protected:Nn \@@_renewcolumntype:nn
  {
    \newcolumntype #1 [ 2 ]
      { 
        > { 
            \hbox_set:Nw \l_tmpa_box
            \@@_Cell:
          }
        c
        < { 
            \@@_end_Cell:
            \hbox_set_end:
            #2 
            \hbox_set:Nn \l_tmpb_box 
              { \makebox [ ##2 ] [ ##1 ] { \box_use:N \l_tmpa_box } }
            \dim_set:Nn \l_tmpa_dim { \box_dp:N \l_tmpb_box }
            \box_move_down:nn \l_tmpa_dim 
              { 
                \vbox:n
                  { \hbox_to_wd:nn { \box_wd:N \l_tmpb_box }
                      { 
                        \hfil 
                        \tikz [ remember~picture , overlay ]
                        \coordinate (@@~north~east) ; 
                      }
                    \hbox:n
                      {
                        \tikz [ remember~picture , overlay ]
                        \coordinate (@@~south~west) ;
                        \box_move_up:nn \l_tmpa_dim { \box_use:N \l_tmpb_box }
                      }         
                  }
              }
%    \end{macrocode}
% The |w|-node is created using the Tikz library |fit| after construction of the
% nodes |(@@~south~west)| and |(@@~north~east)|. It's not possible to contruct
% by a standard |node| instruction because such a construction give a erroneous
% result with some engines (|XeTeX|, |LuaTeX|) although the result is good with
% |pdflatex| (why?). 
%    \begin{macrocode}
            \tikz [ remember~picture , overlay ]
            \node 
              [
                node~contents = { } ,
                name = nm - \int_use:N \g_@@_env_int -
                            \int_use:N \g_@@_row_int -
                            \int_use:N \g_@@_column_int - w,
                alias = 
                  \str_if_empty:NF \l_@@_name_str
                    { 
                      \l_@@_name_str -
                      \int_use:N \g_@@_row_int -
                      \int_use:N \g_@@_column_int - w 
                    } ,
                inner~sep = \c_zero_dim ,
                fit = (@@~south~west) (@@~north~east)
              ] 
            ;
          }  
      }
  }
%    \end{macrocode}
% 
% \bigskip
% First, we test if we are yet in an environment |{NiceArray}| (nested
% environments are forbidden). 
%    \begin{macrocode}
\NewDocumentEnvironment { NiceArray } { O { } m ! O { } }
  { 
    \bool_if:NT \l_@@_in_NiceArray_bool
      { \@@_error:n { Yet~in~NiceArray } }
%    \end{macrocode}
%
% We deactivate Tikz externalization (since we use Tikz pictures with the
% options |overlay| and |remember picture|, there would be errors).
%    \begin{macrocode}
    \cs_if_exist:NT \tikz@library@external@loaded
      { \tikzset { external / export = false } }
    \bool_set_true:N \l_@@_in_NiceArray_bool
    \group_insert_after:N \@@_after_array:
    \tl_gclear_new:N \g_@@_lines_to_draw_tl 
%    \end{macrocode}
%
% We increment the counter |\g_@@_env_int| which counts the environments
% |{NiceArray}|. 
%    \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}
%
% For the following variables, maybe we should create it only if we use the
% environment |{pNiceArrayRC}| or its variants. 
%    \begin{macrocode}
    \dim_gzero_new:N \g_@@_max_dp_row_zero_dim
    \dim_gzero_new:N \g_@@_max_ht_row_zero_dim
    \dim_gzero_new:N \g_@@_max_ht_row_one_dim
%    \end{macrocode}
% 
%    \begin{macrocode}
    \keys_set:nn { NiceMatrix / NiceArray } { #1 , #3 } 
%    \end{macrocode}
% 
% If the user requires all the columns to have a width equal to the widest cell
% of the array, we read this length in the file |.aux| (of, course, this is
% possible only on the second run of LaTeX : on the first run, the dimension
% |\l_@@_columns_width_dim| will be set to zero --- and the columns will have
% their natural width). 
%    \begin{macrocode}
    \bool_if:NT \l_@@_auto_columns_width_bool
      { 
        \group_insert_after:N \@@_write_max_cell_width:
         \cs_if_free:cTF { _@@_max_cell_width_ \int_use:N \g_@@_env_int }
           { \dim_set:Nn \l_@@_columns_width_dim \c_zero_dim }
           { 
             \dim_set:Nx \l_@@_columns_width_dim 
               { \use:c { _@@_max_cell_width _ \int_use:N \g_@@_env_int } } 
           }
%    \end{macrocode}
% If the environment has a name, we read the value of the maximal value of the
% columns from |_@@_name_cell_width|{\ttfamily\slshape name} (the value will be
% the correct value even if the number of the environment has changed (for
% example because the user has created or deleted an environment before the
% current one). 
%    \begin{macrocode}
         \str_if_empty:NF \l_@@_name_str
           { 
             \cs_if_free:cF { _@@_max_cell_width_ \l_@@_name_str }
               { 
                 \dim_set:Nx \l_@@_columns_width_dim 
                   { \use:c { _@@_max_cell_width_ \l_@@_name_str } }
               }
           }
      }
%    \end{macrocode}
% We don't want to patch any code and that's why some code is executed in a
% |\group_insert_after:N|. In particular, in this |\group_insert_after:N|, we
% will have to know the value of some parameters like |\l_@@_extra_nodes_bool|.
% That's why we transit via a global version for some variables.
%    \begin{macrocode}
    \bool_gset_eq:NN \g_@@_extra_nodes_bool \l_@@_extra_nodes_bool
    \dim_gset_eq:NN \g_@@_left_margin_dim \l_@@_left_margin_dim
    \dim_gset_eq:NN \g_@@_right_margin_dim \l_@@_right_margin_dim
    \dim_gset_eq:NN \g_@@_extra_right_margin_dim \l_@@_extra_right_margin_dim
    \tl_gset_eq:NN \g_@@_name_str \l_@@_name_str
%    \end{macrocode}
% The environment |{array}| uses internally the command |\ialign| and, in
% particular, this command |\ialign| sets |\everycr| to |{}|. However, we want
% to use |\everycr| in our array. The solution is to give to |\ialign| a new
% definition (giving to |\everycr| the value we want) that will revert
% automatically to its default definition after the first
% utilisation.\footnote{With this programmation, we will have, in the cells of
% the array, a clean version of |\ialign|. That's necessary: 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:Npn \ialign 
       { 
         \everycr { \noalign { \int_gzero:N \g_@@_column_int } }
         \tabskip = \c_zero_skip
         \cs_set:Npn \ialign 
            { 
              \everycr { } 
              \tabskip = \c_zero_skip
              \halign
            }
         \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}
    \dim_compare:nNnTF \l_@@_columns_width_dim = \c_zero_dim
       {
        \newcolumntype L { > \@@_Cell: l < \@@_end_Cell: }
        \newcolumntype C { > \@@_Cell: c < \@@_end_Cell: }
        \newcolumntype R { > \@@_Cell: r < \@@_end_Cell: }
       }
%    \end{macrocode}
% If there is an option that specify that all the columns must have the same
% width, the column types~|L|, |C| and~|R| are in fact defined upon the column
% type~|w| of \pkg{array} which is, in fact, redefined below. 
%    \begin{macrocode}
       {
        \newcolumntype L { w l { \dim_use:N \l_@@_columns_width_dim } }
        \newcolumntype C { w c { \dim_use:N \l_@@_columns_width_dim } }
        \newcolumntype R { w r { \dim_use:N \l_@@_columns_width_dim } } 
       }
%    \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
%    \end{macrocode}
% 
% We redefine the column types |w| and |W| of the package \pkg{array}.
%    \begin{macrocode}
    \@@_renewcolumntype:nn w { }
    \@@_renewcolumntype:nn W { \cs_set_eq:NN \hss \hfil }
%    \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 extensions, 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|.
%    \begin{macrocode}
    \exp_args:Nx \newcolumntype \l_@@_letter_for_dotted_lines_str
      {
        ! 
          { 
            \skip_horizontal:n { 0.53 pt }
            \bool_gset_true:N \g_@@_extra_nodes_bool
            \int_compare:nNnT \g_@@_row_int = 1
              {
                \int_compare:nNnTF \g_@@_column_int = \c_zero_dim
                  { \@@_error:n { Use~of~:~in~first~position } }
                  {
                    \tl_gput_right:Nx \g_@@_code_after_tl
                      {
                        \exp_not:N \@@_vdottedline:n
                        \exp_not:N {
                        \int_use:N \g_@@_column_int 
                        \exp_not:N }
                      } 
                  }
              }
          }
      } 
%    \end{macrocode}
%
%
% 
% The commands |\Ldots|, |\Cdots|, etc. will be defined only in the environment
% |{NiceArray}|. If the class option |draft| is used, these commands will be
% defined to be no-op (the dotted lines are not drawn). 
%    \begin{macrocode}
    \bool_if:NTF \c_@@_draft_bool
      \@@_define_dots_to_nil:
      \@@_define_dots:
    \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
%    \end{macrocode}
% 
%
% The sequence |\g_@@_empty_cells_seq| will contain a list of ``empty'' cells
% (not all the empty cells of the matrix). If we want to indicate that the cell
% in row~$i$ and column~$j$ must be considered as empty, the token list
% ``|i-j|'' will be put in this sequence. 
%    \begin{macrocode}
    \seq_gclear_new:N  \g_@@_empty_cells_seq
%    \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 |\g_@@_row_int| will be used to count the rows of the array (its
% incrementation will be in the first cell of the row). At the end of the
% environment |{array}|, this counter will give the total number of rows of the
% matrix.  
%    \begin{macrocode}
    \int_gzero_new:N \g_@@_row_int 
    \int_gset:Nn \g_@@_row_int { \l_@@_nb_first_row_int - 1 }
%    \end{macrocode}
%
% The counter |\g_@@_column_int| 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_@@_column_total_int|. These counters are updated in the
% command |\@@_Cell:| executed at the beginning of each cell.  
%    \begin{macrocode}
    \int_gzero_new:N \g_@@_column_int 
    \int_gzero_new:N \g_@@_column_total_int
    \cs_set_eq:NN \@ifnextchar \new@ifnextchar
%    \end{macrocode}
%
% The extra horizontal spaces on both sides of an environment |{array}| should
% be considered as a bad idea of standard LaTeX. In the environment |{matrix}|
% the package  \pkg{amsmath} prefers to suppress these spaces with instructions
% ``|\hskip -\arraycolsep|''. In the same way, we decide to suppress them in
% |{NiceArray}|. However, for better compatibility, we give an option
% |exterior-arraycolsep| to control this feature. 
%    \begin{macrocode}
    \bool_if:NF \l_@@_exterior_arraycolsep_bool
      { \skip_horizontal:n { - \arraycolsep } }
%    \end{macrocode}
% 
%    \begin{macrocode}
    \skip_horizontal:n { \l_@@_left_margin_dim + \l_@@_extra_left_margin_dim }
%    \end{macrocode}
% 
% 
% Eventually, the environment |{NiceArray}| is defined upon the environment
% |{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}
    \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}
% The token list |\l_@@_pos_env_str|, which is the argument of |\array| (or
% |\@array@array|) will contain one of the values |t|, |c| or |b|. 
%    \begin{macrocode}
    [ \l_@@_pos_env_str ] { #2 } 
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
  { \endarray
     \bool_if:NF \l_@@_exterior_arraycolsep_bool
       { \skip_horizontal:n { - \arraycolsep } }
     \skip_horizontal:n 
       { \g_@@_right_margin_dim + \g_@@_extra_right_margin_dim }
  }
%    \end{macrocode}
%
%
% \interitem
% We create the variants of the environment |{NiceMatrix}|.
%    \begin{macrocode}
\NewDocumentEnvironment { pNiceMatrix } { }
   { \left( \begin{NiceMatrix} }
   { \end{NiceMatrix} \right) }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { bNiceMatrix } { }
   { \left[ \begin{NiceMatrix} }
   { \end{NiceMatrix} \right] }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { BNiceMatrix } { }
   { \left\{ \begin{NiceMatrix} }
   { \end{NiceMatrix} \right\} }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { vNiceMatrix } { }
   { \left\lvert \begin{NiceMatrix} }
   { \end{NiceMatrix} \right\rvert }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { VNiceMatrix } {}
   { \left\lVert \begin{NiceMatrix} }
   { \end{NiceMatrix} \right\rVert }
%    \end{macrocode}
%
% \interitem
% For the option \verb|columns-width=auto| (or the option |auto-columns-width|
% of the environment |{NiceMatrixBlock}|), we want to know the maximal width of
% the cells of the array (except the cells of the ``exterior'' column of an
% environment of the kind of |{pNiceAccayC}|). This length can be known only
% after the end of the construction of the array (or at the end of the
% environment |{NiceMatrixBlock}|). That's why we store this value in the main
% |.aux| file and it will be available in the next run. We write a dedicated
% command for this because it will be called in a~|\group_insert_after:N|. 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_write_max_cell_width:
  { 
    \bool_if:NF \l_@@_block_auto_columns_width_bool
      { 
        \iow_now:Nn \@mainaux \ExplSyntaxOn 
        \iow_now:Nx \@mainaux 
          { 
            \cs_gset:cpn { @@_max_cell_width_ \int_use:N \g_@@_env_int }
              { \dim_use:N \g_@@_max_cell_width_dim } 
          }
%    \end{macrocode}
% If the environment has a name, we also create an alias named
% |\@@_max_cell_width_|{\ttfamily\slshape name}.
%    \begin{macrocode}
        \iow_now:Nx \@mainaux 
          {
            \cs_gset:cpn { @@_max_cell_width_ \g_@@_name_str } 
              { \dim_use:N \g_@@_max_cell_width_dim } 
          }
        \iow_now:Nn \@mainaux \ExplSyntaxOff  
      } 
  }
%    \end{macrocode}
% 
% \interitem
% The conditionnal |\@@_if_not_empty_cell:nnT| tests wether a cell is empty. The
% first two arguments must be LaTeX3 counters for the row and the column of the
% considered cell. 
%    \begin{macrocode}
\prg_set_conditional:Npnn \@@_if_not_empty_cell:nn #1 #2 { T , TF }
%    \end{macrocode}
% If the cell is an implicit cell (that is after the symbol |\\| of end of row),
% the cell must, of course, be considered as empty. It's easy to check wether we
% are in this situation considering the correspondant Tikz node. 
%    \begin{macrocode}
  { 
    \cs_if_free:cTF 
      { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - \int_use:N #1 - \int_use:N #2 }
      \prg_return_false:
%    \end{macrocode}
% We manage a list of ``empty cells'' called |\g_@@_empty_cells_seq|. In fact,
% this list is not a list of all the empty cells of the array but only those
% explicitely declared empty for some reason. It's easy to check if the current
% cell is in this list. 
%    \begin{macrocode}
      { 
        \seq_if_in:NxTF \g_@@_empty_cells_seq { \int_use:N #1 - \int_use:N #2 }
          \prg_return_false:
%    \end{macrocode}
% In the general case, we consider the width of the Tikz node corresponding to
% the cell. In order to compute this width, we have to extract the coordinate of
% the west and east anchors of the node. This extraction needs a command
% environment |{pgfpicture}| but, in fact, nothing is drawn.  
%    \begin{macrocode}
          { 
            \begin { pgfpicture }
%    \end{macrocode}
% We store the name of the node corresponding to the cell in |\l_tmpa_tl|.
%    \begin{macrocode}
            \tl_set:Nx \l_tmpa_tl 
               { nm - \int_use:N \g_@@_env_int - \int_use:N #1 - \int_use:N #2 }
            \pgfpointanchor \l_tmpa_tl { east }
            \dim_gset:Nn \g_tmpa_dim \pgf@x
            \pgfpointanchor \l_tmpa_tl { west }
            \dim_gset:Nn \g_tmpb_dim \pgf@x
            \end { pgfpicture } 
            \dim_compare:nTF 
              { \dim_abs:n { \g_tmpb_dim - \g_tmpa_dim } < 0.5 pt }
              \prg_return_false:
              \prg_return_true:
          }
      }
  }
%    \end{macrocode}
%
% \interitem
% The argument of the following command |\@@_instruction_of_type:n| is the type
% of the instruction (|Cdots|, |Vdots|, |Ddots|, etc.). This command writes in
% |\g_@@_lines_to_draw_tl| the instruction that will really 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 & \Hdotsfor{2} \\
% \end{pNiceMatrix}
% \end{BVerbatim}
% $\begin{pNiceMatrix}
% 1 & 2 & 3 & 4 \\
% 5 & \Cdots & & 6 \\
% 7 & \Hdotsfor{2} \\
% \end{pNiceMatrix}$
%
% the content of |\g_@@_lines_to_draw_tl| will be:
% 
% \begin{scope}
% \color{gray}
% \verb|\@@_draw_Cdots:nn {2}{2}|
%
% \verb|\@@_draw_Hdotsfor:nnn {3}{2}{2}|
% \end{scope} 
% 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_instruction_of_type:n 
  { 
    \tl_gput_right:Nx \g_@@_lines_to_draw_tl 
      { 
        \exp_not:c { @@ _ draw _ #1 : nn } 
          { \int_use:N \g_@@_row_int } 
          { \int_use:N \g_@@_column_int }
      }
  }
%    \end{macrocode}
%
% 
% \subsection{After the construction of the array}
%
% First, we deactivate Tikz externalization (since we use Tikz pictures with the
% options |overlay| and |remember picture|, there would be errors).
%    \begin{macrocode}
\cs_new_protected:Nn \@@_after_array:
  { 
    \group_begin:
    \cs_if_exist:NT \tikz@library@external@loaded
      { \tikzset { external / export = false } } 
%    \end{macrocode}
% Now, the definition of the counters |\g_@@_column_int| and
% |\g_@@_column_total_int| change: |\g_@@_column_int| will be the number of
% columns without the exterior column (in an environment like |{pNiceArrayC}|)
% and |\g_@@_column_total_int| will be the number of columns with this exterior
% column.  
%    \begin{macrocode}
    \int_gset_eq:NN \g_@@_column_int \g_@@_column_total_int
    \bool_if:NT \l_@@_exterior_column_bool { \int_gdecr:N \g_@@_column_int }
%    \end{macrocode}
%
% The sequence |\g_@@_yet_drawn_seq| contains a list of lines which have been
% drawn previously in the matrix. We maintain this sequence because we don't
% want to draw two overlapping lines. 
%    \begin{macrocode}
    \seq_gclear_new:N \g_@@_yet_drawn_seq
%    \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 wether a diagonal is
% the first of its type in the current |{NiceArray}| environment.
%    \begin{macrocode}
    \bool_if:NT \l_@@_parallelize_diags_bool
      { 
        \int_zero_new:N \l_@@_ddots_int
        \int_zero_new:N \l_@@_iddots_int
%    \end{macrocode}
%
% The dimensions |\l_@@_delta_x_one_dim| and |\l_@@_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 |\l_@@_delta_x_two_dim| and
% |\l_@@_delta_y_two_dim| are the $\Delta_x$ and $\Delta_y$ of the first
% |\Iddots| diagonal. 
%    \begin{macrocode}
        \dim_zero_new:N \l_@@_delta_x_one_dim
        \dim_zero_new:N \l_@@_delta_y_one_dim
        \dim_zero_new:N \l_@@_delta_x_two_dim
        \dim_zero_new:N \l_@@_delta_y_two_dim
      }
%    \end{macrocode}
%
% If the user has used the option |create-extra-nodes|, the ``medium nodes'' and
% ``large nodes'' are created. We recall that the command
% |\@@_create_extra_nodes:|, when used once, becomes no-op (in the current TeX
% group). 
%    \begin{macrocode}
    \bool_if:NT \g_@@_extra_nodes_bool \@@_create_extra_nodes:
%    \end{macrocode}
% 
% \bigskip
% Now, we really draw the lines. The code to draw the lines has been constructed
% in the token list |\g_@@_lines_to_draw_tl|. 
%    \begin{macrocode}
    \tl_if_empty:NF \g_@@_lines_to_draw_tl
      { 
        \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
        \g_@@_lines_to_draw_tl
      }
    \tl_gclear:N \g_@@_lines_to_draw_tl
%    \end{macrocode}
%
% \bigskip
% Now, the |code-after|.
%    \begin{macrocode}
    \tikzset 
      { 
        every~picture / .style = 
         { 
           overlay ,
           remember~picture ,
           name~prefix = nm - \int_use:N \g_@@_env_int - 
         }
      }
    \cs_set_eq:NN \line \@@_line:nn
    \g_@@_code_after_tl 
    \tl_gclear:N \g_@@_code_after_tl
    \group_end:
  }
%    \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}\]
% For a closed extremity, we use the normal node and for a open one, we use the
% ``medium node'' (the medium and large nodes are created with
% |\@@_create_extra_nodes:| if they have not been created yet).  
% \[ \begin{pNiceMatrix}[create-extra-nodes,
%                        code-after = {\begin{tikzpicture} 
%                                      \node [highlight, fit={(2-1)}] {} ;
%                                      \node [highlight, fit={(2-3-medium)}] {};
%                                      \end{tikzpicture}
%                                    }]
% 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 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 wether
% the extremities are open or not. 
% \end{itemize}
%
%    \begin{macrocode}       
\cs_new_protected:Nn \@@_find_extremities_of_line:nnnn
  { 
    \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 }
    \bool_set_false:N \l_@@_initial_open_bool
    \bool_set_false:N \l_@@_final_open_bool
%    \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. 
%    \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_if:nTF 
          {    
               \int_compare_p:nNn
                 \l_@@_final_i_int < { \l_@@_nb_first_row_int - 1 } 
            || \int_compare_p:nNn \l_@@_final_i_int > \g_@@_row_int
            || \int_compare_p:nNn \l_@@_final_j_int < \c_one_int
            || \int_compare_p:nNn \l_@@_final_j_int > \g_@@_column_total_int
%    \end{macrocode}
% If you arrive in the column |C| of an environment with such columns (like
% |{pNiceArrayC}|), you must consider that we are \emph{outside} the matrix
% except if we are drawing a vertical line (included in the column |C|). 
%    \begin{macrocode}
            || \int_compare_p:nNn \l_@@_final_j_int > \g_@@_column_int    
               && \int_compare_p:nNn { #4 } > \c_zero_int 
          }
%    \end{macrocode}
% If we are outside the matrix, we have found the extremity of the dotted line
% and it's a \emph{open} extremity. 
%    \begin{macrocode}
          { 
            \bool_set_true:N \l_@@_final_open_bool
%    \end{macrocode}
% We do a step backwards because we will draw the dotted line upon the last cell
% in the matrix (we will use the ``medium node'' of this cell).
%    \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 if 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}
          { 
            \@@_if_not_empty_cell:nnT \l_@@_final_i_int \l_@@_final_j_int
              { \bool_set_true:N \l_@@_stop_loop_bool }
          }
      }
%    \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_if:nTF 
          { 
            \int_compare_p:nNn \l_@@_initial_i_int < \l_@@_nb_first_row_int
              || 
            \int_compare_p:nNn \l_@@_initial_i_int > \g_@@_row_int
              || 
            \int_compare_p:nNn \l_@@_initial_j_int < 1
              || 
            \int_compare_p:nNn \l_@@_initial_j_int > \g_@@_column_total_int
          }
          { 
            \bool_set_true:N \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
          }
          { 
            \@@_if_not_empty_cell:nnT 
              \l_@@_initial_i_int \l_@@_initial_j_int
              { \bool_set_true:N \l_@@_stop_loop_bool }
          }
      }
%    \end{macrocode}
% If we have at least one open extremity, we create the ``medium nodes'' in the
% matrix (in the case of an open extremity, the dotted line uses the ``medium
% node'' of the last empty cell). We remind that, when used once, the command
% |\@@_create_extra_nodes:| becomes no-op in the current TeX group. 
%    \begin{macrocode}
    \bool_if:nT { \l_@@_initial_open_bool || \l_@@_final_open_bool }
      \@@_create_extra_nodes: 
  }
%    \end{macrocode}
%
% \interitem
% If the dotted line to draw is in the list of the previously drawn lines
% (|\g_@@_yet_drawn_seq|), we don't draw (so, we won't have overlapping lines in
% the \textsc{pdf}). The token list |\l_tmpa_tl| is the $4$-uplet characteristic
% of the line. 
%    \begin{macrocode}
\prg_set_conditional:Npnn \@@_if_yet_drawn: { F }
  { 
    \tl_set:Nx \l_tmpa_tl 
      { 
        \int_use:N \l_@@_initial_i_int -
        \int_use:N \l_@@_initial_j_int -
        \int_use:N \l_@@_final_i_int -
        \int_use:N \l_@@_final_j_int
      }
    \seq_if_in:NVTF \g_@@_yet_drawn_seq \l_tmpa_tl
%    \end{macrocode}
%
% If the dotted line to draw is not in the list, we add it to the list
% |\g_@@_yet_drawn_seq|. 
%    \begin{macrocode}
      \prg_return_true:
      {
        \seq_gput_left:NV \g_@@_yet_drawn_seq \l_tmpa_tl
        \prg_return_false:
      }
  }
%    \end{macrocode}
%
%
% \interitem 
% The command |\@@_retrieve_coords:nn| retrieves the Tikz coordinates of the two
% extremities of the dotted line we will have to draw \footnote{In fact, with
% diagonal lines, or vertical lines in columns of type |L| or |R|, an adjustment
% of one of the coordinates may be done.}. This command has four implicit
% arguments which are |\l_@@_initial_i_int|, |\l_@@_initial_j_int|,
% |\l_@@_final_i_int| and |\l_@@_final_j_int|. 
%
% The two arguments of the command |\@@_retrieve_coords:nn| are the prefix and
% the anchor that must be used for the two nodes. 
%
% The coordinates are stored in |\g_@@_x_initial_dim|, |\g_@@_y_initial_dim|,
% |\g_@@_x_final_dim|, |\g_@@_y_final_dim|. These variables are global for
% technical reasons: we have to do an affectation in an environment
% |{tikzpicture}|. 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_retrieve_coords:nn
  { 
    \dim_gzero_new:N \g_@@_x_initial_dim 
    \dim_gzero_new:N \g_@@_y_initial_dim 
    \dim_gzero_new:N \g_@@_x_final_dim 
    \dim_gzero_new:N \g_@@_y_final_dim
    \begin { tikzpicture } [ remember~picture ]
      \tikz@parse@node\pgfutil@firstofone
        ( nm - \int_use:N \g_@@_env_int -
               \int_use:N \l_@@_initial_i_int -
               \int_use:N \l_@@_initial_j_int #1 )
      \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
      \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
      \tikz@parse@node\pgfutil@firstofone
        ( nm - \int_use:N \g_@@_env_int -
               \int_use:N \l_@@_final_i_int -
               \int_use:N \l_@@_final_j_int #2 )
      \dim_gset:Nn \g_@@_x_final_dim \pgf@x
      \dim_gset:Nn \g_@@_y_final_dim \pgf@y
    \end { tikzpicture } 
  }
\cs_generate_variant:Nn \@@_retrieve_coords:nn { x x }
%    \end{macrocode}
%
% \interitem
%    \begin{macrocode}
\cs_new_protected:Nn \@@_draw_Ldots:nn
  { 
    \@@_find_extremities_of_line:nnnn { #1 } { #2 } \c_zero_int \c_one_int 
    \@@_if_yet_drawn:F \@@_actually_draw_Ldots:
  }
%    \end{macrocode}
% 
% \medskip
% The command |\@@_actually_draw_Ldots:| actually draws the |Ldots| line using
% |\l_@@_initial_i_int|, |\l_@@_initial_j_int|, |\l_@@_initial_open_bool|,
% |\l_@@_final_i_int|, |\l_@@_final_j_int| and |\l_@@_final_open_bool|. We have
% a dedicated command because if is used also by |\Hdotsfor|. 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_actually_draw_Ldots:
  { 
    \@@_retrieve_coords:xx 
      { 
        \bool_if:NTF \l_@@_initial_open_bool
          { - medium.base~west }
          { .base~east } 
      } 
      {  
        \bool_if:NTF \l_@@_final_open_bool 
          { - medium.base~east }
          { . base~west }
      }
    \bool_if:NT \l_@@_initial_open_bool
      { \dim_gset_eq:NN \g_@@_y_initial_dim \g_@@_y_final_dim }
    \bool_if:NT \l_@@_final_open_bool                 
      { \dim_gset_eq:NN \g_@@_y_final_dim \g_@@_y_initial_dim }
%    \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_gadd:Nn \g_@@_y_initial_dim { 0.53 pt }
    \dim_gadd:Nn \g_@@_y_final_dim { 0.53 pt }
    \@@_draw_tikz_line:
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Nn \@@_draw_Cdots:nn
  { 
    \@@_find_extremities_of_line:nnnn { #1 } { #2 } \c_zero_int \c_one_int 
    \@@_if_yet_drawn:F
      { 
        \@@_retrieve_coords:xx 
          { 
            \bool_if:NTF \l_@@_initial_open_bool
              { - medium.mid~west }
              { .mid~east }
          } 
          { 
            \bool_if:NTF \l_@@_final_open_bool
            { - medium.mid~east }
            { .mid~west }
          }
        \bool_if:NT \l_@@_initial_open_bool
          { \dim_gset_eq:NN \g_@@_y_initial_dim \g_@@_y_final_dim }
        \bool_if:NT \l_@@_final_open_bool                 
          { \dim_gset_eq:NN \g_@@_y_final_dim \g_@@_y_initial_dim }
        \@@_draw_tikz_line:
      }
  }
%    \end{macrocode}
%
% \bigskip
% For the vertical dots, we have to distinguish different instances because we
% want really vertical lines. Be careful: it's not possible to insert the
% command |\@@_retrieve_coords:nn| in the arguments |T| and |F| of the
% \pkg{expl3} commands (why?). 
%    \begin{macrocode}      
\cs_new_protected:Nn \@@_draw_Vdots:nn
  { 
    \@@_find_extremities_of_line:nnnn { #1 } { #2 } \c_one_int \c_zero_int
    \@@_if_yet_drawn:F
      { \@@_retrieve_coords:xx 
          { 
            \bool_if:NTF \l_@@_initial_open_bool
              { - medium.north~west }
              { .south~west }
          } 
          { 
            \bool_if:NTF \l_@@_final_open_bool
              { - medium.south~west }
              { .north~west }
          }
%    \end{macrocode}
% The boolean |\l_tmpa_bool| indicates wether the column is of type |l| (|L| of
% |{NiceArray}|) or may be considered as if.
%    \begin{macrocode}      
        \bool_set:Nn \l_tmpa_bool 
          { \dim_compare_p:nNn \g_@@_x_initial_dim = \g_@@_x_final_dim }
        \@@_retrieve_coords:xx 
          { 
            \bool_if:NTF \l_@@_initial_open_bool
              { - medium.north }
              { .south }
          } 
          { 
            \bool_if:NTF \l_@@_final_open_bool  
              { - medium.south }
              { .north }
          }
%    \end{macrocode}
% The boolean |\l_tmpb_bool| indicates wether the column is of type |c| (|C| of
% |{NiceArray}|) or may be considered as if.
%    \begin{macrocode}      
        \bool_set:Nn \l_tmpb_bool 
          { \dim_compare_p:nNn \g_@@_x_initial_dim = \g_@@_x_final_dim }
        \bool_if:NF \l_tmpb_bool
          { 
            \dim_gset:Nn \g_@@_x_initial_dim
              { 
                \bool_if:NTF \l_tmpa_bool \dim_min:nn \dim_max:nn
                  \g_@@_x_initial_dim \g_@@_x_final_dim
              }
            \dim_gset_eq:NN \g_@@_x_final_dim \g_@@_x_initial_dim
          }
        \@@_draw_tikz_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.
%    \begin{macrocode}
\cs_new_protected:Nn \@@_draw_Ddots:nn
  { 
    \@@_find_extremities_of_line:nnnn { #1 } { #2 } \c_one_int \c_one_int
    \@@_if_yet_drawn:F
      { 
        \@@_retrieve_coords:xx 
          { 
            \bool_if:NTF \l_@@_initial_open_bool
              { - medium.north~west }
              { .south~east }
          } 
          { 
            \bool_if:NTF \l_@@_final_open_bool
              { - medium.south~east }
              { .north~west }
          }
%    \end{macrocode}
% We have retrieved the coordinates in the usual way (they are stored in
% |\g_@@_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_incr:N \l_@@_ddots_int
%    \end{macrocode}
% We test if the diagonal line is the first one (the counter |\l_@@_ddots_int|
% is created for this usage). 
%    \begin{macrocode}
            \int_compare:nNnTF \l_@@_ddots_int = \c_one_int
%    \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_set:Nn \l_@@_delta_x_one_dim 
                  { \g_@@_x_final_dim - \g_@@_x_initial_dim }
                \dim_set:Nn \l_@@_delta_y_one_dim 
                  { \g_@@_y_final_dim - \g_@@_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 |\g_@@_y_initial_dim|.
%    \begin{macrocode}
              { 
                \dim_gset:Nn \g_@@_y_final_dim          
                  { 
                    \g_@@_y_initial_dim +
                    ( \g_@@_x_final_dim - \g_@@_x_initial_dim ) * 
                    \dim_ratio:nn \l_@@_delta_y_one_dim \l_@@_delta_x_one_dim 
                  }
              }
          }
%    \end{macrocode}
% Now, we can draw the dotted line (after a possible change of
% |\g_@@_y_initial_dim|). 
%    \begin{macrocode}
        \@@_draw_tikz_line:
      }
  }
%    \end{macrocode}
%
% \bigskip
% We draw the |\Iddots| diagonals in the same way.
%    \begin{macrocode}
\cs_new_protected:Nn \@@_draw_Iddots:nn
  {
    \@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 { -1 }
    \@@_if_yet_drawn:F
      { \@@_retrieve_coords:xx 
          { 
            \bool_if:NTF \l_@@_initial_open_bool
              { - medium.north~east }
              { .south~west }
          } 
          { 
            \bool_if:NTF \l_@@_final_open_bool
              { - medium.south~west }
              { .north~east }
          }
        \bool_if:NT \l_@@_parallelize_diags_bool
          { 
            \int_incr:N \l_@@_iddots_int
            \int_compare:nNnTF \l_@@_iddots_int = \c_one_int
              { 
                \dim_set:Nn \l_@@_delta_x_two_dim 
                  { \g_@@_x_final_dim - \g_@@_x_initial_dim }
                \dim_set:Nn \l_@@_delta_y_two_dim 
                  { \g_@@_y_final_dim - \g_@@_y_initial_dim }
              }
              { 
                \dim_gset:Nn \g_@@_y_final_dim
                   { 
                     \g_@@_y_initial_dim +
                     ( \g_@@_x_final_dim - \g_@@_x_initial_dim ) *
                     \dim_ratio:nn \l_@@_delta_y_two_dim \l_@@_delta_x_two_dim 
                   }
              }
          }
        \@@_draw_tikz_line:
      }
  }
%    \end{macrocode}
%
% \bigskip
% \subsection{The actual instructions for drawing the dotted line with Tikz}
%
% The command |\@@_draw_tikz_line:| draws the line using four implicit arguments: 
%
% \quad |\g_@@_x_initial_dim|, |\g_@@_y_initial_dim|, |\g_@@_x_final_dim| and |\g_@@_y_final_dim|. 
% These variables are global for technical reasons: their first affectation was in an instruction |\tikz|.
%
%    \begin{macrocode}
\cs_new_protected:Nn \@@_draw_tikz_line:
  { 
%    \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 
             ( (   \dim_use:N \g_@@_x_final_dim 
                 - \dim_use:N \g_@@_x_initial_dim 
               ) ^ 2
                  +
               (   \dim_use:N \g_@@_y_final_dim 
                 - \dim_use:N \g_@@_y_initial_dim
               ) ^ 2 
             )
          }
      }
%    \end{macrocode}
% We draw only if the length is not equal to zero (in fact, in the first
% compilation, the length may be equal to zero). 
%    \begin{macrocode}
    \dim_compare:nNnF \l_@@_l_dim = \c_zero_dim
%    \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 { 0.45 em } }
              }
              { 
                \int_set:Nn \l_tmpa_int 
                  { \dim_ratio:nn { \l_@@_l_dim - 0.3 em } { 0.45 em } }
              }
          }
          { 
            \bool_if:NTF \l_@@_final_open_bool
              { 
                \int_set:Nn \l_tmpa_int 
                  { \dim_ratio:nn { \l_@@_l_dim - 0.3 em } { 0.45 em } }
              }
              { 
                \int_set:Nn \l_tmpa_int 
                  { \dim_ratio:nn { \l_@@_l_dim - 0.6 em } { 0.45 em }}
              }
          }
%    \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 
          { 
            ( \g_@@_x_final_dim - \g_@@_x_initial_dim ) *
            \dim_ratio:nn { 0.45 em } \l_@@_l_dim 
          }
        \dim_set:Nn \l_tmpb_dim 
          { 
            ( \g_@@_y_final_dim - \g_@@_y_initial_dim ) *
            \dim_ratio:nn { 0.45 em } \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 (|\int_step_inline:nnnn|), the dimensions
% |\g_@@_x_initial_dim| and |\g_@@_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 \g_@@_x_initial_dim
          {  
            ( \g_@@_x_final_dim - \g_@@_x_initial_dim ) *
            \dim_ratio:nn 
              { \l_@@_l_dim - 0.45 em * \l_tmpa_int } { \l_@@_l_dim * 2 } *
            \l_tmpb_int
          }
%    \end{macrocode}
% (In a multiplication of a dimension and an integer, the integer must always be
% put in second position.) 
%    \begin{macrocode}         
        \dim_gadd:Nn \g_@@_y_initial_dim 
          {   
            ( \g_@@_y_final_dim - \g_@@_y_initial_dim ) * 
            \dim_ratio:nn 
              { \l_@@_l_dim - 0.45 em * \l_tmpa_int } 
              { \l_@@_l_dim * 2 } * 
            \l_tmpb_int
          }
        \begin { tikzpicture } [ overlay ]
          \int_step_inline:nnnn 0 1 \l_tmpa_int
            { 
              \pgfpathcircle 
                { \pgfpoint { \g_@@_x_initial_dim } { \g_@@_y_initial_dim } }
                { 0.53 pt }
              \pgfusepath { fill }
              \dim_gadd:Nn \g_@@_x_initial_dim \l_tmpa_dim
              \dim_gadd:Nn \g_@@_y_initial_dim \l_tmpb_dim 
            }
        \end { tikzpicture } 
      }
  }
%    \end{macrocode}
%
% \subsection{User commands available in the new environments}
%
% We give new names for the commands |\ldots|, |\cdots|, |\vdots| and |\ddots|
% because these commands will be redefined (if the option |renew-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
%    \end{macrocode}
%
% \interitem
% The command |\@@_add_to_empty_cells:| adds the current cell to
% |\g_@@_empty_cells_seq| which is the list of the empty cells (the cells
% explicitly declared ``empty'': there may be, of course, other empty cells in
% the matrix). 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_add_to_empty_cells:
  { 
    \seq_gput_right:Nx \g_@@_empty_cells_seq
      { \int_use:N \g_@@_row_int - \int_use:N \g_@@_column_int }
  }
%    \end{macrocode}
%
% \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}|). 
%    \begin{macrocode}
\NewDocumentCommand \@@_Ldots { s }
  { 
    \bool_if:nF { #1 } { \@@_instruction_of_type:n { Ldots } }
    \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_ldots }
    \@@_add_to_empty_cells:
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\NewDocumentCommand \@@_Cdots { s }
  { 
    \bool_if:nF { #1 } { \@@_instruction_of_type:n { Cdots } }
    \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_cdots }
    \@@_add_to_empty_cells:
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\NewDocumentCommand \@@_Vdots { s }
  {
    \bool_if:nF { #1 } { \@@_instruction_of_type:n { Vdots } }
    \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_vdots }
    \@@_add_to_empty_cells:
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\NewDocumentCommand \@@_Ddots { s }
  { 
    \bool_if:nF { #1 } { \@@_instruction_of_type:n { Ddots } }
    \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_ddots }
    \@@_add_to_empty_cells:
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\NewDocumentCommand \@@_Iddots { s }
  { 
    \bool_if:nF { #1 } { \@@_instruction_of_type:n { Iddots } }
    \bool_if:NF \l_@@_nullify_dots_bool { \phantom \@@_iddots }
    \@@_add_to_empty_cells:
  }
%    \end{macrocode}
%
%
% \bigskip
% The command |\@@_Hspace:| will be linked to |\hspace| in |{NiceArray}|.
%    \begin{macrocode}
\cs_new_protected:Nn \@@_Hspace:
  { 
   \@@_add_to_empty_cells:
   \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:Nn \@@_multicolumn:nnn
  { 
    \@@_old_multicolumn { #1 } { #2 } { #3 }
    \int_compare:nNnT #1 > 1
      {
        \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
          { \int_eval:n \g_@@_row_int - \int_use:N \g_@@_column_int }
        \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 } 
      }
    \int_gadd:Nn \g_@@_column_int { #1 - 1 }
  }
%    \end{macrocode}
%
%
% \bigskip
% The command |\@@_Hdotsfor| will be linked to |\Hdotsfor| in |{NiceArray}|.
% This command uses an optional argument like |\hdotsfor| but this argument is
% discarded (in |\hdotsfor|, this argument is used for fine tuning of the space
% beetween two consecutive dots). Tikz nodes are created for all the cells of
% the array, even the implicit cells of the |\Hdotsfor|. 
%    \begin{macrocode}
\NewDocumentCommand \@@_Hdotsfor { O { } m }
  { 
    \tl_gput_right:Nx \g_@@_lines_to_draw_tl 
      { 
        \exp_not:N \@@_draw_Hdotsfor:nnn
          { \int_use:N \g_@@_row_int } 
          { \int_use:N \g_@@_column_int }
          { #2 }
      }
    \prg_replicate:nn { #2 - 1 } { & } 
  }
%    \end{macrocode}
% 
% \medskip
%    \begin{macrocode}
\cs_new_protected:Nn \@@_draw_Hdotsfor:nnn
  { 
    \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:Nn \l_@@_final_i_int { #1 }
%    \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
      }
      {
        \int_set:Nn \l_tmpa_int { #2 - 1 }
        \@@_if_not_empty_cell:nnTF \l_@@_initial_i_int \l_tmpa_int
          { \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 } = \g_@@_column_int
      { 
        \int_set:Nn \l_@@_final_j_int { #2 + #3 - 1 }
        \bool_set_true:N \l_@@_final_open_bool
      }
      {
        \int_set:Nn \l_tmpa_int { #2 + #3 }
        \@@_if_not_empty_cell:nnTF \l_@@_final_i_int \l_tmpa_int
          { \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
          }
      }
    \bool_if:nT { \l_@@_initial_open_bool || \l_@@_final_open_bool }
      \@@_create_extra_nodes: 
    \@@_actually_draw_Ldots:
  }
%    \end{macrocode}
% 
%
%
% \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 specification of two cells in the
% array (in the format $i$-$j$) and draws a dotted line between these cells. 
%    \begin{macrocode}
\cs_new_protected:Nn \@@_line:nn
  {
    \dim_zero_new:N \g_@@_x_initial_dim
    \dim_zero_new:N \g_@@_y_initial_dim
    \dim_zero_new:N \g_@@_x_final_dim
    \dim_zero_new:N \g_@@_y_final_dim
    \bool_set_false:N \l_@@_initial_open_bool
    \bool_set_false:N \l_@@_final_open_bool
    \begin { tikzpicture }
       \path~(#1)~--~(#2)~node[at~start]~(i)~{}~node[at~end]~(f)~{} ;
       \tikz@parse@node \pgfutil@firstofone ( i )
       \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
       \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
       \tikz@parse@node \pgfutil@firstofone ( f )
       \dim_gset:Nn \g_@@_x_final_dim \pgf@x
       \dim_gset:Nn \g_@@_y_final_dim \pgf@y
    \end { tikzpicture }  
    \@@_draw_tikz_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 commands to draw dotted lines to separate columns and rows}
%
% The command |\hdottedline| draws a horizontal dotted line to separate two
% rows. Similarly, the letter ``:'' in the preamble draws a vertical dotted line
% (the letter can be changed with the option |letter-for-dotted-lines|). Both
% mechanisms write instructions in the |code-after|. The actual instructions in
% the |code-after| use the commands |\@@_hdottedline:n| and |\@@_vdottedline:n|.
% 
% \bigskip
%
% The following command must \emph{not} be protected because it starts with |\noalign|.
%    \begin{macrocode}
\cs_new:Nn \@@_hdottedline:
  {
    \noalign { \skip_vertical:n { 0.53 pt } }
    \@@_hdottedline_i:
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Nn \@@_hdottedline_i:
  { 
    \int_compare:nNnTF \g_@@_row_int < 2
      { \@@_error:n { Use~of~hdottedline~in~first~position } }
      {
        \bool_gset_true:N \g_@@_extra_nodes_bool
        \bool_if:NF \c_@@_draft_bool
          {
            \tl_gput_right:Nx \g_@@_code_after_tl 
              { 
                \exp_not:N \@@_hdottedline:n 
                \exp_not:N { 
                \int_eval:n { \g_@@_row_int - 1 } 
                \exp_not:N }
              } 
          } 
      }
  }
%    \end{macrocode}
% 
% The argument of |\@@_hdottedline:n| is the number of the row \emph{after} which
% we have to draw a dotted line.
%    \begin{macrocode}
\cs_new_protected:Nn \@@_hdottedline:n
  { 
    \@@_create_extra_nodes:
    \dim_zero_new:N \g_@@_x_initial_dim
    \dim_zero_new:N \g_@@_y_initial_dim
    \dim_zero_new:N \g_@@_x_final_dim
    \dim_zero_new:N \g_@@_y_final_dim
    \bool_set_true:N \l_@@_initial_open_bool 
    \bool_set_true:N \l_@@_final_open_bool 
    \begin { tikzpicture } [ remember~picture ]
      \tikz@parse@node\pgfutil@firstofone
        ( #1 - 1 -large .south~west )
      \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
      \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
      \tikz@parse@node\pgfutil@firstofone
        ( #1 - \int_use:N \g_@@_column_int -large .south~east )
      \dim_gset:Nn \g_@@_x_final_dim \pgf@x
      \dim_gset:Nn \g_@@_y_final_dim \pgf@y
    \end { tikzpicture }
    \@@_draw_tikz_line:
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Use~of~hdottedline~in~first~position }
  { 
    You~can't~use~the~command~\token_to_str:N\hdottedline\ in~the~first~row~ 
    of~the~environment~\{\@currenvir\}. \\
    If~you~go~on,~this~dotted~line~will~be~ignored.
  }
%    \end{macrocode}
%
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Nn \@@_vdottedline:n
  {
%    \end{macrocode}
% The following test is a security: normally, the error should have been capted
% before. 
%    \begin{macrocode}
    \int_compare:nNnTF #1 = \c_zero_int
      { \@@_error:n { Use~of~:~in~first~position } }
      {   
        \@@_create_extra_nodes:
        \bool_if:NF \c_@@_draft_bool
          {
            \dim_zero_new:N \g_@@_x_initial_dim
            \dim_zero_new:N \g_@@_y_initial_dim
            \dim_zero_new:N \g_@@_x_final_dim
            \dim_zero_new:N \g_@@_y_final_dim
            \bool_set_true:N \l_@@_initial_open_bool 
            \bool_set_true:N \l_@@_final_open_bool 
%    \end{macrocode}
% If the |w|-nodes are created in the previous column (that is if the previous
% column was constructed explicitly of implicitly with a letter |w|), we use
% that column in order to have the dotted lines perfectly aligned when we use
% the environment |{NiceMatrixBlock}| with the option |auto-columns-width|.
%    \begin{macrocode}
            \cs_if_exist:cTF 
              { pgf@sh@ns@nm -\int_use:N \g_@@_env_int - 1 - #1 - w }
              {
                \begin { tikzpicture } [ remember~picture ]
                  \tikz@parse@node\pgfutil@firstofone
                    ( 1 - #1 - w .north~east )
                  \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
                  \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
                  \tikz@parse@node\pgfutil@firstofone
                    ( \int_use:N \g_@@_row_int - #1 - w .south~east )
                  \dim_gset:Nn \g_@@_x_final_dim \pgf@x
                  \dim_gset:Nn \g_@@_y_final_dim \pgf@y
                \end { tikzpicture }
                \dim_gadd:Nn \g_@@_x_initial_dim \arraycolsep
                \dim_gadd:Nn \g_@@_x_final_dim \arraycolsep
              }
              {
                \begin { tikzpicture } [ remember~picture ]
                  \tikz@parse@node\pgfutil@firstofone
                    ( 1 - #1 - large .north~east )
                  \dim_gset:Nn \g_@@_x_initial_dim \pgf@x
                  \dim_gset:Nn \g_@@_y_initial_dim \pgf@y
                  \tikz@parse@node\pgfutil@firstofone
                    ( \int_use:N \g_@@_row_int - #1 - large .south~east )
                  \dim_gset:Nn \g_@@_x_final_dim \pgf@x
                  \dim_gset:Nn \g_@@_y_final_dim \pgf@y
                \end { tikzpicture }
              }
            \@@_draw_tikz_line:
          } 
      }
  }
%    \end{macrocode}
% 
%
%    \begin{macrocode}
\@@_msg_new:nn { Use~of~:~in~first~position }
  { 
    You~can't~use~the~column~specifier~"\l_@@_letter_for_dotted_lines_str"~in~the~
    first~position~of~the~preamble~of~the~environment~\{\@currenvir\}. \\
    If~you~go~on,~this~dotted~line~will~be~ignored.
  }
%    \end{macrocode}
%
%
% 
% \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 { } }
  {
    \keys_set:nn { NiceMatrix / NiceMatrixBlock } { #1 }
    \int_zero_new:N \l_@@_first_env_block_int
    \int_set:Nn \l_@@_first_env_block_int { \g_@@_env_int + 1 }
  }
%    \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_now:Nn \@mainaux \ExplSyntaxOn
        \int_step_inline:nnnn \l_@@_first_env_block_int 1 \g_@@_env_int
          { 
            \iow_now:Nx \@mainaux         
              { 
                \cs_gset:cpn { @@ _ max _ cell _ width _ ##1 } 
                  { \dim_use:N \g_@@_max_cell_width_dim }
              }
          }
        \iow_now:Nn \@mainaux \ExplSyntaxOff
      }
  }
%    \end{macrocode}
%
% \subsection{The environment \{pNiceArrayC\} and its variants}
% 
% The code in this section can be removed without affecting the previous code.
% 
% \medskip
% First, we define a set of options for the environment |{pNiceArrayC}| and its
% variants. This set of keys is named |NiceMatrix/NiceArrayC| even though there
% is no environment called |{NiceArrayC}|. 
%
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceArrayC }
  { 
    code-for-last-col .tl_set:N = \l_@@_code_for_last_col_tl ,
    code-for-last-col .value_required:n = true ,
    unknown .code:n  = \@@_error:n { Unknown~option~for~NiceArrayC }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceArrayC }
  { 
    The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
    \{\@currenvir\}. \\
    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):~
    code-after,~
    code-for-last-col,~
    columns-width,~
    create-extra-nodes,~
    extra-left-margin,~
    extra-right-margin,~
    left-margin,~
    name,~
    nullify-dots,~
    parallelize-diags~
    renew-dots~
    and~right-margin.
  }
%    \end{macrocode}
%
% \bigskip
% In the environment |{pNiceArrayC}| (and its variants), the last column is
% composed with instructions |\hbox_overlap_right:n| (this instruction may be
% seen as the \pkg{expl3} equivalent of the classical command |\rlap|). After
% the composition of the array, an horizontal skip is inserted to compensate for
% these overlapping boxes.
%
% \medskip
% The command |\@@_NiceArrayC:n| will be used in |{NiceArrayCwithDelims}| but
% also in the environment |{NiceArrayRCwithDelims}|.
%    \begin{macrocode}
\cs_new_protected:Nn \@@_NiceArrayC:n
  {
    \bool_set_true:N \l_@@_exterior_column_bool
    \begin { NiceArray }
%    \end{macrocode}
% The beginning of the preamble is the argument of the environment
% |{pNiceArrayC}|.  
%    \begin{macrocode}
      { #1
%    \end{macrocode}
% 
% However, we add a last column with its own specification. For a cell in this
% last column, the first operation is to store the content of the cell in the
% box |\l_tmpa_box|. This is allowed in \pkg{expl3} with the construction
% |\hbox_set:Nw \l_tmpa_box| ... |\hbox_set_end:|. 
%    \begin{macrocode}
        > 
          { 
            \int_gincr:N \g_@@_column_int
            \int_gset:Nn \g_@@_column_total_int
              { \int_max:nn \g_@@_column_total_int \g_@@_column_int }
            \hbox_set:Nw \l_tmpa_box $ % $
              \l_@@_code_for_last_col_tl
          }
        l
%    \end{macrocode}
% 
% We actualize the value of |\g_@@_with_last_col_dim| which, at the end of the
% array, will contain the maximal width of the cells of the last column (thus,
% it will be equal to the width of the last column). 
%    \begin{macrocode}
        < { $ % $
            \hbox_set_end:
            \dim_gset:Nn \g_@@_width_last_col_dim
               { 
                 \dim_max:nn 
                   \g_@@_width_last_col_dim
                   { \box_wd:N \l_tmpa_box }
               }
            \skip_horizontal:n { - 2 \arraycolsep }
%    \end{macrocode}
% The content of the cell is inserted in an overlapping position.
%    \begin{macrocode}
            \hbox_overlap_right:n
              { 
                \skip_horizontal:n
                  { 
                    2 \arraycolsep + 
                    \l_@@_right_margin_dim + 
                    \l_@@_extra_right_margin_dim
                  }
                \tikz 
                  [ 
                    remember~picture , 
                    inner~sep = \c_zero_dim , 
                    minimum~width = \c_zero_dim , 
                    baseline
                  ]
                \node 
                  [ 
                    anchor = base ,
                    name = 
                      nm -
                      \int_use:N \g_@@_env_int -
                      \int_use:N \g_@@_row_int -
                      \int_use:N \g_@@_column_int ,
                    alias = 
                      \str_if_empty:NF \l_@@_name_str
                        { 
                          \l_@@_name_str -
                          \int_use:N \g_@@_row_int -
                          \int_use:N \g_@@_column_int
                        }
                  ]
                  { \box_use:N \l_tmpa_box } ; 
              } 
          }
      }
  }
%    \end{macrocode}
%
% \bigskip
% The environments of the type of |{pNiceArrayC}| will be constructed over
% |{NiceArrayCwithDelims}|. The first two arguments of this environment are the
% left and the right delimiter. 
%    \begin{macrocode}
\NewDocumentEnvironment { NiceArrayCwithDelims } { m m O { } m ! O { } }
  {
    \dim_gzero_new:N \g_@@_width_last_col_dim
    \keys_set:nn { NiceMatrix / NiceArrayC } { #3 , #5 }
    \bool_set_false:N \l_@@_exterior_arraycolsep_bool
    \str_set:Nn \l_@@_pos_env_str c
    \left #1
    \@@_NiceArrayC:n { #4 }
  }
  {
    \end { NiceArray }
    \right #2
    \skip_horizontal:n \g_@@_width_last_col_dim
  }
%    \end{macrocode}
%         
%                                                                             
% \bigskip
% In the following environments, we don't use the form with |\begin{...}| and
% |\end{...}| because we use |\@currenvir| in the error message for an unknown
% option. 
%    \begin{macrocode}                       
\NewDocumentEnvironment { pNiceArrayC } { }
  { \NiceArrayCwithDelims ( ) }
  { \endNiceArrayCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}                       
\NewDocumentEnvironment { vNiceArrayC } { }
  { \NiceArrayCwithDelims | | }
  { \endNiceArrayCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}                       
\NewDocumentEnvironment { VNiceArrayC } { }
  { \NiceArrayCwithDelims \|  \| }
  { \endNiceArrayCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}                       
\NewDocumentEnvironment { bNiceArrayC } { }
  { \NiceArrayCwithDelims [ ] }
  { \endNiceArrayCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}                       
\NewDocumentEnvironment { BNiceArrayC } { }
  { \NiceArrayCwithDelims \{  \} }
  { \endNiceArrayCwithDelims }
%    \end{macrocode}
%    
%
% \subsection{The environment \{pNiceArrayRC\}}
%
% The code in this section can be removed without affecting the previous code.
% 
%
% \bigskip
%    \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceArrayRC }
  {
    code-for-first-row .tl_set:N = \l_@@_code_for_first_row_tl ,
    code-for-first-row .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 ,
    unknown .code:n = \@@_error:n { Unknown~option~for~NiceArrayRC }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~for~NiceArrayRC }
  { 
    The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~
     \{ \@currenvir \}. \\
    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):~
    code-after,~
    code-for-last-col,~
    code-for-first-row,~
    columns-width,~
    create-extra-nodes,~
    extra-left-margin,~
    extra-right-margin,~
    left-margin,~
    name,~
    nullify-dots,~
    parallelize-diags,~
    renew-dots~
    and~right-margin.
  }
%    \end{macrocode}
%
%
% The first and the second argument of the environment |{NiceArrayRCwithDelims}|
% are the delimiters which will be used in the array. Usually, the final user
% will not use directly this environment |{NiceArrayRCwithDelims}| because he
% will use one of the variants |{pNiceArrayRC}|, |{vNiceArrayRC}|, etc. 
%
%    \begin{macrocode}
\NewDocumentEnvironment { NiceArrayRCwithDelims } { m m O { } m ! O { } }
  {
    \int_zero:N \l_@@_nb_first_row_int 
    \dim_gzero_new:N \g_@@_width_last_col_dim
    \keys_set:nn { NiceMatrix / NiceArrayRC } { #3 , #5 }
    \bool_set_false:N \l_@@_exterior_arraycolsep_bool
    \str_set:Nn \l_@@_pos_env_str c
    \box_clear_new:N \l_@@_the_array_box
    \hbox_set:Nw \l_@@_the_array_box
    $ % $
    \@@_NiceArrayC:n { #4 } 
  }
  { 
    \end { NiceArray }
    $ % $
    \hbox_set_end:
    \dim_set:Nn \l_tmpa_dim
      { 
        ( 
          \dim_max:nn
             { 12 pt } 
             { \g_@@_max_ht_row_one_dim + \g_@@_max_dp_row_zero_dim }
        ) 
        + \g_@@_max_ht_row_zero_dim - \g_@@_max_ht_row_one_dim 
      }
    \hbox_set:Nn \l_tmpa_box
      {
        $ % $
        \left #1
        \vcenter 
          { 
            \skip_vertical:n { - \l_tmpa_dim }
            \box_use_drop:N \l_@@_the_array_box
          }
        \right #2
        $ % $
        \skip_horizontal:n \g_@@_width_last_col_dim
      }
    \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim }
    \box_use_drop:N \l_tmpa_box
    }
%    \end{macrocode}
% 
% \bigskip
% In the following environments, we don't use the form with |\begin{...}| and
% |\end{...}| because we use |\@currenvir| in the error message for an unknown
% option. 
%    \begin{macrocode}
\NewDocumentEnvironment { pNiceArrayRC } { }
  { \NiceArrayRCwithDelims ( ) }
  { \endNiceArrayRCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { bNiceArrayRC } { }
  { \NiceArrayRCwithDelims [ ] }
  { \endNiceArrayRCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { vNiceArrayRC } { }
  { \NiceArrayRCwithDelims | | }
  { \endNiceArrayRCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { VNiceArrayRC } { }
  { \NiceArrayRCwithDelims \| \| }
  { \endNiceArrayRCwithDelims }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { BNiceArrayRC } { }
  { \NiceArrayRCwithDelims \{ \} }
  { \endNiceArrayRCwithDelims }
%    \end{macrocode}
%
%
% \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
% 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:Nn \@@_create_extra_nodes:
  {
    \begin { tikzpicture } [ remember~picture , overlay ]
      \int_step_variable:nnnNn \l_@@_nb_first_row_int 1 \g_@@_row_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:nnnNn 1 1 \g_@@_column_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_@@_nb_first_row_int \g_@@_row_int \@@_i
        { 
          \int_step_variable:nNn \g_@@_column_total_int \@@_j
%    \end{macrocode}
% Maybe the cell ($i$-$j$) is an implicit cell (that is to say a cell after
% implicit ampersands |&|). In this case, of course, we don't update the
% dimensions we want to compute. 
%    \begin{macrocode}
            { \cs_if_exist:cT 
                { pgf@sh@ns@nm - \int_use:N \g_@@_env_int - \@@_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}
                {
                  \tikz@parse@node \pgfutil@firstofone 
                    ( nm - \int_use:N \g_@@_env_int 
                         - \@@_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}
                 \tikz@parse@node \pgfutil@firstofone 
                   ( nm - \int_use:N \g_@@_env_int - \@@_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 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''
% (after changing the value of |name-suffix|). 
%    \begin{macrocode} 
      \tikzset { name~suffix = -medium }
      \@@_create_nodes:
%    \end{macrocode}
% 
% \bigskip
% For ``large nodes'', the eventual ``first row'' and ``last column'' (in
% environments like |{pNiceArrayRC}|) don't interfer. That's why the loop over
% the rows will start at 1 and the loop over the columns will stop at
% $|\g_@@_column_int|$ (and not |\g_@@_column_total_int|).\footnote{We recall
% that |\g_@@_column_total_int| is equal to |\g_@@_column_int| except if there
% is an exterior column. In this case, |\g_@@_column_total_int| is equal to
% |\g_@@_column_int|${}+1$.} 
%     \begin{macrocode}
      \int_set:Nn \l_@@_nb_first_row_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:nnnNn 1 1 { \g_@@_row_int - 1 } \@@_i
        { 
          \dim_set:cn { l_@@_row _ \@@_i _ min _ dim }  
            {
              (  
                \dim_use:c { l_@@_row _ \@@_i _ min _ dim } + 
                \dim_use:c { l_@@_row _ \int_eval:n { \@@_i + 1 } _ max _ dim }
              ) 
              / 2
            }
          \dim_set_eq:cc { l_@@_row _ \int_eval:n { \@@_i + 1 } _ max _ dim } 
            { l_@@_row_\@@_i _min_dim } 
        }
      \int_step_variable:nnnNn 1 1 { \g_@@_column_int - 1 } \@@_j
        { 
          \dim_set:cn { l_@@_column _ \@@_j _ max _ dim }  
            { 
              (  
                \dim_use:c 
                  { l_@@_column _ \@@_j _ max _ dim } + 
                \dim_use:c 
                  { l_@@_column _ \int_eval:n { \@@_j + 1 } _ min _ dim }
              ) 
              / 2
            }
          \dim_set_eq:cc { l_@@_column _ \int_eval:n { \@@_j + 1 } _ min _ dim }
            { l_@@_column _ \@@_j _ max _ dim } 
        }
      \dim_sub:cn 
        { l_@@_column _ 1 _ min _ dim } 
        \g_@@_left_margin_dim
      \dim_add:cn 
        { l_@@_column _ \int_use:N \g_@@_column_int _ max _ dim } 
        \g_@@_right_margin_dim
%    \end{macrocode}
% Now, we can actually create the ``large nodes''.
%    \begin{macrocode}
      \tikzset { name~suffix = -large }
      \@@_create_nodes:
      \end{tikzpicture}
%    \end{macrocode}
%
% \medskip
% When used once, the command |\@@_create_extra_nodes:| must become no-op (in
% the current TeX group). That's why we put a nullification of the command.
%    \begin{macrocode}
      \cs_set:Nn \@@_create_extra_nodes: { }
  }
%    \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. 
%     \begin{macrocode}
\cs_new_protected:Nn \@@_create_nodes:
  { 
    \int_step_variable:nnnNn \l_@@_nb_first_row_int 1 \g_@@_row_int \@@_i
      { 
        \int_step_variable:nnnNn 1 1 \g_@@_column_total_int \@@_j
%    \end{macrocode}
% We create two ponctual nodes for the extremities of a diagonal of the
% rectangular node we want to create. These nodes |(@@~south~west)| and
% |(@@~north~east)| are not available for the user of \pkg{nicematrix}. That's
% why their names are independent of the row and the column. In the two nested
% loops, they will be overwritten until the last cell.
%    \begin{macrocode}
          {
            \coordinate ( @@~south~west ) 
               at ( \dim_use:c { l_@@_column_ \@@_j _min_dim } ,
                    \dim_use:c { l_@@_row_ \@@_i _min_dim } ) ; 
            \coordinate ( @@~north~east ) 
               at ( \dim_use:c { l_@@_column_ \@@_j _max_dim },
                    \dim_use:c { l_@@_row_ \@@_i _max_dim } ) ; 
%    \end{macrocode}
% We can eventually draw the rectangular node for the cell (|\@@_i|-|\@@_j|).
% This node is created with the Tikz library \pkg{fit}. Don't forget that the
% Tikz option |name suffix| has been set to |-medium| or |-large|. 
%    \begin{macrocode}
            \node
              [ 
                node~contents = { } ,
                fit = ( @@~south~west ) ( @@~north~east )  ,
                inner~sep = \c_zero_dim ,
                name = nm - \int_use:N \g_@@_env_int - \@@_i - \@@_j ,
                alias = 
                  \str_if_empty:NF \g_@@_name_str 
                    { \g_@@_name_str - \@@_i - \@@_j }
              ] 
              ; 
          }
      }
%    \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}
%
%
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_extract_coords: #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:Nn \@@_node_for_multicolumn:nn
  { 
    \@@_extract_coords: #1 \q_stop
    \coordinate ( @@~south~west ) at
      (
        \dim_use:c { l_@@_column _ \@@_j _ min _ dim } ,
        \dim_use:c { l_@@_row _ \@@_i _ min _ dim } 
      ) ; 
    \coordinate ( @@~north~east ) at
      ( 
        \dim_use:c { l_@@_column _ \int_eval:n { \@@_j + #2 - 1 } _ max _ dim} ,
        \dim_use:c { l_@@_row _ \@@_i _ max _ dim } 
      ) ; 
    \node 
      [ 
        node~contents = { } ,
        fit = ( @@~south~west ) ( @@~north~east ) ,
        inner~sep = \c_zero_dim ,
        name = nm - \int_use:N \g_@@_env_int - \@@_i - \@@_j ,
        alias = 
          \str_if_empty:NF \g_@@_name_str { \g_@@_name_str - \@@_i - \@@_j }
      ] 
      ; 
  }
%    \end{macrocode}
%
%
% \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| execute 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}
\ProcessKeysOptions {NiceMatrix}
%    \end{macrocode}
%
% \subsection{Code for \texttt{seq_mapthread_function:NNN}}
%
% In |\@@_create_nodes:| (used twice in |\@@_create_extra_nodes:| to create the
% ``medium nodes'' and ``large nodes''), we want to use
% |\seq_mapthread_function:NNN| which is in \pkg{l3candidates}). For security,
% we define a function |\@@_seq_mapthread_function:NNN|. We will delete the
% following code when |\seq_mapthread_function:NNN| will be in \pkg{l3seq}.
%    \begin{macrocode}
\cs_new:Npn \@@_seq_mapthread_function:NNN #1 #2 #3
  { 
   \group_begin:
%    \end{macrocode}
% In the group, we can use |\seq_pop:NN| safely.
%    \begin{macrocode}
   \int_step_inline:nnnn 1 1 { \seq_count:N #1 }
     { 
       \seq_pop:NN #1 \l_tmpa_tl
       \seq_pop:NN #2 \l_tmpb_tl
       \exp_args:NVV #3 \l_tmpa_tl \l_tmpb_tl
     }
   \group_end:
  }
%    \end{macrocode}
%
%    \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}
%
% 
% \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''. New names are in lowercase and hyphens (but backward compatibility is
% kept). 
% 
%
% \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
% extension \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 column |C|), the cells in the column |C| 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{pNiceArrayRC}{wc{5mm}Cwc{5mm}}
% & C_j & \\
% \mbox{\Large $0$} & \Vdots & \mbox{\Large $0$} \\
%              & \strut a & \Cdots &  L_i \\
% \mbox{\Large $0$} &  & \mbox{\Large $0$} \\
% \end{pNiceArrayRC}\]
%
% \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 |https://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
% ``\verb+|+'' and the specifier ``|:|'' of \pkg{arydshln}).
%
% \endinput
% Local Variables:
% TeX-fold-mode: nil
% fill-column: 80
% End: