summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
blob: c9b463ca716999ee185f58ac96a8c34a29367505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
% \iffalse meta-comment
%
% Copyright (C) 2017-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{1.17}
\def\myfiledate{2019/07/09}
%
%
%<*batchfile>
\begingroup
\input l3docstrip.tex
\keepsilent
\usedir{tex/latex/witharrows}
\preamble

Copyright (C) 2017-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>
%
%<@@=wa>
%<*driver>
\documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz, loaded by witharrows)
\usepackage{xltxtra}
\usepackage{geometry}
\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
\usepackage[footnotehyper]{witharrows}
\usetikzlibrary{calc}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage[only,llbracket,rrbracket]{stmaryrd}
\usepackage{varwidth}
\NewDocumentEnvironment {scope} {} {} {}
\def\interitem{\vskip 7mm plus 2 mm minus 3mm}          
\def\emphase{\bgroup\color{RoyalPurple}\let\next=}
\fvset{commandchars=\~\#\@,formatcom={\color{gray}}}
\DeclareMathOperator{\re}{Re}
\parindent 0pt
\DisableCrossrefs
\begin{document}
\DocInput{witharrows.dtx}
\end{document}
%</driver>
% \fi 
% \VerbatimFootnotes
% \title{The package \pkg{witharrows}\thanks{This document corresponds to the
% version~\myfileversion\space of \pkg{witharrows}, at the date
% of~\myfiledate.}} \author{F. Pantigny \\ \texttt{fpantigny@wanadoo.fr}} 
%
% \maketitle
%
% \begin{abstract}
% The LaTeX package \pkg{witharrows} provides environments |{WithArrows}| and
% |{DispWithArrows}| similar to the environments |{aligned}| and |{align}| of
% \pkg{amsmath} but with the possibility to draw arrows on the right side of the
% alignment. These arrows are usually used to give explanations concerning the
% mathematical calculus presented.
% \end{abstract}
%
%
% \vspace{1cm} 
% This package can be used with |xelatex|, |lualatex|, |pdflatex|
% but also by the classical workflow |latex|-|dvips|-|ps2pdf| (or Adobe
% Distiller). Several compilations may be necessary. This package requires the
% packages \pkg{expl3}, \pkg{xparse} and \pkg{tikz}. The Tikz libraries
% \pkg{arrows.meta} and \pkg{bending} are also required.
%
% \bigskip
% This package provides an environment |{WithArrows}| to construct alignments of
% equations with arrows for the explanations on the right side:
% 
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 ~emphase#\Arrow{we expand}@ \\
%   & = a^2 + 2a + 1  
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1  
% \end{WithArrows}$
%
%
%
% \medskip
% The arrow has been drawn with the command |\Arrow| on the row from which it
% starts. The command |\Arrow| must be used in the second column (the best way
% is to put it at the end of the second cell of the row as in the previous
% example).
%
% \medskip
% The environment |{WithArrows}| bears similarities with the environment
% |{aligned}| of |amsmath| (and |mathtools|). The extension \pkg{witharrows}
% also provides an environment |{DispWithArrows}| which is similar to the
% environment |{align}| of |amsmath|: cf. p. \pageref{DispWithArrows}.
% 
%
% \section{Options for the shape of the arrows}
%
% The command |\Arrow| has several options. These options can be put between
% square brackets, before, or after the mandatory argument.
%
% The option |jump| gives the number\footnote{It's not possible to give a
% non-positive value to |jump|. See below (p.~\pageref{Backwards}) the way to
% draw an arrow which goes backwards.} of rows the arrow must jump (the default
% value is, of course,~$1$).
%
% 
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 \Arrow[~emphase#jump=2@]{we expand} \\
%   & = (a+b)^2 +  2(a+b) +1 \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 \Arrow[jump=1+1]{we expand} \\
%   & = (a+b)^2 + 2(a+b) +1 \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
%
% \interitem
% It's possible to put several arrows which start from the same row.
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 ~emphase#\Arrow{}\Arrow{}[jump=2]@ \\
%   & = (a+b)^2 + 2(a+b) +1 \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 \Arrow{}\Arrow{}[jump=2] \\
%   & = (a+b)^2 + 2(a+b) +1 \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
%
% \interitem
% The option |xoffset| shifts the arrows to the right (we usually don't want the
% arrows to be stucked on the text). The default value of |xoffset| is $3$~mm.
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 
% \Arrow[~emphase#xoffset=1cm@]{with \texttt{xoffset=1cm}} \\
%   & = (a+b)^2 + 2(a+b) +1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 
% \Arrow[xoffset=1cm]{with \texttt{xoffset=1cm}} \\
%   & = (a+b)^2 + 2(a+b) +1 
% \end{WithArrows}$
%
%
% \interitem 
% The arrows are drawn with Tikz. That's why the command |\Arrow| has an option
% |tikz| which can be used to give to the arrow (in fact, the command |\path| of
% Tikz) the options proposed by Tikz for such an arrow. The following example
% gives an thick arrow.
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[~emphase#tikz=thick@]{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[tikz=thick]{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \interitem
% It's also possible to change the arrowheads. For example, we can draw an arrow
% which goes backwards with the Tikz option~|<-|.
% \label{Backwards} 
%
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow~emphase#[tikz=<-]@{we factorize} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[tikz=<-]{we factorize} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \interitem
% It's also possible to suppress both tips of the arrow with the Tikz option
% |-|.
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[~emphase#tikz=-@]{very classical} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[tikz=-]{very classical} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \interitem
% In order to have straight arrows instead of curved ones, we must use the Tikz
% option ``|bend left = 0|''.
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow~emphase#[tikz={bend left=0}]@{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[tikz={bend left=0}]{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \smallskip 
% In fact, it's possible to change more drastically the shape or the arrows with
% the option |tikz-code| (presented p.~\pageref{tikz-code}.
%
% \interitem
% It's possible to use the Tikz option ``|text width|'' to control the width of
% the text associated to the arrow.\footnote{It's possible to avoid the
% hyphenations of the words with the option ``|align = flush left|'' of Tikz.}
% %
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 
% \Arrow[jump=2,~emphase#tikz={text width=5.3cm}@]{We have done...} \\
%   & = (a+b)^2 + 2(a+b) +1 \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = \bigl((a+b)+1\bigr)^2 
% \Arrow[jump=2,tikz={text width=5.3cm}]{We have done a two-stages expansion but
% it would have been clever
% to expand with the multinomial theorem.} \\
% & = (a+b)^2 + 2(a+b) +1 \\
% & = a^2 + 2ab + b^2 + 2a + 2b +1
% \end{WithArrows}$
%
%
% \bigskip
% In the environments |{DispWithArrows}| and |{DispWithArrows*}|, there is an
% option |wrap-lines|. With this option, the lines of the labels are
% automatically wrapped on the right: see p.~\pageref{wrap-lines}.
% 
% \interitem
% If we want to change the font of the text associated to the arrow, we can, of
% course, put a command like |\bfseries|, |\large| or |\sffamily| at the
% beginning of the text. But, by default, the texts are composed with a
% combination of |\small| and |\itshape|. When adding |\bfseries| at the
% beginning of the text, we won't suppress the |\small| and the |\itshape| and
% we will consequently have a text in a bold, italic and small font.
% %
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{~emphase#\bfseries@ we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{\bfseries we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \interitem 
% It's possible to put commands |\\| in the text to force new lines\footnote{By
% default, this is not possible in a Tikz node. However, in \pkg{witharrows},
% the nodes are created with the option |align=left|, and, thus, it becomes
% possible.}. However, if we put a |\\| , a command of font placed in the
% beginning of the text will have effect only until the first command |\\| (like
% in an environment |{tabular}|). That's why Tikz gives an option |font| to
% modify the font of the whole text. Nevertheless, if we use the option
% |tikz={font={\bfseries}}|, the default specification of |\small| and
% |\itshape| will be overwritten.
% %
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[~emphase#tikz={font={\bfseries}}@]{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow[tikz={font={\bfseries}}]{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \medskip
% If we want exactly the same result as previously, we have to give to the
% option |font| the value |{\itshape\small\bfseries}|.
%
%
% \interitem 
% Almost all the options can be given directly between square brackets to the
% environment |{WithArrows}|. \textbf{There must be no space before the opening
% bracket (|[|) of the options of the environment.} The options apply to all the
% arrows of the environment.\footnote{They also apply to the nested environments
% |{WithArrows}| (with the logical exceptions of |interline|, |code-before| and
% |code-after|).}
% %
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#tikz=blue@]
% A & = \bigl((a+b)+1\bigr)^2 \Arrow{first expansion.} \\
%   & = (a+b)^2 + 2(a+b) +1 \Arrow{second expansion.} \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}[tikz=blue]
% A & = \bigl((a+b)+1\bigr)^2 \Arrow{first expansion.} \\
%   & = (a+b)^2 + 2(a+b) +1 \Arrow{second expansion.} \\
%   & = a^2 + 2ab + b^2 + 2a + 2b +1 
% \end{WithArrows}$
%
%
% \interitem
% The environment |{WithArrows}| has an option |displaystyle|. With this option,
% all the elements are composed in |\displaystyle| (like in an environment
% |{aligned}| of \pkg{amsmath}).
%
% \medskip
% Without the option |displaystyle|:
% %
% \begin{Verbatim}
% $\begin{WithArrows}
% \int_0^1 (x+1)^2 dx 
% & = \int_0^1 (x^2+2x+1) dx
% \Arrow{linearity of integration}     \\
% & = \int_0^1 x^2 dx + 2 \int_0^1 x dx + \int_0^1 dx \\
% & = \frac13 + 2\frac12 + 1 \\
% & = \frac73
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% \int_0^1 (x+1)^2 dx 
% & = \int_0^1 (x^2+2x+1) dx
% \Arrow{linearity of integration}     \\
% & = \int_0^1 x^2 dx + 2 \int_0^1 x dx + \int_0^1 dx \\
% & = \frac13 + 2\frac12 + 1 \\
% & = \frac73
% \end{WithArrows}$
%
%
% \medskip
% The same example with the option |displaystyle|:\par\nobreak
%
% $\begin{WithArrows}[displaystyle]
% \int_0^1 (x+1)^2 dx 
% & = \int_0^1 (x^2+2x+1) dx
% \Arrow{linearity of integration}     \\
% & = \int_0^1 x^2 dx + 2 \int_0^1 x dx + \int_0^1 dx \\
% & = \frac13 + 2\frac12 + 1 \\
% & = \frac73
% \end{WithArrows}$
%
%
%
% \interitem 
% Almost all the options can also be set at the document level with the command
% |\WithArrowsOptions|. In this case, the scope of the declarations is the
% current TeX group (these declarations are ``semi-global''). For example, if we
% want all the environments |{WithArrows}| composed in |\displaystyle| with blue
% arrows, we can write
% |\WithArrowsOptions{displaystyle,tikz=blue}|.\footnote{It's also possible to
% configure \pkg{witharrows} by modifying the Tikz style |WithArrows/arrow|
% which is the style used by \pkg{witharrows} when drawing an arrow. For
% example, to have the labels in blue with roman (upright) types, one can use
% the following instruction: 
% |\tikzset{WithArrows/arrow/.append style = {blue,font = {}}}|.}
% 
% \begin{Verbatim}
% ~emphase#\WithArrowsOptions{displaystyle,tikz=blue}@
% $\begin{WithArrows}
% \sum_{i=1}^n (x_i+1)^2 
% & = \sum_{i=1}^n (x_i^2+2x_i+1) \Arrow{by linearity}\\
% & = \sum_{i=1}^n x_i^2 + 2\sum_{i=1}^nx_i+ n
% \end{WithArrows}$
% \end{Verbatim}
%
% \begin{scope}
% \WithArrowsOptions{displaystyle,tikz=blue}
% $\begin{WithArrows}
% \sum_{i=1}^n (x_i+1)^2 
% & = \sum_{i=1}^n (x_i^2+2x_i+1) \Arrow{by linearity}\\
% & = \sum_{i=1}^n x_i^2 + 2\sum_{i=1}^nx_i+ n
% \end{WithArrows}$
% \end{scope}
%
%
% \interitem
% The command |\Arrow| is recognized only in the environments |{WithArrows}|. If
% we have a command |\Arrow| previously defined, it's possible to go on using it
% outside the environments |{WithArrows}|.
%
% However, a previouly defined command |\Arrow| may still be useful in an
% environment |{WithArrows}|. If we want to use it in such an environment, it's
% possible to change the name of the command |\Arrow| of the package
% \pkg{witharrows}: there is an option |command-name|\footnote{For historical
% reasons, there is an alias for this option: |CommandName|.} for this purpose.
% The new name of the command must be given to the option \emph{without} the
% leading backslash.
% %
% \begin{Verbatim}
% \NewDocumentCommand {\Arrow} {} {\longmapsto}
% $\begin{WithArrows}[~emphase#command-name=Explanation@]
% f & = \bigl(x \Arrow (x+1)^2\bigr)
% ~emphase#\Explanation{we work directly on fonctions}@\\
% & = \bigl(x \Arrow x^2+2x+1\bigr)
% \end{WithArrows}$
% \end{Verbatim}
% %
% \begin{scope}
% \NewDocumentCommand {\Arrow} {} {\longmapsto}
% $\begin{WithArrows}[command-name=Explanation]
% f & = \bigl(x \Arrow (x+1)^2\bigr)
% \Explanation{we work directly on fonctions}\\
% & = \bigl(x \Arrow x^2+2x+1\bigr)
% \end{WithArrows}$
% \end{scope}
%
%
% \interitem 
% The environment |{WithArrows}| gives also two options |code-before| and
% |code-after|\footnote{For historical reasons, there are aliases for these
% options: |CodeBefore| and |CodeAfter|.} for LaTeX code that will be executed
% at the beginning and at the end of the environment. These options are not
% designed to be hooks (they are available only at the environment level and
% they do not apply to the nested environments).
% %
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#code-before = \color{blue}@]
% A & = (a+b)^2 \Arrow{we expand} \\
%   & = a^2 + 2ab + b^2 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}[code-before = \color{blue}]
% A & = (a+b)^2 \Arrow{we expand} \\
%   & = a^2 + 2ab + b^2 
% \end{WithArrows}$
% 
% \medskip 
% Special commands are available in |code-after|: a command |\WithArrowsNbLines|
% which gives the number of lines (=rows) of the current environment (this is a
% command and not a counter), a special form of the command |\Arrow| and the
% command |\MultiArrow|: these commands are described in the section concerning
% the nested environments, p.~\pageref{NestedEnv}.
%
% \section{Numbers of columns}
%
% So far, we have used the environment |{WithArrows}| with two columns. However,
% it's possible to use the environment with an arbitrary number of columns with
% the option |format|. The value given to this option is like the preamble of an
% environment |{array}|, that is to say a sequence of letters |r|, |c| and |l|.
% The default value of the option |format| is, in fact, |rl|.
%
% \bigskip
% For exemple, if we want only one column left-aligned, we use the option |format=l|.
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#format = l@]
% f(x) \ge g(x) \Arrow{by squaring both sides} \\
% f(x)^2 \ge g(x)^2 \Arrow{by moving to left side} \\
% f(x)^2 - g(x)^2 \ge 0 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}[format = l]
% f(x) \ge g(x) \Arrow{by squaring both sides} \\
% f(x)^2 \ge g(x)^2 \Arrow{by moving to left side} \\
% f(x)^2 - g(x)^2 \ge 0 
% \end{WithArrows}$
%
% \interitem
% In the following example, we use five columns all centered (the environment
% |{DispWithArrows*}| is  presented p.~\pageref{DispWithArrows}).
%
% \begin{Verbatim}
% \begin{DispWithArrows*}[~emphase#format = ccccc@,
%                         wrap-lines,
%                         tikz = {align = flush left},
%                         interline=1mm]
% k & \;\le\; & t & \;\le\; & k+1 \\
% \frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} 
% \Arrow{we can integrate the inequalities since $k \leq k+1$ } \\
% \int\limits_k^{k+1} \frac{\text{d} t}{k+1} 
% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{t} 
% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{k} \\
% \frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} 
% \end{DispWithArrows*}
% \end{Verbatim}
% \begin{DispWithArrows*}[format = ccccc,
%                         wrap-lines,
%                         tikz = {align = flush left},
%                         interline=1mm]
% k & \;\le\; & t & \;\le\; & k+1 \\
% \frac{1}{k+1} & \le & \frac{1}{t} & \le & \frac{1}{k} 
% \Arrow{we can integrate the inequalities since $k \leq k+1$ } \\
% \int\limits_k^{k+1} \frac{\text{d} t}{k+1} 
% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{t} 
% & \le & \int\limits_k^{k+1} \frac{\text{d} t}{k} \\
% \frac{1}{k+1} & \le & \ln(k+1)-\ln(k) & \le & \frac{1}{k} 
% \end{DispWithArrows*}
% 
%
% \section{Precise positioning of the arrows}
%
%
% The environment |{WithArrows}| defines, during the composition of the array,
% two series of nodes materialized in red in the following example.\footnote{The
% option |show-nodes| can be used to materialize the nodes. The nodes are in
% fact Tikz nodes of shape ``rectangle'', but with zero width. An arrow between
% two nodes starts at the \emph{south} anchor of the first node and arrives at
% the \emph{north} anchor of the second node.}
%
% \smallskip
% $\begin{WithArrows}[displaystyle,show-nodes]
% I
% & = \int_{\frac{\pi}4}^0 \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)(-d u) \\
% & = \int_0^{\frac{\pi}4} \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)d u \\
% & = \int_0^{\frac{\pi}4}\ln\left(1+\frac{1-\tan u}{1+\tan u}\right)\, d u \\
% & =\int_0^{\frac{\pi}4}\ln\left(\frac{1+\tan u+1-\tan u}{1+\tan u}\right) d u \\
% & =\int_0^{\frac{\pi}4} \ln\left(\frac2{1+\tan u}\right)\, d u\\
% & =\int_0^{\frac{\pi}4}\bigl(\ln2-\ln(1+\tan u)\bigr)\, d u \\
% & =\frac{\pi}4\ln2-\int_0^{\frac{\pi}4}\ln(1+\tan u)\, d u  \\
% & =\frac{\pi}4\ln2-I 
% \end{WithArrows}$
%
% \bigskip
% The nodes of the left are at the end of each line of text. These nodes will be
% called \emph{left nodes}. The nodes of the right side are aligned vertically
% on the right side of the array. These nodes will be called \emph{right nodes}.
%
% By default, the arrows use the right nodes. We will say that they are in |rr|
% mode ($r$ for \emph{right}). These arrows are |vertical| (we will say that an
% arrow is \emph{vertical} when its two ends have the same abscissa).
%
%
% \smallskip
% However, it's possible to use the left nodes, or a combination of left and
% right nodes, with one of the options |lr|, |rl| and |ll| ($l$ for
% \emph{left}). Those arrows are, usually, not vertical.
%
%
% Therefore
% $\begin{WithArrows}[displaystyle]
% I
% & = \int_{\frac{\pi}4}^0 \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)(-d u) 
% \Arrow[lr]{This arrow uses the |lr| option.}\\
% & = \int_0^{\frac{\pi}4} \ln\Bigl(1+\tan\left(\tfrac{\pi}4-u\right)\Bigr)d u \\
% & = \int_0^{\frac{\pi}4}\ln\left(1+\frac{1-\tan u}{1+\tan u}\right)\, d u \\
% & =\int_0^{\frac{\pi}4}\ln\left(\frac{1+\tan u+1-\tan u}{1+\tan u}\right) d u 
% \Arrow[ll,jump=2,tikz={text width = 5cm}]{This arrow uses a |ll| option
% and a |jump| equal to $2$}\\ 
% & =\int_0^{\frac{\pi}4} \ln\left(\frac2{1+\tan u}\right)\, d u\\
% & =\int_0^{\frac{\pi}4}\bigl(\ln2-\ln(1+\tan u)\bigr)\, d u \\
% & =\frac{\pi}4\ln2-\int_0^{\frac{\pi}4}\ln(1+\tan u)\, d u  \\
% & =\frac{\pi}4\ln2-I 
% \end{WithArrows}$
%
%
%
% \interitem
% There is also an option called |i| (\emph{i} for \emph{intermediate}). With
% this option, the arrow is vertical and at the leftmost position.
%
% \begin{Verbatim}
% $\begin{WithArrows}
% (a+b)(a+ib)(a-b)(a-ib) 
% & = (a+b)(a-b)\cdot(a+ib)(a-ib) \\
% & = (a^2-b^2)(a^2+b^2) \Arrow~emphase#[i]@{because $(x-y)(x+y)=x^2-y^2$}\\
% & = a^4-b^4 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% (a+b)(a+ib)(a-b)(a-ib) 
% & = (a+b)(a-b)\cdot(a+ib)(a-ib) \\
% & = (a^2-b^2)(a^2+b^2) \Arrow[i]{because $(x-y)(x+y)=x^2-y^2$}\\
% & = a^4-b^4 
% \end{WithArrows}$
%
%
% \interitem 
% The environment |{WithArrows}| gives also a |group| option. With this option,
% \emph{all} the arrows of the environment are grouped on a same vertical line
% and at a leftmost position.
% %
% \begin{Verbatim}[formatcom=\small\color{gray}]
% $\begin{WithArrows}[~emphase#displaystyle,group@]
% 2xy'-3y=\sqrt x
% & \Longleftrightarrow 2x(K'y_0+Ky_0')-3Ky_0 = \sqrt x \\
% & \Longleftrightarrow 2xK'y_0 + K(2xy_0'-3y_0) = \sqrt x \\
% & \Longleftrightarrow 2x K'y_0 = \sqrt x \Arrow{...}\\
% ...
% \end{WithArrows}$
% \end{Verbatim}
%
%
% $\begin{WithArrows}[displaystyle,group]
% 2xy'-3y=\sqrt x
% & \Longleftrightarrow 2x(K'y_0+Ky_0')-3Ky_0 = \sqrt x \\
% & \Longleftrightarrow 2xK'y_0 + K(2xy_0'-3y_0) = \sqrt x \\
% & \Longleftrightarrow 2x K'y_0 = \sqrt x \Arrow{we replace $y_0$ by its value}\\
% & \Longleftrightarrow 2xK'x^{\frac32} = x^{\frac12} \Arrow{simplification of the $x$}\\
% & \Longleftrightarrow K' = \tfrac1{2x^2} \Arrow{antiderivation}\\
% & \Longleftrightarrow K = -\tfrac1{2x} 
% \end{WithArrows}$
%
%
% \bigskip
% The environment |{WithArrows}| gives also a |groups| option (with a \emph{s}
% in the name). With this option, the arrows are divided into several
% ``groups''. Each group is a set of connected\footnote{More precisely: for each
% arrow $a$, we note $i(a)$ the number of its initial row and $f(a)$ the number
% of its final row; for two arrows $a$ and $b$, we say that $a \sim b$ when
% $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq
% \varnothing$; the groups are the equivalence classes of the transitive closure
% of $\sim$.} arrows. All the arrows of a given group are grouped on a same
% vertical line and at a leftmost position.
%
% \bigskip
% $\begin{WithArrows}[groups]
% A & = B \Arrow{one} \\
%   & = C+D \Arrow{two} \\
%   & = D' \\
%   & = E+F+G+H+I \\
%   & = K + L + M \Arrow{three}\\
%   & = N \Arrow{four}\\
%   & = O
% \end{WithArrows}$
%
% \bigskip 
% In an environment which uses the option |group| or the option |groups|, it's
% still possible to give an option of position (|ll|, |lr|, |rl|, |rr| or |i|)
% to an individual arrow. Such arrow will be drawn irrespective of the groups.
% It's also possible to start a new group by applying the option |new-group| to
% an given arrow.
% 
% \bigskip
% If desired, the option |group| or the option |groups| can be given to the
% command |\WithArrowsOptions| so that it will become the default value. In this
% case, it's still possible to come back to the default behaviour for a given
% environment |{WithArrows}| with the option |rr|: |\begin{WithArrows}[rr]|
%
%
% \vspace{1cm}
% In the following example, we have used the option |group| for the environment
% and the option |rr| for the last arrow (that's why the last arrow is not
% aligned with the others).
%
% $\begin{WithArrows}[interline=1mm,group]
% \sum\limits_{k=0}^n\frac{\cos kx}{\cos^k x}
% & = \sum\limits_{k=0}^n \frac{\Re (e^{ikx})}{(\cos x)^k} 
% \Arrow{$(\cos x)^k$ is real} \\
% & = \sum\limits_{k=0}^n \Re\left(\frac{e^{ikx}}{(\cos x)^k}\right)
% \Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\
% & = \Re \left(\sum\limits_{k=0}^n \left(\frac{e^{ix}}{\cos x}\right)^k\right)
% \Arrow{sum of terms of a geometric progression} \\
% & = \Re \left(\frac{1-\left(\frac{e^{ix}}{\cos x}\right)^{n+1}}{1-\frac{e^{ix}}{\cos x}} \right)
% \Arrow{algebraic calculation} \\
% & = \Re \left(\frac{1-\frac{e^{i(n+1)x}}{\cos^{n+1}x}}{1-\frac{e^{ix}}{\cos x}}\right)
% \Arrow{reduction to common denominator} \\
% & = \Re \left(\frac{\frac{\cos^{n+1}x-e^{i(n+1)x}}{\cos^{n+1}x}}{\frac{\cos x-e^{ix}}{\cos x}}\right)
% \Arrow{$\Re(kz) = k\cdot\Re(z)$ if $k$ is real} \\
% & = \frac1{\cos^n x}\Re \left(\frac{\cos^{n+1}x-e^{i(n+1)x}}{\cos x-e^{ix}}\right)
% \Arrow[rr]{algebraic form of the complexes} \\
% & =\frac1{\cos^n x}\Re\left(\frac{\cos^{n+1}x-(\cos(n+1)x+i\sin(n+1)x)}{\cos x-(\cos x+i\sin x)}\right) \\
% & =\frac1{\cos^n x}\Re\left(\frac{(\cos^{n+1}x-\cos(n+1)x)-i\sin(n+1)x}{-i\sin x}\right) \\
% & = \frac1{\cos^nx}\cdot\frac{\sin(n+1)x}{\sin x}
% \end{WithArrows}$
%
% \interitem
%
% \section[The options 'up' and 'down' for individual arrows]%
%     {The options ``up'' and ``down'' for individual arrows} 
%
% \label{up-and-down}
% At the local level, there are also two options for individuals arrows, called
% ``|up|'' and ``|down|''. The following example illustrates these types of
% arrows:
% 
% \begin{Verbatim}
% \(\begin{WithArrows}
% A & = B 
% \Arrow~emphase#[up]@{an arrow of type \texttt{up}} \\
%   & = C + C + C + C + C + C + C + C  \\
%   & = C + C + C + C + C + C + C + C  
% \Arrow~emphase#[down]@{an arrow of type \texttt{down}} \\
%   & = E + E 
% \end{WithArrows}\)
% \end{Verbatim}
% 
% \vspace{1cm}
% \(\begin{WithArrows}
% A & = B 
% \Arrow[up]{an arrow of type \texttt{up}} \\
%   & = C + C + C + C + C + C + C + C  \\
%   & = C + C + C + C + C + C + C + C  
% \Arrow[down]{an arrow of type \texttt{down}} \\
%   & = E + E 
% \end{WithArrows}\)
%
%
% \vspace{1cm}
% The options |up| and |down| require the package \pkg{varwidth} and the Tikz
% library \pkg{calc}. It they are not loaded, an error will be raised.
%
%
% \interitem
%
% \section{Comparison with the environment \{aligned\}}
%
% |{WithArrows}| bears similarities with the environment |{aligned}| of the
% extension \pkg{amsmath}. These are only similarities because |{WithArrows}|
% has not been written upon the environment |{aligned}|.\footnote{In fact, it's
% possible to use the package \pkg{witharrows} without the package
% \pkg{amsmath}.}
%
% \interitem
% As in the environments of \pkg{amsmath}, it's possible to change the spacing
% between two given rows with the option of the command |\\| of end of line
% (it's also possible to use |\\*| but it has exactly the same effect as |\\|
% since an environment |{WithArrows}| is always unbreakable). This option is
% designed to be used with positive values only.
% %
% \begin{Verbatim}
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{we expand} ~emphase#\\[2ex]@
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{we expand} \\*[2ex]
% \noalign{\vspace{3mm}}
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
%
% \interitem 
% In the environments of \pkg{amsmath} (or \pkg{mathtools}), the spacing between
% rows is fixed by a parameter called |\jot| (it's a dimension and not a skip).
% That's also the case for the environment |{WithArrows}|. An option |jot| has
% been given to the environment |{WithArrows}| in order to change the value of
% this parameter |\jot| for a given environment.\footnote{It's also possible to
% change |\jot| with the environment |{spreadlines}| of \pkg{mathtools}.}
% %
% \begin{Verbatim}
% $\begin{WithArrows}[displaystyle,~emphase#jot=2ex@]
% F & = \frac12G     \Arrow{we expand}\\
%   & = H + \frac12K \Arrow{we go on}\\
%   & = K 
% \end{WithArrows}$
% \end{Verbatim}
%
%
% $\begin{WithArrows}[displaystyle,jot=2ex]
% F & = \frac12G     \Arrow{we expand}\\
%   & = H + \frac12K \Arrow{we go on}\\
%   & = K 
% \end{WithArrows}$
%
%
% \bigskip
% However, this new value of |\jot| will also be used in other alignments
% included in the environment~|{WithArrows}|:
% %
% \begin{Verbatim}
% $\begin{WithArrows}[jot=2ex]
% \varphi(x,y) = 0  & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 
% \Arrow{$x$ and $y$ are real}\\
% & \Leftrightarrow \left\{
% \begin{aligned}
% x+y & = 0 \\
% x+2y & = 0 
% \end{aligned}
% \right.
% \end{WithArrows}$
% \end{Verbatim}
%
%
% $\begin{WithArrows}[jot=2ex]
% \varphi(x,y) = 0  & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 
% \Arrow{$x$ and $y$ are real}\\
% & \Leftrightarrow \left\{
% \begin{aligned}
% x+y & = 0 \\
% x+2y & = 0 
% \end{aligned}
% \right.
% \end{WithArrows}$
%
% \bigskip
% Maybe this doesn't correspond to the desired outcome. That's why an option
% |interline| is proposed. It's possible to use a skip (=glue) for this option.
% %
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#interline=2ex@]
% \varphi(x,y) = 0  & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 
% \Arrow{$x$ and $y$ are real}\\
% & \Leftrightarrow \left\{
% \begin{aligned}
% x+y & = 0 \\
% x+2y & = 0 \\
% \end{aligned}
% \right.
% \end{WithArrows}$
% \end{Verbatim}
%
%
% $\begin{WithArrows}[interline=2ex]
% \varphi(x,y) = 0  & \Leftrightarrow (x+y)^2 + (x+2y)^2 = 0 
% \Arrow{$x$ and $y$ are real}\\
% & \Leftrightarrow \left\{
% \begin{aligned}
% x+y & = 0 \\
% x+2y & = 0 \\
% \end{aligned}
% \right.
% \end{WithArrows}$
%
%
% \interitem
% Like the environment |{aligned}|, |{WithArrows}| has an option of placement
% which can assume the values |t|, |c| or |b|. However, the default value is not
% |c| but |t|. If desired, it's possible to have the |c| value as the default
% with the command |\WithArrowsOptions{c}| at the beginning of the document.
% %
% \begin{Verbatim}
% So\enskip
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
% \end{Verbatim}
%
% So\enskip 
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{WithArrows}$
%
% \bigskip
% The value |c| may be useful, for example, if we want to add curly braces:
%
% \smallskip
% \begin{Verbatim}
% On pose\enskip $~emphase#\left\{@
% \begin{WithArrows}[~emphase#c@]
% f(x) & = 3x^3+2x^2-x+4 
% \Arrow[tikz=-]{both are polynoms}\\
% g(x) & = 5x^2-5x+6
% \end{WithArrows}
% ~emphase#\right.@$
% \end{Verbatim}
%
%
% On pose\enskip $\left\{
% \begin{WithArrows}[c]
% f(x) & = 3x^3+2x^2-x+4 
% \Arrow[tikz=-]{both are polynoms}\\
% g(x) & = 5x^2-5x+6
% \end{WithArrows}
% \right.$
%
%
% \interitem
% Unlike |{aligned}|, the environment |{WithArrows}| uses |\textstyle| by
% default.
%
% Once again, it's possible to change this behaviour with |\WithArrowsOptions|:
%
% \quad |\WithArrowsOptions{displaystyle}|.
%
%
% \smallskip
% The following example is composed with |{aligned}|:\par\nobreak
%
% \smallskip
% $\left\{
% \begin{aligned}
% \sum_{i=1}^n (x_i+1)^2  
% & = \sum_{i=1}^n (x_i^2 + 2x_i+1) \\
% & = \sum_{i=1}^n x_i^2 + 2 \sum_{i=1}^nx_i + n 
% \end{aligned}
% \right.$
%
%
% \medskip 
% The following is composed with |{WithArrows}[c,displaystyle]|. The results are
% strictly identical.\footnote{In versions of \pkg{amsmath} older than the
% 5~nov.~2016, a thin space was added on the left of an environment |{aligned}|.
% The new versions do not add this space and neither do
% |{WithArrows}|.}\par\nobreak
%
% \smallskip
% $\left\{
% \begin{WithArrows}[c,displaystyle]
% \sum_{i=1}^n (x_i+1)^2 
% & = \sum_{i=1}^n (x_i^2 + 2x_i+1) \\
% & = \sum_{i=1}^n x_i^2 + 2 \sum_{i=1}^nx_i + n 
% \end{WithArrows}
% \right.$
%
%
% \section{Arrows in nested environments}
%
% \label{NestedEnv}
%
% The environments |{WithArrows}| can be nested. In this case, the options given
% to the encompassing environment applies also to the inner ones (with logical
% exceptions for |interline|, |code-before| and |code-after|). The command |Arrow|
% can be used as usual in each environment |{WithArrows}|.
% 
% \begin{Verbatim}[formatcom=\small\color{gray}]
% $~emphase#\begin{WithArrows}@
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \Arrow{the numbers are real}\\
%   & \Leftrightarrow
%   \left\{~emphase#\begin{WithArrows}@[c]
%   x+2y & = 0 \\
%   2x+4y & = 0 
%   ~emphase#\end{WithArrows}@\right. \\
%   & \Leftrightarrow
%   \left\{~emphase#\begin{WithArrows}@[c]
%   x+2y & = 0 \Arrow[tikz=-]{the same equation}\\
%   x+2y & = 0 
%   ~emphase#\end{WithArrows}@\right. \\
%   & \Leftrightarrow x+2y=0 
% ~emphase#\end{WithArrows}@$
% \end{Verbatim}
%
% $\begin{WithArrows}
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \Arrow{the numbers are real}\\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   2x+4y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \Arrow[tikz=-]{the same equation}\\
%   x+2y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow x+2y=0 
% \end{WithArrows}$
%
% \bigskip
% However, one may want to draw an arrow between rows that are not in the same
% environment. For example, one may want to draw the following arrow :
%
% \bigskip
% $\begin{WithArrows}[code-after = \Arrow[v]{1-2}{2-2}{division by $2$} ]
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   2x+4y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   x+2y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow x+2y=0 
% \end{WithArrows}$
%
%
% \bigskip
% Such a construction is possible by using |\Arrow| in the |code-after| option.
% Indeed, in |code-after|, a special version of |\Arrow| is available (we will
% call it ``|\Arrow| in |code-after|'').
%
% \smallskip
% A command |\Arrow| in |code-after| takes three arguments :
% \begin{itemize}
% \item a specification of the start row of the arrow ;
% \item a specification of the end row of the arrow ;
% \item the label of the arrow.
% \end{itemize}
% As usual, it's also possible to give options within square brackets before or
% after the three arguments. However, these options are limited (see below).
% 
% \bigskip
% The specification of the row is constructed with the position of the concerned
% environment in the nesting tree, followed (after an hyphen) by the number of
% the row.
%
% \bigskip
% In the previous example, there are two environments |{WithArrows}| nested in
% the main environment |{WithArrows}|.
%
% $\begin{WithArrows}[tikz-code = {\path (#1) to node {#3} (#2) ; }]
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
%   & \Leftrightarrow \color{blue}
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \Arrow{environment number 1}\\
%   2x+4y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow \color{red}
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \Arrow{environment number 2}\\
%   x+2y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow x+2y=0 
% \end{WithArrows}$
%
% \bigskip
% The arrow we want to draw starts in the row~$2$ of the sub-environment
% number~$1$ (and therefore, the specification is |1-2|) and ends in the row~$2$
% of the sub-environment number~$2$ (and therefore, the specification is |2-2|).
% We can draw the arrow with the following command |\Arrow| in |code-after| :
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#code-after = \Arrow{1-2}{2-2}{division by $2$}@ ]
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
% .........
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}[code-after = \Arrow{1-2}{2-2}{division by $2$} ]
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   2x+4y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   x+2y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow x+2y=0 
% \end{WithArrows}$
% 
% \bigskip
% The options allowed for a command |\Arrow| in |code-after| are : |ll|, |lr|,
% |rl|, |rr|, |v|, |xoffset|, |tikz| and |tikz-code|. Except |v|, which is
% specific to |\Arrow| in |code-after|, all these options have their usual
% meaning.
%
% With the option |v|, the arrow drawn is vertical to an abscissa computed with
% the start row and the end row only : the intermediate lines are not taken into
% account unlike with the option |i|. Currently, the option |i| is not available
% for the command~|\Arrow| in |code-after|. However, it's always possible to
% translate an arrow with |xoffset| (or |xshift| of Tikz).
% \begin{Verbatim}
% $\begin{WithArrows}[code-after=\Arrow~emphase#[v]@{1-2}{2-2}{division by $2$}]
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
% .........
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}[code-after = \Arrow[v]{1-2}{2-2}{division by $2$} ]
% \varphi(x,y)=0
%   & \Leftrightarrow (x+2y)^2+(2x+4y)^2 = 0 \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   2x+4y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow
%   \left\{\begin{WithArrows}[c]
%   x+2y & = 0 \\
%   x+2y & = 0 
%   \end{WithArrows}\right. \\
%   & \Leftrightarrow x+2y=0 
% \end{WithArrows}$
%
%  
% \interitem
% The package \pkg{witharrows} gives also another command available only in
% |code-after|: the command |\MultiArrow|. This command draws a ``rak''. The list
% of the rows of the environment concerned by this rak are given in the first
% argument of the command |\MultiArrow|. This list is given with the syntax of
% the list in a |\foreach| command of \pkg{pgffor}.
%
%
% \begin{Verbatim}
% $\begin{WithArrows}[tikz = rounded corners,
%                     code-after = {~emphase#\MultiArrow{1,...,4}{text}@} ]
% A & = B \\
%   & = C \\
%   & = D \\
%   & = E \\
%   & = F
% \end{WithArrows}$
% \end{Verbatim}
% 
% 
% $\begin{WithArrows}[tikz = rounded corners,
%                     code-after = {\MultiArrow{1,...,4}{text}}]
% A & = B \\
%   & = C \\
%   & = D \\
%   & = E \\
%   & = F
% \end{WithArrows}$
%
% \medskip
% As of now, there is no option available for the command |\MultiArrow| (maybe
% in a future release).
% 
% 
% \bigskip
% \section{Arrows from outside environments \{WithArrows\}}
%
% If someone wants to draw arrows from outside the environments |{WithArrows}|,
% he can use the Tikz nodes created in the environments.
% 
% The Tikz name of a node created by \pkg{witharrows} is prefixed by |wa-|.
% Then, we have a list of numbers which give the position in the nesting tree
% and the row number in the environment. At the end, we have the suffixe |l| for
% a ``left node'' and |r| for a ``right node''.
% 
% \smallskip
% For illustrative purposes, we give an example of nested environments
% |{WithArrows}|, and, for each ``right node'', the name of that
% node.\footnote{There is an option |show-node-names| to show the names of these
% nodes.}
% 
% \medskip
% \[\begin{WithArrows}[show-nodes,show-node-names]
% A & \vartriangleleft B+B+B+B+B+B+B+B+B+B+B+B+B \\
% & \vartriangleleft \left\{
% \begin{WithArrows}[c]
% C & \vartriangleleft D \\
% E & \vartriangleleft F 
% \end{WithArrows}
% \right. \\
%  & \vartriangleleft 
% \left\{
% \begin{WithArrows}[c]
% G & \vartriangleleft H+H+H+H+H+H+H \\
% I & \vartriangleleft 
% \left\{
% \begin{WithArrows}
% J &\vartriangleleft K \\
% L &\vartriangleleft M 
% \end{WithArrows}
% \right.
% \end{WithArrows}
% \right. \\
%  & \vartriangleleft 
% \left\{
% \begin{WithArrows}[c]
% N & \vartriangleleft O \\
% P & \vartriangleleft Q 
% \end{WithArrows}
% \right.
% \end{WithArrows}\]
%
% \medskip
% The package \pkg{witharrows} provides some tools facilitating the use of these
% nodes:
% \begin{itemize}
% \item the command |\WithArrowsLastEnv| gives the number of the last
% environment of level~$0$;
%
% \item a name can be given to a given environment with the option |name| and,
% in this case, the nodes created in the environment will have aliases
% constructed with this name;
%
% \item the Tikz style |WithArrows/arrow| is the style used by \pkg{witharrows}
% when drawing an arrow\footnote{More precisely, this style is given to the Tikz
% option ``|every path|'' before drawing the arrow with the code of the option
% |tikz-code|. This style is modified (in TeX scopes) by the option |tikz| of
% \pkg{witharrows}.};
%
% \item the Tikz style |WithArrows/arrow/tips| is the style for the tip of the
% arrow (loaded by |WithArrows/arrow|).
% \end{itemize}
%
% For example, we can draw an arrow from \texttt{wa-\WithArrowsLastEnv-2-1-2-r.south}
% to \texttt{wa-\WithArrowsLastEnv-3-2-r.north} with the following Tikz command. 
%
% \begin{Verbatim}
% \begin{tikzpicture}[remember picture,overlay]
% \draw [WithArrows/arrow] 
%       ([xshift=3mm]wa-\WithArrowsLastEnv-2-1-2-r.south)
%    to ([xshift=3mm]wa-\WithArrowsLastEnv-3-2-r.north) ;
% \end{tikzpicture}
% \end{Verbatim}
%
% \[\begin{WithArrows}
% A & \vartriangleleft B+B+B+B+B+B+B+B+B+B+B+B+B \\
% & \vartriangleleft \left\{
% \begin{WithArrows}[c]
% C & \vartriangleleft D \\
% E & \vartriangleleft F 
% \end{WithArrows}
% \right. \\
%  & \vartriangleleft 
% \left\{
% \begin{WithArrows}[c]
% G & \vartriangleleft H+H+H+H+H+H+H \\
% I & \vartriangleleft 
% \left\{
% \begin{WithArrows}
% J &\vartriangleleft K \\
% L &\vartriangleleft M 
% \end{WithArrows}
% \right.
% \end{WithArrows}
% \right. \\
%  & \vartriangleleft 
% \left\{
% \begin{WithArrows}[c]
% N & \vartriangleleft O \\
% P & \vartriangleleft Q 
% \end{WithArrows}
% \right.
% \end{WithArrows}\]
%
% \begin{tikzpicture}[remember picture,overlay]
% \draw [WithArrows/arrow] 
%       ([xshift=3mm]wa-\WithArrowsLastEnv-2-1-2-r.south)
%    to ([xshift=3mm]wa-\WithArrowsLastEnv-3-2-r.north) ;
% \end{tikzpicture}
%
% \medskip
% In this case, it would be easier to use a command |\Arrow| in |code-after| but
% this is an example to explain how the Tikz nodes created by \pkg{witharrows}
% can be used.
% 
% \bigskip
% In the following example, we create two environments |{WithArrows}| named
% ``|first|'' and ``|second|'' and we draw a line between a node of the first
% and a node of the second.
%
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#name=first@]
% A & = B \\
%   & = C 
% \end{WithArrows}$
%
% \bigskip
% $\begin{WithArrows}[~emphase#name=second@]
% A' & = B' \\
%    & = C'
% \end{WithArrows}$
%
% \begin{tikzpicture}[remember picture,overlay]
% \draw [WithArrows/arrow] 
%       ([xshift=3mm]~emphase#first@-1-r.south)
%    to ([xshift=3mm]~emphase#second@-1-r.north) ;
% \end{tikzpicture}
% \end{Verbatim}
% 
%
% \begin{center}
% $\begin{WithArrows}[name=first]
% A & = B \\
%   & = C 
% \end{WithArrows}$
% 
% \bigskip
% $\begin{WithArrows}[name=second]
% A' & = B' \\
%    & = C' 
% \end{WithArrows}$
% \end{center}
%
% \begin{tikzpicture}[remember picture,overlay]
% \draw [WithArrows/arrow] 
%       ([xshift=3mm]first-1-r.south)
%    to ([xshift=3mm]second-1-r.north) ;
% \end{tikzpicture}
% 
% \section{The environment \{DispWithArrows\}}
% \label{DispWithArrows}
% 
% As previously said, the environment |{WithArrows}| bears similarities with the
% environment |{aligned}| of |amsmath| (and |mathtools|). This extension also
% provides an environment |{DispWithArrows}| which is similar to the
% environments |{align}| and |{flalign}| of |amsmath|.
%
% \medskip
% The environment |{DispWithArrows}| must be used \emph{outside} math mode. Like
% |{align}|, it should be used in horizontal mode.
% \begin{Verbatim}
% \begin{~emphase#DispWithArrows@}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{~emphase#DispWithArrows@}
% \end{Verbatim}
% \begin{DispWithArrows}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{DispWithArrows}
%
% \medskip
% It's possible to use the command |\notag| (or |\nonumber|) to suppress a tag. 
% 
% It's possible to use the command |\tag| to put a special tag (e.g. $\star$).
%
% It's also possible to put a label to the line of an equation with the command
% |\label|.
% 
% These commands must be in the second column of the environment.
% \begin{Verbatim}
% \begin{DispWithArrows}
% A & = (a+1)^2 \Arrow{we expand} ~emphase#\notag@ \\
%   & = a^2 + 2a + 1 ~emphase#\tag{$\star$} \label{my-equation}@
% \end{DispWithArrows}
% \end{Verbatim}
% \begin{DispWithArrows}
% A & = (a+1)^2 \Arrow{we expand} \notag \\
%   & = a^2 + 2a + 1 \tag{$\star$} \label{my-equation}
% \end{DispWithArrows}
% A link to the equation \eqref{my-equation}. This link has been composed with
% |\eqref{my-equation}| (the command |\eqref| is a command of \pkg{amsmath}).
% 
% \medskip
% If \pkg{amsmath} (or \pkg{mathtools}) is loaded, it's also possible to use
% |\tag*| which, as in \pkg{amsmath}, typesets the tag without the parenthesis.
% For example, it's possible to use it to put the symbol |\square| of
% \pkg{amssymb}. This symbol is often used to mark the end of a
% proof.\footnote{Notice that the environment |{DispWithArrows}| is compatible
% with the command |\qedhere| of \pkg{amsthm}.}
% \begin{Verbatim}
% \begin{DispWithArrows}
% A & = (a+1)^2 \Arrow{we expand} \notag \\
%   & = a^2 + 2a + 1 ~emphase#\tag*{$\square$}@
% \end{DispWithArrows}
% \end{Verbatim}
% \begin{DispWithArrows}
% A & = (a+1)^2 \Arrow{we expand} \notag \\
%   & = a^2 + 2a + 1 \tag*{$\square$} 
% \end{DispWithArrows}
%
% \medskip
% It's also possible to suppress all the autogenerated numbers with the boolean
% option |notag| (or |nonumber|), at the global or environment level. There is
% also an environment |{DispWithArrows*}| which suppresses all these
% numbers.\footnote{Even in this case, it's possible to put a ``manual tag''
% with the command |\tag|.}
% \begin{Verbatim}
% \begin{~emphase#DispWithArrows*@}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{~emphase#DispWithArrows*@}
% \end{Verbatim}
% \begin{DispWithArrows*}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{DispWithArrows*}
%
% \medskip
% In fact, there is also another option |tagged-lines| which can be used to
% control the lines that will be tagged. The value of this option is a list of
% the numbers of the lines that must to be tagged. For example, with the option
% |tagged-lines = {first,3,last}|, only the first, the third and the last line
% of the environment will be tagged. There is also the special value |all| which
% means that all the lines will be tagged.
% \begin{Verbatim}
% \begin{DispWithArrows}[~emphase#tagged-lines = last@]
% A & = A_1 \Arrow{first stage} \\
%   & = A_2 \Arrow{second stage} \\
%   & = A_3 
% \end{DispWithArrows}
% \end{Verbatim}
% \begin{DispWithArrows}[tagged-lines = last]
% A & = A_1 \Arrow{first stage} \\
%   & = A_2 \Arrow{second stage} \\
%   & = A_3 
% \end{DispWithArrows}
%
% \bigskip
% With the option |fleqn|, the environment is composed flush left (in a way
% similar to the option |fleqn| of the standard classes of LaTeX). In this case,
% the left margin can be controlled with the option |mathindent| (with a name
% inspired by the parameter |\mathindent| of standard LaTeX). The default value
% of this parameter is 25~pt.
%
% \begin{Verbatim}
% \begin{DispWithArrows}[~emphase#fleqn,mathindent = 1cm@]
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{DispWithArrows}
% \end{Verbatim}
% \begin{DispWithArrows}[fleqn,mathindent = 1cm]
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1 
% \end{DispWithArrows}
%
% \medskip
% \emph{Remark} : By design, the option |fleqn| of \pkg{witharrows} is
% independent of the option |fleqn| of LaTeX. Indeed, since the environments of
% \pkg{witharrows} are meant to be used with arrows on the right side, the user
% may want to use \pkg{witharrows} with the option |fleqn| (in order to have
% more space on the right of the equations for the arrows) while still centering
% the classical equations.
%
% \bigskip
% If the package \pkg{amsmath} is loaded, it's possible to use the environment
% |{subequations}| and the command |\intertext| in the environments
% |{DispWithArrows}| and |{DispWithArrows*}| (and even the |\intertext| of
% \pkg{nccmath} if this package is loaded).
%
% If the option |leqno| is used as a class option, the labels will be composed
% on the left also for the environments |{DispWithArrows}| and
% |{DispWithArrows*}|.\footnote{The package \pkg{amsmath} has an option |leqno|
% but \pkg{witharrows}, of course, is not aware of that option: \pkg{witharrows}
% only checks the option |leqno| of the document class.}
%
% \bigskip
% If there is not enough space to put the tag at the end of a line, there is no
% automatic positioning of the label on the next line (as in the environments of
% \pkg{amsmath}). However, in |{DispWithArrows}|, the user can use the command
% |\tagnextline| to manually require the composition of the tag on the following
% line.
% \begin{Verbatim}
% \begin{DispWithArrows}[displaystyle]
% S_{2(p+1)}
% & =\sum_{k=1}^{2(p+1)} (-1)^k k^2 \\
% & \smash[b]{=\sum_{k=1}^{2p}(-1)^kk²
%    +(-1)^{2p+1}(2p+1)^2+(-1)^{2p+2}(2p+2)^2} ~emphase#\tagnextline@ \\
% &= S_{2p}-(2p+1)^2+(2p+2)^2\\
% &=p(2p+1)-(2p+1)^2+(2p+2)^2\\
% &= 2p^2+5p+3 
% \end{DispWithArrows}
% \end{Verbatim}
% \begin{center}
% \color{gray}\vrule%
% \begin{minipage}{275pt}\color{black}
% \begin{DispWithArrows}[displaystyle]
% S_{2(p+1)}
% & =\sum_{k=1}^{2(p+1)} (-1)^k k^2 \\
% & \smash[b]{=\sum_{k=1}^{2p}(-1)^kk^2+(-1)^{2p+1}(2p+1)^2+(-1)^{2p+2}(2p+2)^2}
% \tagnextline \\ 
% &= S_{2p}-(2p+1)^2+(2p+2)^2\\
% &= 2p^2+p-4p^2-4p-1+4p^2+8p+4\\
% &= 2p^2+5p+3 
% \end{DispWithArrows}
% \end{minipage}%
% \color{gray}\vrule
% \end{center}
% 
%
%
% \bigskip
% The environments |{DispWithArrows}| and |{DispWithArrows*}| provide an option
% |wrap-lines|. With this option, the lines of the label are automatically
% wrapped on the right.\footnote{It's possible to avoid the hyphenations of the
% words with the option ``|align = flush left|'' of Tikz.}\label{wrap-lines}
%
% \begin{Verbatim}
% \begin{DispWithArrows*}[displaystyle,~emphase#wrap-lines@]
% S_n
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\
% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}
%                             {1-e^{i\frac{\pi}{2n}}}\right)
% \Arrow{This line has been wrapped automatically.} \\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) 
% \end{DispWithArrows*}
% \end{Verbatim}
% \begin{DispWithArrows*}[displaystyle,wrap-lines]
% S_n
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\
% & = \frac1n \Re \left(
% \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}} \right) 
% \Arrow{This line has been wrapped automatically.} \\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) 
% \end{DispWithArrows*}
% 
% \bigskip
% The option |wrap-lines| doesn't apply to the environments |{WithArrows}|
% nested in an environment |{DispWithArrows}| or |{DispWithArrows*}|. However,
% it applies to the instructions |\Arrow| and |\MultiArrow| of the |code-after|
% of the environments |{DispWithArrows}| or |{DispWithArrows*}|.
% 
% \vspace{1cm}
% We have said that the environments |{DispWithArrows}| and |{DispWithArrows*}|
% should be used in horizontal mode and not in vertical mode. However, there is
% an exception. These environments can be used directly after a |\item| of a
% LaTeX list. In this case, no vertical space is added before the
% environment.\footnote{It's possible to disable this feature with the option |standard-behaviour-with-items|.}
%
% \medskip
% Here is an example. The use of |{DispWithArrows}| gives the ability to tag an
% equation (and also to use |wrap-lines|).
%
% \begin{Verbatim}
% ~emphase#\begin{enumerate}@
% ~emphase#\item @
% \begin{DispWithArrows}%
%   [displaystyle, wrap-lines, tagged-lines = last, fleqn, mathindent = 0 pt]
% S_n
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{we use the formula for a sum of terms of a geometric progression of
% ratio $e^{i\frac{2\pi}n}$}\\ 
% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}
%                             {1-e^{i\frac{\pi}{2n}}}\right)
% \Arrow{$\bigl(e^{i\frac{\pi}{2n}}\bigr)^n = e^{i\frac{\pi}2}=i$} \\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) 
% \end{DispWithArrows}
% ~emphase#\end{enumerate}@
% \end{Verbatim}
% \begin{enumerate}
% \item 
% \begin{DispWithArrows}[displaystyle, wrap-lines, tagged-lines = last, fleqn, mathindent = 0 pt]
% S_n
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{we use the formula for a sum of terms of a geometric progression of
% ratio $e^{i\frac{2\pi}n}$}\\ 
% & = \frac1n \Re \left(
% \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}} \right) 
% \Arrow{$\bigl(e^{i\frac{\pi}{2n}}\bigr)^n = e^{i\frac{\pi}2}=i$} \\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) 
% \end{DispWithArrows}
% \end{enumerate}
% 
% \vspace{1cm}
% The environment |{DispWithArrows}| is similar to the environment |{align}| of
% \pkg{amsmath}. However, |{DispWithArrows}| is not constructed upon |{align}|
% (in fact, it's possible to use \pkg{witharrows} without \pkg{amsmath}).
%
% There are differences between |{DispWithArrows}| and |{align}|. 
% \begin{itemize}
% \item The environment |{DispWithArrows}| cannot be inserted in an environment
% |{gather}| of \pkg{amsmath}.
% \item An environment |{DispWithArrows}| is always unbreakable (even with
% |\allowdisplaybreaks| of \pkg{amsmath}).
% \item The commands |\label|, |\tag|, |\notag| and |\nonumber| are allowed only
% in the last column.
% \item After an |\item| of a LaTeX list, no vertical space is added (this can
% be changed with the option |standard-behaviour-with-items|).
% \item 
% \begin{bfseries}
% Last but not least, by default, the elements of a |\{DispWithArrows\}|
% are composed in |textstyle| and not in |displaystyle| (it's possible to change
% this point with the option |displaystyle|). 
% \end{bfseries}
% \end{itemize}
% 
% \bigskip 
% Concerning the references, the package \pkg{witharrows} is compatible with the
% extensions \pkg{autonum}, \pkg{cleveref}, \pkg{fancyref}, \pkg{fncylab},
% \pkg{hyperref}, \pkg{listlbls}, \pkg{prettyref}, \pkg{refcheck},
% \pkg{refstyle}, \pkg{showlabels}, \pkg{smartref}, \pkg{typedref} and
% \pkg{varioref}, and with the options |showonlyrefs| and |showmanualtags| of
% \pkg{mathtools}.\footnote{We recall that \pkg{varioref}, \pkg{hyperref},
% \pkg{cleveref} and \pkg{autonum} must be loaded in this order. The package
% \pkg{witharrows} can be loaded anywhere.}
%
% It is not compatible with \pkg{showkeys} (not all the labels are shown).
%
% 
% \section{Advanced features}
%
%
% \subsection{The option tikz-code : how to change the shape of the arrows}
%
% \label{tikz-code}
%
% The option |tikz-code|\footnote{For historical reasons, the option |tikz-code|
% has an alias: |TikzCode|.} allows the user to change the shape of the 
% arrows.\footnote{If the option |wrap-lines| is used in an environment
% |{DispWithArrows}| or |{DispWithArrows*}|, the option |tikz-code| will have no
% effect for the arrows of this environment but only for the arrows in the
% nested environments |{WithArrows}|.}
%
% \smallskip
% For example, the options ``|up|'' and ``|down|'' described previously (cf.
% p.~\pageref{up-and-down}) are programmed internally with |tikz-code|.
% 
% \smallskip
% The value of this option must be a valid Tikz drawing instruction (with the
% final semicolon) with three markers |#1|, |#2| and |#3| for the start point,
% the end point and the label of the arrow.
%
% \bigskip
% By default, the value is the following:
% 
% \smallskip
% \qquad \verb|\draw (#1) to node {#3} (#2) ;|
%
%
% \bigskip
% In the following example, we replace this default path by a path with three
% segments (and the node overwriting the second segment).
% \begin{Verbatim}
% \begin{WithArrows}[format=c,ygap=5pt,interline=4mm,
%       ~emphase#tikz-code = {\draw[rounded corners]@
%       ~emphase#                  (~#1) -- ([xshift=5mm]~#1)@
%       ~emphase#                  -- node[circle,@
%       ~emphase#                          draw,@
%       ~emphase#                          auto = false,@
%       ~emphase#                          fill = gray!50,@
%       ~emphase#                          inner sep = 1pt] {\tiny ~#3}@ 
%       ~emphase#                  ([xshift=5mm]~#2)@
%       ~emphase#                  -- (~#2) ; }@]
% 3 (2x+4) = 6   \Arrow{$\div 3$} \\
% 2x+4 = 2       \Arrow{$-4$}     \\
% 2x = -2        \Arrow{$\div 2$} \\
%  x = -1
% \end{WithArrows}
% \end{Verbatim}
%
% 
% \[\begin{WithArrows}[format=c,
%       ygap=5pt,
%       interline=4mm,
%       tikz-code = {\draw[rounded corners]
%                         (#1) 
%                         --
%                         ([xshift=5mm]#1)
%                         -- node[circle,
%                                 draw,
%                                 auto=false,
%                                 fill=gray!50,
%                                 inner sep = 1pt] {\tiny #3} 
%                         ([xshift=5mm]#2)
%                         --
%                         (#2) ; }]
% 3 (2x+4) = 6   \Arrow{$\div 3$} \\
% 2x+4 = 2       \Arrow{$-4$}     \\
% 2x = -2        \Arrow{$\div 2$} \\
%  x = -1
% \end{WithArrows}\]
%
% \bigskip
% The environments |{DispWithArrows}| and its starred version
% |{DispWithArrows*}| provide a command |\WithArrowsRightX| which can be used in
% a definition of |tikz-code|. This command gives the $x$-value of the right side
% of the composition box (taking into account the eventual tags of the
% equations). For an example of use, see p.~\pageref{example-WithArrowsRightX}.
%
%
% \bigskip
% \subsection{The command \textbackslash WithArrowsNewStyle}
%
% The extension \pkg{witharrows} provides a command |\WithArrowsNewStyle| to
% define styles in a way similar to the ``styles'' of Tikz.
%
% The command |\WithArrowsNewStyle| takes two mandatory arguments. The first is
% the name of the style and the second is a list of key-value pairs. The scope
% of the definition done by |\WithArrowsNewStyle| is the current TeX scope.
%
% The style can be used as a key at the document level (with
% |\WithArrowsOptions|) or at the environment level (in the optional arguments
% of |{WithArrows}| and |{DispWithArrows}|). The style can also be used in
% another command |\WithArrowsNewStyle|.
%
% For an example of use, see p.~\pageref{example-WithArrowsRightX}.
%
%
% \bigskip
% \subsection{Vertical positioning of the arrows}
% 
% There are four parameters for fine tuning of the vertical positioning of the
% arrows : |ygap|, |ystart|, |start-adjust| and |end-adjust|.
% 
% \medskip
% We first explain the behaviour when the parameters |start-adjust| and
% |end-adjust| are equal to zero:
% \begin{itemize}
% \item the option |ystart| sets the vertical distance between the base line of
% the text and the start of the arrow (default value: 0.4 ex);
% \item the option |ygap| sets the vertical distance between two consecutive
% arrows (default value: 0.4~ex).
% \end{itemize}
%
%
% \bigskip
% $\begin{WithArrows}[interline=1mm, adjust = 0pt]
%  (\cos x + \sin x)^2 & = \cos^2 x +2 \cos x \sin x + \sin^2 x\Arrow{}\tikz[remember picture] \coordinate (A) ; \\
%    & = \cos^2x + \sin^2x + 2\sin x\cos x \Arrow{} \\
%    & = 1 + \sin(2x) 
% \end{WithArrows}$
%
% \begin{tikzpicture}[remember picture,overlay,blue]
% \draw (wa-\WithArrowsLastEnv-1-r.south) to ++(1,0) coordinate (B) to ++(0.1,0) ;;
% \draw (A) to ++(1,0) coordinate (C) to ++(0.1,0) ;;
% \draw (B) -- (C) ;
% \draw[<-] (B) to ++(0,0.2) ;
% \draw[<-] (C) to ++(0,-0.2) ;
% \path (C) node[right=1mm] {|ystart|} ;
% \draw (wa-\WithArrowsLastEnv-2-r.north) to ++(3,0) coordinate (E) to ++(0.1,0);
% \draw (wa-\WithArrowsLastEnv-2-r.south) to ++(3,0) coordinate (F) to ++(0.1,0);
% \draw (E) -- (F) ;
% \draw[<-] (E) to ++(0,0.2) ;
% \draw[<-] (F) to ++(0,-0.2) ;
% \path (F) node[right=1mm] {|ygap|} ;
% \end{tikzpicture}
%
% \interitem 
% However, for aesthetic reasons, when it's possible, \pkg{witharrows} starts
% the arrow a bit higher (by an amount |start-adjust|) and ends the arrow a bit
% lower (by an amount |end-adjust|). By default, both parameters |start-adjust|
% and |end-adjust| are equal to $0.4$~ex.
%
% \bigskip
% Here is for example the behaviour without the mechanism of |start-adjust| and
% |end-adjust| (this was the standard behaviour for versions prior to 1.13).
% % \begin{Verbatim}
% $\begin{WithArrows}~emphase#[start-adjust=0pt, end-adjust=0pt]@
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1  
% \end{WithArrows}$
% \end{Verbatim}
%
% $\begin{WithArrows}[start-adjust=0pt, end-adjust=0pt]
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1  
% \end{WithArrows}$
%
%
% \bigskip
% Here is the standard behaviour since version 1.13 (the parameters
% |start-adjust| and |end-ajust| are used with the default value $0.4$~ex). The
% arrow is longer and the result is more aesthetic.
% 
% \medskip
% $\begin{WithArrows}
% A & = (a+1)^2 \Arrow{we expand} \\
%   & = a^2 + 2a + 1  
% \end{WithArrows}$
%
%
% \bigskip
% It's also possible to use the option |adjust| which sets both |start-adjust|
% and |end-ajust|.
%
% \bigskip
% Since the mechanism of |start-adjust| and |end-ajust| has been added in
% version 1.13 of \pkg{witharrows}, that version is not stricty compatible with
% older versions. However, it's possible to restore the previous behaviour
% simply by setting |start-adjust| and |end-adjust| to $0$~pt:
% \begin{Verbatim}
% \WithArrowsOptions{adjust = 0pt}
% \end{Verbatim}
% 
% \bigskip
% \subsection{Footnotes in the environments of witharrows}
% 
% If you want to put footnotes in an environment |{WithArrows}| or
% |{DispWithArrows}|, you can use a pair |\footnotemark|--|\footnotetext|.
%
% \smallskip
% It's also possible to extract the footnotes with the help of the package
% \pkg{footnote} or the package \pkg{footnotehyper}.
%
% \smallskip
% If \pkg{witharrows} is loaded with the option |footnote| (with
% |\usepackage[footnote]{witharrows}| or with |\PassOptionsToPackage|), the
% package \pkg{footnote} is loaded (if it is not yet loaded) and it is used to
% extract the footnotes.
%
% \smallskip
% If \pkg{witharrows} is loaded with the option |footnotehyper|, the package
% \pkg{footnotehyper} is loaded (if it is not yet loaded) ant it is used to
% extract footnotes.
%
% \smallskip
% Caution: The packages \pkg{footnote} and \pkg{footnotehyper} are incompatible.
% The package \pkg{footnotehyper} is the successor of the package \pkg{footnote}
% and should be used preferently. The package \pkg{footnote} has some drawbacks,
% in particular: it must be loaded after the package \pkg{xcolor} and it is not
% perfectly compatible with \pkg{hyperref}.
%
% \medskip
% In this document, the package \pkg{witharrows} has been loaded with the option
% |footnotehyper| and we give an example with a footnote in the label of an
% arrow:
%
% \smallskip
% $\begin{WithArrows}
% A & = (a+b)^2 
% \Arrow{We expand\,\footnote{A footnote.}} \\
%    & = a^2+b^2+2ab
% \end{WithArrows}$
%
% \bigskip
% \subsection{Option no-arrows}
%
% The option |no-arrows| is a convenience given to the user. With this option
% the arrows are not drawn. However, an analyse of the arrows is done and some
% errors can be raised, for example if an arrow would arrive after the last row
% of the environment.
%
%
% \bigskip
% \subsection{Note for developpers}
%
% If you want to construct an environment upon an environment of
% \pkg{witharrows}, we recommand to call the environment with the construction
% |\WithArrows|-|\endWithArrows| or |\DispWithArrows|-|\endDispWithArrows| (and
% not |\begin{WithArrows}|-|\end{WithArrows}|, etc.).
%
% \smallskip
% By doing so, the error messages generated by \pkg{witharrows} will (usually)
% mention the name of your environment and they will be easier to understand by
% the final user.
%
% \smallskip
% By example, you can define an environment |{DWA}| which is an alias of
% |{DispWithArrows}|:
% \begin{BVerbatim}
% \NewDocumentEnvironment {DWA} {} {\DispWithArrows}{\endDispWithArrows}
% \end{BVerbatim}
% 
% \smallskip
% If you use this environment |{DWA}| in math mode, you will have the following
% error message:
% 
% \begin{BVerbatim}
% The environment {DWA} should be used only outside math mode.
% \end{BVerbatim}
% 
% \interitem
% Another example is the definition of the environment |{DispWithArrows*}|
% internally in the package \pkg{witharrows} by the following code:
% \begin{Verbatim}
% \NewDocumentEnvironment {DispWithArrows*} {}
%     {\WithArrowsOptions{notag}%
%      \DispWithArrows}
%     {\endDispWithArrows}
% \end{Verbatim}
%
%
%
% \section{Examples}
%
% \subsection{\textbackslash MoveEqLeft}
%
% It's possible to use |\MoveEqLeft| of \pkg{mathtools} (if we don't want
% ampersand on the first line):
% %
% \begin{Verbatim}[formatcom=\small\color{gray}]
% $\begin{WithArrows}[interline=0.5ex]
% ~emphase#\MoveEqLeft@ \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} 
% \Arrow{because both are in $[-\frac{\pi}2,\frac{\pi}2]$} \\
% & \Leftrightarrow x = \sin\left(\arcsin\frac45 + \arcsin\frac5{13}\right) \\
% & \Leftrightarrow x = \frac45\cos\arcsin\frac5{13} + \frac5{13} \cos\arcsin\frac45 
% \Arrow{$\forall x \in [-1,1], \cos(\arcsin x) = \sqrt{1-x^2}$} \\
% & \Leftrightarrow x = \frac45\sqrt{1-\bigl(\frac5{13}\bigr)^2}
% + \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2} 
% \end{WithArrows}$
% \end{Verbatim}
%
%
% \medskip
% $\begin{WithArrows}[interline=0.5ex]
% \MoveEqLeft \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} 
% \Arrow{because both are in $[-\frac{\pi}2,\frac{\pi}2]$} \\
% & \Leftrightarrow x = \sin\left(\arcsin\frac45 + \arcsin\frac5{13}\right) \\
% & \Leftrightarrow x = \frac45\cos\arcsin\frac5{13} + \frac5{13} \cos\arcsin\frac45 
% \Arrow{$\forall x \in [-1,1], \cos(\arcsin x) = \sqrt{1-x^2}$} \\
% & \Leftrightarrow x = \frac45\sqrt{1-\bigl(\frac5{13}\bigr)^2}
% + \frac5{13}\sqrt{1-\bigl(\frac45\bigr)^2} 
% \end{WithArrows}$
%
%
% \bigskip
% \subsection{Modifying the shape of the nodes}
%
% It's possible to change the shape of the labels, which are Tikz nodes, by
% modifying the key ``|every node|'' of Tikz.
%
% \begin{Verbatim}
% \begin{WithArrows}%
%      [format = c,
%       interline = 4mm,
%       tikz = {~emphase#every node/.style = {circle,@
%               ~emphase#                     draw,@
%               ~emphase#                     auto = false,@
%               ~emphase#                     fill = gray!50,@
%               ~emphase#                     inner sep = 1pt,@
%               ~emphase#                     font = \tiny}@}]
%  3 (2x+4) = 6 \Arrow{$\div 3$} \\
%  2x+4 = 2     \Arrow{$-4$} \\
%  2x = -2      \Arrow{$\div 2$} \\
%  2x = -1
% \end{WithArrows}
% \end{Verbatim}
%
% \[\begin{WithArrows}[%
%       format = c,
%       interline = 4mm,
%       tikz = {every node/.style = {circle,
%                                    draw,
%                                    auto = false,
%                                    fill = gray!50,
%                                    inner sep = 1pt,
%                                    font = \tiny}}]
%  3 (2x+4) = 6 \Arrow{$\div 3$} \\
%  2x+4 = 2     \Arrow{$-4$}     \\
%  2x = -2      \Arrow{$\div 2$} \\
%  2x = -1
% \end{WithArrows}\]
%
%
% \bigskip
% \subsection{Examples with the option tikz-code}
%
% We recall that the option |tikz-code| is the Tikz code used by \pkg{witharrows}
% to draw the arrows.\footnote{If an environment |{DispWithArrows}| or
% |{DispWithArrows*}| is used with the option |wrap-lines|, the value of the
% option |tikz-code| is not used for this environment (but is used for the
% environments nested inside).}
%
% \smallskip
% The value by defaut of |tikz-code| is \verb|\draw (#1) to node {#3} (#2) ;|
% where the three markers |#1|, |#2| and |#3| represent the start row, the end
% row and the label of the arrow.
%
%
% \bigskip
% \subsubsection{Example 1}
% In the following example, we define the value of |tikz-code| with two
% instructions |\path| : the first instruction draws the arrow itself and the
% second puts the label in a Tikz node in the rectangle delimited by the arrow.
%
% \begin{Verbatim}
% \begin{DispWithArrows*}%
%       [displaystyle,
%        ygap = 2mm,
%        ystart = 0mm,
%        ~emphase#tikz-code = {\draw (~#1) -- ++(4.5cm,0) |- (~#2) ;@
%        ~emphase#             \path (~#1) -- (~#2) @
%        ~emphase#                    node[text width = 4.2cm, right, midway] {~#3} ;}@]
% S_n
% & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
% ...........
% \end{Verbatim}
%
%
% \bigskip
% \begin{DispWithArrows*}[
%        displaystyle,
%        ygap = 2mm,
%        ystart = 0mm,
%        tikz-code = {\draw (#1) -- ++(4.5cm,0) |- (#2) ;
%                     \path (#1) -- (#2) 
%                            node[text width = 4.2cm, right, midway] {#3} ;}]
% S_n
% & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
% \Arrow{$\cos x = \Re(e^{ix})$}\\
% & = \frac1n\sum_{k=0}^{n-1} \Re\left(e^{i\frac{k\pi}{2n}}\right)
% \Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\
% & = \frac1n \Re\left(\sum_{k=0}^{n-1} e^{i\frac{k\pi}{2n}}\right)
% \Arrow{$\exp$ is a morphism for $\times$ et $+$} \\
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\
% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)\\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) 
% \end{DispWithArrows*}
%
% \bigskip
% \subsubsection{Example 2}
%
% \label{example-WithArrowsRightX}
% It's possible to modify the previous example to have the ``|text width|''
% automatically computed with the right margin (in a way similar as the
% |wrap-lines| option) in the environments |{DispWithArrows}| and
% |{DispWithArrows*}|. In the definition of |tikz-code|, we use the command
% |\WithArrowsRightX| which is the $x$-value of the right margin of the current
% composition box (it's a TeX command and not a dimension). For lisibility, we
% use a style. This example requires the Tikz library \pkg{calc}.
%
% \begin{Verbatim}
% \WithArrowsNewStyle{MyStyle}       
%   {displaystyle,
%    ygap = 2mm,
%    xoffset = 0pt,
%    ystart = 0mm,
%    tikz-code = {\path let \p1 = (~#~#1)
%                       in (~#~#1)
%                           -- node [anchor = west, 
%                                    text width = {~emphase#\WithArrowsRightX@ - \x1 - 0.5 em}] 
%                                   {~#~#3} 
%                          (~#~#2) ;
%                 \draw let \p1 = (~#~#1) 
%                       in (~#~#1) -- ++(~emphase#\WithArrowsRightX@ - \x1,0) |- (~#~#2) ; }}
% \end{Verbatim}
%
% \begin{Verbatim}
%\begin{DispWithArrows}[MyStyle]
%   S_n
%   & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
%   \Arrow{$\cos x = \Re(e^{ix})$}\\
% ...........
% \end{Verbatim}
% 
% \WithArrowsNewStyle{MyStyle}       
% {displaystyle,
%  ygap = 2mm,
%  xoffset = 0pt,
%  ystart = 0mm,
%  tikz-code = {\path let \p1 = (##1)
%                     in (##1)
%                         -- node [anchor = west, 
%                                  text width = {\WithArrowsRightX - \x1 - 0.5 em}] {##3} 
%                        (##2) ;
%               \draw let \p1 = (##1) 
%                     in (##1) -- ++(\WithArrowsRightX - \x1,0) |- (##2) ; }}
%
%\begin{DispWithArrows}[MyStyle]
% S_n
% & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
% \Arrow{$\cos x = \Re(e^{ix})$}\\
% & = \frac1n\sum_{k=0}^{n-1} \Re\left(e^{i\frac{k\pi}{2n}}\right)
% \Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\
% & = \frac1n \Re\left(\sum_{k=0}^{n-1} e^{i\frac{k\pi}{2n}}\right)
% \Arrow{$\exp$ is a morphism for $\times$ et $+$} \\
% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right)
% \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\
% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)\\
% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) 
% \end{DispWithArrows}
% 
%
% 
% \bigskip
% \subsubsection{Example 3}
% 
% In the following example, we change the shape of the arrow depending on whether
% the start row is longer than the end row or not. This example requires the
% Tikz library \pkg{calc}.
% 
% \begin{Verbatim}
% \begin{WithArrows}[ll,interline=5mm,xoffset=5mm,
%       ~emphase#tikz-code  = {\draw[rounded corners,@
%       ~emphase#                    every node/.style = {circle,@
%       ~emphase#                                         draw,@
%       ~emphase#                                         auto = false,@
%       ~emphase#                                         inner sep = 1pt,@
%       ~emphase#                                         fill = gray!50,@
%       ~emphase#                                         font = \tiny }]@ 
%       ~emphase#                    let \p1 = (~#1),@
%       ~emphase#                        \p2 = (~#2)@
%       ~emphase#                    in \ifdim \x1 > \x2@
%       ~emphase#                         (\p1) -- node {~#3} (\x1,\y2) -- (\p2)@
%       ~emphase#                       \else@
%       ~emphase#                         (\p1) -- (\x2,\y1) -- node {~#3} (\p2)@
%       ~emphase#                       \fi ;}@]
% E & \Longleftrightarrow \frac{(x+4)}3 + \frac{5x+3}5 = 7 
% \Arrow{$\times 15$}\\
%   & \Longleftrightarrow 5(x+4) + 3(5x+3) = 105 \\
%   & \Longleftrightarrow 5x+20 + 15x+9 = 105 \\
%   & \Longleftrightarrow 20x+29 = 105 
% \Arrow{$-29$}\\
%   & \Longleftrightarrow 20x = 76 
% \Arrow{$\div 20$}\\
%   & \Longleftrightarrow x = \frac{38}{10} 
% \end{WithArrows}
% \end{Verbatim}
%
%
% \[\begin{WithArrows}[ll,interline=5mm,xoffset=5mm,
%       tikz-code  = {\draw[rounded corners,
%                           every node/.style = {circle,
%                                                draw,
%                                                auto = false,
%                                                inner sep = 1pt,
%                                                fill = gray!50,
%                                                font = \tiny}] 
%                           let \p1 = (#1),
%                               \p2 = (#2)
%                           in \ifdim \x1 > \x2
%                                (\p1) -- node {#3} (\x1,\y2) -- (\p2)
%                              \else
%                                (\p1) -- (\x2,\y1) -- node {#3} (\p2)
%                              \fi ;}]
% E & \Longleftrightarrow \frac{(x+4)}3 + \frac{5x+3}5 = 7 
% \Arrow{$\times 15$}\\
%   & \Longleftrightarrow 5(x+4) + 3(5x+3) = 105 \\
%   & \Longleftrightarrow 5x+20 + 15x+9 = 105 \\
%   & \Longleftrightarrow 20x+29 = 105 
% \Arrow{$-29$}\\
%   & \Longleftrightarrow 20x = 76 
% \Arrow{$\div 20$}\\
%   & \Longleftrightarrow x = \frac{38}{10} 
% \end{WithArrows}\]
%
%
% 
% \subsection{Automatic numbered loop}
%
% Assume we want to draw a loop of numbered arrows. In this purpose, it's
% possible to write a dedicated command |\NumberedLoop| which will do the job
% when used in |code-after|. In the following example, we write this command with
% |\NewDocumentCommand| of \pkg{xparse} and |\foreach| of \pkg{pgffor} (both
% packages are loaded when \pkg{witharrows} is loaded).
%
% \begin{Verbatim}
% \NewDocumentCommand \NumberedLoop {}
%         {\foreach \j in {2,...,\WithArrowsNbLines} 
%               { \pgfmathtruncatemacro{\i}{\j-1}
%                 \Arrow[rr]{\i}{\j}{\i} }
%          \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\WithArrowsNbLines}{\WithArrowsNbLines}}
% \end{Verbatim}
% 
% The command |\WithArrowsNbLines| is a command available in |code-after| which
% gives the total number of lines (=rows) of the current environment (it's a
% command and not a counter).
%
%
% \bigskip
% \begin{Verbatim}
% $\begin{WithArrows}[~emphase#code-after = \NumberedLoop@]
% a.\;& f \text{ est continuous on } E \\
% b.\;& f \text{ est continuous in } 0 \\
% c.\;& f \text{ is bounded on the unit sphere} \\
% d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\
% e.\;& f \text{ is lipschitzian} 
% \end{WithArrows}$
% \end{Verbatim}
% 
% \bigskip
% \begin{scope}
% \NewDocumentCommand \NumberedLoop {}
%         {\foreach \j in {2,...,\WithArrowsNbLines} 
%               { \pgfmathtruncatemacro{\i}{\j-1}
%                 \Arrow[rr]{\i}{\j}{\i} }
%          \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\WithArrowsNbLines}{\WithArrowsNbLines}}
%
%
% $\begin{WithArrows}[code-after = \NumberedLoop]
% a.\;& f \text{ est continuous on } E \\
% b.\;& f \text{ est continuous in } 0 \\
% c.\;& f \text{ is bounded on the unit sphere} \\
% d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\
% e.\;& f \text{ is lipschitzian} 
% \end{WithArrows}$
%
%
% \bigskip
% As usual, it's possible to change the characteristic of both arrows and nodes
% with the option |tikz|. However, if we want to change the style to have, for
% example, numbers in parenthesis, the best way is to change the value of
% |tikz-code|:
%
% \begin{Verbatim}
% tikz-code = {\draw (~#1) to node {\footnotesize (~#3)} (~#2) ;}
% \end{Verbatim}
%
% \WithArrowsOptions{tikz-code = {\draw (#1) to node {\footnotesize (#3)} (#2) ;}}
%
% $\begin{WithArrows}[code-after = \NumberedLoop]
% a.\;& f \text{ est continuous on } E \\
% b.\;& f \text{ est continuous in } 0 \\
% c.\;& f \text{ is bounded on the unit sphere} \\
% d.\;& \exists K > 0\quad \forall x \in E\quad \|f(x)\| \le K \|x\| \\
% e.\;& f \text{ is lipschitzian}  
% \end{WithArrows}$
%
% \end{scope}
%
% \vspace{2cm}
% 
% \section{Implementation}
%
% \subsection{Declaration of the package and extensions loaded}
%
%
% First, \pkg{tikz} and some Tikz libraries 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{arrows.meta,bending}
\RequirePackage{expl3}[2019/02/15]
%    \end{macrocode}
%
% \bigskip
% Then, we can give the traditional declaration of a package written with
% |expl3|:
%    \begin{macrocode}
\RequirePackage{l3keys2e}
\ProvidesExplPackage
  {witharrows}
  {\myfiledate}
  {\myfileversion}
  {Draws arrows for explanations on the right}
%    \end{macrocode}
%
% \bigskip
% The package \pkg{xparse} will be used to define the environments
% |{WithArrows}|, |{DispWithArrows}|, |{DispWithArrows*}| and the commands
% |\Arrow|, |\WithArrowsOptions| and |\WithArrowsNewStyle|.
%    \begin{macrocode}
\RequirePackage { xparse } [ 2018-10-17 ]
%    \end{macrocode}
%
% \bigskip
% \subsection{The packages footnote and footnotehyper}
%
% A few options can be given to the package \pkg{witharrows} when it is loaded
% (with |\usepackage|, |\RequirePackage| or |\PassOptionsToPackage|). Currently
% (version \myfileversion), there are two such options: |footnote| and
% |footnotehyper|. With the option |footnote|, \pkg{witharrows} loads
% \pkg{footnote} and uses it to extract the footnotes from the environments
% |{WithArrows}|. Idem for the option |footnotehyper|.
%
% \medskip
% The boolean |\g_@@_footnotehyper_bool| will indicate if the option
% |footnotehyper| is used.
%    \begin{macrocode}
\bool_new:N \g_@@_footnotehyper_bool
%    \end{macrocode}
%
% \medskip
% The boolean |\g_@@_footnote_bool| will indicate if the option |footnote| is
% used, but quicky, it will also be set to |true| if the option |footnotehyper|
% is used.
%    \begin{macrocode}
\bool_new:N \g_@@_footnote_bool
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { witharrows } }
\cs_new_protected:Npn \@@_msg_new:nnn { \msg_new:nnnn { witharrows } }
\cs_new_protected:Npn \@@_msg_redirect_name:nn 
  { \msg_redirect_name:nnn { witharrows } }
%    \end{macrocode}
% 
% \medskip
% We define a set of keys |WithArrows/package| for these options.
%    \begin{macrocode}
\keys_define:nn { WithArrows / package }
  { 
    footnote .bool_gset:N = \g_@@_footnote_bool ,
    footnotehyper .bool_gset:N = \g_@@_footnotehyper_bool ,
    unknown .code:n = 
      \msg_fatal:nn { witharrows } { Option~unknown~for~package } 
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nn { Option~unknown~for~package }
  { 
    You~can't~use~the~option~'\l_keys_key_tl'~when~loading~the~
    package~witharrows.~Try~to~use~the~command~
    \token_to_str:N\WithArrowsOptions. 
  }
%    \end{macrocode}
%
%
% \bigskip
% We process the options when the package is loaded (with |\usepackage|).
%    \begin{macrocode}
\ProcessKeysOptions { WithArrows / package }
%    \end{macrocode}
% 
%
% \medskip
%    \begin{macrocode}
\@@_msg_new:nn { Option~incompatible~with~Beamer }
  { 
    The~option~'\l_keys_key_tl'\ is~incompatible~
    with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes. 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { footnote~with~footnotehyper~package }
  { 
    You~can't~use~the~option~'footnote'~because~the~package~
    footnotehyper~has~already~been~loaded.~
    If~you~want,~you~can~use~the~option~'footnotehyper'~and~the~footnotes~  
    within~the~environments~of~witharrows~will~be~extracted~with~the~tools~
    of~the~package~footnotehyper. 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { footnotehyper~with~footnote~package }
  { 
    You~can't~use~the~option~'footnotehyper'~because~the~package~
    footnote~has~already~been~loaded.~
    If~you~want,~you~can~use~the~option~'footnote'~and~the~footnotes~  
    within~the~environments~of~witharrows~will~be~extracted~with~the~tools~
    of~the~package~footnote. 
  }
%    \end{macrocode}
%
% \medskip
%    \begin{macrocode}
\bool_if:NT \g_@@_footnote_bool 
  { 
    \@ifclassloaded { beamer }
      { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } }
      { }
    \@ifpackageloaded { footnotehyper }
      { \msg_fatal:nn { witharrows } { footnote~with~footnotehyper~package } }
      { }
    \usepackage { footnote } 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_if:NT \g_@@_footnotehyper_bool 
  { 
    \@ifclassloaded { beamer }
      { \msg_fatal:nn { witharrows } { Option~incompatible~with~Beamer } }
      { }
    \@ifpackageloaded { footnote }
      { \msg_fatal:nn { witharrows } { footnotehyper~with~footnote~package } }
      { }
    \usepackage { footnotehyper }
    \bool_gset_true:N \g_@@_footnote_bool 
  }
%    \end{macrocode}
% The flag |\g_@@_footnote_bool| is raised and so, we will only have to test
% |\g_@@_footnote_bool| in order to know if we have to insert an environnement
% |{savenotes}| (the |\begin{savenotes}| is in |\@@_pre_halign:n| and
% |\end{savenotes}| at the end of the environments |{WithArrows}| and
% |{DispWithArrows}|).
%
% \bigskip
% \subsection{The class option leqno}
%
% The boolean |\c_@@_leqno_bool| will indicate if the class option |leqno| is
% used. When this option is used in LaTeX, the command |\@eqnnum| is redefined
% (as one can see in the file |leqno.clo|). That's enough to put the labels on
% the left in our environments |{DispWithArrows}| and |{DispWithArrows*}|.
% However, that's not enough when our option |wrap-lines| is used. That's why we
% have to know if this option is used as a class option. With the following
% programmation, |leqno| \emph{can't} be given as an option of \pkg{witharrows}
% (by design).
%    \begin{macrocode}
\bool_new:N \c_@@_leqno_bool
\DeclareOption { leqno } { \bool_set_true:N \c_@@_leqno_bool }
\DeclareOption* { }
\ProcessOptions* 
%    \end{macrocode}
%
% 
%
% \bigskip
% \subsection{Some technical definitions}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_error:n { \msg_error:nn { witharrows } }
\cs_new_protected:Npn \@@_error:nn  { \msg_error:nnn { witharrows } }
\cs_generate_variant:Nn \@@_error:nn { n x }
%    \end{macrocode}
% 
%    \begin{macrocode}
\cs_generate_variant:Nn \tl_put_right:Nn { N v }
\cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
%    \end{macrocode}
% 
% \medskip
% We create booleans in order to know if some packages are loaded. For example,
% for the package \pkg{amsmath}, the boolean is called
% |\c_@@_amsmath_loaded_bool|.\footnote{It's not possible to use
%   |\@ifpackageloaded| in the core of the functions because |\@ifpackageloaded|
%   is available only in the preamble.}
%    \begin{macrocode}
\AtBeginDocument 
  { 
    \clist_map_inline:nn
      { 
        amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
        typedref, varwidth 
      }
      {
        \bool_new:c { c_@@_#1_loaded_bool }
        \@ifpackageloaded { #1 }
          { \bool_set_true:c { c_@@_#1_loaded_bool } }
          { } 
      }
  }
%    \end{macrocode}
%
% \bigskip
% We define a command |\@@_strcmp:nn| to compare two token lists. It will be
% available whether the engine is pdfTeX, XeTeX or LuaTeX.
%    \begin{macrocode}
\sys_if_engine_luatex:TF
  { 
    \cs_new_protected:Npn \@@_strcmp:nn  #1 #2
      { \lua_now:e { l3kernel.strcmp('#1','#2') } } 
  }
  { 
    \cs_new_protected:Npn \@@_strcmp:nn #1 #2 
      { \pdftex_strcmp:D { #1 } { #2 } } 
  } 
%    \end{macrocode}
%
% \bigskip
% We can now define a command |\@@_sort_seq:N| which will sort a sequence.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_sort_seq:N #1
  { 
    \seq_sort:Nn #1
      { 
        \int_compare:nNnTF 
          { 
            \@@_strcmp:nn 
              { \str_lower_case:n { ##1 } } 
              { \str_lower_case:n { ##2 } } 
          } 
          > 0
          \sort_return_swapped:
          \sort_return_same:    
      } 
  }
%    \end{macrocode}
% 
% 
% \bigskip
% The command |\@@_save:N| saves a \pkg{expl3} variable by creating a global
% version of the variable. For a variable named |\l_|\texttt{\slshape
%   name}|_|\texttt{\slshape type}, the corresponding global variable will be
% named |\g_|\texttt{\slshape name}|_|\texttt{\slshape type}. The type of the
% variable is determinated by the suffix \texttt{\slshape type} and is used to
% apply the corresponding \pkg{expl3} commands.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_save:N #1
  { 
    \seq_set_split:Nxx \l_tmpa_seq 
       { \char_generate:nn { `_ } { 12 } } 
       { \cs_to_str:N #1 }
    \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
%    \end{macrocode}
% The string |\l_tmpa_str| will contains the \emph{type} of the variable.
%    \begin{macrocode}
    \str_set:Nx \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } }
    \use:c { \l_tmpa_str _if_exist:cF }
      { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ }
      { 
        \use:c { \l_tmpa_str _new:c }
          { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } 
      }
    \use:c { \l_tmpa_str _gset_eq:cN } 
      { g _\seq_use:Nnnn \l_tmpa_seq _ _ _ } #1 
  }
%    \end{macrocode}
% 
% \medskip
% The command |\@@_restore:N| affects to the \pkg{expl3} variable the value of
% the (previously) set value of the corresponding \emph{global} variable.
%    \begin{macrocode}  
\cs_new_protected:Npn \@@_restore:N #1
  { 
    \seq_set_split:Nxx \l_tmpa_seq 
      { \char_generate:nn { `_ } { 12 } } 
      { \cs_to_str:N #1 }
    \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
    \str_set:Nx \l_tmpa_str { \seq_item:Nn \l_tmpa_seq { -1 } }
    \use:c { \l_tmpa_str _set_eq:Nc } 
      #1 { g_\seq_use:Nnnn \l_tmpa_seq _ _ _ } 
  }
%    \end{macrocode}
% 
% 
% \bigskip
% We define a Tikz style |@@_node_style| for the |l|-nodes and |r|-nodes that
% will be created in the |\halign|. These nodes are Tikz nodes of shape
% ``rectangle'' but with zero width. An arrow between two nodes starts from the
% \emph{south} anchor of the first node and arrives at the \emph{north} anchor
% of the second node.
%    \begin{macrocode}
\tikzset
  { 
    @@_node_style / .style = 
      { 
        above = \l_@@_ystart_dim ,
        inner~sep = \c_zero_dim ,
        minimum~width = \c_zero_dim ,
        minimum~height = \l_@@_ygap_dim
      }
  }
%    \end{macrocode}
% If the user uses the option |show-nodes| (it's a \pkg{l3keys} option), the
% Tikz options |draw| and |red| will be appended to this style. This feature may
% be useful for debugging.\footnote{The |v|-nodes, created near the end of line
%   in |{DispWithArrows}| and |{DispWithArrows*}| are not shown with the option
%   |show-nodes|.}
%
% 
% \bigskip
% The style |@@_standard| is loaded in standard in the |{tikzpicture}| we need.
% The names of the nodes are prefixed by |wa| (by security) but also by a prefix
% which is the position-in-the-tree of the nested environments.
%    \begin{macrocode}
\tikzset
  { 
    @@_standard / .style = 
      { 
        remember~picture ,
        overlay ,
        name~prefix = wa - \l_@@_prefix_str -
      }
  }
%    \end{macrocode}
% 
% \bigskip
% We also define a style for the tips of arrow. The final user of the extension
% \pkg{witharrows} will use this style if he wants to draw an arrow directly
% with a Tikz command in his document (probably using the Tikz nodes created by
% |{WithArrows}| in the |\halign|).
%    \begin{macrocode}
\tikzset
  { 
    WithArrows / arrow / tips / .style = 
      { > = { Straight~Barb [ scale = 1.2 , bend ] } } 
  }
%    \end{macrocode}
%
% \bigskip
% The style |WithArrows/arrow| will be used to draw the arrows (more precisely,
% it will be passed to |every~path|).
%    \begin{macrocode}
\tikzset 
 { 
   WithArrows / arrow / .style  = 
     { 
       align = left ,
%    \end{macrocode}
%
% We have put the option |align = left| because we want to give the user the
% possibility of using |\\| in the labels.
%    \begin{macrocode}
       auto = left ,
       font = \small \itshape ,
       WithArrows / arrow / tips ,
       bend~left = 45 ,
       -> 
     } 
 }
%    \end{macrocode}
%
% \bigskip
% In order to increase the interline in the environments |{WithArrows}|,
% |{DispWithArrows}|, etc., we will use the command |\spread@equation| of
% \pkg{amsmath}. When used, this command becomes no-op (in the current TeX
% group). Therefore, it will be possible to use the environments of
% \pkg{amsmath} (e.g. |{aligned}|) in an environment |{WithArrows}|.
% 
% Nevertheless, we want the extension \pkg{witharrows} available without
% \pkg{amsmath}. That's why we give a definition of |\spread@equation| if
% \pkg{amsmath} is not loaded (we put the code in a |\AtBeginDocument| because
% the flag |\c_@@_amsmath_loaded_bool| is itself set in a |\AtBeginDocument|).
%    \begin{macrocode}
\AtBeginDocument 
  {
    \bool_if:NF \c_@@_amsmath_loaded_bool
      { 
        \cs_set_protected:Npn \spread@equation
          { 
            \openup \jot   
            \cs_set_eq:NN \spread@equation \prg_do_nothing:
          }
      } 
  }
%    \end{macrocode}
%
% \bigskip
% For the construction of the preambles of the environments |{WithArrows}| and
% |{DispWithArrows}|, we will have to insert the token |#| (catcode 6). We put it
% in a \emph{toks register} of TeX (with no equivalent in \pkg{expl3}).
%    \begin{macrocode}
\newtoks \@@_parameter_token
\@@_parameter_token = { # } 
%    \end{macrocode}
%
% \bigskip
% \subsection{Variables}
%
% The boolean |\l_@@_in_WithArrows_bool| will be raised in an environment
% |{WithArrows}| and the boolean |\l_@@_in_dispwitharrows_bool| will be raised
% in an environment |{DispWithArrows}| or |{DispWithArrows*}|. The boolean
% |\l_@@_in_code_after_bool| will be raised during the execution of the
% |code-after| (option |code-after|).
%    \begin{macrocode}
\bool_new:N \l_@@_in_WithArrows_bool
\bool_new:N \l_@@_in_DispWithArrows_bool
\bool_new:N \l_@@_in_code_after_bool
%    \end{macrocode}
%
% \bigskip
% The following sequence is the position of the last environment |{WithArrows}|
% in the tree of the nested environments |{WithArrows}|.
%    \begin{macrocode}
\seq_new:N \g_@@_position_in_the_tree_seq
\seq_gput_right:Nn \g_@@_position_in_the_tree_seq 1
%    \end{macrocode}
%
% \bigskip
% The following counter will give the number of the last environment
% |{WithArrows}| of level~$0$. This counter will be used only in the definition
% of |\WithArrowsLastEnv|.
%    \begin{macrocode}
\int_new:N \g_@@_last_env_int
%    \end{macrocode}
%
% \bigskip
% The following integer indicates the position of the box that will be created
% for an environment |{WithArrows}| (not an environment |{DispWithArrows}|) :
% 0 (=|t|=|\vtop|), 1~(=|c|=|\vcenter|) or 2 (=|b|=|\vbox|).
%    \begin{macrocode}
\int_new:N \l_@@_pos_env_int 
%    \end{macrocode}
%
% \bigskip
% The integer |\l_@@_pos_arrow_int| indicates the position of the arrow with the
% following code (the option |v| is accessible only for the arrows in
% |code-after| where the options |i|, |group| et |groups| are not available).
%
% \begin{center}
% \begin{tabular}{l}
% \begin{tabular}{@{}l*8c@{}}
% \toprule
% option                 & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\
% \midrule
% |\l_@@_pos_arrow_int| & $0$  & $1$  & $2$  & $3$  & $4$ & $5$  & $6$  & $7$  \\
% \bottomrule
% \end{tabular} \\
% \footnotesize The option |v| can be used only in |\Arrow| in |code-after| (see
% below). 
% \end{tabular}
% \end{center}
%
%    \begin{macrocode}
\int_new:N \l_@@_pos_arrow_int
\int_set:Nn \l_@@_pos_arrow_int 3
%    \end{macrocode}
%
%
% \bigskip
% In the |\halign| of an environment |{WithArrows}| or |{DispWithArrows}|, we
% will have to use four counters:
% \begin{itemize}
% \item |\g_@@_arrow_int| to count the arrows created in the environment ;
% \item |\g_@@_line_int| to count the lines of the |\halign| ;
% \item |\g_@@_col_int| to count the column of the |\halign|.
% \end{itemize}
%
% These counters will be incremented in a cell of the |\halign| and, therefore,
% the incrementation must be global. However, we want to be able to include a
% |{WithArrows}| in another |{WithArrows}|. To do so, we must restore the
% previous value of these counters at the end of an environment |{WithArrows}|
% and we decide to manage a stack for each of these counters.
%    \begin{macrocode}
\seq_new:N \g_@@_arrow_int_seq
\int_new:N \g_@@_arrow_int
\seq_new:N \g_@@_line_int_seq
\int_new:N \g_@@_line_int
\seq_new:N \g_@@_col_int_seq
\int_new:N \g_@@_col_int
%    \end{macrocode}
%
% 
% \bigskip
% For the environment |{DispWithArrows}|, the comma list |\l_@@_tags_clist| will
% be the list of the numbers of lines to be tagged (with the counter |equation|
% of LaTeX). In fact, |\l_@@_tags_clist| may contain non negative integers but
% also three special values, |first|, |last| and |all|.
%    \begin{macrocode}
\clist_new:N \l_@@_tags_clist
\clist_set:Nn \l_@@_tags_clist { all }
%    \end{macrocode}
%
% \bigskip
% During the execution of an environment |{DispWithArrows}|, if a row must be
% tagged, the (local) value of |\l_@@_tags_clist| will be put (by convention) to
% |all|. 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_test_if_to_tag:
  { 
    \clist_if_in:NVT \l_@@_tags_clist \g_@@_line_int
      { \clist_set:Nn \l_@@_tags_clist { all } }
  }
%    \end{macrocode}
%
%
% \bigskip
% If the user has given a value for the option |command-name| (at the global or
% at the \emph{environment} level), a command with this name is defined locally
% in the environment with meaning |\@@_Arrow|. The default value of the option
% |command-name| is ``|Arrow|'' and thus, by default, the name of the command
% will be |\Arrow|.
%    \begin{macrocode}
\str_new:N \l_@@_command_name_str
\str_set:Nn \l_@@_command_name_str { Arrow }
%    \end{macrocode}
%
% \bigskip
% The string |\l_@@_string_Arrow_for_msg_str| is only a string that will be
% displayed in some error messages. For example, if |command-name| is defined to
% be |Explanation|, this string will contain ``|\Arrow alias \Explanation|''. 
%    \begin{macrocode}
\str_new:N \l_@@_string_Arrow_for_msg_str 
\str_set:Nx \l_@@_string_Arrow_for_msg_str { \token_to_str:N \Arrow }
%    \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 boolean |\l_@@_sbwi_bool| corresponds to the option
% |standard-behaviour-with-items|. Since the version 1.16 of \pkg{witharrows},
% no vertical space is added between an |\item| of a LaTeX list and an
% environment |{DispWithArrows}|. With the option
% |standard-behaviour-with-items|, it's possible to restore the previous
% behaviour (which corresponds to the standard behaviour of |{align}| of
% \pkg{amsmath}). |\l_@@_sbwi_bool| is the boolean corresponding to this option.
%    \begin{macrocode}
\bool_new:N \l_@@_sbwi_bool 
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\bool_new:N \l_@@_in_first_columns_bool
\bool_new:N \l_@@_tag_star_bool
\bool_new:N \l_@@_tag_next_line_bool
\bool_new:N \l_@@_qedhere_bool
\bool_new:N \l_@@_new_group_bool
\bool_new:N \l_@@_initial_r_bool
\bool_new:N \l_@@_final_r_bool
\tl_new:N \l_@@_initial_tl
\tl_new:N \l_@@_final_tl
\int_new:N \l_@@_nb_of_columns_int
\bool_new:N \l_@@_last_col_bool
%    \end{macrocode}
% 
% \bigskip
% The string |\l_@@_format_str| will contain the \emph{format} of the array
% which is a succession of letters |r|, |c| and |l| specifying the type of the
% columns of the |\halign| (except the column for the labels of the equations
% in the environment |{DispWithArrows}|). 
%    \begin{macrocode}
\str_new:N \l_@@_format_str
%    \end{macrocode}
% 
%
% \bigskip
% \subsection{The definition of the options}
%
% There are four levels where options can be set:
% \begin{itemize}
% \item with |\usepackage[...]{witharrows}|: this level will be called
% \emph{package} level;
% \item with |\WithArrowsOptions{...}|: this level will be called \emph{global}
% level\footnote{This level is called \emph{global level} but the settings done
% by |\WithArrowsOptions| are local in the TeX sense: their scope corresponds to
% the current TeX group.};
% \item with |\begin{WithArrows}[...]|: this level will be called
% \emph{environment} level;
% \item with |\Arrow[...]| (included in |code-after|): this level will be called
% \emph{local} level.
% \end{itemize}
%
%
% \bigskip
% When we scan a list of options, we want to be able to raise an error if two
% options of position (|ll|, |rl|, |i|, etc.) of the arrows are present. That's
% why we keep the first option of position in a variable called
% |\l_@@_previous_key_str|. The following function |\@@_eval_if_allowed:n| will
% execute its argument only if a first key of position has not been set (and
% raise an error elsewhere). 
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_eval_if_allowed:n #1
  { 
    \str_if_empty:NTF \l_@@_previous_key_str
      { 
        \str_set_eq:NN \l_@@_previous_key_str \l_keys_key_tl
        #1
      }
      { \@@_error:n { Incompatible~options } }
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_fix_pos_option:n #1
  { \@@_eval_if_allowed:n { \int_set:Nn \l_@@_pos_arrow_int { #1 } } }
%    \end{macrocode}
%
% \bigskip
% First a set of keys that will be used at the global or environment level of
% options.
%    \begin{macrocode}
\keys_define:nn { WithArrows / Global }
  {
    ygap .dim_set:N = \l_@@_ygap_dim ,
    ygap .value_required:n = true ,
    ygap .initial:n = 0.4 ex ,
    ystart .dim_set:N = \l_@@_ystart_dim ,
    ystart .value_required:n = true ,
    ystart .initial:n = 0.4 ex ,
    more-columns .code:n = 
      \@@_msg_redirect_name:nn { Too~much~columns~in~WithArrows } { none } ,
    more-columns .value_forbidden:n = true,
    command-name .code:n =
      \str_set:Nn \l_@@_command_name_str { #1 }
      \str_set:Nx \l_@@_string_Arrow_for_msg_str
        { \c_backslash_str Arrow~alias~\c_backslash_str #1 } ,
    command-name .value_required:n = true ,
    tikz-code .tl_set:N = \l_@@_tikz_code_tl,
    tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
    tikz-code .value_required:n = true ,
    TikzCode .meta:n = { tikz-code = #1 } ,
    displaystyle .bool_set:N = \l_@@_displaystyle_bool ,
    displaystyle .default:n = true ,
    show-nodes .code:n =  
      \tikzset { @@_node_style / .append~style = { draw , red } } ,
    show-nodes .value_forbidden:n = true,
    show-node-names .bool_set:N = \l_@@_show_node_names_bool ,
    show-node-names .default:n = true ,
    group .code:n = 
      \str_if_empty:NTF \l_@@_previous_key_str
        {
          \str_set:Nn \l_@@_previous_key_str { group }
          \seq_remove_all:Nn \l_@@_options_Arrow_seq { xoffset }
          \int_set:Nn \l_@@_pos_arrow_int 7 
        }
        { \@@_error:n { Incompatible~options } } ,
    group .value_forbidden:n = true ,
    groups .code:n = 
      \str_if_empty:NTF \l_@@_previous_key_str
        { 
          \str_set:Nn \l_@@_previous_key_str { groups }
          \seq_if_in:NnF \l_@@_options_Arrow_seq { new-group }
            { \seq_put_right:Nn \l_@@_options_Arrow_seq { new-group } }
          \seq_remove_all:Nn \l_@@_options_Arrow_seq { xoffset }
          \int_set:Nn \l_@@_pos_arrow_int 6
        }
        { \@@_error:n { Incompatible~options } } ,
    groups .value_forbidden:n = true ,
    tikz   .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } , 
    tikz   .initial:n         = \c_empty_tl ,
    tikz   .value_required:n  = true ,
    rr     .value_forbidden:n = true ,
    rr     .code:n            = \@@_fix_pos_option:n 3 ,
    ll     .value_forbidden:n = true ,
    ll     .code:n            = \@@_fix_pos_option:n 1 ,
    rl     .value_forbidden:n = true ,
    rl     .code:n            = \@@_fix_pos_option:n 2 ,
    lr     .value_forbidden:n = true ,
    lr     .code:n            = \@@_fix_pos_option:n 0 ,
    i      .value_forbidden:n = true ,
    i      .code:n            = \@@_fix_pos_option:n 5 ,
    xoffset .dim_set:N  = \l_@@_xoffset_dim ,
    xoffset .value_required:n  = true ,
    xoffset .initial:n = 3 mm ,
    jot .dim_set:N = \jot ,
    jot .value_required:n = true ,
    interline .skip_set:N = \l_@@_interline_skip ,
    interline .value_required:n = true ,
    start-adjust .dim_set:N = \l_@@_start_adjust_dim ,
    start-adjust .value_required:n = true ,
    start-adjust .initial:n = 0.4 ex ,
    end-adjust .dim_set:N = \l_@@_end_adjust_dim ,
    end-adjust .value_required:n = true ,
    end-adjust .initial:n = 0.4 ex ,
    adjust .code:n  = 
      \dim_zero_new:N \l_@@_start_adjust_dim
      \dim_set:Nn \l_@@_start_adjust_dim { #1 }
      \dim_zero_new:N \l_@@_end_adjust_dim
      \dim_set:Nn \l_@@_end_adjust_dim { #1 } ,
    adjust .value_required:n = true ,
%    \end{macrocode}
%
% \medskip
% With the option |no-arrows|, the arrows won't be drawn. However, the ``first
% pass'' of the arrows is done and some errors may be detected. The
% nullification of |\@@_draw_arrows:nn| is for the standard arrows and the
% nullification of |\@@_draw_arrow:nnn| is for ``Arrow in code-after''.
%    \begin{macrocode}
    no-arrows .code:n = 
      \cs_set_eq:NN \@@_draw_arrows:nn \use_none:nn
      \cs_set_eq:NN \@@_draw_arrow:nnn \use_none:nnn  ,
    no-arrows .value_forbidden:n = true ,
  }
%    \end{macrocode}
% 
% \bigskip
% Now a set of keys specific to the environments |{WithArrows}| (and not
% |{DispWithArrow}}|). Despite its name, this set of keys will also be used in
% |\WithArrowsOptions|. 
%    \begin{macrocode}
\keys_define:nn { WithArrows / WithArrowsSpecific }
  { 
    t   .code:n            = \int_set:Nn \l_@@_pos_env_int O ,
    t   .value_forbidden:n = true ,
    c   .code:n            = \int_set:Nn \l_@@_pos_env_int 1 ,
    c   .value_forbidden:n = true ,
    b   .code:n            = \int_set:Nn \l_@@_pos_env_int 2 ,
    b   .value_forbidden:n = true
  }
%    \end{macrocode}
%
% \bigskip
% Now a set of keys specific to the environments |{DispWithArrows}| and
% |{DispWithArrows*}| (and not |{WithArrows}|). Despite its name, this set of
% keys will also be used in |\WithArrowsOptions|. 
%    \begin{macrocode}
\keys_define:nn { WithArrows / DispWithArrowsSpecific }
  {  
    fleqn .bool_set:N = \l_@@_fleqn_bool ,
    fleqn .default:n = true ,
    mathindent .dim_set:N = \l_@@_mathindent_dim ,
    mathindent .value_required:n = true ,
    mathindent .initial:n = 25 pt ,
    notag .code:n = 
      \str_if_eq:nnTF { #1 } { true }
        { \clist_clear:N \l_@@_tags_clist }
        { \clist_set:Nn \l_@@_tags_clist { all } } ,
    notag .default:n = true ,
    nonumber .meta:n = notag ,
    allow-multiple-labels .code:n = 
      \@@_msg_redirect_name:nn { Multiple~labels } { none } ,
    allow-multiple-labels .value_forbidden:n = true ,
    wrap-lines .bool_set:N = \l_@@_wrap_lines_bool ,
    wrap-lines .default:n = true ,
    tagged-lines .code:n =   
      \clist_set:Nn \l_@@_tags_clist { #1 }
      \clist_if_in:NnT \l_@@_tags_clist { first }
        {
          \clist_remove_all:Nn \l_@@_tags_clist { first }
          \clist_put_left:Nn \l_@@_tags_clist \c_one_int
        } ,
    tagged-lines .value_required:n = true ,
%    \end{macrocode}
%
% Since the version 1.16 of \pkg{witharrows}, no vertical space is added between
% an |\item| of a LaTeX list and an environment |{DispWithArrows}|. With the
% option |standard-behaviour-with-items|, it's possible to restore the previous
% behaviour (which corresponds to the standard behaviour of |{align}| of
% \pkg{amsmath}).
%    \begin{macrocode}
    standard-behaviour-with-items .bool_set:N = \l_@@_sbwi_bool ,
    standard-behaviour-with-items .default:n = true 
  }
%    \end{macrocode}
%
% \bigskip
% Now a set of keys which will be used in all the environments (but not in
% |\WithArrowsOptions}|). 
%
%    \begin{macrocode}
\keys_define:nn { WithArrows / Env } 
  { 
    name .code:n = 
      \seq_if_in:NnTF \g_@@_names_seq { #1 }
        { \@@_error:n { Duplicate~name } }
        { \seq_gput_left:Nn \g_@@_names_seq { #1 } }
      \str_set:Nn \l_@@_name_str { #1 } ,
    name .value_required:n = true ,
    code-before .code:n = \tl_put_right:Nn \l_@@_code_before_tl { #1 } ,
    code-before .value_required:n = true,
    CodeBefore .meta:n = { code-before = #1 } ,
    code-after .code:n = \tl_put_right:Nn \l_@@_code_after_tl { #1 } ,
    code-after .value_required:n = true ,
    CodeAfter  .meta:n = { code-after = #1 } ,
    format .code:n = \@@_set_option_format:n { #1 },
    format .value_required:n = true ,
  }
%    \end{macrocode}
%
% \medskip
% An option |format| should contain only the letters |r|, |c| and |l|. That's
% why we write a function to validate and set the value given to |format|.
%    \begin{macrocode} 
\cs_new_protected:Npn \@@_set_option_format:n #1
  { 
    \bool_set_true:N \l_tmpa_bool
    \str_map_inline:nn { #1 }
      {
        \str_if_in:nnF {rcl} { ##1 }
          { 
            \bool_set_false:N \l_tmpa_bool
            \@@_error:n { Invalid~option~format }
            \str_map_break:
          }
      }
    \bool_if:NT \l_tmpa_bool { \tl_set:Nn \l_@@_format_str { #1 } }
  }
%    \end{macrocode}
%
% 
% \bigskip
% Now, we begin the construction of the major sets of keys which are named
% ``|WithArrows / WithArrows|'', ``|WithArrows / DispWithArrows|'' and 
% ``|WithArrows / WithArrowsOptions|''. Each of these sets of keys will be
% completed after.
%    \begin{macrocode}
\keys_define:nn { WithArrows } 
  { 
    WithArrows .inherit:n = 
      { 
        WithArrows / Global , 
        WithArrows / WithArrowsSpecific , 
        WithArrows / Env
      } , 
    DispWithArrows .inherit:n = 
      { 
        WithArrows / DispWithArrowsSpecific , 
        WithArrows / Global ,
        WithArrows / Env ,
      } ,
    WithArrowsOptions .inherit:n = 
      { 
        WithArrows / Global , 
        WithArrows / WithArrowsSpecific , 
        WithArrows / DispWithArrowsSpecific 
      } 
  }
%    \end{macrocode}
% 
% 
% \bigskip
% A sequence of the options available in |{WithArrows}|. This sequence will be
% used in the error messages and can be modified dynamically.
%    \begin{macrocode}
\seq_new:N \l_@@_options_WithArrows_seq
\seq_set_from_clist:Nn \l_@@_options_WithArrows_seq
  { 
    adjust, b, c, code-after, code-before, command-name, displaystyle, end-adjust,
    format, group, groups, i, interline, jot, ll, lr, more-columns, name,
    no-arrows, rl, rr, show-node-names, show-nodes, start-adjust, t, tikz,
    tikz-code, xoffset, ygap, ystart
  } 
%    \end{macrocode}
%
% \medskip
%    \begin{macrocode}
\keys_define:nn { WithArrows / WithArrows } 
  { 
    unknown .code:n  = 
      \@@_sort_seq:N \l_@@_options_WithArrows_seq 
      \@@_error:n { Unknown~option~WithArrows } 
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\keys_define:nn { WithArrows / DispWithArrows } 
  { 
    unknown .code:n  = 
      \@@_sort_seq:N \l_@@_options_DispWithArrows_seq
      \@@_error:n { Unknown~option~DispWithArrows } 
  }
%    \end{macrocode}
%
% \bigskip
% A sequence of the options available in |{DispWithArrows}|. This sequence will
% be used in the error messages and can be modified dynamically.
%    \begin{macrocode}
\seq_new:N \l_@@_options_DispWithArrows_seq
\seq_set_from_clist:Nn \l_@@_options_DispWithArrows_seq
  { 
    allow-multiple-labels, code-after, code-before, command-name, tikz-code, adjust,
    displaystyle, end-adjust, fleqn, group, format, groups, i, interline, jot,
    ll, lr, mathindent, name, no-arrows, nonumber, notag, rl, rr,
    show-node-names, show-nodes, start-adjust, tagged-lines, tikz, wrap-lines,
    xoffset, ygap, ystart 
  }
%    \end{macrocode}
% 
%
%    \begin{macrocode}
\keys_define:nn { WithArrows / WithArrowsOptions } 
  { 
    allow-duplicate-names .code:n = 
      \@@_msg_redirect_name:nn { Duplicate~name } { none } ,
    allow-duplicate-names .value_forbidden:n = true ,
    unknown .code:n  = 
      \@@_sort_seq:N \l_@@_options_WithArrowsOptions_seq
      \@@_error:n { Unknown~option~WithArrowsOptions } 
  }
%    \end{macrocode}
% 
%
% \bigskip
% A sequence of the options available in |\WithArrowsOptions|. This sequence
% will be used in the error messages and can be modified dynamically.
%    \begin{macrocode}
\seq_new:N \l_@@_options_WithArrowsOptions_seq
\seq_set_from_clist:Nn \l_@@_options_WithArrowsOptions_seq
  { 
    allow-duplicate-names, allow-multiple-labels, b, c, command-name,
    more-columns, tikz-code, adjust, displaystyle, end-adjust, fleqn, group,
    groups, i, interline, jot, ll, lr, mathindent, no-arrows, nonumber, notag,
    rl, rr, show-node-names, show-nodes, standard-behaviour-with-items,
    start-adjust, t, tagged-lines, tikz, wrap-lines, xoffset, ygap, ystart 
  }
%    \end{macrocode}
% 
% \bigskip
% The command |\@@_set_independent:| is a command without argument that will be
% used to specify that the arrow will be ``independent'' (of the potential
% groups of the option |group| or |groups|). This information will be stored in
% the field ``status'' of the arrow. Another value of the field ``status'' is
% ``new-group''.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_set_independent:
  { 
    \str_if_empty:NTF \l_@@_previous_key_str
      {
        \str_set_eq:NN \l_@@_previous_key_str \l_keys_key_tl
        \str_set:Nn \l_@@_status_arrow_str { independent } 
        \str_if_eq:VnF \l_keys_value_tl { NoValue } 
          { \@@_error:n { Value~for~a~key } }
      }
      { \@@_error:n { Incompatible~options~in~Arrow } }
  }
%    \end{macrocode}
%
% \bigskip
% The options of an individual arrow are parsed twice. The first pass is when
% the command |\Arrow| is read. The second pass is when the arrows are drawn
% (after the end of the environment |{WithArrows}| or |{DispWithArrows}|). Now,
% we present the keys set for the first pass. The main goal is to extract
% informations which will be necessary during the scan of the arrows. For
% instance, we have to know if some arrows are ``independent'' or use the
% option ``new-group''.
%    \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / FirstPass }
  { 
    jump .code:n = 
      \int_compare:nTF { #1 > 0 }
        { \int_set:Nn \l_@@_jump_int { #1 } }
        { \@@_error:n { Negative~jump } } ,
    jump .value_required:n  = true,
    rr .code:n = \@@_set_independent: ,
    ll .code:n = \@@_set_independent: ,
    rl .code:n = \@@_set_independent: ,
    lr .code:n = \@@_set_independent: ,
    i  .code:n = \@@_set_independent: ,
    rr .default:n = NoValue ,
    ll .default:n = NoValue ,
    rl .default:n = NoValue ,
    lr .default:n = NoValue ,
    i  .default:n = NoValue ,
    new-group .value_forbidden:n = true,
    new-group .code:n = 
      \int_compare:nTF { \l_@@_pos_arrow_int = 6 }
        { \str_set:Nn \l_@@_status_arrow_str { new-group } }
        { \@@_error:n { new-group~without~groups } } , 
%    \end{macrocode}
%
% \medskip
% The other keys don't give any information necessary during the scan of the
% arrows. However, you try to detect errors and that's why all the keys are
% listed in this keys set. An unknown key will be detected at the point of the
% command |\Arrow| and not at the end of the environment.
%    \begin{macrocode}
    tikz-code .code:n = \prg_do_nothing: ,
    tikz-code .value_required:n = true ,
    tikz .code:n = \prg_do_nothing: ,
    tikz .value_required:n = true ,
%    \end{macrocode}
%
% \medskip
% The option |xoffset| is not allowed when the option |group| or the option
% |groups| is used (since it would be meaningless).
%    \begin{macrocode}
    xoffset .code:n = 
      \int_compare:nNnT \l_@@_pos_arrow_int > 5
        { \@@_error:n { Option~xoffset~forbidden } } ,
    xoffset .value_required:n = true ,
    start-adjust .code:n = \prg_do_nothing: ,
    start-adjust .value_required:n = true ,
    end-adjust .code:n = \prg_do_nothing: ,
    end-adjust .value_required:n = true ,
    adjust .code:n  = \prg_do_nothing: ,
    adjust .value_required:n = true ,
    unknown .code:n = 
      \@@_sort_seq:N \l_@@_options_Arrow_seq
      \@@_error:n { Unknown~option~in~Arrow }
  }
%    \end{macrocode}
%
%
% \bigskip
% A sequence of the options available in |\Arrow|. This sequence will be used in
% the error messages and can be modified dynamically.
%    \begin{macrocode}
\seq_new:N \l_@@_options_Arrow_seq
\seq_set_from_clist:Nn \l_@@_options_Arrow_seq
  { 
    adjust, end-adjust, i, jump, ll, lr, rl, rr, start-adjust, tikz, tikz-code,
    xoffset 
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_fix_pos_arrow:n #1
  { 
    \str_if_empty:NT \l_@@_previous_key_str
      { 
        \str_set_eq:NN \l_@@_previous_key_str \l_keys_key_tl
        \int_set:Nn \l_@@_pos_arrow_int { #1 } 
      }
  }
%    \end{macrocode}
%
% \bigskip
% The options of the individual commands |\Arrows| are scanned twice. The second
% pass is just before the drawing of the arrow. In this set of keys, we don't
% put an item for the unknown keys because an unknown key would have been
% already detected during the first pass.
%
%    \begin{macrocode} 
\keys_define:nn {WithArrows / Arrow / SecondPass }
  { 
    tikz-code .tl_set:N = \l_@@_tikz_code_tl ,
    tikz-code .initial:n = \draw~(#1)~to~node{#3}~(#2)~; ,
    tikz .code:n = \tikzset { WithArrows / arrow / .append~style = { #1 } } ,
    tikz .initial:n = \c_empty_tl ,
    rr .code:n = \@@_fix_pos_arrow:n 3 ,
    ll .code:n = \@@_fix_pos_arrow:n 1 ,
    rl .code:n = \@@_fix_pos_arrow:n 2 ,
    lr .code:n = \@@_fix_pos_arrow:n 0 ,
    i  .code:n = \@@_fix_pos_arrow:n 5 ,
%    \end{macrocode}
%
% \medskip
% The option |xoffset| is not allowed when the option |group| or the option 
% |groups| is used (since it would be meaningless). An error has been raised 
% during the first pass. Here, we manage to avoid a second error which
% would be redundant.
%    \begin{macrocode}
    xoffset .code:n  = 
      \int_compare:nNnF \l_@@_pos_arrow_int > 5
        { \dim_set:Nn \l_@@_xoffset_dim { #1 } } ,
    start-adjust .dim_set:N = \l_@@_start_adjust_dim,
    end-adjust .dim_set:N = \l_@@_end_adjust_dim,
    adjust .code:n  =  
      \dim_set:Nn \l_@@_start_adjust_dim { #1 }
      \dim_set:Nn \l_@@_end_adjust_dim { #1 } ,
  }
%    \end{macrocode}
% 
% \bigskip
% |\WithArrowsOptions| is the command of the \pkg{witharrows} package to fix
% options at the document level. It's possible to fix in |\WithArrowsOptions|
% some options specific to |{WithArrows}| (in contrast with |{DispWithArrows}|)
% or specific to |{DispWithArrows}| (in contrast with |{WithArrows}|). That's
% why we have constructed a set of keys specific to |\WithArrowsOptions|.
%    \begin{macrocode}
\NewDocumentCommand \WithArrowsOptions { m }
  { 
    \str_clear_new:N \l_@@_previous_key_str
    \keys_set:nn { WithArrows / WithArrowsOptions } { #1 } 
  }
%    \end{macrocode}
%
% 
% \bigskip
% \subsection{The command \textbackslash Arrow}
%
% In fact, the internal command is not named |\Arrow| but |\@@_Arrow|. Usually,
% at the beginning of an environment |{WithArrows}|, |\Arrow| is set to be
% equivalent to |\@@_Arrow|. However, the user can change the name with the
% option |command-name| and the user command for |\@@_Arrow| will be different.
% This mechanism can be useful when the user has already a command named
% |\Arrow| he still wants to use in the environments |{WithArrows}| or
% |{DispWithArrows}|. 
%
% \medskip
%    \begin{macrocode}
\NewDocumentCommand \@@_Arrow { O { } m ! O { } }
  {
%    \end{macrocode}
%
% The counter |\g_@@_arrow_int| counts the arrows in the environment. The
% incrementation must be global (|gincr|) because the command |\Arrow| will be
% used in the cell of a |\halign|. It's recalled that we manage a stack for this
% counter.
%    \begin{macrocode}
    \int_gincr:N \g_@@_arrow_int
%    \end{macrocode}
% 
% \medskip
% We will construct a global property list to store the informations of the
% considered arrow. The six fields of this property list are ``initial'',
% ``final'', ``status'', ``options'', ``label'' and ``input-line''. In order to
% compute the value of ``final'' (the destination row of the arrow), we have to
% take into account a potential option |jump|. In order to compute the value of
% the field ``status'', we have to take into account options as |ll|, |rl|,
% |rr|, |lr|, etc. or |new-group|.
% 
% We will do that job with a first analyze of the options of the command
% |\Arrow| with a dedicated set of keys called |WithArrows/Arrow/FirstPass|.
% 
%    \begin{macrocode}
    \str_clear_new:N \l_@@_previous_key_str
    \keys_set:nn { WithArrows / Arrow / FirstPass } { #1 , #3 } 
%    \end{macrocode}
%
% \medskip
% We construct now a global property list to store the informations of the
% considered arrow with the six fields ``initial'', ``final'', ``status'',
% ``options'', ``label'' and ``input-line''.
%
% \smallskip
% \begin{enumerate}
% \item First, the row from which the arrow starts:
%    \begin{macrocode}
    \prop_put:NnV \l_tmpa_prop { initial } \g_@@_line_int
%    \end{macrocode}
%
% \item The row where the arrow ends (that's why it was necessary to analyze the
% key |jump|):
%    \begin{macrocode}
    \int_set:Nn \l_tmpa_int { \g_@@_line_int + \l_@@_jump_int }
    \prop_put:NnV \l_tmpa_prop { final } \l_tmpa_int
%    \end{macrocode}
%
% \item The ``status'' of the arrow, with 3 possible values: empty,
% |independent|, or |new-group|.
%    \begin{macrocode} 
    \prop_put:NnV \l_tmpa_prop { status } \l_@@_status_arrow_str
%    \end{macrocode}
% 
% \item The options of the arrow (it's a token list):
%    \begin{macrocode}
    \prop_put:Nnn \l_tmpa_prop { options } { #1 , #3 }
%    \end{macrocode}
%
% \item The label of the arrow (it's also a token list):
%    \begin{macrocode}
    \prop_put:Nnn \l_tmpa_prop { label } { #2 }
%    \end{macrocode}
% 
% \item The number of the line where the command |\Arrow| is issued in the TeX
% source (as of now, this is only useful for an error message).
%    \begin{macrocode}
    \prop_put:Nnx \l_tmpa_prop { input-line } \msg_line_number:
%    \end{macrocode}
% \end{enumerate}
%
% The property list has been created in a local variable for convenience. Now,
% it will be stored in a global variable indicating both the
% position-in-the-tree and the number of the arrow.
% 
%    \begin{macrocode}
    \prop_gclear_new:c 
      { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \g_@@_arrow_int _ prop }
    \prop_gset_eq:cN 
      { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \g_@@_arrow_int _ prop } 
      \l_tmpa_prop
  }       
%    \end{macrocode}
%
% \medskip
% The command |\Arrow| (or the corresponding command with a name given by the
% user with the option |command-name|) will be available only in the last column of
% the environments |{WithArrows}| and |{DispWithArrows}|. In the other columns,
% the command will be linked to the following command |\@@_Arrow_first_columns:|
% which will raise an error.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_Arrow_first_columns: 
  { \@@_error:n { Arrow~not~in~last~column } \@@_Arrow }
%    \end{macrocode}
%                                
%
% \bigskip
% \subsection{The environments \{WithArrows\} and \{DispWithArrows\}}
%
% \subsubsection{Code before the \textbackslash halign}
%
% The command |\@@_pre_halign:n| is a code common to the environments
% |{WithArrows}| and |{DispWithArrows}|. The argument is the list of options
% given to the environment.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_pre_halign:n #1
%    \end{macrocode}
%
% First, the initialisation of |\l_@@_type_env_str| which is the name of the
% encompassing environment. In fact, this token list is used only in the error
% messages.
%    \begin{macrocode}
  { 
    \str_clear_new:N \l_@@_type_env_str
    \str_set:NV \l_@@_type_env_str \@currenvir
%    \end{macrocode}
%
% \bigskip
% We deactivate the potential externalization of Tikz. The Tikz elements created
% by \pkg{witharrows} can't be externalized since they are created in Tikz
% pictures with |overlay| and |remember picture|.
%    \begin{macrocode}
    \cs_if_exist:NT \tikz@library@external@loaded
      { \tikzset { external / export = false } }
%    \end{macrocode}
%
% \bigskip
% The token list |\l_@@_name_str| will contain the potential name of the
% environment (given with the option |name|). This name will be used to create
% aliases for the names of the nodes.
%    \begin{macrocode}
    \str_clear_new:N \l_@@_name_str
%    \end{macrocode}
%
% \bigskip
% The parameter |\l_@@_status_arrow_str| will be used to store the ``status'' of
% an individual arrow. It will be used to fill the field ``status'' in the
% property list describing an arrow.
%    \begin{macrocode}
    \str_clear_new:N \l_@@_status_arrow_str
%    \end{macrocode}
%
% \bigskip
% The dimension |\l_@@_x_dim| will be used to compute the $x$-value for some
% vertical arrows when one of the options |i|, |group| and |groups| (values 5, 6
% and 7 of |\l_@@_pos_arrow_int|) is used.
%    \begin{macrocode}
    \dim_zero_new:N \l_@@_x_dim
%    \end{macrocode}
%
% \medskip
% The variable |\l_@@_input_line_str| will be used only to store, for each
% command |\Arrow| the line (in the TeX file) where the command is issued. This
% information will be stored in the field ``input-line'' of the arrow. As of
% now, this information is used only in the error message of a arrow impossible
% to draw (because it arrives after the last row of the environment).
%    \begin{macrocode}
    \str_clear_new:N \l_@@_input_line_str
%    \end{macrocode}
%
% 
% The initialisation of the counters |\g_@@_arrow_int|, |\g_@@_line_int| and
% |\g_@@_col_int|. However, we have to save their previous values with the
% stacks created for this end. 
%    \begin{macrocode}
    \seq_gput_right:NV \g_@@_arrow_int_seq \g_@@_arrow_int
    \int_gzero:N \g_@@_arrow_int 
    \seq_gput_right:NV \g_@@_line_int_seq \g_@@_line_int
    \int_gzero:N \g_@@_line_int 
    \seq_gput_right:NV \g_@@_col_int_seq \g_@@_col_int
    \int_gzero:N \g_@@_col_int 
%    \end{macrocode}
% 
% \bigskip
% We also have to update the position on the nesting tree.
%    \begin{macrocode}
    \seq_gput_right:Nn \g_@@_position_in_the_tree_seq 1
%    \end{macrocode}
%
% The nesting tree is used to create a prefix which will be used in the names of
% the Tikz nodes and in the names of the arrows (each arrow is a property list
% of six fields). If we are in the second environment |{WithArrows}| nested in
% the third environment |{WithArrows}| of the document, the prefix will be |3-2|
% (although the position in the tree is $[3,2,1]$ since such a position always
% ends with a~$1$). First, we do a copy of the position-in-the-tree and then we
% pop the last element of this copy (in order to drop the last~$1$).
%    \begin{macrocode}
    \seq_set_eq:NN \l_tmpa_seq \g_@@_position_in_the_tree_seq
    \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl
    \str_clear_new:N \l_@@_prefix_str
    \str_set:Nx \l_@@_prefix_str { \seq_use:Nnnn \l_tmpa_seq - - - }
%    \end{macrocode}
% 
% \bigskip
% We define the command |\\| to be the command |\@@_cr:| (defined below). 
%    \begin{macrocode}
    \cs_set_eq:NN \\ \@@_cr:
    \dim_zero:N \mathsurround 
%    \end{macrocode}
%
% \bigskip
% These counters will be used later as variables.
%    \begin{macrocode}
    \int_zero_new:N \l_@@_initial_int
    \int_zero_new:N \l_@@_final_int
    \int_zero_new:N \l_@@_arrow_int
    \int_zero_new:N \l_@@_pos_of_arrow_int
    \int_zero_new:N \l_@@_jump_int
%    \end{macrocode}
%
% \medskip
% The counter |\l_@@_jump_int| corresponds to the option |jump|. Now, we set the
% default value for this option.
%    \begin{macrocode}
    \int_set:Nn \l_@@_jump_int \c_one_int
%    \end{macrocode}
%
% \medskip
% The string |\l_@@_format_str| corresponds to the option |format|. Now, we set
% the default value for this option.
%    \begin{macrocode}
    \str_set:Nn \l_@@_format_str { rl }
%    \end{macrocode}
% 
% \bigskip
% The boolean |\l_@@_last_col_bool| will be used only during the construction of
% the preamble (in |\@@_construct_halign:|).
%    \begin{macrocode}
    \bool_set_true:N \l_@@_last_col_bool
%    \end{macrocode}
%
%
% \bigskip
% In (the last column of) |{DispWithArrows}|, it's possible to put several
% labels (for the same number of equation). That's why these labels will be
% stored in a sequence |\l_@@_labels_seq|.
%    \begin{macrocode}
    \seq_clear_new:N \l_@@_labels_seq
%    \end{macrocode}
%
%    \begin{macrocode}
    \bool_set_false:N \l_@@_tag_next_line_bool
%    \end{macrocode}
% 
% \bigskip
% The value corresponding to the key |interline| is put to zero before the
% treatment of the options of the environment.\footnote{It's recalled that, by
% design, the option |interline| of an environment doesn't apply in the nested
% environments.}
%    \begin{macrocode}
    \skip_zero:N \l_@@_interline_skip
%    \end{macrocode}
%
% \bigskip
% The value corresponding to the key |code-before| is put to nil before the
% treatment of the options of the environment, because, of course, we don't want
% the code executed at the beginning of all the nested
% environments~|{WithArrows}|. Idem for |code-after|. 
%    \begin{macrocode}
    \tl_clear_new:N \l_@@_code_before_tl
    \tl_clear_new:N \l_@@_code_after_tl
%    \end{macrocode}
%
% \bigskip
% We process the options given to the environment |{WithArrows}| or
% |{DispWithArrows}|.
%    \begin{macrocode}
    \str_clear_new:N \l_@@_previous_key_str 
    \bool_if:NT \l_@@_in_WithArrows_bool
      { \keys_set:nn { WithArrows / WithArrows } { #1 } }
    \bool_if:NT \l_@@_in_DispWithArrows_bool
      { \keys_set:nn { WithArrows / DispWithArrows } { #1 } }
%    \end{macrocode}
%
% \medskip
% Now we link the command |\Arrow| (or the corresponding command with a name
% given by the user with the option |command-name|: that's why the following line
% must be after the loading of the options) to the command
% |\@@_Arrow_first_columns:| which will raise an error. 
%    \begin{macrocode}
    \cs_set_eq:cN \l_@@_command_name_str \@@_Arrow_first_columns: 
%    \end{macrocode}
% It's only in the last column of the environment that it will be linked to the
% command |\@@_Arrow:|.
%
% \medskip
% The counter |\l_@@_nb_of_columns_int| is the number of columns in the
% |\halign| (excepted the column for the labels of equations in
% |{DispWithArrows}| and excepted evenutals other columns in |{WithArrows}| if
% the user uses the option |more-columns|).
%    \begin{macrocode}
    \int_set:Nn \l_@@_nb_of_columns_int { \str_count:N \l_@@_format_str } 
%    \end{macrocode}
%
% \medskip
% We convert the format in a sequence because we use it as a stack in the
% construction of the preamble.
%    \begin{macrocode}
    \seq_clear_new:N \l_@@_format_seq
    \seq_set_split:NnV \l_@@_format_seq { } \l_@@_format_str
%    \end{macrocode}
%
% \bigskip
% If the option |footnote| or the option |footnotehyper| is used, then we
% extract the footnotes with an environment |{savenotes}| (of the package
% \pkg{footnote} or the package \pkg{footnotehyper}).
%    \begin{macrocode}
    \bool_if:NT \g_@@_footnote_bool { \begin { savenotes } }
%    \end{macrocode}
%
% \bigskip
% We execute the code |\l_@@_code_before_tl| of the option |code-before| of the
% environment after the eventual |\begin{savenotes}| and, symetrically, we will
% execute the |\l_@@_code_after_tl| before the eventual |\end{savenotes}| (we
% have a good reason for the last point: we want to extract the footnotes of the
% arrows executed in the |code-after|).
%    \begin{macrocode}
    \l_@@_code_before_tl
%    \end{macrocode}
%
% \bigskip
% The command |\spread@equation| is the command used by \pkg{amsmath} in the
% beginning of an alignment to fix the interline. When used, it becomes no-op.
% However, it's possible to use \pkg{witharrows} without \pkg{amsmath} since we
% have redefined |\spread@equation| (if it is not defined yet).
%    \begin{macrocode}
    \spread@equation
%    \end{macrocode}
%
%
%    \begin{macrocode}
    \cs_set_eq:NN \notag \@@_notag:
    \cs_set_eq:NN \nonumber \@@_notag:
    \cs_set_eq:NN \tag \@@_tag
    \cs_set_eq:NN \@@_old_label \label
    \cs_set_eq:NN \label \@@_label:n
    \cs_set_eq:NN \tagnextline \@@_tagnextline:
  }
%    \end{macrocode}
% This is the end of |\@@_pre_halign:n|.
%
% \bigskip
% \subsubsection{The construction of the preamble of the \textbackslash halign}
%
% The control sequence |\@@_construct_halign:| will ``start'' the |\halign| and
% the preamble. In fact, it constructs all the preamble excepted the end of
% the last column (more precisely: except the part concerning the construction
% of the left node and the right node).
%
% The same function |\@@_construct_halign:| will be used both for |{WithArrows}|
% and |{DispWithArrows}|.
% 
% Several important points must be noted concerning that construction of the
% preamble.
% \begin{itemize}
% \item The construction of the preamble is done by reading backwards the
% format |\l_@@_format_str| and adding the corresponding tokens in the input
% stream of TeX. That means that the part of the preamble concerning the last
% cell will be constructed first.
% \item The function |\@@_construct_halign:| is recursive in order to treat
% succesively all the letters of the preamble.
% \item Each part of the preamble is created with a |\use:x| function. This
% expansion of the preamble gives the ability of controlling which parts of the
% code will be expanded during the construction of the preamble (other parts
% will be expanded and executed only during the execution of the |\halign|).
% \end{itemize}
% 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_construct_halign:
  {
    \seq_pop_right:NNTF \l_@@_format_seq \l_@@_type_col_str
      {
%    \end{macrocode}
% Here is the |\use:x| which is fundamental: it will really construct the part
% of the preamble corresponding to a column by expanding only some parts of the
% following code.
%    \begin{macrocode}
        \use:x
          {
%    \end{macrocode}
% Before the recursive call of |\@@_construct_halign:|, 
% we lower the flag |\l_@@_last_col_bool| in order that all the recursive calls
% will know that they are not in the last column. But, during the construction
% of the first column, it is \emph{not} lowered because |\bool_set_false:N|,
% which is protected, won't be expanded by the |\use:x|.
%
% We begin the construction of a generic column.
%    \begin{macrocode}
            \bool_set_false:N \l_@@_last_col_bool 
            \@@_construct_halign:
            \bool_if:NT \l_@@_last_col_bool 
              { 
%    \end{macrocode}
% We redefine the command |\Arrow| (or the name given to the corresponding
% command by the option |command-name|) in each cell of the last column.
% The braces around |\l_@@_command_name_str| are mandatory because
% |\l_@@_command_name_str| will be expanded by the |\use:x| and the command
% |\cs_set_eq:cN| must still be efficient during the execution of the |\halign|.
%    \begin{macrocode}
                \cs_set_eq:cN { \l_@@_command_name_str } \@@_Arrow
                \bool_if:NT \l_@@_in_DispWithArrows_bool
                  {
%    \end{macrocode}
% The command |\@@_test_if_to_tag:| (which is protected and, thus, will not be
% expanded during the construction of the preamble) will test, at each row,
% whether the current row must be tagged (and the tag will be put in the very
% last column).
%    \begin{macrocode}
                    \@@_test_if_to_tag:
%    \end{macrocode}
% The command |\@@_set_qedhere:| will do a redefinition of |\qedhere| in each
% cell of the last column.
%    \begin{macrocode}
                    \bool_if:NT \c_@@_amsthm_loaded_bool \@@_set_qedhere:
                  }
              }
            \str_if_eq:VnT \l_@@_type_col_str { c } \hfil
            \str_if_eq:VnT \l_@@_type_col_str { r } \hfill
            \int_gincr:N \g_@@_col_int
            $ % $
              {
                { }
                \bool_if:NT \l_@@_displaystyle_bool \displaystyle
                ####
              }
            $ % $
            \bool_if:NTF \l_@@_last_col_bool
              { \@@_construct_nodes: }
              {
%    \end{macrocode}
% The following glue (|\hfil|) will be added only if we are not in the last cell
% because, in the last cell, a glue is added beetween the nodes (in
% |\@@_construct_nodes:|). 
%    \begin{macrocode}
                \str_if_eq:VnT \l_@@_type_col_str { l } \hfil
                \str_if_eq:VnT \l_@@_type_col_str { c } \hfil
                \bool_if:NT \l_@@_in_DispWithArrows_bool { \tabskip = \c_zero_skip }
                &
              }
          } 
      }
%    \end{macrocode}
% Now the tokens that will be inserted after the analyze of all the tokens of
% the format: here is the token |\halign|.
%    \begin{macrocode}
      { 
        \bool_if:NTF \l_@@_in_WithArrows_bool
          {
            \ialign
            \bgroup
          }
          {
            \halign to
            \bool_if:NTF \l_@@_inlabel_bool \linewidth \displaywidth
            \bgroup
            \bool_if:NT \l_@@_fleqn_bool
              { \skip_horizontal:N \l_@@_mathindent_dim }
          }
        \int_gincr:N \g_@@_line_int 
        \int_gzero:N \g_@@_col_int
        \strut
      }
  }
%    \end{macrocode}
% 
%
% \bigskip
% The command |\@@_construct_nodes:| is only for the lisibility of the code
% because, in fact, it is used only once. It construct the ``left node'' and the
% ``right node'' at the end of each row of the arrow.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_construct_nodes:
  { 
%    \end{macrocode}
% We create the ``left node'' of the line (when using macros in Tikz node names,
% the macros have to be fully expandable: here, |\int_use:N| is fully
% expandable).
%    \begin{macrocode}
    \tikz [ remember~picture , overlay ] 
      \node 
        [ 
          node~contents = { } ,
          @@_node_style ,
          name = wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int - l ,
          alias = 
            { 
              \str_if_empty:NF \l_@@_name_str
                { \l_@@_name_str - \int_use:N \g_@@_line_int - l }
            } 
        ] 
        ;
    \hfil
%    \end{macrocode}
%
% \bigskip
% Now, after the |\hfil|, we create the ``right node'' and, if the option
% |show-node-names| is raised, the name of the node is written in the document
% (useful for debugging).
%    \begin{macrocode}
    \tikz [ remember~picture , overlay ] 
      \node 
        [ 
          node~contents = { } ,
          @@_node_style ,
          name = wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int - r ,
          alias = 
            {
              \str_if_empty:NF \l_@@_name_str
                { \l_@@_name_str - \int_use:N \g_@@_line_int - r }
            } 
        ] 
        ;
    \bool_if:NT \l_@@_show_node_names_bool
      { 
        \hbox_overlap_right:n 
          { \small wa - \l_@@_prefix_str - \int_use:N \g_@@_line_int - r }
      }
  }
%    \end{macrocode}
%
%
%
% \bigskip
% \subsubsection{The environment \{WithArrows\}}
%
%
% 
%    \begin{macrocode}
\NewDocumentEnvironment { WithArrows } { ! O { } }
  { 
    \bool_set_true:N \l_@@_in_WithArrows_bool
    \bool_set_false:N \l_@@_in_DispWithArrows_bool
    \@@_pre_halign:n { #1 } 
    \if_mode_math: \else:
      \@@_error:n { WithArrows~outside~math~mode }
    \fi:
%    \end{macrocode}
%
% \bigskip 
% The environment begins with a |\vtop|, a |\vcenter| or a
% |\vbox|\footnote{Notice that the use of |\vtop| seems color-safe here...}
% depending of the value of |\l_@@_pos_env_int| (fixed by the options |t|, |c|
% or |b|). The environment |{WithArrows}| must be used in math mode\footnote{An
% error is raised if the environment is used outside math mode.} and therefore,
% we can use |\vcenter|.
%    \begin{macrocode}
    \int_case:nn \l_@@_pos_env_int { 0 \vtop 1 \vcenter 2 \vbox }
    \bgroup
%    \end{macrocode}
%
% \bigskip
% We begin the |\halign| and the preamble.
%    \begin{macrocode}
    \@@_construct_halign: 
%    \end{macrocode}
% 
% 
% \medskip
% In fact, the construction of the preamble is not finished. We add a little more.
% 
% \medskip
% An environmemnt |{WithArrows}| should have a number of columns equal to the
% length of its format (by default, 2 since the default format is |rl|).
% Nevertheless, if the user wants to use more columns (without arrows)
% it's possible with the option |more-columns|.
%    \begin{macrocode}
    && 
    \@@_error:n { Too~much~columns~in~WithArrows }
    $ 
    \bool_if:NT \l_@@_displaystyle_bool \displaystyle 
    { ## } 
    $
    \cr
  }
%    \end{macrocode}
%
%
% \bigskip 
% We begin the second part of the environment |{WithArrows}|. We have two
% |\egroup|\,: one for the |\halign| and one for the |\vtop| (or |\vcenter| or
% |\vbox|).
%    \begin{macrocode}
  {
    \\
    \egroup 
    \egroup
    \@@_post_halign:
%    \end{macrocode}
%
% \bigskip
% If the option |footnote| or the option |footnotehyper| is used, then we
% extract the footnotes with an environment |{footnote}| (of the package
% \pkg{footnote} or the package \pkg{footnotehyper}).
%    \begin{macrocode}
    \bool_if:NT \g_@@_footnote_bool { \end { savenotes } }
  }
%    \end{macrocode}
% This is the end of the environment |{WithArrows}|.
% 
%
% \bigskip
% \subsubsection{After the construction of the \textbackslash halign}
%
% The command |\@@_post_halign:| is a code common to the second part of the
% environment |{WithArrows}| and the environment |{DispWithArrows}|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_post_halign:
%    \end{macrocode}
%
% \bigskip
% The command |\WithArrowsRightX| is not used by \pkg{witharrows}. It's only a
% convenience given to the user.
%    \begin{macrocode}
  { 
    \cs_set:Npn \WithArrowsRightX { \g_@@_right_x_dim }  
%    \end{macrocode}
%
% \bigskip 
% It there is really arrows in the environment, we draw the arrows.
%    \begin{macrocode}
    \int_compare:nNnT \g_@@_arrow_int > 0 \@@_scan_arrows:
%    \end{macrocode}
%
% \bigskip
% We will execute the code specified in the option |code-after|, after some
% settings. 
%    \begin{macrocode}
    \group_begin:
      \tikzset { every~picture / .style = @@_standard }
%    \end{macrocode}
% The command |\WithArrowsNbLines| is not used by \pkg{witharrows}. It's only a
% convenience given to the user.  
%    \begin{macrocode}
      \cs_set:Npn \WithArrowsNbLines { \int_use:N \g_@@_line_int }
%    \end{macrocode}
% The command |\MultiArrow| is available in |code-after|, and we have a special
% version of |\Arrow|, called ``|\Arrow| in |code-after|'' in the
% documentation.\footnote{As for now, |\MultiArrow| has no option, and that's
% why its internal name is a name of \pkg{expl3} with the signature |:nn|
% whereas |\Arrow| in |code-after| provides options and has the name of a
% function defined with |\NewDocumentCommand|.}
%    \begin{macrocode}
      \cs_set_eq:NN \MultiArrow \@@_MultiArrow:nn
      \cs_set_eq:cN \l_@@_command_name_str \@@_Arrow_code_after
      \bool_set_true:N \l_@@_in_code_after_bool
      \l_@@_code_after_tl
    \group_end:
%    \end{macrocode}
%
% \bigskip
% We update the position-in-the-tree. First, we drop the last component and then
% we increment the last element.
%    \begin{macrocode}
    \seq_gpop_right:NN \g_@@_position_in_the_tree_seq \l_tmpa_tl
    \seq_gpop_right:NN \g_@@_position_in_the_tree_seq \l_tmpa_tl
    \seq_gput_right:Nx \g_@@_position_in_the_tree_seq 
      { \int_eval:n { \l_tmpa_tl + 1 } }
%    \end{macrocode}
%
% \bigskip
% We update the value of the counter |\g_@@_last_env_int|. This counter is used
% only by the user function |\WithArrowsLastEnv|.
%    \begin{macrocode}
    \int_compare:nNnT { \seq_count:N \g_@@_position_in_the_tree_seq } = 1
      { \int_gincr:N \g_@@_last_env_int }
%    \end{macrocode}
%
% \bigskip
% Finally, we restore the previous values of the counters |\g_@@_arrow_int|,
% |\g_@@_line_int| and |\g_@@_col_int|. It is recalled that we manage three
% stacks in order to be able to do such a restoration.
%    \begin{macrocode}
    \seq_gpop_right:NN \g_@@_arrow_int_seq \l_tmpa_tl 
    \int_gset:Nn \g_@@_arrow_int \l_tmpa_tl 
    \seq_gpop_right:NN \g_@@_line_int_seq \l_tmpa_tl
    \int_gset:Nn \g_@@_line_int \l_tmpa_tl
    \seq_gpop_right:NN \g_@@_col_int_seq \l_tmpa_tl
    \int_gset:Nn \g_@@_col_int \l_tmpa_tl
  }
%    \end{macrocode}
% That's the end of the command |\@@_post_halign:|.
%
% \bigskip
% \subsubsection{The command of end of row}
%
% We give now the definition of |\@@_cr:| which is the definition of |\\| in an
% environment |{WithArrows}|. The two \pkg{expl3} commands
% |\group_align_safe_begin:| and |\group_align_safe_end:| are specifically
% designed for this purpose: test the token that follows in an |\halign|
% structure.
%
% First, we remove an eventual token |*| (just after the |\\|: there should not
% be space between the two) since the commands |\\| and |\\*| are equivalent in
% an environment |{WithArrows}| (an environment |{WithArrows}|, like an
% environment |{aligned}| of \pkg{amsmath}, is always unbreakable). 
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cr:
  { 
    \scan_stop:
    \prg_replicate:nn { \l_@@_nb_of_columns_int - \g_@@_col_int } { & { } } 
    \group_align_safe_begin:
    \peek_meaning_remove:NTF * \@@_cr_i: \@@_cr_i:
  }
%    \end{macrocode}
%
% \medskip
% Then, we peek the next token to see if it's a |[|. In this case, the command
% |\\| has an optional argument which is the vertical skip (=glue) to put.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cr_i:
  { \peek_meaning:NTF [ \@@_cr_ii: { \@@_cr_ii: [ \c_zero_dim ] } }
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_cr_ii: [ #1 ]
  { 
    \group_align_safe_end:
%    \end{macrocode}
% For the environment |{DispWithArrows}|, the behaviour of |\\| is different
% because we add the third column which is the column for the tag (number of the
% equation). Even if there is no tag, the third column is used for the
% |v|-nodes.
%    \begin{macrocode}
    \bool_if:NT \l_@@_in_DispWithArrows_bool
%    \end{macrocode}
% At this stage, we know that we have a tag to put if (and only if) the value of
% |\l_@@_tags_clist| is the comma list |all| (only one element). Maybe,
% previously, the value of |\l_@@_tags_clist| was, for example, |1,last| (which
% means that only the first line and the last line must be tagged). However, in
% this case, the comparison with the number of line has be done before and, now,
% if we are in a line to tag, the value of |\l_@@_tags_clist| is |all|.
%    \begin{macrocode}
      { 
        \clist_if_in:NnTF \l_@@_tags_clist { all }
          {
%    \end{macrocode}
% Here, we can't use |\refstepcounter{equation}| because if the user has issued
% a |\tag| command, we have to use |\l_@@_tag_tl| and not |\theequation|. That's
% why we have to do the job done by |\refstepcounter| manually.
% 
% First, the incrementation of the counter (potentially).
%    \begin{macrocode}
            \tl_if_empty:NT \l_@@_tag_tl { \int_gincr:N \c@equation }
%    \end{macrocode}
% 
% We store in |\g_tmpa_tl| the tag we will have to compose at the end of the
% line. We use a global variable because we will use it in the \emph{next} cell
% (after the |&|).
%    \begin{macrocode}
            \cs_gset:Npx \g_tmpa_tl
              { \tl_if_empty:NTF \l_@@_tag_tl \theequation \l_@@_tag_tl }
%    \end{macrocode}
% It's possible to put several labels for the same line (it's not possible in
% the environments of \pkg{amsmath}). That's why the differents labels of a same
% line are stored in a sequence |\l_@@_labels_seq|.
%    \begin{macrocode}
            \seq_if_empty:NF \l_@@_labels_seq
              {
%    \end{macrocode}
% Now, we do the job done by |\refstepcounter| and by the redefinitions of
% |\refstepcounter| done by some packages (the incrementation of the counter has
% been done yet).
%
% First an action which is in the definition of |\refstepcounter|. The command
% |\p@equation| is redefined by some extensions like \pkg{fncylab}.
%    \begin{macrocode}
                \cs_set:Npx \@currentlabel { \p@equation \g_tmpa_tl }
%    \end{macrocode}
% Then, an action done by \pkg{hyperref} in its redefinition of
% |\refstepcounter|.
%    \begin{macrocode}
                \bool_if:NT \c_@@_hyperref_loaded_bool
                  { 
                    \str_set:Nn \This@name { equation }
                    \hyper@refstepcounter { equation }
                  }
%    \end{macrocode}
% Then, an action done by \pkg{cleveref} in its redefinition of
% |\refstepcounter|. The package \pkg{cleveref} creates in the |aux| file a
% command |\cref@currentlabel| similar to |\@currentlabel| but with more
% informations.
%    \begin{macrocode}        
                \bool_if:NT \c_@@_cleveref_loaded_bool
                  {
                    \cref@constructprefix { equation } \cref@result
                    \protected@edef \cref@currentlabel
                      { 
                        [ 
                          \cs_if_exist:NTF \cref@equation@alias 
                            \cref@equation@alias 
                            { equation } 
                        ] 
                        [ \arabic { equation } ] [ \cref@result ]
                        \p@equation \g_tmpa_tl
                      }
                  }
%    \end{macrocode}
% Now, we can issue the command |\label| (some packages may have redefined
% |\label|, for example \pkg{typedref}) for each item in the sequence of the
% labels (it's possible with \pkg{witharrows} to put several labels to the same
% line and that's why the labels are in the sequence |\l_@@_labels_seq|).
%    \begin{macrocode}
                \seq_map_function:NN \l_@@_labels_seq \@@_old_label
              }
%    \end{macrocode}
% We save the booleans |\l_@@_tag_star_bool| and |\l_@@_qedhere_bool| because
% they will be used in the \emph{next} cell (after the |&|). We recall that the
% cells of a |\halign| are TeX groups.
%    \begin{macrocode}
            \@@_save:N \l_@@_tag_star_bool
            \@@_save:N \l_@@_qedhere_bool
            \bool_if:NT \l_@@_tag_next_line_bool 
              { 
                \openup -\jot 
                \bool_set_false:N \l_@@_tag_next_line_bool 
                \notag \\ & 
              }
            & 
            \@@_restore:N \l_@@_tag_star_bool
            \@@_restore:N \l_@@_qedhere_bool
            \bool_if:NT \l_@@_qedhere_bool 
               { \hbox_overlap_left:n \@@_qedhere_i: }
            \cs_set_eq:NN \theequation \g_tmpa_tl
            \bool_if:NT \l_@@_tag_star_bool 
              { \cs_set_eq:NN \tagform@ \prg_do_nothing: }
%    \end{macrocode}
% We use |\@eqnnum| (we recall that there are two definitions of |\@eqnnum|, a
% standard definition and another, loaded if the class option |leqno| is used).
% However, of course, the position of the |v|-node is not the same whether the
% option |leqno| is used or not. That's here that we use the flag
% |\c_@@_leqno_bool|.
%    \begin{macrocode}
            \hbox_overlap_left:n 
              { 
                \bool_if:NF \c_@@_leqno_bool
                  { 
                    \tikz [ @@_standard ] 
                      \coordinate ( \int_use:N \g_@@_line_int - v ) ; 
                  }
                \quad
                \@eqnnum 
              }
            \bool_if:NT \c_@@_leqno_bool
              { 
                \tikz [ @@_standard ] 
                  \coordinate ( \int_use:N \g_@@_line_int - v ) ; 
              } 
          }
          { 
            \@@_save:N \l_@@_qedhere_bool 
            & 
            \@@_restore:N \l_@@_qedhere_bool
            \bool_if:NT \l_@@_qedhere_bool 
               { \hbox_overlap_left:n \@@_qedhere_i: }
            \tikz [ @@_standard ] 
               \coordinate ( \int_use:N \g_@@_line_int - v ) ; 
          }
      }
    \cr \noalign { \skip_vertical:n { #1 + \l_@@_interline_skip } \scan_stop: } 
  }
%    \end{macrocode}
% According to the documentation of \pkg{expl3}, the previous addition in 
% ``|#1 + \l_@@_interline_skip|'' is really an addition of skips (=glues).
%
% \bigskip
% \subsubsection{The environment \{DispWithArrows\}}
%
% For the environment |{DispWithArrows}|, the general form of the construction
% is of the type:
%
% |\[\vtop{\halign to \displaywidth {...}}\]|
% 
% The purpose of the |\vtop| is to have an environment unbreakable.
%
% However, if we are juste after an item of a LaTeX list, the construction is
% slightly different:
%
% |\[\vtop{\halign to \linewidth {...}}\]|
% 
% 
% \bigskip
% The boolean |\l_@@_inlabel_bool| will be raised if we are just after a |\item|
% of a list of LaTeX.
%    \begin{macrocode}
\bool_new:N \l_@@_inlabel_bool
%    \end{macrocode}
%
% 
%    \begin{macrocode}
\NewDocumentEnvironment { DispWithArrows } { ! O { } }
  { 
%    \end{macrocode}
% If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we disable
% the code of \pkg{mathtools} for the option |showonlyrefs| with the command
% |\MT_showonlyrefs_false:| (it will be reactivated at the end of the
% environment). 
%    \begin{macrocode}
    \bool_if:nT \c_@@_mathtools_loaded_bool 
      { 
        \MH_if_boolean:nT { show_only_refs } 
          {
            \MT_showonlyrefs_false:
%    \end{macrocode}
% However, we have to re-raise the flag |{show_only_refs}| of \pkg{mhsetup}
% because it has been switched off by |\MT_showonlyrefs_false:| and we will use
% it in the code of the new version of |\label|.
%    \begin{macrocode}
            \MH_set_boolean_T:n { show_only_refs } 
          }
      }
%    \end{macrocode}
%
% An action done by \pkg{typedref} in its redefinition of |\refstepcounter|. The
% command |\sr@name| is a prefix added to the name of the label by the
% redefinition of |\label| done by \pkg{typedref}.
%    \begin{macrocode}
    \bool_if:NT \c_@@_typedref_loaded_bool { \str_set:Nn \sr@name { equation } }
%    \end{macrocode}
%
% The command |\intertext@| is a command of \pkg{amsmath} which loads the
% definition of |\intertext|.
%    \begin{macrocode}
    \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@
    \bool_set_true:N \l_@@_in_DispWithArrows_bool
    \@@_pre_halign:n { #1 }
%    \end{macrocode}
%
% Since the version 1.16 of \pkg{witharrows}, no space is added between an
% |\item| of a LaTeX list and an environment |{DispWithArrows}| except with the
% option |standard-behaviour-with-items| stored in the boolean
% |\l_@@_sbwi_bool|. We have to know if we are just after an |\item| and this
% information will be stored in |\l_@@_inlabel_bool|.
%    \begin{macrocode}
    \bool_if:NF \l_@@_sbwi_bool
      {  
        \if@inlabel
        \bool_set_true:N \l_@@_inlabel_bool
        \fi
      }
%    \end{macrocode}
% 
% \bigskip
% The token list |\l_@@_tag_tl| will contain the argument of the command |\tag|.
%    \begin{macrocode}
    \tl_clear_new:N \l_@@_tag_tl
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
    \bool_set_false:N \l_@@_qedhere_bool
%    \end{macrocode}
%
% \bigskip
% The boolean |\l_@@_tag_star_bool| will be raised if the user uses the command
% |\tag| with a star.
%    \begin{macrocode}
    \bool_set_false:N \l_@@_tag_star_bool
%    \end{macrocode}
% 
%    \begin{macrocode}
    \if_mode_math:
      \@@_error:n { DispWithArrows~in~math~mode }
    \fi:
%    \end{macrocode}
%
% \bigskip
% The construction is not exactly the same whether we are just after an |\item|
% of a LaTeX list or not. We know if we are after an |\item| thanks to the
% boolean |\l_@@_inlabel_bool|.
%    \begin{macrocode}
    \bool_if:NTF \l_@@_inlabel_bool
      { $ } % $ 
      {  
%    \end{macrocode}
% We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a
% redefinition of |\[|. However, we put the following lines which are in the
% definition of |\[| even though they are in case of misuse.
%    \begin{macrocode}
        \if_mode_vertical:
        \nointerlineskip
        \hbox_to_wd:nn { .6 \linewidth } { }
        \fi:
        $$
      }
%    \end{macrocode}
% We use a |\vtop| in order to prevent page breaks in the environment.
%    \begin{macrocode}
    \vtop \bgroup 
    \bool_if:NTF \l_@@_fleqn_bool
      { \tabskip = \c_zero_skip }
      { \tabskip = 0 pt plus 1000 pt minus 1000 pt }
%    \end{macrocode}
%
%
%    \begin{macrocode}
    \@@_construct_halign:
    \tabskip = 0 pt plus 1000 pt minus 1000 pt
    & 
%    \end{macrocode}
%
% If the user try to use more columns than the lenght of the format, we have to
% raise an error. However, the error won't be in the next column which is the
% columns for the labels of the equations. The error will be after... and it
% must be after. That means that we must not have an error in the next column
% simply because we are not in math mode. That's why this column, even if it is
% for the labels, is in math mode.
%    \begin{macrocode}
    $ ## $
    \tabskip = \c_zero_skip
    && 
    \@@_error:n { Too~much~columns~in~DispWithArrows } 
    \bool_if:nT \c_false_bool { ## }
    \cr
  }
%    \end{macrocode}
% 
% \bigskip
% We begin the second part of the environment |{DispWithArrows}|.
%    \begin{macrocode}
  { 
    \clist_if_in:NnT \l_@@_tags_clist { last }
      { \clist_set:Nn \l_@@_tags_clist { all } }
    \\
%    \end{macrocode}
% The following |\egroup| is for the |\halign|.
%    \begin{macrocode}
    \egroup 
%    \end{macrocode}
% The following |\egroup| is for the |\vtop|.
%    \begin{macrocode}
    \egroup 
%    \end{macrocode}
%
%
% We compute the dimension |\g_@@_right_x_dim|. As a first approximation,
% |\g_@@_right_x_dim| is the $x$-value of the right side of the current
% composition box. In fact, we must take into account the potential labels of
% the equations. That's why we compute |\g_@@_right_x_dim| with the |v|-nodes of
% each row specifically built in this goal. |\g_@@_right_x_dim| is the minimal
% value of the $x$-value of these nodes.
%    \begin{macrocode}
    \dim_gzero_new:N \g_@@_right_x_dim 
    \dim_gset_eq:NN \g_@@_right_x_dim \c_max_dim
    \begin { tikzpicture } [ @@_standard ]
      \int_step_variable:nNn \g_@@_line_int \l_tmpa_int
        { 
          \cs_if_free:cTF 
            { pgf@sh@ns@wa - \l_@@_prefix_str - \l_tmpa_int - v }
            { \@@_error:n { Inexistent~v-node } }
            { 
              \tikz@parse@node\pgfutil@firstofone ( \l_tmpa_int - v )
              \dim_set:Nn \l_tmpa_dim \pgf@x
              \dim_compare:nNnT \l_tmpa_dim < \g_@@_right_x_dim
                { \dim_gset:Nn \g_@@_right_x_dim \l_tmpa_dim } 
            } 
        }
    \end { tikzpicture } 
%    \end{macrocode}
% 
% \bigskip
% The code in |\@@_post_halign:| is common to |{WithArrows}| and
% |{DispWithArrows}|.
%    \begin{macrocode}
    \@@_post_halign:
%    \end{macrocode}
% If \pkg{mathtools} has been loaded with the option |showonlyrefs|, we
% reactivate the code of \pkg{mathtools} for the option |showonlyrefs| with the
% command |\MT_showonlyrefs_true:| (it has been deactivated in the beginning of
% the environment).
%    \begin{macrocode}
    \bool_if:nT \c_@@_mathtools_loaded_bool
      { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: }
    \bool_if:NTF \l_@@_inlabel_bool
      { 
        $ % $
        \skip_vertical:N \belowdisplayskip
      }
      { $$ }
%    \end{macrocode}
%
% \bigskip 
% If the option |footnote| or the option |footnotehyper| is used, then we
% extract the footnotes with an environment |{savenotes}| (of the package
% \pkg{footnote} or the package \pkg{footnotehyper}).
%    \begin{macrocode}
    \bool_if:NT \g_@@_footnote_bool { \end {savenotes } }
    \ignorespacesafterend
  }
%    \end{macrocode}
%
% \bigskip
% With the environment |{DispWithArrows*}|, the equations are not numbered. We
% don't put |\begin{DispWithArrows}| and |\end{DispWithArrows}| because there is
% a |\@currenvir| in some error messages.
%    \begin{macrocode}
\NewDocumentEnvironment { DispWithArrows* } { }
  { 
    \WithArrowsOptions { notag }
    \DispWithArrows
  }
  \endDispWithArrows
%    \end{macrocode}
%
% 
% \bigskip
% \subsection{The commands \textbackslash tag, \textbackslash notag,
% \textbackslash label, \textbackslash tagnextline and \textbackslash qedhere for
% \{DispWithArrows\}} 
%
% Some commands are allowed only in the last column of the environment
% |{DispWithArrows}|. We write a command |\@@_if_in_last_col_of_disp:Nn| to
% execute this command only if we are in the last column. If we are in 
% another column, an error is raised. The first argument of
% |\@@_if_in_last_col_of_disp:Nn| is the name of the command used in the error
% message and the second is the code to execute.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_if_in_last_col_of_disp:Nn #1 #2
  { 
    \bool_if:NTF \l_@@_in_WithArrows_bool
      { \@@_error:nn { Not~allowed~in~WithArrows } { #1 } }
      { 
        \int_compare:nNnTF \g_@@_col_int < \l_@@_nb_of_columns_int
          { \@@_error:nn { Not~allowed~in~DispWithArrows } { #1 } }
          { #2 }
      }
  }
%    \end{macrocode}
% 
% \bigskip
% The command |\@@_notag:| will be linked to |\notag| and |\nonumber| in the
% environments |{WithArrows}| and |{DispWithArrows}|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_notag: 
  { \@@_if_in_last_col_of_disp:Nn \notag { \clist_clear:N \l_@@_tags_clist } }
%    \end{macrocode}
% 
%
% \bigskip
% The command |\@@_tag| will be linked to |\tag| in the environments
% |{WithArrows}| and |{DispWithArrows}|. We use |\NewDocumentCommand| because
% this command has a starred version.
%    \begin{macrocode}
\NewDocumentCommand \@@_tag { s m } 
  { 
    \@@_if_in_last_col_of_disp:Nn \tag
      { 
        \tl_if_empty:NF \l_@@_tag_tl
          { \@@_error:nn  { Multiple~tags } { #2 } }
        \clist_set:Nn \l_@@_tags_clist { all }
        \bool_if:nT \c_@@_mathtools_loaded_bool
          {
            \MH_if_boolean:nT { show_only_refs }
              {
                \MH_if_boolean:nF { show_manual_tags }
                  { \clist_clear:N \l_@@_tags_clist }
              }
          }
        \tl_set:Nn \l_@@_tag_tl { #2 }
        \bool_set:Nn \l_@@_tag_star_bool { #1 }
%    \end{macrocode}
% The starred version |\tag*| can't be used if \pkg{amsmath} has not been loaded
% because this version does the job by deactivating the command |\tagform@|
% inserted by \pkg{amsmath} in the (two versions of the) command
% |\@eqnnum|.\footnote{There are two versions of |@eqnnum|, a standard version
% and a version for the option |leqno|.}
%    \begin{macrocode}
        \bool_if:nT { #1 && ! \bool_if_p:N \c_@@_amsmath_loaded_bool }
          { \@@_error:n { tag*~without~amsmath } } 
      }
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_label:n| will be linked to |\label| in the environments
% |{WithArrows}| and |{DispWithArrows}|. In these environments, it's possible to
% put several labels for the same line (it's not possible in the environments of
% \pkg{amsmath}). That's why we store the differents labels of a same line in a
% sequence |\l_@@_labels_seq|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_label:n #1
  {  
    \@@_if_in_last_col_of_disp:Nn \label
      { 
        \seq_if_empty:NF \l_@@_labels_seq 
          { 
            \bool_if:NTF \c_@@_cleveref_loaded_bool
              { \@@_error:n { Multiple~labels~with~cleveref } }
              { \@@_error:n { Multiple~labels } } 
          }
        \seq_put_right:Nn \l_@@_labels_seq { #1 }
        \bool_if:nT \c_@@_mathtools_loaded_bool
          {
            \MH_if_boolean:nT { show_only_refs } 
              { 
                \cs_if_exist:cTF { MT_r_#1 }
                  { \clist_set:Nn \l_@@_tags_clist { all } }
                  { \clist_clear:N \l_@@_tags_clist } 
              }
          }
        \bool_if:nT \c_@@_autonum_loaded_bool
          { 
            \cs_if_exist:cTF { autonum@#1Referenced }
              { \clist_set:Nn \l_@@_tags_clist { all } }
              { \clist_clear:N \l_@@_tags_clist } 
          } 
      } 
  }
%    \end{macrocode}
%
% \bigskip
% The command |\@@_tagnextline:| will be linked to |\tagnextline| in the
% environments |{DispWithArrows}|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_tagnextline:
  { 
    \@@_if_in_last_col_of_disp:Nn \tagnextline
      { \bool_set_true:N \l_@@_tag_next_line_bool }
  }
%    \end{macrocode}
%
%
% \bigskip
% The environments |{DispWithArrows}| and |{DispWithArrows*}| are compliant with
% the command |\qedhere| of \pkg{amsthm}. However, this compatibility requires a
% special version of |\qedhere|.
% 
% This special version is called |\@@_qedhere:| and will be linked with
% |\qedhere| in the last column of the environment |{DispWithArrows}| (only if
% the package \pkg{amsthm} has been loaded). |\@@_qedhere:| raises the boolean
% |\l_@@_qedhere_bool|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_qedhere: { \bool_set_true:N \l_@@_qedhere_bool }
\cs_new_protected:Npn \@@_set_qedhere: { \cs_set_eq:NN \qedhere \@@_qedhere: }  
%    \end{macrocode}
%
% In the third column of the |\halign| of |{DispWithArrows}|, a command
% |\@@_qedhere_i:| will be issued if the flag |\l_@@_qedhere_bool| has been
% raised. The code of this command is an adaptation of the code of |\qedhere| in
% \pkg{amsthm}.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_qedhere_i: 
  {
    \group_begin:
      \cs_set_eq:NN \qed \qedsymbol
%    \end{macrocode}
% The line |\cs_set_eq:NN \qed@elt \setQED@elt| is a preparation for an action
% on the \textsc{qed} stack. Despite its form, the instruction |\QED@stack|
% executes an operation on the stack. This operation prints the \textsc{qed}
% symbol and nullify the top of the stack.
%    \begin{macrocode}
      \cs_set_eq:NN \qed@elt \setQED@elt 
      \QED@stack \relax \relax 
    \group_end: 
  }
%    \end{macrocode}
% 
% 
%
%
% \subsection{We draw the arrows}
%
% \bigskip
% The arrows are divided in groups. There is two reasons for this division.
% \begin{itemize}
% \item If the option |group| or the option |groups| is used, all the arrows of
% a group are drawn on a same vertical at an abscissa of |\l_@@_x_dim|.
% \item For aesthetic reasons, the starting point of all the starting arrows of
% a group is raised upwards by the value |\l_@@_start_adjust_dim|. Idem for the
% ending arrows.
% \end{itemize}
% 
% \medskip
% If the option |group| is used (|\l_@@_pos_arrow_int| = 7), we scan the arrows
% twice: in the first step we only compute the value of |\l_@@_x_dim| for the
% whole group, and, in the second step (|\l_@@_pos_arrow_int| is set to 8), we
% divide the arrows in groups (for the vertical adjustement) and we actually
% draw the arrows.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_scan_arrows:
  { 
    \group_begin:
    \int_compare:nNnT \l_@@_pos_arrow_int = 7
      { 
        \@@_scan_arrows_i:
        \int_set:Nn \l_@@_pos_arrow_int 8 
      }
    \@@_scan_arrows_i:
    \group_end:
  }
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_scan_arrows_i:
  { 
%    \end{macrocode}
%
% \bigskip 
% |\l_@@_first_arrow_of_group_int| will be the first arrow of the current group.
%
% |\l_@@_first_line_of_group_int| will be the first line involved in the group
% of arrows (equal to the initial line of the first arrow of the group because
% the option |jump| is always positive).
%
% |\l_@@_first_arrows_seq| will be the list the arrows of the group starting at
% the first line of the group (we may have several arrows starting from the same
% line). We have to know all these arrows because of the adjustement by
% |\l_@@_start_adjust_dim|.
%
% |\l_@@_last_line_of_group_int| will be the last line involved in the group
% (impossible to guess in advance).
%
% |\l_@@_last_arrows_seq| will be the list of all the arrows of the group
% ending at the last line of the group (impossible to guess in advance).
%    \begin{macrocode}
    \int_zero_new:N \l_@@_first_arrow_of_group_int 
    \int_zero_new:N \l_@@_first_line_of_group_int
    \int_zero_new:N \l_@@_last_line_of_group_int
    \seq_clear_new:N \l_@@_first_arrows_seq
    \seq_clear_new:N \l_@@_last_arrows_seq
%    \end{macrocode}
%
% \medskip
% The boolean |\l_@@_new_group_bool| is a switch that we will use the indicate
% that a group is finished (and the lines of that group have to be drawn). This
% boolean is not directed connected to the option |new-group| of an individual
% arrow.
%    \begin{macrocode}
    \bool_set_true:N \l_@@_new_group_bool
%    \end{macrocode}
%
% \bigskip
% We begin a loop over all the arrows of the environment. Inside this loop, if a
% group is finished, we will draw the arrows of that group.
%    \begin{macrocode}
    \int_set:Nn \l_@@_arrow_int \c_one_int
    \int_until_do:nNnn \l_@@_arrow_int > \g_@@_arrow_int
      { 
%    \end{macrocode}
%
% \bigskip 
% We extract from the property list of the current arrow the fields ``initial'',
% ``final'', ``status'' and ``input-line''. For the two former, we have to do
% conversions to integers.
%    \begin{macrocode}
        \prop_get:cnN 
          { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
          { initial } \l_tmpa_tl
        \int_set:Nn \l_@@_initial_int \l_tmpa_tl
        \prop_get:cnN 
          { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
          { final } \l_tmpa_tl
        \int_set:Nn \l_@@_final_int \l_tmpa_tl
        \prop_get:cnN 
          { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
          { status } \l_@@_status_arrow_str
        \prop_get:cnN 
          { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
          { input-line } \l_@@_input_line_str
%    \end{macrocode}
%
% \bigskip
% We recall that, after the construction of the |\halign|, |\g_@@_line_int| is
% the total number of lines of the environment. Therefore, the conditionnal
% |\l_@@_final_int > \g_@@_line_int| tests whether an arrow arrives after the
% last line of the environment. In this case, we raise an error (except in the
% second step of treatment for the option |group|). The arrow will be completely
% ignored, even for the computation of |\l_@@_x_dim|.
%    \begin{macrocode}
        \int_compare:nNnTF \l_@@_final_int > \g_@@_line_int
          { 
            \int_compare:nNnF \l_@@_pos_arrow_int = 8
              { \_@@_error:n { Too~few~lines~for~an~arrow } }
          }
          \@@_code_for_possible_arrow:
%    \end{macrocode}
%
% \bigskip
% Incrementation of the index of the loop (and end of the loop).
%    \begin{macrocode}
        \int_incr:N \l_@@_arrow_int
      }
%    \end{macrocode}
%
% \bigskip
% After the last arrow of the environment, we have to draw the last group of
% arrows. If we are in option |group| and in the first step of treatment
% (|\l_@@_pos_arrow_int| = 7), we don't draw because, in the first step, we
% don't draw anything. If there is no arrow in the group, we don't draw (this
% situation occurs when all the arrows of the potential group arrives after the
% last line of the environment).
%    \begin{macrocode}
    \bool_if:nT
      { 
        \int_compare_p:n { \l_@@_pos_arrow_int != 7 } 
          &&
        \int_compare_p:nNn \l_@@_first_arrow_of_group_int > 0 
      }
      { \@@_draw_arrows:nn \l_@@_first_arrow_of_group_int \g_@@_arrow_int }
  }
%    \end{macrocode}
%
% \bigskip
%    \begin{macrocode}
\cs_new_protected:Npn \@@_code_for_possible_arrow:
  { 
%    \end{macrocode}
% We test if the previous arrow was in fact the last arrow of a group. In this
% case, we have to draw all the arrows of that group, except if we are with the
% option |group| and in the first step of treatment (|\l_@@_pos_arrow_int| = 7).
%    \begin{macrocode}
    \bool_if:nT 
      { 
        \int_compare_p:nNn \l_@@_arrow_int > \c_one_int
        && 
       ( \int_compare_p:n { \l_@@_initial_int > \l_@@_last_line_of_group_int }
           &&
         \int_compare_p:n { \l_@@_pos_arrow_int != 7 }
           ||
         \str_if_eq_p:Vn \l_@@_status_arrow_str { new-group }
       ) 
      }
      { 
        \int_compare:nNnF \l_@@_first_arrow_of_group_int = \c_zero_int
          { 
            \@@_draw_arrows:nn 
              \l_@@_first_arrow_of_group_int 
              { \l_@@_arrow_int - 1 } 
          }
        \bool_set_true:N \l_@@_new_group_bool
      }
%    \end{macrocode}
%
% \bigskip 
% The flag |\l_@@_new_group_bool| indicates if we have to begin a new group of
% arrows. In fact, we have to begin a new group in three circonstancies: if we
% are at the first arrow of the environment (that's why the flag is raised
% before the beginning of the loop), if we have just finished a group (that's
% why the flag is raised in the previous conditionnal, for topological reasons
% or if the previous arrows had the status ``new-group''). At the beginning of a
% group, we have to initialize the following variables: |\l_@@_first_arrow_int|,
% |\l_@@_first_line_of_group_int|, |\l_@@_last_line_of_group|,
% |\l_@@_first_arrows_seq|, |\l_@@_last_arrows_seq|.
%
%    \begin{macrocode}
    \bool_if:nTF \l_@@_new_group_bool
      { 
        \bool_set_false:N \l_@@_new_group_bool
        \int_set_eq:NN \l_@@_first_arrow_of_group_int \l_@@_arrow_int
        \int_set_eq:NN \l_@@_first_line_of_group_int \l_@@_initial_int
        \int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int
        \seq_clear:N \l_@@_first_arrows_seq 
        \seq_put_left:NV \l_@@_first_arrows_seq \l_@@_arrow_int
        \seq_clear:N \l_@@_last_arrows_seq 
        \seq_put_left:NV \l_@@_last_arrows_seq \l_@@_arrow_int
%    \end{macrocode}
%
% If we are in option |group| and in the second step of treatment
% (|\l_@@_pos_arrow_int| = 8), we don't initialize |\l_@@_x_dim| because we want
% to use the same value of |\l_@@_x_dim| (computed during the first step) for
% all the groups.
%    \begin{macrocode}
        \int_compare:nT { \l_@@_pos_arrow_int != 8 }
          { \dim_set:Nn \l_@@_x_dim { - \c_max_dim } }
      }
%    \end{macrocode}
%
% \bigskip
% If we are not at the beginning of a new group.
%    \begin{macrocode}
      { 
%    \end{macrocode}
% 
% If the arrow is independent, we don't take into account this arrow for the
% detection of the end of the group.
%    \begin{macrocode}
        \bool_if:nF 
          { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
          { 
%    \end{macrocode}
% If the arrow is not independant, the arrow belongs to the current group and we
% have to take it into account in some variables.
%    \begin{macrocode}
            \int_compare:nT 
              { \l_@@_initial_int = \l_@@_first_line_of_group_int }
              { \seq_put_left:NV \l_@@_first_arrows_seq \l_@@_arrow_int }
            \int_compare:nNnTF \l_@@_final_int > \l_@@_last_line_of_group_int
              { 
                \int_set_eq:NN \l_@@_last_line_of_group_int \l_@@_final_int
                \seq_clear:N \l_@@_last_arrows_seq
                \seq_put_left:NV \l_@@_last_arrows_seq \l_@@_arrow_int
              }
              { 
                \int_compare:nNnT \l_@@_final_int = \l_@@_last_line_of_group_int
                  { \seq_put_left:NV \l_@@_last_arrows_seq \l_@@_arrow_int }
              }
          }
      }
%    \end{macrocode}
%
% \bigskip 
% If the arrow is not independent, we update the current $x$-value (in 
% |\l_@@_x_dim|) with the dedicated command |\@@_update_x:nn|. If we are
% in option |group| and in the second step of treatment (|\l_@@_pos_arrow_int| =
% 8), we don't initialize |\l_@@_x_dim| because we want to use the same value of
% |\l_@@_x_dim| (computed during the first step) for all the groups.
%    \begin{macrocode}
    \bool_if:nF { \str_if_eq_p:Vn \l_@@_status_arrow_str { independent } }
      { 
        \int_compare:nT { \l_@@_pos_arrow_int != 8 }
          { \@@_update_x:nn \l_@@_initial_int \l_@@_final_int }
      } 
  }
%    \end{macrocode}
%
%
% \bigskip
% The following code is necessary because we will have to expand an argument
% exactly 3 times.
%    \begin{macrocode}
\cs_generate_variant:Nn \keys_set:nn { n o }
\cs_new_protected:Npn \@@_keys_set: 
  { \keys_set_known:no { WithArrows / Arrow / SecondPass } }
%    \end{macrocode}
%
% \bigskip
% The macro |\@@_draw_arrows:nn| draws all the arrows whose numbers are between
% |#1| and |#2|. |#1| and |#2| must be expressions that expands to an integer
% (they are expanded in the beginning of the macro). This macro is nullified by
% the option |no-arrows|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_arrows:nn #1 #2
  {
    \group_begin:
    \int_zero_new:N \l_@@_first_arrow_int
    \int_set:Nn \l_@@_first_arrow_int { #1 }
    \int_zero_new:N \l_@@_last_arrow_int
    \int_set:Nn \l_@@_last_arrow_int { #2 }
%    \end{macrocode}
%
% \bigskip
% We begin a loop over the arrows we have to draw. The variable
% |\l_@@_arrow_int| (local in the environment |{WithArrows}|) will be used as
% index for the loop.
%    \begin{macrocode}
    \int_set:Nn \l_@@_arrow_int \l_@@_first_arrow_int
    \int_until_do:nNnn \l_@@_arrow_int > \l_@@_last_arrow_int
      {
%    \end{macrocode}
%
% \bigskip 
% We extract from the property list of the current arrow the fields ``initial''
% and ``final'' and we store these values in |\l_@@_initial_int| and
% |\l_@@_final_int|. However, we have to do a conversion because the components
% of a property list are token lists.
%    \begin{macrocode}
        \prop_get:cnN 
          { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
          { initial } \l_tmpa_tl
        \int_set:Nn \l_@@_initial_int \l_tmpa_tl
        \prop_get:cnN 
          { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop }
          { final } \l_tmpa_tl
        \int_set:Nn \l_@@_final_int \l_tmpa_tl
%    \end{macrocode}
%
% \bigskip
% If the arrow ends after the last line of the environment, we don't draw the
% arrow (an error has already been raised in |\@@_scan_arrows:|). We recall
% that, after the construction of the |\halign|, |\g_@@_line_int| is the total
% number of lines of the environment).
%    \begin{macrocode}
        \int_compare:nT { \l_@@_final_int <= \g_@@_line_int } \@@_draw_arrows_i:
        \int_incr:N \l_@@_arrow_int
      } 
    \group_end:
  }
%    \end{macrocode}
%
% \bigskip
% The macro |\@@_draw_arrows_i:| is only for the lisibility of the code. The
% first |\group_begin:| is for the options of the arrows (but we remind that the
% options |ll|, |rr|, |rl|, |lr|, |i| and |jump| have already been extracted and
% are not present in the field |options| of the property list of the arrow).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_arrows_i:
  { 
    \group_begin:
%    \end{macrocode}
%
% \bigskip
% We process the options of the current arrow. The second argument of
% |\keys_set:nn| must be expanded exactly three times. An x-expansion is not
% possible because there can be tokens like |\bfseries| in the option |font| of
% the option |tikz|. This expansion is a bit tricky.
%    \begin{macrocode}
    \prop_get:cnN 
      { g_@@_arrow _\l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop } 
      { options } \l_tmpa_tl
    \str_clear_new:N \l_@@_previous_key_str
    \exp_args:NNo \exp_args:No 
    \@@_keys_set: { \l_tmpa_tl , tikz = { xshift = \l_@@_xoffset_dim } }
%    \end{macrocode}
%
% We create two booleans to indicate the position of the initial node and final
% node of the arrow in cases of options |rr|, |rl|, |lr| or |ll|:
%    \begin{macrocode}
    \bool_set_false:N \l_@@_initial_r_bool
    \bool_set_false:N \l_@@_final_r_bool
    \int_case:nn \l_@@_pos_arrow_int 
      {
        0 { \bool_set_true:N \l_@@_final_r_bool }
        2 { \bool_set_true:N \l_@@_initial_r_bool }
        3 
          { 
            \bool_set_true:N \l_@@_initial_r_bool
            \bool_set_true:N \l_@@_final_r_bool 
          }
      }
%    \end{macrocode}
%
% \bigskip
% \begin{center}
% \begin{tabular}{l}
% \begin{tabular}{@{}l*8c@{}}
% \toprule
% option & |lr| & |ll| & |rl| & |rr| & |v| & |i| & |groups| & |group| \\
% \midrule
% |\l_@@_pos_arrow_int| & $0$  & $1$  & $2$  & $3$  & $4$ & $5$  & $6$  & $7$ \\
% \bottomrule
% \end{tabular} \\
% \footnotesize The option |v| can be used only in |\Arrow| in |code-after| (see
% below). 
% \end{tabular}
% \end{center}
% 
% \bigskip
% In case of option |i| at a local or global level (|\l_@@_pos_arrow_int| = 5),
% we have to compute the $x$-value of the arrow (which is vertical). The
% computed $x$-value is stored in |\l_@@_x_dim| (the same variable used when the
% option |group| or the option |groups| is used).
%    \begin{macrocode}
    \int_compare:nNnT \l_@@_pos_arrow_int = 5
      { 
        \dim_set:Nn \l_@@_x_dim { - \c_max_dim }
        \@@_update_x:nn \l_@@_initial_int \l_@@_final_int 
      }
%    \end{macrocode}
%
% \bigskip
% |\l_@@_initial_tl| contains the name of the Tikz node from which the arrow
% starts (in normal cases... because with the option |i|, |group| and |groups|,
% the point will perhaps have another
% $x$-value --- but always the same $y$-value). Idem for |\l_@@_final_tl|.
%    \begin{macrocode}
    \tl_set:Nx \l_@@_initial_tl 
      { 
        \int_use:N \l_@@_initial_int - \bool_if:NTF \l_@@_initial_r_bool rl 
        .south 
      } 
    \tl_set:Nx \l_@@_final_tl 
      { \int_use:N \l_@@_final_int - \bool_if:NTF \l_@@_final_r_bool rl .north }
%    \end{macrocode}
% We use ``|.south|'' and ``|.north|'' because we want a small gap between two
% consecutive arrows (and the Tikz nodes created have the shape of small
% vertical segments: use option |show-nodes| to visualize the nodes).
%
% \bigskip
% The label of the arrow will be stored in |\l_tmpa_tl|.
%    \begin{macrocode}
    \prop_get:cnN 
      { g_@@_arrow _ \l_@@_prefix_str _ \int_use:N \l_@@_arrow_int _ prop } 
      { label } 
      \l_tmpa_tl 
%    \end{macrocode}
%
% \bigskip
% Now, we have to know if the arrow starts at the first line of the group and/or
% ends at the last line of the group. That's the reason why we have stored in
% |\l_@@_first_arrows_seq| the list of all the arrows starting at the
% first line of the group and in |\l_@@_last_arrows_seq| the list of
% all the arrows ending at the last line of the group. We compute these values
% in the booleans |\l_tmpa_bool| and |\l_tmpb_bool|. These computations can't be
% done in the following |{tikzpicture}| because the command |\seq_if_in:NTF|
% which is \emph{not} expandable.
%    \begin{macrocode}
    \seq_if_in:NxTF \l_@@_first_arrows_seq 
      { \int_use:N \l_@@_arrow_int }
      { \bool_set_true:N \l_tmpa_bool }
      { \bool_set_false:N \l_tmpa_bool }
    \seq_if_in:NxTF \l_@@_last_arrows_seq 
      { \int_use:N \l_@@_arrow_int } 
      { \bool_set_true:N \l_tmpb_bool }
      { \bool_set_false:N \l_tmpb_bool }
    \int_compare:nNnT \l_@@_pos_arrow_int = 5
      { 
        \bool_set_true:N \l_tmpa_bool
        \bool_set_true:N \l_tmpb_bool 
      }
%    \end{macrocode}
%
% \bigskip 
% We compute and store in |\g_tmpa_tl| and |\g_tmpb_tl| the exact coordinates of
% the extremities of the arrow.
% \begin{itemize}
% \item Concerning the
% $x$-values, the abscissa computed in |\l_@@_x_dim| will be used if the option
% of position is |i|, |group| or |groups|.
% \item Concerning the
% $y$-values, an adjustement is done for each arrow starting at the first line
% of the group and each arrow ending at the last line of the group (with the
% values of |\l_@@_start_adjust_dim| and |\l_@@_end_adjust_dim|).
% \end{itemize}
% 
%    \begin{macrocode}
    \begin { tikzpicture } [ @@_standard ]
      \tikz@scan@one@point \pgfutil@firstofone ( \l_@@_initial_tl )
      \tl_gset:Nx \g_tmpa_tl 
        {
          \int_compare:nNnTF \l_@@_pos_arrow_int < 5
            { \dim_use:N \pgf@x }
            { \dim_use:N \l_@@_x_dim } , 
          \bool_if:NTF \l_tmpa_bool
            { \dim_eval:n { \pgf@y + \l_@@_start_adjust_dim } }
            { \dim_use:N \pgf@y } 
        }
      \tikz@scan@one@point \pgfutil@firstofone ( \l_@@_final_tl )
      \tl_gset:Nx \g_tmpb_tl 
        {
          \int_compare:nNnTF \l_@@_pos_arrow_int < 5 
            { \dim_use:N \pgf@x }
            { \dim_use:N \l_@@_x_dim } , 
          \bool_if:NTF \l_tmpb_bool
            { \dim_eval:n { \pgf@y - \l_@@_end_adjust_dim } }
            { \dim_use:N \pgf@y } 
        } 
    \end { tikzpicture } 
%    \end{macrocode}
%
% \bigskip
% Eventually, we can draw the arrow with the code in |\l_@@_tikz_code_tl|. We
% recall that the value by default for this token list is :\enskip
% ``\verb|\draw (#1) to node {#3} (#2) ;|''. This value can be modified with the
% option |tikz-code|. We use the variant |\@@_draw_arrow:nno| of the macro
% |\@@_draw_arrow:nnn| because of the characters \emph{underscore} in the name
% |\l_tmpa_tl|: if the user uses the Tikz library |babel|, the third argument of
% the command |\@@_draw_arrow:nno| will be rescanned because this third argument
% will be in the argument of a command |node| of an instruction |\draw| of
% Tikz... and we will have an error because of the characters
% \emph{underscore}.\footnote{There were other solutions: use another name
% without \emph{underscore} (like \Verb|\ltmpatl|) or use the package
% \pkg{underscore} (with this package, the characters \emph{underscore} will be
% rescanned without errors, even in text mode).}
%    \begin{macrocode}
    \@@_draw_arrow:nno \g_tmpa_tl \g_tmpb_tl \l_tmpa_tl
%    \end{macrocode}
%
% \smallskip
% We close the TeX group opened for the options given to |\Arrow[...]| (local
% level of the options).
%    \begin{macrocode}
    \group_end: 
  }
%    \end{macrocode}
%
%
% \bigskip
% The function |@@_tmpa:nnn| will draw the arrow. It's merely an environment
% |{tikzpicture}|. However, the Tikz instruction in this environment must be
% inserted from |\l_@@_tikz_code_tl| with the markers |#1|, |#2| and |#3|.
% That's why we create a function |\@@_def_function_tmpa:n| which will create
% the function |\@@_tmpa:nnn|.
%    \begin{macrocode}
\cs_new_protected:Npn \@@_def_function_tmpa:n #1
  { 
    \cs_set:Npn \@@_tmpa:nnn ##1 ##2 ##3
      { 
        \begin{tikzpicture} 
          [ 
            @@_standard , 
            every~path / .style = WithArrows / arrow 
          ] 
          #1 
        \end{tikzpicture}
      }
  }
%    \end{macrocode}
%
% \medskip
% When we draw the arrow (with |\@@_draw_arrow:nnn|), we first create the
% function |\@@_tmpa:nnn| and, then, we use the function |\@@_tmpa:nnn| :
%    \begin{macrocode}
\cs_new_protected:Npn \@@_draw_arrow:nnn #1 #2 #3
  {
%    \end{macrocode}
%
% \medskip
% If the option |wrap-lines| is used, we have to use a special version of
% |\l_@@_tikz_code_tl| (which corresponds to the option |tikz-code|).
%    \begin{macrocode}
    \bool_if:nT { \l_@@_wrap_lines_bool && \l_@@_in_DispWithArrows_bool }
       { \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_wrap_lines_tl }
%    \end{macrocode}
% 
% \medskip
% Now, the main lines of this function |\@@_draw_arrow:nnn|.
%    \begin{macrocode}
    \exp_args:NV \@@_def_function_tmpa:n \l_@@_tikz_code_tl
    \@@_tmpa:nnn { #1 } { #2 } { #3 } 
  }
\cs_generate_variant:Nn \@@_draw_arrow:nnn { n n o }
%    \end{macrocode}
% 
% \bigskip
% If the option |wrap-lines| is used, we have to use a special version of
% |\l_@@_tikz_code_tl| (which corresponds to the option |tikz-code|).
%    \begin{macrocode}
\tl_const:Nn \c_@@_tikz_code_wrap_lines_tl
  { 
%    \end{macrocode}
% First, we draw the arrow without the label.
%    \begin{macrocode}
    \draw ( #1 ) to node ( @@_label ) { } ( #2 ) ;
%    \end{macrocode}
% We retrieve in |\pgf@x| the abscissa of the left-side of the label we will
% put.
%    \begin{macrocode}
    \tikz@parse@node \pgfutil@firstofone ( @@_label.west )
%    \end{macrocode}
% We compute in |\l_tmpa_dim| the maximal width possible for the label. 
% |0.3333 em| is the default value of |inner sep| in the nodes of Tikz. Maybe we
% should put the exact Tikz parameter. Here is the use of |\g_@@_right_x_dim|
% which has been computed previously with the |v|-nodes.
%    \begin{macrocode}
    \dim_set:Nn \l_tmpa_dim { \g_@@_right_x_dim - \pgf@x - 0.3333 em } 
%    \end{macrocode}
% We retrieve in |\g_tmpa_tl| the current value of the Tikz parameter 
% ``|text width|''.\footnote{In fact, it's not the current value of 
% ``|text width|'': it's the value of ``|text width|'' set in the option |tikz|
% provided by \pkg{witharrows}. These options are given to Tikz in a 
% ``|every path|''. That's why we have to retrieve it in a path.}
%    \begin{macrocode}
    \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ;
%    \end{macrocode}
% Maybe the current value of the parameter ``|text width|'' is shorter than
% |\l_tmpa_dim|. In this case, we must use ``|text width|'' (we update
% |\l_tmpa_dim|).
%    \begin{macrocode}
    \tl_if_empty:NF \g_tmpa_tl
      {
        \dim_set:Nn \l_tmpb_dim \g_tmpa_tl
        \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
          { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim }
      }
%    \end{macrocode}
% Now, we can put the label with the right value for ``|text width|''.
%    \begin{macrocode}
    \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim
      { 
        \path ( @@_label.west ) 
           node [ anchor = west , text~width = \dim_use:N \l_tmpa_dim ] 
                { #3 } ; 
      } 
  }
%    \end{macrocode}
% 
% \bigskip
% The command |\@@_update_x:nn| will analyze the lines between |#1| and
% |#2| in order to modify |\l_@@_x_dim| in consequence. More precisely,
% |\l_@@_x_dim| is increased if a line longer than the current value of
% |\l_@@_x_dim| is found. |\@@_update_x:nn| is used in |\@@_scan_arrows:|
% (for options |group| and |groups|) and in |\@@_draw_arrows:nn| (for option
% |i|).
%    \begin{macrocode}
\cs_new_protected:Npn \@@_update_x:nn #1 #2
  { 
    \int_step_inline:nnn { #1 } { #2 } 
      { 
        \begin { tikzpicture } [ @@_standard ]
          \tikz@scan@one@point \pgfutil@firstofone ( ##1 - l )
          \dim_gset:Nn \g_tmpa_dim { \dim_max:nn \l_@@_x_dim \pgf@x }
        \end { tikzpicture }
        \dim_set_eq:NN \l_@@_x_dim \g_tmpa_dim 
      } 
  } 
%    \end{macrocode}
%
%
% \bigskip
% The command |\WithArrowsLastEnv| is not used by the package \pkg{witharrows}.
% It's only a facility given to the final user. It gives the number of the last
% environment |{WithArrows}| at
% level~$0$ (to the sense of the nested environments). This macro is fully
% expandable and, thus, can be used directly in the name of a Tikz node.
%    \begin{macrocode}
\cs_new:Npn \WithArrowsLastEnv { \int_use:N \g_@@_last_env_int }
%    \end{macrocode}
%
% \bigskip
% \subsection{The command \textbackslash Arrow in code-after}
%
% The option |code-after| is an option of the environment |{WithArrows}| (this
% option is only available at the environment level). In the option |code-after|,
% one can use the command |Arrow| but it's a special version of the command
% |Arrow|. For this special version (internally called |\@@_Arrow_code_after|),
% we define a special set of keys called |WithArrows/Arrow/code-after|.
%
%    \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / code-after }
  {
    tikz     .code:n = 
      \tikzset { WithArrows / arrow / .append~style = { #1 } } ,
    tikz     .value_required:n  = true ,
    rr       .value_forbidden:n = true ,
    rr       .code:n            = \@@_fix_pos_option:n 0 ,
    ll       .value_forbidden:n = true,
    ll       .code:n            = \@@_fix_pos_option:n 1 ,
    rl       .value_forbidden:n = true ,
    rl       .code:n            = \@@_fix_pos_option:n 2 ,
    lr       .value_forbidden:n = true ,
    lr       .code:n            = \@@_fix_pos_option:n 3 ,
    v        .value_forbidden:n = true ,
    v        .code:n            = \@@_fix_pos_option:n 4 ,
    tikz-code .tl_set:N          = \l_@@_tikz_code_tl ,
    tikz-code .value_required:n  = true ,
    xoffset  .dim_set:N         = \l_@@_xoffset_dim ,
    xoffset  .value_required:n  = true ,
    unknown .code:n  = 
      \@@_sort_seq:N \l_@@_options_Arrow_code_after_seq
      \@@_error:n { Unknown~option~Arrow~in~code-after } 
  }
%    \end{macrocode}
%
% \bigskip
% A sequence of the options available in |\Arrow| in |\code-after|. This sequence
% will be used in the error messages and can be modified dynamically.
%    \begin{macrocode}
\seq_new:N \l_@@_options_Arrow_code_after_seq
\seq_set_from_clist:Nn \l_@@_options_Arrow_code_after_seq
  { ll, lr, rl, rr, tikz, tikz-code, v, x, offset }
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\NewDocumentCommand \@@_Arrow_code_after { O { } m m m ! O { } }
  {
    \int_set:Nn \l_@@_pos_arrow_int 1
    \str_clear_new:N \l_@@_previous_key_str
    \group_begin:
      \keys_set:nn { WithArrows / Arrow / code-after } 
        { #1, #5, tikz = { xshift = \l_@@_xoffset_dim } }
      \bool_set_false:N \l_@@_initial_r_bool
      \bool_set_false:N \l_@@_final_r_bool
      \int_case:nn \l_@@_pos_arrow_int
        { 0
            { 
              \bool_set_true:N \l_@@_initial_r_bool
              \bool_set_true:N \l_@@_final_r_bool
            }
          2 { \bool_set_true:N \l_@@_initial_r_bool }
          3 { \bool_set_true:N \l_@@_final_r_bool } 
        }
%    \end{macrocode}
% We prevent drawing a arrow from a line to itself.
%    \begin{macrocode}
      \tl_if_eq:nnTF { #2 } { #3 }
        { \@@_error:nn { Both~lines~are~equal } { #2 } }
%    \end{macrocode}
% We test whether the two Tikz nodes |(#2-l)| and |(#3-l)| really exist. If not, 
% the arrow won't be drawn.
%    \begin{macrocode}
        {
          \cs_if_free:cTF { pgf@sh@ns@wa - \l_@@_prefix_str - #2 - l }
            { \@@_error:nx { Wrong~line~in~Arrow } { #2 } }
            { 
              \cs_if_free:cTF { pgf@sh@ns@wa - \l_@@_prefix_str - #3 - l }
                { \@@_error:nx { Wrong~line~in~Arrow } { #3 }  }
                { 
                  \int_compare:nNnTF \l_@@_pos_arrow_int = 4
                    {
                      \begin { tikzpicture } [ @@_standard ]
                        \tikz@scan@one@point \pgfutil@firstofone (#2-l.south)
                        \dim_set_eq:NN \l_tmpa_dim \pgf@x
                        \dim_set_eq:NN \l_tmpb_dim \pgf@y
                        \tikz@scan@one@point \pgfutil@firstofone (#3-l.north)
                        \dim_set:Nn \l_tmpa_dim 
                          { \dim_max:nn \l_tmpa_dim \pgf@x }
                        \tl_gset:Nx \g_tmpa_tl 
                          { \dim_use:N \l_tmpa_dim , \dim_use:N \l_tmpb_dim } 
                        \tl_gset:Nx \g_tmpb_tl 
                          { \dim_use:N \l_tmpa_dim , \dim_use:N \pgf@y } 
                      \end { tikzpicture } 
                    }
                    { 
                      \begin { tikzpicture } [ @@_standard ]
                        \tikz@scan@one@point \pgfutil@firstofone
                           ( #2-\bool_if:NTF\l_@@_initial_r_bool rl .south )
                        \tl_gset:Nx \g_tmpa_tl 
                           { \dim_use:N \pgf@x , \dim_use:N \pgf@y }
                        \tikz@scan@one@point \pgfutil@firstofone
                           ( #3-\bool_if:NTF\l_@@_final_r_bool rl .north )
                        \tl_gset:Nx \g_tmpb_tl 
                           { \dim_use:N \pgf@x , \dim_use:N \pgf@y }
                      \end { tikzpicture } 
                    }
                  \@@_draw_arrow:nnn \g_tmpa_tl \g_tmpb_tl { #4 } 
                } 
            }
        }
    \group_end:
  }
%    \end{macrocode}
%
%                               
% \bigskip
% \subsection{The command \textbackslash MultiArrow in code-after}
% The command |\@@_MultiArrow:nn| will be linked to |\MultiArrow| when the
% |code-after| is executed.
%    
%    \begin{macrocode}
\cs_new_protected:Npn \@@_MultiArrow:nn #1 #2
  {  
%    \end{macrocode}
% The user of the command |\MultiArrow| (in |code-after|) will be able to specify
% the list of lines with the same syntax as the loop |\foreach| of \pkg{pgffor}.
% That's why we construct a ``clist'' of \pkg{expl3} from the specification of
% list given by the user. The construction of the ``clist'' must be global in
% order to exit the |\foreach| and that's why we construct the list in
% |\g_tmpa_clist|.
%    \begin{macrocode}
    \foreach \x in { #1 } 
      { 
        \cs_if_free:cTF { pgf@sh@ns@wa - \l_@@_prefix_str - \x - l }
           { \@@_error:nx { Wrong~line~specification~in~MultiArrow } \x }
           { \clist_gput_right:Nx \g_tmpa_clist \x } 
      } 
%    \end{macrocode}
% We sort the list |\g_tmpa_clist| because we want to extract the minimum and
% the maximum.
%    \begin{macrocode}
    \int_compare:nTF { \clist_count:N \g_tmpa_clist < 2 }
      { \@@_error:n { Too~small~specification~for~MultiArrow } }
      {
        \clist_sort:Nn \g_tmpa_clist 
          {
            \int_compare:nTF { ##1 > ##2 }
              \sort_return_swapped: 
              \sort_return_same:
          }
%    \end{macrocode}
% We extract the minimum in |\l_tmpa_tl| (it must be an integer but we store it
% in a token list of \pkg{expl3}).
%    \begin{macrocode}
        \clist_pop:NN \g_tmpa_clist \l_tmpa_tl
%    \end{macrocode}
%
% We extract the maximum in |\l_tmpb_tl|. The remaining list (in
% |\g_tmpa_clist|) will be sorted in decreasing order but never mind...
%    \begin{macrocode}
        \clist_reverse:N \g_tmpa_clist
        \clist_pop:NN \g_tmpa_clist \l_tmpb_tl
%    \end{macrocode}
%
% We draw the teeth of the rak (except the first one and the last one) with the
% auxiliary function |\@@_MultiArrow_i:n|. This auxiliary fonction is necessary
% to expand the specification of the list in the |\foreach| loop. The first and
% the last teeth of the rak can't be drawn the same way as the others (think,
% for example, to the case of the option ``|rounded corners|'' is used).
%    \begin{macrocode}
        \exp_args:NV \@@_MultiArrow_i:n \g_tmpa_clist
%    \end{macrocode}
%
% Now, we draw the rest of the structure.
%    \begin{macrocode}
        \begin { tikzpicture }
          [ 
            @@_standard , 
            every~path / .style = { WithArrows / arrow } 
          ] 
          \draw [<->] ([xshift = \l_@@_xoffset_dim]\l_tmpa_tl-r.south)
                      -- ++(5mm,0)
                      -- node (@@_label) {} 
                         ([xshift = \l_@@_xoffset_dim+5mm]\l_tmpb_tl-r.south)
                      -- ([xshift = \l_@@_xoffset_dim]\l_tmpb_tl-r.south)  ;
          \tikz@parse@node \pgfutil@firstofone (@@_label.west)
          \dim_set:Nn \l_tmpa_dim { 20 cm }
          \path \pgfextra { \tl_gset:Nx \g_tmpa_tl \tikz@text@width } ;
          \tl_if_empty:NF \g_tmpa_tl { \dim_set:Nn \l_tmpa_dim \g_tmpa_tl }
          \bool_if:nT { \l_@@_wrap_lines_bool && \l_@@_in_DispWithArrows_bool }
            { 
              \dim_set:Nn \l_tmpb_dim 
                { \g_@@_right_x_dim - \pgf@x - 0.3333 em }
              \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim
                { \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim } 
            }
          \path (@@_label.west) 
           node [ anchor = west, text~width = \dim_use:N \l_tmpa_dim ] { #2 } ;
        \end{tikzpicture} 
      } 
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \@@_MultiArrow_i:n #1
  { 
    \begin {tikzpicture }
      [ 
        @@_standard , 
        every~path / .style = { WithArrows / arrow } 
      ] 
      \foreach \k in { #1 }
        { 
          \draw [ <- ] 
            ( [xshift = \l_@@_xoffset_dim]\k-r.south ) -- ++(5mm,0) ; 
        } ;
    \end { tikzpicture } 
  }
%    \end{macrocode}
%
%
% \bigskip
% \subsection{The error messages of the package}
%
%    \begin{macrocode}
\str_const:Nn \c_@@_option_ignored_str
  { If~you~go~on,~this~option~will~be~ignored. }
\str_const:Nn \c_@@_command_ignored_str
  { If~you~go~on,~this~command~will~be~ignored. }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Invalid~option~format }
  {
    The~option~'format'~should~contain~only~letters~r,~c~and~l.\\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Value~for~a~key }
  {
    The~key~'\l_keys_key_tl'~should~be~used~without~value. \\
    However,~you~can~go~on~for~this~time.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nnn { Unknown~option~in~Arrow }
  { 
    The~option~'\l_keys_key_tl'~
    is~unknown~for~the~command~\l_@@_string_Arrow_for_msg_str\
    in~the~row~\int_use:N \g_@@_line_int\
    of~your~environment~\{\l_@@_type_env_str\}. \\
    \c_@@_option_ignored_str \\
    For~a~list~of~the~available~keys,~type~H~<return>.
  }
  { 
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l_@@_options_Arrow_seq {~and~} {,~} {~and~}.
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}          
\@@_msg_new:nnn { Unknown~option~WithArrows }
  {
    The~option~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\
    \c_@@_option_ignored_str \\
    For~a~list~of~the~available~keys,~type~H~<return>.
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l_@@_options_WithArrows_seq {~and~} {,~} {~and~}.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nnn { Unknown~option~DispWithArrows }
  { 
    The~option~'\l_keys_key_tl'~is~unknown~in~\{\l_@@_type_env_str\}. \\
    \c_@@_option_ignored_str \\
    For~a~list~of~the~available~keys,~type~H~<return>.
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l_@@_options_DispWithArrows_seq {~and~} {,~} {~and~}.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nnn { Unknown~option~WithArrowsOptions }
  { 
    The~option~'\l_keys_key_tl'~is~unknown~in~
    \token_to_str:N \WithArrowsOptions. \\
    \c_@@_option_ignored_str \\
    For~a~list~of~the~available~keys,~type~H~<return>. 
  }
  {
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l_@@_options_WithArrowsOptions_seq {~and~} {,~} {~and~}.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nnn { Unknown~option~Arrow~in~code-after }
  { 
    The~option~'\l_keys_key_tl'~is~unknown~in~
    \token_to_str:N \Arrow\
    in~\token_to_str:N \code-after. \\
    \c_@@_option_ignored_str \\
    For~a~list~of~the~available~keys,~type~H~<return>.
  }
  { 
    The~available~keys~are~(in~alphabetic~order):~
    \seq_use:Nnnn \l_@@_options_Arrow_code_after_seq {~and~} {,~} {~and~}.
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}          
\@@_msg_new:nn { Too~much~columns~in~WithArrows }
  { 
    Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N 
    \l_@@_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~
    Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str.~
    If~you~really~want~to~use~more~columns~(after~the~arrows)~you~should~use~ 
    the~option~'more-columns'~at~a~global~level~or~for~an~environment. \\
    However,~you~can~go~one~for~this~time.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nn { Too~much~columns~in~DispWithArrows }
  { 
    Your~environment~\{\l_@@_type_env_str\}~has~\int_use:N 
    \l_@@_nb_of_columns_int\ columns~and~you~try~to~use~one~more.~
    Maybe~you~have~forgotten~a~\c_backslash_str\c_backslash_str\ 
    at~the~end~of~row~\int_use:N \g_@@_line_int. \\
    If~you~go~on,~you~may~have~other~errors.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nn { Negative~jump }
  { 
    You~can't~use~a~negative~value~for~the~option~'jump'~of~command~
    \l_@@_string_Arrow_for_msg_str\
    in~the~row~\int_use:N \g_@@_line_int\
    of~your~environment~\{\l_@@_type_env_str\}.~
    You~can~create~an~arrow~going~backwards~with~the~option~'<-'~of~Tikz. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { new-group~without~groups }
  { 
    You~can't~use~the~option~'new-group'~for~the~command~
    \l_@@_string_Arrow_for_msg_str\
    because~you~are~not~in~'groups'~mode.~Try~to~use~the~option~
    'groups'~in~your~environment~\{\l_@@_type_env_str\}. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}          
\@@_msg_new:nn          
  { Too~few~lines~for~an~arrow }
  { Line~\l_@@_input_line_str\
    :~an~arrow~specified~in~the~row~\int_use:N \l_@@_initial_int\
    of~your~environment~\{\l_@@_type_env_str\}~can't~be~drawn~
    because~it~arrives~after~the~last~row~of~the~environment. \\
    If~you~go~on,~this~arrow~will~be~ignored.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nn { WithArrows~outside~math~mode }
  { 
    The~environment~\{\l_@@_type_env_str\}~should~be~used~only~in~math~mode~
    like~the~environment~\{aligned\}~of~amsmath. \\
    Nevertheless,~you~can~go~on.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nn { DispWithArrows~in~math~mode }
  { 
    The~environment~\{\l_@@_type_env_str\}~should~be~used~only~outside~math~
    mode~like~the~environment~\{align\}~of~amsmath. \\ 
    If~you~go~on,~you~will~have~other~errors.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Incompatible~options~in~Arrow }
  { 
    You~try~to~use~the~option~'\l_keys_key_tl'~but~
    this~option~is~incompatible~or~redundant~with~the~option~
    '\l_@@_previous_key_str'~set~in~the~same~command~
    \l_@@_string_Arrow_for_msg_str. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
% 
%
%    \begin{macrocode}          
\@@_msg_new:nn { Incompatible~options }
  { You~try~to~use~the~option~'\l_keys_key_tl'~but~
    this~option~is~incompatible~or~redundant~with~the~option~
    '\l_@@_previous_key_str'~set~in~the~same~command~
    \bool_if:NT \l_@@_in_code_after_bool
      { 
        \l_@@_string_Arrow_for_msg_str\
        in~the~code-after~of~your~environment~\{\l_@@_type_env_str\}
      }. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Arrow~not~in~last~column }
  { 
    You~should~use~the~command~\l_@@_string_Arrow_for_msg_str\
    only~in~the~last~column~of~your~environment~\{\l_@@_type_env_str\}.\\
    However~you~can~go~on~for~this~time.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Wrong~line~in~Arrow }
  { 
    The~specification~of~line~'#1'~you~use~in~the~command~
    \l_@@_string_Arrow_for_msg_str\
    in~the~'code-after'~of~\{\l_@@_type_env_str\}~doesn't~exist. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Both~lines~are~equal }
  {
    In~the~'code-after'~of~\{\l_@@_type_env_str\}~you~try~to~
    draw~an~arrow~going~to~it~self~from~the~line~'#1'.~This~is~not~possible. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { Wrong~line~specification~in~MultiArrow }
  { 
    The~specification~of~line~'#1'~doesn't~exist. \\
    If~you~go~on,~it~will~be~ignored~for~\token_to_str:N \MultiArrow.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Too~small~specification~for~MultiArrow }
  { 
    The~specification~of~lines~you~gave~to~\token_to_str:N \MultiArrow\ 
    is~too~small:~you~need~at~least~two~lines. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { tag*~without~amsmath }
  { 
    We~can't~use~\token_to_str:N\tag*~because~you~haven't~loaded~amsmath~
    (or~mathtools). \\
    If~you~go~on,~the~command~\token_to_str:N\tag\ 
    will~be~used~instead.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Not~allowed~in~DispWithArrows }
  { 
    The~command~\token_to_str:N #1
    is~allowed~only~in~the~last~columnm~of~\{\l_@@_type_env_str\}. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { Not~allowed~in~WithArrows }
  { 
    The~command~\token_to_str:N #1 is~not~allowed~in~\{\l_@@_type_env_str\}~
    (it's~allowed~in~the~last~column~of~\{DispWithArrows\}). \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Multiple~tags }
  {
    You~can't~use~twice~the~command~\token_to_str:N\tag\ 
    in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\
    If~you~go~on,~the~tag~'#1'~will~be~used.
  }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\@@_msg_new:nn { Multiple~labels }
  { 
    Normally,~we~can't~use~the~command~\token_to_str:N\label\ 
    twice~in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\
    However,~you~can~go~on.~
    \bool_if:NT \c_@@_showlabels_loaded_bool
      { However,~only~the~last~label~will~be~shown~by~showlabels.~ }
    If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~
    'allow-multiple-labels'~at~the~global~or~environment~level.
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\@@_msg_new:nn { Multiple~labels~with~cleveref }
  {
    Since~you~use~cleveref,~you~can't~use~the~command~\token_to_str:N\label\ 
    twice~in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\
    If~you~go~on,~you~may~have~undefined~references.
  }
%    \end{macrocode}
%
% 
%    \begin{macrocode}
\@@_msg_new:nn { Inexistent~v-node }
  {
    There~is~a~problem.~Maybe~you~have~put~a~command~\token_to_str:N\cr\
    instead~of~a~command~\token_to_str:N\\~at~the~end~of~
    the~row~\int_use:N \l_tmpa_int\
    of~your~environment~\{\l_@@_type_env_str\}. \\
    If~you~go~on,~you~may~have~an~incorrect~output.
  }
%    \end{macrocode}
%
%    \begin{macrocode}          
\@@_msg_new:nn { Option~xoffset~forbidden }
  { 
    You~can't~use~the~option~'xoffset'~in~the~command~
    \l_@@_string_Arrow_for_msg_str\
    while~you~are~using~the~option~
    ' \int_compare:nNnTF \l_@@_pos_arrow_int = 7
        { group } 
        { groups } '. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
%
% 
%
% \subsection{The command \textbackslash WithArrowsNewStyle}
%
% A new key defined with |\WithArrowsNewStyle| will not be available at the
% local level.
%    \begin{macrocode}
\NewDocumentCommand \WithArrowsNewStyle { m m }
  { 
    \keys_if_exist:nnTF { WithArrows / Global } { #1 }
      { \@@_error:nn { Key~already~defined } { #1 } }
      { 
        \keys_define:nn { WithArrows / Global }
          { 
            #1 .code:n = 
             { \keys_set_known:nn { WithArrows / WithArrowsOptions } { #2 } }
          } 
        \seq_put_right:Nn \l_@@_options_WithArrows_seq {#1}
        \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { #1 }
        \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { #1 }
%    \end{macrocode}
% We now set the options in a TeX group in order to detect if some keys in |#2|
% are unknown. If a key is unknown, an error will be raised. However, the key
% will, even so, be stored in the definition of key~|#1|. 
%    \begin{macrocode}
        \group_begin:
          \msg_set:nnn { witharrows } { Unknown~option~WithArrowsOptions }
            {
              The~option~'\l_keys_key_tl'~can't~be~set~in~the~
              definition~of~a~style.~You~can~go~on~for~this~time~
              but~you~should~suppress~this~key. 
            }
          \WithArrowsOptions { #2 }
        \group_end:
      } 
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { Key~already~defined }
  {
    The~key~'#1'~is~already~defined. \\
    If~you~go~on,~your~instruction~\token_to_str:N\WithArrowsNewStyle\ 
    will~be~ignored.
  }
%    \end{macrocode}
%
%
% \subsection{The options up and down}
%
% The options |up| and |down| are available for individual arrows. The
% corresponding code is given here. It is independent of the main code of the
% extension \pkg{witharrows}.
% 
% This code is the only part of the code of \pkg{witharrows} which uses the
% package \pkg{varwidth} and also the Tikz library |calc|. That's why we have
% decided not to load this package and this library. If they are not loaded, the
% user will have an error only if he uses the option |up| or the option |down|.
% 
% \medskip
% The token list |\c_@@_tikz_code_up_tl| is the value of |tikz-code| which will
% be used for an option |up|.
%    \begin{macrocode}
\tl_const:Nn \c_@@_tikz_code_up_tl
  {
    \draw [ rounded~corners ]
       let \p1 = (#1) ,
           \p2 = (#2)
       in (\p1) -- node { 
                          \dim_set:Nn \l_tmpa_dim { \x2 - \x1 }
                          \begin { varwidth } \l_tmpa_dim
                            \raggedright
                            #3
                          \end { varwidth } 
                        } 
          (\x2,\y1) -- (\p2) ;
  }
%    \end{macrocode}
% 
% \medskip
% Idem for the option |down|.
%    \begin{macrocode}
\tl_const:Nn \c_@@_tikz_code_down_tl
  {
    \draw [ rounded~corners ]
      let \p1 = (#1) ,
          \p2 = (#2)
      in (\p1) -- (\x1,\y2) --
               node {
                      \dim_set:Nn \l_tmpa_dim { \x1 - \x2 }
                      \begin { varwidth } \l_tmpa_dim
                        \raggedright
                        #3
                      \end { varwidth }
                    } 
               (\p2) ;
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / FirstPass }
  {
    up   .code:n = \@@_set_independent: ,
    down .code:n = \@@_set_independent: ,
    up   .default:n = NoValue ,
    down .default:n = NoValue 
  }
%    \end{macrocode}
% 
% \bigskip
%    \begin{macrocode}
\keys_define:nn { WithArrows / Arrow / SecondPass }
  { 
    up .code:n =  
      \str_if_empty:NT \l_@@_previous_key_str
        { 
          \str_set:Nn \l_@@_previous_key_str { up }
          \bool_if:NTF \c_@@_varwidth_loaded_bool
            { 
              \cs_if_exist:cTF { tikz@library@calc@loaded }
                { 
                  \int_set:Nn \l_@@_pos_arrow_int \c_one_int
%    \end{macrocode}
% We have to set |\l_@@_wrap_lines_bool| to |false| because, otherwise, if the
% option |wrap_lines| is used at a higher level (global or environment), we will
% have a special affectation to |tikz-code| that will overwrite our affectation.
%    \begin{macrocode}
                  \bool_set_false:N \l_@@_wrap_lines_bool
                  \tl_set_eq:NN \l_@@_tikz_code_tl 
                    \c_@@_tikz_code_up_tl
                }
                { \@@_error:n { calc~not~loaded } }
            }
            { \@@_error:n { varwidth~not~loaded } } 
        } ,
    down .code:n = 
      \str_if_empty:NT \l_@@_previous_key_str
        { 
          \str_set:Nn \l_@@_previous_key_str { down }
          \bool_if:NTF \c_@@_varwidth_loaded_bool
            { 
              \cs_if_exist:cTF { tikz@library@calc@loaded }
                { 
                  \int_set:Nn \l_@@_pos_arrow_int \c_one_int
                  \bool_set_false:N \l_@@_wrap_lines_bool
                  \tl_set_eq:NN \l_@@_tikz_code_tl 
                    \c_@@_tikz_code_down_tl
                }
                { \@@_error:n { calc~not~loaded } }
            }
            { \@@_error:n { varwidth~not~loaded } } 
        }
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\seq_put_right:Nn \l_@@_options_Arrow_seq { down }
\seq_put_right:Nn \l_@@_options_Arrow_seq { up }
%    \end{macrocode}
%
%
%    \begin{macrocode}
\@@_msg_new:nn { varwidth~not~loaded } 
  {
    You~can't~use~the~option~'\l_keys_key_tl'~because~
    you~don't~have~loaded~the~package~'varwidth'. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nn { calc~not~loaded }
  { 
    You~can't~use~the~option~'\l_keys_key_tl'~because~you~don't~have~loaded~the~
    Tikz~library~'calc'.You~should~add~'\token_to_str:N\usetikzlibrary{calc}'
    ~in~the~preamble~of~your~document. \\
    \c_@@_option_ignored_str
  }
%    \end{macrocode}
% 
%    \begin{macrocode}
\@@_msg_new:nnn { Duplicate~name }
  { 
    The~name~'\l_keys_value_tl'~is~already~used~and~you~shouldn't~use~
    the~same~environment~name~twice.~You~can~go~on,~but,~
    maybe,~you~will~have~incorrect~results. \\
    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}
%
%
% \section{History}
%
% \subsection*{Changes between versions 1.0 and 1.1}
% 
% Option for the command |\\| and option |interline|
% 
% Compatibility with |\usetikzlibrary{babel}|
%
% Possibility of nested environments |{WithArrows}|
% 
%
% \subsection*{Changes between versions 1.1 and 1.2}
%
% The package \pkg{witharrows} can now be loaded without having loaded
% previously \pkg{tikz} and the libraries |arrow.meta| and |bending| (this
% extension and these libraries are loaded silently by \pkg{witharrows}).
%
% New option |groups| (with a \emph{s})
%
% 
% \subsection*{Changes between versions 1.2 and 1.3}
% 
% New options |ygap| and |ystart| for fine tuning.
%
% \subsection*{Changes between versions 1.3 and 1.4}
% 
% The package \pkg{footnote} is no longer loaded by default. Instead, two
% options |footnote| and |footnotehyper| have been added. In particular,
% \pkg{witharrows} becomes compatible with \cls{beamer}.
% 
% \subsection*{Changes between versions 1.4 and 1.5}
% 
% The Tikz code used to draw the arrows can be changed with the option
% |tikz-code|.
%
% Two new options |code-before| and |code-after| have been added at the
% environment level.
%
% A special version of |\Arrow| is available in |code-after| in order to draw
% arrows in nested environments.
% 
% A command |\MultiArrow| is available in |code-after| to draw arrows of other
% shapes.
% 
% \subsection*{Changes between versions 1.5 and 1.6}
% 
% The code has been improved to be faster and the Tikz library |calc| is no
% longer required.
%
% A new option |name| is available for the environments |{WithArrows}|.
%
% \subsection*{Changes between 1.6 and 1.7}
%
% New environments |{DispWithArrows}| and |{DispWithArrows*}|.
%
% \subsection*{Changes between 1.7 and 1.8}
%
% The numbers and tags of the environment |{DispWithArrows}| are now compatible
% with all the major LaTeX packages concerning references (\pkg{autonum},
% \pkg{cleveref}, \pkg{fancyref}, \pkg{hyperref}, \pkg{prettyref},
% \pkg{refstyle}, \pkg{typedref} and \pkg{varioref}) and with the options
% |showonlyrefs| and |showmanualtags| of \pkg{mathtools}.
%
% \subsection*{Changes between 1.8 and 1.9}
% 
% New option |wrap-lines| for the environments |{DispWithArrows}| and
% |{DispWithArrows*}|.
%
% \subsection*{Changes between 1.9 and 1.10}
%
% If the option |wrap-lines| is used, the option ``|text width|'' of Tikz is
% still active: if the value given to ``|text width|'' is lower than the width
% computed by |wrap-lines|, this value is used to wrap the lines.
%
% The option |wrap-lines| is now fully compatible with the class option |leqno|.
%
% Correction of a bug: |\nointerlineskip| and |\makebox[.6\linewidth]{}| should
% be inserted in |{DispWithArrows}| only in vertical mode.
%
% \subsection*{Changes between 1.10 and 1.11}
%
% New commands |\WithArrowsNewStyle| and |\WithArrowsRightX|.
%
% \subsection*{Changes between 1.11 and 1.12}
%
% New command |\tagnextline|.
%
% New option |tagged-lines|.
%
% An option of position (|ll|, |lr|, |rl|, |rr| or |i|) is now allowed at the
% local level even if the option |group| or the option |groups| is used at the
% global or environment level.
%
% Compatibility of |{DispWithArrows}| with |\qedhere| of \pkg{amsthm}.
%
% Compatibility with the packages \pkg{refcheck}, \pkg{showlabels} and
% \pkg{listlbls}.
%
% The option |\AllowLineWithoutAmpersand| is deprecated because lines without
% ampersands are now always allowed.
%
% \subsection*{Changes between 1.12 and 1.13}
%
% Options |start-adjust|, |end-adjust| and |adjust|.
% 
% This version is not stricty compatible with previous ones. To restore the
% behaviour of the previous versions, one has to use the option |adjust| with
% the value $0$~pt:
% 
% \begin{Verbatim}
% \WithArrowsOptions{adjust = 0pt}
% \end{Verbatim}
%
% \subsection*{Changes between 1.13 and 1.14}
%
% New options |up| and |down| for the arrows.
%
% \smallskip
% 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:
% |//www.texdev.net/2018/04/21/xparse-optional-arguments-at-the-end|).
%
% \smallskip
% Modification of the code of |\WithArrowsNewStyle| following a correction of a
% bug in \pkg{l3keys} in the version of \pkg{l3kernel} of 2019/01/28.
% 
% New error message |Inexistent~v-node| to avoid a \pkg{pgf} error.
%
% The error |Option incompatible with 'group(s)'| was suppressed in the version
% 1.12 but this was a mistake since this error is used with the option |xoffset|
% at the local level. The error is put back.
% 
% \subsection*{Changes between 1.14 and 1.15}
%
% Option |new-group| to start a new group of arrows (only available when the
% environment is composed with the option |groups|).
%
% Tikz externalization is now deactivated in the environments of the
% extension \pkg{witharrows}.\footnote{Before this version, there was an error
% when using \pkg{witharrows} with Tikz externalization. In any case, it's not
% possible to externalize the Tikz elements constructed by \pkg{witharrows}
% because they use the options |overlay| and |remember picture|.} 
%
% \subsection*{Changes between 1.15 and 1.16}
%
% Option |no-arrows| 
%
% The behaviour of |{DispWithArrows}| after an |\item| of a LaTeX list has been
% changed : no vertical is added. The previous behaviour can be restored with
% the option |standard-behaviour-with-items|.
% 
% A given name can no longer be used for two distinct environments. However,
% it's possible to deactivate this control with the option
% |allow-duplicate-names|.
% 
%
% \subsection*{Changes between 1.16 and 1.17}
% 
% Option |format|
% 
% \endinput
% Local Variables:
% TeX-fold-mode: nil
% fill-column: 80
% End: