/usr/share/texmf-texlive/tex/generic/pstricks-add/pstricks-add.tex is in texlive-pstricks 2009-10ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 | %% $Id: pstricks-add.tex 139 2009-10-13 12:16:45Z herbert $
%%
%%
%% This is file `pstricks-add.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Package `pstricks-add.tex'
%%
%% Dominique Rodriguez <DR _at_ pstricks.de>
%% Herbert Voss <Herbert.Voss _at_ pstricks.de>
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%% `pstricks-add' is a PSTricks package for additionals to the standard
%% pstricks package
%%
\csname PSTricksAddLoaded\endcsname
\let\PSTricksAddLoaded\endinput
%
% Requires some packages
\ifx\PSTricksLoaded\endinput\else \input pstricks \fi
\ifx\PSTplotLoaded\endinput\else \input pst-plot \fi
\ifx\PSTnodesLoaded\endinput\else \input pst-node \fi
\ifx\PSTthreeDLoaded\endinput\else\input pst-3d \fi
\ifx\MultidoLoaded\endinput\else \input multido \fi
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
\ifx\PSTFPloaded\endinput\else \input pst-fp \fi
\ifx\PSTmathLoaded\endinput\else \input pst-math \fi
%
\def\fileversion{3.35}
\def\filedate{2009/10/12}
\message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
\SpecialCoor
\pst@addfams{pstricks-add}
%
%% prologue for postcript
\pstheader{pstricks-add.pro}%
%\pstheader{pst-math.pro}% for equation solver
%\pstheader{pst-algparser.pro}% now done by pstricks.tex
%
%-------------------------------- pstricks ------------------------------------
%
%%%%%%% \begin{pspicture} %%%%%%%%%%%%%%%%%%%
\newdimen\pst@dimm%
\newdimen\pst@dimn%
\newdimen\pst@dimo%
\newdimen\pst@dimp%
\newcount\pst@cntm%
\newcount\pst@cntn%
\newcount\pst@cnto%
\newcount\pst@cntp%
%\psset{dx=0}%
%\psset{dy=0}%
\newcount\@zero\@zero=0\relax
\chardef\f@ur=4
%
\def\psPiFour{12.566371}
\def\psPiTwo{6.283185}
\def\psPi{3.14159265}
\def\psPiH{1.570796327}
\newdimen\pstRadUnit
\newdimen\pstRadUnitInv
\pstRadUnit=1.047198cm % this is pi/3
\pstRadUnitInv=0.95493cm % this is 3/pi
%
\def\pst@getdimdim#1 #2 #3\@nil{%
\def\pst@tempA{#2}%
\ifx\pst@tempA\@empty
\pssetlength\pst@dimn{#1}%
\pst@dimm=\z@%
\else%
\pssetlength\pst@dimm{#1}%
\pssetlength\pst@dimn{#2}%
\fi%
}
\def\pst@getxdimdim#1 #2 #3\@nil{%
\def\pst@tempA{#2}%
\ifx\pst@tempA\@empty
\pssetxlength\pst@dimn{#1}%
\pst@dimm=\z@
\else%
\pssetxlength\pst@dimm{#1}%
\pssetxlength\pst@dimn{#2}%
\fi%
}
\def\pst@getydimdim#1 #2 #3\@nil{%
\def\pst@tempA{#2}
\ifx\pst@tempA\@empty
\pssetylength\pst@dimn{#1}
\pst@dimm=\z@
\else
\pssetylength\pst@dimm{#1}%
\pssetylength\pst@dimn{#2}%
\fi%
}
%
% stolen from latex.ltx to make it TeX compatible
%
\def\@fornoop#1\@@#2#3{}
\long\def\@for#1:=#2\do#3{%
\expandafter\def\expandafter\@fortmp\expandafter{#2}%
\ifx\@fortmp\@empty \else
\expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}
\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
#5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}
\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
\expandafter\@fornoop \else
#4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}
\def\psforeach#1#2#3{%
\begingroup%
\edef\reserved@a{#2}%
\@for#1:=\reserved@a\do{#3}%
\endgroup%
}
\def\psForeach#1#2#3{%
\edef\reserved@a{#2}%
\@for#1:=\reserved@a\do{#3}%
}
%
% A modulo macro for integer values
% \pst@mod{34}{6}\value ==> \value is 4
%
\def\pst@mod#1#2#3{%
\begingroup%
\pst@cntm=#1\pst@cntn=#2\relax%
\pst@cnto=\pst@cntm%
\divide\pst@cntm by \pst@cntn%
\multiply\pst@cntn by \pst@cntm%
\advance\pst@cnto by -\pst@cntn%
\edef\value{\endgroup\def\noexpand#3{\number\pst@cnto}}\value%
}
\def\pst@max#1#2#3{%
\begingroup%
\pst@cntm=#1\pst@cntn=#2\relax%
\ifnum\pst@cntm<\pst@cntn\pst@cntm=\pst@cntn\fi
\global#3=\the\pst@cntm%
\endgroup%
}
\def\pst@maxdim#1#2#3{%
\begingroup%
\pst@dimm=#1\pst@dimn=#2\relax%
\ifdim\pst@dimm<\pst@dimn\pst@dimm=\pst@dimn\fi
\global#3=\the\pst@dimm%
\endgroup%
}
\def\pst@mindim#1#2#3{%
\begingroup%
\pst@dimm=#1\pst@dimn=#2\relax%
\ifdim\pst@dimm>\pst@dimn\pst@dimm=\pst@dimn\fi
\global#3=\the\pst@dimm%
\endgroup%
}
\def\pst@abs#1#2{%
\begingroup%
\pst@cntm=#1\relax%
\ifnum\pst@cntm<\z@\pst@cntm=-\pst@cntm\fi%
\global#2=\the\pst@cntm
\endgroup%
}
\def\pst@absdim#1#2{%
\begingroup%
\pst@dimm=#1\relax%
\ifdim\pst@dimm<\z@\pst@dimm=-\pst@dimm\fi%
\global#2=\the\pst@dimm%
\endgroup%
}
\def\pst@int#1{\expandafter\pst@@int#1..\@nil}
\def\pst@@int#1.#2.\@nil{#1}
%
\def\pstFPDiv#1#2#3{\pstFP@callc\pstFP@div#1{#2}{#3}% % #1 := int(#2/#3)
\edef#1{\pst@int{#1}}}%
%
\def\psGetSlope(#1,#2)(#3,#4)#5{% 4 values without a dimen! #5 is a macro
\pst@dimm=#1pt%
\advance\pst@dimm by -#3pt%
\pst@dimn=#2pt%
\advance\pst@dimn by -#4pt
\pst@divide{\pst@dimn}{\pst@dimm}#5}
%
%--------------------------------------- small stuff -------------------------------
\def\use@keep@par{% same as \use@par, but keeps the values
\ifx\pst@par\@empty\else
\expandafter\@psset\pst@par,\@nil
% \def\pst@par{}%
\fi%
}
%
\define@boolkey[psset]{pstricks-add}[Pst@]{CMYK}[true]{}
\psset[pstricks-add]{CMYK=true}
%
\def\defineTColor{\@ifnextchar[{\defineTColor@i}{\defineTColor@i[]}}
\def\defineTColor@i[#1]#2#3{% "semi transparency colors"
\def\pst@tempA{#1}%
\newpsstyle{#2}{%
fillstyle=vlines,hatchwidth=0.1\pslinewidth,
hatchsep=1\pslinewidth,hatchcolor=#3}%
\ifx\pst@tempA\@empty\else\psset{#1}\fi%
}
\defineTColor{TRed}{red}
\defineTColor{TGreen}{green}
\defineTColor{TBlue}{blue}
%
\define@key[psset]{pstricks-add}{fsAngle}[137.50775]{\pst@getangle{#1}\pst@fsAngle }
\define@key[psset]{pstricks-add}{fsOrigin}{%
\pst@@getcoor{#1}\edef\pst@fsOrigin{\pst@coor T }}
\psset[pstricks-add]{fsOrigin={0,0},fsAngle=137.50775}
%
\def\psfs@spiral{\pst@fill{\pst@fsOrigin \pst@usecolor\psfillcolor clip newpath
0 .1 500 { dup dup sqrt 4 div 0 360 arc fill \pst@fsAngle rotate } for }}
%
\def\rmultiput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\rmultiput@i}{\rmultiput@i[]}}}
\def\rmultiput@i[#1]{\begingroup\psset{#1}\rmultiput@ii}
\def\rmultiput@ii#1{\def\@rmultiputArg{#1}%
\@ifnextchar({\rmultiput@iii}{\rmultiput@iii(\z@,\z@)}}
\def\rmultiput@iii(#1){%
\pst@killglue%
\if@star\rput*(#1){\@rmultiputArg}
\else\rput(#1){\@rmultiputArg}\fi
\@ifnextchar({\rmultiput@iii}{\endgroup}%
}
% #1: (x,y) #2: rotAngle #3: object
\def\psrotate{\pst@object{psrotate}}
\def\psrotate@i(#1)#2{%
\pst@killglue
\begingroup%
\use@par\pst@makebox{\psrotate@ii(#1){#2}}}
\def\psrotate@ii(#1)#2{%
\pst@getcoor{#1}\pst@tempA%
\pst@getangle{#2}\pst@tempB%
\leavevmode%
\pst@Verb{%
{ \pst@tempA /yRot ED /xRot ED
\pst@tempB dup cos /cosA ED sin /sinA ED
/ax cosA def
/by sinA def
/cx sinA neg def
/dy cosA def
/ex xRot cosA mul neg xRot add yRot sinA mul add def
/fy xRot sinA mul neg yRot add yRot cosA mul sub def
[ax by cx dy ex fy] concat } \tx@TMChange }%
\box\pst@hbox%
\pst@Verb{ \tx@TMRestore }\endgroup}
%
% [#1]: obtargs; (#2,#3): center; {#4}: factor; {#5}: object
\def\psHomothetie{\pst@object{psHomothetie}}
\def\psHomothetie@i(#1)#2{%
\begin@SpecialObj%
\pst@getcoor{#1}\pst@tempA% converts the coordinates without a unit into pt
\pst@makebox{\psHomothetie@ii{#2}}}% put the contents into a box
\def\psHomothetie@ii#1{%
\pst@Verb{%
{ \pst@tempA /yH ED /xH ED
[#1 0 0 #1 #1 xH mul neg xH add #1 yH mul neg yH add] concat }
\tx@TMChange }%
\box\pst@hbox%
\pst@Verb{\tx@TMRestore}%
\end@SpecialObj}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Begin patch TN; Date (YY-MM-DD): 04-07-17; first part
\define@key[psset]{}{dash}{% defined in pstricks.tex
\pst@expandafter\psset@@dash{#1}\@nil% Error handling for empty argument.
}
\define@key[psset]{pstricks-add}{maxdashes}[11]{\def\psk@maxdashes{#1}}
%\psset{maxdashes=11}
\def\psset@@dash#1\@nil{%
\def\psk@dash{}%
% modification 04-08-07:
\pst@cntm0
\def\next##1 ##2\relax{%
\expandafter\ifnum\psk@maxdashes>\pst@cntm\relax % 04-08-07
\edef\@tempa{##1}%
\ifx\@tempa\@empty\else% gobble leading spaces
\pssetlength\pst@dimc{##1}%
\advance\pst@cntm by 1
\edef\psk@dash{\psk@dash\space\pst@number\pst@dimc}%
\fi%
\edef\@tempa{##2}%
\ifx\@tempa\@empty\else% detect end
\ifx\@tempa\space\else% gobble trailing spaces
\next##2\relax%
\fi\fi%
\else% 04-08-07
\@pstrickserr{Number of dashes > \psk@maxdashes. Increasing
'maxdashes' might work.}\@ehpa% 04-08-07
\fi% 04-08-07
}%
\expandafter\next#1 \relax}
%% End patch TN; Date (YY-MM-DD): 04-07-17; 1st part
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\psset{dash=5pt 3pt}% black white black white
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Begin patch TN; Date (YY-MM-DD): 04-07-17; 2nd part
\def\psls@dashed{%
\psk@linecap\space setlinecap
\ifpsdashadjust
[ \psk@dash ] \pst@linetype\space \tx@DashLine
\else
[ \psk@dash ] 0 setdash stroke
\fi}
%% End patch TN; Date (YY-MM-DD): 04-07-17; 2nd part
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-----------------------------------------------------------------------------------
\pst@def{DashLine}<
dup 0 gt
{ /a .5 def PathLength exch div }
{ pop /a 1 def PathLength } ifelse
/b ED % pattern should fit evenly in b
dup /X ED % pattern array
0 get /y ED % length of first black segment
/z 0 X {add} forall def % length of the full pattern
%% Computation of the scaling factor as described by van Zandt:
b a .5 sub 2 mul y mul sub z Div round
z mul a .5 sub 2 mul y mul add b exch Div
%%%% scaling factor on stack.
/z ED %% now, z is the scaling factor
false % for the length test below
X { z mul } forall X astore %% modification TN 04-08-07
%%% Checking whether at least one dash in X has positive length:
{0 gt or} forall
{ X 1 a sub y mul }
{ [ 1 0 ] 0 }
ifelse
setdash stroke >
%% TN end patch; Date (YY-MM-DD): 04-07-17;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\define@key[psset]{pstricks-add}{intSeparator}{\def\psk@intSeparator{#1}}
%\psset{intSeparator={,}}
%
\def\psFormatInt{\def\pst@par{}\pst@object{psFormatInt}}
\def\psFormatInt@i#1{{%
\pst@killglue
\use@par
\count1=#1\count2=\count1
\ifnum\count1=0 0\else
\ifnum\count1>999999
\count3=\count1
\divide\count3 by 1000000
\the\count3\psk@intSeparator\relax
\multiply\count3 by 1000000
\advance\count1 by -\count3 % modulo 1000000
\fi%
\ifnum\count2>999
\count3=\count1
\divide\count3 by 1000
\ifnum\count2>99999
\ifnum\count3<100 0\fi
\ifnum\count3<10 0\fi
\fi%
\the\count3\psk@intSeparator\relax
\multiply\count3 by 1000
\advance\count1 by -\count3 %modulo 1000
\fi%
\ifnum\count2>999
\ifnum\count1<100 0\fi
\ifnum\count1<10 0\fi
\fi%
\the\count1
\fi%
}\ignorespaces}
%
\define@key[psset]{pstricks-add}{braceWidth}{\pst@getlength{#1}\psk@braceWidth}
\define@key[psset]{pstricks-add}{bracePos}{\pst@checknum{#1}\psk@bracePos}
\define@key[psset]{pstricks-add}{braceWidthInner}{\pst@getlength{#1}\psk@braceWidthInner}
\define@key[psset]{pstricks-add}{braceWidthOuter}{\pst@getlength{#1}\psk@braceWidthOuter}
%
\def\psbrace{\pst@object{psbrace}}
\def\psbrace@i(#1)(#2)#3{%
\addbefore@par{ref=lb,linewidth=0.01pt,fillstyle=solid,fillcolor=black}% default setting
\begin@SpecialObj
\if@star\def\pst@tempC{true }\else\def\pst@tempC{false }\fi
\ifx\psk@rot\empty\def\psk@@rot{0}\else\let\psk@@rot\psk@rot\fi
\def\psk@rot{Alpha \psk@@rot\space add 90 sub}%
\pst@getcoor{#1}\pst@tempA
\pst@getcoor{#2}\pst@tempB
\rput(!
/ifStar \pst@tempC def
/radius1 \psk@braceWidthOuter def
/radius2 \psk@braceWidthInner def
/Alpha \pst@tempA \pst@tempB 3 -1 roll sub 3 1 roll exch sub atan def
/Length \pst@tempA \pst@tempB Pyth2 def
/Left { Length \psk@bracePos\space mul } bind def
/Right { Length Left sub } bind def
/Width \psk@braceWidth def
/pop4 { pop pop pop pop } def
gsave
[ Alpha cos Alpha sin Alpha sin neg Alpha cos \pst@tempA ] concat
0 0 moveto
0 radius2 neg radius2 radius2 neg radius2 arcto pop4
Left radius2 sub radius1 sub 0 rlineto
Left radius2 neg Left radius2 radius1 add neg radius1 arcto pop4
currentpoint /y@Label ED /x@Label ED
Left radius2 neg Left radius1 add radius2 neg radius1 arcto pop4
Right radius2 sub radius1 sub 0 rlineto
Length radius2 neg Length 0 radius2 arcto pop4
% 0 Width neg rlineto
Length radius2 Width add neg Length radius2 sub radius2 Width add neg radius2 arcto pop4
Right radius2 sub radius1 sub neg 0 rlineto
Left radius1 add Width radius1 add radius2 add neg radius1 90 180 arc
Left radius1 sub Width radius1 add radius2 add neg radius1 0 90 arc
Left radius2 sub radius1 sub neg 0 rlineto
radius2 Width neg radius2 270 180 arcn
0 0 lineto
\ifx\psk@fillstyle\relax\else
gsave
ifStar { \pst@usecolor\pslinecolor }{ \pst@usecolor\psfillcolor } ifelse
fill
grestore
\fi
\pst@number\pslinewidth setlinewidth \pst@usecolor\pslinecolor stroke
0 0 moveto
grestore
% now calculate the label pos
/Dh radius1 radius2 add Width add def
\pst@tempA \pst@tempB 3 -1 roll sub 3 1 roll exch sub % dy dx
\psk@bracePos\space mul exch \psk@bracePos\space mul % d'x d'y
\pst@tempA 3 -1 roll add Dh Alpha cos mul sub % d'x x yA
\psk@nodesepB sub % use minus sign to shidt right
3 1 roll add Dh Alpha sin mul add \psk@nodesepA add
exch \tx@UserCoor ){#3}
\end@SpecialObj}
%
% -------------- the arrow part -------------
% the original table
% \def\pst@arrowtable{,<->,<<->>,>-<,>>-<<,(-),[-],)-(,]-[,|>-<|}
%
% v : Vee arrow (inside) v,V,f and F by Christophe FOUREY
% V : Vee arrow (outside)
% f : Filled vee arrow (inside)
% F : Filled vee arrow (outside)
\edef\pst@arrowtable{\pst@arrowtable,v-v,V-V,f-f,F-F,t-t,T-T}
% Vee arrow
\define@key[psset]{pstricks-add}{veearrowlength}[3mm]{\pst@getlength{#1}\psk@veearrowlength}
\psset[pstricks-add]{veearrowlength=3mm} % default projected length
\define@key[psset]{pstricks-add}{veearrowangle}[30]{\pst@getangle{#1}\psk@veearrowangle}
\psset[pstricks-add]{veearrowangle=30} % default angle
\define@key[psset]{pstricks-add}{veearrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@veearrowlinewidth}
\psset[pstricks-add]{veearrowlinewidth=0.35mm} % default vee arrow line width
% Filled vee arrow
\define@key[psset]{pstricks-add}{filledveearrowlength}[3mm]{\pst@getlength{#1}\psk@filledveearrowlength}
\psset[pstricks-add]{filledveearrowlength=3mm} % default projected length
\define@key[psset]{pstricks-add}{filledveearrowangle}[15]{\pst@getangle{#1}\psk@filledveearrowangle}
\psset[pstricks-add]{filledveearrowangle=15} % default angle
\define@key[psset]{pstricks-add}{filledveearrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@filledveearrowlinewidth}
\psset[pstricks-add]{filledveearrowlinewidth=0.35mm} % default vee arrow line width
\define@key[psset]{pstricks-add}{arrowLW}{\pst@getlength{#1}\psk@arrowLW}
% arrowLW as LineWidth for the circled line ends
%
\def\psas@o{\psk@arrowLW\space dup 0 eq { pop }{ SLW } ifelse
{\pst@usecolor\psfillcolor true} false \psk@dotsize \tx@EndDot }
\@namedef{psas@*}{\psk@arrowLW\space dup 0 eq { pop }{ SLW } ifelse
{\pst@usecolor\psfillcolor false} false \psk@dotsize \tx@EndDot}
\pst@def{VeeArrow}<%
1 setlinecap % round caps
1 setlinejoin % round join
setlinewidth % vee arrow line width
/y ED % projected length
2 div /a ED % angle (divide by 2)
/t ED % false = inside, true = outside
a sin a cos div y mul /x ED % perpendicular length : x=tan(a).y
t { 1 -1 scale } if % if outside : symmetry
x neg y moveto % point #1
0 0 L % point #2
x y L % point #3
{closepath gsave fill grestore} if % if filled : close and fill
stroke % draw line
0 t {y 2 mul} {0} ifelse moveto> % if outside : twice longer line
% VeeArrow : filled? outside? (total) angle (projected) length (arrow) line width
\@namedef{psas@v}{%
false false \psk@veearrowangle \psk@veearrowlength \psk@veearrowlinewidth \tx@VeeArrow}
\@namedef{psas@V}{%
false true \psk@veearrowangle \psk@veearrowlength \psk@veearrowlinewidth \tx@VeeArrow}
\@namedef{psas@f}{%
true false \psk@filledveearrowangle \psk@filledveearrowlength \psk@filledveearrowlinewidth \tx@VeeArrow}
\@namedef{psas@F}{%
true true \psk@filledveearrowangle \psk@filledveearrowlength \psk@filledveearrowlinewidth \tx@VeeArrow}
% And An another arrowhead
% architectural tick / oblique arrow
% Tick arrow
\define@key[psset]{pstricks-add}{tickarrowlength}[1.5mm]{\pst@getlength{#1}\psk@tickarrowlength}
\psset[pstricks-add]{tickarrowlength=1.5mm} % default projected length
\define@key[psset]{pstricks-add}{tickarrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@tickarrowlinewidth}
\psset[pstricks-add]{tickarrowlinewidth=0.35mm} % default tick arrow line width
\pst@def{TickArrow}<%
1 setlinecap % round caps
1 setlinejoin % round join
setlinewidth % tick line width
/y ED % projected length
/t ED % false = normal, true = reversed
t { 1 -1 scale } if % if reversed : symmetry
y neg y moveto % point #1
y y neg L % point #2
stroke % draw line
0 0 moveto> % origin
\@namedef{psas@t}{ false \psk@tickarrowlength \psk@tickarrowlinewidth \tx@TickArrow }
\@namedef{psas@T}{ true \psk@tickarrowlength \psk@tickarrowlinewidth \tx@TickArrow }
%
% HookLeft/RightArrow
\newdimen\pshooklength
\newdimen\pshookwidth
\define@key[psset]{pstricks-add}{hooklength}[3mm]{\pssetlength\pshooklength{#1}}
\define@key[psset]{pstricks-add}{hookwidth}[1mm]{\pssetlength\pshookwidth{#1}}
%\psset{hooklength=3mm,hookwidth=1mm}
%
\edef\pst@arrowtable{\pst@arrowtable,H-H,h-h} % add new arrow
\def\tx@RHook{RHook } % PostScript name
\def\tx@Rhook{Rhook } % PostScript name
\@namedef{psas@H}{%
/RHook {
/x ED % hook width
/y ED % hook length
/z CLW 2 div def % save it
x y moveto % goto first point
x 0 0 0 0 y
curveto % draw Bezier
stroke
0 y moveto % define current point
} def
\pst@number\pshooklength
\pst@number\pshookwidth
\tx@RHook
}
\@namedef{psas@h}{%
/Rhook {
CLW mul % size * CLW
add dup % +length size*CLW+length size*CLW+length
2 div /w ED % (size*CLW+length)/2 -> w
mul dup /h ED mul % (size*CLW+length)
/a ED
w neg h abs moveto 0 0 L
gsave
stroke grestore
} def
0 \psk@arrowlength \psk@arrowsize \tx@Rhook
}
% New parameter "arrowfill", with default as "true"
\define@boolkey[psset]{pstricks-add}[ps]{ArrowFill}[true]{}
%
% Modification of the PostScript macro Arrow to choose to fill or not the arrow
% (it require to restore the current linewidth, despite of the scaling)
\pst@def{Arrow}<{%
CLW mul add dup 2 div
/w ED mul dup
/h ED mul
/a ED { 0 h T 1 -1 scale } if
gsave
\ifpsArrowFill\else\pst@number\pslinewidth \pst@arrowscale\space div SLW \fi
w neg h moveto
0 0 L w h L w neg a neg rlineto
\ifpsArrowFill gsave fill grestore \else gsave closepath stroke grestore \fi
grestore
0 h a sub moveto
}>
%
\define@key[psset]{pstricks-add}{nArrowsA}[2]{\def\psk@nArrowsA{#1}}
\define@key[psset]{pstricks-add}{nArrowsB}[2]{\def\psk@nArrowsB{#1}}
\define@key[psset]{pstricks-add}{nArrows}[2]{\def\psk@nArrowsA{#1}\def\psk@nArrowsB{#1}}
%\psset{nArrows=2}
%
\@namedef{psas@>>}{%
\psk@nArrowsA\space 1 sub {
false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
0 h a sub T
} repeat
gsave
newpath
false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
CP
grestore
moveto
}
%
\@namedef{psas@<<}{%
true \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
0 h neg a add T
\psk@nArrowsB\space 2 sub {
false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
0 h neg a add T
} repeat
false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
0 h a 5 mul 2 div sub moveto
}
%
% DG addition begin - Dec. 18/19, 1997 and Oct. 11, 2002
% Adapted from \psset@arrows
\define@key[psset]{pstricks-add}{ArrowInside}{%
\def\pst@tempArrow{#1}%
\ifx\pst@tempArrow\@empty \def\psk@ArrowInside{} %
\else%
\begingroup%
\pst@activearrows%
\xdef\pst@tempg{<#1}%
\endgroup%
\expandafter\psset@@ArrowInside\pst@tempg\@empty-\@empty\@nil%
\if@pst\else\@pstrickserr{Bad intermediate arrow specification: #1}\@ehpa\fi%
\fi%
}
% Adapted from \psset@@arrows
\def\psset@@ArrowInside#1-#2\@empty#3\@nil{%
\@psttrue
\def\next##1,#1-##2,##3\@nil{\def\pst@tempg{##2}}%
\expandafter\next\pst@arrowtable,#1-#1,\@nil
\@ifundefined{psas@#2}%
{\@pstfalse\def\psk@ArrowInside{}}%
{\def\psk@ArrowInside{#2}}%
}
% Default value empty
\psset{ArrowInside={}}
% Modified version of \pst@addarrowdef
\def\pst@addarrowdef{%
\addto@pscode{%
/ArrowA {
\ifx\psk@arrowA\@empty
\pst@oplineto
\else
\pst@arrowdef{A}
moveto
\fi
} def
/ArrowB { \ifx\psk@arrowB\@empty \else \pst@arrowdef{B} \fi } def
% DG addition
/ArrowInside {
\ifx\psk@ArrowInside\@empty \else \pst@arrowdefA{Inside} \fi
} def
}%
}
% Adapted from \pst@arrowdef
\def\pst@arrowdefA#1{%
\ifnum\pst@repeatarrowsflag>\z@ /Arrow#1c [ 6 2 roll ] cvx def Arrow#1c\fi
\tx@BeginArrow
\psk@arrowscale
\@nameuse{psas@\@nameuse{psk@Arrow#1}}
\tx@EndArrow%
}
% ArrowInsidePos parameter (default value 0.5)
\define@key[psset]{pstricks-add}{ArrowInsidePos}[0.5]{\pst@checknum{#1}\psk@ArrowInsidePos}%
%\psset{ArrowInsidePos=0.5}
%
% Modified version of \begin@ClosedObj
\def\begin@ClosedObj{%
\leavevmode%
\pst@killglue%
\begingroup%
\use@par%
\solid@star%
\ifpsdoubleline\pst@setdoublesep\fi%
\pst@addarrowdef% DG addition
\init@pscode}
%
% Redefinition of the PostScript /Line macro to print the intermediate
% arrow on each segment of the line
%
\define@key[psset]{pstricks-add}{ArrowInsideNo}[1]{\pst@checknum{#1}\psk@ArrowInsideNo}% hv 20031001
\define@key[psset]{pstricks-add}{ArrowInsideOffset}[0]{\pst@checknum{#1}\psk@ArrowInsideOffset}% hv 20031001
%\psset{ArrowInsideNo=1,ArrowInsideOffset=0}
%
\def\arrowType@H{H}
\pst@def{Line}<
NArray n 0 eq not { n 1 eq { 0 0 /n 2 def } if
(\psk@ArrowInside) length 0 gt {
\ifx\psk@arrowA\arrowType@H % do we have a Hook arrow at the beginning?
\pst@number\pshooklength % yes
\else
\psk@arrowsize\space CLW mul add dup \psk@arrowlength\space mul exch \psk@arrowinset mul neg add
\fi
/arrowlength exch def
4 copy % copy all four values for the arrow line
/y1 ED /x1 ED /y2 ED /x2 ED % save them
/Alpha y2 y1 sub x2 x1 sub Atan def % the gradient of the line
% 2 copy /y1 ED /x1 ED ArrowA x1 y1
ArrowA % draw arrowA
x1 Alpha cos arrowlength mul add % dx add
y1 Alpha sin arrowlength mul add % dy add, to get the current point at the end of the arrow tip
/n n 1 sub def
n {
4 copy
/y1 ED /x1 ED /y2 ED /x2 ED
x1 y1
\psk@ArrowInsidePos\space 1 gt {
/Alpha y2 y1 sub x2 x1 sub Atan def
/ArrowPos \psk@ArrowInsideOffset\space def
/Length x2 x1 sub y2 y1 sub Pyth def
/dArrowPos \psk@ArrowInsidePos\space abs def
{
/ArrowPos ArrowPos dArrowPos add def
ArrowPos Length gt { exit } if
x1 Alpha cos ArrowPos mul add
y1 Alpha sin ArrowPos mul add
ArrowInside
pop pop
} loop
}{
/ArrowPos \psk@ArrowInsideOffset\space def
/dArrowPos \psk@ArrowInsideNo 1 gt {%
1.0 \psk@ArrowInsideNo 1.0 add div
}{\psk@ArrowInsidePos } ifelse def
\psk@ArrowInsideNo\space cvi {
/ArrowPos ArrowPos dArrowPos add def
x2 x1 sub ArrowPos mul x1 add
y2 y1 sub ArrowPos mul y1 add
ArrowInside
pop pop
} repeat
} ifelse
pop pop Lineto
} repeat
}{ ArrowA /n n 2 sub def n { Lineto } repeat } ifelse
CP 4 2 roll ArrowB L pop pop } if >
%
% Redefinition of the PostScript /Polygon macro to print the intermediate
% arrow on each segment of the line
\pst@def{Polygon}<{%
NArray n 2 eq { 0 0 /n 3 def } if
n 3 lt {
n { pop pop } repeat
}{
n 3 gt { CheckClosed } if
n 2 mul -2 roll
/y0 ED
/x0 ED
/y1 ED
/x1 ED
/xx1 x1 def
/yy1 y1 def
x1 y1
/x1 x0 x1 add 2 div def
/y1 y0 y1 add 2 div def
x1 y1 moveto
/n n 2 sub def
/drawArrows {
x11 y11
\psk@ArrowInsidePos\space 1 gt {
/Alpha y12 y11 sub x12 x11 sub atan def
/ArrowPos \psk@ArrowInsideOffset\space def
/Length x12 x11 sub y12 y11 sub Pyth def
/dArrowPos \psk@ArrowInsidePos\space abs def
{
/ArrowPos ArrowPos dArrowPos add def
ArrowPos Length gt { exit } if
x11 Alpha cos ArrowPos mul add
y11 Alpha sin ArrowPos mul add
currentdict /ArrowInside known { ArrowInside } if
pop pop
} loop
}{
/ArrowPos \psk@ArrowInsideOffset\space def
/dArrowPos \psk@ArrowInsideNo\space 1 gt {%
1.0 \psk@ArrowInsideNo\space 1.0 add div
}{ \psk@ArrowInsidePos } ifelse def
\psk@ArrowInsideNo\space cvi {
/ArrowPos ArrowPos dArrowPos add def
x12 x11 sub ArrowPos mul x11 add
y12 y11 sub ArrowPos mul y11 add
currentdict /ArrowInside known { ArrowInside } if
pop pop
} repeat
} ifelse
pop pop Lineto
} def
n {
4 copy
/y11 ED /x11 ED /y12 ED /x12 ED
drawArrows
} repeat
x1 y1 x0 y0
6 4 roll
2 copy
/y11 ED /x11 ED /y12 y0 def /x12 x0 def
drawArrows
/y11 y0 def /x11 x0 def /y12 yy1 def /x12 xx1 def
drawArrows
pop pop
closepath
} ifelse %
}>
%
%
% Redefinition of the PostScript /OpenBezier macro to print the intermediate
% arrow
\pst@def{OpenBezier}<{%
/dArrowPos \psk@ArrowInsideNo 1 gt {%
1.0 \psk@ArrowInsideNo 1.0 add div
}{ \psk@ArrowInsidePos } ifelse def
BezierNArray
n 1 eq { pop pop
}{ 2 copy
/y0 ED /x0 ED
ArrowA
n 4 sub 3 idiv { 6 2 roll 4 2 roll curveto } repeat
6 2 roll
4 2 roll
ArrowB
/y3 ED /x3 ED /y2 ED /x2 ED /y1 ED /x1 ED
/cx x1 x0 sub 3 mul def
/cy y1 y0 sub 3 mul def
/bx x2 x1 sub 3 mul cx sub def
/by y2 y1 sub 3 mul cy sub def
/ax x3 x0 sub cx sub bx sub def
/ay y3 y0 sub cy sub by sub def
/getValues {
ax t0 3 exp mul bx t0 t0 mul mul add cx t0 mul add x0 add
ay t0 3 exp mul by t0 t0 mul mul add cy t0 mul add y0 add
ax t 3 exp mul bx t t mul mul add cx t mul add x0 add
ay t 3 exp mul by t t mul mul add cy t mul add y0 add
} def
/getdL {
getValues
3 -1 roll sub 3 1 roll sub Pyth
} def
/CurveLength {
/u 0 def
/du 0.01 def
0 100 {
/t0 u def
/u u du add def
/t u def
getdL add
} repeat } def
/GetArrowPos {
/ende \psk@ArrowInsidePos\space 1 gt
{ArrowPos}
{ArrowPos CurveLength mul} ifelse def
/u 0 def
/du 0.01 def
/sum 0 def
{ /t0 u def
/u u du add def
/t u def
/sum getdL sum add def
sum ende gt {exit} if
} loop u
} def
/ArrowPos \psk@ArrowInsideOffset\space def
/loopNo \psk@ArrowInsidePos\space 1 gt {%
CurveLength \psk@ArrowInsidePos\space div cvi
}{ \psk@ArrowInsideNo } ifelse def
loopNo cvi {
/ArrowPos ArrowPos dArrowPos add def
/t GetArrowPos def
/t0 t 0.95 mul def
getValues
ArrowInside pop pop pop pop
} repeat
x1 y1 x2 y2 x3 y3 curveto
} ifelse
}>
%
% Redefinition of the PostScript /NCLine macro to print the intermediate
% arrow of the line
\pst@def{NCLine}<{%
NCCoor
tx@Dict begin
ArrowA CP 4 2 roll ArrowB
4 copy
/y2 ED /x2 ED /y1 ED /x1 ED
x1 y1
\psk@ArrowInsidePos\space 1 gt {
/Alpha y2 y1 sub x2 x1 sub atan def
/ArrowPos \psk@ArrowInsideOffset\space def
/Length x2 x1 sub y2 y1 sub Pyth def
/dArrowPos \psk@ArrowInsidePos\space abs def
{%
/ArrowPos ArrowPos dArrowPos add def
ArrowPos Length gt { exit } if
x1 Alpha cos ArrowPos mul add
y1 Alpha sin ArrowPos mul add
ArrowInside
pop pop
} loop
}{%
/ArrowPos \psk@ArrowInsideOffset\space def
/dArrowPos \psk@ArrowInsideNo 1 gt {%
1.0 \psk@ArrowInsideNo 1.0 add div
}{ \psk@ArrowInsidePos } ifelse def
\psk@ArrowInsideNo\space cvi {
/ArrowPos ArrowPos dArrowPos add def
x2 x1 sub ArrowPos mul x1 add
y2 y1 sub ArrowPos mul y1 add
ArrowInside
pop pop
} repeat
} ifelse
pop pop lineto pop pop
end%
}>
%
\pst@def{NCCurve}<{%
GetEdgeA GetEdgeB
xA1 xB1 sub yA1 yB1 sub
Pyth 2 div dup 3 -1 roll mul
/ArmA ED
mul
/ArmB ED
/ArmTypeA 0 def
/ArmTypeB 0 def
GetArmA GetArmB
xA2 yA2 xA1 yA1
2 copy
/y0 ED /x0 ED
tx@Dict begin
ArrowA
end
xB2 yB2 xB1 yB1
tx@Dict begin
ArrowB
end
/y3 ED /x3 ED /y2 ED /x2 ED /y1 ED /x1 ED
/cx x1 x0 sub 3 mul def
/cy y1 y0 sub 3 mul def
/bx x2 x1 sub 3 mul cx sub def
/by y2 y1 sub 3 mul cy sub def
/ax x3 x0 sub cx sub bx sub def
/ay y3 y0 sub cy sub by sub def
/getValues {
ax t0 3 exp mul bx t0 t0 mul mul add cx t0 mul add x0 add
ay t0 3 exp mul by t0 t0 mul mul add cy t0 mul add y0 add
ax t 3 exp mul bx t t mul mul add cx t mul add x0 add
ay t 3 exp mul by t t mul mul add cy t mul add y0 add
} def
/getdL {
getValues
3 -1 roll sub 3 1 roll sub Pyth
} def
/CurveLength {
/u 0 def
/du 0.01 def
0 100 {
/t0 u def
/u u du add def
/t u def
getdL add
} repeat } def
/GetArrowPos {
/ende \psk@ArrowInsidePos\space 1 gt {ArrowPos}{ArrowPos CurveLength mul} ifelse def
/u 0 def
/du 0.01 def
/sum 0 def
{
/t0 u def
/u u du add def
/t u def
/sum getdL sum add def
sum ende gt {exit} if
} loop u
} def
/dArrowPos \psk@ArrowInsideNo 1 gt {%
1.0 \psk@ArrowInsideNo 1.0 add div
}{ \psk@ArrowInsidePos } ifelse def
/ArrowPos \psk@ArrowInsideOffset\space def
/loopNo \psk@ArrowInsidePos\space 1 gt {%
CurveLength \psk@ArrowInsidePos\space div cvi
}{ \psk@ArrowInsideNo } ifelse def
loopNo cvi {
/ArrowPos ArrowPos dArrowPos add def
/t GetArrowPos def
/t0 t 0.95 mul def
getValues
ArrowInside pop pop pop pop
} repeat
x1 y1 x2 y2 x3 y3 curveto
/LPutVar [ xA1 yA1 xA2 yA2 xB2 yB2 xB1 yB1 ] cvx def
/LPutPos { t LPutVar BezierMidpoint } def
/HPutPos { { HPutLines } HPutCurve } def
/VPutPos { { VPutLines } HPutCurve } def
}>
%
\define@key[psset]{pstricks-add}{dashNo}{\def\psk@dashNo{#1}}
\define@key[psset]{pstricks-add}{linecap}{\def\psk@linecap{#1}}
\define@key[psset]{pstricks-add}{randomPoints}[1000]{\def\psk@randomPoints{#1}}
\define@boolkey[psset]{pstricks-add}[Pst@]{color}[true]{}
%\psset{randomPoints=1000,color=false}
%
\def\psRandom{\pst@object{psRandom}}% hv 2004-11-12
\def\psRandom@i{\@ifnextchar({\psRandom@ii}{\psRandom@iii(0,0)(1,1)}}
\def\psRandom@ii(#1){\@ifnextchar({\psRandom@iii(#1)}{\psRandom@iii(0,0)(#1)}}
\def\psRandom@iii(#1)(#2)#3{%
\def\pst@tempA{#3}%
\ifx\pst@tempA\pst@empty\psclip{\psframe(#2)}\else\psclip{#3}\fi
\pst@getcoor{#1}\pst@tempA
\pst@getcoor{#2}\pst@tempB
\begin@SpecialObj
\addto@pscode{
\pst@tempA\space /yMin exch def
/xMin exch def
\pst@tempB\space /yMax exch def
/xMax exch def
/dy yMax yMin sub def
/dx xMax xMin sub def
rrand srand % initializes the random generator
/getRandReal { rand 2147483647 div } def
\psk@dotsize % defines /DS ... def
\@nameuse{psds@\psk@dotstyle}
\psk@randomPoints {
\ifPst@color getRandReal getRandReal getRandReal setrgbcolor \fi
getRandReal dx mul xMin add
getRandReal dy mul yMin add
Dot
\ifx\psk@fillstyle\psfs@solid fill \fi stroke
} repeat
}%
\end@SpecialObj
\endpsclip
\ignorespaces
}
%
\def\psComment{\pst@object{psComment}}
\def\psComment@i{\pst@getarrows\psComment@ii}
\def\psComment@ii(#1)(#2)#3{\@ifnextchar[
{\psComment@iii(#1)(#2){#3}}
{\psComment@iii(#1)(#2){#3}[\ncput]}}
\def\psComment@iii(#1)(#2)#3[#4]{%
\let\pst@Comment#4
\addbefore@par{npos=0}%
\begin@SpecialObj%
\pcline(#1)(#2)
\ifx#4\rput\relax
\if@star\rput*(#1){#3}\else\rput(#1){#3}\fi
\else
\if@star\pst@Comment*{#3}\else\pst@Comment*{#3}\fi
\fi
\end@SpecialObj%
\ignorespaces%
}
%
\def\tx@MovetoByHand{ tx@addDict begin MovetoByHand end }
\def\tx@LinetoByHand{ tx@addDict begin LinetoByHand end }
%/amplHand {.8} def
%/dtHand 2 def
\def\pslineByHand{\pst@object{pslineByHand}}
\def\pslineByHand@i{%
\addbefore@par{VarStepEpsilon=2,varsteptol=0.8}
\pst@getarrows{%
\begin@OpenObj
\pst@getcoors[\pslineByHand@ii}}
\def\pslineByHand@ii{%
\addto@pscode{
tx@addDict begin
/dtHand \psk@VarStepEpsilon\space def
/amplHand \psk@varsteptol\space def
% \pst@cp % current point
\tx@setlinejoin % hv 2007-10-13
MovetoByHand
counttomark 2 div /maxLines ED
1 1 maxLines { pop LinetoByHand } for
end
}%
\end@OpenObj%
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% %%%%%%%%%%
%%%%%%%%%%% pst-node %%%%%%%%%%
%%%%%%%%%%% %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This fixes a bug in pst-node, where the XY-direction is wrong
% the types are changed 1<->2 between X<->Y
%
\define@key[psset]{}{XnodesepA}{%
\pst@getlength{#1}\psk@nodesepA
\def\psk@nodeseptypeA{2 }%
}
\define@key[psset]{}{XnodesepB}{%
\pst@getlength{#1}\psk@nodesepB
\def\psk@nodeseptypeB{2 }%
}
\define@key[psset]{}{Xnodesep}{%
\pst@getlength{#1}\psk@nodesepA
\let\psk@nodesepB\psk@nodesepA
\def\psk@nodeseptypeA{2 }%
\def\psk@nodeseptypeB{2 }%
}
\define@key[psset]{}{YnodesepA}{%
\pst@getlength{#1}\psk@nodesepA
\def\psk@nodeseptypeA{1 }%
}
\define@key[psset]{}{YnodesepB}{%
\pst@getlength{#1}\psk@nodesepB
\def\psk@nodeseptypeB{1 }%
}
\define@key[psset]{}{Ynodesep}{%
\pst@getlength{#1}\psk@nodesepA
\let\psk@nodesepB\psk@nodesepA
\def\psk@nodeseptypeA{1 }%
\def\psk@nodeseptypeB{1 }%
}
%
% \psGetNodeCenter defines the PS variable #1.x and #1.y, which can then
% be used by the user. #1 must be a valid node name
\def\psGetNodeCenter#1{ tx@NodeDict begin /N@#1 load GetCenter end % x y on stack in system coor
\pst@number\psyunit div /#1.y ED % /#1.y in user coor
\pst@number\psxunit div /#1.x ED } % /#1.x in user coor
\def\psGetNodeEdge#1{ tx@NodeDict begin /N@#1 load 1 GetEdge end % x y on stack in system coor
\pst@number\psyunit div /#1.y ED % /#1.y in user coor
\pst@number\psxunit div /#1.x ED } % /#1.x in user coor
%
\define@key[psset]{pstricks-add}{lineAngle}[0]{%
\ifdim#1pt=\z@\else\psset{armB=0.5}\fi
\def\psk@lineAngle{#1}}%
%\psset{lineAngle=0}%
%
\pst@def{NCDiag}<{
GetEdgeA GetEdgeB GetArmA GetArmB mark
\psk@lineAngle\space abs 0 gt {
/xTemp xA2 10 add def
/yTemp yA2 \psk@lineAngle\space dup sin exch cos div 10 mul add def
/dY1 yTemp yA2 sub def
/dX1 xTemp xA2 sub def
/dY2 yB2 yB1 sub def
/dX2 xB2 xB1 sub def
dX1 abs 0.01 lt {
/m2 dY2 dX2 div def
/xB2 xA2 def
/yB2 xA2 xB1 sub m2 mul yB1 add def
}{
dX2 abs 0.01 lt {
/m1 dY1 dX1 div def
/xB2 xB1 def
/yB2 xB1 xA2 sub m1 mul yA2 add def
}{%
/m1 dY1 dX1 div def
/m2 dY2 dX2 div def
/xB2 m1 xA2 mul m2 xB1 mul sub yA2 sub yB1 add m1 m2 sub div def
/yB2 xB2 xA2 sub m1 mul yA2 add def
} ifelse
} ifelse
} if
ArmB 0 ne { xB1 yB1 } if
xB2 yB2 xA2 yA2
ArmA 0 ne { xA1 yA1 } if
tx@Dict begin false Line end
/LPutVar [ xB1 yB1 xB2 yB2 xA2 yA2 xA1 yA1 ] cvx def
/LPutPos { LPutLines } def
/HPutPos { HPutLines } def
/VPutPos { VPutLines } def
}>
% hv 2003-12-22
\pst@def{NCDiagg}<{
GetEdgeA GetArmA \psk@lineAngle\space abs 0 gt { \psk@lineAngle\space }
{ yB yA2 sub xB xA2 sub Atan 180 add } ifelse /AngleB ED
GetEdgeB mark
\psk@lineAngle\space abs 0 gt {
/dY2 yA2 yA1 sub def
/dX2 xA2 xA1 sub def
\psk@lineAngle\space abs 90 eq {
/m2 dY2 dX2 div def
/yA2 xB xA2 sub m2 mul yA2 add def
/xA2 xB def
}{
/m1 \psk@lineAngle\space dup sin exch cos div def % tan alpha
dX2 abs 0.01 lt {
/yA2 xA1 xB sub m1 mul yB add def
/xA2 xA1 def
}{%
/m2 dY2 dX2 div def
/xA2 m1 xB mul m2 xA2 mul sub yA2 add yB sub m1 m2 sub div def
/yA2 xA2 xB sub m1 mul yB add def
} ifelse
} ifelse
} if
xB1 yB1 xA2 yA2
ArmA 0 ne { xA1 yA1 } if
tx@Dict begin false Line end
/LPutVar [ xB1 yB1 xA2 yA2 xA1 yA1 ] cvx def
/LPutPos { LPutLines } def
/HPutPos { HPutLines } def
/VPutPos { VPutLines } def
}>
%
\def\ncbarr{\pst@object{ncbarr}}
\def\ncbarr@i#1#2{
\begingroup
\use@par%
\psLNode(#1)(#2){0.5}{barr@tempNode}%
\pst@dimm=\psk@angleA pt
\pst@dimn=180pt
% be sure, that angleA is 0 or 180. if not, we set it to 0
\ifdim\pst@dimm=\z@\else\ifdim\pst@dimm=\pst@dimn\else\psset{angleA=0}\fi\fi
\ncbar[arrows=-]{#1}{barr@tempNode}
\ifdim\psk@angleA pt=\z@\relax
\ncbar[angleA=180,angleB=180]{barr@tempNode}{#2}
\else\ncbar[angleA=0,angleB=0]{barr@tempNode}{#2}\fi%
\endgroup
}
% #1-------#4----------------#2
% where #1#4= #3 * #1#2
%
\def\psLNode(#1)(#2)#3#4{%
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{#2}\pst@tempB%
\pnode(!%
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
\pst@tempB /YB exch \pst@number\psyunit div def
/XB exch \pst@number\psxunit div def
/dx XB XA sub def
/dy YB YA sub def
XA dx #3\space mul add YA dy #3\space mul add){#4}
}
%
% build the linear combination #2*#1+#4*#3=#5
\def\psLCNode(#1)#2(#3)#4#5{%
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{#3}\pst@tempB%
\pnode(!%
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
\pst@tempB /YB exch \pst@number\psyunit div def
/XB exch \pst@number\psxunit div def
XA #2\space mul XB #4\space mul add
YA #2\space mul YB #4\space mul add){#5}%
}
%
%
\define@boolkey[psset]{pstricks-add}[Pst@]{trueAngle}[true]{}
%\psset{trueAngle=false}
%
\def\psRelNode{\pst@object{psRelNode}}
\def\psRelNode@i(#1)(#2)#3#4{{% A - B - factor - node name
\use@par
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{#2}\pst@tempB%
\pnode(!
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
\pst@tempB /YB exch \pst@number\psyunit div def
/XB exch \pst@number\psxunit div def
/AlphaStrich \psk@angleA\space def
/unit \pst@number\psyunit \pst@number\psxunit div def % yunit/xunit
%
/dx XB XA sub def
/dy YB YA sub \ifPst@trueAngle\space unit mul \fi\space def
/laenge dy dup mul dx dup mul add sqrt #3 mul def
/Alpha dy dx atan def
/beta Alpha AlphaStrich add def
laenge beta cos mul XA add
laenge beta sin mul \ifPst@trueAngle\space unit div \fi\space YA add ){#4}%
}}
%
\def\psRelLine{\pst@object{psRelLine}}
\def\psRelLine@i{\@ifnextchar({\psRelLine@iii}{\psRelLine@ii}}
\def\psRelLine@ii#1{%
\addto@par{arrows=#1}%
\psRelLine@iii%
}
\def\psRelLine@iii(#1)(#2)#3#4{{
\pst@killglue
\use@par
\psRelNode(#1)(#2){#3}{#4}
\psline(#1)(#4)%
}\ignorespaces}
%
% #1 options
% draw a parallel line to #2 #3
% #2---------#3
% #4----------#5(new node)
% #5 length of the line
% #6 node name
\def\psParallelLine{\pst@object{psParallelLine}}
\def\psParallelLine@i{\@ifnextchar({\psParallelLine@iii}{\psParallelLine@ii}}
\def\psParallelLine@ii#1{\addto@par{arrows=#1}\psParallelLine@iii}
\def\psParallelLine@iii(#1)(#2)(#3)#4#5{{
\pst@killglue
\use@par
\pst@getcoor{#1}\pst@tempA
\pst@getcoor{#2}\pst@tempB
\pst@getcoor{#3}\pst@tempC
% \pst@getlength{#4}\pst@dima
\pnode(!%
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
\pst@tempB /YB exch \pst@number\psyunit div def
/XB exch \pst@number\psxunit div def
\pst@tempC /YC exch \pst@number\psyunit div def
/XC exch \pst@number\psxunit div def
%
/dx XB XA sub def
/dy YB YA sub def
/laenge dy dup mul dx dup mul add sqrt #4 mul def
/Alpha dy dx atan def
laenge Alpha cos mul XC add
laenge Alpha sin mul YC add ){#5}%
\psline(#3)(#5)
}\ignorespaces}
%
\def\psIntersectionPoint(#1)(#2)(#3)(#4)#5{%
\pst@getcoor{#1}\pst@tempA
\pst@getcoor{#2}\pst@tempB
\pst@getcoor{#3}\pst@tempC
\pst@getcoor{#4}\pst@tempd
\pnode(!%
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
\pst@tempB /YB exch \pst@number\psyunit div def
/XB exch \pst@number\psxunit div def
\pst@tempC /YC exch \pst@number\psyunit div def
/XC exch \pst@number\psxunit div def
\pst@tempd /YD exch \pst@number\psyunit div def
/XD exch \pst@number\psxunit div def
/dY1 YB YA sub def
/dX1 XB XA sub def
/dY2 YD YC sub def
/dX2 XD XC sub def
dX1 abs 0.01 lt {
/m2 dY2 dX2 div def
XA dup XC sub m2 mul YC add
}{
dX2 abs 0.01 lt {
/m1 dY1 dX1 div def
XC dup XA sub m1 mul YA add
}{%
/m1 dY1 dX1 div def
/m2 dY2 dX2 div def
m1 XA mul m2 XC mul sub YA sub YC add m1 m2 sub div dup
XA sub m1 mul YA add
} ifelse
} ifelse ){#5}%
}
%
\def\psLDNode(#1)(#2)#3#4{%
% #1: node A #2: node B #3: dimen measured from A #4: node name
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{#2}\pst@tempB%
\pssetlength\pst@dimp{#3}%
\pnode(!%
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
\pst@tempB /YB exch \pst@number\psyunit div def
/XB exch \pst@number\psxunit div def
/dx XB XA sub def
/dy YB YA sub def
/angle dy dx Atan def
/linelength \pst@number\pst@dimp \pst@number\psunit div def
XA linelength angle cos mul add YA linelength angle sin mul add ){#4}%
}
\def\nlput{\pst@object{nlput}}
\def\nlput@i(#1)(#2)#3#4{%
\begin@SpecialObj
\psLDNode(#1)(#2){#3}{temp@lnput}
\pcline[linestyle=none](#1)(temp@lnput)%
\ncput[npos=1]{#4}%
\end@SpecialObj
}%
\define@cmdkeys[psset]{pstricks-add}[PSTPSPNk@]{% Christophe Jorssen 2007
blName,bcName,brName,
clName,ccName,crName,
tlName,tcName,trName}[]{}%
\psset[pstricks-add]{%
blName=PSPbl,bcName=PSPbc,brName=PSPbr,
clName=PSPcl,ccName=PSPcc,crName=PSPcr,
tlName=PSPtl,tcName=PSPtc,trName=PSPtr}
\def\psDefPSPNodes{\pst@object{psDefPSPNodes}}
\def\psDefPSPNodes@i{%
\pst@killglue
\begingroup
\use@par
\expandafter\psDefPSPNodes@ii\pic@coor}
%
\def\psDefPSPNodes@ii(#1)(#2)(#3){%
% \pnode(#1){PSPN@temp}\pnode([nodesep=.75,angle=45]PSPN@temp){\PSTPSPNk@blName}
% \pnode(#3){PSPN@temp}\pnode([nodesep=.75,angle=-135]PSPN@temp){\PSTPSPNk@trName}
\pnode(#1){PSPN@temp}\pnode([angle=45]PSPN@temp){\PSTPSPNk@blName}
\pnode(#3){PSPN@temp}\pnode([angle=-135]PSPN@temp){\PSTPSPNk@trName}
\pnode(\PSTPSPNk@blName|\PSTPSPNk@trName){\PSTPSPNk@tlName}
\pnode(\PSTPSPNk@trName|\PSTPSPNk@blName){\PSTPSPNk@brName}
\ncline[linestyle=none]{\PSTPSPNk@blName}{\PSTPSPNk@tlName}
\ncput[npos=.5]{\pnode{\PSTPSPNk@clName}}
\ncline[linestyle=none]{\PSTPSPNk@blName}{\PSTPSPNk@brName}
\ncput[npos=.5]{\pnode{\PSTPSPNk@bcName}}
\pnode(\PSTPSPNk@brName|\PSTPSPNk@clName){\PSTPSPNk@crName}
\pnode(\PSTPSPNk@bcName|\PSTPSPNk@trName){\PSTPSPNk@tcName}
\pnode(\PSTPSPNk@bcName|\PSTPSPNk@clName){\PSTPSPNk@ccName}
\endgroup
\ignorespaces}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% %%%%%%%%%%
%%%%%%%%%%% pst-plot %%%%%%%%%%
%%%%%%%%%%% %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%the following works only for plotstyle line, polygon and bezier
\define@key[psset]{pstricks-add}{yMaxValue}[-1.0]{\def\psk@yMaxValue{#1 }}
\psset{yMaxValue=-1.0}
% can be in PS syntax (eg 1e1.2) and must be positiv! negative values
% will beignored
%
% For quick plots, define:
% \beginqp@<foo> : What to do to first point (PS code only).
% \doqp@<foo> : What to do to subsequent points (PS code only).
% \endqp@<foo> : How to end plot.
% \testqp@<foo> : Set \@psttrue if OK to use quick plot.
\def\doqp@line{
\psk@yMaxValue 0 gt
{ dup abs
\psk@yMaxValue \pst@number\psyunit mul gt
{ moveto }{ L } ifelse }
{ L } ifelse
}
\def\doqp@polygon{
\psk@yMaxValue 0 gt
{ dup abs
\psk@yMaxValue \pst@number\psyunit mul gt
{ moveto }{ L } ifelse }
{ L } ifelse
}
\def\doqp@bezier{/n n 1 add def n 3 mod 0 eq { % we need 3 points
\psk@yMaxValue 0 gt
{ dup % last y value
abs \psk@yMaxValue\space \pst@number\psyunit mul gt
{ moveto pop pop pop pop }{ curveto } ifelse }
{ curveto } ifelse
} if
}
%
% Euclide Algorithm (macro by Jean-Come Charpentier)
% #1 : numerator (number.unit) (e.g. 4.\pi or 3.\ell or 12.a)
% #2 : denominator
\def\psIrFrac#1#2{{%
% extrait le num'erateur et l'unit'e
\ps@extract@unit#1\@nil
% d'enominateur
\pst@cntb=#2\relax
\pst@cntc=\@ne
% test du signe et op'erandes toutes positives
\ifnum\pst@cnta<\z@
\pst@cntc=-\pst@cntc
\pst@cnta=-\pst@cnta
\fi
\ifnum\pst@cntb<\z@
\pst@cntc=-\pst@cntc
\pst@cntb=-\pst@cntb
\fi
\ifnum\pst@cntc=\@ne
\def\ps@ir@sign{}%
\else
\def\ps@ir@sign{-}%
\fi
% calcul pgcd
\loop
\pst@cntd=\pst@cnta
\pst@cntc=\pst@cnta
\divide\pst@cntd\pst@cntb
\multiply\pst@cntd\pst@cntb
\advance\pst@cntc-\pst@cntd
\ifnum\pst@cntc>\z@
\pst@cnta=\pst@cntb
\pst@cntb=\pst@cntc
\repeat
% pgcd dans \ir@r
\pst@cntc=\pst@cntb
\pst@cnta=\ps@ir@num
\pst@cntb=#2\relax
% op'erandes toutes positives
\ifnum\pst@cnta<\z@
\pst@cnta=-\pst@cnta
\fi
\ifnum\pst@cntb<\z@
\pst@cntb=-\pst@cntb
\fi
% division par le pgcd
\divide\pst@cnta\pst@cntc
\divide\pst@cntb\pst@cntc
% affichage
\ifnum\pst@cnta=\z@
0%
\else\ifnum\pst@cnta=\@ne
\ifnum\pst@cntb=\@ne
\ps@ir@sign\ps@ir@unit%
\else
\frac{\ps@ir@sign\ps@ir@unit}{\the\pst@cntb}%
\fi
\else
\ifnum\pst@cntb=\@ne
\ps@ir@sign\the\pst@cnta\ps@ir@unit%
\else
\frac{\ps@ir@sign\the\pst@cnta\ps@ir@unit}{\the\pst@cntb}%
\fi
\fi\fi
}}
%
\def\ps@extract@unit#1.#2\@nil{%
\pst@cnta=#1\relax
\def\ps@ir@num{#1}% sauvegarde (le pgcd 'ecrase la valeur \ir@a)
\def\ps@ir@unit{#2}%
}
%
\define@key[psset]{pstricks-add}{labelFontSize}[{}]{\def\psk@labelFontSize{#1}}%
\define@boolkey[psset]{pstricks-add}[Pst@]{mathLabel}[true]{%
\ifPst@mathLabel%
\def\pshlabel##1{$\psk@labelFontSize##1$}%
\def\psvlabel##1{$\psk@labelFontSize##1$}%
\else%
\def\pshlabel##1{\psk@labelFontSize##1}%
\def\psvlabel##1{\psk@labelFontSize##1}%
\fi}
%\psset{labelFontSize={},mathLabel}
%
\define@key[psset]{pstricks-add}{decimalSeparator}[.]{\def\psk@decimalSeparator{#1}}%
\define@boolkey[psset]{pstricks-add}[Pst@]{comma}[true]{%
\ifPst@comma\def\psk@decimalSeparator{,}\else\def\psk@decimalSeparator{.}\fi}
\define@boolkey[psset]{pstricks-add}[Pst@]{xAxis}[true]{}
\define@boolkey[psset]{pstricks-add}[Pst@]{yAxis}[true]{}
\define@boolkey[psset]{pstricks-add}[Pst@]{xyAxes}[true]{%
\@nameuse{Pst@xAxis#1}\@nameuse{Pst@yAxis#1}}%
%\psset{decimalSeparator=.}%
%
\define@key[psset]{pstricks-add}{xlabelPos}[b]{\pst@expandafter\psset@@xlabelPos{#1}\@nil}
\define@key[psset]{pstricks-add}{ylabelPos}[l]{\pst@expandafter\psset@@ylabelPos{#1}\@nil}
\def\psset@@xlabelPos#1#2\@nil{%
\ifx#1t
\def\psk@xlabelPos{\tw@}% 2=top
\pst@xticksizeC=\pst@xticksizeB%
\else
\ifx#1a
\def\psk@xlabelPos{\@ne}% 1=axis
\pst@xticksizeC=\z@%
\else
\def\psk@xlabelPos{\z@}% 0=bottom
\pst@xticksizeC=\pst@xticksizeA%
\fi\fi}%
\def\psset@@ylabelPos#1#2\@nil{%
\ifx#1r
\def\psk@ylabelPos{\tw@}% 2=right
\pst@yticksizeC=\pst@yticksizeB%
\else
\ifx#1a
\def\psk@ylabelPos{\@ne}% 1=axis
\pst@yticksizeC=\z@%
\else
\def\psk@ylabelPos{\z@}% 0=left
\pst@yticksizeC=\pst@yticksizeA%
\fi\fi}
%\psset{xlabelPos=b, ylabelPos=l}%
%
\define@key[psset]{pstricks-add}{xyDecimals}[{}]{\def\psk@xDecimals{#1}\def\psk@yDecimals{#1}}
\define@key[psset]{pstricks-add}{xDecimals}[{}]{\def\psk@xDecimals{#1}}
\define@key[psset]{pstricks-add}{yDecimals}[{}]{\def\psk@yDecimals{#1}}
%\psset{xyDecimals={}}%
%
\define@key[psset]{pstricks-add}{xlogBase}[{}]{\def\psk@xlogBase{#1}}
\define@key[psset]{pstricks-add}{ylogBase}[{}]{\def\psk@ylogBase{#1}}
\define@key[psset]{pstricks-add}{xylogBase}[{}]{\def\psk@xlogBase{#1}\def\psk@ylogBase{#1}}%
%\psset{xylogBase={}}%
%
\define@key[psset]{pstricks-add}{trigLabelBase}[0]{\pst@getint{#1}{\psk@trigLabelBase}}
\psset{trigLabelBase=0}
%
\define@boolkey[psset]{pstricks-add}[Pst@]{trigLabels}[true]{%
\ifPst@trigLabels
\def\pst@@@hlabel##1{\pshlabel{##1}}
\def\pshlabel##1{%
\ifnum\psk@trigLabelBase<2
\def\de@nominator{\@ne}\else\def\de@nominator{\psk@trigLabelBase}\fi
\def\pst@tempA{##1}
\pst@abs{\pst@tempA}\pst@cntm
\pst@mod{\pst@cntm}{\de@nominator}\pst@cntp % cntb=##1 modulo trigLabelBase
\ifnum\@ne>\pst@cntp % 1 > modulo -> then we have pi/x
\pst@cnto=\pst@cntm \divide\pst@cnto by \de@nominator
\ifPst@mathLabel%
$\psk@labelFontSize
\ifnum\pst@tempA<0 -\fi
\ifnum\pst@cnto=\@ne % #1 = trigLabelBase
\pi % print pi
\else
\the\pst@cnto\pi % print \pst@cnto/\de@nominator pi
\fi$%
\else%
\psk@labelFontSize%
\ifnum\pst@tempA<0 -\fi%
\ifnum\pst@cnto=\@ne% % #1 = trigLabelBase
$\pi$% % print pi
\else%
\the\pst@cnto$\pi$% % print \pst@cnto/\de@nominator pi
\fi%
\fi%
\else%
\ifPst@mathLabel%
$\psk@labelFontSize%
\ifnum\pst@cntp=\@ne% % < 1 pi?
\if\pst@cntm=\@ne%
\frac{\pi}{\de@nominator}% % pi/x
\else\ifnum\pst@tempA=-1 \frac{-\pi}{\de@nominator}%
\else \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator}%
\else\frac{\pst@tempA\pi}{\de@nominator}% (x pi)/y
\fi\fi\fi%
\else%
\ifnum\pst@tempA=1 \frac{\pi}{\de@nominator}%
\else\ifnum\pst@tempA=\de@nominator \pi%
\else\frac{\pst@tempA\pi}{\de@nominator}%
\fi\fi\fi$%
\else%
\psk@labelFontSize%
\ifnum\pst@cntp=\@ne% % < 1 pi?
\if\pst@cntm=\@ne%
$\frac{\pi}{\de@nominator}$% % pi/x
\else\ifnum\pst@tempA=-1 $\frac{-\pi}{\de@nominator}$%
\else \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$%
\else$\frac{\pst@tempA\pi}{\de@nominator}$% (x pi)/y
\fi\fi\fi%
\else%
\ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$%
\else\ifnum\pst@tempA=\de@nominator $\pi$%
\else$\frac{\pst@tempA\pi}{\de@nominator}$%
\fi\fi\fi%
\fi%
\fi%
}%
\else%
\def\pst@@@hlabel##1{%
\edef\@xyDecimals{\psk@xDecimals}%
\ifnum\psk@ticks<\tw@% ticks=all|x
\ifx\psk@xlogBase\@empty%
\pshlabel{\psk@labelFontSize\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}%
\else%
\pshlabel{\psk@labelFontSize\psk@xlogBase\textsuperscript{\expandafter\@stripDecimals##1..\@nil}}%
\fi%
\fi%
}%
\ifPst@mathLabel%
\def\pshlabel##1{$\psk@labelFontSize##1$}\else%
\def\pshlabel##1{\psk@labelFontSize##1}%
\fi%
\fi%
}%
\psset{trigLabels=false}
%
%logLines=all|x|y|none (0,1,2,3)
\def\psk@logLines{3}
\define@key[psset]{pstricks-add}{logLines}[none]{\pst@expandafter\psset@@logLines#1\@nil\psk@logLines}
\def\psset@@logLines#1#2\@nil#3{%
\ifx#1a
\let#3\z@
\Pst@maxxTickstrue\Pst@maxyTickstrue
\set@xticksize{0 4pt}\set@yticksize{0 4pt}%
\def\psk@xsubticksize{1}\def\psk@ysubticksize{1}%
\else
\ifx#1x
\let#3\@ne
\Pst@maxxTickstrue\Pst@maxyTicksfalse
\set@xticksize{0 4pt}\def\psk@xsubticksize{1}%
\else
\ifx#1y
\let#3\tw@
\Pst@maxyTickstrue\Pst@maxxTicksfalse
\set@yticksize{0 4pt}\def\psk@ysubticksize{1}%
\else
\ifx#1n\let#3\thr@@\else
\@pstrickserr{Bad argument: `#1#2'}\@ehpa
\fi\fi\fi\fi}
%\psset{logLines=none}%
%
% Define "ticklines" parameter (ticklines=all|x|y|none with default=none)
%\def\psset@ticklines#1{\pst@expandafter\psset@@ticklines{#1}\@nil\psk@ticklines}
%\psset@ticklines{none}
\define@key[psset]{pstricks-add}{ylabelFactor}[\relax]{\def\psk@ylabelFactor{#1}}
\define@key[psset]{pstricks-add}{xlabelFactor}[\relax]{\def\psk@xlabelFactor{#1}}
\define@boolkey[psset]{pstricks-add}[Pst@]{showOriginTick}[true]{}%
%\psset{xlabelFactor=\relax,ylabelFactor=\relax}%
%% #1 : optional arguments passed to psline
%% #2 : x value
%% #3 : label
\def\psxTick{\pst@object{psxTick}}% idea by Martin Chicoine
\def\psxTick@i(#1)#2{{
\pst@killglue
\addbefore@par{arrows=-,linewidth=\psk@xtickwidth\pslinewidth}
\use@par
\psline(#1,\pst@xticksizeB)(#1,\pst@xticksizeA)
\rput[t](! \psk@origin
#1 \pst@number\pslabelsep \pst@number\pst@xticksizeB add
\pst@number\psyunit div neg ){\pshlabel{#2\vphantom{1}}}}\ignorespaces}
%
%% #1 : optional arguments passed to psline
%% #2 : y value
%% #3 : label
\def\psyTick{\pst@object{psyTick}}% idea by Martin Chicoine
\def\psyTick@i(#1)#2{{
\pst@killglue
\addbefore@par{arrows=-,linewidth=\psk@ytickwidth\pslinewidth}
\use@par
\psline(\pst@yticksizeB,#1)(\pst@yticksizeA,#1)
\rput[r]{0}(! \psk@origin
\pst@number\pst@yticksizeB \pst@number\pslabelsep add
\pst@number\psxunit div neg #1){\psvlabel{#2}}}\ignorespaces}
%
%% #1 integer
%% #2 decimals
%% #3 dot
\def\@stripDecimals#1.#2.#3\@nil{%
\def\pst@dummy{#1}%
\ifx\pst@dummy\@empty\the\@zero\else#1\fi% the integer part
}
%
\def\pst@@@vlabel#1{%
\edef\@xyDecimals{\psk@yDecimals}%
% \psk@yLabel%
\ifodd\psk@ticks% ticks=all||y (0,2)
\else%
\ifx\psk@ylogBase\@empty%
% \ifPst@comma
\psvlabel{\expandafter\@LabelComma#1..\@nil\psk@ylabelFactor}%
% \else\psvlabel{#1\psk@ylabelFactor}\fi%
\else%
\psvlabel{\psk@ylogBase\textsuperscript{\expandafter\@stripDecimals#1..\@nil }}%
\fi%
\fi%
}
\newcount\@digitcounter\@digitcounter=0\relax
\def\@inc@digitcounter{\global\advance\@digitcounter by 1\relax}
\def\@get@digitcounter{\the\@digitcounter\relax}
\def\@Reset@digitcounter{\global\@digitcounter=0\relax}
\def\@zeroFill{%
\ifnum \@xyDecimals>\@get@digitcounter
\bgroup
0\@inc@digitcounter\@zeroFill
\egroup%
\fi%
}
% #1 the value, maybe empty
%
\def\@process@digits#1#2;{%
\ifx *#1\@zeroFill\else#1\@inc@digitcounter
\ifnum\@xyDecimals>\@get@digitcounter\expandafter\@process@digits#2;\fi\fi%
}
%
\def\@writeDecimals#1{%
\ifx\@xyDecimals\@empty% take value as is
\def\@tempa{#1}% write only if not empty
\ifx\@tempa\@empty% write nothing
\else\ifmmode\expandafter\mathord\expandafter{\psk@decimalSeparator}\else\psk@decimalSeparator\fi#1\fi%
% \else\psk@decimalSeparator\fi%
\else% write only \xy@decimals
\ifnum\@xyDecimals>\@zero
\ifmmode\expandafter\mathord\expandafter{\psk@decimalSeparator}\else\psk@decimalSeparator\fi%
% \psk@decimalSeparator
\@Reset@digitcounter
\expandafter\@process@digits#1*;
\fi%
\fi%
}
%% #1 integer
%% #2 decimals
%% #3 dot
\def\@LabelComma#1.#2.#3\@nil{%
\def\pst@tempA{#1}%
\ifx\pst@tempA\@empty\the\@zero\else#1\fi% the integer part
\def\pst@tempA{#2}%
\ifx\pst@tempA\@empty\@writeDecimals{}\else\@writeDecimals{#2}\fi}
%
\def\psxs@none{%
\let\psk@arrowA\@empty%
\let\psk@arrowB\@empty%
\psxs@axes}
%
%
\def\psxs@axes{{%
\ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}\fi%
\ifPst@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}{y}\fi}}
%
\def\psaxes{\pst@object{psaxes}}
\def\psaxes@i{\pst@getarrows\psaxes@ii}
\def\psaxes@ii(#1){\@ifnextchar({\psaxes@iii(#1)}{\psaxes@iv(0,0)(0,0)(#1)}}
\def\psaxes@iii(#1)(#2){\@ifnextchar({\psaxes@iv(#1)(#2)}{\psaxes@iv(#1)(#1)(#2)}}
\def\psaxes@iv(#1)(#2)(#3){\@ifnextchar[{\psaxes@v(#1)(#2)(#3)}{\psaxes@vii(#1)(#2)(#3)}}%
\def\psaxes@v(#1)(#2)(#3)[#4]{\@ifnextchar[{\psaxes@vi(#1)(#2)(#3)[#4]}{\psaxes@vi(#1)(#2)(#3)[#4][]}}%
\def\psaxes@vi(#1)(#2)(#3)[#4,#5][#6,#7]{%
\psaxes@vii(#1)(#2)(#3)%
\begingroup%
\use@par%
\uput{\pslabelsep}[#5](#3|#1){#4}\uput{\pslabelsep}[#7](#1|#3){#6}%
\endgroup%
\ignorespaces%
}
%
\def\psaxes@vii(#1,#2)(#3,#4)(#5,#6){%
\pst@killglue%
\begingroup%
\pssetxlength\pst@dimc{#5}% ur-x
\pssetylength\pst@dimd{#6}% ur-y
\ifdim\pst@dimc<\z@\ifdim\pst@dimd<\z@% axes show to left and down
\addbefore@par{xlabelPos=top,ylabelPos=right}\fi\fi%
\setbox\pst@hbox=\hbox\bgroup%
\use@par% now the same with an optional unit=... in par
\pssetxlength\pst@dimg{#1}% o-x
\pssetylength\pst@dimh{#2}% o-y
\pssetxlength\pst@dima{#3}% ll-x
\pssetylength\pst@dimb{#4}% ll-y
\pssetxlength\pst@dimc{#5}% ur-x
\pssetylength\pst@dimd{#6}% ur-y
% If minimum values are negative in log mode, we modify Ox
% (respectively Oy) if this was not done by the user
% X axis labels (\psk@log = 0 or 1)
%
% Whole thing will be translated to origin:
\advance\pst@dima by -\pst@dimg% Dist. from ll-x to o-x
\advance\pst@dimb by -\pst@dimh% Dist. from ll-y to o-y
\advance\pst@dimc by -\pst@dimg% Dist. from ur-x to o-x
\advance\pst@dimd by -\pst@dimh% Dist. from ur-y to o-y
% Make lines/arrows or frame:
\@nameuse{psxs@\psk@axesstyle}% \psxs@axes or \psxs@frame or \psxs@polar
\ifPst@yAxis%
\begingroup%
\ifdim\pst@dima=\z@\else\showoriginfalse\fi%
\ifnum\psk@dy=\z@%
\pst@dimg=\psk@Dy\psyunit%
\ifdim\pst@dimg<\p@\pst@cnta=\psk@Dy\edef\psk@Dy{-\the\pst@cnta}\fi% v.1.21
\edef\psk@dy{\number\pst@dimg}%
\fi%
\ifPst@xAxis\else\showorigintrue\fi%
\pst@vlabels{\pst@dimd}{\psk@arrowB}{#3}{#5}%
\ifPst@xAxis\showoriginfalse\fi%
\pst@vlabels{\pst@dimb}{\psk@arrowA}{#3}{#5}%
\endgroup%
\fi%
\ifPst@xAxis%
\begingroup%
\ifdim\pst@dimb=\z@\else\showoriginfalse\fi%
\ifnum\psk@dx=\z@%
\pst@dimg=\psk@Dx\psxunit%
\ifdim\pst@dimg<\p@\pst@cnta=\psk@Dx\edef\psk@Dx{-\the\pst@cnta}% v.1.21
\fi% v.1.21
\edef\psk@dx{\number\pst@dimg}%
\fi%
\ifPst@yAxis\else\showorigintrue\fi%
\pst@hlabels{\pst@dimc}{\psk@arrowB}{#4}{#6}%
\ifPst@yAxis\showoriginfalse\fi%
\pst@hlabels{\pst@dima}{\psk@arrowA}{#4}{#6}%
\endgroup%
\fi%
% Now close "\pst@hbox" (which is 0-dimensional), and put it at the origin.
\egroup%
\pssetxlength\pst@dimg{#1}%
\pssetylength\pst@dimh{#2}%
\leavevmode\psput@cartesian\pst@hbox%
\endgroup%
\ignorespaces%
}
%
\newdimen\psk@subticksize\psk@subticksize=\z@
\newdimen\pst@xticksizeA
\newdimen\pst@xticksizeB
\newdimen\pst@xticksizeC
\newdimen\pst@yticksizeA
\newdimen\pst@yticksizeB
\newdimen\pst@yticksizeC
%
\def\set@xticksize#1{%
\pst@expandafter\pst@getydimdim{#1} {} {}\@nil % y-unit!!
\ifdim\pst@dimm>\pst@dimn % first > second value
\pst@xticksizeA=\the\pst@dimn%
\pst@xticksizeB=\the\pst@dimm%
\else
\pst@xticksizeA=\the\pst@dimm%
\pst@xticksizeB=\the\pst@dimn% first > second value
\fi
\edef\psk@xticksize{\pst@number\pst@xticksizeA \pst@number\pst@xticksizeB}%
\ifnum\psk@xlabelPos<\z@ % top
\pst@xticksizeC=\pst@dimn
\else
\pst@xticksizeC=\pst@dimm% bottom
\fi%
}
\def\set@yticksize#1{%
\pst@expandafter\pst@getxdimdim{#1} {} {}\@nil % x-unit!
\ifdim\pst@dimm>\pst@dimn % first > second value
\pst@yticksizeA=\the\pst@dimn%
\pst@yticksizeB=\the\pst@dimm%
\else
\pst@yticksizeA=\the\pst@dimm%
\pst@yticksizeB=\the\pst@dimn% first > second value
\fi
\edef\psk@yticksize{\pst@number\pst@yticksizeA \pst@number\pst@yticksizeB}%
\ifnum\psk@ylabelPos<\z@ % right
\pst@yticksizeC=\pst@dimn
\else
\pst@yticksizeC=\pst@dimo% left
\fi%
}
\newif\ifPst@maxxTicks
\newif\ifPst@maxyTicks
\define@key[psset]{}{ticksize}{%
\psDEBUG[key:ticksize]{setting ticksize}
\def\pst@tempA{max}%
\def\pst@tempB{#1}%
\ifx\pst@tempA\pst@tempB
\psDEBUG[key:ticksize]{setting ticksize to max}
\Pst@maxxTickstrue\Pst@maxyTickstrue
\set@xticksize{0 4pt}\set@yticksize{0 4pt}%
\else
\psDEBUG[key:ticksize]{setting ticksize to user values}
\Pst@maxxTicksfalse\Pst@maxyTicksfalse%
\set@xticksize{#1}\set@yticksize{#1}%
\fi}
\define@key[psset]{pstricks-add}{xticksize}{%
\def\pst@tempA{max}%
\def\pst@tempB{#1}%
\ifx\pst@tempA\pst@tempB
\Pst@maxxTickstrue\set@xticksize{0 4pt}%
\psDEBUG[key:xticksize]{setting ticksize to max}
\else\set@xticksize{#1}\Pst@maxxTicksfalse\fi}
\define@key[psset]{pstricks-add}{yticksize}{%
\def\pst@tempA{max}%
\def\pst@tempB{#1}%
\ifx\pst@tempA\pst@tempB
\psDEBUG[key:yticksize]{setting ticksize to max}
\Pst@maxyTickstrue\set@yticksize{0 4pt}%
\else\set@yticksize{#1}\Pst@maxyTicksfalse\fi}% overwrites the definition in pstricks
%\psset{ticksize=-4pt 4pt}
%
% full= 0, top=1, bottom=-1, inner=2 => -1 0 1 2
\def\psset@tickstyle#1{\pst@expandafter\psset@@tickstyle{#1}\@nil}% overwrite it
\def\psset@@tickstyle#1#2\@nil{%
\ifx#1f\let\psk@tickstyle\z@\else % full
\ifx#1t\let\psk@tickstyle\@ne % top
\edef\psk@xticksize{0 \pst@number\pst@xticksizeB}%
\edef\psk@yticksize{0 \pst@number\pst@yticksizeB}%
\else\ifx#1b\let\psk@tickstyle\m@ne % bottom
\edef\psk@xticksize{\pst@number\pst@xticksizeA 0}%
\edef\psk@yticksize{\pst@number\pst@yticksizeA 0}%
\else\ifx#1i\let\psk@tickstyle\tw@% % inner (for frame)
\else\@pstrickserr{Bad tick style: `#1#2'}\@ehpa
\fi\fi\fi\fi
}
%
\define@key[psset]{pstricks-add}{subticks}[1]{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}}
\define@key[psset]{pstricks-add}{xsubticks}[1]{\def\psk@xsubticks{#1}}
\define@key[psset]{pstricks-add}{ysubticks}[1]{\def\psk@ysubticks{#1}}
%
\define@key[psset]{pstricks-add}{subticksize}[0.75]{\def\psk@xsubticksize{#1}\def\psk@ysubticksize{#1}}
\define@key[psset]{pstricks-add}{xsubticksize}[0.75]{\def\psk@xsubticksize{#1}}
\define@key[psset]{pstricks-add}{ysubticksize}[0.75]{\def\psk@ysubticksize{#1}}
%
\define@key[psset]{pstricks-add}{tickwidth}[0.5\pslinewidth]{%
\pst@getlength{#1}\psk@xtickwidth%
\pst@getlength{#1}\psk@ytickwidth}
\define@key[psset]{pstricks-add}{xtickwidth}[0.5\pslinewidth]{\pst@getlength{#1}\psk@xtickwidth}
\define@key[psset]{pstricks-add}{ytickwidth}[0.5\pslinewidth]{\pst@getlength{#1}\psk@ytickwidth}
\define@key[psset]{pstricks-add}{subtickwidth}[0.25\pslinewidth]{%
\pst@getlength{#1}\psk@xsubtickwidth%
\pst@getlength{#1}\psk@ysubtickwidth}
\define@key[psset]{pstricks-add}{xsubtickwidth}[0.25\pslinewidth]{\pst@getlength{#1}\psk@xsubtickwidth}
\define@key[psset]{pstricks-add}{ysubtickwidth}[0.25\pslinewidth]{\pst@getlength{#1}\psk@ysubtickwidth}
%
\define@key[psset]{pstricks-add}{tickcolor}[black]{%
\pst@getcolor{#1}\psk@xtickcolor%
\pst@getcolor{#1}\psk@ytickcolor}
\define@key[psset]{pstricks-add}{xtickcolor}[black]{\pst@getcolor{#1}\psk@xtickcolor}
\define@key[psset]{pstricks-add}{ytickcolor}[black]{\pst@getcolor{#1}\psk@ytickcolor}
\define@key[psset]{pstricks-add}{subtickcolor}[gray]{%
\pst@getcolor{#1}\psk@xsubtickcolor%
\pst@getcolor{#1}\psk@ysubtickcolor}
\define@key[psset]{pstricks-add}{xsubtickcolor}[gray]{\pst@getcolor{#1}\psk@xsubtickcolor}
\define@key[psset]{pstricks-add}{ysubtickcolor}[gray]{\pst@getcolor{#1}\psk@ysubtickcolor}
%
\define@key[psset]{pstricks-add}{xticklinestyle}[solid]{%
\@ifundefined{psls@#1}%
{\@pstrickserr{Line style `#1' not defined}\@eha}%
{\def\psxticklinestyle{#1}}}
\define@key[psset]{pstricks-add}{xsubticklinestyle}[solid]{%
\@ifundefined{psls@#1}%
{\@pstrickserr{Line style `#1' not defined}\@eha}%
{\def\psxsubticklinestyle{#1}}}
\define@key[psset]{pstricks-add}{yticklinestyle}[solid]{%
\@ifundefined{psls@#1}%
{\@pstrickserr{Line style `#1' not defined}\@eha}%
{\def\psyticklinestyle{#1}}}
\define@key[psset]{pstricks-add}{ysubticklinestyle}[solid]{%
\@ifundefined{psls@#1}%
{\@pstrickserr{Line style `#1' not defined}\@eha}%
{\def\psysubticklinestyle{#1}}}
\define@key[psset]{pstricks-add}{ticklinestyle}[solid]{%
\@ifundefined{psls@#1}%
{\@pstrickserr{Line style `#1' not defined}\@eha}%
{\def\psxticklinestyle{#1}\def\psyticklinestyle{#1}}}
\define@key[psset]{pstricks-add}{subticklinestyle}[solid]{%
\@ifundefined{psls@#1}%
{\@pstrickserr{Line style `#1' not defined}\@eha}%
{\def\psxsubticklinestyle{#1}\def\psysubticklinestyle{#1}}}
%
%\psset{subticksize=0.75,subticks=1,tickcolor=black,ticklinestyle=solid,%
% subticklinestyle=solid,%
% subtickcolor=gray,%
% tickwidth=0.5\pslinewidth,%
% subtickwidth=0.25\pslinewidth}
%
\newif\ifis@yAxis%
%
\def\psxs@@axes#1#2#3#4#5#6{% llx,lly,urx,ury,exch,x|y,arrowA,arrowB
\pst@killglue%
\begin@SpecialObj%
\ifx#6x\relax% % x-axis?
\is@yAxisfalse%
\ifnum\psk@dx=\z@%
\pst@dimg=\psk@Dx\psxunit%
\def\psk@dx{\number\pst@dimg}%
\fi%
\else%
\is@yAxistrue%
\ifnum\psk@dy=\z@%
\pst@dimg=\psk@Dy\psyunit%
\def\psk@dy{\number\pst@dimg}%
\fi%
\fi%
\let\pst@linetype\pst@arrowtype%
\def\pst@tempA{none}%
\pst@addarrowdef%
\addto@pscode{
/showOrigin \ifPst@showOriginTick true \else false \fi def % ticks for 0/0 ?
\ifis@yAxis 0 \pst@number#4 \else \pst@number#3 0 \fi
\ifis@yAxis 0 \pst@number#2 \else \pst@number#1 0 \fi
ArrowA
CP 4 2 roll
ArrowB
/yEnd exch def /xEnd exch def
xEnd yEnd
\ifx\psk@axesstyle\pst@tempA
pop pop % axesstyle = none (only ticks)
\else
L % the line with arrows
\fi
/yStart exch def
/xStart exch def
\@nameuse{psls@\pslinestyle} % linestyle for the axes
stroke % draw the main line
% \psk@ticks: all=0; x=1; y=2; none=3
\number\psk@ticks\space dup 2 mod 0 eq \ifis@yAxis true \else false \fi and
exch 2 lt \ifis@yAxis false \else true \fi and or {
/viceversa
\ifis@yAxis\pst@number#2 \pst@number#4 \else\pst@number#1 \pst@number#3 \fi
gt { true }{ false } ifelse def % other way round
/epsilon 0.01 def % rounding errors
/minTickline \ifis@yAxis \pst@number#1 \else \pst@number#2 \fi def
/maxTickline \ifis@yAxis \pst@number#3 \else \pst@number#4 \fi def
/dT \ifis@yAxis \psk@dy \else \psk@dx \fi\space abs % added abs 2006-07-07
65536 div viceversa { neg } if def % div to get pt instead of sp
/subTNo \ifis@yAxis\psk@ysubticks\else\psk@xsubticks\fi \space def
subTNo 0 gt { /dsubT dT subTNo div def}{ /dsubT 0 def } ifelse % deltaSubTick
\ifis@yAxis \psk@yticksize \else \psk@xticksize \fi
/tickend exch def /tickstart exch def
/Twidth \ifis@yAxis \psk@ytickwidth \else \psk@xtickwidth \fi\space def
/subTwidth \ifis@yAxis \psk@ysubtickwidth \else \psk@xsubtickwidth \fi\space def
/STsize \ifis@yAxis \psk@ysubticksize \else \psk@xsubticksize \fi\space def
/TColor {
\ifis@yAxis\pst@usecolor\psk@ytickcolor
\else\pst@usecolor\psk@xtickcolor\fi\space } def
/subTColor {
\ifis@yAxis\pst@usecolor\psk@ysubtickcolor
\else\pst@usecolor\psk@xsubtickcolor\fi\space } def
/MinValue { \ifis@yAxis yStart \else xStart \fi
\ifx\psk@arrowA\@empty\else
\psk@arrowsize\space CLW mul add \psk@arrowlength\space mul
viceversa { sub epsilon add }{ add epsilon sub } ifelse \fi } def
/MaxValue { \ifis@yAxis yEnd \else xEnd \fi
\ifx\psk@arrowB\@empty\else
\psk@arrowsize\space CLW mul add \psk@arrowlength\space mul
viceversa { add epsilon sub }{ sub epsilon add } ifelse \fi } def
/logLines {
\ifnum\psk@logLines=\z@ true \else % all axes
\ifnum\psk@logLines<\tw@ % x axis
\ifis@yAxis false \else true \fi % do we have x or y axis
\else
\ifnum\psk@logLines<\thr@@ % y axis
\ifis@yAxis true \else false \fi % do we have x or y axis
\else
false % no one
\fi
\fi
\fi
} def
/LSstroke { % set linestyle and stroke
\ifis@yAxis\@nameuse{psls@\psyticklinestyle}
\else\@nameuse{psls@\psxticklinestyle}\fi stroke} def
/subLSstroke { % set sublinestyle and stroke
\ifis@yAxis\@nameuse{psls@\psysubticklinestyle}
\else\@nameuse{psls@\psxsubticklinestyle}\fi stroke} def
%\iffalse
% start ticks ---------------------------------------------------------
% showOrigin { 0 }{ dT } ifelse
0 dT MaxValue 1 add { % the positive part of the axes
/cntTick exch def % the index
logLines { % log lines?
gsave
1 10 subTNo div 9.99 { % do not write a line for 1
/dx exch def % save index
/x cntTick dT dx log mul add def %
x abs MaxValue abs le { % out of range?
\ifis@yAxis
\ifPst@maxyTicks true \else false \fi
\else
\ifPst@maxxTicks true \else false \fi
\fi
{ x minTickline #5 moveto
x maxTickline #5 lineto }
{ x tickstart STsize mul #5 moveto
x tickend STsize mul #5 lineto } ifelse
} if
} for
subTwidth SLW subTColor % set line width and subtick color
subLSstroke
grestore % restore main tick status
stroke
/dsubT 0 def % no other subticks
} if % end logLines
dsubT abs 0 gt { % du we have subticks?
gsave % save graphic state
% start subticks ----------------------------------------------------------
/cntsubTick cntTick dsubT add def
subTNo 1 sub {
cntsubTick abs MaxValue abs le { % out of range?
\ifis@yAxis
\ifPst@maxyTicks true \else false \fi
\else
\ifPst@maxxTicks true \else false \fi
\fi
{ cntsubTick minTickline STsize mul #5 moveto
cntsubTick maxTickline STsize mul #5 lineto }
{ cntsubTick tickstart STsize mul #5 moveto
cntsubTick tickend STsize mul #5 lineto } ifelse
}{ exit } ifelse
/cntsubTick cntsubTick dsubT add def
} repeat
subTwidth SLW subTColor % set line width and subtick color
subLSstroke
% end subticks ----------------------------------------------------------
grestore % restore tick status
} if
showOrigin {
gsave
\ifis@yAxis
\ifPst@maxyTicks true \else false \fi
\else
\ifPst@maxxTicks true \else false \fi
\fi
{ cntTick minTickline #5 moveto
cntTick maxTickline #5 lineto }
{ cntTick tickstart #5 moveto % line begin main Tick
cntTick tickend #5 lineto } ifelse % lineto tick end
Twidth SLW TColor % set line width and tick color
LSstroke
grestore
}{ /showOrigin true def } ifelse % only for the very first tick valid
} for
% end ticks ----------------------------------------------------------
%\fi
%\iffalse
% ================================================ % the other side
/showOrigin \ifPst@showOriginTick true \else false \fi def % ticks for 0/0 ?
/dT dT neg def % the other side of the axis
/dsubT dsubT neg def
% start ticks ----------------------------------------------------------
% showOrigin { 0 }{ dT } ifelse
0 dT MinValue epsilon viceversa { add }{ sub } ifelse {
/cntTick exch def
logLines { % log lines?
gsave
1 10 subTNo div 9.99 { % do not write a line for 1
/dx exch def % save index
/x cntTick dT dx log mul add def %
x abs MinValue abs le { % out of range?
\ifis@yAxis
\ifPst@maxyTicks true \else false \fi
\else
\ifPst@maxxTicks true \else false \fi
\fi
{ x minTickline #5 moveto
x maxTickline #5 lineto }
{ x tickstart STsize mul #5 moveto
x tickend STsize mul #5 lineto } ifelse
} if
} for
/dsubT 0 def
subTwidth SLW subTColor % set line width and subtick color
subLSstroke
grestore
} % end loglines
dsubT abs 0 gt { % do we have subticks?
gsave % save main state
% start subticks ----------------------------------------------------------
/cntsubTick cntTick dsubT add def
subTNo 1 sub {
cntsubTick abs MinValue abs le { % out of range?
cntsubTick tickstart STsize mul #5 moveto
cntsubTick tickend STsize mul #5 lineto
}{ exit } ifelse
/cntsubTick cntsubTick dsubT add def
} repeat % for
% end subticks ----------------------------------------------------------
subTwidth SLW subTColor % set line width and subtick color
subLSstroke
grestore % restore main state
} if
showOrigin {
gsave
cntTick tickstart #5 moveto % line begin main Tick
cntTick tickend #5 lineto % lineto tick end
Twidth SLW TColor % set line width and tick color
LSstroke
grestore
}{ /showOrigin true def } ifelse % only for the very first tick valid
} for
% end ticks ----------------------------------------------------------
%\fi
} if%
}% end of \pscode
\end@SpecialObj%
\ignorespaces%
}%
%
%
\def\psxs@frame{%
\begin@SpecialObj%
\addto@pscode{ % the frame
\pst@number\pst@dima \pst@number\pst@dimb moveto % lower left
\pst@number\pst@dimc \pst@number\pst@dimb L % upper left
\pst@number\pst@dimc \pst@number\pst@dimd L % upper right
\pst@number\pst@dima \pst@number\pst@dimd L % lower right
closepath
}%
\pst@stroke%
\psk@fillstyle%
\end@SpecialObj%
\let\psk@arrowA\@empty%
\let\psk@arrowB\@empty%
\pst@xticksizeC=\z@\pst@yticksizeC=\z@%
\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}% x axis
\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ exch }{y}% y axis
\ifnum\psk@tickstyle=\tw@ % llx,lly,urx,ury,exch,x|y,arrowA,arrowB
\psDEBUG[psxs@frame]{psk@tickstyle=2 (inner)}%
\psDEBUG[psxs@frame]{pst@dima=\pst@number\pst@dima}%
\psDEBUG[psxs@frame]{pst@dimb=\pst@number\pst@dimb}%
\psDEBUG[psxs@frame]{pst@dimc=\pst@number\pst@dimc}%
\psDEBUG[psxs@frame]{pst@dimd=\pst@number\pst@dimd}%
\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ neg \pst@number\pst@dimd add }{x}% % upper x axis
\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ neg \pst@number\pst@dimc add exch }{y}% right y axis
\fi%
}
%
\def\psxs@polar{% (rx,ry) % all other values are ignored
\pst@killglue
\begingroup
\edef\pst@dimC{\strip@pt\pst@dimc}% RadiusX
\pstFPDiv\pstR@dius{\pst@dimC}{\strip@pt\psxunit}% in cm and as int
\addbefore@par{Dy=30}% for the angle step
\use@keep@par
\pstFPDiv\pstN@lpha{360}{\psk@Dy}% No of (int) main lines
\pstFPdiv\pstd@lpha{\psk@Dy}{\psk@ysubticks}% sub dAlpha
\pstFPdiv\pstdR@dius{1}{\psk@xsubticks}% sub dRadius
\pst@cntm=\psk@xsubticks\advance\pst@cntm by \m@ne
\multido{\iA=\psk@Dx+\psk@Dx,\rB=\pstdR@dius+\psk@Dx,\iB=0+1}{\pstR@dius}{%
\multido{\rA=\rB+\pstdR@dius}{\the\pst@cntm}{\pscircle[linestyle=\psxsubticklinestyle,
linecolor=\psk@xsubtickcolor,linewidth=\psk@xsubtickwidth pt]{\rA}}
\pscircle[linestyle=\psxticklinestyle,linecolor=\psk@xtickcolor,
linewidth=\psk@xtickwidth pt]{\iA}%
\uput[-45](\iB,0){\pshlabel{\iB}}\uput[45](0,\iB){\pshlabel{\iB}}%
}%
% \uput[-45](\pstR@dius,0){\pstR@dius}\uput[45](0,\pstR@dius){\pstR@dius}%
\pst@cntm=\psk@ysubticks\advance\pst@cntm by \m@ne
\multido{\iA=\psk@Dy+\psk@Dy,\rB=\pstd@lpha+\psk@Dy}{\pstN@lpha}{%
\multido{\rA=\rB+\pstd@lpha}{\the\pst@cntm}{\psline[linestyle=\psysubticklinestyle,
linecolor=\psk@ysubtickcolor,linewidth=\psk@ysubtickwidth pt](\pstR@dius;\rA)}
\psline[linestyle=\psyticklinestyle,
linecolor=\psk@ytickcolor,linewidth=\psk@ytickwidth pt](\pstR@dius;\iA)%
\uput[\iA](\pstR@dius;\iA){\psvlabel{\iA}}}
\endgroup\ignorespaces%
\Pst@xAxisfalse\Pst@yAxisfalse%
}
% #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max
\def\pst@hlabels#1#2#3#4{%
\ifdim#1=\z@\else% % start from 0 ?
\ifx#2\empty\else\advance#1\ifdim#1>\z@-\fi7\pslinewidth\fi%
\pst@cnta=#1\relax% % Distance (in sp) to end.
\divide\pst@cnta\psk@dx\relax% % Number of ticks/labels
\ifnum\pst@cnta=\z@\else%
\pst@dimb=\psk@dx sp% % Space between ticks.
\ifPst@yAxis\else\showorigintrue\fi%
\ifnum\psk@labels<\tw@\ifPst@xAxis\pst@@hlabels\fi\fi%
\showoriginfalse%
\fi%
\fi%
}
% Knows \pst@dimb and \pst@cnta
\def\pst@@hlabels{%
\psDEBUG[pst@@hlabels]{xticksizeC=\the\pst@xticksizeC}%
\setbox\z@=\vbox{% save all in a box
\ifcase\psk@xlabelPos
\vskip-\pst@xticksizeA\vskip\pslabelsep\or
\vskip-1ex\vskip-\pslabelsep\or
\vskip-\pst@xticksizeB\vskip-\pslabelsep\vskip-1ex
\fi
\ifnum\pst@cnta<\z@ \pst@dimb=-\pst@dimb\fi
\hbox to\z@{%
\ifshoworigin\hbox to \z@{\hss\pst@@@hlabel{\psk@Ox}\hss}\fi%
\mmultido{\nA=\psk@Ox+\psk@Dx}{\pst@cnta}{%
\hskip\pst@dimb\hbox to \z@{\hss%
\ifdim\nA pt=\z@ \pst@@@hlabel{0}%
\else\expandafter\pst@@@hlabel{\nA}%
\fi% prevent -0, doesn't work with \ifnum
\hss}%
}\hss%
}%
}\ht\z@\z@ \dp\z@\z@ \box\z@}% set all values to zero
%
% #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max
% \psk@labels 0:all; 1:x; 2:y; 3:none
\def\pst@vlabels#1#2#3#4{%
\ifdim#1=\z@\else%
\ifx#2\empty\else\advance#1\ifdim#1>\z@-\fi7\pslinewidth\fi%
\pst@cnta=#1\relax% % % Distance (in sp) to end.
\divide\pst@cnta\psk@dy\relax% % Number of ticks/labels
\ifnum\pst@cnta=\z@\else%
\pst@dima=\psk@dy sp% % Space between ticks.
% \ifPst@xAxis\else\showorigintrue\fi%
\ifodd\number\psk@labels\else\ifPst@yAxis\pst@@vlabels\fi\fi%
\showoriginfalse%
\fi%
\fi%
}
% \pst@dima: the width between two labels in pt
% \pst@dimc: the coordinate of the origin in pt
% \pst@cnta: the lowest label
% \pst@ticksizeC the lowest or highest value
\def\pst@@vlabels{%
\psDEBUG[pst@@vlabels]{yticksizeC=\the\pst@yticksizeC}%
% for left labels we use \def\llap#1{\hb@xt@\z@{\hss#1}}
\vbox to\z@{%
\ifnum\pst@cnta>\z@ \pst@dima=-\pst@dima\fi% up or down label positions
\offinterlineskip%
\ifshoworigin%
\vbox to \z@{\vss\hbox to\z@{%
\ifcase\psk@ylabelPos%
\hss\pst@@@vlabel{\psk@Oy}\hskip\pslabelsep\hskip-\pst@yticksizeA\or%
\hskip\pslabelsep\hss\pst@@@vlabel{\psk@Oy}\hss\or % right labels
\hskip\pst@yticksizeB\hskip\pslabelsep\pst@@@vlabel{\psk@Oy}%
\fi}\vss}%
\fi%
\mmultido{\nA=\psk@Oy+\psk@Dy}{\pst@cnta}{%
\vbox to\pst@dima{\vss}%
\vbox to \z@{%
\vss\hbox to\z@{%
\ifcase\psk@ylabelPos% and also check for -0
\hss\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi%
\hskip\pslabelsep\hskip-\pst@yticksizeA\or% top
\hss\ifdim\nA pt=\z@\pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi%
\ifdim\pslabelsep=\z@\hss\else\kern-\pslabelsep\fi\or% axis
\hskip\pst@yticksizeB\hskip\pslabelsep%
\ifdim\nA pt=\z@\pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% bottom
\fi}\vss}%
}\vss}%
}
%
\define@key[psset]{pstricks-add}{nStep}[1]{\def\psk@nStep{#1}}
\define@key[psset]{pstricks-add}{nStart}[0]{\def\psk@nStart{#1}}
\define@key[psset]{pstricks-add}{nEnd}[{}]{\def\psk@nEnd{#1}}
\define@key[psset]{pstricks-add}{xStep}[0]{\def\psk@xStep{#1}}
\define@key[psset]{pstricks-add}{yStep}[0]{\def\psk@yStep{#1}}
%
\define@key[psset]{pstricks-add}{xStart}[{}]{\def\psk@xStart{#1}}
\define@key[psset]{pstricks-add}{xEnd}[{}]{\def\psk@xEnd{#1}}
\define@key[psset]{pstricks-add}{yStart}[{}]{\def\psk@yStart{#1}}
\define@key[psset]{pstricks-add}{yEnd}[{}]{\def\psk@yEnd{#1}}
%
\define@key[psset]{pstricks-add}{plotNo}[1]{\def\psk@plotNo{#1}}
\define@key[psset]{pstricks-add}{plotNoMax}[1]{\def\psk@plotNoMax{#1}}
%
%\psset{nStep=1, nStart=0, nEnd={},%
% xStep=0, yStep=0, xStart={}, xEnd={}, yStart={}, yEnd={}, comma=false,%
% plotNo=1,plotNoMax=1}%
%
\def\pstScalePoints(#1,#2)#3#4{%
% xScale | yScale | xOperator | yOperator
% the operators can be any Postscript code
\def\pstXScale{#1 }%
\def\pstYScale{#2 }%
\def\pstXPSScale{#3 }%
\def\pstYPSScale{#4 }%
\pst@def{ScalePoints}<%
/y ED /x ED
/yPSOp { #4 y mul #2 mul } def
/xPSOp { #3 x mul #1 mul } def
counttomark dup dup cvi eq not { exch pop } if
/m exch def /n m 2 div cvi def
n {
yPSOp m 1 roll xPSOp m 1 roll
/m m 2 sub
def } repeat>%
}
%\pstScalePoints(1,1){}{}% the default -> no special operators
%
\def\listplot@ii#1{%
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{/D {} def mark}%
#1%
\addto@pscode{
\tx@PreparePoints
\pst@number\psxunit
\pst@number\psyunit
\tx@ScalePoints
}%
\@nameuse{endplot@\psplotstyle}%
}
%
\define@boolkey[psset]{pstricks-add}[Psk@]{xyValues}[true]{}
\psset[pstricks-add]{xyValues}
%
\define@boolkey[psset]{pstricks-add}[Pst@]{ChangeOrder}[true]{}
%
\pst@def{PreparePoints}<{%
counttomark /m exch def
\ifPsk@xyValues\else % we have only y values
/mm m def
/M m 1 add def
m { mm exch M 2 roll /M M 1 add def /mm mm 1 sub def } repeat
/m m dup add def
\fi
\ifPst@ChangeOrder
/m0 m def
m \psk@plotNoMax\space 1 add div 1 sub cvi {
m0 \psk@plotNoMax\space 1 add roll /m0 m0 \psk@plotNoMax\space 1 add sub def
} repeat
\fi
/n m \psk@plotNoMax\space 1 add div cvi def
\psk@plotNoMax\space 1 gt {% multiple data files?
n {
\psk@plotNoMax\space \psk@plotNo\space 1 sub neg roll % x yNo y y y ...
\psk@plotNoMax\space 1 sub { pop } repeat % x yNo
/m m \psk@plotNoMax\space 1 sub sub def
m 2 roll
} repeat
} if % no multiple data files
% counttomark /m exch def
% /n m 2 div cvi def
/xMax -99999 def /yMax -99999 def
/xP 0 def /yP 0 def
m copy
n {
/y exch def /x exch def
xMax x lt { /xMax x def } if
yMax y lt {/yMax y def } if
xP x gt { /xP x def } if
yP y gt { /yP y def } if
} repeat
% m 2 roll
\psk@xStep\space 0 gt \psk@yStep\space 0 gt or (\psk@xStart) length 0 gt or
(\psk@yStart) length 0 gt or (\psk@xEnd) length 0 gt or (\psk@yEnd) length 0 gt or {
%
(\psk@xStart) length 0 gt {\psk@xStart\space }{ xP } ifelse /xStart exch def
(\psk@yStart) length 0 gt {\psk@yStart\space }{ yP } ifelse /yStart exch def
(\psk@xEnd) length 0 gt { \psk@xEnd\space }{ xMax } ifelse /xEnd exch def
(\psk@yEnd) length 0 gt { \psk@yEnd\space }{ yMax } ifelse /yEnd exch def
n {
m -2 roll
2 copy /yVal exch def /xVal exch def
xVal xP ge
yVal yP ge and
xVal xEnd le and
yVal yEnd le and
xVal xStart ge and
yVal yStart ge and {
/xP xP \psk@xStep\space add def
/yP yP \psk@yStep\space add def
}{%
pop pop
/m m 2 sub def
} ifelse
} repeat
}{%
/ncount 1 def
(\psk@nEnd) length 0 gt { \psk@nEnd\space }{ m } ifelse
/nEnd exch def
n {
m -2 roll
\psk@nStep\space 1 gt { ncount \psk@nStart\space sub \psk@nStep\space mod 0 eq }{ true } ifelse
ncount nEnd le and
ncount \psk@nStart\space ge and not {
% ncount nEnd le and
% ncount \psk@nStart\space ge and not {
pop pop
/m m 2 sub def
} if
/ncount ncount 1 add def
} repeat
} ifelse
}>
%
%
\define@key[psset]{pstricks-add}{xAxisLabel}[x]{\def\psk@xAxisLabel{#1}}
\define@key[psset]{pstricks-add}{yAxisLabel}[y]{\def\psk@yAxisLabel{#1}}
%\psset{xAxisLabel=x,yAxisLabel=y}
\iffalse
\define@key[psset]{pstricks-add}{xAxisLabelPos}{%
\def\pst@tempA{#1}%
\ifx\pst@tempA\@empty\let\psk@xAxisLabelPos\relax\else%
\pst@getcoor{#1}\psk@xAxisLabelPos\fi}
\define@key[psset]{pstricks-add}{yAxisLabelPos}{%
\def\pst@tempA{#1}%
\ifx\pst@tempA\@empty\let\psk@yAxisLabelPos\relax\else%
\pst@getcoor{#1}\psk@yAxisLabelPos\fi}
\fi
\define@key[psset]{pstricks-add}{xAxisLabelPos}[{}]{\def\psk@xAxisLabelPos{#1}}
\define@key[psset]{pstricks-add}{yAxisLabelPos}[{}]{\def\psk@yAxisLabelPos{#1}}
%\psset{yAxisLabelPos={},xAxisLabelPos={}}
%
\newdimen\psk@llx
\newdimen\psk@lly
\newdimen\psk@urx
\newdimen\psk@ury
\define@key[psset]{pstricks-add}{llx}[\z@]{\pssetxlength\psk@llx{#1}}
\define@key[psset]{pstricks-add}{lly}[\z@]{\pssetylength\psk@lly{#1}}
\define@key[psset]{pstricks-add}{urx}[\z@]{\pssetxlength\psk@urx{#1}}
\define@key[psset]{pstricks-add}{ury}[\z@]{\pssetylength\psk@ury{#1}}
%\psset{llx=\z@, lly=\z@, urx=\z@, ury=\z@}% prevents rounding errors
\newif\ifPst@plot@box
\define@key[psset]{pstricks-add}{box}[true]{\@nameuse{Pst@plot@box#1}}
%
\newdimen\pst@xunit
\newdimen\pst@yunit
%
\def\psgraph{\pst@object{psgraph}}
\def\psgraph@i{\pst@getarrows\psgraph@ii}
\def\psgraph@ii(#1,#2){\catcode`\!=12\relax
\@ifnextchar({\psgraph@iii(#1,#2)}{\psgraph@iv(0,0)(#1,#2)}}
\def\psgraph@iii(#1,#2)(#3,#4){\@ifnextchar({\psgraph@v(#1,#2)(#3,#4)}{\psgraph@iv(#1,#2)(#3,#4)}}
%
\def\psgraph@iv(#1,#2)(#3,#4)#5#6{% no special origin defined
% minX | minY | maxX | maxY | Length x-axis | length y-axis%
\pst@killglue%
\begingroup%
\pst@dimo=#3\p@ \pst@dimp=#1\p@ \multiply\pst@dimp by \m@ne%
\advance\pst@dimo by \pst@dimp% delta x
\pst@dimm=#5%
\pstFPdiv\pst@@dx{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}%
\pst@xunit=\pst@@dx\p@
%
\pst@dimo=#4\p@ \pst@dimp=#2\p@ \multiply\pst@dimp by \m@ne%
\advance\pst@dimo by \pst@dimp% delta y
\ifx!#6\pst@dimm=\pst@@dx\pst@dimo\else\pst@dimm=#6\fi%
\pstFPdiv\pst@@dy{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}%
\pst@yunit=\pst@@dy\p@%
%
\pst@dimm=#1\pst@xunit%
\advance\pst@dimm by \psk@llx%
\pst@dimn=#2\pst@yunit%
\advance\pst@dimn by \psk@lly%
\pst@dimo=#3\pst@xunit%
\advance\pst@dimo by \psk@urx%
\pst@dimp=#4\pst@yunit%
\advance\pst@dimp by \psk@ury%
\if@star\pspicture*(\pst@dimm,\pst@dimn)(\pst@dimo,\pst@dimp)\else%
\pspicture(\pst@dimm,\pst@dimn)(\pst@dimo,\pst@dimp)\fi%
\psset{xunit=\pst@xunit,yunit=\pst@yunit}%
\bgroup%
\use@par%
\psaxes(#1,#2)(#3,#4)%
\egroup%
\psgraph@vi(#1,#2)(#1,#2)(#3,#4)%
}
\def\psgraph@v(#1,#2)(#3,#4)(#5,#6)#7#8{% with special origin
% Xorig | yorig | minX | minY | maxX | maxY | Length x-axis | length y-axis%
\pst@killglue%
\begingroup%
\pst@dimo=#5\p@ \pst@dimp=#3\p@ \multiply\pst@dimp by \m@ne%
\advance\pst@dimo by \pst@dimp% delta x
\pst@dimm=#7%
\pstFPdiv\pst@@dx{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}%
\pst@xunit=\pst@@dx\p@%
%
\pst@dimo=#6\p@\pst@dimp=#4\p@\multiply\pst@dimp by \m@ne%
\advance\pst@dimo by \pst@dimp% delta y
\ifx!#8\pst@dimm=\pst@@dx\pst@dimo\else\pst@dimm=#8\fi%
\pstFPdiv\pst@@dy{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}%
\pst@yunit=\pst@@dy\p@
%
\pst@dima=#3\pst@xunit \advance\pst@dima by \psk@llx%
\pst@dimb=#4\pst@yunit \advance\pst@dimb by \psk@lly%
\pst@dimc=#5\pst@xunit \advance\pst@dimc by \psk@urx%
\pst@dimd=#6\pst@yunit \advance\pst@dimd by \psk@ury%
\if@star\pspicture*(\pst@dima,\pst@dimb)(\pst@dimc,\pst@dimd)\else%
\pspicture(\pst@dima,\pst@dimb)(\pst@dimc,\pst@dimd)\fi%
\psset{xunit=\pst@xunit,yunit=\pst@yunit}%
\bgroup%
\use@par%
\psaxes(#1,#2)(#3,#4)(#5,#6)%
\egroup%
\psgraph@vi(#1,#2)(#3,#4)(#5,#6)%
}
%
\def\setxLabelC@@r#1,#2(#3,#4)(#5){%
\pst@getcoor{#5}\pst@tempB%
\ifx c#1
\pssetylength\pst@dimm{#2}%
\rput(! #4 #3 add 2 div \pst@number\pst@dimm \pst@tempB\space exch pop add
\pst@number\psyunit div ){\psk@xAxisLabel}%
\else%
\pst@getcoor{\psk@xAxisLabelPos}\pst@tempA%
\rput(! \pst@tempA\space \pst@tempB\space exch pop add \tx@UserCoor ){\psk@xAxisLabel}%
\fi}
\def\setyLabelC@@r#1,#2(#3,#4)(#5){%
\pst@getcoor{#5}\pst@tempB%
\ifx c#2
\pssetxlength\pst@dimm{#1}%
\rput{90}(! \pst@number\pst@dimm \pst@tempB\space pop add \pst@number\psxunit div #4 #3 add 2 div ){\psk@yAxisLabel}%
\else%
\pst@getcoor{\psk@yAxisLabelPos}\pst@tempA%
\rput{90}(! \pst@tempB\space pop \pst@tempA\space 3 1 roll add exch \tx@UserCoor ){\psk@yAxisLabel}%
\fi
}
%
\def\psgraph@vi(#1,#2)(#3,#4)(#5,#6){%
\ifx\psk@xAxisLabel\@empty\else%
\ifx\psk@xAxisLabelPos\@empty\uput[0](#5,#2){\psk@xAxisLabel}%
\else \expandafter\setxLabelC@@r\psk@xAxisLabelPos(#3,#5)(#1,#2)\fi%
\fi%
\ifx\psk@yAxisLabel\@empty\else%
\ifx\psk@yAxisLabelPos\@empty\uput[90](#1,#6){\psk@yAxisLabel}%
\else\expandafter\setyLabelC@@r\psk@yAxisLabelPos(#4,#6)(#1,#2)\fi%
\fi%
\ignorespaces%
}
\def\endpsgraph{%
\pst@killglue%
\endpspicture%
\endgroup%
}
\@namedef{psgraph*}{\psgraph*}
\@namedef{endpsgraph*}{\endpsgraph}
%
\define@key[psset]{pstricks-add}{ignoreLines}{\def\psk@ignoreLines{#1}}
\newcount\linecnt
\begingroup
\catcode`\,=13
\catcode`\_=13
\gdef\savedata@#1[#2]{%
\xdef\pst@tempg{#2_}%
\endgroup
\let#1\pst@tempg
\global\let\pst@tempg\relax
\ignorespaces}
\gdef\readdata@{%
\read1 to \pst@tempA
\ifnum\linecnt=\psk@nStep
\global\linecnt=0
\expandafter\readdata@@\pst@tempA_\@nil
\fi
\global\advance\linecnt by 1
\ifeof1\else\expandafter\readdata@\fi}
\gdef\pst@@readfile#1#2\@nil{\addto@pscode{,#1#2}}%
\gdef\readdata@@#1#2\@nil{\xdef\pst@tempg{\pst@tempg,#1#2}}%
\endgroup
\def\readdata{\@ifnextchar[{\readdata@i}{\readdata@i[]}}
\def\readdata@i[#1]#2#3{%
\def\pst@tempA{#1}%
\ifx\pst@tempA\@empty\else\psset{#1}\fi
\openin1=#3
\begingroup
\def\pst@tempg{}%
\ifeof1
\@pstrickserr{Data file `#3' not found.}\@ehpa
\else
\pst@datadelimiters
\catcode`\[=1
\catcode`\]=2
\pst@cnta=0
\loop \ifnum\the\pst@cnta<\psk@ignoreLines
\advance\pst@cnta by 1\relax
\read1 to \pst@tempA
\repeat
\ifnum\Pst@Debug>0 \typeout{>>> ignored \the\pst@cnta\space data lines}\fi%
\global\linecnt=\psk@nStep%
\readdata@%
\fi%
\endgroup%
\global\let#2\pst@tempg%
\global\let\pst@tempg\relax%
\ignorespaces}
%
% D.G. addition - Jun. 9, 1998 - Polar plots using the \psplot macro
% Code added according the way suggested by Ulrich Dirr <udirr@das-team.com>
% For polar plots
\define@boolkey[psset]{pstricks-add}[Pst@]{polarplot}[true]{}
\define@boolkey[psset]{pstricks-add}[Pst@]{algebraic}[true]{}
\psset[pstricks-add]{polarplot=false,algebraic=false}% remark of ML
%
\define@key[psset]{pstricks-add}{method}{\def\psk@method{#1}}% adams - rk4
\define@key[psset]{pstricks-add}{whichabs}{\def\psk@whichabs{#1}}%
\define@key[psset]{pstricks-add}{whichord}{\def\psk@whichord{#1}}%
\define@key[psset]{pstricks-add}{plotfuncx}{\def\psk@plotfuncx{#1}}%
\define@key[psset]{pstricks-add}{plotfuncy}{\def\psk@plotfuncy{#1}}%
\define@key[psset]{pstricks-add}{expression}{\def\psk@expression{#1}}%
\define@boolkey[psset]{pstricks-add}[Pst@]{buildvector}[true]{}%
\def\@rkiv{rk4}% Runge-Kutta 4 method
\def\@adams{adams}% Adams method
\def\@default{default}% Adams method
%
\define@boolkey[psset]{pstricks-add}[Pst@]{VarStep}[true]{}
\define@key[psset]{pstricks-add}{PlotDerivative}{\def\psk@PlotDerivative{#1}}%
\define@key[psset]{pstricks-add}{VarStepEpsilon}{\def\psk@VarStepEpsilon{#1}}%
\define@key[psset]{pstricks-add}{varsteptol}{\def\psk@varsteptol{#1}}% adams - rk4
\define@key[psset]{pstricks-add}{adamsorder}{\def\psk@adamsorder{#1}}% adams - rk4
%\define@key[psset]{pstricks-add}{varstepincrease}{\def\psk@varstepincrease{#1}}% varrk4
%
\def\psplot@i#1#2{\@ifnextchar[{\psplot@I{#1}{#2}}{\psplot@I{#1}{#2}[]}}
\def\psplot@I#1#2[#3]#4{%
\pst@killglue%
\begingroup%
\use@par%
\@nameuse{beginplot@\psplotstyle}%
% D.G. modification begin - Jun. 9, 1998
\ifPst@polarplot%
\addto@pscode{
\psplot@init
#3
/x #1 def
/x1 #2 def
/dx x1 x sub \psk@plotpoints div def
/F@pstplot \ifPst@algebraic (#4)
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx
\else { #4 } \fi def
\ifPst@VarStep
/StillZero 0 def /LastNonZeroStep dx def
/F2@pstplot tx@Derive begin (#4) (x) Derive (x) Derive end
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx def
%% computation of the tolerance defined by plotpoints
/epsilon12 \ifx\psk@VarStepEpsilon\@default tx@Derive begin F2@pstplot end dx 3 exp abs mul abs
\else\psk@VarStepEpsilon\space 12 mul \fi def
/ComputeStep {
dup 1e-4 lt
{ pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def }
{ epsilon12 exch div 1 3 div exp /StillZero 0 def }
ifelse } bind def
\fi
/xy {% Adapted from \parametricplot@i
F@pstplot x \ifPst@algebraic RadtoDeg \fi PtoC
% #4 dup x cos mul exch x sin mul
\pst@number\psyunit mul exch
\pst@number\psxunit mul exch
} def}%
\else% polarplot
% D.G. modification end
\addto@pscode{
\psplot@init
#3
/x #1 def
/x1 #2 def
/dx x1 x sub \psk@plotpoints div def
/F@pstplot \ifPst@algebraic (#4)
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx
\else { #4 } \fi def
\ifPst@VarStep
/StillZero 0 def /LastNonZeroStep dx def
/F2@pstplot tx@Derive begin (#4) (x) Derive (x) Derive end
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx def
%% computation of the tolerance defined by plotpoints
/epsilon12 \ifx\psk@VarStepEpsilon\@default tx@Derive begin F2@pstplot end dx 3 exp abs mul abs
\else\psk@VarStepEpsilon\space 12 mul \fi def
/ComputeStep {
dup 1e-4 lt
{ pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def }
{ epsilon12 exch div 1 3 div exp /StillZero 0 def }
ifelse } bind def
\fi
/xy {
x \pst@number\psxunit mul F@pstplot \pst@number\psyunit mul
% \ifPst@algebraic F@pstplot \else #4 \fi \pst@number\psyunit mul
} def}%
\fi%
\gdef\psplot@init{}%
\@pstfalse%
\@nameuse{testqp@\psplotstyle}%
\if@pst\psplot@ii\else\psplot@iii\fi%
\endgroup%
\ignorespaces}
%
\def\psplot@ii{%
\ifPst@VarStep%
\addto@pscode{%
mark xy \@nameuse{beginqp@\psplotstyle}
{ F2@pstplot abs ComputeStep
x 2 copy add dup x1 gt {pop x1} if /x exch def F2@pstplot abs ComputeStep
/x 3 -1 roll def 2 copy gt { exch } if pop
/x x 3 -1 roll add dup x1 gt {pop x1} if def
xy \@nameuse{doqp@\psplotstyle}
x x1 eq { exit } if} loop}%
\else\pst@killglue%
\addto@pscode{
/ps@Exit false def
xy \@nameuse{beginqp@\psplotstyle}
\ifx\psk@method\@varrkiv\else\psk@plotpoints 1 sub \fi {
/x x dx add \ifx\psk@method\@varrkiv dup x1 gt { pop x1 } if \fi def
xy \@nameuse{doqp@\psplotstyle}
\ifx\psk@method\@varrkiv x x1 eq { exit } if \fi
}
ps@Exit { exit } if
\ifx\psk@method\@varrkiv loop \else repeat \fi
ps@Exit not {
/x x1 def
xy \@nameuse{doqp@\psplotstyle}
} if }%
\fi%
\@nameuse{endqp@\psplotstyle}}
\def\psplot@iii{%
\ifPst@VarStep%
\addto@pscode{
/n 2 def
mark
{ xy n 2 roll F2@pstplot abs
ComputeStep x 2 copy add dup x1 gt {pop x1} if
/x exch def F2@pstplot abs ComputeStep
/x 3 -1 roll def 2 copy gt { exch } if pop
/x x 3 -1 roll dup /LastNonZeroStep exch def add dup x1 gt {pop x1} if def /n n 2 add def
x x1 eq { exit } if } loop
xy
n 2 roll}%
\else\pst@killglue%
\addto@pscode{
mark
/n 2 def
\ifx\psk@method\@varrkiv\else\psk@plotpoints\fi {
xy
n 2 roll
/n n 2 add def
/x x dx add \ifx\psk@method\@varrkiv dup x1 gt { pop x1 } if \fi def
\ifx\psk@method\@varrkiv x x1 eq { exit } if \fi
} \ifx\psk@method\@varrkiv loop\else repeat \fi \space
/x x1 def
xy
2 copy \tx@UserCoor 2 array astore /SaveFinalState ED
n 2 roll}%
\fi%
\@nameuse{endplot@\psplotstyle}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\parametricplot@i#1#2{\@ifnextchar[{\parametricplot@I{#1}{#2}}{\parametricplot@I{#1}{#2}[]}}
\def\parametricplot@I#1#2[#3]#4{%
\pst@killglue%
\begingroup
\use@par
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{%
\psplot@init
#3
/t #1 def
/t1 #2 def
/dt t1 t sub \psk@plotpoints div def
/F@pstplot \ifPst@algebraic (#4)
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx
\else { #4 } \fi def
\ifPst@VarStep
/StillZero 0 def /LastNonZeroStep dt def
/F2@pstplot tx@Derive begin (#4) (t) Derive (t) Derive end
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx def
%% computation of the tolerance defined by plotpoints
/epsilon12 \ifx\psk@VarStepEpsilon\@default
tx@Derive begin F2@pstplot end Pyth
dt 3 exp abs mul
\else\psk@VarStepEpsilon\space 12 mul \fi def
/ComputeStep {
dup 1e-4 lt
{ pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def }
{ epsilon12 exch div 1 3 div exp /StillZero 0 def }
ifelse } bind def
\fi
/xy {
\ifPst@algebraic F@pstplot \else #4 \fi
\pst@number\psyunit mul exch
\pst@number\psxunit mul exch
} def}%
\gdef\psplot@init{}%
\@pstfalse
\@nameuse{testqp@\psplotstyle}%
\if@pst
\parametricplot@ii
\else
\parametricplot@iii
\fi
\endgroup
\ignorespaces}
\def\parametricplot@ii{%
\ifPst@VarStep
\addto@pscode{%
mark xy \@nameuse{beginqp@\psplotstyle}
{ F2@pstplot Pyth ComputeStep
t 2 copy add dup t1 gt {pop t1} if /t exch def F2@pstplot Pyth ComputeStep
/t 3 -1 roll def 2 copy gt { exch } if pop
/t t 3 -1 roll add dup t1 gt {pop t1} if def
xy \@nameuse{doqp@\psplotstyle}
t t1 eq { exit } if } loop}%
\else\pst@killglue%
\addto@pscode{%
/ps@Exit false def
xy \@nameuse{beginqp@\psplotstyle}
\psk@plotpoints 1 sub {
/t t dt add def
xy \@nameuse{doqp@\psplotstyle}
ps@Exit { exit } if
} repeat
ps@Exit not {
/t t1 def
xy \@nameuse{doqp@\psplotstyle}
} if }%
\fi%
\@nameuse{endqp@\psplotstyle}}
\def\parametricplot@iii{%
\ifPst@VarStep
\addto@pscode{%
/n 2 def
mark
{ xy n 2 roll F2@pstplot Pyth
ComputeStep t 2 copy add dup t1 gt {pop t1} if
/t exch def F2@pstplot Pyth ComputeStep
/t 3 -1 roll def 2 copy gt { exch } if pop
/t t 3 -1 roll dup /LastNonZeroStep exch def add dup t1 gt {pop t1} if def /n n 2 add def
t t1 eq { exit } if } loop
xy n 2 roll}%
\else\pst@killglue%
\addto@pscode{%
mark
/n 2 def
\psk@plotpoints {
xy
n 2 roll
/n n 2 add def
/t t dt add def
} repeat
/t t1 def
xy
n 2 roll}%
\fi%
\@nameuse{endplot@\psplotstyle}}
%
\define@key[psset]{pstricks-add}{barwidth}{\pst@getlength{#1}\Add@barwidth}
\psset[pstricks-add]{barwidth=0.25cm}
%
\def\psbar@ii{\addto@pscode{false \tx@NArray \psbar@iii}}
\def\psbar@iii{%
newpath
n {
/Yval exch def /Xval exch def
Xval \number\Add@barwidth 0.5 mul sub 0 moveto
0 Yval rlineto \number\Add@barwidth 0 rlineto
0 Yval neg rlineto \number\Add@barwidth neg 0 rlineto
} repeat
}%
\def\beginplot@bar{\begin@SpecialObj}
\def\endplot@bar{%
\psbar@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi%
\pst@stroke
\end@SpecialObj}
%
\define@key[psset]{pstricks-add}{PSfont}[Times-Roman]{\def\psk@PSfont{/#1 }}
\define@key[psset]{pstricks-add}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth }
\define@key[psset]{pstricks-add}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale }
\define@key[psset]{pstricks-add}{decimals}[-1]{\pst@getint{#1}\psk@decimals }
\psset[pstricks-add]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1}
%
\def\psvalues@ii{
\addto@pscode{false \tx@NArray \psvalues@iii}}
\def\psvalues@iii{%
\psk@PSfont findfont \psk@fontscale scalefont setfont
newpath
n { /yO ED /xO ED
gsave
% \psk@valuewidth 2 div \psk@fontscale mul 0 rlineto 0 \psk@fontscale rlineto
% \psk@valuewidth 2 div \psk@fontscale mul neg 0 rlineto 0 \psk@fontscale neg rlineto
% closepath gsave 1 setgray fill stroke grestore
yO \pst@number\psyunit div
\psk@decimals 0 eq { cvi } if
\psk@decimals 0 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
\psk@valuewidth string cvs /Str ED
Str stringwidth pop /yS \psk@fontscale def /xS ED
gsave newpath
xO yO \pst@number\pslabelsep add moveto \psk@rot rotate
xS 0 rlineto 0 yS rlineto xS neg 0 rlineto 0 yS neg rlineto
closepath 1 setgray fill stroke grestore
xO yO \pst@number\pslabelsep add moveto \psk@rot rotate Str show grestore } repeat
}%
\def\beginplot@values{\begin@SpecialObj}
\def\endplot@values{%
\psvalues@ii%
\pst@stroke
\end@SpecialObj}
%
%
% LSM Least Square Method 2006-03-13 (hv)
\def\psLSM@ii{\addto@pscode{ false \tx@NArray \psLSM@iii }}
\def\psLSM@iii{%
/xiSquare 0 def % xi*xi
/xi 0 def % xi
/fi 0 def % f(xi)
/xifi 0 def % xi*f(xi)
exch dup dup /xEnd ED /xStart ED exch
n { % number of data pairs
/Yval ED /Xval ED % save x y values
/xi xi Xval add def % sum xi
/xiSquare xiSquare Xval dup mul add def % sum xi*xi
/xifi xifi Xval Yval mul add def % sum xi*yi, same as xi*f(xi)
/fi fi Yval add def % sum yi, same as f(xi)
Xval xStart lt { /xStart Xval def } if % find the lowest xi
Xval xEnd gt { /xEnd Xval def } if % find the largest xi
} repeat
/u xiSquare fi mul xi xifi mul sub n xiSquare mul xi dup mul sub div def
/v n xifi mul xi fi mul sub n xiSquare mul xi dup mul sub div def
\Pst@Debug\space 0 gt { % print the equation
/Helvetica findfont 12 scalefont setfont
0 -50 moveto (y=) show % print y=
v 20 string cvs show ( x+) show % m*x+
u \pst@number\psyunit div 20 string cvs show } if
newpath
(\psk@xStart) length 0 gt % special start value?
{ \psk@xStart\space \pst@number\psxunit mul }
{ xStart } ifelse
dup v mul u add % xStart f(xStart)
moveto % goto first point x1 y(x1)
(\psk@xEnd) length 0 gt % special end value?
{ \psk@xEnd\space \pst@number\psxunit mul }
{ xEnd } ifelse
dup v mul u add % xEnd f(xEnd)
lineto % line to second point x2 y(x2)
}%
%
\def\beginplot@LSM{\begin@SpecialObj}
\def\endplot@LSM{%
\psLSM@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi%
\pst@stroke
\end@SpecialObj%
}
%
\define@key[psset]{pstricks-add}{StepType}{\pst@expandafter\psset@@StepType{#1}\@nil}%
\def\psset@@StepType#1#2\@nil{%
\ifx#1u\let\psk@StepType\@ne
\else\ifx#1l\let\psk@StepType\z@
\else\ifx#1i\let\psk@StepType\thr@@
\else\ifx#1s\let\psk@StepType\f@ur
\else\let\psk@StepType\tw@\fi\fi\fi\fi}
\psset{StepType=lower} % alternative StepType=upper/inf/sup/Riemann
%
\def\psStep{\pst@object{psStep}}
\def\psStep@i(#1,#2)#3#4{%
\begin@ClosedObj%
\addto@pscode{
\ifPst@algebraic /Func (#4) tx@addDict begin AlgParser end cvx def \fi
/x #1 def
/dx #2 #1 sub #3 div def
/scx { \pst@number\psxunit mul } def
/scy { \pst@number\psyunit mul } def
\ifcase\psk@StepType % 0->lower, height is always f(x)
x scx 0 moveto
#3 {
\ifPst@algebraic Func \else #4 \fi scy dup x scx exch lineto
/x x dx add def
x scx exch lineto x scx 0 lineto
} repeat
\or % 1-> upper, height is always f(x+dx)
x scx 0 moveto
#3 {
/x x dx add def
\ifPst@algebraic Func \else #4 \fi scy dup x dx sub scx exch lineto
x scx exch lineto x scx 0 lineto
} repeat
\or % 2-> Riemann
/eps3 100 def
/xMinMax [] def
/AMax [] def
/AMin [] def
/dt dx eps3 div def
#3 {
/Max \ifPst@algebraic Func \else #4 \fi def
/Min Max def
/t x def % save x value
eps3 {
\ifPst@algebraic Func \else #4 \fi
dup
Max lt { /Max exch def } { dup Min gt { /Min exch def }{ pop } ifelse } ifelse
/x x dt add def
} repeat
/x t def % restore
x scx Min scy Max scy xMinMax aload length 3 add array astore /xMinMax exch def
/x x dx add def
} repeat
/dx dx scx def
xMinMax aload length 3 div cvi {
/yMax ED /yMin ED /x ED
x yMin moveto dx 0 rlineto x dx add yMax lineto
dx neg 0 rlineto x yMin lineto } repeat
\or % 3->inf(imum)
x scx 0 moveto
#3 {
\ifPst@algebraic Func \else #4 \fi /y0 ED % left value f(x)
/xOld x def
/x x dx add def
\ifPst@algebraic Func \else #4 \fi /y1 ED % right value f(x+dx)
y0 y1 lt { y0 }{ y1 } ifelse % use infimum
scy dup xOld scx exch lineto
x scx exch lineto x scx 0 lineto
} repeat
\or % 4-> sup(remum)
x scx 0 moveto
#3 {
\ifPst@algebraic Func \else #4 \fi /y0 ED % left value f(x)
/x x dx add def
\ifPst@algebraic Func \else #4 \fi /y1 ED % right value f(x+dx)
y0 y1 gt { y0 }{ y1 } ifelse % use supremum
scy dup x dx sub scx exch lineto
x scx exch lineto x scx 0 lineto
} repeat
\fi
}%
\psk@fillstyle
\pst@stroke
\end@ClosedObj%
}
%
\define@key[psset]{pstricks-add}{Derive}{\def\psk@Derive{#1}}%
\define@boolkey[psset]{pstricks-add}[PST@]{Tnormal}[true]{}
\psset[pstricks-add]{CMYK=true}
\def\@NOTEMPTY{NOT@EMPTY}%%dr 0606
%
\def\psTangentLine{\pst@object{psTangentLine}}
\def\psTangentLine@i(#1,#2)(#3,#4)(#5,#6)#7#8{%
\begin@OpenObj%
\addto@pscode{
[[#1 dup dup mul exch 1 #2]
[#3 dup dup mul exch 1 #4]
[#5 dup dup mul exch 1 #6]]
SolveLinEqSystem
/abc ED
abc aload pop % a b c on stack
exch #7 % a c b x
mul add exch % c+b*x a
#7 dup mul mul add % a*x^2+b*x+c
/y0 ED % save value
abc aload pop pop exch % b a
#7 mul 2 mul add % b+2*a*x0=mTan
\ifPST@Tnormal
neg 1 exch div % mOrth
#8 mul /dy ED % mOrth*dx
[
#7 #8 add y0 dy add \tx@ScreenCoor % x0+dx y0 +dy
#7 y0 \tx@ScreenCoor % x0 y0
\else
dup % mTan mTan
#8 mul /dy1 ED % mTan*dx
#8 neg mul /dy2 ED % mTan*-dx
[
#7 #8 add y0 dy1 add \tx@ScreenCoor % x0+dx y0 +dy1
#7 #8 sub y0 dy2 add \tx@ScreenCoor % x0-dx y0 +dy2
\fi
/Lineto /lineto load def
\ifshowpoints true \else false \fi
\tx@setlinejoin %
\tx@Line }%
\end@OpenObj\ignorespaces}
\def\psplotTangent@ii#1,#2,#3\@nil{%
\def\pst@tempLeft{#1}%
\def\pst@tempRight{#2}}
%% #1 : x value
%% #2 : delta x or x0,x1
%% #3 : function
\def\psplotTangent{\@ifnextchar*{\def\pst@tempA{true }\psplotTangent@v}{\def\pst@tempA{false }\psplotTangent@v*}}
\def\psplotTangent@v*{\@ifnextchar[{\psplotTangent@i}{\psplotTangent@i[]}}
\def\psplotTangent@i[#1]#2#3#4{%
\expandafter\psplotTangent@ii#3,,\@nil
\def\pst@par{#1}%
\ifx\psk@Derive\@empty\ifPst@algebraic\addbefore@par{Derive=NOT@EMPTY}\fi\fi%%dr 0606
\begin@OpenObj%
\addto@pscode{
/StarVersion \pst@tempA def
gsave % save current state
/F@pstplot \ifPst@algebraic (#4) tx@addDict begin AlgParser end cvx \else { #4 } \fi def % define function
\ifx\psk@Derive\@empty\else
\ifx\psk@Derive\@NOTEMPTY\else%%dr 0606
/FDer@pstplot % do we have a derivation defined?
\ifPst@algebraic (\psk@Derive) tx@addDict begin AlgParser end cvx \else { \psk@Derive } \fi def % define derivation
\fi%%dr 0606
\fi
/@parametric false def %%dr 0606
% first we calculate the origin
#2 dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
%%{ /y ED /x ED } % if yes, then we have 2 values
{ /y ED /x ED /@parametric true def } % if yes, then we have 2 values%%dr 0606
{ \ifPst@polarplot x \ifPst@algebraic RadtoDeg \fi PtoC /y ED /x ED \else /y ED \fi } ifelse
cleartomark
\ifx\psk@Derive\@NOTEMPTY%%begin dr 0606
%% algebraic we can use the derivative machine
/FDer@pstplot (#4) @parametric { (t) } { (x) } ifelse
tx@Derive begin Derive end tx@addDict begin AlgParser end cvx def
\fi%%end dr 0606
x \pst@number\psxunit mul y \pst@number\psyunit mul
translate % define the temporary origin
% now we calculate the slope of the tangent
\ifx\psk@Derive\@empty% de we have a derivation defined?
#2 abs 1.0e-6 lt % no, we choose secant for the tangent
{ #2 0.0005 add dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
{ /y2 ED /x2 ED } % we have 2 values
{ \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
cos mul /x2 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x2 x def \fi /y2 ED } ifelse
cleartomark % delete the mark
#2 0.0005 sub dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
{ /y1 ED /x1 ED }
{ \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
cos mul /x1 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x1 x def \fi /y1 ED } ifelse
cleartomark
y2 y1 sub x2 x1 sub } % dy dx
{ % > 1.0e-06
#2 1.0005 mul dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
{ /y2 ED /x2 ED } % we have 2 values
{ \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
cos mul /x2 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x2 x def \fi /y2 ED } ifelse
cleartomark
#2 .9995 mul dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
{ /y1 ED /x1 ED } % we have 2 values
{ \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
cos mul /x1 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x1 x def \fi /y1 ED } ifelse
cleartomark
y2 y1 sub \pst@number\psyunit mul x2 x1 sub \pst@number\psxunit mul } ifelse
atan % atan(dy dx), we have the slope angle of the secant
\else % there is a derivation defined
#2 dup /x ED /t ED tx@addDict begin mark FDer@pstplot end counttomark 1 gt % test, if we have parametricplot
{ /y ED /x ED }
{ \ifPst@polarplot /Fphi ED % the value F'(phi)
tx@addDict begin F@pstplot end x \ifPst@algebraic RadtoDeg \fi PtoC /y0 ED /x0 ED % the x y values
x \ifPst@algebraic RadtoDeg \fi sin Fphi mul x0 add /y ED
x \ifPst@algebraic RadtoDeg \fi cos Fphi mul y0 sub /x ED
\else /y ED /x 1 def \fi } ifelse
cleartomark
y \pst@number\psyunit mul x \pst@number\psxunit mul Atan \ifPST@Tnormal 90 add \fi
% y ATAN1 % we have the slope angle of the tangent. ATAN is defined int the pstricks.pro, patch 6
\fi
cvi 180 mod dup 90 gt { 180 sub } if % -90 <= angle <= 90
rotate % rotate, depending to the origin
/Lineto /lineto load def % the pro file needs /Lineto
[ % start array of points
\ifPST@Tnormal
0 0 % moveto
#3
y \pst@number\psyunit mul x \pst@number\psxunit mul Atan 90 add cos div \pst@number\psxunit mul 0 % lineto
\else % points are in reverse order ...
\ifx\pst@tempRight\@empty #3 \else \pst@tempRight\space \fi \pst@number\psxunit mul 0 % moveto
StarVersion { 0 }{\ifx\pst@tempRight\@empty #3 neg \else
\pst@tempLeft\space \fi \pst@number\psxunit mul} ifelse 0 % lineto
\fi
\pst@cp % kill the currentpoint, if any
false % don't show the points
\tx@Line
% ArrowA CP 4 2 roll ArrowB L % the line with arrows L is defined in pstricks.pro
% \pst@number\pslinewidth SLW % set linewidth in pt
% \@nameuse{psls@\pslinestyle} % linestyle
% \pst@usecolor\pslinecolor % linecolor
stroke % stroke everything
\ifshowpoints % show the points?
\psk@dotsize
\@nameuse{psds@\psk@dotstyle}%
0 0 Dot
\fi
grestore % restore old graphics state
}%
\use@pscode % part of \end@OpenObj
\endgroup% % part of \end@OpenObj
\@starfalse%
\ignorespaces% % part of \end@OpenObj
}%
%
\def\@varrkiv{varrkiv}% Runge-Kutta 4 with an adaptive step method
%% #1-#2 x range
%% #3 initial value of y (which is a vector) y(0) y'(0) y''(0) ...
%% #4 value of the derivative (y and t can be used)
%
\define@boolkey[psset]{pstricks-add}[Pst@]{GetFinalState}[true]{}
\define@key[psset]{pstricks-add}{filename}{\def\psk@filename{#1}}%
\define@boolkey[psset]{pstricks-add}[Pst@]{saveData}[true]{} % \ifPst@saveData
\psset[pstricks-add]{GetFinalState=false,saveData=false,filename=PSTdata}
%
\def\Begin@SaveFinalState{ end
/PST@beginspecial /@beginspecial load def
/PST@endspecial /@endspecial load def
/PST@setspecial /@setspecial load def
/@beginspecial {} def /@endspecial{} def /@setspecial {} def
tx@Dict begin
}
\newif\ifPst@BeginSaveFinalState \Pst@BeginSaveFinalStatefalse
\def\BeginSaveFinalState{\Pst@BeginSaveFinalStatetrue}
\def\End@SaveFinalState{
/@beginspecial /PST@beginspecial load def
/@endspecial /PST@endspecial load def
/@setspecial /PST@setspecial load def
}
\def\EndSaveFinalState{\pstverb{\End@SaveFinalState}}
\def\psplotDiffEqn{\pst@object{psplotDiffEqn}}% initial code by Dominique 2005-05-21
\def\psplotDiffEqn@i#1#2#3#4{%
\addbefore@par{xStart=#1}%
\pst@killglue%
\begingroup%
\use@par%
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{%
\ifPst@BeginSaveFinalState \Begin@SaveFinalState \fi
\ifPst@saveData /Pst@data (\psk@filename) (w) file def \fi
/x #1 def % first value
/x1 #2 def % last value
\ifPst@GetFinalState \Begin@SaveFinalState /y SaveFinalState def
\else /y [ #3 ] def \fi % values for t=0
/ylength y length def % number of elements in #3
/addvect {
1 1 ylength {
/i exch def
ylength i sub 2 add -1 roll add ylength 2 mul i sub 1 roll
} for
} def
/dx x1 x sub \psk@plotpoints\space div def
/mulvect {
ylength exch
1 index {
dup 4 -1 roll mul 2 index 2 add 1 roll
} repeat
pop pop } def
/divvect { ylength exch 1 index { dup 4 -1 roll exch div 2 index 2 add 1 roll } repeat pop pop } def
/k0 0 def /k1 0 def /k2 0 def /k3 0 def
\ifPst@algebraic /F@pstplot (#4) tx@addDict begin AlgParser end cvx def \fi
/Func {
\ifPst@algebraic F@pstplot ylength array astore
\else
\ifPst@buildvector\else y aload pop \fi #4
\ifPst@buildvector\else ylength array astore \fi
\fi
} def
\ifx\psk@method\@adams /F1 0 def /F2 0 def /F3 0 def /F4 0 def /F5 0 def /F6 0 def /INIT 1 def \fi
\ifx\psk@method\@empty\else
\ifx\psk@method\@varrkiv %% RUNGE-KUTTA method with var step algorithm
/VarStep false def /VarStepRatio 1 def
/RK {
/k0 Func { dx mul } forall ylength array astore def %% y
dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def %
x dup dx 2 div add /x exch def %% y x
/k1 Func { dx mul } forall ylength array astore def %% y x
exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y
/k2 Func { dx mul } forall ylength array astore def %% x y
dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x
/k3 Func { dx mul } forall ylength array astore def %% y x
/x exch def %% y
dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect
2 mulvect addvect k3 aload pop addvect
6 divvect addvect y astore
} def
/VARRK {
VarStep
%{ /dx dx \psk@varstepincrease\space mul def /VarStep false def } if
{ /dx dx VarStepRatio mul def /VarStep false def } if
x dx add x1 gt { /dx x1 x sub def } if
%{ /dx dx \psk@varstepdecrease\space div def } ifelse
%% we compute y(x+dx) from y(x) using RK4
RK %% y(x) y(x+dx)
exch /y exch def /dx dx 2 div def
{ %% we compute y(x+dx/2) from y(x) using RK4
y RK %% y(x+dx) y(x+dx/2)
%% then y(x+dx) from y(x+dx/2) using RK4
/y exch def y RK %% y(x+dx) y(x) y(x+dx/2) y(x+dx)
dup aload pop 4 ylength add -1 roll
{ -1 mul } forall addvect 0 ylength { exch abs 2 copy lt { exch } if pop } repeat
0 3 -1 roll {abs 2 copy lt { exch } if pop } forall
dup 1e-6 lt { pop } { div } ifelse
/dx dx 2 mul def
dup \psk@varsteptol\space lt
%{ \psk@varsteptol\space div .1 lt { /VarStep true def } if pop exit } if
%pop /dx dx 4 div def exch /y exch def } loop
{ .001 div dup .1 lt
{ dup 1e-6 lt { pop 3 } { log neg } ifelse /VarStepRatio exch def /VarStep true def }
{ pop } ifelse pop exit } if
pop /dx dx 4 div def exch /y exch def } loop
} def
\else %% RUNGE-KUTTA & ADAMS methods
/RK {
/k0 Func { dx mul } forall ylength array astore def %% y
dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def %
x dup dx 2 div add /x exch def %% y x
/k1 Func { dx mul } forall ylength array astore def %% y x
exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y
/k2 Func { dx mul } forall ylength array astore def %% x y
dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x
/k3 Func { dx mul } forall ylength array astore def %% y x
/x exch def %% y
dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect
2 mulvect addvect k3 aload pop addvect
6 divvect addvect y astore pop
} def
\ifx\psk@method\@adams
/ADAMS {
\ifcase\psk@adamsorder
\errmessage{pstricks-add error: no order 0th for adams method (see user's manual)}
\or\errmessage{pstricks-add error: no order 1st for adams method (see user's manual)}
\or\errmessage{pstricks-add error: no order 2nd for adams method (see user's manual)}
\or\errmessage{pstricks-add error: no order 3rd for adams method (see user's manual)}
\or
%% ORDRE 4
F4 aload pop 55 mulvect
F3 aload pop -59 mulvect addvect
F2 aload pop 37 mulvect addvect
F1 aload pop -9 mulvect addvect
dx mulvect 24 divvect
\or
%% ORDRE 5
F5 aload pop 1901 mulvect
F4 aload pop -2774 mulvect addvect
F3 aload pop 2616 mulvect addvect
F2 aload pop -1274 mulvect addvect
F1 aload pop 251 mulvect addvect
dx mulvect 720 divvect
\or
%% ORDRE 6
F6 aload pop 4277 mulvect
F5 aload pop -7923 mulvect addvect
F4 aload pop 9982 mulvect addvect
F3 aload pop -7298 mulvect addvect
F2 aload pop 2877 mulvect addvect
F1 aload pop -475 mulvect addvect
dx mulvect 1440 divvect
\fi
y aload pop addvect ylength array astore /y exch def } def
\fi
\fi
\fi
/xy {
\ifx\psk@plotfuncx\@empty
\ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi
\else \psk@plotfuncx\space \fi
\pst@number\psxunit mul y
\ifx\psk@method\@empty %% EULER method
/y Func { dx mul } forall y aload pop addvect ylength array astore def
\else%
\ifx\psk@method\@varrkiv %% RUNGE-KUTTA method
VARRK
\else\ifx\psk@method\@rkiv %% RUNGE-KUTTA method
RK
\else
/F1 F2 def /F2 F3 def /F3 F4 def /F4 %% ADAMS method
\ifcase\psk@adamsorder\or\or\or\or
%% ORDRE 4
Func def
\or
%% ORDRE 5
F5 def /F5 Func def
\or
%% ORDRE 6
F5 def /F5 F6 def /F6 Func def
\fi
INIT \psk@adamsorder\space lt
{ RK /INIT INIT 1 add def }
{ ADAMS } ifelse
\fi\fi
\fi
\ifx\psk@plotfuncy\@empty
\ifx\psk@whichord\@empty 0 \else \psk@whichord\space \fi get %
\else \psk@plotfuncy\space \fi
\pst@number\psyunit mul
% Pst@data (\string\[) writestring
\ifPst@saveData
2 copy
\pst@number\psyunit div exch \pst@number\psxunit div
20 string cvs Pst@data exch writestring
Pst@data (\space) writestring
20 string cvs Pst@data exch writestring
% Pst@data (\string\]) writestring
Pst@data (\string\n) writestring
\fi
} def
}%
\gdef\psplot@init{}%
\@pstfalse
\@nameuse{testqp@\psplotstyle}%
\if@pst\psplot@ii\else\psplot@iii\fi
\addto@pscode{\ifPst@saveData Pst@data closefile \fi}
\endgroup%
\ignorespaces%
}
%
%
\def\psGTriangle{\pst@object{psGTriangle}}
\def\psGTriangle@i(#1)(#2)(#3)#4#5#6{{%
\def\solid@star{}%
\begin@ClosedObj
\pst@getcoor{#1}\pst@tempA % A: "rgb xr xg xb" or "gray xg"
\pst@getcoor{#2}\pst@tempB % B
\pst@getcoor{#3}\pst@tempC % C
\pst@getcolor{#4}\pst@colorA
\pst@getcolor{#5}\pst@colorB
\pst@getcolor{#6}\pst@colorC
\addto@pscode{%
\pst@tempC % C
\pst@tempB % B
\psk@gangle % rotating angle
\pst@tempA % A, temporary origin
/rgb {} def
/gray {} def
[ \pst@colorC ] aload length 1 eq { dup dup } if 3 array astore % gray -> rgb
[ \pst@colorB ] aload length 1 eq { dup dup } if 3 array astore
[ \pst@colorA ] aload length 1 eq { dup dup } if 3 array astore
tx@addDict begin GTriangle end % PS part
}%
\if@star\pspolygon[fillstyle=none](#1)(#2)(#3)\fi% draw borderline
\def\pst@linetype{2}%
\end@ClosedObj%
}\ignorespaces}
%
\def\psdice{\pst@object{psdice}}
\def\psdice@i#1{{%
\pst@killglue%
\addbefore@par{framearc=0.3,linewidth=1pt}%
\use@par%
\psframe(-0.5,-0.5)(0.5,0.5)%
\ifodd#1 \qdisk(0,0){0.1\psunit}\else\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}\fi
\ifcase#1%
\or\or\or\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}% 3
\or\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}% 4
\or\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}% 5
\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}
\or\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}% 6
\qdisk(-0.3,0){0.1\psunit}\qdisk(0.3,0){0.1\psunit}%
\fi%
\ignorespaces%
}}
%
\define@key[psset]{pstricks-add}{IQLfactor}{\pst@checknum{#1}\pst@IQLfactor}
%\psset[pstricks-add]{IQLfactor=1.5}
%
\def\psBoxplot@ii{%
\addto@pscode{
/Barwidth \number\Add@barwidth 2 div def
/Endwidth Barwidth \psk@arrowlength\space mul def
tx@addDict begin % BSort from pro file
NArray bubblesort end
/NArray ED % save sorted array
[ NArray { yUnit mul } forall ] /NArray ED % multiply with y unit
NArray 0 get /MinVal ED % save minimum
NArray m 1 sub get /MaxVal ED % maximum
m 2 div cvi /M ED % the middle
NArray length 2 mod 0 eq { % even numbers of entries
M 1 sub NArray exch get % even number of values
NArray M get % and the upper one
add 2 div /Median ED % the median
}{
NArray M get /Median ED % odd numbers of values
} ifelse
m 2 mod 1 eq { % get the lower Quartil even/odd
M 2 div cvi 1 add dup /M2 ED % save middle index
1 sub NArray exch get
NArray M2 get
add 2 div /LowerQuartil ED
}{
NArray M 2 div cvi get /LowerQuartil ED
} ifelse % end even/odd
m 2 mod 1 eq { % get the upper Quartil
M 1.5 mul cvi 1 add dup /M3 ED
1 sub NArray exch get
NArray M3 get
add 2 div /UpperQuartil ED
}{ % upper quartil
NArray M 1.5 mul cvi get /UpperQuartil ED
} ifelse
/IQL UpperQuartil LowerQuartil sub \pst@IQLfactor\space mul def
0 1 m 1 sub { % Index on stack
dup /Index ED
NArray exch get LowerQuartil sub abs IQL sub 0 gt {
newpath 0 NArray Index get 2 0 360 arc gsave
1 0 0 setrgbcolor fill grestore
stroke closepath
NArray Index 1 add get /MinVal ED }{ exit } ifelse
} for
m 1 sub -1 0 { % Index on stack
dup /Index ED
NArray exch get UpperQuartil sub abs IQL sub 0 gt {
newpath 0 NArray Index get 2 0 360 arc gsave
1 0 0 setrgbcolor fill grestore
stroke closepath
NArray Index 1 sub get /MaxVal ED }{ exit } ifelse
} for
%
Endwidth neg MaxVal moveto % we are on top
Endwidth dup add 0 rlineto
0 MaxVal moveto
0 UpperQuartil lineto % upper quartil
0 LowerQuartil moveto
0 MinVal lineto
Endwidth neg MinVal moveto
Endwidth dup add 0 rlineto
gsave
\pst@number\pslinewidth SLW
\pst@usecolor\pslinecolor
\tx@setStrokeTransparency
\tx@setStrokeTransparency
\@nameuse{psls@\pslinestyle}
stroke
grestore
newpath
Barwidth neg LowerQuartil moveto % lower quartil
Barwidth neg UpperQuartil lineto
Barwidth dup add 0 rlineto
Barwidth LowerQuartil lineto
closepath
gsave \pst@usecolor\psfillcolor \tx@setTransparency fill grestore
Barwidth neg Median moveto % median
Barwidth dup add 0 rlineto
\pst@number\pslinewidth SLW
\pst@usecolor\pslinecolor
\tx@setStrokeTransparency
\tx@setStrokeTransparency
\@nameuse{psls@solid}
}}%
\def\beginplot@Boxplot{\init@pscode}
\def\endplot@Boxplot{%
\psBoxplot@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi%
\pst@stroke
\end@SpecialObj}
\def\psBoxplot{\def\pst@par{}\pst@object{psBoxplot}}
\def\psBoxplot@i#1{%
\leavevmode
\pst@killglue
\begingroup
\addbefore@par{barwidth=40pt,arrowlength=0.75}%
\addto@par{plotstyle=Boxplot}%
\use@par
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{
/D {} def
[ #1 ] /NArray ED
NArray aload length /m ED
/xUnit \pst@number\psxunit def
/yUnit \pst@number\psyunit def
}%
\@nameuse{endplot@\psplotstyle}%
\ignorespaces%
}
% the datafile must be a matrix with
% /dotmatrix [
% .....
% .....
% ] def
%
\define@key[psset]{pstricks-add}{colorType}[0]{\def\psk@colorType{#1}}
\psset[pstricks-add]{colorType=0} % 0-> two color mode 1->wavelength mode (400..700nm)
\def\psMatrixPlot{\pst@object{psMatrixPlot}}
\def\psMatrixPlot@i#1#2#3{%
\pst@killglue%
\addbefore@par{xStep=1,yStep=1}%
\begin@SpecialObj%
\addto@pscode{
(#3) run % load the data file
/Min 0 def /Max 0 def
dotmatrix { dup Min lt { /Min ED } { dup Max gt { /Max ED } { pop } ifelse } ifelse } forall
/dMaxMin Max Min sub def
\psk@dotsize
\@nameuse{psds@\psk@dotstyle} %
/n 0 def % index for element
1 1 #1 { % the y loop (outer one)
/y exch def % save y
1 1 #2 { % the x loop (inner one)
/x exch def % save x
dotmatrix n get % get value from matrix
\ifcase\psk@colorType
dup 0 gt { % test if > 0
\or
Min sub dMaxMin div 300 mul 400 add
tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor
\or
Min sub dMaxMin div neg 1 add 300 mul 400 add
tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor
\fi
x \psk@xStep\space mul \pst@number\psxunit mul
\ifPst@ChangeOrder #1 y sub 1 add \else y \fi \psk@yStep\space mul \pst@number\psyunit mul Dot%
\ifcase\psk@colorType
} { pop } ifelse
\fi
/n n 1 add def
} for
} for
}%
\end@SpecialObj%
\ignorespaces%
}
%
\newdimen\chart@ColorIndex
\newdimen\chart@ColorStep
\newdimen\pst@chartHeight
\newdimen\pst@chartStackDepth
\newdimen\pst@chartStackWidth
\newcount\chart@Toggle
\newif\if@chartSep
\newif\if@chartUserColor
%
\define@key[psset]{pstricks-add}{chartStyle}{\def\psk@chartStyle{#1}}
\psset[pstricks-add]{chartStyle=pie}% p)ie P)ie-3d-view h)istogram H)istogram-3dview
%
\define@key[psset]{pstricks-add}{chartColor}{\pst@expandafter\psk@@chartColor{#1}\@nil}
\def\psk@@chartColor#1#2\@nil{%
\ifx#1r\def\psk@chartColor{2}\else
\ifx#1c\def\psk@chartColor{380}\else\def\psk@chartColor{0}\fi\fi}
\psset[pstricks-add]{chartColor=gray}% gray, color, randomColor
%
\define@key[psset]{pstricks-add}{chartSep}{\pst@getlength{#1}\psk@chartSep}
\define@key[psset]{pstricks-add}{chartStack}{\pst@getint{#1}\psk@chartStack}
\define@key[psset]{pstricks-add}{chartStackDepth}{\pssetylength\pst@chartStackDepth{#1}}
\define@key[psset]{pstricks-add}{chartStackWidth}{\pssetxlength\pst@chartStackWidth{#1}}
\define@key[psset]{pstricks-add}{chartHeight}{\pssetylength\pst@chartHeight{#1}}
\psset[pstricks-add]{chartSep=10pt,chartStack=0,chartStackDepth=2cm,chartStackWidth=2cm,
chartHeight=5mm}
%
\define@key[psset]{pstricks-add}{userColor}{%
\chart@Toggle=0
\def\chart@option{#1}
\ifx\chart@option\@empty\@chartUserColorfalse
\else
\@chartUserColortrue
\expandafter\psk@@chartUserColor#1,,\@nil
\fi}
\def\psk@@chartUserColor#1,#2,#3\@nil{%
\advance\chart@Toggle by \@ne%
\xglobal\colorlet{chartFillColor\the\chart@Toggle}{#1}%
\def\chart@option{#2}
\ifx\chart@option\@empty\else\psk@@chartUserColor#2,#3,\@nil\fi}%
\psset[pstricks-add]{userColor={}}
\define@key[psset]{pstricks-add}{chartNodeI}{\def\psk@chartNodeI{#1}}
\define@key[psset]{pstricks-add}{chartNodeO}{\def\psk@chartNodeO{#1}}
\psset[pstricks-add]{chartNodeI=0.75,chartNodeO=1.5}
%
\def\psChart{\pst@object{psChart}}
\def\psChart@i#1#2#3{%
% #1:values #2:separated charts
% #3 radius->pie; max height->histogram
\pst@killglue%
\global\pssetylength\pst@chartHeight{#3}%
\global\let\pst@chartRadius\pst@chartHeight%
\begingroup%
\def\psk@chartValues{#1}%
\def\psk@chartSepValues{#2}% only valid for a pie chart
\pst@dimm=\z@\relax% sum of all entries (for a pie)
\pst@cnta=1\relax% number of entries
\pst@dimn=\z@\relax% greatest entry
\psforeach{\chart@tempA}{#1}{%
\global\advance\pst@cnta by \@ne% % no of entries
\global\advance\pst@dimm by \chart@tempA\p@% % sum of all entries
\pst@dima=\chart@tempA\p@%
\ifdim\pst@dima>\pst@dimn\relax
\global\pst@dimn=\pst@dima\fi%
}%
\addbefore@par{dimen=outer}%
\begin@SpecialObj%
\ifnum\psk@chartColor>0\relax
\chart@ColorStep=400\p@\else\chart@ColorStep=\p@\fi % the "numerical color"
\divide\chart@ColorStep by \pst@cnta% % step =1/no or 400/no
\chart@ColorIndex=\psk@chartColor\p@% % the start color (gray or wave)
\@nameuse{pscs@\psk@chartStyle}%
\end@SpecialObj%
\endgroup%
\ignorespaces%
}
%
\def\pscs@pie{%
\degrees[\pst@number\pst@dimm]% % instead of 360 degrees
\def\chart@alpha{0}%
\pst@dimm=\z@\pst@dimn=\z@\pst@dimo=\z@\pst@cnta=0\relax
\global\chart@Toggle=1\relax
\ifpsshadow% create shadow first
\psforeach{\chart@tempA}{\psk@chartValues}{%
\global\advance\pst@dimm by \chart@tempA\p@%
\global\advance\pst@dimn by \chart@alpha\p@%
\global\advance\pst@cnta by \@ne%
\pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart
\global\@chartSepfalse%
\psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax
\global\@chartSeptrue\fi}%
\if@chartSep%
\pswedge(\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
\else%
\pswedge(0,0){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
\fi%
\global\let\chart@alpha\chart@tempA%
}%
\psshadowfalse%
\fi%
\def\chart@alpha{0}%
\pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0\relax%
\psforeach{\chart@tempA}{\psk@chartValues}{%
\global\advance\pst@dimm by \chart@tempA\p@%
\global\advance\pst@dimn by \chart@alpha\p@%
\def\pst@tempB{\pst@number\chart@ColorIndex}%
\psDEBUG[psChart:wave:color]{\pst@tempB}%
\global\advance\pst@cnta by \@ne%
\if@chartUserColor\else%
\def\chart@FillColor{chartFillColor\the\pst@cnta}%
\ifnum\psk@chartColor>0\relax%
\xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}%
\else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi%
\fi%
\pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart
\global\@chartSepfalse%
\psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax%
\global\@chartSeptrue\fi}%
\if@chartSep%
\pswedge[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]%
(\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
\pst@dima=\pst@chartRadius\advance\pst@dima by \psk@chartSep\p@%
\pnode(\pst@dima;\pst@number\pst@dimo){psChart\the\pst@cnta}%
\pst@dimb=\psk@chartNodeI\pst@dima%
\pst@dimc=\psk@chartNodeO\pst@dima%
\pnode(\pst@dimb;\pst@number\pst@dimo){psChartI\the\pst@cnta}%
\pnode(\pst@dimc;\pst@number\pst@dimo){psChartO\the\pst@cnta}%
\else%
\pswedge[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}](0,0)%
{\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
\pnode(\pst@chartRadius;\pst@number\pst@dimo){psChart\the\pst@cnta}%
\pst@dima=\pst@chartRadius%
\pst@dimb=\psk@chartNodeI\pst@dima%
\pst@dimc=\psk@chartNodeO\pst@dima%
\pnode(\pst@dimb;\pst@number\pst@dimo){psChartI\the\pst@cnta}%
\pnode(\pst@dimc;\pst@number\pst@dimo){psChartO\the\pst@cnta}%
\fi%
\global\let\chart@alpha\chart@tempA%
\global\advance\chart@Toggle by \@ne%
\ifnum\chart@Toggle<3\relax
\global\advance\chart@ColorIndex by 2\chart@ColorStep%
\else%
\global\chart@Toggle=0%
\global\advance\chart@ColorIndex by -\chart@ColorStep%
\fi%
}% end foreach
}
%
\def\pscs@histogram{%
\def\chart@maxValue{\pst@number\pst@dimn}% max of the data
\pst@@divide\pst@dimn\pst@chartHeight% maxValue/maxHeight
\psDEBUG[pscs@histogram]{chart@maxValue=\chart@maxValue}
\psDEBUG[pscs@histogram]{(maxValue/maxHeight)pst@dimg=\pst@number\pst@dimg}
\psDEBUG[pscs@histogram]{pst@chartHeight=\the\pst@chartHeight}
\pst@dimo=28.46\pst@dimg
\edef\pst@chartUnit{\pst@number\pst@dimo}
% \psaxes[axesstyle=frame,
% dy=1cm,Dy=\pst@number\pst@dimo](\the\pst@cnta,\the\pst@chartHeight)
\pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0%
\global\chart@Toggle=1
\psforeach{\chart@tempA}{\psk@chartValues}{%
\global\advance\pst@dimm by \chart@tempA pt%
\def\pst@tempB{\pst@number\chart@ColorIndex}%
\psDEBUG[psChart:wave:color]{\pst@tempB}%
\global\advance\pst@cnta by \@ne%
\if@chartUserColor\else
\def\chart@FillColor{chartFillColor\the\pst@cnta}
\ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}%
\else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi%
\fi
\psframe[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]%
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub 0)
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div add \chart@tempA\space \pst@chartUnit\space div)
\pnode(!\the\pst@cnta\space 0){psChart\the\pst@cnta}%
\pnode(!\the\pst@cnta\space \chart@tempA\space 2 div \pst@chartUnit\space div){psChartM\the\pst@cnta}%
\pnode(!\the\pst@cnta\space \chart@tempA\space \pst@chartUnit\space div){psChartT\the\pst@cnta}%
\global\advance\chart@Toggle by \@ne
\ifnum\chart@Toggle<3
\global\advance\chart@ColorIndex by 2\chart@ColorStep
\else
\global\chart@Toggle=0
\global\advance\chart@ColorIndex by -\chart@ColorStep%
\fi%
}% end foreach
}
%
\def\pst@stackList{}
\def\addbefore@stackList#1{%
\ifx\pst@stackList\@empty
\xdef\pst@stackList{#1}%
\else
\toks@{#1}%
\pst@toks\expandafter{\pst@stackList}%
\xdef\pst@stackList{\the\toks@,\the\pst@toks}%
\fi%
}
%
\def\pscs@Histogram{%
\psDEBUG[pscs@Histogram]{psk@chartStack=\psk@chartStack}%
\def\chart@maxValue{\pst@number\pst@dimn}% max of the data
\pst@@divide\pst@dimn\pst@chartHeight% maxValue/maxHeight
\psDEBUG[pscs@Histogram]{chart@maxValue=\chart@maxValue}%
\psDEBUG[pscs@Histogram]{(maxValue/maxHeight)pst@dimg=\pst@number\pst@dimg}%
\psDEBUG[pscs@Histogram]{pst@chartHeight=\the\pst@chartHeight}%
\pst@dimo=28.46\pst@dimg%
\edef\pst@chartUnit{\pst@number\pst@dimo}%
% \psaxes[axesstyle=frame,
% dy=1cm,Dy=\pst@number\pst@dimo](\the\pst@cnta,\the\pst@chartHeight)
\pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0%
\global\chart@Toggle=1 % for color toggling
\pst@cntn=0 % stacked step
\pst@cnto=0 % for a stacked view
\pst@cntp=\psk@chartStack % for a stacked view
\def\pst@stackList{}
\psDEBUG[pscs@Histogram]{psk@chartStack=\the\pst@cntp}%
\psforeach{\chart@tempA}{\psk@chartValues}{% the loop
\ifnum\pst@cntp>0 % stacked version?
\advance\pst@cnto by \@ne % increase
\psDEBUG[pscs@Histogram]{chart@tempA=\chart@tempA}%
\expandafter\addbefore@stackList\expandafter{\chart@tempA}%
\psDEBUG[pscs@Histogram]{stack list=\pst@stackList}%
\ifnum\pst@cnto=\pst@cntp % draw?
\pst@cnto=\psk@chartStack\advance\pst@cnto by \m@ne
\psforeach{\chart@tempB}{\pst@stackList}{% the stack loop
\global\pst@cnta=\pst@cntn % we do not need the value
\psDEBUG[pscs@Histogram]{pst@cnto=\the\pst@cnto}%
\psDEBUG[pscs@Histogram]{pst@chartStackDepth=\the\pst@chartStackDepth}%
\psDEBUG[pscs@Histogram]{pst@chartStackWidth=\the\pst@chartStackWidth}%
\edef\pst@tempA{\the\pst@cnto}%
\psDEBUG[pscs@Histogram]{pst@tempA=\pst@tempA}%
\ifnum\pst@cnto>0
\pst@dima=\pst@chartStackDepth%
\pst@dimb=\pst@chartStackWidth%
\divide \pst@dima by \pst@tempA%
\divide \pst@dimb by \pst@tempA%
\else\pst@dima=\z@ \pst@dimb=\z@%
\fi%
\rput(\the\pst@dima, \the\pst@dimb){\pscs@Histogram@i{\chart@tempB}}
\advance\pst@cnto by \m@ne % decrease stack counter
}%
\advance\pst@cntn by \tw@ % increase
\def\pst@stackList{}% reset stack list
\pst@cnto=0 % reset stack counter
\fi%
\else%
\pscs@Histogram@i{\chart@tempA}% non stacked version
\fi%
}% end foreach
}
%
\def\pscs@Histogram@i#1{% draw the 3d-like bar
\def\pst@tempB{\pst@number\chart@ColorIndex}%
\global\advance\pst@cnta by \@ne%
\if@chartUserColor\else
\def\chart@FillColor{chartFillColor\the\pst@cnta}
\ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}%
\else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi%
\fi
\pspolygon[fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]%
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub 0)% ll
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div add 0)% lr
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add \psk@chartSep\space 56.92 div)% 'lr
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add
\psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ur
(!\the\pst@cnta\space \psk@chartSep\space 56.92 div sub
\psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ul
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub #1 \pst@chartUnit\space div)%ul
\psline%
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div add 0)% lr
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div add #1 \pst@chartUnit\space div)
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub #1 \pst@chartUnit\space div)%ul
\psline%
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div add #1 \pst@chartUnit\space div)
(!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add
\psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ur
\pnode(!\the\pst@cnta\space 0){psChart\the\pst@cnta}%
\pnode(!\the\pst@cnta\space #1 2 div \pst@chartUnit\space div){psChartM\the\pst@cnta}%
\pnode(!\the\pst@cnta\space #1 \pst@chartUnit\space div){psChartT\the\pst@cnta}%
\global\advance\chart@Toggle by \@ne
\ifnum\chart@Toggle<3
\global\advance\chart@ColorIndex by 2\chart@ColorStep
\else
\global\chart@Toggle=0
\global\advance\chart@ColorIndex by -\chart@ColorStep%
\fi%
\global\advance\chart@ColorIndex by 1pt
}
%
\def\psCancel{\pst@object{psCancel}}% by Stefano Baroni 2008-06-21
\def\psCancel@i{\pst@makebox\psCancel@ii}
\def\psCancel@ii{%
\begingroup
\solid@star
\use@par
\pst@dima=\pslinewidth
\advance\pst@dima by \psframesep
\pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima
\pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima
\pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima
\setbox\pst@hbox=\hbox{%
\ifpsboxsep\kern\pst@dima\fi
\begin@ClosedObj
\addto@pscode{
\psk@cornersize % arcradius boolean
\pst@number\pst@dima neg
\pst@number\pst@dimb neg
\pst@number\pst@dimc
\pst@number\pst@dimd
.5
\if@star \tx@Frame \else
CLW mul /a ED % the middle of the line
3 -1 roll 2 copy gt { exch } if
a sub /y2 ED
a add /y1 ED
2 copy gt { exch } if
a sub /x2 ED
a add /x1 ED
pop pop % delete arc values
x1 y1 moveto
x2 y2 lineto
x2 y1 moveto
x1 y2 lineto
\fi
}%
\def\pst@linetype{2}%
\showpointsfalse
\end@ClosedObj
\box\pst@hbox
\ifpsboxsep\kern\pst@dima\fi%
}%
\ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi
\leavevmode\box\pst@hbox
\endgroup%
}
%
\def\resetOptions{%
\@zero=0%
\def\pst@linetype{0}%
\pstScalePoints(1,1){}{}%
\psset[pstricks-add]{%
hooklength=3mm, hookwidth=1mm,
ArrowFill=true,
ArrowInside={}, ArrowInsidePos=0.5,
ArrowInsideNo=1, ArrowInsideOffset=0,
arrowLW=0,
dashNo=0.2,linecap=0,
xyAxes=true,
xlabelPos=bottom, ylabelPos=left,
trigLabels=false,trigLabelBase=0,
xDecimals={},yDecimals={},
xlogBase={},ylogBase={},
labelFontSize={},mathLabel,
logLines=none,
ignoreLines=0,
nStep=1,nStart=0,nEnd={},
xStep=0,yStep=0,xStart={},xEnd={},yStart={},yEnd={},comma=false,
decimalSeparator=.,
plotNo=1,plotNoMax=1,
xAxisLabel=x,yAxisLabel=y,
yAxisLabelPos={},xAxisLabelPos={},
llx=\z@, lly=\z@, urx=\z@, ury=\z@,% prevents rounding errors
randomPoints=1000,color=false,
method={},whichabs={},whichord={},
plotfuncx={},plotfuncy={},buildvector=false,
% algebraic=false, % individuelly set
Derive={},adamsorder=4,
VarStep=false, PlotDerivative=none, VarStepEpsilon=default,
varsteptol=.001,
Tnormal=false,
braceWidth=2\pslinewidth,
bracePos=0.5,
braceWidthInner=10\pslinewidth,
braceWidthOuter=10\pslinewidth,
chartNodeI=0.75,
chartNodeO=1.5,
IQLfactor=1.5,
showOriginTick
}
\psset{%
%%%% pstricks %%%%%%%%
% opacity=1,
% blendmode=0,
% shapealpha=0.6,
unit=1cm,%
swapaxes=false,%
showpoints=false,%
border=0pt, bordercolor=white,%
doubleline=false, doublesep=1.25\pslinewidth,%
doublecolor=white,%
shadow=false, shadowsize=3pt, shadowangle=-45, shadowcolor=darkgray,%
linewidth=.8pt,%
linecolor=black,%
maxdashes=11, dash=5pt 3pt, dashadjust=true, %
dotsep=3pt,%
linestyle=solid,%
fillcolor=white,%
hatchwidth=.8pt, hatchsep=4pt, hatchcolor=black, hatchangle=45,%
hatchsepinc=0pt,hatchwidthinc=0pt,%
fillstyle=none,%
nArrows=2,%
arrows=-, arrowscale=1, arrowsize=1.5pt 2, arrowlength=1.4, arrowinset=.4,%
tbarsize=2pt 5,%
bracketlength=.15, rbracketlength=.15,%
liftpen=0, linetype=0,%
gangle=0,%
curvature=1 .1 0,%
dotsize=2pt 2,%
dotangle=0, dotscale=1, dotstyle=*,%
linearc=0pt,%
framearc=0,%
cornersize=relative,%
dimen=middle,%
gridwidth=.8pt, griddots=0, gridcolor=black,%
subgridwidth=.4pt, subgridcolor=gray, subgriddots=0, subgriddiv=5,%
gridlabels=10pt, gridlabelcolor=black,%
framesep=3pt, boxsep=true,%
trimode=U,%
arcsep=0,radius=.25cm,%
ref=c,rot=0,labelsep=5pt,refangle=0,%
intSeparator={,},%
%%%%%%%%% pst-plot %%%%%%%%%%%%%
labelFontSize={},%
StepType=lower, % alternative SumType=upper
plotstyle=line,plotpoints=50,%
% barwidth=0.25cm,% individuell set
ticksize=-4pt 4pt,
tickstyle=full, ticks=all,%
subticksize=0.75,subticks=1,tickcolor=black,%
ticklinestyle=solid,subticklinestyle=solid,%
subtickcolor=gray,%
tickwidth=0.5\pslinewidth,subtickwidth=0.25\pslinewidth,%
labels=all,Ox=0,Dx=1,dx=0,Oy=0,Dy=1,dy=0,%
xlabelFactor=\relax,ylabelFactor=\relax,%
showorigin=true,%
axesstyle=axes,%
ChangeOrder=false,%
arrowscale=1,%
%%%%%%%%% pst-node %%%%%%%%%%
lineAngle=0,
nodealign=false,
href=0,
vref=.7ex,
framesize=10pt,
nodesep=0pt,
arm=10pt,
offset=0pt,
angle=0,
arcangle=8,
ncurv=.67,
loopsize=1cm,
boxsize=.4cm,
nrot=0,
npos=,
tpos=0.5,
shortput=none,
colsep=1.5cm,
rowsep=1.5cm,
mcol=c,
mnode=R,
emnode=none%
}}
%
\resetOptions
%
\catcode`\@=\PstAtCode\relax
%
%% END: pstricks-add.tex
\endinput
|