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
|
% \iffalse meta-comment
%
% combine.dtx
% Author: Peter Wilson, Herries Press
% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
% Copyright 2000, 2001, 2002, 2003, 2004 Peter R. Wilson
% Copyright 2010 Will Robertson
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version: <http://www.latex-project.org/lppl.txt>
%
% This work has the LPPL maintenance status "maintained".
% The Current Maintainer of this work is Will Robertson.
%
% This work consists of the files listed in the README file.
%
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{combine.dtx}
%</driver>
%<usc>\ProvidesClass{combine}
%<pck>\ProvidesPackage{combinet}
%<natpack>\ProvidesPackage{combnat}
%<citepack>\ProvidesPackage{combcite}
%<*usc|pck|natpack|citepack>
[2010/07/10 v0.7a
%</usc|pck|natpack|citepack>
%<usc> collection of documents
%<pck> document titles in ToC
%<natpack> combine version of natbib package
%<citepack> combine version of cite package
%<*usc|pck|natpack|citepack>
]
%</usc|pck|natpack|citepack>
%
%<*driver>
\documentclass[twoside]{ltxdoc}
\makeatletter \@mparswitchfalse \makeatother
\EnableCrossrefs
\CodelineIndex
%%\OnlyDescription
\renewcommand{\MakeUppercase}[1]{#1}
\pagestyle{headings}
\setcounter{StandardModuleDepth}{1}
\begin{document}
\DocInput{combine.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{3858}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
% \DoNotIndex{\@input,\@ixpt,\@m}
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
% \DoNotIndex{\advance,\Alph,\alph}
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\bullet}
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
% \DoNotIndex{\fbox}
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
% \DoNotIndex{\input}
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
% \DoNotIndex{\NeedsTeXFormat,\newdimen}
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
% \DoNotIndex{\wd,\xiipt,\year,\z@}
%
% \changes{v0.1}{2000/04/29}{First public release as `collection' class}
% \changes{v0.2}{2000/05/07}{First public release with class changed to `combine'}
% \changes{v0.3}{2000/05/20}{Fix newtheorem and letter class}
% \changes{v0.3}{2000/05/20}{Add title formatting}
% \changes{v0.4}{2000/05/27}{Reset counters, ToC formatting}
% \changes{v0.41}{2000/06/18}{Added and used \cs{appendiargdef}}
% \changes{v0.42}{2001/04/04}{Fixed(?) problem with fancyhdr package}
% \changes{v0.5}{2001/07/03}{Added the combnat package}
% \changes{v0.51}{2001/07/09}{Fixed problem with \cs{appendix} in imports}
% \changes{v0.51}{2001/07/09}{Fixed problem with ordering of
% \cs{coltocauthor} and \cs{coltoctitle}}
% \changes{v0.52}{2001/08/25}{Fixed problem with `wrapped class' imports}
% \changes{v0.53}{2001/09/05}{Fixed problem with spaces in ToC entries}
% \changes{v0.54}{2001/12/19}{Added text about exam class}
% \changes{v0.6}{2002/08/24}{Added option for single bibliography}
% \changes{v0.61}{2003/05/22}{Minimal tweak to combnat}
% \changes{v0.62}{2003/07/19}{Minimal addition to combine}
% \changes{v0.63}{2003/11/09}{Memoir option added to combine}
% \changes{v0.63}{2003/11/09}{Added the combcite package}
% \changes{v0.64}{2004/03/06}{Minor change to combinet package}
% \changes{v0.64a}{2004/05/07}{Minor change to the abstract}
% \changes{v0.64b}{2009/09/02}{New maintainer (Will Robertson)}
% \changes{v0.7}{2010/03/22}{Bug fix and new (simpler) file versioning scheme}
%
% \GetFileInfo{combine.dtx}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
%
% \title{The \Lpack{combine} class and the packages\\ \Lpack{combinet},
% \Lpack{combnat} and \Lpack{combcite}\thanks{This file (\texttt{combine.dtx})
% has version number \fileversion, last revised \filedate.}}
%
% \author{%
% Peter Wilson, Herries Press^^A
% \thanks{Dick Nickalls (\texttt{dicknickalls@compuserve.com})
% provided several requirements and suggestions.
% He also very helpfully tested earlier experimental versions.}\\
% \\~
% Maintainer: Will Robertson\\
% \texttt{will dot robertson at latex-project dot org}%
% }
% \date{\filedate}
% \maketitle
% \begin{abstract}
% The \Lpack{combine} class can be used to assemble a group
% of individual \LaTeX{} documents into a single document,
% such as required for a conference proceedings. Typically the documents
% are all of the same class, but with some limitations on ordering
% may be of different classes (e.g., several \Lpack{article}s with
% one \Lpack{letter}).
% The class requires the \Lpack{keyval} package.
%
% The accompanying \Lpack{combinet} and \Lpack{combnat} packages
% respectively let
% the titles of imported documents be added to the main ToC, and
% enable the \Lpack{combine} class and the \Lpack{natbib} package
% to cooperate. The \Lpack{combcite} package enables the \Lpack{cite}
% package to cooperate.
% \end{abstract}
% \tableofcontents
%
%
%
% \section{Introduction}
%
% Questions about making a collection of different articles into a single
% document
% seem to pop up fairly regularly on the
% \texttt{comp.text.tex} newsgroup.
% The \Lpack{combine} class provides a solution for this problem.
%
% This manual is typeset according to the conventions of the
% \LaTeX{} \textsc{docstrip} utility which enables the automatic
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
%
% Section~\ref{sec:usc} describes the usage of the \Lpack{combine} class and
% Sections~\ref{pack} and~\ref{natpack} describe the \Lpack{combinet}
% and \Lpack{combnat} packages. Section~\ref{citepack} describes
% the \Lpack{combcite} package.
% Commented source code for the class is in Section~\ref{sec:code}.
% The class requires the \Lpack{keyval} package to be available.
% Commented source code for the \Lpack{combinet} package is in
% Section~\ref{packcode}, for \Lpack{combnat} is in
% Section~\ref{natpackcode} and for \Lpack{combcite} is in
% Section~\ref{citepackcode}.
%
% Note that the version number and date given for this file does not
% necessarily match version numbers or dates for the class and packages.
%
% \section{The \Lpack{combine} class} \label{sec:usc}
%
% The \Lpack{combine} class enables a group of individual
% \LaTeX{} documents to be imported and assembled into a single document. All
% the individual documents should be of the same class (e.g., all
% \Lpack{article} or all \Lpack{report}).
%
% Sectioning, cross-referencing, bibliographies, etc., are local within
% each imported document. Various means are provided for controlling local
% Table of Contents, the format of |\maketitle|, and so on, without having
% to make any changes to the original of an imported document.
%
% Here is a simple example file which might be the skeleton for a
% conference proceedings.
% \begin{verbatim}
% \documentclass[11pt]{combine}
%
% \title{Proceedings of the ...}
% \author{A. N. Editor\thanks{Support ...}}
% \date{29 February, 2000}
%
% \begin{document}
% \pagestyle{combine} % use the combine page style
% \maketitle % main title
% \tableofcontents % main ToC
% \clearpage
%
% \section{Editor's introduction} \label{intro} % into main ToC (section 1)
%
% In the article by A.~N.~Author on page~\pageref{art1} ...
%
% \begin{papers} % start of individual articles/papers
% \coltoctitle{An article} % first article title into main ToC
% \coltocauthor{A.~N.~Author} % first authors into main ToC
% \label{art1}
% \import{art1} % first article, may have own ToC,
% % bibliography, etc.
% \coltoctitle{Another article}
% \coltocauthor{A.~N.~Other}
% \label{art2}
% \import{art2}
% \end{papers} % end of individual articles/papers
%
% \clearpage
% \section{Acknowledgements} % into main ToC (section 2)
%
% Among the many ...
%
% \end{document}
% \end{verbatim}
%
% \subsection{Class options}
%
% As well as providing all the class options appropriate for
% the class of the individual documents, the \Lpack{combine}
% class provides the following additional options:
% \begin{itemize}
% \item \Lopt{memoir}, \Lopt{book}, \Lopt{report}, and \Lopt{letter}.
% By default the \Lpack{article}
% class is assumed for both the main and the imported documents.
% These options change the class to \Lpack{memoir}, \Lpack{book}, \Lpack{report} or
% \Lpack{letter}, respectively.
% \item \Lopt{colclass=\meta{class}}. This option changes
% the `classes' to \meta{class}. For example, specifying
% |colclass=phdthesis| will use the \Lpack{phdthesis}
% class\footnote{Whatever that is.} definitions
% throughout the entire document.
%
% Note that if you use this option there are likely to be \LaTeX{}
% warnings about \texttt{Unused global option(s): [colclass=\ldots]}.
%
% \item \Lopt{classes}. This option enables the imported documents
% to be of different classes. For example, embedding a letter
% into a compendium of articles. Using this option may
% induce a plethora of \LaTeX{} errors and the printed results
% may be unpredictable. If this happens, try hitting `q' to
% put \LaTeX{} into
% its `quiet batch' processing mode and then examine the typeset result
% for usability.
%
% Different classes of imported documents should not be mixed
% within a single |papers| environment. Also, imported documents
% whose class is the same but which differs from the main class
% should be within a single |papers| environment. For example,
% if several letters are to be imported into a collection
% of articles, the letters must not be scattered between different
% |papers| environments, although the imported articles can be
% scattered.
%
% \item \Lopt{packages}. By default all |\usepackage| commands in
% imported documents are ignored. If this is not desired,
% then the \Lopt{packages} option will enable the imported
% |\usepackage| commands(s). If this option is used, then only
% the first occurrence of a package is actually used and is not
% available to any later imported documents.
%
% Generally speaking, it is advisable to put all |\usepackage|
% commands into the preamble of the main document.
%
% \item \Lopt{layouts}. By default, a single setting of the
% page layout is used throughout the document. The \Lopt{layouts}
% option takes account of any changes to the |\textwidth|,
% |\textheight|, etc., in the imported documents.
%
% \item \Lopt{folios}. The page numbers are sequential throughout
% the document. When the |plain| page style is used, the
% \Lopt{folios} option will display the
% local page numbers of imported documents as well as the
% the main page number. This may have unfortunate consequences
% on the page numbers in ToC, etc., entries as they may well
% refer to local rather than global page numbers.
%
% \item \Lopt{notoc}. Disables the inclusion of a Table of Contents
% in any imported document.
% \item \Lopt{nolof}. Disables the inclusion of a List of Figures
% in any imported document.
% \item \Lopt{nolot}. Disables the inclusion of a List of Tables
% in any imported document.
% \item \Lopt{maintoc}. Adds all imported documents ToC, LoF, LoT, etc.,
% entries to the main document ToC, LoF, \ldots
% \item \Lopt{notitle}. Disables title printing by any |\maketitle|
% in any imported document.
% \item \Lopt{noauthor}. Disables author printing by any |\maketitle|
% in any imported document.
% \item \Lopt{date}. By default, date printing by any |\maketitle|
% in any imported document is disabled. This option causes
% the date(s) to be printed.
% \item \Lopt{nomaketitle}. Disables all printing by any |\maketitle|
% in any imported document.
% \item \Lopt{nopubindoc}. Disables the printing of the |\published|
% information within an imported document.
% \item \Lopt{nopubintoc}. Disables the printing of the |\published|
% information within the main ToC.
% \item \Lopt{onebib}. Disables imported bibliographies and puts all
% citations in the main document's bibliography.
% \item \Lopt{combinedbib}. Individual imported bibliographies and
% also all citations put into the main document's bibliography.
% \end{itemize}
%
% The \Lpack{combine}
% class may be able to incorporate any class of imported documents by
% setting an appropriate value for the \Lopt{colclass} option and perhaps
% doing some additional work.
%
% For example, if you want to have a collection of examination papers
% which were each is originally produced using the \Lpack{exam} class,
% then start off with: \\
% |\documentclass[...,colclass=exam]{combine} | \\
% The \Lpack{exam} class, though, does a couple of things that prevent
% \Lpack{combine} and \Lpack{exam} from working well together:
% \begin{itemize}
% \item \Lpack{exam} has its own version of |\section| which is totally at
% odds with the normal \Lpack{article} definition, and |\section*| is
% used by the |\tableofcontents| command.
% \item \Lpack{exam} does wonderful things at the end of a document. This
% is alright for imported documents in a |papers| environment but is an
% abject failure at the final end of the main document.
% \end{itemize}
%
% To get round these problems, put the following in the preamble to
% the main document:
% \begin{verbatim}
% \makeatletter
% \let\oldsection\section % keep exam's definition of \section
% \renewcommand{\section}{% % article's definition of \section
% \@startsection{section}{1]{\z@}%
% {-3.5ex \@plus -1ex \@minus -.2ex}%
% {2.3ex \@plus .2ex}%
% {\normalfont\Large\bfseries}}
% \makeatletter
% \end{verbatim}
% and in the document put: \\
% |\let\section\oldsection| \\
% immediately before the first |papers| environment.
%
% For the end document problem, put:
% \begin{verbatim}
% \makeatletter
% \let\@enddocumenthook\@oldenddocumenthook
% \makeatother
% \end{verbatim}
% immediately before the main document's |\end{document}|.
%
%
% \subsection{Class commands and environments}
%
% Within a \Lpack{combine} class document you can use any commands
% that are supported by the selected class.
% The following additional commands and environments are also
% provided.
%
% \DescribeEnv{papers}
% The environment |\begin{papers}[|\meta{text/code}|]...\end{papers}|
% provides a wrapper around imported file(s). Effectively, it modifies
% any |\documentclass| command or |document| environment within an
% imported file so that \LaTeX{} does not stop with an error at meeting
% these, or preamble-only commands like |\usepackage|, in the middle
% of a document.
%
% The optional argument is executed immediately at the start of
% the environment and its default value is |\cleardoublepage|.
% To avoid any forced page breaking you can call the environment with
% an empty optional argument (e.g., |\begin{papers}[]|).
%
%
% \DescribeMacro{\import}
% The command |\import{|\meta{texfile}|}| is a cross between the |\input|
% and |\include| commands, and should only be used within a |papers|
% environment. \meta{texfile} is the name of a \LaTeX{} file \emph{without}
% the |.tex| extension. For example, |\import{fred}| will attempt to
% read in a file called |fred.tex|. The \meta{texfile} should be a
% complete \LaTeX{} document file, from |\documentclass...| to
% |\end{document}|. The contents of \meta{texfile} will be typeset in
% the document at the point where it is imported, including any document
% title (via a |\maketitle|), Table of Contents, \ldots, Bibliography, etc.
%
% \DescribeMacro{\maketitle}
% The \Lpack{combine} class provides a |\maketitle| command, together with
% |\title|, |\author| and |\date| commands like those in the
% \Lpack{book/report/article} classes. A \Lopt{titlepage} option is only
% supported if the main class has a \Lopt{titlepage} option. For example,
% if the main class is \Lpack{article} then both |\maketitle| and the
% \Lopt{titlepage} option are supported, but if the main class is
% \Lpack{letter} then only the |\maketitle| command is provided.
%
% \DescribeMacro{\maintitlefont}
% \DescribeMacro{\postmaintitle}
% \DescribeMacro{\mainauthorfont}
% \DescribeMacro{\postmainauthor}
% \DescribeMacro{\maindatefont}
% \DescribeMacro{\postmaindate}
% These commands control the typesetting of the main document's |\maketitle|
% command. The |\title| is processed between the |\maintitlefont| and
% |\postmaintitle| commands; that is, like: \\
% |{\maintitlefont \title \postmaintitle}| \\
% and similarly for the |\author| and |\date| commands. The |\...main...|
% commands are initialised to mimic the normal result of |\maketitle|
% typesetting in the \Lpack{article/report} classes.
% For example, the default definitions of the |\...maintitle...|
% and |\...mainauthor...| commands are:\par
% \begin{small}
% \begin{verbatim}
% \newcommand{\maintitlefont}{\begin{center}\LARGE}
% \newcommand{\postmaintitle}{\par\end{center}\vskip 0.5em}
% \newcommand{\mainauthorfont}{\begin{center}
% \large \lineskip 0.5em%
% \begin{tabular}[t]{c}}
% \newcommand{\postmainauthor}{\end{tabular}\par\end{center}}
% \end{verbatim}
% \end{small}\par
% They can be renewed to obtain different effects, for instance removing
% the |center| environment from |\...title...| will result in the title
% being typeset as a normal paragraph.
%
% \DescribeMacro{\importtitlefont}
% \DescribeMacro{\postimporttitle}
% \DescribeMacro{\importauthorfont}
% \DescribeMacro{\postimportauthor}
% \DescribeMacro{\importdatefont}
% \DescribeMacro{\postimportdate}
% Without any options, the |\title| and |\author| commands
% are typeset by |\maketitle| commands in imported documents.
% Like the main document's |\maketitle|, the typesetting is controlled
% by these |\...import...| commands. The default definition for
% the title and author differ a little from the main document style,
% and are:\par
% \begin{small}
% \begin{verbatim}
% \newcommand{\importtitlefont}{\begin{center}\LARGE\bfseries}
% \newcommand{\postimporttitle}{\par\end{center}}
% \newcommand{\importauthorfont}{\begin{center}
% \large\itshape \lineskip 0.5em%
% \begin{tabular}[t]{c}}
% \newcommand{\postimportauthor}{\end{tabular}\par\end{center}}
% \end{verbatim}
% \end{small}\par
% The commands can be renewed to obtain different formatting.
%
% Note that if the \Lpack{titling} package is used with the \Lpack{combine}
% class, the \Lpack{titling} maketitle typesetting commands are unavailable,
% being replaced by the corresponding \Lpack{combine} commands above. Other
% aspects of \Lpack{titling}, like the |\thetitle| command, are still
% available for use.
%
% \DescribeMacro{\bodytitle}
% The |\bodytitle[|\meta{short title}|]{|\meta{long title}|}| command
% is similar
% to a |\chapter| or |\section| command, depending on the \meta{class}
% of document. It may be used for adding a numbered title heading into
% the main
% document and ToC for the following |\import{|\meta{texfile}|}|. There
% is also a starred version of the command, which produces an unnumbered
% title heading and makes no entry in the ToC. The numbering used for
% |\bodytitle| is independent from any other numbering sequence.
%
% \DescribeMacro{\coltoctitle}
% \DescribeMacro{\coltocauthor}
% The two commands |\coltoctitle{|\meta{title}|}| and
% |\coltocauthor{|\meta{author}|}| are for adding \meta{title} and
% \meta{author} to the main ToC, where \meta{title} is the compiler's
% choice for the title of the following |\import{|\meta{texfile}|}|
% and \meta{author} is for the names of the authors.
%
% \DescribeMacro{\published}
% The command |\published[|\meta{short}|]{|\meta{long}|}| can be used
% for putting the \meta{long} text into the body of the main document.
% If the optional argument is not used, then \meta{long} is also added
% to the main ToC. If the optional argument is used, then \meta{short}
% instead of \meta{long} is added to the ToC. The expectation is that this
% will be used for noting the original publication information for an
% imported document.
%
% \DescribeMacro{\pubfont}
% In the document body the text of the |\published| command is typeset
% using |\pubfont|. By default this is defined as |{\normalfont\centering}| to
% give centered text in the normal font. If, for example, you wanted
% it to be typeset ragged right in an italic font you would do: \\
% |\renewcommand{\pubfont}{\itshape\raggedright}|
%
% \DescribeMacro{\toctitleindent}
% \DescribeMacro{\tocauthorindent}
% \DescribeMacro{\tocpubindent}
% \DescribeMacro{\toctocindent}
% These are all lengths, and their values can be changed using
% |\setlength|. They control the extra indentation of an imported
% document's title, authors, publication information and section
% headings within the main ToC. The default value of |\toctitleindent|
% is 0em and the default for the other four is 1.5em. If any values
% are changed, this must be
% done before the |\tableofcontents| command in the main document.
% For example, the title texts are aligned at the left margin;
% to align them with the default position of authors do: \\
% |\setlength{\toctitleindent}{1.5em}|
%
% \DescribeMacro{\toctitlefont}
% \DescribeMacro{\tocauthorfont}
% \DescribeMacro{\tocpubfont}
% These macros specify the fonts to be used for typesetting the
% imported titles, authors and publishing information within the main ToC.
% Their default definitions are: \\
% |\newcommand{\toctitlefont}{\bfseries}| % bold titles \\
% |\newcommand{\tocauthorfont}{\itshape}| % italic authors \\
% |\newcommand{\tocpubfont}{\normalfont}| % normal font for published
%
% The class tries to keep any group of title/author/published entries
% in the ToC on one page, but sometimes TeX will insert a pagebreak anyway.
% The way of combating this is to make sure that the ToC page is broken
% \emph{before} the group. You can do this like: \\
% |\addtocontents{toc}{\protect\pagebreak}| \\
% |\coltoctitle{...} \coltocauthor{...}| etc.
%
% \DescribeMacro{\erasetitling}
% This macro `undefines' any previous |\coltoctitle|, |\coltocauthor|
% and/or |\published| commands; it is principally provided for use with the
% \Lpack{combinet} package.
%
%
% \DescribeMacro{combine}
% A new |combine| pagestyle is provided. This is like the |plain|
% pagestyle except that page numbers are put at the bottom outside corner
% of the page. This is the default pagestyle for the \Lpack{combine}
% class.
%
% Provided a |plain| (or |combine|) page style is used the pages
% are numbered in sequence throughout the document. If an imported document
% has any |empty| page style pages these will not be numbered.
%
% Unless the \Lopt{folios} option is used, all references to page
% numbers will be to the global page number. With the \Lopt{folios}
% options some references will be to global page numbers and some to
% local page numbers.
%
% You can, of course, define your own heading styles; I recommend
% the \Lpack{fancyhdr} package~\cite{FANCYHDR} if you do this. For example,
% if you had a collection of papers and you wanted to have the
% headers on the lefthand pages to have the title of the collection
% and the righthand pages to have the name of the current author(s), you
% can do this along the following lines.
% \begin{verbatim}
% \documentclass[report,twoside]{combine}
% \usepackage{fancyhdr}
% \title{The collection}
% \author{A. N. Editor}
% \pagestyle{fancy}
% \fancyhead[RO]{A. N. Editor}
% \fancyhead[LE]{The collection}
% \fancyfoot{}
% \fancyfoot[LE,RO]{\thepage}
% \newcommand{\authortochead}[1]{%
% \coltocauthor{#1}
% \fancyhead[RO]{#1}
% }
% ...
% \begin{document}
% \maketitle
% %% Editors introduction, ToC, etc
% \begin{papers}
% \coltoctitle{Paper 1}
% \authortochead{A. N. Author}
% \import{paper1}
% \cleardoublepage
% \coltoctitle{Paper 2}
% \authortochead{A. N. Other}
% \import{paper2}
% ...
% \end{verbatim}
%
%
% In order to ensure that all the material in an imported document
% is typeset, there is an inbuilt |\clearpage| command within the
% imported document's |\end{document}|. Thus, any material after an
% |\import| command will start on a new page.
%
% Here is another example file which might be the skeleton for a
% thesis that includes a copy of a published paper.
% \begin{verbatim}
% %%\documentclass{thesis} % replace this by
% \documentclass[colclass=thesis,classes,layouts]{combine}
% ... packages etc.,
%
% \title{Observations on the ...}
% \author{A. Candidate}
% \date{1 April, 2000}
% \addtolength{\toctitleindent}{2.3em} % extra main ToC indentation
% \addtolength{\tocauthorindent}{2.3em}
% \addtolength{\tocpubindent}{2.3em}
%
% \begin{document}
% \pagestyle{combine} % use the combine page style
% \maketitle % main title
% \tableofcontents % main ToC
% \clearpage
% ...
% lots of remarkable research results
% ...
% \appendix
% ...
% \section{Publication}
% \begin{papers}[]
% \coltoctitle{...}
% \published{Originally published in the
% \textit{Journal of Irreproducible Results}, 1987}
% \import{mypaper}
% \end{papers}
% ...
%
% \bibliography{refs} % main bibliography
% \end{document}
% \end{verbatim}
%
% Each imported file generates its own \file{.aux}, \file{.toc}, etc.,
% files. If a BibTeX database is used for the literature references
% in an imported document, then BibTeX must be run against the imported
% document, \emph{not} the main document, to resolve the citations.
% Citations are local to each imported document. There can, of course,
% also be a bibliography for citations made in the main document, as shown
% in the example file above.
%
% \DescribeMacro{\provideenvironment}
% This macro is like the |\providecommand| macro except that it applies
% to an environment instead of a command. It is required internally
% by the \Lpack{combine} class.
%
% \DescribeMacro{\providelength}
% \DescribeMacro{\providecounter}
% These macros are used internally. They are |\provide...|
% versions of the |\newlength| and |\newcounter| commands.
%
% \DescribeMacro{\zeroextracounters}
% The class attempts to initialise the counters used by each imported
% document. For example, the figure, equation, etc., counters are zeroed
% for each document. The |\zeroextracounters| command can be redefined so
% that it includes the zeroing of any additional counters that might have
% been introduced in a package or defined by the author. For example,
% if two different imports both define a (new) counter called, say,
% |mycounter|, then redefine the command like:
% \begin{verbatim}
% \renewcommand{\zeroextracounters}{%
% \@ifundefined{c@mycounter}{}{\setcounter{mycounter}{0}}
% }
% \end{verbatim}
%
% \DescribeMacro{\appendiargdef}
% The (internal) command |\appendiargdef{|\meta{macro}|}{|\meta{stuff}|}|
% appends \meta{stuff} at the end of the current definition of \meta{macro},
% where \meta{macro} is the name of a macro (including the backslash)
% which takes one argument. For example the following are two equivalent
% definitions of |\mymacro|:
% \par\begin{small}\begin{verbatim}
% \newcommand{\mymacro}[1]{#1 is a bagpiper}
% \appendiargdef{\mymacro}{ and of course is tone deaf}
% % or
% \newcommand{\mymacro}[1]{#1 is a bagpiper and of course is tone deaf}
% \end{verbatim}
% \end{small}\par
%
% \DescribeMacro{\emptyAtBeginDocument}
% Some combinations of circumstances cause an infinite recursion at the
% start of an imported document; in particular the combination of
% \texttt{combine + graphicx + caption2 + pdflatex} causes this. In this case
% the solution was to put |\emptyAtBeginDocument| immediately after the
% initial |\begin{document}|. It may also have worked if it had been added
% after each |\begin{papers}| or before each |\import{}|. An error message
% about being out of stack space may indicate recursion. Judicious use
% of |\emptyAtBeginDocument| may resolve the problem.
%
% \subsection{Imports in subdirectories}
%
% Authors may find it convenient to put the LaTeX source files for imported
% documents into subdirectories of the directory for the main document.
% Perhaps the easiest way to make this work is to set an environment
% variable so that LaTeX will look in the subdirectories of the current
% working directory for files it can't find.
%
% I use a teTeX system and can only talk about that distribution.
% The relevant environment variable, at least for document files, is
% |TEXINPUTS|. An example setting for this is: \\
% |TEXINPUTS=.//:${LOCALTEX}//:| \\
% The fragment |.//| tells LaTeX to look for files in the current directory,
% and recursively in its subdirectories. The fragment |:${LOCALTEX}//| tells
% LaTeX to look for files in the place defined by the environment variable
% |LOCALTEX|, and recursively in its subdirectories. The final |:| tells
% LaTeX to look in the standard teTeX defined places.
%
% \section{The \Lpack{combinet} package} \label{pack}
%
% The \Lpack{combinet} (COMBINE Title) package,
% which should only be used in conjunction
% with the \Lpack{combine} class, modifies the |\maketitle| command of
% all imported documents so that the imported document's title and/or
% author, if
% defined, are automatically added to the main document's ToC.
%
% This is presented as a package rather than as part of the
% \Lpack{combine} class as some unfortunate side effects may become
% apparent.
%
% If a |\coltoctitle| or |\coltocauthor| command has been given
% immediately prior to the import, then these will be put into the main
% ToC instead of the |\maketitle| texts. The |\erasetitling| command can
% be used to disable any prior |\coltoctitle|, |\coltocauthor| and
% |\published| commands.
%
% The package takes the following options.
% \begin{itemize}
% \item \Lopt{nomtitle}. Disable the |\maketitle| title
% from being added to the main ToC.
% \item \Lopt{nomauthor}. Disable the |\maketitle| author
% from being added to the main ToC.
% \item \Lopt{nothanks}. By default, the contents of a |\thanks| command
% will be added to the main ToC. This option prevents that, but
% may have unfortunate side effects if any |\title| or |\author|
% command has any embedded commands within the text.
% \item \Lopt{pub}. Put the text of an immediately prior |\published|
% command after the |\maketitle| typesetting, and add the text to the
% main ToC after any title or author. Remember that the \Lpack{combine}
% class options \Lopt{nopubindoc} and \Lopt{nopubindoc} can be used
% to inhibit printing of |\published| information.
% \item \Lopt{pubtop}. Put the text of an immediately prior |\published|
% command at the top of the |\maketitle| typesetting, and add the
% text to the
% main ToC after any title or author.
% \end{itemize}
%
% As noted above, embedded commands within a |\title| or |\author| may
% not transform well if they appear in the main ToC. In such cases you can
% use |\coltoctitle| or |\coltocauthor| for adding appropriate text to
% the main ToC, not forgetting to disable these after the import via
% |\erasetitling|.
%
% \section{The \Lpack{combnat} package} \label{natpack}
%
% The \Lpack{combine} class and Patrick Daly's \Lpack{natbib}
% package~\cite{NATBIB}
% both redefine some of the same basic LaTeX macros, and naturally
% the redefinitions are incompatible\footnote{Discovered by
% Thomas Hertweck (\texttt{Thomas.Hertweck@gpi.uni-karlsruhe.de}) in
% June 2001.}.
%
% The \Lpack{combnat} (COMBine NATbib) package hopefully resolves this
% problem. With the \Lpack{combine} class you use \Lpack{combnat} instead
% of \Lpack{natbib}. That is, instead of: \\
% |\usepackage[|\meta{natbib-options}|]{natbib}|, simply do \\
% |\usepackage[|\meta{natbib-options}|]{combnat}| \\
% in the preamble of the main document. The package automatically calls
% the \Lpack{natbib} package with the given \meta{natbib-options} and
% then redefines some of the \Lpack{natbib} redefinitions to ensure
% \Lpack{combine/natbib} compatibility.
%
% For details on the \meta{natbib-options} and the other facilities,
% read the \Lpack{natbib} documentation~\cite{NATBIB}.
%
% \section{The \Lpack{combcite} package} \label{citepack}
%
% The \Lpack{combine} class and Donald Aresneau's \Lpack{cite}
% package~\cite{CITE}
% both redefine some of the same basic LaTeX macros, and naturally
% the redefinitions are incompatible\footnote{Discovered by
% Marcilio Alves (\texttt{maralves@usp.br}) in
% November 2003.}
%
% The \Lpack{combcite} (COMBine CITE) package hopefully resolves this
% problem. With the \Lpack{combine} class you use \Lpack{combcite} instead
% of \Lpack{cite}. That is, instead of: \\
% |\usepackage[|\meta{cite-options}|]{cite}|, simply do \\
% |\usepackage[|\meta{cite-options}|]{combcite}| \\
% in the preamble of the main document. The package automatically calls
% the \Lpack{cite} package with the given \meta{cite-options} and
% then redefines some of the \Lpack{cite} redefinitions to ensure
% \Lpack{combine/cite} compatibility.
%
% For details on the \meta{cite-options} and the other facilities,
% read the \Lpack{cite} documentation~\cite{CITE}.
%
% The \Lpack{combcite} package requires the November 2003 version 4.01
% of \Lpack{cite}. This version covers the functions provided by the
% \Lpack{overcite} package. More precisely \\
% \verb?\usepackage[...]{overcite}? is implemented as \\
% \verb?\usepackage[superscript,...]{cite}?
%
%
% \section{Caveats}
%
% \LaTeX{} was designed to typeset a single document, where the document
% has one and only one |\documentclass| command and one and only one
% |document| environment. The \Lpack{combine} class attempts to handle
% a document that has multiple |\documentclass| commands and multiple
% |document| environments. In order to do this certain parts of the
% \LaTeX{} kernel code has had to be modified. Unfortunately, to make
% the usage of \Lpack{combine} completely transparent to the user would
% require very major surgery, with a high probability that with my skills
% the patient would die; being able to remove a hangnail does not imply
% the ability to perform a heart transplant.
%
% It is, of course, assumed that each imported document processes without
% error as an individual document.
%
% Essentially, be prepared for the unexpected, usually indicated
% by a rash of \LaTeX{} error messages about undefined commands or about
% defining an already defined command. These are usually caused by incorrect
% grouping.
%
% Commands, etc., defined in the main document are available to
% all imported
% documents. The |papers| environment forms a group. Commands
% defined within a group are local to the group and are not visible outside
% it. Another point is that \LaTeX{} will read the code for any given
% class or package only once. These facts have some consequences.
%
% \begin{itemize}
% \item The facilities provided by any package that is used by an imported
% file are only available within the first |papers| environment
% in which the package is called for. This is why it is recommended
% that all packages should be called for in the main document.
%
% \item Similarly for a class that is not the main class. For example,
% if the main class is \Lpack{article} and some letters are to be
% imported, then they must all be in the same |papers| environment.
% If they are in multiple |papers| environments, then only the first
% of these will have access to commands like |\address| which are
% defined by the \Lpack{letter} class (which is only read once and
% whose facilities are then local to the first of the |papers|).
%
% \item An imported document does not form a group (if it did, then only
% a single letter could be imported into an article class collection).
% If two imports in a single |papers| seperately use |\new...|
% commands
% with the same \meta{name}, then these \meta{name}s will be
% visible throughout
% the environment. \LaTeX{} will then normally report trying to define a
% pre-existing \meta{name}. The solution to this is either: (a) put
% the imports into different |papers|, or (b) enclose each import
% within a |\begingroup| \ldots |\endgroup| pair.
%
% \end{itemize}
%
% Not all problems can be solved by the above methods. For example, consider
% the case again of importing letters into an article collection. If two
% letters both define the same \meta{name}, then adding additional grouping
% will only change the `defining a pre-existing \meta{name}' problem into
% the `undefined |\address|' problem. A potential solution in this
% particular case
% would be to define all the \Lpack{letter} class specific \meta{name}s in the
% main document.
%
% Within a |papers| environment all |\newcommand| and |\newenvironment|
% commands are replaced by |\providecommand| and |\provideenvironment|
% respectively. This should stop \LaTeX{} from reporting the pre-existing
% \meta{name} error from these commands, but one and only one of the
% definitions will be available. |\newlength| and |\newcounter| commands
% are handled in the same manner. There is no equivalent for |\newtheorem|,
% but instead the |\newtheorem| command has been made local instead
% of global, so cunning use of grouping should be able to circumvent the
% problem of two seperate authors creating identically named
% theorems.
%
%
%
% \StopEventually{
% \bibliographystyle{alpha}
% \begin{thebibliography}{GMS94}
%
% \bibitem[Ars03]{CITE}
% Donald Arseneau.
% \newblock \emph{Cite: Compressed, sorted lists of on-line
% or superscript numerical citations}.
% \newblock November 2003.
% \newblock (Available from CTAN in directory
% \texttt{macros/latex/contrib/cite})
%
% \bibitem[Dal99]{NATBIB}
% Patrick W. Daly.
% \newblock \emph{Natural Sciences Citations and References}.
% \newblock May 1999.
% \newblock (Available from CTAN in directory
% \texttt{macros/latex/contrib/natbib})
%
% \bibitem[GMS94]{GOOSSENS94}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
% \newblock \emph{The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
% \bibitem[Oos96]{FANCYHDR}
% Piet van Oostrum.
% \newblock \emph{Page layout in LaTeX}.
% \newblock June 1996.
% \newblock (Available from CTAN in directory
% \texttt{macros/latex/contrib/fancyhdr})
%
%
% \end{thebibliography}
% }
%
%
% \section{The \Lpack{combine} class code} \label{sec:code}
%
% There are various difficulties to be overcome by the
% \Lpack{combine} code, some seemingly inherent in \TeX{} itself and
% others by the \LaTeX{} kernel code. These include, but are not limited to:
% \begin{itemize}
% \item TeX{} was not designed for processing multiple documents.
% \item There can only be one |\documentclass| command within
% a document.
% \item There are many \LaTeX{} commands that can only be used in
% the preamble, and the preamble is closed by the (first) |\begin{document}|.
% \item There is a single global page number, which may be reset to one
% at any point in any document. If this occurs in an imported document
% then the page numbering for the main document is similarly reset.
% \item |\label|s are global in nature, and with multiple imported
% documents there are likely to be labels with the same name in two
% or more of these.
% \item Many of the kernel (and standard classes) commands use
% the page number; sometimes the use is buried at the end of a chain
% of macros.
% \end{itemize}
%
% A design goal for \Lpack{combine} is that virtually any kind
% of document should be importable and should be processible without
% have to make any changes to it. To completely satisfy this would
% require a rewrite of much of the \LaTeX{} kernel, which is out
% of the question. Of necessity some changes have had to be made but
% these have been limited as far as possible. I think that a collection
% that consists of documents that are all of the same class should
% process without interruption.
%
% When there are mixed classes, \LaTeX{}
% reads in the code for each class. An example is importing a \Lpack{letter}
% class document into an \Lpack{article} class collection.
% If the same command is defined
% by |\newcommand| in two or more of these classes, then \LaTeX{}
% complains and I see no way of getting around this without rewriting
% all the classes and kernel to use |\def| instead of |\newcommand|.
% In any event, if this happens, try responding to the errors by hitting
% `q' to put \LaTeX{} into a batch mode. The typeset result may be useable.
%
% To try and avoid name clashes, all the internal commands include
% the string |c@l|.
%
% \section{Preliminaries}
%
% Announce the name and version of the class, which requires
% \LaTeXe{} and the \Lpack{keyval} package.
% (This now happens at the top of DTX file so doesn't appear here.)
% \changes{v0.53}{2001/09/05}{Class is now v0.45}
% \changes{v0.6}{2002/08/24}{Class is now v0.5}
% \changes{v0.63}{2003/11/09}{Class is now v0.52}
% \begin{macrocode}
%<*usc>
\RequirePackage{keyval}
% \end{macrocode}
%
% \begin{macro}{\c@lclass}
% |\c@lclass| stores the class name, which by default is |article|.
% \begin{macrocode}
\newcommand{\c@lclass}{article}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@l@tempa}
% \begin{macro}{\c@l@getoptionname}
% The next code chunk is based on code posted to the \texttt{ctt} newsgroup
% by Heiko Oberdiek (\texttt{oberdiek@ruf.uni-freiburg.de}) on 18~April 2000.
% The code, by some miraculous means, sets up a keyed class option.
% \begin{macrocode}
\define@key{COLCLASS}{colclass}[article]%
{\renewcommand{\c@lclass}{#1}
\ClassWarningNoLine{combine}
{Expect warnings like:\MessageBreak
\space\space LaTeX Warning: Unused global option(s):\MessageBreak
\space\space\space\space [colclass=#1]}}
\let\c@l@tempa\@empty
\def\c@l@getoptionname#1=#2\@nil{#1}
\@for\CurrentOption:=\@classoptionslist\do{%
\@ifundefined{%
KV@COLCLASS@\expandafter\c@l@getoptionname\CurrentOption=\@nil
}%
{% other options
}{%
\edef\c@l@tempa{\c@l@tempa,\CurrentOption,}%
}%
}%
\edef\c@l@tempa{%
\noexpand\setkeys{COLCLASS}{\c@l@tempa}%
}
\c@l@tempa
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% The following |\if...| commands are for implementing various options.
% \changes{v0.4}{2000/05/27}{Unnested some macro environments to save save stack space}
% \begin{macro}{\ifc@lclasses}
% \begin{macrocode}
\newif\ifc@lclasses
\c@lclassesfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lpackages}
% \begin{macrocode}
\newif\ifc@lpackages
\c@lpackagesfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@llayouts}
% \begin{macrocode}
\newif\ifc@llayouts
\c@llayoutsfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lfolios}
% \begin{macrocode}
\newif\ifc@lfolios
\c@lfoliosfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnotoc}
% \begin{macrocode}
\newif\ifc@lnotoc
\c@lnotocfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnolof}
% \begin{macrocode}
\newif\ifc@lnolof
\c@lnoloffalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnolot}
% \begin{macrocode}
\newif\ifc@lnolot
\c@lnolotfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lmaintoc}
% \begin{macrocode}
\newif\ifc@lmaintoc
\c@lmaintocfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnodate}
% \begin{macrocode}
\newif\ifc@lnodate
\c@lnodatetrue
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnoauthor}
% \begin{macrocode}
\newif\ifc@lnoauthor
\c@lnoauthorfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnotitle}
% \begin{macrocode}
\newif\ifc@lnotitle
\c@lnotitlefalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnomaketitle}
% \begin{macrocode}
\newif\ifc@lnomaketitle
\c@lnomaketitlefalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnopubindoc}
% \changes{v0.4}{2000/05/27}{Added nopubindoc and nopubintoc options}
% \begin{macrocode}
\newif\ifc@lnopubindoc
\c@lnopubindocfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lnopubintoc}
% \begin{macrocode}
\newif\ifc@lnopubintoc
\c@lnopubintocfalse
% \end{macrocode}
% \end{macro}
% \changes{v0.5}{2002/08/24}{Added onebib and combinedbib options}
% \begin{macro}{\ifc@lonebib}
% \begin{macrocode}
\newif\ifc@lonebib
\c@lonebibfalse
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ifc@lcombib}
% \begin{macrocode}
\newif\ifc@lcombib
\c@lcombibfalse
% \end{macrocode}
% \end{macro}
%
%
% Now declare and process the options.
% \changes{v0.4}{2000/05/27}{Added book option}
% \changes{v0.6}{2002/08/24}{Added onebib option}
% \changes{v0.63}{2003/11/09}{Added memoir option}
% \begin{macrocode}
\DeclareOption{book}{\def\c@lclass{book}}
\DeclareOption{report}{\def\c@lclass{report}}
\DeclareOption{letter}{\def\c@lclass{letter}}
\DeclareOption{memoir}{\def\c@lclass{memoir}}
\DeclareOption{classes}{\c@lclassestrue}
\DeclareOption{packages}{\c@lpackagestrue}
\DeclareOption{layouts}{\c@llayoutstrue}
\DeclareOption{folios}{\c@lfoliostrue}
\DeclareOption{notoc}{\c@lnotoctrue}
\DeclareOption{nolof}{\c@lnoloftrue}
\DeclareOption{nolot}{\c@lnolottrue}
\DeclareOption{maintoc}{\c@lmaintoctrue}
\DeclareOption{date}{\c@lnodatefalse}
\DeclareOption{noauthor}{\c@lnoauthortrue}
\DeclareOption{notitle}{\c@lnotitletrue}
\DeclareOption{nomaketitle}{\c@lnomaketitletrue}
\DeclareOption{nopubindoc}{\c@lnopubindoctrue}
\DeclareOption{nopubintoc}{\c@lnopubintoctrue}
\DeclareOption{onebib}{\c@lonebibtrue}
\DeclareOption{combinedbib}{\c@lcombibtrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\c@lclass}}
\ProcessOptions\relax
\ifc@lcombib
\c@lonebibtrue
\fi
% \end{macrocode}
%
%
% At this point, load the actual class (as specified by |\c@lclass|).
% \begin{macrocode}
\LoadClass{\c@lclass}
% \end{macrocode}
%
% \begin{macro}{\ifc@lhaschapter}
% |\ifc@lhaschapter| is TRUE if the loaded class has chapters.
% \begin{macrocode}
\newif\ifc@lhaschapter
\c@lhaschapterfalse
\@ifundefined{chapter}{}{\c@lhaschaptertrue}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@titlepage}
% The \Lpack{letter} class (and perhaps others) does not have a
% |\maketitle| command, and therefor neither has a \Lopt{titlepage} option.
% In this case we need a new |\if@titlepage| for later use when dealing
% with |\maketitle|. A side effect of this implementation is that |\maketitle|
% is available for any main document class.
% \changes{v0.3}{2000/05/20}{Ensured \cs{if@titlepage} is defined}
% \begin{macrocode}
\@ifundefined{if@titlepage}{\newif\if@titlepage\@titlepagefalse}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifc@ltoctitle}
% \begin{macro}{\ifc@ltoctitle}
% \begin{macro}{\ifc@lpub}
% Boolean hooks for testing if |\coltoctitle|, |\coltocauthor| and
% |\published| have been set.
% \begin{macrocode}
\newif\ifc@ltoctitle
\c@ltoctitlefalse
\newif\ifc@ltocauthor
\c@ltocauthorfalse
\newif\ifc@lpub
\c@lpubfalse
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{colpage}
% \begin{macro}{c@lctr}
% \begin{macro}{\c@section}
% |colpage| is a counter for storing the (current) page number for the
% main document.
% |c@lctr| is a counter for storing the current main document sectioning
% number. A section counter (|\c@section|) is provided when the class
% does not have sections.
% \begin{macrocode}
\newcounter{colpage} \setcounter{colpage}{1}
\renewcommand{\thecolpage}{\arabic{colpage}}
\newcounter{c@lctr}
\@ifundefined{c@section}{\newcounter{section}}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@ltocfnum}
% \begin{macro}{\c@lloffnum}
% \begin{macro}{\c@llotfnum}
% These are output stream numbers for local ToC, LoF and LoT files.
% Allocating new streams for each imported file may cause \TeX{} to
% run out of streams (there is a limit of 16).
% \begin{macrocode}
\newwrite\c@ltocfnum
\newwrite\c@lloffnum
\newwrite\c@llotfnum
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Kernel modifications (and potential additions)}
%
% Much of the class code consists of new versions of \LaTeX{} kernel commands.
% Redefinitions starting with |\c@la...| are for commands in the main
% document. Modifications starting |\c@lb...| are for commands within
% imported documents.
%
%
% \begin{macro}{\provideenvironment}
% \begin{macro}{\c@lprovide@environment}
% \begin{macro}{\c@lenvironment}
% \begin{macro}{\c@lenva}
% \begin{macro}{\c@lenvb}
% \begin{macro}{\c@lthrowenv}
% To stop \LaTeX{} whining when multiple classes are read which happen
% to define commands (via |\newcommand|) or environments
% (via |\newenvironment|) that have the same names, we need to be able
% to make \LaTeX{} use |\providecommand| and |\provideenvironment|
% instead. Unfortunately the kernel does not provide a |\provideenvironment|
% command, so here is one based on the code in the \Lpack{makecmds} package.
% \begin{macrocode}
\def\provideenvironment{%
\@star@or@long\c@lprovide@environment}
\def\c@lprovide@environment#1{%
\@ifundefined{#1}{%
\expandafter\let\csname#1\endcsname\relax
\expandafter\let\csname end#1\endcsname\relax
\new@environment{#1}}{\c@lenvironment{#1}}
}
\def\c@lenvironment#1{%
\@testopt{\c@lenva#1}0}
\def\c@lenva#1[#2]{%
\@ifnextchar [{\c@lenvb#1[#2]}{\c@lthrowenv{#1}{[#2]}}}
\def\c@lenvb#1[#2][#3]{\c@lthrowenv{#1}{[#2][#3]}}
\def\c@lthrowenv#1#2#3#4{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lnamethm}
% \begin{macro}{\@xnthm}
% \begin{macro}{\@ynthm}
% \begin{macro}{\@othm}
% As pointed out by Hendri Hondrop\footnote{Email
% from \texttt{hendri@cs.utwente.nl} on 16~May, 2000.}
% |\newtheorem| commands in imported documents can interfere with each other.
% My solution to this is to make the command local instead of global.
% |\c@lnamethm| is a helper macro (removes the |\global| from the
% |\@namedef|s in the original code), and the others are modifications
% of the originals in \file{ltthm.dtx} (just removing any |\global| commands).
% \changes{v0.3}{2000/05/20}{Added a local version of \cs{newtheorem}.}
% \begin{macrocode}
\@ifundefined{newtheorem}{}{%
\newcommand{\c@lnamethm}[3]{%
\@namedef{#1}{\@thm{#2}{#3}}%
\@namedef{end#1}{\@endtheorem}}
\def\@xnthm#1#2[#3]{%
\expandafter\@ifdefinable\csname #1\endcsname
{\@definecounter{#1}\@newctr{#1}[#3]%
\expandafter\xdef\csname the#1\endcsname{%
\expandafter\noexpand\csname the#3\endcsname \@thmcountersep
\@thmcounter{#1}}%
\c@lnamethm{#1}{#1}{#2}}}
\def\@ynthm#1#2{%
\expandafter\@ifdefinable\csname #1\endcsname
{\@definecounter{#1}%
\expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}%
\c@lnamethm{#1}{#1}{#2}}}
\def\@othm#1[#2]#3{%
\@ifundefined{c@#2}{\@nocounterr{#2}}%
{\expandafter\@ifdefinable\csname #1\endcsname
{\@namedef{the#1}{\@nameuse{the#2}}
\c@lnamethm{#1}{#2}{#3}}}}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\providelength}
% This is a |\provide...| version of |\newlength| (from \file{ltlength.dtx}).
% \changes{v0.4}{2000/05/27}{Added \cs{providelength} and \cs{providecounter}
% commands}
% \changes{v0.63}{2003/11/09}{Used \cs{providecommand} for \cs{providelength}
% and \cs{providecounter} as they are defined in the memoir class}
% \begin{macrocode}
\providecommand{\providelength}[1]{%
\ifx #1\undefined
\newlength{#1}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\providecounter}
% This is a |\provide...| version of |\newcounter| (from \file{ltcounts.dtx}).
% \begin{macrocode}
\providecommand{\providecounter}[1]{%
\expandafter\ifx \csname c@#1\endcsname \undefined
{\@definecounter{#1}}%
\@ifnextchar[{\@newctr{#1}}{}
\else
\@ifnextchar[{\c@l@gobbleoptarg}{}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@l@gobbleoptarg}
% A macro that discards an optional argument (i.e., the tokens |[optarg]|).
% \changes{v0.4}{2000/05/27}{Added \cs{c@l@gobbleoptarg} command}
% \begin{macrocode}
\def\c@l@gobbleoptarg[#1]{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\appendiargdef}
% The code for this is copied from the \Lpack{abstract} package, hence
% the use of |@bs| instead of |c@l| as a distinguishing substring.
% \changes{v0.41}{2000/06/18}{Added \cs{appendiargdef} from the abstract package}
% \begin{macrocode}
\providecommand{\appendiargdef}[2]{\begingroup
\toks@\expandafter{#1{##1}#2}%
\edef\@bsx{\endgroup \def\noexpand#1####1{\the\toks@}}%
\@bsx}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Document commands and environments}
%
% \begin{macro}{\c@lbdocumentclass}
% The |\documentclass| in imported documents has to be changed so that
% commands including the |@| sign are legal in the preamble. By default
% the declared options and class are discarded. When the \Lopt{classes}
% option is used, any potential new class file must be read.
% |\documentclass|
% is originally defined in \file{ltclass.dtx}.
% \begin{macrocode}
\ifc@lclasses
\newcommand\c@lbdocumentclass{%
\makeatletter %% added
\let\newcommand\providecommand %% added
\let\newenvironment\provideenvironment %% added
%% \let\documentclass\@twoclasseserror
%% \if@compatability\else\let\usepackage\RequirePackage\fi
\@fileswithoptions\@clsextension
}
\else
\newcommand{\c@lbdocumentclass}[2][\@empty]{%
\makeatletter
}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbusepackage}
% The |\usepackage| command (from \file{ltclass.dtx})
% in imported documents is normally disabled.
% This is the disabled version.
% \begin{macrocode}
\ifc@lpackages\else
\newcommand{\c@lbusepackage}[2][\@empty]{}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbLoadClass}
% This is a copy of the |\LoadClass| from \file{ltclass.dtx}. I found it was
% needed if an imported document used a class that in its turn used
% |\LoadClass|.\footnote{Problem reported by Hans Fredrik Nordhaug
% \texttt{hansfn@mi.uib.no} on 2001/08/24.}
% \changes{v0.52}{2001/08/25}{Added \cs{c@lbLoadClass}}
% \begin{macrocode}
\newcommand{\c@lbLoadClass}{%
\ifx\@currext\@pkgextension
\@latex@error{\noexpand\LoadClass in package file}%
{You may only use \noexpand\LoadClass in a class file.}%
\fi
\@fileswithoptions\@clsextension}
% \end{macrocode}
% \end{macro}
%
% The |\document| command (defined in \file{ltfiles.dtx}) has to be modified,
% both for the main document (to allow later preamble commands and to
% store the jobname of the main document), and similarly but not identically,
% for the imported documents (output here is to the |\@partaux| file instead
% of the |\@mainaux| file).
%
% \begin{macro}{\c@ltextblock}
% |\c@ltextblock| is a macro holding some code that is common to both
% |\c@ladocument| and |\c@lbdocument|.
% \changes{v0.3}{2000/05/20}{Added \cs{c@ltextblock} command}
% \begin{macrocode}
\newcommand{\c@ltextblock}{%
\@colht\textheight
\@colroom\textheight \vsize\textheight
\columnwidth\textwidth
\@clubpenalty\clubpenalty
\if@twocolumn
\advance\columnwidth -\columnsep
\divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
\fi
\hsize\columnwidth \linewidth\hsize
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@ladocument}
% \begin{macro}{\c@lbdocument}
% \begin{macrocode}
\newcommand{\c@ladocument}{%
\endgroup
\let\mainjobname\jobname %% added
\def\c@lmainauxfile{\jobname.aux} %% added
\ifx\@unusedoptionlist\@empty\else
\@latex@warning@no@line{Unused global option(s):^^J%
\@spaces[\@unusedoptionlist]}%
\fi
\c@ltextblock %% a replacement
\begingroup\@floatplacement\@dblfloatplacement
\makeatletter\let\@writefile\@gobbletwo
\global \let \@multiplelabels \relax
\@input{\c@lmainauxfile}% %% changed
\endgroup
\if@filesw
\immediate\openout\@mainaux\c@lmainauxfile %% changed
\immediate\write\@mainaux{\relax}%
\fi
\process@table
\let\glb@currsize\@empty
\normalsize
\everypar{}%
\ifx\normalsfcodes\@empty
\ifnum\sfcode`\.=\@m
\let\normalsfcodes\frenchspacing
\else
\let\normalsfcodes\nonfrenchspacing
\fi
\fi
\@noskipsecfalse
% \end{macrocode}
% \begin{macro}{\@outputpage}
% Imported documents may change the page number, which can then mess
% up the numbering of later pages. The |colpage| counter is used
% to synchronize the main document page numbering after any import.
% To do this, it has to be incremented for each typeset page, so
% this is added to the output routine (described in \file{ltoutput.dtx}).
% This is done here in case any package in the main document has modified
% |\@outputpage|, as the \Lpack{showframe} package does.
% \changes{v0.4}{2000/05/27}{Moved the modification to \cs{@outputpage}
% to within \cs{c@ladocument}}
%
% Similarly, the |\maketitle| command is made to be |\@clamaketitle| in case
% some other package (e.g., \Lpack{titling}) has modified |\maketitle| after
% the \Lpack{combine} class has done its thing.
% \changes{v0.41}{2000/06/18}{Moved \cs{maketitle} letting to
% \cs{c@lamaketitle} to inside \cs{c@ladocument}}
% \begin{macrocode}
\g@addto@macro{\@outputpage}{\stepcounter{colpage}} %% added
\let\maketitle\c@lamaketitle %% added
% \end{macrocode}
% \end{macro}
% \begin{macro}{\c@lthechap}
% \begin{macro}{\c@lthesec}
% Store the initial forms of |\thechapter| or |\thesection| for later
% restoration after a possible |\appendix|.
% \changes{v0.51}{2001/07/05}{Added \cs{c@lthechap} and \cs{c@lthesec}}
% \begin{macrocode}
\@ifundefined{c@chapter}% %% added
{\@ifundefined{c@section}{}{\let\c@lthesec\thesection}}%
{\let\c@lthechap\thechapter}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
\let \@refundefined \relax
\let\AtBeginDocument\@firstofone
\@begindocumenthook
\ifdim\topskip<1sp\global\topskip 1sp\relax\fi
\global\@maxdepth\maxdepth
%% \global\let\@begindocumenthook\@undefined
\ifx\@listfiles\@undefined
\global\let\@filelist\relax
\global\let\@addtofilelist\@gobble
\fi
%% \gdef\do##1{\global\let ##1\@notprerr}%
%% \@preamblecmds
\global\let \@nodocument \relax
\global\let\do\noexpand
\ignorespaces}
% \end{macrocode}
% For an imported document the \Lopt{layouts} option is implemented
% in the |\document| command. The \Lpack{article},
% \Lpack{report} and \Lpack{letter} classes all start of with the |plain|
% page style, which is specified within the class file. When mixed classes
% of imported documents are used the page style definitions can get
% overwritten by the extra class(es). So, the revised |\document| command
% resets the |plain| page style to the \Lpack{combine} class definition
% and sets the initial page style to be |plain|.
% \begin{macrocode}
\newcommand{\c@lbdocument}{%
%% \endgroup
%% \ifx\@unusedoptionlist\@empty\else
%% \@latex@warning@no@line{Unused global option(s):^^J%
%% \@spaces[\@unusedoptionlist]}%
%% \fi
\ifc@llayouts %% layouts option
\c@ltextblock
\fi
\begingroup\@floatplacement\@dblfloatplacement
\makeatletter \let\@writefile\@gobbletwo
%% \global \let \@multiplelabels \relax
\@input{\c@lauxfile}%
\endgroup
\if@filesw
\immediate\openout\@partaux\c@lauxfile
\immediate\write\@partaux{\relax}%
\fi
\process@table
\let\glb@currsize\@empty
\normalsize
\everypar{}%
\@noskipsecfalse
%% \let \@refundefined \relax
\let\AtBeginDocument\@firstofone
\@begindocumenthook
\ifdim\topskip<1sp\global\topskip 1sp\relax\fi
\global\@maxdepth\maxdepth
%% \global\let\@begindocumenthook\@undefined
\ifx\@listfiles\@undefined
\global\let\@filelist\relax
\global\let\@addtofilelist\@gobble
\fi
%% \gdef\do##1{\global\let ##1\@notprerr}%
%% \@preamblecmds
\global\let \@nodocument \relax
\global\let\do\noexpand
\let\ps@plain\c@lbps@plain %% set pagestyle
% \end{macrocode}
% Setting |\pagestyle| here kills the use of any other style (e.g.,
% a fancy style) in the imports\footnote{Problem discovered by Rumen
% Bogdanovski (\texttt{rgb@libra.astro.bas.bg}) on 2001/04/03.}.
% \changes{v0.41}{2001/04/04}{Eliminated page style setting for imports.}
% \begin{macrocode}
%% \pagestyle{plain}
\ifc@lfolios %% folios option initialises page number
\setcounter{page}{1}
\fi
\ifc@lhaschapter %% set chapter/section number
\setcounter{c@lctr}{\value{chapter}}
\setcounter{chapter}{0}
\else
\setcounter{c@lctr}{\value{section}}
\setcounter{section}{0}
\fi
\c@lresetcounters %% added
\makeatother %% added
\ignorespaces}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lresetcounters}
% This sets various counters to zero, and is called at the beginning of
% an imported document.
% \changes{v0.4}{2000/05/27}{Added \cs{c@lresetcounters} and
% \cs{zeroextracounters} commands}
% \changes{v0.51}{2001/07/05}{Reset chapter/section format after possible \cs{appendix}}
% \begin{macrocode}
\newcommand{\c@lresetcounters}{%
\@ifundefined{c@figure}{}{\setcounter{figure}{0}}
\@ifundefined{c@table}{}{\setcounter{table}{0}}
\@ifundefined{c@equation}{}{\setcounter{equation}{0}}
\@ifundefined{c@footnote}{}{\setcounter{footnote}{0}}
\@ifundefined{c@chapter}%
{\@ifundefined{c@section}{}{\renewcommand{\thesection}{\c@lthesec}}}%
{\renewcommand{\thechapter}{\c@lthechap}}
\zeroextracounters
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zeroextracounters}
% This is a user-level macro that can be renewed to reset addtional
% counters to zero at the beginning of an imported document.
% \begin{macrocode}
\newcommand{\zeroextracounters}{}
% \end{macrocode}
% \end{macro}
%
%
%
% The |\enddocument| command (defined in \file{ltmiscen.dtx}) has
% to be modified for both the main and imported documents. The modifications
% are minor, mainly concerned with handling the proper files.
%
% \begin{macro}{\c@lenddoca}
% |\c@lenddoca| holds some code that is common to both |\c@laenddocument|
% and |\c@lbenddocument|.
% \changes{v0.3}{2000/05/20}{Added \cs{c@lenddoca} command}
% \begin{macrocode}
\newcommand{\c@lenddoca}{%
\@dofilelist
\ifdim \font@submax >\fontsubfuzz\relax
\@font@warning{Size substitutions with differences\MessageBreak
up to \font@submax\space have occured.\@gobbletwo}%
\fi
\@defaultsubs
%% \@refundefined
\if@filesw
\ifx \@multiplelabels \relax
\if@tempswa
\@latex@warning@no@line{Label(s) may have changed.
Rerun to get cross-references right}%
\fi
\else
\@multiplelabels
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@laenddocument}
% \begin{macro}{\c@lbenddocument}
% \begin{macrocode}
\newcommand{\c@laenddocument}{%
\@enddocumenthook
\@checkend{document}%
\clearpage
\begingroup
\if@filesw
\immediate\closeout\@mainaux
\immediate\closeout\@partaux
\let\@setckpt\@gobbletwo
\let\@newl@bel\@testdef
\@tempswafalse
\makeatletter \input\c@lmainauxfile %% change here
\fi
\c@lenddoca %% a replacement
\@refundefined
\endgroup
\deadcycles\z@\@@end}
\newcommand{\c@lbenddocument}{%
\@enddocumenthook
\@checkend{document}%
\clearpage
\begingroup
\if@filesw
\immediate\closeout\@partaux %% change here
\let\@setckpt\@gobbletwo
\let\@newl@bel\@testdef
\@tempswafalse
\makeatletter \input\c@lauxfile %% change here
\fi
\c@lenddoca %% a replacement
%% \@refundefined
\endgroup
\deadcycles\z@ %%\@@end %% \@@end will close *all* files
\c@lclosetocs %% close local files
% \end{macrocode}
% Reset sectional and page numbering. Also reset stuff to take account
% of the possibily that |\appendix| was called.
% \changes{v0.51}{2001/05/09}{Added reset of chapter name after appendix}
% \begin{macrocode}
\ifc@lhaschapter %% reset chap/sec and page numbering
\setcounter{chapter}{\value{c@lctr}}
\gdef\thechapter{\c@lthechap}
\gdef\@chapapp{\chaptername}
\else
\setcounter{section}{\value{c@lctr}}
\gdef\thesection{\c@lthesec}
\fi
\setcounter{page}{\value{colpage}}
\pagestyle{\c@lastyle}
\erasetitling %% no \coltoc... or \published commands defined
%% \let\@auxout\@mainaux
\gdef\jobname{\mainjobname} %% swap back to main document file name
\endinput %% ignore any text after \end{document}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Titling commands}
%
% Changes to |\maketitle| and friends are defined here.
%
% \begin{macro}{\maintitlefont}
% \begin{macro}{\postmaintitle}
% \begin{macro}{\mainauthorfont}
% \begin{macro}{\postmainauthor}
% \begin{macro}{\maindatefont}
% \begin{macro}{\postmaindate}
% To provide some flexibilty in the titling style of the main document,
% user level commands are provided that can be changed to reconfigure
% the appearance resulting from |\maketitle|. These are defined initially
% to approximately mimic the normal \LaTeX{} style.
% \changes{v0.3}{2000/05/20}{Added \cs{...main...} commands.}
% \begin{macrocode}
\newcommand{\maintitlefont}{\begin{center}\LARGE}
\newcommand{\postmaintitle}{\par\end{center}\vskip 0.5em}
\newcommand{\mainauthorfont}{\begin{center}
\large \lineskip .5em%
\begin{tabular}[t]{c}}
\newcommand{\postmainauthor}{\end{tabular}\par\end{center}}
\newcommand{\maindatefont}{\begin{center}\large}
\newcommand{\postmaindate}{\par\end{center}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lamaketitle}
% The |\maketitle| command (defined by each class) must not incapacitate
% several commands that it normally does (e.g., |\thanks|, |\maketitle|,
% |\title|, |\author|, |\date|, and |\and|). The following is a
% modification of |\maketitle| as in the \Lpack{article}, \Lpack{report},
% and \Lpack{book} classes.
% \changes{v0.3}{2000/05/20}{Revised maketitle-related commands.}
% \begin{macrocode}
\if@titlepage
\newcommand{\c@lamaketitle}{\begin{titlepage}%
\let\footnotesize\small
\let\footnoterule\relax
\let \footnote \thanks
\null\vfil
\vskip 60\p@
{\maintitlefont \@title \postmaintitle}
{\mainauthorfont \@author \postmainauthor}
{\maindatefont \@date \postmaindate}
\par
\@thanks
\vfil\null
\end{titlepage}%
\setcounter{footnote}{0}%
\c@lmtitlempty %% change here
} % end titlepage defs
\else
\newcommand{\c@lamaketitle}{\par
\begingroup
\c@lmtitle %% change here
\endgroup
\setcounter{footnote}{0}%
\c@lmtitlempty %% change here
} % end non-titlepage
% \end{macrocode}
% I use |\def\@maketitle| to account for the cases where the main class
% does not have titling commands, and to ensure an existing |\@maketitle|
% gets overridden.
% \begin{macrocode}
\def\@maketitle{%
\newpage
\null
\vskip 2em%
{\maintitlefont \@title \postmaintitle}
{\mainauthorfont \@author \postmainauthor}
{\maindatefont \@date \postmaindate}
\par
\vskip 1.5em}
\fi % end mod A of titling
% \end{macrocode}
%
% \begin{macro}{\c@lmtitle}
% This macro contains much of the code that is common between
% |\c@l@maketitle| and |\c@lbmaketitle|.
% \begin{macrocode}
\newcommand{\c@lmtitle}{%
\renewcommand\thefootnote{\@fnsymbol\c@footnote}%
\def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
\long\def\@makefntext##1{\parindent 1em\noindent
\hb@xt@1.8em{%
\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
\if@twocolumn
\ifnum \col@number=\@ne
\@maketitle
\else
\twocolumn[\@maketitle]%
\fi
\else
\newpage
\global\@topnum\z@
\@maketitle
\fi
\thispagestyle{plain}\@thanks
}
% \end{macrocode}
% \end{macro}
%
% The modification for imported documents is simpler as there seems no
% point in allowing for a \Lopt{titlepage} option. Also, don't start
% a new page for the title and use a local typesetting style.
% \begin{macrocode}
\newcommand{\c@lbmaketitle}{\par
\begingroup
\let\newpage\relax
\let\@maketitle\c@lb@maketitle
\c@lmtitle
\endgroup
\setcounter{footnote}{0}%
\c@lmtitlempty
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lmtitlempty}
% A helper macro to save some macro space.
% It empties elements of |\maketitle|.
% \begin{macrocode}
\newcommand{\c@lmtitlempty}{%
\global\let\@thanks\@empty
\global\let\@author\@empty
\global\let\@date\@empty
\global\let\@title\@empty
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\importtitlefont}
% \begin{macro}{\postimporttitle}
% \begin{macro}{\importauthorfont}
% \begin{macro}{\postimportauthor}
% \begin{macro}{\importdatefont}
% \begin{macro}{\postimportdate}
% The fonts and layouts for use within |\maketitle| in imported documents.
% \changes{v0.3}{2000/05/20}{Added \cs{...import...} commands.}
% \begin{macrocode}
\newcommand{\importtitlefont}{\begin{center}\LARGE\bfseries}
\newcommand{\postimporttitle}{\par\end{center}}
\newcommand{\importauthorfont}{\begin{center}
\large\itshape \lineskip .5em%
\begin{tabular}[t]{c}}
\newcommand{\postimportauthor}{\end{tabular}\par\end{center}}
\newcommand{\importdatefont}{\begin{center}\large}
\newcommand{\postimportdate}{\par\end{center}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lb@maketitle}
% This typesets the title in an imported document. It also includes the
% code for implementing the \Lopt{nodate}, \Lopt{notitle} and \Lopt{noauthor}
% options. The vertical spacing is reduced slightly from normal.
% The title and author texts are set with |\importtitlefont| and
% |\importauthorfont| respectiveley. The date is set with |\importdatefont|.
% \begin{macrocode}
\newcommand{\c@lb@maketitle}{%
%% \newpage
\begingroup
\let\footnote\thanks
\null
\vskip 2em%
\ifc@lnotitle\else
{\importtitlefont \@title \postimporttitle}
\fi
\ifc@lnoauthor\else
{\importauthorfont \@author \postimportauthor}
\fi
\ifc@lnodate\else
{\importdatefont \@date \postimportdate}%
\fi
\par
\endgroup
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Cross referencing}
%
% This section deals with |\tableofcontents| and friends, together
% with labeling, referencing and citations.
%
% \begin{macro}{\c@lbstarttoc}
% The |\@starttoc| command (from \file{ltsect.dtx}) has to be modified
% for imported documents so that a local ToC (LoF, LoT) file is used
% instead of the one for the main document. I use a file identifier
% of |c@l#1fnum| instead of the normal |tf@#1|.
% \begin{macrocode}
\newcommand{\c@lb@starttoc}[1]{%
\begingroup
\makeatletter
\def\tocfname{\jobname.#1}
\@input{\tocfname}%
\if@filesw
% \end{macrocode}
% The following tests are to check if we can use a predefined output stream
% or have to allocate a new one (e.g., if a new list of floats hase been
% defined).
% \begin{macrocode}
\def\c@ltempa{#1} \def\c@ltempb{toc}
\ifx \c@ltempa \c@ltempb
\immediate\openout\c@ltocfnum \tocfname\relax
\else
\def\c@ltempb{lof}
\ifx \c@tempa \c@ltempb
\immediate\openout\c@lloffnum \tocfname\relax
\else
\def\c@ltempb{lot}
\ifx \c@tempa \c@ltempb
\immediate\openout\c@llotfnum \tocfname\relax
\else
\expandafter\newwrite\csname c@l#1fnum\endcsname
\immediate\openout\csname c@l#1fnum\endcsname \tocfname\relax
\fi
\fi
\fi
\fi
\@nobreakfalse
\endgroup}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbwritefile}
% To go along with local ToC files, |\@writefile| (in \file{ltmiscen.dtx})
% has to be modified to match. We also check if a local file exists before
% writing to it.
% \begin{macrocode}
\newcommand{\c@lb@writefile}[2]{%
\def\tocfname{\jobname.#1}
\IfFileExists{\tocfname}
{\@temptokena{#2}%
\immediate\write\csname c@l#1fnum\endcsname{\the\@temptokena}}
{}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lclosetocs}
% At the end of each imported document, any local ToC, etc., files
% must be closed.
% \begin{macrocode}
\newcommand{\c@lclosetocs}{%
\immediate\closeout\c@ltocfnum
\immediate\closeout\c@lloffnum
\immediate\closeout\c@llotfnum
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\c@ltocgobble}
% A macro containing some common code for |\...addtocontents| commands.
% \begin{macrocode}
\newcommand{\c@ltocgobble}{%
\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@laaddtocontents}
% \begin{macro}{\c@laaddcontentsline}
% It turns out to be useful to have versions of ToC addition commands
% that go towards the main document.
% \begin{macrocode}
\newcommand{\c@laaddtocontents}[2]{%
\protected@write\@mainaux
{\c@ltocgobble}%
{\string\@writefile{#1}{#2}}
}
\newcommand{\c@laaddcontentsline}[3]{%
\c@laaddtocontents{#1}{\protect\contentsline{#2}{#3}{\thecolpage}}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lbaddtocontents}
% To implement the \Lopt{maintoc} option, we need a modification of
% |\addtocontents| (in \file{ltsect.dtx}) so that it will write to
% both the local and the main \file{.aux} files.
% \begin{macrocode}
\ifc@lmaintoc
\newcommand{\c@lbaddtocontents}[2]{%
\protected@write\@auxout
{\c@ltocgobble}%
{\string\@writefile{#1}{#2}}
\ifx\@mainaux\@auxout\else %% prevent writing twice to mainaux
\protected@write\@mainaux
{\c@ltocgobble}%
{\string\@writefile{#1}{\protect\begin{tocindent}{\toctocindent}}}
\protected@write\@mainaux
{\c@ltocgobble}%
{\string\@writefile{#1}{#2}}
\protected@write\@mainaux
{\c@ltocgobble}%
{\string\@writefile{#1}{\protect\end{tocindent}}}
\fi
}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lblabel}
% \begin{macro}{\c@lb@setref}
% To get the `correct' page number for labels in an imported
% document, we have to use the global and not the local page number.
% \begin{macrocode}
\newcommand{\c@lblabel}[1]{\@bsphack
\protected@write\@auxout{}%
{\string\newlabel{#1}{{\@currentlabel}{\thecolpage}}}%
\@esphack}
\newcommand{\c@lb@setref}[3]{%
\ifx#1\relax
\protect\G@refundefinedtrue
\nfss@text{\reset@font\bfseries ??}%
\@latex@warning{Reference `#3' on page \thecolpage \space
undefined}%
\else
\expandafter#2#1\null
\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lbnewlabel}
% \begin{macro}{\c@lbref}
% \begin{macro}{\c@lpagebref}
% For local labels and cross-references in an imported document,
% special versions of
% |\newlabel|, |\ref| and |\pageref| (in \file{ltxref.dtx}) are needed.
% I use |\jobname| to distinguish identical labels in different imported
% files.
% \begin{macrocode}
\newcommand{\c@lbnewlabel}{\@newl@bel{R?\jobname?}}
\newcommand{\c@lbref}[1]{\expandafter\@setref\csname R?\jobname?@#1\endcsname
\@firstoftwo{#1}}
\newcommand{\c@lbpageref}[1]{\expandafter\@setref\csname R?\jobname?@#1\endcsname
\@secondoftwo{#1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lwritemainbib}
% \begin{macro}{\c@lwritelocalbib}
% For citatations we may be writing to either the main bibliography
% or to a local bibliography. For local bibliographies I use the
% |\jobname| as a distinguishing characteristic.
% \changes{v0.6}{2002/08/24}{Added \cs{c@lwritemainbib} and \cs{c@lwritelocalbib}}
% \begin{macrocode}
\newcommand{\c@lwritemainbib}{%
\if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
\@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
\G@refundefinedtrue
\@latex@warning
{Citation `\@citeb' on page \thecolpage \space undefined}}%
{\hbox{\csname b@\@citeb\endcsname}}}
\newcommand{\c@lwritelocalbib}{%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\@ifundefined{B?\jobname?@\@citeb}{\mbox{\reset@font\bfseries ?}%
\G@refundefinedtrue
\@latex@warning
{Citation `\@citeb' on page \thecolpage \space undefined}}%
{\hbox{\csname B?\jobname?@\@citeb\endcsname}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\c@lanocite}
% Slight mod to the kernel |\nocite| macro.
% \changes{v0.6}{2002/08/24}{Added \cs{c@lanocite}}
% \begin{macrocode}
\newcommand{\c@lanocite}[1]{\@bsphack
\@for\@citeb:=#1\do{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
\@ifundefined{b@\@citeb}{\G@refundefinedtrue
\@latex@warning{Citation `\@citeb' undefined}}{}}%
\@esphack}
\let\nocite\c@lanocite
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbnocite}
% Need another version of |\nocite| for imports.
% \changes{v0.6}{2002/08/24}{Added \cs{c@lbnocite}}
% \begin{macrocode}
\newcommand{\c@lbnocite}[1]{\@bsphack
\@for\@citeb:=#1\do{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\@ifundefined{B?\jobname?@\@citeb}{\G@refundefinedtrue
\@latex@warning{Citation `\@citeb' undefined}}{}}%
\@esphack}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lb@citex}
% \begin{macro}{\c@lbbibcite}
% For local citations in an imported document, special versions of
% |\@citex| and |\bibcite| (in \file{ltbibl.dtx}) are needed. I use
% the |\jobname| as a means of distinguishing between identical citation
% labels in different imported files.
% \changes{v0.6}{2002/08/24}{Added code for bib options to \cs{c@lbbibcite}}
% \begin{macrocode}
\def\c@lb@citex[#1]#2{%
\ifc@lcombib
\c@lanocite{#2}%
\fi
\let\@citea\@empty
\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{,\penalty\@m\ }%
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\ifc@lcombib
\c@lwritelocalbib
\else
\ifc@lonebib
\c@lwritemainbib
\else
\c@lwritelocalbib
\fi
\fi}}{#1}}
\ifc@lonebib
\newcommand{\c@lbbibcite}{\@newl@bel b}
\ifc@lcombib
\renewcommand{\c@lbbibcite}{\@newl@bel{B?\jobname?}}
\fi
\else
\newcommand{\c@lbbibcite}{\@newl@bel{B?\jobname?}}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{Page styles and numbering}
%
% \begin{macro}{\c@lapagestyle}
% \begin{macro}{\c@lastyle}
% \begin{macro}{\c@lbpagestyle}
% I want to be able to restore the main document pagestyle after an
% import. The current main pagestyle is kept in |\c@lastyle| which is
% defined by |\c@lapagestyle| (original in \file{ltpage.dtx}).
% \changes{v0.41}{2001/04/04}{Changed c@lstyle to \cs{c@lastyle} (two places)}
% \begin{macrocode}
\newcommand{\c@lapagestyle}[1]{%
\gdef\c@lastyle{#1}
\@ifundefined{ps@#1}{}{\@nameuse{ps@#1}}
}
% \end{macrocode}
% |\c@lbpagestyle| is the same as the kernel |\pagestyle|, except for some
% reason \LaTeX{} complains that the original command |\undefinedpagestyle|
% is undefined!
% \begin{macrocode}
\newcommand{\c@lbpagestyle}[1]{%
\@ifundefined{ps@#1}{}{\@nameuse{ps@#1}}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lbpagenumbering}
% Need to do something about changing the page numbering in imported
% documents, as it can have an unfortunate impact on later numbering.
% The original command is in \file{ltpageno.dtx}. Disable changing
% the style of the page number unless the \Lopt{folios} option is in effect.
% \begin{macrocode}
\ifc@lfolios
\newcommand{\c@lbpagenumbering}[1]{%
\global\c@page \@ne \gdef\thepage{\csname @#1\endcsname
\c@page}}
\else
\newcommand{\c@lbpagenumbering}[1]{}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@laps@plain}
% \begin{macro}{\c@lbps@plain}
% Alternative definitions for the |plain| pagestyle.
% \begin{macrocode}
\if@twoside
\newcommand{\c@laps@plain}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font\hfil\thepage}%
\def\@evenfoot{\reset@font\thepage\hfil}%
}
\ifc@lfolios
\newcommand{\c@lbps@plain}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font(\thepage)\hfil\thecolpage}%
\def\@evenfoot{\reset@font\thecolpage\hfil(\thepage)}%
}
\else
\newcommand{\c@lbps@plain}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font\hfil\thecolpage}%
\def\@evenfoot{\reset@font\thecolpage\hfil}%
}
\fi
\else
\newcommand{\c@laps@plain}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font\hfil\thepage}%
\let\@evenfoot\@oddfoot
}
\ifc@lfolios
\newcommand{\c@lbps@plain}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font(\thepage)\hfil\thecolpage}%
\let\@evenfoot\@oddfoot
}
\else
\newcommand{\c@lbps@plain}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font\hfil\thecolpage}%
\let\@evenfoot\@oddfoot
}
\fi
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{New class commands}
%
% That completes the preliminaries. We can now move on and define the
% new commands and environment implemented by the \Lpack{combine} class.
%
% \begin{macro}{\ps@combine}
% A new pagestyle. Like |plain| but the page numbers are put at
% a bottom corner instead of being centered. It also changes the
% the |plain| style to match.
% \begin{macrocode}
\if@twoside
\newcommand{\ps@combine}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font\hfil\thepage}%
\def\@evenfoot{\reset@font\thepage\hfil}%
\let\ps@plain\c@laps@plain
}
\else
\newcommand{\ps@combine}{%
\let\@mkboth\@gobbletwo
\let\@oddhead\@empty \let\@evenhead\@empty
\def\@oddfoot{\reset@font\hfil\thepage}%
\let\@evenfoot\@oddfoot
\let\ps@plain\c@laps@plain
}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\import}
% |\import{|\meta{texfile}|}| attempts to find and input the file
% \meta{texfile}\texttt{.tex}. It is very loosely based on |\include|.
% It also adds the |\coltoctitle|, etc., to the ToC in a useful
% order\footnote{This need pointed out by Stefan Becuwe
% (\texttt{Stefan.Becuwe@ua.ac.be}) by Email on 2001/07/09.}.
% \changes{v0.51}{2001/07/09}{\cs{import} adds coltoctitle, etc., to the ToC}
% \changes{v0.53}{2001/09/05}{Added empty \cs{numberline} to title in ToC}
% \begin{macrocode}
\newcommand{\import}[1]{%
\ifc@ltoctitle
\addtocontents{toc}{\protect\contentsline{coltoctitle}%
{\protect\numberline{}\savec@ltoctitle}{\thecolpage}}
\c@ltoctitlefalse
\fi
\ifc@ltocauthor
\addcontentsline{toc}{coltocauthor}{\protect\numberline{}\savec@ltocauthor}
\c@ltocauthorfalse
\fi
\ifc@lpub
\addcontentsline{toc}{published}{\protect\numberline{}\savec@lpublished}
\c@lpubfalse
\fi
\gdef\jobname{#1}
% \end{macrocode}
% \changes{v0.6}{2002/08/24}{Added empty definition for nocite{*}
% handling to \cs{import}}
% \begin{macrocode}
\expandafter\let\csname B?\jobname?@*\endcsname\@empty
\gdef\c@lauxfile{#1.aux}
\@tempswatrue
\let\@auxout\@partaux
\@input@{#1.tex}%
%% \@writeckpt{#1}%
\let\@auxout\@mainaux
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bodytitlemark}
% \begin{macro}{\bodytitle}
% |\bodytitle[|\meta{short}|]{|\meta{long}|}| is for putting a sectional
% title into the main document for the following imported document. It is
% like a |\section| (or |\chapter|) command and has its own numbering scheme.
% \begin{macrocode}
\newcommand*\bodytitlemark[1]{}
\newcounter{bodytitle}
\renewcommand{\thebodytitle}{\@arabic\c@bodytitle}
\ifc@lhaschapter
\newcommand{\bodytitle}{\@startsection{bodytitle}{0}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Huge\bfseries}}
\else
\newcommand{\bodytitle}{\@startsection{bodytitle}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@ll@chapseci}
% \begin{macro}{\c@ll@chapsecii}
% These are two helper macros that contain common code used for
% some of the ToC typesetting commands that will be defined. Essentially
% they hold the first and second quarter of the code for ToC typesetting
% of chapters and sections.
% \begin{macrocode}
\newcommand{\c@ll@chapseci}{%
% \setlength\@tempdima{1.5em}%
\setlength\@tempdima{0em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
}
\newcommand{\c@ll@chapsecii}[2]{%
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@bodytitle}
% |\l@bodytitle| typesets the ToC entry for |\bodytitle|.
% \begin{macrocode}
\ifc@lhaschapter
\newcommand*\l@bodytitle[2]{% % as per chapter
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\addvspace{1.0em \@plus\p@}%
\c@ll@chapseci
\bfseries %% bold ToC entry
\c@ll@chapsecii{#1}{#2}
\penalty\@highpenalty
\endgroup
\fi}
\else
\newcommand*\l@bodytitle[2]{% % as per section
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\c@ll@chapseci
\bfseries %% bold ToC entry
\c@ll@chapsecii{#1}{#2}
\endgroup
\fi}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\toctitleindent}
% \begin{macro}{\tocauthorindent}
% \begin{macro}{\tocpubindent}
% \begin{macro}{\toctocindent}
% These lengths control the indentations of the imported title, author,
% published, and sectional headings in the main ToC.
% \begin{macrocode}
\newlength{\toctitleindent}\setlength{\toctitleindent}{0pt}
\newlength{\tocauthorindent}\setlength{\tocauthorindent}{1.5em}
\newlength{\tocpubindent}\setlength{\tocpubindent}{1.5em}
\newlength{\toctocindent}\setlength{\toctocindent}{1.5em}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{environment}{tocindent}
% The |tocindent| environment is used to set the various main ToC indents.
% \begin{macrocode}
\newenvironment{tocindent}[1]{%
\hangindent #1 \hangafter -100\relax}{}
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\toctitlefont}
% \begin{macro}{\tocauthorfont}
% \begin{macro}{\tocpubfont}
% These macros define the fonts to be used for typesetting the title,
% author and publication entries in the main ToC.
% \begin{macrocode}
\newcommand{\toctitlefont}{\bfseries}
\newcommand{\tocauthorfont}{\itshape}
\newcommand{\tocpubfont}{\normalfont}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\coltoctitle}
% \begin{macro}{\l@coltoctitle}
% |\coltoctitle{|\meta{title}|}| adds \meta{title} to the ToC for the
% following imported document. The ToC entry is typeset by |\l@coltoctitle|.
% \changes{v0.51}{2001/07/09}{Save the value of \cs{coltoctitle}}
% \begin{macrocode}
\newcommand*{\coltoctitle}[1]{%
\c@ltoctitletrue%
\gdef\savec@ltoctitle{#1}
}
% \end{macrocode}
%
% We want to arrange it so that if the title is near the bottom of a
% page in the ToC, have the pagebreak before rather than after the title.
% \changes{v0.42}{2001/04/04}{Changed pagebreak penalties in \cs{l@coltoctitle}}
% \changes{v0.53}{2001/09/05}{Fixed extraneous space in \cs{l@coltoctitle}}
% \begin{macrocode}
\ifc@lhaschapter
\newcommand*\l@coltoctitle[2]{% % as per chapter
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}% encourage page break
\addvspace{1.0em \@plus\p@}%
\c@ll@chapseci
\setlength{\@tempdima}{\toctitleindent}% eliminate any spaces here
\toctitlefont %% bold ToC entry
\c@ll@chapsecii{#1}{#2}
\penalty\@highpenalty % discourage page break
\endgroup
\fi}
\else
\newcommand*\l@coltoctitle[2]{% % as per section
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\c@ll@chapseci
\setlength{\@tempdima}{\toctitleindent}% eliminate any spaces here
\toctitlefont %% bold ToC entry
\c@ll@chapsecii{#1}{#2}
\penalty\@highpenalty % discourage page break
\endgroup
\fi}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\coltocauthor}
% \begin{macro}{\l@coltocauthor}
% |\coltocauthor{|\meta{authors}|}| adds \meta{authors} to the ToC for the
% following imported document. The ToC entry is typeset by |\l@coltocauthor|.
% Note that a page number is not printed.
% \changes{v0.51}{2001/07/09}{Save value of \cs{coltocauthor}}
% \begin{macrocode}
\newcommand*{\coltocauthor}[1]{%
\c@ltocauthortrue%
\gdef\savec@ltocauthor{#1}
}
% \end{macrocode}
% As it is unlikely that the author will be in the ToC without the title,
% don't encourage a page break beforehand.
% \changes{v0.42}{2001/04/04}{Changed pagebreak penalties in \cs{l@coltocauthor}}
% \changes{v0.53}{2001/09/05}{Fixed extraneous space in \cs{l@coltocauthor}}
%
% \begin{macrocode}
\ifc@lhaschapter
\newcommand*\l@coltocauthor[2]{% % similar to chapter
\ifnum \c@tocdepth >\m@ne
\c@ll@chapseci
\setlength{\@tempdima}{\tocauthorindent}% eliminate any spaces here
\tocauthorfont %% italic ToC entry
\c@ll@chapsecii{#1}{}
\penalty\@highpenalty % discourage page break
\endgroup
\fi}
\else
\newcommand*\l@coltocauthor[2]{% % similar to section
\ifnum \c@tocdepth >\z@
\c@ll@chapseci
\setlength{\@tempdima}{\tocauthorindent}% eliminate any spaces here
\tocauthorfont %% italic ToC entry
\c@ll@chapsecii{#1}{}
\penalty\@highpenalty % discourage page break
\endgroup
\fi}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\published}
% \begin{macro}{\pubfont}
% \begin{macro}{\l@published}
% |\published[|\meta{short}|]{|\meta{long}|}| adds \meta{long} to the
% body of the document. It also adds \meta{long} to the ToC, unless the
% optional argument is present, in which case \meta{short} is added
% to the ToC.
%
% In the body of the document \meta{long} is typeset using |\pubfont|.
% The ToC entry is typeset by |\l@published|.
% Note that a page number is not printed.
% \changes{v0.51}{2001/07/09}{Save value of \cs{published}}
% \begin{macrocode}
\newcommand{\published}[2][\@empty]{%
\c@lpubtrue
\ifc@lnopubintoc\else
\ifx #1\@empty
\gdef\savec@lpublished{#2}
\else
\gdef\savec@lpublished{#1}
\fi
\fi
\ifc@lnopubindoc\else
{\parindent \z@ \pubfont #2\par\nobreak}
\fi
}
\newcommand{\pubfont}{\normalfont\centering}
% \end{macrocode}
% As the published information is unlikely to be in the ToC without
% prior title or author information, don't encourage a prior break,
% but also don't try and prevent one afterwards either.
% \changes{v0.42}{2001/04/04}{Changed pagebreak penalties in \cs{l@published}}
% \changes{v0.53}{2001/09/05}{Fixed extraneous space in \cs{l@published}}
%
% \begin{macrocode}
\ifc@lhaschapter
\newcommand*\l@published[2]{% % similar to chapter
\ifnum \c@tocdepth >\m@ne
\c@ll@chapseci
\setlength{\@tempdima}{\tocpubindent}% eliminate any spaces here
\tocpubfont %% normal font ToC entry
\c@ll@chapsecii{#1}{}
\endgroup
\fi}
\else
\newcommand*\l@published[2]{% % similar to section
\ifnum \c@tocdepth >\z@
\c@ll@chapseci
\setlength{\@tempdima}{\tocpubindent}% eliminate any spaces here
\tocpubfont %% normal font ToC entry
\c@ll@chapsecii{#1}{}
\endgroup
\fi}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\erasetitling}
% This macro sets the |\coltoctitle|, |\coltocauthor| and |\published|
% flags to FALSE.
% \begin{macrocode}
\newcommand{\erasetitling}{\c@ltoctitlefalse\c@ltocauthorfalse\c@lpubfalse}
% \end{macrocode}
% \end{macro}
%
%
% \begin{environment}{papers}
% The |papers| environment has one optional argument,
% default |\cleardoublepage| which gets executed at the start of the
% environment. Then the appropriate changes to the kernel commands are
% executed.
% \begin{macrocode}
\newenvironment{papers}[1][\cleardoublepage]{%
#1
\setuppapers
}{%
\takedownpapers
}
% \end{macrocode}
% \end{environment}
%
% \begin{macro}{\setuppapers}
% This macro executes the kernel modifications within the |papers|
% environment. Various options are also checked and implemented if required.
% Sectional numbering is reset to zero. Imported files can't |\include|
% other files, so |\include| is replaced by |\input|. If |\chapter| is
% defined, then the chapter typesetting is redefined to look more like
% a |\section| heading.
% \changes{v0.41}{2000/06/18}{\cs{def}ed \cs{maketitle} instead of \cs{let}ing
% inside \cs{setuppapers} to ignore any titling package redefinitions}
% \changes{v0.52}{2001/08/25}{Added \cs{c@lbLoadClass} to \cs{setuppapers}}
% \changes{v0.6}{2002/08/24}{Added onebib and combinedbib options code to \cs{setuppapers}}
% \changes{v0.62}{2003/06/30}{Left \cs{bibliographystyle} unaltered}.
% \begin{macrocode}
\newcommand{\setuppapers}{%
\let\documentclass\c@lbdocumentclass
\ifc@lpackages\else \let\usepackage\c@lbusepackage \fi
\let\document\c@lbdocument
\let\enddocument\c@lbenddocument
\let\LoadClass\c@lbLoadClass
%% \let\maketitle\c@lbmaketitle
\def\maketitle{\c@lbmaketitle}
\let\@writefile\c@lb@writefile
\let\@starttoc\c@lb@starttoc
\ifc@lnomaketitle \let\maketitle\relax \fi
\ifc@lnotoc \let\tableofcontents\relax \fi
\ifc@lnolof \let\listoffigures\relax \fi
\ifc@lnolot \let\listoftables\relax \fi
\ifc@lmaintoc \let\addtocontents\c@lbaddtocontents \fi
\let\label\c@lblabel
\let\@setref\c@lb@setref
\let\newlabel\c@lbnewlabel
\let\ref\c@lbref
\let\pageref\c@lbpageref
%%% \renewcommand{\bibliographystyle}[1]{}
\ifc@lcombib
\else
\ifc@lonebib
\renewcommand{\bibliography}[1]{}
\fi
\fi
\let\@citex\c@lb@citex
\let\bibcite\c@lbbibcite
\let\nocite\c@lbnocite
\ifc@lhaschapter
\renewcommand{\chapter}{\@startsection{chapter}{0}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
\fi
\c@ltoctitlefalse
\c@ltocauthorfalse
\c@lpubfalse
\let\pagenumbering\c@lbpagenumbering
\setcounter{colpage}{\value{page}}
\let\pagestyle\c@lbpagestyle
\pagestyle{\c@lastyle}
\let\include\input
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\takedownpapers}
% This macro executes the actions, if any, at the end of the |papers|
% environment.
% \begin{macrocode}
\newcommand{\takedownpapers}{%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\emptyAtBeginDocument}
% This macro empties tokens stored for use at |\begin{document}| time.
% \changes{v0.51}{2003/07/17}{Added \cs{emptyAtBeginDocument}}
% \begin{macrocode}
\newcommand{\emptyAtBeginDocument}{\let\@begindocumenthook\@empty}
% \end{macrocode}
% \end{macro}
%
% Finally, use the appropriate revised kernel commands for the main document.
% \changes{v0.41}{2000/06/18}{Moved main document \cs{maketitle} letting to
% its begin document}
% \begin{macrocode}
\let\document\c@ladocument
\let\enddocument\c@laenddocument
%%\let\maketitle\c@lamaketitle
\let\pagestyle\c@lapagestyle
\pagestyle{combine}
% \end{macrocode}
%
%
%
%
% The end of this class.
% \begin{macrocode}
%</usc>
% \end{macrocode}
%
% \section{The \Lpack{combinet} package code} \label{packcode}
%
%
% \begin{macrocode}
%<*pck>
% \end{macrocode}
% The usual preliminaries. The \Lpack{combine} class is expected.
% \changes{v0.53}{2001/09/05}{combinet package now version 0.2}
% \changes{v0.64}{2004/03/06}{combinet package now version 0.2a}
% \begin{macrocode}
\@ifclassloaded{combine}{}{%
\PackageError{combinet}{The `combine' class is expected}{\@ehc}%
}
% \end{macrocode}
%
% \begin{macro}{\ifc@lnomtitle}
% \begin{macro}{\ifc@lnomauthor}
% \begin{macro}{\ifc@lnothanks}
% \begin{macro}{\ifc@lpubopt}
% \begin{macro}{\ifc@lpubtop}
% \begin{macro}{\ifc@lpubs}
% Booleans for implementing the options.
% \begin{macrocode}
\newif\ifc@lnomtitle
\c@lnomtitlefalse
\newif\ifc@lnomauthor
\c@lnomauthorfalse
\newif\ifc@lnothanks
\c@lnothanksfalse
\newif\ifc@lpubopt
\c@lpuboptfalse
\newif\ifc@lpubtop
\c@lpubtopfalse
\newif\ifc@lpubs
\c@lpubsfalse
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Declare and execute the options.
% \begin{macrocode}
\DeclareOption{nomtitle}{\c@lnomtitletrue}
\DeclareOption{nomauthor}{\c@lnomauthortrue}
\DeclareOption{nothanks}{\c@lnothankstrue}
\DeclareOption{pub}{\c@lpubopttrue\c@lpubtopfalse\c@lpubstrue}
\DeclareOption{pubtop}{\c@lpubtoptrue\c@lpuboptfalse\c@lpubstrue}
\ProcessOptions\relax
% \end{macrocode}
%
% \begin{macro}{\published}
% \begin{macro}{\c@lpubtoc}
% \begin{macro}{\c@lpubbody}
% In order to implement either of the \Lopt{pub} options, the |\published|
% command must be modified to delay printing.
% \begin{macrocode}
\ifc@lpubs
\renewcommand{\published}[2][\@empty]{%
\c@lpubtrue
\ifx #1\@empty
\gdef\c@lpubtoc{#2}
\else
\gdef\c@lpubtoc{#1}
\fi
\gdef\c@lpubbody{#2}
}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\title}
% \begin{macro}{\author}
% To implement the \Lopt{nothanks} option, the |\title| and |\author|
% kernel commands must be extended to save their values.
%
% Originally I used |\xdef| below which worked unless there was some
% command other than |\thanks| in the title or author text.
% David Kastrup\footnote{At \texttt{dak@neuroinformatik.ruhr-uni-bochum.de}.}
% and Donald Arseneau\footnote{At \texttt{asnd@triumf.ca}.}
% both pointed out the use of |\protected@xdef|.
% Barbara Beeton\footnote{\texttt{bnb@ams.org}} suggested adding the |\unskip|
% to the redefinition of |\and| in order to remove any preceeding spaces when
% it gets printed in the ToC.
% \changes{v0.4}{2000/06/09}{Added \cs{unskip} to \cs{and} redefinition}
% \changes{v0.41}{2000/06/18}{Appended to \cs{title} and \cs{author} definitions}
% \begin{macrocode}
\appendiargdef{\title}{%
\begingroup
\renewcommand{\thanks}[1]{}
\protected@xdef\c@l@title{#1}
\endgroup
}
\appendiargdef{\author}{%
\begingroup
\renewcommand{\thanks}[1]{}
\renewcommand{\and}{\unskip, }
\protected@xdef\c@l@author{#1}
\endgroup
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lbmaketitle}
% The |\c@lbmaketitle| command is (re)defined so that it adds the title
% and author (if given) to the main ToC. If |\coltoctitle| and/or
% |\coltocauthor| have been used then nothing is done with the title
% and/or author respectively.
% \changes{v0.53}{2001/09/05}{Added empty \cs{numberline} in \cs{c@lbmaketitle}}
% \changes{v0.64}{2004/03/06}{Changed \cs{c@laaddtocontents} for titles to
% \cs{c@laaddcontentsline} in \cs{c@lbmaketitle}}
% \begin{macrocode}
\def\c@lbmaketitle{\par
\begingroup
\let\newpage\relax
\let\@maketitle\c@lb@maketitle
\ifc@lpub
\ifc@lpubtop
\ifc@lnopubindoc\else
{\parindent\z@ \pubfont \c@lpubbody\par\nobreak}
\fi
\fi
\fi
\c@lmtitle %% typeset the title block
\endgroup
\setcounter{footnote}{0}
\begingroup
\let\thanks\@empty
\ifc@ltoctitle\else
\ifc@lnomtitle\else
\ifx\@title\@empty\else
\ifc@lnothanks
% \end{macrocode}
% I originally used
% \begin{verbatim}
% \c@laaddtocontents{toc}%
% {\protect\contentsline{coltoctitle}%
% {\protect\numberline{}\c@l@title}{\thecolpage}}
% \end{verbatim}
% below, but James Szinger\footnote{Email, 2004/03/05, \texttt{szinger@lanl.gov}}
% asked me to change to \verb?\c@laaddcontentsline? instead
% (which I should have done, looking back I've no idea why I didn't) to help
% with using hyperref, which he said required redefining
% \verb?\c@laaddcontentsline? to be compatible with hyperref's (hyperref never
% seems to bother with trying to be compatible with other classes though).
% \begin{macrocode}
\c@laaddcontentsline{toc}%
{coltoctitle}{\protect\numberline{}\c@l@title}%
\else
\c@laaddcontentsline{toc}%
{coltoctitle}{\protect\numberline{}\@title}%
\fi
\fi
\fi
\fi
\ifc@ltocauthor\else
\ifc@lnomauthor\else
\ifx\@author\@empty\else
\ifc@lnothanks
\c@laaddcontentsline{toc}%
{coltocauthor}{\protect\numberline{}\c@l@author}
\else
\c@laaddcontentsline{toc}%
{coltocauthor}{\protect\numberline{}\@author}
\fi
\fi
\fi
\fi
\endgroup
\ifc@lpub
\ifc@lpubopt
\ifc@lnopubindoc\else
{\parindent\z@ \pubfont \c@lpubbody\par\nobreak}
\fi
\fi
\ifc@lpubs
\ifc@lnopubintoc\else
\c@laaddcontentsline{toc}{published}{\protect\numberline{}\c@lpubtoc}
\fi
\fi
\fi
\c@lmtitlempty
}
% \end{macrocode}
% \end{macro}
%
%
% The end of this package
% \begin{macrocode}
%</pck>
% \end{macrocode}
%
%
% \section{The \Lpack{combnat} package code} \label{natpackcode}
%
% This package calls the \Lpack{natbib} package~\cite{NATBIB}
% and then makes some minor changes to some of its macro definitions.
% \changes{v0.6}{2002/08/24}{Added onebib option processing to combnat package}
%
% \begin{macrocode}
%<*natpack>
% \end{macrocode}
% The usual preliminaries. The \Lpack{natbib} package is required
% and all options are passed to it to deal with.
% \changes{v0.5}{2001/07/03}{Added the combnat package}
% \changes{v0.6}{2002/08/24}{Added combine class check to the combnat package}
% \changes{v0.6}{2002/08/24}{combnat package is now version 0.2}
% \changes{v0.61}{2003/05/22}{combnat package is now version 0.21}
% \changes{v0.61}{2003/05/22}{Somehow removed extraneous space from combnat package}
% \changes{v0.7}{2010/03/22}{combnat bug fix thanks to Nicola Talbot}
% \begin{macrocode}
\@ifclassloaded{combine}{}{%
\PackageError{combnat}{The `combine' class is expected}{\@ehc}}
\RequirePackageWithOptions{natbib}
% \end{macrocode}
%
% For multiple bibliographies (|\c@lonebibfalse|)
% the change consists of replacing
% \Lpack{natbib}'s
% naming of citation labels in the \file{.aux} files by the form
% used by the \Lpack{combine} class. That is, the |b@| in each
% code fragment like |b@#...| or |b@\...| is replaced by
% |B?\jobname?@...|.
%
% For a single main bibliography |\c@lonebibtrue|, implementation is much
% easier, merely ensuring that the stuff gets written to the main
% *.aux file.
%
%
% \begin{macro}{\c@lNATwritemainbib}
% \begin{macro}{\c@lNATwritemainbibdate}
% We have to write different biblabels to different files. These write
% to the main *.aux file.
% \begin{macrocode}
\newcommand{\c@lNATwritemainbib}{%
\if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
\@ifundefined{b@\@citeb\@extra@b@citeb}{%
{\reset@font\bfseries?}
\NAT@citeundefined\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}}}
\newcommand{\c@lNATwritemainbibdate}{%
\if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
{\reset@font\bfseries ?}\NAT@citeundefined
\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}
\def\NAT@date{}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lNATwritelocalbib}
% \begin{macro}{\c@lNATwritelocalbibdate}
% We have to write different biblabels to different files. These write
% to the local *.aux files.
% \begin{macrocode}
\newcommand{\c@lNATwritelocalbib}{%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{%
{\reset@font\bfseries?}
\NAT@citeundefined\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}}}
\newcommand{\c@lNATwritelocalbibdate}{%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{\@citea%
{\reset@font\bfseries ?}\NAT@citeundefined
\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}
\def\NAT@date{}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\c@lNAT@citexnum@swatrue}
% Holds some of the internals of the original |\NAT@citexnum|.
% \begin{macrocode}
\newcommand{\c@lNAT@citexnum@swatrue}{%
\ifnum\NAT@ctype>1\relax\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\ifnum\NAT@ctype=2\relax\NAT@test{\NAT@ctype}%
\else\NAT@alias
\fi\hyper@natlinkend\else
\ifnum\NAT@sort>1\relax
\begingroup\catcode`\_=8
\ifcat _\ifnum\z@<0\NAT@num _\else A\fi
\global\let\NAT@nm=\NAT@num \else \gdef\NAT@nm{-2}\fi
\ifcat _\ifnum\z@<0\NAT@last@num _\else A\fi
\global\@tempcnta=\NAT@last@num \global\advance\@tempcnta by\@ne
\else \global\@tempcnta\m@ne\fi
\endgroup
\ifnum\NAT@nm=\@tempcnta
\ifx\NAT@last@yr\relax
\edef\NAT@last@yr{\@citea \mbox{\noexpand\citenumfont\NAT@num}}%
\else
\edef\NAT@last@yr{--\penalty\@m\mbox{\noexpand\citenumfont\NAT@num}}%
\fi
\else
\NAT@last@yr \@citea \mbox{\citenumfont\NAT@num}%
\let\NAT@last@yr\relax
\fi
\else
\@citea \mbox{\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
{\citenumfont\NAT@num}\hyper@natlinkend}%
\fi
\fi
\def\@citea{\NAT@sep\penalty\@m\NAT@space}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NAT@citexnum}
% We redefine the original |\NAT@citexnum| to write for the main file.
% \begin{macrocode}
\def\NAT@citexnum[#1][#2]#3{%
\NAT@sort@cites{#3}%
\let\@citea\@empty
\@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
\@for\@citeb:=\NAT@cite@list\do
{\edef\@citeb{\expandafter\@firstofone\@citeb}%
\c@lNATwritemainbib %%% change here
{\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name
\fi
\ifNAT@swa
\c@lNAT@citexnum@swatrue
\else
\ifcase\NAT@ctype\relax
\ifx\NAT@last@nm\NAT@nm \NAT@yrsep\penalty\@m\NAT@space\else
\@citea \NAT@test{1}\ \NAT@@open
\if*#1*\else#1\ \fi\fi \NAT@mbox{%
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
{\citenumfont\NAT@num}\hyper@natlinkend}%
\def\@citea{\NAT@@close\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@test{\NAT@ctype}\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@test{\NAT@ctype}\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\fi
\fi
}}%
\ifnum\NAT@sort>1\relax\NAT@last@yr\fi
\ifNAT@swa\else\ifnum\NAT@ctype=0\if*#2*\else
\NAT@cmt#2\fi \NAT@@close\fi\fi}{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbNAT@citexnum}
% A local version of |\NAT@citexnum|.
% \begin{macrocode}
\def\c@lbNAT@citexnum[#1][#2]#3{%
\ifc@lcombib\c@laNATnocite{#3}\fi %%% change here
\NAT@sort@cites{#3}%
\let\@citea\@empty
\@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
\@for\@citeb:=\NAT@cite@list\do
{\edef\@citeb{\expandafter\@firstofone\@citeb}%
\c@lNATwritelocalbib %%% change here
{\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
\ifNAT@swa
\c@lNAT@citexnum@swatrue
\else
\ifcase\NAT@ctype\relax
\ifx\NAT@last@nm\NAT@nm \NAT@yrsep\penalty\@m\NAT@space\else
\@citea \NAT@test{1}\ \NAT@@open
\if*#1*\else#1\ \fi\fi \NAT@mbox{%
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
{\citenumfont\NAT@num}\hyper@natlinkend}%
\def\@citea{\NAT@@close\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@test{\NAT@ctype}\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@test{\NAT@ctype}\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\fi\fi
}}%
\ifnum\NAT@sort>1\relax\NAT@last@yr\fi
\ifNAT@swa\else\ifnum\NAT@ctype=0\if*#2*\else
\NAT@cmt#2\fi \NAT@@close\fi\fi}{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\c@lNAT@citex@swatrue}
% Holds some of the internals of the original |\NAT@citex|.
% \begin{macrocode}
\newcommand{\c@lNAT@citex@swatrue}{%
\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\NAT@date\hyper@natlinkend
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
\hyper@natlinkend
\else
\unskip\
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
\hyper@natlinkend
\fi
\else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@aysep\ }{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\fi
\fi
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\fi \def\@citea{\NAT@sep\ }%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@laNAT@citex}
% We redefine the original |\NAT@citex| macro for the main document.
% \begin{macrocode}
\def\NAT@citex%
[#1][#2]#3{%
\NAT@sort@cites{#3}%
\let\@citea\@empty
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
\@for\@citeb:=\NAT@cite@list\do
{\edef\@citeb{\expandafter\@firstofone\@citeb}%
\c@lNATwritemainbibdate %%%% change here
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
\ifNAT@swa
\c@lNAT@citex@swatrue
\else
\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
\hyper@natlinkend
\else\unskip\
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
\hyper@natlinkend
\fi
\else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\ \NAT@@open\if*#1*\else#1\ \fi}%
{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend\fi
\fi
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\fi \if\relax\NAT@date\relax\def\@citea{\NAT@sep\ }%
\else\def\@citea{\NAT@@close\NAT@sep\ }\fi
\fi
}}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
\if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbNAT@citex}
% The local version of |\NAT@citex|.
% \begin{macrocode}
\def\c@lbNAT@citex[#1][#2]#3{%
\ifc@lcombib \c@laNATnocite{#3} \fi %%%% change here
\NAT@sort@cites{#3}%
\let\@citea\@empty
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
\@for\@citeb:=\NAT@cite@list\do
{\edef\@citeb{\expandafter\@firstofone\@citeb}%
\c@lNATwritelocalbibdate %%%% change here
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
\ifNAT@swa
\c@lNAT@citex@swatrue
\else
\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
\hyper@natlinkend
\else\unskip\
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
\hyper@natlinkend
\fi
\else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\ \NAT@@open\if*#1*\else#1\ \fi}%
{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend\fi
\fi
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\fi \if\relax\NAT@date\relax\def\@citea{\NAT@sep\ }%
\else\def\@citea{\NAT@@close\NAT@sep\ }\fi
\fi
}}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
\if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@laNATnocite}
% \begin{macro}{\nocite}
% A main document version of the natbib |\nocite|.
% \begin{macrocode}
\newcommand\c@laNATnocite[1]{\@bsphack
\@for\@citeb:=#1\do{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
\if*\@citeb\else
\@ifundefined{b@\@citeb\@extra@b@citeb}{%
\NAT@citeundefined \PackageWarning{natbib}%
{Citation `\@citeb' undefined}}{}\fi}%
\@esphack}
\renewcommand{\nocite}[1]{\c@laNATnocite{#1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@lbNATnocite}
% The local version pf |\nocite|.
% \begin{macrocode}
\newcommand\c@lbNATnocite[1]{\@bsphack
\@for\@citeb:=#1\do{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\if*\@citeb\else
\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{%
\NAT@citeundefined \PackageWarning{natbib}%
{Citation `\@citeb' undefined}}{}\fi}%
\@esphack}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NAT@wrout}
% Main version of the original |\NAT@wrout|.
% \begin{macrocode}
\renewcommand{\NAT@wrout}[5]{%
\if@filesw
{\let\protect\noexpand\let~\relax
\immediate
\write\@mainaux{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
\ignorespaces}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbNAT@wrout}
% Local version of the original |\NAT@wrout|.
% \begin{macrocode}
\newcommand{\c@lbNAT@wrout}[5]{%
\if@filesw
{\let\protect\noexpand\let~\relax
\immediate
\write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
\ignorespaces}
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\c@laNAT@parse}
% \begin{macro}{\c@lbNAT@parse}
% Main and local versions of |\NAT@parse|.
% \begin{macrocode}
\newcommand\c@laNAT@parse[1]{{%
\let\protect=\@unexpandable@protect\let~\relax
\let\active@prefix=\@gobble
\xdef\NAT@temp{\csname b@#1\@extra@b@citeb\endcsname}}%
\expandafter\NAT@split\NAT@temp?????@@%
\expandafter\NAT@parse@date\NAT@date??????@@%
\ifciteindex\NAT@index\fi}
\newcommand\c@lbNAT@parse[1]{{%
\let\protect=\@unexpandable@protect\let~\relax
\let\active@prefix=\@gobble
\xdef\NAT@temp{\csname B?\jobname?@#1\@extra@b@citeb\endcsname}}%
\expandafter\NAT@split\NAT@temp?????@@%
\expandafter\NAT@parse@date\NAT@date??????@@%
\ifciteindex\NAT@index\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@laNAT@lbibitem}
% \begin{macro}{\c@lbNAT@lbibitem}
% Main and local version of |\@lbibitem|.
% \begin{macrocode}
\def\c@laNAT@lbibitem[#1]#2{%
\if\relax\@extra@b@citeb\relax\else
\@ifundefined{br@#2\@extra@b@citeb}{}{%
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
\@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
\item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\@biblabel{\NAT@num}%
\hyper@natanchorend]%
\NAT@ifcmd#1(@)(@)\@nil{#2}}
\def\c@lbNAT@lbibitem[#1]#2{%
\if\relax\@extra@b@citeb\relax\else
\@ifundefined{br@#2\@extra@b@citeb}{}{%
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
\@ifundefined{B?\jobname?@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
\item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\@biblabel{\NAT@num}%
\hyper@natanchorend]%
\NAT@ifcmd#1(@)(@)\@nil{#2}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@laNATbibcite}
% \begin{macro}{\c@lbNATbibcite}
% Main and local versions of |\NATbibcite|.
% \begin{macrocode}
\newcommand\c@laNATbibcite[2]{\@ifundefined{b@#1\@extra@binfo}\relax
{\NAT@citemultiple
\PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
\global\@namedef{b@#1\@extra@binfo}{#2}}
\newcommand\c@lbNATbibcite[2]{\@ifundefined{B?\jobname?@#1\@extra@binfo}\relax
{\NAT@citemultiple
\PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
\global\@namedef{B?\jobname?@#1\@extra@binfo}{#2}}
\ifc@lonebib
\ifc@lcombib
\else
\renewcommand\c@lbNATbibcite[2]{\@ifundefined{b@#1\@extra@binfo}\relax
{\NAT@citemultiple
\PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
\global\@namedef{B?\jobname?@#1\@extra@binfo}{#2}}
\fi
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@laNAT@testdef}
% \begin{macro}{\c@lbNAT@testdef}
% Main and local versions of |\NAT@testdef|.
% \begin{macrocode}
\newcommand\c@laNAT@testdef[2]{%
\def\NAT@temp{#2}\expandafter \ifx \csname b@#1\@extra@binfo\endcsname
\NAT@temp \else \ifNAT@swa \NAT@swafalse
\PackageWarningNoLine{natbib}{Citation(s) may have
changed.\MessageBreak
Rerun to get citations correct}\fi\fi}
\newcommand\c@lbNAT@testdef[2]{%
\def\NAT@temp{#2}\expandafter \ifx \csname B?\jobname?@#1\@extra@binfo\endcsname
\NAT@temp \else \ifNAT@swa \NAT@swafalse
\PackageWarningNoLine{natbib}{Citation(s) may have
changed.\MessageBreak
Rerun to get citations correct}\fi\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@laNAT@make@cite@list}
% \begin{macro}{\c@lbNAT@make@cite@list}
% Main and local versions of |\NAT@make@cite@list|.
% \begin{macrocode}
\ifnum\NAT@sort>0
\begingroup \catcode`\_=8
\gdef\c@laNAT@make@cite@list{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\@ifundefined{b@\@citeb\@extra@b@citeb}{\def\NAT@num{A}}%
{\NAT@parse{\@citeb}}%
\ifcat _\ifnum\z@<0\NAT@num _\else A\fi
\@tempcnta\NAT@num \relax
\ifnum \@tempcnta>\@tempcntb
\edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
\edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
\@tempcntb\@tempcnta
\else
\let\NAT@@cite@list=\NAT@cite@list \def\NAT@cite@list{}%
\edef\NAT@num@list{\expandafter\NAT@num@celt \NAT@num@list \@gobble @}%
{\let\@celt=\NAT@celt\NAT@num@list}%
\fi
\else
\edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}%
\fi}
\endgroup
\begingroup \catcode`\_=8
\gdef\c@lbNAT@make@cite@list{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{\def\NAT@num{A}}%
{\NAT@parse{\@citeb}}%
\ifcat _\ifnum\z@<0\NAT@num _\else A\fi
\@tempcnta\NAT@num \relax
\ifnum \@tempcnta>\@tempcntb
\edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
\edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
\@tempcntb\@tempcnta
\else
\let\NAT@@cite@list=\NAT@cite@list \def\NAT@cite@list{}%
\edef\NAT@num@list{\expandafter\NAT@num@celt \NAT@num@list \@gobble @}%
{\let\@celt=\NAT@celt\NAT@num@list}%
\fi
\else
\edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}%
\fi}
\endgroup
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% Some things are done at the end of a document.
%
% \begin{macrocode}
\AtEndDocument{%
\ifNAT@stdbst\if@filesw\immediate\write
\@mainaux{\string\global\string\NAT@numberstrue}\fi\fi
}
\AtEndDocument{\NAT@swatrue\let\bibcite\NAT@testdef}
% \end{macrocode}
%
% \begin{macro}{\c@laNAT@set@cites}
% Main version of |\NAT@set@cites|.
% \begin{macrocode}
\newcommand{\c@laNAT@set@cites}{\ifNAT@numbers
\ifNAT@super \let\@cite\NAT@citesuper
\def\NAT@mbox##1{\unskip\nobreak\hspace{1\p@}\textsuperscript{##1}}%
\let\citeyearpar=\citeyear
\let\NAT@space\relax\else
\let\NAT@mbox=\mbox
\let\@cite\NAT@citenum \def\NAT@space{ }\fi
\let\@citex\NAT@citexnum
\ifx\@biblabel\@empty\let\@biblabel\NAT@biblabelnum\fi
\let\@bibsetup\NAT@bibsetnum
\def\natexlab##1{}%
\else
\let\@cite\NAT@cite
\let\@citex\NAT@citex
\let\@biblabel\NAT@biblabel
\let\@bibsetup\NAT@bibsetup
\def\natexlab##1{##1}%
\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbNAT@set@cites}
% Local version of |\NAT@set@cites|.
% \begin{macrocode}
\newcommand{\c@lbNAT@set@cites}{\ifNAT@numbers
\ifNAT@super \let\@cite\NAT@citesuper
\def\NAT@mbox##1{\unskip\nobreak\hspace{1\p@}\textsuperscript{##1}}%
\let\citeyearpar=\citeyear
\let\NAT@space\relax\else
\let\NAT@mbox=\mbox
\let\@cite\NAT@citenum \def\NAT@space{ }\fi
\let\@citex\NAT@citexnum
\ifx\@biblabel\@empty\let\@biblabel\NAT@biblabelnum\fi
\let\@bibsetup\NAT@bibsetnum
\def\natexlab##1{}%
\else
\let\@cite\NAT@cite
\let\@citex\NAT@citex
\let\@biblabel\NAT@biblabel
\let\@bibsetup\NAT@bibsetup
\def\natexlab##1{##1}%
\fi}
% \end{macrocode}
% \end{macro}
%
% For the main document, use |\c@la...| to replace the |\NAT...| definitions.
% \begin{macrocode}
\let\NAT@parse\c@laNAT@parse
%%\let\nocite\c@laNATnocite
%%\let\NAT@wrout\c@laNAT@wrout
\let\@lbibitem\c@laNAT@lbibitem
\let\bibcite\c@laNATbibcite
\let\NAT@testdef\c@laNAT@testdef
%%\let\NAT@make@cite@list\c@laNAT@make@cite@list
%%\let\NAT@citexnum\c@laNAT@citexnum
%%\let\NAT@citex\c@laNAT@citex
% \end{macrocode}
%
% And similarly for imported documents
% \begin{macrocode}
\let\c@loldsetuppapers\setuppapers
\newcommand{\c@lNATsetuplocal}{%
\let\NAT@parse\c@lbNAT@parse
\let\nocite\c@lbNATnocite
\let\NAT@wrout\c@lbNAT@wrout
\let\@lbibitem\c@lbNAT@lbibitem
\let\bibcite\c@lbNATbibcite
\let\NAT@testdef\c@lbNAT@testdef
\let\NAT@make@cite@list\c@lbNAT@make@cite@list
\let\NAT@citexnum\c@lbNAT@citexnum
\let\NAT@citex\c@lbNAT@citex
\let\NAT@set@cites\c@lbNAT@set@cites
\c@lbNAT@set@cites
}
\renewcommand{\setuppapers}{%
\c@loldsetuppapers
\ifc@lcombib
\c@lNATsetuplocal
\else
\ifc@lonebib
\else
\c@lNATsetuplocal
\fi
\fi
}
% \end{macrocode}
%
%
% The end of this package
% \begin{macrocode}
%</natpack>
% \end{macrocode}
%
%
%
% \section{The \Lpack{combcite} package code} \label{citepackcode}
%
% This package calls the \Lpack{cite} package~\cite{CITE}
% and then makes some minor changes to some of its macro definitions.
% \changes{v0.63}{2003/11/09}{Added the combcite package}
%
% \begin{macrocode}
%<*citepack>
% \end{macrocode}
% The usual preliminaries. The \Lpack{cite} package is required
% and all options are passed to it to deal with.
% \begin{macrocode}
\@ifclassloaded{combine}{}{%
\PackageError{combcite}{The `combine' class is expected}{\@ehc}}
% \end{macrocode}
% By definition, we need the \Lpack{cite} package, but first have
% to set up some option handling.
% \begin{macro}{\ifc@lbsuperopt}
% \cs{ifc@lbsuperopt} is a flag for if the \Lpack{cite} \Lopt{superscript}
% option has been used.
% \begin{macrocode}
\newif\ifc@lbsuperopt
\c@lbsuperoptfalse
% \end{macrocode}
% \end{macro}
% Now do the options.
% \begin{macrocode}
\DeclareOption{super}{\ExecuteOptions{superscript}}
\DeclareOption{superscript}{\c@lbsuperopttrue
\PassOptionsToClass{superscript}{cite}}
\ProcessOptions
% \end{macrocode}
%
% We need the latest cite package (version 4.01 November 2003)
% \begin{macrocode}
\RequirePackageWithOptions{cite}[2003/11/04]
% \end{macrocode}
% Need special versions of various macros for imported papers,
% principally to handle writing to the .aux files.
% Indicate these by prepending `c@lb' to the name.
%
% \begin{macro}{\c@lbciten}
% \begin{macrocode}
\DeclareRobustCommand\c@lbciten[1]{%
\begingroup
\let\@safe@activesfalse\@empty
%% \c@lb@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
\@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
\@tempcntb\m@ne % \@tempcntb tracks highest number
\let\@h@ld\@empty % nothing held from list yet
\let\@citea\@empty % no punctuation preceding first
\let\@celt\delimiter % an unexpandable, but identifiable, token
\def\@cite@list{}% % empty list to start
\@for \@citeb:=\@no@sparg\do{\c@lb@make@cite@list}% make a sorted list of numbers
% After sorted citelist is made, execute it to compress citation ranges.
\@tempcnta\m@ne % no previous number
\let\@celt\@compress@cite \@cite@list % output number list with compression
\@h@ld % output anything held over
\endgroup
\@restore@auxhandle
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lb@make@cite@list}
%
% \begin{macrocode}
\def\c@lb@make@cite@list{%
\expandafter\let \expandafter\@B@citeB
\csname B?\jobname?@\@citeb\@extra@b@citeb \endcsname
\ifx\@B@citeB\relax % undefined: output ? and warning
\@citea {\bfseries ?}\let\@citea\citepunct \G@refundefinedtrue
\@warning {Citation `\@citeb' on page \thepage\space undefined}%
\oc@verbo \global\@namedef{B?\jobname?@\@citeb\@extra@b@citeb}{?}%
\else % defined % remove previous line to repeat warnings
\ifcat _\ifnum\z@<0\@B@citeB _\else A\fi % a positive number, put in list
\@addto@cite@list
\else % citation is not a number, output immediately
\@citea \citeform{\@B@citeB}\let\@citea\citepunct
\fi\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbcite}
% The revision to \cs{cite} depends on whether the \Lopt{superscript}
% option has been used.
% \begin{macrocode}
\ifc@lbsuperopt
\DeclareRobustCommand{\c@lbcite}{%
\@ifnextchar[{\@tempswatrue\c@lb@citex}{\@tempswafalse\c@lb@citew}}
\else
\DeclareRobustCommand{\c@lbcite}{%
\@ifnextchar[{\@tempswatrue\c@lb@citex}{\@tempswafalse\c@lb@citex[]}}
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lb@citex}
%
% \begin{macrocode}
\def\c@lb@citex[#1]#2{\@cite{\c@lbciten{#2}}{#1}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lb@citew}
%
% \begin{macrocode}
\def\c@lb@citew#1{\begingroup \leavevmode
\@if@fillglue \lastskip \relax \unskip
\def\@tempa{\@tempcnta\spacefactor
\/% this allows the last word to be hyphenated, and it looks better.
\@citess{\c@lbciten{#1}}\spacefactor\@tempcnta
\endgroup \@restore@auxhandle}%
\oc@movep\relax}% check for following punctuation (depending on options)
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@lbnocite}
%
% \begin{macrocode}
\DeclareRobustCommand\c@lbnocite[1]{%
\@bsphack \@nocite{#1}%
\@for \@citeb:=\@no@sparg\do{\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}%
{\G@refundefinedtrue\@warning{Citation `\@citeb' undefined}%
\oc@verbo \global\@namedef{B?\jobname?@\@citeb\@extra@b@citeb}{?}}{}}%
\@esphack}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@nocite}
%
% \begin{macrocode}
\def\@nocite#1{\begingroup\let\protect\string% normalize active chars
\xdef\@no@sparg{\expandafter\@ignsp#1 \: }\endgroup% and remove ALL spaces
\if@filesw \immediate\write\@newciteauxhandle % = \@auxout, except with multibib
{\string\citation {\@no@sparg}}\fi
}
% \end{macrocode}
% \end{macro}
%
% Finally, add the revision to \cs{setuppapers}.
% \begin{macrocode}
\g@addto@macro{\setuppapers}{\let\cite\c@lbcite}
\g@addto@macro{\setuppapers}{\let\citenum\c@lbciten}
\g@addto@macro{\setuppapers}{\let\citeonline\c@lbciten}
% \end{macrocode}
%
%
% The end of this package
% \begin{macrocode}
%</citepack>
% \end{macrocode}
%
%
%
% \appendix
% \section{Original code}
%
% This section presents the original kernel code before modification.
%
% The |\documentclass| macro is specified in \file{ltclass.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\documentclass{%
% \let\documentclass\@twoclasseserror
% \if@compatability\else\let\usepackage\RequirePackage\fi
% \@fileswithoptions\@clsextension}
% \@onlypreamble\documentclass
% \end{verbatim}
% \end{small}\par
%
% The |document| environment is specified between \file{ltfiles.dtx} and
% \file{ltmiscen.dtx}. The |\document| command is given in \file{ltfiles.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\document{\endgroup
% \ifx\@unusedoptionlist\@empty\else
% \@latex@warning@no@line{Unused global option(s):^^J%
% \@spaces[\@unusedoptionlist]}%
% \fi
% \@colht\textheight
% \@colroom\textheight \vsize\textheight
% \columnwidth\textwidth
% \@clubpenalty\clubpenalty
% \if@twocolumn
% \advance\columnwidth -\columnsep
% \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
% \fi
% \hsize\columnwidth \linewidth\hsize
% \begingroup\@floatplacement\@dblfloatplacement
% \makeatletter\let\@writefile\@gobbletwo
% \global \let \@multiplelabels \relax
% \@input{\jobname.aux}%
% \endgroup
% \if@filesw
% \immediate\openout\@mainaux\jobname.aux
% \immediate\write\@mainaux{\relax}%
% \fi
% \process@table
% \let\glb@currsize\@empty
% \normalsize
% \everypar{}%
% \ifx\normalsfcodes\@empty
% \ifnum\sfcode`\.=\@m
% \let\normalsfcodes\frenchspacing
% \else
% \let\normalsfcodes\nonfrenchspacing
% \fi
% \fi
% \@noskipsecfalse
% \let \@refundefined \relax
% \let\AtBeginDocument\@firstofone
% \@begindocumenthook
% \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
% \global\@maxdepth\maxdepth
% \global\let\@begindocumenthook\@undefined
% \ifx\@listfiles\@undefined
% \global\let\@filelist\relax
% \global\let\@addtofilelist\@gobble
% \fi
% \gdef\do##1{\global\let ##1\@notprerr}%
% \@preamblecmds
% \global\let \@nodocument \relax
% \global\let\do\noexpand
% \ignorespaces}
% \@onlypreamble\document
% \end{verbatim}
% \end{small}\par
% The |\enddocument| macro is specified in \file{ltmiscen.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\enddocument{%
% \@enddocumenthook
% \@checkend{document}%
% \clearpage
% \begingroup
% \if@filesw
% \immediate\closeout\@mainaux
% \let\@setckpt\@gobbletwo
% \let\@newl@bel\@testdef
% \@tempswafalse
% \makeatletter \input\jobname.aux
% \fi
% \@dofilelist
% \ifdim \font@submax >\fontsubfuzz\relax
% \@font@warning{Size substitutions with differences\MessageBreak
% up to \font@submax\space have occured.\@gobbletwo}%
% \fi
% \@defaultsubs
% \@refundefined
% \if@filesw
% \ifx \@multiplelabels \relax
% \if@tempswa
% \@latex@warning@no@line{Label(s) may have changed.
% Rerun to get cross-references right}%
% \fi
% \else
% \@multiplelabels
% \fi
% \fi
% \endgroup
% \deadcycles\z@\@@end}
% \end{verbatim}
% \end{small}\par
%
% |\maketitle| is defined by each class. The following is from
% \file{classes.dtx} for the \Lpack{book}, \Lpack{report} and \Lpack{article}
% classes.
% \par\begin{small}\begin{verbatim}
% \if@titlepage
% \newcommand{\maketitle}{\begin{titlepage}%
% \let\footnotesize\small
% \let\footnoterule\relax
% \let \footnote \thanks
% \null\vfil
% \vskip 60\p@
% \begin{center}%
% {\LARGE \@title \par}%
% \vskip 3em%
% {\large
% \lineskip .75em%
% \begin{tabular}[t]{c}%
% \@author
% \end{tabular}\par}%
% \vskip 1.5em%
% {\large \@date \par}%
% \end{center}\par
% \@thanks
% \vfil\null
% \end{titlepage}%
% \setcounter{footnote}{0}%
% \global\let\thanks\relax
% \global\let\maketitle\relax
% \global\let\@thanks\@empty
% \global\let\@author\@empty
% \global\let\@date\@empty
% \global\let\@title\@empty
% \global\let\title\relax
% \global\let\author\relax
% \global\let\date\relax
% \global\let\and\relax
% } % end titlepage \maketitle
% \else
% \newcommand{\maketitle}{\par
% \begingroup
% \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
% \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
% \long\def\@makefntext##1{\parindent 1em\noindent
% \hb@xt@1.8em{%
% \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
% \if@twocolumn
% \ifnum \col@number=\@ne
% \@maketitle
% \else
% \twocolumn[\@maketitle]%
% \fi
% \else
% \newpage
% \global\@topnum\z@
% \@maketitle
% \fi
% \thispagestyle{plain}\@thanks
% \endgroup
% \setcounter{footnote}{0}%
% \global\let\thanks\relax
% \global\let\maketitle\relax
% \global\let\@maketitle\relax
% \global\let\@thanks\@empty
% \global\let\@author\@empty
% \global\let\@date\@empty
% \global\let\@title\@empty
% \global\let\title\relax
% \global\let\author\relax
% \global\let\date\relax
% \global\let\and\relax
% } % end non-titlepage \maketitle
%
% \def\@maketitle{%
% \newpage
% \null
% \vskip 2em%
% \begin{center}%
% \let \footnote \thanks
% {\LARGE \@title \par}%
% \vskip 1.5em%
% {\large
% \lineskip .5em%
% \begin{tabular}[t]{c}%
% \@author
% \end{tabular}\par}%
% \vskip 1em%
% {\large \@date}%
% \end{center}\par
% \vskip 1.5em}
% \fi
% \end{verbatim}
% \end{small}\par
%
% The definitions of |\title| and friends are in \file{ltsect.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\title#1{\gdef\@title{#1}}
% \def\@title{\@latex@error{No \noexpand\title given}\@ehc}
% \def\author#1{\gdef\@author{#1}}
% \def\@author{\@latex@warning@no@line{No \noexpand\author given}}
% \def\date#1{\gdef\@date{#1}}
% \gdef\@date{\today}
% \def\thanks#1{\footnotemark
% \protected@xdef\@thanks{\@thanks
% \protect\footnotetext[\the\c@footnote]{#1}}}
% \let\@thanks\@empty
% \def\and{% % \begin{tabular}
% \end{tabular}%
% \hskip 1em \@plus.17fil%
% \begin{tabular}[t]{c}}% % \end{tabular}
% \end{verbatim}
% \end{small}\par
%
% The definition of |\@starttoc| from \file{ltsect.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\@starttoc#1{%
% \begingroup
% \makeatletter
% \@input{\jobname.#1}%
% \if@filesw
% \expandafter\newwrite\csname tf@#1\endcsname
% \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
% \fi
% \@nobreakfalse
% \endgroup}
% \end{verbatim}
% \end{small}\par
%
% The definition of |\@writefile| from \file{ltmiscen.dtx}.
% \par\begin{small}\begin{verbatim}
% \long\def@writefile#1#2{%
% \@ifundefined{tf@#1}\relax
% {\@temptokena{#2}%
% \immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
% }}
% \end{verbatim}
% \end{small}\par
%
% The definitions of |\addtocontents| and |addcontentsline|
% from \file{ltsect.dtx}.
% \par\begin{small}\begin{verbatim}
% \long\def\addtocontents#1#2{%
% \protected@write\@auxout
% {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
% {\string\@writefile{#1}{#2}}}
% \def\addcontentsline#1#2#3{%
% \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}}
% \end{verbatim}
% \end{small}\par
%
% The definitions of |\label|, |\@setref|, |\newlabel|, |\ref| and |\pageref|
% from \file{ltxref.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\label#1{\@bsphack
% \protected@write\@auxout{}%
% {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
% \@esphack}
% \def\@setref#1#2#3{%
% \ifx#1\relax
% \protect\G@refundefinedtrue
% \nfss@text{\reset@font\bfseries ??}%
% \@latex@warning{Reference `#3' on page \thepage \space
% undefined}%
% \else
% \expandafter#2#1\null
% \fi}
% \def\newlabel{\@newl@bel r}
% \def\ref#1{\expandafter\@setref\csname r@#1\endcsname
% \@firstoftwo{#1}}
% \def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
% \@secondoftwo{#1}}
% \end{verbatim}
% \end{small}\par
%
% The definitions of |\bibcite| and |\@citex| from \file{ltbibl.dtx}.
% \par\begin{small}\begin{verbatim}
% \def\bibcite{\@newl@bel b}
% \def\@citex[#1]#2{%
% \let\@citea\@empty
% \@cite{\@for\@citeb:=#2\do
% {\@citea\def\@citea{,\penalty\@m\ }%
% \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
% \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
% \@ifundefined{b\@citeb}{\mbox{\reset@font\bfseries ?}%
% \G@refundefinedtrue
% \@latex@warning
% {Citation `\@citeb' on page \thepage \space undefined}}%
% {\hbox{\csname b\@citeb\endcsname}}}}{#1}}
% \end{verbatim}
% \end{small}\par
%
%
%
%
% \Finale
% \PrintIndex
%
\endinput
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
|