summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
blob: 829459b648690c330349253bf5642808b383a104 (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
% \iffalse meta-comment
%
% Copyright (C) 2011 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.3c
% 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.3c or later is part of all distributions of LaTeX
% version 2008/05/04 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.
%
% $Id$
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{adjustbox.dtx}[2011/08/13 v0.5 DTX File]
\expandafter\ifx\csname ifenglish\endcsname\relax
    \expandafter\newif\csname ifenglish\endcsname
    \englishtrue
\fi
\ifenglish
    \RequirePackage[english]{babel}
\else
    \RequirePackage[ngerman]{babel}
\fi

%\PassOptionsToPackage{ngerman}{hyperref}
%\RequirePackage[ngerman]{babel}
\documentclass{ydoc}[2011/08/11]
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\GetFileInfo{adjustbox.dtx}
\usepackage{newverbs}
\MakeSpecialShortVerb\qverb\"
%\AtBeginDocument{\MakeShortMacroArgs\`\relax}
%\AtEndDocument{\DeleteShortVerb\`}
\usepackage{adjustbox}
\usepackage{tikz}
\normalmarginpar

\renewenvironment{example}[1][Example:]{%
    \subsubsection*{#1}%
}{%
    \par
}
\newenvironment{examples}[1][Examples:]{%
    \subsubsection*{#1}%
}{%
    \par
}

\newcommand\babelfiledate{%
    \expandafter\babelfileDate\filedate\relax
}
\def\babelfileDate#1/#2/#3\relax{%
    \begingroup
    \year#1
    \month#2
    \day#3
    \today
    \endgroup
}
\optionaloff

\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, width, totalheight, center, left, right, outer, inner, min, max,
    size, totalsize,
    minipage, 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-2\fboxrule
    }%
    \usebox\exampleresultbox
    }%
}%
\makeatother
\colorlet{exampleborder}{black!33}

%\EnableCrossrefs
%\CodelineIndex
%\RecordChanges
\OnlyDescription
\renewcommand{\bottomfraction}{0.5}
\begin{document}
 \DocInput{adjustbox.dtx}
  \PrintChanges
  %\newpage\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{1842}
%
% \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}
%
% \GetFileInfo{adjustbox.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let}
%
% \ifenglish\else
%   \title{Das \pkgtitle{adjustbox} Paket}
% \fi
% \author{Martin Scharrer}
% \email{martin@scharrer-online.de}
% \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
%
% \ifenglish
% \begin{abstract}
%  This package provides macros missing in \pkg{graphics} to trim, clip and generally adjust boxed \LaTeX{} material
%  as well as further box modification macros and option keys usable for \Macro\adjustbox and \Macro\includegraphics.
%  The macros use the \pkg{collectbox} package to allow for verbatim content. Equivalent environments are also provided.
%  The trim operation is now implemented in \TeX\ and the clip operation uses |pdftex| primitives if available.
%  Otherwise the \pkg{pgf} package is used for clipping, which supports both DVI/PS and PDF output.
%  \\
%  \textcolor{yellow}{This package is still a little new and its implementation might not be fully stable yet.}
% \end{abstract}
% \else
% \begin{abstract}
%  Dieses Paket stellt einige Makros zur Verfügung die im \pkg{graphics} Paket vermisst werden
%  und \LaTeX{} Material zu beschneiden (\emph{trim}, \emph{clip}) oder allgemein zu modifizieren.
%  Die Makros erlauben Inhalt das im \emph{verbatim} Modus gesetzt ist.
%  Ebenfalls werden passende Umgebungen für die Makros bereitgestellt.
%  Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht,
%  dass sowohl das PS und PDF Ausgabeformat unterstützt.\\
%  \textcolor{red}{Dieses Paket ist noch neu und seine Implementieren kann sich in zukünftigen Versionen noch ändern!}
% \end{abstract}
% \fi
%
% \ifenglish
% \section{Introduction}
% 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 provides the missing macros \Macro\clipbox and \Macro\trimbox
% as well as the general \Macro\adjustbox macro. The trim operation is implemented as \TeX\ code
% and the clip operation either using a |pdftex| or a \env{pgfpicture} environment from the \pkg{pgf} package
% which supports both PS and PDF output. All \LaTeX\ compilers should be supported, but |pdflatex| is the main target of the
% author.
% \else
% \section{Einleitung}
% Das \LaTeX{} Paket \pkg{graphicx} (die erweiterte Version von \pkg{graphics}) stellt das Macro \Macro\includegraphics[<Optionen>]{<Dateiname>} zur Verfügung
% mit dem Bilddateien eingebunden werden können. Zahlreiche Optionen können benutzt werden um das Bild zu skalieren, an eine vorgegebene Größe anzupassen, es zu rotieren 
% oder den Rand zu beschneiden.
% Ebenfalls stellt das Paket die Makros \Macro\scalebox\relax (skalieren), \Macro\resizebox\relax (Größe ändern) und \Macro\rotatebox\relax (rotieren) zur Verfügung um \LATeX{} Material,
% z.B.\ normalen Text, entsprechend anzupassen. Dies wird dazu in eine horizontale Box (\Macro\hbox) gesetzt.
% Allerdings fehlen Makros um \LATeX{} Material zu beschneiden, wobei der abgeschnittenen Rand entweder sichtbar bleibt (engl.: \emph{trim}) oder ausgeblendet wird (engl. \emph{clip}).
% Dies ist wahrscheinlich der Fall, weil diese Operationen nicht von \TeX{} selbst vorgenommen werden, sondern von dem verwendeten Ausgabeformat, z.B.\ durch PostScript (PS)
% oder PDF Operationen.
%
% Das \textsf{adjustbox} Paket definiert die Makros \Macro\clipbox und \Macro\trimbox, sowie das allgemeine \Macro\adjustbox Macro (engl.: \emph{adjust} = anpassen).
% Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht, dass sowohl das PS und PDF Ausgabeformat unterstützt.
% \fi
%
% \section{Package Option}\label{sec:options}
% Following v0.5 from 2011/08/13 this package accepts the following package options. Some of them can also be used as
% optional keys for macros.
%
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
%   \oitem{minimal} Only define the minimal set of macros, i.e.\ \Macro\trimbox, \Macro\clipbox and \Macro\adjustbox as
%       with previous versions before v0.5.
%   \oitem{export} Export the now keys of \Macro\adjustbox also to \Macro\includegraphics so that they can be used for
%       images as well. This option is meaningless if \opt{minimal} was used.
%   \oitem{patch} Patch the internal \pkg{graphicx} code to allow the usage of size macros.
%                 This simply loads the small \pkg{adjgrfx} package which can also be used independently.
%                 (Not fully implemented and tested yet!)
%   \oitem{pgf} Uses the \pkg{pgf} package for all clip operations. This overrides all automatically detected drivers.
%               At the moment only a |pdftex| driver is provided, all other compilers and output formats use this option already.
%   \oitem{PGF} Uses the \pkg{pgf} package for clip operations and configures the macros to parse lengths using
%   \pkg{pgfmath} (compare with the \opt{pgf} option below).
%  \end{description}
%
% The following options define the way length values are processed by the provided macros.
% They can be used either as package options and as keys for \Macro\adjustbox\relax (but not for \Macro\includegraphics
% even if the \opt{export} option was used) to change the settings locally.
% The only difference between these two usages is that they also load required packages when used as package options.
% Therefore all keys used in the document should be loaded as package options first or the required packages must be loaded
% manually. (It is also possible to disable the advanced parsing of lengths using the \opt{none} option, but this is not recommended.)
%
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
%   \oitem{etex} Uses the $\epsilon$-\TeX\ primitive \Macro\glueexpr to parse length values. This allows for additions,
%      subtractions as well as multiplications and devision by a numeric factor. See the official \pkg{etex\_man} document
%      for more details. This setting is the default if $\epsilon$-\TeX\ is detected (which should be the case with all
%      modern \LaTeX\ distributions).
%   \oitem{calc} Uses the \pkg{calc} package to parse length values. It supports all operations mentioned for \opt{etex} and
%      also some other operation like \Macro\widthof{<text>}.
%      See the \pkg{calc} package manual for more details.
%      This is the default setting if $\epsilon$-TeX is not detected.
%   \oitem{pgfmath} Uses the \pkg{pgfmath} package of the \pkg{pgf} bundle to parse length values. It supports all basic
%      numeric operations and also advanced mathematical functions.
%      See the \pkg{pgf} manual for more details.
%      Because the \pkg{pgfmath} package can't be loaded
%      independently in the current version (v2.10) the whole \pkg{pgf} package will be loaded.
% \end{description}
%
% One further option exists which can also be used as optional key for \Macro\adjustbox\relax (but not for
% \Macro\includegraphics):
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
%   \oitem{defaultunit}\MacroArgs'='<unit>\relax
%      This sets the default unit used for the values of \Macro\trimbox, \Macro\clipbox and \Macro\marginbox
%      including there starred versions
%      as well as all related keys like \Key{trim}, \Key{viewport}, \Key{margin}, \Key{trim}, \Key{viewport}, \Key{Clip} and \Key{Clip*}.
%      The standard default unit is the same as for \Macro\includegraphics: "bp" (big points, PostScript points).
%      However, for \LaTeX\ material \TeX\ normal unit "pt" (\TeX\ points) are better suited and will avoid rounding
%      errors which otherwise get introduced by the internal conversion.
%      The default unit is only used if the particular value is only a single number without unit,
%      but not if any mathematical operations are used.
%      If the special value |none| is used no default unit is applied and the internal check if the value is a single number
%      is by-passed. This gives a small speed bonus and can be used to avoid potential issues with complex values.
%      At this moment this setting will disable the default unit feature for the rest of the current group (i.e.\ all
%      further \Macro\adjustbox keys or globally if used as a package option) and further usages of this option will
%      have no affect. This might change in future versions of this package.
% \end{description}
%
% \ifenglish
% \def\llx{llx}
% \def\lly{lly}
% \def\urx{urx}
% \def\ury{ury}
% \def\TEXT{content}
% \def\height{height}
% \def\width{width}
% \def\totalheight{totalheight}
% \def\depth{depth}
% \def\factor{factor}
% \def\xfactor{x-factor}
% \def\yfactor{y-factor}
% \def\Angle{angle}
% \def\options{options}
% \else
% \def\llx{lux}
% \def\lly{luy}
% \def\urx{orx}
% \def\ury{ory}
% \def\TEXT{Inhalt}
% \def\height{Höhe}
% \def\width{Weite}
% \def\totalheight{Totale Höhe}
% \def\depth{Tiefe}
% \def\factor{Faktor}
% \def\xfactor{X-Faktor}
% \def\yfactor{Y-Faktor}
% \def\Angle{Winkel}
% \def\options{Optionen}
% \fi
%
% \ifenglish
% \section{Usage}
% This section describes the usage of the provided macros, which are outlined in \autoref{sec:basicmacros}.
% Possible advanced values for the macro arguments are mentioned in \autoref{sec:argval}. The existing verbatim support
% is explained in \autoref{sec:verbatim}. Finally \autoref{sec:alternatives} compares the existing macros with the 
% corresponding options of \Macro\adjustbox.
% Further box modification macros and keys are described in \autoref{sec:moremacros} and \autoref{sec:newkeys}, respectively.
%
% It is recommended to also read the \emph{Graphics Guide} (\pkg{grfguide}, i.e.~the manual of the \pkg{graphics}/|x| packages),
% to understand the existing options for \Macro\includegraphics. 
% \else
% \newpage
% \section{Anleitung}
% Dieser Abschnitt beschreibt die Verwendung der Makros dieses Pakets. Diese werden zuerst im \autoref{sec:basicmacros} beschrieben.
% \autoref{sec:argval} erklärt welche Werte in den Makroargumenten verwendet werden können. Die Makros unterstützen sogenannten
% \emph{verbatim} (engl.: wortgetreu) Inhalt was im \autoref{sec:verbatim} erleutert wird.
% Schlussendlich wird im \autoref{sec:alternatives} die exisitierenden Makros mit den entsprechendem Optionen von \Macro\adjustbox
% verglichen. Beispiele für die beschriebenen Makros befinden sich im folgendem \autoref{sec:example}.
%
% Dem Leser wird darüberhinaus die Lektüre der Anleitung der \pkg{graphic}/|x| Pakete, der \emph{Graphics Guide}, empfohlen wo
% die möglichen Optionen für das Makro \Macro\includegraphics gelistet sind, die auch für \Macro\adjustbox verwendet werden.
% \fi
%
% \ifenglish
% \Needspace*{7\baselineskip}
% \subsection{Basic Box Modification Macros}\label{sec:basicmacros}
% This section lists the provided macros \Macro\clipbox and \Macro\trimbox missing in the \pkg{graphicx} package
% as well as the general \Macro\adjustbox macro.  If the package is loaded with the \opt{minimal} option no further macros or keys are defined.
% \else
% \subsection{Makros zur Modifikation von {\LaTeX} Material}\label{sec:basicmacros}
% \fi
%
% \ifenglish
% \subsubsection*{Trim Box Content}
% \else
% \subsubsection*{Rand beschneiden ohne Überhang auszublenden}
% \fi
% \vskip-\lastskip
% \DescribeMacro\trimbox{<all sites>}{<\TEXT>}
% \DescribeMacro\trimbox{<left/right>~<top/bottom>}{<\TEXT>}
% \DescribeMacro\trimbox{<\llx>~<\lly>~<\urx>~<\ury>}{<\TEXT>}
% \DescribeMacro\trimbox*{<\llx>~<\lly>~<\urx>~<\ury>}{<\TEXT>}
% \ifenglish
% The macro \Macro\trimbox trims the given amount from the lower left (ll) and the upper right (ur) corner of
% the box. This means that the amount \meta{llx} is trimmed from the left side, \meta{lly} from the bottom and
% \meta{urx} and \meta{ury} from the right and top of the box, respectively.
% If only one value is given it will be used for all four sites.
% If only two values are given the first one will be used for the left and right side (llx, urx) and the second for the bottom and top side (lly, ury).
% Trimming means that the official size of the box is reduced, but no material
% is actual removed. The material in the trimmed areas simply swaps over the official border.
%
% If the starred version is used the four coordinates are taken as the \Key{viewport} instead, i.e. the box
% is trimmed to the rectangle described by the coordinates. In this case using all four values must be specified.
% \else
% Das Makro \Macro\trimbox setzt den \meta{Text} in eine \TeX{} Box und reduziert dessen offizielle Größe
% (\emph{bounding box}, engl.: begrenzende Box), so dass \TeX{} annimmt es wäre entsprechend kleiner. Überstehendes Material
% ragt deswegen in den umgebenden Text hinein.
% Die angegebenen Werte im ersten Argument stehen für die Beträge die von der unteren linken (lu) und der oberen rechten (or)
% Ecke entfernt werden. Das heisst, dass der Wert \meta{lux} vom linken Rand, \meta{lly} vom unterem Rand und \meta{orx} und \meta{ory}
% von rechten bzw. oberen Rand abgezogen werden.
% Wird das Makro allerdings in der Sternvariante aufgerufen, stehen die vier Werte für den Darstellungsbereich (\emph{viewport}) und 
% alles ausserhalb wird von der offiziellen Größe abgeschnitten.
% \fi
%
%
% \DescribeEnv[<\TEXT>]{trimbox}{<1, 2 or 4 trim values>}
% \vspace{-\baselineskip}
% \DescribeEnv[<\TEXT>]{trimbox*}{<\llx>~<\lly>~<\urx>~<\ury>}
% \ifenglish
% The \env{trimbox} and \env{trimbox*} environments do the same as the corresponding macros.
% Special care is taken so that the macros and the environments can have the same name.
% Because of this the star can be either part of the name or an optional argument.
% Also the plain\TeX{} syntax for environments (|\trimbox ... \endtrimbox|) can not be used
% because it will trigger \Macro\trimbox as a macro. 
% \else
% Die Umgebungen \env{trimbox} und \env{trimbox*} erzeugen den selben Effekt wie die gleichnamigen Makros.
% Ein spezieller Trick wird verwendet, damit der selbe Name für ein Makro und für eine Umgebung verwendet werden kann,
% was normallerweise nicht der Fall ist. Aufgrund dessen akzeptier die \env{trimbox} Umgebung auch einen optionallen Stern.
% Die plain\TeX{} Schreibweise für Umgebungen (|\trimbox ... \endtrimbox|) kann allerdings nicht verwendet werden,
% da es \Macro\trimbox als Makro aufrufen würde.
% \fi
%
%
% \ifenglish
% \subsubsection*{Clip Box Content}
% \else
% \subsubsection*{Rand beschneiden und Überhang ausblenden}
% \fi
% \vskip-\lastskip
% \DescribeMacro\clipbox{<all sites>}{<\TEXT>}
% \DescribeMacro\clipbox{<left/right>~<top/bottom>}{<\TEXT>}
% \DescribeMacro\clipbox{<\llx>~<\lly>~<\urx>~<\ury>}{<\TEXT>}
% \DescribeMacro\clipbox*{<\llx>~<\lly>~<\urx>~<\ury>}{<\TEXT>}
% \ifenglish
% The \Macro\clipbox macro works like the \Macro\trimbox and trims the given amounts from the \meta{text}.
% However, in addition the trimmed material is also clipped, i.e. it is not shown in the final document.
% Note that the material will still be part of the output file but is simply not shown.
% It might be exported using special tools, so using \Macro\clipbox\relax (or \Macro\includegraphics[clip,trim=...])
% to censor classified information would be a bad idea.
% The starred version will again use the given coordinates as \Key{viewport}. 
% \else
% Das \Macro\clipbox Makro arbeiten ähnlich wie \Macro\trimbox nur, dass der entfernte Rand auch wirklich
% ausgeblendet wird. Allerdings bleibt dieses Material Teil der Ausgabedatei und könnte durch spezielle Software exportiert werden.
% Von der Verwendung von \Macro\clipbox\relax (oder \Macro\includegraphics'[clip,trim=...]') um vertrauliche Informationen zu zensieren
% kann deswegen nur abgeraten werden.
% Die Sternvariante verwendet die angegebenen Werte als den zu darstellenden Bereich wie bei \Macro\trimbox'*'.
% \fi
%
% \DescribeEnv[<\TEXT>]{clipbox}{<1, 2 or 4 trim values>}
% \vspace{-\baselineskip}
% \DescribeEnv[<\TEXT>]{clipbox*}{<\llx>~<\lly>~<\urx>~<\ury>}
% \iffalse
% The environment versions of \Macro\clipbox and \Macro\clipbox*. The same rules as for the trimming environments apply.
% \else
% Die obigen Makros als Umgebungen. Es gelten die gleichen Regeln wie bei den \env{trimbox} Umgebungen.
% \fi
%
%
% \ifenglish
% \subsubsection*{Adjust Box Content}
% \else
% \subsubsection*{Allgemeine Manipulationen von \LaTeX{} Material}
% \fi
% \vskip-\lastskip
% \DescribeMacro\adjustbox{<includegraphics \options>}{<\TEXT>}
% \ifenglish
% The \Macro\adjustbox macro is the general form of all box modifying macros mentioned in the introduction.
% It can be thought as an \Macro\includegraphics for \LATeX{} material.
% It supports the same set of \meta{options}, however they are provided as a mandatory not as an optional argument.
% An \Macro\adjustbox without options would not make sense and can be replaced by a simple \Macro\mbox.
% There is no starred version of this macro. See also \autoref{tab:alternatives} for a comparison of \Macro\adjustbox
% with the other macros.
% \else
% Mit Hilfe des \Macro\adjustbox Makros (engl.\ \emph{adjust} = anpassen, justieren) ist es möglich die selben Optionen
% die \Macro\inludegraphics für Bilder zur Verfügung stellt auch auf beliebiges \LATeX{} Material anzuwenden.
% Die \meta{Optionen} sind dabei allerdings nicht optional, da \Macro\adjustbox ohne jegliche Optionen einem \Macro\mbox
% gleich käme. Eine Sternvariante existiert für dieses Makro nicht.
% Es kann dazu verwendet werden Kombinationen von anderen ähnlichen Makros zu ersetzen, was in \autoref{tab:alternatives} dargestellt wird.
% \fi
%
% \DescribeEnv[<\TEXT>]{adjustbox}{<includegraphics \options>}
% \ifenglish
% The environment version of \Macro\adjustbox.
% \else
% Wie für die anderen Makros gibt es auch für \Macro\adjustbox eine passende Umgebung.
% \fi
%
% \ifenglish
% \section*{Examples}
% The following examples show the application of the aforementioned macros on an example text.
% The result is placed in a tight, colored frame box to show the resulting dimensions.
% \else
% \section*{Beispiele}
% Die folgenden Beispiele zeigen die Anwendung der Makros dieses Packets auf einen Beispieltext (\Macro\example).
% Das Ergebnis wird mit einer engen, farbigen Umrandung dargestellt um die entgültigen Dimensionen sichtbar zu machen.
% \fi
% \begingroup
% \def\examplecontent{\begin{tabular}{@{}|c|c|@{}}
%       \hline
%       A & B \\
%       \hline
%       C & D \\
%       \hline
%   \end{tabular}^^A
% }
% \fboxsep=0pt%
% \def\Fbox{\fcolorbox{red}{white}}%
% \def\X{\vspace*{20pt}}%
% \par\bigskip\noindent
% \begin{tabular}{@{}lc}
%   \X\Macro\example      & \Fbox{\examplecontent} \\
%   \X\Macro\trimbox{10 5 10 5}{\AlsoMacro\example} & \Fbox{\trimbox{10 5 10 5}{\examplecontent}} \\
%   \X\Macro\clipbox{10 5 10 5}{\AlsoMacro\example} & \Fbox{\clipbox{10 5 10 5}{\examplecontent}} \\
%   \X\Macro\trimbox*{15 5 25 30}{\AlsoMacro\example} & \Fbox{\trimbox*{15 5 25 30}{\examplecontent}} \\
%   \X\Macro\clipbox*{15 5 25 30}{\AlsoMacro\example} & \Fbox{\clipbox*{15 5 25 30}{\examplecontent}} \\
%   \X\Macro\adjustbox{trim=10 5 10 5,angle=45}{\AlsoMacro\example} & \Fbox{\adjustbox{trim=10 5 10 5,angle=45}{\examplecontent}} \\
%   \X\Macro\adjustbox{scale=1.5}{\AlsoMacro\example} & \Fbox{\adjustbox{scale=1.5}{\examplecontent}} \\
%   \X\Macro\adjustbox{width=180pt,height=20pt}{\AlsoMacro\example} & \Fbox{\adjustbox{width=40pt,height=10pt}{\examplecontent}} \\
%   \X\Macro\adjustbox{width=180pt,height=20pt,keepaspectratio}{\AlsoMacro\example} & \Fbox{\adjustbox{width=40pt,height=10pt,keepaspectratio}{\examplecontent}} \\
% \end{tabular}
% \endgroup
%
% \clearpage
% \ifenglish
% \subsection{Argument Values}\label{sec:argval}
% All\marginpar{Parsing} length values given in the arguments of all macros and keys provided by this package are parsed by and advanced version of
% \Macro\setlength (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\marginpar{Space=Separator} 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 "{ }".
% \else
% \newpage
% \subsection{Erlaubte Werte für Makroargumente}\label{sec:argval}
% Die numerischen Werte für die Makros werden durch das vielseitige \Macro\pgfmathparse Makro des sowieso schon verwendeten \pkg{pgf} Paketes
% eingelesen. Dies erlaubt die Verwendung von einfachen oder komplizierten Formeln.
% Eine genaue Beschreibung der unterstützten mathematischen Operationen befindet sich im Handbuch des \pkg{pgf} Paketes.
% Dabei muss beachtet werden das die vier Werte für die \Macro\trimbox und \Macro\clipbox Makros sowie für die \Key{trim} und \Key{viewport} Optionen von \Macro\adjustbox
% durch Leerzeichen getrennt werden müssen. Komplizierte Angaben die ein Leerzeichen enthalten oder auf ein Makro enden (entfernt nachfolgende Leerzeichen) müssen
% deswegen in geschweifte Klammern "{ }" gesetzt werden.
% \fi
%
%
% \DescribeMacros
%    \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}%
% \endDescribeMacros
% \ifenglish
% These \LaTeX{} lengths hold the original dimension of \meta{text} and can be used as part of the arguments to \Macro\adjustbox, \Macro\trimbox and \Macro\clipbox.
% The totalheight is the height plus depth. With the \pkg{patch} option these lengths can also be used for \Macro\includegraphics.
% \else
% Diese \LaTeX{} Längen enthalten die Weite, Höhe, Tiefe bzw.\ die totale Höhe (Höhe + Tiefe) des \meta{\TEXT} Arguments bzw.\ des Inhalts der Umgebung.
% Diese Längen können in den ersten Argument von \Macro\adjustbox, \Macro\trimbox und \Macro\clipbox verwendet werden um relative Änderungen vorzunehmen.
% \fi
%
% If\marginpar{Default unit} no unit is provided for of the bounding box coordinates (\llx, \lly, \urx, \ury) 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).
%
%
% \subsection{Verbatim Support}\label{sec:verbatim}
% The macros read the \meta{text} as \TeX{} \Macro\hbox and not as an macro argument in order to support verbatim content.
% This functionality is now provided as dedicated package \pkg{collectbox} which can also be used independently.
% This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:
% \begin{macroquote}
%   \trimbox{1 2 3 4}\AlsoMacro\bgroup~<\TEXT>\AlsoMacro\egroup
% \end{macroquote}
% Special care is taken to allow the \meta{text} to be a single macro (except \Macro\bgroup) without any braces:
% \begin{macroquote}
%   \clipbox{1 2 3 4}\AlsoMacro\somemacro
% \end{macroquote}
% This is to support the questionable habit of some \LaTeX{} users to drop the braces for single token arguments.
% All environments support verbatim content.
%
% \clearpage
% \ifenglish
% \subsection{Alternatives for existing Macros}\label{sec:alternatives}
% The flexible \Macro\adjustbox can also be used as an alternative to existing macros from the \pkg{graphics} package as shown by Table~\ref{tab:alternatives}.
% Because it is longer then the originals this is only of benefit if combinations are to be replaced or verbatim text must be supported.
% \else
% \subsection{Alternativen für existierende Makros}\label{sec:alternatives}
% Das flexible \Macro\adjustbox Makro kann auch als Alternative für die vorhandenen Makros des \pkg{graphics} Paketes verwenden werden.
% Dies ist in Tabelle~\ref{tab:alternatives} dargestellt.
% Die dies allerdings mehr Schreibarbeit darstellt ist es nur dann von Vorteil, falls mehrere Operationen verknüpft werden sollen
% oder wenn der entsprechende Text im \emph{verbatim} Modus eingelesen werden soll.
% \fi
%
% \ifenglish
% \begin{table}[!hb]
% \else
% \begin{table}[!hb]
% \fi
% \belowcaptionskip\abovecaptionskip
% \colorlet{optional}{black}
% \ifenglish
% \caption{Alternatives for existing Macros}
% \else
% \caption{Alternativen für existierende Makros}
% \fi
% \label{tab:alternatives}
% \hbox to \linewidth{\hss
% \begin{tabular}{ll}
%   \toprule
%   \ifenglish
%   Original Macro (w/o content argument)  &  Alternative \Macro\adjustbox keys \\
%   \else
%   Originales Makro (ohne Textargument)  &  Alternative \Macro\adjustbox Schlüssel \\
%   \fi
%   \midrule
%   \Macro\rotatebox{<\Angle>}                   & \MacroArgs'angle='<\Angle>  \\
%                                                & \MacroArgs'rotate='<\Angle>  \\
%   \Macro\scalebox{<\factor>}                   & \MacroArgs'scale='<\factor>  \\
%   \Macro\scalebox{<\xfactor>}[<\yfactor>]      & \MacroArgs'width='<\xfactor>\AlsoMacro\width',height='<\yfactor>\AlsoMacro\height  \\
%   \Macro\reflectbox                            & \MacroArgs'reflect'  \\
%                                                & \MacroArgs'width=-'\AlsoMacro\width',height='\AlsoMacro\height  \\
%   \Macro\resizebox{<\width>}{<\height>}        & \MacroArgs'width='<\width>',height='<\height>  \\
%   \Macro\resizebox*{<\width>}{<\totalheight>}  & \MacroArgs'width='<\width>',totalheight='<\totalheight>  \\
%   \Macro\trimbox{<\llx>~<\lly>~<\urx>~<\ury>}  & \MacroArgs'trim='<\llx>~<\lly>~<\urx>~<\ury>  \\
%                                                & \MacroArgs'Trim='<\llx>~<\lly>~<\urx>~<\ury>  \\
%   \Macro\trimbox*{<\llx>~<\lly>~<\urx>~<\ury>} & \MacroArgs'viewport='<\llx>~<\lly>~<\urx>~<\ury>  \\
%                                                & \MacroArgs'Viewport='<\llx>~<\lly>~<\urx>~<\ury>  \\
%   \Macro\clipbox{<\llx>~<\lly>~<\urx>~<\ury>}  & \MacroArgs'trim='<\llx>~<\lly>~<\urx>~<\ury>,clip  \\
%                                                & \MacroArgs'Clip='<\llx>~<\lly>~<\urx>~<\ury>  \\
%   \Macro\clipbox*{<\llx>~<\lly>~<\urx>~<\ury>} & \MacroArgs'viewport='<\llx>~<\lly>~<\urx>~<\ury>,clip  \\
%                                                & \MacroArgs'Clip*='<\llx>~<\lly>~<\urx>~<\ury>  \\
%   \bottomrule
% \end{tabular}%
% \hss}%
% \end{table}
%
%
%
% \subsection{Further Box Modification Macros}\label{sec:moremacros}
% This section lists further macros which are also defined unless the package is loaded with the \opt{minimal} option.
% Note that the authors other package \pkg{realboxes} provides variants of existing box macros
% defined by the \LaTeX\ core or common packages like \pkg{graphicx}. Like the box macros here this variants allow for verbatim content
% because they read it as real box and not as macro arguments.
%
% \DescribeMacro\marginbox{<all sites>}{<\TEXT>}
% \DescribeMacro\marginbox{<left/right>~<top/bottom>}{<\TEXT>}
% \DescribeMacro\marginbox{<\llx>~<\lly>~<\urx>~<\ury>}{<\TEXT>}
% This macro can be used to add a margin (white space) around the content. It can be seen as the opposite of \Macro\trim.
% The original baseline of the content is preserved because \meta{\lly} is added to the depth.
% It is also available as \env{marginbox} environment and also usable as \Key{margin} option (see below).
%
% \begin{example}
%   \begin{examplecode}
%   Before \fbox{\marginbox{1ex 2ex 3ex 4ex}{Text}} After
%   \end{examplecode}
% \end{example}
%
%
% \DescribeMacro\marginbox'*'{<all sites>}{<\TEXT>}
% \DescribeMacro\marginbox'*'{<left/right>~<top/bottom>}{<\TEXT>}
% \DescribeMacro\marginbox'*'{<\llx>~<\lly>~<\urx>~<\ury>}{<\TEXT>}
% This starred version is almost identical to the normal \Macro\marginbox, but also raises the content by the \MacroArgs<\lly>
% amount, so that the original depth instead of the original baseline is preserved.
% Note that while \Macro\marginbox is basically the opposite of \Macro\trim, \Macro\marginbox* is not the opposite of \Macro\trim*.
% Instead it also takes the same values as the normal value and not view port values like \Macro\trim*.
%
% \begin{example}
%   \begin{examplecode}
%   Before \fbox{\marginbox*{1ex 2ex 3ex 4ex}{Text}} After
%   \end{examplecode}
% \end{example}
%
%
% \DescribeMacro\minsizebox{<width>}{<height>}{<\TEXT>}
% \DescribeMacro\minsizebox'*'{<width>}{<totalheight>}{<\TEXT>}
% 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} options.
%
% \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>}{<\TEXT>}
% \DescribeMacro\maxsizebox'*'{<width>}{<totalheight>}{<\TEXT>}
% 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} options.
%
% \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}
%
% \DescribeMacro\lapbox[<width>]{<lap amount>}{<\TEXT>}
% This macro is a generalisation of the \LaTeX\ core macros \Macro\rlap{<\TEXT>} and \Macro\llap{<\TEXT>} 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}
%
%
% \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}
%
%
% \subsection{New keys for \cs{adjustbox} and \cs{includegraphics}}\label{sec:newkeys}
% This section lists provided keys usable as \Macro\adjustbox options and, if the \opt{export} package option was used, also as \Macro\includegraphics options.
% If the package is loaded with the \opt{minimal} option this code is skipped.
%
% \subsubsection{Trimming and Clipping}
%
% \DescribeKey{Trim}'='<all sites>
% \DescribeKey{Trim}'='<left/right>~<top/bottom>
% \DescribeKey{Trim}'='<llx>~<lly>~<urx>~<ury>
% \DescribeKey{Viewport}'='<llx>~<lly>~<urx>~<ury>
% The normal \Key{trim} and \Key{viewport} keys
% as described earlier are applied on the original content before any resizing
% or other effects. 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 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}'='<llx>~<lly>~<urx>~<ury>
% \DescribeKey{Clip*}'='<llx>~<lly>~<urx>~<ury>
% As stated above the \Key{clip} boolean key
% which will make the default \Key{trim} and \Key{viewport} keys clip the trimmed content, has no effect
% on the \Key{trim} and \Key{viewport} keys. Instead \Key{Clip} and \Key{Clip*} are provided which wrap the content internally in a \Macro\clipbox or 
% \Macro\clipbox*\relax macro. They can be used several times.
%
%
% \subsubsection{Frame and Margin}
%
% \DescribeKey{frame}
% \DescribeKey{frame}'='<width>
% \DescribeKey{frame}'='<width>~<sep>
% This key will draw a black frame around the content.
% By default the frame lines will have a thickness of \Macro\fboxrule\relax
% (i.e.\ the same thickness like \Macro\fbox) and will be placed tightly around the content with zero separation.
% The line width and also the separation can be defined as the optional value.
%
%
% \DescribeKey{margin}'='<all sites>
% \DescribeKey{margin}'='<left/right>~<top/bottom>
% \DescribeKey{margin}'='<llx>~<lly>~<urx>~<ury>
% This key can be used to add a margin (white space) around the content (using \Macro\marginbox).
% It can be seen as the opposite of \Key{trim} (and in fact is implemented
% almost identical to it with negated signs). The four values are added to the left, bottom, right and top side of the content, respectively.
% The original baseline of the content is preserved by adding \meta{\lly} to the depth.
% If negative values are given the content is actually trimmed, but this will lead to wrong results if the absolute values are bigger
% than the available amount. This is particularly a problem with the depth. The \Key{trim} and \Key{trim} code will handle this case correctly, however.
%
% \DescribeKey{margin*}'='<all sites>
% \DescribeKey{margin*}'='<left/right>~<top/bottom>
% \DescribeKey{margin*}'='<llx>~<lly>~<urx>~<ury>
% Like \Key{margin} but also raises the content by \meta{\lly} and therefore preserves the original depth and not the original baseline.
%
% \subsubsection{Size/Scaling}
%
% \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.
%
% \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.
%
% \DescribeKey{reflect}
% This 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}{\sffamily OTTO}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{reflect}{\sffamily ANNA}
%   \end{examplecode}
%   \begin{examplecode}
%   \adjustbox{reflect}{Some text!}
%   \end{examplecode}
% \end{examples}
%
% \subsubsection{Positioning and Alignment}
%
% \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}{depth}} but with limited official
%   height and no depth.
%   \end{examplecode}
% \end{examples}
%
% \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=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}} &
%   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=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}} &
%   Mxy \newline \mbox{\vr Mxy}\newline Mxy \\
%  \bottomrule
% \end{tabular}}
% \endgroup
%
%
% \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{examples}
%   \begin{examplecode}
%   \adjustbox{set height=.5\height}
%       {\shortstack{some stacked\\content}}
%   \end{examplecode}
% \end{examples}
%
% \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{examples}
%   \begin{examplecode}
%   \adjustbox{set depth=0pt}
%       {\shortstack{some stacked\\content
%       with \raisebox{-1ex}{depth}}}
%   \end{examplecode}
% \end{examples}
%
% \DescribeKey{lap}'='<lap amount>
% \DescribeKey{lap}'='{<length>}{<lap amount>}
% This wraps the content into a
% \Macro\lapbox{<lap amount>}{\ldots} and
% \Macro\lapbox[<length>]{<lap amount>}{\ldots}, respectively. Positive \meta{amounts} lap the content to the right
% and negative to the left. The optional \meta{length} argument allows to set the final width.
%
% \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{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 always equal to \Key{center}, because there is no inner or outer margin.
% 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.
% If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning.
%
%
% \subsubsection{Pixel size}
%
% \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.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{dpi=72,trim=10px,frame}
%       {\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{10px}{10px}}}
%   \end{examplecode}
% \end{example}
%
% \subsection{Minipage or other inner Environment}
% The following keys will overwrite each other and 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.
%
% \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{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. Only one inner environment can be used 
% and further uses of this key will overwrite previous ones as well as any \Key{minipage} and \Key{innercode} key.
% 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{innerenv} or similar environment will not work here, because that code will be taken as part of the first cell.
%
% \begin{example}
%   \begin{examplecode}
%   \newenvironment{myenv}[2][]{Before [#1](#2)}{After}
%   \adjustbox{innerenv={myenv}[ex]{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. Only one set of inner code can be used 
% and further uses of this key will overwrite previous ones as well as any \Key{minipage} and \Key{innerenv} key.
%
% \begin{example}
%   \begin{examplecode}
%   \adjustbox{innercode={\color{green}}{!}}{Content}
%   \end{examplecode}
% \end{example}
%
% \subsection{Adding own Code or Environments}
%
% \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.
%
% \DescribeKey{appcode}'='<code afterwards>
% Appends come \meta{code after} the content and the already existing code around it which was added by other keys beforehand.
% More complex code should be enclosed in braces.
%
% \DescribeKey{precode}'='<code before>
% Prepends come \meta{code afterwards} the content and the already existing code around it which was added by other keys beforehand.
% More complex code should be enclosed in braces.
%
%
% \StopEventually{}
% \clearpage
% \section{Implementation}
% \setcounter{lstnumber}{1}
% \ifenglish\else
% Die Dokumentation des Quellcodes ist nur auf Englisch verfügbar.
% \fi
%
% \iffalse
%<*de>
%% Wrapper to set language to German and jobname to 'adjustbox-de'.
%% Does not have to be included in distributions or placed on CTAN.
\expandafter\newif\csname ifenglish\endcsname
\englishfalse
\input{adjustbox.dtx}
%</de>
% \fi
%
% \iffalse
%<*adjustbox>
% \fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Package header, options and dependencies}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \begin{macrocode}
\ProvidesPackage{adjustbox}[2011/08/07 v0.5 Adjusting TeX boxes (trim, clip, ...)]
%    \end{macrocode}
%
%    \begin{macrocode}
\RequirePackage{xkeyval}

\def\adjbox@defaultunit{bp}
\DeclareOptionX<adjbox>{defaultunit}{%
    \def\adjbox@defaultunit{#1}%
    \begingroup
    \def\@tempa{none}%
    \expandafter\endgroup
    \ifx\@tempa\adjbox@defaultunit
        \def\adjbox@default{\adjsetlength}%
    \fi
}

\def\adjbox@fam{adjbox}
\DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}}
\DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}}
\DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput}

\def\adjbox@driver{adj\Gin@driver}
\DeclareOptionX<adjbox>{pgf}{\def\adjbox@driver{adjpgf.def}}
\DeclareOptionX<adjbox>{PGF}{\def\adjbox@driver{adjpgf.def}\adjcalc@pgfmath}
\DeclareOptionX<adjbox>*{\PassOptionsToPackage\CurrentOption{graphicx}}

\let\adjbox@maybeend\relax
\input{adjcalc.sty}
\disable@keys{adjbox}{patch,export,PGF,minimal}
%    \end{macrocode}
%
%    \begin{macrocode}
\RequirePackage{graphicx}[1999/02/16]
\RequirePackage{collectbox}[2011/08/06]
%    \end{macrocode}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Basic commands}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\adjbox@viewport}
%    \begin{macrocode}
\define@key{adjbox}{viewport}{%
    \let\Gin@viewport@code\adjbox@@viewport
    \let\adjustbox@@@\adjustbox@@@trimclip
    \adjbox@parse@v{#1}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@trim}
%    \begin{macrocode}
\define@key{adjbox}{trim}{%
    \let\Gin@viewport@code\adjbox@@trim
    \let\adjustbox@@@\adjustbox@@@trimclip
    \adjbox@parse@v{#1}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjustbox@@@trimclip}
%    \begin{macrocode}
\def\adjustbox@@@trimclip{%
    \Gin@viewport@code
    \ifGin@clip
        \expandafter\@clipbox
    \else
        \expandafter\@trimbox
    \fi
        \adjbox@tllx
        \adjbox@tlly
        \adjbox@turx
        \adjbox@tury
        \collectedbox
    \usebox\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\adjbox@parse@v}
%    \begin{macrocode}
\def\adjbox@parse@v#1{%
    \adjbox@parse@@v#1 {} {} {} \\%
}
\def\adjbox@parse@@v#1 #2 #3 #4 #5\\{%
  \adjbox@default\adjbox@tllx{#1}%
  \ifx\@nnil#2\@nnil
    \adjbox@tlly\adjbox@tllx
    \adjbox@turx\adjbox@tllx
    \adjbox@tury\adjbox@tlly
  \else
    \adjbox@default\adjbox@tlly{#2}%
    \ifx\@nnil#3\@nnil
      \adjbox@turx\adjbox@tllx
      \adjbox@tury\adjbox@tlly
    \else
      \adjbox@default\adjbox@turx{#3}%
      \adjbox@default\adjbox@tury{#4}%
    \fi
  \fi
}%
%%\newdimen\adjbox@llx
%%\newdimen\adjbox@lly
%%\newdimen\adjbox@urx
%%\newdimen\adjbox@ury
\newdimen\adjbox@tllx
\newdimen\adjbox@tlly
\newdimen\adjbox@turx
\newdimen\adjbox@tury
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\adjbox@@trim}
%    \begin{macrocode}
\let\adjbox@@trim\relax
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@@viewport}
%    \begin{macrocode}
\def\adjbox@@viewport{%
    %\advance\adjbox@tllx by -\z@
    \advance\adjbox@tlly by  \dp\collectedbox
    \advance\adjbox@turx by -\wd\collectedbox
    \advance\adjbox@tury by -\ht\collectedbox
    \adjbox@turx=-\adjbox@turx
    \adjbox@tury=-\adjbox@tury
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\trimbox}
%    \begin{macrocode}
\newcommand\trimbox{%
    \collectboxcheckenv{trimbox}%
    \@ifstar
        \trimbox@s
        \trimbox@
}
\def\trimbox@#1{%
    \collectbox{\trimbox@@\@trimbox{#1}}%
}
\def\trimbox@s#1{%
    \collectbox{\trimbox@@{\adjbox@@viewport\@trimbox}{#1}}%
}
\def\trimbox@@#1#2{%
    \adjbox@parse@v{#2}%
    #1%
        \adjbox@tllx
        \adjbox@tlly
        \adjbox@turx
        \adjbox@tury
        \collectedbox
    \usebox\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{trimbox*}
%    \begin{macrocode}
\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
    \@collectboxisenv{trimbox*}%
    \trimbox@s
}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\clipbox}
%    \begin{macrocode}
\newcommand\clipbox{%
    \collectboxcheckenv{clipbox}%
    \@ifstar
        \clipbox@s
        \clipbox@
}
\def\clipbox@#1{%
    \collectbox{\trimbox@@\@clipbox{#1}}%
}
\def\clipbox@s#1{%
    \collectbox{\trimbox@@{\adjbox@@viewport\@clipbox}{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{environment}{clipbox*}
%    \begin{macrocode}
\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
    \@collectboxisenv{clipbox*}%
    \clipbox@s
}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\adjustbox}
% 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@@@ 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[1]{%
    \collectboxcheckenv{adjustbox}%
    \begingroup
    \adjustbox@dimcmds
    \let\Gin@esetsize\adjbox@esetsize
    \@tempswatrue
    \toks@{{\adjustbox@@@@}}%
    \def\setlength{\adjsetlength}%
    \setkeys{adjbox,Gin}{#1}%
    \adjbox@esetsize
    \adjbox@collectbox{\the\toks@\endgroup}%
}
\let\adjbox@collectbox\@collectbox
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjustbox@@@@}
% Content wrapper which might be redefined when the size is specified.
%    \begin{macrocode}
\def\adjustbox@@@@{\adjustbox@@@}%
%    \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}{\adjustbox@dimcmds}
% Inits the dimension macro in an unexpandedable way. They will be redefined to the correct
% values by \Macro\collectbox.
%    \begin{macrocode}
\def\adjustbox@dimcmds{%
    \let\width\relax
    \let\height\relax
    \let\depth\relax
    \let\totalheight\relax
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjustbox@@@}
%    \begin{macrocode}
\def\adjustbox@@@{%
    \usebox\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Low-level trim and clip boxes}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\@trimbox}
%    \begin{macrocode}
\def\@trimbox#1#2#3#4#5{%
    \setbox#5=\hbox{%
        \adjsetlength\@tempdima{#1}%
        \hskip-\@tempdima
        \adjsetlength\@tempdima{\dp#5 - (#2)}%
        \adjsetlength\@tempdimb{\wd#5 - (#3)}%
        \adjsetlength\@tempdimc{\ht#5 - (#4)}%
        \dp#5=\@tempdima
        \wd#5=\@tempdimb
        \ht#5=\@tempdimc
        \ifdim\dp#5<\z@
            \raise\dp#5%
        \else
        \ifdim\ht#5<\z@
            \lower\ht#5%
        \fi\fi
        \box#5%
    }%
    \ifdim\dp#5<\z@ \dp#5=\z@ \fi
    \ifdim\wd#5<\z@ \wd#5=\z@ \fi
    \ifdim\ht#5<\z@ \ht#5=\z@ \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@clipbox}
%    \begin{macrocode}
\def\@clipbox#1#2#3#4#5{%
    \@trimbox{#1}{#2}{#3}{#4}{#5}%
    \pdfxform#5%
    \setbox#5=\hbox{%
        \pdfrefxform\pdflastxform
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Driver}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The clipping support is output driver dependent. The driver selected by \pkg{graphics} is used and a definition file
% is used if its exists. Otherwise either the default \texttt{pdftex} implementation or the \pkg{pgf} fall-back driver
% is used.
%    \begin{macrocode}
\RequirePackage{ifpdf}
\InputIfFileExists{\adjbox@driver}{%
    \PackageInfo{adjustbox}{Using driver '\adjbox@driver'.}%
}{%
    \ifpdf
        \PackageInfo{adjustbox}{Using default pdftex driver.}
    \else
        \input{adjpgf.def}%
        \PackageInfo{adjustbox}{Using fall-back PGF driver.}
    \fi
}
%    \end{macrocode}
%
%
% Stop here if 'minimal' option was used.
%    \begin{macrocode}
\adjbox@maybeend
%    \end{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{More box commands}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \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{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}%
    \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\@tempb#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\@tempa#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\@tempa#1\width
                \ifdim\@tempb#1#2%
                    3%
                \else
                    2%
                \fi
            \else
                \ifdim\@tempb#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
        \adjsetlength\@tempdima\@tempb
        \Gscale@div\@tempa\@tempdima#2%
        \Gscale@box\@tempa[\@tempa]\BOXCONTENT
%    \end{macrocode}
%  Case 2: width needs scaling. Calculate factor and scale the content with it.
%    \begin{macrocode}
    \or
        \adjsetlength\@tempdima\@tempa
        \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
        \adjsetlength\@tempdima\@tempa
        \Gscale@div\@tempa\@tempdima\width
        \adjsetlength\@tempdima\@tempb
        \Gscale@div\@tempb\@tempdima#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}
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{New \cs{includegraphics} and \cs{adjustbox} options}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{Trim}
%    \begin{macrocode}
\define@key\adjbox@fam{Trim}{%
    \adjbox@Gin@Add{\trimbox@{#1}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{Viewport}
%    \begin{macrocode}
\define@key\adjbox@fam{Viewport}{%
    \adjbox@Gin@Add{\trimbox@s{#1}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{Clip}
%    \begin{macrocode}
\define@key\adjbox@fam{Clip}{%
    \adjbox@Gin@Add{\clipbox@{#1}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{Clip*}
%    \begin{macrocode}
\define@key\adjbox@fam{Clip*}{%
    \adjbox@Gin@Add{\clipbox@s{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{frame}
%    \begin{macrocode}
\define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
    \adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{fbox}
%    \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@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{cfbox}
%    \begin{macrocode}
\define@key\adjbox@fam{cfbox}{%
    \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@@frame}
%    \begin{macrocode}
\def\adjbox@@frame#1#2#3#4{%
    \ifx\@nnil#2\@nnil\else
        \adjsetlength\fboxrule{#2}%
    \fi
    \ifx\@nnil#3\@nnil\else
        \adjsetlength\fboxsep{#3}%
    \fi
    \adjsetlength\adjbox@tllx{\fboxrule + \fboxsep}%
    \@marginbox
        \adjbox@tllx
        \adjbox@tllx
        \adjbox@tllx
        \adjbox@tllx
        \collectedbox
    \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\adjbox@tllx{#4}%
      \@marginbox
        \adjbox@tllx
        \adjbox@tllx
        \adjbox@tllx
        \adjbox@tllx
        \collectedbox
      \BOXCONTENT
    \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@boxframe}
% 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}
%
%
%
% \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}
%
%
% \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}{margin}
%    \begin{macrocode}
\define@key\adjbox@fam{margin}{%
    \adjbox@Gin@Add{\marginbox@{#1}}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{margin*}
%    \begin{macrocode}
\define@key\adjbox@fam{margin*}{%
    \adjbox@Gin@Add{\marginbox@s{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \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}
%
%
%    \begin{macrocode}
\define@key\adjbox@fam{execute}{%
    #1%
}
%    \end{macrocode}
%
%
% \begin{key}{adjbox}{raise}
%    \begin{macrocode}
\define@key\adjbox@fam{raise}{%
    \@ifnextchar\bgroup{%
        \adjbox@raisebox
    }{%
        \adjbox@raisebox{#1}{}{}%
    }#1{}{}{}\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@raisebox}
%    \begin{macrocode}
\def\adjbox@raisebox#1#2#3#4\@nnil{%
    \ifx\@nnil#3\@nnil
        \adjbox@Gin@Add{\@irsbox{#1}[{#2}]}%
    \else
        \adjbox@Gin@Add{\@iirsbox{#1}[{#2}][{#3}]}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{key}{adjbox}{valign}
%    \begin{macrocode}
\define@key\adjbox@fam{valign}{%
    \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@Gin@Add{\@irsbox{\height+\adjboxvtop}[]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@T}
%    \begin{macrocode}
\def\adjbox@valign@T{%
    \adjbox@Gin@Add{\@irsbox{-\height}[]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@M}
%    \begin{macrocode}
\def\adjbox@valign@M{%
    \adjbox@Gin@Add{\@irsbox{.5\depth-.5\height}[]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@m}
%    \begin{macrocode}
\def\adjbox@valign@m{%
    \adjbox@Gin@Add{\@irsbox{.5\depth-.5\height+\adjboxvcenter}[]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@b}
%    \begin{macrocode}
\def\adjbox@valign@b{%
    \adjbox@Gin@Add{\@irsbox{\depth+\adjboxvbottom}[]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@valign@B}
%    \begin{macrocode}
\def\adjbox@valign@B{%
    \adjbox@Gin@Add{\@irsbox{\depth}[]}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{bgcolor}
%    \begin{macrocode}
\define@key\adjbox@fam{bgcolor}{%
    \adjbox@Gin@add{\colorbox{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{set height}
%    \begin{macrocode}
\define@key\adjbox@fam{set height}{%
    \adjbox@Gin@Add{\@irsbox\z@[{#1}]}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{set depth}
%    \begin{macrocode}
\define@key\adjbox@fam{set depth}{%
    \adjbox@Gin@Add{\@iirsbox\z@[\height][{#1}]}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{macro}{\adjbox@Gin@add}
%    \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}{\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#3\relax{%
    \ifx\@nnil#3\@nnil
        \adjbox@Gin@add{#1{#2}{#2}}%
    \else
        \adjbox@Gin@add{#1{#2}{#3}}%
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\adjbox@halign}
%    \begin{macrocode}
\def\adjbox@halign#1#2#3{%
    \Gin@esetsize
    \@tempswatrue
    \adjsetlength\@tempdima{#1}%
    \edef\@tempa{\hb@xt@\the\@tempdima}%
    \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{key}{adjbox}{center}
%    \begin{macrocode}
\define@key\adjbox@fam{center}[\linewidth]{%
    \adjbox@halign{#1}\hss\hss
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{left}
%    \begin{macrocode}
\define@key\adjbox@fam{left}[\linewidth]{%
    \adjbox@halign{#1}\hss\relax
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{right}
%    \begin{macrocode}
\define@key\adjbox@fam{right}[\linewidth]{%
    \adjbox@halign{#1}\relax\hss
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{outer}
%    \begin{macrocode}
\define@key\adjbox@fam{outer}[\linewidth]{%
    \def\@tempa{\adjbox@halign{#1}}%
    \if@twoside
      \adjbox@ifoddpage
        {\@tempa\hss\relax}%
        {\@tempa\relax\hss}%
    \else
        \@tempa\hss\hss
    \fi
}
%    \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{inner}
%    \begin{macrocode}
\define@key\adjbox@fam{inner}[\linewidth]{%
    \def\@tempa{\adjbox@halign{#1}}%
    \if@twoside
      \adjbox@ifoddpage
        {\@tempa\relax\hss}%
        {\@tempa\hss\relax}%
    \else
        \@tempa\hss\hss
    \fi
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@ifoddpage}
%    \begin{macrocode}
\def\adjbox@ifoddpage{%
    \begingroup
    \adjbox@checkoddpage
    \expandafter\endgroup
    \ifoddpage
        \expandafter\@firstoftwo
    \else
        \expandafter\@secondoftwo
    \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjbox@checkoddpage}
%    \begin{macrocode}
\def\adjbox@checkoddpage{%
    \ifodd\c@page
        \oddpagetrue
    \else
        \oddpagefalse
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\newif\ifoddpage
\AtBeginDocument{%
    \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
     {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
}%
%    \end{macrocode}
%
% \begin{key}{adjbox}{min width}
%    \begin{macrocode}
\define@key\adjbox@fam{min width}{%
    \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max width}
%    \begin{macrocode}
\define@key\adjbox@fam{max width}{%
    \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min height}
%    \begin{macrocode}
\define@key\adjbox@fam{min height}{%
    \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max height}
%    \begin{macrocode}
\define@key\adjbox@fam{max height}{%
    \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min totalheight}
%    \begin{macrocode}
\define@key\adjbox@fam{min totalheight}{%
    \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max totalheight}
%    \begin{macrocode}
\define@key\adjbox@fam{max totalheight}{%
    \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min size}
%    \begin{macrocode}
\define@key\adjbox@fam{min size}{%
    \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max size}
%    \begin{macrocode}
\define@key\adjbox@fam{max size}{%
    \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min totalsize}
%    \begin{macrocode}
\define@key\adjbox@fam{min totalsize}{%
    \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max totalsize}
%    \begin{macrocode}
\define@key\adjbox@fam{max totalsize}{%
    \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
}
%    \end{macrocode}
% \end{key}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Lap box}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \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}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Margin box}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\marginbox}[1]{Margins as space separated values (like for 'trim')}
% Collect box first.
%    \begin{macrocode}
\newcommand\marginbox{%
    \collectboxcheckenv{marginbox}%
    \@ifstar
        \marginbox@s
        \marginbox@
}
\def\marginbox@#1{%
    \@collectbox{\marginbox@@{#1}}%
}
\def\marginbox@s#1{%
    \@collectbox{\marginbox@@s{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{marginbox*}[1]{Margins as space separated values (like for 'trim')}
%    \begin{macrocode}
\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
    \@collectboxisenv{marginbox*}%
    \marginbox@s
}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\marginbox@@}
% (1) Parse margins (must be done here to allow the user to use the original box dimensions).
% (2) Change box margins and (3) place the box.
%    \begin{macrocode}
\def\marginbox@@#1{%
    \adjbox@parse@v{#1}%
    \@marginbox
        \adjbox@tllx
        \adjbox@tlly
        \adjbox@turx
        \adjbox@tury
        \collectedbox
    \usebox\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\marginbox@@s}
% (1) Parse margins (must be done here to allow the user to use the original box dimensions).
% (2) Change box margins and (3) raise the box by the bottom margin to preserve original depth.
%    \begin{macrocode}
\def\marginbox@@s#1{%
    \adjbox@parse@v{#1}%
    \@marginbox
        \adjbox@tllx
        \adjbox@tlly
        \adjbox@turx
        \adjbox@tury
        \collectedbox
    \raise\adjbox@tlly\copy\collectedbox
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@marginbox}
% Adds the given margins to the depth, width and height.
% The left margin is created by an horizontal skip.
% This implementation assumes that the margins are positive and no special checks are added.
% While negative margins will trim some margin off, this will not lead to correct results if this amounts
% are larger than the existing dimensions. For this the \Macro\trimbox macro should be used.
%    \begin{macrocode}
\def\@marginbox#1#2#3#4#5{%
    \setbox#5=\hbox{%
        \adjsetlength\@tempdima{#1}%
        \hskip\@tempdima
        \adjsetlength\@tempdima{\dp#5 + #2}%
        \adjsetlength\@tempdimb{\wd#5 + #3}%
        \adjsetlength\@tempdimc{\ht#5 + #4}%
        \dp#5=\@tempdima
        \wd#5=\@tempdimb
        \ht#5=\@tempdimc
        \box#5%
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Minibox and other Environments Keys}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{minipage}
%    \begin{macrocode}
\define@key{adjbox}{minipage}{%
    \@ifnextchar[{%
        \adjbox@innerenv{minipage}%
    }{%
        \adjbox@innerenv{minipage}{{#1}}\@nnil%
        \remove@to@nnil
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{innerenv}
%    \begin{macrocode}
\define@key{adjbox}{innerenv}{%
    \@ifnextchar\bgroup{%
        \adjbox@innerenv
    }{%
        \adjbox@innerenv{#1}\@nnil%
        \remove@to@nnil
    }#1\@nnil
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@innerenv}
%    \begin{macrocode}
\def\adjbox@innerenv#1#2\@nnil{%
    \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}%
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{key}{adjbox}{innercode}
%    \begin{macrocode}
\define@key{adjbox}{innercode}{%
    \adjbox@innercode#1{}{}%
}
%    \end{macrocode}
% \end{key}
%
% \begin{macro}{\adjbox@innerenv}
%    \begin{macrocode}
\def\adjbox@innerenv#1#2\@nnil{%
    \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjbox@innercode}
%    \begin{macrocode}
\def\adjbox@innercode#1#2{%
    \def\adjbox@collectbox##1{\collectbox@{#1}{##1}{#2}}%
}%
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{key}{adjbox}{env}
%    \begin{macrocode}
\define@key{adjbox}{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}
%
% \begin{key}{adjbox}{addcode}
%    \begin{macrocode}
\define@key{adjbox}{Addcode}{%
    \adjust@@addcode#1{}\@nnil%
}
\define@key{adjbox}{addcode}{%
    \Gin@esetsize
    \@tempswatrue
    \adjust@@addcode#1{}\@nnil%
}
\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}
%    \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}
\def\adjust@addcode#1#2{%
    \def\@tempa{#1}%
    \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
}%
%    \end{macrocode}
% \end{macro}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
%</adjustbox>
% \fi
%
%
% \iffalse
%<*adjgrfx>
% \fi
%    \begin{macrocode}
\ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox]
\RequirePackage{graphicx}
%    \end{macrocode}
%
%
%%^^A  \width, \height, \totalheight, \depth  =  size current at option execution (changes after every option) (initial: natural size)
%%^^A  \Width, \Height, \Totalheight, \Depth  =  requested size of image (height/totalheight and width) (initial: natural size)
%%^^A  \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH  =  natural size of image
%%  
%%
%
% \begin{macro}{\Gin@adj@adddim}
%    \begin{macrocode}
\newcommand*\Gin@adj@adddim{%
    \let\height\Gin@nat@height
    \let\width\Gin@nat@width
    \let\totalheight\height
    \let\depth\z@
    \let\adjbox@HEIGHT\HEIGHT
    \let\adjbox@WIDTH\WIDTH
    \let\adjbox@TOTALHEIGHT\TOTALHEIGHT
    \let\adjbox@DEPTH\DEPTH
    \global\let\HEIGHT\Gin@nat@height
    \global\let\WIDTH\Gin@nat@width
    \global\let\TOTALHEIGHT\HEIGHT
    \global\let\DEPTH\z@
    \let\adjbox@Height\Height
    \let\adjbox@Width\Width
    \let\adjbox@Totalheight\Totalheight
    \let\adjbox@Depth\Depth
    \global\let\Height\Gin@nat@height
    \global\let\Width\Gin@nat@width
    \global\let\Totalheight\Height
    \global\let\Depth\z@
    \edef\adjbox@restore@dims{%
        \global\adjbox@nat@height\the\adjbox@nat@height\relax
        \global\adjbox@nat@width \the\adjbox@nat@width\relax
        \global\adjbox@req@height\the\adjbox@req@height\relax
        \global\adjbox@req@width \the\adjbox@req@width\relax
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Gin@adj@remdim}
%    \begin{macrocode}
\newcommand*\Gin@adj@remdim{%
    \global\let\HEIGHT\adjbox@HEIGHT
    \global\let\WIDTH\adjbox@WIDTH
    \global\let\TOTALHEIGHT\adjbox@TOTALHEIGHT
    \global\let\DEPTH\adjbox@DEPTH
    \global\let\Height\adjbox@Height
    \global\let\Width\adjbox@Width
    \global\let\Totalheight\adjbox@Totalheight
    \global\let\Depth\adjbox@Depth
    \adjbox@restore@dims
}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\newdimen\adjbox@nat@width
\newdimen\adjbox@nat@height
\newdimen\adjbox@req@width
\newdimen\adjbox@req@height
%    \end{macrocode}
%
% \begin{macro}{\Gin@adj@keepdim}
%    \begin{macrocode}
\newcommand*\Gin@adj@keepdim{%
    \global\adjbox@nat@height\Gin@nat@height
    \global\adjbox@nat@width \Gin@nat@width
    \global\adjbox@req@height\Gin@req@height
    \global\adjbox@req@width \Gin@req@width
    \global\let\HEIGHT\adjbox@nat@height
    \global\let\WIDTH\adjbox@nat@width
    \global\let\TOTALHEIGHT\adjbox@nat@height
    \global\let\DEPTH\z@
    \global\let\Height\adjbox@req@height
    \global\let\Width\adjbox@req@width
    \global\let\Totalheight\adjbox@req@height
    \global\let\Depth\z@
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Gin@ii}
%    \begin{macrocode}
\def\Gin@ii[#1]#2{%
    \def\@tempa{[}\def\@tempb{#2}%
    \ifx\@tempa\@tempb
      \def\@tempa{\Gin@iii[#1][}%
      \expandafter\@tempa
    \else
     \begingroup
       \Gin@adj@adddim
       \@tempswafalse
       \toks@{\Ginclude@graphics{#2}}%
       \setkeys{Gin}{#1}%
       \Gin@esetsize
       \the\toks@
       \Gin@adj@remdim
     \endgroup
     \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Gin@iii}
%    \begin{macrocode}
\def\Gin@iii[#1,#2][#3,#4]#5{%
  \begingroup
  \Gin@adj@adddim
  \Gin@bboxtrue
  \Gin@defaultbp\Gin@llx{#1}%
  \Gin@defaultbp\Gin@lly{#2}%
  \Gin@defaultbp\Gin@urx{#3}%
  \Gin@defaultbp\Gin@ury{#4}%
  \Ginclude@graphics{#5}%
  \Gin@adj@remdim
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\Gin@setfile}
%    \begin{macrocode}
\def\Gin@setfile#1#2#3{%
  \ifx\\#2\\\Gread@false\fi
  \ifGin@bbox\else
    \ifGread@
      \csname Gread@%
         \expandafter\ifx\csname Gread@#1\endcsname\relax
           eps%
         \else
           #1%
         \fi
      \endcsname{\Gin@base#2}%
    \else
      \Gin@nosize{#3}%
    \fi
  \fi
  \Gin@viewport@code
  \Gin@nat@height\Gin@ury bp%
  \advance\Gin@nat@height-\Gin@lly bp%
  \Gin@nat@width\Gin@urx bp%
  \advance\Gin@nat@width-\Gin@llx bp%
  \Gin@req@sizes
  \Gin@adj@keepdim
  \expandafter\ifx\csname Ginclude@#1\endcsname\relax
    \Gin@drafttrue
    \expandafter\ifx\csname Gread@#1\endcsname\relax
      \@latex@error{Can not include graphics of type: #1}\@ehc
      \global\expandafter\let\csname Gread@#1\endcsname\@empty
    \fi
  \fi
  \leavevmode
  \ifGin@draft
      \hb@xt@\Gin@req@width{%
        \vrule\hss
        \vbox to \Gin@req@height{%
           \hrule \@width \Gin@req@width
           \vss
           \edef\@tempa{#3}%
           \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}%
           \vss
           \hrule}%
        \hss\vrule}%
  \else
    \@addtofilelist{#3}%
    \ProvidesFile{#3}[Graphic file (type #1)]%
    \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}%
    \dp\z@\z@
    \ht\z@\Gin@req@height
    \wd\z@\Gin@req@width
  \box\z@
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%</adjgrfx>
% \fi
%
%
% \iffalse
%<*adjcalc>
% \fi
% Test if this package was loaded as package or as file (as part of 'adjustbox'):
%    \begin{macrocode}
\begingroup
\def\@tempa{adjcalc}
\expandafter
\endgroup
\ifx\@tempa\@currname
    \ProvidesPackage{adjcalc}[2011/08/07 v1.0 Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
    \RequirePackage{xkeyval}
\fi
%    \end{macrocode}
%
%
%
% Use e-TeX by default if available, otherwise LaTeX (maybe with \pkg{calc})
%    \begin{macrocode}
\AtEndOfPackage{\adjcalc@atend}
\def\adjcalc@atend{%
\begingroup
\expandafter\ifx\csname eTeXversion\endcsname\relax
    \endgroup
    \RequirePackage{calc}%
    \adjcalc@calc
    \def\adjcalc@etex{\PackageError{adjcalc}{e-TeX not available for current compiler!}}%
\else
    \endgroup
    \adjcalc@etex
\fi
}
%    \end{macrocode}
%
% Initial definitions for the package options. This macros are later redefined because the same keys
% can be used as macro options.
%    \begin{macrocode}
\def\adjcalc@pgfmath{\AtEndOfPackage{\RequirePackage{pgf}}\def\adjcalc@atend{\adjcalc@pgfmath}}
\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}}
\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}}
\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}}
%    \end{macrocode}
%
% Options:
%    \begin{macrocode}
\DeclareOptionX<adjbox>{pgfmath}{\adjcalc@pgfmath}
\DeclareOptionX<adjbox>{etex}{\adjcalc@etex}
\DeclareOptionX<adjbox>{calc}{\adjcalc@calc}
\DeclareOptionX<adjbox>{none}{\let\adjcalc@atend\relax\def\adjsetlength{\setlength}\let\adjcalc@overwrite\relax}
\DeclareOptionX<adjbox>{overwrite}{\adjcalc@overwrite}
\ProcessOptionsX*<adjbox>
\disable@keys{adjbox}{none}
%    \end{macrocode}
%
% \begin{macro}{\adjcalc@etex}
%    \begin{macrocode}
\def\adjcalc@etex{%
    \protected\def\adjsetlength##1##2{%
        ##1=\glueexpr(##2)\relax
    }%
    \protected\def\adjaddtolength##1##2{%
        \advance##1 by \glueexpr(##2)\relax
    }%
    \protected\def\adjsetcounter##1##2{%
        \@ifundefined{c@##1}%
            {\@nocounterr{##1}}%
            {\global\csname c@##1\endcsname\numexpr(##2)\relax}%
    }%
    \protected\def\adjaddtocounter##1##2{%
        \@ifundefined{c@##1}%
            {\@nocounterr{##1}}%
            {\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}%
    }%
    \def\adjbox@default##1##2{%
        \@defaultunits##1=\glueexpr##2 \adjbox@defaultunit\relax\@nnil
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\adjcalc@calc}
% This uses the underlying (re-)definitions of the normal macros (\Macro\setlength, ...) done by the \pkg{calc} package.
% This allows to locally redefine \Macro\setlength to call \Macro\adjsetlength, etc., without causing an infinite loop.
%    \begin{macrocode}
\def\adjcalc@calc{%
    \DeclareRobustCommand\adjsetlength{\calc@assign@skip}%
    \DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}%
    \DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}%
    \DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}%
    \def\adjbox@checkdefault##1\@nnil##2##3{%
        \ifx\relax##1\relax\else
            \calc@assign@skip{##2}{##3}%
        \fi
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjcalc@pgfmath}
%    \begin{macrocode}
\def\adjcalc@pgfmath{%
    \DeclareRobustCommand\adjsetlength{\pgfmathsetlength}%
    \DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}%
    \DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}%
    \DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}%
    \def\adjbox@default##1##2{%
        \edef\pgfmathresultunitscale{1\adjbox@defaultunit}%
        \let\pgfmathpostparse\pgfmathscaleresult
        \pgfmathparse{##2}%
        ##1=\pgfmathresult pt\relax
    }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\adjcalc@overwrite}
%    \begin{macrocode}
\def\adjcalc@overwrite{%
    \let\setlength\adjsetlength
    \let\addtolength\adjaddtolength
    \let\setcounter\adjsetcounter
    \let\addtocounter\adjaddtocounter
}
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%</adjcalc>
% \fi
%
%
% \iffalse
%<*adjpgf.def>
% \fi
%    \begin{macrocode}
\RequirePackage{pgf}
%    \end{macrocode}
%
% \begin{macro}{\@trimbox}
%    \begin{macrocode}
\def\@clipbox#1#2#3#4#5{%
    \@trimbox{#1}{#2}{#3}{#4}{#5}%
    \setbox#5\hbox{\begin{pgfpicture}%
        \pgfpathmoveto{\pgfqpoint\z@{-\dp#5}}%
        \pgfpathlineto{\pgfqpoint\z@{\ht#5}}%
        \pgfpathlineto{\pgfqpoint{\wd#5}{\ht#5}}%
        \pgfpathlineto{\pgfqpoint{\wd#5}{-\dp#5}}%
        \pgfpathclose
        \pgfusepathqclip
        \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}%
        \pgfnode{rectangle}{base west}{\usebox#5}{}{}%
        \pgfsetbaselinepointnow{\pgfpoint\z@\z@}%
    \end{pgfpicture}}%
}
%    \end{macrocode}
% \end{macro}
%<VIM> vim: ft=tex
%
% \iffalse
%</adjpgf.def>
% \fi
%
%
% \Finale
% \endinput