summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/fallback/v3.0/caption.dtx
blob: 7f7b4a49d1b87a3a63d3464bf44290ab74f29bbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
% \iffalse meta-comment
% 
% This is file `caption.dtx'.
% 
% Copyright (C) 1994-2007 Axel Sommerfeldt (caption@sommerfee.de)
% 
% --------------------------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Axel Sommerfeldt.
% 
% This work consists of the files caption.ins, caption.dtx,
% caption2.dtx, and anleitung.tex and the derived files
% caption.sty, caption2.sty, caption3.sty, and manual.tex.
% 
% \fi
% \CheckSum{2178}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\newcommand\NEWfeature{\NEW{New feature}}
\newcommand\NEWdescription{\NEW{New description}}
\newcommand\NEW[2]{\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}}
%
\font\manual=manfnt
\newcommand\DANGER{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{\manual\char127}}}}
%
\ifx\pdfoutput\undefined\else
  \ifcase\pdfoutput\else
    \usepackage{mathptmx,courier}
    \usepackage[scaled=0.90]{helvet}
    \addtolength\marginparwidth{15pt}
  \fi
\fi
%
%\usepackage[french,USenglish]{babel}
\usepackage{color,setspace}
%
%\usepackage{float}
\usepackage{longtable}
%\usepackage[raggedright]{sidecap}
%
\usepackage{caption}[2005/08/24]
\DeclareCaptionLabelSeparator{endash}{\space\textendash\space}
\usepackage{hyperref}
%
\DeclareCaptionFont{red}{\color{red}}
\DeclareCaptionFont{green}{\color{green}}
\DeclareCaptionFont{blue}{\color{blue}}
%
\DeclareCaptionLabelSeparator{period-newline}{. \\}
\DeclareCaptionStyle{period-newline}[labelsep=period]{labelsep=period-newline}
\DeclareCaptionStyle{period-newline2}[labelsep=period,justification=centering]{labelsep=period-newline}
\DeclareCaptionStyle{period-newline3}[labelsep=period]{labelsep=period-newline,justification=centering}
\DeclareCaptionFormat{reverse}{#3#2#1}
\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}
\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}
\DeclareCaptionLabelSeparator{fill}{\hfill}
%
\DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
    M\kern.05em A\kern.1em-\kern.1em Script}}
%
%<+driver>\OnlyDescription
%
\begin{document}
  \DocInput{caption.dtx}
\end{document}
%</driver>
% \fi
%
% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
% \let\package\puresf\def\thispackage{\package{caption}}
% \let\env\purett \let\opt\purett
%
% \newcommand*\version[2][]{$v#2$}
% 
% \newenvironment{Options}[1]%
%   {\list{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
%    \settowidth{\labelwidth}{\texttt{#1\space}}%
%    \setlength{\leftmargin}{\labelwidth}%
%    \addtolength{\leftmargin}{\labelsep}}}%
%   {\endlist}
% 
% \newenvironment{Example}%
%   {\ifvmode\else\unskip\par\fi
%    \minipage{\linewidth}\smallskip}%
%   {\smallskip\endminipage}
% \newcommand\example[3][figure]{%
%   \begingroup
%     \captionsetup{#2}%
%     \captionof{#1}[]{#3}%
%   \endgroup}
% 
% \GetFileInfo{caption.sty}
% \title{Typesetting captions with the
%        \thispackage\ package\thanks{This package has version number
%        \fileversion, last revised \filedate.}}
% \author{Axel Sommerfeldt\\\href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}}
% \date{2007/04/09}
% \maketitle
% 
% \begin{abstract}
% The \thispackage\ package offers customization of captions
% in floating environments such |figure| and |table| and cooperates with
% many other packages.\footnote{A complete re-work of the user interface
% done with Steven D. Cochran and Frank Mittelbach has lead to
% this new enhanced version 3.0.}
% \end{abstract}
% 
% \tableofcontents
% 
% \newcommand\figuretext{^^A
%   White sand beaches. The pink smoothness of the conch shell. A sea abundant
%   with possibilities. Duty-free shops filled with Europe's finest gifts and
%   perfumes. Play your favorite game of golf amidst the tropical greens on one
%   of the many championship courses.}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \section{Introduction}
% 
% Within the standard \LaTeX\ classes captions haven't received the attention
% they deserve. Simply typeset as an ordinary paragraph there is no
% remarkable visual difference from the rest of the text, like here:
% 
% \example{belowskip=\abovecaptionskip}{\figuretext}
% 
% There should be possibilities to change this; for example, it would be nice
% if you could make the text of the caption a little bit smaller as the normal
% text, add an extra margin, typeset the caption label with the same font
% family and shape as your headings etc. Just like this one:
% 
% \example{belowskip=\abovecaptionskip,size=small,margin=10pt,labelfont=bf,labelsep=endash}{\figuretext}
% 
% You can do this easily with this package as there are many ready-to-use
% caption formatting options, but you are free to define your very own stuff, too.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \pagebreak[4]
% \section{Using the package}
% \label{usage}
% 
% \DescribeMacro{\usepackage}
% Insert
% \begin{quote}
%   |\usepackage|\oarg{options}|{caption}[|\texttt{\filedate}|]|
% \end{quote}
% into the preamble of your document, i.e.~the part of your document
% between |\documentclass| and |\begin{document}|.
% The options control how your captions will look like; e.g.,
% \begin{quote}
%   |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}|
% \end{quote}
% would result in captions looking like the second one in the introduction.
% 
% \DescribeMacro{\captionsetup}
% For a later change of options the \thispackage\ package provides the command
% \begin{quote}
%   |\captionsetup|\oarg{float type}\marg{options}
% \end{quote}
% So
% \begin{quote}
%   |\usepackage[margin=10pt,font=small,labelfont=bf]{caption}|
% \end{quote}
% and
% \begin{quote}
%   |\usepackage{caption}|\\
%   |\captionsetup{margin=10pt,font=small,labelfont=bf}|
% \end{quote}
% are equal in their results.
% 
% It's good to know that |\captionsetup| has an effect on the current
% environment only. So if you want to change some settings for the
% current |figure| or |table| only, just place the |\captionsetup| command
% inside the |figure| or |table| right before the |\caption| command.
% For example
% \begin{quote}
%   |\begin{figure}|\\
%   |  |\ldots\\
%   |  \captionsetup{singlelinecheck=off}|\\
%   |  \caption{|\ldots|}|\\
%   |\end{figure}|
% \end{quote}
% switches the single-line-check off, but only for this |figure| so all
% the other captions remain untouched.
% 
% (For a description of the optional parameter \meta{float type} see
%  section \ref{misc}: \textit{``Useful stuff''}.)
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \pagebreak[3]
% \section{Options}
% 
% \def\OptionLabel{RaggedRight}
% \def\UserDefined{\ldots}
% \makeatletter
% \newcommand*\Section{\@ifstar{\@Section\relax}{\@Section{section}}}
% \newcommand*\@Section[3]{#1 \ref{#2}: \textit{``#3''}}
% \makeatother
% \newcommand*\See[1]{{\small (See #1)}}
% \newcommand*\SeeUserDefined[1][]{%
%   \See{\Section{declare}{Do it yourself}#1}}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Formatting}
% 
% \DescribeMacro{format=}
% A figure or table caption mainly consits of three parts: the caption label,
% which says if this object is a `Figure' or `Table' and what number is
% associated with it, the caption text itself, which is normally a short
% description of contents, and the caption separator which separates the text
% from the label.
%
% The \textit{caption format} determines how this information will be presented;
% it is specified with the option
% \begin{quote}
%   |format=|\meta{format name}\quad ,
% \end{quote}
% having the name of the caption format as its argument.
%
% There are two standard caption formats:
% \iffalse
% \footnote{You have the option to
% define your own ones, too. See section \ref{declare}:
% \textit{``Do it yourself!''} for details.}
% \fi
% 
% \begin{Options}{\OptionLabel}
%   \item[plain]\NEWdescription{v3.0h}
%   Typesets the captions as a normal paragraph.
%   (This is the default behaviour, it
%   is adapted from the standard \LaTeX\ document classes.)
% 
%   \item[hang]
%   Indents the caption text, so it will `hang' under the first line of the text.
% 
%   \item[\UserDefined]
%   Own formats can be defined using |\DeclareCaptionFormat|.
%   \SeeUserDefined
% \end{Options}
% 
% \begin{Example}
%   An example: Specifying the option
%   \begin{quote}
%     |format=hang|
%   \end{quote}
%   yields captions like this:
%   \example{format=hang}{\figuretext}
% \end{Example}
% 
% \DescribeMacro{indention=}
% For both formats (\texttt{plain} and \texttt{hang}) you can setup an extra
% indention starting at the second line of the caption. You do this with the
% option
% \begin{quote}
%   |indention=|\meta{amount}.
% \end{quote}
% 
% Two examples:
% 
% \begin{Example}
%   \begin{quote}
%     |format=plain,indention=.5cm|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{format=plain,indention=.5cm}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |format=hang,indention=-0.5cm|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{format=hang,indention=-0.5cm}{\figuretext}
% \end{Example}
% 
% \pagebreak[3]
% \DescribeMacro{labelformat=}
% With the option
% \nopagebreak[3]
% \begin{quote}
%   |labelformat=|\meta{label format name}
% \end{quote}
% \NEWdescription{v3.0e}
% you specify how the caption label will be typeset.
% There are four standard caption label formats:
% 
% \begin{Options}{\OptionLabel}
%   \item[default]
%   The caption label will be typeset as specified by the document class,
%   usually this means the name and the number (like \texttt{simple}).
%   (This is the default behaviour.)
%
%   \item[empty]
%   The caption label will be empty. (This option makes sense when used
%   together with other options like \texttt{labelsep=none}.)
% 
%   \item[simple]
%   The caption label will be typeset as a name and a number.
% 
%   \item[parens]
%   The number of the caption label will be typeset in parentheses.
% 
%   \item[\UserDefined]
%   Own label formats can be defined using |\DeclareCaptionLabelFormat|.
%   \SeeUserDefined
% \end{Options}
% 
% \begin{Example}
%   An example: Using the options
%   \begin{quote}
%     |labelformat=parens,labelsep=quad|
%   \end{quote}
%   gives captions like this one:
%   \example{labelformat=parens,labelsep=quad}{\figuretext}
% \end{Example}
% 
% \DescribeMacro{labelsep=}
% With the option
% \begin{quote}
%   |labelsep=|\meta{label separator name}
% \end{quote}
% you specify what caption separator will be used.
% You can choose one of the following:
% 
% \begin{Options}{\OptionLabel}
%   \item[none]
%   There is no caption separator. (This option makes sense when used
%   together with other options like \texttt{labelformat=empty}.)
% 
%   \item[colon]
%   The caption label and text will be separated by a colon and a space.
%   (This is the default one.)
% 
%   \item[period]
%   The caption label and text will be separated by a period and a space.
% 
%   \item[space]
%   The caption label and text will be separated by a single space.
% 
%   \item[quad]
%   The caption label and text will be separated by a |\quad|.
% 
%   \item[newline]
%   The caption label and text will be separated by a line break (|\\|).
% 
%   \item[endash]\NEWfeature{v3.0h}
%   The caption label and text will be separated by an en-dash,
%   surrounded by spaces (| -- |).
% 
%   \item[\UserDefined]
%   Own separators can be defined using |\DeclareCaptionLabelSeparator|.
%   \SeeUserDefined
% \end{Options}
% 
% Three examples:
% \begin{Example}
%   \begin{quote}
%     |labelsep=period|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{labelsep=period}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |labelsep=newline,singlelinecheck=false|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{labelsep=newline,singlelinecheck=false}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |labelsep=endash|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{labelsep=endash}{\figuretext}
% \end{Example}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Justification}
% \label{justification}
% 
% \DescribeMacro{justification=}
% As addition to the caption format you could also specify a
% \emph{caption justification}; it is specified with the option
% \begin{quote}
%   |justification=|\meta{justification name}\quad.
% \end{quote}
%
% You can choose one of the following:
% 
% \begin{Options}{\OptionLabel}
%   \item[justified]
%   Typesets the caption as a normal paragraph. (This is the default.)
% 
%   \item[centering]
%   Each line of the caption will be centered.
% 
% \iffalse
%   \item[Centering]
%   Each line of the caption will be centered, too.
%   But this time the command |\Centering| of the \package{ragged2e} package
%   will be used to achieve this. This difference is that this time the word
%   breaking algorithm of \TeX\ will work inside the caption.
% \fi
% 
%   \item[centerlast]
%   The last line of each paragraph of the caption text will be centered.
% 
%   \item[centerfirst]
%   Only the first line of the caption will be centered.
% 
%   \item[raggedright]
%   Each line of the caption will be moved to the left margin.
% 
% \iffalse
%   \item[RaggedRight]
%   Each line of the caption will be moved to the left margin using
%   the command |\RaggedRight| from the \package{ragged2e} package.
% \fi
%   \item[RaggedRight]
%   Each line of the caption will be moved to the left margin, too.
%   But this time the command |\RaggedRight| of the \package{ragged2e} package
%   will be used to achieve this. The main difference is that the word
%   breaking algorithm of \TeX\ will work inside captions.
% 
%   \item[raggedleft]
%   Each line of the caption will be moved to the right margin.
% 
% \iffalse
%   \item[RaggedLeft]
%   Each line of the caption will be moved to the right margin using
%   the command |\RaggedLeft| from the \package{ragged2e} package.
% \fi
% 
%   \item[\UserDefined]
%   Own justifications can be defined using |\DeclareCaptionJustification|.
%   \SeeUserDefined
% \end{Options}
% 
% Three examples:
% \begin{Example}
%   \begin{quote}
%     |justification=centerlast|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{justification=centerlast}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |format=hang,justification=raggedright|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{format=hang,justification=raggedright}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |labelsep=newline,justification=centering|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{belowskip=\abovecaptionskip,labelsep=newline,justification=centering}{\figuretext}
% \end{Example}
% 
% \DescribeMacro{singlelinecheck=}
% The standard \LaTeX\ document classes (|article|, |report|, and |book|)
% automatically center a caption if it fits in one single line:
%
% \example{belowskip=\abovecaptionskip}{A short caption.}
%
% \DANGER
% The \thispackage\ package adapts this behaviour and therefore usually
% ignores the justification you have set with |justification=| in such case.
% But you can switch this special treatment of such short captions off
% with the option
% \begin{quote}
%   |singlelinecheck=|\meta{bool}\quad.
% \end{quote}
% Using |false|, |no|, |off| or |0| for \meta{bool} switches the
% extra centering off:
% \begin{quote}
%   |singlelinecheck=false|
% \end{quote}
% Doing so the above short caption would look like
% 
% \begingroup
% \captionsetup{type=figure}
% \ContinuedFloat
% \endgroup
% \example{belowskip=\abovecaptionskip,singlelinecheck=false}{A short caption.}
% 
% You switch the extra centering on again by using |true|, |yes|, |on| or |1|
% for \meta{bool}. (The default is on.)
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Fonts}
% \label{fonts}
% 
% \DescribeMacro{font=}
% \DescribeMacro{labelfont=}
% \DescribeMacro{textfont=}
% There are three font options which affects different parts of the caption:
% One affecting the whole caption (|font|), one which only affects the caption
% label and separator (|labelfont|) and at least one which only affects the
% caption text (|textfont|).
% You set them up using the options
% \begin{quote}\begin{tabular}{@{}r@{}ll}
%   |font=|      & \marg{font options} & ,\\
%   |labelfont=| & \marg{font options} & , and\\
%   |textfont=|  & \marg{font options} & .\\
% \end{tabular}\end{quote}
% 
% And these are the available font options:
% 
% \begin{Options}{\OptionLabel}
%   \item[scriptsize]   {\scriptsize Very small size}
%   \item[footnotesize] {\footnotesize The size usually used for footnotes}
%   \item[small]        {\small Small size}
%   \item[normalsize]   {\normalsize Normal size}
%   \item[large]        {\large Large size}
%   \item[Large]        {\Large Even larger size}
% 
%   \item[up]           {\upshape Upright shape}
%   \item[it]           {\itshape Italic shape}
%   \item[sl]           {\slshape Slanted shape}
%   \item[sc]           {\scshape Small Caps shape}
% 
%   \item[md]           {\mdseries Medium series}
%   \item[bf]           {\bfseries Bold series}
% 
%   \item[rm]           {\rmfamily Roman family}
%   \item[sf]           {\sffamily Sans Serif family}
%   \item[tt]           {\ttfamily Typewriter family}
% 
%   \item[\UserDefined]
%   Own font options can be defined using |\DeclareCaptionFont|.
%   \SeeUserDefined
% \end{Options}
% 
% If you use only one of these options you can omit the braces;
% e.g., the options
% \iffalse
% \begin{quote}
% \fi
%   |font={small}|
% \iffalse
% \end{quote}
% \fi
% and
% \iffalse
% \begin{quote}
% \fi
%   |font=small|
% \iffalse
% \end{quote}
% \fi
% will give the same result.
% 
% Two examples:
% \begin{Example}
%   \begin{quote}
%     |font={small,it},labelfont=bf|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{font={small,it},labelfont=bf}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |font=small,labelfont=bf,textfont=it|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{font=small,labelfont=bf,textfont=it}{\figuretext}
% \end{Example}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Margins and further paragraph options}
% \label{margins}
% 
% \DescribeMacro{margin=}
% \DescribeMacro{width=}
% For all captions you can specify \emph{either} an extra margin \emph{or}
% a fixed width. You do this by using the options
% \begin{quote}\begin{tabular}{@{}r@{}ll}
%   |margin=| & \meta{amount}   & \emph{or}\\
%   |width=|  & \meta{amount} & \\
% \end{tabular}\end{quote}
% Nevertheless what option you use, the left and right margin will be the
% same.
% 
% Two examples will illustrating this:
% \begin{Example}
%   \begin{quote}
%     |margin=10pt|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{margin=10pt}{\figuretext}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |width=.75\textwidth|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{width=.75\textwidth}{\figuretext}
% \end{Example}
% 
% \DescribeMacro{parskip=}
% This option is useful for captions containing more than one paragraph.
% It specifies the extra vertical space inserted between them:
% \begin{quote}
%   |parskip=|\meta{amount}
% \end{quote}
% One example:
% \begin{Example}
%   \begin{quote}
%     |margin=10pt,parskip=5pt|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{margin=10pt,parskip=5pt}{
%     First paragraph of the caption. This one contains some test, just to
%     show how these options affect the layout of the caption.
% 
%     Second paragraph of the caption. This one contains some text, too, to
%     show how these options affect the layout of the caption.}
% \end{Example}
% 
% \DescribeMacro{hangindent=}
% The option
% \begin{quote}
%   |hangindent=|\meta{amount}
% \end{quote}
% is for setting up a hanging indention starting from the second line of each
% paragraph. If the caption contains just a single paragraph, using this option
% leads to the same result as the option |indention=| you already know about.
% But if the caption contains multiple paragraphs you will notice the difference:
% 
% \begin{Example}
%   \begin{quote}
%     |format=hang,indention=-.5cm|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{format=hang,indention=-.5cm}{
%     First paragraph of the caption. This one contains some test, just to
%     show how these options affect the layout of the caption.
% 
%     Second paragraph of the caption. This one contains some text, too, to
%     show how these options affect the layout of the caption.}
% \end{Example}
% 
% \begin{Example}
%   \begin{quote}
%     |format=hang,hangindent=-.5cm|
%   \end{quote}
%   \captionsetup{aboveskip=0pt}
%   \example{format=hang,hangindent=-.5cm}{
%     First paragraph of the caption. This one contains some test, just to
%     show how these options affect the layout of the caption.
% 
%     Second paragraph of the caption. This one contains some text, too, to
%     show how these options affect the layout of the caption.}
% \end{Example}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Styles}
% \label{style}
% 
% \DescribeMacro{style=}
% A suitable combination of caption options is called \emph{caption style}.
% You can compare them more or less to page styles which you set up with
% |\pagestyle|: The caption style provides all settings for a whole caption layout.
% 
% You switch to an already defined caption style with the option
% \begin{quote}
%   |style=|\meta{style name}\quad.
% \end{quote}
% The \thispackage\ package usually defines only the style |default| which
% puts all options you already know about to the default ones.
% This means that specifying the option
% \begin{quote}
%   |style=default|
% \end{quote}
% has the same effect as specifying all these options:
% \begin{quote}
%   |format=default,labelformat=default,labelsep=default,|\\
%   |justification=default,font=default,labelfont=default,|\\
%   |textfont=default,margin=0pt,indention=0pt,parindent=0pt|\\
%   |hangindent=0pt,singlelinecheck=true|
% \end{quote}
% 
% Own caption styles can be defined using |\DeclareCaptionStyle|.
% \SeeUserDefined
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Skips}
% 
% \DescribeMacro{aboveskip=}
% \DescribeMacro{belowskip=}
% The spaces above and below the caption are controlled by the skips
% |\abovecaptionskip| and |\belowcaptionskip|. The standard \LaTeX\ document
% classes |article|, |report| and |book| set |\abovecaptionskip| to |10pt|
% and |\belowcaptionskip| to |0pt|.
%
% \pagebreak[3]
% Both skips can be changed with the command |\setlength|, but you can
% use these options, too:
% \nopagebreak[3]
% \begin{quote}\begin{tabular}{@{}r@{}ll}
%   |aboveskip=| & \meta{amount} & and\\
%   |belowskip=| & \meta{amount} & .\\
% \end{tabular}\end{quote}
%
% \DescribeMacro{position=}
% Using |\abovecaptionskip| and |\belowcaptionskip| has a major design flaw:
% If the caption is typeset \emph{above} (and not \emph{below}) the figure
% or table they are not set up very useful at default, because there will be
% some extra space above the caption but no space between the caption and the
% figure or table itself. (Remember: |\belowcaptionskip| is usually set to |0pt|.)
% 
% Please compare the spacing in these small tables:
% \begin{Example}
%   \begin{minipage}[c]{.5\linewidth}
% \iffalse
%     \captionsetup{aboveskip=0pt}%
% \fi
%     \captionof{table}{A table}
%     \centering\begin{tabular}{ll}
%       A & B \\
%       C & D \\
%     \end{tabular}
%   \end{minipage}
%   \begin{minipage}[c]{.5\linewidth}
%     \centering\begin{tabular}{ll}
%       A & B \\
%       C & D \\
%     \end{tabular}
%     \captionof{table}{A table}
%   \end{minipage}
% \end{Example}
% 
% But you can fix this by using the option |position=|: It specifies how the
% spacing above and below the caption will be used:
% \begin{quote}
%   |position=top|\quad(or |position=above|)
% \end{quote}
% tells the \thispackage\ package to use the spacing useful for caption
% \emph{above} the figure or table and
% \begin{quote}
%   |position=bottom|\quad(or |position=below|)
% \end{quote}
% tells the \thispackage\ package to use the spacing useful for captions
% \emph{below} the figure or table. (The last one is the default setting
% except for |longtable|s.)
% 
% So adding an extra |\captionsetup{position=top}| to the left example
% table gives you proper spacing around both captions:
% \begin{Example}
%   \begin{minipage}[c]{.5\linewidth}
%     \captionsetup{position=top}
%     \captionof{table}{A table}
%     \centering\begin{tabular}{ll}
%       A & B \\
%       C & D \\
%     \end{tabular}
%   \end{minipage}
%   \begin{minipage}[c]{.5\linewidth}
%     \centering\begin{tabular}{ll}
%       A & B \\
%       C & D \\
%     \end{tabular}
%     \captionof{table}{A table}
%   \end{minipage}
% \end{Example}
%
% (Technically speaking |\abovecaptionskip| and |\belowcaptionskip| will
% be swapped if you specify the option |position=top|, so in both cases
% |\abovecaptionskip| will be used between the caption and the figure or
% table itself.)
% 
% This option is especially useful when used together with the optional
% argument of the |\captionsetup| command.
% \See{\Section{misc}{Useful stuff} for details}\par
% For example
% \begin{quote}
%   |\captionsetup[table]{position=top}|
% \end{quote}
% causes all captions within tables to be treated as captions \emph{above}
% the table (regarding spacing around it).
% \DescribeMacro{tableposition=}
% \NEWfeature{v3.0a}
% Because this is a very common setting the \thispackage\ package offers
% an abbreviating option for the use with |\usepackage|:
% \begin{quote}
%   |\usepackage[|\ldots|,tableposition=top]{caption}|\footnote{Please
%   note that this is \emph{not} sufficient when using a
%   \KOMAScript\ document class, you need to use the \emph{global}
%   option |tablecaptionabove|, too.}
% \end{quote}
% is equivalent to
% \begin{quote}
%   |\usepackage[|\ldots|]{caption}|\\
%   |\captionsetup[table]{position=top}|
% \end{quote}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \pagebreak[3]
% \section{Useful stuff}
% \label{misc}
% 
% \DescribeMacro{\caption}
% The command
% \nopagebreak[3]
% \begin{quote}
%   |\caption|\oarg{lst\_entry}\marg{heading}
% \end{quote}
% \nopagebreak[3]
% typesets the caption inside a floating environment like |figure| or |table|.
% Well, you already know this, but the \thispackage\ package offers an extension:
% If you leave the argument \meta{lst\_entry} empty, no entry in the list of
% figures or tables will be made. For example:
% \begin{quote}
%   |\caption[]{A figure without entry in the list of figures.}|
% \end{quote}
% 
% \DescribeMacro{\caption*}
% The \package{longtable} package defines the command |\caption*| which
% typesets the caption without label and without entry in the list of tables.
% An example:
% \begin{quote}
%   |\begin{longtable}{cc}|\\
%   |  \caption*{A table}\\|\\
%   |  A & B \\|\\
%   |  C & D \\|\\
%   |\end{longtable}|
% \end{quote}
% looks like
% \begin{longtable}{cc}
%   \caption*{A table}\\
%   A & B \\
%   C & D \\
% \end{longtable}
% 
% This package offers this feature, too, so you can use this command now within
% every floating environment like |figure| or |table|, like:
% \begin{quote}
%   |\begin{table}|\\
%   |  \caption*{A table}|\\
%   |  \begin{tabular}{cc}|\\
%   |    A & B \\|\\
%   |    C & D \\|\\
%   |  \end{tabular}|\\
%   |\end{table}|
% \end{quote}
% 
% \DescribeMacro{\captionof}
% \DescribeMacro{\captionof*}
% Sometimes you want to typeset a caption \emph{outside} a floating environment,
% putting a figure within a |minipage| for instance. For this purpose the
% \thispackage\ package offers the command
% \begin{quote}
%   |\captionof|\marg{float type}\oarg{lst\_entry}\marg{heading}\quad.
% \end{quote}
% Note that the first argument, the \meta{float type}, is mandatory here, because
% the |\captionof| command needs to know which name to put into the caption label
% (e.g. ``Figure'' or ``Table'') and in which list to put the contents entry.
% An example:
% \begin{quote}
%   |\captionof{figure}{A figure}|\\
%   |\captionof{table}{A table}|
% \end{quote}
% typesets captions like this:
% \begin{Example}
%   \captionof{figure}{A figure}
%   \captionsetup{belowskip=\abovecaptionskip}
%   \captionof{table}{A table}
% \end{Example}
% 
% The star variant |\captionof*| has the same behaviour as the |\caption*| command:
% it typesets the caption without label and without entry to the list of figures
% or tables.
%
% Please use both |\captionof| and |\captionof*| only \emph{inside} environments
% (like |minipage| or |\parbox|), otherwise a page break can appear between content
% and caption. Furthermore some strange effects could occur (e.g., wrong spacing
% around captions).
% 
% \DescribeMacro{\ContinuedFloat}
% Sometimes you want to split figures or tables without giving them
% their own reference number. This is what the command
% \begin{quote}
%   |\ContinuedFloat|
% \end{quote}
% is for; it should be used as first command inside the floating environment.
% It prevents the increment of the relevant counter (usually done by |\caption|)
% so a figure or table with a |\ContinuedFloat| in it gets the same reference
% number as the figure or table before.
% 
% An example:
% \begin{quote}
%   |\begin{table}|\\
%   |\caption{A table}|\\
%   \ldots\\
%   |\end{table}|\\
%   \ldots\\
%   |\begin{table}\ContinuedFloat|\\
%   |\caption{A table (cont.)}|\\
%   \ldots\\
%   |\end{table}|
% \end{quote}
% gives the following result:
% \begin{Example}
%   \makeatletter\def\@captype{table}\makeatother
%   \caption[]{A table}
%   \centerline{\ldots}
%   \ContinuedFloat
%   \captionsetup{aboveskip=0pt}
%   \caption[]{A table (cont.)}
% \end{Example}
% 
% \DescribeMacro{\captionsetup}
% We already know the |\captionsetup| command (see \Section{usage}
% {Using the package}), but this time we get enlighten about
% its optional argument \meta{float type}.
% 
% Remember, the syntax of this command is
% \begin{quote}
%   |\captionsetup|\oarg{float type}\marg{options}\quad.
% \end{quote}
% 
% If a \meta{float type} gets specified, all the \meta{options} don't
% change anything at this time. Instead they only get marked for a later use,
% when a caption inside of a floating environment of the particular type
% \meta{float type} gets typeset.
% For example
% \begin{quote}
%   |\captionsetup[figure]|\marg{options}
% \end{quote}
% forces captions within a |figure| environment to use the given \meta{options}.
%
% Here comes an example to illustrate this:
% \begin{quote}
%   |\captionsetup{font=small}|\\
%   |\captionsetup[figure]{labelfont=bf}|
% \end{quote}
% gives captions like this:
% \begin{Example}
%   \captionsetup{font=small}
%   \captionsetup[figure]{labelfont=bf}
%   \captionof{figure}[]{A figure}
%   \captionsetup{belowskip=\abovecaptionskip}
%   \captionof{table}[]{A table}
% \end{Example}
% 
% As you see the command |\captionsetup[figure]{labelfont=bf}| only changed
% the font of the figure caption labels, not touching all other ones.
% 
% \DescribeMacro{\clearcaptionsetup}
% If you want to get rid of these parameters marked for an automatic use within
% a particular environment you can use the command
% \begin{quote}
%   |\clearcaptionsetup|\marg{float type}\quad.
% \end{quote}
%
% For example |\clearcaptionsetup{figure}| would clear the extra handling in the
% example above:
% \begin{Example}
%   \captionsetup{font=small}
%   \captionof{figure}[]{A figure}
%   \captionsetup{belowskip=\abovecaptionskip}
%   \captionof{table}[]{A table}
% \end{Example}
% 
% As \meta{float type} you can usually give one of these two only:
% |figure| or |table|.
% But as we will see later some \LaTeX\ packages (like the
% \package{float}, \package{longtable}, and \package{sidecap} package
% for example) offer additional floating environments and these two
% commands can also be used with them.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \pagebreak[3]
% \section{Do it yourself!}
% \label{declare}
% 
% A family of commands is provided to allow users to define their own formats.
% This enables information on separators, justification, fonts, and styles to
% be associated with a name and kept in one place
% (these commands need to appear in the document preamble,
% this is the part between |\documentclass| and |\begin{document}|).
% 
% \pagebreak[2]
% \DescribeMacro{\DeclareCaptionFormat}
% You can define your own caption formats using the command
% \begin{quote}
%   |\DeclareCaptionFormat|\marg{name}\marg{code using \#1, \#2 and \#3}\quad.
% \end{quote}
% At usage the system replaces \#1 with the caption label, \#2 with the
% separator and \#3 with the text. So the standard format |plain| is
% pre-defined by the \thispackage\ package as
% \begin{quote}
%   |\DeclareCaptionFormat{plain}{#1#2#3\par}|
% \end{quote}
% 
% \DescribeMacro{\DeclareCaptionLabelFormat}
% Likewise you can define your own caption label formats:
% \begin{quote}
%   |\DeclareCaptionLabelFormat|\marg{name}\marg{code using \#1 and \#2}
% \end{quote}
% At usage \#1 gets replaced with the name (e.g. ``figure'') and \#2
% gets replaced with the reference number (e.g. ``12'').
% 
% \DescribeMacro{\bothIfFirst}
% \DescribeMacro{\bothIfSecond}
% If you define your own caption label formats and use the \package{subfig}
% package\cite{subfig}, you should take care of empty caption label names.
% For this purpose the commands
% \begin{quote}
%   |\bothIfFirst|\marg{first arg}\marg{second arg}\quad and\\
%   |\bothIfSecond|\marg{first arg}\marg{second arg}
% \end{quote}
% are offered. |\bothIfFirst| tests if the first argument exists (means: is
% not empty), |\bothIfSecond| tests if the second argument exists. If yes,
% both arguments get typeset, otherwise none of them.
% 
% For example the standard label format |simple| is \emph{not} defined as
% \begin{quote}
%   |\DeclareCaptionLabelFormat{simple}{#1 #2}|\quad,
% \end{quote}
% because this could cause an extra space if \#1 is empty. Instead |simple|
% is defined as
% \begin{quote}
%   |\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{ }#2}|\quad,
% \end{quote}
% causing the space to appear only if the label name is present.
% 
% \pagebreak[3]
% \DescribeMacro{\DeclareCaptionLabelSeparator}
% You can define your own caption label separators with
% \nopagebreak[3]
% \begin{quote}
%   |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\quad.
% \end{quote}
% \nopagebreak[3]
% Again an easy example taken from the \thispackage\ package itself:
% \nopagebreak[3]
% \begin{quote}
%   |\DeclareCaptionLabelSeparator{colon}{: }|
% \end{quote}
% \pagebreak[3]
% 
% \DescribeMacro{\DeclareCaptionJustification}
% You can define your own caption justifications with
% \begin{quote}
%   |\DeclareCaptionJustification|\marg{name}\marg{code}\quad.
% \end{quote}
% The \meta{code} simply gets typeset just before the caption.
% E.g.~using the justification |raggedright|, which is defined as
% \begin{quote}
%   |\DeclareCaptionJustification{raggedright}{\raggedright}|\quad,
% \end{quote}
% lets captions with all lines moved to the left margin.
% 
% \DescribeMacro{\DeclareCaptionFont}
% You can define your own caption fonts with
% \begin{quote}
%   |\DeclareCaptionFont|\marg{name}\marg{code}\quad.
% \end{quote}
% For example this package defines the options |small| and |bf| as
% \begin{quote}
%   |\DeclareCaptionFont{small}{\small}|\quad and\\
%   |\DeclareCaptionFont{bf}{\bfseries}|\quad.
% \end{quote}
% The line spacing could be customized using the \package{setspace} package,
% for example:\NEWdescription{v3.0h}
% \begin{quote}
%   |\usepackage{setspace}|\\
% \iffalse
%   |\DeclareCaptionFont{singlespacing}{\setstretch{1}}|\quad\footnote{%
%   \emph{Note:} Using \cs{singlespacing} does not work here since it contains
%   a \cs{vskip} command.}\\
%   |\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}|\\
%   |\DeclareCaptionFont{doublespacing}{\doublespacing}|\\
% \fi
%   |\captionsetup{font={onehalfspacing,small},labelfont=bf}|
% \end{quote}
% \example{font={onehalfspacing,small},labelfont=bf,singlelinecheck=off}\figuretext
% An example which brings color into life:
% \begin{quote}
%   |\usepackage{color}|\\
%   |\DeclareCaptionFont{red}{\color{red}}|\\
%   |\DeclareCaptionFont{green}{\color{green}}|\\
%   |\DeclareCaptionFont{blue}{\color{blue}}|\\
%   |\captionsetup{labelfont=blue,textfont=green}|
% \end{quote}
% \example{labelfont=blue,textfont=green,singlelinecheck=off}\figuretext
% 
% \DescribeMacro{\DeclareCaptionStyle}
% You can define your own caption styles with
% \begin{quote}
%   |\DeclareCaptionStyle|\marg{name}\oarg{additional options}\marg{options}
% \end{quote}
% Remember, caption styles are just a collection of suitable options, saved
% under a given name. You can wake up these options at any time with the
% option |style=|\meta{style name}.
%
% All caption styles are based on the default set of options. (See \Section
% {style}{Styles} for a complete list.) So you only need
% to specify options which are different to them.
% 
% If you specify \meta{additional options} they get used in addition when
% the caption fits into a single line and this check was not disabled with
% the option |singlelinecheck=off|.
% 
% Again a very easy example taken from the core of this package: The
% caption style |default| is pre-defined as
% \begin{quote}
%   |\DeclareCaptionStyle{default}[justification=centering]{}|\quad.
% \end{quote}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Further Examples}
% 
% If you would like to have a colon \emph{and} a line break as caption
% separator you could define it this way:
% \begin{quote}
%   |\DeclareCaptionLabelSeparator{period-newline}{. \\}|
% \end{quote}
% Selecting this separator with |\captionsetup{labelsep=period-newline}| you
% get captions like this:
% \begin{Example}
%   \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt}
%   \captionsetup{aboveskip=0pt,type=figure}
%   \caption[]{\figuretext}
% \end{Example}
% 
% For short captions---which fit into one single line---this separator
% may not be satisfying, even when the automatically centering process
% is switched off (with |singlelinecheck=off|):
% \begin{Example}
%   \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt,singlelinecheck=0}
%   \captionsetup{aboveskip=0pt,type=figure}
%   \caption[]{A figure.}
% \end{Example}
% 
% An own caption style which selects another caption separator automatically
% puts this right:
% \begin{quote}
%   |\DeclareCaptionStyle{period-newline}%|\\
%   |  [labelsep=period]{labelsep=period-newline}|
% \end{quote}
% \begin{Example}
%   \captionsetup{style=period-newline,labelfont=bf,margin=10pt}
%   \captionsetup{aboveskip=0pt,type=figure}
%   \ContinuedFloat
%   \caption[]{A figure.}
% \end{Example}
% If you would like to keep the centering of these captions instead, an
% appropriate definition would be something like
% \begin{quote}
%   |\DeclareCaptionStyle{period-newline}%|\\
%   |  [labelsep=period,justification=centering]%|\\
%   |  {labelsep=period-newline}|\quad.
% \end{quote}
% Using this definition short captions look like
% \begin{Example}
%   \captionsetup{style=period-newline2,labelfont=bf,margin=10pt}
%   \captionsetup{aboveskip=0pt,type=figure}
%   \ContinuedFloat
%   \caption[]{A figure.}
% \end{Example}
% while long ones still have a line break after the caption label.
% 
% Slightly changed, you also get centered captions if they are longer than
% one line:
% \begin{quote}
%   |\DeclareCaptionStyle{period-newline}%|\\
%   |  [labelsep=period]%|\\
%   |  {labelsep=period-newline,justification=centering}|
% \end{quote}
% \begin{Example}
%   \captionsetup{style=period-newline3,labelfont=bf,margin=10pt}
%   \captionsetup{aboveskip=0pt,type=figure}
%   \caption[]{\figuretext}
% \end{Example}
%
% \bigskip\pagebreak[3]
% Another example: You want captions to look like this:
% \begin{Example}
%   \captionsetup{format=reverse,labelformat=fullparens,labelsep=fill,font=small,labelfont=it}
%   \captionsetup{aboveskip=0pt}
%  \captionof{figure}[]{\figuretext}
% \end{Example}
% \pagebreak[2]
% You could do it this way:
% \nopagebreak[3]
% {\leftmargini=10pt
%  \begin{quote}
%    |\DeclareCaptionFormat{reverse}{#3#2#1}|\\
%    |\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}|\\
%    |\DeclareCaptionLabelSeparator{fill}{\hfill}|\\
%    |\captionsetup{format=reverse,labelformat=fullparens,|\\
%    |              labelsep=fill,font=small,labelfont=it}|
%  \end{quote}}
%
% \bigskip\pagebreak[3]
% Another example: The caption text should go into the left margin; a possible
% solution would be:
% {\leftmargini=10pt
%  \begin{quote}
%    |\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}|\\
%    |\captionsetup{format=llap,labelsep=quad,singlelinecheck=no}|
%  \end{quote}}
% As a result you would get captions like this:
% \begin{Example}
%   \captionsetup{format=llap,singlelinecheck=no,labelsep=quad}
%   \captionsetup{aboveskip=0pt}
%   \captionof{figure}[]{\figuretext}
% \end{Example}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \pagebreak[3]
% \section{Using non-standard document classes}
% 
% \NEWdescription{v3.0p}
% The \thispackage\ package was developed using the standard document classes
% |article|, |report| and |book|, it also works with the Dutch document classes
% |artikel|, |rapport| and |boek|. It is \emph{incompatible} with all other
% document classes, except the ones based on one of the above.
%
% If you are unsure if your document class is supported or not, it's better
% \emph{not} to use this package. You could try if your document will compile
% fine with the \thispackage\ package anyway, but you should watch carefully
% if side-effects occur, i.e. the look and feel of your captions should
% \emph{not} change if you just include the caption package without options.
% (If it does, you can carry on, but you should be warned that the output
% could change with upcoming versions of the \thispackage\ package.)
% If this is fine, you can start setting options with
% |\usepackage[|\ldots|]{caption}| or |\captionsetup| and keep your fingers
% crossed.
%
% The upcoming version \version{3.1} of the \thispackage\ package will be
% adapted to several document classes, e.g. the \package{beamer} class and
% the \KOMAScript\ ones. It's planned for release during Summer 2007.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \section{Compatibility to other packages}
% \label{packages}
% 
% The \thispackage\ package contains special adaptations to other packages,
% so the captions should always look like you have specified them to look like.
%
% These are the packages the \thispackage\ package is adapted to:
% 
% \begin{tabular}{ll}
%   |float|        & Gives you the possibility to define new floating environments\\
%   |listings|     & Typesets source code listings\\
%   |longtable|    & Typesets tables spanned over multiple pages\\
%   |rotating|     & Supports rotated figures and tables\\
%   |sidecap|      & Offers captions \emph{beside} figures or tables\\
%   |supertabular| & Typesets tables spanned over multiple pages\\
% \end{tabular}
% 
% \NEWfeature{v3.0b}
% If you use one of the above packages together with the {\thispackage} package
% you get the additional possibility to set up captions with
% \begin{quote}|\captionsetup|\oarg{environment}\marg{options}\quad,\end{quote}
% where \meta{environment} stands for any environment the above packages offer.
% (Please note that this do not work with the |sideways| environments offered by
% the \package{rotating} package.)
% For example
% \begin{quote}|\captionsetup[lstlisting]{labelfont=bf}|\end{quote}
% forces captions inside the |lstlisting| environment to have bold labels.
% 
% If a certain support is not desired you can switch it off using the
% \thispackage\ package option
% \begin{quote}
%   |\usepackage[|\ldots|,|\meta{package}|=no]{caption}|\quad.
% \end{quote}
% For example specifying the option |float=no| means you don't like the
% \thispackage\ package to support the \package{float} package.
% (Note: You can specify these options only within the |\usepackage| command,
%  especially \emph{not} at a later time with |\captionsetup|.)
% 
% For further information about the packages mentioned above please take a look
% at the documentation belonging to them or buy yourself
% The \LaTeX\ Companion\cite{companion}.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{The \package{float} package}
% \label{float}
% 
% A very useful feature is provided by the \package{float} package\cite{float}:
% It offers the float placement specifier |H| which is much more restrictive
% than the specifier |h| offered by \LaTeX. While the latter one is only a
% recommendation to \LaTeX\ to set the float ``here'', the |H| forces the
% float to appear exactly at the spot where it occurs in your input file
% and nowhere else.
%
% Furthermore it offers different styles for floating environments, these
% styles are |plain|, |plaintop|, |ruled|, and |boxed|.
% You can link one of these styles to either new floating environments or
% to one of the existing environments |figure| and |table|.
% 
% If you are using the \thispackage\ package together with the \package{float}
% package a caption style called |ruled| gets defined automatically:
% \begin{quote}
%   |\DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space}|
% \end{quote}
% This style represents the caption layout in |ruled| styled floats.
% For you as an end user this means that captions within |ruled| floats will
% always look like this, nevertheless what generic caption options do you
% specify:
% 
% \ifx\floatstyle\undefined
% 
% \begin{Example}
% \hrule height.8pt depth0pt \kern2pt
% \vbox{\strut{\bfseries Program 7.1}
%    The first program. This hasn't got anything to do with the package
%    but is included as an example. Note the \texttt{ruled} float style.}
% \kern2pt\hrule\kern2pt
% \begin{verbatim}
% #include <stdio.h>
% 
% int main(int argc, char **argv)
% {
%        for (int i = 0; i < argc; ++i)
%                printf("argv[%d] = %s\n", i, argv[i]);
%        return 0;
% }
% \end{verbatim}
% \kern2pt\hrule\relax
% \end{Example}
% 
% \else
% 
% \floatstyle{ruled}
% \newfloat{Program}{tbp}{lop}[section]
% \floatname{Program}{Program}
% 
% \begin{Program}[H]
% \begin{verbatim}
% #include <stdio.h>
% 
% int main(int argc, char **argv)
% {
%        for (int i = 0; i < argc; ++i)
%                printf("argv[%d] = %s\n", i, argv[i]);
%        return 0;
% }
% \end{verbatim}
% \caption{The first program. This hasn't got anything to do with the package
%    but is included as an example. Note the \texttt{ruled} float style.}
% \end{Program}
% 
% \fi
% 
% If you want a different layout for |ruled| captions you have to define
% your own one using the command
% \begin{quote}
%   |\DeclareCaptionStyle{ruled}|\marg{options}\quad.
% \end{quote}
% 
% This mechanism also works with all other float styles. If you want a special
% caption layout---for |plain| or |boxed| floats for example---you can simply define
% a suitable caption style with the same name as the float style.
% 
% \textbf{Note:} For successful cooperation you need the float package
% version 1.3 or newer.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{The \package{listings} package}
% \label{listings}
% 
% \NEWdescription{v3.0b}
% The \package{listings} package\cite{listings} is a source code printer for \LaTeX.
% You can typeset stand alone files as well as listings with an environment
% similar to \texttt{verbatim} as well as you can print code snippets using
% a command similar to |\verb|.
% Many parameters control the output and if your preferred programming
% language isn't already supported, you can make your own definition.
%
% \textbf{Note:} For successful cooperation you need the listings package
% version 1.2 or higher. You'll get an error message when using an
% older version!
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{The \package{longtable} package}
% \label{longtable}
% 
% The \package{longtable} package\cite{longtable} offers the environment
% |longtable| which behaves similar to the |tabular| environment, but
% the table itself can span multiple pages.
%
% \textbf{Note:} For successful cooperation you need the longtable package
% version 3.15 or newer.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{The \package{rotating} package}
% \label{rotating}
% 
% The \package{rotating} package\cite{rotating} offers the floating
% environments \texttt{sideways\-figure} and \texttt{sideways\-table}
% which are just like normal figures and tables but rotated by 90 degree.
% Furthermore they always use a full page on their own.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{The \package{sidecap} package}
% \label{sidecap}
% 
% \NEWdescription{v3.0b}
% The \package{sidecap} package\cite{sidecap} offers the floating
% environments |SCfigure| and |SCtable| which are like normal figures
% and tables but the caption will be put \emph{beside} the contents.
% 
% The \package{sidecap} package offers it's own options for justification.
% If set, they will override the one specified with the caption option
% |justification=| for captions beside their contents.
%
% \DescribeMacro{listof=}
% Using the \package{sidecap} package you will probably notice that
% suppressing the entry in the list of figures or tables with
% |\caption[]{|\ldots|}| won't work inside these environments.
% This is caused by the implementation design of the \package{sidecap}
% package, but you can use |\captionsetup{listof=false}| inside the
% figure or table as an alternative here.
% 
% \ifx\SCfigure\undefined
% 
% \begin{Example}
%   \newsavebox\scbox
%   \begin{lrbox}{\scbox}
%     \setlength{\unitlength}{.75cm}
%     \setlength{\fboxsep}{0pt}
%     \fbox{\begin{picture}(4,4)
%       \put(1,3){\circle{1}}
%       \put(3,3){\circle{1}}
%       \put(2,2){\circle{1}}
%       \put(1,1){\circle{1}}
%       \put(3,1){\circle{1}}
%     \end{picture}}
%   \end{lrbox}
%   \newlength\scboxwidth
%   \setlength\scboxwidth{\wd\scbox}
%   \makebox[\linewidth][c]{
%     \parbox[b]{\scboxwidth}{\unhbox\scbox}
%     \hspace\marginparsep
%     \parbox[b]{1.5\scboxwidth}{
%       \captionsetup{justification=raggedright,labelfont=bf}
%       \captionof{figure}[]{A small example with the caption beside the figure.}
%     }
%   }
% \end{Example}
% 
% \else
% 
% \captionsetup{labelfont=bf}
% \begin{SCfigure}[1.5][!ht]
%   \setlength{\unitlength}{.75cm}
%   \setlength{\fboxsep}{0pt}
%   \fbox{\begin{picture}(4,4)
%     \put(1,3){\circle{1}}
%     \put(3,3){\circle{1}}
%     \put(2,2){\circle{1}}
%     \put(1,1){\circle{1}}
%     \put(3,1){\circle{1}}
%   \end{picture}}
% \iffalse
% \captionsetup{labelfont=bf}
% \fi
%   \caption[]{A small example with the caption beside the figure.}
% \end{SCfigure}
% \captionsetup{labelfont=default}
% 
% \fi
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{The \package{supertabular} package}
% \label{supertabular}
% 
% The \package{supertabular} package\cite{supertabular} offers the environment
% |supertabular| which is quite similar to the |longtable| environment provided
% by the \package{longtable} package. Both offers the typesetting of tables
% which can span multiple pages. For a detailed discussion about the
% differences between these powerful packages please take a look at
% The \LaTeX\ Companion\cite{companion}.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \subsection{Known incompatibilities}
% 
% \NEWdescription{v3.0b}
% Using the \thispackage\ package together with one of the following packages
% is not recommended; usually this would cause unwanted side effects or even
% errors:
% \begin{quote}
%   \package{ccaption}, \package{ftcap}, \package{hvfloat}, and
%   \package{nonfloat}
% \end{quote}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \section{Compatibility to older versions}
% \label{compatibility}
% 
% \subsection{The \thispackage\ package version $1.x$}
% 
% This version of the \thispackage\ package still supports the old options
% and commands provided by the version $1.x$ of this package. So there
% shouldn't occur any problems compiling old documents, but please don't mix
% old options and commands with the new ones. This isn't supported and can
% cause ugly side effects.
% 
% Here comes a short oversight of the obsolete options and commands and how
% they have been replaced within this version of the \thispackage\ package:
% 
% {\small\begin{longtable}{ll}
% \thispackage\ \version{1.x} & \thispackage\ \version{3.x}\\
% \hline
% \endhead
% |normal|        & |format=plain|\\
% |hang|          & |format=hang|\\
% |isu|           & |format=hang|\\
% |center|        & |justification=centering|\\
% |centerlast|    & |justification=centerlast|\\
% \iffalse
% |anne|          & |justification=centerlast|\\
% \fi
% |nooneline|     & |singlelinecheck=off|\\
% |scriptsize|    & |font=scriptsize|\\
% |footnotesize|  & |font=footnotesize|\\
% |small|         & |font=small|\\
% |normalsize|    & |font=normalsize|\\
% |large|         & |font=large|\\
% |Large|         & |font=Large|\\
% |up|            & |labelfont=up|\\
% |it|            & |labelfont=it|\\
% |sl|            & |labelfont=sl|\\
% |sc|            & |labelfont=sc|\\
% |md|            & |labelfont=md|\\
% |bf|            & |labelfont=bf|\\
% |rm|            & |labelfont=rm|\\
% |sf|            & |labelfont=sf|\\
% |tt|            & |labelfont=tt|\\
% \end{longtable}}
% 
% Beside the options for setting up the desired font there were also
% the commands |\captionsize| resp.~|\captionfont| and |\captionlabelfont|
% who could be redefined with |\renewcommand| and allowed an alternate and
% more flexible way to change the font used for captions.
% This mechanism was replaced by the commands
% \begin{quote}
%   |\DeclareCaptionFont{|\ldots|}{|\ldots|}|\qquad and\\
%   |\captionsetup{font=|\ldots|,labelfont=|\ldots|}|\qquad.
% \end{quote}\SeeUserDefined
% 
% Setting the margin for captions was done in \version{1.x} with
% \begin{quote}
%   |\setlength{\captionmargin}{|\ldots|}|\quad.
% \end{quote}
% This was replaced by
% \begin{quote}
%   |\captionsetup{margin=|\ldots|}|\qquad.
% \end{quote}
% \See{\Section{margins}{Margins and further paragraph options}}
% 
% For example the old-style code
% \begin{quote}
% |\usepackage[hang,bf]{caption}|\\
% |\renewcommand\captionfont{\small\sffamily}|\\
% |\setlength\captionmargin{10pt}|
% \end{quote}
% will still work fine, but should be written today as
% \begin{quote}
% |\usepackage[format=hang,labelfont=bf,font={small,sf},|\\
% |            margin=10pt]{caption}|
% \end{quote}
% or
% \begin{quote}
% |\usepackage{caption}|\\
% |\captionsetup{format=hang,labelfont=bf,font={small,sf},|\\
% |              margin=10pt}|\qquad.
% \end{quote}
% 
% The quite exotic option |ruled| which allowed a partial usage of
% the caption settings for |ruled| floats defined with the
% \package{float} package will be emulated by this version of the
% caption package, too.
% But using this option is not recommended anymore since this
% version of the \thispackage\ package offers a more flexible way
% for changing the captions of these floating environments:
% \begin{quote}
%   |\DeclareCaptionStyle{ruled}{|\ldots|}|
% \end{quote}
% resp.
% \begin{quote}
%   |\captionsetup[ruled]{|\ldots|}|\qquad.
% \end{quote}
% \SeeUserDefined[, \Section*{misc}{Useful stuff}, and
%                 \Section*{float}{The \package{float} package}]
% 
% \subsection{The \package{caption2} package version $2.x$}
% 
% Although they do very similar stuff, the packages \package{caption} and
% its experimental and now obsolete variant \package{caption2} have a
% very different implementation design.
% Therefore a full compatibility could not be offered.
% For that reason you will still find a file called |caption2.sty| in
% this package distribution, so old documents using the \package{caption2}
% package will still compile fine.
% 
% Newly created documents should use the actual version of the
% \thispackage\ package instead. In most cases it's sufficient to replace
% the command
% \begin{quote}
%   |\usepackage[...]{caption2}|
% \end{quote}
% by
% \begin{quote}
%   |\usepackage[...]{caption}|\qquad.
% \end{quote}
% But some options and commands will not be emulated, so you can get
% error messages afterwards. This section will hopefully help you removing
% these errors. If you have problems migrating from \package{caption2}
% to \package{caption} please don't hesitate to send me an e-mail asking
% for help.
% 
% In addition to the obsolete options shown in the last section
% these ones will be emulated, too:
% 
% {\small\begin{longtable}{ll}
% \package{caption2} \version{2.x} & \thispackage\ \version{3.x}\\
% \hline
% \endhead
% |flushleft|   & |justification=raggedright|\\
% |flushright|  & |justification=raggedleft|\\
% |oneline|     & |singlelinecheck=on|\\
% \end{longtable}}
% 
% Setting the margin for captions was done in \version{2.x} with
% \begin{quote}\leavevmode\hbox{%
%   |\setcaptionmargin{|\ldots|}| resp.
%   |\setcaptionwidth{|\ldots|}|\quad.
% }\end{quote}
% This was replaced by
% \begin{quote}\leavevmode\hbox{%
%   |\captionsetup{margin=|\ldots|}| resp.
%   |\captionsetup{width=|\ldots|}|\quad.
% }\end{quote}
% \See{\Section{margins}{Margins and further paragraph options}}
% 
% Setting an indention was done in \version{2.x} with
% \begin{quote}
%   |\captionstyle{indent}|\\
%   |\setlength\captionindent{|\ldots|}|\quad.
% \end{quote}
% This is now done with
% \begin{quote}
%   |\captionsetup{format=plain,indention=|\ldots|}|\quad.
% \end{quote}
% 
% The so-called single-line-check was controlled by the commands
% |\oneline|\-|captions|\-|false| (for switching the check off) and
% |\oneline|\-|captions|\-|true| (for switching the check on).
% This was replaced by
% |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|off}|
% resp.
% |\captionsetup{|\discretionary{}{}{}|singlelinecheck=|\discretionary{}{}{}|on}|.
% \See{\Section{justification}{Justification}}
% 
% The commands
% \begin{quote}
%   |\captionlabeldelim|, |\captionlabelsep|, |\captionstyle|,\\
%   |\defcaptionstyle|, |\newcaptionstyle|, and |\renewcaptionstyle|
% \end{quote}
% do not have a simple replacement and therefore will not be emulated
% by this version of the \thispackage\ package. (So using them will
% cause error messages.) Rewriting such code is not always easy and
% straight-ahead, but by conscientious reading of this manual you should
% find appropriate options and commands instead.
% 
% \iffalse
% ... (some examples)
% \fi
% 
% The \version{2.x} option |ignoreLTcapwidth| do not have a replacement, too.
% But in most cases you can simply drop using that option because
% in this version of the \thispackage\ package the value of |\LTcapwidth|
% will be ignored anyway (unless you set it to a different value than the
% default one).
% \See{\Section{longtable}{The \package{longtable} package}}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \pagebreak[4]
% \section{Further reading}
% 
% I recommend the following documents for further reading:
% 
% \begin{itemize}
% \item
%   The \TeX\ FAQ - Frequently asked questions about \TeX\ and \LaTeX :
%   \begin{quote}\url{http://faq.tug.org/}\end{quote}
%
% \item
%   A French FAQ can be found at
%   \begin{quote}\url{http://www.grappa.univ-lille3.fr/FAQ-LaTeX/}\end{quote}
% 
% \item
%   \textsf{epslatex} from Keith Reckdahl contains many tips around
%   including graphics in \LaTeXe\ documents.
%   You will find this document in the directory
%   \begin{quote}\url{ftp://ftp.ctan.org/pub/tex/info/epslatex/}\end{quote}
% \end{itemize}
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \section{Thanks}
% 
% I would like to thank Katja Melzner,
% Steven D. Cochran, Frank Mittelbach,
% David Carlisle, Carsten Heinz, Olga Lapko, and Keith Reckdahl.
% Thanks a lot for all your help, ideas, patience, spirit, and support!
% 
% Also I would like to thank
% Harald Harders,
% Peter L\"offler,
% Peng Yu,
% Alexander Zimmermann,
% Matthias Pospiech,
% J\"urgen Wieferink,
% Christoph Bartoschek,
% Uwe St\"ohr,
% Ralf Stubner,
% Geoff Vallis,
% Florian Keiler,
% J\"urgen G\"obel,
% Uwe Siart,
% Sang-Heon Shim,
% Henrik Lundell,
% David Byers,
% William Asquith,
% and
% Prof.~Dr.~Dirk Hoffmann,
% who all helped to make this package a better one.
% 
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \StopEventually{\begin{thebibliography}{9}
%   \bibitem{companion}
%   Frank Mittelbach and Michel Goossens:
%   \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},
%   \newblock Addison-Wesley, 2004.
% 
%   \bibitem{float}
%   Anselm Lingnau:
%   \emph{An Improved Environment for Floats},
%   2001/11/08
% 
%   \bibitem{floatrow}
%   Olga Lapko:
%   \emph{The floatrow package documentation},
%   2005/05/22
%
%   \bibitem{hyperref}
%   Sebastian Rahtz \& Heiko Oberdiek:
%   \emph{Hypertext marks in \LaTeX},
%   2007/01/25
%
%   \bibitem{hypcap}
%   Heiko Oberdiek:
%   \emph{The hypcap package -- Adjusting anchors of captions}
%   2007/02/19
%
%   \bibitem{listings}
%   Carsten Heinz:
%   \emph{The Listings Package},
%   2004/02/13
% 
%   \bibitem{longtable}
%   David Carlisle:
%   \emph{The longtable package},
%   2000/10/22
% 
%   \bibitem{rotating}
%   Sebastian Rahtz and Leonor Barroca:
%   \emph{A style option for rotated objects in \LaTeX},
%   1997/09/26
% 
%   \bibitem{sidecap}
%   Rolf Niepraschk und Hubert G\"a\ss lein:
%   \emph{The sidecap package},
%   2003/06/06
% 
%   \bibitem{subfig}
%   Steven D. Cochran:
%   \emph{The subfig package},
%   2005/07/05
% 
%   \bibitem{supertabular}
%   Johannes Braams und Theo Jurriens:
%   \emph{The supertabular environment},
%   2002/07/19
%
%   \bibitem{Anne}
%   Anne Br\"uggemann-Klein:
%   \emph{Einf\"uhrung in die Dokumentverarbeitung},
%   B.G. Teubner, Stuttgart, 1989
% \end{thebibliography}}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \DoNotIndex{\\,\_,\ ,\@@par}
% \DoNotIndex{\@classoptionslist,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@expandtwoargs}
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@latex@error}
% \DoNotIndex{\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance}
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
% \DoNotIndex{\fi,\footnotesize,\global}
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
% \DoNotIndex{\ifx,\ignorespaces,\itshape}
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
% \DoNotIndex{\normalsize,\or,\par,\parbox,\parfillskip}
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\providecommand}
% \DoNotIndex{\quad}
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
% \DoNotIndex{\rightskip,\rmfamily}
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
% \DoNotIndex{\small,\string,\space,\strut}
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
% 
% \clearpage
% \setlength{\parskip}{0pt plus 1pt}
%
% \section{The Implementation}
%
% \changes{v1.0}{1994/10/27}{First release}
% \changes{v1.1}{1994/11/03}{New captiontype \cs{centerlast}}
% \changes{v1.2}{1994/11/28}{Support of the \package{float} package}
% \changes{v1.3}{1995/01/09}{Support of \cs{captionlabelfont} in subcaptions}
% \changes{v1.4}{1995/01/30}{New option \cs{nooneline}}
% \changes{v1.4b}{1995/04/05}{Bugfix release}
% \changes{v3.0}{2003/12/20}{Rewritten; many new commands and features}
% \changes{v3.0d}{2004/11/28}{Split into two packages: \package{caption} \& \package{caption3}}
% \changes{v3.0l}{2007/01/20}{Usage of \cs{PackageError} replaced by \cs{caption@error}}
%
% The \package{caption} package consists of two parts -- the kernel
% (|caption3.sty|) and the main package (|caption.sty|).
%
% The kernel provides all the user commands and internal macros which are
% necessary for typesetting captions and setting parameters regarding these.
% While the standard \LaTeX\ document classes provides an internal command
% called |\@makecaption| and no options to control its behavior (except the
% vertical skips above and below the caption itself), we provide similar
% commands called |\caption@make| and |\caption@@make|, but with a lot of
% options which can be selected with |\captionsetup|.
% Loading the kernel part do not change the output of a \LaTeX\ document
% -- it just provides functionality which can be used by \LaTeXe\ packages
% which typesets captions, like the \package{caption} package or the
% \package{subfig} package.
%
% The \package{caption} package itself redefines the \LaTeX\ commands
% |\caption|, |\@caption|, and |\@makecaption| and maps the latter one to
% |\caption@@make|, giving the user the possibility to control the captions of
% the floating environments |figure| and |table|. Furthermore it does similar
% to the caption stuff coming from other packages (like the \package{longtable}
% or \package{supertabular} package):
% Mapping the appropriate internal commands (like |\LT@makecaption| or
% |\ST@caption|) to the ones offered by the \package{caption} kernel.
% So you can think of the \package{caption} package as a layer package, it
% simply provides adaptation layers between the caption stuff coming from
% \LaTeXe\ itself or a \LaTeXe\ package and the caption stuff offered by the
% \package{caption} kernel.
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Kernel}
% \iffalse
%<*kernel>
% \fi
%
% \subsubsection*{Identification}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption3}[2007/04/11 v1.0q caption3 kernel (AR)]
%    \end{macrocode}
%
% \subsubsection*{Generic helpers}
%
% \begin{macro}{\@nameundef}
%  This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel.
%  We use it to remove the definition of some commands and keyval options after
%  |\begin{document}| (to save \TeX\ memory) and to remove caption options defined
%  with |\captionsetup|\oarg{type}.
%    \begin{macrocode}
\providecommand*\@nameundef[1]{%
  \expandafter\let\csname #1\endcsname\@undefined}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@addto@macro}
%  The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which
%  globally adds commands to any existising macro, like in |\AtBeginDocument|.
%  This is the same but it works local, not global
%  (using \cs{edef} instead of \cs{xdef}).
%    \begin{macrocode}
\providecommand{\l@addto@macro}[2]{%
  \begingroup
    \toks@\expandafter{#1#2}%
    \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
  \@tempa}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bothIfFirst}
% \begin{macro}{\bothIfSecond}
%  |\bothIfFirst| tests if the first argument is not empty, |\bothIfSecond|
%  tests if the second argument is not empty. If yes both arguments get
%  typeset, otherwise none of them.
%    \begin{macrocode}
\def\bothIfFirst#1#2{%
  \protected@edef\caption@tempa{#1}%
  \ifx\caption@tempa\@empty\else
    #1#2%
  \fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\bothIfSecond#1#2{%
  \protected@edef\caption@tempa{#2}%
  \ifx\caption@tempa\@empty\else
    #1#2%
  \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@ifinlist}
%  This helper macro checks if the first argument is in the comma separated
%  list which is offered as second argument. So for example
%  \begin{quote}
%    |\caption@ifinlist{frank}{axel,frank,steven}{yes}{no}|
%  \end{quote}
%  would expand to |yes|.
%    \begin{macrocode}
\def\caption@ifinlist#1#2{%
  \let\next\@secondoftwo
  \edef\caption@tempa{#1}%
  \@for\caption@tempb:={#2}\do{%
    \ifx\caption@tempa\caption@tempb
      \let\next\@firstoftwo
    \fi}%
  \next}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setbool}
% \begin{macro}{\caption@ifbool}
% \begin{macro}{\caption@undefbool}
%  For setting and testing boolean options we offer these three helper macros:
%  \begin{quote}
%  |\caption@setbool|\marg{name}\marg{value}\\
%  |                |(with |value = false/true/no/yes/off/on/0/1|)\\
%  |\caption@ifbool|\marg{name}\marg{if-clause}\marg{else-clause}\\
%  |\caption@undefbool|\marg{name}
%  \end{quote}
%    \begin{macrocode}
\def\caption@setbool#1#2{%
  \caption@ifinlist{#2}{1,true,yes,on}{%
    \expandafter\let\csname caption@if#1\endcsname\@firstoftwo
  }{\caption@ifinlist{#2}{0,false,no,off}{%
    \expandafter\let\csname caption@if#1\endcsname\@secondoftwo
  }{%
    \caption@Error{Undefined boolean value `#2'}%
  }}}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@ifbool#1{\@nameuse{caption@if#1}}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@undefbool#1{\@nameundef{caption@if#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@newcounter}
