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

\renewenvironment{example}[1][Example:]{%
    \subsubsection*{#1}%
}{%
    \par
}
\newenvironment{examples}[1][Examples:]{%
    \subsubsection*{#1}%
}{%
    \par
}
\global\optionaloff
\let\optionalon\relax

\lstdefinelanguage{none}{}%
\lstdefinelanguage{adjustbox}{%
  moretexcs={%
      begin,end,adjustbox
  },
  emph={%
      frame,fbox,cframe,cfbox,minipage,raise
  },
}%

\lstdefinestyle{examplecode}{%
    basicstyle=\ttfamily\small,
    numbers=none,language=none,
    classoffset=1,
    morekeywords={begin,end},
    keywordstyle=\bfseries,
    classoffset=0,
    morekeywords={adjustbox,minsizebox,maxsizebox,lapbox,marginbox,phantombox},
    keywordstyle=\macrodescstyle,
    emph={viewport, trim, Trim, Viewport, Clip, Clip*, frame, fbox, cframe, cfbox, reflect, lap, margin, margin*, dpi,
    pxdim, execute, raise, valign, bgcolor, set, height, depth, vsize, width, totalheight, center, left, right, outer, inner, min, max,
    size, totalsize,
    minipage, varwidth, innerenv, innercode, env, Addcode, addcode, precode, Precode, appcode, angle, scale, height, width, totalheight, resolution,
    },
    emphstyle=\keydescstyle,
}

\makeatletter
\def\PrintExample{%
  \begingroup
  \par\smallskip\noindent
  \leavevmode
  \BoxExample
  \@tempdima=\textwidth
  \advance\@tempdima by -\wd\examplecodebox\relax
  \advance\@tempdima by -\wd\exampleresultbox\relax
  \advance\@tempdima by -15pt\relax
  \ifdim\@tempdima>\bigskipamount
    \hbox to \textwidth{%
     \null\hss
     \minipage[c]{\wd\examplecodebox}\usebox\examplecodebox\endminipage
     \hfill\hskip\bigskipamount\hfill
     \minipage[c]{\wd\exampleresultbox}%
        \EXAMPLERESULT
     \endminipage
     \hss\null
     }%
  \else
    \vbox{%
        \leftline{\usebox\examplecodebox}%
        \vspace{\bigskipamount}%
        \rightline{\EXAMPLERESULT}%
    }%
  \fi
  \par\smallskip
  \endgroup
}
\def\EXAMPLERESULT{%
    \leavevmode\hbox{%
    \textcolor{exampleborder}{%
        \boxframe
            {\dimexpr\wd\exampleresultbox+2\fboxrule\relax}%
            {\dimexpr\ht\exampleresultbox+\fboxrule\relax}%
            {\dimexpr\dp\exampleresultbox+\fboxrule\relax}%
        \hskip-\wd\exampleresultbox
        \hskip-\fboxrule
    }%
    \usebox\exampleresultbox
    }%
}%
\makeatother
\colorlet{exampleborder}{black!33}
\def\Descsep{\par\vskip-2.5ex\relax}

%\EnableCrossrefs
%\CodelineIndex
%\RecordChanges
\OnlyDescription
\renewcommand{\bottomfraction}{0.5}
\begin{document}
 \DocInput{adjustbox.dtx}
  \PrintChanges
  %\newpage\PrintIndex
\end{document}
%</driver>
% \fi
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ^^A Title page (((
% \CheckSum{3488}
%
% \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         \~}
%
%
% \changes{v0.1}{2011/01/24}{First internal version}
% \changes{v0.2}{2011/01/27}{First released version}
% \changes{v0.3}{2011/03/20}{Bug fix for wrong baseline placed on the bottom}
% \changes{v0.4}{2011/07/xx}{Added pdftex driver}
% \changes{v0.5}{2011/08/13}{Added more macros and keys}
% \changes{v0.5a}{2011/08/21}{Fixed \Key{left} and \Key{right} keys. Fixed \Key{valign}'='t}
% \changes{v0.6}{2011/09/04}{Added tabular support.}
% \changes{v0.6a}{2011/10/29}{Fixed issue with keys affecting the content in an unwanted way.}
% \changes{v0.7}{2011/10/30}{Added \cs{adjustboxset} and \cs{adjustimage} macros.}
% \changes{v0.8}{2011/11/14}{
%     Added driver files for dvips and xelatex. Moved pdftex driver code to own file.
%     Fixed and improved default unit code for the \opt{calc} option.
%     Changed \cs{adjustimage} code to use internals of \cs{includegraphics}. This allows the redefinition of \cs{includegraphics}.
%     Added manual for \Key{bgcolor} and added \Key{bgcolor*}.
%     Changed \Key{bgimage} to use \cs{adjustimage}.
%     Added manual entries for \Key{cfbox} and \Key{cframe}.
%     Removed loading of non-mandatory \pkg{storebox} package for now.
%     Added \Key{set vsize}.
%     Added shortcuts \Key{rlap} and \Key{llap}.
%     Added \adjincludegraphics and the Export option.
%     Fix for \Key{innerenv} argument.
%     Added lengths \cs{Width}, \cs{Height}, \cs{Depth} and \cs{Totalheight} for the original dimensions of the content.
%     Added own \cs{raisebox} variant to support math expressions even for \cs{includegraphics}.
%     Some code cleanup.
%     Added \Key{varwidth} key as an alternative to \Key{minipage}.
%     Added \stackbox and \Key{stack} key and \env{stackbox} environment (similar to \cs{shortstack})
%     Added check for \pkg{xcolor} package.
% }
% \changes{v0.9}{2012/05/16}{
%   Basic trim and clip macros and driver files are now placed in a dedicated minimal package 'trimclip'.
%   Special thanks goes to Joseph Wright (LaTeX3 project) for his work on the driver files.
%   Clipping drivers are provided for 'pdftex' (incl. LuaTeX), 'dvips' and 'xetex' as well as a PGF fall-back
%   driver.
%   Packages: New dedicated 'trimclip' package with own manual.
%       Better separation between 'adjcalc' and 'adjustbox' package.
%       Review of manuals
%   New adjustbox keys:
%       * content
%       * gstore
%       * gstore*
%       * gstore width/height/depth/totalheight/sizes
%       * gobble/discard
%       * phantom
%       * warn width
%       * float
%       * nofloat
%       * figure
%       * label
%       * caption
%       * vspace
%       * vspace*
%       * padding  (alias of 'margin')
%       * padding* (alias of 'margin*')
%   Fixes: env key now works correctly; Fixed raise box code.
%   Macro changes: Added third optional argument to \stackbox.
% }
% \changes{v1.0}{2012/05/21}{%^^A
%       * Updated manual to contain all new keys and macro.
%       * Code optimisations.
%       * Improvements of (re-)boxing code.
%       * Added user-level macros to define keys.
%       * Changed horizontal alignment keys to box the content and added matching macros.
%       * Changed horizontal inner/outer side keys to use 'ifodd' package and added matching macros.
%       * Added missing \cs{leavevmode} for "raise" key.
%       * Simplified code for "valign" key. Fixed spurious space for "valign=v".
%       * Fixed min/max size keys to double a single value correctly.
%       * Code cleanup with "warn width" key.
% }
% \changes{v1.1}{2018/04/08}{%^^A
%       * Several bug fixes.
%       * Support for round corners and frames.
% }
% \changes{v1.2}{2019/01/04}{%^^A
%       * Added missing 'clip' feature for rounded frames.
%       * Changed order of corner values for rounded frames. This includes an update to the clipping drivers.
%       * Corrected 'adjnofloat' environment used by the 'nofloat' key to support the 'hypcap' feature of the 'caption' and 'hypcap' packages.
%       * Updated manual description of `export` option as requested by Issue #9.
%       * Updated manual to use (left, bottom, right, top) for the side values instead of (llx, lly, urx, ury).
%       * Some other improvements in the manual.
%       * Added keys and matching commands and environments to align to the page margins and text area borders:
%         'pagecenter', 'pageleft', 'pageright', 'pageinner', 'pageouter',
%         'textareacenter', 'textarealeft', 'textarearight', 'textareainner', 'textareaouter'.
%       * Added 'noindent' key.
%       * Added \newadjustimage and \NewAdjustImage commands to define custom versions of \adjustimage with predefined key
%         lists. This include variation to renew, provide and declare such macros.
%       * Added \provideadjustboxenv and \declareadjustboxenv.
%       * Added \provideadjustboxcmd and \declareadjustboxcmd.
% }
% \changes{v1.3}{2020/08/19}{%^^A
%       * Added support for (hopefully) all 'graphicx' keys.
%       * Added missing \leavevmode for framing keys.
%       * Added key "leavevmode" on request of Frank Mittelbach.
%       * Added 'process' key.
%       * Added 'clap' key on user request.
%       * Removed old graphicx key 'print'.
%       * trimclip: Added explicit luatex driver which uses the pdftex driver to avoid the fallback to PGF driver.
% }
%
% \GetFileInfo{adjustbox.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let}
%
% \author{Martin Scharrer}
% \email{martin@scharrer-online.de}
% \repository{https://helixteamhub.cloud/scharrer/projects/adjustbox/}
% \ydocpdfsettings
% \maketitle
%
% \makeatletter
% \def\LATeX{\texorpdfstring{(L\kern -.36em{\sbox \z@ T\vbox to\ht \z@ {\hbox {\check@mathfonts
%  \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.15em)\TeX}{(La)TeX}}
% \makeatother
%
% \begin{abstract}
%  This package allows to adjust general \LATeX\ material in several ways using a key=value interface.
%  It got inspired by the interface of \Macro\includegraphics from the \pkg{graphicx} package.
%  This package also loads the \pkg{trimclip} package which code was once included in this package.
% \end{abstract}
% \clearpage% \tableofcontents
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \clearpage\section{Introduction} ^^A (((
% The standard \LaTeX{} package \pkg{graphicx} (the extended version of \pkg{graphics}) provides the macro
% \Macro\includegraphics[<options>]{<file name>} which can be used to include graphic files. Several options can be used
% to scale, resize, rotate, trim and/or clip the graphic.
% The macros \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox are also provided to apply the corresponding
% operation on \LATeX{} material, which is subsequently placed inside a \Macro\hbox.
% However no macros are provided to trim or clip \LATeX{} material, most likely because this operations
% are not done by \TeX{} but by the output format, i.e.\ using PostScript (PS) or PDF operations.
%
% This package started by providing the missing macros \Macro\clipbox and \Macro\trimbox.
% Then a general \Macro\adjustbox macro which allows to combine many operations using a key=value syntax was added and
% further extended until it represented the main feature of this package.  Newly added keys are also provided as
% dedicated macros and corresponding environments.
% The \Macro\clipbox and \Macro\trimbox macros were then moved together with the required output driver code to a
% dedicated package \pkg{trimclip}. This allows documents and other packages to use these basic features without
% loading the full \pkg{adjustbox} package.
%
%
% ^^A )))2
% \subsection{Dependencies} ^^A (((2
% The \pkg{adjustbox} package and its \pkg{trimclip} sub-package require the author's other packages \pkg{adjcalc}
% (bundled with \pkg{adjustbox}) and \pkg{collectbox}, as well as the packages \pkg{xkeyval}, \pkg{graphicx} and \pkg{ifpdf}.
% The \pkg{varwidth} package is automatically loaded if installed, otherwise the \Key{varwidth} and \Key{stack} keys are
% disables as well as \Macro\stackbox and the \env{stackbox} environment.
% The \pkg{ifoddpage} package is automatically loaded if installed, otherwise the \Key{outer} and \Key{inner} keys are
% disables as well as \Macro\outersidebox and \Macro\innersidebox macros and corresponding environments.
% For features which use colors the \pkg{xcolor} package must also be loaded manually (the \pkg{color} package is fine, too).
% The experimental |split| and |pagebreak| features also require the \pkg{storebox} package to be loaded manually.
%
% ^^A )))2
% \subsection{Verbatim Support}\label{sec:verbatim} ^^A (((2
% The macros provided by \pkg{adjustbox} and \pkg{trimclip} read the content as a horizontal \TeX{} box and not as an
% macro argument in order to support verbatim content.
% This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:
% \begin{macroquote}
%   \adjustbox{key=value,\ldots}\AlsoMacro\bgroup~<content>\AlsoMacro\egroup
% \end{macroquote}
% Special care is taken to allow the \meta{content} to be a single macro (except \Macro\bgroup) without any braces:
% \begin{macroquote}
%   \adjustbox{key=value,\ldots}\AlsoMacro\somemacro
% \end{macroquote}
% This is to support the habit of some \LaTeX{} users to drop the braces for single token arguments.
% All environments support verbatim content.
% Note that the plain\TeX{} syntax for environments (\Macro\adjustbox\ldots\Macro\endadjustbox) can not be used
% because it will trigger \Macro\adjustbox as a macro. However, the braces around the content can be replaced
% by \Macro\bgroup and \Macro\egroup.
%
% ^^A )))2
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \clearpage\section{Package Options}\label{sec:options} ^^A (((
% This package accepts the following options:
%
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
%   \oitem{export} Exports the keys of \Macro\adjustbox to \Macro\includegraphics so that they can be used with this
%                  macro as well. Note that not all keys will works properly with \Macro\includegraphics as its internal
%                  code does not support all features. If problems occur the option |Export| should be used.
%                  For new documents it is recommended to use the macro \Macro\adjustimage{<keys>}{<filename>} instead.
%   \oitem{Export} Sets \Macro\includegraphics to be identical to \Macro\adjincludegraphics, which also allows the usage
%                  of all \Macro\adjustbox keys.
%   \oitem{pgf} This option is passed to \pkg{trimclip} and makes it to use the \pkg{pgf} package for all clip operations.
%               This overrides all automatically detected drivers.
%   \oitem{PGF} This option will pass the \opt{pgf} to \pkg{trimclip} and enable the \opt{pgfmath} option of
%               \pkg{adjcalc}, i.e.\ the \pkg{pgf}
%               package is used for clip operations and the \pkg{pgfmath} pacakge is used to parse length arguments.
%   \oitem{minimal} Only load a minimal set of code, i.e.\ \pkg{trimclip} and \Macro\adjustbox/\env{adjustbox}
%               but no additional keys and macros.
%  \end{description}
%
% \noindent
% The following options define the way length values are processed by the provided macros.
% They are passed to the \Macro\adjcalcset macro of the \pkg{adjcalc} package and load any required packages.
% These options can also be used as local keys on \Macro\adjustbox. See the \pkg{adjcalc} manual for more details on
% them.
%
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
%   \oitem{etex} Uses the $\epsilon$-\TeX\ primitive \Macro\glueexpr to parse length values.
%   \oitem{calc} Uses the \pkg{calc} package to parse length values.
%   \oitem{pgfmath} Uses the \pkg{pgfmath} package of the \pkg{pgf} bundle to parse length values.
%   \oitem{defaultunit}\MacroArgs!{\hspace*{-1ex}}!'='<unit>\relax
%      This sets the default unit used for values which accept length without units, e.g.\ \Key{trim}.
% \end{description}
%
% \noindent
% In addition, all driver options of the \pkg{trimclip} package are also accepted and passed to it.
% All unknown options are passed to the \pkg{graphicx} package, which might pass them down to the \pkg{graphics}
% package.
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \clearpage\section{Main Macros}^^A (((
% The following macros and environments represent the main functionality of this package.
% Special care is taken so that the macros and the environments can have the same name.
% For starred environments the star can be either part of the name or an optional argument.
%
% \subsection{Adjust Box Content} ^^A (((2
% \vskip-\lastskip
% \DescribeMacro\adjustbox{<key=value, \ldots>}{<content>}
% The \Macro\adjustbox macro allows the modification of general \LATeX\ content using a key=value syntax.
% This can be seen as an extension of the \Macro\includegraphics macro from images to any \LATeX{} material.
% The macro supports the all \Macro\includegraphics keys and many more.
% However, they are provided as a mandatory not as an optional argument, because an \Macro\adjustbox without options
% would not make sense and can be replaced by a simple \Macro\mbox.
% As already stated the content is read as a box, not as a macro argument, therefore verbatim or other special
% content is supported and the braces can also be replaced by \Macro\bgroup and \Macro\egroup.
% There is no starred version of this macro.
%
% \DescribeEnv[<content>]{adjustbox}{<key=value, \ldots>}
% The environment version of \Macro\adjustbox. A difference to the macro is that it includes \Macro\noindent
% to suppress paragraph indention.
%
% \Needspace*{5\baselineskip}
% \clearpage\subsection{Adjust Images}
% \vskip-\lastskip
% \DescribeMacro\adjustimage{<key=value, \ldots>}{<image filename>}
% This macro can be used as an extension of \Macro\includegraphics.
% While \Macro\adjustbox is based on the same interface as \Macro\includegraphics it provides more keys and allows
% global keys set by \Macro\adjustboxset. Most keys can be exported to \Macro\includegraphics using the \opt{export}
% option, but there is no support for global keys\footnote{However some keys, but not all, can be set globally using
% \Macro\setkeys{Gin}{<includegraphic key=value pairs>}}.  Therefore it can make sense to use
% \Macro\adjustbox{<key/value pairs>}{\AlsoMacro\includegraphics{<filename>}}, which is the definition of
% \Macro\adjustimage.
% However, it does not use \Macro\includegraphics directly, but an internal macro, to allow the redefinition of
% \Macro\includegraphics.
% This macro does not require the \opt{export} option and therefore helps to avoid option clashes
% if \pkg{adjustbox} is loaded at several places.
%
%
% \DescribeMacro\adjincludegraphics[<key/value pairs>]{<image filename>}
% Like \Macro\adjustimage but in the same format as \Macro\includegraphics, i.e.\ with an optional argument.  This macro
% allows to use all features of \Macro\adjustbox on images, however special care must be taken if the values include
% `|[ ]|'.  In this case either the whole value or the while optional argument must be wrapped in `|{ }|':
% \Macro\adjincludegraphics['key='{[..]},...]{..} or \\\Macro\adjincludegraphics[{key=[..],...}]{..}. \\
% It is possible to redefine \Macro\includegraphics to \Macro\adjincludegraphics and this is done by
% the \opt{Export} option (not to be confused with the \opt{export} option).
%
% ^^A )))2
% \clearpage\subsection{Defining custom environments and macros} ^^A (((2
% After \pkg{adjustbox} is used to define custom environments to format specific content.
% If an environment contains other environments these are often written in the plain form \Macro\foo \ldots
% \Macro\endfoo to avoid the overhead of \Macro\begin and \Macro\end and to keep the outer environment name for
% meaningful error messages. As mentioned, the dual nature of \Macro\adjustbox which will detect if it is used
% as environment of macro does not permit this plain form, which can be a pitfall for custom environment definitions.
% Instead the macro form \Macro\adjustbox{<key=value>}\AlsoMacro\bgroup \ldots \Macro\egroup should be used.
% To simplify custom environment definitions based on \Macro\adjustbox/\env{adjustbox} the following macros are
% provided.
%
%
% \DescribeMacro\newadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
% This declaration defines an environment and macro with the given name which will apply the given \pkg{adjustbox} keys
% to its content. The environment/macro can also posses arguments, including one leading optional argument, which can be
% used inside the key=value pairs. It is recommended to wrap the arguments into braces, e.g.\ use `|{#1}|' instead of
% `|#1|' etc., to avoid issues with potentially included commas and equal signs.
% The number and type of arguments are defined using two optional arguments in the same
% way as for \Macro\newcommand and \Macro\newenvironment.
%
%
% \DescribeMacro\newadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
% This declaration works similar to the unstarred version but only defines an environment.
% This environment can therefore be used like any other normal \LaTeX\ environment, including in its plain
% form {\macrodescstyle\textbackslash\meta{name}} \ldots {\macrodescstyle{\textbackslash end\meta{name}}}.
%
%
% \DescribeMacro\renewadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
% \DescribeMacro\renewadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will redefine an existing macro/environment and cause an
% error if it was not yet defined.
%
%
% \DescribeMacro\provideadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
% \DescribeMacro\provideadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will define a macro/environment only if it does not exists
% yet.
%
%
% \DescribeMacro\declareadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
% \DescribeMacro\declareadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will always define a macro/environment even if it does already exist.
%
%
% \DescribeMacro\newadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% This declaration defines a macro which applies the given \pkg{adjustbox} keys to its content.
% As with \Macro\adjustbox the content is read as box, not as macro argument.
% The macro arguments (if any) are defined in the same way as with \Macro\newcommand.
% The arguments can then be used inside the key=value pairs. The number of arguments does not
% include the content.
% This declaration is intended if no environment form is required and is more efficient than the dual declaration.
%
% \begin{example}
%   \begin{examplecode}
%   \newadjustboxcmd{\frotate}[1]{rotate={#1},fbox}%
%   \frotate{30}{Text}
%   \end{examplecode}
% \end{example}
%
% \DescribeMacro\renewadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustboxcmd but will redefine an existing macro and cause an
% error if it was not yet defined.
%
%
% \DescribeMacro\provideadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustboxcmd but will define the macro only if it does not exist yet.
%
%
% \DescribeMacro\declareadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustboxcmd but will define the macro in any case even if it does exist yet.%
%
%
% \DescribeMacro\newadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% \DescribeMacro\renewadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% \DescribeMacro\provideadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% These macros allow to define new versions of \Macro\adjustimage with predefined key lists.
% The new define image macros can also have arguments which can be used in the predefined key list to
% substitude values or one or multiple keys.
%
% They work like \Macro\newcommand, \Macro\renewcommand and \Macro\providecommand, respectively, where
% \meta{num} is the number of arguments and \meta{default} provides a default value for the then optional
% first argument. However, instead of a macro content a \meta{key=value} list must be present, which can
% contain the arguments (|#1|, |#2|, etc). If arguments are used as values they should be wrapped in braces.
% If there are only part of a value the whole value should be wrapped in braces. This is to avoid causes commas
% inside the arguments to cause issues with the key=value list.
%
% \begin{example}
%   \begin{examplecode}
%   \newadjustimage{\myimage}[2][red]{width={#2},cfbox={#1}}%
%   \myimage{2cm}{example-image}
%   \myimage[blue]{2cm}{example-image}
%   \end{examplecode}
% \end{example}
%
% \DescribeMacro\declareadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
% Like \Macro\newadjustimage but will not cause an error if the macro is already defined.
%
%
% \DescribeMacro\NewAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
% \DescribeMacro\RenewAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
% \DescribeMacro\ProvideAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
% \DescribeMacro\DeclareAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
% These macros also allow to define new versions of \Macro\adjustimage with predefined key lists, but use
% the \pkg{xparse} package (which must be loaded separately!) and its macros \Macro\NewDocumentCommand, \Macro\RenewDocumentCommand,
% \Macro\ProvideDocumentCommand and \Macro\DeclareDocumentCommand instead of the standard \LaTeX\ macro creation
% macros. This allows a larger variety of optional and mandatory arguments. Please see the \pkg{xparse} manual
% for more details.
%
% \begin{example}
%   \begin{examplecode}
%   \NewAdjustImage{\myimage}{O{red}m}{width={#2},cfbox={#1}}%
%   \myimage{2cm}{example-image}
%   \myimage[blue]{2cm}{example-image}
%   \end{examplecode}
% \end{example}
%
%
% ^^A )))2
% \clearpage\subsection{Setting keys globally} ^^A (((2
% \vskip-\lastskip
% \DescribeMacro\adjustboxset{<global keys to be executed \emph{before} local keys>}
% \DescribeMacro\adjustboxset*{<global keys to be executed \emph{after} local keys>}
% Using these two macros all keys can be set globally, i.e.\ for all future \Macro\adjustbox macros and \env{adjustbox}
% environments.  Note that these settings are actually \emph{local} to the current \TeX\ group and only really global if
% used in the preamble or outside any group.  The normal macro will place all given keys before the keys used in first
% argument of \Macro\adjustbox\ / \env{adjustbox}, while the starred version will place them afterwards.
%
% If these macros are used several times there keys are accumulated. This happens in the given order for the normal
% version and in reversed order for the starred version, i.e.\ the keys of further \Macro\adjustboxset or
% \Macro\adjustboxset* are always added so they face inwards.  If used without any keys but an empty argument, all keys
% previously set with the same macro are removed (from the current \TeX\ scope).  This means \Macro\adjustboxset{}
% clears all keys set be previously usages of \Macro\adjustboxset{<keys>} and \Macro\adjustboxset*{} clears all set by
% \Macro\adjustboxset*{<keys>}.  Such resets are again local to the current \TeX\ group.
%
%
% \begin{examples}
% The macros:
% \begin{macroquote}
% \adjustboxset{keya=1} \\
% \adjustboxset*{keyc=3}\\
% \adjustbox{keyb=2}{content}
% \end{macroquote}
% are effectively the same as:
% \begin{macroquote}
% \adjustbox{keya=1,keyb=2,keyc=3}{content}
% \end{macroquote}
% \par\medskip\noindent
% The macros:
% \begin{macroquote}
% \adjustboxset{keya=1,keyb=2} \\
% \adjustboxset{keyc=3,keyd=4} \\
% \adjustboxset*{keyg=7,keyh=8}\\
% \adjustboxset*{keyi=9,keyj=10}\\
% \adjustbox{keye=5,keyf=6}{content}
% \end{macroquote}
% are effectively the same as:
% \begin{codequote}
%   \AlsoMacro\adjustbox'{keya=1,keyb=2,keyc=3,keyd=4,keye=5,keyf=6,'\\
%            !\hskip0pt!'            keyi=9,keyj=10,keyg=7,keyh=8}'{content}
% \end{codequote}
% \end{examples}
%
% ^^A )))2
% \clearpage\subsection{Argument Values}\label{sec:argval} ^^A (((2
% All length values given in the arguments of all macros and keys provided by this package are parsed
% by and advanced version of \Macro\setlength\relax (called \Macro\adjsetlength) which uses either $\epsilon$-\TeX\
% expressions (default), the \pkg{calc} package (default fall-back) or the \Macro\pgfmathparse of the \pkg{pgf} package.
% This allows for arithmetic expressions in these arguments. See the package options in \autoref{sec:options} to learn
% how to change the used length parser.  Note that early versions of this package used \Macro\pgfmathparse by default.
% Older documents therefore might need now use the \opt{pgfmath} option to compile correctly.
%
% Note that the four values for \Macro\trimbox and \Macro\clipbox as well as for the
% \Key{trim} and \Key{viewport} option of \Macro\adjustbox are separated by spaces. If the expression of any of this
% values holds a space or ends with a macro (eats trailing spaces!) it must be wrapped into braces "{ }".
%
%
% \DescribeMacros
%    \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}%
% \endDescribeMacros
% These \LaTeX{} lengths hold the current dimensions of the content and can be used as part all length arguments.  When
% the size of the content is changed by a key these lengths will be adjusted to hold the new size for all further keys.
% The totalheight is the height plus depth. With the \pkg{patch} option these lengths can also be used for
% \Macro\includegraphics.
%
% \DescribeMacros
%    \hbox{\Macro\Width~~~\Macro\Height~~~\Macro\Depth~~~\Macro\Totalheight}%
% \endDescribeMacros
% These \LaTeX{} lengths hold the original dimension of original unchanged content and are not modified.  They are
% useful if the size of the content is modified by several keys, but further keys should still work relative to the
% original content.
%
%
% \DescribeMacro\smallestside
% This macro expands to either \Macro\width or \Macro\totalheight whatever is smaller.
%
% \DescribeMacro\largestside
% This macro expands to either \Macro\width or \Macro\totalheight whatever is larger.
%
% \DescribeMacro\Smallestside
% This macro expands to either \Macro\Width or \Macro\Totalheight whatever is smaller.
%
% \DescribeMacro\Largestside
% This macro expands to either \Macro\Width or \Macro\Totalheight whatever is larger.
%
%
% \subsubsection*{Default unit}
% If no unit is provided for of the bounding box coordinates (left, bottom, right, top) in the trim and clip features then
% PostScript points (\emph{big points}, bp, $72\,\text{bp}=1\,\text{inch}$) are used, as it is the default behaviour of
% the \Key{trim} and \Key{viewport} options of \pkg{graphicx}'s \Macro\includegraphics. Note that \pkg{graphicx}
% converts all values, independent if a unit is provided or not, internally to bp, because graphics where traditionally
% stored in Encapsulated PostScript (EPS) files. The more modern PDF files also use bp instead of pt.  Because the
% \pkg{adjustbox} package macros target \LATeX{} material and users will mostly use pt values this internal conversion
% to bp got disabled for them to avoid unnecessary rounding errors. Since v0.5 the default unit can be changed using the
% |defaultunit|\MacroArgs'='<unit>\relax key (which is also usable as global package option).
%
% ^^A )))2
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \clearpage\section{Adjustbox Keys} ^^A (((
% This packages provides the following \Macro\adjustbox keys with matching macros and environments.
%
%
% \subsection{Trimming and Clipping} ^^A (((2
% The following keys allow content to be trimmed (i.e.\ the official size is made smaller, so the remaining material
% laps over the official boundaries) or clipped (overlapping material is not displayed).
% These keys come in different variants, where the lower-case keys represent the behavior of
% the corresponding \Macro\includegraphics keys. The corresponding macros (\Macro\trimbox, \Macro\clipbox, etc.)
% and environments (\env{trimbox}, \env{clipbox}, etc.) are included in the
% accompanying \pkg{trimclip} package and are explained in its manual.
%
% \DescribeKey{trim}'='<all sites>
% \DescribeKey{trim}'='<left/right>~<top/bottom>
% \DescribeKey{trim}'='<left>~<bottom>~<right>~<top>
% This key represents the original \Key{trim} key of \Macro\includegraphics but accepts its value in different forms.
% Unlike most other keys it always acts on the original content independent in which order it is used with other keys.
% If only one value is given it will be used for all four sites.
% If only two values are given, seperated by a space, the first one will be used for the left and right side and the second for the
% bottom and top side.
%
%
% \DescribeKey{viewport}'='<left>~<bottom>~<right>~<top>
% This key represents the original \Key{viewport} key of \Macro\includegraphics.
% It always trims the original content to the given view port independent from its position.
%
% \DescribeKey{clip}
% \DescribeKey{clip}'=true|false'
% This boolean key represents the original \Key{clip} key of \Macro\includegraphics.
% It is intended to be used to make \Key{trim} or \Key{viewport} clip the trimmed material.
% Note that the material will still be part of the output file but is simply not shown.
% It might be exported from the output file using special tools, so using it to censor classified information is a
% bad idea.
%
%
% \DescribeKey{Trim}'='<all sites>
% \DescribeKey{Trim}'='<left/right>~<top/bottom>
% \DescribeKey{Trim}'='<left>~<bottom>~<right>~<top>
% \DescribeKey{Viewport}'='<left>~<bottom>~<right>~<top>
% The normal \Key{trim} and \Key{viewport} keys are applied on the original content before any resizing or (most) other
% keys take effect.  This is because for \Macro\includegraphics the trimming is done by the internal graphic driver,
% while the effects can be applied later (but can also be driver dependent).
% If the \Key{trim} and \Key{viewport} keys are used multiple times only the last values will be used for the trimming,
% i.e. the content is only trimmed once. The upper case variants \Key{Trim} and \Key{Viewport} will wrap the content
% internally in a \Macro\trimbox or \Macro\trimbox*\relax macro which can be applied multiple times, e.g.\ before and
% after the content is rotated.  These two keys awaits the same format as the original keys. However, the \Key{clip} key
% has no effect on them.
%
%
% \DescribeKey{Clip}'='<all sites>
% \DescribeKey{Clip}'='<left/right>~<top/bottom>
% \DescribeKey{Clip}'='<left>~<bottom>~<right>~<top>
% \DescribeKey{Clip*}'='<left>~<bottom>~<right>~<top>
% The \Key{Clip} key will clip the given amounts from the current content and can be used several times if required.
% The starred version will use the given coordinates as \Key{viewport}.
% These keys work by wrapping the content internally in a \Macro\clipbox or \Macro\clipbox*\relax macro.
%
%
% \DescribeKey{rndcorners}'='<radius for all four corners>
% \DescribeKey{rndcorners}'='<left corners>~<right corners>
% \DescribeKey{rndcorners}'='<upper left>~<upper right>~<lower left>~<lower right>
% This key produces round corners by clipping the content. This is done using the same way as the
% above clipping keys but instead of a rectangle clipping path one with quarter circles is used.
% The radius of the every round corner can be given separately if wanted. If only one value is given
% it is used for all four corners. If only two values are given they will be used for the left and right side, respectively.
% A value of 0pt will produce a normal rectangular corner.
% No radius should be larger than half the smallest side (minimum of \Macro\width and \Macro\totalheight).
%
% Please see also the related keys \Key{rndfbox} and \Key{rndframe}, which allow to add a rounded frame around the content as well.
%
%
% ^^A )))2
% \clearpage\subsection{Margins and Vertical Spacing} ^^A (((2
% \vspace{-\baselineskip}
%
% \DescribeKey{margin}'='<all sites>
% \DescribeKey{margin}'='<left/right>~<top/bottom>
% \DescribeKey{margin}'='<left>~<bottom>~<right>~<top>
% This key can be used to add a margin (white space) around the content. It can be seen as the opposite of \Key{Trim}.
% The original baseline of the content is preserved because \meta{bottom} is added to the depth.
% It is also available under the alternative name \Key{padding}, which can be used to more visually distinguish an inner
% margin from an outer margin e.g.\ if a frame is added.
%
% \begin{example}
%   \begin{examplecode}
%   Before \adjustbox{padding=1ex 2ex 3ex 4ex,frame,margin=1ex 2ex 3ex 4ex}{Text} After
%   \end{examplecode}
% \end{example}
%
% \DescribeKey{margin*}'='<all sites>
% \DescribeKey{margin*}'='<left/right>~<top/bottom>
% \DescribeKey{margin*}'='<left>~<bottom>~<right>~<top>
% This starred version is almost identical to the normal \Key{margin} key, but also raises the content by the \MacroArgs<bottom>
% amount, so that the original depth is preserved instead of the original baseline.
% Note that while \Key{margin} is basically the opposite of \Key{Trim}, \Key{margin*} is not the opposite of \Key{Trim*}.
% Instead it also takes the same values as the unstarred key and not viewport values like \Key{Trim*}.
% An alternative name of \Key{margin*} is \Key{padding*}.
%
% \begin{example}
%   \begin{examplecode}
%   Before \adjustbox{padding*=1ex 2ex 3ex 4ex,frame,margin*=1ex 2ex 3ex 4ex}{Text} After
%   \end{examplecode}
% \end{example}
%
%
% \DescribeKey{vspace}'='<above/below>
% \DescribeKey{vspace}'='<above>~<below>
% The \Key{vspace} key adds a vertical space before and after the content.
% This is done by adding paragraph breaks and \Macro\vspace macros, which will yield better spacing between
% paragraphs then when using the \Key{margin} key.
% However \Key{vspace} forces vertical mode around the content. Adding further keys after \Key{vspace} will force
% restricted horizontal mode again and the vertical space will be ignored. For this situation the \Key{margin} key is
% better suited.
%
% \DescribeKey{vspace*}'='<above/below>
% \DescribeKey{vspace*}'='<above>~<below>
% Identical to \Key{vspace} but uses \Macro\vspace'*' instead.
% The difference is that the vertical space is not ignored at page breaks, but its full amount is always forced.
%
%
% ^^A )))2
% \clearpage\subsection{Minimum and Maximum Size} ^^A (((2
% The following keys allow to set a minimum or maximum size.
% The content will be scaled down or up if required.
%
%
% \DescribeKey{min width}'='<width>
% \DescribeKey{max width}'='<width>
% \DescribeKey{min height}'='<height>
% \DescribeKey{max height}'='<height>
% \DescribeKey{min totalheight}'='<total height>
% \DescribeKey{max totalheight}'='<total height>
% These keys allow to set the minimum and maximum width, height or totalheight of the content.
% The current size of the content is measured and the content is resized if the constraint is not already met,
% otherwise the content is unchanged. Multiple usages of these keys are checked one after each other, and therefore
% it is possible that a later one is undoing the size changes of an earlier one.
% A good example is \Key{max width}'='\AlsoMacro\textwidth which will limit large content to the text width but will not affect smaller
% content.
%
% \DescribeKey{min size}'='{<width>}{<height>}
% \DescribeKey{max size}'='{<width>}{<height>}
% \DescribeKey{min totalsize}'='{<width>}{<total height>}
% \DescribeKey{max totalsize}'='{<width>}{<total height>}
% These keys allow to specify the minimum or maximum width and (total)height of the content together,
% which is more efficient than using the width and (total)height keys described earlier.
%
%
%
% \DescribeMacro\minsizebox{<width>}{<height>}{<content>}
% \DescribeMacro\minsizebox'*'{<width>}{<totalheight>}{<content>}
% This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is smaller
% than the given \meta{width} or \meta{height}.
% If only one value should be set the other one can be replaced by "!".
% If required the content is scaled up so that the width and height is equal or larger than the given values, but does not change
% the aspect ratio.
% The star variant uses the total height instead of only the height.
% This macro is used internally for the \Key{min width}, \Key{min height}, \Key{min totalheight} and \Key{min totalsize} keys.
%
% \begin{examples}
%   \begin{examplecode}
%   \minsizebox{3cm}{2ex}{Some Text} which will be enlarged
%   \end{examplecode}
%   \begin{examplecode}
%   \minsizebox{!}{4ex}{\fbox{Some Text}} which will be enlarged
%   \end{examplecode}
%   \begin{examplecode}
%   \minsizebox*{!}{4ex}{\fbox{Some Text}} which will be enlarged
%   \end{examplecode}
%   \begin{examplecode}
%   \minsizebox{3cm}{!}{Some Text} which will be enlarged
%   \end{examplecode}
%   \begin{examplecode}
%   \minsizebox{1cm}{1ex}{Some Text}, already large enough
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeMacro\maxsizebox{<width>}{<height>}{<content>}
% \DescribeMacro\maxsizebox'*'{<width>}{<totalheight>}{<content>}
% This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is larger
% than the given \meta{width} or \meta{height}.
% If only one value should be set the other one can be replaced by "!".
% If required the content is scaled down so that the width and height is equal or smaller than the given values, but does not change
% the aspect ratio.
% The star variant uses the total height instead of only the height.
% This macro is used internally for the \Key{max width}, \Key{max height}, \Key{max totalheight} and \Key{max totalsize} keys.
%
% \begin{examples}
%   \begin{examplecode}
%   \maxsizebox{1cm}{1ex}{Some Text} which will be reduced
%   \end{examplecode}
%   \begin{examplecode}
%   \maxsizebox{!}{1ex}{\fbox{Some Text}} which will be reduced
%   \end{examplecode}
%   \begin{examplecode}
%   \maxsizebox*{!}{1ex}{\fbox{Some Text}} which will be reduced
%   \end{examplecode}
%   \begin{examplecode}
%   \maxsizebox{1cm}{!}{Some Text} which will be reduced
%   \end{examplecode}
%   \begin{examplecode}
%   \maxsizebox{3cm}{1cm}{Some Text}, already small enough
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{warn width}
% \DescribeKey{warn width}=<max width>
% If this key is used the current width of the content is measured and compared with the given maximum width (default is
% \Macro\linewidth).
% If the content is wider than this value by more than the \TeX\ length \Macro\hfuzz\relax (by default 0.1pt)
% an \emph{Overfull hbox} warning is produced.
% The warning will include the source code position and the information that it was an |adjustbox| not a normal
% paragraph:
% \par\smallskip\par
% {\ttfamily Overfull |\hbox| (X.Ypt too wide) in adjustbox at line N}
%
% {\ttfamily Overfull |\hbox| (X.Ypt too wide) in adjustbox at lines N-M}
% \par\smallskip\par\noindent
% Note that this key is not able to take any horizontal space before the |adjustbox|
% into account. This includes a paragraph indention which might be present with \Macro\adjustbox.
%
% This key is useful to be used before the horizontal alignment keys which change the official width of the content
% and prevent the normal \emph{Overfull} warnings to take affect.
%
%
% ^^A )))2
% \Needspace*{8\baselineskip}
% \clearpage\subsection{Scaling} ^^A (((2
% \vspace{-\baselineskip}
%
% \DescribeKey{scale}'='<factor>
% \DescribeKey{scale}'='{<h-factor>}{<v-factor>}
% The normal \Key{scale} key of \pkg{graphicx} only allows for one scale factor which is used for both the horizontal and vertical scaling.
% With \pkg{adjustbox} it is also possible to provide the horizontal and vertical scale factors separately.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{scale=2}{Some text!}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{scale={2}{1}}{Some text!}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{reflect}
% This key reflects the content by using \Macro\reflectbox internally, which is identical to \Macro\scalebox{-1}[1],
% i.e.\ this key is identical to \Key{scale}'='{-1}{1}.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{reflect}{Some text!}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeMacro\scalebox{<h-factor>}[<v-factor>]{<content>}
% \DescribeMacro\reflectbox{<content>}
% These macros is provided by the loaded \pkg{graphicx} package and only mentioned here for the sake of completeness.
% See the |grfguide| for more details.
%
%
% ^^A )))2
% \clearpage\subsection{Frame} ^^A (((2
% The following keys can be used to draw frames around the content.
%
% \DescribeKey{fbox}
% \DescribeKey{fbox}'='<rule width>
% \DescribeKey{fbox}'='<rule width>~<sep>
% \DescribeKey{fbox}'='<rule width>~<sep>~<margin>
% Draws a framed box around the content like \Macro\fbox would do.
% Using the optional space separated values the rule width, the separation (inner padding) and the outer margin can be set.
% If not they default to the values \Macro\fbox uses by default: \Macro\fboxrule, \Macro\fboxsep and zero margin.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{fbox}{Like \cs{fbox}}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{fbox=1pt}{With 1pt rule width}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{fbox=1pt 2pt}{With 1pt rule width and 2pt separation}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{fbox={\fboxrule} 1pt}{With normal rule width and 1pt separation}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{fbox=1pt 1pt 1pt}{With 1pt for rule width, separation and outer margin}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{frame}
% \DescribeKey{frame}'='<rule width>
% \DescribeKey{frame}'='<rule width>~<sep>
% \DescribeKey{frame}'='<rule width>~<sep>~<margin>
% The \Key{frame} key has the same effect as the \Key{fbox} key but is modeled after \LaTeX's \Macro\frame macro (not the version \cls{beamer} defines).
% This means it adds a tight frame with zero separation around the content by default. Besides that it accepts the same space separated values.
% This key is useful to easily add a tight frame around images where the normal separation wouldn't fit.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{frame}{Tight box}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{cfbox}'='<color>
% \DescribeKey{cfbox}'='<color>~<rule width>
% \DescribeKey{cfbox}'='<color>~<rule width>~<sep>
% \DescribeKey{cfbox}'='<color>~<rule width>~<sep>~<margin>
% Identical to \Key{fbox} but uses the given color for the frame.
% The \pkg{xcolor} package must be loaded manually in order for this key to work.
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{cfbox=blue 1pt}{Like a blue \cs{fbox} with \cs{fboxrule}=1pt}
%   \end{examplecode}
% \end{example}
%
%
% \DescribeKey{cframe}'='<color>
% \DescribeKey{cframe}'='<color>~<rule width>
% \DescribeKey{cframe}'='<color>~<rule width>~<sep>
% \DescribeKey{cframe}'='<color>~<rule width>~<sep>~<margin>
% Identical to \Key{frame} but uses the given color for the frame.
% The \pkg{xcolor} package must be loaded manually in order for this key to work.
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{cframe=blue!50!green}
%       {Like a blue and green \cs{frame}}
%   \end{examplecode}
% \end{example}
%
%
% \DescribeKey{rndframe}'='<radius for all four corners>
% \DescribeKey{rndframe}'='<left corners>~<right corners>
% \DescribeKey{rndframe}'='<upper left>~<upper right>~<lower left>~<lower right>
% \DescribeKey{rndframe}'='{<options>}{<radius for all four corners>}
% \DescribeKey{rndframe}'='{<options>}{<left corners>~<right corners>}
% \DescribeKey{rndframe}'='{<options>}{<upper left>~<upper right>~<lower left>~<lower right>}
%
% \begingroup
% \colorlet{keydesc}{keydesc!50!green}
% \DescribeKey{color}'='{<color>}
% \DescribeKey{color*}'='{<color command>}
% \DescribeKey{width}'='{<rule width>}
% \DescribeKey{sep}'='{<rule separation>}
%
% \DescribeKey{clip}
% \DescribeKey{clip}'=true|false'
% \endgroup
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{scale=3,bgcolor=gray,rndframe={color=red,width=2\fboxrule,sep=2\fboxsep}{15pt}}
%       {\Huge XXXX}%
%   \end{examplecode}
% \end{example}
%
% \DescribeKey{rndcornersbox}
% Like \Key{rndframe} (see argument list there) but only clips the corners without drawing a frame.
%
% \DescribeKey{rndfbox}
% Like \Key{rndframe} (see argument list there) but with preset
% \begingroup
% \colorlet{keydesc}{keydesc!50!green}
% \Key{sep}'='0pt.
% \endgroup
%
% \DescribeMacro\rndcornersbox
% \DescribeMacro\rndframebox
% \DescribeMacro\rndfbox
% Standalone macro versions of the corresponding keys. See there for the list of arguments.
%
% ^^A )))2
% \clearpage\subsection{Vertical Alignment} ^^A (((2
% The following keys can be used to adjust the vertical alignment and size of the content.
%
% \DescribeKey{valign}'='<letter>
% This key allows to vertically align the content to the top, middle and bottom.  The uppercase letters |T|, |M| and |B|
% align to the content top (i.e. all depth, no height), the geometric, vertical center (equal height and depth) and to
% the bottom (all height, no depth), respectively.  This allows the alignment of content of different size, but will not
% result in good alignment with text.  The lowercase letters |t|, |m| and |b| are aligning the content again to the top,
% center and bottom but take the current text size in account.
% The |t| letter leaves a certain height given by the macro\footnote{A macro and not a length is used to allow for
% font size relative values like \texttt{1ex}.} \Macro\adjboxvtop\relax
% (by default set to the height of \Macro\strut\relax, i.e.\ |\ht\strutbox|, which is |.7\baselineskip|),
% while |b| sets a certain depth given (as negative length) by the macro \Macro\adjboxvbottom\relax
% (by default equal to the (negated) \Macro\strut depth, i.e.\ |-\dp\strutbox|, which is |.3\baselineskip|).
% The |m| letter will center towards the vertical center of the text line which is determined by the macro
% \Macro\adjboxvcenter\relax (by default \texttt{1ex}).
%
% The following table shows the different alignments for three different sized blocks:
%
% \bigskip
% \begingroup
% \def\vr{%
%     \unskip
%     \tikz [gray] {\useasboundingbox (0,0);
%       \draw (-13.5em,0) -- (2.25em,0);
%       \draw (-13.5em,\adjboxvcenter) -- (2.25em,\adjboxvcenter);
%     }%
%     \unskip\ignorespaces
% }%
% \centerline{%
% \begin{tabular}{cccm{2em}}
%  \toprule
%   \texttt{T} & \texttt{M} & \texttt{B} & Text \\
%   \adjustbox{valign=T}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
%   \adjustbox{valign=T}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
%   \adjustbox{valign=T}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
%   \adjustbox{valign=M}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
%   \adjustbox{valign=M}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
%   \adjustbox{valign=M}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
%   \adjustbox{valign=B}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
%   \adjustbox{valign=B}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
%   \adjustbox{valign=B}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
%   Mxy \newline \mbox{\vr Mxy}\newline Mxy \\
%  \midrule
%   \texttt{t} & \texttt{m} & \texttt{b} & Text \\
%   \adjustbox{valign=t}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
%   \adjustbox{valign=t}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
%   \adjustbox{valign=t}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
%   \adjustbox{valign=m}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
%   \adjustbox{valign=m}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
%   \adjustbox{valign=m}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
%   \adjustbox{valign=b}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
%   \adjustbox{valign=b}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
%   \adjustbox{valign=b}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
%   Mxy \newline \mbox{\vr Mxy}\newline Mxy \\
%  \bottomrule
% \end{tabular}}
% \endgroup
%
%
% \DescribeKey{raise}'='<amount>
% \DescribeKey{raise}'='{<amount>}{<height>}
% \DescribeKey{raise}'='{<amount>}{<height>}{<depth>}
% This key uses
% \Macro\raisebox{<amount>}{\ldots} to raise the content upwards for the given \meta{amount} (length).
% A negative length moves the content down.
% The two optional arguments of \Macro\raisebox{<amount>}[<height>][<depth>]{\ldots}\relax are also available
% as optional brace arguments. They can be used to set the official height and depth of the content.
% This is also possible using the \Key{set height} and \Key{set depth} keys.
%
% \begin{examples}
%   \begin{examplecode}
%   Is \adjustbox{raise=1ex}{higher}
%   than the normal text
%   \end{examplecode}
%   \begin{examplecode}
%   Is \adjustbox{raise={1ex}{\height}}{higher}
%   than the normal text but sill has
%   its original official height
%   \end{examplecode}
%   \begin{examplecode}
%   Is \adjustbox{raise={1ex}{1ex}{0pt}}{higher and
%   \rotatebox{-90}{deeper}} but with limited official
%   height and no depth.
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{set height}'='<height>
% This sets the official height of the content without actual changing it. This can be seen as a form of trimming.
% It uses the same internal code as\\
% \Macro\raisebox{'0pt'}[<height>]{<content>}.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{set height=.5\height}
%       {\shortstack{some stacked\\content}}
%   \end{examplecode}
% \end{example}
%
% \DescribeKey{set depth}'='<depth>
% This sets the official depth of the content without actual changing it. This can be seen as a form of trimming.
% It uses the same internal code as\\
% \Macro\raisebox{'0pt'}['\height'][<depth>]{<content>}.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{set depth=0pt}
%       {\shortstack{some stacked\\content
%       with \raisebox{-1ex}{depth}}}
%   \end{examplecode}
% \end{example}
%
% \DescribeKey{set vsize}'='{<height>}{<depth>}
% This sets the official height of depth of the content without actual changing it.
% This key is simply the combination of \Key{set height} and \Key{set depth}.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{set vsize={2pt}{1pt}}
%       {\shortstack{some stacked\\content
%       with \raisebox{-1ex}{depth}}}
%   \end{examplecode}
% \end{example}
%
%
% ^^A )))2
% \clearpage\subsection{Horizontal Alignment} ^^A (((2
% The following keys can be used to adjust the horizontal alignment and size of the content.
%
% \DescribeKey{center}
% \DescribeKey{center}'='<width>
% This key places
% the content in a horizontal box which is by default \Macro\linewidth wide (i.e.\ as wide as a normal text paragraph)
% and centers it in it. The effect is very similar to \Macro\centerline. The original content is unchanged, but simply identical
% white space is added as a left and right margin. This is useful if the content is a figure or table and can be used as a replacement
% for \Macro\centering. One important difference is that the content will then have the given width which might influence (sub-)caption
% placement.
% If the content is wider than the available width it will stick out on both sides equally without causing an overfull hbox warning.
% Note that when \Macro\adjustbox paragraph is used at the beginning of a paragraph the normal paragraph indention is added, which
% will push the while box to the right and might cause an overfull line. In such cases a \Macro\noindent must be added beforehand.
% The \env{adjustbox} environment already uses this macro.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{center}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{center=5cm}{Some content}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{right}
% \DescribeKey{right}'='<width>
% Like \Key{center} this key
% places the content in a box with the given width (by default \Macro\linewidth) but right aligns it.
% If the content is wider than the available width it will stick out into the left side without causing an overfull hbox warning.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{right}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{right=5cm}{Some content}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{left}
% \DescribeKey{left}'='<width>
% Like \Key{center} this key
% places the content in a box with the given width (by default \Macro\linewidth) but left aligns it.
% If the content is wider than the available width it will stick out into the right side without causing an overfull hbox warning.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{left}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{left=5cm}{Some content}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{inner}
% \DescribeKey{inner}'='<width>
% Like \Key{center}, \Key{left} and \Key{right} this key
% places the content in a box with the given width (by default \Macro\linewidth) but aligns it towards the inner margin.
% If the content is wider than the available width it will stick into the outer margin without causing an overfull hbox warning.
% In |twoside| mode this key is equal to \Key{left} for odd pages and equal to \Key{right} for even pages.
% For |oneside| mode it is equal to \Key{left}.
% Note that the page-is-odd test might not always lead to correct results for some material close to a page boundary, because \TeX\
% might not have decided on which page it will be placed. This can be improved by loading the \pkg{changepage} package with the
% \opt{strict} option, which uses a reference to determine the correct page number (and requires the usual additional compiler run).
%
%
% \DescribeKey{outer}
% \DescribeKey{outer}'='<width>
% Identical to \Key{inner} but aligns the content towards the outer margin.
% For |oneside| mode it is equal to \Key{right}.
% If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning.
%
%
% \DescribeKey{pagecenter}
% \DescribeKey{pagecenter}'='<width>
% This key centers the content relative to the page and independent from the text area. Afterwards the content has the same distance to the
% left and right page borders. It differs from the \Key{center} key when the left and right page margins are different which is the case in
% |twoside| documents or in environments which change the margins.
%
% Note that the content will look misalign to the text paragraphs before and afterwards and is therefore only
% pleasing for overwide images or similar content.
%
% The optional width defaults to \Macro\linewidth and determines the official width of the content. If a smaller value is selected
% following material will be placed on the same line while maybe overlapping the content.
% Larger values will cause an |Overfull \hbox| warning.
%
% \DescribeKey{pageleftalign}
% \DescribeKey{pageleftalign}'='<width>
% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the left side of the page instead of centering it.
%
% \DescribeKey{pagerightalign}
% \DescribeKey{pagerightalign}'='<width>
% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the left side of the page instead of centering it.
%
% \DescribeKey{pageinner}
% \DescribeKey{pageinner}'='<width>
% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the inner side of the page instead of centering it.
% This assumes that the document is compiled in |twoside| mode.
% In |oneside| mode the macro is identical to \Key{pageleftalign}, i.e. always aligns to the left of the page.
%
% \DescribeKey{pageouter}
% \DescribeKey{pageouter}'='<width>
% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the outer side of the page instead of centering it.
% This assumes that the document is compiled in |twoside| mode.
% In |oneside| mode the macro is identical to \Key{pagerightalign}, i.e. always aligns to the right of the page.
%
%
% \DescribeKey{textareacenter}
% \DescribeKey{textareacenter}'='<width>
% This key centers the content on the text area (the box with size \Macro\textwidth$\times$\Macro\textheight containing the text on a page)
% even if the box is inside an indending environment like \env{enumerate}. For this it is assumed that the adjusted box is on the start
% of a line or paragraph. If this is not the case the content will be overlapping the material on its left side.
%
% The optional width defaults to \Macro\linewidth and determines the official width of the content. If a smaller value is selected
% following material will be placed on the same line while maybe overlapping the content.
% Larger values will cause an |Overfull \hbox| warning.%
%
%
% \DescribeKey{textareatalign}
% \DescribeKey{textareatalign}'='<width>
% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the left side of the text area instead of centering it.
%
% \DescribeKey{textareatalign}
% \DescribeKey{textareatalign}'='<width>
% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the left side of the text area instead of centering it.
%
% \DescribeKey{textareainner}
% \DescribeKey{textareainner}'='<width>
% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the inner side of the text area instead of centering it.
% This assumes that the document is compiled in |twoside| mode.
% In |oneside| mode the macro is identical to \Key{pageleftalign}, i.e. always aligns to the left of the text area.
%
% \DescribeKey{textareaouter}
% \DescribeKey{textareaouter}'='<width>
% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the outer side of the text area instead of centering it.
% This assumes that the document is compiled in |twoside| mode.
% In |oneside| mode the macro is identical to \Key{pagerightalign}, i.e. always aligns to the right of the text area.
%
%
%
% \DescribeKey{noindent}
% This key will issue an \Macro\noindent for the \Macro\adjustbox to avoid a paragraph indention if it starts a paragraph.
% It does not expect a value and will ignore it if provided.
%
%
% \DescribeKey{leavevmode}
% This key will issue an \Macro\leavevmode for the \Macro\adjustbox to enter paragraph mode, i.e.\ it starts a paragraph.
% This is usually done automatically by all Keys, but is provided as a failsafe in case of any bugs.
%
%
% \DescribeMacro\centerbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{centerbox}[<width>]
% Macro and environment version of the \Key{center} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
%
% \DescribeMacro\leftalignbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{leftalignbox}[<width>]
% Macro and environment version of the \Key{left} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
%
% \DescribeMacro\rightalignbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{rightalignbox}[<width>]
% Macro and environment version of the \Key{rightalign} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
%
% \DescribeMacro\innersidebox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{innersidebox}[<width>]
% Macro and environment version of the \Key{inner} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
%
% \DescribeMacro\outersidebox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{outersidebox}[<width>]
% Macro and environment version of the \Key{outer} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
%
% \DescribeMacro\centerpagebox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{centerpagebox}[<width>]
% Macro and environment version of the \Key{centerpage} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
%
% \DescribeMacro\pagecenterbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{pagecenterbox}[<width>]
% Macro and environment version of the \Key{pagecenterbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\pageleftalignbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{pageleftalignbox}[<width>]
% Macro and environment version of the \Key{pageleftalignbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\pagerightalignbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{pagerightalignbox}[<width>]
% Macro and environment version of the \Key{pagerightalignbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\pageinnerbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{pageinnerbox}[<width>]
% Macro and environment version of the \Key{pageinnerbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\pageouterbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{pageouterbox}[<width>]
% Macro and environment version of the \Key{pageouterbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\textareacenterbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{textareacenterbox}[<width>]
% Macro and environment version of the \Key{textareacenterbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\textareatalignbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{textareatalignbox}[<width>]
% Macro and environment version of the \Key{textareatalignbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\textareatalignbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{textareatalignbox}[<width>]
% Macro and environment version of the \Key{textareatalignbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\textareainnerbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{textareainnerbox}[<width>]
% Macro and environment version of the \Key{textareainnerbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \DescribeMacro\textareaouterbox[<width>]{<content>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{textareaouterbox}[<width>]
% Macro and environment version of the \Key{textareaouterbox} key. The optional width argument defaults to \Macro\linewidth.
% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
% placing a |\mbox{}| or the identical |\null| macro before it.
%
% \clearpage\subsection*{Lapping} ^^A (((3
% The following features can be used to make the content lap over its left or right boundary. This is basically the same
% as trimming, but provides a different, more dedicated interface.
%
%
% \DescribeKey{lap}'='<lap amount>
% \DescribeKey{lap}'='{<length>}{<lap amount>}
% This key will make the content lap over the surrounding elements to the right or left by the given amount..
% A positive amount will make the content lap over to the right
% and a negative one to the left. The optional \meta{length} argument allows to set the final width.
% If not used the resulting width will be the original width minus the absolute lap amount.
% This key internally uses \Macro\lapbox{<lap amount>}{\ldots} and \Macro\lapbox[<length>]{<lap amount>}{\ldots}, respectively.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{lap=.5\width}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{lap=-.5\width}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{lap=\width}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{lap=-\width}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{lap={\width}{\width}}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{lap={\width}{-\width}}{Some content}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{rlap}
% \DescribeKey{llap}
% \DescribeKey{clap}
% This makes the content to be officially 0pt wide and lap over to the right or left, respectively, like the \LaTeX\ macros \Macro\rlap, \Macro\llap and \Macro\clap do.
% These are shortcuts for \Key{lap}'='\AlsoMacro\width, \Key{lap}'=-'\AlsoMacro\width and \Key{lap}'={0pt}{-0.5'\AlsoMacro\width'}', respectively.
% The values for these keys are ignored and should not be used.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{rlap}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{llap}{Some content}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{clap}{Some content}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeMacro\lapbox[<width>]{<lap amount>}{<content>}
% This macro is a generalisation of the \LaTeX\ core macros \Macro\rlap{<content>} and \Macro\llap{<content>} which lap the
% text to the right or left without taking any official space. The \Macro\lapbox macro can be used to only partially lap
% the content to the right (positive amount) or left (negative amount). As with all macros of this package the original width
% can be references using \Macro\width. The resulting official width of the box is normally the original width minus the absolute
% lap amount. However, it can also be set explicitly using the option argument.
% It is also possible to use lap amount which absolute values are larger than the original width. In this case the resulting
% official width will be zero by default and the content will padded with the required white space.
% Note that the lap amount always states the distance between the right side of the official box and the right side of the actual
% content for positive amounts or the distance between the left side of the official box and the left side of the actual content
% for negative values.
%
% \begin{examples}
%   General lapping:
%   \begin{examplecode}
%   \lapbox{1cm}{Some Text}
%   \end{examplecode}
%   \vspace{-2\smallskipamount}%
%   \begin{examplecode}
%   \lapbox{-1cm}{Some Text}
%   \end{examplecode}
%   \vspace{-2\smallskipamount}%
%   \begin{examplecode}
%   \lapbox[4cm]{1cm}{Some Text}
%   \end{examplecode}
%   \vspace{-2\smallskipamount}%
%   \begin{examplecode}
%   \lapbox[3cm]{2cm}{Some Text}
%   \end{examplecode}
%   \vspace{\smallskipamount}%
%   Like \Macro\rlap:
%   \vspace{-\smallskipamount}%
%   \begin{examplecode}
%   \lapbox[0pt]{\width}{Some Text}
%   \end{examplecode}
%   \vspace{\smallskipamount}%
%   Like \Macro\llap:
%   \vspace{-\smallskipamount}%
%   \begin{examplecode}
%   \lapbox[0pt]{-\width}{Some Text}
%   \end{examplecode}
%   \vspace{\smallskipamount}%
%   A centering \Macro\clap macro can be achieved using:
%   \vspace{-\smallskipamount}%
%   \begin{examplecode}
%   \lapbox[0pt]{-.5\width}{Some Text}
%   \end{examplecode}
%   \vspace{-2\smallskipamount}%
%   \begin{examplecode}
%   \lapbox[0pt]{.5\width}{Some Text}
%   \end{examplecode}
%
% \end{examples}
%
%
% ^^A )))3
% ^^A )))2
% \clearpage\subsection{Support for \pkg{graphicx} keys} ^^A (((2
%
% \DescribeKey{bbllx}'='<length>
% \DescribeKey{bblly}'='<length>
% \DescribeKey{bburx}'='<length>
% \DescribeKey{bbury}'='<length>
% \DescribeKey{decodearray}
% \DescribeKey{intent}
% \DescribeKey{interpolate}
% \DescribeKey{maskarray}
% \DescribeKey{natheight}'='<length>
% \DescribeKey{natwidth}'='<length>
% \DescribeKey{ocobjnum}
% \DescribeKey{ocobjref}
% \DescribeKey{page}'='<page numbers>
% \DescribeKey{pagebox}
% \DescribeKey{quiet}
% \DescribeKey{resetcolor}
% \DescribeKey{resolution}
% \DescribeKey{xmpfile}
% The above \pkg{graphicx} keys are also supported by \cs{adjustbox}. This is done by relying on the original
% \pkg{graphicx} code, i.e. the key code is copied into the \pkg{adjustbox} namespace. These keys are therefore
% mostly for use with images and might not work well with other content.
% For more details on these keys see the \pkg{graphicx} manual.
%
% ^^A )))2
% \clearpage\subsection{Colors} ^^A (((2
% \vspace{-\baselineskip}
%
% \DescribeKey{color}'='<color>
% \DescribeKey{color}'='{<model>}{<color>}
% This key sets the color for all material. Both the content and further material added by other keys will be affected.
% The color change is immediate and will occur before basically every other key takes effect.
% The order in which this key is used is therefore meaningless.
% Using this key several times will cause several color changes with the last one be used for the remaining material.
% Note that \Key{color} will not influence any \Key{fgcolor} or \Key{bgcolor} beside the fact that it changes the
% \emph{current color} accessible using the special name `|.|'.
%
% \DescribeKey{color*}'='<color macro>
% Like \Key{color} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors.
% See the \pkg{xcolor} manual for more details. A \Macro\blendcolors will affect both \Key{fgcolor} and \Key{bgcolor}.
%
%
% \DescribeKey{fgcolor}'='<color>
% \DescribeKey{fgcolor}'='{<model>}{<color>}
% This key sets the color for the content.
% The value is passed to an internal \Macro\color macro.
% This is done using \Key{innercode} because the color must be set before the content is boxed.
% Further material added using keys, e.g.\ a \Key{frame}, is not affected by this key.
% The \pkg{xcolor} package (or \pkg{color} or \pkg{xxcolor}) needs to be loaded otherwise an error will be raised.
%
% \DescribeKey{fgcolor*}'='<color macro>
% Like \Key{fgcolor} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors.
% See the \pkg{xcolor} manual for more details.
%
%
% \DescribeKey{bgcolor}'='<color>
% \DescribeKey{bgcolor}'='{<model>}{<color>}
% This key adds a colored background to the content. The \pkg{xcolor} package (or \pkg{color} or \pkg{xxcolor}) needs to be loaded
% as well in order for this to work. The value is passed to an internal \Macro\color macro.
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{bgcolor=blue}{Text with blue background.}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{bgcolor={rgb}{0 0 1}}{Text with blue background in the RGB color model.}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{margin=1ex,bgcolor=green}{green with a little more margin}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{margin=1ex,bgcolor=green,margin=1pt,bgcolor=yellow}{Emulation of colored frame}
%   \end{examplecode}
% \end{examples}
%
% \DescribeKey{bgcolor*}'='<color macro>
% Like \Key{bgcolor} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors.
% See the \pkg{xcolor} manual for more details.
%
% \begin{examples}
%   \begin{examplecode}
%   \color{blue}Blue text
%   \adjustbox{bgcolor*=\blendcolors{!10!yellow}\color{.}}{with a yellow-bluish background}
%   \end{examplecode}
%   \begin{examplecode}
%   \color{green}Green text
%   \adjustbox{bgcolor*=\blendcolors{!10!yellow}\color{.}}{with a yellow-greenish background}
%   \end{examplecode}
% \end{examples}
%
% \DescribeMacro{\bgcolorbox}[<model>]{<color>}
% \DescribeMacro{\bgcolorbox}*{<color macro>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{bgcolorbox}[<model>]{<color>}
% \vspace{-1.5\baselineskip}\nopagebreak
% \DescribeEnv[<content>]{bgcolorbox*}{<color macro>}
% Standalone macro and environment versions of the \Key{bgcolorbox} and \Key{bgcolorbox*} keys.
%
%
%
% ^^A )))2
% \clearpage\subsection{Background and Forground Images and Text} ^^A (((2
% The following keys, macros and environment allow to add background and foreground layers.
% These layers are placed on the baseline of the original content and are horizontally centered, but can be adjusted
% using own \Macro\adjustbox or \Macro\includegraphics keys.
% The following dimension registers can be used to refer to the dimensions of the original content.
%
% \DescribeMacros
%    \hbox{\Macro\pwidth~~~\Macro\pheight~~~\Macro\pdepth~~~\Macro\ptotalheight}%
% \endDescribeMacros
% These dimension registers hold the width, height, depth and total height (height+depth) of the parent box and can be used
% to resize a background or foreground layer accordantly. They are only defined inside the key=value arguments of the
% following keys, macros and environments.
%
% \DescribeKey{bgimage}'='<image filename>
% \DescribeKey{bgimage}'='{<key=value pairs for image>}{<image filename>}
% Adds a background image to the content. The image is stretched if required to fit exactly to the content.
% It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the image (before the resizing is done).
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{bgimage=example-grid-100x100bp}{Some text}
%   \end{examplecode}
% \end{examples}
%
% \DescribeKey{bgimage*}'='<image filename>
% \DescribeKey{bgimage*}'='{<key=value pairs for image>}{<image filename>}
% Adds a background image to the content like \Key{bgimage} but the image is not stretched to fit the content.
% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
% The image is placed on the baseline of the content and horizontally centered. It can be lowered to the lower edge of
% the content using \Key{raise}'=-'\AlsoMacro\pdepth and left aligned using \Key{left}'='\AlsoMacro\pwidth etc.
%
% \DescribeMacro{\bgimagebox}[<key=value pairs>]{<image filename>}
% \DescribeMacro{\bgimagebox}*[<key=value pairs>]{<image filename>}
% \DescribeEnv[<content>]{bgimagebox}[<key=value pairs>]{<image filename>}
% \DescribeEnv[<content>]{bgimagebox*}[<key=value pairs>]{<image filename>}
% Standalone macro and environment versions of the \Key{bgimage} and \Key{bgimage*} keys.
%
%
% \DescribeKey{fgimage}'='<image filename>
% \DescribeKey{fgimage}'='{<key=value pairs for image>}{<image filename>}
% Adds a foreground image to the content. The image is stretched to fit exactly to the content.
% It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the image (before the resizing is done).
% The image is assumed to have transparent elements, otherwise the existing content is fully covered.
%
% \DescribeKey{fgimage*}'='<image filename>
% \DescribeKey{fgimage*}'='{<key=value pairs for image>}{<image filename>}
% Adds a foreground image to the content like \Key{fgimage} but the image is not stretched to fit the content.
% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
% The image is placed on the baseline of the content and horizontally centered.
%
% \DescribeMacro{\fgimagebox}[<key=value pairs>]{<image filename>}
% \DescribeMacro{\fgimagebox}*[<key=value pairs>]{<image filename>}
% \DescribeEnv[<content>]{fgimagebox}[<key=value pairs>]{<image filename>}
% \DescribeEnv[<content>]{fgimagebox*}[<key=value pairs>]{<image filename>}
% Standalone macro and environment versions of the \Key{fgimage} and \Key{fgimage*} keys.
%
%
%
% \DescribeKey{background}'='<background content>
% \DescribeKey{background}'='{<key=value pairs for image>}{<background content>}
% Adds the given content as background layer to the main content. The background content is stretched to fit the size of
% the main content.  It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the
% background content (before the resizing is done).
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{background={\color{red}xxx}}{Some text}
%   \end{examplecode}
% \end{examples}
%
% \DescribeKey{background*}'='<background content>
% \DescribeKey{background*}'='{<key=value pairs for image>}{<background content>}
% Like \Key{background} but does not resizes the background content.
% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
%
% \DescribeMacro{\backgroundbox}[<key=value pairs>]{<background content>}
% \DescribeMacro{\backgroundbox}*[<key=value pairs>]{<background content>}
% \DescribeEnv[<content>]{backgroundbox}[<key=value pairs>]{<background content>}
% \DescribeEnv[<content>]{backgroundbox*}[<key=value pairs>]{<background content>}
% Standalone macro and environment versions of the \Key{background} and \Key{background*} keys.
%
%
% \DescribeKey{foreground}'='<foreground content>
% \DescribeKey{foreground}'='{<key=value pairs for content>}{<foreground content>}
% Adds the given content as foreground layer to the main content. The foreground content is stretched to fit the size of
% the main content.  It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the
% foreground content (before the resizing is done).
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{foreground={\color{red}xxx}}{Some text}
%   \end{examplecode}
% \end{examples}
%
% \DescribeKey{foreground*}'='<foreground content>
% \DescribeKey{foreground*}'='{<key=value pairs for content>}{<foreground content>}
% Like \Key{foreground} but does not resizes the foreground content.
% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
%
% \DescribeMacro{\foregroundbox}[<key=value pairs>]{<foreground content>}
% \DescribeMacro{\foregroundbox}*[<key=value pairs>]{<foreground content>}
% \DescribeEnv[<content>]{foregroundbox}[<key=value pairs>]{<foreground content>}
% \DescribeEnv[<content>]{foregroundbox*}[<key=value pairs>]{<foreground content>}
% Standalone macro and environment versions of the \Key{foreground} and \Key{foreground*} keys.
%
%
%
% ^^A )))2
% \clearpage\subsection{Density / Pixel size} ^^A (((2
% The following keys allow to adjust the effective length of |pdftex| special |px| (pixel) unit.
% This can be required for images which do not have the correct DPI meta-data included.
%
%
% \DescribeKey{dpi}'='<number (dots per inch)>
% The \Key{dpi} key provides a simple interface to set the pixel size to the given DPI (dots per inch) value.
% For |pdflatex| the length unit |px| can be used to specify pixels. However, the equivalent dimension (length) of one pixel must be
% set using the \Macro\pdfpxdimen length register. To set a specific DPI value this length must be set using
% \Macro\setlength\AlsoMacro\pdfpxdimen{'1in/'<dots>}, which is done by the \Key{dpi}'='<dots> key.
% Note that the key won't affect the setting for the content but only for the further used keys.
% However, it is possible to use \Macro\setkeys{adjbox}{'dpi='<number>} inside the content or anywhere else in the document to
% set \Macro\pdfpxdimen using this interface.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{dpi=72,trim=10px,frame}{%
%       \setkeys{adjbox}{dpi=72}%
%       \textcolor{green}{\rule{50px}{50px}}%
%   }
%   \end{examplecode}
% \end{example}
%
% \DescribeKey{pxdim}'='<length>
% Alternatively
% to the \Key{dpi} key the \Macro\pdfpxdimen length can be set directly to the given value. Afterwards |1px| will stand
% for the given \meta{length}.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{pxdim=2pt,trim=2px,frame}
%       {\textcolor{green}{\rule{20pt}{20pt}}}
%   \end{examplecode}
% \end{example}
%
%
% ^^A )))2
% \clearpage\subsection{Minipage or other inner environments which change the processing of the content}\label{sec:inner} ^^A (((2
% The following keys set the way the content is processed before it is stored it in a box.
% These keys will overwrite each other and only the latest used key will take effect.
% Because they affect the inner content directly their order relative to other, normal keys is not meaningful.
% Also they are only defined for \env{adjustbox} but do not apply for \Macro\includegraphics.
% Because they are therefore only used inside a mandatory argument and never in an optional these keys allow for optional bracket arguments.
%
% \DescribeKey{minipage}'='<width>
% \DescribeKey{minipage}'='[<position>][<height>][<inner position>]{<width>}
% This key wraps the inner content in a \env{minipage} with the given \meta{width} before it is stored as horizontal box.
% Its order relative to other keys is not meaningful (except that future keys of this sub-section will overwrite it).
% This allows for line breaks and footnotes in the \env{adjustbox}.
% All optional arguments of \env{minipage} are supported. I only the width is given it does not have to be enclosed in braces.
% The \meta{position} argument must be "t" for top baseline, "b" for bottom baseline and "c" for center alignment relative to other
% text, i.e.\ defines the resulting baseline. If a \meta{height} is defined the \meta{inner position} defaults to \meta{position} but
% can also be "s" to stretch the content over the whole height. This requires the content to include some vertical stretchable material.
% Note that all length arguments can include arithmetic expressions like for other keys.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{minipage=5cm,angle=-10}{%
%      Some example code which will
%      be automatically broken or can include \\
%      line breaks\footnote{AND footnotes!!}\\
%      or verbatim \verb+@%^&}_+!%
%   }
%   \end{examplecode}
%   \begin{examplecode}
%   Before \begin{adjustbox}{minipage=[b][3cm][s]{5cm}}
%      Some example code
%
%      \vfill
%      with line breaks\footnote{AND footnotes!!}
%
%      \vfill
%      or verbatim \verb+@%^&}_+!%
%   \end{adjustbox} After
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{varwidth}'='<width>
% Adds a \env{varwidth} environment from the \pkg{varwidth} package around the content. This is similar to the
% \env{minipage} environment but the final width of the content will be as large as the widest line in the content up to
% the maximum amount given by the width argument.
% This environment key is vert useful if the content produces some paragraph material which can't be stored in an
% horizontal box directly.
%
%
% \DescribeKey{tabular}'='[<position>]{<column specification>}
% \DescribeKey{tabular*}'='[<position>]{<width>}{<column specification>}
% \DescribeKey{array}'='[<position>]{<column specification>}
% Places the content in a \env{tabular}, \env{tabular*} or \env{array} environment, respectively.
% These keys require different implementations for macro (\Macro\adjustbox) and environment mode (\env{adjustbox} environment) in order to insert
% the end code correctly. Note that the environment mode is more efficient and fully stable, while the macro mode requires the last row to end with
% an explicit |\\| (which can be followed by \Macro\hline or any other macro which uses \Macro\noalign internally). In macro mode the |\\| is internally redefined
% to check for the closing brace. While this was successful tested for normal usages it might still cause issues with unusual or complicated cases.
% Note that these environments are taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported.
%
% \begin{examples}
%   \begin{examplecode}
%   \adjustbox{tabular=lll}{%
%                   \hline
%       A & B & C \\\hline
%       a & b & c \\\hline
%   }
%   \end{examplecode}
%   \begin{examplecode}
%   \begin{adjustbox}{tabular=lll}
%       A & B & C \\
%       a & b & c
%   \end{adjustbox}
%   \end{examplecode}
% \end{examples}
%
%
% \DescribeKey{stack}
% \DescribeKey{stack}'='<horizontal alignment>
% \DescribeKey{stack}'='{<horizontal alignment>}{<vertical alignment>}
% \Descsep
% \DescribeMacro\stackbox!\optionaloff![<horizontal alignment>][<vertical alignment>]{<content>}
% \Descsep
% \DescribeEnv[<content>]{stackbox}[<horizontal alignment>][<vertical alignment>]
% The \Key{stack} key and its corresponding macro and environment can be used to stack multiple lines similar to the \Macro\shortstack macro, but
% both the horizontal and vertical alignment can be selected by a single letter each. Also a proper baseline skip is inserted.
% This is implemented using the \env{varwidth} environment which is based on the \env{minipage} environment.
% Its maximal width arguments is fixed internally to \Macro\linewidth.
%
% Possible horizontal alignments are: "l" (left), "r" (right), "c" (centered, default), "j" (justified).
% Possible vertical alignments are the same as for \env{minipage}: "t" (top baseline), "b" (bottom baseline, default), "c" (vertical centered).
% Because these arguments are always single letters the "{ }" around them can be skipped, so that the value can simple be two concatenated letters.
%
% \begin{example}
%   \begin{examplecode}
%   .\adjustbox{stack}{A\\B\\CC}.
%   \end{examplecode}
%   \begin{examplecode}
%   .\adjustbox{stack=r}{A\\B\\CC}.
%   \end{examplecode}
%   \begin{examplecode}
%   .\adjustbox{stack=ct}{A\\B\\CC}.
%   \end{examplecode}
% \end{example}
%
%
% \DescribeKey{innerenv}'='<environment name>
% \DescribeKey{innerenv}'='{<environment name>}<environment options>
% Wraps the inner content in the given \meta{environment} before it is stored as horizontal box.
% It should be kept in mind that there is some internal code between the begin of the environment and the content. For this reason
% a \env{tabular}, \env{array} or similar environment will not work here, because that code will be taken as part of the first cell.
% Note that such a environment is taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported.
%
% \begin{example}
%   \begin{examplecode}
%   \newenvironment{myenv}[2][]{Before [#1](#2)}{After}
%   \adjustbox{innerenv={myenv}[ex]{amble}}{Content}
%   \end{examplecode}
%   \newenvironment{myenv}[2][]{Before [#1](#2)}{After}
%   \begin{examplecode}
%   \adjustbox{innerenv={myenv}{amble}}{Content}
%   \end{examplecode}
% \end{example}
%
%
% \DescribeKey{innercode}'='{<begin code>}{<end code>}
% Places the given code before and after the inner content before it is stored as horizontal box.
% Note that such code is taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{innercode={\color{green}}{!}}{Content}
%   \end{examplecode}
% \end{example}
%
% ^^A )))2
% \clearpage\subsection{Floats and non-float replacements} ^^A (((2
% The following keys can be used to turn an adjusted box into a float or a non-floating replacement which also allows
% for a caption. These keys must be used last and no other normal keys must be used afterwards, otherwise an error will
% occur because the added floating environment is boxed again.
%
%
% \DescribeKey{caption}=<caption text>
% \DescribeKey{caption}=[<short caption>]{<long caption>}
% Defines a caption which will be used by a following \Key{figure}, \Key{float} or \Key{nofloat} key.
% The position of the caption defaults to top for a |table| (non-)float and bottom for every other type.
%
% \DescribeKey{captionabove}=<caption text>
% \DescribeKey{captionabove}=[<short caption>]{<long caption>}
% Like the \Key{caption} key but forces the placement of the caption above the content.
% The vertical skip above and below a normal below caption are reversed in this case to get proper
% spacing. However, this is not done if the \pkg{caption} package is loaded.
% It is recommended to load this package with the |tableposition=above| option.
%
%
% \DescribeKey{captionbelow}=<caption text>
% \DescribeKey{captionbelow}=[<short caption>]{<long caption>}
% Like the \Key{caption} key but forces the placement of the caption below the content.
%
%
% \DescribeKey{label}=<label>
% Defines a label which will be used by a following \Key{figure}, \Key{float} or \Key{nofloat} key.
%
%
% \DescribeKey{figure}
% \DescribeKey{figure}=<placement>
% Turns the adjusted box into a \env{figure}.
% A previously used \Key{caption} and \Key{label} will be added.
% This is a specialised version of \Key{float}={figure}.
%
%
% \DescribeKey{float}=<float type>
% \DescribeKey{float}={<float type>}[<position>]
% Turns the adjusted box into a float of the given type, i.e.\ |figure|, |table| or any other custom defined float.
% A previously used \Key{caption} and \Key{label} will be added.
%
%
% \DescribeKey{nofloat}=<float type>
% This will add a non-floating replacement of the given float type (|figure|, |table|, etc.).
% The will place the content always at the current
% position which can lead to bad page-breaking. A caption will be in the same format as for real floats of the same
% type.
% A previously used \Key{caption} and \Key{label} will be added.
%
% \DescribeEnv[<content>]{adjnofloat}{<float type>}
% This environment is used internally by \Key{nofloat} to create a non-floating replacement of the given float type
% (|figure|, |table|, etc.). It can also be used directly with other code or be redefined to change the
% behavior of \Key{nofloat}.
% Any redefinition should include |\adjbox@nofloatcaptionsetup{#1}| to set the caption type.
% The environment will be used in plain form, i.e.\ \Macro\adjnofloat\ldots\Macro\endadjnofloat, so
% if a group is required in a redefinition it should be added manually using \Macro\begingroup and \Macro\endgroup.
%
%
%
% ^^A )))2
% \Needspace*{8\baselineskip}
% \clearpage\subsection{Adding own Code or Environments} ^^A (((2
% \vspace{-\baselineskip}
%
% \DescribeKey{env}'='<environment name>
% \DescribeKey{env}'='{<environment name>}<environment options>
% Adds an \meta{environment} around the content and the already existing code around it which was added by other keys beforehand.
% Potential \meta{environment options} (or any other code) can follow the environment name if it was set inside braces.
% At this stage the content is already boxed and format macros won't have any effect on any included text. For this the \Key{innerenv} key needs to be used instead.
%
% \DescribeKey{addcode}'='{<code before>}{<code afters>}
% Adds some \meta{code before} and some \meta{code after} the content and the
% already existing code around it which was added by other keys beforehand.
% At this stage the content is already boxed and format macros won't have any effect on any included text.
% This key sets
% the size of the content before adding the code, i.e.\ keys like \Key{width} or \Key{scale} are executed on the content
% beforehand.
%
% \DescribeKey{Addcode}'='{<code before>}{<code afters>}
% Identical to \Key{addcode} but does not sets the size of the content first.
%
% \DescribeKey{appcode}'='<code afterwards>
% Appends the given \LaTeX\ code after the currently accumulated content. Note that this is the original content of the adjusted box \emph{and} all code
% added by the previous keys.
%
% It is recommended to wrap complex code into braces.
%
% \DescribeKey{precode}'='<code before>
% Prepends the given \LaTeX\ code before the currently accumulated content. Note that this is the original content of the adjusted box \emph{and} all code
% added by the previous keys. The content is wrapped into curly braces, so the given code can use it as a macro argument.
% This key sets the size of the content before adding the code, i.e.\ keys like \Key{width} or \Key{scale} are executed on the content
% beforehand.
%
% It is recommended to wrap complex code into braces.
%
%
% \DescribeKey{Precode}'='{<code before>}
% Identical to \Key{precode} but does not sets the size of the content first.
%
%
% \DescribeKey{execute}'='<code>
% Simply executes the code immediately. This is done in the key processing phase and is intended mostly for debugging purposes.
% Previous (normal) keys won't have an effect yet.
%
% \DescribeKey{Execute}'='<code>
% Simply executes the code immediately. This is done in the key processing phase for inner environments (see \autoref{sec:inner}) and is intended mostly for debugging purposes.
% Only previously used special keys for modifying the boxing of the content will have an effect yet.  % All other keys are not yet processed.
%
%
% ^^A )))2
% \clearpage\subsection{Change or discard content} ^^A (((2
% \vspace{-\baselineskip}
%
% \DescribeKey{phantom}
% \DescribeKey{phantom}'=h'
% \DescribeKey{phantom}'=v'
% This key replaces the content with an empty phantom box of the same dimension.
% If the "h" or "v" value is used the box will only have the same horizontal size or vertical sizes (height and depth)
% while using zero for the other dimension(s). For this the standard \LaTeX\ macros \Macro\phantom, \Macro\hphantom and
% \Macro\vphantom are used internally.
%
%
% \DescribeMacro\phantombox{<width>}{<height>}{<depth>}
% This macro produces an empty box with the given width, height and depth.
% It is equivalent to \Macro\phantom{\AlsoMacro\rule['-'<depth>]{<width>}{<height>'+'<depth>}} but more efficient and more user friendly.
%
% \begin{example}
%   \begin{examplecode}
%   Before \fbox{\phantombox{1cm}{2ex}{1ex}} After
%   \end{examplecode}
% \end{example}
%
%
% \DescribeKey{gobble}
% \DescribeKey{discard}
% These two keys are aliases and will discard the content after it was fully processed.  Any keys used after one of this
% keys will operate on an empty content.  These keys can be used in combination of the \Key{gstore ...} keys to only
% measure but not typeset some content.
%
% \DescribeKey{content}'='<new content>
% This key discards the current content completely after it was fully processed and all earlier keys were applied
% and sets the content to the given \meta{new content}. This can be used to implement some draft box or censoring
% features.
%
% \newlength\somelengtha
% \newlength\somelengthb
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{frame,rotate=-30,gstore sizes=\somelengtha{}{}\somelengthb,
%       content={Censored!},rotate=30,totalheight=\somelengtha,width=\somelengthb,frame}
%           {The real content}
%   \end{examplecode}
% \end{example}
%
%
%
% ^^A )))2
% \clearpage\subsection{Store box content } ^^A (((2
%
% \DescribeKey{gstore}'='<\textbackslash boxregister>
% \DescribeKey{gstore*}'='<\textbackslash boxregister>
% These keys globally store the current content into the given box register.
% With the normal version the content is still preserved and can be further adjusted.
% With the starred version the content will be consumed and further keys will be applied to an empty content.
%
% \DescribeKey{gstore width}'='<\textbackslash lengthregister>
% \DescribeKey{gstore height}'='<\textbackslash lengthregister>
% \DescribeKey{gstore depth}'='<\textbackslash lengthregister>
% \DescribeKey{gstore totalheight}'='<\textbackslash lengthregister>
% These key globally store the width, height, depth and totalheight into a length register, respectively.
% The content will not be altered by these keys. There are no starred versions like for \Key{gstore}.
% If the content should only be measured but not typeset the \Key{gobble}/\Key{discard} key can be used afterwards.
%
% \DescribeKey{gstore sizes}'='<\textbackslash lengthregister><\textbackslash lengthregister><\textbackslash lengthregister><\textbackslash lengthregister>
% Stores all four size values (width, height, depth and totalheight) of the content in the given length registers.
% This key should be used if more than one dimension should be stored, because it is much more efficient than using
% multiple of the above keys.
% If a dimension is not required it can be replaced by an empty argument, i.e.\ `|{}|'.
% Trailing dimensions can be skipped altogether if they are not required.
%
%
% ^^A )))2
% \clearpage\subsection{Process content} ^^A (((2
%
% \DescribeKey{process}
% This key processes the keys and content encountered so far (i.e.\ all keys to its left) and sets the dimension macros to the sizes of the result.
% It is only required for certain key combinations, mostly the ones taken from \pkg{graphicx}, which are otherwise processed together.
%
% ^^A )))2
% \clearpage\subsection{Experimental Keys} ^^A (((2
% The following features are experimental and may not work correctly yet.
% At the moment the \pkg{storebox} package must be loaded manually for this keys.
%
% \DescribeMacro\splitbox{<split width>}{<split height>}{<content>}
% This macro boxes the given content and splits it in multiple fragments of the given width and height.
% This is done row by row starting from the upper left corner. The last column and row can have a smaller size than requested.
% Every fragment is placed using \Macro\splitboxcmd{<fragment box>} which is empty by default but can be redefined to e.g.\ draw
% a frame around each fragment. After every row except the last the macro \Macro\splitboxnewline is inserted which defaults to |\\|,
% but can also be redefined freely. After the last row the macro \Macro\splitboxlastnewline is inserted which defaults to \Macro\splitboxnewline.
%
% The \Macro\splitbox content is stored using \Macro\storebox from the \pkg{storebox} package and therefore the whole content should only
% be stored once in the output file if the format is supported by that package (currently only PDF).
%
% \DescribeEnv[<content>]{splitbox}{<split width>}{<split height>}
% Environment version of \Macro\splitbox.
%
% \DescribeKey{split}'='{<split width>}{<split height>}
% The \Key{split} key can be used with \Macro\adjustbox and uses \Macro\splitbox internally.
%
% \DescribeMacro\pagebreakbox{<content>}
% The \Macro\pagebreakbox macro will split the content into multiple parts so that if fits on the current page.
% If it is larger than the rest of the current page and the full next page it is broken again until the last part fits on a page.
% This doesn't take any baselines into account and text line in the content may be split in two.
% This might be compensated manually by redefining the \Macro\pagebreakboxoffset macro (default: `|\ht\strutbox|'), which adjust the vertical offset
% of the first part.
%
% \DescribeEnv{pagebreakbox}
% Environment version of \Macro\pagebreakbox.
%
% \DescribeKey{pagebreak}
% The key version of \Macro\pagebreakbox. There should no be any further keys used afterwards, because they will interfere with the page breaks.
%
%
% ^^A )))2
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \clearpage\section{Defining own Keys} ^^A (((
% The following macros can be used to define own keys or redefine existing ones.
%
% \DescribeMacro\newadjustboxkey{<key>}[<default value>]{<code>}
% \DescribeMacro\newadjustboxkey*{<key>}[<default value>]{<code>}
% Defines the new \env{adjustbox} key with the given default value if no value is provided.
% The value can be accessed inside the code as |#1|
% Without a default value an error is raised if the value is missing.
% An error is raised if the key is already defined.
%
% The normal form will add the code to the internal token register just before the previous content which is
% wrapped inside braces: \MacroArgs<code>{<previous content>}. Subsequent keys will receive this as content.
% The code can therefore read the content as macro argument. If the dimension of the content need to be accessed
% it should be boxed first using \Macro\collectbox{<code>}. Then the dimension are available using the usual
% macros and the content can be typeset using \Macro\BOXCONTENT. See the \pkg{collectbox} for additional information.
%
% The starred form simply executes the given code in the internal group without changing the token register.
% In this case the content is not directly accessible and all subsequent keys are not yet processed.
% This form is useful to locally change settings for the current \Macro\adjustbox macro or \env{adjustbox} environment.
%
%
% \DescribeMacro\renewadjustboxkey{<key>}[<default value>]{<code>}
% \DescribeMacro\renewadjustboxkey*{<key>}[<default value>]{<code>}
% Like \Macro\newadjustboxkey but will redefine an existing key.
% An error is raised if the key is not already defined.
%
%
% \DescribeMacro\provideadjustboxkey{<key>}[<default value>]{<code>}
% \DescribeMacro\provideadjustboxkey*{<key>}[<default value>]{<code>}
% Like \Macro\newadjustboxkey but will define the key only if it is not already defined.
%
%
% \DescribeMacro\defadjustboxkey{<key>}[<default value>]{<code>}
% \DescribeMacro\defadjustboxkey*{<key>}[<default value>]{<code>}
% Like \Macro\newadjustboxkey but will always define the key independent if it is already defined or not.
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \StopEventually{}
% \clearpage% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \clearpage\section{Implementation} ^^A (((
% \setcounter{lstnumber}{1}
%
% \iffalse
%<*adjustbox.sty>
% \fi
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Package header, options and dependencies} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \begin{macrocode}
%<!COPYRIGHT>
\ProvidesPackage{adjustbox}[%
%<!DATE>
%<!VERSION>
%<*DRIVER>
    2099/01/01 develop
%</DRIVER>
    Adjusting TeX boxes (trim, clip, ...)]
%    \end{macrocode}
%
% Load the packages required for the options.
%    \begin{macrocode}
\RequirePackage{xkeyval}
\RequirePackage{adjcalc}
%    \end{macrocode}
%
% Declare normal options.
%    \begin{macrocode}
\def\adjbox@fam{adjbox}
\DeclareOptionX<Adjbox>{export}{\def\adjbox@fam{Gin}}
\DeclareOptionX<Adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
\DeclareOptionX<Adjbox>{patch}{%
    \PackageWarning{adjustbox}{%
         The 'patch' option is now deprecated.\MessageBreak
         Use the new \string\adjustimage\space or \string\adjincludegraphics\space macros instead%
         \@gobble
    }%
}
\DeclareOptionX<Adjbox>{minimal}{\let\adjustbox@minimal\endinput}
%    \end{macrocode}
%
% Declare the options which must be passed to \pkg{adjcalc} in a special form,
% because they require extra packages. This must be this way because \pkg{adjcalc}
% is already loaded.
%    \begin{macrocode}
\DeclareOptionX<Adjbox>{pgfmath}{\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
\DeclareOptionX<Adjbox>{calc}{\AtEndOfPackage{\RequirePackage{calc}\adjcalcset{calc}}}
\DeclareOptionX<Adjbox>{etex}{\AtEndOfPackage{\adjcalcset{etex}}}
\DeclareOptionX<Adjbox>{defaultunit}{\AtEndOfPackage{\adjcalcset{defaultunit={#1}}}}
%    \end{macrocode}
%
% Handle the special \opt{pgf} and \opt{PGF} options.
%    \begin{macrocode}
\DeclareOptionX<Adjbox>{pgf}{\PassOptionsToPackage{pgf}{trimclip}}
\DeclareOptionX<Adjbox>{PGF}{\PassOptionsToPackage{pgf}{trimclip}\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
%    \end{macrocode}
%
% Pass |pkg{graphicx}| options down.
%    \begin{macrocode}
\DeclareOptionX<Adjbox>{draft}{\PassOptionsToPackage{draft}{graphicx}}
\DeclareOptionX<Adjbox>{final}{\PassOptionsToPackage{final}{graphicx}}
\DeclareOptionX<Adjbox>{hiderotate}{\PassOptionsToPackage{hiderotate}{graphicx}}
\DeclareOptionX<Adjbox>{hidescale}{\PassOptionsToPackage{hidescale}{graphicx}}
\DeclareOptionX<Adjbox>{hiresbb}{\PassOptionsToPackage{hiresbb}{graphicx}}
\DeclareOptionX<Adjbox>{demo}{\PassOptionsToPackage{demo}{graphicx}}
%    \end{macrocode}
%
% Pass all driver options to \pkg{trimclip} and all unknown options to \pkg{graphicx}.
%    \begin{macrocode}
\DeclareOptionX*{%
    \IfFileExists{tc-\CurrentOption.def}{%
        \PassOptionsToPackage\CurrentOption{trimclip}%
    }{%
        \PassOptionsToPackage\CurrentOption{graphicx}%
    }%
}
%    \end{macrocode}
%
% Process all options.
%    \begin{macrocode}
\ProcessOptionsX*<Adjbox>\relax
%    \end{macrocode}
%
% Load the required packages.
%    \begin{macrocode}
\RequirePackage{trimclip}
\RequirePackage{graphicx}[1999/02/16]
\RequirePackage{collectbox}[2012/05/17]
%    \end{macrocode}
%
% Fall-back code for older \pkg{collectbox} versions:
%    \begin{macrocode}
\@ifpackagelater{collectbox}{2012/05/17}{}{%
    \let\@Collectbox\@collectbox
}
%    \end{macrocode}
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Basic commands} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\adjustboxset}
%    \begin{macrocode}
\newcommand*\adjustboxset{%
    \@ifstar
        {\adjbox@addkeysafter}%
        {\adjbox@addkeysbefore}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@addkeysbefore}[1]{<keys>}
%    \begin{macrocode}
\def\adjbox@addkeysbefore#1{%
    \ifx\@nnil#1\@nnil
        \let\adjbox@keysbefore\@empty
    \else
        \expandafter\def\expandafter\adjbox@keysbefore\expandafter{\adjbox@keysbefore,#1}%
        \let\adjbox@setkeys\adjbox@setkeys@ba
    \fi
}
\let\adjbox@keysbefore\@empty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@addkeysafter}[1]{<keys>}
%    \begin{macrocode}
\def\adjbox@addkeysafter#1{%
    \begingroup
    \def\@tempa{#1}%
    \ifx\@tempa\@empty
        \endgroup
        \let\adjbox@keysafter\@empty
    \else
        \expandafter\expandafter
        \expandafter\endgroup
        \expandafter\expandafter
        \expandafter\def
        \expandafter\expandafter
        \expandafter\adjbox@keysafter
        \expandafter\expandafter
        \expandafter{\expandafter\@tempa\expandafter,\adjbox@keysafter}%
        \let\adjbox@setkeys\adjbox@setkeys@ba
    \fi
}
\let\adjbox@keysafter\@empty
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\adjustbox}[1]{<keys>}
% Now processes the keys before the box is read to allow for parbox or similar modes.
%
% This code was originally adapted from the \Macro\Gin@ii macro from the |graphicx| package.
% The \emph{temp switch a} is set to |true| to indicate to |graphicx| that the
% scaling should be done internal, so this package doesn't have to do it.
% The content including macro \Macro\adjustbox@content is but into place,
% the saved options are activated and the final size is set.
% The typesetting of the content is finally done by executing the token register.
%    \begin{macrocode}
\newcommand\adjustbox{%
    \begingroup
    \collectboxcheckenv{adjustbox}%
    \@adjustbox
}
\long\def\@adjustbox#1{%
    \edef\adjbox@line{\the\inputlineno}%
    \let\collectbox@mode\relax
    \let\collectbox@noindent\relax
    \let\adjbox@collectbox\@collectbox
    \let\adjbox@begininnercode\@empty
    \let\adjbox@endinnercode\@empty
    \chardef\adjbox@innerlevel\z@
    \ifcollectboxenv
        \let\adjustbox@noindent\noindent
        \let\adjustbox@unskip\unskip
        \let\adjustbox@ignorespaces\ignorespaces
    \else
        \let\adjustbox@noindent\relax
        \let\adjustbox@unskip\relax
        \let\adjustbox@ignorespaces\relax
    \fi
    \let\XKV@checksanitizea\adjbox@kvsanitize
    \adjbox@setkeys{#1}%
    \expandafter
    \adjbox@collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV@rm}}%
}
\def\adjbox@setkeys@ba{%
    \expandafter\expandafter
    \expandafter\adjbox@@setkeys@ba
    \expandafter\expandafter
    \expandafter{\expandafter\adjbox@keysbefore\expandafter}%
    \expandafter{\adjbox@keysafter}%
}
\def\adjbox@@setkeys@ba#1#2#3{%
    \setkeys*{ADJBOX}{#1,#3,#2}%
}
\def\adjbox@setkeys{%
    \setkeys*{ADJBOX}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjustbox@}[1]{<keys>}
% Second part of \Macro\adjustbox, after the content has been boxed.
% This sets the dimension macros, processes the keys and finally typesets the content.
%    \begin{macrocode}
\def\adjustbox@#1{%
    \adjbox@Width\width
    \adjbox@Height\height
    \adjbox@Depth\depth
    \adjbox@Totalheight\totalheight
    \let\Width\adjbox@Width
    \let\Height\adjbox@Height
    \let\Depth\adjbox@Depth
    \let\Totalheight\adjbox@Totalheight
    \let\Gin@esetsize\adjbox@esetsize
    \let\@collectbox\@Collectbox
    \@tempswatrue
    \toks@{{\adjustbox@content}}%
    \def\setlength{\adjsetlength}%
    \setkeys{adjbox,Gin,adjcalc}{#1}%
    \adjbox@esetsize
    \adjustbox@noindent
    \the\toks@
    \endgroup
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\begingroup
\catcode`\, 3
\catcode`\= 3
\gdef\adjbox@comma@iii{,}%
\gdef\adjbox@equal@iii{=}%
\catcode`\, 4
\catcode`\= 4
\gdef\adjbox@comma@iv{,}%
\gdef\adjbox@equal@iv{=}%
\catcode`\, 7
\catcode`\= 7
\gdef\adjbox@comma@vii{,}%
\gdef\adjbox@equal@vii{=}%
\catcode`\, 8
\catcode`\= 8
\gdef\adjbox@comma@viii{,}%
\gdef\adjbox@equal@viii{=}%
\catcode`\, 10
\catcode`\= 10
\gdef\adjbox@comma@x{,}%
\gdef\adjbox@equal@x{=}%
\catcode`\, 11
\catcode`\= 11
\gdef\adjbox@comma@xi{,}%
\gdef\adjbox@equal@xi{=}%
\catcode`\, 13
\catcode`\= 13
\gdef\adjbox@comma@xiii{,}%
\gdef\adjbox@equal@xiii{=}%
\catcode`\, 12
\catcode`\= 12
\gdef\adjbox@comma@xii{,}%
\gdef\adjbox@equal@xii{=}%
%    \end{macrocode}
%
% \begin{macro}{\adjbox@kvsanitize}
%    \begin{macrocode}
\gdef\adjbox@kvsanitize#1#2{%
    \def\@tempa{\expandafter\noexpand\adjbox@comma@xiii}%
    \def\@tempb{}%
    \ifnum\catcode`\,=12 \else
        \ifnum\catcode`\,=13 \else
            \@ifundefined{adjbox@comma@\romannumeral\catcode`\,}{%
                \PackageError{adjustbox}
                {Invalid comma catcode \the\catcode`\,}{}%
            }{}%
            \edef\@tempb{\csname adjbox@comma@\romannumeral\the\catcode`\,\endcsname}%
        \fi
    \fi
    \edef\@tempa{\@tempa\@tempb}%
    \XKV@tempa@toks{#1}%
    \expandafter\adjbox@replacecatcodes\expandafter,\@tempa\@nnil
    \def\@tempa{\expandafter\noexpand\adjbox@equal@xiii}%
    \def\@tempb{}%
    \ifnum\catcode`\==12 \else
        \ifnum\catcode`\==13 \else
            \@ifundefined{adjbox@equal@\romannumeral\catcode`\=}{%
                \PackageError{adjustbox}
                {Invalid equal sign catcode \the\catcode`\=}{}%
            }{}%
            \def\@tempb{\@tempa\csname adjbox@equal@\romannumeral\the\catcode`\,\endcsname}%
        \fi
    \fi
    \edef\@tempa{\@tempa\@tempb}%
    \expandafter\adjbox@replacecatcodes\expandafter=\@tempa\@nnil
    \edef#2{\the\XKV@tempa@toks}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@replacecatcodes}
%    \begin{macrocode}
\gdef\adjbox@replacecatcodes#1#2{%
    \ifx\@nnil#2\relax\else
        \def\@tempa##1#2{%
            \ifx\@nnil##1\relax\else
                \XKV@tempa@toks{##1}%
                \expandafter\@tempb
            \fi
        }%
        \def\@tempb##1#2{%
            \ifx\@nnil##1\relax\else
                \XKV@tempa@toks\expandafter{\the\XKV@tempa@toks#1##1}%
                \expandafter\@tempb
            \fi
        }%
        \expandafter\@tempa\the\XKV@tempa@toks#2\@nnil#2\relax
        \expandafter\adjbox@replacecatcodes\expandafter#1%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\endgroup
%    \end{macrocode}
%
%
% \begin{macro}{\adjustbox@content}
% The default content, which is simply the collected box.
% This macro can be redefined if required.
%    \begin{macrocode}
\def\adjustbox@content{%
    \usebox\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\smallestside}
%    \begin{macrocode}
\def\smallestside{\ifdim\width<\totalheight \width\else\totalheight\fi}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\largestside}
%    \begin{macrocode}
\def\largestside{\ifdim\width>\totalheight \width\else\totalheight\fi}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Smallestside}
%    \begin{macrocode}
\def\Smallestside{\ifdim\Width<\Totalheight \Width\else\Totalheight\fi}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Largestside}
%    \begin{macrocode}
\def\Largestside{\ifdim\Width>\Totalheight \Width\else\Totalheight\fi}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@Width}
% \begin{macro}{\adjbox@Height}
% \begin{macro}{\adjbox@Depth}
% \begin{macro}{\adjbox@Totalheight}
% Dimension registers for original sizes.
%    \begin{macrocode}
\newdimen\adjbox@Width
\newdimen\adjbox@Height
\newdimen\adjbox@Depth
\newdimen\adjbox@Totalheight
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\adjbox@pwidth}
% \begin{macro}{\adjbox@pheight}
% \begin{macro}{\adjbox@pdepth}
% \begin{macro}{\adjbox@ptotalheight}
% Dimension registers for parent sizes; used for keys which use an internal adjustbox.
%    \begin{macrocode}
\newdimen\adjbox@pwidth
\newdimen\adjbox@pheight
\newdimen\adjbox@pdepth
\newdimen\adjbox@ptotalheight
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\adjbox@parentdims}
%    \begin{macrocode}
\def\adjbox@parentdims{%
    \let\pwidth\adjbox@pwidth
    \let\pheight\adjbox@pheight
    \let\pdepth\adjbox@pdepth
    \let\ptotalheight\adjbox@ptotalheight
    \pwidth\width
    \pheight\height
    \pdepth\depth
    \ptotalheight\totalheight
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@esetsize}
% Replacement of \Macro\Gin@esetsize.
% Now always called in external mode. Checks if any size is set and, as an optimation, does nothing otherwise.
%
% OLD:
% When called in \emph{external} mode (switch is true) then the content is wrapped in
% the internal form of \Macro\resizebox. In \emph{internal} mode, i.e.\ resizing is done by the graphic driver,
% the same code is added around the inner macro. This ensures the same behaviour as \Macro\includegraphics.
%    \begin{macrocode}
\def\adjbox@esetsize{%
  \ifcase0%
    \ifx\Gin@ewidth\Gin@exclamation\else 1\fi
    \ifx\Gin@eheight\Gin@exclamation\else 1\fi
  \relax
  \else
    \edef\@tempa{\toks@{\noexpand
                \Gscale@@box\noexpand\Gin@eresize
                {\Gin@ewidth}{\Gin@eheight}{\the\toks@}}}%
    \@tempa
    \let\Gin@ewidth\Gin@exclamation
    \let\Gin@eheight\Gin@exclamation
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjustimage}
% Simple wrapper to use \Macro\adjustbox for images.
% It uses the internal code of \Macro\includegraphics instead
% to allow later redefinition of that macro.
%    \begin{macrocode}
\newcommand*\adjustimage[2]{%
    \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjincludegraphics}[2]{<keys>}{<filename>}
% Simple wrapper to use \Macro\adjustbox for images in the same format of \Macro\includegraphics.
% This allows to simply do |\let\includegraphics\adjincludegraphics|, which is done by the \opt{Export} option.
%    \begin{macrocode}
\newcommand*\adjincludegraphics[2][]{%
    \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% End input of file if the \opt{minimal} option was used.
%    \begin{macrocode}
{\csname adjustbox@minimal\endcsname}
%    \end{macrocode}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Macros to define new adjustbox environments/macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\newadjustboxenv}
%    \begin{macrocode}
\newcommand*\newadjustboxenv{%
    \begingroup
    \@ifstar{%
        \let\@@@newadjustboxenv\@@@newadjustboxenv@
        \def\new@adjustbox{\newenvironment}%
        \newadjustboxenv@
    }{%
        \def\new@adjustbox{\newcommand}%
        \newadjustboxenv@
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\renewadjustboxenv}
%    \begin{macrocode}
\newcommand*\renewadjustboxenv{%
    \begingroup
    \@ifstar{%
        \let\@@@newadjustboxenv\@@@newadjustboxenv@
        \def\new@adjustbox{\renewenvironment}%
        \newadjustboxenv@
    }{%
        \def\new@adjustbox{\renewcommand}%
        \newadjustboxenv@
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\provideadjustboxenv}
%    \begin{macrocode}
\newcommand*\provideadjustboxenv{%
    \begingroup
    \@ifstar{%
        \let\@@@newadjustboxenv\@@@newadjustboxenv@
        \def\new@adjustbox{\@star@or@long\adjustbox@provideenvironment}%
        \newadjustboxenv@
    }{%
        \def\new@adjustbox{\providecommand}%
        \newadjustboxenv@
    }%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\declareadjustboxenv}
%    \begin{macrocode}
\newcommand*\declareadjustboxenv{%
    \begingroup
    \@ifstar{%
        \let\@@@newadjustboxenv\@@@newadjustboxenv@
        \def\new@adjustbox##1{%
            \expandafter\let\csname ##1\endcsname\@undefined
            \newenvironment{##1}%
        }%
        \newadjustboxenv@
    }{%
        \def\new@adjustbox##1{%
            \let##1\@undefined
            \newcommand{##1}%
        }%
        \newadjustboxenv@
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\newadjustboxcmd}
%    \begin{macrocode}
\newcommand*\newadjustboxcmd{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustboxcmd
    \def\new@adjustbox{\newcommand}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\renewadjustboxcmd}
%    \begin{macrocode}
\newcommand*\renewadjustboxcmd{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustboxcmd
    \def\new@adjustbox{\renewcommand}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\provideadjustboxcmd}
%    \begin{macrocode}
\newcommand*\provideadjustboxcmd{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustboxcmd
    \def\new@adjustbox{\providecommand}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\provideadjustboxcmd}
%    \begin{macrocode}
\newcommand*\declareadjustboxcmd{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustboxcmd
    \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\adjustbox@provideenvironment}[1]{<environment name>}
% Tests if the environment already exists and calls the internal
% macro of \Macro\newenvironment if not. Otherwise, the two optional
% and two mandatory arguments are gobbled.
%    \begin{macrocode}
\def\adjustbox@provideenvironment#1{%
    \@ifundefined{#1}%
        {\new@environment{#1}}%
        {\adjustbox@gobble@oomm}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjustbox@gobble@oomm}
% Gobbles the first optional argument.
%    \begin{macrocode}
\newcommand*\adjustbox@gobble@oomm[1][]{%
    \adjustbox@gobble@@oomm
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjustbox@gobble@@oomm}
% Gobbles the second optional and two mandatory arguments.
%    \begin{macrocode}
\newcommand*\adjustbox@gobble@@oomm[3][]{%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\newadjustboxenv@}[1]{<environment name>}
%    \begin{macrocode}
\def\newadjustboxenv@#1{%
    \@ifnextchar{[}%
        {\@newadjustboxenv{#1}}%
        {\@@@newadjustboxenv{#1}{[0]}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@newadjustboxenv}[2]{<environment name>}{<optional argument>}
%    \begin{macrocode}
\def\@newadjustboxenv#1[#2]{%
    \@ifnextchar{[}%
        {\@@newadjustboxenv{#1}{#2}}%
        {\@@@newadjustboxenv{#1}{[#2]}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@newadjustboxenv}[3]{<environment name>}{<previous optional argument>}{<optional argument>}
%    \begin{macrocode}
\def\@@newadjustboxenv#1#2[#3]{%
    \@@@newadjustboxenv{#1}{[#2][#3]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@@newadjustboxenv@}[3]{<environment name>}{<optional arguments in brackets>}{<keys>}
%    \begin{macrocode}
\def\@@@newadjustboxenv@#1#2#3{%
    \expandafter
    \endgroup
    \new@adjustbox{#1}#2{%
        \begingroup
        \@collectboxisenv{#1}%
        \@adjustbox{#3}%
    }{%
        \collectboxenvend
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@@newadjustboxenv}[3]{<environment name>}{<optional arguments in brackets>}{<keys>}
%    \begin{macrocode}
\def\@@@newadjustboxenv#1#2#3{%
    \expandafter
    \endgroup
    \expandafter
    \expandafter\new@adjustbox\csname #1\endcsname#2{%
        \begingroup
        \collectboxcheckenv{#1}%
        \@adjustbox{#3}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@@newadjustboxcmd}[3]{<environment name>}{<optional arguments in brackets>}{<keys>}
%    \begin{macrocode}
\def\@@@newadjustboxcmd#1#2#3{%
    \expandafter
    \endgroup
    \new@adjustbox{#1}#2{%
        \begingroup
        \@adjustbox{#3}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newadjustimage}
%    \begin{macrocode}
\newcommand*\newadjustimage{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustimage
    \def\new@adjustbox{\newcommand}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\renewadjustimage}
%    \begin{macrocode}
\newcommand*\renewadjustimage{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustimage
    \def\new@adjustbox{\renewcommand}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}%
%
% \begin{macro}{\provideadjustimage}
%    \begin{macrocode}
\newcommand*\provideadjustimage{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustimage
    \def\new@adjustbox{\providecommand}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\declareadjustimage}
%    \begin{macrocode}
\newcommand*\declareadjustimage{%
    \begingroup
    \let\@@@newadjustboxenv\@@@newadjustimage
    \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}%
    \newadjustboxenv@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@@newadjustimage}[3]{<macro name>}{<optional arguments in brackets>}{<keys>}
%    \begin{macrocode}
\def\@@@newadjustimage#1#2#3{%
    \expandafter
    \endgroup
    \new@adjustbox{#1}#2{%
        \begingroup
        \def\@tempa####1{%
            \def\IMAGEFILENAME{####1}%
            \@adjustbox{#3}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}%
        }%
        \@tempa
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\NewAdjustImage}
%    \begin{macrocode}
\newcommand*\adjustbox@NewAdjustImage[4]{%
    \adjustbox@checkforxparse
    #1{#2}{#3}{%
        \begingroup
        \def\@tempa####1{%
            \def\IMAGEFILENAME{####1}%
            \@adjustbox{#4}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}%
        }%
        \@tempa
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\NewAdjustImage}
%    \begin{macrocode}
\newcommand*\NewAdjustImage{%
    \adjustbox@NewAdjustImage\NewDocumentCommand
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\RenewDocumentCommand}
%    \begin{macrocode}
\newcommand*\RenewAdjustImage{%
    \adjustbox@NewAdjustImage\RenewDocumentCommand
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ProvideAdjustImage}
%    \begin{macrocode}
\newcommand*\ProvideAdjustImage{%
    \adjustbox@NewAdjustImage\ProvideDocumentCommand
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\DeclareAdjustImage}
%    \begin{macrocode}
\newcommand*\DeclareAdjustImage{%
    \adjustbox@NewAdjustImage\ProvideDocumentCommand
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\NewAdjustImage}
%    \begin{macrocode}
\def\adjustbox@checkforxparse{%
    \begingroup
    \expandafter\ifx\csname ver@xparse.sty\endcsname\relax
        \PackageError{adjustbox}{%
            The 'xparse' package must be loaded separately in\MessageBreak
            order to use the following macros: \MessageBreak
             \string\NewAdjustImage,
             \string\RenewAdjustImage, \MessageBreak
             \string\ProvideAdjustImage,
             \string\DeclareAdjustImage}{}
    \fi
    \endgroup
    \let\adjustbox@checkforxparse\relax
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Internal code adding macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\adjbox@Gin@add}[1]{<code>}
%    \begin{macrocode}
\def\adjbox@Gin@add#1{%
    \def\@tempa{#1}%
    \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
}
\def\adjbox@Gin@Add{%
    \Gin@esetsize
    \@tempswatrue
    \adjbox@Gin@add
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\newadjustboxkey}
%    \begin{macrocode}
\newcommand\newadjustboxkey{%
    \@adjustboxkey\adjustbox@newkey
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\renewadjustboxkey}
%    \begin{macrocode}
\newcommand\renewadjustboxkey{%
    \@adjustboxkey\adjustbox@renewkey
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\provideadjustboxkey}
%    \begin{macrocode}
\newcommand\provideadjustboxkey{%
    \@adjustboxkey\adjustbox@providekey
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\defadjustboxkey}
%    \begin{macrocode}
\newcommand\defadjustboxkey{%
    \@adjustboxkey\@secondoftwo
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@adjustboxkey}[1]{<key name>}
%    \begin{macrocode}
\def\@adjustboxkey#1{%
    \@ifstar
        {\@adjustboxkey@i#1*}%
        {\@adjustboxkey@i#1\relax}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@adjustboxkey@i}
%    \begin{macrocode}
\def\@adjustboxkey@i#1#2#3{%
    \@ifnextchar{[}%
        {\@adjustboxkey@ii#1#2{#3}}%
        {\@adjustboxkey@ii#1#2{#3}[\@nnil]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@adjustboxkey@ii}
%    \begin{macrocode}
\def\@adjustboxkey@ii#1#2#3[#4]#5{%
  \ifx\@nnil#4\relax
    \@adjustboxkey@iii#1#2{#3}{}{#5}%
  \else
    \@adjustboxkey@iii#1#2{#3}{[#4]}{#5}%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@adjustboxkey@iv}
%    \begin{macrocode}
\def\@adjustboxkey@iii#1#2#3#4#5{%
  #1{#3}{%
    \ifx*#2\relax
        \define@key\adjbox@fam{#3}#4{#5}%
    \else
        \define@key\adjbox@fam{#3}#4{%
            \adjbox@Gin@Add{\@Collectbox{#5}}%
        }%
    \fi
  }{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\define@adjboxkey}
%    \begin{macrocode}
\def\define@adjboxkey#1#2{%
    \define@key\adjbox@fam{#1}{%
        \adjbox@Gin@Add{#2}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\define@adjboxkey@defvalue}
%    \begin{macrocode}
\def\define@adjboxkey@defvalue#1#2#3{%
    \define@key\adjbox@fam{#1}[{#2}]{%
        \adjbox@Gin@Add{#3}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\define@adjboxkey@novalue}
%    \begin{macrocode}
\def\define@adjboxkey@novalue#1#2{%
    \define@key\adjbox@fam{#1}[\@nil]{%
        \adjbox@novalue{##1}%
        \adjbox@Gin@Add{#2}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@novalue}
%    \begin{macrocode}
\def\adjbox@novalue#1{%
    \ifx\@nil#1\else
        \PackageWarning{adjustbox}{%
            Key '\XKV@tkey' does not await a value.\MessageBreak
            Given value will be ignored%
        }%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjustbox@newkey}
%    \begin{macrocode}
\def\adjustbox@newkey#1#2{%
    \@ifundefined{KV@\adjbox@fam @#1}{#2}{%
        \PackageError{adjustbox}{Key '#1' already defined}{}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjustbox@renewkey}
%    \begin{macrocode}
\def\adjustbox@renewkey#1{%
    \@ifundefined{KV@\adjbox@fam @#1}{%
        \PackageError{adjustbox}{Key '#1' undefined}{}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjustbox@providekey}
%    \begin{macrocode}
\def\adjustbox@providekey#1#2{%
    \@ifundefined{KV@\adjbox@fam @#1}{#2}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\adjbox@let@key}
% Aliases one key to another.
%    \begin{macrocode}
\def\adjbox@let@key#1#2#3{%
    \expandafter\let\csname KV@#1@#2\expandafter\endcsname\csname KV@#1@#3\endcsname
    \expandafter\let\csname KV@#1@#2@default\expandafter\endcsname\csname KV@#1@#3@default\endcsname
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@copy@key}
% Aliases one key to another.
%    \begin{macrocode}
\def\adjbox@copy@key#1{%
    \expandafter\let
    \csname KV@ADJBOX@#1\expandafter\endcsname
    \csname KV@Gin@#1\endcsname
    \expandafter\let
    \csname KV@ADJBOX@#1@default\expandafter\endcsname
    \csname KV@Gin@#1@default\endcsname
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Keys for trimming, clipping, viewport and margin} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{key}{adjbox}{viewport}
%    \begin{macrocode}
\define@key{adjbox}{viewport}{%
    \def\adjustbox@content{%
        \@trimclip{%
            \ifGin@clip
                \expandafter\@clipvpbox
            \else
                \expandafter\@viewportbox
            \fi
        }{#1}%
    }%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{Viewport}
%    \begin{macrocode}
\define@adjboxkey{Viewport}{\trimbox@s{#1}}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{trim}
%    \begin{macrocode}
\define@key{adjbox}{trim}{%
    \def\adjustbox@content{%
        \@trimclip{%
            \ifGin@clip
                \expandafter\@clipbox
            \else
                \expandafter\@trimbox
            \fi
        }{#1}%
    }%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{Trim}
%    \begin{macrocode}
\define@adjboxkey{Trim}{\trimbox@{#1}}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{Clip}
%    \begin{macrocode}
\define@adjboxkey{Clip}{\clipbox@{#1}}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{rndcorners}
%    \begin{macrocode}
\define@adjboxkey{rndcorners}{\rndcornersbox@{#1}}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{rndframe}
%    \begin{macrocode}
\define@adjboxkey{rndframe}{%
    \@ifnextchar\bgroup{%
        \adjbox@rndframe{sep=\z@}%
    }{%
        \adjbox@rndframe{sep=\z@}{}%
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{rndfbox}
%    \begin{macrocode}
\define@adjboxkey{rndfbox}{%
    \@ifnextchar\bgroup{%
        \adjbox@rndframe{}%
    }{%
        \adjbox@rndframe{}{}%
    }#1\@nnil
}

\def\adjbox@rndframe#1#2#3\@nnil{%
    \rndfbox[{#1,#2}]{#3}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{Clip*}
%    \begin{macrocode}
\define@adjboxkey{Clip*}{\clipbox@s{#1}}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{margin}
%    \begin{macrocode}
\define@adjboxkey{margin}{\marginbox@{#1}}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{margin*}
%    \begin{macrocode}
\define@adjboxkey{margin*}{\marginbox@s{#1}}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{padding}
% Alias for \Key{margin}.
%    \begin{macrocode}
\adjbox@let@key\adjbox@fam{padding}{margin}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{padding*}
% Alias for \Key{margin*}.
%    \begin{macrocode}
\adjbox@let@key\adjbox@fam{padding*}{margin*}
%    \end{macrocode}
% \end{key}
%
%
%    \begin{macrocode}
\adjbox@copy@key{bbllx}
\adjbox@copy@key{bblly}
\adjbox@copy@key{bburx}
\adjbox@copy@key{bbury}
\adjbox@copy@key{bb}
\adjbox@copy@key{command}
\adjbox@copy@key{decodearray}
\adjbox@copy@key{draft}
\adjbox@copy@key{ext}
\adjbox@copy@key{intent}
\adjbox@copy@key{interpolate}
\adjbox@copy@key{maskarray}
\adjbox@copy@key{natheight}
\adjbox@copy@key{natwidth}
\adjbox@copy@key{ocobjnum}
\adjbox@copy@key{ocobjref}
\adjbox@copy@key{origin}
\adjbox@copy@key{pagebox}
\adjbox@copy@key{page}
\adjbox@copy@key{quiet}
\adjbox@copy@key{read}
\adjbox@copy@key{resetcolor}
\adjbox@copy@key{resolution}
\adjbox@copy@key{type}
\adjbox@copy@key{xmpfile}
%    \end{macrocode}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Round corners} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\rndcornersbox}
%    \begin{macrocode}
\newcommand\rndcornersbox{%
    \collectboxcheckenv{rndcornersbox}%
    \rndcornersbox@
}
\def\rndcornersbox@#1{%
    \collectbox{\@trimclip\@clipcornersofbox{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rndframebox}
%    \begin{macrocode}
\newcommand\rndframebox{%
    \collectboxcheckenv{rndframebox}%
    \rndframebox@
}
\newcommand*\rndframebox@[2][]{%
    \collectbox{\@trimclip{\rndframearoundbox@{sep=\z@,#1}}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rndfbox}
%    \begin{macrocode}
\newcommand\rndfbox{%
    \collectboxcheckenv{rndfbox}%
    \rndfbox@
}
\newcommand*\rndfbox@[2][]{%
    \collectbox{\@trimclip{\rndframearoundbox@{#1}}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\rndframearoundbox@}
%    \begin{macrocode}
\newif\ifadjbox@rndframe@clip
\def\rndframearoundbox@#1#2#3#4#5#6{%
    \setkeys{adjbox@rndframe}{#1}%
    \@rndframearoundbox{#2}{#3}{#4}{#5}{#6}{\ifadjbox@rndframe@clip\relax\fi}%
}
\define@key{adjbox@rndframe}{width}{%
    \adjsetlength\fboxrule{#1}%
}
\define@key{adjbox@rndframe}{sep}{%
    \adjsetlength\fboxsep{#1}%
}
\define@key{adjbox@rndframe}{color}{%
    \def\adjbox@rndframe@color{\color{#1}}%
}
\define@key{adjbox@rndframe}{color*}{%
    \def\adjbox@rndframe@color{#1}%
}
\let\adjbox@rndframe@color\relax
\define@key{adjbox@rndframe}{clip}[true]{%
    \csname adjbox@rndframe@clip#1\endcsname
}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
% \DescribeKey{color}'='{<color>}
% \DescribeKey{color*}'='{<color command>}
% \DescribeKey{width}'='{<rule width>}
% \DescribeKey{sep}'='{<rule separation>}
%    \end{macrocode}
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Scaling and rotating keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{scale}
%    \begin{macrocode}
\define@key\adjbox@fam{scale}{%
    \@ifnextchar\bgroup{%
        \adjbox@scale@xy
    }{%
        \adjbox@scale@x
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@scale@x}
%    \begin{macrocode}
\def\adjbox@scale@x#1\@nnil{%
    \adjbox@scale@xy{#1}{#1}\@nnil%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@scale@xy}
%    \begin{macrocode}
\def\adjbox@scale@xy#1#2\@nnil{%
  \if@tempswa
    \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}%
  \else
    \def\Gin@req@sizes{%
      \def\Gin@scalex{#1}\def\Gin@scaley{#2}%
      \Gin@req@height\Gin@scaley\Gin@nat@height
      \Gin@req@width\Gin@scalex\Gin@nat@width}%
  \fi
  \@tempswatrue
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{reflect}
% Taken from the \Key{scale} key of the \pkg{graphicx} package.
% Open question: why is \Macro\Gin@esetsize not called?
%    \begin{macrocode}
\define@key\adjbox@fam{reflect}[]{%
    \adjbox@scale@xy{-1}{1}\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{rotate}
% New alias of existing |angle| key.
%    \begin{macrocode}
\expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle
%    \end{macrocode}
% \end{key}
%
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Horizontal alignment keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{macro}{\adjbox@halign}[3]{<official width>}{<aligner left>}{<aligner right>}
%    \begin{macrocode}
\def\adjbox@halign#1#2#3{%
    \@collectbox{\@adjbox@halign{#1}{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@adjbox@halign}[3]{<official width>}{<aligner left>}{<aligner right>}
%    \begin{macrocode}
\def\@adjbox@halign#1#2#3{%
    \begingroup
    \adjsetlength\@tempdima{#1}%
    \leavevmode\hb@xt@\the\@tempdima{#2\BOXCONTENT#3}%
    \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{key}{adjbox}{center}[1]{<official width>}
%    \begin{macrocode}
\define@adjboxkey@defvalue{center}{\linewidth}{\adjbox@halign{#1}\hss\hss}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{left}[1]{<official width>}
%    \begin{macrocode}
\define@adjboxkey@defvalue{left}{\linewidth}{\adjbox@halign{#1}\relax\hss}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{right}[1]{<official width>}
%    \begin{macrocode}
\define@adjboxkey@defvalue{right}{\linewidth}{\adjbox@halign{#1}\hss\relax}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\centerbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\centerbox[1][\linewidth]{%
    \collectboxcheckenv{centerbox}%
    \noindent
    \adjbox@halign{#1}\hss\hss
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\leftalignbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\leftalignbox[1][\linewidth]{%
    \collectboxcheckenv{leftalignbox}%
    \noindent
    \adjbox@halign{#1}\relax\hss
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\rightalignbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\rightalignbox[1][\linewidth]{%
    \collectboxcheckenv{rightalignbox}%
    \noindent
    \adjbox@halign{#1}\hss\relax
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{outer}[1]{<official width>}
%    \begin{macrocode}
\define@adjboxkey@defvalue{outer}{\linewidth}{%
    \outersidebox[{#1}]%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{inner}[1]{<official width>}
%    \begin{macrocode}
\define@adjboxkey@defvalue{inner}{\linewidth}{%
    \innersidebox[{#1}]%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\outersidebox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\outersidebox[1][\linewidth]{%
    \collectboxcheckenv{outersidebox}%
    \noindent
    \adjbox@halign{#1}{%
        \checkoddpage
        \ifoddpageoroneside
            \hss
        \else
            \relax
        \fi
    }{%
        \ifoddpageoroneside
            \relax
        \else
            \hss
        \fi
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\innersidebox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\innersidebox[1][\linewidth]{%
    \collectboxcheckenv{innersidebox}%
    \noindent
    \adjbox@halign{#1}{%
        \checkoddpage
        \ifoddpageoroneside
            \relax
        \else
            \hss
        \fi
    }{%
        \ifoddpageoroneside
            \hss
        \else
            \relax
        \fi
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{pagecenter}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{pagecenter}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\pagecenterbox[{#1}]}%
}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{pageleftalign}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{pageleftalign}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\pageleftalignbox[{#1}]}%
}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{pagerightalign}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{pagerightalign}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\pagerightalignbox[{#1}]}%
}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{pageinner}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{pageinner}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\pageinnerbox[{#1}]}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{pageouter}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{pageouter}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\pageouterbox[{#1}]}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{textareacenter}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{textareacenter}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\textareacenterbox[{#1}]}%
}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{textarealeftalign}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{textarealeftalign}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\textarealeftalignbox[{#1}]}%
}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{textarearightalign}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{textarearightalign}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\textarearightalignbox[{#1}]}%
}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{textareainner}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{textareainner}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\textareainnerbox[{#1}]}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{textareaouter}[1]{<official width>}
%    \begin{macrocode}
\define@key\adjbox@fam{textareaouter}[\linewidth]{%
    \noindent\leavevmode
    \adjbox@Gin@Add{\textareaouterbox[{#1}]}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\pagecenterbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\pagecenterbox[1][\linewidth]{%
    \collectboxcheckenv{pagecenterbox}%
    \noindent\leavevmode\checkoddpage
    \@collectbox{\@pagecenterbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi+.5\paperwidth-.5\@tempdimc-\@totalleftmargin}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@pagecenterbox}[2]{<official width>}{<lap amount>}
%    \begin{macrocode}
\def\@pagecenterbox#1#2{%
    \adjsetlength\@tempdimc{#1}%
    \ifdim\@tempdimc<\z@
        \@tempdimc=\z@
    \fi
    \adjsetlength\@tempdima{#2}%
    \ifdim\@tempdima<\z@
        \@tempdimb=-\@tempdima
    \else
        \@tempdimb=\@tempdima
    \fi
    \ifdim\@tempdima<\z@
        \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}\hss}\hskip\@tempdimc}%
    \else
        \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}}\hss}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\textareacenterbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\textareacenterbox[1][\linewidth]{%
    \collectboxcheckenv{textareacenterbox}%
    \noindent\leavevmode
    \@collectbox{\@pagecenterbox{#1}{-\@totalleftmargin+.5\textwidth-.5\linewidth}}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\pageleftalignbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\pageleftalignbox[1][\linewidth]{%
    \collectboxcheckenv{pageleftalignbox}%
    \noindent\leavevmode\checkoddpage
    \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin}}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\pagerightalignbox}[1]{<official width>}
% Note: \Macro\@tempdimc holds the official width inside \Macro\@lapbox.
%    \begin{macrocode}
\newcommand\pagerightalignbox[1][\linewidth]{%
    \collectboxcheckenv{pagerightalignbox}%
    \noindent\leavevmode\checkoddpage
    \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin+\paperwidth-(#1)}}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\textarealeftalignbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\textarealeftalignbox[1][\linewidth]{%
    \collectboxcheckenv{textarealeftalignbox}%
    \noindent\leavevmode\checkoddpage
    \@collectbox{\@textarealeftalignbox{#1}}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\@textarealeftalignbox}[1]{<official width>}
%    \begin{macrocode}
\def\@textarealeftalignbox#1{%
    \adjsetlength\@tempdima{\@totalleftmargin}%
    \adjsetlength\@tempdimc{#1}%
    \ifdim\@tempdimc<\z@
        \@tempdimc=\z@
    \fi
    \leavevmode
    \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdima{\usebox\collectedbox\hss}\hskip\@tempdimc}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\textarearightalignbox}[1]{<official width>}
%    \begin{macrocode}
\newcommand\textarearightalignbox[1][\linewidth]{%
    \collectboxcheckenv{textarearightalignbox}%
    \noindent\leavevmode\checkoddpage
    \@collectbox{\@textarearightalignbox{#1}{+\textwidth}}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{\@textarearightalignbox}[1]{<official width>}
%    \begin{macrocode}
\def\@textarearightalignbox#1#2{%
    \adjsetlength\@tempdimc{#1}%
    \ifdim\@tempdimc<\z@
        \@tempdimc=\z@
    \fi
    \adjsetlength\@tempdima{-\@totalleftmargin+\textwidth-\@tempdimc}%
    \ifdim\@tempdima<\z@
        \@tempdima=-\@tempdima
    \fi
    \leavevmode
    \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdima{\hss\usebox\collectedbox}\hss}%
}
%    \end{macrocode}
% \end{macro}%
%
%
% \begin{macro}{pageinnerbox}
%    \begin{macrocode}
\newcommand\pageinnerbox{%
    \noindent\leavevmode\checkoddpage
    \ifoddpageoroneside
        \expandafter\pageleftalignbox
    \else
        \expandafter\pagerightalignbox
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{pageouterbox}
%    \begin{macrocode}
\newcommand\pageouterbox{%
    \noindent\leavevmode\checkoddpage
    \ifoddpageoroneside
        \expandafter\pagerightalignbox
    \else
        \expandafter\pageleftalignbox
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{textareaouterbox}
%    \begin{macrocode}
\newcommand\textareainnerbox{%
    \noindent\leavevmode\checkoddpage
    \ifoddpageoroneside
        \expandafter\textarealeftalignbox
    \else
        \expandafter\textarearightalignbox
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{textareaouterbox}
%    \begin{macrocode}
\newcommand\textareaouterbox{%
    \noindent\leavevmode\checkoddpage
    \ifoddpageoroneside
        \expandafter\textarearightalignbox
    \else
        \expandafter\textarealeftalignbox
    \fi
}%
%    \end{macrocode}
% \end{macro}%
%
%
%    \begin{macrocode}
\IfFileExists{ifoddpage.sty}{%
    \RequirePackage{ifoddpage}%
}{%
    \def\checkoddpage{%
        \PackageError{adjustbox}{%
                The used key, macro or environment requires \MessageBreak
                the 'ifoddpage' package which is not installed!}{}%
    }
}%
%    \end{macrocode}
%
%
% \begin{key}{adjbox}{noindent}
%    \begin{macrocode}
\define@key\adjbox@fam{noindent}[]{%
    \noindent
}
%    \end{macrocode}
% \end{key}%
%
% \begin{key}{adjbox}{leavevmode}
%    \begin{macrocode}
\define@key\adjbox@fam{leavevmode}[]{%
    \leavevmode
}
%    \end{macrocode}
% \end{key}%
%
% \begin{macro}{\adjbox@fam}{process}
%    \begin{macrocode}
\define@key\adjbox@fam{process}[]{%
    \sbox\collectedbox{\adjbox@esetsize\the\toks@}%
    \collectbox@setdims
    \def\adjustbox@content{\usebox\collectedbox}%
    \toks@{{\adjustbox@content}}
}
%    \end{macrocode}
% \end{macro}
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Vertical alignment keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{raise}
%    \begin{macrocode}
\define@key\adjbox@fam{raise}{%
    \@ifnextchar\bgroup{%
        \adjbox@raise
    }{%
        \adjbox@raise{#1}{}{}%
    }#1{}{}{}\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@raise}
%    \begin{macrocode}
\def\adjbox@raise#1#2#3#4\@nnil{%
    \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@raisebox}[3]{raise amount}{height}{depth}
%    \begin{macrocode}
\def\adjbox@raisebox#1#2#3{%
    \@collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@@raisebox}[3]{raise amount}{height}{depth}
%    \begin{macrocode}
\def\adjbox@@raisebox#1#2#3{%
    \ifx\@nnil#1\@nnil
        \setbox\@tempboxa\copy\collectedbox
    \else
        \adjsetlength\@tempdima{#1}%
        \setbox\@tempboxa\hbox{\raise\@tempdima\copy\collectedbox}%
    \fi
    \ifx\@nnil#2\@nnil\else
        \adjsetlength\@tempdima{#2}%
        \ht\@tempboxa\@tempdima
    \fi
    \ifx\@nnil#3\@nnil\else
        \adjsetlength\@tempdima{#3}%
        \dp\@tempboxa\@tempdima
    \fi
    \leavevmode
    \box\@tempboxa
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{valign}
%    \begin{macrocode}
\define@key\adjbox@fam{valign}{%
    \expandafter\adjbox@Gin@Add\expandafter{\csname adjbox@valign@#1\endcsname}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjboxvtop}
%    \begin{macrocode}
\def\adjboxvtop{\ht\strutbox}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\adjboxvcenter}
%    \begin{macrocode}
\def\adjboxvcenter{1ex}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\adjboxvbottom}
%    \begin{macrocode}
\def\adjboxvbottom{-\dp\strutbox}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@t}
%    \begin{macrocode}
\def\adjbox@valign@t{%
    \adjbox@raisebox{-\height+\adjboxvtop}{}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@T}
%    \begin{macrocode}
\def\adjbox@valign@T{%
    \adjbox@raisebox{-\height}{}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@M}
%    \begin{macrocode}
\def\adjbox@valign@M{%
    \adjbox@raisebox{.5\depth-.5\height}{}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@m}
%    \begin{macrocode}
\def\adjbox@valign@m{%
    \adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@c}
%    \begin{macrocode}
\def\adjbox@valign@c#1{%
    \leavevmode
    \hbox{%
        $\vcenter{\hbox{#1}}\m@th$%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@b}
%    \begin{macrocode}
\def\adjbox@valign@b{%
    \adjbox@raisebox{\depth+\adjboxvbottom}{}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@B}
%    \begin{macrocode}
\def\adjbox@valign@B{%
    \adjbox@raisebox{\depth}{}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Set vertical sizes} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{set height}
%    \begin{macrocode}
\define@adjboxkey{set height}{\adjbox@raisebox{}{#1}{}}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{set depth}
%    \begin{macrocode}
\define@adjboxkey{set depth}{\adjbox@raisebox{}{}{#1}}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{set vsize}
% Uses the same code like \Key{raise} but with the raise value of 0pt,
% i.e.\ only sets the height and depth.
%    \begin{macrocode}
\define@adjboxkey{set vsize}{\adjbox@raisebox{}#1}
%    \end{macrocode}
% \end{key}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Vertical spacing} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{vspace}
%    \begin{macrocode}
\define@key\adjbox@fam{vspace}{%
    \adjbox@vskip#1 {} \@nnil{}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{vspace*}
%    \begin{macrocode}
\define@key\adjbox@fam{vspace*}{%
    \adjbox@vskip#1 {} \@nnil*%
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@vskip}
%    \begin{macrocode}
\def\adjbox@vskip#1 #2 #3\@nnil#4{%
    \ifx\@nnil#2\@nnil
        \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#1}}%
    \else
        \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#2}}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Minimum and maximum size keys and macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{min width}
%    \begin{macrocode}
\define@adjboxkey{min width}{\@minsizebox\height{#1}!}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max width}
%    \begin{macrocode}
\define@adjboxkey{max width}{\@maxsizebox\height{#1}!}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min height}
%    \begin{macrocode}
\define@adjboxkey{min height}{\@minsizebox\height!{#1}}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max height}
%    \begin{macrocode}
\define@adjboxkey{max height}{\@maxsizebox\height!{#1}}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min totalheight}
%    \begin{macrocode}
\define@adjboxkey{min totalheight}{\@minsizebox\totalheight!{#1}}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max totalheight}
%    \begin{macrocode}
\define@adjboxkey{max totalheight}{\@maxsizebox\totalheight!{#1}}
%    \end{macrocode}
% \end{key}
%
%
%
% \begin{macro}{\adjbox@Gin@sizeadd}
% Checks if key-value is actually two arguments. If not it is doubled.
% E.g.: \verb+min size=\A+ is the same as  \verb+min size={\A}{\A}+
%    \begin{macrocode}
\def\adjbox@Gin@sizeadd#1#2\@nnil{%
    \@ifnextchar\bgroup{%
        \adjbox@Gin@Add{#1#2}%
        \remove@to@nnil
    }{%
        \adjbox@Gin@Add{#1{#2}{#2}}%
        \remove@to@nnil
    }#2\@nnil
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{min size}
%    \begin{macrocode}
\define@key\adjbox@fam{min size}{%
    \adjbox@Gin@sizeadd{\@minsizebox\height}#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max size}
%    \begin{macrocode}
\define@key\adjbox@fam{max size}{%
    \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min totalsize}
%    \begin{macrocode}
\define@key\adjbox@fam{min totalsize}{%
    \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max totalsize}
%    \begin{macrocode}
\define@key\adjbox@fam{max totalsize}{%
    \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{warn width}
%    \begin{macrocode}
\define@adjboxkey@defvalue{warn width}{\linewidth}{\@Collectbox{\adjbox@warnwidth{#1}}}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@warnwidth}
% Warn if width is wider than the given width plus |\hfuzz|.
%    \begin{macrocode}
\def\adjbox@warnwidth#1{%
        \@tempdima=#1\relax
        \advance\@tempdima by -\width
        \@tempdima=-\@tempdima
        \ifdim\@tempdima>\hfuzz
            \typeout{Overfull \string\hbox\space (\the\@tempdima\space too wide) in adjustbox at
                \ifnum\adjbox@line=\inputlineno
                    line \adjbox@line
                \else
                    lines \adjbox@line--\the\inputlineno
                \fi
            }%
        \fi
        \BOXCONTENT
}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\minsizebox}
%    \begin{macrocode}
\newcommand*\minsizebox{%
    \collectboxcheckenv{minsizebox}%
    \@ifstar{\@minsizebox\totalheight}{\@minsizebox\height}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{minsizebox*}
%    \begin{macrocode}
\expandafter\newcommand\expandafter*\csname minsizebox*\endcsname{%
    \@collectboxisenv{minsizebox*}%
    \@minsizebox\totalheight
}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\@minsizebox}
%    \begin{macrocode}
\newcommand*\@minsizebox[3]{%
    \@collectbox{\@minmaxsizebox>#1{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\maxsizebox}
%    \begin{macrocode}
\newcommand*\maxsizebox{%
    \collectboxcheckenv{maxsizebox}%
    \@ifstar{\@maxsizebox\totalheight}{\@maxsizebox\height}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{maxsizebox*}
%    \begin{macrocode}
\expandafter\newcommand\expandafter*\csname maxsizebox*\endcsname{%
    \@collectboxisenv{maxsizebox*}%
    \@maxsizebox\totalheight
}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\@maxsizebox}
%    \begin{macrocode}
\newcommand*\@maxsizebox[3]{%
    \@collectbox{\@minmaxsizebox<#1{#2}{#3}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@minmaxsizebox}[4]{Compare sign \texttt{<} or \texttt{>}}{\cs{height} or \cs{totalheight}}{width}{height}
% Used for all min/max-size boxes including the starred version. The first two arguments determine the style.
%
% The width and height values are expanded to allow for \Macro\ifdim or similar conditionals.
%    \begin{macrocode}
\newcommand*\@minmaxsizebox[4]{%
    \edef\@tempa{#3}%
    \edef\@tempb{#4}%
    \ifx\@tempa\Gin@exclamation\else
        \adjsetlength\@tempdima{#3}%
    \fi
    \ifx\@tempb\Gin@exclamation\else
        \adjsetlength\@tempdimb{#4}%
    \fi
    \ifcase0%
%    \end{macrocode}
% Do nothing if both values are `|!|', otherwise use case 1 if the height is to large/small (|#1|)
% than the \Macro\height or \Macro\totalheight (|#2|).
%    \begin{macrocode}
    \ifx\@tempa\Gin@exclamation
        \ifx\@tempb\Gin@exclamation
        \else
            \ifdim\@tempdimb#1#2%
                1%
            \fi
        \fi
    \else
%    \end{macrocode}
% If the width is given, but not the height, use case 2 if the width is to large/small (|#1|) than the native \Macro\width.
%    \begin{macrocode}
        \ifx\@tempb\Gin@exclamation
            \ifdim\@tempdima#1\width
                2%
            \fi
        \else
%    \end{macrocode}
% If both values are given.
% Use case 0-3 depending if the width and/or height is to large/small.
%    \begin{macrocode}
            \ifdim\@tempdima#1\width
                \ifdim\@tempdimb#1#2%
                    3%
                \else
                    2%
                \fi
            \else
                \ifdim\@tempdimb#1#2%
                    1%
                \fi
            \fi
        \fi
    \fi
%    \end{macrocode}
%  Case 0: no scaling is needed. Insert content unchanged.
%    \begin{macrocode}
    \relax% 0
        \BOXCONTENT
%    \end{macrocode}
%  Case 1: height needs scaling. Calculate factor and scale the content with it.
%    \begin{macrocode}
    \or
        \Gscale@div\@tempa\@tempdimb#2%
        \Gscale@box\@tempa[\@tempa]\BOXCONTENT
%    \end{macrocode}
%  Case 2: width needs scaling. Calculate factor and scale the content with it.
%    \begin{macrocode}
    \or
        \Gscale@div\@tempa\@tempdima\width
        \Gscale@box\@tempa[\@tempa]\BOXCONTENT
%    \end{macrocode}
%  Case 3: both width and height need scaling.
%  Both scale factors are calculated and the more extreme value is used.
%    \begin{macrocode}
    \or
        \Gscale@div\@tempa\@tempdima\width
        \Gscale@div\@tempb\@tempdimb#2%
        \ifdim\@tempa\p@#1\@tempb\p@
            \let\@tempb\@tempa
        \else
            \let\@tempa\@tempb
        \fi
        \Gscale@box\@tempa[\@tempb]\BOXCONTENT
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Frame keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{key}{adjbox}{frame}
% As 0--3 arguments: rule width, (inner) separation and margin.
%    \begin{macrocode}
\define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
    \adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{fbox}
% Same as \Key{frame} but with different default separation.
%    \begin{macrocode}
\define@key\adjbox@fam{fbox}[{{\fboxrule}}]{%
    \adjbox@frame{}#1 {} {} {} \relax\relax\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@frame}
%    \begin{macrocode}
\def\adjbox@frame#1#2 #3 #4 #5\relax{%
    \adjbox@Gin@Add{%
        \@Collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}%
    }%
    \remove@to@nnil
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{cframe}
%    \begin{macrocode}
\define@key\adjbox@fam{cframe}{%
    \adjbox@checkcolor
    \adjbox@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{cfbox}
%    \begin{macrocode}
\define@key\adjbox@fam{cfbox}{%
    \adjbox@checkcolor
    \adjbox@cframe{}#1 {} {} {} \relax\relax\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@cframe}
%    \begin{macrocode}
\def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{%
    \adjbox@Gin@Add{%
        \@Collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}%
    }%
    \remove@to@nnil
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@checkcolor}
%    \begin{macrocode}
\def\adjbox@checkcolor{%
    \ifcase0%
        \expandafter\ifx\csname ver@xcolor.sty\endcsname\relax
        \expandafter\ifx\csname ver@color.sty\endcsname\relax
        \expandafter\ifx\csname ver@xxcolor.sty\endcsname\relax 1\fi\fi\fi
    \relax
        \global\let\adjbox@checkcolor\relax
    \else
        \PackageError{adjustbox}{Using a macro, environment or key with color\MessageBreak
                requires a color package to be loaded manually.\MessageBreak
                Recommended is 'xcolor' but 'color' is ok, too}{}.
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@@frame}[4]{content}{rule width}{separation}{margin}
%    \begin{macrocode}
\def\adjbox@@frame#1#2#3#4{%
    \leavevmode
    \ifx\@nnil#2\@nnil\else
        \adjsetlength\fboxrule{#2}%
    \fi
    \ifx\@nnil#3\@nnil\else
        \adjsetlength\fboxsep{#3}%
    \fi
    \adjsetlength\tc@llx{\fboxrule + \fboxsep}%
    \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
    \ifx\@nnil#4\@nnil\else
      \setbox\collectedbox
    \fi
      \hbox\bgroup\color@setgroup
        \BOXCONTENT
        \hskip-\width
        #1%
        \adjbox@boxframe\width\height\depth
      \color@endgroup\egroup
    \ifx\@nnil#4\@nnil\else
      \adjsetlength\tc@llx{#4}%
      \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
      \BOXCONTENT
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@boxframe}[3]{width}{height}{depth}
% Tries to reuse the definition of the \pkg{xcolor} package.
% If it isn't loaded its definition is defined here.
%
% This code was taken from the \pkg{xcolor} package under the free LPPL license.
%    \begin{macrocode}
\let\adjbox@boxframe\boxframe
\providecommand\adjbox@boxframe[3]{%
    \hbox{%
        \dimen@ #2%
        \advance \dimen@ #3\relax
        \lower #3\vbox {%
            \hrule \@height \fboxrule
            \@tempdima -0.5\fboxrule
            \ifodd\fboxrule
                \advance \@tempdima \m@ne sp
            \fi
            \kern \@tempdima
            \hbox {%
                \advance \dimen@ -\fboxrule
                \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
                \@tempdima #1%
                \advance \@tempdima -\tw@ \fboxrule
                \kern \@tempdima
                \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
            }%
            \kern -0.5\fboxrule
            \hrule \@height \fboxrule
        }%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Density keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{dpi}
%    \begin{macrocode}
\define@key\adjbox@fam{dpi}{%
    \adjsetlength\pdfpxdimen{1in/(#1)}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{pxdim}
%    \begin{macrocode}
\define@key\adjbox@fam{pxdim}{%
    \adjsetlength\pdfpxdimen{#1}%
}
%    \end{macrocode}
% \end{key}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Code keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    \begin{macrocode}
\define@key\adjbox@fam{execute}{%
    #1%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key\adjbox@fam{@debug}[]{%
    \showthe\toks@
}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key{ADJBOX}{Execute}{%
    #1%
}
%    \end{macrocode}
%
%
% \begin{key}{adjbox}{addcode}
% Adds code before and after the current boxed content.
% Syntax:~\Key{addcode}'='{<code before>}{<code afterwards>}
%    \begin{macrocode}
\define@key{adjbox}{Addcode}{%
    \adjust@@addcode#1{}\@nnil%
}
\define@key{adjbox}{addcode}{%
    \Gin@esetsize
    \@tempswatrue
    \adjust@@addcode#1{}\@nnil%
}
\long\def\adjust@@addcode#1#2#3\@nnil{%
    \ifx\@nnil#3\@nnil
        \adjust@addcode{#1}{#2}%
    \else
        \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
    \fi
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{precode}
%    \begin{macrocode}
\define@key{adjbox}{precode}{%
    \Gin@esetsize
    \@tempswatrue
    \adjust@addcode{#1}{}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{Precode}
% Same as \Key{precode} but does not set the size yet.
%    \begin{macrocode}
\define@key{adjbox}{Precode}{%
    \adjust@addcode{#1}{}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{appcode}
%    \begin{macrocode}
\define@key{adjbox}{appcode}{%
    \toks@\expandafter{\the\toks@#1}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjust@addcode}
%    \begin{macrocode}
\long\def\adjust@addcode#1#2{%
    \def\@tempa{#1}%
    \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{env}
% Adds environment around boxed content
%    \begin{macrocode}
\define@key\adjbox@fam{env}{%
    \@ifnextchar\bgroup{%
        \adjbox@addenv
    }{%
        \adjbox@addenv{#1}\@nnil%
        \remove@to@nnil
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjust@addenv}
%    \begin{macrocode}
\def\adjbox@addenv#1#2\@nnil{%
    \def\@tempa{\begin{#1}#2}%
    \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
}%
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Background keys and macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{ADJBOX}{color}
% Sets the foreground color, i.e.\ the color used for the content.
% |#1| are the argument to color, i.e. either \MacroArgs<color>
% or \MacroArgs{<model>}{<color>}.
%    \begin{macrocode}
\define@key{ADJBOX}{color}{%
    \adjbox@checkcolor
    \@ifnextchar\bgroup{%
        \adjbox@color
    }{%
        \adjbox@color{}{#1}%
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@color}
% Check for the optional color argument.
%    \begin{macrocode}
\def\adjbox@color#1#2#3\@nnil{%
    \ifx\@nnil#1\@nnil
        \color{#2}%
    \else
        \color[{#1}]{#2}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{key}{ADJBOX}{color*}
% Sets the color using a given color command.
%    \begin{macrocode}
\define@key{ADJBOX}{color*}{%
    #1%
}
%    \end{macrocode}
% \end{key}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{fgcolor}
% Changes the foreground color.
% |#1| are the argument to color, i.e. either \MacroArgs<color>
% or \MacroArgs{<model>}{<color>}.
%    \begin{macrocode}
\define@key{ADJBOX}{fgcolor}{%
    \adjbox@checkcolor
    \@ifnextchar\bgroup{%
        \adjbox@fgcolor
    }{%
        \adjbox@fgcolor{}{#1}%
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@fgcolor}
% Parses the two possible arguments and adds the color macro
% to the token register.
%    \begin{macrocode}
\def\adjbox@fgcolor#1#2#3\@nnil{%
    \ifx\@nnil#1\@nnil
        \adjbox@innercode{\color{#2}}{}%
    \else
        \adjbox@innercode{\color[{#1}]{#2}}{}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{key}{adjbox}{fgcolor*}
% Adds a colored box in the background. It awaits a direct color macro,
% which gives the user more flexibility.
%    \begin{macrocode}
\define@key{ADJBOX}{fgcolor*}{%
    \adjbox@checkcolor
    \adjbox@innercode{#1}{}%
}
%    \end{macrocode}
% \end{key}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{bgcolor}
% Adds a colored box in the background.
% |#1| are the argument to color, i.e. either \MacroArgs<color>
% or \MacroArgs{<model>}{<color>}.
%    \begin{macrocode}
\define@key\adjbox@fam{bgcolor}{%
    \adjbox@checkcolor
    \@ifnextchar\bgroup{%
        \adjbox@bgcolor
    }{%
        \adjbox@bgcolor{}{#1}%
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@bgcolor}
% Parses the two possible arguments and adds the background color macro
% to the token register.
%    \begin{macrocode}
\def\adjbox@bgcolor#1#2#3\@nnil{%
    \ifx\@nnil#1\@nnil
        \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color{#2}}}}%
    \else
        \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color[#1]{#2}}}}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{bgcolor*}
% Adds a colored box in the background. It awaits a direct color macro,
% which gives the user more flexibility.
%    \begin{macrocode}
\define@key\adjbox@fam{bgcolor*}{%
    \adjbox@checkcolor
    \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{#1}}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\@bgcolorbox}
% This places a colored box (vrule) with the same dimensions than
% the content, then compensates for the horizontal shift and places
% the content. This is simpler and more direct than using \Macro\rlap
% or a box macro from the \pkg{xcolor} package.
%
% The argument contains the color macro, e.g.\ \Macro\color{<color>}.
%    \begin{macrocode}
\def\@bgcolorbox#1{%
    \leavevmode
    \hbox{%
        \hbox{%
            #1%
            \vrule\@width\width\@height\height\@depth\depth%
        }%
        \hskip-\width
        \BOXCONTENT
    }%
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\bgcolorbox}
%    \begin{macrocode}
\expandafter\newcommand\expandafter\bgcolorbox\expandafter{%
    \expandafter
    \@ifstar
        \csname bgcolorbox*\endcsname
        \bgcolorbox@
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\bgcolorbox@}
%    \begin{macrocode}
\newcommand\bgcolorbox@[2][\@nnil]{%
    \collectboxcheckenv{bgcolorbox}%
    \ifx\@nnil#1\relax
        \expandafter\@firstoftwo
    \else
        \expandafter\@secondoftwo
    \fi
    {\@collectbox{\@bgcolorbox{\color{#2}}}}%
    {\@collectbox{\@bgcolorbox{\color[#1]{#2}}}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{bgcolorbox*}
%    \begin{macrocode}
\@namedef{bgcolorbox*}#1{%
    \collectboxcheckenv{bgcolorbox*}%
    \@collectbox{\@bgcolorbox{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\fgimagebox}
%    \begin{macrocode}
\expandafter\newcommand\expandafter\fgimagebox\expandafter{%
    \expandafter
    \@ifstar
        \csname fgimagebox*\endcsname
        \fgimagebox@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fgimagebox@}
%    \begin{macrocode}
\newcommand\fgimagebox@[2][]{%
    \collectboxcheckenv{fgimagebox}%
    \@collectbox{\@foregroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{fgimagebox*}
%    \begin{macrocode}
\expandafter\newcommand\csname fgimagebox*\endcsname[2][]{%
    \collectboxcheckenv{fgimagebox*}%
    \@collectbox{\@foregroundbox\adjustimage{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{key}{adjbox}{fgimage}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{fgimage}{%
    \@ifnextchar\bgroup{%
        \adjbox@fgimage
    }{%
        \adjbox@fgimage{}{#1}%
    }#1{}\@nnil
    {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{fgimage*}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{fgimage*}{%
    \@ifnextchar\bgroup{%
        \adjbox@fgimage
    }{%
        \adjbox@fgimage{}{#1}%
    }#1{}\@nnil{}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@fgimage}
%    \begin{macrocode}
\def\adjbox@fgimage#1#2#3\@nnil#4{%
    \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustimage{#1#4}{#2}}}%
}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\bgimagebox}
%    \begin{macrocode}
\expandafter\newcommand\expandafter\bgimagebox\expandafter{%
    \expandafter
    \@ifstar
        \csname bgimagebox*\endcsname
        \bgimagebox@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bgimagebox@}
%    \begin{macrocode}
\newcommand\bgimagebox@[2][]{%
    \collectboxcheckenv{bgimagebox}%
    \@collectbox{\@backgroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{bgimagebox*}
%    \begin{macrocode}
\expandafter\newcommand\csname bgimagebox*\endcsname[2][]{%
    \collectboxcheckenv{bgimagebox*}%
    \@collectbox{\@backgroundbox\adjustimage{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{key}{adjbox}{bgimage}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{bgimage}{%
    \@ifnextchar\bgroup{%
        \adjbox@bgimage
    }{%
        \adjbox@bgimage{}{#1}%
    }#1{}\@nnil
    {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{bgimage*}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{bgimage*}{%
    \@ifnextchar\bgroup{%
        \adjbox@bgimage
    }{%
        \adjbox@bgimage{}{#1}%
    }#1{}\@nnil{}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@bgimage}
%    \begin{macrocode}
\def\adjbox@bgimage#1#2#3\@nnil#4{%
    \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustimage{#1#4}{#2}}}%
}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{foreground}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{foreground}{%
    \@ifnextchar\bgroup{%
        \adjbox@foreground
    }{%
        \adjbox@foreground{}{#1}%
    }#1{}{}\@nnil
    {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{foreground*}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{foreground*}{%
    \@ifnextchar\bgroup{%
        \adjbox@foreground
    }{%
        \adjbox@foreground{}{#1}%
    }#1{}{}\@nnil{}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@foreground}
%    \begin{macrocode}
\def\adjbox@foreground#1#2#3\@nnil#4{%
    \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustbox{#1#4}{#2}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@foregroundbox}
%    \begin{macrocode}
\def\@foregroundbox#1#2#3{%
    \leavevmode
    \hbox to \width{%
        \BOXCONTENT
        \hskip-\width
        \hss
        \adjbox@parentdims
        #1{#2}{#3}%
        \hss
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\foregroundbox}
%    \begin{macrocode}
\expandafter\newcommand\expandafter\foregroundbox\expandafter{%
    \expandafter
    \@ifstar
        \csname foregroundbox*\endcsname
        \foregroundbox@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\foregroundbox@}
%    \begin{macrocode}
\newcommand\foregroundbox@[2][]{%
    \collectboxcheckenv{foregroundbox}%
    \@collectbox{\@foregroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{foregroundbox*}
%    \begin{macrocode}
\expandafter\newcommand\csname foregroundbox*\endcsname[2][]{%
    \collectboxcheckenv{foregroundbox*}%
    \@collectbox{\@foregroundbox\adjustbox{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{background}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{background}{%
    \@ifnextchar\bgroup{%
        \adjbox@background
    }{%
        \adjbox@background{}{#1}%
    }#1{}{}\@nnil
    {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{background*}
% One or two arguments, the first optional one are further \Macro\includegraphics keys.
%    \begin{macrocode}
\define@key{adjbox}{background*}{%
    \@ifnextchar\bgroup{%
        \adjbox@background
    }{%
        \adjbox@background{}{#1}%
    }#1{}{}\@nnil{}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@background}
%    \begin{macrocode}
\def\adjbox@background#1#2#3\@nnil#4{%
    \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustbox{#1#4}{#2}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@backgroundbox}
%    \begin{macrocode}
\def\@backgroundbox#1#2#3{%
    \leavevmode
    \hbox to \width{%
        \hss
        \adjbox@parentdims
        #1{#2}{#3}%
        \hss
        \hskip-\width%
        \BOXCONTENT
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\backgroundbox}
%    \begin{macrocode}
\expandafter\newcommand\expandafter\backgroundbox\expandafter{%
    \expandafter
    \@ifstar
        \csname backgroundbox*\endcsname
        \backgroundbox@
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\backgroundbox@}
%    \begin{macrocode}
\newcommand\backgroundbox@[2][]{%
    \collectboxcheckenv{backgroundbox}%
    \@collectbox{\@backgroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{backgroundbox*}
%    \begin{macrocode}
\expandafter\newcommand\csname backgroundbox*\endcsname[2][]{%
    \collectboxcheckenv{backgroundbox*}%
    \@collectbox{\@backgroundbox\adjustbox{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Lapping keys and macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{lap}
%    \begin{macrocode}
\define@key\adjbox@fam{lap}{%
    \@ifnextchar\bgroup{%
        \adjbox@lapbox
    }{%
        \adjbox@lapbox{#1}{}%
    }#1{}{}\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@lapbox}
%    \begin{macrocode}
\def\adjbox@lapbox#1#2#3\@nnil{%
    \ifx\@nnil#2\@nnil
        \adjbox@Gin@Add{\lapbox{#1}}%
    \else
        \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{rlap}
%    \begin{macrocode}
\define@key\adjbox@fam{rlap}[]{%
    \adjbox@Gin@Add{\lapbox{\width}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{llap}
%    \begin{macrocode}
\define@key\adjbox@fam{llap}[]{%
    \adjbox@Gin@Add{\lapbox{-\width}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{clap}
%    \begin{macrocode}
\define@key\adjbox@fam{clap}[]{%
    \adjbox@Gin@Add{\lapbox[0pt]{-0.5\width}}%
}
%    \end{macrocode}
% \end{key}%
%
% \begin{macro}{\lapbox}
%    \begin{macrocode}
\newcommand*\lapbox[2][\width-\@tempdimb]{%
    \collectboxcheckenv{lapbox}%
    \@collectbox{\@lapbox{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@lapbox}
%    \begin{macrocode}
\def\@lapbox#1#2{%
    \adjsetlength\@tempdima{#2}%
    \ifdim\@tempdima<\z@
        \@tempdimb=-\@tempdima
    \else
        \@tempdimb=\@tempdima
    \fi
    \adjsetlength\@tempdimc{#1}%
    \ifdim\@tempdimc<\z@
        \@tempdimc=\z@
    \fi
    \leavevmode
    \ifdim\@tempdima<\z@
        \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\usebox\collectedbox\hss}\hskip\@tempdimc}%
    \else
        \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Keys for minibox and varwidth} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{ADJBOX}{minipage}
%    \begin{macrocode}
\define@key{ADJBOX}{minipage}{%
    \adjbox@page{minipage}{#1}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{ADJBOX}{varwidth}
%    \begin{macrocode}
\define@key{ADJBOX}{varwidth}{%
    \adjbox@page{varwidth}{#1}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@page}
% If the value starts with "[" or "{" take the value as it is,
% otherwise assume that is a single length expression and add the required "{ }".
%    \begin{macrocode}
\def\adjbox@page#1#2{%
    \@ifnextchar[{%
        \adjbox@@page{#1}%
    }{%
        \@ifnextchar\bgroup{%
            \adjbox@@page{#1}%
        }{%
            \adjbox@@page{#1}{{#2}}\@nnil%
            \remove@to@nnil
        }%
    }#2\@nnil
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@@page}
% Sets collect-box command to use \env{minipage} or similar environment.
%
% The \Macro\setlength macro is change temporary for the \env{minipage} or \env{varwidth} environment.
%    \begin{macrocode}
\def\adjbox@@page#1#2\@nnil{%
    \adjbox@innercode
        {\adjbox@set\begin{#1}#2\adjbox@reset\ignorespaces}%
        {\end{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@set}
% Sets \Macro\setlength to \pkg{adjcalc} version.
%    \begin{macrocode}
\def\adjbox@set{%
    \let\adjbox@origsetlength\setlength
    \def\setlength{\adjsetlength}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@reset}
% Resets \Macro\setlength to normal version.
%    \begin{macrocode}
\def\adjbox@reset{%
    \let\setlength\adjbox@origsetlength
}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Stackbox keys and macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{macro}{\stackbox}
%    \begin{macrocode}
\newcommand*\stackbox[1][c]{%
    \collectboxcheckenv{stackbox}%
    \@ifnextchar[%]
        {\@stackbox{#1}}%
        {\@@stackbox{#1}{b}[]}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@stackbox}
% Read the third optional argument
%    \begin{macrocode}
\def\@stackbox#1[#2]{%
    \@testopt{\@@stackbox{#1}{#2}}{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@stackbox}
% The \env{varwidth} environment is used because it is much simpler to use than \env{tabular}.
% The horizontal alignment is done by the usual text align macros.
%    \begin{macrocode}
\def\@@stackbox#1#2[#3]{%
    \collectbox@
        {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3\ignorespaces}
        \BOXCONTENT
        {\end{varwidth}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@halign@c}
% \begin{macro}{\adjbox@halign@l}
% \begin{macro}{\adjbox@halign@r}
% \begin{macro}{\adjbox@halign@j}
% Horizontal alignment macros.
%    \begin{macrocode}
\def\adjbox@halign@c{\centering}
\def\adjbox@halign@l{\raggedright}
\def\adjbox@halign@r{\raggedleft}
\def\adjbox@halign@j{\let\\\newline}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{key}{ADJBOX}{stack}
%    \begin{macrocode}
\define@key{ADJBOX}{stack}[{}{}{}]{%
    \adjbox@stack#1{}{}{}\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@stack}
%    \begin{macrocode}
\def\adjbox@stack#1#2#3#4\@nnil{%
    \ifx\@nnil#1\@nnil
        \adjbox@@stack{c}{b}{}%
    \else
    \ifx\@nnil#2\@nnil
        \adjbox@@stack{#1}{b}{}%
    \else
        \adjbox@@stack{#1}{#2}{#3}%
    \fi\fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@@stack}
%    \begin{macrocode}
\def\adjbox@@stack#1#2#3{%
    \adjbox@innercode{%
        \begin{varwidth}[#2]{\linewidth}%
        \csname adjbox@halign@#1\endcsname#3%
        \ignorespaces
    }{%
        \end{varwidth}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% Load the \pkg{varwidth} package if available or disable the dependent keys if not.
%    \begin{macrocode}
\IfFileExists{varwidth.sty}
    {\RequirePackage{varwidth}}{%
    \define@key{ADJBOX}{varwidth}{%
        \PackageError{adjustbox}{The 'varwidth' key requires the 'varwidth' package, which is not installed}{}%
    }
    \define@key{ADJBOX}{stack}{%
        \PackageError{adjustbox}{The 'stack' key requires the 'varwidth' package, which is not installed}{}%
    }
}%
%    \end{macrocode}
%
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{tabular and array keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{key}{ADJBOX}{tabular}
%    \begin{macrocode}
\define@key{ADJBOX}{tabular}{%
    \@ifnextchar[{%
        \adjbox@tabular{tabular}%
    }{%
        \adjbox@tabular{tabular}{{#1}}\@nnil%
        \remove@to@nnil
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@tabular}
%    \begin{macrocode}
\def\adjbox@tabular#1#2\@nnil{%
    \ifcollectboxenv
        \adjbox@innerenv{#1}{#2}\@nnil
    \else
        \def\adjbox@collectbox##1{\collectbox@tab{#1}{#2}{\adjbox@begininnercode}{##1}{\adjbox@endinnercode}}%
    \fi
    \chardef\adjbox@innerlevel\tw@
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{ADJBOX}{tabular*}
%    \begin{macrocode}
\define@key{ADJBOX}{tabular*}{%
    \adjbox@tabular{tabular*}#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{ADJBOX}{array}
%    \begin{macrocode}
\define@key{ADJBOX}{array}{%
    \@ifnextchar[{%
        \adjbox@array%
    }{%
        \adjbox@array{{#1}}\@nnil%
        \remove@to@nnil
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@array}
%    \begin{macrocode}
\def\adjbox@array#1\@nnil{%
    \ifcollectboxenv
        \adjbox@innercode{\(\begin{array}#1}{\end{array}\)}%
    \else
        \def\adjbox@collectbox##1{\collectbox@tab{array}{#1}{\adjbox@begininnercode\(}{##1}{\)\adjbox@endinnercode}}%
    \fi
    \chardef\adjbox@innerlevel\tw@
}
%    \end{macrocode}
% \end{macro}
%
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Keys for inner environments and code} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% \begin{key}{ADJBOX}{innerenv}
%    \begin{macrocode}
\define@key{ADJBOX}{innerenv}{%
    \@ifnextchar\bgroup{%
        \adjbox@@innerenv
    }{%
        \adjbox@innerenv{#1}\@nnil%
        \remove@to@nnil
    }#1\@nnil
}
\adjbox@let@key{ADJBOX}{inner env}{innerenv}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@innerenv}
%    \begin{macrocode}
\def\adjbox@innerenv#1#2\@nnil{%
    \adjbox@innercode
        {\begin{#1}#2}%
        {\end{#1}}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@innerenv}
% \begin{macro}{\adjbox@@innerenv}
% \begin{macro}{\adjbox@@@innerenv}
% Used to extract the environment arguments. The issue here is that if a single mandatory argument is used
% its braces are removed. To avoid that a `|{}|' is always added beforehand and then removed again.
%    \begin{macrocode}
\def\adjbox@@innerenv#1{%
    \adjbox@@@innerenv{#1}{}%
}%
\def\adjbox@@@innerenv#1#2\@nnil{%
    \expandafter\adjbox@@@@innerenv\expandafter{\@gobble#2}{#1}%
}%
\def\adjbox@@@@innerenv#1#2{%
    \adjbox@innerenv{#2}{#1}\@nnil
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{key}{ADJBOX}{innercode}
%    \begin{macrocode}
\define@key{ADJBOX}{innercode}{%
    \adjbox@innercode#1{}{}%
}%
\adjbox@let@key{ADJBOX}{inner code}{innercode}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@innercode}
%    \begin{macrocode}
\def\adjbox@innercode{%
    \ifcase\adjbox@innerlevel
    \relax% 0: first inner code
        \def\adjbox@collectbox##1{\collectbox@{\adjbox@begininnercode\adjustbox@ignorespaces}{##1}{\adjustbox@unskip\adjbox@endinnercode}}%
        \chardef\adjbox@innerlevel\@ne
        \expandafter\adjbox@@innercode
    \or% 1 append inner code, no inner env
        \expandafter\adjbox@@innercode
    \else% 2 inner tabular exists, create warning and ignore content.
        \PackageWarning{adjustbox}{Further inner code or environment ignored\MessageBreak after "tabular"-like key}%
        \expandafter\@gobbletwo
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@@innercode}
%    \begin{macrocode}
\long\def\adjbox@@innercode#1#2{%
    \@temptokena\expandafter{\adjbox@begininnercode#1}%
    \edef\adjbox@begininnercode{\the\@temptokena}%
    \@temptokena{#2}%
    \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\adjbox@endinnercode}%
    \edef\adjbox@endinnercode{\the\@temptokena}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Float keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{label}
%    \begin{macrocode}
\define@key\adjbox@fam{label}{%
    \def\adjbox@label{\label{#1}}%
}
\let\adjbox@label\@empty
%    \end{macrocode}
% \end{key}
%
%    \begin{macrocode}
\chardef\adjbox@caption@pos=11
%    \end{macrocode}
%
% \begin{key}{adjbox}{captionabove}
%    \begin{macrocode}
\define@key\adjbox@fam{captionabove}{%
    \chardef\adjbox@caption@pos=1
    \csname KV@\adjbox@fam @caption\endcsname{#1}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{captionbelow}
%    \begin{macrocode}
\define@key\adjbox@fam{captionbelow}{%
    \chardef\adjbox@caption@pos=0
    \csname KV@\adjbox@fam @caption\endcsname{#1}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{caption}
%    \begin{macrocode}
\define@key\adjbox@fam{caption}{%
    \@ifnextchar{[}{%
        \adjbox@def@caption
    }{%
        \adjbox@def@@caption
    }#1\@nnil
}
\def\adjbox@def@@caption#1\@nnil{%
    \def\adjbox@caption{\caption{#1}}%
}
\def\adjbox@def@caption[#1]#2\@nnil{%
    \def\adjbox@caption{\caption[#1]{#2}}%
}
\let\adjbox@caption\@empty
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{figure}
%    \begin{macrocode}
\define@key\adjbox@fam{figure}[]{%
    \let\adjustbox@noindent\relax
    \ifx\@nnil#1\@nnil
        \adjbox@addfloat{figure}{\begin{figure}}{}{\end{figure}}%
    \else
        \adjbox@addfloat{figure}{\begin{figure}}{[{#1}]}{\end{figure}}%
    \fi
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{float}
%    \begin{macrocode}
\define@key\adjbox@fam{float}{%
    \let\adjustbox@noindent\relax
    \@ifnextchar\bgroup{%
        \adjbox@float
    }{%
        \adjbox@float{#1}{}\@nnil
        \remove@to@nnil
    }#1\@nnil
}
\def\adjbox@float#1#2\@nnil{%
    \adjbox@addfloat{#1}{\begin{#1}}{#2}{\end{#1}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{nofloat}
%    \begin{macrocode}
\define@key\adjbox@fam{nofloat}[figure]{%
    \adjbox@addfloat{#1}{\adjnofloat}{{#1}}{\endadjnofloat}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@caption@table@pos}
%    \begin{macrocode}
\def\adjbox@caption@table@pos{1}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@addfloat}
%    \begin{macrocode}
\def\adjbox@addfloat#1#2#3#4{%
    \Gin@esetsize
    \@tempswatrue
    \ifnum\adjbox@caption@pos>10
        \chardef\adjbox@caption@pos=0\csname adjbox@caption@#1@pos\endcsname\relax
    \fi
    \ifcase\adjbox@caption@pos
        \def\@tempa{\adjust@addcode{#2#3}}%
        \expandafter\expandafter\expandafter\@tempa
        \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label#4}%
    \else
        \def\@tempa##1{\adjust@addcode{#2#3\adjbox@captionabove##1}}%
        \expandafter\expandafter\expandafter\@tempa
        \expandafter\expandafter\expandafter
        {\expandafter\adjbox@caption\adjbox@label}{#4}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@captionabove}
%    \begin{macrocode}
\@ifpackageloaded{caption}{%
    \let\adjbox@captionabove\relax
}{%
    \def\adjbox@captionabove{%
        \begingroup
        \edef\@tempa{\endgroup
            \abovecaptionskip=\the\belowcaptionskip\relax
            \belowcaptionskip=\the\abovecaptionskip\relax
        }%
        \@tempa
    }%
    \AtBeginDocument{%
        \@ifpackageloaded{caption}{%
            \global\let\adjbox@captionabove\relax
        }{}%
    }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@nofloatenv}
%    \begin{macrocode}
\def\adjbox@nofloatenv{minipage}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@nofloatcaptionsetup}
% Calls \Macro\captionsetup from the \pkg{caption} package if defined, otherwise sets \Macro\@captype directly.
% Calls \Macro\capstart from the \pkg{hypcap} package if defined. Both are done to ensure correct hypertargets on top
% of the content and not at the caption position.
%    \begin{macrocode}
\def\adjbox@nofloatcaptionsetup#1{%
    \@ifundefined{captionsetup}%
     {\def\@captype{#1}}%
     {\captionsetup{type={#1}}}%
\csname capstart\endcsname
}
%    \end{macrocode}
% \end{macro}%
%
% \begin{environment}{adjnofloat}
% Environment used for non-floats.
%    \begin{macrocode}
\newenvironment{adjnofloat}[1]{%
    \par\noindent
    \minipage{\linewidth}%
    \adjbox@nofloatcaptionsetup{#1}%
}{%
    \endminipage\par
}
%    \end{macrocode}
% \end{environment}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Change or discard the content} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{phantom}
%    \begin{macrocode}
\define@key\adjbox@fam{phantom}[]{%
    \expandafter\ifx\csname #1phantom\endcsname\relax
        \adjust@addcode{\phantom}{}%
    \else
        \expandafter\adjust@addcode\expandafter{\csname #1phantom\endcsname}{}%
    \fi
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\phantombox}[3]{width}{height}{depth}
% Produces an empty box with the given width, height and depth.
%    \begin{macrocode}
\newcommand*\phantombox[3]{%
    \begingroup
    \adjsetlength\@tempdima{#1}%
    \adjsetlength\@tempdimb{#2}%
    \adjsetlength\@tempdimc{#3}%
    \setbox\collectedbox\hbox{}%
    \wd\collectedbox\@tempdima
    \ht\collectedbox\@tempdimb
    \dp\collectedbox\@tempdimc
    \leavevmode
    \box\collectedbox
    \endgroup
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{gobble}
% Discards the content.
%    \begin{macrocode}
\define@key\adjbox@fam{gobble}[\@nil]{%
    \adjbox@novalue{#1}%
    \let\adjustbox@noindent\relax
    \adjbox@Gin@Add{\@Collectbox{}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{discard}
% Alias of \Key{gobble}.
%    \begin{macrocode}
\adjbox@let@key\adjbox@fam{discard}{gobble}%
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{content}
% Replaces the content. The old content is still processed completely before being replaced..
%    \begin{macrocode}
\define@adjboxkey{content}{\@Collectbox{#1}}%
%    \end{macrocode}
% \end{key}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Store box content and sizes} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{gstore}
% Store the current content into a box without removing it.
%    \begin{macrocode}
\define@adjboxkey{gstore}{\global\@collectboxto{#1}{\BOXCONTENT}}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{gstore*}
% Store the content into a box only.
%    \begin{macrocode}
\define@key\adjbox@fam{gstore*}{%
    \let\adjustbox@noindent\relax
    \adjbox@Gin@Add{\global\sbox{#1}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{gstore width}
%    \begin{macrocode}
\define@key{adjbox}{gstore width}{%
    \adjbox@Gin@Add{\@Collectbox{\global#1=\width\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{gstore depth}
%    \begin{macrocode}
\define@key{adjbox}{gstore depth}{%
    \adjbox@Gin@Add{\@Collectbox{\global#1=\depth\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{gstore height}
%    \begin{macrocode}
\define@key{adjbox}{gstore height}{%
    \adjbox@Gin@Add{\@Collectbox{\global#1=\height\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{gstore totalheight}
%    \begin{macrocode}
\define@key{adjbox}{gstore totalheight}{%
    \adjbox@Gin@Add{\@Collectbox{\global#1=\totalheight\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{gstore sizes}
%    \begin{macrocode}
\define@key{adjbox}{gstore sizes}{%
    \adjbox@Gin@Add{\@Collectbox{\adjbox@gstore@sizes#1\relax\relax\relax\relax\@nnil\BOXCONTENT}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@gstore@sizes}[4]{width register}{height register}{depth register}{totalheight register}
% Stores the width, height, depth and totalheight in the given registers if they are not empty (or \Macro\relax).
%    \begin{macrocode}
\def\adjbox@gstore@sizes#1#2#3#4#5\@nnil{%
    \ifx\relax#1\relax\else
        \global#1=\width
    \fi
    \ifx\relax#2\relax\else
        \global#2=\height
    \fi
    \ifx\relax#3\relax\else
        \global#3=\depth
    \fi
    \ifx\relax#4\relax\else
        \global#4=\totalheight
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Experimental split and pagebreak keys and macros} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    \begin{macrocode}
%%\RequirePackage{storebox}
%    \end{macrocode}
%
% \begin{macro}{\splitbox}
%    \begin{macrocode}
\newcommand\splitbox[2]{%
    \collectboxcheckenv{splitbox}%
    \@collectbox{\@splitbox{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{split}
%    \begin{macrocode}
\define@adjboxkey{split}{\@Collectbox{\@splitbox#1}}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\@splitbox}
%    \begin{macrocode}
\def\@splitbox#1#2{%
    \ifstorebox
        \storebox\splittedbox{\BOXCONTENT}%
        \setbox\collectedbox\hbox{\usestorebox\splittedbox}%
    \fi
    \xdef\@tempa{#1}%
    \xdef\@tempb{#2}%
    \ifx\@tempa\Gin@exclamation
        \@tempdima\maxdimen
    \else
        \adjsetlength\@tempdima\@tempa
    \fi
    \ifx\@tempb\Gin@exclamation
        \Gin@nat@height\maxdimen
    \else
        \adjsetlength\Gin@nat@height\@tempb
    \fi
    \ifdim\@tempdima>\width
        \@tempdima\width
    \fi
    \ifdim\Gin@nat@height>\totalheight
        \Gin@nat@height\totalheight
    \fi
    \tc@llx\z@
    \tc@lly\totalheight
    \tc@urx\width
    \tc@ury\z@
    \advance\tc@lly-\Gin@nat@height
    \@@splitbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@splitbox}
%    \begin{macrocode}
\def\@@splitbox{%
    \advance\tc@urx-\@tempdima
    \@@@splitbox
    \ifdim\tc@urx>\z@
        \advance\tc@llx+\@tempdima
        \expandafter\@@splitbox
    \else
        \ifdim\tc@lly<\splitbox@epsilon
            \splitboxlastnewline
        \else
            \splitboxnewline
            \tc@llx\z@
            \tc@urx\width
            \advance\tc@lly-\Gin@nat@height
            \advance\tc@ury+\Gin@nat@height
            \expandafter\expandafter
            \expandafter\@@splitbox
        \fi
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@@@splitbox}
%    \begin{macrocode}
\def\@@@splitbox{%
    \begingroup
    \setbox\collectedbox=\copy\collectedbox
    \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
    \splitboxcmd{\usebox\collectedbox}%
    \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@@splitbox}
%    \begin{macrocode}
\def\@@@splitbox{%
    \begingroup
    \setbox\collectedbox=\copy\collectedbox
    \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
    \splitboxcmd{\usebox\collectedbox}%
    \endgroup
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\splitboxcmd}
%    \begin{macrocode}
\let\splitboxcmd\empty
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\splitboxnewline}
%    \begin{macrocode}
\newcommand\splitboxnewline{\\}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\splitboxlastnewline}
%    \begin{macrocode}
\newcommand\splitboxlastnewline{\splitboxnewline}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\splitbox@epsilon}
%    \begin{macrocode}
\def\splitbox@epsilon{100sp}
%    \end{macrocode}
% \end{macro}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\pagebreakbox}
%    \begin{macrocode}
\newcommand\pagebreakbox{%
    \par\noindent
    \collectboxcheckenv{pagebreakbox}%
    \@collectbox{\@pagebreakbox}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{key}{adjbox}{pagebreak}
%    \begin{macrocode}
\define@key\adjbox@fam{pagebreak}[]{%
    \adjbox@Gin@Add{\@Collectbox{\@pagebreakbox}}%
}
%    \end{macrocode}
% \end{key}
%
%
%
% \begin{macro}{\@pagebreakbox}
% Used internal macros:
%
% \begin{tabular}{ll}
%   \Macro\@tempa      & Caption code \\
%   \Macro\@tempboxa   & Caption box  \\
%   \Macro\tc@lly & Lower clip amount \\
%   \Macro\tc@ury & Lower clip amount \\
% \end{tabular}
%    \begin{macrocode}
\def\@pagebreakbox{%
    \sbox\collectedbox{\raise\dp\collectedbox\hbox{\BOXCONTENT}}%
    \ifstorebox
        \storebox\splittedbox{\BOXCONTENT}%
        \setbox\collectedbox\hbox{\usestorebox\splittedbox}%
    \fi
    \adjsetlength\tc@lly
        {\totalheight-\pagegoal+\pagetotal+\pagebreakboxoffset}%
    \ifdim\tc@lly>\z@
        \begingroup
        \setbox\collectedbox=\copy\collectedbox
        \@clipbox\collectedbox\z@\tc@lly\z@\z@
        \BOXCONTENT
        \endgroup
        \par\noindent
        \adjsetlength\tc@ury{\totalheight-\tc@lly}%
        \ifdim\tc@lly>\textheight
            \loop
                \advance\tc@lly-\textheight
                \begingroup
                \setbox\collectedbox=\copy\collectedbox
                \@clipbox\collectedbox\z@\tc@lly\z@\tc@ury
                \BOXCONTENT
                \endgroup
                \advance\tc@ury\textheight
                \par\noindent
                \ifdim\tc@lly>\textheight
            \repeat
            \@clipbox\collectedbox\z@\z@\z@\tc@ury
            \BOXCONTENT
        \else
            \@clipbox\collectedbox\z@\z@\z@\tc@ury
            \par\noindent
            \BOXCONTENT
        \fi
    \else
        \BOXCONTENT%
    \fi
    \par
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\pagebreakboxoffset}
%    \begin{macrocode}
\newcommand*\pagebreakboxoffset{\ht\strutbox}
%    \end{macrocode}
% \end{macro}
%
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% vim: foldenable foldmethod=marker foldmarker=(((,)))
% \iffalse
%</adjustbox.sty>
% \fi
%
% ^^A )))
% \Finale
% \endinput
% ^^A vim: foldenable foldmethod=marker foldmarker=(((,)))