summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tabu/tabu.dtx
blob: 16717a66ac4d99a13cd4d5945fd1f1bd3961566f (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
% \iffalse meta-comment
% tabu : 2010/11/15 v1.2 - tabu: flexible LaTeX tabulars]
%
% This work 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
%
% This work consists of the main source file tabu.dtx
% and the derived files
%    tabu.sty, tabu.pdf, tabu.ins
%
% Unpacking:
%    (a) If tabu.ins is present:
%           etex tabu.ins
%    (b) Without tabu.ins:
%           etex tabu.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{tabu.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:
%           (pdf)latex tabu.dtx
% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
\Msg{* Package: 2010/11/15 v1.2 - tabu: Flexible LaTeX tabulars}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

tabu : 2010/11/15 v1.2 - tabu : Flexible LaTeX tabulars

This work 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

This work consists of the main source file tabu.dtx
and the derived files
   tabu.sty, tabu.pdf, tabu.ins

tabu : Flexible LaTeX tabulars
Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>

\endpreamble
\let\MetaPrefix\DoubleperCent

\generate{%
   \file{tabu.ins}{\from{tabu.dtx}{install}}%
   \file{tabu.sty}{\from{tabu.dtx}{package}}%
}

\askforoverwritefalse
\generate{%
   \file{tabu.drv}{\from{tabu.dtx}{driver}}%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{*     tabu.sty}
\Msg{*}
\Msg{* To produce the documentation run the file `tabu.dtx'}
\Msg{* through LaTeX.}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{Flexible \LaTeX{} tabulars (\FC)}
\def\thisdate{2010/11/15}
\def\thisversion{1.2}
\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex}
\def\CTANdisplay{CTAN:macros/latex}
\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother
\newcommand*\CTANhrefstar[3][/contrib/]{\href{\CTANbaseurl#1#2}{#3}}
\newcommand*\CTANhrefnost[2][/contrib/]{\href{\CTANbaseurl#1#2}{\nolinkurl{\CTANdisplay#1#2}}}
\let\loadclass\LoadClass
\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}}
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[a4paper,oneside]{ltxdoc}
\AtBeginDocument{\DeleteShortVerb{\|}}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,xspace,numprint}
\usepackage[official]{eurosym}
\usepackage[expansion=all,stretch=20,shrink=60]{microtype}
\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,tabularx,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar}
\heavyrulewidth=.7pt
\usepackage{holtxdoc,bookmark}
\usepackage{interfaces}[2010/11/15]
\usetikz{basic,chains,positioning}
\usepackage{embedfile}
\RequirePackage{amsopn,amsmath}% \DeclareMathOperator
\RequirePackage[a]{esvect}% for vectors
\DeclareMathOperator*\Div{div}
\DeclareMathOperator*\Rot{\vv{\text{rot}}}
\newrobustcmd*\dpartial[2]{\displaystyle\genfrac{}{}{}{}{\partial#1}{\partial#2}}
\usepackage{expl3,l3keys2e,siunitx}
\usepackage{xfrac}
\csname endofdump\endcsname
\CodelineNumbered
%\OnlyDescription
\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}}
\usepackage[linegoal,debugshow]{tabu}
\lastlinefit999
\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm}
\hypersetup{%
  pdftitle={tabu},
  pdfsubject={a simple line parser for TeX},
  pdfauthor={Florent CHERVET},
  colorlinks,linkcolor=reflink,
  pdfstartview={FitH},%pdfpagemode=UseOutLines,
  pdfkeywords={tex, e-tex, latex, package, tabular, array, halign, tabularx, longtable, color, colortbl, alignment},
  }
\embedfile{\thisfile.dtx}
\begin{document}
   \DocInput{\thisfile.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{3471}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater,\z@,\@ne,\@@}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter}
% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography,\newrobustcmd,\renewrobustcmd,\providerobustcmd}
% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment}
% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi}
% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup}
% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine,\@addtopreamble,\@depth,\@height,\@width,\@firstofone,\@frameb@x,\@lastchclass,\@M,\m,\@nextchar,\@startpbox}
% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem,\@tempa,\{,\},\^,\ ,\DeclareOption,\CT@end,\CT@arc@,\count@,\col@sep,\endgraf,\dimexpr,\fbox,\fboxsep,\g@addto@macro}
% \DoNotIndex{\z@,\wd,\vrule,\voidb@x,\verb,\bibitem,\NC@rewrite@,\NC@list,\NC@do,\NC@,\nobreak,\number,\showbox,\tabu@AtEnd,\tabu@getnbc@ls,\tabu@s@nitizetext}
% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar,\tabu@s@veX,\tabu@sett@rget,\tabu@stack}
% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr}
% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt}
% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth,\stform}
% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother}
% \DoNotIndex{\maketitle,\parindent,\x,\kernel@ifnextchar}
% \DoNotIndex{\DefineShortVerb,\DeleteShortVerb,\UndefineShortVerb,\MakeShortVerb,\endinput,\@eha,\@ehd,\@nil,\@nnil,\@ifundefined,\@ifpackagelater,\@ifpackageloaded}
% \DoNotIndex{\p@,\tracingtabu,\@ne,\tw@,\m@ne,\z@skip}
% \makeatletter
% \newrobustcmd\ClearPage{\@ifstar\clearpage{}}
% \makeatletter
% \catcode`\§ \active   \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}}
% \def\thispackage{\xpackage{{\pkgcolor\thisfile}}\xspace}
% \def\ThisPackage{\Xpackage{\thisfile}\xspace}
% \def\Xpackage{\@dblarg\X@package}
% \def\X@package[#1]#2{\@testopt{\X@@package{#1}{#2}}{}}
% \def\X@@package#1#2[#3]{\xpackage{#2\footnote{\noindent\xpackage{#2}: \CTANhref{#1}#3}}}
% \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$}
%\def\FV@DefineCommandChars #1#2#3{%
%   \edef\FV@restoreCommandChars{%
%      \catcode`#1\the\catcode`#1\relax
%      \catcode`#2\the\catcode`#2\relax
%      \catcode`#3\the\catcode`#3\relax}%
%   \def \FV@CommandChars {\catcode `#1=0\relax \catcode `#2=1\relax \catcode `#3=2\relax }%
%   \output\expandafter{\expandafter\FV@restoreCommandChars\the\output}%
%}
% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@\leftmargini=2.5cm
% \widowpenalty=5000\clubpenalty=8000
% \newrobustcmd*\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.05,0.02,0.07}
% \def\macro@font{\changefont{fam=lmtt,size-=1pt,color=macrocode,spread=1}\let\AltMacroFont\macro@font}
% \def\MacroFont{\changefont{fam=lmtt,color=macrocode}}
% \g@addto@macro\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@}
% \def\texorpdf#1#2{\texorpdfstring{#1{#2}}{#2}}
% \def\textitbf#1{\textbf{\itshape#1}}\let\textbfit\textitbf
% \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m}
% \DefineVerbatimEnvironment{VerbLines*}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m,commandchars=$()}
% \DefineVerbatimEnvironment{Verb}{Verbatim}{gobble=1,fontfamily=\ttdefault,fontseries=m}
% \DefineVerbatimEnvironment{Verb*}{Verbatim}{gobble=1,fontfamily=\ttdefault,fontseries=m,commandchars=$()}
% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}}
% \def\ttdefault{lmvtt}
% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}}
% \renewrobustcmd*\cs[2][]{\mbox{\ttfamily#1\expandafter\@gobble\string\\#2}}
% \newrobustcmd*\csbf[2][]{\textbf{\cs[{#1}]{#2}}}
% \newrobustcmd\textttbf[1]{\textbf{\texttt{#1}}}
% \newrobustcmd*\blue{\color{blue}}\newcommand*\red{\color{dr}}\newcommand*\green{\color{green}}\newcommand\rred{\color{red}}
% \newrobustcmd*\FC[1][\color{copper}]{{#1\usefont{T1}{fts}xn FC}}
% \colorlet{pkgcolor}{teal} \def\pkgcolor{\color{pkgcolor}}
% \definecolor{copper}{rgb}{0.67,0.33,0.00}  \newcommand\copper{\color{copper}}
% \definecolor{dg}{rgb}{0.02,0.29,0.00}      \newcommand\dg{\color{dg}}
% \definecolor{db}{rgb}{0,0,0.502}           \newcommand\db{\color{db}}
% \definecolor{dr}{rgb}{0.75,0.00,0.00}      \let\dr\red
% \definecolor{lk}{rgb}{0.25,0.25,0.25}      \newrobustcmd\lk{\color{lk}}
% \definecolor{llk}{rgb}{0.40,0.40,0.40}
% \newrobustcmd\bk{\color{black}}\newcommand\md{\mdseries}
% \newrobustcmd\ie{\emph{ie.}}
% \newcommand\textt[1]{\texorpdf\texttt{#1}}
% \newrobustcmd\texttbf[2][]{\texttt{\bfseries#1#2}}
% \newcommand\cellstrut{}\let\cellstrut\bottopstrut
% \newrobustcmd\etc{{\bk\emph{etc.}}}
% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}}
% \def\M@i#1{\@ifnextchar[^^A]
%   {\M@square#1}
%   {\@ifnextchar(^^A)
%     {\M@paren#1}
%     {\M@brace#1}}^^A
% }
% \def\M@square#1[#2]{\M@Bracket[{#1{#2}}]}
% \def\M@paren#1(#2){\M@Bracket({#1{#2}})}
% \def\M@brace#1#2{\M@Bracket\{{#1{#2}}\}}
% \def\M@Bracket#1#2#3{{\ttfamily#1#2#3}}
% \newrobustcmd*\thisyear{\begingroup
%    \def\thisyear##1/##2\@nil{\endgroup
%       \oldstylenums{##1\ifnum##1=\year\else\,\textendash\,\the\year\fi}%
%    }\expandafter\thisyear\thisdate\@nil
% }
% \renewrobustcmd\declcs[2][]{^^A
%   \par\addvspace\parskip
%   \goodbreak
%   \noindent\larger\changefont{spread=1}^^A
%   \hspace{-\leftmargini}^^A
%   \def\*{\unskip\,\texttt{*}}^^A
%   \begin{tabular}{|l|}^^A
%     \hline
%     \expandafter\SpecialUsageIndex\csname #2\endcsname
%     \raisedhyperdef[8pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A
% }^^A
% \renewcommand\enddeclcs{%
%     \crcr \hline
%     \end{tabular}%
%     \nobreak   \par  \nobreak
%     \noindent
%     \ignorespacesafterend
%  }
% \def\declmargin{\hspace*{\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep}}
% \pretocmd\textasteriskcentered{\usefont{OMS}{cmsy}mn}{}{}
% \bookmarksetup{open=true,openlevel=3}
% \pagesetup{%
%  head/rule/width=.0pt,
%  left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm,
%  head/font=\scriptsize,
%  head/color=LightSteelBlue,
%  head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight\thispackage,
%  head/right=Flexible \LaTeX{} tabulars,
%  foot/font=\lk\scriptsize,
%  foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}},
%  foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}}%
%  }
% \pagesetup[plain]{%
%  norules,font=\scriptsize,
%  foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}},
%  left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm,
%  foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}},
% }
% \pagestyle{fancy}
% \sectionformat\section{
%        mark=\marksthe{section}{#1},
%        left=\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep\relax,
%        top=\medskipamount,
%        bottom=\smallskipamount,
%        font=\normalfont\Large\bfseries,
%        bookmark={bold,color=[rgb]{0.02,0.05,.2}},
%        break=\goodbreak}
% \sectionformat\subsection{%
%     top=\medskipamount,
%     bottom=.5\smallskipamount,
%     bookmark={color=[rgb]{0.02,0.05,.1}},
%     font=\normalfont\Large\bfseries,
%     break=\addpenalty{-\@highpenalty}}
% \sectionformat\subsubsection{
%     bookmark={italic=false,color=lk},
%     font=\normalfont\large\bfseries\lk,
%     label=,
%     top=\medskipamount,
%     bottom=.5\smallskipamount,
%     break=\addpenalty{-\@medpenalty}}
% \setitemize{itemsep=\parskip,topsep=0pt,labelsep=1em,parsep=0pt}
% \tikzset{every picture/.add style={}{/utils/exec=\changefont{spread=1}}}
% \newrobustcmd*\IMPLEMENTATION{%
%     \newgeometry{top=0.8cm,headheight=.5cm,headsep=.3cm,bottom=1.2cm,footskip=.5cm,left=5cm,right=.50cm}
%     \pagesetup*{
%        left/offset+=1cm,right/offset-=1cm,
%        head/color=Lavender,
%        head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight t\,a\,b\,u\,\ \ i\,m\,p\,l\,e\,m\,e\,n\,t\,a\,t\,i\,o\,n,
%      }%
%     \clearpage
%     ^^A\tocsetup{depth-=1}
%     \sectionformat\section{bookmark/color=black}\sectionformat\subsection{bookmark/color=black}
%     \bookmarksetup{bold*,openlevel=3}
%     \section(Implementation)[\mdseries\scshape\pmb{Implementation}]{Implementation} \label{sec:implementation}}
% \let\plainllap\llap
% \newrobustcmd\macro@llap[1]{\global\let\llap\plainllap\setbox0\hbox{#1}^^A
%  \ifdim\wd0>4cm\hbox to\z@{\hss\hbox to4cm{#1\hss}}^^A
%        \edef\@tempa{\the\everypar\hskip\dimexpr\the\wd0-4cm\relax\global\everypar{}}%
%            \global\everypar\expandafter{\@tempa}^^A
%  \else\hbox to\z@{\hss#1}\fi
%  \setbox\z@\box\voidb@x}
% \pretocmd\macro{\MacrocodeTopsep=\z@skip\MacroTopsep\z@skip\let\llap\macro@llap\parsep=\z@\topsep=\z@\itemsep=\z@\partopsep\z@}{}{}
% \apptocmd\endmacro{\goodbreak\vskip.3\parskip}{}{}
%
% \definecolor{reflink}{rgb}{0.95,0.00,0.05}
% \definecolor{reflink}{rgb}{0.05,0.00,0.95}
% \newrobustcmd\stform{\@ifnextchar*{\@stform[]\textasteriskcentered\@gobble}\@stform}
% \newrobustcmd\@stform[2][\string]{\textttbf{#1#2}\xspace}
%
% \makeatother
%
%
% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em}
%
% \title{\vspace*{-28pt}\mdseries {\HUGE\bfseries\sffamily t\,a\,b\,u\,}}
% \date{}
% \author{\small\thisdate~--~version \thisversion}
% \subtitle{\LARGE Flexible \LaTeX{} tabulars\endgraf {\small\FC}}
% \maketitle
%
%
%
% \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone
% \footnotetext{\noindent\parskip=0pt\scriptsize
% This documentation is produced with the +DocStrip+ utility. Package \xpackage{tabu} is used with the \textt{linegoal} option.\topsep=0pt
% \begin{tabbing}
% \qquad\=\smex\=To get the documentation, \= run (thrice):\quad\= \texttt{pdflatex \thisfile.dtx} \\
% \qquad\>\>To get the index, \> run:\>\texttt{makeindex -s gind.ist \thisfile.idx} \\
% \>\smex\>To get the package, \> run:\>        \texttt{etex \thisfile.dtx}
% \end{tabbing}§
% The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.}
% \endgroup\makeatother
%
% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em}
%
% {\let\quotation\relax\vspace*{-1cm}%
% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\leftskip1cm\rightskip\leftskip
%
% This package defines a single environment \textt{tabu} to make all kinds of tabulars in text or in math mode
% provided that they do not split across pages.
%
% \textt{tabu} is more flexible that \textt{tabular}, \textt{tabular*}, \textt{tabularx}
% and \textt{array} and extends the possibilities. All tabulars in this document were made
% with the \textt{tabu} environment. Last (but not least) \textt{tabu} is more than compatible
% with any package that provides commands to format tabulars.
% Indeed, \thispackage{} \textbf{does not modify any of the macros of \xfile{array.sty}.} All
% functionalities are obtained with only two modifications\footnote{\cs{prepnext@tok} and \cs{save@decl}.
% See ``\nameref{sec:light package option}''.} which are loaded only inside
% a \textt{tabu} environment.
%
% \xpackage{tabu} requires \eTeX, the standard package \xfile{array.sty} and no other package.
%
% \end{abstract}}
%
% \makeatletter
% \tocsetup{
% dot=$\scriptscriptstyle\ldotp$,
% dotsep=1mu,
% title/bottom=6pt,
% title=Contents\quad\leaders\vrule height3.1pt depth-3pt\hfill\null,
% bookmark={text=Contents,bold},
% after=\leavevmode\hrule height3.1pt depth-3pt,
% twocolumns=false,
% section/skip=4pt plus2pt minus2pt,
% section/leaders=\leaders\hbox{$\m@th\mkern1mu\hbox{$\mathbf\ldotp$}\mkern1mu$}\hfill,
% section/dotsep,
% subsection/skip=0pt plus2pt minus 2pt,
% subsubsection/font=\slshape,
% subsubsection/pagenumbers=off,
% subsubsection/skip-=1pt,subsubsection/numwidth-=4pt,
% }\makeatother
%
% {%
%  \hypersetup{linkcolor=black}
%  \tableofcontents
% }
%
% \clearpage
% \changefont{spread*=1.1}
%
% \bottomtitles=.3\textwidth
% \section{The \textt{tabu} environment}
% \label{sec.tabu}
%
% \subsection(tabu, tabu to, tabu spread){\textt{tabu}, \textt{tabu to} and \textt{tabu spread}}
%
% {\let\red\relax
% \begin{declcs}{begin}\M*{\red tabu}\M[pos]\M{tabular preamble} \\
% \cs{begin}\M*{{\red tabu}} to \meta{dimen}\M[pos]\M{tabular preamble} \\
% \cs{begin}\M*{{\red tabu}} spread \meta{dimen}\M[pos]\M{tabular preamble} \\
% \end{declcs}}
%
% The \textt{tabu} environment behaves exactly like \textt{tabular}: the preamble
% is parsed by the macros in \xfile{array.sty} with no modification in the characters classes.
%  \textt{tabu} improves \textt{tabular} and \textt{array}:
%  \begin{itemize}
%  \item footnotes and index words are allowed inside \textt{tabu}
%  \item \textt X columns are also allowed, with an \emph{optional} parameter for the width-coefficient,
%        the alignment (\textt{l,r,c} or \textt{L,R,C} for \xpackage{ragged2e} settings) and the column
%        type (\textt{p,m,b}). \textt{tabu} has also a \emph{default target width} when used
%        with \textt X columns.
%  \item You are used to the \textt{tabular} environment in text mode, and \textt{array} in math mode,
%        but \textt{tabu} works in both modes and its name does not change... \textt X columns are also
%        possible in math mode; \xpackage{delarray} shortcuts for delimiters are available in both math and text modes.
%  \item a \textt{tabu} environment can contain another tabular of any kind: \textt{tabular}, \textt{tabular\stform*},
%        \textt{tabularx} or \textt{tabu} itself can be placed in any cell of a \textt{tabu}. Conversely,
%        \textt{tabu} can be placed in a \textt{tabular}, \textt{tabularx} \etc.
%  \item \textt{tabu} introduces optional parameters to columns specifications, providing facilities
%         for modifying columns or line widths, inserting verbatim text...
%  \item \textt{tabu} is more than compatible with \xpackage{arydshln} (for dashed and dotted lines)
%        and \xpackage{colortbl}: actually some corrections of those packages are loaded as soon as you
%        enter a \textt{tabu} environment. Compatibility with \xpackage{delarray}, \xpackage{hhline},
%        \xpackage{makecell}, \xpackage{booktabs}, \xpackage{siunitx}, \xpackage{dcolumn}, \xpackage{warpcol},
%        \etc\ is fine too.
%        When you are inside a \textt{tabu} environment, you can use \cs{raggedleft}, \cs{raggedright}
%        and \cs{centering} without special care about \cs{arraybackslash} and conversely \string\\\ has its
%        ``normal'' meaning inside a list of items that may appear in a \textt X column...
%  \end{itemize}
%
% \bigskip
%
% \declmargin \cs{begin}\M*{tabu} \textt{to}\meta{dimen} is like \textt{tabular\textasteriskcentered} but the inter-columns space is
% given a stretchability of 1fil, in other words \textt{@\M*{\cs{extracolsep}\M*{0pt plus 1fil}}}
% is inserted by default at the beginning of the tabular preamble, unless you specify another value for \cs{extracolsep}. Therefore
% ``\textt{tabu to}'' fills in width the specified \meta{dimen}.
%
% \bigskip
%
% \declmargin \cs{begin}\M*{tabu} \textt{spread}\meta{dimen} does a tabular whose width is \meta{dimen} wider than its natural width.
% \textt{@\M*{\cs{extracolsep}\M*{0pt plus 1fil}}} is inserted by default if \meta{dimen}$>0$.
%
%
% \subsection{\textt{tabu X} columns}
%
% \textt{tabu X} columns can be viewed as an enhancement of \xpackage{tabularx} \textt X columns:
% \begin{itemize}
% \item width coefficients can optionally be given to \textt X columns\\
%       ex.\, \textt{X[2.5]X[1]}\, is the same as\, \textt{X[2.5]X}\, and the same as\, \textt{X[5]X[2]} \\
%       This means that the first \textt X column will be two and a half wider than the second one or
%       that the first \textt X column width will be \sfrac{5}{7} of the whole tabular width. \\[.5\baselineskip]
%       \begin{tabu}{|X[c,2.5]|X[c]|} \firsthline \textt{X[2.5]} & \textt X \\ \hline\end{tabu}
%       \pagebreak
% \item horizontal alignment specification is made easier with\, \textt{X[5,r]X[2,c]}\, for example. Vertical
%       alignment can be specified as well with\, \textt{X[5,r,m]X[2,p,c]}\, (commas are not required,
%       but \textt{X[2cm]} or \textt{X[4pc]} could be misunderstood -- not by \TeX{}: by you...).\\
%       \begin{tabu}{X[c]X[4c]c}
%       \rowfont{\bfseries\ttfamily} Modifier & Meaning & Default \\
%       \textt l, \textt c, \textt r, \textt j  & left, centered, right, justified  & \textt j \\
%       \textt p, \textt m, \textt b &  \textt X column is converted into \textt p, \textt m or \textt b column & \textt p \\
%       \$                      & \textt{X[\$]} is a shortcut for:\, \textt{>\M*{\$}X<\M*{\$}} & \\
%       \end{tabu}
% \item \textt{tabu X} columns can be spanned with \cs{multicolum} without any restriction.
% \item \textt{tabu X} columns can be used with ``\textt{tabu spread}'' for small tabulars.
% \item \textt{tabu X} columns can contain any type of \textt{tabular}, \textt{tabular*}, \textt{tabularx} or \textt{tabu}
%       without special care about the syntax. \textt{tabu} can also be put inside \textt{tabular}, \textt{tabular*}
%       and \textt{tabularx}. As long as \textt{tabu} with \textt X columns has a \emph{default target}, nesting \textt{tabu}
%       with \textt X columns is easy. Furthermore, the default global alignment of a nested \textt{tabu} is \textt t
%       (for \textt{top}) while the default global alignment of a \textt{tabu} in a paragraph is \textt c (for \textt{centered}).
%       ^^AWhen nested inside another \textt{tabu}, \textt{tabu} takes care not to add duplicate margins around its cells...
% \item The ``algorithm'' (or the arithmetic) to get the target width for \textt{tabu X} columns is the same as the one
%       used by \xpackage{tabularx}. \cs{hfuzz} is the ``tolerance'' for the whole tabular width. We use \eTeX{} \cs{dimexpr}
%       instead of \TeX{} primitives (with round/truncate bias correction).
% \item Convergence to the target width is optimized: the \cs{halign} preamble is not re-built at each trial, but only expanded again,
%       until the target is reached. Though optimized, the process is the same as the one implemented for \textt{tabularx}
%       and in particular the content of the \textt{tabu} environment is collected as soon as a \textt{tabu X} column is found in the preamble.
%       This implies restrictions on catcode modifications and verbatim text inside a \textt{tabu} with \textt X columns.
% \item If the width of the whole tabular is not specified with ``\textt{tabu to}'' it is considered to be \cs{linewidth}.
%       \nameref{subsec:linegoal package option} makes the default width equal to \cs{linegoal}. Compilation must then be done
%       with \hologo{pdfTeX} either in \textt{pdf} or \textt{dvi} mode, and package \xpackage{linegoal} is loaded.
%       Remember that \cs{linegoal} uses \xpackage{zref-savepos} and \cs{pdfsavepos}:
%       if the \textt{tabu} is not alone in its paragraph \ie if the target is not
%       \cs{linewidth}, then two compilations (or more) are required to get the correct target. \\
%       Default target for nested \textt{tabu} environments is always \cs{linewidth}, which is the column width inside \textt p,
%       \textt m, \textt b and \textt X columns.
% \item As long as the \cs{halign} content is expanded more than once, protections against counters incrementation, whatsits (\emph{write})
%       index entries, footnotes \etc. are set up: the mechanism of \xpackage{tabularx} is reimplemented and enhanced for \textt{tabu X} columns.
%       \cs{tabuDisableCommands} can be used to neutralize the expansion of additional macros during the trials.
% \end{itemize}
%
% \subsubsection(X columns with tabu spread){X columns with ``\textt{tabu spread}''}
%
% \textt{tabu X} columns can be used with ``\textt{tabu spread}'' to adjust the column widths of tabulars that contain
% only small pieces of text. The question is: how to make a tabular the width of the line, with 6 columns; the columns 1, 2, 5 and 6
% are of equal widths and the widths of columns 3 and 4 are only one half. As possible solution:
%
% \begin{Verb*}
%  \begin{tabu} to\linewidth{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
%  1  &  2  &  3  &  4  &  5  &  6 \\\hline
%  \end{tabu}
% \end{Verb*}
%
% \medskip
%
%  \begin{tabu} to\linewidth{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
%  1          &2 &3 &4 &5 &6 \\\hline
%  \end{tabu}
%
%  \bigskip
%
% But the text in each cell is very short: one single character, and you prefer the table to be tight,
% but don't know the exact width of the whole:\pagebreak
%
% \begin{Verb*}
% \begin{tabu} spread 0pt{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
%  1  &  2  &  3  &  4  &  5  &  6 \\\hline
% \end{tabu}
% \end{Verb*}
%
% {\centering
% \begin{tabu} spread0pt{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
%  1  &  2  &  3  &  4  &  5  &  6 \\\hline
% \end{tabu}\par}
%
% \bigskip
%
% But now it's definitely too narrow, then give it some more space:
%
% \begin{Verb*}
% \begin{tabu} spread 2in{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
%  1  &  2  &  3  &  4  &  5  &  6 \\\hline
% \end{tabu}
% \end{Verb*}
%
% {\centering
% \begin{tabu} spread2in{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
%  1  &  2  &  3  &  4  &  5  &  6 \\\hline
% \end{tabu}\par}
%
%  \bigskip
%
% \textt{tabu spread} is useless with long columns: the following tabular was made with this preamble:
% \begin{Verb*}
% \begin{tabu} spread 3cm{@{}X[9]X[4]|X|}
% \end{Verb*}
%
%
% {\footnotesize
% \begin{tabu} spread 3cm{@{}X[9]>{\parskip=5pt}X[4]|X|}
% "Like the air we breathe, Sherlock Holmes is everywhere.
% His pipe-smoking, deer stalkered image peers at us from ads in Yellow Pages,
% to signs for neighbourhood crime-watch; from billboards to the classroom;
% from film and television to the public library, and now over the Internet.
% He long ago transcended the boundaries of 19th Century London to become
% an international best-seller and has been accepted as part
% of British folklore. Holmes is alive to millions."
% &
% There the text was too long, and \textt{tabu spread} behaves as if you didn't give it a target.\par
% The result of this example is the same as if one had written \cs{begin}\M*{tabu}\textt{to}\cs{linewidth}.
% & \cellcolor{GhostWhite}\centering\rotatebox{-90}{\kern-1.4ex\bfseries Sherlock Holmes}
% \\ \tabucline{1-2}
% \multicolumn{2}{|c|}{And a \cs{multicolumn} cell, just to see} & \omit \\ \tabucline{1-2}
% \end{tabu}}
%
% In the preamble, \textt{@\M*{}} means that you remove the margin.
%
%
% \subsubsection{Nesting \textt{tabu}{\texorpdf\small s} with \textt X columns}
%
% This section should contain some examples but I've no time presently...
%
%
% \subsection{Lines inside \textt{tabu}}
%
% \subsubsection{First important remarks}
%
% The features provided in this section are quite experimental: they are not generally taken for good typography.
% You can use \xpackage{tabu} with package \xpackage{booktabs} for example, which provides properly designed
% commands for horizontal rules in tabulars. \xpackage{arydshln} is pretty good too, but it modifies a huge
% amount of macros of \xfile{array.sty}, something that \thispackage does not.
%
% Lines in \textt{tabu} printed in this document are mostly made with \xpackage{booktabs}.
%
%
% \subsubsection(Vertical lines){Vertical lines: \textt\textbar\ has an optional parameter}
%
% Inside \textt{tabu} environment, the vertical line marker \textt\textbar\  has an \emph{optional} argument
% which is the width of the vertical rule. The default width remains \cs{arrayrulewidth} of course.
% The optional argument for \textt\textbar\ can also contain the name of a color.
% color \emph{names} are only possible, not a color specification by the mean of a color model.
% The width of the line if specified, must come before the color name (sorry for that, but I was tired
% to parse parameters... as for \textt X columns, commas are optional).
% Example:
%
% {\tabcolsep=3pt
% \begin{tabu}{@{}X[3mc]X[3m]X[6m]@{}} \toprule
%     \begin{tabu}{||[5pt]|c|c||[5pt]|}
%        Hello & World
%     \end{tabu}
% &
% The \textt{tabu} you see on left was made with the code displayed on the right.
% &
% \verbatim{
% \begin{tabu}{||[5pt]|c|c||[5pt]|}^^@
%     Hello & World^^@
% \end{tabu}}
% \\ \midrule
%     \begin{tabu}{||[5pt,red]|c|c||[5pt blue]|}
%        Hello & World
%     \end{tabu}
% &
% The \textt{tabu} you see on left was made with the code displayed on the right.
% &
% \verbatim{
% \begin{tabu}{||[5pt,red]|c|c||[5pt blue]|}^^@
%     Hello & World^^@
% \end{tabu}}
% \\ \bottomrule
% \multicolumn{3}{r}{\scriptsize\lk The \cs{verbatim} command available inside \textt{tabu} with \textt X columns was used: guess in which cells...?}
% \end{tabu}}
%
% Note that it is always a good idea to protect the optional argument with braces: \M*[\M*{...}].
% But it's not necessary because \thispackage takes care the \textt\textbar\ token to be rewritten
% before any other column type (just after \stform* however, for obvious reasons). But if you
% use the optional argument for the vertical line into a user-defined column type
% (declared with \cs{newcolumntype} for example), you can get an error. In this case,
% it is compulsory to protect the optional argument by braces. Finally, it's not very often
% that a user-column type contains a vertical bar...
%
%
% \subsubsection(Horizontal lines){More style for horizontal lines: \cs{tabucline}}
%
% \begin{declcs}{tabucline}\M[style or spec.]\M*{start-end}\\
% \end{declcs}
%
% \cs{tabucline} is an attempt to give a versatile command to make horizontal lines:
% \begin{itemize}
% \item \cs{tabucline} is pretty good with vertical lines even if the thickness of the line grows up,
% \item \cs{tabucline} takes care of \cs{extrarowheight},
% \item \cs{tabucline} can make horizontal dashed lines, with a \xpackage{pgf}/\xpackage{TikZ} syntax:\\
%       \cs{tabucline}\M*[\meta{width} on\meta{dash} off\meta{gap}]\M*{\meta{first column}-\meta{last column}}
% \item alternatively, you can give \cs{tabucline} a \cs{hbox} to make a leader with it: The \meta{\ttfamily spec.} must then
%       begin with \cs{hbox}, \cs{box} or \cs{copy},
% \item finally you can give \cs{tabucline} a color \emph{name}, after the line specification.
% \end{itemize}
%
%
%
% Any parameter can be omitted. \tabulinestyle{tabucline=.4pt on2pt off1.5pt}
%
% {\parskip=0pt\topsep=0pt
% \begin{center}\def\margintext#1{\noalign{\vtop to0pt{\marginnote{\ttfamily\small #1}[-1.8ex]\vss}}}^^A
% \begin{tabu}{|[1.5pt]|>{\ttfamily}X@{\hskip\tabcolsep}X[1.4]||[1.5pt]} \tabucline[\heavyrulewidth]- \savetabu{tabucline}
%  \cs{tabucline}\M*[1pt on 1.5pt off 2pt]\M*{1-4} & draws a horizontal dashed line of width \textt{1pt}. Dashes are
%                                                    \textt{1.5pt} long and gap width is \textt{2pt}. The line is drawn
%                                                    between columns 1 and 4. Here there are only 2 columns and the line
%                                                    stops at column 2. \\ \tabucline[1pt on 1.5pt off 2pt]{1-4} \margintext{[1pt on 1.5pt off 2pt]}
%  \cs{tabucline}\M*[1.5pt]\M*{-}                    & draws a horizontal solid line of width \textt{1.5pt} between the first
%                                                    and the last column. \\ \tabucline[1.5pt]{-} \margintext{[1.5pt]}
%  \cs{tabucline}\M*{2-}                           &  draws a horizontal solid line of width \cs{arrayrulewidth} between the second
%                                                    column and the last one.\\ \tabucline{2-} \margintext{default}
%  \cs{tabucline}\M*[on 2pt red]\M*{-5}            &  draws a horizontal dashed line between columns 1 and 5
%                                                     of width \cs{arrayrulewidth}. Dashed are
%                                                    \textt{2pt} long and gaps width is \textt{4pt} (the default).
%                                                    \\ \tabucline[on 2pt red]{-5} \margintext{[on 2pt red]}
% \end{tabu}
% \end{center}}
%
% \begin{declcs}{tabucline}\stform*\M[style or spec.]\M*{start-end}
% \end{declcs}
%
% For fine tuning, the star form \cs{tabucline}\stform* can be used to keep the vertical lines that might
% cross the horizontal line. As a consequence, the content of special \textt @ of \textt ! columns
% will interrupt the horizontal line either. This might be usefull when \cs{extrarowheight} is high.
% Example:
%
% {\makeatletter
% \begin{tabu}{*3{X[mc]}}
% \extrarowheight=8pt
% \begin{tabu}{|[1pt]X|X|[1pt]} \tabucline-
% Hello & world \\ \tabucline[1pt on 2pt off 2pt,blue]-
% Hello & world \\  \tabucline-
% \end{tabu}
% &
% \extrarowheight=8pt
% \begin{tabu}{|[1pt]X|X|[1pt]} \tabucline*-
% Hello & world \\ \tabucline*[1pt on 2pt off 2pt blue]-
% Hello & world \\  \tabucline*-
% \end{tabu}
% &
% \extrarowheight=8pt
% \begin{tabu}[c]{|[1pt]X|X|[1pt]} \firsthline
% Hello & world \\ \hline
% Hello & world \\  \lasthline
% \end{tabu} \\
% \extrarowheight=0pt
%   \cs{tabucline}
% & \cs{tabucline}\stform*
% & \cs{firsthline} and \cs{hline} and \cs{lasthline} \\
% \multicolumn3c{In each table, \cs{extrarowheight} is equal to \textt{8 pt}.} \\
% \end{tabu}}
%
% \cs{tabuclines} tries to put the line in the middle, so that the text is centered in its cell. \enlargethispage\baselineskip
% \cs{tabuclines}\stform* tries to take care of vertical lines.
% Well this is not perfect: it works pretty well with simple vertical lines, but not really with double
% lines, triple lines with colors etc... But it can help in simple cases...
%
% \pagebreak
% \begin{declcs}{tabulinestyle}\M{style=spec., style=spec., style=spec. ...}
% \end{declcs}
%
% This command defines a line style to be used in the first optional argument of \cs{tabucline}:
%
% \begin{tabu}{@{}X[1.6,c]@{}X[c]@{}} \tabucline[\heavyrulewidth]- \tabucline[\hbox{$\scriptstyle\star$}]- \toprule
% \rowfont[c]{\bfseries} Define the line style & Use the line style \\ \midrule
% \cs{tabulinestyle}\M*{myline=0.4pt on 1.5pt off 1pt} & \cs{tabucline}\M*[myline]\M*{-} \\ \tabucline[\heavyrulewidth on 1pt off 2pt]-
% \cs{tabulinestyle}\M*{myleader=\cs{hbox}\M*{\$\cs{scriptstyle}\cs{star}\$}} & \cs{tabucline}\M*[myleader]\M*{1-3} \\
% \multicolumn{2}{c}{This way it is easy to change dashed lines into solid ones} \\ \bottomrule \tabucline[\hbox{$\scriptstyle\star$}]- \tabucline[\heavyrulewidth]-
% \end{tabu}
%
% \begin{tabu}{*{3}{X[cm]}}
% \tabcolsep=2pt
% \begin{tabu}{|l|l|} \tabucline[.4pt on 1pt off 3pt]{-}
% \multicolumn{2}{|c|}{Dashed or dotted} \\ \tabucline[1pt on2pt off1pt]{-}
% And below & is the default \\ \tabucline[on 4pt]-
% \end{tabu}
% &
% \tabcolsep=2pt
% \begin{tabu}{|c|c|} \tabucline[.4pt off 2pt]{-}
% Dash & Gap \\ \tabucline[10pt on2pt off 1pt]{1-1}
% \multicolumn{2}{|c|}{This one was thick} \\ \tabucline[3pt]-
% \end{tabu}
% &
% \tabcolsep=2pt
% \begin{tabu}{|X[cm]|X[cm]|X[2cm]|} \tabucline[.4pt on6pt off 2pt]{-}
% Dash & Gap... & ...or leader \\ \tabucline[\hbox{\small\kern1pt\ScissorRight\vrule width3.4pt depth-5pt height5.4pt\kern1pt\vrule width3.4pt depth-5pt height5.4pt\kern1pt}]-
% \multicolumn{3}{|c|}{Interesting ?} \\ \tabucline-
% \end{tabu}
% \end{tabu}
%
% \enlargethispage{2\baselineskip}
% \small
% \hfil\Shapepar{\nutshape}{Now we stop it because things are becoming too ugly and go to have a look at \textt{tabu} in mathematical mode...}\hfil\null
%
% \normalsize
%
%
% \subsection{\textt{tabu} in math mode}
%
% {
% \extrarowheight=3pt
% \begin{tabu} to\linewidth{X[1.5]X[r$]} \toprule
% On the left, you can see the famous Maxwell-Lorentz equations for electromagnetic field in vacuum,
% publicated in \oldstylenums{1873}.
% &
% \hfil\begin{tabu}({>{\Gape[8pt]\displaystyle}r>{\displaystyle}l}.
% \Div\vv E  &= \frac{\rho}{\epsilon_0}                             \\
% \Div\vv B  &= 0                                                   \\
% \Rot\vv E  &= - \dpartial{\vv B} t                                \\
% \Rot\vv B  &= \mu_0 \vv j + \mu_0 \epsilon_0\, \dpartial{\vv E} t
% \end{tabu}
% \\ \bottomrule
% \end{tabu}}
%
% In this example, the big \textt{tabu} is: \cs{begin}\M*{tabu} to\cs{linewidth}\M*{X[1.5]X[r\$]}.
%
% The nested \textt{tabu} (in math mode) uses \xpackage{delarray} shortcut: its preamble is:
% \begin{Verb}
%    \begin{tabu}({>{\Gape[8pt]\displaystyle}r>{\displaystyle}l}.
% \end{Verb}
%
% You immediately see the interest for \textt{tabu} to have a default target.
%
% \cs{Gape} is a \xpackage{makecell} macro to adjust the height and depth of the rows.
%
% Horizontal rules are \xpackage{booktabs} \cs{toprule}, \cs{midrule} and \cs{bottomrule}.
%
% \begin{tabu}{@{}*3{X[c]@{}}} \toprule \savetabu{math}
% \rowfont{\bfseries} \textt{array} & \textt{tabu} & \textt{tabu spread 1em} \\ \midrule
% $\begin{array}[t]|{cc}|
% \alpha & \beta \\
% \gamma & \delta
% \end{array}$
% &
% $\begin{tabu}|{cc}|
% \alpha & \beta \\
% \gamma & \delta
% \end{tabu}$
% &
% $\begin{tabu} spread 1em|{cc}|
% \alpha & \beta \\
% \gamma & \delta
% \end{tabu}$
% \\ \bottomrule
% \end{tabu}
%
%
% Here, vertical lines are made with \xpackage{delarray} shortcuts:\hfill
% \verb+$\begin{tabu} spread 1em |{cc}|+
%
% \begin{tabu}{\usetabu{math}}
% \multicolumn2{@{}l}{Vertical lines inside the tabular preamble gives:}
% &
% $\begin{tabu} spread 1em[c]{|cc|}
% \alpha & \beta \\
% \gamma & \delta
% \end{tabu}$
% \end{tabu}
%
% \bigskip
% {\raggedleft\footnotesize\lk This was an example of \cs{savetabu}...\cs{usetabu} to keep the alignment.\par}
%
%
% \subsection{Verbatim inside \textt{tabu} with \textt X columns}
%
% The process of computing \textt X columns widths implies to make ``trials'': this means that
% the tabular is first printed in internal mode, inside a box which is measured until the target
% width is reached. Such trials require to collect the content of the \textt{tabu} environment.
% Therefore, the category codes of the characters read in the environment are fixed, and \cs{verb}
% commands are not allowed.
%
% \begin{declcs}{verbatim}\M{general text}
% \end{declcs}
%
% To get round this limitation, \textt{tabu} provides the command \cs{verbatim} which allows to put
% some pieces of verbatim text inside a \textt{tabu}: it is based on \eTeX{} \cs{scantokens} primitive
% and is defined only inside the \textt{tabu} environment. \cs{verbatim} has some other limitations
% you must know:
%
%
% \begin{tabu}to\linewidth{>{\ttfamily\centering}p{3cm}p{\dimexpr\linewidth-3cm-4\tabcolsep}} \toprule
%  \verb+^^@+        &can be used to get a carriage return inside \cs{verbatim} \\
%  \verb+^+          &consequently \verb+^+ is a normal subscript character     \\
%  \verb+{+ \verb+}+ &curly braces must be equilibrated                         \\
%  \%                &The percent character\, \%\, is for commentaries: the content of the
%                     environment is collected before \cs{verbatim} does its job, therefore commentaries are
%                     removed...
%                    \\\bottomrule
% \end{tabu}
%
% If you need more verbatim inside a \textt{tabu} environment:
% \begin{itemize}
% \item you should avoid the use of \textt X columns
% \item or if you really want to use \textt X columns, you must save your verbatim text before the \textt{tabu},
%     for example with the \textt{SaveVerbatim} environment provided by the package \xpackage{fancyvrb}.
% \end{itemize}
%
%
%
% \subsection(Numbers in tabu){Printing numbers inside \textt{tabu} with \xpackage{numprint} and \xpackage{siunitx}}
%
% \subsubsection{Just make it easy !}
%
% \thispackage provides a \emph{facility} to print numbers inside columns. This facility is not
% implemented to replace \xpackage{siunitx} \textt S and \textt s columns or \xpackage{numprint}
% \textt n and \textt N columns or other packages that provide alignment such as \xpackage{warpcol},
% \xpackage{dcolumn} or \xpackage{rccol}. It just make
% easy to apply a macro you get already on each number in a column of a \textt{tabu}.
%
% \cs{tabudecimal} has been developped mainly because it makes possible to align numbers inside \textt{tabu X} columns.
%
% \begin{declcs}{tabudecimal}\M{user-macro}
% \end{declcs}
%
% \cs{tabudecimal} can be used in the preamble of a \textt{tabu} before a column specification.
% The \meta{user-macro} is a macro with one parameter that have to be defined before.
%
% \medskip
%
% Example with \csbf{numprint}:
%
%
% \begin{Verb*}
% \def\usermacro#1{\numprint[\officialeuro]{\zap@space #1 \@empty}}
% \nprounddigits{2} \npprintnull \npthousandsep{\,} \npunitseparator{~}
% \end{Verb*}
%
% \begin{SaveVerbatim}{tabudecimal}
% \begin{tabu}{*2{>{\tabudecimal\usermacro}r}}
%  12.324    &745.32  \\
%  21.13     &0       \\
%  213.3245  &12.342  \\
%  322143.12 &324.325 \\
% \end{tabu}
% \end{SaveVerbatim}
%
% \nprounddigits{2} \npprintnull \npthousandsep{\,} \npunitseparator{~}
% \makeatletter \let\npunitcommand\@firstofone
% \def\usermacro#1{\numprint[\officialeuro]{\zap@space #1 \@empty}}
% \makeatother
%
% \begin{tabu}{XX}
% \multicolumn{2}{l}{\verbatim{\begin{tabu}{|[GreenYellow]*2{>{\tabudecimal\usermacro}X[r]|[GreenYellow]}}}} \\
% \verbatim{
%  \rowfont[c]{\bf} January & February \\ ^^@
%  12.324    & 745.32  \\ ^^@
%  21.13     & 0       \\ ^^@
%  213.3245  & 12.342  \\ ^^@
%  2143.12 & 324.325 \\ ^^@
% \end{tabu}}
% &
% \begin{tabu}{|[GreenYellow]*2{>{\tabudecimal\usermacro}X[r]|[GreenYellow]}c} \tabucline[1pt GreenYellow]-
% \rowfont[c]\bf       January   &February & ...\\ \tabucline[1pt on2pt GreenYellow]-
%                      12.324    &745.32   & ... \\
%                      21.13     &0        & ... \\
%                      213.3245  &12.342   & ... \\
%                      2143.12 &324.325  & ... \\ \tabucline[1pt GreenYellow]-
% \end{tabu}
% \end{tabu}
%
% \medbreak
%
% Example with \csbf{SI}:
%
% \begin{Verb*}
% \def\usermacro#1{\SI[group-four-digits=true,            % thousand separator
%                                round-mode=places,                % round numbers
%                                round-precision=2,                  % with 2 decimal digits
%                                round-integer-to-decimal=true,  % add trailing 0 if necessary
%                                per-mode=symbol]{#1}{\officialeuro\per\kilo\gram}}
% \begin{tabu}spread 0pt{|[GreenYellow]*2{>{\tabudecimal \usermacro}X[r]|[GreenYellow]}} ....
% \end{Verb*}
%
%
% \def\usermacro#1{\SI[group-four-digits=true,
%                      round-mode=places,
%                      round-precision=2,
%                      round-integer-to-decimal=true,
%                      per-mode=symbol]{#1}{\officialeuro\per\kilo\gram}}
% \begin{tabu}{*2{X}}
% \begin{tabu}spread 0pt{|[GreenYellow]*2{>{\tabudecimal\usermacro}X[r]|[GreenYellow]}c} \tabucline[1pt GreenYellow]-
% \rowfont[c]\bf       January  &February &... \\\tabucline[1pt on2pt GreenYellow]-
%                      12.324   &745.32   &... \\
%                      21.13    &0        &... \\
%                      213.3245 &12.342   &... \\
%                      2143.12  &324.325  &... \\\tabucline[1pt GreenYellow]-
% \end{tabu}
% &
% As you can see, the columns widths are exactly the same, whatever their content.
% \end{tabu}
%
% \subsubsection{You should know how it works...}
%
% Yes you should know how it works to avoid problems. \textt{tabu} has a small scanner
% based on \cs{futurelet} to grab all numbers, blank spaces, commas and dots $+$ and $-$ sign
% and also the letter \textt e and  \textt E for exponants.
% The scanner stops as soon as something else than a number, blank space, comma, dot, $+$, $-$, \textt e, \textt E
% is found, and even if it is a macro that contains a number.
%
% This explains why there is \cs{zap@space} in the definition of \cs{usermacro}: because the scanner
% scans blank spaces and because \cs{numprint} does not allow blank spaces in its mandatory argument,
% quite strangely...
%

%
%
%
% \subsection{\texorpdf\xpackage{delarray} shortcuts}
%
% When you enclose your tabular with math delimiters using \xpackage{delarray} shortcuts,
% \xpackage{tabu} tries to reach its target for the whole: the tabular and the delimiter(s).
% You can see the difference:
%
% {\centering
% \extrarowheight=8pt
% \begin{tabu}to .6\linewidth{X[m]} \tabucline-
%
% \extrarowheight=0pt
% \begin{tabu}({X})
%  This is \textt{tabu} with \xpackage{delarray} shortcut for parenthesis around
% \end{tabu}
% \\ \tabucline[1pt on2pt blue]-
%
% \extrarowheight=0pt
% \begin{tabularx}{\linewidth}[t]({X})
%  This is \textt{tabularx} with \xpackage{delarray} shortcut for parenthesis around
% \end{tabularx}
% \\ \tabucline[1pt on2pt blue]-
%
% \extrarowheight=0pt
% \begin{tabu}\{{X}\}
%  This is \textt{tabu} with \xpackage{delarray} shortcut for curly brackets around
% \end{tabu}
% \\ \tabucline[1pt on2pt blue]-
%
% \extrarowheight=0pt
% \begin{tabularx}{\linewidth}[t]\{{X}\}
%  This is \textt{tabularx} with \xpackage{delarray} shortcut for curly brackets around
% \end{tabularx}
% \\ \tabucline-
%
% \end{tabu}\par}
%
% With \textt{overfull hboxes (15.8pt and 16.1pt too wide)} for \textt{tabularx}.
%
%
% \section(save the tabu preamble){Save the \textt{tabu} preamble and \textt X columns widths: \cs{savetabu}, \cs{usetabu}}
%
% \begin{declcs}{savetabu}\M{user-name}
% \end{declcs}
%
% The command \cs{savetabu} can be used at the end of any line of a \textt{tabu} environment to save the
% target width (or the spread), the columns specifications (tabular preamble) and the widths of
% \textt{tabu X} columns (if there is any).
% This possibility allows to easily make tabulars which share exactly the same shape
% throughout your document. This can also be used as a kind of \textt{tabbing} environment
% which is able to remember the tabs positions.
%
% If the \meta{user-name} has been used before, an info is displayed in the \xext{log} file and the
% previous settings are overwritten.
%
%
% \begin{declcs}{usetabu}\M{user-name}
% \end{declcs}
%
% \cs{usetabu} is the complement of \cs{savetabu}: it can be used in the \textt{tabu}
% preamble instead of the usual columns specifications
% to restore any previous settings saved with \cs{savetabu}.
% The \meta{user-name} must exist otherwise, you get an error.
%
% \cs{usetabu} locally restores:
% \begin{itemize}
% \item the preamble,
% \item the target width of the \textt{tabu} in points: the saved target width does not contain
%       any control sequence: it is fixed and stored in points,
% \item the width of \textt{tabu X} columns: those widths are not calculated any more, and \textt{X}
%       columns are directly transformed into \textt p, \textt m or \textt b columns.
% \item \cs{tabcolsep} (or \cs{arraycolsep} in math mode)
% \item \cs{arrayrulewidth}, \cs{doublerulesep}, \cs{extrarowheight} and \cs{extratabsurround}
% \end{itemize}
%
% Example:
%
% \begin{Verb*}
%  \extrarowheight=5pt\tabcolsep=12pt
%  \begin{tabu}to .7\linewidth{|XXX|X[c]|} ($db(\savetabu)){mytabu}   \tabucline*[on1pt]-
%   This & is & tabu & package                                             \\ \tabucline*[on1pt]-
%  \end{tabu}
%  \begin{tabu}{($db(\usetabu)){mytabu}}                                          \tabucline*[on1pt]-
%  \multicolumn3{|c}{This is tabu} & package                         \\ \tabucline*[on1pt]-
%  \end{tabu}
% \end{Verb*}
%
%  \begin{center}
%  \tabulinestyle{myline=on1pt}\extrarowheight=5pt\tabcolsep=12pt
%  \begin{tabu}to .7\linewidth{|XXX|X[c]|} \savetabu{mytabu} \tabucline*[myline]-
%   This & is & tabu & package         \\ \tabucline*[myline]-
%  \end{tabu}
%
%
%  \begin{tabu}{\usetabu{mytabu}}            \tabucline*[myline]-
%  \multicolumn3{|c|}{This is tabu} & package    \\ \tabucline*[myline]-
%  \end{tabu}
%
%  \end{center}
%
% If one day you use \textt{tabu}, you will have the idea to restore a \textt{tabu} while modifying its target,
% or adding new columns... \cs{savetabu} and \cs{usetabu} have not been thought for this purpose, and you may
% have unexpected results. \cs{usetabu} is a help to get several tabulars of exactly the same shape, same target,
% same preamble.
%
%
%
%
% \section(row font and alignment){Change the font and the alignment in one row: \cs{rowfont}}
%
% \begin{declcs}{rowfont}\M[alignment]\M*{font specification}
% \end{declcs}
%
% Inside a \textt{tabu} environment, you can modify the font for each cell in a row.
% \cs{rowfont} has priority over column font specification, exactly like \cs{rowcolor} (package \xpackage{colortbl})
% has priority over \cs{columncolor}.
%
% The alignment of each cell in one row can also be changed to: \topsep=0pt
% \begin{center}
% \begin{tabu}{>{\ttfamily}r@{\,$=$\,}lc>{\ttfamily}r}
% l          &left    &{\qquad\smaller or\, for \xpackage{ragged2e} settings: } &L \\
% c          &center  &                                                         &C \\
% r          &right   &                                                         &R \\
% j          &justify &                                                         &J \\
% \end{tabu}
% \end{center}
%
% Any other value for the optional \meta{alignment} parameter is silently ignored. If \xpackage{ragged2e} is not loaded,
% \textt L\, \textt R\, \textt C\, and\, \textt J\, are synonymous with the lowercase equivalent.
%
% \section(Differences: tabu, tabular, tabularx){Differences between \textt{tabu}, \textt{tabular} and \textt{tabularx}}
%
% \subsection{Paragraph indentation}
%
% \textt{tabu} takes care of paragraph indentation when it is used with \textt X columns and its default target,
% no matter if it has been loaded or not with the \textt{linegoal} option.
% Example with \LaTeX{} default: \cs{parindent} $=20$pt.
%
% {\parindent=20pt \makeatletter\let\tabudefaulttarget\linewidth\makeatother
%
% \begin{tabu}{|[GreenYellow]X|[GreenYellow]} \tabucline[GreenYellow]-
% This is \textt{tabu} with its default target in an indented paragraph. \\ \tabucline[GreenYellow]-
% \end{tabu}
%
% \noindent\begin{tabu}{|[GreenYellow]X|[GreenYellow]}\tabucline[GreenYellow]-
% This is \textt{tabu} with its default target, preceded by \cs{noindent} \\ \tabucline[GreenYellow]-
% \end{tabu}
%
%
% \begin{tabularx}\linewidth{|X|} \hline
% This is \textt{tabularx} with target: \cs{linewidth} in an indented paragraph. \\ \hline
% \end{tabularx}
%
% \noindent\begin{tabularx}\linewidth{|X|} \hline
% This is \textt{tabularx} with target: \cs{linewidth}, preceded by \cs{noindent} \\ \hline
% \end{tabularx}}
%
%
% \subsection{Custom environments}
%
% Unlike \textt{tabularx}, it is possible to define your own environment using \textt{tabu}:
%
% \begin{Verb}
% \newenvironment{foo}
%     {\begin{tabu}{X[1.2]|[1pt gray]X}}
%     {\end{tabu}}
% \end{Verb}
%
% \newenvironment{footabu}
%     {\begin{tabu}{@{}X[1.2]|[1pt,gray]X@{}}}
%     {\end{tabu}}
%
% \begin{footabu}
% \textt{tabu} environment, even when \textt X columns are used, may appear
% in the definition of your custom tabular environment.
% &
% You can also use the commands \cs{savetabu} and \cs{usetabu} for this purpose.
% \end{footabu}
%
%
%
% \subsection{Inversion of tokens}
% \label{subsec:inversion of tokens}
%
% \begin{SaveVerbatim}{tempVerb}
% \begin{tabular}{|>{\bfseries}>{ before }l<{ one }<{ two }|}
%     cell content
% \end{tabular}
% \end{SaveVerbatim}
%
%
% When you typeset the following \textt{tabular}:
% \UseVerbatim{tempVerb}
%
% \begin{tabu}to .9\linewidth{XX} \savetabu{tabbing}
% You get the following result:
% &
% \begin{tabular}{|>{\bfseries}>{ before }l<{ one }<{ two }|}
%     cell content
% \end{tabular}
% \end{tabu}
%
%
% \smex The word \emph{before} is not bold, and \textitbf{two} comes before \textitbf{one}.
%
% The reason is explained in the documentation of \xfile{array.sty}, and is related
% to the \textt{array} environment in math mode when using \cs{newcolumntype}.
%
% This rather strange inversion of tokens may be justified in math mode (otherwise, errors may occur)
% but not in text mode in our opinion. Inside a \textt{tabu} environment, when not in math mode,
% the tokens are not reversed and you get the intuitively expected result:
%
% \begin{tabu}{\usetabu{tabbing}}
% &
% \begin{tabu}{|>{\bfseries}>{ before }l<{ one }<{ two }|}
%     cell content
% \end{tabu}
% \end{tabu}
%
% In math mode however, tokens are in the reverse order in the \textt{tabu} environment
% like they are in the \textt{array} environment.
%
% \subsection(Improved rewrite process){Improved process for rewritting columns}
%
% In the following example, you get an error with \textt{tabular} and no error with \textt{tabu}.
% With \textt{tabular}, and \xpackage{siunitx} \textt S column, the rewritting process is as follow:
%
% \begin{SaveVerbatim}{siunitx}
% \documentclass{minimal}
% \usepackage{numprint,siunitx,xcolor}
% \usepackage{tabu}
% \begin{document}
%
% \begin{tabular}{*2{S[color=green]}}
%     123,45
% \end{tabular}
%
% \begin{tabu}{*2{S[color=green]}}
%     123,45
% \end{tabu}
%
% \end{document}
% \end{SaveVerbatim}
%
% \begin{tabu}{@{}X[m]X[m1.2]@{}}
% \UseVerbatim{siunitx}
% &
% Inside \textt{tabular}:
% \begin{enumerate}[label=\arabic*),topsep=\parskip,itemsep=.5\parskip]
% \item Rewrite \textt S: not found because inside \M*{...}
% \item Rewrite \stform*
% \item Rewrite \textt n column defined by package \xpackage{numprint} \\
%       Then the \textt `n' in \textt{gree\textcolor{red}n} is rewritten \smex problem
% \end{enumerate}
% \vskip1ex
% Inside \textt{tabu}:
% \begin{enumerate}[label=\arabic*),itemsep=.5\parskip,topsep=\parskip,parsep=\parskip]
% \item Rewrite \stform*
% \item Rewrite \textt\textbar\ (there is none here)
% \interitem \textt{\scshape go back}
% \item Rewrite \stform*
% \item Rewrite \textt\textbar\
% \item Rewrite \textt S
% \item Rewrite \textt n \smex not found because \textt S rewritten before, according to \xpackage{siunitx} definition.
% \end{enumerate}
% \end{tabu}
%
% The process of rewritting columns is usually longer inside \textt{tabu} than inside \textt{tabular},
% but conversely \textt{tabu} with \textt X columns is optimised compared to \textt{tabularx},
% because the preamble is built only once, not rebuilt before each trial as \textt{tabularx} does...
%
% The process of rewritting is very sensitiv to the order in which columns are actually rewritten.
% Therefore, if it possible to define a new column type using the \textt X token for use with \textt{tabu}:\nobreak
% \begin{Verb*}
% \newcolumntype{C}{X[c]}
% \end{Verb*}
%
% it is not recommanded no nest such constructions like:
% \begin{Verb*}
% \newcolumntype{Q}{>{\color{green}}C}
% \end{Verb*}
%
% In fact, a problem may arise in nested \textt{tabu}{\small s} if such a \textt Q column type
% is defined before the \textt C column type...
%
% Well, just avoid to nest new column type definitions !
%
%
%
% \section{The package options}
%
% \subsection(The debugshow option){The \textt{debugshow} package option}
%
% \begin{declcs}{tracingtabu}
% \end{declcs}
%
% With the package option \textt{debugshow}, \xpackage{tabu} will report the widths it computes
% at each attempt to read the target, when \textt X columns are used.
% The control sequence \cs{tracingtabu} has the same effect as the \textt{debugshow} option.
%
% Typical information in the \xext{log} file:
%
% {\ttfamily \noindent \tabcolsep=2pt
% \begin{tabu}{cr*{3}{>{\centering}X[2]}>{\centering}X>{\centering}X[2]}
% \rowfont[c]{}
% (tabu)     &Try &tabu X                                        &tabu Width  &Target      &Coefs &Update \\
% (tabu)     &1)  &386.67296pt                                   &797.34592pt &386.67296pt &2.0pt &-205.33649pt \\
% (tabu)     &2)  &181.33647pt                                   &386.67294pt &386.67296pt &2.0pt &0.00002pt \\
% (tabu)     &2)  & \multicolumn{5}{l}{\ \ Target Reached (hfuzz=0.1pt) **************** }\\
% \end{tabu}}
%
% What does it mean? \def\pt#1{$#1$\textt{pt}}
% \begin{enumerate}[label=\arabic*),topsep=0pt,itemsep=\parskip,parsep=0pt]
% \item The first attempt was performed with \textt{X}$=$\pt{386.67296} \\
%       The \textt{tabu} width (\pt{797.34592}) exceeded the target by \pt{410.67296}. \\
%       Thus \textt X has been updated: \pt{410.67296} $/2=$ \pt{205.33649} and then:\\
%       \null\quad\textt X $=$ \pt{386.67296} $-$ \pt{205.33649} $=$ \pt{181.33647}
% \item The second attempt lead to a \textt{tabu} width of \pt{386.67294}: the target is reached. \\
%       The final width of each \textt X column is the product of \textt{tabu X} by its width coefficient.
% \end{enumerate}
%
% \subsection(The linegoal option){The \textt{linegoal} package option}
% \label{subsec:linegoal package option}
%
% With the \textt{linegoal} option, the default target for \textt{tabu} with \textt{X} columns is
% \cs{linegoal} instead of \cs{linewidth}.
% The \xpackage{linegoal} package must be loaded and compilation must be done with \hologo{pdfTeX},
% otherwise, a warning is displayed and the \textt{linegoal} option has no effect: the default
% target remains \cs{linewidth}. \cs{linegoal} works with \hologo{pdfTeX} in \textt{pdf} mode
% \textbf{and in} \textt{dvi} mode.
%
% If for some reason, you wish to turn down the \textt{linegoal} option in your document,
% you can say (in a group for example):
% \verb+\let\tabudefaulttarget=\linewidth+
%
% \subsection(The delarray option){The \textt{delarray} package option}
%
% \textt{delarray} option has the single effect to load \xfile{delarray.sty} for delimiters shortcuts
% around \textt{tabu}. Delimiters shortcuts work both in math and text mode.
%
%
% \subsection(The light option){The \textt{light} package option}
% \label{sec:light package option}
%
%
% When you enter a \textt{tabu} environment, two macros amongst the smallest possible of \xfile{array.sty}
% are modified:
% these are \cs{prepnext@tok}, which is expanded while \cs{@mkpream} builds the \cs{halign} preamble
% and \cs{save@decl} to avoid inversion of tokens in text mode (see \nameref{subsec:inversion of tokens}).
%
% Modification of \cs{prepnext@tok} is loaded only inside the \textt{tabu} environment, while
% the modification of \cs{save@decl} is loaded only inside the group in which \cs{@mkpream} works: this is
% very very local to \textt{tabu} and cannot interfere with any other tabular !
%
% \cs{prepnext@tok} could have been loaded inside the \cs{@mkpream} group as well, but then \cs{rowfont}
% would not have worked inside \textt{array} or \textt{tabular} nested into a \textt{tabu}. Thus the choice.
%
% As you see, these modifications do no modify \textt{tabular}, \textt{tabular*}, \textt{tabularx}, \textt{longtable}
%  \etc \etc \etc
%
% If for some reason you prefer the original macros of \xfile{array.sty}, then you can load \thispackage with
% the ``\textt{light}'' option.
% As a consequence: \cs{rowfont} and \cs{tabucline} will not be available, and vertical lines \texttt\textbar\
% will not have an optional argument for their widths and color. However, \textt{tabu X} columns will work normally.
%
%
% \section(Corrections){Corrections of some bugs (available only inside \textt{tabu})}
%
% \subsection(delarray compatibility){Correction for colortbl and arydshln: compatibility with delarray}
%
% Both \xpackage{colortbl} and \xpackage{arydshln} forget the control sequence \cs{@arrayright} in their implementation,
% quite strangely because both of them take care of \cs{@arrayleft}.
%
% Those control sequences are used by the \xpackage{delarray} package to put parenthesis or bracket around the array.
%
%
% \subsection(arydshln @ columns){Correction for arydshln: \texttbf @ columns}
%
% A bug in \cs{adl@xarraydashrule}: \textt{!-arg} columns (class 1) and \textt{@-arg} columns (class 5) should be treated
% the same as far as rules are concerned.
%
% With this correction, the \textbf{known problem number 1} in \xpackage{arydshln} documentation is solved.
%
%
%
% \vskip2cm
%
%
%
% \begin{SaveVerbatim}[commandchars=$(),gobble=1]{myVerb}
%  ($db(\definecolorseries)){serie}{rgb}{last}{Goldenrod}{DarkSeaGreen}
%  ($db(\resetcolorseries))[3]{serie}
%  \begin{($dr$underline(parse lines))}{($dg(\color{serie!!+}``#1''\par))}
%     This is a nice little package
%     and I really don't know
%     What to do with it !
%     May be tomorrow...
%  \end{($dr$underline(parse lines))}
% \end{SaveVerbatim}
%
%
%
% \StopEventually{
% }
%
% \IMPLEMENTATION
%
% \subsection{Identification, requirements and options}
%
% The package namespace is \textttbf{\macrocodecolor tabu@}.
%
%
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{tabu}[2010/11/15 v1.2 - flexible LaTeX tabulars (FC)]
\RequirePackage{array}[2008/09/09]
%    \end{macrocode}
%
%    Then minimal catcode acertaining for loading \thispackage in good conditions:
%
%    \begin{macrocode}
\AtEndOfPackage{\tabu@AtEnd\let\tabu@AtEnd\@undefined}
\let\tabu@AtEnd\@empty
\def\TMP@EnsureCode#1#2{%
  \edef\tabu@AtEnd{%
    \tabu@AtEnd
    \catcode#1 \the\catcode#1\relax
  }%
  \catcode#1 #2\relax
}% \TMP@EnsureCode
\TMP@EnsureCode{33}{12} % !
\TMP@EnsureCode{124}{12}% |
\TMP@EnsureCode{0}{12}%  ^^@
\TMP@EnsureCode{36}{3}% $ = math shift
%    \end{macrocode}
%
%    \begin{macro}{\tracingtabu (debugshow option)}
%
%    \cs{tracingtabu} is the same as option \textt{debugshow}.
%
%    \begin{macrocode}
\let\tabu@message\@gobble
\def\tracingtabu{\let\tabu@message\message}
\let\tabudefaulttarget\linewidth
\DeclareOption{debugshow}{\tracingtabu}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{linegoal (package option)}
%    \begin{macrocode}
\DeclareOption{linegoal}{%
   \AtEndOfPackage{\RequirePackage{linegoal}[2010/10/31]}%
   \def\tabudefaulttarget{\linegoal}% \linegoal is \linewidth if not pdfTeX
}% linegoal option
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{delarray (package option)}
%    \begin{macrocode}
\DeclareOption{delarray}{%
   \AtEndOfPackage{\RequirePackage{delarray}}%
}% delarray option
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{light (package option)}
%    \begin{macrocode}
\DeclareOption{light}{%
   \AtEndOfPackage{%
      \let\tabu@prepnext@tok \prepnext@tok
      \let\tabu@save@decl \save@decl
      \let\tabu@rowfont \tabu@norowfont
      \let\tabucline \tabu@nocline
      \let\tabu@firstcline \relax
      \let\tabu@lines \relax
   }
}% light option
\def\tabu@norowfont{\PackageError{tabu}
   {\string\rowfont\space is not available with option `light'}\@ehd}
\def\tabu@nocline{\PackageError{tabu}
   {\string\tabucline\space is not available with option `light'}\@ehd}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
%  At Begin Document, we check if a \textt X column has already been defined (\xpackage{tabularx})
%  and if not, we define a new column type \textt X.
%
%  Then a fix for \xpackage{arydshln} and \xpackage{colortbl} comptability with \xpackage{delarray} shortcuts
%  available inside \textt{tabu}: requirement for this fix is checked by \cs{tabu@fix@arrayright}.
%
%  Finally the switch \cs{iftabu@colortbl} is set.
%
%    \begin{macrocode}
\AtBeginDocument{%
   \@ifundefined{NC@rewrite@X}{\newcolumntype{X}{}}{}% new column X if not exists
   \expandafter\in@\expandafter\@arrayright\expandafter{\endarray}%
   \ifin@ \let\tabu@endarray\endarray
   \else \tabu@fix@arrayright \fi % <fix for colortbl & arydshln (delarray)>
   \@ifpackageloaded{colortbl} \tabu@colortbltrue \tabu@colortblfalse
}
%    \end{macrocode}
%
% \subsection{Some constants}
%
%    \begin{macro}{\tabu@cnt}
%
%    Used in in \cs{tabu@arith} (the number of trials) and \cs{tabu@prepnext@tok} (for \cs{rowfont}).
%
%    \begin{macro}{\tabu@nbcols}
%
%    A counter that save the number of columns of the \textt{tabu}.
%
%    \begin{macro}{\tabu@X@cols}
%
%    Used only when \textt{tabu X} columns are used with ``\textt{tabu spread}''.
%
%    \begin{macrocode}
\newcount\tabu@cnt
\newcount\tabu@nbcols
\newcount\tabu@X@cols
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@target}
%
%    Stores the \textt{tabu} target (either ``\textt{to}'' or ``\textt{spread}'').
%
%    \begin{macro}{\tabu@spreadtarget}
%    \begin{macro}{\tabu@naturalX}
%
%     Used only when \textt{tabu X} columns are used with ``\textt{tabu spread}''.
%
%    \begin{macrocode}
\newdimen\tabu@target
\newdimen\tabu@spreadtarget
\newdimen\tabu@naturalX
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%    \begin{macro}{\tabucolX}
%
%    The dimen corresponding to the preamble token \textt{X[1]}: the standard width of \textt X columns.
%
%    \begin{macro}{\tabu@X@sum}
%
%    Stores the sum of all width coefficients for \textt X columns.
%
%    \begin{macrocode}
\newdimen\tabucolX
\newdimen\tabu@X@sum
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\iftabu@measuring}
%
%    This switch is set to \textt{true} by \cs{tabu@arith} if the trial did not reached the target.
%
%    It is also temporarily set to true when the first \textt X column is encountered in the \textt{tabu} preamble,
%    at the time \cs{@mkpream} scans it to built the \cs{halign} preamble. The first \textt X column found
%    actually triggers some special setup to be expanded before \cs{halign} (see the flow chart...)
%
%    \begin{macro}{\iftabu@spread}
%
%    A switch whether ``\textt{tabu spread}'' is used or not.
%
%    \begin{macro}{\iftabu@nested}
%
%    A swith set at the entry in \textt{tabu} environment: true if \textt{tabu} is nested inside another \textt{tabu}.
%
%    \begin{macro}{\iftabu@firstcline}
%
%    A switch to adapt \cs{tabucline} automatically if it comes first in the \textt{tabu} (similar to \cs{firsthline}).
%
%    \begin{macrocode}
\newif\iftabu@measuring
\newif\iftabu@spread
\newif\iftabu@nested
\newif\iftabu@firstcline
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\tabu@box}
%
%    Stores the whole \textt{tabu} when an attempt to adjust \textt X columns is performed.
%
%    It is also used by \cs{tabucline} to save the \cs{@arstrutbox} when inserting a horizontal line.
%
%    \begin{macrocode}
\newsavebox\tabu@box
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@gobblespace}
%
%    A macro which is needed when scanning tokens with \cs{futurelet}.
%
%    \begin{macrocode}
\def\tabu@gobblespace#1 {#1}
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@NC@rewrite@X}
%
%     This is the rewrite macro for \textt{tabu X} columns.
%     Such a column has an optional argument: the width coefficient for the \textt{tabu X} column
%     whose default value is 1, and may be some alignments parameters.
%     The coefficient is used in the expression: \textt{p\M*{\cs{dimexpr}\meta{coef}\cs{tabucolX}}}
%
%    \begin{macrocode}
\newcommand\tabu@NC@rewrite@X[1][]{\tabu@rewrite@X{#1}%
                                 \let\@halignto \relax
                  \expandafter \NC@find \tabucolX@spec}
%    \end{macrocode}
%    \end{macro}
%
%  The next part of the definition (\cs{tabu@rewrite@X}) can be found page \pageref{tabu X column definition}.
%
%    \begin{macro}{\usetabu (new column type)}
%
%    \cs{usetabu} is defined as a new column type. \cs{NC@rewrite@\string\usetabu} is expanded
%    where \cs{@mkpream} does its job.
%
%    \begin{macrocode}
\expandafter\def\csname NC@rewrite@\string\usetabu\endcsname#1{%
   \ifx\\#1\\\tabu@saveerr{}\else
      \@ifundefined{tabu@saved@\string#1}
         {\tabu@saveerr{#1}}
         {\let\tabu@rewrite@X \tabu@rewrite@Xrestore
         \def\tabu@temp{\xdef\tabu@usetabu{%
            \col@sep \the\col@sep\relax
            \arrayrulewidth \the\arrayrulewidth\relax
            \@tempdima \ht\@arstrutbox \advance\@tempdima -\extrarowheight
            \extrarowheight \the\extrarowheight\relax
            \advance\@tempdima \extrarowheight
            \ht\@arstrutbox \@tempdima
            \extratabsurround \the\extratabsurround\relax
            \doublerulesep \the\doublerulesep\relax}}%
         \aftergroup \tabu@usetabu
         \csname tabu@saved@\string#1\expandafter\endcsname}%
   \fi
}% \NC@rewrite@\usetabu
\expandafter\def\csname NC@find@\string\usetabu\endcsname#1\usetabu{\NC@{#1}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@rewritefirst (new column type)}
%
%    This new column type is not really a column type! It is always added to a \textt{tabu} preamble
%    in order to do some setup before any other column is rewritten by \cs{@mkpream}.
%
%    Thus, \cs{NC@do}\cs{tabu@rewritefirst} is added \textbf{at the beginning of} \cs{NC@list}
%    at the entry of a (not nested) \textt{tabu} environment.
%
%    This ``column type'' sets up the new column type \cs{tabu@rewritelast} which is added to
%    \textbf{at the end of} \cs{NC@list}, and defines the token \texttt X to be rewritten by
%    \cs{tabu@NC@rewrite@X} (in case \xpackage{tabularx} is used with \thispackage, this modification
%    of the \textt X column occurs only inside the group where \cs{@mkpream} does its job).
%
%    \begin{macrocode}
\expandafter\def\csname NC@rewrite@\string\tabu@rewritefirst\endcsname{%
   \ifx\tabu@lines\relax
   \NC@list\expandafter{\expandafter\NC@do \expandafter\usetabu
                        \NC@do X\NC@do\tabu@rewritelast}%
   \else
   \NC@list\expandafter{\expandafter\NC@do \expandafter\usetabu
                        \expandafter\NC@do \expandafter|\tabu@NC@list
                        \NC@do X\NC@do\tabu@rewritelast}%
      \tabu@lines % defines NC@rewrite@| for tabu only (inside @mkpream group)
   \fi
   \let\save@decl \tabu@save@decl % inversion of tokens in text mode
   \let\NC@rewrite@X \tabu@NC@rewrite@X
   \aftergroup \tabu@global@temp
   \aftergroup \tabu@firstcline
   \NC@find \tabu@rewritelast
}% NC@rewrite@\tabu@rewritefirst
\expandafter\def\csname NC@find@\string\tabu@rewritefirst\endcsname
                                          #1\tabu@rewritefirst{\NC@{#1}}
\def\tabu@rewritefirst{%
   \edef\tabu@NC@list{\the\NC@list}%
   \NC@list{\NC@do \tabu@rewritefirst \NC@do *}%
}% \tabu@rewritefirst
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@rewritelast (new column type)}
%
%    This new column type is rewritten after \textt X columns, because it is declared by
%    when the column \cs{tabu@rewritefirst} is actually rewritten. In the case where \cs{tabu@target}
%    is $>0$ (either because of ``\textt{tabu to}'' or ``\textt{tabu spread}'' has been called)
%    and if there is no \textt X column, then \textt{@\M*{\cs{extracolsep}\cs{@flushglue}}} is added
%    at the beginning of the preamble.
%
%    To avoid duplicate margin in the \textt{tabu} we have to test the next token in the preamble.
%    If the next token is \textt\textbar\ or \textt !\ then no margin must be added and
%    \textt{@\M*{\cs{extracolsep}\cs{@flushglue}}} can be inserted at the beginning of the preamble.
%
%    Otherwise, we must insert \textt{!\M*{\cs{extracolsep}\cs{@flushglue}}} in order to keep the margin.
%
%    \begin{macrocode}
\expandafter\def\csname NC@rewrite@\string\tabu@rewritelast\endcsname{%
   \global\NC@list\expandafter{\tabu@NC@list}%
   \futurelet \tabu@temp \tabu@rewritelast
}% \NC@rewrite@\tabu@rewritelast
\expandafter\def\csname NC@find@\string\tabu@rewritelast\endcsname
                                          #1\tabu@rewritelast{\NC@{#1}}
\def\tabu@rewritelast{%
   \ifx \@halignto\relax   % found a X column
      \let\tabu@temp \@empty
      \aftergroup \tabu@addphantomline
   \else
      \ifdim \tabu@target=\z@ \let\tabu@temp \@empty
      \else
         \if |\noexpand\tabu@temp \def\tabu@temp{@{\extracolsep\@flushglue}}\else
         \if !\noexpand\tabu@temp \def\tabu@temp{@{\extracolsep\@flushglue}}\else
                                  \def\tabu@temp{!{\extracolsep\@flushglue}}\fi\fi
      \fi
   \fi
   \let\@halignto \tabu@halignto
   \expandafter\NC@find \tabu@temp
}% \tabu@rewritelast
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@everycr@tok}
%    \begin{macro}{\iftabu@colortbl}
%
%    This token is used to store and restore the content of \cs{everycr} when \cs{rowfont} is used.
%
%    The switch \cs{iftabu@colortbl} is used by \cs{rowfont} when modifying the alignment, because
%    \xpackage{colortbl} changes the glue put inside the \cs{halign} preamble to make standard alignments.
%    This switch is set At Begin Document.
%
%    \begin{macrocode}
\newtoks\tabu@everycr@tok
\newif\iftabu@colortbl
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@nowrite}
%
%    A trick to fobidd \cs{write} when a trial is done on the \cs{halign}.
%    (Copied from D. Carlisle's \xpackage{tabularx} code.)
%
%    \begin{macrocode}
\def\tabu@nowrite{% cancels a \write command (tabularx method)
   \begingroup
     \def\let{\afterassignment\endgroup\toks@}%
        \afterassignment\let\count@
}% \tabu@nowrite
\let\tabu@write\write
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@phantomline}
%
%    This macro inserts a phantom line in front of a \textt{tabu}.
%    This is necessary when you use \cs{usetabu} with \textt{tabu X} column,
%    with a single line containing \cs{multicolumn}...
%
%    \begin{macrocode}
\def\tabu@phantomline{\noalign{%
   \global\everycr{}%
   \global\setbox\tabu@box\box\@arstrutbox
   \global\let\tabu@minrowclearance \minrowclearance
   \global\let\minrowclearance \z@
   \global\let\tabu@temp \vcenter
   \global\let\vcenter \vbox
   \toks@{}\count@\@ne
   \@whilenum\count@<\tabu@nbcols\do{\advance\count@\@ne
                        \toks@\expandafter{\the\toks@&}}%
   \toks@\expandafter{\the\toks@
      \cr\noalign{\global\setbox\@arstrutbox\box\tabu@box
         \global\let\minrowclearance \tabu@minrowclearance
         \global\let\vcenter \tabu@temp}}%
   \expandafter}\the\toks@
}% \tabu@phantomline
%    \end{macrocode}
%    \end{macro}
%
% \subsection{\cs{tabu} and \cs{endtabu}}
%
%    \begin{macro}{\tabu}
%
%    \cs{tabu} is the command of the environment.
%
%    \begin{macro}{\endtabu}
%
%    \cs{endtabu} is \cs{endtabular} or \cs{endarray} in math mode.
%
%    \begin{macrocode}
\def\tabu{%
   \ifmmode \def\endtabu{\endarray}%
   \else    \def\endtabu{\endtabular}\fi
   \tabu@setup \tabu@settarget
}% \tabu
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\tabu@setup}
%
%    This macro sets the \textt{tabu X} column definition at the beginning of the \textt{tabu} environment.
%
%    Incidentally, \cs{tabu@X} (number of \textt{tabu X} columns) and \cs{tabu@X@sum} (sum of the width-coefs) are reset to $0$.
%
%    The current value of \cs{hfuzz} is stored in \cs{tabu@hfuzz}, with a minimum of $0.1 pt$.
%
%    \begin{macrocode}
\def\tabu@setup{%
   \let\adl@xarraydashrule \tabu@adl@xarraydashrule % <fix> arydshln
   \let\adl@act@endpbox \tabu@adl@act@endpbox       % <fix> arydshln
   \let\adl@act@@endpbox \tabu@adl@act@endpbox      % <fix> arydshln
   \let\@preamerror \@preamerr                      % <fix> arydshln
   \let\endarray \tabu@endarray          % <fix> colortbl & arydshln (delarray)
   \let\tabu@global@temp \@empty \let\tabu@global@X \@empty
   \ifx\verbatim \tabu@sanitizetext
         \tabu@nestedtrue
         \def\tabu@aligndefault{t}\def\tabudefaulttarget{\linewidth}%
   \else \tabu@nestedfalse
         \def\tabu@aligndefault{c}%
         \ifdim\parindent>\z@ \ifx\linewidth\tabudefaulttarget
         \everypar\expandafter{%                    % correction for indentation
            \the\everypar\everypar\expandafter{\the\everypar}%
            \setbox\z@=\lastbox
            \ifdim\wd\z@>\z@ \advance\linewidth -\wd\z@\fi
            \box\z@
            }%
         \fi\fi
   \fi
   \let\@footnotetext \tabu@footnotetext
   \let\@xfootnotenext\tabu@xfootnotetext
   \iftabu@nested\else
      \global\tabu@footnotes{}%
      \aftergroup\the\aftergroup\tabu@footnotes
   \fi
   \let\centering \tabu@centering
   \let\raggedright \tabu@raggedright
   \let\raggedleft \tabu@raggedleft
   \let\@trivlist \tabu@trivlist           %<restore \\=\@centercr inside lists>
   \let\tabudecimal \tabu@tabudecimal
   \let\verbatim \tabu@sanitizetext
   \let\fbox \tabu@fbox
   \let\prepnext@tok \tabu@prepnext@tok            % <for rowfont and tabucline>
   \let\rowfont \tabu@rowfont
   \tabu@spreadfalse \tabu@measuringfalse
   \edef\tabu@hfuzz{\ifdim\hfuzz<.1\p@ .1\p@\else\the\hfuzz\fi}%
   \tabu@rewritefirst
}% \tabu@setup
\def\tabu@save@decl{% no inversion on tokens when not in math mode
   \ifcat$\d@llarend
      \toks\count@\expandafter\expandafter\expandafter{%
               \expandafter\@nextchar \the\toks\count@}%
   \else
      \toks\count@\expandafter\expandafter\expandafter{%
         \expandafter\the\expandafter\toks\expandafter\count@\@nextchar}%
   \fi
}% \tabu@save@decl
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@settarget}
%    \begin{macro}{\tabu@begin}
%
%    The macro sets \cs{tabu@target} (a dimen) to the value specified for ``\textt{tabu to}'' or ``\textt{tabu spread}''.
%
%    \begin{macrocode}
\def\tabu@settarget{\futurelet\@let@token \tabu@sett@rget}
\def\tabu@sett@rget{\tabu@target\z@
   \ifcase \ifx \bgroup\@let@token 0\else
           \ifx [\@let@token 0\else
           \ifx \@sptoken\@let@token 1\else
           \if t\@let@token 2\else
           \if s\@let@token 3\else
           \m@ne\fi\fi\fi\fi\fi\relax
       \expandafter\tabu@begin
   \or \expandafter\tabu@gobblespace\expandafter\tabu@settarget
   \or \expandafter\tabu@to
   \or \expandafter\tabu@spread
   \else\expandafter\tabu@begin
   \fi
}% \tabu@sett@rget
\def\tabu@to to{\def\@halignto{to}\tabu@gettarget}
\def\tabu@spread spread{\tabu@spreadtrue\def\@halignto{spread}\tabu@gettarget}
\def\tabu@gettarget{\afterassignment\tabu@begin\tabu@target}
\def\tabu@begin#1#{%
   \edef\@halignto{\ifdim\tabu@target>\z@ \@halignto\the\tabu@target\fi}%
   \let\tabu@halignto \@halignto
   \expandafter\@testopt\expandafter\tabu@@begin \tabu@aligndefault #1\@nil
}% \tabu@begin
\def\tabu@@begin[#1]#2\@nil#3{%
   \edef\tabu@align{#1}%
   \edef\tabu@saved{%
      \ifmmode \col@sep \the\arraycolsep
      \else    \col@sep \the\tabcolsep     \fi\relax
      \arrayrulewidth \the\arrayrulewidth\relax
      \extrarowheight \the\extrarowheight\relax
      \extratabsurround \the\extratabsurround\relax
      \doublerulesep \the\doublerulesep\relax}%
   \expandafter\def\expandafter\tabu@saved\expandafter{\tabu@saved
            \tabu@temp \edef\tabu@halignto{to\the\tabu@target}\NC@find #3}%
   \ifmmode \expandafter\array
   \else    \expandafter\tabular
   \fi      [{#1}]#2{\tabu@rewritefirst #3}%
}% \tabu@@begin
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\tabu@footnotes}
%
%    \begin{macrocode}
\newtoks\tabu@footnotes
\long\def\tabu@footnotetext#1{%
   \edef\@tempa{\the\tabu@footnotes
      \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}%
   \global\tabu@footnotes\expandafter{\@tempa{#1}}}%
\long\def\tabu@xfootnotetext[#1]#2{%
  \global\tabu@footnotes\expandafter{\the\tabu@footnotes
                           \footnotetext[{#1}]{#2}}}
%    \end{macrocode}
%    \end{macro}
%
%
%
% \subsection{Flow chart of expansion} ^^A\enlargethispage{\baselineskip}
%
% \subsubsection(case: tabu, tabu to and tabu spread){General case: tabu, tabu to and tabu spread}
%
% {
% \hskip-\evensidemargin
% \begin{tikzpicture}[yscale=.4,xscale=.6,framed,
%    start chain, every join/.style={->,thin,black,solid},node distance=.5cm and .5cm,
%    every node/.style={black}]
% \node [on chain,draw] (begintabu) at (0,0) {\cs{begin}\M*{tabu}} node [anchor=west] at (begintabu.east) {(\cs{begingroup})}
%  node [on chain=going below,join] (tabu) {\cs{tabu}}
%  node [on chain=going right,join] (tabudesc) {$\begin{tabu}\{{>{$}l<{$}}.
%                                                 defines \cs{@halignto} and sets \cs{tabu@target} \\
%                                                 load \cs{NC@rewrite@X} for \textt{tabu} \textt X columns \\
%                                                 load special setup (\xpackage{arydshln} fixes, \cs{rowfont}, \cs{centering} etc)
%                                                \end{tabu}$}
%  node [on chain=going below,join] (tabu@begin) {\cs{tabu@begin}}
%  node [on chain] (tabu@begindesc) {$\begin{tabu}\{{>{$}l<{$}}.
%                                    if \cs{tabu@target} $> 0$ then prepare \\
%                                   \textt{@\M*{\cs{extracolsep}\M*{\cs{@flushglue}}}}
%                                   \end{tabu}$};
%  \chainin (tabu@begin)
%  node [on chain=going below] (H) {}
%  node [on chain=going below,join=with tabu@begin] (toarray) {\cs{tabular} or \cs{array} if in math mode};
%  \draw [densely dotted,gray,very thick] (begintabu.west |- H) -- (tabu@begindesc.east |- H) coordinate (H);
%  \path [fill=AliceBlue] (begintabu.north -| H) rectangle ($(H)+(1,0)$) coordinate (bluebox)
%                                           node [midway,rotate=-90] {\large\thispackage};
%
%  { [start chain=array]
%  \node [on chain] at (begintabu |- toarray) [yshift=-2.5cm] (@array) {\cs{@array}};
%  \draw [->] (toarray.west) -| (@array);
%  \node [on chain=going right,join,fill=GhostWhite,draw=gray,dashed] (@arraydesc)
%                 {\begin{tabu}\{{l}.
%                    creates the \cs{@arstrutbox} \\
%                    \cs{begingroup} \\
%                    \quad \cs{@mkpream}: parse the preamble to create \cs{@preamble}  \\
%                    \quad \cs{xdef} \cs{@preamble} macro \\
%                    \cs{endgroup}\\
%                    \cs{@arrayleft}\\
%                    \cs{vtop} or \cs{vbox} or \cs{vcenter} \cs{bgroup} ... \cs{halign}\{ preamble...
%                 \end{tabu}}
%  node [on chain=going below] (H) {};
%  }
%  { [start chain=endtabu]
%  \node [on chain] (end{tabu}) at (begintabu |- H) {\cs{end}\M*{tabu}}
%   node [on chain=going below,join] (endtabu) {\cs{endtabu}}
%   node [on chain=going right,join] (endtabular) {\cs{endtabular}}
%   node [on chain=going right,join] (endarray) {\cs{endarray}}
%   node [on chain=going right,join] (endarraydesc) {\begin{tabu}\{{l}. end of \cs{halign} \\ end of \cs{vtop}, \cs{vbox} or \cs{vcenter}\end{tabu}};
%   \chainin (endtabular)
%   node [on chain=going below,node distance=.7cm] (H) {};
%   \node at (H -| endarraydesc.west) [anchor=west] (endtabulardesc) {\begin{tabu}\{{l}. end of math group \\ end of \cs{hbox}\end{tabu}};
%   \draw [->] (endtabular) |- (endtabulardesc) node [near end,above] {\small if in text mode};
%   \draw [->] (endtabu.north east) to [bend left,looseness=.5] node [midway,above] {\small if in math mode} (endarray.north);
%   \node at (endtabulardesc.south -| begintabu) [yshift=-.5cm] (endgroup) {\cs{endgroup}} node at (endgroup.east) [anchor=west] {end of envir};
%   \draw [->] (endtabu) -- (endgroup);
%  }
%  \path [fill=LightGoldenrodYellow] (bluebox) rectangle ($(endtabulardesc.south -| bluebox)-(1,0)$)
%                 node [midway,rotate=-90] {\large\xpackage{array}};
% \end{tikzpicture}
% }
%
% \subsubsection(tabu to with X column){\textt{tabu to} with \textt X column}
%
% The important part of the job is made inside the dashed box above: \cs{@mkpream}
% expands the columns definitions, which can be user defined. Hopefully, it does its
% job inside a group, therefore a user-column can set a macro to be expanded
% \cs{aftergroup}. This implementation allows much modifications in the tabular preparation,
% without any change in the macros of \xfile{array.sty}.
%
% When a \textt{tabu X} column is found in the preamble  by \cs{@mkpream}, \textt{tabu} changes his strategy: the macro
% \cs{tabu@prep@TRIAL} is set to be expanded \cs{aftergroup} that is, just after the preamble (\cs{@preamble}) has been built.
% This macro does some setup for \textt{tabu} trials to reach the target with variable \textt X column widths and gobbles
% everything until the next \cs{bgroup} which corresponds to the \cs{vtop}, \cs{vbox} or \cs{vcenter} for the whole tabular.
% This part of \cs{@array} is stored into \cs{tabu@Xfinish} to be expanded after the last trial gave satisfaction
% to reach the \textt{tabu} target. Then \cs{tabu@collect} is expanded to find the end of the \textt{tabu} environment,
% temporarily storing the environment content into a token register.
%
% The last part of \cs{@array} until \cs{halign} is expanded inside a \cs{vbox}
% which is stored into the box register \cs{tabu@box} for measuring purpose. \cs{halign} ends by \cs{endarray}
% which stops the \cs{tabu@box} as well, and then \cs{tabu@arith} is expanded to compute the gap between the
% width of \cs{tabu@box} and the target, and \cs{tabucolX} (the dimension that correspond to \textt{X[1]})
% is updated accordingly.
%
% The trials are ``protected'' by\, \M*{\cs{ifnum}0=`}\cs{fi}\, : they occur in a group that will be closed
% at the very begining of \cs{tabu@Xfinish}, when the final tabular will be printed actually.
% This protection is absolutely necessary to be able to collect
% the environment body in the case of nested \textt{tabu} with \textt X columns. This is related to \TeX{}
% mechanism of expansion inside \cs{halign} (\TeX{} stops reading when it encounters a \& \textt{alignment tab character}
% and goes backward expanding anything that were not expanded before).
%
%
% {\hskip-1cm
% \begin{tikzpicture}[yscale=.4,xscale=.6,framed,
%       start chain=going below,node distance=.3cm and .5cm,
%       every join/.style={->,thin,black,solid},every node/.style={black}]
%
% \node [on chain] (begingroup) at (0,0) {\cs{begingroup}}
%    node [on chain=going right] (@mkpream) {\cs{@mkpream}}
%    node [on chain,join] {Finds a \textt X column}
%    node [on chain,join] {rewrite \textt X column}
%       {[start branch] node [on chain] {\begin{tabu}\{{l}. Parse the optional parameter for \textt X\\ Set \cs{aftergroup}\cs{tabu@prep@TRIAL}\end{tabu}}
%       }
%    node [on chain,join] {... \cs{@mkpream} ...}
%       {[start branch] node [on chain,join] {builds the \cs{halign} preamble}}
%    node [on chain,join] {\cs{xdef}\cs{@preamble}}
%    node [on chain,join] (endgroup) {\cs{endgroup}}
%    node [on chain] (H) {};
% \node (tabu@prep@TRIAL) at (begingroup |- H) {\cs{tabu@prep@TRIAL}};
% \draw [->] (endgroup.west) -| (tabu@prep@TRIAL.north) node [midway,left] {\ssmall\begin{tabu}{c} triggered by\\ \cs{aftergroup}\end{tabu}};
% \chainin (tabu@prep@TRIAL);
%    {  [start branch] \node [on chain,join] {\cs{tabu@setup@TRIAL}}
%                       node [on chain,join] {\begin{tabu}\{{l}.
%                                                 Neutralisation of \cs{write}  \\
%                                                 Protection for: \begin{tabu}{!{\textbullet}l}
%                                                                 footnotes \\ counters \\ index
%                                                                 \end{tabu}
%                                              \end{tabu}};
%    }
% \node [on chain] (H) {}
%    node [on chain,join=with tabu@prep@TRIAL] (tabu@arrayleft@measure) {\cs{tabu@arrayleft@measure}}
%    node [on chain=going right,join] {\begin{tabu}\{{l}. prepares \cs{tabu@Xfinish} \\ Collect the \textt{tabu} body\end{tabu}}
%    node [on chain,join] (tabu@TRIAL) {\cs{tabu@TRIAL}}
%       {[start branch] node [on chain,join] {\begin{tabu}{l} Expands \cs{halign} into a \cs{vbox} \end{tabu}}
%       }
%    node [on chain,join] {\cs{tabu@endTRIAL}}
%       {[start branch] node [on chain,join] {\cs{endarray}}
%       }
%    node [on chain,join] (tabu@arith) {\begin{tabu}{c} \cs{tabu@arith}\\ \cs{wd}\M*{tabu}$-$\cs{tabu@target} $<$ \cs{hfuzz} ?\end{tabu}}
%    node [on chain=going right,node distance=1cm] (tabu@Xfinish) {\cs{tabu@Xfinish}};
%    \draw (tabu@arith) [->] -- (tabu@Xfinish) node [midway,above,blue] {Yes};
%    \draw [->] (tabu@arith.west) |- (tabu@TRIAL) node (No) [very near start,left] {{\small\begin{tabu}.{r}\} Updates \\ \cs{tabucolX}\end{tabu}} \textcolor{red}{No}};
%
% \end{tikzpicture}}
%
%
%
%
%
% \subsubsection(tabu spread with X column){\textt{tabu spread} with \textt X column}
%
% In the case of ``\textt{tabu spread}'' with \textt X columns, the process is the same
% as the one described for ``\textt{tabu to}'' with \textt X columns. However, the first
% trial is different because we have first to measure the \emph{natural width} of the
% tabular.
% The process is the following:
% \begin{itemize}[label=\small\textbullet]
% \item \cs{tabu@target} is first set to \cs{linewidth} (or \cs{linegoal} with the \textt{linegoal} package option).
% \item The \textt X column corresponds to a \cs{vbox} with \cs{hsize} fixed to \cs{tabu@target}.
% \item Inside this \cs{vbox} the cell content is written into a \cs{hbox} whose width is limited to \cs{tabu@target}.
%       This \cs{hbox} is captured into the box register \cs{tabu@box}.
% \item At the end of the cell, the \cs{badness} of the \cs{hbox} is checked:
%        \begin{itemize}[label=\textendash,leftmargin=*]
%        \item if the \cs{badness} is $> 1000$ then the text is too long and ``\textt{tabu spread}''
%        is useless: \textt{tabu to \cs{tabu@target}} give the same result.
%        \item Otherwise, we get the natural width of the cell content by: \\
%              \cs{setbox} \cs{tabu@box} \cs{hbox} \M*{\cs{unhbox} \cs{tabu@box}}
%        \end{itemize}
% \item At the end of the first trial, \cs{tabu@spreadarith} checks if:
%         $$ \text{width(tabular)} + \text{spread} < \cs{linewidth} \text{ (or \cs{linegoal})}$$
%      \begin{itemize}[label=\textendash,leftmargin=*]
%      \item if not, then \textt{tabu to}\cs{tabu@target} give the same result
%      \item Otherwise, the target for \textt{tabu to} will be:
% $$\hskip-\leftmargin
% \text{width(tabular)} + \text{spread} - \sum_i \text{natural widths X}_i
% +\underbrace{\text{Max}_i\left(\dfrac{\text{natural width X}_i}{\text{coef}_i}\right)\times \sum_i\text{coef}_i}
%      _{\text{\begin{tabu}{c} minimal natural width that can be obtained \\ with the given coefs\end{tabu}}}
% $$
%      \end{itemize}
%  And the next trial will be done as if the user called ``\textt{tabu to}'' with this target.
% \end{itemize}
%
%
%
%
% \subsection{tabu X column definition}
% \label{tabu X column definition}
%
%    \begin{macro}{\tabu@rewrite@X}
%
%    This macro is expanded by \cs{@mkpream} in case a \textt X column is found.
%
%    \cs{tabu@X@sum} (a dimen) store the sum of the width coefficients. For the first \textt{X column} found in the
%    preamble, a special setup occurs:
%    \begin{itemize}[itemsep=0pt,topsep=0pt,leftmargin=*]
%    \item the default target (either \cs{linewidth} or \cs{linegoal} if available) is set
%          if it has not been specified by the user.
%    \item \cs{@halignto} is \cs{let} to \cs{relax} to avoid its expansion in \cs{xdef}\cs{@preamble} just after \cs{@mkpream}.
%           Indeed as long as we have to measure the natural width of the tabular, \cs{@halign} must be empty for trial steps.
%    \item The rest of the setup is made \cs{aftergroup} (\ie after \cs{xdef}\cs{@preamble} which occurs inside a group) by \cs{tabu@prep@TRIAL}.
%    \end{itemize}
%
%    \begin{macrocode}
\def\tabu@rewrite@X#1{\tabu@Xarg{#1}%
   \iftabu@spread \tabu@rewrite@Xspread
   \else          \tabu@rewrite@Xto
   \fi
}% \tabu@rewrite@X
%    \end{macrocode}
%
%    \begin{macro}{\tabu@rewrite@Xnested}
%
%    This macro replaces \cs{tabu@rewrite@X} when \textt{tabu} makes a trial for \textt X columns.
%
%    \begin{macro}{\tabu@rewrite@Xrestore}
%
%    This macro replaces \cs{tabu@rewrite@X} in the case of \cs{usetabu}.
%
%    \begin{macrocode}
\def\tabu@rewrite@Xnested#1{\def\tabucolX@spec{p{\tabucolX}}}
\def\tabu@rewrite@Xrestore#1{\tabu@Xarg{#1}\let\tabucolX@spec\tabu@temp}%
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@rewrite@Xto}
%
%    The setup for trial is not the same in case of ``\textt{tabu to}'' and ``\textt{tabu spread}''.
%
%    The important thing is:\, \cs{aftergroup}\cs{tabu@prep@TRIAL}.
%
%    \begin{macrocode}
\def\tabu@rewrite@Xto{%
   \iftabu@measuring % not the first X column found in preamble
      \xdef\tabu@global@X {\tabu@global@X
         \advance\tabu@X@sum \the\tabu@X@sum\relax}%
   \else % first X column found in preamble
      \tabu@measuringtrue
      \ifdim\tabu@target=\z@
         \setlength \tabu@target \tabudefaulttarget
      \fi
      \xdef\tabu@global@X{%
         \tabu@X@sum \the\tabu@X@sum\relax
         \tabu@target \the\tabu@target\relax}%
      \let\tabu@halignto \relax
      \aftergroup \tabu@prep@TRIAL
   \fi
}% \tabu@rewrite@Xto
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@rewrite@Xspread}
%
%    This macro is used instead of \cs{tabu@rewrite@Xto} for \textt X columns with ``\textt{tabu spread}''.
%
%    \begin{macrocode}
\def\tabu@rewrite@Xspread{% tabu spread with X columns: we need to store each coef
   \iftabu@measuring % not the first X column found in preamble
      \advance\tabu@X@cols \@ne
      \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \relax
      \xdef\tabu@global@X {\tabu@global@X
            \advance\tabu@X@cols\@ne
            \advance\tabu@X@sum \the\tabu@X@sum\relax
            \def\csname tabu@X\the\tabu@X@cols\endcsname{\strip@pt\tabu@X@sum}}%
   \else % first X column found in preamble
      \tabu@measuringtrue
      \tabu@X@cols \@ne  \tabu@spreadtarget=\tabu@target
      \setlength \tabu@target \tabudefaulttarget
      \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \relax
      \xdef\tabu@global@X {%
         \tabu@X@cols \@ne
         \tabu@X@sum \the\tabu@X@sum\relax
         \tabu@target \the\tabu@target\relax
         \tabu@spreadtarget \the\tabu@spreadtarget\relax
         \def\csname tabu@X\the\tabu@X@cols\endcsname{\strip@pt\tabu@X@sum}}%
      \let\tabu@halignto \relax
      \aftergroup \tabu@prep@TRIAL
   \fi
}% \tabu@rewrite@Xspread
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@Xarg}
%
%    A tedious (and fastidious) macro to parse the optional argument of \textt X columns. The aim is to built
%    \cs{tabucolX@spec} which expands to the column specification:
%
%    {\centering \textt{>\M*{alignment} p \emph{or} m \emph{or} b \M*{\cs{dimexpr} coef \cs{tabucolX}\cs{relax}}}\par}
%
%    After that \xfile{array.sty} make it easy:\, \cs{expandafter}\cs{NC@find}\cs{tabucolX@spec}
%
%    \begin{macrocode}
\def\tabu@Xarg#1{%
   \ifx\\#1\\%    <shortcut when no option>
      \tabu@X@sum \p@
      \def\tabucolX@spec{p{\tabucolX}}%
      \edef\tabu@temp{p{\the\tabucolX}}%  <required for \usetabu>
   \else
      \tabu@X@sum \z@
      \let\tabucolX@align \@empty
      \let\tabucolX@spec \@empty
      \let\tabu@Xmath \relax
      \tabu@Xparse {}#1\relax\@nnil
   \fi
}% \tabu@Xarg
\def\tabu@Xparse#1{\futurelet\@let@token\tabu@Xtest}
\expandafter\def\expandafter\tabu@Xparsespace\space{\tabu@Xparse{}}
\def\tabu@Xtest{%
   \ifcase \ifx \@nnil\@let@token \z@ \else
           \ifx \relax\@let@token \m@ne\else
           \if ,\@let@token \m@ne\else
           \if p\@let@token 1\else
           \if m\@let@token 2\else
           \if b\@let@token 3\else
           \if l\@let@token 4\else
           \if c\@let@token 5\else
           \if r\@let@token 6\else
           \if .\@let@token 7\else
           \ifx \@sptoken\@let@token 8\else
           \if L\@let@token 9\else
           \if C\@let@token 10\else
           \if R\@let@token 11\else
           \ifcat $\@let@token 12\else
           13\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax
       \tabucolX@do \expandafter\remove@to@nnil
   \or \tabu@Xcolspec{p}%
   \or \tabu@Xcolspec{m}%
   \or \tabu@Xcolspec{b}%
   \or \tabu@Xalign{>{\raggedright}}%
   \or \tabu@Xalign{>{\centering}}%
   \or \tabu@Xalign{>{\raggedleft}}%
   \or \expandafter\tabu@Xcoef
   \or \expandafter\tabu@Xparsespace
   \or \tabu@Xalign{>{\RaggedRight}}%
   \or \tabu@Xalign{>{\Centering}}%
   \or \tabu@Xalign{>{\RaggedLeft}}%
   \or \let\tabu@Xmath=$\expandafter\tabu@Xparse
   \or \tabu@Xcoef{}%
   \else \expandafter\tabu@Xparse
   \fi
}% \tabu@Xtest
\def\tabu@Xalign#1{%
   \ifx \tabucolX@align\@empty \else \PackageWarning{tabu}
      {Duplicate horizontal alignment specification}\fi
   \def\tabucolX@align{#1}\expandafter\tabu@Xparse
}% \tabu@Xalign
\def\tabu@Xcolspec#1{%
   \ifx\tabucolX@spec\@empty\else \PackageWarning{tabu}
      {Duplicate vertical alignment specification}\fi
   \def\tabucolX@spec{#1}\expandafter\tabu@Xparse
}% \tabu@Xcolspec
\def\tabu@Xcoef#1{\def\@tempa{#1}%
   \afterassignment\tabu@Xc@ef \tabu@cnt
}% \tabu@Xcoef
\def\tabu@Xc@ef{%
   \advance\tabu@X@sum \@tempa\the\tabu@cnt\p@
   \tabu@Xparse{}%
}% \tabu@Xc@ef
\def\tabucolX@do{%
   \ifx\tabucolX@spec\@empty \def\tabucolX@spec{p}\fi
   \ifdim \tabu@X@sum=\z@ \tabu@X@sum \p@\fi
   \begingroup
      \ifx \tabu@Xmath\relax
         \edef\tabucolX@spec##1{\tabucolX@spec{##1}}%
      \else
         \edef\tabucolX@spec##1{>{$}\tabucolX@spec{##1}<{$}}%
      \fi
      \edef\tabu@temp{\dimexpr\strip@pt\tabu@X@sum \tabucolX \relax}%
      \toks@\expandafter{\tabucolX@align}%
      \edef\x{%
         \def\noexpand\tabu@temp{\the\toks@ \tabucolX@spec{\the\tabu@temp}}%
         \def\noexpand\tabucolX@spec{\the\toks@ \tabucolX@spec{\tabu@temp}}%
      }\expandafter\endgroup\x
}% \tabucolX@do
%    \end{macrocode}
%    \end{macro}
%
% \subsection(Before trials){Before trials to reach the target}
%
% \subsubsection{Trial setup after \cs{@mkpream}}
%
%    \begin{macro}{\tabu@prep@TRIAL}
%
%    \cs{@mkpream} does its job inside a semi-simple group. At the end, \cs{@preamble} is expanded with \cs{xdef}, and
%    the group is left: this triggers the expansion of \cs{tabu@prep@TRIAL} set \cs{aftergroup} by the first \textt X column
%    encountered in the preamble.
%
%    We \cs{let} \cs{@halignto} to \cs{@empty}: it's a measurement, and put some protections. A group is opened with
%    the famous \M*{\cs{ifnum}0=`}\cs{fi} and control is given to \cs{tabu@arrayleft@measure}.
%
%    \begin{macrocode}
\def\tabu@prep@TRIAL{%
   \let\tabu@savedpreamble \@preamble
   \def\savetabu {\tabu@saveX}%
   {\ifnum0=`}\fi
      \tabu@setup@TRIAL
      \iftabu@spread % first trial only
         \advance\tabu@X@cols \@ne
         \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \@undefined
         \tabu@X@cols \z@ \tabu@naturalX \z@ \tabucolX \z@
         \let\tabu@naturalX@max \z@
         \let\tabu@naturalX@min \z@
         \let\tabu@startpboxORI \@startpbox
         \let\@startpbox \tabu@spread@startpbox
      \else
         \tabucolX = \tabu@target
      \fi
      \tabu@cnt \z@  % number of trials
      \def\tabu@lasttry{\m@ne\p@}%
      \tabu@arrayleft@measure
}% \tabu@prep@TRIAL
%    \end{macrocode}
%
%    \begin{macrocode}
\def\tabu@setup@TRIAL{\tabu@global@X
   \let\tabu@rewrite@X \tabu@rewrite@Xnested
   \def\tabudefaulttarget{\linewidth}%
   \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
   \xdef\tabu@global@X {\cl@@ckpt}\let\@elt \relax
   \hbadness\@M \hfuzz\maxdimen
   \let\hbadness \@tempcnta
   \let\hfuzz \@tempdima
   \let\write \tabu@nowrite
   \let\@footnotetext\@gobble
   \let\tabu@saveX \@gobble
   \tabu@TRIAL@hook
}% \tabu@setup@TRIAL
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabuDisableCommands}
%
%
%
%    \begin{macrocode}
\let\tabu@TRIAL@hook\@empty
\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook{#1}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@arrayleft@measure}
%
%    Measuring the whole tabular occurs just before \cs{@arrayleft}.
%    Hence the name of the macro: \cs{tabu@arrayleft@measure}.
%
%    \begin{macrocode}
\def\tabu@arrayleft@measure#1\bgroup{%
  \def\tabu@Xfinish{\ifnum0=`{\fi}\tabu@global@X
         \let\@halignto\tabu@halignto \tabu@firstcline  #1\bgroup}%
  \toks@{\let\@preamble\tabu@savedpreamble}% <required for multicolumn>
  \tabu@collect
}% \tabu@arrayleft@measure
%    \end{macrocode}
%    \end{macro}
%
% \subsubsection(Collecting the tabu body){Collecting the \textt{tabu} body: required for \texttbf X columns}
%
%    \begin{macro}{\tabu@collect}
%    \begin{macro}{\tabu@collectbody}
%
%    The mechanism is the same as \hologo{AmS}-\cs{collect@body} (also defined in \xfile{environ.sty}).
%    The content of the tabular is captured inside \cs{toks@}, expanded by \cs{tabu@TRIAL}.
%
%    \begin{macrocode}
\def\tabu@collect{\catcode`\^^@=13\def\tabu@stack{b}\tabu@collectbody}
\long\def\tabu@collectbody#1\end#2{%
   \edef\tabu@stack{\tabu@pushbegins #1\begin\end\expandafter\@gobble\tabu@stack}%
   \ifx\tabu@stack\@empty
      \toks@\expandafter{\the\toks@#1}\def\tabu@endenvir{\end{#2}}%
      \expandafter\tabu@TRIAL
   \else
      \toks@\expandafter{\the\toks@#1\end{#2}}%
      \expandafter\tabu@collectbody
   \fi
}% \tabu@collectbody
\long\def\tabu@pushbegins#1\begin#2{\ifx\end#2\else b\expandafter\tabu@pushbegins\fi}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%
% \subsection{Measuring the \textt{tabu}}
%
% \subsubsection{One trial after another}
%
%
%    \begin{macro}{\tabu@TRIAL}
%    \begin{macro}{\tabu@endTRIAL}
%
%    \cs{halign} is temporarily expanded inside a \cs{vbox} which is captured in \cs{tabu@box}.
%
%    At the end of the trial, we call \cs{tabu@arith} to compute the widths. \cs{tabu@arith} exits
%    leaving \cs{iftabu@measuring} equal to \cs{iftrue}: a further trial is necessary, or equal to
%    \cs{iffalse}: the target is reached, \cs{tabu@Xfinish} can print the \textt{tabu} in a last
%    expansion of \cs{halign}.
%
%    \begin{macrocode}
\def\tabu@TRIAL{\setbox\tabu@box \hbox\bgroup $\@arrayleft\vbox\bgroup \the\toks@
                                 \tabu@endTRIAL}% constant
\def\tabu@endTRIAL{\endarray$\egroup
   \iftabu@spread \tabu@spreadfalse
      \let\@startpbox \tabu@startpboxORI
      \tabu@spreadarith % <only once>
   \else \tabu@arith
   \fi
   \iftabu@measuring \tabu@measuringfalse
         \expandafter \tabu@TRIAL % <continue trials>
   \else
         \toks@\expandafter\expandafter\expandafter{%
               \the\expandafter\toks@ \tabu@endenvir}%
         \expandafter \tabu@Xfinish \the\toks@ % <we are then!>
   \fi
}% \tabu@endTRIAL
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
% \subsubsection{The arithmetic of \textt X columns}
%
%    \begin{macro}{\tabu@arith}
%    \begin{macro}{\tabu@spreadarith}
%
%    Algorithms.
%
%    \begin{macrocode}
\def\tabu@arith{%
   \advance\tabu@cnt \@ne
   \ifdim \tabu@lasttry=\wd\tabu@box
      \tabu@message{\tabu@header Reached minimum width. Backing up}%
   \else
      \edef\tabu@lasttry{\the\wd\tabu@box}%
      \tabu@message{\tabu@message@arith}%
      \ifdim \dimexpr \wd \tabu@box - \tabu@target <\tabu@hfuzz
         \tabu@message{\tabu@message@reached}%
         \xdef\tabu@global@X {\tabu@target\the\tabu@target\relax \tabu@global@X
                              \tabucolX \the\tabucolX\relax}%
      \else
         \advance\tabucolX -\dimexpr(\wd\tabu@box-\tabu@target-\tabu@X@sum/65536)
                              *65536/\tabu@X@sum\relax
         \ifdim \tabucolX<\z@
            {\let\write\tabu@write\PackageWarning{tabu}
               {X Columns too narrow (table too wide)\MessageBreak}}%
               \tabucolX=1em%
         \else \tabu@measuringtrue
         \fi
      \fi
   \fi
}% \tabu@arith
\def\tabu@spreadarith{%
   \tabu@naturalX \tabu@naturalX@max\relax
   \tabucolX \tabu@naturalX@min\relax
   \tabu@message{\tabu@message@spread}%
   \ifdim \dimexpr \wd\tabu@box + \tabu@spreadtarget <\tabu@target
      \advance\tabu@spreadtarget \dimexpr\wd\tabu@box-\tabu@naturalX+\tabucolX\relax
      \ifdim \tabu@spreadtarget <\tabu@target
         \tabu@target = \tabu@spreadtarget
      \fi
      \tabu@message{\expandafter\tabu@msg@align \the\tabu@target {}{}{}{}{}\@@}%
      \tabu@message{\ifdim \tabu@spreadtarget>\tabu@target
                           (tabu) default target used.\fi}%
   \else
      \tabu@message{\expandafter\tabu@msg@align \the\tabu@target { }{}{}{}{}\@@}
      \tabu@message{(tabu)\ifdim\wd\tabu@box<\tabu@target spread too large\else
                                                 tabu spread is useless here\fi,
                    default target used.}%
   \fi
   \xdef\tabu@halignto {to\the\tabu@target}%
   \tabucolX \tabu@target
   \tabu@measuringtrue
}% \tabu@spreadarith
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
% \subsubsection(\xext{log} report){Reporting in the \xext{log} file (\textt{debugshow option})}
%
%    \begin{macro}{\tabu@message@arith}
%    \begin{macrocode}
\def\tabu@message@arith{\tabu@header
   \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@
   \expandafter\tabu@msg@align \the\wd\tabu@box { }{ }{ }{ }{}\@@
   \expandafter\tabu@msg@align \the\tabu@target { }{ }{ }{ }{}\@@
   \expandafter\tabu@msg@align \the\tabu@X@sum {}{}{}{}{}\@@
   \expandafter\tabu@msg@align \the\dimexpr(\tabu@target-\wd\tabu@box)
                                      *65536/\tabu@X@sum\relax {}{}{}{}{}\@@}
\def\tabu@message@spread{\tabu@spreadheader
   \expandafter\tabu@msg@align \the\tabu@spreadtarget {}{}{}{}{}\@@
   \expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@
   \expandafter\tabu@msg@align \the\tabucolX {}{}{}{}{}\@@
   \expandafter\tabu@msg@align \expandafter-\the\tabu@naturalX {}{}{}{}{}\@@}
\def\tabu@message@reached{\tabu@header
   \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@
   ******** Reached Target : hfuzz=\tabu@hfuzz\space ********^^J}
\def\do#1{%
   \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{%
   \ifnum##1<10 #1#1#1\else
   \ifnum##1<100 #1#1\else
   \ifnum##1<\@m #1\fi\fi\fi
   ##1.##2##3##4##5##6##7##8#1}%
   \def\tabu@header{%
      \ifnum\tabu@cnt=\@ne (tabu)
       Try#1#1#1#1tabu X#1#1#1#1#1#1tabu Width#1#1#1#1#1Target%
                  #1#1#1#1#1#1#1#1#1Coefs#1#1#1#1#1#1#1Update^^J\fi
       (tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt)#1#1}%
   \def\tabu@spreadheader{%
      (tabu) Try#1#1#1#1Spread#1#1#1tabu Width#1#1#1#1#1Min Nat.#1#1#1#1Nat.X%
                                              #1#1#1#1#1#1#1#1#1New Target^^J%
      (tabu)spread}%
}\do{ }
%    \end{macrocode}
%    \end{macro}
%
% \subsubsection(Natural width measure){Measuring the natural width for \textt{tabu spread}}
%
%    \begin{macro}{\tabu@spread@startpbox}
%    \begin{macro}{\tabu@spread@endhbox}
%
%    When ``\textt{tabu spread}'' is used with \textt X columns, the first trial must
%    measure the natural width of the columns. Therefore, the \cs{vbox}, \cs{vtop} or \cs{vcenter}
%    corresponding to the \textt X columns definitions are temporarily changed into \cs{hbox}. More
%    precisely, the natural width is measured with \cs{vbox}\M*{\cs{hbox}\M*{...}}.
%
%    For the furthur trials, the standard scheme for \textt X column is used.
%
%    \begin{macrocode}
\def\tabu@spread@startpbox#1{\bgroup
   \in@{\tabucolX}{#1}%
   \ifin@
      \let\vss\relax\let\vfil\vss\let\vfill\vss\let\vskip\@tempskipa
      \hbox to\tabu@target\bgroup\aftergroup\tabu@spread@endhbox\hfil
   \else
      \expandafter\@gobble\tabu@startpboxORI{#1}% \@gobble \bgroup
   \fi
}% \tabu@spread@startpbox
\def\tabu@spread@endhbox{%
   \ifnum\badness>\@M %<text does not fit>
      \global\tabu@naturalX \tabu@target
   \else
      \setbox\tabu@box\lastbox
      \setbox\tabu@box\hbox{\unhbox\tabu@box}%
      \global\advance\tabu@X@cols \@ne
      \ifcsname tabu@X\the\tabu@X@cols\endcsname
         \global\advance\tabu@naturalX \wd\tabu@box
      \else
         \global\tabu@X@cols \@ne
         \global\tabu@naturalX \wd\tabu@box
      \fi
      \ifdim \tabu@naturalX@max<\tabu@naturalX
         \xdef\tabu@naturalX@max{\the\tabu@naturalX}%
      \fi
      \ifdim \tabu@naturalX@min<\dimexpr \wd\tabu@box * \tabu@X@sum /
                  (65536*\csname tabu@X\the\tabu@X@cols\endcsname)\relax
         \xdef\tabu@naturalX@min{\the\dimexpr \wd\tabu@box * \tabu@X@sum /
                     (65536*\csname tabu@X\the\tabu@X@cols\endcsname)\relax}%
      \fi
   \fi
   \box\tabu@box
   \egroup % end of \vtop (measure)
}% \tabu@spread@endhbox
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
% \subsection(Lines inside tabu){Lines inside \textt{tabu}}
%
% \subsubsection{Vertical lines}
%
%
%    \begin{macro}{\tabuvline@rewrite}
%
%    \textt\textbar\ is defined as a new column type (only inside \textt{tabu}) in order to add an optional argument:
%    the width of the rule.
%
%    \begin{macrocode}
\newcommand*\tabuvline@rewrite[1][]{\tabuvline@arg{#1}%
                     \expandafter \NC@find \tabu@temp}
\def\tabu@vline#1{\vrule width#1}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabuvline@arg}
%
%    A tedious (and fastidious) macro to parse the optional argument of \textt\textbar\ vertical lines...

%    \begin{macrocode}
\def\tabuvline@arg#1{%
   \ifx\\#1\\%    <shortcut when no option>
      \def\tabu@temp{!{\tabu@vline\arrayrulewidth}}%
   \else \futurelet \tabu@temp \tabuvline@argi #1\p@\p@\@nnil \tabuvline@argiii
   \fi
}% \tabuvline@arg
\def\tabuvline@argi{%
   \let\tabu@color \@empty
   \ifcat A\noexpand\tabu@temp
         \@tempdima\arrayrulewidth
         \expandafter\tabu@getlinecolor
   \else \expandafter\tabuvline@argii
   \fi
}% \tabuvline@argi
\def\tabuvline@argii#1\@nnil{%
   \tabu@maybecolor \@tempdima #1 \@nnil
}% \tabuvline@argii
\def\tabuvline@argiii{%
   \edef\tabu@temp{!{\color@begingroup\tabu@color
                     \noexpand\tabu@vline{\the\@tempdima}\color@endgroup}}%
}% \tabuvline@argiii
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@lines}
%
%  This macro is used in \cs{tabu@setup} to ``mount'' the character \textt\textbar\ as a column type.
%
%    \begin{macrocode}
{
\expandafter\let\csname NC@find@|\endcsname\relax
\expandafter\let\csname NC@rewrite@|\endcsname\relax
\xdef\tabu@lines{%
   \let\csname NC@find@|\endcsname \noexpand\tabuvlines@find
   \let\csname NC@rewrite@|\endcsname \noexpand\tabuvline@rewrite
}% \tabu@vline
}
\def\tabuvlines@find#1|{\NC@{#1}}
%    \end{macrocode}
%    \end{macro}
%
%
% \subsubsection{Horizontal lines: \cs{tabucline}}
%
%    \begin{macro}{\tabu@firstcline}
%    \begin{macrocode}
\def\tabu@firstcline{%
   \tabu@firstclinetrue
   \let\tabu@everycr \everycr
   \def\tabu@restoreeverycr {\let\everycr\tabu@everycr}%
   \def\everycr{\afterassignment\tabu@restoreeverycr\@temptokena}% <for ialign>
   \tabu@everycr{\noalign{%
      \global\tabu@everycr{\noalign{%
            \global\tabu@everycr{}\global\tabu@firstclinefalse}}%
      \global\let\everycr\tabu@everycr}}%
}% \tabu@firstcline
\def\tabu@addphantomline{\tabu@everycr\expandafter{\the\tabu@everycr
                                                 \tabu@phantomline}}
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabucline}
%
%     \cs{tabucline}\M[style or spec.]\M*{start-end}
%
%     \cs{tabucline} appears only at the end of a line: this is the place where we can insert a \cs{noalign} group.
%     We built a new line to be inserted inside the \textt{tabu}: this new line which contains the rule or leaders,
%     is stored into \cs{toks@} (inside the \cs{noalign} group). When leaving the group \cs{toks@} is expanded.
%
%    \begin{macrocode}
\def\tabu@linedash{4pt}%   <default value>
\def\tabu@dashgap{4pt}%    <default value>
\def\tabucline{\noalign{\ifnum0=`}\fi\@ifstar
   {\@tempswatrue\tabu@cline}
   {\@tempswafalse\tabu@cline}}%
\newcommand*\tabu@cline[2][]{%
   \tabu@startstop{#2}\tabu@getlinespec{#1}\@multicnt\@ne
   \ifnum\tabu@start>\tabu@stop \the\toks@
   \else\ifx\tabu@xleaders\relax\the\toks@
   \else
      \toks@{\ifnum0=`{\fi}\noalign{\global\setbox\tabu@box \box\@arstrutbox}}%
      \iftabu@firstcline\if\tabu@align t\vskip-\ht\@arstrutbox\fi\fi
      \@whilenum\@multicnt<\tabu@start\do{\advance\@multicnt\@ne
                              \toks@\expandafter{\the\toks@ &}}%
      \loop
         \toks@\expandafter{\the\toks@ \omit }%
         \ifnum \@multicnt=\@ne
         \expandafter \tabu@add \csname tabu@tok@\the\@multicnt L\endcsname \@nil
         \fi
         \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi\relax
            \toks@\expandafter{\the\toks@ \color@begingroup}%
            \toks@\expandafter\expandafter\expandafter{\expandafter\the
                              \expandafter\toks@ \tabu@xleaders \color@endgroup}%
         \fi
         \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi %
         \expandafter \tabu@add \csname tabu@tok@\the\@multicnt R\endcsname \@nil
         \fi
         \ifnum\@multicnt<\tabu@stop
            \advance\@multicnt\@ne
            \if@tempswa \toks@\expandafter{\the\toks@ &}%
            \else       \toks@\expandafter{\the\toks@ \span}\fi
      \repeat
      \@whilenum\@multicnt<\tabu@nbcols\do{\advance\@multicnt\@ne
                              \toks@\expandafter{\the\toks@ &}}%
      \toks@\expandafter{\the\toks@ \cr \noalign{%
           \global\tabu@firstclinefalse \global\setbox\@arstrutbox \box\tabu@box}}%
      \the\toks@
   \fi\fi
}% \tabucline
\def\tabu@add #1\@nil{\toks@\expandafter{\the\toks@ #1\ifmmode$\fi}}
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@startstop}
%
%    This macro parses the mandatory argument of \cs{tabucline}: start-column and end-column of the \textt{cline}.
%
%    \begin{macrocode}
\def\tabu@startstop#1{\tabu@start@stop #1\relax 1-\tabu@nbcols\@nnil}
\def\tabu@start@stop #1-#2\@nnil{%
   \countdef\tabu@start100\countdef\tabu@stop101 % <inside noalign group>
   \@defaultunits \tabu@start \number0#1\relax\@nnil
   \@defaultunits \tabu@stop  \number0#2\relax\@nnil
   \ifnum\tabu@start>\tabu@nbcols\tabu@start=\tabu@nbcols\else
      \ifnum\tabu@start>\z@\else \tabu@start=\@ne        \fi\fi
   \ifnum\tabu@stop>\tabu@nbcols \tabu@stop\tabu@nbcols  \else
      \ifnum\tabu@stop>\z@\else  \tabu@stop=\tabu@nbcols \fi\fi
}% \tabu@start@stop
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@getlinespec}
%
%    This macro parses the optional argument of \cs{tabucline} and check if it's a line specification
%    (then \cs{tabu@getline} is expanded) or a \cs{leaders} specification (then \cs{tabu@leaders} is expanded).
%
%    \begin{macrocode}
\def\tabu@getlinespec#1{\let\tabu@xleaders \relax
   \@defaultunits \let\@tempa=#1 \relax\@nnil
   \ifx\@tempa\relax \let\tabu@xleaders \tabu@defaultleaders\else
   \ifx\@tempa\hbox  \tabu@defleaders{#1}\else
   \ifx\@tempa\box   \tabu@defleaders{#1}\else
   \ifx\@tempa\copy  \tabu@defleaders{#1}\else
   \ifcsname tabu@line@style@\detokenize{#1}\endcsname
      \csname tabu@line@style@\detokenize{#1}\endcsname
   \else \tabu@getline{#1\p@ on0pt off0pt}\fi\fi\fi\fi\fi
}% \tabu@getlinespec
\def\tabu@defleaders#1{%
   \def\tabu@xleaders{\xleaders\hbox{\lower.5\extrarowheight#1}\tabu@leaderfill}}
\def\tabucline@warn#1{\PackageWarning{tabu}
   {Undefined line syle: #1
   \MessageBreak Using default line style instead}%
   \let\tabu@xleaders \tabu@defaultleaders
}% \tabucline@warn
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@getline}
%
%     This macro parses the optional argument of \cs{tabucline} (or the one of \cs{tabulinestyle})
%     and extract the thickness, the dash an gap specified. Default values assignments are done either.
%
%    \begin{macrocode}
\def\tabu@getline#1{\tabu@lineon #1 \@nil on\tabu@linedash \p@ \@nil\@nnil{#1}}
\def\tabu@maybecolor{\ifx\tabu@color\@empty \afterassignment\tabu@colortest
                     \else \@defaultunits\fi}
\def\tabu@lineon #1on#2\@nil#3\@nnil#4{%
   \let\tabu@color \@empty
   \@defaultunits \let\@tempa=#1 \relax\@nnil
   \ifcase 0\ifx o\@tempa 1\else\ifcat A\noexpand\@tempa 2\fi\fi\relax
      \tabu@maybecolor \@tempdima #1\arrayrulewidth \p@\@nnil
      \tabu@maybecolor \@tempdimb #2\p@ \@nnil
      \tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil
   \or\@tempdima \arrayrulewidth
      \tabu@maybecolor \@tempdimb #2\p@ \@nnil
      \tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil
   \else
      \tabu@maybecolor \@tempdima \arrayrulewidth #1\p@\@nnil
      \ifx\tabu@color\@empty \tabucline@warn{#4}\else
      \@tempdimb \z@
      \tabu@lineoff off0pt \p@\@nnil \fi
   \fi
}% \tabu@lineon
\def\tabu@lineoff #1off#2\@nnil{%
   \tabu@maybecolor \@tempdimc #2\p@ \@nnil
   \ifdim \@tempdimb=\z@
      \ifdim \@tempdimc>\z@ \@tempdimb \tabu@dashgap\relax\fi\fi
   \ifdim \@tempdimc=\z@
      \ifdim \@tempdimb>\z@ \@tempdimc \tabu@linedash\relax\fi\fi
   \ifdim \@tempdima<\z@ \else
   \ifdim \@tempdimb<\z@ \else
   \ifdim \@tempdimc<\z@ \else
      \edef \tabu@xleaders{\tabu@color\xleaders
         \ifdim\@tempdimc>\z@
            \hbox\bgroup \kern\the\dimexpr\@tempdimc/2\relax\fi
         \noexpand\iftabu@firstcline
         \vrule depth\dimexpr\the\@tempdima
                \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi
         \noexpand\else
         \vrule height\dimexpr-\extrarowheight+\the\@tempdima
                depth\dimexpr\extrarowheight
               \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi
         \noexpand\fi
         \ifdim\@tempdimc>\z@
            \kern\the\dimexpr\@tempdimc/2\egroup\fi
         \tabu@leaderfill}%
   \fi\fi\fi
}% \tabu@lineoff
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@colortest}
%
%
%
%    \begin{macrocode}
\def\tabu@colortest{\futurelet\tabu@temp\tabu@linecolor}
\def\tabu@linecolor{%
   \ifcase 0\if ,\noexpand\tabu@temp\else
            \ifx\relax\tabu@temp\else
            \ifx \@sptoken\tabu@temp1\else
            \ifcat A\noexpand\tabu@temp2\else
            3\fi\fi\fi\fi\relax
   \def\tabu@next##1{\futurelet\tabu@temp\tabu@linecolor}%
   \or\def\tabu@next{\tabu@gobblespace{\futurelet\tabu@temp\tabu@linecolor}}%
   \or\let\tabu@next\tabu@getlinecolor
   \else\expandafter\remove@to@nnil
   \fi \tabu@next
}% \tabu@linecolor
\def\tabu@getlinecolor#1\p@{%
   \edef\@tempa{\zap@space #1 \@empty}%
   \ifcsname\string\color@\@tempa\endcsname
      \edef\tabu@color{\noexpand\noexpand\noexpand\color{\@tempa}}%  \set@color
   \fi\remove@to@nnil
}% \tabu@getlinecolor
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabulinestyle}
%
%   \cs{tabulinestyle}\M*{style=spec.}
%
%    \begin{macrocode}
\def\tabulinestyle#1{\@for\@tempa:=#1\do{\expandafter\tabu@linestyle\@tempa==\@nil}}
\def\tabu@linestyle#1=#2=#3\@nil{%
   \begingroup \tabu@getlinespec {#2}\expandafter\gdef
         \csname tabu@line@style@\detokenize{#1}\expandafter\endcsname
                     \expandafter{\expandafter\def\expandafter\tabu@xleaders
                                                \expandafter{\tabu@xleaders}}%
   \endgroup
}% \tabu@linestyle
\expandafter\def \csname tabu@line@style@\endcsname {%
                                     \let\tabu@xleaders \tabu@defaultleaders}%
\def\tabu@defaultleaders{\leaders
   \iftabu@firstcline
      \vrule  depth \arrayrulewidth
   \else
      \vrule  height\dimexpr-\extrarowheight+\arrayrulewidth
              depth \extrarowheight
   \fi
   \tabu@leaderfill}
\let\tabu@leaderfill \hfil
%    \end{macrocode}
%    \end{macro}
%
%
% \subsection(Verbatim with X columns){Verbatim inside \textt{tabu} with \textt X columns}
%
%    \begin{macro}{\tabu@sanitizetext}
%    \begin{macrocode}
{\catcode32=13\relax\catcode`\^^@=13\relax
\gdef\tabu@verb{\@sanitize\makeatletter\catcode`\^=7\edef\^{\string^}%
\catcode32=13\let =\ \catcode`\^^@=13\def^^@{\par}\endlinechar\m@ne}%
}
\newcommand\tabu@sanitizetext[1][\ttfamily]{\begingroup
                        \tabu@verb #1\tabu@s@nitizetext}
\long\def\tabu@s@nitizetext#1{\@makeother\{\@makeother\}%
            \everyeof{\noexpand}\scantokens{#1}\endgroup}
%    \end{macrocode}
%    \end{macro}
%
% \subsection{Numbers in \textt{tabu}}
%
% \subsubsection{\cs{tabudecimal}}
%
%    \begin{macro}{\tabudecimal}
%    \begin{macrocode}
\def\tabu@tabudecimal#1{%
   \def\tabu@decimal{#1}\@temptokena{}%
   \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces
   \tabu@scandecimal
}% \tabudecimal
\def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@}
\def\tabu@skipdecimal#1{#1\tabu@scandecimal}
\def\tabu@getdecimal@ignorespaces{%
   \ifcase 0\ifx\tabu@temp\ignorespaces\else
            \ifx\tabu@temp\@sptoken1\else
            2\fi\fi\relax
      \let\tabu@getdecimal@ \tabu@getdecimal
      \expandafter\tabu@skipdecimal
   \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal
   \else \expandafter\tabu@skipdecimal
   \fi
}% \tabu@getdecimal@ignorespaces
\def\tabu@get@decimal#1{\@temptokena\expandafter{\the\@temptokena #1}%
                        \tabu@scandecimal}
\def\do#1{%
   \def\tabu@get@decimalspace#1{%
      \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}%
}\do{ }
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@getdecimal}
%    \begin{macrocode}
\def\tabu@getdecimal{%
   \ifcase    0\ifx 0\tabu@temp\else
               \ifx 1\tabu@temp\else
               \ifx 2\tabu@temp\else
               \ifx 3\tabu@temp\else
               \ifx 4\tabu@temp\else
               \ifx 5\tabu@temp\else
               \ifx 6\tabu@temp\else
               \ifx 7\tabu@temp\else
               \ifx 8\tabu@temp\else
               \ifx 9\tabu@temp\else
               \ifx .\tabu@temp\else
               \ifx ,\tabu@temp\else
               \ifx -\tabu@temp\else
               \ifx +\tabu@temp\else
               \ifx e\tabu@temp\else
               \ifx E\tabu@temp\else
               \ifx\tabu@cellleft\tabu@temp1\else
               \ifx\ignorespaces\tabu@temp1\else
               \ifx\@sptoken\tabu@temp2\else
            3\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax
       \expandafter\tabu@get@decimal
   \or \expandafter\tabu@skipdecimal
   \or \expandafter\tabu@get@decimalspace
   \else\expandafter\tabu@printdecimal
   \fi
}% \tabu@getdecimal
\def\tabu@printdecimal{%
   \edef\tabu@temp{\the\@temptokena}%
   \ifx\tabu@temp\@empty\else
   \ifx\tabu@temp\space\else
      \expandafter\tabu@decimal\expandafter{\the\@temptokena}%
   \fi\fi
}% \tabu@printdecimal
%    \end{macrocode}
%    \end{macro}
%
%
% \subsection{\cs{savetabu}}
%
%    \begin{macro}{\savetabu}
%
%    When this command is called by the user, the \textt{tabu} preamble and target are globally
%    stored into a macro \cs{tabu@saved@\meta{user-name}}.
%
%    \begin{macro}{\tabu@saveX}
%
%    \cs{tabu@saveX} replaces \cs{savetabu} inside a \textt{tabu} with \textt X columns.
%    The \textt X columns widths have to be stored, that is, the value in points of \cs{tabucolX}.
%
%    \begin{macrocode}
\newcommand*\savetabu[1]{\noalign{%
   \ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else
      \@ifundefined{tabu@save@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}%
      {\toks@\expandafter{\tabu@saved}%
      \expandafter\xdef\csname tabu@saved@\string#1\endcsname{%
         \tabu@target\the\tabu@target\relax
         \the\toks@}}%
   \fi}%
}% \savetabu
%    \end{macrocode}%
%
%    \begin{macrocode}
\def\tabu@saveX#1{\noalign{%
   \ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else
      \@ifundefined{tabu@saved@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}%
      {\toks@\expandafter{\tabu@saved}%
      \expandafter\xdef\csname tabu@saved@\string#1\endcsname{%
         \tabucolX\the\tabucolX\relax
         \tabu@target\the\tabu@target\relax
         \the\toks@}}%
   \fi}%
}% \tabu@saveX
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\tabu@savewarn}
%    \begin{macro}{\tabu@saveerr}
%
%    Info for overwritting when \cs{savetabu} is used.
%
%    Error if \cs{usetabu} is called with an unknown argument.
%
%    \begin{macrocode}
\def\tabu@savewarn#1#2{\PackageInfo{tabu}
   {User-name `#1' already used for \string\savetabu
   \MessageBreak #2}}%
\def\tabu@saveerr#1{\PackageError{tabu}
   {User-name `#1' is unknown for \string\usetabu
   \MessageBreak I cannot restore an unknown preamble!}\@ehd}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%
% \subsection(\cs{rowfont}){\csbf{rowfont}}
%
% \subsubsection(Font and alignment){Setting font and alignment specification}
%
%    \begin{macro}{\rowfont}
%
%    \cs{rowfont} uses the control sequences \cs{tabu@celllalign}, \cs{tabu@cellleft}, \cs{tabu@cellright}\linebreak
%    and \cs{tabu@cellralign} which have been placed on purpose into the user-defined tokens inserted
%    in any preamble by the \xpackage{array} package.
%
%    \cs{tabu@celllalign} and \cs{tabu@cellralign} are used to modify the alignment. If the optional
%    \M[alignment] parameter of \cs{rowfont} is not specified, then those control sequence expand
%    to \cs{@empty}.
%
%    \cs{tabu@cellleft} contains the font-modification information.
%
%    Placement of those control sequences into the user-tokens that are inserted in the preamble
%    by the \xpackage{array} package is explained below under the macro \cs{tabu@prepnext@tok}.
%
%    \begin{macrocode}
\def\tabu@rowfont{\noalign{\ifnum0=`}\fi\tabu@row@font}
\newcommand*\tabu@row@font[2][]{%
   \global\tabu@everycr@tok=\everycr
   \global\let\tabu@@cellleft \tabu@cellleft
   \global\let\tabu@@cellright \tabu@cellright
   \gdef\tabu@cellfont{#2}%
   \ifcsname tabu@cell@#1\endcsname  % row alignment
         \csname tabu@cell@#1\endcsname \fi
   \toks@\expandafter {\tabu@cellleft\tabu@cellfont}% inside \noalign group ok
   \xdef\tabu@cellleft {\the\toks@}%
   \global\everycr\expandafter {\the\everycr\tabu@rowfont@reset}%
   \ifnum0=`{\fi}% end of noalign group
}% \rowfont
%    \end{macrocode}
%    \end{macro}
%
%
%    \begin{macro}{\tabu@rowfont@reset}
%
%    This macro resets \cs{tabu@celllalign},\, \cs{tabu@cellleft},\, \cs{tabu@cellright},\, \cs{tabu@cellralign}\, and\,
%    \cs{everycr} to the value they had before the expansion of \cs{rowfont}.
%
%    It expands when a new row is inserted into the tabular or array.
%
%    \begin{macrocode}
\def\tabu@rowfont@reset{%
   \noalign{%
      \global\let\tabu@cellleft \tabu@@cellleft
      \global\let\tabu@cellright \tabu@@cellright
      \global\let\tabu@cellfont \@empty
      \global\let\tabu@celllalign \@empty
      \global\let\tabu@cellralign \@empty
      \global\everycr=\tabu@everycr@tok
      \global\tabu@everycr@tok{}%
   }%
}% \tabu@rowfont@reset
%    \end{macrocode}
%    \end{macro}
%
% \subsubsection(Tokens preparation){Preparing stuff to be able to use \cs{rowfont}}
%
%    \begin{macro}{\tabu@prepnext@tok}
%
%    \cs{tabu@prepnext@tok} will replace \cs{prepnext@tok} (in \xfile{array.sty}): its purpose is to add
%    the control sequences \cs{tabu@celllalign},\, \cs{tabu@cellleft},\, \cs{tabu@cellright}\, and\, \cs{tabu@cellralign}\,
%    at the right position in the ``preamble'' for \cs{halign}. Those control sequences are not inserted directly
%    into the preamble, but by the means of the user-tokens placed there by the \xpackage{array} package.
%
%     The package \xpackage{array} defines a macro \cs{prenext@tok} to initialize each user-token
%     inserted at both side of each ``normal'' column. For ``special`' \textttbf @ and \texttbf ! columns,
%     there is only one token.
%     \begin{center}
%     \begin{tikzpicture}
%     \node (L) at (1,1)  {$\underbrace{\hbox{>\M*{\cs{bfseries}\cs{color}\M*{red}}}}$}
%           node [anchor=west] (r) at (L.east) {\raise.5ex\hbox{\larger r}}
%           node [anchor=west] (R) at (r.east) {$\underbrace{\hbox{<\M*{\cs{color}\M*{black}\cs ,\cs\$}}}$}
%           node [anchor=center] at (L.south) {\cs{toks}<$i$>}
%           node [anchor=center] at (R.south) {\cs{toks}<$i+1$>};
%     \end{tikzpicture}
%     \end{center}
%
%     When a column is inserted in the tabular preamble (\cs{@preamble}), the \TeX{} counter \cs{count@}
%     is equal to $i+1$ (\ie the right token) and the counter \cs{@tempcnta} is equal to $i$ (\ie the left token).
%     If the column is special (\ie \texttbf @ or \texttbf !) \cs{@tempcnta} is not updated.
%
%     Thus, when a new token is ``prepared'' by \cs{prepnext@tok}:
%     \begin{description}[leftmargin=1cm]
%     \item[either: $\mathbf{i=}$\cs{count@}$\,=$\cs{@tempcnta}]: the token to prepare (\ie \cs{toks}$<i+1>$)
%           is the right one of a ``normal'' column. The switch \cs{iftabu@cellright} is set to \textt{true}. \\
%           The \emph{previous} token (\cs{toks}$<i>=$\cs{toks}\cs{count@}) is necessarily the left one of this ``normal'' column:
%           we prepend \cs{tabu@celllalign} and append \cs{tabu@cellleft} to this token (\cs{toks}$<i>$).
%           This token is finished and will not change afterwards.
%
%     \item[or: $\mathbf{i=}$\cs{count@}$\,=$\cs{@tempcnta}$+1$]: the token to prepare (\cs{toks}$<i+1>$) is either the left one of a normal column,
%           or the single one of a special\, \texttbf @ or \texttbf !\, column.\\
%           If the switch \cs{iftabu@cellright} is true, then the \emph{previous} token \cs{toks}$<i>$ is the right one of the last inserted column
%           (which was a ``normal'' column, thus):, \cs{tabu@cellright}\cs{tabu@cellralign}\, is appended to it, and the switch
%           \cs{ittabu@cellright} is reset to \texttt{false}.
%           May be \cs{prepnext@tok} will be expanded again (by \cs{save@decl}): if it happens,
%           then again\, \cs{count@}$\,=$\cs{@tempcnta}$+1$\, (same case) but \cs{iftabu@cellright} is \textt{false} and nothing is changed.
%
%     \item[else:] The token to prepare (which is \cs{toks}$<i+1>=$\cs{toks}\cs{count@}$+1$), cannot be the right one of a ``normal'' column:
%           \cs{iftabu@cellright} is set to \textt{false}. \\
%           The fact that\, $\vert$\cs{count@}$-$\cs{@tempcnta}$\vert>1$\, tells us that the previous token \cs{toks}$<i>$
%           is necessarily the single one of a ``special''\, \texttbf @ or \texttbf !\, column. We don't modify this token, as
%           long as \emph{special columns are always inserted as is}:\, \cs{rowcolor} has no effect on special
%           columns, nor\, \cs{rowfont}.
%     \end{description}
%     Thereafter, the original initialisation sequence occurs: \cs{advance}\cs{count@}\textt{ by}\cs{@ne} and initialize the token
%     to prepare (\cs{toks}\cs{count@}$\,=$\cs{toks}$<i+1>$) to an empty one.
%
%    \begin{macrocode}
\newif\iftabu@cellright
\AtBeginDocument{\let\array@prepnext@tok \prepnext@tok }% original definition
\def\tabu@prepnext@tok{%
   \ifnum \count@<\z@  % <first initialisation>
      \@tempcnta \@M   % <not initialized by array.sty>
      \tabu@nbcols\z@
      \gdef\tabu@global@temp{\tabu@nbcols\z@}%
      \expandafter\let\csname tabu@tok@1L\endcsname \relax
      \tabu@cellrightfalse
   \else
      \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left
         \advance \tabu@nbcols\@ne
         \expandafter\let\csname tabu@tok@\the\tabu@nbcols R\endcsname \relax
         \expandafter\gdef\expandafter\tabu@global@temp\expandafter{%
                           \tabu@global@temp \advance\tabu@nbcols\@ne}%
         \iftabu@cellright % before-previous token is right and is finished
            \tabu@cellrightfalse % <only once>
            \tabu@savetok R\tabu@preptokenright
         \fi
         \ifnum \tabu@nbcols=\@ne
            \tabu@savetok L% LEFT token is always empty unless >{...}
         \fi
         \tabu@preptokenleft
      \or                     % (case 1) previous token is right
         \tabu@savetok R\tabu@cellrighttrue
      \else % special column: do not change the token
         \ifnum \tabu@nbcols>\z@ %special column: always on the right of normal one
            \tabu@savetok R%
         \else % unless this is the very first column (\tabu@nbcols=0)
            \advance\tabu@nbcols\@ne \tabu@savetok L\advance\tabu@nbcols\m@ne
         \fi
         \iftabu@cellright    % before-previous token is right
            \tabu@cellrightfalse
            \tabu@preptokenright
         \fi
      \fi % \ifcase
   \fi
   \array@prepnext@tok
}% \tabu@prepnext@tok
\def\tabu@preptokenright{%
   \advance \count@ \m@ne
   \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}%
   \advance \count@ \@ne
}% \tabu@preptokenright
\def\tabu@preptokenleft{\toks\count@\expandafter {\expandafter\tabu@celllalign
                                             \the\toks\count@ \tabu@cellleft}%
}% \tabu@preptokenleft
\def\tabu@savetok#1{\begingroup
   \expandafter\tabu@savet@k\csname tabu@tok@\the\tabu@nbcols #1\endcsname
}% \tabu@savetok
\def\tabu@savet@k#1{%
   \@temptokena\toks\count@
   \ifx#1\relax\else \@temptokena\expandafter\expandafter
                     \expandafter{\expandafter#1\the\@temptokena}%
   \fi
   \@temptokena\expandafter{\expandafter\def\expandafter#1\expandafter{%
                                                      \the\@temptokena}}%
   \toks@\expandafter\expandafter\expandafter{\expandafter\tabu@global@temp
                                                      \the\@temptokena}%
   \xdef\tabu@global@temp{\the\toks@}%
   \expandafter\endgroup \the\@temptokena
}% \tabu@savetok
%    \end{macrocode}
%    \end{macro}
%
% \subsubsection(Glue neutralisation){Neutralisation of glues and alignment modification}
%
%    \begin{macro}{\tabu@cellleft}
%    \begin{macro}{\tabu@celllalign}
%    \begin{macro}{\tabu@cellright}
%    \begin{macro}{\tabu@cellralign}
%    \begin{macro}{\tabu@cellfont}
%    First initialisation to \cs{@empty}.
%    \begin{macrocode}
\let\tabu@cellleft\@empty
\let\tabu@cellright\@empty
\def\tabu@celllalign{\tabu@cellleft}% row font spec. applies to pre-column material
\let\tabu@cellralign\@empty
\let\tabu@cellfont\@empty
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\tabu@cell@l}
%    \begin{macro}{\tabu@cell@c}
%    \begin{macro}{\tabu@cell@r}
%    \begin{macro}{\tabu@cell@j}
%
%    Setup macros to modify the alignment. The skips inserted to make the standard alignment
%    specified in the \textt{tabular} preamble are not the same with standard \xpackage{array} tabulars
%    and \xpackage{colortbl} tabulars, hence the switch \cs{iftabu@colortbl}.
%
%    \begin{macrocode}
\def\tabu@cell@l{% force alignment to left
   \gdef\tabu@celllalign{\tabu@removehfil
                        \raggedright\arraybackslash
                        \tabu@cellleft}%
   \gdef\tabu@cellralign{\tabu@flush1\tabu@ignorehfil}%
   \toks@\expandafter{\tabu@cellleft\raggedright\arraybackslash}% local
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@l
\def\tabu@cell@c{% force alignment to center
   \gdef\tabu@celllalign{\tabu@removehfil
                        \centering\arraybackslash
                        \tabu@flush{.5}\tabu@cellleft}%
   \gdef\tabu@cellralign{\tabu@flush{.5}\tabu@ignorehfil}%
   \toks@\expandafter{\tabu@cellleft\centering\arraybackslash}% local
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@c
\def\tabu@cell@r{% force alignment to right
   \gdef\tabu@celllalign{\tabu@removehfil
                        \raggedleft\arraybackslash
                        \tabu@flush1\tabu@cellleft}%
   \gdef\tabu@cellralign{\tabu@ignorehfil}%
   \toks@\expandafter{\tabu@cellleft\raggedleft\arraybackslash}% local
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@r
\def\tabu@cell@j{% force justification (for p, m, b columns)
   \gdef\tabu@celllalign{\tabu@justify\tabu@cellleft}%
   \global\let\tabu@cellralign\@empty
   \toks@\expandafter{\tabu@cellleft\tabu@justify}% local (noalign grp)
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@j
\def\tabu@justify{%
   \leftskip\z@skip \@rightskip\leftskip \rightskip\@rightskip
   \parfillskip\@flushglue
}% \tabu@justify
%% ragged2e settings
\def\tabu@cell@L{% force alignment to left (ragged2e)
   \gdef\tabu@celllalign{\tabu@removehfil
                        \RaggedRight\arraybackslash
                        \tabu@cellleft}%
   \gdef\tabu@cellralign{\tabu@flush1\tabu@ignorehfil}%
   \toks@\expandafter{\tabu@cellleft\RaggedRight\arraybackslash}%
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@L
\def\tabu@cell@C{% force alignment to center (ragged2e)
   \gdef\tabu@celllalign{\tabu@removehfil
                        \Centering\arraybackslash
                        \tabu@flush{.5}\tabu@cellleft}%
   \gdef\tabu@cellralign{\tabu@flush{.5}\tabu@ignorehfil}%
   \toks@\expandafter{\tabu@cellleft\Centering\arraybackslash}%
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@C
\def\tabu@cell@R{% force alignment to right (ragged2e)
   \gdef\tabu@celllalign{\tabu@removehfil
                        \RaggedLeft\arraybackslash
                        \tabu@flush1\tabu@cellleft}%
   \gdef\tabu@cellralign{\tabu@ignorehfil}%
   \toks@\expandafter{\tabu@cellleft\RaggedLeft\arraybackslash}%
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@R
\def\tabu@cell@J{% force justification (ragged2e)
   \gdef\tabu@celllallign{\justifying\arraybackslash\tabu@cellleft}%
   \global\let\tabu@cellralign\@empty
   \toks@\expandafter{\tabu@cellleft\justifying\arraybackslash}%
   \xdef\tabu@cellleft{\the\toks@}%
}% \tabu@cell@J
\def\tabu@flush#1{%
   \iftabu@colortbl      % colortbl uses \hfill rather than \hfil
      \hskip \ifnum\currentgrouptype>13 \stretch{#1}%
      \else\ifdim#1pt<1pt \tabu@cellskip
      \else \stretch{#1}
      \fi\fi \relax
   \else                % array.sty
      \ifnum \currentgrouptype>13\relax
         \hfil \hskip1sp
      \fi
   \fi
}% \tabu@flush
\AtBeginDocument{%
   \@ifpackageloaded{ragged2e}
      {}
      {\let\tabu@cell@L \tabu@cell@l
       \let\tabu@cell@R \tabu@cell@r
       \let\tabu@cell@C \tabu@cell@c
       \let\tabu@cell@J \tabu@cell@j
      }%
}% AtBeginDocument
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\tabu@removehfil}
%
%    \cs{tabu@removehfil} removes (eventually) the infinite stretchable glue inserted
%    \emph{before} the cell (in the preamble of \cs{halign}) to make the column alignment.
%
%    \begin{macrocode}
\newskip\tabu@cellskip
\let\tabu@hfil\hfil
\let\tabu@hfill\hfill
\let\tabu@hskip\hskip
\def\tabu@removehfil{%
   \iftabu@colortbl
      \unkern \tabu@cellskip = \lastskip
      \ifnum\gluestretchorder\tabu@cellskip = \tw@ \hskip-\tabu@cellskip
      \else \tabu@cellskip = \z@skip
      \fi
   \else
      \ifdim\lastskip=1sp\unskip\fi
      \ifnum\gluestretchorder\lastskip = \@ne
         \hfilneg % \hfilneg for array.sty but not for colortbl...
      \fi
   \fi
}% \tabu@removehfil
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\tabu@ignorehfil}
%
%    \cs{tabu@ignorehfil} removes (eventually) the infinite stretchable glue inserted
%    \emph{after} the cell (in the preamble of \cs{halign}) to make the column alignment.
%
%    \begin{macrocode}
\def\tabu@ignorehfil{%
   \aftergroup\tabu@nohfil
}% \tabu@ignorehfil
\def\tabu@nohfil{% \hfil -> do nothing + restore original \hfil
   \def\hfil{\let\hfil\tabu@hfil}%   local to (alignment template) group
}% \tabu@nohfil
\AtBeginDocument{%
   \@ifpackageloaded{colortbl}
   {%
   \def\tabu@nohfil{%
      \def\hfil{\let\hfil\tabu@hfil}% local to (alignment template) group
      \def\hfill{\let\hfill\tabu@hfill}% (colortbl uses \hfill) pfff...
      \def\hskip##1\relax{\let\hskip\tabu@hskip}}% local
   }% @ifpackageloaded colortbl
   {}%
}% AtBeginDocument
%    \end{macrocode}
%    \end{macro}
%
%
%
% \subsection{Utilities}
%
% \subsubsection{tabu \cs{fbox}}
%
% \cs{tabu@fbox} works exactly like \LaTeX{} \cs{fbox} but allows the syntax: \cs{fbox}\cs{bgroup}...\cs{egroup}
% suitable for use inside tabular columns. \cs{fbox} is \cs{let} to \cs{tabu@fbox} at the entry inside a \textt{tabu}
% environment.
%
%    \begin{macrocode}
\def\tabu@fbox{%
   \leavevmode
   \let\color@bgroup\bgroup
   \def\color@egroup{\endgraf\egroup}%
   \afterassignment\tabu@begin@fbox
      \setbox\@tempboxa \hbox
}% \tabu@fbox
\def\tabu@begin@fbox{\color@bgroup\kern\fboxsep\aftergroup\tabu@end@fbox}
\def\tabu@end@fbox{\kern\fboxsep\color@egroup\@frameb@x\relax}
%    \end{macrocode}
%
%
% \subsubsection{\cs{centering}, \cs{raggedright}, \cs{raggedleft}}
%
% Inside \textt{tabu} environment, no need to add \cs{arraybackslash} after these commands.
%
%    \begin{macrocode}
\expandafter\def\expandafter\tabu@centering\expandafter{%
                                                \centering\arraybackslash}
\expandafter\def\expandafter\tabu@raggedleft\expandafter{%
                                                \raggedleft\arraybackslash}
\expandafter\def\expandafter\tabu@raggedright\expandafter{%
                                                \raggedright\arraybackslash}
\AtBeginDocument{%
\expandafter\def\expandafter\tabu@trivlist\expandafter{%
   \expandafter\let\expandafter\\\expandafter\@centercr\@trivlist}%
}%
%    \end{macrocode}
%
%
%
%
% \subsection{Corrections}
%
% \subsubsection(delarray compatibility fix){delarray comptability fix for \xpackage{colortbl} and \xpackage{arydshln}}
%
% Both \xpackage{colortbl} and \xpackage{arydshln} forgot the control sequence \cs{@arrayright}
% which must be expanded by \cs{endarray}. Originally defined for \xpackage{delarray}, this control
% sequence is used by \textt{tabu} environments when \textt{tabu X} columns are present in the preamble.
%
% Here is the fix. We test if \cs{endarray} contains \cs{@arrayright} before modifying the control sequence,
% in case \xpackage{colortbl} and/or \xpackage{arydshln} modify their implementation.
%
%    \begin{macrocode}
\def\tabu@fix@arrayright{%
   \@ifpackageloaded{arydshln}
   {%
   \@ifpackageloaded{colortbl}
      {%% colortbl + arydshln
      \def\tabu@endarray{%
         \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup %<original>
         \@arrayright     % <FC>
         \gdef\@preamble{}% <FC>
                  }}% \endarray
      {%% arydshln / no colortbl
      \def\tabu@endarray{%
         \adl@endarray \egroup \adl@arrayrestore \egroup %<original>
         \@arrayright     % <FC>
         \gdef\@preamble{}% <FC>
                  }}% \endarray
   }%
   {%
   \@ifpackageloaded{colortbl}
      {%% colortbl / no arydshln
      \def\tabu@endarray{%
         \crcr \egroup \egroup
         \@arrayright  % <FC>
         \gdef\@preamble{}\CT@end
                  }}%
      {\PackageWarning{tabu}
         {\string\@arrayright\space is missing from the
         \MessageBreak definition of \string\endarray.
         \MessageBreak Comptability with delarray.sty is broken.}}%
   }%
}% \tabu@fix@arrayright
%    \end{macrocode}
%
% \subsubsection{arydshln @ columns}
%
%    \begin{macrocode}
\def\tabu@adl@xarraydashrule#1#2#3{%
     \ifnum\@lastchclass=\adl@class@start\else
     \ifnum\@lastchclass=\@ne\else
     \ifnum\@lastchclass=5 \else % <FC> @-arg (class 5) and !-arg (class 1)
             \adl@leftrulefalse \fi\fi           % must be treated the same
     \fi
     \ifadl@zwvrule\else \ifadl@inactive\else
             \@addtopreamble{\vrule\@width\arrayrulewidth
                     \@height\z@ \@depth\z@}\fi \fi
     \ifadl@leftrule
             \@addtopreamble{\adl@vlineL{\CT@arc@}{\adl@dashgapcolor}%
                     {\number#1}#3}%
     \else   \@addtopreamble{\adl@vlineR{\CT@arc@}{\adl@dashgapcolor}%
                     {\number#2}#3}
     \fi
}% \tabu@adl@xarraydashrule
%    \end{macrocode}
%
% \subsubsection{arydshln and empty \textt p columns}
%
% \xpackage{arydshln} redefines \cs{@endpbox} for \textt p columns. The definition is stored in \cs{adl@act@endpbox}.
% Here it is:
%
% \begin{Verb*}
%  \unskip \ifhmode \nobreak
%        \vrule\@width\z@\@height\z@\@depth\dp\@arstrutbox
%        \fi
%  \egroup \adl@colhtdp \box\adl@box \hfil
% \end{Verb*}
%
% The \cs{vrule} inserted is exactly what package \xpackage{array} calls: \cs{@finalstrut}\cs{@arstrutbox}.
%
% However, just like in \xfile{array.sty}, this array-\textt{strut} should be inserted inconditionnally,
% and \cs{ifhmode} applies only to \cs{nobreak} (misplaced \cs{fi} in \xpackage{arydshln} definition).
%
%
%    \begin{macrocode}
\def\tabu@adl@act@endpbox{%
   \unskip \ifhmode \nobreak \fi    \@finalstrut \@arstrutbox
   \egroup
   \adl@colhtdp \box\adl@box \hfil
}% \tabu@adl@act@endpbox
%    \end{macrocode}
%
%

%
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \restoregeometry
% \bookmarksetup{bold*}
%
% \begin{History}
%
%   \begin{Version}{2010/11/15 v1.2}
%   \item Improvement in parameters parsing for optional parameters (\textt\textbar\ and \cs{tabucline}).
%   \item Modification / optimization in \cs{tabu@prepnext@tok}.
%   \item Modification of \cs{tabucline} to get better results with \textt m columns (\textt{X[m]})
%         and also when \cs{minrowclearance} $>0$ (package \xpackage{colortbl}).
%   \end{Version}
%
%
%   \begin{Version}{2010/10/28 v1.1}
%   \item First version.
%   \end{Version}
%
% \end{History}
%
%
% \PrintIndex
%
% \Finale