% \changes{v3.0p}{2007/04/08}{\cs{caption@XXXcounter} added}
% \begin{macro}{\caption@setcounter}
% \begin{macro}{\caption@addtocounter}
% \begin{macro}{\caption@stepcounter}
% To save counter space we use commands instead of counters.
%    \begin{macrocode}
\def\caption@newcounter#1{\gdef#1{0}}
\def\caption@setcounter#1#2{\xdef#1{#2}}
\def\caption@addtocounter#1#2{%
  \begingroup
    \@tempcnta#1%
    \advance\@tempcnta#2%
    \xdef#1{\the\@tempcnta}%
  \endgroup}
\def\caption@stepcounter#1{\caption@addtocounter#1\@ne}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection*{Errors}
%
% \begin{macro}{\caption@Error}
% \changes{v3.0l}{2007/01/20}{This macro added}
% \changes{v3.0q}{2007/04/11}{Renamed from \cs{caption@error} to \cs{caption@Error}}
%  This is mainly identical to |\PackageError{caption}{#1}{\caption@eh}|.
%    \begin{macrocode}
\newcommand\caption@Package{caption}
\newcommand*\caption@Error[1]{%
  \PackageError\caption@Package{#1}\caption@eh}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@eh}
%  At the moment we only offer this simple error message as generic helper
%  for the user.
%    \begin{macrocode}
\newcommand\caption@eh{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `\caption@Package' package.\MessageBreak
  \@ehc}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Using the keyval package}
%
% We need the \package{keyval} package for option handling, so we load it here.
%    \begin{macrocode}
\RequirePackage{keyval}[1997/11/10]
%    \end{macrocode}
%
% \begin{macro}{\undefine@key}
% This helper macro is the opposite of |\define@key|, it removes a keyval
% definition.
%    \begin{macrocode}
\providecommand*\undefine@key[2]{%
  \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareCaptionOption}
%  |\DeclareCaptionOption|\marg{option}\marg{code}\\
%  |\DeclareCaptionOption*|\marg{option}\marg{code}\par
%  We declare our options using these commands (instead of using
%  |\DeclareOption| offered by \LaTeXe), so the keyval package is used.
%  The starred form makes the option available during the lifetime of the
%  current package only, so they can be used with |\usepackage|, but
%  \emph{not} with |\captionsetup| later on.
%    \begin{macrocode}
\newcommand\DeclareCaptionOption{%
  \@ifstar{\caption@declareoption\AtEndOfPackage}%
          {\caption@declareoption\@gobble}}
\newcommand*\caption@declareoption[2]{%
  #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
\@onlypreamble\DeclareCaptionOption
\@onlypreamble\caption@declareoption
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionsetup}
% \changes{v3.0a}{2004/01/17}{Bugfix: Missing \% added}
%  |\captionsetup|\oarg{type}\marg{keyval-list of options}\par
%  If the optional argument `type' is specified, we simply save or append
%  the option list, otherwise we `execute' it with |\setkeys|.
%    \begin{macrocode}
\newcommand\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
\newcommand\caption@typ@{caption@typ@} % This saves 74 words of TeX memory
\def\caption@setuptype[#1]#2{%
  \@ifundefined{\caption@typ@#1}%
    {\@namedef{\caption@typ@#1}{#2}}%
    {\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}}
\newcommand\caption@setup{\caption@setkeys{caption}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setkeys}
% \changes{v3.0i}{2006/01/03}{This macro added}
% \changes{v3.0l}{2007/01/20}{Bugfix: Usage of \cs{caption@keydepth} added}
% \changes{v3.0l}{2007/01/30}{Optional argument added}
% \changes{v3.0p}{2007/04/08}{\cs{caption@keydepth} is now a command instead of a counter}
% This one simply calls |\setkeys|\marg{package}\marg{args} but lets the
% error messages refer to the \meta{package} package instead of the
% \package{keyval} package.
%    \begin{macrocode}
\newcommand*\caption@setkeys{%
  \@dblarg\caption@@setkeys}
%    \end{macrocode}
%    \begin{macrocode}
\long\def\caption@@setkeys[#1]#2#3{%
  \ifnum\caption@keydepth=0\relax
    \let\caption@KV@errx\KV@errx
    \let\caption@KV@err\KV@err
    \let\KV@errx\caption@Error
    \let\KV@err\caption@Error
  \fi
  \caption@stepcounter\caption@keydepth
%
  \def\caption@Package{#1}%
  \caption@Debug{\protect\setkeys{#2}{#3}}%
  \setkeys{#2}{#3}%
  \def\caption@Package{caption}%
%
  \caption@addtocounter\caption@keydepth\m@ne
  \ifnum\caption@keydepth=0\relax
    \let\KV@errx\caption@KV@errx
    \let\KV@err\caption@KV@err
  \fi}
%    \end{macrocode}
%    \begin{macrocode}
\caption@newcounter\caption@keydepth
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@settype}
% \changes{v3.0i}{2006/01/03}{Optional argument added}
% \changes{v3.0j}{2006/01/26}{Revised}
% \changes{v3.0l}{2007/01/30}{Optional argument removed}
%  |\caption@settype|\marg{type}\par
%  Caption options which have been saved with |\captionsetup|\oarg{type} can
%  be executed using this command.
%  (It simply executes the saved option list, if there is any.)
%    \begin{macrocode}
\newcommand*\caption@settype[1]{%
  \@ifundefined{\caption@typ@#1}{}{%
    \caption@esetup{\csname\caption@typ@#1\endcsname}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@esetup}
%  |\caption@esetup|\marg{keyval-list of options}\par
%  To execute a keyval-list of options saved within a macro we
%  need this special version of |\caption@setup| which expands the
%  argument first.
%    \begin{macrocode}
\newcommand*\caption@esetup[1]{%
  \edef\caption@tempa{\noexpand\caption@setup{#1}}%
  \caption@tempa}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\clearcaptionsetup}
%  |\clearcaptionsetup|\marg{type}\par
%  This removes the saved option list associated with \meta{type}.
%    \begin{macrocode}
\newcommand*\clearcaptionsetup[1]{\@nameundef{\caption@typ@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\showcaptionsetup}
% \changes{v3.0e}{2005/05/03}{Optimized for memory usage}
%  |\showcaptionsetup|\oarg{package}\marg{type}\par
%  This comes for debugging issues: It shows the saved option list which
%  is associated with \meta{type}.
%    \begin{macrocode}
\newcommand*\showcaptionsetup[2][\@firstofone]{%
  \GenericWarning{}{%
    #1 Caption Info: KV list on `#2'\MessageBreak
    #1 Caption Data: (%
    \@ifundefined{\caption@typ@#2}{%
      % empty -- print nothing
    }{%
      \@nameuse{\caption@typ@#2}%
    }%
    )}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ProcessOptions}
% \changes{v3.0a}{2004/01/23}{Bugfix, see \purett{news:400D360C.9678329F@gmx.net} for details}
% \changes{v3.0i}{2006/01/03}{Improvement, uses \cs{caption@setkeys} instead of \cs{setkeys}}
% \changes{v3.0j}{2006/02/23}{Bugfix, now processes only those global options which have a default value}
% \changes{v3.0l}{2007/01/30}{\cs{ProcessOptionsWithKV} renamed to \cs{caption@ProcessOptions} and moved from the package to the kernel}
%  We process our options using the keyval package, so we use this one
%  instead of |\ProcessOptions| offered by \LaTeXe.
%  (This code was taken from the \package{hyperref} package and improved.)
%    \begin{macrocode}
\newcommand*\caption@ProcessOptions[1]{%
  \let\@tempc\relax
%    \end{macrocode}
%
%    \begin{macrocode}
  \let\caption@tempa\@empty
  \@for\CurrentOption:=\@classoptionslist\do{%
    \@ifundefined{KV@#1@\CurrentOption}{%
    }{%
      \@ifundefined{KV@#1@\CurrentOption @default}{%
        \PackageInfo{#1}{Global option `\CurrentOption' ignored}%
      }{%
        \PackageInfo{#1}{Global option `\CurrentOption' processed}%
        \edef\caption@tempa{\caption@tempa,\CurrentOption,}%
        \@expandtwoargs\@removeelement\CurrentOption
          \@unusedoptionlist\@unusedoptionlist
      }%
    }%
  }%
  \edef\caption@tempa{%
    \noexpand\caption@setkeys{#1}{%
      \caption@tempa\@ptionlist{\@currname.\@currext}%
    }%
  }%
  \caption@tempa
%    \end{macrocode}
%
%    \begin{macrocode}
  \let\CurrentOption\@empty
  \AtEndOfPackage{\let\@unprocessedoptions\relax}}
\@onlypreamble\caption@ProcessOptions
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Margin resp. width}
% \changes{v3.0p}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}}
% \changes{v3.0p}{2007/04/03}{Option `twoside' added to kernel}
%
% \begin{macro}{\captionmargin}
% \begin{macro}{\captionwidth}
%  |\captionmargin| and |\captionwidth| contain the extra margin
%  resp. the total width used for captions. Please never set these values in
%  a direct way, they are just accessible in user documents to provide
%  compatibility to |caption.sty| \version{1.x}.\par
%  Note that we can only set one value at a time, `margin' \emph{or} `width'.
%  If |\captionwidth| is not zero we will take this value afterwards,
%  otherwise |\captionmargin| and |\captionmargin@|.
%    \begin{macrocode}
\newdimen\captionmargin
\newdimen\captionmargin@
\newdimen\captionwidth
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
\DeclareCaptionOption{width}{\setcaptionwidth{#1}}
\DeclareCaptionOption{twoside}[1]{\caption@setbool{twoside}{#1}}
%    \end{macrocode}
%
% \begin{macro}{\setcaptionmargin}
%  |\setcaptionmargin|\marg{amount}
% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setmargin} to \cs{setcaptionmargin}}
% \changes{v3.0h}{2005/10/24}{\cs{setcaptionmargin} enhanced so it can take left+right margin}
%  |\setcaptionmargin|\marg{amount}\par
%  Please never use this in user documents, it's just there to
%  provide compatibility to |caption2.sty| \version{2.x}.
%    \begin{macrocode}
\newcommand*\setcaptionmargin[1]{%
  \captionwidth\z@
  \caption@@setmargin#1,#1,\@nil\@@}
\def\caption@@setmargin#1,#2,#3\@@{%
  \setlength\captionmargin{#1}%
  \setlength\captionmargin@{#2}%
  \advance\captionmargin@ by -\captionmargin}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setcaptionwidth}
%  |\setcaptionwidth|\marg{amount}
% \changes{v3.0h}{2005/10/24}{Renamed from \cs{caption@setwidth} to \cs{setcaptionwidth}}
%  |\setcaptionwidth|\marg{amount}\par
%  Please never use this in user documents, it's just there to
%  provide compatibility to |caption2.sty| \version{2.x}.
%    \begin{macrocode}
\newcommand\setcaptionwidth{%
  \setlength\captionwidth}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@count}
% \changes{v3.0p}{2007/04/03}{This counter added}
% This counter numbers the captions. It will be used inside |\caption@ifoddpage| only.
%    \begin{macrocode}
\caption@newcounter\caption@count
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@newlabel}
% \changes{v3.0p}{2007/04/03}{This macro added}
%  This command is a modified version of |\newlabel| from \LaTeX2e.
%  It will be written to the \texttt{.aux} file to
%  pass label information from one run to another.
%  It will be used inside |\caption@ifoddpage| and |\caption@ragged|.
%    \begin{macrocode}
\newcommand*\caption@newlabel{\@newl@bel{caption}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@thepage}
% \changes{v3.0p}{2007/04/03}{This macro added}
%  This command is a modified version of |\thepage| from \LaTeX2e.
%  It will be used inside |\caption@ifoddpage| only.
%    \begin{macrocode}
\newcommand*\caption@thepage{\the\c@page}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifoddpage}
% \changes{v3.0p}{2007/04/03}{This macro added}
% \emph{Note:} This macro re-defines itself so the \texttt{.aux} file will
% only be used once per group.
%    \begin{macrocode}
\def\caption@ifoddpage{%
  \caption@iftwoside{%
%    \end{macrocode}
% |\refstepcounter{caption@count}|
%    \begin{macrocode}
   \caption@stepcounter\caption@count
%    \end{macrocode}
% |\label{\the\caption@count}|
%    \begin{macrocode}
    \protected@write\@auxout{\let\caption@thepage\relax}%
           {\string\caption@newlabel{\caption@count}{\caption@thepage}}%
%    \end{macrocode}
% |\edef\caption@thepage{\pageref{\the\caption@count}}|
%    \begin{macrocode}
    \expandafter\ifx\csname caption@\caption@count\endcsname\relax
      \G@refundefinedtrue % => 'There are undefined references.'
      \PackageWarning{caption3}{Reference on page \thepage \space undefined}%
    \else
      \expandafter\let\expandafter\caption@thepage
                                  \csname caption@\caption@count\endcsname
    \fi
%    \end{macrocode}
% |\ifodd\caption@thepage|\ldots
%    \begin{macrocode}
    \ifodd\caption@thepage
      \let\caption@ifoddpage\@firstoftwo
    \else
      \let\caption@ifoddpage\@secondoftwo
    \fi
  }{\let\caption@ifoddpage\@firstoftwo}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@ifoddpage}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Indentions}
%
% \begin{macro}{\captionindent}
% \begin{macro}{\captionparindent}
% \begin{macro}{\captionhangindent}
%  These are the indentions we support.
%    \begin{macrocode}
\newdimen\captionindent
\newdimen\captionparindent
\newdimen\captionhangindent
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v3.0b}{2004/05/16}{Defaults added for options \opt{parindent=} and \opt{hangindent=}}
% \changes{v3.0h}{2005/08/22}{Option \opt{parskip=}: \cs{AtBeginCaption} replaced by \cs{caption@@par}}
% \changes{v3.0h}{2005/08/22}{Undocumented defaults for \opt{parindent=}, \opt{hangindent=},
%                             and \opt{parskip=} removed}
%    \begin{macrocode}
\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete!
\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
\DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}}
\DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}}
\DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}}
%    \end{macrocode}
%
% \changes{v3.0h}{2005/08/22}{Increased compatibility to KOMA-Script: A special version of options
%                             `parindent' and `parskip' added}
% \changes{v3.0i}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of `parskip' and `parindent' options
%                             revised and moved into caption kernel}
% \changes{v3.0j}{2006/02/23}{KOMA-Script variants of `parskip' and `parindent' are obsolete now, removed}
% \changes{v3.0o}{2007/03/30}{KOMA-Script variants of `parskip' and `parindent' re-added, since they
%                             still collide with the actual version of subfig (Sigh!)}
%
%    \begin{macrocode}
\@ifundefined{scr@caption}{}{%
%    \end{macrocode}
%
% There is an option clash between the \KOMAScript\ document classes
% and the \package{caption} kernel,
% both define the options |parindent| and |parskip| but with different meaning.
% Furthermore the ones defined by the \package{caption} kernel take a
% value as parameter but the \KOMAScript\ ones do not.
% So we need special versions of the options |parindent| and |parskip| here,
% ones who determine if a value is given (and therefore should be treated as
% our option) or not (and therefore should be ignored by us).
%
%    \begin{macrocode}
  \let\caption@KV@parindent\KV@caption@parindent
  \DeclareCaptionOption{parindent}[]{%
    \def\caption@tempa{#1}%
    \ifx\caption@tempa\@empty
      \PackageInfo{caption3}{Option `parindent' ignored}%
    \else
      \caption@KV@parindent{#1}%
    \fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \let\caption@KV@parskip\KV@caption@parskip
  \DeclareCaptionOption{parskip}[]{%
    \def\caption@tempa{#1}%
    \ifx\caption@tempa\@empty
      \PackageInfo{caption3}{Option `parskip' ignored}%
    \else
      \caption@KV@parskip{#1}%
    \fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{Styles}
%
% \begin{macro}{\DeclareCaptionStyle}
% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
%  |\DeclareCaptionStyle|\marg{name}\oarg{single-line-list-of-KV}\marg{list-of-KV}
%    \begin{macrocode}
\newcommand*\DeclareCaptionStyle[1]{%
  \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}}
\def\caption@declarestyle#1[#2]#3{%
  \global\@namedef{caption@sls@#1}{#2}%
  \global\@namedef{caption@sty@#1}{#3}}
\@onlypreamble\DeclareCaptionStyle
\@onlypreamble\caption@declarestyle
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{style}{\caption@setstyle{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setstyle}
% \changes{v3.0f}{2005/06/01}{Starred variant added}
%  |\caption@setstyle|\marg{name}\\
%  |\caption@setstyle*|\marg{name}\par
%  Selecting a caption style means saving the additional
%  \meta{single-line-list-of-KV} (this will be done by |\caption@sls|),
%  resetting the caption options to the default ones (this will be done using
%  |\caption@setdefault|) and executing the \meta{list-of-KV} options
%  (this will be done using |\caption@esetup|).\par
%  The starred version will give no error message if the given style is not
%  defined.
%    \begin{macrocode}
\newcommand\caption@setstyle{%
  \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}}
\newcommand*\caption@@setstyle[2]{%
  \@ifundefined{caption@sty@#2}%
    {#1{\caption@Error{Undefined caption style `#2'}}}%
    {\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
     \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setdefault}
%  This resets (nearly) all caption options to the default ones.
%  \emph{Note that this does not touch the skips and the positioning!}
%    \begin{macrocode}
\newcommand\caption@setdefault{\captionsetup{%
  format=default,labelformat=default,labelsep=default,textformat=default,%
  justification=default,font=default,labelfont=default,textfont=default,%
  margin=0pt,indent=0pt,parindent=0pt,hangindent=0pt,%
  singlelinecheck=1,strut=1}}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0d}{2005/02/12}{\opt{indent=0pt} added to caption style \opt{default}}
% Currently there is only one pre-defined style, called `default'.
% It's a perfect match to the behaviour of |\@makecaption| offered by the
% standard \LaTeX\ document classes:
% If the caption fits in one single line, it is typeset centered.
%
%    \begin{macrocode}
\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{}
%    \end{macrocode}
%
% \subsubsection*{Formats}
%
% \begin{macro}{\DeclareCaptionFormat}
% \changes{v3.0a}{2004/01/17}{Pass through argument \#3 so extra spaces between arguments do make any harm}
% \changes{v3.0d}{2005/02/09}{Starred variant added}
%  |\DeclareCaptionFormat|\marg{name}\marg{code with \#1, \#2, and \#3}\\
%  |\DeclareCaptionFormat*|\marg{name}\marg{code with \#1, \#2, and \#3}\par
%  The starred form causes the code being typeset in vertical (instead of
%  horizontal) mode, but does not support the |indention=| option.
%    \begin{macrocode}
\newcommand\DeclareCaptionFormat{%
  \@ifstar{\caption@declareformat\@gobble}%
          {\caption@declareformat\@firstofone}}
\newcommand\caption@declareformat[3]{%
  \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
  \global\long\@namedef{caption@fmt@#2}##1##2##3{#3}}
\@onlypreamble\DeclareCaptionFormat
\@onlypreamble\caption@declareformat
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{format}{\caption@setformat{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setformat}
%  |\caption@setformat|\marg{name}\par
%  Selecting a caption format simply means saving the code (in |\caption@fmt|)
%  and if the code should be used in horizontal or vertical mode (|\caption@ifh|).
%    \begin{macrocode}
\newcommand*\caption@setformat[1]{%
  \@ifundefined{caption@fmt@#1}%
    {\caption@Error{Undefined caption format `#1'}}%
    {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
     \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} renamed to \opt{normal}}
% \changes{v3.0f}{2005/05/12}{Caption format \opt{normal} renamed to \opt{@normal}}
% \changes{v3.0h}{2005/08/25}{Caption format \opt{@normal} renamed to \opt{plain} and documented}
% There are two pre-defined formats, called `plain' and `hang'.
%
%    \begin{macrocode}
\DeclareCaptionFormat{plain}{#1#2#3\par}
\DeclareCaptionFormat{hang}{%
  \@hangfrom{#1#2}%
  \advance\captionparindent\hangindent
  \advance\captionhangindent\hangindent
  \caption@@par
  #3\par}
%    \end{macrocode}
%
% \changes{v3.0a}{2004/01/23}{Caption format \opt{default} linked to \opt{normal}}
% \changes{v3.0e}{2005/04/28}{Bugfix 05-04-28: Missing \cs{caption@ifh@default} added}
% `default' usually maps to `plain'.
%
%    \begin{macrocode}
\def\caption@fmt@default{\caption@fmt@plain}
\def\caption@ifh@default{\caption@ifh@plain}
%    \end{macrocode}
%
% \subsubsection*{Label formats}
%
% \begin{macro}{\DeclareCaptionLabelFormat}
% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
%  |\DeclareCaptionLabelFormat|\marg{name}\marg{code with \#1 and \#2}
%    \begin{macrocode}
\newcommand*\DeclareCaptionLabelFormat[2]{%
  \global\@namedef{caption@lfmt@#1}##1##2{#2}}
\@onlypreamble\DeclareCaptionLabelFormat
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setlabelformat}
%  |\caption@setlabelformat|\marg{name}\par
%  Selecting a caption label format simply means saving the code (in |\caption@lfmt|).
%    \begin{macrocode}
\newcommand*\caption@setlabelformat[1]{%
  \@ifundefined{caption@lfmt@#1}%
    {\caption@Error{Undefined caption label format `#1'}}%
    {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
%    \end{macrocode}
% \end{macro}
%
% There are three pre-defined label formats, called `empty', `simple', and `parens'.
%
%    \begin{macrocode}
\DeclareCaptionLabelFormat{empty}{}
\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
%    \end{macrocode}
%
% `default' usually maps to `simple'.
%
%    \begin{macrocode}
\def\caption@lfmt@default{\caption@lfmt@simple}
%    \end{macrocode}
%
% \subsubsection*{Label separators}
%
% \begin{macro}{\DeclareCaptionLabelSeparator}
% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
% \changes{v3.0h}{2005/08/25}{Starred variant added}
%  |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\\
%  |\DeclareCaptionLabelSeparator*|\marg{name}\marg{code}\par
%  The starred form causes the label separator to be typeset \emph{without} using |\captionlabelfont|.
%    \begin{macrocode}
\newcommand\DeclareCaptionLabelSeparator{%
  \@ifstar{\caption@declarelabelseparator\@gobble}%
          {\caption@declarelabelseparator\@firstofone}}
\newcommand\caption@declarelabelseparator[3]{%
  \global\expandafter\let\csname caption@iflf@#2\endcsname#1%
  \global\long\@namedef{caption@lsep@#2}{#3}}
\@onlypreamble\DeclareCaptionLabelSeparator
\@onlypreamble\caption@declarelabelseparator
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setlabelseparator}
%  |\caption@setlabelseparator|\marg{name}\par
%  Selecting a caption label separator simply means saving the code (in |\caption@lsep|).
%    \begin{macrocode}
\newcommand*\caption@setlabelseparator[1]{%
  \@ifundefined{caption@lsep@#1}%
    {\caption@Error{Undefined caption label separator `#1'}}%
    {\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
     \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0f}{2005/06/11}{Bugfix 05-03-23: Caption label separator \opt{newline} implementation
%                             changed from \cs{newline} to \cs{\textbackslash}}
% \changes{v3.0h}{2005/08/24}{Caption label separator \opt{endash} added}
% There are seven pre-defined label separators, called `none', `colon', `period', `space',
% `quad', `newline', and `endash'.
%
%    \begin{macrocode}
\DeclareCaptionLabelSeparator{none}{}
\DeclareCaptionLabelSeparator{colon}{: }
\DeclareCaptionLabelSeparator{period}{. }
\DeclareCaptionLabelSeparator{space}{ }
\DeclareCaptionLabelSeparator*{quad}{\quad}
\DeclareCaptionLabelSeparator*{newline}{\\}
\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
%    \end{macrocode}
%
% `default' usually maps to `colon'.
%
%    \begin{macrocode}
\def\caption@lsep@default{\caption@lsep@colon}
\def\caption@iflf@default{\caption@iflf@colon}
%    \end{macrocode}
%
% \subsubsection*{Text formats}
%
% \begin{macro}{\DeclareCaptionTextFormat}
% \changes{v3.0l}{2007/02/18}{This macro added}
%  |\DeclareCaptionTextFormat|\marg{name}\marg{code with \#1}
%    \begin{macrocode}
\newcommand*\DeclareCaptionTextFormat[2]{%
  \global\long\@namedef{caption@tfmt@#1}##1{#2}}
\@onlypreamble\DeclareCaptionTextFormat
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@settextformat}
% \changes{v3.0l}{2007/02/18}{This macro added}
%  |\caption@settextformat|\marg{name}\par
%  Selecting a caption text format simply means saving the code (in |\caption@tfmt|).
%    \begin{macrocode}
\newcommand*\caption@settextformat[1]{%
  \@ifundefined{caption@tfmt@#1}%
    {\caption@Error{Undefined caption text format `#1'}}%
    {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
%    \end{macrocode}
% \end{macro}
%
% There are two pre-defined text formats, called `simple' and `period'.
%
%    \begin{macrocode}
\DeclareCaptionTextFormat{simple}{#1}
\DeclareCaptionTextFormat{period}{#1.}
%    \end{macrocode}
%
% `default' usually maps to `simple'.
%
%    \begin{macrocode}
\def\caption@tfmt@default{\caption@tfmt@simple}
%    \end{macrocode}
%
% \subsubsection*{Justifications}
%
% \begin{macro}{\DeclareCaptionJustification}
% \changes{v3.0a}{2004/01/17}{Pass through argument \#2 so extra spaces between arguments do make any harm}
%  |\DeclareCaptionJustification|\marg{name}\marg{code}
%    \begin{macrocode}
\newcommand*\DeclareCaptionJustification[2]{%
  \global\@namedef{caption@hj@#1}{#2}}
%\newcommand\DeclareCaptionJustification{\DeclareCaptionFont}
\@onlypreamble\DeclareCaptionJustification
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setjustification}
%  |\caption@setjustification|\marg{name}\par
%  Selecting a caption justification simply means saving the code (in |\caption@hj|).
%    \begin{macrocode}
\newcommand*\caption@setjustification[1]{%
  \@ifundefined{caption@hj@#1}%
    {\caption@Error{Undefined caption justification `#1'}}%
    {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}}
%\newcommand\caption@setjustification{\caption@setfont{@hj}}
%    \end{macrocode}
% \end{macro}
%
% These are the pre-defined justification code snippets.
%
%    \begin{macrocode}
\DeclareCaptionJustification{justified}{}
\DeclareCaptionJustification{centering}{\centering}
\DeclareCaptionJustification{centerfirst}{\centerfirst}
\DeclareCaptionJustification{centerlast}{\centerlast}
\DeclareCaptionJustification{raggedleft}{\raggedleft}
\DeclareCaptionJustification{raggedright}{\raggedright}
%    \end{macrocode}
%
% `default' usually maps to `justified'.
%
%    \begin{macrocode}
\def\caption@hj@default{\caption@hj@justified}
%    \end{macrocode}
%
% \begin{macro}{\centerfirst}
% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerfirst} to \cs{centerfirst}}
%  Please blame Frank Mittelbach for |\caption@centerfirst| |:-)|
%    \begin{macrocode}
\providecommand\centerfirst{%
  \let\\\@centercr
  \edef\caption@normaladjust{%
    \leftskip\the\leftskip
    \rightskip\the\rightskip
    \parfillskip\the\parfillskip\relax}%
  \leftskip\z@\@plus -1fil%
  \rightskip\z@\@plus 1fil%
  \parfillskip\z@skip
  \noindent\hskip\z@\@plus 2fil%
  \@setpar{\@@par\@restorepar\caption@normaladjust}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\centerlast}
% \changes{v3.0l}{2007/01/21}{Bugfix: Usage of \cs{@centercr} added (Thanks to Olga!)}
% \changes{v3.0l}{2007/01/21}{This macro renamed from \cs{caption@centerlast} to \cs{centerlast}}
%  This is based on code from Anne Br\"uggemann-Klein\cite{Anne}
%    \begin{macrocode}
\providecommand\centerlast{%
  \let\\\@centercr
  \leftskip\z@\@plus 1fil%
  \rightskip\z@\@plus -1fil%
  \parfillskip\z@\@plus 2fil\relax}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0b}{2004/05/16}{Improved \package{ragged2e} package support}
% We also support the upper-case commands offered by the \package{ragged2e}
% package.
% Note that these just map to their lower-case variants if the
% \package{ragged2e} package is not available.
%    \begin{macrocode}
\DeclareCaptionJustification{Centering}{%
  \caption@ragged\Centering\centering}
\DeclareCaptionJustification{RaggedLeft}{%
  \caption@ragged\RaggedLeft\raggedleft}
\DeclareCaptionJustification{RaggedRight}{%
  \caption@ragged\RaggedRight\raggedright}
%    \end{macrocode}
%
% \begin{macro}{\caption@ragged}
% \changes{v3.0p}{2007/04/07}{The `ragged2e' package will now only been loaded when needed}
% \changes{v3.0q}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced by \cs{caption@Debug}}
% \changes{v3.0q}{2007/04/16}{Warnung will be suppressed on first \LaTeX\ run}
%  |\caption@ragged| will be basically defined as\par
%  |\AtBeginDocument{\IfFileExists{ragged2e.sty}%|\\
%  |  {\RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}%|\\
%  |  {\let\caption@ragged\@secondoftwo}}|\par
%  but with an additional warning if the ragged2e package is not loaded (yet).
%  (This warning will be typeout only one time per option, that's why
%  we need the |caption\string#1| stuff.)
%  Furthermore we load the \package{ragged2e} package, if needed and available.
%    \begin{macrocode}
\newcommand*\caption@ragged{%
  \caption@Debug{We need ragged2e}%
  \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
  \global\let\caption@ragged\caption@@ragged
  \caption@@ragged}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@@ragged[2]{%
  \@ifundefined{caption\string#1}{%
    \PackageWarning{caption3}{%
      `ragged2e' package not loaded, therefore\MessageBreak
      substituting \string#2 for \string#1\MessageBreak}%
    \global\@namedef{caption\string#1}}{}%
  #2}
%    \end{macrocode}
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifundefined{caption@ragged2e}{%
    \let\caption@@ragged\@secondoftwo % suppress warning above
  }{%
    \caption@Debug{We load ragged2e}%
    \IfFileExists{ragged2e.sty}{%
      \RequirePackage{ragged2e}\let\caption@@ragged\@firstoftwo}{}%
  }}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Fonts}
%
% \begin{macro}{\DeclareCaptionFont}
% \changes{v3.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now}
%  |\DeclareCaptionFont|\marg{name}\marg{code}
%    \begin{macrocode}
\newcommand\DeclareCaptionFont[2]{%
  \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}}
\@onlypreamble\DeclareCaptionFont
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setfont}
% \changes{v3.0l}{2007/01/30}{Usage of \cs{caption@setkeys} with optional argument}
%  |\caption@setfont|\marg{name}\marg{keyval-list of names}\par
%  Selecting a caption font means saving all the code snippets
%  (in |\caption#1|).
%  Because we use |\setkeys| recursive here we need to do this inside an
%  extra group and collect all the code snippets in |\caption@tempa| first.
%    \begin{macrocode}
\newcommand*\caption@setfont[2]{%
  \let\caption@tempa\@empty
  \begingroup
%   \define@key{caption@fnt}{default}[]{%
%     \global\expandafter\let\expandafter\caption@tempa
%       \csname caption#1@default\endcsname}%
    \caption@setkeys[caption]{caption@fnt}{#2}%
  \endgroup
  \expandafter\let\csname caption#1\endcsname\caption@tempa}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\DeclareCaptionFont{default}{}
%    \end{macrocode}
%
% These are the pre-defined font code snippets.
%
%    \begin{macrocode}
\DeclareCaptionFont{scriptsize}{\scriptsize}
\DeclareCaptionFont{footnotesize}{\footnotesize}
\DeclareCaptionFont{small}{\small}
\DeclareCaptionFont{normalsize}{\normalsize}
\DeclareCaptionFont{large}{\large}
\DeclareCaptionFont{Large}{\Large}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionFont{up}{\upshape}
\DeclareCaptionFont{it}{\itshape}
\DeclareCaptionFont{sl}{\slshape}
\DeclareCaptionFont{sc}{\scshape}
\DeclareCaptionFont{md}{\mdseries}
\DeclareCaptionFont{bf}{\bfseries}
\DeclareCaptionFont{rm}{\rmfamily}
\DeclareCaptionFont{sf}{\sffamily}
\DeclareCaptionFont{tt}{\ttfamily}
%    \end{macrocode}
%
% \subsubsection*{\package{setspace} package support}
% \changes{v3.0p}{2007/04/02}{\package{setspace} package support added to kernel}
%
%    \begin{macrocode}
\DeclareCaptionFont{singlespacing}{\setstretch{\setspace@singlespace}}% normally 1
\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
\DeclareCaptionFont{doublespacing}{\doublespacing}
%    \end{macrocode}
%
% \begin{macro}{\captionsize}
% \changes{v3.0a}{2004/01/23}{Implementation changed from \cs{captionfont} to \cs{@empty}}
% \changes{v3.0c}{2004/07/16}{Use \cs{providecommand} instead of \cs{newcommand} in respect of the memoir class}
%  The old versions \version{1.x} of the \package{caption} package offered this
%  command to setup the font size used for captions. We still do
%  so old documents will work fine.
%    \begin{macrocode}
\providecommand\captionsize{}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2004/01/23}{Option \opt{size=} now sets \cs{captionsize} instead of \cs{captionfont}}
%    \begin{macrocode}
\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
%    \end{macrocode}
%
% \subsubsection*{Vertical spaces before and after captions}
%
% \begin{macro}{\abovecaptionskip}
% \begin{macro}{\belowcaptionskip}
%  Usually these skips are defined within the document class, but some
%  document classes don't do so.
%    \begin{macrocode}
\@ifundefined{abovecaptionskip}{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\@ifundefined{belowcaptionskip}{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v3.0d}{2005/02/12}{Option \opt{skip=} added}
%    \begin{macrocode}
\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
%    \end{macrocode}
%
% \subsubsection*{Positioning}
%
% These macros handle the right position of the caption.
% Note that the position is actually \emph{not} controlled by the
% \package{caption} kernel options, but by the user (or a specific package
% like the \package{float} package) instead.
% The user can put the |\caption| command wherever he likes! So this stuff
% is only to give us a \emph{hint} where to put the right skips, the user
% usually has to take care for himself that this hint actually matches the
% right position.
% The user can also try out the experimental setting |position=auto| which
% means that the \package{caption} package should try to guess the actual
% position of the caption for himself. (But in many cases, for example in
% |longtable|s, this is doomed to fail, so it's not documented in the
% user part of the documentation.)
%
%    \begin{macrocode}
\DeclareCaptionOption{position}{\caption@setposition{#1}}
%    \end{macrocode}
%
% \begin{macro}{\caption@setposition}
% \changes{v3.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b},
%                             \opt{below}, and \opt{a} are allowed, too}
% \changes{v3.0d}{2004/08/10}{Usage of \cs{caption@defaultpos} added}
%  |\caption@setposition|\marg{position}\par
%  Selecting the caption position means that we put |\caption@position| to
%  the right value. \emph{Please do \textbf{not} use the internal macro
%  \cs{caption@position} in your own package or document, but use the wrapper
%  macro \cs{caption@iftop} instead.}
%    \begin{macrocode}
\newcommand*\caption@setposition[1]{%
  \caption@ifinlist{#1}{d,default}{%
    \def\caption@position{\caption@defaultpos}%
  }{\caption@ifinlist{#1}{t,top,above}{%
    \let\caption@position\@firstoftwo
  }{\caption@ifinlist{#1}{b,bottom,below}{%
    \let\caption@position\@secondoftwo
  }{\caption@ifinlist{#1}{a,auto}{%
    \let\caption@position\@undefined
  }{%
    \caption@Error{Undefined caption position `#1'}%
  }}}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@defaultpos}
%  The default `position' is usually `bottom', this means that the (larger)
%  skip will be typeset above the caption.
%  This correspondents to the |\@makecaption| implementation in the standard
%  \LaTeX\ document classes.
%    \begin{macrocode}
%\caption@setdefaultpos{b}% default = bottom
\let\caption@defaultpos\@secondoftwo
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@iftop}
% \changes{v3.0a}{2004/01/23}{Split into \cs{caption@iftop} \& \cs{caption@fixposition}}
% \changes{v3.0d}{2005/02/12}{Adapted to \cs{caption@defaultpos}}
%  |\caption@iftop|\marg{true-code}\marg{false-code}\par
%  (If the |position=| is set to |auto| we assume a |bottom| position.)
%    \begin{macrocode}
\newcommand\caption@iftop{%
  \ifx\caption@position\@undefined
    \expandafter\@secondoftwo
  \else
    \expandafter\caption@position
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@fixposition}
% \changes{v3.0b}{2004/05/16}{Split into \cs{caption@fixposition} & \cs{caption@autoposition}}
%  |\caption@fixposition|\par
%  This macro checks if the `position' is set to `auto'.
%  If yes, |\caption@autoposition| will be called to
%  set |\caption@position| to a proper value we can actually use.
%    \begin{macrocode}
\newcommand\caption@fixposition{%
  \ifx\caption@position\@undefined
    \caption@autoposition
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@autoposition}
% \changes{v3.0a}{2004/01/23}{\cs{ifvmode} added}
%  |\caption@autoposition|\par
%  We guess the actual position of the caption by checking |\prevdepth|.
%    \begin{macrocode}
\newcommand\caption@autoposition{%
  \ifvmode
    \edef\caption@tempa{\the\prevdepth}%
    \caption@Debug{\protect\prevdepth=\caption@tempa}%
%   \caption@setposition{\ifdim\prevdepth>-\p@ b\else t\fi}%
    \ifdim\prevdepth>-\p@
      \let\caption@position\@secondoftwo
    \else
      \let\caption@position\@firstoftwo
    \fi
  \else
    \caption@Debug{no \protect\prevdepth}%
%   \caption@setposition{b}%
    \let\caption@position\@secondoftwo
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Hooks}
%
% \begin{macro}{\AtBeginCaption}
% \begin{macro}{\AtEndCaption}
%  |\AtBeginCaption| \marg{code}\\
%  |\AtEndCaption| \marg{code}\par
%  These hooks can be used analogous to |\AtBeginDocument| and |\AtEndDocument|.
%    \begin{macrocode}
\newcommand\caption@beginhook{}
\newcommand\caption@endhook{}
\newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook}
\newcommand\AtEndCaption{\l@addto@macro\caption@endhook}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection*{Miscellaneous options}
%
% \changes{v3.0b}{2004/05/16}{Option \opt{listof=} added}
% \changes{v3.0d}{2005/02/12}{Option \opt{strut=} added}
%    \begin{macrocode}
\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}
\DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}}
\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}
%    \end{macrocode}
%
% \subsubsection*{Debug option}
% \changes{v3.0m}{2007/03/04}{Debug option added to kernel}
%
%    \begin{macrocode}
\DeclareCaptionOption{debug}[1]{%
  \caption@setbool{debug}{#1}%
  \caption@ifdebug{%
    \def\caption@Debug{\PackageInfo{caption3}}%
  }{%
    \let\caption@Debug\@gobble
  }}
\setkeys{caption}{debug=0}
%    \end{macrocode}
%
% \subsubsection*{Initialization of parameters}
%
%    \begin{macrocode}
\captionsetup{style=default,position=default,listof=1,%
              twoside=\if@twoside 1\else 0\fi}
%    \end{macrocode}
%
% \begin{macro}{\ifcaption@star}
% If the starred form of |\caption| is used, this will be set to |true|.
% (It will be reset to |false| at the end of |\caption@@make|.)
%    \begin{macrocode}
\newif\ifcaption@star
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Typesetting the caption}
%
% \begin{macro}{\caption@make}
%  |\caption@make|\marg{float name}\marg{ref.\ number}\marg{text}
%    \begin{macrocode}
\newcommand\caption@make[2]{%
  \caption@@make{\caption@lfmt{#1}{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@make}
% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-05: \cs{ifdim}\cs{captionindent=}\cs{z@} added}
% \changes{v3.0d}{2005/02/12}{Bugfix 04-10-26: Use \cs{@tempdima} instead of \cs{captionmargin} resp. \cs{captionwidth};
%                             check for \cs{z@} added}
% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{hskip}\cs{captionmargin} to the end of caption added}
% \changes{v3.0d}{2005/02/12}{Bugfix: \cs{strut} moved from here to \cs{caption@@@make}}
% \changes{v3.0d}{2005/02/12}{Single-line-check moved up so it can affect margins now}
% \changes{v3.0d}{2005/02/09}{Improvement: \cs{caption@ifh} added}
% \changes{v3.0d}{2005/02/09}{Bugfix: \cs{leavevmode} added}
% \changes{v3.0h}{2005/08/24}{Uses \cs{sbox} instead of \cs{setbox} in single-line-check}
% \changes{v3.0i}{2005/12/04}{Uses \cs{caption@slc}}
% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@calcmargin} inside single-line-check replaced by \cs{relax}}
% \changes{v3.0i}{2006/01/11}{Bugfix: \cs{caption@startbox} will always be typeset in horizontal mode}
% \changes{v3.0k}{2006/05/13}{Uses \cs{captionbox} instead of \cs{caption@start/endbox}}
% \changes{v3.0l}{2007/01/04}{Oops, bugfix 04-05-05 got lost in v3.0j, re-added}
% \changes{v3.0p}{2007/04/03}{Usage of \cs{caption@ifoddpage} added}
%  |\caption@@make|\marg{caption label}\marg{caption text}
%    \begin{macrocode}
\newcommand\caption@@make[2]{%
  \begingroup
  \caption@beginhook
  \caption@calcmargin
%    \end{macrocode}
%
% Special single-line treatment (option |singlelinecheck=|)
%
%    \begin{macrocode}
  \caption@ifslc{\ifx\caption@sls\@empty\else
    \caption@slc{#1}{#2}\captionwidth\relax
  \fi}{}%
%    \end{macrocode}
%
% Typeset the left margin (option |margin=|)
%
%    \begin{macrocode}
  \@tempdima\captionmargin
  \ifdim\captionmargin@=\z@\else
    \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
  \fi
  \caption@ifh{\advance\@tempdima\captionindent}%
  \hskip\@tempdima
%    \end{macrocode}
%
% We actually use a |\vbox| of width |\captionwidth - \captionindent|
% to typeset the caption
% (Note: |\captionindent| is \emph{not} supported if the caption format
% was defined with |\DeclareCaptionFormat*|.)
%
%    \begin{macrocode}
  \@tempdima\captionwidth
  \caption@ifh{\advance\@tempdima by -\captionindent}%
  \captionbox\@tempdima{%
%    \end{macrocode}
%
% Typeset the indention (option |indention=|)\\
% Bugfix 04-05-05: |\hskip-\captionindent| replaced by |\ifdim\captionindent=\z@|\ldots
%
%    \begin{macrocode}
    \caption@ifh{%
      \ifdim\captionindent=\z@
        \leavevmode
      \else
        \hskip-\captionindent
      \fi}%
%    \end{macrocode}
%
% Typeset the caption itself and close the |\captionbox|
%
%    \begin{macrocode}
    \caption@@@make{#1}{#2}}%
%    \end{macrocode}
%
% Typeset the right margin (option |margin=|)
%
%    \begin{macrocode}
  \@tempdima\captionmargin
  \ifdim\captionmargin@=\z@\else
    \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
  \fi
  \hskip\@tempdima
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@endhook
  \endgroup
%    \end{macrocode}
%
%    \begin{macrocode}
  \global\caption@starfalse}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@calcmargin}
%  Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
%  values.
% \changes{v3.0h}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
% \changes{v3.0i}{2006/01/12}{Improvement: Takes care of list environment now}
%    \begin{macrocode}
\newcommand\caption@calcmargin{%
%    \end{macrocode}
%  \emph{Note:} Inside a |list| environment |\linewidth| do not contain
%  the proper value, because |\@caption| calls |\@parboxrestore| which
%  resets |\linewidth| to |\hsize|. Therefore we have to calculate the
%  proper line width on our own in this case.
%    \begin{macrocode}
  \@tempdima\hsize
  \ifnum\@listdepth>0\relax
    \advance\@tempdima by -\leftmargin
    \advance\@tempdima by -\rightmargin
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \ifdim\captionwidth=\z@
    \captionwidth\@tempdima
    \advance\captionwidth by -2\captionmargin
    \advance\captionwidth by -\captionmargin@
  \else
    \captionmargin\@tempdima
    \advance\captionmargin by -\captionwidth
    \divide\captionmargin by 2
    \captionmargin@\z@
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \caption@Debug{%
    \protect\hsize=\the\hsize,
    \protect\margin=\the\captionmargin,
    \protect\marginx=\the\captionmargin@,
    \protect\width=\the\captionwidth}%
%    \end{macrocode}
%    \begin{macrocode}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@slc}
%  This one does the single-line-check.
%    \begin{macrocode}
\newcommand\caption@slc[4]{%
  \caption@startslc
  \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
  \ifdim\wd\@tempboxa >#3%
    \caption@endslc
  \else
    \caption@endslc
    \caption@esetup\caption@sls
    #4%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@startslc}
% \changes{v3.0b}{2004/05/16}{Bugfix: Redefinition of \cs{label} \& \cs{@footnotetext} added}
% \changes{v3.0b}{2004/05/16}{Redefine \cs{stepcounter} instead of \cs{footnote(mark)}}
% \changes{v3.0d}{2005/02/12}{\cs{let}\cs{caption@hj}\cs{relax} added}
% \changes{v3.0h}{2005/07/09}{Support of \package{endnotes} package added}
%  Re-define anything which would disturb the single-line-check.
%    \begin{macrocode}
\newcommand\caption@startslc{%
  \begingroup
  \let\label\@gobble
  \let\@footnotetext\@gobble\let\@endnotetext\@gobble
  \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}%
  \let\caption@hj\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@endslc}
% This ends the single-line-check.
%    \begin{macrocode}
\newcommand\caption@endslc{%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionbox}
% \changes{v3.0k}{2006/05/13}{We define \cs{captionbox} instead of \cs{caption@start/endbox}}
% \changes{v3.0n}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from \cs{parbox-t} to \cs{parbox-b}}
%  This macro defines the box which surrounds the caption paragraph.
%    \begin{macrocode}
\newcommand\captionbox{\parbox[b]}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@@make}
% \changes{v3.0b}{2004/05/16}{Bugfix 04-05-06: \cs{allowhyphens} added}
% \changes{v3.0d}{2005/02/12}{Bugfix 04-12-16: Use some kind of \cs{@startstrut}\cs{strutbox} instead of \cs{strut}}
% \changes{v3.0d}{2005/02/12}{Bugfix 05-01-23: \cs{@finalstrut}\cs{strutbox} added}
% \changes{v3.0e}{2005/05/05}{Use \cs{caption@ifempty}; \cs{let}\cs{caption@ifstrut}\cs{@secondoftwo} added}
% \changes{v3.0e}{2005/05/05}{Bugfix: Handling of \cs{ifcaption@star} changed}
% \changes{v3.0h}{2005/08/24}{Check for empty label added}
% \changes{v3.0h}{2005/08/25}{\cs{caption@iflf} added}
% \changes{v3.0l}{2007/02/18}{Usage of \cs{caption@tfmt} added}
%  |\caption@@@make|\marg{caption label}\marg{caption text}\par
%  This one finally typesets the caption paragraph, without margin and indention.
%    \begin{macrocode}
\newcommand\caption@@@make[2]{%
%    \end{macrocode}
%
% If the label is empty, we use no caption label separator.
%
%    \begin{macrocode}
  \sbox\@tempboxa{#1}%
  \ifdim\wd\@tempboxa=\z@
    \let\caption@lsep\relax
  \fi
%    \end{macrocode}
%
% If the text is empty, we use no caption label separator, too.
%
%    \begin{macrocode}
  \caption@ifempty{#2}{%
    \let\caption@lsep\relax
%   \let\caption@ifstrut\@secondoftwo
  }%
%    \end{macrocode}
%
% Take care that |\captionparindent| and |\captionhangindent| will be used
% to typeset the paragraph.
%
%    \begin{macrocode}
  \@setpar{\@@par\caption@@par}\caption@@par
%    \end{macrocode}
%
% Finally the caption will be typeset.
%
%    \begin{macrocode}
  \caption@hj\captionsize\captionfont\caption@fmt
    {\ifcaption@star\else{\captionlabelfont#1}\fi}%
    {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
    {{\captiontextfont
      \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
      \nobreak\hskip\z@skip
      \caption@tfmt{#2}%
%     \caption@ifstrut{\vrule\@height\z@\@depth\dp\strutbox\@width\z@}{}%
      \caption@ifstrut{\@finalstrut\strutbox}{}%
      \par}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifempty}
% \changes{v3.0e}{2005/05/05}{This macro added}
%  |\caption@ifempty|\marg{text}\marg{if-clause}\par
%  This one tests if the \meta{text} is actually empty.\par
%  \emph{Note:} This will be done without expanding the text, therefore this
%  is far away from being bullet-proof.
%    \begin{macrocode}
\newcommand\caption@ifempty[1]{%
  \def\caption@tempa{#1}%
  \def\caption@tempb{\ignorespaces}%
  \ifx\caption@tempa\caption@tempb
    \let\caption@tempa\@empty
  \fi
  \ifx\caption@tempa\@empty
    \expandafter\@firstofone
  \else
    \expandafter\@gobble
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@@par}
% \changes{v3.0h}{2005/08/22}{Made this definition global}
%  |\caption@@par|\par
%  This command will be executed with every |\par| inside the caption.
%    \begin{macrocode}
\newcommand*\caption@@par{%
  \parindent\captionparindent\hangindent\captionhangindent}%
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%</kernel>
% \fi
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \subsection{Main package}
% \iffalse
%<*package>
% \fi
%
% \subsubsection*{Identification}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption}[2007/04/16 v3.0q Customising captions (AR)]
%    \end{macrocode}
%
% \subsubsection*{Loading the kernel}
%
%    \begin{macrocode}
\RequirePackage{caption3}[=2007/01/31] % needs v1.0l or newer
%    \end{macrocode}
%
% \subsection*{Check against the obsolete \package{caption2} package}
% \changes{v3.0p}{2007/04/06}{Check against obsolete \package{caption2} package added}
%
%    \begin{macrocode}
\@ifpackageloaded{caption2}{%
  \caption@Error{You can't use both the caption *and* caption2 package}%
  \endinput
}{}
%    \end{macrocode}
%
% \subsubsection*{Option for configuration files}
%
%    \begin{macrocode}
\DeclareCaptionOption{config}[caption]{%
   \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file
                                       #1.cfg used ***}}%
                             {\PackageWarning{caption}{Configuration
                               file #1.cfg not found}}}
%    \end{macrocode}
%
% \subsubsection*{Options for |figure| and |table|}
%
% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added}
%    \begin{macrocode}
\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}
\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}
%    \end{macrocode}
%
% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added}
%    \begin{macrocode}
\DeclareCaptionOption*{figurename}{\captionsetup[figure]{name=#1}}
\DeclareCaptionOption*{tablename}{\captionsetup[table]{name=#1}}
%    \end{macrocode}
%
% \subsubsection*{caption \version{1.x} compatibility options}
%
%    \begin{macrocode}
\DeclareCaptionOption*{normal}[]{\caption@setformat{normal}}
\DeclareCaptionOption*{isu}[]{\caption@setformat{hang}}
\DeclareCaptionOption*{hang}[]{\caption@setformat{hang}}
\DeclareCaptionOption*{center}[]{\caption@setjustification{centering}}
\DeclareCaptionOption*{anne}[]{\caption@setjustification{centerlast}}
\DeclareCaptionOption*{centerlast}[]{\caption@setjustification{centerlast}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOption*{scriptsize}[]{\def\captionfont{\scriptsize}}
\DeclareCaptionOption*{footnotesize}[]{\def\captionfont{\footnotesize}}
\DeclareCaptionOption*{small}[]{\def\captionfont{\small}}
\DeclareCaptionOption*{normalsize}[]{\def\captionfont{\normalsize}}
\DeclareCaptionOption*{large}[]{\def\captionfont{\large}}
\DeclareCaptionOption*{Large}[]{\def\captionfont{\Large}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOption*{up}[]{\l@addto@macro\captionlabelfont\upshape}
\DeclareCaptionOption*{it}[]{\l@addto@macro\captionlabelfont\itshape}
\DeclareCaptionOption*{sl}[]{\l@addto@macro\captionlabelfont\slshape}
\DeclareCaptionOption*{sc}[]{\l@addto@macro\captionlabelfont\scshape}
\DeclareCaptionOption*{md}[]{\l@addto@macro\captionlabelfont\mdseries}
\DeclareCaptionOption*{bf}[]{\l@addto@macro\captionlabelfont\bfseries}
\DeclareCaptionOption*{rm}[]{\l@addto@macro\captionlabelfont\rmfamily}
\DeclareCaptionOption*{sf}[]{\l@addto@macro\captionlabelfont\sffamily}
\DeclareCaptionOption*{tt}[]{\l@addto@macro\captionlabelfont\ttfamily}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}}
%    \end{macrocode}
%
%    \begin{macrocode}
\caption@setbool{ruled}{0}
\DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}}
%    \end{macrocode}
%
% \subsubsection*{Some caption2 \version{2.x} compatibility options}
% \changes{v3.0h}{2005/07/08}{caption2 \version{2.x} compatibility options added}
%
%    \begin{macrocode}
\DeclareCaptionOption*{flushleft}[]{\caption@setjustification{raggedright}}
\DeclareCaptionOption*{flushright}[]{\caption@setjustification{raggedleft}}
\DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}}
\DeclareCaptionOption*{ignoreLTcapwidth}[]{}
%    \end{macrocode}
%
% \subsubsection*{Some \KOMAScript\ compatibility options}
% \changes{v3.0h}{2005/08/22}{\KOMAScript\ compatibility options added}
%
%    \begin{macrocode}
\DeclareCaptionOption*{onelinecaption}[]{\caption@setbool{slc}{1}}
\DeclareCaptionOption*{noonelinecaption}[]{\caption@setbool{slc}{0}}
\DeclareCaptionOption*{tablecaptionabove}[]{\captionsetup[table]{position=t}}
\DeclareCaptionOption*{tablecaptionbelow}[]{\captionsetup[table]{position=b}}
%    \end{macrocode}
%
% \subsubsection*{Generic package support}
%
% \begin{macro}{\caption@declarepackage}
%  |\caption@declarepackage|\marg{package name}\par
%  Each single package support can be switched on or off by using the
%  appropriate option. By default all of them are enabled.
%    \begin{macrocode}
\newcommand*\caption@declarepackage[1]{%
  \caption@setbool{pkt@#1}{1}%
  \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}}
\AtEndOfPackage{\let\caption@declarepackage\@undefined}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ifpackage}
% \changes{v3.0f}{2005/05/29}{3rd argument \meta{code} added, so no extra check is needed}
%  |\caption@ifpackage|\marg{package name}\marg{package macro}\marg{code}\par
%  If a certain package support is requested the appropriate code will
%  be used. `Requested' means that the option belonging to it is set to
%  |true| and the macro called \meta{package macro} is defined.
%  (If \meta{package macro} is not yet defined we use |\AtBeginDocument|
%  here, so the package could be loaded after this package, too.)
%    \begin{macrocode}
\newcommand\caption@ifpackage[3]{%
%    \end{macrocode}
%    \begin{macrocode}
  \edef\caption@tempa{%
    \caption@ifbool{pkt@#1}%
      {\@ifundefined{#2}{AtBeginDocument}{firstofone}}%
      {gobble}}%
  \caption@Info{#1=\caption@ifbool{pkt@#1}{1}{0} %
       (\@ifundefined{#2}{not }{}loaded->\caption@tempa)}%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@ifbool{pkt@#1}{%
    \@ifundefined{#2}%
      {\let\caption@tempa\AtBeginDocument}%
      {\let\caption@tempa\@firstofone}%
  }{%
    \let\caption@tempa\@gobble
  }%
  \caption@tempa{\@ifundefined{#2}{}{#3}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@undefbool{pkt@#1}}
\AtEndOfPackage{\let\caption@ifpackage\@undefined}
%    \end{macrocode}
% \end{macro}
%
% You can also switch the caption support off using the package option
% |caption=false|.
% This may look strange, but there are certain circumstances where this could
% be useful.
% Such a situation might be the usage of the \package{subfig} package without
% disturbing the main caption code of the document class.\par
% \emph{Note: This mechanism is obsolete now, it has been superseeded by the
% \package{subfig} package option {\rm|caption=false|} which causes that only the
% caption kernel \package{caption3} is loaded.}
%
%    \begin{macrocode}
\caption@declarepackage{caption}
%    \end{macrocode}
%
% These are the packages we support:
%
%    \begin{macrocode}
\caption@declarepackage{float}
\caption@declarepackage{floatrow}
\caption@declarepackage{hyperref}
\caption@declarepackage{hypcap}
\caption@declarepackage{listings}
\caption@declarepackage{longtable}
\caption@declarepackage{picins}
\caption@declarepackage{rotating}
\caption@declarepackage{sidecap}
\caption@declarepackage{supertabular}
%    \end{macrocode}
%
% \subsubsection*{Processing of options}
%
% \changes{v3.0m}{2007/03/04}{Verbose option added to package}
%    \begin{macrocode}
\DeclareCaptionOption{verbose}[1]{%
  \caption@setbool{verbose}{#1}%
  \caption@ifverbose{%
    \def\caption@Info{\PackageInfo{caption}}%
  }{%
    \let\caption@Info\@gobble
  }}
\setkeys{caption}{verbose=0}
%    \end{macrocode}
%
%    \begin{macrocode}
\caption@ProcessOptions{caption}
%    \end{macrocode}
%
% If the option |caption=false| was given we stop processing this file
% immediately.
%    \begin{macrocode}
\caption@ifbool{pkt@caption}{}{\endinput}
\caption@undefbool{pkt@caption}
%    \end{macrocode}
%
% \subsubsection*{Useful stuff}
%
% \begin{macro}{\captionof}
%  |\captionof|(|*|)\marg{type}\oarg{lst\_entry}\marg{heading}
%    \begin{macrocode}
\def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
\newcommand*\caption@of[2]{\def\@captype{#2}#1}
%    \end{macrocode}
% \end{macro}
%
% Note: Like |\captionof| the option |type=| should only be used inside a
% group or environment and does not check if the argument is a valid
% floating environment or not.
%
% \changes{v3.0d}{2004/08/03}{Option \opt{name=} added}
% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
%    \begin{macrocode}
\DeclareCaptionOption{name}{\caption@setfloatname\@captype{#1}}
\DeclareCaptionOption{type}{\def\@captype{#1}}
%    \end{macrocode}
%
% \begin{macro}{\ContinuedFloat}
% \changes{v3.0f}{2005/06/11}{Call of \cs{caption@ContinuedFloat} added}
% \changes{v3.0i}{2005/11/12}{Optional argument and call of \cs{caption@@ContinuedFloat} added}
%  |\ContinuedFloat|\oarg{type}\par
%  This mainly decreases the appropriate counter by $-1$.
%    \begin{macrocode}
\providecommand\ContinuedFloat{%
  \@ifnextchar[%]
    \@ContinuedFloat
    {\ifx\@captype\@undefined
       \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd
     \else
       \@ContinuedFloat[\@captype]%
     \fi}}
\def\@ContinuedFloat[#1]{%
  \addtocounter{#1}\m@ne
  \caption@ContinuedFloat{#1}%
  \caption@@ContinuedFloat{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@ContinuedFloat}
% \begin{macro}{\caption@resetContinuedFloat}
%  |\caption@ContinuedFloat|\marg{type}\par
%  |\caption@resetContinuedFloat|\marg{type}\par
%  The first one will be called inside |\ContinuedFloat|, the second one
%  inside |\caption|. Usually they do nothing but this changes if the
%  \package{hyperref} package is loaded. (See \package{hyperref} package
%  support for details.)
%    \begin{macrocode}
\let\caption@ContinuedFloat\@gobble
\let\caption@resetContinuedFloat\@gobble
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\caption@@ContinuedFloat}
% This hook is for foreign packages which link themself into |\ContinuedFloat|,
% for example the \package{subfig} package\cite{subfig}.
%    \begin{macrocode}
\providecommand*\caption@@ContinuedFloat[1]{}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Internal helpers}
%
% \begin{macro}{\caption@begin}
% \changes{v3.0a}{2004/01/23}{\cs{caption@settype} changed by \cs{caption@setfloattype}}
% \changes{v3.0e}{2005/04/12}{Check for default label format added}
% \changes{v3.0f}{2005/06/11}{Call of \cs{caption@resetContinuedFloat} added}
%  Our handling of |\caption| will always be surrounded by
%  |\caption@begin| (or |\caption@beginex|) and |\caption@end|.\par
%  |\caption@begin|\marg{type} performs these tasks:
%  \begin{itemize}
%  \item Call |\caption@resetContinuedFloat| (see above)
%        and start a new group
%  \item Execute the options set with |\captionsetup|\oarg{type}
%  \item Define |\fnum@|\meta{type} if the caption label format is set
%        to non-default
%  \item Override the |position=| setting, if necessary
%        (for example if set to |auto| or used inside a |supertabular|)
%  \end{itemize}
%    \begin{macrocode}
\newcommand*\caption@begin[1]{%
  \caption@resetContinuedFloat{#1}%
  \begingroup
%    \end{macrocode}
%    \begin{macrocode}
  \caption@setfloattype{#1}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \ifx\caption@lfmt\caption@lfmt@default\else
    \@namedef{fnum@#1}{%
      \caption@lfmt{\caption@floatname{#1}}{\@nameuse{the#1}}}%
  \fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@fixposition
  \global\let\caption@fixedposition\caption@position}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@beginex}
% \changes{v3.0b}{2004/05/16}{Support of \opt{listof=} added}
% \changes{v3.0h}{2005/09/16}{Bugfix: Made this macro and \cs{addcontentsline} \cs{long}}
% \changes{v3.0l}{2007/02/04}{Takes now 3 args instead of 2, check for empty heading added}
%  |\caption@beginex|\marg{type}\marg{list entry}\marg{heading}\\
%  performs the same tasks as |\caption@begin| and additionally:
%  Redefine |\addcontentsline| if no list-of entry is requested, that
%  means either the argument \meta{list entry} is empty or |listof=| was
%  set to |false|.
%    \begin{macrocode}
\newcommand\caption@beginex[3]{%
  \caption@begin{#1}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@iflof%
    {\def\caption@tempa{#2}}%
    {\let\caption@tempa\@empty}%
  \ifx\caption@tempa\@empty
    \long\def\addcontentsline##1##2##3{}% There is no \@gobblethree...
  \fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \caption@ifempty{#3}{\let\caption@ifempty\@secondoftwo}%
%    \end{macrocode}
%
%    \begin{macrocode}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@end}
%  |\caption@end| closes the group.
%    \begin{macrocode}
\newcommand*\caption@end{%
  \endgroup
%    \end{macrocode}
%
%    \begin{macrocode}
  \let\caption@position\caption@fixedposition}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@setfloattype}
% \changes{v3.0a}{2004/01/23}{This macro added}
%  |\caption@setfloattype|\marg{type}\\
%  sets up the right float type within |\@caption|, |\LT@makecaption| etc.
%  Usually this is equivalent to |\caption@settype| but I made it an own macro so
%  I can extend it later on, for example if the \package{float} or
%  \package{sidecap} package is loaded.
%    \begin{macrocode}
\let\caption@setfloattype\caption@settype
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@letfloattype}
% \changes{v3.0b}{2004/05/16}{This macro added}
% \changes{v3.0e}{2005/05/05}{Argument \meta{extra code} added}
%  |\caption@letfloattype|\marg{type}\marg{extra code}\\
%  redefines |\caption@setfloattype| so it does not only
%  |\caption@settype|\marg{type} but two additional tasks:
%  Executing extra code given as second argument and
%  execute options with |\caption@settype{#1}| afterwards.\par
%  You can find an example of its usage in the \package{longtable}
%  support, where this macro is called so
%  |\captionsetup[longtable]{|\ldots|}| can be used to setup options
%  for longtables which have a higher priority than the options which
%  have been setup with |\captionsetup[table]{|\ldots|}| or
%  |\setlength\LTcapwidth{|\ldots|}|.
%    \begin{macrocode}
\newcommand*\caption@letfloattype[2]{%
  \def\caption@setfloattype##1{%
    \caption@settype{##1}#2\caption@settype{#1}}}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2004/01/23}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} added}
% \changes{v3.0h}{2005/10/06}{Internal hooks \cs{caption@@begin} \& \cs{caption@@end} removed}
% \changes{v3.0d}{2004/08/03}{\cs{caption@setfloatname} added}
%
% \begin{macro}{\caption@floatname}
%  |\caption@floatname|\marg{type}\par
%  Usually all float names (which partly build the caption label)
%  follow the same naming convention. But some packages (for example
%  the \package{float} package) do not, so we use this wrapper macro which
%  can be changed later on.
%    \begin{macrocode}
\newcommand*\caption@floatname[1]{\@nameuse{#1name}}
\newcommand*\caption@setfloatname[1]{\@namedef{#1name}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{Caption support}
%
% \iffalse\begin{quote}
% \small\emph{Note:}
% Our aim is patching the existing |\caption| code so changes done by other
% packages will not get lost. We do similar in our \package{float},
% \package{hyperref}, and \package{hypcap} support so get the disadvantage
% of having ugly code with some negative side-effects, like the non-working
% |\caption{}| feature when the \package{french(le)} or \package{hyperref}
% package is loaded.
% \end{quote}\fi
%
% Some packages (like the \package{hyperref} package for example) redefines
% |\caption| and |\@caption|, too, but without chaining to their previous
% definitions. So we have to use |\AtBeginDocument| here, so we can make sure
% our definition don't get lost.
%
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
%
% We only patch |\caption| and |\@caption| if the \package{captcont} package
% (which brings it's own definition of |\caption*|) is not used.
% It does not make much sense using the actual version of the \package{caption}
% package with the \package{captcont} package, but this was different in the
% old (\version{1.x}) days so we take care to be backward compatible.
%
%    \begin{macrocode}
  \@ifundefined{cc@caption}{%
  \@ifundefined{caption@old}{%
%    \end{macrocode}
%
% \begin{macro}{\caption}
% \iffalse\changes{v3.0}{2003/07/18}{Bugfix: \cs{global} added, so this works with sidecap}\fi
% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
% \changes{v3.0f}{2005/06/13}{Support of \cs{caption*[]} removed}
% \changes{v3.0l}{2007/01/19}{Minimal support of \textsf{combine} package added}
%  Here comes our definition of |\caption| and |\caption*|.
%  (We set |\caption@startrue| globally so it works with the \package{sidecap} package, too.)
%    \begin{macrocode}
    \let\caption@old\caption
    \def\caption{\caption@caption\caption@old}%
    \def\caption@caption#1{%
      \@ifstar{\ContinuedFloat\global\caption@startrue#1[]}{#1}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@caption}
%  Our definition of |\@caption| simply calls the old definition,
%  nested by |\caption@beginex| and |\caption@end|.
%    \begin{macrocode}
    \let\caption@@old\@caption
    \long\def\@caption#1[#2]#3{%
      \caption@beginex{#1}{#2}{#3}%
        \caption@@old{#1}[{#2}]{#3}%
      \caption@end}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
  }{}}{%
%    \end{macrocode}
%
% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: \package{captcont} support fixed}
% Minimum \package{captcont} package support:\\
% We define |\caption@caption| here so it's there but does not make any harm.
%
%    \begin{macrocode}
    \caption@Info{captcont package v2.0 detected}%
    \def\caption@caption#1{#1}%
  }%
}
%    \end{macrocode}
%
% \begin{macro}{\@makecaption}
%  |\@makecaption|\marg{label}\marg{text}\par
%  The original code (from |latex/base/classes.dtx|):
%  \begin{verbatim}
%  \long\def\@makecaption#1#2{%
%    \vskip\abovecaptionskip
%    \sbox\@tempboxa{#1: #2}%
%    \ifdim \wd\@tempboxa >\hsize
%      #1: #2\par
%    \else
%      \global \@minipagefalse
%      \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
%    \fi
%    \vskip\belowcaptionskip}
%  \end{verbatim}
%  We do basically the same, but take care of the |position=| setting
%  and use |\caption@@make| from the \package{caption} kernel to actually
%  typeset the caption.
%    \begin{macrocode}
\renewcommand\@makecaption[2]{%
  \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
  \caption@@make{#1}{#2}%
  \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection*{\package{\KOMAScript} classes support}
% \changes{v3.0a}{2004/01/18}{Minimum adaptation to \KOMAScript\ added}
% \changes{v3.0h}{2005/08/22}{\cs{PackageInfo} added to \KOMAScript\ support}
% \changes{v3.0i}{2005/11/17}{\KOMAScript\ compatibility commands added}
% \changes{v3.0l}{2007/02/18}{\KOMAScript\ compatibility revised}
% \changes{v3.0q}{2007/04/16}{\KOMAScript\ compatibility revised}
%
%    \begin{macrocode}
\@ifundefined{scr@caption}{}{%
  \caption@Info{KOMA-Script class detected}
  \AtBeginDocument{\let\scr@caption\caption}
%    \end{macrocode}
%
% \begin{macro}{\onelinecaptionsfalse}
% \begin{macro}{\onelinecaptionstrue}
%    \begin{macrocode}
  \def\onelinecaptionstrue{\caption@setbool{slc}{1}}
  \def\onelinecaptionsfalse{\caption@setbool{slc}{0}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionabove}
% \begin{macro}{\captionbelow}
% \changes{v3.0j}{2006/03/21}{Bugfix 06-03-21: \cs{let}\cs{caption@setposition}\cs{@gobble} added}
% \changes{v3.0n}{2006/03/09}{Accidentally this got broken in \version{3.0m}, fixed}
%  Original code:
%  \begin{verbatim}
%  \newcommand{\captionabove}{\@captionabovetrue\scr@caption}
%  \newcommand{\captionbelow}{\@captionabovefalse\scr@caption}
%  \end{verbatim}
%    \begin{macrocode}
  \def\captionabove{%
    \caption@setposition{t}\let\caption@setposition\@gobble
    \scr@caption}
  \def\captionbelow{%
    \caption@setposition{b}\let\caption@setposition\@gobble
    \scr@caption}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{french(le)} package support}
% \changes{v3.0h}{2005/10/03}{Minimum adaptation to \package{french(le)} added}
%
%    \begin{macrocode}
\AtBeginDocument{\@ifundefined{f@ffrench}{}{%
  \caption@Info{french(le) package detected}%
%    \end{macrocode}
%
% If |\GOfrench| is defined as |\relax| all the re-definitions regarding
% captions have already been done, so we can do our patches immediately.
% Otherwise we must add our stuff to |\GOfrench|.
%
%    \begin{macrocode}
  \@ifundefined{GOfrench}%
    {\let\caption@tempa\@firstofone}%
    {\def\caption@tempa{\g@addto@macro\GOfrench}}%
  \caption@tempa{%
%    \end{macrocode}
%
% \begin{macro}{\@cnORI}
%  We update the definition of |\@cnORI| so it actually reflects
%  our definition of |\caption|.
%    \begin{macrocode}
    \let\@cnORI\caption
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tablescaption}
%  The \package{french(le)} package sets |\caption| to |\@tablescaption| at
%  |\begin{table}| for special treatment of footnotes.
%  Therefore we have to patch |\@tablescaption| so |\caption*| will work
%  inside the |table| environment.
%    \begin{macrocode}
    \let\caption@tablescaption\@tablescaption
    \def\@tablescaption{\caption@caption\caption@tablescaption}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\f@ffrench}
% \begin{macro}{\f@tfrench}
%  |\f@ffrench| and |\f@tfrench| reflect |\fnum@figure| and |\fnum@table|
%  when used in french mode. These contain additional code which typesets
%  the caption separator |\captionseparator| instead of the usual colon.
%  Because this breaks with our |\@makecaption| code we have to remove
%  this additional code here.
%    \begin{macrocode}
    \let\@eatDP\@undefined
    \let\caption@tempa\@empty
    \ifx\f@ffrench\fnum@figure
      \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
    \fi
    \ifx\f@tfrench\fnum@table
      \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
    \fi
    \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
    \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
    \caption@tempa
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
}}}
%    \end{macrocode}
%
% \subsubsection*{\package{float} package support}
% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
% \iffalse
% (This is a more straight-ahead implementation, but it only works with v1.3
%  now, so v1.2 is no longer supported. The old code including documentation
%  can be found in caption-30f-050530.zip)
% \fi
%
% The \package{float} package usually do not use the \LaTeX\ kernel command
% |\@caption| to typeset the caption but |\float@caption| instead.
% (|\@caption| will only be used if the float is re-styled with
% |\restylefloat*|.)
%
% The main two things |\float@caption| is doing different are:
% \begin{itemize}
%   \item The caption will be typeset inside a savebox called |\@floatcapt| so
%   it can be placed above or below the float contents afterwards.
%   \item |\@makecaption| will not be used to finally typeset the caption.
%   Instead |\@fs@capt| will be used which definition is part of the float
%   style.
%   (Note that |\@fs@capt| will not typeset any vertical space above or below
%   the caption; instead this space will be typeset by the float style code
%   itself.)
% \end{itemize}
%
% So our main goal is to re-define |\float@caption| so our macro
% |\caption@@make| will be used instead of |\@fs@capt|.
%
% To allow different caption styles for different float styles we will also
% determine the current float style (e.g. `ruled') at run time and select
% a caption style (and additional settings) with the same name, if defined.
%
% \begin{macro}{\caption@setfloatposition}
%  First of all we provide a macro which converts |\@fs@iftopcapt| (which
%  is part of a float style and controls where the caption will be typeset,
%  above or below the float contents) to our |position=| setting. Since the
%  spacing above and below the caption will be done by the float style and
%  \emph{not} by us this sounds quite useless. But in fact it isn't, since some
%  packages based on the \package{caption} package (like the \package{subfig}
%  package) could have an interest for this information and therefore use the
%  |\caption@iftop| macro we provide in our kernel. Furthermore we need this
%  information for ourself in |\captionof| which uses |\@makecaption| to
%  finally typeset the caption with skips.
%    \begin{macrocode}
\def\caption@setfloatposition{%
  \caption@setposition{\@fs@iftopcapt t\else b\fi}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@ifpackage{float}{@float@setevery}{%
  \caption@Info{float package v1.3 (or newer) detected}%
%    \end{macrocode}
%
% Since |\float@caption| puts the float contents into a savebox we need
% a special version of |\captionof| which `unfolds' this box afterwards,
% so the caption actually gets typeset. Furthermore we have to typeset
% the spacing above and below the caption for ourself, since this space is
% not part of the box.
%
% Please note that this version of |\captionof| only works \emph{outside}
% floating environments defined with the float package, so for example
% a |\captionof{Program}| used within a `standard' |figure| or a
% |minipage| will work fine, but not within a re-styled |figure| or
% an |Example| environment defined with |\newfloat|.
% (We don't check for this so you'll get wired errors if you try to do so!)
%
% \begin{macro}{\caption@of@float}
%  Usually no special action is necessary, so we define |\caption@of@float|
%  to |\@gobble|. We will redefine it later on to |\@firstofone| to activate
%  the code which `unfolds' the savebox.
%    \begin{macrocode}
  \let\caption@of@float\@gobble
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@of}
%  If the float is defined by the float package (which means |\fst@|\meta{type}
%  is defined) we activate the special treatment for such captions typeset
%  with |\captionof|. Furthermore we `execute' this float style, so
%  |\@fs@iftopcapt| is set to its proper value.
%    \begin{macrocode}
  \renewcommand*\caption@of[2]{%
    \@ifundefined{fst@#2}{}{%
      \let\caption@of@float\@firstofone
      \@nameuse{fst@#2}\@float@setevery{#2}}%
    \def\@captype{#2}#1}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\float@caption}
% \changes{v3.0h}{2005/08/23}{Bugfix 05-08-12: \cs{captionof} sets hyperref anchor now}
%  Our version of |\float@caption| nearly looks like our version of |\@caption|.
%  The main differences are that |\@fs@capt| will be replaced by our |\caption@@make|
%  and that the savebox called |\@floatcapt| will be unfolded if requested by
%  |\captionof|. (see above)
%    \begin{macrocode}
  \let\caption@@float\float@caption
  \long\def\float@caption#1[#2]#3{%
    \caption@beginex{#1}{#2}{#3}%
      \let\@fs@capt\caption@@make
      \caption@@float{#1}[{#2}]{#3}%
%    \end{macrocode}
%
%    \begin{macrocode}
      \caption@of@float{%
%    \end{macrocode}
%  If the \package{hyperref} package is loaded, we need to set the appropriate
%  anchor for ourself. To do so without adding extra vertical space we need
%  to save (and restore) |\prevdepth| and switch off the interline skip.
%    \begin{macrocode}
        \@ifundefined{hyper@@anchor}{}{%
          \begingroup
            \@tempdima\prevdepth
            \nointerlineskip
            \let\leavevmode\relax
            \hyper@@anchor\@currentHref\relax
            \prevdepth\@tempdima
          \endgroup}%
%    \end{macrocode}
%
%    \begin{macrocode}
        \def\caption@@make##1##2{\unvbox\@floatcapt}%
        \@makecaption{}{}}%
%    \end{macrocode}
%
%    \begin{macrocode}
    \caption@end}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@float@setevery}
%  |\@float@setevery|\marg{float type} is provided by the \package{float} package;
%  it's called every time a floating environment defined with |\newfloat| or
%  |\restylefloat| begins.
%  We use this hook to do some adaptations and to setup the proper caption style
%  (if defined) and additional settings declared with
%  |\captionsetup|\oarg{float style}.
%    \begin{macrocode}
  \let\caption@float@setevery\@float@setevery
  \def\@float@setevery#1{%
%    \end{macrocode}
%
%  \LaTeX{} and most packages use |\|\meta{type}|name|
%  to provide a macro for the float name -- for example the command
%  |\figurename| will usually contain the name of the floating environment
%  |figure|:
%  \begin{quote}
%    |\newcommand\figurename{Figure}|
%  \end{quote}
%
%  But the \package{float} package don't follow this naming convention,
%  it uses |\fname@|\meta{type} instead. So we have to adapt
%  |\caption@floatname| here, so our captions will be still ok.
%
%    \begin{macrocode}
    \def\caption@floatname##1{\@nameuse{fname@#1}}%
    \def\caption@setfloatname##1{\@namedef{fname@#1}}%
%    \end{macrocode}
%
%  Both |\newfloat| and |\restylefloat| save the \emph{actual} definition of
%  |\@caption| or |\float@caption| in |\@float@c@|\meta{captype} with |\let|
%  (instead of using |\def|), so redefinitions of |\@caption| (and of course
%  our redefinition of |\float@caption|) will never been used if the
%  |\newfloat| or |\restylefloat| command takes place in front of the
%  redefinitions provided by the \package{caption} or other packages like the
%  \package{hyperref} package.
%
%  So here we determine if the user has used |\restylefloat| or
%  |\restylefloat*| and bring |\@float@c@|\meta{captype} up-to-date.
%  This is quite easy: If |\@float@c@|\meta{captype} is the same as the
%  original or our own definition of |\float@caption|, the user has used
%  |\restylefloat| (and |\float@caption| should be used), otherwise
%  we assume he has used |\restylefloat*| (and |\@caption| should be used).
%  (This test will fail if some other package re-defines |\float@caption|,
%  too, so we have to assume that we are the only one.)
%
%    \begin{macrocode}
    \expandafter\let\expandafter\caption@tempa\csname @float@c@#1\endcsname
    \ifx\caption@tempa\float@caption
    \else\ifx\caption@tempa\@caption
    \else\ifx\caption@tempa\caption@@float
      \caption@Info{\protect\@float@c@#1\space := \protect\float@caption}%
      \expandafter\let\csname @float@c@#1\endcsname\float@caption
    \else
      \caption@Info{\protect\@float@c@#1\space := \protect\@caption}%
      \expandafter\let\csname @float@c@#1\endcsname\@caption
    \fi\fi\fi
%    \end{macrocode}
%
%  If the floating environment is defined with |\newfloat| or |\restylefloat|
%  (and \emph{not} with |\restylefloat*|), |\@float@c@|\meta{type}
%  will now be identical to |\float@caption|.
%
%    \begin{macrocode}
    \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
%    \end{macrocode}
%
%  First of all we set the caption position to it's proper value.
%  (See above definition of |\caption@setfloatposition|)
%
%    \begin{macrocode}
      \caption@setfloatposition
%    \end{macrocode}
%
%  Now we'll have to determine the current float style.
%  This is not so easy because the only hint provided by the \package{float}
%  package is the macro |\fst@|\meta{float type} which points to the macro
%  which represents the float style.
%  So for example after
%  \begin{quote}
%    |\floatstyle{ruled}|\\
%    |\newfloat{Program}{tbp}{lop}|
%  \end{quote}
%  |\fst@Program| will be defined as
%  \begin{quote}
%    |\def\fst@Program{\fs@ruled}|\quad.
%  \end{quote}
%
%  So here is what we do: We copy |\fst@|\meta{float type} to |\caption@fst| and
%  make it a string so we can gobble the first four tokens (= |\fs@|), so only the
%  the name of the float style is left.
%
%    \begin{macrocode}
      \expandafter\let\expandafter\caption@fst\csname fst@#1\endcsname
      \edef\caption@fst{\noexpand\string\expandafter\noexpand\caption@fst}%
      \edef\caption@fst{\noexpand\@gobblefour\caption@fst}%
%     \edef\caption@fst{\caption@fst}%
%    \end{macrocode}
%
%  |\caption@fst| now contains the float style (e.g. `ruled')
%  so we can use it to set the corresponding style (if defined) and additional options.
%
%    \begin{macrocode}
      \caption@setstyle*\caption@fst
      \caption@settype\caption@fst
%    \end{macrocode}
%
%    \begin{macrocode}
    \fi
%    \end{macrocode}
%
%    \begin{macrocode}
    \caption@float@setevery{#1}}%
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0f}{2005/06/26}{Skips of \env{plaintop} and \env{boxed} floats corrected}
%
% \begin{macro}{\fs@plaintop}
% \begin{macro}{\fs@boxed}
%  The float styles |plaintop| and |boxed| don't use our skip which can be set
%  with |skip=| : |plaintop| uses |\belowcaptionskip| instead of
%  |\abovecaptionskip|, and |boxed| uses a fixed space of |2pt|.
%  So we patch the according float style macros here to change this.
%    \begin{macrocode}
  \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
  \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% The skip between `boxed' floats and their caption defaults to |2pt|.
%
%    \begin{macrocode}
\captionsetup[boxed]{skip=2pt}
%    \end{macrocode}
%
% \changes{v3.0f}{2005/05/26}{\opt{strut=0} added to caption style \opt{ruled}}
% \changes{v3.0f}{2005/05/27}{Option \opt{ruled} fixed}
% To emulate the `ruled' definition of |\@fs@capt| we provide a caption style
% `ruled' with appropriate options. But if the package option |ruled| was
% specified, we setup some caption parameters to emulate the behaviour
% of the \package{caption} package \version{1.x} option |ruled| instead:
% The current caption settings will be used, but without margin and without
% `single-line-check'.
%    \begin{macrocode}
\caption@ifbool{ruled}{%
  \captionsetup[ruled]{margin=0pt,singlelinecheck=0}%
}{%
  \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
}
\caption@undefbool{ruled}
%    \end{macrocode}
%
% \subsubsection*{\package{floatrow} package support}
% \changes{v3.0f}{2005/06/01}{Support of the \package{floatrow} package added}
%
% The \package{floatrow} package is already adapted for usage with the
% \package{caption} package. So the main work has already been done by
% Mrs.Lapko, there are only two little things we have to take care about:
%
%    \begin{macrocode}
\caption@ifpackage{floatrow}{flrow@setlist}{%
  \caption@Info{floatrow package v0.1f (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\caption@of}
%  Captions typeset with |\captionof| should have the correct layout,
%  so we have to `activate' this layout here with |\flrow@setlist|.
%  \par{\small (Please note that this version of |\captionof| has the same
%  restrictions than the |\captionof| offered for floating environments
%  defined with the \package{float} package, see above.)}
%    \begin{macrocode}
  \renewcommand*\caption@of[2]{%
    \def\@captype{#2}\flrow@setlist{{#2}}#1}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@floatname}
%  The \package{floatrow} package follows the same naming convention
%  as the \package{float} package; so we have to adapt |\caption@floatname|
%  here, too.
%    \begin{macrocode}
  \renewcommand*\caption@floatname[1]{%
    \@nameuse{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
  \renewcommand*\caption@setfloatname[1]{%
    \@namedef{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{hyperref} package support}
% \changes{v3.0f}{2005/06/11}{Support of the \package{hyperref} package added}
%
% When the \package{hyperref} package is used we have the problem
% that the usage of |\ContinuedFloat| will create duplicate
% hyperlinks -- both |\@currentHlabel| and |\@currentHref| will be the same
% for the main float and the continued ones. So we have to make sure
% unique labels and references will be created each time. We do this
% by extending |\theHfigure| and |\theHtable|, so for continued floats
% the scheme
% \begin{quote}\meta{type}|.|\meta{type \#}|.|\meta{continue \#}\end{quote}
% will be used instead of
% \begin{quote}\meta{type}|.|\meta{type \#}\quad\quad.\end{quote}
% \par{\small(This implementation follows an idea from Steven Douglas Cochran.)}
% \par{\small Note: This does not help if |\Hy@naturalnamestrue| is set.}
%
%    \begin{macrocode}
\caption@ifpackage{hyperref}{theHfigure}{%
  \caption@Info{hyperref package v6.74m (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\caption@ContinuedFloat}
% \changes{v3.0g}{2005/06/28}{Bugfix: \cs{newcounter} replaced by \cs{newcount}}
% \changes{v3.0p}{2007/04/08}{\cs{newcount} replaced by \cs{caption@newcounter}}
%  If |\theH|\meta{type} is defined, we extend it with |.|\meta{continue \#}.
%  Furthermore we set |\caption@resetContinuedFloat| to |\@gobble| so the
%  continuation counter will not be reset to zero inside |\caption|.
%    \begin{macrocode}
  \def\caption@ContinuedFloat#1{%
    \@ifundefined{theH#1}{}{%
      \@ifundefined{CF@#1}{%
        \expandafter\caption@newcounter\csname CF@#1\endcsname
        \caption@resetContinuedFloat{#1}}{}%
      \expandafter\caption@stepcounter\csname CF@#1\endcsname
      \expandafter\l@addto@macro\csname theH#1\endcsname{%
        .\csname CF@#1\endcsname}%
      \let\caption@resetContinuedFloat\@gobble
    }}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@resetContinuedFloat}
%  If a continuation counter is defined, we reset it.
%    \begin{macrocode}
  \def\caption@resetContinuedFloat#1{%
    \@ifundefined{CF@#1}{}{%
      \expandafter\caption@setcounter\csname CF@#1\endcsname0}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{hypcap} package support}
% \changes{v3.0f}{2005/06/22}{Support of the \package{hypcap} package added}
% \changes{v3.0l}{2007/02/20}{Adapted to \package{hypcap} v1.6}
% \changes{v3.0p}{2007/04/09}{Adapted to \package{hypcap} v1.7}
% 
% When the \package{hypcap} package is used the following problems occur:
% \begin{enumerate}
%   \item The \package{hypcap} package uses |\capstart|, |\hc@caption|, and
%   |\hc@@caption| instead of |\caption| and |\@caption|.\footnote{This issue
%   was fixed in \package{hypcap} \version{1.7}}
%   So we have to patch these macros, too.
%   \item |\caption| will be saved to |\hc@org@caption| when the
%   \package{hypcap} package is loaded.
%   We have to change this so our definition of |\caption| will always be
%   used.
%   \item Both, |\capstart| and |\hc@@caption|, call |\hyper@makecurrent|.
%   But since we offer |\ContinuedFloat| the float counters could have changed
%   between these both calls! So we fix this by saving the \package{hyperref}
%   reference (= |\@currentHref|) in |\capstart| and restoring it later on in
%  |\hc@@caption|.
%   \par{\small (This also fixes the problem that \package{hypcap} does not
%   work if |\Hy@hypertexnamesfalse| is set.\footnote{This issue was fixed
%   in \package{hypcap} \version{1.6}} This come in handy; we set
%   it locally to avoid duplicated \package{hyperref} labels which could
%   occur if |\ContinuedFloat| will be used.)}
%   \item |\capstart| will call |\H@refstepcounter| to increase the float
%   number. This collides with a following |\ContinuedFloat|, too, so we have
%   to move this call from here to |\caption|. (Since we set
%   |\Hy@hypertexnamesfalse| we can do this without problems.)
% \end{enumerate}
%
%    \begin{macrocode}
\caption@ifpackage{hypcap}{hc@caption}{%
  \caption@Info{hypcap package v1.0 (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\capstart}
% \changes{v3.0l}{2007/02/20}{\cs{caption@currentHref} renamed to \cs{hc@currentHref}}
%  Here comes our version of |\capstart|:
%    \begin{macrocode}
  \let\caption@capstart\capstart
  \def\capstart{%
%    \end{macrocode}
%  First of all we update |\hc@org@caption| to correct the problem that the
%  \package{hypcap} package has saved an older definition of |\caption|.
%    \begin{macrocode}
    \let\hc@org@caption\caption
%    \end{macrocode}
%  Since we don't know the float counter yet (it could be changed with
%  |\ContinuedFloat| afterwards!) we make sure |\H@refstepcounter| will
%  not be used and |\Hy@hypertexnamesfalse| is set, so unique
%  \package{hyperref} labels will be generated by the original
%  definition of |\capstart|.
%  Afterwards we save the reference which was generated by
%  |\hyper@makecurrent|.
%    \begin{macrocode}
    \begingroup
      \let\H@refstepcounter\@gobble
      \Hy@hypertexnamesfalse
      \caption@capstart
      \@ifundefined{hc@hyperref}{}{% hypcap v1.7
        \global\advance\csname c@\@captype\endcsname\@ne}%
      \global\let\hc@currentHref\@currentHref
    \endgroup
%    \end{macrocode}
%
%  The \package{hypcap} package restores the previous definition of |\caption|
%  inside |\hc@@caption|. But since we will call this inside a group later on
%  (making this restauration non-working), we have to make this for ourself
%  inside |\caption|.
%  (This would not be necessary if \package{hypcap} would do this inside
%  |\hc@caption| instead of |\hc@@caption|.)\par
%  Additionally we increase the float counter here (since we have suppressed this
%  in |\capstart|) and use |\caption@caption| here, so |\caption*| will work as
%  expected.
%  (This is surrounded by |\hc@hyperref| so it does not make any harm when used
%   with \package{hypcap} \version{1.7}.)
%    \begin{macrocode}
    \@ifundefined{hc@hyperref}%
      {\let\next\@firstofone}{\let\next\hc@hyperref}% hypcap v1.7
    \next{\def\caption{%
      \let\caption\hc@org@caption
      \H@refstepcounter\@captype
      \@ifundefined{hc@hyperref}{}{% hypcap v1.7
        \global\advance\csname c@\@captype\endcsname\m@ne}%
      \caption@caption\hc@caption}}%
%    \end{macrocode}
%    \begin{macrocode}
  }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hc@@caption}
%  Here comes our version of |\hc@@caption|:
%    \begin{macrocode}
  \let\caption@hc@@caption\hc@@caption
  \long\def\hc@@caption#1[#2]#3{%
    \caption@beginex{#1}{#2}{#3}%
%    \end{macrocode}
%
%  Beside the usual |\caption@begin| and |\caption@end| stuff (to support local
%  options etc.) we make sure our saved \package{hyperref} reference will be
%  used.
%    \begin{macrocode}
      \let\caption@hyper@makecurrent\hyper@makecurrent
      \def\hyper@makecurrent\@captype{%
        \let\hyper@makecurrent\caption@hyper@makecurrent
        \global\let\@currentHref\hc@currentHref}%
%    \end{macrocode}
%
%    \begin{macrocode}
      \caption@hc@@caption{#1}[{#2}]{#3}%
    \caption@end}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{listings} package support}
% \changes{v3.0b}{2004/05/16}{Support of the \package{listings} package added}
%
%    \begin{macrocode}
\caption@ifpackage{listings}{lst@MakeCaption}{%
  \caption@Info{listings package v1.2 (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\lst@MakeCaption}
%  To support the \package{listings} package we need to redefine
%  |\lst@MakeCaption| so the original stuff is nested with
%  |\caption@begin| and |\caption@end|.
%    \begin{macrocode}
  \let\caption@lst@MakeCaption\lst@MakeCaption
  \def\lst@MakeCaption#1{%
%    \end{macrocode}
%
% If the |position=| is set to |auto|, we take over the |captionpos=| setting
% from the \package{listings} package.
% Note that we won't do this otherwise, so \package{listings} settings like
% |abovecaptionskip=0pt,belowcaptionskip=10pt,captionpos=t| will \emph{not}
% cause different outputs with or without the \package{caption} package loaded.
%    \begin{macrocode}
    \def\caption@autoposition{\caption@setposition{#1}}%
%    \end{macrocode}
%
%    \begin{macrocode}
    \caption@begin{lstlisting}%
      \caption@lst@MakeCaption{#1}%
    \caption@end}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{longtable} package support}
%
%    \begin{macrocode}
\caption@ifpackage{longtable}{LT@makecaption}{%
  \caption@Info{longtable package v3.15 (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\LT@makecaption}
% \changes{v3.0d}{2004/08/10}{Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
% \changes{v3.0e}{2005/05/05}{Bugfix: \cs{captionsetup[longtable]} overrides \cs{LTcapwidth} now}
% \changes{v3.0h}{2005/10/07}{\cs{caption@LT@make} introduced}
%  |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
%  Original code:
%  \begin{verbatim}
%  \def\LT@makecaption#1#2#3{%
%    \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
%      % Based on article class "\@makecaption", "#1" is "\@gobble" in star
%      % form, and "\@firstofone" otherwise.
%      \sbox\@tempboxa{#1{#2: }#3}%
%      \ifdim\wd\@tempboxa>\hsize
%        #1{#2: }#3%
%      \else
%        \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
%      \fi
%      \endgraf\vskip\baselineskip}%
%    \hss}}}
%  \end{verbatim}
%    \begin{macrocode}
  \def\LT@makecaption#1#2#3{%
    \caption@LT@make{%
%    \end{macrocode}
%
%  We set |\ifcaption@star| according the 1st argument.
%    \begin{macrocode}
      \caption@startrue#1\caption@starfalse
%    \end{macrocode}
%
%  If |\LTcapwidth| is not set to its default value |4in| we assume
%  that it shall overwrite our own setting.
%  (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
%    \begin{macrocode}
      \caption@letfloattype{longtable}{%
        \ifdim\LTcapwidth=4in \else
          \setcaptionwidth\LTcapwidth
        \fi}%
%    \end{macrocode}
%
%  The default |position=| setting for longtables is |top|.
%  (This emulates the standard behaviour of the \package{longtable} package
%   which has no skip above the caption but a skip below it.)
%    \begin{macrocode}
%     \caption@setdefaultpos{t}%
      \let\caption@defaultpos\@firstoftwo
%    \end{macrocode}
%
%  |position=auto| is a bad idea for longtables, but we do our very best.
%  This works quite well for captions inside the longtable contents, but
%  not for captions inside the longtable (end)foot.
%    \begin{macrocode}
      \def\caption@autoposition{%
        \caption@setposition{\ifcase\LT@rows t\else b\fi}}%
%    \end{macrocode}
%
%    \begin{macrocode}
      \caption@begin{table}%
%    \end{macrocode}
%
%  The following skip has the purpose to correct the height of the
%  |\parbox[t]|. Usually it's the height of the very first line, but
%  because of our extra skips (|\abovecaptionskip| and |\belowcaptionskip|)
%  it's always |0pt|.
%  (A different idea would be typesetting the first skip outside the longtable
%   column with |\noalign{\vskip|\ldots|}|, but this means we have to move
%   |\caption@begin| to some other place because it does not work in tabular
%   mode\ldots)
%    \begin{macrocode}
        \vskip-\ht\strutbox
%    \end{macrocode}
%
%  This should look familiar. We do our skips and use |\caption@@make| to
%  typeset the caption itself.
%    \begin{macrocode}
        \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
        \caption@@make{#2}{#3}\endgraf
        \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
      \caption@end}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@LT@make}
%  Typesets the caption as centered |\multicolumn|\ldots
%    \begin{macrocode}
  \newcommand\caption@LT@make[1]{%
    \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{#1}\hss}}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{picins} package support}
% \changes{v3.0j}{2006/01/26}{Support of the \package{picins} package added}
%
%    \begin{macrocode}
\caption@ifpackage{picins}{piccaption}{%
  \caption@Info{picins package v3.0 (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\piccaption}
%  Original code:
%  \begin{verbatim}
%  \def\piccaption{\@ifnextchar [{\@piccaption}{\@piccaption[]}}
%  \end{verbatim}
%    \begin{macrocode}
  \def\piccaption{\@dblarg\@piccaption}
% \def\piccaption{\caption@caption{\@dblarg\@piccaption}}
%    \end{macrocode}
% \end{macro}
%
% {\itshape TODO: Make |\piccaption[]{|\ldots|}| and |\piccaption{}| work}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{rotating} package support}
%
%    \begin{macrocode}
\caption@ifpackage{rotating}{@rotcaption}{%
  \caption@Info{rotating package v2.0 (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\rotcaption}
% \changes{v3.0c}{2004/07/16}{Bugfix: Check for \cs{caption@caption} removed}
% \changes{v3.0i}{2005/12/07}{Rewritten, works with \package{hyperref} now}
%  Make |\rotcaption*| work.
%    \begin{macrocode}
  \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
% \let\@rotcaption\@undefined
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rotcaptionof}
% \changes{v3.0i}{2005/12/07}{New}
%  Make |\rotcaptionof(*)| work.
%    \begin{macrocode}
  \def\rotcaptionof{%
    \@ifstar{\caption@of{\rotcaption*}}{\caption@of\rotcaption}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makerotcaption}
% \changes{v3.0i}{2005/12/06}{Rewritten, should finally work proper now}
% \changes{v3.0m}{2007/03/04}{Uses \cs{captionbox} instead of \cs{caption@start/endbox} now}
%  Original (bugfixed) code:
%  \begin{verbatim}
%  \long\def\@makerotcaption#1#2{%
%    \setbox\@tempboxa\hbox{#1: #2}%
%    \ifdim \wd\@tempboxa > .8\vsize
%      \rotatebox{90}{%
%      \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
%      }%\par   % <== \par removed (AR)
%    \else%
%      \rotatebox{90}{\box\@tempboxa}%
%    \fi
%    \nobreak\hspace{12pt}% <== \nobreak added (AR)
%  }
%  \end{verbatim}
%  Our version emulates this behaviour, but if |width=| is set,
%  the rotated caption is always typeset as |minipage|.
%  (Note that |margin=| is not supported here.)
%    \begin{macrocode}
  \long\def\@makerotcaption#1#2{%
%    \end{macrocode}
%
%    \begin{macrocode}
    \ifdim\captionwidth=\z@
      \setcaptionwidth{.8\textheight}%
      \caption@slc{#1}{#2}{.8\vsize}{%
        \let\caption@makerot\caption@@make
        \setcaptionmargin\z@
%       \setlength\captionindent\z@
%       \long\def\captionbox##1##2{\hbox{\hsize=.8\textheight\relax##2}}%
%         (not needed because \rotatebox uses an \hbox anyway)
        \let\captionbox\@secondoftwo}%
      \caption@setbool{slc}{0}% been there, done that
    \fi
%    \end{macrocode}
%
%    \begin{macrocode}
    \rotatebox{90}{\caption@makerot{#1}{#2}}%
    \nobreak\hspace{12pt}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  \newcommand\caption@makerot[2]{%
    \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{sidecap} package support}
%
%    \begin{macrocode}
\caption@ifpackage{sidecap}{endSC@FLOAT}{%
  \caption@Info{sidecap package v1.4d (or newer) detected}%
%    \end{macrocode}
%
% \begin{macro}{\SC@caption}
% \changes{v3.0d}{2004/11/28}{Bugfix: Definition of \cs{@captype} added}
% \changes{v3.0e}{2005/05/05}{Bugfix: Empty captions are handled correctly now}
% \changes{v3.0e}{2005/05/05}{Priority of options fixed}
% \changes{v3.0h}{2005/10/03}{Bugfix: Always use \cs{AtBeginDocument} to set \cs{SC@caption}}
%  First of all, we let sidecap use an actual definition of |\caption|.\\
%  (This is only required for version 1.5d of the sidecap package.)
%    \begin{macrocode}
  \@ifundefined{caption@caption}%
    {\let\caption@tempa\AtBeginDocument}%
    {\let\caption@tempa\@firstofone}%
  \caption@tempa{\let\SC@caption=\caption}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\SC@zfloat}
% \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added}
% \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@caption} removed}
%  This macro will be called at the start of the environment, here is a good
%  opportunity to do some adaptations to |\caption| and |\captionsetup|.
%    \begin{macrocode}
  \let\caption@SC@zfloat\SC@zfloat
  \def\SC@zfloat#1#2#3[#4]{%
%    \end{macrocode}
%
%  Note: |#2| is either |figure| or |table| and will be stored to |\SC@captype|
%  by the original version of |\SC@zfloat|.
%    \begin{macrocode}
    \caption@SC@zfloat{#1}{#2}{#3}[#4]%
%    \end{macrocode}
%
%  Since the sidecap package uses our |\caption| code outside the
%  floating environment the regular |\captionsetup| will not work.
%  So we need a special version here which saves the given argument list
%  which will be executed later on.
%    \begin{macrocode}
    \global\let\SC@CAPsetup\@empty
    \def\captionsetup##1{\g@addto@macro\SC@CAPsetup{,##1}}%
%    \end{macrocode}
%
%  Make |\caption*| work.
%    \begin{macrocode}
    \let\caption@SC\caption
%   \def\caption{\renewcommand\captionsetup[1]{}\caption@caption\caption@SC}%
    \def\caption{\caption@caption\caption@SC}%
  }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endSC@FLOAT}
% \changes{v3.0i}{2006/01/12}{\cs{@listdepth}\cs{z@} added}
%  This macro will be called at the end of the environment, here we need to
%  setup our stuff before the \package{sidecap} package actually typesets
%  its caption.
%    \begin{macrocode}
  \let\caption@endSC@FLOAT\endSC@FLOAT
  \def\endSC@FLOAT{%
%    \end{macrocode}
%
%  Note that |\@captype| isn't defined so far, this will be done inside
%  the original definition of |\endSC@FLOAT|.
%  But we define |\@captype| already here to make |\captionsetup| work
%  with |\@captype|-based options (like |type=|).
%    \begin{macrocode}
    \let\@captype\SC@captype
%    \end{macrocode}
%
%  Here we execute the options set with |\captionsetup| inside this environment.
%    \begin{macrocode}
    \caption@esetup\SC@CAPsetup
%    \end{macrocode}
%
%  Before we can typeset the caption we need to set the margin to zero
%  because any extra margin would only be disturbing here.\par
%  (We don't need to take care about the caption position because
%   the sidecap package set both |\abovecaptionskip| and |\belowcaptionskip|
%   to a skip of zero anyway.)\par
%  Furthermore |\SC@justify| will override the caption justification, if set.
%  The usage of |\SC@justify| differs from version to version of the
%  \package{sidecap} package:\par
%  \begin{tabular}{ll}
%    Version 1.4: & |\SC@justify| is not defined\\
%    Version 1.5: & |\SC@justify| is |\relax| when not set\\
%    Version 1.6: & |\SC@justify| is |\@empty| when not set\\
%  \end{tabular}
%    \begin{macrocode}
    \caption@letfloattype{SC\@captype}{%
      \@listdepth\z@
      \setcaptionmargin\z@
      \@ifundefined{SC@justify}{}{%
        \ifx\SC@justify\@empty\else
          \let\caption@hj\SC@justify
          \let\SC@justify\@empty
        \fi}}%
%    \end{macrocode}
%
%  We adapt |\caption@ifempty| so |\caption{}| will work within these
%  environments, too.
%    \begin{macrocode}
    \long\def\caption@ifempty##1{%
      \ifx\SC@CAPtext\@empty
        \expandafter\@firstofone
      \else
        \expandafter\@gobble
      \fi}%
%    \end{macrocode}
%
% \iffalse % Does not work anyway...
%  Furthermore we adapt |\caption@ifnocontentsline| so |\caption[]{|\ldots|}|
%  will work within these environments, too.
%    \begin{macrocode}
%   \long\def\caption@ifnocontentsline##1{%
%     \ifx\SC@OPTCAPtext\@empty
%       \expandafter\@firstofone
%     \else
%       \expandafter\@gobble
%     \fi}%
%    \end{macrocode}
% \fi
%
%  Finally we call the original definition of |\endSC@FLOAT| which will
%  call our version of |\caption| to typeset the caption.
%    \begin{macrocode}
    \caption@endSC@FLOAT}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsubsection*{\package{supertabular} package support}
%
% \begin{macro}{\caption@setSTposition}
%  The |position=| setting will be overwritten by the
%  \package{supertabular} package: If |\topcaption| is used,
%  the position will be |top| automatically, |bottom| otherwise.
%    \begin{macrocode}
\def\caption@setSTposition{%
  \caption@setposition{\if@topcaption t\else b\fi}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\caption@ifpackage{supertabular}{ST@caption}{%
  \caption@Info{supertabular package detected}%
%    \end{macrocode}
%
% \begin{macro}{\tablecaption}
% \changes{v3.0e}{2005/05/05}{Made \cs{topcaption*} and \cs{bottomcaption*} work}
%  Make |\topcaption*| and |\bottomcaption*| work.
%    \begin{macrocode}
  \let\caption@tablecaption\tablecaption
  \def\tablecaption{\caption@caption\caption@tablecaption}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ST@caption}
% \changes{v3.0a}{2004/01/23}{Bugfix: Missing \cs{par} added}
%  Original code:
%  \begin{verbatim}
%  \long\def\ST@caption#1[#2]#3{\par%
%    \addcontentsline{\csname ext@#1\endcsname}{#1}%
%                    {\protect\numberline{%
%                        \csname the#1\endcsname}{\ignorespaces #2}}
%    \begingroup
%      \@parboxrestore
%      \normalsize
%      \if@topcaption \vskip -10\p@ \fi
%      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%      \if@topcaption \vskip 10\p@ \fi
%    \endgroup}
%  \end{verbatim}
%    \begin{macrocode}
  \long\def\ST@caption#1[#2]#3{\par%
    \caption@letfloattype{supertabular}{}%
    \let\caption@fixposition\caption@setSTposition
    \caption@beginex{#1}{#2}{#3}%
      \addcontentsline{\csname ext@#1\endcsname}{#1}%
                      {\protect\numberline{%
                          \csname the#1\endcsname}{\ignorespaces #2}}%
      \@parboxrestore
      \normalsize
      \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \caption@end}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \clearpage
% \Finale
%
\endinput